]> code.delx.au - gnu-emacs/commitdiff
Merge from emacs-24
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 17 Jul 2012 11:52:00 +0000 (07:52 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 17 Jul 2012 11:52:00 +0000 (07:52 -0400)
1201 files changed:
.dir-locals.el
BUGS
ChangeLog
INSTALL
INSTALL.BZR
Makefile.in
README
admin/CPP-DEFINES
admin/ChangeLog
admin/MAINTAINERS
admin/admin.el
admin/bzrmerge.el
admin/coccinelle/README [new file with mode: 0644]
admin/coccinelle/build_string.cocci [new file with mode: 0644]
admin/coccinelle/list_loop.cocci [new file with mode: 0644]
admin/coccinelle/vector_contents.cocci [new file with mode: 0644]
admin/coccinelle/xzalloc.cocci [new file with mode: 0644]
admin/make-emacs
admin/make-tarball.txt
admin/merge-gnulib [new file with mode: 0755]
admin/notes/multi-tty
admin/quick-install-emacs
admin/unidata/BidiMirroring.txt
admin/unidata/Makefile.in
admin/unidata/README
admin/unidata/UnicodeData.txt
admin/unidata/copyright.html
autogen.sh
autogen/Makefile.in
autogen/aclocal.m4
autogen/config.in
autogen/configure
autogen/copy_autogen
autogen/update_autogen
build-aux/move-if-change
build-aux/snippet/_Noreturn.h
build-aux/snippet/arg-nonnull.h
build-aux/snippet/c++defs.h
build-aux/snippet/warn-on-use.h
build-aux/update-subdirs [moved from update-subdirs with 100% similarity]
config.bat
configure.ac [moved from configure.in with 71% similarity]
doc/emacs/ChangeLog
doc/emacs/Makefile.in
doc/emacs/ack.texi
doc/emacs/anti.texi
doc/emacs/basic.texi
doc/emacs/buffers.texi
doc/emacs/building.texi
doc/emacs/calendar.texi
doc/emacs/cmdargs.texi
doc/emacs/commands.texi
doc/emacs/custom.texi
doc/emacs/display.texi
doc/emacs/emacs.texi
doc/emacs/emacsver.texi
doc/emacs/entering.texi
doc/emacs/files.texi
doc/emacs/fixit.texi
doc/emacs/frames.texi
doc/emacs/glossary.texi
doc/emacs/gnu.texi
doc/emacs/help.texi
doc/emacs/indent.texi
doc/emacs/killing.texi
doc/emacs/kmacro.texi
doc/emacs/m-x.texi
doc/emacs/macos.texi
doc/emacs/maintaining.texi
doc/emacs/makefile.w32-in
doc/emacs/mark.texi
doc/emacs/mini.texi
doc/emacs/misc.texi
doc/emacs/modes.texi
doc/emacs/msdog.texi
doc/emacs/mule.texi
doc/emacs/programs.texi
doc/emacs/regs.texi
doc/emacs/screen.texi
doc/emacs/search.texi
doc/emacs/text.texi
doc/emacs/trouble.texi
doc/emacs/windows.texi
doc/emacs/xresources.texi
doc/lispintro/ChangeLog
doc/lispintro/Makefile.in
doc/lispintro/emacs-lisp-intro.texi
doc/lispintro/makefile.w32-in
doc/lispref/ChangeLog
doc/lispref/Makefile.in
doc/lispref/abbrevs.texi
doc/lispref/advice.texi
doc/lispref/anti.texi
doc/lispref/backups.texi
doc/lispref/buffers.texi
doc/lispref/commands.texi
doc/lispref/compile.texi
doc/lispref/control.texi
doc/lispref/customize.texi
doc/lispref/debugging.texi
doc/lispref/display.texi
doc/lispref/doclicense.texi
doc/lispref/edebug.texi
doc/lispref/elisp-covers.texi [deleted file]
doc/lispref/elisp.texi
doc/lispref/errors.texi
doc/lispref/eval.texi
doc/lispref/files.texi
doc/lispref/frames.texi
doc/lispref/front-cover-1.texi [deleted file]
doc/lispref/functions.texi
doc/lispref/gpl.texi
doc/lispref/hash.texi
doc/lispref/help.texi
doc/lispref/hooks.texi
doc/lispref/index.texi
doc/lispref/internals.texi
doc/lispref/intro.texi
doc/lispref/keymaps.texi
doc/lispref/lists.texi
doc/lispref/loading.texi
doc/lispref/macros.texi
doc/lispref/makefile.w32-in
doc/lispref/maps.texi
doc/lispref/markers.texi
doc/lispref/minibuf.texi
doc/lispref/modes.texi
doc/lispref/nonascii.texi
doc/lispref/numbers.texi
doc/lispref/objects.texi
doc/lispref/os.texi
doc/lispref/package.texi
doc/lispref/positions.texi
doc/lispref/processes.texi
doc/lispref/searching.texi
doc/lispref/sequences.texi
doc/lispref/streams.texi
doc/lispref/strings.texi
doc/lispref/symbols.texi
doc/lispref/syntax.texi
doc/lispref/text.texi
doc/lispref/tindex.pl [deleted file]
doc/lispref/tips.texi
doc/lispref/two-volume.make
doc/lispref/two.el [deleted file]
doc/lispref/variables.texi
doc/lispref/vol1.texi [deleted file]
doc/lispref/vol2.texi [deleted file]
doc/lispref/windows.texi
doc/man/ChangeLog
doc/man/emacs.1
doc/man/rcs-checkin.1 [deleted file]
doc/misc/ChangeLog
doc/misc/Makefile.in
doc/misc/auth.texi
doc/misc/calc.texi
doc/misc/cl.texi
doc/misc/dbus.texi
doc/misc/dired-x.texi
doc/misc/ede.texi
doc/misc/forms.texi
doc/misc/gnus.texi
doc/misc/makefile.w32-in
doc/misc/message.texi
doc/misc/sc.texi
doc/misc/texinfo.tex
doc/misc/tramp.texi
doc/misc/trampver.texi
etc/AUTHORS
etc/ChangeLog
etc/GNUS-NEWS
etc/MORE.STUFF
etc/NEWS
etc/ORG-NEWS
etc/PROBLEMS
etc/TODO
etc/emacs.py [deleted file]
etc/emacs2.py [deleted file]
etc/emacs3.py [deleted file]
etc/forms/README [new file with mode: 0644]
etc/forms/forms-d2.dat [moved from etc/forms-d2.dat with 100% similarity]
etc/forms/forms-d2.el [moved from lisp/forms-d2.el with 95% similarity]
etc/forms/forms-pass.el [moved from lisp/forms-pass.el with 88% similarity]
etc/future-bug
etc/publicsuffix.txt [new file with mode: 0644]
etc/spook.lines
etc/themes/deeper-blue-theme.el
etc/themes/manoj-dark-theme.el
etc/themes/tango-dark-theme.el
etc/themes/tsdh-dark-theme.el
etc/themes/wheatgrass-theme.el
etc/tutorials/TUTORIAL
etc/tutorials/TUTORIAL.es
etc/tutorials/TUTORIAL.fr
etc/tutorials/TUTORIAL.sv
info/.gitignore
leim/ChangeLog
leim/Makefile.in
leim/quail/hangul.el
leim/quail/ipa.el
leim/quail/latin-ltx.el
leim/quail/vnvni.el [new file with mode: 0644]
lib-src/ChangeLog
lib-src/Makefile.in
lib-src/ebrowse.c
lib-src/emacsclient.c
lib-src/etags.c
lib-src/hexl.c
lib-src/make-docfile.c
lib-src/makefile.w32-in
lib-src/movemail.c
lib-src/pop.c
lib-src/profile.c
lib-src/rcs-checkin [deleted file]
lib-src/update-game-score.c
lib-src/vcdiff [deleted file]
lib/Makefile.am
lib/alloca.in.h
lib/allocator.h
lib/c-ctype.c [new file with mode: 0644]
lib/c-ctype.h [new file with mode: 0644]
lib/c-strcase.h [new file with mode: 0644]
lib/c-strcasecmp.c [new file with mode: 0644]
lib/c-strncasecmp.c [new file with mode: 0644]
lib/careadlinkat.c
lib/careadlinkat.h
lib/dosname.h
lib/dtotimespec.c [new file with mode: 0644]
lib/dup2.c
lib/filemode.c
lib/filemode.h
lib/ftoastr.c
lib/ftoastr.h
lib/getloadavg.c
lib/getopt.c
lib/getopt.in.h
lib/getopt1.c
lib/getopt_.h
lib/getopt_int.h
lib/gettext.h
lib/gettime.c [new file with mode: 0644]
lib/gettimeofday.c [new file with mode: 0644]
lib/gnulib.mk
lib/ignore-value.h
lib/intprops.h
lib/inttypes.in.h
lib/lstat.c
lib/makefile.w32-in
lib/md5.c
lib/md5.h
lib/mktime.c
lib/pathmax.h
lib/pselect.c [new file with mode: 0644]
lib/pthread_sigmask.c
lib/readlink.c
lib/sha1.c
lib/sha1.h
lib/sha256.c
lib/sha256.h
lib/sha512.c
lib/sha512.h
lib/signal.in.h
lib/sigprocmask.c
lib/stat-time.h [new file with mode: 0644]
lib/stat.c
lib/stdalign.in.h [new file with mode: 0644]
lib/stdarg.in.h
lib/stdbool.in.h
lib/stddef.in.h
lib/stdint.in.h
lib/stdio.in.h
lib/stdlib.in.h
lib/strftime.c
lib/strftime.h
lib/strtoimax.c
lib/strtol.c
lib/strtoll.c
lib/strtoul.c
lib/strtoull.c
lib/symlink.c
lib/sys_select.in.h [new file with mode: 0644]
lib/sys_stat.in.h
lib/sys_time.in.h [new file with mode: 0644]
lib/sys_types.in.h [new file with mode: 0644]
lib/time.in.h
lib/time_r.c
lib/timespec-add.c [new file with mode: 0644]
lib/timespec-sub.c [new file with mode: 0644]
lib/timespec.h [new file with mode: 0644]
lib/u64.h
lib/unistd.in.h
lib/utimens.c [new file with mode: 0644]
lib/utimens.h [new file with mode: 0644]
lib/verify.h
lisp/ChangeLog
lisp/ChangeLog.11
lisp/ChangeLog.12
lisp/ChangeLog.15
lisp/ChangeLog.6
lisp/ChangeLog.9
lisp/Makefile.in
lisp/abbrev.el
lisp/allout-widgets.el
lisp/allout.el
lisp/ansi-color.el
lisp/apropos.el
lisp/arc-mode.el
lisp/autoinsert.el
lisp/autorevert.el
lisp/avoid.el
lisp/battery.el
lisp/bindings.el
lisp/bookmark.el
lisp/bs.el
lisp/buff-menu.el
lisp/calc/calc-forms.el
lisp/calc/calc-lang.el
lisp/calc/calc-units.el
lisp/calc/calc.el
lisp/calculator.el
lisp/calendar/cal-html.el
lisp/calendar/cal-tex.el
lisp/calendar/calendar.el
lisp/calendar/holidays.el
lisp/calendar/icalendar.el
lisp/calendar/parse-time.el
lisp/calendar/time-date.el
lisp/calendar/timeclock.el
lisp/cedet/ChangeLog
lisp/cedet/data-debug.el
lisp/cedet/ede/autoconf-edit.el
lisp/cedet/ede/emacs.el
lisp/cedet/ede/proj.el
lisp/cedet/ede/project-am.el
lisp/cedet/mode-local.el
lisp/cedet/pulse.el
lisp/cedet/semantic.el
lisp/comint.el
lisp/completion.el
lisp/composite.el
lisp/cus-dep.el
lisp/cus-edit.el
lisp/cus-face.el
lisp/cus-start.el
lisp/custom.el
lisp/dabbrev.el
lisp/descr-text.el
lisp/desktop.el
lisp/dframe.el
lisp/dired-aux.el
lisp/dired-x.el
lisp/dired.el
lisp/dirtrack.el
lisp/doc-view.el
lisp/dos-fns.el
lisp/dos-w32.el
lisp/ebuff-menu.el
lisp/edmacro.el
lisp/electric.el
lisp/emacs-lisp/authors.el
lisp/emacs-lisp/autoload.el
lisp/emacs-lisp/avl-tree.el
lisp/emacs-lisp/byte-opt.el
lisp/emacs-lisp/byte-run.el
lisp/emacs-lisp/bytecomp.el
lisp/emacs-lisp/cconv.el
lisp/emacs-lisp/chart.el
lisp/emacs-lisp/checkdoc.el
lisp/emacs-lisp/cl-extra.el
lisp/emacs-lisp/cl-lib.el [new file with mode: 0644]
lisp/emacs-lisp/cl-loaddefs.el
lisp/emacs-lisp/cl-macs.el
lisp/emacs-lisp/cl-seq.el
lisp/emacs-lisp/cl-specs.el [deleted file]
lisp/emacs-lisp/cl.el
lisp/emacs-lisp/copyright.el
lisp/emacs-lisp/derived.el
lisp/emacs-lisp/disass.el
lisp/emacs-lisp/easy-mmode.el
lisp/emacs-lisp/easymenu.el
lisp/emacs-lisp/edebug.el
lisp/emacs-lisp/eieio-custom.el
lisp/emacs-lisp/eieio-opt.el
lisp/emacs-lisp/eieio.el
lisp/emacs-lisp/elint.el
lisp/emacs-lisp/ert-x.el
lisp/emacs-lisp/ert.el
lisp/emacs-lisp/ewoc.el
lisp/emacs-lisp/float-sup.el
lisp/emacs-lisp/generic.el
lisp/emacs-lisp/gv.el [new file with mode: 0644]
lisp/emacs-lisp/lisp-mode.el
lisp/emacs-lisp/lisp.el
lisp/emacs-lisp/macroexp.el
lisp/emacs-lisp/package.el
lisp/emacs-lisp/pcase.el
lisp/emacs-lisp/re-builder.el
lisp/emacs-lisp/regexp-opt.el
lisp/emacs-lisp/smie.el
lisp/emacs-lisp/syntax.el
lisp/emacs-lisp/tabulated-list.el
lisp/emacs-lisp/timer.el
lisp/emacs-lisp/trace.el
lisp/emacs-lock.el
lisp/emulation/crisp.el
lisp/emulation/cua-base.el
lisp/emulation/cua-rect.el
lisp/emulation/edt.el
lisp/emulation/tpu-edt.el
lisp/emulation/viper-cmd.el
lisp/emulation/viper-ex.el
lisp/emulation/viper-init.el
lisp/emulation/viper-keym.el
lisp/emulation/viper-mous.el
lisp/emulation/viper-util.el
lisp/emulation/viper.el
lisp/env.el
lisp/epa.el
lisp/epg-config.el
lisp/erc/ChangeLog
lisp/erc/erc-autoaway.el
lisp/erc/erc-backend.el
lisp/erc/erc-button.el
lisp/erc/erc-dcc.el
lisp/erc/erc-goodies.el
lisp/erc/erc-join.el
lisp/erc/erc-log.el
lisp/erc/erc-match.el
lisp/erc/erc-notify.el
lisp/erc/erc-pcomplete.el
lisp/erc/erc-services.el
lisp/erc/erc-sound.el
lisp/erc/erc-stamp.el
lisp/erc/erc-track.el
lisp/erc/erc-truncate.el
lisp/erc/erc-xdcc.el
lisp/erc/erc.el
lisp/eshell/em-alias.el
lisp/eshell/em-banner.el
lisp/eshell/em-basic.el
lisp/eshell/em-cmpl.el
lisp/eshell/em-dirs.el
lisp/eshell/em-glob.el
lisp/eshell/em-hist.el
lisp/eshell/em-ls.el
lisp/eshell/em-pred.el
lisp/eshell/em-prompt.el
lisp/eshell/em-rebind.el
lisp/eshell/em-script.el
lisp/eshell/em-smart.el
lisp/eshell/em-term.el
lisp/eshell/em-unix.el
lisp/eshell/em-xtra.el
lisp/eshell/esh-cmd.el
lisp/eshell/esh-ext.el
lisp/eshell/esh-io.el
lisp/eshell/esh-mode.el
lisp/eshell/esh-module.el
lisp/eshell/esh-opt.el
lisp/eshell/esh-var.el
lisp/eshell/eshell.el
lisp/face-remap.el
lisp/facemenu.el
lisp/faces.el
lisp/ffap.el
lisp/files-x.el
lisp/files.el
lisp/filesets.el
lisp/find-file.el
lisp/foldout.el
lisp/follow.el
lisp/font-lock.el
lisp/forms.el
lisp/frame.el
lisp/fringe.el
lisp/gnus/ChangeLog
lisp/gnus/ChangeLog.1
lisp/gnus/auth-source.el
lisp/gnus/gnus-agent.el
lisp/gnus/gnus-art.el
lisp/gnus/gnus-cite.el
lisp/gnus/gnus-demon.el
lisp/gnus/gnus-group.el
lisp/gnus/gnus-int.el
lisp/gnus/gnus-msg.el
lisp/gnus/gnus-picon.el
lisp/gnus/gnus-registry.el
lisp/gnus/gnus-spec.el
lisp/gnus/gnus-start.el
lisp/gnus/gnus-sum.el
lisp/gnus/gnus-sync.el
lisp/gnus/gnus-util.el
lisp/gnus/gnus-win.el
lisp/gnus/gnus.el
lisp/gnus/legacy-gnus-agent.el
lisp/gnus/message.el
lisp/gnus/mm-archive.el [new file with mode: 0644]
lisp/gnus/mm-decode.el
lisp/gnus/mm-util.el
lisp/gnus/mml.el
lisp/gnus/nndraft.el
lisp/gnus/nnfolder.el
lisp/gnus/nnimap.el
lisp/gnus/nnmail.el
lisp/gnus/nnml.el
lisp/gnus/nnspool.el
lisp/gnus/nntp.el
lisp/gnus/nnweb.el
lisp/gnus/plstore.el
lisp/gnus/pop3.el
lisp/gnus/registry.el
lisp/gnus/shr.el
lisp/gnus/smime.el
lisp/gnus/spam.el
lisp/help-fns.el
lisp/help-mode.el
lisp/help.el
lisp/hexl.el
lisp/hi-lock.el
lisp/ibuf-ext.el
lisp/ibuf-macs.el
lisp/ibuffer.el
lisp/icomplete.el
lisp/ido.el
lisp/image-dired.el
lisp/image-mode.el
lisp/image.el
lisp/imenu.el
lisp/info-look.el
lisp/info-xref.el
lisp/info.el
lisp/international/iso-ascii.el
lisp/international/mule-cmds.el
lisp/international/mule.el
lisp/international/quail.el
lisp/international/robin.el
lisp/international/ucs-normalize.el
lisp/international/uni-bidi.el
lisp/international/uni-category.el
lisp/international/uni-combining.el
lisp/international/uni-decimal.el
lisp/international/uni-decomposition.el
lisp/international/uni-digit.el
lisp/international/uni-lowercase.el
lisp/international/uni-mirrored.el
lisp/international/uni-name.el
lisp/international/uni-numeric.el
lisp/international/uni-titlecase.el
lisp/international/uni-uppercase.el
lisp/isearch.el
lisp/iswitchb.el
lisp/jit-lock.el
lisp/kmacro.el
lisp/language/burmese.el
lisp/language/cham.el
lisp/language/czech.el
lisp/language/english.el
lisp/language/ethio-util.el
lisp/language/european.el
lisp/language/georgian.el
lisp/language/greek.el
lisp/language/japanese.el
lisp/language/khmer.el
lisp/language/korea-util.el
lisp/language/korean.el
lisp/language/lao.el
lisp/language/misc-lang.el
lisp/language/romanian.el
lisp/language/sinhala.el
lisp/language/slovak.el
lisp/language/tai-viet.el
lisp/language/thai.el
lisp/language/tibet-util.el
lisp/language/utf-8-lang.el
lisp/ldefs-boot.el
lisp/loadhist.el
lisp/loadup.el
lisp/lpr.el
lisp/mail/binhex.el
lisp/mail/emacsbug.el
lisp/mail/feedmail.el
lisp/mail/footnote.el
lisp/mail/hashcash.el
lisp/mail/mail-extr.el
lisp/mail/mail-hist.el
lisp/mail/mailabbrev.el
lisp/mail/mailheader.el
lisp/mail/metamail.el
lisp/mail/mspools.el
lisp/mail/rmail.el
lisp/mail/sendmail.el
lisp/mail/undigest.el
lisp/mail/unrmail.el
lisp/mail/uudecode.el
lisp/makefile.w32-in
lisp/man.el
lisp/menu-bar.el
lisp/mh-e/ChangeLog
lisp/mh-e/mh-folder.el
lisp/mh-e/mh-utils.el
lisp/midnight.el
lisp/minibuf-eldef.el
lisp/minibuffer.el
lisp/misc.el
lisp/misearch.el
lisp/mouse-drag.el
lisp/mouse.el
lisp/mpc.el
lisp/msb.el
lisp/net/ange-ftp.el
lisp/net/browse-url.el
lisp/net/dbus.el
lisp/net/eudc.el
lisp/net/gnutls.el
lisp/net/goto-addr.el
lisp/net/imap.el
lisp/net/ldap.el
lisp/net/mairix.el
lisp/net/newst-plainview.el
lisp/net/newst-reader.el
lisp/net/newst-ticker.el
lisp/net/newst-treeview.el
lisp/net/newsticker.el
lisp/net/quickurl.el
lisp/net/rcirc.el
lisp/net/secrets.el
lisp/net/snmp-mode.el
lisp/net/soap-client.el
lisp/net/soap-inspect.el
lisp/net/socks.el
lisp/net/tls.el
lisp/net/tramp-cache.el
lisp/net/tramp-cmds.el
lisp/net/tramp-compat.el
lisp/net/tramp-ftp.el
lisp/net/tramp-gvfs.el
lisp/net/tramp-gw.el
lisp/net/tramp-sh.el
lisp/net/tramp-smb.el
lisp/net/tramp.el
lisp/net/trampver.el
lisp/net/webjump.el
lisp/net/xesam.el
lisp/net/zeroconf.el
lisp/newcomment.el
lisp/notifications.el
lisp/novice.el
lisp/nxml/nxml-glyph.el
lisp/nxml/nxml-mode.el
lisp/nxml/nxml-outln.el
lisp/nxml/rng-nxml.el
lisp/obsolete/assoc.el [moved from lisp/emacs-lisp/assoc.el with 92% similarity]
lisp/obsolete/bruce.el [moved from lisp/play/bruce.el with 99% similarity]
lisp/obsolete/cust-print.el [moved from lisp/emacs-lisp/cust-print.el with 99% similarity]
lisp/obsolete/erc-hecomplete.el
lisp/obsolete/fast-lock.el
lisp/obsolete/iso-acc.el
lisp/obsolete/ledit.el [moved from lisp/ledit.el with 98% similarity]
lisp/obsolete/mailpost.el [moved from lisp/mail/mailpost.el with 99% similarity]
lisp/obsolete/mouse-sel.el [moved from lisp/mouse-sel.el with 99% similarity]
lisp/obsolete/old-whitespace.el
lisp/obsolete/patcomp.el [moved from lisp/patcomp.el with 96% similarity]
lisp/obsolete/resume.el
lisp/obsolete/scribe.el
lisp/org/ChangeLog
lisp/org/org-agenda.el
lisp/org/org-clock.el
lisp/org/org-remember.el
lisp/org/org.el
lisp/outline.el
lisp/paren.el
lisp/paths.el [deleted file]
lisp/pcmpl-rpm.el
lisp/pcmpl-unix.el
lisp/pcomplete.el
lisp/play/5x5.el
lisp/play/animate.el
lisp/play/bubbles.el
lisp/play/cookie1.el
lisp/play/decipher.el
lisp/play/doctor.el
lisp/play/gamegrid.el
lisp/play/gomoku.el
lisp/play/hanoi.el
lisp/play/landmark.el
lisp/play/mpuz.el
lisp/play/pong.el
lisp/play/snake.el
lisp/play/solitaire.el
lisp/play/tetris.el
lisp/play/yow.el
lisp/play/zone.el
lisp/proced.el
lisp/progmodes/ada-mode.el
lisp/progmodes/ada-xref.el
lisp/progmodes/antlr-mode.el
lisp/progmodes/asm-mode.el
lisp/progmodes/autoconf.el
lisp/progmodes/bug-reference.el
lisp/progmodes/cc-cmds.el
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-mode.el
lisp/progmodes/cfengine.el
lisp/progmodes/cmacexp.el
lisp/progmodes/compile.el
lisp/progmodes/cperl-mode.el
lisp/progmodes/cpp.el
lisp/progmodes/cwarn.el
lisp/progmodes/dcl-mode.el
lisp/progmodes/delphi.el
lisp/progmodes/ebnf2ps.el
lisp/progmodes/ebrowse.el
lisp/progmodes/etags.el
lisp/progmodes/executable.el
lisp/progmodes/f90.el
lisp/progmodes/flymake.el
lisp/progmodes/fortran.el
lisp/progmodes/gdb-mi.el
lisp/progmodes/glasses.el
lisp/progmodes/grep.el
lisp/progmodes/gud.el
lisp/progmodes/hideshow.el
lisp/progmodes/icon.el
lisp/progmodes/idlw-help.el
lisp/progmodes/idlw-shell.el
lisp/progmodes/idlwave.el
lisp/progmodes/inf-lisp.el
lisp/progmodes/js.el
lisp/progmodes/m4-mode.el
lisp/progmodes/make-mode.el
lisp/progmodes/meta-mode.el
lisp/progmodes/modula2.el
lisp/progmodes/octave-inf.el
lisp/progmodes/octave-mod.el
lisp/progmodes/pascal.el
lisp/progmodes/perl-mode.el
lisp/progmodes/prolog.el
lisp/progmodes/ps-mode.el
lisp/progmodes/python.el
lisp/progmodes/ruby-mode.el
lisp/progmodes/scheme.el
lisp/progmodes/sh-script.el
lisp/progmodes/simula.el
lisp/progmodes/sql.el
lisp/progmodes/tcl.el
lisp/progmodes/vera-mode.el
lisp/progmodes/verilog-mode.el
lisp/progmodes/vhdl-mode.el
lisp/progmodes/which-func.el
lisp/progmodes/xscheme.el
lisp/ps-samp.el
lisp/recentf.el
lisp/rect.el
lisp/register.el
lisp/repeat.el
lisp/replace.el
lisp/savehist.el
lisp/scroll-all.el
lisp/scroll-bar.el
lisp/server.el
lisp/ses.el
lisp/shell.el
lisp/simple.el
lisp/skeleton.el
lisp/speedbar.el
lisp/startup.el
lisp/strokes.el
lisp/subr.el
lisp/tar-mode.el
lisp/term.el
lisp/term/AT386.el
lisp/term/apollo.el
lisp/term/bobcat.el
lisp/term/cygwin.el
lisp/term/iris-ansi.el
lisp/term/linux.el
lisp/term/lk201.el
lisp/term/news.el
lisp/term/ns-win.el
lisp/term/screen.el
lisp/term/sup-mouse.el
lisp/term/tvi970.el
lisp/term/vt102.el
lisp/term/vt125.el
lisp/term/vt200.el
lisp/term/vt201.el
lisp/term/vt220.el
lisp/term/vt240.el
lisp/term/vt300.el
lisp/term/vt320.el
lisp/term/vt400.el
lisp/term/vt420.el
lisp/term/w32-win.el
lisp/term/wyse50.el
lisp/term/x-win.el
lisp/term/xterm.el
lisp/textmodes/artist.el
lisp/textmodes/bib-mode.el
lisp/textmodes/bibtex.el
lisp/textmodes/css-mode.el
lisp/textmodes/fill.el
lisp/textmodes/flyspell.el
lisp/textmodes/ispell.el
lisp/textmodes/picture.el
lisp/textmodes/refbib.el
lisp/textmodes/refill.el
lisp/textmodes/reftex-dcr.el
lisp/textmodes/reftex-global.el
lisp/textmodes/reftex-index.el
lisp/textmodes/reftex-ref.el
lisp/textmodes/reftex-sel.el
lisp/textmodes/reftex-toc.el
lisp/textmodes/reftex-vars.el
lisp/textmodes/rst.el
lisp/textmodes/sgml-mode.el
lisp/textmodes/table.el
lisp/textmodes/tex-mode.el
lisp/textmodes/texinfmt.el
lisp/textmodes/texinfo.el
lisp/textmodes/texnfo-upd.el
lisp/textmodes/tildify.el
lisp/textmodes/two-column.el
lisp/thingatpt.el
lisp/time.el
lisp/timezone.el
lisp/tmm.el
lisp/tooltip.el
lisp/tree-widget.el
lisp/tutorial.el
lisp/type-break.el
lisp/uniquify.el
lisp/url/ChangeLog
lisp/url/url-cookie.el
lisp/url/url-dav.el
lisp/url/url-domsuf.el [new file with mode: 0644]
lisp/url/url-expand.el
lisp/url/url-file.el
lisp/url/url-future.el
lisp/url/url-gw.el
lisp/url/url-handlers.el
lisp/url/url-http.el
lisp/url/url-ldap.el
lisp/url/url-methods.el
lisp/url/url-misc.el
lisp/url/url-nfs.el
lisp/url/url-parse.el
lisp/url/url-privacy.el
lisp/url/url-queue.el
lisp/url/url-util.el
lisp/url/url-vars.el
lisp/url/url.el
lisp/vc/add-log.el
lisp/vc/cvs-status.el
lisp/vc/diff-mode.el
lisp/vc/diff.el
lisp/vc/ediff-diff.el
lisp/vc/ediff-init.el
lisp/vc/ediff-wind.el
lisp/vc/ediff.el
lisp/vc/emerge.el
lisp/vc/log-edit.el
lisp/vc/log-view.el
lisp/vc/pcvs-defs.el
lisp/vc/pcvs-info.el
lisp/vc/pcvs-parse.el
lisp/vc/pcvs-util.el
lisp/vc/pcvs.el
lisp/vc/smerge-mode.el
lisp/vc/vc-annotate.el
lisp/vc/vc-arch.el
lisp/vc/vc-bzr.el
lisp/vc/vc-cvs.el
lisp/vc/vc-dir.el
lisp/vc/vc-dispatcher.el
lisp/vc/vc-git.el
lisp/vc/vc-hg.el
lisp/vc/vc-hooks.el
lisp/vc/vc-mtn.el
lisp/vc/vc-rcs.el
lisp/vc/vc-sccs.el
lisp/vc/vc.el
lisp/vcursor.el
lisp/version.el
lisp/w32-fns.el
lisp/wdired.el
lisp/whitespace.el
lisp/wid-browse.el
lisp/wid-edit.el
lisp/window.el
lisp/winner.el
lisp/woman.el
lisp/xml.el
lisp/xt-mouse.el
lwlib/ChangeLog
lwlib/Makefile.in
lwlib/lwlib-Xaw.c
lwlib/lwlib-Xlw.c
lwlib/lwlib-Xm.c
lwlib/lwlib-utils.c
lwlib/lwlib.c
lwlib/xlwmenu.c
m4/00gnulib.m4
m4/alloca.m4
m4/c-strtod.m4
m4/clock_time.m4 [new file with mode: 0644]
m4/dup2.m4
m4/extensions.m4
m4/filemode.m4
m4/getloadavg.m4
m4/getopt.m4
m4/gettime.m4 [new file with mode: 0644]
m4/gettimeofday.m4 [new file with mode: 0644]
m4/gnulib-common.m4
m4/gnulib-comp.m4 [moved from m4/gl-comp.m4 with 87% similarity]
m4/gnulib-tool.m4
m4/include_next.m4
m4/inttypes.m4
m4/largefile.m4
m4/longlong.m4
m4/lstat.m4
m4/manywarnings.m4 [new file with mode: 0644]
m4/md5.m4
m4/mktime.m4
m4/multiarch.m4
m4/nocrash.m4
m4/off_t.m4 [new file with mode: 0644]
m4/pathmax.m4
m4/pselect.m4 [new file with mode: 0644]
m4/pthread_sigmask.m4
m4/readlink.m4
m4/sha1.m4
m4/sha256.m4
m4/sha512.m4
m4/signal_h.m4
m4/signalblocking.m4
m4/socklen.m4
m4/ssize_t.m4
m4/st_dm_mode.m4
m4/stat-time.m4 [new file with mode: 0644]
m4/stat.m4
m4/stdalign.m4 [new file with mode: 0644]
m4/stdarg.m4
m4/stdbool.m4
m4/stddef_h.m4
m4/stdint.m4
m4/stdio_h.m4
m4/stdlib_h.m4
m4/strftime.m4
m4/strtoimax.m4
m4/strtoll.m4
m4/strtoull.m4
m4/strtoumax.m4
m4/symlink.m4
m4/sys_select_h.m4 [new file with mode: 0644]
m4/sys_socket_h.m4 [new file with mode: 0644]
m4/sys_stat_h.m4
m4/sys_time_h.m4 [new file with mode: 0644]
m4/sys_types_h.m4 [new file with mode: 0644]
m4/time_h.m4
m4/time_r.m4
m4/timespec.m4 [new file with mode: 0644]
m4/tm_gmtoff.m4
m4/unistd_h.m4
m4/utimbuf.m4 [new file with mode: 0644]
m4/utimens.m4 [new file with mode: 0644]
m4/utimes.m4 [new file with mode: 0644]
m4/warnings.m4 [new file with mode: 0644]
m4/wchar_t.m4
make-dist
msdos/ChangeLog
msdos/inttypes.h
msdos/mainmake.v2
msdos/sed1v2.inp
msdos/sed2v2.inp
msdos/sed2x.inp
msdos/sed3v2.inp
msdos/sed6.inp
msdos/sedleim.inp
msdos/sedlibmk.inp
nextstep/ChangeLog
nextstep/Cocoa/Emacs.base/Contents/Info.plist
nextstep/Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings
nextstep/GNUstep/Emacs.base/Resources/Emacs.desktop
nextstep/GNUstep/Emacs.base/Resources/Info-gnustep.plist
nextstep/INSTALL
nt/ChangeLog
nt/INSTALL
nt/README.W32
nt/config.nt
nt/configure.bat
nt/emacs.rc
nt/emacsclient.rc
nt/gmake.defs
nt/inc/stdalign.h [new file with mode: 0644]
nt/inc/sys/time.h
nt/makefile.w32-in
nt/nmake.defs
nt/paths.h
oldXMenu/ChangeLog
oldXMenu/Makefile.in
src/.gdbinit
src/ChangeLog
src/ChangeLog.10
src/ChangeLog.11
src/ChangeLog.6
src/Makefile.in
src/alloc.c
src/atimer.c
src/bidi.c
src/buffer.c
src/buffer.h
src/bytecode.c
src/callint.c
src/callproc.c
src/casefiddle.c
src/casetab.c
src/category.c
src/category.h
src/ccl.c
src/ccl.h
src/character.c
src/character.h
src/charset.c
src/charset.h
src/chartab.c
src/cmds.c
src/coding.c
src/coding.h
src/composite.c
src/composite.h
src/data.c
src/dbusbind.c
src/dired.c
src/dispextern.h
src/dispnew.c
src/doc.c
src/doprnt.c
src/dosfns.c
src/editfns.c
src/emacs.c
src/emacsgtkfixed.c
src/emacsgtkfixed.h
src/epaths.in
src/eval.c
src/fileio.c
src/filelock.c
src/floatfns.c
src/fns.c
src/font.c
src/font.h
src/fontset.c
src/fontset.h
src/frame.c
src/frame.h
src/fringe.c
src/ftfont.c
src/ftxfont.c
src/gmalloc.c
src/gnutls.c
src/gnutls.h
src/gtkutil.c
src/gtkutil.h
src/image.c
src/indent.c
src/indent.h
src/insdel.c
src/intervals.c
src/intervals.h
src/keyboard.c
src/keyboard.h
src/keymap.c
src/keymap.h
src/lisp.h
src/lisp.mk
src/lread.c
src/m/README [deleted file]
src/m/alpha.h [deleted file]
src/m/amdx86-64.h [deleted file]
src/m/ia64.h [deleted file]
src/m/ibmrs6000.h [deleted file]
src/m/ibms390x.h [deleted file]
src/m/intel386.h [deleted file]
src/m/m68k.h [deleted file]
src/m/macppc.h [deleted file]
src/m/sparc.h [deleted file]
src/m/template.h [deleted file]
src/m/vax.h [deleted file]
src/macros.c
src/makefile.w32-in
src/marker.c
src/mem-limits.h
src/menu.c
src/menu.h
src/minibuf.c
src/msdos.c
src/ns.mk
src/nsfns.m
src/nsfont.m
src/nsgui.h
src/nsimage.m
src/nsmenu.m
src/nsselect.m
src/nsterm.h
src/nsterm.m
src/print.c
src/process.c
src/process.h
src/puresize.h
src/ralloc.c
src/regex.c
src/regex.h
src/region-cache.c
src/s/aix4-2.h
src/s/bsd-common.h [deleted file]
src/s/cygwin.h [deleted file]
src/s/darwin.h
src/s/freebsd.h
src/s/gnu-kfreebsd.h [deleted file]
src/s/gnu-linux.h
src/s/gnu.h [deleted file]
src/s/hpux10-20.h
src/s/hpux11.h [deleted file]
src/s/irix6-5.h
src/s/ms-w32.h
src/s/msdos.h
src/s/netbsd.h
src/s/openbsd.h [deleted file]
src/s/sol2-10.h [deleted file]
src/s/sol2-6.h
src/s/template.h
src/s/unixware.h
src/s/usg5-4-common.h
src/scroll.c
src/search.c
src/sound.c
src/syntax.c
src/syntax.h
src/sysdep.c
src/sysselect.h
src/syssignal.h
src/systime.h
src/term.c
src/termcap.c
src/termchar.h
src/termhooks.h
src/terminal.c
src/textprop.c
src/tparam.c
src/undo.c
src/unexaix.c
src/unexelf.c
src/unexmacosx.c
src/unexsol.c
src/vm-limit.c
src/w16select.c
src/w32.c
src/w32console.c
src/w32fns.c
src/w32font.c
src/w32heap.c
src/w32inevt.c
src/w32menu.c
src/w32proc.c
src/w32reg.c
src/w32select.c
src/w32term.c
src/w32term.h
src/w32uniscribe.c
src/widget.c
src/window.c
src/window.h
src/xdisp.c
src/xfaces.c
src/xfns.c
src/xfont.c
src/xftfont.c
src/xgselect.c
src/xgselect.h
src/xmenu.c
src/xml.c
src/xrdb.c
src/xselect.c
src/xsettings.c
src/xsettings.h
src/xterm.c
src/xterm.h
test/ChangeLog
test/automated/Makefile.in
test/automated/compile-tests.el
test/automated/ert-x-tests.el
test/automated/icalendar-tests.el
test/automated/url-util-tests.el [new file with mode: 0644]
test/automated/vc-bzr.el
test/automated/xml-parse-tests.el [new file with mode: 0644]
test/eshell.el
test/indent/latex-mode.tex [new file with mode: 0644]
test/indent/ruby.rb [new file with mode: 0644]
test/indent/shell.rc
test/indent/shell.sh
vpath.sed [deleted file]

index 4da890f92abaf428f5445926160372741f05d773..5bee88267c851f28f8e6e8f5d1117d24ecdc55ba 100644 (file)
@@ -2,10 +2,12 @@
          (sentence-end-double-space . t)
          (fill-column . 70)))
  (c-mode . ((c-file-style . "GNU")))
+ (objc-mode . ((c-file-style . "GNU")))
  ;; You must set bugtracker_debbugs_url in your bazaar.conf for this to work.
  ;; See admin/notes/bugtracker.
  (log-edit-mode . ((log-edit-rewrite-fixes
-                    "[ \n](bug#\\([0-9]+\\))" . "debbugs:\\1")))
+                    "[ \n](bug#\\([0-9]+\\))" . "debbugs:\\1")
+                   (log-edit-font-lock-gnu-style . t)))
  (change-log-mode . ((add-log-time-zone-rule . t)
                     (fill-column . 74)
                     (bug-reference-url-format . "http://debbugs.gnu.org/%s")
diff --git a/BUGS b/BUGS
index d01066459955058ba5856587f586d3cffab2c0e3..30bf10ed94f235231b6f49db8e17213f835e4011 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -5,9 +5,12 @@ Bugs section of the Emacs manual for advice on
 (2) how to write a useful bug report and what information it needs to have.
 
 You can read the Bugs section of the manual from inside Emacs.
-Start Emacs, do C-h i to enter Info, then m Emacs RET to get to the
-Emacs manual, then m Bugs RET to get to the section on bugs.
-Or you can use the standalone Info program in a like manner.
+Start Emacs, and press
+  C-h r       (to view the Emacs manual)
+  m Bugs RET  (to go to the section on Bugs) 
+Or you can use the standalone Info program:
+  info emacs
+  m Bugs RET
 (Standalone Info is part of the Texinfo distribution, not part of the
 Emacs distribution.)
 
@@ -16,7 +19,7 @@ Software Foundation's online store at <http://shop.fsf.org/>.
 
 If necessary, you can read the manual without an info program:
 
-    cat info/emacs* | more "+/^File: emacs,  Node: Bugs,"
+    cat info/emacs* | more "+/^File: emacs.*,  Node: Bugs,"
 
 
 Please first check the file etc/PROBLEMS (e.g. with C-h C-p in Emacs) to
index db8de760ba63707d47b08adaa0c11b82b11659b5..03f4291a634c64bb53a7a37a72175963fb7d922e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
-2012-06-21  Ulrich Mueller  <ulm@gentoo.org>
+2012-07-17  Dmitry Antipov  <dmantipov@yandex.ru>
 
-       * configure.in: Use m/intel386.h for amd64 with x32 ABI.  (Bug#11669)
+       Fix toolkit configuration report.
+       * configure.ac (USE_X_TOOLKIT): Report toolkit as GTK3 if
+       --with-x-toolkit=gtk3 is used.
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-17  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * Version 24.1 released.
+       Fix regression with pthread_sigmask on FreeBSD (Bug#11884).
+       * configure.ac: Configure gnulib at the end, not before running
+       pkg-config.  This restores the behavior before 2012-06-22, when
+       higher-resolution time stamps were added, and fixes a bug whereby
+       LIB_PTHREAD was not used and gnulib's part of 'configure'
+       therefore incorrectly assumed that pthread_sigmask wasn't working.
+       Fix the problem with -lrt and clock_gettime a different way.
+       This should complete the fix for Bug#11884.
+       (pre_PKG_CONFIG_CFLAGS, pre_PKG_CONFIG_LIBS): New shell vars.
+
+2012-07-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Merge from gnulib, incorporating:
+       2012-07-15 pthread_sigmask: fix bug on FreeBSD 9 (Bug#11884)
+       2012-07-11 gettext: do not assume '#define ... defined ...' behavior
+
+2012-07-14  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (GC_SETJMP_WORKS, GC_MARK_STACK): Move here from src/s.
+       (AH_BOTTOM): Move GC_SETJMP_WORKS GCC fallback to main body.
+
+2012-07-13  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (opsysfile): Set to empty on gnu, cygwin.
+
+       * configure.ac (BSD4_2, BSD_SYSTEM, USG, USG5, _AIX, CYGWIN)
+       (DARWIN_OS, GNU_LINUX, HPUX, IRIX6_5, SOLARIS2):
+       Move "system type" macros here from src/s.
+       (BSD_SYSTEM_AHB): New hack macro.
+       (AH_BOTTOM): Set BSD_SYSTEM, using BSD_SYSTEM_AHB.
+
+       * configure.ac (NSIG_MINIMUM, ULIMIT_BREAK_VALUE, SETUP_SLAVE_PTY)
+       (GC_MARK_SECONDARY_STACK): Move here from src/s.
+
+2012-07-12  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (AH_BOTTOM) [DARWIN_OS]: Move SYSTEM_PURESIZE_EXTRA
+       setting here from src/s/darwin.h.
+
+       * configure.ac (NO_MATHERR): Unconditionally define for Darwin;
+       as src/s/darwin.h used to.
+
+       * configure.ac (NARROWPROTO, NO_ABORT, BROKEN_GET_CURRENT_DIR_NAME)
+       (BROKEN_FIONREAD, BROKEN_PTY_READ_AFTER_EAGAIN, BROKEN_SIGAIO)
+       (BROKEN_SIGPOLL, BROKEN_SIGPTY, FIRST_PTY_LETTER, NO_EDITRES)
+       (G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP, PTY_ITERATION, PTY_OPEN)
+       (PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF, RUN_TIME_REMAP)
+       (SETPGRP_RELEASES_CTTY, TAB3, TABDLY, RUN_TIME_REMAP, UNIX98_PTYS)
+       (XOS_NEEDS_TIME_H): Move here from src/s.
+
+2012-07-11  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (INTERRUPT_INPUT): Move here from src/s.
+       (HAVE_PTYS, HAVE_SOCKETS): Define unconditionally.
+
+2012-07-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.ac (tzset): Remove check that's redundant with gnulib.
+
+2012-07-11  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (CLASH_DETECTION): Define unconditionally.
+
+       * configure.ac (opsysfile): Use bsd-common on gnu systems.
+
+       * configure.ac (GNU_LIBRARY_PENDING_OUTPUT_COUNT):
+       (SIGNALS_VIA_CHARACTERS): Move here from src/s.
+
+2012-07-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Assume mkdir, rename, rmdir, strerror.
+       * configure.ac (mkdir, rename, rmdir, strerror): Remove check.
+
+2012-07-11  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (DONT_REOPEN_PTY): Move here from src/s.
+
+       * configure.ac (DEFAULT_SOUND_DEVICE): New definition.
+
+2012-07-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove "#define unix" that is no longer needed (Bug#11905).
+       Merge from gnulib to make "#define unix" unnecessary, incorporating:
+       2012-07-10 getloadavg: clean out old Emacs and Autoconf cruft
+       2012-07-09 getopt: Simplify after Emacs changed.
+
+2012-07-10  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (DATA_START, DATA_SEG_BITS, PENDING_OUTPUT_COUNT):
+       Move here from src/s.
+
+2012-07-09  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.ac (PNG_DEPSTRUCT): Define this instead of
+       PNG_DEPRECATED.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Add GCC-style 'const' attribute to functions that can use it.
+       * configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const.
+       (ATTRIBUTE_CONST): New macro, in config.h.
+
+2012-07-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * lib/makefile.w32-in: Rework dependencies.
+       (GNU_LIB, NT_INC, C_CTYPE_H, MS_W32_H, CONFIG_H, FILEMODE_H)
+       (FTOASTR_H, FTOASTR_C, GETOPT_INT_H, MD5_H, SHA1_H, SHA256_H)
+       (U64_H, SHA512_H): New macros.
+       (SRC): Redefine to point to src/, not current directory.
+       ($(BLD)/c-ctype.$(O), $(BLD)/c-strcasecmp.$(O))
+       ($(BLD)/c-strncasecmp.$(O), $(BLD)/dtoastr.$(O))
+       ($(BLD)/dtotimespec.$(O), $(BLD)/getopt.$(O), $(BLD)/getopt1.$(O))
+       ($(BLD)/gettime.$(O), $(BLD)/strftime.$(O), $(BLD)/time_r.$(O))
+       ($(BLD)/timespec-add.$(O), $(BLD)/timespec-sub.$(O), $(BLD)/md5.$(O))
+       ($(BLD)/sha1.$(O), $(BLD)/sha256.$(O), $(BLD)/sha512.$(O))
+       ($(BLD)/filemode.$(O)): Update dependencies.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Merge from gnulib, incorporating:
+       2012-07-09 timespec: mark functions with const attributes
+
+       Rename configure.in to configure.ac (Bug#11603).
+       The name 'configure.in' has been obsolescent for quite some time,
+       and the next release of Autoconf will generate warnings for it.
+       See commit 'v2.69-4-g560f16b' of 2012-05-06, "general: deprecate
+       'configure.in' as autoconf input" in the Autoconf git repository.
+       * configure.ac: Rename from configure.in.
+       * INSTALL, INSTALL.BZR, README, make-dist:
+       * Makefile.in (AUTOCONF_INPUTS):
+       * autogen.sh (autoconf_min):
+       * autogen/update_autogen (sources):
+       Adjust to reflect new name.
+
+2012-07-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Restore deprecation warnings, except for older libpng.
+       * configure.in (WARN_CFLAGS): Remove -Wno-deprecated-declarations.
+       (HAVE_LIBPNG_PNG_H): Don't bother checking for this if we have png.h.
+       (PNG_DEPRECATED): Define when compiling with older PNG versions.
+
+2012-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in (WARN_CFLAGS): Add -Wno-deprecated-declarations.
+
+2012-07-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Improve static checking when configured --with-ns.
+       See Samuel Bronson's remarks in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00146.html>.
+       * configure.in (WARN_CFLAGS): Omit -Wunreachable-code, as it's
+       a no-op with recent GCC and harmful in earlier ones.
+       Omit -Wsync-nand, as it's irrelevant to Emacs and provokes a
+       warning when compiling with ObjC.  Always omit
+       -Wunsafe-loop-optimizations, as we don't mind when optimization is
+       being done correctly.
+
+2012-07-07  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (BROKEN_SA_RESTART): Doc fix.
+
+       * configure.in: Rather than checking for things then undef'ing
+       them on some platforms, simply don't check for them.
+       (getwd): Don't check for it on unixware.
+       (random, rint): Don't check for these on hpux.
+       (res_init, libresolv): Don't check for these on darwin.
+
+2012-07-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/c-ctype.$(O),
+       $(BLD)/c-strcasecmp.$(O) and $(BLD)/c-strncasecmp.$(O).
+       ($(BLD)/c-ctype.$(O), $(BLD)/c-strcasecmp.$(O))
+       ($(BLD)/c-strncasecmp.$(O)): New dependencies.
+
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.in: Document --enable-gcc-warnings better.
+
+       Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786).
+       This is safer than strcasecmp, which has unspecified behavior
+       outside the POSIX locale and in practice sometimes does not work
+       in multibyte locales.  Similarly for c_strncasecmp and strncasecmp.
+       * configure.in (strcasecmp, strncasecmp): Remove checks.
+
+       * lib/c-ctype.c, lib/c-ctype.h, lib/c-strcase.h, lib/c-strcasecmp.c:
+       * lib/c-strncasecmp.c: New files, taken from gnulib.
+       * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
+
+       Merge from gnulib, incorporating:
+       2012-07-06 timespec-sub: avoid duplicate include
+       Reported by Juanma Barranquero.
+
+2012-07-06  Glenn Morris  <rgm@gnu.org>
+
+       * make-dist [update]: Let autoreconf figure out what needs updating.
+       Use `make info-real'.  leim/leim-list.el should always exist.
+       Check cd return value.
+
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Merge from gnulib.  This is for OpenBSD 5.1 amd64.
+       * m4/sys_time_h.m4: New version from gnulib, incorporating:
+       2012-07-05 sys_time: allow too-wide tv_sec
+
+2012-07-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Merge from gnulib.
+       * lib/alloca.in.h: New version from gnulib, incorporating:
+       2012-07-03 alloca: add support for HP NonStop TNS/E native
+
+2012-07-04  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * configure.in: If --enable-gcc-warnings, disable
+       -Wunsafe-loop-optimizations for -O1 optimization level.
+
+2012-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (standardlisppath): New output variable.
+       (lisppath): Use standardlisppath.
+       * Makefile.in (standardlisppath): New, set by configure.
+       (epaths-force): Use standardlisppath and locallisppath rather than
+       lisppath.
+
+2012-06-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * configure.in: Fix previous change. Remove --enable-asserts.
+       (CPPFLAGS): Remove conditional -DXASSERTS=1.
+       Add --enable-link-time-optimization.
+       * INSTALL: Mention this.
+
+2012-06-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * configure.in: Add glyphs category to --enable-checking option.
+       (GLYPH_DEBUG): Define if glyphs debugging is enabled.
+
+2012-06-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * configure.in (ENABLE_CHECKING): Update comment.
+
+2012-06-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.in: Don't check for sys/select.h, sys/time.h, utime.h.
+       Emacs proper no longer uses these headers, and can rely on Gnulib
+       for these checks.
+
+       Merge from gnulib.
+       * m4/getopt.m4: Copy new version from gnulib, incorporating:
+       getopt-posix: No longer guarantee that option processing is resettable.
+
+2012-06-27  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in: Only check for paxctl on gnu-linux.  (Bug#11398#26)
+
+       * INSTALL: Remove references to paths.el.
+
+2012-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * lib/makefile.w32-in ($(GNULIBOBJS)): Depend on stamp_BLD.  This
+       replaces separate dependency for each object file, which required
+       the same object file to be mentioned twice, causing failures in
+       parallel builds.
+
+2012-06-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Clean out last vestiges of the old HAVE_CONFIG_H stuff.
+       * lib/makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H.
+
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * configure.in (AC_CHECK_FUNCS): Detect library functions
+       strcasecmp and strncasecmp.
+
+2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
+       We might as well use the spelling standardized by C11,
+       as in the long run that should simplify maintenance.
+       * configure.in (NO_RETURN): Remove.  All uses replaced by _Noreturn.
+
+2012-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * lib/makefile.w32-in ($(BLD)/dtotimespec.$(O)):
+       ($(BLD)/timespec-add.$(O)):
+       ($(BLD)/timespec-sub.$(O)): Don't depend on
+       $(EMACS_ROOT)/nt/inc/sys/time.h.
+
+       * lib/stat-time.h:
+       * lib/timespec.h:
+       * lib/utimens.h: Revert last change.
+
+2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Merge from gnulib.
+       * m4/getopt.m4: Copy new version from gnulib, incorporating:
+       getopt-gnu: Handle suboptimal getopt_long's abbreviation handling.
+
+2012-06-23  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu.
+       * lib/makefile.w32-in (GNULIBOBJS): Add $(BLD)/dtotimespec.$(O),
+       $(BLD)/gettime.$(O), $(BLD)/timespec-add.$(O), and
+       $(BLD)/timespec-sub.$(O).
+       ($(BLD)/dtotimespec.$(O)):
+       ($(BLD)/gettime.$(O)):
+       ($(BLD)/timespec-add.$(O)):
+       ($(BLD)/timespec-sub.$(O)): New dependencies.
+
+       * lib/stat-time.h:
+       * lib/timespec.h:
+       * lib/utimens.h: Include sys/time.h.
+
+2012-06-23  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Don't use AC_CHECK_FUNCS_ONCE, which doesn't use
+       the correct CFLAGS and LIBS.
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Support higher-resolution time stamps (Bug#9000).
+       * configure.in (gl_ASSERT_NO_GNULIB_POSIXCHECK)
+       (gl_ASSERT_NO_GNULIB_TESTS, gl_INIT): Move these up earlier, so
+       that the new clock stuff doesn't clash with RSVG_LIBS.
+       (AC_CHECK_HEADERS): Don't check for sys/select.h, sys/time.h, utime.h,
+       as gnulib does that for us now.
+       (emacs_cv_struct_utimbuf, HAVE_STRUCT_UTIMBUF, HAVE_TIMEVAL)
+       (GETTIMEOFDAY_ONE_ARGUMENT): Remove; gnulib does these now.
+       (AC_CHECK_FUNCS): Remove utimes; no longer needed.
+       * lib/dtotimespec.c, lib/gettime.c, lib/gettimeofday.c, lib/pselect.c:
+       * lib/stat-time.h, lib/sys_select.in.h, lib/sys_time.in.h:
+       * lib/timespec-add.c, lib/timespec-sub.c, lib/timespec.h:
+       * lib/utimens.c, lib/utimens.h, m4/clock_time.m4, m4/gettime.m4:
+       * m4/gettimeofday.m4, m4/pselect.m4, m4/stat-time.m4:
+       * m4/sys_select_h.m4, m4/sys_socket_h.m4, m4/sys_time_h.m4:
+       * m4/timespec.m4, m4/utimbuf.m4, m4/utimens.m4, m4/utimes.m4:
+       New files, copied automatically from gnulib.
+       * lib/gnulib.mk, m4/gnulib-comp.m4: Merge from gnulib.
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Merge from gnulib.
+       * lib/filemode.h, lib/signal.in.h, lib/stat.c, lib/stdint.in.h:
+       * lib/stdlib.in.h, lib/unistd.in.h, m4/extensions.m4, m4/getloadavg.m4:
+       * m4/getopt.m4, m4/gnulib-common.m4, m4/largefile.m4, m4/mktime.m4:
+       * m4/multiarch.m4, m4/nocrash.m4, m4/stdio_h.m4, m4/time_r.m4:
+       Copy new versions from gnulib, incorporating the following changes:
+       2012-06-22 time_r: fix typo that always overrode localtime_r decl
+       2012-06-22 Write "Mac OS X" instead of "MacOS X".
+       2012-06-21 mktime: fix integer overflow in 'configure'-time test
+       2012-06-21 nonblocking: Avoid compilation error on mingw64.
+       2012-06-19 stat, fstat: Avoid warnings on mingw64.
+       2012-06-19 getopt-gnu: Fix exit code overflow in autoconf test.
+
+2012-06-13  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * configure.in: Rename --enable-use-lisp-union-type to
+       --enable-check-lisp-object-type and define CHECK_LISP_OBJECT_TYPE
+       instead of USE_LISP_UNION_TYPE.
+
+2012-06-12  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (HAVE_PROCFS, _STRUCTURED_PROC): New AC_DEFINEs.
+       (opsysfile): Set specially for sol2-10.
+
+       * configure.in (BROKEN_SA_RESTART, USG_SUBTTY_WORKS):
+       New AC_DEFINEs, for hpux11.
+       (opsysfile): Set specially for hpux11.
+
+2012-06-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.in: Coalesce some function checking.
+       This makes 'configure' a bit smaller.
+       Prefer AC_CHECK_FUNCS_ONCE for functions that we always check for.
+
+2012-06-12  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (opsysfile): Set specially for gnu-kfreebsd, openbsd.
+
+       * configure.in (NO_TERMIO, BROKEN_SIGIO): Move here from src/s.
+
+       * configure.in: Anticipate platforms with no src/s file.
+
+2012-06-12  Chong Yidong  <cyd@gnu.org>
+
+       * configure.in: Check for MagickMergeImageLayers (Bug#11678).
+
+2012-06-11  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (SYSTEM_TYPE): New AC_DEFINE.
+
+2012-06-09  Michael Albinus  <michael.albinus@gmx.de>
+
+       * configure.in (dbus_type_is_valid): Check for library function.
+
+2012-06-06  Glenn Morris  <rgm@gnu.org>
+
+       * INSTALL, make-dist: Remove vcdiff.
+
+2012-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * INSTALL, make-dist: Remove rcs-checkin.
+
+2012-06-03  Ulrich Müller  <ulm@gentoo.org>
+
+       * configure.in (PAXCTL): Check for paxctl. (Bug#11398)
+
+2012-06-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove --disable-maintainer-mode option from 'configure'.  (Bug#11555)
+       It is confusingly named and rarely useful.  See, for example,
+       <http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00089.html>.
+       * INSTALL.BZR: Don't mention --disable-maintainer-mode.
+       * Makefile.in (MAINTAINER_MODE_FLAG): Remove; all uses removed.
+       * configure.in: Remove --disable-maintainer-mode.
+       (USE_MAINTAINER_MODE, MAINT): Remove.
+
+2012-05-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Make 'configure' a bit smaller and faster.
+       * configure.in (INSTALL_INFO): Set it with one call to
+       AC_PATH_PROG, not three.
+       (PKG_CONFIG): Hoist this out of PKG_CHECK_MODULES, since it's
+       so likely that it'll be needed.
+       (AC_CHECK_HEADERS_ONCE): Prefer to AC_CHECK_HEADERS where either works.
+       (AC_PROG_MAKE_SET): Remove; Automake does this.
+       (sysinfo): Do not check for this function, as it's never used.
+       (tzset): Check for this function just once.
+       * m4/manywarnings.m4: Sync from gnulib, incorporating the following:
+       2012-05-27 manywarnings: remove duplicate -Wmultichar entry
+
+2012-05-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * config.bat (lib): Create/update lib/stdalign.in-h and
+       lib/sys_types.in-h.
+
+       * lib/makefile.w32-in ($(BLD)/md5.$(O)):
+       ($(BLD)/sha1.$(O)):
+       ($(BLD)/sha256.$(O)):
+       ($(BLD)/sha512.$(O)): Depend on $(EMACS_ROOT)/nt/inc/stdalign.h.
+       Suggested by Christoph Scholtes <cschol2112@googlemail.com>.
+
+       * lib/getopt_.h: Regenerate.
+
+2012-05-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Assume gnulib does largefile.
+       Gnulib does the largefile configuration anyway, so when configure.in
+       invokes AC_SYS_LARGEFILE, that bloats 'configure' unnecessarily.
+       * configure.in (AC_SYS_LARGEFILE): Remove.
+       * lib/gnulib.mk: Autoupdate.
+
+2012-05-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Merge from gnulib.  (Bug#11527)
+
+       The build procedure now creates <stdalign.h> and <sys/types.h> for
+       older hosts that lack a working <stdalign.h> or whose
+       <sys/types.h> does not define pid_t, size_t, ssize_t, mode_t.  New
+       symbols such as WINDOWS_64_BIT_OFF_T may require attention in the
+       msdos and nt builds.
+
+       Here is a precis of gnulib changes that seem relevant; please see
+       the gnulib ChangeLog for details.
+
+       2012-05-18 crypto: fix bug in large buffer handling
+       2012-05-14 ignore-value.h: remove unused _GL_ATTRIBUTE_DEPRECATED
+       2012-05-10 _Noreturn: port config.h to gcc -Wundef
+       2012-05-08 warnings.m4: give a means to specify the program to compile
+       2012-05-07 stdint: be more consistent with glibc, SunOS libc
+       2012-04-21 Large File Support for native Windows platforms.
+       2012-04-14 stat: Bypass buggy override in mingw64.
+       2012-03-29 stdio: don't assume gets any more
+       2012-03-24 Enable common subexpression optimization in GCC.
+       2012-02-09 maint: replace FSF snail-mail addresses with URLs
+       2012-01-30 sys_stat: Fix support for mingw64 and MSVC.
+       2012-01-28 strtoimax: eliminate need for stdint.h, inttypes.h checks
+       2012-01-21 stdint: Add support for Android.
+       2012-01-15 Improve support for MSVC 9.
+       2012-01-08 mktime: Avoid compilation error on Solaris 11.
+       2012-01-05 Use ', not `, for quoting output.
+       2012-01-05 strtoimax: Don't replace systems where intmax_t is int.
+       2012-01-05 strtoimax: Work around AIX 5.1 bug.
+       2012-01-05 inttypes: Modernize.
+       2011-12-13 inttypes, stdint: add C++11 support
+       2011-11-26 Fix conflict between two instantiations of module 'unistd'.
+       2011-11-21 _Noreturn: Check that _MSC_VER is defined
+       2011-11-10 ptsname_r: Avoid compilation error on OSF/1 5.1.
+       2011-11-09 raise: fix mingw handling of SIGPIPE
+       2011-10-27 Add stdalign module and use it in other modules.
+
+       * lib/stdalign.in.h, lib/sys_types.in.h, m4/off_t.m4, m4/stdalign.m4:
+       * m4/sys_types_h.m4:
+       New files.
+       * build-aux/move-if-change, build-aux/snippet/_Noreturn.h:
+       * build-aux/snippet/arg-nonnull.h, build-aux/snippet/c++defs.h:
+       * build-aux/snippet/warn-on-use.h, doc/misc/texinfo.tex:
+       * lib/alloca.in.h, lib/allocator.h, lib/careadlinkat.c:
+       * lib/careadlinkat.h, lib/dosname.h, lib/dup2.c, lib/filemode.c:
+       * lib/filemode.h, lib/ftoastr.c, lib/ftoastr.h, lib/getloadavg.c:
+       * lib/getopt.c, lib/getopt.in.h, lib/getopt1.c, lib/getopt_int.h:
+       * lib/gettext.h, lib/gnulib.mk, lib/ignore-value.h, lib/intprops.h:
+       * lib/inttypes.in.h, lib/lstat.c, lib/md5.c, lib/md5.h, lib/mktime.c:
+       * lib/pathmax.h, lib/pthread_sigmask.c, lib/readlink.c, lib/sha1.c:
+       * lib/sha1.h, lib/sha256.c, lib/sha256.h, lib/sha512.c, lib/sha512.h:
+       * lib/signal.in.h, lib/sigprocmask.c, lib/stat.c, lib/stdarg.in.h:
+       * lib/stdbool.in.h, lib/stddef.in.h, lib/stdint.in.h, lib/stdio.in.h:
+       * lib/stdlib.in.h, lib/strftime.c, lib/strftime.h, lib/strtoimax.c:
+       * lib/strtol.c, lib/strtoll.c, lib/strtoul.c, lib/strtoull.c:
+       * lib/symlink.c, lib/sys_stat.in.h, lib/time.in.h, lib/time_r.c:
+       * lib/u64.h, lib/unistd.in.h, lib/verify.h, m4/00gnulib.m4:
+       * m4/alloca.m4, m4/c-strtod.m4, m4/dup2.m4, m4/extensions.m4:
+       * m4/filemode.m4, m4/getloadavg.m4, m4/getopt.m4, m4/gl-comp.m4:
+       * m4/gnulib-common.m4, m4/gnulib-tool.m4, m4/include_next.m4:
+       * m4/inttypes.m4, m4/largefile.m4, m4/longlong.m4, m4/lstat.m4:
+       * m4/md5.m4, m4/mktime.m4, m4/multiarch.m4, m4/nocrash.m4:
+       * m4/pathmax.m4, m4/pthread_sigmask.m4, m4/readlink.m4, m4/sha1.m4:
+       * m4/sha256.m4, m4/sha512.m4, m4/signal_h.m4, m4/signalblocking.m4:
+       * m4/socklen.m4, m4/ssize_t.m4, m4/st_dm_mode.m4, m4/stat.m4:
+       * m4/stdarg.m4, m4/stdbool.m4, m4/stddef_h.m4, m4/stdint.m4:
+       * m4/stdio_h.m4, m4/stdlib_h.m4, m4/strftime.m4, m4/strtoimax.m4:
+       * m4/strtoll.m4, m4/strtoull.m4, m4/strtoumax.m4, m4/symlink.m4:
+       * m4/sys_stat_h.m4, m4/time_h.m4, m4/time_r.m4, m4/tm_gmtoff.m4:
+       * m4/unistd_h.m4, m4/warnings.m4, m4/wchar_t.m4:
+       Update from gnulib.
+
+2012-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove src/m/*.
+       * configure.in: Remove all mention of src/m/*.
+       (machine, machfile, M_FILE, config_machfile, and_machfile): Remove.
+       All uses removed.
+       (BITS_PER_CHAR, BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG)
+       (BITS_PER_LONG_LONG): Move to src/lisp.h.
+       * lib/makefile.w32-in: Remove dependencies on
+       $(EMACS_ROOT)/src/m/intel386.h.
+       * make-dist: Don't make links to src/m.
+
+2012-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * Makefile.in (ACLOCAL_INPUTS): Fix up gnulib-comp.m4 name.  (Bug#11529)
+       Without this further fix, aclocal was being invoked unnecessarily.
+
+2012-05-22  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (blessmail, install-arch-dep, uninstall):
+       Check cd lib-src works.
+       (install-arch-dep, uninstall): Remove unneeded subshells.
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * update-subdirs: Move to build-aux/.
+       * make-dist, Makefile.in (install-arch-indep): Update for this change.
+
+       * Makefile.in (leimdir): New, set by configure.
+       (COPYDIR, COPYDESTS): Add leim directories.
+       (install-leim): Remove.
+       (install-arch-indep): Handle leim installation directly.
+
+       * vpath.sed: Remove unused file.
+       * make-dist: No more vpath.sed.
+
+2012-05-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use full name for m4/gnulib-comp.m4.  (Bug#11529)
+       Previously the file was named m4/gl-comp.m4 due to DOS 8+3 restrictions,
+       even though the file's name in gnulib is m4/gnulib-comp.m4.
+       This had a problem when merging from gnulib, as the code temporarily
+       renamed it to the full name, causing problems when interrupted.
+       Now the file has its full name, with the idea that we will find
+       a solution for MS-DOS that does not affect the rest of Emacs.
+       * m4/gnulib-comp.m4: Rename from m4/gl-comp.m4.
+
+       Assume C89 or later.
+       * configure.in (AC_C_PROTOTYPES, AC_C_VOLATILE, AC_C_CONST)
+       (POINTER_TYPE, PROTOTYPES): Remove.
+
+       Make merging from gnulib a script, not a makefile action.
+       Putting it in a makefile has some problems with reflection, as
+       merging from gnulib updates 'configure', which can update the makefile.
+       Putting it in a standalone script breaks this loop.
+       * Makefile.in (gnulib_srcdir, $(gnulib_srcdir), DOS_gnulib_comp.m4)
+       (GNULIB_MODULES, GNULIB_TOOL_FLAGS, sync-from-gnulib):
+       Remove, moving the actions to the script admin/merge-gnulib.
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LEIM_INSTALLDIR):
+       Rename to leimdir, treat like lispdir.
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-indep, install-doc, install-info)
+       (uninstall): Scrap superfluous subshells.
+
+2012-05-19  Ulrich Mueller  <ulm@gentoo.org>
+
+       * Makefile.in (install-etc): Respect DESTDIR.  (Bug#11518)
+
+2012-05-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.in (AC_CHECK_FUNCS): Remove XSetWMProtocols,
+       getdomainname, mblen (twice), mbrlen (twice), mbsinit, ualarm,
+       getsockopt, setsockopt, mremap, mempcpy.
+
+       * configure.in (machine): Do not set to 'vax', since src/m/vax.h
+       is being removed.
+       (AC_CHECK_FUNCS): Remove ftime.
+
+2012-05-19  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-indep): Remove unneeded subshell.
+
+       * Makefile.in (install-arch-indep): Remove unneeded chmod.
+       Set permissions of lisp/subdirs.el.
+
+       * Makefile.in (SUBDIR): Add leim.  Update users.
+
+       * Makefile.in (lib, lib-src, lisp): Check cd return value.
+
+       * Makefile.in (leim): No need to set PARALLEL.
+
+2012-05-18  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-indep, install-info, install-man):
+       Simplify some one-sided ifs.
+
+       * Makefile.in: Install only the relevant DOC file.
+       (install-arch-indep): Delete etc/DOC*.
+       (install-doc): No more need to delete etc/DOC.
+
+       * Makefile.in (install-arch-indep): Split into several rules.
+       (install-doc, innstall-info, install-man): New rules.
+
+       * configure.in (mandir): May as well include it in the NS app bundle.
+
+       * configure.in (INSTALL_ARCH_INDEP_EXTRA): New output variable.
+       * Makefile.in (INSTALL_ARCH_INDEP_EXTRA): New, set by configure.
+       (install-arch-indep): Don't install-etc for self-contained ns builds.
+
+       * configure.in (GCC_TEST_OPTIONS, NON_GCC_TEST_OPTIONS) <darwin>:
+       No longer unconditonally add /sw directories.  (Bug#2280)
+
+       * Makefile.in (install-arch-dep): Depend on install-arch-indep.
+       (install-arch-indep): Depend on install-leim.
+       (install): Remove explicit install-leim dependence.
+
+       * Makefile.in (install-arch-indep):
+       Move last element of mkdir rule here.
+       (mkdir): Remove rule.
+
+       * Makefile.in (install-arch-indep): Remove unneeded chmods.
+       INSTALL_DATA does this for us.
+
+       * Makefile.in (install-arch-dep): Ensure bindir exists.
+       Drop mkdir dependency.
+       (install-arch-indep): Ensure docdir, infodir, mandir exist.
+       (install-leim): Drop mkdir dependency.
+       (mkdir): Remove most directories, now made in relevant rules.
+
+       * Makefile.in (install-arch-indep): Combine adjacent loops.
+
+2012-05-17  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-etc, mkdir):
+       Make relevant directories in install-etc rather than mkdir.
+
+       * Makefile.in (write_subdir): Create the directory if needed.
+       (install-arch-dep, mkdir): No need to make site-lisp directories.
+
+       * Makefile.in (write_subdir): New.
+       (install-arch-indep, install-arch-dep): Use $write_subdir.
+
+       * configure.in (docdir, etcdir, infodir, lispdir):
+       For a self-contained ns build, set these to the appropriate values.
+       * Makefile.in (install-arch-dep): No need to move info/ any more.
+
+       * configure.in (ns_self_contained): New output variable.
+       * Makefile.in (ns_self_contained): New, set by configure.
+       (install-arch-dep): For a self-contained ns build,
+       don't bother installing binaries then immediately deleting them.
+
+       * Makefile.in (ns_appbindir, ns_appresdir):
+       Move them before things that may refer to them.
+       (install-arch-dep): No need to relocate self-contained ns libexec.
+
+       * configure.in (archlibdir): Set it for self-contained ns builds.
+       (libexecdir): Don't expand it now (this is mainly cosmetic).
+
+2012-05-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.in: Simplify by removing CPP etc.
+       (CPP_TEST_OPTIONS, NON_GNU_CPP, cc_specified, SPECIFIED_CFLAGS)
+       (SPECIFED_CPP, CPP, NON_GNU_CC, AC_PROG_CPP): Remove; not needed.
+       In particular we no longer need to fiddle with CPP, since we don't
+       use CPP specially any more.
+       (gl_EARLY): Invoke this after adjusting CC, so that it uses the
+       adjusted compiler.
+       (AC_PROG_INSTALL, AC_PROG_MKDIR_P, AC_PROG_RANLIB): Comment out,
+       since gl_EARLY and/or Autoconf already does these.
+
+2012-05-16  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in: Try to fix building with gcc >= 4.6 on Darwin.
+       (CPP): Do not unconditionally set it on Darwin.
+       Instead, try to test if -no-cpp-precomp is accepted.
+       (CPP_TEST_OPTIONS, SPECIFIED_CPP): New.  (Bug#9755)
+
+2012-05-15  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-dep): Replace use of MV_DIRS.
+
+       * Makefile.in (install-arch-dep): Do not hard-code version number.
+
+       * Makefile.in (install-arch-dep): NS install no longer needs to
+       symlink libexec/* into bin/, since 2012-05-14 ns_init_paths change.
+
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (ns_appbindir): Remove trailing "/".
+
+       * configure.in (AC_PROG_MKDIR_P): Call it, to set MKDIR_P.
+       (MKDEPDIR): Use $MKDIR_P.
+       * Makefile.in (MKDIR_P): New, set by configure.
+       (mkdir): Use $MKDIR_P.
+
+2012-05-11  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-indep): There are no more Makefile.c files.
+       Use INSTALL_DATA for the DOC file.
+       Remove dead code for ./lisp that never executes.
+
+2012-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (LEIM_INSTALLDIR): New output variable.
+
+2012-05-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * .dir-locals.el (log-edit-mode): Enable gnu-style checks.
+
+2012-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * make-dist: No more doc/lispref/*.el.
 
 2012-05-05  Andreas Schwab  <schwab@linux-m68k.org>
 
-       * configure.in: Fix last change.
+       * configure.in: Fix quoting bugs.
+
+2012-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (INFO_EXT, INFO_OPTS): New output variables.
 
 2012-05-02  Glenn Morris  <rgm@gnu.org>
 
+       * configure.in (LD_SWITCH_SYSTEM): Don't try to defeat
+       the choices made by FreeBSD and NetBSD.  (Bug#10313)
+
+       * Makefile.in (INFO_FILES): Remove variable.
+       (INFO_NONMISC): New variable.
+       (install-arch-indep, uninstall): Don't use $INFO_FILES.
+
        * Makefile.in (uninstall): Remove useless-use-of-for; that for
        some reason caused problems on an old Solaris.
 
        * Makefile.in (install-arch-indep, uninstall):
        Ensure that INSTALL-type commands are run from top-level.
 
-       * Makefile.in (INFO_FILES): Add emacs-gnutls; accidentally
-       omitted from 2012-04-12 backport from trunk.
-
        * info/dir: Make some entries consistent with the source texi files.
 
        * configure.in (LIBS_TERMCAP): Fix netbsd logic, broken 2012-03-04.
 
-2012-04-18  Ludovic Courtès  <ludo@gnu.org>
+2012-05-02  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install-arch-indep):
+       Combine adjacent install-data and install-info loops.
+
+2012-05-01  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (MAN_PAGES): Remove.
+       (install-arch-indep, uninstall): Don't use $MAN_PAGES.
+
+       * configure.in: Try libtinfo for tputs.
+       (LIBS_TERMCAP) [gnu*]: Use libtinfo if it was found.  (Bug#9741)
+
+       * configure.in: Combine adjacent $opsys case blocks.
+
+       * configure.in (LIBS_TERMCAP): Remove unreachable branch for sol2.
+
+       * configure.in: Invert the TERMINFO logic,
+       since "yes" is far more common than "no".
+
+       * configure.in (HAVE_LIBNCURSES): Remove; it is required to be true.
+
+       * configure.in (LD_SWITCH_X_SITE_RPATH):
+       Rename from LD_SWITCH_X_SITE_AUX_RPATH.
+
+       * configure.in (LD_SWITCH_X_SITE_AUX): Remove; no longer used.
+
+2012-04-26  Glenn Morris  <rgm@gnu.org>
+
+       * make-dist: No more doc/lispref/tindex.pl.
+
+2012-04-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       * configure.in (dbus_validate_bus_name, dbus_validate_path)
+       (dbus_validate_interface, dbus_validate_member): Check also for
+       these library functions.
+
+2012-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.in (doug_lea_malloc): Check for __malloc_initialize_hook.
+       With glibc 2.14 or later, when compiled with GCC 4.7.0's
+       -Werror=deprecated-declarations flag, use of hooks like
+       __malloc_initialize_hook causes compilation to fail because these
+       hooks are deprecated.  Modify 'configure' to check for these hooks too.
+       Simplify the 'configure' code to test for all the hooks at once.
+       (emacs_cv_var___after_morecore_hook): Remove, replacing with ...
+       (emacs_cv_var_doug_lea_malloc): ... this new var.
+
+2012-04-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Sync from gnulib version 4f11d6bebc3098c64ffde27079ab0d0cecfd0cdc
+       dated 2011-10-07.  Regenerating from current gnulib would be a
+       pervasive change, and currently the trunk isn't open to such changes.
+       * configure.in (WARN_CFLAGS): Remove; no longer needed now
+       that gnulib does it.
+       * lib/gnulib.mk, m4/gl-comp.m4: Regenerate.
+
+2012-04-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * m4/gl-comp.m4: Update.  (Bug#11285)
+
+2012-04-20  Ludovic Courtès  <ludo@gnu.org>
 
        * configure.in: Don't use the -R option (Bug#11251).
 
-2012-04-12  Teodor Zlatanov  <tzz@lifelogs.com>
+2012-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       configure: new option --enable-gcc-warnings (Bug#11207)
+       I have been using this change for many months in my private copy
+       of Emacs, and have used it to find several bugs.  It's mature
+       enough to publish now.
+       * Makefile.in (GNULIB_MODULES): Add warnings, manywarnings.
+       * configure.in: Support --enable-gcc-warnings, in the style of
+       other GNU packages such as coreutils.
+       (C_WARNINGS_SWITCH): Remove, replacing with...
+       (WARN_CFLAGS, GNULIB_WARN_CFLAGS): New variable.
+       (PKG_CHECK_MODULES, C_SWITCH_X_SITE): Use -isystem rather than -I,
+       when including system files with GCC.
+       * etc/NEWS: Mention --enable-gcc-warnings.
+       * INSTALL (DETAILED BUILDING AND INSTALLATION): Likewise.
+       * lib/Makefile.am (AM_CFLAGS): New macro.
+       * m4/manywarnings.m4, m4/warnings.m4: New files, from gnulib.
+
+2012-04-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * configure.in (AC_CHECK_FUNCS):
+       Add getpwent, endpwent, getgrent, endgrent. (Bug#7900)
+
+2012-04-16  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (NS_HAVE_NSINTEGER): Remove unnecessary variable.
+
+       * configure.in: Remove X libs workaround for old autoconf.
+
+2012-04-12  Ken Brown  <kbrown@cornell.edu>
+
+       * configure.in: Warn that Cygwin 1.5 is unsupported.  (Bug#10398)
+
+2012-04-11  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in (GNUSTEP_CFLAGS): Rename from C_SWITCH_X_SYSTEM.
+
+2012-04-10  Glenn Morris  <rgm@gnu.org>
+
+       * configure.in: Conditionally generate admin/unidata/Makefile.
+
+2012-04-09  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * info/dir, Makefile.in (INFO_FILES): Add emacs-gnutls manual.
+
+2012-04-09  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (leim): Check cd return value.  Pass fewer variables.
+       (install-leim): Check cd return value.  Pass $MFLAGS.
+       (install-strip): Pass $MFLAGS.
+
+       * configure.in: Require makeinfo >= 4.7.  (Bug#10910)
+       Eg org.texi has been using 4.7 functions for some time.
+
+2012-04-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Check pkg-config exit status when configuring (Bug#10626).
+       * configure.in (PKG_CHECK_MODULES): Do not assume that pkg-config
+       works; check its exit status.  Problem reported by Jordi Gutiérrez
+       Hermoso in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00787.html>.
+
+2012-04-07  Glenn Morris  <rgm@gnu.org>
+
+       * README, configure.in (AC_INIT): Bump version to 24.1.50.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
 
-       * info/dir: Add emacs-gnutls.
+       * lib/makefile.w32-in (gnulib, all): Don't depend on stamp_BLD.
 
 2012-03-04  Paul Eggert  <eggert@cs.ucla.edu>
 
 2011-12-17  Paul Eggert  <eggert@cs.ucla.edu>
 
        Port HAVE_PTHREAD configuration to MirBSD 10 (Bug#10201).
-       * configure.in (HAVE_PTHREAD): Check for pthread_atfork if linking
+       * configure.in (HAVE_PTHREAD): Check for pthread_atfork if linking
        to gmalloc.c.  This should prevent a MirBSD 10 build failure reported
        by Nelson H. F. Beebe in
        <http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00065.html>.
 
 2010-03-12  Eli Zaretskii  <eliz@gnu.org>
 
-       These changes remove termcap.c from the build on Posix platforms.
+       These changes remove termcap.c from the build on POSIX platforms.
        * configure.in <AC_CHECK_HEADERS>: Remove termcap.h.
 
        * configure: Regenerated.
 
 2005-06-08  Steven Tamm  <steventamm@mac.com>
 
-       * configure.in: Support Darwin/MacOSX on Intel
+       * configure.in: Support Darwin/MacOSX on Intel.
 
 2005-06-06  Jan Djärv  <jan.h.d@swipnet.se>
 
 
 2004-10-08  Steven Tamm  <steventamm@mac.com>
 
-       * configure.in (HAVE_MALLOC_MALLOC_H): Test for malloc/malloc.h
+       * configure.in (HAVE_MALLOC_MALLOC_H): Test for malloc/malloc.h.
 
 2004-10-06  Jan Djärv  <jan.h.d@swipnet.se>
 
 
 2003-01-19  Jan Djärv  <jan.h.d@swipnet.se>
 
-       * configure.in: Add --with-gtk, --with-x-toolkit=gtk
+       * configure.in: Add --with-gtk, --with-x-toolkit=gtk.
 
        * INSTALL (DETAILED BUILDING AND INSTALLATION): Add text about GTK.
 
        * configure.in: New option, --enable-carbon-app, to specify
        that the application should be installed
        * Makefile.in (install-arch-dep): On Mac OS X, install the
-       Emacs.app application if carbon-app is enabled
+       Emacs.app application if carbon-app is enabled.
 
 2003-01-06  Dave Love  <fx@gnu.org>
 
 
 1995-09-30  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
-       * configure.in (powerpc-*-solaris2): New alternative.x
+       * configure.in (powerpc-*-solaris2): New alternative.
 
 1995-09-12  Karl Heuer  <kwzh@gnu.ai.mit.edu>
 
 
 1994-09-21  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
-       * configure.in (i[345]86-sequent-ptx*): Handle
+       * configure.in (i[345]86-sequent-ptx*): Handle.
 
 1994-09-20  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
-       * Makefile.in (paths-force): Depend on src/paths.h
+       * Makefile.in (paths-force): Depend on src/paths.h.
 
 1994-09-19  Karl Heuer  <kwzh@hal.gnu.ai.mit.edu>
 
 
 1994-09-18  Karl Heuer  <kwzh@hal.gnu.ai.mit.edu>
 
-       * Makefile.in (install-arch-indep): Copy DOC-*, not DOC*
+       * Makefile.in (install-arch-indep): Copy DOC-*, not DOC*.
 
        * configure.in: Add AC_AIX.
        Add checks to set HAVE_STRUCT_UTIMBUF, HAVE_TIMEVAL, HAVE_SELECT.
 
 1993-09-12  Roland McGrath  (roland@sugar-bombs.gnu.ai.mit.edu)
 
-       * make-dist: Dist vpath.sed
+       * make-dist: Dist vpath.sed.
 
        * Makefile.in (lib-src/Makefile, src/Makefile, oldXMenu/Makefile):
        Depend on vpath.sed.
diff --git a/INSTALL b/INSTALL
index 1e0844879cb35754d073b7b0265f87a1f48ffbde..2eab03975f946166d66f9b9f87ac3465d3015031 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -317,6 +317,19 @@ Use --with-wide-int to implement Emacs values with the type 'long long',
 even on hosts where a narrower type would do.  With this option, on a
 typical 32-bit host, Emacs integers have 62 bits instead of 30.
 
+Use --enable-gcc-warnings to enable compile-time checks that warn
+about possibly-questionable C code.  This is intended for developers
+and is useful with GNU-compatible compilers.  On a recent GNU system
+there should be no warnings; on older and on non-GNU systems the
+generated warnings may still be useful.
+
+Use --enable-link-time-optimization to enable link-time optimizer, which
+is available in GNU compiler since version 4.5.0.  If your compiler is not
+GNU or older than version 4.5.0, this option does nothing.  If `configure'
+can determine number of online CPUS on your system, final link-time
+optimization and code generation is executed in parallel using one job
+per each available online CPU.
+
 The `--prefix=PREFIXDIR' option specifies where the installation process
 should put emacs and its data files.  This defaults to `/usr/local'.
 - Emacs (and the other utilities users run) go in PREFIXDIR/bin
@@ -423,11 +436,19 @@ that supports the `VPATH' variable, such as GNU `make'.
 to the real source directory--there is no need, and installation will
 fail.)
 
-4) Look at `./lisp/paths.el'; if some of those values are not right
-for your system, set up the file `./lisp/site-init.el' with Emacs
-Lisp code to override them; it is not a good idea to edit paths.el
-itself.  YOU MUST USE THE LISP FUNCTION `setq' TO ASSIGN VALUES,
-rather than `defvar', as used by `./lisp/paths.el'.  For example,
+4) Put into `./lisp/site-init.el' or `./lisp/site-load.el' any Emacs
+Lisp code you want Emacs to load before it is dumped out.  Use
+site-load.el for additional libraries if you arrange for their
+documentation strings to be in the etc/DOC file (see
+src/Makefile.in if you wish to figure out how to do that).  For all
+else, use site-init.el.  Do not load byte-compiled code which
+was built with a non-nil value of `byte-compile-dynamic'.
+
+It is not a good idea to edit the normal .el files that come with Emacs.
+Instead, use a file like site-init.el to change settings.
+
+To change the value of a variable that is already defined in Emacs,
+you should use the Lisp function `setq', not `defvar'.  For example,
 
      (setq news-inews-program "/usr/bin/inews")
 
@@ -439,14 +460,6 @@ variable gets by default!  Make sure you know what kind of value the
 variable should have.  If you don't pay attention to what you are
 doing, you'll make a mistake.
 
-5) Put into `./lisp/site-init.el' or `./lisp/site-load.el' any Emacs
-Lisp code you want Emacs to load before it is dumped out.  Use
-site-load.el for additional libraries if you arrange for their
-documentation strings to be in the etc/DOC file (see
-src/Makefile.in if you wish to figure out how to do that).  For all
-else, use site-init.el.  Do not load byte-compiled code which
-was built with a non-nil value of `byte-compile-dynamic'.
-
 If you set load-path to a different value in site-init.el or
 site-load.el, Emacs will use *precisely* that value when it starts up
 again.  If you do this, you are on your own!
@@ -454,10 +467,10 @@ again.  If you do this, you are on your own!
 The `site-*.el' files are nonexistent in the distribution.  You do not
 need to create them if you have nothing to put in them.
 
-6) Refer to the file `./etc/TERMS' for information on fields you may
+5) Refer to the file `./etc/TERMS' for information on fields you may
 wish to add to various termcap entries.  (This is unlikely to be necessary.)
 
-7) Run `make' in the top directory of the Emacs distribution to finish
+6) Run `make' in the top directory of the Emacs distribution to finish
 building Emacs in the standard way.  The final executable file is
 named `src/emacs'.  You can execute this file "in place" without
 copying it, if you wish; then it automatically uses the sibling
@@ -468,8 +481,8 @@ installed locations, with `make install'.  By default, Emacs's files
 are installed in the following directories:
 
 `/usr/local/bin' holds the executable programs users normally run -
-               `emacs', `etags', `ctags', `emacsclient',
-               `grep-changelog', and `rcs-checkin'.
+               `emacs', `etags', `ctags', `emacsclient', and
+               `grep-changelog'.
 
 `/usr/local/share/emacs/VERSION/lisp' holds the Emacs Lisp library;
                `VERSION' stands for the number of the Emacs version
@@ -528,15 +541,15 @@ for its Lisp files by giving values for `make' variables as part of
 the command.  See the section below called `MAKE VARIABLES' for more
 information on this.
 
-8) Check the file `dir' in your site's info directory (usually
+7) Check the file `dir' in your site's info directory (usually
 /usr/local/share/info) to make sure that it has a menu entry for the
 Emacs info files.
 
-9) If your system uses lock files to interlock access to mailer inbox files,
+8) If your system uses lock files to interlock access to mailer inbox files,
 then you might need to make the movemail program setuid or setgid
 to enable it to write the lock files.  We believe this is safe.
 
-10) You are done!  You can remove executables and object files from
+9) You are done!  You can remove executables and object files from
 the build directory by typing `make clean'.  To also remove the files
 that `configure' created (so you can compile Emacs for a different
 configuration), type `make distclean'.  If you don't need some, or all
@@ -670,9 +683,9 @@ changing the s/*.h and m/*.h files.
 corresponding `Makefile.in' files.  This isn't so hard, just a matter
 of editing in appropriate substitutions for the @...@ constructs.
 
-The `configure' script is built from `configure.in' by the `autoconf'
+The `configure' script is built from `configure.ac' by the `autoconf'
 program.  You need at least the version of autoconf specified in the
-AC_PREREQ(...) command to rebuild `configure' from `configure.in'.
+AC_PREREQ(...) command to rebuild `configure' from `configure.ac'.
 
 BUILDING GNU EMACS BY HAND
 
@@ -713,15 +726,15 @@ directory of the Emacs distribution.
 in `./lib-src' to their final destinations, as selected in `./src/epaths.h'.
 
 Strictly speaking, not all of the executables in `./lib-src' need be copied.
-- The programs `hexl', `movemail', `profile', `rcs2log', and `vcdiff'
+- The programs `hexl', `movemail', `profile', and `rcs2log'
     are used by Emacs; they do need to be copied.
-- The programs `etags', `ctags', `emacsclient', and `rcs-checkin'
-    are intended to be run by users; they are handled below.
+- The programs `etags', `ctags', and `emacsclient' are intended to be
+    run by users; they are handled below.
 - The programs `make-docfile' and `test-distrib' were
     used in building Emacs, and are not needed any more.
 
 2) Copy the files in `./info' to the place specified in
-`./lisp/site-init.el' or `./lisp/paths.el'.  Note that if the
+`./lisp/site-init.el' or `./lisp/info.el'.  Note that if the
 destination directory already contains a file named `dir', you
 probably don't want to replace it with the `dir' file in the Emacs
 distribution.  Instead, you should make sure that the existing `dir'
@@ -735,9 +748,8 @@ of installing different versions.
 
 You can delete `./src/temacs'.
 
-4) Copy the programs `emacsclient', `ctags', `etags', and `rcs-checkin'
-from `./lib-src' to `/usr/local/bin'.  These programs are intended for
-users to run.
+4) Copy the programs `emacsclient', `ctags', and `etags' from `./lib-src'
+to `/usr/local/bin'.  These programs are intended for users to run.
 
 5) Copy the man pages in `./doc/man' into the appropriate man directory.
 
index 93e53fd09aad5b14126b2837497567694170fc37..e98d742fb33eae8abc972605712f7a011ff8c07c 100644 (file)
@@ -8,7 +8,7 @@ Building Emacs from Bazaar requires some tools that are not needed
 when building from a release.  You will need:
 
 autoconf  - at least the version specified near the start of
-  configure.in (in the AC_PREREQ command).
+  configure.ac (in the AC_PREREQ command).
 automake  - we recommend at least version 1.11.
 makeinfo  - not strictly necessary, but highly recommended, so that
   you can build the manuals.
@@ -30,7 +30,7 @@ options you can set):
 
 If you want later builds to go faster, at the expense of sometimes
 doing the wrong thing if you update the build procedure, you can
-invoke "./configure -C --disable-maintainer-mode" instead.
+invoke "./configure -C" instead.
 
 Some of the files that are included in the Emacs tarball, such as
 byte-compiled Lisp files, are not stored in Bazaar.  Therefore, to
index 9a9be4f0a4340a89e2bf392109a735e19b824879..95b0931087fc740cc71b3eb2cdc21630daa1d1d9 100644 (file)
@@ -2,7 +2,7 @@
 # DIST: make most of the changes to this file you might want, so try
 # DIST: that first.
 
-# Copyright (C) 1992-2012  Free Software Foundation, Inc.
+# Copyright (C) 1992-2012 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -66,10 +66,8 @@ CDPATH=
 
 # ==================== Things `configure' Might Edit ====================
 
-MAINTAINER_MODE_FLAG = --disable-maintainer-mode
-@MAINT@MAINTAINER_MODE_FLAG = --enable-maintainer-mode
 cache_file = @cache_file@
-CONFIGURE_FLAGS = --cache-file=$(cache_file) $(MAINTAINER_MODE_FLAG)
+CONFIGURE_FLAGS = --cache-file=$(cache_file)
 
 CC=@CC@
 CFLAGS=@CFLAGS@
@@ -90,6 +88,13 @@ configuration=@configuration@
 
 # ==================== Where To Install Things ====================
 
+# Location to install Emacs.app under GNUstep / Mac OS X.
+# Later values may use these.
+ns_appbindir=@ns_appbindir@
+ns_appresdir=@ns_appresdir@
+# Either yes or no depending on whether this is a relocatable Emacs.app.
+ns_self_contained=@ns_self_contained@
+
 # The default location for installation.  Everything is placed in
 # subdirectories of this directory.  The default values for many of
 # the variables below are expressed in terms of this one, so you may
@@ -117,30 +122,22 @@ datadir=@datadir@
 sharedstatedir=@sharedstatedir@
 
 # Where to install and expect executable files to be run by Emacs
-# rather than directly by users, and other architecture-dependent
-# data.         ${archlibdir} is a subdirectory of this.
+# rather than directly by users (and other architecture-dependent
+# data, although Emacs does not have any).  The executables
+# are actually installed in ${archlibdir}, which is (normally)
+# a subdirectory of this.
 libexecdir=@libexecdir@
 
 # Where to install Emacs's man pages.
-# This used to allow choice of the numeric extension, but this made
-# little sense since the files were always installed in man1/
-# (and they contain cross-references that expect them to be there).
+# Note they contain cross-references that expect them to be in section 1.
 mandir=@mandir@
 man1dir=$(mandir)/man1
-MAN_PAGES=ctags.1 ebrowse.1 emacs.1 emacsclient.1 etags.1 \
-          grep-changelog.1 rcs-checkin.1
 
-# Where to install and expect the info files describing Emacs. In the
-# past, this defaulted to a subdirectory of ${prefix}/lib/emacs, but
-# since there are now many packages documented with the texinfo
-# system, it is inappropriate to imply that it is part of Emacs.
+# Where to install and expect the info files describing Emacs.
 infodir=@infodir@
-INFO_FILES=ada-mode auth autotype calc ccmode cl dbus dired-x ebrowse  \
-           ede ediff edt eieio efaq eintr elisp emacs emacs-gnutls emacs-mime epa erc \
-          ert eshell eudc flymake forms gnus idlwave info mairix-el    \
-          message mh-e newsticker nxml-mode org pcl-cvs pgg rcirc      \
-          reftex remember sasl sc semantic ses sieve smtpmail speedbar \
-          tramp url vip viper widget woman
+# Info files not in the doc/misc directory (we get those via make echo-info).
+INFO_EXT=@INFO_EXT@
+INFO_NONMISC=emacs$(INFO_EXT) eintr$(INFO_EXT) elisp$(INFO_EXT)
 
 # If no makeinfo was found and configured --without-makeinfo, "no"; else "yes".
 HAVE_MAKEINFO=@HAVE_MAKEINFO@
@@ -168,10 +165,6 @@ VPATH=@srcdir@
 # Where to find the application default.
 x_default_search_path=@x_default_search_path@
 
-# Location to install Emacs.app under NeXT/Open/GNUstep / Cocoa
-ns_appbindir=@ns_appbindir@
-ns_appresdir=@ns_appresdir@
-
 # Where the etc/emacs.desktop file is to be installed.
 desktopdir=$(datarootdir)/applications
 
@@ -186,22 +179,27 @@ iconsrcdir=$(srcdir)/etc/images/icons
 # These variables hold the values Emacs will actually use.  They are
 # based on the values of the standard Make variables above.
 
-# Where to install the lisp files distributed with
+# Where to install the lisp, leim files distributed with
 # Emacs.  This includes the Emacs version, so that the
 # lisp files for different versions of Emacs will install
 # themselves in separate directories.
 lispdir=@lispdir@
+leimdir=@leimdir@
 
-# Directories Emacs should search for lisp files specific
-# to this site (i.e. customizations), before consulting
-# ${lispdir}.  This should be a colon-separated list of
-# directories.
+# Directories Emacs should search for standard lisp files.
+# The default is ${lispdir}:${leimdir}.
+standardlisppath=@standardlisppath@
+
+# Directories Emacs should search for lisp files specific to this
+# site (i.e. customizations), before consulting ${standardlisppath}.
+# This should be a colon-separated list of directories.
 locallisppath=@locallisppath@
 
 # Where Emacs will search to find its lisp files.  Before
 # changing this, check to see if your purpose wouldn't
 # better be served by changing locallisppath.  This
 # should be a colon-separated list of directories.
+# The default is ${locallisppath}:${standardlisppath}.
 lisppath=@lisppath@
 
 # Where Emacs will search for its lisp files while
@@ -239,7 +237,7 @@ gamedir=@gamedir@
 # Note that if the system does not provide a suitable install,
 # configure will use build-aux/install-sh.  Annoyingly, it does
 # not use an absolute path.  So we must take care to always run
-# INSTALL-type commands from the top-level directory.
+# INSTALL-type commands from the directory containing the Makefile.
 # This explains (I think) the cd thisdir seen in several install rules.
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -247,6 +245,7 @@ INSTALL_DATA = @INSTALL_DATA@
 INSTALL_INFO = @INSTALL_INFO@
 # By default, we uphold the dignity of our programs.
 INSTALL_STRIP =
+MKDIR_P = @MKDIR_P@
 
 # We use gzip to compress installed .el files.
 GZIP_PROG = @GZIP_PROG@
@@ -262,14 +261,8 @@ TRANSFORM = @program_transform_name@
 EMACS = `echo emacs${EXEEXT} | sed '$(TRANSFORM)'`
 EMACSFULL = `echo emacs-${version}${EXEEXT} | sed '$(TRANSFORM)'`
 
-# Subdirectories to make recursively.  `lisp' is not included
-# because the compiled lisp files are part of the distribution.
-# leim is not included because it needs special handling.
-#
-# Actually, we now include `lisp' as well, since the compiled files
-# are not included any more in case of bootstrap or in case Emacs was
-# checked out from a VCS.
-SUBDIR = lib lib-src src lisp
+# Subdirectories to make recursively.
+SUBDIR = lib lib-src src lisp leim
 
 # The subdir makefiles created by config.status.
 SUBDIR_MAKEFILES_IN = @SUBDIR_MAKEFILES_IN@
@@ -277,28 +270,29 @@ SUBDIR_MAKEFILES = `echo $(SUBDIR_MAKEFILES_IN:.in=) | sed 's|$(srcdir)/||g'`
 
 # Subdirectories to install, and where they'll go.
 # lib-src's makefile knows how to install it, so we don't do that here.
-# leim's makefile also knows how to install it, so we don't do that here.
-# When installing the info files, we need to do special things to
-# avoid nuking an existing dir file, so we don't do that here;
-# instead, we have written out explicit code in the `install' targets.
-COPYDIR = ${srcdir}/etc ${srcdir}/lisp
-COPYDESTS = $(DESTDIR)${etcdir} $(DESTDIR)${lispdir}
+# Directories that cannot simply be copied, eg info,
+# are treated separately.
+# quail appears twice because in out-of-tree builds, it exists twice.
+COPYDIR = ${srcdir}/etc ${srcdir}/lisp ${srcdir}/leim/ja-dic ${srcdir}/leim/quail leim/quail
+COPYDESTS = $(DESTDIR)${etcdir} $(DESTDIR)${lispdir} $(DESTDIR)${leimdir}/ja-dic $(DESTDIR)${leimdir}/quail $(DESTDIR)${leimdir}/quail
 
-all: ${SUBDIR} leim
+all: ${SUBDIR}
 
 removenullpaths=sed -e 's/^://g' -e 's/:$$//g' -e 's/::/:/g'
 
 # Generate epaths.h from epaths.in.  This target is invoked by `configure'.
-# See comments in configure.in for why it is done this way, as opposed
+# See comments in configure.ac for why it is done this way, as opposed
 # to just letting configure generate epaths.h from epaths.in in a
 # similar way to how Makefile is made from Makefile.in.
 epaths-force: FRC
-       @(lisppath=`echo ${lisppath} | ${removenullpaths}` ;            \
+       @(standardlisppath=`echo ${standardlisppath} | ${removenullpaths}` ; \
+         locallisppath=`echo ${locallisppath} | ${removenullpaths}` ; \
          buildlisppath=`echo ${buildlisppath} | ${removenullpaths}` ;  \
          x_default_search_path=`echo ${x_default_search_path}`; \
          gamedir=`echo ${gamedir}`; \
          sed < ${srcdir}/src/epaths.in > epaths.h.$$$$         \
-         -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "'"$${lisppath}"'";'      \
+         -e 's;\(#.*PATH_LOADSEARCH\).*$$;\1 "'"$${standardlisppath}"'";' \
+         -e 's;\(#.*PATH_SITELOADSEARCH\).*$$;\1 "'"$${locallisppath}"'";' \
          -e 's;\(#.*PATH_DUMPLOADSEARCH\).*$$;\1 "'"$${buildlisppath}"'";' \
          -e 's;\(#.*PATH_EXEC\).*$$;\1 "${archlibdir}";'               \
          -e 's;\(#.*PATH_INFO\).*$$;\1 "${infodir}";'                  \
@@ -309,63 +303,19 @@ epaths-force: FRC
          -e 's;\(#.*PATH_DOC\).*$$;\1 "${docdir}";') &&                \
        ${srcdir}/build-aux/move-if-change epaths.h.$$$$ src/epaths.h
 
-# For parallel make, src should be built before leim.
-# "export PARALLEL=0" is for SGI's Make, to prevent it from
-# running more than 1 process in the leim directory, especially for
-# the $TIT files there.
-leim:   src Makefile FRC
-       (export PARALLEL; PARALLEL=0; cd $@; $(MAKE) all $(MFLAGS) \
-         CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
-         LDFLAGS='${LDFLAGS}' MAKE='${MAKE}')
-
 lib-src src: lib
 
 src:   lib-src FRC
 
-.RECURSIVE: ${SUBDIR} leim
-
-# We need to build `emacs' in `src' to compile the *.elc files in `lisp'.
-lisp: src
-
-# Maintainers can put a copy of gnulib into $(gnulib_srcdir).
-gnulib_srcdir = ../gnulib
-$(gnulib_srcdir):
-       git clone git://git.savannah.gnu.org/gnulib.git $@
-
-# A shorter name that satisfies MS-DOS 8+3 constraints.
-DOS_gnulib_comp.m4 = gl-comp.m4
-
-# Update modules from gnulib, for maintainers, who should have it in
-# $(gnulib_srcdir) (relative to $(srcdir) and should have build tools
-# as per $(gnulib_srcdir)/DEPENDENCIES.
-GNULIB_MODULES = \
-  alloca-opt \
-  careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr \
-  dup2 \
-  filemode getloadavg getopt-gnu ignore-value intprops lstat \
-  mktime pthread_sigmask readlink \
-  socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
-GNULIB_TOOL_FLAGS = \
- --avoid=msvc-inval --avoid=msvc-nothrow \
- --avoid=raise --avoid=threadlib \
- --conditional-dependencies --import --no-changelog --no-vc-files \
- --makefile-name=gnulib.mk
-sync-from-gnulib: $(gnulib_srcdir)
-       -cd $(srcdir)/m4 && cp $(DOS_gnulib_comp.m4) gnulib-comp.m4
-       cd $(srcdir) && \
-         $(gnulib_srcdir)/gnulib-tool $(GNULIB_TOOL_FLAGS) $(GNULIB_MODULES)
-       cd $(srcdir)/m4 && rm gnulib-cache.m4 warn-on-use.m4
-       cd $(srcdir)/m4 && mv gnulib-comp.m4 $(DOS_gnulib_comp.m4)
-       cp $(gnulib_srcdir)/build-aux/texinfo.tex $(srcdir)/doc/misc
-       cp \
-         $(gnulib_srcdir)/build-aux/move-if-change \
-         $(srcdir)/build-aux
-       cd $(srcdir) && autoreconf -i -I m4
-.PHONY: sync-from-gnulib
+.RECURSIVE: ${SUBDIR}
+
+# We need to build `emacs' in `src' to compile the *.elc files in `lisp'
+# and `leim'.
+lisp leim: src
 
 # These targets should be "${SUBDIR} without `src'".
-lib lib-src lisp: Makefile FRC
-       cd $@; $(MAKE) all $(MFLAGS)                           \
+lib lib-src lisp leim: Makefile FRC
+       cd $@ && $(MAKE) all $(MFLAGS)                         \
          CC='${CC}' CFLAGS='${CFLAGS}' CPPFLAGS='${CPPFLAGS}' \
          LDFLAGS='${LDFLAGS}' MAKE='${MAKE}'
 
@@ -394,7 +344,7 @@ src: Makefile FRC
          VCSWITNESS="$$vcswitness"
 
 blessmail: Makefile src FRC
-       cd lib-src; $(MAKE) maybe-blessmail $(MFLAGS) \
+       cd lib-src && $(MAKE) maybe-blessmail $(MFLAGS) \
          MAKE='${MAKE}' archlibdir='$(archlibdir)'
 
 # We used to have one rule per */Makefile.in, but that leads to race
@@ -414,16 +364,17 @@ config.status: ${srcdir}/configure ${srcdir}/lisp/version.el
            ./configure $(CONFIGURE_FLAGS); \
        fi
 
-AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/aclocal.m4
+AUTOCONF_INPUTS = $(srcdir)/configure.ac $(srcdir)/aclocal.m4
 
 $(srcdir)/configure: $(AUTOCONF_INPUTS)
        cd ${srcdir} && autoconf
 
-ACLOCAL_INPUTS = @MAINT@ $(srcdir)/m4/$(DOS_gnulib_comp.m4)
+ACLOCAL_INPUTS = $(srcdir)/m4/gnulib-comp.m4
 $(srcdir)/aclocal.m4: $(ACLOCAL_INPUTS)
        cd $(srcdir) && aclocal -I m4
 
-AUTOMAKE_INPUTS = @MAINT@ $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am $(srcdir)/lib/gnulib.mk
+AUTOMAKE_INPUTS = $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am \
+  $(srcdir)/lib/gnulib.mk
 $(srcdir)/lib/Makefile.in: $(AUTOMAKE_INPUTS)
        cd $(srcdir) && automake --gnu -a -c lib/Makefile
 am--refresh: $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/src/config.in
@@ -446,51 +397,55 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
 ## don't have to duplicate the list of utilities to install in
 ## this Makefile as well.
 
-## On AIX, use tar xBf.
-## On Xenix, use tar xpf.
-
-.PHONY: install mkdir
+.PHONY: install
 
-## We delete each directory in ${COPYDESTS} before we copy into it;
-## that way, we can reinstall over directories that have been put in
-## place with their files read-only (perhaps because they are checked
-## into RCS).  In order to make this safe, we make sure that the
-## source exists and is distinct from the destination.
-### We do install-arch-indep first because
-### the executable needs the Lisp files and DOC file to work properly.
-install: all install-arch-indep install-arch-dep install-leim blessmail
+install: all install-arch-indep install-doc install-arch-dep blessmail
        @true
 
-MV_DIRS = for i in $$dir; do rm -fr `basename "$$i"` ; mv "$$i" . ; done
+## Ensure that $subdir contains a subdirs.el file.
+## Here and elsewhere, we set the umask so that any created files are
+## world-readable.
+## TODO it might be good to warn about non-standard permissions of
+## pre-existing directories, but that does not seem easy.
+write_subdir=if [ -f $${subdir}/subdirs.el ]; \
+       then true; \
+       else \
+         umask 022; \
+         ${MKDIR_P} $${subdir}; \
+         (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
+          echo "    (normal-top-level-add-subdirs-to-load-path))") \
+           > $${subdir}/subdirs.el; \
+       fi
 
 ### Install the executables that were compiled specifically for this machine.
-### It would be nice to do something for a parallel make
-### to ensure that install-arch-indep finishes before this starts.
-install-arch-dep: mkdir
-       (cd lib-src; \
+### We do install-arch-indep first because the executable needs the
+### Lisp files and DOC file to work properly.
+install-arch-dep: install-arch-indep install-doc
+       umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
+       cd lib-src && \
          $(MAKE) install $(MFLAGS) prefix=${prefix} \
            exec_prefix=${exec_prefix} bindir=${bindir} \
            libexecdir=${libexecdir} archlibdir=${archlibdir} \
-           INSTALL_STRIP=${INSTALL_STRIP})
-       ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} $(DESTDIR)${bindir}/$(EMACSFULL)
-       -chmod 1755 $(DESTDIR)${bindir}/$(EMACSFULL)
-       rm -f $(DESTDIR)${bindir}/$(EMACS)
-       -ln $(DESTDIR)${bindir}/$(EMACSFULL) $(DESTDIR)${bindir}/$(EMACS)
-       if test "${ns_appresdir}" != ""; then \
-         ( cd ${ns_appresdir} ; \
-           if test -d share/emacs ; then dir=share/emacs/*/*; $(MV_DIRS); fi;\
-           if test -d share/info ; then dir=share/info; $(MV_DIRS) ; fi ; \
-           rm -fr share ) ; \
-         ( cd ${ns_appbindir} ; \
-           if cd libexec ; then dir=emacs/*/*/* ; $(MV_DIRS); \
-           rm -fr emacs; if cd ../bin; then rm -f emacs emacs-24*; \
-           ln -sf ../libexec/* . ; fi ; fi ) ; \
-       else true ; fi
-
-## FIXME is the emacs-24* bit above really necessary and correct?
-## What if I have 24.1 and 24.2 installed at the same time?
-## In any case, it should use something like echo $version | sed 's/\..*//'
-## instead of hard-coding a version.
+           INSTALL_STRIP=${INSTALL_STRIP}
+       if test "${ns_self_contained}" = "no"; then \
+         ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} $(DESTDIR)${bindir}/$(EMACSFULL) || exit 1 ; \
+         chmod 1755 $(DESTDIR)${bindir}/$(EMACSFULL) ; \
+         rm -f $(DESTDIR)${bindir}/$(EMACS) ; \
+         ln $(DESTDIR)${bindir}/$(EMACSFULL) $(DESTDIR)${bindir}/$(EMACS) || true ; \
+       else \
+         subdir=${ns_appresdir}/site-lisp; \
+         ${write_subdir} || exit 1; \
+         rm -rf ${ns_appresdir}/share; \
+       fi
+
+## In the share directory, we are deleting:
+## applications (with emacs.desktop, also found in etc/)
+## emacs (basically empty except for unneeded site-lisp directories)
+## icons (duplicates etc/images/icons/hicolor)
+
+## This is install-etc for everything except self-contained-ns builds.
+## For them, it is empty.
+INSTALL_ARCH_INDEP_EXTRA = @INSTALL_ARCH_INDEP_EXTRA@
 
 ## http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg01672.html
 ## Needs to be the user running install, so configure can't set it.
@@ -500,80 +455,109 @@ set_installuser=for installuser in $${LOGNAME} $${USERNAME} $${USER} \
        done
 
 ### Install the files that are machine-independent.
-### Most of them come straight from the distribution;
-### the exception is the DOC-* files, which are copied
-### from the build directory.
-
-## Note that we copy DOC* and then delete DOC
-## as a workaround for a bug in tar on Ultrix 4.2.
+### Most of them come straight from the distribution; the exception is
+### the DOC file, which is copied from the build directory.
 
-## We install only the relevant DOC file if possible
-## (ie DOC-${version}.buildnumber), otherwise DOC-${version}*.
+## We delete each directory in ${COPYDESTS} before we copy into it;
+## that way, we can reinstall over directories that have been put in
+## place with their files read-only (perhaps because they are checked
+## into RCS).  In order to make this safe, we make sure that the
+## source exists and is distinct from the destination.
 
-## If people complain about the h flag in tar command, take that out.
-## That flag is also used in leim/Makefile.in
+## We delete etc/DOC* because there may be irrelevant DOC files from
+## other builds in the source directory.  This is ok because we just
+## deleted the entire installed etc/ directory and recreated it.
+## install-doc installs the relevant DOC.
 
 ## Note that the Makefiles in the etc directory are potentially useful
 ## in an installed Emacs, so should not be excluded.
 
-install-arch-indep: mkdir info install-etc
-       -set ${COPYDESTS} ; \
-       unset CDPATH; \
-       for dir in ${COPYDIR} ; do \
-         if [ `(cd $$1 && /bin/pwd)` != `(cd $${dir} && /bin/pwd)` ] ; then \
-           rm -rf $$1 ; \
-         fi ; \
-         shift ; \
-       done
+## I'm not sure creating locallisppath here serves any useful purpose.
+## If it has the default value, then the later write_subdir commands
+## will ensure all these components exist.
+## This will only do something if locallisppath has a non-standard value.
+## Is it really Emacs's job to create those directories?
+## Should we also be ensuring they contain subdirs.el files?
+## It would be easy to do, just use write_subdir.
+
+## Note that we use tar instead of plain old cp -R/-r because the latter
+## is apparently not portable (even in 2012!).
+## http://lists.gnu.org/archive/html/emacs-devel/2012-05/msg00278.html
+## I have no idea which platforms Emacs supports where cp -R does not
+## work correctly, and therefore no idea when tar can be replaced.
+## See also these comments from 2004 about cp -r working fine:
+## http://lists.gnu.org/archive/html/autoconf-patches/2004-11/msg00005.html
+install-arch-indep: install-info install-man ${INSTALL_ARCH_INDEP_EXTRA}
+       umask 022 ; \
+         $(MKDIR_P) $(DESTDIR)`echo ${locallisppath} | sed 's,:, $(DESTDIR),g'`
        -set ${COPYDESTS} ; \
-       mkdir ${COPYDESTS} ; \
-       chmod ugo+rx ${COPYDESTS} ; \
        unset CDPATH; \
        $(set_installuser); \
        for dir in ${COPYDIR} ; do \
+         [ -d $${dir} ] || exit 1 ; \
          dest=$$1 ; shift ; \
-         [ -d $${dir} ] \
-         && [ `(cd $${dir} && /bin/pwd)` != `(cd $${dest} && /bin/pwd)` ] \
-         && (echo "Copying $${dir} to $${dest}..." ; \
-             (cd $${dir}; tar -chf - . ) \
-               | (cd $${dest}; umask 022; \
-                   tar -xvf - && cat > /dev/null) || exit 1; \
-             find $${dest} -exec chown $${installuser} {} ';' ;\
-             for subdir in `find $${dest} -type d -print` ; do \
-               chmod a+rx $${subdir} ; \
-               rm -f  $${subdir}/.gitignore ; \
-               rm -f  $${subdir}/.arch-inventory ; \
-               rm -f  $${subdir}/.DS_Store ; \
-               rm -f  $${subdir}/\#* ; \
-               rm -f  $${subdir}/.\#* ; \
-               rm -f  $${subdir}/*~ ; \
-               rm -f  $${subdir}/*.orig ; \
-               [ "$${dir}" != "${srcdir}/etc" ] && \
-                rm -f $${subdir}/[mM]akefile*.c $${subdir}/[mM]akefile*[.-]in \
-                  $${subdir}/[mM]akefile ; \
-               rm -f  $${subdir}/ChangeLog* ; \
-             done) ; \
+         [ -d $${dest} ] && \
+           [ `cd $${dest} && /bin/pwd` = `cd $${dir} && /bin/pwd` ] && \
+           continue ; \
+         if [ "$${dir}" = "leim/quail" ]; then \
+           [ `cd $${dir} && /bin/pwd` = `cd ${srcdir}/leim/quail && /bin/pwd` ] && \
+             continue ; \
+         else \
+           rm -rf $${dest} ; \
+           umask 022; ${MKDIR_P} $${dest} ; \
+         fi ; \
+         echo "Copying $${dir} to $${dest}..." ; \
+         (cd $${dir}; tar -chf - . ) \
+           | (cd $${dest}; umask 022; \
+              tar -xvf - && cat > /dev/null) || exit 1; \
+         [ "$${dir}" != "${srcdir}/etc" ] || rm -f $${dest}/DOC* ; \
+         for subdir in `find $${dest} -type d -print` ; do \
+           rm -f $${subdir}/.gitignore ; \
+           rm -f $${subdir}/.arch-inventory ; \
+           rm -f $${subdir}/.DS_Store ; \
+           rm -f $${subdir}/\#* ; \
+           rm -f $${subdir}/.\#* ; \
+           rm -f $${subdir}/*~ ; \
+           rm -f $${subdir}/*.orig ; \
+           rm -f $${subdir}/ChangeLog* ; \
+           [ "$${dir}" != "${srcdir}/etc" ] && \
+             rm -f $${subdir}/[mM]akefile*[.-]in $${subdir}/[mM]akefile ; \
+         done ; \
+         find $${dest} -exec chown $${installuser} {} ';' ;\
        done
+       -rm -f $(DESTDIR)${leimdir}/leim-list.el
+       ${INSTALL_DATA} leim/leim-list.el $(DESTDIR)${leimdir}/leim-list.el
        -rm -f $(DESTDIR)${lispdir}/subdirs.el
-       $(srcdir)/update-subdirs $(DESTDIR)${lispdir}
-       if [ -f $(DESTDIR)${datadir}/emacs/${version}/site-lisp/subdirs.el ]; \
-       then true; \
-       else \
-         (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
-          echo "    (normal-top-level-add-subdirs-to-load-path))") \
-           > $(DESTDIR)${datadir}/emacs/${version}/site-lisp/subdirs.el; \
-       fi
-       chmod a+r $(DESTDIR)${datadir}/emacs/${version}/site-lisp/subdirs.el
-       -if [ -f $(DESTDIR)${datadir}/emacs/site-lisp/subdirs.el ]; \
-       then true; \
-       else \
-         (echo "(if (fboundp 'normal-top-level-add-subdirs-to-load-path)"; \
-          echo "    (normal-top-level-add-subdirs-to-load-path))") \
-           > $(DESTDIR)${datadir}/emacs/site-lisp/subdirs.el; \
-       fi
-       -chmod a+r $(DESTDIR)${datadir}/emacs/site-lisp/subdirs.el
+       umask 022; $(srcdir)/build-aux/update-subdirs $(DESTDIR)${lispdir}
+       subdir=$(DESTDIR)${datadir}/emacs/${version}/site-lisp ; \
+         ${write_subdir}
+       subdir=$(DESTDIR)${datadir}/emacs/site-lisp ; \
+         ${write_subdir} || true
+       [ -z "${GZIP_PROG}" ] || \
+         ( echo "Compressing *.el ..." ; \
+           unset CDPATH; \
+           thisdir=`/bin/pwd`; \
+           for dir in $(DESTDIR)${lispdir} $(DESTDIR)${leimdir}; do \
+             cd $${thisdir} ; \
+             cd $${dir} || exit 1 ; \
+             for f in `find . -name "*.elc" -print`; do \
+               ${GZIP_PROG} -9n `echo $$f|sed 's/.elc$$/.el/'` ; \
+             done ; \
+           done )
+       -chmod -R a+r $(DESTDIR)${datadir}/emacs/${version} ${COPYDESTS}
+
+# The last chmod isn't needed at present.
+
+## We install only the relevant DOC file if possible
+## (ie DOC-${version}.buildnumber), otherwise DOC-${version}*.
+## (Note "otherwise" is inaccurate since 2009-08-23.)
+
+## Note that install-arch-indep deletes and recreates the entire
+## installed etc/ directory, so we need it to run before this does.
+install-doc: install-arch-indep
        -unset CDPATH; \
-       if [ `(cd ./etc; /bin/pwd)` != `(cd $(DESTDIR)${docdir}; /bin/pwd)` ]; \
+       umask 022; ${MKDIR_P} $(DESTDIR)${docdir} ; \
+       if [ `cd ./etc; /bin/pwd` != `cd $(DESTDIR)${docdir}; /bin/pwd` ]; \
        then \
           fullversion=`./src/emacs --version | sed -n '1 s/GNU Emacs *//p'`; \
           if [ -f "./etc/DOC-$${fullversion}" ]; \
@@ -583,143 +567,83 @@ install-arch-indep: mkdir info install-etc
             docfile="DOC"; \
           fi; \
           echo "Copying etc/$${docfile} to $(DESTDIR)${docdir} ..." ; \
-          (cd ./etc; tar -chf - $${docfile}) \
-            |(cd $(DESTDIR)${docdir}; umask 022; tar -xvf - && cat > /dev/null) || exit 1; \
-          (cd $(DESTDIR)$(docdir); \
-           $(set_installuser); \
-           chown $${installuser} DOC*; chmod a+r DOC*; \
-           if test "`echo DOC-*`" != "DOC-*"; then rm -f DOC; fi); \
-       else true; fi
-       -unset CDPATH; \
-       if [ -r ./lisp ] \
-          && [ -r ./lisp/simple.el ] \
-          && [ x`(cd ./lisp; /bin/pwd)` != x`(cd $(DESTDIR)${lispdir}; /bin/pwd)` ] \
-          && [ x`(cd ${srcdir}/lisp; /bin/pwd)` != x`(cd ./lisp; /bin/pwd)` ]; \
-       then \
-          echo "Copying lisp/*.el and lisp/*.elc to $(DESTDIR)${lispdir} ..." ; \
-          (cd lisp; tar -chf - *.el *.elc) \
-            |(cd $(DESTDIR)${lispdir}; umask 022; tar -xvf - && cat > /dev/null) || exit 1; \
-          (cd $(DESTDIR)${lispdir}; \
-           $(set_installuser); \
-           find . -exec chown $${installuser} {} ';') ; \
-       else true; fi
-       -unset CDPATH; \
-       if [ -n "${GZIP_PROG}" ]; \
-       then \
-          echo "Compressing *.el ..." ; \
-          (cd $(DESTDIR)${lispdir}; for f in `find . -name "*.elc" -print`; do \
-               ${GZIP_PROG} -9n `echo $$f|sed 's/.elc$$/.el/'` ; \
-           done) \
+          ${INSTALL_DATA} etc/$${docfile} $(DESTDIR)${docdir}/$${docfile}; \
+          $(set_installuser); \
+            chown $${installuser} $(DESTDIR)${docdir}/$${docfile} || true ; \
        else true; fi
+
+install-info: info
+       umask 022; ${MKDIR_P} $(DESTDIR)${infodir}
        -unset CDPATH; \
        thisdir=`/bin/pwd`; \
-       if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd $(DESTDIR)${infodir} && /bin/pwd)` ]; \
-       then \
+       [ `cd ${srcdir}/info && /bin/pwd` = `cd $(DESTDIR)${infodir} && /bin/pwd` ] || \
          (cd $(DESTDIR)${infodir};  \
-          if [ -f dir ]; then true; \
-          else \
+          [ -f dir ] || \
             (cd $${thisdir}; \
-             ${INSTALL_DATA} ${srcdir}/info/dir $(DESTDIR)${infodir}/dir; \
-             chmod a+r $(DESTDIR)${infodir}/dir); \
-          fi; \
+             ${INSTALL_DATA} ${srcdir}/info/dir $(DESTDIR)${infodir}/dir) ; \
+          info_misc=`cd $${thisdir}/doc/misc; ${MAKE} echo-info | sed '/ing directory/d'`; \
           cd ${srcdir}/info ; \
-          for elt in $(INFO_FILES); do \
+          for elt in ${INFO_NONMISC} $${info_misc}; do \
              test "$(HAVE_MAKEINFO)" = "no" && test ! -f $$elt && continue; \
              for f in `ls $$elt $$elt-[1-9] $$elt-[1-9][0-9] 2>/dev/null`; do \
               (cd $${thisdir}; \
                ${INSTALL_DATA} ${srcdir}/info/$$f $(DESTDIR)${infodir}/$$f); \
-               chmod a+r $(DESTDIR)${infodir}/$$f; \
-               if [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ]; then \
-                 rm -f $(DESTDIR)${infodir}/$$f.gz; \
-                 ${GZIP_PROG} -9n $(DESTDIR)${infodir}/$$f; \
-               else true; fi; \
+               ( [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ] ) || continue ; \
+               rm -f $(DESTDIR)${infodir}/$$f.gz; \
+               ${GZIP_PROG} -9n $(DESTDIR)${infodir}/$$f; \
              done; \
-          done); \
-       else true; fi
-       -unset CDPATH; \
-       thisdir=`/bin/pwd`; \
-       if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd $(DESTDIR)${infodir} && /bin/pwd)` ]; \
-       then \
-         for elt in $(INFO_FILES); do \
-           test "$(HAVE_MAKEINFO)" = "no" && test ! -f $$elt && continue; \
-           (cd $${thisdir}; \
-            ${INSTALL_INFO} --info-dir=$(DESTDIR)${infodir} $(DESTDIR)${infodir}/$$elt); \
-         done; \
-       else true; fi
-       -chmod -R a+r $(DESTDIR)${datadir}/emacs/${version} ${COPYDESTS}
+            (cd $${thisdir}; \
+             ${INSTALL_INFO} --info-dir=$(DESTDIR)${infodir} $(DESTDIR)${infodir}/$$elt); \
+          done)
+
+install-man:
+       umask 022; ${MKDIR_P} $(DESTDIR)${man1dir}
        thisdir=`/bin/pwd`; \
        cd ${mansrcdir}; \
-       for page in ${MAN_PAGES}; do \
+       for page in *.1; do \
          (cd $${thisdir}; \
-          ${INSTALL_DATA} ${mansrcdir}/$${page} $(DESTDIR)${man1dir}/$${page}; \
-          chmod a+r $(DESTDIR)${man1dir}/$${page}; \
-          if [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ]; then \
-            rm -f $(DESTDIR)${man1dir}/$${page}.gz; \
-            ${GZIP_PROG} -9n $(DESTDIR)${man1dir}/$${page}; \
-          else true; fi ); \
+          ${INSTALL_DATA} ${mansrcdir}/$${page} $(DESTDIR)${man1dir}/$${page}); \
+         ( [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ] ) || continue ; \
+         rm -f $(DESTDIR)${man1dir}/$${page}.gz; \
+         ${GZIP_PROG} -9n $(DESTDIR)${man1dir}/$${page}; \
        done
 
 ## Install those items from etc/ that need to end up elsewhere.
-install-etc: mkdir
+install-etc:
+       umask 022; ${MKDIR_P} $(DESTDIR)${desktopdir}
        ${INSTALL_DATA} ${srcdir}/etc/emacs.desktop \
          $(DESTDIR)${desktopdir}/emacs.desktop
-       for icon in $(iconsrcdir)/*/*/apps/*.* \
-         $(iconsrcdir)/*/*/mimetypes/*.*; do \
-         if [ -r $${icon} ]; then \
-           iicon=`echo "$${icon}" | sed 's,$(srcdir)/etc/images/icons,$(DESTDIR)${icondir},'` ; \
-           ${INSTALL_DATA} $${icon} $${iicon} ; \
-         fi ; \
+       thisdir=`/bin/pwd`; \
+       cd ${iconsrcdir} || exit 1; umask 022 ; \
+       for dir in */*/apps */*/mimetypes; do \
+         [ -d $${dir} ] || continue ; \
+         ( cd $${thisdir}; ${MKDIR_P} $(DESTDIR)${icondir}/$${dir} ) ; \
+         for icon in $${dir}/*.*; do \
+           [ -r $${icon} ] || continue ; \
+           ( cd $${thisdir}; \
+             ${INSTALL_DATA} ${iconsrcdir}/$${icon} $(DESTDIR)${icondir}/$${icon} ) \
+           || exit 1; \
+         done ; \
        done
 
-### Install LEIM files.  Although they are machine-independent, we
-### have separate target here instead of including it in
-### `install-arch-indep'.  People who extracted LEIM files after they
-### installed Emacs itself can install only LEIM files by this target.
-install-leim: leim/Makefile mkdir
-       cd leim; $(MAKE) install
-
 ### Build Emacs and install it, stripping binaries while installing them.
 install-strip:
-       $(MAKE) INSTALL_STRIP=-s install
-
-### Build all the directories we're going to install Emacs in. Since
-### we may be creating several layers of directories (for example,
-### /usr/local/lib/emacs/19.0/mips-dec-ultrix4.2), we use install-sh -d
-### instead of mkdir.  Not all systems' mkdir programs have the `-p' flag.
-### We set the umask so that any created directories are world-readable.
-### FIXME it would be good to warn about non-standard permissions of
-### pre-existing directories, but that does not seem easy.
-mkdir: FRC
-       icondirs= ; \
-       for dir in $(iconsrcdir)/*/*/apps $(iconsrcdir)/*/*/mimetypes; do \
-         if [ -d $${dir} ]; then \
-           icondirs="$${icondirs} $${dir}" ; \
-         fi ; \
-       done ; \
-       icondirs=`echo "$${icondirs}" | sed 's,$(srcdir)/etc/images/icons,$(DESTDIR)${icondir},g'` ; \
-       umask 022 ; \
-       $(srcdir)/build-aux/install-sh -d $(DESTDIR)${datadir} ${COPYDESTS} \
-         $(DESTDIR)${infodir} $(DESTDIR)${man1dir} \
-         $(DESTDIR)${bindir} $(DESTDIR)${docdir} $(DESTDIR)${libexecdir} \
-         $(DESTDIR)${datadir}/emacs/site-lisp \
-         $(DESTDIR)${datadir}/emacs/${version}/site-lisp \
-         $(DESTDIR)`echo ${locallisppath} | sed 's,:, $(DESTDIR),g'` \
-         $(DESTDIR)${desktopdir} $${icondirs}
+       $(MAKE) $(MFLAGS) INSTALL_STRIP=-s install
 
 ### Delete all the installed files that the `install' target would
 ### create (but not the noninstalled files such as `make all' would create).
 ###
 ### Don't delete the lisp and etc directories if they're in the source tree.
 uninstall:
-       (cd lib-src;                                    \
+       cd lib-src &&                                   \
         $(MAKE) $(MFLAGS) uninstall                    \
            prefix=${prefix} exec_prefix=${exec_prefix} \
-           bindir=${bindir} libexecdir=${libexecdir} archlibdir=${archlibdir})
+           bindir=${bindir} libexecdir=${libexecdir} archlibdir=${archlibdir}
        -unset CDPATH; \
        for dir in $(DESTDIR)${lispdir} $(DESTDIR)${etcdir} ; do        \
          if [ -d $${dir} ]; then                       \
-           case `(cd $${dir} ; /bin/pwd)` in           \
-             `(cd ${srcdir} ; /bin/pwd)`* ) ;;         \
+           case `cd $${dir} ; /bin/pwd` in             \
+             `cd ${srcdir} ; /bin/pwd`* ) ;;           \
              * ) rm -rf $${dir} ;;                     \
            esac ;                                      \
            case $${dir} in                             \
@@ -731,8 +655,9 @@ uninstall:
        done
        -rm -rf $(DESTDIR)${libexecdir}/emacs/${version}
        thisdir=`/bin/pwd`; \
-       (cd $(DESTDIR)${infodir} && \
-         for elt in $(INFO_FILES); do \
+       (info_misc=`cd doc/misc; ${MAKE} echo-info | sed '/ing directory/d'`; \
+         cd $(DESTDIR)${infodir} && \
+         for elt in ${INFO_NONMISC} $${info_misc}; do \
            (cd $${thisdir}; \
             $(INSTALL_INFO) --remove --info-dir=$(DESTDIR)${infodir} $(DESTDIR)${infodir}/$$elt); \
            if [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ]; then \
@@ -741,8 +666,8 @@ uninstall:
          done;)
        (if [ -n "${GZIP_INFO}" ] && [ -n "${GZIP_PROG}" ]; then \
            ext=.gz; else ext=; fi; \
-        cd $(DESTDIR)${man1dir} && for page in ${MAN_PAGES}; do \
-          rm -f $$page$$ext; done )
+        cd ${mansrcdir} && for page in *.1; do \
+          rm -f $(DESTDIR)${man1dir}/$$page$$ext; done )
        (cd $(DESTDIR)${bindir}  && rm -f $(EMACSFULL) $(EMACS))
        (cd $(DESTDIR)${icondir} && rm -f hicolor/*x*/apps/emacs.png hicolor/*x*/apps/emacs22.png hicolor/scalable/apps/emacs.svg hicolor/scalable/mimetypes/emacs-document.svg )
        -rm -f $(DESTDIR)${desktopdir}/emacs.desktop
@@ -865,7 +790,7 @@ maintainer-clean: bootstrap-clean FRC
 ### the coding standards seem to come from.  It's like distclean, but
 ### it deletes backup and autosave files too.
 extraclean:
-       for i in ${SUBDIR} leim; do (cd $$i; $(MAKE) $(MFLAGS) extraclean); done
+       for i in ${SUBDIR}; do (cd $$i; $(MAKE) $(MFLAGS) extraclean); done
        ${top_maintainer_clean}
        -rm -f config-tmp-*
        -rm -f *~ \#*
@@ -922,6 +847,7 @@ check-info-dir: info
          case $${file} in \
            *-[0-9]*|COPYING|dir) continue ;; \
          esac ; \
+         file=`echo $${file} | sed 's/\.info//'` ; \
          grep -q -F ": ($${file})." dir || missing="$${missing} $${file}" ; \
        done ; \
        if test -n "$${missing}"; then \
diff --git a/README b/README
index 4226721862754a51213b0d9459ce5f8c8a9ceeff..de4ee24fc5eb324178f9bade07c62fb987d06a04 100644 (file)
--- a/README
+++ b/README
@@ -2,7 +2,7 @@ Copyright (C) 2001-2012  Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
-This directory tree holds version 24.1 of GNU Emacs, the extensible,
+This directory tree holds version 24.1.50 of GNU Emacs, the extensible,
 customizable, self-documenting real-time display editor.
 
 The file INSTALL in this directory says how to build and install GNU
@@ -37,12 +37,12 @@ oddities of your processor and operating system.  It creates the file
 process of building and installing Emacs.  See INSTALL for more
 detailed information.
 
-The file `configure.in' is the input used by the autoconf program to
+The file `configure.ac' is the input used by the autoconf program to
 construct the `configure' script.  Since Emacs has some configuration
 requirements that autoconf can't meet directly, and for historical
-reasons, `configure.in' uses an unholy marriage of custom-baked
+reasons, `configure.ac' uses an unholy marriage of custom-baked
 configuration code and autoconf macros.  If you want to rebuild
-`configure' from `configure.in', you will need to install a recent
+`configure' from `configure.ac', you will need to install a recent
 version of autoconf and GNU m4.
 
 The file `Makefile.in' is a template used by `configure' to create
index c084a94188de5282f1957b20ff972b2cb10a58cc..9fc7ce3e33d06cb5504e635754a73b8b1730f22f 100644 (file)
@@ -46,7 +46,7 @@ HAVE_PROCFS     The /proc filesystem is supported.
 REL_ALLOC      Compile in the relocatable memory allocator ralloc.c.
 SYSTEM_MALLOC  Use the system library's malloc.
 subprocesses    System can use subprocesses (for M-x shell for example).  Defined by default, only MSDOS undefines it.
-USE_LISP_UNION_TYPE Define it in lisp.h to make Lisp_Object be a union type instead of the default int.
+DEBUG_LISP_OBJECT_TYPE Define it in lisp.h enable compile time checks on Lisp_Object use.
 
 ** System specific macros, described in detail in src/s/template.h
 CLASH_DETECTION
@@ -63,16 +63,11 @@ USER_FULL_NAME   If defined, overrides the default pw->pw_gecos for getting at t
 
 ** Replace, the definition is trivial: SWITCH_ENUM_CAST
 
-** Defines from src/m/*.h and src/s/*.h.  Some of these might not be used in the code anymore, so they can be removed.  The HAVE_* definitions are probably handled by autoconf, so it might be possible to just remove them from src/[sm]/*.h.
+** Defines from src/s/*.h.  Some of these might not be used in the code anymore, so they can be removed.  The HAVE_* definitions are probably handled by autoconf, so it might be possible to just remove them from src/s/*.h.
 
 
 AIX
 AMPERSAND_FULL_NAME
-BITS_PER_EMACS_INT
-BITS_PER_LONG
-BITS_PER_CHAR
-BITS_PER_SHORT
-BITS_PER_INT
 BROKEN_DATAGRAM_SOCKETS
 BROKEN_FIONREAD
 BROKEN_GET_CURRENT_DIR_NAME
@@ -84,7 +79,6 @@ BROKEN_SIGIO
 BROKEN_SIGPOLL
 BROKEN_SIGPTY
 BSD4_2
-BSD4_3
 BSD_SYSTEM
 CLASH_DETECTION
 DATA_SEG_BITS
@@ -119,9 +113,7 @@ HAVE_FMOD
 HAVE_FPATHCONF
 HAVE_FREXP
 HAVE_FSYNC
-HAVE_FTIME
 HAVE_GETCWD
-HAVE_GETDOMAINNAME
 HAVE_GETHOSTNAME
 HAVE_GETLOADAVG
 HAVE_GETPAGESIZE
@@ -138,17 +130,13 @@ HAVE_LOGB
 HAVE_LONG_FILE_NAMES
 HAVE_LRAND48
 HAVE_MENUS
-HAVE_MKDIR
 HAVE_MKTIME
 HAVE_MOUSE
-HAVE_PERROR
 HAVE_PSTAT_GETDYNAMIC
 HAVE_PWD_H
 HAVE_RANDOM
-HAVE_RENAME
 HAVE_RES_INIT
 HAVE_RINT
-HAVE_RMDIR
 HAVE_SELECT
 HAVE_SETLOCALE
 HAVE_SETPGID
@@ -158,22 +146,17 @@ HAVE_SHUTDOWN
 HAVE_SOCKETS
 HAVE_SOUND
 HAVE_STDLIB_H
-HAVE_STRERROR
 HAVE_STRFTIME
 HAVE_STRING_H
 HAVE_STRUCT_UTIMBUF
-HAVE_SYSINFO
-HAVE_SYSV_SIGPAUSE
 HAVE_SYS_SELECT_H
 HAVE_SYS_SYSTEMINFO_H
 HAVE_SYS_TIMEB_H
 HAVE_SYS_TIME_H
 HAVE_TCATTR
-HAVE_TIMEVAL
 HAVE_TM_ZONE
 HAVE_TZSET
 HAVE_UNISTD_H
-HAVE_UTIMES
 HAVE_UTIME_H
 HAVE_WINDOW_SYSTEM
 HAVE_WORKING_VFORK
@@ -184,7 +167,6 @@ IS_ANY_SEP
 IS_DIRECTORY_SEP
 LINKER
 LINUX_VERSION_CODE
-LISP_FLOAT_TYPE
 LNOFLSH
 LOCALTIME_CACHE
 MAIL_USE_FLOCK
@@ -202,7 +184,6 @@ NO_MATHERR
 NO_TERMIO
 NSIG
 NSIG_MINIMUM
-NULL
 NULL_DEVICE
 ORDINARY_LINK
 O_APPEND
@@ -210,7 +191,6 @@ O_RDONLY
 O_RDWR
 PAGESIZE
 PENDING_OUTPUT_COUNT
-POSIX
 PREFER_VSUSP
 PTY_ITERATION
 PTY_NAME_SPRINTF
@@ -247,7 +227,6 @@ USE_CRT_DLL
 USE_TOOLKIT_SCROLL_BARS
 USG
 USG5
-USG5_4
 USG_SUBTTY_WORKS
 VALBITS
 WRETCODE
@@ -273,7 +252,6 @@ chdir
 chmod
 chown
 close
-const
 creat
 ctime
 dup
@@ -326,7 +304,6 @@ sleep
 spawnve
 srandom
 strdup
-strerror
 stricmp
 strnicmp
 strupr
index 75079a335c91ad4e922b3534e196e05aeb509a68..0d059714788a24732c6ea8381392ac1d7e22af25 100644 (file)
-2012-07-14  Eli Zaretskii  <eliz@gnu.org>
+2012-07-17  Eli Zaretskii  <eliz@gnu.org>
 
        * CPP-DEFINES: Remove FILE_SYSTEM_CASE.
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-17  Chong Yidong  <cyd@gnu.org>
 
        * Version 24.1 released.
+2012-07-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Assume mkdir, perror, rename, rmdir, strerror.
+       * CPP-DEFINES (HAVE_MKDIR, HAVE_PERROR, HAVE_RENAME, HAVE_RMDIR)
+       (HAVE_STRERROR, strerror):
+       Remove.
+
+2012-07-10  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * coccinelle/list_loop.cocci: Semantic patch to convert from Fcdr
+       to XCDR and consistently use CONSP in the list iteration loops.
+       * coccinelle/vector_contents.cocci: Fix indentation.
+
+2012-07-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * bzrmerge.el: Use cl-lib.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Rename configure.in to configure.ac (Bug#11603).
+       * admin.el (set-version):
+       * quick-install-emacs (VERSION):
+       Get version number from configure.ac, not configure.in.
+
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786).
+       * merge-gnulib (GNULIB_MODULES): Add c-strcase.
+
+2012-07-05  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * coccinelle/xzalloc.cocci: Semantic patch to convert
+       calls to xmalloc with following memset to xzalloc.
+
+2012-07-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * CPP-DEFINES (LISP_FLOAT_TYPE): Remove, obsolete.
+
+2012-06-26  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * coccinelle/build_string.cocci: Semantic patch
+       to convert from make_string to build_string.
+
+2012-06-24  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       First Coccinelle semantic patch.
+       * coccinelle: New subdirectory
+       * coccinelle/README: Documentation stub.
+       * coccinelle/vector_contents.cocci: Semantic patch to replace direct
+       access to `contents' member of Lisp_Vector objects with AREF and ASET
+       where appropriate.
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Support higher-resolution time stamps (Bug#9000).
+       * merge-gnulib (GNULIB_MODULES): Add dtotimespec, gettime,
+       gettimeofday, pselect, stat-time, sys_time, time, timespec-add,
+       timespec-sub, utimens.
+       (GNULIB_TOOL_FLAGS): Add --avoid=select --avoid=sigprocmask.
+       This trims down the gnulib import, from the very latest gnulib.
+       Emacs does its own implementation of 'select' and 'sigprocmask'
+       on Windows, and it assumes 'select' and 'sigprocmask' on non-Windows
+       hosts, so it doesn't need these modules.
+       Similarly, avoid errno, fcntl, fcntl-h, fstat, and sys_types, as
+       these gnulib modules are only for Windows porting and Emacs ports
+       to Windows in a different way.
+
+2012-06-13  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * make-emacs: Rename --union-type to --check-lisp-type.
+       Define CHECK_LISP_OBJECT_TYPE insted of USE_LISP_UNION_TYPE.
+       * CPP-DEFINES (DEBUG_LISP_OBJECT_TYPE): Rename from
+       USE_LISP_UNION_TYPE.
+
+2012-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * quick-install-emacs (PUBLIC_LIBSRC_SCRIPTS): Remove rcs-checkin.
+
+2012-06-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove --disable-maintainer-mode option from 'configure'.  (Bug#11555)
+       * make-tarball.txt: Don't worry about maintainer mode.
+
+2012-05-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * CPP-DEFINES: Remove HAVE_SYSINFO.
+
+2012-05-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Assume gnulib does largefile.
+       * merge-gnulib (GNULIB_MODULES): Add largefile.
+
+2012-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove src/m/*.
+       * CPP-DEFINES: Do not mention src/m/*.h.
+       (BITS_PER_EMACS_INT, BITS_PER_LONG, BITS_PER_CHAR)
+       (BITS_PER_SHORT, BITS_PER_INT): Remove.
+       * MAINTAINERS: Remove src/m/.
+
+2012-05-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use full name for m4/gnulib-comp.m4.  (Bug#11529)
+       * merge-gnulib: Leave m4/gnulib-comp.m4's name alone.
+
+       Assume C89 or later.
+       * CPP-DEFINES: Remove NULL, const.
+
+       Make merging from gnulib a script, not a makefile action.
+       * merge-gnulib: New script, with actions moved here from
+       ../Makefile.in.
+
+2012-05-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * CPP-DEFINES (HAVE_GETDOMAINNAME): Remove.
+
+       * CPP-DEFINES (HAVE_FTIME): Remove.
+
+2012-05-02  Glenn Morris  <rgm@gnu.org>
+
+       * bzrmerge.el (bzrmerge-skip-regexp): Add "Auto-commit".
+
+2012-04-10  Glenn Morris  <rgm@gnu.org>
+
+       * bzrmerge.el (bzrmerge-skip-regexp): Add "from trunk".
+
+       * unidata/Makefile.in: Add FSF copyright.
+       Make it use autoconf features, and work for out-of-tree builds.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * unidata/README:
+       * unidata/copyright.html:
+       * unidata/BidiMirroring.txt:
+       * unidata/UnicodeData.txt: Update for the latest version 6.1 of
+       the Unicode Standard.
 
 2012-02-16  Kenichi Handa  <handa@m17n.org>
 
 
        * unidata/makefile.w32-in (all): Remove src/biditype.h and
        src/bidimirror.h.
-       (../../src/biditype.h, ../../src/bidimirror.h): Deleted.
+       (../../src/biditype.h, ../../src/bidimirror.h): Delete.
 
        * unidata/Makefile.in (all): Remove src/biditype.h and
        src/bidimirror.h.
-       (../../src/biditype.h, ../../src/bidimirror.h): Deleted.
+       (../../src/biditype.h, ../../src/bidimirror.h): Delete.
 
 2011-07-07  Juanma Barranquero  <lekktu@gmail.com>
 
 
        * unidata/unidata-gen.el (unidata-dir): New variable.
        (unidata-setup-list): Expand unidata-text-file in unidata-dir.
-       (unidata-prop-alist): INDEX element may be a function.  New
-       optional element VAL-LIST (for general-category and bidi-class).
+       (unidata-prop-alist): INDEX element may be a function.
+       New optional element VAL-LIST (for general-category and bidi-class).
        New entry `mirroring'.
        (unidata-prop-default, unidata-prop-val-list): New subst.
        (unidata-get-character, unidata-put-character): Delete them.
 
 2009-04-17  Kenichi Handa  <handa@m17n.org>
 
-       * unidata/unidata-gen.el (unidata-get-decomposition): Adjust
-       Hangle decomposition rule to Unicode.
+       * unidata/unidata-gen.el (unidata-get-decomposition):
+       Adjust Hangle decomposition rule to Unicode.
 
 2009-04-09  Kenichi Handa  <handa@m17n.org>
 
-       * unidata/unidata-gen.el (unidata-describe-decomposition): Return
-       a string with a composition property to disable combining
+       * unidata/unidata-gen.el (unidata-describe-decomposition):
+       Return a string with a composition property to disable combining
        characters being composed.
 
 2009-03-11  Miles Bader  <miles@gnu.org>
 
 2009-02-23  Jason Rumney  <jasonr@gnu.org>
 
-       * nt/README-ftp-server: Update for 23.0.91
+       * nt/README-ftp-server: Update for 23.0.91.
 
        * nt/README.W32: Remove ever expanding versions of Windows.
        Shorten FAQ URL.  Remove mention of obsolete lock directory.
 
 2005-10-17  Bill Wohler  <wohler@newt.com>
 
-       * FOR-RELEASE (DOCUMENTATION): Removed lisp/toolbar from list
+       * FOR-RELEASE (DOCUMENTATION): Remove lisp/toolbar from list
        since it's gone.  Also marked mh-e as done.
 
 2005-10-11  Juanma Barranquero  <lekktu@gmail.com>
 
 2005-03-30  Marcelo Toledo  <marcelo@marcelotoledo.org>
 
-       * FOR-RELEASE (Documentation): Added check the Emacs Tutorial.
+       * FOR-RELEASE (Documentation): Add check the Emacs Tutorial.
        The first line of every tutorial must begin with a sentence saying
        "Emacs Tutorial" in the respective language.  This should be
        followed by "See end for copying conditions", likewise in the
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2001-2012  Free Software Foundation, Inc.
+  Copyright (C) 2001-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index bfac347eb151c77b20c4ffbc8482160717bc0f61..86d319d65d5251f55154ab30ff6105bfc51d56fe 100644 (file)
@@ -171,7 +171,6 @@ src/insdel.c
 src/image.c
 src/lastfile.c
 src/lread.c
-src/m/
 src/macros.c
 src/makefile.w32-in
 src/marker.c
@@ -220,4 +219,3 @@ src/xmenu.c
 src/xrdb.c
 src/xselect.c
 src/xterm.c
-
index 27b2b3ab64860af7e34978ddde967ad9c80ab8f8..6d729214bd014c7b0735928ea57acea7a64b58ee 100644 (file)
@@ -62,7 +62,7 @@ Root must be the root of an Emacs source tree."
   (set-version-in-file root "README" version
                       (rx (and "version" (1+ space)
                                (submatch (1+ (in "0-9."))))))
-  (set-version-in-file root "configure.in" version
+  (set-version-in-file root "configure.ac" version
                       (rx (and "AC_INIT" (1+ (not (in ?,)))
                                 ?, (0+ space)
                                 (submatch (1+ (in "0-9."))))))
@@ -240,7 +240,7 @@ Root must be the root of an Emacs source tree."
       (manual-txt texi (expand-file-name "emacs.txt" txt-dir))
       (manual-pdf texi (expand-file-name "emacs.pdf" dest))
       (manual-dvi texi (expand-file-name "emacs.dvi" dvi-dir)
-                 (expand-file-name "emacs.ps" ps-dir)))
+                 (expand-file-name "emacs.ps" ps-dir)))
     ;; Lisp manual
     (let ((texi (expand-file-name "doc/lispref/elisp.texi" root)))
       (manual-html-node texi (expand-file-name "elisp" html-node-dir))
@@ -248,7 +248,20 @@ Root must be the root of an Emacs source tree."
       (manual-txt texi (expand-file-name "elisp.txt" txt-dir))
       (manual-pdf texi (expand-file-name "elisp.pdf" dest))
       (manual-dvi texi (expand-file-name "elisp.dvi" dvi-dir)
-                 (expand-file-name "elisp.ps" ps-dir)))
+                 (expand-file-name "elisp.ps" ps-dir)))
+    ;; Misc manuals
+    (let ((manuals '("ada-mode" "auth" "autotype" "calc" "cc-mode"
+                    "cl" "dbus" "dired-x" "ebrowse" "ede" "ediff"
+                    "edt" "eieio" "emacs-mime" "epa" "erc" "ert"
+                    "eshell" "eudc" "faq" "flymake" "forms"
+                    "gnus" "emacs-gnutls" "idlwave" "info"
+                    "mairix-el" "message" "mh-e" "newsticker"
+                    "nxml-mode" "org" "pcl-cvs" "pgg" "rcirc"
+                    "remember" "reftex" "sasl" "sc" "semantic"
+                    "ses" "sieve" "smtpmail" "speedbar" "tramp"
+                    "url" "vip" "viper" "widget" "woman")))
+      (dolist (manual manuals)
+       (manual-misc-html manual root html-node-dir html-mono-dir)))
     (message "Manuals created in %s" dest)))
 
 (defconst manual-doctype-string
@@ -265,6 +278,12 @@ Root must be the root of an Emacs source tree."
 (defconst manual-style-string "<style type=\"text/css\">
 @import url('/style.css');\n</style>\n")
 
+(defun manual-misc-html (name root html-node-dir html-mono-dir)
+  (let ((texi (expand-file-name (format "doc/misc/%s.texi" name) root)))
+    (manual-html-node texi (expand-file-name name html-node-dir))
+    (manual-html-mono texi (expand-file-name (concat name ".html")
+                                            html-mono-dir))))
+
 (defun manual-html-mono (texi-file dest)
   "Run Makeinfo on TEXI-FILE, emitting mono HTML output to DEST.
 This function also edits the HTML files so that they validate as
@@ -307,13 +326,15 @@ the @import directive."
              (let (copyright-text)
                (manual-html-fix-index-1)
                ;; Move copyright notice to the end.
-               (re-search-forward "[ \t]*<p>Copyright &copy;")
-               (setq opoint (match-beginning 0))
-               (re-search-forward "</blockquote>")
-               (setq copyright-text (buffer-substring opoint (point)))
-               (delete-region opoint (point))
+               (when (re-search-forward "[ \t]*<p>Copyright &copy;" nil t)
+                 (setq opoint (match-beginning 0))
+                 (re-search-forward "</blockquote>")
+                 (setq copyright-text (buffer-substring opoint (point)))
+                 (delete-region opoint (point)))
                (manual-html-fix-index-2)
-               (insert copyright-text "\n</div>\n"))
+               (if copyright-text
+                   (insert copyright-text))
+               (insert "\n</div>\n"))
            ;; For normal nodes, give the header div a blue bg.
            (manual-html-fix-node-div))
          (save-buffer))))))
@@ -369,9 +390,9 @@ Also generate PostScript output in PS-DEST."
 
 (defun manual-html-fix-index-1 ()
   (let (opoint)
-    (re-search-forward "<body>\n\\(<h1 class=\"settitle\\)")
-    (setq opoint (match-beginning 1))
-    (search-forward "<h2 class=\"unnumbered")
+    (re-search-forward "<body>\n")
+    (setq opoint (match-end 0))
+    (search-forward "<h2 class=\"")
     (goto-char (match-beginning 0))
     (delete-region opoint (point))
     (insert "<div id=\"content\" class=\"inner\">\n\n")))
@@ -380,7 +401,8 @@ Also generate PostScript output in PS-DEST."
   "Replace the index list in the current buffer with a HTML table."
   (let (done open-td tag desc)
     ;; Convert the list that Makeinfo made into a table.
-    (search-forward "<ul class=\"menu\">")
+    (or (search-forward "<ul class=\"menu\">" nil t)
+       (search-forward "<ul>"))
     (replace-match "<table style=\"float:left\" width=\"100%\">")
     (forward-line 1)
     (while (not done)
@@ -413,7 +435,7 @@ Also generate PostScript output in PS-DEST."
        (replace-match "  </td></tr></table>\n
 <h3>Detailed Node Listing</h3>\n\n" t t)
        (search-forward "<p>")
-       (search-forward "<p>")
+       (search-forward "<p>" nil t)
        (goto-char (match-beginning 0))
        (skip-chars-backward "\n ")
        (setq open-td nil)
@@ -427,8 +449,8 @@ Also generate PostScript output in PS-DEST."
          (setq open-td nil))
        (insert "  <tr>
     <th colspan=\"2\" align=\"left\" style=\"text-align:left\">")
-       (re-search-forward "</p>[ \t\n]*<ul class=\"menu\">")
-       (replace-match "  </th></tr>"))
+       (if (re-search-forward "</p>[ \t\n]*<ul class=\"menu\">" nil t)
+           (replace-match "  </th></tr>")))
        ((looking-at "[ \t]*</ul>[ \t]*$")
        (replace-match
         (if open-td
index cb63d5b16baa3f0bd598948298d1ed284686246a..977e95860e21cc82ee489f699df3042872921b0a 100644 (file)
@@ -1,9 +1,9 @@
 ;;; bzrmerge.el --- help merge one Emacs bzr branch to another
 
-;; Copyright (C) 2010-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
-;; Keywords: 
+;; Keywords: maint
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))                        ; assert
+(eval-when-compile (require 'cl-lib))
 
 (defvar bzrmerge-skip-regexp
-  "back[- ]?port\\|merge\\|sync\\|re-?generate\\|bump version"
+  "back[- ]?port\\|merge\\|sync\\|re-?generate\\|bump version\\|from trunk\\|\
+Auto-commit"
   "Regexp matching logs of revisions that might be skipped.
 `bzrmerge-missing' will ask you if it should skip any matches.")
 
@@ -138,17 +138,17 @@ Type `y' to skip this revision,
 `N' to include it and go on to the next revision,
 `n' to not skip, but continue to search this log entry for skip regexps,
 `q' to quit merging."))
-                    (case (save-excursion
+                    (pcase (save-excursion
                             (read-char-choice
                              (format "%s: Skip (y/n/N/q/%s)? " str
                                      (key-description (vector help-char)))
                              '(?y ?n ?N ?q)))
-                      (?y (setq skip t))
-                      (?q (keyboard-quit))
+                      (`?y (setq skip t))
+                      (`?q (keyboard-quit))
                       ;; A single log entry can match skip-regexp multiple
                       ;; times.  If you are sure you don't want to skip it,
                       ;; you don't want to be asked multiple times.
-                      (?N (setq skip 'no))))))
+                      (`?N (setq skip 'no))))))
               (if (eq skip t)
                   (push revno skipped)
                 (push revno revnos)))))
@@ -255,17 +255,17 @@ Does not make other difference."
           ;; Do a "skip" (i.e. merge the meta-data only).
           (setq beg (1- (car skip)))
           (while (and skip (or (null merge) (< (car skip) (car merge))))
-            (assert (> (car skip) (or end beg)))
+            (cl-assert (> (car skip) (or end beg)))
             (setq end (pop skip)))
           (message "Skipping %s..%s" beg end)
           (bzrmerge-add-metadata from end))
 
          (t
           ;; Do a "normal" merge.
-          (assert (or (null skip) (< (car merge) (car skip))))
+          (cl-assert (or (null skip) (< (car merge) (car skip))))
           (setq beg (1- (car merge)))
           (while (and merge (or (null skip) (< (car merge) (car skip))))
-            (assert (> (car merge) (or end beg)))
+            (cl-assert (> (car merge) (or end beg)))
             (setq end (pop merge)))
           (message "Merging %s..%s" beg end)
           (if (with-temp-buffer
diff --git a/admin/coccinelle/README b/admin/coccinelle/README
new file mode 100644 (file)
index 0000000..48a88db
--- /dev/null
@@ -0,0 +1,3 @@
+This directory contains semantic patches for Coccinelle, a program matching
+and transformation tool for programs written in C.  For more details, see
+http://coccinelle.lip6.fr.
diff --git a/admin/coccinelle/build_string.cocci b/admin/coccinelle/build_string.cocci
new file mode 100644 (file)
index 0000000..d477270
--- /dev/null
@@ -0,0 +1,6 @@
+// Convert simple cases to build_string.
+@@
+identifier I;
+@@
+- make_string (I, strlen (I))
++ build_string (I)
diff --git a/admin/coccinelle/list_loop.cocci b/admin/coccinelle/list_loop.cocci
new file mode 100644 (file)
index 0000000..89f0bff
--- /dev/null
@@ -0,0 +1,19 @@
+// Omit redundant type check, consistently use CONSP.
+@@
+identifier A;
+expression X;
+statement S;
+@@
+(
+for (A = X; 
+- !NILP (A); 
++ CONSP (A);
+- A = Fcdr (A))
++ A = XCDR (A))
+S
+|
+for (A = X; CONSP (A);
+- A = Fcdr (A))
++ A = XCDR (A))
+S
+)
diff --git a/admin/coccinelle/vector_contents.cocci b/admin/coccinelle/vector_contents.cocci
new file mode 100644 (file)
index 0000000..3c696ff
--- /dev/null
@@ -0,0 +1,16 @@
+// Avoid direct access to `contents' member of
+// Lisp_Vector, use AREF and ASET where possible.
+@expression@
+identifier I1, I2;
+expression E1, E2;
+@@
+(
+- XVECTOR (I1)->contents[I2++] = E1
++ ASET (I1, I2, E1), I2++
+|
+- XVECTOR (I1)->contents[E1] = E2
++ ASET (I1, E1, E2)
+|
+- XVECTOR (I1)->contents[E1]
++ AREF (I1, E1)
+)
diff --git a/admin/coccinelle/xzalloc.cocci b/admin/coccinelle/xzalloc.cocci
new file mode 100644 (file)
index 0000000..5d3ba99
--- /dev/null
@@ -0,0 +1,10 @@
+@@
+expression x;
+expression E;
+@@
+ x = 
+- xmalloc 
++ xzalloc
+  (E)
+  ... 
+- memset (x, 0, E);
index f64d51b0c418c61e3f4cbe5543f9d2b7209d7287..688f5c196bffb7e6ad95a887f6a76cb299e98c3f 100755 (executable)
@@ -42,7 +42,7 @@ $rc = GetOptions ("help" => \$help,
                  "check-marked" => \$check_marked,
                  "all" => \$all,
                  "no-optim" => \$no_optim,
-                 "union-type" => \$union_type,
+                 "check-lisp-type" => \$check_lisp_type,
                  "gprof" => \$profile,
                  "malloc-check" => \$malloc_check,
                  "no-mcheck" => \$no_mcheck,
@@ -70,7 +70,7 @@ Build Emacs.
  --check-marked                GC_CHECK_MARKED_OBJECTS=1
  --optim               no debug defines
  --gprof               make Emacs for profiling
- --union-type          define USE_LISP_UNION_TYPE (bad for GDB)
+ --check-lisp-type     define CHECK_LISP_OBJECT_TYPE
  --malloc-check                define GC_MALLOC_CHECK
  --no-mcheck           don't define GC_MCHECK
  --wall                        compile with -Wall
@@ -140,7 +140,7 @@ else
       }
   }
 
-$defs = "$defs -DUSE_LISP_UNION_TYPE" if $union_type;
+$defs = "$defs -DCHECK_LISP_OBJECT_TYPE" if $check_lisp_type;
 $defs = "$defs -DGC_MALLOC_CHECK=1 -DGC_PROTECT_MALLOC_STATE=1" if $malloc_check;
 $defs = "$defs -DGC_MCHECK=1" unless $no_mcheck;
 
index 0acd29bbc1363791832b4596cd9e5f43650d1104..ea9c4a3c2d17312b5887fa77cc57f89c0d6a1515 100644 (file)
@@ -28,13 +28,7 @@ For each step, check for possible errors.
     refer to a newer release of Emacs.  (This is probably needed only
     when preparing a major Emacs release, or branching for it.)
 
-5.  Edit configure.in so that maintainer-mode is off by default.
-    (FIXME - need to find a better way of dealing with this.
-     Or maybe it's fine and indeed correct to leave it on?
-     See http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00859.html
-     and subsequent.)
-
-     autoreconf -i -I m4 --force
+5.   autoreconf -i -I m4 --force
      make bootstrap
 
 6.  Commit etc/AUTHORS, all the files changed by M-x set-version, and
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
new file mode 100755 (executable)
index 0000000..727b701
--- /dev/null
@@ -0,0 +1,90 @@
+#! /bin/sh
+# Merge gnulib sources into Emacs sources.
+# Typical usage:
+#
+#      admin/merge-gnulib
+
+# Copyright 2012 Free Software Foundation, Inc.
+
+# This file is part of GNU Emacs.
+
+# GNU Emacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+# written by Paul Eggert
+
+GNULIB_URL=git://git.savannah.gnu.org/gnulib.git
+
+GNULIB_MODULES='
+  alloca-opt c-strcase
+  careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
+  dtoastr dtotimespec dup2
+  filemode getloadavg getopt-gnu gettime gettimeofday
+  ignore-value intprops largefile lstat
+  manywarnings mktime pselect pthread_sigmask readlink
+  socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat
+  sys_time time timespec-add timespec-sub utimens
+  warnings
+'
+
+GNULIB_TOOL_FLAGS='
+  --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
+  --conditional-dependencies --import --no-changelog --no-vc-files
+  --makefile-name=gnulib.mk
+'
+
+# The source directory, with a trailing '/'.
+# If empty, the source directory is the working directory.
+src=$2
+case $src in
+  */ | '') ;;
+  *) src=$src/ ;;
+esac
+
+# Gnulib's source directory.
+gnulib_srcdir=${1-$src../gnulib}
+
+case $gnulib_srcdir in
+  -*) src=- ;;
+esac
+case $src in
+  -*)
+    echo >&2 "$0: usage: $0 [GNULIB_SRCDIR [SRCDIR]]
+
+    SRCDIR is the Emacs source directory (default: working directory).
+    GNULIB_SRCDIR is the Gnulib source directory (default: SRCDIR/../gnulib)."
+    exit 1 ;;
+esac
+
+test -x "$src"autogen.sh || {
+  echo >&2 "$0: '${src:-.}' is not an Emacs source directory."
+  exit 1
+}
+
+test -d "$gnulib_srcdir" ||
+git clone -- "$GNULIB_URL" "$gnulib_srcdir" ||
+exit
+
+test -x "$gnulib_srcdir"/gnulib-tool || {
+  echo >&2 "$0: '$gnulib_srcdir' is not a Gnulib source directory."
+  exit 1
+}
+
+"$gnulib_srcdir"/gnulib-tool --dir="$src" $GNULIB_TOOL_FLAGS $GNULIB_MODULES &&
+rm -- "$src"m4/gnulib-cache.m4 "$src"m4/warn-on-use.m4 &&
+cp -- "$gnulib_srcdir"/build-aux/texinfo.tex "$src"doc/misc &&
+cp -- "$gnulib_srcdir"/build-aux/move-if-change "$src"build-aux &&
+autoreconf -i -I m4 -- ${src:+"$src"}
index 4146c8ffa580812df9a80578991e621878ff8486..5408b9a3d0063fb4af915d3f6745a44af9a6ecaf 100644 (file)
@@ -906,7 +906,7 @@ DIARY OF CHANGES
    read_avail_input.
 
    (Fixed.  This was caused by unconditionally including stdin in
-   input_wait_mask in init_process.  The select call in
+   input_wait_mask in init_process_emacs.  The select call in
    wait_reading_process_input always returned immediately, indicating
    that there is pending input from stdin, which nobody read.
 
index 06cd2d409013babe78b3c1a0ac4834bbc28240c6..4abef102dc48bc6ffd09ad4f07a8636ca867ddfa 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### quick-install-emacs --- do a halfway-decent job of installing emacs quickly
 
-## Copyright (C) 2001-2012  Free Software Foundation, Inc.
+## Copyright (C) 2001-2012 Free Software Foundation, Inc.
 
 ## Author: Miles Bader <miles@gnu.org>
 
@@ -28,7 +28,7 @@
 
 
 PUBLIC_LIBSRC_BINARIES='emacsclient etags ctags ebrowse'
-PUBLIC_LIBSRC_SCRIPTS='grep-changelog rcs-checkin'
+PUBLIC_LIBSRC_SCRIPTS='grep-changelog'
 
 AVOID="CVS -DIC README COPYING ChangeLog ~ [.]orig$ [.]rej$ Makefile$ Makefile.in$ makefile$ makefile.w32-in$ stamp-subdir [.]cvsignore [.]arch-ids [{]arch[}] [.][cho]$ make-docfile testfile test-distrib"
 
@@ -171,9 +171,9 @@ test x"$prefix" = x && { prefix="`get_config_var prefix`" || exit 4 ; }
 test x"$ARCH" = x && { ARCH="`get_config_var host`" || exit 4 ; }
 
 VERSION=`
-  sed -n 's/^AC_INIT(emacs,[    ]*\([^  )]*\).*/\1/p' <$SRC/configure.in
+  sed -n 's/^AC_INIT(emacs,[    ]*\([^  )]*\).*/\1/p' <$SRC/configure.ac
 ` || exit 4
-test -n "$VERSION" || { echo >&2 "$me: no version in configure.in"; exit 4; }
+test -n "$VERSION" || { echo >&2 "$me: no version in configure.ac"; exit 4; }
 
 DST_SHARE="$prefix/share/emacs/$VERSION"
 DST_BIN="$prefix/bin"
index 902f9a6b8869ae29ddbb76d9b5052567d30f8be7..2e719bc1e0551794318854b399cea1394f5987a1 100644 (file)
@@ -1,19 +1,19 @@
-# BidiMirroring-6.0.0.txt
-# Date: 2010-06-21, 12:09:00 PDT [KW]
+# BidiMirroring-6.1.0.txt
+# Date: 2011-12-20, 19:31:00 GMT [KW, LI]
 #
 # Bidi_Mirroring_Glyph Property
 # 
 # This file is an informative contributory data file in the
 # Unicode Character Database.
 #
-# Copyright (c) 1991-2010 Unicode, Inc.
+# Copyright (c) 1991-2011 Unicode, Inc.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
-# This data file lists characters that have the Bidi_Mirrored=True property
+# This data file lists characters that have the Bidi_Mirrored=Yes property
 # value, for which there is another Unicode character that typically has a glyph
 # that is the mirror image of the original character's glyph.
 #
-# The repertoire covered by the file is Unicode 6.0.0.
+# The repertoire covered by the file is Unicode 6.1.0.
 # 
 # The file contains a list of lines with mappings from one code point
 # to another one for character-based mirroring.
 # variable-length hexadecimal value with 4 to 6 digits.
 # A comment indicates where the characters are "BEST FIT" mirroring.
 # 
-# Code points for which Bidi_Mirrored=True, but for which no appropriate 
+# Code points for which Bidi_Mirrored=Yes, but for which no appropriate 
 # characters exist with mirrored glyphs, are
 # listed as comments at the end of the file.
 #
+#   Note: (2011-12-19) There is an inconsistency between the 
+#   following statement about the default value
+#   of the Bidi_Mirroring_Glyph property and the
+#   value of the @missing line for Bidi_Mirroring_Glyph in
+#   PropertyValueAliases.txt. This inconsistency was discovered too
+#   late in the release process to be resolved by
+#   the UTC. The inconsistency will be resolved in a future revision.
+#
 # Formally, the default value of the Bidi_Mirroring_Glyph property
 # for each code point is the code point itself, unless a mapping to
 # some other character is specified in this data file. When a code
 # at http://www.unicode.org/unicode/reports/tr9/
 # 
 # This file was originally created by Markus Scherer.
-# Extended for Unicode 3.2, 4.0, 4.1, 5.0, 5.1, 5.2, and 6.0 by Ken Whistler.
+# Extended for Unicode 3.2, 4.0, 4.1, 5.0, 5.1, 5.2, and 6.0 by Ken Whistler,
+# and for Unicode 6.1 by Ken Whistler and Laurentiu Iancu.
 # 
 # ############################################################
+#
+# Property:    Bidi_Mirroring_Glyph
+#
 
 0028; 0029 # LEFT PARENTHESIS
 0029; 0028 # RIGHT PARENTHESIS
 27C6; 27C5 # RIGHT S-SHAPED BAG DELIMITER
 27C8; 27C9 # REVERSE SOLIDUS PRECEDING SUBSET
 27C9; 27C8 # SUPERSET PRECEDING SOLIDUS
+27CB; 27CD # MATHEMATICAL RISING DIAGONAL
+27CD; 27CB # MATHEMATICAL FALLING DIAGONAL
 27D5; 27D6 # LEFT OUTER JOIN
 27D6; 27D5 # RIGHT OUTER JOIN
 27DD; 27DE # LONG RIGHT TACK
index c890dad890336e2f33de4c49b423a5a8823cda87..ecbd04902467bf8c46926d9ce7a5435b5a1f63eb 100644 (file)
@@ -1,4 +1,7 @@
 # Makefile -- Makefile to generate character property tables.
+
+# Copyright (C) 2012 Free Software Foundation, Inc.
+
 # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
 #   Registration Number H13PRO009
 # You should have received a copy of the GNU General Public License
 # along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+abs_builddir = @abs_builddir@
+top_srcdir = @top_srcdir@
+abs_top_builddir = @abs_top_builddir@
 
-EMACS = ../../src/emacs
-DSTDIR = ../../lisp/international
-RUNEMACS = ${EMACS} -Q -batch
+EMACS = ${abs_top_builddir}/src/emacs
+DSTDIR = ${top_srcdir}/lisp/international
+emacs = ${EMACS} -batch --no-site-file --no-site-lisp
 
 all: ${DSTDIR}/charprop.el
 
 .el.elc:
-       ${RUNEMACS} -batch -f batch-byte-compile $<
+       ${emacs} -f batch-byte-compile $<
 
-unidata.txt: UnicodeData.txt
-       sed -e 's/\([^;]*\);\(.*\)/(#x\1 "\2")/' -e 's/;/" "/g' < UnicodeData.txt > $@
+unidata.txt: ${srcdir}/UnicodeData.txt
+       sed -e 's/\([^;]*\);\(.*\)/(#x\1 "\2")/' -e 's/;/" "/g' < ${srcdir}/UnicodeData.txt > $@
 
-${DSTDIR}/charprop.el: unidata-gen.elc unidata.txt
-       ELC=`/bin/pwd`/unidata-gen.elc; \
-       DATADIR=`/bin/pwd`; \
-       DATA=unidata.txt; \
-       cd ${DSTDIR}; \
-       ${RUNEMACS} -batch --load $${ELC} -f unidata-gen-files $${DATADIR} $${DATA}
+${DSTDIR}/charprop.el: ${srcdir}/unidata-gen.elc unidata.txt
+       cd ${DSTDIR} && ${emacs} -l ${srcdir}/unidata-gen \
+         -f unidata-gen-files ${srcdir} ${abs_builddir}/unidata.txt
+
+## Like the above, but generate in PWD rather than lisp/international.
+charprop.el: ${srcdir}/unidata-gen.elc unidata.txt
+       ${emacs} -l ${srcdir}/unidata-gen \
+         -f unidata-gen-files ${srcdir} unidata.txt
 
 install: charprop.el
        cp charprop.el ${DSTDIR}
@@ -46,4 +57,9 @@ clean:
        if test -f charprop.el; then \
          rm -f `sed -n 's/^;; FILE: //p' < charprop.el`; \
        fi
-       rm -f charprop.el unidata-gen.elc unidata.txt
+       rm -f charprop.el ${srcdir}/unidata-gen.elc unidata.txt
+
+distclean: clean
+       -rm -f ./Makefile
+
+maintainer-clean: distclean
index 6048a6d624e23c5254fba42a45d33a96dc0c125b..481cd5e9b6ab8b265d40c4dbea56fe8e6b9f6748 100644 (file)
@@ -1,4 +1,4 @@
 The file `UnicodeData.txt' in this directory is a copy of
-<http://www.unicode.org/Public/UNIDATA/UnicodeData.txt> on 2009.10.1,
+<http://www.unicode.org/Public/UNIDATA/UnicodeData.txt> on 2012.04.07,
 and is a part of the Unicode Character Database governed by the "UCD
 Terms of Use" shown in the file `copyright.html'.
index 8d7222b13789c43e5ed36ddf0d3eb7ebe8d72c7b..9f204050c6bb2e587cb1c3154372b8131f9e2f28 100644 (file)
 00A4;CURRENCY SIGN;Sc;0;ET;;;;;N;;;;;
 00A5;YEN SIGN;Sc;0;ET;;;;;N;;;;;
 00A6;BROKEN BAR;So;0;ON;;;;;N;BROKEN VERTICAL BAR;;;;
-00A7;SECTION SIGN;So;0;ON;;;;;N;;;;;
+00A7;SECTION SIGN;Po;0;ON;;;;;N;;;;;
 00A8;DIAERESIS;Sk;0;ON;<compat> 0020 0308;;;;N;SPACING DIAERESIS;;;;
 00A9;COPYRIGHT SIGN;So;0;ON;;;;;N;;;;;
-00AA;FEMININE ORDINAL INDICATOR;Ll;0;L;<super> 0061;;;;N;;;;;
+00AA;FEMININE ORDINAL INDICATOR;Lo;0;L;<super> 0061;;;;N;;;;;
 00AB;LEFT-POINTING DOUBLE ANGLE QUOTATION MARK;Pi;0;ON;;;;;Y;LEFT POINTING GUILLEMET;;;;
 00AC;NOT SIGN;Sm;0;ON;;;;;N;;;;;
 00AD;SOFT HYPHEN;Cf;0;BN;;;;;N;;;;;
 00B3;SUPERSCRIPT THREE;No;0;EN;<super> 0033;;3;3;N;SUPERSCRIPT DIGIT THREE;;;;
 00B4;ACUTE ACCENT;Sk;0;ON;<compat> 0020 0301;;;;N;SPACING ACUTE;;;;
 00B5;MICRO SIGN;Ll;0;L;<compat> 03BC;;;;N;;;039C;;039C
-00B6;PILCROW SIGN;So;0;ON;;;;;N;PARAGRAPH SIGN;;;;
+00B6;PILCROW SIGN;Po;0;ON;;;;;N;PARAGRAPH SIGN;;;;
 00B7;MIDDLE DOT;Po;0;ON;;;;;N;;;;;
 00B8;CEDILLA;Sk;0;ON;<compat> 0020 0327;;;;N;SPACING CEDILLA;;;;
 00B9;SUPERSCRIPT ONE;No;0;EN;<super> 0031;;1;1;N;SUPERSCRIPT DIGIT ONE;;;;
-00BA;MASCULINE ORDINAL INDICATOR;Ll;0;L;<super> 006F;;;;N;;;;;
+00BA;MASCULINE ORDINAL INDICATOR;Lo;0;L;<super> 006F;;;;N;;;;;
 00BB;RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK;Pf;0;ON;;;;;Y;RIGHT POINTING GUILLEMET;;;;
 00BC;VULGAR FRACTION ONE QUARTER;No;0;ON;<fraction> 0031 2044 0034;;;1/4;N;FRACTION ONE QUARTER;;;;
 00BD;VULGAR FRACTION ONE HALF;No;0;ON;<fraction> 0031 2044 0032;;;1/2;N;FRACTION ONE HALF;;;;
 0263;LATIN SMALL LETTER GAMMA;Ll;0;L;;;;;N;;;0194;;0194
 0264;LATIN SMALL LETTER RAMS HORN;Ll;0;L;;;;;N;LATIN SMALL LETTER BABY GAMMA;;;;
 0265;LATIN SMALL LETTER TURNED H;Ll;0;L;;;;;N;;;A78D;;A78D
-0266;LATIN SMALL LETTER H WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER H HOOK;;;;
+0266;LATIN SMALL LETTER H WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER H HOOK;;A7AA;;A7AA
 0267;LATIN SMALL LETTER HENG WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER HENG HOOK;;;;
 0268;LATIN SMALL LETTER I WITH STROKE;Ll;0;L;;;;;N;LATIN SMALL LETTER BARRED I;;0197;;0197
 0269;LATIN SMALL LETTER IOTA;Ll;0;L;;;;;N;;;0196;;0196
 0587;ARMENIAN SMALL LIGATURE ECH YIWN;Ll;0;L;<compat> 0565 0582;;;;N;;;;;
 0589;ARMENIAN FULL STOP;Po;0;L;;;;;N;ARMENIAN PERIOD;;;;
 058A;ARMENIAN HYPHEN;Pd;0;ON;;;;;N;;;;;
+058F;ARMENIAN DRAM SIGN;Sc;0;ET;;;;;N;;;;;
 0591;HEBREW ACCENT ETNAHTA;Mn;220;NSM;;;;;N;;;;;
 0592;HEBREW ACCENT SEGOL;Mn;230;NSM;;;;;N;;;;;
 0593;HEBREW ACCENT SHALSHELET;Mn;230;NSM;;;;;N;;;;;
 0601;ARABIC SIGN SANAH;Cf;0;AN;;;;;N;;;;;
 0602;ARABIC FOOTNOTE MARKER;Cf;0;AN;;;;;N;;;;;
 0603;ARABIC SIGN SAFHA;Cf;0;AN;;;;;N;;;;;
+0604;ARABIC SIGN SAMVAT;Cf;0;AN;;;;;N;;;;;
 0606;ARABIC-INDIC CUBE ROOT;Sm;0;ON;;;;;N;;;;;
 0607;ARABIC-INDIC FOURTH ROOT;Sm;0;ON;;;;;N;;;;;
 0608;ARABIC RAY;Sm;0;AL;;;;;N;;;;;
 070B;SYRIAC HARKLEAN OBELUS;Po;0;AL;;;;;N;;;;;
 070C;SYRIAC HARKLEAN METOBELUS;Po;0;AL;;;;;N;;;;;
 070D;SYRIAC HARKLEAN ASTERISCUS;Po;0;AL;;;;;N;;;;;
-070F;SYRIAC ABBREVIATION MARK;Cf;0;AN;;;;;N;;;;;
+070F;SYRIAC ABBREVIATION MARK;Cf;0;AL;;;;;N;;;;;
 0710;SYRIAC LETTER ALAPH;Lo;0;AL;;;;;N;;;;;
 0711;SYRIAC LETTER SUPERSCRIPT ALAPH;Mn;36;NSM;;;;;N;;;;;
 0712;SYRIAC LETTER BETH;Lo;0;AL;;;;;N;;;;;
 085A;MANDAIC VOCALIZATION MARK;Mn;220;NSM;;;;;N;;;;;
 085B;MANDAIC GEMINATION MARK;Mn;220;NSM;;;;;N;;;;;
 085E;MANDAIC PUNCTUATION;Po;0;R;;;;;N;;;;;
+08A0;ARABIC LETTER BEH WITH SMALL V BELOW;Lo;0;AL;;;;;N;;;;;
+08A2;ARABIC LETTER JEEM WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+08A3;ARABIC LETTER TAH WITH TWO DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+08A4;ARABIC LETTER FEH WITH DOT BELOW AND THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+08A5;ARABIC LETTER QAF WITH DOT BELOW;Lo;0;AL;;;;;N;;;;;
+08A6;ARABIC LETTER LAM WITH DOUBLE BAR;Lo;0;AL;;;;;N;;;;;
+08A7;ARABIC LETTER MEEM WITH THREE DOTS ABOVE;Lo;0;AL;;;;;N;;;;;
+08A8;ARABIC LETTER YEH WITH TWO DOTS BELOW AND HAMZA ABOVE;Lo;0;AL;;;;;N;;;;;
+08A9;ARABIC LETTER YEH WITH TWO DOTS BELOW AND DOT ABOVE;Lo;0;AL;;;;;N;;;;;
+08AA;ARABIC LETTER REH WITH LOOP;Lo;0;AL;;;;;N;;;;;
+08AB;ARABIC LETTER WAW WITH DOT WITHIN;Lo;0;AL;;;;;N;;;;;
+08AC;ARABIC LETTER ROHINGYA YEH;Lo;0;AL;;;;;N;;;;;
+08E4;ARABIC CURLY FATHA;Mn;230;NSM;;;;;N;;;;;
+08E5;ARABIC CURLY DAMMA;Mn;230;NSM;;;;;N;;;;;
+08E6;ARABIC CURLY KASRA;Mn;220;NSM;;;;;N;;;;;
+08E7;ARABIC CURLY FATHATAN;Mn;230;NSM;;;;;N;;;;;
+08E8;ARABIC CURLY DAMMATAN;Mn;230;NSM;;;;;N;;;;;
+08E9;ARABIC CURLY KASRATAN;Mn;220;NSM;;;;;N;;;;;
+08EA;ARABIC TONE ONE DOT ABOVE;Mn;230;NSM;;;;;N;;;;;
+08EB;ARABIC TONE TWO DOTS ABOVE;Mn;230;NSM;;;;;N;;;;;
+08EC;ARABIC TONE LOOP ABOVE;Mn;230;NSM;;;;;N;;;;;
+08ED;ARABIC TONE ONE DOT BELOW;Mn;220;NSM;;;;;N;;;;;
+08EE;ARABIC TONE TWO DOTS BELOW;Mn;220;NSM;;;;;N;;;;;
+08EF;ARABIC TONE LOOP BELOW;Mn;220;NSM;;;;;N;;;;;
+08F0;ARABIC OPEN FATHATAN;Mn;27;NSM;;;;;N;;;;;
+08F1;ARABIC OPEN DAMMATAN;Mn;28;NSM;;;;;N;;;;;
+08F2;ARABIC OPEN KASRATAN;Mn;29;NSM;;;;;N;;;;;
+08F3;ARABIC SMALL HIGH WAW;Mn;230;NSM;;;;;N;;;;;
+08F4;ARABIC FATHA WITH RING;Mn;230;NSM;;;;;N;;;;;
+08F5;ARABIC FATHA WITH DOT ABOVE;Mn;230;NSM;;;;;N;;;;;
+08F6;ARABIC KASRA WITH DOT BELOW;Mn;220;NSM;;;;;N;;;;;
+08F7;ARABIC LEFT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;;
+08F8;ARABIC RIGHT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;;
+08F9;ARABIC LEFT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;;
+08FA;ARABIC RIGHT ARROWHEAD BELOW;Mn;220;NSM;;;;;N;;;;;
+08FB;ARABIC DOUBLE RIGHT ARROWHEAD ABOVE;Mn;230;NSM;;;;;N;;;;;
+08FC;ARABIC DOUBLE RIGHT ARROWHEAD ABOVE WITH DOT;Mn;230;NSM;;;;;N;;;;;
+08FD;ARABIC RIGHT ARROWHEAD ABOVE WITH DOT;Mn;230;NSM;;;;;N;;;;;
+08FE;ARABIC DAMMA WITH DOT;Mn;230;NSM;;;;;N;;;;;
 0900;DEVANAGARI SIGN INVERTED CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
 0901;DEVANAGARI SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
 0902;DEVANAGARI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
 0AED;GUJARATI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
 0AEE;GUJARATI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
 0AEF;GUJARATI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0AF0;GUJARATI ABBREVIATION SIGN;Po;0;L;;;;;N;;;;;
 0AF1;GUJARATI RUPEE SIGN;Sc;0;ET;;;;;N;;;;;
 0B01;ORIYA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
 0B02;ORIYA SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
 0ED9;LAO DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
 0EDC;LAO HO NO;Lo;0;L;<compat> 0EAB 0E99;;;;N;;;;;
 0EDD;LAO HO MO;Lo;0;L;<compat> 0EAB 0EA1;;;;N;;;;;
+0EDE;LAO LETTER KHMU GO;Lo;0;L;;;;;N;;;;;
+0EDF;LAO LETTER KHMU NYO;Lo;0;L;;;;;N;;;;;
 0F00;TIBETAN SYLLABLE OM;Lo;0;L;;;;;N;;;;;
 0F01;TIBETAN MARK GTER YIG MGO TRUNCATED A;So;0;L;;;;;N;;;;;
 0F02;TIBETAN MARK GTER YIG MGO -UM RNAM BCAD MA;So;0;L;;;;;N;;;;;
 0F11;TIBETAN MARK RIN CHEN SPUNGS SHAD;Po;0;L;;;;;N;TIBETAN RINCHANPHUNGSHAD;;;;
 0F12;TIBETAN MARK RGYA GRAM SHAD;Po;0;L;;;;;N;;;;;
 0F13;TIBETAN MARK CARET -DZUD RTAGS ME LONG CAN;So;0;L;;;;;N;;;;;
-0F14;TIBETAN MARK GTER TSHEG;So;0;L;;;;;N;TIBETAN COMMA;;;;
+0F14;TIBETAN MARK GTER TSHEG;Po;0;L;;;;;N;TIBETAN COMMA;;;;
 0F15;TIBETAN LOGOTYPE SIGN CHAD RTAGS;So;0;L;;;;;N;;;;;
 0F16;TIBETAN LOGOTYPE SIGN LHAG RTAGS;So;0;L;;;;;N;;;;;
 0F17;TIBETAN ASTROLOGICAL SIGN SGRA GCAN -CHAR RTAGS;So;0;L;;;;;N;;;;;
 10C3;GEORGIAN CAPITAL LETTER WE;Lu;0;L;;;;;N;;;;2D23;
 10C4;GEORGIAN CAPITAL LETTER HAR;Lu;0;L;;;;;N;;;;2D24;
 10C5;GEORGIAN CAPITAL LETTER HOE;Lu;0;L;;;;;N;;;;2D25;
+10C7;GEORGIAN CAPITAL LETTER YN;Lu;0;L;;;;;N;;;;2D27;
+10CD;GEORGIAN CAPITAL LETTER AEN;Lu;0;L;;;;;N;;;;2D2D;
 10D0;GEORGIAN LETTER AN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER AN;;;;
 10D1;GEORGIAN LETTER BAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER BAN;;;;
 10D2;GEORGIAN LETTER GAN;Lo;0;L;;;;;N;GEORGIAN SMALL LETTER GAN;;;;
 10FA;GEORGIAN LETTER AIN;Lo;0;L;;;;;N;;;;;
 10FB;GEORGIAN PARAGRAPH SEPARATOR;Po;0;L;;;;;N;;;;;
 10FC;MODIFIER LETTER GEORGIAN NAR;Lm;0;L;<super> 10DC;;;;N;;;;;
+10FD;GEORGIAN LETTER AEN;Lo;0;L;;;;;N;;;;;
+10FE;GEORGIAN LETTER HARD SIGN;Lo;0;L;;;;;N;;;;;
+10FF;GEORGIAN LETTER LABIAL SIGN;Lo;0;L;;;;;N;;;;;
 1100;HANGUL CHOSEONG KIYEOK;Lo;0;L;;;;;N;;;;;
 1101;HANGUL CHOSEONG SSANGKIYEOK;Lo;0;L;;;;;N;;;;;
 1102;HANGUL CHOSEONG NIEUN;Lo;0;L;;;;;N;;;;;
 135D;ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK;Mn;230;NSM;;;;;N;;;;;
 135E;ETHIOPIC COMBINING VOWEL LENGTH MARK;Mn;230;NSM;;;;;N;;;;;
 135F;ETHIOPIC COMBINING GEMINATION MARK;Mn;230;NSM;;;;;N;;;;;
-1360;ETHIOPIC SECTION MARK;So;0;L;;;;;N;;;;;
+1360;ETHIOPIC SECTION MARK;Po;0;L;;;;;N;;;;;
 1361;ETHIOPIC WORDSPACE;Po;0;L;;;;;N;;;;;
 1362;ETHIOPIC FULL STOP;Po;0;L;;;;;N;;;;;
 1363;ETHIOPIC COMMA;Po;0;L;;;;;N;;;;;
 17B1;KHMER INDEPENDENT VOWEL QOO TYPE ONE;Lo;0;L;;;;;N;;;;;
 17B2;KHMER INDEPENDENT VOWEL QOO TYPE TWO;Lo;0;L;;;;;N;;;;;
 17B3;KHMER INDEPENDENT VOWEL QAU;Lo;0;L;;;;;N;;;;;
-17B4;KHMER VOWEL INHERENT AQ;Cf;0;L;;;;;N;;;;;
-17B5;KHMER VOWEL INHERENT AA;Cf;0;L;;;;;N;;;;;
+17B4;KHMER VOWEL INHERENT AQ;Mn;0;NSM;;;;;N;;;;;
+17B5;KHMER VOWEL INHERENT AA;Mn;0;NSM;;;;;N;;;;;
 17B6;KHMER VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
 17B7;KHMER VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
 17B8;KHMER VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
 1BA8;SUNDANESE VOWEL SIGN PAMEPET;Mn;0;NSM;;;;;N;;;;;
 1BA9;SUNDANESE VOWEL SIGN PANEULEUNG;Mn;0;NSM;;;;;N;;;;;
 1BAA;SUNDANESE SIGN PAMAAEH;Mc;9;L;;;;;N;;;;;
+1BAB;SUNDANESE SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+1BAC;SUNDANESE CONSONANT SIGN PASANGAN MA;Mc;0;L;;;;;N;;;;;
+1BAD;SUNDANESE CONSONANT SIGN PASANGAN WA;Mc;0;L;;;;;N;;;;;
 1BAE;SUNDANESE LETTER KHA;Lo;0;L;;;;;N;;;;;
 1BAF;SUNDANESE LETTER SYA;Lo;0;L;;;;;N;;;;;
 1BB0;SUNDANESE DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
 1BB7;SUNDANESE DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
 1BB8;SUNDANESE DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
 1BB9;SUNDANESE DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+1BBA;SUNDANESE AVAGRAHA;Lo;0;L;;;;;N;;;;;
+1BBB;SUNDANESE LETTER REU;Lo;0;L;;;;;N;;;;;
+1BBC;SUNDANESE LETTER LEU;Lo;0;L;;;;;N;;;;;
+1BBD;SUNDANESE LETTER BHA;Lo;0;L;;;;;N;;;;;
+1BBE;SUNDANESE LETTER FINAL K;Lo;0;L;;;;;N;;;;;
+1BBF;SUNDANESE LETTER FINAL M;Lo;0;L;;;;;N;;;;;
 1BC0;BATAK LETTER A;Lo;0;L;;;;;N;;;;;
 1BC1;BATAK LETTER SIMALUNGUN A;Lo;0;L;;;;;N;;;;;
 1BC2;BATAK LETTER HA;Lo;0;L;;;;;N;;;;;
 1C7D;OL CHIKI AHAD;Lm;0;L;;;;;N;;;;;
 1C7E;OL CHIKI PUNCTUATION MUCAAD;Po;0;L;;;;;N;;;;;
 1C7F;OL CHIKI PUNCTUATION DOUBLE MUCAAD;Po;0;L;;;;;N;;;;;
+1CC0;SUNDANESE PUNCTUATION BINDU SURYA;Po;0;L;;;;;N;;;;;
+1CC1;SUNDANESE PUNCTUATION BINDU PANGLONG;Po;0;L;;;;;N;;;;;
+1CC2;SUNDANESE PUNCTUATION BINDU PURNAMA;Po;0;L;;;;;N;;;;;
+1CC3;SUNDANESE PUNCTUATION BINDU CAKRA;Po;0;L;;;;;N;;;;;
+1CC4;SUNDANESE PUNCTUATION BINDU LEU SATANGA;Po;0;L;;;;;N;;;;;
+1CC5;SUNDANESE PUNCTUATION BINDU KA SATANGA;Po;0;L;;;;;N;;;;;
+1CC6;SUNDANESE PUNCTUATION BINDU DA SATANGA;Po;0;L;;;;;N;;;;;
+1CC7;SUNDANESE PUNCTUATION BINDU BA SATANGA;Po;0;L;;;;;N;;;;;
 1CD0;VEDIC TONE KARSHANA;Mn;230;NSM;;;;;N;;;;;
 1CD1;VEDIC TONE SHARA;Mn;230;NSM;;;;;N;;;;;
 1CD2;VEDIC TONE PRENKHA;Mn;230;NSM;;;;;N;;;;;
 1CF0;VEDIC SIGN RTHANG LONG ANUSVARA;Lo;0;L;;;;;N;;;;;
 1CF1;VEDIC SIGN ANUSVARA UBHAYATO MUKHA;Lo;0;L;;;;;N;;;;;
 1CF2;VEDIC SIGN ARDHAVISARGA;Mc;0;L;;;;;N;;;;;
+1CF3;VEDIC SIGN ROTATED ARDHAVISARGA;Mc;0;L;;;;;N;;;;;
+1CF4;VEDIC TONE CANDRA ABOVE;Mn;230;NSM;;;;;N;;;;;
+1CF5;VEDIC SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;;
+1CF6;VEDIC SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;;
 1D00;LATIN LETTER SMALL CAPITAL A;Ll;0;L;;;;;N;;;;;
 1D01;LATIN LETTER SMALL CAPITAL AE;Ll;0;L;;;;;N;;;;;
 1D02;LATIN SMALL LETTER TURNED AE;Ll;0;L;;;;;N;;;;;
 1D5F;MODIFIER LETTER SMALL DELTA;Lm;0;L;<super> 03B4;;;;N;;;;;
 1D60;MODIFIER LETTER SMALL GREEK PHI;Lm;0;L;<super> 03C6;;;;N;;;;;
 1D61;MODIFIER LETTER SMALL CHI;Lm;0;L;<super> 03C7;;;;N;;;;;
-1D62;LATIN SUBSCRIPT SMALL LETTER I;Ll;0;L;<sub> 0069;;;;N;;;;;
-1D63;LATIN SUBSCRIPT SMALL LETTER R;Ll;0;L;<sub> 0072;;;;N;;;;;
-1D64;LATIN SUBSCRIPT SMALL LETTER U;Ll;0;L;<sub> 0075;;;;N;;;;;
-1D65;LATIN SUBSCRIPT SMALL LETTER V;Ll;0;L;<sub> 0076;;;;N;;;;;
-1D66;GREEK SUBSCRIPT SMALL LETTER BETA;Ll;0;L;<sub> 03B2;;;;N;;;;;
-1D67;GREEK SUBSCRIPT SMALL LETTER GAMMA;Ll;0;L;<sub> 03B3;;;;N;;;;;
-1D68;GREEK SUBSCRIPT SMALL LETTER RHO;Ll;0;L;<sub> 03C1;;;;N;;;;;
-1D69;GREEK SUBSCRIPT SMALL LETTER PHI;Ll;0;L;<sub> 03C6;;;;N;;;;;
-1D6A;GREEK SUBSCRIPT SMALL LETTER CHI;Ll;0;L;<sub> 03C7;;;;N;;;;;
+1D62;LATIN SUBSCRIPT SMALL LETTER I;Lm;0;L;<sub> 0069;;;;N;;;;;
+1D63;LATIN SUBSCRIPT SMALL LETTER R;Lm;0;L;<sub> 0072;;;;N;;;;;
+1D64;LATIN SUBSCRIPT SMALL LETTER U;Lm;0;L;<sub> 0075;;;;N;;;;;
+1D65;LATIN SUBSCRIPT SMALL LETTER V;Lm;0;L;<sub> 0076;;;;N;;;;;
+1D66;GREEK SUBSCRIPT SMALL LETTER BETA;Lm;0;L;<sub> 03B2;;;;N;;;;;
+1D67;GREEK SUBSCRIPT SMALL LETTER GAMMA;Lm;0;L;<sub> 03B3;;;;N;;;;;
+1D68;GREEK SUBSCRIPT SMALL LETTER RHO;Lm;0;L;<sub> 03C1;;;;N;;;;;
+1D69;GREEK SUBSCRIPT SMALL LETTER PHI;Lm;0;L;<sub> 03C6;;;;N;;;;;
+1D6A;GREEK SUBSCRIPT SMALL LETTER CHI;Lm;0;L;<sub> 03C7;;;;N;;;;;
 1D6B;LATIN SMALL LETTER UE;Ll;0;L;;;;;N;;;;;
 1D6C;LATIN SMALL LETTER B WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
 1D6D;LATIN SMALL LETTER D WITH MIDDLE TILDE;Ll;0;L;;;;;N;;;;;
 27C8;REVERSE SOLIDUS PRECEDING SUBSET;Sm;0;ON;;;;;Y;;;;;
 27C9;SUPERSET PRECEDING SOLIDUS;Sm;0;ON;;;;;Y;;;;;
 27CA;VERTICAL BAR WITH HORIZONTAL STROKE;Sm;0;ON;;;;;N;;;;;
+27CB;MATHEMATICAL RISING DIAGONAL;Sm;0;ON;;;;;Y;;;;;
 27CC;LONG DIVISION;Sm;0;ON;;;;;Y;;;;;
+27CD;MATHEMATICAL FALLING DIAGONAL;Sm;0;ON;;;;;Y;;;;;
 27CE;SQUARED LOGICAL AND;Sm;0;ON;;;;;N;;;;;
 27CF;SQUARED LOGICAL OR;Sm;0;ON;;;;;N;;;;;
 27D0;WHITE DIAMOND WITH CENTRED DOT;Sm;0;ON;;;;;N;;;;;
 2C79;LATIN SMALL LETTER TURNED R WITH TAIL;Ll;0;L;;;;;N;;;;;
 2C7A;LATIN SMALL LETTER O WITH LOW RING INSIDE;Ll;0;L;;;;;N;;;;;
 2C7B;LATIN LETTER SMALL CAPITAL TURNED E;Ll;0;L;;;;;N;;;;;
-2C7C;LATIN SUBSCRIPT SMALL LETTER J;Ll;0;L;<sub> 006A;;;;N;;;;;
+2C7C;LATIN SUBSCRIPT SMALL LETTER J;Lm;0;L;<sub> 006A;;;;N;;;;;
 2C7D;MODIFIER LETTER CAPITAL V;Lm;0;L;<super> 0056;;;;N;;;;;
 2C7E;LATIN CAPITAL LETTER S WITH SWASH TAIL;Lu;0;L;;;;;N;;;;023F;
 2C7F;LATIN CAPITAL LETTER Z WITH SWASH TAIL;Lu;0;L;;;;;N;;;;0240;
 2CEF;COPTIC COMBINING NI ABOVE;Mn;230;NSM;;;;;N;;;;;
 2CF0;COPTIC COMBINING SPIRITUS ASPER;Mn;230;NSM;;;;;N;;;;;
 2CF1;COPTIC COMBINING SPIRITUS LENIS;Mn;230;NSM;;;;;N;;;;;
+2CF2;COPTIC CAPITAL LETTER BOHAIRIC KHEI;Lu;0;L;;;;;N;;;;2CF3;
+2CF3;COPTIC SMALL LETTER BOHAIRIC KHEI;Ll;0;L;;;;;N;;;2CF2;;2CF2
 2CF9;COPTIC OLD NUBIAN FULL STOP;Po;0;ON;;;;;N;;;;;
 2CFA;COPTIC OLD NUBIAN DIRECT QUESTION MARK;Po;0;ON;;;;;N;;;;;
 2CFB;COPTIC OLD NUBIAN INDIRECT QUESTION MARK;Po;0;ON;;;;;N;;;;;
 2D23;GEORGIAN SMALL LETTER WE;Ll;0;L;;;;;N;;;10C3;;10C3
 2D24;GEORGIAN SMALL LETTER HAR;Ll;0;L;;;;;N;;;10C4;;10C4
 2D25;GEORGIAN SMALL LETTER HOE;Ll;0;L;;;;;N;;;10C5;;10C5
+2D27;GEORGIAN SMALL LETTER YN;Ll;0;L;;;;;N;;;10C7;;10C7
+2D2D;GEORGIAN SMALL LETTER AEN;Ll;0;L;;;;;N;;;10CD;;10CD
 2D30;TIFINAGH LETTER YA;Lo;0;L;;;;;N;;;;;
 2D31;TIFINAGH LETTER YAB;Lo;0;L;;;;;N;;;;;
 2D32;TIFINAGH LETTER YABH;Lo;0;L;;;;;N;;;;;
 2D63;TIFINAGH LETTER YAZ;Lo;0;L;;;;;N;;;;;
 2D64;TIFINAGH LETTER TAWELLEMET YAZ;Lo;0;L;;;;;N;;;;;
 2D65;TIFINAGH LETTER YAZZ;Lo;0;L;;;;;N;;;;;
+2D66;TIFINAGH LETTER YE;Lo;0;L;;;;;N;;;;;
+2D67;TIFINAGH LETTER YO;Lo;0;L;;;;;N;;;;;
 2D6F;TIFINAGH MODIFIER LETTER LABIALIZATION MARK;Lm;0;L;<super> 2D61;;;;N;;;;;
 2D70;TIFINAGH SEPARATOR MARK;Po;0;L;;;;;N;;;;;
 2D7F;TIFINAGH CONSONANT JOINER;Mn;9;NSM;;;;;N;;;;;
 2E2F;VERTICAL TILDE;Lm;0;ON;;;;;N;;;;;
 2E30;RING POINT;Po;0;ON;;;;;N;;;;;
 2E31;WORD SEPARATOR MIDDLE DOT;Po;0;ON;;;;;N;;;;;
+2E32;TURNED COMMA;Po;0;ON;;;;;N;;;;;
+2E33;RAISED DOT;Po;0;ON;;;;;N;;;;;
+2E34;RAISED COMMA;Po;0;ON;;;;;N;;;;;
+2E35;TURNED SEMICOLON;Po;0;ON;;;;;N;;;;;
+2E36;DAGGER WITH LEFT GUARD;Po;0;ON;;;;;N;;;;;
+2E37;DAGGER WITH RIGHT GUARD;Po;0;ON;;;;;N;;;;;
+2E38;TURNED DAGGER;Po;0;ON;;;;;N;;;;;
+2E39;TOP HALF SECTION SIGN;Po;0;ON;;;;;N;;;;;
+2E3A;TWO-EM DASH;Pd;0;ON;;;;;N;;;;;
+2E3B;THREE-EM DASH;Pd;0;ON;;;;;N;;;;;
 2E80;CJK RADICAL REPEAT;So;0;ON;;;;;N;;;;;
 2E81;CJK RADICAL CLIFF;So;0;ON;;;;;N;;;;;
 2E82;CJK RADICAL SECOND ONE;So;0;ON;;;;;N;;;;;
 302B;IDEOGRAPHIC RISING TONE MARK;Mn;228;NSM;;;;;N;;;;;
 302C;IDEOGRAPHIC DEPARTING TONE MARK;Mn;232;NSM;;;;;N;;;;;
 302D;IDEOGRAPHIC ENTERING TONE MARK;Mn;222;NSM;;;;;N;;;;;
-302E;HANGUL SINGLE DOT TONE MARK;Mn;224;NSM;;;;;N;;;;;
-302F;HANGUL DOUBLE DOT TONE MARK;Mn;224;NSM;;;;;N;;;;;
+302E;HANGUL SINGLE DOT TONE MARK;Mc;224;L;;;;;N;;;;;
+302F;HANGUL DOUBLE DOT TONE MARK;Mc;224;L;;;;;N;;;;;
 3030;WAVY DASH;Pd;0;ON;;;;;N;;;;;
 3031;VERTICAL KANA REPEAT MARK;Lm;0;L;;;;;N;;;;;
 3032;VERTICAL KANA REPEAT WITH VOICED SOUND MARK;Lm;0;L;;;;;N;;;;;
 3245;CIRCLED IDEOGRAPH KINDERGARTEN;So;0;L;<circle> 5E7C;;;;N;;;;;
 3246;CIRCLED IDEOGRAPH SCHOOL;So;0;L;<circle> 6587;;;;N;;;;;
 3247;CIRCLED IDEOGRAPH KOTO;So;0;L;<circle> 7B8F;;;;N;;;;;
-3248;CIRCLED NUMBER TEN ON BLACK SQUARE;So;0;L;;;;;N;;;;;
-3249;CIRCLED NUMBER TWENTY ON BLACK SQUARE;So;0;L;;;;;N;;;;;
-324A;CIRCLED NUMBER THIRTY ON BLACK SQUARE;So;0;L;;;;;N;;;;;
-324B;CIRCLED NUMBER FORTY ON BLACK SQUARE;So;0;L;;;;;N;;;;;
-324C;CIRCLED NUMBER FIFTY ON BLACK SQUARE;So;0;L;;;;;N;;;;;
-324D;CIRCLED NUMBER SIXTY ON BLACK SQUARE;So;0;L;;;;;N;;;;;
-324E;CIRCLED NUMBER SEVENTY ON BLACK SQUARE;So;0;L;;;;;N;;;;;
-324F;CIRCLED NUMBER EIGHTY ON BLACK SQUARE;So;0;L;;;;;N;;;;;
+3248;CIRCLED NUMBER TEN ON BLACK SQUARE;No;0;L;;;;10;N;;;;;
+3249;CIRCLED NUMBER TWENTY ON BLACK SQUARE;No;0;L;;;;20;N;;;;;
+324A;CIRCLED NUMBER THIRTY ON BLACK SQUARE;No;0;L;;;;30;N;;;;;
+324B;CIRCLED NUMBER FORTY ON BLACK SQUARE;No;0;L;;;;40;N;;;;;
+324C;CIRCLED NUMBER FIFTY ON BLACK SQUARE;No;0;L;;;;50;N;;;;;
+324D;CIRCLED NUMBER SIXTY ON BLACK SQUARE;No;0;L;;;;60;N;;;;;
+324E;CIRCLED NUMBER SEVENTY ON BLACK SQUARE;No;0;L;;;;70;N;;;;;
+324F;CIRCLED NUMBER EIGHTY ON BLACK SQUARE;No;0;L;;;;80;N;;;;;
 3250;PARTNERSHIP SIGN;So;0;ON;<square> 0050 0054 0045;;;;N;;;;;
 3251;CIRCLED NUMBER TWENTY ONE;No;0;ON;<circle> 0032 0031;;;21;N;;;;;
 3252;CIRCLED NUMBER TWENTY TWO;No;0;ON;<circle> 0032 0032;;;22;N;;;;;
 4DFE;HEXAGRAM FOR AFTER COMPLETION;So;0;ON;;;;;N;;;;;
 4DFF;HEXAGRAM FOR BEFORE COMPLETION;So;0;ON;;;;;N;;;;;
 4E00;<CJK Ideograph, First>;Lo;0;L;;;;;N;;;;;
-9FCB;<CJK Ideograph, Last>;Lo;0;L;;;;;N;;;;;
+9FCC;<CJK Ideograph, Last>;Lo;0;L;;;;;N;;;;;
 A000;YI SYLLABLE IT;Lo;0;L;;;;;N;;;;;
 A001;YI SYLLABLE IX;Lo;0;L;;;;;N;;;;;
 A002;YI SYLLABLE I;Lo;0;L;;;;;N;;;;;
@@ -13258,6 +13346,14 @@ A670;COMBINING CYRILLIC TEN MILLIONS SIGN;Me;0;NSM;;;;;N;;;;;
 A671;COMBINING CYRILLIC HUNDRED MILLIONS SIGN;Me;0;NSM;;;;;N;;;;;
 A672;COMBINING CYRILLIC THOUSAND MILLIONS SIGN;Me;0;NSM;;;;;N;;;;;
 A673;SLAVONIC ASTERISK;Po;0;ON;;;;;N;;;;;
+A674;COMBINING CYRILLIC LETTER UKRAINIAN IE;Mn;230;NSM;;;;;N;;;;;
+A675;COMBINING CYRILLIC LETTER I;Mn;230;NSM;;;;;N;;;;;
+A676;COMBINING CYRILLIC LETTER YI;Mn;230;NSM;;;;;N;;;;;
+A677;COMBINING CYRILLIC LETTER U;Mn;230;NSM;;;;;N;;;;;
+A678;COMBINING CYRILLIC LETTER HARD SIGN;Mn;230;NSM;;;;;N;;;;;
+A679;COMBINING CYRILLIC LETTER YERU;Mn;230;NSM;;;;;N;;;;;
+A67A;COMBINING CYRILLIC LETTER SOFT SIGN;Mn;230;NSM;;;;;N;;;;;
+A67B;COMBINING CYRILLIC LETTER OMEGA;Mn;230;NSM;;;;;N;;;;;
 A67C;COMBINING CYRILLIC KAVYKA;Mn;230;NSM;;;;;N;;;;;
 A67D;COMBINING CYRILLIC PAYEROK;Mn;230;NSM;;;;;N;;;;;
 A67E;CYRILLIC KAVYKA;Po;0;ON;;;;;N;;;;;
@@ -13286,6 +13382,7 @@ A694;CYRILLIC CAPITAL LETTER HWE;Lu;0;L;;;;;N;;;;A695;
 A695;CYRILLIC SMALL LETTER HWE;Ll;0;L;;;;;N;;;A694;;A694
 A696;CYRILLIC CAPITAL LETTER SHWE;Lu;0;L;;;;;N;;;;A697;
 A697;CYRILLIC SMALL LETTER SHWE;Ll;0;L;;;;;N;;;A696;;A696
+A69F;COMBINING CYRILLIC LETTER IOTIFIED E;Mn;230;NSM;;;;;N;;;;;
 A6A0;BAMUM LETTER A;Lo;0;L;;;;;N;;;;;
 A6A1;BAMUM LETTER KA;Lo;0;L;;;;;N;;;;;
 A6A2;BAMUM LETTER U;Lo;0;L;;;;;N;;;;;
@@ -13519,6 +13616,8 @@ A78D;LATIN CAPITAL LETTER TURNED H;Lu;0;L;;;;;N;;;;0265;
 A78E;LATIN SMALL LETTER L WITH RETROFLEX HOOK AND BELT;Ll;0;L;;;;;N;;;;;
 A790;LATIN CAPITAL LETTER N WITH DESCENDER;Lu;0;L;;;;;N;;;;A791;
 A791;LATIN SMALL LETTER N WITH DESCENDER;Ll;0;L;;;;;N;;;A790;;A790
+A792;LATIN CAPITAL LETTER C WITH BAR;Lu;0;L;;;;;N;;;;A793;
+A793;LATIN SMALL LETTER C WITH BAR;Ll;0;L;;;;;N;;;A792;;A792
 A7A0;LATIN CAPITAL LETTER G WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A1;
 A7A1;LATIN SMALL LETTER G WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A0;;A7A0
 A7A2;LATIN CAPITAL LETTER K WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A3;
@@ -13529,6 +13628,9 @@ A7A6;LATIN CAPITAL LETTER R WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A7;
 A7A7;LATIN SMALL LETTER R WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A6;;A7A6
 A7A8;LATIN CAPITAL LETTER S WITH OBLIQUE STROKE;Lu;0;L;;;;;N;;;;A7A9;
 A7A9;LATIN SMALL LETTER S WITH OBLIQUE STROKE;Ll;0;L;;;;;N;;;A7A8;;A7A8
+A7AA;LATIN CAPITAL LETTER H WITH HOOK;Lu;0;L;;;;;N;;;;0266;
+A7F8;MODIFIER LETTER CAPITAL H WITH STROKE;Lm;0;L;<super> 0126;;;;N;;;;;
+A7F9;MODIFIER LETTER SMALL LIGATURE OE;Lm;0;L;<super> 0153;;;;N;;;;;
 A7FA;LATIN LETTER SMALL CAPITAL TURNED M;Ll;0;L;;;;;N;;;;;
 A7FB;LATIN EPIGRAPHIC LETTER REVERSED F;Lo;0;L;;;;;N;;;;;
 A7FC;LATIN EPIGRAPHIC LETTER REVERSED P;Lo;0;L;;;;;N;;;;;
@@ -14142,6 +14244,29 @@ AADC;TAI VIET SYMBOL NUENG;Lo;0;L;;;;;N;;;;;
 AADD;TAI VIET SYMBOL SAM;Lm;0;L;;;;;N;;;;;
 AADE;TAI VIET SYMBOL HO HOI;Po;0;L;;;;;N;;;;;
 AADF;TAI VIET SYMBOL KOI KOI;Po;0;L;;;;;N;;;;;
+AAE0;MEETEI MAYEK LETTER E;Lo;0;L;;;;;N;;;;;
+AAE1;MEETEI MAYEK LETTER O;Lo;0;L;;;;;N;;;;;
+AAE2;MEETEI MAYEK LETTER CHA;Lo;0;L;;;;;N;;;;;
+AAE3;MEETEI MAYEK LETTER NYA;Lo;0;L;;;;;N;;;;;
+AAE4;MEETEI MAYEK LETTER TTA;Lo;0;L;;;;;N;;;;;
+AAE5;MEETEI MAYEK LETTER TTHA;Lo;0;L;;;;;N;;;;;
+AAE6;MEETEI MAYEK LETTER DDA;Lo;0;L;;;;;N;;;;;
+AAE7;MEETEI MAYEK LETTER DDHA;Lo;0;L;;;;;N;;;;;
+AAE8;MEETEI MAYEK LETTER NNA;Lo;0;L;;;;;N;;;;;
+AAE9;MEETEI MAYEK LETTER SHA;Lo;0;L;;;;;N;;;;;
+AAEA;MEETEI MAYEK LETTER SSA;Lo;0;L;;;;;N;;;;;
+AAEB;MEETEI MAYEK VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+AAEC;MEETEI MAYEK VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+AAED;MEETEI MAYEK VOWEL SIGN AAI;Mn;0;NSM;;;;;N;;;;;
+AAEE;MEETEI MAYEK VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+AAEF;MEETEI MAYEK VOWEL SIGN AAU;Mc;0;L;;;;;N;;;;;
+AAF0;MEETEI MAYEK CHEIKHAN;Po;0;L;;;;;N;;;;;
+AAF1;MEETEI MAYEK AHANG KHUDAM;Po;0;L;;;;;N;;;;;
+AAF2;MEETEI MAYEK ANJI;Lo;0;L;;;;;N;;;;;
+AAF3;MEETEI MAYEK SYLLABLE REPETITION MARK;Lm;0;L;;;;;N;;;;;
+AAF4;MEETEI MAYEK WORD REPETITION MARK;Lm;0;L;;;;;N;;;;;
+AAF5;MEETEI MAYEK VOWEL SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+AAF6;MEETEI MAYEK VIRAMA;Mn;9;NSM;;;;;N;;;;;
 AB01;ETHIOPIC SYLLABLE TTHU;Lo;0;L;;;;;N;;;;;
 AB02;ETHIOPIC SYLLABLE TTHI;Lo;0;L;;;;;N;;;;;
 AB03;ETHIOPIC SYLLABLE TTHAA;Lo;0;L;;;;;N;;;;;
@@ -14614,6 +14739,8 @@ FA2A;CJK COMPATIBILITY IDEOGRAPH-FA2A;Lo;0;L;98EF;;;;N;;;;;
 FA2B;CJK COMPATIBILITY IDEOGRAPH-FA2B;Lo;0;L;98FC;;;;N;;;;;
 FA2C;CJK COMPATIBILITY IDEOGRAPH-FA2C;Lo;0;L;9928;;;;N;;;;;
 FA2D;CJK COMPATIBILITY IDEOGRAPH-FA2D;Lo;0;L;9DB4;;;;N;;;;;
+FA2E;CJK COMPATIBILITY IDEOGRAPH-FA2E;Lo;0;L;90DE;;;;N;;;;;
+FA2F;CJK COMPATIBILITY IDEOGRAPH-FA2F;Lo;0;L;96B7;;;;N;;;;;
 FA30;CJK COMPATIBILITY IDEOGRAPH-FA30;Lo;0;L;4FAE;;;;N;;;;;
 FA31;CJK COMPATIBILITY IDEOGRAPH-FA31;Lo;0;L;50E7;;;;N;;;;;
 FA32;CJK COMPATIBILITY IDEOGRAPH-FA32;Lo;0;L;514D;;;;N;;;;;
@@ -16126,7 +16253,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 100FA;LINEAR B IDEOGRAM VESSEL B305;Lo;0;L;;;;;N;;;;;
 10100;AEGEAN WORD SEPARATOR LINE;Po;0;L;;;;;N;;;;;
 10101;AEGEAN WORD SEPARATOR DOT;Po;0;ON;;;;;N;;;;;
-10102;AEGEAN CHECK MARK;So;0;L;;;;;N;;;;;
+10102;AEGEAN CHECK MARK;Po;0;L;;;;;N;;;;;
 10107;AEGEAN NUMBER ONE;No;0;L;;;;1;N;;;;;
 10108;AEGEAN NUMBER TWO;No;0;L;;;;2;N;;;;;
 10109;AEGEAN NUMBER THREE;No;0;L;;;;3;N;;;;;
@@ -16845,6 +16972,64 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 10938;LYDIAN LETTER NN;Lo;0;R;;;;;N;;;;;
 10939;LYDIAN LETTER C;Lo;0;R;;;;;N;;;;;
 1093F;LYDIAN TRIANGULAR MARK;Po;0;R;;;;;N;;;;;
+10980;MEROITIC HIEROGLYPHIC LETTER A;Lo;0;R;;;;;N;;;;;
+10981;MEROITIC HIEROGLYPHIC LETTER E;Lo;0;R;;;;;N;;;;;
+10982;MEROITIC HIEROGLYPHIC LETTER I;Lo;0;R;;;;;N;;;;;
+10983;MEROITIC HIEROGLYPHIC LETTER O;Lo;0;R;;;;;N;;;;;
+10984;MEROITIC HIEROGLYPHIC LETTER YA;Lo;0;R;;;;;N;;;;;
+10985;MEROITIC HIEROGLYPHIC LETTER WA;Lo;0;R;;;;;N;;;;;
+10986;MEROITIC HIEROGLYPHIC LETTER BA;Lo;0;R;;;;;N;;;;;
+10987;MEROITIC HIEROGLYPHIC LETTER BA-2;Lo;0;R;;;;;N;;;;;
+10988;MEROITIC HIEROGLYPHIC LETTER PA;Lo;0;R;;;;;N;;;;;
+10989;MEROITIC HIEROGLYPHIC LETTER MA;Lo;0;R;;;;;N;;;;;
+1098A;MEROITIC HIEROGLYPHIC LETTER NA;Lo;0;R;;;;;N;;;;;
+1098B;MEROITIC HIEROGLYPHIC LETTER NA-2;Lo;0;R;;;;;N;;;;;
+1098C;MEROITIC HIEROGLYPHIC LETTER NE;Lo;0;R;;;;;N;;;;;
+1098D;MEROITIC HIEROGLYPHIC LETTER NE-2;Lo;0;R;;;;;N;;;;;
+1098E;MEROITIC HIEROGLYPHIC LETTER RA;Lo;0;R;;;;;N;;;;;
+1098F;MEROITIC HIEROGLYPHIC LETTER RA-2;Lo;0;R;;;;;N;;;;;
+10990;MEROITIC HIEROGLYPHIC LETTER LA;Lo;0;R;;;;;N;;;;;
+10991;MEROITIC HIEROGLYPHIC LETTER KHA;Lo;0;R;;;;;N;;;;;
+10992;MEROITIC HIEROGLYPHIC LETTER HHA;Lo;0;R;;;;;N;;;;;
+10993;MEROITIC HIEROGLYPHIC LETTER SA;Lo;0;R;;;;;N;;;;;
+10994;MEROITIC HIEROGLYPHIC LETTER SA-2;Lo;0;R;;;;;N;;;;;
+10995;MEROITIC HIEROGLYPHIC LETTER SE;Lo;0;R;;;;;N;;;;;
+10996;MEROITIC HIEROGLYPHIC LETTER KA;Lo;0;R;;;;;N;;;;;
+10997;MEROITIC HIEROGLYPHIC LETTER QA;Lo;0;R;;;;;N;;;;;
+10998;MEROITIC HIEROGLYPHIC LETTER TA;Lo;0;R;;;;;N;;;;;
+10999;MEROITIC HIEROGLYPHIC LETTER TA-2;Lo;0;R;;;;;N;;;;;
+1099A;MEROITIC HIEROGLYPHIC LETTER TE;Lo;0;R;;;;;N;;;;;
+1099B;MEROITIC HIEROGLYPHIC LETTER TE-2;Lo;0;R;;;;;N;;;;;
+1099C;MEROITIC HIEROGLYPHIC LETTER TO;Lo;0;R;;;;;N;;;;;
+1099D;MEROITIC HIEROGLYPHIC LETTER DA;Lo;0;R;;;;;N;;;;;
+1099E;MEROITIC HIEROGLYPHIC SYMBOL VIDJ;Lo;0;R;;;;;N;;;;;
+1099F;MEROITIC HIEROGLYPHIC SYMBOL VIDJ-2;Lo;0;R;;;;;N;;;;;
+109A0;MEROITIC CURSIVE LETTER A;Lo;0;R;;;;;N;;;;;
+109A1;MEROITIC CURSIVE LETTER E;Lo;0;R;;;;;N;;;;;
+109A2;MEROITIC CURSIVE LETTER I;Lo;0;R;;;;;N;;;;;
+109A3;MEROITIC CURSIVE LETTER O;Lo;0;R;;;;;N;;;;;
+109A4;MEROITIC CURSIVE LETTER YA;Lo;0;R;;;;;N;;;;;
+109A5;MEROITIC CURSIVE LETTER WA;Lo;0;R;;;;;N;;;;;
+109A6;MEROITIC CURSIVE LETTER BA;Lo;0;R;;;;;N;;;;;
+109A7;MEROITIC CURSIVE LETTER PA;Lo;0;R;;;;;N;;;;;
+109A8;MEROITIC CURSIVE LETTER MA;Lo;0;R;;;;;N;;;;;
+109A9;MEROITIC CURSIVE LETTER NA;Lo;0;R;;;;;N;;;;;
+109AA;MEROITIC CURSIVE LETTER NE;Lo;0;R;;;;;N;;;;;
+109AB;MEROITIC CURSIVE LETTER RA;Lo;0;R;;;;;N;;;;;
+109AC;MEROITIC CURSIVE LETTER LA;Lo;0;R;;;;;N;;;;;
+109AD;MEROITIC CURSIVE LETTER KHA;Lo;0;R;;;;;N;;;;;
+109AE;MEROITIC CURSIVE LETTER HHA;Lo;0;R;;;;;N;;;;;
+109AF;MEROITIC CURSIVE LETTER SA;Lo;0;R;;;;;N;;;;;
+109B0;MEROITIC CURSIVE LETTER ARCHAIC SA;Lo;0;R;;;;;N;;;;;
+109B1;MEROITIC CURSIVE LETTER SE;Lo;0;R;;;;;N;;;;;
+109B2;MEROITIC CURSIVE LETTER KA;Lo;0;R;;;;;N;;;;;
+109B3;MEROITIC CURSIVE LETTER QA;Lo;0;R;;;;;N;;;;;
+109B4;MEROITIC CURSIVE LETTER TA;Lo;0;R;;;;;N;;;;;
+109B5;MEROITIC CURSIVE LETTER TE;Lo;0;R;;;;;N;;;;;
+109B6;MEROITIC CURSIVE LETTER TO;Lo;0;R;;;;;N;;;;;
+109B7;MEROITIC CURSIVE LETTER DA;Lo;0;R;;;;;N;;;;;
+109BE;MEROITIC CURSIVE LOGOGRAM RMT;Lo;0;R;;;;;N;;;;;
+109BF;MEROITIC CURSIVE LOGOGRAM IMN;Lo;0;R;;;;;N;;;;;
 10A00;KHAROSHTHI LETTER A;Lo;0;R;;;;;N;;;;;
 10A01;KHAROSHTHI VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
 10A02;KHAROSHTHI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
@@ -17338,6 +17523,257 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 110BF;KAITHI DOUBLE SECTION MARK;Po;0;L;;;;;N;;;;;
 110C0;KAITHI DANDA;Po;0;L;;;;;N;;;;;
 110C1;KAITHI DOUBLE DANDA;Po;0;L;;;;;N;;;;;
+110D0;SORA SOMPENG LETTER SAH;Lo;0;L;;;;;N;;;;;
+110D1;SORA SOMPENG LETTER TAH;Lo;0;L;;;;;N;;;;;
+110D2;SORA SOMPENG LETTER BAH;Lo;0;L;;;;;N;;;;;
+110D3;SORA SOMPENG LETTER CAH;Lo;0;L;;;;;N;;;;;
+110D4;SORA SOMPENG LETTER DAH;Lo;0;L;;;;;N;;;;;
+110D5;SORA SOMPENG LETTER GAH;Lo;0;L;;;;;N;;;;;
+110D6;SORA SOMPENG LETTER MAH;Lo;0;L;;;;;N;;;;;
+110D7;SORA SOMPENG LETTER NGAH;Lo;0;L;;;;;N;;;;;
+110D8;SORA SOMPENG LETTER LAH;Lo;0;L;;;;;N;;;;;
+110D9;SORA SOMPENG LETTER NAH;Lo;0;L;;;;;N;;;;;
+110DA;SORA SOMPENG LETTER VAH;Lo;0;L;;;;;N;;;;;
+110DB;SORA SOMPENG LETTER PAH;Lo;0;L;;;;;N;;;;;
+110DC;SORA SOMPENG LETTER YAH;Lo;0;L;;;;;N;;;;;
+110DD;SORA SOMPENG LETTER RAH;Lo;0;L;;;;;N;;;;;
+110DE;SORA SOMPENG LETTER HAH;Lo;0;L;;;;;N;;;;;
+110DF;SORA SOMPENG LETTER KAH;Lo;0;L;;;;;N;;;;;
+110E0;SORA SOMPENG LETTER JAH;Lo;0;L;;;;;N;;;;;
+110E1;SORA SOMPENG LETTER NYAH;Lo;0;L;;;;;N;;;;;
+110E2;SORA SOMPENG LETTER AH;Lo;0;L;;;;;N;;;;;
+110E3;SORA SOMPENG LETTER EEH;Lo;0;L;;;;;N;;;;;
+110E4;SORA SOMPENG LETTER IH;Lo;0;L;;;;;N;;;;;
+110E5;SORA SOMPENG LETTER UH;Lo;0;L;;;;;N;;;;;
+110E6;SORA SOMPENG LETTER OH;Lo;0;L;;;;;N;;;;;
+110E7;SORA SOMPENG LETTER EH;Lo;0;L;;;;;N;;;;;
+110E8;SORA SOMPENG LETTER MAE;Lo;0;L;;;;;N;;;;;
+110F0;SORA SOMPENG DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+110F1;SORA SOMPENG DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+110F2;SORA SOMPENG DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+110F3;SORA SOMPENG DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+110F4;SORA SOMPENG DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+110F5;SORA SOMPENG DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+110F6;SORA SOMPENG DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+110F7;SORA SOMPENG DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+110F8;SORA SOMPENG DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+110F9;SORA SOMPENG DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+11100;CHAKMA SIGN CANDRABINDU;Mn;230;NSM;;;;;N;;;;;
+11101;CHAKMA SIGN ANUSVARA;Mn;230;NSM;;;;;N;;;;;
+11102;CHAKMA SIGN VISARGA;Mn;230;NSM;;;;;N;;;;;
+11103;CHAKMA LETTER AA;Lo;0;L;;;;;N;;;;;
+11104;CHAKMA LETTER I;Lo;0;L;;;;;N;;;;;
+11105;CHAKMA LETTER U;Lo;0;L;;;;;N;;;;;
+11106;CHAKMA LETTER E;Lo;0;L;;;;;N;;;;;
+11107;CHAKMA LETTER KAA;Lo;0;L;;;;;N;;;;;
+11108;CHAKMA LETTER KHAA;Lo;0;L;;;;;N;;;;;
+11109;CHAKMA LETTER GAA;Lo;0;L;;;;;N;;;;;
+1110A;CHAKMA LETTER GHAA;Lo;0;L;;;;;N;;;;;
+1110B;CHAKMA LETTER NGAA;Lo;0;L;;;;;N;;;;;
+1110C;CHAKMA LETTER CAA;Lo;0;L;;;;;N;;;;;
+1110D;CHAKMA LETTER CHAA;Lo;0;L;;;;;N;;;;;
+1110E;CHAKMA LETTER JAA;Lo;0;L;;;;;N;;;;;
+1110F;CHAKMA LETTER JHAA;Lo;0;L;;;;;N;;;;;
+11110;CHAKMA LETTER NYAA;Lo;0;L;;;;;N;;;;;
+11111;CHAKMA LETTER TTAA;Lo;0;L;;;;;N;;;;;
+11112;CHAKMA LETTER TTHAA;Lo;0;L;;;;;N;;;;;
+11113;CHAKMA LETTER DDAA;Lo;0;L;;;;;N;;;;;
+11114;CHAKMA LETTER DDHAA;Lo;0;L;;;;;N;;;;;
+11115;CHAKMA LETTER NNAA;Lo;0;L;;;;;N;;;;;
+11116;CHAKMA LETTER TAA;Lo;0;L;;;;;N;;;;;
+11117;CHAKMA LETTER THAA;Lo;0;L;;;;;N;;;;;
+11118;CHAKMA LETTER DAA;Lo;0;L;;;;;N;;;;;
+11119;CHAKMA LETTER DHAA;Lo;0;L;;;;;N;;;;;
+1111A;CHAKMA LETTER NAA;Lo;0;L;;;;;N;;;;;
+1111B;CHAKMA LETTER PAA;Lo;0;L;;;;;N;;;;;
+1111C;CHAKMA LETTER PHAA;Lo;0;L;;;;;N;;;;;
+1111D;CHAKMA LETTER BAA;Lo;0;L;;;;;N;;;;;
+1111E;CHAKMA LETTER BHAA;Lo;0;L;;;;;N;;;;;
+1111F;CHAKMA LETTER MAA;Lo;0;L;;;;;N;;;;;
+11120;CHAKMA LETTER YYAA;Lo;0;L;;;;;N;;;;;
+11121;CHAKMA LETTER YAA;Lo;0;L;;;;;N;;;;;
+11122;CHAKMA LETTER RAA;Lo;0;L;;;;;N;;;;;
+11123;CHAKMA LETTER LAA;Lo;0;L;;;;;N;;;;;
+11124;CHAKMA LETTER WAA;Lo;0;L;;;;;N;;;;;
+11125;CHAKMA LETTER SAA;Lo;0;L;;;;;N;;;;;
+11126;CHAKMA LETTER HAA;Lo;0;L;;;;;N;;;;;
+11127;CHAKMA VOWEL SIGN A;Mn;0;NSM;;;;;N;;;;;
+11128;CHAKMA VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
+11129;CHAKMA VOWEL SIGN II;Mn;0;NSM;;;;;N;;;;;
+1112A;CHAKMA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+1112B;CHAKMA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+1112C;CHAKMA VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+1112D;CHAKMA VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+1112E;CHAKMA VOWEL SIGN O;Mn;0;NSM;11131 11127;;;;N;;;;;
+1112F;CHAKMA VOWEL SIGN AU;Mn;0;NSM;11132 11127;;;;N;;;;;
+11130;CHAKMA VOWEL SIGN OI;Mn;0;NSM;;;;;N;;;;;
+11131;CHAKMA O MARK;Mn;0;NSM;;;;;N;;;;;
+11132;CHAKMA AU MARK;Mn;0;NSM;;;;;N;;;;;
+11133;CHAKMA VIRAMA;Mn;9;NSM;;;;;N;;;;;
+11134;CHAKMA MAAYYAA;Mn;9;NSM;;;;;N;;;;;
+11136;CHAKMA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+11137;CHAKMA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+11138;CHAKMA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+11139;CHAKMA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+1113A;CHAKMA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+1113B;CHAKMA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+1113C;CHAKMA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+1113D;CHAKMA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+1113E;CHAKMA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+1113F;CHAKMA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+11140;CHAKMA SECTION MARK;Po;0;L;;;;;N;;;;;
+11141;CHAKMA DANDA;Po;0;L;;;;;N;;;;;
+11142;CHAKMA DOUBLE DANDA;Po;0;L;;;;;N;;;;;
+11143;CHAKMA QUESTION MARK;Po;0;L;;;;;N;;;;;
+11180;SHARADA SIGN CANDRABINDU;Mn;0;NSM;;;;;N;;;;;
+11181;SHARADA SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+11182;SHARADA SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+11183;SHARADA LETTER A;Lo;0;L;;;;;N;;;;;
+11184;SHARADA LETTER AA;Lo;0;L;;;;;N;;;;;
+11185;SHARADA LETTER I;Lo;0;L;;;;;N;;;;;
+11186;SHARADA LETTER II;Lo;0;L;;;;;N;;;;;
+11187;SHARADA LETTER U;Lo;0;L;;;;;N;;;;;
+11188;SHARADA LETTER UU;Lo;0;L;;;;;N;;;;;
+11189;SHARADA LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+1118A;SHARADA LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+1118B;SHARADA LETTER VOCALIC L;Lo;0;L;;;;;N;;;;;
+1118C;SHARADA LETTER VOCALIC LL;Lo;0;L;;;;;N;;;;;
+1118D;SHARADA LETTER E;Lo;0;L;;;;;N;;;;;
+1118E;SHARADA LETTER AI;Lo;0;L;;;;;N;;;;;
+1118F;SHARADA LETTER O;Lo;0;L;;;;;N;;;;;
+11190;SHARADA LETTER AU;Lo;0;L;;;;;N;;;;;
+11191;SHARADA LETTER KA;Lo;0;L;;;;;N;;;;;
+11192;SHARADA LETTER KHA;Lo;0;L;;;;;N;;;;;
+11193;SHARADA LETTER GA;Lo;0;L;;;;;N;;;;;
+11194;SHARADA LETTER GHA;Lo;0;L;;;;;N;;;;;
+11195;SHARADA LETTER NGA;Lo;0;L;;;;;N;;;;;
+11196;SHARADA LETTER CA;Lo;0;L;;;;;N;;;;;
+11197;SHARADA LETTER CHA;Lo;0;L;;;;;N;;;;;
+11198;SHARADA LETTER JA;Lo;0;L;;;;;N;;;;;
+11199;SHARADA LETTER JHA;Lo;0;L;;;;;N;;;;;
+1119A;SHARADA LETTER NYA;Lo;0;L;;;;;N;;;;;
+1119B;SHARADA LETTER TTA;Lo;0;L;;;;;N;;;;;
+1119C;SHARADA LETTER TTHA;Lo;0;L;;;;;N;;;;;
+1119D;SHARADA LETTER DDA;Lo;0;L;;;;;N;;;;;
+1119E;SHARADA LETTER DDHA;Lo;0;L;;;;;N;;;;;
+1119F;SHARADA LETTER NNA;Lo;0;L;;;;;N;;;;;
+111A0;SHARADA LETTER TA;Lo;0;L;;;;;N;;;;;
+111A1;SHARADA LETTER THA;Lo;0;L;;;;;N;;;;;
+111A2;SHARADA LETTER DA;Lo;0;L;;;;;N;;;;;
+111A3;SHARADA LETTER DHA;Lo;0;L;;;;;N;;;;;
+111A4;SHARADA LETTER NA;Lo;0;L;;;;;N;;;;;
+111A5;SHARADA LETTER PA;Lo;0;L;;;;;N;;;;;
+111A6;SHARADA LETTER PHA;Lo;0;L;;;;;N;;;;;
+111A7;SHARADA LETTER BA;Lo;0;L;;;;;N;;;;;
+111A8;SHARADA LETTER BHA;Lo;0;L;;;;;N;;;;;
+111A9;SHARADA LETTER MA;Lo;0;L;;;;;N;;;;;
+111AA;SHARADA LETTER YA;Lo;0;L;;;;;N;;;;;
+111AB;SHARADA LETTER RA;Lo;0;L;;;;;N;;;;;
+111AC;SHARADA LETTER LA;Lo;0;L;;;;;N;;;;;
+111AD;SHARADA LETTER LLA;Lo;0;L;;;;;N;;;;;
+111AE;SHARADA LETTER VA;Lo;0;L;;;;;N;;;;;
+111AF;SHARADA LETTER SHA;Lo;0;L;;;;;N;;;;;
+111B0;SHARADA LETTER SSA;Lo;0;L;;;;;N;;;;;
+111B1;SHARADA LETTER SA;Lo;0;L;;;;;N;;;;;
+111B2;SHARADA LETTER HA;Lo;0;L;;;;;N;;;;;
+111B3;SHARADA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+111B4;SHARADA VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+111B5;SHARADA VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+111B6;SHARADA VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+111B7;SHARADA VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+111B8;SHARADA VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+111B9;SHARADA VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;;
+111BA;SHARADA VOWEL SIGN VOCALIC L;Mn;0;NSM;;;;;N;;;;;
+111BB;SHARADA VOWEL SIGN VOCALIC LL;Mn;0;NSM;;;;;N;;;;;
+111BC;SHARADA VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+111BD;SHARADA VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+111BE;SHARADA VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;;
+111BF;SHARADA VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+111C0;SHARADA SIGN VIRAMA;Mc;9;L;;;;;N;;;;;
+111C1;SHARADA SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
+111C2;SHARADA SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;;
+111C3;SHARADA SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;;
+111C4;SHARADA OM;Lo;0;L;;;;;N;;;;;
+111C5;SHARADA DANDA;Po;0;L;;;;;N;;;;;
+111C6;SHARADA DOUBLE DANDA;Po;0;L;;;;;N;;;;;
+111C7;SHARADA ABBREVIATION SIGN;Po;0;L;;;;;N;;;;;
+111C8;SHARADA SEPARATOR;Po;0;L;;;;;N;;;;;
+111D0;SHARADA DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+111D1;SHARADA DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+111D2;SHARADA DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+111D3;SHARADA DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+111D4;SHARADA DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+111D5;SHARADA DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+111D6;SHARADA DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+111D7;SHARADA DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+111D8;SHARADA DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+111D9;SHARADA DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+11680;TAKRI LETTER A;Lo;0;L;;;;;N;;;;;
+11681;TAKRI LETTER AA;Lo;0;L;;;;;N;;;;;
+11682;TAKRI LETTER I;Lo;0;L;;;;;N;;;;;
+11683;TAKRI LETTER II;Lo;0;L;;;;;N;;;;;
+11684;TAKRI LETTER U;Lo;0;L;;;;;N;;;;;
+11685;TAKRI LETTER UU;Lo;0;L;;;;;N;;;;;
+11686;TAKRI LETTER E;Lo;0;L;;;;;N;;;;;
+11687;TAKRI LETTER AI;Lo;0;L;;;;;N;;;;;
+11688;TAKRI LETTER O;Lo;0;L;;;;;N;;;;;
+11689;TAKRI LETTER AU;Lo;0;L;;;;;N;;;;;
+1168A;TAKRI LETTER KA;Lo;0;L;;;;;N;;;;;
+1168B;TAKRI LETTER KHA;Lo;0;L;;;;;N;;;;;
+1168C;TAKRI LETTER GA;Lo;0;L;;;;;N;;;;;
+1168D;TAKRI LETTER GHA;Lo;0;L;;;;;N;;;;;
+1168E;TAKRI LETTER NGA;Lo;0;L;;;;;N;;;;;
+1168F;TAKRI LETTER CA;Lo;0;L;;;;;N;;;;;
+11690;TAKRI LETTER CHA;Lo;0;L;;;;;N;;;;;
+11691;TAKRI LETTER JA;Lo;0;L;;;;;N;;;;;
+11692;TAKRI LETTER JHA;Lo;0;L;;;;;N;;;;;
+11693;TAKRI LETTER NYA;Lo;0;L;;;;;N;;;;;
+11694;TAKRI LETTER TTA;Lo;0;L;;;;;N;;;;;
+11695;TAKRI LETTER TTHA;Lo;0;L;;;;;N;;;;;
+11696;TAKRI LETTER DDA;Lo;0;L;;;;;N;;;;;
+11697;TAKRI LETTER DDHA;Lo;0;L;;;;;N;;;;;
+11698;TAKRI LETTER NNA;Lo;0;L;;;;;N;;;;;
+11699;TAKRI LETTER TA;Lo;0;L;;;;;N;;;;;
+1169A;TAKRI LETTER THA;Lo;0;L;;;;;N;;;;;
+1169B;TAKRI LETTER DA;Lo;0;L;;;;;N;;;;;
+1169C;TAKRI LETTER DHA;Lo;0;L;;;;;N;;;;;
+1169D;TAKRI LETTER NA;Lo;0;L;;;;;N;;;;;
+1169E;TAKRI LETTER PA;Lo;0;L;;;;;N;;;;;
+1169F;TAKRI LETTER PHA;Lo;0;L;;;;;N;;;;;
+116A0;TAKRI LETTER BA;Lo;0;L;;;;;N;;;;;
+116A1;TAKRI LETTER BHA;Lo;0;L;;;;;N;;;;;
+116A2;TAKRI LETTER MA;Lo;0;L;;;;;N;;;;;
+116A3;TAKRI LETTER YA;Lo;0;L;;;;;N;;;;;
+116A4;TAKRI LETTER RA;Lo;0;L;;;;;N;;;;;
+116A5;TAKRI LETTER LA;Lo;0;L;;;;;N;;;;;
+116A6;TAKRI LETTER VA;Lo;0;L;;;;;N;;;;;
+116A7;TAKRI LETTER SHA;Lo;0;L;;;;;N;;;;;
+116A8;TAKRI LETTER SA;Lo;0;L;;;;;N;;;;;
+116A9;TAKRI LETTER HA;Lo;0;L;;;;;N;;;;;
+116AA;TAKRI LETTER RRA;Lo;0;L;;;;;N;;;;;
+116AB;TAKRI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
+116AC;TAKRI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+116AD;TAKRI VOWEL SIGN AA;Mn;0;NSM;;;;;N;;;;;
+116AE;TAKRI VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+116AF;TAKRI VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+116B0;TAKRI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+116B1;TAKRI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+116B2;TAKRI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+116B3;TAKRI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+116B4;TAKRI VOWEL SIGN O;Mn;0;NSM;;;;;N;;;;;
+116B5;TAKRI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;;
+116B6;TAKRI SIGN VIRAMA;Mc;9;L;;;;;N;;;;;
+116B7;TAKRI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+116C0;TAKRI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+116C1;TAKRI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+116C2;TAKRI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+116C3;TAKRI DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+116C4;TAKRI DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+116C5;TAKRI DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+116C6;TAKRI DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+116C7;TAKRI DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+116C8;TAKRI DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+116C9;TAKRI DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
 12000;CUNEIFORM SIGN A;Lo;0;L;;;;;N;;;;;
 12001;CUNEIFORM SIGN A TIMES A;Lo;0;L;;;;;N;;;;;
 12002;CUNEIFORM SIGN A TIMES BAD;Lo;0;L;;;;;N;;;;;
@@ -19960,6 +20396,139 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 16A36;BAMUM LETTER PHASE-F KPA;Lo;0;L;;;;;N;;;;;
 16A37;BAMUM LETTER PHASE-F SAMBA;Lo;0;L;;;;;N;;;;;
 16A38;BAMUM LETTER PHASE-F VUEQ;Lo;0;L;;;;;N;;;;;
+16F00;MIAO LETTER PA;Lo;0;L;;;;;N;;;;;
+16F01;MIAO LETTER BA;Lo;0;L;;;;;N;;;;;
+16F02;MIAO LETTER YI PA;Lo;0;L;;;;;N;;;;;
+16F03;MIAO LETTER PLA;Lo;0;L;;;;;N;;;;;
+16F04;MIAO LETTER MA;Lo;0;L;;;;;N;;;;;
+16F05;MIAO LETTER MHA;Lo;0;L;;;;;N;;;;;
+16F06;MIAO LETTER ARCHAIC MA;Lo;0;L;;;;;N;;;;;
+16F07;MIAO LETTER FA;Lo;0;L;;;;;N;;;;;
+16F08;MIAO LETTER VA;Lo;0;L;;;;;N;;;;;
+16F09;MIAO LETTER VFA;Lo;0;L;;;;;N;;;;;
+16F0A;MIAO LETTER TA;Lo;0;L;;;;;N;;;;;
+16F0B;MIAO LETTER DA;Lo;0;L;;;;;N;;;;;
+16F0C;MIAO LETTER YI TTA;Lo;0;L;;;;;N;;;;;
+16F0D;MIAO LETTER YI TA;Lo;0;L;;;;;N;;;;;
+16F0E;MIAO LETTER TTA;Lo;0;L;;;;;N;;;;;
+16F0F;MIAO LETTER DDA;Lo;0;L;;;;;N;;;;;
+16F10;MIAO LETTER NA;Lo;0;L;;;;;N;;;;;
+16F11;MIAO LETTER NHA;Lo;0;L;;;;;N;;;;;
+16F12;MIAO LETTER YI NNA;Lo;0;L;;;;;N;;;;;
+16F13;MIAO LETTER ARCHAIC NA;Lo;0;L;;;;;N;;;;;
+16F14;MIAO LETTER NNA;Lo;0;L;;;;;N;;;;;
+16F15;MIAO LETTER NNHA;Lo;0;L;;;;;N;;;;;
+16F16;MIAO LETTER LA;Lo;0;L;;;;;N;;;;;
+16F17;MIAO LETTER LYA;Lo;0;L;;;;;N;;;;;
+16F18;MIAO LETTER LHA;Lo;0;L;;;;;N;;;;;
+16F19;MIAO LETTER LHYA;Lo;0;L;;;;;N;;;;;
+16F1A;MIAO LETTER TLHA;Lo;0;L;;;;;N;;;;;
+16F1B;MIAO LETTER DLHA;Lo;0;L;;;;;N;;;;;
+16F1C;MIAO LETTER TLHYA;Lo;0;L;;;;;N;;;;;
+16F1D;MIAO LETTER DLHYA;Lo;0;L;;;;;N;;;;;
+16F1E;MIAO LETTER KA;Lo;0;L;;;;;N;;;;;
+16F1F;MIAO LETTER GA;Lo;0;L;;;;;N;;;;;
+16F20;MIAO LETTER YI KA;Lo;0;L;;;;;N;;;;;
+16F21;MIAO LETTER QA;Lo;0;L;;;;;N;;;;;
+16F22;MIAO LETTER QGA;Lo;0;L;;;;;N;;;;;
+16F23;MIAO LETTER NGA;Lo;0;L;;;;;N;;;;;
+16F24;MIAO LETTER NGHA;Lo;0;L;;;;;N;;;;;
+16F25;MIAO LETTER ARCHAIC NGA;Lo;0;L;;;;;N;;;;;
+16F26;MIAO LETTER HA;Lo;0;L;;;;;N;;;;;
+16F27;MIAO LETTER XA;Lo;0;L;;;;;N;;;;;
+16F28;MIAO LETTER GHA;Lo;0;L;;;;;N;;;;;
+16F29;MIAO LETTER GHHA;Lo;0;L;;;;;N;;;;;
+16F2A;MIAO LETTER TSSA;Lo;0;L;;;;;N;;;;;
+16F2B;MIAO LETTER DZZA;Lo;0;L;;;;;N;;;;;
+16F2C;MIAO LETTER NYA;Lo;0;L;;;;;N;;;;;
+16F2D;MIAO LETTER NYHA;Lo;0;L;;;;;N;;;;;
+16F2E;MIAO LETTER TSHA;Lo;0;L;;;;;N;;;;;
+16F2F;MIAO LETTER DZHA;Lo;0;L;;;;;N;;;;;
+16F30;MIAO LETTER YI TSHA;Lo;0;L;;;;;N;;;;;
+16F31;MIAO LETTER YI DZHA;Lo;0;L;;;;;N;;;;;
+16F32;MIAO LETTER REFORMED TSHA;Lo;0;L;;;;;N;;;;;
+16F33;MIAO LETTER SHA;Lo;0;L;;;;;N;;;;;
+16F34;MIAO LETTER SSA;Lo;0;L;;;;;N;;;;;
+16F35;MIAO LETTER ZHA;Lo;0;L;;;;;N;;;;;
+16F36;MIAO LETTER ZSHA;Lo;0;L;;;;;N;;;;;
+16F37;MIAO LETTER TSA;Lo;0;L;;;;;N;;;;;
+16F38;MIAO LETTER DZA;Lo;0;L;;;;;N;;;;;
+16F39;MIAO LETTER YI TSA;Lo;0;L;;;;;N;;;;;
+16F3A;MIAO LETTER SA;Lo;0;L;;;;;N;;;;;
+16F3B;MIAO LETTER ZA;Lo;0;L;;;;;N;;;;;
+16F3C;MIAO LETTER ZSA;Lo;0;L;;;;;N;;;;;
+16F3D;MIAO LETTER ZZA;Lo;0;L;;;;;N;;;;;
+16F3E;MIAO LETTER ZZSA;Lo;0;L;;;;;N;;;;;
+16F3F;MIAO LETTER ARCHAIC ZZA;Lo;0;L;;;;;N;;;;;
+16F40;MIAO LETTER ZZYA;Lo;0;L;;;;;N;;;;;
+16F41;MIAO LETTER ZZSYA;Lo;0;L;;;;;N;;;;;
+16F42;MIAO LETTER WA;Lo;0;L;;;;;N;;;;;
+16F43;MIAO LETTER AH;Lo;0;L;;;;;N;;;;;
+16F44;MIAO LETTER HHA;Lo;0;L;;;;;N;;;;;
+16F50;MIAO LETTER NASALIZATION;Lo;0;L;;;;;N;;;;;
+16F51;MIAO SIGN ASPIRATION;Mc;0;L;;;;;N;;;;;
+16F52;MIAO SIGN REFORMED VOICING;Mc;0;L;;;;;N;;;;;
+16F53;MIAO SIGN REFORMED ASPIRATION;Mc;0;L;;;;;N;;;;;
+16F54;MIAO VOWEL SIGN A;Mc;0;L;;;;;N;;;;;
+16F55;MIAO VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+16F56;MIAO VOWEL SIGN AHH;Mc;0;L;;;;;N;;;;;
+16F57;MIAO VOWEL SIGN AN;Mc;0;L;;;;;N;;;;;
+16F58;MIAO VOWEL SIGN ANG;Mc;0;L;;;;;N;;;;;
+16F59;MIAO VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
+16F5A;MIAO VOWEL SIGN OO;Mc;0;L;;;;;N;;;;;
+16F5B;MIAO VOWEL SIGN WO;Mc;0;L;;;;;N;;;;;
+16F5C;MIAO VOWEL SIGN W;Mc;0;L;;;;;N;;;;;
+16F5D;MIAO VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
+16F5E;MIAO VOWEL SIGN EN;Mc;0;L;;;;;N;;;;;
+16F5F;MIAO VOWEL SIGN ENG;Mc;0;L;;;;;N;;;;;
+16F60;MIAO VOWEL SIGN OEY;Mc;0;L;;;;;N;;;;;
+16F61;MIAO VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+16F62;MIAO VOWEL SIGN IA;Mc;0;L;;;;;N;;;;;
+16F63;MIAO VOWEL SIGN IAN;Mc;0;L;;;;;N;;;;;
+16F64;MIAO VOWEL SIGN IANG;Mc;0;L;;;;;N;;;;;
+16F65;MIAO VOWEL SIGN IO;Mc;0;L;;;;;N;;;;;
+16F66;MIAO VOWEL SIGN IE;Mc;0;L;;;;;N;;;;;
+16F67;MIAO VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+16F68;MIAO VOWEL SIGN IU;Mc;0;L;;;;;N;;;;;
+16F69;MIAO VOWEL SIGN ING;Mc;0;L;;;;;N;;;;;
+16F6A;MIAO VOWEL SIGN U;Mc;0;L;;;;;N;;;;;
+16F6B;MIAO VOWEL SIGN UA;Mc;0;L;;;;;N;;;;;
+16F6C;MIAO VOWEL SIGN UAN;Mc;0;L;;;;;N;;;;;
+16F6D;MIAO VOWEL SIGN UANG;Mc;0;L;;;;;N;;;;;
+16F6E;MIAO VOWEL SIGN UU;Mc;0;L;;;;;N;;;;;
+16F6F;MIAO VOWEL SIGN UEI;Mc;0;L;;;;;N;;;;;
+16F70;MIAO VOWEL SIGN UNG;Mc;0;L;;;;;N;;;;;
+16F71;MIAO VOWEL SIGN Y;Mc;0;L;;;;;N;;;;;
+16F72;MIAO VOWEL SIGN YI;Mc;0;L;;;;;N;;;;;
+16F73;MIAO VOWEL SIGN AE;Mc;0;L;;;;;N;;;;;
+16F74;MIAO VOWEL SIGN AEE;Mc;0;L;;;;;N;;;;;
+16F75;MIAO VOWEL SIGN ERR;Mc;0;L;;;;;N;;;;;
+16F76;MIAO VOWEL SIGN ROUNDED ERR;Mc;0;L;;;;;N;;;;;
+16F77;MIAO VOWEL SIGN ER;Mc;0;L;;;;;N;;;;;
+16F78;MIAO VOWEL SIGN ROUNDED ER;Mc;0;L;;;;;N;;;;;
+16F79;MIAO VOWEL SIGN AI;Mc;0;L;;;;;N;;;;;
+16F7A;MIAO VOWEL SIGN EI;Mc;0;L;;;;;N;;;;;
+16F7B;MIAO VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+16F7C;MIAO VOWEL SIGN OU;Mc;0;L;;;;;N;;;;;
+16F7D;MIAO VOWEL SIGN N;Mc;0;L;;;;;N;;;;;
+16F7E;MIAO VOWEL SIGN NG;Mc;0;L;;;;;N;;;;;
+16F8F;MIAO TONE RIGHT;Mn;0;NSM;;;;;N;;;;;
+16F90;MIAO TONE TOP RIGHT;Mn;0;NSM;;;;;N;;;;;
+16F91;MIAO TONE ABOVE;Mn;0;NSM;;;;;N;;;;;
+16F92;MIAO TONE BELOW;Mn;0;NSM;;;;;N;;;;;
+16F93;MIAO LETTER TONE-2;Lm;0;L;;;;;N;;;;;
+16F94;MIAO LETTER TONE-3;Lm;0;L;;;;;N;;;;;
+16F95;MIAO LETTER TONE-4;Lm;0;L;;;;;N;;;;;
+16F96;MIAO LETTER TONE-5;Lm;0;L;;;;;N;;;;;
+16F97;MIAO LETTER TONE-6;Lm;0;L;;;;;N;;;;;
+16F98;MIAO LETTER TONE-7;Lm;0;L;;;;;N;;;;;
+16F99;MIAO LETTER TONE-8;Lm;0;L;;;;;N;;;;;
+16F9A;MIAO LETTER REFORMED TONE-1;Lm;0;L;;;;;N;;;;;
+16F9B;MIAO LETTER REFORMED TONE-2;Lm;0;L;;;;;N;;;;;
+16F9C;MIAO LETTER REFORMED TONE-4;Lm;0;L;;;;;N;;;;;
+16F9D;MIAO LETTER REFORMED TONE-5;Lm;0;L;;;;;N;;;;;
+16F9E;MIAO LETTER REFORMED TONE-6;Lm;0;L;;;;;N;;;;;
+16F9F;MIAO LETTER REFORMED TONE-8;Lm;0;L;;;;;N;;;;;
 1B000;KATAKANA LETTER ARCHAIC E;Lo;0;L;;;;;N;;;;;
 1B001;HIRAGANA LETTER ARCHAIC YE;Lo;0;L;;;;;N;;;;;
 1D000;BYZANTINE MUSICAL SYMBOL PSILI;So;0;L;;;;;N;;;;;
@@ -21599,6 +22168,149 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1D7FD;MATHEMATICAL MONOSPACE DIGIT SEVEN;Nd;0;EN;<font> 0037;7;7;7;N;;;;;
 1D7FE;MATHEMATICAL MONOSPACE DIGIT EIGHT;Nd;0;EN;<font> 0038;8;8;8;N;;;;;
 1D7FF;MATHEMATICAL MONOSPACE DIGIT NINE;Nd;0;EN;<font> 0039;9;9;9;N;;;;;
+1EE00;ARABIC MATHEMATICAL ALEF;Lo;0;AL;<font> 0627;;;;N;;;;;
+1EE01;ARABIC MATHEMATICAL BEH;Lo;0;AL;<font> 0628;;;;N;;;;;
+1EE02;ARABIC MATHEMATICAL JEEM;Lo;0;AL;<font> 062C;;;;N;;;;;
+1EE03;ARABIC MATHEMATICAL DAL;Lo;0;AL;<font> 062F;;;;N;;;;;
+1EE05;ARABIC MATHEMATICAL WAW;Lo;0;AL;<font> 0648;;;;N;;;;;
+1EE06;ARABIC MATHEMATICAL ZAIN;Lo;0;AL;<font> 0632;;;;N;;;;;
+1EE07;ARABIC MATHEMATICAL HAH;Lo;0;AL;<font> 062D;;;;N;;;;;
+1EE08;ARABIC MATHEMATICAL TAH;Lo;0;AL;<font> 0637;;;;N;;;;;
+1EE09;ARABIC MATHEMATICAL YEH;Lo;0;AL;<font> 064A;;;;N;;;;;
+1EE0A;ARABIC MATHEMATICAL KAF;Lo;0;AL;<font> 0643;;;;N;;;;;
+1EE0B;ARABIC MATHEMATICAL LAM;Lo;0;AL;<font> 0644;;;;N;;;;;
+1EE0C;ARABIC MATHEMATICAL MEEM;Lo;0;AL;<font> 0645;;;;N;;;;;
+1EE0D;ARABIC MATHEMATICAL NOON;Lo;0;AL;<font> 0646;;;;N;;;;;
+1EE0E;ARABIC MATHEMATICAL SEEN;Lo;0;AL;<font> 0633;;;;N;;;;;
+1EE0F;ARABIC MATHEMATICAL AIN;Lo;0;AL;<font> 0639;;;;N;;;;;
+1EE10;ARABIC MATHEMATICAL FEH;Lo;0;AL;<font> 0641;;;;N;;;;;
+1EE11;ARABIC MATHEMATICAL SAD;Lo;0;AL;<font> 0635;;;;N;;;;;
+1EE12;ARABIC MATHEMATICAL QAF;Lo;0;AL;<font> 0642;;;;N;;;;;
+1EE13;ARABIC MATHEMATICAL REH;Lo;0;AL;<font> 0631;;;;N;;;;;
+1EE14;ARABIC MATHEMATICAL SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;;
+1EE15;ARABIC MATHEMATICAL TEH;Lo;0;AL;<font> 062A;;;;N;;;;;
+1EE16;ARABIC MATHEMATICAL THEH;Lo;0;AL;<font> 062B;;;;N;;;;;
+1EE17;ARABIC MATHEMATICAL KHAH;Lo;0;AL;<font> 062E;;;;N;;;;;
+1EE18;ARABIC MATHEMATICAL THAL;Lo;0;AL;<font> 0630;;;;N;;;;;
+1EE19;ARABIC MATHEMATICAL DAD;Lo;0;AL;<font> 0636;;;;N;;;;;
+1EE1A;ARABIC MATHEMATICAL ZAH;Lo;0;AL;<font> 0638;;;;N;;;;;
+1EE1B;ARABIC MATHEMATICAL GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;;
+1EE1C;ARABIC MATHEMATICAL DOTLESS BEH;Lo;0;AL;<font> 066E;;;;N;;;;;
+1EE1D;ARABIC MATHEMATICAL DOTLESS NOON;Lo;0;AL;<font> 06BA;;;;N;;;;;
+1EE1E;ARABIC MATHEMATICAL DOTLESS FEH;Lo;0;AL;<font> 06A1;;;;N;;;;;
+1EE1F;ARABIC MATHEMATICAL DOTLESS QAF;Lo;0;AL;<font> 066F;;;;N;;;;;
+1EE21;ARABIC MATHEMATICAL INITIAL BEH;Lo;0;AL;<font> 0628;;;;N;;;;;
+1EE22;ARABIC MATHEMATICAL INITIAL JEEM;Lo;0;AL;<font> 062C;;;;N;;;;;
+1EE24;ARABIC MATHEMATICAL INITIAL HEH;Lo;0;AL;<font> 0647;;;;N;;;;;
+1EE27;ARABIC MATHEMATICAL INITIAL HAH;Lo;0;AL;<font> 062D;;;;N;;;;;
+1EE29;ARABIC MATHEMATICAL INITIAL YEH;Lo;0;AL;<font> 064A;;;;N;;;;;
+1EE2A;ARABIC MATHEMATICAL INITIAL KAF;Lo;0;AL;<font> 0643;;;;N;;;;;
+1EE2B;ARABIC MATHEMATICAL INITIAL LAM;Lo;0;AL;<font> 0644;;;;N;;;;;
+1EE2C;ARABIC MATHEMATICAL INITIAL MEEM;Lo;0;AL;<font> 0645;;;;N;;;;;
+1EE2D;ARABIC MATHEMATICAL INITIAL NOON;Lo;0;AL;<font> 0646;;;;N;;;;;
+1EE2E;ARABIC MATHEMATICAL INITIAL SEEN;Lo;0;AL;<font> 0633;;;;N;;;;;
+1EE2F;ARABIC MATHEMATICAL INITIAL AIN;Lo;0;AL;<font> 0639;;;;N;;;;;
+1EE30;ARABIC MATHEMATICAL INITIAL FEH;Lo;0;AL;<font> 0641;;;;N;;;;;
+1EE31;ARABIC MATHEMATICAL INITIAL SAD;Lo;0;AL;<font> 0635;;;;N;;;;;
+1EE32;ARABIC MATHEMATICAL INITIAL QAF;Lo;0;AL;<font> 0642;;;;N;;;;;
+1EE34;ARABIC MATHEMATICAL INITIAL SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;;
+1EE35;ARABIC MATHEMATICAL INITIAL TEH;Lo;0;AL;<font> 062A;;;;N;;;;;
+1EE36;ARABIC MATHEMATICAL INITIAL THEH;Lo;0;AL;<font> 062B;;;;N;;;;;
+1EE37;ARABIC MATHEMATICAL INITIAL KHAH;Lo;0;AL;<font> 062E;;;;N;;;;;
+1EE39;ARABIC MATHEMATICAL INITIAL DAD;Lo;0;AL;<font> 0636;;;;N;;;;;
+1EE3B;ARABIC MATHEMATICAL INITIAL GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;;
+1EE42;ARABIC MATHEMATICAL TAILED JEEM;Lo;0;AL;<font> 062C;;;;N;;;;;
+1EE47;ARABIC MATHEMATICAL TAILED HAH;Lo;0;AL;<font> 062D;;;;N;;;;;
+1EE49;ARABIC MATHEMATICAL TAILED YEH;Lo;0;AL;<font> 064A;;;;N;;;;;
+1EE4B;ARABIC MATHEMATICAL TAILED LAM;Lo;0;AL;<font> 0644;;;;N;;;;;
+1EE4D;ARABIC MATHEMATICAL TAILED NOON;Lo;0;AL;<font> 0646;;;;N;;;;;
+1EE4E;ARABIC MATHEMATICAL TAILED SEEN;Lo;0;AL;<font> 0633;;;;N;;;;;
+1EE4F;ARABIC MATHEMATICAL TAILED AIN;Lo;0;AL;<font> 0639;;;;N;;;;;
+1EE51;ARABIC MATHEMATICAL TAILED SAD;Lo;0;AL;<font> 0635;;;;N;;;;;
+1EE52;ARABIC MATHEMATICAL TAILED QAF;Lo;0;AL;<font> 0642;;;;N;;;;;
+1EE54;ARABIC MATHEMATICAL TAILED SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;;
+1EE57;ARABIC MATHEMATICAL TAILED KHAH;Lo;0;AL;<font> 062E;;;;N;;;;;
+1EE59;ARABIC MATHEMATICAL TAILED DAD;Lo;0;AL;<font> 0636;;;;N;;;;;
+1EE5B;ARABIC MATHEMATICAL TAILED GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;;
+1EE5D;ARABIC MATHEMATICAL TAILED DOTLESS NOON;Lo;0;AL;<font> 06BA;;;;N;;;;;
+1EE5F;ARABIC MATHEMATICAL TAILED DOTLESS QAF;Lo;0;AL;<font> 066F;;;;N;;;;;
+1EE61;ARABIC MATHEMATICAL STRETCHED BEH;Lo;0;AL;<font> 0628;;;;N;;;;;
+1EE62;ARABIC MATHEMATICAL STRETCHED JEEM;Lo;0;AL;<font> 062C;;;;N;;;;;
+1EE64;ARABIC MATHEMATICAL STRETCHED HEH;Lo;0;AL;<font> 0647;;;;N;;;;;
+1EE67;ARABIC MATHEMATICAL STRETCHED HAH;Lo;0;AL;<font> 062D;;;;N;;;;;
+1EE68;ARABIC MATHEMATICAL STRETCHED TAH;Lo;0;AL;<font> 0637;;;;N;;;;;
+1EE69;ARABIC MATHEMATICAL STRETCHED YEH;Lo;0;AL;<font> 064A;;;;N;;;;;
+1EE6A;ARABIC MATHEMATICAL STRETCHED KAF;Lo;0;AL;<font> 0643;;;;N;;;;;
+1EE6C;ARABIC MATHEMATICAL STRETCHED MEEM;Lo;0;AL;<font> 0645;;;;N;;;;;
+1EE6D;ARABIC MATHEMATICAL STRETCHED NOON;Lo;0;AL;<font> 0646;;;;N;;;;;
+1EE6E;ARABIC MATHEMATICAL STRETCHED SEEN;Lo;0;AL;<font> 0633;;;;N;;;;;
+1EE6F;ARABIC MATHEMATICAL STRETCHED AIN;Lo;0;AL;<font> 0639;;;;N;;;;;
+1EE70;ARABIC MATHEMATICAL STRETCHED FEH;Lo;0;AL;<font> 0641;;;;N;;;;;
+1EE71;ARABIC MATHEMATICAL STRETCHED SAD;Lo;0;AL;<font> 0635;;;;N;;;;;
+1EE72;ARABIC MATHEMATICAL STRETCHED QAF;Lo;0;AL;<font> 0642;;;;N;;;;;
+1EE74;ARABIC MATHEMATICAL STRETCHED SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;;
+1EE75;ARABIC MATHEMATICAL STRETCHED TEH;Lo;0;AL;<font> 062A;;;;N;;;;;
+1EE76;ARABIC MATHEMATICAL STRETCHED THEH;Lo;0;AL;<font> 062B;;;;N;;;;;
+1EE77;ARABIC MATHEMATICAL STRETCHED KHAH;Lo;0;AL;<font> 062E;;;;N;;;;;
+1EE79;ARABIC MATHEMATICAL STRETCHED DAD;Lo;0;AL;<font> 0636;;;;N;;;;;
+1EE7A;ARABIC MATHEMATICAL STRETCHED ZAH;Lo;0;AL;<font> 0638;;;;N;;;;;
+1EE7B;ARABIC MATHEMATICAL STRETCHED GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;;
+1EE7C;ARABIC MATHEMATICAL STRETCHED DOTLESS BEH;Lo;0;AL;<font> 066E;;;;N;;;;;
+1EE7E;ARABIC MATHEMATICAL STRETCHED DOTLESS FEH;Lo;0;AL;<font> 06A1;;;;N;;;;;
+1EE80;ARABIC MATHEMATICAL LOOPED ALEF;Lo;0;AL;<font> 0627;;;;N;;;;;
+1EE81;ARABIC MATHEMATICAL LOOPED BEH;Lo;0;AL;<font> 0628;;;;N;;;;;
+1EE82;ARABIC MATHEMATICAL LOOPED JEEM;Lo;0;AL;<font> 062C;;;;N;;;;;
+1EE83;ARABIC MATHEMATICAL LOOPED DAL;Lo;0;AL;<font> 062F;;;;N;;;;;
+1EE84;ARABIC MATHEMATICAL LOOPED HEH;Lo;0;AL;<font> 0647;;;;N;;;;;
+1EE85;ARABIC MATHEMATICAL LOOPED WAW;Lo;0;AL;<font> 0648;;;;N;;;;;
+1EE86;ARABIC MATHEMATICAL LOOPED ZAIN;Lo;0;AL;<font> 0632;;;;N;;;;;
+1EE87;ARABIC MATHEMATICAL LOOPED HAH;Lo;0;AL;<font> 062D;;;;N;;;;;
+1EE88;ARABIC MATHEMATICAL LOOPED TAH;Lo;0;AL;<font> 0637;;;;N;;;;;
+1EE89;ARABIC MATHEMATICAL LOOPED YEH;Lo;0;AL;<font> 064A;;;;N;;;;;
+1EE8B;ARABIC MATHEMATICAL LOOPED LAM;Lo;0;AL;<font> 0644;;;;N;;;;;
+1EE8C;ARABIC MATHEMATICAL LOOPED MEEM;Lo;0;AL;<font> 0645;;;;N;;;;;
+1EE8D;ARABIC MATHEMATICAL LOOPED NOON;Lo;0;AL;<font> 0646;;;;N;;;;;
+1EE8E;ARABIC MATHEMATICAL LOOPED SEEN;Lo;0;AL;<font> 0633;;;;N;;;;;
+1EE8F;ARABIC MATHEMATICAL LOOPED AIN;Lo;0;AL;<font> 0639;;;;N;;;;;
+1EE90;ARABIC MATHEMATICAL LOOPED FEH;Lo;0;AL;<font> 0641;;;;N;;;;;
+1EE91;ARABIC MATHEMATICAL LOOPED SAD;Lo;0;AL;<font> 0635;;;;N;;;;;
+1EE92;ARABIC MATHEMATICAL LOOPED QAF;Lo;0;AL;<font> 0642;;;;N;;;;;
+1EE93;ARABIC MATHEMATICAL LOOPED REH;Lo;0;AL;<font> 0631;;;;N;;;;;
+1EE94;ARABIC MATHEMATICAL LOOPED SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;;
+1EE95;ARABIC MATHEMATICAL LOOPED TEH;Lo;0;AL;<font> 062A;;;;N;;;;;
+1EE96;ARABIC MATHEMATICAL LOOPED THEH;Lo;0;AL;<font> 062B;;;;N;;;;;
+1EE97;ARABIC MATHEMATICAL LOOPED KHAH;Lo;0;AL;<font> 062E;;;;N;;;;;
+1EE98;ARABIC MATHEMATICAL LOOPED THAL;Lo;0;AL;<font> 0630;;;;N;;;;;
+1EE99;ARABIC MATHEMATICAL LOOPED DAD;Lo;0;AL;<font> 0636;;;;N;;;;;
+1EE9A;ARABIC MATHEMATICAL LOOPED ZAH;Lo;0;AL;<font> 0638;;;;N;;;;;
+1EE9B;ARABIC MATHEMATICAL LOOPED GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;;
+1EEA1;ARABIC MATHEMATICAL DOUBLE-STRUCK BEH;Lo;0;AL;<font> 0628;;;;N;;;;;
+1EEA2;ARABIC MATHEMATICAL DOUBLE-STRUCK JEEM;Lo;0;AL;<font> 062C;;;;N;;;;;
+1EEA3;ARABIC MATHEMATICAL DOUBLE-STRUCK DAL;Lo;0;AL;<font> 062F;;;;N;;;;;
+1EEA5;ARABIC MATHEMATICAL DOUBLE-STRUCK WAW;Lo;0;AL;<font> 0648;;;;N;;;;;
+1EEA6;ARABIC MATHEMATICAL DOUBLE-STRUCK ZAIN;Lo;0;AL;<font> 0632;;;;N;;;;;
+1EEA7;ARABIC MATHEMATICAL DOUBLE-STRUCK HAH;Lo;0;AL;<font> 062D;;;;N;;;;;
+1EEA8;ARABIC MATHEMATICAL DOUBLE-STRUCK TAH;Lo;0;AL;<font> 0637;;;;N;;;;;
+1EEA9;ARABIC MATHEMATICAL DOUBLE-STRUCK YEH;Lo;0;AL;<font> 064A;;;;N;;;;;
+1EEAB;ARABIC MATHEMATICAL DOUBLE-STRUCK LAM;Lo;0;AL;<font> 0644;;;;N;;;;;
+1EEAC;ARABIC MATHEMATICAL DOUBLE-STRUCK MEEM;Lo;0;AL;<font> 0645;;;;N;;;;;
+1EEAD;ARABIC MATHEMATICAL DOUBLE-STRUCK NOON;Lo;0;AL;<font> 0646;;;;N;;;;;
+1EEAE;ARABIC MATHEMATICAL DOUBLE-STRUCK SEEN;Lo;0;AL;<font> 0633;;;;N;;;;;
+1EEAF;ARABIC MATHEMATICAL DOUBLE-STRUCK AIN;Lo;0;AL;<font> 0639;;;;N;;;;;
+1EEB0;ARABIC MATHEMATICAL DOUBLE-STRUCK FEH;Lo;0;AL;<font> 0641;;;;N;;;;;
+1EEB1;ARABIC MATHEMATICAL DOUBLE-STRUCK SAD;Lo;0;AL;<font> 0635;;;;N;;;;;
+1EEB2;ARABIC MATHEMATICAL DOUBLE-STRUCK QAF;Lo;0;AL;<font> 0642;;;;N;;;;;
+1EEB3;ARABIC MATHEMATICAL DOUBLE-STRUCK REH;Lo;0;AL;<font> 0631;;;;N;;;;;
+1EEB4;ARABIC MATHEMATICAL DOUBLE-STRUCK SHEEN;Lo;0;AL;<font> 0634;;;;N;;;;;
+1EEB5;ARABIC MATHEMATICAL DOUBLE-STRUCK TEH;Lo;0;AL;<font> 062A;;;;N;;;;;
+1EEB6;ARABIC MATHEMATICAL DOUBLE-STRUCK THEH;Lo;0;AL;<font> 062B;;;;N;;;;;
+1EEB7;ARABIC MATHEMATICAL DOUBLE-STRUCK KHAH;Lo;0;AL;<font> 062E;;;;N;;;;;
+1EEB8;ARABIC MATHEMATICAL DOUBLE-STRUCK THAL;Lo;0;AL;<font> 0630;;;;N;;;;;
+1EEB9;ARABIC MATHEMATICAL DOUBLE-STRUCK DAD;Lo;0;AL;<font> 0636;;;;N;;;;;
+1EEBA;ARABIC MATHEMATICAL DOUBLE-STRUCK ZAH;Lo;0;AL;<font> 0638;;;;N;;;;;
+1EEBB;ARABIC MATHEMATICAL DOUBLE-STRUCK GHAIN;Lo;0;AL;<font> 063A;;;;N;;;;;
+1EEF0;ARABIC MATHEMATICAL OPERATOR MEEM WITH HAH WITH TATWEEL;Sm;0;ON;;;;;N;;;;;
+1EEF1;ARABIC MATHEMATICAL OPERATOR HAH WITH DAL;Sm;0;ON;;;;;N;;;;;
 1F000;MAHJONG TILE EAST WIND;So;0;ON;;;;;N;;;;;
 1F001;MAHJONG TILE SOUTH WIND;So;0;ON;;;;;N;;;;;
 1F002;MAHJONG TILE WEST WIND;So;0;ON;;;;;N;;;;;
@@ -21902,6 +22614,8 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F167;NEGATIVE CIRCLED LATIN CAPITAL LETTER X;So;0;L;;;;;N;;;;;
 1F168;NEGATIVE CIRCLED LATIN CAPITAL LETTER Y;So;0;L;;;;;N;;;;;
 1F169;NEGATIVE CIRCLED LATIN CAPITAL LETTER Z;So;0;L;;;;;N;;;;;
+1F16A;RAISED MC SIGN;So;0;ON;<super> 004D 0043;;;;N;;;;;
+1F16B;RAISED MD SIGN;So;0;ON;<super> 004D 0044;;;;N;;;;;
 1F170;NEGATIVE SQUARED LATIN CAPITAL LETTER A;So;0;L;;;;;N;;;;;
 1F171;NEGATIVE SQUARED LATIN CAPITAL LETTER B;So;0;L;;;;;N;;;;;
 1F172;NEGATIVE SQUARED LATIN CAPITAL LETTER C;So;0;L;;;;;N;;;;;
@@ -22354,7 +23068,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F489;SYRINGE;So;0;ON;;;;;N;;;;;
 1F48A;PILL;So;0;ON;;;;;N;;;;;
 1F48B;KISS MARK;So;0;ON;;;;;N;;;;;
-1F48C;LOVE LETTER;So;0;L;;;;;N;;;;;
+1F48C;LOVE LETTER;So;0;ON;;;;;N;;;;;
 1F48D;RING;So;0;ON;;;;;N;;;;;
 1F48E;GEM STONE;So;0;ON;;;;;N;;;;;
 1F48F;KISS;So;0;ON;;;;;N;;;;;
@@ -22502,7 +23216,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F521;INPUT SYMBOL FOR LATIN SMALL LETTERS;So;0;ON;;;;;N;;;;;
 1F522;INPUT SYMBOL FOR NUMBERS;So;0;ON;;;;;N;;;;;
 1F523;INPUT SYMBOL FOR SYMBOLS;So;0;ON;;;;;N;;;;;
-1F524;INPUT SYMBOL FOR LATIN LETTERS;So;0;L;;;;;N;;;;;
+1F524;INPUT SYMBOL FOR LATIN LETTERS;So;0;ON;;;;;N;;;;;
 1F525;FIRE;So;0;ON;;;;;N;;;;;
 1F526;ELECTRIC TORCH;So;0;ON;;;;;N;;;;;
 1F527;WRENCH;So;0;ON;;;;;N;;;;;
@@ -22528,6 +23242,10 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F53B;DOWN-POINTING RED TRIANGLE;So;0;ON;;;;;N;;;;;
 1F53C;UP-POINTING SMALL RED TRIANGLE;So;0;ON;;;;;N;;;;;
 1F53D;DOWN-POINTING SMALL RED TRIANGLE;So;0;ON;;;;;N;;;;;
+1F540;CIRCLED CROSS POMMEE;So;0;ON;;;;;N;;;;;
+1F541;CROSS POMMEE WITH HALF-CIRCLE BELOW;So;0;ON;;;;;N;;;;;
+1F542;CROSS POMMEE;So;0;ON;;;;;N;;;;;
+1F543;NOTCHED LEFT SEMICIRCLE WITH THREE DOTS;So;0;ON;;;;;N;;;;;
 1F550;CLOCK FACE ONE OCLOCK;So;0;ON;;;;;N;;;;;
 1F551;CLOCK FACE TWO OCLOCK;So;0;ON;;;;;N;;;;;
 1F552;CLOCK FACE THREE OCLOCK;So;0;ON;;;;;N;;;;;
@@ -22557,6 +23275,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F5FD;STATUE OF LIBERTY;So;0;ON;;;;;N;;;;;
 1F5FE;SILHOUETTE OF JAPAN;So;0;ON;;;;;N;;;;;
 1F5FF;MOYAI;So;0;ON;;;;;N;;;;;
+1F600;GRINNING FACE;So;0;ON;;;;;N;;;;;
 1F601;GRINNING FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;;
 1F602;FACE WITH TEARS OF JOY;So;0;ON;;;;;N;;;;;
 1F603;SMILING FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;;
@@ -22573,30 +23292,42 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F60E;SMILING FACE WITH SUNGLASSES;So;0;ON;;;;;N;;;;;
 1F60F;SMIRKING FACE;So;0;ON;;;;;N;;;;;
 1F610;NEUTRAL FACE;So;0;ON;;;;;N;;;;;
+1F611;EXPRESSIONLESS FACE;So;0;ON;;;;;N;;;;;
 1F612;UNAMUSED FACE;So;0;ON;;;;;N;;;;;
 1F613;FACE WITH COLD SWEAT;So;0;ON;;;;;N;;;;;
 1F614;PENSIVE FACE;So;0;ON;;;;;N;;;;;
+1F615;CONFUSED FACE;So;0;ON;;;;;N;;;;;
 1F616;CONFOUNDED FACE;So;0;ON;;;;;N;;;;;
+1F617;KISSING FACE;So;0;ON;;;;;N;;;;;
 1F618;FACE THROWING A KISS;So;0;ON;;;;;N;;;;;
+1F619;KISSING FACE WITH SMILING EYES;So;0;ON;;;;;N;;;;;
 1F61A;KISSING FACE WITH CLOSED EYES;So;0;ON;;;;;N;;;;;
+1F61B;FACE WITH STUCK-OUT TONGUE;So;0;ON;;;;;N;;;;;
 1F61C;FACE WITH STUCK-OUT TONGUE AND WINKING EYE;So;0;ON;;;;;N;;;;;
 1F61D;FACE WITH STUCK-OUT TONGUE AND TIGHTLY-CLOSED EYES;So;0;ON;;;;;N;;;;;
 1F61E;DISAPPOINTED FACE;So;0;ON;;;;;N;;;;;
+1F61F;WORRIED FACE;So;0;ON;;;;;N;;;;;
 1F620;ANGRY FACE;So;0;ON;;;;;N;;;;;
 1F621;POUTING FACE;So;0;ON;;;;;N;;;;;
 1F622;CRYING FACE;So;0;ON;;;;;N;;;;;
 1F623;PERSEVERING FACE;So;0;ON;;;;;N;;;;;
 1F624;FACE WITH LOOK OF TRIUMPH;So;0;ON;;;;;N;;;;;
 1F625;DISAPPOINTED BUT RELIEVED FACE;So;0;ON;;;;;N;;;;;
+1F626;FROWNING FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;;
+1F627;ANGUISHED FACE;So;0;ON;;;;;N;;;;;
 1F628;FEARFUL FACE;So;0;ON;;;;;N;;;;;
 1F629;WEARY FACE;So;0;ON;;;;;N;;;;;
 1F62A;SLEEPY FACE;So;0;ON;;;;;N;;;;;
 1F62B;TIRED FACE;So;0;ON;;;;;N;;;;;
+1F62C;GRIMACING FACE;So;0;ON;;;;;N;;;;;
 1F62D;LOUDLY CRYING FACE;So;0;ON;;;;;N;;;;;
+1F62E;FACE WITH OPEN MOUTH;So;0;ON;;;;;N;;;;;
+1F62F;HUSHED FACE;So;0;ON;;;;;N;;;;;
 1F630;FACE WITH OPEN MOUTH AND COLD SWEAT;So;0;ON;;;;;N;;;;;
 1F631;FACE SCREAMING IN FEAR;So;0;ON;;;;;N;;;;;
 1F632;ASTONISHED FACE;So;0;ON;;;;;N;;;;;
 1F633;FLUSHED FACE;So;0;ON;;;;;N;;;;;
+1F634;SLEEPING FACE;So;0;ON;;;;;N;;;;;
 1F635;DIZZY FACE;So;0;ON;;;;;N;;;;;
 1F636;FACE WITHOUT MOUTH;So;0;ON;;;;;N;;;;;
 1F637;FACE WITH MEDICAL MASK;So;0;ON;;;;;N;;;;;
index f414ca461f26ddfee1d327f8e4c66ce3dd30ac0f..90cd895d9848230ccc4c313fc127cf233db75a52 100644 (file)
@@ -10,7 +10,7 @@
 
 <meta name="VI60_defaultClientScript" content="JavaScript">
 
-<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
+<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
 
 <meta name="keywords" content="Unicode Standard, copyright">
 
@@ -28,10 +28,6 @@ href="http://www.unicode.org/webscripts/standard_styles.css">
 
 <body text="#330000">
 
-
-
-<form action="http://www.unicode.org/webscripts/POST">
-
   <table width="100%" cellpadding="0" cellspacing="0" border="0">
 
     <tr>
@@ -79,7 +75,7 @@ href="http://www.unicode.org/webscripts/standard_styles.css">
           <td valign="top" class="navColCell"><a href="#4">Waiver of Damages</a></td>
         </tr>
         <tr>
-          <td valign="top" class="navColCell"><a href="#5">Trademarks</a></td>
+          <td valign="top" class="navColCell"><a href="#5">Trademarks & Logos</a></td>
         </tr>
         <tr>
           <td valign="top" class="navColCell"><a href="#7">Miscellaneous</a></td>
@@ -99,8 +95,7 @@ href="http://www.unicode.org/webscripts/standard_styles.css">
         </tr>
         <tr>
           <td valign="top" class="navColCell">
-          <a href="http://www.unicode.org/policies/logo_policy.html">The 
-          Unicode® Consortium Trademarks and Logo Policy</a></td>
+        <a href="http://www.unicode.org/policies/logo_policy.html">Trademark Policy</a></td>
         </tr>
         <tr>
           <td valign="top" class="navColCell">
@@ -125,7 +120,7 @@ href="http://www.unicode.org/webscripts/standard_styles.css">
             <a href="http://www.unicode.org/policies/privacy_policy.html">
             Unicode Privacy Policy</a>. For trademark usage, see
             <a href="http://www.unicode.org/policies/logo_policy.html">the 
-            Unicode Consortium® Trademarks and Logo Policy</a>.</p>
+        Unicode® Consortium Name and Trademark Usage Policy</a>.</p>
             
             <table class="sidebar" align="right" width="50%" id="table1">
               <tr>
@@ -135,13 +130,13 @@ href="http://www.unicode.org/webscripts/standard_styles.css">
                 <td class="sidebar">Carefully read the following legal agreement 
                 (&quot;Agreement&quot;). Use or copying of the software and/or codes 
                 provided with this agreement (The &quot;Software&quot;) constitutes your 
-                acceptance of these terms</td>
+                acceptance of these terms. If you have any questions about these terms of use, please <a href="http://www.unicode.org/contacts.html">contact the Unicode Consortium</a>.</td>
               </tr>
             </table>
             <ol type="A">
               <li><u><a name="1"></a>Unicode Copyright.</u>
               <ol>
-                <li>Copyright © 1991-2006 Unicode, Inc. All rights reserved.</li>
+                <li>Copyright © 1991-2012 Unicode, Inc. All rights reserved.</li>
                 <li>Certain documents and files on this website contain a legend 
                 indicating that &quot;Modification is permitted.&quot; Any person is 
                 hereby authorized, without fee, to modify such documents and 
@@ -156,17 +151,12 @@ href="http://www.unicode.org/webscripts/standard_styles.css">
                 to the use of the particular set of data files known as the 
                 &quot;Unicode Character Database&quot; can be found in <a href="#Exhibit1">
                 Exhibit 1</a>.</li>
-                <li>Each version of the Unicode Standard has further specifications of rights and restrictions 
-                               of use. For the book editions, these are found on the back of 
-                               the
-                               <a href="http://www.unicode.org/versions/Unicode4.0.0/Title.pdf">
-                               title page</a>. For the online edition, certain files (such as 
-                               the PDF files for book chapters and code charts) carry specific 
-                               restrictions. All other files are covered under these general 
-                               Terms of Use.&nbsp; To request a permission to reproduce any 
-                               part of the Unicode Standard, please
-                               <a href="http://www.unicode.org/contacts.html">contact the 
-                               Unicode Consortium</a>.</li>
+                <li>Each version of the Unicode Standard has further 
+                specifications of rights and restrictions of use. For the book 
+                editions (Unicode 5.0 and earlier), these are found on the back 
+                of the
+                               <a href="http://www.unicode.org/versions/Unicode5.0.0/Title.pdf">title page</a>. 
+                The online code charts carry specific restrictions. All other files, including online documentation  of the core specification for Unicode 6.0 and later, are covered under these  general Terms of Use.</li>
                 <li>No license is granted to &quot;mirror&quot; the Unicode website where 
                 a fee is charged for access to the &quot;mirror&quot; site.</li>
                 <li>Modification is not permitted with respect to this document. 
@@ -217,19 +207,12 @@ href="http://www.unicode.org/webscripts/standard_styles.css">
               the following: loss of use, data or profits, in connection with 
               the use, modification or distribution of this information or its 
               derivatives.</li>
-              <li><u><a name="5"></a>Trademarks.</u>
-              <ol>
-                <li>Unicode and the Unicode logo are registered trademarks of 
-                Unicode, Inc.&nbsp;</li>
-                <li>This site contains product names and corporate names of 
-                other companies. All product names and company names and logos 
-                mentioned herein are the trademarks or registered trademarks of 
-                their respective owners. Other products and corporate names 
-                mentioned herein which are trademarks of a third party are used 
-                only for explanation and for the owners&#39; benefit and with no 
-                intent to infringe.</li>
-                <li>Use of third party products or information referred to 
-                herein is at the user’s risk.</li>
+              <li><u><a name="5"></a>Trademarks &amp; Logos.</u>
+                <ol>
+                <li>The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, Inc.  “The Unicode Consortium” and “Unicode, Inc.” are trade names of Unicode, Inc.  Use of the information and materials found on this website indicates your acknowledgement of Unicode, Inc.’s exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names.</li>
+<li><a href="http://www.unicode.org/policies/logo_policy.html">The Unicode Consortium Name and Trademark Usage Policy</a> (“Trademark Policy”) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc.</li>
+<li>All third party trademarks referenced herein are the property of their respective owners.
+</li>
               </ol>
               </li>
 
@@ -274,19 +257,18 @@ UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE</h3>
 <a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>, 
 <a href="http://www.unicode.org/reports/">http://www.unicode.org/reports/</a>, 
 and
-<a title="http://www.unicode.org/cldr/data/" onclick="return top.js.OpenExtLink(window,event,this)" target="_blank" href="http://www.unicode.org/cldr/data/">
-http://www.unicode.org/cldr/data/ </a>. Unicode Software includes any source code 
-published in the Unicode Standard or under the directories
-<a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>,
+<a title="http://www.unicode.org/cldr/data/" onClick="return top.js.OpenExtLink(window,event,this)" target="_blank" href="http://www.unicode.org/cldr/data/">
+http://www.unicode.org/cldr/data/</a>. Unicode Data Files do not include PDF online code charts under the directory  <a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>. Software includes any source code 
+published in the Unicode Standard or under the directories <a href="http://www.unicode.org/Public/">http://www.unicode.org/Public/</a>,
 <a href="http://www.unicode.org/reports/">http://www.unicode.org/reports/</a>, 
 and
-<a title="http://www.unicode.org/cldr/data/" onclick="return top.js.OpenExtLink(window,event,this)" target="_blank" href="http://www.unicode.org/cldr/data/">
-http://www.unicode.org/cldr/data/.</a></p>
+<a title="http://www.unicode.org/cldr/data/" onClick="return top.js.OpenExtLink(window,event,this)" target="_blank" href="http://www.unicode.org/cldr/data/">
+http://www.unicode.org/cldr/data/</a>.</p>
 
 <p>NOTICE TO USER: Carefully read the following legal agreement. BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.</p>
 <p>COPYRIGHT AND PERMISSION NOTICE</p>
 
-<p>Copyright © 1991-2005 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in 
+<p>Copyright © 1991-2012 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in 
 <a href="http://www.unicode.org/copyright.html">http://www.unicode.org/copyright.html</a>.</p>
 
 <p>Permission is hereby granted, free of charge, to any person obtaining a copy of the Unicode data files and 
@@ -300,7 +282,7 @@ PERFORMANCE OF THE DATA FILES OR SOFTWARE.</p>
 
             <hr width="80%">
 
-<p>Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be registered in some jurisdictions. All other trademarks and registered trademarks mentioned herein are the property of their respective owners.</p>
+<p>Unicode and the Unicode logo are trademarks of Unicode, Inc. in the United States and other countries. All third party trademarks referenced herein are the property of their respective owners.</p>
 
 
 </blockquote>
@@ -330,13 +312,5 @@ PERFORMANCE OF THE DATA FILES OR SOFTWARE.</p>
     </tr>
 
   </table>
-
-</form>
-
-
-
 </body>
-
-
-
 </html>
index fb5917fbbf73bfa49460f87fd43388513f4bfd27..0c92047e469821dd5394d032db471da95664e695 100755 (executable)
@@ -34,7 +34,7 @@
 progs="autoconf automake"
 
 ## Minimum versions we need:
-autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.in`
+autoconf_min=`sed -n 's/^ *AC_PREREQ(\([0-9\.]*\)).*/\1/p' configure.ac`
 
 ## FIXME how to determine this from the sources?
 automake_min=1.11
index 4ade989d095d945f84fe13f3344d90f766dde922..4808d7aa17907687f8fdeb30af9489ffbbcd3c8b 100644 (file)
@@ -15,7 +15,7 @@
 
 @SET_MAKE@
 
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# 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=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
+# 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-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -64,31 +64,40 @@ subdir = lib
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/c-strtod.m4 \
-       $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/extensions.m4 \
-       $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \
-       $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \
+       $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/dup2.m4 \
+       $(top_srcdir)/m4/extensions.m4 $(top_srcdir)/m4/filemode.m4 \
+       $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \
+       $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
        $(top_srcdir)/m4/gnulib-common.m4 \
+       $(top_srcdir)/m4/gnulib-comp.m4 \
        $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/inttypes.m4 \
        $(top_srcdir)/m4/largefile.m4 $(top_srcdir)/m4/longlong.m4 \
-       $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/md5.m4 \
-       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/multiarch.m4 \
-       $(top_srcdir)/m4/nocrash.m4 $(top_srcdir)/m4/pathmax.m4 \
+       $(top_srcdir)/m4/lstat.m4 $(top_srcdir)/m4/manywarnings.m4 \
+       $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \
+       $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/nocrash.m4 \
+       $(top_srcdir)/m4/off_t.m4 $(top_srcdir)/m4/pathmax.m4 \
+       $(top_srcdir)/m4/pselect.m4 \
        $(top_srcdir)/m4/pthread_sigmask.m4 \
        $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/sha1.m4 \
        $(top_srcdir)/m4/sha256.m4 $(top_srcdir)/m4/sha512.m4 \
-       $(top_srcdir)/m4/signal_h.m4 \
-       $(top_srcdir)/m4/signalblocking.m4 $(top_srcdir)/m4/socklen.m4 \
+       $(top_srcdir)/m4/signal_h.m4 $(top_srcdir)/m4/socklen.m4 \
        $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/st_dm_mode.m4 \
-       $(top_srcdir)/m4/stat.m4 $(top_srcdir)/m4/stdarg.m4 \
+       $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stat.m4 \
+       $(top_srcdir)/m4/stdalign.m4 $(top_srcdir)/m4/stdarg.m4 \
        $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \
        $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdio_h.m4 \
        $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \
        $(top_srcdir)/m4/strtoimax.m4 $(top_srcdir)/m4/strtoll.m4 \
        $(top_srcdir)/m4/strtoull.m4 $(top_srcdir)/m4/strtoumax.m4 \
-       $(top_srcdir)/m4/symlink.m4 $(top_srcdir)/m4/sys_stat_h.m4 \
+       $(top_srcdir)/m4/symlink.m4 $(top_srcdir)/m4/sys_select_h.m4 \
+       $(top_srcdir)/m4/sys_socket_h.m4 \
+       $(top_srcdir)/m4/sys_stat_h.m4 $(top_srcdir)/m4/sys_time_h.m4 \
        $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \
-       $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \
-       $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in
+       $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
+       $(top_srcdir)/m4/unistd_h.m4 $(top_srcdir)/m4/utimbuf.m4 \
+       $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes.m4 \
+       $(top_srcdir)/m4/warnings.m4 $(top_srcdir)/m4/wchar_t.m4 \
+       $(top_srcdir)/configure.ac
 am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
        $(ACLOCAL_M4)
 mkinstalldirs = $(install_sh) -d
@@ -98,13 +107,19 @@ CONFIG_CLEAN_VPATH_FILES =
 LIBRARIES = $(noinst_LIBRARIES)
 libgnu_a_AR = $(AR) $(ARFLAGS)
 am__DEPENDENCIES_1 =
-am__libgnu_a_SOURCES_DIST = allocator.c careadlinkat.c md5.c sha1.c \
-       sha256.c sha512.c dtoastr.c filemode.c gettext.h strftime.c
+am__libgnu_a_SOURCES_DIST = allocator.c c-ctype.h c-ctype.c \
+       c-strcase.h c-strcasecmp.c c-strncasecmp.c careadlinkat.c \
+       md5.c sha1.c sha256.c sha512.c dtoastr.c dtotimespec.c \
+       filemode.c gettext.h gettime.c strftime.c timespec-add.c \
+       timespec-sub.c utimens.c
 am__objects_1 =
-am_libgnu_a_OBJECTS = allocator.$(OBJEXT) careadlinkat.$(OBJEXT) \
-       md5.$(OBJEXT) sha1.$(OBJEXT) sha256.$(OBJEXT) sha512.$(OBJEXT) \
-       dtoastr.$(OBJEXT) filemode.$(OBJEXT) $(am__objects_1) \
-       strftime.$(OBJEXT)
+am_libgnu_a_OBJECTS = allocator.$(OBJEXT) c-ctype.$(OBJEXT) \
+       c-strcasecmp.$(OBJEXT) c-strncasecmp.$(OBJEXT) \
+       careadlinkat.$(OBJEXT) md5.$(OBJEXT) sha1.$(OBJEXT) \
+       sha256.$(OBJEXT) sha512.$(OBJEXT) dtoastr.$(OBJEXT) \
+       dtotimespec.$(OBJEXT) filemode.$(OBJEXT) $(am__objects_1) \
+       gettime.$(OBJEXT) strftime.$(OBJEXT) timespec-add.$(OBJEXT) \
+       timespec-sub.$(OBJEXT) utimens.$(OBJEXT)
 libgnu_a_OBJECTS = $(am_libgnu_a_OBJECTS)
 depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
 am__depfiles_maybe = depfiles
@@ -152,8 +167,6 @@ CYGWIN_OBJ = @CYGWIN_OBJ@
 C_SWITCH_MACHINE = @C_SWITCH_MACHINE@
 C_SWITCH_SYSTEM = @C_SWITCH_SYSTEM@
 C_SWITCH_X_SITE = @C_SWITCH_X_SITE@
-C_SWITCH_X_SYSTEM = @C_SWITCH_X_SYSTEM@
-C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
 DBUS_CFLAGS = @DBUS_CFLAGS@
 DBUS_LIBS = @DBUS_LIBS@
 DBUS_OBJ = @DBUS_OBJ@
@@ -230,13 +243,15 @@ GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@
 GNULIB_GETLOGIN = @GNULIB_GETLOGIN@
 GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
 GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
-GNULIB_GETS = @GNULIB_GETS@
 GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
+GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@
 GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
+GNULIB_GL_UNISTD_H_GETOPT = @GNULIB_GL_UNISTD_H_GETOPT@
 GNULIB_GRANTPT = @GNULIB_GRANTPT@
 GNULIB_GROUP_MEMBER = @GNULIB_GROUP_MEMBER@
 GNULIB_IMAXABS = @GNULIB_IMAXABS@
 GNULIB_IMAXDIV = @GNULIB_IMAXDIV@
+GNULIB_ISATTY = @GNULIB_ISATTY@
 GNULIB_LCHMOD = @GNULIB_LCHMOD@
 GNULIB_LCHOWN = @GNULIB_LCHOWN@
 GNULIB_LINK = @GNULIB_LINK@
@@ -264,17 +279,21 @@ GNULIB_PERROR = @GNULIB_PERROR@
 GNULIB_PIPE = @GNULIB_PIPE@
 GNULIB_PIPE2 = @GNULIB_PIPE2@
 GNULIB_POPEN = @GNULIB_POPEN@
+GNULIB_POSIX_OPENPT = @GNULIB_POSIX_OPENPT@
 GNULIB_PREAD = @GNULIB_PREAD@
 GNULIB_PRINTF = @GNULIB_PRINTF@
 GNULIB_PRINTF_POSIX = @GNULIB_PRINTF_POSIX@
+GNULIB_PSELECT = @GNULIB_PSELECT@
 GNULIB_PTHREAD_SIGMASK = @GNULIB_PTHREAD_SIGMASK@
 GNULIB_PTSNAME = @GNULIB_PTSNAME@
+GNULIB_PTSNAME_R = @GNULIB_PTSNAME_R@
 GNULIB_PUTC = @GNULIB_PUTC@
 GNULIB_PUTCHAR = @GNULIB_PUTCHAR@
 GNULIB_PUTENV = @GNULIB_PUTENV@
 GNULIB_PUTS = @GNULIB_PUTS@
 GNULIB_PWRITE = @GNULIB_PWRITE@
 GNULIB_RAISE = @GNULIB_RAISE@
+GNULIB_RANDOM = @GNULIB_RANDOM@
 GNULIB_RANDOM_R = @GNULIB_RANDOM_R@
 GNULIB_READ = @GNULIB_READ@
 GNULIB_READLINK = @GNULIB_READLINK@
@@ -287,7 +306,9 @@ GNULIB_RENAMEAT = @GNULIB_RENAMEAT@
 GNULIB_RMDIR = @GNULIB_RMDIR@
 GNULIB_RPMATCH = @GNULIB_RPMATCH@
 GNULIB_SCANF = @GNULIB_SCANF@
+GNULIB_SELECT = @GNULIB_SELECT@
 GNULIB_SETENV = @GNULIB_SETENV@
+GNULIB_SETHOSTNAME = @GNULIB_SETHOSTNAME@
 GNULIB_SIGACTION = @GNULIB_SIGACTION@
 GNULIB_SIGNAL_H_SIGPIPE = @GNULIB_SIGNAL_H_SIGPIPE@
 GNULIB_SIGPROCMASK = @GNULIB_SIGPROCMASK@
@@ -310,7 +331,6 @@ GNULIB_TIMEGM = @GNULIB_TIMEGM@
 GNULIB_TIME_R = @GNULIB_TIME_R@
 GNULIB_TMPFILE = @GNULIB_TMPFILE@
 GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@
-GNULIB_UNISTD_H_GETOPT = @GNULIB_UNISTD_H_GETOPT@
 GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@
 GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@
 GNULIB_UNLINK = @GNULIB_UNLINK@
@@ -329,9 +349,11 @@ GNULIB_VPRINTF_POSIX = @GNULIB_VPRINTF_POSIX@
 GNULIB_VSCANF = @GNULIB_VSCANF@
 GNULIB_VSNPRINTF = @GNULIB_VSNPRINTF@
 GNULIB_VSPRINTF_POSIX = @GNULIB_VSPRINTF_POSIX@
+GNULIB_WARN_CFLAGS = @GNULIB_WARN_CFLAGS@
 GNULIB_WCTOMB = @GNULIB_WCTOMB@
 GNULIB_WRITE = @GNULIB_WRITE@
 GNULIB__EXIT = @GNULIB__EXIT@
+GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@
 GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@
 GREP = @GREP@
 GSETTINGS_CFLAGS = @GSETTINGS_CFLAGS@
@@ -362,6 +384,7 @@ HAVE_DECL_IMAXDIV = @HAVE_DECL_IMAXDIV@
 HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
 HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@
 HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
+HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@
 HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@
 HAVE_DECL_STRTOIMAX = @HAVE_DECL_STRTOIMAX@
 HAVE_DECL_STRTOUMAX = @HAVE_DECL_STRTOUMAX@
@@ -390,6 +413,7 @@ HAVE_GETLOGIN = @HAVE_GETLOGIN@
 HAVE_GETOPT_H = @HAVE_GETOPT_H@
 HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
 HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
 HAVE_GRANTPT = @HAVE_GRANTPT@
 HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
@@ -416,12 +440,16 @@ HAVE_PCLOSE = @HAVE_PCLOSE@
 HAVE_PIPE = @HAVE_PIPE@
 HAVE_PIPE2 = @HAVE_PIPE2@
 HAVE_POPEN = @HAVE_POPEN@
+HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@
 HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@
 HAVE_PREAD = @HAVE_PREAD@
+HAVE_PSELECT = @HAVE_PSELECT@
 HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@
 HAVE_PTSNAME = @HAVE_PTSNAME@
+HAVE_PTSNAME_R = @HAVE_PTSNAME_R@
 HAVE_PWRITE = @HAVE_PWRITE@
 HAVE_RAISE = @HAVE_RAISE@
+HAVE_RANDOM = @HAVE_RANDOM@
 HAVE_RANDOM_H = @HAVE_RANDOM_H@
 HAVE_RANDOM_R = @HAVE_RANDOM_R@
 HAVE_READLINK = @HAVE_READLINK@
@@ -430,6 +458,7 @@ HAVE_REALPATH = @HAVE_REALPATH@
 HAVE_RENAMEAT = @HAVE_RENAMEAT@
 HAVE_RPMATCH = @HAVE_RPMATCH@
 HAVE_SETENV = @HAVE_SETENV@
+HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
 HAVE_SIGACTION = @HAVE_SIGACTION@
 HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@
 HAVE_SIGINFO_T = @HAVE_SIGINFO_T@
@@ -445,12 +474,15 @@ HAVE_STRTOLL = @HAVE_STRTOLL@
 HAVE_STRTOULL = @HAVE_STRTOULL@
 HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
 HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@
+HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
 HAVE_SYMLINK = @HAVE_SYMLINK@
 HAVE_SYMLINKAT = @HAVE_SYMLINKAT@
 HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
 HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
 HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
 HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
+HAVE_SYS_SELECT_H = @HAVE_SYS_SELECT_H@
+HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
 HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
 HAVE_TIMEGM = @HAVE_TIMEGM@
 HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@
@@ -464,6 +496,7 @@ HAVE_VASPRINTF = @HAVE_VASPRINTF@
 HAVE_VDPRINTF = @HAVE_VDPRINTF@
 HAVE_WCHAR_H = @HAVE_WCHAR_H@
 HAVE_WCHAR_T = @HAVE_WCHAR_T@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
 HAVE_XSERVER = @HAVE_XSERVER@
 HAVE__BOOL = @HAVE__BOOL@
 HAVE__EXIT = @HAVE__EXIT@
@@ -471,7 +504,10 @@ IMAGEMAGICK_CFLAGS = @IMAGEMAGICK_CFLAGS@
 IMAGEMAGICK_LIBS = @IMAGEMAGICK_LIBS@
 INCLUDE_NEXT = @INCLUDE_NEXT@
 INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
+INFO_EXT = @INFO_EXT@
+INFO_OPTS = @INFO_OPTS@
 INSTALL = @INSTALL@
+INSTALL_ARCH_INDEP_EXTRA = @INSTALL_ARCH_INDEP_EXTRA@
 INSTALL_DATA = @INSTALL_DATA@
 INSTALL_INFO = @INSTALL_INFO@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -486,8 +522,7 @@ LD_FIRSTFLAG = @LD_FIRSTFLAG@
 LD_SWITCH_SYSTEM = @LD_SWITCH_SYSTEM@
 LD_SWITCH_SYSTEM_TEMACS = @LD_SWITCH_SYSTEM_TEMACS@
 LD_SWITCH_X_SITE = @LD_SWITCH_X_SITE@
-LD_SWITCH_X_SITE_AUX = @LD_SWITCH_X_SITE_AUX@
-LD_SWITCH_X_SITE_AUX_RPATH = @LD_SWITCH_X_SITE_AUX_RPATH@
+LD_SWITCH_X_SITE_RPATH = @LD_SWITCH_X_SITE_RPATH@
 LIBGIF = @LIBGIF@
 LIBGNUTLS_CFLAGS = @LIBGNUTLS_CFLAGS@
 LIBGNUTLS_LIBS = @LIBGNUTLS_LIBS@
@@ -518,6 +553,7 @@ LIBXSM = @LIBXSM@
 LIBXTR6 = @LIBXTR6@
 LIBXT_OTHER = @LIBXT_OTHER@
 LIBX_OTHER = @LIBX_OTHER@
+LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
 LIB_GCC = @LIB_GCC@
 LIB_MATH = @LIB_MATH@
 LIB_PTHREAD = @LIB_PTHREAD@
@@ -527,11 +563,9 @@ LTLIBINTL = @LTLIBINTL@
 LTLIBOBJS = @LTLIBOBJS@
 M17N_FLT_CFLAGS = @M17N_FLT_CFLAGS@
 M17N_FLT_LIBS = @M17N_FLT_LIBS@
-MAINT = @MAINT@
 MAKEINFO = @MAKEINFO@
 MKDEPDIR = @MKDEPDIR@
 MKDIR_P = @MKDIR_P@
-M_FILE = @M_FILE@
 NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
 NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H = @NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H@
 NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@
@@ -540,7 +574,9 @@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
 NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
 NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@
 NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H@
 NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@
 NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
 NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
 NEXT_GETOPT_H = @NEXT_GETOPT_H@
@@ -551,7 +587,9 @@ NEXT_STDDEF_H = @NEXT_STDDEF_H@
 NEXT_STDINT_H = @NEXT_STDINT_H@
 NEXT_STDIO_H = @NEXT_STDIO_H@
 NEXT_STDLIB_H = @NEXT_STDLIB_H@
+NEXT_SYS_SELECT_H = @NEXT_SYS_SELECT_H@
 NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
+NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
 NEXT_TIME_H = @NEXT_TIME_H@
 NEXT_UNISTD_H = @NEXT_UNISTD_H@
 NS_OBJ = @NS_OBJ@
@@ -569,6 +607,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_URL = @PACKAGE_URL@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATH_SEPARATOR = @PATH_SEPARATOR@
+PAXCTL = @PAXCTL@
 PKG_CONFIG = @PKG_CONFIG@
 POST_ALLOC_OBJ = @POST_ALLOC_OBJ@
 PRAGMA_COLUMNS = @PRAGMA_COLUMNS@
@@ -602,6 +641,7 @@ REPLACE_FSTAT = @REPLACE_FSTAT@
 REPLACE_FSTATAT = @REPLACE_FSTATAT@
 REPLACE_FTELL = @REPLACE_FTELL@
 REPLACE_FTELLO = @REPLACE_FTELLO@
+REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@
 REPLACE_FUTIMENS = @REPLACE_FUTIMENS@
 REPLACE_GETCWD = @REPLACE_GETCWD@
 REPLACE_GETDELIM = @REPLACE_GETDELIM@
@@ -610,6 +650,8 @@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
 REPLACE_GETLINE = @REPLACE_GETLINE@
 REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
 REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
+REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_ISATTY = @REPLACE_ISATTY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LINK = @REPLACE_LINK@
 REPLACE_LINKAT = @REPLACE_LINKAT@
@@ -630,10 +672,13 @@ REPLACE_PERROR = @REPLACE_PERROR@
 REPLACE_POPEN = @REPLACE_POPEN@
 REPLACE_PREAD = @REPLACE_PREAD@
 REPLACE_PRINTF = @REPLACE_PRINTF@
+REPLACE_PSELECT = @REPLACE_PSELECT@
 REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@
+REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@
 REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_PWRITE = @REPLACE_PWRITE@
 REPLACE_RAISE = @REPLACE_RAISE@
+REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
 REPLACE_READ = @REPLACE_READ@
 REPLACE_READLINK = @REPLACE_READLINK@
 REPLACE_REALLOC = @REPLACE_REALLOC@
@@ -642,6 +687,7 @@ REPLACE_REMOVE = @REPLACE_REMOVE@
 REPLACE_RENAME = @REPLACE_RENAME@
 REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
 REPLACE_RMDIR = @REPLACE_RMDIR@
+REPLACE_SELECT = @REPLACE_SELECT@
 REPLACE_SETENV = @REPLACE_SETENV@
 REPLACE_SLEEP = @REPLACE_SLEEP@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
@@ -650,6 +696,8 @@ REPLACE_STAT = @REPLACE_STAT@
 REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@
 REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@
 REPLACE_STRTOD = @REPLACE_STRTOD@
+REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@
+REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@
 REPLACE_SYMLINK = @REPLACE_SYMLINK@
 REPLACE_TIMEGM = @REPLACE_TIMEGM@
 REPLACE_TMPFILE = @REPLACE_TMPFILE@
@@ -676,6 +724,7 @@ SHELL = @SHELL@
 SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
 SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
 START_FILES = @START_FILES@
+STDALIGN_H = @STDALIGN_H@
 STDARG_H = @STDARG_H@
 STDBOOL_H = @STDBOOL_H@
 STDDEF_H = @STDDEF_H@
@@ -695,8 +744,12 @@ UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
 VERSION = @VERSION@
 VMLIMIT_OBJ = @VMLIMIT_OBJ@
+WARN_CFLAGS = @WARN_CFLAGS@
 WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
+WERROR_CFLAGS = @WERROR_CFLAGS@
 WIDGET_OBJ = @WIDGET_OBJ@
+WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
+WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@
 WINT_T_SUFFIX = @WINT_T_SUFFIX@
 XFT_CFLAGS = @XFT_CFLAGS@
 XFT_LIBS = @XFT_LIBS@
@@ -748,6 +801,7 @@ htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
 install_sh = @install_sh@
+leimdir = @leimdir@
 libdir = @libdir@
 libexecdir = @libexecdir@
 liblockfile = @liblockfile@
@@ -762,6 +816,7 @@ ns_appbindir = @ns_appbindir@
 ns_appdir = @ns_appdir@
 ns_appresdir = @ns_appresdir@
 ns_appsrc = @ns_appsrc@
+ns_self_contained = @ns_self_contained@
 oldincludedir = @oldincludedir@
 pdfdir = @pdfdir@
 prefix = @prefix@
@@ -770,6 +825,7 @@ psdir = @psdir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
+standardlisppath = @standardlisppath@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
@@ -788,42 +844,49 @@ x_default_search_path = @x_default_search_path@
 # present in all Makefile.am that need it. This is ensured by the applicability
 # 'all' defined above.
 BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) inttypes.h signal.h \
-       arg-nonnull.h c++defs.h warn-on-use.h $(STDARG_H) $(STDBOOL_H) \
-       $(STDDEF_H) $(STDINT_H) stdio.h stdlib.h sys/stat.h time.h \
-       unistd.h
+       arg-nonnull.h c++defs.h warn-on-use.h $(STDALIGN_H) \
+       $(STDARG_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \
+       stdlib.h sys/select.h sys/stat.h sys/time.h time.h unistd.h
 EXTRA_DIST = alloca.in.h allocator.h careadlinkat.h md5.h sha1.h \
        sha256.h sha512.h dosname.h ftoastr.c ftoastr.h dup2.c \
        filemode.h getloadavg.c getopt.c getopt.in.h getopt1.c \
-       getopt_int.h ignore-value.h intprops.h inttypes.in.h lstat.c \
-       mktime-internal.h mktime.c pathmax.h pthread_sigmask.c \
-       readlink.c signal.in.h sigprocmask.c \
+       getopt_int.h gettimeofday.c ignore-value.h intprops.h \
+       inttypes.in.h lstat.c mktime-internal.h mktime.c pathmax.h \
+       pselect.c pthread_sigmask.c readlink.c signal.in.h \
        $(top_srcdir)/build-aux/snippet/_Noreturn.h \
        $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
        $(top_srcdir)/build-aux/snippet/c++defs.h \
        $(top_srcdir)/build-aux/snippet/warn-on-use.h stat.c \
-       stdarg.in.h stdbool.in.h stddef.in.h stdint.in.h stdio.in.h \
-       stdlib.in.h strftime.h strtoimax.c strtol.c strtoll.c strtol.c \
-       strtoul.c strtoull.c strtoimax.c strtoumax.c symlink.c \
-       sys_stat.in.h time.in.h time_r.c u64.h unistd.in.h verify.h
-MOSTLYCLEANDIRS = sys
+       stat-time.h stdalign.in.h stdarg.in.h stdbool.in.h stddef.in.h \
+       stdint.in.h stdio.in.h stdlib.in.h strftime.h strtoimax.c \
+       strtol.c strtoll.c strtol.c strtoul.c strtoull.c strtoimax.c \
+       strtoumax.c symlink.c sys_select.in.h sys_stat.in.h \
+       sys_time.in.h time.in.h time_r.c timespec.h u64.h unistd.in.h \
+       utimens.h verify.h
+MOSTLYCLEANDIRS = sys sys
 MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t getopt.h \
        getopt.h-t inttypes.h inttypes.h-t signal.h signal.h-t \
        arg-nonnull.h arg-nonnull.h-t c++defs.h c++defs.h-t \
-       warn-on-use.h warn-on-use.h-t stdarg.h stdarg.h-t stdbool.h \
-       stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdio.h \
-       stdio.h-t stdlib.h stdlib.h-t sys/stat.h sys/stat.h-t time.h \
-       time.h-t unistd.h unistd.h-t
+       warn-on-use.h warn-on-use.h-t stdalign.h stdalign.h-t stdarg.h \
+       stdarg.h-t stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h \
+       stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t sys/select.h \
+       sys/select.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \
+       time.h time.h-t unistd.h unistd.h-t
 noinst_LIBRARIES = libgnu.a
+AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
 DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
-libgnu_a_SOURCES = allocator.c careadlinkat.c md5.c sha1.c sha256.c \
-       sha512.c dtoastr.c filemode.c $(am__append_1) strftime.c
+libgnu_a_SOURCES = allocator.c c-ctype.h c-ctype.c c-strcase.h \
+       c-strcasecmp.c c-strncasecmp.c careadlinkat.c md5.c sha1.c \
+       sha256.c sha512.c dtoastr.c dtotimespec.c filemode.c \
+       $(am__append_1) gettime.c strftime.c timespec-add.c \
+       timespec-sub.c utimens.c
 libgnu_a_LIBADD = $(gl_LIBOBJS)
 libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
 EXTRA_libgnu_a_SOURCES = ftoastr.c dup2.c getloadavg.c getopt.c \
-       getopt1.c lstat.c mktime.c pthread_sigmask.c readlink.c \
-       sigprocmask.c stat.c strtoimax.c strtol.c strtoll.c strtol.c \
-       strtoul.c strtoull.c strtoimax.c strtoumax.c symlink.c \
-       time_r.c
+       getopt1.c gettimeofday.c lstat.c mktime.c pselect.c \
+       pthread_sigmask.c readlink.c stat.c strtoimax.c strtol.c \
+       strtoll.c strtol.c strtoul.c strtoull.c strtoimax.c \
+       strtoumax.c symlink.c time_r.c
 
 # Because this Makefile snippet defines a variable used by other
 # gnulib Makefile snippets, it must be present in all Makefile.am that
@@ -882,23 +945,29 @@ distclean-compile:
        -rm -f *.tab.c
 
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/allocator.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-ctype.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strcasecmp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/c-strncasecmp.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/careadlinkat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtotimespec.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gettimeofday.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lstat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktime.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pselect.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread_sigmask.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/readlink.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha256.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha512.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigprocmask.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strftime.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoimax.Po@am__quote@
@@ -909,6 +978,9 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strtoumax.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symlink.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/time_r.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timespec-add.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timespec-sub.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utimens.Po@am__quote@
 
 .c.o:
 @am__fastdepCC_TRUE@   $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -1154,7 +1226,7 @@ getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
 
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
-inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@@ -1175,10 +1247,12 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_N
              -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
              -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
              -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
+             -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
              -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
              -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
              -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
              -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/inttypes.in.h; \
@@ -1244,6 +1318,17 @@ warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h
          > $@-t && \
        mv $@-t $@
 
+# We need the following in order to create <stdalign.h> when the system
+# doesn't have one that works.
+@GL_GENERATE_STDALIGN_H_TRUE@stdalign.h: stdalign.in.h $(top_builddir)/config.status
+@GL_GENERATE_STDALIGN_H_TRUE@  $(AM_V_GEN)rm -f $@-t $@ && \
+@GL_GENERATE_STDALIGN_H_TRUE@  { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+@GL_GENERATE_STDALIGN_H_TRUE@    cat $(srcdir)/stdalign.in.h; \
+@GL_GENERATE_STDALIGN_H_TRUE@  } > $@-t && \
+@GL_GENERATE_STDALIGN_H_TRUE@  mv $@-t $@
+@GL_GENERATE_STDALIGN_H_FALSE@stdalign.h: $(top_builddir)/config.status
+@GL_GENERATE_STDALIGN_H_FALSE@ rm -f $@
+
 # We need the following in order to create <stdarg.h> when the system
 # doesn't have one that works with the given compiler.
 @GL_GENERATE_STDARG_H_TRUE@stdarg.h: stdarg.in.h $(top_builddir)/config.status
@@ -1361,7 +1446,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
              -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
              -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
-             -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
              -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
              -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
              -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
@@ -1472,8 +1556,11 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
              -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
              -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
+             -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
              -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
+             -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
              -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
+             -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
              -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
              -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
              -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
@@ -1498,7 +1585,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
              -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
              -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
+             -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
              -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
+             -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
+             -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
              -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
              -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
              -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
@@ -1516,7 +1606,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
              -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+             -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
              -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
@@ -1530,6 +1622,30 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
        } > $@-t && \
        mv $@-t $@
 
+# We need the following in order to create <sys/select.h> when the system
+# doesn't have one that works with the given compiler.
+sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
+             -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
+             -e 's/@''GNULIB_PSELECT''@/$(GNULIB_PSELECT)/g' \
+             -e 's/@''GNULIB_SELECT''@/$(GNULIB_SELECT)/g' \
+             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \
+             -e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \
+             -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/sys_select.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+
 # We need the following in order to create <sys/stat.h> when the system
 # has one that is incomplete.
 sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
@@ -1541,6 +1657,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
              -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
              -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
              -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
@@ -1581,6 +1698,31 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
        } > $@-t && \
        mv $@-t $@
 
+# We need the following in order to create <sys/time.h> when the system
+# doesn't have one that works with the given compiler.
+sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+             -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
+             -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
+             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
+             -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+             -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/sys_time.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+
 # We need the following in order to create <time.h> when the system
 # doesn't have one that works with the given compiler.
 time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
@@ -1625,6 +1767,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
+             -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
              -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
              -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
              -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
@@ -1649,6 +1792,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
              -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
              -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
+             -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \
              -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
              -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
              -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
@@ -1661,11 +1805,12 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
              -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
              -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
+             -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \
              -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
              -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
              -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
              -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
-             -e 's/@''GNULIB_UNISTD_H_GETOPT''@/$(GNULIB_UNISTD_H_GETOPT)/g' \
+             -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \
              -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
              -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
              -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
@@ -1698,6 +1843,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
+             -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
@@ -1710,6 +1856,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
              -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
              -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
@@ -1719,11 +1866,13 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
              -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
              -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
+             -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
              -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
              -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
+             -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
              -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
index 5fd9650b86bd8958e7f5112fd1d5a81b1055a0f6..cc09901d05ae6a33e269a0254f1a6716ca153738 100644 (file)
@@ -987,34 +987,41 @@ AC_SUBST([am__untar])
 m4_include([m4/00gnulib.m4])
 m4_include([m4/alloca.m4])
 m4_include([m4/c-strtod.m4])
+m4_include([m4/clock_time.m4])
 m4_include([m4/dup2.m4])
 m4_include([m4/extensions.m4])
 m4_include([m4/filemode.m4])
 m4_include([m4/getloadavg.m4])
 m4_include([m4/getopt.m4])
-m4_include([m4/gl-comp.m4])
+m4_include([m4/gettime.m4])
+m4_include([m4/gettimeofday.m4])
 m4_include([m4/gnulib-common.m4])
+m4_include([m4/gnulib-comp.m4])
 m4_include([m4/include_next.m4])
 m4_include([m4/inttypes.m4])
 m4_include([m4/largefile.m4])
 m4_include([m4/longlong.m4])
 m4_include([m4/lstat.m4])
+m4_include([m4/manywarnings.m4])
 m4_include([m4/md5.m4])
 m4_include([m4/mktime.m4])
 m4_include([m4/multiarch.m4])
 m4_include([m4/nocrash.m4])
+m4_include([m4/off_t.m4])
 m4_include([m4/pathmax.m4])
+m4_include([m4/pselect.m4])
 m4_include([m4/pthread_sigmask.m4])
 m4_include([m4/readlink.m4])
 m4_include([m4/sha1.m4])
 m4_include([m4/sha256.m4])
 m4_include([m4/sha512.m4])
 m4_include([m4/signal_h.m4])
-m4_include([m4/signalblocking.m4])
 m4_include([m4/socklen.m4])
 m4_include([m4/ssize_t.m4])
 m4_include([m4/st_dm_mode.m4])
+m4_include([m4/stat-time.m4])
 m4_include([m4/stat.m4])
+m4_include([m4/stdalign.m4])
 m4_include([m4/stdarg.m4])
 m4_include([m4/stdbool.m4])
 m4_include([m4/stddef_h.m4])
@@ -1027,9 +1034,17 @@ m4_include([m4/strtoll.m4])
 m4_include([m4/strtoull.m4])
 m4_include([m4/strtoumax.m4])
 m4_include([m4/symlink.m4])
+m4_include([m4/sys_select_h.m4])
+m4_include([m4/sys_socket_h.m4])
 m4_include([m4/sys_stat_h.m4])
+m4_include([m4/sys_time_h.m4])
 m4_include([m4/time_h.m4])
 m4_include([m4/time_r.m4])
+m4_include([m4/timespec.m4])
 m4_include([m4/tm_gmtoff.m4])
 m4_include([m4/unistd_h.m4])
+m4_include([m4/utimbuf.m4])
+m4_include([m4/utimens.m4])
+m4_include([m4/utimes.m4])
+m4_include([m4/warnings.m4])
 m4_include([m4/wchar_t.m4])
index e93bd7f325ceb9e018cc5a639c5e5855fae7f023..5f5052c5205b6b48b4890fcf99fed118103a2e16 100644 (file)
@@ -1,4 +1,4 @@
-/* src/config.in.  Generated from configure.in by autoheader.  */
+/* src/config.in.  Generated from configure.ac by autoheader.  */
 
 /* GNU Emacs site configuration template file.
 
@@ -46,20 +46,81 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to the number of bits in type 'wint_t'. */
 #undef BITSIZEOF_WINT_T
 
+/* Define if FIONREAD should not be used. */
+#undef BROKEN_FIONREAD
+
+/* Define if get_current_dir_name should not be used. */
+#undef BROKEN_GET_CURRENT_DIR_NAME
+
+/* Define on FreeBSD to work around an issue when reading from a PTY. */
+#undef BROKEN_PTY_READ_AFTER_EAGAIN
+
+/* Define if SA_RESTART should only be used in batch mode. */
+#undef BROKEN_SA_RESTART
+
+/* Define if SIGAIO should not be used. */
+#undef BROKEN_SIGAIO
+
+/* Define if SIGIO should not be used. */
+#undef BROKEN_SIGIO
+
+/* Define if SIGPOLL should not be used. */
+#undef BROKEN_SIGPOLL
+
+/* Define if SIGPTY should not be used. */
+#undef BROKEN_SIGPTY
+
+/* Define if the system is compatible with BSD 4.2. */
+#undef BSD4_2
+
+/* Define if the system is compatible with BSD 4.2. */
+#undef BSD_SYSTEM
+
+/* Define if AH_BOTTOM should change BSD_SYSTEM. */
+#undef BSD_SYSTEM_AHB
+
 /* Define if Emacs cannot be dumped on your system. */
 #undef CANNOT_DUMP
 
-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
-   systems. This function is required for `alloca.c' support on those systems.
+/* Define this to enable compile time checks for the Lisp_Object data type. */
+#undef CHECK_LISP_OBJECT_TYPE
+
+/* Define if you want lock files to be written, so that Emacs can tell
+   instantly when you try to modify a file that someone else has modified in
+   his/her Emacs. */
+#undef CLASH_DETECTION
+
+/* Define to one of '_getb67', 'GETB67', 'getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for 'alloca.c' support on those systems.
    */
 #undef CRAY_STACKSEG_END
 
-/* Define to 1 if using `alloca.c'. */
+/* Define if the system is Cygwin. */
+#undef CYGWIN
+
+/* Define to 1 if using 'alloca.c'. */
 #undef C_ALLOCA
 
+/* Define if the system is Darwin. */
+#undef DARWIN_OS
+
+/* Extra bits to be or'd in with any pointers stored in a Lisp_Object. */
+#undef DATA_SEG_BITS
+
+/* Address of the start of the data segment. */
+#undef DATA_START
+
+/* Name of the default sound device. */
+#undef DEFAULT_SOUND_DEVICE
+
 /* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
 #undef DGUX
 
+/* Define if process.c does not need to close a pty to make it a controlling
+   terminal (it is already a controlling terminal of the subprocess, because
+   we did ioctl TIOCSCTTY). */
+#undef DONT_REOPEN_PTY
+
 /* Define to 1 if you are using the GNU C Library. */
 #undef DOUG_LEA_MALLOC
 
@@ -69,9 +130,17 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to the options passed to configure. */
 #undef EMACS_CONFIG_OPTIONS
 
-/* Enable expensive run-time checking of data types? */
+/* Define to 1 if expensive run-time data type and consistency checks are
+   enabled. */
 #undef ENABLE_CHECKING
 
+/* Letter to use in finding device name of first PTY, if PTYs are supported.
+   */
+#undef FIRST_PTY_LETTER
+
+/* Define to 1 if futimesat mishandles a NULL file name. */
+#undef FUTIMESAT_NULL_BUG
+
 /* Define this to check for errors in cons list. */
 #undef GC_CHECK_CONS_LIST
 
@@ -86,18 +155,54 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define this to check for short string overrun. */
 #undef GC_CHECK_STRING_OVERRUN
 
+/* Mark a secondary stack, like the register stack on the ia64. */
+#undef GC_MARK_SECONDARY_STACK
+
+/* Define to GC_USE_GCPROS_AS_BEFORE if conservative garbage collection is not
+   known to work. */
+#undef GC_MARK_STACK
+
+/* Define if setjmp is known to save all registers relevant for conservative
+   garbage collection in the jmp_buf. */
+#undef GC_SETJMP_WORKS
+
 /* Define to 1 if the `getpgrp' function requires zero arguments. */
 #undef GETPGRP_VOID
 
-/* Define to 1 if gettimeofday accepts only one argument. */
-#undef GETTIMEOFDAY_ONE_ARGUMENT
+/* Define if gettimeofday clobbers the localtime buffer. */
+#undef GETTIMEOFDAY_CLOBBERS_LOCALTIME
+
+/* Define this to 'void' or 'struct timezone' to match the system's
+   declaration of the second argument to gettimeofday. */
+#undef GETTIMEOFDAY_TIMEZONE
+
+/* Define this to enable glyphs debugging code. */
+#undef GLYPH_DEBUG
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module fscanf shall be considered present. */
+#undef GNULIB_FSCANF
 
-/* Define to make the limit macros in <stdint.h> visible. */
-#undef GL_TRIGGER_STDC_LIMIT_MACROS
+/* enable some gnulib portability checks */
+#undef GNULIB_PORTCHECK
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module scanf shall be considered present. */
+#undef GNULIB_SCANF
+
+/* Value of PENDING_OUTPUT_COUNT if using the GNU C library. */
+#undef GNU_LIBRARY_PENDING_OUTPUT_COUNT
+
+/* Define if ths system is compatible with GNU/Linux. */
+#undef GNU_LINUX
 
 /* Define to 1 if you want to use the GNU memory allocator. */
 #undef GNU_MALLOC
 
+/* Define to set the G_SLICE environment variable to "always-malloc" at
+   startup, if using GTK. */
+#undef G_SLICE_ALWAYS_MALLOC
+
 /* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */
 #undef HAVE_AIX_SMT_EXP
 
@@ -130,6 +235,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `cfsetspeed' function. */
 #undef HAVE_CFSETSPEED
 
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the `clock_settime' function. */
+#undef HAVE_CLOCK_SETTIME
+
 /* Define to 1 if you have the `closedir' function. */
 #undef HAVE_CLOSEDIR
 
@@ -145,6 +256,21 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if using D-Bus. */
 #undef HAVE_DBUS
 
+/* Define to 1 if you have the `dbus_type_is_valid' function. */
+#undef HAVE_DBUS_TYPE_IS_VALID
+
+/* Define to 1 if you have the `dbus_validate_bus_name' function. */
+#undef HAVE_DBUS_VALIDATE_BUS_NAME
+
+/* Define to 1 if you have the `dbus_validate_interface' function. */
+#undef HAVE_DBUS_VALIDATE_INTERFACE
+
+/* Define to 1 if you have the `dbus_validate_member' function. */
+#undef HAVE_DBUS_VALIDATE_MEMBER
+
+/* Define to 1 if you have the `dbus_validate_path' function. */
+#undef HAVE_DBUS_VALIDATE_PATH
+
 /* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */
 #undef HAVE_DBUS_WATCH_GET_UNIX_FD
 
@@ -203,6 +329,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the 'dup2' function. */
 #undef HAVE_DUP2
 
+/* Define to 1 if you have the `endgrent' function. */
+#undef HAVE_ENDGRENT
+
+/* Define to 1 if you have the `endpwent' function. */
+#undef HAVE_ENDPWENT
+
 /* Define to 1 if you have the `euidaccess' function. */
 #undef HAVE_EUIDACCESS
 
@@ -233,8 +365,14 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `fsync' function. */
 #undef HAVE_FSYNC
 
-/* Define to 1 if you have the `ftime' function. */
-#undef HAVE_FTIME
+/* Define to 1 if you have the `futimens' function. */
+#undef HAVE_FUTIMENS
+
+/* Define to 1 if you have the `futimes' function. */
+#undef HAVE_FUTIMES
+
+/* Define to 1 if you have the `futimesat' function. */
+#undef HAVE_FUTIMESAT
 
 /* Define to 1 if you have the `gai_strerror' function. */
 #undef HAVE_GAI_STRERROR
@@ -251,8 +389,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `getdelim' function. */
 #undef HAVE_GETDELIM
 
-/* Define to 1 if you have the `getdomainname' function. */
-#undef HAVE_GETDOMAINNAME
+/* Define to 1 if you have the `getgrent' function. */
+#undef HAVE_GETGRENT
 
 /* Define to 1 if you have the `gethostname' function. */
 #undef HAVE_GETHOSTNAME
@@ -278,6 +416,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `getpt' function. */
 #undef HAVE_GETPT
 
+/* Define to 1 if you have the `getpwent' function. */
+#undef HAVE_GETPWENT
+
 /* Define to 1 if you have the `getrlimit' function. */
 #undef HAVE_GETRLIMIT
 
@@ -287,9 +428,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `getsockname' function. */
 #undef HAVE_GETSOCKNAME
 
-/* Define to 1 if you have the `getsockopt' function. */
-#undef HAVE_GETSOCKOPT
-
 /* Define to 1 if you have the `gettimeofday' function. */
 #undef HAVE_GETTIMEOFDAY
 
@@ -447,9 +585,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `mail' library (-lmail). */
 #undef HAVE_LIBMAIL
 
-/* Define to 1 if you have the `ncurses' library (-lncurses). */
-#undef HAVE_LIBNCURSES
-
 /* Define to 1 if using libotf. */
 #undef HAVE_LIBOTF
 
@@ -480,9 +615,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <linux/version.h> header file. */
 #undef HAVE_LINUX_VERSION_H
 
-/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
 /* Define to 1 if you have the `localtime_r' function. */
 #undef HAVE_LOCALTIME_R
 
@@ -492,7 +624,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you support file names longer than 14 characters. */
 #undef HAVE_LONG_FILE_NAMES
 
-/* Define to 1 if the system has the type `long long int'. */
+/* Define to 1 if the system has the type 'long long int'. */
 #undef HAVE_LONG_LONG_INT
 
 /* Define to 1 if you have the `lrand48' function. */
@@ -501,6 +633,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `lstat' function. */
 #undef HAVE_LSTAT
 
+/* Define to 1 if you have the `lutimes' function. */
+#undef HAVE_LUTIMES
+
 /* Define to 1 if using libm17n-flt. */
 #undef HAVE_M17N_FLT
 
@@ -513,38 +648,26 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `MagickExportImagePixels' function. */
 #undef HAVE_MAGICKEXPORTIMAGEPIXELS
 
+/* Define to 1 if you have the `MagickMergeImageLayers' function. */
+#undef HAVE_MAGICKMERGEIMAGELAYERS
+
 /* Define to 1 if you have the <maillock.h> header file. */
 #undef HAVE_MAILLOCK_H
 
 /* Define to 1 if you have the <malloc/malloc.h> header file. */
 #undef HAVE_MALLOC_MALLOC_H
 
-/* Define to 1 if you have the `mblen' function. */
-#undef HAVE_MBLEN
-
-/* Define to 1 if you have the `mbrlen' function. */
-#undef HAVE_MBRLEN
-
-/* Define to 1 if you have the `mbsinit' function. */
-#undef HAVE_MBSINIT
-
 /* Define to 1 if <wchar.h> declares mbstate_t. */
 #undef HAVE_MBSTATE_T
 
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
-/* Define to 1 if you have the `mempcpy' function. */
-#undef HAVE_MEMPCPY
-
 /* Define to 1 if you have mouse menus. (This is automatic if you use X, but
    the option to specify it remains.) It is also defined with other window
    systems that support xmenu.c. */
 #undef HAVE_MENUS
 
-/* Define to 1 if you have the `mkdir' function. */
-#undef HAVE_MKDIR
-
 /* Define to 1 if you have the `mkstemp' function. */
 #undef HAVE_MKSTEMP
 
@@ -554,8 +677,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define if you have mouse support. */
 #undef HAVE_MOUSE
 
-/* Define to 1 if you have the `mremap' function. */
-#undef HAVE_MREMAP
+/* Define to 1 if you have the `nanotime' function. */
+#undef HAVE_NANOTIME
 
 /* Define to 1 if you have the <net/if_dl.h> header file. */
 #undef HAVE_NET_IF_DL_H
@@ -585,6 +708,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `posix_memalign' function. */
 #undef HAVE_POSIX_MEMALIGN
 
+/* Define if you have the /proc filesystem. */
+#undef HAVE_PROCFS
+
+/* Define to 1 if you have the `pselect' function. */
+#undef HAVE_PSELECT
+
 /* Define to 1 if you have the `pstat_getdynamic' function. */
 #undef HAVE_PSTAT_GETDYNAMIC
 
@@ -597,6 +726,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if the pthread_sigmask function can be used (despite bugs). */
 #undef HAVE_PTHREAD_SIGMASK
 
+/* Define if the system supports pty devices. */
+#undef HAVE_PTYS
+
 /* Define to 1 if you have the <pty.h> header file. */
 #undef HAVE_PTY_H
 
@@ -615,18 +747,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `recvfrom' function. */
 #undef HAVE_RECVFROM
 
-/* Define to 1 if you have the `rename' function. */
-#undef HAVE_RENAME
-
 /* Define to 1 if res_init is available. */
 #undef HAVE_RES_INIT
 
 /* Define to 1 if you have the `rint' function. */
 #undef HAVE_RINT
 
-/* Define to 1 if you have the `rmdir' function. */
-#undef HAVE_RMDIR
-
 /* Define to 1 if using librsvg. */
 #undef HAVE_RSVG
 
@@ -651,9 +777,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `setsid' function. */
 #undef HAVE_SETSID
 
-/* Define to 1 if you have the `setsockopt' function. */
-#undef HAVE_SETSOCKOPT
-
 /* Define to 1 if you have the `shutdown' function. */
 #undef HAVE_SHUTDOWN
 
@@ -672,6 +795,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `snprintf' function. */
 #undef HAVE_SNPRINTF
 
+/* Define if the system supports 4.2-compatible sockets. */
+#undef HAVE_SOCKETS
+
 /* Define to 1 if you have sound support. */
 #undef HAVE_SOUND
 
@@ -690,9 +816,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <stdlib.h> header file. */
 #undef HAVE_STDLIB_H
 
-/* Define to 1 if you have the `strerror' function. */
-#undef HAVE_STRERROR
-
 /* Define to 1 if you have the <strings.h> header file. */
 #undef HAVE_STRINGS_H
 
@@ -735,10 +858,32 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */
 #undef HAVE_STRUCT_NLIST_N_UN_N_NAME
 
+/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
+
+/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
+
+/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC
+
+/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+
+/* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
+
+/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
+
+/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
+
 /* Define to 1 if `tm_zone' is a member of `struct tm'. */
 #undef HAVE_STRUCT_TM_TM_ZONE
 
-/* Define to 1 if `struct utimbuf' is declared by <utime.h>. */
+/* Define if struct utimbuf is declared -- usually in <utime.h>. Some systems
+   have utime.h but don't declare the struct anywhere. */
 #undef HAVE_STRUCT_UTIMBUF
 
 /* Define if struct stat has an st_dm_mode member. */
@@ -750,9 +895,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `sync' function. */
 #undef HAVE_SYNC
 
-/* Define to 1 if you have the `sysinfo' function. */
-#undef HAVE_SYSINFO
-
 /* Define to 1 if you have the <sys/bitypes.h> header file. */
 #undef HAVE_SYS_BITYPES_H
 
@@ -762,9 +904,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <sys/loadavg.h> header file. */
 #undef HAVE_SYS_LOADAVG_H
 
-/* Define to 1 if you have the <sys/mman.h> header file. */
-#undef HAVE_SYS_MMAN_H
-
 /* Define to 1 if you have the <sys/param.h> header file. */
 #undef HAVE_SYS_PARAM_H
 
@@ -786,6 +925,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the <sys/systeminfo.h> header file. */
 #undef HAVE_SYS_SYSTEMINFO_H
 
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#undef HAVE_SYS_TIMEB_H
+
 /* Define to 1 if you have the <sys/time.h> header file. */
 #undef HAVE_SYS_TIME_H
 
@@ -804,18 +946,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
 #undef HAVE_SYS_WAIT_H
 
-/* Define to 1 if you have the <sys/_mbstate_t.h> header file. */
-#undef HAVE_SYS__MBSTATE_T_H
-
 /* Define to 1 if you have the <term.h> header file. */
 #undef HAVE_TERM_H
 
 /* Define to 1 if you have the tiff library (-ltiff). */
 #undef HAVE_TIFF
 
-/* Define to 1 if `struct timeval' is declared by <sys/time.h>. */
-#undef HAVE_TIMEVAL
-
 /* Define if struct tm has the tm_gmtoff member. */
 #undef HAVE_TM_GMTOFF
 
@@ -833,18 +969,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `tzset' function. */
 #undef HAVE_TZSET
 
-/* Define to 1 if you have the `ualarm' function. */
-#undef HAVE_UALARM
-
 /* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* Define to 1 if the system has the type `unsigned long long int'. */
+/* Define to 1 if the system has the type 'unsigned long long int'. */
 #undef HAVE_UNSIGNED_LONG_LONG_INT
 
 /* Define to 1 if you have the <util.h> header file. */
 #undef HAVE_UTIL_H
 
+/* Define to 1 if you have the `utimensat' function. */
+#undef HAVE_UTIMENSAT
+
 /* Define to 1 if you have the `utimes' function. */
 #undef HAVE_UTIMES
 
@@ -869,9 +1005,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define if you have a window system. */
 #undef HAVE_WINDOW_SYSTEM
 
+/* Define to 1 if you have the <winsock2.h> header file. */
+#undef HAVE_WINSOCK2_H
+
 /* Define to 1 if `fork' works. */
 #undef HAVE_WORKING_FORK
 
+/* Define if utimes works properly. */
+#undef HAVE_WORKING_UTIMES
+
 /* Define to 1 if `vfork' works. */
 #undef HAVE_WORKING_VFORK
 
@@ -915,9 +1057,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `XScreenResourceString' function. */
 #undef HAVE_XSCREENRESOURCESTRING
 
-/* Define to 1 if you have the `XSetWMProtocols' function. */
-#undef HAVE_XSETWMPROTOCOLS
-
 /* Define if you have usable i18n support. */
 #undef HAVE_X_I18N
 
@@ -930,6 +1069,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if the system has the type `_Bool'. */
 #undef HAVE__BOOL
 
+/* Define to 1 if you have the `_ftime' function. */
+#undef HAVE__FTIME
+
 /* Define to 1 if you have the `__builtin_unwind_init' function. */
 #undef HAVE___BUILTIN_UNWIND_INIT
 
@@ -942,6 +1084,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to support using a Hesiod database to find the POP server. */
 #undef HESIOD
 
+/* Define if the system is HPUX. */
+#undef HPUX
+
+/* Define to read input using SIGIO. */
+#undef INTERRUPT_INPUT
+
+/* Define if the system is IRIX. */
+#undef IRIX6_5
+
 /* Define to support Kerberos-authenticated POP mail retrieval. */
 #undef KERBEROS
 
@@ -951,7 +1102,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if localtime caches TZ. */
 #undef LOCALTIME_CACHE
 
-/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+/* Define to 1 if 'lstat' dereferences a symlink specified with a trailing
    slash. */
 #undef LSTAT_FOLLOWS_SLASHED_SYMLINK
 
@@ -973,12 +1124,28 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to support POP mail retrieval. */
 #undef MAIL_USE_POP
 
+/* Define if system's imake configuration file defines `NeedWidePrototypes' as
+   `NO'. */
+#undef NARROWPROTO
+
+/* Do not define abort in emacs.c. */
+#undef NO_ABORT
+
+/* Define if XEditRes should not be used. */
+#undef NO_EDITRES
+
 /* Define to 1 if you don't have struct exception in math.h. */
 #undef NO_MATHERR
 
 /* Define to 1 if your C compiler doesn't accept -c and -o together. */
 #undef NO_MINUS_C_MINUS_O
 
+/* Define if termio.h should not be included. */
+#undef NO_TERMIO
+
+/* Minimum value of NSIG. */
+#undef NSIG_MINIMUM
+
 /* Define to 1 if `NSInteger' is defined. */
 #undef NS_HAVE_NSINTEGER
 
@@ -1015,12 +1182,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
-/* Define as `void' if your compiler accepts `void *'; otherwise define as
-   `char'. */
-#undef POINTER_TYPE
+/* Number of chars of output in the buffer of a stdio stream. */
+#undef PENDING_OUTPUT_COUNT
+
+/* Define to empty to suppress deprecation warnings when building with
+   --enable-gcc-warnings and with libpng versions before 1.5, which lack
+   png_longjmp. */
+#undef PNG_DEPSTRUCT
 
-/* Define to 1 if the C compiler supports function prototypes. */
-#undef PROTOTYPES
+/* Define if process_send_signal should use VSUSP instead of VSWTCH. */
+#undef PREFER_VSUSP
 
 /* Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno.
    */
@@ -1036,6 +1207,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    'ptrdiff_t'. */
 #undef PTRDIFF_T_SUFFIX
 
+/* How to iterate over PTYs. */
+#undef PTY_ITERATION
+
+/* How to get the device name of the control end of a PTY, if non-standard. */
+#undef PTY_NAME_SPRINTF
+
+/* How to open a PTY, if non-standard. */
+#undef PTY_OPEN
+
+/* How to get device name of the tty end of a PTY, if non-standard. */
+#undef PTY_TTY_NAME_SPRINTF
+
 /* Define to 1 if readlink fails to recognize a trailing slash. */
 #undef READLINK_TRAILING_SLASH_BUG
 
@@ -1051,6 +1234,18 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    slash */
 #undef REPLACE_FUNC_STAT_FILE
 
+/* Define if emacs.c needs to call run_time_remap; for HPUX. */
+#undef RUN_TIME_REMAP
+
+/* Define if process.c:child_setup should not call setpgrp. */
+#undef SETPGRP_RELEASES_CTTY
+
+/* How to set up a slave PTY, if needed. */
+#undef SETUP_SLAVE_PTY
+
+/* Make process_send_signal work by "typing" a signal character on the pty. */
+#undef SIGNALS_VIA_CHARACTERS
+
 /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
    'sig_atomic_t'. */
 #undef SIG_ATOMIC_T_SUFFIX
@@ -1059,6 +1254,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    'size_t'. */
 #undef SIZE_T_SUFFIX
 
+/* Define if the system is Solaris. */
+#undef SOLARIS2
+
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
    automatically deduced at runtime.
@@ -1082,6 +1280,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to use system malloc. */
 #undef SYSTEM_MALLOC
 
+/* The type of system you are compiling for; sets `system-type'. */
+#undef SYSTEM_TYPE
+
+/* Undocumented. */
+#undef TAB3
+
+/* Undocumented. */
+#undef TABDLY
+
 /* Define to 1 if you use terminfo instead of termcap. */
 #undef TERMINFO
 
@@ -1091,6 +1298,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if your <sys/time.h> declares `struct tm'. */
 #undef TM_IN_SYS_TIME
 
+/* Define to 1 if the type of the st_atim member of a struct stat is struct
+   timespec. */
+#undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC
+
+/* Undocumented. */
+#undef ULIMIT_BREAK_VALUE
+
 /* Define to 1 for Encore UMAX. */
 #undef UMAX
 
@@ -1098,12 +1312,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    <sys/cpustats.h>. */
 #undef UMAX4_3
 
+/* Define if the system has Unix98 PTYs. */
+#undef UNIX98_PTYS
+
 /* Define to 1 if using GTK. */
 #undef USE_GTK
 
-/* Define this to use a lisp union for the Lisp_Object data type. */
-#undef USE_LISP_UNION_TYPE
-
 /* Define to 1 if using the Lucid X toolkit. */
 #undef USE_LUCID
 
@@ -1122,6 +1336,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if using an X toolkit. */
 #undef USE_X_TOOLKIT
 
+/* Define if the system is compatible with System III. */
+#undef USG
+
+/* Define if the system is compatible with System V. */
+#undef USG5
+
+/* Define for USG systems where it works to open a pty's tty in the parent
+   process, then close and reopen it in the child. */
+#undef USG_SUBTTY_WORKS
+
 /* Version number of package */
 #undef VERSION
 
@@ -1151,10 +1375,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define this to check for malloc buffer overrun. */
 #undef XMALLOC_OVERRUN_CHECK
 
+/* Compensate for a bug in Xos.h on some systems, where it requires time.h. */
+#undef XOS_NEEDS_TIME_H
+
 /* Define to the type of the 6th arg of XRegisterIMInstantiateCallback, either
    XPointer or XPointer*. */
 #undef XRegisterIMInstantiateCallback_arg6
 
+/* Define if the system is AIX. */
+#undef _AIX
+
 /* Enable large inode numbers on Mac OS X.  */
 #ifndef _DARWIN_USE_64_BIT_INODE
 # define _DARWIN_USE_64_BIT_INODE 1
@@ -1163,6 +1393,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Number of bits in a file offset, on hosts where this is settable. */
 #undef _FILE_OFFSET_BITS
 
+/* enable compile-time and run-time bounds-checking, and some warnings */
+#undef _FORTIFY_SOURCE
+
+/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct
+   stat.st_size becomes 64-bit. */
+#undef _GL_WINDOWS_64_BIT_ST_SIZE
+
 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
 #undef _LARGEFILE_SOURCE
 
@@ -1175,12 +1412,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define if GNUstep uses ObjC exceptions. */
 #undef _NATIVE_OBJC_EXCEPTIONS
 
-/* The _Noreturn keyword of draft C1X.  */
-#ifndef _Noreturn
+/* The _Noreturn keyword of C11.  */
+#if ! (defined _Noreturn \
+       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif 1200 <= _MSC_VER
+# elif defined _MSC_VER && 1200 <= _MSC_VER
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
@@ -1192,9 +1430,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    this defined. */
 #undef _POSIX_1_SOURCE
 
-/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* Define to 1 if you need to in order for 'stat' and other things to work. */
 #undef _POSIX_SOURCE
 
+/* Needed for system_process_attributes on Solaris. */
+#undef _STRUCTURED_PROC
+
 /* Define to 500 only on HP-UX. */
 #undef _XOPEN_SOURCE
 
@@ -1202,7 +1443,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
-/* Enable general extensions on MacOS X.  */
+/* Enable general extensions on Mac OS X.  */
 #ifndef _DARWIN_C_SOURCE
 # undef _DARWIN_C_SOURCE
 #endif
@@ -1228,32 +1469,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    used. */
 #undef __GETOPT_PREFIX
 
-/* Define like PROTOTYPES; this can be used by system headers. */
-#undef __PROTOTYPES
-
-/* Ensure that <stdint.h> defines the limit macros, since gnulib's
-   <inttypes.h> relies on them.  */
-#if defined __cplusplus && !defined __STDC_LIMIT_MACROS && GL_TRIGGER_STDC_LIMIT_MACROS
-# define __STDC_LIMIT_MACROS 1
-#endif
-
-
 /* Define to compiler's equivalent of C99 restrict keyword in array
    declarations. Define as empty for no equivalent. */
 #undef __restrict_arr
 
-/* Define to the used machine dependent file. */
-#undef config_machfile
-
 /* Define to the used os dependent file. */
 #undef config_opsysfile
 
-/* Define to empty if `const' does not conform to ANSI C. */
-#undef const
-
 /* A replacement for va_copy, if needed.  */
 #define gl_va_copy(a,b) ((a) = (b))
 
+/* Define to rpl_gmtime if the replacement function should be used. */
+#undef gmtime
+
 /* Define to `__inline__' or `__inline' if that's what the C compiler
    calls it, or to nothing if 'inline' is not supported under any name.  */
 #ifndef __cplusplus
@@ -1263,13 +1491,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
    the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
    earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
-   __APPLE__ && __MACH__ test for MacOS X.
+   __APPLE__ && __MACH__ test for Mac OS X.
    __APPLE_CC__ tests for the Apple compiler and its version.
    __STDC_VERSION__ tests for the C99 mode.  */
 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
 # define __GNUC_STDC_INLINE__ 1
 #endif
 
+/* Define to 1 if the compiler is checking for lint. */
+#undef lint
+
+/* Define to rpl_localtime if the replacement function should be used. */
+#undef localtime
+
 /* Define to a type if <wchar.h> does not define. */
 #undef mbstate_t
 
@@ -1341,10 +1575,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define as `fork' if `vfork' does not work. */
 #undef vfork
 
-/* Define to empty if the keyword `volatile' does not work. Warning: valid
-   code using `volatile' can become incorrect without. Disable with care. */
-#undef volatile
-
 
 /* On AIX 3 this must be included before any other include file.  */
 #include <alloca.h>
@@ -1352,6 +1582,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 # error "alloca not available on this machine"
 #endif
 
+/* This silences a few compilation warnings on FreeBSD.  */
+#ifdef BSD_SYSTEM_AHB
+#undef BSD_SYSTEM_AHB
+#undef BSD_SYSTEM
+#if __FreeBSD__ == 1
+#define BSD_SYSTEM 199103
+#elif __FreeBSD__ == 2
+#define BSD_SYSTEM 199306
+#elif __FreeBSD__ >= 3
+#define BSD_SYSTEM 199506
+#endif
+#endif
+
 /* Define AMPERSAND_FULL_NAME if you use the convention
    that & in the full name stands for the login id.  */
 /* Turned on June 1996 supposing nobody will mind it.  */
@@ -1365,19 +1608,19 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #define subprocesses
 
-/* Include the os and machine dependent files.  */
-#include config_opsysfile
-#ifdef config_machfile
-# include config_machfile
+/* Include the os dependent file.  */
+#ifdef config_opsysfile
+# include config_opsysfile
 #endif
 
-/* GNUstep needs a bit more pure memory.  Of the existing knobs,
-   SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.
-  (There is probably a better place to do this, but right now the
-   Cocoa side does this in s/darwin.h and we cannot parallel this
-   exactly since GNUstep is multi-OS.  */
-#if defined HAVE_NS && defined NS_IMPL_GNUSTEP
+/* Mac OS X / GNUstep need a bit more pure memory.  Of the existing knobs,
+   SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
+#ifdef HAVE_NS
+#if defined NS_IMPL_GNUSTEP
 #  define SYSTEM_PURESIZE_EXTRA 30000
+#elif defined DARWIN_OS
+#  define SYSTEM_PURESIZE_EXTRA 200000
+#endif
 #endif
 
 #ifdef emacs /* Don't do this for lib-src.  */
@@ -1393,48 +1636,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 #endif
 
-/* These default definitions are good for almost all machines.
-   Any exceptions should override them in m/MACHINE.h.
-   They must be usable in preprocessor conditionals.  */
-
-#ifndef BITS_PER_CHAR
-#define BITS_PER_CHAR 8
-#endif
-
-#ifndef BITS_PER_SHORT
-#define BITS_PER_SHORT 16
-#endif
-
-#ifndef BITS_PER_INT
-#define BITS_PER_INT 32
-#endif
-
-#ifndef BITS_PER_LONG
-#ifdef _LP64
-#define BITS_PER_LONG 64
-#else
-#define BITS_PER_LONG 32
-#endif
-#endif
-
-#if !defined BITS_PER_LONG_LONG && HAVE_LONG_LONG_INT
-#define BITS_PER_LONG_LONG 64
-#endif
-
-/* Define if the compiler supports function prototypes.  It may do so but
-   not define __STDC__ (e.g. DEC C by default) or may define it as zero.  */
-#undef PROTOTYPES
-
 #include <string.h>
 #include <stdlib.h>
 
-#if defined __GNUC__ && (__GNUC__ > 2 \
-                         || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
-#define NO_RETURN      __attribute__ ((__noreturn__))
-#else
-#define NO_RETURN      /* nothing */
-#endif
-
 #if __GNUC__ >= 3  /* On GCC 3.0 we might get a warning.  */
 #define NO_INLINE __attribute__((noinline))
 #else
@@ -1461,20 +1665,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
 #endif
 
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+
 /* Some versions of GNU/Linux define noinline in their headers.  */
 #ifdef noinline
 #undef noinline
 #endif
 
-/* These won't be used automatically yet.  We also need to know, at least,
-   that the stack is continuous.  */
-#ifdef __GNUC__
-#  ifndef GC_SETJMP_WORKS
-  /* GC_SETJMP_WORKS is nearly always appropriate for GCC.  */
-#    define GC_SETJMP_WORKS 1
-#  endif
-#endif
-
 #endif /* EMACS_CONFIG_H */
 
 /*
index 33576638fddd6029f51ffda56bc13cec69364981..784b10593aab4cc4e30b11509d18e87e5ef56945 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.65 for emacs 24.1.
+# Generated by GNU Autoconf 2.65 for emacs 24.1.50.
 #
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -549,8 +549,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='emacs'
 PACKAGE_TARNAME='emacs'
-PACKAGE_VERSION='24.1'
-PACKAGE_STRING='emacs 24.1'
+PACKAGE_VERSION='24.1.50'
+PACKAGE_STRING='emacs 24.1.50'
 PACKAGE_BUGREPORT=''
 PACKAGE_URL=''
 
@@ -618,8 +618,6 @@ gl_GNULIB_ENABLED_strtoll_FALSE
 gl_GNULIB_ENABLED_strtoll_TRUE
 gl_GNULIB_ENABLED_stat_FALSE
 gl_GNULIB_ENABLED_stat_TRUE
-gl_GNULIB_ENABLED_sigprocmask_FALSE
-gl_GNULIB_ENABLED_sigprocmask_TRUE
 gl_GNULIB_ENABLED_pathmax_FALSE
 gl_GNULIB_ENABLED_pathmax_TRUE
 gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_FALSE
@@ -628,6 +626,7 @@ gl_GNULIB_ENABLED_dosname_FALSE
 gl_GNULIB_ENABLED_dosname_TRUE
 LTLIBINTL
 LIBINTL
+WINDOWS_64_BIT_OFF_T
 HAVE_UNISTD_H
 NEXT_AS_FIRST_DIRECTIVE_UNISTD_H
 NEXT_UNISTD_H
@@ -636,6 +635,7 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC
 TIME_H_DEFINES_STRUCT_TIMESPEC
 NEXT_AS_FIRST_DIRECTIVE_TIME_H
 NEXT_TIME_H
+WINDOWS_64_BIT_ST_SIZE
 NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H
 NEXT_SYS_STAT_H
 NEXT_AS_FIRST_DIRECTIVE_STDLIB_H
@@ -719,7 +719,6 @@ GNULIB_PERROR
 GNULIB_PCLOSE
 GNULIB_OBSTACK_PRINTF_POSIX
 GNULIB_OBSTACK_PRINTF
-GNULIB_GETS
 GNULIB_GETLINE
 GNULIB_GETDELIM
 GNULIB_GETCHAR
@@ -760,8 +759,12 @@ GL_GENERATE_STDARG_H_TRUE
 STDARG_H
 NEXT_AS_FIRST_DIRECTIVE_STDARG_H
 NEXT_STDARG_H
+GL_GENERATE_STDALIGN_H_FALSE
+GL_GENERATE_STDALIGN_H_TRUE
+STDALIGN_H
 NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H
 NEXT_SIGNAL_H
+LIB_PTHREAD_SIGMASK
 REPLACE_RAISE
 REPLACE_PTHREAD_SIGMASK
 HAVE_SIGHANDLER_T
@@ -778,7 +781,14 @@ GNULIB_SIGPROCMASK
 GNULIB_SIGNAL_H_SIGPIPE
 GNULIB_RAISE
 GNULIB_PTHREAD_SIGMASK
-LIB_PTHREAD_SIGMASK
+HAVE_SYS_SELECT_H
+NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H
+NEXT_SYS_SELECT_H
+REPLACE_SELECT
+REPLACE_PSELECT
+HAVE_PSELECT
+GNULIB_SELECT
+GNULIB_PSELECT
 REPLACE_TIMEGM
 REPLACE_NANOSLEEP
 REPLACE_MKTIME
@@ -833,6 +843,7 @@ PRIPTR_PREFIX
 PRI_MACROS_BROKEN
 INT64_MAX_EQ_LONG_MAX
 INT32_MAX_LT_INTMAX_MAX
+REPLACE_STRTOIMAX
 HAVE_DECL_STRTOUMAX
 HAVE_DECL_STRTOIMAX
 HAVE_DECL_IMAXDIV
@@ -868,6 +879,16 @@ HAVE_INTTYPES_H
 HAVE_WCHAR_H
 HAVE_UNSIGNED_LONG_LONG_INT
 HAVE_LONG_LONG_INT
+HAVE_WINSOCK2_H
+NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H
+NEXT_SYS_TIME_H
+REPLACE_STRUCT_TIMEVAL
+REPLACE_GETTIMEOFDAY
+HAVE_SYS_TIME_H
+HAVE_STRUCT_TIMEVAL
+HAVE_GETTIMEOFDAY
+GNULIB_GETTIMEOFDAY
+GNULIB_GL_UNISTD_H_GETOPT
 GETOPT_H
 HAVE_GETOPT_H
 NEXT_AS_FIRST_DIRECTIVE_GETOPT_H
@@ -883,7 +904,9 @@ REPLACE_STRTOD
 REPLACE_SETENV
 REPLACE_REALPATH
 REPLACE_REALLOC
+REPLACE_RANDOM_R
 REPLACE_PUTENV
+REPLACE_PTSNAME_R
 REPLACE_MKSTEMP
 REPLACE_MBTOWC
 REPLACE_MALLOC
@@ -902,7 +925,10 @@ HAVE_RPMATCH
 HAVE_REALPATH
 HAVE_RANDOM_R
 HAVE_RANDOM_H
+HAVE_RANDOM
+HAVE_PTSNAME_R
 HAVE_PTSNAME
+HAVE_POSIX_OPENPT
 HAVE_MKSTEMPS
 HAVE_MKSTEMP
 HAVE_MKOSTEMPS
@@ -926,8 +952,11 @@ GNULIB_RPMATCH
 GNULIB_REALPATH
 GNULIB_REALLOC_POSIX
 GNULIB_RANDOM_R
+GNULIB_RANDOM
 GNULIB_PUTENV
+GNULIB_PTSNAME_R
 GNULIB_PTSNAME
+GNULIB_POSIX_OPENPT
 GNULIB_MKSTEMPS
 GNULIB_MKSTEMP
 GNULIB_MKOSTEMPS
@@ -960,11 +989,13 @@ REPLACE_LSEEK
 REPLACE_LINKAT
 REPLACE_LINK
 REPLACE_LCHOWN
+REPLACE_ISATTY
 REPLACE_GETPAGESIZE
 REPLACE_GETGROUPS
 REPLACE_GETLOGIN_R
 REPLACE_GETDOMAINNAME
 REPLACE_GETCWD
+REPLACE_FTRUNCATE
 REPLACE_FCHOWNAT
 REPLACE_DUP2
 REPLACE_DUP
@@ -973,6 +1004,7 @@ REPLACE_CHOWN
 HAVE_SYS_PARAM_H
 HAVE_OS_H
 HAVE_DECL_TTYNAME_R
+HAVE_DECL_SETHOSTNAME
 HAVE_DECL_GETUSERSHELL
 HAVE_DECL_GETPAGESIZE
 HAVE_DECL_GETLOGIN_R
@@ -985,6 +1017,7 @@ HAVE_UNLINKAT
 HAVE_SYMLINKAT
 HAVE_SYMLINK
 HAVE_SLEEP
+HAVE_SETHOSTNAME
 HAVE_READLINKAT
 HAVE_READLINK
 HAVE_PWRITE
@@ -1016,11 +1049,11 @@ GNULIB_UNLINKAT
 GNULIB_UNLINK
 GNULIB_UNISTD_H_SIGPIPE
 GNULIB_UNISTD_H_NONBLOCKING
-GNULIB_UNISTD_H_GETOPT
 GNULIB_TTYNAME_R
 GNULIB_SYMLINKAT
 GNULIB_SYMLINK
 GNULIB_SLEEP
+GNULIB_SETHOSTNAME
 GNULIB_RMDIR
 GNULIB_READLINKAT
 GNULIB_READLINK
@@ -1033,6 +1066,7 @@ GNULIB_LSEEK
 GNULIB_LINKAT
 GNULIB_LINK
 GNULIB_LCHOWN
+GNULIB_ISATTY
 GNULIB_GROUP_MEMBER
 GNULIB_GETUSERSHELL
 GNULIB_GETPAGESIZE
@@ -1057,6 +1091,7 @@ GNULIB_DUP
 GNULIB_CLOSE
 GNULIB_CHOWN
 GNULIB_CHDIR
+LIB_CLOCK_GETTIME
 GL_GENERATE_ALLOCA_H_FALSE
 GL_GENERATE_ALLOCA_H_TRUE
 ALLOCA_H
@@ -1085,9 +1120,8 @@ ns_appresdir
 ns_appbindir
 ns_appdir
 S_FILE
-M_FILE
 X_TOOLKIT_TYPE
-C_SWITCH_X_SYSTEM
+GNUSTEP_CFLAGS
 C_SWITCH_X_SITE
 LD_SWITCH_X_SITE
 gameuser
@@ -1098,6 +1132,8 @@ etcdir
 x_default_search_path
 lisppath
 locallisppath
+standardlisppath
+leimdir
 lispdir
 srcdir
 canonical
@@ -1162,17 +1198,18 @@ HAVE_XSERVER
 LIB_STANDARD
 NS_OBJC_OBJ
 NS_OBJ
+ns_self_contained
+INSTALL_ARCH_INDEP_EXTRA
 TEMACS_LDFLAGS2
-LD_SWITCH_X_SITE_AUX_RPATH
-LD_SWITCH_X_SITE_AUX
+LD_SWITCH_X_SITE_RPATH
 XMKMF
 DEPFLAGS
 MKDEPDIR
 CFLAGS_SOUND
 ALSA_LIBS
 ALSA_CFLAGS
-PKG_CONFIG
 LIBSOUND
+PKG_CONFIG
 CRT_DIR
 START_FILES
 LIB_MATH
@@ -1182,10 +1219,15 @@ UNEXEC_OBJ
 C_SWITCH_MACHINE
 LD_SWITCH_SYSTEM
 CANNOT_DUMP
+INFO_OPTS
+INFO_EXT
 HAVE_MAKEINFO
+PAXCTL
 GZIP_PROG
 INSTALL_INFO
-C_WARNINGS_SWITCH
+GNULIB_WARN_CFLAGS
+WARN_CFLAGS
+WERROR_CFLAGS
 RANLIB
 ARFLAGS
 AR
@@ -1217,7 +1259,6 @@ build_vendor
 build_cpu
 build
 PROFILING_CFLAGS
-MAINT
 GZIP_INFO
 cache_file
 am__untar
@@ -1325,15 +1366,15 @@ with_crt_dir
 with_gameuser
 with_gnustep_conf
 enable_ns_self_contained
-enable_asserts
-enable_maintainer_mode
 enable_locallisppath
 enable_checking
-enable_use_lisp_union_type
+enable_check_lisp_object_type
 enable_profiling
 enable_autodepend
 enable_dependency_tracking
 enable_largefile
+enable_gcc_warnings
+enable_link_time_optimization
 with_x
 '
       ac_precious_vars='build_alias
@@ -1887,7 +1928,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures emacs 24.1 to adapt to many kinds of systems.
+\`configure' configures emacs 24.1.50 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1961,7 +2002,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of emacs 24.1:";;
+     short | recursive ) echo "Configuration of emacs 24.1.50:";;
    esac
   cat <<\_ACEOF
 
@@ -1971,10 +2012,6 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-ns-self-contained
                           disable self contained build under NeXTstep
-  --enable-asserts        compile code with asserts enabled
-  --disable-maintainer-mode
-                          disable make rules and dependencies not useful (and
-                          sometimes confusing) to the casual installer
   --enable-locallisppath=PATH
                           directories Emacs should search for lisp files
                           specific to this site
@@ -1982,11 +2019,11 @@ Optional Features:
                           enable expensive run-time checks. With LIST, enable
                           only specific categories of checks. Categories are:
                           all,yes,no. Flags are: stringbytes, stringoverrun,
-                          stringfreelist, xmallocoverrun, conslist
-  --enable-use-lisp-union-type
-                          use a union for the Lisp_Object data type. This is
-                          only useful for development for catching certain
-                          types of bugs.
+                          stringfreelist, xmallocoverrun, conslist, glyphs
+  --enable-check-lisp-object-type
+                          enable compile time checks for the Lisp_Object data
+                          type. This is useful for development for catching
+                          certain types of bugs.
   --enable-profiling      build emacs with profiling support. This might not
                           work on all platforms
   --enable-autodepend     automatically generate dependencies to .h-files.
@@ -1995,6 +2032,12 @@ Optional Features:
   --disable-dependency-tracking  speeds up one-time build
   --enable-dependency-tracking   do not reject slow dependency extractors
   --disable-largefile     omit support for large files
+  --enable-gcc-warnings   turn on lots of GCC warnings. This is intended for
+                          developers, and may generate false alarms when used
+                          with older or non-GNU development tools.
+  --enable-link-time-optimization
+                          build emacs with link-time optimization. This is
+                          supported only for GCC since 4.5.0.
 
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
@@ -2124,7 +2167,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-emacs configure 24.1
+emacs configure 24.1.50
 generated by GNU Autoconf 2.65
 
 Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2487,6 +2530,63 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_header_preproc
 
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_member
+
 # ac_fn_c_check_func LINENO FUNC VAR
 # ----------------------------------
 # Tests whether FUNC exists, setting the cache variable VAR accordingly
@@ -2554,63 +2654,6 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_func
 
-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
-# ----------------------------------------------------
-# Tries to find if the field MEMBER exists in type AGGR, after including
-# INCLUDES, setting cache variable VAR accordingly.
-ac_fn_c_check_member ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
-$as_echo_n "checking for $2.$3... " >&6; }
-if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (sizeof ac_aggr.$3)
-return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  eval "$4=yes"
-else
-  eval "$4=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$4
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
-
-} # ac_fn_c_check_member
-
 # ac_fn_c_check_type LINENO TYPE VAR INCLUDES
 # -------------------------------------------
 # Tests whether TYPE exists after having included INCLUDES, setting cache
@@ -2846,7 +2889,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by emacs $as_me 24.1, which was
+It was created by emacs $as_me 24.1.50, which was
 generated by GNU Autoconf 2.65.  Invocation command line was
 
   $ $0 $@
@@ -3125,27 +3168,54 @@ $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
+as_fn_append ac_header_list " linux/version.h"
+as_fn_append ac_header_list " sys/systeminfo.h"
+as_fn_append ac_header_list " stdio_ext.h"
+as_fn_append ac_header_list " fcntl.h"
+as_fn_append ac_header_list " coff.h"
+as_fn_append ac_header_list " pty.h"
+as_fn_append ac_header_list " sys/vlimit.h"
+as_fn_append ac_header_list " sys/resource.h"
+as_fn_append ac_header_list " sys/utsname.h"
+as_fn_append ac_header_list " pwd.h"
+as_fn_append ac_header_list " utmp.h"
+as_fn_append ac_header_list " dirent.h"
+as_fn_append ac_header_list " util.h"
+as_fn_append ac_header_list " sys/socket.h"
 as_fn_append ac_header_list " stdlib.h"
 as_fn_append ac_header_list " unistd.h"
 as_fn_append ac_header_list " sys/param.h"
+as_fn_append ac_header_list " pthread.h"
+as_fn_append ac_header_list " malloc/malloc.h"
+as_fn_append ac_header_list " maillock.h"
+as_fn_append ac_header_list " sys/un.h"
+as_fn_append ac_func_list " tzset"
 as_fn_append ac_func_list " readlinkat"
 gl_getopt_required=GNU
 as_fn_append ac_header_list " getopt.h"
+as_fn_append ac_func_list " gettimeofday"
+as_fn_append ac_func_list " nanotime"
+as_fn_append ac_header_list " sys/time.h"
 as_fn_append ac_header_list " wchar.h"
 as_fn_append ac_header_list " stdint.h"
 as_fn_append ac_header_list " inttypes.h"
 as_fn_append ac_func_list " lstat"
 as_fn_append ac_func_list " alarm"
+as_fn_append ac_header_list " sys/select.h"
+as_fn_append ac_func_list " pselect"
 as_fn_append ac_func_list " pthread_sigmask"
 as_fn_append ac_func_list " readlink"
-as_fn_append ac_header_list " sys/socket.h"
-as_fn_append ac_func_list " tzset"
 as_fn_append ac_func_list " strtoimax"
 as_fn_append ac_func_list " strtoumax"
 as_fn_append ac_func_list " symlink"
 as_fn_append ac_header_list " sys/stat.h"
-as_fn_append ac_header_list " sys/time.h"
 as_fn_append ac_func_list " localtime_r"
+as_fn_append ac_header_list " utime.h"
+as_fn_append ac_func_list " futimes"
+as_fn_append ac_func_list " futimesat"
+as_fn_append ac_func_list " futimens"
+as_fn_append ac_func_list " utimensat"
+as_fn_append ac_func_list " lutimes"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -3679,7 +3749,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='emacs'
- VERSION='24.1'
+ VERSION='24.1.50'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -3723,9 +3793,11 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
 
 
 lispdir='${datadir}/emacs/${version}/lisp'
+leimdir='${datadir}/emacs/${version}/leim'
+standardlisppath='${lispdir}:${leimdir}'
 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
 '${datadir}/emacs/site-lisp'
-lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
+lisppath='${locallisppath}:${standardlisppath}'
 etcdir='${datadir}/emacs/${version}/etc'
 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
 docdir='${datadir}/emacs/${version}/etc'
@@ -4143,28 +4215,6 @@ else
 fi
 
 
-# Check whether --enable-asserts was given.
-if test "${enable_asserts+set}" = set; then :
-  enableval=$enable_asserts; USE_XASSERTS=$enableval
-else
-  USE_XASSERTS=no
-fi
-
-
-# Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then :
-  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
-else
-  USE_MAINTAINER_MODE=yes
-fi
-
-if test $USE_MAINTAINER_MODE = yes; then
-  MAINT=
-else
-  MAINT=#
-fi
-
-
 # Check whether --enable-locallisppath was given.
 if test "${enable_locallisppath+set}" = set; then :
   enableval=$enable_locallisppath; if test "${enableval}" = "no"; then
@@ -4191,19 +4241,22 @@ do
                        ac_gc_check_string_overrun= ;
                        ac_gc_check_string_free_list= ;
                        ac_xmalloc_overrun= ;
-                       ac_gc_check_cons_list= ;;
+                       ac_gc_check_cons_list= ;
+                       ac_glyphs_debug= ;;
        all)            ac_enable_checking=1 ;
                        ac_gc_check_stringbytes=1 ;
                        ac_gc_check_string_overrun=1 ;
                        ac_gc_check_string_free_list=1 ;
                        ac_xmalloc_overrun=1 ;
-                       ac_gc_check_cons_list=1 ;;
+                       ac_gc_check_cons_list=1 ;
+                       ac_glyphs_debug=1 ;;
        # these enable particular checks
        stringbytes)    ac_gc_check_stringbytes=1 ;;
        stringoverrun)  ac_gc_check_string_overrun=1 ;;
        stringfreelist) ac_gc_check_string_free_list=1 ;;
        xmallocoverrun) ac_xmalloc_overrun=1 ;;
        conslist)       ac_gc_check_cons_list=1 ;;
+       glyphs)         ac_glyphs_debug=1 ;;
        *)      as_fn_error "unknown check category $check" "$LINENO" 5 ;;
        esac
 done
@@ -4238,13 +4291,18 @@ if test x$ac_gc_check_cons_list != x ; then
 
 $as_echo "#define GC_CHECK_CONS_LIST 1" >>confdefs.h
 
+fi
+if test x$ac_glyphs_debug != x ; then
+
+$as_echo "#define GLYPH_DEBUG 1" >>confdefs.h
+
 fi
 
-# Check whether --enable-use-lisp-union-type was given.
-if test "${enable_use_lisp_union_type+set}" = set; then :
-  enableval=$enable_use_lisp_union_type; if test "${enableval}" != "no"; then
+# Check whether --enable-check-lisp-object-type was given.
+if test "${enable_check_lisp_object_type+set}" = set; then :
+  enableval=$enable_check_lisp_object_type; if test "${enableval}" != "no"; then
 
-$as_echo "#define USE_LISP_UNION_TYPE 1" >>confdefs.h
+$as_echo "#define CHECK_LISP_OBJECT_TYPE 1" >>confdefs.h
 
 fi
 fi
@@ -4295,8 +4353,8 @@ case "${srcdir}" in
   *  ) srcdir="`(cd ${srcdir}; pwd)`" ;;
 esac
 
-#### Given the configuration name, set machfile and opsysfile to the
-#### names of the m/*.h and s/*.h files we should use.
+#### Given the configuration name, set opsysfile to the
+#### name of s/*.h file we should use.
 
 ### Canonicalize the configuration name.
 
@@ -4378,13 +4436,11 @@ configuration=${host_alias-${build_alias-$host}}
 
 ### If you add support for a new configuration, add code to this
 ### switch statement to recognize your configuration name and select
-### the appropriate operating system and machine description files.
+### the appropriate operating system file.
 
-### You would hope that you could choose an m/*.h file pretty much
-### based on the machine portion of the configuration name, and an s/*.h
+### You would hope that you could choose an s/*.h
 ### file based on the operating system portion.  However, it turns out
-### that each m/*.h file is pretty manufacturer-specific - for
-### example mips.h is MIPS
+### that each s/*.h file is pretty manufacturer-specific.
 ### So we basically have to have a special case for each
 ### configuration name.
 ###
@@ -4394,95 +4450,49 @@ configuration=${host_alias-${build_alias-$host}}
 ### prepared to handle anything reasonably.  If version numbers
 ### matter, be sure /etc/MACHINES says something about it.
 
-machine='' opsys='' unported=no
+opsys='' unported=no
 case "${canonical}" in
 
   ## GNU/Linux and similar ports
   *-*-linux* )
     opsys=gnu-linux
-    case ${canonical} in
-      alpha*)  machine=alpha ;;
-      s390x-*) machine=ibms390x ;;
-      powerpc*)        machine=macppc ;;
-      sparc*)  machine=sparc ;;
-      ia64*)   machine=ia64 ;;
-      m68k*)   machine=m68k ;;
-      x86_64*) machine=amdx86-64 ;;
-    esac
   ;;
 
   ## FreeBSD ports
   *-*-freebsd* )
     opsys=freebsd
-    case "${canonical}" in
-      alpha*)           machine=alpha ;;
-      amd64-*|x86_64-*) machine=amdx86-64 ;;
-      ia64-*)           machine=ia64 ;;
-      i[3456]86-*)      machine=intel386 ;;
-      powerpc-*)        machine=macppc ;;
-      sparc-*)          machine=sparc ;;
-      sparc64-*)        machine=sparc ;;
-    esac
   ;;
 
   ## FreeBSD kernel + glibc based userland
   *-*-kfreebsd*gnu* )
     opsys=gnu-kfreebsd
-    case "${canonical}" in
-      alpha*)           machine=alpha ;;
-      amd64-*|x86_64-*) machine=amdx86-64 ;;
-      ia64-*)           machine=ia64 ;;
-      i[3456]86-*)      machine=intel386 ;;
-      powerpc-*)        machine=macppc ;;
-      sparc-*)          machine=sparc ;;
-      sparc64-*)        machine=sparc ;;
-    esac
   ;;
 
   ## NetBSD ports
   *-*-netbsd* )
     opsys=netbsd
-    case "${canonical}" in
-      alpha*)      machine=alpha ;;
-      x86_64-*)    machine=amdx86-64 ;;
-      i[3456]86-*) machine=intel386 ;;
-      m68k-*)      machine=m68k ;;
-      powerpc-*)   machine=macppc ;;
-      sparc*-)     machine=sparc ;;
-      vax-*)       machine=vax ;;
-    esac
   ;;
 
   ## OpenBSD ports
   *-*-openbsd* )
     opsys=openbsd
-    case "${canonical}" in
-      alpha*)    machine=alpha ;;
-      x86_64-*)  machine=amdx86-64 ;;
-      i386-*)    machine=intel386 ;;
-      powerpc-*) machine=macppc ;;
-      sparc*)    machine=sparc ;;
-      vax-*)     machine=vax ;;
-    esac
   ;;
 
   ## Apple Darwin / Mac OS X
   *-apple-darwin* )
     case "${canonical}" in
-      i[3456]86-* )  machine=intel386 ;;
-      powerpc-* )    machine=macppc ;;
-      x86_64-* )     machine=amdx86-64 ;;
+      i[3456]86-* )  ;;
+      powerpc-* )    ;;
+      x86_64-* )     ;;
       * )            unported=yes ;;
     esac
     opsys=darwin
-    # Define CPP as follows to make autoconf work correctly.
-    CPP="${CC-cc} -E -no-cpp-precomp"
-    # Use fink packages if available.
-    if test -d /sw/include && test -d /sw/lib; then
-      GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
-      CPP="${CPP} ${GCC_TEST_OPTIONS}"
-      NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
-    fi
+    ## Use fink packages if available.
+    ## FIXME find a better way to do this: http://debbugs.gnu.org/11507
+##    if test -d /sw/include && test -d /sw/lib; then
+##      GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
+##      NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
+##    fi
   ;;
 
   ## HP 9000 series 700 and 800, running HP/UX
@@ -4496,16 +4506,16 @@ case "${canonical}" in
 
   ## IBM machines
   rs6000-ibm-aix4.[23]* )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
   powerpc-ibm-aix4.[23]*  )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
   rs6000-ibm-aix[56]* )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
   powerpc-ibm-aix[56]*  )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
 
   ## Silicon Graphics machines
@@ -4515,7 +4525,6 @@ case "${canonical}" in
     # Without defining _LANGUAGE_C, things get masked out in the headers
     # so that, for instance, grepping for `free' in stdlib.h fails and
     # AC_HEADER_STD_C fails.   (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
-    NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
     NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
   ;;
 
@@ -4524,26 +4533,23 @@ case "${canonical}" in
     | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
     | x86_64-*-solaris2*    | x86_64-*-sunos5*)
     case "${canonical}" in
-      i[3456]86-*-* )     machine=intel386 ;;
-      amd64-*-*|x86_64-*-*)    machine=amdx86-64 ;;
-      sparc* )         machine=sparc ;;
+      i[3456]86-*-* )   ;;
+      amd64-*-*|x86_64-*-*) ;;
+      sparc* )         ;;
       * )              unported=yes ;;
     esac
     case "${canonical}" in
       *-sunos5.6* | *-solaris2.6* )
                opsys=sol2-6
-               NON_GNU_CPP=/usr/ccs/lib/cpp
                RANLIB="ar -ts"
                ;;
       *-sunos5.[7-9]* | *-solaris2.[7-9]* )
                opsys=sol2-6
                emacs_check_sunpro_c=yes
-               NON_GNU_CPP=/usr/ccs/lib/cpp
                ;;
       *-sunos5* | *-solaris* )
                opsys=sol2-10
                emacs_check_sunpro_c=yes
-               NON_GNU_CPP=/usr/ccs/lib/cpp
                ;;
     esac
     ## Watch out for a compiler that we know will not work.
@@ -4561,15 +4567,12 @@ case "${canonical}" in
 
   ## Intel 386 machines where we don't care about the manufacturer.
   i[3456]86-*-* )
-    machine=intel386
     case "${canonical}" in
       *-cygwin )                opsys=cygwin ;;
-      *-darwin* )               opsys=darwin
-                                CPP="${CC-cc} -E -no-cpp-precomp"
-                               ;;
-      *-sysv4.2uw* )           opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
-      *-sysv5uw* )             opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
-      *-sysv5OpenUNIX* )       opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
+      *-darwin* )               opsys=darwin ;;
+      *-sysv4.2uw* )           opsys=unixware ;;
+      *-sysv5uw* )             opsys=unixware ;;
+      *-sysv5OpenUNIX* )       opsys=unixware ;;
       ## Otherwise, we'll fall through to the generic opsys code at the bottom.
     esac
   ;;
@@ -4601,19 +4604,10 @@ if test $unported = yes; then
 Check \`etc/MACHINES' for recognized configuration names." "$LINENO" 5
 fi
 
-if test -n "$machine"; then
-  machfile="m/${machine}.h"
-else
-  machfile=
-fi
 opsysfile="s/${opsys}.h"
 
 
 #### Choose a compiler.
-test -n "$CC" && cc_specified=yes
-
-# Save the value of CFLAGS that the user specified.
-SPECIFIED_CFLAGS="$CFLAGS"
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -5722,7 +5716,13 @@ fi
 
 
 
-# Initialize gnulib right after verifying that the C compiler works.
+if test x$GCC = xyes; then
+  test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
+else
+  test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
+fi
+
+# Initialize gnulib right after choosing the compiler.
 
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -6936,13 +6936,17 @@ esac
 
   # Code from module alloca-opt:
   # Code from module allocator:
+  # Code from module c-ctype:
+  # Code from module c-strcase:
   # Code from module careadlinkat:
+  # Code from module clock-time:
   # Code from module crypto/md5:
   # Code from module crypto/sha1:
   # Code from module crypto/sha256:
   # Code from module crypto/sha512:
   # Code from module dosname:
   # Code from module dtoastr:
+  # Code from module dtotimespec:
   # Code from module dup2:
   # Code from module extensions:
 
@@ -6951,6 +6955,8 @@ esac
   # Code from module getopt-gnu:
   # Code from module getopt-posix:
   # Code from module gettext-h:
+  # Code from module gettime:
+  # Code from module gettimeofday:
   # Code from module ignore-value:
   # Code from module include_next:
   # Code from module intprops:
@@ -6958,14 +6964,15 @@ esac
   # Code from module largefile:
 
   # Code from module lstat:
+  # Code from module manywarnings:
   # Code from module mktime:
   # Code from module multiarch:
   # Code from module nocrash:
   # Code from module pathmax:
+  # Code from module pselect:
   # Code from module pthread_sigmask:
   # Code from module readlink:
   # Code from module signal-h:
-  # Code from module sigprocmask:
   # Code from module snippet/_Noreturn:
   # Code from module snippet/arg-nonnull:
   # Code from module snippet/c++defs:
@@ -6973,6 +6980,8 @@ esac
   # Code from module socklen:
   # Code from module ssize_t:
   # Code from module stat:
+  # Code from module stat-time:
+  # Code from module stdalign:
   # Code from module stdarg:
 
 
@@ -6988,88 +6997,108 @@ esac
   # Code from module strtoull:
   # Code from module strtoumax:
   # Code from module symlink:
+  # Code from module sys_select:
   # Code from module sys_stat:
+  # Code from module sys_time:
   # Code from module time:
   # Code from module time_r:
+  # Code from module timespec:
+  # Code from module timespec-add:
+  # Code from module timespec-sub:
   # Code from module u64:
   # Code from module unistd:
+  # Code from module utimens:
   # Code from module verify:
+  # Code from module warnings:
 
 
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
+# Check whether --enable-gcc-warnings was given.
+if test "${enable_gcc_warnings+set}" = set; then :
+  enableval=$enable_gcc_warnings; case $enableval in
+     yes|no) ;;
+     *)      as_fn_error "bad value $enableval for gcc-warnings option" "$LINENO" 5 ;;
+   esac
+   gl_gcc_warnings=$enableval
+else
+  gl_gcc_warnings=no
+
 fi
 
-## If not using gcc, and on Solaris, and no CPP specified, see if
-## using a Sun compiler, which needs -Xs to prevent whitespace.
-if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
- test x"$CPP" = x; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using a Sun C compiler" >&5
-$as_echo_n "checking whether we are using a Sun C compiler... " >&6; }
-  if test "${emacs_cv_sunpro_c+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+# Check whether --enable-link-time-optimization was given.
+if test "${enable_link_time_optimization+set}" = set; then :
+  enableval=$enable_link_time_optimization; if test "${enableval}" != "no"; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether link-time optimization is supported" >&5
+$as_echo_n "checking whether link-time optimization is supported... " >&6; }
+   ac_lto_supported=no
+   if test x$GCC = xyes; then
+      CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
+      if test x$CPUS != x; then
+        LTO="-flto=$CPUS"
+      else
+        LTO="-flto"
+      fi
+      old_CFLAGS=$CFLAGS
+      CFLAGS="$CFLAGS $LTO"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
-#ifndef __SUNPRO_C
-fail;
-#endif
 
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  emacs_cv_sunpro_c=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_lto_supported=yes
 else
-  emacs_cv_sunpro_c=no
+  ac_lto_supported=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      CFLAGS="$old_CFLAGS"
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_lto_supported" >&5
+$as_echo "$ac_lto_supported" >&6; }
+   if test "$ac_lto_supported" = "yes"; then
+      CFLAGS="$CFLAGS $LTO"
+   fi
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
 fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_sunpro_c" >&5
-$as_echo "$emacs_cv_sunpro_c" >&6; }
 
-  if test x"$emacs_cv_sunpro_c" = xyes; then
-    NON_GNU_CPP="$CC -E -Xs"
-  fi
-fi
+# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
+# ------------------------------------------------
+# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
+# Otherwise, run RUN-IF-NOT-FOUND.
 
-#### Some systems specify a CPP to use unless we are using GCC.
-#### Now that we know whether we are using GCC, we can decide whether
-#### to use that one.
-if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
-then
-  CPP="$NON_GNU_CPP"
-fi
 
-#### Some systems specify a CC to use unless we are using GCC.
-#### Now that we know whether we are using GCC, we can decide whether
-#### to use that one.
-if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
-  test x$cc_specified != xyes
-then
-  CC="$NON_GNU_CC"
-fi
+# When compiling with GCC, prefer -isystem to -I when including system
+# include files, to avoid generating useless diagnostics for the files.
+if test "$gl_gcc_warnings" != yes; then
+  isystem='-I'
+else
+  isystem='-isystem '
 
-if test x$GCC = xyes; then
-  test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
+  # This, $nw, is the list of warnings we disable.
+  nw=
+
+  case $with_x_toolkit in
+    lucid | athena | motif)
+       # Old toolkits mishandle 'const'.
+       nw="$nw -Wwrite-strings"
+       ;;
+    *)
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror" >&5
+$as_echo_n "checking whether C compiler handles -Werror... " >&6; }
+if test "${gl_cv_warn_c__Werror+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
-fi
 
-### Use -Wdeclaration-after-statement if the compiler supports it
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -Wdeclaration-after-statement" >&5
-$as_echo_n "checking whether gcc understands -Wdeclaration-after-statement... " >&6; }
-SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wdeclaration-after-statement"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Werror"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -7081,27 +7110,72 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  has_option=yes
+  gl_cv_warn_c__Werror=yes
 else
-  has_option=no
+  gl_cv_warn_c__Werror=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-if test $has_option = yes; then
-   C_WARNINGS_SWITCH="-Wdeclaration-after-statement $C_WARNINGS_SWITCH"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5
-$as_echo "$has_option" >&6; }
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
-
-### Use -Wold-style-definition if the compiler supports it
-# This can be removed when conversion to standard C is finished.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -Wold-style-definition" >&5
-$as_echo_n "checking whether gcc understands -Wold-style-definition... " >&6; }
-SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wold-style-definition"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror" >&5
+$as_echo "$gl_cv_warn_c__Werror" >&6; }
+if test "x$gl_cv_warn_c__Werror" = x""yes; then :
+  as_fn_append WERROR_CFLAGS " -Werror"
+fi
+
+
+       ;;
+  esac
+
+
+  nw="$nw -Waggregate-return"       # anachronistic
+  nw="$nw -Wlong-long"              # C90 is anachronistic
+  nw="$nw -Wc++-compat"             # We don't care about C++ compilers
+  nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
+  nw="$nw -Wtraditional"            # Warns on #elif which we use often
+  nw="$nw -Wcast-qual"              # Too many warnings for now
+  nw="$nw -Wconversion"             # Too many warnings for now
+  nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
+  nw="$nw -Wsign-conversion"        # Too many warnings for now
+  nw="$nw -Woverlength-strings"     # Not a problem these days
+  nw="$nw -Wtraditional-conversion" # Too many warnings for now
+  nw="$nw -Wunreachable-code"       # so buggy that it's now silently ignored
+  nw="$nw -Wpadded"                 # Our structs are not padded
+  nw="$nw -Wredundant-decls"        # we regularly (re)declare functions
+  nw="$nw -Wlogical-op"             # any use of fwrite provokes this
+  nw="$nw -Wformat-nonliteral"      # we do this a lot
+  nw="$nw -Wvla"                    # warnings in gettext.h
+  nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
+  nw="$nw -Wswitch-enum"            # Too many warnings for now
+  nw="$nw -Wswitch-default"         # Too many warnings for now
+  nw="$nw -Wfloat-equal"            # warns about high-quality code
+  nw="$nw -Winline"                 # OK to ignore 'inline'
+  nw="$nw -Wsync-nand"              # irrelevant here, and provokes ObjC warning
+  nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
+
+  # Emacs doesn't care about shadowing; see
+  # <http://lists.gnu.org/archive/html/emacs-diffs/2011-11/msg00265.html>.
+  nw="$nw -Wshadow"
+
+  # The following lines should be removable at some point.
+  nw="$nw -Wstack-protector"
+  nw="$nw -Wstrict-overflow"
+  nw="$nw -Wsuggest-attribute=pure"
+
+
+
+  if test -n "$GCC"; then
+
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is supported" >&5
+$as_echo_n "checking whether -Wno-missing-field-initializers is supported... " >&6; }
+    if test "${gl_cv_cc_nomfi_supported+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -7113,27 +7187,33 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  has_option=yes
+  gl_cv_cc_nomfi_supported=yes
 else
-  has_option=no
+  gl_cv_cc_nomfi_supported=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-if test $has_option = yes; then
-   C_WARNINGS_SWITCH="-Wold-style-definition $C_WARNINGS_SWITCH"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5
-$as_echo "$has_option" >&6; }
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
-
-### Use -Wimplicit-function-declaration if the compiler supports it
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -Wimplicit-function-declaration" >&5
-$as_echo_n "checking whether gcc understands -Wimplicit-function-declaration... " >&6; }
-SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wimplicit-function-declaration"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+      CFLAGS="$gl_save_CFLAGS"
+fi
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_supported" >&5
+$as_echo "$gl_cv_cc_nomfi_supported" >&6; }
+
+    if test "$gl_cv_cc_nomfi_supported" = yes; then
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is needed" >&5
+$as_echo_n "checking whether -Wno-missing-field-initializers is needed... " >&6; }
+      if test "${gl_cv_cc_nomfi_needed+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+        gl_save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS -W -Werror"
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+void f (void)
+               {
+                 typedef struct { int a; int b; } s_t;
+                 s_t s1 = { 0, };
+               }
 
 int
 main ()
@@ -7144,320 +7224,533 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  has_option=yes
+  gl_cv_cc_nomfi_needed=no
 else
-  has_option=no
+  gl_cv_cc_nomfi_needed=yes
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-if test $has_option = yes; then
-   C_WARNINGS_SWITCH="-Wimplicit-function-declaration $C_WARNINGS_SWITCH"
+        CFLAGS="$gl_save_CFLAGS"
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $has_option" >&5
-$as_echo "$has_option" >&6; }
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
 
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_needed" >&5
+$as_echo "$gl_cv_cc_nomfi_needed" >&6; }
+    fi
+  fi
+
+  gl_manywarn_set=
+  for gl_manywarn_item in \
+    -Wall \
+    -W \
+    -Wformat-y2k \
+    -Wformat-nonliteral \
+    -Wformat-security \
+    -Winit-self \
+    -Wmissing-include-dirs \
+    -Wswitch-default \
+    -Wswitch-enum \
+    -Wunused \
+    -Wunknown-pragmas \
+    -Wstrict-aliasing \
+    -Wstrict-overflow \
+    -Wsystem-headers \
+    -Wfloat-equal \
+    -Wtraditional \
+    -Wtraditional-conversion \
+    -Wdeclaration-after-statement \
+    -Wundef \
+    -Wshadow \
+    -Wunsafe-loop-optimizations \
+    -Wpointer-arith \
+    -Wbad-function-cast \
+    -Wc++-compat \
+    -Wcast-qual \
+    -Wcast-align \
+    -Wwrite-strings \
+    -Wconversion \
+    -Wsign-conversion \
+    -Wlogical-op \
+    -Waggregate-return \
+    -Wstrict-prototypes \
+    -Wold-style-definition \
+    -Wmissing-prototypes \
+    -Wmissing-declarations \
+    -Wmissing-noreturn \
+    -Wmissing-format-attribute \
+    -Wpacked \
+    -Wpadded \
+    -Wredundant-decls \
+    -Wnested-externs \
+    -Wunreachable-code \
+    -Winline \
+    -Winvalid-pch \
+    -Wlong-long \
+    -Wvla \
+    -Wvolatile-register-var \
+    -Wdisabled-optimization \
+    -Wstack-protector \
+    -Woverlength-strings \
+    -Wbuiltin-macro-redefined \
+    -Wmudflap \
+    -Wpacked-bitfield-compat \
+    -Wsync-nand \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+  # The following are not documented in the manual but are included in
+  # output from gcc --help=warnings.
+  for gl_manywarn_item in \
+    -Wattributes \
+    -Wcoverage-mismatch \
+    -Wunused-macros \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+  # More warnings from gcc 4.6.2 --help=warnings.
+  for gl_manywarn_item in \
+    -Wabi \
+    -Wcpp \
+    -Wdeprecated \
+    -Wdeprecated-declarations \
+    -Wdiv-by-zero \
+    -Wdouble-promotion \
+    -Wendif-labels \
+    -Wextra \
+    -Wformat-contains-nul \
+    -Wformat-extra-args \
+    -Wformat-zero-length \
+    -Wformat=2 \
+    -Wmultichar \
+    -Wnormalized=nfc \
+    -Woverflow \
+    -Wpointer-to-int-cast \
+    -Wpragmas \
+    -Wsuggest-attribute=const \
+    -Wsuggest-attribute=noreturn \
+    -Wsuggest-attribute=pure \
+    -Wtrampolines \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+
+  # Disable the missing-field-initializers warning if needed
+  if test "$gl_cv_cc_nomfi_needed" = yes; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
+  fi
 
+  ws=$gl_manywarn_set
 
 
-#### Some other nice autoconf tests.
+  gl_warn_set=
+  set x $ws; shift
+  for gl_warn_item
+  do
+    case " $nw " in
+      *" $gl_warn_item "*)
+        ;;
+      *)
+        gl_warn_set="$gl_warn_set $gl_warn_item"
+        ;;
+    esac
+  done
+  ws=$gl_warn_set
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-  if test "${ac_cv_prog_CPP+set}" = set; then :
+  for w in $ws; do
+    as_gl_Warn=`$as_echo "gl_cv_warn_c_$w" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $w" >&5
+$as_echo_n "checking whether C compiler handles $w... " >&6; }
+if { as_var=$as_gl_Warn; eval "test \"\${$as_var+set}\" = set"; }; then :
   $as_echo_n "(cached) " >&6
 else
-      # Double quotes because CPP needs to be expanded
-    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
+
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " $w"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
 
-else
-  # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.$ac_ext
+int
+main ()
+{
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
+  ;
+  return 0;
+}
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$as_gl_Warn=yes"
 else
-  # Passes both tests.
-ac_preproc_ok=:
-break
+  eval "$as_gl_Warn=no"
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-  break
+fi
+eval ac_res=\$$as_gl_Warn
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+eval as_val=\$$as_gl_Warn
+   if test "x$as_val" = x""yes; then :
+  as_fn_append WARN_CFLAGS " $w"
 fi
 
-    done
-    ac_cv_prog_CPP=$CPP
 
-fi
-  CPP=$ac_cv_prog_CPP
+  done
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-missing-field-initializers" >&5
+$as_echo_n "checking whether C compiler handles -Wno-missing-field-initializers... " >&6; }
+if test "${gl_cv_warn_c__Wno_missing_field_initializers+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
+
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Wno-missing-field-initializers"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
 
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__Wno_missing_field_initializers=yes
 else
-  # Broken: fails on valid input.
-continue
+  gl_cv_warn_c__Wno_missing_field_initializers=no
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
 
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_missing_field_initializers" >&5
+$as_echo "$gl_cv_warn_c__Wno_missing_field_initializers" >&6; }
+if test "x$gl_cv_warn_c__Wno_missing_field_initializers" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -Wno-missing-field-initializers"
+fi
+
+ # We need this one
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-sign-compare" >&5
+$as_echo_n "checking whether C compiler handles -Wno-sign-compare... " >&6; }
+if test "${gl_cv_warn_c__Wno_sign_compare+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Wno-sign-compare"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <ac_nonexistent.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-  # Broken: success on invalid input.
-continue
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__Wno_sign_compare=yes
 else
-  # Passes both tests.
-ac_preproc_ok=:
-break
+  gl_cv_warn_c__Wno_sign_compare=no
 fi
-rm -f conftest.err conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
 
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_sign_compare" >&5
+$as_echo "$gl_cv_warn_c__Wno_sign_compare" >&6; }
+if test "x$gl_cv_warn_c__Wno_sign_compare" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -Wno-sign-compare"
+fi
 
+     # Too many warnings for now
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-type-limits" >&5
+$as_echo_n "checking whether C compiler handles -Wno-type-limits... " >&6; }
+if test "${gl_cv_warn_c__Wno_type_limits+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details." "$LINENO" 5; }
-fi
 
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Wno-type-limits"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+int
+main ()
+{
 
-if test "x$RANLIB" = x; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_RANLIB+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__Wno_type_limits=yes
 else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
+  gl_cv_warn_c__Wno_type_limits=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
+
 fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_type_limits" >&5
+$as_echo "$gl_cv_warn_c__Wno_type_limits" >&6; }
+if test "x$gl_cv_warn_c__Wno_type_limits" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -Wno-type-limits"
 fi
 
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+      # Too many warnings for now
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-switch" >&5
+$as_echo_n "checking whether C compiler handles -Wno-switch... " >&6; }
+if test "${gl_cv_warn_c__Wno_switch+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
 
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Wno-switch"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__Wno_switch=yes
+else
+  gl_cv_warn_c__Wno_switch=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
+
 fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_switch" >&5
+$as_echo "$gl_cv_warn_c__Wno_switch" >&6; }
+if test "x$gl_cv_warn_c__Wno_switch" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -Wno-switch"
 fi
 
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
+           # Too many warnings for now
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-unused-parameter" >&5
+$as_echo_n "checking whether C compiler handles -Wno-unused-parameter... " >&6; }
+if test "${gl_cv_warn_c__Wno_unused_parameter+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
 
-fi
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Wno-unused-parameter"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-## Although we're running on an amd64 kernel, we're actually compiling for
-## the x86 architecture.  The user should probably have provided an
-## explicit --build to `configure', but if everything else than the kernel
-## is running in i386 mode, we can help them out.
-if test "$machine" = "amdx86-64"; then
-  ac_fn_c_check_decl "$LINENO" "i386" "ac_cv_have_decl_i386" "$ac_includes_default"
-if test "x$ac_cv_have_decl_i386" = x""yes; then :
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__Wno_unused_parameter=yes
+else
+  gl_cv_warn_c__Wno_unused_parameter=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
 
-  if test "$ac_cv_have_decl_i386" = "yes"; then
-    canonical=`echo "$canonical" | sed -e 's/^amd64/i386/' -e 's/^x86_64/i386/'`
-    machine=intel386
-    machfile="m/${machine}.h"
-  fi
-  ac_fn_c_check_decl "$LINENO" "__ILP32__" "ac_cv_have_decl___ILP32__" "$ac_includes_default"
-if test "x$ac_cv_have_decl___ILP32__" = x""yes; then :
-  machfile="m/intel386.h"
 fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_unused_parameter" >&5
+$as_echo "$gl_cv_warn_c__Wno_unused_parameter" >&6; }
+if test "x$gl_cv_warn_c__Wno_unused_parameter" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -Wno-unused-parameter"
 fi
 
-# Extract the first word of "install-info", so it can be a program name with args.
-set dummy install-info; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_INSTALL_INFO+set}" = set; then :
+ # Too many warnings for now
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-format-nonliteral" >&5
+$as_echo_n "checking whether C compiler handles -Wno-format-nonliteral... " >&6; }
+if test "${gl_cv_warn_c__Wno_format_nonliteral+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $INSTALL_INFO in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_INSTALL_INFO="$INSTALL_INFO" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_INSTALL_INFO="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
 
-  ;;
-esac
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Wno-format-nonliteral"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__Wno_format_nonliteral=yes
+else
+  gl_cv_warn_c__Wno_format_nonliteral=no
 fi
-INSTALL_INFO=$ac_cv_path_INSTALL_INFO
-if test -n "$INSTALL_INFO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL_INFO" >&5
-$as_echo "$INSTALL_INFO" >&6; }
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_format_nonliteral" >&5
+$as_echo "$gl_cv_warn_c__Wno_format_nonliteral" >&6; }
+if test "x$gl_cv_warn_c__Wno_format_nonliteral" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -Wno-format-nonliteral"
+fi
+
+
+
+  # In spite of excluding -Wlogical-op above, it is enabled, as of
+  # gcc 4.5.0 20090517.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-logical-op" >&5
+$as_echo_n "checking whether C compiler handles -Wno-logical-op... " >&6; }
+if test "${gl_cv_warn_c__Wno_logical_op+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -Wno-logical-op"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__Wno_logical_op=yes
+else
+  gl_cv_warn_c__Wno_logical_op=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wno_logical_op" >&5
+$as_echo "$gl_cv_warn_c__Wno_logical_op" >&6; }
+if test "x$gl_cv_warn_c__Wno_logical_op" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -Wno-logical-op"
+fi
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -fdiagnostics-show-option" >&5
+$as_echo_n "checking whether C compiler handles -fdiagnostics-show-option... " >&6; }
+if test "${gl_cv_warn_c__fdiagnostics_show_option+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -fdiagnostics-show-option"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__fdiagnostics_show_option=yes
+else
+  gl_cv_warn_c__fdiagnostics_show_option=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__fdiagnostics_show_option" >&5
+$as_echo "$gl_cv_warn_c__fdiagnostics_show_option" >&6; }
+if test "x$gl_cv_warn_c__fdiagnostics_show_option" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -fdiagnostics-show-option"
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -funit-at-a-time" >&5
+$as_echo_n "checking whether C compiler handles -funit-at-a-time... " >&6; }
+if test "${gl_cv_warn_c__funit_at_a_time+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  gl_save_compiler_FLAGS="$CFLAGS"
+  as_fn_append CFLAGS " -funit-at-a-time"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_warn_c__funit_at_a_time=yes
+else
+  gl_cv_warn_c__funit_at_a_time=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CFLAGS="$gl_save_compiler_FLAGS"
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__funit_at_a_time" >&5
+$as_echo "$gl_cv_warn_c__funit_at_a_time" >&6; }
+if test "x$gl_cv_warn_c__funit_at_a_time" = x""yes; then :
+  as_fn_append WARN_CFLAGS " -funit-at-a-time"
+fi
+
+
+
+
+$as_echo "#define lint 1" >>confdefs.h
+
+
+$as_echo "#define _FORTIFY_SOURCE 2" >>confdefs.h
+
+
+$as_echo "#define GNULIB_PORTCHECK 1" >>confdefs.h
+
+
+  # We use a slightly smaller set of warning options for lib/.
+  # Remove the following and save the result in GNULIB_WARN_CFLAGS.
+  nw=
+  nw="$nw -Wunused-macros"
+
+
+  gl_warn_set=
+  set x $WARN_CFLAGS; shift
+  for gl_warn_item
+  do
+    case " $nw " in
+      *" $gl_warn_item "*)
+        ;;
+      *)
+        gl_warn_set="$gl_warn_set $gl_warn_item"
+        ;;
+    esac
+  done
+  GNULIB_WARN_CFLAGS=$gl_warn_set
+
+
 fi
 
 
+
+
 # Extract the first word of "install-info", so it can be a program name with args.
 set dummy install-info; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7471,7 +7764,7 @@ else
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /usr/sbin
+for as_dir in $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
@@ -7485,6 +7778,7 @@ done
   done
 IFS=$as_save_IFS
 
+  test -z "$ac_cv_path_INSTALL_INFO" && ac_cv_path_INSTALL_INFO=":"
   ;;
 esac
 fi
@@ -7498,26 +7792,26 @@ $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "install-info", so it can be a program name with args.
-set dummy install-info; ac_word=$2
+# Extract the first word of "gzip", so it can be a program name with args.
+set dummy gzip; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_INSTALL_INFO+set}" = set; then :
+if test "${ac_cv_path_GZIP_PROG+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $INSTALL_INFO in
+  case $GZIP_PROG in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_INSTALL_INFO="$INSTALL_INFO" # Let the user override the test with a path.
+  ac_cv_path_GZIP_PROG="$GZIP_PROG" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /sbin
+for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_INSTALL_INFO="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_GZIP_PROG="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7525,40 +7819,41 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_INSTALL_INFO" && ac_cv_path_INSTALL_INFO=":"
   ;;
 esac
 fi
-INSTALL_INFO=$ac_cv_path_INSTALL_INFO
-if test -n "$INSTALL_INFO"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL_INFO" >&5
-$as_echo "$INSTALL_INFO" >&6; }
+GZIP_PROG=$ac_cv_path_GZIP_PROG
+if test -n "$GZIP_PROG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP_PROG" >&5
+$as_echo "$GZIP_PROG" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-# Extract the first word of "gzip", so it can be a program name with args.
-set dummy gzip; ac_word=$2
+
+if test $opsys = gnu-linux; then
+  # Extract the first word of "paxctl", so it can be a program name with args.
+set dummy paxctl; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_GZIP_PROG+set}" = set; then :
+if test "${ac_cv_path_PAXCTL+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $GZIP_PROG in
+  case $PAXCTL in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_GZIP_PROG="$GZIP_PROG" # Let the user override the test with a path.
+  ac_cv_path_PAXCTL="$PAXCTL" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+for as_dir in $PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_GZIP_PROG="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_PAXCTL="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7569,19 +7864,19 @@ IFS=$as_save_IFS
   ;;
 esac
 fi
-GZIP_PROG=$ac_cv_path_GZIP_PROG
-if test -n "$GZIP_PROG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GZIP_PROG" >&5
-$as_echo "$GZIP_PROG" >&6; }
+PAXCTL=$ac_cv_path_PAXCTL
+if test -n "$PAXCTL"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAXCTL" >&5
+$as_echo "$PAXCTL" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
+fi
 
-
-## Need makeinfo >= 4.6 (?) to build the manuals.
+## Need makeinfo >= 4.7 (?) to build the manuals.
 # Extract the first word of "makeinfo", so it can be a program name with args.
 set dummy makeinfo; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -7624,7 +7919,7 @@ fi
 
 
 if test "$MAKEINFO" != "no" && \
-  test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[^0-9]*([1-4][0-9]+|[5-9]|4\.[6-9]|4\.[1-5][0-9]+)'`" = x; then
+  test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[^0-9]*([1-4][0-9]+|[5-9]|4\.[7-9]|4\.[1-6][0-9]+)'`" = x; then
    MAKEINFO=no
 fi
 
@@ -7644,7 +7939,7 @@ if test "$MAKEINFO" = "no"; then
   if test "x${with_makeinfo}" = "xno"; then
     HAVE_MAKEINFO=no
   elif test ! -e $srcdir/info/emacs; then
-    as_fn_error "You do not seem to have makeinfo >= 4.6, and your
+    as_fn_error "You do not seem to have makeinfo >= 4.7, and your
 source tree does not seem to have pre-built manuals in the \`info' directory.
 Either install a suitable version of makeinfo, or re-run configure
 with the \`--without-makeinfo' option to build without the manuals. " "$LINENO" 5
@@ -7652,6 +7947,11 @@ with the \`--without-makeinfo' option to build without the manuals. " "$LINENO"
 fi
 
 
+INFO_EXT=.info
+INFO_OPTS=--no-split
+
+
+
 
 if test x$GCC = xyes; then
   test "x$GCC_LINK_TEST_OPTIONS" != x && \
@@ -7694,11 +7994,6 @@ rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
 
-# The value of CPP is a quoted variable reference, so we need to do this
-# to get its actual value...
-CPP=`eval "echo $CPP"`
-
-
 test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
 case "$opsys" in
   your-opsys-here) CANNOT_DUMP=yes ;;
@@ -7750,7 +8045,9 @@ case "$opsys" in
    ## Let `ld' find image libs and similar things in /usr/local/lib.
    ## The system compiler, GCC, has apparently been modified to not
    ## look there, contrary to what a stock GCC would do.
-   LD_SWITCH_SYSTEM=-L/usr/local/lib
+### It's not our place to do this.  See bug#10313#17.
+###   LD_SWITCH_SYSTEM=-L/usr/local/lib
+      :
    ;;
 
   gnu-linux)
@@ -7759,7 +8056,9 @@ case "$opsys" in
    ;;
 
   netbsd)
-   LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+### It's not our place to do this.  See bug#10313#17.
+###   LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+      :
    ;;
 
   openbsd)
@@ -7772,7 +8071,7 @@ esac
 
 ac_link="$ac_link $LD_SWITCH_SYSTEM"
 
-## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_AUX,
+## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
 ## which has not been defined yet.  When this was handled with cpp,
 ## it was expanded to null when configure sourced the s/*.h file.
 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
@@ -7784,13 +8083,13 @@ ac_link="$ac_link $LD_SWITCH_SYSTEM"
 ## LD_SWITCH_SYSTEM_TEMACS.
 case "$opsys" in
   netbsd|openbsd)
-   ## _AUX_RPATH is like _AUX, but uses -rpath instead of -R.
-   LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_AUX_RPATH) $LD_SWITCH_SYSTEM" ;;
+   LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
 esac
 
 
 C_SWITCH_MACHINE=
-if test "$machine" = "alpha"; then
+case $canonical in
+ alpha*)
   ac_fn_c_check_decl "$LINENO" "__ELF__" "ac_cv_have_decl___ELF__" "$ac_includes_default"
 if test "x$ac_cv_have_decl___ELF__" = x""yes; then :
 
@@ -7810,7 +8109,8 @@ fi
   else
     UNEXEC_OBJ=unexalpha.o
   fi
-fi
+  ;;
+esac
 
 
 
 # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
 
 
-# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then :
-  enableval=$enable_largefile;
-fi
 
-if test "$enable_largefile" != no; then
+LIB_MATH=-lm
+LIB_STANDARD=
+START_FILES=
+SYSTEM_TYPE=`echo $opsys | sed -e 's/[0-9].*//' -e 's|-|/|'`
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
-$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_sys_largefile_CC=no
-     if test "$GCC" != yes; then
-       ac_save_CC=$CC
-       while :; do
-         # IRIX 6.2 and later do not support large files by default,
-         # so use the C compiler's -n32 option if that helps.
-         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                       && LARGE_OFF_T % 2147483647 == 1)
-                      ? 1 : -1];
-int
-main ()
-{
+case $opsys in
+  cygwin )
+    LIB_MATH=
+    START_FILES='pre-crt0.o'
+    ;;
+  darwin )
+    ## Adding -lm confuses the dynamic linker, so omit it.
+    LIB_MATH=
+    START_FILES='pre-crt0.o'
+    ;;
+  freebsd )
+    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+    SYSTEM_TYPE=berkeley-unix
+    ;;
+  gnu-linux | gnu-kfreebsd )
+    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
+    ;;
+  hpux10-20 | hpux11 )
+    LIB_STANDARD=-lc
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
+    ;;
+    netbsd | openbsd )
+    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
+    START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
+    SYSTEM_TYPE=berkeley-unix
+    ;;
 
-  ;
-  return 0;
-}
+  sol2* | unixware )
+    SYSTEM_TYPE=usg-unix-v
+    ;;
+
+esac
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SYSTEM_TYPE "$SYSTEM_TYPE"
 _ACEOF
-         if ac_fn_c_try_compile "$LINENO"; then :
-  break
-fi
-rm -f core conftest.err conftest.$ac_objext
-         CC="$CC -n32"
-         if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_largefile_CC=' -n32'; break
-fi
-rm -f core conftest.err conftest.$ac_objext
-         break
-       done
-       CC=$ac_save_CC
-       rm -f conftest.$ac_ext
-    fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
-$as_echo "$ac_cv_sys_largefile_CC" >&6; }
-  if test "$ac_cv_sys_largefile_CC" != no; then
-    CC=$CC$ac_cv_sys_largefile_CC
-  fi
-
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
-$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                       && LARGE_OFF_T % 2147483647 == 1)
-                      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                       && LARGE_OFF_T % 2147483647 == 1)
-                      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_file_offset_bits=64; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_file_offset_bits=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
-$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
-case $ac_cv_sys_file_offset_bits in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  if test $ac_cv_sys_file_offset_bits = unknown; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
-$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if test "${ac_cv_sys_large_files+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                       && LARGE_OFF_T % 2147483647 == 1)
-                      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=no; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#define _LARGE_FILES 1
-#include <sys/types.h>
- /* Check that off_t can represent 2**63 - 1 correctly.
-    We can't simply define LARGE_OFF_T to be 9223372036854775807,
-    since some C++ compilers masquerading as C compilers
-    incorrectly reject 9223372036854775807.  */
-#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
-  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
-                       && LARGE_OFF_T % 2147483647 == 1)
-                      ? 1 : -1];
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sys_large_files=1; break
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  ac_cv_sys_large_files=unknown
-  break
-done
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
-$as_echo "$ac_cv_sys_large_files" >&6; }
-case $ac_cv_sys_large_files in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGE_FILES $ac_cv_sys_large_files
-_ACEOF
-;;
-esac
-rm -rf conftest*
-  fi
-
-
-fi
-
-
-
-LIB_MATH=-lm
-LIB_STANDARD=
-START_FILES=
-
-case $opsys in
-  cygwin )
-    LIB_MATH=
-    START_FILES='pre-crt0.o'
-    ;;
-  darwin )
-    ## Adding -lm confuses the dynamic linker, so omit it.
-    LIB_MATH=
-    START_FILES='pre-crt0.o'
-    ;;
-  freebsd )
-    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
-    ;;
-  gnu-linux | gnu-kfreebsd )
-    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o'
-    ;;
-  hpux10-20 | hpux11 )
-    LIB_STANDARD=-lc
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o'
-    ;;
-    netbsd | openbsd )
-    LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
-    START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
-    ;;
-esac
-
-
 
 
 crt_files=
@@ -8199,6 +8311,51 @@ case $opsys in
 esac
 
 
+pre_PKG_CONFIG_CFLAGS=$CFLAGS
+pre_PKG_CONFIG_LIBS=$LIBS
+
+# Extract the first word of "pkg-config", so it can be a program name with args.
+set dummy pkg-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $PKG_CONFIG in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
+  ;;
+esac
+fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
 
 
 
@@ -8268,48 +8425,6 @@ fi
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
   if test "$PKG_CONFIG" = "no" ; then
      HAVE_ALSA=no
   else
@@ -8318,22 +8433,20 @@ fi
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ALSA_MODULES" >&5
 $as_echo_n "checking for $ALSA_MODULES... " >&6; }
 
-        if $PKG_CONFIG --exists "$ALSA_MODULES" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "$ALSA_MODULES" 2>&5 &&
+          ALSA_CFLAGS=`$PKG_CONFIG --cflags "$ALSA_MODULES" 2>&5` &&
+          ALSA_LIBS=`$PKG_CONFIG --libs "$ALSA_MODULES" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           ALSA_CFLAGS=`$as_echo "$ALSA_CFLAGS" | sed -e "$edit_cflags"`
+           ALSA_LIBS=`$as_echo "$ALSA_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$ALSA_CFLAGS' LIBS='$ALSA_LIBS'" >&5
+$as_echo "yes CFLAGS='$ALSA_CFLAGS' LIBS='$ALSA_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking ALSA_CFLAGS" >&5
-$as_echo_n "checking ALSA_CFLAGS... " >&6; }
-            ALSA_CFLAGS=`$PKG_CONFIG --cflags "$ALSA_MODULES"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_CFLAGS" >&5
-$as_echo "$ALSA_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking ALSA_LIBS" >&5
-$as_echo_n "checking ALSA_LIBS... " >&6; }
-            ALSA_LIBS=`$PKG_CONFIG --libs "$ALSA_MODULES"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ALSA_LIBS" >&5
-$as_echo "$ALSA_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -8427,14 +8540,14 @@ $as_echo "#define HAVE_SOUND 1" >>confdefs.h
 
 fi
 
-for ac_header in sys/select.h sys/time.h unistd.h utime.h \
-  linux/version.h sys/systeminfo.h \
-  stdio_ext.h fcntl.h coff.h pty.h sys/mman.h \
-  sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
-  sys/utsname.h pwd.h utmp.h dirent.h util.h
+
+
+
+  for ac_header in $ac_header_list
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
 eval as_val=\$$as_ac_Header
    if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
@@ -8446,6 +8559,33 @@ fi
 done
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if personality LINUX32 can be set" >&5
 $as_echo_n "checking if personality LINUX32 can be set... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -8593,49 +8733,6 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h
 fi
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct utimbuf" >&5
-$as_echo_n "checking for struct utimbuf... " >&6; }
-if test "${emacs_cv_struct_utimbuf+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-int
-main ()
-{
-static struct utimbuf x; x.actime = x.modtime;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_struct_utimbuf=yes
-else
-  emacs_cv_struct_utimbuf=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_utimbuf" >&5
-$as_echo "$emacs_cv_struct_utimbuf" >&6; }
-if test $emacs_cv_struct_utimbuf = yes; then
-
-$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for speed_t" >&5
 $as_echo_n "checking for speed_t... " >&6; }
 if test "${emacs_cv_speed_t+set}" = set; then :
@@ -8667,47 +8764,6 @@ $as_echo "#define HAVE_SPEED_T 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5
-$as_echo_n "checking for struct timeval... " >&6; }
-if test "${emacs_cv_struct_timeval+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-int
-main ()
-{
-static struct timeval x; x.tv_sec = x.tv_usec;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_struct_timeval=yes
-else
-  emacs_cv_struct_timeval=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_timeval" >&5
-$as_echo "$emacs_cv_struct_timeval" >&6; }
-HAVE_TIMEVAL=$emacs_cv_struct_timeval
-if test $emacs_cv_struct_timeval = yes; then
-
-$as_echo "#define HAVE_TIMEVAL 1" >>confdefs.h
-
-fi
-
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct exception" >&5
 $as_echo_n "checking for struct exception... " >&6; }
 if test "${emacs_cv_struct_exception+set}" = set; then :
@@ -8734,23 +8790,14 @@ fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_exception" >&5
 $as_echo "$emacs_cv_struct_exception" >&6; }
 HAVE_EXCEPTION=$emacs_cv_struct_exception
-if test $emacs_cv_struct_exception != yes; then
+if test $emacs_cv_struct_exception != yes || test $opsys = darwin; then
 
 $as_echo "#define NO_MATHERR 1" >>confdefs.h
 
 fi
 
-for ac_header in sys/socket.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_socket_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_SOCKET_H 1
-_ACEOF
 
-fi
 
-done
 
 for ac_header in net/if.h
 do :
@@ -8800,19 +8847,6 @@ fi
 
 done
 
-for ac_func in getifaddrs freeifaddrs
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
 
 ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_flags" "ac_cv_member_struct_ifreq_ifr_flags" "$ac_includes_default
 #if HAVE_SYS_SOCKET_H
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for function prototypes" >&5
-$as_echo_n "checking for function prototypes... " >&6; }
-if test "$ac_cv_prog_cc_c89" != no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-$as_echo "#define PROTOTYPES 1" >>confdefs.h
-
-
-$as_echo "#define __PROTOTYPES 1" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
-$as_echo_n "checking for working volatile... " >&6; }
-if test "${ac_cv_c_volatile+set}" = set; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for  __attribute__ ((__aligned__ (expr)))" >&5
+$as_echo_n "checking for  __attribute__ ((__aligned__ (expr)))... " >&6; }
+if test "${emacs_cv_attribute_aligned+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
+char __attribute__ ((__aligned__ (1 << 3))) c;
 int
 main ()
 {
 
-volatile int x;
-int * volatile y = (int *) 0;
-return !x && !y;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_volatile=yes
+  emacs_cv_attribute_aligned=yes
 else
-  ac_cv_c_volatile=no
+  emacs_cv_attribute_aligned=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
-$as_echo "$ac_cv_c_volatile" >&6; }
-if test $ac_cv_c_volatile = no; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_attribute_aligned" >&5
+$as_echo "$emacs_cv_attribute_aligned" >&6; }
+if test $emacs_cv_attribute_aligned = yes; then
 
-$as_echo "#define volatile /**/" >>confdefs.h
+$as_echo "#define HAVE_ATTRIBUTE_ALIGNED 1" >>confdefs.h
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
-$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+DEPFLAGS=
+MKDEPDIR=":"
+deps_frag=deps.mk
+if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using GNU Make" >&5
+$as_echo_n "checking whether we are using GNU Make... " >&6; }
+   HAVE_GNU_MAKE=no
+   testval=`${MAKE-make} --version 2>/dev/null | grep 'GNU Make'`
+   if test "x$testval" != x; then
+      HAVE_GNU_MAKE=yes
+   else
+      ac_enable_autodepend=no
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_GNU_MAKE" >&5
+$as_echo "$HAVE_GNU_MAKE" >&6; }
+   if test $HAVE_GNU_MAKE = yes; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -MMD -MF" >&5
+$as_echo_n "checking whether gcc understands -MMD -MF... " >&6; }
+      SAVE_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
-/* FIXME: Include the comments suggested by Paul. */
-#ifndef __cplusplus
-  /* Ultrix mips cc rejects this.  */
-  typedef int charset[2];
-  const charset cs;
-  /* SunOS 4.1.1 cc rejects this.  */
-  char const *const *pcpcc;
-  char **ppc;
-  /* NEC SVR4.0.2 mips cc rejects this.  */
-  struct point {int x, y;};
-  static struct point const zero = {0,0};
-  /* AIX XL C 1.02.0.0 rejects this.
-     It does not let you subtract one const X* pointer from another in
-     an arm of an if-expression whose if-part is not a constant
-     expression */
-  const char *g = "string";
-  pcpcc = &g + (g ? g-g : 0);
-  /* HPUX 7.0 cc rejects these. */
-  ++pcpcc;
-  ppc = (char**) pcpcc;
-  pcpcc = (char const *const *) ppc;
-  { /* SCO 3.2v4 cc rejects this.  */
-    char *t;
-    char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-    *t++ = 0;
-    if (s) return 0;
-  }
-  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-    int x[] = {25, 17};
-    const int *foo = &x[0];
-    ++foo;
-  }
-  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-    typedef const int *iptr;
-    iptr p = 0;
-    ++p;
-  }
-  { /* AIX XL C 1.02.0.0 rejects this saying
-       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-    struct s { int j; const int *ap[3]; };
-    struct s *b; b->j = 5;
-  }
-  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-    const int foo = 10;
-    if (!foo) return 0;
-  }
-  return !cs[0] && !zero.x;
-#endif
 
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_const=yes
+
 else
-  ac_cv_c_const=no
+  ac_enable_autodepend=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      CFLAGS="$SAVE_CFLAGS"
+      test -f deps.d || ac_enable_autodepend=no
+      rm -rf deps.d
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_enable_autodepend" >&5
+$as_echo "$ac_enable_autodepend" >&6; }
+   fi
+   if test $ac_enable_autodepend = yes; then
+      DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d -MP'
+      ## MKDIR_P is documented (see AC_PROG_MKDIR_P) to be parallel-safe.
+      MKDEPDIR='${MKDIR_P} ${DEPDIR}'
+      deps_frag=autodeps.mk
+   fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
-$as_echo "$ac_cv_c_const" >&6; }
-if test $ac_cv_c_const = no; then
+deps_frag=$srcdir/src/$deps_frag
 
-$as_echo "#define const /**/" >>confdefs.h
 
-fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for void * support" >&5
-$as_echo_n "checking for void * support... " >&6; }
-if test "${emacs_cv_void_star+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-int
-main ()
-{
-void * foo;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_void_star=yes
-else
-  emacs_cv_void_star=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_void_star" >&5
-$as_echo "$emacs_cv_void_star" >&6; }
-if test $emacs_cv_void_star = yes; then
-  $as_echo "#define POINTER_TYPE void" >>confdefs.h
 
-else
-  $as_echo "#define POINTER_TYPE char" >>confdefs.h
+lisp_frag=$srcdir/src/lisp.mk
 
-fi
 
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
-$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if test "${ac_cv_c_bigendian+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_bigendian=unknown
-    # See if we're dealing with a universal compiler.
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifndef __APPLE_CC__
-              not a universal capable compiler
-            #endif
-            typedef int dummy;
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-       # Check for potential -arch flags.  It is not universal unless
-       # there are at least two -arch flags with different values.
-       ac_arch=
-       ac_prev=
-       for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
-        if test -n "$ac_prev"; then
-          case $ac_word in
-            i?86 | x86_64 | ppc | ppc64)
-              if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
-                ac_arch=$ac_word
-              else
-                ac_cv_c_bigendian=universal
-                break
-              fi
-              ;;
-          esac
-          ac_prev=
-        elif test "x$ac_word" = "x-arch"; then
-          ac_prev=arch
-        fi
-       done
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    if test $ac_cv_c_bigendian = unknown; then
-      # See if sys/param.h defines the BYTE_ORDER macro.
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-            #include <sys/param.h>
-
-int
-main ()
-{
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
-                    && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
-                    && LITTLE_ENDIAN)
-             bogus endian macros
-            #endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  # It does; now see whether it defined to BIG_ENDIAN or not.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-               #include <sys/param.h>
-
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
-                not big endian
-               #endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_bigendian=yes
-else
-  ac_cv_c_bigendian=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    fi
-    if test $ac_cv_c_bigendian = unknown; then
-      # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <limits.h>
-
-int
-main ()
-{
-#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
-             bogus endian macros
-            #endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  # It does; now see whether it defined to _BIG_ENDIAN or not.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <limits.h>
-
-int
-main ()
-{
-#ifndef _BIG_ENDIAN
-                not big endian
-               #endif
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_bigendian=yes
-else
-  ac_cv_c_bigendian=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-    fi
-    if test $ac_cv_c_bigendian = unknown; then
-      # Compile a test program.
-      if test "$cross_compiling" = yes; then :
-  # Try to guess by grepping values from an object file.
-        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-short int ascii_mm[] =
-                 { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-               short int ascii_ii[] =
-                 { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-               int use_ascii (int i) {
-                 return ascii_mm[i] + ascii_ii[i];
-               }
-               short int ebcdic_ii[] =
-                 { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-               short int ebcdic_mm[] =
-                 { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-               int use_ebcdic (int i) {
-                 return ebcdic_mm[i] + ebcdic_ii[i];
-               }
-               extern int foo;
-
-int
-main ()
-{
-return use_ascii (foo) == use_ebcdic (foo);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
-             ac_cv_c_bigendian=yes
-           fi
-           if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
-             if test "$ac_cv_c_bigendian" = unknown; then
-               ac_cv_c_bigendian=no
-             else
-               # finding both strings is unlikely to happen, but who knows?
-               ac_cv_c_bigendian=unknown
-             fi
-           fi
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-main ()
-{
-
-            /* Are we little or big endian?  From Harbison&Steele.  */
-            union
-            {
-              long int l;
-              char c[sizeof (long int)];
-            } u;
-            u.l = 1;
-            return u.c[sizeof (long int) - 1] == 1;
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_c_bigendian=no
-else
-  ac_cv_c_bigendian=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-    fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
-$as_echo "$ac_cv_c_bigendian" >&6; }
- case $ac_cv_c_bigendian in #(
-   yes)
-     $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
-;; #(
-   no)
-      ;; #(
-   universal)
-
-$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
-
-     ;; #(
-   *)
-     as_fn_error "unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
- esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for  __attribute__ ((__aligned__ (expr)))" >&5
-$as_echo_n "checking for  __attribute__ ((__aligned__ (expr)))... " >&6; }
-if test "${emacs_cv_attribute_aligned+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-char __attribute__ ((__aligned__ (1 << 3))) c;
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_attribute_aligned=yes
-else
-  emacs_cv_attribute_aligned=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_attribute_aligned" >&5
-$as_echo "$emacs_cv_attribute_aligned" >&6; }
-if test $emacs_cv_attribute_aligned = yes; then
-
-$as_echo "#define HAVE_ATTRIBUTE_ALIGNED 1" >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-       @echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
-  *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-  SET_MAKE=
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-DEPFLAGS=
-MKDEPDIR=":"
-deps_frag=deps.mk
-if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using GNU Make" >&5
-$as_echo_n "checking whether we are using GNU Make... " >&6; }
-   HAVE_GNU_MAKE=no
-   testval=`${MAKE-make} --version 2>/dev/null | grep 'GNU Make'`
-   if test "x$testval" != x; then
-      HAVE_GNU_MAKE=yes
-   else
-      ac_enable_autodepend=no
-   fi
-   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HAVE_GNU_MAKE" >&5
-$as_echo "$HAVE_GNU_MAKE" >&6; }
-   if test $HAVE_GNU_MAKE = yes; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc understands -MMD -MF" >&5
-$as_echo_n "checking whether gcc understands -MMD -MF... " >&6; }
-      SAVE_CFLAGS="$CFLAGS"
-      CFLAGS="$CFLAGS -MMD -MF deps.d -MP"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  ac_enable_autodepend=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-      CFLAGS="$SAVE_CFLAGS"
-      test -f deps.d || ac_enable_autodepend=no
-      rm -rf deps.d
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_enable_autodepend" >&5
-$as_echo "$ac_enable_autodepend" >&6; }
-   fi
-   if test $ac_enable_autodepend = yes; then
-      DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d -MP'
-      ## In parallel builds, another make might create depdir between
-      ## the first test and mkdir, so stick another test on the end.
-      ## Or use install-sh -d?  mkdir -p is not portable.
-      MKDEPDIR='test -d ${DEPDIR} || mkdir ${DEPDIR} || test -d ${DEPDIR}'
-      deps_frag=autodeps.mk
-   fi
-fi
-deps_frag=$srcdir/src/$deps_frag
-
-
-
-
-
-lisp_frag=$srcdir/src/lisp.mk
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long file names" >&5
-$as_echo_n "checking for long file names... " >&6; }
-if test "${ac_cv_sys_long_file_names+set}" = set; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for long file names" >&5
+$as_echo_n "checking for long file names... " >&6; }
+if test "${ac_cv_sys_long_file_names+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_cv_sys_long_file_names=yes
@@ -9668,22 +9281,11 @@ else
   window_system=x11
 fi
 
-## Workaround for bug in autoconf <= 2.62.
-## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html
-## No need to do anything special for these standard directories.
-if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then
-
-   x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'`
-
-fi
-
-LD_SWITCH_X_SITE_AUX=
-LD_SWITCH_X_SITE_AUX_RPATH=
+LD_SWITCH_X_SITE_RPATH=
 if test "${x_libraries}" != NONE; then
   if test -n "${x_libraries}"; then
     LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
-    LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
-    LD_SWITCH_X_SITE_AUX_RPATH=`echo ${LD_SWITCH_X_SITE_AUX} | sed -e 's/-R/-Wl,-rpath,/'`
+    LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`echo ${x_libraries} | sed -e "s/:/ -Wl,-rpath,/g"`
   fi
   x_default_search_path=""
   x_search_path=${x_libraries}
@@ -9708,9 +9310,8 @@ ${x_library}/X11/%T/%N%S"
 fi
 
 
-
 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
-  C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
+  C_SWITCH_X_SITE="$isystem"`echo ${x_includes} | sed -e "s/:/ $isystem/g"`
 fi
 
 if test x"${x_includes}" = x; then
@@ -9744,13 +9345,13 @@ if test "${with_ns}" != no; then
   if test "${opsys}" = darwin; then
      NS_IMPL_COCOA=yes
      ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=${ns_appdir}/Contents/MacOS/
+     ns_appbindir=${ns_appdir}/Contents/MacOS
      ns_appresdir=${ns_appdir}/Contents/Resources
      ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base
   elif test -f $GNUSTEP_CONFIG_FILE; then
      NS_IMPL_GNUSTEP=yes
      ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=${ns_appdir}/
+     ns_appbindir=${ns_appdir}
      ns_appresdir=${ns_appdir}/Resources
      ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
           GNUSTEP_SYSTEM_HEADERS="$(. $GNUSTEP_CONFIG_FILE; echo $GNUSTEP_SYSTEM_HEADERS)"
@@ -9815,7 +9416,6 @@ else
 fi
 
 
-  NS_HAVE_NSINTEGER=yes
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <Foundation/NSObjCRuntime.h>
@@ -9833,12 +9433,16 @@ else
   ns_have_nsinteger=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  if test $ns_have_nsinteger = no; then
-    NS_HAVE_NSINTEGER=no
+  if test $ns_have_nsinteger = yes; then
+
+$as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h
+
   fi
 fi
 
 
+INSTALL_ARCH_INDEP_EXTRA=install-etc
+ns_self_contained=no
 ns_frag=/dev/null
 NS_OBJ=
 NS_OBJC_OBJ=
@@ -9851,9 +9455,18 @@ if test "${HAVE_NS}" = yes; then
   with_xft=no
   # set up packaging dirs
   if test "${EN_NS_SELF_CONTAINED}" = yes; then
+     ns_self_contained=yes
      prefix=${ns_appresdir}
      exec_prefix=${ns_appbindir}
-     libexecdir=${ns_appbindir}/libexec
+          libexecdir="\${ns_appbindir}/libexec"
+     archlibdir="\${ns_appbindir}/libexec"
+     docdir="\${ns_appresdir}/etc"
+     etcdir="\${ns_appresdir}/etc"
+               infodir="\${ns_appresdir}/info"
+     mandir="\${ns_appresdir}/man"
+     lispdir="\${ns_appresdir}/lisp"
+     leimdir="\${ns_appresdir}/leim"
+     INSTALL_ARCH_INDEP_EXTRA=
   fi
   ns_frag=$srcdir/src/ns.mk
   NS_OBJ="fontset.o fringe.o image.o"
@@ -9866,6 +9479,8 @@ CPPFLAGS="$tmp_CPPFLAGS"
 
 
 
+
+
 case "${window_system}" in
   x11 )
     HAVE_X_WINDOWS=yes
@@ -9947,53 +9562,40 @@ case ${HAVE_X11} in
   yes ) HAVE_MENUS=yes ;;
 esac
 
-# Do the opsystem or machine files prohibit the use of the GNU malloc?
+# Does the opsystem file prohibit the use of the GNU malloc?
 # Assume not, until told otherwise.
 GNU_MALLOC=yes
-doug_lea_malloc=yes
-ac_fn_c_check_func "$LINENO" "malloc_get_state" "ac_cv_func_malloc_get_state"
-if test "x$ac_cv_func_malloc_get_state" = x""yes; then :
-
-else
-  doug_lea_malloc=no
-fi
-
-ac_fn_c_check_func "$LINENO" "malloc_set_state" "ac_cv_func_malloc_set_state"
-if test "x$ac_cv_func_malloc_set_state" = x""yes; then :
 
-else
-  doug_lea_malloc=no
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __after_morecore_hook exists" >&5
-$as_echo_n "checking whether __after_morecore_hook exists... " >&6; }
-if test "${emacs_cv_var___after_morecore_hook+set}" = set; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc is Doug Lea style" >&5
+$as_echo_n "checking whether malloc is Doug Lea style... " >&6; }
+if test "${emacs_cv_var_doug_lea_malloc+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-extern void (* __after_morecore_hook)();
+#include <malloc.h>
+         static void hook (void) {}
 int
 main ()
 {
-__after_morecore_hook = 0
+malloc_set_state (malloc_get_state ());
+         __after_morecore_hook = hook;
+         __malloc_initialize_hook = hook;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  emacs_cv_var___after_morecore_hook=yes
+  emacs_cv_var_doug_lea_malloc=yes
 else
-  emacs_cv_var___after_morecore_hook=no
+  emacs_cv_var_doug_lea_malloc=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_var___after_morecore_hook" >&5
-$as_echo "$emacs_cv_var___after_morecore_hook" >&6; }
-if test $emacs_cv_var___after_morecore_hook = no; then
-  doug_lea_malloc=no
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_var_doug_lea_malloc" >&5
+$as_echo "$emacs_cv_var_doug_lea_malloc" >&6; }
+doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
 
 
 system_malloc=no
@@ -10048,24 +9650,6 @@ esac
 
 
 
-  for ac_header in $ac_header_list
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
 
 
 
@@ -10338,17 +9922,8 @@ fi
 
 
 LIB_PTHREAD=
-for ac_header in pthread.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
-if test "x$ac_cv_header_pthread_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_PTHREAD_H 1
-_ACEOF
 
-fi
 
-done
 
 if test "$ac_cv_header_pthread_h"; then
         if test "$GMALLOC_OBJ" = gmalloc.o; then
@@ -10525,9 +10100,9 @@ if test "${HAVE_X11}" = "yes"; then
   CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
 
   # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
-  # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
-  # but it's more convenient here to set LD_RUN_PATH
-  # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
+  # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
+  # but it's more convenient here to set LD_RUN_PATH since this
+  # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
   if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
     LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
     export LD_RUN_PATH
@@ -10632,7 +10207,7 @@ $as_echo "#define HAVE_XKBGETKEYBOARD 1" >>confdefs.h
   fi
 
   for ac_func in XrmSetDatabase XScreenResourceString \
-XScreenNumberOfScreen XSetWMProtocols
+XScreenNumberOfScreen
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@@ -10711,48 +10286,6 @@ if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes"; then
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
   if test "$PKG_CONFIG" = "no" ; then
      :
   else
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $RSVG_MODULE" >&5
 $as_echo_n "checking for $RSVG_MODULE... " >&6; }
 
-        if $PKG_CONFIG --exists "$RSVG_MODULE" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "$RSVG_MODULE" 2>&5 &&
+          RSVG_CFLAGS=`$PKG_CONFIG --cflags "$RSVG_MODULE" 2>&5` &&
+          RSVG_LIBS=`$PKG_CONFIG --libs "$RSVG_MODULE" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           RSVG_CFLAGS=`$as_echo "$RSVG_CFLAGS" | sed -e "$edit_cflags"`
+           RSVG_LIBS=`$as_echo "$RSVG_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$RSVG_CFLAGS' LIBS='$RSVG_LIBS'" >&5
+$as_echo "yes CFLAGS='$RSVG_CFLAGS' LIBS='$RSVG_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking RSVG_CFLAGS" >&5
-$as_echo_n "checking RSVG_CFLAGS... " >&6; }
-            RSVG_CFLAGS=`$PKG_CONFIG --cflags "$RSVG_MODULE"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RSVG_CFLAGS" >&5
-$as_echo "$RSVG_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking RSVG_LIBS" >&5
-$as_echo_n "checking RSVG_LIBS... " >&6; }
-            RSVG_LIBS=`$PKG_CONFIG --libs "$RSVG_MODULE"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RSVG_LIBS" >&5
-$as_echo "$RSVG_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -10825,48 +10356,6 @@ if test "${HAVE_X11}" = "yes"; then
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
   if test "$PKG_CONFIG" = "no" ; then
      :
   else
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $IMAGEMAGICK_MODULE" >&5
 $as_echo_n "checking for $IMAGEMAGICK_MODULE... " >&6; }
 
-        if $PKG_CONFIG --exists "$IMAGEMAGICK_MODULE" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "$IMAGEMAGICK_MODULE" 2>&5 &&
+          IMAGEMAGICK_CFLAGS=`$PKG_CONFIG --cflags "$IMAGEMAGICK_MODULE" 2>&5` &&
+          IMAGEMAGICK_LIBS=`$PKG_CONFIG --libs "$IMAGEMAGICK_MODULE" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           IMAGEMAGICK_CFLAGS=`$as_echo "$IMAGEMAGICK_CFLAGS" | sed -e "$edit_cflags"`
+           IMAGEMAGICK_LIBS=`$as_echo "$IMAGEMAGICK_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$IMAGEMAGICK_CFLAGS' LIBS='$IMAGEMAGICK_LIBS'" >&5
+$as_echo "yes CFLAGS='$IMAGEMAGICK_CFLAGS' LIBS='$IMAGEMAGICK_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking IMAGEMAGICK_CFLAGS" >&5
-$as_echo_n "checking IMAGEMAGICK_CFLAGS... " >&6; }
-            IMAGEMAGICK_CFLAGS=`$PKG_CONFIG --cflags "$IMAGEMAGICK_MODULE"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IMAGEMAGICK_CFLAGS" >&5
-$as_echo "$IMAGEMAGICK_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking IMAGEMAGICK_LIBS" >&5
-$as_echo_n "checking IMAGEMAGICK_LIBS... " >&6; }
-            IMAGEMAGICK_LIBS=`$PKG_CONFIG --libs "$IMAGEMAGICK_MODULE"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $IMAGEMAGICK_LIBS" >&5
-$as_echo "$IMAGEMAGICK_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -10921,77 +10408,37 @@ $as_echo "no" >&6; }
 
     if test $HAVE_IMAGEMAGICK = yes; then
 
-$as_echo "#define HAVE_IMAGEMAGICK 1" >>confdefs.h
-
-      CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
-      LIBS="$IMAGEMAGICK_LIBS $LIBS"
-      for ac_func in MagickExportImagePixels
-do :
-  ac_fn_c_check_func "$LINENO" "MagickExportImagePixels" "ac_cv_func_MagickExportImagePixels"
-if test "x$ac_cv_func_MagickExportImagePixels" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_MAGICKEXPORTIMAGEPIXELS 1
-_ACEOF
-
-fi
-done
-
-    fi
-  fi
-fi
-
-
-HAVE_GTK=no
-GTK_OBJ=
-if test "${with_gtk3}" = "yes"; then
-  GLIB_REQUIRED=2.28
-  GTK_REQUIRED=3.0
-  GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
-
-
-  succeeded=no
-
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+$as_echo "#define HAVE_IMAGEMAGICK 1" >>confdefs.h
+
+      CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
+      LIBS="$IMAGEMAGICK_LIBS $LIBS"
+      for ac_func in MagickExportImagePixels MagickMergeImageLayers
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
 fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+done
+
+    fi
+  fi
 fi
 
 
+HAVE_GTK=no
+GTK_OBJ=
+if test "${with_gtk3}" = "yes"; then
+  GLIB_REQUIRED=2.28
+  GTK_REQUIRED=3.0
+  GTK_MODULES="gtk+-3.0 >= $GTK_REQUIRED glib-2.0 >= $GLIB_REQUIRED"
+
+
+  succeeded=no
 
   if test "$PKG_CONFIG" = "no" ; then
      pkg_check_gtk=no
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GTK_MODULES" >&5
 $as_echo_n "checking for $GTK_MODULES... " >&6; }
 
-        if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5 &&
+          GTK_CFLAGS=`$PKG_CONFIG --cflags "$GTK_MODULES" 2>&5` &&
+          GTK_LIBS=`$PKG_CONFIG --libs "$GTK_MODULES" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           GTK_CFLAGS=`$as_echo "$GTK_CFLAGS" | sed -e "$edit_cflags"`
+           GTK_LIBS=`$as_echo "$GTK_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GTK_CFLAGS' LIBS='$GTK_LIBS'" >&5
+$as_echo "yes CFLAGS='$GTK_CFLAGS' LIBS='$GTK_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_CFLAGS" >&5
-$as_echo_n "checking GTK_CFLAGS... " >&6; }
-            GTK_CFLAGS=`$PKG_CONFIG --cflags "$GTK_MODULES"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_CFLAGS" >&5
-$as_echo "$GTK_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_LIBS" >&5
-$as_echo_n "checking GTK_LIBS... " >&6; }
-            GTK_LIBS=`$PKG_CONFIG --libs "$GTK_MODULES"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_LIBS" >&5
-$as_echo "$GTK_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -11061,48 +10506,6 @@ if test "${with_gtk}" = "yes" || test "$USE_X_TOOLKIT" = "maybe"; then
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
   if test "$PKG_CONFIG" = "no" ; then
      pkg_check_gtk=no
   else
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $GTK_MODULES" >&5
 $as_echo_n "checking for $GTK_MODULES... " >&6; }
 
-        if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "$GTK_MODULES" 2>&5 &&
+          GTK_CFLAGS=`$PKG_CONFIG --cflags "$GTK_MODULES" 2>&5` &&
+          GTK_LIBS=`$PKG_CONFIG --libs "$GTK_MODULES" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           GTK_CFLAGS=`$as_echo "$GTK_CFLAGS" | sed -e "$edit_cflags"`
+           GTK_LIBS=`$as_echo "$GTK_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GTK_CFLAGS' LIBS='$GTK_LIBS'" >&5
+$as_echo "yes CFLAGS='$GTK_CFLAGS' LIBS='$GTK_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_CFLAGS" >&5
-$as_echo_n "checking GTK_CFLAGS... " >&6; }
-            GTK_CFLAGS=`$PKG_CONFIG --cflags "$GTK_MODULES"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_CFLAGS" >&5
-$as_echo "$GTK_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GTK_LIBS" >&5
-$as_echo_n "checking GTK_LIBS... " >&6; }
-            GTK_LIBS=`$PKG_CONFIG --libs "$GTK_MODULES"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GTK_LIBS" >&5
-$as_echo "$GTK_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -11263,48 +10664,6 @@ if test "${with_dbus}" = "yes"; then
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
   if test "$PKG_CONFIG" = "no" ; then
      HAVE_DBUS=no
   else
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dbus-1 >= 1.0" >&5
 $as_echo_n "checking for dbus-1 >= 1.0... " >&6; }
 
-        if $PKG_CONFIG --exists "dbus-1 >= 1.0" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "dbus-1 >= 1.0" 2>&5 &&
+          DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1 >= 1.0" 2>&5` &&
+          DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1 >= 1.0" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           DBUS_CFLAGS=`$as_echo "$DBUS_CFLAGS" | sed -e "$edit_cflags"`
+           DBUS_LIBS=`$as_echo "$DBUS_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$DBUS_CFLAGS' LIBS='$DBUS_LIBS'" >&5
+$as_echo "yes CFLAGS='$DBUS_CFLAGS' LIBS='$DBUS_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking DBUS_CFLAGS" >&5
-$as_echo_n "checking DBUS_CFLAGS... " >&6; }
-            DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-1 >= 1.0"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBUS_CFLAGS" >&5
-$as_echo "$DBUS_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking DBUS_LIBS" >&5
-$as_echo_n "checking DBUS_LIBS... " >&6; }
-            DBUS_LIBS=`$PKG_CONFIG --libs "dbus-1 >= 1.0"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBUS_LIBS" >&5
-$as_echo "$DBUS_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -11359,12 +10716,19 @@ $as_echo "no" >&6; }
 
 $as_echo "#define HAVE_DBUS 1" >>confdefs.h
 
-     for ac_func in dbus_watch_get_unix_fd
+                    for ac_func in dbus_watch_get_unix_fd \
+                   dbus_type_is_valid \
+                   dbus_validate_bus_name \
+                    dbus_validate_path \
+                   dbus_validate_interface \
+                   dbus_validate_member
 do :
-  ac_fn_c_check_func "$LINENO" "dbus_watch_get_unix_fd" "ac_cv_func_dbus_watch_get_unix_fd"
-if test "x$ac_cv_func_dbus_watch_get_unix_fd" = x""yes; then :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_DBUS_WATCH_GET_UNIX_FD 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -11380,48 +10744,6 @@ if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
   if test "$PKG_CONFIG" = "no" ; then
      HAVE_GSETTINGS=no
   else
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gio-2.0 >= 2.26" >&5
 $as_echo_n "checking for gio-2.0 >= 2.26... " >&6; }
 
-        if $PKG_CONFIG --exists "gio-2.0 >= 2.26" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "gio-2.0 >= 2.26" 2>&5 &&
+          GSETTINGS_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.26" 2>&5` &&
+          GSETTINGS_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.26" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           GSETTINGS_CFLAGS=`$as_echo "$GSETTINGS_CFLAGS" | sed -e "$edit_cflags"`
+           GSETTINGS_LIBS=`$as_echo "$GSETTINGS_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GSETTINGS_CFLAGS' LIBS='$GSETTINGS_LIBS'" >&5
+$as_echo "yes CFLAGS='$GSETTINGS_CFLAGS' LIBS='$GSETTINGS_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GSETTINGS_CFLAGS" >&5
-$as_echo_n "checking GSETTINGS_CFLAGS... " >&6; }
-            GSETTINGS_CFLAGS=`$PKG_CONFIG --cflags "gio-2.0 >= 2.26"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GSETTINGS_CFLAGS" >&5
-$as_echo "$GSETTINGS_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GSETTINGS_LIBS" >&5
-$as_echo_n "checking GSETTINGS_LIBS... " >&6; }
-            GSETTINGS_LIBS=`$PKG_CONFIG --libs "gio-2.0 >= 2.26"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GSETTINGS_LIBS" >&5
-$as_echo "$GSETTINGS_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -11485,48 +10805,6 @@ if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
   if test "$PKG_CONFIG" = "no" ; then
      HAVE_GCONF=no
   else
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gconf-2.0 >= 2.13" >&5
 $as_echo_n "checking for gconf-2.0 >= 2.13... " >&6; }
 
-        if $PKG_CONFIG --exists "gconf-2.0 >= 2.13" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "gconf-2.0 >= 2.13" 2>&5 &&
+          GCONF_CFLAGS=`$PKG_CONFIG --cflags "gconf-2.0 >= 2.13" 2>&5` &&
+          GCONF_LIBS=`$PKG_CONFIG --libs "gconf-2.0 >= 2.13" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           GCONF_CFLAGS=`$as_echo "$GCONF_CFLAGS" | sed -e "$edit_cflags"`
+           GCONF_LIBS=`$as_echo "$GCONF_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GCONF_CFLAGS' LIBS='$GCONF_LIBS'" >&5
+$as_echo "yes CFLAGS='$GCONF_CFLAGS' LIBS='$GCONF_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GCONF_CFLAGS" >&5
-$as_echo_n "checking GCONF_CFLAGS... " >&6; }
-            GCONF_CFLAGS=`$PKG_CONFIG --cflags "gconf-2.0 >= 2.13"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCONF_CFLAGS" >&5
-$as_echo "$GCONF_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking GCONF_LIBS" >&5
-$as_echo_n "checking GCONF_LIBS... " >&6; }
-            GCONF_LIBS=`$PKG_CONFIG --libs "gconf-2.0 >= 2.13"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GCONF_LIBS" >&5
-$as_echo "$GCONF_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -11666,49 +10942,7 @@ HAVE_GNUTLS=no
 HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY=no
 if test "${with_gnutls}" = "yes" ; then
 
-  succeeded=no
-
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
+  succeeded=no
 
   if test "$PKG_CONFIG" = "no" ; then
      HAVE_GNUTLS=no
         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gnutls >= 2.6.6" >&5
 $as_echo_n "checking for gnutls >= 2.6.6... " >&6; }
 
-        if $PKG_CONFIG --exists "gnutls >= 2.6.6" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "gnutls >= 2.6.6" 2>&5 &&
+          LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 2.6.6" 2>&5` &&
+          LIBGNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 2.6.6" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           LIBGNUTLS_CFLAGS=`$as_echo "$LIBGNUTLS_CFLAGS" | sed -e "$edit_cflags"`
+           LIBGNUTLS_LIBS=`$as_echo "$LIBGNUTLS_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$LIBGNUTLS_CFLAGS' LIBS='$LIBGNUTLS_LIBS'" >&5
+$as_echo "yes CFLAGS='$LIBGNUTLS_CFLAGS' LIBS='$LIBGNUTLS_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_CFLAGS" >&5
-$as_echo_n "checking LIBGNUTLS_CFLAGS... " >&6; }
-            LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 2.6.6"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_CFLAGS" >&5
-$as_echo "$LIBGNUTLS_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGNUTLS_LIBS" >&5
-$as_echo_n "checking LIBGNUTLS_LIBS... " >&6; }
-            LIBGNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 2.6.6"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGNUTLS_LIBS" >&5
-$as_echo "$LIBGNUTLS_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
@@ -12021,7 +11253,7 @@ _ACEOF
 fi
 
   test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
-fi
+  fi
 
 
 LIBXMU=-lXmu
@@ -12322,80 +11554,321 @@ if test "${HAVE_X11}" = "yes"; then
 
   succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+  if test "$PKG_CONFIG" = "no" ; then
+     HAVE_FC=no
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fontconfig >= 2.2.0" >&5
+$as_echo_n "checking for fontconfig >= 2.2.0... " >&6; }
+
+        if $PKG_CONFIG --exists "fontconfig >= 2.2.0" 2>&5 &&
+          FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags "fontconfig >= 2.2.0" 2>&5` &&
+          FONTCONFIG_LIBS=`$PKG_CONFIG --libs "fontconfig >= 2.2.0" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           FONTCONFIG_CFLAGS=`$as_echo "$FONTCONFIG_CFLAGS" | sed -e "$edit_cflags"`
+           FONTCONFIG_LIBS=`$as_echo "$FONTCONFIG_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$FONTCONFIG_CFLAGS' LIBS='$FONTCONFIG_LIBS'" >&5
+$as_echo "yes CFLAGS='$FONTCONFIG_CFLAGS' LIBS='$FONTCONFIG_LIBS'" >&6; }
+            succeeded=yes
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            FONTCONFIG_CFLAGS=""
+            FONTCONFIG_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig >= 2.2.0"`
+
+        fi
+
+
+
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     HAVE_FC=yes
+  else
+     HAVE_FC=no
+  fi
+
+
+   ## Use -lXft if available, unless `--with-xft=no'.
+   HAVE_XFT=maybe
+    if test "${HAVE_FC}" = "no" || test "x${with_x}" = "xno"; then
+      with_xft="no";
+    fi
+    if test "x${with_xft}" != "xno"; then
+
+
+  succeeded=no
+
+  if test "$PKG_CONFIG" = "no" ; then
+     HAVE_XFT=no
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xft >= 0.13.0" >&5
+$as_echo_n "checking for xft >= 0.13.0... " >&6; }
+
+        if $PKG_CONFIG --exists "xft >= 0.13.0" 2>&5 &&
+          XFT_CFLAGS=`$PKG_CONFIG --cflags "xft >= 0.13.0" 2>&5` &&
+          XFT_LIBS=`$PKG_CONFIG --libs "xft >= 0.13.0" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           XFT_CFLAGS=`$as_echo "$XFT_CFLAGS" | sed -e "$edit_cflags"`
+           XFT_LIBS=`$as_echo "$XFT_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$XFT_CFLAGS' LIBS='$XFT_LIBS'" >&5
+$as_echo "yes CFLAGS='$XFT_CFLAGS' LIBS='$XFT_LIBS'" >&6; }
+            succeeded=yes
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            XFT_CFLAGS=""
+            XFT_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            XFT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xft >= 0.13.0"`
+
+        fi
+
+
+
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     :
+  else
+     HAVE_XFT=no
+  fi
+
+      ## Because xftfont.c uses XRenderQueryExtension, we also
+      ## need to link to -lXrender.
+      HAVE_XRENDER=no
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRenderQueryExtension in -lXrender" >&5
+$as_echo_n "checking for XRenderQueryExtension in -lXrender... " >&6; }
+if test "${ac_cv_lib_Xrender_XRenderQueryExtension+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXrender  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XRenderQueryExtension ();
+int
+main ()
+{
+return XRenderQueryExtension ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xrender_XRenderQueryExtension=yes
+else
+  ac_cv_lib_Xrender_XRenderQueryExtension=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderQueryExtension" >&5
+$as_echo "$ac_cv_lib_Xrender_XRenderQueryExtension" >&6; }
+if test "x$ac_cv_lib_Xrender_XRenderQueryExtension" = x""yes; then :
+  HAVE_XRENDER=yes
+fi
+
+      if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
+       OLD_CPPFLAGS="$CPPFLAGS"
+       OLD_CFLAGS="$CFLAGS"
+       OLD_LIBS="$LIBS"
+       CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
+       CFLAGS="$CFLAGS $XFT_CFLAGS"
+       XFT_LIBS="-lXrender $XFT_LIBS"
+       LIBS="$XFT_LIBS $LIBS"
+       ac_fn_c_check_header_mongrel "$LINENO" "X11/Xft/Xft.h" "ac_cv_header_X11_Xft_Xft_h" "$ac_includes_default"
+if test "x$ac_cv_header_X11_Xft_Xft_h" = x""yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XftFontOpen in -lXft" >&5
+$as_echo_n "checking for XftFontOpen in -lXft... " >&6; }
+if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXft $XFT_LIBS $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XftFontOpen ();
+int
+main ()
+{
+return XftFontOpen ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xft_XftFontOpen=yes
+else
+  ac_cv_lib_Xft_XftFontOpen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xft_XftFontOpen" >&5
+$as_echo "$ac_cv_lib_Xft_XftFontOpen" >&6; }
+if test "x$ac_cv_lib_Xft_XftFontOpen" = x""yes; then :
+  HAVE_XFT=yes
+fi
+
+fi
+
+
+
+       if test "${HAVE_XFT}" = "yes"; then
+
+$as_echo "#define HAVE_XFT 1" >>confdefs.h
+
+
+         C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
+       else
+         CPPFLAGS="$OLD_CPPFLAGS"
+         CFLAGS="$OLD_CFLAGS"
+         LIBS="$OLD_LIBS"
+       fi                        # "${HAVE_XFT}" = "yes"
+      fi                          # "$HAVE_XFT" != no
+    fi                            # "x${with_xft}" != "xno"
+
+    ## We used to allow building with FreeType and without Xft.
+    ## However, the ftx font backend driver is not in good shape.
+    if test "$HAVE_XFT" != "yes"; then
+              HAVE_XFT=no
+       HAVE_FREETYPE=no
+    else
+
+  succeeded=no
+
+  if test "$PKG_CONFIG" = "no" ; then
+     HAVE_FREETYPE=no
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype2" >&5
+$as_echo_n "checking for freetype2... " >&6; }
+
+        if $PKG_CONFIG --exists "freetype2" 2>&5 &&
+          FREETYPE_CFLAGS=`$PKG_CONFIG --cflags "freetype2" 2>&5` &&
+          FREETYPE_LIBS=`$PKG_CONFIG --libs "freetype2" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           FREETYPE_CFLAGS=`$as_echo "$FREETYPE_CFLAGS" | sed -e "$edit_cflags"`
+           FREETYPE_LIBS=`$as_echo "$FREETYPE_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$FREETYPE_CFLAGS' LIBS='$FREETYPE_LIBS'" >&5
+$as_echo "yes CFLAGS='$FREETYPE_CFLAGS' LIBS='$FREETYPE_LIBS'" >&6; }
+            succeeded=yes
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            FREETYPE_CFLAGS=""
+            FREETYPE_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            FREETYPE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "freetype2"`
+
+        fi
+
+
+
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     HAVE_FREETYPE=yes
+  else
+     HAVE_FREETYPE=no
   fi
-done
-  done
-IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
 
+       test "$HAVE_FREETYPE" = "no" && as_fn_error "libxft requires libfreetype" "$LINENO" 5
+    fi
+
+    HAVE_LIBOTF=no
+    if test "${HAVE_FREETYPE}" = "yes"; then
+
+$as_echo "#define HAVE_FREETYPE 1" >>confdefs.h
+
+      if test "${with_libotf}" != "no"; then
 
+  succeeded=no
 
   if test "$PKG_CONFIG" = "no" ; then
-     HAVE_FC=no
+     HAVE_LIBOTF=no
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fontconfig >= 2.2.0" >&5
-$as_echo_n "checking for fontconfig >= 2.2.0... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libotf" >&5
+$as_echo_n "checking for libotf... " >&6; }
 
-        if $PKG_CONFIG --exists "fontconfig >= 2.2.0" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "libotf" 2>&5 &&
+          LIBOTF_CFLAGS=`$PKG_CONFIG --cflags "libotf" 2>&5` &&
+          LIBOTF_LIBS=`$PKG_CONFIG --libs "libotf" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           LIBOTF_CFLAGS=`$as_echo "$LIBOTF_CFLAGS" | sed -e "$edit_cflags"`
+           LIBOTF_LIBS=`$as_echo "$LIBOTF_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$LIBOTF_CFLAGS' LIBS='$LIBOTF_LIBS'" >&5
+$as_echo "yes CFLAGS='$LIBOTF_CFLAGS' LIBS='$LIBOTF_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking FONTCONFIG_CFLAGS" >&5
-$as_echo_n "checking FONTCONFIG_CFLAGS... " >&6; }
-            FONTCONFIG_CFLAGS=`$PKG_CONFIG --cflags "fontconfig >= 2.2.0"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FONTCONFIG_CFLAGS" >&5
-$as_echo "$FONTCONFIG_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking FONTCONFIG_LIBS" >&5
-$as_echo_n "checking FONTCONFIG_LIBS... " >&6; }
-            FONTCONFIG_LIBS=`$PKG_CONFIG --libs "fontconfig >= 2.2.0"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FONTCONFIG_LIBS" >&5
-$as_echo "$FONTCONFIG_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-            FONTCONFIG_CFLAGS=""
-            FONTCONFIG_LIBS=""
+            LIBOTF_CFLAGS=""
+            LIBOTF_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
             ## do set a variable so people can do so.
-            FONTCONFIG_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "fontconfig >= 2.2.0"`
+            LIBOTF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libotf"`
 
         fi
 
@@ -12408,96 +11881,102 @@ $as_echo "no" >&6; }
   fi
 
   if test $succeeded = yes; then
-     HAVE_FC=yes
+     HAVE_LIBOTF=yes
   else
-     HAVE_FC=no
+     HAVE_LIBOTF=no
   fi
 
+       if test "$HAVE_LIBOTF" = "yes"; then
 
-   ## Use -lXft if available, unless `--with-xft=no'.
-   HAVE_XFT=maybe
-    if test "${HAVE_FC}" = "no" || test "x${with_x}" = "xno"; then
-      with_xft="no";
-    fi
-    if test "x${with_xft}" != "xno"; then
-
-
-  succeeded=no
+$as_echo "#define HAVE_LIBOTF 1" >>confdefs.h
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OTF_get_variation_glyphs in -lotf" >&5
+$as_echo_n "checking for OTF_get_variation_glyphs in -lotf... " >&6; }
+if test "${ac_cv_lib_otf_OTF_get_variation_glyphs+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lotf  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char OTF_get_variation_glyphs ();
+int
+main ()
+{
+return OTF_get_variation_glyphs ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_otf_OTF_get_variation_glyphs=yes
+else
+  ac_cv_lib_otf_OTF_get_variation_glyphs=no
 fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_otf_OTF_get_variation_glyphs" >&5
+$as_echo "$ac_cv_lib_otf_OTF_get_variation_glyphs" >&6; }
+if test "x$ac_cv_lib_otf_OTF_get_variation_glyphs" = x""yes; then :
+  HAVE_OTF_GET_VARIATION_GLYPHS=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  HAVE_OTF_GET_VARIATION_GLYPHS=no
 fi
 
+         if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
+
+$as_echo "#define HAVE_OTF_GET_VARIATION_GLYPHS 1" >>confdefs.h
+
+         fi
+       fi
+      fi
+            fi
+
+    HAVE_M17N_FLT=no
+    if test "${HAVE_LIBOTF}" = yes; then
+      if test "${with_m17n_flt}" != "no"; then
 
+  succeeded=no
 
   if test "$PKG_CONFIG" = "no" ; then
-     HAVE_XFT=no
+     HAVE_M17N_FLT=no
   else
      PKG_CONFIG_MIN_VERSION=0.9.0
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xft >= 0.13.0" >&5
-$as_echo_n "checking for xft >= 0.13.0... " >&6; }
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for m17n-flt" >&5
+$as_echo_n "checking for m17n-flt... " >&6; }
 
-        if $PKG_CONFIG --exists "xft >= 0.13.0" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+        if $PKG_CONFIG --exists "m17n-flt" 2>&5 &&
+          M17N_FLT_CFLAGS=`$PKG_CONFIG --cflags "m17n-flt" 2>&5` &&
+          M17N_FLT_LIBS=`$PKG_CONFIG --libs "m17n-flt" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           M17N_FLT_CFLAGS=`$as_echo "$M17N_FLT_CFLAGS" | sed -e "$edit_cflags"`
+           M17N_FLT_LIBS=`$as_echo "$M17N_FLT_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$M17N_FLT_CFLAGS' LIBS='$M17N_FLT_LIBS'" >&5
+$as_echo "yes CFLAGS='$M17N_FLT_CFLAGS' LIBS='$M17N_FLT_LIBS'" >&6; }
             succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking XFT_CFLAGS" >&5
-$as_echo_n "checking XFT_CFLAGS... " >&6; }
-            XFT_CFLAGS=`$PKG_CONFIG --cflags "xft >= 0.13.0"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XFT_CFLAGS" >&5
-$as_echo "$XFT_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking XFT_LIBS" >&5
-$as_echo_n "checking XFT_LIBS... " >&6; }
-            XFT_LIBS=`$PKG_CONFIG --libs "xft >= 0.13.0"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XFT_LIBS" >&5
-$as_echo "$XFT_LIBS" >&6; }
         else
             { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
-            XFT_CFLAGS=""
-            XFT_LIBS=""
+            M17N_FLT_CFLAGS=""
+            M17N_FLT_LIBS=""
             ## If we have a custom action on failure, don't print errors, but
             ## do set a variable so people can do so.
-            XFT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "xft >= 0.13.0"`
+            M17N_FLT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "m17n-flt"`
 
         fi
 
@@ -12510,21 +11989,50 @@ $as_echo "no" >&6; }
   fi
 
   if test $succeeded = yes; then
-     :
+     HAVE_M17N_FLT=yes
   else
-     HAVE_XFT=no
+     HAVE_M17N_FLT=no
   fi
 
-      ## Because xftfont.c uses XRenderQueryExtension, we also
-      ## need to link to -lXrender.
-      HAVE_XRENDER=no
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRenderQueryExtension in -lXrender" >&5
-$as_echo_n "checking for XRenderQueryExtension in -lXrender... " >&6; }
-if test "${ac_cv_lib_Xrender_XRenderQueryExtension+set}" = set; then :
+       if test "$HAVE_M17N_FLT" = "yes"; then
+
+$as_echo "#define HAVE_M17N_FLT 1" >>confdefs.h
+
+       fi
+      fi
+    fi
+else
+    HAVE_XFT=no
+    HAVE_FREETYPE=no
+    HAVE_LIBOTF=no
+    HAVE_M17N_FLT=no
+fi
+
+### End of font-backend (under X11) section.
+
+
+
+
+
+
+
+
+
+
+### Use -lXpm if available, unless `--with-xpm=no'.
+HAVE_XPM=no
+LIBXPM=
+if test "${HAVE_X11}" = "yes"; then
+  if test "${with_xpm}" != "no"; then
+    ac_fn_c_check_header_mongrel "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "$ac_includes_default"
+if test "x$ac_cv_header_X11_xpm_h" = x""yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReadFileToPixmap in -lXpm" >&5
+$as_echo_n "checking for XpmReadFileToPixmap in -lXpm... " >&6; }
+if test "${ac_cv_lib_Xpm_XpmReadFileToPixmap+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXrender  $LIBS"
+LIBS="-lXpm -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12534,47 +12042,86 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XRenderQueryExtension ();
+char XpmReadFileToPixmap ();
 int
 main ()
 {
-return XRenderQueryExtension ();
+return XpmReadFileToPixmap ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xrender_XRenderQueryExtension=yes
+  ac_cv_lib_Xpm_XpmReadFileToPixmap=yes
 else
-  ac_cv_lib_Xrender_XRenderQueryExtension=no
+  ac_cv_lib_Xpm_XpmReadFileToPixmap=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderQueryExtension" >&5
-$as_echo "$ac_cv_lib_Xrender_XRenderQueryExtension" >&6; }
-if test "x$ac_cv_lib_Xrender_XRenderQueryExtension" = x""yes; then :
-  HAVE_XRENDER=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xpm_XpmReadFileToPixmap" >&5
+$as_echo "$ac_cv_lib_Xpm_XpmReadFileToPixmap" >&6; }
+if test "x$ac_cv_lib_Xpm_XpmReadFileToPixmap" = x""yes; then :
+  HAVE_XPM=yes
 fi
 
-      if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
-       OLD_CPPFLAGS="$CPPFLAGS"
-       OLD_CFLAGS="$CFLAGS"
-       OLD_LIBS="$LIBS"
-       CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
-       CFLAGS="$CFLAGS $XFT_CFLAGS"
-       XFT_LIBS="-lXrender $XFT_LIBS"
-       LIBS="$XFT_LIBS $LIBS"
-       ac_fn_c_check_header_mongrel "$LINENO" "X11/Xft/Xft.h" "ac_cv_header_X11_Xft_Xft_h" "$ac_includes_default"
-if test "x$ac_cv_header_X11_Xft_Xft_h" = x""yes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XftFontOpen in -lXft" >&5
-$as_echo_n "checking for XftFontOpen in -lXft... " >&6; }
-if test "${ac_cv_lib_Xft_XftFontOpen+set}" = set; then :
+fi
+
+
+    if test "${HAVE_XPM}" = "yes"; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReturnAllocPixels preprocessor define" >&5
+$as_echo_n "checking for XpmReturnAllocPixels preprocessor define... " >&6; }
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include "X11/xpm.h"
+#ifndef XpmReturnAllocPixels
+no_return_alloc_pixels
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "no_return_alloc_pixels" >/dev/null 2>&1; then :
+  HAVE_XPM=no
+else
+  HAVE_XPM=yes
+fi
+rm -f conftest*
+
+
+      if test "${HAVE_XPM}" = "yes"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+      else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      fi
+    fi
+  fi
+
+  if test "${HAVE_XPM}" = "yes"; then
+
+$as_echo "#define HAVE_XPM 1" >>confdefs.h
+
+    LIBXPM=-lXpm
+  fi
+fi
+
+
+### Use -ljpeg if available, unless `--with-jpeg=no'.
+HAVE_JPEG=no
+LIBJPEG=
+if test "${HAVE_X11}" = "yes"; then
+  if test "${with_jpeg}" != "no"; then
+            ac_fn_c_check_header_mongrel "$LINENO" "jerror.h" "ac_cv_header_jerror_h" "$ac_includes_default"
+if test "x$ac_cv_header_jerror_h" = x""yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_destroy_compress in -ljpeg" >&5
+$as_echo_n "checking for jpeg_destroy_compress in -ljpeg... " >&6; }
+if test "${ac_cv_lib_jpeg_jpeg_destroy_compress+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXft $XFT_LIBS $LIBS"
+LIBS="-ljpeg  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12584,263 +12131,91 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XftFontOpen ();
+char jpeg_destroy_compress ();
 int
 main ()
 {
-return XftFontOpen ();
+return jpeg_destroy_compress ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xft_XftFontOpen=yes
+  ac_cv_lib_jpeg_jpeg_destroy_compress=yes
 else
-  ac_cv_lib_Xft_XftFontOpen=no
+  ac_cv_lib_jpeg_jpeg_destroy_compress=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xft_XftFontOpen" >&5
-$as_echo "$ac_cv_lib_Xft_XftFontOpen" >&6; }
-if test "x$ac_cv_lib_Xft_XftFontOpen" = x""yes; then :
-  HAVE_XFT=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_destroy_compress" >&5
+$as_echo "$ac_cv_lib_jpeg_jpeg_destroy_compress" >&6; }
+if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = x""yes; then :
+  HAVE_JPEG=yes
 fi
 
 fi
 
 
+  fi
 
-       if test "${HAVE_XFT}" = "yes"; then
-
-$as_echo "#define HAVE_XFT 1" >>confdefs.h
-
-
-         C_SWITCH_X_SITE="$C_SWITCH_X_SITE $XFT_CFLAGS"
-       else
-         CPPFLAGS="$OLD_CPPFLAGS"
-         CFLAGS="$OLD_CFLAGS"
-         LIBS="$OLD_LIBS"
-       fi                        # "${HAVE_XFT}" = "yes"
-      fi                          # "$HAVE_XFT" != no
-    fi                            # "x${with_xft}" != "xno"
-
-    ## We used to allow building with FreeType and without Xft.
-    ## However, the ftx font backend driver is not in good shape.
-    if test "$HAVE_XFT" != "yes"; then
-              HAVE_XFT=no
-       HAVE_FREETYPE=no
-    else
+    if test "${HAVE_JPEG}" = "yes"; then
+    $as_echo "#define HAVE_JPEG 1" >>confdefs.h
 
-  succeeded=no
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <jpeglib.h>
+        version=JPEG_LIB_VERSION
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "version= *(6[2-9]|[7-9][0-9])" >/dev/null 2>&1; then :
+  $as_echo "#define HAVE_JPEG 1" >>confdefs.h
 
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libjpeg found, but not version 6b or later" >&5
+$as_echo "$as_me: WARNING: libjpeg found, but not version 6b or later" >&2;}
+        HAVE_JPEG=no
 fi
+rm -f conftest*
 
-
-
-  if test "$PKG_CONFIG" = "no" ; then
-     HAVE_FREETYPE=no
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for freetype2" >&5
-$as_echo_n "checking for freetype2... " >&6; }
-
-        if $PKG_CONFIG --exists "freetype2" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking FREETYPE_CFLAGS" >&5
-$as_echo_n "checking FREETYPE_CFLAGS... " >&6; }
-            FREETYPE_CFLAGS=`$PKG_CONFIG --cflags "freetype2"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_CFLAGS" >&5
-$as_echo "$FREETYPE_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking FREETYPE_LIBS" >&5
-$as_echo_n "checking FREETYPE_LIBS... " >&6; }
-            FREETYPE_LIBS=`$PKG_CONFIG --libs "freetype2"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_LIBS" >&5
-$as_echo "$FREETYPE_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-            FREETYPE_CFLAGS=""
-            FREETYPE_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            FREETYPE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "freetype2"`
-
-        fi
-
-
-
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
-
-  if test $succeeded = yes; then
-     HAVE_FREETYPE=yes
-  else
-     HAVE_FREETYPE=no
   fi
-
-
-       test "$HAVE_FREETYPE" = "no" && as_fn_error "libxft requires libfreetype" "$LINENO" 5
-    fi
-
-    HAVE_LIBOTF=no
-    if test "${HAVE_FREETYPE}" = "yes"; then
-
-$as_echo "#define HAVE_FREETYPE 1" >>confdefs.h
-
-      if test "${with_libotf}" != "no"; then
-
-  succeeded=no
-
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+  if test "${HAVE_JPEG}" = "yes"; then
+    LIBJPEG=-ljpeg
   fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
 fi
 
 
+### Use -lpng if available, unless `--with-png=no'.
+HAVE_PNG=no
+LIBPNG=
+if test "${HAVE_X11}" = "yes"; then
+  if test "${with_png}" != "no"; then
+    # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
+    # in /usr/include/libpng.
+    for ac_header in png.h libpng/png.h
+do :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+eval as_val=\$$as_ac_Header
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+ break
+fi
 
-  if test "$PKG_CONFIG" = "no" ; then
-     HAVE_LIBOTF=no
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libotf" >&5
-$as_echo_n "checking for libotf... " >&6; }
-
-        if $PKG_CONFIG --exists "libotf" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBOTF_CFLAGS" >&5
-$as_echo_n "checking LIBOTF_CFLAGS... " >&6; }
-            LIBOTF_CFLAGS=`$PKG_CONFIG --cflags "libotf"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBOTF_CFLAGS" >&5
-$as_echo "$LIBOTF_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBOTF_LIBS" >&5
-$as_echo_n "checking LIBOTF_LIBS... " >&6; }
-            LIBOTF_LIBS=`$PKG_CONFIG --libs "libotf"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBOTF_LIBS" >&5
-$as_echo "$LIBOTF_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-            LIBOTF_CFLAGS=""
-            LIBOTF_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            LIBOTF_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libotf"`
-
-        fi
-
-
-
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
-
-  if test $succeeded = yes; then
-     HAVE_LIBOTF=yes
-  else
-     HAVE_LIBOTF=no
-  fi
-
-       if test "$HAVE_LIBOTF" = "yes"; then
-
-$as_echo "#define HAVE_LIBOTF 1" >>confdefs.h
+done
 
-         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OTF_get_variation_glyphs in -lotf" >&5
-$as_echo_n "checking for OTF_get_variation_glyphs in -lotf... " >&6; }
-if test "${ac_cv_lib_otf_OTF_get_variation_glyphs+set}" = set; then :
+    if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_get_channels in -lpng" >&5
+$as_echo_n "checking for png_get_channels in -lpng... " >&6; }
+if test "${ac_cv_lib_png_png_get_channels+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lotf  $LIBS"
+LIBS="-lpng -lz -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12850,177 +12225,137 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char OTF_get_variation_glyphs ();
+char png_get_channels ();
 int
 main ()
 {
-return OTF_get_variation_glyphs ();
+return png_get_channels ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_otf_OTF_get_variation_glyphs=yes
+  ac_cv_lib_png_png_get_channels=yes
 else
-  ac_cv_lib_otf_OTF_get_variation_glyphs=no
+  ac_cv_lib_png_png_get_channels=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_otf_OTF_get_variation_glyphs" >&5
-$as_echo "$ac_cv_lib_otf_OTF_get_variation_glyphs" >&6; }
-if test "x$ac_cv_lib_otf_OTF_get_variation_glyphs" = x""yes; then :
-  HAVE_OTF_GET_VARIATION_GLYPHS=yes
-else
-  HAVE_OTF_GET_VARIATION_GLYPHS=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_get_channels" >&5
+$as_echo "$ac_cv_lib_png_png_get_channels" >&6; }
+if test "x$ac_cv_lib_png_png_get_channels" = x""yes; then :
+  HAVE_PNG=yes
 fi
 
-         if test "${HAVE_OTF_GET_VARIATION_GLYPHS}" = "yes"; then
-
-$as_echo "#define HAVE_OTF_GET_VARIATION_GLYPHS 1" >>confdefs.h
-
-         fi
-       fi
-      fi
-            fi
-
-    HAVE_M17N_FLT=no
-    if test "${HAVE_LIBOTF}" = yes; then
-      if test "${with_m17n_flt}" != "no"; then
-
-  succeeded=no
-
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+    fi
   fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
-esac
-fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
 
+  if test "${HAVE_PNG}" = "yes"; then
 
-  if test "$PKG_CONFIG" = "no" ; then
-     HAVE_M17N_FLT=no
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for m17n-flt" >&5
-$as_echo_n "checking for m17n-flt... " >&6; }
+$as_echo "#define HAVE_PNG 1" >>confdefs.h
 
-        if $PKG_CONFIG --exists "m17n-flt" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
+    LIBPNG="-lpng -lz -lm"
 
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking M17N_FLT_CFLAGS" >&5
-$as_echo_n "checking M17N_FLT_CFLAGS... " >&6; }
-            M17N_FLT_CFLAGS=`$PKG_CONFIG --cflags "m17n-flt"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $M17N_FLT_CFLAGS" >&5
-$as_echo "$M17N_FLT_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking M17N_FLT_LIBS" >&5
-$as_echo_n "checking M17N_FLT_LIBS... " >&6; }
-            M17N_FLT_LIBS=`$PKG_CONFIG --libs "m17n-flt"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $M17N_FLT_LIBS" >&5
-$as_echo "$M17N_FLT_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-            M17N_FLT_CFLAGS=""
-            M17N_FLT_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            M17N_FLT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "m17n-flt"`
+    ac_fn_c_check_decl "$LINENO" "png_longjmp" "ac_cv_have_decl_png_longjmp" "#ifdef HAVE_LIBPNG_PNG_H
+       # include <libpng/png.h>
+       #else
+       # include <png.h>
+       #endif
 
-        fi
+"
+if test "x$ac_cv_have_decl_png_longjmp" = x""yes; then :
 
+else
 
+$as_echo "#define PNG_DEPSTRUCT /**/" >>confdefs.h
 
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
+fi
 
-  if test $succeeded = yes; then
-     HAVE_M17N_FLT=yes
-  else
-     HAVE_M17N_FLT=no
   fi
+fi
 
-       if test "$HAVE_M17N_FLT" = "yes"; then
 
-$as_echo "#define HAVE_M17N_FLT 1" >>confdefs.h
+### Use -ltiff if available, unless `--with-tiff=no'.
+HAVE_TIFF=no
+LIBTIFF=
+if test "${HAVE_X11}" = "yes"; then
+  if test "${with_tiff}" != "no"; then
+    ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default"
+if test "x$ac_cv_header_tiffio_h" = x""yes; then :
+  tifflibs="-lz -lm"
+      # At least one tiff package requires the jpeg library.
+      if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFGetVersion in -ltiff" >&5
+$as_echo_n "checking for TIFFGetVersion in -ltiff... " >&6; }
+if test "${ac_cv_lib_tiff_TIFFGetVersion+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltiff $tifflibs $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-       fi
-      fi
-    fi
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char TIFFGetVersion ();
+int
+main ()
+{
+return TIFFGetVersion ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_tiff_TIFFGetVersion=yes
 else
-    HAVE_XFT=no
-    HAVE_FREETYPE=no
-    HAVE_LIBOTF=no
-    HAVE_M17N_FLT=no
+  ac_cv_lib_tiff_TIFFGetVersion=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFGetVersion" >&5
+$as_echo "$ac_cv_lib_tiff_TIFFGetVersion" >&6; }
+if test "x$ac_cv_lib_tiff_TIFFGetVersion" = x""yes; then :
+  HAVE_TIFF=yes
 fi
 
-### End of font-backend (under X11) section.
-
-
-
+fi
 
 
+  fi
 
+  if test "${HAVE_TIFF}" = "yes"; then
 
+$as_echo "#define HAVE_TIFF 1" >>confdefs.h
 
+        LIBTIFF=-ltiff
+  fi
+fi
 
 
-### Use -lXpm if available, unless `--with-xpm=no'.
-HAVE_XPM=no
-LIBXPM=
-if test "${HAVE_X11}" = "yes"; then
-  if test "${with_xpm}" != "no"; then
-    ac_fn_c_check_header_mongrel "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "$ac_includes_default"
-if test "x$ac_cv_header_X11_xpm_h" = x""yes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReadFileToPixmap in -lXpm" >&5
-$as_echo_n "checking for XpmReadFileToPixmap in -lXpm... " >&6; }
-if test "${ac_cv_lib_Xpm_XpmReadFileToPixmap+set}" = set; then :
+### Use -lgif or -lungif if available, unless `--with-gif=no'.
+HAVE_GIF=no
+LIBGIF=
+if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default"
+if test "x$ac_cv_header_gif_lib_h" = x""yes; then :
+  # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
+# Earlier versions can crash Emacs.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGifPutExtensionLast in -lgif" >&5
+$as_echo_n "checking for EGifPutExtensionLast in -lgif... " >&6; }
+if test "${ac_cv_lib_gif_EGifPutExtensionLast+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXpm -lX11 $LIBS"
+LIBS="-lgif  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13030,86 +12365,130 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XpmReadFileToPixmap ();
+char EGifPutExtensionLast ();
 int
 main ()
 {
-return XpmReadFileToPixmap ();
+return EGifPutExtensionLast ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xpm_XpmReadFileToPixmap=yes
+  ac_cv_lib_gif_EGifPutExtensionLast=yes
 else
-  ac_cv_lib_Xpm_XpmReadFileToPixmap=no
+  ac_cv_lib_gif_EGifPutExtensionLast=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xpm_XpmReadFileToPixmap" >&5
-$as_echo "$ac_cv_lib_Xpm_XpmReadFileToPixmap" >&6; }
-if test "x$ac_cv_lib_Xpm_XpmReadFileToPixmap" = x""yes; then :
-  HAVE_XPM=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_EGifPutExtensionLast" >&5
+$as_echo "$ac_cv_lib_gif_EGifPutExtensionLast" >&6; }
+if test "x$ac_cv_lib_gif_EGifPutExtensionLast" = x""yes; then :
+  HAVE_GIF=yes
+else
+  HAVE_GIF=maybe
+fi
+
+fi
+
+
+
+  if test "$HAVE_GIF" = yes; then
+    LIBGIF=-lgif
+  elif test "$HAVE_GIF" = maybe; then
+# If gif_lib.h but no libgif, try libungif.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGifPutExtensionLast in -lungif" >&5
+$as_echo_n "checking for EGifPutExtensionLast in -lungif... " >&6; }
+if test "${ac_cv_lib_ungif_EGifPutExtensionLast+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lungif  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char EGifPutExtensionLast ();
+int
+main ()
+{
+return EGifPutExtensionLast ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_ungif_EGifPutExtensionLast=yes
+else
+  ac_cv_lib_ungif_EGifPutExtensionLast=no
 fi
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-
-    if test "${HAVE_XPM}" = "yes"; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpmReturnAllocPixels preprocessor define" >&5
-$as_echo_n "checking for XpmReturnAllocPixels preprocessor define... " >&6; }
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include "X11/xpm.h"
-#ifndef XpmReturnAllocPixels
-no_return_alloc_pixels
-#endif
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "no_return_alloc_pixels" >/dev/null 2>&1; then :
-  HAVE_XPM=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ungif_EGifPutExtensionLast" >&5
+$as_echo "$ac_cv_lib_ungif_EGifPutExtensionLast" >&6; }
+if test "x$ac_cv_lib_ungif_EGifPutExtensionLast" = x""yes; then :
+  HAVE_GIF=yes
 else
-  HAVE_XPM=yes
+  HAVE_GIF=no
 fi
-rm -f conftest*
-
 
-      if test "${HAVE_XPM}" = "yes"; then
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-      else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-      fi
-    fi
+    test "$HAVE_GIF" = yes && LIBGIF=-lungif
   fi
 
-  if test "${HAVE_XPM}" = "yes"; then
+  if test "${HAVE_GIF}" = "yes"; then
 
-$as_echo "#define HAVE_XPM 1" >>confdefs.h
+$as_echo "#define HAVE_GIF 1" >>confdefs.h
 
-    LIBXPM=-lXpm
   fi
 fi
 
 
-### Use -ljpeg if available, unless `--with-jpeg=no'.
-HAVE_JPEG=no
-LIBJPEG=
 if test "${HAVE_X11}" = "yes"; then
-  if test "${with_jpeg}" != "no"; then
-            ac_fn_c_check_header_mongrel "$LINENO" "jerror.h" "ac_cv_header_jerror_h" "$ac_includes_default"
-if test "x$ac_cv_header_jerror_h" = x""yes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_destroy_compress in -ljpeg" >&5
-$as_echo_n "checking for jpeg_destroy_compress in -ljpeg... " >&6; }
-if test "${ac_cv_lib_jpeg_jpeg_destroy_compress+set}" = set; then :
+  MISSING=""
+  WITH_NO=""
+  test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
+    MISSING="libXpm" && WITH_NO="--with-xpm=no"
+  test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
+    MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
+  test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
+    MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
+  test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
+    MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
+  test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
+    MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
+
+  if test "X${MISSING}" != X; then
+    as_fn_error "The following required libraries were not found:
+    $MISSING
+Maybe some development libraries/packages are missing?
+If you don't want to link with them give
+    $WITH_NO
+as options to configure" "$LINENO" 5
+  fi
+fi
+
+### Use -lgpm if available, unless `--with-gpm=no'.
+HAVE_GPM=no
+LIBGPM=
+if test "${with_gpm}" != "no"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "gpm.h" "ac_cv_header_gpm_h" "$ac_includes_default"
+if test "x$ac_cv_header_gpm_h" = x""yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gpm_Open in -lgpm" >&5
+$as_echo_n "checking for Gpm_Open in -lgpm... " >&6; }
+if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ljpeg  $LIBS"
+LIBS="-lgpm  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13119,91 +12498,87 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char jpeg_destroy_compress ();
+char Gpm_Open ();
 int
 main ()
 {
-return jpeg_destroy_compress ();
+return Gpm_Open ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_jpeg_jpeg_destroy_compress=yes
+  ac_cv_lib_gpm_Gpm_Open=yes
 else
-  ac_cv_lib_jpeg_jpeg_destroy_compress=no
+  ac_cv_lib_gpm_Gpm_Open=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_destroy_compress" >&5
-$as_echo "$ac_cv_lib_jpeg_jpeg_destroy_compress" >&6; }
-if test "x$ac_cv_lib_jpeg_jpeg_destroy_compress" = x""yes; then :
-  HAVE_JPEG=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gpm_Gpm_Open" >&5
+$as_echo "$ac_cv_lib_gpm_Gpm_Open" >&6; }
+if test "x$ac_cv_lib_gpm_Gpm_Open" = x""yes; then :
+  HAVE_GPM=yes
 fi
 
 fi
 
 
+
+  if test "${HAVE_GPM}" = "yes"; then
+
+$as_echo "#define HAVE_GPM 1" >>confdefs.h
+
+    LIBGPM=-lgpm
   fi
+fi
 
-    if test "${HAVE_JPEG}" = "yes"; then
-    $as_echo "#define HAVE_JPEG 1" >>confdefs.h
 
-    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <jpeglib.h>
-        version=JPEG_LIB_VERSION
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "version= *(6[2-9]|[7-9][0-9])" >/dev/null 2>&1; then :
-  $as_echo "#define HAVE_JPEG 1" >>confdefs.h
 
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libjpeg found, but not version 6b or later" >&5
-$as_echo "$as_me: WARNING: libjpeg found, but not version 6b or later" >&2;}
-        HAVE_JPEG=no
-fi
-rm -f conftest*
 
-  fi
-  if test "${HAVE_JPEG}" = "yes"; then
-    LIBJPEG=-ljpeg
-  fi
-fi
 
+GNUSTEP_CFLAGS=
+### Use NeXTstep API to implement GUI.
+if test "${HAVE_NS}" = "yes"; then
 
-### Use -lpng if available, unless `--with-png=no'.
-HAVE_PNG=no
-LIBPNG=
-if test "${HAVE_X11}" = "yes"; then
-  if test "${with_png}" != "no"; then
-    # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
-    # in /usr/include/libpng.
-    for ac_header in png.h libpng/png.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-eval as_val=\$$as_ac_Header
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
+$as_echo "#define HAVE_NS 1" >>confdefs.h
+
+  if test "${NS_IMPL_COCOA}" = "yes"; then
+
+$as_echo "#define NS_IMPL_COCOA 1" >>confdefs.h
 
+  fi
+  if test "${NS_IMPL_GNUSTEP}" = "yes"; then
+
+$as_echo "#define NS_IMPL_GNUSTEP 1" >>confdefs.h
+
+    # See also .m.o rule in Makefile.in */
+    # FIXME: are all these flags really needed?  Document here why.  */
+    GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
+    ## Extra CFLAGS applied to src/*.m files.
+    GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE"
+  fi
+  # We also have mouse menus.
+  HAVE_MENUS=yes
+  OTHER_FILES=ns-app
 fi
 
-done
 
-    if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for png_get_channels in -lpng" >&5
-$as_echo_n "checking for png_get_channels in -lpng... " >&6; }
-if test "${ac_cv_lib_png_png_get_channels+set}" = set; then :
+### Use session management (-lSM -lICE) if available
+HAVE_X_SM=no
+LIBXSM=
+if test "${HAVE_X11}" = "yes"; then
+  ac_fn_c_check_header_mongrel "$LINENO" "X11/SM/SMlib.h" "ac_cv_header_X11_SM_SMlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_X11_SM_SMlib_h" = x""yes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SmcOpenConnection in -lSM" >&5
+$as_echo_n "checking for SmcOpenConnection in -lSM... " >&6; }
+if test "${ac_cv_lib_SM_SmcOpenConnection+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng -lz -lm $LIBS"
+LIBS="-lSM -lICE $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13213,59 +12588,110 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char png_get_channels ();
+char SmcOpenConnection ();
 int
 main ()
 {
-return png_get_channels ();
+return SmcOpenConnection ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_png_png_get_channels=yes
+  ac_cv_lib_SM_SmcOpenConnection=yes
 else
-  ac_cv_lib_png_png_get_channels=no
+  ac_cv_lib_SM_SmcOpenConnection=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_png_png_get_channels" >&5
-$as_echo "$ac_cv_lib_png_png_get_channels" >&6; }
-if test "x$ac_cv_lib_png_png_get_channels" = x""yes; then :
-  HAVE_PNG=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SM_SmcOpenConnection" >&5
+$as_echo "$ac_cv_lib_SM_SmcOpenConnection" >&6; }
+if test "x$ac_cv_lib_SM_SmcOpenConnection" = x""yes; then :
+  HAVE_X_SM=yes
 fi
 
-    fi
-  fi
+fi
 
-  if test "${HAVE_PNG}" = "yes"; then
 
-$as_echo "#define HAVE_PNG 1" >>confdefs.h
 
-    LIBPNG="-lpng -lz -lm"
+  if test "${HAVE_X_SM}" = "yes"; then
+
+$as_echo "#define HAVE_X_SM 1" >>confdefs.h
+
+    LIBXSM="-lSM -lICE"
+    case "$LIBS" in
+      *-lSM*) ;;
+      *)      LIBS="$LIBXSM $LIBS" ;;
+    esac
   fi
 fi
 
 
-### Use -ltiff if available, unless `--with-tiff=no'.
-HAVE_TIFF=no
-LIBTIFF=
-if test "${HAVE_X11}" = "yes"; then
-  if test "${with_tiff}" != "no"; then
-    ac_fn_c_check_header_mongrel "$LINENO" "tiffio.h" "ac_cv_header_tiffio_h" "$ac_includes_default"
-if test "x$ac_cv_header_tiffio_h" = x""yes; then :
-  tifflibs="-lz -lm"
-      # At least one tiff package requires the jpeg library.
-      if test "${HAVE_JPEG}" = yes; then tifflibs="-ljpeg $tifflibs"; fi
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for TIFFGetVersion in -ltiff" >&5
-$as_echo_n "checking for TIFFGetVersion in -ltiff... " >&6; }
-if test "${ac_cv_lib_tiff_TIFFGetVersion+set}" = set; then :
+### Use libxml (-lxml2) if available
+HAVE_LIBXML2=no
+if test "${with_xml2}" != "no"; then
+  ### I'm not sure what the version number should be, so I just guessed.
+
+  succeeded=no
+
+  if test "$PKG_CONFIG" = "no" ; then
+     HAVE_LIBXML2=no
+  else
+     PKG_CONFIG_MIN_VERSION=0.9.0
+     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 > 2.6.17" >&5
+$as_echo_n "checking for libxml-2.0 > 2.6.17... " >&6; }
+
+        if $PKG_CONFIG --exists "libxml-2.0 > 2.6.17" 2>&5 &&
+          LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 > 2.6.17" 2>&5` &&
+          LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 > 2.6.17" 2>&5`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           LIBXML2_CFLAGS=`$as_echo "$LIBXML2_CFLAGS" | sed -e "$edit_cflags"`
+           LIBXML2_LIBS=`$as_echo "$LIBXML2_LIBS" | sed -e 's,///*,/,g'`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$LIBXML2_CFLAGS' LIBS='$LIBXML2_LIBS'" >&5
+$as_echo "yes CFLAGS='$LIBXML2_CFLAGS' LIBS='$LIBXML2_LIBS'" >&6; }
+            succeeded=yes
+        else
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+            LIBXML2_CFLAGS=""
+            LIBXML2_LIBS=""
+            ## If we have a custom action on failure, don't print errors, but
+            ## do set a variable so people can do so.
+            LIBXML2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libxml-2.0 > 2.6.17"`
+
+        fi
+
+
+
+     else
+        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
+        echo "*** See http://www.freedesktop.org/software/pkgconfig"
+     fi
+  fi
+
+  if test $succeeded = yes; then
+     HAVE_LIBXML2=yes
+  else
+     HAVE_LIBXML2=no
+  fi
+
+  if test "${HAVE_LIBXML2}" = "yes"; then
+    LIBS="$LIBXML2_LIBS $LIBS"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for htmlReadMemory in -lxml2" >&5
+$as_echo_n "checking for htmlReadMemory in -lxml2... " >&6; }
+if test "${ac_cv_lib_xml2_htmlReadMemory+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ltiff $tifflibs $LIBS"
+LIBS="-lxml2  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13275,59 +12701,87 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char TIFFGetVersion ();
+char htmlReadMemory ();
 int
 main ()
 {
-return TIFFGetVersion ();
+return htmlReadMemory ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_tiff_TIFFGetVersion=yes
+  ac_cv_lib_xml2_htmlReadMemory=yes
 else
-  ac_cv_lib_tiff_TIFFGetVersion=no
+  ac_cv_lib_xml2_htmlReadMemory=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tiff_TIFFGetVersion" >&5
-$as_echo "$ac_cv_lib_tiff_TIFFGetVersion" >&6; }
-if test "x$ac_cv_lib_tiff_TIFFGetVersion" = x""yes; then :
-  HAVE_TIFF=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_htmlReadMemory" >&5
+$as_echo "$ac_cv_lib_xml2_htmlReadMemory" >&6; }
+if test "x$ac_cv_lib_xml2_htmlReadMemory" = x""yes; then :
+  HAVE_LIBXML2=yes
+else
+  HAVE_LIBXML2=no
 fi
 
-fi
+    if test "${HAVE_LIBXML2}" = "yes"; then
 
+$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
 
+    else
+      LIBXML2_LIBS=""
+      LIBXML2_CFLAGS=""
+    fi
   fi
+fi
 
-  if test "${HAVE_TIFF}" = "yes"; then
 
-$as_echo "#define HAVE_TIFF 1" >>confdefs.h
 
-        LIBTIFF=-ltiff
-  fi
+# If netdb.h doesn't declare h_errno, we must declare it by hand.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether netdb declares h_errno" >&5
+$as_echo_n "checking whether netdb declares h_errno... " >&6; }
+if test "${emacs_cv_netdb_declares_h_errno+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <netdb.h>
+int
+main ()
+{
+return h_errno;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_netdb_declares_h_errno=yes
+else
+  emacs_cv_netdb_declares_h_errno=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_netdb_declares_h_errno" >&5
+$as_echo "$emacs_cv_netdb_declares_h_errno" >&6; }
+if test $emacs_cv_netdb_declares_h_errno = yes; then
 
+$as_echo "#define HAVE_H_ERRNO 1" >>confdefs.h
 
-### Use -lgif or -lungif if available, unless `--with-gif=no'.
-HAVE_GIF=no
-LIBGIF=
-if test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no"; then
-  ac_fn_c_check_header_mongrel "$LINENO" "gif_lib.h" "ac_cv_header_gif_lib_h" "$ac_includes_default"
-if test "x$ac_cv_header_gif_lib_h" = x""yes; then :
-  # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
-# Earlier versions can crash Emacs.
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGifPutExtensionLast in -lgif" >&5
-$as_echo_n "checking for EGifPutExtensionLast in -lgif... " >&6; }
-if test "${ac_cv_lib_gif_EGifPutExtensionLast+set}" = set; then :
+fi
+
+# fmod, logb, and frexp are found in -lm on most systems.
+# On HPUX 9.01, -lm does not contain logb, so check for sqrt.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
+$as_echo_n "checking for sqrt in -lm... " >&6; }
+if test "${ac_cv_lib_m_sqrt+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgif  $LIBS"
+LIBS="-lm  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13337,47 +12791,45 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char EGifPutExtensionLast ();
+char sqrt ();
 int
 main ()
 {
-return EGifPutExtensionLast ();
+return sqrt ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_gif_EGifPutExtensionLast=yes
+  ac_cv_lib_m_sqrt=yes
 else
-  ac_cv_lib_gif_EGifPutExtensionLast=no
+  ac_cv_lib_m_sqrt=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gif_EGifPutExtensionLast" >&5
-$as_echo "$ac_cv_lib_gif_EGifPutExtensionLast" >&6; }
-if test "x$ac_cv_lib_gif_EGifPutExtensionLast" = x""yes; then :
-  HAVE_GIF=yes
-else
-  HAVE_GIF=maybe
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5
+$as_echo "$ac_cv_lib_m_sqrt" >&6; }
+if test "x$ac_cv_lib_m_sqrt" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
 
-fi
+  LIBS="-lm $LIBS"
 
+fi
 
 
-  if test "$HAVE_GIF" = yes; then
-    LIBGIF=-lgif
-  elif test "$HAVE_GIF" = maybe; then
-# If gif_lib.h but no libgif, try libungif.
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for EGifPutExtensionLast in -lungif" >&5
-$as_echo_n "checking for EGifPutExtensionLast in -lungif... " >&6; }
-if test "${ac_cv_lib_ungif_EGifPutExtensionLast+set}" = set; then :
+# Check for mail-locking functions in a "mail" library.  Probably this should
+# have the same check as for liblockfile below.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for maillock in -lmail" >&5
+$as_echo_n "checking for maillock in -lmail... " >&6; }
+if test "${ac_cv_lib_mail_maillock+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lungif  $LIBS"
+LIBS="-lmail  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13387,80 +12839,48 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char EGifPutExtensionLast ();
+char maillock ();
 int
 main ()
 {
-return EGifPutExtensionLast ();
+return maillock ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_ungif_EGifPutExtensionLast=yes
+  ac_cv_lib_mail_maillock=yes
 else
-  ac_cv_lib_ungif_EGifPutExtensionLast=no
+  ac_cv_lib_mail_maillock=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ungif_EGifPutExtensionLast" >&5
-$as_echo "$ac_cv_lib_ungif_EGifPutExtensionLast" >&6; }
-if test "x$ac_cv_lib_ungif_EGifPutExtensionLast" = x""yes; then :
-  HAVE_GIF=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mail_maillock" >&5
+$as_echo "$ac_cv_lib_mail_maillock" >&6; }
+if test "x$ac_cv_lib_mail_maillock" = x""yes; then :
+  have_mail=yes
 else
-  HAVE_GIF=no
-fi
-
-    test "$HAVE_GIF" = yes && LIBGIF=-lungif
-  fi
-
-  if test "${HAVE_GIF}" = "yes"; then
-
-$as_echo "#define HAVE_GIF 1" >>confdefs.h
-
-  fi
+  have_mail=no
 fi
 
+if test $have_mail = yes; then
+  LIBS_MAIL=-lmail
+  LIBS="$LIBS_MAIL $LIBS"
 
-if test "${HAVE_X11}" = "yes"; then
-  MISSING=""
-  WITH_NO=""
-  test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
-    MISSING="libXpm" && WITH_NO="--with-xpm=no"
-  test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
-    MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
-  test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
-    MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
-  test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
-    MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
-  test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
-    MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
+$as_echo "#define HAVE_LIBMAIL 1" >>confdefs.h
 
-  if test "X${MISSING}" != X; then
-    as_fn_error "The following required libraries were not found:
-    $MISSING
-Maybe some development libraries/packages are missing?
-If you don't want to link with them give
-    $WITH_NO
-as options to configure" "$LINENO" 5
-  fi
+else
+  LIBS_MAIL=
 fi
-
-### Use -lgpm if available, unless `--with-gpm=no'.
-HAVE_GPM=no
-LIBGPM=
-if test "${with_gpm}" != "no"; then
-  ac_fn_c_check_header_mongrel "$LINENO" "gpm.h" "ac_cv_header_gpm_h" "$ac_includes_default"
-if test "x$ac_cv_header_gpm_h" = x""yes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gpm_Open in -lgpm" >&5
-$as_echo_n "checking for Gpm_Open in -lgpm... " >&6; }
-if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for maillock in -llockfile" >&5
+$as_echo_n "checking for maillock in -llockfile... " >&6; }
+if test "${ac_cv_lib_lockfile_maillock+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgpm  $LIBS"
+LIBS="-llockfile  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13470,443 +12890,619 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char Gpm_Open ();
+char maillock ();
 int
 main ()
 {
-return Gpm_Open ();
+return maillock ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_gpm_Gpm_Open=yes
+  ac_cv_lib_lockfile_maillock=yes
 else
-  ac_cv_lib_gpm_Gpm_Open=no
+  ac_cv_lib_lockfile_maillock=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gpm_Gpm_Open" >&5
-$as_echo "$ac_cv_lib_gpm_Gpm_Open" >&6; }
-if test "x$ac_cv_lib_gpm_Gpm_Open" = x""yes; then :
-  HAVE_GPM=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lockfile_maillock" >&5
+$as_echo "$ac_cv_lib_lockfile_maillock" >&6; }
+if test "x$ac_cv_lib_lockfile_maillock" = x""yes; then :
+  have_lockfile=yes
+else
+  have_lockfile=no
+fi
+
+if test $have_lockfile = yes; then
+   LIBS_MAIL=-llockfile
+   LIBS="$LIBS_MAIL $LIBS"
+
+$as_echo "#define HAVE_LIBLOCKFILE 1" >>confdefs.h
+
+else
+# If we have the shared liblockfile, assume we must use it for mail
+# locking (e.g. Debian).  If we couldn't link against liblockfile
+# (no liblockfile.a installed), ensure that we don't need to.
+      # Extract the first word of "liblockfile.so", so it can be a program name with args.
+set dummy liblockfile.so; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_liblockfile+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$liblockfile"; then
+  ac_cv_prog_liblockfile="$liblockfile" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_dummy="/usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH"
+for as_dir in $as_dummy
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_liblockfile="yes"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_prog_liblockfile" && ac_cv_prog_liblockfile="no"
+fi
 fi
-
+liblockfile=$ac_cv_prog_liblockfile
+if test -n "$liblockfile"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $liblockfile" >&5
+$as_echo "$liblockfile" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
+  if test $ac_cv_prog_liblockfile = yes; then
+    as_fn_error "Shared liblockfile found but can't link against it.
+This probably means that movemail could lose mail.
+There may be a \`development' package to install containing liblockfile." "$LINENO" 5
+  fi
+fi
 
-  if test "${HAVE_GPM}" = "yes"; then
 
-$as_echo "#define HAVE_GPM 1" >>confdefs.h
 
-    LIBGPM=-lgpm
-  fi
-fi
 
 
-ac_fn_c_check_header_mongrel "$LINENO" "malloc/malloc.h" "ac_cv_header_malloc_malloc_h" "$ac_includes_default"
-if test "x$ac_cv_header_malloc_malloc_h" = x""yes; then :
+## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
+## interlock access to the mail spool.  The alternative is a lock file named
+## /usr/spool/mail/$USER.lock.
+mail_lock=no
+case "$opsys" in
+  aix4-2) mail_lock="lockf" ;;
 
-$as_echo "#define HAVE_MALLOC_MALLOC_H 1" >>confdefs.h
+  gnu|freebsd|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;;
 
-fi
+  ## On GNU/Linux systems, both methods are used by various mail programs.
+  ## I assume most people are using newer mailers that have heard of flock.
+  ## Change this if you need to.
+  ## Debian contains a patch which says: ``On Debian/GNU/Linux systems,
+  ## configure gets the right answers, and that means *NOT* using flock.
+  ## Using flock is guaranteed to be the wrong thing. See Debian Policy
+  ## for details.'' and then uses `#ifdef DEBIAN'.  Unfortunately the
+  ## Debian maintainer hasn't provided a clean fix for Emacs.
+  ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
+  ## HAVE_MAILLOCK_H are defined, so the following appears to be the
+  ## correct logic.  -- fx
+  ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
+  ## liblockfile is a Free Software replacement for libmail, used on
+  ## Debian systems and elsewhere. -rfr.
+  gnu-*)
+    mail_lock="flock"
+    if test $have_mail = yes || test $have_lockfile = yes; then
+      test $ac_cv_header_maillock_h = yes && mail_lock=no
+    fi
+    ;;
+esac
 
+BLESSMAIL_TARGET=
+case "$mail_lock" in
+  flock)
+$as_echo "#define MAIL_USE_FLOCK 1" >>confdefs.h
+ ;;
 
+  lockf)
+$as_echo "#define MAIL_USE_LOCKF 1" >>confdefs.h
+ ;;
 
-C_SWITCH_X_SYSTEM=
-### Use NeXTstep API to implement GUI.
-if test "${HAVE_NS}" = "yes"; then
+  *) BLESSMAIL_TARGET="need-blessmail" ;;
+esac
 
-$as_echo "#define HAVE_NS 1" >>confdefs.h
 
-  if test "${NS_IMPL_COCOA}" = "yes"; then
 
-$as_echo "#define NS_IMPL_COCOA 1" >>confdefs.h
+for ac_func in gethostname \
+closedir getrusage get_current_dir_name \
+lrand48 logb frexp fmod cbrt setsid \
+fpathconf select euidaccess getpagesize setlocale \
+utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \
+__fpending strsignal setitimer \
+sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
+gai_strerror mkstemp getline getdelim fsync sync \
+difftime posix_memalign \
+getpwent endpwent getgrent endgrent \
+touchlock \
+cfmakeraw cfsetspeed copysign __executable_start
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-  fi
-  if test "${NS_IMPL_GNUSTEP}" = "yes"; then
+fi
+done
 
-$as_echo "#define NS_IMPL_GNUSTEP 1" >>confdefs.h
 
-    # See also .m.o rule in Makefile.in */
-    # FIXME: are all these flags really needed?  Document here why.  */
-            C_SWITCH_X_SYSTEM="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
-    ## Extra CFLAGS applied to src/*.m files.
-    GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE"
-  fi
-  if test "${NS_HAVE_NSINTEGER}" = "yes"; then
+if test $opsys != unixware; then
+  for ac_func in getwd
+do :
+  ac_fn_c_check_func "$LINENO" "getwd" "ac_cv_func_getwd"
+if test "x$ac_cv_func_getwd" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETWD 1
+_ACEOF
 
-$as_echo "#define NS_HAVE_NSINTEGER 1" >>confdefs.h
+fi
+done
 
-  fi
-  # We also have mouse menus.
-  HAVE_MENUS=yes
-  OTHER_FILES=ns-app
 fi
 
+## Eric Backus <ericb@lsid.hp.com> says, HP-UX 9.x on HP 700 machines
+## has a broken `rint' in some library versions including math library
+## version number A.09.05.
+## You can fix the math library by installing patch number PHSS_4630.
+## But we can fix it more reliably for Emacs by just not using rint.
+## We also skip HAVE_RANDOM - see comments in src/s/hpux10-20.h.
+case $opsys in
+   hpux*) : ;;
+   *) for ac_func in random rint
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-### Use session management (-lSM -lICE) if available
-HAVE_X_SM=no
-LIBXSM=
-if test "${HAVE_X11}" = "yes"; then
-  ac_fn_c_check_header_mongrel "$LINENO" "X11/SM/SMlib.h" "ac_cv_header_X11_SM_SMlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_X11_SM_SMlib_h" = x""yes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SmcOpenConnection in -lSM" >&5
-$as_echo_n "checking for SmcOpenConnection in -lSM... " >&6; }
-if test "${ac_cv_lib_SM_SmcOpenConnection+set}" = set; then :
+fi
+done
+ ;;
+esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_unwind_init" >&5
+$as_echo_n "checking for __builtin_unwind_init... " >&6; }
+if test "${emacs_cv_func___builtin_unwind_init+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lSM -lICE $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char SmcOpenConnection ();
 int
 main ()
 {
-return SmcOpenConnection ();
+__builtin_unwind_init ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_SM_SmcOpenConnection=yes
+  emacs_cv_func___builtin_unwind_init=yes
 else
-  ac_cv_lib_SM_SmcOpenConnection=no
+  emacs_cv_func___builtin_unwind_init=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SM_SmcOpenConnection" >&5
-$as_echo "$ac_cv_lib_SM_SmcOpenConnection" >&6; }
-if test "x$ac_cv_lib_SM_SmcOpenConnection" = x""yes; then :
-  HAVE_X_SM=yes
-fi
-
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_func___builtin_unwind_init" >&5
+$as_echo "$emacs_cv_func___builtin_unwind_init" >&6; }
+if test $emacs_cv_func___builtin_unwind_init = yes; then
 
+$as_echo "#define HAVE___BUILTIN_UNWIND_INIT 1" >>confdefs.h
 
-
-  if test "${HAVE_X_SM}" = "yes"; then
-
-$as_echo "#define HAVE_X_SM 1" >>confdefs.h
-
-    LIBXSM="-lSM -lICE"
-    case "$LIBS" in
-      *-lSM*) ;;
-      *)      LIBS="$LIBXSM $LIBS" ;;
-    esac
-  fi
 fi
 
 
-### Use libxml (-lxml2) if available
-HAVE_LIBXML2=no
-if test "${with_xml2}" != "no"; then
-  ### I'm not sure what the version number should be, so I just guessed.
 
-  succeeded=no
 
-  # Extract the first word of "pkg-config", so it can be a program name with args.
-set dummy pkg-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_source+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  case $PKG_CONFIG in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
+  while :; do
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=no; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+     #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sys_largefile_source=1; break
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+  ac_cv_sys_largefile_source=unknown
+  break
 done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
-  ;;
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
+$as_echo "$ac_cv_sys_largefile_source" >&6; }
+case $ac_cv_sys_largefile_source in #(
+  no | unknown) ;;
+  *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
+_ACEOF
+;;
 esac
+rm -rf conftest*
+
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
+
+$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
+
 fi
-PKG_CONFIG=$ac_cv_path_PKG_CONFIG
-if test -n "$PKG_CONFIG"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
-$as_echo "$PKG_CONFIG" >&6; }
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getpgrp requires zero arguments" >&5
+$as_echo_n "checking whether getpgrp requires zero arguments... " >&6; }
+if test "${ac_cv_func_getpgrp_void+set}" = set; then :
+  $as_echo_n "(cached) " >&6
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  # Use it with a single arg.
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+getpgrp (0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_func_getpgrp_void=no
+else
+  ac_cv_func_getpgrp_void=yes
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getpgrp_void" >&5
+$as_echo "$ac_cv_func_getpgrp_void" >&6; }
+if test $ac_cv_func_getpgrp_void = yes; then
 
+$as_echo "#define GETPGRP_VOID 1" >>confdefs.h
 
+fi
 
-  if test "$PKG_CONFIG" = "no" ; then
-     HAVE_LIBXML2=no
-  else
-     PKG_CONFIG_MIN_VERSION=0.9.0
-     if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 > 2.6.17" >&5
-$as_echo_n "checking for libxml-2.0 > 2.6.17... " >&6; }
 
-        if $PKG_CONFIG --exists "libxml-2.0 > 2.6.17" 2>&5; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-            succeeded=yes
+# UNIX98 PTYs.
+for ac_func in grantpt
+do :
+  ac_fn_c_check_func "$LINENO" "grantpt" "ac_cv_func_grantpt"
+if test "x$ac_cv_func_grantpt" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GRANTPT 1
+_ACEOF
 
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBXML2_CFLAGS" >&5
-$as_echo_n "checking LIBXML2_CFLAGS... " >&6; }
-            LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 > 2.6.17"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBXML2_CFLAGS" >&5
-$as_echo "$LIBXML2_CFLAGS" >&6; }
-
-            { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBXML2_LIBS" >&5
-$as_echo_n "checking LIBXML2_LIBS... " >&6; }
-            LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 > 2.6.17"|sed -e 's,///*,/,g'`
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBXML2_LIBS" >&5
-$as_echo "$LIBXML2_LIBS" >&6; }
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-            LIBXML2_CFLAGS=""
-            LIBXML2_LIBS=""
-            ## If we have a custom action on failure, don't print errors, but
-            ## do set a variable so people can do so.
-            LIBXML2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libxml-2.0 > 2.6.17"`
+fi
+done
 
-        fi
 
+# PTY-related GNU extensions.
+for ac_func in getpt
+do :
+  ac_fn_c_check_func "$LINENO" "getpt" "ac_cv_func_getpt"
+if test "x$ac_cv_func_getpt" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETPT 1
+_ACEOF
 
+fi
+done
 
-     else
-        echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer."
-        echo "*** See http://www.freedesktop.org/software/pkgconfig"
-     fi
-  fi
 
-  if test $succeeded = yes; then
-     HAVE_LIBXML2=yes
+# Check this now, so that we will NOT find the above functions in ncurses.
+# That is because we have not set up to link ncurses in lib-src.
+# It's better to believe a function is not available
+# than to expect to find it in ncurses.
+# Also we need tputs and friends to be able to build at all.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5
+$as_echo_n "checking for library containing tputs... " >&6; }
+# Run a test program that contains a call to tputs, a call that is
+# never executed.  This tests whether a pre-'main' dynamic linker
+# works with the library.  It's too much trouble to actually call
+# tputs in the test program, due to portability hassles.  When
+# cross-compiling, assume the test program will run if it links.
+
+# Maybe curses should be tried earlier?
+# See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
+for tputs_library in '' tinfo ncurses terminfo termcap curses; do
+  OLIBS=$LIBS
+  if test -z "$tputs_library"; then
+    LIBS_TERMCAP=
+    msg='none required'
   else
-     HAVE_LIBXML2=no
+    LIBS_TERMCAP=-l$tputs_library
+    msg=$LIBS_TERMCAP
+    LIBS="$LIBS_TERMCAP $LIBS"
   fi
-
-  if test "${HAVE_LIBXML2}" = "yes"; then
-    LIBS="$LIBXML2_LIBS $LIBS"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for htmlReadMemory in -lxml2" >&5
-$as_echo_n "checking for htmlReadMemory in -lxml2... " >&6; }
-if test "${ac_cv_lib_xml2_htmlReadMemory+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lxml2  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if test "$cross_compiling" = yes; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char htmlReadMemory ();
-int
-main ()
-{
-return htmlReadMemory ();
-  ;
-  return 0;
-}
+  extern void tputs (const char *, int, int (*)(int));
+       int main (int argc, char **argv)
+       {
+         if (argc == 10000)
+           tputs (argv[0], 0, 0);
+         return 0;
+       }
+
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_xml2_htmlReadMemory=yes
+
 else
-  ac_cv_lib_xml2_htmlReadMemory=no
+  msg=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xml2_htmlReadMemory" >&5
-$as_echo "$ac_cv_lib_xml2_htmlReadMemory" >&6; }
-if test "x$ac_cv_lib_xml2_htmlReadMemory" = x""yes; then :
-  HAVE_LIBXML2=yes
 else
-  HAVE_LIBXML2=no
-fi
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-    if test "${HAVE_LIBXML2}" = "yes"; then
+  extern void tputs (const char *, int, int (*)(int));
+       int main (int argc, char **argv)
+       {
+         if (argc == 10000)
+           tputs (argv[0], 0, 0);
+         return 0;
+       }
 
-$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
 
-    else
-      LIBXML2_LIBS=""
-      LIBXML2_CFLAGS=""
-    fi
+else
+  msg=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+  LIBS=$OLIBS
+  if test "X$msg" != Xno; then
+    break
   fi
+done
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $msg" >&5
+$as_echo "$msg" >&6; }
+if test "X$msg" = Xno; then
+  as_fn_error "The required function \`tputs' was not found in any library.
+The following libraries were tried (in order):
+  libtinfo, libncurses, libterminfo, libtermcap, libcurses
+Please try installing whichever of these libraries is most appropriate
+for your system, together with its header files.
+For example, a libncurses-dev(el) or similar package." "$LINENO" 5
 fi
 
+## Use termcap instead of terminfo?
+## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
+TERMINFO=yes
+## FIXME?  In the cases below where we unconditionally set
+## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
+## if that was found above to have tputs.
+## Should we use the gnu* logic everywhere?
+case "$opsys" in
+  ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
+  ##  The ncurses library has been moved out of the System framework in
+  ##  Mac OS X 10.2.  So if configure detects it, set the command-line
+  ##  option to use it.
+  darwin) LIBS_TERMCAP="-lncurses" ;;
 
+  gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
 
-# If netdb.h doesn't declare h_errno, we must declare it by hand.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether netdb declares h_errno" >&5
-$as_echo_n "checking whether netdb declares h_errno... " >&6; }
-if test "${emacs_cv_netdb_declares_h_errno+set}" = set; then :
+  freebsd)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether FreeBSD is new enough to use terminfo" >&5
+$as_echo_n "checking whether FreeBSD is new enough to use terminfo... " >&6; }
+    if test "${emacs_cv_freebsd_terminfo+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <netdb.h>
+#include <osreldate.h>
 int
 main ()
 {
-return h_errno;
+#if __FreeBSD_version < 400000
+fail;
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  emacs_cv_netdb_declares_h_errno=yes
+  emacs_cv_freebsd_terminfo=yes
 else
-  emacs_cv_netdb_declares_h_errno=no
+  emacs_cv_freebsd_terminfo=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_netdb_declares_h_errno" >&5
-$as_echo "$emacs_cv_netdb_declares_h_errno" >&6; }
-if test $emacs_cv_netdb_declares_h_errno = yes; then
 
-$as_echo "#define HAVE_H_ERRNO 1" >>confdefs.h
 
-fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_freebsd_terminfo" >&5
+$as_echo "$emacs_cv_freebsd_terminfo" >&6; }
 
-# fmod, logb, and frexp are found in -lm on most systems.
-# On HPUX 9.01, -lm does not contain logb, so check for sqrt.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
-$as_echo_n "checking for sqrt in -lm... " >&6; }
-if test "${ac_cv_lib_m_sqrt+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+    if test $emacs_cv_freebsd_terminfo = yes; then
+      LIBS_TERMCAP="-lncurses"
+    else
+      TERMINFO=no
+      LIBS_TERMCAP="-ltermcap"
+    fi
+    ;;
+
+  netbsd)
+    if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
+      TERMINFO=no
+      LIBS_TERMCAP="-ltermcap"
+    fi
+    ;;
+
+  openbsd) LIBS_TERMCAP="-lncurses" ;;
+
+  ## hpux: Make sure we get select from libc rather than from libcurses
+  ##  because libcurses on HPUX 10.10 has a broken version of select.
+  ##  We used to use -lc -lcurses, but this may be cleaner.
+  ## FIXME?  But TERMINFO = yes on hpux (it used to be explicitly
+  # set that way, now it uses the default).  Isn't this a contradiction?
+  hpux*) LIBS_TERMCAP="-ltermcap" ;;
+
+esac
+
+TERMCAP_OBJ=tparam.o
+if test $TERMINFO = yes; then
+
+$as_echo "#define TERMINFO 1" >>confdefs.h
+
+  TERMCAP_OBJ=terminfo.o
+fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char sqrt ();
+
+
+
+# Do we have res_init, for detecting changes in /etc/resolv.conf?
+# On Darwin, res_init appears not to be useful: see bug#562 and
+# http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html
+resolv=no
+
+if test $opsys != darwin; then
+
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
 int
 main ()
 {
-return sqrt ();
+return res_init();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_m_sqrt=yes
+  have_res_init=yes
 else
-  ac_cv_lib_m_sqrt=no
+  have_res_init=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5
-$as_echo "$ac_cv_lib_m_sqrt" >&6; }
-if test "x$ac_cv_lib_m_sqrt" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBM 1
-_ACEOF
-
-  LIBS="-lm $LIBS"
-
-fi
-
-
-# Check for mail-locking functions in a "mail" library.  Probably this should
-# have the same check as for liblockfile below.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for maillock in -lmail" >&5
-$as_echo_n "checking for maillock in -lmail... " >&6; }
-if test "${ac_cv_lib_mail_maillock+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmail  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if test "$have_res_init" = no; then
+    OLIBS="$LIBS"
+    LIBS="$LIBS -lresolv"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_init with -lresolv" >&5
+$as_echo_n "checking for res_init with -lresolv... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char maillock ();
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
 int
 main ()
 {
-return maillock ();
+return res_init();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_mail_maillock=yes
+  have_res_init=yes
 else
-  ac_cv_lib_mail_maillock=no
+  have_res_init=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mail_maillock" >&5
-$as_echo "$ac_cv_lib_mail_maillock" >&6; }
-if test "x$ac_cv_lib_mail_maillock" = x""yes; then :
-  have_mail=yes
-else
-  have_mail=no
-fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_res_init" >&5
+$as_echo "$have_res_init" >&6; }
+    if test "$have_res_init" = yes ; then
+      resolv=yes
+    fi
+    LIBS="$OLIBS"
+  fi
 
-if test $have_mail = yes; then
-  LIBS_MAIL=-lmail
-  LIBS="$LIBS_MAIL $LIBS"
+  if test "$have_res_init" = yes; then
 
-$as_echo "#define HAVE_LIBMAIL 1" >>confdefs.h
+$as_echo "#define HAVE_RES_INIT 1" >>confdefs.h
 
-else
-  LIBS_MAIL=
+  fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for maillock in -llockfile" >&5
-$as_echo_n "checking for maillock in -llockfile... " >&6; }
-if test "${ac_cv_lib_lockfile_maillock+set}" = set; then :
+# Do we need the Hesiod library to provide the support routines?
+LIBHESIOD=
+if test "$with_hesiod" != no ; then
+  # Don't set $LIBS here -- see comments above.  FIXME which comments?
+  ac_fn_c_check_func "$LINENO" "res_send" "ac_cv_func_res_send"
+if test "x$ac_cv_func_res_send" = x""yes; then :
+
+else
+  ac_fn_c_check_func "$LINENO" "__res_send" "ac_cv_func___res_send"
+if test "x$ac_cv_func___res_send" = x""yes; then :
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_send in -lresolv" >&5
+$as_echo_n "checking for res_send in -lresolv... " >&6; }
+if test "${ac_cv_lib_resolv_res_send+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-llockfile  $LIBS"
+LIBS="-lresolv  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13916,622 +13512,509 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char maillock ();
+char res_send ();
 int
 main ()
 {
-return maillock ();
+return res_send ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_lockfile_maillock=yes
-else
-  ac_cv_lib_lockfile_maillock=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lockfile_maillock" >&5
-$as_echo "$ac_cv_lib_lockfile_maillock" >&6; }
-if test "x$ac_cv_lib_lockfile_maillock" = x""yes; then :
-  have_lockfile=yes
-else
-  have_lockfile=no
-fi
-
-if test $have_lockfile = yes; then
-   LIBS_MAIL=-llockfile
-   LIBS="$LIBS_MAIL $LIBS"
-
-$as_echo "#define HAVE_LIBLOCKFILE 1" >>confdefs.h
-
-else
-# If we have the shared liblockfile, assume we must use it for mail
-# locking (e.g. Debian).  If we couldn't link against liblockfile
-# (no liblockfile.a installed), ensure that we don't need to.
-      # Extract the first word of "liblockfile.so", so it can be a program name with args.
-set dummy liblockfile.so; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_liblockfile+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test -n "$liblockfile"; then
-  ac_cv_prog_liblockfile="$liblockfile" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_dummy="/usr/lib:/lib:/usr/local/lib:$LD_LIBRARY_PATH"
-for as_dir in $as_dummy
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_liblockfile="yes"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
-
-  test -z "$ac_cv_prog_liblockfile" && ac_cv_prog_liblockfile="no"
-fi
-fi
-liblockfile=$ac_cv_prog_liblockfile
-if test -n "$liblockfile"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $liblockfile" >&5
-$as_echo "$liblockfile" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-  if test $ac_cv_prog_liblockfile = yes; then
-    as_fn_error "Shared liblockfile found but can't link against it.
-This probably means that movemail could lose mail.
-There may be a \`development' package to install containing liblockfile." "$LINENO" 5
-  fi
-fi
-for ac_func in touchlock
-do :
-  ac_fn_c_check_func "$LINENO" "touchlock" "ac_cv_func_touchlock"
-if test "x$ac_cv_func_touchlock" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_TOUCHLOCK 1
-_ACEOF
-
-fi
-done
-
-for ac_header in maillock.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "maillock.h" "ac_cv_header_maillock_h" "$ac_includes_default"
-if test "x$ac_cv_header_maillock_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_MAILLOCK_H 1
-_ACEOF
-
-fi
-
-done
-
-
-
-## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
-## interlock access to the mail spool.  The alternative is a lock file named
-## /usr/spool/mail/$USER.lock.
-mail_lock=no
-case "$opsys" in
-  aix4-2) mail_lock="lockf" ;;
-
-  gnu|freebsd|netbsd|openbsd|darwin|irix6-5) mail_lock="flock" ;;
-
-  ## On GNU/Linux systems, both methods are used by various mail programs.
-  ## I assume most people are using newer mailers that have heard of flock.
-  ## Change this if you need to.
-  ## Debian contains a patch which says: ``On Debian/GNU/Linux systems,
-  ## configure gets the right answers, and that means *NOT* using flock.
-  ## Using flock is guaranteed to be the wrong thing. See Debian Policy
-  ## for details.'' and then uses `#ifdef DEBIAN'.  Unfortunately the
-  ## Debian maintainer hasn't provided a clean fix for Emacs.
-  ## movemail.c will use `maillock' when MAILDIR, HAVE_LIBMAIL and
-  ## HAVE_MAILLOCK_H are defined, so the following appears to be the
-  ## correct logic.  -- fx
-  ## We must check for HAVE_LIBLOCKFILE too, as movemail does.
-  ## liblockfile is a Free Software replacement for libmail, used on
-  ## Debian systems and elsewhere. -rfr.
-  gnu-*)
-    mail_lock="flock"
-    if test $have_mail = yes || test $have_lockfile = yes; then
-      test $ac_cv_header_maillock_h = yes && mail_lock=no
-    fi
-    ;;
-esac
-
-BLESSMAIL_TARGET=
-case "$mail_lock" in
-  flock)
-$as_echo "#define MAIL_USE_FLOCK 1" >>confdefs.h
- ;;
-
-  lockf)
-$as_echo "#define MAIL_USE_LOCKF 1" >>confdefs.h
- ;;
-
-  *) BLESSMAIL_TARGET="need-blessmail" ;;
-esac
-
-
-
-for ac_func in gethostname getdomainname \
-rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
-random lrand48 logb frexp fmod rint cbrt ftime setsid \
-strerror fpathconf select euidaccess getpagesize tzset setlocale \
-utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
-__fpending mblen mbrlen mbsinit strsignal setitimer ualarm \
-sendto recvfrom getsockopt setsockopt getsockname getpeername \
-gai_strerror mkstemp getline getdelim mremap fsync sync \
-difftime mempcpy mblen mbrlen posix_memalign \
-cfmakeraw cfsetspeed copysign __executable_start
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
+  ac_cv_lib_resolv_res_send=yes
+else
+  ac_cv_lib_resolv_res_send=no
 fi
-done
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_unwind_init" >&5
-$as_echo_n "checking for __builtin_unwind_init... " >&6; }
-if test "${emacs_cv_func___builtin_unwind_init+set}" = set; then :
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_send" >&5
+$as_echo "$ac_cv_lib_resolv_res_send" >&6; }
+if test "x$ac_cv_lib_resolv_res_send" = x""yes; then :
+  resolv=yes
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __res_send in -lresolv" >&5
+$as_echo_n "checking for __res_send in -lresolv... " >&6; }
+if test "${ac_cv_lib_resolv___res_send+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lresolv  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char __res_send ();
 int
 main ()
 {
-__builtin_unwind_init ();
+return __res_send ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  emacs_cv_func___builtin_unwind_init=yes
+  ac_cv_lib_resolv___res_send=yes
 else
-  emacs_cv_func___builtin_unwind_init=no
+  ac_cv_lib_resolv___res_send=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_func___builtin_unwind_init" >&5
-$as_echo "$emacs_cv_func___builtin_unwind_init" >&6; }
-if test $emacs_cv_func___builtin_unwind_init = yes; then
-
-$as_echo "#define HAVE___BUILTIN_UNWIND_INIT 1" >>confdefs.h
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv___res_send" >&5
+$as_echo "$ac_cv_lib_resolv___res_send" >&6; }
+if test "x$ac_cv_lib_resolv___res_send" = x""yes; then :
+  resolv=yes
 fi
 
-for ac_header in sys/un.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "sys/un.h" "ac_cv_header_sys_un_h" "$ac_includes_default"
-if test "x$ac_cv_header_sys_un_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_UN_H 1
-_ACEOF
+fi
 
 fi
 
-done
+fi
 
+  if test "$resolv" = yes ; then
+    RESOLVLIB=-lresolv
+  else
+    RESOLVLIB=
+  fi
+  ac_fn_c_check_func "$LINENO" "hes_getmailhost" "ac_cv_func_hes_getmailhost"
+if test "x$ac_cv_func_hes_getmailhost" = x""yes; then :
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGEFILE_SOURCE value needed for large files" >&5
-$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_source+set}" = set; then :
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hes_getmailhost in -lhesiod" >&5
+$as_echo_n "checking for hes_getmailhost in -lhesiod... " >&6; }
+if test "${ac_cv_lib_hesiod_hes_getmailhost+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  while :; do
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lhesiod $RESOLVLIB $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char hes_getmailhost ();
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+return hes_getmailhost ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=no; break
+  ac_cv_lib_hesiod_hes_getmailhost=yes
+else
+  ac_cv_lib_hesiod_hes_getmailhost=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hesiod_hes_getmailhost" >&5
+$as_echo "$ac_cv_lib_hesiod_hes_getmailhost" >&6; }
+if test "x$ac_cv_lib_hesiod_hes_getmailhost" = x""yes; then :
+  hesiod=yes
+else
+  :
+fi
+
+fi
+
+
+  if test x"$hesiod" = xyes; then
+
+$as_echo "#define HAVE_LIBHESIOD 1" >>confdefs.h
+
+    LIBHESIOD=-lhesiod
+  fi
+fi
+
+
+# Do we need libresolv (due to res_init or Hesiod)?
+if test "$resolv" = yes && test $opsys != darwin; then
+
+$as_echo "#define HAVE_LIBRESOLV 1" >>confdefs.h
+
+  LIBRESOLV=-lresolv
+else
+  LIBRESOLV=
+fi
+
+
+# These tell us which Kerberos-related libraries to use.
+COM_ERRLIB=
+CRYPTOLIB=
+KRB5LIB=
+DESLIB=
+KRB4LIB=
+
+if test "${with_kerberos}" != no; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for com_err in -lcom_err" >&5
+$as_echo_n "checking for com_err in -lcom_err... " >&6; }
+if test "${ac_cv_lib_com_err_com_err+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcom_err  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#define _LARGEFILE_SOURCE 1
-#include <sys/types.h> /* for off_t */
-     #include <stdio.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char com_err ();
 int
 main ()
 {
-int (*fp) (FILE *, off_t, int) = fseeko;
-     return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+return com_err ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sys_largefile_source=1; break
+  ac_cv_lib_com_err_com_err=yes
+else
+  ac_cv_lib_com_err_com_err=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  ac_cv_sys_largefile_source=unknown
-  break
-done
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_source" >&5
-$as_echo "$ac_cv_sys_largefile_source" >&6; }
-case $ac_cv_sys_largefile_source in #(
-  no | unknown) ;;
-  *)
-cat >>confdefs.h <<_ACEOF
-#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
-_ACEOF
-;;
-esac
-rm -rf conftest*
-
-# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
-# in glibc 2.1.3, but that breaks too many other things.
-# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
-if test $ac_cv_sys_largefile_source != unknown; then
-
-$as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_com_err_com_err" >&5
+$as_echo "$ac_cv_lib_com_err_com_err" >&6; }
+if test "x$ac_cv_lib_com_err_com_err" = x""yes; then :
+  have_com_err=yes
+else
+  have_com_err=no
 fi
 
+  if test $have_com_err = yes; then
+    COM_ERRLIB=-lcom_err
+    LIBS="$COM_ERRLIB $LIBS"
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getpgrp requires zero arguments" >&5
-$as_echo_n "checking whether getpgrp requires zero arguments... " >&6; }
-if test "${ac_cv_func_getpgrp_void+set}" = set; then :
+$as_echo "#define HAVE_LIBCOM_ERR 1" >>confdefs.h
+
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mit_des_cbc_encrypt in -lcrypto" >&5
+$as_echo_n "checking for mit_des_cbc_encrypt in -lcrypto... " >&6; }
+if test "${ac_cv_lib_crypto_mit_des_cbc_encrypt+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  # Use it with a single arg.
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcrypto  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char mit_des_cbc_encrypt ();
 int
 main ()
 {
-getpgrp (0);
+return mit_des_cbc_encrypt ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_func_getpgrp_void=no
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_crypto_mit_des_cbc_encrypt=yes
 else
-  ac_cv_func_getpgrp_void=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getpgrp_void" >&5
-$as_echo "$ac_cv_func_getpgrp_void" >&6; }
-if test $ac_cv_func_getpgrp_void = yes; then
-
-$as_echo "#define GETPGRP_VOID 1" >>confdefs.h
-
+  ac_cv_lib_crypto_mit_des_cbc_encrypt=no
 fi
-
-
-# UNIX98 PTYs.
-for ac_func in grantpt
-do :
-  ac_fn_c_check_func "$LINENO" "grantpt" "ac_cv_func_grantpt"
-if test "x$ac_cv_func_grantpt" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GRANTPT 1
-_ACEOF
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-done
-
-
-# PTY-related GNU extensions.
-for ac_func in getpt
-do :
-  ac_fn_c_check_func "$LINENO" "getpt" "ac_cv_func_getpt"
-if test "x$ac_cv_func_getpt" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GETPT 1
-_ACEOF
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_mit_des_cbc_encrypt" >&5
+$as_echo "$ac_cv_lib_crypto_mit_des_cbc_encrypt" >&6; }
+if test "x$ac_cv_lib_crypto_mit_des_cbc_encrypt" = x""yes; then :
+  have_crypto=yes
+else
+  have_crypto=no
 fi
-done
 
+  if test $have_crypto = yes; then
+    CRYPTOLIB=-lcrypto
+    LIBS="$CRYPTOLIB $LIBS"
 
-# Check this now, so that we will NOT find the above functions in ncurses.
-# That is because we have not set up to link ncurses in lib-src.
-# It's better to believe a function is not available
-# than to expect to find it in ncurses.
-# Also we need tputs and friends to be able to build at all.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5
-$as_echo_n "checking for library containing tputs... " >&6; }
-# Run a test program that contains a call to tputs, a call that is
-# never executed.  This tests whether a pre-'main' dynamic linker
-# works with the library.  It's too much trouble to actually call
-# tputs in the test program, due to portability hassles.  When
-# cross-compiling, assume the test program will run if it links.
+$as_echo "#define HAVE_LIBCRYPTO 1" >>confdefs.h
 
-# Maybe curses should be tried earlier?
-# See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
-for tputs_library in '' ncurses terminfo termcap curses; do
-  OLIBS=$LIBS
-  if test -z "$tputs_library"; then
-    LIBS_TERMCAP=
-    msg='none required'
-  else
-    LIBS_TERMCAP=-l$tputs_library
-    msg=$LIBS_TERMCAP
-    LIBS="$LIBS_TERMCAP $LIBS"
   fi
-  if test "$cross_compiling" = yes; then :
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mit_des_cbc_encrypt in -lk5crypto" >&5
+$as_echo_n "checking for mit_des_cbc_encrypt in -lk5crypto... " >&6; }
+if test "${ac_cv_lib_k5crypto_mit_des_cbc_encrypt+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lk5crypto  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-  extern void tputs (const char *, int, int (*)(int));
-       int main (int argc, char **argv)
-       {
-         if (argc == 10000)
-           tputs (argv[0], 0, 0);
-         return 0;
-       }
-
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char mit_des_cbc_encrypt ();
+int
+main ()
+{
+return mit_des_cbc_encrypt ();
+  ;
+  return 0;
+}
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-
+  ac_cv_lib_k5crypto_mit_des_cbc_encrypt=yes
 else
-  msg=no
+  ac_cv_lib_k5crypto_mit_des_cbc_encrypt=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&5
+$as_echo "$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&6; }
+if test "x$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" = x""yes; then :
+  have_k5crypto=yes
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  have_k5crypto=no
+fi
 
-  extern void tputs (const char *, int, int (*)(int));
-       int main (int argc, char **argv)
-       {
-         if (argc == 10000)
-           tputs (argv[0], 0, 0);
-         return 0;
-       }
+  if test $have_k5crypto = yes; then
+    CRYPTOLIB=-lk5crypto
+    LIBS="$CRYPTOLIB $LIBS"
 
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
+$as_echo "#define HAVE_LIBK5CRYPTO 1" >>confdefs.h
+
+  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb5_init_context in -lkrb5" >&5
+$as_echo_n "checking for krb5_init_context in -lkrb5... " >&6; }
+if test "${ac_cv_lib_krb5_krb5_init_context+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkrb5  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char krb5_init_context ();
+int
+main ()
+{
+return krb5_init_context ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_krb5_krb5_init_context=yes
 else
-  msg=no
+  ac_cv_lib_krb5_krb5_init_context=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-  LIBS=$OLIBS
-  if test "X$msg" != Xno; then
-    break
-  fi
-done
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $msg" >&5
-$as_echo "$msg" >&6; }
-if test "X$msg" = Xno; then
-  as_fn_error "The required function \`tputs' was not found in any library.
-These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
-Please try installing whichever of these libraries is most appropriate
-for your system, together with its header files.
-For example, a libncurses-dev(el) or similar package." "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb5_krb5_init_context" >&5
+$as_echo "$ac_cv_lib_krb5_krb5_init_context" >&6; }
+if test "x$ac_cv_lib_krb5_krb5_init_context" = x""yes; then :
+  have_krb5=yes
+else
+  have_krb5=no
 fi
-# Must define this when any termcap library is found.
-
-$as_echo "#define HAVE_LIBNCURSES 1" >>confdefs.h
 
-## FIXME This was the cpp logic, but I am not sure it is right.
-## The above test has not necessarily found libncurses.
-HAVE_LIBNCURSES=yes
-
-## Use terminfo instead of termcap?
-## Note only system files NOT using terminfo are:
-## freebsd < 40000, ms-w32, msdos, netbsd < 599002500, and
-## darwin|gnu without ncurses.
-TERMINFO=no
-case "$opsys" in
-  ## cygwin: Fewer environment variables to go wrong, more terminal types.
-  ## hpux10-20: Use the system provided termcap(3) library.
-  ## openbsd: David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
-  ##  is necessary.  Otherwise Emacs dumps core when run -nw.
-  aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;;
+  if test $have_krb5=yes; then
+    KRB5LIB=-lkrb5
+    LIBS="$KRB5LIB $LIBS"
 
-  ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
-  ##  The ncurses library has been moved out of the System framework in
-  ##  Mac OS X 10.2.  So if configure detects it, set the command-line
-  ##  option to use it.
-  darwin|gnu*)
-    ## (HAVE_LIBNCURSES was not always true, but is since 2010-03-18.)
-    if test "x$HAVE_LIBNCURSES" = "xyes"; then
-      TERMINFO=yes
-      LIBS_TERMCAP="-lncurses"
-    fi
-    ;;
+$as_echo "#define HAVE_LIBKRB5 1" >>confdefs.h
 
-  freebsd)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether FreeBSD is new enough to use terminfo" >&5
-$as_echo_n "checking whether FreeBSD is new enough to use terminfo... " >&6; }
-    if test "${emacs_cv_freebsd_terminfo+set}" = set; then :
+  fi
+    if test "${with_kerberos5}" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_cbc_encrypt in -ldes425" >&5
+$as_echo_n "checking for des_cbc_encrypt in -ldes425... " >&6; }
+if test "${ac_cv_lib_des425_des_cbc_encrypt+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldes425  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <osreldate.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char des_cbc_encrypt ();
 int
 main ()
 {
-#if __FreeBSD_version < 400000
-fail;
-#endif
-
+return des_cbc_encrypt ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  emacs_cv_freebsd_terminfo=yes
+  ac_cv_lib_des425_des_cbc_encrypt=yes
 else
-  emacs_cv_freebsd_terminfo=no
+  ac_cv_lib_des425_des_cbc_encrypt=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_freebsd_terminfo" >&5
-$as_echo "$emacs_cv_freebsd_terminfo" >&6; }
-
-    if test $emacs_cv_freebsd_terminfo = yes; then
-      TERMINFO=yes
-      LIBS_TERMCAP="-lncurses"
-    else
-      LIBS_TERMCAP="-ltermcap"
-    fi
-    ;;
-
-  netbsd)
-    if test "x$LIBS_TERMCAP" = "x-lterminfo"; then
-      TERMINFO=yes
-    else
-      LIBS_TERMCAP="-ltermcap"
-    fi
-    ;;
-
-esac
-
-case "$opsys" in
-  ## hpux: Make sure we get select from libc rather than from libcurses
-  ##  because libcurses on HPUX 10.10 has a broken version of select.
-  ##  We used to use -lc -lcurses, but this may be cleaner.
-  hpux*) LIBS_TERMCAP="-ltermcap" ;;
-
-  openbsd) LIBS_TERMCAP="-lncurses" ;;
-
-  ## Must use system termcap, if we use any termcap.  It does special things.
-  sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;;
-esac
-
-TERMCAP_OBJ=tparam.o
-if test $TERMINFO = yes; then
-
-$as_echo "#define TERMINFO 1" >>confdefs.h
-
-  TERMCAP_OBJ=terminfo.o
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des425_des_cbc_encrypt" >&5
+$as_echo "$ac_cv_lib_des425_des_cbc_encrypt" >&6; }
+if test "x$ac_cv_lib_des425_des_cbc_encrypt" = x""yes; then :
+  have_des425=yes
+else
+  have_des425=no
 fi
 
+    if test $have_des425 = yes; then
+      DESLIB=-ldes425
+      LIBS="$DESLIB $LIBS"
 
+$as_echo "#define HAVE_LIBDES425 1" >>confdefs.h
 
-
-# Do we have res_init, for detecting changes in /etc/resolv.conf?
-resolv=no
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_cbc_encrypt in -ldes" >&5
+$as_echo_n "checking for des_cbc_encrypt in -ldes... " >&6; }
+if test "${ac_cv_lib_des_des_cbc_encrypt+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldes  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char des_cbc_encrypt ();
 int
 main ()
 {
-return res_init();
+return des_cbc_encrypt ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  have_res_init=yes
+  ac_cv_lib_des_des_cbc_encrypt=yes
 else
-  have_res_init=no
+  ac_cv_lib_des_des_cbc_encrypt=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-if test "$have_res_init" = no; then
-  OLIBS="$LIBS"
-  LIBS="$LIBS -lresolv"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_init with -lresolv" >&5
-$as_echo_n "checking for res_init with -lresolv... " >&6; }
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des_des_cbc_encrypt" >&5
+$as_echo "$ac_cv_lib_des_des_cbc_encrypt" >&6; }
+if test "x$ac_cv_lib_des_des_cbc_encrypt" = x""yes; then :
+  have_des=yes
+else
+  have_des=no
+fi
+
+      if test $have_des = yes; then
+        DESLIB=-ldes
+        LIBS="$DESLIB $LIBS"
+
+$as_echo "#define HAVE_LIBDES 1" >>confdefs.h
+
+      fi
+    fi
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_cred in -lkrb4" >&5
+$as_echo_n "checking for krb_get_cred in -lkrb4... " >&6; }
+if test "${ac_cv_lib_krb4_krb_get_cred+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lkrb4  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char krb_get_cred ();
 int
 main ()
 {
-return res_init();
+return krb_get_cred ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  have_res_init=yes
+  ac_cv_lib_krb4_krb_get_cred=yes
 else
-  have_res_init=no
+  ac_cv_lib_krb4_krb_get_cred=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_res_init" >&5
-$as_echo "$have_res_init" >&6; }
-  if test "$have_res_init" = yes ; then
-    resolv=yes
-  fi
-  LIBS="$OLIBS"
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-if test "$have_res_init" = yes; then
-
-$as_echo "#define HAVE_RES_INIT 1" >>confdefs.h
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb4_krb_get_cred" >&5
+$as_echo "$ac_cv_lib_krb4_krb_get_cred" >&6; }
+if test "x$ac_cv_lib_krb4_krb_get_cred" = x""yes; then :
+  have_krb4=yes
+else
+  have_krb4=no
 fi
 
-# Do we need the Hesiod library to provide the support routines?
-LIBHESIOD=
-if test "$with_hesiod" != no ; then
-  # Don't set $LIBS here -- see comments above.  FIXME which comments?
-  ac_fn_c_check_func "$LINENO" "res_send" "ac_cv_func_res_send"
-if test "x$ac_cv_func_res_send" = x""yes; then :
+    if test $have_krb4 = yes; then
+      KRB4LIB=-lkrb4
+      LIBS="$KRB4LIB $LIBS"
 
-else
-  ac_fn_c_check_func "$LINENO" "__res_send" "ac_cv_func___res_send"
-if test "x$ac_cv_func___res_send" = x""yes; then :
+$as_echo "#define HAVE_LIBKRB4 1" >>confdefs.h
 
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_send in -lresolv" >&5
-$as_echo_n "checking for res_send in -lresolv... " >&6; }
-if test "${ac_cv_lib_resolv_res_send+set}" = set; then :
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_cred in -lkrb" >&5
+$as_echo_n "checking for krb_get_cred in -lkrb... " >&6; }
+if test "${ac_cv_lib_krb_krb_get_cred+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv  $LIBS"
+LIBS="-lkrb  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -14541,1167 +14024,1255 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char res_send ();
+char krb_get_cred ();
 int
 main ()
 {
-return res_send ();
+return krb_get_cred ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_resolv_res_send=yes
-else
-  ac_cv_lib_resolv_res_send=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_krb_krb_get_cred=yes
+else
+  ac_cv_lib_krb_krb_get_cred=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb_krb_get_cred" >&5
+$as_echo "$ac_cv_lib_krb_krb_get_cred" >&6; }
+if test "x$ac_cv_lib_krb_krb_get_cred" = x""yes; then :
+  have_krb=yes
+else
+  have_krb=no
+fi
+
+      if test $have_krb = yes; then
+        KRB4LIB=-lkrb
+        LIBS="$KRB4LIB $LIBS"
+
+$as_echo "#define HAVE_LIBKRB 1" >>confdefs.h
+
+      fi
+    fi
+  fi
+
+  if test "${with_kerberos5}" != no; then
+    for ac_header in krb5.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "krb5.h" "ac_cv_header_krb5_h" "$ac_includes_default"
+if test "x$ac_cv_header_krb5_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_KRB5_H 1
+_ACEOF
+ ac_fn_c_check_member "$LINENO" "krb5_error" "text" "ac_cv_member_krb5_error_text" "#include <krb5.h>
+"
+if test "x$ac_cv_member_krb5_error_text" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_KRB5_ERROR_TEXT 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_member "$LINENO" "krb5_error" "e_text" "ac_cv_member_krb5_error_e_text" "#include <krb5.h>
+"
+if test "x$ac_cv_member_krb5_error_e_text" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_KRB5_ERROR_E_TEXT 1
+_ACEOF
+
+
+fi
+
+fi
+
+done
+
+  else
+    for ac_header in des.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "des.h" "ac_cv_header_des_h" "$ac_includes_default"
+if test "x$ac_cv_header_des_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DES_H 1
+_ACEOF
+
+else
+  for ac_header in kerberosIV/des.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "kerberosIV/des.h" "ac_cv_header_kerberosIV_des_h" "$ac_includes_default"
+if test "x$ac_cv_header_kerberosIV_des_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_KERBEROSIV_DES_H 1
+_ACEOF
+
+else
+  for ac_header in kerberos/des.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "kerberos/des.h" "ac_cv_header_kerberos_des_h" "$ac_includes_default"
+if test "x$ac_cv_header_kerberos_des_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_KERBEROS_DES_H 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+done
+
+fi
+
+done
+
+    for ac_header in krb.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "krb.h" "ac_cv_header_krb_h" "$ac_includes_default"
+if test "x$ac_cv_header_krb_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_KRB_H 1
+_ACEOF
+
+else
+  for ac_header in kerberosIV/krb.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "kerberosIV/krb.h" "ac_cv_header_kerberosIV_krb_h" "$ac_includes_default"
+if test "x$ac_cv_header_kerberosIV_krb_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_KERBEROSIV_KRB_H 1
+_ACEOF
+
+else
+  for ac_header in kerberos/krb.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "kerberos/krb.h" "ac_cv_header_kerberos_krb_h" "$ac_includes_default"
+if test "x$ac_cv_header_kerberos_krb_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_KERBEROS_KRB_H 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+done
+
+fi
+
+done
+
+  fi
+  for ac_header in com_err.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "com_err.h" "ac_cv_header_com_err_h" "$ac_includes_default"
+if test "x$ac_cv_header_com_err_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_COM_ERR_H 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
+
+
+
+
+
+
+
+
+  for ac_func in $ac_func_list
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_send" >&5
-$as_echo "$ac_cv_lib_resolv_res_send" >&6; }
-if test "x$ac_cv_lib_resolv_res_send" = x""yes; then :
-  resolv=yes
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __res_send in -lresolv" >&5
-$as_echo_n "checking for __res_send in -lresolv... " >&6; }
-if test "${ac_cv_lib_resolv___res_send+set}" = set; then :
+done
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether localtime caches TZ" >&5
+$as_echo_n "checking whether localtime caches TZ... " >&6; }
+if test "${emacs_cv_localtime_cache+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if test x$ac_cv_func_tzset = xyes; then
+if test "$cross_compiling" = yes; then :
+  # If we have tzset, assume the worst when cross-compiling.
+emacs_cv_localtime_cache=yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char __res_send ();
-int
-main ()
+#include <time.h>
+char TZ_GMT0[] = "TZ=GMT0";
+char TZ_PST8[] = "TZ=PST8";
+main()
 {
-return __res_send ();
-  ;
-  return 0;
+  time_t now = time ((time_t *) 0);
+  int hour_GMT0, hour_unset;
+  if (putenv (TZ_GMT0) != 0)
+    exit (1);
+  hour_GMT0 = localtime (&now)->tm_hour;
+  unsetenv("TZ");
+  hour_unset = localtime (&now)->tm_hour;
+  if (putenv (TZ_PST8) != 0)
+    exit (1);
+  if (localtime (&now)->tm_hour == hour_GMT0)
+    exit (1);
+  unsetenv("TZ");
+  if (localtime (&now)->tm_hour != hour_unset)
+    exit (1);
+  exit (0);
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_resolv___res_send=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  emacs_cv_localtime_cache=no
 else
-  ac_cv_lib_resolv___res_send=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  emacs_cv_localtime_cache=yes
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv___res_send" >&5
-$as_echo "$ac_cv_lib_resolv___res_send" >&6; }
-if test "x$ac_cv_lib_resolv___res_send" = x""yes; then :
-  resolv=yes
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+else
+       # If we lack tzset, report that localtime does not cache TZ,
+       # since we can't invalidate the cache if we don't have tzset.
+       emacs_cv_localtime_cache=no
 fi
-
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_localtime_cache" >&5
+$as_echo "$emacs_cv_localtime_cache" >&6; }
+if test $emacs_cv_localtime_cache = yes; then
+
+$as_echo "#define LOCALTIME_CACHE 1" >>confdefs.h
 
 fi
 
-  if test "$resolv" = yes ; then
-    RESOLVLIB=-lresolv
-  else
-    RESOLVLIB=
-  fi
-  ac_fn_c_check_func "$LINENO" "hes_getmailhost" "ac_cv_func_hes_getmailhost"
-if test "x$ac_cv_func_hes_getmailhost" = x""yes; then :
+ok_so_far=yes
+ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
+if test "x$ac_cv_func_socket" = x""yes; then :
 
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hes_getmailhost in -lhesiod" >&5
-$as_echo_n "checking for hes_getmailhost in -lhesiod... " >&6; }
-if test "${ac_cv_lib_hesiod_hes_getmailhost+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lhesiod $RESOLVLIB $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  ok_so_far=no
+fi
+
+if test $ok_so_far = yes; then
+  ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default"
+if test "x$ac_cv_header_netinet_in_h" = x""yes; then :
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char hes_getmailhost ();
-int
-main ()
-{
-return hes_getmailhost ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_hesiod_hes_getmailhost=yes
 else
-  ac_cv_lib_hesiod_hes_getmailhost=no
+  ok_so_far=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hesiod_hes_getmailhost" >&5
-$as_echo "$ac_cv_lib_hesiod_hes_getmailhost" >&6; }
-if test "x$ac_cv_lib_hesiod_hes_getmailhost" = x""yes; then :
-  hesiod=yes
+if test $ok_so_far = yes; then
+  ac_fn_c_check_header_mongrel "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default"
+if test "x$ac_cv_header_arpa_inet_h" = x""yes; then :
+
 else
-  :
+  ok_so_far=no
 fi
 
+
 fi
+if test $ok_so_far = yes; then
 
+$as_echo "#define HAVE_INET_SOCKETS 1" >>confdefs.h
 
-  if test x"$hesiod" = xyes; then
+fi
 
-$as_echo "#define HAVE_LIBHESIOD 1" >>confdefs.h
+if test -f /usr/lpp/X11/bin/smt.exp; then
 
-    LIBHESIOD=-lhesiod
-  fi
-fi
+$as_echo "#define HAVE_AIX_SMT_EXP 1" >>confdefs.h
 
+fi
 
-# Do we need libresolv (due to res_init or Hesiod)?
-if test "$resolv" = yes ; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system supports dynamic ptys" >&5
+$as_echo_n "checking whether system supports dynamic ptys... " >&6; }
+if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
 
-$as_echo "#define HAVE_LIBRESOLV 1" >>confdefs.h
+$as_echo "#define HAVE_DEV_PTMX 1" >>confdefs.h
 
-  LIBRESOLV=-lresolv
 else
-  LIBRESOLV=
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = x""yes; then :
 
-# These tell us which Kerberos-related libraries to use.
-COM_ERRLIB=
-CRYPTOLIB=
-KRB5LIB=
-DESLIB=
-KRB4LIB=
-
-if test "${with_kerberos}" != no; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for com_err in -lcom_err" >&5
-$as_echo_n "checking for com_err in -lcom_err... " >&6; }
-if test "${ac_cv_lib_com_err_com_err+set}" = set; then :
-  $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcom_err  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char com_err ();
-int
-main ()
-{
-return com_err ();
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_com_err_com_err=yes
-else
-  ac_cv_lib_com_err_com_err=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_com_err_com_err" >&5
-$as_echo "$ac_cv_lib_com_err_com_err" >&6; }
-if test "x$ac_cv_lib_com_err_com_err" = x""yes; then :
-  have_com_err=yes
-else
-  have_com_err=no
+
+for ac_header in vfork.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
+_ACEOF
+
 fi
 
-  if test $have_com_err = yes; then
-    COM_ERRLIB=-lcom_err
-    LIBS="$COM_ERRLIB $LIBS"
+done
 
-$as_echo "#define HAVE_LIBCOM_ERR 1" >>confdefs.h
+for ac_func in fork vfork
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
 
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mit_des_cbc_encrypt in -lcrypto" >&5
-$as_echo_n "checking for mit_des_cbc_encrypt in -lcrypto... " >&6; }
-if test "${ac_cv_lib_crypto_mit_des_cbc_encrypt+set}" = set; then :
+if test "x$ac_cv_func_fork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if test "${ac_cv_func_fork_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_fork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char mit_des_cbc_encrypt ();
+$ac_includes_default
 int
 main ()
 {
-return mit_des_cbc_encrypt ();
+
+         /* By Ruediger Kuhlmann. */
+         return fork () < 0;
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_crypto_mit_des_cbc_encrypt=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_fork_works=yes
 else
-  ac_cv_lib_crypto_mit_des_cbc_encrypt=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ac_cv_func_fork_works=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_mit_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_crypto_mit_des_cbc_encrypt" >&6; }
-if test "x$ac_cv_lib_crypto_mit_des_cbc_encrypt" = x""yes; then :
-  have_crypto=yes
-else
-  have_crypto=no
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-  if test $have_crypto = yes; then
-    CRYPTOLIB=-lcrypto
-    LIBS="$CRYPTOLIB $LIBS"
-
-$as_echo "#define HAVE_LIBCRYPTO 1" >>confdefs.h
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
 
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mit_des_cbc_encrypt in -lk5crypto" >&5
-$as_echo_n "checking for mit_des_cbc_encrypt in -lk5crypto... " >&6; }
-if test "${ac_cv_lib_k5crypto_mit_des_cbc_encrypt+set}" = set; then :
+else
+  ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+  case $host in
+    *-*-amigaos* | *-*-msdosdjgpp*)
+      # Override, as these systems have only a dummy fork() stub
+      ac_cv_func_fork_works=no
+      ;;
+    *)
+      ac_cv_func_fork_works=yes
+      ;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if test "${ac_cv_func_vfork_works+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lk5crypto  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  if test "$cross_compiling" = yes; then :
+  ac_cv_func_vfork_works=cross
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
+/* Thanks to Paul Eggert for this test.  */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+   argument registers are propagated back to the parent.  The compiler
+   is told about this with #include <vfork.h>, but some compilers
+   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
+   static variable whose address is put into a register that is
+   clobbered by the vfork.  */
+static void
 #ifdef __cplusplus
-extern "C"
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
 #endif
-char mit_des_cbc_encrypt ();
+{
+  static pid_t child;
+  if (!child) {
+    child = vfork ();
+    if (child < 0) {
+      perror ("vfork");
+      _exit(2);
+    }
+    if (!child) {
+      arg = getpid();
+      write(-1, "", 0);
+      _exit (arg);
+    }
+  }
+}
+
 int
 main ()
 {
-return mit_des_cbc_encrypt ();
-  ;
-  return 0;
+  pid_t parent = getpid ();
+  pid_t child;
+
+  sparc_address_test (0);
+
+  child = vfork ();
+
+  if (child == 0) {
+    /* Here is another test for sparc vfork register problems.  This
+       test uses lots of local variables, at least as many local
+       variables as main has allocated so far including compiler
+       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
+       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
+       reuse the register of parent for one of the local variables,
+       since it will think that parent can't possibly be used any more
+       in this routine.  Assigning to the local variable will thus
+       munge parent in the parent process.  */
+    pid_t
+      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+    /* Convince the compiler that p..p7 are live; otherwise, it might
+       use the same hardware register for all 8 local variables.  */
+    if (p != p1 || p != p2 || p != p3 || p != p4
+       || p != p5 || p != p6 || p != p7)
+      _exit(1);
+
+    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+       from child file descriptors.  If the child closes a descriptor
+       before it execs or exits, this munges the parent's descriptor
+       as well.  Test for this by closing stdout in the child.  */
+    _exit(close(fileno(stdout)) != 0);
+  } else {
+    int status;
+    struct stat st;
+
+    while (wait(&status) != child)
+      ;
+    return (
+        /* Was there some problem with vforking?  */
+        child < 0
+
+        /* Did the child fail?  (This shouldn't happen.)  */
+        || status
+
+        /* Did the vfork/compiler bug occur?  */
+        || parent != getpid()
+
+        /* Did the file descriptor bug occur?  */
+        || fstat(fileno(stdout), &st) != 0
+        );
+  }
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_k5crypto_mit_des_cbc_encrypt=yes
+if ac_fn_c_try_run "$LINENO"; then :
+  ac_cv_func_vfork_works=yes
 else
-  ac_cv_lib_k5crypto_mit_des_cbc_encrypt=no
+  ac_cv_func_vfork_works=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&6; }
-if test "x$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" = x""yes; then :
-  have_k5crypto=yes
-else
-  have_k5crypto=no
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
 
-  if test $have_k5crypto = yes; then
-    CRYPTOLIB=-lk5crypto
-    LIBS="$CRYPTOLIB $LIBS"
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+  ac_cv_func_vfork_works=$ac_cv_func_vfork
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
 
-$as_echo "#define HAVE_LIBK5CRYPTO 1" >>confdefs.h
+if test "x$ac_cv_func_vfork_works" = xyes; then
 
-  fi
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb5_init_context in -lkrb5" >&5
-$as_echo_n "checking for krb5_init_context in -lkrb5... " >&6; }
-if test "${ac_cv_lib_krb5_krb5_init_context+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb5  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char krb5_init_context ();
-int
-main ()
-{
-return krb5_init_context ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_krb5_krb5_init_context=yes
 else
-  ac_cv_lib_krb5_krb5_init_context=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
+$as_echo "#define vfork fork" >>confdefs.h
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb5_krb5_init_context" >&5
-$as_echo "$ac_cv_lib_krb5_krb5_init_context" >&6; }
-if test "x$ac_cv_lib_krb5_krb5_init_context" = x""yes; then :
-  have_krb5=yes
-else
-  have_krb5=no
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
 fi
 
-  if test $have_krb5=yes; then
-    KRB5LIB=-lkrb5
-    LIBS="$KRB5LIB $LIBS"
 
-$as_echo "#define HAVE_LIBKRB5 1" >>confdefs.h
+for ac_func in snprintf
+do :
+  ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
+if test "x$ac_cv_func_snprintf" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SNPRINTF 1
+_ACEOF
 
-  fi
-    if test "${with_kerberos5}" = no; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_cbc_encrypt in -ldes425" >&5
-$as_echo_n "checking for des_cbc_encrypt in -ldes425... " >&6; }
-if test "${ac_cv_lib_des425_des_cbc_encrypt+set}" = set; then :
+fi
+done
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
+$as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
+if test "${emacs_cv_langinfo_codeset+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldes425  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char des_cbc_encrypt ();
+#include <langinfo.h>
 int
 main ()
 {
-return des_cbc_encrypt ();
+char* cs = nl_langinfo(CODESET);
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_des425_des_cbc_encrypt=yes
+  emacs_cv_langinfo_codeset=yes
 else
-  ac_cv_lib_des425_des_cbc_encrypt=no
+  emacs_cv_langinfo_codeset=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des425_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_des425_des_cbc_encrypt" >&6; }
-if test "x$ac_cv_lib_des425_des_cbc_encrypt" = x""yes; then :
-  have_des425=yes
-else
-  have_des425=no
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_langinfo_codeset" >&5
+$as_echo "$emacs_cv_langinfo_codeset" >&6; }
+if test $emacs_cv_langinfo_codeset = yes; then
 
-    if test $have_des425 = yes; then
-      DESLIB=-ldes425
-      LIBS="$DESLIB $LIBS"
+$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
 
-$as_echo "#define HAVE_LIBDES425 1" >>confdefs.h
+fi
 
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_cbc_encrypt in -ldes" >&5
-$as_echo_n "checking for des_cbc_encrypt in -ldes... " >&6; }
-if test "${ac_cv_lib_des_des_cbc_encrypt+set}" = set; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5
+$as_echo_n "checking for mbstate_t... " >&6; }
+if test "${ac_cv_type_mbstate_t+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldes  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char des_cbc_encrypt ();
+$ac_includes_default
+#          include <wchar.h>
 int
 main ()
 {
-return des_cbc_encrypt ();
+mbstate_t x; return sizeof x;
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_des_des_cbc_encrypt=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_type_mbstate_t=yes
 else
-  ac_cv_lib_des_des_cbc_encrypt=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+  ac_cv_type_mbstate_t=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des_des_cbc_encrypt" >&5
-$as_echo "$ac_cv_lib_des_des_cbc_encrypt" >&6; }
-if test "x$ac_cv_lib_des_des_cbc_encrypt" = x""yes; then :
-  have_des=yes
-else
-  have_des=no
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5
+$as_echo "$ac_cv_type_mbstate_t" >&6; }
+   if test $ac_cv_type_mbstate_t = yes; then
 
-      if test $have_des = yes; then
-        DESLIB=-ldes
-        LIBS="$DESLIB $LIBS"
+$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h
 
-$as_echo "#define HAVE_LIBDES 1" >>confdefs.h
+   else
 
-      fi
-    fi
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_cred in -lkrb4" >&5
-$as_echo_n "checking for krb_get_cred in -lkrb4... " >&6; }
-if test "${ac_cv_lib_krb4_krb_get_cred+set}" = set; then :
+$as_echo "#define mbstate_t int" >>confdefs.h
+
+   fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C restricted array declarations" >&5
+$as_echo_n "checking for C restricted array declarations... " >&6; }
+if test "${emacs_cv_c_restrict_arr+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb4  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char krb_get_cred ();
+void fred (int x[__restrict]);
 int
 main ()
 {
-return krb_get_cred ();
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_krb4_krb_get_cred=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  emacs_cv_c_restrict_arr=yes
 else
-  ac_cv_lib_krb4_krb_get_cred=no
+  emacs_cv_c_restrict_arr=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb4_krb_get_cred" >&5
-$as_echo "$ac_cv_lib_krb4_krb_get_cred" >&6; }
-if test "x$ac_cv_lib_krb4_krb_get_cred" = x""yes; then :
-  have_krb4=yes
-else
-  have_krb4=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_c_restrict_arr" >&5
+$as_echo "$emacs_cv_c_restrict_arr" >&6; }
+if test "$emacs_cv_c_restrict_arr" = yes; then
+
+$as_echo "#define __restrict_arr __restrict" >>confdefs.h
+
 fi
 
-    if test $have_krb4 = yes; then
-      KRB4LIB=-lkrb4
-      LIBS="$KRB4LIB $LIBS"
 
-$as_echo "#define HAVE_LIBKRB4 1" >>confdefs.h
 
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_cred in -lkrb" >&5
-$as_echo_n "checking for krb_get_cred in -lkrb... " >&6; }
-if test "${ac_cv_lib_krb_krb_get_cred+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+$as_echo "#define CLASH_DETECTION 1" >>confdefs.h
+
+
+## Note: PTYs are broken on darwin <6.  Use at your own risk.
+
+$as_echo "#define HAVE_PTYS 1" >>confdefs.h
+
+
+
+$as_echo "#define HAVE_SOCKETS 1" >>confdefs.h
+
+
+
+
+
+case $opsys in
+  aix4-2)
+        if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then
+      $as_echo "#define NO_EDITRES 1" >>confdefs.h
+
+    fi
+    ;;
+
+  hpux*)
+            $as_echo "#define NO_EDITRES 1" >>confdefs.h
+
+    ;;
+esac
+
+
+case $opsys in
+  darwin | gnu | hpux* | *bsd )
+
+$as_echo "#define NO_TERMIO 1" >>confdefs.h
+
+    ;;
+
+  irix6-5 | sol2* | unixware )
+
+$as_echo "#define NSIG_MINIMUM 32" >>confdefs.h
+
+    ;;
+esac
+
+
+case $opsys in
+      hpux* | irix6-5 | openbsd | sol2* | unixware )
+
+$as_echo "#define BROKEN_SIGIO 1" >>confdefs.h
+
+    ;;
+
+  aix4-2)
+
+$as_echo "#define BROKEN_FIONREAD 1" >>confdefs.h
+
+
+$as_echo "#define BROKEN_SIGAIO 1" >>confdefs.h
+
+
+$as_echo "#define BROKEN_SIGPOLL 1" >>confdefs.h
+
+
+$as_echo "#define BROKEN_SIGPTY 1" >>confdefs.h
+
+
+
+$as_echo "#define BROKEN_GET_CURRENT_DIR_NAME 1" >>confdefs.h
+
+    ;;
+
+  freebsd)
+
+$as_echo "#define BROKEN_PTY_READ_AFTER_EAGAIN 1" >>confdefs.h
+
+    ;;
+
+      darwin)
+
+$as_echo "#define NO_ABORT 1" >>confdefs.h
+
+    ;;
+esac
+
+case $opsys in
+  gnu-* | sol2-10 )
+
+$as_echo "#define HAVE_PROCFS 1" >>confdefs.h
+
+  ;;
+esac
+
+case $opsys in
+  darwin | freebsd | netbsd | openbsd )
+
+$as_echo "#define DONT_REOPEN_PTY 1" >>confdefs.h
+
+  ;;
+esac
+
+case $opsys in
+  netbsd | openbsd) sound_device="/dev/audio" ;;
+  *) sound_device="/dev/dsp" ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_SOUND_DEVICE "$sound_device"
+_ACEOF
+
+
+
+case $opsys in
+  darwin | gnu-linux | gnu-kfreebsd )
+
+$as_echo "#define INTERRUPT_INPUT 1" >>confdefs.h
+
+  ;;
+esac
+
+
+case $opsys in
+  cygwin|gnu|gnu-linux|gnu-kfreebsd|irix6-5|freebsd|netbsd|openbsd)
+
+$as_echo "#define NARROWPROTO 1" >>confdefs.h
+
+  ;;
+esac
+
+
+
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char krb_get_cred ();
-int
-main ()
-{
-return krb_get_cred ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_krb_krb_get_cred=yes
-else
-  ac_cv_lib_krb_krb_get_cred=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb_krb_get_cred" >&5
-$as_echo "$ac_cv_lib_krb_krb_get_cred" >&6; }
-if test "x$ac_cv_lib_krb_krb_get_cred" = x""yes; then :
-  have_krb=yes
-else
-  have_krb=no
-fi
 
-      if test $have_krb = yes; then
-        KRB4LIB=-lkrb
-        LIBS="$KRB4LIB $LIBS"
 
-$as_echo "#define HAVE_LIBKRB 1" >>confdefs.h
 
-      fi
-    fi
-  fi
 
-  if test "${with_kerberos5}" != no; then
-    for ac_header in krb5.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "krb5.h" "ac_cv_header_krb5_h" "$ac_includes_default"
-if test "x$ac_cv_header_krb5_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_KRB5_H 1
-_ACEOF
- ac_fn_c_check_member "$LINENO" "krb5_error" "text" "ac_cv_member_krb5_error_text" "#include <krb5.h>
-"
-if test "x$ac_cv_member_krb5_error_text" = x""yes; then :
+case $opsys in
+  aix4-2 )
+    $as_echo "#define PTY_ITERATION int c; for (c = 0; !c ; c++) " >>confdefs.h
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_KRB5_ERROR_TEXT 1
-_ACEOF
+            $as_echo "#define PTY_NAME_SPRINTF strcpy (pty_name, \"/dev/ptc\"); " >>confdefs.h
 
+    $as_echo "#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd)); " >>confdefs.h
 
-fi
-ac_fn_c_check_member "$LINENO" "krb5_error" "e_text" "ac_cv_member_krb5_error_e_text" "#include <krb5.h>
-"
-if test "x$ac_cv_member_krb5_error_e_text" = x""yes; then :
+    ;;
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_KRB5_ERROR_E_TEXT 1
-_ACEOF
+  cygwin )
+    $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++) " >>confdefs.h
 
+        $as_echo "#define PTY_OPEN  do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0) " >>confdefs.h
 
-fi
+    $as_echo "#define PTY_NAME_SPRINTF  " >>confdefs.h
 
-fi
+    $as_echo "#define PTY_TTY_NAME_SPRINTF  " >>confdefs.h
 
-done
+    ;;
 
-  else
-    for ac_header in des.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "des.h" "ac_cv_header_des_h" "$ac_includes_default"
-if test "x$ac_cv_header_des_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DES_H 1
-_ACEOF
+  darwin )
+    $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++) " >>confdefs.h
 
-else
-  for ac_header in kerberosIV/des.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "kerberosIV/des.h" "ac_cv_header_kerberosIV_des_h" "$ac_includes_default"
-if test "x$ac_cv_header_kerberosIV_des_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_KERBEROSIV_DES_H 1
-_ACEOF
+        $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
 
-else
-  for ac_header in kerberos/des.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "kerberos/des.h" "ac_cv_header_kerberos_des_h" "$ac_includes_default"
-if test "x$ac_cv_header_kerberos_des_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_KERBEROS_DES_H 1
-_ACEOF
+                $as_echo "#define PTY_OPEN  do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (0) " >>confdefs.h
 
-fi
+    $as_echo "#define PTY_NAME_SPRINTF  " >>confdefs.h
 
-done
+    $as_echo "#define PTY_TTY_NAME_SPRINTF  " >>confdefs.h
 
-fi
+    ;;
 
-done
+  gnu | freebsd | netbsd | openbsd )
+    $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
 
-fi
+    ;;
 
-done
+  gnu-linux | gnu-kfreebsd )
+        if test "x$ac_cv_func_grantpt" = xyes; then
 
-    for ac_header in krb.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "krb.h" "ac_cv_header_krb_h" "$ac_includes_default"
-if test "x$ac_cv_header_krb_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_KRB_H 1
-_ACEOF
+$as_echo "#define UNIX98_PTYS 1" >>confdefs.h
 
-else
-  for ac_header in kerberosIV/krb.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "kerberosIV/krb.h" "ac_cv_header_kerberosIV_krb_h" "$ac_includes_default"
-if test "x$ac_cv_header_kerberosIV_krb_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_KERBEROSIV_KRB_H 1
-_ACEOF
+      $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++) " >>confdefs.h
 
-else
-  for ac_header in kerberos/krb.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "kerberos/krb.h" "ac_cv_header_kerberos_krb_h" "$ac_includes_default"
-if test "x$ac_cv_header_kerberos_krb_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_KERBEROS_KRB_H 1
-_ACEOF
+                  $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); sigunblock (sigmask (SIGCHLD)); } " >>confdefs.h
 
-fi
+            if test "x$ac_cv_func_getpt" = xyes; then
+        $as_echo "#define PTY_OPEN fd = getpt ()" >>confdefs.h
 
-done
+        $as_echo "#define PTY_NAME_SPRINTF  " >>confdefs.h
 
-fi
+      else
+        $as_echo "#define PTY_NAME_SPRINTF strcpy (pty_name, \"/dev/ptmx\"); " >>confdefs.h
 
-done
+      fi
+    else
+      $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
 
-fi
+    fi
+    ;;
 
-done
+  hpux*)
+    $as_echo "#define FIRST_PTY_LETTER 'p'" >>confdefs.h
 
-  fi
-  for ac_header in com_err.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "com_err.h" "ac_cv_header_com_err_h" "$ac_includes_default"
-if test "x$ac_cv_header_com_err_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_COM_ERR_H 1
-_ACEOF
+    $as_echo "#define PTY_NAME_SPRINTF sprintf (pty_name, \"/dev/ptym/pty%c%x\", c, i); " >>confdefs.h
 
-fi
+    $as_echo "#define PTY_TTY_NAME_SPRINTF sprintf (pty_name, \"/dev/pty/tty%c%x\", c, i); " >>confdefs.h
 
-done
+    ;;
 
-fi
+  irix6-5 )
+                                            $as_echo "#define PTY_ITERATION /**/" >>confdefs.h
 
+        $as_echo "#define FIRST_PTY_LETTER 'q'" >>confdefs.h
 
+    $as_echo "#define PTY_OPEN  { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); } " >>confdefs.h
 
+        $as_echo "#define PTY_NAME_SPRINTF  " >>confdefs.h
 
+        $as_echo "#define PTY_TTY_NAME_SPRINTF  " >>confdefs.h
 
+    ;;
 
+  sol2* )
+                            $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); } " >>confdefs.h
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether localtime caches TZ" >&5
-$as_echo_n "checking whether localtime caches TZ... " >&6; }
-if test "${emacs_cv_localtime_cache+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test x$ac_cv_func_tzset = xyes; then
-if test "$cross_compiling" = yes; then :
-  # If we have tzset, assume the worst when cross-compiling.
-emacs_cv_localtime_cache=yes
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+    ;;
+
+  unixware )
+        $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal(\"could not grant slave pty\"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal(\"could not unlock slave pty\"); if (!(ptyname = ptsname(fd))) fatal (\"could not enable slave pty\"); snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); } " >>confdefs.h
+
+    ;;
+esac
+
+
+case $opsys in
+  sol2* | unixware )
+            $as_echo "#define FIRST_PTY_LETTER 'z'" >>confdefs.h
+
+    $as_echo "#define PTY_NAME_SPRINTF strcpy (pty_name, \"/dev/ptmx\"); " >>confdefs.h
+
+
+$as_echo "#define SETUP_SLAVE_PTY if (ioctl (xforkin, I_PUSH, \"ptem\") == -1) fatal (\"ioctl I_PUSH ptem\"); if (ioctl (xforkin, I_PUSH, \"ldterm\") == -1) fatal (\"ioctl I_PUSH ldterm\"); if (ioctl (xforkin, I_PUSH, \"ttcompat\") == -1) fatal (\"ioctl I_PUSH ttcompat\");" >>confdefs.h
+
+    ;;
+esac
+
+
+
+
+case $opsys in
+      aix4-2 | cygwin | gnu | irix6-5 | freebsd | netbsd | openbsd )
+    $as_echo "#define SIGNALS_VIA_CHARACTERS 1" >>confdefs.h
+
+    ;;
+
+      gnu-linux | gnu-kfreebsd )
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for signals via characters" >&5
+$as_echo_n "checking for signals via characters... " >&6; }
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <time.h>
-char TZ_GMT0[] = "TZ=GMT0";
-char TZ_PST8[] = "TZ=PST8";
-main()
+
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < 0x20400
+# error "Linux version too old"
+#endif
+
+int
+main ()
 {
-  time_t now = time ((time_t *) 0);
-  int hour_GMT0, hour_unset;
-  if (putenv (TZ_GMT0) != 0)
-    exit (1);
-  hour_GMT0 = localtime (&now)->tm_hour;
-  unsetenv("TZ");
-  hour_unset = localtime (&now)->tm_hour;
-  if (putenv (TZ_PST8) != 0)
-    exit (1);
-  if (localtime (&now)->tm_hour == hour_GMT0)
-    exit (1);
-  unsetenv("TZ");
-  if (localtime (&now)->tm_hour != hour_unset)
-    exit (1);
-  exit (0);
+
+  ;
+  return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  emacs_cv_localtime_cache=no
+if ac_fn_c_try_cpp "$LINENO"; then :
+  emacs_signals_via_chars=yes
 else
-  emacs_cv_localtime_cache=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+  emacs_signals_via_chars=no
 fi
+rm -f conftest.err conftest.$ac_ext
 
-else
-       # If we lack tzset, report that localtime does not cache TZ,
-       # since we can't invalidate the cache if we don't have tzset.
-       emacs_cv_localtime_cache=no
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_localtime_cache" >&5
-$as_echo "$emacs_cv_localtime_cache" >&6; }
-if test $emacs_cv_localtime_cache = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_signals_via_chars" >&5
+$as_echo "$emacs_signals_via_chars" >&6; }
+    test $emacs_signals_via_chars = yes && $as_echo "#define SIGNALS_VIA_CHARACTERS 1" >>confdefs.h
 
-$as_echo "#define LOCALTIME_CACHE 1" >>confdefs.h
+    ;;
+esac
 
-fi
 
-if test "x$HAVE_TIMEVAL" = xyes; then
-  for ac_func in gettimeofday
-do :
-  ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday"
-if test "x$ac_cv_func_gettimeofday" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GETTIMEOFDAY 1
-_ACEOF
 
-fi
-done
 
-  if test $ac_cv_func_gettimeofday = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday can accept two arguments" >&5
-$as_echo_n "checking whether gettimeofday can accept two arguments... " >&6; }
-if test "${emacs_cv_gettimeofday_two_arguments+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+
+case $opsys in
+  cygwin | darwin | freebsd | netbsd | openbsd )
+    $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)" >>confdefs.h
+
+    ;;
+
+  unixware)
+    $as_echo "#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)" >>confdefs.h
+
+    ;;
+
+  gnu | gnu-linux | gnu-kfreebsd )
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of pending output formalism" >&5
+$as_echo_n "checking for style of pending output formalism... " >&6; }
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
+#include <stdio.h>
+#if !defined (_IO_STDIO_H) && !defined (_STDIO_USES_IOSTREAM)
+# error "stdio definitions not found"
 #endif
+
 int
 main ()
 {
-struct timeval time;
-       gettimeofday (&time, 0);
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_gettimeofday_two_arguments=yes
+if ac_fn_c_try_cpp "$LINENO"; then :
+  emacs_pending_output=new
 else
-  emacs_cv_gettimeofday_two_arguments=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  emacs_pending_output=unknown
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_gettimeofday_two_arguments" >&5
-$as_echo "$emacs_cv_gettimeofday_two_arguments" >&6; }
-    if test $emacs_cv_gettimeofday_two_arguments = no; then
+rm -f conftest.err conftest.$ac_ext
 
-$as_echo "#define GETTIMEOFDAY_ONE_ARGUMENT 1" >>confdefs.h
+      if test $emacs_pending_output = unknown; then
+        case $opsys in
+          gnu-linux | gnu-kfreebsd)
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-    fi
-  fi
-fi
+#include <stdio.h>
+#ifndef __UCLIBC__
+# error "not using uclibc"
+#endif
 
-ok_so_far=yes
-ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket"
-if test "x$ac_cv_func_socket" = x""yes; then :
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+  emacs_pending_output=uclibc
 else
-  ok_so_far=no
+  emacs_pending_output=old
 fi
+rm -f conftest.err conftest.$ac_ext
+            ;;
+        esac
+      fi
 
-if test $ok_so_far = yes; then
-  ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default"
-if test "x$ac_cv_header_netinet_in_h" = x""yes; then :
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_pending_output" >&5
+$as_echo "$emacs_pending_output" >&6; }
 
-else
-  ok_so_far=no
-fi
+      case $emacs_pending_output in
+        new)
+                    $as_echo "#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)" >>confdefs.h
 
+          ;;
+        uclibc)
+                    $as_echo "#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) ((FILE)->__bufpos - (FILE)->__bufstart)" >>confdefs.h
 
-fi
-if test $ok_so_far = yes; then
-  ac_fn_c_check_header_mongrel "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default"
-if test "x$ac_cv_header_arpa_inet_h" = x""yes; then :
+          ;;
+        old)
+                    $as_echo "#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) ((FILE)->_pptr - (FILE)->_pbase)" >>confdefs.h
 
-else
-  ok_so_far=no
-fi
+          ;;
+      esac
+    ;;
+esac
 
 
-fi
-if test $ok_so_far = yes; then
 
-$as_echo "#define HAVE_INET_SOCKETS 1" >>confdefs.h
 
-fi
 
-if test -f /usr/lpp/X11/bin/smt.exp; then
+case $opsys in
+  gnu)
+        $as_echo "#define DATA_START ({ extern int data_start; (char *) &data_start; })" >>confdefs.h
 
-$as_echo "#define HAVE_AIX_SMT_EXP 1" >>confdefs.h
+    ;;
 
-fi
+  hpux*)
+        $as_echo "#define DATA_START 0x40000000" >>confdefs.h
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system supports dynamic ptys" >&5
-$as_echo_n "checking whether system supports dynamic ptys... " >&6; }
-if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+    $as_echo "#define DATA_SEG_BITS 0x40000000" >>confdefs.h
 
-$as_echo "#define HAVE_DEV_PTMX 1" >>confdefs.h
+    ;;
+  irix6-5)
+    $as_echo "#define DATA_START 0x10000000" >>confdefs.h
 
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
+    $as_echo "#define DATA_SEG_BITS 0x10000000" >>confdefs.h
 
-ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
-if test "x$ac_cv_type_pid_t" = x""yes; then :
+    ;;
+esac
 
-else
 
-cat >>confdefs.h <<_ACEOF
-#define pid_t int
-_ACEOF
 
-fi
 
-for ac_header in vfork.h
-do :
-  ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
-if test "x$ac_cv_header_vfork_h" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_VFORK_H 1
-_ACEOF
 
-fi
+case $opsys in
+  darwin) $as_echo "#define TAB3 OXTABS" >>confdefs.h
+ ;;
 
-done
+  gnu | freebsd | netbsd | openbsd )
 
-for ac_func in fork vfork
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
+$as_echo "#define TABDLY OXTABS" >>confdefs.h
 
-fi
-done
+    $as_echo "#define TAB3 OXTABS" >>confdefs.h
 
-if test "x$ac_cv_func_fork" = xyes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
-$as_echo_n "checking for working fork... " >&6; }
-if test "${ac_cv_func_fork_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_fork_works=cross
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+    ;;
+
+  gnu-linux | gnu-kfreebsd )
+            cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
+
+#ifndef __i386__
+# error "not i386"
+#endif
+
 int
 main ()
 {
 
-         /* By Ruediger Kuhlmann. */
-         return fork () < 0;
-
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_fork_works=yes
-else
-  ac_cv_func_fork_works=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+if ac_fn_c_try_cpp "$LINENO"; then :
+  $as_echo "#define ULIMIT_BREAK_VALUE (32*1024*1024)" >>confdefs.h
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
-$as_echo "$ac_cv_func_fork_works" >&6; }
+rm -f conftest.err conftest.$ac_ext
 
-else
-  ac_cv_func_fork_works=$ac_cv_func_fork
-fi
-if test "x$ac_cv_func_fork_works" = xcross; then
-  case $host in
-    *-*-amigaos* | *-*-msdosdjgpp*)
-      # Override, as these systems have only a dummy fork() stub
-      ac_cv_func_fork_works=no
-      ;;
-    *)
-      ac_cv_func_fork_works=yes
-      ;;
-  esac
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
-$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
-fi
-ac_cv_func_vfork_works=$ac_cv_func_vfork
-if test "x$ac_cv_func_vfork" = xyes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
-$as_echo_n "checking for working vfork... " >&6; }
-if test "${ac_cv_func_vfork_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_vfork_works=cross
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-/* Thanks to Paul Eggert for this test.  */
-$ac_includes_default
-#include <sys/wait.h>
-#ifdef HAVE_VFORK_H
-# include <vfork.h>
-#endif
-/* On some sparc systems, changes by the child to local and incoming
-   argument registers are propagated back to the parent.  The compiler
-   is told about this with #include <vfork.h>, but some compilers
-   (e.g. gcc -O) don't grok <vfork.h>.  Test for this by using a
-   static variable whose address is put into a register that is
-   clobbered by the vfork.  */
-static void
-#ifdef __cplusplus
-sparc_address_test (int arg)
-# else
-sparc_address_test (arg) int arg;
+
+#ifndef __ia64__
+# error "not ia64"
 #endif
-{
-  static pid_t child;
-  if (!child) {
-    child = vfork ();
-    if (child < 0) {
-      perror ("vfork");
-      _exit(2);
-    }
-    if (!child) {
-      arg = getpid();
-      write(-1, "", 0);
-      _exit (arg);
-    }
-  }
-}
 
 int
 main ()
 {
-  pid_t parent = getpid ();
-  pid_t child;
-
-  sparc_address_test (0);
-
-  child = vfork ();
-
-  if (child == 0) {
-    /* Here is another test for sparc vfork register problems.  This
-       test uses lots of local variables, at least as many local
-       variables as main has allocated so far including compiler
-       temporaries.  4 locals are enough for gcc 1.40.3 on a Solaris
-       4.1.3 sparc, but we use 8 to be safe.  A buggy compiler should
-       reuse the register of parent for one of the local variables,
-       since it will think that parent can't possibly be used any more
-       in this routine.  Assigning to the local variable will thus
-       munge parent in the parent process.  */
-    pid_t
-      p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
-      p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
-    /* Convince the compiler that p..p7 are live; otherwise, it might
-       use the same hardware register for all 8 local variables.  */
-    if (p != p1 || p != p2 || p != p3 || p != p4
-       || p != p5 || p != p6 || p != p7)
-      _exit(1);
-
-    /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
-       from child file descriptors.  If the child closes a descriptor
-       before it execs or exits, this munges the parent's descriptor
-       as well.  Test for this by closing stdout in the child.  */
-    _exit(close(fileno(stdout)) != 0);
-  } else {
-    int status;
-    struct stat st;
 
-    while (wait(&status) != child)
-      ;
-    return (
-        /* Was there some problem with vforking?  */
-        child < 0
-
-        /* Did the child fail?  (This shouldn't happen.)  */
-        || status
-
-        /* Did the vfork/compiler bug occur?  */
-        || parent != getpid()
-
-        /* Did the file descriptor bug occur?  */
-        || fstat(fileno(stdout), &st) != 0
-        );
-  }
+  ;
+  return 0;
 }
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_vfork_works=yes
-else
-  ac_cv_func_vfork_works=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+if ac_fn_c_try_cpp "$LINENO"; then :
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
-$as_echo "$ac_cv_func_vfork_works" >&6; }
+$as_echo "#define GC_MARK_SECONDARY_STACK() do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (0)" >>confdefs.h
 
-fi;
-if test "x$ac_cv_func_fork_works" = xcross; then
-  ac_cv_func_vfork_works=$ac_cv_func_vfork
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
-$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
 fi
+rm -f conftest.err conftest.$ac_ext
+    ;;
 
-if test "x$ac_cv_func_vfork_works" = xyes; then
+  hpux*)
 
-$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+$as_echo "#define RUN_TIME_REMAP 1" >>confdefs.h
 
-else
+    ;;
 
-$as_echo "#define vfork fork" >>confdefs.h
+  irix6-5)
+        $as_echo "#define ULIMIT_BREAK_VALUE 0x14000000" >>confdefs.h
 
-fi
-if test "x$ac_cv_func_fork_works" = xyes; then
+    ;;
+esac
 
-$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
 
-fi
 
 
-for ac_func in snprintf
-do :
-  ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf"
-if test "x$ac_cv_func_snprintf" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_SNPRINTF 1
-_ACEOF
 
-fi
-done
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5
-$as_echo_n "checking for nl_langinfo and CODESET... " >&6; }
-if test "${emacs_cv_langinfo_codeset+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+case $opsys in
+  aix4-2 | hpux* | unixware)
+            $as_echo "#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE" >>confdefs.h
+
+    ;;
+
+          gnu-linux | gnu-kfreebsd )
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <langinfo.h>
+
+#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
+  || defined __alpha__ || defined __mips__ || defined __s390__ \
+  || defined __arm__ || defined __powerpc__ || defined __amd64__ \
+  || defined __ia64__ || defined __sh__
+/* ok */
+#else
+# error "setjmp not known to work on this arch"
+#endif
+
 int
 main ()
 {
-char* cs = nl_langinfo(CODESET);
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  emacs_cv_langinfo_codeset=yes
+if ac_fn_c_try_cpp "$LINENO"; then :
+  $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h
+
 else
-  emacs_cv_langinfo_codeset=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
+  $as_echo "#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE" >>confdefs.h
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_langinfo_codeset" >&5
-$as_echo "$emacs_cv_langinfo_codeset" >&6; }
-if test $emacs_cv_langinfo_codeset = yes; then
+rm -f conftest.err conftest.$ac_ext
+    ;;
+esac
 
-$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h
 
-fi
+if test x$GCC = xyes; then
+      $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5
-$as_echo_n "checking for mbstate_t... " >&6; }
-if test "${ac_cv_type_mbstate_t+set}" = set; then :
-  $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  case $opsys in
+        freebsd | netbsd | openbsd | irix6-5 | sol2* )
+      $as_echo "#define GC_SETJMP_WORKS 1" >>confdefs.h
+
+      ;;
+  esac
+fi
+
+case $opsys in
+  hpux* | sol2* )
+
+$as_echo "#define XOS_NEEDS_TIME_H 1" >>confdefs.h
+
+    ;;
+esac
+
+
+
+
+
+
+
+case $opsys in
+  aix4-2)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-$ac_includes_default
-#          include <wchar.h>
+
+#ifndef _AIX
+# error "_AIX not defined"
+#endif
+
 int
 main ()
 {
-mbstate_t x; return sizeof x;
+
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_type_mbstate_t=yes
+if ac_fn_c_try_cpp "$LINENO"; then :
+
 else
-  ac_cv_type_mbstate_t=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+$as_echo "#define _AIX /**/" >>confdefs.h
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5
-$as_echo "$ac_cv_type_mbstate_t" >&6; }
-   if test $ac_cv_type_mbstate_t = yes; then
+rm -f conftest.err conftest.$ac_ext
+    ;;
 
-$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h
+  cygwin)
+    opsysfile=
 
-   else
+$as_echo "#define CYGWIN 1" >>confdefs.h
 
-$as_echo "#define mbstate_t int" >>confdefs.h
+    ;;
 
-   fi
+  darwin)
+        $as_echo "#define BSD4_2 /**/" >>confdefs.h
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C restricted array declarations" >&5
-$as_echo_n "checking for C restricted array declarations... " >&6; }
-if test "${emacs_cv_c_restrict_arr+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+    $as_echo "#define BSD_SYSTEM /**/" >>confdefs.h
+
+
+$as_echo "#define DARWIN_OS /**/" >>confdefs.h
+
+    ;;
+
+  freebsd)
+    $as_echo "#define BSD4_2 /**/" >>confdefs.h
+
+
+$as_echo "#define BSD_SYSTEM_AHB 1" >>confdefs.h
+
+    ;;
+
+  gnu | netbsd | openbsd )
+    $as_echo "#define BSD4_2 /**/" >>confdefs.h
+
+    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-void fred (int x[__restrict]);
+
+#ifndef BSD_SYSTEM
+# error "BSD_SYSTEM not defined"
+#endif
+
 int
 main ()
 {
@@ -15710,21 +15281,102 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  emacs_cv_c_restrict_arr=yes
+if ac_fn_c_try_cpp "$LINENO"; then :
+
 else
-  emacs_cv_c_restrict_arr=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  $as_echo "#define BSD_SYSTEM 43" >>confdefs.h
+
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_c_restrict_arr" >&5
-$as_echo "$emacs_cv_c_restrict_arr" >&6; }
-if test "$emacs_cv_c_restrict_arr" = yes; then
+rm -f conftest.err conftest.$ac_ext
+    ;;
 
-$as_echo "#define __restrict_arr __restrict" >>confdefs.h
+  gnu-linux | gnu-kfreebsd )
+    $as_echo "#define USG /**/" >>confdefs.h
 
-fi
 
+$as_echo "#define GNU_LINUX /**/" >>confdefs.h
+
+    ;;
+
+  hpux*)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+
+$as_echo "#define HPUX /**/" >>confdefs.h
+
+    ;;
+
+  irix6-5)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+
+$as_echo "#define IRIX6_5 /**/" >>confdefs.h
+
+    ;;
+
+  sol2*)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+
+$as_echo "#define SOLARIS2 /**/" >>confdefs.h
+
+    ;;
+
+  unixware)
+    $as_echo "#define USG /**/" >>confdefs.h
+
+    $as_echo "#define USG5 /**/" >>confdefs.h
+
+    ;;
+esac
+
+
+case $opsys in
+          cygwin)
+
+$as_echo "#define G_SLICE_ALWAYS_MALLOC 1" >>confdefs.h
+
+    ;;
+
+  gnu) opsysfile= ;;
+
+  gnu-kfreebsd) opsysfile="s/gnu-linux.h" ;;
+
+  hpux11)
+
+$as_echo "#define BROKEN_SA_RESTART 1" >>confdefs.h
+
+
+$as_echo "#define USG_SUBTTY_WORKS 1" >>confdefs.h
+
+
+    opsysfile="s/hpux10-20.h"
+    ;;
+
+  irix6-5)
+
+$as_echo "#define PREFER_VSUSP 1" >>confdefs.h
+
+
+$as_echo "#define SETPGRP_RELEASES_CTTY 1" >>confdefs.h
+
+    ;;
+
+  openbsd) opsysfile="s/netbsd.h" ;;
+
+  sol2-10)
+
+$as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h
+
+    opsysfile="s/sol2-6.h"
+    ;;
+esac
 
 # Set up the CFLAGS for real compilation, so we can substitute it.
 CFLAGS="$REAL_CFLAGS"
@@ -15763,6 +15415,8 @@ version=$PACKAGE_VERSION
 
 
 
+
+
 
 
 ## FIXME? Nothing uses @LD_SWITCH_X_SITE@.
@@ -15774,13 +15428,11 @@ version=$PACKAGE_VERSION
 
 ## Used in lwlib/Makefile.in.
 
-if test -n "${machfile}"; then
-  M_FILE="\$(srcdir)/${machfile}"
+if test -n "${opsysfile}"; then
+  S_FILE="\$(srcdir)/${opsysfile}"
 else
-  M_FILE=
+  S_FILE=
 fi
-S_FILE="\$(srcdir)/${opsysfile}"
-
 
 
 
@@ -15799,18 +15451,13 @@ cat >>confdefs.h <<_ACEOF
 #define EMACS_CONFIG_OPTIONS "${ac_configure_args}"
 _ACEOF
 
-if test -n "$machfile"; then
-
-cat >>confdefs.h <<_ACEOF
-#define config_machfile "${machfile}"
-_ACEOF
-
-fi
+if test -n "$opsysfile"; then
 
 cat >>confdefs.h <<_ACEOF
 #define config_opsysfile "${opsysfile}"
 _ACEOF
 
+fi
 
 XMENU_OBJ=
 XOBJ=
 
 
 
-# Configure gnulib here, now that we know LIBS.
+# Configure gnulib.  Although this does not affect CFLAGS or LIBS permanently.
+# it temporarily reverts them to their pre-pkg-config values,
+# because gnulib needs to work with both src (which uses the
+# pkg-config stuff) and lib-src (which does not).  For example, gnulib
+# may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
+# and it therefore needs to run in an environment where LIBS does not
+# already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
+# for some package unrelated to lib-src.
+SAVE_CFLAGS=$CFLAGS
+SAVE_LIBS=$LIBS
+CFLAGS=$pre_PKG_CONFIG_CFLAGS
+LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
 
 
 
@@ -16084,8 +15742,8 @@ ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
 $as_echo "#define C_ALLOCA 1" >>confdefs.h
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
-$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether 'alloca.c' needs Cray hooks" >&5
+$as_echo_n "checking whether 'alloca.c' needs Cray hooks... " >&6; }
 if test "${ac_cv_os_cray+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
@@ -16160,34 +15818,18 @@ else
   ac_cv_c_stack_direction=-1
 fi
 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
-$as_echo "$ac_cv_c_stack_direction" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
-
-
-fi
-
-
-
-
-  for ac_func in $ac_func_list
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-eval as_val=\$$as_ac_var
-   if test "x$as_val" = x""yes; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
+$as_echo "$ac_cv_c_stack_direction" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
 _ACEOF
 
+
 fi
-done
 
 
 
@@ -16528,6 +16170,7 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
   GNULIB_GETPAGESIZE=0;
   GNULIB_GETUSERSHELL=0;
   GNULIB_GROUP_MEMBER=0;
+  GNULIB_ISATTY=0;
   GNULIB_LCHOWN=0;
   GNULIB_LINK=0;
   GNULIB_LINKAT=0;
@@ -16540,11 +16183,11 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
   GNULIB_READLINK=0;
   GNULIB_READLINKAT=0;
   GNULIB_RMDIR=0;
+  GNULIB_SETHOSTNAME=0;
   GNULIB_SLEEP=0;
   GNULIB_SYMLINK=0;
   GNULIB_SYMLINKAT=0;
   GNULIB_TTYNAME_R=0;
-  GNULIB_UNISTD_H_GETOPT=0;
   GNULIB_UNISTD_H_NONBLOCKING=0;
   GNULIB_UNISTD_H_SIGPIPE=0;
   GNULIB_UNLINK=0;
@@ -16576,6 +16219,7 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
   HAVE_PWRITE=1;
   HAVE_READLINK=1;
   HAVE_READLINKAT=1;
+  HAVE_SETHOSTNAME=1;
   HAVE_SLEEP=1;
   HAVE_SYMLINK=1;
   HAVE_SYMLINKAT=1;
@@ -16588,6 +16232,7 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
   HAVE_DECL_GETLOGIN_R=1;
   HAVE_DECL_GETPAGESIZE=1;
   HAVE_DECL_GETUSERSHELL=1;
+  HAVE_DECL_SETHOSTNAME=1;
   HAVE_DECL_TTYNAME_R=1;
   HAVE_OS_H=0;
   HAVE_SYS_PARAM_H=0;
@@ -16596,11 +16241,13 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h
   REPLACE_DUP=0;
   REPLACE_DUP2=0;
   REPLACE_FCHOWNAT=0;
+  REPLACE_FTRUNCATE=0;
   REPLACE_GETCWD=0;
   REPLACE_GETDOMAINNAME=0;
   REPLACE_GETLOGIN_R=0;
   REPLACE_GETGROUPS=0;
   REPLACE_GETPAGESIZE=0;
+  REPLACE_ISATTY=0;
   REPLACE_LCHOWN=0;
   REPLACE_LINK=0;
   REPLACE_LINKAT=0;
@@ -16682,8 +16329,11 @@ _ACEOF
   GNULIB_MKOSTEMPS=0;
   GNULIB_MKSTEMP=0;
   GNULIB_MKSTEMPS=0;
+  GNULIB_POSIX_OPENPT=0;
   GNULIB_PTSNAME=0;
+  GNULIB_PTSNAME_R=0;
   GNULIB_PUTENV=0;
+  GNULIB_RANDOM=0;
   GNULIB_RANDOM_R=0;
   GNULIB_REALLOC_POSIX=0;
   GNULIB_REALPATH=0;
@@ -16707,7 +16357,10 @@ _ACEOF
   HAVE_MKOSTEMPS=1;
   HAVE_MKSTEMP=1;
   HAVE_MKSTEMPS=1;
+  HAVE_POSIX_OPENPT=1;
   HAVE_PTSNAME=1;
+  HAVE_PTSNAME_R=1;
+  HAVE_RANDOM=1;
   HAVE_RANDOM_H=1;
   HAVE_RANDOM_R=1;
   HAVE_REALPATH=1;
@@ -16726,7 +16379,9 @@ _ACEOF
   REPLACE_MALLOC=0;
   REPLACE_MBTOWC=0;
   REPLACE_MKSTEMP=0;
+  REPLACE_PTSNAME_R=0;
   REPLACE_PUTENV=0;
+  REPLACE_RANDOM_R=0;
   REPLACE_REALLOC=0;
   REPLACE_REALPATH=0;
   REPLACE_SETENV=0;
@@ -16890,12 +16545,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'getopt.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'getopt.h\)".*|\1|
+               gl_header_literal_regex=`echo 'getopt.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -16967,57 +16625,124 @@ done
 
   fi
 
-                    if test -z "$gl_replace_getopt"; then
+          if test -z "$gl_replace_getopt"; then
     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt is POSIX compatible" >&5
 $as_echo_n "checking whether getopt is POSIX compatible... " >&6; }
 if test "${gl_cv_func_getopt_posix+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
 
-                                                                        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+                                                if test $cross_compiling = no; then
+                              if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+
 #include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
 int
 main ()
 {
-int *p = &optreset; return optreset;
-  ;
+  static char program[] = "program";
+  static char a[] = "-a";
+  static char foo[] = "foo";
+  static char bar[] = "bar";
+  char *argv[] = { program, a, foo, bar, NULL };
+  int c;
+
+  c = getopt (4, argv, "ab");
+  if (!(c == 'a'))
+    return 1;
+  c = getopt (4, argv, "ab");
+  if (!(c == -1))
+    return 2;
+  if (!(optind == 2))
+    return 3;
   return 0;
 }
+
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_optind_min=1
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_getopt_posix=maybe
+else
+  gl_cv_func_getopt_posix=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+          if test $gl_cv_func_getopt_posix = maybe; then
+                                    if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <getopt.h>
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
 int
 main ()
 {
-return !getopt_clip;
-  ;
+  static char program[] = "program";
+  static char donald[] = "donald";
+  static char p[] = "-p";
+  static char billy[] = "billy";
+  static char duck[] = "duck";
+  static char a[] = "-a";
+  static char bar[] = "bar";
+  char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
+  int c;
+
+  c = getopt (7, argv, "+abp:q:");
+  if (!(c == -1))
+    return 4;
+  if (!(strcmp (argv[0], "program") == 0))
+    return 5;
+  if (!(strcmp (argv[1], "donald") == 0))
+    return 6;
+  if (!(strcmp (argv[2], "-p") == 0))
+    return 7;
+  if (!(strcmp (argv[3], "billy") == 0))
+    return 8;
+  if (!(strcmp (argv[4], "duck") == 0))
+    return 9;
+  if (!(strcmp (argv[5], "-a") == 0))
+    return 10;
+  if (!(strcmp (argv[6], "bar") == 0))
+    return 11;
+  if (!(optind == 1))
+    return 12;
   return 0;
 }
+
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gl_optind_min=1
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_getopt_posix=maybe
 else
-  gl_optind_min=0
+  gl_cv_func_getopt_posix=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-
-                gl_save_CPPFLAGS=$CPPFLAGS
-        CPPFLAGS="$CPPFLAGS -DOPTIND_MIN=$gl_optind_min"
-        if test "$cross_compiling" = yes; then :
-  case "$host_os" in
-             mingw*)         gl_cv_func_getopt_posix="guessing no";;
-             darwin* | aix*) gl_cv_func_getopt_posix="guessing no";;
-             *)              gl_cv_func_getopt_posix="guessing yes";;
-           esac
 
+          fi
+          if test $gl_cv_func_getopt_posix = maybe; then
+                        if test "$cross_compiling" = yes; then :
+  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run test program while cross compiling
+See \`config.log' for more details." "$LINENO" 5; }
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
@@ -17029,78 +16754,17 @@ else
 int
 main ()
 {
-  {
-    static char program[] = "program";
-    static char a[] = "-a";
-    static char foo[] = "foo";
-    static char bar[] = "bar";
-    char *argv[] = { program, a, foo, bar, NULL };
-    int c;
-
-    optind = OPTIND_MIN;
-    opterr = 0;
-
-    c = getopt (4, argv, "ab");
-    if (!(c == 'a'))
-      return 1;
-    c = getopt (4, argv, "ab");
-    if (!(c == -1))
-      return 2;
-    if (!(optind == 2))
-      return 3;
-  }
-  /* Some internal state exists at this point.  */
-  {
-    static char program[] = "program";
-    static char donald[] = "donald";
-    static char p[] = "-p";
-    static char billy[] = "billy";
-    static char duck[] = "duck";
-    static char a[] = "-a";
-    static char bar[] = "bar";
-    char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
-    int c;
-
-    optind = OPTIND_MIN;
-    opterr = 0;
-
-    c = getopt (7, argv, "+abp:q:");
-    if (!(c == -1))
-      return 4;
-    if (!(strcmp (argv[0], "program") == 0))
-      return 5;
-    if (!(strcmp (argv[1], "donald") == 0))
-      return 6;
-    if (!(strcmp (argv[2], "-p") == 0))
-      return 7;
-    if (!(strcmp (argv[3], "billy") == 0))
-      return 8;
-    if (!(strcmp (argv[4], "duck") == 0))
-      return 9;
-    if (!(strcmp (argv[5], "-a") == 0))
-      return 10;
-    if (!(strcmp (argv[6], "bar") == 0))
-      return 11;
-    if (!(optind == 1))
-      return 12;
-  }
-  /* Detect MacOS 10.5, AIX 7.1 bug.  */
-  {
-    static char program[] = "program";
-    static char ab[] = "-ab";
-    char *argv[3] = { program, ab, NULL };
-    optind = OPTIND_MIN;
-    opterr = 0;
-    if (getopt (2, argv, "ab:") != 'a')
-      return 13;
-    if (getopt (2, argv, "ab:") != '?')
-      return 14;
-    if (optopt != 'b')
-      return 15;
-    if (optind != 2)
-      return 16;
-  }
-
+  static char program[] = "program";
+  static char ab[] = "-ab";
+  char *argv[3] = { program, ab, NULL };
+  if (getopt (2, argv, "ab:") != 'a')
+    return 13;
+  if (getopt (2, argv, "ab:") != '?')
+    return 14;
+  if (optopt != 'b')
+    return 15;
+  if (optind != 2)
+    return 16;
   return 0;
 }
 
@@ -17114,7 +16778,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-        CPPFLAGS=$gl_save_CPPFLAGS
+          fi
+        else
+          case "$host_os" in
+            darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";;
+            *)                       gl_cv_func_getopt_posix="guessing yes";;
+          esac
+        fi
 
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_posix" >&5
@@ -17145,11 +16815,7 @@ else
        POSIXLY_CORRECT=1
        export POSIXLY_CORRECT
        if test "$cross_compiling" = yes; then :
-           case $host_os:$ac_cv_have_decl_optreset in
-           *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;;
-           *:yes)               gl_cv_func_getopt_gnu=no;;
-           *)                   gl_cv_func_getopt_gnu=yes;;
-         esac
+           gl_cv_func_getopt_gnu="guessing no"
 
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -17160,7 +16826,7 @@ else
 
 #include <stdlib.h>
 #if defined __MACH__ && defined __APPLE__
-/* Avoid a crash on MacOS X.  */
+/* Avoid a crash on Mac OS X.  */
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <mach/thread_status.h>
@@ -17280,7 +16946,7 @@ main ()
              nocrash_init();
 
              /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
-                and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
+                and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
                 OSF/1 5.1, Solaris 10.  */
              {
                static char conftest[] = "conftest";
@@ -17291,7 +16957,7 @@ main ()
                  result |= 1;
              }
              /* This code succeeds on glibc 2.8, mingw,
-                and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
+                and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
                 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x.  */
              {
                static char program[] = "program";
@@ -17320,7 +16986,7 @@ main ()
                if (getopt (3, argv, "-p") != 1)
                  result |= 16;
                else if (getopt (3, argv, "-p") != 'p')
-                 result |= 32;
+                 result |= 16;
              }
              /* This code fails on glibc 2.11.  */
              {
@@ -17330,9 +16996,9 @@ main ()
                char *argv[] = { program, b, a, NULL };
                optind = opterr = 0;
                if (getopt (3, argv, "+:a:b") != 'b')
-                 result |= 64;
+                 result |= 32;
                else if (getopt (3, argv, "+:a:b") != ':')
-                 result |= 64;
+                 result |= 32;
              }
              /* This code dumps core on glibc 2.14.  */
              {
@@ -17342,7 +17008,7 @@ main ()
                char *argv[] = { program, w, dummy, NULL };
                optind = opterr = 1;
                if (getopt (3, argv, "W;") != 'W')
-                 result |= 128;
+                 result |= 64;
              }
              return result;
 
@@ -17359,55 +17025,369 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-       case $gl_had_POSIXLY_CORRECT in
-         exported) ;;
-         yes) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;}; POSIXLY_CORRECT=1 ;;
-         *) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} ;;
-       esac
+       case $gl_had_POSIXLY_CORRECT in
+         exported) ;;
+         yes) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;}; POSIXLY_CORRECT=1 ;;
+         *) { POSIXLY_CORRECT=; unset POSIXLY_CORRECT;} ;;
+       esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5
+$as_echo "$gl_cv_func_getopt_gnu" >&6; }
+    if test "$gl_cv_func_getopt_gnu" != yes; then
+      gl_replace_getopt=yes
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt_long function" >&5
+$as_echo_n "checking for working GNU getopt_long function... " >&6; }
+if test "${gl_cv_func_getopt_long_gnu+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+              case "$host_os" in
+              openbsd*) gl_cv_func_getopt_long_gnu="guessing no";;
+              *)        gl_cv_func_getopt_long_gnu="guessing yes";;
+            esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <getopt.h>
+                #include <stddef.h>
+                #include <string.h>
+
+int
+main ()
+{
+static const struct option long_options[] =
+                  {
+                    { "xtremely-",no_argument,       NULL, 1003 },
+                    { "xtra",     no_argument,       NULL, 1001 },
+                    { "xtreme",   no_argument,       NULL, 1002 },
+                    { "xtremely", no_argument,       NULL, 1003 },
+                    { NULL,       0,                 NULL, 0 }
+                  };
+                /* This code fails on OpenBSD 5.0.  */
+                {
+                  static char program[] = "program";
+                  static char xtremel[] = "--xtremel";
+                  char *argv[] = { program, xtremel, NULL };
+                  int option_index;
+                  optind = 1; opterr = 0;
+                  if (getopt_long (2, argv, "", long_options, &option_index) != 1003)
+                    return 1;
+                }
+                return 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_getopt_long_gnu=yes
+else
+  gl_cv_func_getopt_long_gnu=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_long_gnu" >&5
+$as_echo "$gl_cv_func_getopt_long_gnu" >&6; }
+      case "$gl_cv_func_getopt_long_gnu" in
+        *yes) ;;
+        *) gl_replace_getopt=yes ;;
+      esac
+    fi
+  fi
+
+
+
+
+
+
+    REPLACE_GETOPT=0
+    if test -n "$gl_replace_getopt"; then
+      REPLACE_GETOPT=1
+    fi
+
+  if test $REPLACE_GETOPT = 1; then
+
+  GETOPT_H=getopt.h
+
+$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
+
+
+
+  fi
+
+ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default"
+if test "x$ac_cv_have_decl_getenv" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_GETENV $ac_have_decl
+_ACEOF
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
+$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
+if test "${ac_cv_c_restrict+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_c_restrict=no
+   # The order here caters to the fact that C++ does not require restrict.
+   for ac_kw in __restrict __restrict__ _Restrict restrict; do
+     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+typedef int * int_ptr;
+       int foo (int_ptr $ac_kw ip) {
+       return ip[0];
+       }
+int
+main ()
+{
+int s[1];
+       int * $ac_kw t = s;
+       t[0] = 0;
+       return foo(t)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_c_restrict=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+     test "$ac_cv_c_restrict" != no && break
+   done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
+$as_echo "$ac_cv_c_restrict" >&6; }
+
+ case $ac_cv_c_restrict in
+   restrict) ;;
+   no) $as_echo "#define restrict /**/" >>confdefs.h
+ ;;
+   *)  cat >>confdefs.h <<_ACEOF
+#define restrict $ac_cv_c_restrict
+_ACEOF
+ ;;
+ esac
+
+
+  GNULIB_GETTIMEOFDAY=0;
+    HAVE_GETTIMEOFDAY=1;
+  HAVE_STRUCT_TIMEVAL=1;
+  HAVE_SYS_TIME_H=1;
+  REPLACE_GETTIMEOFDAY=0;
+  REPLACE_STRUCT_TIMEVAL=0;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+     if test $gl_cv_have_include_next = yes; then
+       gl_cv_next_sys_time_h='<'sys/time.h'>'
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/time.h>" >&5
+$as_echo_n "checking absolute name of <sys/time.h>... " >&6; }
+if test "${gl_cv_next_sys_time_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+             if test $ac_cv_header_sys_time_h = yes; then
+
+
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/time.h>
+
+_ACEOF
+                                                                                                                        case "$host_os" in
+                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
+                 *)    gl_absname_cpp="$ac_cpp" ;;
+               esac
+
+               case "$host_os" in
+                 mingw*)
+                                                                                                                                     gl_dirsep_regex='[/\\]'
+                   ;;
+                 *)
+                   gl_dirsep_regex='\/'
+                   ;;
+               esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
+
+               gl_header_literal_regex=`echo 'sys/time.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
+                   s|^/[^/]|//&|
+                   p
+                   q
+                 }'
+                                                            gl_cv_next_sys_time_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                      sed -n "$gl_absolute_header_sed"`'"'
+          else
+               gl_cv_next_sys_time_h='<'sys/time.h'>'
+             fi
+
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5
-$as_echo "$gl_cv_func_getopt_gnu" >&6; }
-    if test "$gl_cv_func_getopt_gnu" = "no"; then
-      gl_replace_getopt=yes
-    fi
-  fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_time_h" >&5
+$as_echo "$gl_cv_next_sys_time_h" >&6; }
+     fi
+     NEXT_SYS_TIME_H=$gl_cv_next_sys_time_h
 
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'sys/time.h'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_sys_time_h
+     fi
+     NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H=$gl_next_as_first_directive
 
 
 
 
-    REPLACE_GETOPT=0
 
+  if test $ac_cv_header_sys_time_h != yes; then
+    HAVE_SYS_TIME_H=0
+  fi
 
-  if test -n "$gl_replace_getopt"; then :
 
-      REPLACE_GETOPT=1
 
-fi
 
 
-  if test $REPLACE_GETOPT = 1; then
+  if test $ac_cv_header_sys_socket_h != yes; then
+                    for ac_header in winsock2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
+if test "x$ac_cv_header_winsock2_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINSOCK2_H 1
+_ACEOF
 
-  GETOPT_H=getopt.h
+fi
 
-$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
+done
 
+  fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
 
 
-        GNULIB_UNISTD_H_GETOPT=1
-  fi
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5
+$as_echo_n "checking for struct timeval... " >&6; }
+if test "${gl_cv_sys_struct_timeval+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+            #if HAVE_WINSOCK2_H
+            # include <winsock2.h>
+            #endif
 
-ac_fn_c_check_decl "$LINENO" "getenv" "ac_cv_have_decl_getenv" "$ac_includes_default"
-if test "x$ac_cv_have_decl_getenv" = x""yes; then :
-  ac_have_decl=1
+int
+main ()
+{
+static struct timeval x; x.tv_sec = x.tv_usec;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_timeval=yes
 else
-  ac_have_decl=0
+  gl_cv_sys_struct_timeval=no
 fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_GETENV $ac_have_decl
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval" >&5
+$as_echo "$gl_cv_sys_struct_timeval" >&6; }
+  if test $gl_cv_sys_struct_timeval != yes; then
+    HAVE_STRUCT_TIMEVAL=0
+  else
+                            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for wide-enough struct timeval.tv_sec member" >&5
+$as_echo_n "checking for wide-enough struct timeval.tv_sec member... " >&6; }
+if test "${gl_cv_sys_struct_timeval_tv_sec+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#if HAVE_SYS_TIME_H
+               #include <sys/time.h>
+              #endif
+              #include <time.h>
+              #if HAVE_WINSOCK2_H
+              # include <winsock2.h>
+              #endif
+
+int
+main ()
+{
+static struct timeval x;
+              typedef int verify_tv_sec_type[
+                sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1
+              ];
+
+  ;
+  return 0;
+}
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_timeval_tv_sec=yes
+else
+  gl_cv_sys_struct_timeval_tv_sec=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timeval_tv_sec" >&5
+$as_echo "$gl_cv_sys_struct_timeval_tv_sec" >&6; }
+    if test $gl_cv_sys_struct_timeval_tv_sec != yes; then
+      REPLACE_STRUCT_TIMEVAL=1
+    fi
+  fi
+
+
+
+
+
 
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5
@@ -17647,12 +17627,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'stdint.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'stdint.h\)".*|\1|
+               gl_header_literal_regex=`echo 'stdint.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -17700,8 +17683,6 @@ else
 /* end confdefs.h.  */
 
 
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 #include <stdint.h>
 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
@@ -17870,8 +17851,6 @@ else
 /* end confdefs.h.  */
 
 
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 #include <stdint.h>
 
@@ -18310,6 +18289,7 @@ fi
   HAVE_DECL_IMAXDIV=1;
   HAVE_DECL_STRTOIMAX=1;
   HAVE_DECL_STRTOUMAX=1;
+  REPLACE_STRTOIMAX=0;
   INT32_MAX_LT_INTMAX_MAX=1;
   INT64_MAX_EQ_LONG_MAX='defined _LP64';
   PRI_MACROS_BROKEN=0;
@@ -18358,12 +18338,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'inttypes.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'inttypes.h\)".*|\1|
+               gl_header_literal_regex=`echo 'inttypes.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -18397,11 +18380,51 @@ $as_echo "$gl_cv_next_inttypes_h" >&6; }
 
 
 
-$as_echo "#define GL_TRIGGER_STDC_LIMIT_MACROS 1" >>confdefs.h
 
 
 
+  case "$host_os" in
+    mingw*)
+                        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit off_t" >&5
+$as_echo_n "checking for 64-bit off_t... " >&6; }
+if test "${gl_cv_type_off_t_64+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+                int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_type_off_t_64=yes
+else
+  gl_cv_type_off_t_64=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_off_t_64" >&5
+$as_echo "$gl_cv_type_off_t_64" >&6; }
+      if test $gl_cv_type_off_t_64 = no; then
+        WINDOWS_64_BIT_OFF_T=1
+      else
+        WINDOWS_64_BIT_OFF_T=0
+      fi
+                  WINDOWS_64_BIT_ST_SIZE=1
+      ;;
+    *)
+                                                      WINDOWS_64_BIT_OFF_T=0
+      WINDOWS_64_BIT_ST_SIZE=0
+      ;;
+  esac
 
 
      GNULIB_FCHMODAT=0;
@@ -18450,10 +18473,12 @@ else
      echo >conftest.file
      if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
        if test "$cross_compiling" = yes; then :
-  # When cross-compiling, be pessimistic so we will end up using the
-          # replacement version of lstat that checks for trailing slashes and
-          # calls lstat a second time when necessary.
-          gl_cv_func_lstat_dereferences_slashed_symlink=no
+  case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
+          esac
 
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -18468,50 +18493,256 @@ struct stat sbuf;
                  have to compile and use the lstat wrapper.  */
               return lstat ("conftest.sym/", &sbuf) == 0;
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  gl_cv_func_lstat_dereferences_slashed_symlink=yes
-else
-  gl_cv_func_lstat_dereferences_slashed_symlink=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+  gl_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+     else
+       # If the 'ln -s' command failed, then we probably don't even
+       # have an lstat function.
+       gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
+     fi
+     rm -f conftest.sym conftest.file
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+    *yes)
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+      ;;
+  esac
+
+
+  GNULIB_MKTIME=0;
+  GNULIB_NANOSLEEP=0;
+  GNULIB_STRPTIME=0;
+  GNULIB_TIMEGM=0;
+  GNULIB_TIME_R=0;
+    HAVE_DECL_LOCALTIME_R=1;
+  HAVE_NANOSLEEP=1;
+  HAVE_STRPTIME=1;
+  HAVE_TIMEGM=1;
+        REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;
+  REPLACE_MKTIME=GNULIB_PORTCHECK;
+  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;
+  REPLACE_TIMEGM=GNULIB_PORTCHECK;
+
+
+
+
+  GNULIB_PSELECT=0;
+  GNULIB_SELECT=0;
+    HAVE_PSELECT=1;
+  REPLACE_PSELECT=0;
+  REPLACE_SELECT=0;
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <sys/select.h> is self-contained" >&5
+$as_echo_n "checking whether <sys/select.h> is self-contained... " >&6; }
+if test "${gl_cv_header_sys_select_h_selfcontained+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+struct timeval b;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_header_sys_select_h_selfcontained=yes
+else
+  gl_cv_header_sys_select_h_selfcontained=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+                        if test $gl_cv_header_sys_select_h_selfcontained = yes; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+int memset; int bzero;
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+
+                  #undef memset
+                  #define memset nonexistent_memset
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void *memset (void *, int, unsigned long);
+                  #undef bzero
+                  #define bzero nonexistent_bzero
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void bzero (void *, unsigned long);
+                  fd_set fds;
+                  FD_ZERO (&fds);
+
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+
+else
+  gl_cv_header_sys_select_h_selfcontained=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5
+$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; }
+
+
+
+
+
+
+
+
+
+     if test $gl_cv_have_include_next = yes; then
+       gl_cv_next_sys_select_h='<'sys/select.h'>'
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/select.h>" >&5
+$as_echo_n "checking absolute name of <sys/select.h>... " >&6; }
+if test "${gl_cv_next_sys_select_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+             if test $ac_cv_header_sys_select_h = yes; then
+
+
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+
+_ACEOF
+                                                                                                                        case "$host_os" in
+                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
+                 *)    gl_absname_cpp="$ac_cpp" ;;
+               esac
+
+               case "$host_os" in
+                 mingw*)
+                                                                                                                                     gl_dirsep_regex='[/\\]'
+                   ;;
+                 *)
+                   gl_dirsep_regex='\/'
+                   ;;
+               esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
+
+               gl_header_literal_regex=`echo 'sys/select.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
+                   s|^/[^/]|//&|
+                   p
+                   q
+                 }'
+                                                            gl_cv_next_sys_select_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                      sed -n "$gl_absolute_header_sed"`'"'
+          else
+               gl_cv_next_sys_select_h='<'sys/select.h'>'
+             fi
+
+
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5
+$as_echo "$gl_cv_next_sys_select_h" >&6; }
+     fi
+     NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h
 
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'sys/select.h'>'
      else
-       # If the 'ln -s' command failed, then we probably don't even
-       # have an lstat function.
-       gl_cv_func_lstat_dereferences_slashed_symlink=no
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_sys_select_h
      fi
-     rm -f conftest.sym conftest.file
+     NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_lstat_dereferences_slashed_symlink" >&5
-$as_echo "$gl_cv_func_lstat_dereferences_slashed_symlink" >&6; }
-  test $gl_cv_func_lstat_dereferences_slashed_symlink = yes &&
 
-cat >>confdefs.h <<_ACEOF
-#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+
+
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
+  else
+    HAVE_SYS_SELECT_H=0
+  fi
+
+
+
+
+
+  if test $ac_cv_header_sys_socket_h != yes; then
+                    for ac_header in winsock2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
+if test "x$ac_cv_header_winsock2_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINSOCK2_H 1
 _ACEOF
 
+fi
+
+done
+
+  fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
 
 
-  GNULIB_MKTIME=0;
-  GNULIB_NANOSLEEP=0;
-  GNULIB_STRPTIME=0;
-  GNULIB_TIMEGM=0;
-  GNULIB_TIME_R=0;
-    HAVE_DECL_LOCALTIME_R=1;
-  HAVE_NANOSLEEP=1;
-  HAVE_STRPTIME=1;
-  HAVE_TIMEGM=1;
-        REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;
-  REPLACE_MKTIME=GNULIB_PORTCHECK;
-  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;
-  REPLACE_TIMEGM=GNULIB_PORTCHECK;
 
 
 
@@ -18540,6 +18771,8 @@ _ACEOF
 
 
 
+
+
   ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" "
       #include <signal.h>
       /* Mingw defines sigset_t not in <signal.h>, but in <sys/types.h>.  */
@@ -18563,8 +18796,6 @@ fi
 
 
 
-
-
    if test $ac_cv_header_sys_socket_h = no; then
                          for ac_header in ws2tcpip.h
 do :
@@ -18729,7 +18960,6 @@ $as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h
   GNULIB_GETCHAR=0;
   GNULIB_GETDELIM=0;
   GNULIB_GETLINE=0;
-  GNULIB_GETS=0;
   GNULIB_OBSTACK_PRINTF=0;
   GNULIB_OBSTACK_PRINTF_POSIX=0;
   GNULIB_PCLOSE=0;
@@ -18922,8 +19152,6 @@ fi
 
 
 
-
-
 ac_fn_c_check_decl "$LINENO" "strtoimax" "ac_cv_have_decl_strtoimax" "$ac_includes_default"
 if test "x$ac_cv_have_decl_strtoimax" = x""yes; then :
   ac_have_decl=1
@@ -19005,54 +19233,6 @@ _ACEOF
 
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
-$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
-if test "${ac_cv_c_restrict+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_c_restrict=no
-   # The order here caters to the fact that C++ does not require restrict.
-   for ac_kw in __restrict __restrict__ _Restrict restrict; do
-     cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-typedef int * int_ptr;
-       int foo (int_ptr $ac_kw ip) {
-       return ip[0];
-       }
-int
-main ()
-{
-int s[1];
-       int * $ac_kw t = s;
-       t[0] = 0;
-       return foo(t)
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_c_restrict=$ac_kw
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-     test "$ac_cv_c_restrict" != no && break
-   done
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
-$as_echo "$ac_cv_c_restrict" >&6; }
-
- case $ac_cv_c_restrict in
-   restrict) ;;
-   no) $as_echo "#define restrict /**/" >>confdefs.h
- ;;
-   *)  cat >>confdefs.h <<_ACEOF
-#define restrict $ac_cv_c_restrict
-_ACEOF
- ;;
- esac
-
-
-
 
 
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in <time.h>" >&5
@@ -19134,103 +19314,289 @@ static struct timespec x; x.tv_sec = x.tv_nsec;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gl_cv_sys_struct_timespec_in_pthread_h=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_timespec_in_pthread_h=yes
+else
+  gl_cv_sys_struct_timespec_in_pthread_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_pthread_h" >&5
+$as_echo "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; }
+      if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
+        PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
+      fi
+    fi
+  fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+     if test $gl_cv_have_include_next = yes; then
+       gl_cv_next_time_h='<'time.h'>'
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <time.h>" >&5
+$as_echo_n "checking absolute name of <time.h>... " >&6; }
+if test "${gl_cv_next_time_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <time.h>
+
+_ACEOF
+                                                                                                                        case "$host_os" in
+                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
+                 *)    gl_absname_cpp="$ac_cpp" ;;
+               esac
+
+               case "$host_os" in
+                 mingw*)
+                                                                                                                                     gl_dirsep_regex='[/\\]'
+                   ;;
+                 *)
+                   gl_dirsep_regex='\/'
+                   ;;
+               esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
+
+               gl_header_literal_regex=`echo 'time.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
+                   s|^/[^/]|//&|
+                   p
+                   q
+                 }'
+                                                            gl_cv_next_time_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                      sed -n "$gl_absolute_header_sed"`'"'
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5
+$as_echo "$gl_cv_next_time_h" >&6; }
+     fi
+     NEXT_TIME_H=$gl_cv_next_time_h
+
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'time.h'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_time_h
+     fi
+     NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the utimes function works" >&5
+$as_echo_n "checking whether the utimes function works... " >&6; }
+if test "${gl_cv_func_working_utimes+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  if test "$cross_compiling" = yes; then :
+  gl_cv_func_working_utimes=no
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <utime.h>
+
+static int
+inorder (time_t a, time_t b, time_t c)
+{
+  return a <= b && b <= c;
+}
+
+int
+main ()
+{
+  int result = 0;
+  char const *file = "conftest.utimes";
+  static struct timeval timeval[2] = {{9, 10}, {999999, 999999}};
+
+  /* Test whether utimes() essentially works.  */
+  {
+    struct stat sbuf;
+    FILE *f = fopen (file, "w");
+    if (f == NULL)
+      result |= 1;
+    else if (fclose (f) != 0)
+      result |= 1;
+    else if (utimes (file, timeval) != 0)
+      result |= 2;
+    else if (lstat (file, &sbuf) != 0)
+      result |= 1;
+    else if (!(sbuf.st_atime == timeval[0].tv_sec
+               && sbuf.st_mtime == timeval[1].tv_sec))
+      result |= 4;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument sets the file's timestamp
+     to the current time.  Use 'fstat' as well as 'time' to
+     determine the "current" time, to accommodate NFS file systems
+     if there is a time skew between the host and the NFS server.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0644);
+    if (fd < 0)
+      result |= 1;
+    else
+      {
+        time_t t0, t2;
+        struct stat st0, st1, st2;
+        if (time (&t0) == (time_t) -1)
+          result |= 1;
+        else if (fstat (fd, &st0) != 0)
+          result |= 1;
+        else if (utimes (file, timeval) != 0)
+          result |= 2;
+        else if (utimes (file, NULL) != 0)
+          result |= 8;
+        else if (fstat (fd, &st1) != 0)
+          result |= 1;
+        else if (write (fd, "\n", 1) != 1)
+          result |= 1;
+        else if (fstat (fd, &st2) != 0)
+          result |= 1;
+        else if (time (&t2) == (time_t) -1)
+          result |= 1;
+        else
+          {
+            int m_ok_POSIX = inorder (t0, st1.st_mtime, t2);
+            int m_ok_NFS = inorder (st0.st_mtime, st1.st_mtime, st2.st_mtime);
+            if (! (st1.st_atime == st1.st_mtime))
+              result |= 16;
+            if (! (m_ok_POSIX || m_ok_NFS))
+              result |= 32;
+          }
+        if (close (fd) != 0)
+          result |= 1;
+      }
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument works on read-only files.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0444);
+    if (fd < 0)
+      result |= 1;
+    else if (close (fd) != 0)
+      result |= 1;
+    else if (utimes (file, NULL) != 0)
+      result |= 64;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  return result;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_working_utimes=yes
 else
-  gl_cv_sys_struct_timespec_in_pthread_h=no
+  gl_cv_func_working_utimes=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_pthread_h" >&5
-$as_echo "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; }
-      if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then
-        PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1
-      fi
-    fi
-  fi
-
-
-
-
-
-
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_utimes" >&5
+$as_echo "$gl_cv_func_working_utimes" >&6; }
 
+  if test $gl_cv_func_working_utimes = yes; then
 
+$as_echo "#define HAVE_WORKING_UTIMES 1" >>confdefs.h
 
+  fi
 
 
 
 
 
-     if test $gl_cv_have_include_next = yes; then
-       gl_cv_next_time_h='<'time.h'>'
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <time.h>" >&5
-$as_echo_n "checking absolute name of <time.h>... " >&6; }
-if test "${gl_cv_next_time_h+set}" = set; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct utimbuf" >&5
+$as_echo_n "checking for struct utimbuf... " >&6; }
+if test "${gl_cv_sys_struct_utimbuf+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
-
-               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <time.h>
+#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+            #ifdef HAVE_UTIME_H
+             #include <utime.h>
+            #endif
 
+int
+main ()
+{
+static struct utimbuf x; x.actime = x.modtime;
+  ;
+  return 0;
+}
 _ACEOF
-                                                                                                                        case "$host_os" in
-                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
-                 *)    gl_absname_cpp="$ac_cpp" ;;
-               esac
-
-               case "$host_os" in
-                 mingw*)
-                                                                                                                                     gl_dirsep_regex='[/\\]'
-                   ;;
-                 *)
-                   gl_dirsep_regex='/'
-                   ;;
-               esac
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_sys_struct_utimbuf=yes
+else
+  gl_cv_sys_struct_utimbuf=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_utimbuf" >&5
+$as_echo "$gl_cv_sys_struct_utimbuf" >&6; }
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'time.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'time.h\)".*|\1|
-                   s|^/[^/]|//&|
-                   p
-                   q
-                 }'
-                                                            gl_cv_next_time_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
-                      sed -n "$gl_absolute_header_sed"`'"'
+  if test $gl_cv_sys_struct_utimbuf = yes; then
 
+$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5
-$as_echo "$gl_cv_next_time_h" >&6; }
-     fi
-     NEXT_TIME_H=$gl_cv_next_time_h
+  fi
 
-     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
-       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
-       gl_next_as_first_directive='<'time.h'>'
-     else
-       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
-       gl_next_as_first_directive=$gl_cv_next_time_h
-     fi
-     NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive
 
 
 
 
 
 
-ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "$ac_includes_default"
-if test "x$ac_cv_have_decl_localtime_r" = x""yes; then :
-  ac_have_decl=1
-else
-  ac_have_decl=0
-fi
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_LOCALTIME_R $ac_have_decl
-_ACEOF
 
 
 
 
 
 
+  # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
+  # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+
+  # Save and restore LIBS so e.g., -lrt, isn't added to it.  Otherwise, *all*
+  # programs in the package would end up linked with that potentially-shared
+  # library, inducing unnecessary run-time overhead.
+  LIB_CLOCK_GETTIME=
+
+  gl_saved_libs=$LIBS
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
+$as_echo_n "checking for library containing clock_gettime... " >&6; }
+if test "${ac_cv_search_clock_gettime+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char clock_gettime ();
+int
+main ()
+{
+return clock_gettime ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' rt posix4; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_search_clock_gettime=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_clock_gettime+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_clock_gettime+set}" = set; then :
+
+else
+  ac_cv_search_clock_gettime=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
+$as_echo "$ac_cv_search_clock_gettime" >&6; }
+ac_res=$ac_cv_search_clock_gettime
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  test "$ac_cv_search_clock_gettime" = "none required" ||
+                    LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
+fi
+
+    for ac_func in clock_gettime clock_settime
+do :
+  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+eval as_val=\$$as_ac_var
+   if test "x$as_val" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+  LIBS=$gl_saved_libs
+
+
+
+
   :
 
 
@@ -19349,17 +19799,17 @@ else
   if test "$cross_compiling" = yes; then :
   case "$host_os" in
            mingw*) # on this platform, dup2 always returns 0 for success
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
                    # closed fd may yield -EBADF instead of -1 / errno=EBADF.
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF.
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
-             gl_cv_func_dup2_works=no;;
-           *) gl_cv_func_dup2_works=yes;;
+             gl_cv_func_dup2_works="guessing no" ;;
+           *) gl_cv_func_dup2_works="guessing yes" ;;
          esac
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup2_works" >&5
 $as_echo "$gl_cv_func_dup2_works" >&6; }
-    if test "$gl_cv_func_dup2_works" = no; then
-      REPLACE_DUP2=1
-    fi
+    case "$gl_cv_func_dup2_works" in
+      *yes) ;;
+      *)
+        REPLACE_DUP2=1
+        ;;
+    esac
   fi
 
 
@@ -19449,7 +19902,7 @@ fi
 
 gl_save_LIBS=$LIBS
 
-# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
+# getloadvg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
 # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
 HAVE_GETLOADAVG=1
 ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg"
@@ -19851,6 +20304,8 @@ if test $HAVE_GETLOADAVG = 0; then
 
 # Figure out what our getloadavg.c needs.
 
+
+
 # On HPUX9, an unprivileged user can get load averages this way.
 if test $gl_func_getloadavg_done = no; then
   for ac_func in pstat_getdynamic
@@ -20004,58 +20459,264 @@ if test $REPLACE_GETOPT = 1; then
 
 
 
+    GNULIB_GL_UNISTD_H_GETOPT=1
 fi
 
 
 
 
 
+
+
     REPLACE_GETOPT=0
+    if test -n "$gl_replace_getopt"; then
+      REPLACE_GETOPT=1
+    fi
+
+  if test $REPLACE_GETOPT = 1; then
+
+  GETOPT_H=getopt.h
+
+$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
+
+
+
+  fi
+
+if test $REPLACE_GETOPT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext"
+
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext"
+
+
+
+
+    GNULIB_GL_UNISTD_H_GETOPT=1
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+  gl_gettimeofday_timezone=void
+  if test $ac_cv_func_gettimeofday != yes; then
+    HAVE_GETTIMEOFDAY=0
+  else
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday clobbers localtime buffer" >&5
+$as_echo_n "checking whether gettimeofday clobbers localtime buffer... " >&6; }
+if test "${gl_cv_func_gettimeofday_clobber+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  # When cross-compiling:
+      case "$host_os" in
+                # Guess all is fine on glibc systems.
+        *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+                # If we don't know, assume the worst.
+        *)      gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+      esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <string.h>
+          #include <sys/time.h>
+          #include <time.h>
+          #include <stdlib.h>
+
+int
+main ()
+{
+
+          time_t t = 0;
+          struct tm *lt;
+          struct tm saved_lt;
+          struct timeval tv;
+          lt = localtime (&t);
+          saved_lt = *lt;
+          gettimeofday (&tv, NULL);
+          return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_gettimeofday_clobber=no
+else
+  gl_cv_func_gettimeofday_clobber=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_clobber" >&5
+$as_echo "$gl_cv_func_gettimeofday_clobber" >&6; }
+
+ case "$gl_cv_func_gettimeofday_clobber" in
+   *yes)
+     REPLACE_GETTIMEOFDAY=1
+
+
+$as_echo "#define gmtime rpl_gmtime" >>confdefs.h
+
+
+$as_echo "#define localtime rpl_localtime" >>confdefs.h
+
+
+
+$as_echo "#define GETTIMEOFDAY_CLOBBERS_LOCALTIME 1" >>confdefs.h
+
+     ;;
+ esac
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gettimeofday with POSIX signature" >&5
+$as_echo_n "checking for gettimeofday with POSIX signature... " >&6; }
+if test "${gl_cv_func_gettimeofday_posix_signature+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/time.h>
+              struct timeval c;
+              int gettimeofday (struct timeval *restrict, void *restrict);
+
+int
+main ()
+{
+/* glibc uses struct timezone * rather than the POSIX void *
+                 if _GNU_SOURCE is defined.  However, since the only portable
+                 use of gettimeofday uses NULL as the second parameter, and
+                 since the glibc definition is actually more typesafe, it is
+                 not worth wrapping this to get a compliant signature.  */
+              int (*f) (struct timeval *restrict, void *restrict)
+                = gettimeofday;
+              int x = f (&c, 0);
+              return !(x | c.tv_sec | c.tv_usec);
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_func_gettimeofday_posix_signature=yes
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/time.h>
+int gettimeofday (struct timeval *restrict, struct timezone *restrict);
 
+int
+main ()
+{
 
-  if test -n "$gl_replace_getopt"; then :
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_func_gettimeofday_posix_signature=almost
+else
+  gl_cv_func_gettimeofday_posix_signature=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_gettimeofday_posix_signature" >&5
+$as_echo "$gl_cv_func_gettimeofday_posix_signature" >&6; }
+    if test $gl_cv_func_gettimeofday_posix_signature = almost; then
+      gl_gettimeofday_timezone='struct timezone'
+    elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
+        if test $REPLACE_STRUCT_TIMEVAL = 1; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
 
-      REPLACE_GETOPT=1
+  fi
 
-fi
+cat >>confdefs.h <<_ACEOF
+#define GETTIMEOFDAY_TIMEZONE $gl_gettimeofday_timezone
+_ACEOF
 
 
-  if test $REPLACE_GETOPT = 1; then
+if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
 
-  GETOPT_H=getopt.h
 
-$as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h
 
 
 
-        GNULIB_UNISTD_H_GETOPT=1
-  fi
 
-if test $REPLACE_GETOPT = 1; then
 
 
+  gl_LIBOBJS="$gl_LIBOBJS gettimeofday.$ac_objext"
 
 
+  for ac_header in sys/timeb.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "sys/timeb.h" "ac_cv_header_sys_timeb_h" "$ac_includes_default"
+if test "x$ac_cv_header_sys_timeb_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_SYS_TIMEB_H 1
+_ACEOF
 
+fi
 
+done
 
+  for ac_func in _ftime
+do :
+  ac_fn_c_check_func "$LINENO" "_ftime" "ac_cv_func__ftime"
+if test "x$ac_cv_func__ftime" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE__FTIME 1
+_ACEOF
 
-  gl_LIBOBJS="$gl_LIBOBJS getopt.$ac_objext"
+fi
+done
 
 
+fi
 
 
 
 
 
+          GNULIB_GETTIMEOFDAY=1
 
 
-  gl_LIBOBJS="$gl_LIBOBJS getopt1.$ac_objext"
 
 
 
 
-fi
 
 
 
 
   if test $ac_cv_func_lstat = yes; then
 
-    if test $gl_cv_func_lstat_dereferences_slashed_symlink = no; then
-      REPLACE_LSTAT=1
-    fi
+    case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+      *no)
+        REPLACE_LSTAT=1
+        ;;
+    esac
   else
     HAVE_LSTAT=0
   fi
@@ -20104,7 +20767,7 @@ fi
 
 
   if test $APPLE_UNIVERSAL_BUILD = 1; then
-    # A universal build on Apple MacOS X platforms.
+    # A universal build on Apple Mac OS X platforms.
     # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
     # But we need a configuration result that is valid in both modes.
     gl_cv_func_working_mktime=no
@@ -20286,20 +20949,23 @@ main ()
       if (tz_strings[i])
         putenv (tz_strings[i]);
 
-      for (t = 0; t <= time_t_max - delta; t += delta)
+      for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta)
         if (! mktime_test (t))
           result |= 1;
-      if (! (mktime_test ((time_t) 1)
-             && mktime_test ((time_t) (60 * 60))
-             && mktime_test ((time_t) (60 * 60 * 24))))
+      if ((result & 2) == 0
+          && ! (mktime_test ((time_t) 1)
+                && mktime_test ((time_t) (60 * 60))
+                && mktime_test ((time_t) (60 * 60 * 24))))
         result |= 2;
 
-      for (j = 1; ; j <<= 1)
-        if (! bigtime_test (j))
-          result |= 4;
-        else if (INT_MAX / 2 < j)
-          break;
-      if (! bigtime_test (INT_MAX))
+      for (j = 1; (result & 4) == 0; j <<= 1)
+        {
+          if (! bigtime_test (j))
+            result |= 4;
+          if (INT_MAX / 2 < j)
+            break;
+        }
+      if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
         result |= 8;
     }
   if (! irix_6_4_bug ())
 
 
 
+
+
+
+  if test $ac_cv_func_pselect = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether signature of pselect conforms to POSIX" >&5
+$as_echo_n "checking whether signature of pselect conforms to POSIX... " >&6; }
+if test "${gl_cv_sig_pselect+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+
+int
+main ()
+{
+int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
+                          struct timespec const *restrict,
+                          sigset_t const *restrict) = pselect;
+                return !p;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gl_cv_sig_pselect=yes
+else
+  gl_cv_sig_pselect=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sig_pselect" >&5
+$as_echo "$gl_cv_sig_pselect" >&6; }
+  fi
+
+  if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then
+    REPLACE_PSELECT=1
+  fi
+
+if test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS pselect.$ac_objext"
+
+fi
+
+
+
+
+
+          GNULIB_PSELECT=1
+
+
+
+
+
+
+
+
+
   LIB_PTHREAD_SIGMASK=
 
 
@@ -20634,7 +21367,13 @@ else
        ln -s conftest.no-such conftest.link
        ln -s conftest.link conftest.lnk2
        if test "$cross_compiling" = yes; then :
-  gl_cv_func_readlink_works="guessing no"
+  case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_readlink_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_readlink_works="guessing no" ;;
+          esac
+
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_readlink_works" >&5
 $as_echo "$gl_cv_func_readlink_works" >&6; }
-    if test "$gl_cv_func_readlink_works" != yes; then
+    case "$gl_cv_func_readlink_works" in
+      *yes)
+        if test "$gl_cv_decl_readlink_works" != yes; then
+          REPLACE_READLINK=1
+        fi
+        ;;
+      *)
 
 $as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h
 
-      REPLACE_READLINK=1
-    elif test "$gl_cv_decl_readlink_works" != yes; then
-      REPLACE_READLINK=1
-    fi
+        REPLACE_READLINK=1
+        ;;
+    esac
   fi
 
 if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
@@ -20733,12 +21477,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'signal.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'signal.h\)".*|\1|
+               gl_header_literal_regex=`echo 'signal.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
 #endif
 
 "
-if test "x$ac_cv_type_socklen_t" = x""yes; then :
+if test "x$ac_cv_type_socklen_t" = x""yes; then :
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5
+$as_echo_n "checking for socklen_t equivalent... " >&6; }
+      if test "${gl_cv_socklen_t_equiv+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  # Systems have either "struct sockaddr *" or
+         # "void *" as the second argument to getpeername
+         gl_cv_socklen_t_equiv=
+         for arg2 in "struct sockaddr" void; do
+           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
+             cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+                   #include <sys/socket.h>
+
+                   int getpeername (int, $arg2 *, $t *);
+int
+main ()
+{
+$t len;
+                  getpeername (0, 0, &len);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_socklen_t_equiv="$t"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+             test "$gl_cv_socklen_t_equiv" != "" && break
+           done
+           test "$gl_cv_socklen_t_equiv" != "" && break
+         done
+
+fi
+
+      if test "$gl_cv_socklen_t_equiv" = ""; then
+        as_fn_error "Cannot find a type to use in place of socklen_t" "$LINENO" 5
+      fi
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socklen_t_equiv" >&5
+$as_echo "$gl_cv_socklen_t_equiv" >&6; }
+
+cat >>confdefs.h <<_ACEOF
+#define socklen_t $gl_cv_socklen_t_equiv
+_ACEOF
+
+fi
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5
+$as_echo_n "checking for ssize_t... " >&6; }
+if test "${gt_cv_ssize_t+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/types.h>
+int
+main ()
+{
+int x = sizeof (ssize_t *) + sizeof (ssize_t);
+            return !x;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gt_cv_ssize_t=yes
+else
+  gt_cv_ssize_t=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_ssize_t" >&5
+$as_echo "$gt_cv_ssize_t" >&6; }
+  if test $gt_cv_ssize_t = no; then
+
+$as_echo "#define ssize_t int" >>confdefs.h
+
+  fi
+
+
+
+
+
+
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.tv_nsec" "ac_cv_member_struct_stat_st_atim_tv_nsec" "#include <sys/types.h>
+     #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
+_ACEOF
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct stat.st_atim is of type struct timespec" >&5
+$as_echo_n "checking whether struct stat.st_atim is of type struct timespec... " >&6; }
+if test "${ac_cv_typeof_struct_stat_st_atim_is_struct_timespec+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+            #include <sys/types.h>
+            #include <sys/stat.h>
+            #if HAVE_SYS_TIME_H
+            # include <sys/time.h>
+            #endif
+            #include <time.h>
+            struct timespec ts;
+            struct stat st;
+
+int
+main ()
+{
+
+            st.st_atim = ts;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes
+else
+  ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&5
+$as_echo "$ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&6; }
+     if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
+
+$as_echo "#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1" >>confdefs.h
+
+     fi
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec.tv_nsec" "ac_cv_member_struct_stat_st_atimespec_tv_nsec" "#include <sys/types.h>
+        #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atimespec_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1
+_ACEOF
+
+
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "#include <sys/types.h>
+           #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atimensec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
+_ACEOF
+
+
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.st__tim.tv_nsec" "ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" "#include <sys/types.h>
+              #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC 1
+_ACEOF
+
+
+fi
+
+fi
+
+fi
+
+fi
+
+
+
+
+
+
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec.tv_nsec" "ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" "#include <sys/types.h>
+     #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1
+_ACEOF
+
 
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t equivalent" >&5
-$as_echo_n "checking for socklen_t equivalent... " >&6; }
-      if test "${gl_cv_socklen_t_equiv+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  # Systems have either "struct sockaddr *" or
-         # "void *" as the second argument to getpeername
-         gl_cv_socklen_t_equiv=
-         for arg2 in "struct sockaddr" void; do
-           for t in int size_t "unsigned int" "long int" "unsigned long int"; do
-             cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <sys/types.h>
-                   #include <sys/socket.h>
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimensec" "ac_cv_member_struct_stat_st_birthtimensec" "#include <sys/types.h>
+        #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_birthtimensec" = x""yes; then :
 
-                   int getpeername (int, $arg2 *, $t *);
-int
-main ()
-{
-$t len;
-                  getpeername (0, 0, &len);
-  ;
-  return 0;
-}
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  gl_cv_socklen_t_equiv="$t"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-             test "$gl_cv_socklen_t_equiv" != "" && break
-           done
-           test "$gl_cv_socklen_t_equiv" != "" && break
-         done
 
-fi
 
-      if test "$gl_cv_socklen_t_equiv" = ""; then
-        as_fn_error "Cannot find a type to use in place of socklen_t" "$LINENO" 5
-      fi
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_socklen_t_equiv" >&5
-$as_echo "$gl_cv_socklen_t_equiv" >&6; }
+else
+  ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtim.tv_nsec" "ac_cv_member_struct_stat_st_birthtim_tv_nsec" "#include <sys/types.h>
+          #include <sys/stat.h>
+"
+if test "x$ac_cv_member_struct_stat_st_birthtim_tv_nsec" = x""yes; then :
 
 cat >>confdefs.h <<_ACEOF
-#define socklen_t $gl_cv_socklen_t_equiv
+#define HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC 1
 _ACEOF
 
+
 fi
 
+fi
 
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5
-$as_echo_n "checking for ssize_t... " >&6; }
-if test "${gt_cv_ssize_t+set}" = set; then :
+fi
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working stdalign.h" >&5
+$as_echo_n "checking for working stdalign.h... " >&6; }
+if test "${gl_cv_header_working_stdalign_h+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <sys/types.h>
+#include <stdalign.h>
+            #include <stddef.h>
+
+            /* Test that alignof yields a result consistent with offsetof.
+               This catches GCC bug 52023
+               <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.  */
+            #ifdef __cplusplus
+               template <class t> struct alignof_helper { char a; t b; };
+            # define ao(type) offsetof (alignof_helper<type>, b)
+            #else
+            # define ao(type) offsetof (struct { char a; type b; }, b)
+            #endif
+            char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1];
+            char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1];
+            char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1];
+
+            /* Test _Alignas only on platforms where gnulib can help.  */
+            #if \
+                (__GNUC__ || __IBMC__ || __IBMCPP__ \
+                 || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
+              int alignas (8) alignas_int = 1;
+              char test_alignas[_Alignof (alignas_int) == 8 ? 1 : -1];
+            #endif
+
 int
 main ()
 {
-int x = sizeof (ssize_t *) + sizeof (ssize_t);
-            return !x;
+
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  gt_cv_ssize_t=yes
+  gl_cv_header_working_stdalign_h=yes
 else
-  gt_cv_ssize_t=no
+  gl_cv_header_working_stdalign_h=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_ssize_t" >&5
-$as_echo "$gt_cv_ssize_t" >&6; }
-  if test $gt_cv_ssize_t = no; then
-
-$as_echo "#define ssize_t int" >>confdefs.h
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdalign_h" >&5
+$as_echo "$gl_cv_header_working_stdalign_h" >&6; }
 
+  if test $gl_cv_header_working_stdalign_h = yes; then
+    STDALIGN_H=''
+  else
+    STDALIGN_H='stdalign.h'
   fi
 
 
+   if test -n "$STDALIGN_H"; then
+  GL_GENERATE_STDALIGN_H_TRUE=
+  GL_GENERATE_STDALIGN_H_FALSE='#'
+else
+  GL_GENERATE_STDALIGN_H_TRUE='#'
+  GL_GENERATE_STDALIGN_H_FALSE=
+fi
+
+
+
   STDARG_H=''
   NEXT_STDARG_H='<stdarg.h>'
   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for va_copy" >&5
@@ -20977,12 +21930,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'stdarg.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'stdarg.h\)".*|\1|
+               gl_header_literal_regex=`echo 'stdarg.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -21177,12 +22133,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'stddef.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'stddef.h\)".*|\1|
+               gl_header_literal_regex=`echo 'stddef.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -21247,12 +22206,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'stdio.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'stdio.h\)".*|\1|
+               gl_header_literal_regex=`echo 'stdio.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -21281,12 +22243,25 @@ $as_echo "$gl_cv_next_stdio_h" >&6; }
 
 
       GNULIB_FSCANF=1
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_FSCANF 1
+_ACEOF
+
+
   GNULIB_SCANF=1
+
+
+cat >>confdefs.h <<_ACEOF
+#define GNULIB_SCANF 1
+_ACEOF
+
+
   GNULIB_FGETC=1
   GNULIB_GETC=1
   GNULIB_GETCHAR=1
   GNULIB_FGETS=1
-  GNULIB_GETS=1
   GNULIB_FREAD=1
 
 
@@ -21339,12 +22314,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'stdlib.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'stdlib.h\)".*|\1|
+               gl_header_literal_regex=`echo 'stdlib.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -21397,7 +22375,83 @@ $as_echo "#define my_strftime nstrftime" >>confdefs.h
     HAVE_DECL_STRTOIMAX=0
   fi
 
-if test $ac_cv_func_strtoimax = no; then
+  if test $ac_cv_func_strtoimax = yes; then
+    HAVE_STRTOIMAX=1
+             { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether strtoimax works" >&5
+$as_echo_n "checking whether strtoimax works... " >&6; }
+if test "${gl_cv_func_strtoimax+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                   # Guess no on AIX 5.
+            aix5*) gl_cv_func_strtoimax="guessing no" ;;
+                   # Guess yes otherwise.
+            *)     gl_cv_func_strtoimax="guessing yes" ;;
+          esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
+int main ()
+{
+  if (sizeof (intmax_t) > sizeof (int))
+    {
+      const char *s = "4294967295";
+      char *p;
+      intmax_t res;
+      errno = 0;
+      res = strtoimax (s, &p, 10);
+      if (p != s + strlen (s))
+        return 1;
+      if (errno != 0)
+        return 2;
+      if (res != (intmax_t) 65535 * (intmax_t) 65537)
+        return 3;
+    }
+  else
+    {
+      const char *s = "2147483647";
+      char *p;
+      intmax_t res;
+      errno = 0;
+      res = strtoimax (s, &p, 10);
+      if (p != s + strlen (s))
+        return 1;
+      if (errno != 0)
+        return 2;
+      if (res != 2147483647)
+        return 3;
+    }
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_strtoimax=yes
+else
+  gl_cv_func_strtoimax=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strtoimax" >&5
+$as_echo "$gl_cv_func_strtoimax" >&6; }
+    case "$gl_cv_func_strtoimax" in
+      *no) REPLACE_STRTOIMAX=1 ;;
+    esac
+  else
+    HAVE_STRTOIMAX=0
+  fi
+
+if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then
 
 
 
@@ -21451,103 +22505,307 @@ if test $ac_cv_func_strtoumax = no; then
 
 
 
-  gl_LIBOBJS="$gl_LIBOBJS strtoumax.$ac_objext"
+  gl_LIBOBJS="$gl_LIBOBJS strtoumax.$ac_objext"
+
+
+  ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strtoull" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRTOULL $ac_have_decl
+_ACEOF
+
+
+
+fi
+
+
+
+
+
+          GNULIB_STRTOUMAX=1
+
+
+
+
+
+
+
+        if test $ac_cv_func_symlink = no; then
+    HAVE_SYMLINK=0
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symlink handles trailing slash correctly" >&5
+$as_echo_n "checking whether symlink handles trailing slash correctly... " >&6; }
+if test "${gl_cv_func_symlink_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_symlink_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_symlink_works="guessing no" ;;
+          esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <unistd.h>
+
+int
+main ()
+{
+int result = 0;
+             if (!symlink ("a", "conftest.link/"))
+               result |= 1;
+             if (symlink ("conftest.f", "conftest.lnk2"))
+               result |= 2;
+             else if (!symlink ("a", "conftest.lnk2/"))
+               result |= 4;
+             return result;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_symlink_works=yes
+else
+  gl_cv_func_symlink_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      rm -f conftest.f conftest.link conftest.lnk2
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_symlink_works" >&5
+$as_echo "$gl_cv_func_symlink_works" >&6; }
+    case "$gl_cv_func_symlink_works" in
+      *yes) ;;
+      *)
+        REPLACE_SYMLINK=1
+        ;;
+    esac
+  fi
+
+if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS symlink.$ac_objext"
+
+fi
+
+
+
+
+
+          GNULIB_SYMLINK=1
+
+
+
+
+
+
+
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether <sys/select.h> is self-contained" >&5
+$as_echo_n "checking whether <sys/select.h> is self-contained... " >&6; }
+if test "${gl_cv_header_sys_select_h_selfcontained+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+
+                                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+struct timeval b;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_header_sys_select_h_selfcontained=yes
+else
+  gl_cv_header_sys_select_h_selfcontained=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+                        if test $gl_cv_header_sys_select_h_selfcontained = yes; then
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+int memset; int bzero;
+  ;
+  return 0;
+}
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <sys/select.h>
+int
+main ()
+{
+
+                  #undef memset
+                  #define memset nonexistent_memset
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void *memset (void *, int, unsigned long);
+                  #undef bzero
+                  #define bzero nonexistent_bzero
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void bzero (void *, unsigned long);
+                  fd_set fds;
+                  FD_ZERO (&fds);
+
+  ;
+  return 0;
+}
 
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
 
-  ac_fn_c_check_decl "$LINENO" "strtoull" "ac_cv_have_decl_strtoull" "$ac_includes_default"
-if test "x$ac_cv_have_decl_strtoull" = x""yes; then :
-  ac_have_decl=1
 else
-  ac_have_decl=0
+  gl_cv_header_sys_select_h_selfcontained=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_STRTOULL $ac_have_decl
-_ACEOF
-
-
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+      fi
 
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5
+$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; }
 
 
 
 
 
-          GNULIB_STRTOUMAX=1
 
 
 
 
+     if test $gl_cv_have_include_next = yes; then
+       gl_cv_next_sys_select_h='<'sys/select.h'>'
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of <sys/select.h>" >&5
+$as_echo_n "checking absolute name of <sys/select.h>... " >&6; }
+if test "${gl_cv_next_sys_select_h+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
 
+             if test $ac_cv_header_sys_select_h = yes; then
 
 
-        if test $ac_cv_func_symlink = no; then
-    HAVE_SYMLINK=0
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether symlink handles trailing slash correctly" >&5
-$as_echo_n "checking whether symlink handles trailing slash correctly... " >&6; }
-if test "${gl_cv_func_symlink_works+set}" = set; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  gl_cv_func_symlink_works="guessing no"
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+               cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <unistd.h>
-
-int
-main ()
-{
-int result = 0;
-             if (!symlink ("a", "conftest.link/"))
-               result |= 1;
-             if (symlink ("conftest.f", "conftest.lnk2"))
-               result |= 2;
-             else if (!symlink ("a", "conftest.lnk2/"))
-               result |= 4;
-             return result;
+#include <sys/select.h>
 
-  ;
-  return 0;
-}
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  gl_cv_func_symlink_works=yes
-else
-  gl_cv_func_symlink_works=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
+                                                                                                                        case "$host_os" in
+                 aix*) gl_absname_cpp="$ac_cpp -C" ;;
+                 *)    gl_absname_cpp="$ac_cpp" ;;
+               esac
 
-      rm -f conftest.f conftest.link conftest.lnk2
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_symlink_works" >&5
-$as_echo "$gl_cv_func_symlink_works" >&6; }
-    if test "$gl_cv_func_symlink_works" != yes; then
-      REPLACE_SYMLINK=1
-    fi
-  fi
+               case "$host_os" in
+                 mingw*)
+                                                                                                                                     gl_dirsep_regex='[/\\]'
+                   ;;
+                 *)
+                   gl_dirsep_regex='\/'
+                   ;;
+               esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
+
+               gl_header_literal_regex=`echo 'sys/select.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
+                   s|^/[^/]|//&|
+                   p
+                   q
+                 }'
+                                                            gl_cv_next_sys_select_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 |
+                      sed -n "$gl_absolute_header_sed"`'"'
+          else
+               gl_cv_next_sys_select_h='<'sys/select.h'>'
+             fi
 
-if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5
+$as_echo "$gl_cv_next_sys_select_h" >&6; }
+     fi
+     NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h
+
+     if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next'
+       gl_next_as_first_directive='<'sys/select.h'>'
+     else
+       # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include'
+       gl_next_as_first_directive=$gl_cv_next_sys_select_h
+     fi
+     NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive
 
 
 
 
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
+  else
+    HAVE_SYS_SELECT_H=0
+  fi
 
 
 
-  gl_LIBOBJS="$gl_LIBOBJS symlink.$ac_objext"
 
-fi
 
+  if test $ac_cv_header_sys_socket_h != yes; then
+                    for ac_header in winsock2.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default"
+if test "x$ac_cv_header_winsock2_h" = x""yes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_WINSOCK2_H 1
+_ACEOF
 
+fi
 
+done
 
+  fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
 
-          GNULIB_SYMLINK=1
 
 
 
@@ -21596,12 +22854,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'sys/stat.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'sys/stat.h\)".*|\1|
+               gl_header_literal_regex=`echo 'sys/stat.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -21634,6 +22895,16 @@ $as_echo "$gl_cv_next_sys_stat_h" >&6; }
 
 
 
+
+
+
+
+  if test $WINDOWS_64_BIT_ST_SIZE = 1; then
+
+$as_echo "#define _GL_WINDOWS_64_BIT_ST_SIZE 1" >>confdefs.h
+
+  fi
+
       ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include <sys/types.h>
      #include <sys/stat.h>
 "
 
 
 
+
+
+
+      ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "#include <time.h>
+"
+if test "x$ac_cv_have_decl_localtime_r" = x""yes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_LOCALTIME_R $ac_have_decl
+_ACEOF
+
   if test $ac_cv_have_decl_localtime_r = no; then
     HAVE_DECL_LOCALTIME_R=0
   fi
@@ -21747,6 +23033,9 @@ fi
 
 
 
+
+
+
 
 
      if test $gl_cv_have_include_next = yes; then
@@ -21776,12 +23065,15 @@ _ACEOF
                                                                                                                                      gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+                                             gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"'unistd.h|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"'unistd.h\)".*|\1|
+               gl_header_literal_regex=`echo 'unistd.h' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
                    s|^/[^/]|//&|
                    p
                    q
@@ -21822,10 +23114,74 @@ $as_echo "$gl_cv_next_unistd_h" >&6; }
 
 
 
+
+
+
+
+
+
+
+
+  if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether futimesat handles NULL file" >&5
+$as_echo_n "checking whether futimesat handles NULL file... " >&6; }
+if test "${gl_cv_func_futimesat_works+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  touch conftest.file
+       if test "$cross_compiling" = yes; then :
+  case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_futimesat_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_futimesat_works="guessing no" ;;
+         esac
+
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+#include <stddef.h>
+#include <sys/times.h>
+#include <fcntl.h>
+
+int
+main ()
+{
+    int fd = open ("conftest.file", O_RDWR);
+          if (fd < 0) return 1;
+          if (futimesat (fd, NULL, NULL)) return 2;
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  gl_cv_func_futimesat_works=yes
+else
+  gl_cv_func_futimesat_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+      rm -f conftest.file
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_futimesat_works" >&5
+$as_echo "$gl_cv_func_futimesat_works" >&6; }
+    case "$gl_cv_func_futimesat_works" in
+      *yes) ;;
+      *)
+
+$as_echo "#define FUTIMESAT_NULL_BUG 1" >>confdefs.h
+
+        ;;
+    esac
+  fi
+
   gl_gnulib_enabled_dosname=false
   gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
   gl_gnulib_enabled_pathmax=false
-  gl_gnulib_enabled_sigprocmask=false
   gl_gnulib_enabled_stat=false
   gl_gnulib_enabled_strtoll=false
   gl_gnulib_enabled_strtoull=false
@@ -21853,52 +23209,6 @@ $as_echo "$gl_cv_next_unistd_h" >&6; }
       gl_gnulib_enabled_pathmax=true
     fi
   }
-  func_gl_gnulib_m4code_sigprocmask ()
-  {
-    if ! $gl_gnulib_enabled_sigprocmask; then
-
-
-
-  if test $gl_cv_type_sigset_t = yes; then
-    ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask"
-if test "x$ac_cv_func_sigprocmask" = x""yes; then :
-  gl_cv_func_sigprocmask=1
-fi
-
-  fi
-  if test -z "$gl_cv_func_sigprocmask"; then
-    HAVE_POSIX_SIGNALBLOCKING=0
-  fi
-
-if test $HAVE_POSIX_SIGNALBLOCKING = 0; then
-
-
-
-
-
-
-
-
-  gl_LIBOBJS="$gl_LIBOBJS sigprocmask.$ac_objext"
-
-
-
-
-fi
-
-
-
-
-
-          GNULIB_SIGPROCMASK=1
-
-
-
-
-
-      gl_gnulib_enabled_sigprocmask=true
-    fi
-  }
   func_gl_gnulib_m4code_stat ()
   {
     if ! $gl_gnulib_enabled_stat; then
@@ -21940,7 +23250,7 @@ fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_dir_slash" >&5
 $as_echo "$gl_cv_func_stat_dir_slash" >&6; }
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5
 $as_echo_n "checking whether stat handles trailing slashes on files... " >&6; }
 if test "${gl_cv_func_stat_file_slash+set}" = set; then :
   $as_echo_n "(cached) " >&6
@@ -21951,7 +23261,13 @@ else
          ln -s conftest.tmp conftest.lnk
        fi
        if test "$cross_compiling" = yes; then :
-  gl_cv_func_stat_file_slash="guessing no"
+  case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_stat_file_slash="guessing no" ;;
+          esac
+
 else
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
   if test $REPLACE_LSTAT = 1; then
     func_gl_gnulib_m4code_stat
   fi
-  if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then
-    func_gl_gnulib_m4code_sigprocmask
-  fi
   if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
     func_gl_gnulib_m4code_stat
   fi
-  if test $ac_cv_func_strtoimax = no; then
-    func_gl_gnulib_m4code_verify
-  fi
-  if test $ac_cv_func_strtoimax = no && test $ac_cv_type_long_long_int = yes; then
+  if { test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes; then
     func_gl_gnulib_m4code_strtoll
   fi
-  if test $ac_cv_func_strtoumax = no; then
+  if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then
     func_gl_gnulib_m4code_verify
   fi
   if test $ac_cv_func_strtoumax = no && test $ac_cv_type_unsigned_long_long_int = yes; then
     func_gl_gnulib_m4code_strtoull
   fi
+  if test $ac_cv_func_strtoumax = no; then
+    func_gl_gnulib_m4code_verify
+  fi
 
    if $gl_gnulib_enabled_dosname; then
   gl_GNULIB_ENABLED_dosname_TRUE=
@@ -22201,14 +23514,6 @@ else
   gl_GNULIB_ENABLED_pathmax_FALSE=
 fi
 
-   if $gl_gnulib_enabled_sigprocmask; then
-  gl_GNULIB_ENABLED_sigprocmask_TRUE=
-  gl_GNULIB_ENABLED_sigprocmask_FALSE='#'
-else
-  gl_GNULIB_ENABLED_sigprocmask_TRUE='#'
-  gl_GNULIB_ENABLED_sigprocmask_FALSE=
-fi
-
    if $gl_gnulib_enabled_stat; then
   gl_GNULIB_ENABLED_stat_TRUE=
   gl_GNULIB_ENABLED_stat_FALSE='#'
@@ -22281,6 +23586,8 @@ fi
   LIBGNU_LTLIBDEPS="$gl_ltlibdeps"
 
 
+CFLAGS=$SAVE_CFLAGS
+LIBS=$SAVE_LIBS
 
 case "$opsys" in
   aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
@@ -22304,8 +23611,7 @@ case "$opsys" in
    ##   #ifndef LD_SWITCH_SYSTEM
    ##   #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
    ## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to:
-   ## not using gcc, darwin system not on an alpha (ie darwin, since
-   ## darwin + alpha does not occur).
+   ## not using gcc, darwin.
    ## Because this was done in src/Makefile.in, the resulting part of
    ## LD_SWITCH_SYSTEM was not used in configure (ie, in ac_link).
    ## It therefore seems cleaner to put this in LD_SWITCH_SYSTEM_TEMACS,
@@ -22314,13 +23620,14 @@ case "$opsys" in
      LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
    ;;
 
-  ## LD_SWITCH_X_SITE_AUX is a -R option saying where to find X at run-time.
-  ## When handled by cpp, this was in LD_SWITCH_SYSTEM.  However, at
-  ## the point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_AUX
+  ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
+  ## find X at run-time.
+  ## When handled by cpp, this was in LD_SWITCH_SYSTEM.  However, at the
+  ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
   ## had not yet been defined and was expanded to null.  Hence LD_SWITCH_SYSTEM
   ## had different values in configure (in ac_link) and src/Makefile.in.
   ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
-  gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_AUX_RPATH)" ;;
+  gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
 
   *) LD_SWITCH_SYSTEM_TEMACS= ;;
 esac
@@ -22344,12 +23651,12 @@ case "$opsys" in
   ## will also work on earlier NetBSD releases.
   netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
 
-  ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
+  ## powerpc*: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
   ##   MkLinux/LinuxPPC needs this.
-  ## ibms390x only supports opsys = gnu-linux so it can be added here.
+  ## s390x-* only supports opsys = gnu-linux so it can be added here.
   gnu-*)
-    case "$machine" in
-      macppc|ibms390x) LD_FIRSTFLAG="-nostdlib" ;;
+    case "$canonical" in
+      powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;;
     esac
     ;;
 esac
@@ -22363,7 +23670,7 @@ $as_echo "#define ORDINARY_LINK 1" >>confdefs.h
 
 
 ## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
-## freebsd, gnu-* not on macppc|ibms390x.
+## freebsd, gnu-* not on powerpc*|s390x*.
 elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
 
   ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
 #### It makes printing result more understandable as using GTK sets
 #### toolkit_scroll_bars to yes by default.
 if test "${HAVE_GTK}" = "yes"; then
-  USE_X_TOOLKIT=GTK
-fi
-
-and_machfile=
-if test -n "$machfile"; then
-  and_machfile=" and \`${machfile}'"
+  if test "${with_gtk3}" = "yes"; then
+    USE_X_TOOLKIT=GTK3
+  else
+    USE_X_TOOLKIT=GTK
+  fi
 fi
 
 echo "
 Configured for \`${canonical}'.
 
   Where should the build process find the source code?    ${srcdir}
-  What operating system and machine description files should Emacs use?
-        \`${opsysfile}'${and_machfile}
+  What operating system file should Emacs use?            ${opsysfile-none}
   What compiler should emacs be built with?               ${CC} ${CFLAGS}
   Should Emacs use the GNU version of malloc?             ${GNU_MALLOC}${GNU_MALLOC_reason}
   Should Emacs use a relocating allocator for buffers?    ${REL_ALLOC}
@@ -22497,11 +23802,6 @@ if test -n "${EMACSDOC}"; then
    echo "  Environment variable EMACSDOC set to:                   $EMACSDOC"
 fi
 
-if test $USE_XASSERTS = yes; then
-   echo "  Compiling with asserts turned on."
-   CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
-fi
-
 echo
 
 if test "$HAVE_NS" = "yes"; then
@@ -22519,6 +23819,14 @@ to run if these resources are not installed."
    echo
 fi
 
+if test "${opsys}" = "cygwin"; then
+  case `uname -r` in
+    1.5.*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: building Emacs on Cygwin 1.5 is not supported." >&5
+$as_echo "$as_me: WARNING: building Emacs on Cygwin 1.5 is not supported." >&2;}
+           echo
+          ;;
+  esac
+fi
 
 # Remove any trailing slashes in these variables.
 test "${prefix}" != NONE &&
@@ -22539,6 +23847,16 @@ if test -f $srcdir/${opt_makefile}.in; then
 
 fi
 
+
+opt_makefile=admin/unidata/Makefile
+
+if test -f $srcdir/${opt_makefile}.in; then
+  SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
+  ac_config_files="$ac_config_files admin/unidata/Makefile"
+
+fi
+
+
 SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
 
 
@@ -22665,7 +23983,6 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-
 if test -z "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then
   as_fn_error "conditional \"GL_COND_LIBTOOL\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -22679,6 +23996,10 @@ if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FAL
   as_fn_error "conditional \"GL_GENERATE_STDINT_H\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${GL_GENERATE_STDALIGN_H_TRUE}" && test -z "${GL_GENERATE_STDALIGN_H_FALSE}"; then
+  as_fn_error "conditional \"GL_GENERATE_STDALIGN_H\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${GL_GENERATE_STDARG_H_TRUE}" && test -z "${GL_GENERATE_STDARG_H_FALSE}"; then
   as_fn_error "conditional \"GL_GENERATE_STDARG_H\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -22703,10 +24024,6 @@ if test -z "${gl_GNULIB_ENABLED_pathmax_TRUE}" && test -z "${gl_GNULIB_ENABLED_p
   as_fn_error "conditional \"gl_GNULIB_ENABLED_pathmax\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
-if test -z "${gl_GNULIB_ENABLED_sigprocmask_TRUE}" && test -z "${gl_GNULIB_ENABLED_sigprocmask_FALSE}"; then
-  as_fn_error "conditional \"gl_GNULIB_ENABLED_sigprocmask\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
 if test -z "${gl_GNULIB_ENABLED_stat_TRUE}" && test -z "${gl_GNULIB_ENABLED_stat_FALSE}"; then
   as_fn_error "conditional \"gl_GNULIB_ENABLED_stat\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
@@ -23163,7 +24480,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by emacs $as_me 24.1, which was
+This file was extended by emacs $as_me 24.1.50, which was
 generated by GNU Autoconf 2.65.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -23229,7 +24546,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-emacs config.status 24.1
+emacs config.status 24.1.50
 configured by $0, generated by GNU Autoconf 2.65,
   with options \\"\$ac_cs_config\\"
 
@@ -23343,7 +24660,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 # INIT-COMMANDS
 #
 AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPPFLAGS="$CPPFLAGS"
+GCC="$GCC" CPPFLAGS="$CPPFLAGS"
 
 _ACEOF
 
@@ -23368,6 +24685,7 @@ do
     "lisp/Makefile") CONFIG_FILES="$CONFIG_FILES lisp/Makefile" ;;
     "leim/Makefile") CONFIG_FILES="$CONFIG_FILES leim/Makefile" ;;
     "test/automated/Makefile") CONFIG_FILES="$CONFIG_FILES test/automated/Makefile" ;;
+    "admin/unidata/Makefile") CONFIG_FILES="$CONFIG_FILES admin/unidata/Makefile" ;;
     "mkdirs") CONFIG_COMMANDS="$CONFIG_COMMANDS mkdirs" ;;
     "epaths") CONFIG_COMMANDS="$CONFIG_COMMANDS epaths" ;;
     "gdbinit") CONFIG_COMMANDS="$CONFIG_COMMANDS gdbinit" ;;
@@ -24142,4 +25460,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
 fi
 
-
index c9f04ad625355ae9b2f4312cd87a0511875eb432..b6af9b6eb35df72262e56d0b2e0303f59c67324e 100755 (executable)
@@ -3,7 +3,7 @@
 ## Helper script for those building Emacs from bzr without autoconf etc.
 ## This installs some pre-generated versions of the automatically
 ## generated files.  It is highly recommended to install the necessary
-## tools instead of using this.  Note that if eg configure.in
+## tools instead of using this.  Note that if eg configure.ac
 ## is updated, the next time you run make it will attempt to
 ## regenerate configure and will fail if you do not have the required
 ## tools.  You will have to run this script again.
index 58e3838f8c1258bbeed6ca24296f76d5dcef7dbc..14a4119087ea0005f95648e90b304b8fd6811038 100755 (executable)
@@ -79,7 +79,7 @@ lboot_flag=
 ## Parameters.
 ldefs_in=lisp/loaddefs.el
 ldefs_out=lisp/ldefs-boot.el
-sources="configure.in lib/Makefile.am"
+sources="configure.ac lib/Makefile.am"
 genfiles="
   configure aclocal.m4 src/config.in lib/Makefile.in
   build-aux/compile build-aux/config.guess build-aux/config.sub
index e7ba25e3127c458890bc5a900d44ed43931ff023..8cae2b392c68b027b88f44cdcb0570786724fccc 100755 (executable)
@@ -2,13 +2,13 @@
 # Like mv $1 $2, but if the files are the same, just delete $1.
 # Status is zero if successful, nonzero otherwise.
 
-VERSION='2011-01-28 20:09'; # UTC
+VERSION='2012-01-06 07:23'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,7 +32,7 @@ If SOURCE is different than DEST, then move it to DEST; else remove SOURCE.
   --help     display this help and exit
   --version  output version information and exit
 
-The variable CMPPROG can be used to specify an alternative to \`cmp'.
+The variable CMPPROG can be used to specify an alternative to 'cmp'.
 
 Report bugs to <bug-gnulib@gnu.org>."
 
index 1a7b4daed0a18e3939896b4953ef37243ad0e237..c44ad89b7c09315601bfb48467992f9fff797093 100644 (file)
@@ -1,4 +1,4 @@
-#ifndef _Noreturn
+#if !defined _Noreturn && __STDC_VERSION__ < 201112
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
index 6c2f1e82d066e3613b3da29969afd627c91a71f8..3a9dd2664eab4cda92fda7d2cc148350f85cc443 100644 (file)
@@ -1,5 +1,5 @@
 /* A C macro for declaring that specific arguments must not be NULL.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
index b6821a64ac45d476cd00882eeb6617ca8fe5960c..96da94b97b69693221c33607419d5f05db409baa 100644 (file)
@@ -1,5 +1,5 @@
 /* C++ compatible function declaration macros.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
index 2cdeec3e663bcbe2bbd746d4de53a97f9a02c076..d4cb94f35256e487e3327d25143c995e9c38aec2 100644 (file)
@@ -1,5 +1,5 @@
 /* A C macro for emitting warnings if a function is used.
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
similarity index 100%
rename from update-subdirs
rename to build-aux/update-subdirs
index cb664533e12d5bef988dbcec83d1c45c1116875f..4803ad899c1298c7436113550c2c615eb975dcbf 100644 (file)
@@ -283,11 +283,13 @@ If Exist alloca.in.h update alloca.in.h alloca.in-h
 If Exist getopt.in.h update getopt.in.h getopt.in-h\r
 If Exist stdbool.in.h update stdbool.in.h stdbool.in-h\r
 If Exist signal.in.h update signal.in.h signal.in-h\r
+If Exist stdalign.in.h update stdalign.in.h  stdalign.in-h\r
 If Exist stddef.in.h update stddef.in.h  stddef.in-h\r
 If Exist stdint.in.h update stdint.in.h  stdint.in-h\r
 If Exist stdio.in.h update stdio.in.h stdio.in-h\r
 If Exist stdlib.in.h update stdlib.in.h stdlib.in-h\r
 If Exist sys_stat.in.h update sys_stat.in.h sys_stat.in-h\r
+If Exist sys_types.in.h update sys_types.in.h sys_types.in-h\r
 If Exist time.in.h update time.in.h time.in-h\r
 If Exist unistd.in.h update unistd.in.h unistd.in-h\r
 If Exist Makefile.in sed -f ../msdos/sedlibcf.inp < Makefile.in > makefile.tmp\r
similarity index 71%
rename from configure.in
rename to configure.ac
index f9aef8195c69bd9d55309c01ab28d19b749da6e0..fba98513825e1704cf1948c789601b14bd83a74b 100644 (file)
@@ -4,7 +4,7 @@ dnl     autoconf
 dnl in the directory containing this script.
 dnl If you changed any AC_DEFINES, also run autoheader.
 dnl
-dnl Copyright (C) 1994-1996, 1999-2012  Free Software Foundation, Inc.
+dnl Copyright (C) 1994-1996, 1999-2012 Free Software Foundation, Inc.
 dnl
 dnl  This file is part of GNU Emacs.
 dnl
@@ -22,7 +22,7 @@ dnl  You should have received a copy of the GNU General Public License
 dnl  along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 AC_PREREQ(2.65)
-AC_INIT(emacs, 24.1)
+AC_INIT(emacs, 24.1.50)
 AC_CONFIG_HEADER(src/config.h:src/config.in)
 AC_CONFIG_SRCDIR(src/lisp.h)
 AC_CONFIG_AUX_DIR(build-aux)
@@ -37,9 +37,11 @@ dnl hence the single quotes.  This is per the GNU coding standards, see
 dnl (autoconf) Installation Directory Variables
 dnl See also epaths.h below.
 lispdir='${datadir}/emacs/${version}/lisp'
+leimdir='${datadir}/emacs/${version}/leim'
+standardlisppath='${lispdir}:${leimdir}'
 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
 '${datadir}/emacs/site-lisp'
-lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim'
+lisppath='${locallisppath}:${standardlisppath}'
 etcdir='${datadir}/emacs/${version}/etc'
 archlibdir='${libexecdir}/emacs/${version}/${configuration}'
 docdir='${datadir}/emacs/${version}/etc'
@@ -229,24 +231,6 @@ AC_ARG_ENABLE(ns-self-contained,
    EN_NS_SELF_CONTAINED=$enableval,
    EN_NS_SELF_CONTAINED=yes)
 
-AC_ARG_ENABLE(asserts,
-[AS_HELP_STRING([--enable-asserts], [compile code with asserts enabled])],
-      USE_XASSERTS=$enableval,
-      USE_XASSERTS=no)
-
-AC_ARG_ENABLE(maintainer-mode,
-[AS_HELP_STRING([--disable-maintainer-mode],
-                [disable make rules and dependencies not useful (and sometimes
-                confusing) to the casual installer])],
-      USE_MAINTAINER_MODE=$enableval,
-      USE_MAINTAINER_MODE=yes)
-if test $USE_MAINTAINER_MODE = yes; then
-  MAINT=
-else
-  MAINT=#
-fi
-AC_SUBST(MAINT)
-
 AC_ARG_ENABLE(locallisppath,
 [AS_HELP_STRING([--enable-locallisppath=PATH],
                 [directories Emacs should search for lisp files specific
@@ -263,7 +247,7 @@ AC_ARG_ENABLE(checking,
                 enable only specific categories of checks.
                 Categories are: all,yes,no.
                 Flags are: stringbytes, stringoverrun, stringfreelist,
-                xmallocoverrun, conslist])],
+                xmallocoverrun, conslist, glyphs])],
 [ac_checking_flags="${enableval}"],[])
 IFS="${IFS=    }"; ac_save_IFS="$IFS"; IFS="$IFS,"
 for check in $ac_checking_flags
@@ -276,19 +260,22 @@ do
                        ac_gc_check_string_overrun= ;
                        ac_gc_check_string_free_list= ;
                        ac_xmalloc_overrun= ;
-                       ac_gc_check_cons_list= ;;
+                       ac_gc_check_cons_list= ;
+                       ac_glyphs_debug= ;;
        all)            ac_enable_checking=1 ;
                        ac_gc_check_stringbytes=1 ;
                        ac_gc_check_string_overrun=1 ;
                        ac_gc_check_string_free_list=1 ;
                        ac_xmalloc_overrun=1 ;
-                       ac_gc_check_cons_list=1 ;;
+                       ac_gc_check_cons_list=1 ;
+                       ac_glyphs_debug=1 ;;
        # these enable particular checks
        stringbytes)    ac_gc_check_stringbytes=1 ;;
        stringoverrun)  ac_gc_check_string_overrun=1 ;;
        stringfreelist) ac_gc_check_string_free_list=1 ;;
        xmallocoverrun) ac_xmalloc_overrun=1 ;;
        conslist)       ac_gc_check_cons_list=1 ;;
+       glyphs)         ac_glyphs_debug=1 ;;
        *)      AC_MSG_ERROR(unknown check category $check) ;;
        esac
 done
@@ -296,7 +283,7 @@ IFS="$ac_save_IFS"
 
 if test x$ac_enable_checking != x ; then
   AC_DEFINE(ENABLE_CHECKING, 1,
-[Enable expensive run-time checking of data types?])
+[Define to 1 if expensive run-time data type and consistency checks are enabled.])
 fi
 if test x$ac_gc_check_stringbytes != x ; then
   AC_DEFINE(GC_CHECK_STRING_BYTES, 1,
@@ -320,14 +307,18 @@ if test x$ac_gc_check_cons_list != x ; then
   AC_DEFINE(GC_CHECK_CONS_LIST, 1,
 [Define this to check for errors in cons list.])
 fi
+if test x$ac_glyphs_debug != x ; then
+  AC_DEFINE(GLYPH_DEBUG, 1,
+[Define this to enable glyphs debugging code.])
+fi
 
-AC_ARG_ENABLE(use-lisp-union-type,
-[AS_HELP_STRING([--enable-use-lisp-union-type],
-                [use a union for the Lisp_Object data type.
-               This is only useful for development for catching certain types of bugs.])],
+AC_ARG_ENABLE(check-lisp-object-type,
+[AS_HELP_STRING([--enable-check-lisp-object-type],
+                [enable compile time checks for the Lisp_Object data type.
+               This is useful for development for catching certain types of bugs.])],
 if test "${enableval}" != "no"; then
-   AC_DEFINE(USE_LISP_UNION_TYPE, 1,
-   [Define this to use a lisp union for the Lisp_Object data type.])
+   AC_DEFINE(CHECK_LISP_OBJECT_TYPE, 1,
+   [Define this to enable compile time checks for the Lisp_Object data type.])
 fi)
 
 
@@ -374,8 +365,8 @@ case "${srcdir}" in
   *  ) srcdir="`(cd ${srcdir}; pwd)`" ;;
 esac
 
-#### Given the configuration name, set machfile and opsysfile to the
-#### names of the m/*.h and s/*.h files we should use.
+#### Given the configuration name, set opsysfile to the
+#### name of s/*.h file we should use.
 
 ### Canonicalize the configuration name.
 
@@ -395,13 +386,11 @@ dnl quotation begins
 
 ### If you add support for a new configuration, add code to this
 ### switch statement to recognize your configuration name and select
-### the appropriate operating system and machine description files.
+### the appropriate operating system file.
 
-### You would hope that you could choose an m/*.h file pretty much
-### based on the machine portion of the configuration name, and an s/*.h
+### You would hope that you could choose an s/*.h
 ### file based on the operating system portion.  However, it turns out
-### that each m/*.h file is pretty manufacturer-specific - for
-### example mips.h is MIPS
+### that each s/*.h file is pretty manufacturer-specific.
 ### So we basically have to have a special case for each
 ### configuration name.
 ###
@@ -411,95 +400,49 @@ dnl quotation begins
 ### prepared to handle anything reasonably.  If version numbers
 ### matter, be sure /etc/MACHINES says something about it.
 
-machine='' opsys='' unported=no
+opsys='' unported=no
 case "${canonical}" in
 
   ## GNU/Linux and similar ports
   *-*-linux* )
     opsys=gnu-linux
-    case ${canonical} in
-      alpha*)  machine=alpha ;;
-      s390x-*) machine=ibms390x ;;
-      powerpc*)        machine=macppc ;;
-      sparc*)  machine=sparc ;;
-      ia64*)   machine=ia64 ;;
-      m68k*)   machine=m68k ;;
-      x86_64*) machine=amdx86-64 ;;
-    esac
   ;;
 
   ## FreeBSD ports
   *-*-freebsd* )
     opsys=freebsd
-    case "${canonical}" in
-      alpha*)           machine=alpha ;;
-      amd64-*|x86_64-*) machine=amdx86-64 ;;
-      ia64-*)           machine=ia64 ;;
-      i[3456]86-*)      machine=intel386 ;;
-      powerpc-*)        machine=macppc ;;
-      sparc-*)          machine=sparc ;;
-      sparc64-*)        machine=sparc ;;
-    esac
   ;;
 
   ## FreeBSD kernel + glibc based userland
   *-*-kfreebsd*gnu* )
     opsys=gnu-kfreebsd
-    case "${canonical}" in
-      alpha*)           machine=alpha ;;
-      amd64-*|x86_64-*) machine=amdx86-64 ;;
-      ia64-*)           machine=ia64 ;;
-      i[3456]86-*)      machine=intel386 ;;
-      powerpc-*)        machine=macppc ;;
-      sparc-*)          machine=sparc ;;
-      sparc64-*)        machine=sparc ;;
-    esac
   ;;
 
   ## NetBSD ports
   *-*-netbsd* )
     opsys=netbsd
-    case "${canonical}" in
-      alpha*)      machine=alpha ;;
-      x86_64-*)    machine=amdx86-64 ;;
-      i[3456]86-*) machine=intel386 ;;
-      m68k-*)      machine=m68k ;;
-      powerpc-*)   machine=macppc ;;
-      sparc*-)     machine=sparc ;;
-      vax-*)       machine=vax ;;
-    esac
   ;;
 
   ## OpenBSD ports
   *-*-openbsd* )
     opsys=openbsd
-    case "${canonical}" in
-      alpha*)    machine=alpha ;;
-      x86_64-*)  machine=amdx86-64 ;;
-      i386-*)    machine=intel386 ;;
-      powerpc-*) machine=macppc ;;
-      sparc*)    machine=sparc ;;
-      vax-*)     machine=vax ;;
-    esac
   ;;
 
   ## Apple Darwin / Mac OS X
   *-apple-darwin* )
     case "${canonical}" in
-      i[3456]86-* )  machine=intel386 ;;
-      powerpc-* )    machine=macppc ;;
-      x86_64-* )     machine=amdx86-64 ;;
+      i[3456]86-* )  ;;
+      powerpc-* )    ;;
+      x86_64-* )     ;;
       * )            unported=yes ;;
     esac
     opsys=darwin
-    # Define CPP as follows to make autoconf work correctly.
-    CPP="${CC-cc} -E -no-cpp-precomp"
-    # Use fink packages if available.
-    if test -d /sw/include && test -d /sw/lib; then
-      GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
-      CPP="${CPP} ${GCC_TEST_OPTIONS}"
-      NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
-    fi
+    ## Use fink packages if available.
+    ## FIXME find a better way to do this: http://debbugs.gnu.org/11507
+##    if test -d /sw/include && test -d /sw/lib; then
+##      GCC_TEST_OPTIONS="-I/sw/include -L/sw/lib"
+##      NON_GCC_TEST_OPTIONS=${GCC_TEST_OPTIONS}
+##    fi
   ;;
 
   ## HP 9000 series 700 and 800, running HP/UX
@@ -513,16 +456,16 @@ case "${canonical}" in
 
   ## IBM machines
   rs6000-ibm-aix4.[23]* )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
   powerpc-ibm-aix4.[23]*  )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
   rs6000-ibm-aix[56]* )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
   powerpc-ibm-aix[56]*  )
-    machine=ibmrs6000 opsys=aix4-2
+    opsys=aix4-2
   ;;
 
   ## Silicon Graphics machines
@@ -532,7 +475,6 @@ case "${canonical}" in
     # Without defining _LANGUAGE_C, things get masked out in the headers
     # so that, for instance, grepping for `free' in stdlib.h fails and
     # AC_HEADER_STD_C fails.   (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m).
-    NON_GNU_CPP="/lib/cpp -D_LANGUAGE_C"
     NON_GCC_TEST_OPTIONS="-D_LANGUAGE_C"
   ;;
 
@@ -541,26 +483,23 @@ case "${canonical}" in
     | i[3456]86-*-solaris2* | i[3456]86-*-sunos5* \
     | x86_64-*-solaris2*    | x86_64-*-sunos5*)
     case "${canonical}" in
-      i[3456]86-*-* )     machine=intel386 ;;
-      amd64-*-*|x86_64-*-*)    machine=amdx86-64 ;;
-      sparc* )         machine=sparc ;;
+      i[3456]86-*-* )   ;;
+      amd64-*-*|x86_64-*-*) ;;
+      sparc* )         ;;
       * )              unported=yes ;;
     esac
     case "${canonical}" in
       *-sunos5.6* | *-solaris2.6* )
                opsys=sol2-6
-               NON_GNU_CPP=/usr/ccs/lib/cpp
                RANLIB="ar -ts"
                ;;
       *-sunos5.[7-9]* | *-solaris2.[7-9]* )
                opsys=sol2-6
                emacs_check_sunpro_c=yes
-               NON_GNU_CPP=/usr/ccs/lib/cpp
                ;;
       *-sunos5* | *-solaris* )
                opsys=sol2-10
                emacs_check_sunpro_c=yes
-               NON_GNU_CPP=/usr/ccs/lib/cpp
                ;;
     esac
     ## Watch out for a compiler that we know will not work.
@@ -578,15 +517,12 @@ case "${canonical}" in
 
   ## Intel 386 machines where we don't care about the manufacturer.
   i[3456]86-*-* )
-    machine=intel386
     case "${canonical}" in
       *-cygwin )                opsys=cygwin ;;
-      *-darwin* )               opsys=darwin
-                                CPP="${CC-cc} -E -no-cpp-precomp"
-                               ;;
-      *-sysv4.2uw* )           opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
-      *-sysv5uw* )             opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
-      *-sysv5OpenUNIX* )       opsys=unixware; NON_GNU_CPP=/lib/cpp ;;
+      *-darwin* )               opsys=darwin ;;
+      *-sysv4.2uw* )           opsys=unixware ;;
+      *-sysv5uw* )             opsys=unixware ;;
+      *-sysv5OpenUNIX* )       opsys=unixware ;;
       ## Otherwise, we'll fall through to the generic opsys code at the bottom.
     esac
   ;;
@@ -619,152 +555,195 @@ if test $unported = yes; then
 Check `etc/MACHINES' for recognized configuration names.])
 fi
 
-if test -n "$machine"; then
-  machfile="m/${machine}.h"
-else
-  machfile=
-fi
 opsysfile="s/${opsys}.h"
 
 
 #### Choose a compiler.
-test -n "$CC" && cc_specified=yes
-
-# Save the value of CFLAGS that the user specified.
-SPECIFIED_CFLAGS="$CFLAGS"
 
 dnl Sets GCC=yes if using gcc.
 AC_PROG_CC
 AM_PROG_CC_C_O
 
-# Initialize gnulib right after verifying that the C compiler works.
+if test x$GCC = xyes; then
+  test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
+else
+  test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
+fi
+
+# Initialize gnulib right after choosing the compiler.
 gl_EARLY
 
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
+AC_ARG_ENABLE([gcc-warnings],
+  [AS_HELP_STRING([--enable-gcc-warnings],
+                  [turn on lots of GCC warnings. This is intended for
+                  developers, and may generate false alarms when used
+                  with older or non-GNU development tools.])],
+  [case $enableval in
+     yes|no) ;;
+     *)      AC_MSG_ERROR([bad value $enableval for gcc-warnings option]) ;;
+   esac
+   gl_gcc_warnings=$enableval],
+  [gl_gcc_warnings=no]
+)
+
+AC_ARG_ENABLE(link-time-optimization,
+[AS_HELP_STRING([--enable-link-time-optimization],
+                [build emacs with link-time optimization.
+                 This is supported only for GCC since 4.5.0.])],
+if test "${enableval}" != "no"; then
+   AC_MSG_CHECKING([whether link-time optimization is supported])
+   ac_lto_supported=no
+   if test x$GCC = xyes; then
+      CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
+      if test x$CPUS != x; then
+        LTO="-flto=$CPUS"
+      else
+        LTO="-flto"
+      fi
+      old_CFLAGS=$CFLAGS
+      CFLAGS="$CFLAGS $LTO"
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
+       [ac_lto_supported=yes], [ac_lto_supported=no])
+      CFLAGS="$old_CFLAGS"
+   fi
+   AC_MSG_RESULT([$ac_lto_supported])
+   if test "$ac_lto_supported" = "yes"; then
+      CFLAGS="$CFLAGS $LTO"
+   fi
+fi)
 
-## If not using gcc, and on Solaris, and no CPP specified, see if
-## using a Sun compiler, which needs -Xs to prevent whitespace.
-if test x"$GCC" != xyes && test x"$emacs_check_sunpro_c" = xyes && \
- test x"$CPP" = x; then
-  AC_MSG_CHECKING([whether we are using a Sun C compiler])
-  AC_CACHE_VAL(emacs_cv_sunpro_c,
-  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
-[[#ifndef __SUNPRO_C
-fail;
+# gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found])
+# ------------------------------------------------
+# If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND.
+# Otherwise, run RUN-IF-NOT-FOUND.
+AC_DEFUN([gl_GCC_VERSION_IFELSE],
+  [AC_PREPROC_IFELSE(
+    [AC_LANG_PROGRAM(
+      [[
+#if ($1) < __GNUC__ || (($1) == __GNUC__ && ($2) <= __GNUC_MINOR__)
+/* ok */
+#else
+# error "your version of gcc is older than $1.$2"
 #endif
-]])], emacs_cv_sunpro_c=yes, emacs_cv_sunpro_c=no)])
-  AC_MSG_RESULT($emacs_cv_sunpro_c)
+      ]]),
+    ], [$3], [$4])
+  ]
+)
+
+# When compiling with GCC, prefer -isystem to -I when including system
+# include files, to avoid generating useless diagnostics for the files.
+if test "$gl_gcc_warnings" != yes; then
+  isystem='-I'
+else
+  isystem='-isystem '
+
+  # This, $nw, is the list of warnings we disable.
+  nw=
+
+  case $with_x_toolkit in
+    lucid | athena | motif)
+       # Old toolkits mishandle 'const'.
+       nw="$nw -Wwrite-strings"
+       ;;
+    *)
+       gl_WARN_ADD([-Werror], [WERROR_CFLAGS])
+       ;;
+  esac
+  AC_SUBST([WERROR_CFLAGS])
+
+  nw="$nw -Waggregate-return"       # anachronistic
+  nw="$nw -Wlong-long"              # C90 is anachronistic
+  nw="$nw -Wc++-compat"             # We don't care about C++ compilers
+  nw="$nw -Wundef"                  # Warns on '#if GNULIB_FOO' etc in gnulib
+  nw="$nw -Wtraditional"            # Warns on #elif which we use often
+  nw="$nw -Wcast-qual"              # Too many warnings for now
+  nw="$nw -Wconversion"             # Too many warnings for now
+  nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
+  nw="$nw -Wsign-conversion"        # Too many warnings for now
+  nw="$nw -Woverlength-strings"     # Not a problem these days
+  nw="$nw -Wtraditional-conversion" # Too many warnings for now
+  nw="$nw -Wunreachable-code"       # so buggy that it's now silently ignored
+  nw="$nw -Wpadded"                 # Our structs are not padded
+  nw="$nw -Wredundant-decls"        # we regularly (re)declare functions
+  nw="$nw -Wlogical-op"             # any use of fwrite provokes this
+  nw="$nw -Wformat-nonliteral"      # we do this a lot
+  nw="$nw -Wvla"                    # warnings in gettext.h
+  nw="$nw -Wnested-externs"         # use of XARGMATCH/verify_function__
+  nw="$nw -Wswitch-enum"            # Too many warnings for now
+  nw="$nw -Wswitch-default"         # Too many warnings for now
+  nw="$nw -Wfloat-equal"            # warns about high-quality code
+  nw="$nw -Winline"                 # OK to ignore 'inline'
+  nw="$nw -Wsync-nand"              # irrelevant here, and provokes ObjC warning
+  nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations
+
+  # Emacs doesn't care about shadowing; see
+  # <http://lists.gnu.org/archive/html/emacs-diffs/2011-11/msg00265.html>.
+  nw="$nw -Wshadow"
+
+  # The following lines should be removable at some point.
+  nw="$nw -Wstack-protector"
+  nw="$nw -Wstrict-overflow"
+  nw="$nw -Wsuggest-attribute=pure"
+
+  gl_MANYWARN_ALL_GCC([ws])
+  gl_MANYWARN_COMPLEMENT([ws], [$ws], [$nw])
+  for w in $ws; do
+    gl_WARN_ADD([$w])
+  done
+  gl_WARN_ADD([-Wno-missing-field-initializers]) # We need this one
+  gl_WARN_ADD([-Wno-sign-compare])     # Too many warnings for now
+  gl_WARN_ADD([-Wno-type-limits])      # Too many warnings for now
+  gl_WARN_ADD([-Wno-switch])           # Too many warnings for now
+  gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now
+  gl_WARN_ADD([-Wno-format-nonliteral])
 
-  if test x"$emacs_cv_sunpro_c" = xyes; then
-    NON_GNU_CPP="$CC -E -Xs"
-  fi
-fi
+  # In spite of excluding -Wlogical-op above, it is enabled, as of
+  # gcc 4.5.0 20090517.
+  gl_WARN_ADD([-Wno-logical-op])
 
-#### Some systems specify a CPP to use unless we are using GCC.
-#### Now that we know whether we are using GCC, we can decide whether
-#### to use that one.
-if test "x$NON_GNU_CPP" != x && test x$GCC != xyes && test "x$CPP" = x
-then
-  CPP="$NON_GNU_CPP"
-fi
+  gl_WARN_ADD([-fdiagnostics-show-option])
+  gl_WARN_ADD([-funit-at-a-time])
 
-#### Some systems specify a CC to use unless we are using GCC.
-#### Now that we know whether we are using GCC, we can decide whether
-#### to use that one.
-if test "x$NON_GNU_CC" != x && test x$GCC != xyes &&
-  test x$cc_specified != xyes
-then
-  CC="$NON_GNU_CC"
-fi
+  AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.])
+  AC_DEFINE([_FORTIFY_SOURCE], [2],
+    [enable compile-time and run-time bounds-checking, and some warnings])
+  AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
 
-if test x$GCC = xyes; then
-  test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
-else
-  test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
+  # We use a slightly smaller set of warning options for lib/.
+  # Remove the following and save the result in GNULIB_WARN_CFLAGS.
+  nw=
+  nw="$nw -Wunused-macros"
+
+  gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
+  AC_SUBST([GNULIB_WARN_CFLAGS])
 fi
 
-### Use -Wdeclaration-after-statement if the compiler supports it
-AC_MSG_CHECKING([whether gcc understands -Wdeclaration-after-statement])
-SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wdeclaration-after-statement"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], has_option=yes, has_option=no)
-if test $has_option = yes; then
-   C_WARNINGS_SWITCH="-Wdeclaration-after-statement $C_WARNINGS_SWITCH"
-fi
-AC_MSG_RESULT($has_option)
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
-
-### Use -Wold-style-definition if the compiler supports it
-# This can be removed when conversion to standard C is finished.
-AC_MSG_CHECKING([whether gcc understands -Wold-style-definition])
-SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wold-style-definition"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], has_option=yes, has_option=no)
-if test $has_option = yes; then
-   C_WARNINGS_SWITCH="-Wold-style-definition $C_WARNINGS_SWITCH"
-fi
-AC_MSG_RESULT($has_option)
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
-
-### Use -Wimplicit-function-declaration if the compiler supports it
-AC_MSG_CHECKING([whether gcc understands -Wimplicit-function-declaration])
-SAVE_CFLAGS="$CFLAGS"
-CFLAGS="$CFLAGS -Wimplicit-function-declaration"
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])], has_option=yes, has_option=no)
-if test $has_option = yes; then
-   C_WARNINGS_SWITCH="-Wimplicit-function-declaration $C_WARNINGS_SWITCH"
-fi
-AC_MSG_RESULT($has_option)
-CFLAGS="$SAVE_CFLAGS"
-unset has_option
-unset SAVE_CFLAGS
-
-AC_SUBST(C_WARNINGS_SWITCH)
-
-
-#### Some other nice autoconf tests.
-
-dnl checks for programs
-AC_PROG_CPP
-AC_PROG_INSTALL
-if test "x$RANLIB" = x; then
-  AC_PROG_RANLIB
-fi
-
-## Although we're running on an amd64 kernel, we're actually compiling for
-## the x86 architecture.  The user should probably have provided an
-## explicit --build to `configure', but if everything else than the kernel
-## is running in i386 mode, we can help them out.
-if test "$machine" = "amdx86-64"; then
-  AC_CHECK_DECL([i386])
-  if test "$ac_cv_have_decl_i386" = "yes"; then
-    canonical=`echo "$canonical" | sed -e 's/^amd64/i386/' -e 's/^x86_64/i386/'`
-    machine=intel386
-    machfile="m/${machine}.h"
-  fi
-  AC_CHECK_DECL([__ILP32__], [machfile="m/intel386.h"])
-fi
-
-AC_PATH_PROG(INSTALL_INFO, install-info)
-AC_PATH_PROG(INSTALL_INFO, install-info,, /usr/sbin)
-AC_PATH_PROG(INSTALL_INFO, install-info,:, /sbin)
+
+
+dnl Some other nice autoconf tests.
+dnl These are commented out, since gl_EARLY and/or Autoconf already does them.
+dnl AC_PROG_INSTALL
+dnl AC_PROG_MKDIR_P
+dnl if test "x$RANLIB" = x; then
+dnl   AC_PROG_RANLIB
+dnl fi
+
+AC_PATH_PROG(INSTALL_INFO, install-info, :,
+  $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)
 dnl Don't use GZIP, which is used by gzip for additional parameters.
 AC_PATH_PROG(GZIP_PROG, gzip)
 
+if test $opsys = gnu-linux; then
+  AC_PATH_PROG(PAXCTL, paxctl,,
+    [$PATH$PATH_SEPARATOR/sbin$PATH_SEPARATOR/usr/sbin])
+fi
 
-## Need makeinfo >= 4.6 (?) to build the manuals.
+## Need makeinfo >= 4.7 (?) to build the manuals.
 AC_PATH_PROG(MAKEINFO, makeinfo, no)
 dnl By this stage, configure has already checked for egrep and set EGREP,
 dnl or exited with an error if no egrep was found.
 if test "$MAKEINFO" != "no" && \
-  test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[6-9]]|4\.[[1-5]][[0-9]]+)'`" = x; then
+  test x"`$MAKEINFO --version 2> /dev/null | $EGREP 'texinfo[[^0-9]]*([[1-4]][[0-9]]+|[[5-9]]|4\.[[7-9]]|4\.[[1-6]][[0-9]]+)'`" = x; then
    MAKEINFO=no
 fi
 
@@ -784,7 +763,7 @@ if test "$MAKEINFO" = "no"; then
   if test "x${with_makeinfo}" = "xno"; then
     HAVE_MAKEINFO=no
   elif test ! -e $srcdir/info/emacs; then
-    AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.6, and your
+    AC_MSG_ERROR( [You do not seem to have makeinfo >= 4.7, and your
 source tree does not seem to have pre-built manuals in the `info' directory.
 Either install a suitable version of makeinfo, or re-run configure
 with the `--without-makeinfo' option to build without the manuals.] )
@@ -792,6 +771,12 @@ with the `--without-makeinfo' option to build without the manuals.] )
 fi
 AC_SUBST(HAVE_MAKEINFO)
 
+dnl Just so that there is only a single place we need to edit.
+INFO_EXT=.info
+INFO_OPTS=--no-split
+AC_SUBST(INFO_EXT)
+AC_SUBST(INFO_OPTS)
+
 dnl Add our options to ac_link now, after it is set up.
 
 if test x$GCC = xyes; then
@@ -822,11 +807,6 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
   [AC_MSG_RESULT(no)])
 
 
-# The value of CPP is a quoted variable reference, so we need to do this
-# to get its actual value...
-CPP=`eval "echo $CPP"`
-
-
 dnl The function dump-emacs will not be defined and temacs will do
 dnl (load "loadup") automatically unless told otherwise.
 test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
@@ -878,7 +858,9 @@ case "$opsys" in
    ## Let `ld' find image libs and similar things in /usr/local/lib.
    ## The system compiler, GCC, has apparently been modified to not
    ## look there, contrary to what a stock GCC would do.
-   LD_SWITCH_SYSTEM=-L/usr/local/lib
+### It's not our place to do this.  See bug#10313#17.
+###   LD_SWITCH_SYSTEM=-L/usr/local/lib
+      :
    ;;
 
   gnu-linux)
@@ -887,7 +869,9 @@ case "$opsys" in
    ;;
 
   netbsd)
-   LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+### It's not our place to do this.  See bug#10313#17.
+###   LD_SWITCH_SYSTEM="-Wl,-rpath,/usr/pkg/lib -L/usr/pkg/lib -Wl,-rpath,/usr/local/lib -L/usr/local/lib"
+      :
    ;;
 
   openbsd)
@@ -900,7 +884,7 @@ AC_SUBST(LD_SWITCH_SYSTEM)
 
 ac_link="$ac_link $LD_SWITCH_SYSTEM"
 
-## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_AUX,
+## This setting of LD_SWITCH_SYSTEM references LD_SWITCH_X_SITE_RPATH,
 ## which has not been defined yet.  When this was handled with cpp,
 ## it was expanded to null when configure sourced the s/*.h file.
 ## Thus LD_SWITCH_SYSTEM had different values in configure and the Makefiles.
@@ -912,13 +896,13 @@ ac_link="$ac_link $LD_SWITCH_SYSTEM"
 ## LD_SWITCH_SYSTEM_TEMACS.
 case "$opsys" in
   netbsd|openbsd)
-   ## _AUX_RPATH is like _AUX, but uses -rpath instead of -R.
-   LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_AUX_RPATH) $LD_SWITCH_SYSTEM" ;;
+   LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
 esac
 
 
 C_SWITCH_MACHINE=
-if test "$machine" = "alpha"; then
+case $canonical in
+ alpha*)
   AC_CHECK_DECL([__ELF__])
   if test "$ac_cv_have_decl___ELF__" = "yes"; then
     ## With ELF, make sure that all common symbols get allocated to in the
@@ -934,7 +918,8 @@ if test "$machine" = "alpha"; then
   else
     UNEXEC_OBJ=unexalpha.o
   fi
-fi
+  ;;
+esac
 AC_SUBST(C_SWITCH_MACHINE)
 
 AC_SUBST(UNEXEC_OBJ)
@@ -980,13 +965,15 @@ AC_DEFUN([AC_TYPE_SIZE_T])
 # Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them.
 AC_DEFUN([AC_TYPE_UID_T])
 
-dnl Do this early because it can frob feature test macros for Unix-98 &c.
-AC_SYS_LARGEFILE
-
 
 LIB_MATH=-lm
 LIB_STANDARD=
 START_FILES=
+dnl Current possibilities handled by sed (aix4-2 -> aix,
+dnl gnu-linux -> gnu/linux, etc.):
+dnl gnu, gnu/linux, gnu/kfreebsd, aix, cygwin, darwin, hpux, irix.
+dnl And special cases: berkeley-unix, usg-unix-v, ms-dos, windows-nt.
+SYSTEM_TYPE=`echo $opsys | sed -e 's/[[0-9]].*//' -e 's|-|/|'`
 
 dnl NB do not use CRT_DIR unquoted here, since it might not be set yet.
 case $opsys in
@@ -1002,6 +989,7 @@ case $opsys in
   freebsd )
     LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o $(CRT_DIR)/crtn.o'
     START_FILES='pre-crt0.o $(CRT_DIR)/crt1.o $(CRT_DIR)/crti.o $(CRT_DIR)/crtbegin.o'
+    SYSTEM_TYPE=berkeley-unix
     ;;
   gnu-linux | gnu-kfreebsd )
     LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtn.o'
@@ -1015,11 +1003,19 @@ case $opsys in
   netbsd | openbsd )
     LIB_STANDARD='-lgcc -lc -lgcc $(CRT_DIR)/crtend.o'
     START_FILES='pre-crt0.o $(CRT_DIR)/crt0.o $(CRT_DIR)/crtbegin.o'
+    SYSTEM_TYPE=berkeley-unix
     ;;
+
+  sol2* | unixware )
+    SYSTEM_TYPE=usg-unix-v
+    ;;
+
 esac
 
 AC_SUBST(LIB_MATH)
 AC_SUBST(START_FILES)
+AC_DEFINE_UNQUOTED(SYSTEM_TYPE, "$SYSTEM_TYPE",
+  [The type of system you are compiling for; sets `system-type'.])
 
 dnl Not all platforms use crtn.o files.  Check if the current one does.
 crt_files=
@@ -1108,6 +1104,11 @@ case $opsys in
 esac
 
 
+pre_PKG_CONFIG_CFLAGS=$CFLAGS
+pre_PKG_CONFIG_LIBS=$LIBS
+
+AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+
 dnl This function definition taken from Gnome 2.0
 dnl PKG_CHECK_MODULES(GSTUFF, gtk+-2.0 >= 1.3 glib = 1.3.4, action-if, action-not)
 dnl defines GSTUFF_LIBS, GSTUFF_CFLAGS, see pkg-config man page
@@ -1115,8 +1116,6 @@ dnl also defines GSTUFF_PKG_ERRORS on error
 AC_DEFUN([PKG_CHECK_MODULES], [
   succeeded=no
 
-  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-
   if test "$PKG_CONFIG" = "no" ; then
      ifelse([$4], , [AC_MSG_ERROR([
       *** The pkg-config script could not be found. Make sure it is in your path, or give the full path to pkg-config with the PKG_CONFIG environment variable or --with-pkg-config-prog.  Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config.])], [$4])
@@ -1125,17 +1124,19 @@ AC_DEFUN([PKG_CHECK_MODULES], [
      if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then
         AC_MSG_CHECKING(for $2)
 
-        if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD; then
-            AC_MSG_RESULT(yes)
+        if $PKG_CONFIG --exists "$2" 2>&AS_MESSAGE_LOG_FD &&
+          $1_CFLAGS=`$PKG_CONFIG --cflags "$2" 2>&AS_MESSAGE_LOG_FD` &&
+          $1_LIBS=`$PKG_CONFIG --libs "$2" 2>&AS_MESSAGE_LOG_FD`; then
+           edit_cflags="
+             s,///*,/,g
+             s/^/ /
+             s/ -I/ $isystem/g
+             s/^ //
+           "
+           $1_CFLAGS=`AS_ECHO(["$$1_CFLAGS"]) | sed -e "$edit_cflags"`
+           $1_LIBS=`AS_ECHO(["$$1_LIBS"]) | sed -e 's,///*,/,g'`
+            AC_MSG_RESULT([yes CFLAGS='$$1_CFLAGS' LIBS='$$1_LIBS'])
             succeeded=yes
-
-            AC_MSG_CHECKING($1_CFLAGS)
-            $1_CFLAGS=`$PKG_CONFIG --cflags "$2"|sed -e 's,///*,/,g'`
-            AC_MSG_RESULT($$1_CFLAGS)
-
-            AC_MSG_CHECKING($1_LIBS)
-            $1_LIBS=`$PKG_CONFIG --libs "$2"|sed -e 's,///*,/,g'`
-            AC_MSG_RESULT($$1_LIBS)
         else
             AC_MSG_RESULT(no)
             $1_CFLAGS=""
@@ -1215,10 +1216,10 @@ if test "${with_sound}" != "no"; then
 fi
 
 dnl checks for header files
-AC_CHECK_HEADERS(sys/select.h sys/time.h unistd.h utime.h \
-  linux/version.h sys/systeminfo.h \
-  stdio_ext.h fcntl.h coff.h pty.h sys/mman.h \
-  sys/vlimit.h sys/resource.h locale.h sys/_mbstate_t.h \
+AC_CHECK_HEADERS_ONCE(
+  linux/version.h sys/systeminfo.h
+  stdio_ext.h fcntl.h coff.h pty.h
+  sys/vlimit.h sys/resource.h
   sys/utsname.h pwd.h utmp.h dirent.h util.h)
 
 AC_MSG_CHECKING(if personality LINUX32 can be set)
@@ -1247,26 +1248,6 @@ if test $ac_cv_have_decl_sys_siglist != yes; then
 fi
 AC_HEADER_SYS_WAIT
 
-dnl Some systems have utime.h but don't declare the struct anyplace.
-AC_CACHE_CHECK(for struct utimbuf, emacs_cv_struct_utimbuf,
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif]], [[static struct utimbuf x; x.actime = x.modtime;]])],
-  emacs_cv_struct_utimbuf=yes, emacs_cv_struct_utimbuf=no))
-if test $emacs_cv_struct_utimbuf = yes; then
-  AC_DEFINE(HAVE_STRUCT_UTIMBUF, 1, [Define to 1 if `struct utimbuf' is declared by <utime.h>.])
-fi
-
 dnl Check for speed_t typedef.
 AC_CACHE_CHECK(for speed_t, emacs_cv_speed_t,
   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <termios.h>]], [[speed_t x = 1;]])],
@@ -1276,33 +1257,18 @@ if test $emacs_cv_speed_t = yes; then
           [Define to 1 if `speed_t' is declared by <termios.h>.])
 fi
 
-AC_CACHE_CHECK(for struct timeval, emacs_cv_struct_timeval,
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif]], [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
-  emacs_cv_struct_timeval=yes, emacs_cv_struct_timeval=no))
-HAVE_TIMEVAL=$emacs_cv_struct_timeval
-if test $emacs_cv_struct_timeval = yes; then
-  AC_DEFINE(HAVE_TIMEVAL, 1, [Define to 1 if `struct timeval' is declared by <sys/time.h>.])
-fi
-
 AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception,
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <math.h>]],
 [[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;]])],
   emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no))
 HAVE_EXCEPTION=$emacs_cv_struct_exception
-if test $emacs_cv_struct_exception != yes; then
+dnl Define on Darwin so emacs symbols will not conflict with those
+dnl in the System framework.  Otherwise -prebind will not work.
+if test $emacs_cv_struct_exception != yes || test $opsys = darwin; then
   AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.])
 fi
 
-AC_CHECK_HEADERS(sys/socket.h)
+AC_CHECK_HEADERS_ONCE(sys/socket.h)
 AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
@@ -1315,7 +1281,6 @@ AC_CHECK_HEADERS(net/if_dl.h, , , [AC_INCLUDES_DEFAULT
 #if HAVE_SYS_SOCKET_H
 #include <sys/socket.h>
 #endif])
-AC_CHECK_FUNCS(getifaddrs freeifaddrs)
 
 dnl checks for structure members
 AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
@@ -1330,29 +1295,8 @@ AC_CHECK_MEMBERS([struct ifreq.ifr_flags, struct ifreq.ifr_hwaddr,
 #include <net/if.h>
 #endif])
 
-dnl checks for compiler characteristics
-
-dnl Testing __STDC__ to determine prototype support isn't good enough.
-dnl DEC C, for instance, doesn't define it with default options, and
-dnl is used on 64-bit systems (OSF Alphas).  Similarly for volatile
-dnl and void *.
-AC_C_PROTOTYPES
-AC_C_VOLATILE
-AC_C_CONST
-AC_CACHE_CHECK([for void * support], emacs_cv_void_star,
-  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[void * foo;]])],
-                   emacs_cv_void_star=yes, emacs_cv_void_star=no)])
-if test $emacs_cv_void_star = yes; then
-  AC_DEFINE(POINTER_TYPE, void)
-else
-  AC_DEFINE(POINTER_TYPE, char)
-fi
-AH_TEMPLATE(POINTER_TYPE,
-           [Define as `void' if your compiler accepts `void *'; otherwise
-            define as `char'.])dnl
-
 dnl Check for endianness.
-AC_C_BIGENDIAN
+dnl AC_C_BIGENDIAN is done by gnulib.
 
 AC_CACHE_CHECK([for  __attribute__ ((__aligned__ (expr)))],
   [emacs_cv_attribute_aligned],
@@ -1368,7 +1312,7 @@ if test $emacs_cv_attribute_aligned = yes; then
 fi
 
 dnl check for Make feature
-AC_PROG_MAKE_SET
+dnl AC_PROG_MAKE_SET is done by Automake.
 
 DEPFLAGS=
 MKDEPDIR=":"
@@ -1396,10 +1340,8 @@ if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
    fi
    if test $ac_enable_autodepend = yes; then
       DEPFLAGS='-MMD -MF ${DEPDIR}/$*.d -MP'
-      ## In parallel builds, another make might create depdir between
-      ## the first test and mkdir, so stick another test on the end.
-      ## Or use install-sh -d?  mkdir -p is not portable.
-      MKDEPDIR='test -d ${DEPDIR} || mkdir ${DEPDIR} || test -d ${DEPDIR}'
+      ## MKDIR_P is documented (see AC_PROG_MKDIR_P) to be parallel-safe.
+      MKDEPDIR='${MKDIR_P} ${DEPDIR}'
       deps_frag=autodeps.mk
    fi
 fi
@@ -1425,22 +1367,11 @@ else
   window_system=x11
 fi
 
-## Workaround for bug in autoconf <= 2.62.
-## http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01551.html
-## No need to do anything special for these standard directories.
-if test -n "${x_libraries}" && test x"${x_libraries}" != xNONE; then
-
-   x_libraries=`echo :${x_libraries}: | sed -e 's|:/usr/lib64:|:|g' -e 's|:/lib64:|:|g' -e 's|^:||' -e 's|:$||'`
-
-fi
-
-LD_SWITCH_X_SITE_AUX=
-LD_SWITCH_X_SITE_AUX_RPATH=
+LD_SWITCH_X_SITE_RPATH=
 if test "${x_libraries}" != NONE; then
   if test -n "${x_libraries}"; then
     LD_SWITCH_X_SITE=-L`echo ${x_libraries} | sed -e "s/:/ -L/g"`
-    LD_SWITCH_X_SITE_AUX=-R`echo ${x_libraries} | sed -e "s/:/ -R/g"`
-    LD_SWITCH_X_SITE_AUX_RPATH=`echo ${LD_SWITCH_X_SITE_AUX} | sed -e 's/-R/-Wl,-rpath,/'`
+    LD_SWITCH_X_SITE_RPATH=-Wl,-rpath,`echo ${x_libraries} | sed -e "s/:/ -Wl,-rpath,/g"`
   fi
   x_default_search_path=""
   x_search_path=${x_libraries}
@@ -1463,11 +1394,10 @@ ${x_library}/X11/%T/%N%S"
     fi
   done
 fi
-AC_SUBST(LD_SWITCH_X_SITE_AUX)
-AC_SUBST(LD_SWITCH_X_SITE_AUX_RPATH)
+AC_SUBST(LD_SWITCH_X_SITE_RPATH)
 
 if test "${x_includes}" != NONE && test -n "${x_includes}"; then
-  C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"`
+  C_SWITCH_X_SITE="$isystem"`echo ${x_includes} | sed -e "s/:/ $isystem/g"`
 fi
 
 if test x"${x_includes}" = x; then
@@ -1497,20 +1427,17 @@ CPPFLAGS="$CPPFLAGS -x objective-c"
 CFLAGS="$CFLAGS -x objective-c"
 TEMACS_LDFLAGS2="\${LDFLAGS}"
 GNU_OBJC_CFLAGS=
-dnl I don't think it's especially important, but src/Makefile.in
-dnl (now the only user of ns_appdir) used to go to the trouble of adding a
-dnl trailing "/" to it, so now we do it here.
 if test "${with_ns}" != no; then
   if test "${opsys}" = darwin; then
      NS_IMPL_COCOA=yes
      ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=${ns_appdir}/Contents/MacOS/
+     ns_appbindir=${ns_appdir}/Contents/MacOS
      ns_appresdir=${ns_appdir}/Contents/Resources
      ns_appsrc=${srcdir}/nextstep/Cocoa/Emacs.base
   elif test -f $GNUSTEP_CONFIG_FILE; then
      NS_IMPL_GNUSTEP=yes
      ns_appdir=`pwd`/nextstep/Emacs.app
-     ns_appbindir=${ns_appdir}/
+     ns_appbindir=${ns_appdir}
      ns_appresdir=${ns_appdir}/Resources
      ns_appsrc=${srcdir}/nextstep/GNUstep/Emacs.base
      dnl FIXME sourcing this several times in subshells seems inefficient.
@@ -1554,17 +1481,18 @@ fail;
   AC_CHECK_HEADER([AppKit/AppKit.h], [HAVE_NS=yes],
                  [AC_MSG_ERROR([`--with-ns' was specified, but the include
   files are missing or cannot be compiled.])])
-  NS_HAVE_NSINTEGER=yes
   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <Foundation/NSObjCRuntime.h>],
                                      [NSInteger i;])],
                    ns_have_nsinteger=yes,
                    ns_have_nsinteger=no)
-  if test $ns_have_nsinteger = no; then
-    NS_HAVE_NSINTEGER=no
+  if test $ns_have_nsinteger = yes; then
+    AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.])
   fi
 fi
 AC_SUBST(TEMACS_LDFLAGS2)
 
+INSTALL_ARCH_INDEP_EXTRA=install-etc
+ns_self_contained=no
 ns_frag=/dev/null
 NS_OBJ=
 NS_OBJC_OBJ=
@@ -1577,9 +1505,21 @@ if test "${HAVE_NS}" = yes; then
   with_xft=no
   # set up packaging dirs
   if test "${EN_NS_SELF_CONTAINED}" = yes; then
+     ns_self_contained=yes
      prefix=${ns_appresdir}
      exec_prefix=${ns_appbindir}
-     libexecdir=${ns_appbindir}/libexec
+     dnl This one isn't really used, only archlibdir is.
+     libexecdir="\${ns_appbindir}/libexec"
+     archlibdir="\${ns_appbindir}/libexec"
+     docdir="\${ns_appresdir}/etc"
+     etcdir="\${ns_appresdir}/etc"
+     dnl FIXME maybe set datarootdir instead.
+     dnl That would also get applications, icons, man.
+     infodir="\${ns_appresdir}/info"
+     mandir="\${ns_appresdir}/man"
+     lispdir="\${ns_appresdir}/lisp"
+     leimdir="\${ns_appresdir}/leim"
+     INSTALL_ARCH_INDEP_EXTRA=
   fi
   ns_frag=$srcdir/src/ns.mk
   NS_OBJ="fontset.o fringe.o image.o"
@@ -1587,6 +1527,8 @@ if test "${HAVE_NS}" = yes; then
 fi
 CFLAGS="$tmp_CFLAGS"
 CPPFLAGS="$tmp_CPPFLAGS"
+AC_SUBST(INSTALL_ARCH_INDEP_EXTRA)
+AC_SUBST(ns_self_contained)
 AC_SUBST(NS_OBJ)
 AC_SUBST(NS_OBJC_OBJ)
 AC_SUBST(LIB_STANDARD)
@@ -1640,20 +1582,23 @@ case ${HAVE_X11} in
   yes ) HAVE_MENUS=yes ;;
 esac
 
-# Do the opsystem or machine files prohibit the use of the GNU malloc?
+# Does the opsystem file prohibit the use of the GNU malloc?
 # Assume not, until told otherwise.
 GNU_MALLOC=yes
-doug_lea_malloc=yes
-AC_CHECK_FUNC(malloc_get_state, ,doug_lea_malloc=no)
-AC_CHECK_FUNC(malloc_set_state, ,doug_lea_malloc=no)
-AC_CACHE_CHECK(whether __after_morecore_hook exists,
-              emacs_cv_var___after_morecore_hook,
-[AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern void (* __after_morecore_hook)();]],[[__after_morecore_hook = 0]])],
-  emacs_cv_var___after_morecore_hook=yes,
-  emacs_cv_var___after_morecore_hook=no)])
-if test $emacs_cv_var___after_morecore_hook = no; then
-  doug_lea_malloc=no
-fi
+
+AC_CACHE_CHECK(
+  [whether malloc is Doug Lea style],
+  [emacs_cv_var_doug_lea_malloc],
+  [AC_LINK_IFELSE(
+     [AC_LANG_PROGRAM(
+        [[#include <malloc.h>
+         static void hook (void) {}]],
+        [[malloc_set_state (malloc_get_state ());
+         __after_morecore_hook = hook;
+         __malloc_initialize_hook = hook;]])],
+     [emacs_cv_var_doug_lea_malloc=yes],
+     [emacs_cv_var_doug_lea_malloc=no])])
+doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
 
 
 dnl See comments in aix4-2.h about maybe using system malloc there.
@@ -1723,7 +1668,7 @@ AC_CHECK_LIB(Xbsd, main, LD_SWITCH_X_SITE="$LD_SWITCH_X_SITE -lXbsd")
 
 dnl Check if pthreads is available.
 LIB_PTHREAD=
-AC_CHECK_HEADERS(pthread.h)
+AC_CHECK_HEADERS_ONCE(pthread.h)
 if test "$ac_cv_header_pthread_h"; then
   dnl gmalloc.c uses pthread_atfork, which is not available on older-style
   dnl hosts such as MirBSD 10, so test for pthread_atfork instead of merely
@@ -1790,9 +1735,9 @@ if test "${HAVE_X11}" = "yes"; then
   CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS"
 
   # On Solaris, arrange for LD_RUN_PATH to point to the X libraries for tests.
-  # This is handled by LD_SWITCH_X_SITE_AUX during the real build,
-  # but it's more convenient here to set LD_RUN_PATH
-  # since this also works on hosts that don't understand LD_SWITCH_X_SITE_AUX.
+  # This is handled by LD_SWITCH_X_SITE_RPATH during the real build,
+  # but it's more convenient here to set LD_RUN_PATH since this
+  # also works on hosts that don't understand LD_SWITCH_X_SITE_RPATH.
   if test "${x_libraries}" != NONE && test -n "${x_libraries}"; then
     LD_RUN_PATH=$x_libraries${LD_RUN_PATH+:}$LD_RUN_PATH
     export LD_RUN_PATH
@@ -1846,7 +1791,7 @@ if test "${HAVE_X11}" = "yes"; then
   fi
 
   AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
-XScreenNumberOfScreen XSetWMProtocols)
+XScreenNumberOfScreen)
 fi
 
 if test "${window_system}" = "x11"; then
@@ -1910,7 +1855,7 @@ if test "${HAVE_X11}" = "yes"; then
       AC_DEFINE(HAVE_IMAGEMAGICK, 1, [Define to 1 if using imagemagick.])
       CFLAGS="$CFLAGS $IMAGEMAGICK_CFLAGS"
       LIBS="$IMAGEMAGICK_LIBS $LIBS"
-      AC_CHECK_FUNCS(MagickExportImagePixels)
+      AC_CHECK_FUNCS(MagickExportImagePixels MagickMergeImageLayers)
     fi
   fi
 fi
@@ -2011,8 +1956,7 @@ if test "${HAVE_GTK}" = "yes"; then
 fi
 
 dnl D-Bus has been tested under GNU/Linux only.  Must be adapted for
-dnl other platforms.  Support for higher D-Bus versions than 1.0 is
-dnl also not configured.
+dnl other platforms.
 HAVE_DBUS=no
 DBUS_OBJ=
 if test "${with_dbus}" = "yes"; then
@@ -2020,7 +1964,15 @@ if test "${with_dbus}" = "yes"; then
    if test "$HAVE_DBUS" = yes; then
      LIBS="$LIBS $DBUS_LIBS"
      AC_DEFINE(HAVE_DBUS, 1, [Define to 1 if using D-Bus.])
-     AC_CHECK_FUNCS([dbus_watch_get_unix_fd])
+     dnl dbus_watch_get_unix_fd has been introduced in D-Bus 1.1.1.
+     dnl dbus_type_is_valid and dbus_validate_* have been introduced in
+     dnl D-Bus 1.5.12.
+     AC_CHECK_FUNCS(dbus_watch_get_unix_fd \
+                   dbus_type_is_valid \
+                   dbus_validate_bus_name \
+                    dbus_validate_path \
+                   dbus_validate_interface \
+                   dbus_validate_member)
      DBUS_OBJ=dbusbind.o
    fi
 fi
@@ -2181,6 +2133,7 @@ dnl tranle@intellicorp.com says libXmu.a can need XtMalloc in libXt.a to link.
   fi
   AC_CHECK_LIB(Xmu, XmuConvertStandardSelection)
   test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS"
+  dnl ac_cv_lib_Xmu_XmuConvertStandardSelection is also referenced below.
 fi
 AC_SUBST(LIBXTR6)
 
@@ -2495,7 +2448,7 @@ if test "${HAVE_X11}" = "yes"; then
   if test "${with_png}" != "no"; then
     # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
     # in /usr/include/libpng.
-    AC_CHECK_HEADERS(png.h libpng/png.h)
+    AC_CHECK_HEADERS(png.h libpng/png.h, break)
     if test "$ac_cv_header_png_h" = yes || test "$ac_cv_header_libpng_png_h" = yes ; then
       AC_CHECK_LIB(png, png_get_channels, HAVE_PNG=yes, , -lz -lm)
     fi
@@ -2504,6 +2457,19 @@ if test "${HAVE_X11}" = "yes"; then
   if test "${HAVE_PNG}" = "yes"; then
     AC_DEFINE(HAVE_PNG, 1, [Define to 1 if you have the png library (-lpng).])
     LIBPNG="-lpng -lz -lm"
+
+    AC_CHECK_DECL(png_longjmp,
+      [],
+      [AC_DEFINE(PNG_DEPSTRUCT, [],
+        [Define to empty to suppress deprecation warnings when building
+         with --enable-gcc-warnings and with libpng versions before 1.5,
+         which lack png_longjmp.])],
+      [[#ifdef HAVE_LIBPNG_PNG_H
+       # include <libpng/png.h>
+       #else
+       # include <png.h>
+       #endif
+      ]])
   fi
 fi
 AC_SUBST(LIBPNG)
@@ -2591,9 +2557,9 @@ fi
 AC_SUBST(LIBGPM)
 
 dnl Check for malloc/malloc.h on darwin
-AC_CHECK_HEADER(malloc/malloc.h, [AC_DEFINE(HAVE_MALLOC_MALLOC_H, 1, [Define to 1 if you have the <malloc/malloc.h> header file.])])
+AC_CHECK_HEADERS_ONCE(malloc/malloc.h)
 
-C_SWITCH_X_SYSTEM=
+GNUSTEP_CFLAGS=
 ### Use NeXTstep API to implement GUI.
 if test "${HAVE_NS}" = "yes"; then
   AC_DEFINE(HAVE_NS, 1, [Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on Mac OS X.])
@@ -2604,15 +2570,10 @@ if test "${HAVE_NS}" = "yes"; then
     AC_DEFINE(NS_IMPL_GNUSTEP, 1, [Define to 1 if you are using NS windowing under GNUstep.])
     # See also .m.o rule in Makefile.in */
     # FIXME: are all these flags really needed?  Document here why.  */
-    dnl FIXME this should be renamed to GNUSTEP_CFLAGS, and only
-    dnl used in src/Makefile.in.
-    C_SWITCH_X_SYSTEM="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
+    GNUSTEP_CFLAGS="-D_REENTRANT -fPIC -fno-strict-aliasing -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
     ## Extra CFLAGS applied to src/*.m files.
     GNU_OBJC_CFLAGS="$GNU_OBJC_CFLAGS -fgnu-runtime -Wno-import -fconstant-string-class=NSConstantString -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGSWARN -DGSDIAGNOSE"
   fi
-  if test "${NS_HAVE_NSINTEGER}" = "yes"; then
-    AC_DEFINE(NS_HAVE_NSINTEGER, 1, [Define to 1 if `NSInteger' is defined.])
-  fi
   # We also have mouse menus.
   HAVE_MENUS=yes
   OTHER_FILES=ns-app
@@ -2700,8 +2661,7 @@ This probably means that movemail could lose mail.
 There may be a `development' package to install containing liblockfile.])
   fi
 fi
-AC_CHECK_FUNCS(touchlock)
-AC_CHECK_HEADERS(maillock.h)
+AC_CHECK_HEADERS_ONCE(maillock.h)
 AC_SUBST(LIBS_MAIL)
 
 ## Define MAIL_USE_FLOCK (or LOCKF) if the mailer uses flock (or lockf) to
@@ -2746,17 +2706,38 @@ esac
 AC_SUBST(BLESSMAIL_TARGET)
 
 
-AC_CHECK_FUNCS(gethostname getdomainname \
-rename closedir mkdir rmdir sysinfo getrusage get_current_dir_name \
-random lrand48 logb frexp fmod rint cbrt ftime setsid \
-strerror fpathconf select euidaccess getpagesize tzset setlocale \
-utimes getrlimit setrlimit setpgid getcwd getwd shutdown getaddrinfo \
-__fpending mblen mbrlen mbsinit strsignal setitimer ualarm \
-sendto recvfrom getsockopt setsockopt getsockname getpeername \
-gai_strerror mkstemp getline getdelim mremap fsync sync \
-difftime mempcpy mblen mbrlen posix_memalign \
+AC_CHECK_FUNCS(gethostname \
+closedir getrusage get_current_dir_name \
+lrand48 logb frexp fmod cbrt setsid \
+fpathconf select euidaccess getpagesize setlocale \
+utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \
+__fpending strsignal setitimer \
+sendto recvfrom getsockname getpeername getifaddrs freeifaddrs \
+gai_strerror mkstemp getline getdelim fsync sync \
+difftime posix_memalign \
+getpwent endpwent getgrent endgrent \
+touchlock \
 cfmakeraw cfsetspeed copysign __executable_start)
 
+dnl FIXME Fragile: something else may test for getwd as a dependency.
+dnl Change to defining BROKEN_xxx ?
+dnl getwd appears to be buggy on SVR4.2, so we don't use it.
+if test $opsys != unixware; then
+  AC_CHECK_FUNCS(getwd)
+fi
+
+dnl FIXME Fragile: see above.
+## Eric Backus <ericb@lsid.hp.com> says, HP-UX 9.x on HP 700 machines
+## has a broken `rint' in some library versions including math library
+## version number A.09.05.
+## You can fix the math library by installing patch number PHSS_4630.
+## But we can fix it more reliably for Emacs by just not using rint.
+## We also skip HAVE_RANDOM - see comments in src/s/hpux10-20.h.
+case $opsys in
+   hpux*) : ;;
+   *) AC_CHECK_FUNCS(random rint) ;;
+esac
+
 dnl Cannot use AC_CHECK_FUNCS
 AC_CACHE_CHECK([for __builtin_unwind_init],
               emacs_cv_func___builtin_unwind_init,
@@ -2768,7 +2749,7 @@ if test $emacs_cv_func___builtin_unwind_init = yes; then
            [Define to 1 if you have the `__builtin_unwind_init' function.])
 fi
 
-AC_CHECK_HEADERS(sys/un.h)
+AC_CHECK_HEADERS_ONCE(sys/un.h)
 
 AC_FUNC_FSEEKO
 
@@ -2803,7 +2784,7 @@ AC_DEFUN([tputs_link_source], [
 ])
 # Maybe curses should be tried earlier?
 # See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9736#35
-for tputs_library in '' ncurses terminfo termcap curses; do
+for tputs_library in '' tinfo ncurses terminfo termcap curses; do
   OLIBS=$LIBS
   if test -z "$tputs_library"; then
     LIBS_TERMCAP=
@@ -2823,41 +2804,28 @@ done
 AC_MSG_RESULT([$msg])
 if test "X$msg" = Xno; then
   AC_MSG_ERROR([The required function `tputs' was not found in any library.
-These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
+The following libraries were tried (in order):
+  libtinfo, libncurses, libterminfo, libtermcap, libcurses
 Please try installing whichever of these libraries is most appropriate
 for your system, together with its header files.
 For example, a libncurses-dev(el) or similar package.])
 fi
-# Must define this when any termcap library is found.
-AC_DEFINE(HAVE_LIBNCURSES, 1,
-          [Define to 1 if you have the `ncurses' library (-lncurses).])
-## FIXME This was the cpp logic, but I am not sure it is right.
-## The above test has not necessarily found libncurses.
-HAVE_LIBNCURSES=yes
-
-## Use terminfo instead of termcap?
-## Note only system files NOT using terminfo are:
-## freebsd < 40000, ms-w32, msdos, netbsd < 599002500, and
-## darwin|gnu without ncurses.
-TERMINFO=no
-case "$opsys" in
-  ## cygwin: Fewer environment variables to go wrong, more terminal types.
-  ## hpux10-20: Use the system provided termcap(3) library.
-  ## openbsd: David Mazieres <dm@reeducation-labor.lcs.mit.edu> says this
-  ##  is necessary.  Otherwise Emacs dumps core when run -nw.
-  aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;;
 
+## Use termcap instead of terminfo?
+## Only true for: freebsd < 40000, ms-w32, msdos, netbsd < 599002500.
+TERMINFO=yes
+## FIXME?  In the cases below where we unconditionally set
+## LIBS_TERMCAP="-lncurses", this overrides LIBS_TERMCAP = -ltinfo,
+## if that was found above to have tputs.
+## Should we use the gnu* logic everywhere?
+case "$opsys" in
   ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2.
   ##  The ncurses library has been moved out of the System framework in
   ##  Mac OS X 10.2.  So if configure detects it, set the command-line
   ##  option to use it.
-  darwin|gnu*)
-    ## (HAVE_LIBNCURSES was not always true, but is since 2010-03-18.)
-    if test "x$HAVE_LIBNCURSES" = "xyes"; then
-      TERMINFO=yes
-      LIBS_TERMCAP="-lncurses"
-    fi
-    ;;
+  darwin) LIBS_TERMCAP="-lncurses" ;;
+
+  gnu*) test -z "$LIBS_TERMCAP" && LIBS_TERMCAP="-lncurses" ;;
 
   freebsd)
     AC_MSG_CHECKING([whether FreeBSD is new enough to use terminfo])
@@ -2871,33 +2839,29 @@ fail;
     AC_MSG_RESULT($emacs_cv_freebsd_terminfo)
 
     if test $emacs_cv_freebsd_terminfo = yes; then
-      TERMINFO=yes
       LIBS_TERMCAP="-lncurses"
     else
+      TERMINFO=no
       LIBS_TERMCAP="-ltermcap"
     fi
     ;;
 
   netbsd)
-    if test "x$LIBS_TERMCAP" = "x-lterminfo"; then
-      TERMINFO=yes
-    else
+    if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
+      TERMINFO=no
       LIBS_TERMCAP="-ltermcap"
     fi
     ;;
 
-esac
+  openbsd) LIBS_TERMCAP="-lncurses" ;;
 
-case "$opsys" in
   ## hpux: Make sure we get select from libc rather than from libcurses
   ##  because libcurses on HPUX 10.10 has a broken version of select.
   ##  We used to use -lc -lcurses, but this may be cleaner.
+  ## FIXME?  But TERMINFO = yes on hpux (it used to be explicitly
+  # set that way, now it uses the default).  Isn't this a contradiction?
   hpux*) LIBS_TERMCAP="-ltermcap" ;;
 
-  openbsd) LIBS_TERMCAP="-lncurses" ;;
-
-  ## Must use system termcap, if we use any termcap.  It does special things.
-  sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;;
 esac
 
 TERMCAP_OBJ=tparam.o
@@ -2910,33 +2874,40 @@ AC_SUBST(TERMCAP_OBJ)
 
 
 # Do we have res_init, for detecting changes in /etc/resolv.conf?
+# On Darwin, res_init appears not to be useful: see bug#562 and
+# http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html
 resolv=no
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
+
+if test $opsys != darwin; then
+
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>]],
     [[return res_init();]])],
     have_res_init=yes, have_res_init=no)
-if test "$have_res_init" = no; then
-  OLIBS="$LIBS"
-  LIBS="$LIBS -lresolv"
-  AC_MSG_CHECKING(for res_init with -lresolv)
-  AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
+  if test "$have_res_init" = no; then
+    OLIBS="$LIBS"
+    LIBS="$LIBS -lresolv"
+    AC_MSG_CHECKING(for res_init with -lresolv)
+    AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <netinet/in.h>
 #include <arpa/nameser.h>
 #include <resolv.h>]],
-    [[return res_init();]])],
-    have_res_init=yes, have_res_init=no)
-  AC_MSG_RESULT($have_res_init)
-  if test "$have_res_init" = yes ; then
-    resolv=yes
+      [[return res_init();]])],
+      have_res_init=yes, have_res_init=no)
+    AC_MSG_RESULT($have_res_init)
+    if test "$have_res_init" = yes ; then
+      resolv=yes
+    fi
+    LIBS="$OLIBS"
   fi
-  LIBS="$OLIBS"
-fi
 
-if test "$have_res_init" = yes; then
-  AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
-fi
+  if test "$have_res_init" = yes; then
+    AC_DEFINE(HAVE_RES_INIT, 1, [Define to 1 if res_init is available.])
+  fi
+fi                              dnl !darwin
 
 # Do we need the Hesiod library to provide the support routines?
+dnl FIXME?  Should we be skipping this on Darwin too?
 LIBHESIOD=
 if test "$with_hesiod" != no ; then
   # Don't set $LIBS here -- see comments above.  FIXME which comments?
@@ -2960,7 +2931,7 @@ fi
 AC_SUBST(LIBHESIOD)
 
 # Do we need libresolv (due to res_init or Hesiod)?
-if test "$resolv" = yes ; then
+if test "$resolv" = yes && test $opsys != darwin; then
   AC_DEFINE(HAVE_LIBRESOLV, 1,
             [Define to 1 if you have the resolv library (-lresolv).])
   LIBRESOLV=-lresolv
@@ -3052,6 +3023,7 @@ AC_SUBST(KRB5LIB)
 AC_SUBST(DESLIB)
 AC_SUBST(KRB4LIB)
 
+AC_CHECK_FUNCS_ONCE(tzset)
 AC_MSG_CHECKING(whether localtime caches TZ)
 AC_CACHE_VAL(emacs_cv_localtime_cache,
 [if test x$ac_cv_func_tzset = xyes; then
@@ -3089,33 +3061,6 @@ if test $emacs_cv_localtime_cache = yes; then
            [Define to 1 if localtime caches TZ.])
 fi
 
-if test "x$HAVE_TIMEVAL" = xyes; then
-  AC_CHECK_FUNCS(gettimeofday)
-  if test $ac_cv_func_gettimeofday = yes; then
-    AC_CACHE_CHECK(whether gettimeofday can accept two arguments,
-                  emacs_cv_gettimeofday_two_arguments,
-    [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif]],
-      [[struct timeval time;
-       gettimeofday (&time, 0);]])],
-      emacs_cv_gettimeofday_two_arguments=yes,
-      emacs_cv_gettimeofday_two_arguments=no)])
-    if test $emacs_cv_gettimeofday_two_arguments = no; then
-      AC_DEFINE(GETTIMEOFDAY_ONE_ARGUMENT, 1,
-               [Define to 1 if gettimeofday accepts only one argument.])
-    fi
-  fi
-fi
-
 ok_so_far=yes
 AC_CHECK_FUNC(socket, , ok_so_far=no)
 if test $ok_so_far = yes; then
@@ -3181,6 +3126,662 @@ dnl                                and macros for terminal control.])
 dnl    AC_DEFINE(HAVE_TCATTR, 1, [Define to 1 if you have tcgetattr and tcsetattr.])
 dnl fi
 
+dnl Every platform that uses configure (ie every non-MS platform)
+dnl supports this.  There is a create-lockfiles option you can
+dnl customize if you do not want the lock files to be written.
+dnl So it is not clear that this #define still needs to exist.
+AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written,
+  so that Emacs can tell instantly when you try to modify a file that
+  someone else has modified in his/her Emacs.])
+
+dnl Everybody supports this, except MS.
+dnl Seems like the kind of thing we should be testing for, though.
+## Note: PTYs are broken on darwin <6.  Use at your own risk.
+AC_DEFINE(HAVE_PTYS, 1, [Define if the system supports pty devices.])
+
+dnl Everybody supports this, except MS-DOS.
+dnl Seems like the kind of thing we should be testing for, though.
+dnl Compare with HAVE_INET_SOCKETS (which is unused...) above.
+AC_DEFINE(HAVE_SOCKETS, 1, [Define if the system supports
+  4.2-compatible sockets.])
+
+
+AH_TEMPLATE(NO_EDITRES, [Define if XEditRes should not be used.])
+
+case $opsys in
+  aix4-2)
+    dnl Unfortunately without libXmu we cannot support EditRes.
+    if test x$ac_cv_lib_Xmu_XmuConvertStandardSelection != xyes; then
+      AC_DEFINE(NO_EDITRES, 1)
+    fi
+    ;;
+
+  hpux*)
+    dnl Assar Westerlund <assar@sics.se> says this is necessary for
+    dnl HP-UX 10.20, and that it works for HP-UX 0 as well.
+    AC_DEFINE(NO_EDITRES, 1)
+    ;;
+esac
+
+
+case $opsys in
+  darwin | gnu | hpux* | *bsd )
+    AC_DEFINE(NO_TERMIO, 1, [Define if termio.h should not be included.])
+    ;;
+
+  irix6-5 | sol2* | unixware )
+    dnl Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
+    dnl instead, there's a system variable _sys_nsig.  Unfortunately, we
+    dnl need the constant to dimension an array.  So wire in the appropriate
+    dnl value here.
+    AC_DEFINE(NSIG_MINIMUM, 32, [Minimum value of NSIG.])
+    ;;
+esac
+
+
+case $opsys in
+  dnl SIGIO exists, but the feature doesn't work in the way Emacs needs.
+  dnl See eg <http://article.gmane.org/gmane.os.openbsd.ports/46831>.
+  hpux* | irix6-5 | openbsd | sol2* | unixware )
+    AC_DEFINE(BROKEN_SIGIO, 1, [Define if SIGIO should not be used.])
+    ;;
+
+  aix4-2)
+    dnl BUILD 9008 - FIONREAD problem still exists in X-Windows.
+    AC_DEFINE(BROKEN_FIONREAD, 1, [Define if FIONREAD should not be used.])
+    dnl As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h.
+    dnl But, on AIX, SIGAIO, SIGPTY, and SIGPOLL are defined as SIGIO,
+    dnl which causes compilation error at init_signals in sysdep.c.
+    dnl So, we define these macros so that syssignal.h detects them
+    dnl and undefine SIGAIO, SIGPTY and SIGPOLL.
+    AC_DEFINE(BROKEN_SIGAIO, 1, [Define if SIGAIO should not be used.])
+    AC_DEFINE(BROKEN_SIGPOLL,1, [Define if SIGPOLL should not be used.])
+    AC_DEFINE(BROKEN_SIGPTY, 1, [Define if SIGPTY should not be used.])
+
+    dnl On AIX Emacs uses the gmalloc.c malloc implementation.  But given
+    dnl the way this system works, libc functions that return malloced
+    dnl memory use the libc malloc implementation. Calling xfree or
+    dnl xrealloc on the results of such functions results in a crash.
+    dnl
+    dnl One solution for this could be to define SYSTEM_MALLOC in configure,
+    dnl but that does not currently work on this system.
+    dnl
+    dnl It is possible to completely override the malloc implementation on
+    dnl AIX, but that involves putting the malloc functions in a shared
+    dnl library and setting the MALLOCTYPE environment variable to point to
+    dnl that shared library.
+    dnl
+    dnl Emacs currently calls xrealloc on the results of get_current_dir name,
+    dnl to avoid a crash just use the Emacs implementation for that function.
+    dnl
+    dnl FIXME We could change the AC_CHECK_FUNCS call near the start
+    dnl of this file, so that we do not check for get_current_dir_name
+    dnl on AIX.  But that might be fragile if something else ends
+    dnl up testing for get_current_dir_name as a dependency.
+    AC_DEFINE(BROKEN_GET_CURRENT_DIR_NAME, 1, [Define if
+      get_current_dir_name should not be used.])
+    ;;
+
+  freebsd)
+    dnl Circumvent a bug in FreeBSD.  In the following sequence of
+    dnl writes/reads on a PTY, read(2) returns bogus data:
+    dnl
+    dnl write(2)  1022 bytes
+    dnl write(2)   954 bytes, get EAGAIN
+    dnl read(2)   1024 bytes in process_read_output
+    dnl read(2)     11 bytes in process_read_output
+    dnl
+    dnl That is, read(2) returns more bytes than have ever been written
+    dnl successfully.  The 1033 bytes read are the 1022 bytes written
+    dnl successfully after processing (for example with CRs added if the
+    dnl terminal is set up that way which it is here).  The same bytes will
+    dnl be seen again in a later read(2), without the CRs.
+    AC_DEFINE(BROKEN_PTY_READ_AFTER_EAGAIN, 1, [Define on FreeBSD to
+      work around an issue when reading from a PTY.])
+    ;;
+
+  dnl Define the following so emacs symbols will not conflict with those
+  dnl in the System framework.  Otherwise -prebind will not work.
+  darwin)
+    AC_DEFINE(NO_ABORT, 1, [Do not define abort in emacs.c.])
+    ;;
+esac
+
+case $opsys in
+  gnu-* | sol2-10 )
+    dnl FIXME Can't we test if this exists (eg /proc/$$)?
+    AC_DEFINE(HAVE_PROCFS, 1, [Define if you have the /proc filesystem.])
+  ;;
+esac
+
+case $opsys in
+  darwin | freebsd | netbsd | openbsd )
+    AC_DEFINE(DONT_REOPEN_PTY, 1, [Define if process.c does not need to
+      close a pty to make it a controlling terminal (it is already a
+      controlling terminal of the subprocess, because we did ioctl TIOCSCTTY).])
+  ;;
+esac
+
+dnl FIXME Surely we can test for this rather than hard-code it.
+case $opsys in
+  netbsd | openbsd) sound_device="/dev/audio" ;;
+  *) sound_device="/dev/dsp" ;;
+esac
+
+dnl Used in sound.c
+AC_DEFINE_UNQUOTED(DEFAULT_SOUND_DEVICE, "$sound_device",
+  [Name of the default sound device.])
+
+
+dnl Emacs can read input using SIGIO and buffering characters itself,
+dnl or using CBREAK mode and making C-g cause SIGINT.
+dnl The choice is controlled by the variable interrupt_input.
+dnl
+dnl Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
+dnl
+dnl Emacs uses the presence or absence of the SIGIO and BROKEN_SIGIO macros
+dnl to indicate whether or not signal-driven I/O is possible.  It uses
+dnl INTERRUPT_INPUT to decide whether to use it by default.
+dnl
+dnl SIGIO can be used only on systems that implement it (4.2 and 4.3).
+dnl CBREAK mode has two disadvantages
+dnl 1) At least in 4.2, it is impossible to handle the Meta key properly.
+dnl I hear that in system V this problem does not exist.
+dnl 2) Control-G causes output to be discarded.
+dnl I do not know whether this can be fixed in system V.
+dnl
+dnl Another method of doing input is planned but not implemented.
+dnl It would have Emacs fork off a separate process
+dnl to read the input and send it to the true Emacs process
+dnl through a pipe.
+case $opsys in
+  darwin | gnu-linux | gnu-kfreebsd )
+    AC_DEFINE(INTERRUPT_INPUT, 1, [Define to read input using SIGIO.])
+  ;;
+esac
+
+
+dnl If the system's imake configuration file defines `NeedWidePrototypes'
+dnl as `NO', we must define NARROWPROTO manually.  Such a define is
+dnl generated in the Makefile generated by `xmkmf'.  If we don't define
+dnl NARROWPROTO, we will see the wrong function prototypes for X functions
+dnl taking float or double parameters.
+case $opsys in
+  cygwin|gnu|gnu-linux|gnu-kfreebsd|irix6-5|freebsd|netbsd|openbsd)
+    AC_DEFINE(NARROWPROTO, 1, [Define if system's imake configuration
+      file defines `NeedWidePrototypes' as `NO'.])
+  ;;
+esac
+
+
+dnl Used in process.c, this must be a loop, even if it only runs once.
+dnl (Except on SGI; see below.  Take that, clarity and consistency!)
+AH_TEMPLATE(PTY_ITERATION, [How to iterate over PTYs.])
+dnl Only used if !PTY_ITERATION.  Iterate from FIRST_PTY_LETTER to z,
+dnl trying suffixes 0-16.
+AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
+  first PTY, if PTYs are supported.])
+AH_TEMPLATE(PTY_OPEN, [How to open a PTY, if non-standard.])
+AH_TEMPLATE(PTY_NAME_SPRINTF, [How to get the device name of the control
+  end of a PTY, if non-standard.])
+AH_TEMPLATE(PTY_TTY_NAME_SPRINTF, [How to get device name of the tty
+  end of a PTY, if non-standard.])
+
+case $opsys in
+  aix4-2 )
+    AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)] )
+    dnl You allocate a pty by opening /dev/ptc to get the master side.
+    dnl To get the name of the slave side, you just ttyname() the master side.
+    AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptc");] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [strcpy (pty_name, ttyname (fd));] )
+    ;;
+
+  cygwin )
+    AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+    dnl multi-line AC_DEFINEs are hard. :(
+    AC_DEFINE(PTY_OPEN, [ do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)] )
+    AC_DEFINE(PTY_NAME_SPRINTF, [] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] )
+    ;;
+
+  darwin )
+    AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+    dnl Not used, because PTY_ITERATION is defined.
+    AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+    dnl Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
+    dnl But we don't have to block SIGCHLD because it is blocked in the
+    dnl implementation of grantpt.
+    AC_DEFINE(PTY_OPEN, [ do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (0)] )
+    AC_DEFINE(PTY_NAME_SPRINTF, [] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] )
+    ;;
+
+  gnu | freebsd | netbsd | openbsd )
+    AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+    ;;
+
+  gnu-linux | gnu-kfreebsd )
+    dnl if HAVE_GRANTPT
+    if test "x$ac_cv_func_grantpt" = xyes; then
+      AC_DEFINE(UNIX98_PTYS, 1, [Define if the system has Unix98 PTYs.])
+      AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+      dnl Note that grantpt and unlockpt may fork.  We must block SIGCHLD
+      dnl to prevent sigchld_handler from intercepting the child's death.
+      AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); sigunblock (sigmask (SIGCHLD)); }] )
+      dnl if HAVE_GETPT
+      if test "x$ac_cv_func_getpt" = xyes; then
+        AC_DEFINE(PTY_OPEN, [fd = getpt ()])
+        AC_DEFINE(PTY_NAME_SPRINTF, [] )
+      else
+        AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");] )
+      fi
+    else
+      AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+    fi
+    ;;
+
+  hpux*)
+    AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+    AC_DEFINE(PTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);] )
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [sprintf (pty_name, "/dev/pty/tty%c%x", c, i);] )
+    ;;
+
+  irix6-5 )
+    dnl It looks like this cannot be right, because it is not a loop.
+    dnl However, process.c actually does this:
+    dnl # ifndef __sgi
+    dnl   continue;
+    dnl # else
+    dnl   return -1;
+    dnl # endif
+    dnl which presumably makes it OK, since irix == sgi (?).
+    dnl FIXME it seems like this special treatment is unnecessary?
+    dnl Why can't irix use a single-trip loop like eg cygwin?
+    AC_DEFINE(PTY_ITERATION, [])
+    dnl Not used, because PTY_ITERATION is defined.
+    AC_DEFINE(FIRST_PTY_LETTER, ['q'])
+    AC_DEFINE(PTY_OPEN, [ { struct sigaction ocstat, cstat; struct stat stb; char * name; sigemptyset(&cstat.sa_mask); cstat.sa_handler = SIG_DFL; cstat.sa_flags = 0; sigaction(SIGCLD, &cstat, &ocstat); name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0); sigaction(SIGCLD, &ocstat, (struct sigaction *)0); if (name == 0) return -1; if (fd < 0) return -1; if (fstat (fd, &stb) < 0) return -1; strcpy (pty_name, name); }] )
+    dnl No need to get the pty name at all.
+    AC_DEFINE(PTY_NAME_SPRINTF, [] )
+    dnl No need to use sprintf to get the tty name--we get that from _getpty.
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [] )
+    ;;
+
+  sol2* )
+    dnl Uses sigblock/sigunblock rather than sighold/sigrelse,
+    dnl which appear to be BSD4.1 specific.  It may also be appropriate
+    dnl for SVR4.x (x<2) but I'm not sure.   fnf@cygnus.com
+    dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler()
+    dnl from intercepting that death.  If any child but grantpt's should die
+    dnl within, it should be caught after sigrelse(2).
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }] )
+    ;;
+
+  unixware )
+    dnl Comments are as per sol2*.
+    AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }] )
+    ;;
+esac
+
+
+case $opsys in
+  sol2* | unixware )
+    dnl This change means that we don't loop through allocate_pty too
+    dnl many times in the (rare) event of a failure.
+    AC_DEFINE(FIRST_PTY_LETTER, ['z'])
+    AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");] )
+    dnl Push various streams modules onto a PTY channel.  Used in process.c.
+    AC_DEFINE(SETUP_SLAVE_PTY, [if (ioctl (xforkin, I_PUSH, "ptem") == -1) fatal ("ioctl I_PUSH ptem"); if (ioctl (xforkin, I_PUSH, "ldterm") == -1) fatal ("ioctl I_PUSH ldterm"); if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) fatal ("ioctl I_PUSH ttcompat");], [How to set up a slave PTY, if needed.])
+    ;;
+esac
+
+
+AH_TEMPLATE(SIGNALS_VIA_CHARACTERS, [Make process_send_signal work by
+"typing" a signal character on the pty.])
+
+case $opsys in
+  dnl Perry Smith <pedz@ddivt1.austin.ibm.com> says this is correct for AIX.
+  dnl thomas@mathematik.uni-bremen.de says this is needed for IRIX.
+  aix4-2 | cygwin | gnu | irix6-5 | freebsd | netbsd | openbsd )
+    AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
+    ;;
+
+  dnl 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.
+  dnl FIXME Does gnu-kfreebsd have linux/version.h?  It seems unlikely...
+  gnu-linux | gnu-kfreebsd )
+
+    AC_MSG_CHECKING([for signals via characters])
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < 0x20400
+# error "Linux version too old"
+#endif
+      ]], [[]])], emacs_signals_via_chars=yes, emacs_signals_via_chars=no)
+
+    AC_MSG_RESULT([$emacs_signals_via_chars])
+    test $emacs_signals_via_chars = yes && AC_DEFINE(SIGNALS_VIA_CHARACTERS, 1)
+    ;;
+esac
+
+
+dnl Used in dispnew.c
+AH_TEMPLATE(PENDING_OUTPUT_COUNT, [Number of chars of output in the
+buffer of a stdio stream.])
+
+dnl FIXME just PENDING_OUTPUT_COUNT should suffice.
+AH_TEMPLATE(GNU_LIBRARY_PENDING_OUTPUT_COUNT, [Value of
+PENDING_OUTPUT_COUNT if using the GNU C library.])
+
+case $opsys in
+  cygwin | darwin | freebsd | netbsd | openbsd )
+    AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), [((FILE)->_p - (FILE)->_bf._base)])
+    ;;
+
+  unixware)
+    AC_DEFINE(PENDING_OUTPUT_COUNT(FILE), [((FILE)->__ptr - (FILE)->__base)])
+    ;;
+
+  gnu | gnu-linux | gnu-kfreebsd )
+    AC_MSG_CHECKING([for style of pending output formalism])
+    dnl In autoconf 2.67 and later, we could use a single test
+    dnl since the preprocessed output is accessible in "conftest.i".
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+#if !defined (_IO_STDIO_H) && !defined (_STDIO_USES_IOSTREAM)
+# error "stdio definitions not found"
+#endif
+      ]], [[]])], emacs_pending_output=new, emacs_pending_output=unknown)
+
+      if test $emacs_pending_output = unknown; then
+        case $opsys in
+          gnu-linux | gnu-kfreebsd)
+            AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+#ifndef __UCLIBC__
+# error "not using uclibc"
+#endif
+            ]], [[]])], emacs_pending_output=uclibc, emacs_pending_output=old)
+            ;;
+        esac
+      fi
+
+      AC_MSG_RESULT([$emacs_pending_output])
+
+      case $emacs_pending_output in
+        new)
+          dnl New C libio names.
+          AC_DEFINE(GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE),
+            [((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)])
+          ;;
+        uclibc)
+          dnl Using the uClibc library.
+          AC_DEFINE(GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE),
+            [((FILE)->__bufpos - (FILE)->__bufstart)])
+          ;;
+        old)
+          dnl Old C++ iostream names.
+          AC_DEFINE(GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE),
+            [((FILE)->_pptr - (FILE)->_pbase)])
+          ;;
+      esac
+    ;;
+esac
+
+
+dnl Used in vm-limit.c
+AH_TEMPLATE(DATA_START, [Address of the start of the data segment.])
+dnl Used in lisp.h, emacs.c, mem-limits.h
+dnl NEWS.18 describes this as "a number which contains
+dnl the high bits to be inclusive or'ed with pointers that are unpacked."
+AH_TEMPLATE(DATA_SEG_BITS, [Extra bits to be or'd in with any pointers
+stored in a Lisp_Object.])
+dnl if Emacs uses fewer than 32 bits for the value field of a LISP_OBJECT.
+
+case $opsys in
+  gnu)
+    dnl libc defines data_start.
+    AC_DEFINE(DATA_START, [({ extern int data_start; (char *) &data_start; })])
+    ;;
+
+  hpux*)
+    dnl The data segment on this machine always starts at address 0x40000000.
+    AC_DEFINE(DATA_START, [0x40000000])
+    AC_DEFINE(DATA_SEG_BITS, [0x40000000])
+    ;;
+  irix6-5)
+    AC_DEFINE(DATA_START, [0x10000000])
+    AC_DEFINE(DATA_SEG_BITS, [0x10000000])
+    ;;
+esac
+
+
+AH_TEMPLATE(ULIMIT_BREAK_VALUE, [Undocumented.])
+AH_TEMPLATE(TAB3, [Undocumented.])
+
+case $opsys in
+  darwin) AC_DEFINE(TAB3, OXTABS) ;;
+
+  gnu | freebsd | netbsd | openbsd )
+    AC_DEFINE(TABDLY, OXTABS, [Undocumented.] )
+    AC_DEFINE(TAB3, OXTABS)
+    ;;
+
+  gnu-linux | gnu-kfreebsd )
+    dnl libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared
+    dnl library, we cannot get the maximum address for brk.
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef __i386__
+# error "not i386"
+#endif
+      ]], [[]])], AC_DEFINE(ULIMIT_BREAK_VALUE, [(32*1024*1024)]), [])
+
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef __ia64__
+# error "not ia64"
+#endif
+      ]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
+        [do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (0)],
+        [Mark a secondary stack, like the register stack on the ia64.]), [])
+    ;;
+
+  hpux*)
+    AC_DEFINE(RUN_TIME_REMAP, 1, [Define if emacs.c needs to call
+      run_time_remap; for HPUX.])
+    ;;
+
+  irix6-5)
+    dnl Ulimit(UL_GMEMLIM) is busted...
+    AC_DEFINE(ULIMIT_BREAK_VALUE, [0x14000000])
+    ;;
+esac
+
+
+dnl These won't be used automatically yet.  We also need to know, at least,
+dnl that the stack is continuous.
+AH_TEMPLATE(GC_SETJMP_WORKS, [Define if setjmp is known to save all
+  registers relevant for conservative garbage collection in the jmp_buf.])
+
+AH_TEMPLATE(GC_MARK_STACK, [Define to GC_USE_GCPROS_AS_BEFORE if
+  conservative garbage collection is not known to work.])
+
+
+case $opsys in
+  aix4-2 | hpux* | unixware)
+    dnl Conservative garbage collection has not been tested, so for now
+    dnl play it safe and stick with the old-fashioned way of marking.
+    AC_DEFINE(GC_MARK_STACK, [GC_USE_GCPROS_AS_BEFORE])
+    ;;
+
+  dnl Not all the architectures are tested, but there are Debian packages
+  dnl for SCM and/or Guile on them, so the technique must work.  See also
+  dnl comments in alloc.c concerning setjmp and gcc.
+  dnl Fixme: it's probably safe to just use the GCC conditional below.
+  gnu-linux | gnu-kfreebsd )
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
+  || defined __alpha__ || defined __mips__ || defined __s390__ \
+  || defined __arm__ || defined __powerpc__ || defined __amd64__ \
+  || defined __ia64__ || defined __sh__
+/* ok */
+#else
+# error "setjmp not known to work on this arch"
+#endif
+    ]], [[]])], AC_DEFINE(GC_SETJMP_WORKS, 1),
+      AC_DEFINE(GC_MARK_STACK, [GC_USE_GCPROS_AS_BEFORE]) )
+    ;;
+esac
+
+
+if test x$GCC = xyes; then
+   dnl GC_SETJMP_WORKS is nearly always appropriate for GCC.
+   AC_DEFINE(GC_SETJMP_WORKS, 1)
+else
+  case $opsys in
+    dnl irix: Tested on Irix 6.5.  SCM worked on earlier versions.
+    freebsd | netbsd | openbsd | irix6-5 | sol2* )
+      AC_DEFINE(GC_SETJMP_WORKS, 1)
+      ;;
+  esac
+fi                              dnl GCC?
+
+
+dnl Used in xfaces.c.
+case $opsys in
+  hpux* | sol2* )
+    AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on
+      some systems, where it requires time.h.])
+    ;;
+esac
+
+
+dnl Define symbols to identify the version of Unix this is.
+dnl Define all the symbols that apply correctly.
+AH_TEMPLATE(BSD4_2, [Define if the system is compatible with BSD 4.2.])
+AH_TEMPLATE(BSD_SYSTEM, [Define if the system is compatible with BSD 4.2.])
+AH_TEMPLATE(USG, [Define if the system is compatible with System III.])
+AH_TEMPLATE(USG5, [Define if the system is compatible with System V.])
+
+case $opsys in
+  aix4-2)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    dnl This symbol should be defined on AIX Version 3  ???????
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef _AIX
+# error "_AIX not defined"
+#endif
+    ]], [[]])], [], AC_DEFINE(_AIX, [], [Define if the system is AIX.]))
+    ;;
+
+  cygwin)
+    opsysfile=
+    AC_DEFINE(CYGWIN, 1, [Define if the system is Cygwin.])
+    ;;
+
+  darwin)
+    dnl BSD4_3 and BSD4_4 are already defined in sys/param.h.
+    AC_DEFINE(BSD4_2, [])
+    AC_DEFINE(BSD_SYSTEM, [])
+    dnl More specific than the above two.  We cannot use __APPLE__ as this
+    dnl may not be defined on non-OSX Darwin, and we cannot define DARWIN
+    dnl here because Panther and lower CoreFoundation.h uses DARWIN to
+    dnl distinguish OS X from pure Darwin.
+    AC_DEFINE(DARWIN_OS, [], [Define if the system is Darwin.])
+    ;;
+
+  freebsd)
+    AC_DEFINE(BSD4_2, [])
+    dnl Hack to avoid calling AC_PREPROC_IFELSE multiple times.
+    dnl Would not be needed with autoconf >= 2.67, where the
+    dnl preprocessed output is accessible in "conftest.i".
+    AC_DEFINE(BSD_SYSTEM_AHB, 1, [Define if AH_BOTTOM should change BSD_SYSTEM.])
+    ;;
+
+  gnu | netbsd | openbsd )
+    AC_DEFINE(BSD4_2, [])
+    AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
+#ifndef BSD_SYSTEM
+# error "BSD_SYSTEM not defined"
+#endif
+    ]], [[]])], [], AC_DEFINE(BSD_SYSTEM, 43) )
+    ;;
+
+  gnu-linux | gnu-kfreebsd )
+    AC_DEFINE(USG, [])
+    AC_DEFINE(GNU_LINUX, [], [Define if ths system is compatible with GNU/Linux.])
+    ;;
+
+  hpux*)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    AC_DEFINE(HPUX, [], [Define if the system is HPUX.])
+    ;;
+
+  irix6-5)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    AC_DEFINE(IRIX6_5, [], [Define if the system is IRIX.])
+    ;;
+
+  sol2*)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    AC_DEFINE(SOLARIS2, [], [Define if the system is Solaris.])
+    ;;
+
+  unixware)
+    AC_DEFINE(USG, [])
+    AC_DEFINE(USG5, [])
+    ;;
+esac
+
+
+case $opsys in
+  dnl Emacs supplies its own malloc, but glib (part of Gtk+) calls
+  dnl memalign and on Cygwin, that becomes the Cygwin-supplied memalign.
+  dnl As malloc is not the Cygwin malloc, the Cygwin memalign always
+  dnl returns ENOSYS.  A workaround is to set G_SLICE=always-malloc. */
+  cygwin)
+    AC_DEFINE(G_SLICE_ALWAYS_MALLOC, 1, [Define to set the
+      G_SLICE environment variable to "always-malloc" at startup, if
+      using GTK.])
+    ;;
+
+  gnu) opsysfile= ;;
+
+  gnu-kfreebsd) opsysfile="s/gnu-linux.h" ;;
+
+  hpux11)
+    dnl See comments in sysdep.c:sys_signal.
+    dnl SA_RESTART resets the timeout of `select' on hpux11.
+    dnl Defining BROKEN_SA_RESTART is not the same as undef'ing SA_RESTART.
+    AC_DEFINE(BROKEN_SA_RESTART, 1, [Define if SA_RESTART should only
+      be used in batch mode.])
+    dnl It works to open the pty's tty in the parent (Emacs), then
+    dnl close and reopen it in the child.
+    AC_DEFINE(USG_SUBTTY_WORKS, 1, [Define for USG systems where it
+      works to open a pty's tty in the parent process, then close and
+      reopen it in the child.])
+
+    opsysfile="s/hpux10-20.h"
+    ;;
+
+  irix6-5)
+    AC_DEFINE(PREFER_VSUSP, 1, [Define if process_send_signal should
+      use VSUSP instead of VSWTCH.])
+    AC_DEFINE(SETPGRP_RELEASES_CTTY, 1, [Define if process.c:child_setup
+      should not call setpgrp.])
+    ;;
+
+  openbsd) opsysfile="s/netbsd.h" ;;
+
+  sol2-10)
+    AC_DEFINE(_STRUCTURED_PROC, 1, [Needed for system_process_attributes
+      on Solaris.])
+    opsysfile="s/sol2-6.h"
+    ;;
+esac
+
 # Set up the CFLAGS for real compilation, so we can substitute it.
 CFLAGS="$REAL_CFLAGS"
 CPPFLAGS="$REAL_CPPFLAGS"
@@ -3211,6 +3812,8 @@ AC_SUBST(libexecdir)
 AC_SUBST(mandir)
 AC_SUBST(infodir)
 AC_SUBST(lispdir)
+AC_SUBST(leimdir)
+AC_SUBST(standardlisppath)
 AC_SUBST(locallisppath)
 AC_SUBST(lisppath)
 AC_SUBST(x_default_search_path)
@@ -3225,17 +3828,15 @@ AC_SUBST(gameuser)
 ## end of LIBX_BASE, but nothing ever set it.
 AC_SUBST(LD_SWITCH_X_SITE)
 AC_SUBST(C_SWITCH_X_SITE)
-AC_SUBST(C_SWITCH_X_SYSTEM)
+AC_SUBST(GNUSTEP_CFLAGS)
 AC_SUBST(CFLAGS)
 ## Used in lwlib/Makefile.in.
 AC_SUBST(X_TOOLKIT_TYPE)
-if test -n "${machfile}"; then
-  M_FILE="\$(srcdir)/${machfile}"
+if test -n "${opsysfile}"; then
+  S_FILE="\$(srcdir)/${opsysfile}"
 else
-  M_FILE=
+  S_FILE=
 fi
-S_FILE="\$(srcdir)/${opsysfile}"
-AC_SUBST(M_FILE)
 AC_SUBST(S_FILE)
 AC_SUBST(ns_appdir)
 AC_SUBST(ns_appbindir)
@@ -3248,12 +3849,10 @@ AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION,  "${canonical}",
                   [Define to the canonical Emacs configuration name.])
 AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}",
                   [Define to the options passed to configure.])
-if test -n "$machfile"; then
-  AC_DEFINE_UNQUOTED(config_machfile,  "${machfile}",
-                    [Define to the used machine dependent file.])
+if test -n "$opsysfile"; then
+  AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
+                    [Define to the used os dependent file.])
 fi
-AC_DEFINE_UNQUOTED(config_opsysfile, "${opsysfile}",
-                  [Define to the used os dependent file.])
 
 XMENU_OBJ=
 XOBJ=
@@ -3403,10 +4002,23 @@ AC_SUBST(CYGWIN_OBJ)
 AC_SUBST(PRE_ALLOC_OBJ)
 AC_SUBST(POST_ALLOC_OBJ)
 
-# Configure gnulib here, now that we know LIBS.
+# Configure gnulib.  Although this does not affect CFLAGS or LIBS permanently.
+# it temporarily reverts them to their pre-pkg-config values,
+# because gnulib needs to work with both src (which uses the
+# pkg-config stuff) and lib-src (which does not).  For example, gnulib
+# may need to determine whether LIB_CLOCK_GETTIME should contain -lrt,
+# and it therefore needs to run in an environment where LIBS does not
+# already contain -lrt merely because 'pkg-config --libs' printed '-lrt'
+# for some package unrelated to lib-src.
+SAVE_CFLAGS=$CFLAGS
+SAVE_LIBS=$LIBS
+CFLAGS=$pre_PKG_CONFIG_CFLAGS
+LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS"
 gl_ASSERT_NO_GNULIB_POSIXCHECK
 gl_ASSERT_NO_GNULIB_TESTS
 gl_INIT
+CFLAGS=$SAVE_CFLAGS
+LIBS=$SAVE_LIBS
 
 case "$opsys" in
   aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;;
@@ -3430,8 +4042,7 @@ case "$opsys" in
    ##   #ifndef LD_SWITCH_SYSTEM
    ##   #if !defined (__GNUC__) && ((defined (BSD_SYSTEM) && !defined (COFF)))
    ## Since all the *bsds define LD_SWITCH_SYSTEM, this simplifies to:
-   ## not using gcc, darwin system not on an alpha (ie darwin, since
-   ## darwin + alpha does not occur).
+   ## not using gcc, darwin.
    ## Because this was done in src/Makefile.in, the resulting part of
    ## LD_SWITCH_SYSTEM was not used in configure (ie, in ac_link).
    ## It therefore seems cleaner to put this in LD_SWITCH_SYSTEM_TEMACS,
@@ -3440,13 +4051,14 @@ case "$opsys" in
      LD_SWITCH_SYSTEM_TEMACS="-X $LD_SWITCH_SYSTEM_TEMACS"
    ;;
 
-  ## LD_SWITCH_X_SITE_AUX is a -R option saying where to find X at run-time.
-  ## When handled by cpp, this was in LD_SWITCH_SYSTEM.  However, at
-  ## the point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_AUX
+  ## LD_SWITCH_X_SITE_RPATH is a -rpath option saying where to
+  ## find X at run-time.
+  ## When handled by cpp, this was in LD_SWITCH_SYSTEM.  However, at the
+  ## point where configure sourced the s/*.h file, LD_SWITCH_X_SITE_RPATH
   ## had not yet been defined and was expanded to null.  Hence LD_SWITCH_SYSTEM
   ## had different values in configure (in ac_link) and src/Makefile.in.
   ## It seems clearer therefore to put this piece in LD_SWITCH_SYSTEM_TEMACS.
-  gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_AUX_RPATH)" ;;
+  gnu*) LD_SWITCH_SYSTEM_TEMACS="\$(LD_SWITCH_X_SITE_RPATH)" ;;
 
   *) LD_SWITCH_SYSTEM_TEMACS= ;;
 esac
@@ -3470,12 +4082,12 @@ case "$opsys" in
   ## will also work on earlier NetBSD releases.
   netbsd|openbsd) LD_FIRSTFLAG="-nostartfiles" ;;
 
-  ## macpcc: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
+  ## powerpc*: NAKAJI Hiroyuki <nakaji@tutrp.tut.ac.jp> says
   ##   MkLinux/LinuxPPC needs this.
-  ## ibms390x only supports opsys = gnu-linux so it can be added here.
+  ## s390x-* only supports opsys = gnu-linux so it can be added here.
   gnu-*)
-    case "$machine" in
-      macppc|ibms390x) LD_FIRSTFLAG="-nostdlib" ;;
+    case "$canonical" in
+      powerpc*|s390x-*) LD_FIRSTFLAG="-nostdlib" ;;
     esac
     ;;
 esac
@@ -3487,7 +4099,7 @@ if test "x$ORDINARY_LINK" = "xyes"; then
   AC_DEFINE(ORDINARY_LINK, 1, [Define if the C compiler is the linker.])
 
 ## The system files defining neither ORDINARY_LINK nor LD_FIRSTFLAG are:
-## freebsd, gnu-* not on macppc|ibms390x.
+## freebsd, gnu-* not on powerpc*|s390x*.
 elif test "x$GCC" = "xyes" && test "x$LD_FIRSTFLAG" = "x"; then
 
   ## Versions of GCC >= 2.0 put their library, libgcc.a, in obscure
@@ -3582,6 +4194,19 @@ AH_BOTTOM([
 # error "alloca not available on this machine"
 #endif
 
+/* This silences a few compilation warnings on FreeBSD.  */
+#ifdef BSD_SYSTEM_AHB
+#undef BSD_SYSTEM_AHB
+#undef BSD_SYSTEM
+#if __FreeBSD__ == 1
+#define BSD_SYSTEM 199103
+#elif __FreeBSD__ == 2
+#define BSD_SYSTEM 199306
+#elif __FreeBSD__ >= 3
+#define BSD_SYSTEM 199506
+#endif
+#endif
+
 /* Define AMPERSAND_FULL_NAME if you use the convention
    that & in the full name stands for the login id.  */
 /* Turned on June 1996 supposing nobody will mind it.  */
@@ -3595,19 +4220,19 @@ AH_BOTTOM([
 
 #define subprocesses
 
-/* Include the os and machine dependent files.  */
-#include config_opsysfile
-#ifdef config_machfile
-# include config_machfile
+/* Include the os dependent file.  */
+#ifdef config_opsysfile
+# include config_opsysfile
 #endif
 
-/* GNUstep needs a bit more pure memory.  Of the existing knobs,
-   SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.
-  (There is probably a better place to do this, but right now the
-   Cocoa side does this in s/darwin.h and we cannot parallel this
-   exactly since GNUstep is multi-OS.  */
-#if defined HAVE_NS && defined NS_IMPL_GNUSTEP
+/* Mac OS X / GNUstep need a bit more pure memory.  Of the existing knobs,
+   SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
+#ifdef HAVE_NS
+#if defined NS_IMPL_GNUSTEP
 #  define SYSTEM_PURESIZE_EXTRA 30000
+#elif defined DARWIN_OS
+#  define SYSTEM_PURESIZE_EXTRA 200000
+#endif
 #endif
 
 #ifdef emacs /* Don't do this for lib-src.  */
@@ -3623,48 +4248,9 @@ AH_BOTTOM([
 #endif
 #endif
 
-/* These default definitions are good for almost all machines.
-   Any exceptions should override them in m/MACHINE.h.
-   They must be usable in preprocessor conditionals.  */
-
-#ifndef BITS_PER_CHAR
-#define BITS_PER_CHAR 8
-#endif
-
-#ifndef BITS_PER_SHORT
-#define BITS_PER_SHORT 16
-#endif
-
-#ifndef BITS_PER_INT
-#define BITS_PER_INT 32
-#endif
-
-#ifndef BITS_PER_LONG
-#ifdef _LP64
-#define BITS_PER_LONG 64
-#else
-#define BITS_PER_LONG 32
-#endif
-#endif
-
-#if !defined BITS_PER_LONG_LONG && HAVE_LONG_LONG_INT
-#define BITS_PER_LONG_LONG 64
-#endif
-
-/* Define if the compiler supports function prototypes.  It may do so but
-   not define __STDC__ (e.g. DEC C by default) or may define it as zero.  */
-#undef PROTOTYPES
-
 #include <string.h>
 #include <stdlib.h>
 
-#if defined __GNUC__ && (__GNUC__ > 2 \
-                         || (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
-#define NO_RETURN      __attribute__ ((__noreturn__))
-#else
-#define NO_RETURN      /* nothing */
-#endif
-
 #if __GNUC__ >= 3  /* On GCC 3.0 we might get a warning.  */
 #define NO_INLINE __attribute__((noinline))
 #else
@@ -3691,20 +4277,13 @@ AH_BOTTOM([
    ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
 #endif
 
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+
 /* Some versions of GNU/Linux define noinline in their headers.  */
 #ifdef noinline
 #undef noinline
 #endif
 
-/* These won't be used automatically yet.  We also need to know, at least,
-   that the stack is continuous.  */
-#ifdef __GNUC__
-#  ifndef GC_SETJMP_WORKS
-  /* GC_SETJMP_WORKS is nearly always appropriate for GCC.  */
-#    define GC_SETJMP_WORKS 1
-#  endif
-#endif
-
 #endif /* EMACS_CONFIG_H */
 
 /*
@@ -3719,20 +4298,18 @@ End:
 #### It makes printing result more understandable as using GTK sets
 #### toolkit_scroll_bars to yes by default.
 if test "${HAVE_GTK}" = "yes"; then
-  USE_X_TOOLKIT=GTK
-fi
-
-and_machfile=
-if test -n "$machfile"; then
-  and_machfile=" and \`${machfile}'"
+  if test "${with_gtk3}" = "yes"; then
+    USE_X_TOOLKIT=GTK3
+  else
+    USE_X_TOOLKIT=GTK
+  fi
 fi
 
 echo "
 Configured for \`${canonical}'.
 
   Where should the build process find the source code?    ${srcdir}
-  What operating system and machine description files should Emacs use?
-        \`${opsysfile}'${and_machfile}
+  What operating system file should Emacs use?            ${opsysfile-none}
   What compiler should emacs be built with?               ${CC} ${CFLAGS}
   Should Emacs use the GNU version of malloc?             ${GNU_MALLOC}${GNU_MALLOC_reason}
   Should Emacs use a relocating allocator for buffers?    ${REL_ALLOC}
@@ -3783,11 +4360,6 @@ if test -n "${EMACSDOC}"; then
    echo "  Environment variable EMACSDOC set to:                   $EMACSDOC"
 fi
 
-if test $USE_XASSERTS = yes; then
-   echo "  Compiling with asserts turned on."
-   CPPFLAGS="$CPPFLAGS -DXASSERTS=1"
-fi
-
 echo
 
 if test "$HAVE_NS" = "yes"; then
@@ -3805,6 +4377,13 @@ to run if these resources are not installed."
    echo
 fi
 
+if test "${opsys}" = "cygwin"; then
+  case `uname -r` in
+    1.5.*) AC_MSG_WARN([[building Emacs on Cygwin 1.5 is not supported.]])
+           echo
+          ;;
+  esac
+fi
 
 # Remove any trailing slashes in these variables.
 [test "${prefix}" != NONE &&
@@ -3837,6 +4416,16 @@ if test -f $srcdir/${opt_makefile}.in; then
   AC_CONFIG_FILES([test/automated/Makefile])
 fi
 
+
+dnl admin/ may or may not be present.
+opt_makefile=admin/unidata/Makefile
+
+if test -f $srcdir/${opt_makefile}.in; then
+  SUBDIR_MAKEFILES="$SUBDIR_MAKEFILES $opt_makefile"
+  AC_CONFIG_FILES([admin/unidata/Makefile])
+fi
+
+
 SUBDIR_MAKEFILES_IN=`echo " ${SUBDIR_MAKEFILES}" | sed -e 's| | $(srcdir)/|g' -e 's|Makefile|Makefile.in|g'`
 
 AC_SUBST(SUBDIR_MAKEFILES_IN)
@@ -3859,7 +4448,7 @@ dnl the use of force in the `epaths-force' rule in Makefile.in.
 AC_CONFIG_COMMANDS([epaths], [
 echo creating src/epaths.h
 ${MAKE-make} epaths-force
-], [GCC="$GCC" NON_GNU_CPP="$NON_GNU_CPP" CPP="$CPP" CPPFLAGS="$CPPFLAGS"])
+], [GCC="$GCC" CPPFLAGS="$CPPFLAGS"])
 
 AC_CONFIG_COMMANDS([gdbinit], [
 if test ! -f src/.gdbinit && test -f $srcdir/src/.gdbinit; then
@@ -3869,5 +4458,3 @@ fi
 ])
 
 AC_OUTPUT
-
-dnl configure.in ends here
index 0d31e64b3079c541bf31fc78c1855787c71a933d..6783e8431109a5a91c6e694de6413b97dd141379 100644 (file)
@@ -1,27 +1,51 @@
+2012-07-17  Chong Yidong  <cyd@gnu.org>
+
+       * basic.texi (Inserting Text): Replace ucs-insert with
+       insert-char.  Provide more details of input.
+
+       * mule.texi (International Chars, Input Methods): Likewise.
+
+2012-07-13  Chong Yidong  <cyd@gnu.org>
+
+       * custom.texi (Examining): Update C-h v message.
+
+       * buffers.texi (Misc Buffer): Document view-read-only.
+
+2012-07-07  Chong Yidong  <cyd@gnu.org>
+
+       * custom.texi (Init File): Index site-lisp (Bug#11435).
+
+2012-07-06  Chong Yidong  <cyd@gnu.org>
+
+       * emacs.texi: Re-order top-level menu to correspond to logical
+       order, to avoid makeinfo warnings.
+
+       * ack.texi (Acknowledgments): Note new python.el.
+
 2012-06-29  Chong Yidong  <cyd@gnu.org>
 
        * maintaining.texi (Basic VC Editing, VC Pull, Merging):
        * basic.texi (Erasing, Basic Undo): Fix markup.
 
-2012-06-26  Glenn Morris  <rgm@gnu.org>
+2012-06-29  Glenn Morris  <rgm@gnu.org>
 
        * fixit.texi (Undo): Grammar fixes.  (Bug#11779)
 
-2012-06-24  Michael Witten  <mfwitten@gmail.com>  (tiny change)
+2012-06-29  Michael Witten  <mfwitten@gmail.com>  (tiny change)
 
        * fixit.texi (Undo): Fix typo.  (Bug#11775)
 
-2012-06-19  Glenn Morris  <rgm@gnu.org>
+2012-06-27  Glenn Morris  <rgm@gnu.org>
 
-       * Makefile.in: Rename infodir to buildinfodir throughout.  (Bug#11737)
+       * ack.texi (Acknowledgments): Tiny update.
 
-2012-06-11  Chong Yidong  <cyd@gnu.org>
+2012-06-21  Glenn Morris  <rgm@gnu.org>
 
-       * emacs.texi: Remove urlcolor setting.
+       * Makefile.in: Rename infodir to buildinfodir throughout.  (Bug#11737)
 
-2012-06-10  Chong Yidong  <cyd@gnu.org>
+2012-06-17  Chong Yidong  <cyd@gnu.org>
 
-       * emacs.texi: Update ISBN and edition number.
+       * emacs.texi: Remove urlcolor setting.  Update ISBN and edition number.
 
        * anti.texi:
        * building.texi:
        * sending.texi:
        * text.texi: Copyedits to avoid underfull/overfull in 7x9 manual.
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-06  Michael Albinus  <michael.albinus@gmx.de>
+
+       * custom.texi (Directory Variables): Mention enable-remote-dir-locals.
+
+2012-05-28  Glenn Morris  <rgm@gnu.org>
+
+       * ack.texi, building.texi, calendar.texi, custom.texi:
+       * maintaining.texi, text.texi: Use @LaTeX rather than La@TeX.
+
+2012-05-27  Glenn Morris  <rgm@gnu.org>
+
+       * emacs.texi: Simplify following removal of node pointers.
+
+       * ack.texi, anti.texi, basic.texi, buffers.texi, building.texi:
+       * cmdargs.texi, commands.texi, display.texi, emacs.texi:
+       * entering.texi, files.texi, fixit.texi, frames.texi, glossary.texi:
+       * gnu.texi, help.texi, indent.texi, killing.texi, kmacro.texi:
+       * m-x.texi, macos.texi, maintaining.texi, mark.texi, mini.texi:
+       * misc.texi, modes.texi, msdog.texi, mule.texi, programs.texi:
+       * regs.texi, screen.texi, search.texi, text.texi, trouble.texi:
+       * windows.texi, xresources.texi: Nuke hand-written node pointers.
+
+2012-05-22  Glenn Morris  <rgm@gnu.org>
+
+       * emacs.texi (Acknowledgments): Add another contributor.
+
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (MKDIR_P): New, set by configure.
+       (mkinfodir): Use $MKDIR_P.
+
+2012-05-10  Glenn Morris  <rgm@gnu.org>
 
-       * Version 24.1 released.
+       * mule.texi (Disabling Multibyte): Replace the obsolete "unibyte: t"
+       with "coding: raw-text".
 
-2012-05-06  Chong Yidong  <cyd@gnu.org>
+       * files.texi (Interlocking): Mention create-lockfiles option.
+
+2012-05-09  Chong Yidong  <cyd@gnu.org>
 
        * frames.texi (Mouse References, Mouse Commands): Fix index
        entries (Bug#11362).
 
-2012-05-03  Glenn Morris  <rgm@gnu.org>
+2012-05-05  Glenn Morris  <rgm@gnu.org>
 
        * custom.texi (Customization Groups, Custom Themes, Examining):
        Improve page breaks.
 
        * fixit.texi (Fixit, Undo): Reword to improve page-breaks.
 
-2012-05-01  Glenn Morris  <rgm@gnu.org>
+2012-05-04  Glenn Morris  <rgm@gnu.org>
 
-       * emacs.texi (@copying): Only print EDITION in the TeX version.
+       * Makefile.in (INFO_EXT, INFO_OPTS): New, set by configure.
+       (info, infoclean): Use $INFO_EXT.
+       ($(infodir)/emacs$(INFO_EXT)): Use $INFO_EXT and $INFO_OPT.
+       * makefile.w32-in (INFO_EXT, INFO_OPTS): New.
+       (INFO_TARGETS): Use $INFO_EXT.
+       ($(infodir)/emacs$(INFO_EXT)): Use $INFO_EXT and $INFO_OPT, and -o.
+
+2012-05-02  Glenn Morris  <rgm@gnu.org>
 
-2012-04-30  Glenn Morris  <rgm@gnu.org>
+       * emacs.texi (@copying): Only print EDITION in the TeX version.
 
        * search.texi (Regexp Search): Just say "Emacs".
 
        * display.texi (Auto Scrolling):
        Reword to avoid repetition and improve page break.
 
-2012-04-28  Glenn Morris  <rgm@gnu.org>
-
        * xresources.texi (Resources):
        * mule.texi (Language Environments):
        * misc.texi (Amusements):
 
        * emacs.texi: Some fixes for detailed menu.
 
-2012-04-26  Glenn Morris  <rgm@gnu.org>
-
        * emacs.texi: Add "et al." to authors.
 
        * ack.texi, basic.texi, buffers.texi, building.texi:
        * search.texi, trouble.texi, windows.texi:
        Use Texinfo recommended convention for quotes+punctuation.
 
-2012-04-25  Eli Zaretskii  <eliz@gnu.org>
+2012-04-27  Eli Zaretskii  <eliz@gnu.org>
 
-       * mule.texi (Bidirectional Editing): Improve indexing.  Minor
-       wording tweaks.
+       * mule.texi (Bidirectional Editing): Improve indexing.
+       Minor wording tweaks.
 
 2012-04-15  Chong Yidong  <cyd@gnu.org>
 
        * misc.texi (emacsclient Options): More clarifications.
 
-2012-04-14  Glenn Morris  <rgm@gnu.org>
+2012-04-15  Glenn Morris  <rgm@gnu.org>
 
        * msdog.texi (Windows Printing): It doesn't set printer-name.
 
        (Defining Fontsets, Modifying Fontsets, Undisplayable Characters)
        (Unibyte Mode, Charsets, Bidirectional Editing): Copyedits.
 
-2012-04-14  Chong Yidong  <cyd@gnu.org>
+2012-04-15  Chong Yidong  <cyd@gnu.org>
 
        * glossary.texi (Glossary): Standardize on "text terminal"
        terminology.  All callers changed.
        * misc.texi (emacsclient Options): Document "client frame" concept
        and its effect on C-x C-c more carefully.
 
-2012-04-14  Glenn Morris  <rgm@gnu.org>
+2012-04-15  Glenn Morris  <rgm@gnu.org>
 
        * frames.texi (Scroll Bars):
        * glossary.texi (Glossary): Use consistent case for "X Window System".
        (Text Coding, Communication Coding, File Name Coding, Terminal Coding):
        Copyedits.
 
-2012-04-13  Glenn Morris  <rgm@gnu.org>
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
        * mule.texi (Select Input Method, Coding Systems, Recognize Coding):
        Copyedits.
        auto-coding-functions does not override coding: tags.
        Remove rmail-decode-mime-charset; it no longer has any effect.
 
-2012-04-12  Chong Yidong  <cyd@gnu.org>
+2012-04-14  Chong Yidong  <cyd@gnu.org>
 
        * custom.texi (Creating Custom Themes): Add reference to Custom
        Themes node in Lisp manual.
 
-2012-04-12  Glenn Morris  <rgm@gnu.org>
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
        * mule.texi (International): Copyedits.
        (International Chars): Update C-x = example output.
        (Input Methods): Copyedits.  Use "^" for the postfix example,
        because it is less confusing inside Info's `quotes'.
 
-       * custom.texi (Specifying File Variables):  Fix "unibyte" description.
+       * custom.texi (Specifying File Variables): Fix "unibyte" description.
        Update for "Disabling Multibyte" node name change.
        * emacs.texi: Update for "Disabling Multibyte" node name change.
 
-2012-04-10  Glenn Morris  <rgm@gnu.org>
-
        * abbrevs.texi, arevert-xtra.texi, buffers.texi, building.texi:
        * cmdargs.texi, custom.texi, entering.texi, files.texi, frames.texi:
        * glossary.texi, help.texi, macos.texi, maintaining.texi, mini.texi:
        * entering.texi (Entering Emacs):
        Do not mention initial-buffer-choice = t.
 
-2012-04-08  Glenn Morris  <rgm@gnu.org>
-
        * misc.texi (Gnus Startup): Use @env for environment variables.
 
+       * Makefile.in: Replace non-portable use of $< in ordinary rules.
+
+2012-04-12  Glenn Morris  <rgm@gnu.org>
+
+       * ack.texi (Acknowledgments): Don't mention obsolete mailpost.el.
+
 2012-04-07  Glenn Morris  <rgm@gnu.org>
 
-       * Makefile.in: Replace non-portable use of $< in ordinary rules.
+       * emacsver.texi (EMACSVER): Bump version to 24.1.50.
 
 2012-04-05  Glenn Morris  <rgm@gnu.org>
 
 
 2012-01-09  Chong Yidong  <cyd@gnu.org>
 
-       * custom.texi (Custom Themes): Switched custom-safe-themes to use
+       * custom.texi (Custom Themes): Switch custom-safe-themes to use
        SHA-256.
 
 2012-01-07  Chong Yidong  <cyd@gnu.org>
        (Screen Garbled): Don't refer to terminal "manufacturers".
        (Total Frustration): Node deleted.  Eliza is documented in
        Amusements now.
-       (Known Problems): More info about using the bug tracker.  Mention
-       debbugs package.
+       (Known Problems): More info about using the bug tracker.
+       Mention debbugs package.
        (Bug Criteria): Copyedits.
        (Understanding Bug Reporting): Mention emacs -Q.
 
        Document browse-url-mailto-function.
        (Goto Address mode): Add index entries.  Add xref to Browse-URL.
        (FFAP): FFAP is not a minor mode.
-       (Amusements): M-x lm was renamed to M-x landmark.  Document
-       nato-region.
+       (Amusements): M-x lm was renamed to M-x landmark.
+       Document nato-region.
 
 2012-01-01  Chong Yidong  <cyd@gnu.org>
 
 
 2011-12-26  Chong Yidong  <cyd@gnu.org>
 
-       * dired.texi (Dired Enter, Misc Dired Features): Document
-       dired-use-ls-dired changes.  Mention quit-window.
+       * dired.texi (Dired Enter, Misc Dired Features):
+       Document dired-use-ls-dired changes.  Mention quit-window.
        (Dired Navigation): Add index entries.
        (Dired Visiting): Fix View Mode xref.
        (Marks vs Flags): Prefer C-/ binding for undo.
 
        * vc1-xtra.texi (Version Headers): Note that these are for
        Subversion, CVS, etc. only.
-       (General VC Options): De-document vc-keep-workfiles.  Fix
-       RCS-isms.
+       (General VC Options): De-document vc-keep-workfiles.
+       Fix RCS-isms.
 
 2011-12-22  Eli Zaretskii  <eliz@gnu.org>
 
 
        * vc1-xtra.texi (Remote Repositories): Update introduction.
        (Local Version Control): Node deleted (obsolete with DVCSes).
-       (Remote Repositories, Version Backups): Node deleted.  Move
-       documentation of vc-cvs-stay-local to CVS Options.
+       (Remote Repositories, Version Backups): Node deleted.
+       Move documentation of vc-cvs-stay-local to CVS Options.
        (CVS Options): Reduce verbosity of description of obscure CVS
        locking feature.
        (Making Revision Tags, Revision Tag Caveats): Merge into Revision
        less CVS-specific.
        (VC With A Merging VCS, VC With A Locking VCS): Add xref to
        Registering node.
-       (Secondary VC Commands): Deleted.  Promote subnodes.
+       (Secondary VC Commands): Delete.  Promote subnodes.
        (Log Buffer): Add command name for C-c C-c.  Fix the name of the
        log buffer.  Add index entries.
-       (VCS Changesets, Types of Log File, VC With A Merging VCS): Use
-       "commit" terminology.
+       (VCS Changesets, Types of Log File, VC With A Merging VCS):
+       Use "commit" terminology.
        (Old Revisions): Move it to just before VC Change Log.  "Tag" here
        doesn't refer to tags tables.  Note other possible forms of the
        revision ID.  C-x v = does not save.
        (Lisp Eval): Note that listed commands are available globally.
        Explain the meaning of "defun" in the C-M-x context.
        (Lisp Interaction): Copyedits.
-       (External Lisp): Fix name of inferior Lisp buffer.  Mention
-       Scheme.
+       (External Lisp): Fix name of inferior Lisp buffer.
+       Mention Scheme.
        (Compilation): Define "inferior process".
 
 2011-12-10  Eli Zaretskii  <eliz@gnu.org>
        (Compilation Mode): Add xref for grep, occur, and mouse
        references.  Define "locus".
        (Grep Searching): Use @command.
-       (Debuggers, Commands of GUD, GDB Graphical Interface): Clarify
-       intro.
+       (Debuggers, Commands of GUD, GDB Graphical Interface):
+       Clarify intro.
        (Starting GUD): Clarify how arguments are specified.
        (Debugger Operation): Index entry for "GUD interaction buffer",
        and move basic description here from Commands of GUD node.
        (Source Buffers): Remove gdb-find-source-frame, which is not in
        gdb-mi.el.
        (Other GDB Buffers): Remove gdb-use-separate-io-buffer and
-       toggle-gdb-all-registers, which are not in gdb-mi.el.  Don't
-       re-document GUD interaction buffers.
+       toggle-gdb-all-registers, which are not in gdb-mi.el.
+       Don't re-document GUD interaction buffers.
 
        * programs.texi (Symbol Completion): M-TAB can now use Semantic.
        (Semantic): Add cindex entries for Semantic.
 
        * programs.texi (Program Modes): Mention modes that are not
        included with Emacs.  Fix references to other manuals for tex.
-       Add index entry for backward-delete-char-untabify.  Mention
-       prog-mode-hook.
+       Add index entry for backward-delete-char-untabify.
+       Mention prog-mode-hook.
        (Which Function): Use "global minor mode" terminology.
        (Basic Indent, Multi-line Indent): Refer to previous descriptions
        in Indentation chapter to avoid duplication.
        (TeX Editing): Add xref to documentation for Occur.
        (LaTeX Editing): Add xref to Completion node.
        (TeX Print): Fix description of tex-directory.
-       (Enriched Text): Renamed from Formatted Text.  Make this node and
+       (Enriched Text): Rename from Formatted Text.  Make this node and
        its subnodes less verbose, since text/enriched files are
        practically unused.
-       (Enriched Mode): Renamed from Requesting Formatted Text.
+       (Enriched Mode): Rename from Requesting Formatted Text.
        (Format Colors): Node deleted.
-       (Enriched Faces): Renamed from Format Faces.  Describe commands
+       (Enriched Faces): Rename from Format Faces.  Describe commands
        for applying colors too.
        (Forcing Enriched Mode): Node deleted; merged into Enriched Mode.
 
 2011-10-18  Chong Yidong  <cyd@gnu.org>
 
        * display.texi (Faces): Simplify discussion.  Move documentation
-       of list-faces-display here, from Standard Faces node.  Note
-       special role of `default' background.
-       (Standard Faces): Note special role of `default' background.  Note
-       that region face may be taken fom GTK.  Add xref to Text Display.
-       (Text Scale): Rename from "Temporary Face Changes".  Callers
-       changed.  Don't bother documenting variable-pitch-mode.
+       of list-faces-display here, from Standard Faces node.
+       Note special role of `default' background.
+       (Standard Faces): Note special role of `default' background.
+       Note that region face may be taken fom GTK.  Add xref to Text Display.
+       (Text Scale): Rename from "Temporary Face Changes".
+       Callers changed.  Don't bother documenting variable-pitch-mode.
        (Font Lock): Copyedits.  Remove font-lock-maximum-size.
        (Useless Whitespace): Simplify description of
        delete-trailing-whitespace.  Note active region case.
 
 2011-10-13  Chong Yidong  <cyd@stupidchicken.com>
 
-       * killing.texi (Deletion): Add xref to Using Region.  Document
-       delete-forward-char.
+       * killing.texi (Deletion): Add xref to Using Region.
+       Document delete-forward-char.
        (Yanking): Move yank-excluded-properties to Lisp manual.  Move C-y
        description here.  Recommend C-u C-SPC for jumping to mark.
        (Kill Ring): Move kill ring variable documentation here.
        selection changes.  Mention that commands like C-y set the mark.
        (Marking Objects): Add xref to Words node.  Note that mark-word
        and mark-sexp also have the "extend region" behavior.
-       (Using Region): Mention M-$ in the table.  Document
-       mark-even-if-inactive here instead of in Mark Ring.
-       (Mark Ring): Move mark-even-if-inactive to Using Region.  Take
-       note of the "Mark Set" behavior.
+       (Using Region): Mention M-$ in the table.
+       Document mark-even-if-inactive here instead of in Mark Ring.
+       (Mark Ring): Move mark-even-if-inactive to Using Region.
+       Take note of the "Mark Set" behavior.
        (Disabled Transient Mark): Rename from "Persistent Mark"
        (Bug#9688).  Callers changed.
 
        (Name Help): Remove an over-long joke.
        (Apropos): Document prefix args.  Remove duplicated descriptions.
        (Help Mode): Add C-c C-b to table.  Update TAB binding.
-       (Package Keywords): Rename from "Library by Keyword".  Describe
-       new package menu interface.
+       (Package Keywords): Rename from "Library by Keyword".
+       Describe new package menu interface.
        (Help Files, Help Echo): Tweak description.
 
        * mini.texi (Completion Options): Add completion-cycle-threshold.
 
 2011-10-08  Chong Yidong  <cyd@stupidchicken.com>
 
-       * basic.texi (Position Info): Omit page commands.  Document
-       count-words-region and count-words.
+       * basic.texi (Position Info): Omit page commands.
+       Document count-words-region and count-words.
 
        * text.texi (Pages): Move what-page documentation here.
 
 
 2011-10-07  Chong Yidong  <cyd@stupidchicken.com>
 
-       * basic.texi (Inserting Text): Add xref to Completion.  Add
-       ucs-insert example, and document prefix argument.
+       * basic.texi (Inserting Text): Add xref to Completion.
+       Add ucs-insert example, and document prefix argument.
        (Moving Point): Fix introduction; C-f/C-b are no longer equivalent
        to left/right.  Tweak left-char and right-char descriptions.
        M-left and M-right are now bound to left-word/right-word.
        * custom.texi (Mouse Buttons):
        * rmail.texi (Rmail Scrolling):
        * search.texi (Isearch Scroll):
-
        * display.texi (Scrolling): Replace scroll-up/down with
        scroll-up/down-command.  Fix scroll-preserve-screen-position
        description.  Document scroll-error-top-bottom.
 
 2011-04-24  Chong Yidong  <cyd@stupidchicken.com>
 
-       * maintaining.texi (List Tags): Document next-file.  Suggested by
-       Uday S Reddy.
+       * maintaining.texi (List Tags): Document next-file.
+       Suggested by Uday S Reddy.
 
 2011-04-23  Juanma Barranquero  <lekktu@gmail.com>
 
        * ack.texi (Acknowledgments): General update based on AUTHORS,
        including removal of some stuff no longer distributed.
 
-2008-12-19  Agustin Martin  <agustin.martin@hispalinux.es>
+2008-12-19  Agustín Martín  <agustin.martin@hispalinux.es>
 
-       * fixit.texi: Mention hunspell
+       * fixit.texi: Mention hunspell.
 
 2008-12-19  Glenn Morris  <rgm@gnu.org>
 
index a516e75be67b9459cbfa8e362ba642d58fe457af..8f2078192b2c6c8312306fe23c7dc8762afca8e6 100644 (file)
@@ -35,6 +35,15 @@ buildinfodir = $(srcdir)/../../info
 # Directory with the (customized) texinfo.tex file.
 texinfodir = $(srcdir)/../misc
 
+MKDIR_P = @MKDIR_P@
+
+INFO_EXT=@INFO_EXT@
+# Options used only when making info output.
+# --no-split is only needed because of MS-DOS.
+# For a possible alternative, see
+# http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg01182.html
+INFO_OPTS=@INFO_OPTS@
+
 # The makeinfo program is part of the Texinfo distribution.
 # Use --force so that it generates output even if there are errors.
 MAKEINFO = @MAKEINFO@
@@ -111,14 +120,12 @@ EMACSSOURCES= \
        $(EMACS_XTRA)
 
 ## This seems pointless.  The info/ directory exists in both the
-## repository and the release tarfiles.  We do not use any
-## equivalent of mkdir -p/install-sh -d, so this is not a general
-## solution anyway.  The second test -d is for parallel builds.
-mkinfodir = @test -d ${buildinfodir} || mkdir ${buildinfodir} || test -d ${buildinfodir}
+## repository and the release tarfiles.
+mkinfodir = @${MKDIR_P} ${buildinfodir}
 
 .PHONY: info dvi html pdf ps
 
-info: $(buildinfodir)/emacs
+info: $(buildinfodir)/emacs$(INFO_EXT)
 dvi: emacs.dvi
 html: emacs.html
 pdf: emacs.pdf
@@ -128,9 +135,9 @@ ps: emacs.ps
 # There is no provision for Info files to exist in the build directory.
 # In a distribution of Emacs, the Info files should be up to date.
 # Note: "<" is not portable in ordinary make rules.
-$(buildinfodir)/emacs: ${EMACSSOURCES}
+$(buildinfodir)/emacs$(INFO_EXT): ${EMACSSOURCES}
        $(mkinfodir)
-       $(MAKEINFO) $(MAKEINFO_OPTS) -o $@ ${srcdir}/emacs.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/emacs.texi
 
 emacs.dvi: ${EMACSSOURCES}
        $(ENVADD) $(TEXI2DVI) ${srcdir}/emacs.texi
@@ -171,7 +178,7 @@ distclean: clean
 
 ## In the standalone tarfile, the clean rule runs this.
 infoclean:
-       -cd $(buildinfodir) && rm -f emacs emacs-[1-9] emacs-[1-9][0-9]
+       -cd $(buildinfodir) && rm -f emacs$(INFO_EXT) emacs$(INFO_EXT)-[1-9] emacs$(INFO_EXT)-[1-9][0-9]
 
 maintainer-clean: distclean infoclean
 
index 5e4e6f254744f473080d64655055e6bab83ee3e9..2c4ed1fbcc873d7d22465c846cf6c531150fb04d 100644 (file)
@@ -3,7 +3,7 @@
 @c Copyright (C) 1994-1997, 1999-2012 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
-@node Acknowledgments, Screen, Concept Index, Top
+@node Acknowledgments
 @unnumbered Acknowledgments
 
 Many people have contributed code included in the Free Software
@@ -251,10 +251,6 @@ color manipulation.  He also made various contributions to Gnus.
 Vivek Dasmohapatra wrote @file{htmlfontify.el}, to convert a buffer or
 source tree to HTML.
 
-@item
-Gary Delp wrote @file{mailpost.el}, an interface between RMAIL and the
-@file{/usr/uci/post} mailer.
-
 @item
 Matthieu Devin wrote @file{delsel.el}, a package to make newly-typed
 text replace the current selection.
@@ -268,7 +264,7 @@ He also wrote @file{dynamic-setting.el}.
 
 @item
 Carsten Dominik wrote Ref@TeX{}, a package for setting up labels and
-cross-references in La@TeX{} documents; and co-wrote IDLWAVE mode
+cross-references in @LaTeX{} documents; and co-wrote IDLWAVE mode
 (q.v.@:).  He was the original author of Org mode, for maintaining notes,
 todo lists, and project planning.  Bastien Guerry subsequently took
 over maintainership.  Benjamin Andresen, Thomas Baumann, Joel Boehland, Jan Böcker, Lennart
@@ -367,6 +363,10 @@ Kevin Gallagher rewrote and enhanced the EDT emulation, and wrote
 @file{flow-ctrl.el}, a package for coping with unsuppressible XON/XOFF
 flow control.
 
+@item
+Fabián E. Gallina rewrote @file{python.el}, the major mode for the
+Python programming language used in Emacs 24.2 onwards.
+
 @item
 Kevin Gallo added multiple-frame support for Windows NT and wrote
 @file{w32-win.el}, support functions for the MS-Windows window system.
@@ -553,7 +553,7 @@ for the Transport Layer Security protocol.
 
 @item
 Arne Jørgensen wrote @file{latexenc.el}, a package to
-automatically guess the correct coding system in La@TeX{} files.
+automatically guess the correct coding system in @LaTeX{} files.
 
 @item
 Alexandre Julliard wrote @file{vc-git.el}, support for the Git version
@@ -571,7 +571,7 @@ control system.
 Henry Kautz wrote @file{bib-mode.el}, a mode for maintaining
 bibliography databases compatible with @code{refer} (the @code{troff}
 version) and @code{lookbib}, and @file{refbib.el}, a package to convert
-those databases to the format used by the La@TeX{} text formatting package.
+those databases to the format used by the @LaTeX{} text formatting package.
 
 @item
 Taichi Kawabata added support for Devanagari script and the Indian
@@ -714,13 +714,13 @@ headers; @file{hl-line.el}, a minor mode for highlighting the line in
 the current window on which point is; @file{cap-words.el}, a minor mode
 for motion in ``CapitalizedWordIdentifiers''; @file{latin1-disp.el}, a
 package that lets you display ISO 8859 characters on Latin-1 terminals
-by setting up appropriate display tables; @file{python.el}, a major mode
-for the Python programming language; @file{smiley.el}, a facility for
-displaying smiley faces; @file{sym-comp.el}, a library for performing
-mode-dependent symbol completion; @file{benchmark.el} for timing code
-execution; and @file{tool-bar.el}, a mode to control the display of
-the Emacs tool bar.  With Riccardo Murri he wrote @file{vc-bzr.el},
-support for the Bazaar version control system.
+by setting up appropriate display tables; the version of
+@file{python.el} used prior to Emacs 24.2; @file{smiley.el}, a
+facility for displaying smiley faces; @file{sym-comp.el}, a library
+for performing mode-dependent symbol completion; @file{benchmark.el}
+for timing code execution; and @file{tool-bar.el}, a mode to control
+the display of the Emacs tool bar.  With Riccardo Murri he wrote
+@file{vc-bzr.el}, support for the Bazaar version control system.
 
 @item
 Eric Ludlam wrote the Speedbar package; @file{checkdoc.el}, for checking
@@ -835,7 +835,9 @@ diffs; @file{css-mode.el} for Cascading Style Sheets;
 @file{bibtex-style.el} for Bib@TeX{} Style files; @file{mpc.el}, a
 client for the ``Music Player Daemon''; @file{smie.el}, a generic
 indentation engine; and @file{pcase.el}, implementing ML-style pattern
-matching.  He integrated the lexical binding code in Emacs 24.
+matching.  In Emacs 24, he integrated the lexical binding code,
+and cleaned up the CL namespace (making it acceptable to use CL
+functions at runtime).
 
 @item
 Morioka Tomohiko wrote several packages for MIME support in Gnus and
index a2309a9919d7a7d8f402e89cf76740fb445c5472..62433a5b220c9e9a47199dcc0ca60e1782820143 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 2005-2012 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 
-@node Antinews, Mac OS / GNUstep, X Resources, Top
+@node Antinews
 @appendix Emacs 23 Antinews
 @c Update the emacs.texi Antinews menu entry with the above version number.
 
index 71e59e4738d4d38b93a2cffa4ead31679a962325..16ccdba086635d215af006c3ea008d68d37742f8 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Basic, Minibuffer, Exiting, Top
+@node Basic
 @chapter Basic Editing Commands
 
 @kindex C-h t
@@ -97,28 +97,29 @@ To use decimal or hexadecimal instead of octal, set the variable
 the letters @kbd{a} to @kbd{f} serve as part of a character code,
 just like digits.  Case is ignored.
 
-@findex ucs-insert
+@findex insert-char
 @kindex C-x 8 RET
 @cindex Unicode characters, inserting
 @cindex insert Unicode character
 @cindex characters, inserting by name or code-point
-  Instead of @kbd{C-q}, you can use the command @kbd{C-x 8 @key{RET}}
-(@code{ucs-insert}).  This prompts for the Unicode name or code-point
+  Alternatively, you can use the command @kbd{C-x 8 @key{RET}}
+(@code{insert-char}).  This prompts for the Unicode name or code-point
 of a character, using the minibuffer.  If you enter a name, the
 command provides completion (@pxref{Completion}).  If you enter a
-code-point, it should be a hexadecimal number (which is the convention
-for Unicode).  The command then inserts the corresponding character
-into the buffer.  For example, both of the following insert the
-infinity sign (Unicode code-point @code{U+221E}):
+code-point, it should be as a hexadecimal number (the convention for
+Unicode), or a number with a specified radix, e.g.@: @code{#o23072}
+(octal); @xref{Integer Basics,,, elisp, The Emacs Lisp Reference
+Manual}.  The command then inserts the corresponding character into
+the buffer.  For example, both of the following insert the infinity
+sign (Unicode code-point @code{U+221E}):
 
 @example
 @kbd{C-x 8 @key{RET} infinity @key{RET}}
 @kbd{C-x 8 @key{RET} 221e @key{RET}}
 @end example
 
-  A numeric argument to either @kbd{C-q} or @kbd{C-x 8 @key{RET}}
-specifies how many copies of the character to insert
-(@pxref{Arguments}).
+  A numeric argument to @kbd{C-q} or @kbd{C-x 8 @key{RET}} specifies
+how many copies of the character to insert (@pxref{Arguments}).
 
 @node Moving Point
 @section Changing the Location of Point
index 5dd95cc2a6f6fc7f799448cfb56801b43b8fa49d..24bb0e83778139c5cb4e39ef393b3ce0fd0096b5 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Buffers, Windows, Files, Top
+@node Buffers
 @chapter Using Multiple Buffers
 
 @cindex buffers
@@ -232,11 +232,14 @@ have special commands to operate on the text; also by visiting a file
 whose access control says you cannot write it.
 
 @findex toggle-read-only
+@vindex view-read-only
  The command @kbd{C-x C-q} (@code{toggle-read-only}) makes a read-only
 buffer writable, and makes a writable buffer read-only.  This works by
 setting the variable @code{buffer-read-only}, which has a local value
 in each buffer and makes the buffer read-only if its value is
-non-@code{nil}.
+non-@code{nil}.  If you change the option @code{view-read-only} to a
+non-@code{nil} value, making the buffer read-only with @kbd{C-x C-q}
+also enables View mode in the buffer (@pxref{View Mode}).
 
 @findex rename-buffer
   @kbd{M-x rename-buffer} changes the name of the current buffer.  You
index 064f18dd463f38ecb537ec30ed4de2c9ec3e8211..01e6e67b07e0a5dd087bad7231548fa374ec767e 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Building, Maintaining, Programs, Top
+@node Building
 @chapter Compiling and Testing Programs
 @cindex building programs
 @cindex program building
@@ -416,7 +416,7 @@ by various version control systems.
 
   Flymake mode is a minor mode that performs on-the-fly syntax
 checking for many programming and markup languages, including C, C++,
-Perl, HTML, and @TeX{}/La@TeX{}.  It is somewhat analogous to Flyspell
+Perl, HTML, and @TeX{}/@LaTeX{}.  It is somewhat analogous to Flyspell
 mode, which performs spell checking for ordinary human languages in a
 similar fashion (@pxref{Spelling}).  As you edit a file, Flymake mode
 runs an appropriate syntax checking tool in the background, using a
index ff00df58c455c545702170e1badb7e0ecf59ef87..fdf1c65fcd6d56881ca9c9d8065aab95cfca7f51 100644 (file)
@@ -345,7 +345,7 @@ calendar deletes or iconifies that frame depending on the value of
 @node Writing Calendar Files
 @section Writing Calendar Files
 
-  You can write calendars and diary entries to HTML and La@TeX{} files.
+  You can write calendars and diary entries to HTML and @LaTeX{} files.
 
 @cindex calendar and HTML
   The Calendar HTML commands produce files of HTML code that contain
@@ -380,8 +380,8 @@ non-@code{nil}, then the monthly calendars show the day-of-the-year
 number. The variable @code{cal-html-year-index-cols} specifies the
 number of columns in the yearly index page.
 
-@cindex calendar and La@TeX{}
-  The Calendar La@TeX{} commands produce a buffer of La@TeX{} code that
+@cindex calendar and @LaTeX{}
+  The Calendar @LaTeX{} commands produce a buffer of @LaTeX{} code that
 prints as a calendar.  Depending on the command you use, the printed
 calendar covers the day, week, month or year that point is in.
 
@@ -441,7 +441,7 @@ the individual cal-tex functions to see which calendars support which
 features.
 
   You can use the variable @code{cal-tex-preamble-extra} to insert extra
-La@TeX{} commands in the preamble of the generated document if you need
+@LaTeX{} commands in the preamble of the generated document if you need
 to.
 
 @node Holidays
index 91cb0786a8667ce61b5972f25a2d90cf22a52fb0..2dea1577c04abc66f1a6908c3425fdb227c78017 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Emacs Invocation, X Resources, GNU Free Documentation License, Top
+@node Emacs Invocation
 @appendix Command Line Arguments for Emacs Invocation
 @cindex command line arguments
 @cindex arguments (command line)
index 9678adfe87f8f5586c4e1cc09f8f4bf2954c9033..e63a98a97229fd9f91b7586b7d03b66d5c6362a6 100644 (file)
@@ -15,7 +15,7 @@ input.
 @raisesections
 @end ifnottex
 
-@node User Input, Keys, Screen, Top
+@node User Input
 @section Kinds of User Input
 @cindex input with the keyboard
 @cindex keyboard input
@@ -80,7 +80,7 @@ as @dfn{input events}.  For details about how Emacs internally handles
 input events, see @ref{Input Events,,, elisp, The Emacs Lisp Reference
 Manual}.
 
-@node Keys, Commands, User Input, Top
+@node Keys
 @section Keys
 
   Some Emacs commands are invoked by just one input event; for
@@ -133,7 +133,7 @@ exception to this rule is @key{ESC}: @kbd{@key{ESC} C-h} is equivalent
 to @kbd{C-M-h}, which does something else entirely.  You can, however,
 use @key{F1} to display a list of commands starting with @key{ESC}.
 
-@node Commands, Entering Emacs, Keys, Top
+@node Commands
 @section Keys and Commands
 
 @cindex binding
index b6a82ed3888919bf6e7aac44ac034f57a6326505..2da70227c29cd2ac3d155151784e39d043994a0a 100644 (file)
@@ -766,7 +766,7 @@ displays something like this:
 fill-column is a variable defined in `C source code'.
 fill-column's value is 70
 
-Automatically becomes buffer-local when set in any fashion.
+Automatically becomes buffer-local when set.
 This variable is safe as a file local variable if its value
 satisfies the predicate `integerp'.
 
@@ -864,7 +864,7 @@ other modes based on Text mode:
 @noindent
 This works by calling @code{auto-fill-mode}, which enables the minor
 mode when no argument is supplied (@pxref{Minor Modes}).  Next,
-suppose you don't want Auto Fill mode turned on in La@TeX{} mode,
+suppose you don't want Auto Fill mode turned on in @LaTeX{} mode,
 which is one of the modes based on Text mode.  You can do this with
 the following additional line:
 
@@ -876,7 +876,7 @@ the following additional line:
 Here we have used the special macro @code{lambda} to construct an
 anonymous function (@pxref{Lambda Expressions,,, elisp, The Emacs Lisp
 Reference Manual}), which calls @code{auto-fill-mode} with an argument
-of @code{-1} to disable the minor mode.  Because La@TeX{} mode runs
+of @code{-1} to disable the minor mode.  Because @LaTeX{} mode runs
 @code{latex-mode-hook} after running @code{text-mode-hook}, the result
 leaves Auto Fill mode disabled.
 
@@ -1282,7 +1282,9 @@ specified in @file{.dir-locals.el}, as though they had been defined as
 file-local variables for that file (@pxref{File Variables}).  Emacs
 searches for @file{.dir-locals.el} starting in the directory of the
 visited file, and moving up the directory tree.  To avoid slowdown,
-this search is skipped for remote files.
+this search is skipped for remote files.  If needed, the search can be
+extended for remote files by setting the variable
+@code{enable-remote-dir-locals} to @code{t}.
 
   The @file{.dir-locals.el} file should hold a specially-constructed
 list, which maps major mode names (symbols) to alists
@@ -2101,11 +2103,12 @@ loading of this library, use the option @samp{--no-site-file}.
 better to put them in @file{default.el}, so that users can more easily
 override them.
 
+@cindex site-lisp directories
   You can place @file{default.el} and @file{site-start.el} in any of
 the directories which Emacs searches for Lisp libraries.  The variable
 @code{load-path} (@pxref{Lisp Libraries}) specifies these directories.
-Many sites put these files in the @file{site-lisp} subdirectory of the
-Emacs installation directory, typically
+Many sites put these files in a subdirectory named @file{site-lisp} in
+the Emacs installation directory, such as
 @file{/usr/local/share/emacs/site-lisp}.
 
   Byte-compiling your init file is not recommended (@pxref{Byte
index e0128a4679cf762febd8d7544ac3e3402e558c2c..2fa711272987fd2bb698c06bfb2bad0ab32ad8a1 100644 (file)
@@ -3,7 +3,7 @@
 @c   Free Software Foundation, Inc.
 
 @c See file emacs.texi for copying conditions.
-@node Display, Search, Registers, Top
+@node Display
 @chapter Controlling the Display
 
   Since only part of a large buffer fits in the window, Emacs has to
index aaeeda24d45e0b0ff94da9a7081c770cbc8a3634..6b39803f7d058f27cbeee663b57ca2d16c4ccd53 100644 (file)
@@ -107,7 +107,7 @@ Cover art by Etienne Suvasa; cover design by Matt Lee.
 
 
 @ifnottex
-@node Top, Distrib, (dir), (dir)
+@node Top
 @top The Emacs Editor
 
 Emacs is the extensible, customizable, self-documenting real-time
@@ -131,17 +131,6 @@ Emacs Lisp Reference Manual}.
 @menu
 * Distrib::             How to get the latest Emacs distribution.
 * Intro::               An introduction to Emacs concepts.
-@c Note that in the printed manual, the glossary and indices come last.
-* Glossary::            Terms used in this manual.
-
-Indexes (each index contains a large menu)
-* Key Index::           An item for each standard Emacs key sequence.
-* Option Index::        An item for every command-line option.
-* Command Index::       An item for each command name.
-* Variable Index::      An item for each documented variable.
-* Concept Index::       An item for each concept.
-
-* Acknowledgments::     Major contributors to GNU Emacs.
 
 Important General Concepts
 * Screen::              How to interpret what you see on the screen.
@@ -224,6 +213,18 @@ Appendices
 * Microsoft Windows::   Using Emacs on Microsoft Windows and MS-DOS.
 * Manifesto::           What's GNU?  Gnu's Not Unix!
 
+* Glossary::            Terms used in this manual.
+@ifnottex
+* Acknowledgments::     Major contributors to GNU Emacs.
+@end ifnottex
+
+Indexes (each index contains a large menu)
+* Key Index::           An item for each standard Emacs key sequence.
+* Option Index::        An item for every command-line option.
+* Command Index::       An item for each command name.
+* Variable Index::      An item for each documented variable.
+* Concept Index::       An item for each concept.
+
 @c Do NOT modify the following 3 lines!  They must have this form to
 @c be correctly identified by `texinfo-multiple-files-update'.  In
 @c particular, the detailed menu header line MUST be identical to the
@@ -1284,7 +1285,7 @@ Windows.  @xref{Mac OS / GNUstep}, for information about using Emacs
 on Macintosh (and GNUstep).
 @end iftex
 
-@node Distrib, Intro, Top, Top
+@node Distrib
 @unnumbered Distribution
 
 GNU Emacs is @dfn{free software}; this means that everyone is free to
@@ -1341,12 +1342,12 @@ USA
 @end display
 
 @iftex
-@node Acknowledgments, Intro, Distrib, Top
+@node Acknowledgments
 @unnumberedsec Acknowledgments
 
 Contributors to GNU Emacs include Jari Aalto, Per Abrahamsen, Tomas
 Abrahamsson, Jay K.@: Adams, Alon Albert, Michael Albinus, Nagy
-Andras, Benjamin Andresen, Ralf Angeli, Joe Arceneaux, Emil Åström,
+Andras, Benjamin Andresen, Ralf Angeli, Dmitry Antipov, Joe Arceneaux, Emil Åström,
 Miles Bader, David Bakhash, Juanma Barranquero, Eli Barzilay, Thomas
 Baumann, Steven L.@: Baur, Jay Belanger, Alexander L.@: Belikoff,
 Thomas Bellman, Scott Bender, Boaz Ben-Zvi, Sergey Berezin, Karl
@@ -1448,7 +1449,7 @@ Shenghuo Zhu, Piotr Zielinski, Ian T.@: Zimmermann, Reto Zimmermann,
 Neal Ziring, Teodor Zlatanov, and Detlev Zundel.
 @end iftex
 
-@node Intro, Glossary, Distrib, Top
+@node Intro
 @unnumbered Introduction
 
   You are reading about GNU Emacs, the GNU incarnation of the
@@ -1529,11 +1530,11 @@ Lisp programming.
 @include custom.texi
 @include trouble.texi
 
-@node Copying, GNU Free Documentation License, Service, Top
+@node Copying
 @appendix GNU GENERAL PUBLIC LICENSE
 @include gpl.texi
 
-@node GNU Free Documentation License, Emacs Invocation, Copying, Top
+@node GNU Free Documentation License
 @appendix GNU Free Documentation License
 @include doclicense.texi
 
@@ -1553,43 +1554,26 @@ Lisp programming.
 @c The Option Index is produced only in the on-line version,
 @c because the index entries related to command-line options
 @c tend to point to the same pages and all begin with a dash.
-@c This, and the need to keep the node links consistent, are
-@c the reasons for the funky @iftex/@ifnottex dance below.
-@c The Option Index is _not_ before Key Index, because that
-@c would require changes in the glossary.texi's @node line.
-@c It is not after Concept Index for similar reasons.
 
-@iftex
-@node Key Index, Command Index, Glossary, Top
+@node Key Index
 @unnumbered Key (Character) Index
 @printindex ky
-@end iftex
 
 @ifnottex
-@node Key Index, Option Index, Glossary, Top
-@unnumbered Key (Character) Index
-@printindex ky
-
-@node Option Index, Command Index, Key Index, Top
+@node Option Index
 @unnumbered Command-Line Options Index
 @printindex op
-
-@node Command Index, Variable Index, Option Index, Top
-@unnumbered Command and Function Index
-@printindex fn
 @end ifnottex
 
-@iftex
-@node Command Index, Variable Index, Key Index, Top
+@node Command Index
 @unnumbered Command and Function Index
 @printindex fn
-@end iftex
 
-@node Variable Index, Concept Index, Command Index, Top
+@node Variable Index
 @unnumbered Variable Index
 @printindex vr
 
-@node Concept Index, Acknowledgments, Variable Index, Top
+@node Concept Index
 @unnumbered Concept Index
 @printindex cp
 
index 1c12f47497c85998d11c08a3e340f2aee3086406..88c6f2c6045b082359bcdb6f5950569a943042c2 100644 (file)
@@ -1,4 +1,4 @@
 @c It would be nicer to generate this using configure and @version@.
 @c However, that would mean emacsver.texi would always be newer
 @c then the info files in release tarfiles.
-@set EMACSVER 24.1
+@set EMACSVER 24.1.50
index 3ec51ddfb604f9cac88218db800837e6e8c39933..de143516ce8dd70028741fea5a4cd5d69fc92d95 100644 (file)
@@ -12,7 +12,7 @@
 @raisesections
 @end ifnottex
 
-@node Entering Emacs, Exiting, Commands, Top
+@node Entering Emacs
 @section Entering Emacs
 @cindex entering Emacs
 @cindex starting Emacs
@@ -85,7 +85,7 @@ the desired file or directory.
 or @code{t}, which means to display the @file{*scratch*} buffer.
 @end ignore
 
-@node Exiting, Basic, Entering Emacs, Top
+@node Exiting
 @section Exiting Emacs
 @cindex exiting
 @cindex killing Emacs
index 3ee1df99a99f1dad3b893577e8fd33f4560082bc..422100e27b9e7351f115f83c0674181a6f7fb9d2 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Files, Buffers, Keyboard Macros, Top
+@node Files
 @chapter File Handling
 @cindex files
 
@@ -739,6 +739,11 @@ directory.)  Emacs removes the lock when you save the changes.  The
 idea is that the file is locked whenever an Emacs buffer visiting it
 has unsaved changes.
 
+@vindex create-lockfiles
+  You can prevent the creation of lock files by setting the variable
+@code{create-lockfiles} to @code{nil}.  @strong{Caution:} by
+doing so you will lose the benefits that this feature provides.
+
 @cindex collision
   If you begin to modify the buffer while the visited file is locked by
 someone else, this constitutes a @dfn{collision}.  When Emacs detects a
index 5de54a4ba1e1b3b77303e3bade5f98c88805857d..b9199eba553901a4626ad449b1632d6913aeab8c 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Fixit, Keyboard Macros, Search, Top
+@node Fixit
 @chapter Commands for Fixing Typos
 @cindex typos, fixing
 @cindex mistakes, correcting
index cf276c44d0f3e1551c46e383ddeb6569993130b0..fee91d370c3f3ebc50accd36f288709aac09f91c 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Frames, International, Windows, Top
+@node Frames
 @chapter Frames and Graphical Displays
 @cindex frames
 
index 6fe554419716d92acdae5cf0780ec397c680bdc3..0912cfe5311ab794d4dcb141dbe45b50c223f19e 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Glossary, Key Index, Intro, Top
+@node Glossary
 @unnumbered Glossary
 
 @table @asis
index ac9b9de6dcb4bd9fd296bc094eafc97a1010d3f7..0f21dd635db369aa58f853e730021713b06421cc 100644 (file)
@@ -10,7 +10,7 @@
 @c Modified versions may not be made.
 
 @ifclear justgnu
-@node Manifesto,, Microsoft Windows, Top
+@node Manifesto
 @unnumbered The GNU Manifesto
 @end ifclear
 @ifset justgnu
index e8c5614ff58afaf52f14175f0a9017ded6813ea2..d09885c5eddbadbffdd5842c5497f1c62dd9acb5 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Help, Mark, M-x, Top
+@node Help
 @chapter Help
 @kindex Help
 @cindex help
index 3892dc2ae992cf91d5810a1864d8610a64012470..08914d203400bbd1e053db1d92f2458be9c4d994 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Indentation, Text, Modes, Top
+@node Indentation
 @chapter Indentation
 @cindex indentation
 @cindex tabs
index 270ca9e77a8f3cfdb6a37ecef0a31a731d0026f7..a034c6168aa76c6ebf890b60f810989ea5c5e40c 100644 (file)
@@ -3,7 +3,7 @@
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 
-@node Killing, Registers, Mark, Top
+@node Killing
 @chapter Killing and Moving Text
 
   In Emacs, @dfn{killing} means erasing text and copying it into the
index e7522a9db438fc426373b75dd77fab8fb4b740e5..7a3f3151e5ce36f30eac1ad21aef63c51cfcc2c2 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Keyboard Macros, Files, Fixit, Top
+@node Keyboard Macros
 @chapter Keyboard Macros
 @cindex defining keyboard macros
 @cindex keyboard macro
index 81ceb1e3ac9af754600ed6c760221cab6bfe0dc3..5412c88af921ca2c4df627eacf043a33d94074f6 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node M-x, Help, Minibuffer, Top
+@node M-x
 @chapter Running Commands by Name
 
   Every Emacs command has a name that you can use to run it.  For
index 695f8f9c6c358400f837ead18d98ef56fe2d0c45..14c5fcae0ce919991c005f8e2fa7725874e848f2 100644 (file)
@@ -1,7 +1,7 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 2000-2012 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Mac OS / GNUstep, Microsoft Windows, Antinews, Top
+@node Mac OS / GNUstep
 @appendix Emacs and Mac OS / GNUstep
 @cindex Mac OS X
 @cindex Macintosh
@@ -31,7 +31,7 @@ Support}), but we hope to improve it in the future.
 * GNUstep Support::             Details on status of GNUstep support.
 @end menu
 
-@node Mac / GNUstep Basics, Mac / GNUstep Customization, , Mac OS / GNUstep
+@node Mac / GNUstep Basics
 @section Basic Emacs usage under Mac OS and GNUstep
 
   By default, the @key{alt} and @key{option} keys are the same as
@@ -84,7 +84,7 @@ For the PATH and MANPATH variables, a system-wide method
 of setting PATH is recommended on Mac OS X 10.5 and later, using the
 @file{/etc/paths} files and the @file{/etc/paths.d} directory.
 
-@node Mac / GNUstep Customization, Mac / GNUstep Events, Mac / GNUstep Basics, Mac OS / GNUstep
+@node Mac / GNUstep Customization
 @section Mac / GNUstep Customization
 
 Emacs can be customized in several ways in addition to the standard
@@ -125,7 +125,7 @@ move the mouse pointer over it.  (Requires Mac OS X 10.6 or later.)
 @end table
 
 
-@node Mac / GNUstep Events, GNUstep Support, Mac / GNUstep Customization, Mac OS / GNUstep
+@node Mac / GNUstep Events
 @section Windowing System Events under Mac OS / GNUstep
 
   Nextstep applications receive a number of special events which have
@@ -202,7 +202,7 @@ and return the result as a string.  You can also use the Lisp function
 services and receive the results back.  Note that you may need to
 restart Emacs to access newly-available services.
 
-@node GNUstep Support, , Mac / GNUstep Events, Mac OS / GNUstep
+@node GNUstep Support
 @section GNUstep Support
 
 Emacs can be built and run under GNUstep, but there are still
index 3517500cd51a73039fa8c808454f6ccb81a89798..c719c483ec825386ddd0ab108b9fcbb5630dfff6 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Maintaining, Abbrevs, Building, Top
+@node Maintaining
 @chapter Maintaining Large Programs
 
   This chapter describes Emacs features for maintaining large
@@ -1659,7 +1659,7 @@ Tags for variables and functions in classes are named
 @samp{@var{class}.@var{variable}} and @samp{@var{class}.@var{function}}.
 
 @item
-In La@TeX{} documents, the arguments for @code{\chapter},
+In @LaTeX{} documents, the arguments for @code{\chapter},
 @code{\section}, @code{\subsection}, @code{\subsubsection},
 @code{\eqno}, @code{\label}, @code{\ref}, @code{\cite},
 @code{\bibitem}, @code{\part}, @code{\appendix}, @code{\entry},
index 488ccbaaf52112d5c2db53de0aecd9537a8d785b..4ccecbb7ddf7056c360544801e2078dfca474de2 100644 (file)
@@ -1,6 +1,6 @@
 #### -*- Makefile -*- for the Emacs Manual
 
-# Copyright (C) 2003-2012  Free Software Foundation, Inc.
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -30,7 +30,9 @@ infodir = $(srcdir)/../../info
 MAKEINFO = makeinfo
 MAKEINFO_OPTS = --force --enable-encoding -I$(srcdir)
 MULTI_INSTALL_INFO = $(srcdir)\..\..\nt\multi-install-info.bat
-INFO_TARGETS = $(infodir)/emacs
+INFO_EXT=.info
+INFO_OPTS=--no-split
+INFO_TARGETS = $(infodir)/emacs$(INFO_EXT)
 DVI_TARGETS =  emacs.dvi
 INFOSOURCES = info.texi
 
@@ -114,8 +116,8 @@ dvi: $(DVI_TARGETS)
 $(infodir)/dir:
        $(MULTI_INSTALL_INFO) --info-dir=$(infodir) $(INFO_TARGETS)
 
-$(infodir)/emacs: $(EMACSSOURCES)
-       $(MAKEINFO) $(MAKEINFO_OPTS) emacs.texi
+$(infodir)/emacs$(INFO_EXT): $(EMACSSOURCES)
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ emacs.texi
 
 emacs.dvi: $(EMACSSOURCES)
        $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs.texi
@@ -129,6 +131,7 @@ emacs-xtra.dvi: emacs-xtra.texi $(EMACS_XTRA)
 mostlyclean:
        - $(DEL) *.log *.cp *.fn *.ky *.pg *.vr core *.tp *.core gnustmp.*
 
+## FIXME $(infodir)/emacs* deletes too much, eg emacs-mime.
 clean: mostlyclean
        - $(DEL) *.dvi
        - $(DEL) $(infodir)/emacs*
index 9a15f9454ddb286aff692a9c8017c34f2f088834..83d519a4cd2da661779cd102fe865b4249dd21b7 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Mark, Killing, Help, Top
+@node Mark
 @chapter The Mark and the Region
 @cindex mark
 @cindex setting a mark
index f50e3085f2df167c694188adfbc2dbcbfae884b7..2856db7a4fa1db59cfd29b3d6bd21667b7cbddc3 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Minibuffer, M-x, Basic, Top
+@node Minibuffer
 @chapter The Minibuffer
 @cindex minibuffer
 
index 45689409bb0d63fa913fd65acb0563ff5b1bf937..90072d19a699e4dfce6aa1a123941f94c694e124 100644 (file)
@@ -1324,7 +1324,7 @@ bit, and 1 stopbit.
 with your device and will probably only see garbage output in the
 window.
 
-@node Emacs Server, Printing, Shell, Top
+@node Emacs Server
 @section Using Emacs as a Server
 @pindex emacsclient
 @cindex Emacs as a server
@@ -1642,7 +1642,7 @@ text terminal.  If you supply both options, Emacs visits the specified
 files(s) in an existing frame rather than a new client frame, negating
 the effect of @samp{-t}.
 
-@node Printing, Sorting, Emacs Server, Top
+@node Printing
 @section Printing Hard Copies
 @cindex hardcopy
 @cindex printing
@@ -1710,7 +1710,7 @@ printer program is not compatible with @command{lpr}).
 * Printing Package::     An optional advanced printing interface.
 @end menu
 
-@node PostScript, PostScript Variables,, Printing
+@node PostScript
 @subsection PostScript Hardcopy
 
   These commands convert buffer contents to PostScript,
@@ -1779,7 +1779,7 @@ rendition of the current buffer as a cursive handwritten document.  It
 can be customized in group @code{handwrite}.  This function only
 supports ISO 8859-1 characters.
 
-@node PostScript Variables, Printing Package, PostScript, Printing
+@node PostScript Variables
 @subsection Variables for PostScript Hardcopy
 
 @vindex ps-lpr-command
@@ -1874,7 +1874,7 @@ includes a single directory @file{/usr/local/share/emacs/fonts/bdf}.
   Many other customization variables for these commands are defined and
 described in the Lisp files @file{ps-print.el} and @file{ps-mule.el}.
 
-@node Printing Package,, PostScript Variables, Printing
+@node Printing Package
 @subsection Printing Package
 @cindex Printing package
 
@@ -2098,7 +2098,7 @@ bytes, move by @code{short}s or @code{int}s, etc.; type @kbd{C-h a
 hexl-@key{RET}} for details.
 
 
-@node Saving Emacs Sessions, Recursive Edit, Editing Binary Files, Top
+@node Saving Emacs Sessions
 @section Saving Emacs Sessions
 @cindex saving sessions
 @cindex restore session
@@ -2164,7 +2164,7 @@ expression matching the names of buffers not to kill.
   If you want to save minibuffer history from one session to
 another, use the @code{savehist} library.
 
-@node Recursive Edit, Emulation, Saving Emacs Sessions, Top
+@node Recursive Edit
 @section Recursive Editing Levels
 @cindex recursive editing level
 @cindex editing level, recursive
@@ -2232,7 +2232,7 @@ new major mode which provides a command to switch back.  These
 approaches give you more flexibility to go back to unfinished tasks in
 the order you choose.
 
-@node Emulation, Hyperlinking, Recursive Edit, Top
+@node Emulation
 @section Emulation
 @cindex emulating other editors
 @cindex other editors
@@ -2324,7 +2324,7 @@ not use it.
 key bindings.
 @end table
 
-@node Hyperlinking, Amusements, Emulation, Top
+@node Hyperlinking
 @section Hyperlinking and Navigation Features
 
   The following subsections describe convenience features for handling
@@ -2475,7 +2475,7 @@ Display a menu of files and URLs mentioned in current buffer, then
 find the one you select (@code{ffap-menu}).
 @end table
 
-@node Amusements, Packages, Hyperlinking, Top
+@node Amusements
 @section Other Amusements
 @cindex boredom
 
index a48299768a8ceb338bd791b84e56bdbb9ed51331..c619b1eb47e0f320fc32aef44c4c9a5c540f2a68 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Modes, Indentation, International, Top
+@node Modes
 @chapter Major and Minor Modes
 
   Emacs contains many @dfn{editing modes} that alter its basic
index b3ce825c887ca421dddcf2671e80f4531fc0fadc..d8f9bb6961d8e48314b953a0a937abbcee91fe07 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Microsoft Windows, Manifesto, Mac OS / GNUstep, Top
+@node Microsoft Windows
 @appendix Emacs and Microsoft Windows/MS-DOS
 @cindex Microsoft Windows
 @cindex MS-Windows, Emacs peculiarities
index 01ff980b0caace75c7ef956cacf8c3b4444ac135..1dfae79c7885a1094053700591f2adcec4f7b881 100644 (file)
@@ -1,7 +1,7 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1997, 1999-2012 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node International, Modes, Frames, Top
+@node International
 @chapter International Character Set Support
 @c This node is referenced in the tutorial.  When renaming or deleting
 @c it, the tutorial needs to be adjusted.  (TUTORIAL.de)
@@ -146,7 +146,7 @@ displayed on your terminal, they appear as @samp{?} or as hollow boxes
 used, generally don't have keys for all the characters in them.  You
 can insert characters that your keyboard does not support, using
 @kbd{C-q} (@code{quoted-insert}) or @kbd{C-x 8 @key{RET}}
-(@code{ucs-insert}).  @xref{Inserting Text}.  Emacs also supports
+(@code{insert-char}).  @xref{Inserting Text}.  Emacs also supports
 various @dfn{input methods}, typically one for each script or
 language, which make it easier to type characters in the script.
 @xref{Input Methods}.
@@ -287,20 +287,17 @@ auto mode selection.
 This includes the Emacs initialization
 file, @file{.emacs}, and the initialization files of packages
 such as Gnus.  However, you can specify unibyte loading for a
-particular Lisp file, by adding an entry @samp{unibyte: t} in a file
-local variables section (@pxref{File Variables}).  Then that file is
-always loaded as unibyte text.  Note that this does not represent a
-real @code{unibyte} variable, rather it just acts as an indicator
-to Emacs in the same way as @code{coding} does (@pxref{Specify Coding}).
+particular Lisp file, by adding an entry @samp{coding: raw-text} in a file
+local variables section.  @xref{Specify Coding}.
+Then that file is always loaded as unibyte text.
 @ignore
 @c I don't see the point of this statement:
 The motivation for these conventions is that it is more reliable to
 always load any particular Lisp file in the same way.
 @end ignore
-Note also that this feature only applies to @emph{loading} Lisp files
-for evaluation, not to visiting them for editing.  You can also load a
-Lisp file as unibyte, on any one occasion, by typing @kbd{C-x
-@key{RET} c raw-text @key{RET}} immediately before loading it.
+You can also load a Lisp file as unibyte, on any one occasion, by
+typing @kbd{C-x @key{RET} c raw-text @key{RET}} immediately before
+loading it.
 
 @c See http://debbugs.gnu.org/11226 for lack of unibyte tooltip.
 @vindex enable-multibyte-characters
@@ -551,7 +548,7 @@ possible characters to type next is displayed in the echo area (but
 not when you are in the minibuffer).
 
   Another facility for typing characters not on your keyboard is by
-using @kbd{C-x 8 @key{RET}} (@code{ucs-insert}) to insert a single
+using @kbd{C-x 8 @key{RET}} (@code{insert-char}) to insert a single
 character based on its Unicode name or code-point; see @ref{Inserting
 Text}.
 
index 9930edfd720b0d2a91be8f1d83d6871c130c5a7b..e5340655770020df3142195535444fc877930d08 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Programs, Building, Text, Top
+@node Programs
 @chapter Editing Programs
 @cindex Lisp editing
 @cindex C editing
index d02ddd64b498db0a6935350f0c53dca38863912a..72fd6458dde189ad137b400a720df8f6b26297d6 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Registers, Display, Killing, Top
+@node Registers
 @chapter Registers
 @cindex registers
 
index fbea52523ba16c5f84f3902ebd19a082dc4ba97b..989cf998bfd1112f34b676143ef222b59332d6e8 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Screen, User Input, Acknowledgments, Top
+@node Screen
 @chapter The Organization of the Screen
 @cindex screen
 @cindex frame
index 152ac605843a56d4ef0e9b09f8fe13d67154e540..d5c9783b77266539e363074151d6b69a463fb281 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Search, Fixit, Display, Top
+@node Search
 @chapter Searching and Replacement
 @cindex searching
 @cindex finding strings within text
@@ -981,7 +981,7 @@ command @code{expand-region-abbrevs} (@pxref{Expanding Abbrevs}).
 * Query Replace::           How to use querying.
 @end menu
 
-@node Unconditional Replace, Regexp Replace, Replace, Replace
+@node Unconditional Replace
 @subsection Unconditional Replacement
 @findex replace-string
 
@@ -1011,7 +1011,7 @@ surrounded by word boundaries.
   @xref{Replacement and Case}, for details about case-sensitivity in
 replace commands.
 
-@node Regexp Replace, Replacement and Case, Unconditional Replace, Replace
+@node Regexp Replace
 @subsection Regexp Replacement
 @findex replace-regexp
 
@@ -1098,7 +1098,7 @@ M-x replace-regexp @key{RET} ^.\@{0,72\@}$ @key{RET}
 \,(format "%-72sABC%05d" \& \#) @key{RET}
 @end example
 
-@node Replacement and Case, Query Replace, Regexp Replace, Replace
+@node Replacement and Case
 @subsection Replace Commands and Case
 
   If the first argument of a replace command is all lower case, the
@@ -1130,7 +1130,7 @@ exactly as given, with no case conversion.  Likewise, if either
 @code{case-replace} or @code{case-fold-search} is set to @code{nil},
 replacement is done without case conversion.
 
-@node Query Replace,, Replacement and Case, Replace
+@node Query Replace
 @subsection Query Replace
 @cindex query replace
 
index fd47401252558351108311c5196c398d82f764d5..f10e78e17adf7eb32402faf6f3f38bc4c0ee7de0 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Text, Programs, Indentation, Top
+@node Text
 @chapter Commands for Human Languages
 @cindex text
 @cindex manipulating text
@@ -34,7 +34,7 @@ publish them in many formats.
 @cindex mode, nXML
 @findex nxml-mode
   Emacs has other major modes for text which contains ``embedded''
-commands, such as @TeX{} and La@TeX{} (@pxref{TeX Mode}); HTML and
+commands, such as @TeX{} and @LaTeX{} (@pxref{TeX Mode}); HTML and
 SGML (@pxref{HTML Mode}); XML
 @ifinfo
 (@pxref{Top,The nXML Mode Manual,,nxml-mode, nXML Mode});
@@ -1372,7 +1372,7 @@ etc.
 export and publication.  To export the current buffer, type @kbd{C-c
 C-e} (@code{org-export}) anywhere in an Org buffer.  This command
 prompts for an export format; currently supported formats include
-HTML, La@TeX{}, OpenDocument (@file{.odt}), and PDF.  Some formats,
+HTML, @LaTeX{}, OpenDocument (@file{.odt}), and PDF.  Some formats,
 such as PDF, require certain system tools to be installed.
 
 @vindex org-publish-project-alist
@@ -1405,11 +1405,11 @@ This is an example.
 @node TeX Mode
 @section @TeX{} Mode
 @cindex @TeX{} mode
-@cindex La@TeX{} mode
+@cindex @LaTeX{} mode
 @cindex Sli@TeX{} mode
 @cindex Doc@TeX{} mode
 @cindex mode, @TeX{}
-@cindex mode, La@TeX{}
+@cindex mode, @LaTeX{}
 @cindex mode, Sli@TeX{}
 @cindex mode, Doc@TeX{}
 @findex tex-mode
@@ -1422,15 +1422,15 @@ This is an example.
   Emacs provides special major modes for editing files written in
 @TeX{} and its related formats.  @TeX{} is a powerful text formatter
 written by Donald Knuth; like GNU Emacs, it is free software.
-La@TeX{} is a simplified input format for @TeX{}, implemented using
+@LaTeX{} is a simplified input format for @TeX{}, implemented using
 @TeX{} macros.  Doc@TeX{} is a special file format in which the
-La@TeX{} sources are written, combining sources with documentation.
-Sli@TeX{} is an obsolete special form of La@TeX{}.@footnote{It has
+@LaTeX{} sources are written, combining sources with documentation.
+Sli@TeX{} is an obsolete special form of @LaTeX{}.@footnote{It has
 been replaced by the @samp{slides} document class, which comes with
-La@TeX{}.}
+@LaTeX{}.}
 
 @vindex tex-default-mode
-  @TeX{} mode has four variants: Plain @TeX{} mode, La@TeX{} mode,
+  @TeX{} mode has four variants: Plain @TeX{} mode, @LaTeX{} mode,
 Doc@TeX{} mode, and Sli@TeX{} mode.  These distinct major modes differ
 only slightly, and are designed for editing the four different
 formats.  Emacs selects the appropriate mode by looking at the
@@ -1450,13 +1450,13 @@ which are not documented in this manual:
 @itemize @bullet
 @item
 Bib@TeX{} mode is a major mode for Bib@TeX{} files, which are commonly
-used for keeping bibliographic references for La@TeX{} documents.  For
+used for keeping bibliographic references for @LaTeX{} documents.  For
 more information, see the documentation string for the command
 @code{bibtex-mode}.
 
 @item
 The Ref@TeX{} package provides a minor mode which can be used with
-La@TeX{} mode to manage bibliographic references.
+@LaTeX{} mode to manage bibliographic references.
 @ifinfo
 @xref{Top,The Ref@TeX{} Manual,,reftex}.
 @end ifinfo
@@ -1561,23 +1561,23 @@ is useful for the various motion commands and automatic match display
 to work with them.
 
 @node LaTeX Editing
-@subsection La@TeX{} Editing Commands
+@subsection @LaTeX{} Editing Commands
 
-  La@TeX{} mode provides a few extra features not applicable to plain
+  @LaTeX{} mode provides a few extra features not applicable to plain
 @TeX{}:
 
 @table @kbd
 @item C-c C-o
-Insert @samp{\begin} and @samp{\end} for La@TeX{} block and position
+Insert @samp{\begin} and @samp{\end} for @LaTeX{} block and position
 point on a line between them (@code{tex-latex-block}).
 @item C-c C-e
-Close the innermost La@TeX{} block not yet closed
+Close the innermost @LaTeX{} block not yet closed
 (@code{tex-close-latex-block}).
 @end table
 
 @findex tex-latex-block
-@kindex C-c C-o @r{(La@TeX{} mode)}
-  In La@TeX{} input, @samp{\begin} and @samp{\end} tags are used to
+@kindex C-c C-o @r{(@LaTeX{} mode)}
+  In @LaTeX{} input, @samp{\begin} and @samp{\end} tags are used to
 group blocks of text.  To insert a block, type @kbd{C-c C-o}
 (@code{tex-latex-block}).  This prompts for a block type, and inserts
 the appropriate matching @samp{\begin} and @samp{\end} tags, leaving a
@@ -1586,14 +1586,14 @@ blank line between the two and moving point there.
 @vindex latex-block-names
   When entering the block type argument to @kbd{C-c C-o}, you can use
 the usual completion commands (@pxref{Completion}).  The default
-completion list contains the standard La@TeX{} block types.  If you
+completion list contains the standard @LaTeX{} block types.  If you
 want additional block types for completion, customize the list
 variable @code{latex-block-names}.
 
 @findex tex-close-latex-block
-@kindex C-c C-e @r{(La@TeX{} mode)}
+@kindex C-c C-e @r{(@LaTeX{} mode)}
 @findex latex-electric-env-pair-mode
-  In La@TeX{} input, @samp{\begin} and @samp{\end} tags must balance.
+  In @LaTeX{} input, @samp{\begin} and @samp{\end} tags must balance.
 You can use @kbd{C-c C-e} (@code{tex-close-latex-block}) to insert an
 @samp{\end} tag which matches the last unmatched @samp{\begin}.  It
 also indents the @samp{\end} to match the corresponding @samp{\begin},
@@ -1670,7 +1670,7 @@ such as @code{"/tmp"}.
   The buffer's @TeX{} variant determines what shell command @kbd{C-c
 C-b} actually runs.  In Plain @TeX{} mode, it is specified by the
 variable @code{tex-run-command}, which defaults to @code{"tex"}.  In
-La@TeX{} mode, it is specified by @code{latex-run-command}, which
+@LaTeX{} mode, it is specified by @code{latex-run-command}, which
 defaults to @code{"latex"}.  The shell command that @kbd{C-c C-v} runs
 to view the @file{.dvi} output is determined by the variable
 @code{tex-dvi-view-command}, regardless of the @TeX{} variant.  The
@@ -1725,9 +1725,9 @@ after.  The lines containing the two strings are included in the header.
 If @samp{%**start of header} does not appear within the first 100 lines of
 the buffer, @kbd{C-c C-r} assumes that there is no header.
 
-  In La@TeX{} mode, the header begins with @samp{\documentclass} or
+  In @LaTeX{} mode, the header begins with @samp{\documentclass} or
 @samp{\documentstyle} and ends with @samp{\begin@{document@}}.  These
-are commands that La@TeX{} requires you to use in any case, so nothing
+are commands that @LaTeX{} requires you to use in any case, so nothing
 special needs to be done to identify the header.
 
 @findex tex-file
@@ -1769,7 +1769,7 @@ Variables}.
 @findex tex-bibtex-file
 @kindex C-c TAB @r{(@TeX{} mode)}
 @vindex tex-bibtex-command
-  For La@TeX{} files, you can use Bib@TeX{} to process the auxiliary
+  For @LaTeX{} files, you can use Bib@TeX{} to process the auxiliary
 file for the current buffer's file.  Bib@TeX{} looks up bibliographic
 citations in a data base and prepares the cited references for the
 bibliography section.  The command @kbd{C-c @key{TAB}}
index 3bbdecc0176bd3bdc04d4b2cd1fe42c2c779940b..025185c583fb1d06ec388ea9460cec101ac4450a 100644 (file)
@@ -133,7 +133,7 @@ a command, but you can think of it as canceling a command that already
 finished executing.  @xref{Undo}, for more information about the undo
 facility.
 
-@node Lossage, Bugs, Quitting, Top
+@node Lossage
 @section Dealing with Emacs Trouble
 
   This section describes how to recognize and deal with situations in
@@ -373,7 +373,7 @@ program.
 emergency escape---but there are cases where it won't work, when
 system call hangs or when Emacs is stuck in a tight loop in C code.
 
-@node Bugs, Contributing, Lossage, Top
+@node Bugs
 @section Reporting Bugs
 
 @cindex bugs
@@ -1064,7 +1064,7 @@ Please help us keep up with the workload by designing the patch in a
 form that is clearly safe to install.
 @end itemize
 
-@node Contributing, Service, Bugs, Top
+@node Contributing
 @section Contributing to Emacs Development
 @cindex contributing to Emacs
 
@@ -1089,7 +1089,7 @@ See the Emacs project page
 For more information on how to contribute, see the @file{etc/CONTRIBUTE}
 file in the Emacs distribution.
 
-@node Service, Copying, Contributing, Top
+@node Service
 @section How To Get Help with GNU Emacs
 
 If you need help installing, using or changing GNU Emacs, there are two
index 72e01a368a19fce4ce000f92a536102bdc395399..2496a5050631ca7ff3b004a29f8e8158f4e1a06f 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Windows, Frames, Buffers, Top
+@node Windows
 @chapter Multiple Windows
 @cindex windows in Emacs
 @cindex multiple windows in Emacs
index b99c98d84e010054ea69fed051185513e664148a..5bdf734804b47254feb5e5d368c646957ccf9b69 100644 (file)
@@ -2,7 +2,7 @@
 @c Copyright (C) 1987, 1993-1995, 1997, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node X Resources, Antinews, Emacs Invocation, Top
+@node X Resources
 @appendix X Options and Resources
 
   You can customize some X-related aspects of Emacs behavior using X
index 0cf74ae5878aafb0bb9c83180fdc51e413d45b86..11eacf25c96eb65bd91d176ec66ccb22980900d9 100644 (file)
@@ -1,27 +1,40 @@
-2012-06-19  Glenn Morris  <rgm@gnu.org>
+2012-06-21  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in: Rename infodir to buildinfodir throughout.  (Bug#11737)
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-05-29  Glenn Morris  <rgm@gnu.org>
 
-       * Version 24.1 released.
+       * emacs-lisp-intro.texi: Nuke hand-written node pointers.
+       (dolist, dotimes): Fix sectioning.
 
-2012-05-04  Glenn Morris  <rgm@gnu.org>
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (MKDIR_P): New, set by configure.
+       (mkinfodir): Use $MKDIR_P.
+
+2012-05-05  Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp-intro.texi (Making Errors): Don't mention Emacs 20.
        (Void Function, Wrong Type of Argument, Recursion with list)
        (Simple Extension): Assume a non-ancient Emacs.
        (Void Variable, Switching Buffers): Improve page breaks.
 
-2012-05-03  Glenn Morris  <rgm@gnu.org>
-
        * emacs-lisp-intro.texi: Update GNU Press contact details.
 
-2012-04-28  Glenn Morris  <rgm@gnu.org>
+2012-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (INFO_EXT, INFO_OPTS): New, set by configure.
+       (info, infoclean): Use $INFO_EXT.
+       (${infodir}/eintr$(INFO_EXT)): Use $INFO_EXT and $INFO_OPT.
+       * makefile.w32-in (INFO_EXT, INFO_OPTS): New.
+       (INFO_TARGETS, clean): Use $INFO_EXT.
+       ($(infodir)/eintr$(INFO_EXT)): Use $INFO_EXT and $INFO_OPT.
+
+2012-05-02  Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp-intro.texi (Syntax): Reword to avoid underfull hbox.
 
-2012-04-07  Glenn Morris  <rgm@gnu.org>
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in: Replace non-portable use of $< in ordinary rules.
 
        `named' to `selected'.
        (lengths-list-file): Remove extraneous parenthesis from reference.
        (lengths-list-many-files): Explain `expand-file-name' better.
-       (Files List): Rephrase sentence regarding Lisp sources directory
+       (Files List): Rephrase sentence regarding Lisp sources directory.
 
 2006-11-04  Robert J. Chassell  <bob@rattlesnake.com>
 
index df5248dff3d78854d970fd37495fea5433d6993f..3f2fe1f9526285d81ab9404e1429ba4d84dea515 100644 (file)
@@ -26,6 +26,12 @@ buildinfodir = $(srcdir)/../../info
 # Directory with the (customized) texinfo.tex file.
 texinfodir = $(srcdir)/../misc
 
+MKDIR_P = @MKDIR_P@
+
+INFO_EXT=@INFO_EXT@
+# Options used only when making info output.
+INFO_OPTS=@INFO_OPTS@
+
 MAKEINFO = @MAKEINFO@
 MAKEINFO_OPTS = --force -I $(srcdir)
 TEXI2DVI = texi2dvi
@@ -35,11 +41,11 @@ DVIPS = dvips
 ENVADD = TEXINPUTS="$(srcdir):$(texinfodir):$(TEXINPUTS)" \
          MAKEINFO="$(MAKEINFO) $(MAKEINFO_OPTS)"
 
-mkinfodir = @test -d ${buildinfodir} || mkdir ${buildinfodir} || test -d ${buildinfodir}
+mkinfodir = @${MKDIR_P} ${buildinfodir}
 
 .PHONY: info dvi html pdf ps
 
-info: ${buildinfodir}/eintr
+info: ${buildinfodir}/eintr$(INFO_EXT)
 
 dvi: emacs-lisp-intro.dvi
 html: emacs-lisp-intro.html
@@ -49,9 +55,9 @@ ps: emacs-lisp-intro.ps
 # The file name eintr must fit within 5 characters, to allow for
 # -NN extensions to fit into DOS 8+3 limits without clashing.
 # Note: "<" is not portable in ordinary make rules.
-${buildinfodir}/eintr: ${srcdir}/emacs-lisp-intro.texi
+${buildinfodir}/eintr$(INFO_EXT): ${srcdir}/emacs-lisp-intro.texi
        $(mkinfodir)
-       $(MAKEINFO) $(MAKEINFO_OPTS) -o $@ ${srcdir}/emacs-lisp-intro.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/emacs-lisp-intro.texi
 
 emacs-lisp-intro.dvi: ${srcdir}/emacs-lisp-intro.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-lisp-intro.texi
@@ -79,7 +85,7 @@ clean: mostlyclean
 distclean: clean
 
 infoclean:
-       -cd $(buildinfodir) && rm -f eintr eintr-[1-9]
+       -cd $(buildinfodir) && rm -f eintr$(INFO_EXT) eintr$(INFO_EXT)-[1-9]
 
 maintainer-clean: distclean infoclean
 
index 9446333db2a6c6da117f9ba889299c7fb501590f..04e3e0c8649d3944096788fc4c57dcd8d6e51fc7 100644 (file)
@@ -315,7 +315,7 @@ supports it in developing GNU and promoting software freedom.''
 @contents
 
 @ifnottex
-@node Top, Preface, (dir), (dir)
+@node Top
 @top An Introduction to Programming in Emacs Lisp
 
 @insertcopying
@@ -829,8 +829,7 @@ Printing the Whole Graph
 @end detailmenu
 @end menu
 
-@node Preface, List Processing, Top, Top
-@comment  node-name,  next,  previous,  up
+@node Preface
 @unnumbered Preface
 
 Most of the GNU Emacs integrated environment is written in the programming
@@ -858,8 +857,8 @@ editing in the most general sense of the word.)
 * Thank You::
 @end menu
 
-@node Why, On Reading this Text, Preface, Preface
 @ifnottex
+@node Why
 @unnumberedsec Why Study Emacs Lisp?
 @end ifnottex
 
@@ -873,8 +872,7 @@ Emacs Lisp is designed to get you started: to guide you in learning the
 fundamentals of programming, and more importantly, to show you how you
 can teach yourself to go further.
 
-@node On Reading this Text, Who You Are, Why, Preface
-@comment  node-name,  next,  previous,  up
+@node On Reading this Text
 @unnumberedsec On Reading this Text
 
 All through this document, you will see little sample programs you can
@@ -924,8 +922,7 @@ Emacs to help you understand what puzzles you or to find out how to do
 something new.  This self-reliance is not only a pleasure, but an
 advantage.
 
-@node Who You Are, Lisp History, On Reading this Text, Preface
-@comment  node-name,  next,  previous,  up
+@node Who You Are
 @unnumberedsec For Whom This is Written
 
 This text is written as an elementary introduction for people who are
@@ -987,7 +984,7 @@ quoted above.  And, of course, after you have read this
 @cite{Introduction}, you will find the @cite{Reference Manual} useful
 when you are writing your own programs.
 
-@node Lisp History, Note for Novices, Who You Are, Preface
+@node Lisp History
 @unnumberedsec Lisp History
 @cindex Lisp history
 
@@ -1004,8 +1001,7 @@ standard in the 1980s.  However, Emacs Lisp is much simpler than Common
 Lisp.  (The standard Emacs distribution contains an optional extensions
 file, @file{cl.el}, that adds many Common Lisp features to Emacs Lisp.)
 
-@node Note for Novices, Thank You, Lisp History, Preface
-@comment  node-name,  next,  previous,  up
+@node Note for Novices
 @unnumberedsec A Note for Novices
 
 If you don't know GNU Emacs, you can still read this document
@@ -1052,8 +1048,7 @@ A note on terminology:  when I use the word Lisp alone, I often am
 referring to the various dialects of Lisp in general, but when I speak
 of Emacs Lisp, I am referring to GNU Emacs Lisp in particular.
 
-@node Thank You,  , Note for Novices, Preface
-@comment  node-name,  next,  previous,  up
+@node Thank You
 @unnumberedsec Thank You
 
 My thanks to all who helped me with this book.  My especial thanks to
@@ -1099,8 +1094,7 @@ Robert J. Chassell
 @global@pageno = 1
 @end iftex
 
-@node List Processing, Practicing Evaluation, Preface, Top
-@comment  node-name,  next,  previous,  up
+@node List Processing
 @chapter List Processing
 
 To the untutored eye, Lisp is a strange programming language.  In Lisp
@@ -1129,8 +1123,7 @@ Errors, , Generate an Error Message}.}  Lists are the basis of Lisp.
 * Error Message Exercises::
 @end menu
 
-@node Lisp Lists, Run a Program, List Processing, List Processing
-@comment  node-name,  next,  previous,  up
+@node Lisp Lists
 @section Lisp Lists
 @cindex Lisp Lists
 
@@ -1161,8 +1154,8 @@ like flowers in a field with a stone wall around them.
 * Typing Lists::                How GNU Emacs helps you type lists.
 @end menu
 
-@node Numbers Lists, Lisp Atoms, Lisp Lists, Lisp Lists
 @ifnottex
+@node Numbers Lists
 @unnumberedsubsec Numbers, Lists inside of Lists
 @end ifnottex
 
@@ -1190,8 +1183,7 @@ The components of this list are the words @samp{this}, @samp{list},
 list is made up of the words @samp{a}, @samp{list}, @samp{inside},
 @samp{of}, @samp{it}.
 
-@node Lisp Atoms, Whitespace in Lists, Numbers Lists, Lisp Lists
-@comment  node-name,  next,  previous,  up
+@node Lisp Atoms
 @subsection Lisp Atoms
 @cindex Lisp Atoms
 
@@ -1271,8 +1263,7 @@ is used for messages that a computer can print for a human to read.
 Strings are a different kind of atom than numbers or symbols and are
 used differently.
 
-@node Whitespace in Lists, Typing Lists, Lisp Atoms, Lisp Lists
-@comment  node-name,  next,  previous,  up
+@node Whitespace in Lists
 @subsection Whitespace in Lists
 @cindex Whitespace in lists
 
@@ -1312,8 +1303,7 @@ marks, a symbol looks like a word, and a number looks like a number.
 (For certain situations, square brackets, dots and a few other special
 characters may be used; however, we will go quite far without them.)
 
-@node Typing Lists,  , Whitespace in Lists, Lisp Lists
-@comment  node-name,  next,  previous,  up
+@node Typing Lists
 @subsection GNU Emacs Helps You Type Lists
 @cindex Help typing lists
 @cindex Formatting help
@@ -1335,8 +1325,7 @@ in Lisp must have its closing parenthesis match its opening
 parenthesis.  (@xref{Major Modes, , Major Modes, emacs, The GNU Emacs
 Manual}, for more information about Emacs's modes.)
 
-@node Run a Program, Making Errors, Lisp Lists, List Processing
-@comment  node-name,  next,  previous,  up
+@node Run a Program
 @section Run a Program
 @cindex Run a program
 @cindex Program, running one
@@ -1398,8 +1387,7 @@ from the humanly readable expression to the language of the computer.
 But before discussing this (@pxref{Variables}), we will discuss what the
 Lisp interpreter does when you make an error.
 
-@node Making Errors, Names & Definitions, Run a Program, List Processing
-@comment  node-name,  next,  previous,  up
+@node Making Errors
 @section Generate an Error Message
 @cindex Generate an error message
 @cindex Error message generation
@@ -1549,8 +1537,7 @@ The error message can be understood: @samp{Symbol's function
 definition is void:@: this}.  The symbol (that is, the word
 @samp{this}) lacks instructions for the computer to carry out.
 
-@node Names & Definitions, Lisp Interpreter, Making Errors, List Processing
-@comment  node-name,  next,  previous,  up
+@node Names & Definitions
 @section Symbol Names and Function Definitions
 @cindex Symbol names
 
@@ -1584,8 +1571,7 @@ Thus, all the names for functions that deal with Texinfo start with
 @samp{texinfo-} and those for functions that deal with reading mail
 start with @samp{rmail-}.
 
-@node Lisp Interpreter, Evaluation, Names & Definitions, List Processing
-@comment  node-name,  next,  previous,  up
+@node Lisp Interpreter
 @section The Lisp Interpreter
 @cindex Lisp interpreter, what it does
 @cindex Interpreter, what it does
@@ -1610,8 +1596,8 @@ yourself or the computer.
 * Byte Compiling::              Specially processing code for speed.
 @end menu
 
-@node Complications, Byte Compiling, Lisp Interpreter, Lisp Interpreter
 @ifnottex
+@node Complications
 @unnumberedsubsec Complications
 @end ifnottex
 
@@ -1642,7 +1628,7 @@ used by the enclosing expression.
 Otherwise, the interpreter works left to right, from one expression to
 the next.
 
-@node Byte Compiling,  , Complications, Lisp Interpreter
+@node Byte Compiling
 @subsection Byte Compiling
 @cindex Byte compiling
 
@@ -1665,8 +1651,7 @@ the topic here.  @xref{Byte Compilation, , Byte Compilation, elisp,
 The GNU Emacs Lisp Reference Manual}, for a full description of byte
 compilation.
 
-@node Evaluation, Variables, Lisp Interpreter, List Processing
-@comment  node-name,  next,  previous,  up
+@node Evaluation
 @section Evaluation
 @cindex Evaluation
 
@@ -1682,8 +1667,8 @@ Collegiate Dictionary}.
 * Evaluating Inner Lists::      Lists within lists...
 @end menu
 
-@node How the Interpreter Acts, Evaluating Inner Lists, Evaluation, Evaluation
 @ifnottex
+@node How the Interpreter Acts
 @unnumberedsubsec How the Lisp Interpreter Acts
 @end ifnottex
 
@@ -1709,8 +1694,7 @@ In summary, evaluating a symbolic expression most commonly causes the
 Lisp interpreter to return a value and perhaps carry out a side effect;
 or else produce an error.
 
-@node Evaluating Inner Lists,  , How the Interpreter Acts, Evaluation
-@comment  node-name,  next,  previous,  up
+@node Evaluating Inner Lists
 @subsection Evaluating Inner Lists
 @cindex Inner list evaluation
 @cindex Evaluating inner lists
@@ -1773,8 +1757,7 @@ instructions in the function definition attached to that name.  If a
 symbol by itself is evaluated, something different happens, as we will
 see in the next section.
 
-@node Variables, Arguments, Evaluation, List Processing
-@comment  node-name,  next,  previous,  up
+@node Variables
 @section Variables
 @cindex Variables
 
@@ -1813,8 +1796,8 @@ function definition, and vice-verse.
 * Void Variable::               The error message for a symbol without a value.
 @end menu
 
-@node fill-column Example, Void Function, Variables, Variables
 @ifnottex
+@node fill-column Example
 @unnumberedsubsec @code{fill-column}, an Example Variable
 @end ifnottex
 
@@ -1851,8 +1834,7 @@ A symbol can be bound to a value in several ways.  @xref{set & setq, ,
 Setting the Value of a Variable}, for information about one way to do
 this.
 
-@node Void Function, Void Variable, fill-column Example, Variables
-@comment  node-name,  next,  previous,  up
+@node Void Function
 @subsection Error Message for a Symbol Without a Function
 @cindex Symbol without function error
 @cindex Error for symbol without function
@@ -1904,8 +1886,7 @@ Symbol's function definition is void:@: fill-column
 another key.)
 @end ignore
 
-@node Void Variable,  , Void Function, Variables
-@comment  node-name,  next,  previous,  up
+@node Void Variable
 @subsection Error Message for a Symbol Without a Value
 @cindex Symbol without value error
 @cindex Error for symbol without value
@@ -1971,8 +1952,7 @@ Symbol's value as variable is void:@: +
 The meaning is the same as in GNU Emacs 22.
 @end ignore
 
-@node Arguments, set & setq, Variables, List Processing
-@comment  node-name,  next,  previous,  up
+@node Arguments
 @section Arguments
 @cindex Arguments
 @cindex Passing information to functions
@@ -2025,8 +2005,7 @@ have two different function definitions at the same time.)}
 * message::                     A useful function for sending messages.
 @end menu
 
-@node Data types, Args as Variable or List, Arguments, Arguments
-@comment  node-name,  next,  previous,  up
+@node Data types
 @subsection Arguments' Data Types
 @cindex Data types
 @cindex Types of data
@@ -2080,8 +2059,7 @@ and extracts a part.  However, @code{substring} is only able to extract
 a substring from an argument that is a string, not from another type of
 atom such as a number or symbol.
 
-@node Args as Variable or List, Variable Number of Arguments, Data types, Arguments
-@comment  node-name,  next,  previous,  up
+@node Args as Variable or List
 @subsection An Argument as the Value of a Variable or List
 
 An argument can be a symbol that returns a value when it is evaluated.
@@ -2122,8 +2100,7 @@ the final string.  The function @code{number-to-string} converts the
 integer that the addition function returns to a string.
 @code{number-to-string} is also known as @code{int-to-string}.)
 
-@node Variable Number of Arguments, Wrong Type of Argument, Args as Variable or List, Arguments
-@comment  node-name,  next,  previous,  up
+@node Variable Number of Arguments
 @subsection Variable Number of Arguments
 @cindex Variable number of arguments
 @cindex Arguments, variable number of
@@ -2167,8 +2144,7 @@ In this set, the functions have three arguments each:
 @end group
 @end smallexample
 
-@node Wrong Type of Argument, message, Variable Number of Arguments, Arguments
-@comment  node-name,  next,  previous,  up
+@node Wrong Type of Argument
 @subsection Using the Wrong Type Object as an Argument
 @cindex Wrong type of argument
 @cindex Argument, wrong type of
@@ -2262,8 +2238,7 @@ This says, in different words, the same as the top line of the
 @file{*Backtrace*} buffer.
 @end ignore
 
-@node message,  , Wrong Type of Argument, Arguments
-@comment  node-name,  next,  previous,  up
+@node message
 @subsection The @code{message} Function
 @findex message
 
@@ -2375,8 +2350,7 @@ When your fill column is 70 and you evaluate the expression, the
 message @code{"He saw 38 red foxes leaping."} appears in your echo
 area.
 
-@node set & setq, Summary, Arguments, List Processing
-@comment  node-name,  next,  previous,  up
+@node set & setq
 @section Setting the Value of a Variable
 @cindex Variable, setting value
 @cindex Setting value of variable
@@ -2396,8 +2370,7 @@ work but also illustrate how arguments are passed.
 * Counting::                   Using @code{setq} to count.
 @end menu
 
-@node Using set, Using setq, set & setq, set & setq
-@comment  node-name,  next,  previous,  up
+@node Using set
 @subsection Using @code{set}
 @findex set
 
@@ -2453,8 +2426,7 @@ a value after it was evaluated, the @code{set} would attempt to set
 the value that was returned.  There are situations where this is the
 right thing for the function to do; but such situations are rare.)
 
-@node Using setq, Counting, Using set, set & setq
-@comment  node-name,  next,  previous,  up
+@node Using setq
 @subsection Using @code{setq}
 @findex setq
 
@@ -2514,8 +2486,7 @@ part of its name.  The name is chosen because the symbol has a value,
 specifically a list, attached to it; or, expressed another way,
 the symbol is set to ``point'' to the list.
 
-@node Counting,  , Using setq, set & setq
-@comment  node-name,  next,  previous,  up
+@node Counting
 @subsection Counting
 @cindex Counting
 
@@ -2561,8 +2532,7 @@ is then returned as the value of the inner list and passed to the
 @code{setq} which sets the variable @code{counter} to this new value.
 Thus, the value of the variable, @code{counter}, is changed.
 
-@node Summary, Error Message Exercises, set & setq, List Processing
-@comment  node-name,  next,  previous,  up
+@node Summary
 @section Summary
 
 Learning Lisp is like climbing a hill in which the first part is the
@@ -2624,8 +2594,7 @@ an error); in addition, it may also carry out some action called a
 create a side effect.
 @end itemize
 
-@node Error Message Exercises,  , Summary, List Processing
-@comment  node-name,  next,  previous,  up
+@node Error Message Exercises
 @section Exercises
 
 A few simple exercises:
@@ -2647,8 +2616,7 @@ Write an expression that prints a message in the echo area when
 evaluated.
 @end itemize
 
-@node Practicing Evaluation, Writing Defuns, List Processing, Top
-@comment  node-name,  next,  previous,  up
+@node Practicing Evaluation
 @chapter Practicing Evaluation
 @cindex Practicing evaluation
 @cindex Evaluation practice
@@ -2673,8 +2641,8 @@ buffer-related functions, to see how they were written.
 * Evaluation Exercise::
 @end menu
 
-@node How to Evaluate, Buffer Names, Practicing Evaluation, Practicing Evaluation
 @ifnottex
+@node How to Evaluate
 @unnumberedsec How to Evaluate
 @end ifnottex
 
@@ -2705,8 +2673,7 @@ next few sections are important in their own right.  A study of these
 functions makes clear the distinction between buffers and files, how to
 switch to a buffer, and how to determine a location within it.
 
-@node Buffer Names, Getting Buffers, How to Evaluate, Practicing Evaluation
-@comment  node-name,  next,  previous,  up
+@node Buffer Names
 @section Buffer Names
 @findex buffer-name
 @findex buffer-file-name
@@ -2831,8 +2798,7 @@ you to change the contents of the buffer.  But you can do this in any
 buffer you can edit; and when you write code or documentation (such as
 this book), this feature is very useful.
 
-@node Getting Buffers, Switching Buffers, Buffer Names, Practicing Evaluation
-@comment  node-name,  next,  previous,  up
+@node Getting Buffers
 @section Getting Buffers
 @findex current-buffer
 @findex other-buffer
@@ -2900,8 +2866,7 @@ just switched is visible to you in another window, @code{other-buffer}
 will choose the most recent buffer that you cannot see; this is a
 subtlety that I often forget.}.
 
-@node Switching Buffers, Buffer Size & Locations, Getting Buffers, Practicing Evaluation
-@comment  node-name,  next,  previous,  up
+@node Switching Buffers
 @section Switching Buffers
 @findex switch-to-buffer
 @findex set-buffer
@@ -2990,8 +2955,7 @@ the function as an entity that can do something for you if you `call'
 it---just as a plumber is an entity who can fix a leak if you call him
 or her.
 
-@node Buffer Size & Locations, Evaluation Exercise, Switching Buffers, Practicing Evaluation
-@comment  node-name,  next,  previous,  up
+@node Buffer Size & Locations
 @section Buffer Size and the Location of Point
 @cindex Size of buffer
 @cindex Buffer size
@@ -3058,14 +3022,13 @@ or a program, to operations on just a part of a buffer.
 function @code{point-max} returns the value of the maximum permissible
 value of point in the current buffer.
 
-@node Evaluation Exercise,  , Buffer Size & Locations, Practicing Evaluation
+@node Evaluation Exercise
 @section Exercise
 
 Find a file with which you are working and move towards its middle.
 Find its buffer name, file name, length, and your position in the file.
 
-@node Writing Defuns, Buffer Walk Through, Practicing Evaluation, Top
-@comment  node-name,  next,  previous,  up
+@node Writing Defuns
 @chapter How To Write Function Definitions
 @cindex Definition writing
 @cindex Function definition writing
@@ -3095,8 +3058,8 @@ symbol refers to it.)
 * defun Exercises::
 @end menu
 
-@node Primitive Functions, defun, Writing Defuns, Writing Defuns
 @ifnottex
+@node Primitive Functions
 @unnumberedsec An Aside about Primitive Functions
 @end ifnottex
 @cindex Primitive functions
@@ -3121,8 +3084,7 @@ mention the distinction only because it is interesting to know.  Indeed,
 unless you investigate, you won't know whether an already-written
 function is written in Emacs Lisp or C.
 
-@node defun, Install, Primitive Functions, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node defun
 @section The @code{defun} Special Form
 @findex defun
 @cindex Special form of @code{defun}
@@ -3294,8 +3256,7 @@ Installing a function is the process that tells the Lisp interpreter the
 definition of the function.  Installation is described in the next
 section.
 
-@node Install, Interactive, defun, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node Install
 @section Install a Function Definition
 @cindex Install a Function Definition
 @cindex Definition installation
@@ -3332,8 +3293,8 @@ Emacs.  To reload code automatically whenever you start Emacs, see
 * Change a defun::              How to change a function definition.
 @end menu
 
-@node Effect of installation, Change a defun, Install, Install
 @ifnottex
+@node Effect of installation
 @unnumberedsubsec The effect of installation
 @end ifnottex
 
@@ -3363,8 +3324,7 @@ Multiply NUMBER by seven.
 @noindent
 (To return to a single window on your screen, type @kbd{C-x 1}.)
 
-@node Change a defun,  , Effect of installation, Install
-@comment  node-name,  next,  previous,  up
+@node Change a defun
 @subsection Change a Function Definition
 @cindex Changing a function definition
 @cindex Function definition, how to change
@@ -3409,8 +3369,7 @@ In summary, this is how you write code in Emacs Lisp: you write a
 function; install it; test it; and then make fixes or enhancements and
 install it again.
 
-@node Interactive, Interactive Options, Install, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node Interactive
 @section Make a Function Interactive
 @cindex Interactive functions
 @findex interactive
@@ -3434,8 +3393,8 @@ each time you typed a key, it would be very distracting.
 * multiply-by-seven in detail::    The interactive version.
 @end menu
 
-@node Interactive multiply-by-seven, multiply-by-seven in detail, Interactive, Interactive
 @ifnottex
+@node Interactive multiply-by-seven
 @unnumberedsubsec An Interactive @code{multiply-by-seven}, An Overview
 @end ifnottex
 
@@ -3490,8 +3449,7 @@ A prefix argument is passed to an interactive function by typing the
 typing @kbd{C-u} and then a number, for example, @kbd{C-u 3 M-e} (if you
 type @kbd{C-u} without a number, it defaults to 4).
 
-@node multiply-by-seven in detail,  , Interactive multiply-by-seven, Interactive
-@comment  node-name,  next,  previous,  up
+@node multiply-by-seven in detail
 @subsection An Interactive @code{multiply-by-seven}
 
 Let's look at the use of the special form @code{interactive} and then at
@@ -3560,8 +3518,7 @@ expression whose first element is @code{message}; but when embedded in a
 function, @code{message} prints the text as a side effect without
 quotes.)
 
-@node Interactive Options, Permanent Installation, Interactive, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node Interactive Options
 @section Different Options for @code{interactive}
 @cindex Options for @code{interactive}
 @cindex Interactive options
@@ -3639,8 +3596,7 @@ for an example.  @xref{Using Interactive, , Using @code{Interactive},
 elisp, The GNU Emacs Lisp Reference Manual}, for a more complete
 explanation about this technique.
 
-@node Permanent Installation, let, Interactive Options, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node Permanent Installation
 @section Install Code Permanently
 @cindex Install code permanently
 @cindex Permanent code installation
@@ -3688,8 +3644,7 @@ the Free Software Foundation, and properly protect yourself and
 others, it may be included in the next release of Emacs.  In large
 part, this is how Emacs has grown over the past years, by donations.
 
-@node let, if, Permanent Installation, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node let
 @section @code{let}
 @findex let
 
@@ -3721,8 +3676,8 @@ and the two are not intended to refer to the same value.  The
 * Uninitialized let Variables::
 @end menu
 
-@node Prevent confusion, Parts of let Expression, let, let
 @ifnottex
+@node Prevent confusion
 @unnumberedsubsec @code{let} Prevents Confusion
 @end ifnottex
 
@@ -3760,8 +3715,7 @@ meaning `to give practical effect to' (@cite{Oxford English
 Dictionary}).  Since you evaluate an expression to perform an action,
 `execute' has evolved as a synonym to `evaluate'.)
 
-@node Parts of let Expression, Sample let Expression, Prevent confusion, let
-@comment  node-name,  next,  previous,  up
+@node Parts of let Expression
 @subsection The Parts of a @code{let} Expression
 @cindex @code{let} expression, parts of
 @cindex Parts of @code{let} expression
@@ -3809,8 +3763,7 @@ the template for the @code{let} expression looks like this:
 @end group
 @end smallexample
 
-@node Sample let Expression, Uninitialized let Variables, Parts of let Expression, let
-@comment  node-name,  next,  previous,  up
+@node Sample let Expression
 @subsection Sample @code{let} Expression
 @cindex Sample @code{let} expression
 @cindex @code{let} expression sample
@@ -3860,8 +3813,7 @@ argument, except for @samp{%s}.  In this example, the value of the variable
 value of the variable @code{tiger} is printed at the location of the
 second @samp{%s}.
 
-@node Uninitialized let Variables,  , Sample let Expression, let
-@comment  node-name,  next,  previous,  up
+@node Uninitialized let Variables
 @subsection Uninitialized Variables in a @code{let} Statement
 @cindex Uninitialized @code{let} variables
 @cindex @code{let} variables uninitialized
@@ -3909,8 +3861,7 @@ number is printed in the message using a @samp{%d} rather than a
 @samp{%s}.)  The four variables as a group are put into a list to
 delimit them from the body of the @code{let}.
 
-@node if, else, let, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node if
 @section The @code{if} Special Form
 @findex if
 @cindex Conditional with @code{if}
@@ -3932,8 +3883,8 @@ such as, ``if it is warm and sunny, then go to the beach!''
 * type-of-animal in detail::    An example of an @code{if} expression.
 @end menu
 
-@node if in more detail, type-of-animal in detail, if, if
 @ifnottex
+@node if in more detail
 @unnumberedsubsec @code{if} in more detail
 @end ifnottex
 
@@ -4023,8 +3974,7 @@ following message printed in the echo area: @code{"It's a tiger!"}; and
 when you evaluate @code{(type-of-animal 'zebra)} you will see @code{nil}
 printed in the echo area.
 
-@node type-of-animal in detail,  , if in more detail, if
-@comment  node-name,  next,  previous,  up
+@node type-of-animal in detail
 @subsection The @code{type-of-animal} Function in Detail
 
 Let's look at the @code{type-of-animal} function in detail.
@@ -4111,8 +4061,7 @@ argument @code{zebra} is passed to @code{type-of-animal}.  @code{zebra}
 is not equal to @code{fierce}, so the then-part is not evaluated and
 @code{nil} is returned by the @code{if} expression.
 
-@node else, Truth & Falsehood, if, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node else
 @section If--then--else Expressions
 @cindex Else
 
@@ -4200,8 +4149,7 @@ misleading!  When you write code, you need to take into account the
 possibility that some such argument will be tested by the @code{if}
 and write your program accordingly.)
 
-@node Truth & Falsehood, save-excursion, else, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node Truth & Falsehood
 @section Truth and Falsehood in Emacs Lisp
 @cindex Truth and falsehood in Emacs Lisp
 @cindex Falsehood and truth in Emacs Lisp
@@ -4224,8 +4172,8 @@ long as it is not empty), or even a buffer!
 * nil explained::               @code{nil} has two meanings.
 @end menu
 
-@node nil explained,  , Truth & Falsehood, Truth & Falsehood
 @ifnottex
+@node nil explained
 @unnumberedsubsec An explanation of @code{nil}
 @end ifnottex
 
@@ -4288,8 +4236,7 @@ On the other hand, this function returns @code{nil} if the test is false.
 (> 4 5)
 @end smallexample
 
-@node save-excursion, Review, Truth & Falsehood, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node save-excursion
 @section @code{save-excursion}
 @findex save-excursion
 @cindex Region, what it is
@@ -4313,8 +4260,8 @@ unexpected movement of point or mark.
 * Template for save-excursion::
 @end menu
 
-@node Point and mark, Template for save-excursion, save-excursion, save-excursion
 @ifnottex
+@node Point and mark
 @unnumberedsubsec Point and Mark
 @end ifnottex
 
@@ -4371,8 +4318,7 @@ have @code{save-excursion} switch you back to the original buffer.
 This is how @code{save-excursion} is used in @code{append-to-buffer}.
 (@xref{append-to-buffer, , The Definition of @code{append-to-buffer}}.)
 
-@node Template for save-excursion,  , Point and mark, save-excursion
-@comment  node-name,  next,  previous,  up
+@node Template for save-excursion
 @subsection Template for a @code{save-excursion} Expression
 
 @need 800
@@ -4423,8 +4369,7 @@ within the body of a @code{let} expression.  It looks like this:
 @end group
 @end smallexample
 
-@node Review, defun Exercises, save-excursion, Writing Defuns
-@comment  node-name,  next,  previous,  up
+@node Review
 @section Review
 
 In the last few chapters we have introduced a fair number of functions
@@ -4677,7 +4622,7 @@ effect.
 @end table
 
 @need 1500
-@node defun Exercises,  , Review, Writing Defuns
+@node defun Exercises
 @section Exercises
 
 @itemize @bullet
@@ -4691,8 +4636,7 @@ Write a function that tests whether the current value of
 and if so, prints an appropriate message.
 @end itemize
 
-@node Buffer Walk Through, More Complex, Writing Defuns, Top
-@comment  node-name,  next,  previous,  up
+@node Buffer Walk Through
 @chapter A Few Buffer--Related Functions
 
 In this chapter we study in detail several of the functions used in GNU
@@ -4714,7 +4658,7 @@ buffers.  Later, we will study other functions.
 * Buffer Exercises::
 @end menu
 
-@node Finding More, simplified-beginning-of-buffer, Buffer Walk Through, Buffer Walk Through
+@node Finding More
 @section Finding More Information
 
 @findex describe-function, @r{introduced}
@@ -4810,8 +4754,7 @@ In @cite{The GNU Emacs Manual}, you will see sentences such as ``The
 @kbd{C-h p} command lets you search the standard Emacs Lisp libraries
 by topic keywords.''
 
-@node simplified-beginning-of-buffer, mark-whole-buffer, Finding More, Buffer Walk Through
-@comment  node-name,  next,  previous,  up
+@node simplified-beginning-of-buffer
 @section A Simplified @code{beginning-of-buffer} Definition
 @findex simplified-beginning-of-buffer
 
@@ -4939,8 +4882,7 @@ the @code{beginning-of-buffer} definition except that the body of the
 function contains the expression @code{(goto-char (point-max))} in place
 of @code{(goto-char (point-min))}.
 
-@node mark-whole-buffer, append-to-buffer, simplified-beginning-of-buffer, Buffer Walk Through
-@comment  node-name,  next,  previous,  up
+@node mark-whole-buffer
 @section The Definition of @code{mark-whole-buffer}
 @findex mark-whole-buffer
 
@@ -4959,8 +4901,8 @@ h}.
 * Body of mark-whole-buffer::   Only three lines of code.
 @end menu
 
-@node mark-whole-buffer overview, Body of mark-whole-buffer, mark-whole-buffer, mark-whole-buffer
 @ifnottex
+@node mark-whole-buffer overview
 @unnumberedsubsec An overview of @code{mark-whole-buffer}
 @end ifnottex
 
@@ -5006,8 +4948,7 @@ to the @code{simplified-beginning-of-buffer} function described in the
 previous section.
 
 @need 1250
-@node Body of mark-whole-buffer,  , mark-whole-buffer overview, mark-whole-buffer
-@comment  node-name,  next,  previous,  up
+@node Body of mark-whole-buffer
 @subsection Body of @code{mark-whole-buffer}
 
 The body of the @code{mark-whole-buffer} function consists of three
@@ -5080,8 +5021,7 @@ result of this, point is placed at the beginning of the buffer and mark
 is set at the end of the buffer.  The whole buffer is, therefore, the
 region.
 
-@node append-to-buffer, Buffer Related Review, mark-whole-buffer, Buffer Walk Through
-@comment  node-name,  next,  previous,  up
+@node append-to-buffer
 @section The Definition of @code{append-to-buffer}
 @findex append-to-buffer
 
@@ -5097,8 +5037,8 @@ current buffer to a specified buffer.
 * append save-excursion::       How the @code{save-excursion} works.
 @end menu
 
-@node append-to-buffer overview, append interactive, append-to-buffer, append-to-buffer
 @ifnottex
+@node append-to-buffer overview
 @unnumberedsubsec An Overview of @code{append-to-buffer}
 @end ifnottex
 
@@ -5178,8 +5118,7 @@ described in the same order as in the argument list.
 Note that the documentation distinguishes between a buffer and its
 name.  (The function can handle either.)
 
-@node append interactive, append-to-buffer body, append-to-buffer overview, append-to-buffer
-@comment  node-name,  next,  previous,  up
+@node append interactive
 @subsection The @code{append-to-buffer} Interactive Expression
 
 Since the @code{append-to-buffer} function will be used interactively,
@@ -5247,8 +5186,7 @@ two arguments that follow the symbol @code{buffer} in the function's
 argument list (that is, @code{start} and @code{end}) to the values of
 point and mark.  That argument worked fine.)
 
-@node append-to-buffer body, append save-excursion, append interactive, append-to-buffer
-@comment  node-name,  next,  previous,  up
+@node append-to-buffer body
 @subsection The Body of @code{append-to-buffer}
 
 @ignore
@@ -5347,8 +5285,7 @@ not realize that the first parenthesis before @code{oldbuf} marks the
 boundary of the varlist and the second parenthesis marks the beginning
 of the two-element list, @code{(oldbuf (current-buffer))}.
 
-@node append save-excursion,  , append-to-buffer body, append-to-buffer
-@comment  node-name,  next,  previous,  up
+@node append save-excursion
 @subsection @code{save-excursion} in @code{append-to-buffer}
 
 The body of the @code{let} expression in @code{append-to-buffer}
@@ -5525,8 +5462,7 @@ complex function.  It shows how to use @code{let} and
 buffer.  Many function definitions use @code{let},
 @code{save-excursion}, and @code{set-buffer} this way.
 
-@node Buffer Related Review, Buffer Exercises, append-to-buffer, Buffer Walk Through
-@comment  node-name,  next,  previous,  up
+@node Buffer Related Review
 @section Review
 
 Here is a brief summary of the various functions discussed in this chapter.
@@ -5578,7 +5514,7 @@ buffer does not exist.
 @end table
 
 @need 1500
-@node Buffer Exercises,  , Buffer Related Review, Buffer Walk Through
+@node Buffer Exercises
 @section Exercises
 
 @itemize @bullet
@@ -5595,8 +5531,7 @@ Using @code{find-tag}, find the source for the @code{copy-to-buffer}
 function.
 @end itemize
 
-@node More Complex, Narrowing & Widening, Buffer Walk Through, Top
-@comment  node-name,  next,  previous,  up
+@node More Complex
 @chapter A Few More Complex Functions
 
 In this chapter, we build on what we have learned in previous chapters
@@ -5616,8 +5551,7 @@ to which the name refers.
 * optional Exercise::
 @end menu
 
-@node copy-to-buffer, insert-buffer, More Complex, More Complex
-@comment  node-name,  next,  previous,  up
+@node copy-to-buffer
 @section The Definition of @code{copy-to-buffer}
 @findex copy-to-buffer
 
@@ -5695,8 +5629,7 @@ In outline, the body of @code{copy-to-buffer} looks like this:
 @end group
 @end smallexample
 
-@node insert-buffer, beginning-of-buffer, copy-to-buffer, More Complex
-@comment  node-name,  next,  previous,  up
+@node insert-buffer
 @section The Definition of @code{insert-buffer}
 @findex insert-buffer
 
@@ -5725,8 +5658,8 @@ between the name of an object and the object actually referred to.
 * New insert-buffer::
 @end menu
 
-@node insert-buffer code, insert-buffer interactive, insert-buffer, insert-buffer
 @ifnottex
+@node insert-buffer code
 @unnumberedsubsec The Code for @code{insert-buffer}
 @end ifnottex
 
@@ -5770,8 +5703,7 @@ outline of the function:
 @end group
 @end smallexample
 
-@node insert-buffer interactive, insert-buffer body, insert-buffer code, insert-buffer
-@comment  node-name,  next,  previous,  up
+@node insert-buffer interactive
 @subsection The Interactive Expression in @code{insert-buffer}
 @findex interactive, @r{example use of}
 
@@ -5784,8 +5716,7 @@ buffer:@: }.
 * b for interactive::           An existing buffer or else its name.
 @end menu
 
-@node Read-only buffer, b for interactive, insert-buffer interactive, insert-buffer interactive
-@comment  node-name,  next,  previous,  up
+@node Read-only buffer
 @unnumberedsubsubsec A Read-only Buffer
 @cindex Read-only buffer
 @cindex Asterisk for read-only buffer
@@ -5799,8 +5730,7 @@ may beep or blink at you; you will not be permitted to insert anything
 into current buffer.  The asterisk does not need to be followed by a
 newline to separate it from the next argument.
 
-@node b for interactive,  , Read-only buffer, insert-buffer interactive
-@comment  node-name,  next,  previous,  up
+@node b for interactive
 @unnumberedsubsubsec @samp{b} in an Interactive Expression
 
 The next argument in the interactive expression starts with a lower
@@ -5820,8 +5750,7 @@ It uses the @code{barf-if-buffer-read-only} and @code{read-buffer}
 functions with which we are already familiar and the @code{progn}
 special form with which we are not.  (It will be described later.)
 
-@node insert-buffer body, if & or, insert-buffer interactive, insert-buffer
-@comment  node-name,  next,  previous,  up
+@node insert-buffer body
 @subsection The Body of the @code{insert-buffer} Function
 
 The body of the @code{insert-buffer} function has two major parts: an
@@ -5856,8 +5785,7 @@ is first necessary to understand the @code{or} function.
 Before doing this, let me rewrite this part of the function using
 @code{if} so that you can see what is done in a manner that will be familiar.
 
-@node if & or, Insert or, insert-buffer body, insert-buffer
-@comment  node-name,  next,  previous,  up
+@node if & or
 @subsection @code{insert-buffer} With an @code{if} Instead of an @code{or}
 
 The job to be done is to make sure the value of @code{buffer} is a
@@ -5937,8 +5865,7 @@ buffer itself, given its name.  The @code{setq} then sets the variable
 @code{buffer} to the value of the buffer itself, replacing its previous
 value (which was the name of the buffer).
 
-@node Insert or, Insert let, if & or, insert-buffer
-@comment  node-name,  next,  previous,  up
+@node Insert or
 @subsection The @code{or} in the Body
 
 The purpose of the @code{or} expression in the @code{insert-buffer}
@@ -5996,8 +5923,7 @@ written like this:
 (or (holding-on-to-guest) (find-and-take-arm-of-guest))
 @end smallexample
 
-@node Insert let, New insert-buffer, Insert or, insert-buffer
-@comment  node-name,  next,  previous,  up
+@node Insert let
 @subsection The @code{let} Expression in @code{insert-buffer}
 
 After ensuring that the variable @code{buffer} refers to a buffer itself
@@ -6095,8 +6021,7 @@ function uses @code{let}, @code{save-excursion}, and
 use @code{or}.  All these functions are building blocks that we will
 find and use again and again.
 
-@node New insert-buffer,  , Insert let, insert-buffer
-@comment  node-name,  next,  previous,  up
+@node New insert-buffer
 @subsection New Body for @code{insert-buffer}
 @findex insert-buffer, new version body
 @findex new version body for insert-buffer
@@ -6134,8 +6059,7 @@ its last command.  Put another way, the @code{insert-buffer} function
 exists only to produce a side effect, inserting another buffer, not to
 return any value.
 
-@node beginning-of-buffer, Second Buffer Related Review, insert-buffer, More Complex
-@comment  node-name,  next,  previous,  up
+@node beginning-of-buffer
 @section Complete Definition of @code{beginning-of-buffer}
 @findex beginning-of-buffer
 
@@ -6167,7 +6091,7 @@ argument.  The use of the argument is optional.
 * beginning-of-buffer complete::
 @end menu
 
-@node Optional Arguments, beginning-of-buffer opt arg, beginning-of-buffer, beginning-of-buffer
+@node Optional Arguments
 @subsection Optional Arguments
 
 Unless told otherwise, Lisp expects that a function with an argument in
@@ -6250,7 +6174,7 @@ simply @code{point-min}, and when this is the outcome, the whole
 is how we saw the @code{beginning-of-buffer} function in its
 simplified form.
 
-@node beginning-of-buffer opt arg, beginning-of-buffer complete, Optional Arguments, beginning-of-buffer
+@node beginning-of-buffer opt arg
 @subsection @code{beginning-of-buffer} with an Argument
 
 When @code{beginning-of-buffer} is called with an argument, an
@@ -6278,8 +6202,8 @@ like this:
 * Small buffer case::
 @end menu
 
-@node Disentangle beginning-of-buffer, Large buffer case, beginning-of-buffer opt arg, beginning-of-buffer opt arg
 @ifnottex
+@node Disentangle beginning-of-buffer
 @unnumberedsubsubsec Disentangle @code{beginning-of-buffer}
 @end ifnottex
 
@@ -6308,8 +6232,7 @@ that are far, far larger than ever before.
 
 There are two cases:  if the buffer is large and if it is not.
 
-@node Large buffer case, Small buffer case, Disentangle beginning-of-buffer, beginning-of-buffer opt arg
-@comment  node-name,  next,  previous,  up
+@node Large buffer case
 @unnumberedsubsubsec What happens in a large buffer
 
 In @code{beginning-of-buffer}, the inner @code{if} expression tests
@@ -6392,8 +6315,7 @@ is large, the @code{goto-char} expression reads like this:
 
 This puts the cursor where we want it.
 
-@node Small buffer case,  , Large buffer case, beginning-of-buffer opt arg
-@comment  node-name,  next,  previous,  up
+@node Small buffer case
 @unnumberedsubsubsec What happens in a small buffer
 
 If the buffer contains fewer than 10,000 characters, a slightly
@@ -6450,8 +6372,7 @@ The number that results from all this is passed to @code{goto-char} and
 the cursor is moved to that point.
 
 @need 1500
-@node beginning-of-buffer complete,  , beginning-of-buffer opt arg, beginning-of-buffer
-@comment  node-name,  next,  previous,  up
+@node beginning-of-buffer complete
 @subsection The Complete @code{beginning-of-buffer}
 
 @need 1000
@@ -6579,8 +6500,7 @@ beginning of the second line @dots{}  I don't know whether this is
 intended or whether no one has dealt with the code to avoid this
 happening.
 
-@node Second Buffer Related Review, optional Exercise, beginning-of-buffer, More Complex
-@comment  node-name,  next,  previous,  up
+@node Second Buffer Related Review
 @section Review
 
 Here is a brief summary of some of the topics covered in this chapter.
@@ -6623,7 +6543,7 @@ Delete the entire contents of the current buffer.
 Return @code{t} if its argument is a buffer; otherwise return @code{nil}.
 @end table
 
-@node optional Exercise,  , Second Buffer Related Review, More Complex
+@node optional Exercise
 @section @code{optional} Argument Exercise
 
 Write an interactive function with an optional argument that tests
@@ -6632,8 +6552,7 @@ less than the value of @code{fill-column}, and tells you which, in a
 message.  However, if you do not pass an argument to the function, use
 56 as a default value.
 
-@node Narrowing & Widening, car cdr & cons, More Complex, Top
-@comment  node-name,  next,  previous,  up
+@node Narrowing & Widening
 @chapter Narrowing and Widening
 @cindex Focusing attention (narrowing)
 @cindex Narrowing
@@ -6651,8 +6570,8 @@ novices.
 * narrow Exercise::
 @end menu
 
-@node Narrowing advantages, save-restriction, Narrowing & Widening, Narrowing & Widening
 @ifnottex
+@node Narrowing advantages
 @unnumberedsec The Advantages of Narrowing
 @end ifnottex
 
@@ -6686,8 +6605,7 @@ On the other hand, the @code{count-lines} function, which is called by
 of the buffer in which it is interested and then restores the previous
 situation.
 
-@node save-restriction, what-line, Narrowing advantages, Narrowing & Widening
-@comment  node-name,  next,  previous,  up
+@node save-restriction
 @section The @code{save-restriction} Special Form
 @findex save-restriction
 
@@ -6804,8 +6722,7 @@ and the greater of them is not at the start of a line."
         (- (buffer-size) (forward-line (buffer-size)))))))
 @end ignore
 
-@node what-line, narrow Exercise, save-restriction, Narrowing & Widening
-@comment  node-name,  next,  previous,  up
+@node what-line
 @section @code{what-line}
 @findex what-line
 @cindex Widening, example of
@@ -6938,7 +6855,7 @@ printed in the echo area, the @code{save-excursion} restores point and
 mark to their original positions; and @code{save-restriction} restores
 the original narrowing, if any.
 
-@node narrow Exercise,  , what-line, Narrowing & Widening
+@node narrow Exercise
 @section Exercise with Narrowing
 
 Write a function that will display the first 60 characters of the
@@ -6961,8 +6878,7 @@ Manual}.)
 Additionally, do you really need @code{goto-char} or @code{point-min}?
 Or can you write the function without them?
 
-@node car cdr & cons, Cutting & Storing Text, Narrowing & Widening, Top
-@comment  node-name,  next,  previous,  up
+@node car cdr & cons
 @chapter @code{car}, @code{cdr}, @code{cons}: Fundamental Functions
 @findex car, @r{introduced}
 @findex cdr, @r{introduced}
@@ -6986,8 +6902,8 @@ namely, @code{setcdr} and @code{nthcdr}.  (@xref{copy-region-as-kill}.)
 * cons Exercise::
 @end menu
 
-@node Strange Names, car & cdr, car cdr & cons, car cdr & cons
 @ifnottex
+@node Strange Names
 @unnumberedsec Strange Names
 @end ifnottex
 
@@ -7006,8 +6922,7 @@ functions, the old terms are still in use.  In particular, since the
 terms are used in the Emacs Lisp source code, we will use them in this
 introduction.
 
-@node car & cdr, cons, Strange Names, car cdr & cons
-@comment  node-name,  next,  previous,  up
+@node car & cdr
 @section @code{car} and @code{cdr}
 
 The @sc{car} of a list is, quite simply, the first item in the list.
@@ -7129,8 +7044,7 @@ together or construct a list, but not an array.  (Arrays are handled
 by array-specific functions.  @xref{Arrays, , Arrays, elisp, The GNU
 Emacs Lisp Reference Manual}.)
 
-@node cons, nthcdr, car & cdr, car cdr & cons
-@comment  node-name,  next,  previous,  up
+@node cons
 @section @code{cons}
 @findex cons, @r{introduced}
 
@@ -7167,8 +7081,8 @@ Like @code{car} and @code{cdr}, @code{cons} is non-destructive.
 * length::                      How to find the length of a list.
 @end menu
 
-@node Build a list, length, cons, cons
 @ifnottex
+@node Build a list
 @unnumberedsubsec Build a list
 @end ifnottex
 
@@ -7218,8 +7132,7 @@ two element list by putting @code{daisy} in front of @code{buttercup};
 and the third example constructs a three element list by putting
 @code{violet} in front of @code{daisy} and @code{buttercup}.
 
-@node length,  , Build a list, cons
-@comment  node-name,  next,  previous,  up
+@node length
 @subsection Find the Length of a List: @code{length}
 @findex length
 
@@ -7300,8 +7213,7 @@ In an earlier version:
     about subroutines.
 @end ignore
 
-@node nthcdr, nth, cons, car cdr & cons
-@comment  node-name,  next,  previous,  up
+@node nthcdr
 @section @code{nthcdr}
 @findex nthcdr
 
@@ -7425,8 +7337,7 @@ and 5:
 @end group
 @end smallexample
 
-@node nth, setcar, nthcdr, car cdr & cons
-@comment  node-name,  next,  previous,  up
+@node nth
 @section @code{nth}
 @findex nth
 
@@ -7478,8 +7389,7 @@ It is worth mentioning that @code{nth}, like @code{nthcdr} and
 non-destructive.  This is in sharp contrast to the @code{setcar} and
 @code{setcdr} functions.
 
-@node setcar, setcdr, nth, car cdr & cons
-@comment  node-name,  next,  previous,  up
+@node setcar
 @section @code{setcar}
 @findex setcar
 
@@ -7554,8 +7464,7 @@ So we can see that @code{setcar} did not add a new element to the list
 as @code{cons} would have; it replaced @code{antelope} with
 @code{hippopotamus}; it @emph{changed} the list.
 
-@node setcdr, cons Exercise, setcar, car cdr & cons
-@comment  node-name,  next,  previous,  up
+@node setcdr
 @section @code{setcdr}
 @findex setcdr
 
@@ -7614,7 +7523,7 @@ Indeed, the list is changed from @code{(horse cow sheep goat)} to
 @code{(horse cat dog)}.  The @sc{cdr} of the list is changed from
 @code{(cow sheep goat)} to @code{(cat dog)}.
 
-@node cons Exercise,  , setcdr, car cdr & cons
+@node cons Exercise
 @section Exercise
 
 Construct a list of four birds by evaluating several expressions with
@@ -7622,8 +7531,7 @@ Construct a list of four birds by evaluating several expressions with
 itself.  Replace the first element of the list of four birds with a
 fish.  Replace the rest of that list with a list of other fish.
 
-@node Cutting & Storing Text, List Implementation, car cdr & cons, Top
-@comment  node-name,  next,  previous,  up
+@node Cutting & Storing Text
 @chapter Cutting and Storing Text
 @cindex Cutting and storing text
 @cindex Storing and cutting text
@@ -7655,8 +7563,8 @@ sources with `clip' and all occurrences of `killed' with `clipped'.)
 * search Exercises::
 @end menu
 
-@node Storing Text, zap-to-char, Cutting & Storing Text, Cutting & Storing Text
 @ifnottex
+@node Storing Text
 @unnumberedsec Storing Text in a List
 @end ifnottex
 
@@ -7722,8 +7630,7 @@ climb the foothills.
 A subsequent chapter describes how text that is cut from the buffer is
 retrieved.  @xref{Yanking, , Yanking Text Back}.
 
-@node zap-to-char, kill-region, Storing Text, Cutting & Storing Text
-@comment  node-name,  next,  previous,  up
+@node zap-to-char
 @section @code{zap-to-char}
 @findex zap-to-char
 
@@ -7751,8 +7658,8 @@ But first, let us look at the interactive @code{zap-to-char} function.
 * Summing up zap-to-char::      Using @code{point} and @code{search-forward}.
 @end menu
 
-@node Complete zap-to-char, zap-to-char interactive, zap-to-char, zap-to-char
 @ifnottex
+@node Complete zap-to-char
 @unnumberedsubsec The Complete @code{zap-to-char} Implementation
 @end ifnottex
 
@@ -7812,8 +7719,7 @@ Goes backward if ARG is negative; error if CHAR not found."
 The documentation is thorough.  You do need to know the jargon meaning
 of the word `kill'.
 
-@node zap-to-char interactive, zap-to-char body, Complete zap-to-char, zap-to-char
-@comment  node-name,  next,  previous,  up
+@node zap-to-char interactive
 @subsection The @code{interactive} Expression
 
 @need 800
@@ -7848,8 +7754,7 @@ to the kill ring, but does not remove it.  The echo area displays a
 message saying that the buffer is read-only.  Also, the terminal may
 beep or blink at you.
 
-@node zap-to-char body, search-forward, zap-to-char interactive, zap-to-char
-@comment  node-name,  next,  previous,  up
+@node zap-to-char body
 @subsection The Body of @code{zap-to-char}
 
 The body of the @code{zap-to-char} function contains the code that
@@ -7887,8 +7792,7 @@ It is easier to understand how @code{progn} works after learning about
 @code{search-forward}, so we will look at @code{search-forward} and
 then at @code{progn}.
 
-@node search-forward, progn, zap-to-char body, zap-to-char
-@comment  node-name,  next,  previous,  up
+@node search-forward
 @subsection The @code{search-forward} Function
 @findex search-forward
 
@@ -7963,8 +7867,7 @@ In template form, a @code{search-forward} expression looks like this:
 
 We will look at @code{progn} next.
 
-@node progn, Summing up zap-to-char, search-forward, zap-to-char
-@comment  node-name,  next,  previous,  up
+@node progn
 @subsection The @code{progn} Special Form
 @findex progn
 
@@ -8004,8 +7907,7 @@ ever a part of the distributed source.)  The value of @code{point} is
 returned by the @code{progn} expression and is passed to
 @code{kill-region} as @code{kill-region}'s second argument.
 
-@node Summing up zap-to-char,  , progn, zap-to-char
-@comment  node-name,  next,  previous,  up
+@node Summing up zap-to-char
 @subsection Summing up @code{zap-to-char}
 
 Now that we have seen how @code{search-forward} and @code{progn} work,
@@ -8026,8 +7928,7 @@ sequence as two additional arguments.  The @code{progn} expression is
 a single argument to @code{kill-region} and returns the one value that
 @code{kill-region} needs for its second argument.
 
-@node kill-region, copy-region-as-kill, zap-to-char, Cutting & Storing Text
-@comment  node-name,  next,  previous,  up
+@node kill-region
 @section @code{kill-region}
 @findex kill-region
 
@@ -8111,8 +8012,8 @@ contains the code that is called in the event of an error.
 * Lisp macro::
 @end menu
 
-@node Complete kill-region, condition-case, kill-region, kill-region
 @ifnottex
+@node Complete kill-region
 @unnumberedsubsec The Complete @code{kill-region} Definition
 @end ifnottex
 
@@ -8299,8 +8200,7 @@ The text is deleted but saved in the kill ring."
 @end smallexample
 @end ignore
 
-@node condition-case, Lisp macro, Complete kill-region, kill-region
-@comment  node-name,  next,  previous,  up
+@node condition-case
 @subsection @code{condition-case}
 @findex condition-case
 
@@ -8386,8 +8286,7 @@ this is line 8054
 Initializing a Variable with @code{defvar} includes line 8350
 @end ignore
 
-@node Lisp macro,  , condition-case, kill-region
-@comment  node-name,  next,  previous,  up
+@node Lisp macro
 @subsection Lisp macro
 @cindex Macro, lisp
 @cindex Lisp macro
@@ -8458,8 +8357,7 @@ whether the previous command was @code{kill-region}.  If it was,
 concatenates a copy of the newly clipped text to the just previously
 clipped text in the kill ring.
 
-@node copy-region-as-kill, Digression into C, kill-region, Cutting & Storing Text
-@comment  node-name,  next,  previous,  up
+@node copy-region-as-kill
 @section @code{copy-region-as-kill}
 @findex copy-region-as-kill
 @findex nthcdr
@@ -8480,8 +8378,8 @@ the function copies the text into a separate entry in the kill ring.
 * copy-region-as-kill body::      The body of @code{copy-region-as-kill}.
 @end menu
 
-@node Complete copy-region-as-kill, copy-region-as-kill body, copy-region-as-kill, copy-region-as-kill
 @ifnottex
+@node Complete copy-region-as-kill
 @unnumberedsubsec The complete @code{copy-region-as-kill} function definition
 @end ifnottex
 
@@ -8559,8 +8457,7 @@ if Transient Mark mode is turned on.
 
 The body of @code{copy-region-as-kill} merits discussion in detail.
 
-@node copy-region-as-kill body,  , Complete copy-region-as-kill, copy-region-as-kill
-@comment  node-name,  next,  previous,  up
+@node copy-region-as-kill body
 @subsection The Body of @code{copy-region-as-kill}
 
 The @code{copy-region-as-kill} function works in much the same way as
@@ -8583,8 +8480,8 @@ previous Emacs command.
 * kill-new function::
 @end menu
 
-@node last-command & this-command, kill-append function, copy-region-as-kill body, copy-region-as-kill body
 @ifnottex
+@node last-command & this-command
 @unnumberedsubsubsec @code{last-command} and @code{this-command}
 @end ifnottex
 
@@ -8639,7 +8536,7 @@ expressions are the same.
 If the previous command was @code{kill-region}, then the Emacs Lisp
 interpreter calls the @code{kill-append} function
 
-@node kill-append function, kill-new function, last-command & this-command, copy-region-as-kill body
+@node kill-append function
 @unnumberedsubsubsec The @code{kill-append} function
 @findex kill-append
 
@@ -8771,7 +8668,7 @@ of the kill ring.  The kill ring is a list, each element of which is
 saved text.  The @code{kill-append} function uses the @code{kill-new}
 function which in turn uses the @code{setcar} function.
 
-@node kill-new function,  , kill-append function, copy-region-as-kill body
+@node kill-new function
 @unnumberedsubsubsec The @code{kill-new} function
 @findex kill-new
 
@@ -9200,8 +9097,7 @@ delete-and-extract-region is written in C.
 see Initializing a Variable with @code{defvar}
 @end ignore
 
-@node Digression into C, defvar, copy-region-as-kill, Cutting & Storing Text
-@comment  node-name,  next,  previous,  up
+@node Digression into C
 @section Digression into C
 @findex delete-and-extract-region
 @cindex C, a digression into
@@ -9366,8 +9262,7 @@ From the point of view of the person writing Lisp, Emacs is all very
 simple; but hidden underneath is a great deal of complexity to make it
 all work.
 
-@node defvar, cons & search-fwd Review, Digression into C, Cutting & Storing Text
-@comment  node-name,  next,  previous,  up
+@node defvar
 @section Initializing a Variable with @code{defvar}
 @findex defvar
 @cindex Initializing a variable
@@ -9416,8 +9311,8 @@ that people customize.  It has more features than @code{defvar}.
 * defvar and asterisk::
 @end menu
 
-@node See variable current value, defvar and asterisk, defvar, defvar
 @ifnottex
+@node See variable current value
 @unnumberedsubsec Seeing the Current Value of a Variable
 @end ifnottex
 
@@ -9468,7 +9363,7 @@ like @code{apropos}, print only the first line of documentation.
 Succeeding lines should not be indented; otherwise they look odd when
 you use @kbd{C-h v} (@code{describe-variable}).
 
-@node defvar and asterisk,  , See variable current value, defvar
+@node defvar and asterisk
 @subsection @code{defvar} and an asterisk
 @findex defvar @r{for a user customizable variable}
 @findex defvar @r{with an asterisk}
@@ -9514,8 +9409,7 @@ readily.  Fortunately, you can press @key{TAB} after calling the
 The GNU Emacs Manual}.)
 
 @need 1250
-@node cons & search-fwd Review, search Exercises, defvar, Cutting & Storing Text
-@comment  node-name,  next,  previous,  up
+@node cons & search-fwd Review
 @section Review
 
 Here is a brief summary of some recently introduced functions.
@@ -9664,7 +9558,7 @@ mark from the buffer and throws it away.  You cannot get it back.
 (This is not an interactive command.)
 
 @need 1500
-@node search Exercises,  , cons & search-fwd Review, Cutting & Storing Text
+@node search Exercises
 @section Searching Exercises
 
 @itemize @bullet
@@ -9682,8 +9576,7 @@ echo area, if any; if the kill ring does not contain a third element,
 print an appropriate message.
 @end itemize
 
-@node List Implementation, Yanking, Cutting & Storing Text, Top
-@comment  node-name,  next,  previous,  up
+@node List Implementation
 @chapter How Lists are Implemented
 @cindex Lists in a computer
 
@@ -9707,8 +9600,8 @@ pointed to.  Hence, a list is kept as a series of electronic addresses.
 * List Exercise::
 @end menu
 
-@node Lists diagrammed, Symbols as Chest, List Implementation, List Implementation
 @ifnottex
+@node Lists diagrammed
 @unnumberedsec Lists diagrammed
 @end ifnottex
 
@@ -10047,7 +9940,7 @@ is the address of the empty list, of @code{nil}.
 In summary, when a Lisp variable is set to a value, it is provided with
 the address of the list to which the variable refers.
 
-@node Symbols as Chest, List Exercise, Lists diagrammed, List Implementation
+@node Symbols as Chest
 @section Symbols as a Chest of Drawers
 @cindex Symbols as a Chest of Drawers
 @cindex Chest of Drawers, metaphor for a symbol
@@ -10148,7 +10041,7 @@ Here is a fanciful representation:
 @end iftex
 @end ifclear
 
-@node List Exercise,  , Symbols as Chest, List Implementation
+@node List Exercise
 @section Exercise
 
 Set @code{flowers} to @code{violet} and @code{buttercup}.  Cons two
@@ -10156,8 +10049,7 @@ more flowers on to this list and set this new list to
 @code{more-flowers}.  Set the @sc{car} of @code{flowers} to a fish.
 What does the @code{more-flowers} list now contain?
 
-@node Yanking, Loops & Recursion, List Implementation, Top
-@comment  node-name,  next,  previous,  up
+@node Yanking
 @chapter Yanking Text Back
 @findex yank
 @cindex Text retrieval
@@ -10188,8 +10080,7 @@ list is handled as a ring.)
 * yank nthcdr Exercises::       The @code{kill-ring-yank-pointer} variable.
 @end menu
 
-@node Kill Ring Overview, kill-ring-yank-pointer, Yanking, Yanking
-@comment  node-name,  next,  previous,  up
+@node Kill Ring Overview
 @section Kill Ring Overview
 @cindex Kill ring overview
 
@@ -10232,8 +10123,7 @@ is easier to understand.)
 To begin to understand how @code{yank} and @code{yank-pop} work, it is
 first necessary to look at the @code{kill-ring-yank-pointer} variable.
 
-@node kill-ring-yank-pointer, yank nthcdr Exercises, Kill Ring Overview, Yanking
-@comment  node-name,  next,  previous,  up
+@node kill-ring-yank-pointer
 @section The @code{kill-ring-yank-pointer} Variable
 
 @code{kill-ring-yank-pointer} is a variable, just as @code{kill-ring} is
@@ -10372,7 +10262,7 @@ yanking point; just return the Nth kill forward."
 @end ignore
 
 @need 1500
-@node yank nthcdr Exercises,  , kill-ring-yank-pointer, Yanking
+@node yank nthcdr Exercises
 @section Exercises with @code{yank} and @code{nthcdr}
 
 @itemize @bullet
@@ -10389,8 +10279,7 @@ Using @code{nthcdr} and @code{car}, construct a series of expressions
 to return the first, second, third, and fourth elements of a list.
 @end itemize
 
-@node Loops & Recursion, Regexp Search, Yanking, Top
-@comment  node-name,  next,  previous,  up
+@node Loops & Recursion
 @chapter Loops and Recursion
 @cindex Loops and recursion
 @cindex Recursion and loops
@@ -10426,8 +10315,7 @@ increase the values of @code{max-specpdl-size} and
 * Looping exercise::
 @end menu
 
-@node while, dolist dotimes, Loops & Recursion, Loops & Recursion
-@comment  node-name,  next,  previous,  up
+@node while
 @section @code{while}
 @cindex Loops
 @findex while
@@ -10465,8 +10353,8 @@ The template for a @code{while} expression looks like this:
 * Decrementing Loop::           A loop with a decrementing counter.
 @end menu
 
-@node Looping with while, Loop Example, while, while
 @ifnottex
+@node Looping with while
 @unnumberedsubsec Looping with @code{while}
 @end ifnottex
 
@@ -10499,8 +10387,7 @@ This makes sense.  It is not the mere act of looping that is desired,
 but the consequences of what happens when the expressions in the loop
 are repeatedly evaluated.
 
-@node Loop Example, print-elements-of-list, Looping with while, while
-@comment  node-name,  next,  previous,  up
+@node Loop Example
 @subsection A @code{while} Loop and a List
 
 A common way to control a @code{while} loop is to test whether a list
@@ -10604,7 +10491,7 @@ This test and use of @code{cdr} can be put together in a function that
 goes through a list and prints each element of the list on a line of its
 own.
 
-@node print-elements-of-list, Incrementing Loop, Loop Example, while
+@node print-elements-of-list
 @subsection An Example: @code{print-elements-of-list}
 @findex print-elements-of-list
 
@@ -10683,8 +10570,7 @@ function is printed.  Since the last expression in the function is the
 @code{while} loop, and since @code{while} loops always return
 @code{nil}, a @code{nil} is printed after the last element of the list.
 
-@node Incrementing Loop, Incrementing Loop Details, print-elements-of-list, while
-@comment  node-name,  next,  previous,  up
+@node Incrementing Loop
 @subsection A Loop with an Incrementing Counter
 
 A loop is not useful unless it stops when it ought.  Besides
@@ -10694,8 +10580,8 @@ number of repetitions are complete.  This means that the loop must
 have a counter---an expression that counts how many times the loop
 repeats itself.
 
-@node Incrementing Loop Details, Decrementing Loop, Incrementing Loop, while
 @ifnottex
+@node Incrementing Loop Details
 @unnumberedsubsec Details of an Incrementing Loop
 @end ifnottex
 
@@ -10733,7 +10619,7 @@ is set to 1.
 * Inc Example altogether::      Putting the function definition together.
 @end menu
 
-@node Incrementing Example, Inc Example parts, Incrementing Loop Details, Incrementing Loop Details
+@node Incrementing Example
 @unnumberedsubsubsec  Example with incrementing counter
 
 Suppose you are playing on the beach and decide to make a triangle of
@@ -10800,7 +10686,7 @@ row has been added to the total of all the preceding rows.  In a more
 complex loop the repetitive action might not be so simple, but it will
 be simpler than doing everything all at once.
 
-@node Inc Example parts, Inc Example altogether, Incrementing Example, Incrementing Loop Details
+@node Inc Example parts
 @unnumberedsubsubsec The parts of the function definition
 
 The preceding analysis gives us the bones of our function definition:
@@ -10894,7 +10780,7 @@ The built-in Emacs Lisp function @code{1+} adds 1 to a number, so the
 (setq row-number (1+ row-number))
 @end smallexample
 
-@node Inc Example altogether,  , Inc Example parts, Incrementing Loop Details
+@node Inc Example altogether
 @unnumberedsubsubsec Putting the function definition together
 
 We have created the parts for the function definition; now we need to
@@ -11004,8 +10890,7 @@ can try it out.  Here are two examples:
 The sum of the first four numbers is 10 and the sum of the first seven
 numbers is 28.
 
-@node Decrementing Loop,  , Incrementing Loop Details, while
-@comment  node-name,  next,  previous,  up
+@node Decrementing Loop
 @subsection Loop with a Decrementing Counter
 
 Another common way to write a @code{while} loop is to write the test
@@ -11041,7 +10926,7 @@ The template for a decrementing @code{while} loop looks like this:
 * Dec Example altogether::      Putting the function definition together.
 @end menu
 
-@node Decrementing Example, Dec Example parts, Decrementing Loop, Decrementing Loop
+@node Decrementing Example
 @unnumberedsubsubsec Example with decrementing counter
 
 To illustrate a loop with a decrementing counter, we will rewrite the
@@ -11068,7 +10953,7 @@ rows, the number of pebbles in the last row is 7.  Likewise, we know how
 many pebbles are in the preceding row: it is one less than the number in
 the row.
 
-@node Dec Example parts, Dec Example altogether, Decrementing Example, Decrementing Loop
+@node Dec Example parts
 @unnumberedsubsubsec The parts of the function definition
 
 We start with three variables: the total number of rows in the
@@ -11130,7 +11015,7 @@ the @code{while} loop is simply:
 (while (> number-of-pebbles-in-row 0)
 @end smallexample
 
-@node Dec Example altogether,  , Dec Example parts, Decrementing Loop
+@node Dec Example altogether
 @unnumberedsubsubsec Putting the function definition together
 
 We can put these expressions together to create a function definition
@@ -11201,8 +11086,7 @@ that the test returns false after the loop has repeated itself the right
 number of times.
 @end enumerate
 
-@node dolist dotimes, Recursion, while, Loops & Recursion
-@comment  node-name,  next,  previous,  up
+@node dolist dotimes
 @section Save your time: @code{dolist} and @code{dotimes}
 
 In addition to @code{while}, both @code{dolist} and @code{dotimes}
@@ -11222,8 +11106,8 @@ each shorter version of the list to the first of its arguments.
 * dotimes::
 @end menu
 
-@node dolist, dotimes, dolist dotimes, dolist dotimes
-@unnumberedsubsubsec The @code{dolist} Macro
+@node dolist
+@unnumberedsubsec The @code{dolist} Macro
 @findex dolist
 
 Suppose, for example, you want to reverse a list, so that
@@ -11326,8 +11210,8 @@ version of the list to @code{element} and then evaluates the body of
 the expression; and repeats the loop.  The result is returned in
 @code{value}.
 
-@node dotimes,  , dolist, dolist dotimes
-@unnumberedsubsubsec The @code{dotimes} Macro
+@node dotimes
+@unnumberedsubsec The @code{dotimes} Macro
 @findex dotimes
 
 The @code{dotimes} macro is similar to @code{dolist}, except that it
@@ -11376,8 +11260,7 @@ up the number of pebbles in a triangle.
 @end group
 @end smallexample
 
-@node Recursion, Looping exercise, dolist dotimes, Loops & Recursion
-@comment  node-name,  next,  previous,  up
+@node Recursion
 @section Recursion
 @cindex Recursion
 
@@ -11403,8 +11286,7 @@ arguments that the final instance will stop.
 * No deferment solution::
 @end menu
 
-@node Building Robots, Recursive Definition Parts, Recursion, Recursion
-@comment  node-name,  next,  previous,  up
+@node Building Robots
 @subsection Building Robots: Extending the Metaphor
 @cindex Building robots
 @cindex Robots, building
@@ -11441,8 +11323,7 @@ does the same job as the first, but with different arguments.
 It is important that the arguments differ from one instance to the
 next; otherwise, the process will never stop.
 
-@node Recursive Definition Parts, Recursion with list, Building Robots, Recursion
-@comment  node-name,  next,  previous,  up
+@node Recursive Definition Parts
 @subsection The Parts of a Recursive Definition
 @cindex Parts of a Recursive Definition
 @cindex Recursive Definition Parts
@@ -11506,8 +11387,7 @@ false when the function should no longer be repeated.
 The do-again-test is sometimes called the @dfn{stop condition},
 since it stops the repetitions when it tests false.
 
-@node Recursion with list, Recursive triangle function, Recursive Definition Parts, Recursion
-@comment  node-name,  next,  previous,  up
+@node Recursion with list
 @subsection Recursion with a List
 
 The example of a @code{while} loop that printed the elements of a list
@@ -11599,8 +11479,7 @@ nil
 @end smallexample
 
 @need 2000
-@node Recursive triangle function, Recursion with cond, Recursion with list, Recursion
-@comment  node-name,  next,  previous,  up
+@node Recursive triangle function
 @subsection Recursion in Place of a Counter
 @findex triangle-recursively
 
@@ -11638,8 +11517,8 @@ its argument.
 * Recursive Example arg of 3 or 4::
 @end menu
 
-@node Recursive Example arg of 1 or 2, Recursive Example arg of 3 or 4, Recursive triangle function, Recursive triangle function
 @ifnottex
+@node Recursive Example arg of 1 or 2
 @unnumberedsubsubsec An argument of 1 or 2
 @end ifnottex
 
@@ -11701,7 +11580,7 @@ returned, which is correct.  A triangle with two rows has three
 pebbles in it.
 @end table
 
-@node Recursive Example arg of 3 or 4,  , Recursive Example arg of 1 or 2, Recursive triangle function
+@node Recursive Example arg of 3 or 4
 @unnumberedsubsubsec An argument of 3 or 4
 
 Suppose that @code{triangle-recursively} is called with an argument of
@@ -11791,8 +11670,7 @@ on.
 There is a way around this kind of waiting, which we will discuss in
 @ref{No Deferment, , Recursion without Deferments}.
 
-@node Recursion with cond, Recursive Patterns, Recursive triangle function, Recursion
-@comment  node-name,  next,  previous,  up
+@node Recursion with cond
 @subsection Recursion Example Using @code{cond}
 @findex cond
 
@@ -11868,8 +11746,7 @@ equal to 0, it returns 1 if the number is 1 and it evaluates @code{(+
 number (triangle-using-cond (1- number)))} if the number is greater than
 1.
 
-@node Recursive Patterns, No Deferment, Recursion with cond, Recursion
-@comment  node-name,  next,  previous,  up
+@node Recursive Patterns
 @subsection Recursive Patterns
 @cindex Recursive Patterns
 
@@ -11883,8 +11760,7 @@ and this provides a sense of its primal capabilities.
 * Keep::
 @end menu
 
-@node Every, Accumulate, Recursive Patterns, Recursive Patterns
-@comment  node-name,  next,  previous,  up
+@node Every
 @unnumberedsubsubsec Recursive Pattern: @emph{every}
 @cindex Every, type of recursive pattern
 @cindex Recursive pattern: every
@@ -11983,8 +11859,7 @@ But when the list has at least one element,
     @end itemize
 @end itemize
 
-@node Accumulate, Keep, Every, Recursive Patterns
-@comment  node-name,  next,  previous,  up
+@node Accumulate
 @unnumberedsubsubsec Recursive Pattern: @emph{accumulate}
 @cindex Accumulate, type of recursive pattern
 @cindex Recursive pattern: accumulate
@@ -12035,8 +11910,7 @@ Here is an example:
 @xref{Files List, , Making a List of Files}, for an example of the
 accumulate pattern.
 
-@node Keep,  , Accumulate, Recursive Patterns
-@comment  node-name,  next,  previous,  up
+@node Keep
 @unnumberedsubsubsec Recursive Pattern: @emph{keep}
 @cindex Keep, type of recursive pattern
 @cindex Recursive pattern: keep
@@ -12105,7 +11979,7 @@ Here is an example that uses @code{cond}:
 It goes without saying that you need not use @code{nil} as the test for
 when to stop; and you can, of course, combine these patterns.
 
-@node No Deferment, No deferment solution, Recursive Patterns, Recursion
+@node No Deferment
 @subsection Recursion without Deferments
 @cindex Deferment in recursion
 @cindex Recursion without Deferments
@@ -12188,7 +12062,7 @@ is being waited on.  This is not a problem when there are only a few
 steps, as in this example.  But it can be a problem when there are
 more steps.
 
-@node No deferment solution,  , No Deferment, Recursion
+@node No deferment solution
 @subsection No Deferment Solution
 @cindex No deferment solution
 @cindex Defermentless solution
@@ -12352,7 +12226,7 @@ This kind of pattern helps when you are writing functions that can use
 many resources in a computer.
 
 @need 1500
-@node Looping exercise,  , Recursion, Loops & Recursion
+@node Looping exercise
 @section Looping Exercise
 
 @itemize @bullet
@@ -12399,8 +12273,7 @@ Documentation Format}.
 @end iftex
 @end itemize
 
-@node Regexp Search, Counting Words, Loops & Recursion, Top
-@comment  node-name,  next,  previous,  up
+@node Regexp Search
 @chapter Regular Expression Searches
 @cindex Searches, illustrating
 @cindex Regular expression searches
@@ -12446,8 +12319,7 @@ introduces several new features.
 * re-search Exercises::
 @end menu
 
-@node sentence-end, re-search-forward, Regexp Search, Regexp Search
-@comment  node-name,  next,  previous,  up
+@node sentence-end
 @section The Regular Expression for @code{sentence-end}
 @findex sentence-end
 
@@ -12598,8 +12470,7 @@ return between square brackets but here it is shown as @key{RET}.
 @end table
 @end ignore
 
-@node re-search-forward, forward-sentence, sentence-end, Regexp Search
-@comment  node-name,  next,  previous,  up
+@node re-search-forward
 @section The @code{re-search-forward} Function
 @findex re-search-forward
 
@@ -12673,8 +12544,7 @@ sentence cannot go beyond a paragraph).  If the search fails, the
 function will return @code{nil}; and the repeat count will be provided
 by the argument to the @code{forward-sentence} function.
 
-@node forward-sentence, forward-paragraph, re-search-forward, Regexp Search
-@comment  node-name,  next,  previous,  up
+@node forward-sentence
 @section @code{forward-sentence}
 @findex forward-sentence
 
@@ -12691,8 +12561,8 @@ bound to the key command @kbd{M-e}.
 * fwd-sentence re-search::      A regular expression search.
 @end menu
 
-@node Complete forward-sentence, fwd-sentence while loops, forward-sentence, forward-sentence
 @ifnottex
+@node Complete forward-sentence
 @unnumberedsubsec Complete @code{forward-sentence} function definition
 @end ifnottex
 
@@ -12818,7 +12688,7 @@ point, from before the search, is used in the
 equivalents.  The @code{sentence-end} variable is set by the
 @code{sentence-end} function.
 
-@node fwd-sentence while loops, fwd-sentence re-search, Complete forward-sentence, forward-sentence
+@node fwd-sentence while loops
 @unnumberedsubsec The @code{while} loops
 
 Two @code{while} loops follow.  The first @code{while} has a
@@ -12919,7 +12789,7 @@ It may seem odd to have what looks like the `real work' of
 the @code{forward-sentence} function buried here, but this is a common
 way this kind of operation is carried out in Lisp.
 
-@node fwd-sentence re-search,  , fwd-sentence while loops, forward-sentence
+@node fwd-sentence re-search
 @unnumberedsubsec The regular expression search
 
 The @code{re-search-forward} function searches for the end of the
@@ -12967,8 +12837,7 @@ illustrated by @code{re-search-forward}, in which the search is the
 test of an @code{if} expression, is handy.  You will see or write code
 incorporating this pattern often.
 
-@node forward-paragraph, etags, forward-sentence, Regexp Search
-@comment  node-name,  next,  previous,  up
+@node forward-paragraph
 @section @code{forward-paragraph}: a Goldmine of Functions
 @findex forward-paragraph
 
@@ -13151,8 +13020,8 @@ This is an added complication.
 * fwd-para while::              The forward motion @code{while} loop.
 @end menu
 
-@node forward-paragraph in brief, fwd-para let, forward-paragraph, forward-paragraph
 @ifnottex
+@node forward-paragraph in brief
 @unnumberedsubsec Shortened @code{forward-paragraph} function definition
 @end ifnottex
 
@@ -13191,7 +13060,7 @@ This case was described earlier.  (@xref{forward-sentence, The
 @code{forward-sentence} function}.)  Now we reach the end of the
 familiar part of this function.
 
-@node fwd-para let, fwd-para while, forward-paragraph in brief, forward-paragraph
+@node fwd-para let
 @unnumberedsubsec The @code{let*} expression
 
 The next line of the @code{forward-paragraph} function begins a
@@ -13323,7 +13192,7 @@ of the @code{let*} deals with the case when the function is given a
 negative argument and is therefore moving backwards.  We will skip this
 section.
 
-@node fwd-para while,  , fwd-para let, forward-paragraph
+@node fwd-para while
 @unnumberedsubsec The forward motion @code{while} loop
 
 The second part of the body of the @code{let*} deals with forward
@@ -13596,7 +13465,7 @@ key; you will be taken directly to the source.  (Be sure to install
 your sources!  Without them, you are like a person who tries to drive
 a car with his eyes shut!)
 
-@node etags, Regexp Review, forward-paragraph, Regexp Search
+@node etags
 @section Create Your Own @file{TAGS} File
 @findex etags
 @cindex @file{TAGS} file, create own
@@ -13720,8 +13589,7 @@ as well as with some other source packages.)
 For more information, see @ref{Tags, , Tag Tables, emacs, The GNU Emacs
 Manual}.
 
-@node Regexp Review, re-search Exercises, etags, Regexp Search
-@comment  node-name,  next,  previous,  up
+@node Regexp Review
 @section Review
 
 Here is a brief summary of some recently introduced functions.
@@ -13812,7 +13680,7 @@ the buffer is narrowed.
 @end table
 
 @need 1500
-@node re-search Exercises,  , Regexp Review, Regexp Search
+@node re-search Exercises
 @section Exercises with @code{re-search-forward}
 
 @itemize @bullet
@@ -13830,7 +13698,7 @@ The function I use is described in an appendix, along with several
 regexps.  @xref{the-the, , @code{the-the} Duplicated Words Function}.
 @end itemize
 
-@node Counting Words, Words in a defun, Regexp Search, Top
+@node Counting Words
 @chapter Counting: Repetition and Regexps
 @cindex Repetition for word counting
 @cindex Regular expressions for word counting
@@ -13847,8 +13715,8 @@ word count commands using @code{while} loops and recursion.
 * Counting Exercise::
 @end menu
 
-@node Why Count Words, @value{COUNT-WORDS}, Counting Words, Counting Words
 @ifnottex
+@node Why Count Words
 @unnumberedsec Counting words
 @end ifnottex
 
@@ -13869,8 +13737,7 @@ There are many ways to implement a command to count words.  Here are
 some examples, which you may wish to compare with the standard Emacs
 command, @code{count-words-region}.
 
-@node @value{COUNT-WORDS}, recursive-count-words, Why Count Words, Counting Words
-@comment  node-name,  next,  previous,  up
+@node @value{COUNT-WORDS}
 @section The @code{@value{COUNT-WORDS}} Function
 @findex @value{COUNT-WORDS}
 
@@ -13895,8 +13762,8 @@ or to a @code{while} loop.
 * Whitespace Bug::              The Whitespace Bug in @code{@value{COUNT-WORDS}}.
 @end menu
 
-@node Design @value{COUNT-WORDS}, Whitespace Bug, @value{COUNT-WORDS}, @value{COUNT-WORDS}
 @ifnottex
+@node Design @value{COUNT-WORDS}
 @unnumberedsubsec Designing @code{@value{COUNT-WORDS}}
 @end ifnottex
 
@@ -14072,8 +13939,7 @@ table determines which characters these are."
 @noindent
 As written, the function works, but not in all circumstances.
 
-@node Whitespace Bug,  , Design @value{COUNT-WORDS}, @value{COUNT-WORDS}
-@comment  node-name,  next,  previous,  up
+@node Whitespace Bug
 @subsection The Whitespace Bug in @code{@value{COUNT-WORDS}}
 
 The @code{@value{COUNT-WORDS}} command described in the preceding
@@ -14325,8 +14191,7 @@ Here is what it looks like:
 @end group
 @end smallexample
 
-@node recursive-count-words, Counting Exercise, @value{COUNT-WORDS}, Counting Words
-@comment  node-name,  next,  previous,  up
+@node recursive-count-words
 @section Count Words Recursively
 @cindex Count words recursively
 @cindex Recursively counting words
@@ -14704,14 +14569,14 @@ determines which characters these are."
 @end group
 @end smallexample
 
-@node Counting Exercise,  , recursive-count-words, Counting Words
+@node Counting Exercise
 @section Exercise: Counting Punctuation
 
 Using a @code{while} loop, write a function to count the number of
 punctuation marks in a region---period, comma, semicolon, colon,
 exclamation mark, and question mark.  Do the same using recursion.
 
-@node Words in a defun, Readying a Graph, Counting Words, Top
+@node Words in a defun
 @chapter Counting Words in a @code{defun}
 @cindex Counting words in a @code{defun}
 @cindex Word counting in a @code{defun}
@@ -14744,8 +14609,8 @@ and this will tell.
 * Prepare the data::            Prepare the data for display in a graph.
 @end menu
 
-@node Divide and Conquer, Words and Symbols, Words in a defun, Words in a defun
 @ifnottex
+@node Divide and Conquer
 @unnumberedsec Divide and Conquer
 @end ifnottex
 
@@ -14782,7 +14647,7 @@ Fifth, write a function to print the results as a graph.
 This is quite a project!  But if we take each step slowly, it will not
 be difficult.
 
-@node Words and Symbols, Syntax, Divide and Conquer, Words in a defun
+@node Words and Symbols
 @section What to Count?
 @cindex Words and symbols in defun
 
@@ -14836,7 +14701,7 @@ that are not word constituents.  What is meant by `word constituent
 characters' brings us to the issue of syntax, which is worth a section
 of its own.
 
-@node Syntax, count-words-in-defun, Words and Symbols, Words in a defun
+@node Syntax
 @section What Constitutes a Word or Symbol?
 @cindex Syntax categories and tables
 
@@ -14920,7 +14785,7 @@ Here is the full regular expression:
 "\\(\\w\\|\\s_\\)+[^ \t\n]*[ \t\n]*"
 @end smallexample
 
-@node count-words-in-defun, Several defuns, Syntax, Words in a defun
+@node count-words-in-defun
 @section The @code{count-words-in-defun} Function
 @cindex Counting words in a @code{defun}
 
@@ -15114,7 +14979,7 @@ Success!  The definition has 10 words and symbols.
 The next problem is to count the numbers of words and symbols in
 several definitions within a single file.
 
-@node Several defuns, Find a File, count-words-in-defun, Words in a defun
+@node Several defuns
 @section Count Several @code{defuns} Within a File
 
 A file such as @file{simple.el} may have a hundred or more function
@@ -15169,8 +15034,7 @@ switched back and forth to some other buffer, such as the
 
 Finding a file is a new process that we have not yet discussed.
 
-@node Find a File, lengths-list-file, Several defuns, Words in a defun
-@comment  node-name,  next,  previous,  up
+@node Find a File
 @section Find a File
 @cindex Find a File
 
@@ -15253,7 +15117,7 @@ our own expression.
 
 The task is easy: use @code{find-file-noselect} and @code{set-buffer}.
 
-@node lengths-list-file, Several files, Find a File, Words in a defun
+@node lengths-list-file
 @section @code{lengths-list-file} in Detail
 
 The core of the @code{lengths-list-file} function is a @code{while}
@@ -15394,7 +15258,7 @@ earlier one; and my new machine is much faster than the old one.)
 Note that the length of the last definition in the file is first in
 the list.
 
-@node Several files, Several files recursively, lengths-list-file, Words in a defun
+@node Several files
 @section Count Words in @code{defuns} in Different Files
 
 In the previous section, we created a function that returns a list of
@@ -15410,8 +15274,8 @@ either a @code{while} loop or recursion.
 * append::                      Attach one list to another.
 @end menu
 
-@node lengths-list-many-files, append, Several files, Several files
 @ifnottex
+@node lengths-list-many-files
 @unnumberedsubsec Determine the lengths of @code{defuns}
 @end ifnottex
 
@@ -15507,7 +15371,7 @@ The only other new element of this function definition is the as yet
 unstudied function @code{append}, which merits a short section for
 itself.
 
-@node append,  , lengths-list-many-files, Several files
+@node append
 @subsection The @code{append} Function
 
 @need 800
@@ -15542,7 +15406,7 @@ becomes the first element of the new list:
 ((1 2 3 4) 5 6 7 8)
 @end smallexample
 
-@node Several files recursively, Prepare the data, Several files, Words in a defun
+@node Several files recursively
 @section Recursively Count Words in Different Files
 
 Besides a @code{while} loop, you can work on each of a list of files
@@ -15625,7 +15489,7 @@ output we want.
 
 The next step is to prepare the data in the list for display in a graph.
 
-@node Prepare the data,  , Several files recursively, Words in a defun
+@node Prepare the data
 @section Prepare the Data for Display in a Graph
 
 The @code{recursive-lengths-list-many-files} function returns a list
@@ -15648,8 +15512,8 @@ numbers.
 * Counting function definitions::
 @end menu
 
-@node Data for Display in Detail, Sorting, Prepare the data, Prepare the data
 @ifnottex
+@node Data for Display in Detail
 @unnumberedsubsec The Data for Display in Detail
 @end ifnottex
 
@@ -15667,7 +15531,7 @@ inspecting a sorted list, we can discover the highest and lowest
 number, and thereby determine the largest and smallest length range
 that we will need.
 
-@node Sorting, Files List, Data for Display in Detail, Prepare the data
+@node Sorting
 @subsection Sorting Lists
 @findex sort
 
@@ -15746,7 +15610,7 @@ which produces:
 quoted, since the expression must be evaluated so as to produce the
 list that is passed to @code{sort}.)
 
-@node Files List, Counting function definitions, Sorting, Prepare the data
+@node Files List
 @subsection Making a List of Files
 
 The @code{recursive-lengths-list-many-files} function requires a list
@@ -16007,7 +15871,7 @@ like this:
   (insert (format "%s" (current-time-string))))
 @end ignore
 
-@node Counting function definitions,  , Files List, Prepare the data
+@node Counting function definitions
 @subsection Counting function definitions
 
 Our immediate goal is to generate a list that tells us how many
@@ -16311,7 +16175,7 @@ between 120 and 129, and so on.  There are four elements with a value
 of 200 or larger.
 
 @c The next step is to turn this numbers' list into a graph.
-@node Readying a Graph, Emacs Initialization, Words in a defun, Top
+@node Readying a Graph
 @chapter Readying a Graph
 @cindex Readying a graph
 @cindex Graph prototype
@@ -16343,8 +16207,8 @@ the function to label the axes automatically.
 * Line Graph Exercise::
 @end menu
 
-@node Columns of a graph, graph-body-print, Readying a Graph, Readying a Graph
 @ifnottex
+@node Columns of a graph
 @unnumberedsec Printing the Columns of a Graph
 @end ifnottex
 
@@ -16716,7 +16580,7 @@ Now, finally, we come to our first actual graph printing function.
 This prints the body of a graph, not the labels for the vertical and
 horizontal axes, so we can call this @code{graph-body-print}.
 
-@node graph-body-print, recursive-graph-body-print, Columns of a graph, Readying a Graph
+@node graph-body-print
 @section The @code{graph-body-print} Function
 @findex graph-body-print
 
@@ -16875,7 +16739,7 @@ Emacs will print a graph like this:
 @end group
 @end smallexample
 
-@node recursive-graph-body-print, Printed Axes, graph-body-print, Readying a Graph
+@node recursive-graph-body-print
 @section The @code{recursive-graph-body-print} Function
 @findex recursive-graph-body-print
 
@@ -16962,7 +16826,7 @@ Here is what @code{recursive-graph-body-print} produces:
 Either of these two functions, @code{graph-body-print} or
 @code{recursive-graph-body-print}, create the body of a graph.
 
-@node Printed Axes, Line Graph Exercise, recursive-graph-body-print, Readying a Graph
+@node Printed Axes
 @section Need for Printed Axes
 
 A graph needs printed axes, so you can orient yourself.  For a do-once
@@ -16975,12 +16839,12 @@ the horizontal and vertical axes.  Since the label printing functions
 do not contain much new material, I have placed their description in
 an appendix.  @xref{Full Graph, , A Graph with Labeled Axes}.
 
-@node Line Graph Exercise,  , Printed Axes, Readying a Graph
+@node Line Graph Exercise
 @section Exercise
 
 Write a line graph version of the graph printing functions.
 
-@node Emacs Initialization, Debugging, Readying a Graph, Top
+@node Emacs Initialization
 @chapter Your @file{.emacs} File
 @cindex @file{.emacs} file
 @cindex Customizing your @file{.emacs} file
@@ -17012,8 +16876,8 @@ expressions in Emacs Lisp you can change or extend Emacs.
 * Mode Line::                   How to customize your mode line.
 @end menu
 
-@node Default Configuration, Site-wide Init, Emacs Initialization, Emacs Initialization
 @ifnottex
+@node Default Configuration
 @unnumberedsec Emacs's Default Configuration
 @end ifnottex
 
@@ -17059,7 +16923,7 @@ describes a simple @file{.emacs} file; for more information, see
 @ref{Init File, , The Init File, elisp, The GNU Emacs Lisp Reference
 Manual}.
 
-@node Site-wide Init, defcustom, Default Configuration, Emacs Initialization
+@node Site-wide Init
 @section Site-wide Initialization Files
 
 @cindex @file{default.el} init file
@@ -17105,7 +16969,7 @@ The @file{loaddefs.el} file contains a good many suggestions as to
 what to put into your own @file{.emacs} file, or into a site-wide
 initialization file.
 
-@node defcustom, Beginning a .emacs File, Site-wide Init, Emacs Initialization
+@node defcustom
 @section Specifying Variables using @code{defcustom}
 @findex defcustom
 
@@ -17270,7 +17134,7 @@ intent is that neither programs nor users should ever change a value
 set by @code{defconst}.  (You can change it; the value set is a
 variable; but please do not.)
 
-@node Beginning a .emacs File, Text and Auto-fill, defcustom, Emacs Initialization
+@node Beginning a .emacs File
 @section Beginning a @file{.emacs} File
 @cindex @file{.emacs} file, beginning of
 
@@ -17353,7 +17217,7 @@ Of course, you don't need to include comments like these in your
 about Mode help or the conventions for comments---but I was able to
 remember to look here to remind myself.
 
-@node Text and Auto-fill, Mail Aliases, Beginning a .emacs File, Emacs Initialization
+@node Text and Auto-fill
 @section Text and Auto Fill Mode
 
 Now we come to the part that `turns on' Text mode and
@@ -17475,7 +17339,7 @@ fill commands to insert two spaces after a colon:
 (setq colon-double-space t)
 @end smallexample
 
-@node Mail Aliases, Indent Tabs Mode, Text and Auto-fill, Emacs Initialization
+@node Mail Aliases
 @section Mail Aliases
 
 Here is a @code{setq} that `turns on' mail aliases, along with more
@@ -17509,7 +17373,7 @@ alias geo george@@foobar.wiz.edu
 When you write a message to George, address it to @samp{geo}; the
 mailer will automatically expand @samp{geo} to the full address.
 
-@node Indent Tabs Mode, Keybindings, Mail Aliases, Emacs Initialization
+@node Indent Tabs Mode
 @section Indent Tabs Mode
 @cindex Tabs, preventing
 @findex indent-tabs-mode
@@ -17547,7 +17411,7 @@ Files'' in @cite{The GNU Emacs Manual}.
 @end iftex
 
 @need 1700
-@node Keybindings, Keymaps, Indent Tabs Mode, Emacs Initialization
+@node Keybindings
 @section Some Keybindings
 
 Now for some personal keybindings:
@@ -17660,7 +17524,7 @@ window, I prefer the  @code{buffer-menu}
 command, which not only lists the buffers,
 but moves point into that window.
 
-@node Keymaps, Loading Files, Keybindings, Emacs Initialization
+@node Keymaps
 @section Keymaps
 @cindex Keymaps
 @cindex Rebinding keys
@@ -17728,7 +17592,7 @@ You will see numerous @code{define-key} expressions in
 Manual}, and @ref{Keymaps, , Keymaps, elisp, The GNU Emacs Lisp
 Reference Manual}, for more information about keymaps.
 
-@node Loading Files, Autoload, Keymaps, Emacs Initialization
+@node Loading Files
 @section Loading Files
 @cindex Loading files
 @c findex load
@@ -17820,7 +17684,7 @@ Another interactive command that does a slightly different job is
 Emacs, emacs, The GNU Emacs Manual}, for information on the
 distinction between @code{load-library} and this command.
 
-@node Autoload, Simple Extension, Loading Files, Emacs Initialization
+@node Autoload
 @section Autoloading
 @findex autoload
 
@@ -17889,7 +17753,7 @@ documentation is not available.)
 @xref{Autoload, , Autoload, elisp, The GNU Emacs Lisp Reference
 Manual}, for more information.
 
-@node Simple Extension, X11 Colors, Autoload, Emacs Initialization
+@node Simple Extension
 @section A Simple Extension: @code{line-to-top-of-window}
 @findex line-to-top-of-window
 @cindex Simple extension in @file{.emacs} file
@@ -18001,7 +17865,7 @@ emacs -Q - D
 @end group
 @end smallexample
 
-@node X11 Colors, Miscellaneous, Simple Extension, Emacs Initialization
+@node X11 Colors
 @section X11 Colors
 
 You can specify colors when you use Emacs with the MIT X Windowing
@@ -18079,7 +17943,7 @@ xsetroot -solid Navy -fg white &
 @end smallexample
 
 @need 1700
-@node Miscellaneous, Mode Line, X11 Colors, Emacs Initialization
+@node Miscellaneous
 @section Miscellaneous Settings for a @file{.emacs} File
 
 @need 1250
@@ -18271,7 +18135,7 @@ xmodmap -e "keysym Alt_L = Meta_L Alt_L"
 @end smallexample
 
 @need 1700
-@node Mode Line,  , Miscellaneous, Emacs Initialization
+@node Mode Line
 @section A Modified Mode Line
 @vindex mode-line-format
 @cindex Mode line format
@@ -18434,7 +18298,7 @@ This will start an Emacs that does @emph{not} load your
 @file{~/.emacs} initialization file.  A plain, default Emacs.  Nothing
 more.
 
-@node Debugging, Conclusion, Emacs Initialization, Top
+@node Debugging
 @chapter Debugging
 @cindex debugging
 
@@ -18454,7 +18318,7 @@ In this chapter, I will walk through a short example of each.
 * Debugging Exercises::
 @end menu
 
-@node debug, debug-on-entry, Debugging, Debugging
+@node debug
 @section @code{debug}
 @findex debug
 
@@ -18581,7 +18445,7 @@ Debugger entered--Lisp error: (void-function 1=)
 You can correct the mistake, re-evaluate the function definition, and
 then run your test again.
 
-@node debug-on-entry, debug-on-quit, debug, Debugging
+@node debug-on-entry
 @section @code{debug-on-entry}
 @findex debug-on-entry
 
@@ -18720,7 +18584,7 @@ M-x cancel-debug-on-entry RET triangle-bugged RET
 @noindent
 (If you are reading this in Info, cancel @code{debug-on-entry} now.)
 
-@node debug-on-quit, edebug, debug-on-entry, Debugging
+@node debug-on-quit
 @section @code{debug-on-quit} and @code{(debug)}
 
 In addition to setting @code{debug-on-error} or calling @code{debug-on-entry},
@@ -18752,7 +18616,7 @@ where you want the debugger to start, like this:
 The @code{debug} function is described in detail in @ref{Debugger, ,
 The Lisp Debugger, elisp, The GNU Emacs Lisp Reference Manual}.
 
-@node edebug, Debugging Exercises, debug-on-quit, Debugging
+@node edebug
 @section The @code{edebug} Source Level Debugger
 @cindex Source level debugger
 @findex edebug
@@ -18895,7 +18759,7 @@ Edebug is described in @ref{edebug, , Edebug, elisp, The GNU Emacs
 Lisp Reference Manual}.
 
 @need 1500
-@node Debugging Exercises,  , edebug, Debugging
+@node Debugging Exercises
 @section Debugging Exercises
 
 @itemize @bullet
@@ -18940,7 +18804,7 @@ Set a breakpoint, then run Edebug in Trace mode until it reaches the
 stopping point.
 @end itemize
 
-@node Conclusion, the-the, Debugging, Top
+@node Conclusion
 @chapter Conclusion
 
 We have now reached the end of this Introduction.  You have now
@@ -19060,7 +18924,7 @@ beginning.
 
 @c ================ Appendix ================
 
-@node the-the, Kill Ring, Conclusion, Top
+@node the-the
 @appendix The @code{the-the} Function
 @findex the-the
 @cindex Duplicated words function
@@ -19157,7 +19021,7 @@ five six seven
 You can substitute the other regular expressions shown above in the
 function definition and try each of them on this list.
 
-@node Kill Ring, Full Graph, the-the, Top
+@node Kill Ring
 @appendix Handling the Kill Ring
 @cindex Kill ring handling
 @cindex Handling the kill ring
@@ -19179,8 +19043,8 @@ consider the workings of the kill ring.
 * ring file::
 @end menu
 
-@node What the Kill Ring Does, current-kill, Kill Ring, Kill Ring
 @ifnottex
+@node What the Kill Ring Does
 @unnumberedsec What the Kill Ring Does
 @end ifnottex
 
@@ -19254,8 +19118,7 @@ To return to the old value for the length of the kill ring, evaluate:
 (setq kill-ring-max old-kill-ring-max)
 @end smallexample
 
-@node current-kill, yank, What the Kill Ring Does, Kill Ring
-@comment  node-name,  next,  previous,  up
+@node current-kill
 @appendixsec The @code{current-kill} Function
 @findex current-kill
 
@@ -19272,8 +19135,8 @@ and @code{kill-region}.)
 * Understanding current-kill::
 @end menu
 
-@node Code for current-kill, Understanding current-kill, current-kill, current-kill
 @ifnottex
+@node Code for current-kill
 @unnumberedsubsec The code for @code{current-kill}
 @end ifnottex
 
@@ -19333,8 +19196,8 @@ Here is the line in @code{kill-new}, which is explained in
 (setq kill-ring-yank-pointer kill-ring)
 @end smallexample
 
-@node Understanding current-kill,  , Code for current-kill, current-kill
 @ifnottex
+@node Understanding current-kill
 @unnumberedsubsec @code{current-kill} in Outline
 @end ifnottex
 
@@ -19360,8 +19223,8 @@ documentation string.  It is @emph{not} interactive.
 * Determining the Element::
 @end menu
 
-@node Body of current-kill, Digression concerning error, Understanding current-kill, Understanding current-kill
 @ifnottex
+@node Body of current-kill
 @unnumberedsubsubsec The Body of @code{current-kill}
 @end ifnottex
 
@@ -19443,8 +19306,8 @@ current value of @code{kill-ring-yank-pointer} is set to point to the
 list.  Finally, another expression returns the first element of the
 list even if the @code{do-not-move} argument is true.
 
-@node Digression concerning error, Determining the Element, Body of current-kill, Understanding current-kill
 @ifnottex
+@node Digression concerning error
 @unnumberedsubsubsec Digression about the word `error'
 @end ifnottex
 
@@ -19465,8 +19328,8 @@ environment, is making an error.  This is bad.  Even though the computer
 takes the same steps as it does when there is an `error', a term such as
 `cancel' would have a clearer connotation.
 
-@node Determining the Element,  , Digression concerning error, Understanding current-kill
 @ifnottex
+@node Determining the Element
 @unnumberedsubsubsec Determining the Element
 @end ifnottex
 
@@ -19603,8 +19466,7 @@ them in an argument list (and within expressions called by them).
 @ref{defun, , The @code{defun} Special Form}.)
 @end ignore
 
-@node yank, yank-pop, current-kill, Kill Ring
-@comment  node-name,  next,  previous,  up
+@node yank
 @appendixsec @code{yank}
 @findex yank
 
@@ -19689,8 +19551,7 @@ function.)
 
 The last part of the function tells what to do when it succeeds.
 
-@node yank-pop, ring file, yank, Kill Ring
-@comment  node-name,  next,  previous,  up
+@node yank-pop
 @appendixsec @code{yank-pop}
 @findex yank-pop
 
@@ -19760,8 +19621,7 @@ positions of point and mark set by the preceding @code{yank} command.
 
 There is more, but that is the hardest part.
 
-@node ring file,  , yank-pop, Kill Ring
-@comment  node-name,  next,  previous,  up
+@node ring file
 @appendixsec The @file{ring.el} File
 @cindex @file{ring.el} file
 
@@ -19770,7 +19630,7 @@ provides many of the features we just discussed.  But functions such
 as @code{kill-ring-yank-pointer} do not use this library, possibly
 because they were written earlier.
 
-@node Full Graph, Free Software and Free Manuals, Kill Ring, Top
+@node Full Graph
 @appendix A Graph with Labeled Axes
 
 Printed axes help you understand a graph.  They convey scale.  In an
@@ -19787,8 +19647,8 @@ body itself.
 * Print Whole Graph::           The function to print a complete graph.
 @end menu
 
-@node Labeled Example, print-graph Varlist, Full Graph, Full Graph
 @ifnottex
+@node Labeled Example
 @unnumberedsec Labeled Example Graph
 @end ifnottex
 
@@ -19875,8 +19735,7 @@ These considerations suggest the following outline for the
 We can work on each part of the @code{print-graph} function definition
 in turn.
 
-@node print-graph Varlist, print-Y-axis, Labeled Example, Full Graph
-@comment  node-name,  next,  previous,  up
+@node print-graph Varlist
 @appendixsec The @code{print-graph} Varlist
 @cindex @code{print-graph} varlist
 
@@ -19917,8 +19776,7 @@ in the @code{let} for @code{print-graph}:
 As we shall see, this expression is not quite right.
 
 @need 2000
-@node print-Y-axis, print-X-axis, print-graph Varlist, Full Graph
-@comment  node-name,  next,  previous,  up
+@node print-Y-axis
 @appendixsec The @code{print-Y-axis} Function
 @cindex Axis, print vertical
 @cindex Y axis printing
@@ -19956,8 +19814,8 @@ construct and insert the appropriate numbers and marks.
 * print-Y-axis Penultimate::    A not quite final version.
 @end menu
 
-@node print-Y-axis in Detail, Height of label, print-Y-axis, print-Y-axis
 @ifnottex
+@node print-Y-axis in Detail
 @unnumberedsubsec The @code{print-Y-axis} Function in Detail
 @end ifnottex
 
@@ -19972,8 +19830,8 @@ the base line (number 1) and then that we want a number and a tic on
 the fifth line from the bottom and on every line that is a multiple of
 five.
 
-@node Height of label, Compute a Remainder, print-Y-axis in Detail, print-Y-axis
 @ifnottex
+@node Height of label
 @unnumberedsubsec What height should the label be?
 @end ifnottex
 
@@ -20010,7 +19868,7 @@ language, more reminiscent of the classroom, five goes into seven
 once, with a remainder of two.  However, five goes into ten twice,
 with no remainder: ten is an integral multiple of five.
 
-@node Compute a Remainder, Y Axis Element, Height of label, print-Y-axis
+@node Compute a Remainder
 @appendixsubsec Side Trip: Compute a Remainder
 
 @findex % @r{(remainder function)}
@@ -20144,7 +20002,7 @@ then the resulting value of  @code{height} is used to compute its
 final value.  @xref{fwd-para let, , The @code{let*} expression}, for
 more about @code{let*}.)
 
-@node Y Axis Element, Y-axis-column, Compute a Remainder, print-Y-axis
+@node Y Axis Element
 @appendixsubsec Construct a Y Axis Element
 
 When we print the vertical axis, we want to insert strings such as
@@ -20250,7 +20108,7 @@ The @code{number-to-string} function is used in the concatenation
 expression, to convert the number to a string that is concatenated
 with the leading spaces and the tic mark.
 
-@node Y-axis-column, print-Y-axis Penultimate, Y Axis Element, print-Y-axis
+@node Y-axis-column
 @appendixsubsec Create a Y Axis Column
 
 The preceding functions provide all the tools needed to construct a
@@ -20297,7 +20155,7 @@ blank label using the @code{make-string} function.  The base line
 consists of the number one followed by a tic mark.
 
 @need 2000
-@node print-Y-axis Penultimate,  , Y-axis-column, print-Y-axis
+@node print-Y-axis Penultimate
 @appendixsubsec The Not Quite Final Version of @code{print-Y-axis}
 
 The list constructed by the @code{Y-axis-column} function is passed to
@@ -20373,7 +20231,7 @@ Emacs will print labels vertically, the top one being @w{@samp{10 -@w{
 thereby getting rid of what might appear as a bug.)
 
 @need 2000
-@node print-X-axis, Print Whole Graph, print-Y-axis, Full Graph
+@node print-X-axis
 @appendixsec The @code{print-X-axis} Function
 @cindex Axis, print horizontal
 @cindex X axis printing
@@ -20409,8 +20267,8 @@ graph without changing the ways the graph is labeled.
 * X Axis Tic Marks::            Create tic marks for the horizontal axis.
 @end menu
 
-@node Similarities differences, X Axis Tic Marks, print-X-axis, print-X-axis
 @ifnottex
+@node Similarities differences
 @unnumberedsubsec Similarities and differences
 @end ifnottex
 
@@ -20435,7 +20293,7 @@ using @code{print-X-axis-tic-line} and
 @code{print-X-axis-numbered-line}.
 @end enumerate
 
-@node X Axis Tic Marks,  , Similarities differences, print-X-axis
+@node X Axis Tic Marks
 @appendixsubsec X Axis Tic Marks
 
 The first function should print the X axis tic marks.  We must specify
@@ -20724,7 +20582,7 @@ Emacs will print the horizontal axis like this:
 @end group
 @end smallexample
 
-@node Print Whole Graph,  , print-X-axis, Full Graph
+@node Print Whole Graph
 @appendixsec Printing the Whole Graph
 @cindex Printing the whole graph
 @cindex Whole graph printing
@@ -20763,8 +20621,8 @@ Here is the outline:
 * Final printed graph::         The graph itself!
 @end menu
 
-@node The final version, Test print-graph, Print Whole Graph, Print Whole Graph
 @ifnottex
+@node The final version
 @unnumberedsubsec Changes for the Final Version
 @end ifnottex
 
@@ -20915,7 +20773,7 @@ each row is five units."
 @end group
 @end smallexample
 
-@node Test print-graph, Graphing words in defuns, The final version, Print Whole Graph
+@node Test print-graph
 @appendixsubsec Testing @code{print-graph}
 
 @need 1250
@@ -21005,7 +20863,7 @@ The graph looks like this:
 feature?  If you think it is a bug, and should be a `1' instead, (or
 even a `0'), you can modify the sources.)
 
-@node Graphing words in defuns, lambda, Test print-graph, Print Whole Graph
+@node Graphing words in defuns
 @appendixsubsec Graphing Numbers of Words and Symbols
 
 Now for the graph for which all this code was written: a graph that
@@ -21093,7 +20951,7 @@ not yet seen, @code{mapcar} and @code{lambda}.
 @end group
 @end smallexample
 
-@node lambda, mapcar, Graphing words in defuns, Print Whole Graph
+@node lambda
 @appendixsubsec A @code{lambda} Expression: Useful Anonymity
 @cindex Anonymous function
 @findex lambda
@@ -21259,7 +21117,7 @@ divides that number by 50.
 Lisp Reference Manual}, for more about @code{lambda}.  Lisp and lambda
 expressions derive from the Lambda Calculus.
 
-@node mapcar, Another Bug, lambda, Print Whole Graph
+@node mapcar
 @appendixsubsec The @code{mapcar} Function
 @findex mapcar
 
@@ -21343,7 +21201,7 @@ information: many of the higher ranges are 0, meaning that fewer than
 50 defuns had that many words or symbols---but not necessarily meaning
 that none had that many words or symbols.)
 
-@node Another Bug, Final printed graph, mapcar, Print Whole Graph
+@node Another Bug
 @appendixsubsec Another Bug @dots{} Most Insidious
 @cindex Bug, most insidious type
 @cindex Insidious type of bug
@@ -22040,7 +21898,7 @@ each column."
 @end ignore
 
 @page
-@node Final printed graph,  , Another Bug, Print Whole Graph
+@node Final printed graph
 @appendixsubsec The Printed Graph
 
 When made and installed, you can call the @code{print-graph} command
@@ -22090,7 +21948,7 @@ Here is the graph:
 @noindent
 The largest group of functions contain 10 -- 19 words and symbols each.
 
-@node Free Software and Free Manuals, GNU Free Documentation License, Full Graph, Top
+@node Free Software and Free Manuals
 @appendix Free Software and Free Manuals
 
 @strong{by Richard M. Stallman}
@@ -22210,14 +22068,13 @@ Note: The Free Software Foundation maintains a page on its Web site
 that lists free books available from other publishers:@*
 @uref{http://www.gnu.org/doc/other-free-books.html}
 
-@node GNU Free Documentation License, Index, Free Software and Free Manuals, Top
+@node GNU Free Documentation License
 @appendix GNU Free Documentation License
 
 @cindex FDL, GNU Free Documentation License
 @include doclicense.texi
 
-@node Index, About the Author, GNU Free Documentation License, Top
-@comment  node-name,  next,  previous,  up
+@node Index
 @unnumbered Index
 
 @ignore
@@ -22256,7 +22113,7 @@ MENU ENTRY: NODE NAME.
 @end iftex
 
 @ifnottex
-@node About the Author,  , Index, Top
+@node About the Author
 @unnumbered About the Author
 @end ifnottex
 
index a8aaf43096e51cdb1333fab855d405c9f74fd423..ea9b04b87ca6cd90cb2f9abccf0970594d4011c9 100644 (file)
@@ -1,6 +1,6 @@
 #### -*- Makefile -*- for the Emacs Lisp Introduction manual.
 
-# Copyright (C) 2003-2012  Free Software Foundation, Inc.
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -24,10 +24,12 @@ infodir = $(srcdir)/../../info
 # Directory with the (customized) texinfo.tex file.
 texinfodir = $(srcdir)/../misc
 
+INFO_EXT=.info
+INFO_OPTS=--no-split
 INFO_SOURCES = $(srcdir)/emacs-lisp-intro.texi $(srcdir)/doclicense.texi
 # The file name eintr must fit within 5 characters, to allow for
 # -NN extensions to fit into DOS 8+3 limits without clashing
-INFO_TARGETS = $(infodir)/eintr
+INFO_TARGETS = $(infodir)/eintr$(INFO_EXT)
 DVI_TARGETS = emacs-lisp-intro.dvi
 
 MAKEINFO = makeinfo
@@ -47,8 +49,8 @@ $(infodir)/dir:
 
 dvi: $(DVI_TARGETS)
 
-$(infodir)/eintr: $(INFO_SOURCES)
-       $(MAKEINFO) -o $@ $(srcdir)/emacs-lisp-intro.texi
+$(infodir)/eintr$(INFO_EXT): $(INFO_SOURCES)
+       $(MAKEINFO) $(INFO_OPTS) -o $@ $(srcdir)/emacs-lisp-intro.texi
 
 emacs-lisp-intro.dvi: $(INFO_SOURCES)
        $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-lisp-intro.texi
@@ -66,7 +68,7 @@ mostlyclean:
        - $(DEL) *.log *.cp *.fn *.ky *.pg *.vr *.tp
 
 clean: mostlyclean
-       - $(DEL) *.dvi $(infodir)/eintr*
+       - $(DEL) *.dvi $(infodir)/eintr$(INFO_EXT)*
 
 distclean: clean
        - $(DEL) makefile
index ed9aab245eabb53dc1160c5fd36b146edb2f390b..bc01d64c509dd4827dc0528163d819dcb6c7561c 100644 (file)
-2012-06-19  Glenn Morris  <rgm@gnu.org>
+2012-07-17  Chong Yidong  <cyd@gnu.org>
+
+       * text.texi (Insertion): Document insert-char changes.
+
+2012-07-15  Leo Liu  <sdl.web@gmail.com>
+
+       * display.texi (Fringe Bitmaps): Add exclamation-mark.
+
+2012-07-13  Chong Yidong  <cyd@gnu.org>
+
+       * buffers.texi (Read Only Buffers): Document toggle-read-only
+       changes.  Reword to account for the fact that read-only is
+       currently not supported in overlay properties.
+
+2012-07-07  Chong Yidong  <cyd@gnu.org>
+
+       * loading.texi (Library Search): Index site-lisp directories.
+
+2012-07-06  Chong Yidong  <cyd@gnu.org>
+
+       * intro.texi (A Sample Function Description): Fix incorrect
+       markup, undoing previous change.
+       (A Sample Variable Description): Minor clarifications and markup
+       improvements.
+
+       * elisp.texi (Top):
+       * text.texi (Text): Fix menu order.
+
+2012-07-06  Richard Stallman  <rms@gnu.org>
+
+       * intro.texi (Evaluation Notation, A Sample Function Description):
+       (A Sample Variable Description): Improve/undo previous changes.
+
+2012-07-05  Glenn Morris  <rgm@gnu.org>
+
+       * intro.texi (A Sample Function Description): Fix cross-refs.
+
+2012-07-05  Michael Witten  <mfwitten@gmail.com>  (tiny change)
+
+       * intro.texi (Evaluation Notation, A Sample Function Description)
+       (A Sample Variable Description, Version Info): Copy edits (bug#11862).
+
+2012-06-27  Chong Yidong  <cyd@gnu.org>
+
+       * processes.texi (Asynchronous Processes, Input to Processes):
+       * internals.texi (Process Internals): Don't capitalize "pty".
+
+2012-06-24  Thien-Thi Nguyen  <ttn@gnuvola.org>
+
+       * processes.texi (Asynchronous Processes): Make the pty vs pipe
+       discussion more prominent.
+
+2012-06-23  Eli Zaretskii  <eliz@gnu.org>
+
+       * commands.texi (Misc Events): Document the language-change event.
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Support higher-resolution time stamps (Bug#9000).
+       * os.texi (Time of Day, Time Parsing, Processor Run Time, Idle Timers):
+       * processes.texi (System Processes):
+       Time stamp resolution is now picosecond, not microsecond.
+
+2012-06-21  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in: Rename infodir to buildinfodir throughout.  (Bug#11737)
 
+2012-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * functions.texi (Defining Functions):
+       * macros.texi (Defining Macros): Un-define the return value of `defun',
+       `defmacro' and `defalias'.
+
+2012-06-17  Chong Yidong  <cyd@gnu.org>
+
+       * elisp.texi: Remove urlcolor setting.
+
+2012-06-17  Glenn Morris  <rgm@gnu.org>
+
+       * display.texi (Face Attributes): Copyedits.  Add a few cindex entries.
+       Overlining no longer behaves exactly like underlining.
+
+2012-06-16  Aurelien Aptel  <aurelien.aptel@gmail.com>
+
+       * display.texi (Face Attributes):
+       Document wave-style underline face attribute.
+
 2012-06-11  Chong Yidong  <cyd@gnu.org>
 
-       * elisp.texi, vol1.texi, vol2.texi: Remove urlcolor setting.
+       * display.texi (ImageMagick Images): ImageMagick now supports the
+       :background property.
+
+2012-06-10  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * internals.texi (Garbage Collection): Typo fix.
+
+2012-06-09  Chong Yidong  <cyd@gnu.org>
+
+       * text.texi (Special Properties): Clarify the meaning of a list of
+       faces in the `face' property.
+
+       * display.texi (Face Remapping): Minor clarification.
+
+2012-06-08  Chong Yidong  <cyd@gnu.org>
+
+       * display.texi (Face Attributes): Font family does not accept
+       wildcards.  De-document obsolete :bold and :italic attributes.
+       (Defining Faces): Use new-style face spec format.
+
+2012-06-08  Dmitry Antipov  <dmantipov@yandex.ru>
 
-       * vol2.texi: Include package.texi.
+       * internals.text (Garbage Collection): Document new
+       vector management code and vectorlike_header structure.
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-03  Chong Yidong  <cyd@gnu.org>
 
-       * Version 24.1 released.
+       * modes.texi (Mode Line Data): Use "mode line construct"
+       terminology for consistency.
 
-2012-05-15  Chong Yidong  <cyd@gnu.org>
+2012-05-27  Glenn Morris  <rgm@gnu.org>
 
-       * functions.texi (Obsolete Functions): Fix doc for
-       set-advertised-calling-convention.
+       * abbrevs.texi, advice.texi, anti.texi, backups.texi:
+       * buffers.texi, commands.texi, compile.texi, control.texi:
+       * customize.texi, debugging.texi, display.texi, doclicense.texi:
+       * edebug.texi, elisp.texi, errors.texi, eval.texi, files.texi:
+       * frames.texi, functions.texi, gpl.texi, hash.texi, help.texi:
+       * hooks.texi, index.texi, internals.texi, intro.texi, keymaps.texi:
+       * lists.texi, loading.texi, macros.texi, maps.texi, markers.texi:
+       * minibuf.texi, modes.texi, nonascii.texi, numbers.texi:
+       * objects.texi, os.texi, package.texi, positions.texi:
+       * processes.texi, searching.texi, sequences.texi, streams.texi:
+       * strings.texi, symbols.texi, syntax.texi, text.texi, tips.texi:
+       * variables.texi, windows.texi: Nuke hand-written node pointers.
+
+2012-05-27  Chong Yidong  <cyd@gnu.org>
+
+       * functions.texi (Obsolete Functions):
+       Fix doc for set-advertised-calling-convention.
 
        * modes.texi (Mode Help): Fix describe-mode.
 
 
        * variables.texi (Variable Aliases): Fix make-obsolete-variable.
 
-2012-05-15  Martin Rudalics  <rudalics@gmx.at>
+2012-05-27  Martin Rudalics  <rudalics@gmx.at>
 
-       * commands.texi (Recursive Editing): recursive-edit is a
-       command.
+       * commands.texi (Recursive Editing): recursive-edit is a command.
 
        * compile.texi (Docs and Compilation):
        byte-compile-dynamic-docstrings is an option.
        progress-reporter-force-update have VALUE argument optional.
        (Animated Images): Use non-@code{nil} instead of non-nil.
 
-       * files.texi (Format Conversion Round-Trip): Use non-@code{nil}
-       instead of non-nil.
+       * files.texi (Format Conversion Round-Trip):
+       Use non-@code{nil} instead of non-nil.
 
        * frames.texi (Creating Frames): make-frame is a command.
        (Input Focus): select-frame is a command.
        (Pointer Shape): void-text-area-pointer is an option.
 
-       * help.texi (Describing Characters): read-kbd-macro is a
-       command.
+       * help.texi (Describing Characters): read-kbd-macro is a command.
        (Help Functions): describe-prefix-bindings is a command.
 
        * markers.texi (Creating Markers): Both arguments of copy-marker
        * modes.texi (Mode Line Variables): mode-line-remote and
        mode-line-client are not options.
        (Imenu): imenu-add-to-menubar is a command.
-       (SMIE Indentation Helpers): Use non-@code{nil} instead of
-       non-nil.
+       (SMIE Indentation Helpers): Use non-@code{nil} instead of non-nil.
 
        * os.texi (Sound Output): play-sound-file is a command.
 
-       * package.texi (Package Archives): Use @key{RET} instead of
-       @kbd{RET}.
+       * package.texi (Package Archives): Use @key{RET} instead of @kbd{RET}.
 
-       * processes.texi (Signals to Processes): Use @key{RET} instead
-       of @code{RET}.
+       * processes.texi (Signals to Processes):
+       Use @key{RET} instead of @code{RET}.
        (Signals to Processes): signal-process is a command.
 
-       * text.texi (Clickable Text): Use @key{RET} instead of
-       @kbd{RET}.
+       * text.texi (Clickable Text): Use @key{RET} instead of @kbd{RET}.
        (Base 64): base64-encode-string is not a command while
        base64-decode-region is.
 
        * windows.texi (Switching Buffers): pop-to-buffer is a command.
 
-2012-05-08  Glenn Morris  <rgm@gnu.org>
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (MKDIR_P): New, set by configure.
+       (mkinfodir): Use $MKDIR_P.
+
+2012-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * loading.texi (Loading Non-ASCII): Replace the obsolete "unibyte: t"
+       with "coding: raw-text".
+       Concept of multibyte sessions no longer exists.
+
+       * files.texi (File Locks): Mention create-lockfiles option.
+
+2012-05-09  Glenn Morris  <rgm@gnu.org>
+
+       * vol1.texi, vol2.texi: Remove files.
+       * elisp.texi: Add VOL1,2 conditionals equivalent to vol1,2.texi
+       * two-volume.make: Use elisp.texi as input rather than vol1,2.texi.
 
        * Makefile.in (clean, mostlyclean): Add some more vol1/2 items.
 
        * two-volume.make (emacsdir): New.
        (tex): Add directory with emacsver.texi to TEXINPUTS.
 
-2012-05-05  Glenn Morris  <rgm@gnu.org>
-
        * minibuf.texi (Minibuffer History, Basic Completion):
        Tweak page breaks.
 
        (Sequencing, Conditionals, Signaling Errors, Handling Errors):
        Tweak page breaks.
 
-2012-05-04  Glenn Morris  <rgm@gnu.org>
+2012-05-08  Glenn Morris  <rgm@gnu.org>
 
-       * lists.texi (List-related Predicates, List Variables):
-       Tweak page-breaks.
-       (Sets And Lists): Convert inforef to xref.
+       * two.el: Remove; unused since creation of two-volume.make.
 
-       * text.texi (Auto Filling): Don't mention Emacs 19.
+       * vol1.texi, vol2.texi: No need to keep menus in these files.
 
-       * commands.texi (Event Input Misc): Don't mention unread-command-char.
-       * numbers.texi (Predicates on Numbers): Don't mention Emacs 18.
+2012-05-05  Glenn Morris  <rgm@gnu.org>
 
        * objects.texi (Process Type, Overlay Type): Tweak page-breaks.
 
        (Lisp History): Convert inforef to xref.
        (Lisp History, Printing Notation, Version Info): Improve page-breaks.
 
+       * text.texi (Auto Filling): Don't mention Emacs 19.
+
+       * commands.texi (Event Input Misc): Don't mention unread-command-char.
+       * numbers.texi (Predicates on Numbers): Don't mention Emacs 18.
+
        * elisp.texi (DATE): Forgot to change the month in 2012-04-21 change.
 
-2012-05-01  Glenn Morris  <rgm@gnu.org>
+       * lists.texi (List-related Predicates, List Variables):
+       Tweak page-breaks.
+       (Sets And Lists): Convert inforef to xref.
+
+2012-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (INFO_EXT, INFO_OPTS): New, set by configure.
+       (info, infoclean): Use $INFO_EXT.
+       ($(infodir)/elisp$(INFO_EXT)): Use $INFO_EXT and $INFO_OPT.
+       * makefile.w32-in (INFO_EXT, INFO_OPTS): New.
+       (info, maintainer-clean): Use $INFO_EXT.
+       ($(infodir)/elisp$(INFO_EXT)): Use $INFO_EXT and $INFO_OPT.
+
+2012-05-04  Chong Yidong  <cyd@gnu.org>
+
+       * os.texi (Timers): Use defopt for timer-max-repeats.
+
+2012-05-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * os.texi (Time of Day): Do not limit current-time-string
+       to years 1000..9999.
+
+2012-05-02  Chong Yidong  <cyd@gnu.org>
+
+       * display.texi (Font Lookup):
+       * frames.texi (Pointer Shape):
+       * processes.texi (Subprocess Creation): Use defopt for options.
+
+2012-05-02  Glenn Morris  <rgm@gnu.org>
 
        * elisp.texi (@copying):
        * intro.texi (Introduction): Only print VERSION in the TeX version.
 
-2012-04-29  Chong Yidong  <cyd@gnu.org>
+2012-05-02  Chong Yidong  <cyd@gnu.org>
 
        * text.texi (Change Hooks): Minor fix for after-change-functions.
 
-2012-04-28  Glenn Morris  <rgm@gnu.org>
+2012-05-02  Glenn Morris  <rgm@gnu.org>
 
        * package.texi (Packaging Basics):
        * loading.texi (Autoload):
        * files.texi (Magic File Names):
        Reword to remove/reduce some overly long/short lines.
 
-2012-04-26  Glenn Morris  <rgm@gnu.org>
+2012-04-27  Glenn Morris  <rgm@gnu.org>
 
        * elisp.texi, vol1.texi, vol2.texi: Some fixes for detailed menu.
        * modes.texi (Major Modes, Auto-Indentation):
        * buffers.texi (Buffers): Some fixes for menu descriptions.
 
-2012-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
-
+2012-04-27  Stefan Monnier  <monnier@iro.umontreal.ca>
        * functions.texi (Simple Lambda, Argument List):
        * eval.texi (Function Indirection): Avoid deprecated form.
 
-2012-04-26  Glenn Morris  <rgm@gnu.org>
+2012-04-27  Glenn Morris  <rgm@gnu.org>
 
        * book-spine.texi, elisp.texi, vol1.texi, vol2.texi:
        Add "et al." to authors.
        * symbols.texi, syntax.texi, text.texi, tips.texi, variables.texi:
        Use Texinfo recommended convention for quotes+punctuation.
 
-2012-04-23  Chong Yidong  <cyd@gnu.org>
+2012-04-27  Chong Yidong  <cyd@gnu.org>
 
        * keymaps.texi (Scanning Keymaps): Fix description of NO-REMAP arg
        to where-is-internal (Bug#10872).
 
-2012-04-21  Glenn Morris  <rgm@gnu.org>
+2012-04-27  Glenn Morris  <rgm@gnu.org>
 
        * macros.texi (Indenting Macros): Fix typo.
 
        * minibuf.texi (Intro to Minibuffers):
        Tweak discussion of resizing minibuffer window.
 
+2012-04-26  Glenn Morris  <rgm@gnu.org>
+
+       * elisp-covers.texi, front-cover-1.texi: Remove files.
+
+       * tindex.pl: Remove file.
+
+       * makefile.w32-in (srcs):
+       * Makefile.in (srcs): Remove back.texi (which is unused).
+
+2012-04-24  Michael Albinus  <michael.albinus@gmx.de>
+
+       * os.texi (Notifications): Extend possible notification hints.
+       Add notifications-get-capabilities.
+
 2012-04-20  Chong Yidong  <cyd@gnu.org>
 
        * processes.texi (Asynchronous Processes): Mention nil argument to
        * elisp.texi, vol1.texi, vol2.texi, minibuf.texi (Completion):
        Update "High-Level Completion" description.
 
-2012-04-19  Glenn Morris  <rgm@gnu.org>
-
        * minibuf.texi (Minibuffers):
        * elisp.texi, vol1.texi, vol2.texi: Fix minibuffer subsection order.
 
        (Minibuffer Misc): Mention minibuffer-message-timeout, and
        minibuffer-inactive-mode.
 
-2012-04-18  Glenn Morris  <rgm@gnu.org>
-
        * processes.texi (Serial Ports, Byte Packing, Bindat Spec)
        (Bindat Functions): Copyedits.
 
-2012-04-18  Christopher Schmidt  <christopher@ch.ristopher.com>
+2012-04-20  Christopher Schmidt  <christopher@ch.ristopher.com>
 
        * files.texi (Saving Buffers): Document `visit and `visit-save'
        values of require-final-newline.
 
-2012-04-18  Glenn Morris  <rgm@gnu.org>
+2012-04-20  Glenn Morris  <rgm@gnu.org>
 
        * processes.texi (Output from Processes, Filter Functions):
        Mention waiting-for-user-input-p.
        (Network): Add encrypted network overview paragraph.
        Cross-reference the Emacs-GnuTLS manual.  Use @acronym.
 
-2012-04-17  Chong Yidong  <cyd@gnu.org>
+2012-04-20  Chong Yidong  <cyd@gnu.org>
 
        * help.texi (Keys in Documentation): Mention :advertised-binding.
 
        * keymaps.texi (Menu Bar): Move most of the :advertised-binding
        description to help.texi.
 
-2012-04-16  Glenn Morris  <rgm@gnu.org>
+2012-04-20  Glenn Morris  <rgm@gnu.org>
 
        * processes.texi (Process Information, Input to Processes)
        (Signals to Processes, Output from Processes, Process Buffers)
        (Process Information): Fix typo.
        (Bindat Spec): Use Texinfo-recommended form of quote+punctuation.
 
-2012-04-14  Glenn Morris  <rgm@gnu.org>
+2012-04-15  Glenn Morris  <rgm@gnu.org>
 
        * anti.texi (Antinews): Copyedits.  Don't @dfn anything here.
        open-network-stream does exist in Emacs 23, but is simpler.
 
-2012-04-13  Chong Yidong  <cyd@gnu.org>
+2012-04-15  Chong Yidong  <cyd@gnu.org>
 
        * customize.texi (Custom Themes): Also document load-theme etc.
 
-2012-04-12  Chong Yidong  <cyd@gnu.org>
+2012-04-14  Chong Yidong  <cyd@gnu.org>
 
        * customize.texi (Applying Customizations):
        (Custom Themes): New nodes.
        * modes.texi (Defining Minor Modes, Defining Minor Modes):
        * os.texi (Startup Summary): Copyedits.
 
-2012-04-12  Glenn Morris  <rgm@gnu.org>
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
        * loading.texi (Loading Non-ASCII): "unibyte:" can also be at the end.
 
-2012-04-10  Glenn Morris  <rgm@gnu.org>
-
        * strings.texi (Case Tables):
        * objects.texi (General Escape Syntax):
        * keymaps.texi (Key Sequences): Use @acronym with "ASCII".
 
        * compile.texi (Compiler Errors): Add missing space in buffer name.
 
-2012-04-08  Chong Yidong  <cyd@gnu.org>
+2012-04-14  Chong Yidong  <cyd@gnu.org>
 
        * processes.texi (Query Before Exit): Remove obsolete function
        process-kill-without-query (Bug#11190).
 
-2012-04-08  Glenn Morris  <rgm@gnu.org>
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
        * files.texi, frames.texi, loading.texi, os.texi, processes.texi:
        Use @env for environment variables.
 
-2012-04-07  Glenn Morris  <rgm@gnu.org>
-
        * Makefile.in: Replace non-portable use of $< in ordinary rules.
 
+2012-04-12  Jari Aalto  <jari.aalto@cante.net>
+
+       * processes.texi (Synchronous Processes): Mention
+       `default-directory' (bug#7515).
+
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * customize.texi (Variable Definitions): Remove user-variable-p.
+
+       * commands.texi (Interactive Codes):
+       * help.texi (Accessing Documentation):
+       * minibuf.texi (High-Level Completion): Callers changed.
+
 2012-04-06  Chong Yidong  <cyd@gnu.org>
 
        * minibuf.texi (Programmed Completion): Document metadata method.
        (Recording Input): Document that clear-this-command-keys clears
        the vector to be returned by recent-keys.
 
-       * keymaps.texi (Scanning Keymaps) <where-is-internal>: The
-       argument keymap can be a list.
+       * keymaps.texi (Scanning Keymaps) <where-is-internal>:
+       The argument keymap can be a list.
 
        * nonascii.texi (User-Chosen Coding Systems)
        <select-safe-coding-system>: Document the new argument
        * Makefile (dist): Don't bother excluding autosave files; they'll
        never make it into the temp directory anyway, and the hash marks
        in the name are problematic for make and the Bourne shell.
-       (srcs):
+       (srcs): ???
 
 1993-02-12  Jim Blandy  (jimb@wookumz.gnu.ai.mit.edu)
 
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1998-2012  Free Software Foundation, Inc.
+  Copyright (C) 1998-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index dafe5bc896476ea58ba9b93a922da53ca6895c84..32a241e2a2dc09c74f00290b166130896d0feef5 100644 (file)
@@ -30,6 +30,12 @@ texinfodir = $(srcdir)/../misc
 # Directory with emacsver.texi.
 emacsdir =  $(srcdir)/../emacs
 
+MKDIR_P = @MKDIR_P@
+
+INFO_EXT=@INFO_EXT@
+# Options used only when making info output.
+INFO_OPTS=@INFO_OPTS@
+
 MAKEINFO = @MAKEINFO@
 MAKEINFO_OPTS = --force --enable-encoding -I $(emacsdir) -I $(srcdir)
 TEXI2DVI = texi2dvi
@@ -47,7 +53,6 @@ srcs = \
   $(srcdir)/abbrevs.texi \
   $(srcdir)/advice.texi \
   $(srcdir)/anti.texi \
-  $(srcdir)/back.texi \
   $(srcdir)/backups.texi \
   $(srcdir)/buffers.texi \
   $(srcdir)/commands.texi \
@@ -96,20 +101,20 @@ srcs = \
   $(srcdir)/gpl.texi \
   $(srcdir)/doclicense.texi
 
-mkinfodir = @test -d ${buildinfodir} || mkdir ${buildinfodir} || test -d ${buildinfodir}
+mkinfodir = @${MKDIR_P} ${buildinfodir}
 
 .PHONY: info dvi pdf ps
 
-info: $(buildinfodir)/elisp
+info: $(buildinfodir)/elisp$(INFO_EXT)
 dvi: elisp.dvi
 html: elisp.html
 pdf: elisp.pdf
 ps: elisp.ps
 
 ## Note: "<" is not portable in ordinary make rules.
-$(buildinfodir)/elisp: $(srcs)
+$(buildinfodir)/elisp$(INFO_EXT): $(srcs)
        $(mkinfodir)
-       $(MAKEINFO) $(MAKEINFO_OPTS) -o $@ $(srcdir)/elisp.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ $(srcdir)/elisp.texi
 
 elisp.dvi: $(srcs)
        $(ENVADD) $(TEXI2DVI) $(srcdir)/elisp.texi
@@ -140,7 +145,7 @@ clean: mostlyclean
 distclean: clean
 
 infoclean:
-       -cd $(buildinfodir) && rm -f elisp elisp-[1-9] elisp-[1-9][0-9]
+       -cd $(buildinfodir) && rm -f elisp$(INFO_EXT) elisp$(INFO_EXT)-[1-9] elisp$(INFO_EXT)-[1-9][0-9]
 
 maintainer-clean: distclean infoclean
 
index a64e8a0bd5123c448ce632bf79e5107a681f33b5..65a83ef5b8481a553135842a0b55fd00c8b36729 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1994, 1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/abbrevs
-@node Abbrevs, Processes, Syntax Tables, Top
+@node Abbrevs
 @chapter Abbrevs and Abbrev Expansion
 @cindex abbrev
 @c  @cindex abbrev table  Redundant with "abbrev".
@@ -57,7 +56,7 @@ expanded in the buffer.  For the user-level commands for abbrevs, see
                                 Which properties have which effect.
 @end menu
 
-@node Abbrev Tables, Defining Abbrevs, Abbrevs, Abbrevs
+@node Abbrev Tables
 @section Abbrev Tables
 
   This section describes how to create and manipulate abbrev tables.
@@ -124,8 +123,7 @@ the system abbrevs.  (The mode or package using @var{name} is supposed
 to add these to @var{name} separately.)
 @end defun
 
-@node Defining Abbrevs, Abbrev Files, Abbrev Tables, Abbrevs
-@comment  node-name,  next,  previous,  up
+@node Defining Abbrevs
 @section Defining Abbrevs
 
   @code{define-abbrev} is the low-level basic function for defining an
@@ -180,7 +178,7 @@ behavior of the functions in this section; it is examined by their
 callers.
 @end defopt
 
-@node Abbrev Files, Abbrev Expansion, Defining Abbrevs, Abbrevs
+@node Abbrev Files
 @section Saving Abbrevs in Files
 
   A file of saved abbrev definitions is actually a file of Lisp code.
@@ -231,8 +229,7 @@ define the same abbrevs.  If @var{filename} is @code{nil} or omitted,
 @code{abbrev-file-name} is used.  This function returns @code{nil}.
 @end deffn
 
-@node Abbrev Expansion, Standard Abbrev Tables, Abbrev Files, Abbrevs
-@comment  node-name,  next,  previous,  up
+@node Abbrev Expansion
 @section Looking Up and Expanding Abbreviations
 
   Abbrevs are usually expanded by certain interactive commands,
@@ -368,8 +365,7 @@ definitions of @code{local-abbrev-table} and @code{text-mode-abbrev-table}.
                         nil t)))
 @end smallexample
 
-@node Standard Abbrev Tables, Abbrev Properties, Abbrev Expansion, Abbrevs
-@comment  node-name,  next,  previous,  up
+@node Standard Abbrev Tables
 @section Standard Abbrev Tables
 
   Here we list the variables that hold the abbrev tables for the
@@ -411,7 +407,7 @@ of the local abbrev table used in Emacs Lisp mode.  @xref{Abbrev Table
 Properties}.
 @end defvar
 
-@node Abbrev Properties, Abbrev Table Properties, Standard Abbrev Tables, Abbrevs
+@node Abbrev Properties
 @section Abbrev Properties
 
 Abbrevs have properties, some of which influence the way they work.
@@ -451,7 +447,7 @@ same pattern of capitalization.  It also disables the code that
 modifies the capitalization of the expansion.
 @end table
 
-@node Abbrev Table Properties,  , Abbrev Properties, Abbrevs
+@node Abbrev Table Properties
 @section Abbrev Table Properties
 
 Like abbrevs, abbrev tables have properties, some of which influence
index a2f59b2ddc9a17b6de24cbe7e30f17a92bb4fa9b..7b18852b1a127577af291215421348c4109445cd 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/advising
-@node Advising Functions, Debugging, Byte Compilation, Top
+@node Advising Functions
 @chapter Advising Emacs Lisp Functions
 @cindex advising functions
 
index 59f8f91c855147d625dc46b87e598ed0eb4ec30b..f1f4a089f1b418dbe1565bed325aaeb4355dbbf4 100644 (file)
@@ -5,10 +5,9 @@
 
 @c This node must have no pointers.
 
-@node Antinews, GNU Free Documentation License, Packaging, Top
+@node Antinews
 @appendix Emacs 23 Antinews
-@c Update the elisp.texi, vol1.texi, vol2.texi Antinews menu entries
-@c with the above version number.
+@c Update the elisp.texi Antinews menu entry with the above version number.
 
 For those users who live backwards in time, here is information about
 downgrading to Emacs version 23.4.  We hope you will enjoy the greater
index a1c5f20f28c13ba29ab957535507c13f919cd209..04aa28e9f045ba6ce49bb32b38905e27ff71ea21 100644 (file)
@@ -1,9 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1999, 2001-2012  Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/backups
-@node Backups and Auto-Saving, Buffers, Files, Top
+@node Backups and Auto-Saving
 @chapter Backups and Auto-Saving
 @cindex backups and auto-saving
 
index fa0cb11777264021bdd3fb26f445cd07b933b566..6ad329f3a301eece38c3bbd4804d86ab3364a7bd 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/buffers
-@node Buffers, Windows, Backups and Auto-Saving, Top
+@node Buffers
 @chapter Buffers
 @cindex buffer
 
@@ -35,7 +34,6 @@ not be displayed in any windows.
 @end menu
 
 @node Buffer Basics
-@comment  node-name,  next,  previous,  up
 @section Buffer Basics
 
 @ifnottex
@@ -589,7 +587,6 @@ current buffer is used.
 @end defun
 
 @node Modification Time
-@comment  node-name,  next,  previous,  up
 @section Buffer Modification Time
 @cindex comparing file modification time
 @cindex modification time of buffer
@@ -733,11 +730,9 @@ The buffer is read-only if this variable is non-@code{nil}.
 @defvar inhibit-read-only
 If this variable is non-@code{nil}, then read-only buffers and,
 depending on the actual value, some or all read-only characters may be
-modified.  Read-only characters in a buffer are those that have
-non-@code{nil} @code{read-only} properties (either text properties or
-overlay properties).  @xref{Special Properties}, for more information
-about text properties.  @xref{Overlays}, for more information about
-overlays and their properties.
+modified.  Read-only characters in a buffer are those that have a
+non-@code{nil} @code{read-only} text property.  @xref{Special
+Properties}, for more information about text properties.
 
 If @code{inhibit-read-only} is @code{t}, all @code{read-only} character
 properties have no effect.  If @code{inhibit-read-only} is a list, then
@@ -745,18 +740,31 @@ properties have no effect.  If @code{inhibit-read-only} is a list, then
 of the list (comparison is done with @code{eq}).
 @end defvar
 
-@deffn Command toggle-read-only &optional arg
-This command toggles whether the current buffer is read-only.  It is
-intended for interactive use; do not use it in programs (it may have
-side-effects, such as enabling View mode, and does not affect
-read-only text properties).  To change the read-only state of a buffer in
-a program, explicitly set @code{buffer-read-only} to the proper value.
-To temporarily ignore a read-only state, bind @code{inhibit-read-only}.
-
-If @var{arg} is non-@code{nil}, it should be a raw prefix argument.
-@code{toggle-read-only} sets @code{buffer-read-only} to @code{t} if
-the numeric value of that prefix argument is positive and to
-@code{nil} otherwise.  @xref{Prefix Command Arguments}.
+@deffn Command toggle-read-only &optional arg message
+This command toggles whether the current buffer is read-only, by
+setting the variable @code{buffer-read-only}.  If @var{arg} is
+non-@code{nil}, it should be a raw prefix argument; the command then
+makes the buffer read-only if the numeric value of that prefix
+argument is positive, and makes the buffer writable otherwise.
+@xref{Prefix Command Arguments}.
+
+If called interactively, or if called from Lisp with @var{message} is
+non-@code{nil}, the command prints a message reporting the buffer's
+new read-only status.
+
+When making the buffer read-only, this command also enables View mode
+if the option @code{view-read-only} is non-@code{nil}.  @xref{Misc
+Buffer,,Miscellaneous Buffer Operations, emacs, The GNU Emacs Manual}.
+When making the buffer writable, it disables View mode if View mode
+was enabled.
+
+Lisp programs should only call @code{toggle-read-only} if they really
+intend to do the same thing as the user command, including possibly
+enabling or disabling View mode.  Note also that this command works by
+setting @code{buffer-read-only}, so even if you make the buffer
+writable, characters with non-@code{nil} @code{read-only} text
+properties will remain read-only.  To temporarily ignore all read-only
+states, bind @code{inhibit-read-only}, as described above.
 @end deffn
 
 @defun barf-if-buffer-read-only
index a6dfbe2f8ee28d0d71da669751062c1027daa066..a5fb4638c9d6debac5d37792cfb81a18b83636c3 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/commands
-@node Command Loop, Keymaps, Minibuffers, Top
+@node Command Loop
 @chapter Command Loop
 @cindex editor command loop
 @cindex command loop
@@ -287,7 +286,6 @@ used.
 @end defun
 
 @node Interactive Codes
-@comment  node-name,  next,  previous,  up
 @subsection Code Characters for @code{interactive}
 @cindex interactive code description
 @cindex description for interactive codes
@@ -482,7 +480,7 @@ discarded, @samp{U} provides @code{nil} as the argument.  No I/O.
 
 @item v
 A variable declared to be a user option (i.e., satisfying the
-predicate @code{user-variable-p}).  This reads the variable using
+predicate @code{custom-variable-p}).  This reads the variable using
 @code{read-variable}.  @xref{Definition of read-variable}.  Existing,
 Completion, Prompt.
 
@@ -509,7 +507,6 @@ argument value.  Completion, Existing, Prompt.
 @end table
 
 @node Interactive Examples
-@comment  node-name,  next,  previous,  up
 @subsection Examples of Using @code{interactive}
 @cindex examples of using @code{interactive}
 @cindex @code{interactive}, examples of using
@@ -784,7 +781,6 @@ Here is another example that contrasts direct and indirect calls to
 @end example
 
 @node Command Loop Info
-@comment  node-name,  next,  previous,  up
 @section Information from the Command Loop
 
 The editor command loop sets several Lisp variables to keep status
@@ -1720,6 +1716,38 @@ To test the signal handler, you can make Emacs send a signal to itself:
 @smallexample
 (signal-process (emacs-pid) 'sigusr1)
 @end smallexample
+
+@cindex @code{language-change} event
+@item language-change
+This kind of event is generated on MS-Windows when the input language
+has changed.  This typically means that the keyboard keys will send to
+Emacs characters from a different language.  The generated event has
+this form:
+
+@smallexample
+(language-change @var{frame} @var{codepage} @var{language-id})
+@end smallexample
+
+@noindent
+Here @var{frame} is the frame which was current when the input
+language changed; @var{codepage} is the new codepage number; and
+@var{language-id} is the numerical ID of the new input language.  The
+coding-system (@pxref{Coding Systems}) that corresponds to
+@var{codepage} is @code{cp@var{codepage}} or
+@code{windows-@var{codepage}}.  To convert @var{language-id} to a
+string (e.g., to use it for various language-dependent features, such
+as @code{set-language-environment}), use the
+@code{w32-get-locale-info} function, like this:
+
+@smallexample
+;; Get the abbreviated language name, such as "ENU" for English
+(w32-get-locale-info language-id)
+;; Get the full English name of the language,
+;; such as "English (United States)"
+(w32-get-locale-info language-id 4097)
+;; Get the full localized name of the language
+(w32-get-locale-info language-id t)
+@end smallexample
 @end table
 
   If one of these events arrives in the middle of a key sequence---that
index 032ba0524846bbd69bf953a6d7ee915df7091c3c..f088934f5f1ca51c6821b8bf1b0da097a93964a1 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1994, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/compile
-@node Byte Compilation, Advising Functions, Loading, Top
+@node Byte Compilation
 @chapter Byte Compilation
 @cindex byte compilation
 @cindex byte-code
@@ -81,7 +80,6 @@ whereas the byte-compiled code required less than 4 seconds.  These
 results are representative, but actual results may vary.
 
 @node Compilation Functions
-@comment  node-name,  next,  previous,  up
 @section Byte-Compilation Functions
 @cindex compilation functions
 
index 95b70e87c93116c16a638ca4ef3bb6179de9fc4b..07d2d0d993cb0491596d85718cd8f7ccf8416305 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/control
-@node Control Structures, Variables, Evaluation, Top
+@node Control Structures
 @chapter Control Structures
 @cindex special forms for control structures
 @cindex control structures
index 0382e958c5d2324569f9a52c7159d6230221d25a..38dfc949264673673b9608d611be6aff90e9306e 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1997-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/customize
-@node Customization, Loading, Macros, Top
+@node Customization
 @chapter Customization Settings
 
 @cindex customization item
@@ -469,14 +468,6 @@ meaning it was declared with @code{defcustom}), or an alias for
 another customizable variable.
 @end defun
 
-@defun user-variable-p arg
-This function is like @code{custom-variable-p}, except it also returns
-@code{t} if the first character of the variable's documentation string
-is the character @samp{*}.  That is an obsolete way of indicating a
-user option, so for most purposes you may consider
-@code{user-variable-p} as equivalent to @code{custom-variable-p}.
-@end defun
-
 @node Customization Types
 @section Customization Types
 
index 885766bd1cc89a1f036da1efa5a194e080473b3b..00e8d84e9b34486f3c35193389b8de9266e30154 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1994, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/debugging
-@node Debugging, Read and Print, Advising Functions, Top
+@node Debugging
 @chapter Debugging Lisp Programs
 
   There are several ways to find and investigate problems in an Emacs
index 02285e86e024a4f15b36287ded253a4a241e55e9..01d177feb87561e6448321e70c5269bff67155b7 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/display
-@node Display, System Interface, Processes, Top
+@node Display
 @chapter Emacs Display
 
   This chapter describes a number of features related to the display
@@ -1928,11 +1927,16 @@ exactly what the @code{defface} says.
 @cindex face specification
 The @var{spec} argument is a @dfn{face specification}, which states
 how the face should appear on different kinds of terminals.  It should
-be an alist whose elements each have the form @code{(@var{display}
-@var{atts})}.  @var{display} specifies a class of terminals (see
-below), while @var{atts} is a property list of face attributes and
-their values, specifying the appearance of the face on matching
-terminals
+be an alist whose elements each have the form
+
+@example
+(@var{display} . @var{plist})
+@end example
+
+@noindent
+@var{display} specifies a class of terminals (see below), while
+@var{plist} is a property list of face attributes and their values,
+specifying how the face appears on such terminals
 @iftex
 (see the next section for details about face attributes).
 @end iftex
@@ -1948,8 +1952,8 @@ for that frame.  There are three possibilities for @var{display}:
 @table @asis
 @item @code{default}
 This element of @var{spec} doesn't match any frames; instead, it
-specifies defaults that apply to all frames.  This kind of element, if
-used, must be the first element of @var{spec}.  Each of the following
+specifies defaults that apply to all frames.  This element, if used,
+must be the first element of @var{spec}.  Each of the following
 elements can override any or all of these defaults.
 
 @item @code{t}
@@ -2067,16 +2071,14 @@ attribute is ignored.
 @table @code
 @item :family
 Font family or fontset (a string).  @xref{Fonts,,, emacs, The GNU
-Emacs Manual}.  If you specify a font family name, the wild-card
-characters @samp{*} and @samp{?} are allowed.  The function
-@code{font-family-list}, described below, returns a list of available
-family names.  @xref{Fontsets}, for information about fontsets.
+Emacs Manual}, for more information about font families; the function
+@code{font-family-list} (see below) returns a list of available family
+names.  @xref{Fontsets}, for information about fontsets.
 
 @item :foundry
 The name of the @dfn{font foundry} for the font family specified by
-the @code{:family} attribute (a string).  The wild-card characters
-@samp{*} and @samp{?} are allowed.  @xref{Fonts,,, emacs, The GNU
-Emacs Manual}.
+the @code{:family} attribute (a string).  @xref{Fonts,,, emacs, The
+GNU Emacs Manual}.
 
 @item :width
 Relative character width.  This should be one of the symbols
@@ -2110,6 +2112,7 @@ variable-brightness text, any weight greater than normal is displayed
 as extra bright, and any weight less than normal is displayed as
 half-bright.
 
+@cindex italic text
 @item :slant
 Font slant---one of the symbols @code{italic}, @code{oblique},
 @code{normal}, @code{reverse-italic}, or @code{reverse-oblique}.  On
@@ -2126,19 +2129,42 @@ stipple patterns.
 Background color, a string.  The value can be a system-defined color
 name, or a hexadecimal color specification.  @xref{Color Names}.
 
+@cindex underlined text
 @item :underline
-Whether or not characters should be underlined, and in what color.  If
-the value is @code{t}, underlining uses the foreground color of the
-face.  If the value is a string, underlining uses that color.  The
-value @code{nil} means do not underline.
+Whether or not characters should be underlined, and in what
+way.  The possible values of the @code{:underline} attribute are:
+
+@table @asis
+@item @code{nil}
+Don't underline.
+
+@item @code{t}
+Underline with the foreground color of the face.
+
+@item @var{color}
+Underline in color @var{color}; which should be either a string
+specifying a color, or the symbol @code{foreground-color}, meaning the
+foreground color of the face.
+
+@item @code{(:color @var{color} :style @var{style})}
+@var{color} is as described above.  Omitting the attribute
+@code{:color} means to use the foreground color of the face.
+@var{style} should be a symbol @code{line} or @code{wave}, meaning to
+use a straight or wavy line.  Omitting the attribute @code{:style}
+means to use a straight line.
+@end table
 
+@cindex overlined text
 @item :overline
 Whether or not characters should be overlined, and in what color.
-The value is used like that of @code{:underline}.
+If the value is @code{t}, overlining uses the foreground color of the
+face.  If the value is a string, overlining uses that color.  The
+value @code{nil} means do not overline.
 
+@cindex strike-through text
 @item :strike-through
 Whether or not characters should be strike-through, and in what
-color.  The value is used like that of @code{:underline}.
+color.  The value is used like that of @code{:overline}.
 
 @item :box
 Whether or not a box should be drawn around characters, its color, the
@@ -2221,16 +2247,6 @@ attributes from faces earlier in the list override those from later
 faces.
 @end table
 
-For compatibility with Emacs 20, you can also specify values for two
-``fake'' face attributes: @code{:bold} and @code{:italic}.  Their
-values must be either @code{t} or @code{nil}; a value of
-@code{unspecified} is not allowed.  Setting @code{:bold} to @code{t}
-is equivalent to setting the @code{:weight} attribute to @code{bold},
-and setting it to @code{nil} is equivalent to setting @code{:weight}
-to @code{normal}.  Setting @code{:italic} to @code{t} is equivalent to
-setting the @code{:slant} attribute to @code{italic}, and setting it
-to @code{nil} is equivalent to setting @code{:slant} to @code{normal}.
-
 @defun font-family-list &optional frame
 This function returns a list of available font family names.  The
 optional argument @var{frame} specifies the frame on which the text is
@@ -2518,39 +2534,34 @@ Scale,,, emacs, The GNU Emacs Manual}).
 The value of this variable is an alist whose elements have the form
 @code{(@var{face} . @var{remapping})}.  This causes Emacs to display
 any text having the face @var{face} with @var{remapping}, rather than
-the ordinary definition of @var{face}.  @var{remapping} may be any
-face specification suitable for a @code{face} text property: either a
-face name, or a property list of attribute/value pairs, or a list in
-which each element is either a face name or a property list
-(@pxref{Special Properties}).
+the ordinary definition of @var{face}.
+
+@var{remapping} may be any face specification suitable for a
+@code{face} text property: either a face (i.e.@: a face name or a
+property list of attribute/value pairs), or a list of faces.  For
+details, see the description of the @code{face} text property in
+@ref{Special Properties}.  @var{remapping} serves as the complete
+specification for the remapped face---it replaces the normal
+definition of @var{face}, instead of modifying it.
 
 If @code{face-remapping-alist} is buffer-local, its local value takes
 effect only within that buffer.
 
-Two points bear emphasizing:
-
-@enumerate
-@item
-@var{remapping} serves as the complete specification for the remapped
-face---it replaces the normal definition of @var{face}, instead of
-modifying it.
-
-@item
-If @var{remapping} references the same face name @var{face}, either
-directly or via the @code{:inherit} attribute of some other face in
-@var{remapping}, that reference uses the normal definition of
-@var{face}.  In other words, the remapping cannot be recursive.
+Note: face remapping is non-recursive.  If @var{remapping} references
+the same face name @var{face}, either directly or via the
+@code{:inherit} attribute of some other face in @var{remapping}, that
+reference uses the normal definition of @var{face}.  For instance, if
+the @code{mode-line} face is remapped using this entry in
+@code{face-remapping-alist}:
 
-For instance, if the @code{mode-line} face is remapped using this
-entry in @code{face-remapping-alist}:
 @example
 (mode-line italic mode-line)
 @end example
+
 @noindent
 then the new definition of the @code{mode-line} face inherits from the
 @code{italic} face, and the @emph{normal} (non-remapped) definition of
 @code{mode-line} face.
-@end enumerate
 @end defvar
 
   The following functions implement a higher-level interface to
@@ -2925,13 +2936,13 @@ The last three elements give additional information about the font.
 encoding of the font.
 @end defun
 
-@defvar font-list-limit
+@defopt font-list-limit
 This variable specifies maximum number of fonts to consider in font
-matching.  The function @code{x-family-fonts} will not return more than
-that many fonts, and font selection will consider only that many fonts
-when searching a matching font for face attributes.  The default is
-currently 100.
-@end defvar
+matching.  The function @code{x-family-fonts} will not return more
+than that many fonts, and font selection will consider only that many
+fonts when searching a matching font for face attributes.  The default
+is 100.
+@end defopt
 
 @node Fontsets
 @subsection Fontsets
@@ -3539,7 +3550,7 @@ Used to indicate buffer boundaries.
 @itemx @code{vertical-bar}, @code{horizontal-bar}
 Used for different types of fringe cursors.
 
-@item @code{empty-line}, @code{question-mark}
+@item @code{empty-line}, @code{question-mark}, @code{exclamation-mark}
 Unused.
 @end table
 
@@ -4615,6 +4626,12 @@ JPEG files, add @code{JPG} to this list.
 image descriptor properties:
 
 @table @code
+@item :background @var{background}
+@var{background}, if non-@code{nil}, should be a string specifying a
+color, which is used as the image's background color if the image
+supports transparency.  If the value is @code{nil}, it defaults to the
+frame's background color.
+
 @item :width, :height
 The @code{:width} and @code{:height} keywords are used for scaling the
 image.  If only one of them is specified, the other one will be
index 0c2d47827a97c89ecdd584e2116fea8db13fc3d7..6e7ec924f65b6f936ae65c306cbadda9d10b7d08 100644 (file)
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c The GNU Free Documentation License.
-@node GNU Free Documentation License, GPL, Antinews, Top
+@node GNU Free Documentation License
 
 @appendix GNU Free Documentation License
 @center Version 1.3, 3 November 2008
index 94c4b8a2197d47173e8d3f01a2e2d7dff1c3d4bf..99b4c2178457754e836f6207ff2b7e2078154f90 100644 (file)
@@ -9,7 +9,7 @@
 
 @c , Bugs and Todo List, Top, Top
 
-@node Edebug, Syntax Errors, Debugger, Debugging
+@node Edebug
 @section Edebug
 @cindex Edebug debugging facility
 
diff --git a/doc/lispref/elisp-covers.texi b/doc/lispref/elisp-covers.texi
deleted file mode 100644 (file)
index b2cc5a9..0000000
+++ /dev/null
@@ -1,252 +0,0 @@
-\input texinfo    @c -*-texinfo-*-
-@c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 2001-2012  Free Software Foundation, Inc.
-@c See the file elisp.texi for copying conditions.
-@c
-@comment %**start of header
-@setfilename covers.info
-@settitle GNU Emacs Lisp Reference Manual
-@comment %**end of header
-
-@titlepage
-@c ================ Volume 1 ================
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 2 ================
-@w{ }
-@sp 5
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 2}
-@sp 2
-@center by Bil Lewis,
-@center Dan LaLiberte, and
-@center the GNU Manual Group
-
-@page
-@c ================ Volume 1 with baseline skip 16pt ================
-
-@tex
-\global\baselineskip = 16pt
-@end tex
-
-16 pts baseline skip:
-
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 1 with baseline skip 18pt ================
-
-@tex
-\global\baselineskip = 18pt
-@end tex
-
-18 pts baseline skip, with 15pts  between sections
-
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@tex
-\global\baselineskip = 15pt
-@end tex
-
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis,
-@center Dan LaLiberte, and
-@center the GNU Manual Group
-
-@page
-@c ================ Volume 1 with more baseline skip 24 pts ================
-
-@tex
-\global\baselineskip = 24pt
-@end tex
-
-24 pts baseline skip:
-
-@w{ }
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 2 with more baseline skip 18 pts ================
-
-@tex
-\global\baselineskip = 18pt
-@end tex
-
-18 pts baseline skip:
-
-@w{ }
-@sp 5
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 2}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@page
-@c ================ Volume 2 with more baseline skip 24 pts ================
-
-@tex
-\global\baselineskip = 24pt
-@end tex
-
-24 pts baseline skip:
-
-@w{ }
-@sp 5
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 2
-@center @titlefont{Volume 2}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-
-@page
-@c ================  Spine 1 ================
-
-@w{@titlefont{The GNU Emacs Lisp Reference Manual --- Vol. 1}}
-@sp 4
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 4
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@sp 4
-@author The GNU Emacs Lisp Reference Manual --- Vol. 1
-@sp 3
-@author FSF
-
-@author
-
-@page
-@c ================  Spine 2 ================
-
-@w{@titlefont{The GNU Emacs Lisp Reference Manual --- Vol. 2}}
-@sp 4
-@center GNU Emacs Version 19
-@center for Unix Users
-@center Edition 2.3, June 1994
-@sp 4
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-
-@sp 4
-@author The GNU Emacs Lisp Reference Manual --- Vol. 2
-@sp 3
-@author FSF
-
-@end titlepage
-@bye
index f826548ac7baecdae795a93c20deeac553dd28f4..60abd718f8ed86ad2ecc807c46320ba9b8f374a0 100644 (file)
@@ -1,11 +1,58 @@
 \input texinfo  @c -*-texinfo-*-
 @c %**start of header
 @setfilename elisp
+
+@ifset VOL1
+@set volflag
+@set voltitle Volume 1
+@end ifset
+
+@ifset VOL2
+@set volflag
+@set voltitle Volume 2
+@end ifset
+
+@ifset volflag
+@settitle GNU Emacs Lisp Reference Manual: @value{voltitle}
+@end ifset
+@ifclear volflag
 @settitle GNU Emacs Lisp Reference Manual
+@end ifclear
+
 @c %**end of header
 
+@c See two-volume-cross-refs.txt.
+@tex
+@ifset VOL1
+\message{Formatting for two volume edition...Volume 1...}
+%
+% Read special toc file, set up in two-volume.make.
+\gdef\tocreadfilename{elisp1-toc-ready.toc}
+%
+% Don't make outlines, they're not needed and \readdatafile can't pay
+% attention to the special definition above.
+\global\let\pdfmakeoutlines=\relax
+%
+% Start volume 1 chapter numbering at 1; this must be listed as chapno0.
+\global\chapno=0
+@end ifset
+@ifset VOL2
+\message{Formatting for two volume edition...Volume 2...}
+%
+% Read special toc file, set up in two-volume.make.
+\gdef\tocreadfilename{elisp2-toc-ready.toc}
+%
+% Don't make outlines, they're not needed and \readdatafile can't pay
+% attention to the special definition above.
+\global\let\pdfmakeoutlines=\relax
+%
+% Start volume 2 chapter numbering at 27; this must be listed as chapno26
+\global\chapno=26
+@end ifset
+@end tex
+
+
 @c Version of the manual and of Emacs.
-@c Please remember to update these in vol1.texi and vol2.texi as well.
 @c (See comments for EDITION in emacs.texi)
 @set VERSION  3.1
 @include emacsver.texi
 @c onto the distribution in the full, 8.5 x 11" size.
 @c @set smallbook
 
+@ifset volflag
+@smallbook
+@end ifset
+
 @ifset smallbook
 @smallbook
 @end ifset
@@ -73,6 +124,9 @@ developing GNU and promoting software freedom.''
 
 @titlepage
 @title GNU Emacs Lisp Reference Manual
+@ifset volflag
+@subtitle @value{voltitle}
+@end ifset
 @subtitle For Emacs Version @value{EMACSVER}
 @subtitle Revision @value{VERSION}, @value{DATE}
 
@@ -100,13 +154,12 @@ Cover art by Etienne Suvasa.
 
 
 @ifnottex
-@node Top, Introduction, (dir), (dir)
+@node Top
 @top Emacs Lisp
 
 @insertcopying
 @end ifnottex
 
-@c Copy any updates to vol1.texi and vol2.texi.
 @menu
 * Introduction::            Introduction and conventions used.
 
@@ -187,7 +240,6 @@ Appendices
 @c be correctly identified by `texinfo-multiple-files-update'.  In
 @c particular, the detailed menu header line MUST be identical to the
 @c value of `texinfo-master-menu-header'.  See texnfo-upd.el.
-@c Copy any updates to vol1.texi and vol2.texi.
 
 @detailmenu
  --- The Detailed Node Listing ---
@@ -1071,9 +1123,9 @@ Text
 * Case Changes::            Case conversion of parts of the buffer.
 * Text Properties::         Assigning Lisp property lists to text characters.
 * Substitution::            Replacing a given character wherever it appears.
-* Transposition::           Swapping two portions of a buffer.
 * Registers::               How registers are implemented.  Accessing
                               the text or position stored in a register.
+* Transposition::           Swapping two portions of a buffer.
 * Base 64::                 Conversion to or from base 64 encoding.
 * Checksum/Hash::           Computing cryptographic hashes.
 * Parsing HTML/XML::        Parsing HTML and XML.
@@ -1468,6 +1520,7 @@ Object Internals
 @end detailmenu
 @end menu
 
+@ifclear VOL2
 @include intro.texi
 @include objects.texi
 @include numbers.texi
@@ -1501,6 +1554,12 @@ Object Internals
 @include files.texi
 
 @include backups.texi
+
+@end ifclear
+
+@c ================ Beginning of Volume 2 ================
+@ifclear VOL1
+
 @include buffers.texi
 @include windows.texi
 @include frames.texi
@@ -1533,8 +1592,10 @@ Object Internals
 
 @include index.texi
 
+@end ifclear
+
 @ignore
-@node New Symbols, , Index, Top
+@node New Symbols
 @unnumbered New Symbols Since the Previous Edition
 
 @printindex tp
index 76ab8b235f570a301d4cd0a2857352246e39e41d..a822a2d960827779c10581035aba72c6bf478886 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1993, 1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/errors
-@node Standard Errors, Standard Keymaps, GNU Emacs Internals, Top
+@node Standard Errors
 @appendix Standard Errors
 @cindex standard errors
 
index 342c79e48e8a3d51dc434b7d7f246c1740079605..6dc6287b803f06ab960a04fcf218518076348823 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1994, 1998, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/eval
-@node Evaluation, Control Structures, Symbols, Top
+@node Evaluation
 @chapter Evaluation
 @cindex evaluation
 @cindex  interpreter
index dd355061c148506c3b639d712550b9674bc9bd34..56971bf0ff0c8be265c583fae5163ff57c7654cd 100644 (file)
@@ -3,9 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/files
-@node Files, Backups and Auto-Saving, Documentation, Top
-@comment  node-name,  next,  previous,  up
+@node Files
 @chapter Files
 
   This chapter describes the Emacs Lisp functions and variables to
@@ -251,7 +249,6 @@ is permanent local, so it is unaffected by changes of major modes.
 @end defvar
 
 @node Subroutines of Visiting
-@comment  node-name,  next,  previous,  up
 @subsection Subroutines of Visiting
 
   The @code{find-file-noselect} function uses two important subroutines
@@ -507,7 +504,6 @@ major modes set it to @code{t} in particular buffers.
 Name}).
 
 @node Reading from Files
-@comment  node-name,  next,  previous,  up
 @section Reading from Files
 @cindex reading from files
 
@@ -570,7 +566,6 @@ program can read the file, use the function @code{file-local-copy}; see
 @ref{Magic File Names}.
 
 @node Writing to Files
-@comment  node-name,  next,  previous,  up
 @section Writing to Files
 @cindex writing to files
 
@@ -727,7 +722,12 @@ system does not support locking.
 
   File locking is not supported on some systems.  On systems that do not
 support it, the functions @code{lock-buffer}, @code{unlock-buffer} and
-@code{file-locked-p} do nothing and return @code{nil}.
+@code{file-locked-p} do nothing and return @code{nil}.  It is also
+possible to disable locking, by setting the variable @code{create-lockfiles}.
+
+@defopt create-lockfiles
+If this variable is @code{nil}, Emacs does not lock files.
+@end defopt
 
 @defun ask-user-about-lock file other-user
 This function is called when the user tries to modify @var{file}, but it
@@ -785,7 +785,6 @@ otherwise noted.
 @end menu
 
 @node Testing Accessibility
-@comment  node-name,  next,  previous,  up
 @subsection Testing Accessibility
 @cindex accessibility of a file
 @cindex file accessibility
@@ -943,7 +942,6 @@ time as a list of two numbers.  @xref{File Attributes}.
 @end defun
 
 @node Kinds of Files
-@comment  node-name,  next,  previous,  up
 @subsection Distinguishing Kinds of Files
 
   This section describes how to distinguish various kinds of files, such
@@ -1096,7 +1094,6 @@ we would have:
   @xref{Buffer File Name}, for related information.
 
 @node File Attributes
-@comment  node-name,  next,  previous,  up
 @subsection Other Information about Files
 
   This section describes the functions for getting detailed
@@ -1849,6 +1846,17 @@ Note that the @samp{.~3~} in the two last examples is the backup part,
 not an extension.
 @end defun
 
+@defun file-name-base &optional filename
+This function is the composition of @code{file-name-sans-extension}
+and @code{file-name-nondirectory}.  For example,
+
+@example
+(file-name-base "/my/home/foo.c")
+    @result{} "foo"
+@end example
+
+The @var{filename} argument defaults to @code{buffer-file-name}.
+@end defun
 
 @node Relative File Names
 @subsection Absolute and Relative File Names
@@ -1914,7 +1922,6 @@ form.
 @end defun
 
 @node Directory Names
-@comment  node-name,  next,  previous,  up
 @subsection Directory Names
 @cindex directory name
 @cindex file name of directory
index 29c3dcad404ca24c94695b435fc2c16523d8f96d..22efcda18be4032d597aa8b5779b2dbef04baea0 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/frames
-@node Frames, Positions, Windows, Top
+@node Frames
 @chapter Frames
 @cindex frame
 
diff --git a/doc/lispref/front-cover-1.texi b/doc/lispref/front-cover-1.texi
deleted file mode 100644 (file)
index 56d0f2b..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-\input texinfo    @c -*-texinfo-*-
-@comment %**start of header
-@setfilename front1.info
-@settitle GNU Emacs Lisp Reference Manual
-@smallbook
-@comment %**end of header
-
-@titlepage
-.
-@sp 2
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19.29
-@center for Unix Users
-@center Edition 2.4, June 1995
-@sp 2
-@center @titlefont{Volume 1}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-@page
-.
-@sp 5
-@center @titlefont{The}
-@sp 1
-@center @titlefont{GNU}
-@sp 1
-@center @titlefont{Emacs Lisp}
-@sp 1
-@center @titlefont{Reference}
-@sp 1
-@center @titlefont{Manual}
-@sp 2
-@center GNU Emacs Version 19.29
-@center for Unix Users
-@center Edition 2.4, June 1995
-@sp 2
-@center @titlefont{Volume 2}
-@sp 2
-@center by Bil Lewis, Dan LaLiberte,
-@center and the GNU Manual Group
-
-@end titlepage
-@bye
index 5958d56686d368c364157a4e74258f5f293c2334..ab2789b5e6d7718010de499bb24a5cec7ecda42f 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/functions
-@node Functions, Macros, Variables, Top
+@node Functions
 @chapter Functions
 
   A Lisp program is composed mainly of Lisp functions.  This chapter
@@ -531,8 +530,7 @@ defines the symbol @var{name} as a function that looks like this:
 @end example
 
 @code{defun} stores this lambda expression in the function cell of
-@var{name}.  It returns the value @var{name}, but usually we ignore this
-value.
+@var{name}.  Its return value is @emph{undefined}.
 
 As described previously, @var{argument-list} is a list of argument
 names and may include the keywords @code{&optional} and @code{&rest}.
@@ -544,9 +542,6 @@ Here are some examples:
 @example
 @group
 (defun foo () 5)
-     @result{} foo
-@end group
-@group
 (foo)
      @result{} 5
 @end group
@@ -554,9 +549,6 @@ Here are some examples:
 @group
 (defun bar (a &optional b &rest c)
     (list a b c))
-     @result{} bar
-@end group
-@group
 (bar 1 2 3 4 5)
      @result{} (1 2 (3 4 5))
 @end group
@@ -577,7 +569,6 @@ Here are some examples:
   (forward-word 1)
   (backward-char 1)
   (capitalize-word 1))
-     @result{} capitalize-backwards
 @end group
 @end example
 
@@ -594,7 +585,7 @@ redefinition from unintentional redefinition.
 @anchor{Definition of defalias}
 This special form defines the symbol @var{name} as a function, with
 definition @var{definition} (which can be any valid Lisp function).
-It returns @var{definition}.
+Its return value is @emph{undefined}.
 
 If @var{docstring} is non-@code{nil}, it becomes the function
 documentation of @var{name}.  Otherwise, any documentation provided by
@@ -1016,9 +1007,6 @@ function.
 @example
 @group
 (defun bar (n) (+ n 2))
-     @result{} bar
-@end group
-@group
 (symbol-function 'bar)
      @result{} (lambda (n) (+ n 2))
 @end group
@@ -1064,9 +1052,6 @@ subsequent attempt to access this cell will cause a
 @example
 @group
 (defun foo (x) x)
-     @result{} foo
-@end group
-@group
 (foo 1)
      @result{}1
 @end group
index 244f3330d440a86a0664b12172df535dbbb8ae28..6dc50a9751ce8fe9e1fdb96fef0ef1652d7d4511 100644 (file)
@@ -1,8 +1,6 @@
 @c -*-texinfo-*-
-@setfilename ../../info/gpl
 
-@node GPL, Tips, GNU Free Documentation License, Top
-@comment  node-name,  next,  previous,  up
+@node GPL
 @appendix GNU General Public License
 @c The GNU General Public License.
 @center Version 3, 29 June 2007
index 94d9e6e44854ee722a9190d9aba9e7591f01168f..bb7a60e2e2df9c0f09d5d07e2a34074c4864ece5 100644 (file)
@@ -1,9 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1999, 2001-2012  Free Software Foundation, Inc.
+@c Copyright (C) 1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/hash
-@node Hash Tables, Symbols, Sequences Arrays Vectors, Top
+@node Hash Tables
 @chapter Hash Tables
 @cindex hash tables
 @cindex lookup tables
index 16a2caf03b423039405e0492e01dcccdf8954945..5dd8f3c11f5bcce05a5b41d0973c7ba9a8b8c4d8 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/help
-@node Documentation, Files, Modes, Top
+@node Documentation
 @chapter Documentation
 @cindex documentation strings
 
@@ -35,7 +34,6 @@ Help, emacs, The GNU Emacs Manual}.
 @end menu
 
 @node Documentation Basics
-@comment  node-name,  next,  previous,  up
 @section Documentation Basics
 @cindex documentation conventions
 @cindex writing a documentation string
@@ -218,7 +216,7 @@ in the `*Help*' buffer."
 @group
                 (princ
                  (format "%s\t%s\n%s\n\n" s
-                   (if (user-variable-p s)
+                   (if (custom-variable-p s)
                        "Option " "Variable")
 @end group
 @group
index 0d29c25c8b10f19622cb04f40c2af0344453ba3b..28888e371657815dc3cbc0e09904a34941f492a3 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1993, 1998, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/hooks
-@node Standard Hooks, Index, Standard Keymaps, Top
+@node Standard Hooks
 @appendix Standard Hooks
 @cindex standard hooks
 @cindex hook variables, list of
index 6cdadf94491393cfee7098b22318704d4ae7f7d3..8bec3aa635b0b5c96a9e896cebe4ba61c5cf4027 100644 (file)
@@ -1,5 +1,4 @@
 @c -*-texinfo-*-
-@setfilename ../../info/index
 
 @c Indexing guidelines
 
@@ -19,7 +18,7 @@
 
 @c pindex is used for .el files and Unix programs
 
-@node Index, , Standard Hooks, Top
+@node Index
 @unnumbered Index
 
 @c Print the indices
index eb9d81f196ffdeb2a0aa6d1be11adba67783995d..1459f52d979c26788cf4a6588b27037c7d886808 100644 (file)
@@ -2,9 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1993, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/internals
-@node GNU Emacs Internals, Standard Errors, Tips, Top
-@comment  node-name,  next,  previous,  up
+@node GNU Emacs Internals
 @appendix GNU Emacs Internals
 
 This chapter describes how the runnable Emacs executable is dumped with
@@ -217,10 +215,23 @@ You should not change this flag in a running Emacs.
 (such as by loading a library), that data is placed in normal storage.
 If normal storage runs low, then Emacs asks the operating system to
 allocate more memory.  Different types of Lisp objects, such as
-symbols, cons cells, markers, etc., are segregated in distinct blocks
-in memory.  (Vectors, long strings, buffers and certain other editing
-types, which are fairly large, are allocated in individual blocks, one
-per object, while small strings are packed into blocks of 8k bytes.)
+symbols, cons cells, small vectors, markers, etc., are segregated in
+distinct blocks in memory.  (Large vectors, long strings, buffers and
+certain other editing types, which are fairly large, are allocated in
+individual blocks, one per object; small strings are packed into blocks
+of 8k bytes, and small vectors are packed into blocks of 4k bytes).
+
+@cindex vector-like objects, storage
+@cindex storage of vector-like Lisp objects
+  Beyond the basic vector, a lot of objects like window, buffer, and
+frame are managed as if they were vectors.  The corresponding C data
+structures include the @code{struct vectorlike_header} field whose
+@code{next} field points to the next object in the chain:
+@code{header.next.buffer} points to the next buffer (which could be
+a killed buffer), and @code{header.next.vector} points to the next
+vector in a free list.  If a vector is small (smaller than or equal to
+@code{VBLOCK_BYTES_MAX} bytes, see @file{alloc.c}), then
+@code{header.next.nbytes} contains the vector size in bytes.
 
 @cindex garbage collection
   It is quite common to use some storage for a while, then release it
@@ -245,8 +256,12 @@ might as well be reused, since no one will miss them.  The second
   The sweep phase puts unused cons cells onto a @dfn{free list}
 for future allocation; likewise for symbols and markers.  It compacts
 the accessible strings so they occupy fewer 8k blocks; then it frees the
-other 8k blocks.  Vectors, buffers, windows, and other large objects are
-individually allocated and freed using @code{malloc} and @code{free}.
+other 8k blocks.  Unreachable vectors from vector blocks are coalesced
+to create largest possible free areas; if a free area spans a complete
+4k block, that block is freed.  Otherwise, the free area is recorded
+in a free list array, where each entry corresponds to a free list
+of areas of the same size.  Large vectors, buffers, and other large
+objects are allocated and freed individually.
 
 @cindex CL note---allocate more storage
 @quotation
@@ -1365,7 +1380,7 @@ needs to be reported, either by running the sentinel or by inserting a
 message in the process buffer.
 
 @item pty_flag
-Non-@code{nil} if communication with the subprocess uses a @acronym{PTY};
+Non-@code{nil} if communication with the subprocess uses a pty;
 @code{nil} if it uses a pipe.
 
 @item infd
index c221286fece963b7fd2ceb4d47dc56081c5ab08d..90970a1c6fa7483359b1d56e09647b081e5e82dc 100644 (file)
@@ -2,10 +2,8 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1994, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/intro
 
-@node Introduction, Lisp Data Types, Top, Top
-@comment  node-name,  next,  previous,  up
+@node Introduction
 @chapter Introduction
 
   Most of the GNU Emacs text editor is written in the programming
@@ -237,7 +235,7 @@ evaluation of the expanded form.
      @result{} c
 @end example
 
-  Sometimes to help describe one form we show another form that
+  To help describe one form, we sometimes show another form that
 produces identical results.  The exact equivalence of two forms is
 indicated with @samp{@equiv{}}.
 
@@ -353,7 +351,7 @@ you call the function.
 
   The keyword @code{&rest} (which must be followed by a single
 argument name) indicates that any number of arguments can follow.  The
-single argument name following @code{&rest} will receive, as its
+single argument name following @code{&rest} receives, as its
 value, a list of all the remaining arguments passed to the function.
 Do not write @code{&rest} when you call the function.
 
@@ -381,24 +379,25 @@ More generally,
 @end example
 @end defun
 
-  Any argument whose name contains the name of a type (e.g.,
-@var{integer}, @var{integer1} or @var{buffer}) is expected to be of that
-type.  A plural of a type (such as @var{buffers}) often means a list of
-objects of that type.  Arguments named @var{object} may be of any type.
-(@xref{Lisp Data Types}, for a list of Emacs object types.)  Arguments
-with other sorts of names (e.g., @var{new-file}) are discussed
-specifically in the description of the function.  In some sections,
-features common to the arguments of several functions are described at
-the beginning.
+  By convention, any argument whose name contains the name of a type
+(e.g.@: @var{integer}, @var{integer1} or @var{buffer}) is expected to
+be of that type.  A plural of a type (such as @var{buffers}) often
+means a list of objects of that type.  An argument named @var{object}
+may be of any type.  (For a list of Emacs object types, @pxref{Lisp
+Data Types}.)  An argument with any other sort of name
+(e.g.@: @var{new-file}) is specific to the function; if the function
+has a documentation string, the type of the argument should be
+described there (@pxref{Documentation}).
 
-  @xref{Lambda Expressions}, for a more complete description of optional
-and rest arguments.
+  @xref{Lambda Expressions}, for a more complete description of
+arguments modified by @code{&optional} and @code{&rest}.
 
   Command, macro, and special form descriptions have the same format,
-but the word `Function' is replaced by `Command', `Macro', or `Special
-Form', respectively.  Commands are simply functions that may be called
-interactively; macros process their arguments differently from functions
-(the arguments are not evaluated), but are presented the same way.
+but the word @samp{Function} is replaced by @samp{Command},
+@samp{Macro}, or @samp{Special Form}, respectively.  Commands are
+simply functions that may be called interactively; macros process
+their arguments differently from functions (the arguments are not
+evaluated), but are presented the same way.
 
   The descriptions of macros and special forms use a more complex
 notation to specify optional and repeated arguments, because they can
@@ -447,11 +446,14 @@ from @var{body}, which includes all remaining elements of the form.
 @cindex variable descriptions
 @cindex option descriptions
 
-  A @dfn{variable} is a name that can hold a value.  Although nearly
-all variables can be set by the user, certain variables exist
-specifically so that users can change them; these are called @dfn{user
-options}.  Ordinary variables and user options are described using a
-format like that for functions except that there are no arguments.
+  A @dfn{variable} is a name that can be @dfn{bound} (or @dfn{set}) to
+an object.  The object to which a variable is bound is called a
+@dfn{value}; we say also that variable holds that value.
+Although nearly all variables can be set by the user, certain
+variables exist specifically so that users can change them; these are
+called @dfn{user options}.  Ordinary variables and user options are
+described using a format like that for functions, except that there
+are no arguments.
 
   Here is a description of the imaginary @code{electric-future-map}
 variable.@refill
@@ -462,8 +464,8 @@ Future mode.  The functions in this map allow you to edit commands you
 have not yet thought about executing.
 @end defvar
 
-  User option descriptions have the same format, but `Variable' is
-replaced by `User Option'.
+  User option descriptions have the same format, but @samp{Variable}
+is replaced by @samp{User Option}.
 
 @node Version Info
 @section Version Information
@@ -506,7 +508,7 @@ emacs-build-time
 The value of this variable is the version of Emacs being run.  It is a
 string such as @code{"23.1.1"}.  The last number in this string is not
 really part of the Emacs release version number; it is incremented
-each time you build Emacs in any given directory.  A value with four
+each time Emacs is built in any given directory.  A value with four
 numeric components, such as @code{"22.0.91.1"}, indicates an
 unreleased test version.
 @end defvar
index 7ee8cc5548c3a73be7637b01d98840cd3e8c4fa6..ac3d9e4758087fdf5e9eeed30031eb7dcfcc984d 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1994, 1998-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/keymaps
-@node Keymaps, Modes, Command Loop, Top
+@node Keymaps
 @chapter Keymaps
 @cindex keymap
 
index a894d93a4a050dba61305d9ac32ab642d9f24574..023f8ba18ddcbbd4dc36c4872177d0b81f886d0a 100644 (file)
@@ -1,9 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1998-1999, 2001-2012  Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/lists
-@node Lists, Sequences Arrays Vectors, Strings and Characters, Top
+@node Lists
 @chapter Lists
 @cindex lists
 @cindex element (of list)
@@ -370,7 +369,6 @@ making a copy of the list.
 @end defun
 
 @node Building Lists
-@comment  node-name,  next,  previous,  up
 @section Building Cons Cells and Lists
 @cindex cons cells
 @cindex building lists
index c7d9ff4ae6af31c9ab56a07cdf806e5993583ced..3c9bee96639934cfe1e7d5e90e08ba3bdf558af3 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/loading
-@node Loading, Byte Compilation, Customization, Top
+@node Loading
 @chapter Loading
 @cindex loading
 @cindex library
@@ -263,6 +262,7 @@ Here is how to set it from @code{csh}:
 setenv EMACSLOADPATH /home/foo/.emacs.d/lisp:/opt/emacs/lisp
 @end example
 
+@cindex site-lisp directories
   If @env{EMACSLOADPATH} is not set (which is usually the case), Emacs
 initializes @code{load-path} with the following two directories:
 
@@ -375,11 +375,10 @@ strings are multibyte strings should not be noticeable, since
 inserting them in unibyte buffers converts them to unibyte
 automatically.  However, if this does make a difference, you can force
 a particular Lisp file to be interpreted as unibyte by writing
-@samp{unibyte: t} in a local variables section.  With
+@samp{coding: raw-text} in a local variables section.  With
 that designator, the file will unconditionally be interpreted as
-unibyte, even in an ordinary multibyte Emacs session.  This can matter
-when making keybindings to non-@acronym{ASCII} characters written as
-@code{?v@var{literal}}.
+unibyte.  This can matter when making keybindings to
+non-@acronym{ASCII} characters written as @code{?v@var{literal}}.
 
 @node Autoload
 @section Autoload
index 196ed89d72f5fc8899b17fffef66617047df23fc..efe298bf647cf818bcc064f684fd2e5f3c097916 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/macros
-@node Macros, Customization, Functions, Top
+@node Macros
 @chapter Macros
 @cindex macros
 
@@ -114,7 +113,6 @@ uses this feature.
 @group
 (defmacro inc (var)
     (list 'setq var (list '1+ var)))
-     @result{} inc
 @end group
 
 @group
@@ -125,7 +123,6 @@ uses this feature.
 @group
 (defmacro inc2 (var1 var2)
     (list 'progn (list 'inc var1) (list 'inc var2)))
-     @result{} inc2
 @end group
 
 @group
@@ -208,9 +205,8 @@ like this:
 @end example
 
 (Note that the @sc{cdr} of this list is a function---a lambda expression.)
-This macro object is stored in the function cell of @var{name}.  The
-value returned by evaluating the @code{defmacro} form is @var{name}, but
-usually we ignore this value.
+This macro object is stored in the function cell of @var{name}.  Its return
+value is @emph{undefined}.
 
 The shape and meaning of @var{argument-list} is the same as in a
 function, and the keywords @code{&rest} and @code{&optional} may be used
@@ -343,7 +339,6 @@ For example, (for i from 1 to 10 do (print i))."
               (cons (list '<= var final)
                     (append body (list (list 'inc var)))))))
 @end group
-@result{} for
 
 @group
 (for i from 1 to 3 do
@@ -513,7 +508,6 @@ it.  Here is an example:
 @group
 (defmacro foo (a)
   (list 'setq (eval a) t))
-     @result{} foo
 @end group
 @group
 (setq x 'b)
index 0a4aea2d7e0cdad3102143a243961611d9676295..2914852dc8a4166a06db5db39a185afcd0ae1ff0 100644 (file)
@@ -28,6 +28,9 @@ emacsdir = $(srcdir)/../emacs
 # Directory with the (customized) texinfo.tex file.
 texinfodir = $(srcdir)/../misc
 
+INFO_EXT=.info
+INFO_OPTS=--no-split
+
 # Redefine `TEX' if `tex' does not invoke plain TeX.  For example:
 # TEX=platex
 TEX=tex
@@ -48,7 +51,6 @@ srcs = \
   $(srcdir)/abbrevs.texi \
   $(srcdir)/advice.texi \
   $(srcdir)/anti.texi \
-  $(srcdir)/back.texi \
   $(srcdir)/backups.texi \
   $(srcdir)/buffers.texi \
   $(srcdir)/commands.texi \
@@ -103,13 +105,13 @@ srcs = \
 
 # The info file is named `elisp'.
 
-info: $(infodir)/elisp
+info: $(infodir)/elisp$(INFO_EXT)
 
 $(infodir)/dir:
        $(INSTALL_INFO) --info-dir=$(infodir) $(infodir)/elisp
 
-$(infodir)/elisp: $(srcs)
-       $(MAKEINFO) $(MAKEINFO_OPTS) -o $(infodir)/elisp $(srcdir)/elisp.texi
+$(infodir)/elisp$(INFO_EXT): $(srcs)
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ $(srcdir)/elisp.texi
 
 elisp.dvi: $(srcs)
        $(texinputdir) $(TEX) $(srcdir)/elisp.texi
@@ -124,4 +126,4 @@ distclean: clean
        - $(DEL) makefile
 
 maintainer-clean: distclean
-       - $(DEL) elisp elisp-? elisp-?? elisp.dvi elisp.oaux
+       - $(DEL) elisp$(INFO_EXT) elisp$(INFO_EXT)-? elisp$(INFO_EXT)-?? elisp.dvi elisp.oaux
index b303562028bd16c1a88bf2ec0b2dbeb588c8fe7b..9426dfd4a888d08d94e87cf08e60852db3fe1e8b 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1993, 1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/maps
-@node Standard Keymaps, Standard Hooks, Standard Errors, Top
+@node Standard Keymaps
 @appendix Standard Keymaps
 @cindex keymaps, standard
 
index 1e8829396a7d3bb5c6f6ac689de4bb4ca57f4590..22e806defec9548762fc27abc84ac83a7ca87d88 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/markers
-@node Markers, Text, Positions, Top
+@node Markers
 @chapter Markers
 @cindex markers
 
index 7b4e589a7047bb83cbd8c1819407b5192fc9c765..4cf096b86635554ed67010ade6f3340a2d46ec37 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/minibuf
-@node Minibuffers, Command Loop, Read and Print, Top
+@node Minibuffers
 @chapter Minibuffers
 @cindex arguments, reading
 @cindex complex arguments
@@ -1283,10 +1282,11 @@ complete in the set of extant Lisp symbols, and it uses the
 
 @defun read-variable prompt &optional default
 @anchor{Definition of read-variable}
-This function reads the name of a user variable and returns it as a
-symbol.  Its arguments have the same form as those of @code{read-command}.
-In general, this function is similar to @code{read-command}, but uses
-the predicate @code{user-variable-p} instead of @code{commandp}.
+This function reads the name of a customizable variable and returns it
+as a symbol.  Its arguments have the same form as those of
+@code{read-command}.  It behaves just like @code{read-command}, except
+that it uses the predicate @code{custom-variable-p} instead of
+@code{commandp}.
 @end defun
 
 @deffn Command read-color &optional prompt convert allow-empty display
index e96f30c9a72e8997f9f99256a04f8b529e3314e6..8b5e3da493a3b0458b691f588a59fbc224a9e262 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/modes
-@node Modes, Documentation, Keymaps, Top
+@node Modes
 @chapter Major and Minor Modes
 @cindex mode
 
@@ -1844,9 +1843,9 @@ properties specified by @var{props} to the result.  The argument
 A list whose first element is a symbol that is not a keyword specifies
 a conditional.  Its meaning depends on the value of @var{symbol}.  If
 @var{symbol} has a non-@code{nil} value, the second element,
-@var{then}, is processed recursively as a mode line element.
+@var{then}, is processed recursively as a mode line construct.
 Otherwise, the third element, @var{else}, is processed recursively.
-You may omit @var{else}; then the mode line element displays nothing
+You may omit @var{else}; then the mode line construct displays nothing
 if the value of @var{symbol} is @code{nil} or void.
 
 @item (@var{width} @var{rest}@dots{})
index 9237484f7842cdc5bc10702fc230399baadad6f4..7895d1616f543b98a1d15f7901cc96c293709c4a 100644 (file)
@@ -1,9 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1998-1999, 2001-2012  Free Software Foundation, Inc.
+@c Copyright (C) 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/characters
-@node Non-ASCII Characters, Searching and Matching, Text, Top
+@node Non-ASCII Characters
 @chapter Non-@acronym{ASCII} Characters
 @cindex multibyte characters
 @cindex characters, multi-byte
index 7019fdde17267364ef0bddd6f64b91a62d6ead8c..ce0716f39ef2ef055084c9e95d913a694943d4d8 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/numbers
-@node Numbers, Strings and Characters, Lisp Data Types, Top
+@node Numbers
 @chapter Numbers
 @cindex integers
 @cindex numbers
@@ -32,7 +31,6 @@ exact; they have a fixed, limited amount of precision.
 @end menu
 
 @node Integer Basics
-@comment  node-name,  next,  previous,  up
 @section Integer Basics
 
   The range of values for an integer depends on the machine.  The
index 64cd4a12392faa0d917202f2f9ce9d1d6812e1a2..7d40f0ff9348ef9f200cb76b4b020c4d253885d2 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/objects
-@node Lisp Data Types, Numbers, Introduction, Top
+@node Lisp Data Types
 @chapter Lisp Data Types
 @cindex object
 @cindex Lisp object
@@ -61,7 +60,6 @@ to use these types can be found in later chapters.
 @end menu
 
 @node Printed Representation
-@comment  node-name,  next,  previous,  up
 @section Printed Representation and Read Syntax
 @cindex printed representation
 @cindex read syntax
@@ -108,7 +106,6 @@ not be evaluated later.  @xref{Input Functions}, for a description of
 @code{read}, the basic function for reading objects.
 
 @node Comments
-@comment  node-name,  next,  previous,  up
 @section Comments
 @cindex comments
 @cindex @samp{;} in comment
@@ -914,7 +911,6 @@ It looks like this:
 @end ifnottex
 
 @node Association List Type
-@comment  node-name,  next,  previous,  up
 @subsubsection Association List Type
 
   An @dfn{association list} or @dfn{alist} is a specially-constructed
index bc5cde1bc3c906a6353fa188a9b5eb7f431852f6..6431ac8beadf06a4f7cf1aa9bdfa9d90da6ba075 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/os
-@node System Interface, Packaging, Display, Top
+@node System Interface
 @chapter Operating System Interface
 
   This chapter is about starting and getting out of Emacs, access to
@@ -612,7 +611,6 @@ special to Emacs, then switch back to Emacs when you want.)
 @end menu
 
 @node Killing Emacs
-@comment  node-name,  next,  previous,  up
 @subsection Killing Emacs
 @cindex killing Emacs
 
@@ -1168,7 +1166,9 @@ The value may be a floating point number.
 zone.
 
 @cindex epoch
-  Most of these functions represent time as a list of either three
+  Most of these functions represent time as a list of either four
+integers, @code{(@var{sec-high} @var{sec-low} @var{microsec}
+@var{picosec})}, or of three
 integers, @code{(@var{sec-high} @var{sec-low} @var{microsec})}, or of
 two integers, @code{(@var{sec-high} @var{sec-low})}.  The integers
 @var{sec-high} and @var{sec-low} give the high and low bits of an
@@ -1183,12 +1183,15 @@ is the number of seconds from the @dfn{epoch} (0:00 January 1, 1970
 UTC) to the specified time.  The third list element @var{microsec}, if
 present, gives the number of microseconds from the start of that
 second to the specified time.
+Similarly, the fourth list element @var{picosec}, if present, gives
+the number of picoseconds from the start of that microsecond to the
+specified time.
 
   The return value of @code{current-time} represents time using three
-integers, while the timestamps in the return value of
-@code{file-attributes} use two integers (@pxref{Definition of
+integers, as do the timestamps in the return value of
+@code{file-attributes} (@pxref{Definition of
 file-attributes}).  In function arguments, e.g.@: the @var{time-value}
-argument to @code{current-time-string}, both two- and three-integer
+argument to @code{current-time-string}, two-, three-, and four-integer
 lists are accepted.  You can convert times from the list
 representation into standard human-readable strings using
 @code{current-time}, or to other forms using the @code{decode-time}
@@ -1197,11 +1200,14 @@ sections.
 
 @defun current-time-string &optional time-value
 This function returns the current time and date as a human-readable
-string.  The format of the string is unvarying; the number of
-characters used for each part is always the same, so you can reliably
-use @code{substring} to extract pieces of it.  You should count
+string.  The format does not vary for the initial part of the string,
+which contains the day of week, month, day of month, and time of day
+in that order: the number of characters used for these fields is
+always the same, so you can reliably
+use @code{substring} to extract them.  You should count
 characters from the beginning of the string rather than from the end,
-as additional information may some day be added at the end.
+as the year might not have exactly four digits, and additional
+information may some day be added at the end.
 
 The argument @var{time-value}, if given, specifies a time to format
 (represented as a list of integers), instead of the current time.
@@ -1215,9 +1221,12 @@ The argument @var{time-value}, if given, specifies a time to format
 @end defun
 
 @defun current-time
-This function returns the current time, represented as a list of three
-integers @code{(@var{sec-high} @var{sec-low} @var{microsec})}.  On
-systems with only one-second time resolutions, @var{microsec} is 0.
+This function returns the current time, represented as a list of four
+integers @code{(@var{sec-high} @var{sec-low} @var{microsec} @var{picosec})}.
+These integers have trailing zeros on systems that return time with
+lower resolutions.  On all current machines @var{picosec} is a
+multiple of 1000, but this may change as higher-resolution clocks
+become available.
 @end defun
 
 @defun float-time &optional time-value
@@ -1258,7 +1267,7 @@ time zone.
 @node Time Conversion
 @section Time Conversion
 
-  These functions convert time values (lists of two or three integers,
+  These functions convert time values (lists of two to four integers,
 as explained in the previous section) into calendrical information and
 vice versa.
 
@@ -1409,8 +1418,6 @@ This stands for a newline.
 This stands for the nanoseconds (000000000-999999999).  To ask for
 fewer digits, use @samp{%3N} for milliseconds, @samp{%6N} for
 microseconds, etc.  Any excess digits are discarded, without rounding.
-Currently Emacs time stamps are at best microsecond resolution so the
-last three digits generated by plain @samp{%N} are always zero.
 @item %p
 This stands for @samp{AM} or @samp{PM}, as appropriate.
 @item %r
@@ -1562,18 +1569,9 @@ When called interactively, it prints the uptime in the echo area.
 
 @defun get-internal-run-time
 This function returns the processor run time used by Emacs as a list
-of three integers: @code{(@var{high} @var{low} @var{microsec})}.  The
-integers @var{high} and @var{low} combine to give the number of
-seconds, which is
-@ifnottex
-@var{high} * 2**16 + @var{low}.
-@end ifnottex
-@tex
-$high*2^{16}+low$.
-@end tex
-
-The third element, @var{microsec}, gives the microseconds (or 0 for
-systems that return time with the resolution of only one second).
+of four integers: @code{(@var{high} @var{low} @var{microsec}
+@var{picosec})}, using the same format as @code{current-time}
+(@pxref{Time of Day}).
 
 Note that the time returned by this function excludes the time Emacs
 was not using the processor, and if the Emacs process has several
@@ -1733,11 +1731,11 @@ between them).  If you want a timer to run again no less than @var{n}
 seconds after the last invocation, don't use the @var{repeat} argument.
 Instead, the timer function should explicitly reschedule the timer.
 
-@defvar timer-max-repeats
+@defopt timer-max-repeats
 This variable's value specifies the maximum number of times to repeat
 calling a timer function in a row, when many previously scheduled
 calls were unavoidably delayed.
-@end defvar
+@end defopt
 
 @defmac with-timeout (seconds timeout-forms@dots{}) body@dots{}
 Execute @var{body}, but give up after @var{seconds} seconds.  If
@@ -1816,10 +1814,9 @@ set up to repeat will subsequently run another time, one by one.
 
 @defun current-idle-time
 If Emacs is idle, this function returns the length of time Emacs has
-been idle, as a list of three integers: @code{(@var{sec-high}
-@var{sec-low} @var{microsec})}, where @var{high} and @var{low} are the
-high and low bits for the number of seconds and @var{microsec} is the
-additional number of microseconds (@pxref{Time of Day}).
+been idle, as a list of four integers: @code{(@var{sec-high}
+@var{sec-low} @var{microsec} @var{picosec})}, using the same format as
+@code{current-time} (@pxref{Time of Day}).
 
 When Emacs is not idle, @code{current-idle-time} returns @code{nil}.
 This is a convenient way to test whether Emacs is idle.
@@ -2272,7 +2269,7 @@ The notification title.
 @item :body @var{text}
 The notification body text.  Depending on the implementation of the
 notification server, the text could contain HTML markups, like
-@samp{"<b>bold text</b>"}, or hyperlinks.
+@samp{"<b>bold text</b>"}, hyperlinks, or images.
 
 @item :app-name @var{name}
 The name of the application sending the notification.  The default is
@@ -2302,6 +2299,10 @@ the notification never expires.  Default value is -1.
 @item :urgency @var{urgency}
 The urgency level.  It can be @code{low}, @code{normal}, or @code{critical}.
 
+@item :action-items
+When this keyword is given, the @var{title} string of the actions is
+interpreted as icon name.
+
 @item :category @var{category}
 The type of notification this is, a string.
 
@@ -2332,6 +2333,17 @@ example would be @samp{"message-new-instant"}.
 Causes the server to suppress playing any sounds, if it has that
 ability.
 
+@item :resident
+When set the server will not automatically remove the notification
+when an action has been invoked. The notification will remain resident
+in the server until it is explicitly removed by the user or by the
+sender. This hint is likely only useful when the server has the
+@code{:persistence} capability.
+
+@item :transient
+When set the server will treat the notification as transient and
+by-pass the server's persistence capability, if it should exist.
+
 @item :x @var{position}
 @itemx :y @var{position}
 Specifies the X, Y location on the screen that the
@@ -2356,6 +2368,9 @@ by the user.  The function receive the notification @var{id} and the closing
 @end itemize
 @end table
 
+Which parameters are accepted by the notification server can be
+checked via @code{notifications-get-capabilities}.
+
 This function returns a notification id, an integer, which can be used
 to manipulate the notification item with
 @code{notifications-close-notification} or the @code{:replaces-id}
@@ -2396,6 +2411,46 @@ A message window opens on the desktop.  Press "I agree"
 This function closes a notification with identifier @var{id}.
 @end defun
 
+@defun notifications-get-capabilities
+Returns the capabilities of the notification server, a list of strings.
+The following capabilities can be expected:
+
+@table @code
+@item :actions
+The server will provide the specified actions to the user.
+
+@item :body
+Supports body text.
+
+@item :body-hyperlinks
+The server supports hyperlinks in the notifications.
+
+@item :body-images
+The server supports images in the notifications.
+
+@item :body-markup
+Supports markup in the body text.
+
+@item :icon-multi
+The server will render an animation of all the frames in a given image
+array.
+
+@item :icon-static
+Supports display of exactly 1 frame of any given image array.  This
+value is mutually exclusive with @code{:icon-multi}.
+
+@item :persistence
+The server supports persistence of notifications.
+
+@item :sound
+The server supports sounds on notifications.
+@end table
+
+Further vendor-specific caps start with @code{:x-vendor}, like
+@code{:x-gnome-foo-cap}.
+@end defun
+
+
 @node Dynamic Libraries
 @section Dynamically Loaded Libraries
 @cindex dynamic libraries
index 387fba52c63d5c2c1453ac173965ff4b6ad0ea85..08677f1718b1f4d9ed9d674c6243b2306438e708 100644 (file)
@@ -1,9 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 2010-2012  Free Software Foundation, Inc.
+@c Copyright (C) 2010-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/package
-@node Packaging, Antinews, System Interface, Top
+@node Packaging
 @chapter Preparing Lisp code for distribution
 @cindex package
 @cindex Lisp package
index 9d7cffd51ed1b22698fea40d66a13d0a89548ab9..a59a99d124c7fe74daeeee85867c667d45d72c28 100644 (file)
@@ -1,9 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1998-2012  Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1998-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/positions
-@node Positions, Markers, Frames, Top
+@node Positions
 @chapter Positions
 @cindex position (in buffer)
 
@@ -615,7 +614,6 @@ beginning of the first screen line.  @xref{Minibuffer Contents}.
 @end defun
 
 @node List Motion
-@comment  node-name,  next,  previous,  up
 @subsection Moving over Balanced Expressions
 @cindex sexp motion
 @cindex Lisp expression motion
@@ -726,7 +724,6 @@ of using its normal method.
 @end defvar
 
 @node Skipping Characters
-@comment  node-name,  next,  previous,  up
 @subsection Skipping Characters
 @cindex skipping characters
 
index a059272e43eee20ca1db00f33b2b9b11bab98e60..217f9f9eaeedde778f615c0afe5b475a63cf55c8 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/processes
-@node Processes, Display, Abbrevs, Top
+@node Processes
 @chapter Processes
 @cindex child process
 @cindex parent process
@@ -97,12 +96,12 @@ Expansion}).  @code{nil} in this list refers to
   Executing a program can also try adding suffixes to the specified
 name:
 
-@defvar exec-suffixes
+@defopt exec-suffixes
 This variable is a list of suffixes (strings) to try adding to the
 specified program file name.  The list should include @code{""} if you
 want the name to be tried exactly as specified.  The default value is
 system-dependent.
-@end defvar
+@end defopt
 
   @strong{Please note:} The argument @var{program} contains only the
 name of the program; it may not contain any command-line arguments.  You
@@ -276,6 +275,9 @@ system, much like text written into a file.  @xref{Coding Systems}.
 @defun call-process program &optional infile destination display &rest args
 This function calls @var{program} and waits for it to finish.
 
+The current working directory of the subprocess is
+@code{default-directory}.
+
 The standard input for the new process comes from file @var{infile} if
 @var{infile} is not @code{nil}, and from the null device otherwise.
 The argument @var{destination} says where to put the process output.
@@ -539,16 +541,29 @@ is decoded in the same way as for @code{call-process}.
 @section Creating an Asynchronous Process
 @cindex asynchronous subprocess
 
-  After an @dfn{asynchronous process} is created, Emacs and the subprocess
-both continue running immediately.  The process thereafter runs
-in parallel with Emacs, and the two can communicate with each other
-using the functions described in the following sections.  However,
+  In this section, we describe how to create an @dfn{asynchronous
+process}.  After an asynchronous process is created, it runs in
+parallel with Emacs, and Emacs can communicate with it using the
+functions described in the following sections (@pxref{Input to
+Processes}, and @pxref{Output from Processes}).  Note that process
 communication is only partially asynchronous: Emacs sends data to the
 process only when certain functions are called, and Emacs accepts data
-from the process only when Emacs is waiting for input or for a time
-delay.
-
-  Here we describe how to create an asynchronous process.
+from the process only while waiting for input or for a time delay.
+
+@cindex pty
+@cindex pipe
+  An asynchronous process is controlled either via a @dfn{pty}
+(pseudo-terminal) or a @dfn{pipe}.  The choice of pty or pipe is made
+when creating the process, based on the value of the variable
+@code{process-connection-type} (see below).  Ptys are usually
+preferable for processes visible to the user, as in Shell mode,
+because they allow for job control (@kbd{C-c}, @kbd{C-z}, etc.)
+between the process and its children, whereas pipes do not.  For
+subprocesses used for internal purposes by programs, it is often
+better to use a pipe, because they are more efficient, and because
+they are immune to stray character injections that ptys introduce for
+large (around 500 byte) messages.  Also, the total number of ptys is
+limited on many systems and it is good not to waste them.
 
 @defun start-process name buffer-or-name program &rest args
 This function creates a new asynchronous subprocess and starts the
@@ -650,20 +665,10 @@ can also be executed on remote hosts, depending on @code{default-directory}.
 @end defun
 
 @defvar process-connection-type
-@cindex pipes
-@cindex @acronym{PTY}s
 This variable controls the type of device used to communicate with
-asynchronous subprocesses.  If it is non-@code{nil}, then @acronym{PTY}s are
+asynchronous subprocesses.  If it is non-@code{nil}, then ptys are
 used, when available.  Otherwise, pipes are used.
 
-@acronym{PTY}s are usually preferable for processes visible to the user, as
-in Shell mode, because they allow job control (@kbd{C-c}, @kbd{C-z},
-etc.) to work between the process and its children, whereas pipes do
-not.  For subprocesses used for internal purposes by programs, it is
-often better to use a pipe, because they are more efficient.  In
-addition, the total number of @acronym{PTY}s is limited on many systems and
-it is good not to waste them.
-
 The value of @code{process-connection-type} takes effect when
 @code{start-process} is called.  So you can specify how to communicate
 with one subprocess by binding the variable around the call to
@@ -676,8 +681,8 @@ with one subprocess by binding the variable around the call to
 @end group
 @end smallexample
 
-To determine whether a given subprocess actually got a pipe or a
-@acronym{PTY}, use the function @code{process-tty-name} (@pxref{Process
+To determine whether a given subprocess actually got a pipe or a pty,
+use the function @code{process-tty-name} (@pxref{Process
 Information}).
 @end defvar
 
@@ -955,9 +960,9 @@ data appears on the ``standard input'' of the subprocess.
 
 @c FIXME which?
   Some operating systems have limited space for buffered input in a
-@acronym{PTY}.  On these systems, Emacs sends an @acronym{EOF}
-periodically amidst the other characters, to force them through.  For
-most programs, these @acronym{EOF}s do no harm.
+pty.  On these systems, Emacs sends an @acronym{EOF} periodically
+amidst the other characters, to force them through.  For most
+programs, these @acronym{EOF}s do no harm.
 
   Subprocess input is normally encoded using a coding system before the
 subprocess receives it, much like text written into a file.  You can use
@@ -1768,7 +1773,7 @@ faults for all the child processes of the given process.
 @item utime
 Time spent by the process in the user context, for running the
 application's code.  The corresponding @var{value} is in the
-@w{@code{(@var{high} @var{low} @var{microsec})}} format, the same
+@w{@code{(@var{high} @var{low} @var{microsec} @var{picosec})}} format, the same
 format used by functions @code{current-time} (@pxref{Time of Day,
 current-time}) and @code{file-attributes} (@pxref{File Attributes}).
 
@@ -1799,12 +1804,12 @@ The number of threads in the process.
 
 @item start
 The time when the process was started, in the same
-@w{@code{(@var{high} @var{low} @var{microsec})}} format used by
+@w{@code{(@var{high} @var{low} @var{microsec} @var{picosec})}} format used by
 @code{current-time} and by @code{file-attributes}.
 
 @item etime
 The time elapsed since the process started, in the @w{@code{(@var{high}
-@var{low} @var{microsec})}} format.
+@var{low} @var{microsec} @var{picosec})}} format.
 
 @item vsize
 The virtual memory size of the process, measured in kilobytes.
index e79d361bfeb2335df5d24111e934a8dcaebf34b1..0fa681ecb51650aedcd9226a1caad88079207f06 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/searching
-@node Searching and Matching, Syntax Tables, Non-ASCII Characters, Top
+@node Searching and Matching
 @chapter Searching and Matching
 @cindex searching
 
@@ -832,7 +831,6 @@ an invalid regular expression is passed to any of the search functions,
 an @code{invalid-regexp} error is signaled.
 
 @node Regexp Example
-@comment  node-name,  next,  previous,  up
 @subsection Complex Regexp Example
 
   Here is a complicated regexp which was formerly used by Emacs to
index 1a1160a34d7fc4b619c2117dbcf09c7384615c91..e66f61d22d3ef6b9c83a81605228fd2ac3366e35 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/sequences
-@node Sequences Arrays Vectors, Hash Tables, Lists, Top
+@node Sequences Arrays Vectors
 @chapter Sequences, Arrays, and Vectors
 @cindex sequence
 
index e485d8c4d148b4bc47aac88a7cccc74f1d8d5e96..5fd082678c5591f19e73c87d85a0e233559846c6 100644 (file)
@@ -2,9 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1994, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/streams
-@node Read and Print, Minibuffers, Debugging, Top
-@comment  node-name,  next,  previous,  up
+@node Read and Print
 @chapter Reading and Printing Lisp Objects
 
   @dfn{Printing} and @dfn{reading} are the operations of converting Lisp
index 3b8c62af3134bbd41db36073c5c4f7688097fe8f..b7097e057c0f99a0e768d321a7fb9a40405ad774 100644 (file)
@@ -3,9 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/strings
-@node Strings and Characters, Lists, Numbers, Top
-@comment  node-name,  next,  previous,  up
+@node Strings and Characters
 @chapter Strings and Characters
 @cindex strings
 @cindex character arrays
@@ -555,7 +553,6 @@ against a string, can be used for a kind of string comparison; see
 @ref{Regexp Search}.
 
 @node String Conversion
-@comment  node-name,  next,  previous,  up
 @section Conversion of Characters and Strings
 @cindex conversion of strings
 
@@ -671,7 +668,6 @@ This function converts a byte of character data into a unibyte string.
 @end table
 
 @node Formatting Strings
-@comment  node-name,  next,  previous,  up
 @section Formatting Strings
 @cindex formatting strings
 @cindex strings, formatting them
@@ -904,7 +900,6 @@ shows only the first three characters of the representation for
 characters.
 
 @node Case Conversion
-@comment node-name, next, previous, up
 @section Case Conversion in Lisp
 @cindex upper case
 @cindex lower case
index 6148d76ca32b02e11c3de4c2cd9dc82436b72384..d7497ab6f3f26e940feff96d74e8370d302b143d 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/symbols
-@node Symbols, Evaluation, Hash Tables, Top
+@node Symbols
 @chapter Symbols
 @cindex symbol
 
@@ -31,7 +30,7 @@ otherwise.
                                for recording miscellaneous information.
 @end menu
 
-@node Symbol Components, Definitions, Symbols, Symbols
+@node Symbol Components
 @section Symbol Components
 @cindex symbol components
 
@@ -113,7 +112,7 @@ buffer-file-name
      @result{} #<subr buffer-file-name>
 @end example
 
-@node Definitions, Creating Symbols, Symbol Components, Symbols
+@node Definitions
 @section Defining Symbols
 @cindex definitions of symbols
 
@@ -162,7 +161,7 @@ example, the @kbd{C-h f} and @kbd{C-h v} commands create help buffers
 containing links to the relevant variable, function, or macro
 definitions.  @xref{Name Help,,, emacs, The GNU Emacs Manual}.
 
-@node Creating Symbols, Property Lists, Definitions, Symbols
+@node Creating Symbols
 @section Creating and Interning Symbols
 @cindex reading symbols
 
@@ -377,7 +376,7 @@ If @code{unintern} does delete a symbol, it returns @code{t}.  Otherwise
 it returns @code{nil}.
 @end defun
 
-@node Property Lists,, Creating Symbols, Symbols
+@node Property Lists
 @section Property Lists
 @cindex property list
 @cindex plist
index af6243fd4574388c6d81a4e8beceadebdabb3a85..e4cdeb598117fe3671f4416906a4399f45034384 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/syntax
-@node Syntax Tables, Abbrevs, Searching and Matching, Top
+@node Syntax Tables
 @chapter Syntax Tables
 @cindex parsing buffer text
 @cindex syntax table
index 51f425b121f1825928bca17ec22f54edc6c17d8d..d115322f84f0761a7f6c5ae43cbf94d87e51dc2e 100644 (file)
@@ -1,9 +1,8 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990-1995, 1998-2012  Free Software Foundation, Inc.
+@c Copyright (C) 1990-1995, 1998-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/text
-@node Text, Non-ASCII Characters, Markers, Top
+@node Text
 @chapter Text
 @cindex text
 
@@ -52,9 +51,9 @@ the character after point.
 * Case Changes::     Case conversion of parts of the buffer.
 * Text Properties::  Assigning Lisp property lists to text characters.
 * Substitution::     Replacing a given character wherever it appears.
-* Transposition::    Swapping two portions of a buffer.
 * Registers::        How registers are implemented.  Accessing the text or
                        position stored in a register.
+* Transposition::    Swapping two portions of a buffer.
 * Base 64::          Conversion to or from base 64 encoding.
 * Checksum/Hash::    Computing cryptographic hashes.
 * Parsing HTML/XML:: Parsing HTML and XML.
@@ -402,19 +401,23 @@ ends at the insertion point, the inserted text falls inside that
 overlay.
 @end defun
 
-@defun insert-char character count &optional inherit
-This function inserts @var{count} instances of @var{character} into the
-current buffer before point.  The argument @var{count} should be an
-integer, and @var{character} must be a character.  The value is @code{nil}.
+@deffn Command insert-char character &optional count inherit
+This command inserts @var{count} instances of @var{character} into the
+current buffer before point.  The argument @var{count} must be an
+integer, and @var{character} must be a character.
+
+If called interactively, this command prompts for @var{character}
+using its Unicode name or its code point.  @xref{Inserting Text,,,
+emacs, The GNU Emacs Manual}.
 
 This function does not convert unibyte character codes 128 through 255
 to multibyte characters, not even if the current buffer is a multibyte
 buffer.  @xref{Converting Representations}.
 
-If @var{inherit} is non-@code{nil}, then the inserted characters inherit
+If @var{inherit} is non-@code{nil}, the inserted characters inherit
 sticky text properties from the two characters before and after the
 insertion point.  @xref{Sticky Properties}.
-@end defun
+@end deffn
 
 @defun insert-buffer-substring from-buffer-or-name &optional start end
 This function inserts a portion of buffer @var{from-buffer-or-name}
@@ -823,7 +826,6 @@ would be difficult to change the terminology now.
 @end menu
 
 @node Kill Ring Concepts
-@comment  node-name,  next,  previous,  up
 @subsection Kill Ring Concepts
 
   The kill ring records killed text as strings in a list, most recent
@@ -850,7 +852,6 @@ change the list itself---the most recent entry always comes first in the
 list.
 
 @node Kill Functions
-@comment  node-name,  next,  previous,  up
 @subsection Functions for Killing
 
   @code{kill-region} is the usual subroutine for killing text.  Any
@@ -967,7 +968,6 @@ specifying key bindings.
 @end defopt
 
 @node Yank Commands
-@comment  node-name,  next,  previous,  up
 @subsection Functions for Yanking
 
   This section describes higher-level commands for yanking, which are
@@ -1123,7 +1123,6 @@ window system's clipboard.  @xref{Window System Selections}.
 @end defvar
 
 @node Internals of Kill Ring
-@comment  node-name,  next,  previous,  up
 @subsection Internals of the Kill Ring
 
   The variable @code{kill-ring} holds the kill ring contents, in the
@@ -1196,7 +1195,6 @@ value for @code{kill-ring-max} is 60.
 @end defopt
 
 @node Undo
-@comment  node-name,  next,  previous,  up
 @section Undo
 @cindex redo
 
@@ -1399,7 +1397,6 @@ leak memory if the user waits too long before answering the question.
 @end defopt
 
 @node Filling
-@comment  node-name,  next,  previous,  up
 @section Filling
 @cindex filling text
 
@@ -1777,7 +1774,6 @@ prefix or @code{nil}, meaning it has failed to determine a prefix.
 @end defopt
 
 @node Auto Filling
-@comment  node-name,  next,  previous,  up
 @section Auto Filling
 @cindex filling, automatic
 @cindex Auto Fill mode
@@ -2072,7 +2068,6 @@ utility program.
 @end deffn
 
 @node Columns
-@comment  node-name,  next,  previous,  up
 @section Counting Columns
 @cindex columns
 @cindex counting columns
@@ -2415,7 +2410,6 @@ column, this command does nothing.
 @end deffn
 
 @node Indent Tabs
-@comment  node-name,  next,  previous,  up
 @subsection Adjustable ``Tab Stops''
 @cindex tabs stops for indentation
 
@@ -2474,7 +2468,6 @@ If @var{arg} is omitted or @code{nil}, it defaults to 1.
 @end deffn
 
 @node Case Changes
-@comment  node-name,  next,  previous,  up
 @section Case Changes
 @cindex case conversion in buffers
 
@@ -3014,7 +3007,11 @@ time you want to specify a particular attribute for certain text.
 @xref{Face Attributes}.
 
 @item
-A list, where each element uses one of the two forms listed above.
+A list of faces.  This specifies a face which is an aggregate of the
+attributes of each of the listed faces.  Faces occurring earlier in
+the list have higher priority.  Each list element must have one of the
+two above forms (i.e.@: either a face name or a property list of face
+attributes).
 @end itemize
 
 Font Lock mode (@pxref{Font Lock Mode}) works in most buffers by
diff --git a/doc/lispref/tindex.pl b/doc/lispref/tindex.pl
deleted file mode 100755 (executable)
index a876571..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-#! /usr/bin/perl
-
-# Copyright (C) 2000-2012  Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-require 5;
-use Getopt::Long;
-
-my $USAGE = <<ENDUSAGE;
-Remove \@tindex lines from files that were already present in previous
-versions.
-
-Usage: $0 [--old=EXT] FILE...
-       $0 --help
-       $0 --version
-
-  --help       display this help and exit
-  --version    print version and exit
-  --old=DIR    find old files in DIR
-
-The script performs two passes.  In the first pass, Texinfo files from
-DIR are scanned for \@tindex lines, and identifiers in them are
-recorded.  In a second pass, Texinfo files in the current directory
-are scanned, and \@tindex lines for identifiers that were recorded in
-the first pass are removed.  Old file contents are saved in files
-with extension ".orig".  A list of modified files and removed \@tindex
-identifiers is printed to stdout at the end.
-ENDUSAGE
-
-sub fatal {
-    print STDERR "$0: ", @_, ".\n";
-    exit 1;
-}
-
-my $help = 0;
-my $version = 0;
-my $old;
-
-my $rc = GetOptions ('help' => \$help, 'version' => \$version,
-                     'old=s' => \$old);
-if ($version) {
-    print "0.1\n";
-    exit 0;
-} elsif (!$rc || !$old || @ARGV) {
-    print $USAGE;
-    exit 1;
-} elsif ($help) {
-    print $USAGE;
-    exit 0;
-}
-
-# Fill the hash %tindex with associations VAR -> COUNT where
-# the keys VAR are identifiers mentioned in @tindex lines in the older
-# files to process and COUNT is the number of times they are seen in
-# the files.
-
-my %tindex;
-my %removed;
-my @old_files = glob "$old/*.texi";
-my @new_files = glob "*.texi";
-fatal ("No Texinfo files found in `$old'") unless @old_files;
-fatal ("No Texinfo files found in current directory") unless @new_files;
-
-print "Scanning old files for \@tindex lines\n";
-foreach $file (@old_files) {
-    open (IN, "<$file") or fatal "Cannot open $file: $!";
-    while (<IN>) {
-       ++$tindex{$1} if /^\s*\@tindex\s+(\S+)/;
-    }
-    close IN;
-}
-
-# Process current files and remove those @tindex lines which we
-# know were already present in the files scanned above.
-
-print "Removing old \@tindex lines\n";
-foreach $file (@new_files) {
-    my $modified = 0;
-    my $contents = "";
-
-    open (IN, "< $file") or fatal "Cannot open $file.orig for reading: $!";
-    while (<IN>) {
-       if (/^\s*\@tindex\s+(\S+)/ && $tindex{$1}) {
-           ++$removed{$1};
-           $modified = 1;
-       } else {
-           $contents = $contents . $_;
-       }
-    }
-
-    close IN;
-
-    if ($modified) {
-       print "  $file\n";
-       system ("cp $file $file.orig") == 0 or fatal "Cannot backup $file: $!";
-       open (OUT, ">$file") or fatal "Cannot open $file for writing: $!";
-       print OUT $contents;
-       close OUT;
-    }
-}
-
-# Print a list of identifiers removed.
-
-print "Removed \@tindex commands for:\n";
-my $key;
-foreach $key (keys %removed) {
-    print "  $key\n";
-}
-
index 56c361cf86e9941a47eee505d1ed7052b1619273..0c7282c358666b8e9a47ddfefbc548abd1417fba 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1993, 1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/tips
-@node Tips, GNU Emacs Internals, GPL, Top
+@node Tips
 @appendix Tips and Conventions
 @cindex tips for writing Lisp
 @cindex standards of coding style
index 07fcaf09b988f3492e44c64aec8ef93945568f88..eb5c0e0193d32771656fa297f1b81ddbbfd65ad8 100644 (file)
@@ -5,6 +5,8 @@
 # colors, spurious warnings about names being referenced but not
 # existing, etc., dvips | ps2pdf doesn't preserve the page size.
 # Instead of creating a special dvips config file, put up with the warnings.
+# (Note added 2012/05: for me, using texlive-2007-57, pdftex
+# doesn't work for reason, but tex does.)
 texinfodir=../misc
 emacsdir=../emacs
 
@@ -12,22 +14,32 @@ tex = TEXINPUTS=".:$(texinfodir):${emacsdir}:${TEXINPUTS}" pdftex -interaction=n
 
 all: vol1.pdf vol2.pdf
 
-# vol1.texi and vol2.texi specially define \tocreadfilename so we can
-# use our premade .toc's.
+# There's probably a better way to do this, without using a temp file.
+# Something like:
+# tex -jobname=vol1 '\def\SETVOL1 \input{elisp.texi}'
+# but I don't know what to use for "\def\SETVOL1".
+tex1 = sed '/^@setfilename/a\
+@set VOL1' elisp.texi > elisp1tmp.tex && $(tex) -jobname=vol1 elisp1tmp.tex
+
+tex2 = sed '/^@setfilename/a\
+@set VOL2' elisp.texi > elisp2tmp.tex && $(tex) -jobname=vol2 elisp2tmp.tex
+
+# elisp.texi specially defines \tocreadfilename when VOL1 or VOL2 is
+# set, so we can use our premade .toc's.
 # 
 vol1.pdf: elisp1med-fns-ready elisp1med-aux-ready elisp1med-toc-ready
        @echo -e "\f Final TeX run for volume 1..."
        cp elisp1med-toc-ready elisp1-toc-ready.toc
        cp elisp1med-fns-ready vol1.fns
        cp elisp1med-aux-ready vol1.aux
-       $(tex) vol1.texi
+       $(tex1)
 #
 vol2.pdf: elisp2med-fns-ready elisp2med-aux-ready elisp2med-toc-ready
        @echo "Final TeX run for volume 2..."
        cp elisp2med-toc-ready elisp2-toc-ready.toc
        cp elisp2med-fns-ready vol2.fns
        cp elisp2med-aux-ready vol2.aux
-       $(tex) vol2.texi
+       $(tex2)
 
 # \f intermediate toc files.
 # 
@@ -105,7 +117,7 @@ elisp1med-init: elisp1-fns-ready elisp1-aux-ready elisp1init-toc-ready $(texinfo
        cp elisp1init-toc-ready elisp1-toc-ready.toc
        cp elisp1-fns-ready vol1.fns
        cp elisp1-aux-ready vol1.aux
-       $(tex) vol1.texi
+       $(tex1)
        texindex vol1.??
        mv vol1.aux elisp1med-aux
        mv vol1.toc elisp1med-toc
@@ -115,7 +127,7 @@ elisp2med-init: elisp2-fns-ready elisp2-aux-ready elisp2init-toc-ready $(texinfo
        cp elisp2init-toc-ready elisp2-toc-ready.toc
        cp elisp2-fns-ready vol2.fns
        cp elisp2-aux-ready vol2.aux
-       $(tex) vol2.texi
+       $(tex2)
        texindex vol2.??
        mv vol2.aux elisp2med-aux
        mv vol2.toc elisp2med-toc
@@ -189,19 +201,19 @@ elisp2-fn-vol-added: elisp2-init
 # but we run texindex and TeX a second time just to get them closer.
 # Otherwise it might take even longer for them to converge.
 # 
-elisp1-init: vol1.texi
+elisp1-init: elisp.texi
        @echo -e "\f Initial TeX run for volume 1..."
        rm -f vol1.aux vol1.toc
-       $(tex) $<
+       $(tex1)
        texindex vol1.??
        mv vol1.aux elisp1-aux
        mv vol1.toc elisp1-toc
        touch $@
 #
-elisp2-init: vol2.texi
+elisp2-init: elisp.texi
        @echo "Initial TeX run for volume 2..."
        rm -f vol2.aux vol2.toc
-       $(tex) $<
+       $(tex2)
        texindex vol2.??
        mv vol2.aux elisp2-aux
        mv vol2.toc elisp2-toc
diff --git a/doc/lispref/two.el b/doc/lispref/two.el
deleted file mode 100644 (file)
index 39dee62..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-;; Auxiliary functions for preparing a two volume manual.
-
-;; Copyright (C) 2001-2012  Free Software Foundation, Inc.
-
-;; --rjc 30mar92
-
-;; This file is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This file is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this file.  If not, see <http://www.gnu.org/licenses/>.
-
-
-(defun volume-aux-markup (arg)
-  "Append `vol. NUMBER' to page number.
-Apply to aux file that you save.
-Then insert marked file into other volume's .aux file."
-  (interactive "sType volume number, 1 or 2: " )
-  (goto-char (point-min))
-  (while (search-forward "-pg" nil t)
-    (end-of-line 1)
-    (delete-backward-char 1 nil)
-    (insert ", vol.'tie" arg "}")))
-
-(defun volume-index-markup (arg)
-  "Prepend  `NUMBER:' to page number.  Use Roman Numeral.
-Apply only to unsorted index file,
-Then insert marked file into other volume's unsorted index file.
-Then run texindex on that file and save."
-  (interactive
-   "sType volume number,  roman number I or II: " )
-  (goto-char (point-min))
-  (while (search-forward "\\entry" nil t)
-    (search-forward "}{" (save-excursion (end-of-line) (point)) nil)
-    (insert arg ":")))
-
-(defun volume-numbers-toc-markup (arg)
-  (interactive
-   "sType volume number,  roman number I or II: " )
-  (goto-char (point-min))
-  (while (search-forward "chapentry" nil t)
-    (end-of-line)
-    (search-backward "{" nil t)
-    (forward-char 1)
-    (insert arg ":")))
-
-(defun volume-header-toc-markup ()
-  "Insert Volume I and Volume II text into .toc file.
-NOTE: this auxiliary function is file specific.
-This is for the *Elisp Ref Manual*."
-  (interactive)
-  (goto-char (point-min))
-  (insert "\\unnumbchapentry {Volume 1}{}\n\\unnumbchapentry {}{}\n")
-  (search-forward "\\unnumbchapentry {Index}")
-  (forward-line 1)
-  (insert
-   "\\unnumbchapentry {}{}\n\\unnumbchapentry {}{}\n\\unnumbchapentry {}{}\n\\unnumbchapentry {}{}\n\\unnumbchapentry {Volume 2}{}\n\\unnumbchapentry {}{}\n"))
-
-
-;;; In batch mode, you cannot call functions with args; hence this kludge:
-
-(defun volume-aux-markup-1 () (volume-aux-markup "1"))
-(defun volume-aux-markup-2 () (volume-aux-markup "2"))
-
-(defun volume-index-markup-I () (volume-index-markup "I"))
-(defun volume-index-markup-II () (volume-index-markup "II"))
-
-(defun volume-numbers-toc-markup-I () (volume-numbers-toc-markup "I"))
-(defun volume-numbers-toc-markup-II () (volume-numbers-toc-markup "II"))
-
-;;; two.el ends here
index 93fb4d5f87360dcf3c1220e0365f1e29d8a8133b..affaff46ff90b12f4a9bcdebfa1d37c9d3da501a 100644 (file)
@@ -2,8 +2,7 @@
 @c This is part of the GNU Emacs Lisp Reference Manual.
 @c Copyright (C) 1990-1995, 1998-2012 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/variables
-@node Variables, Functions, Control Structures, Top
+@node Variables
 @chapter Variables
 @cindex variable
 
diff --git a/doc/lispref/vol1.texi b/doc/lispref/vol1.texi
deleted file mode 100644 (file)
index b34659b..0000000
+++ /dev/null
@@ -1,1562 +0,0 @@
-\input texinfo  @c -*-texinfo-*-
-@c This file is used for printing the GNU Emacs Lisp Reference Manual
-@c in two volumes.  It is a modified version of elisp.texi.
-@c Copyright (C) 1990-1995, 1998-1999, 2001-2012
-@c   Free Software Foundation, Inc.
-@c %**start of header
-@setfilename elisp
-@settitle GNU Emacs Lisp Reference Manual: Volume 1
-@c %**end of header
-
-@c See two-volume-cross-refs.txt.
-@tex
-\message{Formatting for two volume edition...Volume 1...}
-%
-% Read special toc file, set up in two-volume.make.
-\gdef\tocreadfilename{elisp1-toc-ready.toc}
-%
-% Don't make outlines, they're not needed and \readdatafile can't pay
-% attention to the special definition above.
-\global\let\pdfmakeoutlines=\relax
-%
-% Start volume 1 chapter numbering at 1; this must be listed as chapno0.
-\global\chapno=0
-@end tex
-
-@c Version of the manual and of Emacs.
-@set VERSION  3.1
-@include emacsver.texi
-@set DATE May 2012
-
-@dircategory Emacs
-@direntry
-* Elisp: (elisp).       The Emacs Lisp Reference Manual.
-@end direntry
-
-@c in general, keep the following line commented out, unless doing a
-@c copy of this manual that will be published.  the manual should go
-@c onto the distribution in the full, 8.5 x 11" size.
-@set smallbook
-
-@ifset smallbook
-@smallbook
-@end ifset
-
-@c per rms and peterb, use 10pt fonts for the main text, mostly to
-@c save on paper cost.
-@c Do this inside @tex for now, so current makeinfo does not complain.
-@tex
-@ifset smallbook
-@fonttextsize 10
-@end ifset
-\global\hbadness=6666 % don't worry about not-too-underfull boxes
-@end tex
-
-@c Combine indices.
-@synindex cp fn
-@syncodeindex vr fn
-@syncodeindex ky fn
-@syncodeindex pg fn
-@c We use the "type index" to index new functions and variables.
-@c @syncodeindex tp fn
-
-@copying
-This is edition @value{VERSION} of the GNU Emacs Lisp Reference Manual,@*
-corresponding to Emacs version @value{EMACSVER}.
-
-Copyright @copyright{} 1990-1996, 1998-2012  Free Software Foundation, Inc.
-
-@quotation
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.3 or
-any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License,'' with the
-Front-Cover texts being ``A GNU Manual,'' and with the Back-Cover
-Texts as in (a) below.  A copy of the license is included in the
-section entitled ``GNU Free Documentation License.''
-
-(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
-modify this GNU manual.  Buying copies from the FSF supports it in
-developing GNU and promoting software freedom.''
-@end quotation
-@end copying
-
-@titlepage
-@title GNU Emacs Lisp Reference Manual
-@subtitle Volume 1
-@subtitle For Emacs Version @value{EMACSVER}
-@subtitle Revision @value{VERSION}, @value{DATE}
-
-@author by Bil Lewis, Dan LaLiberte, Richard Stallman,
-@author the GNU Manual Group, et al.
-@page
-@vskip 0pt plus 1filll
-@insertcopying
-
-@sp 2
-
-Published by the Free Software Foundation @*
-51 Franklin St, Fifth Floor @*
-Boston, MA 02110-1301 @*
-USA @*
-ISBN 1-882114-74-4
-
-@sp 2
-Cover art by Etienne Suvasa.
-@end titlepage
-
-
-@c Print the tables of contents
-@summarycontents
-@contents
-
-
-@ifnottex
-@node Top, Introduction, (dir), (dir)
-@top Emacs Lisp
-
-This Info file contains edition @value{VERSION} of the GNU Emacs Lisp
-Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}.
-@end ifnottex
-
-@menu
-* Introduction::            Introduction and conventions used.
-
-* Lisp Data Types::         Data types of objects in Emacs Lisp.
-* Numbers::                 Numbers and arithmetic functions.
-* Strings and Characters::  Strings, and functions that work on them.
-* Lists::                   Lists, cons cells, and related functions.
-* Sequences Arrays Vectors::  Lists, strings and vectors are called sequences.
-                                Certain functions act on any kind of sequence.
-                                The description of vectors is here as well.
-* Hash Tables::             Very fast lookup-tables.
-* Symbols::                 Symbols represent names, uniquely.
-
-* Evaluation::              How Lisp expressions are evaluated.
-* Control Structures::      Conditionals, loops, nonlocal exits.
-* Variables::               Using symbols in programs to stand for values.
-* Functions::               A function is a Lisp program
-                              that can be invoked from other functions.
-* Macros::                  Macros are a way to extend the Lisp language.
-* Customization::           Making variables and faces customizable.
-
-* Loading::                 Reading files of Lisp code into Lisp.
-* Byte Compilation::        Compilation makes programs run faster.
-* Advising Functions::      Adding to the definition of a function.
-* Debugging::               Tools and tips for debugging Lisp programs.
-
-* Read and Print::          Converting Lisp objects to text and back.
-* Minibuffers::             Using the minibuffer to read input.
-* Command Loop::            How the editor command loop works,
-                              and how you can call its subroutines.
-* Keymaps::                 Defining the bindings from keys to commands.
-* Modes::                   Defining major and minor modes.
-* Documentation::           Writing and using documentation strings.
-
-* Files::                   Accessing files.
-* Backups and Auto-Saving:: Controlling how backups and auto-save
-                              files are made.
-* Buffers::                 Creating and using buffer objects.
-* Windows::                 Manipulating windows and displaying buffers.
-* Frames::                  Making multiple system-level windows.
-* Positions::               Buffer positions and motion functions.
-* Markers::                 Markers represent positions and update
-                              automatically when the text is changed.
-
-* Text::                    Examining and changing text in buffers.
-* Non-ASCII Characters::    Non-ASCII text in buffers and strings.
-* Searching and Matching::  Searching buffers for strings or regexps.
-* Syntax Tables::           The syntax table controls word and list parsing.
-* Abbrevs::                 How Abbrev mode works, and its data structures.
-
-* Processes::               Running and communicating with subprocesses.
-* Display::                 Features for controlling the screen display.
-* System Interface::        Getting the user id, system type, environment
-                              variables, and other such things.
-
-* Packaging::               Preparing Lisp code for distribution.
-
-Appendices
-
-* Antinews::                Info for users downgrading to Emacs 23.
-* GNU Free Documentation License:: The license for this documentation.
-* GPL::                     Conditions for copying and changing GNU Emacs.
-* Tips::                    Advice and coding conventions for Emacs Lisp.
-* GNU Emacs Internals::     Building and dumping Emacs;
-                              internal data structures.
-* Standard Errors::         List of some standard error symbols.
-* Standard Keymaps::        List of some standard keymaps.
-* Standard Hooks::          List of some standard hook variables.
-
-* Index::                   Index including concepts, functions, variables,
-                              and other terms.
-
-@ignore
-* New Symbols::             New functions and variables in Emacs @value{EMACSVER}.
-@end ignore
-
-@c Do NOT modify the following 3 lines!  They must have this form to
-@c be correctly identified by `texinfo-multiple-files-update'.  In
-@c particular, the detailed menu header line MUST be identical to the
-@c value of `texinfo-master-menu-header'.  See texnfo-upd.el.
-
-@detailmenu
- --- The Detailed Node Listing ---
- ---------------------------------
-
-Here are other nodes that are subnodes of those already listed,
-mentioned here so you can get to them in one step:
-
-Introduction
-
-* Caveats::                 Flaws and a request for help.
-* Lisp History::            Emacs Lisp is descended from Maclisp.
-* Conventions::             How the manual is formatted.
-* Version Info::            Which Emacs version is running?
-* Acknowledgements::        The authors, editors, and sponsors of this manual.
-
-Conventions
-
-* Some Terms::              Explanation of terms we use in this manual.
-* nil and t::               How the symbols @code{nil} and @code{t} are used.
-* Evaluation Notation::     The format we use for examples of evaluation.
-* Printing Notation::       The format we use when examples print text.
-* Error Messages::          The format we use for examples of errors.
-* Buffer Text Notation::    The format we use for buffer contents in examples.
-* Format of Descriptions::  Notation for describing functions, variables, etc.
-
-Format of Descriptions
-
-* A Sample Function Description::  A description of an imaginary
-                                     function, @code{foo}.
-* A Sample Variable Description::  A description of an imaginary
-                                     variable, @code{electric-future-map}.
-
-Lisp Data Types
-
-* Printed Representation::  How Lisp objects are represented as text.
-* Comments::                Comments and their formatting conventions.
-* Programming Types::       Types found in all Lisp systems.
-* Editing Types::           Types specific to Emacs.
-* Circular Objects::            Read syntax for circular structure.
-* Type Predicates::         Tests related to types.
-* Equality Predicates::     Tests of equality between any two objects.
-
-Programming Types
-
-* Integer Type::        Numbers without fractional parts.
-* Floating Point Type:: Numbers with fractional parts and with a large range.
-* Character Type::      The representation of letters, numbers and
-                          control characters.
-* Symbol Type::         A multi-use object that refers to a function,
-                        variable, or property list, and has a unique identity.
-* Sequence Type::       Both lists and arrays are classified as sequences.
-* Cons Cell Type::      Cons cells, and lists (which are made from cons cells).
-* Array Type::          Arrays include strings and vectors.
-* String Type::         An (efficient) array of characters.
-* Vector Type::         One-dimensional arrays.
-* Char-Table Type::     One-dimensional sparse arrays indexed by characters.
-* Bool-Vector Type::    One-dimensional arrays of @code{t} or @code{nil}.
-* Hash Table Type::     Super-fast lookup tables.
-* Function Type::       A piece of executable code you can call from elsewhere.
-* Macro Type::          A method of expanding an expression into another
-                          expression, more fundamental but less pretty.
-* Primitive Function Type::     A function written in C, callable from Lisp.
-* Byte-Code Type::      A function written in Lisp, then compiled.
-* Autoload Type::       A type used for automatically loading seldom-used
-                          functions.
-
-Character Type
-
-* Basic Char Syntax::       Syntax for regular characters.
-* General Escape Syntax::   How to specify characters by their codes.
-* Ctl-Char Syntax::         Syntax for control characters.
-* Meta-Char Syntax::        Syntax for meta-characters.
-* Other Char Bits::         Syntax for hyper-, super-, and alt-characters.
-
-Cons Cell and List Types
-
-* Box Diagrams::            Drawing pictures of lists.
-* Dotted Pair Notation::    A general syntax for cons cells.
-* Association List Type::   A specially constructed list.
-
-String Type
-
-* Syntax for Strings::      How to specify Lisp strings.
-* Non-ASCII in Strings::    International characters in strings.
-* Nonprinting Characters::  Literal unprintable characters in strings.
-* Text Props and Strings::  Strings with text properties.
-
-Editing Types
-
-* Buffer Type::             The basic object of editing.
-* Marker Type::             A position in a buffer.
-* Window Type::             Buffers are displayed in windows.
-* Frame Type::              Windows subdivide frames.
-* Terminal Type::           A terminal device displays frames.
-* Window Configuration Type::  Recording the way a frame is subdivided.
-* Frame Configuration Type::   Recording the status of all frames.
-* Process Type::            A subprocess of Emacs running on the underlying OS.
-* Stream Type::             Receive or send characters.
-* Keymap Type::             What function a keystroke invokes.
-* Overlay Type::            How an overlay is represented.
-* Font Type::               Fonts for displaying text.
-
-Numbers
-
-* Integer Basics::          Representation and range of integers.
-* Float Basics::            Representation and range of floating point.
-* Predicates on Numbers::   Testing for numbers.
-* Comparison of Numbers::   Equality and inequality predicates.
-* Numeric Conversions::     Converting float to integer and vice versa.
-* Arithmetic Operations::   How to add, subtract, multiply and divide.
-* Rounding Operations::     Explicitly rounding floating point numbers.
-* Bitwise Operations::      Logical and, or, not, shifting.
-* Math Functions::          Trig, exponential and logarithmic functions.
-* Random Numbers::          Obtaining random integers, predictable or not.
-
-Strings and Characters
-
-* String Basics::           Basic properties of strings and characters.
-* Predicates for Strings::  Testing whether an object is a string or char.
-* Creating Strings::        Functions to allocate new strings.
-* Modifying Strings::         Altering the contents of an existing string.
-* Text Comparison::         Comparing characters or strings.
-* String Conversion::       Converting to and from characters and strings.
-* Formatting Strings::      @code{format}: Emacs's analogue of @code{printf}.
-* Case Conversion::         Case conversion functions.
-* Case Tables::             Customizing case conversion.
-
-Lists
-
-* Cons Cells::              How lists are made out of cons cells.
-* List-related Predicates:: Is this object a list?  Comparing two lists.
-* List Elements::           Extracting the pieces of a list.
-* Building Lists::          Creating list structure.
-* List Variables::          Modifying lists stored in variables.
-* Modifying Lists::         Storing new pieces into an existing list.
-* Sets And Lists::          A list can represent a finite mathematical set.
-* Association Lists::       A list can represent a finite relation or mapping.
-* Rings::                   Managing a fixed-size ring of objects.
-
-Modifying Existing List Structure
-
-* Setcar::                  Replacing an element in a list.
-* Setcdr::                  Replacing part of the list backbone.
-                              This can be used to remove or add elements.
-* Rearrangement::           Reordering the elements in a list; combining lists.
-
-Sequences, Arrays, and Vectors
-
-* Sequence Functions::      Functions that accept any kind of sequence.
-* Arrays::                  Characteristics of arrays in Emacs Lisp.
-* Array Functions::         Functions specifically for arrays.
-* Vectors::                 Special characteristics of Emacs Lisp vectors.
-* Vector Functions::        Functions specifically for vectors.
-* Char-Tables::             How to work with char-tables.
-* Bool-Vectors::            How to work with bool-vectors.
-
-Hash Tables
-
-* Creating Hash::           Functions to create hash tables.
-* Hash Access::             Reading and writing the hash table contents.
-* Defining Hash::           Defining new comparison methods.
-* Other Hash::              Miscellaneous.
-
-Symbols
-
-* Symbol Components::       Symbols have names, values, function definitions
-                              and property lists.
-* Definitions::             A definition says how a symbol will be used.
-* Creating Symbols::        How symbols are kept unique.
-* Property Lists::          Each symbol has a property list
-                              for recording miscellaneous information.
-
-Property Lists
-
-* Plists and Alists::       Comparison of the advantages of property
-                              lists and association lists.
-* Symbol Plists::           Functions to access symbols' property lists.
-* Other Plists::            Accessing property lists stored elsewhere.
-
-Evaluation
-
-* Intro Eval::              Evaluation in the scheme of things.
-* Forms::                   How various sorts of objects are evaluated.
-* Quoting::                 Avoiding evaluation (to put constants in
-                              the program).
-* Backquote::               Easier construction of list structure.
-* Eval::                    How to invoke the Lisp interpreter explicitly.
-
-Kinds of Forms
-
-* Self-Evaluating Forms::   Forms that evaluate to themselves.
-* Symbol Forms::            Symbols evaluate as variables.
-* Classifying Lists::       How to distinguish various sorts of list forms.
-* Function Indirection::    When a symbol appears as the car of a list,
-                              we find the real function via the symbol.
-* Function Forms::          Forms that call functions.
-* Macro Forms::             Forms that call macros.
-* Special Forms::           "Special forms" are idiosyncratic primitives,
-                              most of them extremely important.
-* Autoloading::             Functions set up to load files
-                              containing their real definitions.
-
-Control Structures
-
-* Sequencing::              Evaluation in textual order.
-* Conditionals::            @code{if}, @code{cond}, @code{when}, @code{unless}.
-* Combining Conditions::    @code{and}, @code{or}, @code{not}.
-* Iteration::               @code{while} loops.
-* Nonlocal Exits::          Jumping out of a sequence.
-
-Nonlocal Exits
-
-* Catch and Throw::         Nonlocal exits for the program's own purposes.
-* Examples of Catch::       Showing how such nonlocal exits can be written.
-* Errors::                  How errors are signaled and handled.
-* Cleanups::                Arranging to run a cleanup form if an
-                              error happens.
-
-Errors
-
-* Signaling Errors::        How to report an error.
-* Processing of Errors::    What Emacs does when you report an error.
-* Handling Errors::         How you can trap errors and continue execution.
-* Error Symbols::           How errors are classified for trapping them.
-
-Variables
-
-* Global Variables::        Variable values that exist permanently, everywhere.
-* Constant Variables::      Certain "variables" have values that never change.
-* Local Variables::         Variable values that exist only temporarily.
-* Void Variables::          Symbols that lack values.
-* Defining Variables::      A definition says a symbol is used as a variable.
-* Tips for Defining::       Things you should think about when you
-                              define a variable.
-* Accessing Variables::     Examining values of variables whose names
-                              are known only at run time.
-* Setting Variables::       Storing new values in variables.
-* Variable Scoping::        How Lisp chooses among local and global values.
-* Buffer-Local Variables::  Variable values in effect only in one buffer.
-* File Local Variables::    Handling local variable lists in files.
-* Directory Local Variables:: Local variables common to all files in a
-                                directory.
-* Frame-Local Variables::   Frame-local bindings for variables.
-* Variable Aliases::        Variables that are aliases for other variables.
-* Variables with Restricted Values::  Non-constant variables whose value can
-                                        @emph{not} be an arbitrary Lisp object.
-
-Scoping Rules for Variable Bindings
-
-* Scope::                   Scope means where in the program a value
-                              is visible.  Comparison with other languages.
-* Extent::                  Extent means how long in time a value exists.
-* Impl of Scope::           Two ways to implement dynamic scoping.
-* Using Scoping::           How to use dynamic scoping carefully and
-                              avoid problems.
-
-Buffer-Local Variables
-
-* Intro to Buffer-Local::   Introduction and concepts.
-* Creating Buffer-Local::   Creating and destroying buffer-local bindings.
-* Default Value::           The default value is seen in buffers
-                              that don't have their own buffer-local values.
-
-Functions
-
-* What Is a Function::      Lisp functions vs. primitives; terminology.
-* Lambda Expressions::      How functions are expressed as Lisp objects.
-* Function Names::          A symbol can serve as the name of a function.
-* Defining Functions::      Lisp expressions for defining functions.
-* Calling Functions::       How to use an existing function.
-* Mapping Functions::       Applying a function to each element of a list, etc.
-* Anonymous Functions::     Lambda expressions are functions with no names.
-* Function Cells::          Accessing or setting the function definition
-                              of a symbol.
-* Closures::                Functions that enclose a lexical environment.
-* Obsolete Functions::      Declaring functions obsolete.
-* Inline Functions::        Defining functions that the compiler
-                              will expand inline.
-* Declaring Functions::     Telling the compiler that a function is defined.
-* Function Safety::         Determining whether a function is safe to call.
-* Related Topics::          Cross-references to specific Lisp primitives
-                              that have a special bearing on how
-                              functions work.
-
-Lambda Expressions
-
-* Lambda Components::       The parts of a lambda expression.
-* Simple Lambda::           A simple example.
-* Argument List::           Details and special features of argument lists.
-* Function Documentation::  How to put documentation in a function.
-
-Macros
-
-* Simple Macro::            A basic example.
-* Expansion::               How, when and why macros are expanded.
-* Compiling Macros::        How macros are expanded by the compiler.
-* Defining Macros::         How to write a macro definition.
-* Problems with Macros::    Don't evaluate the macro arguments too many times.
-                              Don't hide the user's variables.
-* Indenting Macros::        Specifying how to indent macro calls.
-
-Common Problems Using Macros
-
-* Wrong Time::             Do the work in the expansion, not in the macro.
-* Argument Evaluation::    The expansion should evaluate each macro arg once.
-* Surprising Local Vars::  Local variable bindings in the expansion
-                              require special care.
-* Eval During Expansion::  Don't evaluate them; put them in the expansion.
-* Repeated Expansion::     Avoid depending on how many times expansion is done.
-
-Customization Settings
-
-* Common Keywords::         Common keyword arguments for all kinds of
-                              customization declarations.
-* Group Definitions::       Writing customization group definitions.
-* Variable Definitions::    Declaring user options.
-* Customization Types::     Specifying the type of a user option.
-* Applying Customizations:: Functions to apply customization settings.
-* Custom Themes::           Writing Custom themes.
-
-Customization Types
-
-* Simple Types::            Simple customization types: sexp, integer, number,
-                              string, file, directory, alist.
-* Composite Types::         Build new types from other types or data.
-* Splicing into Lists::     Splice elements into list with @code{:inline}.
-* Type Keywords::           Keyword-argument pairs in a customization type.
-* Defining New Types::      Give your type a name.
-
-Loading
-
-* How Programs Do Loading:: The @code{load} function and others.
-* Load Suffixes::           Details about the suffixes that @code{load} tries.
-* Library Search::          Finding a library to load.
-* Loading Non-ASCII::       Non-@acronym{ASCII} characters in Emacs Lisp files.
-* Autoload::                Setting up a function to autoload.
-* Repeated Loading::        Precautions about loading a file twice.
-* Named Features::          Loading a library if it isn't already loaded.
-* Where Defined::           Finding which file defined a certain symbol.
-* Unloading::               How to "unload" a library that was loaded.
-* Hooks for Loading::       Providing code to be run when
-                              particular libraries are loaded.
-
-Byte Compilation
-
-* Speed of Byte-Code::      An example of speedup from byte compilation.
-* Compilation Functions::   Byte compilation functions.
-* Docs and Compilation::    Dynamic loading of documentation strings.
-* Dynamic Loading::         Dynamic loading of individual functions.
-* Eval During Compile::     Code to be evaluated when you compile.
-* Compiler Errors::         Handling compiler error messages.
-* Byte-Code Objects::       The data type used for byte-compiled functions.
-* Disassembly::             Disassembling byte-code; how to read byte-code.
-
-Advising Emacs Lisp Functions
-
-* Simple Advice::           A simple example to explain the basics of advice.
-* Defining Advice::         Detailed description of @code{defadvice}.
-* Around-Advice::           Wrapping advice around a function's definition.
-* Computed Advice::         ...is to @code{defadvice} as @code{fset} is to @code{defun}.
-* Activation of Advice::    Advice doesn't do anything until you activate it.
-* Enabling Advice::         You can enable or disable each piece of advice.
-* Preactivation::           Preactivation is a way of speeding up the
-                              loading of compiled advice.
-* Argument Access in Advice:: How advice can access the function's arguments.
-* Combined Definition::     How advice is implemented.
-
-Debugging Lisp Programs
-
-* Debugger::                A debugger for the Emacs Lisp evaluator.
-* Edebug::                  A source-level Emacs Lisp debugger.
-* Syntax Errors::           How to find syntax errors.
-* Test Coverage::           Ensuring you have tested all branches in your code.
-
-The Lisp Debugger
-
-* Error Debugging::         Entering the debugger when an error happens.
-* Infinite Loops::          Stopping and debugging a program that doesn't exit.
-* Function Debugging::      Entering it when a certain function is called.
-* Explicit Debug::          Entering it at a certain point in the program.
-* Using Debugger::          What the debugger does; what you see while in it.
-* Debugger Commands::       Commands used while in the debugger.
-* Invoking the Debugger::   How to call the function @code{debug}.
-* Internals of Debugger::   Subroutines of the debugger, and global variables.
-
-Edebug
-
-* Using Edebug::            Introduction to use of Edebug.
-* Instrumenting::           You must instrument your code
-                              in order to debug it with Edebug.
-* Edebug Execution Modes::  Execution modes, stopping more or less often.
-* Jumping::                 Commands to jump to a specified place.
-* Edebug Misc::             Miscellaneous commands.
-* Breaks::                  Setting breakpoints to make the program stop.
-* Trapping Errors::         Trapping errors with Edebug.
-* Edebug Views::            Views inside and outside of Edebug.
-* Edebug Eval::             Evaluating expressions within Edebug.
-* Eval List::               Expressions whose values are displayed
-                              each time you enter Edebug.
-* Printing in Edebug::      Customization of printing.
-* Trace Buffer::            How to produce trace output in a buffer.
-* Coverage Testing::        How to test evaluation coverage.
-* The Outside Context::     Data that Edebug saves and restores.
-* Edebug and Macros::       Specifying how to handle macro calls.
-* Edebug Options::          Option variables for customizing Edebug.
-
-Breaks
-
-* Breakpoints::             Breakpoints at stop points.
-* Global Break Condition::  Breaking on an event.
-* Source Breakpoints::      Embedding breakpoints in source code.
-
-The Outside Context
-
-* Checking Whether to Stop::When Edebug decides what to do.
-* Edebug Display Update::   When Edebug updates the display.
-* Edebug Recursive Edit::   When Edebug stops execution.
-
-Edebug and Macros
-
-* Instrumenting Macro Calls::The basic problem.
-* Specification List::      How to specify complex patterns of evaluation.
-* Backtracking::            What Edebug does when matching fails.
-* Specification Examples::  To help understand specifications.
-
-Debugging Invalid Lisp Syntax
-
-* Excess Open::             How to find a spurious open paren or missing close.
-* Excess Close::            How to find a spurious close paren or missing open.
-
-Reading and Printing Lisp Objects
-
-* Streams Intro::           Overview of streams, reading and printing.
-* Input Streams::           Various data types that can be used as
-                              input streams.
-* Input Functions::         Functions to read Lisp objects from text.
-* Output Streams::          Various data types that can be used as
-                              output streams.
-* Output Functions::        Functions to print Lisp objects as text.
-* Output Variables::        Variables that control what the printing
-                              functions do.
-
-Minibuffers
-
-* Intro to Minibuffers::    Basic information about minibuffers.
-* Text from Minibuffer::    How to read a straight text string.
-* Object from Minibuffer::  How to read a Lisp object or expression.
-* Minibuffer History::      Recording previous minibuffer inputs
-                              so the user can reuse them.
-* Initial Input::           Specifying initial contents for the minibuffer.
-* Completion::              How to invoke and customize completion.
-* Yes-or-No Queries::       Asking a question with a simple answer.
-* Multiple Queries::        Asking a series of similar questions.
-* Reading a Password::      Reading a password from the terminal.
-* Minibuffer Commands::     Commands used as key bindings in minibuffers.
-* Minibuffer Windows::      Operating on the special minibuffer windows.
-* Minibuffer Contents::     How such commands access the minibuffer text.
-* Recursive Mini::          Whether recursive entry to minibuffer is allowed.
-* Minibuffer Misc::         Various customization hooks and variables.
-
-Completion
-
-* Basic Completion::        Low-level functions for completing strings.
-                              (These are too low level to use the minibuffer.)
-* Minibuffer Completion::   Invoking the minibuffer with completion.
-* Completion Commands::     Minibuffer commands that do completion.
-* High-Level Completion::   Convenient special cases of completion
-                              (reading buffer names, variable names, etc.).
-* Reading File Names::      Using completion to read file names and
-                              shell commands.
-* Completion Variables::    Variables controlling completion behavior.
-* Programmed Completion::   Writing your own completion function.
-* Completion in Buffers::   Completing text in ordinary buffers.
-
-Command Loop
-
-* Command Overview::    How the command loop reads commands.
-* Defining Commands::   Specifying how a function should read arguments.
-* Interactive Call::    Calling a command, so that it will read arguments.
-* Distinguish Interactive::     Making a command distinguish interactive calls.
-* Command Loop Info::   Variables set by the command loop for you to examine.
-* Adjusting Point::     Adjustment of point after a command.
-* Input Events::        What input looks like when you read it.
-* Reading Input::       How to read input events from the keyboard or mouse.
-* Special Events::      Events processed immediately and individually.
-* Waiting::             Waiting for user input or elapsed time.
-* Quitting::            How @kbd{C-g} works.  How to catch or defer quitting.
-* Prefix Command Arguments::    How the commands to set prefix args work.
-* Recursive Editing::   Entering a recursive edit,
-                          and why you usually shouldn't.
-* Disabling Commands::  How the command loop handles disabled commands.
-* Command History::     How the command history is set up, and how accessed.
-* Keyboard Macros::     How keyboard macros are implemented.
-
-Defining Commands
-
-* Using Interactive::       General rules for @code{interactive}.
-* Interactive Codes::       The standard letter-codes for reading arguments
-                              in various ways.
-* Interactive Examples::    Examples of how to read interactive arguments.
-
-Input Events
-
-* Keyboard Events::         Ordinary characters--keys with symbols on them.
-* Function Keys::           Function keys--keys with names, not symbols.
-* Mouse Events::            Overview of mouse events.
-* Click Events::            Pushing and releasing a mouse button.
-* Drag Events::             Moving the mouse before releasing the button.
-* Button-Down Events::      A button was pushed and not yet released.
-* Repeat Events::           Double and triple click (or drag, or down).
-* Motion Events::           Just moving the mouse, not pushing a button.
-* Focus Events::            Moving the mouse between frames.
-* Misc Events::             Other events the system can generate.
-* Event Examples::          Examples of the lists for mouse events.
-* Classifying Events::      Finding the modifier keys in an event symbol.
-                              Event types.
-* Accessing Mouse::         Functions to extract info from mouse events.
-* Accessing Scroll::        Functions to get info from scroll bar events.
-* Strings of Events::       Special considerations for putting
-                              keyboard character events in a string.
-
-Reading Input
-
-* Key Sequence Input::      How to read one key sequence.
-* Reading One Event::       How to read just one event.
-* Event Mod::               How Emacs modifies events as they are read.
-* Invoking the Input Method::   How reading an event uses the input method.
-* Quoted Character Input::  Asking the user to specify a character.
-* Event Input Misc::        How to reread or throw away input events.
-
-Keymaps
-
-* Key Sequences::           Key sequences as Lisp objects.
-* Keymap Basics::           Basic concepts of keymaps.
-* Format of Keymaps::       What a keymap looks like as a Lisp object.
-* Creating Keymaps::        Functions to create and copy keymaps.
-* Inheritance and Keymaps:: How one keymap can inherit the bindings
-                              of another keymap.
-* Prefix Keys::             Defining a key with a keymap as its definition.
-* Active Keymaps::          How Emacs searches the active keymaps
-                              for a key binding.
-* Searching Keymaps::       A pseudo-Lisp summary of searching active maps.
-* Controlling Active Maps:: Each buffer has a local keymap
-                               to override the standard (global) bindings.
-                               A minor mode can also override them.
-* Key Lookup::              Finding a key's binding in one keymap.
-* Functions for Key Lookup::    How to request key lookup.
-* Changing Key Bindings::   Redefining a key in a keymap.
-* Remapping Commands::      A keymap can translate one command to another.
-* Translation Keymaps::     Keymaps for translating sequences of events.
-* Key Binding Commands::    Interactive interfaces for redefining keys.
-* Scanning Keymaps::        Looking through all keymaps, for printing help.
-* Menu Keymaps::            Defining a menu as a keymap.
-
-Menu Keymaps
-
-* Defining Menus::          How to make a keymap that defines a menu.
-* Mouse Menus::             How users actuate the menu with the mouse.
-* Keyboard Menus::          How users actuate the menu with the keyboard.
-* Menu Example::            Making a simple menu.
-* Menu Bar::                How to customize the menu bar.
-* Tool Bar::                A tool bar is a row of images.
-* Modifying Menus::         How to add new items to a menu.
-
-Defining Menus
-
-* Simple Menu Items::       A simple kind of menu key binding,
-                              limited in capabilities.
-* Extended Menu Items::     More powerful menu item definitions
-                              let you specify keywords to enable
-                              various features.
-* Menu Separators::         Drawing a horizontal line through a menu.
-* Alias Menu Items::        Using command aliases in menu items.
-* Toolkit Differences::     Not all toolkits provide the same features.
-
-Major and Minor Modes
-
-* Hooks::              How to use hooks; how to write code that provides hooks.
-* Major Modes::        Defining major modes.
-* Minor Modes::        Defining minor modes.
-* Mode Line Format::   Customizing the text that appears in the mode line.
-* Imenu::              Providing a menu of definitions made in a buffer.
-* Font Lock Mode::     How modes can highlight text according to syntax.
-* Auto-Indentation::   How to teach Emacs to indent for a major mode.
-* Desktop Save Mode::  How modes can have buffer state saved between
-                         Emacs sessions.
-
-Hooks
-
-* Running Hooks::      How to run a hook.
-* Setting Hooks::      How to put functions on a hook, or remove them.
-
-Major Modes
-
-* Major Mode Conventions::  Coding conventions for keymaps, etc.
-* Auto Major Mode::         How Emacs chooses the major mode automatically.
-* Mode Help::               Finding out how to use a mode.
-* Derived Modes::           Defining a new major mode based on another major
-                              mode.
-* Basic Major Modes::       Modes that other modes are often derived from.
-* Mode Hooks::              Hooks run at the end of major mode functions.
-* Tabulated List Mode::     Parent mode for buffers containing tabulated data.
-* Generic Modes::           Defining a simple major mode that supports
-                              comment syntax and Font Lock mode.
-* Example Major Modes::     Text mode and Lisp modes.
-
-Minor Modes
-
-* Minor Mode Conventions::  Tips for writing a minor mode.
-* Keymaps and Minor Modes:: How a minor mode can have its own keymap.
-* Defining Minor Modes::    A convenient facility for defining minor modes.
-
-Mode Line Format
-
-* Mode Line Basics::        Basic ideas of mode line control.
-* Mode Line Data::          The data structure that controls the mode line.
-* Mode Line Top::           The top level variable, mode-line-format.
-* Mode Line Variables::     Variables used in that data structure.
-* %-Constructs::            Putting information into a mode line.
-* Properties in Mode::      Using text properties in the mode line.
-* Header Lines::            Like a mode line, but at the top.
-* Emulating Mode Line::     Formatting text as the mode line would.
-
-Font Lock Mode
-
-* Font Lock Basics::        Overview of customizing Font Lock.
-* Search-based Fontification::  Fontification based on regexps.
-* Customizing Keywords::    Customizing search-based fontification.
-* Other Font Lock Variables::   Additional customization facilities.
-* Levels of Font Lock::     Each mode can define alternative levels
-                              so that the user can select more or less.
-* Precalculated Fontification:: How Lisp programs that produce the buffer
-                                  contents can also specify how to fontify it.
-* Faces for Font Lock::     Special faces specifically for Font Lock.
-* Syntactic Font Lock::     Fontification based on syntax tables.
-* Multiline Font Lock::     How to coerce Font Lock into properly
-                              highlighting multiline constructs.
-
-Multiline Font Lock Constructs
-
-* Font Lock Multiline::     Marking multiline chunks with a text property.
-* Region to Refontify::     Controlling which region gets refontified
-                              after a buffer change.
-
-Automatic Indentation of code
-
-* SMIE::                    A simple minded indentation engine.
-
-Simple Minded Indentation Engine
-
-* SMIE setup::              SMIE setup and features.
-* Operator Precedence Grammars:: A very simple parsing technique.
-* SMIE Grammar::            Defining the grammar of a language.
-* SMIE Lexer::              Defining tokens.
-* SMIE Tricks::             Working around the parser's limitations.
-* SMIE Indentation::        Specifying indentation rules.
-* SMIE Indentation Helpers:: Helper functions for indentation rules.
-* SMIE Indentation Example::  Sample indentation rules.
-
-Documentation
-
-* Documentation Basics::    Where doc strings are defined and stored.
-* Accessing Documentation:: How Lisp programs can access doc strings.
-* Keys in Documentation::   Substituting current key bindings.
-* Describing Characters::   Making printable descriptions of
-                              non-printing characters and key sequences.
-* Help Functions::          Subroutines used by Emacs help facilities.
-
-Files
-
-* Visiting Files::          Reading files into Emacs buffers for editing.
-* Saving Buffers::          Writing changed buffers back into files.
-* Reading from Files::      Reading files into buffers without visiting.
-* Writing to Files::        Writing new files from parts of buffers.
-* File Locks::              Locking and unlocking files, to prevent
-                              simultaneous editing by two people.
-* Information about Files:: Testing existence, accessibility, size of files.
-* Changing Files::          Renaming files, changing permissions, etc.
-* File Names::              Decomposing and expanding file names.
-* Contents of Directories:: Getting a list of the files in a directory.
-* Create/Delete Dirs::      Creating and Deleting Directories.
-* Magic File Names::        Special handling for certain file names.
-* Format Conversion::       Conversion to and from various file formats.
-
-Visiting Files
-
-* Visiting Functions::      The usual interface functions for visiting.
-* Subroutines of Visiting:: Lower-level subroutines that they use.
-
-Information about Files
-
-* Testing Accessibility::   Is a given file readable?  Writable?
-* Kinds of Files::          Is it a directory?  A symbolic link?
-* Truenames::               Eliminating symbolic links from a file name.
-* File Attributes::         How large is it?  Any other names?  Etc.
-* Locating Files::          How to find a file in standard places.
-
-File Names
-
-* File Name Components::    The directory part of a file name, and the rest.
-* Relative File Names::     Some file names are relative to a current directory.
-* Directory Names::         A directory's name as a directory
-                              is different from its name as a file.
-* File Name Expansion::     Converting relative file names to absolute ones.
-* Unique File Names::       Generating names for temporary files.
-* File Name Completion::    Finding the completions for a given file name.
-* Standard File Names::     If your package uses a fixed file name,
-                              how to handle various operating systems simply.
-
-File Format Conversion
-
-* Format Conversion Overview::   @code{insert-file-contents} and @code{write-region}.
-* Format Conversion Round-Trip:: Using @code{format-alist}.
-* Format Conversion Piecemeal::  Specifying non-paired conversion.
-
-Backups and Auto-Saving
-
-* Backup Files::            How backup files are made; how their names
-                              are chosen.
-* Auto-Saving::             How auto-save files are made; how their
-                              names are chosen.
-* Reverting::               @code{revert-buffer}, and how to customize
-                              what it does.
-
-Backup Files
-
-* Making Backups::          How Emacs makes backup files, and when.
-* Rename or Copy::          Two alternatives: renaming the old file
-                              or copying it.
-* Numbered Backups::        Keeping multiple backups for each source file.
-* Backup Names::            How backup file names are computed; customization.
-
-Buffers
-
-* Buffer Basics::           What is a buffer?
-* Current Buffer::          Designating a buffer as current
-                              so that primitives will access its contents.
-* Buffer Names::            Accessing and changing buffer names.
-* Buffer File Name::        The buffer file name indicates which file
-                              is visited.
-* Buffer Modification::     A buffer is @dfn{modified} if it needs to be saved.
-* Modification Time::       Determining whether the visited file was changed
-                              "behind Emacs's back".
-* Read Only Buffers::       Modifying text is not allowed in a
-                              read-only buffer.
-* The Buffer List::         How to look at all the existing buffers.
-* Creating Buffers::        Functions that create buffers.
-* Killing Buffers::         Buffers exist until explicitly killed.
-* Indirect Buffers::        An indirect buffer shares text with some
-                              other buffer.
-* Swapping Text::           Swapping text between two buffers.
-* Buffer Gap::              The gap in the buffer.
-
-Windows
-
-* Basic Windows::           Basic information on using windows.
-* Splitting Windows::       Splitting one window into two windows.
-* Deleting Windows::        Deleting a window gives its space to other windows.
-* Selecting Windows::       The selected window is the one that you edit in.
-* Cyclic Window Ordering::  Moving around the existing windows.
-* Buffers and Windows::     Each window displays the contents of a buffer.
-* Switching Buffers::       Higher-level functions for switching to a buffer.
-* Choosing Window::         How to choose a window for displaying a buffer.
-* Display Action Functions:: Subroutines for @code{display-buffer}.
-* Choosing Window Options:: Extra options affecting how buffers are displayed.
-* Window History::          Each window remembers the buffers displayed in it.
-* Dedicated Windows::       How to avoid displaying another buffer in
-                              a specific window.
-* Window Point::            Each window has its own location of point.
-* Window Start and End::    Buffer positions indicating which text is
-                              on-screen in a window.
-* Textual Scrolling::       Moving text up and down through the window.
-* Vertical Scrolling::      Moving the contents up and down on the window.
-* Horizontal Scrolling::    Moving the contents sideways on the window.
-* Size of Window::          Accessing the size of a window.
-* Resizing Windows::        Changing the size of a window.
-* Coordinates and Windows:: Converting coordinates to windows.
-* Window Tree::             The layout and sizes of all windows in a frame.
-* Window Configurations::   Saving and restoring the state of the screen.
-* Window Parameters::       Associating additional information with windows.
-* Window Hooks::            Hooks for scrolling, window size changes,
-                              redisplay going past a certain point,
-                              or window configuration changes.
-
-Frames
-
-* Creating Frames::         Creating additional frames.
-* Multiple Terminals::      Displaying on several different devices.
-* Frame Parameters::        Controlling frame size, position, font, etc.
-* Terminal Parameters::     Parameters common for all frames on terminal.
-* Frame Titles::            Automatic updating of frame titles.
-* Deleting Frames::         Frames last until explicitly deleted.
-* Finding All Frames::      How to examine all existing frames.
-* Frames and Windows::      A frame contains windows;
-                              display of text always works through windows.
-* Minibuffers and Frames::  How a frame finds the minibuffer to use.
-* Input Focus::             Specifying the selected frame.
-* Visibility of Frames::    Frames may be visible or invisible, or icons.
-* Raising and Lowering::    Raising a frame makes it hide other windows;
-                              lowering it makes the others hide it.
-* Frame Configurations::    Saving the state of all frames.
-* Mouse Tracking::          Getting events that say when the mouse moves.
-* Mouse Position::          Asking where the mouse is, or moving it.
-* Pop-Up Menus::            Displaying a menu for the user to select from.
-* Dialog Boxes::            Displaying a box to ask yes or no.
-* Pointer Shape::           Specifying the shape of the mouse pointer.
-* Window System Selections::Transferring text to and from other X clients.
-* Drag and Drop::               Internals of Drag-and-Drop implementation.
-* Color Names::             Getting the definitions of color names.
-* Text Terminal Colors::    Defining colors for text terminals.
-* Resources::               Getting resource values from the server.
-* Display Feature Testing:: Determining the features of a terminal.
-
-Frame Parameters
-
-* Parameter Access::        How to change a frame's parameters.
-* Initial Parameters::      Specifying frame parameters when you make a frame.
-* Window Frame Parameters:: List of frame parameters for window systems.
-* Size and Position::       Changing the size and position of a frame.
-* Geometry::                Parsing geometry specifications.
-
-Window Frame Parameters
-
-* Basic Parameters::        Parameters that are fundamental.
-* Position Parameters::     The position of the frame on the screen.
-* Size Parameters::         Frame's size.
-* Layout Parameters::       Size of parts of the frame, and
-                              enabling or disabling some parts.
-* Buffer Parameters::       Which buffers have been or should be shown.
-* Management Parameters::   Communicating with the window manager.
-* Cursor Parameters::       Controlling the cursor appearance.
-* Font and Color Parameters:: Fonts and colors for the frame text.
-
-Positions
-
-* Point::                   The special position where editing takes place.
-* Motion::                  Changing point.
-* Excursions::              Temporary motion and buffer changes.
-* Narrowing::               Restricting editing to a portion of the buffer.
-
-Motion
-
-* Character Motion::        Moving in terms of characters.
-* Word Motion::             Moving in terms of words.
-* Buffer End Motion::       Moving to the beginning or end of the buffer.
-* Text Lines::              Moving in terms of lines of text.
-* Screen Lines::            Moving in terms of lines as displayed.
-* List Motion::             Moving by parsing lists and sexps.
-* Skipping Characters::     Skipping characters belonging to a certain set.
-
-Markers
-
-* Overview of Markers::     The components of a marker, and how it relocates.
-* Predicates on Markers::   Testing whether an object is a marker.
-* Creating Markers::        Making empty markers or markers at certain places.
-* Information from Markers::Finding the marker's buffer or character position.
-* Marker Insertion Types::  Two ways a marker can relocate when you
-                              insert where it points.
-* Moving Markers::          Moving the marker to a new buffer or position.
-* The Mark::                How "the mark" is implemented with a marker.
-* The Region::              How to access "the region".
-
-Text
-
-* Near Point::              Examining text in the vicinity of point.
-* Buffer Contents::         Examining text in a general fashion.
-* Comparing Text::          Comparing substrings of buffers.
-* Insertion::               Adding new text to a buffer.
-* Commands for Insertion::  User-level commands to insert text.
-* Deletion::                Removing text from a buffer.
-* User-Level Deletion::     User-level commands to delete text.
-* The Kill Ring::           Where removed text sometimes is saved for
-                              later use.
-* Undo::                    Undoing changes to the text of a buffer.
-* Maintaining Undo::        How to enable and disable undo information.
-                              How to control how much information is kept.
-* Filling::                 Functions for explicit filling.
-* Margins::                 How to specify margins for filling commands.
-* Adaptive Fill::           Adaptive Fill mode chooses a fill prefix
-                              from context.
-* Auto Filling::            How auto-fill mode is implemented to break lines.
-* Sorting::                 Functions for sorting parts of the buffer.
-* Columns::                 Computing horizontal positions, and using them.
-* Indentation::             Functions to insert or adjust indentation.
-* Case Changes::            Case conversion of parts of the buffer.
-* Text Properties::         Assigning Lisp property lists to text characters.
-* Substitution::            Replacing a given character wherever it appears.
-* Transposition::           Swapping two portions of a buffer.
-* Registers::               How registers are implemented.  Accessing
-                              the text or position stored in a register.
-* Base 64::                 Conversion to or from base 64 encoding.
-* Checksum/Hash::           Computing cryptographic hashes.
-* Parsing HTML/XML::        Parsing HTML and XML.
-* Atomic Changes::          Installing several buffer changes "atomically".
-* Change Hooks::            Supplying functions to be run when text is changed.
-
-The Kill Ring
-
-* Kill Ring Concepts::      What text looks like in the kill ring.
-* Kill Functions::          Functions that kill text.
-* Yanking::                 How yanking is done.
-* Yank Commands::           Commands that access the kill ring.
-* Low-Level Kill Ring::     Functions and variables for kill ring access.
-* Internals of Kill Ring::  Variables that hold kill ring data.
-
-Indentation
-
-* Primitive Indent::        Functions used to count and insert indentation.
-* Mode-Specific Indent::    Customize indentation for different modes.
-* Region Indent::           Indent all the lines in a region.
-* Relative Indent::         Indent the current line based on previous lines.
-* Indent Tabs::             Adjustable, typewriter-like tab stops.
-* Motion by Indent::        Move to first non-blank character.
-
-Text Properties
-
-* Examining Properties::    Looking at the properties of one character.
-* Changing Properties::     Setting the properties of a range of text.
-* Property Search::         Searching for where a property changes value.
-* Special Properties::      Particular properties with special meanings.
-* Format Properties::       Properties for representing formatting of text.
-* Sticky Properties::       How inserted text gets properties from
-                              neighboring text.
-* Lazy Properties::         Computing text properties in a lazy fashion
-                              only when text is examined.
-* Clickable Text::          Using text properties to make regions of text
-                              do something when you click on them.
-* Fields::                  The @code{field} property defines
-                              fields within the buffer.
-* Not Intervals::           Why text properties do not use
-                              Lisp-visible text intervals.
-
-Non-@acronym{ASCII} Characters
-
-* Text Representations::    How Emacs represents text.
-* Converting Representations::  Converting unibyte to multibyte and vice versa.
-* Selecting a Representation::  Treating a byte sequence as unibyte or multi.
-* Character Codes::         How unibyte and multibyte relate to
-                                codes of individual characters.
-* Character Properties::    Character attributes that define their
-                                behavior and handling.
-* Character Sets::          The space of possible character codes
-                                is divided into various character sets.
-* Scanning Charsets::       Which character sets are used in a buffer?
-* Translation of Characters::   Translation tables are used for conversion.
-* Coding Systems::          Coding systems are conversions for saving files.
-* Input Methods::           Input methods allow users to enter various
-                                non-ASCII characters without special keyboards.
-* Locales::                 Interacting with the POSIX locale.
-
-Coding Systems
-
-* Coding System Basics::    Basic concepts.
-* Encoding and I/O::        How file I/O functions handle coding systems.
-* Lisp and Coding Systems:: Functions to operate on coding system names.
-* User-Chosen Coding Systems::  Asking the user to choose a coding system.
-* Default Coding Systems::  Controlling the default choices.
-* Specifying Coding Systems::   Requesting a particular coding system
-                                    for a single file operation.
-* Explicit Encoding::       Encoding or decoding text without doing I/O.
-* Terminal I/O Encoding::   Use of encoding for terminal I/O.
-* MS-DOS File Types::       How DOS "text" and "binary" files
-                                relate to coding systems.
-
-Searching and Matching
-
-* String Search::           Search for an exact match.
-* Searching and Case::      Case-independent or case-significant searching.
-* Regular Expressions::     Describing classes of strings.
-* Regexp Search::           Searching for a match for a regexp.
-* POSIX Regexps::           Searching POSIX-style for the longest match.
-* Match Data::              Finding out which part of the text matched,
-                              after a string or regexp search.
-* Search and Replace::      Commands that loop, searching and replacing.
-* Standard Regexps::        Useful regexps for finding sentences, pages,...
-
-Regular Expressions
-
-* Syntax of Regexps::       Rules for writing regular expressions.
-* Regexp Example::          Illustrates regular expression syntax.
-* Regexp Functions::        Functions for operating on regular expressions.
-
-Syntax of Regular Expressions
-
-* Regexp Special::          Special characters in regular expressions.
-* Char Classes::            Character classes used in regular expressions.
-* Regexp Backslash::        Backslash-sequences in regular expressions.
-
-The Match Data
-
-* Replacing Match::         Replacing a substring that was matched.
-* Simple Match Data::       Accessing single items of match data,
-                              such as where a particular subexpression started.
-* Entire Match Data::       Accessing the entire match data at once, as a list.
-* Saving Match Data::       Saving and restoring the match data.
-
-Syntax Tables
-
-* Syntax Basics::           Basic concepts of syntax tables.
-* Syntax Descriptors::      How characters are classified.
-* Syntax Table Functions::  How to create, examine and alter syntax tables.
-* Syntax Properties::       Overriding syntax with text properties.
-* Motion and Syntax::       Moving over characters with certain syntaxes.
-* Parsing Expressions::     Parsing balanced expressions
-                              using the syntax table.
-* Standard Syntax Tables::  Syntax tables used by various major modes.
-* Syntax Table Internals::  How syntax table information is stored.
-* Categories::              Another way of classifying character syntax.
-
-Syntax Descriptors
-
-* Syntax Class Table::      Table of syntax classes.
-* Syntax Flags::            Additional flags each character can have.
-
-Parsing Expressions
-
-* Motion via Parsing::      Motion functions that work by parsing.
-* Position Parse::          Determining the syntactic state of a position.
-* Parser State::            How Emacs represents a syntactic state.
-* Low-Level Parsing::       Parsing across a specified region.
-* Control Parsing::         Parameters that affect parsing.
-
-Abbrevs and Abbrev Expansion
-
-* Abbrev Tables::           Creating and working with abbrev tables.
-* Defining Abbrevs::        Specifying abbreviations and their expansions.
-* Abbrev Files::            Saving abbrevs in files.
-* Abbrev Expansion::        Controlling expansion; expansion subroutines.
-* Standard Abbrev Tables::  Abbrev tables used by various major modes.
-* Abbrev Properties::       How to read and set abbrev properties.
-                            Which properties have which effect.
-* Abbrev Table Properties:: How to read and set abbrev table properties.
-                            Which properties have which effect.
-
-Processes
-
-* Subprocess Creation::     Functions that start subprocesses.
-* Shell Arguments::         Quoting an argument to pass it to a shell.
-* Synchronous Processes::   Details of using synchronous subprocesses.
-* Asynchronous Processes::  Starting up an asynchronous subprocess.
-* Deleting Processes::      Eliminating an asynchronous subprocess.
-* Process Information::     Accessing run-status and other attributes.
-* Input to Processes::      Sending input to an asynchronous subprocess.
-* Signals to Processes::    Stopping, continuing or interrupting
-                              an asynchronous subprocess.
-* Output from Processes::   Collecting output from an asynchronous subprocess.
-* Sentinels::               Sentinels run when process run-status changes.
-* Query Before Exit::       Whether to query if exiting will kill a process.
-* System Processes::        Accessing other processes running on your system.
-* Transaction Queues::      Transaction-based communication with subprocesses.
-* Network::                 Opening network connections.
-* Network Servers::         Network servers let Emacs accept net connections.
-* Datagrams::               UDP network connections.
-* Low-Level Network::       Lower-level but more general function
-                              to create connections and servers.
-* Misc Network::            Additional relevant functions for net connections.
-* Serial Ports::            Communicating with serial ports.
-* Byte Packing::            Using bindat to pack and unpack binary data.
-
-Receiving Output from Processes
-
-* Process Buffers::         If no filter, output is put in a buffer.
-* Filter Functions::        Filter functions accept output from the process.
-* Decoding Output::         Filters can get unibyte or multibyte strings.
-* Accepting Output::        How to wait until process output arrives.
-
-Low-Level Network Access
-
-* Network Processes::       Using @code{make-network-process}.
-* Network Options::         Further control over network connections.
-* Network Feature Testing:: Determining which network features work on
-                              the machine you are using.
-
-Packing and Unpacking Byte Arrays
-
-* Bindat Spec::             Describing data layout.
-* Bindat Functions::        Doing the unpacking and packing.
-* Bindat Examples::         Samples of what bindat.el can do for you!
-
-Emacs Display
-
-* Refresh Screen::          Clearing the screen and redrawing everything on it.
-* Forcing Redisplay::       Forcing redisplay.
-* Truncation::              Folding or wrapping long text lines.
-* The Echo Area::           Displaying messages at the bottom of the screen.
-* Warnings::                Displaying warning messages for the user.
-* Invisible Text::          Hiding part of the buffer text.
-* Selective Display::       Hiding part of the buffer text (the old way).
-* Temporary Displays::      Displays that go away automatically.
-* Overlays::                Use overlays to highlight parts of the buffer.
-* Width::                   How wide a character or string is on the screen.
-* Line Height::             Controlling the height of lines.
-* Faces::                   A face defines a graphics style
-                              for text characters: font, colors, etc.
-* Fringes::                 Controlling window fringes.
-* Scroll Bars::             Controlling vertical scroll bars.
-* Display Property::        Enabling special display features.
-* Images::                  Displaying images in Emacs buffers.
-* Buttons::                 Adding clickable buttons to Emacs buffers.
-* Abstract Display::        Emacs's Widget for Object Collections.
-* Blinking::                How Emacs shows the matching open parenthesis.
-* Character Display::       How Emacs displays individual characters.
-* Beeping::                 Audible signal to the user.
-* Window Systems::          Which window system is being used.
-* Bidirectional Display::   Display of bidirectional scripts, such as
-                              Arabic and Farsi.
-
-The Echo Area
-
-* Displaying Messages::     Explicitly displaying text in the echo area.
-* Progress::                Informing user about progress of a long operation.
-* Logging Messages::        Echo area messages are logged for the user.
-* Echo Area Customization:: Controlling the echo area.
-
-Reporting Warnings
-
-* Warning Basics::          Warnings concepts and functions to report them.
-* Warning Variables::       Variables programs bind to customize
-                              their warnings.
-* Warning Options::         Variables users set to control display of warnings.
-* Delayed Warnings::        Deferring warning display until the end of a command.
-
-Overlays
-
-* Managing Overlays::       Creating and moving overlays.
-* Overlay Properties::      How to read and set properties.
-                            What properties do to the screen display.
-* Finding Overlays::        Searching for overlays.
-
-Faces
-
-* Defining Faces::          How to define a face.
-* Face Attributes::         What is in a face?
-* Attribute Functions::     Functions to examine and set face attributes.
-* Displaying Faces::        How Emacs combines the faces specified for
-                              a character.
-* Face Remapping::         Remapping faces to alternative definitions.
-* Face Functions::          How to define and examine faces.
-* Auto Faces::              Hook for automatic face assignment.
-* Basic Faces::             Faces that are defined by default.
-* Font Selection::          Finding the best available font for a face.
-* Font Lookup::             Looking up the names of available fonts
-                              and information about them.
-* Fontsets::                A fontset is a collection of fonts
-                              that handle a range of character sets.
-* Low-Level Font::          Lisp representation for character display fonts.
-
-Fringes
-
-* Fringe Size/Pos::         Specifying where to put the window fringes.
-* Fringe Indicators::       Displaying indicator icons in the window fringes.
-* Fringe Cursors::          Displaying cursors in the right fringe.
-* Fringe Bitmaps::          Specifying bitmaps for fringe indicators.
-* Customizing Bitmaps::     Specifying your own bitmaps to use in the fringes.
-* Overlay Arrow::           Display of an arrow to indicate position.
-
-The @code{display} Property
-
-* Replacing Specs::         Display specs that replace the text.
-* Specified Space::         Displaying one space with a specified width.
-* Pixel Specification::     Specifying space width or height in pixels.
-* Other Display Specs::     Displaying an image; adjusting the height,
-                              spacing, and other properties of text.
-* Display Margins::         Displaying text or images to the side of
-                              the main text.
-
-Images
-
-* Image Formats::           Supported image formats.
-* Image Descriptors::       How to specify an image for use in @code{:display}.
-* XBM Images::              Special features for XBM format.
-* XPM Images::              Special features for XPM format.
-* GIF Images::              Special features for GIF format.
-* TIFF Images::             Special features for TIFF format.
-* PostScript Images::       Special features for PostScript format.
-* ImageMagick Images::      Special features available through ImageMagick.
-* Other Image Types::       Various other formats are supported.
-* Defining Images::         Convenient ways to define an image for later use.
-* Showing Images::          Convenient ways to display an image once
-                              it is defined.
-* Animated Images::         Some image formats can be animated.
-* Image Cache::             Internal mechanisms of image display.
-
-Buttons
-
-* Button Properties::       Button properties with special meanings.
-* Button Types::            Defining common properties for classes of buttons.
-* Making Buttons::          Adding buttons to Emacs buffers.
-* Manipulating Buttons::    Getting and setting properties of buttons.
-* Button Buffer Commands::  Buffer-wide commands and bindings for buttons.
-
-Abstract Display
-
-* Abstract Display Functions::  Functions in the Ewoc package.
-* Abstract Display Example::    Example of using Ewoc.
-
-Character Display
-
-* Usual Display::       The usual conventions for displaying characters.
-* Display Tables::      What a display table consists of.
-* Active Display Table::  How Emacs selects a display table to use.
-* Glyphs::              How to define a glyph, and what glyphs mean.
-* Glyphless Chars::     How glyphless characters are drawn.
-
-Operating System Interface
-
-* Starting Up::             Customizing Emacs startup processing.
-* Getting Out::             How exiting works (permanent or temporary).
-* System Environment::      Distinguish the name and kind of system.
-* User Identification::     Finding the name and user id of the user.
-* Time of Day::             Getting the current time.
-* Time Conversion::         Converting a time from numeric form to
-                              calendrical data and vice versa.
-* Time Parsing::            Converting a time from numeric form to text
-                              and vice versa.
-* Processor Run Time::      Getting the run time used by Emacs.
-* Time Calculations::       Adding, subtracting, comparing times, etc.
-* Timers::                  Setting a timer to call a function at a
-                              certain time.
-* Idle Timers::             Setting a timer to call a function when Emacs has
-                              been idle for a certain length of time.
-* Terminal Input::          Accessing and recording terminal input.
-* Terminal Output::         Controlling and recording terminal output.
-* Sound Output::            Playing sounds on the computer's speaker.
-* X11 Keysyms::             Operating on key symbols for X Windows.
-* Batch Mode::              Running Emacs without terminal interaction.
-* Session Management::      Saving and restoring state with
-                              X Session Management.
-* Notifications::           Desktop notifications.
-* Dynamic Libraries::       On-demand loading of support libraries.
-
-Starting Up Emacs
-
-* Startup Summary::         Sequence of actions Emacs performs at startup.
-* Init File::               Details on reading the init file.
-* Terminal-Specific::       How the terminal-specific Lisp file is read.
-* Command-Line Arguments::  How command-line arguments are processed,
-                              and how you can customize them.
-
-Getting Out of Emacs
-
-* Killing Emacs::           Exiting Emacs irreversibly.
-* Suspending Emacs::        Exiting Emacs reversibly.
-
-Terminal Input
-
-* Input Modes::             Options for how input is processed.
-* Recording Input::         Saving histories of recent or all input events.
-
-Preparing Lisp code for distribution
-
-* Packaging Basics::        The basic concepts of Emacs Lisp packages.
-* Simple Packages::         How to package a single .el file.
-* Multi-file Packages::     How to package multiple files.
-* Package Archives::        Maintaining package archives.
-
-Tips and Conventions
-
-* Coding Conventions::      Conventions for clean and robust programs.
-* Key Binding Conventions:: Which keys should be bound by which programs.
-* Programming Tips::        Making Emacs code fit smoothly in Emacs.
-* Compilation Tips::        Making compiled code run fast.
-* Warning Tips::            Turning off compiler warnings.
-* Documentation Tips::      Writing readable documentation strings.
-* Comment Tips::            Conventions for writing comments.
-* Library Headers::         Standard headers for library packages.
-
-GNU Emacs Internals
-
-* Building Emacs::          How the dumped Emacs is made.
-* Pure Storage::            Kludge to make preloaded Lisp functions shareable.
-* Garbage Collection::      Reclaiming space for Lisp objects no longer used.
-* Memory Usage::            Info about total size of Lisp objects made so far.
-* Writing Emacs Primitives::  Writing C code for Emacs.
-* Object Internals::        Data formats of buffers, windows, processes.
-
-Object Internals
-
-* Buffer Internals::        Components of a buffer structure.
-* Window Internals::        Components of a window structure.
-* Process Internals::       Components of a process structure.
-@end detailmenu
-@end menu
-
-@include intro.texi
-@include objects.texi
-@include numbers.texi
-@include strings.texi
-
-@include lists.texi
-@include sequences.texi
-@include hash.texi
-@include symbols.texi
-@include eval.texi
-
-@include control.texi
-@include variables.texi
-@include functions.texi
-@include macros.texi
-
-@include customize.texi
-@include loading.texi
-@include compile.texi
-@include advice.texi
-
-@c This includes edebug.texi.
-@include debugging.texi
-@include streams.texi
-@include minibuf.texi
-@include commands.texi
-
-@include keymaps.texi
-@include modes.texi
-@include help.texi
-@include files.texi
-
-@include backups.texi
-
-@c ================ Beginning of Volume 2 ================
-@c include buffers.texi
-@c include windows.texi
-@c include frames.texi
-
-@c include positions.texi
-@c include markers.texi
-@c include text.texi
-@c include nonascii.texi
-
-@c include searching.texi
-@c include syntax.texi
-@c include abbrevs.texi
-@c include processes.texi
-
-@c include display.texi
-@c include os.texi
-
-@c appendices
-
-@c include anti.texi
-@c include doclicense.texi
-@c include gpl.texi
-@c include tips.texi
-@c include internals.texi
-@c include errors.texi
-@c include maps.texi
-@c include hooks.texi
-
-@include index.texi
-
-@ignore
-@node New Symbols, , Index, Top
-@unnumbered New Symbols Since the Previous Edition
-
-@printindex tp
-@end ignore
-
-@bye
-
-\f
-These words prevent "local variables" above from confusing Emacs.
diff --git a/doc/lispref/vol2.texi b/doc/lispref/vol2.texi
deleted file mode 100644 (file)
index e6fbf12..0000000
+++ /dev/null
@@ -1,1562 +0,0 @@
-\input texinfo  @c -*-texinfo-*-
-@c This file is used for printing the GNU Emacs Lisp Reference Manual
-@c in two volumes.  It is a modified version of elisp.texi.
-@c Copyright (C) 1990-1995, 1998-1999, 2001-2012
-@c   Free Software Foundation, Inc.
-@c %**start of header
-@setfilename elisp
-@settitle GNU Emacs Lisp Reference Manual: Volume 2
-@c %**end of header
-
-@c See two-volume-cross-refs.txt.
-@tex
-\message{Formatting for two volume edition...Volume 2...}
-%
-% Read special toc file, set up in two-volume.make.
-\gdef\tocreadfilename{elisp2-toc-ready.toc}
-%
-% Don't make outlines, they're not needed and \readdatafile can't pay
-% attention to the special definition above.
-\global\let\pdfmakeoutlines=\relax
-%
-% Start volume 2 chapter numbering at 27; this must be listed as chapno26
-\global\chapno=26
-@end tex
-
-@c Version of the manual and of Emacs.
-@set VERSION  3.1
-@include emacsver.texi
-@set DATE May 2012
-
-@dircategory Emacs
-@direntry
-* Elisp: (elisp).       The Emacs Lisp Reference Manual.
-@end direntry
-
-@c in general, keep the following line commented out, unless doing a
-@c copy of this manual that will be published.  the manual should go
-@c onto the distribution in the full, 8.5 x 11" size.
-@set smallbook
-
-@ifset smallbook
-@smallbook
-@end ifset
-
-@c per rms and peterb, use 10pt fonts for the main text, mostly to
-@c save on paper cost.
-@c Do this inside @tex for now, so current makeinfo does not complain.
-@tex
-@ifset smallbook
-@fonttextsize 10
-@end ifset
-\global\hbadness=6666 % don't worry about not-too-underfull boxes
-@end tex
-
-@c Combine indices.
-@synindex cp fn
-@syncodeindex vr fn
-@syncodeindex ky fn
-@syncodeindex pg fn
-@c We use the "type index" to index new functions and variables.
-@c @syncodeindex tp fn
-
-@copying
-This is edition @value{VERSION} of the GNU Emacs Lisp Reference Manual,@*
-corresponding to Emacs version @value{EMACSVER}.
-
-Copyright @copyright{} 1990-1996, 1998-2012 Free Software Foundation, Inc.
-
-@quotation
-Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.3 or
-any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License,'' with the
-Front-Cover texts being ``A GNU Manual,'' and with the Back-Cover
-Texts as in (a) below.  A copy of the license is included in the
-section entitled ``GNU Free Documentation License.''
-
-(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
-modify this GNU manual.  Buying copies from the FSF supports it in
-developing GNU and promoting software freedom.''
-@end quotation
-@end copying
-
-@titlepage
-@title GNU Emacs Lisp Reference Manual
-@subtitle Volume 2
-@subtitle For Emacs Version @value{EMACSVER}
-@subtitle Revision @value{VERSION}, @value{DATE}
-
-@author by Bil Lewis, Dan LaLiberte, Richard Stallman,
-@author the GNU Manual Group, et al.
-@page
-@vskip 0pt plus 1filll
-@insertcopying
-
-@sp 2
-Published by the Free Software Foundation @*
-51 Franklin St, Fifth Floor @*
-Boston, MA 02110-1301 @*
-USA @*
-ISBN 1-882114-74-4
-
-@sp 2
-Cover art by Etienne Suvasa.
-@end titlepage
-
-
-@c Print the tables of contents
-@summarycontents
-@contents
-
-
-@ifnottex
-@node Top, Introduction, (dir), (dir)
-@top Emacs Lisp
-
-This Info file contains edition @value{VERSION} of the GNU Emacs Lisp
-Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}.
-@end ifnottex
-
-@menu
-* Introduction::            Introduction and conventions used.
-
-* Lisp Data Types::         Data types of objects in Emacs Lisp.
-* Numbers::                 Numbers and arithmetic functions.
-* Strings and Characters::  Strings, and functions that work on them.
-* Lists::                   Lists, cons cells, and related functions.
-* Sequences Arrays Vectors::  Lists, strings and vectors are called sequences.
-                                Certain functions act on any kind of sequence.
-                                The description of vectors is here as well.
-* Hash Tables::             Very fast lookup-tables.
-* Symbols::                 Symbols represent names, uniquely.
-
-* Evaluation::              How Lisp expressions are evaluated.
-* Control Structures::      Conditionals, loops, nonlocal exits.
-* Variables::               Using symbols in programs to stand for values.
-* Functions::               A function is a Lisp program
-                              that can be invoked from other functions.
-* Macros::                  Macros are a way to extend the Lisp language.
-* Customization::           Making variables and faces customizable.
-
-* Loading::                 Reading files of Lisp code into Lisp.
-* Byte Compilation::        Compilation makes programs run faster.
-* Advising Functions::      Adding to the definition of a function.
-* Debugging::               Tools and tips for debugging Lisp programs.
-
-* Read and Print::          Converting Lisp objects to text and back.
-* Minibuffers::             Using the minibuffer to read input.
-* Command Loop::            How the editor command loop works,
-                              and how you can call its subroutines.
-* Keymaps::                 Defining the bindings from keys to commands.
-* Modes::                   Defining major and minor modes.
-* Documentation::           Writing and using documentation strings.
-
-* Files::                   Accessing files.
-* Backups and Auto-Saving:: Controlling how backups and auto-save
-                              files are made.
-* Buffers::                 Creating and using buffer objects.
-* Windows::                 Manipulating windows and displaying buffers.
-* Frames::                  Making multiple system-level windows.
-* Positions::               Buffer positions and motion functions.
-* Markers::                 Markers represent positions and update
-                              automatically when the text is changed.
-
-* Text::                    Examining and changing text in buffers.
-* Non-ASCII Characters::    Non-ASCII text in buffers and strings.
-* Searching and Matching::  Searching buffers for strings or regexps.
-* Syntax Tables::           The syntax table controls word and list parsing.
-* Abbrevs::                 How Abbrev mode works, and its data structures.
-
-* Processes::               Running and communicating with subprocesses.
-* Display::                 Features for controlling the screen display.
-* System Interface::        Getting the user id, system type, environment
-                              variables, and other such things.
-
-* Packaging::               Preparing Lisp code for distribution.
-
-Appendices
-
-* Antinews::                Info for users downgrading to Emacs 23.
-* GNU Free Documentation License:: The license for this documentation.
-* GPL::                     Conditions for copying and changing GNU Emacs.
-* Tips::                    Advice and coding conventions for Emacs Lisp.
-* GNU Emacs Internals::     Building and dumping Emacs;
-                              internal data structures.
-* Standard Errors::         List of some standard error symbols.
-* Standard Keymaps::        List of some standard keymaps.
-* Standard Hooks::          List of some standard hook variables.
-
-* Index::                   Index including concepts, functions, variables,
-                              and other terms.
-
-@ignore
-* New Symbols::             New functions and variables in Emacs @value{EMACSVER}.
-@end ignore
-
-@c Do NOT modify the following 3 lines!  They must have this form to
-@c be correctly identified by `texinfo-multiple-files-update'.  In
-@c particular, the detailed menu header line MUST be identical to the
-@c value of `texinfo-master-menu-header'.  See texnfo-upd.el.
-
-@detailmenu
- --- The Detailed Node Listing ---
- ---------------------------------
-
-Here are other nodes that are subnodes of those already listed,
-mentioned here so you can get to them in one step:
-
-Introduction
-
-* Caveats::                 Flaws and a request for help.
-* Lisp History::            Emacs Lisp is descended from Maclisp.
-* Conventions::             How the manual is formatted.
-* Version Info::            Which Emacs version is running?
-* Acknowledgements::        The authors, editors, and sponsors of this manual.
-
-Conventions
-
-* Some Terms::              Explanation of terms we use in this manual.
-* nil and t::               How the symbols @code{nil} and @code{t} are used.
-* Evaluation Notation::     The format we use for examples of evaluation.
-* Printing Notation::       The format we use when examples print text.
-* Error Messages::          The format we use for examples of errors.
-* Buffer Text Notation::    The format we use for buffer contents in examples.
-* Format of Descriptions::  Notation for describing functions, variables, etc.
-
-Format of Descriptions
-
-* A Sample Function Description::  A description of an imaginary
-                                     function, @code{foo}.
-* A Sample Variable Description::  A description of an imaginary
-                                     variable, @code{electric-future-map}.
-
-Lisp Data Types
-
-* Printed Representation::  How Lisp objects are represented as text.
-* Comments::                Comments and their formatting conventions.
-* Programming Types::       Types found in all Lisp systems.
-* Editing Types::           Types specific to Emacs.
-* Circular Objects::            Read syntax for circular structure.
-* Type Predicates::         Tests related to types.
-* Equality Predicates::     Tests of equality between any two objects.
-
-Programming Types
-
-* Integer Type::        Numbers without fractional parts.
-* Floating Point Type:: Numbers with fractional parts and with a large range.
-* Character Type::      The representation of letters, numbers and
-                          control characters.
-* Symbol Type::         A multi-use object that refers to a function,
-                        variable, or property list, and has a unique identity.
-* Sequence Type::       Both lists and arrays are classified as sequences.
-* Cons Cell Type::      Cons cells, and lists (which are made from cons cells).
-* Array Type::          Arrays include strings and vectors.
-* String Type::         An (efficient) array of characters.
-* Vector Type::         One-dimensional arrays.
-* Char-Table Type::     One-dimensional sparse arrays indexed by characters.
-* Bool-Vector Type::    One-dimensional arrays of @code{t} or @code{nil}.
-* Hash Table Type::     Super-fast lookup tables.
-* Function Type::       A piece of executable code you can call from elsewhere.
-* Macro Type::          A method of expanding an expression into another
-                          expression, more fundamental but less pretty.
-* Primitive Function Type::     A function written in C, callable from Lisp.
-* Byte-Code Type::      A function written in Lisp, then compiled.
-* Autoload Type::       A type used for automatically loading seldom-used
-                          functions.
-
-Character Type
-
-* Basic Char Syntax::       Syntax for regular characters.
-* General Escape Syntax::   How to specify characters by their codes.
-* Ctl-Char Syntax::         Syntax for control characters.
-* Meta-Char Syntax::        Syntax for meta-characters.
-* Other Char Bits::         Syntax for hyper-, super-, and alt-characters.
-
-Cons Cell and List Types
-
-* Box Diagrams::            Drawing pictures of lists.
-* Dotted Pair Notation::    A general syntax for cons cells.
-* Association List Type::   A specially constructed list.
-
-String Type
-
-* Syntax for Strings::      How to specify Lisp strings.
-* Non-ASCII in Strings::    International characters in strings.
-* Nonprinting Characters::  Literal unprintable characters in strings.
-* Text Props and Strings::  Strings with text properties.
-
-Editing Types
-
-* Buffer Type::             The basic object of editing.
-* Marker Type::             A position in a buffer.
-* Window Type::             Buffers are displayed in windows.
-* Frame Type::              Windows subdivide frames.
-* Terminal Type::           A terminal device displays frames.
-* Window Configuration Type::  Recording the way a frame is subdivided.
-* Frame Configuration Type::   Recording the status of all frames.
-* Process Type::            A subprocess of Emacs running on the underlying OS.
-* Stream Type::             Receive or send characters.
-* Keymap Type::             What function a keystroke invokes.
-* Overlay Type::            How an overlay is represented.
-* Font Type::               Fonts for displaying text.
-
-Numbers
-
-* Integer Basics::          Representation and range of integers.
-* Float Basics::            Representation and range of floating point.
-* Predicates on Numbers::   Testing for numbers.
-* Comparison of Numbers::   Equality and inequality predicates.
-* Numeric Conversions::     Converting float to integer and vice versa.
-* Arithmetic Operations::   How to add, subtract, multiply and divide.
-* Rounding Operations::     Explicitly rounding floating point numbers.
-* Bitwise Operations::      Logical and, or, not, shifting.
-* Math Functions::          Trig, exponential and logarithmic functions.
-* Random Numbers::          Obtaining random integers, predictable or not.
-
-Strings and Characters
-
-* String Basics::           Basic properties of strings and characters.
-* Predicates for Strings::  Testing whether an object is a string or char.
-* Creating Strings::        Functions to allocate new strings.
-* Modifying Strings::         Altering the contents of an existing string.
-* Text Comparison::         Comparing characters or strings.
-* String Conversion::       Converting to and from characters and strings.
-* Formatting Strings::      @code{format}: Emacs's analogue of @code{printf}.
-* Case Conversion::         Case conversion functions.
-* Case Tables::             Customizing case conversion.
-
-Lists
-
-* Cons Cells::              How lists are made out of cons cells.
-* List-related Predicates:: Is this object a list?  Comparing two lists.
-* List Elements::           Extracting the pieces of a list.
-* Building Lists::          Creating list structure.
-* List Variables::          Modifying lists stored in variables.
-* Modifying Lists::         Storing new pieces into an existing list.
-* Sets And Lists::          A list can represent a finite mathematical set.
-* Association Lists::       A list can represent a finite relation or mapping.
-* Rings::                   Managing a fixed-size ring of objects.
-
-Modifying Existing List Structure
-
-* Setcar::                  Replacing an element in a list.
-* Setcdr::                  Replacing part of the list backbone.
-                              This can be used to remove or add elements.
-* Rearrangement::           Reordering the elements in a list; combining lists.
-
-Sequences, Arrays, and Vectors
-
-* Sequence Functions::      Functions that accept any kind of sequence.
-* Arrays::                  Characteristics of arrays in Emacs Lisp.
-* Array Functions::         Functions specifically for arrays.
-* Vectors::                 Special characteristics of Emacs Lisp vectors.
-* Vector Functions::        Functions specifically for vectors.
-* Char-Tables::             How to work with char-tables.
-* Bool-Vectors::            How to work with bool-vectors.
-
-Hash Tables
-
-* Creating Hash::           Functions to create hash tables.
-* Hash Access::             Reading and writing the hash table contents.
-* Defining Hash::           Defining new comparison methods.
-* Other Hash::              Miscellaneous.
-
-Symbols
-
-* Symbol Components::       Symbols have names, values, function definitions
-                              and property lists.
-* Definitions::             A definition says how a symbol will be used.
-* Creating Symbols::        How symbols are kept unique.
-* Property Lists::          Each symbol has a property list
-                              for recording miscellaneous information.
-
-Property Lists
-
-* Plists and Alists::       Comparison of the advantages of property
-                              lists and association lists.
-* Symbol Plists::           Functions to access symbols' property lists.
-* Other Plists::            Accessing property lists stored elsewhere.
-
-Evaluation
-
-* Intro Eval::              Evaluation in the scheme of things.
-* Forms::                   How various sorts of objects are evaluated.
-* Quoting::                 Avoiding evaluation (to put constants in
-                              the program).
-* Backquote::               Easier construction of list structure.
-* Eval::                    How to invoke the Lisp interpreter explicitly.
-
-Kinds of Forms
-
-* Self-Evaluating Forms::   Forms that evaluate to themselves.
-* Symbol Forms::            Symbols evaluate as variables.
-* Classifying Lists::       How to distinguish various sorts of list forms.
-* Function Indirection::    When a symbol appears as the car of a list,
-                              we find the real function via the symbol.
-* Function Forms::          Forms that call functions.
-* Macro Forms::             Forms that call macros.
-* Special Forms::           "Special forms" are idiosyncratic primitives,
-                              most of them extremely important.
-* Autoloading::             Functions set up to load files
-                              containing their real definitions.
-
-Control Structures
-
-* Sequencing::              Evaluation in textual order.
-* Conditionals::            @code{if}, @code{cond}, @code{when}, @code{unless}.
-* Combining Conditions::    @code{and}, @code{or}, @code{not}.
-* Iteration::               @code{while} loops.
-* Nonlocal Exits::          Jumping out of a sequence.
-
-Nonlocal Exits
-
-* Catch and Throw::         Nonlocal exits for the program's own purposes.
-* Examples of Catch::       Showing how such nonlocal exits can be written.
-* Errors::                  How errors are signaled and handled.
-* Cleanups::                Arranging to run a cleanup form if an
-                              error happens.
-
-Errors
-
-* Signaling Errors::        How to report an error.
-* Processing of Errors::    What Emacs does when you report an error.
-* Handling Errors::         How you can trap errors and continue execution.
-* Error Symbols::           How errors are classified for trapping them.
-
-Variables
-
-* Global Variables::        Variable values that exist permanently, everywhere.
-* Constant Variables::      Certain "variables" have values that never change.
-* Local Variables::         Variable values that exist only temporarily.
-* Void Variables::          Symbols that lack values.
-* Defining Variables::      A definition says a symbol is used as a variable.
-* Tips for Defining::       Things you should think about when you
-                              define a variable.
-* Accessing Variables::     Examining values of variables whose names
-                              are known only at run time.
-* Setting Variables::       Storing new values in variables.
-* Variable Scoping::        How Lisp chooses among local and global values.
-* Buffer-Local Variables::  Variable values in effect only in one buffer.
-* File Local Variables::    Handling local variable lists in files.
-* Directory Local Variables:: Local variables common to all files in a
-                                directory.
-* Frame-Local Variables::   Frame-local bindings for variables.
-* Variable Aliases::        Variables that are aliases for other variables.
-* Variables with Restricted Values::  Non-constant variables whose value can
-                                        @emph{not} be an arbitrary Lisp object.
-
-Scoping Rules for Variable Bindings
-
-* Scope::                   Scope means where in the program a value
-                              is visible.  Comparison with other languages.
-* Extent::                  Extent means how long in time a value exists.
-* Impl of Scope::           Two ways to implement dynamic scoping.
-* Using Scoping::           How to use dynamic scoping carefully and
-                              avoid problems.
-
-Buffer-Local Variables
-
-* Intro to Buffer-Local::   Introduction and concepts.
-* Creating Buffer-Local::   Creating and destroying buffer-local bindings.
-* Default Value::           The default value is seen in buffers
-                              that don't have their own buffer-local values.
-
-Functions
-
-* What Is a Function::      Lisp functions vs. primitives; terminology.
-* Lambda Expressions::      How functions are expressed as Lisp objects.
-* Function Names::          A symbol can serve as the name of a function.
-* Defining Functions::      Lisp expressions for defining functions.
-* Calling Functions::       How to use an existing function.
-* Mapping Functions::       Applying a function to each element of a list, etc.
-* Anonymous Functions::     Lambda expressions are functions with no names.
-* Function Cells::          Accessing or setting the function definition
-                              of a symbol.
-* Closures::                Functions that enclose a lexical environment.
-* Obsolete Functions::      Declaring functions obsolete.
-* Inline Functions::        Defining functions that the compiler
-                              will expand inline.
-* Declaring Functions::     Telling the compiler that a function is defined.
-* Function Safety::         Determining whether a function is safe to call.
-* Related Topics::          Cross-references to specific Lisp primitives
-                              that have a special bearing on how
-                              functions work.
-
-Lambda Expressions
-
-* Lambda Components::       The parts of a lambda expression.
-* Simple Lambda::           A simple example.
-* Argument List::           Details and special features of argument lists.
-* Function Documentation::  How to put documentation in a function.
-
-Macros
-
-* Simple Macro::            A basic example.
-* Expansion::               How, when and why macros are expanded.
-* Compiling Macros::        How macros are expanded by the compiler.
-* Defining Macros::         How to write a macro definition.
-* Problems with Macros::    Don't evaluate the macro arguments too many times.
-                              Don't hide the user's variables.
-* Indenting Macros::        Specifying how to indent macro calls.
-
-Common Problems Using Macros
-
-* Wrong Time::             Do the work in the expansion, not in the macro.
-* Argument Evaluation::    The expansion should evaluate each macro arg once.
-* Surprising Local Vars::  Local variable bindings in the expansion
-                              require special care.
-* Eval During Expansion::  Don't evaluate them; put them in the expansion.
-* Repeated Expansion::     Avoid depending on how many times expansion is done.
-
-Customization Settings
-
-* Common Keywords::         Common keyword arguments for all kinds of
-                              customization declarations.
-* Group Definitions::       Writing customization group definitions.
-* Variable Definitions::    Declaring user options.
-* Customization Types::     Specifying the type of a user option.
-* Applying Customizations:: Functions to apply customization settings.
-* Custom Themes::           Writing Custom themes.
-
-Customization Types
-
-* Simple Types::            Simple customization types: sexp, integer, number,
-                              string, file, directory, alist.
-* Composite Types::         Build new types from other types or data.
-* Splicing into Lists::     Splice elements into list with @code{:inline}.
-* Type Keywords::           Keyword-argument pairs in a customization type.
-* Defining New Types::      Give your type a name.
-
-Loading
-
-* How Programs Do Loading:: The @code{load} function and others.
-* Load Suffixes::           Details about the suffixes that @code{load} tries.
-* Library Search::          Finding a library to load.
-* Loading Non-ASCII::       Non-@acronym{ASCII} characters in Emacs Lisp files.
-* Autoload::                Setting up a function to autoload.
-* Repeated Loading::        Precautions about loading a file twice.
-* Named Features::          Loading a library if it isn't already loaded.
-* Where Defined::           Finding which file defined a certain symbol.
-* Unloading::               How to "unload" a library that was loaded.
-* Hooks for Loading::       Providing code to be run when
-                              particular libraries are loaded.
-
-Byte Compilation
-
-* Speed of Byte-Code::      An example of speedup from byte compilation.
-* Compilation Functions::   Byte compilation functions.
-* Docs and Compilation::    Dynamic loading of documentation strings.
-* Dynamic Loading::         Dynamic loading of individual functions.
-* Eval During Compile::     Code to be evaluated when you compile.
-* Compiler Errors::         Handling compiler error messages.
-* Byte-Code Objects::       The data type used for byte-compiled functions.
-* Disassembly::             Disassembling byte-code; how to read byte-code.
-
-Advising Emacs Lisp Functions
-
-* Simple Advice::           A simple example to explain the basics of advice.
-* Defining Advice::         Detailed description of @code{defadvice}.
-* Around-Advice::           Wrapping advice around a function's definition.
-* Computed Advice::         ...is to @code{defadvice} as @code{fset} is to @code{defun}.
-* Activation of Advice::    Advice doesn't do anything until you activate it.
-* Enabling Advice::         You can enable or disable each piece of advice.
-* Preactivation::           Preactivation is a way of speeding up the
-                              loading of compiled advice.
-* Argument Access in Advice:: How advice can access the function's arguments.
-* Combined Definition::     How advice is implemented.
-
-Debugging Lisp Programs
-
-* Debugger::                A debugger for the Emacs Lisp evaluator.
-* Edebug::                  A source-level Emacs Lisp debugger.
-* Syntax Errors::           How to find syntax errors.
-* Test Coverage::           Ensuring you have tested all branches in your code.
-
-The Lisp Debugger
-
-* Error Debugging::         Entering the debugger when an error happens.
-* Infinite Loops::          Stopping and debugging a program that doesn't exit.
-* Function Debugging::      Entering it when a certain function is called.
-* Explicit Debug::          Entering it at a certain point in the program.
-* Using Debugger::          What the debugger does; what you see while in it.
-* Debugger Commands::       Commands used while in the debugger.
-* Invoking the Debugger::   How to call the function @code{debug}.
-* Internals of Debugger::   Subroutines of the debugger, and global variables.
-
-Edebug
-
-* Using Edebug::            Introduction to use of Edebug.
-* Instrumenting::           You must instrument your code
-                              in order to debug it with Edebug.
-* Edebug Execution Modes::  Execution modes, stopping more or less often.
-* Jumping::                 Commands to jump to a specified place.
-* Edebug Misc::             Miscellaneous commands.
-* Breaks::                  Setting breakpoints to make the program stop.
-* Trapping Errors::         Trapping errors with Edebug.
-* Edebug Views::            Views inside and outside of Edebug.
-* Edebug Eval::             Evaluating expressions within Edebug.
-* Eval List::               Expressions whose values are displayed
-                              each time you enter Edebug.
-* Printing in Edebug::      Customization of printing.
-* Trace Buffer::            How to produce trace output in a buffer.
-* Coverage Testing::        How to test evaluation coverage.
-* The Outside Context::     Data that Edebug saves and restores.
-* Edebug and Macros::       Specifying how to handle macro calls.
-* Edebug Options::          Option variables for customizing Edebug.
-
-Breaks
-
-* Breakpoints::             Breakpoints at stop points.
-* Global Break Condition::  Breaking on an event.
-* Source Breakpoints::      Embedding breakpoints in source code.
-
-The Outside Context
-
-* Checking Whether to Stop::When Edebug decides what to do.
-* Edebug Display Update::   When Edebug updates the display.
-* Edebug Recursive Edit::   When Edebug stops execution.
-
-Edebug and Macros
-
-* Instrumenting Macro Calls::The basic problem.
-* Specification List::      How to specify complex patterns of evaluation.
-* Backtracking::            What Edebug does when matching fails.
-* Specification Examples::  To help understand specifications.
-
-Debugging Invalid Lisp Syntax
-
-* Excess Open::             How to find a spurious open paren or missing close.
-* Excess Close::            How to find a spurious close paren or missing open.
-
-Reading and Printing Lisp Objects
-
-* Streams Intro::           Overview of streams, reading and printing.
-* Input Streams::           Various data types that can be used as
-                              input streams.
-* Input Functions::         Functions to read Lisp objects from text.
-* Output Streams::          Various data types that can be used as
-                              output streams.
-* Output Functions::        Functions to print Lisp objects as text.
-* Output Variables::        Variables that control what the printing
-                              functions do.
-
-Minibuffers
-
-* Intro to Minibuffers::    Basic information about minibuffers.
-* Text from Minibuffer::    How to read a straight text string.
-* Object from Minibuffer::  How to read a Lisp object or expression.
-* Minibuffer History::      Recording previous minibuffer inputs
-                              so the user can reuse them.
-* Initial Input::           Specifying initial contents for the minibuffer.
-* Completion::              How to invoke and customize completion.
-* Yes-or-No Queries::       Asking a question with a simple answer.
-* Multiple Queries::        Asking a series of similar questions.
-* Reading a Password::      Reading a password from the terminal.
-* Minibuffer Commands::     Commands used as key bindings in minibuffers.
-* Minibuffer Windows::      Operating on the special minibuffer windows.
-* Minibuffer Contents::     How such commands access the minibuffer text.
-* Recursive Mini::          Whether recursive entry to minibuffer is allowed.
-* Minibuffer Misc::         Various customization hooks and variables.
-
-Completion
-
-* Basic Completion::        Low-level functions for completing strings.
-                              (These are too low level to use the minibuffer.)
-* Minibuffer Completion::   Invoking the minibuffer with completion.
-* Completion Commands::     Minibuffer commands that do completion.
-* High-Level Completion::   Convenient special cases of completion
-                              (reading buffer names, variable names, etc.).
-* Reading File Names::      Using completion to read file names and
-                              shell commands.
-* Completion Variables::    Variables controlling completion behavior.
-* Programmed Completion::   Writing your own completion function.
-* Completion in Buffers::   Completing text in ordinary buffers.
-
-Command Loop
-
-* Command Overview::    How the command loop reads commands.
-* Defining Commands::   Specifying how a function should read arguments.
-* Interactive Call::    Calling a command, so that it will read arguments.
-* Distinguish Interactive::     Making a command distinguish interactive calls.
-* Command Loop Info::   Variables set by the command loop for you to examine.
-* Adjusting Point::     Adjustment of point after a command.
-* Input Events::        What input looks like when you read it.
-* Reading Input::       How to read input events from the keyboard or mouse.
-* Special Events::      Events processed immediately and individually.
-* Waiting::             Waiting for user input or elapsed time.
-* Quitting::            How @kbd{C-g} works.  How to catch or defer quitting.
-* Prefix Command Arguments::    How the commands to set prefix args work.
-* Recursive Editing::   Entering a recursive edit,
-                          and why you usually shouldn't.
-* Disabling Commands::  How the command loop handles disabled commands.
-* Command History::     How the command history is set up, and how accessed.
-* Keyboard Macros::     How keyboard macros are implemented.
-
-Defining Commands
-
-* Using Interactive::       General rules for @code{interactive}.
-* Interactive Codes::       The standard letter-codes for reading arguments
-                              in various ways.
-* Interactive Examples::    Examples of how to read interactive arguments.
-
-Input Events
-
-* Keyboard Events::         Ordinary characters--keys with symbols on them.
-* Function Keys::           Function keys--keys with names, not symbols.
-* Mouse Events::            Overview of mouse events.
-* Click Events::            Pushing and releasing a mouse button.
-* Drag Events::             Moving the mouse before releasing the button.
-* Button-Down Events::      A button was pushed and not yet released.
-* Repeat Events::           Double and triple click (or drag, or down).
-* Motion Events::           Just moving the mouse, not pushing a button.
-* Focus Events::            Moving the mouse between frames.
-* Misc Events::             Other events the system can generate.
-* Event Examples::          Examples of the lists for mouse events.
-* Classifying Events::      Finding the modifier keys in an event symbol.
-                              Event types.
-* Accessing Mouse::         Functions to extract info from mouse events.
-* Accessing Scroll::        Functions to get info from scroll bar events.
-* Strings of Events::       Special considerations for putting
-                              keyboard character events in a string.
-
-Reading Input
-
-* Key Sequence Input::      How to read one key sequence.
-* Reading One Event::       How to read just one event.
-* Event Mod::               How Emacs modifies events as they are read.
-* Invoking the Input Method::   How reading an event uses the input method.
-* Quoted Character Input::  Asking the user to specify a character.
-* Event Input Misc::        How to reread or throw away input events.
-
-Keymaps
-
-* Key Sequences::           Key sequences as Lisp objects.
-* Keymap Basics::           Basic concepts of keymaps.
-* Format of Keymaps::       What a keymap looks like as a Lisp object.
-* Creating Keymaps::        Functions to create and copy keymaps.
-* Inheritance and Keymaps:: How one keymap can inherit the bindings
-                              of another keymap.
-* Prefix Keys::             Defining a key with a keymap as its definition.
-* Active Keymaps::          How Emacs searches the active keymaps
-                              for a key binding.
-* Searching Keymaps::       A pseudo-Lisp summary of searching active maps.
-* Controlling Active Maps:: Each buffer has a local keymap
-                               to override the standard (global) bindings.
-                               A minor mode can also override them.
-* Key Lookup::              Finding a key's binding in one keymap.
-* Functions for Key Lookup::    How to request key lookup.
-* Changing Key Bindings::   Redefining a key in a keymap.
-* Remapping Commands::      A keymap can translate one command to another.
-* Translation Keymaps::     Keymaps for translating sequences of events.
-* Key Binding Commands::    Interactive interfaces for redefining keys.
-* Scanning Keymaps::        Looking through all keymaps, for printing help.
-* Menu Keymaps::            Defining a menu as a keymap.
-
-Menu Keymaps
-
-* Defining Menus::          How to make a keymap that defines a menu.
-* Mouse Menus::             How users actuate the menu with the mouse.
-* Keyboard Menus::          How users actuate the menu with the keyboard.
-* Menu Example::            Making a simple menu.
-* Menu Bar::                How to customize the menu bar.
-* Tool Bar::                A tool bar is a row of images.
-* Modifying Menus::         How to add new items to a menu.
-
-Defining Menus
-
-* Simple Menu Items::       A simple kind of menu key binding,
-                              limited in capabilities.
-* Extended Menu Items::     More powerful menu item definitions
-                              let you specify keywords to enable
-                              various features.
-* Menu Separators::         Drawing a horizontal line through a menu.
-* Alias Menu Items::        Using command aliases in menu items.
-* Toolkit Differences::     Not all toolkits provide the same features.
-
-Major and Minor Modes
-
-* Hooks::              How to use hooks; how to write code that provides hooks.
-* Major Modes::        Defining major modes.
-* Minor Modes::        Defining minor modes.
-* Mode Line Format::   Customizing the text that appears in the mode line.
-* Imenu::              Providing a menu of definitions made in a buffer.
-* Font Lock Mode::     How modes can highlight text according to syntax.
-* Auto-Indentation::   How to teach Emacs to indent for a major mode.
-* Desktop Save Mode::  How modes can have buffer state saved between
-                         Emacs sessions.
-
-Hooks
-
-* Running Hooks::      How to run a hook.
-* Setting Hooks::      How to put functions on a hook, or remove them.
-
-Major Modes
-
-* Major Mode Conventions::  Coding conventions for keymaps, etc.
-* Auto Major Mode::         How Emacs chooses the major mode automatically.
-* Mode Help::               Finding out how to use a mode.
-* Derived Modes::           Defining a new major mode based on another major
-                              mode.
-* Basic Major Modes::       Modes that other modes are often derived from.
-* Mode Hooks::              Hooks run at the end of major mode functions.
-* Tabulated List Mode::     Parent mode for buffers containing tabulated data.
-* Generic Modes::           Defining a simple major mode that supports
-                              comment syntax and Font Lock mode.
-* Example Major Modes::     Text mode and Lisp modes.
-
-Minor Modes
-
-* Minor Mode Conventions::  Tips for writing a minor mode.
-* Keymaps and Minor Modes:: How a minor mode can have its own keymap.
-* Defining Minor Modes::    A convenient facility for defining minor modes.
-
-Mode Line Format
-
-* Mode Line Basics::        Basic ideas of mode line control.
-* Mode Line Data::          The data structure that controls the mode line.
-* Mode Line Top::           The top level variable, mode-line-format.
-* Mode Line Variables::     Variables used in that data structure.
-* %-Constructs::            Putting information into a mode line.
-* Properties in Mode::      Using text properties in the mode line.
-* Header Lines::            Like a mode line, but at the top.
-* Emulating Mode Line::     Formatting text as the mode line would.
-
-Font Lock Mode
-
-* Font Lock Basics::        Overview of customizing Font Lock.
-* Search-based Fontification::  Fontification based on regexps.
-* Customizing Keywords::    Customizing search-based fontification.
-* Other Font Lock Variables::   Additional customization facilities.
-* Levels of Font Lock::     Each mode can define alternative levels
-                              so that the user can select more or less.
-* Precalculated Fontification:: How Lisp programs that produce the buffer
-                                  contents can also specify how to fontify it.
-* Faces for Font Lock::     Special faces specifically for Font Lock.
-* Syntactic Font Lock::     Fontification based on syntax tables.
-* Multiline Font Lock::     How to coerce Font Lock into properly
-                              highlighting multiline constructs.
-
-Multiline Font Lock Constructs
-
-* Font Lock Multiline::     Marking multiline chunks with a text property.
-* Region to Refontify::     Controlling which region gets refontified
-                              after a buffer change.
-
-Automatic Indentation of code
-
-* SMIE::                    A simple minded indentation engine.
-
-Simple Minded Indentation Engine
-
-* SMIE setup::              SMIE setup and features.
-* Operator Precedence Grammars:: A very simple parsing technique.
-* SMIE Grammar::            Defining the grammar of a language.
-* SMIE Lexer::              Defining tokens.
-* SMIE Tricks::             Working around the parser's limitations.
-* SMIE Indentation::        Specifying indentation rules.
-* SMIE Indentation Helpers:: Helper functions for indentation rules.
-* SMIE Indentation Example::  Sample indentation rules.
-
-Documentation
-
-* Documentation Basics::    Where doc strings are defined and stored.
-* Accessing Documentation:: How Lisp programs can access doc strings.
-* Keys in Documentation::   Substituting current key bindings.
-* Describing Characters::   Making printable descriptions of
-                              non-printing characters and key sequences.
-* Help Functions::          Subroutines used by Emacs help facilities.
-
-Files
-
-* Visiting Files::          Reading files into Emacs buffers for editing.
-* Saving Buffers::          Writing changed buffers back into files.
-* Reading from Files::      Reading files into buffers without visiting.
-* Writing to Files::        Writing new files from parts of buffers.
-* File Locks::              Locking and unlocking files, to prevent
-                              simultaneous editing by two people.
-* Information about Files:: Testing existence, accessibility, size of files.
-* Changing Files::          Renaming files, changing permissions, etc.
-* File Names::              Decomposing and expanding file names.
-* Contents of Directories:: Getting a list of the files in a directory.
-* Create/Delete Dirs::      Creating and Deleting Directories.
-* Magic File Names::        Special handling for certain file names.
-* Format Conversion::       Conversion to and from various file formats.
-
-Visiting Files
-
-* Visiting Functions::      The usual interface functions for visiting.
-* Subroutines of Visiting:: Lower-level subroutines that they use.
-
-Information about Files
-
-* Testing Accessibility::   Is a given file readable?  Writable?
-* Kinds of Files::          Is it a directory?  A symbolic link?
-* Truenames::               Eliminating symbolic links from a file name.
-* File Attributes::         How large is it?  Any other names?  Etc.
-* Locating Files::          How to find a file in standard places.
-
-File Names
-
-* File Name Components::    The directory part of a file name, and the rest.
-* Relative File Names::     Some file names are relative to a current directory.
-* Directory Names::         A directory's name as a directory
-                              is different from its name as a file.
-* File Name Expansion::     Converting relative file names to absolute ones.
-* Unique File Names::       Generating names for temporary files.
-* File Name Completion::    Finding the completions for a given file name.
-* Standard File Names::     If your package uses a fixed file name,
-                              how to handle various operating systems simply.
-
-File Format Conversion
-
-* Format Conversion Overview::   @code{insert-file-contents} and @code{write-region}.
-* Format Conversion Round-Trip:: Using @code{format-alist}.
-* Format Conversion Piecemeal::  Specifying non-paired conversion.
-
-Backups and Auto-Saving
-
-* Backup Files::            How backup files are made; how their names
-                              are chosen.
-* Auto-Saving::             How auto-save files are made; how their
-                              names are chosen.
-* Reverting::               @code{revert-buffer}, and how to customize
-                              what it does.
-
-Backup Files
-
-* Making Backups::          How Emacs makes backup files, and when.
-* Rename or Copy::          Two alternatives: renaming the old file
-                              or copying it.
-* Numbered Backups::        Keeping multiple backups for each source file.
-* Backup Names::            How backup file names are computed; customization.
-
-Buffers
-
-* Buffer Basics::           What is a buffer?
-* Current Buffer::          Designating a buffer as current
-                              so that primitives will access its contents.
-* Buffer Names::            Accessing and changing buffer names.
-* Buffer File Name::        The buffer file name indicates which file
-                              is visited.
-* Buffer Modification::     A buffer is @dfn{modified} if it needs to be saved.
-* Modification Time::       Determining whether the visited file was changed
-                              "behind Emacs's back".
-* Read Only Buffers::       Modifying text is not allowed in a
-                              read-only buffer.
-* The Buffer List::         How to look at all the existing buffers.
-* Creating Buffers::        Functions that create buffers.
-* Killing Buffers::         Buffers exist until explicitly killed.
-* Indirect Buffers::        An indirect buffer shares text with some
-                              other buffer.
-* Swapping Text::           Swapping text between two buffers.
-* Buffer Gap::              The gap in the buffer.
-
-Windows
-
-* Basic Windows::           Basic information on using windows.
-* Splitting Windows::       Splitting one window into two windows.
-* Deleting Windows::        Deleting a window gives its space to other windows.
-* Selecting Windows::       The selected window is the one that you edit in.
-* Cyclic Window Ordering::  Moving around the existing windows.
-* Buffers and Windows::     Each window displays the contents of a buffer.
-* Switching Buffers::       Higher-level functions for switching to a buffer.
-* Choosing Window::         How to choose a window for displaying a buffer.
-* Display Action Functions:: Subroutines for @code{display-buffer}.
-* Choosing Window Options:: Extra options affecting how buffers are displayed.
-* Window History::          Each window remembers the buffers displayed in it.
-* Dedicated Windows::       How to avoid displaying another buffer in
-                              a specific window.
-* Window Point::            Each window has its own location of point.
-* Window Start and End::    Buffer positions indicating which text is
-                              on-screen in a window.
-* Textual Scrolling::       Moving text up and down through the window.
-* Vertical Scrolling::      Moving the contents up and down on the window.
-* Horizontal Scrolling::    Moving the contents sideways on the window.
-* Size of Window::          Accessing the size of a window.
-* Resizing Windows::        Changing the size of a window.
-* Coordinates and Windows:: Converting coordinates to windows.
-* Window Tree::             The layout and sizes of all windows in a frame.
-* Window Configurations::   Saving and restoring the state of the screen.
-* Window Parameters::       Associating additional information with windows.
-* Window Hooks::            Hooks for scrolling, window size changes,
-                              redisplay going past a certain point,
-                              or window configuration changes.
-
-Frames
-
-* Creating Frames::         Creating additional frames.
-* Multiple Terminals::      Displaying on several different devices.
-* Frame Parameters::        Controlling frame size, position, font, etc.
-* Terminal Parameters::     Parameters common for all frames on terminal.
-* Frame Titles::            Automatic updating of frame titles.
-* Deleting Frames::         Frames last until explicitly deleted.
-* Finding All Frames::      How to examine all existing frames.
-* Frames and Windows::      A frame contains windows;
-                              display of text always works through windows.
-* Minibuffers and Frames::  How a frame finds the minibuffer to use.
-* Input Focus::             Specifying the selected frame.
-* Visibility of Frames::    Frames may be visible or invisible, or icons.
-* Raising and Lowering::    Raising a frame makes it hide other windows;
-                              lowering it makes the others hide it.
-* Frame Configurations::    Saving the state of all frames.
-* Mouse Tracking::          Getting events that say when the mouse moves.
-* Mouse Position::          Asking where the mouse is, or moving it.
-* Pop-Up Menus::            Displaying a menu for the user to select from.
-* Dialog Boxes::            Displaying a box to ask yes or no.
-* Pointer Shape::           Specifying the shape of the mouse pointer.
-* Window System Selections::Transferring text to and from other X clients.
-* Drag and Drop::               Internals of Drag-and-Drop implementation.
-* Color Names::             Getting the definitions of color names.
-* Text Terminal Colors::    Defining colors for text terminals.
-* Resources::               Getting resource values from the server.
-* Display Feature Testing:: Determining the features of a terminal.
-
-Frame Parameters
-
-* Parameter Access::        How to change a frame's parameters.
-* Initial Parameters::      Specifying frame parameters when you make a frame.
-* Window Frame Parameters:: List of frame parameters for window systems.
-* Size and Position::       Changing the size and position of a frame.
-* Geometry::                Parsing geometry specifications.
-
-Window Frame Parameters
-
-* Basic Parameters::        Parameters that are fundamental.
-* Position Parameters::     The position of the frame on the screen.
-* Size Parameters::         Frame's size.
-* Layout Parameters::       Size of parts of the frame, and
-                              enabling or disabling some parts.
-* Buffer Parameters::       Which buffers have been or should be shown.
-* Management Parameters::   Communicating with the window manager.
-* Cursor Parameters::       Controlling the cursor appearance.
-* Font and Color Parameters:: Fonts and colors for the frame text.
-
-Positions
-
-* Point::                   The special position where editing takes place.
-* Motion::                  Changing point.
-* Excursions::              Temporary motion and buffer changes.
-* Narrowing::               Restricting editing to a portion of the buffer.
-
-Motion
-
-* Character Motion::        Moving in terms of characters.
-* Word Motion::             Moving in terms of words.
-* Buffer End Motion::       Moving to the beginning or end of the buffer.
-* Text Lines::              Moving in terms of lines of text.
-* Screen Lines::            Moving in terms of lines as displayed.
-* List Motion::             Moving by parsing lists and sexps.
-* Skipping Characters::     Skipping characters belonging to a certain set.
-
-Markers
-
-* Overview of Markers::     The components of a marker, and how it relocates.
-* Predicates on Markers::   Testing whether an object is a marker.
-* Creating Markers::        Making empty markers or markers at certain places.
-* Information from Markers::Finding the marker's buffer or character position.
-* Marker Insertion Types::  Two ways a marker can relocate when you
-                              insert where it points.
-* Moving Markers::          Moving the marker to a new buffer or position.
-* The Mark::                How "the mark" is implemented with a marker.
-* The Region::              How to access "the region".
-
-Text
-
-* Near Point::              Examining text in the vicinity of point.
-* Buffer Contents::         Examining text in a general fashion.
-* Comparing Text::          Comparing substrings of buffers.
-* Insertion::               Adding new text to a buffer.
-* Commands for Insertion::  User-level commands to insert text.
-* Deletion::                Removing text from a buffer.
-* User-Level Deletion::     User-level commands to delete text.
-* The Kill Ring::           Where removed text sometimes is saved for
-                              later use.
-* Undo::                    Undoing changes to the text of a buffer.
-* Maintaining Undo::        How to enable and disable undo information.
-                              How to control how much information is kept.
-* Filling::                 Functions for explicit filling.
-* Margins::                 How to specify margins for filling commands.
-* Adaptive Fill::           Adaptive Fill mode chooses a fill prefix
-                              from context.
-* Auto Filling::            How auto-fill mode is implemented to break lines.
-* Sorting::                 Functions for sorting parts of the buffer.
-* Columns::                 Computing horizontal positions, and using them.
-* Indentation::             Functions to insert or adjust indentation.
-* Case Changes::            Case conversion of parts of the buffer.
-* Text Properties::         Assigning Lisp property lists to text characters.
-* Substitution::            Replacing a given character wherever it appears.
-* Transposition::           Swapping two portions of a buffer.
-* Registers::               How registers are implemented.  Accessing
-                              the text or position stored in a register.
-* Base 64::                 Conversion to or from base 64 encoding.
-* Checksum/Hash::           Computing cryptographic hashes.
-* Parsing HTML/XML::        Parsing HTML and XML.
-* Atomic Changes::          Installing several buffer changes "atomically".
-* Change Hooks::            Supplying functions to be run when text is changed.
-
-The Kill Ring
-
-* Kill Ring Concepts::      What text looks like in the kill ring.
-* Kill Functions::          Functions that kill text.
-* Yanking::                 How yanking is done.
-* Yank Commands::           Commands that access the kill ring.
-* Low-Level Kill Ring::     Functions and variables for kill ring access.
-* Internals of Kill Ring::  Variables that hold kill ring data.
-
-Indentation
-
-* Primitive Indent::        Functions used to count and insert indentation.
-* Mode-Specific Indent::    Customize indentation for different modes.
-* Region Indent::           Indent all the lines in a region.
-* Relative Indent::         Indent the current line based on previous lines.
-* Indent Tabs::             Adjustable, typewriter-like tab stops.
-* Motion by Indent::        Move to first non-blank character.
-
-Text Properties
-
-* Examining Properties::    Looking at the properties of one character.
-* Changing Properties::     Setting the properties of a range of text.
-* Property Search::         Searching for where a property changes value.
-* Special Properties::      Particular properties with special meanings.
-* Format Properties::       Properties for representing formatting of text.
-* Sticky Properties::       How inserted text gets properties from
-                              neighboring text.
-* Lazy Properties::         Computing text properties in a lazy fashion
-                              only when text is examined.
-* Clickable Text::          Using text properties to make regions of text
-                              do something when you click on them.
-* Fields::                  The @code{field} property defines
-                              fields within the buffer.
-* Not Intervals::           Why text properties do not use
-                              Lisp-visible text intervals.
-
-Non-@acronym{ASCII} Characters
-
-* Text Representations::    How Emacs represents text.
-* Converting Representations::  Converting unibyte to multibyte and vice versa.
-* Selecting a Representation::  Treating a byte sequence as unibyte or multi.
-* Character Codes::         How unibyte and multibyte relate to
-                                codes of individual characters.
-* Character Properties::    Character attributes that define their
-                                behavior and handling.
-* Character Sets::          The space of possible character codes
-                                is divided into various character sets.
-* Scanning Charsets::       Which character sets are used in a buffer?
-* Translation of Characters::   Translation tables are used for conversion.
-* Coding Systems::          Coding systems are conversions for saving files.
-* Input Methods::           Input methods allow users to enter various
-                                non-ASCII characters without special keyboards.
-* Locales::                 Interacting with the POSIX locale.
-
-Coding Systems
-
-* Coding System Basics::    Basic concepts.
-* Encoding and I/O::        How file I/O functions handle coding systems.
-* Lisp and Coding Systems:: Functions to operate on coding system names.
-* User-Chosen Coding Systems::  Asking the user to choose a coding system.
-* Default Coding Systems::  Controlling the default choices.
-* Specifying Coding Systems::   Requesting a particular coding system
-                                    for a single file operation.
-* Explicit Encoding::       Encoding or decoding text without doing I/O.
-* Terminal I/O Encoding::   Use of encoding for terminal I/O.
-* MS-DOS File Types::       How DOS "text" and "binary" files
-                                relate to coding systems.
-
-Searching and Matching
-
-* String Search::           Search for an exact match.
-* Searching and Case::      Case-independent or case-significant searching.
-* Regular Expressions::     Describing classes of strings.
-* Regexp Search::           Searching for a match for a regexp.
-* POSIX Regexps::           Searching POSIX-style for the longest match.
-* Match Data::              Finding out which part of the text matched,
-                              after a string or regexp search.
-* Search and Replace::      Commands that loop, searching and replacing.
-* Standard Regexps::        Useful regexps for finding sentences, pages,...
-
-Regular Expressions
-
-* Syntax of Regexps::       Rules for writing regular expressions.
-* Regexp Example::          Illustrates regular expression syntax.
-* Regexp Functions::        Functions for operating on regular expressions.
-
-Syntax of Regular Expressions
-
-* Regexp Special::          Special characters in regular expressions.
-* Char Classes::            Character classes used in regular expressions.
-* Regexp Backslash::        Backslash-sequences in regular expressions.
-
-The Match Data
-
-* Replacing Match::         Replacing a substring that was matched.
-* Simple Match Data::       Accessing single items of match data,
-                              such as where a particular subexpression started.
-* Entire Match Data::       Accessing the entire match data at once, as a list.
-* Saving Match Data::       Saving and restoring the match data.
-
-Syntax Tables
-
-* Syntax Basics::           Basic concepts of syntax tables.
-* Syntax Descriptors::      How characters are classified.
-* Syntax Table Functions::  How to create, examine and alter syntax tables.
-* Syntax Properties::       Overriding syntax with text properties.
-* Motion and Syntax::       Moving over characters with certain syntaxes.
-* Parsing Expressions::     Parsing balanced expressions
-                              using the syntax table.
-* Standard Syntax Tables::  Syntax tables used by various major modes.
-* Syntax Table Internals::  How syntax table information is stored.
-* Categories::              Another way of classifying character syntax.
-
-Syntax Descriptors
-
-* Syntax Class Table::      Table of syntax classes.
-* Syntax Flags::            Additional flags each character can have.
-
-Parsing Expressions
-
-* Motion via Parsing::      Motion functions that work by parsing.
-* Position Parse::          Determining the syntactic state of a position.
-* Parser State::            How Emacs represents a syntactic state.
-* Low-Level Parsing::       Parsing across a specified region.
-* Control Parsing::         Parameters that affect parsing.
-
-Abbrevs and Abbrev Expansion
-
-* Abbrev Tables::           Creating and working with abbrev tables.
-* Defining Abbrevs::        Specifying abbreviations and their expansions.
-* Abbrev Files::            Saving abbrevs in files.
-* Abbrev Expansion::        Controlling expansion; expansion subroutines.
-* Standard Abbrev Tables::  Abbrev tables used by various major modes.
-* Abbrev Properties::       How to read and set abbrev properties.
-                            Which properties have which effect.
-* Abbrev Table Properties:: How to read and set abbrev table properties.
-                            Which properties have which effect.
-
-Processes
-
-* Subprocess Creation::     Functions that start subprocesses.
-* Shell Arguments::         Quoting an argument to pass it to a shell.
-* Synchronous Processes::   Details of using synchronous subprocesses.
-* Asynchronous Processes::  Starting up an asynchronous subprocess.
-* Deleting Processes::      Eliminating an asynchronous subprocess.
-* Process Information::     Accessing run-status and other attributes.
-* Input to Processes::      Sending input to an asynchronous subprocess.
-* Signals to Processes::    Stopping, continuing or interrupting
-                              an asynchronous subprocess.
-* Output from Processes::   Collecting output from an asynchronous subprocess.
-* Sentinels::               Sentinels run when process run-status changes.
-* Query Before Exit::       Whether to query if exiting will kill a process.
-* System Processes::        Accessing other processes running on your system.
-* Transaction Queues::      Transaction-based communication with subprocesses.
-* Network::                 Opening network connections.
-* Network Servers::         Network servers let Emacs accept net connections.
-* Datagrams::               UDP network connections.
-* Low-Level Network::       Lower-level but more general function
-                              to create connections and servers.
-* Misc Network::            Additional relevant functions for
-                              network connections.
-* Serial Ports::            Communicating with serial ports.
-* Byte Packing::            Using bindat to pack and unpack binary data.
-
-Receiving Output from Processes
-
-* Process Buffers::         If no filter, output is put in a buffer.
-* Filter Functions::        Filter functions accept output from the process.
-* Decoding Output::         Filters can get unibyte or multibyte strings.
-* Accepting Output::        How to wait until process output arrives.
-
-Low-Level Network Access
-
-* Network Processes::       Using @code{make-network-process}.
-* Network Options::         Further control over network connections.
-* Network Feature Testing:: Determining which network features work on
-                              the machine you are using.
-
-Packing and Unpacking Byte Arrays
-
-* Bindat Spec::             Describing data layout.
-* Bindat Functions::        Doing the unpacking and packing.
-* Bindat Examples::         Samples of what bindat.el can do for you!
-
-Emacs Display
-
-* Refresh Screen::          Clearing the screen and redrawing everything on it.
-* Forcing Redisplay::       Forcing redisplay.
-* Truncation::              Folding or wrapping long text lines.
-* The Echo Area::           Displaying messages at the bottom of the screen.
-* Warnings::                Displaying warning messages for the user.
-* Invisible Text::          Hiding part of the buffer text.
-* Selective Display::       Hiding part of the buffer text (the old way).
-* Temporary Displays::      Displays that go away automatically.
-* Overlays::                Use overlays to highlight parts of the buffer.
-* Width::                   How wide a character or string is on the screen.
-* Line Height::             Controlling the height of lines.
-* Faces::                   A face defines a graphics style
-                              for text characters: font, colors, etc.
-* Fringes::                 Controlling window fringes.
-* Scroll Bars::             Controlling vertical scroll bars.
-* Display Property::        Enabling special display features.
-* Images::                  Displaying images in Emacs buffers.
-* Buttons::                 Adding clickable buttons to Emacs buffers.
-* Abstract Display::        Emacs's Widget for Object Collections.
-* Blinking::                How Emacs shows the matching open parenthesis.
-* Character Display::       How Emacs displays individual characters.
-* Beeping::                 Audible signal to the user.
-* Window Systems::          Which window system is being used.
-* Bidirectional Display::   Display of bidirectional scripts, such as
-                              Arabic and Farsi.
-
-The Echo Area
-
-* Displaying Messages::     Explicitly displaying text in the echo area.
-* Progress::                Informing user about progress of a long operation.
-* Logging Messages::        Echo area messages are logged for the user.
-* Echo Area Customization:: Controlling the echo area.
-
-Reporting Warnings
-
-* Warning Basics::          Warnings concepts and functions to report them.
-* Warning Variables::       Variables programs bind to customize
-                              their warnings.
-* Warning Options::         Variables users set to control display of warnings.
-* Delayed Warnings::        Deferring a warning until the end of a command.
-
-Overlays
-
-* Managing Overlays::       Creating and moving overlays.
-* Overlay Properties::      How to read and set properties.
-                            What properties do to the screen display.
-* Finding Overlays::        Searching for overlays.
-
-Faces
-
-* Defining Faces::          How to define a face.
-* Face Attributes::         What is in a face?
-* Attribute Functions::     Functions to examine and set face attributes.
-* Displaying Faces::        How Emacs combines the faces specified for
-                              a character.
-* Face Remapping::         Remapping faces to alternative definitions.
-* Face Functions::          How to define and examine faces.
-* Auto Faces::              Hook for automatic face assignment.
-* Basic Faces::             Faces that are defined by default.
-* Font Selection::          Finding the best available font for a face.
-* Font Lookup::             Looking up the names of available fonts
-                              and information about them.
-* Fontsets::                A fontset is a collection of fonts
-                              that handle a range of character sets.
-* Low-Level Font::          Lisp representation for character display fonts.
-
-Fringes
-
-* Fringe Size/Pos::         Specifying where to put the window fringes.
-* Fringe Indicators::       Displaying indicator icons in the window fringes.
-* Fringe Cursors::          Displaying cursors in the right fringe.
-* Fringe Bitmaps::          Specifying bitmaps for fringe indicators.
-* Customizing Bitmaps::     Specifying your own bitmaps to use in the fringes.
-* Overlay Arrow::           Display of an arrow to indicate position.
-
-The @code{display} Property
-
-* Replacing Specs::         Display specs that replace the text.
-* Specified Space::         Displaying one space with a specified width.
-* Pixel Specification::     Specifying space width or height in pixels.
-* Other Display Specs::     Displaying an image; adjusting the height,
-                              spacing, and other properties of text.
-* Display Margins::         Displaying text or images to the side of
-                              the main text.
-
-Images
-
-* Image Formats::           Supported image formats.
-* Image Descriptors::       How to specify an image for use in @code{:display}.
-* XBM Images::              Special features for XBM format.
-* XPM Images::              Special features for XPM format.
-* GIF Images::              Special features for GIF format.
-* TIFF Images::             Special features for TIFF format.
-* PostScript Images::       Special features for PostScript format.
-* ImageMagick Images::      Special features available through ImageMagick.
-* Other Image Types::       Various other formats are supported.
-* Defining Images::         Convenient ways to define an image for later use.
-* Showing Images::          Convenient ways to display an image once
-                              it is defined.
-* Animated Images::         Some image formats can be animated.
-* Image Cache::             Internal mechanisms of image display.
-
-Buttons
-
-* Button Properties::       Button properties with special meanings.
-* Button Types::            Defining common properties for classes of buttons.
-* Making Buttons::          Adding buttons to Emacs buffers.
-* Manipulating Buttons::    Getting and setting properties of buttons.
-* Button Buffer Commands::  Buffer-wide commands and bindings for buttons.
-
-Abstract Display
-
-* Abstract Display Functions::  Functions in the Ewoc package.
-* Abstract Display Example::    Example of using Ewoc.
-
-Character Display
-
-* Usual Display::       The usual conventions for displaying characters.
-* Display Tables::      What a display table consists of.
-* Active Display Table::  How Emacs selects a display table to use.
-* Glyphs::              How to define a glyph, and what glyphs mean.
-* Glyphless Chars::     How glyphless characters are drawn.
-
-Operating System Interface
-
-* Starting Up::             Customizing Emacs startup processing.
-* Getting Out::             How exiting works (permanent or temporary).
-* System Environment::      Distinguish the name and kind of system.
-* User Identification::     Finding the name and user id of the user.
-* Time of Day::             Getting the current time.
-* Time Conversion::         Converting a time from numeric form to
-                              calendrical data and vice versa.
-* Time Parsing::            Converting a time from numeric form to text
-                              and vice versa.
-* Processor Run Time::      Getting the run time used by Emacs.
-* Time Calculations::       Adding, subtracting, comparing times, etc.
-* Timers::                  Setting a timer to call a function at a
-                              certain time.
-* Idle Timers::             Setting a timer to call a function when Emacs has
-                              been idle for a certain length of time.
-* Terminal Input::          Accessing and recording terminal input.
-* Terminal Output::         Controlling and recording terminal output.
-* Sound Output::            Playing sounds on the computer's speaker.
-* X11 Keysyms::             Operating on key symbols for X Windows.
-* Batch Mode::              Running Emacs without terminal interaction.
-* Session Management::      Saving and restoring state with
-                              X Session Management.
-* Notifications::           Desktop notifications.
-* Dynamic Libraries::       On-demand loading of support libraries.
-
-Starting Up Emacs
-
-* Startup Summary::         Sequence of actions Emacs performs at startup.
-* Init File::               Details on reading the init file.
-* Terminal-Specific::       How the terminal-specific Lisp file is read.
-* Command-Line Arguments::  How command-line arguments are processed,
-                              and how you can customize them.
-
-Getting Out of Emacs
-
-* Killing Emacs::           Exiting Emacs irreversibly.
-* Suspending Emacs::        Exiting Emacs reversibly.
-
-Terminal Input
-
-* Input Modes::             Options for how input is processed.
-* Recording Input::         Saving histories of recent or all input events.
-
-Preparing Lisp code for distribution
-
-* Packaging Basics::        The basic concepts of Emacs Lisp packages.
-* Simple Packages::         How to package a single .el file.
-* Multi-file Packages::     How to package multiple files.
-
-Tips and Conventions
-
-* Coding Conventions::      Conventions for clean and robust programs.
-* Key Binding Conventions:: Which keys should be bound by which programs.
-* Programming Tips::        Making Emacs code fit smoothly in Emacs.
-* Compilation Tips::        Making compiled code run fast.
-* Warning Tips::            Turning off compiler warnings.
-* Documentation Tips::      Writing readable documentation strings.
-* Comment Tips::            Conventions for writing comments.
-* Library Headers::         Standard headers for library packages.
-
-GNU Emacs Internals
-
-* Building Emacs::          How the dumped Emacs is made.
-* Pure Storage::            Kludge to make preloaded Lisp functions shareable.
-* Garbage Collection::      Reclaiming space for Lisp objects no longer used.
-* Memory Usage::            Info about total size of Lisp objects made so far.
-* Writing Emacs Primitives::  Writing C code for Emacs.
-* Object Internals::        Data formats of buffers, windows, processes.
-
-Object Internals
-
-* Buffer Internals::        Components of a buffer structure.
-* Window Internals::        Components of a window structure.
-* Process Internals::       Components of a process structure.
-@end detailmenu
-@end menu
-
-@c include intro.texi
-@c include objects.texi
-@c include numbers.texi
-@c include strings.texi
-
-@c include lists.texi
-@c include sequences.texi
-@c include hash.texi
-@c include symbols.texi
-@c include eval.texi
-
-@c include control.texi
-@c include variables.texi
-@c include functions.texi
-@c include macros.texi
-
-@c include customize.texi
-@c include loading.texi
-@c include compile.texi
-@c include advice.texi
-
-@c This includes edebug.texi.
-@c include debugging.texi
-@c include streams.texi
-@c include minibuf.texi
-@c include commands.texi
-
-@c include keymaps.texi
-@c include modes.texi
-@c include help.texi
-@c include files.texi
-
-@c include backups.texi
-
-@c ================ Beginning of Volume 2 ================
-@include buffers.texi
-@include windows.texi
-@include frames.texi
-
-@include positions.texi
-@include markers.texi
-@include text.texi
-@include nonascii.texi
-
-@include searching.texi
-@include syntax.texi
-@include abbrevs.texi
-@include processes.texi
-
-@include display.texi
-@include os.texi
-@include package.texi
-
-@c appendices
-
-@include anti.texi
-@include doclicense.texi
-@include gpl.texi
-@include tips.texi
-@include internals.texi
-@include errors.texi
-@include maps.texi
-@include hooks.texi
-
-@include index.texi
-
-@ignore
-@node New Symbols, , Index, Top
-@unnumbered New Symbols Since the Previous Edition
-
-@printindex tp
-@end ignore
-
-@bye
-
-\f
-These words prevent "local variables" above from confusing Emacs.
index 1fdc987ea35cf895eed142d46a44a2a74b453fd3..c7c466c7d3615436b93173f868155e200f9b11ea 100644 (file)
@@ -3,8 +3,7 @@
 @c Copyright (C) 1990-1995, 1998-1999, 2001-2012
 @c   Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
-@setfilename ../../info/windows
-@node Windows, Frames, Buffers, Top
+@node Windows
 @chapter Windows
 
 This chapter describes the functions and variables related to Emacs
index 8355e6742126fd6a84070e90882d7a694c88a4e5..cc54cd254b58583938ebb35499a027c468547bf3 100644 (file)
@@ -1,6 +1,10 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-03  Glenn Morris  <rgm@gnu.org>
 
-       * Version 24.1 released.
+       * rcs-checkin.1: Remove.
+
+2012-04-07  Glenn Morris  <rgm@gnu.org>
+
+       * emacs.1: Bump version to 24.1.50.
 
 2011-11-16  Juanma Barranquero  <lekktu@gmail.com>
 
 
 ;; Local Variables:
 ;; coding: utf-8
-;; fill-column: 79
-;; add-log-time-zone-rule: t
 ;; End:
 
-    Copyright (C) 2007-2012  Free Software Foundation, Inc.
+  Copyright (C) 2007-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index 6dd8c55b013235856e97e5e1d66ad6f0362d6856..ff67324568065c3004c101138e80b211e0663d0c 100644 (file)
@@ -1,5 +1,5 @@
 .\" See section COPYING for copyright and redistribution information.
-.TH EMACS 1 "2007 April 13" "GNU Emacs 24.1"
+.TH EMACS 1 "2007 April 13" "GNU Emacs 24.1.50"
 .
 .
 .SH NAME
diff --git a/doc/man/rcs-checkin.1 b/doc/man/rcs-checkin.1
deleted file mode 100644 (file)
index a17c28a..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-.\" See section COPYING for copyright and redistribution information.
-.TH rcs-checkin 1
-.SH NAME
-rcs-checkin \- check files into RCS
-.SH SYNOPSIS
-.B rcs-checkin
-.RI [ FILE .\|.\|.]
-.SH DESCRIPTION
-.B rcs-checkin
-is a helper script for checking files into RCS.  This program is
-distributed with
-.BR "GNU Emacs" .
-
-This program converts files with an old
-.BR Emacs -style
-version history for use with the
-.B "Emacs 19"
-version control interface
-.BR VC ,
-which likes to use RCS as its back end.
-
-For each file to be processed, the script looks for
-.B Emacs
-version files related to it. These files are checked in as deltas,
-oldest first, so that the contents of the file itself becomes the
-latest revision in the master.
-
-The first line of each file is used as its description.  The file
-itself is not deleted, as under
-.B VC
-with
-.B vc-keep-workfiles
-at its default of
-.BR t ,
-but all the version files are.
-
-If an argument file is already version-controlled under RCS, any
-version files are added to the list of deltas and deleted, and then
-the workfile is checked in again as the latest version.  This is
-probably not quite what was wanted, and is the main reason VC doesn't
-simply call this to do checkins.
-
-In order to make it easier to use
-.BR "rcs-checkin *" ,
-files which are detectably either RCS masters (with names ending in
-.BR ,v )
-or Emacs version files (with names containing
-.BR ~ )
-are ignored.
-.
-.PP
-.SH OPTIONS
-The program accepts no options.
-.
-.SH SEE ALSO
-The Emacs version control interface is documented in the GNU Emacs manual,
-which  you  can  read  using
-.BR Info ,
-either from Emacs or as a standalone program.
-.
-.SH AUTHORS
-.I rcs-checkin
-was originally written by Paul Eggert.  It was revised for use with
-.B "GNU Emacs"
-.B VC
-by Eric S. Raymond.
-.
-.SH COPYING
-Copyright
-.if t \(co
-.if n (C)
-2008-2012 Free Software Foundation, Inc.
-.PP
-Permission is granted to make and distribute verbatim copies of this
-document provided the copyright notice and this permission notice are
-preserved on all copies.
-.PP
-Permission is granted to copy and distribute modified versions of
-this document under the conditions for verbatim copying, provided that
-the entire resulting derived work is distributed under the terms of
-a permission notice identical to this one.
-.PP
-Permission is granted to copy and distribute translations of this
-document into another language, under the above conditions for
-modified versions, except that this permission notice may be stated
-in a translation approved by the Free Software Foundation.
-.
index 389e937932bb7d47d918762b5bd97208de8acafa..87a8fcb0e8bb2298206ea1b7c04467c63d129901 100644 (file)
-2012-06-19  Glenn Morris  <rgm@gnu.org>
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Rename configure.in to configure.ac (Bug#11603).
+       * ede.texi (Compiler and Linker objects, ede-proj-project)
+       (ede-step-project): Prefer the name configure.ac to configure.in.
+
+2012-07-06  Michael Albinus  <michael.albinus@gmx.de>
+
+       * tramp.texi (Multi-hops): Introduce
+       `tramp-restricted-shell-hosts-alist'.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (POP before SMTP): POP-before-SMTP works with all sending
+       methods, so don't mention smtpmail here.
+
+2012-06-26  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * gnus.texi (Picons): Document gnus-picon-properties.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi: Remove mention of compilation, as that's no longer
+       supported.
+
+2012-06-26  Christopher Schmidt  <christopher@ch.ristopher.com>
+
+       * gnus.texi (Archived Messages): Mention
+       gnus-gcc-pre-body-encode-hook and gnus-gcc-post-body-encode-hook.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (Various Summary Stuff):
+       Remove mention of `gnus-propagate-marks'.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi: Remove mentions of nnml/nnfolder/nntp backend marks,
+       which no longer exist.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus.texi (Archived Messages):
+       Document gnus-gcc-self-resent-messages.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * message.texi (Mail Variables):
+       Mention the optional user parameter for X-Message-SMTP-Method.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (Posting Styles): Mention X-Message-SMTP-Method.
+
+       * message.texi (Mail Variables): Document X-Message-SMTP-Method.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (Key Index): Change encoding to utf-8.
+
+2012-06-21  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in: Rename infodir to buildinfodir throughout.  (Bug#11737)
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-11  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.texi (Group Timestamp): Mention where to find documentation for
+       the `gnus-tmp-' variables (bug#11601).
 
-       * Version 24.1 released.
+2012-06-11  Michael Albinus  <michael.albinus@gmx.de>
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+       Sync with Tramp 2.2.6-pre.
+
+       * tramp.texi (all): Use consequently @command{}, @env{} and @kbd{}
+       where appropriate.
+       (Ad-hoc multi-hops): New section.
+       (Remote processes): New subsection "Running remote processes on
+       Windows hosts".
+       (History): Add remote commands on Windows, and ad-hoc multi-hop
+       methods.
+       (External methods): "ControlPersist" must be set to "no" for the
+       `scpc' method.
+       (Remote processes): Add a note about `auto-revert-tail-mode'.
+       (Frequently Asked Questions): Use "scpx" in combination with
+       "ControlPersist".  Reported by Adam Spiers <emacs@adamspiers.org>.
+
+       * trampver.texi: Update release number.
+
+2012-06-10  Chong Yidong  <cyd@gnu.org>
 
        * sc.texi: Remove bogus @ifinfo commands which prevent makeinfo
        compilation for html-mono.
 
-2012-05-16  Bastien Guerry  <bzg@gnu.org>
+2012-06-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * texinfo.tex: Merge from gnulib.
+
+2012-05-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * Makefile.in (echo-info): Don't try to install info files named
+       just ".info".
+
+2012-05-28  Glenn Morris  <rgm@gnu.org>
+
+       * calc.texi, dired-x.texi: Use @LaTeX rather than La@TeX.  (Bug#10910)
+
+       * sc.texi: Nuke hand-written node pointers.
+       Fix top-level menu to match actual node order.
+
+2012-05-27  Glenn Morris  <rgm@gnu.org>
+
+       * cl.texi, dired-x.texi: Nuke hand-written node pointers.
+       Some associated fixes, including not messing with chapno in cl.texi.
+
+2012-05-27  Bastien Guerry  <bzg@gnu.org>
 
        * org.texi (Durations and time values): Fix typo.
 
-2012-05-12  Andreas Schwab  <schwab@linux-m68k.org>
+2012-05-19  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * doc/misc/calc.texi (Basic Operations on Units, Customizing Calc):
+       Mention `calc-ensure-consistent-units'.
+
+2012-05-14  Andreas Schwab  <schwab@linux-m68k.org>
 
        * cc-mode.texi: Avoid space before macro in 4th argument of cross
        reference commands.  (Bug#11461)
 
        * Makefile.in (gnus.dvi): Use $@ instead of $*.dvi.
 
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (mostlyclean): Add more TeX intermediates.
+
+       * Makefile.in: Make it look more like the other doc Makefiles.
+       Use explicit $srcdir in all dependencies.
+       Remove cd $srcdir from rules.
+       (VPATH): Remove.
+       (infodir): Set to an absolute path.
+       (INFO_TARGETS): Use short names.
+       (mkinfodir): infodir is now absolute.
+       (echo-info, maintainer-clean): Update for new format of INFO_TARGETS.
+
+       * Makefile.in (info.info): Rename from info, to avoid duplication.
+       (.SUFFIXES): Disable implicit rules.
+
+       * Makefile.in (MKDIR_P): New, set by configure.
+       (mkinfodir): Use $MKDIR_P.
+
+2012-05-07  Glenn Morris  <rgm@gnu.org>
+
+       * forms.texi (Long Example): Update for changed location of files.
+
+2012-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (INFO_EXT, INFO_OPTS): New, set by configure.
+       (INFO_TARGETS): Use $INFO_EXT.
+       Make all rules generating info files use $INFO_EXT, $INFO_OPT, and -o.
+       * makefile.w32-in (INFO_EXT, INFO_OPTS): New.
+       (INFO_TARGETS): Use $INFO_EXT.
+       Make all rules generating info files use $INFO_EXT, $INFO_OPT, and -o.
+
 2012-05-02  Glenn Morris  <rgm@gnu.org>
 
+       * Makefile.in (echo-info): New phony target, used by top-level.
+
        * viper.texi: Make direntry shorter (also it is no longer "newest").
 
        * emacs-gnutls.texi, ert.texi, org.texi:
        Fix dircategory, direntry to match info/dir.
 
-2012-04-28  Glenn Morris  <rgm@gnu.org>
-
        * faq.texi: Convert @inforefs to @xrefs.
        Fix some malformed cross-references.
        (File-name conventions): Shorten section name to avoid overfull line.
        (How to add fonts): Use smallexample to avoid overfull lines.
 
-2012-04-26  Ippei Furuhashi  <top.tuna+orgmode@gmail.com>  (tiny change)
+2012-05-01  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * auth.texi (Help for users): Update for .gpg file being second.
+
+2012-04-27  Ippei Furuhashi  <top.tuna+orgmode@gmail.com>  (tiny change)
 
        * org.texi (Agenda commands): Fix two typos: give corresponding
        function names, according to `org-agenda-view-mode-dispatch'.
 
-2012-04-21  Glenn Morris  <rgm@gnu.org>
+2012-04-27  Glenn Morris  <rgm@gnu.org>
 
        * faq.texi (Major packages and programs): Remove section.
        There is no point listing 6 packages (cf etc/MORE.STUFF).
        (Finding Emacs and related packages): Move "Spell-checkers" here.
 
+2012-04-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbus.texi (Version): New node.
+       (Properties and Annotations): Mention the object manager
+       interface.  Describe dbus-get-all-managed-objects.
+       (Type Conversion): Floating point numbers are allowed, if an
+       anteger does not fit Emacs's integer range.
+       (Synchronous Methods): Remove obsolete dbus-call-method-non-blocking.
+       (Asynchronous Methods): Fix description of
+       dbus-call-method-asynchronously.
+       (Receiving Method Calls): Fix some minor errors.  Add
+       dbus-interface-emacs.
+       (Signals): Describe unicast signals and the new match rules.
+       (Alternative Buses): Add the PRIVATE optional argument to
+       dbus-init-bus.  Describe its new return value.  Add dbus-setenv.
+
 2012-04-20  Glenn Morris  <rgm@gnu.org>
 
        * faq.texi (New in Emacs 24): New section.
        (Packages that do not come with Emacs): Mention M-x list-packages.
 
-2012-04-13  Glenn Morris  <rgm@gnu.org>
-
-       * Makefile.in: Replace non-portable use of $< in emacs-gnutls rules.
-
-2012-04-12  Eli Zaretskii  <eliz@gnu.org>
-
-       * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add emacs-gnutls.
-       ($(infodir)/emacs-gnutls, emacs-gnutls.dvi): New targets.
-
-2012-04-12  Teodor Zlatanov  <tzz@lifelogs.com>
-
-       * emacs-gnutls.texi: Add documentation for the GnuTLS integration.
-       * Makefile.in: Add emacs-gnutls.texi to build.
-
-2012-04-11  Alan Mackenzie  <acm@muc.de>
+2012-04-14  Alan Mackenzie  <acm@muc.de>
 
        * cc-mode.texi (c-offsets-alist): Correct a typo.
 
-2012-04-11  Jérémie Courrèges-Anglas  <jca@wxcvbn.org>  (tiny change)
+2012-04-14  Jérémie Courrèges-Anglas  <jca@wxcvbn.org>  (tiny change)
 
        * org.texi (Deadlines and scheduling): Fix the example: the
        DEADLINE item should come right after the headline.  We enforce
        this convention, so it is a bug not to illustrate it correctly in
        the manual.
 
-2012-04-11  Ippei FURUHASHI  <top.tuna+orgmode@gmail.com>  (tiny change)
+2012-04-14  Ippei FURUHASHI  <top.tuna+orgmode@gmail.com>  (tiny change)
 
        * org.texi (Agenda commands): Fix documentation bug by swapping
        the equivalent keybindings to `org-agenda-next-line' with the ones
        to `org-agenda-previous-line'.
 
-2012-04-07  Glenn Morris  <rgm@gnu.org>
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in: Replace non-portable use of $< in ordinary rules.
 
+2012-04-09  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (INFO_TARGETS, DVI_TARGETS, clean): Add
+       emacs-gnutls.
+       ($(infodir)/emacs-gnutls, emacs-gnutls.dvi): New targets.
+
+2012-04-09  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * Makefile.in: Add emacs-gnutls.texi to build.
+
+       * emacs-gnutls.texi: Add documentation for the GnuTLS integration.
+
 2012-04-05  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * auth.texi (Secret Service API): Edit further and give examples.
        * mh-e.texi (VERSION, EDITION, UPDATED, UPDATE-MONTH): Update for
        release 8.3.
        (Preface): Updated support information.
-       (From Bill Wohler): Reset text to original version. As a
+       (From Bill Wohler): Reset text to original version.  As a
        historical quote, the tense should be correct in the time that it
        was written.
 
 
 2011-08-15  Suvayu Ali  <fatkasuvayu+linux@gmail.com>  (tiny change)
 
-       * org.texi (Images in LaTeX export): rewrite.
+       * org.texi (Images in LaTeX export): Rewrite.
 
 2011-08-15  Bastien Guerry  <bzg@gnu.org>
 
-       * org.texi (Using the mapping API): mention 'region as a possible
+       * org.texi (Using the mapping API): Mention 'region as a possible
        scope for `org-map-entries'.
 
 2011-08-15  Carsten Dominik  <carsten.dominik@gmail.com>
 
 2011-08-15  Bastien Guerry  <bzg@gnu.org>
 
-       * org.texi (Template expansion): order template sequences in the
+       * org.texi (Template expansion): Order template sequences in the
        proper order.
 
 2011-08-15  Eric Schulte  <schulte.eric@gmail.com>
 
 2011-08-15  Achim Gratz  <stromeko@nexgo.de>
 
-       * org.texi: document that both CLOCK_INTO_DRAWER and
+       * org.texi: Document that both CLOCK_INTO_DRAWER and
        LOG_INTO_DRAWER can be used to override the contents of variable
        org-clock-into-drawer (or if unset, org-log-into-drawer).
 
-       * org.texi: replace @xref->@pxref.
+       * org.texi: Replace @xref->@pxref.
 
 2011-08-15  Eric Schulte  <schulte.eric@gmail.com>
 
 
 2011-08-15  Eric Schulte  <schulte.eric@gmail.com>
 
-       * org.texi (Structure of code blocks): explicitly state that the
-       behavior of multiple blocks of the same name is undefined
+       * org.texi (Structure of code blocks): Explicitly state that the
+       behavior of multiple blocks of the same name is undefined.
 
 2011-08-15  Christian Egli  <christian.egli@sbszh.ch>
 
 
 2011-08-15  Bastien Guerry  <bzg@gnu.org>
 
-       * org.texi (LaTeX and PDF export): add a note about a limitation
+       * org.texi (LaTeX and PDF export): Add a note about a limitation
        of the LaTeX export: the org file has to be properly structured.
 
 2011-08-15  Bastien Guerry  <bzg@gnu.org>
 
 2011-03-19  Antoine Levitt  <antoine.levitt@gmail.com>
 
-       * gnus.texi (Listing Groups): Document gnus-group-list-ticked
+       * gnus.texi (Listing Groups): Document gnus-group-list-ticked.
 
 2011-03-17  Jay Belanger  <jay.p.belanger@gmail.com>
 
 
 2010-11-11  Eric Schulte  <schulte.eric@gmail.com>
 
-       * org.texi: multi-line header arguments :PROPERTIES: :ID:
+       * org.texi: Multi-line header arguments :PROPERTIES: :ID:
        b77c8857-6c76-4ea9-8a61-ddc2648d96c4 :END:.
 
 2010-11-11  Carsten Dominik  <carsten.dominik@gmail.com>
 2009-07-29  Jay Belanger  <jay.p.belanger@gmail.com>
 
        * calc.texi (Stack Manipulation Commands): Add documentation for
-       `calc-transpose-lines'
+       `calc-transpose-lines'.
 
 2009-07-27  Michael Albinus  <michael.albinus@gmx.de>
 
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2012  Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index dd8cf4b9014abf0d820bb173b558624b26049b05..c42a10b88bcc454298e241e4282bc8c4280ba0aa 100644 (file)
@@ -24,77 +24,31 @@ SHELL = /bin/sh
 # set by the configure script's `--srcdir' option.
 srcdir=@srcdir@
 
-# Tell make where to find source files; this is needed for the makefiles.
-# Note the other doc Makefiles do not use VPATH anymore, instead
-# they set buildinfodir to an absolute path.  Not doing that here in
-# case INFO_TARGETS gets too long for some feeble shells.
-# (cf src/Makefile.in's passing of $lisp to make-docfile)
-VPATH=@srcdir@
-
 ## Where the output files go.
-## Note that the setfilename command in the .texi files assumes this.
-buildinfodir=../../info
+buildinfodir = $(srcdir)/../../info
 ## Directory with emacsver.texi.
 ## Currently only used by efaq and calc.
 emacsdir = $(srcdir)/../emacs
 
+MKDIR_P = @MKDIR_P@
+
+INFO_EXT=@INFO_EXT@
+# Options used only when making info output.
+INFO_OPTS=@INFO_OPTS@
+
 # The makeinfo program is part of the Texinfo distribution.
 # Use --force so that it generates output even if there are errors.
 MAKEINFO = @MAKEINFO@
 MAKEINFO_OPTS = --force -I$(emacsdir)
 
-# Also add new entries to INFO_FILES in the top-level Makefile.in.
-INFO_TARGETS = \
-       $(buildinfodir)/ada-mode \
-       $(buildinfodir)/auth \
-       $(buildinfodir)/autotype \
-       $(buildinfodir)/calc \
-       $(buildinfodir)/ccmode \
-       $(buildinfodir)/cl \
-       $(buildinfodir)/dbus \
-       $(buildinfodir)/dired-x \
-       $(buildinfodir)/ebrowse \
-       $(buildinfodir)/ede \
-       $(buildinfodir)/ediff \
-       $(buildinfodir)/edt \
-       $(buildinfodir)/eieio \
-       $(buildinfodir)/emacs-mime \
-       $(buildinfodir)/epa \
-       $(buildinfodir)/erc \
-       $(buildinfodir)/ert \
-       $(buildinfodir)/eshell \
-       $(buildinfodir)/eudc \
-       $(buildinfodir)/efaq \
-       $(buildinfodir)/flymake \
-       $(buildinfodir)/forms \
-       $(buildinfodir)/gnus \
-       $(buildinfodir)/emacs-gnutls \
-       $(buildinfodir)/idlwave \
-       $(buildinfodir)/info \
-       $(buildinfodir)/mairix-el \
-       $(buildinfodir)/message \
-       $(buildinfodir)/mh-e \
-       $(buildinfodir)/newsticker \
-       $(buildinfodir)/nxml-mode \
-       $(buildinfodir)/org \
-       $(buildinfodir)/pcl-cvs \
-       $(buildinfodir)/pgg \
-       $(buildinfodir)/rcirc \
-       $(buildinfodir)/remember \
-       $(buildinfodir)/reftex \
-       $(buildinfodir)/sasl \
-       $(buildinfodir)/sc \
-       $(buildinfodir)/semantic \
-       $(buildinfodir)/ses \
-       $(buildinfodir)/sieve \
-       $(buildinfodir)/smtpmail \
-       $(buildinfodir)/speedbar \
-       $(buildinfodir)/tramp \
-       $(buildinfodir)/url \
-       $(buildinfodir)/vip \
-       $(buildinfodir)/viper \
-       $(buildinfodir)/widget \
-       $(buildinfodir)/woman
+INFO_TARGETS = ada-mode auth autotype calc ccmode cl \
+       dbus dired-x ebrowse ede ediff edt eieio \
+       emacs-mime epa erc ert eshell eudc efaq \
+       flymake forms gnus emacs-gnutls idlwave info.info \
+       mairix-el message mh-e newsticker nxml-mode \
+       org pcl-cvs pgg rcirc remember reftex sasl \
+       sc semantic ses sieve smtpmail speedbar tramp \
+       url vip viper widget woman
 
 DVI_TARGETS = \
        ada-mode.dvi \
@@ -208,12 +162,21 @@ TEXI2PDF = texi2pdf
 ENVADD = TEXINPUTS="$(srcdir):$(emacsdir):$(TEXINPUTS)" \
          MAKEINFO="$(MAKEINFO) $(MAKEINFO_OPTS)"
 
-mkinfodir = @cd ${srcdir}; test -d ${buildinfodir} || mkdir ${buildinfodir} || test -d ${buildinfodir}
+mkinfodir = @${MKDIR_P} ${buildinfodir}
 
-.PHONY: info dvi pdf
+.PHONY: info dvi pdf echo-info
+## Prevent implicit rule triggering for foo.info.
+.SUFFIXES:
 
+# Default.
 info: $(INFO_TARGETS)
 
+## Used by top-level Makefile.
+## Base file names of output info files.
+echo-info:
+       @echo "$(INFO_TARGETS) " | \
+         sed -e 's|[^ ]*/||g' -e 's/\.info//g' -e "s/  */$(INFO_EXT) /g"
+
 # please modify this for all the web manual targets
 webhack: clean
        $(MAKE) pdf MAKEINFO_OPTS="-DWEBHACKDEVEL $(MAKEINFO_OPTS)"
@@ -222,198 +185,196 @@ dvi: $(DVI_TARGETS)
 
 pdf: $(PDF_TARGETS)
 
-# Note that all the Info targets build the Info files
-# in srcdir.  There is no provision for Info files
-# to exist in the build directory.
+# Note that all the Info targets build the Info files in srcdir.
+# There is no provision for Info files to exist in the build directory.
 # In a distribution of Emacs, the Info files should be up to date.
 
 # Note: "<" is not portable in ordinary make rules.
 
-## "short" target names for convenience, to just rebuild one manual.
-ada-mode : $(buildinfodir)/ada-mode
-$(buildinfodir)/ada-mode: ada-mode.texi
+ada-mode : $(buildinfodir)/ada-mode$(INFO_EXT)
+$(buildinfodir)/ada-mode$(INFO_EXT): ${srcdir}/ada-mode.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) ada-mode.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/ada-mode.texi
 ada-mode.dvi: ${srcdir}/ada-mode.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/ada-mode.texi
 ada-mode.pdf: ${srcdir}/ada-mode.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/ada-mode.texi
 
-auth : $(buildinfodir)/auth
-$(buildinfodir)/authauth.texi
+auth : $(buildinfodir)/auth$(INFO_EXT)
+$(buildinfodir)/auth$(INFO_EXT): ${srcdir}/auth.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) auth.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/auth.texi
 auth.dvi: ${srcdir}/auth.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/auth.texi
 auth.pdf: ${srcdir}/auth.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/auth.texi
 
-autotype : $(buildinfodir)/autotype
-$(buildinfodir)/autotypeautotype.texi
+autotype : $(buildinfodir)/autotype$(INFO_EXT)
+$(buildinfodir)/autotype$(INFO_EXT): ${srcdir}/autotype.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) autotype.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/autotype.texi
 autotype.dvi: ${srcdir}/autotype.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/autotype.texi
 autotype.pdf: ${srcdir}/autotype.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/autotype.texi
 
-calc : $(buildinfodir)/calc
-$(buildinfodir)/calccalc.texi $(emacsdir)/emacsver.texi
+calc : $(buildinfodir)/calc$(INFO_EXT)
+$(buildinfodir)/calc$(INFO_EXT): ${srcdir}/calc.texi $(emacsdir)/emacsver.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) calc.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/calc.texi
 calc.dvi: ${srcdir}/calc.texi $(emacsdir)/emacsver.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/calc.texi
 calc.pdf: ${srcdir}/calc.texi $(emacsdir)/emacsver.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/calc.texi
 
-ccmode : $(buildinfodir)/ccmode
-$(buildinfodir)/ccmodecc-mode.texi
+ccmode : $(buildinfodir)/ccmode$(INFO_EXT)
+$(buildinfodir)/ccmode$(INFO_EXT): ${srcdir}/cc-mode.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) cc-mode.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/cc-mode.texi
 cc-mode.dvi: ${srcdir}/cc-mode.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/cc-mode.texi
 cc-mode.pdf: ${srcdir}/cc-mode.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/cc-mode.texi
 
-cl : $(buildinfodir)/cl
-$(buildinfodir)/clcl.texi
+cl : $(buildinfodir)/cl$(INFO_EXT)
+$(buildinfodir)/cl$(INFO_EXT): ${srcdir}/cl.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) cl.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/cl.texi
 cl.dvi: ${srcdir}/cl.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/cl.texi
 cl.pdf: ${srcdir}/cl.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/cl.texi
 
-dbus : $(buildinfodir)/dbus
-$(buildinfodir)/dbusdbus.texi
+dbus : $(buildinfodir)/dbus$(INFO_EXT)
+$(buildinfodir)/dbus$(INFO_EXT): ${srcdir}/dbus.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) dbus.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/dbus.texi
 dbus.dvi: ${srcdir}/dbus.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/dbus.texi
 dbus.pdf: ${srcdir}/dbus.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/dbus.texi
 
-dired-x : $(buildinfodir)/dired-x
-$(buildinfodir)/dired-xdired-x.texi $(emacsdir)/emacsver.texi
+dired-x : $(buildinfodir)/dired-x$(INFO_EXT)
+$(buildinfodir)/dired-x$(INFO_EXT): ${srcdir}/dired-x.texi $(emacsdir)/emacsver.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) dired-x.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/dired-x.texi
 dired-x.dvi: ${srcdir}/dired-x.texi $(emacsdir)/emacsver.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/dired-x.texi
 dired-x.pdf: ${srcdir}/dired-x.texi $(emacsdir)/emacsver.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/dired-x.texi
 
-ebrowse : $(buildinfodir)/ebrowse
-$(buildinfodir)/ebrowseebrowse.texi
+ebrowse : $(buildinfodir)/ebrowse$(INFO_EXT)
+$(buildinfodir)/ebrowse$(INFO_EXT): ${srcdir}/ebrowse.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) ebrowse.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/ebrowse.texi
 ebrowse.dvi: ${srcdir}/ebrowse.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/ebrowse.texi
 ebrowse.pdf: ${srcdir}/ebrowse.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/ebrowse.texi
 
-ede : $(buildinfodir)/ede
-$(buildinfodir)/edeede.texi
+ede : $(buildinfodir)/ede$(INFO_EXT)
+$(buildinfodir)/ede$(INFO_EXT): ${srcdir}/ede.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) ede.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/ede.texi
 ede.dvi: ${srcdir}/ede.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/ede.texi
 ede.pdf: ${srcdir}/ede.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/ede.texi
 
-ediff : $(buildinfodir)/ediff
-$(buildinfodir)/ediffediff.texi
+ediff : $(buildinfodir)/ediff$(INFO_EXT)
+$(buildinfodir)/ediff$(INFO_EXT): ${srcdir}/ediff.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) ediff.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/ediff.texi
 ediff.dvi: ${srcdir}/ediff.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/ediff.texi
 ediff.pdf: ${srcdir}/ediff.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/ediff.texi
 
-edt : $(buildinfodir)/edt
-$(buildinfodir)/edtedt.texi
+edt : $(buildinfodir)/edt$(INFO_EXT)
+$(buildinfodir)/edt$(INFO_EXT): ${srcdir}/edt.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) edt.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/edt.texi
 edt.dvi: ${srcdir}/edt.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/edt.texi
 edt.pdf: ${srcdir}/edt.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/edt.texi
 
-eieio : $(buildinfodir)/eieio
-$(buildinfodir)/eieioeieio.texi
+eieio : $(buildinfodir)/eieio$(INFO_EXT)
+$(buildinfodir)/eieio$(INFO_EXT): ${srcdir}/eieio.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) eieio.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/eieio.texi
 eieio.dvi: ${srcdir}/eieio.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/eieio.texi
 eieio.pdf: ${srcdir}/eieio.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/eieio.texi
 
-emacs-gnutls : $(buildinfodir)/emacs-gnutls
-$(buildinfodir)/emacs-gnutlsemacs-gnutls.texi
+emacs-gnutls : $(buildinfodir)/emacs-gnutls$(INFO_EXT)
+$(buildinfodir)/emacs-gnutls$(INFO_EXT): ${srcdir}/emacs-gnutls.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) emacs-gnutls.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/emacs-gnutls.texi
 emacs-gnutls.dvi: ${srcdir}/emacs-gnutls.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-gnutls.texi
 emacs-gnutls.pdf: ${srcdir}/emacs-gnutls.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/emacs-gnutls.texi
 
-emacs-mime : $(buildinfodir)/emacs-mime
-$(buildinfodir)/emacs-mimeemacs-mime.texi
+emacs-mime : $(buildinfodir)/emacs-mime$(INFO_EXT)
+$(buildinfodir)/emacs-mime$(INFO_EXT): ${srcdir}/emacs-mime.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) --enable-encoding emacs-mime.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) --enable-encoding -o $@ ${srcdir}/emacs-mime.texi
 emacs-mime.dvi: ${srcdir}/emacs-mime.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/emacs-mime.texi
 emacs-mime.pdf: ${srcdir}/emacs-mime.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/emacs-mime.texi
 
-epa : $(buildinfodir)/epa
-$(buildinfodir)/epaepa.texi
+epa : $(buildinfodir)/epa$(INFO_EXT)
+$(buildinfodir)/epa$(INFO_EXT): ${srcdir}/epa.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) epa.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/epa.texi
 epa.dvi: ${srcdir}/epa.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/epa.texi
 epa.pdf: ${srcdir}/epa.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/epa.texi
 
-erc : $(buildinfodir)/erc
-$(buildinfodir)/ercerc.texi
+erc : $(buildinfodir)/erc$(INFO_EXT)
+$(buildinfodir)/erc$(INFO_EXT): ${srcdir}/erc.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) erc.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/erc.texi
 erc.dvi: ${srcdir}/erc.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/erc.texi
 erc.pdf: ${srcdir}/erc.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/erc.texi
 
-ert : $(buildinfodir)/ert
-$(buildinfodir)/ertert.texi
+ert : $(buildinfodir)/ert$(INFO_EXT)
+$(buildinfodir)/ert$(INFO_EXT): ${srcdir}/ert.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) ert.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/ert.texi
 ert.dvi: ${srcdir}/ert.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/ert.texi
 ert.pdf: ${srcdir}/ert.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/ert.texi
 
-eshell : $(buildinfodir)/eshell
-$(buildinfodir)/eshelleshell.texi
+eshell : $(buildinfodir)/eshell$(INFO_EXT)
+$(buildinfodir)/eshell$(INFO_EXT): ${srcdir}/eshell.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) eshell.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/eshell.texi
 eshell.dvi: ${srcdir}/eshell.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/eshell.texi
 eshell.pdf: ${srcdir}/eshell.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/eshell.texi
 
-eudc : $(buildinfodir)/eudc
-$(buildinfodir)/eudceudc.texi
+eudc : $(buildinfodir)/eudc$(INFO_EXT)
+$(buildinfodir)/eudc$(INFO_EXT): ${srcdir}/eudc.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) eudc.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/eudc.texi
 eudc.dvi: ${srcdir}/eudc.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/eudc.texi
 eudc.pdf: ${srcdir}/eudc.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/eudc.texi
 
-efaq : $(buildinfodir)/efaq
-$(buildinfodir)/efaqfaq.texi $(emacsdir)/emacsver.texi
+efaq : $(buildinfodir)/efaq$(INFO_EXT)
+$(buildinfodir)/efaq$(INFO_EXT): ${srcdir}/faq.texi $(emacsdir)/emacsver.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) faq.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/faq.texi
 faq.dvi: ${srcdir}/faq.texi $(emacsdir)/emacsver.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/faq.texi
 faq.pdf: ${srcdir}/faq.texi $(emacsdir)/emacsver.texi
@@ -428,274 +389,272 @@ emacs-faq.html: ${srcdir}/faq.texi $(emacsdir)/emacsver.texi
 emacs-faq.text: ${srcdir}/faq.texi $(emacsdir)/emacsver.texi
        $(MAKEINFO) $(MAKEINFO_OPTS) --plaintext -o $@ ${srcdir}/faq.texi
 
-flymake : $(buildinfodir)/flymake
-$(buildinfodir)/flymakeflymake.texi
+flymake : $(buildinfodir)/flymake$(INFO_EXT)
+$(buildinfodir)/flymake$(INFO_EXT): ${srcdir}/flymake.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) flymake.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/flymake.texi
 flymake.dvi: ${srcdir}/flymake.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/flymake.texi
 flymake.pdf: ${srcdir}/flymake.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/flymake.texi
 
-forms : $(buildinfodir)/forms
-$(buildinfodir)/formsforms.texi
+forms : $(buildinfodir)/forms$(INFO_EXT)
+$(buildinfodir)/forms$(INFO_EXT): ${srcdir}/forms.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) forms.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/forms.texi
 forms.dvi: ${srcdir}/forms.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/forms.texi
 forms.pdf: ${srcdir}/forms.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/forms.texi
 
 # gnus/message/emacs-mime/sieve/pgg are part of Gnus:
-gnus : $(buildinfodir)/gnus
-$(buildinfodir)/gnus: gnus.texi gnus-faq.texi
+gnus : $(buildinfodir)/gnus$(INFO_EXT)
+$(buildinfodir)/gnus$(INFO_EXT): ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) gnus.texi
-gnus.dvi: ${srcdir}/gnus.texi gnus-faq.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/gnus.texi
+gnus.dvi: ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi
        sed -e '/@iflatex/,/@end iflatex/d' ${srcdir}/gnus.texi > gnustmp.texi
        $(ENVADD) $(TEXI2DVI) gnustmp.texi
        cp gnustmp.dvi $@
        rm gnustmp.*
-gnus.pdf: ${srcdir}/gnus.texi gnus-faq.texi
+gnus.pdf: ${srcdir}/gnus.texi ${srcdir}/gnus-faq.texi
        sed -e '/@iflatex/,/@end iflatex/d' ${srcdir}/gnus.texi > gnustmp.texi
        $(ENVADD) $(TEXI2PDF) gnustmp.texi
        cp gnustmp.pdf $@
        rm gnustmp.*
 
-# This is produced with --no-split to avoid making files whose
-# names clash on DOS 8+3 filesystems
-idlwave : $(buildinfodir)/idlwave
-$(buildinfodir)/idlwave: idlwave.texi
+# NB this one needs --no-split even without a .info extension.
+idlwave : $(buildinfodir)/idlwave$(INFO_EXT)
+$(buildinfodir)/idlwave$(INFO_EXT): ${srcdir}/idlwave.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) --no-split idlwave.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/idlwave.texi
 idlwave.dvi: ${srcdir}/idlwave.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/idlwave.texi
 idlwave.pdf: ${srcdir}/idlwave.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/idlwave.texi
 
-# The following target uses an explicit -o switch to work around
-# the @setfilename directive in info.texi, which is required for
-# the Texinfo distribution.
-###info : $(buildinfodir)/info   # circular!
-$(buildinfodir)/info: info.texi
+# NB this one needs --no-split even without a .info extension.
+# Avoid name clash with overall "info" target.
+info.info : $(buildinfodir)/info$(INFO_EXT)
+$(buildinfodir)/info$(INFO_EXT): ${srcdir}/info.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) --no-split -o $@ info.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/info.texi
 info.dvi: ${srcdir}/info.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/info.texi
 info.pdf: ${srcdir}/info.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/info.texi
 
-mairix-el : $(buildinfodir)/mairix-el
-$(buildinfodir)/mairix-elmairix-el.texi
+mairix-el : $(buildinfodir)/mairix-el$(INFO_EXT)
+$(buildinfodir)/mairix-el$(INFO_EXT): ${srcdir}/mairix-el.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) mairix-el.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/mairix-el.texi
 mairix-el.dvi: ${srcdir}/mairix-el.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/mairix-el.texi
 mairix-el.pdf: ${srcdir}/mairix-el.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/mairix-el.texi
 
-message : $(buildinfodir)/message
-$(buildinfodir)/messagemessage.texi
+message : $(buildinfodir)/message$(INFO_EXT)
+$(buildinfodir)/message$(INFO_EXT): ${srcdir}/message.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) message.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/message.texi
 message.dvi: ${srcdir}/message.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/message.texi
 message.pdf: ${srcdir}/message.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/message.texi
 
-mh-e : $(buildinfodir)/mh-e
-$(buildinfodir)/mh-emh-e.texi
+mh-e : $(buildinfodir)/mh-e$(INFO_EXT)
+$(buildinfodir)/mh-e$(INFO_EXT): ${srcdir}/mh-e.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) mh-e.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/mh-e.texi
 mh-e.dvi: ${srcdir}/mh-e.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/mh-e.texi
 mh-e.pdf: ${srcdir}/mh-e.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/mh-e.texi
 
-newsticker : $(buildinfodir)/newsticker
-$(buildinfodir)/newstickernewsticker.texi
+newsticker : $(buildinfodir)/newsticker$(INFO_EXT)
+$(buildinfodir)/newsticker$(INFO_EXT): ${srcdir}/newsticker.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) newsticker.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/newsticker.texi
 newsticker.dvi: ${srcdir}/newsticker.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/newsticker.texi
 newsticker.pdf: ${srcdir}/newsticker.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/newsticker.texi
 
-nxml-mode : $(buildinfodir)/nxml-mode
-$(buildinfodir)/nxml-modenxml-mode.texi
+nxml-mode : $(buildinfodir)/nxml-mode$(INFO_EXT)
+$(buildinfodir)/nxml-mode$(INFO_EXT): ${srcdir}/nxml-mode.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) nxml-mode.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/nxml-mode.texi
 nxml-mode.dvi: ${srcdir}/nxml-mode.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/nxml-mode.texi
 nxml-mode.pdf: ${srcdir}/nxml-mode.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/nxml-mode.texi
 
-org : $(buildinfodir)/org
-$(buildinfodir)/orgorg.texi
+org : $(buildinfodir)/org$(INFO_EXT)
+$(buildinfodir)/org$(INFO_EXT): ${srcdir}/org.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) org.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/org.texi
 org.dvi: ${srcdir}/org.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/org.texi
 org.pdf: ${srcdir}/org.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/org.texi
 
-pcl-cvs : $(buildinfodir)/pcl-cvs
-$(buildinfodir)/pcl-cvspcl-cvs.texi
+pcl-cvs : $(buildinfodir)/pcl-cvs$(INFO_EXT)
+$(buildinfodir)/pcl-cvs$(INFO_EXT): ${srcdir}/pcl-cvs.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) pcl-cvs.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/pcl-cvs.texi
 pcl-cvs.dvi: ${srcdir}/pcl-cvs.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/pcl-cvs.texi
 pcl-cvs.pdf: ${srcdir}/pcl-cvs.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/pcl-cvs.texi
 
-pgg : $(buildinfodir)/pgg
-$(buildinfodir)/pggpgg.texi
+pgg : $(buildinfodir)/pgg$(INFO_EXT)
+$(buildinfodir)/pgg$(INFO_EXT): ${srcdir}/pgg.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) pgg.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/pgg.texi
 pgg.dvi: ${srcdir}/pgg.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/pgg.texi
 pgg.pdf: ${srcdir}/pgg.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/pgg.texi
 
-rcirc : $(buildinfodir)/rcirc
-$(buildinfodir)/rcircrcirc.texi
+rcirc : $(buildinfodir)/rcirc$(INFO_EXT)
+$(buildinfodir)/rcirc$(INFO_EXT): ${srcdir}/rcirc.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) rcirc.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/rcirc.texi
 rcirc.dvi: ${srcdir}/rcirc.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/rcirc.texi
 rcirc.pdf: ${srcdir}/rcirc.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/rcirc.texi
 
-reftex : $(buildinfodir)/reftex
-$(buildinfodir)/reftexreftex.texi
+reftex : $(buildinfodir)/reftex$(INFO_EXT)
+$(buildinfodir)/reftex$(INFO_EXT): ${srcdir}/reftex.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) reftex.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/reftex.texi
 reftex.dvi: ${srcdir}/reftex.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/reftex.texi
 reftex.pdf: ${srcdir}/reftex.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/reftex.texi
 
-remember : $(buildinfodir)/remember
-$(buildinfodir)/rememberremember.texi
+remember : $(buildinfodir)/remember$(INFO_EXT)
+$(buildinfodir)/remember$(INFO_EXT): ${srcdir}/remember.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) remember.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/remember.texi
 remember.dvi: ${srcdir}/remember.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/remember.texi
 remember.pdf: ${srcdir}/remember.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/remember.texi
 
-sasl : $(buildinfodir)/sasl
-$(buildinfodir)/saslsasl.texi
+sasl : $(buildinfodir)/sasl$(INFO_EXT)
+$(buildinfodir)/sasl$(INFO_EXT): ${srcdir}/sasl.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) sasl.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/sasl.texi
 sasl.dvi: ${srcdir}/sasl.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/sasl.texi
 sasl.pdf: ${srcdir}/sasl.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/sasl.texi
 
-sc : $(buildinfodir)/sc
-$(buildinfodir)/scsc.texi
+sc : $(buildinfodir)/sc$(INFO_EXT)
+$(buildinfodir)/sc$(INFO_EXT): ${srcdir}/sc.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) sc.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/sc.texi
 sc.dvi: ${srcdir}/sc.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/sc.texi
 sc.pdf: ${srcdir}/sc.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/sc.texi
 
-semantic : $(buildinfodir)/semantic
-$(buildinfodir)/semantic: semantic.texi sem-user.texi
+semantic : $(buildinfodir)/semantic$(INFO_EXT)
+$(buildinfodir)/semantic$(INFO_EXT): ${srcdir}/semantic.texi ${srcdir}/sem-user.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) semantic.texi
-semantic.dvi: ${srcdir}/semantic.texi sem-user.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/semantic.texi
+semantic.dvi: ${srcdir}/semantic.texi ${srcdir}/sem-user.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/semantic.texi
-semantic.pdf: ${srcdir}/semantic.texi sem-user.texi
+semantic.pdf: ${srcdir}/semantic.texi ${srcdir}/sem-user.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/semantic.texi
 
-ses : $(buildinfodir)/ses
-$(buildinfodir)/sesses.texi
+ses : $(buildinfodir)/ses$(INFO_EXT)
+$(buildinfodir)/ses$(INFO_EXT): ${srcdir}/ses.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) ses.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/ses.texi
 ses.dvi: ${srcdir}/ses.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/ses.texi
 ses.pdf: ${srcdir}/ses.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/ses.texi
 
-sieve : $(buildinfodir)/sieve
-$(buildinfodir)/sievesieve.texi
+sieve : $(buildinfodir)/sieve$(INFO_EXT)
+$(buildinfodir)/sieve$(INFO_EXT): ${srcdir}/sieve.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) sieve.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/sieve.texi
 sieve.dvi: ${srcdir}/sieve.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/sieve.texi
 sieve.pdf: ${srcdir}/sieve.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/sieve.texi
 
-smtpmail : $(buildinfodir)/smtpmail
-$(buildinfodir)/smtpmailsmtpmail.texi
+smtpmail : $(buildinfodir)/smtpmail$(INFO_EXT)
+$(buildinfodir)/smtpmail$(INFO_EXT): ${srcdir}/smtpmail.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) smtpmail.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/smtpmail.texi
 smtpmail.dvi: ${srcdir}/smtpmail.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/smtpmail.texi
 smtpmail.pdf: ${srcdir}/smtpmail.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/smtpmail.texi
 
-speedbar : $(buildinfodir)/speedbar
-$(buildinfodir)/speedbarspeedbar.texi
+speedbar : $(buildinfodir)/speedbar$(INFO_EXT)
+$(buildinfodir)/speedbar$(INFO_EXT): ${srcdir}/speedbar.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) speedbar.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/speedbar.texi
 speedbar.dvi: ${srcdir}/speedbar.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/speedbar.texi
 speedbar.pdf: ${srcdir}/speedbar.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/speedbar.texi
 
-tramp : $(buildinfodir)/tramp
-$(buildinfodir)/tramp: tramp.texi trampver.texi
+tramp : $(buildinfodir)/tramp$(INFO_EXT)
+$(buildinfodir)/tramp$(INFO_EXT): ${srcdir}/tramp.texi ${srcdir}/trampver.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) -D emacs tramp.texi
-tramp.dvi: ${srcdir}/tramp.texi trampver.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ -D emacs ${srcdir}/tramp.texi
+tramp.dvi: ${srcdir}/tramp.texi ${srcdir}/trampver.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/tramp.texi
-tramp.pdf: ${srcdir}/tramp.texi trampver.texi
+tramp.pdf: ${srcdir}/tramp.texi ${srcdir}/trampver.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/tramp.texi
 
-url : $(buildinfodir)/url
-$(buildinfodir)/urlurl.texi
+url : $(buildinfodir)/url$(INFO_EXT)
+$(buildinfodir)/url$(INFO_EXT): ${srcdir}/url.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) url.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/url.texi
 url.dvi: ${srcdir}/url.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/url.texi
 url.pdf: ${srcdir}/url.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/url.texi
 
-vip : $(buildinfodir)/vip
-$(buildinfodir)/vipvip.texi
+vip : $(buildinfodir)/vip$(INFO_EXT)
+$(buildinfodir)/vip$(INFO_EXT): ${srcdir}/vip.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) vip.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/vip.texi
 vip.dvi: ${srcdir}/vip.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/vip.texi
 vip.pdf: ${srcdir}/vip.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/vip.texi
 
-viper : $(buildinfodir)/viper
-$(buildinfodir)/viperviper.texi
+viper : $(buildinfodir)/viper$(INFO_EXT)
+$(buildinfodir)/viper$(INFO_EXT): ${srcdir}/viper.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) viper.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/viper.texi
 viper.dvi: ${srcdir}/viper.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/viper.texi
 viper.pdf: ${srcdir}/viper.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/viper.texi
 
-widget : $(buildinfodir)/widget
-$(buildinfodir)/widgetwidget.texi
+widget : $(buildinfodir)/widget$(INFO_EXT)
+$(buildinfodir)/widget$(INFO_EXT): ${srcdir}/widget.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) widget.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/widget.texi
 widget.dvi: ${srcdir}/widget.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/widget.texi
 widget.pdf: ${srcdir}/widget.texi
        $(ENVADD) $(TEXI2PDF) ${srcdir}/widget.texi
 
-woman : $(buildinfodir)/woman
-$(buildinfodir)/womanwoman.texi
+woman : $(buildinfodir)/woman$(INFO_EXT)
+$(buildinfodir)/woman$(INFO_EXT): ${srcdir}/woman.texi
        $(mkinfodir)
-       cd $(srcdir); $(MAKEINFO) $(MAKEINFO_OPTS) woman.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ${srcdir}/woman.texi
 woman.dvi: ${srcdir}/woman.texi
        $(ENVADD) $(TEXI2DVI) ${srcdir}/woman.texi
 woman.pdf: ${srcdir}/woman.texi
@@ -705,8 +664,9 @@ woman.pdf: ${srcdir}/woman.texi
 .PHONY: mostlyclean clean distclean maintainer-clean
 
 mostlyclean:
-       rm -f *.aux *.log *.toc *.cp *.cps *.fn *.fns *.ky *.kys \
-         *.op *.ops *.pg *.pgs *.tp *.tps *.vr *.vrs
+       rm -f *.aux *.log *.toc *.c[mp] *.c[mp]s *.fn *.fns \
+         *.ky *.kys *.op *.ops *.p[gj] *.p[gj]s *.sc *.scs *.ss \
+         *.t[gp] *.t[gp]s *.vr *.vrs
        rm -f gnustmp.*
 
 clean: mostlyclean
@@ -717,7 +677,8 @@ distclean: clean
 
 ## buildinfodir is relative to srcdir.
 maintainer-clean: distclean
-       cd $(srcdir); for file in $(INFO_TARGETS); do \
+       cd $(buildinfodir); for file in $(INFO_TARGETS); do \
+         file=`echo $${file} | sed 's/\.info$$//'`${INFO_EXT}; \
          rm -f $${file} $${file}-[1-9] $${file}-[1-9][0-9]; \
        done
 
index 4ce4e337a0fe4fc4511f21e29e4594627651dc05..3a1e4155e9711aeae30f71a6b651cdccebb68269 100644 (file)
@@ -180,12 +180,15 @@ Here's a mixed example using two sources:
 @end defvar
 
 If you don't customize @code{auth-sources}, you'll have to live with
-the defaults: any host and any port are looked up in the netrc
-file @file{~/.authinfo.gpg}, which is a GnuPG encrypted file
-(@pxref{GnuPG and EasyPG Assistant Configuration}).
+the defaults: the unencrypted netrc file @file{~/.authinfo} will be
+used for any host and any port.
 
-If that fails, the unencrypted netrc files @file{~/.authinfo} and
-@file{~/.netrc} will be used.
+If that fails, any host and any port are looked up in the netrc file
+@file{~/.authinfo.gpg}, which is a GnuPG encrypted file (@pxref{GnuPG
+and EasyPG Assistant Configuration}).
+
+Finally, the unencrypted netrc file @file{~/.netrc} will be used for
+any host and any port.
 
 The typical netrc line example is without a port.
 
index 48252ceb3271b05c68f0f14a2a7eadba3e4b172c..61ca34b8d2f8d97407bbe105cf608242dee07a5c 100644 (file)
@@ -557,7 +557,7 @@ these equations for the variables @expr{x} and @expr{y}.
 Type @kbd{d B} to view the solutions in more readable notation.
 Type @w{@kbd{d C}} to view them in C language notation, @kbd{d T}
 to view them in the notation for the @TeX{} typesetting system,
-and @kbd{d L} to view them in the notation for the La@TeX{} typesetting
+and @kbd{d L} to view them in the notation for the @LaTeX{} typesetting
 system.  Type @kbd{d N} to return to normal notation.
 
 @noindent
@@ -939,7 +939,7 @@ is
 Calc has added annotations to the file to help it remember the modes
 that were used for this formula.  They are formatted like comments
 in the @TeX{} typesetting language, just in case you are using @TeX{} or
-La@TeX{}. (In this example @TeX{} is not being used, so you might want
+@LaTeX{}. (In this example @TeX{} is not being used, so you might want
 to move these comments up to the top of the file or otherwise put them
 out of the way.)
 
@@ -5026,7 +5026,7 @@ One more mode that makes reading formulas easier is Big mode.
 Here things like powers, square roots, and quotients and fractions
 are displayed in a two-dimensional pictorial form.  Calc has other
 language modes as well, such as C mode, FORTRAN mode, @TeX{} mode
-and La@TeX{} mode.
+and @LaTeX{} mode.
 
 @smallexample
 @group
@@ -13842,7 +13842,7 @@ left or right as you prefer.
 @noindent
 The commands in this section change Calc to use a different notation for
 entry and display of formulas, corresponding to the conventions of some
-other common language such as Pascal or La@TeX{}.  Objects displayed on the
+other common language such as Pascal or @LaTeX{}.  Objects displayed on the
 stack or yanked from the Calculator to an editing buffer will be formatted
 in the current language; objects entered in algebraic entry or yanked from
 another buffer will be interpreted according to the current language.
@@ -13867,10 +13867,10 @@ the brackets in @samp{a[1]} and @samp{a[2]}, would not have known that
 and would have written the formula back with notations (like implicit
 multiplication) which would not have been valid for a C program.
 
-As another example, suppose you are maintaining a C program and a La@TeX{}
+As another example, suppose you are maintaining a C program and a @LaTeX{}
 document, each of which needs a copy of the same formula.  You can grab the
-formula from the program in C mode, switch to La@TeX{} mode, and yank the
-formula into the document in La@TeX{} math-mode format.
+formula from the program in C mode, switch to @LaTeX{} mode, and yank the
+formula into the document in @LaTeX{} math-mode format.
 
 Language modes are selected by typing the letter @kbd{d} followed by a
 shifted letter key.
@@ -14067,7 +14067,7 @@ convert to lower-case on input.  With a negative prefix, these modes
 convert to lower-case for display and input.
 
 @node TeX and LaTeX Language Modes, Eqn Language Mode, C FORTRAN Pascal, Language Modes
-@subsection @TeX{} and La@TeX{} Language Modes
+@subsection @TeX{} and @LaTeX{} Language Modes
 
 @noindent
 @kindex d T
@@ -14079,38 +14079,38 @@ convert to lower-case for display and input.
 The @kbd{d T} (@code{calc-tex-language}) command selects the conventions
 of ``math mode'' in Donald Knuth's @TeX{} typesetting language,
 and the @kbd{d L} (@code{calc-latex-language}) command selects the
-conventions of ``math mode'' in La@TeX{}, a typesetting language that
-uses @TeX{} as its formatting engine.  Calc's La@TeX{} language mode can
-read any formula that the @TeX{} language mode can, although La@TeX{}
+conventions of ``math mode'' in @LaTeX{}, a typesetting language that
+uses @TeX{} as its formatting engine.  Calc's @LaTeX{} language mode can
+read any formula that the @TeX{} language mode can, although @LaTeX{}
 mode may display it differently.
 
 Formulas are entered and displayed in the appropriate notation;
 @texline @math{\sin(a/b)}
 @infoline @expr{sin(a/b)}
 will appear as @samp{\sin\left( @{a \over b@} \right)} in @TeX{} mode and
-@samp{\sin\left(\frac@{a@}@{b@}\right)} in La@TeX{} mode.
+@samp{\sin\left(\frac@{a@}@{b@}\right)} in @LaTeX{} mode.
 Math formulas are often enclosed by @samp{$ $} signs in @TeX{} and
-La@TeX{}; these should be omitted when interfacing with Calc.  To Calc,
+@LaTeX{}; these should be omitted when interfacing with Calc.  To Calc,
 the @samp{$} sign has the same meaning it always does in algebraic
 formulas (a reference to an existing entry on the stack).
 
 Complex numbers are displayed as in @samp{3 + 4i}.  Fractions and
 quotients are written using @code{\over} in @TeX{} mode (as in
-@code{@{a \over b@}}) and @code{\frac} in La@TeX{} mode (as in
+@code{@{a \over b@}}) and @code{\frac} in @LaTeX{} mode (as in
 @code{\frac@{a@}@{b@}});  binomial coefficients are written with
 @code{\choose} in @TeX{} mode (as in @code{@{a \choose b@}}) and
-@code{\binom} in La@TeX{} mode (as in @code{\binom@{a@}@{b@}}).
+@code{\binom} in @LaTeX{} mode (as in @code{\binom@{a@}@{b@}}).
 Interval forms are written with @code{\ldots}, and error forms are
 written with @code{\pm}. Absolute values are written as in
 @samp{|x + 1|}, and the floor and ceiling functions are written with
 @code{\lfloor}, @code{\rfloor}, etc. The words @code{\left} and
-@code{\right} are ignored when reading formulas in @TeX{} and La@TeX{}
+@code{\right} are ignored when reading formulas in @TeX{} and @LaTeX{}
 modes.  Both @code{inf} and @code{uinf} are written as @code{\infty};
 when read, @code{\infty} always translates to @code{inf}.
 
 Function calls are written the usual way, with the function name followed
 by the arguments in parentheses.  However, functions for which @TeX{}
-and La@TeX{} have special names (like @code{\sin}) will use curly braces
+and @LaTeX{} have special names (like @code{\sin}) will use curly braces
 instead of parentheses for very simple arguments.  During input, curly
 braces and parentheses work equally well for grouping, but when the
 document is formatted the curly braces will be invisible.  Thus the
@@ -14125,14 +14125,14 @@ The @TeX{} specific unit names (@pxref{Predefined Units}) will not use
 the @samp{tex} prefix;  the unit name for a @TeX{} point will be
 @samp{pt} instead of @samp{texpt}, for example.
 
-Function and variable names not treated specially by @TeX{} and La@TeX{}
+Function and variable names not treated specially by @TeX{} and @LaTeX{}
 are simply written out as-is, which will cause them to come out in
 italic letters in the printed document.  If you invoke @kbd{d T} or
 @kbd{d L} with a positive numeric prefix argument, names of more than
 one character will instead be enclosed in a protective commands that
 will prevent them from being typeset in the math italics; they will be
 written @samp{\hbox@{@var{name}@}} in @TeX{} mode and
-@samp{\text@{@var{name}@}} in La@TeX{} mode.  The
+@samp{\text@{@var{name}@}} in @LaTeX{} mode.  The
 @samp{\hbox@{ @}} and @samp{\text@{ @}} notations are ignored during
 reading.  If you use a negative prefix argument, such function names are
 written @samp{\@var{name}}, and function names that begin with @code{\} during
@@ -14143,7 +14143,7 @@ any @TeX{} mode.)
 
 During reading, text of the form @samp{\matrix@{ ...@: @}} is replaced
 by @samp{[ ...@: ]}.  The same also applies to @code{\pmatrix} and
-@code{\bmatrix}.  In La@TeX{} mode this also applies to
+@code{\bmatrix}.  In @LaTeX{} mode this also applies to
 @samp{\begin@{matrix@} ... \end@{matrix@}},
 @samp{\begin@{bmatrix@} ... \end@{bmatrix@}},
 @samp{\begin@{pmatrix@} ... \end@{pmatrix@}}, as well as
@@ -14153,7 +14153,7 @@ and the symbols @samp{\cr} and @samp{\\} are interpreted as semicolons.
 During output, matrices are displayed in @samp{\matrix@{ a & b \\ c & d@}}
 format in @TeX{} mode and in
 @samp{\begin@{pmatrix@} a & b \\ c & d \end@{pmatrix@}} format in
-La@TeX{} mode; you may need to edit this afterwards to change to your
+@LaTeX{} mode; you may need to edit this afterwards to change to your
 preferred matrix form.  If you invoke @kbd{d T} or @kbd{d L} with an
 argument of 2 or -2, then matrices will be displayed in two-dimensional
 form, such as
@@ -14177,7 +14177,7 @@ c & d
 @end example
 
 @noindent
-While this wouldn't bother Calc, it is incorrect La@TeX{}.
+While this wouldn't bother Calc, it is incorrect @LaTeX{}.
 (Similarly for @TeX{}.)
 
 Accents like @code{\tilde} and @code{\bar} translate into function
@@ -14185,7 +14185,7 @@ calls internally (@samp{tilde(x)}, @samp{bar(x)}).  The @code{\underline}
 sequence is treated as an accent.  The @code{\vec} accent corresponds
 to the function name @code{Vec}, because @code{vec} is the name of
 a built-in Calc function.  The following table shows the accents
-in Calc, @TeX{}, La@TeX{} and @dfn{eqn} (described in the next section):
+in Calc, @TeX{}, @LaTeX{} and @dfn{eqn} (described in the next section):
 
 @ignore
 @iftex
@@ -14362,7 +14362,7 @@ reading is:
 @end example
 
 Note that, because these symbols are ignored, reading a @TeX{} or
-La@TeX{} formula into Calc and writing it back out may lose spacing and
+@LaTeX{} formula into Calc and writing it back out may lose spacing and
 font information.
 
 Also, the ``discretionary multiplication sign'' @samp{\*} is read
@@ -14528,7 +14528,7 @@ treated the same as a space in @dfn{eqn} mode, as is the @samp{~}
 symbol (these are used to introduce spaces of various widths into
 the typeset output of @dfn{eqn}).
 
-As in La@TeX{} mode, Calc's formatter omits parentheses around the
+As in @LaTeX{} mode, Calc's formatter omits parentheses around the
 arguments of functions like @code{ln} and @code{sin} if they are
 ``simple-looking''; in this case Calc surrounds the argument with
 braces, separated by a @samp{~} from the function name: @samp{sin~@{x@}}.
@@ -15939,7 +15939,7 @@ FORTRAN language mode (@kbd{d F}).
 @TeX{} language mode (@kbd{d T}; @pxref{TeX and LaTeX Language Modes}).
 
 @item LaTeX
-La@TeX{} language mode (@kbd{d L}; @pxref{TeX and LaTeX Language Modes}).
+@LaTeX{} language mode (@kbd{d L}; @pxref{TeX and LaTeX Language Modes}).
 
 @item Eqn
 @dfn{Eqn} language mode (@kbd{d E}; @pxref{Eqn Language Mode}).
@@ -27778,6 +27778,11 @@ acres per meter-second.)  Remainder units are expressed in terms of
 ``fundamental'' units like @samp{m} and @samp{s}, regardless of the
 input units.
 
+If you want to disallow using inconsistent units, you can set the customizable variable
+@code{calc-ensure-consistent-units} to @code{t} (@pxref{Customizing Calc}).  In this case, 
+if you request units which are inconsistent with the original units, you will be warned about
+it and no conversion will occur.
+
 One special exception is that if you specify a single unit name, and
 a compatible unit appears somewhere in the units expression, then
 that compatible unit will be converted to the new unit and the
@@ -27997,7 +28002,7 @@ than the point used by @TeX{}), @code{texdd} (a Didot point),
 @code{texcc} (a Cicero) and @code{texsp} (a scaled @TeX{} point,
 all dimensions representable in @TeX{} are multiples of this value).
 
-When Calc is using the @TeX{} or La@TeX{} language mode (@pxref{TeX
+When Calc is using the @TeX{} or @LaTeX{} language mode (@pxref{TeX
 and LaTeX Language Modes}), the @TeX{} specific unit names will not
 use the @samp{tex} prefix; the unit name for a @TeX{} point will be
 @samp{pt} instead of @samp{texpt}, for example.  To avoid conflicts,
@@ -28906,7 +28911,7 @@ since the evaluation step will also evaluate @code{pi}.
 @cindex @samp{=>} operator
 The special algebraic symbol @samp{=>} is known as the @dfn{evaluates-to
 operator}.  (It will show up as an @code{evalto} function call in
-other language modes like Pascal and La@TeX{}.)  This is a binary
+other language modes like Pascal and @LaTeX{}.)  This is a binary
 operator, that is, it has a lefthand and a righthand argument,
 although it can be entered with the righthand argument omitted.
 
@@ -30485,7 +30490,7 @@ are visiting your own files.
 
 Calc will try to guess an appropriate language based on the major mode
 of the editing buffer. (@xref{Language Modes}.) If the current buffer is
-in @code{latex-mode}, for example, Calc will set its language to La@TeX{}.
+in @code{latex-mode}, for example, Calc will set its language to @LaTeX{}.
 Similarly, Calc will use @TeX{} language for @code{tex-mode},
 @code{plain-tex-mode} and @code{context-mode}, C language for
 @code{c-mode} and @code{c++-mode}, FORTRAN language for
@@ -30502,7 +30507,7 @@ understands are:
 
 @enumerate
 @item
-The @TeX{} and La@TeX{} math delimiters @samp{$ $}, @samp{$$ $$},
+The @TeX{} and @LaTeX{} math delimiters @samp{$ $}, @samp{$$ $$},
 @samp{\[ \]}, and @samp{\( \)};
 @item
 Lines beginning with @samp{\begin} and @samp{\end} (except matrix delimiters);
@@ -30642,14 +30647,14 @@ you haven't done anything with this formula yet.
 When Embedded mode ``activates'' a formula, i.e., when it examines
 the formula for the first time since the buffer was created or
 loaded, Calc tries to sense the language in which the formula was
-written.  If the formula contains any La@TeX{}-like @samp{\} sequences,
-it is parsed (i.e., read) in La@TeX{} mode.  If the formula appears to
+written.  If the formula contains any @LaTeX{}-like @samp{\} sequences,
+it is parsed (i.e., read) in @LaTeX{} mode.  If the formula appears to
 be written in multi-line Big mode, it is parsed in Big mode.  Otherwise,
 it is parsed according to the current language mode.
 
 Note that Calc does not change the current language mode according
-the formula it reads in.  Even though it can read a La@TeX{} formula when
-not in La@TeX{} mode, it will immediately rewrite this formula using
+the formula it reads in.  Even though it can read a @LaTeX{} formula when
+not in @LaTeX{} mode, it will immediately rewrite this formula using
 whatever language mode is in effect.
 
 @tex
@@ -30670,8 +30675,8 @@ version.
 
 Plain formulas are preceded and followed by @samp{%%%} signs
 by default.  This notation has the advantage that the @samp{%}
-character begins a comment in @TeX{} and La@TeX{}, so if your formula is
-embedded in a @TeX{} or La@TeX{} document its plain version will be
+character begins a comment in @TeX{} and @LaTeX{}, so if your formula is
+embedded in a @TeX{} or @LaTeX{} document its plain version will be
 invisible in the final printed copy.  Certain major modes have different
 delimiters to ensure that the ``plain'' version will be
 in a comment for those modes, also.
@@ -30957,7 +30962,7 @@ a few lines that look like this:
 @noindent
 where the leading and trailing @samp{---} can be replaced by
 any suitable strings (which must be the same on all three lines)
-or omitted altogether; in a @TeX{} or La@TeX{} file, @samp{%} would be a good
+or omitted altogether; in a @TeX{} or @LaTeX{} file, @samp{%} would be a good
 leading string and no trailing string would be necessary.  In a
 C program, @samp{/*} and @samp{*/} would be good leading and
 trailing strings.
@@ -35387,7 +35392,7 @@ The simplest delimiters are blank lines.  Other delimiters that
 Embedded mode understands by default are:
 @enumerate
 @item
-The @TeX{} and La@TeX{} math delimiters @samp{$ $}, @samp{$$ $$},
+The @TeX{} and @LaTeX{} math delimiters @samp{$ $}, @samp{$$ $$},
 @samp{\[ \]}, and @samp{\( \)};
 @item
 Lines beginning with @samp{\begin} and @samp{\end} (except matrix delimiters);
@@ -35591,6 +35596,19 @@ as @samp{a/(b*c)}. If @code{calc-multiplication-has-precedence} is
 of @code{calc-multiplication-has-precedence} is @code{t}.
 @end defvar
 
+@defvar calc-ensure-consistent-units
+When converting units, the variable @code{calc-ensure-consistent-units} 
+determines whether or not the target units need to be consistent with the 
+original units.  If @code{calc-ensure-consistent-units} is @code{nil}, then
+the target units don't need to have the same dimensions as the original units; 
+for example, converting @samp{100 ft/s} to @samp{m} will produce @samp{30.48 m/s}.   
+If  @code{calc-ensure-consistent-units} is non-@code{nil}, then the target units 
+need to have the same dimensions as the original units; for example, converting 
+@samp{100 ft/s} to @samp{m} will result in an error, since @samp{ft/s} and @samp{m} 
+have different dimensions. The default value of @code{calc-ensure-consistent-units} 
+is @code{nil}.
+@end defvar
+
 @defvar calc-undo-length
 The variable @code{calc-undo-length} determines the number of undo
 steps that Calc will keep track of when @code{calc-quit} is called.
index d35c14acd1deaf79e0b3dde7a31ae0a65a9f49cd..9195ca3f10c821ee572a6da3ca8057d94f9959e4 100644 (file)
@@ -45,16 +45,10 @@ developing GNU and promoting software freedom.''
 
 @contents
 
-@node Top, Overview, (dir), (dir)
-@chapter Introduction
-
-@noindent
-This document describes a set of Emacs Lisp facilities borrowed from
-Common Lisp.  All the facilities are described here in detail.  While
-this document does not assume any prior knowledge of Common Lisp, it
-does assume a basic familiarity with Emacs Lisp.
-
 @ifnottex
+@node Top
+@top GNU Emacs Common Lisp Emulation
+
 @insertcopying
 @end ifnottex
 
@@ -82,12 +76,15 @@ does assume a basic familiarity with Emacs Lisp.
 * Variable Index::
 @end menu
 
-@node Overview, Program Structure, Top, Top
-@ifnottex
+@node Overview
 @chapter Overview
-@end ifnottex
 
 @noindent
+This document describes a set of Emacs Lisp facilities borrowed from
+Common Lisp.  All the facilities are described here in detail.  While
+this document does not assume any prior knowledge of Common Lisp, it
+does assume a basic familiarity with Emacs Lisp.
+
 Common Lisp is a huge language, and Common Lisp systems tend to be
 massive and extremely complex.  Emacs Lisp, by contrast, is rather
 minimalist in the choice of Lisp features it offers the programmer.
@@ -150,7 +147,7 @@ environment.
 * Naming Conventions::   Notes on CL function names
 @end menu
 
-@node Usage, Organization, Overview, Overview
+@node Usage
 @section Usage
 
 @noindent
@@ -166,7 +163,7 @@ It is safe to arrange to load @dfn{CL} at all times, e.g.,
 in your @file{.emacs} file.  But it's a good idea, for portability,
 to @code{(require 'cl)} in your code even if you do this.
 
-@node Organization, Installation, Usage, Overview
+@node Organization
 @section Organization
 
 @noindent
@@ -212,7 +209,7 @@ like @code{defkeyword}, and an emulation of the old-style
 multiple-values feature.  This file is obsolete and should not be used
 in new code.  @xref{Old CL Compatibility}.
 
-@node Installation, Naming Conventions, Organization, Overview
+@node Installation
 @section Installation
 
 @noindent
@@ -226,7 +223,7 @@ directory on your @code{load-path}.  Also, format the @file{cl.texi}
 file and put the resulting Info files into a directory in your
 @code{Info-directory-list}.
 
-@node Naming Conventions,  , Installation, Overview
+@node Naming Conventions
 @section Naming Conventions
 
 @noindent
@@ -280,11 +277,7 @@ and @code{:key} is not used.
 @noindent
 [4] Only when @var{place} is a plain variable name.
 
-@iftex
-@chapno=4
-@end iftex
-
-@node Program Structure, Predicates, Overview, Top
+@node Program Structure
 @chapter Program Structure
 
 @noindent
@@ -301,7 +294,7 @@ and the @code{eval-when} construct.
 @secno=1
 @end iftex
 
-@node Argument Lists, Time of Evaluation, Program Structure, Program Structure
+@node Argument Lists
 @section Argument Lists
 
 @noindent
@@ -525,7 +518,7 @@ If the optimization quality @code{safety} is set to 0
 arguments and invalid keyword arguments is disabled.  By default,
 argument lists are rigorously checked.
 
-@node Time of Evaluation,  , Argument Lists, Program Structure
+@node Time of Evaluation
 @section Time of Evaluation
 
 @noindent
@@ -675,7 +668,7 @@ Byte-compiled, the above defun will result in the following code
 @end example
 @end defspec
 
-@node Predicates, Control Structure, Program Structure, Top
+@node Predicates
 @chapter Predicates
 
 @noindent
@@ -687,7 +680,7 @@ facts are true or false.
 * Equality Predicates::  @code{equalp}
 @end menu
 
-@node Type Predicates, Equality Predicates, Predicates, Predicates
+@node Type Predicates
 @section Type Predicates
 
 @noindent
@@ -820,7 +813,7 @@ names.  @xref{Conditionals}.  @xref{Assertions}.  The @code{map},
 @code{concatenate}, and @code{merge} functions take type-name
 arguments to specify the type of sequence to return.  @xref{Sequences}.
 
-@node Equality Predicates,  , Type Predicates, Predicates
+@node Equality Predicates
 @section Equality Predicates
 
 @noindent
@@ -848,7 +841,7 @@ MacLisp tradition and uses @code{equal} for these two functions.
 In Emacs, use @code{member*} and @code{assoc*} to get functions
 which use @code{eql} for comparisons.
 
-@node Control Structure, Macros, Predicates, Top
+@node Control Structure
 @chapter Control Structure
 
 @noindent
@@ -868,7 +861,7 @@ constructs.
 * Multiple Values::        @code{values}, @code{multiple-value-bind}, etc.
 @end menu
 
-@node Assignment, Generalized Variables, Control Structure, Control Structure
+@node Assignment
 @section Assignment
 
 @noindent
@@ -905,7 +898,7 @@ provides an even more convenient way to swap two variables;
 @code{psetq} always returns @code{nil}.
 @end defspec
 
-@node Generalized Variables, Variable Bindings, Assignment, Control Structure
+@node Generalized Variables
 @section Generalized Variables
 
 @noindent
@@ -934,7 +927,7 @@ is a set of forms that can be generalized variables in Lisp.
 * Customizing Setf::   @code{define-modify-macro}, @code{defsetf}, @code{define-setf-method}
 @end menu
 
-@node Basic Setf, Modify Macros, Generalized Variables, Generalized Variables
+@node Basic Setf
 @subsection Basic Setf
 
 @noindent
@@ -1105,7 +1098,7 @@ evaluate @var{b} first, then @var{a}, just as in an actual call
 to @code{wrong-order}.
 @end defspec
 
-@node Modify Macros, Customizing Setf, Basic Setf, Generalized Variables
+@node Modify Macros
 @subsection Modify Macros
 
 @noindent
@@ -1316,7 +1309,7 @@ blocks for other macros like @code{incf}, @code{pushnew}, and
 macros are used in the processing of symbol macros;
 @pxref{Macro Bindings}.
 
-@node Customizing Setf,  , Modify Macros, Generalized Variables
+@node Customizing Setf
 @subsection Customizing Setf
 
 @noindent
@@ -1529,7 +1522,7 @@ defined later.
 @secno=4
 @end iftex
 
-@node Variable Bindings, Conditionals, Generalized Variables, Control Structure
+@node Variable Bindings
 @section Variable Bindings
 
 @noindent
@@ -1546,7 +1539,7 @@ are also related to variable bindings.
 * Macro Bindings::       @code{macrolet} and @code{symbol-macrolet}
 @end menu
 
-@node Dynamic Bindings, Lexical Bindings, Variable Bindings, Variable Bindings
+@node Dynamic Bindings
 @subsection Dynamic Bindings
 
 @noindent
@@ -1566,7 +1559,7 @@ If @var{symbols} is shorter than @var{values}, the excess values
 are ignored.
 @end defspec
 
-@node Lexical Bindings, Function Bindings, Dynamic Bindings, Variable Bindings
+@node Lexical Bindings
 @subsection Lexical Bindings
 
 @noindent
@@ -1680,7 +1673,7 @@ This form is just like @code{lexical-let}, except that the bindings
 are made sequentially in the manner of @code{let*}.
 @end defspec
 
-@node Function Bindings, Macro Bindings, Lexical Bindings, Variable Bindings
+@node Function Bindings
 @subsection Function Bindings
 
 @noindent
@@ -1756,7 +1749,7 @@ function, or a use of its name quoted by @code{quote} or
 @code{function} to be passed on to, say, @code{mapcar}.
 @end defspec
 
-@node Macro Bindings,  , Function Bindings, Variable Bindings
+@node Macro Bindings
 @subsection Macro Bindings
 
 @noindent
@@ -1843,7 +1836,7 @@ This package defines a nonstandard @code{in-ref} loop clause that
 works much like @code{my-dolist}.
 @end defspec
 
-@node Conditionals, Blocks and Exits, Variable Bindings, Control Structure
+@node Conditionals
 @section Conditionals
 
 @noindent
@@ -1917,7 +1910,7 @@ not match any of the clauses, an error is signaled rather than
 simply returning @code{nil}.
 @end defspec
 
-@node Blocks and Exits, Iteration, Conditionals, Control Structure
+@node Blocks and Exits
 @section Blocks and Exits
 
 @noindent
@@ -1982,7 +1975,7 @@ Common Lisp loops like @code{do} and @code{dolist} implicitly enclose
 themselves in @code{nil} blocks.
 @end defspec
 
-@node Iteration, Loop Facility, Blocks and Exits, Control Structure
+@node Iteration
 @section Iteration
 
 @noindent
@@ -2126,7 +2119,7 @@ argument is omitted; it always iterates over the default obarray.
 @xref{Mapping over Sequences}, for some more functions for
 iterating over vectors or lists.
 
-@node Loop Facility, Multiple Values, Iteration, Control Structure
+@node Loop Facility
 @section Loop Facility
 
 @noindent
@@ -2148,7 +2141,7 @@ with an easy-to-use but very powerful and expressive syntax.
 * Other Clauses::         @code{with}, @code{if}, @code{initially}, @code{finally}
 @end menu
 
-@node Loop Basics, Loop Examples, Loop Facility, Loop Facility
+@node Loop Basics
 @subsection Loop Basics
 
 @noindent
@@ -2207,7 +2200,7 @@ action, and describe the particular loop clauses in great detail.
 Consult the second edition of Steele's @dfn{Common Lisp, the Language},
 for additional discussion and examples of the @code{loop} macro.
 
-@node Loop Examples, For Clauses, Loop Basics, Loop Facility
+@node Loop Examples
 @subsection Loop Examples
 
 @noindent
@@ -2280,7 +2273,7 @@ define loops all by themselves, it still creates a single loop
 rather than some sort of triple-nested loop.  You must explicitly
 nest your @code{loop} constructs if you want nested loops.
 
-@node For Clauses, Iteration Clauses, Loop Examples, Loop Facility
+@node For Clauses
 @subsection For Clauses
 
 @noindent
@@ -2595,7 +2588,7 @@ to process an alist
      @result{} (1 2)
 @end example
 
-@node Iteration Clauses, Accumulation Clauses, For Clauses, Loop Facility
+@node Iteration Clauses
 @subsection Iteration Clauses
 
 @noindent
@@ -2654,7 +2647,7 @@ in this case, it returns that non-@code{nil} value.  If all the
 values were @code{nil}, the loop returns @code{nil}.
 @end table
 
-@node Accumulation Clauses, Other Clauses, Iteration Clauses, Loop Facility
+@node Accumulation Clauses
 @subsection Accumulation Clauses
 
 @noindent
@@ -2723,7 +2716,7 @@ accumulate into the same place.  From Steele:
      @result{} (fred bob ken sue alice joe kris sunshine june)
 @end example
 
-@node Other Clauses,  , Accumulation Clauses, Loop Facility
+@node Other Clauses
 @subsection Other Clauses
 
 @noindent
@@ -2874,7 +2867,7 @@ and data-type specifiers.  Naturally, the @code{for} clauses which
 iterate over keymaps, overlays, intervals, frames, windows, and
 buffers are Emacs-specific extensions.
 
-@node Multiple Values,  , Loop Facility, Control Structure
+@node Multiple Values
 @section Multiple Values
 
 @noindent
@@ -2916,7 +2909,7 @@ form would see them.
 Since a perfect emulation is not feasible in Emacs Lisp, this
 package opts to keep it as simple and predictable as possible.
 
-@node Macros, Declarations, Control Structure, Top
+@node Macros
 @chapter Macros
 
 @noindent
@@ -2994,7 +2987,7 @@ for which no further expansion is possible.
 and @code{symbol-macrolet} forms for making ``local'' macro
 definitions.
 
-@node Declarations, Symbols, Macros, Top
+@node Declarations
 @chapter Declarations
 
 @noindent
@@ -3176,7 +3169,7 @@ disable these warnings and any higher value will enable them.
 See the documentation for the optimizing byte compiler for details.
 @end table
 
-@node Symbols, Numbers, Declarations, Top
+@node Symbols
 @chapter Symbols
 
 @noindent
@@ -3188,7 +3181,7 @@ missing from Emacs Lisp.
 * Creating Symbols::     @code{gensym}, @code{gentemp}
 @end menu
 
-@node Property Lists, Creating Symbols, Symbols, Symbols
+@node Property Lists
 @section Property Lists
 
 @noindent
@@ -3273,7 +3266,7 @@ out the property and value cells.
 @secno=2
 @end iftex
 
-@node Creating Symbols,  , Property Lists, Symbols
+@node Creating Symbols
 @section Creating Symbols
 
 @noindent
@@ -3318,11 +3311,7 @@ automatically creates all keywords that are called for by
 keywords as data unrelated to keyword arguments, so the
 @code{defkeyword} form has been discontinued.
 
-@iftex
-@chapno=11
-@end iftex
-
-@node Numbers, Sequences, Symbols, Top
+@node Numbers
 @chapter Numbers
 
 @noindent
@@ -3340,7 +3329,7 @@ which were left out of Emacs Lisp.
 @secno=1
 @end iftex
 
-@node Predicates on Numbers, Numerical Functions, Numbers, Numbers
+@node Predicates on Numbers
 @section Predicates on Numbers
 
 @noindent
@@ -3377,7 +3366,7 @@ to @code{floatp}.  On other systems, this always returns @code{nil}.
 @secno=3
 @end iftex
 
-@node Numerical Functions, Random Numbers, Predicates on Numbers, Numbers
+@node Numerical Functions
 @section Numerical Functions
 
 @noindent
@@ -3473,7 +3462,7 @@ multiple values is different.
 @secno=8
 @end iftex
 
-@node Random Numbers, Implementation Parameters, Numerical Functions, Numbers
+@node Random Numbers
 @section Random Numbers
 
 @noindent
@@ -3534,7 +3523,7 @@ This predicate returns @code{t} if @var{object} is a
 @code{random-state} object, or @code{nil} otherwise.
 @end defun
 
-@node Implementation Parameters,  , Random Numbers, Numbers
+@node Implementation Parameters
 @section Implementation Parameters
 
 @noindent
@@ -3615,11 +3604,7 @@ This is the smallest positive value that can be subtracted from
 @code{1.11e-16}.
 @end defvar
 
-@iftex
-@chapno=13
-@end iftex
-
-@node Sequences, Lists, Numbers, Top
+@node Sequences
 @chapter Sequences
 
 @noindent
@@ -3636,7 +3621,7 @@ Emacs Lisp includes a few of these, notably @code{elt} and
 * Sorting Sequences::        @code{sort*}, @code{stable-sort}, @code{merge}
 @end menu
 
-@node Sequence Basics, Mapping over Sequences, Sequences, Sequences
+@node Sequence Basics
 @section Sequence Basics
 
 @noindent
@@ -3713,7 +3698,7 @@ example, @code{(remove* ?A @var{str})} may or may not preserve
 the properties of the characters copied from @var{str} into the
 result.
 
-@node Mapping over Sequences, Sequence Functions, Sequence Basics, Sequences
+@node Mapping over Sequences
 @section Mapping over Sequences
 
 @noindent
@@ -3851,7 +3836,7 @@ terms of the @code{loop} macro.  In compiled code, @code{loop} will
 be faster since it generates the loop as in-line code with no
 function calls.
 
-@node Sequence Functions, Searching Sequences, Mapping over Sequences, Sequences
+@node Sequence Functions
 @section Sequence Functions
 
 @noindent
@@ -3978,7 +3963,7 @@ The @code{substitute-if}, @code{substitute-if-not}, @code{nsubstitute-if},
 and @code{nsubstitute-if-not} functions are defined similarly.  For
 these, a @var{predicate} is given in place of the @var{old} argument.
 
-@node Searching Sequences, Sorting Sequences, Sequence Functions, Sequences
+@node Searching Sequences
 @section Searching Sequences
 
 @noindent
@@ -4047,7 +4032,7 @@ if no matches were found.  If @code{:from-end} is true, the
 function finds the @emph{rightmost} matching subsequence.
 @end defun
 
-@node Sorting Sequences,  , Searching Sequences, Sequences
+@node Sorting Sequences
 @section Sorting Sequences
 
 @defun sort* seq predicate @t{&key :key}
@@ -4106,7 +4091,7 @@ a merged sequence which is (stably) sorted according to
 @var{predicate}.
 @end defun
 
-@node Lists, Structures, Sequences, Top
+@node Lists
 @chapter Lists
 
 @noindent
@@ -4119,7 +4104,7 @@ The functions described here operate on lists.
 * Association Lists::             @code{assoc*}, @code{rassoc*}, @code{acons}, @code{pairlis}
 @end menu
 
-@node List Functions, Substitution of Expressions, Lists, Lists
+@node List Functions
 @section List Functions
 
 @noindent
@@ -4212,7 +4197,7 @@ applied to the elements of both trees.  @xref{Sequences}.
 @secno=3
 @end iftex
 
-@node Substitution of Expressions, Lists as Sets, List Functions, Lists
+@node Substitution of Expressions
 @section Substitution of Expressions
 
 @noindent
@@ -4261,7 +4246,7 @@ function, if any), is compared with the @code{car}s of
 This is a destructive version of @code{sublis}.
 @end defun
 
-@node Lists as Sets, Association Lists, Substitution of Expressions, Lists
+@node Lists as Sets
 @section Lists as Sets
 
 @noindent
@@ -4360,7 +4345,7 @@ of @var{list2}, i.e., whether every element of @var{list1}
 also appears in @var{list2}.
 @end defun
 
-@node Association Lists,  , Lists as Sets, Lists
+@node Association Lists
 @section Association Lists
 
 @noindent
@@ -4404,11 +4389,7 @@ This is equivalent to @code{(nconc (mapcar* 'cons @var{keys} @var{values})
 @var{alist})}.
 @end defun
 
-@iftex
-@chapno=18
-@end iftex
-
-@node Structures, Assertions, Lists, Top
+@node Structures
 @chapter Structures
 
 @noindent
@@ -4738,11 +4719,7 @@ of the included type and the first new slot.
 Except as noted, the @code{defstruct} facility of this package is
 entirely compatible with that of Common Lisp.
 
-@iftex
-@chapno=23
-@end iftex
-
-@node Assertions, Efficiency Concerns, Structures, Top
+@node Assertions
 @chapter Assertions and Errors
 
 @noindent
@@ -4814,7 +4791,7 @@ If the @var{forms} complete successfully, @code{ignore-errors}
 returns the result of the last @var{form}.
 @end defspec
 
-@node Efficiency Concerns, Common Lisp Compatibility, Assertions, Top
+@node Efficiency Concerns
 @appendix Efficiency Concerns
 
 @appendixsec Macros
@@ -4957,7 +4934,7 @@ code which can be improved by optimization.  In particular,
 optimizing compiler removes @code{block}s which are not actually
 referenced by @code{return} or @code{return-from} inside the block.
 
-@node Common Lisp Compatibility, Old CL Compatibility, Efficiency Concerns, Top
+@node Common Lisp Compatibility
 @appendix Common Lisp Compatibility
 
 @noindent
@@ -5019,7 +4996,7 @@ special, distinct type.  Also, the @code{:type} slot option is ignored.
 
 The second argument of @code{check-type} is treated differently.
 
-@node Old CL Compatibility, Porting Common Lisp, Common Lisp Compatibility, Top
+@node Old CL Compatibility
 @appendix Old CL Compatibility
 
 @noindent
@@ -5120,7 +5097,7 @@ older versions of the old package used the unadorned names
 @code{floor}, @code{ceiling}, etc.; @code{cl-compat} cannot use
 these names because they conflict with Emacs built-ins.
 
-@node Porting Common Lisp, GNU Free Documentation License, Old CL Compatibility, Top
+@node Porting Common Lisp
 @appendix Porting Common Lisp
 
 @noindent
@@ -5326,16 +5303,16 @@ note that the current Emacs Lisp compiler does not optimize tail
 recursion.
 @end itemize
 
-@node GNU Free Documentation License, Function Index, Porting Common Lisp, Top
+@node GNU Free Documentation License
 @appendix GNU Free Documentation License
 @include doclicense.texi
 
-@node Function Index, Variable Index, GNU Free Documentation License, Top
+@node Function Index
 @unnumbered Function Index
 
 @printindex fn
 
-@node Variable Index,  , Function Index, Top
+@node Variable Index
 @unnumbered Variable Index
 
 @printindex vr
index 204afe7056ee65838ac11b265d64d446c4ffc0f1..865e99a3aa60a2c9aa5320c4df3f7531be3f3c80 100644 (file)
@@ -53,7 +53,7 @@ another.  An overview of D-Bus can be found at
 * Asynchronous Methods::        Calling methods non-blocking.
 * Receiving Method Calls::      Offering own methods.
 * Signals::                     Sending and receiving signals.
-* Alternative Buses::           Alternative buses.
+* Alternative Buses::           Alternative buses and environments.
 * Errors and Events::           Errors and events.
 * Index::                       Index including concepts, functions, variables.
 
@@ -116,6 +116,7 @@ name could be @samp{org.gnu.Emacs.TextEditor} or
 @cindex inspection
 
 @menu
+* Version::                     Determining the D-Bus version.
 * Bus names::                   Discovering D-Bus names.
 * Introspection::               Knowing the details of D-Bus services.
 * Nodes and Interfaces::        Detecting object paths and interfaces.
@@ -125,6 +126,25 @@ name could be @samp{org.gnu.Emacs.TextEditor} or
 @end menu
 
 
+@node Version
+@section D-Bus version.
+
+D-Bus has evolved over the years.  New features have been added with
+new D-Bus versions.  There are two variables, which allow to determine
+the used D-Bus version.
+
+@defvar dbus-compiled-version
+This variable, a string, determines the version of D-Bus Emacs is
+compiled against.  If it cannot be determined the value is @code{nil}.
+@end defvar
+
+@defvar dbus-runtime-version
+The other D-Bus version to be checked is the version of D-Bus Emacs
+runs with.  This string can be different from @code{dbus-compiled-version}.
+It is also @code{nil}, if it cannot be determined at runtime.
+@end defvar
+
+
 @node Bus names
 @section Bus names.
 
@@ -149,7 +169,6 @@ activatable service names at all.  Example:
 (member "org.gnome.evince.Daemon"
         (dbus-list-activatable-names :session))
 @end lisp
-
 @end defun
 
 @defun dbus-list-names bus
@@ -637,6 +656,12 @@ Interfaces can have properties.  These can be exposed via the
 That is, properties can be retrieved and changed during lifetime of an
 element.
 
+A generalized interface is
+@samp{org.freedesktop.DBus.Objectmanager}@footnote{See
+@uref{http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager}},
+which returns objects, their interfaces and properties for a given
+service in just one call.
+
 Annotations, on the other hand, are static values for an element.
 Often, they are used to instruct generators, how to generate code from
 the interface for a given language binding.
@@ -732,6 +757,61 @@ If there are no properties, @code{nil} is returned.  Example:
 @end lisp
 @end defun
 
+@defun dbus-get-all-managed-objects bus service path
+This functions returns all objects at @var{bus}, @var{service},
+@var{path}, and the children of @var{path}.  The result is a list of
+objects.  Every object is a cons of an existing path name, and the
+list of available interface objects.  An interface object is another
+cons, which car is the interface name, and the cdr is the list of
+properties as returned by @code{dbus-get-all-properties} for that path
+and interface. Example:
+
+@lisp
+(dbus-get-all-managed-objects
+  :session "org.gnome.SettingsDaemon" "/")
+
+@result{} (("/org/gnome/SettingsDaemon/MediaKeys"
+     ("org.gnome.SettingsDaemon.MediaKeys")
+     ("org.freedesktop.DBus.Peer")
+     ("org.freedesktop.DBus.Introspectable")
+     ("org.freedesktop.DBus.Properties")
+     ("org.freedesktop.DBus.ObjectManager"))
+    ("/org/gnome/SettingsDaemon/Power"
+     ("org.gnome.SettingsDaemon.Power.Keyboard")
+     ("org.gnome.SettingsDaemon.Power.Screen")
+     ("org.gnome.SettingsDaemon.Power"
+      ("Icon" . ". GThemedIcon battery-full-charged-symbolic ")
+      ("Tooltip" . "Laptop battery is charged"))
+     ("org.freedesktop.DBus.Peer")
+     ("org.freedesktop.DBus.Introspectable")
+     ("org.freedesktop.DBus.Properties")
+     ("org.freedesktop.DBus.ObjectManager"))
+    @dots{})
+@end lisp
+
+If possible, @samp{org.freedesktop.DBus.ObjectManager.GetManagedObjects}
+is used for retrieving the information.  Otherwise, the information
+is collected via @samp{org.freedesktop.DBus.Introspectable.Introspect}
+and @samp{org.freedesktop.DBus.Properties.GetAll}, which is slow.
+
+An overview of all existing object paths, their interfaces and
+properties could be retrieved by the following code:
+
+@lisp
+(with-current-buffer (switch-to-buffer "*objectmanager*")
+  (erase-buffer)
+  (let (result)
+    (dolist (service (dbus-list-known-names :session) result)
+      (message "%s" service)
+      (add-to-list
+       'result
+       (cons service
+             (dbus-get-all-managed-objects :session service "/"))))
+    (insert (message "%s" (pp result)))
+    (redisplay t)))
+@end lisp
+@end defun
+
 @defun dbus-introspect-get-annotation-names bus service path interface &optional name
 Return a list of all annotation names as list of strings.  If
 @var{name} is @code{nil}, the annotations are children of
@@ -928,6 +1008,10 @@ represented outside this range are stripped of.  For example,
 @code{:byte ?x} is equal to @code{:byte ?\M-x}, but it is not equal to
 @code{:byte ?\C-x} or @code{:byte ?\M-\C-x}.
 
+Signed and unsigned integer D-Bus types expect a corresponding integer
+value.  If the value does not fit Emacs's integer range, it is also
+possible to use an equivalent floating point number.
+
 A D-Bus compound type is always represented as a list.  The @sc{car}
 of this list can be the type symbol @code{:array}, @code{:variant},
 @code{:struct} or @code{:dict-entry}, which would result in a
@@ -1182,24 +1266,6 @@ emulate the @code{lshal} command on GNU/Linux systems:
 @end lisp
 @end defun
 
-@defun dbus-call-method-non-blocking bus service path interface method &optional :timeout timeout &rest args
-Call @var{method} on the D-Bus @var{bus}, but don't block the event queue.
-This is necessary for communicating to registered D-Bus methods,
-which are running in the same Emacs process.
-
-The arguments are the same as in @code{dbus-call-method}.  Example:
-
-@lisp
-(dbus-call-method-non-blocking
-  :system "org.freedesktop.Hal"
-  "/org/freedesktop/Hal/devices/computer"
-  "org.freedesktop.Hal.Device" "GetPropertyString"
-  "system.kernel.machine")
-
-@result{} "i686"
-@end lisp
-@end defun
-
 
 @node Asynchronous Methods
 @chapter Calling methods non-blocking.
@@ -1229,7 +1295,7 @@ All other arguments args are passed to @var{method} as arguments.
 They are converted into D-Bus types as described in @ref{Type
 Conversion}.
 
-Unless @var{handler} is @code{nil}, the function returns a key into
+If @var{handler} is a Lisp function, the function returns a key into
 the hash table @code{dbus-registered-objects-table}.  The
 corresponding entry in the hash table is removed, when the return
 message has been arrived, and @var{handler} is called.  Example:
@@ -1241,7 +1307,7 @@ message has been arrived, and @var{handler} is called.  Example:
   "org.freedesktop.Hal.Device" "GetPropertyString" 'message
   "system.kernel.machine")
 
-@result{} (:system 2)
+@result{} (:serial :system 2)
 
 @print{} i686
 @end lisp
@@ -1323,19 +1389,21 @@ implementation of an interface of a well known service, like
 
 It could be also an implementation of an own interface.  In this case,
 the service name must be @samp{org.gnu.Emacs}.  The object path shall
-begin with @samp{/org/gnu/Emacs/@strong{Application}/}, and the
+begin with @samp{/org/gnu/Emacs/@strong{Application}}, and the
 interface name shall be @code{org.gnu.Emacs.@strong{Application}}.
 @samp{@strong{Application}} is the name of the application which
 provides the interface.
 
 @deffn Constant dbus-service-emacs
-The well known service name of Emacs.
+The well known service name @samp{org.gnu.Emacs} of Emacs.
 @end deffn
 
 @deffn Constant dbus-path-emacs
-The object path head "/org/gnu/Emacs" used by Emacs.  All object
-paths, used by offered methods or signals, shall start with this
-string.
+The object path namespace @samp{/org/gnu/Emacs} used by Emacs.
+@end deffn
+
+@deffn Constant dbus-interface-emacs
+The interface namespace @code{org.gnu.Emacs} used by Emacs.
 @end deffn
 
 @defun dbus-register-method bus service path interface method handler dont-register-service
@@ -1400,7 +1468,7 @@ registration for @var{method}.  Example:
   "org.freedesktop.TextEditor" "OpenFile"
   'my-dbus-method-handler)
 
-@result{} ((:session "org.freedesktop.TextEditor" "OpenFile")
+@result{} ((:method :session "org.freedesktop.TextEditor" "OpenFile")
     ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
      my-dbus-method-handler))
 @end lisp
@@ -1497,14 +1565,14 @@ clients from discovering the still incomplete interface.
   :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
   "org.freedesktop.TextEditor" "name" :read "GNU Emacs")
 
-@result{} ((:session "org.freedesktop.TextEditor" "name")
+@result{} ((:property :session "org.freedesktop.TextEditor" "name")
     ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"))
 
 (dbus-register-property
   :session "org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"
   "org.freedesktop.TextEditor" "version" :readwrite emacs-version t)
 
-@result{} ((:session "org.freedesktop.TextEditor" "version")
+@result{} ((:property :session "org.freedesktop.TextEditor" "version")
     ("org.freedesktop.TextEditor" "/org/freedesktop/TextEditor"))
 @end lisp
 
@@ -1569,8 +1637,8 @@ to the service from D-Bus.
 @chapter Sending and receiving signals.
 @cindex signals
 
-Signals are broadcast messages.  They carry input parameters, which
-are received by all objects which have registered for such a signal.
+Signals are one way messages.  They carry input parameters, which are
+received by all objects which have registered for such a signal.
 
 @defun dbus-send-signal bus service path interface signal &rest args
 This function is similar to @code{dbus-call-method}.  The difference
@@ -1580,10 +1648,14 @@ The function emits @var{signal} on the D-Bus @var{bus}.  @var{bus} is
 either the symbol @code{:system} or the symbol @code{:session}.  It
 doesn't matter whether another object has registered for @var{signal}.
 
-@var{service} is the D-Bus service name of the object the signal is
-emitted from.  @var{path} is the corresponding D-Bus object path,
-@var{service} is registered at.  @var{interface} is an interface
-offered by @var{service}.  It must provide @var{signal}.
+Signals can be unicast or broadcast messages.  For broadcast messages,
+@var{service} must be @code{nil}.  Otherwise, @var{service} is the
+D-Bus service name the signal is sent to as unicast
+message.@footnote{For backward compatibility, a broadcast message is
+also emitted if @var{service} is the known or unique name Emacs is
+registered at D-Bus @var{bus}.}  @var{path} is the D-Bus object path
+@var{signal} is sent from.  @var{interface} is an interface available
+at @var{path}.  It must provide @var{signal}.
 
 All other arguments args are passed to @var{signal} as arguments.
 They are converted into D-Bus types as described in @ref{Type
@@ -1591,15 +1663,15 @@ Conversion}.  Example:
 
 @lisp
 (dbus-send-signal
-  :session dbus-service-emacs dbus-path-emacs
-  (concat dbus-service-emacs ".FileManager") "FileModified"
+  :session nil dbus-path-emacs
+  (concat dbus-interface-emacs ".FileManager") "FileModified"
   "/home/albinus/.emacs")
 @end lisp
 @end defun
 
 @defun dbus-register-signal bus service path interface signal handler &rest args
-With this function, an application registers for @var{signal} on the
-D-Bus @var{bus}.
+With this function, an application registers for a signal on the D-Bus
+@var{bus}.
 
 @var{bus} is either the symbol @code{:system} or the symbol
 @code{:session}.
@@ -1611,24 +1683,46 @@ unique name of the object, owning @var{service} at registration time.
 When the corresponding D-Bus object disappears, signals won't be
 received any longer.
 
-When @var{service} is @code{nil}, related signals from all D-Bus
-objects shall be accepted.
-
 @var{path} is the corresponding D-Bus object path, @var{service} is
-registered at.  It can also be @code{nil} if the path name of incoming
-signals shall not be checked.
+registered at.  @var{interface} is an interface offered by
+@var{service}.  It must provide @var{signal}.
 
-@var{interface} is an interface offered by @var{service}.  It must
-provide @var{signal}.
+@var{service}, @var{path}, @var{interface} and @var{signal} can be
+@code{nil}.  This is interpreted as a wildcard for the respective
+argument.
 
 @var{handler} is a Lisp function to be called when the @var{signal} is
 received.  It must accept as arguments the output parameters
 @var{signal} is sending.
 
-All other arguments @var{args}, if specified, must be strings.  They
-stand for the respective arguments of @var{signal} in their order, and
-are used for filtering as well.  A @code{nil} argument might be used
-to preserve the order.
+The remaining arguments @var{args} can be keywords or keyword string
+pairs.@footnote{For backward compatibility, the arguments @var{args}
+can also be just strings.  They stand for the respective arguments of
+@var{signal} in their order, and are used for filtering as well.  A
+@code{nil} argument might be used to preserve the order.}  The meaning
+is as follows:
+
+@itemize
+@item @code{:argN} @var{string}:@*
+@code{:pathN} @var{string}:@*
+This stands for the Nth argument of the signal.  @code{:pathN}
+arguments can be used for object path wildcard matches as specified by
+D-Bus, while an @code{:argN} argument requires an exact match.
+
+@item @code{:arg-namespace} @var{string}:@*
+Register for the signals, which first argument defines the service or
+interface namespace @var{string}.
+
+@item @code{:path-namespace} @var{string}:@*
+Register for the object path namespace @var{string}.  All signals sent
+from an object path, which has @var{string} as the preceding string,
+are matched.  This requires @var{path} to be @code{nil}.
+
+@item @code{:eavesdrop}:@*
+Register for unicast signals which are not directed to the D-Bus
+object Emacs is registered at D-Bus BUS, if the security policy of BUS
+allows this.  Otherwise, this argument is ignored.
+@end itemize
 
 @code{dbus-register-signal} returns a Lisp object, which can be used
 as argument in @code{dbus-unregister-object} for removing the
@@ -1645,7 +1739,7 @@ registration for @var{signal}.  Example:
   "org.freedesktop.Hal.Manager" "DeviceAdded"
   'my-dbus-signal-handler)
 
-@result{} ((:system "org.freedesktop.Hal.Manager" "DeviceAdded")
+@result{} ((:signal :system "org.freedesktop.Hal.Manager" "DeviceAdded")
     ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager"
      my-signal-handler))
 @end lisp
@@ -1657,23 +1751,36 @@ The callback function @code{my-dbus-signal-handler} must define one
 single string argument therefore.  Plugging an USB device to your
 machine, when registered for signal @samp{DeviceAdded}, will show you
 which objects the GNU/Linux @code{hal} daemon adds.
+
+Some of the match rules have been added to a later version of D-Bus.
+In order to test the availability of such features, you could register
+for a dummy signal, and check the result:
+
+@lisp
+(dbus-ignore-errors
+  (dbus-register-signal
+    :system nil nil nil nil 'ignore :path-namespace "/invalid/path"))
+
+@result{} nil
+@end lisp
 @end defun
 
 
 @node Alternative Buses
-@chapter Alternative buses.
+@chapter Alternative buses and environments.
 @cindex bus names
 @cindex UNIX domain socket
+@cindex TCP/IP socket
 
 Until now, we have spoken about the system and the session buses,
 which are the default buses to be connected to.  However, it is
 possible to connect to any bus, from which the address is known.  This
-is a UNIX domain socket.  Everywhere, where a @var{bus} is mentioned
-as argument of a function (the symbol @code{:system} or the symbol
-@code{:session}), this address can be used instead.  The connection to
-this bus must be initialized first.
+is a UNIX domain or TCP/IP socket.  Everywhere, where a @var{bus} is
+mentioned as argument of a function (the symbol @code{:system} or the
+symbol @code{:session}), this address can be used instead.  The
+connection to this bus must be initialized first.
 
-@defun dbus-init-bus bus
+@defun dbus-init-bus bus &optional private
 Establish the connection to D-Bus @var{bus}.
 
 @var{bus} can be either the symbol @code{:system} or the symbol
@@ -1682,30 +1789,90 @@ corresponding bus.  For the system and session buses, this function
 is called when loading @file{dbus.el}, there is no need to call it
 again.
 
-Example: You open another session bus in a terminal window on your host:
+The function returns a number, which counts the connections this Emacs
+session has established to the @var{bus} under the same unique name
+(see @code{dbus-get-unique-name}).  It depends on the libraries Emacs
+is linked with, and on the environment Emacs is running.  For example,
+if Emacs is linked with the gtk toolkit, and it runs in a GTK-aware
+environment like Gnome, another connection might already be
+established.
 
-@example
-# eval `dbus-launch --auto-syntax`
-# echo $DBUS_SESSION_BUS_ADDRESS
+When @var{private} is non-@code{nil}, a new connection is established
+instead of reusing an existing one.  It results in a new unique name
+at the bus.  This can be used, if it is necessary to distinguish from
+another connection used in the same Emacs process, like the one
+established by GTK+.  It should be used with care for at least the
+@code{:system} and @code{:session} buses, because other Emacs Lisp
+packages might already use this connection to those buses.
 
-@print{} unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e
-@end example
-
-In Emacs, you can access to this bus via its address:
+Example: You initialize a connection to the AT-SPI bus on your host:
 
 @lisp
 (setq my-bus
-      "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e")
+  (dbus-call-method
+   :session "org.a11y.Bus" "/org/a11y/bus"
+   "org.a11y.Bus" "GetAddress"))
 
-@result{} "unix:abstract=/tmp/dbus-JoFtAVG92w,guid=2f320a1ebe50b7ef58e"
+@result{} "unix:abstract=/tmp/dbus-2yzWHOCdSD,guid=a490dd26625870ca1298b6e10000fd7f"
 
+;; If Emacs is built with gtk support, and you run in a GTK enabled
+;; environment (like a GNOME session), the initialization reuses the
+;; connection established by GTK's atk bindings.
 (dbus-init-bus my-bus)
 
-@result{} nil
+@result{} 2
 
 (dbus-get-unique-name my-bus)
 
-@result{} ":1.0"
+@result{} ":1.19"
+
+;; Open a new connection to the same bus.  This obsoletes the
+;; previous one.
+(dbus-init-bus my-bus 'private)
+
+@result{} 1
+
+(dbus-get-unique-name my-bus)
+
+@result{} ":1.20"
+@end lisp
+
+D-Bus addresses can specify different transport.  A possible address
+could be based on TCP/IP sockets, see next example.  However, it
+depends on the bus daemon configuration, which transport is supported.
+@end defun
+
+@defun dbus-setenv bus variable value
+Set the value of the @var{bus} environment variable @var{variable} to
+@var{value}.
+
+@var{bus} is either a Lisp symbol, @code{:system} or @code{:session},
+or a string denoting the bus address.  Both @var{variable} and
+@var{value} should be strings.
+
+Normally, services inherit the environment of the bus daemon.  This
+function adds to or modifies that environment when activating services.
+
+Some bus instances, such as @code{:system}, may disable setting the
+environment.  In such cases, or if this feature is not available in
+older D-Bus versions, a @code{dbus-error} error is raised.
+
+As an example, it might be desirable to start X11 enabled services on
+a remote host's bus on the same X11 server the local Emacs is
+running.  This could be achieved by
+
+@lisp
+(setq my-bus "unix:host=example.gnu.org,port=4711")
+
+@result{} "unix:host=example.gnu.org,port=4711"
+
+(dbus-init-bus my-bus)
+
+@result{} 1
+
+(dbus-setenv my-bus "DISPLAY" (getenv "DISPLAY"))
+
+@result{} nil
 @end lisp
 @end defun
 
@@ -1723,8 +1890,8 @@ If this variable is non-@code{nil}, D-Bus specific debug messages are raised.
 @end defvar
 
 Input parameters of @code{dbus-call-method},
-@code{dbus-call-method-non-blocking},
-@code{dbus-call-method-asynchronously}, and
+@code{dbus-call-method-asynchronously}, @code{dbus-send-signal},
+@code{dbus-register-method}, @code{dbus-register-property} and
 @code{dbus-register-signal} are checked for correct D-Bus types. If
 there is a type mismatch, the Lisp error @code{wrong-type-argument}
 @code{D-Bus ARG} is raised.
@@ -1825,7 +1992,7 @@ Example:
 
 @lisp
 (defun my-dbus-event-error-handler (event error)
-  (when (string-equal (concat dbus-service-emacs ".FileManager")
+  (when (string-equal (concat dbus-interface-emacs ".FileManager")
                       (dbus-event-interface-name event))
     (message "my-dbus-event-error-handler: %S %S" event error)
     (signal 'file-error (cdr error))))
index 95c129f411df5b169c4c1bfc14ac126eb7a8af91..cd1ad79eab57e5bc4422b56e107edbe406e606b1 100644 (file)
@@ -111,7 +111,7 @@ For @file{dired-x.el} as distributed with GNU Emacs @value{EMACSVER}.
 
 @end ifnottex
 
-@node Introduction, Installation, Top, Top
+@node Introduction
 @chapter Introduction
 
 This documents some @emph{extra} features for GNU Emacs's Dired Mode
@@ -125,7 +125,7 @@ original @file{dired-x.el}).
 @end menu
 @end ifnottex
 
-@node Features, Technical Details, , Introduction
+@node Features
 @section Features
 @cindex Features
 
@@ -157,7 +157,7 @@ also binds @kbd{C-x C-f} and @kbd{C-x 4 C-f} to
 @code{dired-x-find-file} and @code{dired-x-find-file-other-window},
 respectively (@pxref{Find File At Point}).
 
-@node Technical Details, , Features, Introduction
+@node Technical Details
 @section Technical Details
 @cindex Modified functions
 @cindex @file{dired-aux.el}
@@ -173,7 +173,7 @@ Dired}), if it is active.  @code{dired-find-buffer-nocreate} and
 @code{dired-guess-shell-command} (@pxref{Shell Command Guessing}) to
 offer a smarter default command.
 
-@node Installation, Omitting Files in Dired, Introduction, Top
+@node Installation
 @chapter Installation
 
 @noindent
@@ -211,7 +211,7 @@ when you first type @kbd{C-x d}).
 @end menu
 @end ifnottex
 
-@node Optional Installation Dired Jump, Optional Installation File At Point, , Installation
+@node Optional Installation Dired Jump
 @section Optional Installation Dired Jump
 
 @cindex Autoloading @code{dired-jump} and @code{dired-jump-other-window}
@@ -232,7 +232,7 @@ for these functions.  In your @file{.emacs} file put
 (define-key global-map "\C-x4\C-j" 'dired-jump-other-window)
 @end example
 
-@node Optional Installation File At Point, , Optional Installation Dired Jump, Installation
+@node Optional Installation File At Point
 @section Optional Installation File At Point
 
 @cindex Binding @code{dired-x-find-file}
@@ -251,7 +251,7 @@ or call @code{dired-x-bind-find-file} after changing the value.
             ))
 @end example
 
-@node Omitting Files in Dired, Local Variables, Installation, Top
+@node Omitting Files in Dired
 @chapter Omitting Files in Dired
 
 @cindex Omitting Files in Dired
@@ -307,7 +307,7 @@ inside @code{dired-load-hook} (@pxref{Installation}) and then evaluate
 @end menu
 @end ifnottex
 
-@node Omitting Variables, Omitting Examples, , Omitting Files in Dired
+@node Omitting Variables
 @section Omitting Variables
 
 @cindex Customizing file omitting
@@ -403,7 +403,7 @@ will show up again after reverting the buffer, unlike the others.
 
 @end table
 
-@node Omitting Examples, Omitting Technical, Omitting Variables, Omitting Files in Dired
+@node Omitting Examples
 @section Examples of Omitting Various File Types
 
 @itemize @bullet
@@ -429,7 +429,7 @@ in the @code{dired-load-hook} (@pxref{Installation}).  This assumes
 @cindex Tib files, how to omit them in Dired
 @cindex Omitting tib files in Dired
 If you use @code{tib}, the bibliography program for use with @TeX{} and
-La@TeX{}, and you
+@LaTeX{}, and you
 want to omit the @file{INDEX} and the @file{*-t.tex} files, then put
 
 @example
@@ -458,7 +458,7 @@ better way to achieve this particular goal is simply to omit @samp{-a} from
 
 @end itemize
 
-@node Omitting Technical, , Omitting Examples, Omitting Files in Dired
+@node Omitting Technical
 @section Some Technical Details of Omitting
 
 Loading @file{dired-x.el} will install Dired Omit by putting
@@ -466,7 +466,7 @@ Loading @file{dired-x.el} will install Dired Omit by putting
 call @code{dired-extra-startup}, which in turn calls @code{dired-omit-startup}
 in your @code{dired-mode-hook}.
 
-@node Local Variables, Shell Command Guessing, Omitting Files in Dired, Top
+@node Local Variables
 @chapter Local Variables for Dired Directories
 
 @cindex Local Variables for Dired Directories
@@ -537,7 +537,7 @@ the Dired Local Variables are hacked.  It takes the same values as that
 variable.  A value of @code{nil} means to ignore any Dired Local Variables.
 @end table
 
-@node Shell Command Guessing, Virtual Dired, Local Variables, Top
+@node Shell Command Guessing
 @chapter Shell Command Guessing
 @cindex Guessing shell commands for files.
 
@@ -643,7 +643,7 @@ smaller than the @file{.gz} file.
 History list for commands that read dired-shell commands.
 @end table
 
-@node Virtual Dired, Advanced Mark Commands, Shell Command Guessing, Top
+@node Virtual Dired
 @chapter Virtual Dired
 
 @cindex Virtual Dired
@@ -684,7 +684,7 @@ virtual Dired mode from the @code{auto-mode-alist}.  To edit all
 The regexp is a bit more complicated than usual to exclude @file{.dired}
 local-variable files.
 
-@node Advanced Mark Commands, Multiple Dired Directories, Virtual Dired, Top
+@node Advanced Mark Commands
 @chapter Advanced Mark Commands
 
 @table @kbd
@@ -730,7 +730,7 @@ Flag all files with a certain extension for deletion.  A @samp{.} is
 @end menu
 @end ifnottex
 
-@node Advanced Cleaning Functions, Advanced Cleaning Variables, , Advanced Mark Commands
+@node Advanced Cleaning Functions
 @section Advanced Cleaning Functions
 
 @table @code
@@ -741,7 +741,7 @@ variable @code{dired-patch-unclean-extensions}.
 
 @item dired-clean-tex
 @findex dired-clean-tex
-Flag dispensable files created by @TeX{}, La@TeX{}, and @samp{texinfo} for
+Flag dispensable files created by @TeX{}, @LaTeX{}, and @samp{texinfo} for
 deletion.  See the following variables (@pxref{Advanced Cleaning Variables}):
 
 @itemize @bullet
@@ -757,11 +757,11 @@ deletion.  See the following variables (@pxref{Advanced Cleaning Variables}):
 
 @item dired-very-clean-tex
 @findex dired-very-clean-tex
-Flag dispensable files created by @TeX{}, La@TeX{}, @samp{texinfo},
+Flag dispensable files created by @TeX{}, @LaTeX{}, @samp{texinfo},
 and @file{*.dvi} files for deletion.
 @end table
 
-@node Advanced Cleaning Variables, Special Marking Function, Advanced Cleaning Functions, Advanced Mark Commands
+@node Advanced Cleaning Variables
 @section Advanced Cleaning Variables
 
 @noindent Variables used by the above cleaning commands (and in the default value for
@@ -791,7 +791,7 @@ List of extensions of dispensable files created by @samp{texinfo}.
 @vindex dired-latex-unclean-extensions
 Default: @code{(".idx" ".lof" ".lot" ".glo")}
 
-List of extensions of dispensable files created by La@TeX{}.
+List of extensions of dispensable files created by @LaTeX{}.
 
 @item dired-bibtex-unclean-extensions
 @vindex dired-bibtex-unclean-extensions
@@ -800,7 +800,7 @@ Default:  @code{(".blg" ".bbl")}
 List of extensions of dispensable files created by Bib@TeX{}.
 @end table
 
-@node Special Marking Function, , Advanced Cleaning Variables, Advanced Mark Commands
+@node Special Marking Function
 @section Special Marking Function
 
 @table @kbd
@@ -856,7 +856,7 @@ to mark all @file{.el} files without a corresponding @file{.elc} file.
 
 @end table
 
-@node Multiple Dired Directories, Find File At Point, Advanced Mark Commands, Top
+@node Multiple Dired Directories
 @chapter Multiple Dired Directories and Non-Dired Commands
 
 @cindex Multiple Dired directories
@@ -876,8 +876,8 @@ The command @code{dired-smart-shell-command}, bound to @kbd{M-!} in
 Dired buffers, is like @code{shell-command}, but it runs with
 @code{default-directory} bound to the current Dired directory.
 
-@node Find File At Point, Miscellaneous Commands, Multiple Dired Directories, Top
-@section Find File At Point
+@node Find File At Point
+@chapter Find File At Point
 @cindex Visiting a file mentioned in a buffer
 @cindex Finding a file at point
 
@@ -952,7 +952,7 @@ that uses the value of @code{dired-x-hands-off-my-keys} to determine if
 @code{find-file-other-window}.  See @xref{Optional Installation File At Point}.
 @end table
 
-@node Miscellaneous Commands, Bugs, Find File At Point, Top
+@node Miscellaneous Commands
 @chapter Miscellaneous Commands
 
 Miscellaneous features not fitting anywhere else:
@@ -1082,7 +1082,7 @@ Bound to @kbd{%Y}.  Relative symlink all marked files containing
 info.
 @end table
 
-@node Bugs, GNU Free Documentation License, Miscellaneous Commands, Top
+@node Bugs
 @chapter Bugs
 @cindex Bugs
 
@@ -1090,23 +1090,23 @@ info.
 If you encounter a bug in this package, or wish to suggest an
 enhancement, then please use @kbd{M-x report-emacs-bug} to report it.
 
-@node GNU Free Documentation License, Concept Index, Bugs, Top
+@node GNU Free Documentation License
 @appendix GNU Free Documentation License
 @include doclicense.texi
 
-@node     Concept Index, Command Index, GNU Free Documentation License, Top
+@node     Concept Index
 @unnumbered Concept Index
 @printindex cp
 
-@node     Command Index, Key Index, Concept Index, Top
+@node     Command Index
 @unnumbered Function Index
 @printindex fn
 
-@node     Key Index, Variable Index, Command Index, Top
+@node     Key Index
 @unnumbered Key Index
 @printindex ky
 
-@node     Variable Index,  , Key Index, Top
+@node     Variable Index
 @unnumbered Variable Index
 @printindex vr
 
index f7e39b6c65cefea5d8b59c35bd14eda40ad6dd56..655d11b5d17755e70efad15687ad10f1ea0ef8e4 100644 (file)
@@ -790,7 +790,7 @@ compilers that will be inserted into the Makefile.
 
 Compiler instantiations must also insert variables specifying the
 compiler it plans to use, in addition to creating Automake settings for
-@file{configure.in} when appropriate.
+@file{configure.ac} when appropriate.
 
 Compiler objects are stored in the target objects as a list of
 symbols, where the symbols value is the object.  This enables the
@@ -1557,7 +1557,7 @@ For project @var{THIS}, test that the file @var{FILE} exists, or create it.
 
 @deffn Method ede-proj-setup-buildenvironment :AFTER this &optional force
 Setup the build environment for project @var{THIS}.
-Handles the Makefile, or a Makefile.am configure.in combination.
+Handles the Makefile, or a Makefile.am configure.ac combination.
 Optional argument @var{FORCE} will force items to be regenerated.
 @end deffn
 
@@ -1567,7 +1567,7 @@ These are removed with make clean.
 @end deffn
 
 @deffn Method ede-proj-configure-synchronize :AFTER this
-Synchronize what we know about project @var{THIS} into configure.in.
+Synchronize what we know about project @var{THIS} into configure.ac.
 @end deffn
 
 @deffn Method ede-proj-makefile-insert-variables-new :AFTER this
@@ -1603,7 +1603,7 @@ Return the name of the Makefile with the DIST target in it for @var{THIS}.
 @end deffn
 
 @deffn Method ede-proj-configure-file :AFTER this
-The configure.in script used by project @var{THIS}.
+The configure.ac script used by project @var{THIS}.
 @end deffn
 
 @deffn Method ede-commit-project :AFTER proj
@@ -1767,7 +1767,7 @@ Create a Makefile for all Makefile targets in @var{THIS} if needed.
 
 @deffn Method ede-proj-setup-buildenvironment :AFTER this &optional force
 Setup the build environment for project @var{THIS}.
-Handles the Makefile, or a Makefile.am configure.in combination.
+Handles the Makefile, or a Makefile.am configure.ac combination.
 Optional argument @var{FORCE} will force items to be regenerated.
 @end deffn
 
index 34c418c14fd0e4ccebad4c7e1ed666e38dda0fda..bcb8d8974ea19d7d9ca439e05257d4233d2b6dde 100644 (file)
@@ -861,7 +861,7 @@ you said `no'.
 @chapter Long Example
 
 The following example exploits most of the features of Forms mode.
-This example is included in the distribution as file @file{forms-d2.el}.
+This example is included in the distribution as file @file{etc/forms/forms-d2.el}.
 
 @example
 ;; demo2 -- demo forms-mode     -*- emacs-lisp -*-
@@ -869,7 +869,8 @@ This example is included in the distribution as file @file{forms-d2.el}.
 ;; @r{This sample forms exploit most of the features of forms mode.}
 
 ;; @r{Set the name of the data file.}
-(setq forms-file "forms-d2.dat")
+(setq forms-file
+       (expand-file-name "forms/forms-d2.dat" data-directory))
 
 ;; @r{Use @code{forms-enumerate} to set field names and number thereof.}
 (setq forms-number-of-fields
index b0839906df5d2157041edec585d18640d86b8da6..df4493789b6817b9baf13edef107962c519f8db8 100644 (file)
@@ -8,7 +8,7 @@
 @syncodeindex vr cp
 @syncodeindex pg cp
 
-@documentencoding ISO-8859-1
+@documentencoding UTF-8
 
 @copying
 Copyright @copyright{} 1995-2012 Free Software Foundation, Inc.
@@ -663,7 +663,6 @@ Getting News
 * Direct Functions::            Connecting directly to the server.
 * Indirect Functions::          Connecting indirectly to the server.
 * Common Variables::            Understood by several connection functions.
-* NNTP marks::                  Storing marks for @acronym{NNTP} servers.
 
 Getting Mail
 
@@ -816,7 +815,6 @@ Various
 * Formatting Variables::        You can specify what buffers should look like.
 * Window Layout::               Configuring the Gnus buffer windows.
 * Faces and Fonts::             How to change how faces look.
-* Compilation::                 How to speed Gnus up.
 * Mode Lines::                  Displaying information in the mode lines.
 * Highlighting and Menus::      Making buffers look all nice and cozy.
 * Daemons::                     Gnus can do things behind your back.
@@ -907,7 +905,8 @@ New Features
 * Quassia Gnus::                Two times two is four, or Gnus 5.6/5.7.
 * Pterodactyl Gnus::            Pentad also starts with P, AKA Gnus 5.8/5.9.
 * Oort Gnus::                   It's big.  It's far out.  Gnus 5.10/5.11.
-* No Gnus::                     Very punny.
+* No Gnus::                     Very punny.  Gnus 5.12/5.13
+* Ma Gnus::                     Celebrating 25 years of Gnus.
 
 Customization
 
@@ -1066,10 +1065,6 @@ you would typically set this variable to
 (setq gnus-secondary-select-methods '((nnmbox "")))
 @end lisp
 
-Note: the @acronym{NNTP} back end stores marks in marks files
-(@pxref{NNTP marks}).  This feature makes it easy to share marks between
-several Gnus installations, but may slow down things a bit when fetching
-new articles.  @xref{NNTP marks}, for more information.
 
 
 @node The Server is Down
@@ -2884,7 +2879,7 @@ composed messages will be @code{Gcc}'d to the current group.  If
 generated, if @code{(gcc-self . "string")} is present, this string will
 be inserted literally as a @code{gcc} header.  This parameter takes
 precedence over any default @code{Gcc} rules as described later
-(@pxref{Archived Messages}).
+(@pxref{Archived Messages}), with the exception for messages to resend.
 
 @strong{Caveat}: Adding @code{(gcc-self . t)} to the parameter list of
 @code{nntp} groups (or the like) isn't valid.  An @code{nntp} server
@@ -3027,6 +3022,7 @@ like this in the group parameters:
 @example
 (posting-style
   (name "Funky Name")
+  ("X-Message-SMTP-Method" "smtp smtp.example.org 587")
   ("X-My-Header" "Funky Value")
   (signature "Funky Signature"))
 @end example
@@ -4293,12 +4289,11 @@ default is @code{nil} in Emacs, or is the aliasee of the coding system
 named @code{file-name} (a certain coding system of which an alias is
 @code{file-name}) in XEmacs.
 
-The @code{nnml} back end, the @code{nnrss} back end, the @acronym{NNTP}
-marks feature (@pxref{NNTP marks}), the agent, and the cache use
-non-@acronym{ASCII} group names in those files and directories.  This
-variable overrides the value of @code{file-name-coding-system} which
-specifies the coding system used when encoding and decoding those file
-names and directory names.
+The @code{nnml} back end, the @code{nnrss} back end, the agent, and
+the cache use non-@acronym{ASCII} group names in those files and
+directories.  This variable overrides the value of
+@code{file-name-coding-system} which specifies the coding system used
+when encoding and decoding those file names and directory names.
 
 In XEmacs (with the @code{mule} feature), @code{file-name-coding-system}
 is the only means to specify the coding system used to encode and decode
@@ -4588,6 +4583,11 @@ trick:
       "")))
 @end lisp
 
+To see what variables are dynamically bound (like
+@code{gnus-tmp-group}), you have to look at the source code.  The
+variable names aren't guaranteed to be stable over Gnus versions,
+either.
+
 
 @node File Commands
 @subsection File Commands
@@ -8981,7 +8981,7 @@ Translate many non-@acronym{ASCII} characters into their
 @acronym{ASCII} equivalents (@code{gnus-article-treat-non-ascii}).
 This is mostly useful if you're on a terminal that has a limited font
 and doesn't show accented characters, ``advanced'' punctuation, and the
-like.  For instance, @samp{»} is translated into @samp{>>}, and so on.
+like.  For instance, @samp{»} is translated into @samp{>>}, and so on.
 
 @item W Y f
 @kindex W Y f (Summary)
@@ -10814,12 +10814,6 @@ buffers.  For example:
 
 Also @pxref{Group Parameters}.
 
-@vindex gnus-propagate-marks
-@item gnus-propagate-marks
-If non-@code{nil}, propagate marks to the backends for possible
-storing.  @xref{NNTP marks}, and friends, for a more fine-grained
-sieve.
-
 @end table
 
 
@@ -12399,32 +12393,25 @@ value suitable for your system.
 @xref{Mail Variables, ,Mail Variables,message,Message manual}, for more
 information.
 
+
 @node POP before SMTP
 @section POP before SMTP
 @cindex pop before smtp
-@findex message-smtpmail-send-it
 @findex mail-source-touch-pop
 
-Does your @acronym{ISP} require the @acronym{POP}-before-@acronym{SMTP}
-authentication?  It is whether you need to connect to the @acronym{POP}
-mail server within a certain time before sending mails.  If so, there is
-a convenient way.  To do that, put the following lines in your
-@file{~/.gnus.el} file:
+Does your @acronym{ISP} use @acronym{POP}-before-@acronym{SMTP}
+authentication?  This authentication method simply requires you to
+contact the @acronym{POP} server before sending email.  To do that,
+put the following lines in your @file{~/.gnus.el} file:
 
 @lisp
-(setq message-send-mail-function 'message-smtpmail-send-it)
 (add-hook 'message-send-mail-hook 'mail-source-touch-pop)
 @end lisp
 
 @noindent
-It means to let Gnus connect to the @acronym{POP} mail server in advance
-whenever you send a mail.  The @code{mail-source-touch-pop} function
-does only a @acronym{POP} authentication according to the value of
-@code{mail-sources} without fetching mails, just before sending a mail.
-Note that you have to use @code{message-smtpmail-send-it} which runs
-@code{message-send-mail-hook} rather than @code{smtpmail-send-it} and
-set the value of @code{mail-sources} for a @acronym{POP} connection
-correctly.  @xref{Mail Sources}.
+The @code{mail-source-touch-pop} function does @acronym{POP}
+authentication according to the value of @code{mail-sources} without
+fetching mails, just before sending a mail.  @xref{Mail Sources}.
 
 If you have two or more @acronym{POP} mail servers set in
 @code{mail-sources}, you may want to specify one of them to
@@ -12452,6 +12439,7 @@ Otherwise, bind it dynamically only when performing the
               (mail-source-touch-pop))))
 @end lisp
 
+
 @node Mail and Post
 @section Mail and Post
 
@@ -12669,6 +12657,35 @@ and matches the Gcc group name, attach files as external parts; if it is
 non-@code{nil}, the behavior is the same as @code{all}, but it may be
 changed in the future.
 
+@item gnus-gcc-self-resent-messages
+@vindex gnus-gcc-self-resent-messages
+Like the @code{gcc-self} group parameter, applied only for unmodified
+messages that @code{gnus-summary-resend-message} (@pxref{Summary Mail
+Commands}) resends.  Non-@code{nil} value of this variable takes
+precedence over any existing @code{Gcc} header.
+
+If this is @code{none}, no @code{Gcc} copy will be made.  If this is
+@code{t}, messages resent will be @code{Gcc} copied to the current
+group.  If this is a string, it specifies a group to which resent
+messages will be @code{Gcc} copied.  If this is @code{nil}, @code{Gcc}
+will be done according to existing @code{Gcc} header(s), if any.  If
+this is @code{no-gcc-self}, that is the default, resent messages will be
+@code{Gcc} copied to groups that existing @code{Gcc} header specifies,
+except for the current group.
+
+@item gnus-gcc-pre-body-encode-hook
+@vindex gnus-gcc-pre-body-encode-hook
+@itemx gnus-gcc-post-body-encode-hook
+@vindex gnus-gcc-post-body-encode-hook
+
+These hooks are run before/after encoding the message body of the Gcc
+copy of a sent message.  The current buffer (when the hook is run)
+contains the message including the message header.  Changes made to
+the message will only affect the Gcc copy, but not the original
+message.  You can use these hooks to edit the copy (and influence
+subsequent transformations), e.g. remove MML secure tags
+(@pxref{Signing and encrypting}).
+
 @end table
 
 
@@ -12800,6 +12817,7 @@ So here's a new example:
          (signature-file "~/.work-signature")
          (address "user@@bar.foo")
          (body "You are fired.\n\nSincerely, your boss.")
+         ("X-Message-SMTP-Method" "smtp smtp.example.org 587")
          (organization "Important Work, Inc"))
         ("nnml:.*"
          (From (with-current-buffer gnus-article-buffer
@@ -12814,6 +12832,13 @@ if you fill many roles.
 You may also use @code{message-alternative-emails} instead.
 @xref{Message Headers, ,Message Headers, message, Message Manual}.
 
+Of particular interest in the ``work-mail'' style is the
+@samp{X-Message-SMTP-Method} header.  It specifies how to send the
+outgoing email.  You may want to sent certain emails through certain
+@acronym{SMTP} servers due to company policies, for instance.
+@xref{Mail Variables, ,Message Variables, message, Message Manual}.
+
+
 @node Drafts
 @section Drafts
 @cindex drafts
@@ -13739,7 +13764,6 @@ don't update their active files often, this can help.
 * Direct Functions::            Connecting directly to the server.
 * Indirect Functions::          Connecting indirectly to the server.
 * Common Variables::            Understood by several connection functions.
-* NNTP marks::                  Storing marks for @acronym{NNTP} servers.
 @end menu
 
 
@@ -14010,53 +14034,6 @@ is @samp{()}.
 
 @end table
 
-@node NNTP marks
-@subsubsection NNTP marks
-@cindex storing NNTP marks
-
-Gnus stores marks (@pxref{Marking Articles}) for @acronym{NNTP}
-servers in marks files.  A marks file records what marks you have set
-in a group and each file is specific to the corresponding server.
-Marks files are stored in @file{~/News/marks}
-(@code{nntp-marks-directory}) under a classic hierarchy resembling
-that of a news server, for example marks for the group
-@samp{gmane.discuss} on the news.gmane.org server will be stored in
-the file @file{~/News/marks/news.gmane.org/gmane/discuss/.marks}.
-
-Marks files are useful because you can copy the @file{~/News/marks}
-directory (using rsync, scp or whatever) to another Gnus installation,
-and it will realize what articles you have read and marked.  The data
-in @file{~/News/marks} has priority over the same data in
-@file{~/.newsrc.eld}.
-
-Note that marks files are very much server-specific: Gnus remembers
-the article numbers so if you don't use the same servers on both
-installations things are most likely to break (most @acronym{NNTP}
-servers do not use the same article numbers as any other server).
-However, if you use servers A, B, C on one installation and servers A,
-D, E on the other, you can sync the marks files for A and then you'll
-get synchronization for that server between the two installations.
-
-Using @acronym{NNTP} marks can possibly incur a performance penalty so
-if Gnus feels sluggish, try setting the @code{nntp-marks-is-evil}
-variable to @code{t}.  Marks will then be stored in @file{~/.newsrc.eld}.
-
-Related variables:
-
-@table @code
-
-@item nntp-marks-is-evil
-@vindex nntp-marks-is-evil
-If non-@code{nil}, this back end will ignore any marks files.  The
-default is @code{nil}.
-
-@item nntp-marks-directory
-@vindex nntp-marks-directory
-The directory where marks for nntp groups will be stored.
-
-@end table
-
-
 @node News Spool
 @subsection News Spool
 @cindex nnspool
@@ -16147,22 +16124,6 @@ splitting.  It has to create lots of files, and it also generates
 @acronym{NOV} databases for the incoming mails.  This makes it possibly the
 fastest back end when it comes to reading mail.
 
-@cindex self contained nnml servers
-@cindex marks
-When the marks file is used (which it is by default), @code{nnml}
-servers have the property that you may backup them using @code{tar} or
-similar, and later be able to restore them into Gnus (by adding the
-proper @code{nnml} server) and have all your marks be preserved.  Marks
-for a group are usually stored in the @code{.marks} file (but see
-@code{nnml-marks-file-name}) within each @code{nnml} group's directory.
-Individual @code{nnml} groups are also possible to backup, use @kbd{G m}
-to restore the group (after restoring the backup into the nnml
-directory).
-
-If for some reason you believe your @file{.marks} files are screwed
-up, you can just delete them all.  Gnus will then correctly regenerate
-them next time it starts.
-
 Virtual server settings:
 
 @table @code
@@ -16200,15 +16161,6 @@ The name of the @acronym{NOV} files.  The default is @file{.overview}.
 @vindex nnml-prepare-save-mail-hook
 Hook run narrowed to an article before saving.
 
-@item nnml-marks-is-evil
-@vindex nnml-marks-is-evil
-If non-@code{nil}, this back end will ignore any @sc{marks} files.  The
-default is @code{nil}.
-
-@item nnml-marks-file-name
-@vindex nnml-marks-file-name
-The name of the @dfn{marks} files.  The default is @file{.marks}.
-
 @item nnml-use-compressed-files
 @vindex nnml-use-compressed-files
 If non-@code{nil}, @code{nnml} will allow using compressed message
@@ -16549,19 +16501,6 @@ separate file.  Each file is in the standard Un*x mbox format.
 @code{nnfolder} will add extra headers to keep track of article
 numbers and arrival dates.
 
-@cindex self contained nnfolder servers
-@cindex marks
-When the marks file is used (which it is by default), @code{nnfolder}
-servers have the property that you may backup them using @code{tar} or
-similar, and later be able to restore them into Gnus (by adding the
-proper @code{nnfolder} server) and have all your marks be preserved.
-Marks for a group are usually stored in a file named as the mbox file
-with @code{.mrk} concatenated to it (but see
-@code{nnfolder-marks-file-suffix}) within the @code{nnfolder}
-directory.  Individual @code{nnfolder} groups are also possible to
-backup, use @kbd{G m} to restore the group (after restoring the backup
-into the @code{nnfolder} directory).
-
 Virtual server settings:
 
 @table @code
@@ -16620,20 +16559,6 @@ The extension for @acronym{NOV} files.  The default is @file{.nov}.
 The directory where the @acronym{NOV} files should be stored.  If
 @code{nil}, @code{nnfolder-directory} is used.
 
-@item nnfolder-marks-is-evil
-@vindex nnfolder-marks-is-evil
-If non-@code{nil}, this back end will ignore any @sc{marks} files.  The
-default is @code{nil}.
-
-@item nnfolder-marks-file-suffix
-@vindex nnfolder-marks-file-suffix
-The extension for @sc{marks} files.  The default is @file{.mrk}.
-
-@item nnfolder-marks-directory
-@vindex nnfolder-marks-directory
-The directory where the @sc{marks} files should be stored.  If
-@code{nil}, @code{nnfolder-directory} is used.
-
 @end table
 
 
@@ -16794,9 +16719,7 @@ undergo treatment such as duplicate checking.
 @code{nnmaildir} stores article marks for a given group in the
 corresponding maildir, in a way designed so that it's easy to manipulate
 them from outside Gnus.  You can tar up a maildir, unpack it somewhere
-else, and still have your marks.  @code{nnml} also stores marks, but
-it's not as easy to work with them from outside Gnus as with
-@code{nnmaildir}.
+else, and still have your marks.
 
 @code{nnmaildir} uses a significant amount of memory to speed things up.
 (It keeps in memory some of the things that @code{nnml} stores in files
@@ -16888,16 +16811,6 @@ adding a server definition pointing to that directory in Gnus.  The
 might interfere with overwriting data, so you may want to shut down Gnus
 before you restore the data.
 
-It is also possible to archive individual @code{nnml},
-@code{nnfolder}, or @code{nnmaildir} groups, while preserving marks.
-For @code{nnml} or @code{nnmaildir}, you copy all files in the group's
-directory.  For @code{nnfolder} you need to copy both the base folder
-file itself (@file{FOO}, say), and the marks file (@file{FOO.mrk} in
-this example).  Restoring the group is done with @kbd{G m} from the Group
-buffer.  The last step makes Gnus notice the new directory.
-@code{nnmaildir} notices the new directory automatically, so @kbd{G m}
-is unnecessary in that case.
-
 @node Web Searches
 @subsection Web Searches
 @cindex nnweb
@@ -20870,7 +20783,7 @@ then this operator will return @code{false}.
 
 @item !
 @itemx not
-@itemx ¬
+@itemx Â¬
 This logical operator only takes a single argument.  It returns the
 logical negation of the value of its argument.
 
@@ -22163,7 +22076,6 @@ to you, using @kbd{G b u} and updating the group will usually fix this.
 * Formatting Variables::        You can specify what buffers should look like.
 * Window Layout::               Configuring the Gnus buffer windows.
 * Faces and Fonts::             How to change how faces look.
-* Compilation::                 How to speed Gnus up.
 * Mode Lines::                  Displaying information in the mode lines.
 * Highlighting and Menus::      Making buffers look all nice and cozy.
 * Daemons::                     Gnus can do things behind your back.
@@ -22460,11 +22372,6 @@ than 6 characters to make it look nice in columns.)
 Ignoring is done first; then cutting; then maxing; and then as the very
 last operation, padding.
 
-If you use lots of these advanced thingies, you'll find that Gnus gets
-quite slow.  This can be helped enormously by running @kbd{M-x
-gnus-compile} when you are satisfied with the look of your lines.
-@xref{Compilation}.
-
 
 @node User-Defined Specs
 @subsection User-Defined Specs
@@ -22510,7 +22417,7 @@ and so on.  Create as many faces as you wish.  The same goes for the
 @samp{hello} mouse-highlighted with @code{gnus-mouse-face-3}.
 
 @cindex %<<, %>>, guillemets
-@c @cindex %<<, %>>, %«, %», guillemets
+@c @cindex %<<, %>>, %«, %», guillemets
 @vindex gnus-balloon-face-0
 Text inside the @samp{%<<} and @samp{%>>} specifiers will get the
 special @code{balloon-help} property set to
@@ -22973,30 +22880,6 @@ the face you want to alter, and alter it via the standard Customize
 interface.
 
 
-@node Compilation
-@section Compilation
-@cindex compilation
-@cindex byte-compilation
-
-@findex gnus-compile
-
-Remember all those line format specification variables?
-@code{gnus-summary-line-format}, @code{gnus-group-line-format}, and so
-on.  Now, Gnus will of course heed whatever these variables are, but,
-unfortunately, changing them will mean a quite significant slow-down.
-(The default values of these variables have byte-compiled functions
-associated with them, while the user-generated versions do not, of
-course.)
-
-To help with this, you can run @kbd{M-x gnus-compile} after you've
-fiddled around with the variables and feel that you're (kind of)
-satisfied.  This will result in the new specs being byte-compiled, and
-you'll get top speed again.  Gnus will save these compiled specs in the
-@file{.newsrc.eld} file.  (User-defined functions aren't compiled by
-this function, though---you should compile them yourself by sticking
-them into the @file{~/.gnus.el} file and byte-compiling that file.)
-
-
 @node Mode Lines
 @section Mode Lines
 @cindex mode lines
@@ -23651,6 +23534,10 @@ The variable @code{gnus-picon-style} controls how picons are displayed.
 If @code{inline}, the textual representation is replaced.  If
 @code{right}, picons are added right to the textual representation.
 
+@vindex gnus-picon-properties
+The value of the variable @code{gnus-picon-properties} is a list of
+properties applied to picons.
+
 The following variables offer control over where things are located.
 
 @table @code
@@ -26404,6 +26291,7 @@ renamed it back again to ``Gnus''.  But in mixed case.  ``Gnus'' vs.
 @cindex Pterodactyl Gnus
 @cindex Oort Gnus
 @cindex No Gnus
+@cindex Ma Gnus
 @cindex Gnus versions
 
 The first ``proper'' release of Gnus 5 was done in November 1995 when it
@@ -26432,12 +26320,15 @@ On April 19, 2010 Gnus development was moved to Git.  See
 http://git.gnus.org for details (http://www.gnus.org will be updated
 with the information when possible).
 
+On the January 31th 2012, Ma Gnus was begun.
+
 If you happen upon a version of Gnus that has a prefixed name --
 ``(ding) Gnus'', ``September Gnus'', ``Red Gnus'', ``Quassia Gnus'',
-``Pterodactyl Gnus'', ``Oort Gnus'', ``No Gnus'' -- don't panic.
-Don't let it know that you're frightened.  Back away.  Slowly.  Whatever
-you do, don't run.  Walk away, calmly, until you're out of its reach.
-Find a proper released version of Gnus and snuggle up to that instead.
+``Pterodactyl Gnus'', ``Oort Gnus'', ``No Gnus'', ``Ma Gnus'' -- don't
+panic.  Don't let it know that you're frightened.  Back away.  Slowly.
+Whatever you do, don't run.  Walk away, calmly, until you're out of
+its reach.  Find a proper released version of Gnus and snuggle up to
+that instead.
 
 
 @node Why?
@@ -27040,7 +26931,8 @@ actually are people who are using Gnus.  Who'd'a thunk it!
 * Quassia Gnus::                Two times two is four, or Gnus 5.6/5.7.
 * Pterodactyl Gnus::            Pentad also starts with P, AKA Gnus 5.8/5.9.
 * Oort Gnus::                   It's big.  It's far out.  Gnus 5.10/5.11.
-* No Gnus::                     Very punny.
+* No Gnus::                     Very punny.  Gnus 5.12/5.13.
+* Ma Gnus::                     Celebrating 25 years of Gnus.
 @end menu
 
 These lists are, of course, just @emph{short} overviews of the
@@ -28415,6 +28307,32 @@ New features in No Gnus:
 
 @include gnus-news.texi
 
+@node Ma Gnus
+@subsubsection Ma Gnus
+@cindex Ma Gnus
+
+I'm sure there will be lots of text here.  It's really spelled 真
+Gnus.
+
+New features in Ma Gnus:
+
+@itemize @bullet
+
+@item Changes in Message mode and related Gnus features
+@c ****************************************************
+
+@itemize @bullet
+
+@item
+The new hooks @code{gnus-gcc-pre-body-encode-hook} and
+@code{gnus-gcc-post-body-encode-hook} are run before/after encoding
+the message body of the Gcc copy of a sent message.  See
+@xref{Archived Messages}.
+
+@end itemize
+
+@end itemize
+
 @iftex
 
 @page
@@ -30637,5 +30555,5 @@ former).  The manual is unambiguous, but it can be confusing.
 
 @c Local Variables:
 @c mode: texinfo
-@c coding: iso-8859-1
+@c coding: utf-8
 @c End:
index 0f81786cdb55a95586448633f9e01baaae660afa..9e577c351b74adb84f005610ce34a60f47c633c3 100644 (file)
@@ -1,6 +1,6 @@
 #### -*- Makefile -*- for documentation other than the Emacs manual.
 
-# Copyright (C) 2003-2012  Free Software Foundation, Inc.
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -30,28 +30,31 @@ infodir = $(srcdir)/../../info
 ## Currently only used by efaq; could be added to MAKEINFO.
 emacsdir = $(srcdir)/../emacs
 
+INFO_EXT=.info
+INFO_OPTS=--no-split
+
 # The makeinfo program is part of the Texinfo distribution.
 MAKEINFO = makeinfo
 MAKEINFO_OPTS = --force -I$(emacsdir)
 MULTI_INSTALL_INFO = $(srcdir)\..\..\nt\multi-install-info.bat
-INFO_TARGETS = $(infodir)/ccmode \
-               $(infodir)/cl $(infodir)/dbus $(infodir)/dired-x \
-               $(infodir)/ediff $(infodir)/forms $(infodir)/gnus \
-               $(infodir)/message $(infodir)/sieve $(infodir)/pgg \
-               $(infodir)/emacs-mime $(infodir)/info $(infodir)/mh-e \
-               $(infodir)/reftex $(infodir)/sc $(infodir)/vip \
-               $(infodir)/viper $(infodir)/widget $(infodir)/efaq \
-               $(infodir)/ada-mode $(infodir)/autotype $(infodir)/calc \
-               $(infodir)/idlwave $(infodir)/eudc $(infodir)/ebrowse \
-               $(infodir)/pcl-cvs $(infodir)/woman $(infodir)/eshell \
-               $(infodir)/org $(infodir)/url $(infodir)/speedbar \
-               $(infodir)/tramp $(infodir)/ses $(infodir)/smtpmail \
-               $(infodir)/flymake $(infodir)/newsticker $(infodir)/rcirc \
-               $(infodir)/erc $(infodir)/ert \
-               $(infodir)/remember $(infodir)/nxml-mode \
-               $(infodir)/epa $(infodir)/mairix-el $(infodir)/sasl \
-               $(infodir)/auth $(infodir)/eieio $(infodir)/ede \
-               $(infodir)/semantic $(infodir)/edt $(infodir)/emacs-gnutls
+INFO_TARGETS = $(infodir)/ccmode$(INFO_EXT) \
+               $(infodir)/cl$(INFO_EXT) $(infodir)/dbus$(INFO_EXT) $(infodir)/dired-x$(INFO_EXT) \
+               $(infodir)/ediff$(INFO_EXT) $(infodir)/forms$(INFO_EXT) $(infodir)/gnus$(INFO_EXT) \
+               $(infodir)/message$(INFO_EXT) $(infodir)/sieve$(INFO_EXT) $(infodir)/pgg$(INFO_EXT) \
+               $(infodir)/emacs-mime$(INFO_EXT) $(infodir)/info$(INFO_EXT) $(infodir)/mh-e$(INFO_EXT) \
+               $(infodir)/reftex$(INFO_EXT) $(infodir)/sc$(INFO_EXT) $(infodir)/vip$(INFO_EXT) \
+               $(infodir)/viper$(INFO_EXT) $(infodir)/widget$(INFO_EXT) $(infodir)/efaq$(INFO_EXT) \
+               $(infodir)/ada-mode$(INFO_EXT) $(infodir)/autotype$(INFO_EXT) $(infodir)/calc$(INFO_EXT) \
+               $(infodir)/idlwave$(INFO_EXT) $(infodir)/eudc$(INFO_EXT) $(infodir)/ebrowse$(INFO_EXT) \
+               $(infodir)/pcl-cvs$(INFO_EXT) $(infodir)/woman$(INFO_EXT) $(infodir)/eshell$(INFO_EXT) \
+               $(infodir)/org$(INFO_EXT) $(infodir)/url$(INFO_EXT) $(infodir)/speedbar$(INFO_EXT) \
+               $(infodir)/tramp$(INFO_EXT) $(infodir)/ses$(INFO_EXT) $(infodir)/smtpmail$(INFO_EXT) \
+               $(infodir)/flymake$(INFO_EXT) $(infodir)/newsticker$(INFO_EXT) $(infodir)/rcirc$(INFO_EXT) \
+               $(infodir)/erc$(INFO_EXT) $(infodir)/ert$(INFO_EXT) \
+               $(infodir)/remember$(INFO_EXT) $(infodir)/nxml-mode$(INFO_EXT) \
+               $(infodir)/epa$(INFO_EXT) $(infodir)/mairix-el$(INFO_EXT) $(infodir)/sasl$(INFO_EXT) \
+               $(infodir)/auth$(INFO_EXT) $(infodir)/eieio$(INFO_EXT) $(infodir)/ede$(INFO_EXT) \
+               $(infodir)/semantic$(INFO_EXT) $(infodir)/edt$(INFO_EXT) $(infodir)/emacs-gnutls$(INFO_EXT)
 DVI_TARGETS = calc.dvi cc-mode.dvi cl.dvi dbus.dvi dired-x.dvi \
                ediff.dvi forms.dvi gnus.dvi message.dvi emacs-mime.dvi \
                sieve.dvi pgg.dvi mh-e.dvi \
@@ -93,68 +96,68 @@ $(infodir)/dir:
 # Some Windows ports of makeinfo seem to require -o to come before the
 # texi filename, contrary to GNU standards.
 
-$(infodir)/info: $(INFOSOURCES)
-       $(MAKEINFO) $(MAKEINFO_OPTS) --no-split -o $@ info.texi
+$(infodir)/info$(INFO_EXT): $(INFOSOURCES)
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ info.texi
 
 info.dvi: $(INFOSOURCES)
        $(ENVADD) $(TEXI2DVI) $(srcdir)/info.texi
 
 
-$(infodir)/ccmode: cc-mode.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) cc-mode.texi
+$(infodir)/ccmode$(INFO_EXT): cc-mode.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ cc-mode.texi
 cc-mode.dvi: cc-mode.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/cc-mode.texi
 
-$(infodir)/ada-mode: ada-mode.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) ada-mode.texi
+$(infodir)/ada-mode$(INFO_EXT): ada-mode.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ada-mode.texi
 ada-mode.dvi: ada-mode.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/ada-mode.texi
 
-$(infodir)/pcl-cvs: pcl-cvs.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) pcl-cvs.texi
+$(infodir)/pcl-cvs$(INFO_EXT): pcl-cvs.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ pcl-cvs.texi
 pcl-cvs.dvi: pcl-cvs.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/pcl-cvs.texi
 
-$(infodir)/eshell: eshell.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) eshell.texi
+$(infodir)/eshell$(INFO_EXT): eshell.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ eshell.texi
 eshell.dvi: eshell.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/eshell.texi
 
-$(infodir)/cl: cl.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) cl.texi
+$(infodir)/cl$(INFO_EXT): cl.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ cl.texi
 cl.dvi: cl.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/cl.texi
 
-$(infodir)/dbus: dbus.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) dbus.texi
+$(infodir)/dbus$(INFO_EXT): dbus.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ dbus.texi
 dbus.dvi: dbus.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/dbus.texi
 
-$(infodir)/dired-x: dired-x.texi $(emacsdir)/emacsver.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) dired-x.texi
+$(infodir)/dired-x$(INFO_EXT): dired-x.texi $(emacsdir)/emacsver.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ dired-x.texi
 dired-x.dvi: dired-x.texi $(emacsdir)/emacsver.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/dired-x.texi
 
-$(infodir)/ediff: ediff.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) ediff.texi
+$(infodir)/ediff$(INFO_EXT): ediff.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ediff.texi
 ediff.dvi: ediff.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/ediff.texi
 
-$(infodir)/flymake: flymake.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) flymake.texi
+$(infodir)/flymake$(INFO_EXT): flymake.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ flymake.texi
 flymake.dvi: flymake.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/flymake.texi
 
-$(infodir)/forms: forms.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) forms.texi
+$(infodir)/forms$(INFO_EXT): forms.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ forms.texi
 forms.dvi: forms.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/forms.texi
 
 # gnus/message/emacs-mime/sieve/pgg are part of Gnus:
-$(infodir)/gnus: gnus.texi gnus-overrides.texi message.texi emacs-mime.texi \
+$(infodir)/gnus$(INFO_EXT): gnus.texi gnus-overrides.texi message.texi emacs-mime.texi \
                 sieve.texi pgg.texi sasl.texi gnus-news.texi gnus-faq.texi \
                 doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) gnus.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ gnus.texi
 gnus.dvi: gnus.texi gnus-overrides.texi message.texi emacs-mime.texi \
          sieve.texi pgg.texi sasl.texi gnus-news.texi gnus-faq.texi \
          doclicense.texi
@@ -163,195 +166,195 @@ gnus.dvi: gnus.texi gnus-overrides.texi message.texi emacs-mime.texi \
        cp gnustmp.dvi $*.dvi
        rm gnustmp.*
 #
-$(infodir)/message: message.texi gnus-overrides.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) message.texi
+$(infodir)/message$(INFO_EXT): message.texi gnus-overrides.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ message.texi
 message.dvi: message.texi gnus-overrides.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/message.texi
 #
-$(infodir)/emacs-mime: emacs-mime.texi gnus-overrides.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) --enable-encoding emacs-mime.texi
+$(infodir)/emacs-mime$(INFO_EXT): emacs-mime.texi gnus-overrides.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ --enable-encoding emacs-mime.texi
 emacs-mime.dvi: emacs-mime.texi gnus-overrides.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-mime.texi
 #
-$(infodir)/sieve: sieve.texi gnus-overrides.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) sieve.texi
+$(infodir)/sieve$(INFO_EXT): sieve.texi gnus-overrides.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ sieve.texi
 sieve.dvi: sieve.texi gnus-overrides.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/sieve.texi
 #
-$(infodir)/pgg: pgg.texi gnus-overrides.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) pgg.texi
+$(infodir)/pgg$(INFO_EXT): pgg.texi gnus-overrides.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ pgg.texi
 pgg.dvi: pgg.texi gnus-overrides.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/pgg.texi
 
-$(infodir)/mh-e: mh-e.texi doclicense.texi gpl.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) mh-e.texi
+$(infodir)/mh-e$(INFO_EXT): mh-e.texi doclicense.texi gpl.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ mh-e.texi
 mh-e.dvi: mh-e.texi doclicense.texi gpl.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/mh-e.texi
 
-$(infodir)/reftex: reftex.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) reftex.texi
+$(infodir)/reftex$(INFO_EXT): reftex.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ reftex.texi
 reftex.dvi: reftex.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/reftex.texi
 
-$(infodir)/remember: remember.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) remember.texi
+$(infodir)/remember$(INFO_EXT): remember.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ remember.texi
 remember.dvi: remember.texi doclicense.texix
        $(ENVADD) $(TEXI2DVI) $(srcdir)/remember.texi
 
-$(infodir)/sasl: sasl.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) sasl.texi
+$(infodir)/sasl$(INFO_EXT): sasl.texi gnus-overrides.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ sasl.texi
 sasl.dvi: sasl.texi gnus-overrides.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/sasl.texi
 
-$(infodir)/sc: sc.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) sc.texi
+$(infodir)/sc$(INFO_EXT): sc.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ sc.texi
 sc.dvi: sc.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/sc.texi
 
-$(infodir)/vip: vip.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) vip.texi
+$(infodir)/vip$(INFO_EXT): vip.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ vip.texi
 vip.dvi: vip.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/vip.texi
 
-$(infodir)/viper: viper.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) viper.texi
+$(infodir)/viper$(INFO_EXT): viper.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ viper.texi
 viper.dvi: viper.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/viper.texi
 
-$(infodir)/widget: widget.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) widget.texi
+$(infodir)/widget$(INFO_EXT): widget.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ widget.texi
 widget.dvi: widget.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/widget.texi
 
-$(infodir)/efaq: faq.texi $(emacsdir)/emacsver.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) faq.texi
+$(infodir)/efaq$(INFO_EXT): faq.texi $(emacsdir)/emacsver.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ faq.texi
 faq.dvi: faq.texi $(emacsdir)/emacsver.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/faq.texi
 
-$(infodir)/autotype: autotype.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) autotype.texi
+$(infodir)/autotype$(INFO_EXT): autotype.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ autotype.texi
 autotype.dvi: autotype.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/autotype.texi
 
-$(infodir)/calc: calc.texi $(emacsdir)/emacsver.texi gpl.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) calc.texi
+$(infodir)/calc$(INFO_EXT): calc.texi $(emacsdir)/emacsver.texi gpl.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ calc.texi
 calc.dvi: calc.texi $(emacsdir)/emacsver.texi gpl.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/calc.texi
 
 # This is produced with --no-split to avoid making files whose
 # names clash on DOS 8+3 filesystems
-$(infodir)/idlwave: idlwave.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) --no-split idlwave.texi
+$(infodir)/idlwave$(INFO_EXT): idlwave.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ idlwave.texi
 idlwave.dvi: idlwave.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/idlwave.texi
 
-$(infodir)/eudc: eudc.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) eudc.texi
+$(infodir)/eudc$(INFO_EXT): eudc.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ eudc.texi
 eudc.dvi: eudc.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/eudc.texi
 
-$(infodir)/ebrowse: ebrowse.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) ebrowse.texi
+$(infodir)/ebrowse$(INFO_EXT): ebrowse.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ebrowse.texi
 ebrowse.dvi: ebrowse.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/ebrowse.texi
 
-$(infodir)/woman: woman.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) woman.texi
+$(infodir)/woman$(INFO_EXT): woman.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ woman.texi
 woman.dvi: woman.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/woman.texi
 
-$(infodir)/speedbar: speedbar.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) speedbar.texi
+$(infodir)/speedbar$(INFO_EXT): speedbar.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ speedbar.texi
 speedbar.dvi: speedbar.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/speedbar.texi
 
-$(infodir)/tramp: tramp.texi trampver.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) tramp.texi
+$(infodir)/tramp$(INFO_EXT): tramp.texi trampver.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ tramp.texi
 tramp.dvi: tramp.texi trampver.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/tramp.texi
 
-$(infodir)/ses: ses.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) ses.texi
+$(infodir)/ses$(INFO_EXT): ses.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ses.texi
 ses.dvi: ses.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/ses.texi
 
-$(infodir)/smtpmail: smtpmail.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) smtpmail.texi
+$(infodir)/smtpmail$(INFO_EXT): smtpmail.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ smtpmail.texi
 smtpmail.dvi: smtpmail.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/smtpmail.texi
 
-$(infodir)/org: org.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) org.texi
+$(infodir)/org$(INFO_EXT): org.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ org.texi
 org.dvi: org.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/org.texi
 
-$(infodir)/url: url.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) url.texi
+$(infodir)/url$(INFO_EXT): url.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ url.texi
 url.dvi: url.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/url.texi
 
-$(infodir)/newsticker: newsticker.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) newsticker.texi
+$(infodir)/newsticker$(INFO_EXT): newsticker.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ newsticker.texi
 newsticker.dvi: newsticker.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/newsticker.texi
 
-$(infodir)/nxml-mode: nxml-mode.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) nxml-mode.texi
+$(infodir)/nxml-mode$(INFO_EXT): nxml-mode.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ nxml-mode.texi
 nxml-mod.dvi: nxml-mode.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/nxml-mode.texi
 
-$(infodir)/rcirc: rcirc.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) rcirc.texi
+$(infodir)/rcirc$(INFO_EXT): rcirc.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ rcirc.texi
 rcirc.dvi: rcirc.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/rcirc.texi
 
-$(infodir)/erc: erc.texi gpl.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) erc.texi
+$(infodir)/erc$(INFO_EXT): erc.texi gpl.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ erc.texi
 erc.dvi: erc.texi gpl.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/erc.texi
 
-$(infodir)/ert: ert.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) ert.texi
+$(infodir)/ert$(INFO_EXT): ert.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ert.texi
 ert.dvi: ert.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/ert.texi
 
-$(infodir)/epa: epa.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) epa.texi
+$(infodir)/epa$(INFO_EXT): epa.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ epa.texi
 epa.dvi: epa.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/epa.texi
 
-$(infodir)/mairix-el: mairix-el.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) mairix-el.texi
+$(infodir)/mairix-el$(INFO_EXT): mairix-el.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ mairix-el.texi
 mairix-el.dvi: mairix-el.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/mairix-el.texi
 
-$(infodir)/auth: auth.texi gnus-overrides.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) auth.texi
+$(infodir)/auth$(INFO_EXT): auth.texi gnus-overrides.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ auth.texi
 auth.dvi: auth.texi gnus-overrides.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/auth.texi
 
-$(infodir)/eieio: eieio.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) eieio.texi
+$(infodir)/eieio$(INFO_EXT): eieio.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ eieio.texi
 eieio.dvi: eieio.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/eieio.texi
 
-$(infodir)/ede: ede.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) ede.texi
+$(infodir)/ede$(INFO_EXT): ede.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ ede.texi
 ede.dvi: ede.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/ede.texi
 
-$(infodir)/semantic: semantic.texi sem-user.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) semantic.texi
+$(infodir)/semantic$(INFO_EXT): semantic.texi sem-user.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ semantic.texi
 semantic.dvi: semantic.texi sem-user.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/semantic.texi
 
-$(infodir)/edt: edt.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) edt.texi
+$(infodir)/edt$(INFO_EXT): edt.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ edt.texi
 edt.dvi: edt.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/edt.texi
 
-$(infodir)/emacs-gnutls: emacs-gnutls.texi doclicense.texi
-       $(MAKEINFO) $(MAKEINFO_OPTS) emacs-gnutls.texi
+$(infodir)/emacs-gnutls$(INFO_EXT): emacs-gnutls.texi doclicense.texi
+       $(MAKEINFO) $(MAKEINFO_OPTS) $(INFO_OPTS) -o $@ emacs-gnutls.texi
 emacs-gnutls.dvi: emacs-gnutls.texi doclicense.texi
        $(ENVADD) $(TEXI2DVI) $(srcdir)/emacs-gnutls.texi
 
index ac5811a0ce8ce8da0ad76d8d7ada1eb189fb2d8f..ef752a96fdc89a4d877e116fc4f73c6e059ded3a 100644 (file)
@@ -1637,6 +1637,40 @@ To the thing similar to this, there is
 requires the @acronym{POP}-before-@acronym{SMTP} authentication.
 @xref{POP before SMTP, , POP before SMTP, gnus, The Gnus Manual}.
 
+@cindex X-Message-SMTP-Method
+If you have a complex @acronym{SMTP} setup, and want some messages to
+go via one mail server, and other messages to go through another, you
+can use the @samp{X-Message-SMTP-Method} header.  These are the
+supported values:
+
+@table @samp
+@item smtpmail
+
+@example
+X-Message-SMTP-Method: smtp smtp.fsf.org 587
+@end example
+
+This will send the message via @samp{smtp.fsf.org}, using port 587.
+
+@example
+X-Message-SMTP-Method: smtp smtp.fsf.org 587 other-user
+@end example
+
+This is the same as the above, but uses @samp{other-user} as the user
+name when authenticating.  This is handy if you have several
+@acronym{SMTP} accounts on the same server.
+
+@item sendmail
+
+@example
+X-Message-SMTP-Method: sendmail
+@end example
+
+This will send the message via the locally installed sendmail/exim/etc
+installation.
+
+@end table
+
 @item message-mh-deletable-headers
 @vindex message-mh-deletable-headers
 Most versions of MH doesn't like being fed messages that contain the
index 60de89e676de1ac4b0d1a0a9775b53e6bca20345..6be385aeba952ab2c70ae4ae95ee3309bc976e1d 100644 (file)
@@ -52,9 +52,8 @@ developing GNU and promoting software freedom.''
 @contents
 
 @ifnottex
-@node Top, Introduction, (dir), (dir)
+@node Top
 @top Supercite
-@comment  node-name,  next,  previous,  up
 
 @insertcopying
 
@@ -64,13 +63,13 @@ into the following chapters.
 @menu
 * Introduction::
 * Citations::
+* Information Keys and the Info Alist::
+* Reference Headers::
 * Getting Connected::
 * Replying and Yanking::
 * Selecting an Attribution::
 * Configuring the Citation Engine::
 * Post-yank Formatting Commands::
-* Information Keys and the Info Alist::
-* Reference Headers::
 * Hints to MUA Authors::
 * Thanks and History::
 
@@ -83,7 +82,7 @@ into the following chapters.
 @end ifnottex
 
 
-@node  Introduction, Usage Overview, Top, Top
+@node  Introduction
 @chapter Introduction
 
 Supercite is a GNU Emacs package written entirely in Emacs Lisp. It
@@ -111,14 +110,14 @@ formatting styles are available in that reply buffer until the reply is
 sent.  Supercite is re-initialized in each new reply buffer.
 
 
-@node Usage Overview, What Supercite Does Not Do, Introduction, Introduction
+@node Usage Overview
+@section Usage Overview
 @kindex r
 @kindex f
 @kindex C-c C-y
 @cindex yank
 @cindex cite, citing
 @cindex attribute, attributing
-@section Usage Overview
 
 Typical usage is as follows. You want to reply or followup to a message
 in your MUA. You will probably hit @kbd{r} (i.e., ``reply'') or @kbd{f}
@@ -136,7 +135,7 @@ special text tag.  Most MUAs provide some default style of citing; by
 using Supercite you gain a wider flexibility in the look and style of
 citations.  Supercite's only job is to cite the original message.
 
-@node  What Supercite Does Not Do, What Supercite Does, Usage Overview, Introduction
+@node  What Supercite Does Not Do
 @section What Supercite Doesn't Do
 
 Because of this clear division of labor, there are useful features which
@@ -157,9 +156,9 @@ know anything about the meaning of these headers, and never ventures
 outside the designated region. @xref{Hints to MUA Authors}, for more
 details.@refill
 
-@node  What Supercite Does, Citations, What Supercite Does Not Do, Introduction
-@findex sc-cite-original
+@node  What Supercite Does
 @section What Supercite Does
+@findex sc-cite-original
 
 Supercite is invoked for the first time on a reply buffer via your MUA's
 reply or forward command.  This command will actually perform citations
@@ -217,10 +216,10 @@ but it is also immediately useful with the default configuration, once
 it has been properly connected to your MUA.  @xref{Getting Connected},
 for more details.@refill
 
-@node  Citations, Citation Elements, What Supercite Does, Top
+@node  Citations
+@chapter Citations
 @cindex nested citations
 @cindex citation
-@chapter Citations
 
 A @dfn{citation} is the acknowledgement of the original author of a mail
 message in the body of the reply.  There are two basic citation styles
@@ -280,9 +279,9 @@ non-nested citations are used.  When non-@code{nil}, nested citations
 are used.
 
 
-@node  Citation Elements, Recognizing Citations, Citations, Citations
-@cindex citation string
+@node  Citation Elements
 @section Citation Elements
+@cindex citation string
 
 @dfn{Citation strings} are composed of one or more elements. Non-nested
 citations are composed of four elements, three of which are directly
@@ -335,7 +334,7 @@ of the same elements, sans the attribution string.  Supercite is smart
 enough to not put additional spaces between citation delimiters for
 multi-level nested citations.
 
-@node  Recognizing Citations, Getting Connected, Citation Elements, Citations
+@node  Recognizing Citations
 @section Recognizing Citations
 
 Supercite also recognizes citations in the original article, and can
@@ -379,13 +378,13 @@ non-nested citation roots.  It is important to remember that if you
 change @code{sc-citation-root-regexp} you should always also change
 @code{sc-citation-nonnested-root-regexp}.@refill
 
-@node  Information Keys and the Info Alist, Reference Headers, Miscellaneous Commands, Top
+@node  Information Keys and the Info Alist
+@chapter Information Keys and the Info Alist
 @cindex information keys
 @cindex Info Alist
 @cindex information extracted from mail fields
 @findex sc-mail-field
 @findex mail-field (sc-)
-@chapter Information Keys and the Info Alist
 
 @dfn{Mail header information keys} are nuggets of information that
 Supercite extracts from the various mail headers of the original
@@ -489,9 +488,9 @@ If the author's name has more than one middle name, they will appear as
 info keys with the appropriate index (e.g., @code{"sc-middlename-2"},
 @dots{}).  @xref{Selecting an Attribution}.@refill
 
-@node  Reference Headers, The Built-in Header Rewrite Functions, Information Keys and the Info Alist, Top
-@cindex reference headers
+@node  Reference Headers
 @chapter Reference Headers
+@cindex reference headers
 
 Supercite will insert an informative @dfn{reference header} at the
 beginning of the cited body of text, which display more detail about the
@@ -528,9 +527,9 @@ functions. The one it uses is defined in the variable
 integer which is an index into the @code{sc-rewrite-header-list},
 beginning at zero.
 
-@node  The Built-in Header Rewrite Functions, Electric References, Reference Headers, Reference Headers
-@cindex header rewrite functions, built-in
+@node  The Built-in Header Rewrite Functions
 @section The Built-in Header Rewrite Functions
+@cindex header rewrite functions, built-in
 
 Below are examples of the various built-in header rewrite functions.
 Please note the following:@: first, the text which appears in the
@@ -607,9 +606,9 @@ line after the @code{mail-header-separator} line will be removed.
 @code{>>>>> see @var{references} for more details}
 @end table
 
-@node  Electric References, Hints to MUA Authors, The Built-in Header Rewrite Functions, Reference Headers
-@cindex electric references
+@node  Electric References
 @section Electric References
+@cindex electric references
 
 By default, when Supercite cites the original message for the first
 time, it just goes ahead and inserts the reference header indexed by
@@ -703,10 +702,9 @@ Exit from electric reference mode without inserting the current header.
 Supercite will execute the hook @code{sc-electric-mode-hook} before
 entering electric reference mode.
 
-@node  Getting Connected, Replying and Yanking, Recognizing Citations, Top
-@cindex citation interface specification
+@node  Getting Connected
 @chapter Getting Connected
-
+@cindex citation interface specification
 
 @vindex mail-citation-hook
 @cindex .emacs file
@@ -785,7 +783,7 @@ In that case, you can use the @code{sc-pre-hook} variable, but this will
 get executed every time @code{sc-cite-original} is called.  @xref{Reply
 Buffer Initialization}.@refill
 
-@node  Replying and Yanking, Reply Buffer Initialization, Getting Connected, Top
+@node  Replying and Yanking
 @chapter Replying and Yanking
 
 This chapter explains what happens when you reply and yank an original
@@ -796,10 +794,10 @@ message from an MUA.
 * Filling Cited Text::
 @end menu
 
-@node  Reply Buffer Initialization, Filling Cited Text, Replying and Yanking, Replying and Yanking
+@node  Reply Buffer Initialization
+@section Reply Buffer Initialization
 @findex sc-cite-original
 @findex cite-original (sc-)
-@section Reply Buffer Initialization
 
 Executing @code{sc-cite-original} performs the following steps as it
 initializes the reply buffer:
@@ -953,7 +951,8 @@ for completeness and backward compatibility. Perhaps it could be used to
 reset certain variables set in @code{sc-pre-hook}.@refill
 @end enumerate
 
-@node  Filling Cited Text, Selecting an Attribution, Reply Buffer Initialization, Replying and Yanking
+@node  Filling Cited Text
+@section Filling Cited Text
 @cindex filling paragraphs
 @vindex sc-auto-fill-region-p
 @vindex auto-fill-region-p (sc-)
@@ -963,7 +962,6 @@ reset certain variables set in @code{sc-pre-hook}.@refill
 @findex setup-filladapt (sc-)
 @vindex sc-load-hook
 @vindex load-hook (sc-)
-@section Filling Cited Text
 
 Supercite will automatically fill newly cited text from the original
 message unless the variable @code{sc-auto-fill-region-p} has a
@@ -1032,11 +1030,11 @@ have been widespread complaints on the net about mail and news messages
 containing lines greater than about 72 characters.  So the default is to
 fill cited text.
 
-@node  Selecting an Attribution, Attribution Preferences, Filling Cited Text, Top
+@node  Selecting an Attribution
+@chapter Selecting an Attribution
 @cindex attribution list
 @vindex sc-preferred-attribution-list
 @vindex preferred-attribution-list (sc-)
-@chapter Selecting an Attribution
 
 As you know, the attribution string is the part of the author's name
 that will be used to composed a non-nested citation string. Supercite
@@ -1054,7 +1052,7 @@ author's initials, and the author's email terminus.
 * Author Names::
 @end menu
 
-@node  Attribution Preferences, Anonymous Attributions, Selecting an Attribution, Selecting an Attribution
+@node  Attribution Preferences
 @section Attribution Preferences
 
 When you cite an original message, you can tell Supercite which part of
@@ -1156,12 +1154,12 @@ what nickname they would prefer to use, and you can set up this list to
 match against a specific mail field, e.g., @samp{From:@:}, allowing you
 to cite your friend's message with the appropriate attribution.
 
-@node  Anonymous Attributions, Author Names, Attribution Preferences, Selecting an Attribution
+@node  Anonymous Attributions
+@section Anonymous Attributions
 @vindex sc-default-author-name
 @vindex default-author-name (sc-)
 @vindex sc-default-attribution
 @vindex default-attribution (sc-)
-@section Anonymous Attributions
 
 When the author's name cannot be found in the @samp{From:@:} mail
 header, a fallback author name and attribution string must be supplied.
@@ -1245,9 +1243,9 @@ to override any automatically derived attribution string when it is only
 one character long; e.g. you prefer to use @code{"initials"} but the
 author only has one name.@refill
 
-@node  Author Names, Configuring the Citation Engine, Anonymous Attributions, Selecting an Attribution
-@cindex author names
+@node  Author Names
 @section Author Names
+@cindex author names
 
 Supercite employs a number of heuristics to decipher the author's name
 based on value of the @samp{From:@:} mail field of the original message.
@@ -1307,11 +1305,11 @@ The position indicator is an integer, or one of the two special symbols
 word in the name field, while @code{any} matches against every word in
 the name field.
 
-@node  Configuring the Citation Engine, Using Regi, Author Names, Top
+@node  Configuring the Citation Engine
+@chapter Configuring the Citation Engine
 @cindex Regi
 @cindex frames (Regi)
 @cindex entries (Regi)
-@chapter Configuring the Citation Engine
 
 At the heart of Supercite is a regular expression interpreting engine
 called @dfn{Regi}.  Regi operates by interpreting a data structure
@@ -1343,11 +1341,11 @@ Supercite to recognize such things as uuencoded messages or C code and
 cite or fill those differently than normal text.  None of this is
 currently part of Supercite, but contributions are welcome!
 
-@node  Using Regi, Frames You Can Customize, Configuring the Citation Engine, Configuring the Citation Engine
+@node  Using Regi
+@section Using Regi
 @findex regi-interpret
 @findex eval
 @findex looking-at
-@section Using Regi
 
 Regi works by interpreting frames with the function
 @code{regi-interpret}.  A frame is a list of arbitrary size where each
@@ -1441,9 +1439,9 @@ The current frame being interpreted.
 The current frame entry being interpreted.
 @end table
 
-@node  Frames You Can Customize, Post-yank Formatting Commands, Using Regi, Configuring the Citation Engine
-@vindex sc-nuke-mail-header
+@node  Frames You Can Customize
 @section Frames You Can Customize
+@vindex sc-nuke-mail-header
 
 As mentioned earlier, Supercite uses various frames to perform
 certain jobs such as mail header information extraction and mail header
@@ -1505,11 +1503,11 @@ When Supercite is about to cite, uncite, or recite a region, it consults
 the appropriate alist and attempts to find a frame to use.  If one
 is not found from the alist, then the appropriate default frame is used.
 
-@node  Post-yank Formatting Commands, Citing Commands, Frames You Can Customize, Top
+@node  Post-yank Formatting Commands
+@chapter Post-yank Formatting Commands
 @vindex sc-mode-map-prefix
 @vindex mode-map-prefix (sc-)
 @kindex C-c C-p
-@chapter Post-yank Formatting Commands
 
 Once the original message has been yanked into the reply buffer, and
 @code{sc-cite-original} has had a chance to do its thing, a number of
@@ -1533,9 +1531,9 @@ prefix.@refill
 * Miscellaneous Commands::
 @end menu
 
-@node   Citing Commands, Insertion Commands, Post-yank Formatting Commands, Post-yank Formatting Commands
-@vindex sc-cite-region-limit
+@node   Citing Commands
 @section Commands to Manually Cite, Recite, and Uncite
+@vindex sc-cite-region-limit
 
 Probably the three most common post-yank formatting operations that you
 will perform will be the manual citing, reciting, and unciting of
@@ -1595,7 +1593,7 @@ Supercite will always ask you to confirm the attribution when reciting a
 region, regardless of the value of @code{sc-confirm-always-p}.
 @end table
 
-@node  Insertion Commands, Variable Toggling Shortcuts, Citing Commands, Post-yank Formatting Commands
+@node  Insertion Commands
 @section Insertion Commands
 
 These two functions insert various strings into the reply buffer.
@@ -1625,9 +1623,9 @@ Inserts the current citation string at the beginning of the line that
 an error and will not cite the line.
 @end table
 
-@node  Variable Toggling Shortcuts, Mail Field Commands, Insertion Commands, Post-yank Formatting Commands
-@cindex toggling variables
+@node  Variable Toggling Shortcuts
 @section Variable Toggling Shortcuts
+@cindex toggling variables
 
 Supercite defines a number of commands that make it easier for you to
 toggle and set various Supercite variables as you are editing the reply
@@ -1705,7 +1703,7 @@ Finally, the command @kbd{C-c C-p C-t h} (also @kbd{C-c C-p C-t ?})
 brings up a Help message on the toggling keymap.
 
 
-@node  Mail Field Commands, Miscellaneous Commands, Variable Toggling Shortcuts, Post-yank Formatting Commands
+@node  Mail Field Commands
 @section Mail Field Commands
 
 These commands allow you to view, modify, add, and delete various bits
@@ -1755,7 +1753,7 @@ message author.  Note that unless an error during processing occurs, any
 old information is lost.@refill
 @end table
 
-@node  Miscellaneous Commands, Information Keys and the Info Alist, Mail Field Commands, Post-yank Formatting Commands
+@node  Miscellaneous Commands
 @section Miscellaneous Commands
 
 @table @asis
@@ -1769,7 +1767,7 @@ citation string in front of the new line.  As with @code{open-line},
 an optional numeric argument inserts that many new lines.@refill
 @end table
 
-@node  Hints to MUA Authors, Thanks and History, Electric References, Top
+@node  Hints to MUA Authors
 @chapter Hints to MUA Authors
 
 In June of 1989, some discussion was held between the various MUA
@@ -1851,7 +1849,7 @@ need only add @code{sc-cite-original} to this list of hooks using
 If you do all this your MUA will join the ranks of those that conform to
 this interface ``out of the box.''
 
-@node Thanks and History, GNU Free Documentation License, Hints to MUA Authors, Top
+@node Thanks and History
 @chapter Thanks and History
 
 The Supercite package was derived from its predecessor Superyank 1.11
@@ -1888,15 +1886,15 @@ All who have helped and contributed have been greatly appreciated.
 
 Supercite was written by Barry Warsaw.
 
-@node GNU Free Documentation License, Concept Index, Thanks and History, Top
+@node GNU Free Documentation License
 @appendix GNU Free Documentation License
 @include doclicense.texi
 
-@node  Concept Index, Command Index, GNU Free Documentation License, Top
+@node  Concept Index
 @unnumbered Concept Index
 @printindex cp
 
-@node  Command Index, Key Index, Concept Index, Top
+@node  Command Index
 @unnumbered Command Index
 
 Since all supercite commands are prepended with the string
@@ -1907,11 +1905,11 @@ its @var{command} name.
 @end iftex
 @printindex fn
 
-@node  Key Index, Variable Index, Command Index, Top
+@node  Key Index
 @unnumbered Key Index
 @printindex ky
 
-@node Variable Index,  , Key Index, Top
+@node Variable Index
 @unnumbered Variable Index
 
 Since all supercite variables are prepended with the string
index 3298298bb9d4eab87e64993796b93242d5bc591d..2b646dd671c1a36a9e11b62bfe9cf42fb7062252 100644 (file)
@@ -3,11 +3,11 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2011-09-23.09}
+\def\texinfoversion{2012-07-03.16}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+% 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
@@ -28,9 +28,9 @@
 %
 % Please try the latest version of texinfo.tex before submitting bug
 % reports; you can get the latest version from:
-%   http://www.gnu.org/software/texinfo/ (the Texinfo home page), or
-%   ftp://tug.org/tex/texinfo.tex
-%     (and all CTAN mirrors, see http://www.ctan.org).
+%   http://ftp.gnu.org/gnu/texinfo/ (the Texinfo release area), or
+%   http://ftpmirror.gnu.org/texinfo/ (same, via a mirror), or
+%   http://www.gnu.org/software/texinfo/ (the Texinfo home page)
 % The texinfo.tex in any given distribution could well be out
 % of date, so if that's what you're using, please check.
 %
 % Set up fixed words for English if not already set.
 \ifx\putwordAppendix\undefined  \gdef\putwordAppendix{Appendix}\fi
 \ifx\putwordChapter\undefined   \gdef\putwordChapter{Chapter}\fi
+\ifx\putworderror\undefined     \gdef\putworderror{error}\fi
 \ifx\putwordfile\undefined      \gdef\putwordfile{file}\fi
 \ifx\putwordin\undefined        \gdef\putwordin{in}\fi
 \ifx\putwordIndexIsEmpty\undefined       \gdef\putwordIndexIsEmpty{(Index is empty)}\fi
   \errorcontextlines16
 }%
 
+% @errormsg{MSG}.  Do the index-like expansions on MSG, but if things
+% aren't perfect, it's not the end of the world, being an error message,
+% after all.
+% 
+\def\errormsg{\begingroup \indexnofonts \doerrormsg}
+\def\doerrormsg#1{\errmessage{#1}}
+
 % add check for \lastpenalty to plain's definitions.  If the last thing
 % we did was a \nobreak, we don't want to insert more space.
 %
@@ -879,7 +887,7 @@ where each line of input produces a line of output.}
 \def\popthisfilestack{\errthisfilestackempty}
 \def\errthisfilestackempty{\errmessage{Internal error:
   the stack of filenames is empty.}}
-
+%
 \def\thisfile{}
 
 % @center line
@@ -887,36 +895,46 @@ where each line of input produces a line of output.}
 %
 \parseargdef\center{%
   \ifhmode
-    \let\next\centerH
+    \let\centersub\centerH
   \else
-    \let\next\centerV
+    \let\centersub\centerV
   \fi
-  \next{\hfil \ignorespaces#1\unskip \hfil}%
+  \centersub{\hfil \ignorespaces#1\unskip \hfil}%
+  \let\centersub\relax % don't let the definition persist, just in case
 }
-\def\centerH#1{%
-  {%
-    \hfil\break
-    \advance\hsize by -\leftskip
-    \advance\hsize by -\rightskip
-    \line{#1}%
-    \break
-  }%
+\def\centerH#1{{%
+  \hfil\break
+  \advance\hsize by -\leftskip
+  \advance\hsize by -\rightskip
+  \line{#1}%
+  \break
+}}
+%
+\newcount\centerpenalty
+\def\centerV#1{%
+  % The idea here is the same as in \startdefun, \cartouche, etc.: if
+  % @center is the first thing after a section heading, we need to wipe
+  % out the negative parskip inserted by \sectionheading, but still
+  % prevent a page break here.
+  \centerpenalty = \lastpenalty
+  \ifnum\centerpenalty>10000 \vskip\parskip \fi
+  \ifnum\centerpenalty>9999 \penalty\centerpenalty \fi
+  \line{\kern\leftskip #1\kern\rightskip}%
 }
-\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}}
 
 % @sp n   outputs n lines of vertical space
-
+%
 \parseargdef\sp{\vskip #1\baselineskip}
 
 % @comment ...line which is ignored...
 % @c is the same as @comment
 % @ignore ... @end ignore  is another way to write a comment
-
+%
 \def\comment{\begingroup \catcode`\^^M=\other%
 \catcode`\@=\other \catcode`\{=\other \catcode`\}=\other%
 \commentxxx}
 {\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}}
-
+%
 \let\c=\comment
 
 % @paragraphindent NCHARS
@@ -1089,50 +1107,24 @@ where each line of input produces a line of output.}
 % for display in the outlines, and in other places.  Thus, we have to
 % double any backslashes.  Otherwise, a name like "\node" will be
 % interpreted as a newline (\n), followed by o, d, e.  Not good.
-% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html
-% (and related messages, the final outcome is that it is up to the TeX
-% user to double the backslashes and otherwise make the string valid, so
-% that's what we do).
-
-% double active backslashes.
-%
-{\catcode`\@=0 \catcode`\\=\active
- @gdef@activebackslashdouble{%
-   @catcode`@\=@active
-   @let\=@doublebackslash}
-}
-
-% To handle parens, we must adopt a different approach, since parens are
-% not active characters.  hyperref.dtx (which has the same problem as
-% us) handles it with this amazing macro to replace tokens, with minor
-% changes for Texinfo.  It is included here under the GPL by permission
-% from the author, Heiko Oberdiek.
-%
-% #1 is the tokens to replace.
-% #2 is the replacement.
-% #3 is the control sequence with the string.
-%
-\def\HyPsdSubst#1#2#3{%
-  \def\HyPsdReplace##1#1##2\END{%
-    ##1%
-    \ifx\\##2\\%
-    \else
-      #2%
-      \HyReturnAfterFi{%
-        \HyPsdReplace##2\END
-      }%
-    \fi
-  }%
-  \xdef#3{\expandafter\HyPsdReplace#3#1\END}%
-}
-\long\def\HyReturnAfterFi#1\fi{\fi#1}
-
-% #1 is a control sequence in which to do the replacements.
-\def\backslashparens#1{%
-  \xdef#1{#1}% redefine it as its expansion; the definition is simply
-             % \lastnode when called from \setref -> \pdfmkdest.
-  \HyPsdSubst{(}{\realbackslash(}{#1}%
-  \HyPsdSubst{)}{\realbackslash)}{#1}%
+% 
+% See http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html and
+% related messages.  The final outcome is that it is up to the TeX user
+% to double the backslashes and otherwise make the string valid, so
+% that's what we do.  pdftex 1.30.0 (ca.2005) introduced a primitive to
+% do this reliably, so we use it.
+
+% #1 is a control sequence in which to do the replacements,
+% which we \xdef.
+\def\txiescapepdf#1{%
+  \ifx\pdfescapestring\thisisundefined
+    % No primitive available; should we give a warning or log?
+    % Many times it won't matter.
+  \else
+    % The expandable \pdfescapestring primitive escapes parentheses,
+    % backslashes, and other special chars.
+    \xdef#1{\pdfescapestring{#1}}%
+  \fi
 }
 
 \newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
@@ -1191,32 +1183,34 @@ output) for that.)}
   %
   % #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
   \def\dopdfimage#1#2#3{%
-    \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
-    \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
+    \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
+    \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
     %
-    % pdftex (and the PDF format) support .png, .jpg, .pdf (among
-    % others).  Let's try in that order.
+    % pdftex (and the PDF format) support .pdf, .png, .jpg (among
+    % others).  Let's try in that order, PDF first since if
+    % someone has a scalable image, presumably better to use that than a
+    % bitmap.
     \let\pdfimgext=\empty
     \begingroup
-      \openin 1 #1.png \ifeof 1
-        \openin 1 #1.jpg \ifeof 1
-          \openin 1 #1.jpeg \ifeof 1
-            \openin 1 #1.JPG \ifeof 1
-              \openin 1 #1.pdf \ifeof 1
-                \openin 1 #1.PDF \ifeof 1
+      \openin 1 #1.pdf \ifeof 1
+        \openin 1 #1.PDF \ifeof 1
+          \openin 1 #1.png \ifeof 1
+            \openin 1 #1.jpg \ifeof 1
+              \openin 1 #1.jpeg \ifeof 1
+                \openin 1 #1.JPG \ifeof 1
                   \errhelp = \nopdfimagehelp
                   \errmessage{Could not find image file #1 for pdf}%
-                \else \gdef\pdfimgext{PDF}%
+                \else \gdef\pdfimgext{JPG}%
                 \fi
-              \else \gdef\pdfimgext{pdf}%
+              \else \gdef\pdfimgext{jpeg}%
               \fi
-            \else \gdef\pdfimgext{JPG}%
+            \else \gdef\pdfimgext{jpg}%
             \fi
-          \else \gdef\pdfimgext{jpeg}%
+          \else \gdef\pdfimgext{png}%
           \fi
-        \else \gdef\pdfimgext{jpg}%
+        \else \gdef\pdfimgext{PDF}%
         \fi
-      \else \gdef\pdfimgext{png}%
+      \else \gdef\pdfimgext{pdf}%
       \fi
       \closein 1
     \endgroup
@@ -1228,8 +1222,8 @@ output) for that.)}
     \else
       \immediate\pdfximage
     \fi
-      \ifdim \wd0 >0pt width \imagewidth \fi
-      \ifdim \wd2 >0pt height \imageheight \fi
+      \ifdim \wd0 >0pt width \pdfimagewidth \fi
+      \ifdim \wd2 >0pt height \pdfimageheight \fi
       \ifnum\pdftexversion<13
          #1.\pdfimgext
        \else
@@ -1244,10 +1238,9 @@ output) for that.)}
     % such as \, aren't expanded when present in a section title.
     \indexnofonts
     \turnoffactive
-    \activebackslashdouble
     \makevalueexpandable
     \def\pdfdestname{#1}%
-    \backslashparens\pdfdestname
+    \txiescapepdf\pdfdestname
     \safewhatsit{\pdfdest name{\pdfdestname} xyz}%
   }}
   %
@@ -1279,28 +1272,22 @@ output) for that.)}
     % page number.  We could generate a destination for the section
     % text in the case where a section has no node, but it doesn't
     % seem worth the trouble, since most documents are normally structured.
-    \def\pdfoutlinedest{#3}%
+    \edef\pdfoutlinedest{#3}%
     \ifx\pdfoutlinedest\empty
       \def\pdfoutlinedest{#4}%
     \else
-      % Doubled backslashes in the name.
-      {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
-       \backslashparens\pdfoutlinedest}%
+      \txiescapepdf\pdfoutlinedest
     \fi
     %
-    % Also double the backslashes in the display string.
-    {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
-     \backslashparens\pdfoutlinetext}%
+    % Also escape PDF chars in the display string.
+    \edef\pdfoutlinetext{#1}%
+    \txiescapepdf\pdfoutlinetext
     %
     \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}%
   }
   %
   \def\pdfmakeoutlines{%
     \begingroup
-      % Thanh's hack / proper braces in bookmarks
-      \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace
-      \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace
-      %
       % Read toc silently, to get counts of subentries for \pdfoutline.
       \def\partentry##1##2##3##4{}% ignore parts in the outlines
       \def\numchapentry##1##2##3##4{%
@@ -1356,25 +1343,41 @@ output) for that.)}
       % Latin 2 (0xea) gets translated to a | character.  Info from
       % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
       %
-      % xx to do this right, we have to translate 8-bit characters to
-      % their "best" equivalent, based on the @documentencoding.  Right
-      % now, I guess we'll just let the pdf reader have its way.
+      % TODO this right, we have to translate 8-bit characters to
+      % their "best" equivalent, based on the @documentencoding.  Too
+      % much work for too little return.  Just use the ASCII equivalents
+      % we use for the index sort strings.
+      % 
       \indexnofonts
       \setupdatafile
+      % We can have normal brace characters in the PDF outlines, unlike
+      % Texinfo index files.  So set that up.
+      \def\{{\lbracecharliteral}%
+      \def\}{\rbracecharliteral}%
       \catcode`\\=\active \otherbackslash
       \input \tocreadfilename
     \endgroup
   }
+  {\catcode`[=1 \catcode`]=2
+   \catcode`{=\other \catcode`}=\other
+   \gdef\lbracecharliteral[{]%
+   \gdef\rbracecharliteral[}]%
+  ]
   %
   \def\skipspaces#1{\def\PP{#1}\def\D{|}%
     \ifx\PP\D\let\nextsp\relax
     \else\let\nextsp\skipspaces
-      \ifx\p\space\else\addtokens{\filename}{\PP}%
-        \advance\filenamelength by 1
-      \fi
+      \addtokens{\filename}{\PP}%
+      \advance\filenamelength by 1
     \fi
     \nextsp}
-  \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
+  \def\getfilename#1{%
+    \filenamelength=0
+    % If we don't expand the argument now, \skipspaces will get
+    % snagged on things like "@value{foo}".
+    \edef\temp{#1}%
+    \expandafter\skipspaces\temp|\relax
+  }
   \ifnum\pdftexversion < 14
     \let \startlink \pdfannotlink
   \else
@@ -1471,9 +1474,6 @@ output) for that.)}
 \def\ttsl{\setfontstyle{ttsl}}
 
 
-% Default leading.
-\newdimen\textleading  \textleading = 13.2pt
-
 % Set the baselineskip to #1, and the lineskip and strut size
 % correspondingly.  There is no deep meaning behind these magic numbers
 % used as factors; they just match (closely enough) what Knuth defined.
@@ -1485,6 +1485,7 @@ output) for that.)}
 % can get a sort of poor man's double spacing by redefining this.
 \def\baselinefactor{1}
 %
+\newdimen\textleading
 \def\setleading#1{%
   \dimen0 = #1\relax
   \normalbaselineskip = \baselinefactor\dimen0
@@ -1757,18 +1758,24 @@ end
 \fi\fi
 
 
-% Set the font macro #1 to the font named #2, adding on the
-% specified font prefix (normally `cm').
+% Set the font macro #1 to the font named \fontprefix#2.
 % #3 is the font's design size, #4 is a scale factor, #5 is the CMap
-% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
-% empty to omit).
+% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
+% Example:
+% #1 = \textrm
+% #2 = \rmshape
+% #3 = 10
+% #4 = \mainmagstep
+% #5 = OT1
+%
 \def\setfont#1#2#3#4#5{%
   \font#1=\fontprefix#2#3 scaled #4
   \csname cmap#5\endcsname#1%
 }
 % This is what gets called when #5 of \setfont is empty.
 \let\cmap\gobble
-% emacs-page end of cmaps
+%
+% (end of cmaps)
 
 % Use cm as the default font prefix.
 % To specify the font prefix, you must define \fontprefix
@@ -1778,7 +1785,7 @@ end
 \fi
 % Support font families that don't use the same naming scheme as CM.
 \def\rmshape{r}
-\def\rmbshape{bx}               %where the normal face is bold
+\def\rmbshape{bx}               % where the normal face is bold
 \def\bfshape{b}
 \def\bxshape{bx}
 \def\ttshape{tt}
@@ -1793,8 +1800,7 @@ end
 \def\scshape{csc}
 \def\scbshape{csc}
 
-% Definitions for a main text size of 11pt.  This is the default in
-% Texinfo.
+% Definitions for a main text size of 11pt.  (The default in Texinfo.)
 %
 \def\definetextfontsizexi{%
 % Text fonts (11.2pt, magstep1).
@@ -1919,7 +1925,7 @@ end
 \textleading = 13.2pt % line spacing for 11pt CM
 \textfonts            % reset the current fonts
 \rm
-} % end of 11pt text font size definitions
+} % end of 11pt text font size definitions, \definetextfontsizexi
 
 
 % Definitions to make the main text be 10pt Computer Modern, with
@@ -2051,7 +2057,7 @@ end
 \textleading = 12pt   % line spacing for 10pt CM
 \textfonts            % reset the current fonts
 \rm
-} % end of 10pt text font size definitions
+} % end of 10pt text font size definitions, \definetextfontsizex
 
 
 % We provide the user-level command
@@ -2372,7 +2378,9 @@ end
   \else\ifx\next-%
   \else\ifx\next.%
   \else\ptexslash
-  \fi\fi\fi}
+  \fi\fi\fi
+  \aftersmartic
+}
 
 % like \smartslanted except unconditionally uses \ttsl, and no ic.
 % @var is set to this for defun arguments.
@@ -2382,9 +2390,15 @@ end
 % ttsl for book titles, do we?
 \def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
 
+\def\aftersmartic{}
+\def\var#1{%
+  \let\saveaftersmartic = \aftersmartic
+  \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
+  \smartslanted{#1}%
+}
+
 \let\i=\smartitalic
 \let\slanted=\smartslanted
-\def\var#1{\smartslanted{#1}}
 \let\dfn=\smartslanted
 \let\emph=\smartitalic
 
@@ -2480,7 +2494,7 @@ end
     \plainfrenchspacing
     #1%
   }%
-  \null
+  \null % reset spacefactor to 1000
 }
 
 % We *must* turn on hyphenation at `-' and `_' in @code.
@@ -2762,6 +2776,7 @@ end
   \ifx\temp\empty \else
     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   \fi
+  \null % reset \spacefactor=1000
 }
 
 % @abbr for "Comput. J." and the like.
@@ -2774,6 +2789,7 @@ end
   \ifx\temp\empty \else
     \space ({\unsepspaces \ignorespaces \temp \unskip})%
   \fi
+  \null % reset \spacefactor=1000
 }
 
 % @asis just yields its argument.  Used with @table, for example.
@@ -2838,20 +2854,48 @@ end
   }
 }
 
+% @inlinefmt{FMTNAME,PROCESSED-TEXT} and @inlineraw{FMTNAME,RAW-TEXT}.
+% Ignore unless FMTNAME == tex; then it is like @iftex and @tex,
+% except specified as a normal braced arg, so no newlines to worry about.
+% 
+\def\outfmtnametex{tex}
+%
+\long\def\inlinefmt#1{\doinlinefmt #1,\finish}
+\long\def\doinlinefmt#1,#2,\finish{%
+  \def\inlinefmtname{#1}%
+  \ifx\inlinefmtname\outfmtnametex \ignorespaces #2\fi
+}
+% For raw, must switch into @tex before parsing the argument, to avoid
+% setting catcodes prematurely.  Doing it this way means that, for
+% example, @inlineraw{html, foo{bar} gets a parse error instead of being
+% ignored.  But this isn't important because if people want a literal
+% *right* brace they would have to use a command anyway, so they may as
+% well use a command to get a left brace too.  We could re-use the
+% delimiter character idea from \verb, but it seems like overkill.
+% 
+\long\def\inlineraw{\tex \doinlineraw}
+\long\def\doinlineraw#1{\doinlinerawtwo #1,\finish}
+\def\doinlinerawtwo#1,#2,\finish{%
+  \def\inlinerawname{#1}%
+  \ifx\inlinerawname\outfmtnametex \ignorespaces #2\fi
+  \endgroup % close group opened by \tex.
+}
+
 
 \message{glyphs,}
 % and logos.
 
-% @@ prints an @.
+% @@ prints an @, as does @atchar{}.
 \def\@{\char64 }
+\let\atchar=\@
 
-% Used to generate quoted braces.  Unless we're in typewriter, use
-% \ecfont because the CM text fonts do not have braces, and we don't
-% want to switch into math.
+% @{ @} @lbracechar{} @rbracechar{} all generate brace characters.
+% Unless we're in typewriter, use \ecfont because the CM text fonts do
+% not have braces, and we don't want to switch into math.
 \def\mylbrace{{\ifmonospace\else\ecfont\fi \char123}}
 \def\myrbrace{{\ifmonospace\else\ecfont\fi \char125}}
-\let\{=\mylbrace
-\let\}=\myrbrace
+\let\{=\mylbrace \let\lbracechar=\{
+\let\}=\myrbrace \let\rbracechar=\}
 \begingroup
   % Definitions to produce \{ and \} commands for indices,
   % and @{ and @} for the aux/toc files.
@@ -2979,7 +3023,7 @@ end
 {\tentt \global\dimen0 = 3em}% Width of the box.
 \dimen2 = .55pt % Thickness of rules
 % The text. (`r' is open on the right, `e' somewhat less so on the left.)
-\setbox0 = \hbox{\kern-.75pt \reducedsf error\kern-1.5pt}
+\setbox0 = \hbox{\kern-.75pt \reducedsf \putworderror\kern-1.5pt}
 %
 \setbox\errorbox=\hbox to \dimen0{\hfil
    \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right.
@@ -4162,7 +4206,7 @@ end
 }
 \def\ifsetfail{\doignore{ifset}}
 
-% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been
+% @ifclear VAR ... @end executes the `...' iff VAR has never been
 % defined with @set, or has been undefined with @clear.
 %
 % The `\else' inside the `\doifset' parameter is a trick to reuse the
@@ -4173,6 +4217,35 @@ end
 \def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}}
 \def\ifclearfail{\doignore{ifclear}}
 
+% @ifcommandisdefined CMD ... @end executes the `...' if CMD (written
+% without the @) is in fact defined.  We can only feasibly check at the
+% TeX level, so something like `mathcode' is going to considered
+% defined even though it is not a Texinfo command.
+% 
+\makecond{ifcommanddefined}
+\def\ifcommanddefined{\parsearg{\doifcmddefined{\let\next=\ifcmddefinedfail}}}
+%
+\def\doifcmddefined#1#2{{%
+    \makevalueexpandable
+    \let\next=\empty
+    \expandafter\ifx\csname #2\endcsname\relax
+      #1% If not defined, \let\next as above.
+    \fi
+    \expandafter
+  }\next
+}
+\def\ifcmddefinedfail{\doignore{ifcommanddefined}}
+
+% @ifcommandnotdefined CMD ... handlded similar to @ifclear above.
+\makecond{ifcommandnotdefined}
+\def\ifcommandnotdefined{%
+  \parsearg{\doifcmddefined{\else \let\next=\ifcmdnotdefinedfail}}}
+\def\ifcmdnotdefinedfail{\doignore{ifcommandnotdefined}}
+
+% Set the `txicommandconditionals' variable, so documents have a way to
+% test if the @ifcommand...defined conditionals are available.
+\set txicommandconditionals
+
 % @dircategory CATEGORY  -- specify a category of the dir file
 % which this file should belong to.  Ignore this in TeX.
 \let\dircategory=\comment
@@ -4409,6 +4482,7 @@ end
   \definedummyword\guillemetright
   \definedummyword\guilsinglleft
   \definedummyword\guilsinglright
+  \definedummyword\lbracechar
   \definedummyword\leq
   \definedummyword\minus
   \definedummyword\ogonek
@@ -4421,6 +4495,7 @@ end
   \definedummyword\quoteleft
   \definedummyword\quoteright
   \definedummyword\quotesinglbase
+  \definedummyword\rbracechar
   \definedummyword\result
   \definedummyword\textdegree
   %
@@ -4472,7 +4547,9 @@ end
   \definedummyword\t
   %
   % Commands that take arguments.
+  \definedummyword\abbr
   \definedummyword\acronym
+  \definedummyword\anchor
   \definedummyword\cite
   \definedummyword\code
   \definedummyword\command
@@ -4482,7 +4559,9 @@ end
   \definedummyword\emph
   \definedummyword\env
   \definedummyword\file
+  \definedummyword\image
   \definedummyword\indicateurl
+  \definedummyword\inforef
   \definedummyword\kbd
   \definedummyword\key
   \definedummyword\math
@@ -4529,7 +4608,10 @@ end
   % content at all.  So for index sorting, we map @{ and @} to strings
   % starting with |, since that ASCII character is between ASCII { and }.
   \def\{{|a}%
+  \def\lbracechar{|a}%
+  %
   \def\}{|b}%
+  \def\rbracechar{|b}%
   %
   % Non-English letters.
   \def\AA{AA}%
@@ -4705,10 +4787,9 @@ end
 %
 % ..., ready, GO:
 %
-\def\safewhatsit#1{%
-\ifhmode
+\def\safewhatsit#1{\ifhmode
   #1%
-\else
+ \else
   % \lastskip and \lastpenalty cannot both be nonzero simultaneously.
   \whatsitskip = \lastskip
   \edef\lastskipmacro{\the\lastskip}%
@@ -4732,7 +4813,6 @@ end
     % to re-insert the same penalty (values >10000 are used for various
     % signals); since we just inserted a non-discardable item, any
     % following glue (such as a \parskip) would be a breakpoint.  For example:
-    %
     %   @deffn deffn-whatever
     %   @vindex index-whatever
     %   Description.
@@ -4745,8 +4825,7 @@ end
     % (the whatsit from the \write), so we must insert a \nobreak.
     \nobreak\vskip\whatsitskip
   \fi
-\fi
-}
+\fi}
 
 % The index entry written in the file actually looks like
 %  \entry {sortstring}{page}{topic}
@@ -5849,14 +5928,15 @@ end
   %
   % We'll almost certainly start a paragraph next, so don't let that
   % glue accumulate.  (Not a breakpoint because it's preceded by a
-  % discardable item.)
+  % discardable item.)  However, when a paragraph is not started next
+  % (\startdefun, \cartouche, \center, etc.), this needs to be wiped out
+  % or the negative glue will cause weirdly wrong output, typically
+  % obscuring the section heading with something else.
   \vskip-\parskip
   %
-  % This is purely so the last item on the list is a known \penalty >
-  % 10000.  This is so \startdefun can avoid allowing breakpoints after
-  % section headings.  Otherwise, it would insert a valid breakpoint between:
-  %   @section sec-whatever
-  %   @deffn def-whatever
+  % This is so the last item on the main vertical list is a known
+  % \penalty > 10000, so \startdefun, etc., can recognize the situation
+  % and do the needful.
   \penalty 10001
 }
 
@@ -6276,7 +6356,7 @@ end
   % If this cartouche directly follows a sectioning command, we need the
   % \parskip glue (backspaced over by default) or the cartouche can
   % collide with the section heading.
-  \ifnum\lastpenalty>10000 \vskip\parskip \fi
+  \ifnum\lastpenalty>10000 \vskip\parskip \penalty\lastpenalty \fi
   %
   \vbox\bgroup
       \baselineskip=0pt\parskip=0pt\lineskip=0pt
@@ -7766,7 +7846,7 @@ end
   \fi\fi
 }
 
-
+% \f
 % @xref, @pxref, and @ref generate cross-references.  For \xrefX, #1 is
 % the node name, #2 the name of the Info cross-reference, #3 the printed
 % node name, #4 the name of the Info file, #5 the name of the printed
@@ -7775,26 +7855,41 @@ end
 \def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]}
 \def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]}
 \def\ref#1{\xrefX[#1,,,,,,,]}
+%
+\newbox\toprefbox
+\newbox\printedrefnamebox
+\newbox\infofilenamebox
+\newbox\printedmanualbox
+%
 \def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup
   \unsepspaces
-  \def\printedmanual{\ignorespaces #5}%
+  %
+  % Get args without leading/trailing spaces.
   \def\printedrefname{\ignorespaces #3}%
-  \setbox1=\hbox{\printedmanual\unskip}%
-  \setbox0=\hbox{\printedrefname\unskip}%
-  \ifdim \wd0 = 0pt
+  \setbox\printedrefnamebox = \hbox{\printedrefname\unskip}%
+  %
+  \def\infofilename{\ignorespaces #4}%
+  \setbox\infofilenamebox = \hbox{\infofilename\unskip}%
+  %
+  \def\printedmanual{\ignorespaces #5}%
+  \setbox\printedmanualbox  = \hbox{\printedmanual\unskip}%
+  %
+  % If the printed reference name (arg #3) was not explicitly given in
+  % the @xref, figure out what we want to use.
+  \ifdim \wd\printedrefnamebox = 0pt
     % No printed node name was explicitly given.
     \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
-      % Use the node name inside the square brackets.
+      % Not auto section-title: use node name inside the square brackets.
       \def\printedrefname{\ignorespaces #1}%
     \else
-      % Use the actual chapter/section title appear inside
-      % the square brackets.  Use the real section title if we have it.
-      \ifdim \wd1 > 0pt
-        % It is in another manual, so we don't have it.
+      % Auto section-title: use chapter/section title inside
+      % the square brackets if we have it.
+      \ifdim \wd\printedmanualbox > 0pt
+        % It is in another manual, so we don't have it; use node name.
         \def\printedrefname{\ignorespaces #1}%
       \else
         \ifhavexrefs
-          % We know the real title if we have the xref values.
+          % We (should) know the real title if we have the xref values.
           \def\printedrefname{\refx{#1-title}{}}%
         \else
           % Otherwise just copy the Info node name.
@@ -7808,13 +7903,20 @@ end
   \ifpdf
     {\indexnofonts
      \turnoffactive
+     \makevalueexpandable
      % This expands tokens, so do it after making catcode changes, so _
-     % etc. don't get their TeX definitions.
+     % etc. don't get their TeX definitions.  This ignores all spaces in
+     % #4, including (wrongly) those in the middle of the filename.
      \getfilename{#4}%
      %
-     % See comments at \activebackslashdouble.
-     {\activebackslashdouble \xdef\pdfxrefdest{#1}%
-      \backslashparens\pdfxrefdest}%
+     % This (wrongly) does not take account of leading or trailing
+     % spaces in #1, which should be ignored.
+     \edef\pdfxrefdest{#1}%
+     \ifx\pdfxrefdest\empty
+       \def\pdfxrefdest{Top}% no empty targets
+     \else
+       \txiescapepdf\pdfxrefdest  % escape PDF special chars
+     \fi
      %
      \leavevmode
      \startlink attr{/Border [0 0 0]}%
@@ -7841,29 +7943,42 @@ end
   \iffloat\Xthisreftitle
     % If the user specified the print name (third arg) to the ref,
     % print it instead of our usual "Figure 1.2".
-    \ifdim\wd0 = 0pt
+    \ifdim\wd\printedrefnamebox = 0pt
       \refx{#1-snt}{}%
     \else
       \printedrefname
     \fi
     %
-    % if the user also gave the printed manual name (fifth arg), append
+    % If the user also gave the printed manual name (fifth arg), append
     % "in MANUALNAME".
-    \ifdim \wd1 > 0pt
+    \ifdim \wd\printedmanualbox > 0pt
       \space \putwordin{} \cite{\printedmanual}%
     \fi
   \else
     % node/anchor (non-float) references.
+    % 
+    % If we use \unhbox to print the node names, TeX does not insert
+    % empty discretionaries after hyphens, which means that it will not
+    % find a line break at a hyphen in a node names.  Since some manuals
+    % are best written with fairly long node names, containing hyphens,
+    % this is a loss.  Therefore, we give the text of the node name
+    % again, so it is as if TeX is seeing it for the first time.
+    % 
+    \ifdim \wd\printedmanualbox > 0pt
+      % Cross-manual reference with a printed manual name.
+      % 
+      \crossmanualxref{\cite{\printedmanual\unskip}}%
+    %
+    \else\ifdim \wd\infofilenamebox > 0pt
+      % Cross-manual reference with only an info filename (arg 4), no
+      % printed manual name (arg 5).  This is essentially the same as
+      % the case above; we output the filename, since we have nothing else.
+      % 
+      \crossmanualxref{\code{\infofilename\unskip}}%
     %
-    % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not
-    % insert empty discretionaries after hyphens, which means that it will
-    % not find a line break at a hyphen in a node names.  Since some manuals
-    % are best written with fairly long node names, containing hyphens, this
-    % is a loss.  Therefore, we give the text of the node name again, so it
-    % is as if TeX is seeing it for the first time.
-    \ifdim \wd1 > 0pt
-      \putwordSection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}%
     \else
+      % Reference within this manual.
+      %
       % _ (for example) has to be the character _ for the purposes of the
       % control sequence corresponding to the node, but it has to expand
       % into the usual \leavevmode...\vrule stuff for purposes of
@@ -7875,7 +7990,7 @@ end
        \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
        \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
       }%
-      % output the `[mynode]' via a macro so it can be overridden.
+      % output the `[mynode]' via the macro below so it can be overridden.
       \xrefprintnodename\printedrefname
       %
       % But we always want a comma and a space:
@@ -7883,11 +7998,37 @@ end
       %
       % output the `page 3'.
       \turnoffactive \putwordpage\tie\refx{#1-pg}{}%
-    \fi
+    \fi\fi
   \fi
   \endlink
 \endgroup}
 
+% Output a cross-manual xref to #1.  Used just above (twice).
+% 
+% Only include the text "Section ``foo'' in" if the foo is neither
+% missing or Top.  Thus, @xref{,,,foo,The Foo Manual} outputs simply
+% "see The Foo Manual", the idea being to refer to the whole manual.
+% 
+% But, this being TeX, we can't easily compare our node name against the
+% string "Top" while ignoring the possible spaces before and after in
+% the input.  By adding the arbitrary 7sp below, we make it much less
+% likely that a real node name would have the same width as "Top" (e.g.,
+% in a monospaced font).  Hopefully it will never happen in practice.
+% 
+% For the same basic reason, we retypeset the "Top" at every
+% reference, since the current font is indeterminate.
+% 
+\def\crossmanualxref#1{%
+  \setbox\toprefbox = \hbox{Top\kern7sp}%
+  \setbox2 = \hbox{\ignorespaces \printedrefname \unskip \kern7sp}%
+  \ifdim \wd2 > 7sp  % nonempty?
+    \ifdim \wd2 = \wd\toprefbox \else  % same as Top?
+      \putwordSection{} ``\printedrefname'' \putwordin{}\space
+    \fi
+  \fi
+  #1%
+}
+
 % This macro is called from \xrefX for the `[nodename]' part of xref
 % output.  It's a separate macro only so it can be changed more easily,
 % since square brackets don't work well in some documents.  Particularly
@@ -8103,7 +8244,7 @@ end
 % space to prevent strange expansion errors.)
 \def\supereject{\par\penalty -20000\footnoteno =0 }
 
-% @footnotestyle is meaningful for info output only.
+% @footnotestyle is meaningful for Info output only.
 \let\footnotestyle=\comment
 
 {\catcode `\@=11
@@ -8166,6 +8307,8 @@ end
   % expands into a box, it must come within the paragraph, lest it
   % provide a place where TeX can split the footnote.
   \footstrut
+  %
+  % Invoke rest of plain TeX footnote routine.
   \futurelet\next\fo@t
 }
 }%end \catcode `\@=11
@@ -8253,7 +8396,7 @@ end
   it from ftp://tug.org/tex/epsf.tex.}
 %
 \def\image#1{%
-  \ifx\epsfbox\thisiundefined
+  \ifx\epsfbox\thisisundefined
     \ifwarnednoepsf \else
       \errhelp = \noepsfhelp
       \errmessage{epsf.tex not found, images will be ignored}%
@@ -8277,6 +8420,13 @@ end
   % If the image is by itself, center it.
   \ifvmode
     \imagevmodetrue
+  \else \ifx\centersub\centerV
+    % for @center @image, we need a vbox so we can have our vertical space
+    \imagevmodetrue
+    \vbox\bgroup % vbox has better behavior than vtop herev
+  \fi\fi
+  %
+  \ifimagevmode
     \nobreak\medskip
     % Usually we'll have text after the image which will insert
     % \parskip glue, so insert it here too to equalize the space
@@ -8286,9 +8436,13 @@ end
   \fi
   %
   % Leave vertical mode so that indentation from an enclosing
-  % environment such as @quotation is respected.  On the other hand, if
-  % it's at the top level, we don't want the normal paragraph indentation.
-  \noindent
+  %  environment such as @quotation is respected.
+  % However, if we're at the top level, we don't want the
+  %  normal paragraph indentation.
+  % On the other hand, if we are in the case of @center @image, we don't
+  %  want to start a paragraph, which will create a hsize-width box and
+  %  eradicate the centering.
+  \ifx\centersub\centerV\else \noindent \fi
   %
   % Output the image.
   \ifpdf
@@ -8300,7 +8454,10 @@ end
     \epsfbox{#1.eps}%
   \fi
   %
-  \ifimagevmode \medskip \fi  % space after the standalone image
+  \ifimagevmode
+    \medskip  % space after a standalone image
+  \fi  
+  \ifx\centersub\centerV \egroup \fi
 \endgroup}
 
 
@@ -9781,14 +9938,24 @@ directory should work if nowhere else does.}
 
 % In texinfo, backslash is an active character; it prints the backslash
 % in fixed width font.
-\catcode`\\=\active
-@def@normalbackslash{{@tt@backslashcurfont}}
+\catcode`\\=\active  % @ for escape char from now on.
+
+% The story here is that in math mode, the \char of \backslashcurfont
+% ends up printing the roman \ from the math symbol font (because \char
+% in math mode uses the \mathcode, and plain.tex sets
+% \mathcode`\\="026E).  It seems better for @backslashchar{} to always
+% print a typewriter backslash, hence we use an explicit \mathchar,
+% which is the decimal equivalent of "715c (class 7, e.g., use \fam;
+% ignored family value; char position "5C).  We can't use " for the
+% usual hex value because it has already been made active.
+@def@normalbackslash{{@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
+@let@backslashchar = @normalbackslash % @backslashchar{} is for user documents.
+
 % On startup, @fixbackslash assigns:
 %  @let \ = @normalbackslash
-
 % \rawbackslash defines an active \ to do \backslashcurfont.
 % \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other.
+% catcode other.  We switch back and forth between these.
 @gdef@rawbackslash{@let\=@backslashcurfont}
 @gdef@otherbackslash{@let\=@realbackslash}
 
@@ -9844,10 +10011,13 @@ directory should work if nowhere else does.}
 @def@normalslash{/}
 
 % These look ok in all fonts, so just make them not special.
+% @hashchar{} gets its own user-level command, because of #line.
 @catcode`@& = @other @def@normalamp{&}
 @catcode`@# = @other @def@normalhash{#}
 @catcode`@% = @other @def@normalpercent{%}
 
+@let @hashchar = @normalhash
+
 @c Finally, make ` and ' active, so that txicodequoteundirected and
 @c txicodequotebacktick work right in, e.g., @w{@code{`foo'}}.  If we
 @c don't make ` and ' active, @code will not get them as active chars.
index 7fbd11decd726c454183e33b93b3ba848489ad42..87ad2bc500937508de2ccea15a022b91e0e49dbb 100644 (file)
@@ -197,6 +197,7 @@ Using @value{tramp}
 * Filename Syntax::             @value{tramp} filename conventions.
 * Alternative Syntax::          URL-like filename syntax.
 * Filename completion::         Filename completion.
+* Ad-hoc multi-hops::           Declaring multiple hops in the file name.
 * Remote processes::            Integration with other @value{emacsname} packages.
 * Cleanup remote connections::  Cleanup remote connections.
 
@@ -442,6 +443,11 @@ Support of gateways exists since April 2007.
 @ifset emacsgvfs
 GVFS integration started in February 2009.
 @end ifset
+@ifset emacs
+Remote commands on Windows hosts are available since September 2011.
+@end ifset
+Ad-hoc multi-hop methods (with a changed syntax) have been reenabled
+in November 2011.
 
 In December 2001, @value{tramp} has been added to the XEmacs package
 repository.  Being part of the Emacs repository happened in June 2002,
@@ -510,7 +516,7 @@ Method}.
 
 
 @node Connection types
-@section Types of connections made to remote machines.
+@section Types of connections made to remote machines
 @cindex connection types, overview
 
 There are two basic types of transfer methods, each with its own
@@ -880,7 +886,9 @@ if it fails like
 command-line: line 0: Bad configuration option: ControlMaster
 @end example
 
-then you cannot use it.
+then you cannot use it.  Note, that the option
+@option{ControlPersist}, if it is supported by your @option{ssh}
+version, must be set to @option{no}.
 
 This method supports the @samp{-p} argument.
 
@@ -976,8 +984,8 @@ This is another not natural @value{tramp} method.  It uses the
 @command{smbclient} command on different Unices in order to connect to
 an SMB server.  An SMB server might be a Samba (or CIFS) server on
 another UNIX host or, more interesting, a host running MS Windows.  So
-far, it is tested against MS Windows NT, MS Windows 2000, and MS
-Windows XP.
+far, it is tested against MS Windows NT, MS Windows 2000, MS Windows
+XP, MS Windows Vista, and MS Windows 7.
 
 The first directory in the localname must be a share name on the remote
 host.  Remember that the @code{$} character, in which default shares
@@ -1259,8 +1267,8 @@ See the documentation for the variable
 
 One trap to fall in must be known.  If @value{tramp} finds a default
 user, this user will be passed always to the connection command as
-parameter (for example @samp{ssh here.somewhere.else -l john}.  If you
-have specified another user for your command in its configuration
+parameter (for example @command{ssh here.somewhere.else -l john}.  If
+you have specified another user for your command in its configuration
 files, @value{tramp} cannot know it, and the remote access will fail.
 If you have specified in the given example in @file{~/.ssh/config} the
 lines
@@ -1319,19 +1327,21 @@ because @samp{/:} is the prefix for quoted file names.
 @cindex multi-hop
 @cindex proxy hosts
 
-Sometimes, the methods described before are not sufficient.  Sometimes,
-it is not possible to connect to a remote host using a simple command.
-For example, if you are in a secured network, you might have to log in
-to a `bastion host' first before you can connect to the outside world.
-Of course, the target host may also require a bastion host.
+Sometimes, the methods described before are not sufficient.
+Sometimes, it is not possible to connect to a remote host using a
+simple command.  For example, if you are in a secured network, you
+might have to log in to a bastion host first before you can connect to
+the outside world.  Of course, the target host may also require a
+bastion host.
 
 @vindex tramp-default-proxies-alist
-In order to specify such multiple hops, it is possible to define a proxy
+@defopt tramp-default-proxies-alist
+In order to specify multiple hops, it is possible to define a proxy
 host to pass through, via the variable
 @code{tramp-default-proxies-alist}.  This variable keeps a list of
 triples (@var{host} @var{user} @var{proxy}).
 
- The first matching item specifies the proxy host to be passed for a
+The first matching item specifies the proxy host to be passed for a
 file name located on a remote target matching @var{user}@@@var{host}.
 @var{host} and @var{user} are regular expressions or @code{nil}, which
 is interpreted as a regular expression which always matches.
@@ -1398,8 +1408,8 @@ host, wouldn't be useful here.
 @var{host}, @var{user} and @var{proxy} can also be Lisp forms.  These
 forms are evaluated, and must return a string, or @code{nil}.  The
 previous example could be generalized then: For all hosts except my
-local one connect via @code{ssh} first, and apply @code{sudo -u root}
-afterwards:
+local one connect via @command{ssh} first, and apply @command{sudo -u
+root} afterwards:
 
 @lisp
 (add-to-list 'tramp-default-proxies-alist
@@ -1434,6 +1444,26 @@ following rule:
 Gateway methods can be declared as first hop only in a multiple hop
 chain.
 @end ifset
+@end defopt
+
+Hops to be passed tend to be restricted firewalls and alike.
+Sometimes they offer limited features only, like running @command{rbash}
+(restricted bash).  This must be told to @value{tramp}.
+
+@vindex tramp-restricted-shell-hosts-alist
+@defopt tramp-restricted-shell-hosts-alist
+This variable keeps a list of regular expressions, which denote hosts
+running a registered shell like "rbash".  Those hosts can be used as
+proxies only.
+
+If the bastion host from the example above runs a restricted shell,
+you shall apply
+
+@lisp
+(add-to-list 'tramp-restricted-shell-hosts-alist
+             "\\`bastion\\.your\\.domain\\'")
+@end lisp
+@end defopt
 
 
 @node Customizing Methods
@@ -1571,7 +1601,7 @@ Example:
 
 
 @node Password handling
-@section Reusing passwords for several connections.
+@section Reusing passwords for several connections
 @cindex passwords
 
 Sometimes it is necessary to connect to the same remote host several
@@ -1645,7 +1675,7 @@ parameters}.
 
 
 @node Connection caching
-@section Reusing connection related information.
+@section Reusing connection related information
 @cindex caching
 
 @vindex tramp-persistency-file-name
@@ -1690,7 +1720,7 @@ connection again.
 
 
 @node Remote Programs
-@section How @value{tramp} finds and uses programs on the remote machine.
+@section How @value{tramp} finds and uses programs on the remote machine
 
 @value{tramp} depends on a number of programs on the remote host in order to
 function, including @command{ls}, @command{test}, @command{find} and
@@ -1867,7 +1897,7 @@ Maybe some shells ask other questions when they are started.
 @value{tramp} does not know how to answer these questions.  There are
 two approaches for dealing with this problem.  One approach is to take
 care that the shell does not ask any questions when invoked from
-@value{tramp}.  You can do this by checking the @code{TERM}
+@value{tramp}.  You can do this by checking the @env{TERM}
 environment variable, it will be set to @code{dumb} when connecting.
 
 @vindex tramp-terminal-type
@@ -1898,9 +1928,9 @@ the variable @code{tramp-actions-before-shell}.  Example:
 
 @item Environment variables named like users in @file{.profile}
 
-If you have a user named frumple and set the variable @code{FRUMPLE} in
+If you have a user named frumple and set the variable @env{FRUMPLE} in
 your shell environment, then this might cause trouble.  Maybe rename
-the variable to @code{FRUMPLE_DIR} or the like.
+the variable to @env{FRUMPLE_DIR} or the like.
 
 This weird effect was actually reported by a @value{tramp} user!
 
@@ -1925,7 +1955,7 @@ understand this syntax and will emit a syntax error when it reaches
 this line.
 
 Another example is the tilde (@code{~}) character, say when adding
-@file{~/bin} to @code{PATH}.  Many Bourne shells will not expand this
+@file{~/bin} to @env{PATH}.  Many Bourne shells will not expand this
 character, and since there is usually no directory whose name consists
 of the single character tilde, strange things will happen.
 
@@ -1960,10 +1990,10 @@ output robustly.  When calling an interactive shell by @kbd{M-x
 shell}, this doesn't look nice.
 
 You can redefine the shell prompt by checking the environment variable
-@code{INSIDE_EMACS}, which is set by @value{tramp}, in your startup
-script @file{~/.emacs_SHELLNAME}. @code{SHELLNAME} might be the string
+@env{INSIDE_EMACS}, which is set by @value{tramp}, in your startup
+script @file{~/.emacs_SHELLNAME}. @env{SHELLNAME} might be the string
 @code{bash} or similar, in case of doubt you could set it the
-environment variable @code{ESHELL} in your @file{.emacs}:
+environment variable @env{ESHELL} in your @file{.emacs}:
 
 @lisp
 (setenv "ESHELL" "bash")
@@ -2177,7 +2207,7 @@ If you want to use either @option{ssh} based method on Windows, then
 you might encounter problems with @command{ssh-agent}.  Using this
 program, you can avoid typing the pass-phrase every time you log in.
 However, if you start @value{emacsname} from a desktop shortcut, then
-the environment variable @code{SSH_AUTH_SOCK} is not set and so
+the environment variable @env{SSH_AUTH_SOCK} is not set and so
 @value{emacsname} and thus @value{tramp} and thus @command{ssh} and
 @command{scp} started from @value{tramp} cannot communicate with
 @command{ssh-agent}.  It works better to start @value{emacsname} from
@@ -2215,6 +2245,7 @@ minute you have already forgotten that you hit that key!
 * Filename Syntax::             @value{tramp} filename conventions.
 * Alternative Syntax::          URL-like filename syntax.
 * Filename completion::         Filename completion.
+* Ad-hoc multi-hops::           Declaring multiple hops in the file name.
 * Remote processes::            Integration with other @value{emacsname} packages.
 * Cleanup remote connections::  Cleanup remote connections.
 @end menu
@@ -2455,16 +2486,56 @@ always cached values for the directory contents.
 @end defopt
 
 
+@node Ad-hoc multi-hops
+@section Declaring multiple hops in the file name
+@cindex multi-hop, ad-hoc
+@cindex proxy hosts, ad-hoc
+
+Multiple hops are configured with the variable
+@code{tramp-default-proxies-alist} (@pxref{Multi-hops}).  However,
+sometimes it is desirable to reach a remote host immediately, without
+configuration changes.  This can be reached by an ad-hoc specification
+of the proxies.
+
+A proxy looks like a remote file name specification without the local
+file name part.  It is prepended to the target remote file name,
+separated by @samp{|}.  As an example, a remote file on
+@samp{you@@remotehost}, passing the proxy @samp{bird@@bastion}, could
+be opened by
+
+@example
+@c @kbd{C-x C-f @trampfn{ssh@value{postfixhop}bird@@bastion|ssh, you,
+@c remotehost, /path}}
+@kbd{C-x C-f @value{prefix}ssh@value{postfixhop}bird@@bastion|ssh@value{postfixhop}you@@remotehost@value{postfix}/path}
+@end example
+
+Multiple hops can be cascaded, separating all proxies by @samp{|}.
+The proxies can also contain the patterns @code{%h} or @code{%u}.
+
+The ad-hoc definition is added on the fly to
+@code{tramp-default-proxies-alist}.  Therefore, during the lifetime of
+the @value{emacsname} session it is not necessary to enter this ad-hoc
+specification, again.  The remote file name @samp{@trampfn{ssh, you,
+remotehost, /path}} would be sufficient from now on.
+
+@vindex tramp-save-ad-hoc-proxies
+@defopt tramp-save-ad-hoc-proxies
+This customer option controls whether ad-hoc definitions are kept
+persistently in @code{tramp-default-proxies-alist}.  That means, those
+definitions are available also for future @value{emacsname} sessions.
+@end defopt
+
+
 @node Remote processes
-@section Integration with other @value{emacsname} packages.
+@section Integration with other @value{emacsname} packages
 @cindex compile
 @cindex recompile
 
 @value{tramp} supports running processes on a remote host.  This
 allows to exploit @value{emacsname} packages without modification for
-remote file names.  It does not work for the @option{ftp} and
-@option{smb} methods.  Association of a pty, as specified in
-@code{start-file-process}, is not supported.
+remote file names.  It does not work for the @option{ftp} method.
+Association of a pty, as specified in @code{start-file-process}, is
+not supported.
 
 @code{process-file} and @code{start-file-process} work on the remote
 host when the variable @code{default-directory} is remote:
@@ -2503,9 +2574,9 @@ Programs}):
 The environment for your program can be adapted by customizing
 @code{tramp-remote-process-environment}.  This variable is a list of
 strings.  It is structured like @code{process-environment}.  Each
-element is a string of the form ENVVARNAME=VALUE.  An entry
-ENVVARNAME= disables the corresponding environment variable, which
-might have been set in your init file like @file{~/.profile}.
+element is a string of the form @code{"ENVVARNAME=VALUE"}.  An entry
+@code{"ENVVARNAME="} disables the corresponding environment variable,
+which might have been set in your init file like @file{~/.profile}.
 
 @noindent
 Adding an entry can be performed via @code{add-to-list}:
@@ -2517,7 +2588,7 @@ Adding an entry can be performed via @code{add-to-list}:
 Changing or removing an existing entry is not encouraged.  The default
 values are chosen for proper @value{tramp} work.  Nevertheless, if for
 example a paranoid system administrator disallows changing the
-@code{HISTORY} environment variable, you can customize
+@env{HISTORY} environment variable, you can customize
 @code{tramp-remote-process-environment}, or you can apply the
 following code in your @file{.emacs}:
 
@@ -2536,7 +2607,7 @@ integrate them as well.  @xref{Bug Reports}.
 
 If you want to run a remote program, which shall connect the X11
 server you are using with your local host, you can set the
-@code{DISPLAY} environment variable on the remote host:
+@env{DISPLAY} environment variable on the remote host:
 
 @lisp
 (add-to-list 'tramp-remote-process-environment
@@ -2557,7 +2628,7 @@ that host.
 @subsection Running @code{shell} on a remote host
 @cindex shell
 
-Calling @code{M-x shell} in a buffer related to a remote host runs the
+Calling @kbd{M-x shell} in a buffer related to a remote host runs the
 local shell as defined in @option{shell-file-name}.  This might be
 also a valid path name for a shell to be applied on the remote host,
 but it will fail at least when your local and remote hosts belong to
@@ -2590,13 +2661,18 @@ hosts.  Example:
 You will see the buffer @file{*Async Shell Command*}, containing the
 continuous output of the @command{tail} command.
 
+@ifset emacs
+A similar behaviour can be reached by @kbd{M-x auto-revert-tail-mode},
+if available.
+@end ifset
+
 
 @subsection Running @code{eshell} on a remote host
 @cindex eshell
 
 @value{tramp} is integrated into @file{eshell.el}.  That is, you can
 open an interactive shell on your remote host, and run commands there.
-After you have started @code{M-x eshell}, you could perform commands
+After you have started @kbd{M-x eshell}, you could perform commands
 like this:
 
 @example
@@ -2672,8 +2748,40 @@ means, file names as arguments must be given as ordinary relative or
 absolute file names, without any remote specification.
 
 
+@subsection Running remote processes on Windows hosts
+@cindex winexe
+@cindex powershell
+
+With the help of the @command{winexe} it is possible tu run processes
+on a remote Windows host.  @value{tramp} has implemented this for
+@code{process-file} and @code{start-file-process}.
+
+The variable @code{tramp-smb-winexe-program} must contain the file
+name of your local @command{winexe} command.  On the remote host,
+Powershell V2.0 must be installed; it is used to run the remote
+process.
+
+In order to open a remote shell on the Windows host via @kbd{M-x
+shell}, you must set the variables @option{explicit-shell-file-name}
+and @option{explicit-*-args}.  If you want, for example, run
+@command{cmd}, you must set:
+
+@lisp
+(setq explicit-shell-file-name "cmd"
+      explicit-cmd-args '("/q"))
+@end lisp
+
+@noindent
+In case of running @command{powershell} as remote shell, the settings are
+
+@lisp
+(setq explicit-shell-file-name "powershell"
+      explicit-powershell-args '("-file" "-"))
+@end lisp
+
+
 @node Cleanup remote connections
-@section Cleanup remote connections.
+@section Cleanup remote connections
 @cindex cleanup
 
 Sometimes it is useful to cleanup remote connections.  The following
@@ -2869,7 +2977,7 @@ Echoed characters after login
 
 When the remote machine opens an echoing shell, there might be control
 characters in the welcome message.  @value{tramp} tries to suppress
-such echoes via the @code{stty -echo} command, but sometimes this
+such echoes via the @command{stty -echo} command, but sometimes this
 command is not reached, because the echoed output has confused
 @value{tramp} already.  In such situations it might be helpful to use
 the @option{sshx} or @option{scpx} methods, which allocate a pseudo tty.
@@ -2923,6 +3031,20 @@ Host *
 @end example
 
 
+@item
+How can I use @samp{ControlPersist}?
+
+When @samp{ControlPersist} is set to @samp{yes}, the @option{scpc}
+method does not work.  You can use @option{scpx} instead with the
+following settings in @file{~/.ssh/config}:
+
+@example
+Host *
+     ControlMaster  auto
+     ControlPersist yes
+@end example
+
+
 @item
 File name completion does not work with @value{tramp}
 
@@ -3385,7 +3507,7 @@ could write a script @file{emacsclient.sh}:
 emacsclient @trampfn{ssh, $(whoami), $(hostname --fqdn), $1}
 @end example
 
-Then you must set the environment variable @code{EDITOR} pointing to
+Then you must set the environment variable @env{EDITOR} pointing to
 that script:
 
 @example
@@ -3477,7 +3599,7 @@ This resets also the @value{ftppackagename} plugins.
 
 
 @node Localname deconstruction
-@section Breaking a localname into its components.
+@section Breaking a localname into its components
 
 @value{tramp} file names are somewhat different, obviously, to ordinary file
 names.  As such, the lisp functions @code{file-name-directory} and
@@ -3494,7 +3616,7 @@ effect while preserving the @value{tramp} file name information.
 
 @ifset emacs
 @node External packages
-@section Integration with external Lisp packages.
+@section Integration with external Lisp packages
 @subsection Filename completion.
 
 While reading filenames in the minibuffer, @value{tramp} must decide
index b4fb5f9aa6a6f730adbbde375091ab59110575df..78bd9d0965f53c84f536e57ac9133ee227cab96b 100644 (file)
@@ -8,7 +8,7 @@
 @c In the Tramp CVS, the version number is auto-frobbed from
 @c configure.ac, so you should edit that file and run
 @c "autoconf && ./configure" to change the version number.
-@set trampver 2.2.3-24.1
+@set trampver 2.2.6-pre
 
 @c Other flags from configuration
 @set instprefix /usr/local
index 5b8338ba4e3294f4c19ab9c4ec05b134b75ff474..e6e8137141ea1104bb51b0ce379d397515da4152 100644 (file)
@@ -71,9 +71,9 @@ Alan Mackenzie: wrote cc-awk.el
 and co-wrote cc-align.el cc-cmds.el cc-defs.el cc-engine.el cc-fonts.el
   cc-langs.el cc-mode.el cc-styles.el cc-vars.el
 and changed cc-mode.texi lread.c programs.texi font-lock.el font-core.el
-  isearch.el lisp.el modes.texi cc-menus.el cc-subword.el display.texi
-  os.texi search.texi startup.el subr.el text.texi INSTALL.BZR add-log.el
-  buffers.texi bytecomp.el callint.c and 22 other files
+  isearch.el lisp.el modes.texi cc-subword.el display.texi os.texi
+  search.texi startup.el subr.el text.texi INSTALL.BZR add-log.el
+  buffers.texi bytecomp.el callint.c cc-fix.el and 22 other files
 
 Alan Shutko: changed diary-lib.el calendar.el bindings.el cal-hebrew.el
   easy-mmode.el gnus-sum.el ibuf-ext.el ibuffer.el lunar.el macros.el
@@ -197,7 +197,7 @@ Andreas Rottmann: changed emacsclient.1 emacsclient.c misc.texi server.el
 Andreas Schwab: changed Makefile.in configure.in lisp.h xdisp.c alloc.c
   process.c coding.c files.el keyboard.c xterm.c editfns.c emacs.c fns.c
   print.c eval.c fileio.c lread.c sysdep.c dired.el xfns.c buffer.c
-  and 579 other files
+  and 577 other files
 
 Andreas Seltenreich: changed nnweb.el gnus.texi message.el gnus-sum.el
   gnus.el nnslashdot.el gnus-srvr.el gnus-util.el mm-url.el mm-uu.el
@@ -280,8 +280,6 @@ Artem Chuprina: changed message.el
 
 Ashwin Ram: wrote refer.el
 
-Atsuo Ohki: changed lread.c
-
 Aubrey Jaffer: changed info.el unexelf.c
 
 Axel Boldt: changed ehelp.el electric.el
@@ -300,11 +298,11 @@ Barry Fishman: changed gnu-linux.h
 
 Bastien Guerry: wrote gnus-bookmark.el org-latex.el
 and co-wrote org-bibtex.el org-list.el org-protocol.el org-src.el
-and changed org.el org-agenda.el org-html.el org-clock.el org-table.el
-  org.texi org-exp.el org-capture.el org-publish.el org-timer.el
+and changed org.el org-agenda.el org-html.el org-clock.el org-exp.el
+  org.texi org-table.el org-capture.el org-publish.el org-timer.el
   org-export-latex.el org-archive.el org-ascii.el org-colview.el
-  org-exp-blocks.el org-faces.el org-mobile.el ob.el org-eshell.el
-  org-pcomplete.el bookmark.el and 37 other files
+  org-exp-blocks.el org-mobile.el ob.el org-eshell.el bookmark.el info.el
+  org-attach.el and 36 other files
 
 Ben A. Mesander: co-wrote erc-dcc.el
 
@@ -468,10 +466,10 @@ and co-wrote idlw-help.el idlw-shell.el idlwave.el org-bbdb.el
   org-bibtex.el org-entities.el org-gnus.el org-list.el org-pcomplete.el
   org-src.el
 and changed org-latex.el org.texi org-publish.el orgcard.tex
-  org-export-latex.el org-docbook.el org-attach.el org-mouse.el
-  org-protocol.el org-mac-message.el org-wl.el org-crypt.el
+  org-export-latex.el org-colview-xemacs.el org-docbook.el org-attach.el
+  org-mouse.el org-protocol.el org-mac-message.el org-wl.el org-crypt.el
   org-freemind.el idlw-rinfo.el org-exp-blocks.el org-habit.el org-mhe.el
-  org-plot.el org-special-blocks.el reftex.texi ob.el and 23 other files
+  org-plot.el org-special-blocks.el reftex.texi and 24 other files
 
 Caveh Jalali: changed configure.in intel386.h sol2-4.h
 
@@ -499,10 +497,10 @@ Chip Coldwell: changed font.c
 Chong Yidong: wrote compile-tests.el dichromacy-theme.el
   font-parse-tests.el redisplay-testsuite.el tabulated-list.el
 and co-wrote longlines.el tango-dark-theme.el tango-theme.el
-and changed xdisp.c display.texi simple.el files.el frames.texi
+and changed xdisp.c simple.el display.texi files.el frames.texi
   files.texi cus-edit.el keyboard.c custom.el text.texi package.el
-  startup.el faces.el misc.texi subr.el xterm.c emacs.texi custom.texi
-  image.c mouse.el xfns.c and 847 other files
+  startup.el faces.el xterm.c emacs.texi misc.texi subr.el image.c
+  mouse.el custom.texi xfns.c and 845 other files
 
 Chris Chase: co-wrote idlw-shell.el idlwave.el
 
@@ -591,7 +589,7 @@ Christopher J. White: changed url-http.el
 
 Christopher Oliver: changed mouse.el
 
-Christopher Schmidt: changed ibuffer.el files.texi
+Christopher Schmidt: changed ibuffer.el
 
 Christopher Suckling: co-wrote org-mac-message.el
 
@@ -665,12 +663,12 @@ and co-wrote hideshow.el
 and changed vc.el Makefile.in configure.in vc-hg.el vc-git.el vc-bzr.el
   sysdep.c emacs.c process.c vc-cvs.el lisp.h term.c vc-hooks.el xterm.c
   keyboard.c vc-svn.el xterm.el callproc.c darwin.h term.el gnu-linux.h
-  and 919 other files
+  and 918 other files
 
 Dan Rosenberg: changed movemail.c
 
-Dani Moncayo: changed buffers.texi lists.texi makefile.w32-in custom.texi
-  dired.texi text.texi
+Dani Moncayo: changed buffers.texi lists.texi custom.texi dired.texi
+  makefile.w32-in text.texi
 
 Daniel Brockman: changed cus-start.el format-spec.el ibuffer.el rcirc.el
 
@@ -1032,9 +1030,9 @@ Eli Tziperman: wrote rmail-spam-filter.el
 Eli Zaretskii: wrote [bidirectional display in xdisp.c] bidi.c rxvt.el
   tty-colors.el
 and changed makefile.w32-in xdisp.c msdos.c Makefile.in files.el
-  config.bat simple.el fileio.c msdos.h rmail.el info.el mainmake.v2
+  config.bat fileio.c simple.el msdos.h info.el mainmake.v2 rmail.el
   sed1v2.inp display.texi w32.c pc-win.el process.c dispnew.c startup.el
-  dispextern.h dired.c and 703 other files
+  dispextern.h dired.c and 702 other files
 
 Elias Oltmanns: changed tls.el gnus-agent.el gnus-int.el gnus-srvr.el
   gnus.el
@@ -1278,8 +1276,6 @@ Frédéric Perrin: changed vc-dispatcher.el
 
 G Dinesh Dutt: changed etags.el
 
-Gabor Vida: changed ido.el
-
 Gareth Jones: changed fns.c gnus-score.el
 
 Garrett Wollman: changed sendmail.el
@@ -1339,9 +1335,9 @@ Giuseppe Scrivano: changed browse-url.el buffer.c configure.in sysdep.c
 
 Glenn Morris: wrote automated/f90.el automated/vc-bzr.el check-declare.el
 and changed Makefile.in configure.in calendar.el diary-lib.el rmail.el
-  files.el progmodes/f90.el cal-menu.el appt.el cal-hebrew.el emacs.texi
-  fortran.el bytecomp.el holidays.el calendar.texi ack.texi simple.el
-  make-dist sed1v2.inp cal-islam.el dired-x.el and 1257 other files
+  progmodes/f90.el files.el cal-menu.el appt.el cal-hebrew.el fortran.el
+  bytecomp.el holidays.el emacs.texi calendar.texi ack.texi make-dist
+  simple.el sed1v2.inp cal-islam.el dired-x.el and 1249 other files
 
 Glynn Clements: wrote gamegrid.el snake.el tetris.el
 
@@ -1496,8 +1492,6 @@ Inoue Seiichiro: changed xterm.c xfns.c xterm.h
 International Business Machines: changed emacs.c fileio.c process.c
   sysdep.c unexcoff.c
 
-Ippei Furuhashi: changed org.texi
-
 Irie Shinsuke: changed subr.el
 
 Irie Tetsuya: changed gnus.texi message.texi
@@ -1542,7 +1536,7 @@ Jaeyoun Chung: changed hangul3.el hanja3.el gnus-mule.el hangul.el
 
 Jambunathan K: wrote org-lparse.el org-odt.el
 and changed org.el org-exp.el org.texi OrgOdtContentTemplate.xml
-  OrgOdtStyles.xml org-footnote.el org-inlinetask.el htmlfontify.el
+  org-footnote.el org-inlinetask.el OrgOdtStyles.xml htmlfontify.el
   org-html.el package-x.el quail/indian.el tar-mode.el
 
 James Clark: wrote nxml-enc.el nxml-glyph.el nxml-maint.el nxml-mode.el
@@ -1561,8 +1555,8 @@ James R. Larus: co-wrote mh-e.el
 James R. Van Zandt: changed sh-script.el
 
 James TD Smith: changed org.el org-colview.el org-clock.el
-  org-remember.el org-plot.el org-agenda.el org-compat.el org-habit.el
-  org.texi
+  org-remember.el org-colview-xemacs.el org-plot.el org-agenda.el
+  org-compat.el org-habit.el org.texi
 
 James Troup: changed gnus-sum.el
 
@@ -1613,8 +1607,6 @@ Jason Baker: changed gnus-art.el
 
 Jason Dunsmore: changed org-html.el org.el
 
-Jason L. Wright: changed smtpmail.el
-
 Jason Merrill: changed gnus-sum.el add-log.el gnus-salt.el imap.el
   nnfolder.el
 
@@ -1703,10 +1695,10 @@ and changed keyboard.c xterm.c xfns.c Makefile.in window.c process.c
 Jim Kingdon: changed emacsclient.c emacs.tex functions.texinfo hp300bsd.h
   rmail.el
 
-Jim Meyering: changed lread.c w32.c w32font.c copyright.el ebrowse.c
-  emacs.c make-docfile.c nsfont.m pop.c term.c xfaces.c xselect.c
-  Makefile.in alloc.c artist.el autoinsert.el buffer.h character.h
-  charset.c configure configure.in and 54 other files
+Jim Meyering: changed lread.c w32.c copyright.el ebrowse.c emacs.c
+  make-docfile.c nsfont.m term.c w32font.c xfaces.c xselect.c Makefile.in
+  alloc.c artist.el autoinsert.el buffer.h character.h charset.c
+  configure configure.in doprnt.c and 53 other files
 
 Jim Radford: changed gnus-start.el
 
@@ -1897,8 +1889,8 @@ Juan Pechiar: wrote ob-mscgen.el
 and changed ob-octave.el
 
 Juanma Barranquero: wrote emacs-lock.el
-and changed makefile.w32-in subr.el w32fns.c files.el emacsclient.c
-  server.el bs.el help-fns.el faces.el org.el simple.el buffer.c xdisp.c
+and changed makefile.w32-in subr.el w32fns.c files.el server.el bs.el
+  emacsclient.c help-fns.el faces.el org.el simple.el buffer.c xdisp.c
   keyboard.c desktop.el process.c w32term.c window.c ido.el w32.c
   allout.el and 1089 other files
 
@@ -1920,7 +1912,7 @@ and co-wrote color.el
 and changed shr.el org-agenda.el gnus-art.el gnus-html.el gnus.el
   mm-decode.el gnus-group.el gnus-util.el message.el org.el gnus-sum.el
   gnus.texi mm-view.el nnimap.el mm-uu.el nnir.el sieve-manage.el
-  color-lab.el url-cache.el auth-source.el gnus-ems.el and 80 other files
+  color-lab.el url-cache.el auth-source.el gnus-ems.el and 82 other files
 
 Julien Gilles: wrote gnus-ml.el
 
@@ -1941,8 +1933,6 @@ Justin Sheehy: changed gnus-sum.el nntp.el
 
 Justus Piater: changed smtpmail.el
 
-Jérémie Courrèges-Anglas: changed org.texi
-
 Jérémy Compostella: changed battery.el windmove.el window.el
 
 Jérôme Marant: changed Makefile.in make-dist bindings.el configure.in
@@ -2212,7 +2202,7 @@ and co-wrote gnus-kill.el gnus-mh.el gnus-msg.el gnus-score.el
 and changed gnus.texi gnus-cite.el pop3.el smtpmail.el gnus-xmas.el
   auth-source.el proto-stream.el url-http.el gnutls.c subr.el xml.c
   dired.el editfns.c nnultimate.el gnus-nocem.el imap.el nnkiboze.el
-  nnrss.el nnslashdot.el simple.el spam-report.el and 211 other files
+  nnrss.el nnslashdot.el simple.el spam-report.el and 210 other files
 
 Lars Rasmusson: changed ebrowse.c
 
@@ -2278,7 +2268,7 @@ Lucid, Inc.: changed byte-opt.el byte-run.el bytecode.c bytecomp.el
 Ludovic Courtes: changed nnregistry.el
 
 Ludovic Courtès: wrote nnregistry.el
-and changed configure.in gnus.texi
+and changed gnus.texi
 
 Lukas Huonker: changed tetris.el
 
@@ -2297,8 +2287,6 @@ Lynn Slater: wrote help-macro.el
 
 Maciek Pasternacki: changed nnrss.el
 
-Madan Ramakrishnan: changed org-agenda.el
-
 Magnus Henoch: changed url-http.el ispell.el url.el dbusbind.c dns.el
   url-gw.el url-parse.el url-proxy.el autoinsert.el cl.texi configure.in
   dbus.el gnus.texi hashcash.el log-edit.el message.el org-clock.el
@@ -2369,8 +2357,6 @@ Mark Davies: changed Makefile.in amdx86-64.h configure configure.in
 
 Mark Diekhans: changed files.el progmodes/compile.el subr.el
 
-Mark E. Shoulson: changed org.el
-
 Mark H. Weaver: changed comint.el
 
 Mark Hood: changed gnus-uu.el
@@ -2447,8 +2433,8 @@ Martin Pohlack: changed iimage.el pc-select.el
 
 Martin Rudalics: changed window.el window.c windows.texi frame.c buffer.c
   help.el window.h cus-start.el frame.el cus-edit.el files.el
-  buffers.texi dired.el subr.el add-log.el mouse.el xdisp.c display.texi
-  font-lock.el help-fns.el help.texi and 143 other files
+  buffers.texi dired.el subr.el add-log.el xdisp.c font-lock.el
+  help-fns.el lisp.h mouse.el wid-edit.el and 137 other files
 
 Martin Stjernholm: wrote cc-bytecomp.el
 and co-wrote cc-align.el cc-cmds.el cc-compat.el cc-defs.el cc-engine.el
@@ -2497,7 +2483,7 @@ Matt Hodges: changed textmodes/table.el faces.el iswitchb.el simple.el
   edebug.texi eldoc.el em-hist.el em-pred.el fixit.texi icon.el ido.el
   locate.el paragraphs.el pcomplete.el repeat.el and 3 other files
 
-Matt Lundin: changed org-agenda.el org-bibtex.el org.el org-footnote.el
+Matt Lundin: changed org-agenda.el org-bibtex.el org-footnote.el org.el
 
 Matt Pharr: changed message.el
 
@@ -2532,9 +2518,9 @@ Michael Albinus: wrote dbus.el secrets.el tramp-cmds.el tramp-compat.el
 and co-wrote tramp-cache.el tramp-sh.el tramp.el
 and changed tramp.texi dbusbind.c trampver.texi dbus.texi trampver.el
   ange-ftp.el tramp-fish.el files.el files.texi tramp-imap.el Makefile.in
-  tramp-vc.el notifications.el tramp-util.el tramp-uu.el simple.el
+  tramp-vc.el tramp-util.el tramp-uu.el notifications.el simple.el
   auth-source.el dired-aux.el configure.in em-unix.el fileio.c
-  and 71 other files
+  and 66 other files
 
 Michael Ben-Gershon: changed acorn.h configure.in riscix1-1.h riscix1-2.h
   unexec.c
@@ -2575,8 +2561,9 @@ and changed viper*.el ediff*.el viper.texi ediff.texi ediff-hooks.el
   ediff-merge.el menu-bar.el appt.el desktop.el ediff-meta.el
   viper-mouse.el
 
-Michael Markert: changed ob.el org-agenda.el org-ascii.el org-docbook.el
-  org-html.el org-latex.el org-table.el org.el
+Michael Markert: changed ob.el org-agenda.el org-ascii.el
+  org-contacts-wl.el org-docbook.el org-html.el org-latex.el org-table.el
+  org.el
 
 Michael McNamara: co-wrote verilog-mode.el
 
@@ -2652,8 +2639,6 @@ Mike Newton: co-wrote bibtex.el
 Mike Rowan: changed process.c alloc.c dispnew.c keyboard.c process.h
   sysdep.c xdisp.c
 
-Mike Sperber: changed org-footnote.el
-
 Mike Williams: wrote mouse-sel.el thingatpt.el
 and changed sgml-mode.el xml-lite.el
 
@@ -2763,8 +2748,8 @@ Nicolas Avrutin: changed url-http.el
 Nicolas Goaziou: changed org-list.el org.el org-footnote.el org-exp.el
   org-latex.el org-html.el org-inlinetask.el org-indent.el org-docbook.el
   org-timer.el ob-asymptote.el org-ascii.el org-capture.el ob.el
-  org-agenda.el org-archive.el org-mouse.el ob-exp.el org-clock.el
-  org-macs.el org-table.el and 3 other files
+  org-agenda.el org-archive.el ob-exp.el org-clock.el org-macs.el
+  org-mouse.el org.texi and 3 other files
 
 Niels Giesen: changed icalendar.el org-agenda.el org-clock.el
   org-docbook.el org-icalendar.el
@@ -3439,7 +3424,7 @@ and co-wrote font-lock.el
 and changed vc.el subr.el simple.el lisp.h keyboard.c files.el
   bytecomp.el keymap.c Makefile.in progmodes/compile.el xdisp.c pcvs.el
   alloc.c newcomment.el vc-hooks.el tex-mode.el buffer.c fileio.c eval.c
-  sh-script.el fill.el and 1035 other files
+  sh-script.el fill.el and 1033 other files
 
 Stefan Reichör: changed gnus-agent.el
 
@@ -3590,7 +3575,7 @@ and changed subword.el image-mode.el Makefile.in cc-cmds.el emacsbug.el
   gnus-art.el gnus.texi nnimap.el files.el gnus-sum.el info.el
   org-footnote.el org.el reftex-ref.el saveplace.el simple.el
   tsdh-dark-theme.el tsdh-light-theme.el ack.texi artist.el bindings.el
-  and 25 other files
+  and 26 other files
 
 Tatsuya Ichikawa: changed gnus-agent.el gnus-cache.el
 
@@ -3603,10 +3588,10 @@ Teemu Likonen: changed dired.el gnus-agent.el message.el
 Teodor Zlatanov: wrote auth-source.el gnus-registry.el gnus-sync.el
   gnus-tests.el gnutls.el registry.el spam-report.el url-future-tests.el
   url-future.el
-and changed spam.el gnus.el nnimap.el gnus.texi gnus-sum.el auth.texi
-  gnus-util.el gnutls.c netrc.el gnus-start.el message.el spam-stat.el
-  encrypt.el nnir.el nnmail.el Makefile.in gnutls.h imap.el
-  mail-source.el nnmairix.el nntp.el and 99 other files
+and changed spam.el gnus.el nnimap.el gnus.texi gnus-sum.el gnus-util.el
+  auth.texi netrc.el gnus-start.el gnutls.c message.el spam-stat.el
+  encrypt.el nnir.el nnmail.el imap.el mail-source.el nnmairix.el nntp.el
+  Makefile.in gnus-encrypt.el and 97 other files
 
 Terje Rosten: changed xfns.c version.el xterm.c xterm.h
 
@@ -3699,7 +3684,8 @@ Tobias Ringström: changed etags.c
 Toby Allsopp: changed ldap.el eudc.el
 
 Toby Cubitt: co-wrote avl-tree.el
-and changed org.el
+
+Toby S. Cubitt: changed org.el
 
 Toby Speight: changed generic-x.el window.el
 
@@ -3760,7 +3746,7 @@ Trey Jackson: changed spam-stat.el
 
 Triet Hoai Lai: changed vntelex.el viet-util.el vietnamese.el
 
-Troels Nielsen: changed process.c progmodes/compile.el
+Troels Nielsen: changed process.c
 
 Trung Tran-Duc: changed nntp.el
 
@@ -3975,7 +3961,7 @@ Yutaka Niibe: changed indent.c xdisp.c configure.in Makefile.in dispnew.c
   sysdep.c config.in dired.el emacs.c fill.el fns.c gmalloc.c gnu-linux.h
   indent.h process.c simple.el term.c window.c
 
-Zachary Kanfer: changed cus-edit.el keyboard.c org.el
+Zachary Kanfer: changed cus-edit.el keyboard.c
 
 Zhang Wei: changed chinese.el characters.el mule-cmds.el xfns.c erc.el
   faces.el fontset.el makefile.w32-in mm-util.el mule.el org-publish.el
index 903407e47d5d7f4a7a0aa6a6ce4ebd460be6563d..5c5f85a1a25ec3da708f3eacbd83b1823bafb170 100644 (file)
@@ -1,11 +1,75 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-15  Leo Liu  <sdl.web@gmail.com>
 
-       * Version 24.1 released.
+       * NEWS: Mention exclamation-mark and flymake.
 
-2012-04-26  Jambunathan K  <kjambunathan@gmail.com>
+2012-07-08  Juanma Barranquero  <lekktu@gmail.com>
 
-       * org/OrgOdtStyles.xml (OrgDescriptionList): Modify style.  With
-       this change, in a description list, if the description paragraph
+       * tutorials/TUTORIAL.es: Sync with changes in 2012-07-07T10:34:37Z!cyd@gnu.org.
+
+2012-07-07  Michael Witten  <mfwitten@gmail.com>  (tiny change)
+
+       * tutorials/TUTORIAL: Copyedits (Bug#11689).
+
+2012-06-28  Glenn Morris  <rgm@gnu.org>
+
+       * emacs.py, emacs2.py, emacs3.py: Remove files, no longer used.
+
+2012-06-24  Lawrence Mitchell  <wence@gmx.li>
+
+       * NEWS: Move and improve the defun/defalias changes (bug#11686).
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Support higher-resolution time stamps (Bug#9000).
+       * NEWS: Mention addition of picoseconds to time stamp format.
+
+2012-06-13  Deniz Dogan  <deniz@dogan.se>
+
+       * tutorials/TUTORIAL.sv: Fix grammar and a couple of typos.
+
+2012-06-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * PROBLEMS (68000 C compiler problems): Remove obsolete section.
+       Not only are the compilers long-dead, the obsolete advice
+       typically doesn't apply to current Emacs sources.
+
+2012-06-03  Chong Yidong  <cyd@gnu.org>
+
+       * themes/wheatgrass-theme.el:
+       * themes/deeper-blue-theme.el:
+       * themes/tango-dark-theme.el:
+       * themes/tsdh-dark-theme.el: Add compilation-mode-line-fail,
+       compilation-mode-line-run, and compilation-mode-line-exit faces.
+
+       * themes/manoj-dark-theme.el: Remove :family attributes.
+
+2012-06-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove --disable-maintainer-mode option from 'configure'.  (Bug#11555)
+       * NEWS: Mention this.
+
+2012-06-01  Andrew Beals  <andrew.beals@gmail.com>  (tiny change)
+
+       * spook.lines: Additions.  (Bug#11598)
+
+2012-05-31  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * PROBLEMS: Remove obsolete '#define static' cruft.
+
+2012-05-07  Glenn Morris  <rgm@gnu.org>
+
+       * forms/forms-d2.el, forms/forms-pass.el: Move here from ../lisp.
+       * forms/forms-d2.dat: Move to forms/ subdirectory.
+       * forms/README: New.
+
+2012-05-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * NEWS: Do not limit current-time-string to years 1000..9999.
+
+2012-04-27  Jambunathan K  <kjambunathan@gmail.com>
+
+       * org/OrgOdtStyles.xml (OrgDescriptionList): Modify style.
+       With this change, in a description list, if the description paragraph
        spawns multiple lines then it will correctly indented.
 
 2012-04-20  Glenn Morris  <rgm@gnu.org>
@@ -14,6 +78,9 @@
 
        * MORE.STUFF: General update.  Mention list-packages.
        Remove many old/outdated URLs.
+2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * publicsuffix.txt: New file (bug#1401).
 
 2012-04-02  Alan Mackenzie  <acm@muc.de>
 
@@ -24,8 +91,8 @@
        * org/OrgOdtContentTemplate.xml (OrgIndentedSection-Level-*):
        New section styles. These sections are indented to the same
        level as the corresponding list entries.  These sections hold
-       tables that occur within a list.  (OrgTable): Increased
-       relative width from 90% to 96% for aesthetic reasons.
+       tables that occur within a list.  (OrgTable):
+       Increased relative width from 90% to 96% for aesthetic reasons.
 
 2012-03-16  Glenn Morris  <rgm@gnu.org>
 
 2012-01-10  Chong Yidong  <cyd@gnu.org>
 
        * tutorials/TUTORIAL: Don't give instructions for old-style X
-       scrollbars.  Use DEL terminology instead of DelBack.  Improve
-       description of graphical continuation lines and mode-line.
+       scrollbars.  Use DEL terminology instead of DelBack.
+       Improve description of graphical continuation lines and mode-line.
        Promote use of C-/ and C-SPC.  Remove discussion of flow control.
 
 2012-01-05  Glenn Morris  <rgm@gnu.org>
        POSIX does not allow "-" in Makefile variable names.
        Reported by Bruno Haible in
        <http://lists.gnu.org/archive/html/emacs-devel/2011-01/msg00990.html>.
-       * refcards/Makefile (DIRED_REFCARDS_PDF): Renamed from
+       * refcards/Makefile (DIRED_REFCARDS_PDF): Rename from
        DIRED-REFCARDS_PDF.
-       (MISC_REFCARDS_PDF): Renamed from MISC-REFCARDS_PDF.
-       (SURVIVAL_CARDS_PDF): Renamed from SURVIVAL-CARDS_PDF.
-       (VIPER_CARDS_PDF): Renamed from VIPER-CARDS_PDF.
+       (MISC_REFCARDS_PDF): Rename from MISC-REFCARDS_PDF.
+       (SURVIVAL_CARDS_PDF): Rename from SURVIVAL-CARDS_PDF.
+       (VIPER_CARDS_PDF): Rename from VIPER-CARDS_PDF.
 
 2011-01-18  Glenn Morris  <rgm@gnu.org>
 
 
 2009-09-27  Teodor Zlatanov  <tzz@lifelogs.com>
 
-       * NEWS: Mention new library imap-hash.el
+       * NEWS: Mention new library imap-hash.el.
 
 2009-09-22  Juanma Barranquero  <lekktu@gmail.com>
 
 2009-08-08  Dmitry Dzhus  <dima@sphinx.net.ru>
 
        * images/gud/all.xpm, images/gud/thread.xpm: New icons for
-       gdb-mi.el
+       gdb-mi.el.
 
 2009-08-07  Dan Nicolaescu  <dann@ics.uci.edu>
 
 
        * refcards/refcard.tex: Updates for printing.
        (\versionyear): Update to 2007.
-       (\copyrightnotice): Modified or unmodified ok.
+       (\copyrightnotice): Modify or unmodified ok.
        (Simple Customization): Don't use goto-line, since now it's bound.
        Also, use now-preferred (kbd ...) syntax.
 
 
 2007-07-02  Carsten Dominik  <dominik@science.uva.nl>
 
-       * orgcard.tex: Version 5.01
+       * orgcard.tex: Version 5.01.
 
 2007-06-27  Michael Albinus  <michael.albinus@gmx.de>
 
 2006-09-15  Richard Stallman  <rms@gnu.org>
 
        * THE-GNU-PROJECT: Update with the latest footnotes
-       from www.gnu.org/gnu/the-gnu-project.html
+       from www.gnu.org/gnu/the-gnu-project.html.
 
 2006-09-15  David Kastrup  <dak@gnu.org>
 
 
 2006-09-03  Diane Murray  <disumu@x3y2z1.net>
 
-       * erc.texi (Getting Started, Connecting): Changed erc-select to erc.
+       * erc.texi (Getting Started, Connecting): Change erc-select to erc.
 
 2006-09-02  Juri Linkov  <juri@jurta.org>
 
 
 2006-07-05  Kenichi Handa  <handa@m17n.org>
 
-       * HELLO: Add a paragraph for non-ASCII examples at the head.  Add
-       Bulgarian and Hungarian.  Add more "hello"s to Danish and Swedish.
+       * HELLO: Add a paragraph for non-ASCII examples at the head.
+       Add Bulgarian and Hungarian.  Add more "hello"s to Danish and Swedish.
 
 2006-07-03  Bill Wohler  <wohler@newt.com>
 
 
 2006-05-24  Carsten Dominik  <dominik@science.uva.nl>
 
-       * orgcard.tex (section{Motion}): Added the item navigation commands.
+       * orgcard.tex (section{Motion}): Add the item navigation commands.
        (section{Publishing}): New section.
        (section{Links}): Documented elisp and shell links.
 
        New bitmaps for new images.
 
        * images/refresh.xpm, images/sort-ascending.xpm,
-       * images/sort-descending.xpm: Update with GTK 2.x images.  Note
-       that the default GTK icons are not overridden by the GNOME theme
+       * images/sort-descending.xpm: Update with GTK 2.x images.
+       Note that the default GTK icons are not overridden by the GNOME theme
        due to a bug which was fixed in GNOME 2.15.  Once GNOME 2.16 is in
        wide circulation, then the GTK icons should be replaced with the
        equivalent GNOME icons.  Until then, we should be consistent with
 
 2005-11-18  Carsten Dominik  <dominik@science.uva.nl>
 
-       * orgcard.tex: Version 3.20
+       * orgcard.tex: Version 3.20.
 
 2005-11-16  Nick Roberts  <nickrob@snap.net.nz>
 
 
 2001-11-22  Colin Walters  <walters@debian.org>
 
-       * PROBLEMS: Remove already applied calc info patches.  Clarify
-       that there is no such thing as Debian GNU/Linux 2.4.3.  ftpd is
+       * PROBLEMS: Remove already applied calc info patches.
+       Clarify that there is no such thing as Debian GNU/Linux 2.4.3.  ftpd is
        not handled by alternatives in Debian, the reporter surely meant
        just "--config ftp".
 
 
        * ps-prin1.ps: Footer implementation.  Doc fix.
        (doLineNumber): Code fix for line number color.
-       (BeginPage, BeginSheet, HeaderFramePath, HeaderFrame, HeaderText): Code
-       fix for footer implementation.
+       (BeginPage, BeginSheet, HeaderFramePath, HeaderFrame, HeaderText):
+       Code fix for footer implementation.
        (TextStart, SetFooterLines, FooterFrameStart, doFramePath)
        (FooterFramePath, doFrame, FooterFrame, FooterStart)
        (HeaderOrFooterTextLines, HeaderOrFooterText, FooterText): New funs.
        * ps-prin0.ps: Insert a version number comment (5.2.2).
        Indentation fix.
 
-       * ps-prin1.ps: Insert a version number comment (5.2.2).  Can
-       select page size with/without giving an error if PostScript
+       * ps-prin1.ps: Insert a version number comment (5.2.2).
+       Can select page size with/without giving an error if PostScript
        printer doesn't have this kind of page size.  Zebra Stripe
        continues or restarts on next page.  Indentation fix.
        (BeginSheet): If necessary, rescale n-up to fit on the sheet of
        * termcap.dat, termcap.ucb: Deleted and replaced.
 
        * termcap: New termcap file from the ncurses project; bigger,
-       better, brighter, does away with waxy yellow buildup.  Email
-       me at terminfo@ccil.org if you have any trouble with this.
+       better, brighter, does away with waxy yellow buildup.
+       Email me at terminfo@ccil.org if you have any trouble with this.
 
        * README: Changed to track above change.
 
 
 1995-04-26  Karl Heuer  <kwzh@nutrimat.gnu.ai.mit.edu>
 
-       * Makefile (maintainer-clean): Renamed from realclean.
+       * Makefile (maintainer-clean): Rename from realclean.
 
 1995-04-09  Richard Stallman  <rms@mole.gnu.ai.mit.edu>
 
 
 1993-03-19  Eric S. Raymond  (eric@geech.gnu.ai.mit.edu)
 
-       * sex.6: Added 900-line support
+       * sex.6: Added 900-line support.
 
        * NEWS: Added news about the package finder.
 
        * DISTRIB: The actual domestic order form is now ORDERS.USA.
        The DISTRIB text now mentions 19.
 
-       * ORDERS.USA: Created.  This is just the order form.  DISTRIB
-       has a pointer to it at the beginning.
+       * ORDERS.USA: Created.  This is just the order form.
+       DISTRIB has a pointer to it at the beginning.
 
        * EUROPE: Renamed to ORDERS.EUROPE.  DISTRIB now has a pointer
        to it at the beginning.
 
 1992-04-06  Jim Blandy  (jimb@pogo.cs.oberlin.edu)
 
-       * etags.c (C_entries): Removed comment saying that \" in a string
+       * etags.c (C_entries): Remove comment saying that \" in a string
        isn't recognized as magic, because it is correctly handled.
 
        * getopt.c, getopt.h: New files, from GNU C library.
        optind.
        (main): Argument processing loop rewritten to call getopt to get
        next option.  Options which take parameters (-o and -i) rewritten
-       to get parameter from optarg instead of argv[1].  Filename
-       preprocessing loop and update command changed similarly.
+       to get parameter from optarg instead of argv[1].
+       Filename preprocessing loop and update command changed similarly.
        * Makefile (etags, ctags): Depend on and link with getopt.h,
        getopt.o, and getopt1.o.
        (getopt.o, getopt1.o): New targets for the GNU getopt routines.
 1991-01-25  Jim Blandy  (jimb@churchy.ai.mit.edu)
 
        * make-docfile: Find the arguments to a C function correctly,
-       by not ignoring the character that read_c_string returns.  Don't
-       even try to find argument names for functions that take MANY
+       by not ignoring the character that read_c_string returns.
+       Don't even try to find argument names for functions that take MANY
        or UNEVALLED arguments, since they're a figment of the docstring's
        imagination.
 
 1988-12-31  Richard Mlynarik  (mly@rice-chex.ai.mit.edu)
 
        * env.c: Add decl for my-index.
-       * etags.c (file-entries): .oak => scheme
+       * etags.c (file-entries): .oak => scheme.
 
 1988-12-30  Richard Stallman  (rms@sugar-bombs.ai.mit.edu)
 
index 086e44f2bba36c1b7caa91045741196fdc24e7d4..c5fca9de9293bcf73b688fcf581f1cdfb07f5f5e 100644 (file)
@@ -7,257 +7,35 @@ Please send Gnus bug reports to bugs@gnus.org.
 For older news, see Gnus info node "New Features".
 
 \f
-* Installation changes
+* New features
 
-** Upgrading from previous (stable) version if you have used No Gnus.
+** If you have the "tnef" program installed, Gnus will display ms-tnef
+   files, aka "winmail.dat".
 
-If you have tried No Gnus (the unstable Gnus branch leading to this
-release) but went back to a stable version, be careful when upgrading to
-this version.  In particular, you will probably want to remove the
-`~/News/marks' directory (perhaps selectively), so that flags are read
-from your `~/.newsrc.eld' instead of from the stale marks file, where
-this release will store flags for nntp.  See a later entry for more
-information about nntp marks.  Note that downgrading isn't safe in
-general.
+** Archives (like tar and zip files) will be automatically unpacked,
+   and the files inside the packages will be displayed as MIME parts.
 
-** Incompatibility when switching from Emacs 23 to Emacs 22 In Emacs 23,
-Gnus uses Emacs' new internal coding system `utf-8-emacs' for saving
-articles drafts and `~/.newsrc.eld'.  These files may not be read
-correctly in Emacs 22 and below.  If you want to use Gnus across
-different Emacs versions, you may set `mm-auto-save-coding-system' to
-`emacs-mule'.
+** shr has a new command `z' that cycles through image sizes.
 
-** Lisp files are now installed in `.../site-lisp/gnus/' by default.  It
-defaulted to `.../site-lisp/' formerly.  In addition to this, the new
-installer issues a warning if other Gnus installations which will shadow
-the latest one are detected.  You can then remove those shadows manually
-or remove them using `make remove-installed-shadows'.
+** `backtab' in the summary buffer now selects the previous link in
+   the article buffer.
 
-** The installation directory name is allowed to have spaces and/or tabs.
+** Using the "X-Message-SMTP-Method" header in Message buffers now
+   allows specifying how messages are to be sent.  For example:
 
-\f
-* New packages and libraries within Gnus
-
-** Gnus includes the Emacs Lisp SASL library.
-
-This provides a clean API to SASL mechanisms from within Emacs.  The
-user visible aspects of this, compared to the earlier situation, include
-support for DIGEST-MD5 and NTLM.   *Note Emacs SASL: (sasl)Top.
-
-** ManageSieve connections uses the SASL library by default.
-
-The primary change this brings is support for DIGEST-MD5 and NTLM, when
-the server supports it.
-
-** Gnus includes a password cache mechanism in password-cache.el.
-
-It is enabled by default (see `password-cache'), with a short timeout of
-16 seconds (see `password-cache-expiry').  If PGG is used as the PGP
-back end, the PGP passphrase is managed by this mechanism.  Passwords
-for ManageSieve connections are managed by this mechanism, after
-querying the user about whether to do so.
-
-** Using EasyPG with Gnus When EasyPG, is available, Gnus will use it
-instead of PGG.  EasyPG is an Emacs user interface to GNU Privacy Guard.
- *Note EasyPG Assistant user's manual: (epa)Top.  EasyPG is included in
-Emacs 23 and available separately as well.
-
-\f
-* Changes in group mode
-
-** Old intermediate incoming mail files (`Incoming*') are deleted after a
-couple of days, not immediately.  *Note Mail Source Customization::.
-(New in Gnus 5.10.10 / Emacs 22.2)
-
-
-\f
-* Changes in summary and article mode
-
-** Gnus now supports sticky article buffers.  Those are article buffers
-that are not reused when you select another article.  *Note Sticky
-Articles::.
-
-** Gnus can selectively display `text/html' articles with a WWW browser
-with `K H'.  *Note MIME Commands::.
-
-** International host names (IDNA) can now be decoded inside article bodies
-using `W i' (`gnus-summary-idna-message').  This requires that GNU Libidn
-(`http://www.gnu.org/software/libidn/') has been installed.
-
-** The non-ASCII group names handling has been much improved.  The back
-ends that fully support non-ASCII group names are now `nntp', `nnml',
-and `nnrss'.  Also the agent, the cache, and the marks features work
-with those back ends.  *Note Non-ASCII Group Names::.
+   X-Message-SMTP-Method: smtp smtp.fsf.org 587
 
-** Gnus now displays DNS master files sent as text/dns using dns-mode.
+** Gnus keeps track of non-existent articles for nnimap groups, so
+   that sparse IMAP folders now list a correct number of messages in
+   them.
 
-** Gnus supports new limiting commands in the Summary buffer: `/ r'
-(`gnus-summary-limit-to-replied') and `/ R'
-(`gnus-summary-limit-to-recipient').  *Note Limiting::.
-
-** You can now fetch all ticked articles from the server using `Y t'
-(`gnus-summary-insert-ticked-articles').  *Note Summary Generation
-Commands::.
-
-** Gnus supports a new sort command in the Summary buffer: `C-c C-s C-t'
-(`gnus-summary-sort-by-recipient').  *Note Summary Sorting::.
-
-** S/MIME now features LDAP user certificate searches.  You need to
-configure the server in `smime-ldap-host-list'.
-
-** URLs inside OpenPGP headers are retrieved and imported to your PGP key
-ring when you click on them.
-
-** Picons can be displayed right from the textual address, see
-`gnus-picon-style'.  *Note Picons::.
-
-** ANSI SGR control sequences can be transformed using `W A'.
-
-ANSI sequences are used in some Chinese hierarchies for highlighting
-articles (`gnus-article-treat-ansi-sequences').
-
-** Gnus now MIME decodes articles even when they lack "MIME-Version" header.
-This changes the default of `gnus-article-loose-mime'.
-
-** `gnus-decay-scores' can be a regexp matching score files.  For example,
-set it to `\\.ADAPT\\'' and only adaptive score files will be decayed.
- *Note Score Decays::.
-
-** Strings prefixing to the `To' and `Newsgroup' headers in summary lines
-when using `gnus-ignored-from-addresses' can be customized with
-`gnus-summary-to-prefix' and `gnus-summary-newsgroup-prefix'.  *Note To
-From Newsgroups::.
-
-** You can replace MIME parts with external bodies.  See
-`gnus-mime-replace-part' and `gnus-article-replace-part'.  *Note MIME
-Commands::, *note Using MIME::.
-
-** The option `mm-fill-flowed' can be used to disable treatment of
-format=flowed messages.  Also, flowed text is disabled when sending
-inline PGP signed messages.  *Note Flowed text: (emacs-mime)Flowed text.
-(New in Gnus 5.10.7)
-
-** Now the new command `S W' (`gnus-article-wide-reply-with-original') for
-a wide reply in the article buffer yanks a text that is in the active
-region, if it is set, as well as the `R'
-(`gnus-article-reply-with-original') command.  Note that the `R' command
-in the article buffer no longer accepts a prefix argument, which was
-used to make it do a wide reply.  *Note Article Keymap::.
-
-** The new command `C-h b' (`gnus-article-describe-bindings') used in the
-article buffer now shows not only the article commands but also the real
-summary commands that are accessible from the article buffer.
-
-
-\f
-* Changes in Message mode
+** Gnus will guess the real type of MIME parts of type
+   application/octet-stream based on the file suffix.  So an
+   application/octet-stream with a name of "rms.jpg" will be displayed
+   as an image/jpeg type by default, for instance.
 
-** Gnus now supports the "hashcash" client puzzle anti-spam mechanism.  Use
-`(setq message-generate-hashcash t)' to enable.  *Note Hashcash::.
-
-** You can now drag and drop attachments to the Message buffer.  See
-`mml-dnd-protocol-alist' and `mml-dnd-attach-options'.  *Note MIME:
-(message)MIME.
-
-** The option `message-yank-empty-prefix' now controls how empty lines are
-prefixed in cited text.  *Note Insertion Variables: (message)Insertion
-Variables.
-
-** Gnus uses narrowing to hide headers in Message buffers.  The
-`References' header is hidden by default.  To make all headers visible,
-use `(setq message-hidden-headers nil)'.  *Note Message Headers:
-(message)Message Headers.
-
-** You can highlight different levels of citations like in the article
-buffer.  See `gnus-message-highlight-citation'.
-
-** `auto-fill-mode' is enabled by default in Message mode.  See
-`message-fill-column'.  *Note Message Headers: (message)Various Message
-Variables.
-
-** You can now store signature files in a special directory named
-`message-signature-directory'.
-
-** The option `message-citation-line-format' controls the format of the
-"Whomever writes:" line.  You need to set
-`message-citation-line-function' to
-`message-insert-formatted-citation-line' as well.
-
-\f
-* Changes in back ends
-
-** The nntp back end stores article marks in `~/News/marks'.
-
-The directory can be changed using the (customizable) variable
-`nntp-marks-directory', and marks can be disabled using the (back end)
-variable `nntp-marks-is-evil'.  The advantage of this is that you can
-copy `~/News/marks' (using rsync, scp or whatever) to another Gnus
-installation, and it will realize what articles you have read and
-marked.  The data in `~/News/marks' has priority over the same data in
-`~/.newsrc.eld'.
-
-** You can import and export your RSS subscriptions from OPML files.  *Note
-RSS::.
-
-** IMAP identity (RFC 2971) is supported.
-
-By default, Gnus does not send any information about itself, but you can
-customize it using the variable `nnimap-id'.
-
-** The `nnrss' back end now supports multilingual text.  Non-ASCII group
-names for the `nnrss' groups are also supported.  *Note RSS::.
-
-** Retrieving mail with POP3 is supported over SSL/TLS and with StartTLS.
-
-** The nnml back end allows other compression programs beside `gzip' for
-compressed message files.  *Note Mail Spool::.
-
-** The nnml back end supports group compaction.
-
-This feature, accessible via the functions `gnus-group-compact-group'
-(`G z' in the group buffer) and `gnus-server-compact-server' (`z' in the
-server buffer) renumbers all articles in a group, starting from 1 and
-removing gaps.  As a consequence, you get a correct total article count
-(until messages are deleted again).
-
-
-\f
-* Appearance
-
-** The tool bar has been updated to use GNOME icons.  You can also
-customize the tool bars: `M-x customize-apropos RET -tool-bar$' should
-get you started.  (Only for Emacs, not in XEmacs.)
-
-** The tool bar icons are now (de)activated correctly in the group buffer,
-see the variable `gnus-group-update-tool-bar'.  Its default value
-depends on your Emacs version.
-
-** You can change the location of XEmacs' toolbars in Gnus buffers.  See
-`gnus-use-toolbar' and `message-use-toolbar'.
-
-
-\f
-* Miscellaneous changes
-
-** Having edited the select-method for the foreign server in the server
-buffer is immediately reflected to the subscription of the groups which
-use the server in question.  For instance, if you change
-`nntp-via-address' into `bar.example.com' from `foo.example.com', Gnus
-will connect to the news host by way of the intermediate host
-`bar.example.com' from next time.
-
-** The `all.SCORE' file can be edited from the group buffer using `W e'.
-
-** You can set `gnus-mark-copied-or-moved-articles-as-expirable' to a
-non-`nil' value so that articles that have been read may be marked as
-expirable automatically when copying or moving them to a group that has
-auto-expire turned on.  The default is `nil' and copying and moving of
-articles behave as before; i.e., the expirable marks will be unchanged
-except that the marks will be removed when copying or moving articles to
-a group that has not turned auto-expire on.  *Note Expiring Mail::.
-
-
-\f
+** `nnimap-inbox' can now be a list of mail box names.
+   
 * For older news, see Gnus info node "New Features".
 
 ----------------------------------------------------------------------
index 06e0870e4ce23149880749597e10f3b61140ef06..7186047dfb6be7a7317631ea525fe75b7ced161d 100644 (file)
@@ -210,8 +210,8 @@ packages that you can install.
 
 Local Variables:
 mode: text
-mode: view
-mode: goto-address
+eval: (view-mode 1)
+eval: (goto-address-mode 1)
 End:
 
 This file is part of GNU Emacs.
index 4fbed3402af2c52e02542f4428f5cdec4dc9029c..bf7880bd1ac205d68c986b6fb2a78e1eca81245c 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2010-2012  Free Software Foundation, Inc.
+Copyright (C) 2010-2012 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to bug-gnu-emacs@gnu.org.
@@ -14,6 +14,533 @@ and NEWS.1-17 for changes in older Emacs versions.
 You can narrow news to a specific version by calling `view-emacs-news'
 with a prefix argument or by typing C-u C-h C-n.
 
+Temporary note:
++++ indicates that the appropriate manual has already been updated.
+--- means no change in the manuals is called for.
+When you add a new item, please add it without either +++ or ---
+so we will look at it and add it to the manual.
+
+\f
+* Installation Changes in Emacs 24.2
+
+** New configure option '--enable-gcc-warnings', intended for developers.
+If building with GCC, this enables compile-time checks that warn about
+possibly-questionable C code.  On a recent GNU system there should be
+no warnings; on older and on non-GNU systems the generated warnings
+may be useful.
+
+** The configure option '--disable-maintainer-mode' has been removed,
+as it was confusingly-named and rarely useful.
+
+---
+** Emacs uses libtinfo in preference to libncurses, if available.
+
+---
+** On FreeBSD and NetBSD, configure no longer adds /usr/local/lib and
+/usr/pkg/lib to the linker search path.  You must add them yourself if
+you want them.
+
+---
+** On Mac OS X, configure no longer automatically adds the Fink /sw
+directories to the search path.  You must add them yourself if you want them.
+
+---
+** The standalone scripts rcs-checkin and vcdiff have been removed
+(from the bin and libexec directories, respectively).  The former is
+no longer relevant, the latter is replaced by lisp (in vc-sccs.el).
+
+** The configuration option '--enable-use-lisp-union-type' has been
+renamed to '--enable-check-lisp-object-type', as the resulting
+Lisp_Object type no longer uses a union to implement the compile time
+check that this option enables.
+
+\f
+* Startup Changes in Emacs 24.2
+
+** Emacs no longer searches for `leim-list.el' files beneath the standard
+lisp/ directory.  There should not be any there anyway.  If you have
+been adding them there, put them somewhere else, eg site-lisp.
+
+---
+** The `--no-site-lisp' command line option now works for Nextstep builds.
+
+\f
+* Changes in Emacs 24.2
+
+** Help changes
+
+*** `C-h f' (describe-function) can now perform autoloading.
+When this command is called for an autoloaded function whose docstring
+contains a key substitution construct, that function's library is
+automatically loaded, so that the documentation can be shown
+correctly.  To disable this, set `help-enable-auto-load' to nil.
+
+*** `C-h f' now reports previously-autoloaded functions as "autoloaded",
+even after their associated libraries have been loaded (and the
+autoloads have been redefined as functions).
+
+** The function `current-time' now returns extended-format time stamps
+(HIGH LOW USEC PSEC) that use picosecond resolution; the PSEC
+component is new.  PSEC is typically a multiple of 1000 on current
+machines.  Other functions that use this format, such as
+file-attributes and format-time-string, have been changed accordingly.
+Old-format time stamps are still accepted.
+
+** New functions `system-users', `system-groups' return lists of the user
+name, group names known to the system (where possible).
+
+** If your Emacs was built from a bzr checkout, the new variable
+`emacs-bzr-version' contains information about which bzr revision was used.
+
+** ImageMagick support, if available, is automatically enabled.
+It is no longer necessary to call `imagemagick-register-types'
+explicitly to install ImageMagick image types; that function is called
+automatically at startup, or when customizing a relevant imagemagick-
+option.
+
+*** Setting `imagemagick-types-inhibit' to t now disables the use of
+ImageMagick to view images.  You must call imagemagick-register-types
+afterwards if you do not use customize to change this.
+
+*** The new variable `imagemagick-enabled-types' also affects which
+ImageMagick types are treated as images.  The function
+`imagemagick-filter-types' returns the list of types that will be
+treated as images.
+
+*** Images displayed via ImageMagick now support transparency and the
+:background image spec property.
+
+** Face underlining can now use a wave.
+See the "Face Attributes" section of the Elisp manual.
+
+** New fringe bitmap exclamation-mark.
+
+** String values for `initial-buffer-choice' also apply to emacsclient
+frames, if emacsclient is only told to open a new frame without
+specifying any file to visit or expression to evaluate.
+
++++
+** You can prevent the creation of lock files by setting `create-lockfiles'
+to nil.  Use with caution, and only if you really need to.
+
++++
+** Using "unibyte: t" in Lisp source files is obsolete.
+Use "coding: raw-text" instead.
+
+** Mode line changes
+
+*** New option `mode-line-default-help-echo' specifies the help text
+(shown in a tooltip or in the echo area) for any part of the mode line
+that does not have its own specialized help text.
+
+*** You can now click mouse-3 in the coding system indicator to
+invokes `set-buffer-file-coding-system'.
+
++++
+** Setting `enable-remote-dir-locals' to non-nil allows directory
+local variables on remote hosts.
+
++++
+** `insert-char' is now a command, and `ucs-insert' an obsolete alias
+for it.
+
+\f
+* Editing Changes in Emacs 24.2
+
+** Search changes
+
+*** Global `M-s _' starts a symbol (identifier) incremental search,
+and `M-s _' in Isearch toggles symbol search mode.
+`M-s c' in Isearch toggles search case-sensitivity.
+
+** M-x move-to-column, if called interactively with no prefix arg, now
+prompts for a column number.
+
+** `mouse-avoidance-banish-position' can now be used to customize
+`mouse-avoidance-mode' further.
+
+** `C-M-f' and `C-M-b' will now move to the path name separator
+character when doing minibuffer filename prompts.
+
+** `goto-char' is now bound to `M-g c'.
+
+** New command `C-x r M-w' (copy-rectangle-as-kill).
+It copies the region-rectangle as the last rectangle kill.
+
+** New input method `vietnamese-vni'.
+
+\f
+* Changes in Specialized Modes and Packages in Emacs 24.2
+
+** Term changes
+
+The variables `term-default-fg-color' and `term-default-bg-color' are
+now deprecated in favor of the `term-face' face, that you can
+customize.  Also, it is now possible to customize how are displayed the
+ANSI terminal colors and styles by customizing the corresponding
+`term-color-<COLOR>', `term-color-underline' and `term-color-bold'
+faces.
+
+** CL's main entry is now (require 'cl-lib).
+`cl-lib' is like the old `cl' except that it uses the namespace cleanly,
+i.e. all its definitions have the "cl-" prefix.
+
+If `cl' provided a feature under the name `foo', then `cl-lib' provides it
+under the name `cl-foo' instead, with the exceptions of the few definitions
+that had to use `foo*' to avoid conflicts with pre-existing Elisp entities,
+which have not been renamed to `cl-foo*' but just `cl-foo'.
+
+The old `cl' is now deprecated and is nothing more than a bunch of aliases that
+provide the old non-prefixed names.
+
+** Desktop
+
+*** `desktop-path' no longer includes the "." directory.  Desktop
+files are now located in ~/.emacs.d by default.
+
+** Python mode
+
+A new version of python.el, which provides several new features, including:
+per-buffer shells, better indentation, Python 3 support, and improved
+shell-interaction compatible with iPython (and virtually any other
+text based shell).
+
+*** Some user options have been replaced/renamed:
+Old defcustom:                | New defcustom:
+python-indent                 | python-indent-offset
+python-guess-indent           | python-indent-guess-indent-offset
+python-pdbtrack-do-tracking-p | python-pdbtrack-activate
+python-use-skeletons          | python-skeleton-autoinsert
+
+*** Some user options have been removed:
+
+**** `python-indent-string-contents': Strings are never indented.
+
+**** `python-honour-comment-indentation':
+Comments are never considered as indentation markers themselves.
+
+**** `python-continuation-offset': Indentation is automatically
+calculated in a pep8 compliant way depending on the context.
+
+**** `python-shell-prompt-alist', `python-shell-continuation-prompt-alist':
+Have no direct mapping as the shell interaction is completely different.
+
+**** `python-python-command', `python-jython-command':
+Replaced by `python-shell-interpreter'.
+
+**** `inferior-python-filter-regexp', `python-remove-cwd-from-path',
+`python-pdbtrack-minor-mode-string', `python-source-modes':
+No longer relevant.
+
+*** Some commands have been replaced:
+Old command               | New command
+python-insert-class       | python-skeleton-class
+python-insert-def         | python-skeleton-def
+python-insert-for         | python-skeleton-for
+python-insert-if          | python-skeleton-if
+python-insert-try/except  | python-skeleton-try
+python-insert-try/finally | python-skeleton-try
+python-insert-while       | python-skeleton-while
+python-find-function      | python-nav-jump-to-defun
+python-next-statement     | python-nav-forward-sentence
+python-previous-statement | python-nav-backward-sentence
+python-send-buffer        | python-shell-send-buffer
+python-send-defun         | python-shell-send-defun
+python-send-region        | python-shell-send-region
+python-send-region-and-go | Emulate with python-shell-send-region and
+                            python-shell-switch-to-shell
+python-send-string        | python-shell-send-string
+python-switch-to-python   | python-shell-switch-to-shell
+python-describe-symbol    | python-eldoc-at-point
+
+** VHDL mode
+
+*** The free software compiler GHDL is supported (and now the default).
+
+*** Support for the VHDL-AMS packages has been added/updated.
+
+*** Updated to the 2002 revision of the VHDL standard.
+
+*** Accepts \r and \f as whitespace.
+
+** Diff mode
+
+Faces for changes now use the same diff color scheme as in modern VCSes
+where deletions are displayed in red (new faces `diff-refine-removed'
+and `smerge-refined-removed' and new definition of `diff-removed'),
+insertions in green (new faces `diff-refine-added' and
+`smerge-refined-added' and new definition of `diff-added').
+The variable `diff-use-changed-face' defines whether to use
+the face `diff-changed', or `diff-removed' and `diff-added'
+to highlight changes in context diffs.
+
+** Flymake uses fringe bitmaps to indicate errors and warnings.
+See flymake-fringe-indicator-position, flymake-error-bitmap and
+flymake-warning-bitmap.
+
+** Ediff now uses the same color scheme as Diff mode
+on high color displays.
+
+** `sh-script'
+*** Pairing of parens/quotes uses electric-pair-mode instead of skeleton-pair.
+*** `sh-electric-here-document-mode' now controls auto-insertion of here-docs.
+*** `sh-use-smie' lets you choose a new indentation and navigation code.
+
+** reStructuredText mode
+
+*** Rebind nearly all keys making room for more keys and complying
+better to usage in other modes.  Describe bindings with C-c C-h.
+
+*** Major revision of indentation working very similar to other
+modes.  TAB is your friend.
+
+*** Major revision of filling working fine with most of
+reStructuredText syntax.  Support auto-filling.
+
+*** Major revision of comment handling.
+
+*** Major revision of fontification working with `jit-lock-mode'.
+
+*** Cover reStructuredText syntax more closely.  Improve
+the experience for Sphinx users.
+
+*** `rst-insert-list' inserts new list or continues existing lists.
+
+*** Extend correct and improve customization.
+
+*** Negative prefix argument always works for `rst-adjust'.
+
+*** Reset window configuration after displaying TOC.
+
+*** Package version in `rst-version'.
+
+** New `derived-mode' filter for Ibuffer, bound to `/ M'.
+`/ m' is now bound to filter by used-mode, which used to be bound to `/ M'.
+
+** Apropos
+
+*** The faces used by Apropos are now directly customizable.
+These faces are named `apropos-symbol', `apropos-keybinding', and so on;
+see the `apropos' Custom group for details.
+
+**** The old options whose values specified faces to use were removed
+(i.e. `apropos-symbol-face', `apropos-keybinding-face', etc.).
+
+** Buffer Menu
+This package has been rewritten to use Tabulated List mode.
+
+*** Option `Buffer-menu-buffer+size-width' is now obsolete.
+Use `Buffer-menu-name-width' and `Buffer-menu-size-width' instead.
+
+** Calendar
+
+*** The calendars produced by cal-html include holidays.
+Customize cal-html-holidays to change this.
+
+** Customize
+
+*** `custom-reset-button-menu' now defaults to t.
+
+*** Non-option variables are never matched in `customize-apropos' and
+`customize-apropos-options' (i.e. the prefix argument does nothing for
+these commands now).
+
+** erc will look up server/channel names via auth-source and use the
+channel keys found, if any.
+
+** FFAP
+
+*** The option `ffap-url-unwrap-remote' can now be a list of strings,
+specifying URL types which should be converted to remote file names at
+the FFAP prompt.  The default is now '("ftp").
+
+** Follow mode
+
+*** The obsolete variable `follow-mode-off-hook' has been removed.
+
+*** Follow mode no longer works by using advice.
+The option `follow-intercept-processes' has been removed.
+
+** The `server-auth-key' variable can be used to set a permanent
+shared key for Emacs Server.
+
+** In Perl mode, new option `perl-indent-parens-as-block' causes non-block
+closing brackets to be aligned with the line of the opening bracket.
+
+** FIXME something happened to ses.el, 2012-04-17.
+
+** which-function-mode now applies to all applicable major modes by default.
+
+** Tramp
+
++++
+*** The syntax has been extended in order to allow ad-hoc proxy
+definitions.  See the manual for details.
+
++++
+*** Remote processes are now supported also on remote Windows host.
+
+** D-Bus
+
++++
+*** New variables `dbus-compiled-version' and `dbus-runtime-version'.
+
++++
+*** The D-Bus object manager interface is implemented.
+
++++
+*** Variables of type :(u)int32 and :(u)int64 accept floating points,
+if their value does not fit into Emacs's integer range.
+
++++
+*** The function `dbus-call-method' works non-blocking now, it can be
+interrupted by C-g.  `dbus-call-method-non-blocking' is obsolete.
+
++++
+*** Signals can be sent also as unicast message.
+
++++
+*** The argument list of `dbus-register-signal' has been extended,
+according to the new match rule types of D-Bus.  See the manual for
+details.
+
++++
+*** `dbus-init-bus' supports private connections.
+
++++
+*** There is a new function `dbus-setenv'.
+
++++
+** notifications.el supports now version 1.2 of the Notifications API.
+The function `notifications-get-capabilities' returns the supported
+server properties.
+
+** Package Menu
+
+*** Newly-available packages are listed in the Package Menu as "new",
+and sorted above the other "available" packages by default.
+
+** Tabulated List and packages derived from it
+
+*** New command `tabulated-list-sort', bound to `S', sorts the column
+at point, or the Nth column if a numeric prefix argument is given.
+
+** URL
+
+*** Structs made by `url-generic-parse-url' have nil `attributes' slot.
+Previously, this slot stored semicolon-separated attribute-value pairs
+appended to some imap URLs, but this is not compatible with RFC 3986.
+So now the `filename' slot stores the entire path and query components
+and the `attributes' slot is always nil.
+
+*** New function `url-encode-url' for encoding a URI string.
+The `url-retrieve' function now uses this to encode its URL argument,
+in case that is not properly encoded.
+
+** Obsolete packages:
+
+*** assoc.el
+In most cases, assoc+member+push+delq work just as well.
+And in any case it's just a terrible package: ugly semantics, terrible
+inefficiency, and not namespace-clean.
+
+*** bruce.el
+
+*** ledit.el
+
+*** mailpost.el
+
+*** mouse-sel.el
+
+*** patcomp.el
+
+*** cust-print.el
+
+\f
+* New Modes and Packages in Emacs 24.2
+\f
+* Incompatible Lisp Changes in Emacs 24.2
+
++++
+** Docstrings starting with `*' no longer indicate user options.
+Only variables defined using `defcustom' are considered user options.
+The function `user-variable-p' is now an obsolete alias for
+`custom-variable-p'.
+
++++
+** The return values of `defalias', `defun' and `defmacro' have changed,
+and are now undefined.  For backwards compatibility, defun and
+defmacro currently return the name of the newly defined function/macro
+but this should not be relied upon.
+
+** `face-spec-set' no longer sets frame-specific attributes when the
+third argument is a frame (that usage was obsolete since Emacs 22.2).
+
++++
+** The arguments of `dbus-register-signal' are no longer just strings,
+but keywords or keyword-string pairs.  The old argument list will
+still be supported for Emacs 24.x.
+
+** The following obsolete variables and varaliases have been removed:
+
+*** `facemenu-unlisted-faces'
+*** `rmail-decode-mime-charset'
+
+\f
+* Lisp changes in Emacs 24.2
+
+** `toggle-read-only' accepts a second argument specifying whether to
+print a message, if called from Lisp.
+
+** CL-style generalized variables are now in core Elisp.
+`setf' is autoloaded and `push' and `pop' accept generalized variables.
+
+** `defun' also accepts a (declare DECLS) form, like `defmacro'.
+The interpretation of the DECLS is determined by `defun-declarations-alist'.
+
+** `macro-declaration-function' is obsolete, use `macro-declarations-alist'.
+
+** New function `set-temporary-overlay-map'.
+
+** New macros `setq-local' and `defvar-local'.
+
+** New error type and new function `user-error'.  Doesn't trigger the debugger.
+
+** The functions get-lru-window, get-mru-window and get-largest-window
+now accept a third argument to avoid choosing the selected window.
+
+** Completion
+
+*** New function `completion-table-with-quoting' to handle completion
+in the presence of quoting, such as file completion in shell buffers.
+
+*** New function `completion-table-subvert' to use an existing completion
+table, but with a different prefix.
+
+** Time
+
+*** `current-time-string' no longer requires that its argument's year
+must be in the range 1000..9999.  It now works with any year supported
+by the underlying C implementation.
+
+** New function file-name-base.
+
+** New function `tty-top-frame' returns the topmost frame of a text terminal.
+
+** `automount-dir-prefix' is obsolete.
+** `buffer-has-markers-at' is obsolete.
+\f
+* Changes in Emacs 24.2 on non-free operating systems
+
+** New configure.bat options on MS-Windows:
+
+*** --without-libxml2 omits support for libxml2, even if its presence
+is detected.
+
+** When invoked with the -nw switch to run on the Windows text-mode terminal,
+Emacs now supports mouse highlight, help-echo (in the echo area), and
+mouse-autoselect-window.
+
 \f
 * Installation Changes in Emacs 24.1
 
index a6b31cf124971fe9689972d67c7ad20b47bb0c58..a5b88d3f4514e9e37cede60fca9ceca475d2a548 100644 (file)
@@ -20,7 +20,7 @@ Please send Org bug reports to emacs-orgmode@gnu.org.
    :PROPERTIES:
    :OrgVersion:  7.4
    :END:
-   
+
    The variable =org-agenda-ndays= is obsolete - please use
    =org-agenda-span= instead.
 
@@ -313,7 +313,7 @@ to mean anything.
     :OrgVersion:  7.5
     :END:
 
-    You can now create links from messages.  This is particularily
+    You can now create links from messages.  This is particularly
     useful when the user wants to stored messages that he sends, for
     later check.  Thanks to Ulf Stegemann for the patch.
 
@@ -328,7 +328,7 @@ to mean anything.
 
 : Percent escaping is used in Org mode to escape certain characters
 : in links that would either break the parser (e.g. square brackets
-: in link target oder description) or are not allowed to appear in
+: in link target or description) or are not allowed to appear in
 : a particular link type (e.g. non-ascii characters in a http:
 : link).
 :
@@ -554,7 +554,7 @@ to mean anything.
 
 ** Completion
 
-*** In-buffer completion is now done using John Wiegleys pcomplete.el
+*** In-buffer completion is now done using John Wiegley's pcomplete.el
     :PROPERTIES:
     :OrgVersion:  7.4
     :END:
index 23e877cca1c2d768824986f4a48a90ab536055e9..58f2bb9bcf2fb22849beda8d1dfa16aa29f60da3 100644 (file)
@@ -1884,8 +1884,8 @@ Emacs uses symbolic links to implement file locks.  In a directory
 with +t bit, the directory owner becomes the owner of the symbolic
 link, so that it cannot be removed by anyone else.
 
-If you don't like those useless links, you can let Emacs not to using
-file lock by adding #undef CLASH_DETECTION to config.h.
+If you don't like those useless links, you can customize
+the option `create-lockfiles'.
 
 *** FreeBSD: Getting a Meta key on the console.
 
@@ -2808,19 +2808,11 @@ build Emacs in a directory on a local disk.
 
 *** The dumped Emacs crashes when run, trying to write pure data.
 
-Two causes have been seen for such problems.
-
-1) On a system where getpagesize is not a system call, it is defined
+On a system where getpagesize is not a system call, it is defined
 as a macro.  If the definition (in both unex*.c and malloc.c) is wrong,
 it can cause problems like this.  You might be able to find the correct
 value in the man page for a.out (5).
 
-2) Some systems allocate variables declared static among the
-initialized variables.  Emacs makes all initialized variables in most
-of its files pure after dumping, but the variables declared static and
-not initialized are not supposed to be pure.  On these systems you
-may need to add "#define static" to config.h.
-
 * Runtime problems on legacy systems
 
 This section covers bugs reported on very old hardware or software.
@@ -3243,50 +3235,6 @@ causes the problem to go away.
 The `contents' field of a Lisp vector is an array of Lisp_Objects,
 so you may see the problem happening with indexed references to that.
 
-** 68000 C compiler problems
-
-Various 68000 compilers have different problems.
-These are some that have been observed.
-
-*** Using value of assignment expression on union type loses.
-This means that  x = y = z;  or  foo (x = z);  does not work
-if x is of type Lisp_Object.
-
-*** "cannot reclaim" error.
-
-This means that an expression is too complicated.  You get the correct
-line number in the error message.  The code must be rewritten with
-simpler expressions.
-
-*** XCONS, XSTRING, etc macros produce incorrect code.
-
-If temacs fails to run at all, this may be the cause.
-Compile this test program and look at the assembler code:
-
-struct foo { char x; unsigned int y : 24; };
-
-lose (arg)
-     struct foo arg;
-{
-  test ((int *) arg.y);
-}
-
-If the code is incorrect, your compiler has this problem.
-In the XCONS, etc., macros in lisp.h you must replace (a).u.val with
-((a).u.val + coercedummy) where coercedummy is declared as int.
-
-This problem will only happen if USE_LISP_UNION_TYPE is manually
-defined in lisp.h.
-
-** C compilers lose on returning unions.
-
-I hear that some C compilers cannot handle returning a union type.
-Most of the functions in GNU Emacs return type Lisp_Object, which is
-defined as a union on some rare architectures.
-
-This problem will only happen if USE_LISP_UNION_TYPE is manually
-defined in lisp.h.
-
 \f
 This file is part of GNU Emacs.
 
index 6aa74df5a79e93423583df410382314815c47336..e4c0092c7e53b43287338a0b0146214fedd88752 100644 (file)
--- a/etc/TODO
+++ b/etc/TODO
@@ -1,6 +1,6 @@
 Emacs TODO List                                                   -*-outline-*-
 
-Copyright (C) 2001-2012  Free Software Foundation, Inc.
+Copyright (C) 2001-2012 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -24,7 +24,6 @@ to the FSF.
 ** Improve the "code snippets" support: consolidate skeleton.el, tempo.el,
   and expand.el (any other?) and then advertise/use/improve it.
 ** Improve VC: yes, there's a lot of work to be done there :-(
-  And most of it could/should make it into Emacs-23.3.
 
 ** Random things that cross my mind right now that I'd like to see (some of
 them from my local hacks), but it's not obvious at all whether they'll
@@ -433,18 +432,13 @@ http://lists.gnu.org/archive/html/emacs-devel/2008-02/msg02234.html
 ** Highlight rectangles (`mouse-track-rectangle-p' in XEmacs).  Already in CUA,
   but it's a valuable feature worth making more general.
 
-** Provide MIME support for Rmail using the Gnus MIME library.  [Maybe
-  not now feasible, given Gnus maintenance decisions.  fx looked at
-  this and can say where some of the problems are.]
-
 ** Eliminate the storm of warnings concerning char/unsigned char
   mismatches that we get with GCC 4.x and proprietary compilers on
   various systems.  They make it difficult to spot the important warnings.
 
 ** Fix anything necessary to use `long long' EMACS_INTs with GCC.
 
-** Split out parts of lisp.h [and generate Makefile dependencies automatically.]
-[the last bit is done, see DEPFLAGS etc in src/Makefile.in ]
+** Split out parts of lisp.h.
 
 ** Update the FAQ.
 
@@ -528,15 +522,15 @@ http://lists.gnu.org/archive/html/emacs-devel/2008-02/msg02234.html
   artist, ansi-color, array, battery, calculator, cdl, cmuscheme,
   completion, cua, delim-col, dirtrack, double, echistory, elide-head,
   easymenu, expand, flow-ctrl, format [format-alist],
-  generic/generic-x [various modes], kermit, log-edit, ledit
-  [obsolete?], makesum, midnight [other than in Kill Buffer node],
+  generic/generic-x [various modes], kermit, log-edit,
+  makesum, midnight [other than in Kill Buffer node],
   mouse-copy [?], mouse-drag, mouse-sel, net-utils, rcompile,
   snmp-mode [?], soundex [should be interactive?], strokes [start from
   the web page], talk, thingatpt [interactive functions?], type-break,
-  vcursor, xscheme, zone-mode [?], mlconvert [?], iso-cvt, iso-swed,
-  swedish, feedmail [?], uce, bruce, gametree, meese, page-ext,
+  vcursor, xscheme, zone-mode [?], mlconvert [?], iso-cvt,
+  feedmail [?], uce, gametree, meese, page-ext,
   refbib, refer, scribe, sgml-mode, spell, texinfo, underline,
-  cmacexp, hideif, mantemp [obsolete?], pcomplete, assoc, xml,
+  cmacexp, hideif, mantemp [obsolete?], pcomplete, xml,
   cvs-status (should be described in PCL-CVS manual); other progmodes,
   probably in separate manual.
 
@@ -1217,6 +1211,8 @@ systems for HTML/XML files automatically."
    this.]
 
 ** Rewrite make-docfile to be clean and maintainable.
+   It might be better to replace it with Lisp, using the byte compiler.
+   http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00037.html
 
 ** Add an inferior-comint-minor-mode to capture the common set of operations
    offered by major modes that offer an associated inferior
@@ -1236,6 +1232,15 @@ systems for HTML/XML files automatically."
    button classes inherit from it.  Set the default face of the "link" button
    class to the standard "link" face.
 
+* Wishlist items:
+
+** Maybe replace etags.c with a Lisp implementation.
+http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00354.html
+
+** Maybe replace lib-src/rcs2log with a Lisp implementation.
+It wouldn't have to be a complete replacement, just enough
+for vc-rcs-update-changelog.
+
 * Other known bugs:
 
 ** `make-frame' forgets unhandled parameters, at least for X11 frames.
diff --git a/etc/emacs.py b/etc/emacs.py
deleted file mode 100644 (file)
index 24004b3..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-"""Wrapper for version-specific implementations of python.el helper
-functions """
-
-import sys
-
-if sys.version_info[0] == 3:
-    from emacs3 import *
-else:
-    from emacs2 import *
-
diff --git a/etc/emacs2.py b/etc/emacs2.py
deleted file mode 100644 (file)
index ed99a3a..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
-"""Definitions used by commands sent to inferior Python in python.el."""
-
-# Copyright (C) 2004-2012  Free Software Foundation, Inc.
-# Author: Dave Love <fx@gnu.org>
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-import os, sys, traceback, inspect, __main__
-
-try:
-    set
-except:
-    from sets import Set as set
-
-__all__ = ["eexecfile", "eargs", "complete", "ehelp", "eimport", "modpath"]
-
-def format_exception (filename, should_remove_self):
-    type, value, tb = sys.exc_info ()
-    sys.last_type = type
-    sys.last_value = value
-    sys.last_traceback = tb
-    if type is SyntaxError:
-        try: # parse the error message
-            msg, (dummy_filename, lineno, offset, line) = value
-        except:
-            pass # Not the format we expect; leave it alone
-        else:
-            # Stuff in the right filename
-            value = SyntaxError(msg, (filename, lineno, offset, line))
-            sys.last_value = value
-    res = traceback.format_exception_only (type, value)
-    # There are some compilation errors which do not provide traceback so we
-    # should not massage it.
-    if should_remove_self:
-        tblist = traceback.extract_tb (tb)
-        del tblist[:1]
-        res = traceback.format_list (tblist)
-        if res:
-            res.insert(0, "Traceback (most recent call last):\n")
-        res[len(res):] = traceback.format_exception_only (type, value)
-    # traceback.print_exception(type, value, tb)
-    for line in res: print line,
-
-def eexecfile (file):
-    """Execute FILE and then remove it.
-    Execute the file within the __main__ namespace.
-    If we get an exception, print a traceback with the top frame
-    (ourselves) excluded."""
-    # We cannot use real execfile since it has a bug where the file stays
-    # locked forever (under w32) if SyntaxError occurs.
-    # --- code based on code.py and PyShell.py.
-    try:
-        try:
-            source = open (file, "r").read()
-            code = compile (source, file, "exec")
-        # Other exceptions (shouldn't be any...) will (correctly) fall
-        # through to "final".
-        except (OverflowError, SyntaxError, ValueError):
-            # FIXME: When can compile() raise anything else than
-            # SyntaxError ????
-            format_exception (file, False)
-            return
-        try:
-            exec code in __main__.__dict__
-        except:
-            format_exception (file, True)
-    finally:
-        os.remove (file)
-
-def eargs (name, imports):
-    "Get arglist of NAME for Eldoc &c."
-    try:
-        if imports: exec imports
-        parts = name.split ('.')
-        if len (parts) > 1:
-            exec 'import ' + parts[0] # might fail
-        func = eval (name)
-        if inspect.isbuiltin (func) or type(func) is type:
-            doc = func.__doc__
-            if doc.find (' ->') != -1:
-                print '_emacs_out', doc.split (' ->')[0]
-            else:
-                print '_emacs_out', doc.split ('\n')[0]
-            return
-        if inspect.ismethod (func):
-            func = func.im_func
-        if not inspect.isfunction (func):
-            print '_emacs_out '
-            return
-        (args, varargs, varkw, defaults) = inspect.getargspec (func)
-        # No space between name and arglist for consistency with builtins.
-        print '_emacs_out', \
-            func.__name__ + inspect.formatargspec (args, varargs, varkw,
-                                                   defaults)
-    except:
-        print "_emacs_out "
-
-def all_names (object):
-    """Return (an approximation to) a list of all possible attribute
-    names reachable via the attributes of OBJECT, i.e. roughly the
-    leaves of the dictionary tree under it."""
-
-    def do_object (object, names):
-        if inspect.ismodule (object):
-            do_module (object, names)
-        elif inspect.isclass (object):
-            do_class (object, names)
-        # Might have an object without its class in scope.
-        elif hasattr (object, '__class__'):
-            names.add ('__class__')
-            do_class (object.__class__, names)
-        # Probably not a good idea to try to enumerate arbitrary
-        # dictionaries...
-        return names
-
-    def do_module (module, names):
-        if hasattr (module, '__all__'): # limited export list
-            names.update(module.__all__)
-            for i in module.__all__:
-                do_object (getattr (module, i), names)
-        else:                   # use all names
-            names.update(dir (module))
-            for i in dir (module):
-                do_object (getattr (module, i), names)
-        return names
-
-    def do_class (object, names):
-        ns = dir (object)
-        names.update(ns)
-        if hasattr (object, '__bases__'): # superclasses
-            for i in object.__bases__: do_object (i, names)
-        return names
-
-    return do_object (object, set([]))
-
-def complete (name, imports):
-    """Complete TEXT in NAMESPACE and print a Lisp list of completions.
-    Exec IMPORTS first."""
-    import __main__, keyword
-
-    def class_members(object):
-        names = dir (object)
-        if hasattr (object, '__bases__'):
-            for super in object.__bases__:
-                names = class_members (super)
-        return names    
-
-    names = set([])
-    base = None
-    try:
-        dict = __main__.__dict__.copy()
-        if imports: exec imports in dict
-        l = len (name)
-        if not "." in name:
-            for src in [dir (__builtins__), keyword.kwlist, dict.keys()]:
-                for elt in src:
-                    if elt[:l] == name: names.add(elt)
-        else:
-            base = name[:name.rfind ('.')]
-            name = name[name.rfind('.')+1:]
-            try:
-                object = eval (base, dict)
-                names = set(dir (object))
-                if hasattr (object, '__class__'):
-                    names.add('__class__')
-                    names.update(class_members (object))
-            except: names = all_names (dict)
-    except: 
-        print sys.exc_info()
-        names = []
-        
-    l = len(name)
-    print '_emacs_out (',
-    for n in names:
-        if name == n[:l]:
-            if base: print '"%s.%s"' % (base, n),
-            else: print '"%s"' % n,
-    print ')'
-
-def ehelp (name, imports):
-    """Get help on string NAME.
-    First try to eval name for, e.g. user definitions where we need
-    the object.  Otherwise try the string form."""
-    locls = {}
-    if imports:
-        try: exec imports in locls
-        except: pass
-    try: help (eval (name, globals(), locls))
-    except: help (name)
-
-def eimport (mod, dir):
-    """Import module MOD with directory DIR at the head of the search path.
-    NB doesn't load from DIR if MOD shadows a system module."""
-    from __main__ import __dict__
-
-    path0 = sys.path[0]
-    sys.path[0] = dir
-    try:
-        try:
-            if __dict__.has_key(mod) and inspect.ismodule (__dict__[mod]):
-                reload (__dict__[mod])
-            else:
-                __dict__[mod] = __import__ (mod)
-        except:
-            (type, value, tb) = sys.exc_info ()
-            print "Traceback (most recent call last):"
-            traceback.print_exception (type, value, tb.tb_next)
-    finally:
-        sys.path[0] = path0
-
-def modpath (module):
-    """Return the source file for the given MODULE (or None).
-Assumes that MODULE.py and MODULE.pyc are in the same directory."""
-    try:
-        path = __import__ (module).__file__
-        if path[-4:] == '.pyc' and os.path.exists (path[0:-1]):
-            path = path[:-1]
-        print "_emacs_out", path
-    except:
-        print "_emacs_out ()"
-
-# print '_emacs_ok'             # ready for input and can call continuation
-
diff --git a/etc/emacs3.py b/etc/emacs3.py
deleted file mode 100644 (file)
index f0e4659..0000000
+++ /dev/null
@@ -1,234 +0,0 @@
-# Copyright (C) 2004-2012  Free Software Foundation, Inc.
-# Author: Dave Love <fx@gnu.org>
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-import os, sys, traceback, inspect, imp, __main__
-
-try:
-    set
-except:
-    from sets import Set as set
-
-__all__ = ["eexecfile", "eargs", "complete", "ehelp", "eimport", "modpath"]
-
-def format_exception (filename, should_remove_self):
-    type, value, tb = sys.exc_info ()
-    sys.last_type = type
-    sys.last_value = value
-    sys.last_traceback = tb
-    if type is SyntaxError:
-        try: # parse the error message
-            msg, (dummy_filename, lineno, offset, line) = value
-        except:
-            pass # Not the format we expect; leave it alone
-        else:
-            # Stuff in the right filename
-            value = SyntaxError(msg, (filename, lineno, offset, line))
-            sys.last_value = value
-    res = traceback.format_exception_only (type, value)
-    # There are some compilation errors which do not provide traceback so we
-    # should not massage it.
-    if should_remove_self:
-        tblist = traceback.extract_tb (tb)
-        del tblist[:1]
-        res = traceback.format_list (tblist)
-        if res:
-            res.insert(0, "Traceback (most recent call last):\n")
-        res[len(res):] = traceback.format_exception_only (type, value)
-    # traceback.print_exception(type, value, tb)
-    for line in res: print(line, end=' ')
-
-def eexecfile (file):
-    """Execute FILE and then remove it.
-    Execute the file within the __main__ namespace.
-    If we get an exception, print a traceback with the top frame
-    (ourselves) excluded."""
-    # We cannot use real execfile since it has a bug where the file stays
-    # locked forever (under w32) if SyntaxError occurs.
-    # --- code based on code.py and PyShell.py.
-    try:
-        try:
-            source = open (file, "r").read()
-            code = compile (source, file, "exec")
-        # Other exceptions (shouldn't be any...) will (correctly) fall
-        # through to "final".
-        except (OverflowError, SyntaxError, ValueError):
-            # FIXME: When can compile() raise anything else than
-            # SyntaxError ????
-            format_exception (file, False)
-            return
-        try:
-            exec(code, __main__.__dict__)
-        except:
-            format_exception (file, True)
-    finally:
-        os.remove (file)
-
-def eargs (name, imports):
-    "Get arglist of NAME for Eldoc &c."
-    try:
-        if imports: exec(imports)
-        parts = name.split ('.')
-        if len (parts) > 1:
-            exec('import ' + parts[0]) # might fail
-        func = eval (name)
-        if inspect.isbuiltin (func) or type(func) is type:
-            doc = func.__doc__
-            if doc.find (' ->') != -1:
-                print('_emacs_out', doc.split (' ->')[0])
-            else:
-                print('_emacs_out', doc.split ('\n')[0])
-            return
-        if inspect.ismethod (func):
-            func = func.im_func
-        if not inspect.isfunction (func):
-            print('_emacs_out ')
-            return
-        (args, varargs, varkw, defaults) = inspect.getargspec (func)
-        # No space between name and arglist for consistency with builtins.
-        print('_emacs_out', \
-            func.__name__ + inspect.formatargspec (args, varargs, varkw,
-                                                   defaults))
-    except:
-        print("_emacs_out ")
-
-def all_names (object):
-    """Return (an approximation to) a list of all possible attribute
-    names reachable via the attributes of OBJECT, i.e. roughly the
-    leaves of the dictionary tree under it."""
-
-    def do_object (object, names):
-        if inspect.ismodule (object):
-            do_module (object, names)
-        elif inspect.isclass (object):
-            do_class (object, names)
-        # Might have an object without its class in scope.
-        elif hasattr (object, '__class__'):
-            names.add ('__class__')
-            do_class (object.__class__, names)
-        # Probably not a good idea to try to enumerate arbitrary
-        # dictionaries...
-        return names
-
-    def do_module (module, names):
-        if hasattr (module, '__all__'): # limited export list
-            names.update(module.__all__)
-            for i in module.__all__:
-                do_object (getattr (module, i), names)
-        else:                   # use all names
-            names.update(dir (module))
-            for i in dir (module):
-                do_object (getattr (module, i), names)
-        return names
-
-    def do_class (object, names):
-        ns = dir (object)
-        names.update(ns)
-        if hasattr (object, '__bases__'): # superclasses
-            for i in object.__bases__: do_object (i, names)
-        return names
-
-    return do_object (object, set([]))
-
-def complete (name, imports):
-    """Complete TEXT in NAMESPACE and print a Lisp list of completions.
-    Exec IMPORTS first."""
-    import __main__, keyword
-
-    def class_members(object):
-        names = dir (object)
-        if hasattr (object, '__bases__'):
-            for super in object.__bases__:
-                names = class_members (super)
-        return names    
-
-    names = set([])
-    base = None
-    try:
-        dict = __main__.__dict__.copy()
-        if imports: exec(imports, dict)
-        l = len (name)
-        if not "." in name:
-            for src in [dir (__builtins__), keyword.kwlist, list(dict.keys())]:
-                for elt in src:
-                    if elt[:l] == name: names.add(elt)
-        else:
-            base = name[:name.rfind ('.')]
-            name = name[name.rfind('.')+1:]
-            try:
-                object = eval (base, dict)
-                names = set(dir (object))
-                if hasattr (object, '__class__'):
-                    names.add('__class__')
-                    names.update(class_members (object))
-            except: names = all_names (dict)
-    except: 
-        print(sys.exc_info())
-        names = []
-        
-    l = len(name)
-    print('_emacs_out (', end=' ')
-    for n in names:
-        if name == n[:l]:
-            if base: print('"%s.%s"' % (base, n), end=' ')
-            else: print('"%s"' % n, end=' ')
-    print(')')
-
-def ehelp (name, imports):
-    """Get help on string NAME.
-    First try to eval name for, e.g. user definitions where we need
-    the object.  Otherwise try the string form."""
-    locls = {}
-    if imports:
-        try: exec(imports, locls)
-        except: pass
-    try: help (eval (name, globals(), locls))
-    except: help (name)
-
-def eimport (mod, dir):
-    """Import module MOD with directory DIR at the head of the search path.
-    NB doesn't load from DIR if MOD shadows a system module."""
-    from __main__ import __dict__
-
-    path0 = sys.path[0]
-    sys.path[0] = dir
-    try:
-        try:
-            if mod in __dict__ and inspect.ismodule (__dict__[mod]):
-                imp.reload (__dict__[mod])
-            else:
-                __dict__[mod] = __import__ (mod)
-        except:
-            (type, value, tb) = sys.exc_info ()
-            print("Traceback (most recent call last):")
-            traceback.print_exception (type, value, tb.tb_next)
-    finally:
-        sys.path[0] = path0
-
-def modpath (module):
-    """Return the source file for the given MODULE (or None).
-Assumes that MODULE.py and MODULE.pyc are in the same directory."""
-    try:
-        path = __import__ (module).__file__
-        if path[-4:] == '.pyc' and os.path.exists (path[0:-1]):
-            path = path[:-1]
-        print("_emacs_out", path)
-    except:
-        print("_emacs_out ()")
-
-# print '_emacs_ok'             # ready for input and can call continuation
-
diff --git a/etc/forms/README b/etc/forms/README
new file mode 100644 (file)
index 0000000..4d72845
--- /dev/null
@@ -0,0 +1 @@
+This directory contains some example files for the forms.el library.
similarity index 100%
rename from etc/forms-d2.dat
rename to etc/forms/forms-d2.dat
similarity index 95%
rename from lisp/forms-d2.el
rename to etc/forms/forms-d2.el
index 7d7336030dbac762b293f840c36ba02130911b2b..9fa2145e4d0abd2b09bad0ca8d8fd9f6cdf8701e 100644 (file)
@@ -1,4 +1,4 @@
-;;; forms-d2.el --- demo forms-mode -*- no-byte-compile: t -*-
+;;; forms-d2.el --- demo forms-mode
 
 ;; Copyright (C) 1991, 1994-1997, 2001-2012 Free Software Foundation, Inc.
 
@@ -27,7 +27,7 @@
 ;;; Code:
 
 ;; Set the name of the data file.
-(setq forms-file (expand-file-name "forms-d2.dat" data-directory))
+(setq forms-file (expand-file-name "forms/forms-d2.dat" data-directory))
 
 ;; Use 'forms-enumerate' to set field names and number thereof.
 (setq forms-number-of-fields
similarity index 88%
rename from lisp/forms-pass.el
rename to etc/forms/forms-pass.el
index b635c965cf073d16f8bcf34755e5e3755e6c1c33..34d4548434b8d83307b2184dd40be79578ae16be 100644 (file)
@@ -1,4 +1,4 @@
-;;; forms-pass.el --- passwd file demo for forms-mode -*- no-byte-compile: t -*-
+;;; forms-pass.el --- passwd file demo for forms-mode
 
 ;; This file is part of GNU Emacs.
 
index fb6262dfe55a639dc14b14818586bc3f023a47d0..c18dd995d6628395e91eaf2f89091fdb0837a6b5 100644 (file)
@@ -30,7 +30,7 @@ comments when you write it (sometime in 2198 as I recall).
 
 
 P.S. You'll be pleased to know that since (time-forward N) still works
-     for N >= 0, we've used it to pre-emptively update configure.in.
+     for N >= 0, we've used it to pre-emptively update configure.ac.
      Emacs now configures and builds on every platform that will ever
      be made.  It wasn't easy, but at least that's one problem out of
      the way for good.  If you'd like the patch, just ask.
diff --git a/etc/publicsuffix.txt b/etc/publicsuffix.txt
new file mode 100644 (file)
index 0000000..45cd95a
--- /dev/null
@@ -0,0 +1,5189 @@
+// ***** BEGIN LICENSE BLOCK *****
+// Version: MPL 1.1/GPL 2.0/LGPL 2.1
+// 
+// The contents of this file are subject to the Mozilla Public License Version 
+// 1.1 (the "License"); you may not use this file except in compliance with 
+// the License. You may obtain a copy of the License at 
+// http://www.mozilla.org/MPL/
+// 
+// Software distributed under the License is distributed on an "AS IS" basis,
+// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+// for the specific language governing rights and limitations under the
+// License.
+// 
+// The Original Code is the Public Suffix List.
+// 
+// The Initial Developer of the Original Code is
+// Jo Hermans <jo.hermans@gmail.com>.
+// Portions created by the Initial Developer are Copyright (C) 2007
+// the Initial Developer. All Rights Reserved.
+// 
+// Contributor(s):
+//   Ruben Arakelyan <ruben@rubenarakelyan.com>
+//   Gervase Markham <gerv@gerv.net>
+//   Pamela Greene <pamg.bugs@gmail.com>
+//   David Triendl <david@triendl.name>
+//   Jothan Frakes <jothan@gmail.com>
+//   The kind representatives of many TLD registries
+// 
+// Alternatively, the contents of this file may be used under the terms of
+// either the GNU General Public License Version 2 or later (the "GPL"), or
+// the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+// in which case the provisions of the GPL or the LGPL are applicable instead
+// of those above. If you wish to allow use of your version of this file only
+// under the terms of either the GPL or the LGPL, and not to allow others to
+// use your version of this file under the terms of the MPL, indicate your
+// decision by deleting the provisions above and replace them with the notice
+// and other provisions required by the GPL or the LGPL. If you do not delete
+// the provisions above, a recipient may use your version of this file under
+// the terms of any one of the MPL, the GPL or the LGPL.
+// 
+// ***** END LICENSE BLOCK *****
+
+// ac : http://en.wikipedia.org/wiki/.ac
+ac
+com.ac
+edu.ac
+gov.ac
+net.ac
+mil.ac
+org.ac
+
+// ad : http://en.wikipedia.org/wiki/.ad
+ad
+nom.ad
+
+// ae : http://en.wikipedia.org/wiki/.ae
+// see also: "Domain Name Eligibility Policy" at http://www.aeda.ae/eng/aepolicy.php
+ae
+co.ae
+net.ae
+org.ae
+sch.ae
+ac.ae
+gov.ae
+mil.ae
+
+// aero : see http://www.information.aero/index.php?id=66
+aero
+accident-investigation.aero
+accident-prevention.aero
+aerobatic.aero
+aeroclub.aero
+aerodrome.aero
+agents.aero
+aircraft.aero
+airline.aero
+airport.aero
+air-surveillance.aero
+airtraffic.aero
+air-traffic-control.aero
+ambulance.aero
+amusement.aero
+association.aero
+author.aero
+ballooning.aero
+broker.aero
+caa.aero
+cargo.aero
+catering.aero
+certification.aero
+championship.aero
+charter.aero
+civilaviation.aero
+club.aero
+conference.aero
+consultant.aero
+consulting.aero
+control.aero
+council.aero
+crew.aero
+design.aero
+dgca.aero
+educator.aero
+emergency.aero
+engine.aero
+engineer.aero
+entertainment.aero
+equipment.aero
+exchange.aero
+express.aero
+federation.aero
+flight.aero
+freight.aero
+fuel.aero
+gliding.aero
+government.aero
+groundhandling.aero
+group.aero
+hanggliding.aero
+homebuilt.aero
+insurance.aero
+journal.aero
+journalist.aero
+leasing.aero
+logistics.aero
+magazine.aero
+maintenance.aero
+marketplace.aero
+media.aero
+microlight.aero
+modelling.aero
+navigation.aero
+parachuting.aero
+paragliding.aero
+passenger-association.aero
+pilot.aero
+press.aero
+production.aero
+recreation.aero
+repbody.aero
+res.aero
+research.aero
+rotorcraft.aero
+safety.aero
+scientist.aero
+services.aero
+show.aero
+skydiving.aero
+software.aero
+student.aero
+taxi.aero
+trader.aero
+trading.aero
+trainer.aero
+union.aero
+workinggroup.aero
+works.aero
+
+// af : http://www.nic.af/help.jsp
+af
+gov.af
+com.af
+org.af
+net.af
+edu.af
+
+// ag : http://www.nic.ag/prices.htm
+ag
+com.ag
+org.ag
+net.ag
+co.ag
+nom.ag
+
+// ai : http://nic.com.ai/
+ai
+off.ai
+com.ai
+net.ai
+org.ai
+
+// al : http://www.ert.gov.al/ert_alb/faq_det.html?Id=31
+al
+com.al
+edu.al
+gov.al
+mil.al
+net.al
+org.al
+
+// am : http://en.wikipedia.org/wiki/.am
+am
+
+// an : http://www.una.an/an_domreg/default.asp
+an
+com.an
+net.an
+org.an
+edu.an
+
+// ao : http://en.wikipedia.org/wiki/.ao
+// http://www.dns.ao/REGISTR.DOC
+ao
+ed.ao
+gv.ao
+og.ao
+co.ao
+pb.ao
+it.ao
+
+// aq : http://en.wikipedia.org/wiki/.aq
+aq
+
+// ar : http://en.wikipedia.org/wiki/.ar
+*.ar
+!congresodelalengua3.ar
+!educ.ar
+!gobiernoelectronico.ar
+!mecon.ar
+!nacion.ar
+!nic.ar
+!promocion.ar
+!retina.ar
+!uba.ar
+
+// arpa : http://en.wikipedia.org/wiki/.arpa
+// Confirmed by registry <iana-questions@icann.org> 2008-06-18
+e164.arpa
+in-addr.arpa
+ip6.arpa
+iris.arpa
+uri.arpa
+urn.arpa
+
+// as : http://en.wikipedia.org/wiki/.as
+as
+gov.as
+
+// asia: http://en.wikipedia.org/wiki/.asia
+asia
+
+// at : http://en.wikipedia.org/wiki/.at
+// Confirmed by registry <it@nic.at> 2008-06-17
+at
+ac.at
+co.at
+gv.at
+or.at
+
+// http://www.info.at/
+biz.at
+info.at
+
+// priv.at : http://www.nic.priv.at/
+// Submitted by registry <lendl@nic.at> 2008-06-09
+priv.at
+
+// au : http://en.wikipedia.org/wiki/.au
+*.au
+// au geographical names (vic.au etc... are covered above)
+act.edu.au
+nsw.edu.au
+nt.edu.au
+qld.edu.au
+sa.edu.au
+tas.edu.au
+vic.edu.au
+wa.edu.au
+act.gov.au
+// Removed at request of Shae.Donelan@services.nsw.gov.au, 2010-03-04
+// nsw.gov.au
+nt.gov.au
+qld.gov.au
+sa.gov.au
+tas.gov.au
+vic.gov.au
+wa.gov.au
+// CGDNs - http://www.aucd.org.au/
+act.au
+nsw.au
+nt.au
+qld.au
+sa.au
+tas.au
+vic.au
+wa.au
+
+// aw : http://en.wikipedia.org/wiki/.aw
+aw
+com.aw
+
+// ax : http://en.wikipedia.org/wiki/.ax
+ax
+
+// az : http://en.wikipedia.org/wiki/.az
+az
+com.az
+net.az
+int.az
+gov.az
+org.az
+edu.az
+info.az
+pp.az
+mil.az
+name.az
+pro.az
+biz.az
+
+// ba : http://en.wikipedia.org/wiki/.ba
+ba
+org.ba
+net.ba
+edu.ba
+gov.ba
+mil.ba
+unsa.ba
+unbi.ba
+co.ba
+com.ba
+rs.ba
+
+// bb : http://en.wikipedia.org/wiki/.bb
+bb
+biz.bb
+com.bb
+edu.bb
+gov.bb
+info.bb
+net.bb
+org.bb
+store.bb
+
+// bd : http://en.wikipedia.org/wiki/.bd
+*.bd
+
+// be : http://en.wikipedia.org/wiki/.be
+// Confirmed by registry <tech@dns.be> 2008-06-08
+be
+ac.be
+
+// bf : http://en.wikipedia.org/wiki/.bf
+bf
+gov.bf
+
+// bg : http://en.wikipedia.org/wiki/.bg
+// https://www.register.bg/user/static/rules/en/index.html
+bg
+a.bg
+b.bg
+c.bg
+d.bg
+e.bg
+f.bg
+g.bg
+h.bg
+i.bg
+j.bg
+k.bg
+l.bg
+m.bg
+n.bg
+o.bg
+p.bg
+q.bg
+r.bg
+s.bg
+t.bg
+u.bg
+v.bg
+w.bg
+x.bg
+y.bg
+z.bg
+0.bg
+1.bg
+2.bg
+3.bg
+4.bg
+5.bg
+6.bg
+7.bg
+8.bg
+9.bg                   
+
+// bh : http://en.wikipedia.org/wiki/.bh
+bh
+com.bh
+edu.bh
+net.bh
+org.bh
+gov.bh
+
+// bi : http://en.wikipedia.org/wiki/.bi
+// http://whois.nic.bi/
+bi
+co.bi
+com.bi
+edu.bi
+or.bi
+org.bi
+
+// biz : http://en.wikipedia.org/wiki/.biz
+biz
+
+// bj : http://en.wikipedia.org/wiki/.bj
+bj
+asso.bj
+barreau.bj
+gouv.bj
+
+// bm : http://www.bermudanic.bm/dnr-text.txt
+bm
+com.bm
+edu.bm
+gov.bm
+net.bm
+org.bm
+
+// bn : http://en.wikipedia.org/wiki/.bn
+*.bn
+
+// bo : http://www.nic.bo/
+bo
+com.bo
+edu.bo
+gov.bo
+gob.bo
+int.bo
+org.bo
+net.bo
+mil.bo
+tv.bo
+
+// br : http://registro.br/dominio/dpn.html
+// Updated by registry <fneves@registro.br> 2011-03-01
+br
+adm.br
+adv.br
+agr.br
+am.br
+arq.br
+art.br
+ato.br
+b.br
+bio.br
+blog.br
+bmd.br
+can.br
+cim.br
+cng.br
+cnt.br
+com.br
+coop.br
+ecn.br
+edu.br
+emp.br
+eng.br
+esp.br
+etc.br
+eti.br
+far.br
+flog.br
+fm.br
+fnd.br
+fot.br
+fst.br
+g12.br
+ggf.br
+gov.br
+imb.br
+ind.br
+inf.br
+jor.br
+jus.br
+lel.br
+mat.br
+med.br
+mil.br
+mus.br
+net.br
+nom.br
+not.br
+ntr.br
+odo.br
+org.br
+ppg.br
+pro.br
+psc.br
+psi.br
+qsl.br
+radio.br
+rec.br
+slg.br
+srv.br
+taxi.br
+teo.br
+tmp.br
+trd.br
+tur.br
+tv.br
+vet.br
+vlog.br
+wiki.br
+zlg.br
+
+// bs : http://www.nic.bs/rules.html
+bs
+com.bs
+net.bs
+org.bs
+edu.bs
+gov.bs
+
+// bt : http://en.wikipedia.org/wiki/.bt
+bt
+com.bt
+edu.bt
+gov.bt
+net.bt
+org.bt
+
+// bv : No registrations at this time.
+// Submitted by registry <jarle@uninett.no> 2006-06-16
+
+// bw : http://en.wikipedia.org/wiki/.bw
+// http://www.gobin.info/domainname/bw.doc
+// list of other 2nd level tlds ?
+bw
+co.bw
+org.bw
+
+// by : http://en.wikipedia.org/wiki/.by
+// http://tld.by/rules_2006_en.html
+// list of other 2nd level tlds ?
+by
+gov.by
+mil.by
+// Official information does not indicate that com.by is a reserved
+// second-level domain, but it's being used as one (see www.google.com.by and
+// www.yahoo.com.by, for example), so we list it here for safety's sake.
+com.by
+
+// http://hoster.by/
+of.by
+
+// bz : http://en.wikipedia.org/wiki/.bz
+// http://www.belizenic.bz/
+bz
+com.bz
+net.bz
+org.bz
+edu.bz
+gov.bz
+
+// ca : http://en.wikipedia.org/wiki/.ca
+ca
+// ca geographical names
+ab.ca
+bc.ca
+mb.ca
+nb.ca
+nf.ca
+nl.ca
+ns.ca
+nt.ca
+nu.ca
+on.ca
+pe.ca
+qc.ca
+sk.ca
+yk.ca
+// gc.ca: http://en.wikipedia.org/wiki/.gc.ca
+// see also: http://registry.gc.ca/en/SubdomainFAQ
+gc.ca
+
+// cat : http://en.wikipedia.org/wiki/.cat
+cat
+
+// cc : http://en.wikipedia.org/wiki/.cc
+cc
+
+// cd : http://en.wikipedia.org/wiki/.cd
+// see also: https://www.nic.cd/domain/insertDomain_2.jsp?act=1
+cd
+gov.cd
+
+// cf : http://en.wikipedia.org/wiki/.cf
+cf
+
+// cg : http://en.wikipedia.org/wiki/.cg
+cg
+
+// ch : http://en.wikipedia.org/wiki/.ch
+ch
+
+// ci : http://en.wikipedia.org/wiki/.ci
+// http://www.nic.ci/index.php?page=charte
+ci
+org.ci
+or.ci
+com.ci
+co.ci
+edu.ci
+ed.ci
+ac.ci
+net.ci
+go.ci
+asso.ci
+aéroport.ci
+int.ci
+presse.ci
+md.ci
+gouv.ci
+
+// ck : http://en.wikipedia.org/wiki/.ck
+*.ck
+
+// cl : http://en.wikipedia.org/wiki/.cl
+cl
+gov.cl
+gob.cl
+
+// cm : http://en.wikipedia.org/wiki/.cm
+cm
+gov.cm
+
+// cn : http://en.wikipedia.org/wiki/.cn
+// Submitted by registry <tanyaling@cnnic.cn> 2008-06-11
+cn
+ac.cn
+com.cn
+edu.cn
+gov.cn
+net.cn
+org.cn
+mil.cn
+公司.cn
+网络.cn
+網絡.cn
+// cn geographic names
+ah.cn
+bj.cn
+cq.cn
+fj.cn
+gd.cn
+gs.cn
+gz.cn
+gx.cn
+ha.cn
+hb.cn
+he.cn
+hi.cn
+hl.cn
+hn.cn
+jl.cn
+js.cn
+jx.cn
+ln.cn
+nm.cn
+nx.cn
+qh.cn
+sc.cn
+sd.cn
+sh.cn
+sn.cn
+sx.cn
+tj.cn
+xj.cn
+xz.cn
+yn.cn
+zj.cn
+hk.cn
+mo.cn
+tw.cn
+
+// co : http://en.wikipedia.org/wiki/.co
+// Submitted by registry <tecnico@uniandes.edu.co> 2008-06-11
+co
+arts.co
+com.co
+edu.co
+firm.co
+gov.co
+info.co
+int.co
+mil.co
+net.co
+nom.co
+org.co
+rec.co
+web.co
+
+// com : http://en.wikipedia.org/wiki/.com
+com
+
+// CentralNic names : http://www.centralnic.com/names/domains
+// Confirmed by registry <gavin.brown@centralnic.com> 2008-06-09
+ar.com
+br.com
+cn.com
+de.com
+eu.com
+gb.com
+hu.com
+jpn.com
+kr.com
+no.com
+qc.com
+ru.com
+sa.com
+se.com
+uk.com
+us.com
+uy.com
+za.com
+
+// Requested by Yngve Pettersen <yngve@opera.com> 2009-11-26
+operaunite.com
+
+// Requested by Eduardo Vela <evn@google.com> 2010-09-06
+appspot.com
+
+// coop : http://en.wikipedia.org/wiki/.coop
+coop
+
+// cr : http://www.nic.cr/niccr_publico/showRegistroDominiosScreen.do
+cr
+ac.cr
+co.cr
+ed.cr
+fi.cr
+go.cr
+or.cr
+sa.cr
+
+// cu : http://en.wikipedia.org/wiki/.cu
+cu
+com.cu
+edu.cu
+org.cu
+net.cu
+gov.cu
+inf.cu
+
+// cv : http://en.wikipedia.org/wiki/.cv
+cv
+
+// cx : http://en.wikipedia.org/wiki/.cx
+// list of other 2nd level tlds ?
+cx
+gov.cx
+
+// cy : http://en.wikipedia.org/wiki/.cy
+*.cy
+
+// cz : http://en.wikipedia.org/wiki/.cz
+cz
+
+// de : http://en.wikipedia.org/wiki/.de
+// Confirmed by registry <ops@denic.de> (with technical
+// reservations) 2008-07-01
+de
+
+// dj : http://en.wikipedia.org/wiki/.dj
+dj
+
+// dk : http://en.wikipedia.org/wiki/.dk
+// Confirmed by registry <robert@dk-hostmaster.dk> 2008-06-17
+dk
+
+// dm : http://en.wikipedia.org/wiki/.dm
+dm
+com.dm
+net.dm
+org.dm
+edu.dm
+gov.dm
+
+// do : http://en.wikipedia.org/wiki/.do
+do
+art.do
+com.do
+edu.do
+gob.do
+gov.do
+mil.do
+net.do
+org.do
+sld.do
+web.do
+
+// dz : http://en.wikipedia.org/wiki/.dz
+dz
+com.dz
+org.dz
+net.dz
+gov.dz
+edu.dz
+asso.dz
+pol.dz
+art.dz
+
+// ec : http://www.nic.ec/reg/paso1.asp
+// Submitted by registry <vabboud@nic.ec> 2008-07-04
+ec
+com.ec
+info.ec
+net.ec
+fin.ec
+k12.ec
+med.ec
+pro.ec
+org.ec
+edu.ec
+gov.ec
+gob.ec
+mil.ec
+
+// edu : http://en.wikipedia.org/wiki/.edu
+edu
+
+// ee : http://www.eenet.ee/EENet/dom_reeglid.html#lisa_B
+ee
+edu.ee
+gov.ee
+riik.ee
+lib.ee
+med.ee
+com.ee
+pri.ee
+aip.ee
+org.ee
+fie.ee
+
+// eg : http://en.wikipedia.org/wiki/.eg
+eg  
+com.eg
+edu.eg
+eun.eg
+gov.eg
+mil.eg
+name.eg
+net.eg
+org.eg
+sci.eg
+
+// er : http://en.wikipedia.org/wiki/.er
+*.er
+
+// es : https://www.nic.es/site_ingles/ingles/dominios/index.html
+es
+com.es
+nom.es
+org.es
+gob.es
+edu.es
+
+// et : http://en.wikipedia.org/wiki/.et
+*.et
+
+// eu : http://en.wikipedia.org/wiki/.eu
+eu
+
+// fi : http://en.wikipedia.org/wiki/.fi
+fi
+// aland.fi : http://en.wikipedia.org/wiki/.ax
+// This domain is being phased out in favor of .ax. As there are still many
+// domains under aland.fi, we still keep it on the list until aland.fi is
+// completely removed.
+// TODO: Check for updates (expected to be phased out around Q1/2009)
+aland.fi
+// iki.fi : Submitted by Hannu Aronsson <haa@iki.fi> 2009-11-05
+iki.fi
+
+// fj : http://en.wikipedia.org/wiki/.fj
+*.fj
+
+// fk : http://en.wikipedia.org/wiki/.fk
+*.fk
+
+// fm : http://en.wikipedia.org/wiki/.fm
+fm
+
+// fo : http://en.wikipedia.org/wiki/.fo
+fo
+
+// fr : http://www.afnic.fr/
+// domaines descriptifs : http://www.afnic.fr/obtenir/chartes/nommage-fr/annexe-descriptifs
+fr
+com.fr
+asso.fr
+nom.fr
+prd.fr
+presse.fr
+tm.fr
+// domaines sectoriels : http://www.afnic.fr/obtenir/chartes/nommage-fr/annexe-sectoriels
+aeroport.fr
+assedic.fr
+avocat.fr
+avoues.fr
+cci.fr
+chambagri.fr
+chirurgiens-dentistes.fr
+experts-comptables.fr
+geometre-expert.fr
+gouv.fr
+greta.fr
+huissier-justice.fr
+medecin.fr
+notaires.fr
+pharmacien.fr
+port.fr
+veterinaire.fr
+
+// ga : http://en.wikipedia.org/wiki/.ga
+ga
+
+// gb : This registry is effectively dormant
+// Submitted by registry <Damien.Shaw@ja.net> 2008-06-12
+
+// gd : http://en.wikipedia.org/wiki/.gd
+gd
+
+// ge : http://www.nic.net.ge/policy_en.pdf
+ge
+com.ge
+edu.ge
+gov.ge
+org.ge
+mil.ge
+net.ge
+pvt.ge
+
+// gf : http://en.wikipedia.org/wiki/.gf
+gf
+
+// gg : http://www.channelisles.net/applic/avextn.shtml
+gg
+co.gg
+org.gg
+net.gg
+sch.gg
+gov.gg
+
+// gh : http://en.wikipedia.org/wiki/.gh
+// see also: http://www.nic.gh/reg_now.php
+// Although domains directly at second level are not possible at the moment,
+// they have been possible for some time and may come back.
+gh
+com.gh
+edu.gh
+gov.gh
+org.gh
+mil.gh
+
+// gi : http://www.nic.gi/rules.html
+gi
+com.gi
+ltd.gi
+gov.gi
+mod.gi
+edu.gi
+org.gi
+
+// gl : http://en.wikipedia.org/wiki/.gl
+// http://nic.gl
+gl
+
+// gm : http://www.nic.gm/htmlpages%5Cgm-policy.htm
+gm
+
+// gn : http://psg.com/dns/gn/gn.txt
+// Submitted by registry <randy@psg.com> 2008-06-17
+ac.gn
+com.gn
+edu.gn
+gov.gn
+org.gn
+net.gn
+
+// gov : http://en.wikipedia.org/wiki/.gov
+gov
+
+// gp : http://www.nic.gp/index.php?lang=en
+gp
+com.gp
+net.gp
+mobi.gp
+edu.gp
+org.gp
+asso.gp
+
+// gq : http://en.wikipedia.org/wiki/.gq
+gq
+
+// gr : https://grweb.ics.forth.gr/english/1617-B-2005.html
+// Submitted by registry <segred@ics.forth.gr> 2008-06-09
+gr
+com.gr
+edu.gr
+net.gr
+org.gr
+gov.gr
+
+// gs : http://en.wikipedia.org/wiki/.gs
+gs
+
+// gt : http://www.gt/politicas.html
+*.gt
+
+// gu : http://gadao.gov.gu/registration.txt
+*.gu
+
+// gw : http://en.wikipedia.org/wiki/.gw
+gw
+
+// gy : http://en.wikipedia.org/wiki/.gy
+// http://registry.gy/
+gy
+co.gy
+com.gy
+net.gy
+
+// hk : https://www.hkdnr.hk
+// Submitted by registry <hk.tech@hkirc.hk> 2008-06-11
+hk
+com.hk
+edu.hk
+gov.hk
+idv.hk
+net.hk
+org.hk
+公司.hk
+教育.hk
+敎育.hk
+政府.hk
+個人.hk
+个人.hk
+箇人.hk
+網络.hk
+网络.hk
+组織.hk
+網絡.hk
+网絡.hk
+组织.hk
+組織.hk
+組织.hk 
+
+// hm : http://en.wikipedia.org/wiki/.hm
+hm
+
+// hn : http://www.nic.hn/politicas/ps02,,05.html
+hn
+com.hn
+edu.hn
+org.hn
+net.hn
+mil.hn
+gob.hn
+
+// hr : http://www.dns.hr/documents/pdf/HRTLD-regulations.pdf
+hr
+iz.hr
+from.hr
+name.hr
+com.hr
+
+// ht : http://www.nic.ht/info/charte.cfm
+ht
+com.ht
+shop.ht
+firm.ht
+info.ht
+adult.ht
+net.ht
+pro.ht
+org.ht
+med.ht
+art.ht
+coop.ht
+pol.ht
+asso.ht
+edu.ht
+rel.ht
+gouv.ht
+perso.ht
+
+// hu : http://www.domain.hu/domain/English/sld.html
+// Confirmed by registry <pasztor@iszt.hu> 2008-06-12
+hu
+co.hu
+info.hu
+org.hu
+priv.hu
+sport.hu
+tm.hu
+2000.hu
+agrar.hu
+bolt.hu
+casino.hu
+city.hu
+erotica.hu
+erotika.hu
+film.hu
+forum.hu
+games.hu
+hotel.hu
+ingatlan.hu
+jogasz.hu
+konyvelo.hu
+lakas.hu
+media.hu
+news.hu
+reklam.hu
+sex.hu
+shop.hu
+suli.hu
+szex.hu
+tozsde.hu
+utazas.hu
+video.hu
+
+// id : http://en.wikipedia.org/wiki/.id
+// see also: https://register.pandi.or.id/
+id
+ac.id
+co.id
+go.id
+mil.id
+net.id
+or.id
+sch.id
+web.id
+
+// ie : http://en.wikipedia.org/wiki/.ie
+ie
+gov.ie
+
+// il : http://en.wikipedia.org/wiki/.il
+*.il
+
+// im : https://www.nic.im/pdfs/imfaqs.pdf
+im
+co.im
+ltd.co.im
+plc.co.im
+net.im
+gov.im
+org.im
+nic.im
+ac.im
+
+// in : http://en.wikipedia.org/wiki/.in
+// see also: http://www.inregistry.in/policies/
+// Please note, that nic.in is not an offical eTLD, but used by most
+// government institutions.
+in
+co.in
+firm.in
+net.in
+org.in
+gen.in
+ind.in
+nic.in
+ac.in
+edu.in
+res.in
+gov.in
+mil.in
+
+// info : http://en.wikipedia.org/wiki/.info
+info
+
+// int : http://en.wikipedia.org/wiki/.int
+// Confirmed by registry <iana-questions@icann.org> 2008-06-18
+int
+eu.int
+
+// io : http://www.nic.io/rules.html
+// list of other 2nd level tlds ?
+io
+com.io
+
+// iq : http://www.cmc.iq/english/iq/iqregister1.htm
+iq
+gov.iq
+edu.iq
+mil.iq
+com.iq
+org.iq
+net.iq
+
+// ir : http://www.nic.ir/Terms_and_Conditions_ir,_Appendix_1_Domain_Rules
+// Also see http://www.nic.ir/Internationalized_Domain_Names
+// Two <iran>.ir entries added at request of <tech-team@nic.ir>, 2010-04-16
+ir
+ac.ir
+co.ir
+gov.ir
+id.ir
+net.ir
+org.ir
+sch.ir
+// xn--mgba3a4f16a.ir (<iran>.ir, Persian YEH)
+ایران.ir
+// xn--mgba3a4fra.ir (<iran>.ir, Arabic YEH)
+ايران.ir
+
+// is : http://www.isnic.is/domain/rules.php
+// Confirmed by registry <marius@isgate.is> 2008-12-06
+is
+net.is
+com.is
+edu.is
+gov.is
+org.is
+int.is
+
+// it : http://en.wikipedia.org/wiki/.it
+it
+gov.it
+edu.it
+// list of reserved geo-names : 
+// http://www.nic.it/documenti/regolamenti-e-linee-guida/regolamento-assegnazione-versione-6.0.pdf
+// (There is also a list of reserved geo-names corresponding to Italian 
+// municipalities : http://www.nic.it/documenti/appendice-c.pdf , but it is
+// not included here.)
+agrigento.it
+ag.it
+alessandria.it
+al.it
+ancona.it
+an.it
+aosta.it
+aoste.it
+ao.it
+arezzo.it
+ar.it
+ascoli-piceno.it
+ascolipiceno.it
+ap.it
+asti.it
+at.it
+avellino.it
+av.it
+bari.it
+ba.it
+andria-barletta-trani.it
+andriabarlettatrani.it
+trani-barletta-andria.it
+tranibarlettaandria.it
+barletta-trani-andria.it
+barlettatraniandria.it
+andria-trani-barletta.it
+andriatranibarletta.it
+trani-andria-barletta.it
+traniandriabarletta.it
+bt.it
+belluno.it
+bl.it
+benevento.it
+bn.it
+bergamo.it
+bg.it
+biella.it
+bi.it
+bologna.it
+bo.it
+bolzano.it
+bozen.it
+balsan.it
+alto-adige.it
+altoadige.it
+suedtirol.it
+bz.it
+brescia.it
+bs.it
+brindisi.it
+br.it
+cagliari.it
+ca.it
+caltanissetta.it
+cl.it
+campobasso.it
+cb.it
+carboniaiglesias.it
+carbonia-iglesias.it
+iglesias-carbonia.it
+iglesiascarbonia.it
+ci.it
+caserta.it
+ce.it
+catania.it
+ct.it
+catanzaro.it
+cz.it
+chieti.it
+ch.it
+como.it
+co.it
+cosenza.it
+cs.it
+cremona.it
+cr.it
+crotone.it
+kr.it
+cuneo.it
+cn.it
+dell-ogliastra.it
+dellogliastra.it
+ogliastra.it
+og.it
+enna.it
+en.it
+ferrara.it
+fe.it
+fermo.it
+fm.it
+firenze.it
+florence.it
+fi.it
+foggia.it
+fg.it
+forli-cesena.it
+forlicesena.it
+cesena-forli.it
+cesenaforli.it
+fc.it
+frosinone.it
+fr.it
+genova.it
+genoa.it
+ge.it
+gorizia.it
+go.it
+grosseto.it
+gr.it
+imperia.it
+im.it
+isernia.it
+is.it
+laquila.it
+aquila.it
+aq.it
+la-spezia.it
+laspezia.it
+sp.it
+latina.it
+lt.it
+lecce.it
+le.it
+lecco.it
+lc.it
+livorno.it
+li.it
+lodi.it
+lo.it
+lucca.it
+lu.it
+macerata.it
+mc.it
+mantova.it
+mn.it
+massa-carrara.it
+massacarrara.it
+carrara-massa.it
+carraramassa.it
+ms.it
+matera.it
+mt.it
+medio-campidano.it
+mediocampidano.it
+campidano-medio.it
+campidanomedio.it
+vs.it
+messina.it
+me.it
+milano.it
+milan.it
+mi.it
+modena.it
+mo.it
+monza.it
+monza-brianza.it
+monzabrianza.it
+monzaebrianza.it
+monzaedellabrianza.it
+monza-e-della-brianza.it
+mb.it
+napoli.it
+naples.it
+na.it
+novara.it
+no.it
+nuoro.it
+nu.it
+oristano.it
+or.it
+padova.it
+padua.it
+pd.it
+palermo.it
+pa.it
+parma.it
+pr.it
+pavia.it
+pv.it
+perugia.it
+pg.it
+pescara.it
+pe.it
+pesaro-urbino.it
+pesarourbino.it
+urbino-pesaro.it
+urbinopesaro.it
+pu.it
+piacenza.it
+pc.it
+pisa.it
+pi.it
+pistoia.it
+pt.it
+pordenone.it
+pn.it
+potenza.it
+pz.it
+prato.it
+po.it
+ragusa.it
+rg.it
+ravenna.it
+ra.it
+reggio-calabria.it
+reggiocalabria.it
+rc.it
+reggio-emilia.it
+reggioemilia.it
+re.it
+rieti.it
+ri.it
+rimini.it
+rn.it
+roma.it
+rome.it
+rm.it
+rovigo.it
+ro.it
+salerno.it
+sa.it
+sassari.it
+ss.it
+savona.it
+sv.it
+siena.it
+si.it
+siracusa.it
+sr.it
+sondrio.it
+so.it
+taranto.it
+ta.it
+tempio-olbia.it
+tempioolbia.it
+olbia-tempio.it
+olbiatempio.it
+ot.it
+teramo.it
+te.it
+terni.it
+tr.it
+torino.it
+turin.it
+to.it
+trapani.it
+tp.it
+trento.it
+trentino.it
+tn.it
+treviso.it
+tv.it
+trieste.it
+ts.it
+udine.it
+ud.it
+varese.it
+va.it
+venezia.it
+venice.it
+ve.it
+verbania.it
+vb.it
+vercelli.it
+vc.it
+verona.it
+vr.it
+vibo-valentia.it
+vibovalentia.it
+vv.it
+vicenza.it
+vi.it
+viterbo.it
+vt.it
+
+// je : http://www.channelisles.net/applic/avextn.shtml
+je
+co.je
+org.je
+net.je
+sch.je
+gov.je
+
+// jm : http://www.com.jm/register.html
+*.jm
+
+// jo : http://www.dns.jo/Registration_policy.aspx
+jo
+com.jo
+org.jo
+net.jo
+edu.jo
+sch.jo
+gov.jo
+mil.jo
+name.jo
+
+// jobs : http://en.wikipedia.org/wiki/.jobs
+jobs
+
+// jp : http://en.wikipedia.org/wiki/.jp
+// http://jprs.co.jp/en/jpdomain.html
+// Submitted by registry <yone@jprs.co.jp> 2008-06-11
+// Updated by registry <yone@jprs.co.jp> 2008-12-04
+jp
+// jp organizational type names 
+ac.jp
+ad.jp
+co.jp
+ed.jp
+go.jp
+gr.jp
+lg.jp
+ne.jp
+or.jp
+// jp geographic type names
+// http://jprs.jp/doc/rule/saisoku-1.html
+*.aichi.jp
+*.akita.jp
+*.aomori.jp
+*.chiba.jp
+*.ehime.jp
+*.fukui.jp
+*.fukuoka.jp
+*.fukushima.jp
+*.gifu.jp
+*.gunma.jp
+*.hiroshima.jp
+*.hokkaido.jp
+*.hyogo.jp
+*.ibaraki.jp
+*.ishikawa.jp
+*.iwate.jp
+*.kagawa.jp
+*.kagoshima.jp
+*.kanagawa.jp
+*.kawasaki.jp
+*.kitakyushu.jp
+*.kobe.jp
+*.kochi.jp
+*.kumamoto.jp
+*.kyoto.jp
+*.mie.jp
+*.miyagi.jp
+*.miyazaki.jp
+*.nagano.jp
+*.nagasaki.jp
+*.nagoya.jp
+*.nara.jp
+*.niigata.jp
+*.oita.jp
+*.okayama.jp
+*.okinawa.jp
+*.osaka.jp
+*.saga.jp
+*.saitama.jp
+*.sapporo.jp
+*.sendai.jp
+*.shiga.jp
+*.shimane.jp
+*.shizuoka.jp
+*.tochigi.jp
+*.tokushima.jp
+*.tokyo.jp
+*.tottori.jp
+*.toyama.jp
+*.wakayama.jp
+*.yamagata.jp
+*.yamaguchi.jp
+*.yamanashi.jp
+*.yokohama.jp
+!metro.tokyo.jp
+!pref.aichi.jp
+!pref.akita.jp
+!pref.aomori.jp
+!pref.chiba.jp
+!pref.ehime.jp
+!pref.fukui.jp
+!pref.fukuoka.jp
+!pref.fukushima.jp
+!pref.gifu.jp
+!pref.gunma.jp
+!pref.hiroshima.jp
+!pref.hokkaido.jp
+!pref.hyogo.jp
+!pref.ibaraki.jp
+!pref.ishikawa.jp
+!pref.iwate.jp
+!pref.kagawa.jp
+!pref.kagoshima.jp
+!pref.kanagawa.jp
+!pref.kochi.jp
+!pref.kumamoto.jp
+!pref.kyoto.jp
+!pref.mie.jp
+!pref.miyagi.jp
+!pref.miyazaki.jp
+!pref.nagano.jp
+!pref.nagasaki.jp
+!pref.nara.jp
+!pref.niigata.jp
+!pref.oita.jp
+!pref.okayama.jp
+!pref.okinawa.jp
+!pref.osaka.jp
+!pref.saga.jp
+!pref.saitama.jp
+!pref.shiga.jp
+!pref.shimane.jp
+!pref.shizuoka.jp
+!pref.tochigi.jp
+!pref.tokushima.jp
+!pref.tottori.jp
+!pref.toyama.jp
+!pref.wakayama.jp
+!pref.yamagata.jp
+!pref.yamaguchi.jp
+!pref.yamanashi.jp
+!city.chiba.jp
+!city.fukuoka.jp
+!city.hiroshima.jp
+!city.kawasaki.jp
+!city.kitakyushu.jp
+!city.kobe.jp
+!city.kyoto.jp
+!city.nagoya.jp
+!city.niigata.jp
+!city.okayama.jp
+!city.osaka.jp
+!city.saitama.jp
+!city.sapporo.jp
+!city.sendai.jp
+!city.shizuoka.jp
+!city.yokohama.jp
+
+// ke : http://www.kenic.or.ke/index.php?option=com_content&task=view&id=117&Itemid=145
+*.ke
+
+// kg : http://www.domain.kg/dmn_n.html
+kg
+org.kg
+net.kg
+com.kg
+edu.kg
+gov.kg
+mil.kg
+
+// kh : http://www.mptc.gov.kh/dns_registration.htm
+*.kh
+
+// ki : http://www.ki/dns/index.html
+ki
+edu.ki
+biz.ki
+net.ki
+org.ki
+gov.ki
+info.ki
+com.ki
+
+// km : http://en.wikipedia.org/wiki/.km
+// http://www.domaine.km/documents/charte.doc
+km
+org.km
+nom.km
+gov.km
+prd.km
+tm.km
+edu.km
+mil.km
+ass.km
+com.km
+// These are only mentioned as proposed suggestions at domaine.km, but
+// http://en.wikipedia.org/wiki/.km says they're available for registration:
+coop.km
+asso.km
+presse.km
+medecin.km
+notaires.km
+pharmaciens.km
+veterinaire.km
+gouv.km
+
+// kn : http://en.wikipedia.org/wiki/.kn
+// http://www.dot.kn/domainRules.html
+kn
+net.kn
+org.kn
+edu.kn
+gov.kn
+
+// kp : http://www.kcce.kp/en_index.php
+com.kp
+edu.kp
+gov.kp
+org.kp
+rep.kp
+tra.kp
+
+// kr : http://en.wikipedia.org/wiki/.kr
+// see also: http://domain.nida.or.kr/eng/registration.jsp
+kr
+ac.kr
+co.kr
+es.kr
+go.kr
+hs.kr
+kg.kr
+mil.kr
+ms.kr
+ne.kr
+or.kr
+pe.kr
+re.kr
+sc.kr
+// kr geographical names
+busan.kr
+chungbuk.kr
+chungnam.kr
+daegu.kr
+daejeon.kr
+gangwon.kr
+gwangju.kr
+gyeongbuk.kr
+gyeonggi.kr
+gyeongnam.kr
+incheon.kr
+jeju.kr
+jeonbuk.kr
+jeonnam.kr
+seoul.kr
+ulsan.kr
+
+// kw : http://en.wikipedia.org/wiki/.kw
+*.kw
+
+// ky : http://www.icta.ky/da_ky_reg_dom.php
+// Confirmed by registry <kysupport@perimeterusa.com> 2008-06-17
+ky
+edu.ky
+gov.ky
+com.ky
+org.ky
+net.ky
+
+// kz : http://en.wikipedia.org/wiki/.kz
+// see also: http://www.nic.kz/rules/index.jsp
+kz
+org.kz
+edu.kz
+net.kz
+gov.kz
+mil.kz
+com.kz
+
+// la : http://en.wikipedia.org/wiki/.la
+// Submitted by registry <gavin.brown@nic.la> 2008-06-10
+la
+int.la
+net.la
+info.la
+edu.la
+gov.la
+per.la
+com.la
+org.la
+// see http://www.c.la/
+c.la
+
+// lb : http://en.wikipedia.org/wiki/.lb
+// Submitted by registry <randy@psg.com> 2008-06-17
+com.lb
+edu.lb
+gov.lb
+net.lb
+org.lb
+
+// lc : http://en.wikipedia.org/wiki/.lc
+// see also: http://www.nic.lc/rules.htm
+lc
+com.lc
+net.lc
+co.lc
+org.lc
+edu.lc
+gov.lc
+
+// li : http://en.wikipedia.org/wiki/.li
+li
+
+// lk : http://www.nic.lk/seclevpr.html
+lk
+gov.lk
+sch.lk
+net.lk
+int.lk
+com.lk
+org.lk
+edu.lk
+ngo.lk
+soc.lk
+web.lk
+ltd.lk
+assn.lk
+grp.lk
+hotel.lk
+
+// local : http://en.wikipedia.org/wiki/.local
+local
+
+// lr : http://psg.com/dns/lr/lr.txt
+// Submitted by registry <randy@psg.com> 2008-06-17
+com.lr
+edu.lr
+gov.lr
+org.lr
+net.lr
+
+// ls : http://en.wikipedia.org/wiki/.ls
+ls
+co.ls
+org.ls
+
+// lt : http://en.wikipedia.org/wiki/.lt
+lt
+// gov.lt : http://www.gov.lt/index_en.php
+gov.lt
+
+// lu : http://www.dns.lu/en/
+lu
+
+// lv : http://www.nic.lv/DNS/En/generic.php
+lv
+com.lv
+edu.lv
+gov.lv
+org.lv
+mil.lv
+id.lv
+net.lv
+asn.lv
+conf.lv
+
+// ly : http://www.nic.ly/regulations.php
+ly
+com.ly
+net.ly
+gov.ly
+plc.ly
+edu.ly
+sch.ly
+med.ly
+org.ly
+id.ly
+
+// ma : http://en.wikipedia.org/wiki/.ma
+// http://www.anrt.ma/fr/admin/download/upload/file_fr782.pdf
+ma
+co.ma
+net.ma
+gov.ma
+org.ma
+ac.ma
+press.ma
+
+// mc : http://www.nic.mc/
+mc
+tm.mc
+asso.mc
+
+// md : http://en.wikipedia.org/wiki/.md
+md
+
+// me : http://en.wikipedia.org/wiki/.me
+me
+co.me
+net.me
+org.me
+edu.me
+ac.me
+gov.me
+its.me
+priv.me
+
+// mg : http://www.nic.mg/tarif.htm
+mg
+org.mg
+nom.mg
+gov.mg
+prd.mg
+tm.mg
+edu.mg
+mil.mg
+com.mg
+
+// mh : http://en.wikipedia.org/wiki/.mh
+mh
+
+// mil : http://en.wikipedia.org/wiki/.mil
+mil
+
+// mk : http://en.wikipedia.org/wiki/.mk
+// see also: http://dns.marnet.net.mk/postapka.php
+mk
+com.mk
+org.mk
+net.mk
+edu.mk
+gov.mk
+inf.mk
+name.mk
+
+// ml : http://www.gobin.info/domainname/ml-template.doc
+// see also: http://en.wikipedia.org/wiki/.ml
+ml
+com.ml
+edu.ml
+gouv.ml
+gov.ml
+net.ml
+org.ml
+presse.ml
+
+// mm : http://en.wikipedia.org/wiki/.mm
+*.mm
+
+// mn : http://en.wikipedia.org/wiki/.mn
+mn
+gov.mn
+edu.mn
+org.mn
+
+// mo : http://www.monic.net.mo/
+mo
+com.mo
+net.mo
+org.mo
+edu.mo
+gov.mo
+
+// mobi : http://en.wikipedia.org/wiki/.mobi
+mobi
+
+// mp : http://www.dot.mp/
+// Confirmed by registry <dcamacho@saipan.com> 2008-06-17
+mp
+
+// mq : http://en.wikipedia.org/wiki/.mq
+mq
+
+// mr : http://en.wikipedia.org/wiki/.mr
+mr
+gov.mr
+
+// ms : http://en.wikipedia.org/wiki/.ms
+ms
+
+// mt : https://www.nic.org.mt/dotmt/
+*.mt
+
+// mu : http://en.wikipedia.org/wiki/.mu
+mu
+com.mu
+net.mu
+org.mu
+gov.mu
+ac.mu
+co.mu
+or.mu
+
+// museum : http://about.museum/naming/
+// http://index.museum/
+museum
+academy.museum
+agriculture.museum
+air.museum
+airguard.museum
+alabama.museum
+alaska.museum
+amber.museum
+ambulance.museum
+american.museum
+americana.museum
+americanantiques.museum
+americanart.museum
+amsterdam.museum
+and.museum
+annefrank.museum
+anthro.museum
+anthropology.museum
+antiques.museum
+aquarium.museum
+arboretum.museum
+archaeological.museum
+archaeology.museum
+architecture.museum
+art.museum
+artanddesign.museum
+artcenter.museum
+artdeco.museum
+arteducation.museum
+artgallery.museum
+arts.museum
+artsandcrafts.museum
+asmatart.museum
+assassination.museum
+assisi.museum
+association.museum
+astronomy.museum
+atlanta.museum
+austin.museum
+australia.museum
+automotive.museum
+aviation.museum
+axis.museum
+badajoz.museum
+baghdad.museum
+bahn.museum
+bale.museum
+baltimore.museum
+barcelona.museum
+baseball.museum
+basel.museum
+baths.museum
+bauern.museum
+beauxarts.museum
+beeldengeluid.museum
+bellevue.museum
+bergbau.museum
+berkeley.museum
+berlin.museum
+bern.museum
+bible.museum
+bilbao.museum
+bill.museum
+birdart.museum
+birthplace.museum
+bonn.museum
+boston.museum
+botanical.museum
+botanicalgarden.museum
+botanicgarden.museum
+botany.museum
+brandywinevalley.museum
+brasil.museum
+bristol.museum
+british.museum
+britishcolumbia.museum
+broadcast.museum
+brunel.museum
+brussel.museum
+brussels.museum
+bruxelles.museum
+building.museum
+burghof.museum
+bus.museum
+bushey.museum
+cadaques.museum
+california.museum
+cambridge.museum
+can.museum
+canada.museum
+capebreton.museum
+carrier.museum
+cartoonart.museum
+casadelamoneda.museum
+castle.museum
+castres.museum
+celtic.museum
+center.museum
+chattanooga.museum
+cheltenham.museum
+chesapeakebay.museum
+chicago.museum
+children.museum
+childrens.museum
+childrensgarden.museum
+chiropractic.museum
+chocolate.museum
+christiansburg.museum
+cincinnati.museum
+cinema.museum
+circus.museum
+civilisation.museum
+civilization.museum
+civilwar.museum
+clinton.museum
+clock.museum
+coal.museum
+coastaldefence.museum
+cody.museum
+coldwar.museum
+collection.museum
+colonialwilliamsburg.museum
+coloradoplateau.museum
+columbia.museum
+columbus.museum
+communication.museum
+communications.museum
+community.museum
+computer.museum
+computerhistory.museum
+comunicações.museum
+contemporary.museum
+contemporaryart.museum
+convent.museum
+copenhagen.museum
+corporation.museum
+correios-e-telecomunicações.museum
+corvette.museum
+costume.museum
+countryestate.museum
+county.museum
+crafts.museum
+cranbrook.museum
+creation.museum
+cultural.museum
+culturalcenter.museum
+culture.museum
+cyber.museum
+cymru.museum
+dali.museum
+dallas.museum
+database.museum
+ddr.museum
+decorativearts.museum
+delaware.museum
+delmenhorst.museum
+denmark.museum
+depot.museum
+design.museum
+detroit.museum
+dinosaur.museum
+discovery.museum
+dolls.museum
+donostia.museum
+durham.museum
+eastafrica.museum
+eastcoast.museum
+education.museum
+educational.museum
+egyptian.museum
+eisenbahn.museum
+elburg.museum
+elvendrell.museum
+embroidery.museum
+encyclopedic.museum
+england.museum
+entomology.museum
+environment.museum
+environmentalconservation.museum
+epilepsy.museum
+essex.museum
+estate.museum
+ethnology.museum
+exeter.museum
+exhibition.museum
+family.museum
+farm.museum
+farmequipment.museum
+farmers.museum
+farmstead.museum
+field.museum
+figueres.museum
+filatelia.museum
+film.museum
+fineart.museum
+finearts.museum
+finland.museum
+flanders.museum
+florida.museum
+force.museum
+fortmissoula.museum
+fortworth.museum
+foundation.museum
+francaise.museum
+frankfurt.museum
+franziskaner.museum
+freemasonry.museum
+freiburg.museum
+fribourg.museum
+frog.museum
+fundacio.museum
+furniture.museum
+gallery.museum
+garden.museum
+gateway.museum
+geelvinck.museum
+gemological.museum
+geology.museum
+georgia.museum
+giessen.museum
+glas.museum
+glass.museum
+gorge.museum
+grandrapids.museum
+graz.museum
+guernsey.museum
+halloffame.museum
+hamburg.museum
+handson.museum
+harvestcelebration.museum
+hawaii.museum
+health.museum
+heimatunduhren.museum
+hellas.museum
+helsinki.museum
+hembygdsforbund.museum
+heritage.museum
+histoire.museum
+historical.museum
+historicalsociety.museum
+historichouses.museum
+historisch.museum
+historisches.museum
+history.museum
+historyofscience.museum
+horology.museum
+house.museum
+humanities.museum
+illustration.museum
+imageandsound.museum
+indian.museum
+indiana.museum
+indianapolis.museum
+indianmarket.museum
+intelligence.museum
+interactive.museum
+iraq.museum
+iron.museum
+isleofman.museum
+jamison.museum
+jefferson.museum
+jerusalem.museum
+jewelry.museum
+jewish.museum
+jewishart.museum
+jfk.museum
+journalism.museum
+judaica.museum
+judygarland.museum
+juedisches.museum
+juif.museum
+karate.museum
+karikatur.museum
+kids.museum
+koebenhavn.museum
+koeln.museum
+kunst.museum
+kunstsammlung.museum
+kunstunddesign.museum
+labor.museum
+labour.museum
+lajolla.museum
+lancashire.museum
+landes.museum
+lans.museum
+läns.museum
+larsson.museum
+lewismiller.museum
+lincoln.museum
+linz.museum
+living.museum
+livinghistory.museum
+localhistory.museum
+london.museum
+losangeles.museum
+louvre.museum
+loyalist.museum
+lucerne.museum
+luxembourg.museum
+luzern.museum
+mad.museum
+madrid.museum
+mallorca.museum
+manchester.museum
+mansion.museum
+mansions.museum
+manx.museum
+marburg.museum
+maritime.museum
+maritimo.museum
+maryland.museum
+marylhurst.museum
+media.museum
+medical.museum
+medizinhistorisches.museum
+meeres.museum
+memorial.museum
+mesaverde.museum
+michigan.museum
+midatlantic.museum
+military.museum
+mill.museum
+miners.museum
+mining.museum
+minnesota.museum
+missile.museum
+missoula.museum
+modern.museum
+moma.museum
+money.museum
+monmouth.museum
+monticello.museum
+montreal.museum
+moscow.museum
+motorcycle.museum
+muenchen.museum
+muenster.museum
+mulhouse.museum
+muncie.museum
+museet.museum
+museumcenter.museum
+museumvereniging.museum
+music.museum
+national.museum
+nationalfirearms.museum
+nationalheritage.museum
+nativeamerican.museum
+naturalhistory.museum
+naturalhistorymuseum.museum
+naturalsciences.museum
+nature.museum
+naturhistorisches.museum
+natuurwetenschappen.museum
+naumburg.museum
+naval.museum
+nebraska.museum
+neues.museum
+newhampshire.museum
+newjersey.museum
+newmexico.museum
+newport.museum
+newspaper.museum
+newyork.museum
+niepce.museum
+norfolk.museum
+north.museum
+nrw.museum
+nuernberg.museum
+nuremberg.museum
+nyc.museum
+nyny.museum
+oceanographic.museum
+oceanographique.museum
+omaha.museum
+online.museum
+ontario.museum
+openair.museum
+oregon.museum
+oregontrail.museum
+otago.museum
+oxford.museum
+pacific.museum
+paderborn.museum
+palace.museum
+paleo.museum
+palmsprings.museum
+panama.museum
+paris.museum
+pasadena.museum
+pharmacy.museum
+philadelphia.museum
+philadelphiaarea.museum
+philately.museum
+phoenix.museum
+photography.museum
+pilots.museum
+pittsburgh.museum
+planetarium.museum
+plantation.museum
+plants.museum
+plaza.museum
+portal.museum
+portland.museum
+portlligat.museum
+posts-and-telecommunications.museum
+preservation.museum
+presidio.museum
+press.museum
+project.museum
+public.museum
+pubol.museum
+quebec.museum
+railroad.museum
+railway.museum
+research.museum
+resistance.museum
+riodejaneiro.museum
+rochester.museum
+rockart.museum
+roma.museum
+russia.museum
+saintlouis.museum
+salem.museum
+salvadordali.museum
+salzburg.museum
+sandiego.museum
+sanfrancisco.museum
+santabarbara.museum
+santacruz.museum
+santafe.museum
+saskatchewan.museum
+satx.museum
+savannahga.museum
+schlesisches.museum
+schoenbrunn.museum
+schokoladen.museum
+school.museum
+schweiz.museum
+science.museum
+scienceandhistory.museum
+scienceandindustry.museum
+sciencecenter.museum
+sciencecenters.museum
+science-fiction.museum
+sciencehistory.museum
+sciences.museum
+sciencesnaturelles.museum
+scotland.museum
+seaport.museum
+settlement.museum
+settlers.museum
+shell.museum
+sherbrooke.museum
+sibenik.museum
+silk.museum
+ski.museum
+skole.museum
+society.museum
+sologne.museum
+soundandvision.museum
+southcarolina.museum
+southwest.museum
+space.museum
+spy.museum
+square.museum
+stadt.museum
+stalbans.museum
+starnberg.museum
+state.museum
+stateofdelaware.museum
+station.museum
+steam.museum
+steiermark.museum
+stjohn.museum
+stockholm.museum
+stpetersburg.museum
+stuttgart.museum
+suisse.museum
+surgeonshall.museum
+surrey.museum
+svizzera.museum
+sweden.museum
+sydney.museum
+tank.museum
+tcm.museum
+technology.museum
+telekommunikation.museum
+television.museum
+texas.museum
+textile.museum
+theater.museum
+time.museum
+timekeeping.museum
+topology.museum
+torino.museum
+touch.museum
+town.museum
+transport.museum
+tree.museum
+trolley.museum
+trust.museum
+trustee.museum
+uhren.museum
+ulm.museum
+undersea.museum
+university.museum
+usa.museum
+usantiques.museum
+usarts.museum
+uscountryestate.museum
+usculture.museum
+usdecorativearts.museum
+usgarden.museum
+ushistory.museum
+ushuaia.museum
+uslivinghistory.museum
+utah.museum
+uvic.museum
+valley.museum
+vantaa.museum
+versailles.museum
+viking.museum
+village.museum
+virginia.museum
+virtual.museum
+virtuel.museum
+vlaanderen.museum
+volkenkunde.museum
+wales.museum
+wallonie.museum
+war.museum
+washingtondc.museum
+watchandclock.museum
+watch-and-clock.museum
+western.museum
+westfalen.museum
+whaling.museum
+wildlife.museum
+williamsburg.museum
+windmill.museum
+workshop.museum
+york.museum
+yorkshire.museum
+yosemite.museum
+youth.museum
+zoological.museum
+zoology.museum
+ירושלים.museum
+иком.museum
+
+// mv : http://en.wikipedia.org/wiki/.mv
+// "mv" included because, contra Wikipedia, google.mv exists.
+mv
+aero.mv
+biz.mv
+com.mv
+coop.mv
+edu.mv
+gov.mv
+info.mv
+int.mv
+mil.mv
+museum.mv
+name.mv
+net.mv
+org.mv
+pro.mv
+
+// mw : http://www.registrar.mw/
+mw
+ac.mw
+biz.mw
+co.mw
+com.mw
+coop.mw
+edu.mw
+gov.mw
+int.mw
+museum.mw
+net.mw
+org.mw
+
+// mx : http://www.nic.mx/
+// Submitted by registry <farias@nic.mx> 2008-06-19
+mx
+com.mx
+org.mx
+gob.mx
+edu.mx
+net.mx
+
+// my : http://www.mynic.net.my/
+my
+com.my
+net.my
+org.my
+gov.my
+edu.my
+mil.my
+name.my
+
+// mz : http://www.gobin.info/domainname/mz-template.doc
+*.mz
+
+// na : http://www.na-nic.com.na/
+// http://www.info.na/domain/
+na
+info.na
+pro.na
+name.na
+school.na
+or.na
+dr.na
+us.na
+mx.na
+ca.na
+in.na
+cc.na
+tv.na
+ws.na
+mobi.na
+co.na
+com.na
+org.na
+
+// name : has 2nd-level tlds, but there's no list of them
+name
+
+// nc : http://www.cctld.nc/
+nc
+asso.nc
+
+// ne : http://en.wikipedia.org/wiki/.ne
+ne
+
+// net : http://en.wikipedia.org/wiki/.net
+net
+
+// CentralNic names : http://www.centralnic.com/names/domains
+// Submitted by registry <gavin.brown@centralnic.com> 2008-06-17
+gb.net
+se.net
+uk.net
+
+// ZaNiC names : http://www.za.net/
+// Confirmed by registry <hostmaster@nic.za.net> 2009-10-03
+za.net
+
+// nf : http://en.wikipedia.org/wiki/.nf
+nf
+com.nf
+net.nf
+per.nf
+rec.nf
+web.nf
+arts.nf
+firm.nf
+info.nf
+other.nf
+store.nf
+
+// ng : http://psg.com/dns/ng/
+// Submitted by registry <randy@psg.com> 2008-06-17
+ac.ng
+com.ng
+edu.ng
+gov.ng
+net.ng
+org.ng
+
+// ni : http://www.nic.ni/dominios.htm
+*.ni
+
+// nl : http://www.domain-registry.nl/ace.php/c,728,122,,,,Home.html
+// Confirmed by registry <Antoin.Verschuren@sidn.nl> (with technical
+// reservations) 2008-06-08
+nl
+
+// BV.nl will be a registry for dutch BV's (besloten vennootschap)
+bv.nl
+
+// the co.nl domain is managed by CoDNS B.V. Added 2010-05-23.
+co.nl
+
+// no : http://www.norid.no/regelverk/index.en.html
+// The Norwegian registry has declined to notify us of updates. The web pages
+// referenced below are the official source of the data. There is also an
+// announce mailing list: 
+// https://postlister.uninett.no/sympa/info/norid-diskusjon
+no
+// Norid generic domains : http://www.norid.no/regelverk/vedlegg-c.en.html
+fhs.no
+vgs.no
+fylkesbibl.no
+folkebibl.no
+museum.no
+idrett.no
+priv.no
+// Non-Norid generic domains : http://www.norid.no/regelverk/vedlegg-d.en.html
+mil.no
+stat.no
+dep.no
+kommune.no
+herad.no
+// no geographical names : http://www.norid.no/regelverk/vedlegg-b.en.html
+// counties
+aa.no
+ah.no
+bu.no
+fm.no
+hl.no
+hm.no
+jan-mayen.no
+mr.no
+nl.no
+nt.no
+of.no
+ol.no
+oslo.no
+rl.no
+sf.no
+st.no
+svalbard.no
+tm.no
+tr.no
+va.no
+vf.no
+// primary and lower secondary schools per county
+gs.aa.no
+gs.ah.no
+gs.bu.no
+gs.fm.no
+gs.hl.no
+gs.hm.no
+gs.jan-mayen.no
+gs.mr.no
+gs.nl.no
+gs.nt.no
+gs.of.no
+gs.ol.no
+gs.oslo.no
+gs.rl.no
+gs.sf.no
+gs.st.no
+gs.svalbard.no
+gs.tm.no
+gs.tr.no
+gs.va.no
+gs.vf.no
+// cities
+akrehamn.no
+åkrehamn.no
+algard.no
+ålgård.no
+arna.no
+brumunddal.no
+bryne.no
+bronnoysund.no
+brønnøysund.no
+drobak.no
+drøbak.no
+egersund.no
+fetsund.no
+floro.no
+florø.no
+fredrikstad.no
+hokksund.no
+honefoss.no
+hønefoss.no
+jessheim.no
+jorpeland.no
+jørpeland.no
+kirkenes.no
+kopervik.no
+krokstadelva.no
+langevag.no
+langevåg.no
+leirvik.no
+mjondalen.no
+mjøndalen.no
+mo-i-rana.no
+mosjoen.no
+mosjøen.no
+nesoddtangen.no
+orkanger.no
+osoyro.no
+osøyro.no
+raholt.no
+råholt.no
+sandnessjoen.no
+sandnessjøen.no
+skedsmokorset.no
+slattum.no
+spjelkavik.no
+stathelle.no
+stavern.no
+stjordalshalsen.no
+stjørdalshalsen.no
+tananger.no
+tranby.no
+vossevangen.no
+// communities
+afjord.no
+åfjord.no
+agdenes.no
+al.no
+ål.no
+alesund.no
+ålesund.no
+alstahaug.no
+alta.no
+áltá.no
+alaheadju.no
+álaheadju.no
+alvdal.no
+amli.no
+åmli.no
+amot.no
+åmot.no
+andebu.no
+andoy.no
+andøy.no
+andasuolo.no
+ardal.no
+årdal.no
+aremark.no
+arendal.no
+ås.no
+aseral.no
+åseral.no
+asker.no
+askim.no
+askvoll.no
+askoy.no
+askøy.no
+asnes.no
+åsnes.no
+audnedaln.no
+aukra.no
+aure.no
+aurland.no
+aurskog-holand.no
+aurskog-høland.no
+austevoll.no
+austrheim.no
+averoy.no
+averøy.no
+balestrand.no
+ballangen.no
+balat.no
+bálát.no
+balsfjord.no
+bahccavuotna.no
+báhccavuotna.no
+bamble.no
+bardu.no
+beardu.no
+beiarn.no
+bajddar.no
+bájddar.no
+baidar.no
+báidár.no
+berg.no
+bergen.no
+berlevag.no
+berlevåg.no
+bearalvahki.no
+bearalváhki.no
+bindal.no
+birkenes.no
+bjarkoy.no
+bjarkøy.no
+bjerkreim.no
+bjugn.no
+bodo.no
+bodø.no
+badaddja.no
+bådåddjå.no
+budejju.no
+bokn.no
+bremanger.no
+bronnoy.no
+brønnøy.no
+bygland.no
+bykle.no
+barum.no
+bærum.no
+bo.telemark.no
+bø.telemark.no
+bo.nordland.no
+bø.nordland.no
+bievat.no
+bievát.no
+bomlo.no
+bømlo.no
+batsfjord.no
+båtsfjord.no
+bahcavuotna.no
+báhcavuotna.no
+dovre.no
+drammen.no
+drangedal.no
+dyroy.no
+dyrøy.no
+donna.no
+dønna.no
+eid.no
+eidfjord.no
+eidsberg.no
+eidskog.no
+eidsvoll.no
+eigersund.no
+elverum.no
+enebakk.no
+engerdal.no
+etne.no
+etnedal.no
+evenes.no
+evenassi.no
+evenášši.no
+evje-og-hornnes.no
+farsund.no
+fauske.no
+fuossko.no
+fuoisku.no
+fedje.no
+fet.no
+finnoy.no
+finnøy.no
+fitjar.no
+fjaler.no
+fjell.no
+flakstad.no
+flatanger.no
+flekkefjord.no
+flesberg.no
+flora.no
+fla.no
+flå.no
+folldal.no
+forsand.no
+fosnes.no
+frei.no
+frogn.no
+froland.no
+frosta.no
+frana.no
+fræna.no
+froya.no
+frøya.no
+fusa.no
+fyresdal.no
+forde.no
+førde.no
+gamvik.no
+gangaviika.no
+gáŋgaviika.no
+gaular.no
+gausdal.no
+gildeskal.no
+gildeskål.no
+giske.no
+gjemnes.no
+gjerdrum.no
+gjerstad.no
+gjesdal.no
+gjovik.no
+gjøvik.no
+gloppen.no
+gol.no
+gran.no
+grane.no
+granvin.no
+gratangen.no
+grimstad.no
+grong.no
+kraanghke.no
+kråanghke.no
+grue.no
+gulen.no
+hadsel.no
+halden.no
+halsa.no
+hamar.no
+hamaroy.no
+habmer.no
+hábmer.no
+hapmir.no
+hápmir.no
+hammerfest.no
+hammarfeasta.no
+hámmárfeasta.no
+haram.no
+hareid.no
+harstad.no
+hasvik.no
+aknoluokta.no
+ákŋoluokta.no
+hattfjelldal.no
+aarborte.no
+haugesund.no
+hemne.no
+hemnes.no
+hemsedal.no
+heroy.more-og-romsdal.no
+herøy.møre-og-romsdal.no
+heroy.nordland.no
+herøy.nordland.no
+hitra.no
+hjartdal.no
+hjelmeland.no
+hobol.no
+hobøl.no
+hof.no
+hol.no
+hole.no
+holmestrand.no
+holtalen.no
+holtålen.no
+hornindal.no
+horten.no
+hurdal.no
+hurum.no
+hvaler.no
+hyllestad.no
+hagebostad.no
+hægebostad.no
+hoyanger.no
+høyanger.no
+hoylandet.no
+høylandet.no
+ha.no
+hå.no
+ibestad.no
+inderoy.no
+inderøy.no
+iveland.no
+jevnaker.no
+jondal.no
+jolster.no
+jølster.no
+karasjok.no
+karasjohka.no
+kárášjohka.no
+karlsoy.no
+galsa.no
+gálsá.no
+karmoy.no
+karmøy.no
+kautokeino.no
+guovdageaidnu.no
+klepp.no
+klabu.no
+klæbu.no
+kongsberg.no
+kongsvinger.no
+kragero.no
+kragerø.no
+kristiansand.no
+kristiansund.no
+krodsherad.no
+krødsherad.no
+kvalsund.no
+rahkkeravju.no
+ráhkkerávju.no
+kvam.no
+kvinesdal.no
+kvinnherad.no
+kviteseid.no
+kvitsoy.no
+kvitsøy.no
+kvafjord.no
+kvæfjord.no
+giehtavuoatna.no
+kvanangen.no
+kvænangen.no
+navuotna.no
+návuotna.no
+kafjord.no
+kåfjord.no
+gaivuotna.no
+gáivuotna.no
+larvik.no
+lavangen.no
+lavagis.no
+loabat.no
+loabát.no
+lebesby.no
+davvesiida.no
+leikanger.no
+leirfjord.no
+leka.no
+leksvik.no
+lenvik.no
+leangaviika.no
+leaŋgaviika.no
+lesja.no
+levanger.no
+lier.no
+lierne.no
+lillehammer.no
+lillesand.no
+lindesnes.no
+lindas.no
+lindås.no
+lom.no
+loppa.no
+lahppi.no
+láhppi.no
+lund.no
+lunner.no
+luroy.no
+lurøy.no
+luster.no
+lyngdal.no
+lyngen.no
+ivgu.no
+lardal.no
+lerdal.no
+lærdal.no
+lodingen.no
+lødingen.no
+lorenskog.no
+lørenskog.no
+loten.no
+løten.no
+malvik.no
+masoy.no
+måsøy.no
+muosat.no
+muosát.no
+mandal.no
+marker.no
+marnardal.no
+masfjorden.no
+meland.no
+meldal.no
+melhus.no
+meloy.no
+meløy.no
+meraker.no
+meråker.no
+moareke.no
+moåreke.no
+midsund.no
+midtre-gauldal.no
+modalen.no
+modum.no
+molde.no
+moskenes.no
+moss.no
+mosvik.no
+malselv.no
+målselv.no
+malatvuopmi.no
+málatvuopmi.no
+namdalseid.no
+aejrie.no
+namsos.no
+namsskogan.no
+naamesjevuemie.no
+nååmesjevuemie.no
+laakesvuemie.no
+nannestad.no
+narvik.no
+narviika.no
+naustdal.no
+nedre-eiker.no
+nes.akershus.no
+nes.buskerud.no
+nesna.no
+nesodden.no
+nesseby.no
+unjarga.no
+unjárga.no
+nesset.no
+nissedal.no
+nittedal.no
+nord-aurdal.no
+nord-fron.no
+nord-odal.no
+norddal.no
+nordkapp.no
+davvenjarga.no
+davvenjárga.no
+nordre-land.no
+nordreisa.no
+raisa.no
+ráisa.no
+nore-og-uvdal.no
+notodden.no
+naroy.no
+nærøy.no
+notteroy.no
+nøtterøy.no
+odda.no
+oksnes.no
+øksnes.no
+oppdal.no
+oppegard.no
+oppegård.no
+orkdal.no
+orland.no
+ørland.no
+orskog.no
+ørskog.no
+orsta.no
+ørsta.no
+os.hedmark.no
+os.hordaland.no
+osen.no
+osteroy.no
+osterøy.no
+ostre-toten.no
+østre-toten.no
+overhalla.no
+ovre-eiker.no
+øvre-eiker.no
+oyer.no
+øyer.no
+oygarden.no
+øygarden.no
+oystre-slidre.no
+øystre-slidre.no
+porsanger.no
+porsangu.no
+porsáŋgu.no
+porsgrunn.no
+radoy.no
+radøy.no
+rakkestad.no
+rana.no
+ruovat.no
+randaberg.no
+rauma.no
+rendalen.no
+rennebu.no
+rennesoy.no
+rennesøy.no
+rindal.no
+ringebu.no
+ringerike.no
+ringsaker.no
+rissa.no
+risor.no
+risør.no
+roan.no
+rollag.no
+rygge.no
+ralingen.no
+rælingen.no
+rodoy.no
+rødøy.no
+romskog.no
+rømskog.no
+roros.no
+røros.no
+rost.no
+røst.no
+royken.no
+røyken.no
+royrvik.no
+røyrvik.no
+rade.no
+råde.no
+salangen.no
+siellak.no
+saltdal.no
+salat.no
+sálát.no
+sálat.no
+samnanger.no
+sande.more-og-romsdal.no
+sande.møre-og-romsdal.no
+sande.vestfold.no
+sandefjord.no
+sandnes.no
+sandoy.no
+sandøy.no
+sarpsborg.no
+sauda.no
+sauherad.no
+sel.no
+selbu.no
+selje.no
+seljord.no
+sigdal.no
+siljan.no
+sirdal.no
+skaun.no
+skedsmo.no
+ski.no
+skien.no
+skiptvet.no
+skjervoy.no
+skjervøy.no
+skierva.no
+skiervá.no
+skjak.no
+skjåk.no
+skodje.no
+skanland.no
+skånland.no
+skanit.no
+skánit.no
+smola.no
+smøla.no
+snillfjord.no
+snasa.no
+snåsa.no
+snoasa.no
+snaase.no
+snåase.no
+sogndal.no
+sokndal.no
+sola.no
+solund.no
+songdalen.no
+sortland.no
+spydeberg.no
+stange.no
+stavanger.no
+steigen.no
+steinkjer.no
+stjordal.no
+stjørdal.no
+stokke.no
+stor-elvdal.no
+stord.no
+stordal.no
+storfjord.no
+omasvuotna.no
+strand.no
+stranda.no
+stryn.no
+sula.no
+suldal.no
+sund.no
+sunndal.no
+surnadal.no
+sveio.no
+svelvik.no
+sykkylven.no
+sogne.no
+søgne.no
+somna.no
+sømna.no
+sondre-land.no
+søndre-land.no
+sor-aurdal.no
+sør-aurdal.no
+sor-fron.no
+sør-fron.no
+sor-odal.no
+sør-odal.no
+sor-varanger.no
+sør-varanger.no
+matta-varjjat.no
+mátta-várjjat.no
+sorfold.no
+sørfold.no
+sorreisa.no
+sørreisa.no
+sorum.no
+sørum.no
+tana.no
+deatnu.no
+time.no
+tingvoll.no
+tinn.no
+tjeldsund.no
+dielddanuorri.no
+tjome.no
+tjøme.no
+tokke.no
+tolga.no
+torsken.no
+tranoy.no
+tranøy.no
+tromso.no
+tromsø.no
+tromsa.no
+romsa.no
+trondheim.no
+troandin.no
+trysil.no
+trana.no
+træna.no
+trogstad.no
+trøgstad.no
+tvedestrand.no
+tydal.no
+tynset.no
+tysfjord.no
+divtasvuodna.no
+divttasvuotna.no
+tysnes.no
+tysvar.no
+tysvær.no
+tonsberg.no
+tønsberg.no
+ullensaker.no
+ullensvang.no
+ulvik.no
+utsira.no
+vadso.no
+vadsø.no
+cahcesuolo.no
+čáhcesuolo.no
+vaksdal.no
+valle.no
+vang.no
+vanylven.no
+vardo.no
+vardø.no
+varggat.no
+várggát.no
+vefsn.no
+vaapste.no
+vega.no
+vegarshei.no
+vegårshei.no
+vennesla.no
+verdal.no
+verran.no
+vestby.no
+vestnes.no
+vestre-slidre.no
+vestre-toten.no
+vestvagoy.no
+vestvågøy.no
+vevelstad.no
+vik.no
+vikna.no
+vindafjord.no
+volda.no
+voss.no
+varoy.no
+værøy.no
+vagan.no
+vågan.no
+voagat.no
+vagsoy.no
+vågsøy.no
+vaga.no
+vågå.no
+valer.ostfold.no
+våler.østfold.no
+valer.hedmark.no
+våler.hedmark.no
+
+// the co.no domain is managed by CoDNS B.V. Added 2010-05-23.
+co.no
+
+// np : http://www.mos.com.np/register.html
+*.np
+
+// nr : http://cenpac.net.nr/dns/index.html
+// Confirmed by registry <technician@cenpac.net.nr> 2008-06-17
+nr
+biz.nr
+info.nr
+gov.nr
+edu.nr
+org.nr
+net.nr
+com.nr
+
+// nu : http://en.wikipedia.org/wiki/.nu
+nu
+
+// nz : http://en.wikipedia.org/wiki/.nz
+*.nz
+
+// om : http://en.wikipedia.org/wiki/.om
+*.om
+!mediaphone.om
+!nawrastelecom.om
+!nawras.om
+!omanmobile.om
+!omanpost.om
+!omantel.om
+!rakpetroleum.om
+!siemens.om
+!songfest.om
+!statecouncil.om
+
+// org : http://en.wikipedia.org/wiki/.org
+org
+
+// CentralNic names : http://www.centralnic.com/names/domains
+// Submitted by registry <gavin.brown@centralnic.com> 2008-06-17
+ae.org
+
+// ZaNiC names : http://www.za.net/
+// Confirmed by registry <hostmaster@nic.za.net> 2009-10-03
+za.org
+
+// pa : http://www.nic.pa/
+// Some additional second level "domains" resolve directly as hostnames, such as
+// pannet.pa, so we add a rule for "pa".
+pa
+ac.pa
+gob.pa
+com.pa
+org.pa
+sld.pa
+edu.pa
+net.pa
+ing.pa
+abo.pa
+med.pa
+nom.pa
+
+// pe : https://www.nic.pe/InformeFinalComision.pdf
+pe
+edu.pe
+gob.pe
+nom.pe
+mil.pe
+org.pe
+com.pe
+net.pe
+
+// pf : http://www.gobin.info/domainname/formulaire-pf.pdf
+pf
+com.pf
+org.pf
+edu.pf
+
+// pg : http://en.wikipedia.org/wiki/.pg
+*.pg
+
+// ph : http://www.domains.ph/FAQ2.asp
+// Submitted by registry <jed@email.com.ph> 2008-06-13
+ph
+com.ph
+net.ph
+org.ph
+gov.ph
+edu.ph
+ngo.ph
+mil.ph
+i.ph
+
+// pk : http://pk5.pknic.net.pk/pk5/msgNamepk.PK
+pk
+com.pk
+net.pk
+edu.pk
+org.pk
+fam.pk
+biz.pk
+web.pk
+gov.pk
+gob.pk
+gok.pk
+gon.pk
+gop.pk
+gos.pk
+info.pk
+
+// pl : http://www.dns.pl/english/
+pl
+// NASK functional domains (nask.pl / dns.pl) : http://www.dns.pl/english/dns-funk.html
+aid.pl
+agro.pl
+atm.pl
+auto.pl
+biz.pl
+com.pl
+edu.pl
+gmina.pl
+gsm.pl
+info.pl
+mail.pl
+miasta.pl
+media.pl
+mil.pl
+net.pl
+nieruchomosci.pl
+nom.pl
+org.pl
+pc.pl
+powiat.pl
+priv.pl
+realestate.pl
+rel.pl
+sex.pl
+shop.pl
+sklep.pl
+sos.pl
+szkola.pl
+targi.pl
+tm.pl
+tourism.pl
+travel.pl
+turystyka.pl
+// ICM functional domains (icm.edu.pl)
+6bone.pl
+art.pl
+mbone.pl
+// Government domains (administered by ippt.gov.pl)
+gov.pl
+uw.gov.pl
+um.gov.pl
+ug.gov.pl
+upow.gov.pl
+starostwo.gov.pl
+so.gov.pl
+sr.gov.pl
+po.gov.pl
+pa.gov.pl
+// other functional domains
+ngo.pl
+irc.pl
+usenet.pl
+// NASK geographical domains : http://www.dns.pl/english/dns-regiony.html
+augustow.pl
+babia-gora.pl
+bedzin.pl
+beskidy.pl
+bialowieza.pl
+bialystok.pl
+bielawa.pl
+bieszczady.pl
+boleslawiec.pl
+bydgoszcz.pl
+bytom.pl
+cieszyn.pl
+czeladz.pl
+czest.pl
+dlugoleka.pl
+elblag.pl
+elk.pl
+glogow.pl
+gniezno.pl
+gorlice.pl
+grajewo.pl
+ilawa.pl
+jaworzno.pl
+jelenia-gora.pl
+jgora.pl
+kalisz.pl
+kazimierz-dolny.pl
+karpacz.pl
+kartuzy.pl
+kaszuby.pl
+katowice.pl
+kepno.pl
+ketrzyn.pl
+klodzko.pl
+kobierzyce.pl
+kolobrzeg.pl
+konin.pl
+konskowola.pl
+kutno.pl
+lapy.pl
+lebork.pl
+legnica.pl
+lezajsk.pl
+limanowa.pl
+lomza.pl
+lowicz.pl
+lubin.pl
+lukow.pl
+malbork.pl
+malopolska.pl
+mazowsze.pl
+mazury.pl
+mielec.pl
+mielno.pl
+mragowo.pl
+naklo.pl
+nowaruda.pl
+nysa.pl
+olawa.pl
+olecko.pl
+olkusz.pl
+olsztyn.pl
+opoczno.pl
+opole.pl
+ostroda.pl
+ostroleka.pl
+ostrowiec.pl
+ostrowwlkp.pl
+pila.pl
+pisz.pl
+podhale.pl
+podlasie.pl
+polkowice.pl
+pomorze.pl
+pomorskie.pl
+prochowice.pl
+pruszkow.pl
+przeworsk.pl
+pulawy.pl
+radom.pl
+rawa-maz.pl
+rybnik.pl
+rzeszow.pl
+sanok.pl
+sejny.pl
+siedlce.pl
+slask.pl
+slupsk.pl
+sosnowiec.pl
+stalowa-wola.pl
+skoczow.pl
+starachowice.pl
+stargard.pl
+suwalki.pl
+swidnica.pl
+swiebodzin.pl
+swinoujscie.pl
+szczecin.pl
+szczytno.pl
+tarnobrzeg.pl
+tgory.pl
+turek.pl
+tychy.pl
+ustka.pl
+walbrzych.pl
+warmia.pl
+warszawa.pl
+waw.pl
+wegrow.pl
+wielun.pl
+wlocl.pl
+wloclawek.pl
+wodzislaw.pl
+wolomin.pl
+wroclaw.pl
+zachpomor.pl
+zagan.pl
+zarow.pl
+zgora.pl
+zgorzelec.pl
+// TASK geographical domains (www.task.gda.pl/uslugi/dns)
+gda.pl
+gdansk.pl
+gdynia.pl
+med.pl
+sopot.pl
+// other geographical domains
+gliwice.pl
+krakow.pl
+poznan.pl
+wroc.pl
+zakopane.pl
+
+// co.pl : Mainseek Sp. z o.o. http://www.co.pl
+co.pl
+
+// pn : http://www.government.pn/PnRegistry/policies.htm
+pn
+gov.pn
+co.pn
+org.pn
+edu.pn
+net.pn
+
+// pr : http://www.nic.pr/index.asp?f=1
+pr
+com.pr
+net.pr
+org.pr
+gov.pr
+edu.pr
+isla.pr
+pro.pr
+biz.pr
+info.pr
+name.pr
+// these aren't mentioned on nic.pr, but on http://en.wikipedia.org/wiki/.pr
+est.pr
+prof.pr
+ac.pr
+
+// pro : http://www.nic.pro/support_faq.htm
+pro
+aca.pro
+bar.pro
+cpa.pro
+jur.pro
+law.pro
+med.pro
+eng.pro
+
+// ps : http://en.wikipedia.org/wiki/.ps
+// http://www.nic.ps/registration/policy.html#reg
+ps
+edu.ps
+gov.ps
+sec.ps
+plo.ps
+com.ps
+org.ps
+net.ps
+
+// pt : http://online.dns.pt/dns/start_dns
+pt
+net.pt
+gov.pt
+org.pt
+edu.pt
+int.pt
+publ.pt
+com.pt
+nome.pt
+
+// pw : http://en.wikipedia.org/wiki/.pw
+pw
+co.pw
+ne.pw
+or.pw
+ed.pw
+go.pw
+belau.pw
+
+// py : http://www.nic.py/faq_a.html#faq_b
+*.py
+
+// qa : http://www.qatar.net.qa/services/virtual.htm
+*.qa
+
+// re : http://www.afnic.re/obtenir/chartes/nommage-re/annexe-descriptifs
+re
+com.re
+asso.re
+nom.re
+
+// ro : http://www.rotld.ro/
+ro
+com.ro
+org.ro
+tm.ro
+nt.ro
+nom.ro
+info.ro
+rec.ro
+arts.ro
+firm.ro
+store.ro
+www.ro
+
+// rs : http://en.wikipedia.org/wiki/.rs
+rs
+co.rs
+org.rs
+edu.rs
+ac.rs
+gov.rs
+in.rs
+
+// ru : http://www.cctld.ru/ru/docs/aktiv_8.php
+// Industry domains
+ru
+ac.ru
+com.ru
+edu.ru
+int.ru
+net.ru
+org.ru
+pp.ru
+// Geographical domains
+adygeya.ru
+altai.ru
+amur.ru
+arkhangelsk.ru
+astrakhan.ru
+bashkiria.ru
+belgorod.ru
+bir.ru
+bryansk.ru
+buryatia.ru
+cbg.ru
+chel.ru
+chelyabinsk.ru
+chita.ru
+chukotka.ru
+chuvashia.ru
+dagestan.ru
+dudinka.ru
+e-burg.ru
+grozny.ru
+irkutsk.ru
+ivanovo.ru
+izhevsk.ru
+jar.ru
+joshkar-ola.ru
+kalmykia.ru
+kaluga.ru
+kamchatka.ru
+karelia.ru
+kazan.ru
+kchr.ru
+kemerovo.ru
+khabarovsk.ru
+khakassia.ru
+khv.ru
+kirov.ru
+koenig.ru
+komi.ru
+kostroma.ru
+krasnoyarsk.ru
+kuban.ru
+kurgan.ru
+kursk.ru
+lipetsk.ru
+magadan.ru
+mari.ru
+mari-el.ru
+marine.ru
+mordovia.ru
+mosreg.ru
+msk.ru
+murmansk.ru
+nalchik.ru
+nnov.ru
+nov.ru
+novosibirsk.ru
+nsk.ru
+omsk.ru
+orenburg.ru
+oryol.ru
+palana.ru
+penza.ru
+perm.ru
+pskov.ru
+ptz.ru
+rnd.ru
+ryazan.ru
+sakhalin.ru
+samara.ru
+saratov.ru
+simbirsk.ru
+smolensk.ru
+spb.ru
+stavropol.ru
+stv.ru
+surgut.ru
+tambov.ru
+tatarstan.ru
+tom.ru
+tomsk.ru
+tsaritsyn.ru
+tsk.ru
+tula.ru
+tuva.ru
+tver.ru
+tyumen.ru
+udm.ru
+udmurtia.ru
+ulan-ude.ru
+vladikavkaz.ru
+vladimir.ru
+vladivostok.ru
+volgograd.ru
+vologda.ru
+voronezh.ru
+vrn.ru
+vyatka.ru
+yakutia.ru
+yamal.ru
+yaroslavl.ru
+yekaterinburg.ru
+yuzhno-sakhalinsk.ru
+// More geographical domains
+amursk.ru
+baikal.ru
+cmw.ru
+fareast.ru
+jamal.ru
+kms.ru
+k-uralsk.ru
+kustanai.ru
+kuzbass.ru
+magnitka.ru
+mytis.ru
+nakhodka.ru
+nkz.ru
+norilsk.ru
+oskol.ru
+pyatigorsk.ru
+rubtsovsk.ru
+snz.ru
+syzran.ru
+vdonsk.ru
+zgrad.ru
+// State domains
+gov.ru
+mil.ru
+// Technical domains
+test.ru
+
+// rw : http://www.nic.rw/cgi-bin/policy.pl
+rw
+gov.rw
+net.rw
+edu.rw
+ac.rw
+com.rw
+co.rw
+int.rw
+mil.rw
+gouv.rw
+
+// sa : http://www.nic.net.sa/
+sa
+com.sa
+net.sa
+org.sa
+gov.sa
+med.sa
+pub.sa
+edu.sa
+sch.sa
+
+// sb : http://www.sbnic.net.sb/
+// Submitted by registry <lee.humphries@telekom.com.sb> 2008-06-08
+sb
+com.sb
+edu.sb
+gov.sb
+net.sb
+org.sb
+
+// sc : http://www.nic.sc/
+sc
+com.sc
+gov.sc
+net.sc
+org.sc
+edu.sc
+
+// sd : http://www.isoc.sd/sudanic.isoc.sd/billing_pricing.htm
+// Submitted by registry <admin@isoc.sd> 2008-06-17
+sd
+com.sd
+net.sd
+org.sd
+edu.sd
+med.sd
+gov.sd
+info.sd
+
+// se : http://en.wikipedia.org/wiki/.se
+// Submitted by registry <Patrik.Wallstrom@iis.se> 2008-06-24
+se
+a.se
+ac.se
+b.se
+bd.se
+brand.se
+c.se
+d.se
+e.se
+f.se
+fh.se
+fhsk.se
+fhv.se
+g.se
+h.se
+i.se
+k.se
+komforb.se
+kommunalforbund.se
+komvux.se
+l.se
+lanbib.se
+m.se
+n.se
+naturbruksgymn.se
+o.se
+org.se
+p.se
+parti.se
+pp.se
+press.se
+r.se
+s.se
+sshn.se
+t.se
+tm.se
+u.se
+w.se
+x.se
+y.se
+z.se
+
+// sg : http://www.nic.net.sg/sub_policies_agreement/2ld.html
+sg
+com.sg
+net.sg
+org.sg
+gov.sg
+edu.sg
+per.sg
+
+// sh : http://www.nic.sh/rules.html
+// list of 2nd level domains ?
+sh
+
+// si : http://en.wikipedia.org/wiki/.si
+si
+
+// sj : No registrations at this time.
+// Submitted by registry <jarle@uninett.no> 2008-06-16
+
+// sk : http://en.wikipedia.org/wiki/.sk
+// list of 2nd level domains ?
+sk
+
+// sl : http://www.nic.sl
+// Submitted by registry <adam@neoip.com> 2008-06-12
+sl
+com.sl
+net.sl
+edu.sl
+gov.sl
+org.sl
+
+// sm : http://en.wikipedia.org/wiki/.sm
+sm
+
+// sn : http://en.wikipedia.org/wiki/.sn
+sn
+art.sn
+com.sn
+edu.sn
+gouv.sn
+org.sn
+perso.sn
+univ.sn
+
+// so : http://www.soregistry.com/
+so
+com.so
+net.so
+org.so
+
+// sr : http://en.wikipedia.org/wiki/.sr
+sr
+
+// st : http://www.nic.st/html/policyrules/
+st
+co.st
+com.st
+consulado.st
+edu.st
+embaixada.st
+gov.st
+mil.st
+net.st
+org.st
+principe.st
+saotome.st
+store.st
+
+// su : http://en.wikipedia.org/wiki/.su
+su
+
+// sv : http://www.svnet.org.sv/svpolicy.html
+*.sv
+
+// sy : http://en.wikipedia.org/wiki/.sy
+// see also: http://www.gobin.info/domainname/sy.doc
+sy
+edu.sy
+gov.sy
+net.sy
+mil.sy
+com.sy
+org.sy
+
+// sz : http://en.wikipedia.org/wiki/.sz
+// http://www.sispa.org.sz/
+sz
+co.sz
+ac.sz
+org.sz
+
+// tc : http://en.wikipedia.org/wiki/.tc
+tc
+
+// td : http://en.wikipedia.org/wiki/.td
+td
+
+// tel: http://en.wikipedia.org/wiki/.tel
+// http://www.telnic.org/
+tel
+
+// tf : http://en.wikipedia.org/wiki/.tf
+tf
+
+// tg : http://en.wikipedia.org/wiki/.tg
+// http://www.nic.tg/nictg/index.php implies no reserved 2nd-level domains,
+// although this contradicts wikipedia.
+tg
+
+// th : http://en.wikipedia.org/wiki/.th
+// Submitted by registry <krit@thains.co.th> 2008-06-17
+th
+ac.th
+co.th
+go.th
+in.th
+mi.th
+net.th
+or.th
+
+// tj : http://www.nic.tj/policy.htm
+tj
+ac.tj
+biz.tj
+co.tj
+com.tj
+edu.tj
+go.tj
+gov.tj
+int.tj
+mil.tj
+name.tj
+net.tj
+nic.tj
+org.tj
+test.tj
+web.tj
+
+// tk : http://en.wikipedia.org/wiki/.tk
+tk
+
+// tl : http://en.wikipedia.org/wiki/.tl
+tl
+gov.tl
+
+// tm : http://www.nic.tm/rules.html
+// list of 2nd level tlds ?
+tm
+
+// tn : http://en.wikipedia.org/wiki/.tn
+// http://whois.ati.tn/
+tn
+com.tn
+ens.tn
+fin.tn
+gov.tn
+ind.tn
+intl.tn
+nat.tn
+net.tn
+org.tn
+info.tn
+perso.tn
+tourism.tn
+edunet.tn
+rnrt.tn
+rns.tn
+rnu.tn
+mincom.tn
+agrinet.tn
+defense.tn
+turen.tn
+
+// to : http://en.wikipedia.org/wiki/.to
+// Submitted by registry <egullich@colo.to> 2008-06-17
+to
+com.to
+gov.to
+net.to
+org.to
+edu.to
+mil.to
+
+// tr : http://en.wikipedia.org/wiki/.tr
+*.tr
+!nic.tr
+// Used by government in the TRNC
+// http://en.wikipedia.org/wiki/.nc.tr
+gov.nc.tr
+
+// travel : http://en.wikipedia.org/wiki/.travel
+travel
+
+// tt : http://www.nic.tt/
+tt
+co.tt
+com.tt
+org.tt
+net.tt
+biz.tt
+info.tt
+pro.tt
+int.tt
+coop.tt
+jobs.tt
+mobi.tt
+travel.tt
+museum.tt
+aero.tt
+name.tt
+gov.tt
+edu.tt
+
+// tv : http://en.wikipedia.org/wiki/.tv
+// Not listing any 2LDs as reserved since none seem to exist in practice,
+// Wikipedia notwithstanding.
+tv
+
+// tw : http://en.wikipedia.org/wiki/.tw
+tw
+edu.tw
+gov.tw
+mil.tw
+com.tw
+net.tw
+org.tw
+idv.tw
+game.tw
+ebiz.tw
+club.tw
+網路.tw
+組織.tw
+商業.tw
+
+// tz : http://en.wikipedia.org/wiki/.tz
+// Submitted by registry <randy@psg.com> 2008-06-17
+// Updated from http://www.tznic.or.tz/index.php/domains.html 2010-10-25
+ac.tz
+co.tz
+go.tz
+mil.tz
+ne.tz
+or.tz
+sc.tz
+
+// ua : http://www.nic.net.ua/
+ua
+com.ua
+edu.ua
+gov.ua
+in.ua
+net.ua
+org.ua
+// ua geo-names
+cherkassy.ua
+chernigov.ua
+chernovtsy.ua
+ck.ua
+cn.ua
+crimea.ua
+cv.ua
+dn.ua
+dnepropetrovsk.ua
+donetsk.ua
+dp.ua
+if.ua
+ivano-frankivsk.ua
+kh.ua
+kharkov.ua
+kherson.ua
+khmelnitskiy.ua
+kiev.ua
+kirovograd.ua
+km.ua
+kr.ua
+ks.ua
+kv.ua
+lg.ua
+lugansk.ua
+lutsk.ua
+lviv.ua
+mk.ua
+nikolaev.ua
+od.ua
+odessa.ua
+pl.ua
+poltava.ua
+rovno.ua
+rv.ua
+sebastopol.ua
+sumy.ua
+te.ua
+ternopil.ua
+uzhgorod.ua
+vinnica.ua
+vn.ua
+zaporizhzhe.ua
+zp.ua
+zhitomir.ua
+zt.ua
+
+// ug : http://www.registry.co.ug/
+ug
+co.ug
+ac.ug
+sc.ug
+go.ug
+ne.ug
+or.ug
+
+// uk : http://en.wikipedia.org/wiki/.uk
+*.uk
+*.sch.uk
+!bl.uk
+!british-library.uk
+!icnet.uk
+!jet.uk
+!mod.uk
+!nel.uk
+!nhs.uk
+!nic.uk
+!nls.uk
+!national-library-scotland.uk
+!parliament.uk
+!police.uk
+
+// us : http://en.wikipedia.org/wiki/.us
+us
+dni.us
+fed.us
+isa.us
+kids.us
+nsn.us
+// us geographic names
+ak.us
+al.us
+ar.us
+as.us
+az.us
+ca.us
+co.us
+ct.us
+dc.us
+de.us
+fl.us
+ga.us
+gu.us
+hi.us
+ia.us
+id.us
+il.us
+in.us
+ks.us
+ky.us
+la.us
+ma.us
+md.us
+me.us
+mi.us
+mn.us
+mo.us
+ms.us
+mt.us
+nc.us
+nd.us
+ne.us
+nh.us
+nj.us
+nm.us
+nv.us
+ny.us
+oh.us
+ok.us
+or.us
+pa.us
+pr.us
+ri.us
+sc.us
+sd.us
+tn.us
+tx.us
+ut.us
+vi.us
+vt.us
+va.us
+wa.us
+wi.us
+wv.us
+wy.us
+// The registrar notes several more specific domains available in each state,
+// such as state.*.us, dst.*.us, etc., but resolution of these is somewhat
+// haphazard; in some states these domains resolve as addresses, while in others
+// only subdomains are available, or even nothing at all. We include the
+// most common ones where it's clear that different sites are different
+// entities.
+k12.ak.us
+k12.al.us
+k12.ar.us
+k12.as.us
+k12.az.us
+k12.ca.us
+k12.co.us
+k12.ct.us
+k12.dc.us
+k12.de.us
+k12.fl.us
+k12.ga.us
+k12.gu.us
+// k12.hi.us  Hawaii has a state-wide DOE login: bug 614565
+k12.ia.us
+k12.id.us
+k12.il.us
+k12.in.us
+k12.ks.us
+k12.ky.us
+k12.la.us
+k12.ma.us
+k12.md.us
+k12.me.us
+k12.mi.us
+k12.mn.us
+k12.mo.us
+k12.ms.us
+k12.mt.us
+k12.nc.us
+k12.nd.us
+k12.ne.us
+k12.nh.us
+k12.nj.us
+k12.nm.us
+k12.nv.us
+k12.ny.us
+k12.oh.us
+k12.ok.us
+k12.or.us
+k12.pa.us
+k12.pr.us
+k12.ri.us
+k12.sc.us
+k12.sd.us
+k12.tn.us
+k12.tx.us
+k12.ut.us
+k12.vi.us
+k12.vt.us
+k12.va.us
+k12.wa.us
+k12.wi.us
+k12.wv.us
+k12.wy.us
+
+cc.ak.us
+cc.al.us
+cc.ar.us
+cc.as.us
+cc.az.us
+cc.ca.us
+cc.co.us
+cc.ct.us
+cc.dc.us
+cc.de.us
+cc.fl.us
+cc.ga.us
+cc.gu.us
+cc.hi.us
+cc.ia.us
+cc.id.us
+cc.il.us
+cc.in.us
+cc.ks.us
+cc.ky.us
+cc.la.us
+cc.ma.us
+cc.md.us
+cc.me.us
+cc.mi.us
+cc.mn.us
+cc.mo.us
+cc.ms.us
+cc.mt.us
+cc.nc.us
+cc.nd.us
+cc.ne.us
+cc.nh.us
+cc.nj.us
+cc.nm.us
+cc.nv.us
+cc.ny.us
+cc.oh.us
+cc.ok.us
+cc.or.us
+cc.pa.us
+cc.pr.us
+cc.ri.us
+cc.sc.us
+cc.sd.us
+cc.tn.us
+cc.tx.us
+cc.ut.us
+cc.vi.us
+cc.vt.us
+cc.va.us
+cc.wa.us
+cc.wi.us
+cc.wv.us
+cc.wy.us
+
+lib.ak.us
+lib.al.us
+lib.ar.us
+lib.as.us
+lib.az.us
+lib.ca.us
+lib.co.us
+lib.ct.us
+lib.dc.us
+lib.de.us
+lib.fl.us
+lib.ga.us
+lib.gu.us
+lib.hi.us
+lib.ia.us
+lib.id.us
+lib.il.us
+lib.in.us
+lib.ks.us
+lib.ky.us
+lib.la.us
+lib.ma.us
+lib.md.us
+lib.me.us
+lib.mi.us
+lib.mn.us
+lib.mo.us
+lib.ms.us
+lib.mt.us
+lib.nc.us
+lib.nd.us
+lib.ne.us
+lib.nh.us
+lib.nj.us
+lib.nm.us
+lib.nv.us
+lib.ny.us
+lib.oh.us
+lib.ok.us
+lib.or.us
+lib.pa.us
+lib.pr.us
+lib.ri.us
+lib.sc.us
+lib.sd.us
+lib.tn.us
+lib.tx.us
+lib.ut.us
+lib.vi.us
+lib.vt.us
+lib.va.us
+lib.wa.us
+lib.wi.us
+lib.wv.us
+lib.wy.us
+
+// k12.ma.us contains school districts in Massachusetts. The 4LDs are 
+//  managed indepedently except for private (PVT), charter (CHTR) and
+//  parochial (PAROCH) schools.  Those are delegated dorectly to the 
+//  5LD operators.   <k12-ma-hostmaster _ at _ rsuc.gweep.net>
+pvt.k12.ma.us
+chtr.k12.ma.us
+paroch.k12.ma.us
+
+// uy : http://www.antel.com.uy/
+*.uy
+
+// uz : http://www.reg.uz/registerr.html
+// are there other 2nd level tlds ?
+uz
+com.uz
+co.uz
+
+// va : http://en.wikipedia.org/wiki/.va
+va
+
+// vc : http://en.wikipedia.org/wiki/.vc
+// Submitted by registry <kshah@ca.afilias.info> 2008-06-13
+vc
+com.vc
+net.vc
+org.vc
+gov.vc
+mil.vc
+edu.vc
+
+// ve : http://registro.nic.ve/nicve/registro/index.html
+*.ve
+
+// vg : http://en.wikipedia.org/wiki/.vg
+vg
+
+// vi : http://www.nic.vi/newdomainform.htm
+// http://www.nic.vi/Domain_Rules/body_domain_rules.html indicates some other
+// TLDs are "reserved", such as edu.vi and gov.vi, but doesn't actually say they
+// are available for registration (which they do not seem to be).
+vi
+co.vi
+com.vi
+k12.vi
+net.vi
+org.vi
+
+// vn : https://www.dot.vn/vnnic/vnnic/domainregistration.jsp
+vn
+com.vn
+net.vn
+org.vn
+edu.vn
+gov.vn
+int.vn
+ac.vn
+biz.vn
+info.vn
+name.vn
+pro.vn
+health.vn
+
+// vu : http://en.wikipedia.org/wiki/.vu
+// list of 2nd level tlds ?
+vu
+
+// ws : http://en.wikipedia.org/wiki/.ws
+// http://samoanic.ws/index.dhtml
+ws
+com.ws
+net.ws
+org.ws
+gov.ws
+edu.ws
+
+// IDN ccTLDs
+// Please sort by ISO 3166 ccTLD, then punicode string
+// when submitting patches and follow this format:
+// <Punicode> ("<english word>" <language>) : <ISO 3166 ccTLD>
+// [optional sponsoring org]
+// <URL>
+
+// xn--mgbaam7a8h ("Emerat" Arabic) : AE
+//http://nic.ae/english/arabicdomain/rules.jsp
+امارات
+
+// xn--54b7fta0cc ("Bangla" Bangla) : BD  
+বাংলা
+
+// xn--fiqs8s ("China" Chinese-Han-Simplified <.Zhonggou>) : CN 
+// CNNIC
+// http://cnnic.cn/html/Dir/2005/10/11/3218.htm
+中国
+
+// xn--fiqz9s ("China" Chinese-Han-Traditional <.Zhonggou>) : CN
+// CNNIC
+// http://cnnic.cn/html/Dir/2005/10/11/3218.htm
+中國
+
+// xn--lgbbat1ad8j ("Algeria / Al Jazair" Arabic) : DZ  
+الجزائر
+
+// xn--wgbh1c ("Egypt" Arabic .masr) : EG
+// http://www.dotmasr.eg/
+مصر
+
+// xn--node ("ge" Georgian (Mkhedruli)) : GE  
+გე
+
+// xn--j6w193g ("Hong Kong" Chinese-Han) : HK
+// https://www2.hkirc.hk/register/rules.jsp
+香港
+
+// xn--h2brj9c ("Bharat" Devanagari) : IN  
+// India
+भारत
+
+// xn--mgbbh1a71e ("Bharat" Arabic) : IN  
+// India
+بھارت
+
+// xn--fpcrj9c3d ("Bharat" Telugu) : IN  
+// India
+భారత్
+
+// xn--gecrj9c ("Bharat" Gujarati) : IN  
+// India
+ભારત
+
+// xn--s9brj9c ("Bharat" Gurmukhi) : IN  
+// India
+ਭਾਰਤ
+
+// xn--45brj9c ("Bharat" Bengali) : IN  
+// India
+ভারত
+
+// xn--xkc2dl3a5ee0h ("India" Tamil) : IN  
+// India
+இந்தியா
+
+// xn--mgba3a4f16a ("Iran" Persian) : IR  
+ایران
+
+// xn--mgba3a4fra ("Iran" Arabic) : IR  
+ايران
+
+//xn--mgbayh7gpa ("al-Ordon" Arabic) JO
+//National Information Technology Center (NITC) 
+//Royal Scientific Society, Al-Jubeiha
+الاردن
+
+// xn--3e0b707e ("Republic of Korea" Hangul) : KR  
+한국
+
+// xn--fzc2c9e2c ("Lanka" Sinhalese-Sinhala) : LK
+// http://nic.lk
+ලංකා
+
+// xn--xkc2al3hye2a ("Ilangai" Tamil) : LK
+// http://nic.lk
+இலங்கை
+
+// xn--mgbc0a9azcg ("Morocco / al-Maghrib" Arabic) : MA  
+المغرب
+
+// xn--mgb9awbf ("Oman" Arabic) : OM  
+عمان
+
+// xn--ygbi2ammx ("Falasteen" Arabic) : PS
+// The Palestinian National Internet Naming Authority (PNINA)
+// http://www.pnina.ps
+فلسطين
+
+// xn--90a3ac ("srb" Cyrillic) : RS  
+срб
+
+// xn--p1ai ("rf" Russian-Cyrillic) : RU
+// http://www.cctld.ru/en/docs/rulesrf.php
+рф
+
+// xn--wgbl6a ("Qatar" Arabic) : QA
+// http://www.ict.gov.qa/
+قطر
+
+// xn--mgberp4a5d4ar ("AlSaudiah" Arabic) : SA
+// http://www.nic.net.sa/
+السعودية
+
+// xn--mgberp4a5d4a87g ("AlSaudiah" Arabic) variant : SA  
+السعودیة
+
+// xn--mgbqly7c0a67fbc ("AlSaudiah" Arabic) variant : SA  
+السعودیۃ
+
+// xn--mgbqly7cvafr ("AlSaudiah" Arabic) variant : SA  
+السعوديه
+
+// xn--ogbpf8fl ("Syria" Arabic) : SY  
+سورية
+
+// xn--mgbtf8fl ("Syria" Arabic) variant : SY  
+سوريا
+
+// xn--yfro4i67o Singapore ("Singapore" Chinese-Han) : SG
+新加坡
+
+// xn--clchc0ea0b2g2a9gcd ("Singapore" Tamil) : SG
+சிங்கப்பூர்
+
+// xn--o3cw4h ("Thai" Thai) : TH
+// http://www.thnic.co.th
+ไทย
+
+// xn--pgbs0dh ("Tunis") : TN
+// http://nic.tn
+تونس
+
+// xn--kpry57d ("Taiwan" Chinese-Han-Traditional) : TW
+// http://www.twnic.net/english/dn/dn_07a.htm
+台灣
+
+// xn--kprw13d ("Taiwan" Chinese-Han-Simplified) : TW
+// http://www.twnic.net/english/dn/dn_07a.htm
+台湾
+
+// xn--nnx388a ("Taiwan") variant : TW  
+臺灣
+
+// xn--j1amh ("ukr" Cyrillic) : UA  
+укр
+
+// xn--mgb2ddes ("AlYemen" Arabic) : YE  
+اليمن
+
+// xxx : http://icmregistry.com
+xxx
+
+// ye : http://www.y.net.ye/services/domain_name.htm
+*.ye
+
+// yu : http://www.nic.yu/pravilnik-e.html
+*.yu
+
+// za : http://www.zadna.org.za/slds.html
+*.za
+
+// zm : http://en.wikipedia.org/wiki/.zm
+*.zm
+
+// zw : http://en.wikipedia.org/wiki/.zw
+*.zw
+
+// DynDNS.com Dynamic DNS zones : http://www.dyndns.com/services/dns/dyndns/
+dyndns-at-home.com
+dyndns-at-work.com
+dyndns-blog.com
+dyndns-free.com
+dyndns-home.com
+dyndns-ip.com
+dyndns-mail.com
+dyndns-office.com
+dyndns-pics.com
+dyndns-remote.com
+dyndns-server.com
+dyndns-web.com
+dyndns-wiki.com
+dyndns-work.com
+dyndns.biz
+dyndns.info
+dyndns.org
+dyndns.tv
+at-band-camp.net
+ath.cx
+barrel-of-knowledge.info
+barrell-of-knowledge.info
+better-than.tv
+blogdns.com
+blogdns.net
+blogdns.org
+blogsite.org
+boldlygoingnowhere.org
+broke-it.net
+buyshouses.net
+cechire.com
+dnsalias.com
+dnsalias.net
+dnsalias.org
+dnsdojo.com
+dnsdojo.net
+dnsdojo.org
+does-it.net
+doesntexist.com
+doesntexist.org
+dontexist.com
+dontexist.net
+dontexist.org
+doomdns.com
+doomdns.org
+dvrdns.org
+dyn-o-saur.com
+dynalias.com
+dynalias.net
+dynalias.org
+dynathome.net
+dyndns.ws
+endofinternet.net
+endofinternet.org
+endoftheinternet.org
+est-a-la-maison.com
+est-a-la-masion.com
+est-le-patron.com
+est-mon-blogueur.com
+for-better.biz
+for-more.biz
+for-our.info
+for-some.biz
+for-the.biz
+forgot.her.name
+forgot.his.name
+from-ak.com
+from-al.com
+from-ar.com
+from-az.net
+from-ca.com
+from-co.net
+from-ct.com
+from-dc.com
+from-de.com
+from-fl.com
+from-ga.com
+from-hi.com
+from-ia.com
+from-id.com
+from-il.com
+from-in.com
+from-ks.com
+from-ky.com
+from-la.net
+from-ma.com
+from-md.com
+from-me.org
+from-mi.com
+from-mn.com
+from-mo.com
+from-ms.com
+from-mt.com
+from-nc.com
+from-nd.com
+from-ne.com
+from-nh.com
+from-nj.com
+from-nm.com
+from-nv.com
+from-ny.net
+from-oh.com
+from-ok.com
+from-or.com
+from-pa.com
+from-pr.com
+from-ri.com
+from-sc.com
+from-sd.com
+from-tn.com
+from-tx.com
+from-ut.com
+from-va.com
+from-vt.com
+from-wa.com
+from-wi.com
+from-wv.com
+from-wy.com
+ftpaccess.cc
+fuettertdasnetz.de
+game-host.org
+game-server.cc
+getmyip.com
+gets-it.net
+go.dyndns.org
+gotdns.com
+gotdns.org
+groks-the.info
+groks-this.info
+ham-radio-op.net
+here-for-more.info
+hobby-site.com
+hobby-site.org
+home.dyndns.org
+homedns.org
+homeftp.net
+homeftp.org
+homeip.net
+homelinux.com
+homelinux.net
+homelinux.org
+homeunix.com
+homeunix.net
+homeunix.org
+iamallama.com
+in-the-band.net
+is-a-anarchist.com
+is-a-blogger.com
+is-a-bookkeeper.com
+is-a-bruinsfan.org
+is-a-bulls-fan.com
+is-a-candidate.org
+is-a-caterer.com
+is-a-celticsfan.org
+is-a-chef.com
+is-a-chef.net
+is-a-chef.org
+is-a-conservative.com
+is-a-cpa.com
+is-a-cubicle-slave.com
+is-a-democrat.com
+is-a-designer.com
+is-a-doctor.com
+is-a-financialadvisor.com
+is-a-geek.com
+is-a-geek.net
+is-a-geek.org
+is-a-green.com
+is-a-guru.com
+is-a-hard-worker.com
+is-a-hunter.com
+is-a-knight.org
+is-a-landscaper.com
+is-a-lawyer.com
+is-a-liberal.com
+is-a-libertarian.com
+is-a-linux-user.org
+is-a-llama.com
+is-a-musician.com
+is-a-nascarfan.com
+is-a-nurse.com
+is-a-painter.com
+is-a-patsfan.org
+is-a-personaltrainer.com
+is-a-photographer.com
+is-a-player.com
+is-a-republican.com
+is-a-rockstar.com
+is-a-socialist.com
+is-a-soxfan.org
+is-a-student.com
+is-a-teacher.com
+is-a-techie.com
+is-a-therapist.com
+is-an-accountant.com
+is-an-actor.com
+is-an-actress.com
+is-an-anarchist.com
+is-an-artist.com
+is-an-engineer.com
+is-an-entertainer.com
+is-by.us
+is-certified.com
+is-found.org
+is-gone.com
+is-into-anime.com
+is-into-cars.com
+is-into-cartoons.com
+is-into-games.com
+is-leet.com
+is-lost.org
+is-not-certified.com
+is-saved.org
+is-slick.com
+is-uberleet.com
+is-very-bad.org
+is-very-evil.org
+is-very-good.org
+is-very-nice.org
+is-very-sweet.org
+is-with-theband.com
+isa-geek.com
+isa-geek.net
+isa-geek.org
+isa-hockeynut.com
+issmarterthanyou.com
+isteingeek.de
+istmein.de
+kicks-ass.net
+kicks-ass.org
+knowsitall.info
+land-4-sale.us
+lebtimnetz.de
+leitungsen.de
+likes-pie.com
+likescandy.com
+merseine.nu
+mine.nu
+misconfused.org
+mypets.ws
+myphotos.cc
+neat-url.com
+office-on-the.net
+on-the-web.tv
+podzone.net
+podzone.org
+readmyblog.org
+saves-the-whales.com
+scrapper-site.net
+scrapping.cc
+selfip.biz
+selfip.com
+selfip.info
+selfip.net
+selfip.org
+sells-for-less.com
+sells-for-u.com
+sells-it.net
+sellsyourhome.org
+servebbs.com
+servebbs.net
+servebbs.org
+serveftp.net
+serveftp.org
+servegame.org
+shacknet.nu
+simple-url.com
+space-to-rent.com
+stuff-4-sale.org
+stuff-4-sale.us
+teaches-yoga.com
+thruhere.net
+traeumtgerade.de
+webhop.biz
+webhop.info
+webhop.net
+webhop.org
+worse-than.tv
+writesthisblog.com
index d0bda6d12efb036b75920bfeaf273411f8124d62..16bc696e0f34dc92525f4a8de2b87d091f0b1870 100644 (file)
Binary files a/etc/spook.lines and b/etc/spook.lines differ
index 0021d5800733ff0f692616a81e95694daad4ec91..397228ea0359054a3e6dfa5e5537bdb9e54c381e 100644 (file)
@@ -35,6 +35,7 @@
    `(compilation-error ((,class (:foreground "Red1"))))
    `(compilation-info ((,class (:weight normal :foreground "LightSkyBlue"))))
    `(compilation-line-number ((,class (:foreground "LightGreen"))))
+   `(compilation-mode-line-exit ((,class (:foreground "blue4"))))
    `(cperl-array-face ((,class (:foreground "yellow2"))))
    `(cperl-hash-face ((,class (:foreground "coral1"))))
    `(cursor ((,class (:background "green"))))
index d09c550b0b68d4b4665c637c73c4e9bf7377f8f2..bab741372e7aa802148cfcec867c44b0470d1ee5 100644 (file)
@@ -307,7 +307,7 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(org-agenda-structure ((t (:foreground "LightSkyBlue"))))
  '(org-archived ((t (:foreground "grey70"))))
  '(org-code ((t (:foreground "grey70"))))
- '(org-column ((t (:background "grey30" :slant normal :weight normal :height 81 :family "unknown-DejaVu Sans Mono"))))
+ '(org-column ((t (:background "grey30" :slant normal :weight normal :height 81))))
  '(org-column-title ((t (:bold t :background "grey30" :underline t :weight bold))))
  '(org-date ((t (:foreground "Cyan" :underline t))))
  '(org-done ((t (:bold t :foreground "PaleGreen" :weight bold))))
@@ -352,10 +352,10 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(CUA-global-mark-face ((t (:background "cyan" :foreground "black"))))
  '(CUA-rectangle-face ((t (:background "maroon" :foreground "white"))))
  '(CUA-rectangle-noselect-face ((t (:background "dimgray" :foreground "white"))))
- '(Info-title-1-face ((t (:bold t :weight bold :family "helv" :height 1.728))))
- '(Info-title-2-face ((t (:bold t :family "helv" :weight bold :height 1.44))))
- '(Info-title-3-face ((t (:bold t :weight bold :family "helv" :height 1.2))))
- '(Info-title-4-face ((t (:bold t :family "helv" :weight bold))))
+ '(Info-title-1-face ((t (:bold t :weight bold :height 1.728))))
+ '(Info-title-2-face ((t (:bold t :weight bold :height 1.44))))
+ '(Info-title-3-face ((t (:bold t :weight bold :height 1.2))))
+ '(Info-title-4-face ((t (:bold t :weight bold))))
  '(align-highlight-nochange-face ((t (:background "SkyBlue4"))))
 
  '(antlr-font-lock-keyword-face ((t (:foreground "SteelBlue")))) ;%
@@ -383,7 +383,7 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(change-log-conditionals-face ((t (:foreground "Aquamarine"))))
  '(change-log-date-face ((t (:italic t :slant oblique :foreground "BurlyWood"))))
  '(change-log-email-face ((t (:foreground "Aquamarine"))))
- '(change-log-file-face ((t (:bold t :family "Verdana" :weight bold :foreground "LightSkyBlue" :height 0.9))))
+ '(change-log-file-face ((t (:bold t :weight bold :foreground "LightSkyBlue" :height 0.9))))
  '(change-log-function-face ((t (:foreground "Aquamarine"))))
  '(change-log-list-face ((t (:foreground "LightSkyBlue"))))
  '(change-log-name-face ((t (:bold t :weight bold :foreground "Gold"))))
@@ -397,10 +397,9 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(compilation-message-face  ((t (:underline t))))
  '(compilation-warning ((t (:bold t :foreground "Orange" :weight bold))))
  '(compilation-warning-face ((t (:bold t :foreground "Orange" :weight bold))))
- '(completions-common-part ((t (:family "unknown-DejaVu Sans Mono"
-                                        :width normal :weight normal
-                                        :slant normal :foreground "WhiteSmoke"
-                                        :background "black" :height 81))))
+ '(completions-common-part ((t (:width normal :weight normal
+                                :slant normal :foreground "WhiteSmoke"
+                               :background "black" :height 81))))
  '(completions-first-difference ((t (:bold t :weight bold))))
 
  '(css-selector ((t (:foreground "LightSteelBlue"))))
@@ -415,9 +414,9 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(custom-changed-face ((t (:foreground "wheat" :background "blue"))))
  '(custom-comment-face ((t (:background "dim gray"))))
  '(custom-comment-tag-face ((t (:foreground "gray80"))))
- '(custom-face-tag-face ((t (:bold t :family "helv" :weight bold :height 1.1))))
- '(custom-group-tag-face ((t (:bold t :family "helv" :foreground "light blue" :weight bold :height 1.1))))
- '(custom-group-tag-face-1 ((t (:bold t :family "helv" :foreground "pink" :weight bold :height 1.1))))
+ '(custom-face-tag-face ((t (:bold t :weight bold :height 1.1))))
+ '(custom-group-tag-face ((t (:bold t :foreground "light blue" :weight bold :height 1.1))))
+ '(custom-group-tag-face-1 ((t (:bold t :foreground "pink" :weight bold :height 1.1))))
  '(custom-invalid-face ((t (:background "red" :foreground "yellow"))))
  '(custom-modified-face ((t (:background "blue" :foreground "white"))))
  '(custom-rogue-face ((t (:background "black" :foreground "pink"))))
@@ -428,9 +427,8 @@ jarring angry fruit salad look to reduce eye fatigue.")
                                           :background "lightgrey"
                                           :foreground "black"
                                           :box '(:line-width 2 :style released-button)))))
- '(custom-variable-tag-face ((t (:bold t :family "helv"
-                                       :foreground "light blue"
-                                       :weight bold :height 1.2))))
+ '(custom-variable-tag-face ((t (:bold t :foreground "light blue"
+                                         :weight bold :height 1.2))))
 
  '(diary ((t (:foreground "IndianRed"))))
  '(diary-anniversary ((t (:foreground "Cyan1"))))
@@ -505,7 +503,6 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(excerpt ((t (:italic t))))
  '(file-name-shadow ((t (:foreground "grey70"))))
  '(fixed ((t (:bold t))))
- '(fixed-pitch ((t (:family "courier"))))
  '(flyspell-duplicate-face ((t (:foreground "IndianRed" :bold t :underline t))))
  '(flyspell-incorrect-face ((t (:foreground "Pink" :bold t :underline t))))
 
@@ -543,7 +540,7 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(ido-only-match ((t (:foreground "ForestGreen"))))
  '(ido-subdir ((t (:foreground "red1"))))
  '(info-menu-5 ((t (:underline t))))
- '(info-menu-header ((t (:bold t :family "helv" :weight bold))))
+ '(info-menu-header ((t (:bold t :weight bold))))
  '(info-node ((t (:bold t :italic t :foreground "yellow"))))
  '(info-node ((t (:italic t :bold t :foreground "white" :slant italic :weight bold))))
  '(info-xref ((t (:bold t :foreground "DodgerBlue1"))))
@@ -638,10 +635,9 @@ jarring angry fruit salad look to reduce eye fatigue.")
  '(table-cell ((t (:background "blue1" :foreground "gray90"))))
 
  '(tool-bar ((t (:background "grey75" :foreground "black" :box (:line-width 1 :style released-button)))))
- '(tooltip ((t (:family "helv" :background "lightyellow" :foreground "black"))))
+ '(tooltip ((t (:background "lightyellow" :foreground "black"))))
  '(trailing-whitespace ((t (:background "red1"))))
  '(underline ((t (:underline t))))
- '(variable-pitch ((t (:family "helv"))))
  '(vcursor ((t (:foreground "blue" :background "cyan" :underline t))))
  '(vertical-border ((t (:background "dim gray"))))
  '(vhdl-font-lock-attribute-face ((t (:foreground "Orchid"))))
index 27a8f1868b4f1efb6d134f65a162c0eda7f32d49..d48bf4e4ea9fab1cd8fb58fb76a9a4dab909fecc 100644 (file)
@@ -72,6 +72,9 @@ Semantic, and Ansi-Color faces are included.")
    `(mode-line-inactive ((,class
                          (:box (:line-width -1 :style released-button)
                           :background ,alum-5 :foreground ,alum-1))))
+   `(compilation-mode-line-fail ((,class (:foreground ,red-3))))
+   `(compilation-mode-line-run  ((,class (:foreground ,orange-3))))
+   `(compilation-mode-line-exit ((,class (:foreground ,cham-3))))
    ;; Escape and prompt faces
    `(minibuffer-prompt ((,class (:foreground ,cham-0))))
    `(escape-glyph ((,class (:foreground ,butter-3))))
index 85db38a9e5af2cd218767d373517773ef4210e44..a551ab8722ff5dc95813bc49a3ec0c0c0c880764 100644 (file)
@@ -26,6 +26,9 @@ Used and created by Tassilo Horn.")
 (custom-theme-set-faces
  'tsdh-dark
  '(default ((t (:background "gray20" :foreground "white smoke"))))
+ '(compilation-mode-line-fail ((t (:foreground "red"))))
+ '(compilation-mode-line-run  ((t (:foreground "dark orange"))))
+ '(compilation-mode-line-exit ((t (:foreground "sea green"))))
  '(diff-added ((t (:inherit diff-changed :background "dark green"))))
  '(diff-changed ((t (:background "midnight blue"))))
  '(diff-indicator-added ((t (:inherit diff-indicator-changed))))
@@ -40,7 +43,7 @@ Used and created by Tassilo Horn.")
  '(message-header-subject ((t (:foreground "SkyBlue"))))
  '(minibuffer-prompt ((t (:background "yellow" :foreground "medium blue" :box (:line-width -1 :color "red" :style released-button) :weight bold))))
  '(mode-line ((t (:box (:line-width -1 :color "red" :style released-button) :family "DejaVu Sans"))))
- '(mode-line-inactive ((t (:inherit mode-line :foreground "dim gray"))))
+ '(mode-line-inactive ((t (:inherit mode-line :foreground "gray"))))
  '(org-agenda-date ((t (:inherit org-agenda-structure))))
  '(org-agenda-date-today ((t (:inherit org-agenda-date :underline t))))
  '(org-agenda-date-weekend ((t (:inherit org-agenda-date :foreground "dark green"))))
index 113fbae7b6a6d745a513ef2b5cfca7467479cfa7..423605e4bbdb779cb9b739ef3f9947dcef671ff2 100644 (file)
@@ -33,6 +33,10 @@ of green, brown, and blue.")
    `(error ((,class (:foreground "salmon1"))))
    `(warning ((,class (:foreground "orange"))))
    `(success ((,class (:foreground "yellow green"))))
+   ;; Compilation faces
+   `(compilation-mode-line-fail ((,class (:foreground "dark green"))))
+   `(compilation-mode-line-run  ((,class (:foreground "dark goldenrod"))))
+   `(compilation-mode-line-exit ((,class (:foreground "SpringGreen4"))))
    ;; Highlighting faces
    `(highlight ((,class (:foreground "white" :background "dark green"))))
    `(region ((,class (:foreground "white" :background "dark green"))))
index ccd438ad629a7c2a87b79a26cab919d764e8097d..b74d1421ee6a3a50380faa2006031b93eb4cc1cd 100644 (file)
@@ -16,7 +16,7 @@ The characters ">>" at the left margin indicate directions for you to
 try using a command.  For instance:
 <<Blank lines inserted around following line by help-with-tutorial>>
 [Middle of page left blank for didactic purposes.   Text continues below]
->>  Now type C-v (View next screen) to move to the next screen.
+>> Now type C-v (View next screen) to move to the next screen.
        (go ahead, do it by holding down the CONTROL key while typing v).
        From now on, you should do this again whenever you finish
        reading the screen.
@@ -30,7 +30,7 @@ to place in the text.  You already know how to move forward one screen,
 with C-v.  To move backwards one screen, type M-v (hold down the META key
 and type v, or type <ESC>v if you do not have a META, EDIT, or ALT key).
 
->>  Try typing M-v and then C-v, a few times.
+>> Try typing M-v and then C-v, a few times.
 
 
 * SUMMARY
@@ -209,12 +209,12 @@ prefix argument, regardless of its value, makes the command do
 something different.
 
 C-v and M-v are another kind of exception.  When given an argument,
-they scroll the screen up or down by that many lines, rather than by a
-screenful.  For example, C-u 8 C-v scrolls the screen by 8 lines.
+they scroll the text up or down by that many lines, rather than by a
+screenful.  For example, C-u 8 C-v scrolls by 8 lines.
 
 >> Try typing C-u 8 C-v now.
 
-This should have scrolled the screen up by 8 lines.  If you would like
+This should have scrolled the text up by 8 lines.  If you would like
 to scroll it down again, you can give an argument to M-v.
 
 If you are using a graphical display, such as X or MS-Windows, there
@@ -281,8 +281,6 @@ other windows.
 
 >> Type C-x 1 and see the documentation listing window disappear.
 
-This command is unlike the other commands you have learned in that it
-consists of two characters.  It starts with the character CONTROL-x.
 There is a whole series of commands that start with CONTROL-x; many of
 them have to do with windows, files, buffers, and related things.
 These commands are two, three or four characters long.
@@ -337,7 +335,7 @@ Remember that most Emacs commands can be given a repeat count;
 this includes text characters.  Repeating a text character inserts
 it several times.
 
->>  Try that now -- type C-u 8 * to insert ********.
+>> Try that now -- type C-u 8 * to insert ********.
 
 You've now learned the most basic way of typing something in
 Emacs and correcting errors.  You can delete by words or lines
@@ -522,11 +520,8 @@ command
 This copies the text within Emacs into the file.  The first time you
 do this, Emacs renames the original file to a new name so that it is
 not lost.  The new name is made by adding "~" to the end of the
-original file's name.
-
-When saving is finished, Emacs displays the name of the file written.
-You should save fairly often, so that you will not lose very much
-work if the system should crash (see the section "Auto Save" below).
+original file's name.  When saving is finished, Emacs displays the
+name of the file written.
 
 >> Type C-x C-s TUTORIAL <Return>.
    This should save this tutorial to a file named TUTORIAL, and show
@@ -534,11 +529,11 @@ work if the system should crash (see the section "Auto Save" below).
 
 You can find an existing file, to view it or edit it.  You can also
 find a file which does not already exist.  This is the way to create a
-file with Emacs: find the file, which will start out empty, and then
-begin inserting the text for the file.  When you ask to "save" the
-file, Emacs will really create the file with the text that you have
-inserted.  From then on, you can consider yourself to be editing an
-already existing file.
+file with Emacs: find the file, which starts out empty, and then begin
+inserting the text for the file.  When you ask to "save" the file,
+Emacs actually creates the file with the text that you have inserted.
+From then on, you can consider yourself to be editing an already
+existing file.
 
 
 * BUFFERS
@@ -595,8 +590,8 @@ this does not save the first file.  Its changes remain inside Emacs,
 in that file's buffer.  The creation or editing of the second file's
 buffer has no effect on the first file's buffer.  This is very useful,
 but it also means that you need a convenient way to save the first
-file's buffer.  It would be a nuisance to have to switch back to
-it with C-x C-f in order to save it with C-x C-s.  So we have
+file's buffer.  Having to switch back to that buffer, in order to save
+it with C-x C-s, would be a nuisance.  So we have
 
        C-x s     Save some buffers
 
@@ -631,7 +626,7 @@ If you are using a graphical display, you don't need any special
 command to move from Emacs to another application.  You can do this
 with the mouse or with window manager commands.  However, if you're
 using a text terminal which can only show one application at a time,
-you need to "suspend" Emacs to move to any other program.
+you need to "suspend" Emacs to move to any other application.
 
 C-z is the command to exit Emacs *temporarily*--so that you can go
 back to the same Emacs session afterward.  When Emacs is running on a
@@ -640,8 +635,8 @@ but does not destroy the Emacs job.  In the most common shells, you
 can resume Emacs with the `fg' command or with `%emacs'.
 
 The time to use C-x C-c is when you are about to log out.  It's also
-the right thing to use to exit an Emacs invoked under mail handling
-programs and other miscellaneous utilities.
+the right thing to use to exit an Emacs invoked for a quick edit, such
+as by a mail handling utility.
 
 There are many C-x commands.  Here is a list of the ones you have learned:
 
@@ -656,8 +651,8 @@ There are many C-x commands.  Here is a list of the ones you have learned:
 
 Named eXtended commands are commands which are used even less
 frequently, or commands which are used only in certain modes.  An
-example is the command replace-string, which globally replaces one
-string with another.  When you type M-x, Emacs prompts you at the
+example is the command replace-string, which replaces one string with
+another in the buffer.  When you type M-x, Emacs prompts you at the
 bottom of the screen with M-x and you should type the name of the
 command; in this case, "replace-string".  Just type "repl s<TAB>" and
 Emacs will complete the name.  (<TAB> is the Tab key, usually found
@@ -671,9 +666,9 @@ argument with <Return>.
 >> Move the cursor to the blank line two lines below this one.
    Then type M-x repl s<Return>changed<Return>altered<Return>.
 
-   Notice how this line has changed: you've replaced
-   the word c-h-a-n-g-e-d with "altered" wherever it occurred,
-   after the initial position of the cursor.
+   Notice how this line has changed: you've replaced the word
+   "changed" with "altered" wherever it occurred, after the
+   initial position of the cursor.
 
 
 * AUTO SAVE
@@ -762,6 +757,7 @@ differently.
 
 To view documentation on your current major mode, type C-h m.
 
+>> Move the cursor to the line following this line.
 >> Type C-l C-l to bring this line to the top of screen.
 >> Type C-h m, to see how Text mode differs from Fundamental mode.
 >> Type C-x 1 to remove the documentation from the screen.
@@ -893,7 +889,8 @@ display, those cursors are drawn as unblinking hollow boxes.
 
 The command C-M-v is very useful when you are editing text in one
 window and using the other window just for reference.  Without leaving
-the selected window, you can scroll the other window with C-M-v.
+the selected window, you can scroll the text in the other window with
+C-M-v.
 
 C-M-v is an example of a CONTROL-META character.  If you have a META
 (or Alt) key, you can type C-M-v by holding down both CONTROL and META
@@ -1041,8 +1038,8 @@ You need to type in the name of the variable when Emacs prompts for it.
 >> Type C-h a file <Return>.
 
 This displays in another window a list of all M-x commands with "file"
-in their names.  You will see character-commands like C-x C-f listed
-beside the corresponding command names such as find-file.
+in their names.  You will see character-commands listed beside the
+corresponding command names (such as C-x C-f beside find-file).
 
 >> Type C-M-v to scroll the help window.  Do this a few times.
 
index fe8c223551aa5dac1a4ed4a4709cd609cdf1c405..b48f0aa79fb5e94e9fb0114ed83deac99b4557e1 100644 (file)
@@ -222,13 +222,13 @@ bandera: la presencia de un argumento prefijo, sin tener en cuenta su
 valor, hace que el comando actúe de forma diferente.
 
 C-v y M-v son otro tipo de excepción.  Cuando se les da un argumento,
-desplazan la pantalla arriba o abajo esa cantidad de líneas, en vez de
+desplazan el texto arriba o abajo esa cantidad de líneas, en vez de
 una pantalla completa.  Por ejemplo, C-u 8 C-v desplaza la pantalla 8
 líneas.
 
 >> Pruebe tecleando C-u 8 C-v ahora.
 
-Esto debió haber desplazado la pantalla hacia arriba 8 líneas.  Si
+Esto debería haber desplazado el texto hacia arriba 8 líneas.  Si
 quisiera desplazarla hacia abajo de nuevo, puede dar un argumento a
 M-v.
 
@@ -299,9 +299,7 @@ dem
 >> Escriba C-x 1 y vea que la ventana de listado de documentación
    desaparece.
 
-Este comando es diferente a los otros que ha aprendido en que éste
-consiste de dos caracteres.  Comienza con el carácter CONTROL-x.  Hay
-toda una serie de comandos que comienzan con CONTROL-x; muchos de
+Hay toda una serie de comandos que comienzan con CONTROL-x; muchos de
 ellos tienen que ver con ventanas, archivos, buffers y cosas
 relacionadas.  Estos comandos son de una longitud de dos, tres o
 cuatro caracteres.
@@ -554,12 +552,8 @@ comando
 Esto copia el texto dentro de Emacs al archivo.  La primera vez que
 haga esto, Emacs renombrará el archivo original con un nuevo nombre
 para que éste no se pierda.  El nuevo nombre se hace agregando "~" al
-final del nombre del archivo original.
-
-Cuando guardar haya terminado, Emacs mostrará el nombre del archivo
-escrito.  Deberá guardar frecuentemente, para que no pierda mucho
-trabajo si el sistema falla (vea la sección "AUTO GUARDADO", más
-adelante).
+final del nombre del archivo original. Cuando guardar haya terminado,
+Emacs mostrará el nombre del archivo escrito.
 
 >> Teclee C-x C-s TUTORIAL.es <Return>
    Esto guardará el tutorial en un archivo llamado TUTORIAL.es, y
@@ -567,10 +561,10 @@ adelante).
 
 Puede encontrar un archivo existente, para verlo o editarlo.  También
 puede hacerlo con un archivo que no exista.  Ésta es la forma de crear
-un archivo en Emacs: encuentre el archivo, que comenzará vacío, luego
-comience a insertar el texto para ese archivo.  Cuando invoque
+un archivo en Emacs: encuentre el archivo, que está inicialmente vacío,
+luego comience a insertar el texto para ese archivo.  Cuando invoque
 "guardar" el archivo, Emacs creará realmente el archivo con el texto
-que ha insertado.  De ahí en adelante, puede considerarse estar
+que ha insertado.  De ahí en adelante, puede considerar que está
 editando un archivo existente.
 
 
@@ -631,8 +625,8 @@ archivo, esto no guarda el primer archivo.  Sus cambios permanecer
 dentro de Emacs en ese buffer del archivo.  La creación o edición del
 segundo buffer de archivo no afecta al primero.  Esto es muy útil,
 pero también significa que necesita una forma conveniente para guardar
-el archivo del primer buffer.  Sería una molestia tener que volver a
-éste con C-x C-f para guardarlo con C-x C-s.  Así tenemos
+el archivo del primer buffer.  Tener que volver a él para guardarlo
+con C-x C-s sería una molestia.  Por tanto, tenemos
 
        C-x s   Guardar algunos buffers
 
@@ -667,7 +661,7 @@ Si est
 especial para cambiar de Emacs a otra aplicación.  Puede hacerlo con
 el ratón, o mediante el gestor de ventanas.  Sin embargo, si está
 usando una terminal que solo puede mostrar una aplicación a la vez,
-tendrá que "suspender" Emacs para poder acceder a otros programas.
+tendrá que "suspender" Emacs para poder acceder a otras aplicaciones.
 
 C-z es el comando para salir de Emacs *temporalmente*: para que pueda
 regresar a la misma sesión de Emacs después.  Cuando Emacs está
@@ -677,8 +671,9 @@ int
 comando `fg' o con `%emacs'.
 
 El momento para usar C-x C-c es cuando está listo para salir del
-sistema.  Es además el paso correcto para salir de un Emacs llamado
-bajo programas de gestión de correo y otras utilidades diversas.
+sistema.  Es además el paso correcto para salir de un Emacs invocado
+para editar algo rápidamente, como por ejemplo desde un programa de
+gestión de correo.
 
 Existen muchos comandos C-x.  He aquí la lista de los que ya ha
 aprendido:
@@ -694,14 +689,14 @@ aprendido:
 
 Los comandos eXtendidos por nombre son comandos que se utilizan aún
 con menos frecuencia, o únicamente en ciertos modos.  Un ejemplo es el
-comando replace-string, el cual substituye globalmente una cadena de
-caracteres por otra.  Cuando teclea M-x, Emacs le pregunta al final de
-la pantalla con M-x y debe escribir el nombre del comando; en este
-caso "replace-string".  Solo teclee "repl s<TAB>" y Emacs completará
-el nombre.  (<TAB> es la tecla del tabulador, que habitualmenté está
-situada sobre la tecla de bloquear mayúsculas o la de shift, en el
-lado izquierdo del teclado.)  Para aceptar el comando y ejecutarlo,
-pulse <Return>.
+comando replace-string, el cual substituye una cadena de caracteres
+por otra en todo el buffer.  Cuando teclea M-x, Emacs le pregunta al
+final de la pantalla con M-x y debe escribir el nombre del comando; en
+este caso "replace-string".  Solo teclee "repl s<TAB>" y Emacs
+completará el nombre.  (<TAB> es la tecla del tabulador, que
+habitualmenté está situada sobre la tecla de bloquear mayúsculas o la
+de shift, en el lado izquierdo del teclado.)  Para aceptar el comando
+y ejecutarlo, pulse <Return>.
 
 El comando replace-string requiere dos argumentos: la cadena de
 caracteres a reemplazar, y la cadena de caracteres para reemplazarla.
@@ -711,8 +706,8 @@ Debe terminar cada argumento con <Return>.
    A continuación escriba
    M-x repl s<Return>cambiado<Return>alterado<Return>.
 
-   Note cómo esta línea ha cambiado: ha substituido la palabra
-   c-a-m-b-i-a-d-o por "alterado" en cada ocurrencia, después de la
+   Note cómo ha cambiado la línea: ha substituido la palabra
+   "cambiado" por "alterado" en cada ocurrencia, después de la
    posición inicial del cursor.
 
 
@@ -804,7 +799,9 @@ pero funcionan de forma un poco diferente.
 
 Para ver la documentación del modo mayor actual, teclee C-h m.
 
->> Use C-l C-l para traer esta línea en la parte superior de la
+>> Mueva el cursor a la línea siguiente a la actual.
+
+>> Use C-l C-l para traer esta línea a la parte superior de la
    pantalla.
 
 >> Teclee C-h m, para ver como el modo de Texto difiere del modo
@@ -1102,9 +1099,9 @@ pregunte por ella.
 >> Teclee C-h a file <Return>.
 
 Esto muestra en otra ventana una lista de todos los comandos M-x con
-la palabra "file" en sus nombres.  Verá comandos de caracteres como
-C-x C-f listados además de los nombres de los comandos
-correspondientes tales como find-file.
+la palabra "file" en sus nombres.  Verá los comandos de caracteres
+listados junto a los nombres de los comandos correspondientes (por
+ejemplo, C-x C-f junto a find-file).
 
 >> Teclee C-M-v para desplazar la ventana de ayuda.  Haga esto unas
    cuantas veces.
index 89ec7c16f8b457a6e65c0d91ebe1cc048a49f1ab..7b829ccee730dfaceee12b24bf76de7bf47b673a 100644 (file)
@@ -18,10 +18,10 @@ tapez C-g. Dans ce didacticiel, les caract
 indiquent les directions à suivre pour essayer une commande. Ainsi :
 <<Lignes blanches insérées après cette ligne par help-with-tutorial>>
 [Centre de page delibérément vide. Le texte continue ci-dessous.]
->>  Tapez C-v (Voir l'écran suivant) pour passer à l'écran suivant
-    (faites-le, pressez la touche CTRL tout en pressant la touche v).
-    À partir de maintenant, vous devrez le faire à chaque fois que
-    vous avez fini de lire l'écran.
+>> Tapez C-v (Voir l'écran suivant) pour passer à l'écran suivant
+     (faites-le, pressez la touche CTRL tout en pressant la touche v).
+     À partir de maintenant, vous devrez le faire à chaque fois que
+     vous avez fini de lire l'écran.
 
 Vous remarquerez qu'il y a un recouvrement de deux lignes lorsque l'on
 passe d'un écran à un autre : cela permet une certaine continuité dans
@@ -33,7 +33,7 @@ C-v. Pour revenir un 
 META tout en appuyant sur v ou faites <ESC>v si vous n'avez pas de
 touche META, EDIT ou ALT).
 
->>  Faites M-v, puis C-v plusieurs fois.
+>> Faites M-v, puis C-v plusieurs fois.
 
 
 * RÉSUMÉ
@@ -228,13 +228,13 @@ d'un param
 agir différemment.
 
 C-v et M-v constituent un autre type d'exception. Lorsqu'on leur donne
-un paramètre, elles font défiler l'écran vers le haut ou vers le bas
+un paramètre, elles font défiler le texte vers le haut ou vers le bas
 du nombre de lignes indiqué au lieu de passer d'un écran complet à
-l'autre. C-u 8 C-v, par exemple, fait défiler l'écran de 8 lignes.
+l'autre. C-u 8 C-v, par exemple, fait défiler le texte de 8 lignes.
 
 >> Faites C-u 8 C-v.
 
-Cela a dû déplacer l'écran de 8 lignes vers le haut. Si vous voulez
+Cela a dû déplacer le texte de 8 lignes vers le haut. Si vous voulez
 redescendre de 8 lignes, il suffit de passer ce nombre comme paramètre
 de M-v.
 
@@ -307,11 +307,10 @@ supprime toutes les autres fen
 
 >> Faites C-x 1 et la fenêtre de documentation disparaît.
 
-Cette commande est différente de celles que nous avons déjà vues car
-elle est formée de deux caractères. Elle commence par le caractère
-CONTROLE-x, comme le font de nombreuses commandes de manipulation de
-fenêtres, fichiers, tampons et autres entités associées. Ces commandes
-font deux, trois ou quatre caractères.
+Il y a toute une série de commandes qui commencent par CONTROL-x;
+nombre d'entre elles ont à voir avec la manipulation de fenêtres, 
+fichiers, tampons et autres entités associées. Ces commandes font 
+deux, trois ou quatre caractères de long.
 
 
 * INSERTION ET SUPPRESSION
@@ -370,7 +369,7 @@ Rappelez-vous que la plupart des commandes Emacs peuvent utiliser un
 nombre de répétitions ; les caractères de texte font de même. La
 répétition d'un caractère de texte l'insère plusieurs fois.
 
->>  Faites C-u 8 * pour insérer ********.
+>> Faites C-u 8 * pour insérer ********.
 
 Vous connaissez maintenant la méthode la plus simple pour taper du
 texte dans Emacs et pour corriger les erreurs. Vous pouvez également
@@ -572,11 +571,8 @@ deviennent permanentes, faites :
 Cette commande copie dans le fichier le texte qui est dans Emacs. La
 première fois, Emacs renomme le fichier original afin qu'il ne soit
 pas perdu. Le nom de cette sauvegarde est construit en ajoutant « ~ »
-à la fin du nom initial.
-
-Lorsque la sauvegarde est finie, Emacs affiche le nom du fichier
-écrit. Sauvegardez à intervalles réguliers afin de perdre le moins
-possible de travail au cas où votre système se planterait.
+à la fin du nom initial. Lorsque la sauvegarde est finie, Emacs
+affiche le nom du fichier écrit. 
 
 >> Faites C-x C-s pour sauvegarder votre copie du didacticiel.
    Cela devrait écrire "Wrote ...TUTORIAL.fr" en bas de l'écran.
@@ -694,7 +690,7 @@ commande sp
 Vous pouvez le faire à l'aide de la souris ou avec les commandes du
 gestionnaire de fenêtres.  Cependant, si vous utilisez un terminal
 texte ne pouvant afficher qu'une application à la fois, vous devez
-« suspendre » Emacs pour passer à n'importe quel autre programme.
+« suspendre » Emacs pour passer à n'importe quelle autre application.
 
 C-z est la commande permettant de quitter *temporairement* Emacs --
 afin de pouvoir revenir à la même session plus tard. Sur les systèmes
@@ -704,7 +700,8 @@ vous pouvez revenir 
 
 Le moment idéal pour utiliser C-x C-c est lorsque l'on se
 déconnecte. C'est aussi la commande adaptée pour sortir d'un Emacs
-invoqué par un programme de courrier ou tout autre utilitaire.
+invoqué pour une modification rapide, par exemple par un programme de
+courrier ou tout autre utilitaire.
 
 Il existe de nombreuses commandes C-x. Voici une liste de celles que
 vous avez apprises :
@@ -719,7 +716,7 @@ vous avez apprises :
 Les eXtensions de commandes nommées sont des commandes utilisées
 encore moins souvent, ou des commandes qui ne servent que dans
 certains modes. Un exemple est la commande replace-string, qui
-remplace globalement une chaîne par une autre. Lorsque vous faites
+remplace une chaîne par une autre dans un tampon. Lorsque vous faites
 M-x, Emacs affiche M-x en bas de l'écran et vous demande de taper le
 nom de la commande, « replace-string » ici. Contentez-vous de faire
 «repl s<TAB> » et Emacs complétera le nom (<TAB> représente la touche
@@ -735,7 +732,7 @@ param
    Puis, faites M-x repl s<Entrée>changée<Entrée>modifiée<Entrée>.
 
    Notez comment cette ligne a été changée : vous avez remplacé le mot
-   c-h-a-n-g-é-e par « modifiée » à chaque fois qu'il apparaissait après
+   « changée » par « modifiée » à chaque fois qu'il apparaissait après
    la position initiale du curseur.
 
 
@@ -949,7 +946,7 @@ manuel d'Emacs contient un Glossaire des termes d'Emacs.)
    fenêtres. Toutes les deux affichent ce didacticiel et le curseur
    reste dans celle du haut.
 
->> Faites C-M-v pour faire défiler la fenêtre du bas
+>> Faites C-M-v pour faire défiler le texte de la fenêtre du bas
    (Si vous n'avez pas de touche Meta, faites <ESC> C-v).
 
 >> Tapez C-x o (« o » pour « other ») afin de placer le curseur dans
@@ -1123,9 +1120,9 @@ Voici d'autres options utiles de C-h :
 >> Faites C-h a file<Entrée>.
 
 Cela affiche dans une autre fenêtre une liste de toutes les commandes
-M-x ayant « file » dans leurs noms. Vous verrez des commandes
-caractères, comme C-x C-f, apparaître à côté des noms de commandes qui
-leur correspondent, comme find-file.
+M-x ayant « file » dans leurs noms. Vous verrez listée des commandes
+caractères à côté des noms de commandes qui leur correspondent (comme 
+C-x C-f à côté de find-file).
 
 >> Faites C-M-v pour faire défiler la fenêtre d'aide. Faites-le
    plusieurs fois.
index 7db452e79fc920b341d262453974d10112a38403..3f721e5f455bab68ac454d81bda102504fd42da2 100644 (file)
@@ -11,7 +11,7 @@ ALT eller EDIT). Vi anv
          den och trycker sedan <chr>.
 
 Viktigt: För att avsluta Emacs trycker du C-x C-c (två tecken).
-För att avsluta kommandon som inte skrivits in fullt, tryck C-g.  
+För att avsluta kommandon som inte skrivits in fullt, tryck C-g.
 Tecknen ">>" i vänstermarginalen anger att du kan prova ett
 kommando. Till exempel:
 <<Tomma rader sätts in runt nästa rad när help-with-tutorial aktiveras>>
@@ -291,24 +291,24 @@ tas bort.
 >> Slå C-x 1 och se hur dokumentationsfönstret nu försvinner.
 
 Kommandot skiljer sig lite från andra kommandon du har lärt dig
-eftersom det består av två tecken. Det startar med tecknet
-KONTROLL-x. Det är faktisk många kommandon som startar med KONTROLL-x
-och många av dem har med filer, skärmbilder och liknande saker att
-göra. Dessa kommandon är två, tre eller fyra tecken långa.
+eftersom det består av två tecken. Det startar med tecknet KONTROLL-x.
+Det finns många kommandon som startar med KONTROLL-x och många av dem
+har med filer, skärmbilder och liknande saker att göra. Dessa
+kommandon är två, tre eller fyra tecken långa.
 
 
 * SKRIVA OCH TA BORT TEXT
 -------------------------
 
-Om du önskar att sätta in text är det bara att skriva in texten. 
-Vanliga tecken, som A, 7, *, etc., sätts in direkt när du skriver dem. 
+Om du önskar att sätta in text är det bara att skriva in texten.
+Vanliga tecken, som A, 7, *, etc., sätts in direkt när du skriver dem.
 Tryck på <Return> för att sätta in en radbrytning. (Det är den tangent
 på tangentbordet som ibland är märkt med "Enter")
 
-För att radera <DEL> tecknet omedelbart före aktuell markörposition,
-skriv <DEL>. Det är tangenten på tangentbordet som vanligtvis är
-markerad med "Backspace" -- det är samma tangent som du normal
-använder för att radera det sist inmatade tecknet utanför Emacs. 
+För att radera tecknet omedelbart före aktuell markörposition, tryck
+på <DEL>. Det är tangenten på tangentbordet som vanligtvis är markerad
+med "Backspace" -- det är samma tangent som du normal använder för att
+radera det sist inmatade tecknet utanför Emacs.
 
 Det kan finnas en annan tangent på ditt tangentbordet som är märkt med
 "Delete", men det är inte den vi menar med <DEL>.
@@ -885,7 +885,7 @@ ordlista 
 >> Flytta markören till den här raden och tryck C-l C-l.
 
 >> Skriv nu C-x 2, som leder till att skärmen delas i två
-   fönster. Bägge fönstren visar den här vägledningen. 
+   fönster. Bägge fönstren visar den här vägledningen.
    Redigeringsmarkören stannar i det övre fönstret.
 
 >> Skriv C-M-v för att rulla det nedre fönstret.
index 72e8ffc0db8aad71a934dd11e5968bd5109e54b4..bf12a974f48708357249245742b2c8148b9d29a3 100644 (file)
@@ -1 +1 @@
-*
+*.info
index 2d062f6e54dc2152ee4773e19ca28ced8981da64..f3acaebec94f4849cb6ca5eba92e6b217d4be1d4 100644 (file)
@@ -1,6 +1,91 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * Version 24.1 released.
+       * quail/ipa.el: Use cl-lib.
+
+       * quail/hangul.el: Don't require CL.
+
+2012-06-12  Nguyen Thai Ngoc Duy  <pclouds@gmail.com>
+
+       * quail/vnvi.el: New file (Bug#4747).
+
+2012-05-22  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (SUBDIRS): Remove variable and rule.
+       (MKDIR_P): Add it back.
+       (all, changed.tit, changed.misc, leim-list.el):
+       Don't depend on SUBDIRS.
+       (changed.tit, changed.misc): Ensure output directory exists.
+       (distclean): Don't use SUBDIRS.
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install): Remove, let top-level do it.
+       (version, prefix, datarootdir, datadir, ns_appresdir, leimdir):
+       (MKDIR_P, GZIP_PROG): Remove, no longer used.
+
+       * Makefile.in (install_prefix): Remove.
+       (LEIM_INSTALLDIR): Rename to leimdir.
+       (install): Update for this change.
+
+       * Makefile.in (leim-list.el, install): Scrap superfluous subshells.
+
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (MKDIR_P): New, set by configure.
+       (install): Use $MKDIR_P.
+
+2012-05-10  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Install self-contained ns files directly to
+       their final destination.
+       (install_prefix): New.
+       (LEIM_INSTALLDIR): New, set by configure.
+       (install): Use LEIM_INSTALLDIR.
+
+       * Makefile.in (MV_DIRS): Remove.
+       (install): Simplify the --with-ns case.
+
+2012-04-09  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (EMACS): Rename from BUILT_EMACS.
+       (RUN_EMACS, compile-main): Update for this change.
+
+       * Makefile.in (../src/emacs): Remove this rule, no longer relevant
+       since leim distributed with Emacs (eg lisp/ has no such rule).
+       (all): Remove $BUILT_EMACS dependence.
+
+2012-04-09  Eli Zaretskii  <eliz@gnu.org>
+
+       * quail/latin-ltx.el (latin-ltx--define-rules): Comment out
+       debugging messages.
+
+2012-04-09  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Compute list of .el files to be compiled dynamically,
+       as the lisp/ directory does, rather than hard-coding it.
+       Also, separate leim-list generation from byte-compilation.
+       (TIT_GB, TIT_BIG5, CHINESE_TIT, MISC, TIT_MISC):
+       Make them store the .el files rather than the .elc files.
+       (NON_TIT_GB, NON_TIT_BIG5, CHINESE_NON_TIT, CHINESE_GB)
+       (CHINESE_GB, CHINESE_BIG5, JAPANESE, KOREAN, THAI, VIETNAMESE)
+       (LAO, INDIAN, TIBETAN, LATIN, UNICODE, SLAVIC, GREEK, RUSSIAN)
+       (OTHERS, CHINESE, EASTASIA, ASIA, EUROPEAN, WORLD, NON_TIT_MISC):
+       Remove variables listing the non-generated .el files.
+       (.el.elc): Add explicit load-path for quail.
+       (all): Depend on compile-main rule rather than $WORLD.
+       (changed.tit, changed.misc): Also depend on $SUBDIRS.
+       (leim-list.el): Don't depend on changed.tit or changed.misc.
+       Remove unnecessary compilation check.
+       (setwins, compile-targets, compile-main): New.
+       (clean, mostlyclean): Update for change in TIT_MISC contents.
+       (bootstrap-clean): Use a glob match to delete .elc, not a fixed list.
+
+2012-04-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * quail/latin-ltx.el: Auto-generate some of the entries.
+       (latin-ltx--ascii-p): New function.
+       (latin-ltx--define-rules): New macro.
+       (define-rules): Use it.
 
 2012-03-25  Eli Zaretskii  <eliz@gnu.org>
 
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1997-1999, 2001-2012  Free Software Foundation, Inc.
+  Copyright (C) 1997-1999, 2001-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index 9556ecb3bb73bdc0fd73fdd41b509f98abe27c8e..04f64c0ce0b2c221cbc1ff12e9635ccf682d886a 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for leim subdirectory in GNU Emacs.
 
-# Copyright (C) 1997-2012  Free Software Foundation, Inc.
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 #   2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
 SHELL = /bin/sh
 
 # Here are the things that we expect ../configure to edit.
-version=@version@
-prefix=@prefix@
-datarootdir=@datarootdir@
-datadir=@datadir@
 srcdir=@srcdir@
-ns_appresdir=@ns_appresdir@
-
-# Where to install LEIM files.
-INSTALLDIR=$(DESTDIR)${datadir}/emacs/${version}/leim
-
-GZIP_PROG = @GZIP_PROG@
 
 # Which Emacs to use to convert TIT files to Emacs Lisp files,
 # byte-compile Emacs Lisp files, and generate the file leim-list.el.
-BUILT_EMACS = ../src/emacs
+EMACS = ../src/emacs
 
 buildlisppath=${srcdir}/../lisp
 
 # How to run Emacs.
 RUN_EMACS = EMACSLOADPATH=$(buildlisppath) LC_ALL=C \
-       ${BUILT_EMACS} -batch --no-site-file --no-site-lisp
+       ${EMACS} -batch --no-site-file --no-site-lisp
 
-# Subdirectories to be made if ${srcdir} is different from the current
-# directory.
-SUBDIRS=quail
+MKDIR_P = @MKDIR_P@
 
 # Files generated from TIT dictionaries for Chinese GB character set.
 TIT_GB=\
-       quail/CCDOSPY.elc       \
-       quail/Punct.elc         \
-       quail/QJ.elc            \
-       quail/SW.elc            \
-       quail/TONEPY.elc
+       quail/CCDOSPY.el        \
+       quail/Punct.el          \
+       quail/QJ.el             \
+       quail/SW.el             \
+       quail/TONEPY.el
 
 # Files generated from TIT dictionaries for Chinese BIG5 character set.
 TIT_BIG5=\
-       quail/4Corner.elc       \
-       quail/ARRAY30.elc       \
-       quail/ECDICT.elc        \
-       quail/ETZY.elc          \
-       quail/Punct-b5.elc      \
-       quail/PY-b5.elc         \
-       quail/QJ-b5.elc         \
-       quail/ZOZY.elc
+       quail/4Corner.el        \
+       quail/ARRAY30.el        \
+       quail/ECDICT.el \
+       quail/ETZY.el           \
+       quail/Punct-b5.el       \
+       quail/PY-b5.el          \
+       quail/QJ-b5.el          \
+       quail/ZOZY.el
 
 CHINESE_TIT=${TIT_GB} ${TIT_BIG5}
 
-NON_TIT_GB=${srcdir}/quail/py-punct.elc
-
-NON_TIT_BIG5=${srcdir}/quail/pypunct-b5.elc
-
-CHINESE_NON_TIT=${NON_TIT_GB} ${NON_TIT_BIG5}
-
-CHINESE_GB=${TIT_GB} ${NON_TIT_GB}
-
-CHINESE_BIG5=${TIT_BIG5} ${NON_TIT_BIG5}
-
-JAPANESE=${srcdir}/quail/japanese.elc ${srcdir}/ja-dic/ja-dic.elc
-
-KOREAN=        ${srcdir}/quail/hangul.elc      \
-       ${srcdir}/quail/hanja.elc       \
-       ${srcdir}/quail/hanja3.elc      \
-       ${srcdir}/quail/hanja-jis.elc   \
-       ${srcdir}/quail/symbol-ksc.elc
-
-THAI=${srcdir}/quail/thai.elc
-
-VIETNAMESE=${srcdir}/quail/viqr.elc ${srcdir}/quail/vntelex.elc
-
-LAO=${srcdir}/quail/lao.elc ${srcdir}/quail/lrt.elc
-
-INDIAN=${srcdir}/quail/indian.elc
-
-TIBETAN=${srcdir}/quail/tibetan.elc
-
-LATIN= ${srcdir}/quail/latin-pre.elc   \
-       ${srcdir}/quail/latin-post.elc  \
-       ${srcdir}/quail/latin-alt.elc   \
-       ${srcdir}/quail/latin-ltx.elc   \
-       ${srcdir}/quail/welsh.elc
-
-UNICODE=${srcdir}/quail/sgml-input.elc ${srcdir}/quail/rfc1345.elc \
-       ${srcdir}/quail/uni-input.elc
-
-SLAVIC= \
-       ${srcdir}/quail/czech.elc \
-       ${srcdir}/quail/croatian.elc \
-       ${srcdir}/quail/slovak.elc
-
-GREEK=${srcdir}/quail/greek.elc
-
-RUSSIAN=${srcdir}/quail/cyrillic.elc ${srcdir}/quail/cyril-jis.elc
-
-OTHERS= \
-       ${srcdir}/quail/arabic.elc \
-       ${srcdir}/quail/ethiopic.elc \
-       ${srcdir}/quail/ipa.elc \
-       ${srcdir}/quail/ipa-praat.elc \
-       ${srcdir}/quail/hebrew.elc \
-       ${srcdir}/quail/georgian.elc \
-       $(srcdir)/quail/persian.elc \
-       ${srcdir}/quail/sisheng.elc
-
 MISC= \
-       quail/tsang-b5.elc      \
-       quail/quick-b5.elc      \
-       quail/tsang-cns.elc     \
-       quail/quick-cns.elc     \
-       quail/PY.elc            \
-       quail/ZIRANMA.elc       \
-       quail/CTLau.elc         \
-       quail/CTLau-b5.elc
-
-CHINESE=${CHINESE_GB} ${CHINESE_BIG5}
-EASTASIA=${CHINESE} ${JAPANESE} ${KOREAN}
-ASIA=${EASTASIA} ${THAI} ${VIETNAMESE} ${LAO} ${INDIAN} ${TIBETAN}
-EUROPEAN=${LATIN} ${SLAVIC} ${GREEK} ${RUSSIAN}
-WORLD=${ASIA} ${EUROPEAN} ${OTHERS} ${MISC} ${UNICODE}
-
+       quail/tsang-b5.el       \
+       quail/quick-b5.el       \
+       quail/tsang-cns.el      \
+       quail/quick-cns.el      \
+       quail/PY.el             \
+       quail/ZIRANMA.el        \
+       quail/CTLau.el          \
+       quail/CTLau-b5.el
+
+## The generated .el files.
 TIT_MISC=${CHINESE_TIT} ${MISC}
-NON_TIT_MISC=${CHINESE_NON_TIT} ${JAPANESE} ${KOREAN} ${EUROPEAN} ${OTHERS}
 
 .SUFFIXES: .elc .el
 
 .el.elc:
        @echo Compiling $<
-       @${RUN_EMACS} -f batch-byte-compile $<
-
-all: ${BUILT_EMACS} ${SUBDIRS} leim-list.el ${WORLD}
-
-# To ensure that we can run Emacs.  This target is ignored (never
-# being hit) if a user changes default value of EMACS.
-../src/emacs:
-       cd ../src; ${MAKE} ${MFLAGS} emacs
+       @${RUN_EMACS} -l ${buildlisppath}/international/quail -f batch-byte-compile $<
 
-${SUBDIRS}:
-       mkdir $@
-       touch stamp-subdir
+all: leim-list.el compile-main
 
 TIT_SOURCES= \
        ${srcdir}/CXTERM-DIC/4Corner.tit \
@@ -181,10 +98,19 @@ TIT_SOURCES= \
        ${srcdir}/CXTERM-DIC/TONEPY.tit \
        ${srcdir}/CXTERM-DIC/ZOZY.tit
 
-${CHINESE_TIT:.elc=.el}: changed.tit
+${CHINESE_TIT}: changed.tit
        @true
 
+## The changed.* files act to serialize this part of the build.
+## A single Emacs invocation creates all the CHINESE_TIT files.
+## Otherwise in a parallel build multiple Emacs instances could
+## interfere with each other.  If we used GNU make we could probably
+## parallelize this without the need for an explicit rule for each
+## file.  Something like the pattern rule:
+## quail/%.el: CXTERM-DIC/%.tit
+## It doesn't seem possible to do this with VPATH and suffix rules.
 changed.tit: ${TIT_SOURCES}
+       @${MKDIR_P} quail
        ${RUN_EMACS} -l ${buildlisppath}/international/titdic-cnv \
          -f batch-titdic-convert -dir quail ${srcdir}/CXTERM-DIC; \
          echo "changed" > $@
@@ -197,19 +123,18 @@ MISC_SOURCES= \
        ${srcdir}/MISC-DIC/pinyin.map \
        ${srcdir}/MISC-DIC/ziranma.cin
 
-${MISC:.elc=.el}: changed.misc
+${MISC}: changed.misc
        @true
 
 changed.misc: ${MISC_SOURCES}
+       @${MKDIR_P} quail
        ${RUN_EMACS} -l ${buildlisppath}/international/titdic-cnv \
          -f batch-miscdic-convert -dir quail ${srcdir}/MISC-DIC; \
          echo "changed" > $@
 
-leim-list.el: ${SUBDIRS} ${TIT_MISC} changed.tit changed.misc ${srcdir}/leim-ext.el
+leim-list.el: ${TIT_MISC} ${srcdir}/leim-ext.el
        rm -f leim-list.el
-       ${RUN_EMACS}  -l ${buildlisppath}/international/quail \
-         -f batch-byte-compile-if-not-done ${TIT_MISC:.elc=.el}
-       if [ x`(cd ${srcdir} && /bin/pwd)` = x`(/bin/pwd)` ] ; then \
+       if [ x`cd ${srcdir} && /bin/pwd` = x`/bin/pwd` ] ; then \
          ${RUN_EMACS} -l ${buildlisppath}/international/quail \
            --eval "(update-leim-list-file \".\")" ; \
        else \
@@ -218,67 +143,41 @@ leim-list.el: ${SUBDIRS} ${TIT_MISC} changed.tit changed.misc ${srcdir}/leim-ext
        fi
        sed -n '/^[^;]/ p' < ${srcdir}/leim-ext.el >> $@
 
-MV_DIRS = for i in $$dir; do rm -fr `basename "$$i"` ; mv "$$i" . ; done
-
-install: all
-       if [ ! -d ${INSTALLDIR} ] ; then \
-          umask 022; ${srcdir}/../build-aux/install-sh -d ${INSTALLDIR}; \
-       else true; fi
-       if [ x`(cd ${INSTALLDIR} && /bin/pwd)` != x`(/bin/pwd)` ] ; then \
-         rm -f ${INSTALLDIR}/leim-list.el; \
-         rm -rf ${INSTALLDIR}/quail ${INSTALLDIR}/ja-dic ; \
-         echo "Copying leim files to ${INSTALLDIR} ..." ; \
-         if [ x`(cd ${srcdir} && /bin/pwd)` = x`(/bin/pwd)` ] ; then \
-           tar -chf - leim-list.el quail ja-dic \
-               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
-         else \
-           tar -chf - leim-list.el quail \
-               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
-           cd ${srcdir}; \
-           tar -chf - quail/* ja-dic \
-               | (cd ${INSTALLDIR}; umask 0; tar -xvf - && cat > /dev/null) ;\
-         fi; \
-         rm -f  ${INSTALLDIR}/.gitignore ${INSTALLDIR}/*/.gitignore; \
-         rm -f  ${INSTALLDIR}/.arch-inventory ${INSTALLDIR}/*/.arch-inventory; \
-         rm -f  ${INSTALLDIR}/\#*        ${INSTALLDIR}/*/\#* ; \
-         rm -f  ${INSTALLDIR}/.\#*       ${INSTALLDIR}/*/.\#* ; \
-         rm -f  ${INSTALLDIR}/*~         ${INSTALLDIR}/*/*~ ; \
-         rm -f  ${INSTALLDIR}/*.orig     ${INSTALLDIR}/*/*.orig ; \
-       else true; fi
-       -unset CDPATH; \
-       if [ -n "${GZIP_PROG}" ]; \
-       then \
-          echo "Compressing *.el ..." ; \
-          (cd ${INSTALLDIR}; for f in `find . -name "*.elc" -print`; do \
-               ${GZIP_PROG} -9n `echo $$f|sed 's/.elc$$/.el/'` ; \
-           done) \
-       else true; fi
-       -chmod -R a+r ${INSTALLDIR}
-       for installuser in $${LOGNAME} $${USERNAME} $${USER} \
-         `id -un 2> /dev/null`; do \
-         [ -n "$${installuser}" ] && break ; \
-       done ; \
-       find ${INSTALLDIR} -exec chown $${installuser} '{}' ';'
-       if [ "${ns_appresdir}" != "" ]; then \
-         ( cd ${ns_appresdir} ; \
-           if test -d share/emacs ; then dir=share/emacs/*/*; $(MV_DIRS); fi;\
-           rm -fr share ) ; \
-       else true ; fi
+## Following adapted from lisp/Makefile.in.
+setwins=wins="${srcdir}/ja-dic quail"; \
+       [ `cd ${srcdir} && /bin/pwd` != `/bin/pwd` ] && \
+       wins="$$wins ${srcdir}/quail"
+
+.PHONY: compile-targets
+# TARGETS is set dynamically in the recursive call from `compile-main'.
+compile-targets: $(TARGETS)
+
+# Compile all the Elisp files that need it.  Beware: it approximates
+# `no-byte-compile', so watch out for false-positives!
+compile-main: ${TIT_MISC}
+       @($(setwins); \
+       els=`echo "$$wins " | sed -e 's| |/*.el |g'`; \
+       for el in $$els; do \
+         test -f $$el || continue; \
+         test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el > /dev/null && continue; \
+         echo "$${el}c"; \
+       done | xargs echo) | \
+       while read chunk; do \
+         $(MAKE) $(MFLAGS) compile-targets EMACS="$(EMACS)" TARGETS="$$chunk"; \
+       done
 
 clean mostlyclean:
-       rm -f ${TIT_MISC} ${TIT_MISC:.elc=.el} \
+       rm -f ${TIT_MISC} ${TIT_MISC:.el=.elc} \
                leim-list.el changed.tit changed.misc
 
 # The following target is needed because the `clean' target only removes
 # TIT-generated files and doesn't touch compiled Quail packages.  But
 # bootstrapping should not leave non-fresh .elc files behind.
 bootstrap-clean: clean
-       rm -f ${WORLD}
-## FIXME some compiled files go to srcdir, some don't?
-#      cd ${srcdir}; rm -f *.elc */*.elc
+       $(setwins); for w in $$wins; do rm -f $$w/*.elc; done
 
 distclean: clean
-       if test -f stamp-subdir; then rm -rf ${SUBDIRS} stamp-subdir; fi
+       -[ `cd ${srcdir} && /bin/pwd` != `/bin/pwd` ] && rm -rf quail
        rm -f Makefile
 
 maintainer-clean: distclean bootstrap-clean
index 2ce55a57107a52960e931b05a6b1fe19aed9d634..d30957ae7e64fc807efed0f2ad210506e0c40c5c 100644 (file)
@@ -30,7 +30,6 @@
 ;;; Code:
 
 (require 'quail)
-(eval-when-compile (require 'cl))       ; for setf
 (require 'hanja-util)
 
 ;; Hangul double Jamo table.
index 72db819fa234d3d1dd75013a81d17fd686d1b45d..b29a6ffc113efa66b7f91a3712ae06bd66ef6d9c 100644 (file)
@@ -29,7 +29,7 @@
 ;;; Code:
 
 (require 'quail)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (quail-define-package
  "ipa" "IPA" "IPA" t
@@ -277,13 +277,13 @@ string."
       (setq quail-keymap (list (string quail-keymap)))
     (if (stringp quail-keymap)
        (setq quail-keymap (list quail-keymap))
-      (assert (vectorp quail-keymap) t)
+      (cl-assert (vectorp quail-keymap) t)
       (setq quail-keymap (append quail-keymap nil))))
   (list
    (apply 'vector
          (mapcar
           #'(lambda (entry)
-               (assert (char-or-string-p entry) t)
+               (cl-assert (char-or-string-p entry) t)
                (format "%s%s" to-prepend
                        (if (integerp entry) (string entry) entry)))
           quail-keymap))))
@@ -318,18 +318,18 @@ particular sequence of keys, and the result will be cached by Quail."
     (dolist (underscoring underscore-map)
       (cond ((null underscoring))
            ((eq (length underscoring) 2)
-            (setq underscore-map-entry (second underscoring))
+            (setq underscore-map-entry (cl-second underscoring))
             (setcdr underscoring (ipa-x-sampa-prepend-to-keymap-entry
                                   pre-underscore-map underscore-map-entry)))
            ((eq (length underscoring) 3)
-            (setq underscore-map-entry (second (third underscoring)))
-            (setcdr (third underscoring)
+            (setq underscore-map-entry (cl-second (cl-third underscoring)))
+            (setcdr (cl-third underscoring)
                     (ipa-x-sampa-prepend-to-keymap-entry
                      pre-underscore-map underscore-map-entry)))
            (t
-            (assert (null t) t
-                    "Can't handle subtrees of this level right now."))))
-    (append underscore-map (list (list ?< (second x-sampa-submap-entry))))))
+            (cl-assert (null t) t
+                        "Can't handle subtrees of this level right now."))))
+    (append underscore-map (list (list ?< (cl-second x-sampa-submap-entry))))))
 
 (quail-define-package
  "ipa-x-sampa" "IPA" "IPA-X" t
index 089797c32ae3ba0602bcc87e8012881ace1d2a80..9f4c9664899abba4082351a9a2ab09c2be42865e 100644 (file)
@@ -42,484 +42,265 @@ system, including many technical ones.  Examples:
  '(("\t" . quail-completion))
  t t nil nil nil nil nil nil nil t)
 
-(quail-define-rules
+(eval-when-compile
+  (defun latin-ltx--ascii-p (char)
+    (and (characterp char) (< char 128)))
+
+  (defmacro latin-ltx--define-rules (&rest rules)
+    (load "uni-name")
+    (let ((newrules ()))
+      (dolist (rule rules)
+        (pcase rule
+          (`(,_ ,(pred characterp)) (push rule newrules)) ;; Normal quail rule.
+          (`(,seq ,re)
+           (let ((count 0))
+             (dolist (pair (ucs-names))
+               (let ((name (car pair))
+                     (char (cdr pair)))
+                 (when (and (characterp char) ;; Ignore char-ranges.
+                            (string-match re name))
+                   (let ((keys (if (stringp seq)
+                                   (replace-match seq nil nil name)
+                                 (funcall seq name char))))
+                     (if (listp keys)
+                         (dolist (x keys)
+                           (setq count (1+ count))
+                           (push (list x char) newrules))
+                       (setq count (1+ count))
+                       (push (list keys char) newrules))))))
+             ;(message "latin-ltx: %d mapping for %S" count re)
+            ))))
+      `(quail-define-rules ,@(nreverse (delete-dups newrules))))))
+
+(latin-ltx--define-rules
  ("!`" ?¡)
  ("\\pounds" ?£) ;; ("{\\pounds}" ?£)
  ("\\S" ?§) ;; ("{\\S}" ?§)
- ("\\\"{}" ?¨)
- ("\\copyright" ?©) ;; ("{\\copyright}" ?©)
  ("$^a$" ?ª)
- ("\\={}" ?¯)
  ("$\\pm$" ?±) ("\\pm" ?±)
  ("$^2$" ?²)
  ("$^3$" ?³)
- ("\\'{}" ?´)
  ("\\P" ?¶) ;; ("{\\P}" ?¶)
  ;; Fixme: Yudit has the equivalent of ("\\cdot" ?⋅), for U+22C5, DOT
  ;; OPERATOR, whereas · is MIDDLE DOT.  JadeTeX translates both to
  ;; \cdot.
  ("$\\cdot$" ?·) ("\\cdot" ?·)
- ("\\c{}" ?¸)
  ("$^1$" ?¹)
  ("$^o$" ?º)
  ("?`" ?¿)
 
- ("\\`{A}" ?À)  ("\\`A" ?À)
- ("\\'{A}" ?Á)  ("\\'A" ?Á)
- ("\\^{A}" ?Â)  ("\\^A" ?Â)
- ("\\~{A}" ?Ã)  ("\\~A" ?Ã)
- ("\\\"{A}" ?Ä)  ("\\\"A" ?Ä)
- ("\\\k{A}" ?Ą)
+ ("\\`" ?̀)
+ ("\\`{}" ?`)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\`{%s}" c) (format "\\`%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH GRAVE")
+
+ ("\\'" ?́)
+ ("\\'{}" ?´)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\'{%s}" c) (format "\\'%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH ACUTE")
+
+ ("\\^" ?̂)
+ ("\\^{}" ?^)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\^{%s}" c) (format "\\^%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH CIRCUMFLEX")
+
+ ("\\~" ?̃)
+ ("\\~{}" ?˜)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\~{%s}" c) (format "\\~%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH TILDE")
+
+ ("\\\"" ?̈)
+ ("\\\"{}" ?¨)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\\"{%s}" c) (format "\\\"%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH DIAERESIS")
+
+ ("\\k" ?̨)
+ ("\\k{}" ?˛)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\k{%s}" c) ;; (format "\\k%s" c)
+            )))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH OGONEK")
+
+ ("\\c" ?̧)
+ ("\\c{}" ?¸)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\c{%s}" c) (format "\\c%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH CEDILLA")
+
  ("\\AA" ?Å) ;; ("{\\AA}" ?Å)
  ("\\AE" ?Æ) ;; ("{\\AE}" ?Æ)
- ("\\c{C}" ?Ç)  ("\\cC" ?Ç)
- ("\\`{E}" ?È)  ("\\`E" ?È)
- ("\\'{E}" ?É)  ("\\'E" ?É)
- ("\\^{E}" ?Ê)  ("\\^E" ?Ê)
- ("\\\"{E}" ?Ë)  ("\\\"E" ?Ë)
- ("\\\k{E}" ?Ę)
- ("\\`{I}" ?Ì)  ("\\`I" ?Ì)
- ("\\'{I}" ?Í)  ("\\'I" ?Í)
- ("\\^{I}" ?Î)  ("\\^I" ?Î)
- ("\\\"{I}" ?Ï)  ("\\\"I" ?Ï)
- ("\\\k{I}" ?Į)
 
- ("\\~{N}" ?Ñ)  ("\\~N" ?Ñ)
- ("\\`{O}" ?Ò)  ("\\`O" ?Ò)
- ("\\'{O}" ?Ó)  ("\\'O" ?Ó)
- ("\\^{O}" ?Ô)  ("\\^O" ?Ô)
- ("\\~{O}" ?Õ)  ("\\~O" ?Õ)
- ("\\\"{O}" ?Ö)  ("\\\"O" ?Ö)
- ("\\\k{O}" ?Ǫ)
  ("$\\times$" ?×) ("\\times" ?×)
  ("\\O" ?Ø) ;; ("{\\O}" ?Ø)
- ("\\`{U}" ?Ù) ("\\`U" ?Ù)
- ("\\'{U}" ?Ú) ("\\'U" ?Ú)
- ("\\^{U}" ?Û) ("\\^U" ?Û)
- ("\\\"{U}" ?Ü) ("\\\"U" ?Ü)
- ("\\\k{U}" ?Ų)
- ("\\'{Y}" ?Ý) ("\\'Y" ?Ý)
  ("\\ss" ?ß) ;; ("{\\ss}" ?ß)
 
- ("\\`{a}" ?à) ("\\`a" ?à)
- ("\\'{a}" ?á) ("\\'a" ?á)
- ("\\^{a}" ?â) ("\\^a" ?â)
- ("\\~{a}" ?ã) ("\\~a" ?ã)
- ("\\\"{a}" ?ä) ("\\\"a" ?ä)
- ("\\\k{a}" ?ą)
  ("\\aa" ?å) ;; ("{\\aa}" ?å)
  ("\\ae" ?æ) ;; ("{\\ae}" ?æ)
- ("\\c{c}" ?ç) ("\\cc" ?ç)
- ("\\`{e}" ?è) ("\\`e" ?è)
- ("\\'{e}" ?é) ("\\'e" ?é)
- ("\\^{e}" ?ê) ("\\^e" ?ê)
- ("\\\"{e}" ?ë) ("\\\"e" ?ë)
- ("\\\k{e}" ?ę)
- ("\\`{\\i}" ?ì)  ("\\`i" ?ì)
- ("\\'{\\i}" ?í)  ("\\'i" ?í)
- ("\\^{\\i}" ?î) ("\\^i" ?î)
- ("\\\"{\\i}" ?ï) ("\\\"i" ?ï)
- ("\\\k{i}" ?į)
 
- ("\\~{n}" ?ñ) ("\\~n" ?ñ)
- ("\\`{o}" ?ò) ("\\`o" ?ò)
- ("\\'{o}" ?ó) ("\\'o" ?ó)
- ("\\^{o}" ?ô) ("\\^o" ?ô)
- ("\\~{o}" ?õ) ("\\~o" ?õ)
- ("\\\"{o}" ?ö) ("\\\"o" ?ö)
- ("\\\k{o}" ?ǫ)
  ("$\\div$" ?÷) ("\\div" ?÷)
  ("\\o" ?ø) ;; ("{\\o}" ?ø)
- ("\\`{u}" ?ù) ("\\`u" ?ù)
- ("\\'{u}" ?ú) ("\\'u" ?ú)
- ("\\^{u}" ?û) ("\\^u" ?û)
- ("\\\"{u}" ?ü) ("\\\"u" ?ü)
- ("\\\k{u}" ?ų)
- ("\\'{y}" ?ý) ("\\'y" ?ý)
- ("\\\"{y}" ?ÿ) ("\\\"y" ?ÿ)
 
- ("\\={A}" ?Ā) ("\\=A" ?Ā)
- ("\\={a}" ?ā) ("\\=a" ?ā)
- ("\\u{A}" ?Ă) ("\\uA" ?Ă)
- ("\\u{a}" ?ă) ("\\ua" ?ă)
- ("\\'{C}" ?Ć) ("\\'C" ?Ć)
- ("\\'{c}" ?ć) ("\\'c" ?ć)
- ("\\^{C}" ?Ĉ) ("\\^C" ?Ĉ)
- ("\\^{c}" ?ĉ) ("\\^c" ?ĉ)
- ("\\.{C}" ?Ċ) ("\\.C" ?Ċ)
- ("\\.{c}" ?ċ) ("\\.c" ?ċ)
- ("\\v{C}" ?Č) ("\\vC" ?Č)
- ("\\v{c}" ?č) ("\\vc" ?č)
- ("\\v{D}" ?Ď) ("\\vD" ?Ď)
- ("\\v{d}" ?ď) ("\\vd" ?ď)
+ ("\\=" ?̄)
+ ("\\={}" ?¯)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\={%s}" c) (format "\\=%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH MACRON")
 
- ("\\={E}" ?Ē) ("\\=E" ?Ē)
- ("\\={e}" ?ē) ("\\=e" ?ē)
- ("\\u{E}" ?Ĕ) ("\\uE" ?Ĕ)
- ("\\u{e}" ?ĕ) ("\\ue" ?ĕ)
- ("\\.{E}" ?Ė) ("\\.E" ?Ė)
- ("\\e{e}" ?ė) ("\\ee" ?ė)
- ("\\v{E}" ?Ě) ("\\vE" ?Ě)
- ("\\v{e}" ?ě) ("\\ve" ?ě)
- ("\\^{G}" ?Ĝ) ("\\^G" ?Ĝ)
- ("\\^{g}" ?ĝ) ("\\^g" ?ĝ)
- ("\\u{G}" ?Ğ) ("\\uG" ?Ğ)
- ("\\u{g}" ?ğ) ("\\ug" ?ğ)
+ ("\\u" ?̆)
+ ("\\u{}" ?˘)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\u{%s}" c) (format "\\u%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH BREVE")
 
- ("\\.{G}" ?Ġ) ("\\.G" ?Ġ)
- ("\\.{g}" ?ġ) ("\\.g" ?ġ)
- ("\\c{G}" ?Ģ) ("\\cG" ?Ģ)
- ("\\c{g}" ?ģ) ("\\cg" ?ģ)
- ("\\^{H}" ?Ĥ) ("\\^H" ?Ĥ)
- ("\\^{h}" ?ĥ) ("\\^h" ?ĥ)
- ("\\~{I}" ?Ĩ) ("\\~I" ?Ĩ)
- ("\\~{\\i}" ?ĩ) ("\\~i" ?ĩ)
- ("\\={I}" ?Ī) ("\\=I" ?Ī)
- ("\\={\\i}" ?ī) ("\\=i" ?ī)
- ("\\u{I}" ?Ĭ) ("\\uI" ?Ĭ)
- ("\\u{\\i}" ?ĭ) ("\\ui" ?ĭ)
+ ("\\." ?̇)
+ ("\\.{}" ?˙)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\.{%s}" c) (format "\\.%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH DOT ABOVE")
+
+ ("\\v" ?̌)
+ ("\\v{}" ?ˇ)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\v{%s}" c) (format "\\v%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH CARON")
+
+ ("\\~{\\i}" ?ĩ)
+ ("\\={\\i}" ?ī)
+ ("\\u{\\i}" ?ĭ)
 
- ("\\.{I}" ?İ) ("\\.I" ?İ)
  ("\\i" ?ı) ;; ("{\\i}" ?ı)
- ("\\^{J}" ?Ĵ) ("\\^J" ?Ĵ)
- ("\\^{\\j}" ?ĵ) ("\\^j" ?ĵ)
- ("\\c{K}" ?Ķ) ("\\cK" ?Ķ)
- ("\\c{k}" ?ķ) ("\\ck" ?ķ)
- ("\\'{L}" ?Ĺ) ("\\'L" ?Ĺ)
- ("\\'{l}" ?ĺ) ("\\'l" ?ĺ)
- ("\\c{L}" ?Ļ) ("\\cL" ?Ļ)
- ("\\c{l}" ?ļ) ("\\cl" ?ļ)
+ ("\\^{\\j}" ?ĵ)
 
  ("\\L" ?Ł) ;; ("{\\L}" ?Ł)
  ("\\l" ?ł) ;; ("{\\l}" ?ł)
- ("\\'{N}" ?Ń) ("\\'N" ?Ń)
- ("\\'{n}" ?ń) ("\\'n" ?ń)
- ("\\c{N}" ?Ņ) ("\\cN" ?Ņ)
- ("\\c{n}" ?ņ) ("\\cn" ?ņ)
- ("\\v{N}" ?Ň) ("\\vN" ?Ň)
- ("\\v{n}" ?ň) ("\\vn" ?ň)
- ("\\={O}" ?Ō) ("\\=O" ?Ō)
- ("\\={o}" ?ō) ("\\=o" ?ō)
- ("\\u{O}" ?Ŏ) ("\\uO" ?Ŏ)
- ("\\u{o}" ?ŏ) ("\\uo" ?ŏ)
 
- ("\\H{O}" ?Ő) ("\\HO" ?Ő)
- ("\\U{o}" ?ő) ("\\Uo" ?ő)
+ ("\\H" ?̋)
+ ("\\H{}" ?˝)
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\H{%s}" c) (format "\\H%s" c))))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH DOUBLE ACUTE")
+ ("\\U{o}" ?ő) ("\\Uo" ?ő) ;; FIXME: Was it just a typo?
  ("\\OE" ?Œ) ;; ("{\\OE}" ?Œ)
  ("\\oe" ?œ) ;; ("{\\oe}" ?œ)
- ("\\'{R}" ?Ŕ) ("\\'R" ?Ŕ)
- ("\\'{r}" ?ŕ) ("\\'r" ?ŕ)
- ("\\c{R}" ?Ŗ) ("\\cR" ?Ŗ)
- ("\\c{r}" ?ŗ) ("\\cr" ?ŗ)
- ("\\v{R}" ?Ř) ("\\vR" ?Ř)
- ("\\v{r}" ?ř) ("\\vr" ?ř)
- ("\\'{S}" ?Ś) ("\\'S" ?Ś)
- ("\\'{s}" ?ś) ("\\'s" ?ś)
- ("\\^{S}" ?Ŝ) ("\\^S" ?Ŝ)
- ("\\^{s}" ?ŝ) ("\\^s" ?ŝ)
- ("\\c{S}" ?Ş) ("\\cS" ?Ş)
- ("\\c{s}" ?ş) ("\\cs" ?ş)
-
- ("\\v{S}" ?Š) ("\\vS" ?Š)
- ("\\v{s}" ?š) ("\\vs" ?š)
- ("\\c{T}" ?Ţ) ("\\cT" ?Ţ)
- ("\\c{t}" ?ţ) ("\\ct" ?ţ)
- ("\\v{T}" ?Ť) ("\\vT" ?Ť)
- ("\\v{t}" ?ť) ("\\vt" ?ť)
- ("\\~{U}" ?Ũ) ("\\~U" ?Ũ)
- ("\\~{u}" ?ũ) ("\\~u" ?ũ)
- ("\\={U}" ?Ū) ("\\=U" ?Ū)
- ("\\={u}" ?ū) ("\\=u" ?ū)
- ("\\u{U}" ?Ŭ) ("\\uU" ?Ŭ)
- ("\\u{u}" ?ŭ) ("\\uu" ?ŭ)
 
- ("\\H{U}" ?Ű) ("\\HU" ?Ű)
- ("\\H{u}" ?ű) ("\\Hu" ?ű)
- ("\\^{W}" ?Ŵ) ("\\^W" ?Ŵ)
- ("\\^{w}" ?ŵ) ("\\^w" ?ŵ)
- ("\\^{Y}" ?Ŷ) ("\\^Y" ?Ŷ)
- ("\\^{y}" ?ŷ) ("\\^y" ?ŷ)
- ("\\\"{Y}" ?Ÿ) ("\\\"Y" ?Ÿ)
- ("\\'{Z}" ?Ź) ("\\'Z" ?Ź)
- ("\\'{z}" ?ź) ("\\'z" ?ź)
- ("\\.{Z}" ?Ż) ("\\.Z" ?Ż)
- ("\\.{z}" ?ż) ("\\.z" ?ż)
- ("\\v{Z}" ?Ž) ("\\vZ" ?Ž)
- ("\\v{z}" ?ž) ("\\vz" ?ž)
-
- ("\\v{A}" ?Ǎ) ("\\vA" ?Ǎ)
- ("\\v{a}" ?ǎ) ("\\va" ?ǎ)
- ("\\v{I}" ?Ǐ) ("\\vI" ?Ǐ)
- ("\\v{\\i}" ?ǐ) ("\\vi" ?ǐ)
- ("\\v{O}" ?Ǒ) ("\\vO" ?Ǒ)
- ("\\v{o}" ?ǒ) ("\\vo" ?ǒ)
- ("\\v{U}" ?Ǔ) ("\\vU" ?Ǔ)
- ("\\v{u}" ?ǔ) ("\\vu" ?ǔ)
+ ("\\v{\\i}" ?ǐ)
 
  ("\\={\\AE}" ?Ǣ) ("\\=\\AE" ?Ǣ)
  ("\\={\\ae}" ?ǣ) ("\\=\\ae" ?ǣ)
- ("\\v{G}" ?Ǧ) ("\\vG" ?Ǧ)
- ("\\v{g}" ?ǧ) ("\\vg" ?ǧ)
- ("\\v{K}" ?Ǩ) ("\\vK" ?Ǩ)
- ("\\v{k}" ?ǩ) ("\\vk" ?ǩ)
 
- ("\\v{\\j}" ?ǰ) ("\\vj" ?ǰ)
- ("\\'{G}" ?Ǵ) ("\\'G" ?Ǵ)
- ("\\'{g}" ?ǵ) ("\\'g" ?ǵ)
- ("\\`{N}" ?Ǹ) ("\\`N" ?Ǹ)
- ("\\`{n}" ?ǹ) ("\\`n" ?ǹ)
+ ("\\v{\\j}" ?ǰ)
  ("\\'{\\AE}" ?Ǽ) ("\\'\\AE" ?Ǽ)
  ("\\'{\\ae}" ?ǽ) ("\\'\\ae" ?ǽ)
  ("\\'{\\O}" ?Ǿ) ("\\'\\O" ?Ǿ)
  ("\\'{\\o}" ?ǿ) ("\\'\\o" ?ǿ)
 
- ("\\v{H}" ?Ȟ) ("\\vH" ?Ȟ)
- ("\\v{h}" ?ȟ) ("\\vh" ?ȟ)
- ("\\.{A}" ?Ȧ) ("\\.A" ?Ȧ)
- ("\\.{a}" ?ȧ) ("\\.a" ?ȧ)
- ("\\c{E}" ?Ȩ) ("\\cE" ?Ȩ)
- ("\\c{e}" ?ȩ) ("\\ce" ?ȩ)
- ("\\.{O}" ?Ȯ) ("\\.O" ?Ȯ)
- ("\\.{o}" ?ȯ) ("\\.o" ?ȯ)
- ("\\={Y}" ?Ȳ) ("\\=Y" ?Ȳ)
- ("\\={y}" ?ȳ) ("\\=y" ?ȳ)
-
- ("\\v{}" ?ˇ)
- ("\\u{}" ?˘)
- ("\\.{}" ?˙)
- ("\\~{}" ?˜)
- ("\\H{}" ?˝)
-
- ("\\'" ?́)
- ("\\'K" ?Ḱ)
- ("\\'M" ?Ḿ)
- ("\\'P" ?Ṕ)
- ("\\'W" ?Ẃ)
- ("\\'k" ?ḱ)
- ("\\'m" ?ḿ)
- ("\\'p" ?ṕ)
- ("\\'w" ?ẃ)
  ("\\," ? )
- ("\\." ?̇)
- ("\\.B" ?Ḃ)
- ("\\.D" ?Ḋ)
- ("\\.F" ?Ḟ)
- ("\\.H" ?Ḣ)
- ("\\.M" ?Ṁ)
- ("\\.N" ?Ṅ)
- ("\\.P" ?Ṗ)
- ("\\.R" ?Ṙ)
- ("\\.S" ?Ṡ)
- ("\\.T" ?Ṫ)
- ("\\.W" ?Ẇ)
- ("\\.X" ?Ẋ)
- ("\\.Y" ?Ẏ)
- ("\\.b" ?ḃ)
- ("\\.d" ?ḋ)
- ("\\.e" ?ė)
- ("\\.f" ?ḟ)
- ("\\.h" ?ḣ)
- ("\\.m" ?ṁ)
- ("\\.n" ?ṅ)
- ("\\.p" ?ṗ)
- ("\\.r" ?ṙ)
- ("\\.s" ?ṡ)
- ("\\.t" ?ṫ)
- ("\\.w" ?ẇ)
- ("\\.x" ?ẋ)
- ("\\.y" ?ẏ)
  ("\\/" ?‌)
  ("\\:" ? )
  ("\\;" ? )
- ("\\=" ?̄)
- ("\\=G" ?Ḡ)
- ("\\=g" ?ḡ)
 
- ("^(" ?⁽)
- ("^)" ?⁾)
- ("^+" ?⁺)
- ("^-" ?⁻)
- ("^0" ?⁰)
- ("^1" ?¹)
- ("^2" ?²)
- ("^3" ?³)
- ("^4" ?⁴)
- ("^5" ?⁵)
- ("^6" ?⁶)
- ("^7" ?⁷)
- ("^8" ?⁸)
- ("^9" ?⁹)
- ("^=" ?⁼)
+ ((lambda (name char)
+    (let* ((base (concat (match-string 1 name) (match-string 3 name)))
+           (basechar (cdr (assoc base (ucs-names)))))
+      (when (latin-ltx--ascii-p basechar)
+        (string (if (match-end 2) ?^ ?_) basechar))))
+  "\\(.*\\)SU\\(?:B\\|\\(PER\\)\\)SCRIPT \\(.*\\)")
+
  ("^\\gamma" ?ˠ)
- ;; FIXME: It'd be nicer to generate some of these rules via something like
- ;; (map (lambda (name char)
- ;;        (cond ((string-match "MODIFIER SMALL LETTER \\(.\\)" name)
- ;;               (list (string ?^ (downcase (aref name (match-beginning 1))))
- ;;                     char)))
- ;;              ...)))
- ("^a" ?ᵃ)
- ("^b" ?ᵇ)
- ("^c" ?ᶜ)
- ("^d" ?ᵈ)
- ("^e" ?ᵉ)
- ("^f" ?ᶠ)
- ("^g" ?ᵍ)
- ("^h" ?ʰ)
- ;; ("^i" ?)  ;; FIXME: can't find MODIFIER SMALL LETTER I  !?!
- ("^j" ?ʲ)
- ("^k" ?ᵏ)
- ("^l" ?ˡ)
- ("^m" ?ᵐ)
- ("^n" ?ⁿ)
- ("^o" ?ᵒ)
+
+ ((lambda (name char)
+    (let* ((base (format "LATIN %s LETTER %s"
+                         (match-string 1 name) (match-string 2 name)))
+           (basechar (cdr (assoc base (ucs-names)))))
+      (when (latin-ltx--ascii-p basechar)
+        (string ?^ basechar))))
+  "MODIFIER LETTER \\(SMALL\\|CAPITAL\\) \\(.*\\)")
+ ;; ((lambda (name char) (format "^%s" (downcase (match-string 1 name))))
+ ;;  "\\`MODIFIER LETTER SMALL \\(.\\)\\'")
+ ;; ("^\\1" "\\`MODIFIER LETTER CAPITAL \\(.\\)\\'")
  ("^o_" ?º)
- ("^p" ?ᵖ)
- ;; ("^q" ?)  ;; FIXME: can't find MODIFIER SMALL LETTER Q  !?!
- ("^r" ?ʳ)
- ("^s" ?ˢ)
- ("^t" ?ᵗ)
- ("^u" ?ᵘ)
- ("^v" ?ᵛ)
- ("^w" ?ʷ)
- ("^x" ?ˣ)
- ("^y" ?ʸ)
- ("^z" ?ᶻ)
- ("^A" ?ᴬ)
- ("^B" ?ᴮ)
- ;; ("^C" ?)  ;; FIXME: can't find MODIFIER CAPITAL LETTER C  !?!
- ("^D" ?ᴰ)
- ("^E" ?ᴱ)
- ;; ("^F" ?)  ;; FIXME: can't find MODIFIER CAPITAL LETTER F  !?!
- ("^G" ?ᴳ)
- ("^H" ?ᴴ)
- ("^I" ?ᴵ)
- ("^J" ?ᴶ)
- ("^K" ?ᴷ)
- ("^L" ?ᴸ)
- ("^M" ?ᴹ)
- ("^N" ?ᴺ)
- ("^O" ?ᴼ)
- ("^P" ?ᴾ)
- ;; ("^Q" ?)  ;; FIXME: can't find MODIFIER CAPITAL LETTER Q  !?!
- ("^R" ?ᴿ)
- ;; ("^S" ?)  ;; FIXME: can't find MODIFIER CAPITAL LETTER S  !?!
- ("^T" ?ᵀ)
- ("^U" ?ᵁ)
- ("^V" ?ⱽ)
- ("^W" ?ᵂ)
- ;; ("^X" ?)  ;; FIXME: can't find MODIFIER CAPITAL LETTER X  !?!
- ;; ("^Y" ?)  ;; FIXME: can't find MODIFIER CAPITAL LETTER Y  !?!
- ;; ("^Z" ?)  ;; FIXME: can't find MODIFIER CAPITAL LETTER Z  !?!
  ("^{SM}" ?℠)
  ("^{TEL}" ?℡)
  ("^{TM}" ?™)
- ("_(" ?₍)
- ("_)" ?₎)
- ("_+" ?₊)
- ("_-" ?₋)
- ("_0" ?₀)
- ("_1" ?₁)
- ("_2" ?₂)
- ("_3" ?₃)
- ("_4" ?₄)
- ("_5" ?₅)
- ("_6" ?₆)
- ("_7" ?₇)
- ("_8" ?₈)
- ("_9" ?₉)
- ("_=" ?₌)
 
- ("\\~" ?̃)
- ("\\~E" ?Ẽ)
- ("\\~V" ?Ṽ)
- ("\\~Y" ?Ỹ)
- ("\\~e" ?ẽ)
- ("\\~v" ?ṽ)
- ("\\~y" ?ỹ)
-
- ("\\\"" ?̈)
- ("\\\"H" ?Ḧ)
- ("\\\"W" ?Ẅ)
- ("\\\"X" ?Ẍ)
- ("\\\"h" ?ḧ)
- ("\\\"t" ?ẗ)
- ("\\\"w" ?ẅ)
- ("\\\"x" ?ẍ)
- ("\\^" ?̂)
- ("\\^Z" ?Ẑ)
- ("\\^z" ?ẑ)
- ("\\`" ?̀)
- ("\\`W" ?Ẁ)
- ("\\`Y" ?Ỳ)
- ("\\`w" ?ẁ)
- ("\\`y" ?ỳ)
  ("\\b" ?̱)
- ("\\c" ?̧)
- ("\\c{D}" ?Ḑ)
- ("\\c{H}" ?Ḩ)
- ("\\c{d}" ?ḑ)
- ("\\c{h}" ?ḩ)
+
  ("\\d" ?̣)
- ("\\d{A}" ?Ạ)
- ("\\d{B}" ?Ḅ)
- ("\\d{D}" ?Ḍ)
- ("\\d{E}" ?Ẹ)
- ("\\d{H}" ?Ḥ)
- ("\\d{I}" ?Ị)
- ("\\d{K}" ?Ḳ)
- ("\\d{L}" ?Ḷ)
- ("\\d{M}" ?Ṃ)
- ("\\d{N}" ?Ṇ)
- ("\\d{O}" ?Ọ)
- ("\\d{R}" ?Ṛ)
- ("\\d{S}" ?Ṣ)
- ("\\d{T}" ?Ṭ)
- ("\\d{U}" ?Ụ)
- ("\\d{V}" ?Ṿ)
- ("\\d{W}" ?Ẉ)
- ("\\d{Y}" ?Ỵ)
- ("\\d{Z}" ?Ẓ)
- ("\\d{a}" ?ạ)
- ("\\d{b}" ?ḅ)
- ("\\d{d}" ?ḍ)
- ("\\d{e}" ?ẹ)
- ("\\d{h}" ?ḥ)
- ("\\d{i}" ?ị)
- ("\\d{k}" ?ḳ)
- ("\\d{l}" ?ḷ)
- ("\\d{m}" ?ṃ)
- ("\\d{n}" ?ṇ)
- ("\\d{o}" ?ọ)
- ("\\d{r}" ?ṛ)
- ("\\d{s}" ?ṣ)
- ("\\d{t}" ?ṭ)
- ("\\d{u}" ?ụ)
- ("\\d{v}" ?ṿ)
- ("\\d{w}" ?ẉ)
- ("\\d{y}" ?ỵ)
- ("\\d{z}" ?ẓ)
+ ;; ("\\d{}" ?) ;; FIXME: can't find the DOT BELOW character.
+ ((lambda (name char)
+    (let ((c (if (match-end 1)
+                 (downcase (match-string 2 name))
+               (match-string 2 name))))
+      (list (format "\\d{%s}" c) ;; (format "\\d%s" c)
+            )))
+  "\\(?:CAPITAL\\|SMAL\\(L\\)\\) LETTER \\(.\\) WITH DOT BELOW")
+
  ("\\rq" ?’)
- ("\\u" ?̆)
- ("\\v" ?̌)
- ("\\v{L}" ?Ľ)
- ("\\v{i}" ?ǐ)
- ("\\v{j}" ?ǰ)
- ("\\v{l}" ?ľ)
- ("\\yen" ?¥)
+
+ ;; FIXME: Provides some useful entries (yen, euro, copyright, registered,
+ ;; currency, minus, micro), but also a lot of dubious ones.
+ ((lambda (name char)
+    (unless (latin-ltx--ascii-p char)
+      (concat "\\" (downcase (match-string 1 name)))))
+  "\\`\\([^- ]+\\) SIGN\\'")
+
+ ((lambda (name char)
+    (concat "\\" (funcall (if (match-end 1) #' capitalize #'downcase)
+                          (match-string 2 name))))
+  "\\`GREEK \\(?:SMALL\\|CAPITA\\(L\\)\\) LETTER \\([^- ]+\\)\\'")
 
  ("\\Box" ?□)
  ("\\Bumpeq" ?≎)
  ("\\Cap" ?⋒)
  ("\\Cup" ?⋓)
- ("\\Delta" ?Δ)
  ("\\Diamond" ?◇)
  ("\\Downarrow" ?⇓)
- ("\\Gamma" ?Γ)
- ("\\H" ?̋)
  ("\\H{o}" ?ő)
  ("\\Im" ?ℑ)
  ("\\Join" ?⋈)
- ("\\Lambda" ?Λ)
  ("\\Leftarrow" ?⇐)
  ("\\Leftrightarrow" ?⇔)
  ("\\Ll" ?⋘)
@@ -528,27 +309,18 @@ system, including many technical ones.  Examples:
  ("\\Longleftrightarrow" ?⇔)
  ("\\Longrightarrow" ?⇒)
  ("\\Lsh" ?↰)
- ("\\Omega" ?Ω)
- ("\\Phi" ?Φ)
- ("\\Pi" ?Π)
- ("\\Psi" ?Ψ)
  ("\\Re" ?ℜ)
  ("\\Rightarrow" ?⇒)
  ("\\Rrightarrow" ?⇛)
  ("\\Rsh" ?↱)
- ("\\Sigma" ?Σ)
  ("\\Subset" ?⋐)
  ("\\Supset" ?⋑)
- ("\\Theta" ?Θ)
  ("\\Uparrow" ?⇑)
  ("\\Updownarrow" ?⇕)
- ("\\Upsilon" ?Υ)
  ("\\Vdash" ?⊩)
  ("\\Vert" ?‖)
  ("\\Vvdash" ?⊪)
- ("\\Xi" ?Ξ)
  ("\\aleph" ?ℵ)
- ("\\alpha" ?α)
  ("\\amalg" ?∐)
  ("\\angle" ?∠)
  ("\\approx" ?≈)
@@ -563,7 +335,6 @@ system, including many technical ones.  Examples:
  ("\\backslash" ?\\)
  ("\\barwedge" ?⊼)
  ("\\because" ?∵)
- ("\\beta" ?β)
  ("\\beth" ?ℶ)
  ("\\between" ?≬)
  ("\\bigcap" ?⋂)
@@ -602,7 +373,7 @@ system, including many technical ones.  Examples:
  ("\\circledcirc" ?⊚)
  ("\\circleddash" ?⊝)
  ("\\clubsuit" ?♣)
- ("\\colon" ?:)
+ ("\\colon" ?:)                         ;FIXME: Conflict with "COLON SIGN" ₡.
  ("\\coloneq" ?≔)
  ("\\complement" ?∁)
  ("\\cong" ?≅)
@@ -623,7 +394,6 @@ system, including many technical ones.  Examples:
  ("\\ddag" ?‡)
  ("\\ddagger" ?‡)
  ("\\ddots" ?⋱)
- ("\\delta" ?δ)
  ("\\diamond" ?⋄)
  ("\\diamondsuit" ?♢)
  ("\\digamma" ?Ϝ)
@@ -638,14 +408,11 @@ system, including many technical ones.  Examples:
  ("\\downrightharpoon" ?⇂)
  ("\\ell" ?ℓ)
  ("\\emptyset" ?∅)
- ("\\epsilon" ?ε)
  ("\\eqcirc" ?≖)
  ("\\eqcolon" ?≕)
  ("\\eqslantgtr" ?⋝)
  ("\\eqslantless" ?⋜)
  ("\\equiv" ?≡)
- ("\\eta" ?η)
- ("\\euro" ?€)
  ("\\exists" ?∃)
  ("\\fallingdotseq" ?≒)
  ("\\flat" ?♭)
@@ -667,7 +434,6 @@ system, including many technical ones.  Examples:
  ("\\frac58" ?⅝)
  ("\\frac78" ?⅞)
  ("\\frown" ?⌢)
- ("\\gamma" ?γ)
  ("\\ge" ?≥)
  ("\\geq" ?≥)
  ("\\geqq" ?≧)
@@ -697,9 +463,6 @@ system, including many technical ones.  Examples:
  ("\\infty" ?∞)
  ("\\int" ?∫)
  ("\\intercal" ?⊺)
- ("\\iota" ?ι)
- ("\\kappa" ?κ)
- ("\\lambda" ?λ)
  ("\\langle" ?〈)
  ("\\lbrace" ?{)
  ("\\lbrack" ?\[)
@@ -783,7 +546,7 @@ system, including many technical ones.  Examples:
  ("\\nleqslant" ?≰)
  ("\\nless" ?≮)
  ("\\nmid" ?∤)
- ("\\not" ?̸)
+ ("\\not" ?̸)                            ;FIXME: conflict with "NOT SIGN" ¬.
  ("\\notin" ?∉)
  ("\\nparallel" ?∦)
  ("\\nprec" ?⊀)
@@ -805,13 +568,11 @@ system, including many technical ones.  Examples:
  ("\\ntrianglelefteq" ?⋬)
  ("\\ntriangleright" ?⋫)
  ("\\ntrianglerighteq" ?⋭)
- ("\\nu" ?ν)
  ("\\nvDash" ?⊭)
  ("\\nvdash" ?⊬)
  ("\\nwarrow" ?↖)
  ("\\odot" ?⊙)
  ("\\oint" ?∮)
- ("\\omega" ?ω)
  ("\\ominus" ?⊖)
  ("\\oplus" ?⊕)
  ("\\oslash" ?⊘)
@@ -820,8 +581,6 @@ system, including many technical ones.  Examples:
  ("\\parallel" ?∥)
  ("\\partial" ?∂)
  ("\\perp" ?⊥)
- ("\\phi" ?φ)
- ("\\pi" ?π)
  ("\\pitchfork" ?⋔)
  ("\\prec" ?≺)
  ("\\precapprox" ?≾)
@@ -832,7 +591,6 @@ system, including many technical ones.  Examples:
  ("\\prime" ?′)
  ("\\prod" ?∏)
  ("\\propto" ?∝)
- ("\\psi" ?ψ)
  ("\\qed" ?∎)
  ("\\quad" ? )
  ("\\rangle" ?〉)
@@ -857,7 +615,6 @@ system, including many technical ones.  Examples:
  ("\\sharp" ?♯)
  ("\\shortmid" ?∣)
  ("\\shortparallel" ?∥)
- ("\\sigma" ?σ)
  ("\\sim" ?∼)
  ("\\simeq" ?≃)
  ("\\smallamalg" ?∐)
@@ -896,9 +653,7 @@ system, including many technical ones.  Examples:
  ("\\supsetneqq" ?⊋)
  ("\\surd" ?√)
  ("\\swarrow" ?↙)
- ("\\tau" ?τ)
  ("\\therefore" ?∴)
- ("\\theta" ?θ)
  ("\\thickapprox" ?≈)
  ("\\thicksim" ?∼)
  ("\\to" ?→)
@@ -918,19 +673,18 @@ system, including many technical ones.  Examples:
  ("\\upleftharpoon" ?↿)
  ("\\uplus" ?⊎)
  ("\\uprightharpoon" ?↾)
- ("\\upsilon" ?υ)
  ("\\upuparrows" ?⇈)
  ("\\urcorner" ?⌝)
  ("\\u{i}" ?ĭ)
  ("\\vDash" ?⊨)
- ("\\varkappa" ?ϰ)
- ("\\varphi" ?ϕ)
- ("\\varpi" ?ϖ)
+
+ ((lambda (name char)
+    (concat "\\var" (downcase (match-string 1 name))))
+  "\\`GREEK \\([^- ]+\\) SYMBOL\\'")
+
  ("\\varprime" ?′)
  ("\\varpropto" ?∝)
- ("\\varrho" ?ϱ)
- ("\\varsigma" ?ς)
- ("\\vartheta" ?ϑ)
+ ("\\varsigma" ?ς)                     ;FIXME: Looks reversed with the non\var.
  ("\\vartriangleleft" ?⊲)
  ("\\vartriangleright" ?⊳)
  ("\\vdash" ?⊢)
@@ -941,8 +695,6 @@ system, including many technical ones.  Examples:
  ("\\wedge" ?∧)
  ("\\wp" ?℘)
  ("\\wr" ?≀)
- ("\\xi" ?ξ)
- ("\\zeta" ?ζ)
 
  ("\\Bbb{N}" ?ℕ)                     ; AMS commands for blackboard bold
  ("\\Bbb{P}" ?ℙ)                     ; Also sometimes \mathbb.
@@ -954,8 +706,6 @@ system, including many technical ones.  Examples:
  ;; a bug where the user finds his ~ key doesn't insert a ~ any more.
  ("\\ " ? )
  ("\\\\" ?\\)
- ("\\mu" ?μ)
- ("\\rho" ?ρ)
  ("\\mathscr{I}" ?ℐ)                 ; moment of inertia
  ("\\Smiley" ?☺)
  ("\\blacksmiley" ?☻)
@@ -980,13 +730,10 @@ system, including many technical ones.  Examples:
  ;; ("\\Writinghand" ?✍)
  ;; ("\\Yinyang" ?☯)
  ;; ("\\Heart" ?♡)
- ("\\registered" ?®)
- ("\\currency" ?¤)
  ("\\dh" ?ð)
  ("\\DH" ?Ð)
  ("\\th" ?þ)
  ("\\TH" ?Þ)
- ("\\micro" ?µ)
  ("\\lnot" ?¬)
  ("\\ordfeminine" ?ª)
  ("\\ordmasculine" ?º)
@@ -995,7 +742,6 @@ system, including many technical ones.  Examples:
  ;; by analogy with lq, rq:
  ("\\ldq" ?\“)
  ("\\rdq" ?\”)
- ("\\minus" ?−)
  ("\\defs" ?≙)                               ; per fuzz/zed
  ;; ("\\sqrt[3]" ?∛)
  ("\\llbracket" ?\〚)                         ; stmaryrd
diff --git a/leim/quail/vnvni.el b/leim/quail/vnvni.el
new file mode 100644 (file)
index 0000000..b5948a7
--- /dev/null
@@ -0,0 +1,305 @@
+;;; vnvni.el --- Quail package for Vietnamese by VNI method
+
+;; Copyright (C) 2001-2012  Free Software Foundation, Inc.
+
+;; Author:   Werner Lemberg <wl@gnu.org>
+;;           Nguyen Thai Ngoc Duy <pclouds@gmail.com>
+;; Keywords: multilingual, input method, Vietnamese
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; There are two commonly-used input methods for Vietnamese: Telex
+;; (implemented in vntelex.el) and VNI (implemented in this file,
+;; which was based on vntelex.el).
+
+;;; Code:
+
+(require 'quail)
+
+
+(quail-define-package
+ "vietnamese-vni"                ; NAME
+ "Vietnamese"                    ; LANGUAGE
+ "VV"                            ; TITLE
+ t                               ; GUIDANCE
+ "Vietnamese VNI input method
+
+Diacritics:
+
+  effect     postfix   examples
+  ------------------------------
+  circumflex    6      a6 -> \e,Ab\e(B
+  breve         8      a8 -> \e,1e\e(B
+  horn          7      o7 -> \e,1=\e(B
+
+  acute         1      a1 -> \e,1a\e(B
+  grave         2      a2 -> \e,1`\e(B
+  hook above    3      a3 -> \e,1d\e(B
+  tilde         4      a4 -> \e,1c\e(B
+  dot below     5      a5 -> \e,1U\e(B
+
+  d bar         9      d9 -> \e,1p\e(B
+
+Combinations:
+
+  A82 -> \e,2"\e(B, o74 -> \e,1^\e(B, etc.
+
+Doubling the postfix (but not in combinations) separates the letter
+and postfix: E66 -> E6, a55 -> a5, etc.
+"                                ; DOCSTRING
+ nil                             ; TRANSLATION-KEYS
+ t                               ; FORGET-LAST-SELECTION
+ nil                             ; DETERMINISTIC
+ nil                             ; KBD-TRANSLATE
+ nil                             ; SHOW-LAYOUT
+ nil                             ; CREATE-DECODE-MAP
+ nil                             ; MAXIMUM-SHORTEST
+ nil                             ; OVERLAY-PLIST
+ nil                             ; UPDATE-TRANSLATION-FUNCTION
+ nil                             ; CONVERSION-KEYS
+ t)                              ; SIMPLE
+
+(quail-define-rules
+ ("a2" ?\e,1`\e(B)       ; LATIN SMALL LETTER A WITH GRAVE
+ ("A2" ?\e,2`\e(B)       ; LATIN CAPITAL LETTER A WITH GRAVE
+ ("a1" ?\e,1a\e(B)       ; LATIN SMALL LETTER A WITH ACUTE
+ ("A1" ?\e,2a\e(B)       ; LATIN CAPITAL LETTER A WITH ACUTE
+ ("a6" ?\e,1b\e(B)       ; LATIN SMALL LETTER A WITH CIRCUMFLEX
+ ("A6" ?\e,2b\e(B)       ; LATIN CAPITAL LETTER A WITH CIRCUMFLEX
+ ("a4" ?\e,1c\e(B)       ; LATIN SMALL LETTER A WITH TILDE
+ ("A4" ?\e,2c\e(B)       ; LATIN CAPITAL LETTER A WITH TILDE
+ ("e2" ?\e,1h\e(B)       ; LATIN SMALL LETTER E WITH GRAVE
+ ("E2" ?\e,2h\e(B)       ; LATIN CAPITAL LETTER E WITH GRAVE
+ ("e1" ?\e,1i\e(B)       ; LATIN SMALL LETTER E WITH ACUTE
+ ("E1" ?\e,2i\e(B)       ; LATIN CAPITAL LETTER E WITH ACUTE
+ ("e6" ?\e,1j\e(B)       ; LATIN SMALL LETTER E WITH CIRCUMFLEX
+ ("E6" ?\e,2j\e(B)       ; LATIN CAPITAL LETTER E WITH CIRCUMFLEX
+ ("i2" ?\e,1l\e(B)       ; LATIN SMALL LETTER I WITH GRAVE
+ ("I2" ?\e,2l\e(B)       ; LATIN CAPITAL LETTER I WITH GRAVE
+ ("i1" ?\e,1m\e(B)       ; LATIN SMALL LETTER I WITH ACUTE
+ ("I1" ?\e,2m\e(B)       ; LATIN CAPITAL LETTER I WITH ACUTE
+ ("o2" ?\e,1r\e(B)       ; LATIN SMALL LETTER O WITH GRAVE
+ ("O2" ?\e,2r\e(B)       ; LATIN CAPITAL LETTER O WITH GRAVE
+ ("o1" ?\e,1s\e(B)       ; LATIN SMALL LETTER O WITH ACUTE
+ ("O1" ?\e,2s\e(B)       ; LATIN CAPITAL LETTER O WITH ACUTE
+ ("o6" ?\e,1t\e(B)       ; LATIN SMALL LETTER O WITH CIRCUMFLEX
+ ("O6" ?\e,2t\e(B)       ; LATIN CAPITAL LETTER O WITH CIRCUMFLEX
+ ("o4" ?\e,1u\e(B)       ; LATIN SMALL LETTER O WITH TILDE
+ ("O4" ?\e,2u\e(B)       ; LATIN CAPITAL LETTER O WITH TILDE
+ ("u2" ?\e,1y\e(B)       ; LATIN SMALL LETTER U WITH GRAVE
+ ("U2" ?\e,2y\e(B)       ; LATIN CAPITAL LETTER U WITH GRAVE
+ ("u1" ?\e,1z\e(B)       ; LATIN SMALL LETTER U WITH ACUTE
+ ("U1" ?\e,2z\e(B)       ; LATIN CAPITAL LETTER U WITH ACUTE
+ ("y1" ?\e,1}\e(B)       ; LATIN SMALL LETTER Y WITH ACUTE
+ ("Y1" ?\e,2}\e(B)       ; LATIN CAPITAL LETTER Y WITH ACUTE
+ ("a8" ?\e,1e\e(B)       ; LATIN SMALL LETTER A WITH BREVE
+ ("A8" ?\e,2e\e(B)       ; LATIN CAPITAL LETTER A WITH BREVE
+ ("i4" ?\e,1n\e(B)       ; LATIN SMALL LETTER I WITH TILDE
+ ("I4" ?\e,2n\e(B)       ; LATIN CAPITAL LETTER I WITH TILDE
+ ("u4" ?\e,1{\e(B)       ; LATIN SMALL LETTER U WITH TILDE
+ ("U4" ?\e,2{\e(B)       ; LATIN CAPITAL LETTER U WITH TILDE
+ ("o7" ?\e,1=\e(B)       ; LATIN SMALL LETTER O WITH HORN
+ ("O7" ?\e,2=\e(B)       ; LATIN CAPITAL LETTER O WITH HORN
+ ("u7" ?\e,1_\e(B)       ; LATIN SMALL LETTER U WITH HORN
+ ("U7" ?\e,2_\e(B)       ; LATIN CAPITAL LETTER U WITH HORN
+ ("a5" ?\e,1U\e(B)       ; LATIN SMALL LETTER A WITH DOT BELOW
+ ("A5" ?\e,2U\e(B)       ; LATIN CAPITAL LETTER A WITH DOT BELOW
+ ("a3" ?\e,1d\e(B)       ; LATIN SMALL LETTER A WITH HOOK ABOVE
+ ("A3" ?\e,2d\e(B)       ; LATIN CAPITAL LETTER A WITH HOOK ABOVE
+ ("a61" ?\e,1$\e(B)      ; LATIN SMALL LETTER A WITH CIRCUMFLEX AND ACUTE
+ ("A61" ?\e,2$\e(B)      ; LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND ACUTE
+ ("a62" ?\e,1%\e(B)      ; LATIN SMALL LETTER A WITH CIRCUMFLEX AND GRAVE
+ ("A62" ?\e,2%\e(B)      ; LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND GRAVE
+ ("a63" ?\e,1&\e(B)      ; LATIN SMALL LETTER A WITH CIRCUMFLEX AND HO6K ABOVE
+ ("A63" ?\e,2&\e(B)      ; LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND HO6K ABOVE
+ ("a64" ?\e,1g\e(B)      ; LATIN SMALL LETTER A WITH CIRCUMFLEX AND TILDE
+ ("A64" ?\e,2g\e(B)      ; LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND TILDE
+ ("a65" ?\e,1'\e(B)      ; LATIN SMALL LETTER A WITH CIRCUMFLEX AND DOT BELOW
+ ("A65" ?\e,2'\e(B)      ; LATIN CAPITAL LETTER A WITH CIRCUMFLEX AND DOT BELOW
+ ("a81" ?\e,1!\e(B)      ; LATIN SMALL LETTER A WITH BREVE AND ACUTE
+ ("A81" ?\e,2!\e(B)      ; LATIN CAPITAL LETTER A WITH BREVE AND ACUTE
+ ("a82" ?\e,1"\e(B)      ; LATIN SMALL LETTER A WITH BREVE AND GRAVE
+ ("A82" ?\e,2"\e(B)      ; LATIN CAPITAL LETTER A WITH BREVE AND GRAVE
+ ("a83" ?\e,1F\e(B)      ; LATIN SMALL LETTER A WITH BREVE AND HO6K ABOVE
+ ("A83" ?\e,2F\e(B)      ; LATIN CAPITAL LETTER A WITH BREVE AND HO6K ABOVE
+ ("a84" ?\e,1G\e(B)      ; LATIN SMALL LETTER A WITH BREVE AND TILDE
+ ("A84" ?\e,2G\e(B)      ; LATIN CAPITAL LETTER A WITH BREVE AND TILDE
+ ("a85" ?\e,1#\e(B)      ; LATIN SMALL LETTER A WITH BREVE AND DOT BELOW
+ ("A85" ?\e,2#\e(B)      ; LATIN CAPITAL LETTER A WITH BREVE AND DOT BELOW
+ ("e5" ?\e,1)\e(B)       ; LATIN SMALL LETTER E WITH DOT BELOW
+ ("E5" ?\e,2)\e(B)       ; LATIN CAPITAL LETTER E WITH DOT BELOW
+ ("e3" ?\e,1k\e(B)       ; LATIN SMALL LETTER E WITH HO6K ABOVE
+ ("E3" ?\e,2k\e(B)       ; LATIN CAPITAL LETTER E WITH HO6K ABOVE
+ ("e4" ?\e,1(\e(B)       ; LATIN SMALL LETTER E WITH TILDE
+ ("E4" ?\e,2(\e(B)       ; LATIN CAPITAL LETTER E WITH TILDE
+ ("e61" ?\e,1*\e(B)      ; LATIN SMALL LETTER E WITH CIRCUMFLEX AND ACUTE
+ ("E61" ?\e,2*\e(B)      ; LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND ACUTE
+ ("e62" ?\e,1+\e(B)      ; LATIN SMALL LETTER E WITH CIRCUMFLEX AND GRAVE
+ ("E62" ?\e,2+\e(B)      ; LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND GRAVE
+ ("e63" ?\e,1,\e(B)      ; LATIN SMALL LETTER E WITH CIRCUMFLEX AND HO6K ABOVE
+ ("E63" ?\e,2,\e(B)      ; LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND HO6K ABOVE
+ ("e64" ?\e,1-\e(B)      ; LATIN SMALL LETTER E WITH CIRCUMFLEX AND TILDE
+ ("E64" ?\e,2-\e(B)      ; LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND TILDE
+ ("e65" ?\e,1.\e(B)      ; LATIN SMALL LETTER E WITH CIRCUMFLEX AND DOT BELOW
+ ("E65" ?\e,2.\e(B)      ; LATIN CAPITAL LETTER E WITH CIRCUMFLEX AND DOT BELOW
+ ("i3" ?\e,1o\e(B)       ; LATIN SMALL LETTER I WITH HO6K ABOVE
+ ("I3" ?\e,2o\e(B)       ; LATIN CAPITAL LETTER I WITH HO6K ABOVE
+ ("i5" ?\e,18\e(B)       ; LATIN SMALL LETTER I WITH DOT BELOW
+ ("I5" ?\e,28\e(B)       ; LATIN CAPITAL LETTER I WITH DOT BELOW
+ ("o5" ?\e,1w\e(B)       ; LATIN SMALL LETTER O WITH DOT BELOW
+ ("O5" ?\e,2w\e(B)       ; LATIN CAPITAL LETTER O WITH DOT BELOW
+ ("o3" ?\e,1v\e(B)       ; LATIN SMALL LETTER O WITH HO6K ABOVE
+ ("O3" ?\e,2v\e(B)       ; LATIN CAPITAL LETTER O WITH HO6K ABOVE
+ ("o61" ?\e,1/\e(B)      ; LATIN SMALL LETTER O WITH CIRCUMFLEX AND ACUTE
+ ("O61" ?\e,2/\e(B)      ; LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND ACUTE
+ ("o62" ?\e,10\e(B)      ; LATIN SMALL LETTER O WITH CIRCUMFLEX AND GRAVE
+ ("O62" ?\e,20\e(B)      ; LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND GRAVE
+ ("o63" ?\e,11\e(B)      ; LATIN SMALL LETTER O WITH CIRCUMFLEX AND HO6K ABOVE
+ ("O63" ?\e,21\e(B)      ; LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND HO6K ABOVE
+ ("o64" ?\e,12\e(B)      ; LATIN SMALL LETTER O WITH CIRCUMFLEX AND TILDE
+ ("O64" ?\e,22\e(B)      ; LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND TILDE
+ ("o65" ?\e,15\e(B)      ; LATIN SMALL LETTER O WITH CIRCUMFLEX AND DOT BELO7
+ ("O65" ?\e,25\e(B)      ; LATIN CAPITAL LETTER O WITH CIRCUMFLEX AND DOT BELO7
+ ("o71" ?\e,1>\e(B)      ; LATIN SMALL LETTER O WITH HORN AND ACUTE
+ ("O71" ?\e,2>\e(B)      ; LATIN CAPITAL LETTER O WITH HORN AND ACUTE
+ ("o72" ?\e,16\e(B)      ; LATIN SMALL LETTER O WITH HORN AND GRAVE
+ ("O72" ?\e,26\e(B)      ; LATIN CAPITAL LETTER O WITH HORN AND GRAVE
+ ("o73" ?\e,17\e(B)      ; LATIN SMALL LETTER O WITH HORN AND HO6K ABOVE
+ ("O73" ?\e,27\e(B)      ; LATIN CAPITAL LETTER O WITH HORN AND HO6K ABOVE
+ ("o74" ?\e,1^\e(B)      ; LATIN SMALL LETTER O WITH HORN AND TILDE
+ ("O74" ?\e,2^\e(B)      ; LATIN CAPITAL LETTER O WITH HORN AND TILDE
+ ("o75" ?\e,1~\e(B)      ; LATIN SMALL LETTER O WITH HORN AND DOT BELO7
+ ("O75" ?\e,2~\e(B)      ; LATIN CAPITAL LETTER O WITH HORN AND DOT BELO7
+ ("u5" ?\e,1x\e(B)       ; LATIN SMALL LETTER U WITH DOT BELO7
+ ("U5" ?\e,2x\e(B)       ; LATIN CAPITAL LETTER U WITH DOT BELO7
+ ("u3" ?\e,1|\e(B)       ; LATIN SMALL LETTER U WITH HO6K ABOVE
+ ("U3" ?\e,2|\e(B)       ; LATIN CAPITAL LETTER U WITH HO6K ABOVE
+ ("u71" ?\e,1Q\e(B)      ; LATIN SMALL LETTER U WITH HORN AND ACUTE
+ ("U71" ?\e,2Q\e(B)      ; LATIN CAPITAL LETTER U WITH HORN AND ACUTE
+ ("u72" ?\e,1W\e(B)      ; LATIN SMALL LETTER U WITH HORN AND GRAVE
+ ("U72" ?\e,2W\e(B)      ; LATIN CAPITAL LETTER U WITH HORN AND GRAVE
+ ("u73" ?\e,1X\e(B)      ; LATIN SMALL LETTER U WITH HORN AND HO6K ABOVE
+ ("U73" ?\e,2X\e(B)      ; LATIN CAPITAL LETTER U WITH HORN AND HO6K ABOVE
+ ("u74" ?\e,1f\e(B)      ; LATIN SMALL LETTER U WITH HORN AND TILDE
+ ("U74" ?\e,2f\e(B)      ; LATIN CAPITAL LETTER U WITH HORN AND TILDE
+ ("u75" ?\e,1q\e(B)      ; LATIN SMALL LETTER U WITH HORN AND DOT BELO7
+ ("U75" ?\e,2q\e(B)      ; LATIN CAPITAL LETTER U WITH HORN AND DOT BELO7
+ ("y2" ?\e,1O\e(B)       ; LATIN SMALL LETTER Y WITH GRAVE
+ ("Y2" ?\e,2O\e(B)       ; LATIN CAPITAL LETTER Y WITH GRAVE
+ ("y5" ?\e,1\\e(B)       ; LATIN SMALL LETTER Y WITH DOT BELO7
+ ("Y5" ?\e,2\\e(B)       ; LATIN CAPITAL LETTER Y WITH DOT BELO7
+ ("y3" ?\e,1V\e(B)       ; LATIN SMALL LETTER Y WITH HO6K ABOVE
+ ("Y3" ?\e,2V\e(B)       ; LATIN CAPITAL LETTER Y WITH HO6K ABOVE
+ ("y4" ?\e,1[\e(B)       ; LATIN SMALL LETTER Y WITH TILDE
+ ("Y4" ?\e,2[\e(B)       ; LATIN CAPITAL LETTER Y WITH TILDE
+ ("d9" ?\e,1p\e(B)       ; LATIN SMALL LETTER D WITH STROKE
+ ("D9" ?\e,2p\e(B)       ; LATIN CAPITAL LETTER D WITH STROKE
+;("$$" ?\e$,1tK\e(B)     ; U+20AB DONG SIGN (#### check)
+
+ ("a22" ["a22"])
+ ("A22" ["A2"])
+ ("a11" ["a1"])
+ ("A11" ["A1"])
+ ("a66"' ["a6"])
+ ("A66"' ["A6"])
+ ("a44" ["a4"])
+ ("A44" ["A4"])
+ ("e22" ["e2"])
+ ("E22" ["E2"])
+ ("e11" ["e1"])
+ ("E11" ["E1"])
+ ("e66" ["e6"])
+ ("E66" ["E6"])
+ ("i22" ["i2"])
+ ("I22" ["I2"])
+ ("i11" ["i1"])
+ ("I11" ["I1"])
+ ("o22" ["o2"])
+ ("O22" ["O2"])
+ ("o11" ["o1"])
+ ("O11" ["O1"])
+ ("o66" ["o6"])
+ ("O66" ["O6"])
+ ("o44" ["o4"])
+ ("O44" ["O4"])
+ ("u22" ["u2"])
+ ("U22" ["U2"])
+ ("u11" ["u1"])
+ ("U11" ["U1"])
+ ("y11" ["y1"])
+ ("Y11" ["Y1"])
+ ("a88" ["a8"])
+ ("A88" ["A8"])
+ ("i44" ["i4"])
+ ("I44" ["I4"])
+ ("u44" ["u4"])
+ ("U44" ["u4"])
+ ("o77" ["o7"])
+ ("O77" ["O7"])
+ ("u77" ["u7"])
+ ("U77" ["U7"])
+ ("a55" ["a5"])
+ ("A55" ["A5"])
+ ("a33" ["a3"])
+ ("A33" ["A3"])
+ ("e55" ["e5"])
+ ("E55" ["E5"])
+ ("e33" ["e3"])
+ ("E33" ["E3"])
+ ("e44" ["e4"])
+ ("E44" ["E4"])
+ ("i33" ["i3"])
+ ("I33" ["I3"])
+ ("i55" ["i5"])
+ ("I55" ["I5"])
+ ("o55" ["o5"])
+ ("O55" ["O5"])
+ ("o33" ["o3"])
+ ("O33" ["O3"])
+ ("u55" ["u5"])
+ ("U55" ["U5"])
+ ("u33" ["u3"])
+ ("U33" ["U3"])
+ ("y22" ["y2"])
+ ("Y22" ["Y2"])
+ ("y55" ["y5"])
+ ("Y55" ["Y5"])
+ ("y33" ["y3"])
+ ("Y33" ["Y3"])
+ ("y44" ["y4"])
+ ("Y44" ["Y4"])
+ ("d9"  ["d9"])
+ ("D99" ["D9"])
+;("$$$" ["$$"])
+
+ ;; escape from composition
+ ("\\1" ?1)
+ ("\\2" ?2)
+ ("\\3" ?3)
+ ("\\4" ?4)
+ ("\\5" ?5)
+ ("\\6" ?6)
+ ("\\7" ?7)
+ ("\\8" ?8)
+ ("\\9" ?9)
+ ("\\\\" ?\\)) ; literal backslash
+
+
+;; Local Variables:
+;; coding: iso-2022-7bit
+;; End:
index bdb6058c09aa66db8f2c985c9b264cfbd9875626..4f4d2b50a003825be7ea2ac995890aefdf417012 100644 (file)
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-12  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * Version 24.1 released.
+       * movemail.c: Add missing 'defined'.
+       Suggested by Sven Joachim in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00218.html>.
 
-2012-05-29  Eli Zaretskii  <eliz@gnu.org>
+2012-07-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port 'movemail' again to Solaris and similar hosts.
+       See Susan Cragin's report in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00199.html>.
+       * movemail.c (xmalloc): Also define if !DISABLE_DIRECT_ACCESS &&
+       !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.  Move up, so it doesn't
+       need a forward declaration.
+       (main): Rewrite to avoid no-longer-present function 'concat', if
+       !DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK.
+
+       Assume strerror.
+       * emacsclient.c, movemail.c, update-game-score.c (strerror)
+       [!HAVE_STRERROR]: Remove.
+
+2012-07-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       EMACS_TIME simplification (Bug#11875).
+       * profile.c (TV2): Remove no-longer-needed static var.
+
+       Simplify by avoiding confusing use of strncpy etc.
+       * etags.c (write_classname, C_entries):
+       Use sprintf rather than strncpy or strncat.
+       * etags.c (consider_token, C_entries, HTML_labels, Prolog_functions)
+       (Erlang_functions, substitute, readline_internal, savenstr):
+       * movemail.c (mail_spool_name):
+       Use memcpy rather than strncpy or strncat when either will do.
+       * make-docfile.c (write_c_args):
+       Use memcmp rather than strncmp when either will do.
+       * movemail.c (pop_retr):
+       * pop.c (pop_stat, pop_list, pop_multi_first, pop_last)
+       (socket_connection, pop_getline, sendline, getok):
+       Use snprintf rather than strncpy or strncat.
+       * movemail.c (concat): Remove; no longer needed.
+       (xmalloc): Define only if needed, now that concat has gone away.
+       Return void *.  All uses changed.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Add GCC-style 'const' attribute to functions that can use it.
+       * etags.c (number_len): Add ATTRIBUTE_CONST.
+
+2012-07-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacsclient.c (w32_execvp): Declare execvp to silence the compiler.
+
+2012-07-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/test-distrib.exe): Use LIB_SRC, not SRC.
+       (LIB_SRC, NT_INC, GNU_LIB, MS_W32_H, CONFIG_H, INTTYPES_H, NTLIB_H)
+       (SYSTIME_H): New macros.
+       (SRC): Redefine to point to src/, not current directory.
+       ($(BLD)/ctags.$(O), $(BLD)/ebrowse.$(O), $(BLD)/emacsclient.$(O))
+       ($(BLD)/etags.$(O), $(BLD)/hexl.$(O), $(BLD)/make-docfile.$(O))
+       ($(BLD)/movemail.$(O), $(BLD)/ntlib.$(O), $(BLD)/pop.$(O))
+       ($(BLD)/profile.$(O), $(BLD)/test-distrib.$(O)): Update dependencies.
+       ($(BLD)/regex.$(O)): New dependency.
+
+2012-07-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (ALL): Add profile.exe.
+       (PROFILEOBJS): New macro.
+       ($(BLD)/profile.exe): New target.
+       (install): Copy profile.exe.
+       ($(BLD)/alloca.$(O), $(BLD)/tcp.$(O)): Remove, obsolete.
+
+2012-07-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/etags.$(O)):
+       Update dependencies.
+
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786).
+       * etags.c: Include c-strcase.h.
+       (etags_strcasecmp, etags_strncasecmp): Remove.
+       All uses replaced with c_strcasecmp and c_strncasecmp.
+
+2012-07-06  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * make-docfile.c (write_globals): Warn about duplicate function
+       definitions with differing signatures.
+
+2012-07-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * make-docfile.c (scan_c_file): Suppress GCC warning.
+
+2012-06-29  Tom Tromey  <tromey@redhat.com>
+
+       * make-docfile.c (enum global_type) <FUNCTION>: New constant.
+       (struct global) <value>: New field.
+       (add_global): Add 'value' argument.
+       (compare_globals): Sort functions at the end.
+       (close_emacs_globals): New function.
+       (write_globals): Handle functions.
+       (scan_c_file): Call add_global for DEFUN.
+
+2012-06-30  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (CTAGS_CFLAGS): Remove EMACS_NAME;
+       already defined in ETAGS_CFLAGS.
+
+2012-06-27  Glenn Morris  <rgm@gnu.org>
+
+       * makefile.w32-in (lisp2): Remove paths.el.
+
+2012-06-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Clean out last vestiges of the old HAVE_CONFIG_H stuff.
+       * Makefile.in (BASE_CFLAGS):
+       * makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H.
+       * etags.c, hexl.c, pop.c: Include <config.h> unconditionally.
+       * etags.c (DOS_NT):
+       * pop.c (MAIL_USE_POP, h_errno):
+       Remove code that was conditioned on !HAVE_CONFIG_H.
+
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * etags.c (etags_strcasecmp, etags_strncasecmp): Define to
+       library functions strcasecmp and strncasecmp if available.
+
+2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
+       * ebrowse.c (usage, version):
+       * emacsclient.c (print_help_and_exit, fail):
+       * etags.c (suggest_asking_for_help, fatal, pfatal):
+       * hexl.c (usage):
+       * make-docfile.c (fatal):
+       * movemail.c (fatal, pfatal_with_name, pfatal_and_delete):
+       * update-game-score.c (usage):
+       * ebrowse.c (usage, version):
+       * emacsclient.c (print_help_and_exit, fail):
+       Use _Noreturn rather than NO_RETURN.
+       No need for separate decl merely because of _Noreturn.
+
+2012-06-24  Samuel Bronson  <naesten@gmail.com>  (tiny change)
+
+       * emacsclient.c (set_local_socket): Fix compiler warning (Bug#7838).
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Support higher-resolution time stamps (Bug#9000).
+       * Makefile.in (LIB_CLOCK_GETTIME): New macro.
+       (profile${EXEEXT}): Use it.
+       * profile.c: Include inttypes.h, intprops.h.
+       (time_string): Size conservatively; do not guess size.
+       (get_time): Now prints nanoseconds.
+       (gettimeofday): Remove replacement function; gnulib now does this.
+
+2012-06-08  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * make-docfile.c (search_lisp_doc_at_eol): Unget last read
+       character.
+
+2012-06-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (STAMP_INST_SCRIPTS, STAMP_SCRIPTS, insrcdir)
+       (stamp-rcs2log, stamp-grep-changelog): Remove.
+       (all, clean): Remove references to stamps.
+
+       * vcdiff: Remove file.
+       * Makefile.in (SCRIPTS, STAMP_SCRIPTS): Remove vcdiff.
+       (stamp-vcdiff): Remove.
+
+2012-06-05  Glenn Morris  <rgm@gnu.org>
+
+       * makefile.w32-in ($(BLD)/getdate.$(O), $(BLD)/leditcfns.$(O)):
+       ($(BLD)/make-path.$(O), $(BLD)/qsort.$(O)):
+       ($(BLD)/timer.$(O)): Remove cruft.
+
+2012-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * rcs-checkin: Remove file.
+       * Makefile.in (INSTALLABLE_SCRIPTS, STAMP_INST_SCRIPTS):
+       Remove rcs-checkin.
+       (stamp-rcs-checkin): Remove.
+
+2012-05-31  Eli Zaretskii  <eliz@gnu.org>
 
        * makefile.w32-in ($(BLD)/emacsclientw.exe): Use $(MWINDOWS)
        instead of a literal -mwindows, which is not supported by MSVC.
        (Bug#11405)
 
+2012-05-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * make-docfile.c: Improve comment style.
+       (search_lisp_doc_at_eol): New function.
+       (scan_lisp_file): Use it.
+
+2012-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (INSTALL_DATA): Remove; unused.
+
+2012-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove src/m/*.
+       * makefile.w32-in: Remove dependencies on
+       $(EMACS_ROOT)/src/m/intel386.h.
+
+2012-05-22  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install): Remove unneeded chmods.
+
+2012-05-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Assume C89 or later.
+       * etags.c (static, const): Remove macros.
+       (PTR): Remove; all uses replaced with void *.  Omit needless casts.
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (insrcdir, $(DESTDIR)${archlibdir}):
+       Scrap superfluous subshells.
+
+2012-05-18  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (install): Ensure $bindir exists.
+
+2012-05-17  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (ns_appbindir): New, set by configure.
+
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (MKDIR_P): New, set by configure.
+       ($(DESTDIR)${archlibdir}): Use $MKDIR_P.
+
+2012-05-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       etags: pacify gcc -Wstack-protector on Ubuntu 12.04 x86
+       * etags.c: Include <stdarg.h>.
+       (error): Declare as printf-style, as that's what it really is.
+       All uses changed.
+       (add_regex): Use single char rather than array-of-one char.
+
+2012-05-05  Jim Meyering  <meyering@redhat.com>
+
+       * lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last):
+       NUL-terminate the error buffer (Bug#11372).
+
 2012-05-02  Juanma Barranquero  <lekktu@gmail.com>
 
        * emacsclient.c (min): Undef before redefining it.
        * emacsclient.c (send_to_emacs): Avoid invalid strcpy upon partial
        send (Bug#11374).
 
-       * lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last):
-       NUL-terminate the error buffer (Bug#11372).
+2012-04-29  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * make-docfile.c (scan_lisp_file) [DEBUG]: Also skip if and
+       byte-code forms.  (Bug#11380)
 
-2012-04-15  Chong Yidong  <cyd@gnu.org>
+2012-04-20  Chong Yidong  <cyd@gnu.org>
 
        * emacsclient.c (decode_options): Move -t -n corner case handling
        into server.el (Bug#11102).
+       (main): Send -tty to Emacs under more circumstances (Bug#8314).
+
+2012-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       configure: new option --enable-gcc-warnings (Bug#11207)
+       * Makefile.in (C_WARNINGS_SWITCH): Remove.
+       (WARN_CFLAGS, WERROR_CFLAGS): New macros.
+       (BASE_CFLAGS): Use new macros rather than old.
+
+2012-04-16  Paul Eggert  <eggert@cs.ucla.edu>
 
-2012-04-12  Juanma Barranquero  <lekktu@gmail.com>
+       Assume less-ancient POSIX support.
+       * update-game-score.c: Include <getopt.h> rather than rolling our
+       own decls for optarg, optind, opterr.  See
+       <http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html>.
+
+2012-04-14  Juanma Barranquero  <lekktu@gmail.com>
 
        * emacsclient.c (decode_options) [WINDOWSNT]:
        Call ttyname instead of passing its address (typo in 2011-12-04T17:13:01Z!lekktu@gmail.com).
 
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (obj): Add xml.o.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (ALL): Now the list of executables, not of phony
+       targets.
+       (.PHONY): Only make-docfile is its prerequisite now.
+       (make-docfile): Don't depend on stamp_BLD.  Add a comment about
+       the need in this target.
+       (ctags, etags, ebrowse, hexl, movemail, emacsclient)
+       (test-distrib): Phony targets removed.
+       ($(BLD)/test-distrib.exe): Run test-distrib as part of the recipe.
+       (all): Don't depend on stamp_BLD.
+       (ALL): Include $(BLD)/test-distrib.exe.
+
 2012-03-11  Andreas Schwab  <schwab@linux-m68k.org>
 
        * emacsclient.c (main): Handle -print-nonl command.
        * makefile.w32-in (LOCAL_FLAGS): Add $(EMACS_EXTRA_C_FLAGS).
 
        * emacsclient.c (main) <environ>: Remove declaration, already
-       pulled in by unistd.h on Posix hosts and stdlib.h on MS-Windows.
+       pulled in by unistd.h on POSIX hosts and stdlib.h on MS-Windows.
 
 2011-11-24  Glenn Morris  <rgm@gnu.org>
 
 
        * etags.c (canonicalize_filename, ISUPPER): Fix last change.
 
-       * makefile.w32-in ($(BLD)/ebrowse.$(O), $(BLD)/pop.$(O)): Depend
-       on ../lib/min-max.h.
+       * makefile.w32-in ($(BLD)/ebrowse.$(O), $(BLD)/pop.$(O)):
+       Depend on ../lib/min-max.h.
 
 2011-02-22  Paul Eggert  <eggert@cs.ucla.edu>
 
 
        * make-docfile.c (read_c_string_or_comment): Declare msgno.
 
-       * Makefile.in (YACC): Deleted.
+       * Makefile.in (YACC): Delete.
 
 2002-10-19  Andreas Schwab  <schwab@suse.de>
 
        (TeX_commands): Names now include the initial backslash.
        (TeX_commands): Names do not include numeric args #n.
        (TeX_commands): Correct line char number in tags.
-       (TEX_tabent, TEX_token): Deleted.
+       (TEX_tabent, TEX_token): Delete.
        (TeX_commands, TEX_decode_env): Streamlined.
 
 2002-06-05  Francesco Potortì  <pot@gnu.org>
        (main): New argument -d, for specifying directory.
        (usage): Document.
        (get_user_id): Compute.
-       (get_home_dir): Deleted.
+       (get_home_dir): Delete.
        (get_prefix): New function, taken from main.
        (main): Check whether or not we are running setuid.  Move prefix
        computation to get_prefix.  Don't call getpwent; we don't need to
        (LOOKING_AT, get_tag, PHP_functions): Use notinname.
        (Ada_getit, Ada_funcs, Python_functions, Scheme_functions):
        Clarified, using strneq or notinname.
-       (L_isdef, L_isquote): Removed.
+       (L_isdef, L_isquote): Remove.
        (Lisp_functions, L_getit): Clarified.
 
        * etags.c (P_): Rename to __P for consistency with config.h.
        comma when --declarations is used.
        (C_entries): More accurate tagging of members and declarations.
        (yacc_rules): Was global, made local to C_entries.
-       (next_token_is_func): Removed.
+       (next_token_is_func): Remove.
        (fvdef): New constants fdefunkey, fdefunname.
        (consider_token, C_entries): Use them.
        (C_entries): Build proper lisp names for Emacs DEFUNs.
        (find_entries, takeprec, getit, Fortran_functions, Perl_functions)
        (Python_functions, L_getit, Lisp_functions, Scheme_functions)
        (prolog_pred, erlanf_func, erlang_attribute): Use them.
-       (eat_white): Deleted.
+       (eat_white): Delete.
 
        * etags.c (CHAR, init): Keep into account non US-ASCII
        characters and compilers with default signed chars.
 1997-05-13  Francesco Potortì  <F.Potorti@cnuce.cnr.it>
 
        * etags.c (TeX_functions): Cleaned up.
-       (tex_getit): Removed.
+       (tex_getit): Remove.
 
 1997-05-13  Paul Eggert  <eggert@twinsun.com>
 
 
        * etags.c: Prolog language totally rewritten.
        (Prolog_functions): Rewritten from scratch.
-       (skip_comment, prolog_getit): Removed.
+       (skip_comment, prolog_getit): Remove.
        (prolog_skip_comment): New function, like old skip_comment.
        (prolog_pred, prolog_atom, prolog_white): New functions.
        (erlang_func, erlang_attributes): Forward declarations added.
 
 1995-01-12  Francesco Potortì  (pot@cnuce.cnr.it)
 
-       * etags.c (FILEPOS, GET_CHARNO, GET_FILEPOS, max, LINENO): Deleted.
+       * etags.c (FILEPOS, GET_CHARNO, GET_FILEPOS, max, LINENO): Delete.
        (append_to_tagfile, typedefs, typedefs_and_cplusplus)
        (constantypedefs, update, vgrind_style, no_warnings)
        (cxref_style, cplusplus, noindentypedefs): Were int, now logical.
        (consider_token): Don't take a token as argument.  Use savenstr
        when saving a tag in structtag.  Callers changed.
        (TOKEN): Structure changed.  Now used only in C_entries.
-       (TOKEN_SAVED_P, SAVE_TOKEN, RESTORE_TOKEN): Deleted.
+       (TOKEN_SAVED_P, SAVE_TOKEN, RESTORE_TOKEN): Delete.
        (C_entries): nameb and savenameb deleted.  Use dinamic allocation.
-       (pfcnt): Deleted.  Users updated.
+       (pfcnt): Delete.  Users updated.
        (getit, Asm_labels, Pascal_functions, L_getit, get_scheme)
        (TEX_getit, prolog_getit): Use dinamic allocation for storing
        the tag instead of a fixed size buffer.
 
 1994-03-25  Francesco Potortì  (pot@cnuce.cnr.it)
 
-       * etags.c (emacs_tags_format, ETAGS): Removed.  Use CTAGS instead.
+       * etags.c (emacs_tags_format, ETAGS): Remove.  Use CTAGS instead.
        (main): Don't allow the use of -t and -T in etags mode.
        (print_help): Don't show options enabled by default.
        (print_version): Show the emacs version number if VERSION is #defined.
 1994-01-14  Francesco Potortì  (pot@cnuce.cnr.it)
 
        * etags.c (stab_entry, stab_create, stab_find, stab_search,
-       stab_type, add_keyword, C_reate_stab, C_create_stabs): Deleted.
+       stab_type, add_keyword, C_reate_stab, C_create_stabs): Delete.
        Use gperf generated hash table instead of linked list.
-       (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Added.
+       (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Add.
        Mostly code generated by gperf.
        (consider_token): Remove unused parameter `lp'.
        (PF_funcs, getit): Allow subroutine and similar declarations
 
 1993-08-25  Paul Eggert  (eggert@twinsun.com)
 
-       * rcs2log: Change /{/ to /\{/ for Posix ERE compatibility;
+       * rcs2log: Change /{/ to /\{/ for POSIX ERE compatibility;
        otherwise, HP awk complains.
 
        * vcdiff: Append /usr/ccs/bin and /usr/sccs to PATH, since these
        * etags.c (consider_token): Was `==', now is `='.
        (consider_token): DEFUNs now treated like funcs in ctags mode.
 
-       * etags.c (LEVEL_OK_FOR_FUNCDEF): Removed.
+       * etags.c (LEVEL_OK_FOR_FUNCDEF): Remove.
        (C_entries): Optimized the test that used LEVEL_OK_FOR_FUNCDEF.
        (C_entries): Remove a piece of useless code.
        (C_entries): Making typedef tags is delayed until a semicolon
 
        * rcs2log: mawk, SunOS 4.1.3 nawk, and Ultrix/MKS nawk all barf on
        /[/]/, so change it to /[\/]/.  This should work on all
-       Posix-compliant awks.  It's slightly wrong with traditional awk,
+       POSIX-compliant awks.  It's slightly wrong with traditional awk,
        since it matches \ too, but that's a minor problem compared to awk
        syntax errors.
 
        * etags.c (GET_COOKIE): And related macros removed.
        (logical): Is now int, no more a char.
        (reg): Define deleted.
-       (isgood, _gd, notgd): Deleted.
-       (gotone): Deleted.
+       (isgood, _gd, notgd): Delete.
+       (gotone): Delete.
        (TOKEN): Member linestart removed.
-       (linepos, prev_linepos, lb1): Deleted.
+       (linepos, prev_linepos, lb1): Delete.
        (main): Call initbuffer on lbs array instead of lb1.
        (init): Remove the initialization of the logical _gd array.
        (find_entries): A .sa suffix means assembler file.
        All C state machines rewritten.
        (C_entries): Complete rewrite.
        (condider_token): Complete rewrite.
-       (getline): Deleted.
+       (getline): Delete.
 
 1993-03-01  Francesco Potortì  (pot@fly.CNUCE.CNR.IT)
 
index cc1757e4e3bba27fe1abb271d886570f691a8a38..fe727c65730ec5947caecf9d293ddb0398dad3af 100644 (file)
@@ -36,14 +36,19 @@ configuration=@configuration@
 EXEEXT=@EXEEXT@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
-C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
 PROFILING_CFLAGS = @PROFILING_CFLAGS@
+WARN_CFLAGS = @WARN_CFLAGS@
+WERROR_CFLAGS = @WERROR_CFLAGS@
 
 # Program name transformation.
 TRANSFORM = @program_transform_name@
 
 # ==================== Where To Install Things ====================
 
+# Location to install Emacs.app under GNUstep / Mac OS X.
+# Later values may use this.
+ns_appbindir=@ns_appbindir@
+
 # The default location for installation.  Everything is placed in
 # subdirectories of this directory.  The default values for many of
 # the variables below are expressed in terms of this one, so you may
@@ -101,10 +106,10 @@ gameuser=@gameuser@
 # ../configure figures out the correct values for these.
 INSTALL = @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
 INSTALL_SCRIPT = @INSTALL_SCRIPT@
 # By default, we uphold the dignity of our programs.
 INSTALL_STRIP =
+MKDIR_P = @MKDIR_P@
 
 # ========================== Lists of Files ===========================
 
@@ -112,8 +117,7 @@ INSTALL_STRIP =
 INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \
                ebrowse${EXEEXT}
 
-INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog
-STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog
+INSTALLABLE_SCRIPTS = grep-changelog
 
 # Things that Emacs runs internally, or during the build process,
 #  which should not be installed in bindir.
@@ -124,8 +128,7 @@ DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
 
 # Like UTILITIES, but they're not system-dependent, and should not be
 #  deleted by the distclean target.
-SCRIPTS= rcs2log vcdiff
-STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff
+SCRIPTS= rcs2log
 
 # All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
 EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
@@ -156,6 +159,8 @@ LIBHESIOD=@LIBHESIOD@
 LIBRESOLV=@LIBRESOLV@
 ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL
 LIBS_MAIL=@LIBS_MAIL@
+## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
+LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
 
 ## Extra libraries to use when linking movemail.
 LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
@@ -164,43 +169,20 @@ LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
 ## Some systems define this to request special libraries.
 LIBS_SYSTEM = @LIBS_SYSTEM@
 
-# Those files shared with other GNU utilities need HAVE_CONFIG_H
-# defined before they know they can take advantage of the information
-# in ../src/config.h.
-BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \
-             -DHAVE_CONFIG_H -I. -I../src -I../lib \
+BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
+             $(WARN_CFLAGS) $(WERROR_CFLAGS) \
+             -I. -I../src -I../lib \
              -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
 
 ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
 LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
 CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
 
-all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
+all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}
 
 LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
 $(EXE_FILES): ../lib/libgnu.a
 
-## These targets copy the scripts into the build directory so that
-## they can be run from there in an uninstalled Emacs.
-## Nothing to do if pwd = srcdir.
-insrcdir=[ "`/bin/pwd`" = "`(cd $(srcdir) && /bin/pwd)`" ]
-
-stamp-rcs2log: $(srcdir)/rcs2log
-       $(insrcdir) || cp -p $(srcdir)/rcs2log rcs2log
-       touch $@
-
-stamp-rcs-checkin: $(srcdir)/rcs-checkin
-       $(insrcdir) || cp -p $(srcdir)/rcs-checkin rcs-checkin
-       touch $@
-
-stamp-grep-changelog: $(srcdir)/grep-changelog
-       $(insrcdir) || cp -p $(srcdir)/grep-changelog grep-changelog
-       touch $@
-
-stamp-vcdiff: $(srcdir)/vcdiff
-       $(insrcdir) || cp -p $(srcdir)/vcdiff vcdiff
-       touch $@
-
 ## Only used if we need blessmail, but no harm in always defining.
 ## This makes the actual blessmail executable.
 blessmail:
@@ -229,21 +211,21 @@ maybe-blessmail: $(BLESSMAIL_TARGET)
 $(DESTDIR)${archlibdir}: all
        @echo
        @echo "Installing utilities run internally by Emacs."
-       umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${archlibdir}
-       if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
+       umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir}
+       if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` != `/bin/pwd` ]; then \
          for file in ${UTILITIES}; do \
            $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
          done ; \
         fi
-       umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${gamedir}; \
+       umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \
        touch $(DESTDIR)${gamedir}/snake-scores; \
        touch $(DESTDIR)${gamedir}/tetris-scores
        -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
          chown ${gameuser} $(DESTDIR)${gamedir}; \
          chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
        fi
-       if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \
-             != `(cd ${srcdir} && /bin/pwd)` ]; then \
+       if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` \
+             != `cd ${srcdir} && /bin/pwd` ]; then \
          for file in ${SCRIPTS}; do \
            $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \
          done ; \
@@ -252,13 +234,12 @@ $(DESTDIR)${archlibdir}: all
 install: $(DESTDIR)${archlibdir}
        @echo
        @echo "Installing utilities for users to run."
+       umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
        for file in ${INSTALLABLES} ; do \
          $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
-         chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
        done
        for file in ${INSTALLABLE_SCRIPTS} ; do \
          $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`  ; \
-         chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \
        done
 
 uninstall:
@@ -276,7 +257,6 @@ mostlyclean:
 
 clean: mostlyclean
        -rm -f ${EXE_FILES}
-       -rm -f ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
 
 distclean: clean
        -rm -f TAGS
@@ -328,7 +308,8 @@ ctags${EXEEXT}: etags${EXEEXT}
          regex.o $(LOADLIBES) -o ctags
 
 profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
-       $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
+       $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
+         $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile
 
 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
        $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
index a1fe10b863a20fb923723204a2766aa14611b6e7..1c43bc6a4f1c785483934ead032569a3587381c5 100644 (file)
@@ -463,10 +463,6 @@ static struct member *add_member (struct sym *, char *, int, int, unsigned);
 static void class_definition (struct sym *, int, int, int);
 static char *operator_name (int *);
 static void parse_qualified_param_ident_or_type (char **);
-static void usage (int) NO_RETURN;
-static void version (void) NO_RETURN;
-
-
 \f
 /***********************************************************************
                              Utilities
@@ -3507,7 +3503,7 @@ Usage: ebrowse [options] {files}\n\
       --version                        display version info\n\
 "
 
-static void
+static _Noreturn void
 usage (int error)
 {
   puts (USAGE);
@@ -3522,7 +3518,7 @@ usage (int error)
 # define VERSION "21"
 #endif
 
-static void
+static _Noreturn void
 version (void)
 {
   /* Makes it easier to update automatically. */
index c2b0a80c67058875b564417301457cb7b4ae5efc..0ba6535b79d26559d950383730b87eadf3d7d824 100644 (file)
@@ -21,7 +21,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifdef WINDOWSNT
 
-/* config.h defines these, which disables sockets altogether! */
+/* ms-w32.h defines these, which disables sockets altogether!  */
 # undef _WINSOCKAPI_
 # undef _WINSOCK_H
 
@@ -169,8 +169,7 @@ int emacs_pid = 0;
    be used for the new frame */
 const char *frame_parameters = NULL;
 
-static void print_help_and_exit (void) NO_RETURN;
-static void fail (void) NO_RETURN;
+static _Noreturn void print_help_and_exit (void);
 
 
 struct option longopts[] =
@@ -452,19 +451,19 @@ w32_window_app (void)
   return window_app;
 }
 
-/*
-  execvp wrapper for Windows.  Quotes arguments with embedded spaces.
+/* execvp wrapper for Windows.  Quotes arguments with embedded spaces.
 
   This is necessary due to the broken implementation of exec* routines in
   the Microsoft libraries: they concatenate the arguments together without
   quoting special characters, and pass the result to CreateProcess, with
   predictably bad results.  By contrast, POSIX execvp passes the arguments
-  directly into the argv array of the child process.
-*/
+  directly into the argv array of the child process.  */
+
 int
 w32_execvp (const char *path, char **argv)
 {
   int i;
+  extern int execvp (const char*, char **);
 
   /* Required to allow a .BAT script as alternate editor.  */
   argv[0] = (char *) alternate_editor;
@@ -670,7 +669,7 @@ an empty string");
 }
 
 \f
-static void
+static _Noreturn void
 print_help_and_exit (void)
 {
   /* Spaces and tabs are significant in this message; they're chosen so the
@@ -713,12 +712,11 @@ Report bugs with M-x report-emacs-bug.\n", progname);
   exit (EXIT_SUCCESS);
 }
 
-/*
-  Try to run a different command, or --if no alternate editor is
-  defined-- exit with an errorcode.
-  Uses argv, but gets it from the global variable main_argv.
-*/
-static void
+/* Try to run a different command, or --if no alternate editor is
+   defined-- exit with an errorcode.
+   Uses argv, but gets it from the global variable main_argv.  */
+
+static _Noreturn void
 fail (void)
 {
   if (alternate_editor)
@@ -751,16 +749,15 @@ main (int argc, char **argv)
 #define AUTH_KEY_LENGTH      64
 #define SEND_BUFFER_SIZE   4096
 
-extern char *strerror (int);
-
 /* Buffer to accumulate data to send in TCP connections.  */
 char send_buffer[SEND_BUFFER_SIZE + 1];
 int sblen = 0; /* Fill pointer for the send buffer.  */
 /* Socket used to communicate with the Emacs server process.  */
 HSOCKET emacs_socket = 0;
 
-/* On Windows, the socket library was historically separate from the standard
-   C library, so errors are handled differently.  */
+/* On Windows, the socket library was historically separate from the
+   standard C library, so errors are handled differently.  */
+
 static void
 sock_err_message (const char *function_name)
 {
@@ -865,7 +862,7 @@ quote_argument (HSOCKET s, const char *str)
 
 
 /* The inverse of quote_argument.  Removes quoting in string STR by
-   modifying the string in place.   Returns STR. */
+   modifying the string in place.   Returns STR.  */
 
 static char *
 unquote_argument (char *str)
@@ -948,10 +945,9 @@ initialize_sockets (void)
 #endif /* WINDOWSNT */
 
 \f
-/*
- * Read the information needed to set up a TCP comm channel with
- * the Emacs server: host, port, and authentication string.
- */
+/* Read the information needed to set up a TCP comm channel with
+   the Emacs server: host, port, and authentication string.  */
+
 static int
 get_server_config (const char *config_file, struct sockaddr_in *server,
                   char *authentication)
@@ -1032,18 +1028,14 @@ set_tcp_socket (const char *local_server_file)
     message (FALSE, "%s: connected to remote socket at %s\n",
              progname, inet_ntoa (server.sin_addr));
 
-  /*
-   * Open up an AF_INET socket
-   */
+  /* Open up an AF_INET socket.  */
   if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
     {
       sock_err_message ("socket");
       return INVALID_SOCKET;
     }
 
-  /*
-   * Set up the socket
-   */
+  /* Set up the socket.  */
   if (connect (s, (struct sockaddr *) &server, sizeof server) < 0)
     {
       sock_err_message ("connect");
@@ -1052,9 +1044,7 @@ set_tcp_socket (const char *local_server_file)
 
   setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg);
 
-  /*
-   * Send the authentication
-   */
+  /* Send the authentication.  */
   auth_string[AUTH_KEY_LENGTH] = '\0';
 
   send_to_emacs (s, "-auth ");
@@ -1188,7 +1178,7 @@ handle_sigcont (int signalnum)
    going to sleep.  Normally the suspend is initiated by Emacs via
    server-handle-suspend-tty, but if the server gets out of sync with
    reality, we may get a SIGTSTP on C-z.  Handling this signal and
-   notifying Emacs about it should get things under control again. */
+   notifying Emacs about it should get things under control again.  */
 
 static void
 handle_sigtstp (int signalnum)
@@ -1240,10 +1230,7 @@ set_local_socket (const char *local_socket_name)
   HSOCKET s;
   struct sockaddr_un server;
 
-  /*
-   * Open up an AF_UNIX socket in this person's home directory
-   */
-
+  /* Open up an AF_UNIX socket in this person's home directory.  */
   if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
     {
       message (TRUE, "%s: socket: %s\n", progname, strerror (errno));
@@ -1278,7 +1265,7 @@ set_local_socket (const char *local_socket_name)
             if (n > 0)
               {
                tmpdir = tmpdir_storage = xmalloc (n);
-                confstr (_CS_DARWIN_USER_TEMP_DIR, tmpdir, n);
+               confstr (_CS_DARWIN_USER_TEMP_DIR, tmpdir_storage, n);
               }
             else
 #endif
@@ -1477,10 +1464,9 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam)
   return FALSE;
 }
 
-/*
- * Search for a window of class "Emacs" and owned by a process with
- * process id = emacs_pid.  If found, allow it to grab the focus.
- */
+/* Search for a window of class "Emacs" and owned by a process with
+   process id = emacs_pid.  If found, allow it to grab the focus.  */
+
 void
 w32_give_focus (void)
 {
@@ -1665,10 +1651,10 @@ main (int argc, char **argv)
       send_to_emacs (emacs_socket, " ");
     }
 
-  /* If using the current frame, send tty information to Emacs anyway.
-     In daemon mode, Emacs may need to occupy this tty if no other
-     frame is available.  */
-  if (tty || (current_frame && !eval))
+  /* Unless we are certain we don't want to occupy the tty, send our
+     tty information to Emacs.  For example, in daemon mode Emacs may
+     need to occupy this tty if no other frame is available.  */
+  if (!current_frame || !eval)
     {
       const char *tty_type, *tty_name;
 
@@ -1862,22 +1848,3 @@ main (int argc, char **argv)
 }
 
 #endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */
-
-\f
-#ifndef HAVE_STRERROR
-char *
-strerror (errnum)
-     int errnum;
-{
-  extern char *sys_errlist[];
-  extern int sys_nerr;
-
-  if (errnum >= 0 && errnum < sys_nerr)
-    return sys_errlist[errnum];
-  return (char *) "Unknown error";
-}
-
-#endif /* ! HAVE_STRERROR */
-
-
-/* emacsclient.c ends here */
index c88473ad525de09b988a9b2e9da7b53a790aa013..69200b790fbaab6f58e0dda35501eebd09b35637 100644 (file)
@@ -91,25 +91,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 #  define NDEBUG               /* disable assert */
 #endif
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-  /* This is probably not necessary any more.  On some systems, config.h
-     used to define static as nothing for the sake of unexec.  We don't
-     want that here since we don't use unexec.  None of these systems
-     are supported any more, but the idea is still mentioned in
-     etc/PROBLEMS.  */
-# undef static
-# ifndef PTR                   /* for XEmacs */
-#   define PTR void *
-# endif
-#else  /* no config.h */
-# if defined (__STDC__) && (__STDC__ || defined (__SUNPRO_C))
-#   define PTR void *          /* for generic pointers */
-# else /* not standard C */
-#   define const               /* remove const for old compilers' sake */
-#   define PTR long *          /* don't use void* */
-# endif
-#endif /* !HAVE_CONFIG_H */
+#include <config.h>
 
 #ifndef _GNU_SOURCE
 # define _GNU_SOURCE 1         /* enables some compiler checks on GNU */
@@ -129,10 +111,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 # include <fcntl.h>
 # include <sys/param.h>
 # include <io.h>
-# ifndef HAVE_CONFIG_H
-#   define DOS_NT
-#   include <sys/config.h>
-# endif
 #else
 # define MSDOS FALSE
 #endif /* MSDOS */
@@ -158,6 +136,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 # endif
 #endif /* HAVE_UNISTD_H */
 
+#include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -165,6 +144,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <c-strcase.h>
 
 #include <assert.h>
 #ifdef NDEBUG
@@ -182,14 +162,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 # include <getopt.h>
 #endif /* NO_LONG_OPTIONS */
 
-#ifndef HAVE_CONFIG_H          /* this is a standalone compilation */
-# ifdef __CYGWIN__             /* compiling on Cygwin */
-                            !!! NOTICE !!!
- the regex.h distributed with Cygwin is not compatible with etags, alas!
-If you want regular expression support, you should delete this notice and
-             arrange to use the GNU regex.h and regex.c.
-# endif
-#endif
 #include <regex.h>
 
 /* Define CTAGS to make the program "ctags" compatible with the usual one.
@@ -203,9 +175,9 @@ If you want regular expression support, you should delete this notice and
 #endif
 
 #define streq(s,t)     (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t))
-#define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t))
+#define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=NULL), !c_strcasecmp (s, t))
 #define strneq(s,t,n)  (assert ((s)!=NULL || (t)!=NULL), !strncmp (s, t, n))
-#define strncaseeq(s,t,n) (assert ((s)!=NULL && (t)!=NULL), !etags_strncasecmp (s, t, n))
+#define strncaseeq(s,t,n) (assert ((s)!=NULL && (t)!=NULL), !c_strncasecmp (s, t, n))
 
 #define CHARS 256              /* 2^sizeof(char) */
 #define CHAR(x)                ((unsigned int)(x) & (CHARS - 1))
@@ -380,10 +352,10 @@ static void get_tag (char *, char **);
 static void analyse_regex (char *);
 static void free_regexps (void);
 static void regex_tag_multiline (void);
-static void error (const char *, const char *);
-static void suggest_asking_for_help (void) NO_RETURN;
-void fatal (const char *, const char *) NO_RETURN;
-static void pfatal (const char *) NO_RETURN;
+static void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
+static _Noreturn void suggest_asking_for_help (void);
+_Noreturn void fatal (const char *, const char *);
+static _Noreturn void pfatal (const char *);
 static void add_node (node *, node **);
 
 static void init (void);
@@ -404,8 +376,6 @@ static char *savenstr (const char *, int);
 static char *savestr (const char *);
 static char *etags_strchr (const char *, int);
 static char *etags_strrchr (const char *, int);
-static int etags_strcasecmp (const char *, const char *);
-static int etags_strncasecmp (const char *, const char *, int);
 static char *etags_getcwd (void);
 static char *relative_filename (char *, char *);
 static char *absolute_filename (char *, char *);
@@ -414,8 +384,8 @@ static bool filename_is_absolute (char *f);
 static void canonicalize_filename (char *);
 static void linebuffer_init (linebuffer *);
 static void linebuffer_setlen (linebuffer *, int);
-static PTR xmalloc (size_t);
-static PTR xrealloc (char *, size_t);
+static void *xmalloc (size_t);
+static void *xrealloc (char *, size_t);
 
 \f
 static char searchar = '/';    /* use /.../ searches */
@@ -1140,7 +1110,7 @@ main (int argc, char **argv)
       case 'o':
        if (tagfile)
          {
-           error ("-o option may only be given once.", (char *)NULL);
+           error ("-o option may only be given once.");
            suggest_asking_for_help ();
            /* NOTREACHED */
          }
@@ -1224,7 +1194,7 @@ main (int argc, char **argv)
 
   if (nincluded_files == 0 && file_count == 0)
     {
-      error ("no input files specified.", (char *)NULL);
+      error ("no input files specified.");
       suggest_asking_for_help ();
       /* NOTREACHED */
     }
@@ -1447,7 +1417,7 @@ get_language_from_langname (const char *name)
   language *lang;
 
   if (name == NULL)
-    error ("empty language name", (char *)NULL);
+    error ("empty language name");
   else
     {
       for (lang = lang_names; lang->name != NULL; lang++)
@@ -2153,7 +2123,7 @@ invalidate_nodes (fdesc *badfdp, node **npp)
 
 \f
 static int total_size_of_entries (node *);
-static int number_len (long);
+static int number_len (long) ATTRIBUTE_CONST;
 
 /* Length of a non-negative number's decimal representation. */
 static int
@@ -2233,7 +2203,7 @@ put_entries (register node *np)
        {
          /* Ctags mode */
          if (np->name == NULL)
-           error ("internal error: NULL name in ctags mode.", (char *)NULL);
+           error ("internal error: NULL name in ctags mode.");
 
          if (cxref_style)
            {
@@ -2672,17 +2642,11 @@ write_classname (linebuffer *cn, const char *qualifier)
     }
   for (i = 1; i < cstack.nl; i++)
     {
-      char *s;
-      int slen;
-
-      s = cstack.cname[i];
+      char *s = cstack.cname[i];
       if (s == NULL)
        continue;
-      slen = strlen (s);
-      len += slen + qlen;
-      linebuffer_setlen (cn, len);
-      strncat (cn->buffer, qualifier, qlen);
-      strncat (cn->buffer, s, slen);
+      linebuffer_setlen (cn, len + qlen + strlen (s));
+      len += sprintf (cn->buffer + len, "%s%s", qualifier, s);
     }
 }
 
@@ -2773,7 +2737,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
      case dignorerest:
        return FALSE;
      default:
-       error ("internal error: definedef value.", (char *)NULL);
+       error ("internal error: definedef value.");
      }
 
    /*
@@ -2897,7 +2861,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
           fvdef = fvnone;
           objdef = omethodtag;
           linebuffer_setlen (&token_name, len);
-          strncpy (token_name.buffer, str, len);
+          memcpy (token_name.buffer, str, len);
           token_name.buffer[len] = '\0';
           return TRUE;
         }
@@ -2909,10 +2873,11 @@ consider_token (register char *str, register int len, register int c, int *c_ext
      case omethodparm:
        if (parlev == 0)
         {
+          int oldlen = token_name.len;
           fvdef = fvnone;
           objdef = omethodtag;
-          linebuffer_setlen (&token_name, token_name.len + len);
-          strncat (token_name.buffer, str, len);
+          linebuffer_setlen (&token_name, oldlen + len);
+          memcpy (token_name.buffer + oldlen, str, len);
           return TRUE;
         }
        return FALSE;
@@ -3061,7 +3026,7 @@ make_C_tag (int isfun)
       make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""),
                token_name.len + 17, isfun, token.line,
                token.offset+token.length+1, token.lineno, token.linepos);
-      error ("INVALID TOKEN", NULL);
+      error ("INVALID TOKEN");
     }
 
   token.valid = FALSE;
@@ -3341,12 +3306,12 @@ C_entries (int c_ext, FILE *inf)
                              && nestlev > 0 && definedef == dnone)
                            /* in struct body */
                            {
+                             int len;
                               write_classname (&token_name, qualifier);
-                             linebuffer_setlen (&token_name,
-                                                token_name.len+qlen+toklen);
-                             strcat (token_name.buffer, qualifier);
-                             strncat (token_name.buffer,
-                                      newlb.buffer + tokoff, toklen);
+                             len = token_name.len;
+                             linebuffer_setlen (&token_name, len+qlen+toklen);
+                             sprintf (token_name.buffer + len, "%s%.*s",
+                                      qualifier, toklen, newlb.buffer + tokoff);
                              token.named = TRUE;
                            }
                          else if (objdef == ocatseen)
@@ -3354,11 +3319,8 @@ C_entries (int c_ext, FILE *inf)
                            {
                              int len = strlen (objtag) + 2 + toklen;
                              linebuffer_setlen (&token_name, len);
-                             strcpy (token_name.buffer, objtag);
-                             strcat (token_name.buffer, "(");
-                             strncat (token_name.buffer,
-                                      newlb.buffer + tokoff, toklen);
-                             strcat (token_name.buffer, ")");
+                             sprintf (token_name.buffer, "%s(%.*s)",
+                                      objtag, toklen, newlb.buffer + tokoff);
                              token.named = TRUE;
                            }
                          else if (objdef == omethodtag
@@ -3382,8 +3344,8 @@ C_entries (int c_ext, FILE *inf)
                                  len -= 1;
                                }
                              linebuffer_setlen (&token_name, len);
-                             strncpy (token_name.buffer,
-                                      newlb.buffer + off, len);
+                             memcpy (token_name.buffer,
+                                     newlb.buffer + off, len);
                              token_name.buffer[len] = '\0';
                              if (defun)
                                while (--len >= 0)
@@ -3394,8 +3356,8 @@ C_entries (int c_ext, FILE *inf)
                          else
                            {
                              linebuffer_setlen (&token_name, toklen);
-                             strncpy (token_name.buffer,
-                                      newlb.buffer + tokoff, toklen);
+                             memcpy (token_name.buffer,
+                                     newlb.buffer + tokoff, toklen);
                              token_name.buffer[toklen] = '\0';
                              /* Name macros and members. */
                              token.named = (structdef == stagseen
@@ -5191,7 +5153,7 @@ HTML_labels (FILE *inf)
                  for (end = dbp; *end != '\0' && intoken (*end); end++)
                    continue;
                linebuffer_setlen (&token_name, end - dbp);
-               strncpy (token_name.buffer, dbp, end - dbp);
+               memcpy (token_name.buffer, dbp, end - dbp);
                token_name.buffer[end - dbp] = '\0';
 
                dbp = end;
@@ -5291,7 +5253,7 @@ Prolog_functions (FILE *inf)
          else if (len + 1 > allocated)
            xrnew (last, len + 1, char);
          allocated = len + 1;
-         strncpy (last, cp, len);
+         memcpy (last, cp, len);
          last[len] = '\0';
        }
     }
@@ -5464,7 +5426,7 @@ Erlang_functions (FILE *inf)
          else if (len + 1 > allocated)
            xrnew (last, len + 1, char);
          allocated = len + 1;
-         strncpy (last, cp, len);
+         memcpy (last, cp, len);
          last[len] = '\0';
        }
     }
@@ -5706,7 +5668,7 @@ add_regex (char *regexp_pattern, language *lang)
 {
   static struct re_pattern_buffer zeropattern;
   char sep, *pat, *name, *modifiers;
-  char empty[] = "";
+  char empty = '\0';
   const char *err;
   struct re_pattern_buffer *patbuf;
   regexp *rp;
@@ -5719,7 +5681,7 @@ add_regex (char *regexp_pattern, language *lang)
 
   if (strlen (regexp_pattern) < 3)
     {
-      error ("null regexp", (char *)NULL);
+      error ("null regexp");
       return;
     }
   sep = regexp_pattern[0];
@@ -5738,7 +5700,7 @@ add_regex (char *regexp_pattern, language *lang)
   if (modifiers == NULL)       /* no terminating separator --> no name */
     {
       modifiers = name;
-      name = empty;
+      name = &empty;
     }
   else
     modifiers += 1;            /* skip separator */
@@ -5749,7 +5711,7 @@ add_regex (char *regexp_pattern, language *lang)
       {
       case 'N':
        if (modifiers == name)
-         error ("forcing explicit tag name but no name, ignoring", NULL);
+         error ("forcing explicit tag name but no name, ignoring");
        force_explicit_name = TRUE;
        break;
       case 'i':
@@ -5763,12 +5725,7 @@ add_regex (char *regexp_pattern, language *lang)
        need_filebuf = TRUE;
        break;
       default:
-       {
-         char wrongmod [2];
-         wrongmod[0] = modifiers[0];
-         wrongmod[1] = '\0';
-         error ("invalid regexp modifier `%s', ignoring", wrongmod);
-       }
+       error ("invalid regexp modifier `%c', ignoring", modifiers[0]);
        break;
       }
 
@@ -5852,7 +5809,7 @@ substitute (char *in, char *out, struct re_registers *regs)
       {
        dig = *out - '0';
        diglen = regs->end[dig] - regs->start[dig];
-       strncpy (t, in + regs->start[dig], diglen);
+       memcpy (t, in + regs->start[dig], diglen);
        t += diglen;
       }
     else
@@ -6075,7 +6032,7 @@ readline_internal (linebuffer *lbp, register FILE *stream)
          filebuf.size *= 2;
          xrnew (filebuf.buffer, filebuf.size, char);
        }
-      strncpy (filebuf.buffer + filebuf.len, lbp->buffer, lbp->len);
+      memcpy (filebuf.buffer + filebuf.len, lbp->buffer, lbp->len);
       filebuf.len += lbp->len;
       filebuf.buffer[filebuf.len++] = '\n';
       filebuf.buffer[filebuf.len] = '\0';
@@ -6298,7 +6255,7 @@ savenstr (const char *cp, int len)
   register char *dp;
 
   dp = xnew (len + 1, char);
-  strncpy (dp, cp, len);
+  memcpy (dp, cp, len);
   dp[len] = '\0';
   return dp;
 }
@@ -6340,48 +6297,6 @@ etags_strchr (register const char *sp, register int c)
   return NULL;
 }
 
-/*
- * Compare two strings, ignoring case for alphabetic characters.
- *
- * Same as BSD's strcasecmp, included for portability.
- */
-static int
-etags_strcasecmp (register const char *s1, register const char *s2)
-{
-  while (*s1 != '\0'
-        && (ISALPHA (*s1) && ISALPHA (*s2)
-            ? lowcase (*s1) == lowcase (*s2)
-            : *s1 == *s2))
-    s1++, s2++;
-
-  return (ISALPHA (*s1) && ISALPHA (*s2)
-         ? lowcase (*s1) - lowcase (*s2)
-         : *s1 - *s2);
-}
-
-/*
- * Compare two strings, ignoring case for alphabetic characters.
- * Stop after a given number of characters
- *
- * Same as BSD's strncasecmp, included for portability.
- */
-static int
-etags_strncasecmp (register const char *s1, register const char *s2, register int n)
-{
-  while (*s1 != '\0' && n-- > 0
-        && (ISALPHA (*s1) && ISALPHA (*s2)
-            ? lowcase (*s1) == lowcase (*s2)
-            : *s1 == *s2))
-    s1++, s2++;
-
-  if (n < 0)
-    return 0;
-  else
-    return (ISALPHA (*s1) && ISALPHA (*s2)
-           ? lowcase (*s1) - lowcase (*s2)
-           : *s1 - *s2);
-}
-
 /* Skip spaces (end of string is not space), return new pointer. */
 static char *
 skip_spaces (char *cp)
@@ -6423,13 +6338,16 @@ suggest_asking_for_help (void)
   exit (EXIT_FAILURE);
 }
 
-/* Print error message.  `s1' is printf control string, `s2' is arg for it. */
+/* Output a diagnostic with printf-style FORMAT and args.  */
 static void
-error (const char *s1, const char *s2)
+error (const char *format, ...)
 {
+  va_list ap;
+  va_start (ap, format);
   fprintf (stderr, "%s: ", progname);
-  fprintf (stderr, s1, s2);
+  vfprintf (stderr, format, ap);
   fprintf (stderr, "\n");
+  va_end (ap);
 }
 
 /* Return a newly-allocated string whose contents
@@ -6687,19 +6605,19 @@ linebuffer_setlen (linebuffer *lbp, int toksize)
 }
 
 /* Like malloc but get fatal error if memory is exhausted. */
-static PTR
+static void *
 xmalloc (size_t size)
 {
-  PTR result = (PTR) malloc (size);
+  void *result = malloc (size);
   if (result == NULL)
     fatal ("virtual memory exhausted", (char *)NULL);
   return result;
 }
 
-static PTR
+static void *
 xrealloc (char *ptr, size_t size)
 {
-  PTR result = (PTR) realloc (ptr, size);
+  void *result = realloc (ptr, size);
   if (result == NULL)
     fatal ("virtual memory exhausted", (char *)NULL);
   return result;
index f8fb11f8218c0352d8e5ea3a0f442e1f9ff22f39..08da0075269af91eb2b9bddd7b35b8f90b9cc647 100644 (file)
@@ -20,9 +20,7 @@ You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <stdio.h>
 #include <ctype.h>
@@ -48,7 +46,7 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
 int group_by = DEFAULT_GROUPING;
 char *progname;
 
-void usage (void) NO_RETURN;
+_Noreturn void usage (void);
 
 int
 main (int argc, char **argv)
index 3e79cae4f412c3ae675b0feff00354b2f40ce57c..bd87b5b6524b70a5f8de43cb894984a44e142b5b 100644 (file)
@@ -35,7 +35,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
-/* defined to be emacs_main, sys_fopen, etc. in config.h */
+/* Defined to be emacs_main, sys_fopen, etc. in config.h.  */
 #undef main
 #undef fopen
 #undef chdir
@@ -66,7 +66,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
 #endif
 
-/* Use this to suppress gcc's `...may be used before initialized' warnings. */
+/* Use this to suppress gcc's `...may be used before initialized' warnings.  */
 #ifdef lint
 # define IF_LINT(Code) Code
 #else
@@ -76,7 +76,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 static int scan_file (char *filename);
 static int scan_lisp_file (const char *filename, const char *mode);
 static int scan_c_file (char *filename, const char *mode);
-static void fatal (const char *s1, const char *s2) NO_RETURN;
 static void start_globals (void);
 static void write_globals (void);
 
@@ -111,7 +110,7 @@ error (const char *s1, const char *s2)
 /* Print error message and exit.  */
 
 /* VARARGS1 */
-static void
+static _Noreturn void
 fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
@@ -226,7 +225,7 @@ put_filename (char *filename)
 
   for (tmp = filename; *tmp; tmp++)
     {
-      if (IS_DIRECTORY_SEP(*tmp))
+      if (IS_DIRECTORY_SEP (*tmp))
        filename = tmp + 1;
     }
 
@@ -542,7 +541,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
 
          /* In C code, `default' is a reserved word, so we spell it
             `defalt'; demangle that here.  */
-         if (ident_length == 6 && strncmp (ident_start, "defalt", 6) == 0)
+         if (ident_length == 6 && memcmp (ident_start, "defalt", 6) == 0)
            fprintf (out, "DEFAULT");
          else
            while (ident_length-- > 0)
@@ -565,6 +564,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
 /* The types of globals.  */
 enum global_type
 {
+  FUNCTION,
   EMACS_INTEGER,
   BOOLEAN,
   LISP_OBJECT,
@@ -576,6 +576,7 @@ struct global
 {
   enum global_type type;
   char *name;
+  int value;
 };
 
 /* All the variable names we saw while scanning C sources in `-g'
@@ -585,7 +586,7 @@ int num_globals_allocated;
 struct global *globals;
 
 static void
-add_global (enum global_type type, char *name)
+add_global (enum global_type type, char *name, int value)
 {
   /* Ignore the one non-symbol that can occur.  */
   if (strcmp (name, "..."))
@@ -606,6 +607,7 @@ add_global (enum global_type type, char *name)
 
       globals[num_globals - 1].type = type;
       globals[num_globals - 1].name = name;
+      globals[num_globals - 1].value = value;
     }
 }
 
@@ -614,13 +616,29 @@ compare_globals (const void *a, const void *b)
 {
   const struct global *ga = a;
   const struct global *gb = b;
+
+  if (ga->type == FUNCTION)
+    {
+      if (gb->type != FUNCTION)
+       return 1;
+    }
+  else if (gb->type == FUNCTION)
+    return -1;
+
   return strcmp (ga->name, gb->name);
 }
 
+static void
+close_emacs_globals (void)
+{
+  fprintf (outfile, "};\n");
+  fprintf (outfile, "extern struct emacs_globals globals;\n");
+}
+
 static void
 write_globals (void)
 {
-  int i;
+  int i, seen_defun = 0;
   qsort (globals, num_globals, sizeof (struct global), compare_globals);
   for (i = 0; i < num_globals; ++i)
     {
@@ -637,20 +655,55 @@ write_globals (void)
        case LISP_OBJECT:
          type = "Lisp_Object";
          break;
+       case FUNCTION:
+         if (!seen_defun)
+           {
+             close_emacs_globals ();
+             fprintf (outfile, "\n");
+             seen_defun = 1;
+           }
+         break;
        default:
          fatal ("not a recognized DEFVAR_", 0);
        }
 
-      fprintf (outfile, "  %s f_%s;\n", type, globals[i].name);
-      fprintf (outfile, "#define %s globals.f_%s\n",
-              globals[i].name, globals[i].name);
+      if (globals[i].type != FUNCTION)
+       {
+         fprintf (outfile, "  %s f_%s;\n", type, globals[i].name);
+         fprintf (outfile, "#define %s globals.f_%s\n",
+                  globals[i].name, globals[i].name);
+       }
+      else
+       {
+         /* It would be nice to have a cleaner way to deal with these
+            special hacks.  */
+         if (strcmp (globals[i].name, "Fthrow") == 0
+             || strcmp (globals[i].name, "Ftop_level") == 0
+             || strcmp (globals[i].name, "Fkill_emacs") == 0)
+           fprintf (outfile, "_Noreturn ");
+         fprintf (outfile, "EXFUN (%s, ", globals[i].name);
+         if (globals[i].value == -1)
+           fprintf (outfile, "MANY");
+         else if (globals[i].value == -2)
+           fprintf (outfile, "UNEVALLED");
+         else
+           fprintf (outfile, "%d", globals[i].value);
+         fprintf (outfile, ");\n");
+       }
+
       while (i + 1 < num_globals
             && !strcmp (globals[i].name, globals[i + 1].name))
-       ++i;
+       {
+         if (globals[i].type == FUNCTION
+             && globals[i].value != globals[i + 1].value)
+           error ("function '%s' defined twice with differing signatures",
+                  globals[i].name);
+         ++i;
+       }
     }
 
-  fprintf (outfile, "};\n");
-  fprintf (outfile, "extern struct emacs_globals globals;\n");
+  if (!seen_defun)
+    close_emacs_globals ();
 }
 
 \f
@@ -675,14 +728,14 @@ scan_c_file (char *filename, const char *mode)
 
   if (infile == NULL && extension == 'o')
     {
-      /* try .m */
+      /* Try .m.  */
       filename[strlen (filename) - 1] = 'm';
       infile = fopen (filename, mode);
       if (infile == NULL)
-        filename[strlen (filename) - 1] = 'c'; /* don't confuse people */
+        filename[strlen (filename) - 1] = 'c'; /* Don't confuse people.  */
     }
 
-  /* No error if non-ex input file */
+  /* No error if non-ex input file */
   if (infile == NULL)
     {
       perror (filename);
@@ -700,6 +753,7 @@ scan_c_file (char *filename, const char *mode)
       int defvarperbufferflag = 0;
       int defvarflag = 0;
       enum global_type type = INVALID;
+      char *name IF_LINT (= 0);
 
       if (c != '\n' && c != '\r')
        {
@@ -765,8 +819,9 @@ scan_c_file (char *filename, const char *mode)
        }
       else continue;
 
-      if (generate_globals && (!defvarflag || defvarperbufferflag
-                              || type == INVALID))
+      if (generate_globals
+         && (!defvarflag || defvarperbufferflag || type == INVALID)
+         && !defunflag)
        continue;
 
       while (c != '(')
@@ -785,7 +840,6 @@ scan_c_file (char *filename, const char *mode)
       if (generate_globals)
        {
          int i = 0;
-         char *name;
 
          /* Skip "," and whitespace.  */
          do
@@ -800,14 +854,18 @@ scan_c_file (char *filename, const char *mode)
              input_buffer[i++] = c;
              c = getc (infile);
            }
-         while (! (c == ',' || c == ' ' || c == '\t' ||
-                   c == '\n' || c == '\r'));
+         while (! (c == ',' || c == ' ' || c == '\t'
+                   || c == '\n' || c == '\r'));
          input_buffer[i] = '\0';
 
          name = xmalloc (i + 1);
          memcpy (name, input_buffer, i + 1);
-         add_global (type, name);
-         continue;
+
+         if (!defunflag)
+           {
+             add_global (type, name, 0);
+             continue;
+           }
        }
 
       /* DEFVAR_LISP ("name", addr, "doc")
@@ -815,12 +873,12 @@ scan_c_file (char *filename, const char *mode)
         DEFVAR_LISP ("name", addr, doc: /\* doc *\/)  */
 
       if (defunflag)
-       commas = 5;
+       commas = generate_globals ? 4 : 5;
       else if (defvarperbufferflag)
        commas = 3;
       else if (defvarflag)
        commas = 1;
-      else  /* For DEFSIMPLE and DEFPRED */
+      else  /* For DEFSIMPLE and DEFPRED */
        commas = 2;
 
       while (commas)
@@ -838,11 +896,16 @@ scan_c_file (char *filename, const char *mode)
                  if (c < 0)
                    goto eof;
                  ungetc (c, infile);
-                 if (commas == 2) /* pick up minargs */
+                 if (commas == 2) /* Pick up minargs.  */
                    scanned = fscanf (infile, "%d", &minargs);
-                 else /* pick up maxargs */
+                 else /* Pick up maxargs.  */
                    if (c == 'M' || c == 'U') /* MANY || UNEVALLED */
-                     maxargs = -1;
+                     {
+                       if (generate_globals)
+                         maxargs = (c == 'M') ? -1 : -2;
+                       else
+                         maxargs = -1;
+                     }
                    else
                      scanned = fscanf (infile, "%d", &maxargs);
                  if (scanned < 0)
@@ -855,6 +918,12 @@ scan_c_file (char *filename, const char *mode)
          c = getc (infile);
        }
 
+      if (generate_globals)
+       {
+         add_global (FUNCTION, name, maxargs);
+         continue;
+       }
+
       while (c == ' ' || c == '\n' || c == '\r' || c == '\t')
        c = getc (infile);
 
@@ -893,7 +962,7 @@ scan_c_file (char *filename, const char *mode)
          fprintf (outfile, "%s\n", input_buffer);
 
          if (comment)
-           getc (infile);      /* Skip past `*' */
+           getc (infile);      /* Skip past `*' */
          c = read_c_string_or_comment (infile, 1, comment, &saw_usage);
 
          /* If this is a defun, find the arguments and print them.  If
@@ -979,7 +1048,7 @@ scan_c_file (char *filename, const char *mode)
  problem because byte-compiler output follows this convention.
  The NAME and DOCSTRING are output.
  NAME is preceded by `F' for a function or `V' for a variable.
- An entry is output only if DOCSTRING has \ newline just after the opening "
+ An entry is output only if DOCSTRING has \ newline just after the opening ".
  */
 
 static void
@@ -1019,6 +1088,34 @@ read_lisp_symbol (FILE *infile, char *buffer)
   skip_white (infile);
 }
 
+static int
+search_lisp_doc_at_eol (FILE *infile)
+{
+  char c = 0, c1 = 0, c2 = 0;
+
+  /* Skip until the end of line; remember two previous chars.  */
+  while (c != '\n' && c != '\r' && c != EOF)
+    {
+      c2 = c1;
+      c1 = c;
+      c = getc (infile);
+    }
+
+  /* If two previous characters were " and \,
+     this is a doc string.  Otherwise, there is none.  */
+  if (c2 != '"' || c1 != '\\')
+    {
+#ifdef DEBUG
+      fprintf (stderr, "## non-docstring in %s (%s)\n",
+              buffer, filename);
+#endif
+      if (c != EOF)
+       ungetc (c, infile);
+      return 0;
+    }
+  return 1;
+}
+
 static int
 scan_lisp_file (const char *filename, const char *mode)
 {
@@ -1033,7 +1130,7 @@ scan_lisp_file (const char *filename, const char *mode)
   if (infile == NULL)
     {
       perror (filename);
-      return 0;                                /* No error */
+      return 0;                                /* No error */
     }
 
   c = '\n';
@@ -1110,7 +1207,7 @@ scan_lisp_file (const char *filename, const char *mode)
          type = 'F';
          read_lisp_symbol (infile, buffer);
 
-         /* Skip the arguments: either "nil" or a list in parens */
+         /* Skip the arguments: either "nil" or a list in parens */
 
          c = getc (infile);
          if (c == 'n') /* nil */
@@ -1154,39 +1251,18 @@ scan_lisp_file (const char *filename, const char *mode)
               || ! strcmp (buffer, "defconst")
               || ! strcmp (buffer, "defcustom"))
        {
-         char c1 = 0, c2 = 0;
          type = 'V';
          read_lisp_symbol (infile, buffer);
 
          if (saved_string == 0)
-           {
-
-             /* Skip until the end of line; remember two previous chars.  */
-             while (c != '\n' && c != '\r' && c >= 0)
-               {
-                 c2 = c1;
-                 c1 = c;
-                 c = getc (infile);
-               }
-
-             /* If two previous characters were " and \,
-                this is a doc string.  Otherwise, there is none.  */
-             if (c2 != '"' || c1 != '\\')
-               {
-#ifdef DEBUG
-                 fprintf (stderr, "## non-docstring in %s (%s)\n",
-                          buffer, filename);
-#endif
-                 continue;
-               }
-           }
+           if (!search_lisp_doc_at_eol (infile))
+             continue;
        }
 
       else if (! strcmp (buffer, "custom-declare-variable")
               || ! strcmp (buffer, "defvaralias")
               )
        {
-         char c1 = 0, c2 = 0;
          type = 'V';
 
          c = getc (infile);
@@ -1221,31 +1297,12 @@ scan_lisp_file (const char *filename, const char *mode)
            }
 
          if (saved_string == 0)
-           {
-             /* Skip to end of line; remember the two previous chars.  */
-             while (c != '\n' && c != '\r' && c >= 0)
-               {
-                 c2 = c1;
-                 c1 = c;
-                 c = getc (infile);
-               }
-
-             /* If two previous characters were " and \,
-                this is a doc string.  Otherwise, there is none.  */
-             if (c2 != '"' || c1 != '\\')
-               {
-#ifdef DEBUG
-                 fprintf (stderr, "## non-docstring in %s (%s)\n",
-                          buffer, filename);
-#endif
-                 continue;
-               }
-           }
+           if (!search_lisp_doc_at_eol (infile))
+             continue;
        }
 
       else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias"))
        {
-         char c1 = 0, c2 = 0;
          type = 'F';
 
          c = getc (infile);
@@ -1278,26 +1335,8 @@ scan_lisp_file (const char *filename, const char *mode)
            }
 
          if (saved_string == 0)
-           {
-             /* Skip to end of line; remember the two previous chars.  */
-             while (c != '\n' && c != '\r' && c >= 0)
-               {
-                 c2 = c1;
-                 c1 = c;
-                 c = getc (infile);
-               }
-
-             /* If two previous characters were " and \,
-                this is a doc string.  Otherwise, there is none.  */
-             if (c2 != '"' || c1 != '\\')
-               {
-#ifdef DEBUG
-                 fprintf (stderr, "## non-docstring in %s (%s)\n",
-                          buffer, filename);
-#endif
-                 continue;
-               }
-           }
+           if (!search_lisp_doc_at_eol (infile))
+             continue;
        }
 
       else if (! strcmp (buffer, "autoload"))
@@ -1339,29 +1378,16 @@ scan_lisp_file (const char *filename, const char *mode)
              continue;
            }
          read_c_string_or_comment (infile, 0, 0, 0);
-         skip_white (infile);
 
          if (saved_string == 0)
-           {
-             /* If the next three characters aren't `dquote bslash newline'
-                then we're not reading a docstring.  */
-             if ((c = getc (infile)) != '"'
-                 || (c = getc (infile)) != '\\'
-                 || ((c = getc (infile)) != '\n' && c != '\r'))
-               {
-#ifdef DEBUG
-                 fprintf (stderr, "## non-docstring in %s (%s)\n",
-                          buffer, filename);
-#endif
-                 continue;
-               }
-           }
+           if (!search_lisp_doc_at_eol (infile))
+             continue;
        }
 
 #ifdef DEBUG
       else if (! strcmp (buffer, "if")
               || ! strcmp (buffer, "byte-code"))
-       ;
+       continue;
 #endif
 
       else
@@ -1373,12 +1399,10 @@ scan_lisp_file (const char *filename, const char *mode)
          continue;
        }
 
-      /* At this point, we should either use the previous
-        dynamic doc string in saved_string
-        or gobble a doc string from the input file.
-
-        In the latter case, the opening quote (and leading
-        backslash-newline) have already been read.  */
+      /* At this point, we should either use the previous dynamic doc string in
+        saved_string or gobble a doc string from the input file.
+        In the latter case, the opening quote (and leading backslash-newline)
+        have already been read.  */
 
       putc (037, outfile);
       putc (type, outfile);
index b4b59556034a18dc6965d7af0849784964c67d8c..4b2b523ea34d822446e308ad7b547942910e8367 100644 (file)
 # along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 
-ALL = make-docfile hexl ctags etags movemail ebrowse emacsclient
+ALL = $(BLD)/test-distrib.exe $(BLD)/make-docfile.exe $(BLD)/hexl.exe\
+ $(BLD)/ctags.exe $(BLD)/etags.exe $(BLD)/movemail.exe $(BLD)/ebrowse.exe\
+ $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe $(BLD)/profile.exe
 
-.PHONY: $(ALL)
+.PHONY: make-docfile
 
 LOCAL_FLAGS    = -DWINDOWSNT -DDOS_NT -DNO_LDAV=1 \
-                 -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \
+                 -DNO_ARCHIVES=1 -I../lib \
                  -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS)
 
 LIBS           = $(BASE_LIBS) $(ADVAPI32)
 
+# The following target is used by makefile.w32-in files in other directories.
+make-docfile:  $(BLD)/make-docfile.exe
+
 $(BLD)/make-docfile.exe:       $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O)
                $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS)
 $(BLD)/hexl.exe:               $(BLD)/hexl.$(O)
                $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS)
 $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O)
                $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS)
-
-make-docfile:  stamp_BLD $(BLD)/make-docfile.exe
-ctags:         stamp_BLD $(BLD)/ctags.exe
-etags:         stamp_BLD $(BLD)/etags.exe
-ebrowse:        stamp_BLD $(BLD)/ebrowse.exe
-hexl:          stamp_BLD $(BLD)/hexl.exe
-movemail:      stamp_BLD $(BLD)/movemail.exe
-emacsclient:   stamp_BLD $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe
-
-test-distrib:  stamp_BLD $(BLD)/test-distrib.exe
-       "$(BLD)/test-distrib.exe" "$(SRC)/testfile"
+               "$(BLD)/test-distrib.exe" "$(LIB_SRC)/testfile"
 
 MOVEMAILOBJS =  $(BLD)/movemail.$(O) \
                $(BLD)/pop.$(O) \
@@ -111,10 +106,16 @@ ctags.c:  etags.c
                - $(DEL) ctags.c
                $(CP) etags.c ctags.c
 
-CTAGS_CFLAGS  = -DCTAGS $(ETAGS_CFLAGS) -DEMACS_NAME="\"GNU Emacs\""
+CTAGS_CFLAGS  = -DCTAGS $(ETAGS_CFLAGS)
 $(BLD)/ctags.$(O): ctags.c
                $(CC) $(CFLAGS) $(CTAGS_CFLAGS) $(CC_OUT)$@ ctags.c
 
+PROFILEOBJS    = $(BLD)/profile.$(O) \
+                 ../lib/$(BLD)/libgnu.$(A) \
+                 $(BLD)/ntlib.$(O)
+$(BLD)/profile.exe:    $(PROFILEOBJS)
+               $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(PROFILEOBJS) $(LIBS)
+
 #
 # From ..\src\Makefile.in
 # It doesn't matter if the real name is *.obj for the files in this list,
@@ -140,7 +141,7 @@ obj =   dosfns.o msdos.o \
        process.o callproc.o unexw32.o \
        region-cache.o sound.o atimer.o \
        doprnt.o intervals.o textprop.o composite.o \
-       gnutls.o
+       gnutls.o xml.o
 
 #
 # These are the lisp files that are loaded up in loadup.el
@@ -241,7 +242,6 @@ lisp2 = \
        $(lispsource)language/georgian.el \
        $(lispsource)language/khmer.el \
        $(lispsource)language/burmese.el \
-       $(lispsource)paths.el \
        $(lispsource)register.elc \
        $(lispsource)replace.elc \
        $(lispsource)simple.elc \
@@ -297,7 +297,7 @@ $(DOC):             stamp_BLD $(BLD)/make-docfile.exe ../src/$(BLD)/temacs.exe $(lisp1) $(l
 #
 # Build the executables
 #
-all:           stamp_BLD $(ALL) $(DOC)
+all:           $(ALL) $(DOC)
 
 #
 # Assuming INSTALL_DIR is defined, build and install emacs in it.
@@ -312,6 +312,7 @@ install:    $(INSTALL_FILES)
                $(CP) $(BLD)/movemail.exe $(INSTALL_DIR)/bin
                $(CP) $(BLD)/emacsclient.exe $(INSTALL_DIR)/bin
                $(CP) $(BLD)/emacsclientw.exe $(INSTALL_DIR)/bin
+               $(CP) $(BLD)/profile.exe $(INSTALL_DIR)/bin
                - mkdir "$(INSTALL_DIR)/etc"
                $(CP) $(DOC) $(INSTALL_DIR)/etc
 
@@ -354,114 +355,108 @@ TAGS: $(BLD)/etags.exe *.c *.h
 ### DEPENDENCIES ###
 
 EMACS_ROOT     = ..
-SRC            = .
-
-$(BLD)/alloca.$(O) : \
-       $(SRC)/alloca.c \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h \
-       $(EMACS_ROOT)/src/blockinput.h
+LIB_SRC                = .
+SRC            = $(EMACS_ROOT)/src
+NT_INC         = $(EMACS_ROOT)/nt/inc
+GNU_LIB                = $(EMACS_ROOT)/lib
+
+MS_W32_H       = $(SRC)/s/ms-w32.h \
+                $(NT_INC)/sys/stat.h
+CONFIG_H       = $(SRC)/config.h \
+                $(MS_W32_H)
+INTTYPES_H     = $(NT_INC)/inttypes.h \
+                $(NT_INC)/stdint.h
+NTLIB_H        = $(LIB_SRC)/ntlib.h \
+                $(NT_INC)/pwd.h
+SYSTIME_H      = $(SRC)/systime.h \
+                $(NT_INC)/sys/time.h \
+                $(GNU_LIB)/timespec.h
 
 $(BLD)/ctags.$(O) : \
-       $(SRC)/ctags.c \
-       $(EMACS_ROOT)/nt/inc/sys/param.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/lib-src/../src/config.h \
-       $(SRC)/ntlib.h \
-       $(EMACS_ROOT)/lib/getopt.h
+       $(LIB_SRC)/ctags.c \
+       $(SRC)/regex.h \
+       $(NT_INC)/sys/stat.h \
+       $(NT_INC)/unistd.h \
+       $(GNU_LIB)/c-strcase.h \
+       $(GNU_LIB)/getopt.h \
+       $(CONFIG_H)
 
 $(BLD)/ebrowse.$(O) : \
-       $(SRC)/ebrowse.c \
-       $(EMACS_ROOT)/lib/min-max.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/lib-src/../src/config.h
+       $(LIB_SRC)/ebrowse.c \
+       $(GNU_LIB)/getopt.h \
+       $(GNU_LIB)/min-max.h \
+       $(CONFIG_H)
 
 $(BLD)/emacsclient.$(O) : \
-       $(SRC)/emacsclient.c \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/lib-src/../src/config.h
+       $(LIB_SRC)/emacsclient.c \
+       $(NT_INC)/pwd.h \
+       $(NT_INC)/sys/stat.h \
+       $(NT_INC)/unistd.h \
+       $(GNU_LIB)/getopt.h \
+       $(CONFIG_H)
 
 $(BLD)/etags.$(O) : \
-       $(SRC)/etags.c \
-       $(EMACS_ROOT)/nt/inc/sys/param.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/lib-src/../src/config.h \
-       $(SRC)/ntlib.h \
-       $(EMACS_ROOT)/lib/getopt.h
-
-$(BLD)/getdate.$(O) : \
-       $(SRC)/getdate.c \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h \
-       $(MSTOOLS_SYS)/types.h
+       $(LIB_SRC)/etags.c \
+       $(SRC)/regex.h \
+       $(NT_INC)/sys/stat.h \
+       $(NT_INC)/unistd.h \
+       $(GNU_LIB)/c-strcase.h \
+       $(GNU_LIB)/getopt.h \
+       $(CONFIG_H)
 
 $(BLD)/hexl.$(O) : \
-       $(SRC)/hexl.c
-
-$(BLD)/leditcfns.$(O) : \
-       $(SRC)/leditcfns.c
+       $(LIB_SRC)/hexl.c \
+       $(CONFIG_H)
 
 $(BLD)/make-docfile.$(O) : \
-       $(SRC)/make-docfile.c \
-       $(EMACS_ROOT)/src/config.h
-
-$(BLD)/make-path.$(O) : \
-       $(SRC)/make-path.c
+       $(LIB_SRC)/make-docfile.c \
+       $(NT_INC)/unistd.h \
+       $(CONFIG_H)
 
 $(BLD)/movemail.$(O) : \
-       $(SRC)/movemail.c \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/lib-src/../src/config.h \
-       $(EMACS_ROOT)/nt/inc/sys/file.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/lib-src/../src/syswait.h \
-       $(EMACS_ROOT)/nt/inc/pwd.h \
-       $(SRC)/ntlib.h
-       $(CC) $(CFLAGS) -DUSG $(CC_OUT)$@ movemail.c
+       $(LIB_SRC)/movemail.c \
+       $(LIB_SRC)/pop.h \
+       $(SRC)/syswait.h \
+       $(NT_INC)/pwd.h \
+       $(NT_INC)/sys/file.h \
+       $(NT_INC)/sys/stat.h \
+       $(NT_INC)/unistd.h \
+       $(GNU_LIB)/getopt.h \
+       $(CONFIG_H) \
+       $(NTLIB_H)
 
 $(BLD)/ntlib.$(O) : \
-       $(SRC)/ntlib.c \
-       $(SRC)/ntlib.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/nt/inc/pwd.h
+       $(LIB_SRC)/ntlib.c \
+       $(NT_INC)/sys/stat.h \
+       $(NTLIB_H)
 
 $(BLD)/pop.$(O) : \
-       $(SRC)/pop.c \
-       $(SRC)/pop.h \
-       $(EMACS_ROOT)/lib/min-max.h \
-       $(SRC)/ntlib.h
+       $(LIB_SRC)/pop.c \
+       $(LIB_SRC)/pop.h \
+       $(NT_INC)/netdb.h \
+       $(NT_INC)/pwd.h \
+       $(NT_INC)/unistd.h \
+       $(GNU_LIB)/min-max.h \
+       $(CONFIG_H) \
+       $(NTLIB_H)
 
 $(BLD)/profile.$(O) : \
-       $(SRC)/profile.c \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/lib-src/../src/config.h \
-       $(EMACS_ROOT)/lib-src/../src/systime.h
-
-$(BLD)/qsort.$(O) : \
-       $(SRC)/qsort.c
-
-$(BLD)/tcp.$(O) : \
-       $(SRC)/tcp.c
+       $(LIB_SRC)/profile.c \
+       $(GNU_LIB)/intprops.h \
+       $(CONFIG_H) \
+       $(INTTYPES_H) \
+       $(SYSTIME_H)
+
+$(BLD)/regex.$(O) : \
+       $(SRC)/regex.c \
+       $(SRC)/regex.h \
+       $(NT_INC)/unistd.h \
+       $(CONFIG_H)
 
 $(BLD)/test-distrib.$(O) : \
-       $(SRC)/test-distrib.c
-
-$(BLD)/timer.$(O) : \
-       $(SRC)/timer.c \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/lib-src/../src/config.h
+       $(LIB_SRC)/test-distrib.c \
+       $(NT_INC)/unistd.h \
+       $(CONFIG_H)
 
 # The following dependencies are for supporting parallel builds, where
 # we must make sure $(BLD) exists before any compilation starts.
index 9d19df32814688c4dac8da033c71e98362e13fdd..d157aa8c0b9bc272eae55a7012f8b4b7bf9df11c 100644 (file)
@@ -133,16 +133,10 @@ static char *mail_spool_name (char *);
 #endif
 #endif
 
-#ifndef HAVE_STRERROR
-char *strerror (int);
-#endif
-
-static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN;
+static _Noreturn void fatal (const char *s1, const char *s2, const char *s3);
 static void error (const char *s1, const char *s2, const char *s3);
-static void pfatal_with_name (char *name) NO_RETURN;
-static void pfatal_and_delete (char *name) NO_RETURN;
-static char *concat (const char *s1, const char *s2, const char *s3);
-static long *xmalloc (unsigned int size);
+static _Noreturn void pfatal_with_name (char *name);
+static _Noreturn void pfatal_and_delete (char *name);
 #ifdef MAIL_USE_POP
 static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
 static int pop_retr (popserver server, int msgno, FILE *arg);
@@ -151,6 +145,21 @@ static int mbx_delimit_begin (FILE *mbf);
 static int mbx_delimit_end (FILE *mbf);
 #endif
 
+#if (defined MAIL_USE_MAILLOCK                                         \
+     || (!defined DISABLE_DIRECT_ACCESS && !defined MAIL_USE_MMDF      \
+        && !defined MAIL_USE_SYSTEM_LOCK))
+/* Like malloc but get fatal error if memory is exhausted.  */
+
+static void *
+xmalloc (size_t size)
+{
+  void *result = malloc (size);
+  if (!result)
+    fatal ("virtual memory exhausted", 0, 0);
+  return result;
+}
+#endif
+
 /* Nonzero means this is name of a lock file to delete on fatal error.  */
 static char *delete_lockname;
 
@@ -168,7 +177,7 @@ main (int argc, char **argv)
   int tem;
   char *lockname;
   char *tempname;
-  size_t inname_dirlen;
+  size_t inname_len, inname_dirlen;
   int desc;
 #endif /* not MAIL_USE_SYSTEM_LOCK */
 
@@ -296,12 +305,15 @@ main (int argc, char **argv)
         should define MAIL_USE_SYSTEM_LOCK but does not, send a bug report
         to bug-gnu-emacs@prep.ai.mit.edu so we can fix it.  */
 
-      lockname = concat (inname, ".lock", "");
-      for (inname_dirlen = strlen (inname);
+      inname_len = strlen (inname);
+      lockname = xmalloc (inname_len + sizeof ".lock");
+      strcpy (lockname, inname);
+      strcpy (lockname + inname_len, ".lock");
+      for (inname_dirlen = inname_len;
           inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]);
           inname_dirlen--)
        continue;
-      tempname = (char *) xmalloc (inname_dirlen + sizeof "EXXXXXX");
+      tempname = xmalloc (inname_dirlen + sizeof "EXXXXXX");
 
       while (1)
        {
@@ -583,8 +595,8 @@ mail_spool_name (char *inname)
   if (stat (MAILDIR, &stat1) < 0)
     return NULL;
 
-  indir = (char *) xmalloc (fname - inname + 1);
-  strncpy (indir, inname, fname - inname);
+  indir = xmalloc (fname - inname + 1);
+  memcpy (indir, inname, fname - inname);
   indir[fname-inname] = '\0';
 
 
@@ -643,33 +655,6 @@ pfatal_and_delete (char *name)
   unlink (name);
   fatal ("%s for %s", s, name);
 }
-
-/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
-
-static char *
-concat (const char *s1, const char *s2, const char *s3)
-{
-  size_t len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
-  char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
-
-  strcpy (result, s1);
-  strcpy (result + len1, s2);
-  strcpy (result + len1 + len2, s3);
-  *(result + len1 + len2 + len3) = 0;
-
-  return result;
-}
-
-/* Like malloc but get fatal error if memory is exhausted.  */
-
-static long *
-xmalloc (unsigned int size)
-{
-  long *result = (long *) malloc (size);
-  if (!result)
-    fatal ("virtual memory exhausted", 0, 0);
-  return result;
-}
 \f
 /* This is the guts of the interface to the Post Office Protocol.  */
 
@@ -851,10 +836,7 @@ pop_retr (popserver server, int msgno, FILE *arg)
 
   if (pop_retrieve_first (server, msgno, &line))
     {
-      char *msg = concat ("Error from POP server: ", pop_error, "");
-      strncpy (Errmsg, msg, sizeof (Errmsg));
-      Errmsg[sizeof (Errmsg)-1] = '\0';
-      free (msg);
+      snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error);
       return (NOTOK);
     }
 
@@ -873,10 +855,7 @@ pop_retr (popserver server, int msgno, FILE *arg)
 
   if (ret)
     {
-      char *msg = concat ("Error from POP server: ", pop_error, "");
-      strncpy (Errmsg, msg, sizeof (Errmsg));
-      Errmsg[sizeof (Errmsg)-1] = '\0';
-      free (msg);
+      snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error);
       return (NOTOK);
     }
 
@@ -939,21 +918,3 @@ mbx_delimit_end (FILE *mbf)
 }
 
 #endif /* MAIL_USE_POP */
-\f
-#ifndef HAVE_STRERROR
-char *
-strerror (errnum)
-     int errnum;
-{
-  extern char *sys_errlist[];
-  extern int sys_nerr;
-
-  if (errnum >= 0 && errnum < sys_nerr)
-    return sys_errlist[errnum];
-  return (char *) "Unknown error";
-}
-
-#endif /* ! HAVE_STRERROR */
-
-
-/* movemail.c ends here */
index c4c7f2b4e2f0360fff2ff2c0c2724625685e478a..74054e0e1b13589b1159069ecfa134cd07f424f2 100644 (file)
@@ -21,11 +21,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#else
-#define MAIL_USE_POP
-#endif
 
 #ifdef MAIL_USE_POP
 
@@ -101,7 +97,7 @@ extern char *krb_realmofhost (/* char * */);
 #endif /* KERBEROS */
 
 #ifndef WINDOWSNT
-#if !defined (HAVE_H_ERRNO) || !defined (HAVE_CONFIG_H)
+#ifndef HAVE_H_ERRNO
 extern int h_errno;
 #endif
 #endif
@@ -344,10 +340,7 @@ pop_stat (popserver server, int *count, int *size)
   if (strncmp (fromserver, "+OK ", 4))
     {
       if (0 == strncmp (fromserver, "-ERR", 4))
-       {
-         strncpy (pop_error, fromserver, ERROR_MAX);
-         pop_error[ERROR_MAX-1] = '\0';
-       }
+       snprintf (pop_error, ERROR_MAX, "%s", fromserver);
       else
        {
          strcpy (pop_error,
@@ -448,10 +441,7 @@ pop_list (popserver server, int message, int **IDs, int **sizes)
       if (strncmp (fromserver, "+OK ", 4))
        {
          if (! strncmp (fromserver, "-ERR", 4))
-           {
-             strncpy (pop_error, fromserver, ERROR_MAX);
-             pop_error[ERROR_MAX-1] = '\0';
-           }
+           snprintf (pop_error, ERROR_MAX, "%s", fromserver);
          else
            {
              strcpy (pop_error,
@@ -690,8 +680,7 @@ pop_multi_first (popserver server, const char *command, char **response)
 
   if (0 == strncmp (*response, "-ERR", 4))
     {
-      strncpy (pop_error, *response, ERROR_MAX);
-      pop_error[ERROR_MAX-1] = '\0';
+      snprintf (pop_error, ERROR_MAX, "%s", *response);
       return (-1);
     }
   else if (0 == strncmp (*response, "+OK", 3))
@@ -864,8 +853,7 @@ pop_last (popserver server)
 
   if (! strncmp (fromserver, "-ERR", 4))
     {
-      strncpy (pop_error, fromserver, ERROR_MAX);
-      pop_error[ERROR_MAX-1] = '\0';
+      snprintf (pop_error, ERROR_MAX, "%s", fromserver);
       return (-1);
     }
   else if (strncmp (fromserver, "+OK ", 4))
@@ -1065,9 +1053,8 @@ socket_connection (char *host, int flags)
   sock = socket (PF_INET, SOCK_STREAM, 0);
   if (sock < 0)
     {
-      strcpy (pop_error, POP_SOCKET_ERROR);
-      strncat (pop_error, strerror (errno),
-              ERROR_MAX - sizeof (POP_SOCKET_ERROR));
+      snprintf (pop_error, ERROR_MAX, "%s%s",
+               POP_SOCKET_ERROR, strerror (errno));
       return (-1);
 
     }
@@ -1143,9 +1130,7 @@ socket_connection (char *host, int flags)
   if (! connect_ok)
     {
       CLOSESOCKET (sock);
-      strcpy (pop_error, CONNECT_ERROR);
-      strncat (pop_error, strerror (errno),
-              ERROR_MAX - sizeof (CONNECT_ERROR));
+      snprintf (pop_error, ERROR_MAX, "%s%s", CONNECT_ERROR, strerror (errno));
       return (-1);
 
     }
@@ -1163,9 +1148,8 @@ socket_connection (char *host, int flags)
            krb5_auth_con_free (kcontext, auth_context);
          if (kcontext)
            krb5_free_context (kcontext);
-         strcpy (pop_error, KRB_ERROR);
-         strncat (pop_error, error_message (rem),
-                  ERROR_MAX - sizeof (KRB_ERROR));
+         snprintf (pop_error, ERROR_MAX, "%s%s",
+                   KRB_ERROR, error_message (rem));
          CLOSESOCKET (sock);
          return (-1);
        }
@@ -1203,30 +1187,19 @@ socket_connection (char *host, int flags)
       krb5_free_principal (kcontext, server);
       if (rem)
        {
-         strcpy (pop_error, KRB_ERROR);
-         strncat (pop_error, error_message (rem),
-                  ERROR_MAX - sizeof (KRB_ERROR));
+         int pop_error_len = snprintf (pop_error, ERROR_MAX, "%s%s",
+                                       KRB_ERROR, error_message (rem));
 #if defined HAVE_KRB5_ERROR_TEXT
          if (err_ret && err_ret->text.length)
            {
-             strncat (pop_error, " [server says '",
-                      ERROR_MAX - strlen (pop_error) - 1);
-             strncat (pop_error, err_ret->text.data,
-                      min (ERROR_MAX - strlen (pop_error) - 1,
-                           err_ret->text.length));
-             strncat (pop_error, "']",
-                      ERROR_MAX - strlen (pop_error) - 1);
+             int errlen = err_ret->text.length;
+             snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len,
+                       " [server says '.*%s']", errlen, err_ret->text.data);
            }
 #elif defined HAVE_KRB5_ERROR_E_TEXT
-         if (err_ret && err_ret->e_text && strlen (*err_ret->e_text))
-           {
-             strncat (pop_error, " [server says '",
-                      ERROR_MAX - strlen (pop_error) - 1);
-             strncat (pop_error, *err_ret->e_text,
-                      ERROR_MAX - strlen (pop_error) - 1);
-             strncat (pop_error, "']",
-                      ERROR_MAX - strlen (pop_error) - 1);
-           }
+         if (err_ret && err_ret->e_text && **err_ret->e_text)
+           snprintf (pop_error + pop_error_len, ERRMAX - pop_error_len,
+                     " [server says '%s']", *err_ret->e_text);
 #endif
          if (err_ret)
            krb5_free_error (kcontext, err_ret);
@@ -1247,9 +1220,7 @@ socket_connection (char *host, int flags)
       free ((char *) ticket);
       if (rem != KSUCCESS)
        {
-         strcpy (pop_error, KRB_ERROR);
-         strncat (pop_error, krb_err_txt[rem],
-                  ERROR_MAX - sizeof (KRB_ERROR));
+         snprintf (pop_error, ERROR_MAX, "%s%s", KRB_ERROR, krb_err_txt[rem]);
          CLOSESOCKET (sock);
          return (-1);
        }
@@ -1354,9 +1325,8 @@ pop_getline (popserver server, char **line)
                  server->buffer_size - server->data - 1, 0);
       if (ret < 0)
        {
-         strcpy (pop_error, GETLINE_ERROR);
-         strncat (pop_error, strerror (errno),
-                  ERROR_MAX - sizeof (GETLINE_ERROR));
+         snprintf (pop_error, ERROR_MAX, "%s%s",
+                   GETLINE_ERROR, strerror (errno));
          pop_trash (server);
          return (-1);
        }
@@ -1440,9 +1410,7 @@ sendline (popserver server, const char *line)
   if (ret < 0)
     {
       pop_trash (server);
-      strcpy (pop_error, SENDLINE_ERROR);
-      strncat (pop_error, strerror (errno),
-              ERROR_MAX - sizeof (SENDLINE_ERROR));
+      snprintf (pop_error, ERROR_MAX, "%s%s", SENDLINE_ERROR, strerror (errno));
       return (ret);
     }
 
@@ -1504,8 +1472,7 @@ getok (popserver server)
     return (0);
   else if (! strncmp (fromline, "-ERR", 4))
     {
-      strncpy (pop_error, fromline, ERROR_MAX);
-      pop_error[ERROR_MAX-1] = '\0';
+      snprintf (pop_error, ERROR_MAX, "%s", fromline);
       return (-1);
     }
   else
index 8ed4f3189748e6e119bfc9143e88a0f84e1e27c4..d21f2c28e5875a2f9b9310496eae28239406a373 100644 (file)
@@ -20,7 +20,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 /**
- **  To be run as an emacs process. Input string that starts with:
+ **  To be run as an emacs subprocess.  Input string that starts with:
  **    'z' -- resets the watch (to zero).
  **    'p' -- return time (on stdout) as string with format <sec>.<micro-sec>
  **    'q' -- exit.
@@ -29,53 +29,42 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
  **  operations: reset_watch, get_time
  */
 #include <config.h>
+
+#include <inttypes.h>
 #include <stdio.h>
+
+#include <intprops.h>
 #include <systime.h>
 
-static EMACS_TIME TV1, TV2;
+static EMACS_TIME TV1;
 static int watch_not_started = 1; /* flag */
-static char time_string[30];
+static char time_string[INT_STRLEN_BOUND (uintmax_t) + sizeof "."
+                       + LOG10_EMACS_TIME_RESOLUTION];
 
 /* Reset the stopwatch to zero.  */
 
 static void
 reset_watch (void)
 {
-  EMACS_GET_TIME (TV1);
+  TV1 = current_emacs_time ();
   watch_not_started = 0;
 }
 
 /* This call returns the time since the last reset_watch call.  The time
-   is returned as a string with the format  <seconds>.<micro-seconds>
+   is returned as a string with the format  <seconds>.<nanoseconds>
    If reset_watch was not called yet, exit.  */
 
 static char *
 get_time (void)
 {
+  EMACS_TIME TV2 = sub_emacs_time (current_emacs_time (), TV1);
+  uintmax_t s = EMACS_SECS (TV2);
+  int ns = EMACS_NSECS (TV2);
   if (watch_not_started)
     exit (EXIT_FAILURE);  /* call reset_watch first ! */
-  EMACS_GET_TIME (TV2);
-  EMACS_SUB_TIME (TV2, TV2, TV1);
-  sprintf (time_string, "%lu.%06lu", (unsigned long)EMACS_SECS (TV2), (unsigned long)EMACS_USECS (TV2));
+  sprintf (time_string, "%"PRIuMAX".%0*d", s, LOG10_EMACS_TIME_RESOLUTION, ns);
   return time_string;
 }
-
-#if ! defined (HAVE_GETTIMEOFDAY) && defined (HAVE_TIMEVAL)
-
-/* ARGSUSED */
-gettimeofday (tp, tzp)
-     struct timeval *tp;
-     struct timezone *tzp;
-{
-  extern long time ();
-
-  tp->tv_sec = time ((long *)0);
-  tp->tv_usec = 0;
-  if (tzp != 0)
-    tzp->tz_minuteswest = -1;
-}
-
-#endif
 \f
 int
 main (void)
diff --git a/lib-src/rcs-checkin b/lib-src/rcs-checkin
deleted file mode 100755 (executable)
index 57e91be..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-#! /bin/sh
-
-# This script accepts any number of file arguments and checks them into RCS.
-
-# Copyright (C) 1993-1995, 2001-2012 Free Software Foundation, Inc.
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-# Arguments which are detectably either RCS masters (with names ending in ,v)
-# or Emacs version files  (with names of the form foo.~<number>~) are ignored.
-# For each file foo, the script looks for Emacs version files related to it.
-# These files are checked in as deltas, oldest first, so that the contents of
-# the file itself becomes the latest revision in the master.
-#
-# The first line of each file is used as its description text.  The file itself
-# is not deleted, as under VC with vc-keep-workfiles at its default of t, but
-# all the version files are.
-#
-# If an argument file is already version-controlled under RCS, any version
-# files are added to the list of deltas and deleted, and then the workfile
-# is checked in again as the latest version.  This is probably not quite
-# what was wanted, and is the main reason VC doesn't simply call this to
-# do checkins.
-#
-# This script is intended to be used to convert files with an old-Emacs-style
-# version history for use with VC (the Emacs 19 version-control interface),
-# which likes to use RCS as its back end.  It was written by Paul Eggert
-# and revised/documented for use with VC by Eric S. Raymond, Mar 19 1993.
-
-case $# in
-0)
-       echo "rcs-checkin: usage: rcs-checkin file ..."
-       echo "rcs-checkin: function: checks file.~*~ and file into a new RCS file"
-       echo "rcs-checkin: function: uses the file's first line for the description"
-esac
-
-# expr pattern to extract owner from ls -l output
-ls_owner_pattern='[^ ][^ ]*  *[^ ][^ ]*  *\([^ ][^ ]*\)'
-
-for file
-do
-       # Make it easier to say `rcs-checkin *'
-       # by ignoring file names that already contain `~', or end in `,v'.
-       case $file in
-       *~* | *,v) continue
-       esac
-       # Ignore non-files too.
-       test -f "$file" || continue
-
-       # Check that file is readable.
-       test -r "$file" || exit
-
-       # If the RCS file does not already exist,
-       # initialize it with a description from $file's first line.
-       rlog -R "$file" >/dev/null 2>&1 ||
-       rcs -i -q -t-"`sed 1q $file`" "$file" || exit
-
-       # Get list of old files.
-       oldfiles=`
-               ls $file.~[0-9]*~ 2>/dev/null |
-               sort -t~ -n -k 2
-       `
-
-       # Check that they are properly sorted by date.
-       case $oldfiles in
-       ?*)
-               oldfiles_by_date=`ls -rt $file $oldfiles`
-               test " $oldfiles
-$file" = " $oldfiles_by_date" || {
-                       echo >&2 "rcs-checkin: skipping $file, because its mod times are out of order.
-
-Sorted by mod time:
-$oldfiles_by_date
-
-Sorted by name:
-$oldfiles
-$file"
-                       continue
-               }
-       esac
-
-       echo >&2 rcs-checkin: checking in: $oldfiles $file
-
-       # Save $file as $file.~-~ temporarily.
-       mv "$file" "$file.~-~" || exit
-
-       # Rename each old file to $file, and check it in.
-       for oldfile in $oldfiles
-       do
-               mv "$oldfile" "$file" || exit
-               ls_l=`ls -l "$file"` || exit
-               owner=-w`expr " $ls_l" : " $ls_owner_pattern"` || owner=
-               echo "Formerly ${oldfile}" | ci -d -l -q $owner "$file" || exit
-       done
-
-       # Bring $file back from $file.~-~, and check it in.
-       mv "$file.~-~" "$file" || exit
-       ls_l=`ls -l "$file"` || exit
-       owner=-w`expr " $ls_l" : " $ls_owner_pattern"` || owner=
-       ci -d -q -u $owner -m"entered into RCS" "$file" || exit
-done
-
index a32bd6d8d78472498dc2a15c16fea720f2e3355d..40397536fad4f65b91e30690a54fb26850bcf193 100644 (file)
@@ -46,12 +46,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <fcntl.h>
 #endif
 #include <sys/stat.h>
-
-/* Needed for SunOS4, for instance.  */
-extern char *optarg;
-extern int optind, opterr;
-
-static int usage (int err) NO_RETURN;
+#include <getopt.h>
 
 #define MAX_ATTEMPTS 5
 #define MAX_SCORES 200
@@ -62,7 +57,7 @@ static int usage (int err) NO_RETURN;
 #define difftime(t1, t0) (double)((t1) - (t0))
 #endif
 
-static int
+static _Noreturn void
 usage (int err)
 {
   fprintf (stdout, "Usage: update-game-score [-m MAX] [-r] [-d DIR] game/scorefile SCORE DATA\n");
@@ -92,34 +87,14 @@ static void sort_scores (struct score_entry *scores, int count, int reverse);
 static int write_scores (const char *filename,
                         const struct score_entry *scores, int count);
 
-static void lose (const char *msg) NO_RETURN;
-
-static void
+static _Noreturn void
 lose (const char *msg)
 {
   fprintf (stderr, "%s\n", msg);
   exit (EXIT_FAILURE);
 }
 
-static void lose_syserr (const char *msg) NO_RETURN;
-
-/* Taken from sysdep.c.  */
-#ifndef HAVE_STRERROR
-#ifndef WINDOWSNT
-char *
-strerror (int errnum)
-{
-  extern char *sys_errlist[];
-  extern int sys_nerr;
-
-  if (errnum >= 0 && errnum < sys_nerr)
-    return sys_errlist[errnum];
-  return (char *) "Unknown error";
-}
-#endif /* not WINDOWSNT */
-#endif /* ! HAVE_STRERROR */
-
-static void
+static _Noreturn void
 lose_syserr (const char *msg)
 {
   fprintf (stderr, "%s: %s\n", msg, strerror (errno));
diff --git a/lib-src/vcdiff b/lib-src/vcdiff
deleted file mode 100755 (executable)
index dd7ca44..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-#! /bin/sh
-
-# Enhanced sccs diff utility for use with vc mode.
-# This version is more compatible with rcsdiff(1).
-
-# Copyright (C) 1992-1993, 1995, 1997, 2001-2012
-#   Free Software Foundation, Inc.
-
-# Author: Paul Eggert
-# (according to authors.el)
-
-# This file is part of GNU Emacs.
-
-# GNU Emacs is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-
-# GNU Emacs is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-
-DIFF="diff"
-usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..."
-
-# Now that we use `sccs get' rather than just `get', we don't need this.
-# PATH=$PATH:/usr/ccs/bin:/usr/sccs:/usr/xpg4/bin # common SCCS hangouts
-
-echo="echo"
-sid1= sid2=
-
-for f
-do
-       case $f in
-       -*)
-               case $f in
-               --brief)
-                       DIFF=cmp;;
-               -q)
-                       echo=:;;
-               -r?*)
-                       case $sid1 in
-                       '')
-                               sid1=$f
-                               ;;
-                       *)
-                               case $sid2 in
-                               ?*) echo "$usage" >&2; exit 2 ;;
-                               esac
-                               sid2=$f
-                               ;;
-                       esac
-                       ;;
-               *)
-                       options="$options $f"
-                       ;;
-               esac
-               shift
-               ;;
-       *)
-               break
-               ;;
-       esac
-done
-
-case $# in
-0)
-       echo "$usage" >&2
-       exit 2
-esac
-
-
-rev1= rev2= status=0
-trap 'status=2; exit' 1 2 13 15
-trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0
-
-for f
-do
-       s=2
-
-       case $f in
-       s.* | */s.*)
-               if
-                       rev1=`mktemp /tmp/geta.XXXXXXXX`
-                       sccs get -s -p -k $sid1 "$f" > $rev1 &&
-                       case $sid2 in
-                       '')
-                               workfile=`expr " /$f" : '.*/s.\(.*\)'`
-                               ;;
-                       *)
-                               rev2=`mktemp /tmp/getb.XXXXXXXX`
-                               sccs get -s -p -k $sid2 "$f" > $rev2
-                               workfile=$rev2
-                       esac
-               then
-                       $echo $DIFF $options $rev1 $workfile >&2
-                       $DIFF $options $rev1 $workfile
-                       s=$?
-               fi
-               ;;
-       *)
-               echo "$0: $f is not an SCCS file" >&2
-       esac
-
-       if test $status -lt $s
-       then status=$s
-       fi
-done
-
index 220ba713d4ef7044622d6fd53c52a9790ae64c8a..716510aff920e96cffe8ea32ba027487bcd024c7 100644 (file)
@@ -4,6 +4,7 @@ MOSTLYCLEANDIRS =
 MOSTLYCLEANFILES =
 noinst_LIBRARIES =
 
+AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
 DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src
 
 include gnulib.mk
index 5b69c6c81a803724507c7a2d256fc004fddfb769..d20f4b8f1c3d1d82e144dd6ffc9553845d8d369f 100644 (file)
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2011 Free Software Foundation,
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2012 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -14,9 +14,9 @@
    General Public License for more details.
 
    You should have received a copy of the GNU General Public
-   License along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-   USA.  */
+   License along with this program; if not, see
+   <http://www.gnu.org/licenses/>.
+  */
 
 /* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H
    means there is a real alloca function.  */
 #  define alloca _alloca
 # elif defined __DECC && defined __VMS
 #  define alloca __ALLOCA
+# elif defined __TANDEM && defined _TNS_E_TARGET
+#  ifdef  __cplusplus
+extern "C"
+#  endif
+void *_alloca (unsigned short);
+#  pragma intrinsic (_alloca)
+#  define alloca _alloca
 # else
 #  include <stddef.h>
 #  ifdef  __cplusplus
index b8de95c0f50c8d79dbb466ff0ea5e24a3e87b58e..81c4aa20a45c60ba791a4d363649323c2d923ba9 100644 (file)
@@ -1,6 +1,6 @@
 /* Memory allocators such as malloc+free.
 
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/c-ctype.c b/lib/c-ctype.c
new file mode 100644 (file)
index 0000000..952d7a8
--- /dev/null
@@ -0,0 +1,395 @@
+/* Character handling in C locale.
+
+   Copyright 2000-2003, 2006, 2009-2012 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#define NO_C_CTYPE_MACROS
+#include "c-ctype.h"
+
+/* The function isascii is not locale dependent. Its use in EBCDIC is
+   questionable. */
+bool
+c_isascii (int c)
+{
+  return (c >= 0x00 && c <= 0x7f);
+}
+
+bool
+c_isalnum (int c)
+{
+#if C_CTYPE_CONSECUTIVE_DIGITS \
+    && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+#if C_CTYPE_ASCII
+  return ((c >= '0' && c <= '9')
+          || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'));
+#else
+  return ((c >= '0' && c <= '9')
+          || (c >= 'A' && c <= 'Z')
+          || (c >= 'a' && c <= 'z'));
+#endif
+#else
+  switch (c)
+    {
+    case '0': case '1': case '2': case '3': case '4': case '5':
+    case '6': case '7': case '8': case '9':
+    case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+    case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+    case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+    case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+    case 'Y': case 'Z':
+    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+    case 'y': case 'z':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_isalpha (int c)
+{
+#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+#if C_CTYPE_ASCII
+  return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z');
+#else
+  return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
+#endif
+#else
+  switch (c)
+    {
+    case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+    case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+    case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+    case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+    case 'Y': case 'Z':
+    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+    case 'y': case 'z':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_isblank (int c)
+{
+  return (c == ' ' || c == '\t');
+}
+
+bool
+c_iscntrl (int c)
+{
+#if C_CTYPE_ASCII
+  return ((c & ~0x1f) == 0 || c == 0x7f);
+#else
+  switch (c)
+    {
+    case ' ': case '!': case '"': case '#': case '$': case '%':
+    case '&': case '\'': case '(': case ')': case '*': case '+':
+    case ',': case '-': case '.': case '/':
+    case '0': case '1': case '2': case '3': case '4': case '5':
+    case '6': case '7': case '8': case '9':
+    case ':': case ';': case '<': case '=': case '>': case '?':
+    case '@':
+    case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+    case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+    case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+    case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+    case 'Y': case 'Z':
+    case '[': case '\\': case ']': case '^': case '_': case '`':
+    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+    case 'y': case 'z':
+    case '{': case '|': case '}': case '~':
+      return 0;
+    default:
+      return 1;
+    }
+#endif
+}
+
+bool
+c_isdigit (int c)
+{
+#if C_CTYPE_CONSECUTIVE_DIGITS
+  return (c >= '0' && c <= '9');
+#else
+  switch (c)
+    {
+    case '0': case '1': case '2': case '3': case '4': case '5':
+    case '6': case '7': case '8': case '9':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_islower (int c)
+{
+#if C_CTYPE_CONSECUTIVE_LOWERCASE
+  return (c >= 'a' && c <= 'z');
+#else
+  switch (c)
+    {
+    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+    case 'y': case 'z':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_isgraph (int c)
+{
+#if C_CTYPE_ASCII
+  return (c >= '!' && c <= '~');
+#else
+  switch (c)
+    {
+    case '!': case '"': case '#': case '$': case '%': case '&':
+    case '\'': case '(': case ')': case '*': case '+': case ',':
+    case '-': case '.': case '/':
+    case '0': case '1': case '2': case '3': case '4': case '5':
+    case '6': case '7': case '8': case '9':
+    case ':': case ';': case '<': case '=': case '>': case '?':
+    case '@':
+    case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+    case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+    case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+    case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+    case 'Y': case 'Z':
+    case '[': case '\\': case ']': case '^': case '_': case '`':
+    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+    case 'y': case 'z':
+    case '{': case '|': case '}': case '~':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_isprint (int c)
+{
+#if C_CTYPE_ASCII
+  return (c >= ' ' && c <= '~');
+#else
+  switch (c)
+    {
+    case ' ': case '!': case '"': case '#': case '$': case '%':
+    case '&': case '\'': case '(': case ')': case '*': case '+':
+    case ',': case '-': case '.': case '/':
+    case '0': case '1': case '2': case '3': case '4': case '5':
+    case '6': case '7': case '8': case '9':
+    case ':': case ';': case '<': case '=': case '>': case '?':
+    case '@':
+    case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+    case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+    case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+    case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+    case 'Y': case 'Z':
+    case '[': case '\\': case ']': case '^': case '_': case '`':
+    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+    case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
+    case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
+    case 's': case 't': case 'u': case 'v': case 'w': case 'x':
+    case 'y': case 'z':
+    case '{': case '|': case '}': case '~':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_ispunct (int c)
+{
+#if C_CTYPE_ASCII
+  return ((c >= '!' && c <= '~')
+          && !((c >= '0' && c <= '9')
+               || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')));
+#else
+  switch (c)
+    {
+    case '!': case '"': case '#': case '$': case '%': case '&':
+    case '\'': case '(': case ')': case '*': case '+': case ',':
+    case '-': case '.': case '/':
+    case ':': case ';': case '<': case '=': case '>': case '?':
+    case '@':
+    case '[': case '\\': case ']': case '^': case '_': case '`':
+    case '{': case '|': case '}': case '~':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_isspace (int c)
+{
+  return (c == ' ' || c == '\t'
+          || c == '\n' || c == '\v' || c == '\f' || c == '\r');
+}
+
+bool
+c_isupper (int c)
+{
+#if C_CTYPE_CONSECUTIVE_UPPERCASE
+  return (c >= 'A' && c <= 'Z');
+#else
+  switch (c)
+    {
+    case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+    case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
+    case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
+    case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
+    case 'Y': case 'Z':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+bool
+c_isxdigit (int c)
+{
+#if C_CTYPE_CONSECUTIVE_DIGITS \
+    && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+#if C_CTYPE_ASCII
+  return ((c >= '0' && c <= '9')
+          || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F'));
+#else
+  return ((c >= '0' && c <= '9')
+          || (c >= 'A' && c <= 'F')
+          || (c >= 'a' && c <= 'f'));
+#endif
+#else
+  switch (c)
+    {
+    case '0': case '1': case '2': case '3': case '4': case '5':
+    case '6': case '7': case '8': case '9':
+    case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
+    case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
+      return 1;
+    default:
+      return 0;
+    }
+#endif
+}
+
+int
+c_tolower (int c)
+{
+#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+  return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c);
+#else
+  switch (c)
+    {
+    case 'A': return 'a';
+    case 'B': return 'b';
+    case 'C': return 'c';
+    case 'D': return 'd';
+    case 'E': return 'e';
+    case 'F': return 'f';
+    case 'G': return 'g';
+    case 'H': return 'h';
+    case 'I': return 'i';
+    case 'J': return 'j';
+    case 'K': return 'k';
+    case 'L': return 'l';
+    case 'M': return 'm';
+    case 'N': return 'n';
+    case 'O': return 'o';
+    case 'P': return 'p';
+    case 'Q': return 'q';
+    case 'R': return 'r';
+    case 'S': return 's';
+    case 'T': return 't';
+    case 'U': return 'u';
+    case 'V': return 'v';
+    case 'W': return 'w';
+    case 'X': return 'x';
+    case 'Y': return 'y';
+    case 'Z': return 'z';
+    default: return c;
+    }
+#endif
+}
+
+int
+c_toupper (int c)
+{
+#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+  return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c);
+#else
+  switch (c)
+    {
+    case 'a': return 'A';
+    case 'b': return 'B';
+    case 'c': return 'C';
+    case 'd': return 'D';
+    case 'e': return 'E';
+    case 'f': return 'F';
+    case 'g': return 'G';
+    case 'h': return 'H';
+    case 'i': return 'I';
+    case 'j': return 'J';
+    case 'k': return 'K';
+    case 'l': return 'L';
+    case 'm': return 'M';
+    case 'n': return 'N';
+    case 'o': return 'O';
+    case 'p': return 'P';
+    case 'q': return 'Q';
+    case 'r': return 'R';
+    case 's': return 'S';
+    case 't': return 'T';
+    case 'u': return 'U';
+    case 'v': return 'V';
+    case 'w': return 'W';
+    case 'x': return 'X';
+    case 'y': return 'Y';
+    case 'z': return 'Z';
+    default: return c;
+    }
+#endif
+}
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
new file mode 100644 (file)
index 0000000..0b31309
--- /dev/null
@@ -0,0 +1,294 @@
+/* Character handling in C locale.
+
+   These functions work like the corresponding functions in <ctype.h>,
+   except that they have the C (POSIX) locale hardwired, whereas the
+   <ctype.h> functions' behaviour depends on the current locale set via
+   setlocale.
+
+   Copyright (C) 2000-2003, 2006, 2008-2012 Free Software Foundation, Inc.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef C_CTYPE_H
+#define C_CTYPE_H
+
+#include <stdbool.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* The functions defined in this file assume the "C" locale and a character
+   set without diacritics (ASCII-US or EBCDIC-US or something like that).
+   Even if the "C" locale on a particular system is an extension of the ASCII
+   character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
+   is ISO-8859-1), the functions in this file recognize only the ASCII
+   characters.  */
+
+
+/* Check whether the ASCII optimizations apply. */
+
+/* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that
+   '0', '1', ..., '9' have consecutive integer values.  */
+#define C_CTYPE_CONSECUTIVE_DIGITS 1
+
+#if ('A' <= 'Z') \
+    && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \
+    && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \
+    && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \
+    && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \
+    && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \
+    && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \
+    && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \
+    && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \
+    && ('Y' + 1 == 'Z')
+#define C_CTYPE_CONSECUTIVE_UPPERCASE 1
+#endif
+
+#if ('a' <= 'z') \
+    && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \
+    && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \
+    && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \
+    && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \
+    && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \
+    && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \
+    && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \
+    && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \
+    && ('y' + 1 == 'z')
+#define C_CTYPE_CONSECUTIVE_LOWERCASE 1
+#endif
+
+#if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+    && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+    && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+    && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+    && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+    && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+    && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+    && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+    && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+    && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+    && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+    && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+    && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+    && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+    && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+    && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+    && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+    && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+    && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+    && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+    && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+    && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+    && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)
+/* The character set is ASCII or one of its variants or extensions, not EBCDIC.
+   Testing the value of '\n' and '\r' is not relevant.  */
+#define C_CTYPE_ASCII 1
+#endif
+
+
+/* Function declarations. */
+
+/* Unlike the functions in <ctype.h>, which require an argument in the range
+   of the 'unsigned char' type, the functions here operate on values that are
+   in the 'unsigned char' range or in the 'char' range.  In other words,
+   when you have a 'char' value, you need to cast it before using it as
+   argument to a <ctype.h> function:
+
+         const char *s = ...;
+         if (isalpha ((unsigned char) *s)) ...
+
+   but you don't need to cast it for the functions defined in this file:
+
+         const char *s = ...;
+         if (c_isalpha (*s)) ...
+ */
+
+extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */
+
+extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_islower (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST;
+extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST;
+
+extern int c_tolower (int c) _GL_ATTRIBUTE_CONST;
+extern int c_toupper (int c) _GL_ATTRIBUTE_CONST;
+
+
+#if defined __GNUC__ && defined __OPTIMIZE__ && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS
+
+/* ASCII optimizations. */
+
+#undef c_isascii
+#define c_isascii(c) \
+  ({ int __c = (c); \
+     (__c >= 0x00 && __c <= 0x7f); \
+   })
+
+#if C_CTYPE_CONSECUTIVE_DIGITS \
+    && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+#if C_CTYPE_ASCII
+#undef c_isalnum
+#define c_isalnum(c) \
+  ({ int __c = (c); \
+     ((__c >= '0' && __c <= '9') \
+      || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \
+   })
+#else
+#undef c_isalnum
+#define c_isalnum(c) \
+  ({ int __c = (c); \
+     ((__c >= '0' && __c <= '9') \
+      || (__c >= 'A' && __c <= 'Z') \
+      || (__c >= 'a' && __c <= 'z')); \
+   })
+#endif
+#endif
+
+#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+#if C_CTYPE_ASCII
+#undef c_isalpha
+#define c_isalpha(c) \
+  ({ int __c = (c); \
+     ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \
+   })
+#else
+#undef c_isalpha
+#define c_isalpha(c) \
+  ({ int __c = (c); \
+     ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \
+   })
+#endif
+#endif
+
+#undef c_isblank
+#define c_isblank(c) \
+  ({ int __c = (c); \
+     (__c == ' ' || __c == '\t'); \
+   })
+
+#if C_CTYPE_ASCII
+#undef c_iscntrl
+#define c_iscntrl(c) \
+  ({ int __c = (c); \
+     ((__c & ~0x1f) == 0 || __c == 0x7f); \
+   })
+#endif
+
+#if C_CTYPE_CONSECUTIVE_DIGITS
+#undef c_isdigit
+#define c_isdigit(c) \
+  ({ int __c = (c); \
+     (__c >= '0' && __c <= '9'); \
+   })
+#endif
+
+#if C_CTYPE_CONSECUTIVE_LOWERCASE
+#undef c_islower
+#define c_islower(c) \
+  ({ int __c = (c); \
+     (__c >= 'a' && __c <= 'z'); \
+   })
+#endif
+
+#if C_CTYPE_ASCII
+#undef c_isgraph
+#define c_isgraph(c) \
+  ({ int __c = (c); \
+     (__c >= '!' && __c <= '~'); \
+   })
+#endif
+
+#if C_CTYPE_ASCII
+#undef c_isprint
+#define c_isprint(c) \
+  ({ int __c = (c); \
+     (__c >= ' ' && __c <= '~'); \
+   })
+#endif
+
+#if C_CTYPE_ASCII
+#undef c_ispunct
+#define c_ispunct(c) \
+  ({ int _c = (c); \
+     (c_isgraph (_c) && ! c_isalnum (_c)); \
+   })
+#endif
+
+#undef c_isspace
+#define c_isspace(c) \
+  ({ int __c = (c); \
+     (__c == ' ' || __c == '\t' \
+      || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \
+   })
+
+#if C_CTYPE_CONSECUTIVE_UPPERCASE
+#undef c_isupper
+#define c_isupper(c) \
+  ({ int __c = (c); \
+     (__c >= 'A' && __c <= 'Z'); \
+   })
+#endif
+
+#if C_CTYPE_CONSECUTIVE_DIGITS \
+    && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+#if C_CTYPE_ASCII
+#undef c_isxdigit
+#define c_isxdigit(c) \
+  ({ int __c = (c); \
+     ((__c >= '0' && __c <= '9') \
+      || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \
+   })
+#else
+#undef c_isxdigit
+#define c_isxdigit(c) \
+  ({ int __c = (c); \
+     ((__c >= '0' && __c <= '9') \
+      || (__c >= 'A' && __c <= 'F') \
+      || (__c >= 'a' && __c <= 'f')); \
+   })
+#endif
+#endif
+
+#if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE
+#undef c_tolower
+#define c_tolower(c) \
+  ({ int __c = (c); \
+     (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \
+   })
+#undef c_toupper
+#define c_toupper(c) \
+  ({ int __c = (c); \
+     (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \
+   })
+#endif
+
+#endif /* optimizing for speed */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* C_CTYPE_H */
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
new file mode 100644 (file)
index 0000000..fdef238
--- /dev/null
@@ -0,0 +1,56 @@
+/* Case-insensitive string comparison functions in C locale.
+   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2012 Free Software
+   Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef C_STRCASE_H
+#define C_STRCASE_H
+
+#include <stddef.h>
+
+
+/* The functions defined in this file assume the "C" locale and a character
+   set without diacritics (ASCII-US or EBCDIC-US or something like that).
+   Even if the "C" locale on a particular system is an extension of the ASCII
+   character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it
+   is ISO-8859-1), the functions in this file recognize only the ASCII
+   characters.  More precisely, one of the string arguments must be an ASCII
+   string; the other one can also contain non-ASCII characters (but then
+   the comparison result will be nonzero).  */
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* Compare strings S1 and S2, ignoring case, returning less than, equal to or
+   greater than zero if S1 is lexicographically less than, equal to or greater
+   than S2.  */
+extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE;
+
+/* Compare no more than N characters of strings S1 and S2, ignoring case,
+   returning less than, equal to or greater than zero if S1 is
+   lexicographically less than, equal to or greater than S2.  */
+extern int c_strncasecmp (const char *s1, const char *s2, size_t n)
+  _GL_ATTRIBUTE_PURE;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* C_STRCASE_H */
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
new file mode 100644 (file)
index 0000000..d8332ca
--- /dev/null
@@ -0,0 +1,56 @@
+/* c-strcasecmp.c -- case insensitive string comparator in C locale
+   Copyright (C) 1998-1999, 2005-2006, 2009-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "c-strcase.h"
+
+#include <limits.h>
+
+#include "c-ctype.h"
+
+int
+c_strcasecmp (const char *s1, const char *s2)
+{
+  register const unsigned char *p1 = (const unsigned char *) s1;
+  register const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2)
+    return 0;
+
+  do
+    {
+      c1 = c_tolower (*p1);
+      c2 = c_tolower (*p2);
+
+      if (c1 == '\0')
+        break;
+
+      ++p1;
+      ++p2;
+    }
+  while (c1 == c2);
+
+  if (UCHAR_MAX <= INT_MAX)
+    return c1 - c2;
+  else
+    /* On machines where 'char' and 'int' are types of the same size, the
+       difference of two 'unsigned char' values - including the sign bit -
+       doesn't fit in an 'int'.  */
+    return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
+}
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
new file mode 100644 (file)
index 0000000..47fb5fd
--- /dev/null
@@ -0,0 +1,56 @@
+/* c-strncasecmp.c -- case insensitive string comparator in C locale
+   Copyright (C) 1998-1999, 2005-2006, 2009-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+/* Specification.  */
+#include "c-strcase.h"
+
+#include <limits.h>
+
+#include "c-ctype.h"
+
+int
+c_strncasecmp (const char *s1, const char *s2, size_t n)
+{
+  register const unsigned char *p1 = (const unsigned char *) s1;
+  register const unsigned char *p2 = (const unsigned char *) s2;
+  unsigned char c1, c2;
+
+  if (p1 == p2 || n == 0)
+    return 0;
+
+  do
+    {
+      c1 = c_tolower (*p1);
+      c2 = c_tolower (*p2);
+
+      if (--n == 0 || c1 == '\0')
+        break;
+
+      ++p1;
+      ++p2;
+    }
+  while (c1 == c2);
+
+  if (UCHAR_MAX <= INT_MAX)
+    return c1 - c2;
+  else
+    /* On machines where 'char' and 'int' are types of the same size, the
+       difference of two 'unsigned char' values - including the sign bit -
+       doesn't fit in an 'int'.  */
+    return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0);
+}
index 751578b9a58fc6f46894cbbef3237d716f1c347b..cd4aa846dcaac99ae3016a059bc33df78f2505ef 100644 (file)
@@ -1,6 +1,6 @@
 /* Read symbolic links into a buffer without size limitation, relative to fd.
 
-   Copyright (C) 2001, 2003-2004, 2007, 2009-2011 Free Software Foundation,
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2012 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
index 6576fb2cecc98f89f5789c65a2ff069d2a369ddd..c21d3f459cdb645e001ded804260b284841db093 100644 (file)
@@ -1,6 +1,6 @@
 /* Read symbolic links into a buffer without size limitation, relative to fd.
 
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index acdd03b156e32c902d182da75b6c1e6e3a51d49a..0468ce4dc810baec2abdfb6f8ee04beda60ef069 100644 (file)
@@ -1,6 +1,6 @@
 /* File names on MS-DOS/Windows systems.
 
-   Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2004-2006, 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c
new file mode 100644 (file)
index 0000000..f30fa07
--- /dev/null
@@ -0,0 +1,69 @@
+/* Convert double to timespec.
+
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+/* Convert the double value SEC to a struct timespec.  Round toward
+   positive infinity.  On overflow, return an extremal value.  */
+
+#include <config.h>
+
+#include "timespec.h"
+
+#include "intprops.h"
+
+struct timespec
+dtotimespec (double sec)
+{
+  enum { BILLION = 1000 * 1000 * 1000 };
+  double min_representable = TYPE_MINIMUM (time_t);
+  double max_representable =
+    ((TYPE_MAXIMUM (time_t) * (double) BILLION + (BILLION - 1))
+     / BILLION);
+  struct timespec r;
+
+  if (! (min_representable < sec))
+    {
+      r.tv_sec = TYPE_MINIMUM (time_t);
+      r.tv_nsec = 0;
+    }
+  else if (! (sec < max_representable))
+    {
+      r.tv_sec = TYPE_MAXIMUM (time_t);
+      r.tv_nsec = BILLION - 1;
+    }
+  else
+    {
+      time_t s = sec;
+      double frac = BILLION * (sec - s);
+      long ns = frac;
+      ns += ns < frac;
+      s += ns / BILLION;
+      ns %= BILLION;
+
+      if (ns < 0)
+        {
+          s--;
+          ns += BILLION;
+        }
+
+      r.tv_sec = s;
+      r.tv_nsec = ns;
+    }
+
+  return r;
+}
index 790c98a2e846c7ccd823b98c5ed2e816a3a5705c..f6d0f1c73c5aa3c1fe4d7b66c933d553885df7f6 100644 (file)
@@ -1,6 +1,6 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
 
-   Copyright (C) 1999, 2004-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004-2007, 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -31,7 +31,7 @@
 
 # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 
-/* Get declarations of the Win32 API functions.  */
+/* Get declarations of the native Windows API functions.  */
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 
index 0f6641ace6a364bdc488a5dc2643f97e4c93bec7..ed8c6c989f1c479f13db174db11b89eb13fd220e 100644 (file)
@@ -1,6 +1,6 @@
 /* filemode.c -- make a string describing file modes
 
-   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2011 Free
+   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2012 Free
    Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -21,8 +21,8 @@
 #include "filemode.h"
 
 /* The following is for Cray DMF (Data Migration Facility), which is a
-   HSM file system.  A migrated file has a `st_dm_mode' that is
-   different from the normal `st_mode', so any tests for migrated
+   HSM file system.  A migrated file has a 'st_dm_mode' that is
+   different from the normal 'st_mode', so any tests for migrated
    files should use the former.  */
 #if HAVE_ST_DM_MODE
 # define IS_MIGRATED_FILE(statp) \
index 1a50302704cf5f717936dec4c247235ab28dd91a..3ca19b856230c77fe7e4445e7bf1d566bf9a0647 100644 (file)
@@ -1,6 +1,6 @@
 /* Make a string describing file modes.
 
-   Copyright (C) 1998-1999, 2003, 2006, 2009-2011 Free Software Foundation,
+   Copyright (C) 1998-1999, 2003, 2006, 2009-2012 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -23,7 +23,7 @@
 
 /* Get the declaration of strmode.  */
 # if HAVE_DECL_STRMODE
-#  include <string.h> /* MacOS X, FreeBSD, OpenBSD */
+#  include <string.h> /* Mac OS X, FreeBSD, OpenBSD */
 #  include <unistd.h> /* NetBSD */
 # endif
 
index 7c99ef00f385129e8f3b32cad3ee8c5ce378703f..ebeed3e1347b454779a9a3f39ab54c251d23a977 100644 (file)
@@ -1,6 +1,6 @@
 /* floating point to accurate string
 
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -29,7 +29,6 @@
 
 #include "ftoastr.h"
 
-#include "intprops.h"
 #include <float.h>
 #include <stdio.h>
 #include <stdlib.h>
index 6264952e8e97e1563afd351c038af3823e777cf6..89869a2238f4fa6d33208a0ff7eee5165ba50710 100644 (file)
@@ -1,6 +1,6 @@
 /* floating point to accurate string
 
-   Copyright (C) 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2010-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -58,7 +58,7 @@ enum
     FTOASTR_ALWAYS_SIGNED = 2,
 
     /* Output " " before positive numbers; ignored if
-       FTOASTER_ALWAYS_SIGNED is also given.  */
+       FTOASTR_ALWAYS_SIGNED is also given.  */
     FTOASTR_SPACE_POSITIVE = 4,
 
     /* Pad with zeros instead of spaces; ignored if FTOASTR_LEFT_JUSTIFY
index d324451ef15796316f17fb0203bc0da467b0a044..a8ffefee33f6d3ef79971b56007085b1ee026da5 100644 (file)
@@ -1,6 +1,6 @@
 /* Get the system load averages.
 
-   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2011 Free Software
+   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2012 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with gnulib.
@@ -28,7 +28,7 @@
                                 macro that comes with autoconf 2.13 or newer.
                                 If that isn't an option, then just put
                                 AC_CHECK_FUNCS(pstat_getdynamic) in your
-                                configure.in file.
+                                configure.ac file.
    HAVE_LIBPERFSTAT Define this if your system has the
                                 perfstat_cpu_total function in libperfstat (AIX).
    FIXUP_KERNEL_SYMBOL_ADDR()   Adjust address in returned struct nlist.
@@ -46,7 +46,7 @@
    NLIST_STRUCT                 Include nlist.h, not a.out.h.
    N_NAME_POINTER               The nlist n_name element is a pointer,
                                 not an array.
-   HAVE_STRUCT_NLIST_N_UN_N_NAME `n_un.n_name' is member of `struct nlist'.
+   HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
    LINUX_LDAV_FILE              [__linux__, __CYGWIN__]: File containing
                                 load averages.
 
    We also #define LDAV_PRIVILEGED if a program will require
    special installation to be able to call getloadavg.  */
 
-/* "configure" defines CONFIGURING_GETLOADAVG to sidestep problems
-   with partially-configured source directories.  */
-
-#ifndef CONFIGURING_GETLOADAVG
-# include <config.h>
-# include <stdbool.h>
-#endif
+#include <config.h>
 
 /* Specification.  */
 #include <stdlib.h>
 
 #include <errno.h>
+#include <stdbool.h>
 #include <stdio.h>
 
 # include <sys/types.h>
 
-/* Both the Emacs and non-Emacs sections want this.  Some
-   configuration files' definitions for the LOAD_AVE_CVT macro (like
-   sparc.h's) use macros like FSCALE, defined here.  */
-# if defined (unix) || defined (__unix)
+# if HAVE_SYS_PARAM_H
 #  include <sys/param.h>
 # endif
 
 # include "intprops.h"
 
-/* The existing Emacs configuration files define a macro called
-   LOAD_AVE_CVT, which accepts a value of type LOAD_AVE_TYPE, and
-   returns the load average multiplied by 100.  What we actually want
-   is a macro called LDAV_CVT, which returns the load average as an
-   unmultiplied double.
-
-   For backwards compatibility, we'll define LDAV_CVT in terms of
-   LOAD_AVE_CVT, but future machine config files should just define
-   LDAV_CVT directly.  */
-
-# if !defined (LDAV_CVT) && defined (LOAD_AVE_CVT)
-#  define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0)
-# endif
-
 # if !defined (BSD) && defined (ultrix)
 /* Ultrix behaves like BSD on Vaxen.  */
 #  define BSD
@@ -794,7 +772,7 @@ getloadavg (double loadavg[], int nelem)
 #  define LDAV_DONE
   /* This call can return -1 for an error, but with good args
      it's not supposed to fail.  The first argument is for no
-     apparent reason of type `long int *'.  */
+     apparent reason of type 'long int *'.  */
   dg_sys_info ((long int *) &load_info,
                DG_SYS_INFO_LOAD_INFO_TYPE,
                DG_SYS_INFO_LOAD_VERSION_0);
index 7c9f704061210f4473fee7edfe196350920dbab6..4342a34104c392c253d80fab6af534e3640e0855 100644 (file)
@@ -2,7 +2,7 @@
    NOTE: getopt is part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to drepper@gnu.org
    before changing it!
-   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2011 Free Software
+   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
 # include <wchar.h>
 #endif
 
-/* This version of `getopt' appears to the caller like standard Unix `getopt'
+/* This version of 'getopt' appears to the caller like standard Unix 'getopt'
    but it behaves differently for the user, since it allows the user
    to intersperse the options with the other arguments.
 
-   As `getopt_long' works, it permutes the elements of ARGV so that,
+   As 'getopt_long' works, it permutes the elements of ARGV so that,
    when it is done, all the options precede everything else.  Thus
    all application programs are extended to handle flexible argument order.
 
-   Using `getopt' or setting the environment variable POSIXLY_CORRECT
+   Using 'getopt' or setting the environment variable POSIXLY_CORRECT
    disables permutation.
    Then the behavior is completely standard.
 
 
 #include "getopt_int.h"
 
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
+/* For communication from 'getopt' to the caller.
+   When 'getopt' finds an option that takes an argument,
    the argument value is returned here.
-   Also, when `ordering' is RETURN_IN_ORDER,
+   Also, when 'ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
 char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
-   and for communication between successive calls to `getopt'.
+   and for communication between successive calls to 'getopt'.
 
-   On entry to `getopt', zero means this is the first call; initialize.
+   On entry to 'getopt', zero means this is the first call; initialize.
 
-   When `getopt' returns -1, this is the index of the first of the
+   When 'getopt' returns -1, this is the index of the first of the
    non-option elements that the caller should itself scan.
 
-   Otherwise, `optind' communicates from one call to the next
+   Otherwise, 'optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
 /* 1003.2 says this must be 1 before any call.  */
@@ -137,7 +137,7 @@ extern char *__getopt_nonoption_flags;
    The other is elements [last_nonopt,optind), which contains all
    the options processed since those non-options were skipped.
 
-   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   'first_nonopt' and 'last_nonopt' are relocated so that they describe
    the new indices of the non-options in ARGV after they are moved.  */
 
 static void
@@ -154,7 +154,7 @@ exchange (char **argv, struct _getopt_data *d)
      but it consists of two parts that need to be swapped next.  */
 
 #if defined _LIBC && defined USE_NONOPTION_FLAGS
-  /* First make sure the handling of the `__getopt_nonoption_flags'
+  /* First make sure the handling of the '__getopt_nonoption_flags'
      string can work normally.  Our top argument must be in the range
      of the string.  */
   if (d->__nonoption_flags_len > 0 && top >= d->__nonoption_flags_max_len)
@@ -291,48 +291,48 @@ _getopt_initialize (int argc _GL_UNUSED,
 
    If an element of ARGV starts with '-', and is not exactly "-" or "--",
    then it is an option element.  The characters of this element
-   (aside from the initial '-') are option characters.  If `getopt'
+   (aside from the initial '-') are option characters.  If 'getopt'
    is called repeatedly, it returns successively each of the option characters
    from each of the option elements.
 
-   If `getopt' finds another option character, it returns that character,
-   updating `optind' and `nextchar' so that the next call to `getopt' can
+   If 'getopt' finds another option character, it returns that character,
+   updating 'optind' and 'nextchar' so that the next call to 'getopt' can
    resume the scan with the following option character or ARGV-element.
 
-   If there are no more option characters, `getopt' returns -1.
-   Then `optind' is the index in ARGV of the first ARGV-element
+   If there are no more option characters, 'getopt' returns -1.
+   Then 'optind' is the index in ARGV of the first ARGV-element
    that is not an option.  (The ARGV-elements have been permuted
    so that those that are not options now come last.)
 
    OPTSTRING is a string containing the legitimate option characters.
    If an option character is seen that is not listed in OPTSTRING,
-   return '?' after printing an error message.  If you set `opterr' to
+   return '?' after printing an error message.  If you set 'opterr' to
    zero, the error message is suppressed but we still return '?'.
 
    If a char in OPTSTRING is followed by a colon, that means it wants an arg,
    so the following text in the same ARGV-element, or the text of the following
-   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   ARGV-element, is returned in 'optarg'.  Two colons mean an option that
    wants an optional arg; if there is text in the current ARGV-element,
-   it is returned in `optarg', otherwise `optarg' is set to zero.
+   it is returned in 'optarg', otherwise 'optarg' is set to zero.
 
-   If OPTSTRING starts with `-' or `+', it requests different methods of
+   If OPTSTRING starts with '-' or '+', it requests different methods of
    handling the non-option ARGV-elements.
    See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
 
-   Long-named options begin with `--' instead of `-'.
+   Long-named options begin with '--' instead of '-'.
    Their names may be abbreviated as long as the abbreviation is unique
    or is an exact match for some defined option.  If they have an
    argument, it follows the option name in the same ARGV-element, separated
-   from the option name by a `=', or else the in next ARGV-element.
-   When `getopt' finds a long-named option, it returns 0 if that option's
-   `flag' field is nonzero, the value of the option's `val' field
-   if the `flag' field is zero.
+   from the option name by a '=', or else the in next ARGV-element.
+   When 'getopt' finds a long-named option, it returns 0 if that option's
+   'flag' field is nonzero, the value of the option's 'val' field
+   if the 'flag' field is zero.
 
    The elements of ARGV aren't really const, because we permute them.
    But we pretend they're const in the prototype to be compatible
    with other systems.
 
-   LONGOPTS is a vector of `struct option' terminated by an
+   LONGOPTS is a vector of 'struct option' terminated by an
    element containing a name which is zero.
 
    LONGIND returns the index in LONGOPT of the long-named option found.
@@ -409,7 +409,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
           d->__last_nonopt = d->optind;
         }
 
-      /* The special ARGV-element `--' means premature end of options.
+      /* The special ARGV-element '--' means premature end of options.
          Skip it like a null option,
          then exchange with previous non-options as if it were an option,
          then skip everything else like a non-option.  */
@@ -788,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
     char c = *d->__nextchar++;
     const char *temp = strchr (optstring, c);
 
-    /* Increment `optind' when we start to process its last character.  */
+    /* Increment 'optind' when we start to process its last character.  */
     if (*d->__nextchar == '\0')
       ++d->optind;
 
@@ -887,7 +887,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
             return c;
           }
         else
-          /* We already incremented `d->optind' once;
+          /* We already incremented 'd->optind' once;
              increment it again when taking next ARGV-elt as argument.  */
           d->optarg = argv[d->optind++];
 
@@ -1114,7 +1114,7 @@ _getopt_internal_r (int argc, char **argv, const char *optstring,
                   c = '?';
               }
             else
-              /* We already incremented `optind' once;
+              /* We already incremented 'optind' once;
                  increment it again when taking next ARGV-elt as argument.  */
               d->optarg = argv[d->optind++];
             d->__nextchar = NULL;
@@ -1177,7 +1177,7 @@ __posix_getopt (int argc, char *const *argv, const char *optstring)
 #ifdef TEST
 
 /* Compile with -DTEST to make an executable for use in testing
-   the above definition of `getopt'.  */
+   the above definition of 'getopt'.  */
 
 int
 main (int argc, char **argv)
index 0f3918ab771095e95213552455d9608d75e3dfd6..06b6dfc50c2dbf2f9011ada0a28099e42d27595f 100644 (file)
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2011 Free Software
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -82,7 +82,7 @@
    getopt_long_only can permute argv; this is required for backward
    compatibility (e.g., for LSB 2.0.1).
 
-   This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',
+   This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
    but it caused redefinition warnings if both unistd.h and getopt.h were
    included, since unistd.h includes getopt.h having previously defined
    __need_getopt.
 extern "C" {
 #endif
 
-/* For communication from `getopt' to the caller.
-   When `getopt' finds an option that takes an argument,
+/* For communication from 'getopt' to the caller.
+   When 'getopt' finds an option that takes an argument,
    the argument value is returned here.
-   Also, when `ordering' is RETURN_IN_ORDER,
+   Also, when 'ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
 extern char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
-   and for communication between successive calls to `getopt'.
+   and for communication between successive calls to 'getopt'.
 
-   On entry to `getopt', zero means this is the first call; initialize.
+   On entry to 'getopt', zero means this is the first call; initialize.
 
-   When `getopt' returns -1, this is the index of the first of the
+   When 'getopt' returns -1, this is the index of the first of the
    non-option elements that the caller should itself scan.
 
-   Otherwise, `optind' communicates from one call to the next
+   Otherwise, 'optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
 extern int optind;
 
-/* Callers store zero here to inhibit the error message `getopt' prints
+/* Callers store zero here to inhibit the error message 'getopt' prints
    for unrecognized options.  */
 
 extern int opterr;
@@ -162,24 +162,24 @@ extern int optopt;
 #ifndef __need_getopt
 /* Describe the long-named options requested by the application.
    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
-   of `struct option' terminated by an element containing a name which is
+   of 'struct option' terminated by an element containing a name which is
    zero.
 
-   The field `has_arg' is:
+   The field 'has_arg' is:
    no_argument          (or 0) if the option does not take an argument,
    required_argument    (or 1) if the option requires an argument,
    optional_argument    (or 2) if the option takes an optional argument.
 
-   If the field `flag' is not NULL, it points to a variable that is set
-   to the value given in the field `val' when the option is found, but
+   If the field 'flag' is not NULL, it points to a variable that is set
+   to the value given in the field 'val' when the option is found, but
    left unchanged if the option is not found.
 
-   To have a long-named option do something other than set an `int' to
-   a compiled-in constant, such as set a value from `optarg', set the
-   option's `flag' field to zero and its `val' field to a nonzero
+   To have a long-named option do something other than set an 'int' to
+   a compiled-in constant, such as set a value from 'optarg', set the
+   option's 'flag' field to zero and its 'val' field to a nonzero
    value (the equivalent single-letter option character, if there is
-   one).  For long options that have a zero `flag' field, `getopt'
-   returns the contents of the `val' field.  */
+   one).  For long options that have a zero 'flag' field, 'getopt'
+   returns the contents of the 'val' field.  */
 
 # if !GNULIB_defined_struct_option
 struct option
@@ -194,7 +194,7 @@ struct option
 #  define GNULIB_defined_struct_option 1
 # endif
 
-/* Names for the values of the `has_arg' field of `struct option'.  */
+/* Names for the values of the 'has_arg' field of 'struct option'.  */
 
 # define no_argument            0
 # define required_argument      1
@@ -208,23 +208,23 @@ struct option
 
    Return the option character from OPTS just read.  Return -1 when
    there are no more options.  For unrecognized options, or options
-   missing arguments, `optopt' is set to the option letter, and '?' is
+   missing arguments, 'optopt' is set to the option letter, and '?' is
    returned.
 
    The OPTS string is a list of characters which are recognized option
    letters, optionally followed by colons, specifying that that letter
-   takes an argument, to be placed in `optarg'.
+   takes an argument, to be placed in 'optarg'.
 
    If a letter in OPTS is followed by two colons, its argument is
-   optional.  This behavior is specific to the GNU `getopt'.
+   optional.  This behavior is specific to the GNU 'getopt'.
 
-   The argument `--' causes premature termination of argument
-   scanning, explicitly telling `getopt' that there are no more
+   The argument '--' causes premature termination of argument
+   scanning, explicitly telling 'getopt' that there are no more
    options.
 
-   If OPTS begins with `-', then non-option arguments are treated as
+   If OPTS begins with '-', then non-option arguments are treated as
    arguments to the option '\1'.  This behavior is specific to the GNU
-   `getopt'.  If OPTS begins with `+', or POSIXLY_CORRECT is set in
+   'getopt'.  If OPTS begins with '+', or POSIXLY_CORRECT is set in
    the environment, then do not permute arguments.  */
 
 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
index 36568024cc275358005b0b17be37b29ba1954899..fb2a8f5a7b1a7b874c0b6eefe95eafb8b936589e 100644 (file)
@@ -1,5 +1,5 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2011 Free Software
+   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -141,11 +141,11 @@ main (int argc, char **argv)
           break;
 
         case 'c':
-          printf ("option c with value `%s'\n", optarg);
+          printf ("option c with value '%s'\n", optarg);
           break;
 
         case 'd':
-          printf ("option d with value `%s'\n", optarg);
+          printf ("option d with value '%s'\n", optarg);
           break;
 
         case '?':
index e0923962b4f30b29e8cd96794b4651c3d0105b72..d69f57b9cf756e6ca22357d55de3aa8b60afe968 100644 (file)
-/* Declarations for getopt.\r
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2011 Free Software\r
-   Foundation, Inc.\r
-   This file is part of the GNU C Library.\r
-\r
-   This program is free software: you can redistribute it and/or modify\r
-   it under the terms of the GNU General Public License as published by\r
-   the Free Software Foundation; either version 3 of the License, or\r
-   (at your option) any later version.\r
-\r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-   GNU General Public License for more details.\r
-\r
-   You should have received a copy of the GNU General Public License\r
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\r
-\r
-#ifndef _GL_GETOPT_H\r
-\r
-#if __GNUC__ >= 3\r
-#pragma GCC system_header\r
-#endif\r
-\r
-\r
-/* The include_next requires a split double-inclusion guard.  We must\r
-   also inform the replacement unistd.h to not recursively use\r
-   <getopt.h>; our definitions will be present soon enough.  */\r
-#if HAVE_GETOPT_H\r
-# define _GL_SYSTEM_GETOPT\r
-# ifndef __GNUC__\r
-# include <next_getopt.h>\r
-# else\r
-# include_next <getopt.h>\r
-# endif\r
-# undef _GL_SYSTEM_GETOPT\r
-#endif\r
-\r
-#ifndef _GL_GETOPT_H\r
-\r
-#ifndef __need_getopt\r
-# define _GL_GETOPT_H 1\r
-#endif\r
-\r
-/* Standalone applications should #define __GETOPT_PREFIX to an\r
-   identifier that prefixes the external functions and variables\r
-   defined in this header.  When this happens, include the\r
-   headers that might declare getopt so that they will not cause\r
-   confusion if included after this file (if the system had <getopt.h>,\r
-   we have already included it).  Then systematically rename\r
-   identifiers so that they do not collide with the system functions\r
-   and variables.  Renaming avoids problems with some compilers and\r
-   linkers.  */\r
-#if defined __GETOPT_PREFIX && !defined __need_getopt\r
-# if !HAVE_GETOPT_H\r
-#  include <stdlib.h>\r
-#  include <stdio.h>\r
-#  include <unistd.h>\r
-# endif\r
-# undef __need_getopt\r
-# undef getopt\r
-# undef getopt_long\r
-# undef getopt_long_only\r
-# undef optarg\r
-# undef opterr\r
-# undef optind\r
-# undef optopt\r
-# undef option\r
-# define __GETOPT_CONCAT(x, y) x ## y\r
-# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)\r
-# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)\r
-# define getopt __GETOPT_ID (getopt)\r
-# define getopt_long __GETOPT_ID (getopt_long)\r
-# define getopt_long_only __GETOPT_ID (getopt_long_only)\r
-# define optarg __GETOPT_ID (optarg)\r
-# define opterr __GETOPT_ID (opterr)\r
-# define optind __GETOPT_ID (optind)\r
-# define optopt __GETOPT_ID (optopt)\r
-# define option __GETOPT_ID (option)\r
-# define _getopt_internal __GETOPT_ID (getopt_internal)\r
-#endif\r
-\r
-/* Standalone applications get correct prototypes for getopt_long and\r
-   getopt_long_only; they declare "char **argv".  libc uses prototypes\r
-   with "char *const *argv" that are incorrect because getopt_long and\r
-   getopt_long_only can permute argv; this is required for backward\r
-   compatibility (e.g., for LSB 2.0.1).\r
-\r
-   This used to be `#if defined __GETOPT_PREFIX && !defined __need_getopt',\r
-   but it caused redefinition warnings if both unistd.h and getopt.h were\r
-   included, since unistd.h includes getopt.h having previously defined\r
-   __need_getopt.\r
-\r
-   The only place where __getopt_argv_const is used is in definitions\r
-   of getopt_long and getopt_long_only below, but these are visible\r
-   only if __need_getopt is not defined, so it is quite safe to rewrite\r
-   the conditional as follows:\r
-*/\r
-#if !defined __need_getopt\r
-# if defined __GETOPT_PREFIX\r
-#  define __getopt_argv_const /* empty */\r
-# else\r
-#  define __getopt_argv_const const\r
-# endif\r
-#endif\r
-\r
-/* If __GNU_LIBRARY__ is not already defined, either we are being used\r
-   standalone, or this is the first header included in the source file.\r
-   If we are being used with glibc, we need to include <features.h>, but\r
-   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is\r
-   not defined, include <ctype.h>, which will pull in <features.h> for us\r
-   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it\r
-   doesn't flood the namespace with stuff the way some other headers do.)  */\r
-#if !defined __GNU_LIBRARY__\r
-# include <ctype.h>\r
-#endif\r
-\r
-#ifndef __THROW\r
-# ifndef __GNUC_PREREQ\r
-#  define __GNUC_PREREQ(maj, min) (0)\r
-# endif\r
-# if defined __cplusplus && __GNUC_PREREQ (2,8)\r
-#  define __THROW       throw ()\r
-# else\r
-#  define __THROW\r
-# endif\r
-#endif\r
-\r
-/* The definition of _GL_ARG_NONNULL is copied here.  */\r
-/* A C macro for declaring that specific arguments must not be NULL.\r
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.\r
-\r
-   This program is free software: you can redistribute it and/or modify it\r
-   under the terms of the GNU General Public License as published\r
-   by the Free Software Foundation; either version 3 of the License, or\r
-   (at your option) any later version.\r
-\r
-   This program is distributed in the hope that it will be useful,\r
-   but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
-   General Public License for more details.\r
-\r
-   You should have received a copy of the GNU General Public License\r
-   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */\r
-\r
-/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools\r
-   that the values passed as arguments n, ..., m must be non-NULL pointers.\r
-   n = 1 stands for the first argument, n = 2 for the second argument etc.  */\r
-#ifndef _GL_ARG_NONNULL\r
-# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3\r
-#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))\r
-# else\r
-#  define _GL_ARG_NONNULL(params)\r
-# endif\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/* For communication from `getopt' to the caller.\r
-   When `getopt' finds an option that takes an argument,\r
-   the argument value is returned here.\r
-   Also, when `ordering' is RETURN_IN_ORDER,\r
-   each non-option ARGV-element is returned here.  */\r
-\r
-extern char *optarg;\r
-\r
-/* Index in ARGV of the next element to be scanned.\r
-   This is used for communication to and from the caller\r
-   and for communication between successive calls to `getopt'.\r
-\r
-   On entry to `getopt', zero means this is the first call; initialize.\r
-\r
-   When `getopt' returns -1, this is the index of the first of the\r
-   non-option elements that the caller should itself scan.\r
-\r
-   Otherwise, `optind' communicates from one call to the next\r
-   how much of ARGV has been scanned so far.  */\r
-\r
-extern int optind;\r
-\r
-/* Callers store zero here to inhibit the error message `getopt' prints\r
-   for unrecognized options.  */\r
-\r
-extern int opterr;\r
-\r
-/* Set to an option character which was unrecognized.  */\r
-\r
-extern int optopt;\r
-\r
-#ifndef __need_getopt\r
-/* Describe the long-named options requested by the application.\r
-   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector\r
-   of `struct option' terminated by an element containing a name which is\r
-   zero.\r
-\r
-   The field `has_arg' is:\r
-   no_argument          (or 0) if the option does not take an argument,\r
-   required_argument    (or 1) if the option requires an argument,\r
-   optional_argument    (or 2) if the option takes an optional argument.\r
-\r
-   If the field `flag' is not NULL, it points to a variable that is set\r
-   to the value given in the field `val' when the option is found, but\r
-   left unchanged if the option is not found.\r
-\r
-   To have a long-named option do something other than set an `int' to\r
-   a compiled-in constant, such as set a value from `optarg', set the\r
-   option's `flag' field to zero and its `val' field to a nonzero\r
-   value (the equivalent single-letter option character, if there is\r
-   one).  For long options that have a zero `flag' field, `getopt'\r
-   returns the contents of the `val' field.  */\r
-\r
-# if !GNULIB_defined_struct_option\r
-struct option\r
-{\r
-  const char *name;\r
-  /* has_arg can't be an enum because some compilers complain about\r
-     type mismatches in all the code that assumes it is an int.  */\r
-  int has_arg;\r
-  int *flag;\r
-  int val;\r
-};\r
-#  define GNULIB_defined_struct_option 1\r
-# endif\r
-\r
-/* Names for the values of the `has_arg' field of `struct option'.  */\r
-\r
-# define no_argument            0\r
-# define required_argument      1\r
-# define optional_argument      2\r
-#endif  /* need getopt */\r
-\r
-\r
-/* Get definitions and prototypes for functions to process the\r
-   arguments in ARGV (ARGC of them, minus the program name) for\r
-   options given in OPTS.\r
-\r
-   Return the option character from OPTS just read.  Return -1 when\r
-   there are no more options.  For unrecognized options, or options\r
-   missing arguments, `optopt' is set to the option letter, and '?' is\r
-   returned.\r
-\r
-   The OPTS string is a list of characters which are recognized option\r
-   letters, optionally followed by colons, specifying that that letter\r
-   takes an argument, to be placed in `optarg'.\r
-\r
-   If a letter in OPTS is followed by two colons, its argument is\r
-   optional.  This behavior is specific to the GNU `getopt'.\r
-\r
-   The argument `--' causes premature termination of argument\r
-   scanning, explicitly telling `getopt' that there are no more\r
-   options.\r
-\r
-   If OPTS begins with `-', then non-option arguments are treated as\r
-   arguments to the option '\1'.  This behavior is specific to the GNU\r
-   `getopt'.  If OPTS begins with `+', or POSIXLY_CORRECT is set in\r
-   the environment, then do not permute arguments.  */\r
-\r
-extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)\r
-       __THROW _GL_ARG_NONNULL ((2, 3));\r
-\r
-#ifndef __need_getopt\r
-extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,\r
-                        const char *__shortopts,\r
-                        const struct option *__longopts, int *__longind)\r
-       __THROW _GL_ARG_NONNULL ((2, 3));\r
-extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,\r
-                             const char *__shortopts,\r
-                             const struct option *__longopts, int *__longind)\r
-       __THROW _GL_ARG_NONNULL ((2, 3));\r
-\r
-#endif\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-/* Make sure we later can get all the definitions and declarations.  */\r
-#undef __need_getopt\r
-\r
-#endif /* _GL_GETOPT_H */\r
-#endif /* _GL_GETOPT_H */\r
+/* Declarations for getopt.
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2012 Free Software
+   Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef _GL_GETOPT_H
+
+#if __GNUC__ >= 3
+#pragma GCC system_header
+#endif
+
+
+/* The include_next requires a split double-inclusion guard.  We must
+   also inform the replacement unistd.h to not recursively use
+   <getopt.h>; our definitions will be present soon enough.  */
+#if HAVE_GETOPT_H
+# define _GL_SYSTEM_GETOPT
+# ifndef __GNUC__
+# include <next_getopt.h>
+# else
+# include_next <getopt.h>
+# endif
+# undef _GL_SYSTEM_GETOPT
+#endif
+
+#ifndef _GL_GETOPT_H
+
+#ifndef __need_getopt
+# define _GL_GETOPT_H 1
+#endif
+
+/* Standalone applications should #define __GETOPT_PREFIX to an
+   identifier that prefixes the external functions and variables
+   defined in this header.  When this happens, include the
+   headers that might declare getopt so that they will not cause
+   confusion if included after this file (if the system had <getopt.h>,
+   we have already included it).  Then systematically rename
+   identifiers so that they do not collide with the system functions
+   and variables.  Renaming avoids problems with some compilers and
+   linkers.  */
+#if defined __GETOPT_PREFIX && !defined __need_getopt
+# if !HAVE_GETOPT_H
+#  include <stdlib.h>
+#  include <stdio.h>
+#  include <unistd.h>
+# endif
+# undef __need_getopt
+# undef getopt
+# undef getopt_long
+# undef getopt_long_only
+# undef optarg
+# undef opterr
+# undef optind
+# undef optopt
+# undef option
+# define __GETOPT_CONCAT(x, y) x ## y
+# define __GETOPT_XCONCAT(x, y) __GETOPT_CONCAT (x, y)
+# define __GETOPT_ID(y) __GETOPT_XCONCAT (__GETOPT_PREFIX, y)
+# define getopt __GETOPT_ID (getopt)
+# define getopt_long __GETOPT_ID (getopt_long)
+# define getopt_long_only __GETOPT_ID (getopt_long_only)
+# define optarg __GETOPT_ID (optarg)
+# define opterr __GETOPT_ID (opterr)
+# define optind __GETOPT_ID (optind)
+# define optopt __GETOPT_ID (optopt)
+# define option __GETOPT_ID (option)
+# define _getopt_internal __GETOPT_ID (getopt_internal)
+#endif
+
+/* Standalone applications get correct prototypes for getopt_long and
+   getopt_long_only; they declare "char **argv".  libc uses prototypes
+   with "char *const *argv" that are incorrect because getopt_long and
+   getopt_long_only can permute argv; this is required for backward
+   compatibility (e.g., for LSB 2.0.1).
+
+   This used to be '#if defined __GETOPT_PREFIX && !defined __need_getopt',
+   but it caused redefinition warnings if both unistd.h and getopt.h were
+   included, since unistd.h includes getopt.h having previously defined
+   __need_getopt.
+
+   The only place where __getopt_argv_const is used is in definitions
+   of getopt_long and getopt_long_only below, but these are visible
+   only if __need_getopt is not defined, so it is quite safe to rewrite
+   the conditional as follows:
+*/
+#if !defined __need_getopt
+# if defined __GETOPT_PREFIX
+#  define __getopt_argv_const /* empty */
+# else
+#  define __getopt_argv_const const
+# endif
+#endif
+
+/* If __GNU_LIBRARY__ is not already defined, either we are being used
+   standalone, or this is the first header included in the source file.
+   If we are being used with glibc, we need to include <features.h>, but
+   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
+   not defined, include <ctype.h>, which will pull in <features.h> for us
+   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
+   doesn't flood the namespace with stuff the way some other headers do.)  */
+#if !defined __GNU_LIBRARY__
+# include <ctype.h>
+#endif
+
+#ifndef __THROW
+# ifndef __GNUC_PREREQ
+#  define __GNUC_PREREQ(maj, min) (0)
+# endif
+# if defined __cplusplus && __GNUC_PREREQ (2,8)
+#  define __THROW       throw ()
+# else
+#  define __THROW
+# endif
+#endif
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+/* A C macro for declaring that specific arguments must not be NULL.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published
+   by the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
+   that the values passed as arguments n, ..., m must be non-NULL pointers.
+   n = 1 stands for the first argument, n = 2 for the second argument etc.  */
+#ifndef _GL_ARG_NONNULL
+# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
+#  define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
+# else
+#  define _GL_ARG_NONNULL(params)
+# endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For communication from 'getopt' to the caller.
+   When 'getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when 'ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to 'getopt'.
+
+   On entry to 'getopt', zero means this is the first call; initialize.
+
+   When 'getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, 'optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message 'getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+#ifndef __need_getopt
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of 'struct option' terminated by an element containing a name which is
+   zero.
+
+   The field 'has_arg' is:
+   no_argument          (or 0) if the option does not take an argument,
+   required_argument    (or 1) if the option requires an argument,
+   optional_argument    (or 2) if the option takes an optional argument.
+
+   If the field 'flag' is not NULL, it points to a variable that is set
+   to the value given in the field 'val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an 'int' to
+   a compiled-in constant, such as set a value from 'optarg', set the
+   option's 'flag' field to zero and its 'val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero 'flag' field, 'getopt'
+   returns the contents of the 'val' field.  */
+
+# if !GNULIB_defined_struct_option
+struct option
+{
+  const char *name;
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+#  define GNULIB_defined_struct_option 1
+# endif
+
+/* Names for the values of the 'has_arg' field of 'struct option'.  */
+
+# define no_argument            0
+# define required_argument      1
+# define optional_argument      2
+#endif  /* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+   arguments in ARGV (ARGC of them, minus the program name) for
+   options given in OPTS.
+
+   Return the option character from OPTS just read.  Return -1 when
+   there are no more options.  For unrecognized options, or options
+   missing arguments, 'optopt' is set to the option letter, and '?' is
+   returned.
+
+   The OPTS string is a list of characters which are recognized option
+   letters, optionally followed by colons, specifying that that letter
+   takes an argument, to be placed in 'optarg'.
+
+   If a letter in OPTS is followed by two colons, its argument is
+   optional.  This behavior is specific to the GNU 'getopt'.
+
+   The argument '--' causes premature termination of argument
+   scanning, explicitly telling 'getopt' that there are no more
+   options.
+
+   If OPTS begins with '-', then non-option arguments are treated as
+   arguments to the option '\1'.  This behavior is specific to the GNU
+   'getopt'.  If OPTS begins with '+', or POSIXLY_CORRECT is set in
+   the environment, then do not permute arguments.  */
+
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
+       __THROW _GL_ARG_NONNULL ((2, 3));
+
+#ifndef __need_getopt
+extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
+                        const char *__shortopts,
+                        const struct option *__longopts, int *__longind)
+       __THROW _GL_ARG_NONNULL ((2, 3));
+extern int getopt_long_only (int ___argc, char *__getopt_argv_const *___argv,
+                             const char *__shortopts,
+                             const struct option *__longopts, int *__longind)
+       __THROW _GL_ARG_NONNULL ((2, 3));
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
+#endif /* _GL_GETOPT_H */
+#endif /* _GL_GETOPT_H */
index 9f0c7131a142a229de2cc245a2286b8988218eef..2da020c995a12d2437d7aab417a126a56170381c 100644 (file)
@@ -1,5 +1,5 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2011 Free Software
+   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -40,7 +40,7 @@ extern int _getopt_internal (int ___argc, char **___argv,
    stop option processing when the first non-option is seen.
    This is what Unix does.
    This mode of operation is selected by either setting the environment
-   variable POSIXLY_CORRECT, or using `+' as the first character
+   variable POSIXLY_CORRECT, or using '+' as the first character
    of the list of option characters, or by calling getopt.
 
    PERMUTE is the default.  We permute the contents of ARGV as we
@@ -52,12 +52,12 @@ extern int _getopt_internal (int ___argc, char **___argv,
    written to expect options and other ARGV-elements in any order
    and that care about the ordering of the two.  We describe each
    non-option ARGV-element as if it were the argument of an option
-   with character code 1.  Using `-' as the first character of the
+   with character code 1.  Using '-' as the first character of the
    list of option characters selects this mode of operation.
 
-   The special argument `--' forces an end of option-scanning regardless
-   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
-   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+   The special argument '--' forces an end of option-scanning regardless
+   of the value of 'ordering'.  In the case of RETURN_IN_ORDER, only
+   '--' can cause 'getopt' to return -1 with 'optind' != ARGC.  */
 
 enum __ord
   {
@@ -99,8 +99,8 @@ struct _getopt_data
   /* Handle permutation of arguments.  */
 
   /* Describe the part of ARGV that contains non-options that have
-     been skipped.  `first_nonopt' is the index in ARGV of the first
-     of them; `last_nonopt' is the index after the last of them.  */
+     been skipped.  'first_nonopt' is the index in ARGV of the first
+     of them; 'last_nonopt' is the index after the last of them.  */
 
   int __first_nonopt;
   int __last_nonopt;
index 458e33221772ccc3fc08bd2a5cdcd0300699b0b0..65ca1e6762ee79e0aafcbb2373ab9f2d000496f4 100644 (file)
@@ -1,5 +1,5 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2011 Free Software
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBGETTEXT_H
 #define _LIBGETTEXT_H 1
@@ -184,9 +183,12 @@ npgettext_aux (const char *domain,
 
 #include <string.h>
 
-#define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS \
-  (((__GNUC__ >= 3 || __GNUG__ >= 2) && !__STRICT_ANSI__) \
-   /* || __STDC_VERSION__ >= 199901L */ )
+#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
+     /* || __STDC_VERSION__ >= 199901L */ )
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
+#else
+# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
+#endif
 
 #if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS
 #include <stdlib.h>
diff --git a/lib/gettime.c b/lib/gettime.c
new file mode 100644 (file)
index 0000000..8075bfa
--- /dev/null
@@ -0,0 +1,48 @@
+/* gettime -- get the system clock
+
+   Copyright (C) 2002, 2004-2007, 2009-2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#include <config.h>
+
+#include "timespec.h"
+
+#include <sys/time.h>
+
+/* Get the system time into *TS.  */
+
+void
+gettime (struct timespec *ts)
+{
+#if HAVE_NANOTIME
+  nanotime (ts);
+#else
+
+# if defined CLOCK_REALTIME && HAVE_CLOCK_GETTIME
+  if (clock_gettime (CLOCK_REALTIME, ts) == 0)
+    return;
+# endif
+
+  {
+    struct timeval tv;
+    gettimeofday (&tv, NULL);
+    ts->tv_sec = tv.tv_sec;
+    ts->tv_nsec = tv.tv_usec * 1000;
+  }
+
+#endif
+}
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
new file mode 100644 (file)
index 0000000..5d35060
--- /dev/null
@@ -0,0 +1,154 @@
+/* Provide gettimeofday for systems that don't have it or for which it's broken.
+
+   Copyright (C) 2001-2003, 2005-2007, 2009-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <sys/time.h>
+
+#include <time.h>
+
+#if HAVE_SYS_TIMEB_H
+# include <sys/timeb.h>
+#endif
+
+#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
+
+/* Work around the bug in some systems whereby gettimeofday clobbers
+   the static buffer that localtime uses for its return value.  The
+   gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
+   this problem.  The tzset replacement is necessary for at least
+   Solaris 2.5, 2.5.1, and 2.6.  */
+
+static struct tm tm_zero_buffer;
+static struct tm *localtime_buffer_addr = &tm_zero_buffer;
+
+# undef localtime
+extern struct tm *localtime (time_t const *);
+
+# undef gmtime
+extern struct tm *gmtime (time_t const *);
+
+/* This is a wrapper for localtime.  It is used only on systems for which
+   gettimeofday clobbers the static buffer used for localtime's result.
+
+   On the first call, record the address of the static buffer that
+   localtime uses for its result.  */
+
+struct tm *
+rpl_localtime (time_t const *timep)
+{
+  struct tm *tm = localtime (timep);
+
+  if (localtime_buffer_addr == &tm_zero_buffer)
+    localtime_buffer_addr = tm;
+
+  return tm;
+}
+
+/* Same as above, since gmtime and localtime use the same buffer.  */
+struct tm *
+rpl_gmtime (time_t const *timep)
+{
+  struct tm *tm = gmtime (timep);
+
+  if (localtime_buffer_addr == &tm_zero_buffer)
+    localtime_buffer_addr = tm;
+
+  return tm;
+}
+
+#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */
+
+#if TZSET_CLOBBERS_LOCALTIME
+
+# undef tzset
+extern void tzset (void);
+
+/* This is a wrapper for tzset, for systems on which tzset may clobber
+   the static buffer used for localtime's result.  */
+void
+rpl_tzset (void)
+{
+  /* Save and restore the contents of the buffer used for localtime's
+     result around the call to tzset.  */
+  struct tm save = *localtime_buffer_addr;
+  tzset ();
+  *localtime_buffer_addr = save;
+}
+#endif
+
+/* This is a wrapper for gettimeofday.  It is used only on systems
+   that lack this function, or whose implementation of this function
+   causes problems.  */
+
+int
+gettimeofday (struct timeval *restrict tv, void *restrict tz)
+{
+#undef gettimeofday
+#if HAVE_GETTIMEOFDAY
+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
+  /* Save and restore the contents of the buffer used for localtime's
+     result around the call to gettimeofday.  */
+  struct tm save = *localtime_buffer_addr;
+# endif
+
+# if defined timeval /* 'struct timeval' overridden by gnulib?  */
+#  undef timeval
+  struct timeval otv;
+  int result = gettimeofday (&otv, (struct timezone *) tz);
+  if (result == 0)
+    {
+      tv->tv_sec = otv.tv_sec;
+      tv->tv_usec = otv.tv_usec;
+    }
+# else
+  int result = gettimeofday (tv, (struct timezone *) tz);
+# endif
+
+# if GETTIMEOFDAY_CLOBBERS_LOCALTIME
+  *localtime_buffer_addr = save;
+# endif
+
+  return result;
+
+#else
+
+# if HAVE__FTIME
+
+  struct _timeb timebuf;
+  _ftime (&timebuf);
+  tv->tv_sec = timebuf.time;
+  tv->tv_usec = timebuf.millitm * 1000;
+
+# else
+
+#  if !defined OK_TO_USE_1S_CLOCK
+#   error "Only 1-second nominal clock resolution found.  Is that intended?" \
+          "If so, compile with the -DOK_TO_USE_1S_CLOCK option."
+#  endif
+  tv->tv_sec = time (NULL);
+  tv->tv_usec = 0;
+
+# endif
+
+  return 0;
+
+#endif
+}
index 154ae9882da4c476fbfb6961bb9ba1a80a2165eb..6e2bf89786c5349b6ee18b4880de1198a9257b1b 100644 (file)
@@ -1,6 +1,6 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
 ## Process this file with automake to produce Makefile.in.
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# 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=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dup2 filemode getloadavg getopt-gnu ignore-value intprops lstat mktime pthread_sigmask readlink socklen stdarg stdio strftime strtoimax strtoumax symlink sys_stat
+# 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-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -64,6 +64,18 @@ EXTRA_DIST += allocator.h
 
 ## end   gnulib module allocator
 
+## begin gnulib module c-ctype
+
+libgnu_a_SOURCES += c-ctype.h c-ctype.c
+
+## end   gnulib module c-ctype
+
+## begin gnulib module c-strcase
+
+libgnu_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c
+
+## end   gnulib module c-strcase
+
 ## begin gnulib module careadlinkat
 
 libgnu_a_SOURCES += careadlinkat.c
@@ -123,6 +135,12 @@ EXTRA_libgnu_a_SOURCES += ftoastr.c
 
 ## end   gnulib module dtoastr
 
+## begin gnulib module dtotimespec
+
+libgnu_a_SOURCES += dtotimespec.c
+
+## end   gnulib module dtotimespec
+
 ## begin gnulib module dup2
 
 
@@ -184,6 +202,21 @@ libgnu_a_SOURCES += gettext.h
 endif
 ## end   gnulib module gettext-h
 
+## begin gnulib module gettime
+
+libgnu_a_SOURCES += gettime.c
+
+## end   gnulib module gettime
+
+## begin gnulib module gettimeofday
+
+
+EXTRA_DIST += gettimeofday.c
+
+EXTRA_libgnu_a_SOURCES += gettimeofday.c
+
+## end   gnulib module gettimeofday
+
 ## begin gnulib module ignore-value
 
 
@@ -204,7 +237,7 @@ BUILT_SOURCES += inttypes.h
 
 # We need the following in order to create <inttypes.h> when the system
 # doesn't have one that works with the given compiler.
-inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_NONNULL_H)
+inttypes.h: inttypes.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H) $(ARG_NONNULL_H)
        $(AM_V_GEN)rm -f $@-t $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
          sed -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \
@@ -225,10 +258,12 @@ inttypes.h: inttypes.in.h $(top_builddir)/config.status $(WARN_ON_USE_H) $(ARG_N
              -e 's/@''HAVE_DECL_IMAXDIV''@/$(HAVE_DECL_IMAXDIV)/g' \
              -e 's/@''HAVE_DECL_STRTOIMAX''@/$(HAVE_DECL_STRTOIMAX)/g' \
              -e 's/@''HAVE_DECL_STRTOUMAX''@/$(HAVE_DECL_STRTOUMAX)/g' \
+             -e 's/@''REPLACE_STRTOIMAX''@/$(REPLACE_STRTOIMAX)/g' \
              -e 's/@''INT32_MAX_LT_INTMAX_MAX''@/$(INT32_MAX_LT_INTMAX_MAX)/g' \
              -e 's/@''INT64_MAX_EQ_LONG_MAX''@/$(INT64_MAX_EQ_LONG_MAX)/g' \
              -e 's/@''UINT32_MAX_LT_UINTMAX_MAX''@/$(UINT32_MAX_LT_UINTMAX_MAX)/g' \
              -e 's/@''UINT64_MAX_EQ_ULONG_MAX''@/$(UINT64_MAX_EQ_ULONG_MAX)/g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
              -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
              -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
              < $(srcdir)/inttypes.in.h; \
@@ -267,6 +302,15 @@ EXTRA_DIST += pathmax.h
 
 ## end   gnulib module pathmax
 
+## begin gnulib module pselect
+
+
+EXTRA_DIST += pselect.c
+
+EXTRA_libgnu_a_SOURCES += pselect.c
+
+## end   gnulib module pselect
+
 ## begin gnulib module pthread_sigmask
 
 
@@ -327,17 +371,6 @@ EXTRA_DIST += signal.in.h
 
 ## end   gnulib module signal-h
 
-## begin gnulib module sigprocmask
-
-if gl_GNULIB_ENABLED_sigprocmask
-
-endif
-EXTRA_DIST += sigprocmask.c
-
-EXTRA_libgnu_a_SOURCES += sigprocmask.c
-
-## end   gnulib module sigprocmask
-
 ## begin gnulib module snippet/_Noreturn
 
 # Because this Makefile snippet defines a variable used by other
@@ -430,6 +463,36 @@ EXTRA_libgnu_a_SOURCES += stat.c
 
 ## end   gnulib module stat
 
+## begin gnulib module stat-time
+
+
+EXTRA_DIST += stat-time.h
+
+## end   gnulib module stat-time
+
+## begin gnulib module stdalign
+
+BUILT_SOURCES += $(STDALIGN_H)
+
+# We need the following in order to create <stdalign.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_STDALIGN_H
+stdalign.h: stdalign.in.h $(top_builddir)/config.status
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/stdalign.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+else
+stdalign.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += stdalign.h stdalign.h-t
+
+EXTRA_DIST += stdalign.in.h
+
+## end   gnulib module stdalign
+
 ## begin gnulib module stdarg
 
 BUILT_SOURCES += $(STDARG_H)
@@ -599,7 +662,6 @@ stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H)
              -e 's/@''GNULIB_GETCHAR''@/$(GNULIB_GETCHAR)/g' \
              -e 's/@''GNULIB_GETDELIM''@/$(GNULIB_GETDELIM)/g' \
              -e 's/@''GNULIB_GETLINE''@/$(GNULIB_GETLINE)/g' \
-             -e 's/@''GNULIB_GETS''@/$(GNULIB_GETS)/g' \
              -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GNULIB_OBSTACK_PRINTF)/g' \
              -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GNULIB_OBSTACK_PRINTF_POSIX)/g' \
              -e 's/@''GNULIB_PCLOSE''@/$(GNULIB_PCLOSE)/g' \
@@ -719,8 +781,11 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's/@''GNULIB_MKOSTEMPS''@/$(GNULIB_MKOSTEMPS)/g' \
              -e 's/@''GNULIB_MKSTEMP''@/$(GNULIB_MKSTEMP)/g' \
              -e 's/@''GNULIB_MKSTEMPS''@/$(GNULIB_MKSTEMPS)/g' \
+             -e 's/@''GNULIB_POSIX_OPENPT''@/$(GNULIB_POSIX_OPENPT)/g' \
              -e 's/@''GNULIB_PTSNAME''@/$(GNULIB_PTSNAME)/g' \
+             -e 's/@''GNULIB_PTSNAME_R''@/$(GNULIB_PTSNAME_R)/g' \
              -e 's/@''GNULIB_PUTENV''@/$(GNULIB_PUTENV)/g' \
+             -e 's/@''GNULIB_RANDOM''@/$(GNULIB_RANDOM)/g' \
              -e 's/@''GNULIB_RANDOM_R''@/$(GNULIB_RANDOM_R)/g' \
              -e 's/@''GNULIB_REALLOC_POSIX''@/$(GNULIB_REALLOC_POSIX)/g' \
              -e 's/@''GNULIB_REALPATH''@/$(GNULIB_REALPATH)/g' \
@@ -745,7 +810,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
              -e 's|@''HAVE_MKSTEMP''@|$(HAVE_MKSTEMP)|g' \
              -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \
+             -e 's|@''HAVE_POSIX_OPENPT''@|$(HAVE_POSIX_OPENPT)|g' \
              -e 's|@''HAVE_PTSNAME''@|$(HAVE_PTSNAME)|g' \
+             -e 's|@''HAVE_PTSNAME_R''@|$(HAVE_PTSNAME_R)|g' \
+             -e 's|@''HAVE_RANDOM''@|$(HAVE_RANDOM)|g' \
              -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \
              -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \
              -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \
@@ -763,7 +831,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \
              -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
              -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
+             -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
+             -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
              -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
@@ -839,6 +909,40 @@ EXTRA_libgnu_a_SOURCES += symlink.c
 
 ## end   gnulib module symlink
 
+## begin gnulib module sys_select
+
+BUILT_SOURCES += sys/select.h
+
+# We need the following in order to create <sys/select.h> when the system
+# doesn't have one that works with the given compiler.
+sys/select.h: sys_select.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(WARN_ON_USE_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_SYS_SELECT_H''@|$(NEXT_SYS_SELECT_H)|g' \
+             -e 's|@''HAVE_SYS_SELECT_H''@|$(HAVE_SYS_SELECT_H)|g' \
+             -e 's/@''GNULIB_PSELECT''@/$(GNULIB_PSELECT)/g' \
+             -e 's/@''GNULIB_SELECT''@/$(GNULIB_SELECT)/g' \
+             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e 's|@''HAVE_PSELECT''@|$(HAVE_PSELECT)|g' \
+             -e 's|@''REPLACE_PSELECT''@|$(REPLACE_PSELECT)|g' \
+             -e 's|@''REPLACE_SELECT''@|$(REPLACE_SELECT)|g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/sys_select.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += sys/select.h sys/select.h-t
+MOSTLYCLEANDIRS += sys
+
+EXTRA_DIST += sys_select.in.h
+
+## end   gnulib module sys_select
+
 ## begin gnulib module sys_stat
 
 BUILT_SOURCES += sys/stat.h
@@ -854,6 +958,7 @@ sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNU
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \
+             -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \
              -e 's/@''GNULIB_FCHMODAT''@/$(GNULIB_FCHMODAT)/g' \
              -e 's/@''GNULIB_FSTAT''@/$(GNULIB_FSTAT)/g' \
              -e 's/@''GNULIB_FSTATAT''@/$(GNULIB_FSTATAT)/g' \
@@ -900,6 +1005,40 @@ EXTRA_DIST += sys_stat.in.h
 
 ## end   gnulib module sys_stat
 
+## begin gnulib module sys_time
+
+BUILT_SOURCES += sys/time.h
+
+# We need the following in order to create <sys/time.h> when the system
+# doesn't have one that works with the given compiler.
+sys/time.h: sys_time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H)
+       $(AM_V_at)$(MKDIR_P) sys
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         sed -e 's|@''GUARD_PREFIX''@|GL|g' \
+             -e 's/@''HAVE_SYS_TIME_H''@/$(HAVE_SYS_TIME_H)/g' \
+             -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \
+             -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
+             -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
+             -e 's|@''NEXT_SYS_TIME_H''@|$(NEXT_SYS_TIME_H)|g' \
+             -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
+             -e 's|@''HAVE_WINSOCK2_H''@|$(HAVE_WINSOCK2_H)|g' \
+             -e 's/@''HAVE_GETTIMEOFDAY''@/$(HAVE_GETTIMEOFDAY)/g' \
+             -e 's/@''HAVE_STRUCT_TIMEVAL''@/$(HAVE_STRUCT_TIMEVAL)/g' \
+             -e 's/@''REPLACE_GETTIMEOFDAY''@/$(REPLACE_GETTIMEOFDAY)/g' \
+             -e 's/@''REPLACE_STRUCT_TIMEVAL''@/$(REPLACE_STRUCT_TIMEVAL)/g' \
+             -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
+             -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \
+             -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \
+             < $(srcdir)/sys_time.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+MOSTLYCLEANFILES += sys/time.h sys/time.h-t
+
+EXTRA_DIST += sys_time.in.h
+
+## end   gnulib module sys_time
+
 ## begin gnulib module time
 
 BUILT_SOURCES += time.h
@@ -951,6 +1090,25 @@ EXTRA_libgnu_a_SOURCES += time_r.c
 
 ## end   gnulib module time_r
 
+## begin gnulib module timespec
+
+
+EXTRA_DIST += timespec.h
+
+## end   gnulib module timespec
+
+## begin gnulib module timespec-add
+
+libgnu_a_SOURCES += timespec-add.c
+
+## end   gnulib module timespec-add
+
+## begin gnulib module timespec-sub
+
+libgnu_a_SOURCES += timespec-sub.c
+
+## end   gnulib module timespec-sub
+
 ## begin gnulib module u64
 
 
@@ -973,6 +1131,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \
+             -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
              -e 's/@''GNULIB_CHDIR''@/$(GNULIB_CHDIR)/g' \
              -e 's/@''GNULIB_CHOWN''@/$(GNULIB_CHOWN)/g' \
              -e 's/@''GNULIB_CLOSE''@/$(GNULIB_CLOSE)/g' \
@@ -997,6 +1156,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_GETPAGESIZE''@/$(GNULIB_GETPAGESIZE)/g' \
              -e 's/@''GNULIB_GETUSERSHELL''@/$(GNULIB_GETUSERSHELL)/g' \
              -e 's/@''GNULIB_GROUP_MEMBER''@/$(GNULIB_GROUP_MEMBER)/g' \
+             -e 's/@''GNULIB_ISATTY''@/$(GNULIB_ISATTY)/g' \
              -e 's/@''GNULIB_LCHOWN''@/$(GNULIB_LCHOWN)/g' \
              -e 's/@''GNULIB_LINK''@/$(GNULIB_LINK)/g' \
              -e 's/@''GNULIB_LINKAT''@/$(GNULIB_LINKAT)/g' \
@@ -1009,11 +1169,12 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's/@''GNULIB_READLINK''@/$(GNULIB_READLINK)/g' \
              -e 's/@''GNULIB_READLINKAT''@/$(GNULIB_READLINKAT)/g' \
              -e 's/@''GNULIB_RMDIR''@/$(GNULIB_RMDIR)/g' \
+             -e 's/@''GNULIB_SETHOSTNAME''@/$(GNULIB_SETHOSTNAME)/g' \
              -e 's/@''GNULIB_SLEEP''@/$(GNULIB_SLEEP)/g' \
              -e 's/@''GNULIB_SYMLINK''@/$(GNULIB_SYMLINK)/g' \
              -e 's/@''GNULIB_SYMLINKAT''@/$(GNULIB_SYMLINKAT)/g' \
              -e 's/@''GNULIB_TTYNAME_R''@/$(GNULIB_TTYNAME_R)/g' \
-             -e 's/@''GNULIB_UNISTD_H_GETOPT''@/$(GNULIB_UNISTD_H_GETOPT)/g' \
+             -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GNULIB_GL_UNISTD_H_GETOPT)/g' \
              -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GNULIB_UNISTD_H_NONBLOCKING)/g' \
              -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GNULIB_UNISTD_H_SIGPIPE)/g' \
              -e 's/@''GNULIB_UNLINK''@/$(GNULIB_UNLINK)/g' \
@@ -1046,6 +1207,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \
              -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \
              -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \
+             -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \
              -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \
              -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \
              -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \
@@ -1058,6 +1220,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \
              -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \
              -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \
+             -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \
              -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \
              -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \
              -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \
@@ -1067,11 +1230,13 @@ unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
              -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
              -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
              -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
+             -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
              -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
              -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \
              -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \
              -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \
              -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \
+             -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \
              -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \
              -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \
              -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \
@@ -1101,6 +1266,14 @@ EXTRA_DIST += unistd.in.h
 
 ## end   gnulib module unistd
 
+## begin gnulib module utimens
+
+libgnu_a_SOURCES += utimens.c
+
+EXTRA_DIST += utimens.h
+
+## end   gnulib module utimens
+
 ## begin gnulib module verify
 
 if gl_GNULIB_ENABLED_verify
index f021a1ac8eaa6a4b3b1cac59e13325ad45425f5c..2e344350946e8a4cd5170f764a2621e8caa9de8f 100644 (file)
@@ -1,6 +1,6 @@
 /* ignore a function return without a compiler warning
 
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #ifndef _GL_IGNORE_VALUE_H
 # define _GL_IGNORE_VALUE_H
 
-# ifndef _GL_ATTRIBUTE_DEPRECATED
-/* The __attribute__((__deprecated__)) feature
-   is available in gcc versions 3.1 and newer.  */
-#  if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)
-#   define _GL_ATTRIBUTE_DEPRECATED /* empty */
-#  else
-#   define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
-#  endif
-# endif
-
 /* The __attribute__((__warn_unused_result__)) feature
    is available in gcc versions 3.4 and newer,
    while the typeof feature has been available since 2.7 at least.  */
@@ -54,9 +44,4 @@
 #  define ignore_value(x) (({ __typeof__ (x) __x = (x); (void) __x; }))
 # endif
 
-/* ignore_value works for scalars, pointers and aggregates;
-   deprecate ignore_ptr.  */
-static inline void _GL_ATTRIBUTE_DEPRECATED
-ignore_ptr (void *p) { (void) p; } /* deprecated: use ignore_value */
-
 #endif
index 1f6a539c1831a882ffdd27b2ed4f9d4736afeecd..2485c78d4ba9555f37914541ca9ff128d0bcbf59 100644 (file)
@@ -1,6 +1,6 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001-2005, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2001-2005, 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 7abf39403f01670f61346ca31f15f64d238c5000..b9da2b5b0917ca5c19b51fab816a032eddc0ae24 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2011 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2012 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Derek Price.
    This file is part of gnulib.
 
    The include_next requires a split double-inclusion guard.  */
 #if ! defined INTTYPES_H || defined _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 # if @HAVE_INTTYPES_H@
+
+   /* Some pre-C++11 <stdint.h> implementations need this.  */
+#  if defined __cplusplus && ! defined __STDC_FORMAT_MACROS
+#   define __STDC_FORMAT_MACROS 1
+#  endif
+
 #  @INCLUDE_NEXT@ @NEXT_INTTYPES_H@
 # endif
 #endif
 # error "This file assumes that 'int' has exactly 32 bits. Please report your platform and compiler to <bug-gnulib@gnu.org>."
 #endif
 
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
 /* The definition of _GL_ARG_NONNULL is copied here.  */
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
 /* 7.8.1 Macros for format specifiers */
 
-#if ! defined __cplusplus || defined __STDC_FORMAT_MACROS
-
-# if defined _TNS_R_TARGET
+#if defined _TNS_R_TARGET
    /* Tandem NonStop R series and compatible platforms released before
       July 2005 support %Ld but not %lld.  */
-#  define _LONG_LONG_FORMAT_PREFIX "L"
-# else
-#  define _LONG_LONG_FORMAT_PREFIX "ll"
-# endif
+# define _LONG_LONG_FORMAT_PREFIX "L"
+#else
+# define _LONG_LONG_FORMAT_PREFIX "ll"
+#endif
 
-# if !defined PRId8 || @PRI_MACROS_BROKEN@
-#  undef PRId8
-#  ifdef INT8_MAX
-#   define PRId8 "d"
-#  endif
+#if !defined PRId8 || @PRI_MACROS_BROKEN@
+# undef PRId8
+# ifdef INT8_MAX
+#  define PRId8 "d"
 # endif
-# if !defined PRIi8 || @PRI_MACROS_BROKEN@
-#  undef PRIi8
-#  ifdef INT8_MAX
-#   define PRIi8 "i"
-#  endif
+#endif
+#if !defined PRIi8 || @PRI_MACROS_BROKEN@
+# undef PRIi8
+# ifdef INT8_MAX
+#  define PRIi8 "i"
 # endif
-# if !defined PRIo8 || @PRI_MACROS_BROKEN@
-#  undef PRIo8
-#  ifdef UINT8_MAX
-#   define PRIo8 "o"
-#  endif
+#endif
+#if !defined PRIo8 || @PRI_MACROS_BROKEN@
+# undef PRIo8
+# ifdef UINT8_MAX
+#  define PRIo8 "o"
 # endif
-# if !defined PRIu8 || @PRI_MACROS_BROKEN@
-#  undef PRIu8
-#  ifdef UINT8_MAX
-#   define PRIu8 "u"
-#  endif
+#endif
+#if !defined PRIu8 || @PRI_MACROS_BROKEN@
+# undef PRIu8
+# ifdef UINT8_MAX
+#  define PRIu8 "u"
 # endif
-# if !defined PRIx8 || @PRI_MACROS_BROKEN@
-#  undef PRIx8
-#  ifdef UINT8_MAX
-#   define PRIx8 "x"
-#  endif
+#endif
+#if !defined PRIx8 || @PRI_MACROS_BROKEN@
+# undef PRIx8
+# ifdef UINT8_MAX
+#  define PRIx8 "x"
 # endif
-# if !defined PRIX8 || @PRI_MACROS_BROKEN@
-#  undef PRIX8
-#  ifdef UINT8_MAX
-#   define PRIX8 "X"
-#  endif
+#endif
+#if !defined PRIX8 || @PRI_MACROS_BROKEN@
+# undef PRIX8
+# ifdef UINT8_MAX
+#  define PRIX8 "X"
 # endif
-# if !defined PRId16 || @PRI_MACROS_BROKEN@
-#  undef PRId16
-#  ifdef INT16_MAX
-#   define PRId16 "d"
-#  endif
+#endif
+#if !defined PRId16 || @PRI_MACROS_BROKEN@
+# undef PRId16
+# ifdef INT16_MAX
+#  define PRId16 "d"
 # endif
-# if !defined PRIi16 || @PRI_MACROS_BROKEN@
-#  undef PRIi16
-#  ifdef INT16_MAX
-#   define PRIi16 "i"
-#  endif
+#endif
+#if !defined PRIi16 || @PRI_MACROS_BROKEN@
+# undef PRIi16
+# ifdef INT16_MAX
+#  define PRIi16 "i"
 # endif
-# if !defined PRIo16 || @PRI_MACROS_BROKEN@
-#  undef PRIo16
-#  ifdef UINT16_MAX
-#   define PRIo16 "o"
-#  endif
+#endif
+#if !defined PRIo16 || @PRI_MACROS_BROKEN@
+# undef PRIo16
+# ifdef UINT16_MAX
+#  define PRIo16 "o"
 # endif
-# if !defined PRIu16 || @PRI_MACROS_BROKEN@
-#  undef PRIu16
-#  ifdef UINT16_MAX
-#   define PRIu16 "u"
-#  endif
+#endif
+#if !defined PRIu16 || @PRI_MACROS_BROKEN@
+# undef PRIu16
+# ifdef UINT16_MAX
+#  define PRIu16 "u"
 # endif
-# if !defined PRIx16 || @PRI_MACROS_BROKEN@
-#  undef PRIx16
-#  ifdef UINT16_MAX
-#   define PRIx16 "x"
-#  endif
+#endif
+#if !defined PRIx16 || @PRI_MACROS_BROKEN@
+# undef PRIx16
+# ifdef UINT16_MAX
+#  define PRIx16 "x"
 # endif
-# if !defined PRIX16 || @PRI_MACROS_BROKEN@
-#  undef PRIX16
-#  ifdef UINT16_MAX
-#   define PRIX16 "X"
-#  endif
+#endif
+#if !defined PRIX16 || @PRI_MACROS_BROKEN@
+# undef PRIX16
+# ifdef UINT16_MAX
+#  define PRIX16 "X"
 # endif
-# if !defined PRId32 || @PRI_MACROS_BROKEN@
-#  undef PRId32
-#  ifdef INT32_MAX
-#   define PRId32 "d"
-#  endif
+#endif
+#if !defined PRId32 || @PRI_MACROS_BROKEN@
+# undef PRId32
+# ifdef INT32_MAX
+#  define PRId32 "d"
 # endif
-# if !defined PRIi32 || @PRI_MACROS_BROKEN@
-#  undef PRIi32
-#  ifdef INT32_MAX
-#   define PRIi32 "i"
-#  endif
+#endif
+#if !defined PRIi32 || @PRI_MACROS_BROKEN@
+# undef PRIi32
+# ifdef INT32_MAX
+#  define PRIi32 "i"
 # endif
-# if !defined PRIo32 || @PRI_MACROS_BROKEN@
-#  undef PRIo32
-#  ifdef UINT32_MAX
-#   define PRIo32 "o"
-#  endif
+#endif
+#if !defined PRIo32 || @PRI_MACROS_BROKEN@
+# undef PRIo32
+# ifdef UINT32_MAX
+#  define PRIo32 "o"
 # endif
-# if !defined PRIu32 || @PRI_MACROS_BROKEN@
-#  undef PRIu32
-#  ifdef UINT32_MAX
-#   define PRIu32 "u"
-#  endif
+#endif
+#if !defined PRIu32 || @PRI_MACROS_BROKEN@
+# undef PRIu32
+# ifdef UINT32_MAX
+#  define PRIu32 "u"
 # endif
-# if !defined PRIx32 || @PRI_MACROS_BROKEN@
-#  undef PRIx32
-#  ifdef UINT32_MAX
-#   define PRIx32 "x"
-#  endif
+#endif
+#if !defined PRIx32 || @PRI_MACROS_BROKEN@
+# undef PRIx32
+# ifdef UINT32_MAX
+#  define PRIx32 "x"
 # endif
-# if !defined PRIX32 || @PRI_MACROS_BROKEN@
-#  undef PRIX32
-#  ifdef UINT32_MAX
-#   define PRIX32 "X"
-#  endif
+#endif
+#if !defined PRIX32 || @PRI_MACROS_BROKEN@
+# undef PRIX32
+# ifdef UINT32_MAX
+#  define PRIX32 "X"
 # endif
-# ifdef INT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
-#   define _PRI64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _PRI64_PREFIX "I64"
-#  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined PRId64 || @PRI_MACROS_BROKEN@
-#   undef PRId64
-#   define PRId64 _PRI64_PREFIX "d"
-#  endif
-#  if !defined PRIi64 || @PRI_MACROS_BROKEN@
-#   undef PRIi64
-#   define PRIi64 _PRI64_PREFIX "i"
-#  endif
+#endif
+#ifdef INT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
+#  define _PRI64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _PRI64_PREFIX "I64"
+# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+#  define _PRI64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined PRId64 || @PRI_MACROS_BROKEN@
+#  undef PRId64
+#  define PRId64 _PRI64_PREFIX "d"
+# endif
+# if !defined PRIi64 || @PRI_MACROS_BROKEN@
+#  undef PRIi64
+#  define PRIi64 _PRI64_PREFIX "i"
 # endif
-# ifdef UINT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
-#   define _PRIu64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _PRIu64_PREFIX "I64"
-#  elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-#   define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined PRIo64 || @PRI_MACROS_BROKEN@
-#   undef PRIo64
-#   define PRIo64 _PRIu64_PREFIX "o"
-#  endif
-#  if !defined PRIu64 || @PRI_MACROS_BROKEN@
-#   undef PRIu64
-#   define PRIu64 _PRIu64_PREFIX "u"
-#  endif
-#  if !defined PRIx64 || @PRI_MACROS_BROKEN@
-#   undef PRIx64
-#   define PRIx64 _PRIu64_PREFIX "x"
-#  endif
-#  if !defined PRIX64 || @PRI_MACROS_BROKEN@
-#   undef PRIX64
-#   define PRIX64 _PRIu64_PREFIX "X"
-#  endif
+#endif
+#ifdef UINT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
+#  define _PRIu64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _PRIu64_PREFIX "I64"
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+#  define _PRIu64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined PRIo64 || @PRI_MACROS_BROKEN@
+#  undef PRIo64
+#  define PRIo64 _PRIu64_PREFIX "o"
+# endif
+# if !defined PRIu64 || @PRI_MACROS_BROKEN@
+#  undef PRIu64
+#  define PRIu64 _PRIu64_PREFIX "u"
+# endif
+# if !defined PRIx64 || @PRI_MACROS_BROKEN@
+#  undef PRIx64
+#  define PRIx64 _PRIu64_PREFIX "x"
+# endif
+# if !defined PRIX64 || @PRI_MACROS_BROKEN@
+#  undef PRIX64
+#  define PRIX64 _PRIu64_PREFIX "X"
 # endif
+#endif
 
-# if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIdLEAST8
-#  define PRIdLEAST8 "d"
-# endif
-# if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIiLEAST8
-#  define PRIiLEAST8 "i"
-# endif
-# if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIoLEAST8
-#  define PRIoLEAST8 "o"
-# endif
-# if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIuLEAST8
-#  define PRIuLEAST8 "u"
-# endif
-# if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIxLEAST8
-#  define PRIxLEAST8 "x"
-# endif
-# if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIXLEAST8
-#  define PRIXLEAST8 "X"
-# endif
-# if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIdLEAST16
-#  define PRIdLEAST16 "d"
-# endif
-# if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIiLEAST16
-#  define PRIiLEAST16 "i"
-# endif
-# if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIoLEAST16
-#  define PRIoLEAST16 "o"
-# endif
-# if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIuLEAST16
-#  define PRIuLEAST16 "u"
-# endif
-# if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIxLEAST16
-#  define PRIxLEAST16 "x"
-# endif
-# if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIXLEAST16
-#  define PRIXLEAST16 "X"
-# endif
-# if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIdLEAST32
-#  define PRIdLEAST32 "d"
-# endif
-# if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIiLEAST32
-#  define PRIiLEAST32 "i"
-# endif
-# if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIoLEAST32
-#  define PRIoLEAST32 "o"
-# endif
-# if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIuLEAST32
-#  define PRIuLEAST32 "u"
-# endif
-# if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIxLEAST32
-#  define PRIxLEAST32 "x"
-# endif
-# if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIXLEAST32
-#  define PRIXLEAST32 "X"
-# endif
-# ifdef INT64_MAX
-#  if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIdLEAST64
-#   define PRIdLEAST64 PRId64
-#  endif
-#  if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIiLEAST64
-#   define PRIiLEAST64 PRIi64
-#  endif
+#if !defined PRIdLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIdLEAST8
+# define PRIdLEAST8 "d"
+#endif
+#if !defined PRIiLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIiLEAST8
+# define PRIiLEAST8 "i"
+#endif
+#if !defined PRIoLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIoLEAST8
+# define PRIoLEAST8 "o"
+#endif
+#if !defined PRIuLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIuLEAST8
+# define PRIuLEAST8 "u"
+#endif
+#if !defined PRIxLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIxLEAST8
+# define PRIxLEAST8 "x"
+#endif
+#if !defined PRIXLEAST8 || @PRI_MACROS_BROKEN@
+# undef PRIXLEAST8
+# define PRIXLEAST8 "X"
+#endif
+#if !defined PRIdLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIdLEAST16
+# define PRIdLEAST16 "d"
+#endif
+#if !defined PRIiLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIiLEAST16
+# define PRIiLEAST16 "i"
+#endif
+#if !defined PRIoLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIoLEAST16
+# define PRIoLEAST16 "o"
+#endif
+#if !defined PRIuLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIuLEAST16
+# define PRIuLEAST16 "u"
+#endif
+#if !defined PRIxLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIxLEAST16
+# define PRIxLEAST16 "x"
+#endif
+#if !defined PRIXLEAST16 || @PRI_MACROS_BROKEN@
+# undef PRIXLEAST16
+# define PRIXLEAST16 "X"
+#endif
+#if !defined PRIdLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIdLEAST32
+# define PRIdLEAST32 "d"
+#endif
+#if !defined PRIiLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIiLEAST32
+# define PRIiLEAST32 "i"
+#endif
+#if !defined PRIoLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIoLEAST32
+# define PRIoLEAST32 "o"
+#endif
+#if !defined PRIuLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIuLEAST32
+# define PRIuLEAST32 "u"
+#endif
+#if !defined PRIxLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIxLEAST32
+# define PRIxLEAST32 "x"
+#endif
+#if !defined PRIXLEAST32 || @PRI_MACROS_BROKEN@
+# undef PRIXLEAST32
+# define PRIXLEAST32 "X"
+#endif
+#ifdef INT64_MAX
+# if !defined PRIdLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIdLEAST64
+#  define PRIdLEAST64 PRId64
 # endif
-# ifdef UINT64_MAX
-#  if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIoLEAST64
-#   define PRIoLEAST64 PRIo64
-#  endif
-#  if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIuLEAST64
-#   define PRIuLEAST64 PRIu64
-#  endif
-#  if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIxLEAST64
-#   define PRIxLEAST64 PRIx64
-#  endif
-#  if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIXLEAST64
-#   define PRIXLEAST64 PRIX64
-#  endif
+# if !defined PRIiLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIiLEAST64
+#  define PRIiLEAST64 PRIi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined PRIoLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIoLEAST64
+#  define PRIoLEAST64 PRIo64
+# endif
+# if !defined PRIuLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIuLEAST64
+#  define PRIuLEAST64 PRIu64
+# endif
+# if !defined PRIxLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIxLEAST64
+#  define PRIxLEAST64 PRIx64
 # endif
+# if !defined PRIXLEAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIXLEAST64
+#  define PRIXLEAST64 PRIX64
+# endif
+#endif
 
-# if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIdFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define PRIdFAST8 PRId64
-#  else
-#   define PRIdFAST8 "d"
-#  endif
+#if !defined PRIdFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIdFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define PRIdFAST8 PRId64
+# else
+#  define PRIdFAST8 "d"
 # endif
-# if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIiFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define PRIiFAST8 PRIi64
-#  else
-#   define PRIiFAST8 "i"
-#  endif
+#endif
+#if !defined PRIiFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIiFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define PRIiFAST8 PRIi64
+# else
+#  define PRIiFAST8 "i"
 # endif
-# if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIoFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIoFAST8 PRIo64
-#  else
-#   define PRIoFAST8 "o"
-#  endif
+#endif
+#if !defined PRIoFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIoFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIoFAST8 PRIo64
+# else
+#  define PRIoFAST8 "o"
 # endif
-# if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIuFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIuFAST8 PRIu64
-#  else
-#   define PRIuFAST8 "u"
-#  endif
+#endif
+#if !defined PRIuFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIuFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIuFAST8 PRIu64
+# else
+#  define PRIuFAST8 "u"
 # endif
-# if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIxFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIxFAST8 PRIx64
-#  else
-#   define PRIxFAST8 "x"
-#  endif
+#endif
+#if !defined PRIxFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIxFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIxFAST8 PRIx64
+# else
+#  define PRIxFAST8 "x"
 # endif
-# if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@
-#  undef PRIXFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define PRIXFAST8 PRIX64
-#  else
-#   define PRIXFAST8 "X"
-#  endif
+#endif
+#if !defined PRIXFAST8 || @PRI_MACROS_BROKEN@
+# undef PRIXFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define PRIXFAST8 PRIX64
+# else
+#  define PRIXFAST8 "X"
 # endif
-# if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIdFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define PRIdFAST16 PRId64
-#  else
-#   define PRIdFAST16 "d"
-#  endif
+#endif
+#if !defined PRIdFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIdFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define PRIdFAST16 PRId64
+# else
+#  define PRIdFAST16 "d"
 # endif
-# if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIiFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define PRIiFAST16 PRIi64
-#  else
-#   define PRIiFAST16 "i"
-#  endif
+#endif
+#if !defined PRIiFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIiFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define PRIiFAST16 PRIi64
+# else
+#  define PRIiFAST16 "i"
 # endif
-# if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIoFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIoFAST16 PRIo64
-#  else
-#   define PRIoFAST16 "o"
-#  endif
+#endif
+#if !defined PRIoFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIoFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIoFAST16 PRIo64
+# else
+#  define PRIoFAST16 "o"
 # endif
-# if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIuFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIuFAST16 PRIu64
-#  else
-#   define PRIuFAST16 "u"
-#  endif
+#endif
+#if !defined PRIuFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIuFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIuFAST16 PRIu64
+# else
+#  define PRIuFAST16 "u"
 # endif
-# if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIxFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIxFAST16 PRIx64
-#  else
-#   define PRIxFAST16 "x"
-#  endif
+#endif
+#if !defined PRIxFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIxFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIxFAST16 PRIx64
+# else
+#  define PRIxFAST16 "x"
 # endif
-# if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@
-#  undef PRIXFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define PRIXFAST16 PRIX64
-#  else
-#   define PRIXFAST16 "X"
-#  endif
+#endif
+#if !defined PRIXFAST16 || @PRI_MACROS_BROKEN@
+# undef PRIXFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define PRIXFAST16 PRIX64
+# else
+#  define PRIXFAST16 "X"
 # endif
-# if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIdFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define PRIdFAST32 PRId64
-#  else
-#   define PRIdFAST32 "d"
-#  endif
+#endif
+#if !defined PRIdFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIdFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define PRIdFAST32 PRId64
+# else
+#  define PRIdFAST32 "d"
 # endif
-# if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIiFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define PRIiFAST32 PRIi64
-#  else
-#   define PRIiFAST32 "i"
-#  endif
+#endif
+#if !defined PRIiFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIiFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define PRIiFAST32 PRIi64
+# else
+#  define PRIiFAST32 "i"
 # endif
-# if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIoFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIoFAST32 PRIo64
-#  else
-#   define PRIoFAST32 "o"
-#  endif
+#endif
+#if !defined PRIoFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIoFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIoFAST32 PRIo64
+# else
+#  define PRIoFAST32 "o"
 # endif
-# if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIuFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIuFAST32 PRIu64
-#  else
-#   define PRIuFAST32 "u"
-#  endif
+#endif
+#if !defined PRIuFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIuFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIuFAST32 PRIu64
+# else
+#  define PRIuFAST32 "u"
 # endif
-# if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIxFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIxFAST32 PRIx64
-#  else
-#   define PRIxFAST32 "x"
-#  endif
+#endif
+#if !defined PRIxFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIxFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIxFAST32 PRIx64
+# else
+#  define PRIxFAST32 "x"
 # endif
-# if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@
-#  undef PRIXFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define PRIXFAST32 PRIX64
-#  else
-#   define PRIXFAST32 "X"
-#  endif
+#endif
+#if !defined PRIXFAST32 || @PRI_MACROS_BROKEN@
+# undef PRIXFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define PRIXFAST32 PRIX64
+# else
+#  define PRIXFAST32 "X"
 # endif
-# ifdef INT64_MAX
-#  if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIdFAST64
-#   define PRIdFAST64 PRId64
-#  endif
-#  if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIiFAST64
-#   define PRIiFAST64 PRIi64
-#  endif
+#endif
+#ifdef INT64_MAX
+# if !defined PRIdFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIdFAST64
+#  define PRIdFAST64 PRId64
 # endif
-# ifdef UINT64_MAX
-#  if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIoFAST64
-#   define PRIoFAST64 PRIo64
-#  endif
-#  if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIuFAST64
-#   define PRIuFAST64 PRIu64
-#  endif
-#  if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIxFAST64
-#   define PRIxFAST64 PRIx64
-#  endif
-#  if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@
-#   undef PRIXFAST64
-#   define PRIXFAST64 PRIX64
-#  endif
+# if !defined PRIiFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIiFAST64
+#  define PRIiFAST64 PRIi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined PRIoFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIoFAST64
+#  define PRIoFAST64 PRIo64
+# endif
+# if !defined PRIuFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIuFAST64
+#  define PRIuFAST64 PRIu64
+# endif
+# if !defined PRIxFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIxFAST64
+#  define PRIxFAST64 PRIx64
 # endif
+# if !defined PRIXFAST64 || @PRI_MACROS_BROKEN@
+#  undef PRIXFAST64
+#  define PRIXFAST64 PRIX64
+# endif
+#endif
 
-# if !defined PRIdMAX || @PRI_MACROS_BROKEN@
-#  undef PRIdMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define PRIdMAX PRId64
-#  else
-#   define PRIdMAX "ld"
-#  endif
+#if !defined PRIdMAX || @PRI_MACROS_BROKEN@
+# undef PRIdMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define PRIdMAX PRId64
+# else
+#  define PRIdMAX "ld"
 # endif
-# if !defined PRIiMAX || @PRI_MACROS_BROKEN@
-#  undef PRIiMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define PRIiMAX PRIi64
-#  else
-#   define PRIiMAX "li"
-#  endif
+#endif
+#if !defined PRIiMAX || @PRI_MACROS_BROKEN@
+# undef PRIiMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define PRIiMAX PRIi64
+# else
+#  define PRIiMAX "li"
 # endif
-# if !defined PRIoMAX || @PRI_MACROS_BROKEN@
-#  undef PRIoMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIoMAX PRIo64
-#  else
-#   define PRIoMAX "lo"
-#  endif
+#endif
+#if !defined PRIoMAX || @PRI_MACROS_BROKEN@
+# undef PRIoMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIoMAX PRIo64
+# else
+#  define PRIoMAX "lo"
 # endif
-# if !defined PRIuMAX || @PRI_MACROS_BROKEN@
-#  undef PRIuMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIuMAX PRIu64
-#  else
-#   define PRIuMAX "lu"
-#  endif
+#endif
+#if !defined PRIuMAX || @PRI_MACROS_BROKEN@
+# undef PRIuMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIuMAX PRIu64
+# else
+#  define PRIuMAX "lu"
 # endif
-# if !defined PRIxMAX || @PRI_MACROS_BROKEN@
-#  undef PRIxMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIxMAX PRIx64
-#  else
-#   define PRIxMAX "lx"
-#  endif
+#endif
+#if !defined PRIxMAX || @PRI_MACROS_BROKEN@
+# undef PRIxMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIxMAX PRIx64
+# else
+#  define PRIxMAX "lx"
 # endif
-# if !defined PRIXMAX || @PRI_MACROS_BROKEN@
-#  undef PRIXMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define PRIXMAX PRIX64
-#  else
-#   define PRIXMAX "lX"
-#  endif
+#endif
+#if !defined PRIXMAX || @PRI_MACROS_BROKEN@
+# undef PRIXMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define PRIXMAX PRIX64
+# else
+#  define PRIXMAX "lX"
 # endif
+#endif
 
-# if !defined PRIdPTR || @PRI_MACROS_BROKEN@
-#  undef PRIdPTR
-#  ifdef INTPTR_MAX
-#   define PRIdPTR @PRIPTR_PREFIX@ "d"
-#  endif
+#if !defined PRIdPTR || @PRI_MACROS_BROKEN@
+# undef PRIdPTR
+# ifdef INTPTR_MAX
+#  define PRIdPTR @PRIPTR_PREFIX@ "d"
 # endif
-# if !defined PRIiPTR || @PRI_MACROS_BROKEN@
-#  undef PRIiPTR
-#  ifdef INTPTR_MAX
-#   define PRIiPTR @PRIPTR_PREFIX@ "i"
-#  endif
+#endif
+#if !defined PRIiPTR || @PRI_MACROS_BROKEN@
+# undef PRIiPTR
+# ifdef INTPTR_MAX
+#  define PRIiPTR @PRIPTR_PREFIX@ "i"
 # endif
-# if !defined PRIoPTR || @PRI_MACROS_BROKEN@
-#  undef PRIoPTR
-#  ifdef UINTPTR_MAX
-#   define PRIoPTR @PRIPTR_PREFIX@ "o"
-#  endif
+#endif
+#if !defined PRIoPTR || @PRI_MACROS_BROKEN@
+# undef PRIoPTR
+# ifdef UINTPTR_MAX
+#  define PRIoPTR @PRIPTR_PREFIX@ "o"
 # endif
-# if !defined PRIuPTR || @PRI_MACROS_BROKEN@
-#  undef PRIuPTR
-#  ifdef UINTPTR_MAX
-#   define PRIuPTR @PRIPTR_PREFIX@ "u"
-#  endif
+#endif
+#if !defined PRIuPTR || @PRI_MACROS_BROKEN@
+# undef PRIuPTR
+# ifdef UINTPTR_MAX
+#  define PRIuPTR @PRIPTR_PREFIX@ "u"
 # endif
-# if !defined PRIxPTR || @PRI_MACROS_BROKEN@
-#  undef PRIxPTR
-#  ifdef UINTPTR_MAX
-#   define PRIxPTR @PRIPTR_PREFIX@ "x"
-#  endif
+#endif
+#if !defined PRIxPTR || @PRI_MACROS_BROKEN@
+# undef PRIxPTR
+# ifdef UINTPTR_MAX
+#  define PRIxPTR @PRIPTR_PREFIX@ "x"
 # endif
-# if !defined PRIXPTR || @PRI_MACROS_BROKEN@
-#  undef PRIXPTR
-#  ifdef UINTPTR_MAX
-#   define PRIXPTR @PRIPTR_PREFIX@ "X"
-#  endif
+#endif
+#if !defined PRIXPTR || @PRI_MACROS_BROKEN@
+# undef PRIXPTR
+# ifdef UINTPTR_MAX
+#  define PRIXPTR @PRIPTR_PREFIX@ "X"
 # endif
+#endif
 
-# if !defined SCNd8 || @PRI_MACROS_BROKEN@
-#  undef SCNd8
-#  ifdef INT8_MAX
-#   define SCNd8 "hhd"
-#  endif
+#if !defined SCNd8 || @PRI_MACROS_BROKEN@
+# undef SCNd8
+# ifdef INT8_MAX
+#  define SCNd8 "hhd"
 # endif
-# if !defined SCNi8 || @PRI_MACROS_BROKEN@
-#  undef SCNi8
-#  ifdef INT8_MAX
-#   define SCNi8 "hhi"
-#  endif
+#endif
+#if !defined SCNi8 || @PRI_MACROS_BROKEN@
+# undef SCNi8
+# ifdef INT8_MAX
+#  define SCNi8 "hhi"
 # endif
-# if !defined SCNo8 || @PRI_MACROS_BROKEN@
-#  undef SCNo8
-#  ifdef UINT8_MAX
-#   define SCNo8 "hho"
-#  endif
+#endif
+#if !defined SCNo8 || @PRI_MACROS_BROKEN@
+# undef SCNo8
+# ifdef UINT8_MAX
+#  define SCNo8 "hho"
 # endif
-# if !defined SCNu8 || @PRI_MACROS_BROKEN@
-#  undef SCNu8
-#  ifdef UINT8_MAX
-#   define SCNu8 "hhu"
-#  endif
+#endif
+#if !defined SCNu8 || @PRI_MACROS_BROKEN@
+# undef SCNu8
+# ifdef UINT8_MAX
+#  define SCNu8 "hhu"
 # endif
-# if !defined SCNx8 || @PRI_MACROS_BROKEN@
-#  undef SCNx8
-#  ifdef UINT8_MAX
-#   define SCNx8 "hhx"
-#  endif
+#endif
+#if !defined SCNx8 || @PRI_MACROS_BROKEN@
+# undef SCNx8
+# ifdef UINT8_MAX
+#  define SCNx8 "hhx"
 # endif
-# if !defined SCNd16 || @PRI_MACROS_BROKEN@
-#  undef SCNd16
-#  ifdef INT16_MAX
-#   define SCNd16 "hd"
-#  endif
+#endif
+#if !defined SCNd16 || @PRI_MACROS_BROKEN@
+# undef SCNd16
+# ifdef INT16_MAX
+#  define SCNd16 "hd"
 # endif
-# if !defined SCNi16 || @PRI_MACROS_BROKEN@
-#  undef SCNi16
-#  ifdef INT16_MAX
-#   define SCNi16 "hi"
-#  endif
+#endif
+#if !defined SCNi16 || @PRI_MACROS_BROKEN@
+# undef SCNi16
+# ifdef INT16_MAX
+#  define SCNi16 "hi"
 # endif
-# if !defined SCNo16 || @PRI_MACROS_BROKEN@
-#  undef SCNo16
-#  ifdef UINT16_MAX
-#   define SCNo16 "ho"
-#  endif
+#endif
+#if !defined SCNo16 || @PRI_MACROS_BROKEN@
+# undef SCNo16
+# ifdef UINT16_MAX
+#  define SCNo16 "ho"
 # endif
-# if !defined SCNu16 || @PRI_MACROS_BROKEN@
-#  undef SCNu16
-#  ifdef UINT16_MAX
-#   define SCNu16 "hu"
-#  endif
+#endif
+#if !defined SCNu16 || @PRI_MACROS_BROKEN@
+# undef SCNu16
+# ifdef UINT16_MAX
+#  define SCNu16 "hu"
 # endif
-# if !defined SCNx16 || @PRI_MACROS_BROKEN@
-#  undef SCNx16
-#  ifdef UINT16_MAX
-#   define SCNx16 "hx"
-#  endif
+#endif
+#if !defined SCNx16 || @PRI_MACROS_BROKEN@
+# undef SCNx16
+# ifdef UINT16_MAX
+#  define SCNx16 "hx"
 # endif
-# if !defined SCNd32 || @PRI_MACROS_BROKEN@
-#  undef SCNd32
-#  ifdef INT32_MAX
-#   define SCNd32 "d"
-#  endif
+#endif
+#if !defined SCNd32 || @PRI_MACROS_BROKEN@
+# undef SCNd32
+# ifdef INT32_MAX
+#  define SCNd32 "d"
 # endif
-# if !defined SCNi32 || @PRI_MACROS_BROKEN@
-#  undef SCNi32
-#  ifdef INT32_MAX
-#   define SCNi32 "i"
-#  endif
+#endif
+#if !defined SCNi32 || @PRI_MACROS_BROKEN@
+# undef SCNi32
+# ifdef INT32_MAX
+#  define SCNi32 "i"
 # endif
-# if !defined SCNo32 || @PRI_MACROS_BROKEN@
-#  undef SCNo32
-#  ifdef UINT32_MAX
-#   define SCNo32 "o"
-#  endif
+#endif
+#if !defined SCNo32 || @PRI_MACROS_BROKEN@
+# undef SCNo32
+# ifdef UINT32_MAX
+#  define SCNo32 "o"
 # endif
-# if !defined SCNu32 || @PRI_MACROS_BROKEN@
-#  undef SCNu32
-#  ifdef UINT32_MAX
-#   define SCNu32 "u"
-#  endif
+#endif
+#if !defined SCNu32 || @PRI_MACROS_BROKEN@
+# undef SCNu32
+# ifdef UINT32_MAX
+#  define SCNu32 "u"
 # endif
-# if !defined SCNx32 || @PRI_MACROS_BROKEN@
-#  undef SCNx32
-#  ifdef UINT32_MAX
-#   define SCNx32 "x"
-#  endif
+#endif
+#if !defined SCNx32 || @PRI_MACROS_BROKEN@
+# undef SCNx32
+# ifdef UINT32_MAX
+#  define SCNx32 "x"
 # endif
-# ifdef INT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
-#   define _SCN64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _SCN64_PREFIX "I64"
-#  elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
-#   define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined SCNd64 || @PRI_MACROS_BROKEN@
-#   undef SCNd64
-#   define SCNd64 _SCN64_PREFIX "d"
-#  endif
-#  if !defined SCNi64 || @PRI_MACROS_BROKEN@
-#   undef SCNi64
-#   define SCNi64 _SCN64_PREFIX "i"
-#  endif
+#endif
+#ifdef INT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @INT64_MAX_EQ_LONG_MAX@)
+#  define _SCN64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _SCN64_PREFIX "I64"
+# elif @HAVE_LONG_LONG_INT@ && LONG_MAX >> 30 == 1
+#  define _SCN64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined SCNd64 || @PRI_MACROS_BROKEN@
+#  undef SCNd64
+#  define SCNd64 _SCN64_PREFIX "d"
+# endif
+# if !defined SCNi64 || @PRI_MACROS_BROKEN@
+#  undef SCNi64
+#  define SCNi64 _SCN64_PREFIX "i"
 # endif
-# ifdef UINT64_MAX
-#  if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
-#   define _SCNu64_PREFIX "l"
-#  elif defined _MSC_VER || defined __MINGW32__
-#   define _SCNu64_PREFIX "I64"
-#  elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
-#   define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
-#  endif
-#  if !defined SCNo64 || @PRI_MACROS_BROKEN@
-#   undef SCNo64
-#   define SCNo64 _SCNu64_PREFIX "o"
-#  endif
-#  if !defined SCNu64 || @PRI_MACROS_BROKEN@
-#   undef SCNu64
-#   define SCNu64 _SCNu64_PREFIX "u"
-#  endif
-#  if !defined SCNx64 || @PRI_MACROS_BROKEN@
-#   undef SCNx64
-#   define SCNx64 _SCNu64_PREFIX "x"
-#  endif
+#endif
+#ifdef UINT64_MAX
+# if (@APPLE_UNIVERSAL_BUILD@ ? defined _LP64 : @UINT64_MAX_EQ_ULONG_MAX@)
+#  define _SCNu64_PREFIX "l"
+# elif defined _MSC_VER || defined __MINGW32__
+#  define _SCNu64_PREFIX "I64"
+# elif @HAVE_UNSIGNED_LONG_LONG_INT@ && ULONG_MAX >> 31 == 1
+#  define _SCNu64_PREFIX _LONG_LONG_FORMAT_PREFIX
+# endif
+# if !defined SCNo64 || @PRI_MACROS_BROKEN@
+#  undef SCNo64
+#  define SCNo64 _SCNu64_PREFIX "o"
+# endif
+# if !defined SCNu64 || @PRI_MACROS_BROKEN@
+#  undef SCNu64
+#  define SCNu64 _SCNu64_PREFIX "u"
+# endif
+# if !defined SCNx64 || @PRI_MACROS_BROKEN@
+#  undef SCNx64
+#  define SCNx64 _SCNu64_PREFIX "x"
 # endif
+#endif
 
-# if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNdLEAST8
-#  define SCNdLEAST8 "hhd"
-# endif
-# if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNiLEAST8
-#  define SCNiLEAST8 "hhi"
-# endif
-# if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNoLEAST8
-#  define SCNoLEAST8 "hho"
-# endif
-# if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNuLEAST8
-#  define SCNuLEAST8 "hhu"
-# endif
-# if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNxLEAST8
-#  define SCNxLEAST8 "hhx"
-# endif
-# if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNdLEAST16
-#  define SCNdLEAST16 "hd"
-# endif
-# if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNiLEAST16
-#  define SCNiLEAST16 "hi"
-# endif
-# if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNoLEAST16
-#  define SCNoLEAST16 "ho"
-# endif
-# if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNuLEAST16
-#  define SCNuLEAST16 "hu"
-# endif
-# if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNxLEAST16
-#  define SCNxLEAST16 "hx"
-# endif
-# if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNdLEAST32
-#  define SCNdLEAST32 "d"
-# endif
-# if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNiLEAST32
-#  define SCNiLEAST32 "i"
-# endif
-# if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNoLEAST32
-#  define SCNoLEAST32 "o"
-# endif
-# if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNuLEAST32
-#  define SCNuLEAST32 "u"
-# endif
-# if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNxLEAST32
-#  define SCNxLEAST32 "x"
-# endif
-# ifdef INT64_MAX
-#  if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNdLEAST64
-#   define SCNdLEAST64 SCNd64
-#  endif
-#  if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNiLEAST64
-#   define SCNiLEAST64 SCNi64
-#  endif
+#if !defined SCNdLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNdLEAST8
+# define SCNdLEAST8 "hhd"
+#endif
+#if !defined SCNiLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNiLEAST8
+# define SCNiLEAST8 "hhi"
+#endif
+#if !defined SCNoLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNoLEAST8
+# define SCNoLEAST8 "hho"
+#endif
+#if !defined SCNuLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNuLEAST8
+# define SCNuLEAST8 "hhu"
+#endif
+#if !defined SCNxLEAST8 || @PRI_MACROS_BROKEN@
+# undef SCNxLEAST8
+# define SCNxLEAST8 "hhx"
+#endif
+#if !defined SCNdLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNdLEAST16
+# define SCNdLEAST16 "hd"
+#endif
+#if !defined SCNiLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNiLEAST16
+# define SCNiLEAST16 "hi"
+#endif
+#if !defined SCNoLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNoLEAST16
+# define SCNoLEAST16 "ho"
+#endif
+#if !defined SCNuLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNuLEAST16
+# define SCNuLEAST16 "hu"
+#endif
+#if !defined SCNxLEAST16 || @PRI_MACROS_BROKEN@
+# undef SCNxLEAST16
+# define SCNxLEAST16 "hx"
+#endif
+#if !defined SCNdLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNdLEAST32
+# define SCNdLEAST32 "d"
+#endif
+#if !defined SCNiLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNiLEAST32
+# define SCNiLEAST32 "i"
+#endif
+#if !defined SCNoLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNoLEAST32
+# define SCNoLEAST32 "o"
+#endif
+#if !defined SCNuLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNuLEAST32
+# define SCNuLEAST32 "u"
+#endif
+#if !defined SCNxLEAST32 || @PRI_MACROS_BROKEN@
+# undef SCNxLEAST32
+# define SCNxLEAST32 "x"
+#endif
+#ifdef INT64_MAX
+# if !defined SCNdLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNdLEAST64
+#  define SCNdLEAST64 SCNd64
 # endif
-# ifdef UINT64_MAX
-#  if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNoLEAST64
-#   define SCNoLEAST64 SCNo64
-#  endif
-#  if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNuLEAST64
-#   define SCNuLEAST64 SCNu64
-#  endif
-#  if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNxLEAST64
-#   define SCNxLEAST64 SCNx64
-#  endif
+# if !defined SCNiLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNiLEAST64
+#  define SCNiLEAST64 SCNi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined SCNoLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNoLEAST64
+#  define SCNoLEAST64 SCNo64
+# endif
+# if !defined SCNuLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNuLEAST64
+#  define SCNuLEAST64 SCNu64
+# endif
+# if !defined SCNxLEAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNxLEAST64
+#  define SCNxLEAST64 SCNx64
 # endif
+#endif
 
-# if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNdFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define SCNdFAST8 SCNd64
-#  elif INT_FAST8_MAX == 0x7fff
-#   define SCNdFAST8 "hd"
-#  elif INT_FAST8_MAX == 0x7f
-#   define SCNdFAST8 "hhd"
-#  else
-#   define SCNdFAST8 "d"
-#  endif
+#if !defined SCNdFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNdFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define SCNdFAST8 SCNd64
+# elif INT_FAST8_MAX == 0x7fff
+#  define SCNdFAST8 "hd"
+# elif INT_FAST8_MAX == 0x7f
+#  define SCNdFAST8 "hhd"
+# else
+#  define SCNdFAST8 "d"
 # endif
-# if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNiFAST8
-#  if INT_FAST8_MAX > INT32_MAX
-#   define SCNiFAST8 SCNi64
-#  elif INT_FAST8_MAX == 0x7fff
-#   define SCNiFAST8 "hi"
-#  elif INT_FAST8_MAX == 0x7f
-#   define SCNiFAST8 "hhi"
-#  else
-#   define SCNiFAST8 "i"
-#  endif
+#endif
+#if !defined SCNiFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNiFAST8
+# if INT_FAST8_MAX > INT32_MAX
+#  define SCNiFAST8 SCNi64
+# elif INT_FAST8_MAX == 0x7fff
+#  define SCNiFAST8 "hi"
+# elif INT_FAST8_MAX == 0x7f
+#  define SCNiFAST8 "hhi"
+# else
+#  define SCNiFAST8 "i"
 # endif
-# if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNoFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define SCNoFAST8 SCNo64
-#  elif UINT_FAST8_MAX == 0xffff
-#   define SCNoFAST8 "ho"
-#  elif UINT_FAST8_MAX == 0xff
-#   define SCNoFAST8 "hho"
-#  else
-#   define SCNoFAST8 "o"
-#  endif
+#endif
+#if !defined SCNoFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNoFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNoFAST8 SCNo64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNoFAST8 "ho"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNoFAST8 "hho"
+# else
+#  define SCNoFAST8 "o"
 # endif
-# if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNuFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define SCNuFAST8 SCNu64
-#  elif UINT_FAST8_MAX == 0xffff
-#   define SCNuFAST8 "hu"
-#  elif UINT_FAST8_MAX == 0xff
-#   define SCNuFAST8 "hhu"
-#  else
-#   define SCNuFAST8 "u"
-#  endif
+#endif
+#if !defined SCNuFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNuFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNuFAST8 SCNu64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNuFAST8 "hu"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNuFAST8 "hhu"
+# else
+#  define SCNuFAST8 "u"
 # endif
-# if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@
-#  undef SCNxFAST8
-#  if UINT_FAST8_MAX > UINT32_MAX
-#   define SCNxFAST8 SCNx64
-#  elif UINT_FAST8_MAX == 0xffff
-#   define SCNxFAST8 "hx"
-#  elif UINT_FAST8_MAX == 0xff
-#   define SCNxFAST8 "hhx"
-#  else
-#   define SCNxFAST8 "x"
-#  endif
+#endif
+#if !defined SCNxFAST8 || @PRI_MACROS_BROKEN@
+# undef SCNxFAST8
+# if UINT_FAST8_MAX > UINT32_MAX
+#  define SCNxFAST8 SCNx64
+# elif UINT_FAST8_MAX == 0xffff
+#  define SCNxFAST8 "hx"
+# elif UINT_FAST8_MAX == 0xff
+#  define SCNxFAST8 "hhx"
+# else
+#  define SCNxFAST8 "x"
 # endif
-# if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNdFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define SCNdFAST16 SCNd64
-#  elif INT_FAST16_MAX == 0x7fff
-#   define SCNdFAST16 "hd"
-#  else
-#   define SCNdFAST16 "d"
-#  endif
+#endif
+#if !defined SCNdFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNdFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define SCNdFAST16 SCNd64
+# elif INT_FAST16_MAX == 0x7fff
+#  define SCNdFAST16 "hd"
+# else
+#  define SCNdFAST16 "d"
 # endif
-# if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNiFAST16
-#  if INT_FAST16_MAX > INT32_MAX
-#   define SCNiFAST16 SCNi64
-#  elif INT_FAST16_MAX == 0x7fff
-#   define SCNiFAST16 "hi"
-#  else
-#   define SCNiFAST16 "i"
-#  endif
+#endif
+#if !defined SCNiFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNiFAST16
+# if INT_FAST16_MAX > INT32_MAX
+#  define SCNiFAST16 SCNi64
+# elif INT_FAST16_MAX == 0x7fff
+#  define SCNiFAST16 "hi"
+# else
+#  define SCNiFAST16 "i"
 # endif
-# if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNoFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define SCNoFAST16 SCNo64
-#  elif UINT_FAST16_MAX == 0xffff
-#   define SCNoFAST16 "ho"
-#  else
-#   define SCNoFAST16 "o"
-#  endif
+#endif
+#if !defined SCNoFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNoFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNoFAST16 SCNo64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNoFAST16 "ho"
+# else
+#  define SCNoFAST16 "o"
 # endif
-# if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNuFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define SCNuFAST16 SCNu64
-#  elif UINT_FAST16_MAX == 0xffff
-#   define SCNuFAST16 "hu"
-#  else
-#   define SCNuFAST16 "u"
-#  endif
+#endif
+#if !defined SCNuFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNuFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNuFAST16 SCNu64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNuFAST16 "hu"
+# else
+#  define SCNuFAST16 "u"
 # endif
-# if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@
-#  undef SCNxFAST16
-#  if UINT_FAST16_MAX > UINT32_MAX
-#   define SCNxFAST16 SCNx64
-#  elif UINT_FAST16_MAX == 0xffff
-#   define SCNxFAST16 "hx"
-#  else
-#   define SCNxFAST16 "x"
-#  endif
+#endif
+#if !defined SCNxFAST16 || @PRI_MACROS_BROKEN@
+# undef SCNxFAST16
+# if UINT_FAST16_MAX > UINT32_MAX
+#  define SCNxFAST16 SCNx64
+# elif UINT_FAST16_MAX == 0xffff
+#  define SCNxFAST16 "hx"
+# else
+#  define SCNxFAST16 "x"
 # endif
-# if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNdFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define SCNdFAST32 SCNd64
-#  else
-#   define SCNdFAST32 "d"
-#  endif
+#endif
+#if !defined SCNdFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNdFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define SCNdFAST32 SCNd64
+# else
+#  define SCNdFAST32 "d"
 # endif
-# if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNiFAST32
-#  if INT_FAST32_MAX > INT32_MAX
-#   define SCNiFAST32 SCNi64
-#  else
-#   define SCNiFAST32 "i"
-#  endif
+#endif
+#if !defined SCNiFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNiFAST32
+# if INT_FAST32_MAX > INT32_MAX
+#  define SCNiFAST32 SCNi64
+# else
+#  define SCNiFAST32 "i"
 # endif
-# if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNoFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define SCNoFAST32 SCNo64
-#  else
-#   define SCNoFAST32 "o"
-#  endif
+#endif
+#if !defined SCNoFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNoFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNoFAST32 SCNo64
+# else
+#  define SCNoFAST32 "o"
 # endif
-# if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNuFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define SCNuFAST32 SCNu64
-#  else
-#   define SCNuFAST32 "u"
-#  endif
+#endif
+#if !defined SCNuFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNuFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNuFAST32 SCNu64
+# else
+#  define SCNuFAST32 "u"
 # endif
-# if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@
-#  undef SCNxFAST32
-#  if UINT_FAST32_MAX > UINT32_MAX
-#   define SCNxFAST32 SCNx64
-#  else
-#   define SCNxFAST32 "x"
-#  endif
+#endif
+#if !defined SCNxFAST32 || @PRI_MACROS_BROKEN@
+# undef SCNxFAST32
+# if UINT_FAST32_MAX > UINT32_MAX
+#  define SCNxFAST32 SCNx64
+# else
+#  define SCNxFAST32 "x"
 # endif
-# ifdef INT64_MAX
-#  if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNdFAST64
-#   define SCNdFAST64 SCNd64
-#  endif
-#  if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNiFAST64
-#   define SCNiFAST64 SCNi64
-#  endif
+#endif
+#ifdef INT64_MAX
+# if !defined SCNdFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNdFAST64
+#  define SCNdFAST64 SCNd64
 # endif
-# ifdef UINT64_MAX
-#  if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNoFAST64
-#   define SCNoFAST64 SCNo64
-#  endif
-#  if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNuFAST64
-#   define SCNuFAST64 SCNu64
-#  endif
-#  if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
-#   undef SCNxFAST64
-#   define SCNxFAST64 SCNx64
-#  endif
+# if !defined SCNiFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNiFAST64
+#  define SCNiFAST64 SCNi64
+# endif
+#endif
+#ifdef UINT64_MAX
+# if !defined SCNoFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNoFAST64
+#  define SCNoFAST64 SCNo64
 # endif
+# if !defined SCNuFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNuFAST64
+#  define SCNuFAST64 SCNu64
+# endif
+# if !defined SCNxFAST64 || @PRI_MACROS_BROKEN@
+#  undef SCNxFAST64
+#  define SCNxFAST64 SCNx64
+# endif
+#endif
 
-# if !defined SCNdMAX || @PRI_MACROS_BROKEN@
-#  undef SCNdMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define SCNdMAX SCNd64
-#  else
-#   define SCNdMAX "ld"
-#  endif
+#if !defined SCNdMAX || @PRI_MACROS_BROKEN@
+# undef SCNdMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define SCNdMAX SCNd64
+# else
+#  define SCNdMAX "ld"
 # endif
-# if !defined SCNiMAX || @PRI_MACROS_BROKEN@
-#  undef SCNiMAX
-#  if @INT32_MAX_LT_INTMAX_MAX@
-#   define SCNiMAX SCNi64
-#  else
-#   define SCNiMAX "li"
-#  endif
+#endif
+#if !defined SCNiMAX || @PRI_MACROS_BROKEN@
+# undef SCNiMAX
+# if @INT32_MAX_LT_INTMAX_MAX@
+#  define SCNiMAX SCNi64
+# else
+#  define SCNiMAX "li"
 # endif
-# if !defined SCNoMAX || @PRI_MACROS_BROKEN@
-#  undef SCNoMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define SCNoMAX SCNo64
-#  else
-#   define SCNoMAX "lo"
-#  endif
+#endif
+#if !defined SCNoMAX || @PRI_MACROS_BROKEN@
+# undef SCNoMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNoMAX SCNo64
+# else
+#  define SCNoMAX "lo"
 # endif
-# if !defined SCNuMAX || @PRI_MACROS_BROKEN@
-#  undef SCNuMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define SCNuMAX SCNu64
-#  else
-#   define SCNuMAX "lu"
-#  endif
+#endif
+#if !defined SCNuMAX || @PRI_MACROS_BROKEN@
+# undef SCNuMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNuMAX SCNu64
+# else
+#  define SCNuMAX "lu"
 # endif
-# if !defined SCNxMAX || @PRI_MACROS_BROKEN@
-#  undef SCNxMAX
-#  if @UINT32_MAX_LT_UINTMAX_MAX@
-#   define SCNxMAX SCNx64
-#  else
-#   define SCNxMAX "lx"
-#  endif
+#endif
+#if !defined SCNxMAX || @PRI_MACROS_BROKEN@
+# undef SCNxMAX
+# if @UINT32_MAX_LT_UINTMAX_MAX@
+#  define SCNxMAX SCNx64
+# else
+#  define SCNxMAX "lx"
 # endif
+#endif
 
-# if !defined SCNdPTR || @PRI_MACROS_BROKEN@
-#  undef SCNdPTR
-#  ifdef INTPTR_MAX
-#   define SCNdPTR @PRIPTR_PREFIX@ "d"
-#  endif
+#if !defined SCNdPTR || @PRI_MACROS_BROKEN@
+# undef SCNdPTR
+# ifdef INTPTR_MAX
+#  define SCNdPTR @PRIPTR_PREFIX@ "d"
 # endif
-# if !defined SCNiPTR || @PRI_MACROS_BROKEN@
-#  undef SCNiPTR
-#  ifdef INTPTR_MAX
-#   define SCNiPTR @PRIPTR_PREFIX@ "i"
-#  endif
+#endif
+#if !defined SCNiPTR || @PRI_MACROS_BROKEN@
+# undef SCNiPTR
+# ifdef INTPTR_MAX
+#  define SCNiPTR @PRIPTR_PREFIX@ "i"
 # endif
-# if !defined SCNoPTR || @PRI_MACROS_BROKEN@
-#  undef SCNoPTR
-#  ifdef UINTPTR_MAX
-#   define SCNoPTR @PRIPTR_PREFIX@ "o"
-#  endif
+#endif
+#if !defined SCNoPTR || @PRI_MACROS_BROKEN@
+# undef SCNoPTR
+# ifdef UINTPTR_MAX
+#  define SCNoPTR @PRIPTR_PREFIX@ "o"
 # endif
-# if !defined SCNuPTR || @PRI_MACROS_BROKEN@
-#  undef SCNuPTR
-#  ifdef UINTPTR_MAX
-#   define SCNuPTR @PRIPTR_PREFIX@ "u"
-#  endif
+#endif
+#if !defined SCNuPTR || @PRI_MACROS_BROKEN@
+# undef SCNuPTR
+# ifdef UINTPTR_MAX
+#  define SCNuPTR @PRIPTR_PREFIX@ "u"
 # endif
-# if !defined SCNxPTR || @PRI_MACROS_BROKEN@
-#  undef SCNxPTR
-#  ifdef UINTPTR_MAX
-#   define SCNxPTR @PRIPTR_PREFIX@ "x"
-#  endif
+#endif
+#if !defined SCNxPTR || @PRI_MACROS_BROKEN@
+# undef SCNxPTR
+# ifdef UINTPTR_MAX
+#  define SCNxPTR @PRIPTR_PREFIX@ "x"
 # endif
-
 #endif
 
 /* 7.8.2 Functions for greatest-width integer types */
@@ -1075,10 +1079,23 @@ _GL_WARN_ON_USE (imaxdiv, "imaxdiv is unportable - "
 #endif
 
 #if @GNULIB_STRTOIMAX@
-# if !@HAVE_DECL_STRTOIMAX@
-#  undef strtoimax
-extern intmax_t strtoimax (const char *, char **, int) _GL_ARG_NONNULL ((1));
+# if @REPLACE_STRTOIMAX@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef strtoimax
+#   define strtoimax rpl_strtoimax
+#  endif
+_GL_FUNCDECL_RPL (strtoimax, intmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoimax, intmax_t, (const char *, char **, int));
+# else
+#  if !@HAVE_DECL_STRTOIMAX@
+#   undef strtoimax
+_GL_FUNCDECL_SYS (strtoimax, intmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtoimax, intmax_t, (const char *, char **, int));
 # endif
+_GL_CXXALIASWARN (strtoimax);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoimax
 # if HAVE_RAW_DECL_STRTOIMAX
@@ -1090,8 +1107,11 @@ _GL_WARN_ON_USE (strtoimax, "strtoimax is unportable - "
 #if @GNULIB_STRTOUMAX@
 # if !@HAVE_DECL_STRTOUMAX@
 #  undef strtoumax
-extern uintmax_t strtoumax (const char *, char **, int) _GL_ARG_NONNULL ((1));
+_GL_FUNCDECL_SYS (strtoumax, uintmax_t,
+                  (const char *, char **, int) _GL_ARG_NONNULL ((1)));
 # endif
+_GL_CXXALIAS_SYS (strtoumax, uintmax_t, (const char *, char **, int));
+_GL_CXXALIASWARN (strtoumax);
 #elif defined GNULIB_POSIXCHECK
 # undef strtoumax
 # if HAVE_RAW_DECL_STRTOUMAX
index d786288f2b78ee434a072803c6070d6794b7834f..db119a10d3f48db6f760dab5953696eb6b49902b 100644 (file)
@@ -1,6 +1,6 @@
 /* Work around a bug of lstat on some systems
 
-   Copyright (C) 1997-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 1997-2006, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -51,11 +51,11 @@ orig_lstat (const char *filename, struct stat *buf)
 # include <errno.h>
 
 /* lstat works differently on Linux and Solaris systems.  POSIX (see
-   `pathname resolution' in the glossary) requires that programs like
-   `ls' take into consideration the fact that FILE has a trailing slash
+   "pathname resolution" in the glossary) requires that programs like
+   'ls' take into consideration the fact that FILE has a trailing slash
    when FILE is a symbolic link.  On Linux and Solaris 10 systems, the
    lstat function already has the desired semantics (in treating
-   `lstat ("symlink/", sbuf)' just like `lstat ("symlink/.", sbuf)',
+   'lstat ("symlink/", sbuf)' just like 'lstat ("symlink/.", sbuf)',
    but on Solaris 9 and earlier it does not.
 
    If FILE has a trailing slash and specifies a symbolic link,
index 3600406ac134cf47fb53eb9483d134184f2d2465..b49195bcb8431ccb9990f8ff5abe51daf5163ca6 100644 (file)
@@ -20,14 +20,21 @@ ALL = gnulib
 
 .PHONY: $(ALL)
 
-LOCAL_FLAGS    = -DHAVE_CONFIG_H=1 -I. -I../nt/inc -I../src
+LOCAL_FLAGS    = -I. -I../nt/inc -I../src
 LIBS           =
 
-GNULIBOBJS = $(BLD)/dtoastr.$(O) \
+GNULIBOBJS = $(BLD)/c-ctype.$(O) \
+            $(BLD)/c-strcasecmp.$(O) \
+            $(BLD)/c-strncasecmp.$(O) \
+            $(BLD)/dtoastr.$(O) \
+            $(BLD)/dtotimespec.$(O)  \
             $(BLD)/getopt.$(O)  \
             $(BLD)/getopt1.$(O) \
+            $(BLD)/gettime.$(O) \
             $(BLD)/strftime.$(O) \
             $(BLD)/time_r.$(O) \
+            $(BLD)/timespec-add.$(O) \
+            $(BLD)/timespec-sub.$(O) \
             $(BLD)/md5.$(O) \
             $(BLD)/sha1.$(O) \
             $(BLD)/sha256.$(O) \
@@ -41,12 +48,12 @@ $(BLD)/libgnu.$(A): $(GNULIBOBJS)
        - $(DEL) $@
        $(AR) $(AR_OUT)$@ $(ALL_DEPS)
 
-gnulib:        stamp_BLD $(BLD)/libgnu.$(A)
+gnulib:                $(BLD)/libgnu.$(A)
 
 #
 # Build everything
 #
-all:           stamp_BLD $(ALL)
+all:           $(ALL)
 
 ### TAGS ###
 
@@ -58,105 +65,144 @@ TAGS: FRC
 ### DEPENDENCIES ###
 
 EMACS_ROOT     = ..
-SRC            = .
+GNU_LIB                = .
+SRC            = $(EMACS_ROOT)/src
+NT_INC         = $(EMACS_ROOT)/nt/inc
+
+C_CTYPE_H      = $(GNU_LIB)/c-ctype.h \
+                $(NT_INC)/stdbool.h
+MS_W32_H       = $(SRC)/s/ms-w32.h \
+                $(NT_INC)/sys/stat.h
+CONFIG_H       = $(SRC)/config.h \
+                $(MS_W32_H)
+FILEMODE_H     = $(GNU_LIB)/filemode.h \
+                $(NT_INC)/sys/stat.h
+FTOASTR_H      = $(GNU_LIB)/ftoastr.h \
+                $(GNU_LIB)/intprops.h
+FTOASTR_C      = $(GNU_LIB)/ftoastr.c \
+                $(CONFIG_H) \
+                $(FTOASTR_H) \
+                $(GNU_LIB)/ftoastr.h
+GETOPT_INT_H   = $(GNU_LIB)/getopt_int.h \
+                $(GNU_LIB)/getopt.h
+MD5_H          = $(GNU_LIB)/md5.h \
+                $(NT_INC)/stdint.h
+SHA1_H         = $(GNU_LIB)/sha1.h \
+                $(NT_INC)/stdint.h
+SHA256_H       = $(GNU_LIB)/sha256.h \
+                $(NT_INC)/stdint.h
+U64_H          = $(GNU_LIB)/u64.h \
+                $(NT_INC)/stdint.h
+SHA512_H       = $(GNU_LIB)/sha512.h \
+                $(U64_H) \
+                $(GNU_LIB)/u64.h
+
+$(BLD)/c-ctype.$(O) : \
+       $(GNU_LIB)/c-ctype.c \
+       $(CONFIG_H) \
+       $(C_CTYPE_H)
+
+$(BLD)/c-strcasecmp.$(O) : \
+       $(GNU_LIB)/c-strcasecmp.c \
+       $(GNU_LIB)/c-strcase.h \
+       $(CONFIG_H) \
+       $(C_CTYPE_H)
+
+$(BLD)/c-strncasecmp.$(O) : \
+       $(GNU_LIB)/c-strncasecmp.c \
+       $(GNU_LIB)/c-strcase.h \
+       $(CONFIG_H) \
+       $(C_CTYPE_H)
 
 $(BLD)/dtoastr.$(O) : \
-       $(SRC)/dtoastr.c \
-       $(SRC)/ftoastr.c \
-       $(SRC)/ftoastr.h \
-       $(SRC)/intprops.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/dtoastr.c \
+       $(FTOASTR_C)
+
+$(BLD)/dtotimespec.$(O) : \
+       $(GNU_LIB)/dtotimespec.c \
+       $(GNU_LIB)/intprops.h \
+       $(GNU_LIB)/timespec.h \
+       $(CONFIG_H)
 
 $(BLD)/getopt.$(O) : \
-       $(SRC)/getopt.c \
-       $(SRC)/getopt.h \
-       $(SRC)/getopt_int.h \
-       $(SRC)/gettext.h \
-       $(EMACS_ROOT)/nt/inc/unistd.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/getopt.c \
+       $(GNU_LIB)/getopt.h \
+       $(GNU_LIB)/gettext.h \
+       $(NT_INC)/unistd.h \
+       $(CONFIG_H) \
+       $(GETOPT_INT_H)
 
 $(BLD)/getopt1.$(O) : \
-       $(SRC)/getopt1.c \
-       $(SRC)/getopt.h \
-       $(SRC)/getopt_int.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/getopt1.c \
+       $(GNU_LIB)/getopt.h \
+       $(CONFIG_H) \
+       $(GETOPT_INT_H)
+
+$(BLD)/gettime.$(O) : \
+       $(GNU_LIB)/gettime.c \
+       $(GNU_LIB)/timespec.h \
+       $(NT_INC)/sys/time.h \
+       $(CONFIG_H)
 
 $(BLD)/strftime.$(O) : \
-       $(SRC)/strftime.c \
-       $(SRC)/strftime.h \
-       $(EMACS_ROOT)/nt/inc/stdbool.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/strftime.c \
+       $(GNU_LIB)/strftime.h \
+       $(NT_INC)/stdbool.h \
+       $(CONFIG_H)
 
 $(BLD)/time_r.$(O) : \
-       $(SRC)/time_r.c \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/time_r.c \
+       $(CONFIG_H)
+
+$(BLD)/timespec-add.$(O) : \
+       $(GNU_LIB)/timespec-add.c \
+       $(GNU_LIB)/intprops.h \
+       $(GNU_LIB)/timespec.h \
+       $(CONFIG_H)
+
+$(BLD)/timespec-sub.$(O) : \
+       $(GNU_LIB)/timespec-sub.c \
+       $(GNU_LIB)/intprops.h \
+       $(GNU_LIB)/timespec.h \
+       $(CONFIG_H)
 
 $(BLD)/md5.$(O) : \
-       $(SRC)/md5.c \
-       $(SRC)/md5.h \
-       $(EMACS_ROOT)/nt/inc/stdint.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/md5.c \
+       $(NT_INC)/stdalign.h \
+       $(NT_INC)/stdint.h \
+       $(CONFIG_H) \
+       $(MD5_H)
 
 $(BLD)/sha1.$(O) : \
-       $(SRC)/sha1.c \
-       $(SRC)/sha1.h \
-       $(EMACS_ROOT)/nt/inc/stdint.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/sha1.c \
+       $(NT_INC)/stdalign.h \
+       $(NT_INC)/stdint.h \
+       $(CONFIG_H) \
+       $(SHA1_H)
 
 $(BLD)/sha256.$(O) : \
-       $(SRC)/sha256.c \
-       $(SRC)/sha256.h \
-       $(EMACS_ROOT)/nt/inc/stdint.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/sha256.c \
+       $(NT_INC)/stdalign.h \
+       $(NT_INC)/stdint.h \
+       $(CONFIG_H) \
+       $(SHA256_H)
 
 $(BLD)/sha512.$(O) : \
-       $(SRC)/sha512.c \
-       $(SRC)/sha512.h \
-       $(EMACS_ROOT)/nt/inc/stdint.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/sha512.c \
+       $(NT_INC)/stdalign.h \
+       $(NT_INC)/stdint.h \
+       $(CONFIG_H) \
+       $(SHA512_H)
 
 $(BLD)/filemode.$(O) : \
-       $(SRC)/filemode.c \
-       $(SRC)/filemode.h \
-       $(EMACS_ROOT)/nt/inc/sys/stat.h \
-       $(EMACS_ROOT)/src/s/ms-w32.h \
-       $(EMACS_ROOT)/src/m/intel386.h \
-       $(EMACS_ROOT)/src/config.h
+       $(GNU_LIB)/filemode.c \
+       $(CONFIG_H) \
+       $(FILEMODE_H)
 
 # The following dependencies are for supporting parallel builds, where
 # we must make sure $(BLD) exists before any compilation starts.
 #
-$(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O): stamp_BLD
-$(BLD)/strftime.$(O) $(BLD)/time_r.$(O) $(BLD)/md5.$(O): stamp_BLD
-$(BLD)/sha1.$(O) $(BLD)/sha256.$(O) $(BLD)/sha512.$(O): stamp_BLD
-$(BLD)/filemode.$(O): stamp_BLD
+$(GNULIBOBJS): stamp_BLD
 
 #
 # Headers we would preprocess if we could.
index b7fad633364cf8c85c4941e589e24001be80d56f..30b7e50e3ae454439950744744c41afefab73364 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,6 +1,6 @@
 /* Functions to compute MD5 message digest of files or memory blocks.
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2011 Free Software
+   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -15,8 +15,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
 
@@ -24,7 +23,8 @@
 
 #include "md5.h"
 
-#include <stddef.h>
+#include <stdalign.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
@@ -254,8 +254,7 @@ md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
   if (len >= 64)
     {
 #if !_STRING_ARCH_unaligned
-# define alignof(type) offsetof (struct { char c; type x; }, x)
-# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
       if (UNALIGNED_P (buffer))
         while (len > 64)
           {
@@ -313,13 +312,13 @@ md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
   uint32_t B = ctx->B;
   uint32_t C = ctx->C;
   uint32_t D = ctx->D;
+  uint32_t lolen = len;
 
   /* First increment the byte count.  RFC 1321 specifies the possible
      length of the file up to 2^64 bits.  Here we only compute the
      number of bytes.  Do a double word increment.  */
-  ctx->total[0] += len;
-  if (ctx->total[0] < len)
-    ++ctx->total[1];
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
 
   /* Process all bytes in the buffer with 64 bytes in each round of
      the loop.  */
index 53e60480292c4032c24798d028cd4d3eb11e7a53..75d6bce5c3364b09c7fae80ec643d6dcce429bc2 100644 (file)
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,6 +1,6 @@
 /* Declaration of functions and data types used for MD5 sum computing
    library functions.
-   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2011 Free Software
+   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2012 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -15,8 +15,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _MD5_H
 #define _MD5_H 1
@@ -73,7 +72,7 @@ struct md5_ctx
 
 /*
  * The following three functions are build up the low level used in
- * the functions `md5_stream' and `md5_buffer'.
+ * the functions 'md5_stream' and 'md5_buffer'.
  */
 
 /* Initialize structure containing state of computation.
index c68ad9ba262008d623ac8ca44bcca1e72efdfa26..952c82983bb2cbfdc4f73a1bbcf8ba2fc8608767 100644 (file)
@@ -1,21 +1,21 @@
-/* Convert a `struct tm' to a time_t value.
-   Copyright (C) 1993-1999, 2002-2007, 2009-2011 Free Software Foundation, Inc.
+/* Convert a 'struct tm' to a time_t value.
+   Copyright (C) 1993-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <eggert@twinsun.com>.
 
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 3, or (at your option)
-   any later version.
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public
+   License as published by the Free Software Foundation; either
+   version 3 of the License, or (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful,
+   The GNU C Library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-   You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 /* Define this to have a standalone program to test this implementation of
    mktime.  */
 # include <config.h>
 #endif
 
-/* Some of the code in this file assumes that signed integer overflow
-   silently wraps around.  This assumption can't easily be programmed
-   around, nor can it be checked for portably at compile-time or
-   easily eliminated at run-time.
-
-   Define WRAPV to 1 if the assumption is valid.  Otherwise, define it
-   to 0; this forces the use of slower code that, while not guaranteed
-   by the C Standard, works on all production platforms that we know
-   about.  */
-#ifndef WRAPV
-# if (__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__
-#  pragma GCC optimize ("wrapv")
-#  define WRAPV 1
-# else
-#  define WRAPV 0
-# endif
-#endif
-
 /* Assume that leap seconds are possible, unless told otherwise.
-   If the host has a `zic' command with a `-L leapsecondfilename' option,
+   If the host has a 'zic' command with a '-L leapsecondfilename' option,
    then it supports leap seconds; otherwise it probably doesn't.  */
 #ifndef LEAP_SECONDS_POSSIBLE
 # define LEAP_SECONDS_POSSIBLE 1
@@ -54,7 +36,7 @@
 
 #include <limits.h>
 
-#include <string.h>             /* For the real memcpy prototype.  */
+#include <string.h>            /* For the real memcpy prototype.  */
 
 #if DEBUG
 # include <stdio.h>
 # define mktime my_mktime
 #endif /* DEBUG */
 
+/* Some of the code in this file assumes that signed integer overflow
+   silently wraps around.  This assumption can't easily be programmed
+   around, nor can it be checked for portably at compile-time or
+   easily eliminated at run-time.
+
+   Define WRAPV to 1 if the assumption is valid and if
+     #pragma GCC optimize ("wrapv")
+   does not trigger GCC bug 51793
+   <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51793>.
+   Otherwise, define it to 0; this forces the use of slower code that,
+   while not guaranteed by the C Standard, works on all production
+   platforms that we know about.  */
+#ifndef WRAPV
+# if (((__GNUC__ == 4 && 4 <= __GNUC_MINOR__) || 4 < __GNUC__) \
+      && defined __GLIBC__)
+#  pragma GCC optimize ("wrapv")
+#  define WRAPV 1
+# else
+#  define WRAPV 0
+# endif
+#endif
+
 /* Verify a requirement at compile-time (unlike assert, which is runtime).  */
 #define verify(name, assertion) struct name { char a[(assertion) ? 1 : -1]; }
 
@@ -112,12 +116,12 @@ verify (long_int_is_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2);
    your host.  */
 #define TYPE_MINIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-        ? (t) 0 \
-        : ~ TYPE_MAXIMUM (t)))
+       ? (t) 0 \
+       : ~ TYPE_MAXIMUM (t)))
 #define TYPE_MAXIMUM(t) \
   ((t) (! TYPE_SIGNED (t) \
-        ? (t) -1 \
-        : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
+       ? (t) -1 \
+       : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
 
 #ifndef TIME_T_MIN
 # define TIME_T_MIN TYPE_MINIMUM (time_t)
@@ -129,9 +133,9 @@ verify (long_int_is_wide_enough, INT_MAX == INT_MAX * (long_int) 2 / 2);
 
 verify (time_t_is_integer, TYPE_IS_INTEGER (time_t));
 verify (twos_complement_arithmetic,
-        (TYPE_TWOS_COMPLEMENT (int)
-         && TYPE_TWOS_COMPLEMENT (long_int)
-         && TYPE_TWOS_COMPLEMENT (time_t)));
+       (TYPE_TWOS_COMPLEMENT (int)
+        && TYPE_TWOS_COMPLEMENT (long_int)
+        && TYPE_TWOS_COMPLEMENT (time_t)));
 
 #define EPOCH_YEAR 1970
 #define TM_YEAR_BASE 1900
@@ -146,7 +150,7 @@ leapyear (long_int year)
   return
     ((year & 3) == 0
      && (year % 100 != 0
-         || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
+        || ((year / 100) & 3) == (- (TM_YEAR_BASE / 100) & 3)));
 }
 
 /* How many days come before each month (0-12).  */
@@ -178,7 +182,7 @@ const unsigned short int __mon_yday[2][13] =
 static int
 isdst_differ (int a, int b)
 {
-  return (!a != !b) & (0 <= a) & (0 <= b);
+  return (!a != !b) && (0 <= a) && (0 <= b);
 }
 
 /* Return an integer value measuring (YEAR1-YDAY1 HOUR1:MIN1:SEC1) -
@@ -194,7 +198,7 @@ isdst_differ (int a, int b)
 
 static inline time_t
 ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
-            int year0, int yday0, int hour0, int min0, int sec0)
+           int year0, int yday0, int hour0, int min0, int sec0)
 {
   verify (C99_integer_division, -1 / 2 == 0);
 
@@ -275,15 +279,15 @@ time_t_int_add_ok (time_t a, int b)
    yield a value equal to *T.  */
 static time_t
 guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
-               const time_t *t, const struct tm *tp)
+              const time_t *t, const struct tm *tp)
 {
   if (tp)
     {
       time_t d = ydhms_diff (year, yday, hour, min, sec,
-                             tp->tm_year, tp->tm_yday,
-                             tp->tm_hour, tp->tm_min, tp->tm_sec);
+                            tp->tm_year, tp->tm_yday,
+                            tp->tm_hour, tp->tm_min, tp->tm_sec);
       if (time_t_add_ok (*t, d))
-        return *t + d;
+       return *t + d;
     }
 
   /* Overflow occurred one way or another.  Return the nearest result
@@ -292,8 +296,8 @@ guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
      match; and don't oscillate between two values, as that would
      confuse the spring-forward gap detector.  */
   return (*t < TIME_T_MIDPOINT
-          ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
-          : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
+         ? (*t <= TIME_T_MIN + 1 ? *t + 1 : TIME_T_MIN)
+         : (TIME_T_MAX - 1 <= *t ? *t - 1 : TIME_T_MAX));
 }
 
 /* Use CONVERT to convert *T to a broken down time in *TP.
@@ -301,7 +305,7 @@ guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
    it is the nearest in-range value and then convert that.  */
 static struct tm *
 ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
-                time_t *t, struct tm *tp)
+               time_t *t, struct tm *tp)
 {
   struct tm *r = convert (t, tp);
 
@@ -311,25 +315,25 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
       time_t ok = 0;
 
       /* BAD is a known unconvertible time_t, and OK is a known good one.
-         Use binary search to narrow the range between BAD and OK until
-         they differ by 1.  */
+        Use binary search to narrow the range between BAD and OK until
+        they differ by 1.  */
       while (bad != ok + (bad < 0 ? -1 : 1))
-        {
-          time_t mid = *t = time_t_avg (ok, bad);
-          r = convert (t, tp);
-          if (r)
-            ok = mid;
-          else
-            bad = mid;
-        }
+       {
+         time_t mid = *t = time_t_avg (ok, bad);
+         r = convert (t, tp);
+         if (r)
+           ok = mid;
+         else
+           bad = mid;
+       }
 
       if (!r && ok)
-        {
-          /* The last conversion attempt failed;
-             revert to the most recent successful attempt.  */
-          *t = ok;
-          r = convert (t, tp);
-        }
+       {
+         /* The last conversion attempt failed;
+            revert to the most recent successful attempt.  */
+         *t = ok;
+         r = convert (t, tp);
+       }
     }
 
   return r;
@@ -344,8 +348,8 @@ ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
    This function is external because it is used also by timegm.c.  */
 time_t
 __mktime_internal (struct tm *tp,
-                   struct tm *(*convert) (const time_t *, struct tm *),
-                   time_t *offset)
+                  struct tm *(*convert) (const time_t *, struct tm *),
+                  time_t *offset)
 {
   time_t t, gt, t0, t1, t2;
   struct tm tm;
@@ -384,8 +388,8 @@ __mktime_internal (struct tm *tp,
   /* Calculate day of year from year, month, and day of month.
      The result need not be in range.  */
   int mon_yday = ((__mon_yday[leapyear (year)]
-                   [mon_remainder + 12 * negative_mon_remainder])
-                  - 1);
+                  [mon_remainder + 12 * negative_mon_remainder])
+                 - 1);
   long_int lmday = mday;
   long_int yday = mon_yday + lmday;
 
@@ -396,33 +400,33 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE)
     {
       /* Handle out-of-range seconds specially,
-         since ydhms_tm_diff assumes every minute has 60 seconds.  */
+        since ydhms_tm_diff assumes every minute has 60 seconds.  */
       if (sec < 0)
-        sec = 0;
+       sec = 0;
       if (59 < sec)
-        sec = 59;
+       sec = 59;
     }
 
   /* Invert CONVERT by probing.  First assume the same offset as last
      time.  */
 
   t0 = ydhms_diff (year, yday, hour, min, sec,
-                   EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
+                  EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, - guessed_offset);
 
   if (TIME_T_MAX / INT_MAX / 366 / 24 / 60 / 60 < 3)
     {
       /* time_t isn't large enough to rule out overflows, so check
-         for major overflows.  A gross check suffices, since if t0
-         has overflowed, it is off by a multiple of TIME_T_MAX -
-         TIME_T_MIN + 1.  So ignore any component of the difference
-         that is bounded by a small value.  */
+        for major overflows.  A gross check suffices, since if t0
+        has overflowed, it is off by a multiple of TIME_T_MAX -
+        TIME_T_MIN + 1.  So ignore any component of the difference
+        that is bounded by a small value.  */
 
       /* Approximate log base 2 of the number of time units per
-         biennium.  A biennium is 2 years; use this unit instead of
-         years to avoid integer overflow.  For example, 2 average
-         Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
-         which is 63113904 seconds, and rint (log2 (63113904)) is
-         26.  */
+        biennium.  A biennium is 2 years; use this unit instead of
+        years to avoid integer overflow.  For example, 2 average
+        Gregorian years are 2 * 365.2425 * 24 * 60 * 60 seconds,
+        which is 63113904 seconds, and rint (log2 (63113904)) is
+        26.  */
       int ALOG2_SECONDS_PER_BIENNIUM = 26;
       int ALOG2_MINUTES_PER_BIENNIUM = 20;
       int ALOG2_HOURS_PER_BIENNIUM = 14;
@@ -430,64 +434,64 @@ __mktime_internal (struct tm *tp,
       int LOG2_YEARS_PER_BIENNIUM = 1;
 
       int approx_requested_biennia =
-        (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
-         - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
-         + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
-         + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
-         + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
-         + (LEAP_SECONDS_POSSIBLE
-            ? 0
-            : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
+       (SHR (year_requested, LOG2_YEARS_PER_BIENNIUM)
+        - SHR (EPOCH_YEAR - TM_YEAR_BASE, LOG2_YEARS_PER_BIENNIUM)
+        + SHR (mday, ALOG2_DAYS_PER_BIENNIUM)
+        + SHR (hour, ALOG2_HOURS_PER_BIENNIUM)
+        + SHR (min, ALOG2_MINUTES_PER_BIENNIUM)
+        + (LEAP_SECONDS_POSSIBLE
+           ? 0
+           : SHR (sec, ALOG2_SECONDS_PER_BIENNIUM)));
 
       int approx_biennia = SHR (t0, ALOG2_SECONDS_PER_BIENNIUM);
       int diff = approx_biennia - approx_requested_biennia;
-      int abs_diff = diff < 0 ? -1 - diff : diff;
+      int approx_abs_diff = diff < 0 ? -1 - diff : diff;
 
       /* IRIX 4.0.5 cc miscalculates TIME_T_MIN / 3: it erroneously
-         gives a positive value of 715827882.  Setting a variable
-         first then doing math on it seems to work.
-         (ghazi@caip.rutgers.edu) */
+        gives a positive value of 715827882.  Setting a variable
+        first then doing math on it seems to work.
+        (ghazi@caip.rutgers.edu) */
       time_t time_t_max = TIME_T_MAX;
       time_t time_t_min = TIME_T_MIN;
       time_t overflow_threshold =
-        (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
-
-      if (overflow_threshold < abs_diff)
-        {
-          /* Overflow occurred.  Try repairing it; this might work if
-             the time zone offset is enough to undo the overflow.  */
-          time_t repaired_t0 = -1 - t0;
-          approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
-          diff = approx_biennia - approx_requested_biennia;
-          abs_diff = diff < 0 ? -1 - diff : diff;
-          if (overflow_threshold < abs_diff)
-            return -1;
-          guessed_offset += repaired_t0 - t0;
-          t0 = repaired_t0;
-        }
+       (time_t_max / 3 - time_t_min / 3) >> ALOG2_SECONDS_PER_BIENNIUM;
+
+      if (overflow_threshold < approx_abs_diff)
+       {
+         /* Overflow occurred.  Try repairing it; this might work if
+            the time zone offset is enough to undo the overflow.  */
+         time_t repaired_t0 = -1 - t0;
+         approx_biennia = SHR (repaired_t0, ALOG2_SECONDS_PER_BIENNIUM);
+         diff = approx_biennia - approx_requested_biennia;
+         approx_abs_diff = diff < 0 ? -1 - diff : diff;
+         if (overflow_threshold < approx_abs_diff)
+           return -1;
+         guessed_offset += repaired_t0 - t0;
+         t0 = repaired_t0;
+       }
     }
 
   /* Repeatedly use the error to improve the guess.  */
 
   for (t = t1 = t2 = t0, dst2 = 0;
        (gt = guess_time_tm (year, yday, hour, min, sec, &t,
-                            ranged_convert (convert, &t, &tm)),
-        t != gt);
+                           ranged_convert (convert, &t, &tm)),
+       t != gt);
        t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
     if (t == t1 && t != t2
-        && (tm.tm_isdst < 0
-            || (isdst < 0
-                ? dst2 <= (tm.tm_isdst != 0)
-                : (isdst != 0) != (tm.tm_isdst != 0))))
+       && (tm.tm_isdst < 0
+           || (isdst < 0
+               ? dst2 <= (tm.tm_isdst != 0)
+               : (isdst != 0) != (tm.tm_isdst != 0))))
       /* We can't possibly find a match, as we are oscillating
-         between two values.  The requested time probably falls
-         within a spring-forward gap of size GT - T.  Follow the common
-         practice in this case, which is to return a time that is GT - T
-         away from the requested time, preferring a time whose
-         tm_isdst differs from the requested value.  (If no tm_isdst
-         was requested and only one of the two values has a nonzero
-         tm_isdst, prefer that value.)  In practice, this is more
-         useful than returning -1.  */
+        between two values.  The requested time probably falls
+        within a spring-forward gap of size GT - T.  Follow the common
+        practice in this case, which is to return a time that is GT - T
+        away from the requested time, preferring a time whose
+        tm_isdst differs from the requested value.  (If no tm_isdst
+        was requested and only one of the two values has a nonzero
+        tm_isdst, prefer that value.)  In practice, this is more
+        useful than returning -1.  */
       goto offset_found;
     else if (--remaining_probes == 0)
       return -1;
@@ -497,50 +501,50 @@ __mktime_internal (struct tm *tp,
   if (isdst_differ (isdst, tm.tm_isdst))
     {
       /* tm.tm_isdst has the wrong value.  Look for a neighboring
-         time with the right value, and use its UTC offset.
+        time with the right value, and use its UTC offset.
 
-         Heuristic: probe the adjacent timestamps in both directions,
-         looking for the desired isdst.  This should work for all real
-         time zone histories in the tz database.  */
+        Heuristic: probe the adjacent timestamps in both directions,
+        looking for the desired isdst.  This should work for all real
+        time zone histories in the tz database.  */
 
       /* Distance between probes when looking for a DST boundary.  In
-         tzdata2003a, the shortest period of DST is 601200 seconds
-         (e.g., America/Recife starting 2000-10-08 01:00), and the
-         shortest period of non-DST surrounded by DST is 694800
-         seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
-         minimum of these two values, so we don't miss these short
-         periods when probing.  */
+        tzdata2003a, the shortest period of DST is 601200 seconds
+        (e.g., America/Recife starting 2000-10-08 01:00), and the
+        shortest period of non-DST surrounded by DST is 694800
+        seconds (Africa/Tunis starting 1943-04-17 01:00).  Use the
+        minimum of these two values, so we don't miss these short
+        periods when probing.  */
       int stride = 601200;
 
       /* The longest period of DST in tzdata2003a is 536454000 seconds
-         (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
-         period of non-DST is much longer, but it makes no real sense
-         to search for more than a year of non-DST, so use the DST
-         max.  */
+        (e.g., America/Jujuy starting 1946-10-01 01:00).  The longest
+        period of non-DST is much longer, but it makes no real sense
+        to search for more than a year of non-DST, so use the DST
+        max.  */
       int duration_max = 536454000;
 
       /* Search in both directions, so the maximum distance is half
-         the duration; add the stride to avoid off-by-1 problems.  */
+        the duration; add the stride to avoid off-by-1 problems.  */
       int delta_bound = duration_max / 2 + stride;
 
       int delta, direction;
 
       for (delta = stride; delta < delta_bound; delta += stride)
-        for (direction = -1; direction <= 1; direction += 2)
-          if (time_t_int_add_ok (t, delta * direction))
-            {
-              time_t ot = t + delta * direction;
-              struct tm otm;
-              ranged_convert (convert, &ot, &otm);
-              if (! isdst_differ (isdst, otm.tm_isdst))
-                {
-                  /* We found the desired tm_isdst.
-                     Extrapolate back to the desired time.  */
-                  t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
-                  ranged_convert (convert, &t, &tm);
-                  goto offset_found;
-                }
-            }
+       for (direction = -1; direction <= 1; direction += 2)
+         if (time_t_int_add_ok (t, delta * direction))
+           {
+             time_t ot = t + delta * direction;
+             struct tm otm;
+             ranged_convert (convert, &ot, &otm);
+             if (! isdst_differ (isdst, otm.tm_isdst))
+               {
+                 /* We found the desired tm_isdst.
+                    Extrapolate back to the desired time.  */
+                 t = guess_time_tm (year, yday, hour, min, sec, &ot, &otm);
+                 ranged_convert (convert, &t, &tm);
+                 goto offset_found;
+               }
+           }
     }
 
  offset_found:
@@ -549,16 +553,16 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
     {
       /* Adjust time to reflect the tm_sec requested, not the normalized value.
-         Also, repair any damage from a false match due to a leap second.  */
+        Also, repair any damage from a false match due to a leap second.  */
       int sec_adjustment = (sec == 0 && tm.tm_sec == 60) - sec;
       if (! time_t_int_add_ok (t, sec_requested))
-        return -1;
+       return -1;
       t1 = t + sec_requested;
       if (! time_t_int_add_ok (t1, sec_adjustment))
-        return -1;
+       return -1;
       t2 = t1 + sec_adjustment;
       if (! convert (&t2, &tm))
-        return -1;
+       return -1;
       t = t2;
     }
 
@@ -579,7 +583,7 @@ mktime (struct tm *tp)
 {
 #ifdef _LIBC
   /* POSIX.1 8.1.1 requires that whenever mktime() is called, the
-     time zone names contained in the external variable `tzname' shall
+     time zone names contained in the external variable 'tzname' shall
      be set as if the tzset() function had been called.  */
   __tzset ();
 #endif
@@ -602,13 +606,13 @@ static int
 not_equal_tm (const struct tm *a, const struct tm *b)
 {
   return ((a->tm_sec ^ b->tm_sec)
-          | (a->tm_min ^ b->tm_min)
-          | (a->tm_hour ^ b->tm_hour)
-          | (a->tm_mday ^ b->tm_mday)
-          | (a->tm_mon ^ b->tm_mon)
-          | (a->tm_year ^ b->tm_year)
-          | (a->tm_yday ^ b->tm_yday)
-          | isdst_differ (a->tm_isdst, b->tm_isdst));
+         | (a->tm_min ^ b->tm_min)
+         | (a->tm_hour ^ b->tm_hour)
+         | (a->tm_mday ^ b->tm_mday)
+         | (a->tm_mon ^ b->tm_mon)
+         | (a->tm_year ^ b->tm_year)
+         | (a->tm_yday ^ b->tm_yday)
+         | isdst_differ (a->tm_isdst, b->tm_isdst));
 }
 
 static void
@@ -616,9 +620,9 @@ print_tm (const struct tm *tp)
 {
   if (tp)
     printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
-            tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
-            tp->tm_hour, tp->tm_min, tp->tm_sec,
-            tp->tm_yday, tp->tm_wday, tp->tm_isdst);
+           tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
+           tp->tm_hour, tp->tm_min, tp->tm_sec,
+           tp->tm_yday, tp->tm_wday, tp->tm_isdst);
   else
     printf ("0");
 }
@@ -650,11 +654,11 @@ main (int argc, char **argv)
 
   if ((argc == 3 || argc == 4)
       && (sscanf (argv[1], "%d-%d-%d%c",
-                  &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
-          == 3)
+                 &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
+         == 3)
       && (sscanf (argv[2], "%d:%d:%d%c",
-                  &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
-          == 3))
+                 &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
+         == 3))
     {
       tm.tm_year -= TM_YEAR_BASE;
       tm.tm_mon--;
@@ -663,10 +667,10 @@ main (int argc, char **argv)
       tl = mktime (&tmk);
       lt = localtime (&tl);
       if (lt)
-        {
-          tml = *lt;
-          lt = &tml;
-        }
+       {
+         tml = *lt;
+         lt = &tml;
+       }
       printf ("mktime returns %ld == ", (long int) tl);
       print_tm (&tmk);
       printf ("\n");
@@ -679,51 +683,51 @@ main (int argc, char **argv)
       time_t to = atol (argv[3]);
 
       if (argc == 4)
-        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-          {
-            lt = localtime (&tl);
-            if (lt)
-              {
-                tmk = tml = *lt;
-                tk = mktime (&tmk);
-                status |= check_result (tk, tmk, tl, &tml);
-              }
-            else
-              {
-                printf ("localtime (%ld) yields 0\n", (long int) tl);
-                status = 1;
-              }
-            tl1 = tl + by;
-            if ((tl1 < tl) != (by < 0))
-              break;
-          }
+       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+         {
+           lt = localtime (&tl);
+           if (lt)
+             {
+               tmk = tml = *lt;
+               tk = mktime (&tmk);
+               status |= check_result (tk, tmk, tl, &tml);
+             }
+           else
+             {
+               printf ("localtime (%ld) yields 0\n", (long int) tl);
+               status = 1;
+             }
+           tl1 = tl + by;
+           if ((tl1 < tl) != (by < 0))
+             break;
+         }
       else
-        for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-          {
-            /* Null benchmark.  */
-            lt = localtime (&tl);
-            if (lt)
-              {
-                tmk = tml = *lt;
-                tk = tl;
-                status |= check_result (tk, tmk, tl, &tml);
-              }
-            else
-              {
-                printf ("localtime (%ld) yields 0\n", (long int) tl);
-                status = 1;
-              }
-            tl1 = tl + by;
-            if ((tl1 < tl) != (by < 0))
-              break;
-          }
+       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
+         {
+           /* Null benchmark.  */
+           lt = localtime (&tl);
+           if (lt)
+             {
+               tmk = tml = *lt;
+               tk = tl;
+               status |= check_result (tk, tmk, tl, &tml);
+             }
+           else
+             {
+               printf ("localtime (%ld) yields 0\n", (long int) tl);
+               status = 1;
+             }
+           tl1 = tl + by;
+           if ((tl1 < tl) != (by < 0))
+             break;
+         }
     }
   else
     printf ("Usage:\
 \t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
 \t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
 \t%s FROM BY TO - # Do not test those values (for benchmark).\n",
-            argv[0], argv[0], argv[0]);
+           argv[0], argv[0], argv[0]);
 
   return status;
 }
index c47618a1b6aa5b20fd02e3adbbb3d6ebbc7b6a81..03db7cb519b44c97a905e68b4cc42de620cd512e 100644 (file)
@@ -1,5 +1,5 @@
 /* Define PATH_MAX somehow.  Requires sys/types.h.
-   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2011 Free Software
+   Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _PATHMAX_H
 # define _PATHMAX_H
diff --git a/lib/pselect.c b/lib/pselect.c
new file mode 100644 (file)
index 0000000..d8ebc70
--- /dev/null
@@ -0,0 +1,76 @@
+/* pselect - synchronous I/O multiplexing
+
+   Copyright 2011-2012 Free Software Foundation, Inc.
+
+   This file is part of gnulib.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Paul Eggert */
+
+#include <config.h>
+
+#include <sys/select.h>
+
+#include <errno.h>
+#include <signal.h>
+
+/* Examine the size-NFDS file descriptor sets in RFDS, WFDS, and XFDS
+   to see whether some of their descriptors are ready for reading,
+   ready for writing, or have exceptions pending.  Wait for at most
+   TIMEOUT seconds, and use signal mask SIGMASK while waiting.  A null
+   pointer parameter stands for no descriptors, an infinite timeout,
+   or an unaffected signal mask.  */
+
+int
+pselect (int nfds, fd_set *restrict rfds,
+         fd_set *restrict wfds, fd_set *restrict xfds,
+         struct timespec const *restrict timeout,
+         sigset_t const *restrict sigmask)
+{
+  int select_result;
+  sigset_t origmask;
+  struct timeval tv, *tvp;
+
+  if (timeout)
+    {
+      if (! (0 <= timeout->tv_nsec && timeout->tv_nsec < 1000000000))
+        {
+          errno = EINVAL;
+          return -1;
+        }
+
+      tv.tv_sec = timeout->tv_sec;
+      tv.tv_usec = (timeout->tv_nsec + 999) / 1000;
+      tvp = &tv;
+    }
+  else
+    tvp = NULL;
+
+  /* Signal mask munging should be atomic, but this is the best we can
+     do in this emulation.  */
+  if (sigmask)
+    pthread_sigmask (SIG_SETMASK, sigmask, &origmask);
+
+  select_result = select (nfds, rfds, wfds, xfds, tvp);
+
+  if (sigmask)
+    {
+      int select_errno = errno;
+      pthread_sigmask (SIG_SETMASK, &origmask, NULL);
+      errno = select_errno;
+    }
+
+  return select_result;
+}
index 11d549cad41bf9e6f9142af5971484066206db14..80ab24bf0b13d68856a5e7584a0dac28f7f6dbb4 100644 (file)
@@ -1,5 +1,5 @@
 /* POSIX compatible signal blocking for threads.
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include <errno.h>
 #include <stddef.h>
 
+#if PTHREAD_SIGMASK_INEFFECTIVE
+# include <string.h>
+#endif
+
 #if PTHREAD_SIGMASK_UNBLOCK_BUG
 # include <unistd.h>
 #endif
@@ -31,7 +35,22 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
 #undef pthread_sigmask
 {
 #if HAVE_PTHREAD_SIGMASK
-  int ret = pthread_sigmask (how, new_mask, old_mask);
+  int ret;
+
+# if PTHREAD_SIGMASK_INEFFECTIVE
+  sigset_t omask, omask_copy;
+  sigset_t *old_mask_ptr = &omask;
+  sigemptyset (&omask);
+  /* Add a signal unlikely to be blocked, so that OMASK_COPY
+     is unlikely to match the actual mask.  */
+  sigaddset (&omask, SIGILL);
+  memcpy (&omask_copy, &omask, sizeof omask);
+# else
+  sigset_t *old_mask_ptr = old_mask;
+# endif
+
+  ret = pthread_sigmask (how, new_mask, old_mask_ptr);
+
 # if PTHREAD_SIGMASK_INEFFECTIVE
   if (ret == 0)
     {
@@ -39,12 +58,16 @@ pthread_sigmask (int how, const sigset_t *new_mask, sigset_t *old_mask)
          Don't cache the information: libpthread.so could be dynamically
          loaded after the program started and after pthread_sigmask was
          called for the first time.  */
-      if (pthread_sigmask (1729, NULL, NULL) == 0)
+      if (memcmp (&omask_copy, &omask, sizeof omask) == 0
+          && pthread_sigmask (1729, &omask_copy, NULL) == 0)
         {
           /* pthread_sigmask is currently ineffective.  The program is not
              linked to -lpthread.  So use sigprocmask instead.  */
           return (sigprocmask (how, new_mask, old_mask) < 0 ? errno : 0);
         }
+
+      if (old_mask)
+        memcpy (old_mask, &omask, sizeof omask);
     }
 # endif
 # if PTHREAD_SIGMASK_FAILS_WITH_ERRNO
index 35d045b9a1205d2bc4bc672cb7b77ff60a14f4d9..baac1322442a244a03bb79233591acefe2773cbc 100644 (file)
@@ -1,5 +1,5 @@
 /* Stub for readlink().
-   Copyright (C) 2003-2007, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index f832d050574b3345ff976d981b095252fab427bb..0d82af14bc951b212fe02f83cfe52ee81792bfa4 100644 (file)
@@ -1,7 +1,7 @@
 /* sha1.c - Functions to compute SHA1 message digest of files or
    memory blocks according to the NIST specification FIPS-180-1.
 
-   Copyright (C) 2000-2001, 2003-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003-2006, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -14,8 +14,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Scott G. Miller
    Credits:
@@ -26,7 +25,8 @@
 
 #include "sha1.h"
 
-#include <stddef.h>
+#include <stdalign.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -241,8 +241,7 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
   if (len >= 64)
     {
 #if !_STRING_ARCH_unaligned
-# define alignof(type) offsetof (struct { char c; type x; }, x)
-# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
       if (UNALIGNED_P (buffer))
         while (len > 64)
           {
@@ -306,13 +305,13 @@ sha1_process_block (const void *buffer, size_t len, struct sha1_ctx *ctx)
   uint32_t c = ctx->C;
   uint32_t d = ctx->D;
   uint32_t e = ctx->E;
+  uint32_t lolen = len;
 
   /* First increment the byte count.  RFC 1321 specifies the possible
      length of the file up to 2^64 bits.  Here we only compute the
      number of bytes.  Do a double word increment.  */
-  ctx->total[0] += len;
-  if (ctx->total[0] < len)
-    ++ctx->total[1];
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
 
 #define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n))))
 
index 47b56f2adfba984c4721a1f6e1d93f2658bcefff..0d9ced0298df653ccbd7a190402b89b3ddb01d86 100644 (file)
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA1 sum
    library functions.
-   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2011 Free Software
+   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2012 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -14,8 +14,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef SHA1_H
 # define SHA1_H 1
index 4dbb5e91291840e1e3e65be95cdd147031ba9708..a8d29da18ddfe6536f1444ce8d9ffb2ccfb94cb5 100644 (file)
@@ -1,7 +1,7 @@
 /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
    memory blocks according to the NIST specification FIPS-180-2.
 
-   Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@
 
 #include "sha256.h"
 
-#include <stddef.h>
+#include <stdalign.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -373,8 +374,7 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
   if (len >= 64)
     {
 #if !_STRING_ARCH_unaligned
-# define alignof(type) offsetof (struct { char c; type x; }, x)
-# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (uint32_t) != 0)
       if (UNALIGNED_P (buffer))
         while (len > 64)
           {
@@ -454,13 +454,13 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx)
   uint32_t f = ctx->state[5];
   uint32_t g = ctx->state[6];
   uint32_t h = ctx->state[7];
+  uint32_t lolen = len;
 
   /* First increment the byte count.  FIPS PUB 180-2 specifies the possible
      length of the file up to 2^64 bits.  Here we only compute the
      number of bytes.  Do a double word increment.  */
-  ctx->total[0] += len;
-  if (ctx->total[0] < len)
-    ++ctx->total[1];
+  ctx->total[0] += lolen;
+  ctx->total[1] += (len >> 31 >> 1) + (ctx->total[0] < lolen);
 
 #define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
 #define S0(x) (rol(x,25)^rol(x,14)^(x>>3))
index 9f6bf14bf0c7f806f89edd969194bd148611039c..d69b83fc9fcd0105a550fa8d806d5a03e7be9909 100644 (file)
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA256 and SHA224 sum
    library functions.
-   Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 5c2e3ab9f811f6bcc76265cb22ae08908fcb5c62..cf62f2034e519e58d7d0fd462c370237b4c9ff86 100644 (file)
@@ -1,7 +1,7 @@
 /* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
    memory blocks according to the NIST specification FIPS-180-2.
 
-   Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -24,7 +24,8 @@
 
 #include "sha512.h"
 
-#include <stddef.h>
+#include <stdalign.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
@@ -381,8 +382,7 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx)
   if (len >= 128)
     {
 #if !_STRING_ARCH_unaligned
-# define alignof(type) offsetof (struct { char c; type x; }, x)
-# define UNALIGNED_P(p) (((size_t) p) % alignof (u64) != 0)
+# define UNALIGNED_P(p) ((uintptr_t) (p) % alignof (u64) != 0)
       if (UNALIGNED_P (buffer))
         while (len > 128)
           {
@@ -485,13 +485,15 @@ sha512_process_block (const void *buffer, size_t len, struct sha512_ctx *ctx)
   u64 f = ctx->state[5];
   u64 g = ctx->state[6];
   u64 h = ctx->state[7];
+  u64 lolen = u64size (len);
 
   /* First increment the byte count.  FIPS PUB 180-2 specifies the possible
      length of the file up to 2^128 bits.  Here we only compute the
      number of bytes.  Do a double word increment.  */
-  ctx->total[0] = u64plus (ctx->total[0], u64lo (len));
-  if (u64lt (ctx->total[0], u64lo (len)))
-    ctx->total[1] = u64plus (ctx->total[1], u64lo (1));
+  ctx->total[0] = u64plus (ctx->total[0], lolen);
+  ctx->total[1] = u64plus (ctx->total[1],
+                           u64plus (u64size (len >> 31 >> 31 >> 2),
+                                    u64lo (u64lt (ctx->total[0], lolen))));
 
 #define S0(x) u64xor (u64rol(x, 63), u64xor (u64rol (x, 56), u64shr (x, 7)))
 #define S1(x) u64xor (u64rol (x, 45), u64xor (u64rol (x, 3), u64shr (x, 6)))
index af8b354ebd0e2eaacb2368e9207a257b3fa953b8..ddf91d6c726cb78caedd8ced5b04e1e61791cd2c 100644 (file)
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA512 and SHA384 sum
    library functions.
-   Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index e18e0b29832c089648fb9d140b3f582ebd787dcf..8fb1ad119ad5f9ca887d5b46e37fa9d95fc7c708 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <signal.h>.
 
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@
 #ifndef _@GUARD_PREFIX@_SIGNAL_H
 #define _@GUARD_PREFIX@_SIGNAL_H
 
-/* MacOS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
+/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6 declare
    pthread_sigmask in <pthread.h>, not in <signal.h>.
    But avoid namespace pollution on glibc systems.*/
 #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \
@@ -197,7 +197,7 @@ typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1];
 
 /* Test whether a given signal is contained in a signal set.  */
 # if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X.  */
+/* This function is defined as a macro on Mac OS X.  */
 #  if defined __cplusplus && defined GNULIB_NAMESPACE
 #   undef sigismember
 #  endif
@@ -210,7 +210,7 @@ _GL_CXXALIASWARN (sigismember);
 
 /* Initialize a signal set to the empty set.  */
 # if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X.  */
+/* This function is defined as a macro on Mac OS X.  */
 #  if defined __cplusplus && defined GNULIB_NAMESPACE
 #   undef sigemptyset
 #  endif
@@ -222,7 +222,7 @@ _GL_CXXALIASWARN (sigemptyset);
 
 /* Add a signal to a signal set.  */
 # if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X.  */
+/* This function is defined as a macro on Mac OS X.  */
 #  if defined __cplusplus && defined GNULIB_NAMESPACE
 #   undef sigaddset
 #  endif
@@ -235,7 +235,7 @@ _GL_CXXALIASWARN (sigaddset);
 
 /* Remove a signal from a signal set.  */
 # if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X.  */
+/* This function is defined as a macro on Mac OS X.  */
 #  if defined __cplusplus && defined GNULIB_NAMESPACE
 #   undef sigdelset
 #  endif
@@ -248,7 +248,7 @@ _GL_CXXALIASWARN (sigdelset);
 
 /* Fill a signal set with all possible signals.  */
 # if @HAVE_POSIX_SIGNALBLOCKING@
-/* This function is defined as a macro on MacOS X.  */
+/* This function is defined as a macro on Mac OS X.  */
 #  if defined __cplusplus && defined GNULIB_NAMESPACE
 #   undef sigfillset
 #  endif
index e75c7576cdf6dc849e2ecf223edb71062fcaee4e..be53d54001246fd62cddfd47a167db27eda7bd7a 100644 (file)
@@ -1,5 +1,5 @@
 /* POSIX compatible signal blocking.
-   Copyright (C) 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2006.
 
    This program is free software: you can redistribute it and/or modify
@@ -32,7 +32,7 @@
    also does not have the POSIX sigaction() function, only the
    signal() function.  We also assume signal() has SysV semantics,
    where any handler is uninstalled prior to being invoked.  This is
-   true for Woe32 platforms.  */
+   true for native Windows platforms.  */
 
 /* We use raw signal(), but also provide a wrapper rpl_signal() so
    that applications can query or change a blocked signal.  */
@@ -344,5 +344,6 @@ _gl_raise_SIGPIPE (void)
       else if (handler != SIG_IGN)
         (*handler) (SIGPIPE);
     }
+  return 0;
 }
 #endif
diff --git a/lib/stat-time.h b/lib/stat-time.h
new file mode 100644 (file)
index 0000000..30c2acd
--- /dev/null
@@ -0,0 +1,189 @@
+/* stat-related time functions.
+
+   Copyright (C) 2005, 2007, 2009-2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef STAT_TIME_H
+#define STAT_TIME_H 1
+
+#include <sys/stat.h>
+#include <time.h>
+
+/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type
+   struct timespec, if available.  If not, then STAT_TIMESPEC_NS (ST,
+   ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST,
+   if available.  ST_XTIM can be st_atim, st_ctim, st_mtim, or st_birthtim
+   for access, status change, data modification, or birth (creation)
+   time respectively.
+
+   These macros are private to stat-time.h.  */
+#if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+# ifdef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC
+#  define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim)
+# else
+#  define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec)
+# endif
+#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
+# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec)
+#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC
+# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec)
+#elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC
+# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec)
+#endif
+
+/* Return the nanosecond component of *ST's access time.  */
+static inline long int
+get_stat_atime_ns (struct stat const *st)
+{
+# if defined STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_atim).tv_nsec;
+# elif defined STAT_TIMESPEC_NS
+  return STAT_TIMESPEC_NS (st, st_atim);
+# else
+  return 0;
+# endif
+}
+
+/* Return the nanosecond component of *ST's status change time.  */
+static inline long int
+get_stat_ctime_ns (struct stat const *st)
+{
+# if defined STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_ctim).tv_nsec;
+# elif defined STAT_TIMESPEC_NS
+  return STAT_TIMESPEC_NS (st, st_ctim);
+# else
+  return 0;
+# endif
+}
+
+/* Return the nanosecond component of *ST's data modification time.  */
+static inline long int
+get_stat_mtime_ns (struct stat const *st)
+{
+# if defined STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_mtim).tv_nsec;
+# elif defined STAT_TIMESPEC_NS
+  return STAT_TIMESPEC_NS (st, st_mtim);
+# else
+  return 0;
+# endif
+}
+
+/* Return the nanosecond component of *ST's birth time.  */
+static inline long int
+get_stat_birthtime_ns (struct stat const *st)
+{
+# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
+  return STAT_TIMESPEC (st, st_birthtim).tv_nsec;
+# elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
+  return STAT_TIMESPEC_NS (st, st_birthtim);
+# else
+  /* Avoid a "parameter unused" warning.  */
+  (void) st;
+  return 0;
+# endif
+}
+
+/* Return *ST's access time.  */
+static inline struct timespec
+get_stat_atime (struct stat const *st)
+{
+#ifdef STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_atim);
+#else
+  struct timespec t;
+  t.tv_sec = st->st_atime;
+  t.tv_nsec = get_stat_atime_ns (st);
+  return t;
+#endif
+}
+
+/* Return *ST's status change time.  */
+static inline struct timespec
+get_stat_ctime (struct stat const *st)
+{
+#ifdef STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_ctim);
+#else
+  struct timespec t;
+  t.tv_sec = st->st_ctime;
+  t.tv_nsec = get_stat_ctime_ns (st);
+  return t;
+#endif
+}
+
+/* Return *ST's data modification time.  */
+static inline struct timespec
+get_stat_mtime (struct stat const *st)
+{
+#ifdef STAT_TIMESPEC
+  return STAT_TIMESPEC (st, st_mtim);
+#else
+  struct timespec t;
+  t.tv_sec = st->st_mtime;
+  t.tv_nsec = get_stat_mtime_ns (st);
+  return t;
+#endif
+}
+
+/* Return *ST's birth time, if available; otherwise return a value
+   with tv_sec and tv_nsec both equal to -1.  */
+static inline struct timespec
+get_stat_birthtime (struct stat const *st)
+{
+  struct timespec t;
+
+#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \
+     || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC)
+  t = STAT_TIMESPEC (st, st_birthtim);
+#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
+  t.tv_sec = st->st_birthtime;
+  t.tv_nsec = st->st_birthtimensec;
+#elif (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+  /* Native Windows platforms (but not Cygwin) put the "file creation
+     time" in st_ctime (!).  See
+     <http://msdn2.microsoft.com/de-de/library/14h5k7ff(VS.80).aspx>.  */
+  t.tv_sec = st->st_ctime;
+  t.tv_nsec = 0;
+#else
+  /* Birth time is not supported.  */
+  t.tv_sec = -1;
+  t.tv_nsec = -1;
+  /* Avoid a "parameter unused" warning.  */
+  (void) st;
+#endif
+
+#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \
+     || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC \
+     || defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC)
+  /* FreeBSD and NetBSD sometimes signal the absence of knowledge by
+     using zero.  Attempt to work around this problem.  Alas, this can
+     report failure even for valid time stamps.  Also, NetBSD
+     sometimes returns junk in the birth time fields; work around this
+     bug if it is detected.  */
+  if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000))
+    {
+      t.tv_sec = -1;
+      t.tv_nsec = -1;
+    }
+#endif
+
+  return t;
+}
+
+#endif
index 1397aa93290a0210734366edbae83b3a1ca41d22..75995408906a72167b658a6885171a2bba8492c1 100644 (file)
@@ -1,5 +1,5 @@
 /* Work around platform bugs in stat.
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include <sys/stat.h>
 #undef __need_system_sys_stat_h
 
+#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+# if _GL_WINDOWS_64_BIT_ST_SIZE
+#  undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
+#  define stat _stati64
+#  define REPLACE_FUNC_STAT_DIR 1
+#  undef REPLACE_FUNC_STAT_FILE
+# elif REPLACE_FUNC_STAT_FILE
+/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
+   Bypass it.  */
+#  define stat _stat
+#  define REPLACE_FUNC_STAT_DIR 1
+#  undef REPLACE_FUNC_STAT_FILE
+# endif
+#endif
+
 static inline int
 orig_stat (const char *filename, struct stat *buf)
 {
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
new file mode 100644 (file)
index 0000000..8fba694
--- /dev/null
@@ -0,0 +1,90 @@
+/* A substitute for ISO C11 <stdalign.h>.
+
+   Copyright 2011-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert and Bruno Haible.  */
+
+#ifndef _GL_STDALIGN_H
+#define _GL_STDALIGN_H
+
+/* ISO C11 <stdalign.h> for platforms that lack it.
+
+   References:
+   ISO C11 (latest free draft
+   <http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf>)
+   sections 6.5.3.4, 6.7.5, 7.15.
+   C++11 (latest free draft
+   <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf>)
+   section 18.10. */
+
+/* alignof (TYPE), also known as _Alignof (TYPE), yields the alignment
+   requirement of a structure member (i.e., slot or field) that is of
+   type TYPE, as an integer constant expression.
+
+   This differs from GCC's __alignof__ operator, which can yield a
+   better-performing alignment for an object of that type.  For
+   example, on x86 with GCC, __alignof__ (double) and __alignof__
+   (long long) are 8, whereas alignof (double) and alignof (long long)
+   are 4 unless the option '-malign-double' is used.
+
+   The result cannot be used as a value for an 'enum' constant, if you
+   want to be portable to HP-UX 10.20 cc and AIX 3.2.5 xlc.  */
+#include <stddef.h>
+#if defined __cplusplus
+   template <class __t> struct __alignof_helper { char __a; __t __b; };
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+#else
+# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+#endif
+#define alignof _Alignof
+#define __alignof_is_defined 1
+
+/* alignas (A), also known as _Alignas (A), aligns a variable or type
+   to the alignment A, where A is an integer constant expression.  For
+   example:
+
+      int alignas (8) foo;
+      struct s { int a; int alignas (8) bar; };
+
+   aligns the address of FOO and the offset of BAR to be multiples of 8.
+
+   A should be a power of two that is at least the type's alignment
+   and at most the implementation's alignment limit.  This limit is
+   2**28 on typical GNUish hosts, and 2**13 on MSVC.  To be portable
+   to MSVC through at least version 10.0, A should be an integer
+   constant, as MSVC does not support expressions such as 1 << 3.
+   To be portable to Sun C 5.11, do not align auto variables to
+   anything stricter than their default alignment.
+
+   The following C11 requirements are not supported here:
+
+     - If A is zero, alignas has no effect.
+     - alignas can be used multiple times; the strictest one wins.
+     - alignas (TYPE) is equivalent to alignas (alignof (TYPE)).
+
+   */
+
+#if __GNUC__ || __IBMC__ || __IBMCPP__ || 0x5110 <= __SUNPRO_C
+# define _Alignas(a) __attribute__ ((__aligned__ (a)))
+#elif 1300 <= _MSC_VER
+# define _Alignas(a) __declspec (align (a))
+#endif
+#ifdef _Alignas
+# define alignas _Alignas
+# define __alignas_is_defined 1
+#endif
+
+#endif /* _GL_STDALIGN_H */
index 43f960707086538ecb866521b25d4ff84dc11479..53104a61923410218637faa61155531f39932d8b 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <stdarg.h>.
-   Copyright (C) 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _@GUARD_PREFIX@_STDARG_H
 
index b64dc75b20cc57836e4fdc8e6e2cd5f6e316c5f9..ed1f9aa488b1329a039aad50df316dc24d3a5653 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2003, 2006-2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2003, 2006-2012 Free Software Foundation, Inc.
    Written by Bruno Haible <haible@clisp.cons.org>, 2001.
 
    This program is free software; you can redistribute it and/or modify
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef _GL_STDBOOL_H
 #define _GL_STDBOOL_H
index c7b98e7dcc58dbda738a321d02bc879c3d848efc..17fcaea2bfe6df6afb1e8f8561e55a709c082682 100644 (file)
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake.  */
 
index b6d08c754ae62d5dfe28e549b998cfe486a56996..e2a0eb19ac098c55d297ff58a98d8bb77626401b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2012 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /*
  * ISO C 99 <stdint.h> for platforms that lack it.
    <inttypes.h>.  */
 #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H
 
+/* On Android (Bionic libc), <sys/types.h> includes this file before
+   having defined 'time_t'.  Therefore in this case avoid including
+   other system header files; just include the system's <stdint.h>.
+   Ideally we should test __BIONIC__ here, but it is only defined after
+   <sys/cdefs.h> has been included; hence test __ANDROID__ instead.  */
+#if defined __ANDROID__ \
+    && defined _SYS_TYPES_H_ && !defined _SSIZE_T_DEFINED_
+# @INCLUDE_NEXT@ @NEXT_STDINT_H@
+#else
+
 /* Get those types that are already defined in other system include
    files, so that we can "#define int8_t signed char" below without
    worrying about a later system include file containing a "typedef
       diagnostics.  */
 #  define __STDINT_H__
 # endif
+
+  /* Some pre-C++11 <stdint.h> implementations need this.  */
+# ifdef __cplusplus
+#  ifndef __STDC_CONSTANT_MACROS
+#   define __STDC_CONSTANT_MACROS 1
+#  endif
+#  ifndef __STDC_LIMIT_MACROS
+#   define __STDC_LIMIT_MACROS 1
+#  endif
+# endif
+
   /* Other systems may have an incomplete or buggy <stdint.h>.
      Include it before <inttypes.h>, since any "#include <stdint.h>"
      in <inttypes.h> would reinclude us, skipping our contents because
 /* <sys/types.h> defines some of the stdint.h types as well, on glibc,
    IRIX 6.5, and OpenBSD 3.8 (via <machine/types.h>).
    AIX 5.2 <sys/types.h> isn't needed and causes troubles.
-   MacOS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
+   Mac OS X 10.4.6 <sys/types.h> includes <stdint.h> (which is us), but
    relies on the system <stdint.h> definitions, so include
    <sys/types.h> after @NEXT_STDINT_H@.  */
 #if @HAVE_SYS_TYPES_H@ && ! defined _AIX
 # include <sys/types.h>
 #endif
 
-/* Get LONG_MIN, LONG_MAX, ULONG_MAX.  */
+/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX,
+   LONG_MIN, LONG_MAX, ULONG_MAX.  */
 #include <limits.h>
 
 #if @HAVE_INTTYPES_H@
@@ -226,8 +247,9 @@ typedef unsigned long long int gl_uint64_t;
 
 /* Here we assume a standard architecture where the hardware integer
    types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types
-   are taken from the same list of types.  Assume that 'long int'
-   is fast enough for all narrower integers.  */
+   are taken from the same list of types.  The following code normally
+   uses types consistent with glibc, as that lessens the chance of
+   incompatibility with older GNU hosts.  */
 
 #undef int_fast8_t
 #undef uint_fast8_t
@@ -237,12 +259,21 @@ typedef unsigned long long int gl_uint64_t;
 #undef uint_fast32_t
 #undef int_fast64_t
 #undef uint_fast64_t
-typedef long int gl_int_fast8_t;
-typedef unsigned long int gl_uint_fast8_t;
-typedef long int gl_int_fast16_t;
-typedef unsigned long int gl_uint_fast16_t;
+typedef signed char gl_int_fast8_t;
+typedef unsigned char gl_uint_fast8_t;
+
+#ifdef __sun
+/* Define types compatible with SunOS 5.10, so that code compiled under
+   earlier SunOS versions works with code compiled under SunOS 5.10.  */
+typedef int gl_int_fast32_t;
+typedef unsigned int gl_uint_fast32_t;
+#else
 typedef long int gl_int_fast32_t;
 typedef unsigned long int gl_uint_fast32_t;
+#endif
+typedef gl_int_fast32_t gl_int_fast16_t;
+typedef gl_uint_fast32_t gl_uint_fast16_t;
+
 #define int_fast8_t gl_int_fast8_t
 #define uint_fast8_t gl_uint_fast8_t
 #define int_fast16_t gl_int_fast16_t
@@ -313,8 +344,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 
 /* 7.18.2. Limits of specified-width integer types */
 
-#if ! defined __cplusplus || defined __STDC_LIMIT_MACROS
-
 /* 7.18.2.1. Limits of exact-width integer types */
 
 /* Here we assume a standard architecture where the hardware integer
@@ -400,23 +429,29 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 #undef INT_FAST8_MIN
 #undef INT_FAST8_MAX
 #undef UINT_FAST8_MAX
-#define INT_FAST8_MIN  LONG_MIN
-#define INT_FAST8_MAX  LONG_MAX
-#define UINT_FAST8_MAX  ULONG_MAX
+#define INT_FAST8_MIN  SCHAR_MIN
+#define INT_FAST8_MAX  SCHAR_MAX
+#define UINT_FAST8_MAX  UCHAR_MAX
 
 #undef INT_FAST16_MIN
 #undef INT_FAST16_MAX
 #undef UINT_FAST16_MAX
-#define INT_FAST16_MIN  LONG_MIN
-#define INT_FAST16_MAX  LONG_MAX
-#define UINT_FAST16_MAX  ULONG_MAX
+#define INT_FAST16_MIN  INT_FAST32_MIN
+#define INT_FAST16_MAX  INT_FAST32_MAX
+#define UINT_FAST16_MAX  UINT_FAST32_MAX
 
 #undef INT_FAST32_MIN
 #undef INT_FAST32_MAX
 #undef UINT_FAST32_MAX
-#define INT_FAST32_MIN  LONG_MIN
-#define INT_FAST32_MAX  LONG_MAX
-#define UINT_FAST32_MAX  ULONG_MAX
+#ifdef __sun
+# define INT_FAST32_MIN  INT_MIN
+# define INT_FAST32_MAX  INT_MAX
+# define UINT_FAST32_MAX  UINT_MAX
+#else
+# define INT_FAST32_MIN  LONG_MIN
+# define INT_FAST32_MAX  LONG_MAX
+# define UINT_FAST32_MAX  ULONG_MAX
+#endif
 
 #undef INT_FAST64_MIN
 #undef INT_FAST64_MAX
@@ -534,12 +569,8 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 #define WINT_MAX  \
    _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@)
 
-#endif /* !defined __cplusplus || defined __STDC_LIMIT_MACROS */
-
 /* 7.18.4. Macros for integer constants */
 
-#if ! defined __cplusplus || defined __STDC_CONSTANT_MACROS
-
 /* 7.18.4.1. Macros for minimum-width integer constants */
 /* According to ISO C 99 Technical Corrigendum 1 */
 
@@ -600,7 +631,6 @@ typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t)
 # endif
 #endif
 
-#endif /* !defined __cplusplus || defined __STDC_CONSTANT_MACROS */
-
 #endif /* _@GUARD_PREFIX@_STDINT_H */
+#endif /* !(defined __ANDROID__ && ...) */
 #endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */
index ce00af574a8a4120d8ef7ceaa3dcc89c529ec8f3..b1b543dee727416cc57cdc7aab77d0226968b20f 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
@@ -53,7 +52,8 @@
 #include <stddef.h>
 
 /* Get off_t and ssize_t.  Needed on many systems, including glibc 2.8
-   and eglibc 2.11.2.  */
+   and eglibc 2.11.2.
+   May also define off_t to a 64-bit type on native Windows.  */
 #include <sys/types.h>
 
 /* The __attribute__ feature is available in gcc versions 2.5 and later.
@@ -186,7 +186,7 @@ _GL_CXXALIASWARN (fdopen);
 #elif defined GNULIB_POSIXCHECK
 # undef fdopen
 /* Assume fdopen is always declared.  */
-_GL_WARN_ON_USE (fdopen, "fdopen on Win32 platforms is not POSIX compatible - "
+_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - "
                  "use gnulib module fdopen for portability");
 #endif
 
@@ -259,7 +259,7 @@ _GL_CXXALIASWARN (fopen);
 #elif defined GNULIB_POSIXCHECK
 # undef fopen
 /* Assume fopen is always declared.  */
-_GL_WARN_ON_USE (fopen, "fopen on Win32 platforms is not POSIX compatible - "
+_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - "
                  "use gnulib module fopen for portability");
 #endif
 
@@ -387,7 +387,7 @@ _GL_CXXALIASWARN (freopen);
 # undef freopen
 /* Assume freopen is always declared.  */
 _GL_WARN_ON_USE (freopen,
-                 "freopen on Win32 platforms is not POSIX compatible - "
+                 "freopen on native Windows platforms is not POSIX compliant - "
                  "use gnulib module freopen for portability");
 #endif
 
@@ -699,22 +699,11 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
 # endif
 #endif
 
-#if @GNULIB_GETS@
-# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@
-#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
-#   undef gets
-#   define gets rpl_gets
-#  endif
-_GL_FUNCDECL_RPL (gets, char *, (char *s) _GL_ARG_NONNULL ((1)));
-_GL_CXXALIAS_RPL (gets, char *, (char *s));
-# else
-_GL_CXXALIAS_SYS (gets, char *, (char *s));
-#  undef gets
-# endif
-_GL_CXXALIASWARN (gets);
 /* It is very rare that the developer ever has full control of stdin,
-   so any use of gets warrants an unconditional warning.  Assume it is
-   always declared, since it is required by C89.  */
+   so any use of gets warrants an unconditional warning; besides, C11
+   removed it.  */
+#undef gets
+#if HAVE_RAW_DECL_GETS
 _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
 #endif
 
@@ -779,7 +768,7 @@ _GL_CXXALIASWARN (pclose);
 #elif defined GNULIB_POSIXCHECK
 # undef pclose
 # if HAVE_RAW_DECL_PCLOSE
-_GL_WARN_ON_USE (pclose, "popen is unportable - "
+_GL_WARN_ON_USE (pclose, "pclose is unportable - "
                  "use gnulib module pclose for more portability");
 # endif
 #endif
@@ -1054,9 +1043,9 @@ _GL_WARN_ON_USE (snprintf, "snprintf is unportable - "
 # endif
 #endif
 
-/* Some people would argue that sprintf should be handled like gets
-   (for example, OpenBSD issues a link warning for both functions),
-   since both can cause security holes due to buffer overruns.
+/* Some people would argue that all sprintf uses should be warned about
+   (for example, OpenBSD issues a link warning for it),
+   since it can cause security holes due to buffer overruns.
    However, we believe that sprintf can be used safely, and is more
    efficient than snprintf in those safe cases; and as proof of our
    belief, we use sprintf in several gnulib modules.  So this header
index 047fac18b83bfdb3ab8887ba13391178192c64c2..1d67ec64c663517a86d3992ed6f29cc8d39881bd 100644 (file)
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2011 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 # include <sys/loadavg.h>
 #endif
 
+/* Native Windows platforms declare mktemp() in <io.h>.  */
+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
 #if @GNULIB_RANDOM_R@
 
 /* OSF/1 5.1 declares 'struct random_data' in <random.h>, which is included
@@ -58,7 +63,7 @@
 #  include <random.h>
 # endif
 
-# if !@HAVE_STRUCT_RANDOM_DATA@ || !@HAVE_RANDOM_R@
+# if !@HAVE_STRUCT_RANDOM_DATA@ || @REPLACE_RANDOM_R@ || !@HAVE_RANDOM_R@
 #  include <stdint.h>
 # endif
 
@@ -82,13 +87,21 @@ struct random_data
 #endif
 
 #if (@GNULIB_MKSTEMP@ || @GNULIB_MKSTEMPS@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK) && ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
-/* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
-/* On MacOS X 10.5, only <unistd.h> declares mkstemps.  */
+/* On Mac OS X 10.3, only <unistd.h> declares mkstemp.  */
+/* On Mac OS X 10.5, only <unistd.h> declares mkstemps.  */
 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
 /* But avoid namespace pollution on glibc systems and native Windows.  */
 # include <unistd.h>
 #endif
 
+/* The __attribute__ feature is available in gcc versions 2.5 and later.
+   The attribute __pure__ was added in gcc 2.96.  */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
+#else
+# define _GL_ATTRIBUTE_PURE /* empty */
+#endif
+
 /* The definition of _Noreturn is copied here.  */
 
 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
@@ -133,7 +146,9 @@ _GL_WARN_ON_USE (_Exit, "_Exit is unportable - "
 /* Parse a signed decimal integer.
    Returns the value of the integer.  Errors are not detected.  */
 # if !@HAVE_ATOLL@
-_GL_FUNCDECL_SYS (atoll, long long, (const char *string) _GL_ARG_NONNULL ((1)));
+_GL_FUNCDECL_SYS (atoll, long long, (const char *string)
+                                    _GL_ATTRIBUTE_PURE
+                                    _GL_ARG_NONNULL ((1)));
 # endif
 _GL_CXXALIAS_SYS (atoll, long long, (const char *string));
 _GL_CXXALIASWARN (atoll);
@@ -247,7 +262,7 @@ _GL_CXXALIASWARN (grantpt);
 #elif defined GNULIB_POSIXCHECK
 # undef grantpt
 # if HAVE_RAW_DECL_GRANTPT
-_GL_WARN_ON_USE (ptsname, "grantpt is not portable - "
+_GL_WARN_ON_USE (grantpt, "grantpt is not portable - "
                  "use gnulib module grantpt for portability");
 # endif
 #endif
@@ -423,6 +438,22 @@ _GL_WARN_ON_USE (mkstemps, "mkstemps is unportable - "
 # endif
 #endif
 
+#if @GNULIB_POSIX_OPENPT@
+/* Return an FD open to the master side of a pseudo-terminal.  Flags should
+   include O_RDWR, and may also include O_NOCTTY.  */
+# if !@HAVE_POSIX_OPENPT@
+_GL_FUNCDECL_SYS (posix_openpt, int, (int flags));
+# endif
+_GL_CXXALIAS_SYS (posix_openpt, int, (int flags));
+_GL_CXXALIASWARN (posix_openpt);
+#elif defined GNULIB_POSIXCHECK
+# undef posix_openpt
+# if HAVE_RAW_DECL_POSIX_OPENPT
+_GL_WARN_ON_USE (posix_openpt, "posix_openpt is not portable - "
+                 "use gnulib module posix_openpt for portability");
+# endif
+#endif
+
 #if @GNULIB_PTSNAME@
 /* Return the pathname of the pseudo-terminal slave associated with
    the master FD is open on, or NULL on errors.  */
@@ -439,6 +470,32 @@ _GL_WARN_ON_USE (ptsname, "ptsname is not portable - "
 # endif
 #endif
 
+#if @GNULIB_PTSNAME_R@
+/* Set the pathname of the pseudo-terminal slave associated with
+   the master FD is open on and return 0, or set errno and return
+   non-zero on errors.  */
+# if @REPLACE_PTSNAME_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ptsname_r
+#   define ptsname_r rpl_ptsname_r
+#  endif
+_GL_FUNCDECL_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+_GL_CXXALIAS_RPL (ptsname_r, int, (int fd, char *buf, size_t len));
+# else
+#  if !@HAVE_PTSNAME_R@
+_GL_FUNCDECL_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+#  endif
+_GL_CXXALIAS_SYS (ptsname_r, int, (int fd, char *buf, size_t len));
+# endif
+_GL_CXXALIASWARN (ptsname_r);
+#elif defined GNULIB_POSIXCHECK
+# undef ptsname_r
+# if HAVE_RAW_DECL_PTSNAME_R
+_GL_WARN_ON_USE (ptsname_r, "ptsname_r is not portable - "
+                 "use gnulib module ptsname_r for portability");
+# endif
+#endif
+
 #if @GNULIB_PUTENV@
 # if @REPLACE_PUTENV@
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
@@ -462,12 +519,83 @@ _GL_CXXALIASWARN (putenv);
 # endif
 #endif
 
+
+#if @GNULIB_RANDOM@
+# if !@HAVE_RANDOM@
+_GL_FUNCDECL_SYS (random, long, (void));
+# endif
+_GL_CXXALIAS_SYS (random, long, (void));
+_GL_CXXALIASWARN (random);
+#elif defined GNULIB_POSIXCHECK
+# undef random
+# if HAVE_RAW_DECL_RANDOM
+_GL_WARN_ON_USE (random, "random is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM@
+# if !@HAVE_RANDOM@
+_GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
+# endif
+_GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
+_GL_CXXALIASWARN (srandom);
+#elif defined GNULIB_POSIXCHECK
+# undef srandom
+# if HAVE_RAW_DECL_SRANDOM
+_GL_WARN_ON_USE (srandom, "srandom is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM@
+# if !@HAVE_RANDOM@
+_GL_FUNCDECL_SYS (initstate, char *,
+                  (unsigned int seed, char *buf, size_t buf_size)
+                  _GL_ARG_NONNULL ((2)));
+# endif
+_GL_CXXALIAS_SYS (initstate, char *,
+                  (unsigned int seed, char *buf, size_t buf_size));
+_GL_CXXALIASWARN (initstate);
+#elif defined GNULIB_POSIXCHECK
+# undef initstate
+# if HAVE_RAW_DECL_INITSTATE_R
+_GL_WARN_ON_USE (initstate, "initstate is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+#if @GNULIB_RANDOM@
+# if !@HAVE_RANDOM@
+_GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
+# endif
+_GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
+_GL_CXXALIASWARN (setstate);
+#elif defined GNULIB_POSIXCHECK
+# undef setstate
+# if HAVE_RAW_DECL_SETSTATE_R
+_GL_WARN_ON_USE (setstate, "setstate is unportable - "
+                 "use gnulib module random for portability");
+# endif
+#endif
+
+
 #if @GNULIB_RANDOM_R@
-# if !@HAVE_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef random_r
+#   define random_r rpl_random_r
+#  endif
+_GL_FUNCDECL_RPL (random_r, int, (struct random_data *buf, int32_t *result)
+                                 _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (random_r, int, (struct random_data *buf, int32_t *result));
+# else
+#  if !@HAVE_RANDOM_R@
 _GL_FUNCDECL_SYS (random_r, int, (struct random_data *buf, int32_t *result)
                                  _GL_ARG_NONNULL ((1, 2)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (random_r, int, (struct random_data *buf, int32_t *result));
+# endif
 _GL_CXXALIASWARN (random_r);
 #elif defined GNULIB_POSIXCHECK
 # undef random_r
@@ -478,13 +606,25 @@ _GL_WARN_ON_USE (random_r, "random_r is unportable - "
 #endif
 
 #if @GNULIB_RANDOM_R@
-# if !@HAVE_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef srandom_r
+#   define srandom_r rpl_srandom_r
+#  endif
+_GL_FUNCDECL_RPL (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (srandom_r, int,
+                  (unsigned int seed, struct random_data *rand_state));
+# else
+#  if !@HAVE_RANDOM_R@
 _GL_FUNCDECL_SYS (srandom_r, int,
                   (unsigned int seed, struct random_data *rand_state)
                   _GL_ARG_NONNULL ((2)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (srandom_r, int,
                   (unsigned int seed, struct random_data *rand_state));
+# endif
 _GL_CXXALIASWARN (srandom_r);
 #elif defined GNULIB_POSIXCHECK
 # undef srandom_r
@@ -495,15 +635,29 @@ _GL_WARN_ON_USE (srandom_r, "srandom_r is unportable - "
 #endif
 
 #if @GNULIB_RANDOM_R@
-# if !@HAVE_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef initstate_r
+#   define initstate_r rpl_initstate_r
+#  endif
+_GL_FUNCDECL_RPL (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((2, 4)));
+_GL_CXXALIAS_RPL (initstate_r, int,
+                  (unsigned int seed, char *buf, size_t buf_size,
+                   struct random_data *rand_state));
+# else
+#  if !@HAVE_RANDOM_R@
 _GL_FUNCDECL_SYS (initstate_r, int,
                   (unsigned int seed, char *buf, size_t buf_size,
                    struct random_data *rand_state)
                   _GL_ARG_NONNULL ((2, 4)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (initstate_r, int,
                   (unsigned int seed, char *buf, size_t buf_size,
                    struct random_data *rand_state));
+# endif
 _GL_CXXALIASWARN (initstate_r);
 #elif defined GNULIB_POSIXCHECK
 # undef initstate_r
@@ -514,13 +668,25 @@ _GL_WARN_ON_USE (initstate_r, "initstate_r is unportable - "
 #endif
 
 #if @GNULIB_RANDOM_R@
-# if !@HAVE_RANDOM_R@
+# if @REPLACE_RANDOM_R@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setstate_r
+#   define setstate_r rpl_setstate_r
+#  endif
+_GL_FUNCDECL_RPL (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state)
+                  _GL_ARG_NONNULL ((1, 2)));
+_GL_CXXALIAS_RPL (setstate_r, int,
+                  (char *arg_state, struct random_data *rand_state));
+# else
+#  if !@HAVE_RANDOM_R@
 _GL_FUNCDECL_SYS (setstate_r, int,
                   (char *arg_state, struct random_data *rand_state)
                   _GL_ARG_NONNULL ((1, 2)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (setstate_r, int,
                   (char *arg_state, struct random_data *rand_state));
+# endif
 _GL_CXXALIASWARN (setstate_r);
 #elif defined GNULIB_POSIXCHECK
 # undef setstate_r
index acebc9adfad65b9f968c96055b50d26ec38f89fc..c7b8eb5ef7e5619a5b735fee0650f240898e4c98 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C Library.
    Bugs can be reported to bug-glibc@prep.ai.mit.edu.
@@ -40,7 +40,7 @@
 extern char *tzname[];
 #endif
 
-/* Do multibyte processing if multibytes are supported, unless
+/* Do multibyte processing if multibyte encodings are supported, unless
    multibyte sequences are safe in formats.  Multibyte sequences are
    safe if they cannot contain byte sequences that look like format
    conversion specifications.  The multibyte encodings used by the
@@ -289,7 +289,7 @@ extern char *tzname[];
 #  define TOLOWER(Ch, L) tolower (Ch)
 # endif
 #endif
-/* We don't use `isdigit' here since the locale dependent
+/* We don't use 'isdigit' here since the locale dependent
    interpretation is not what we want here.  We only need to accept
    the arabic digits in the ASCII range.  One day there is perhaps a
    more reliable way to accept other sets of digits.  */
@@ -437,7 +437,7 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
 #ifdef _NL_CURRENT
   /* We cannot make the following values variables since we must delay
      the evaluation of these values until really needed since some
-     expressions might not be valid in every situation.  The `struct tm'
+     expressions might not be valid in every situation.  The 'struct tm'
      might be generated by a strptime() call that initialized
      only a few elements.  Dereference the pointers only if the format
      requires this.  Then it is ok to fail if the pointers are invalid.  */
@@ -896,7 +896,7 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
           goto do_number_body;
 
         do_number_spacepad:
-          /* Force `_' flag unless overridden by `0' or `-' flag.  */
+          /* Force '_' flag unless overridden by '0' or '-' flag.  */
           if (pad != L_('0') && pad != L_('-'))
             pad = L_('_');
 
index 3410568a9a45ab6349fcbe93029a8d4380ed42ff..d3b4cb28c52f0773bf31fe163ecf2cb845f6c0a2 100644 (file)
@@ -1,6 +1,6 @@
 /* declarations for strftime.c
 
-   Copyright (C) 2002, 2004, 2008-2011 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2008-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index 497d15585ced3f20912e9e1a579646f2027c012d..4f5fdbb5f22a44c6bce2376ba075c311227ab858 100644 (file)
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an intmax_t value.
 
-   Copyright (C) 1999, 2001-2004, 2006, 2009-2011 Free Software Foundation,
+   Copyright (C) 1999, 2001-2004, 2006, 2009-2012 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
index 6c15d11e8f8d4047698f40d394cb2827a81f3b0c..bf992a8c2720798be4a478d0be691bbd370b4367 100644 (file)
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an integer value.
 
-   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2011 Free Software
+   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2012 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
@@ -40,7 +40,7 @@
 # include "../locale/localeinfo.h"
 #endif
 
-/* Nonzero if we are defining `strtoul' or `strtoull', operating on
+/* Nonzero if we are defining 'strtoul' or 'strtoull', operating on
    unsigned integers.  */
 #ifndef UNSIGNED
 # define UNSIGNED 0
 # endif
 #endif
 
-/* If QUAD is defined, we are defining `strtoll' or `strtoull',
-   operating on `long long int's.  */
+/* If QUAD is defined, we are defining 'strtoll' or 'strtoull',
+   operating on 'long long int's.  */
 #ifdef QUAD
 # define LONG long long
 # define STRTOL_LONG_MIN LLONG_MIN
 
 
 
-/* Convert NPTR to an `unsigned long int' or `long int' in base BASE.
+/* Convert NPTR to an 'unsigned long int' or 'long int' in base BASE.
    If BASE is 0 the base is determined by the presence of a leading
    zero, indicating octal or a leading "0x" or "0X", indicating hexadecimal.
    If BASE is < 2 or > 36, it is reset to 10.
@@ -380,7 +380,7 @@ INTERNAL (strtol) (const STRING_TYPE *nptr, STRING_TYPE **endptr,
 
 #if !UNSIGNED
   /* Check for a value that is within the range of
-     `unsigned LONG int', but outside the range of `LONG int'.  */
+     'unsigned LONG int', but outside the range of 'LONG int'.  */
   if (overflow == 0
       && i > (negative
               ? -((unsigned LONG int) (STRTOL_LONG_MIN + 1)) + 1
@@ -405,7 +405,7 @@ noconv:
   /* We must handle a special case here: the base is 0 or 16 and the
      first two characters are '0' and 'x', but the rest are no
      hexadecimal digits.  This is no error case.  We return 0 and
-     ENDPTR points to the `x`.  */
+     ENDPTR points to the 'x'.  */
   if (endptr != NULL)
     {
       if (save - nptr >= 2 && TOUPPER (save[-1]) == L_('X')
index 75afa4d9bc9550181a64aee06565b1e8665daeed..fdfceb0137105e214616ad0639517e3eebfea353 100644 (file)
@@ -1,5 +1,5 @@
-/* Function to parse a `long long int' from text.
-   Copyright (C) 1995-1997, 1999, 2001, 2009-2011 Free Software Foundation,
+/* Function to parse a 'long long int' from text.
+   Copyright (C) 1995-1997, 1999, 2001, 2009-2012 Free Software Foundation,
    Inc.
    This file is part of the GNU C Library.
 
index 6fa6d0c2e0100dd3d5e40e3f3fa6d61de82bfe18..e99da41edc0e35b156400be745b5bff2e880825b 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1997, 2009-2011 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1997, 2009-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
index bf259958d6e97dc152c02a86faf723f95933865a..33c2c5d9afb9a9c154126c0cf05a05863a622f36 100644 (file)
@@ -1,5 +1,5 @@
-/* Function to parse an `unsigned long long int' from text.
-   Copyright (C) 1995-1997, 1999, 2009-2011 Free Software Foundation, Inc.
+/* Function to parse an 'unsigned long long int' from text.
+   Copyright (C) 1995-1997, 1999, 2009-2012 Free Software Foundation, Inc.
    NOTE: The canonical source of this file is maintained with the GNU C
    Library.  Bugs can be reported to bug-glibc@gnu.org.
 
index 2896cc9655b3e5ad64d079185563da85a987a366..642ca66b66cd5f21b004092d652d1b668d24ba80 100644 (file)
@@ -1,5 +1,5 @@
 /* Stub for symlink().
-   Copyright (C) 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
new file mode 100644 (file)
index 0000000..0aee2a1
--- /dev/null
@@ -0,0 +1,298 @@
+/* Substitute for <sys/select.h>.
+   Copyright (C) 2007-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+# if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+# endif
+@PRAGMA_COLUMNS@
+
+/* On OSF/1, <sys/types.h> and <sys/time.h> include <sys/select.h>.
+   Simply delegate to the system's header in this case.  */
+#if @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TYPES_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H) && defined _OSF_SOURCE
+
+# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TYPES_H
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+#elif @HAVE_SYS_SELECT_H@ && defined __osf__ && (defined _SYS_TIME_H_ && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H) && defined _OSF_SOURCE
+
+# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_TIME_H
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+/* On IRIX 6.5, <sys/timespec.h> includes <sys/types.h>, which includes
+   <sys/bsd_types.h>, which includes <sys/select.h>.  At this point we cannot
+   include <signal.h>, because that includes <internal/signal_core.h>, which
+   gives a syntax error because <sys/timespec.h> has not been completely
+   processed.  Simply delegate to the system's header in this case.  */
+#elif @HAVE_SYS_SELECT_H@ && defined __sgi && (defined _SYS_BSD_TYPES_H && !defined _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H)
+
+# define _GL_SYS_SELECT_H_REDIRECT_FROM_SYS_BSD_TYPES_H
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+/* On OpenBSD 5.0, <pthread.h> includes <sys/types.h>, which includes
+   <sys/select.h>.  At this point we cannot include <signal.h>, because that
+   includes gnulib's pthread.h override, which gives a syntax error because
+   /usr/include/pthread.h has not been completely processed.  Simply delegate
+   to the system's header in this case.  */
+#elif @HAVE_SYS_SELECT_H@ && defined __OpenBSD__ && (defined _PTHREAD_H_ && !defined PTHREAD_MUTEX_INITIALIZER)
+
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+#else
+
+#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
+
+/* On many platforms, <sys/select.h> assumes prior inclusion of
+   <sys/types.h>.  Also, mingw defines sigset_t there, instead of
+   in <signal.h> where it belongs.  */
+#include <sys/types.h>
+
+#if @HAVE_SYS_SELECT_H@
+
+/* On OSF/1 4.0, <sys/select.h> provides only a forward declaration
+   of 'struct timeval', and no definition of this type.
+   Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select()
+   in <sys/time.h>.
+   But avoid namespace pollution on glibc systems.  */
+# ifndef __GLIBC__
+#  include <sys/time.h>
+# endif
+
+/* On AIX 7 and Solaris 10, <sys/select.h> provides an FD_ZERO implementation
+   that relies on memset(), but without including <string.h>.
+   But in any case avoid namespace pollution on glibc systems.  */
+# if (defined __OpenBSD__ || defined _AIX || defined __sun || defined __osf__ || defined __BEOS__) \
+     && ! defined __GLIBC__
+#  include <string.h>
+# endif
+
+/* The include_next requires a split double-inclusion guard.  */
+# @INCLUDE_NEXT@ @NEXT_SYS_SELECT_H@
+
+#endif
+
+/* Get definition of 'sigset_t'.
+   But avoid namespace pollution on glibc systems.
+   Do this after the include_next (for the sake of OpenBSD 5.0) but before
+   the split double-inclusion guard (for the sake of Solaris).  */
+#if !(defined __GLIBC__ && !defined __UCLIBC__)
+# include <signal.h>
+#endif
+
+#ifndef _@GUARD_PREFIX@_SYS_SELECT_H
+#define _@GUARD_PREFIX@_SYS_SELECT_H
+
+#if !@HAVE_SYS_SELECT_H@
+/* A platform that lacks <sys/select.h>.  */
+/* Get the 'struct timeval' and 'fd_set' types and the FD_* macros
+   on most platforms.  */
+# include <sys/time.h>
+/* On HP-UX 11, <sys/time.h> provides an FD_ZERO implementation
+   that relies on memset(), but without including <string.h>.  */
+# if defined __hpux
+#  include <string.h>
+# endif
+/* On native Windows platforms:
+   Get the 'fd_set' type.
+   Get the close() declaration before we override it.  */
+# if @HAVE_WINSOCK2_H@
+#  if !defined _GL_INCLUDING_WINSOCK2_H
+#   define _GL_INCLUDING_WINSOCK2_H
+#   include <winsock2.h>
+#   undef _GL_INCLUDING_WINSOCK2_H
+#  endif
+#  include <io.h>
+# endif
+#endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+
+/* Fix some definitions from <winsock2.h>.  */
+
+#if @HAVE_WINSOCK2_H@
+
+# if !GNULIB_defined_rpl_fd_isset
+
+/* Re-define FD_ISSET to avoid a WSA call while we are not using
+   network sockets.  */
+static inline int
+rpl_fd_isset (SOCKET fd, fd_set * set)
+{
+  u_int i;
+  if (set == NULL)
+    return 0;
+
+  for (i = 0; i < set->fd_count; i++)
+    if (set->fd_array[i] == fd)
+      return 1;
+
+  return 0;
+}
+
+#  define GNULIB_defined_rpl_fd_isset 1
+# endif
+
+# undef FD_ISSET
+# define FD_ISSET(fd, set) rpl_fd_isset(fd, set)
+
+#endif
+
+/* Hide some function declarations from <winsock2.h>.  */
+
+#if @HAVE_WINSOCK2_H@
+# if !defined _@GUARD_PREFIX@_UNISTD_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef close
+#   define close close_used_without_including_unistd_h
+#  else
+    _GL_WARN_ON_USE (close,
+                     "close() used without including <unistd.h>");
+#  endif
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef gethostname
+#   define gethostname gethostname_used_without_including_unistd_h
+#  else
+    _GL_WARN_ON_USE (gethostname,
+                     "gethostname() used without including <unistd.h>");
+#  endif
+# endif
+# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef socket
+#   define socket              socket_used_without_including_sys_socket_h
+#   undef connect
+#   define connect             connect_used_without_including_sys_socket_h
+#   undef accept
+#   define accept              accept_used_without_including_sys_socket_h
+#   undef bind
+#   define bind                bind_used_without_including_sys_socket_h
+#   undef getpeername
+#   define getpeername         getpeername_used_without_including_sys_socket_h
+#   undef getsockname
+#   define getsockname         getsockname_used_without_including_sys_socket_h
+#   undef getsockopt
+#   define getsockopt          getsockopt_used_without_including_sys_socket_h
+#   undef listen
+#   define listen              listen_used_without_including_sys_socket_h
+#   undef recv
+#   define recv                recv_used_without_including_sys_socket_h
+#   undef send
+#   define send                send_used_without_including_sys_socket_h
+#   undef recvfrom
+#   define recvfrom            recvfrom_used_without_including_sys_socket_h
+#   undef sendto
+#   define sendto              sendto_used_without_including_sys_socket_h
+#   undef setsockopt
+#   define setsockopt          setsockopt_used_without_including_sys_socket_h
+#   undef shutdown
+#   define shutdown            shutdown_used_without_including_sys_socket_h
+#  else
+    _GL_WARN_ON_USE (socket,
+                     "socket() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (connect,
+                     "connect() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (accept,
+                     "accept() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (bind,
+                     "bind() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getpeername,
+                     "getpeername() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getsockname,
+                     "getsockname() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (getsockopt,
+                     "getsockopt() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (listen,
+                     "listen() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (recv,
+                     "recv() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (send,
+                     "send() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (recvfrom,
+                     "recvfrom() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (sendto,
+                     "sendto() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (setsockopt,
+                     "setsockopt() used without including <sys/socket.h>");
+    _GL_WARN_ON_USE (shutdown,
+                     "shutdown() used without including <sys/socket.h>");
+#  endif
+# endif
+#endif
+
+
+#if @GNULIB_PSELECT@
+# if @REPLACE_PSELECT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef pselect
+#   define pselect rpl_pselect
+#  endif
+_GL_FUNCDECL_RPL (pselect, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timespec const *restrict, const sigset_t *restrict));
+_GL_CXXALIAS_RPL (pselect, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timespec const *restrict, const sigset_t *restrict));
+# else
+#  if !@HAVE_PSELECT@
+_GL_FUNCDECL_SYS (pselect, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timespec const *restrict, const sigset_t *restrict));
+#  endif
+_GL_CXXALIAS_SYS (pselect, int,
+                  (int, fd_set *restrict, fd_set *restrict, fd_set *restrict,
+                   struct timespec const *restrict, const sigset_t *restrict));
+# endif
+_GL_CXXALIASWARN (pselect);
+#elif defined GNULIB_POSIXCHECK
+# undef pselect
+# if HAVE_RAW_DECL_PSELECT
+_GL_WARN_ON_USE (pselect, "pselect is not portable - "
+                 "use gnulib module pselect for portability");
+# endif
+#endif
+
+#if @GNULIB_SELECT@
+# if @REPLACE_SELECT@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef select
+#   define select rpl_select
+#  endif
+_GL_FUNCDECL_RPL (select, int,
+                  (int, fd_set *, fd_set *, fd_set *, struct timeval *));
+_GL_CXXALIAS_RPL (select, int,
+                  (int, fd_set *, fd_set *, fd_set *, struct timeval *));
+# else
+_GL_CXXALIAS_SYS (select, int,
+                  (int, fd_set *, fd_set *, fd_set *, struct timeval *));
+# endif
+_GL_CXXALIASWARN (select);
+#elif @HAVE_WINSOCK2_H@
+# undef select
+# define select select_used_without_requesting_gnulib_module_select
+#elif defined GNULIB_POSIXCHECK
+# undef select
+# if HAVE_RAW_DECL_SELECT
+_GL_WARN_ON_USE (select, "select is not always POSIX compliant - "
+                 "use gnulib module select for portability");
+# endif
+#endif
+
+
+#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
+#endif /* _@GUARD_PREFIX@_SYS_SELECT_H */
+#endif /* OSF/1 */
index 77a7177ca64e0683838e2b82767d142cc05f4277..2efc1e92e06070bb77b9299166183b9c602a0767 100644 (file)
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat header file.
-   Copyright (C) 2005-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Eric Blake, Paul Eggert, and Jim Meyering.  */
 
@@ -36,7 +35,8 @@
 
 #ifndef _@GUARD_PREFIX@_SYS_STAT_H
 
-/* Get nlink_t.  */
+/* Get nlink_t.
+   May also define off_t to a 64-bit type on native Windows.  */
 #include <sys/types.h>
 
 /* Get struct timespec.  */
 # include <direct.h> /* mingw64, MSVC 9 */
 #endif
 
+/* Native Windows platforms declare umask() in <io.h>.  */
+#if 0 && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
+#endif
+
+/* Large File Support on native Windows.  */
+#if @WINDOWS_64_BIT_ST_SIZE@
+# define stat _stati64
+#endif
+
 #ifndef S_IFIFO
 # ifdef _S_IFIFO
 #  define S_IFIFO _S_IFIFO
@@ -331,6 +341,9 @@ _GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf));
 _GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf));
 # endif
 _GL_CXXALIASWARN (fstat);
+#elif @WINDOWS_64_BIT_ST_SIZE@
+/* Above, we define stat to _stati64.  */
+# define fstat _fstati64
 #elif defined GNULIB_POSIXCHECK
 # undef fstat
 # if HAVE_RAW_DECL_FSTAT
@@ -611,14 +624,55 @@ _GL_WARN_ON_USE (mknodat, "mknodat is not portable - "
 /* We can't use the object-like #define stat rpl_stat, because of
    struct stat.  This means that rpl_stat will not be used if the user
    does (stat)(a,b).  Oh well.  */
-#  undef stat
-#  ifdef _LARGE_FILES
+#  if defined _AIX && defined stat && defined _LARGE_FILES
     /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
        so we have to replace stat64() instead of stat(). */
-#   define stat stat64
 #   undef stat64
 #   define stat64(name, st) rpl_stat (name, st)
-#  else /* !_LARGE_FILES */
+#  elif @WINDOWS_64_BIT_ST_SIZE@
+    /* Above, we define stat to _stati64.  */
+#   if defined __MINGW32__ && defined _stati64
+#    ifndef _USE_32BIT_TIME_T
+      /* The system headers define _stati64 to _stat64.  */
+#     undef _stat64
+#     define _stat64(name, st) rpl_stat (name, st)
+#    endif
+#   elif defined _MSC_VER && defined _stati64
+#    ifdef _USE_32BIT_TIME_T
+      /* The system headers define _stati64 to _stat32i64.  */
+#     undef _stat32i64
+#     define _stat32i64(name, st) rpl_stat (name, st)
+#    else
+      /* The system headers define _stati64 to _stat64.  */
+#     undef _stat64
+#     define _stat64(name, st) rpl_stat (name, st)
+#    endif
+#   else
+#    undef _stati64
+#    define _stati64(name, st) rpl_stat (name, st)
+#   endif
+#  elif defined __MINGW32__ && defined stat
+#   ifdef _USE_32BIT_TIME_T
+     /* The system headers define stat to _stat32i64.  */
+#    undef _stat32i64
+#    define _stat32i64(name, st) rpl_stat (name, st)
+#   else
+     /* The system headers define stat to _stat64.  */
+#    undef _stat64
+#    define _stat64(name, st) rpl_stat (name, st)
+#   endif
+#  elif defined _MSC_VER && defined stat
+#   ifdef _USE_32BIT_TIME_T
+     /* The system headers define stat to _stat32.  */
+#    undef _stat32
+#    define _stat32(name, st) rpl_stat (name, st)
+#   else
+     /* The system headers define stat to _stat64i32.  */
+#    undef _stat64i32
+#    define _stat64i32(name, st) rpl_stat (name, st)
+#   endif
+#  else /* !(_AIX ||__MINGW32__ ||  _MSC_VER) */
+#   undef stat
 #   define stat(name, st) rpl_stat (name, st)
 #  endif /* !_LARGE_FILES */
 _GL_EXTERN_C int stat (const char *name, struct stat *buf)
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
new file mode 100644 (file)
index 0000000..d915cee
--- /dev/null
@@ -0,0 +1,205 @@
+/* Provide a more complete sys/time.h.
+
+   Copyright (C) 2007-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#if defined _@GUARD_PREFIX@_SYS_TIME_H
+
+/* Simply delegate to the system's header, without adding anything.  */
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# endif
+
+#else
+
+# define _@GUARD_PREFIX@_SYS_TIME_H
+
+# if @HAVE_SYS_TIME_H@
+#  @INCLUDE_NEXT@ @NEXT_SYS_TIME_H@
+# else
+#  include <time.h>
+# endif
+
+/* On native Windows with MSVC, get the 'struct timeval' type.
+   Also, on native Windows with a 64-bit time_t, where we are overriding the
+   'struct timeval' type, get all declarations of system functions whose
+   signature contains 'struct timeval'.  */
+# if (defined _MSC_VER || @REPLACE_STRUCT_TIMEVAL@) && @HAVE_WINSOCK2_H@ && !defined _GL_INCLUDING_WINSOCK2_H
+#  define _GL_INCLUDING_WINSOCK2_H
+#  include <winsock2.h>
+#  undef _GL_INCLUDING_WINSOCK2_H
+# endif
+
+/* The definitions of _GL_FUNCDECL_RPL etc. are copied here.  */
+
+/* The definition of _GL_ARG_NONNULL is copied here.  */
+
+/* The definition of _GL_WARN_ON_USE is copied here.  */
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+# if !@HAVE_STRUCT_TIMEVAL@ || @REPLACE_STRUCT_TIMEVAL@
+
+#  if @REPLACE_STRUCT_TIMEVAL@
+#   define timeval rpl_timeval
+#  endif
+
+#  if !GNULIB_defined_struct_timeval
+struct timeval
+{
+  time_t tv_sec;
+  long int tv_usec;
+};
+#   define GNULIB_defined_struct_timeval 1
+#  endif
+
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+# if @GNULIB_GETTIMEOFDAY@
+#  if @REPLACE_GETTIMEOFDAY@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef gettimeofday
+#    define gettimeofday rpl_gettimeofday
+#   endif
+_GL_FUNCDECL_RPL (gettimeofday, int,
+                  (struct timeval *restrict, void *restrict)
+                  _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (gettimeofday, int,
+                  (struct timeval *restrict, void *restrict));
+#  else
+#   if !@HAVE_GETTIMEOFDAY@
+_GL_FUNCDECL_SYS (gettimeofday, int,
+                  (struct timeval *restrict, void *restrict)
+                  _GL_ARG_NONNULL ((1)));
+#   endif
+/* Need to cast, because on glibc systems, by default, the second argument is
+                                                  struct timezone *.  */
+_GL_CXXALIAS_SYS_CAST (gettimeofday, int,
+                       (struct timeval *restrict, void *restrict));
+#  endif
+_GL_CXXALIASWARN (gettimeofday);
+# elif defined GNULIB_POSIXCHECK
+#  undef gettimeofday
+#  if HAVE_RAW_DECL_GETTIMEOFDAY
+_GL_WARN_ON_USE (gettimeofday, "gettimeofday is unportable - "
+                 "use gnulib module gettimeofday for portability");
+#  endif
+# endif
+
+/* Hide some function declarations from <winsock2.h>.  */
+
+# if defined _MSC_VER && @HAVE_WINSOCK2_H@
+#  if !defined _@GUARD_PREFIX@_UNISTD_H
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef close
+#    define close close_used_without_including_unistd_h
+#   else
+     _GL_WARN_ON_USE (close,
+                      "close() used without including <unistd.h>");
+#   endif
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef gethostname
+#    define gethostname gethostname_used_without_including_unistd_h
+#   else
+     _GL_WARN_ON_USE (gethostname,
+                      "gethostname() used without including <unistd.h>");
+#   endif
+#  endif
+#  if !defined _@GUARD_PREFIX@_SYS_SOCKET_H
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef socket
+#    define socket              socket_used_without_including_sys_socket_h
+#    undef connect
+#    define connect             connect_used_without_including_sys_socket_h
+#    undef accept
+#    define accept              accept_used_without_including_sys_socket_h
+#    undef bind
+#    define bind                bind_used_without_including_sys_socket_h
+#    undef getpeername
+#    define getpeername         getpeername_used_without_including_sys_socket_h
+#    undef getsockname
+#    define getsockname         getsockname_used_without_including_sys_socket_h
+#    undef getsockopt
+#    define getsockopt          getsockopt_used_without_including_sys_socket_h
+#    undef listen
+#    define listen              listen_used_without_including_sys_socket_h
+#    undef recv
+#    define recv                recv_used_without_including_sys_socket_h
+#    undef send
+#    define send                send_used_without_including_sys_socket_h
+#    undef recvfrom
+#    define recvfrom            recvfrom_used_without_including_sys_socket_h
+#    undef sendto
+#    define sendto              sendto_used_without_including_sys_socket_h
+#    undef setsockopt
+#    define setsockopt          setsockopt_used_without_including_sys_socket_h
+#    undef shutdown
+#    define shutdown            shutdown_used_without_including_sys_socket_h
+#   else
+     _GL_WARN_ON_USE (socket,
+                      "socket() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (connect,
+                      "connect() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (accept,
+                      "accept() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (bind,
+                      "bind() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (getpeername,
+                      "getpeername() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (getsockname,
+                      "getsockname() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (getsockopt,
+                      "getsockopt() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (listen,
+                      "listen() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (recv,
+                      "recv() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (send,
+                      "send() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (recvfrom,
+                      "recvfrom() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (sendto,
+                      "sendto() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (setsockopt,
+                      "setsockopt() used without including <sys/socket.h>");
+     _GL_WARN_ON_USE (shutdown,
+                      "shutdown() used without including <sys/socket.h>");
+#   endif
+#  endif
+#  if !defined _@GUARD_PREFIX@_SYS_SELECT_H
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef select
+#    define select select_used_without_including_sys_select_h
+#   else
+     _GL_WARN_ON_USE (select,
+                      "select() used without including <sys/select.h>");
+#   endif
+#  endif
+# endif
+
+#endif /* _@GUARD_PREFIX@_SYS_TIME_H */
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
new file mode 100644 (file)
index 0000000..8139d98
--- /dev/null
@@ -0,0 +1,51 @@
+/* Provide a more complete sys/types.h.
+
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+#if __GNUC__ >= 3
+@PRAGMA_SYSTEM_HEADER@
+#endif
+@PRAGMA_COLUMNS@
+
+#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+
+/* The include_next requires a split double-inclusion guard.  */
+#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@
+
+#ifndef _@GUARD_PREFIX@_SYS_TYPES_H
+#define _@GUARD_PREFIX@_SYS_TYPES_H
+
+/* Override off_t if Large File Support is requested on native Windows.  */
+#if @WINDOWS_64_BIT_OFF_T@
+/* Same as int64_t in <stdint.h>.  */
+# if defined _MSC_VER
+#  define off_t __int64
+# else
+#  define off_t long long int
+# endif
+/* Indicator, for gnulib internal purposes.  */
+# define _GL_WINDOWS_64_BIT_OFF_T 1
+#endif
+
+/* MSVC 9 defines size_t in <stddef.h>, not in <sys/types.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__) \
+    && ! defined __GLIBC__
+# include <stddef.h>
+#endif
+
+#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
+#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */
index 1fbebf47beb0197e380e88f3c7f0ec050a59e2bc..04cde057cf070cbdbf95a09523893100dec998b7 100644 (file)
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
index 31d010e437b49949f7e689b503e18a3f1f294bdb..74366a0f75910b5228a962e0290478ff47bfae8b 100644 (file)
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006-2007, 2010-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2010-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -13,8 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License along
-   with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by Paul Eggert.  */
 
diff --git a/lib/timespec-add.c b/lib/timespec-add.c
new file mode 100644 (file)
index 0000000..4e5c641
--- /dev/null
@@ -0,0 +1,71 @@
+/* Add two struct timespec values.
+
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Return the sum of two timespec values A and B.  On overflow, return
+   an extremal value.  This assumes 0 <= tv_nsec <= 999999999.  */
+
+#include <config.h>
+#include "timespec.h"
+
+#include "intprops.h"
+
+struct timespec
+timespec_add (struct timespec a, struct timespec b)
+{
+  struct timespec r;
+  time_t rs = a.tv_sec;
+  time_t bs = b.tv_sec;
+  int ns = a.tv_nsec + b.tv_nsec;
+  int nsd = ns - 1000000000;
+  int rns = ns;
+
+  if (0 <= nsd)
+    {
+      rns = nsd;
+      if (rs == TYPE_MAXIMUM (time_t))
+        {
+          if (0 <= bs)
+            goto high_overflow;
+          bs++;
+        }
+      else
+        rs++;
+    }
+
+  if (INT_ADD_OVERFLOW (rs, bs))
+    {
+      if (rs < 0)
+        {
+          rs = TYPE_MINIMUM (time_t);
+          rns = 0;
+        }
+      else
+        {
+        high_overflow:
+          rs = TYPE_MAXIMUM (time_t);
+          rns = 999999999;
+        }
+    }
+  else
+    rs += bs;
+
+  r.tv_sec = rs;
+  r.tv_nsec = rns;
+  return r;
+}
diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c
new file mode 100644 (file)
index 0000000..7c4c781
--- /dev/null
@@ -0,0 +1,71 @@
+/* Subtract two struct timespec values.
+
+   Copyright (C) 2011-2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* Return the difference between two timespec values A and B.  On
+   overflow, return an extremal value.  This assumes 0 <= tv_nsec <=
+   999999999.  */
+
+#include <config.h>
+#include "timespec.h"
+
+#include "intprops.h"
+
+struct timespec
+timespec_sub (struct timespec a, struct timespec b)
+{
+  struct timespec r;
+  time_t rs = a.tv_sec;
+  time_t bs = b.tv_sec;
+  int ns = a.tv_nsec - b.tv_nsec;
+  int rns = ns;
+
+  if (ns < 0)
+    {
+      rns = ns + 1000000000;
+      if (rs == TYPE_MINIMUM (time_t))
+        {
+          if (bs <= 0)
+            goto low_overflow;
+          bs--;
+        }
+      else
+        rs--;
+    }
+
+  if (INT_SUBTRACT_OVERFLOW (rs, bs))
+    {
+      if (rs < 0)
+        {
+        low_overflow:
+          rs = TYPE_MINIMUM (time_t);
+          rns = 0;
+        }
+      else
+        {
+          rs = TYPE_MAXIMUM (time_t);
+          rns = 999999999;
+        }
+    }
+  else
+    rs -= bs;
+
+  r.tv_sec = rs;
+  r.tv_nsec = rns;
+  return r;
+}
diff --git a/lib/timespec.h b/lib/timespec.h
new file mode 100644 (file)
index 0000000..a587079
--- /dev/null
@@ -0,0 +1,85 @@
+/* timespec -- System time interface
+
+   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2012 Free Software
+   Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#if ! defined TIMESPEC_H
+# define TIMESPEC_H
+
+# include <time.h>
+
+/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
+
+   For each time stamp T, this code assumes that either:
+
+     * T.tv_nsec is in the range 0..999999999; or
+     * T.tv_sec corresponds to a valid leap second on a host that supports
+       leap seconds, and T.tv_nsec is in the range 1000000000..1999999999; or
+     * T.tv_sec is the minimum time_t value and T.tv_nsec is -1; or
+       T.tv_sec is the maximum time_t value and T.tv_nsec is 2000000000.
+       This allows for special struct timespec values that are less or
+       greater than all possible valid time stamps.
+
+   In all these cases, it is safe to subtract two tv_nsec values and
+   convert the result to integer without worrying about overflow on
+   any platform of interest to the GNU project, since all such
+   platforms have 32-bit int or wider.
+
+   Replacing "(int) (a.tv_nsec - b.tv_nsec)" with something like
+   "a.tv_nsec < b.tv_nsec ? -1 : a.tv_nsec > b.tv_nsec" would cause
+   this function to work in some cases where the above assumption is
+   violated, but not in all cases (e.g., a.tv_sec==1, a.tv_nsec==-2,
+   b.tv_sec==0, b.tv_nsec==999999999) and is arguably not worth the
+   extra instructions.  Using a subtraction has the advantage of
+   detecting some invalid cases on platforms that detect integer
+   overflow.
+
+   The (int) cast avoids a gcc -Wconversion warning.  */
+
+static inline int
+timespec_cmp (struct timespec a, struct timespec b)
+{
+  return (a.tv_sec < b.tv_sec ? -1
+          : a.tv_sec > b.tv_sec ? 1
+          : (int) (a.tv_nsec - b.tv_nsec));
+}
+
+/* Return -1, 0, 1, depending on the sign of A.  A.tv_nsec must be
+   nonnegative.  */
+static inline int
+timespec_sign (struct timespec a)
+{
+  return a.tv_sec < 0 ? -1 : a.tv_sec || a.tv_nsec;
+}
+
+struct timespec timespec_add (struct timespec, struct timespec)
+  _GL_ATTRIBUTE_CONST;
+struct timespec timespec_sub (struct timespec, struct timespec)
+  _GL_ATTRIBUTE_CONST;
+struct timespec dtotimespec (double)
+  _GL_ATTRIBUTE_CONST;
+
+/* Return an approximation to A, of type 'double'.  */
+static inline double
+timespectod (struct timespec a)
+{
+  return a.tv_sec + a.tv_nsec / 1e9;
+}
+
+void gettime (struct timespec *);
+int settime (struct timespec const *);
+
+#endif
index 182d64955aa891f2b6d5f1931b4380c1a66d7213..f5ec9ebcb3d9ce78dac799f213296d51707597ce 100644 (file)
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -1,6 +1,6 @@
 /* uint64_t-like operations that work even on hosts lacking uint64_t
 
-   Copyright (C) 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@ typedef uint64_t u64;
 # define u64hilo(hi, lo) ((u64) (((u64) (hi) << 32) + (lo)))
 # define u64init(hi, lo) u64hilo (hi, lo)
 # define u64lo(x) ((u64) (x))
+# define u64size(x) u64lo (x)
 # define u64lt(x, y) ((x) < (y))
 # define u64and(x, y) ((x) & (y))
 # define u64or(x, y) ((x) | (y))
@@ -72,6 +73,16 @@ u64lo (uint32_t lo)
   return r;
 }
 
+/* Return a u64 value representing SIZE.  */
+static inline u64
+u64size (size_t size)
+{
+  u64 r;
+  r.hi = size >> 31 >> 1;
+  r.lo = size;
+  return r;
+}
+
 /* Return X < Y.  */
 static inline int
 u64lt (u64 x, u64 y)
index 77e5675aad225c595d733a1c3db791ffb443ad37..e904e512ee81d3ac05e4a9332f6ba201a62e2fee 100644 (file)
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2011 Free Software Foundation, Inc.
+   Copyright (C) 2003-2012 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -12,8 +12,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software Foundation,
-   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
 
 #if __GNUC__ >= 3
 @PRAGMA_SYSTEM_HEADER@
 #endif
 
 /* Native Windows platforms declare chdir, getcwd, rmdir in
-   <io.h> and/or <direct.h>, not in <unistd.h>.  */
+   <io.h> and/or <direct.h>, not in <unistd.h>.
+   They also declare access(), chmod(), close(), dup(), dup2(), isatty(),
+   lseek(), read(), unlink(), write() in <io.h>.  */
 #if ((@GNULIB_CHDIR@ || @GNULIB_GETCWD@ || @GNULIB_RMDIR@ \
       || defined GNULIB_POSIXCHECK) \
      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__))
 # include <io.h>     /* mingw32, mingw64 */
 # include <direct.h> /* mingw64, MSVC 9 */
+#elif (@GNULIB_CLOSE@ || @GNULIB_DUP@ || @GNULIB_DUP2@ || @GNULIB_ISATTY@ \
+       || @GNULIB_LSEEK@ || @GNULIB_READ@ || @GNULIB_UNLINK@ || @GNULIB_WRITE@ \
+       || defined GNULIB_POSIXCHECK) \
+      && ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)
+# include <io.h>
 #endif
 
 /* AIX and OSF/1 5.1 declare getdomainname in <netdb.h>, not in <unistd.h>.
 # include <netdb.h>
 #endif
 
-/* MSVC defines off_t in <sys/types.h>.  */
-#if !@HAVE_UNISTD_H@
+/* MSVC defines off_t in <sys/types.h>.
+   May also define off_t to a 64-bit type on native Windows.  */
+#if !@HAVE_UNISTD_H@ || @WINDOWS_64_BIT_OFF_T@
 /* Get off_t.  */
 # include <sys/types.h>
 #endif
@@ -556,10 +563,19 @@ _GL_WARN_ON_USE (fsync, "fsync is unportable - "
    Return 0 if successful, otherwise -1 and errno set.
    See the POSIX:2008 specification
    <http://pubs.opengroup.org/onlinepubs/9699919799/functions/ftruncate.html>.  */
-# if !@HAVE_FTRUNCATE@
+# if @REPLACE_FTRUNCATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef ftruncate
+#   define ftruncate rpl_ftruncate
+#  endif
+_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length));
+_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length));
+# else
+#  if !@HAVE_FTRUNCATE@
 _GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length));
+# endif
 _GL_CXXALIASWARN (ftruncate);
 #elif defined GNULIB_POSIXCHECK
 # undef ftruncate
@@ -935,6 +951,27 @@ _GL_WARN_ON_USE (group_member, "group_member is unportable - "
 #endif
 
 
+#if @GNULIB_ISATTY@
+# if @REPLACE_ISATTY@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef isatty
+#   define isatty rpl_isatty
+#  endif
+_GL_FUNCDECL_RPL (isatty, int, (int fd));
+_GL_CXXALIAS_RPL (isatty, int, (int fd));
+# else
+_GL_CXXALIAS_SYS (isatty, int, (int fd));
+# endif
+_GL_CXXALIASWARN (isatty);
+#elif defined GNULIB_POSIXCHECK
+# undef isatty
+# if HAVE_RAW_DECL_ISATTY
+_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - "
+                 "use gnulib module isatty for portability");
+# endif
+#endif
+
+
 #if @GNULIB_LCHOWN@
 /* Change the owner of FILE to UID (if UID is not -1) and the group of FILE
    to GID (if GID is not -1).  Do not follow symbolic links.
@@ -1268,6 +1305,33 @@ _GL_WARN_ON_USE (rmdir, "rmdir is unportable - "
 #endif
 
 
+#if @GNULIB_SETHOSTNAME@
+/* Set the host name of the machine.
+   The host name may or may not be fully qualified.
+
+   Put LEN bytes of NAME into the host name.
+   Return 0 if successful, otherwise, set errno and return -1.
+
+   Platforms with no ability to set the hostname return -1 and set
+   errno = ENOSYS.  */
+# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@
+_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len)
+                                    _GL_ARG_NONNULL ((1)));
+# endif
+/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5
+   and FreeBSD 6.4 the second parameter is int.  On Solaris 11
+   2011-10, the first parameter is not const.  */
+_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len));
+_GL_CXXALIASWARN (sethostname);
+#elif defined GNULIB_POSIXCHECK
+# undef sethostname
+# if HAVE_RAW_DECL_SETHOSTNAME
+_GL_WARN_ON_USE (sethostname, "sethostname is unportable - "
+                 "use gnulib module sethostname for portability");
+# endif
+#endif
+
+
 #if @GNULIB_SLEEP@
 /* Pause the execution of the current thread for N seconds.
    Returns the number of seconds left to sleep.
diff --git a/lib/utimens.c b/lib/utimens.c
new file mode 100644 (file)
index 0000000..c126b95
--- /dev/null
@@ -0,0 +1,533 @@
+/* Set file access and modification times.
+
+   Copyright (C) 2003-2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify it
+   under the terms of the GNU General Public License as published by the
+   Free Software Foundation; either version 3 of the License, or any
+   later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+/* derived from a function in touch.c */
+
+#include <config.h>
+
+#include "utimens.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+#include "stat-time.h"
+#include "timespec.h"
+
+#if HAVE_UTIME_H
+# include <utime.h>
+#endif
+
+/* Some systems (even some that do have <utime.h>) don't declare this
+   structure anywhere.  */
+#ifndef HAVE_STRUCT_UTIMBUF
+struct utimbuf
+{
+  long actime;
+  long modtime;
+};
+#endif
+
+/* Avoid recursion with rpl_futimens or rpl_utimensat.  */
+#undef futimens
+#undef utimensat
+
+/* Solaris 9 mistakenly succeeds when given a non-directory with a
+   trailing slash.  Force the use of rpl_stat for a fix.  */
+#ifndef REPLACE_FUNC_STAT_FILE
+# define REPLACE_FUNC_STAT_FILE 0
+#endif
+
+#if HAVE_UTIMENSAT || HAVE_FUTIMENS
+/* Cache variables for whether the utimensat syscall works; used to
+   avoid calling the syscall if we know it will just fail with ENOSYS,
+   and to avoid unnecessary work in massaging timestamps if the
+   syscall will work.  Multiple variables are needed, to distinguish
+   between the following scenarios on Linux:
+   utimensat doesn't exist, or is in glibc but kernel 2.6.18 fails with ENOSYS
+   kernel 2.6.22 and earlier rejects AT_SYMLINK_NOFOLLOW
+   kernel 2.6.25 and earlier reject UTIME_NOW/UTIME_OMIT with non-zero tv_sec
+   kernel 2.6.32 used with xfs or ntfs-3g fail to honor UTIME_OMIT
+   utimensat completely works
+   For each cache variable: 0 = unknown, 1 = yes, -1 = no.  */
+static int utimensat_works_really;
+static int lutimensat_works_really;
+#endif /* HAVE_UTIMENSAT || HAVE_FUTIMENS */
+
+/* Validate the requested timestamps.  Return 0 if the resulting
+   timespec can be used for utimensat (after possibly modifying it to
+   work around bugs in utimensat).  Return a positive value if the
+   timespec needs further adjustment based on stat results: 1 if any
+   adjustment is needed for utimes, and 2 if any adjustment is needed
+   for Linux utimensat.  Return -1, with errno set to EINVAL, if
+   timespec is out of range.  */
+static int
+validate_timespec (struct timespec timespec[2])
+{
+  int result = 0;
+  int utime_omit_count = 0;
+  assert (timespec);
+  if ((timespec[0].tv_nsec != UTIME_NOW
+       && timespec[0].tv_nsec != UTIME_OMIT
+       && (timespec[0].tv_nsec < 0 || 1000000000 <= timespec[0].tv_nsec))
+      || (timespec[1].tv_nsec != UTIME_NOW
+          && timespec[1].tv_nsec != UTIME_OMIT
+          && (timespec[1].tv_nsec < 0 || 1000000000 <= timespec[1].tv_nsec)))
+    {
+      errno = EINVAL;
+      return -1;
+    }
+  /* Work around Linux kernel 2.6.25 bug, where utimensat fails with
+     EINVAL if tv_sec is not 0 when using the flag values of tv_nsec.
+     Flag a Linux kernel 2.6.32 bug, where an mtime of UTIME_OMIT
+     fails to bump ctime.  */
+  if (timespec[0].tv_nsec == UTIME_NOW
+      || timespec[0].tv_nsec == UTIME_OMIT)
+    {
+      timespec[0].tv_sec = 0;
+      result = 1;
+      if (timespec[0].tv_nsec == UTIME_OMIT)
+        utime_omit_count++;
+    }
+  if (timespec[1].tv_nsec == UTIME_NOW
+      || timespec[1].tv_nsec == UTIME_OMIT)
+    {
+      timespec[1].tv_sec = 0;
+      result = 1;
+      if (timespec[1].tv_nsec == UTIME_OMIT)
+        utime_omit_count++;
+    }
+  return result + (utime_omit_count == 1);
+}
+
+/* Normalize any UTIME_NOW or UTIME_OMIT values in *TS, using stat
+   buffer STATBUF to obtain the current timestamps of the file.  If
+   both times are UTIME_NOW, set *TS to NULL (as this can avoid some
+   permissions issues).  If both times are UTIME_OMIT, return true
+   (nothing further beyond the prior collection of STATBUF is
+   necessary); otherwise return false.  */
+static bool
+update_timespec (struct stat const *statbuf, struct timespec *ts[2])
+{
+  struct timespec *timespec = *ts;
+  if (timespec[0].tv_nsec == UTIME_OMIT
+      && timespec[1].tv_nsec == UTIME_OMIT)
+    return true;
+  if (timespec[0].tv_nsec == UTIME_NOW
+      && timespec[1].tv_nsec == UTIME_NOW)
+    {
+      *ts = NULL;
+      return false;
+    }
+
+  if (timespec[0].tv_nsec == UTIME_OMIT)
+    timespec[0] = get_stat_atime (statbuf);
+  else if (timespec[0].tv_nsec == UTIME_NOW)
+    gettime (&timespec[0]);
+
+  if (timespec[1].tv_nsec == UTIME_OMIT)
+    timespec[1] = get_stat_mtime (statbuf);
+  else if (timespec[1].tv_nsec == UTIME_NOW)
+    gettime (&timespec[1]);
+
+  return false;
+}
+
+/* Set the access and modification time stamps of FD (a.k.a. FILE) to be
+   TIMESPEC[0] and TIMESPEC[1], respectively.
+   FD must be either negative -- in which case it is ignored --
+   or a file descriptor that is open on FILE.
+   If FD is nonnegative, then FILE can be NULL, which means
+   use just futimes (or equivalent) instead of utimes (or equivalent),
+   and fail if on an old system without futimes (or equivalent).
+   If TIMESPEC is null, set the time stamps to the current time.
+   Return 0 on success, -1 (setting errno) on failure.  */
+
+int
+fdutimens (int fd, char const *file, struct timespec const timespec[2])
+{
+  struct timespec adjusted_timespec[2];
+  struct timespec *ts = timespec ? adjusted_timespec : NULL;
+  int adjustment_needed = 0;
+  struct stat st;
+
+  if (ts)
+    {
+      adjusted_timespec[0] = timespec[0];
+      adjusted_timespec[1] = timespec[1];
+      adjustment_needed = validate_timespec (ts);
+    }
+  if (adjustment_needed < 0)
+    return -1;
+
+  /* Require that at least one of FD or FILE are potentially valid, to avoid
+     a Linux bug where futimens (AT_FDCWD, NULL) changes "." rather
+     than failing.  */
+  if (fd < 0 && !file)
+    {
+      errno = EBADF;
+      return -1;
+    }
+
+  /* Some Linux-based NFS clients are buggy, and mishandle time stamps
+     of files in NFS file systems in some cases.  We have no
+     configure-time test for this, but please see
+     <http://bugs.gentoo.org/show_bug.cgi?id=132673> for references to
+     some of the problems with Linux 2.6.16.  If this affects you,
+     compile with -DHAVE_BUGGY_NFS_TIME_STAMPS; this is reported to
+     help in some cases, albeit at a cost in performance.  But you
+     really should upgrade your kernel to a fixed version, since the
+     problem affects many applications.  */
+
+#if HAVE_BUGGY_NFS_TIME_STAMPS
+  if (fd < 0)
+    sync ();
+  else
+    fsync (fd);
+#endif
+
+  /* POSIX 2008 added two interfaces to set file timestamps with
+     nanosecond resolution; newer Linux implements both functions via
+     a single syscall.  We provide a fallback for ENOSYS (for example,
+     compiling against Linux 2.6.25 kernel headers and glibc 2.7, but
+     running on Linux 2.6.18 kernel).  */
+#if HAVE_UTIMENSAT || HAVE_FUTIMENS
+  if (0 <= utimensat_works_really)
+    {
+      int result;
+# if __linux__
+      /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
+         systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
+         but work if both times are either explicitly specified or
+         UTIME_NOW.  Work around it with a preparatory [f]stat prior
+         to calling futimens/utimensat; fortunately, there is not much
+         timing impact due to the extra syscall even on file systems
+         where UTIME_OMIT would have worked.  FIXME: Simplify this in
+         2012, when file system bugs are no longer common.  */
+      if (adjustment_needed == 2)
+        {
+          if (fd < 0 ? stat (file, &st) : fstat (fd, &st))
+            return -1;
+          if (ts[0].tv_nsec == UTIME_OMIT)
+            ts[0] = get_stat_atime (&st);
+          else if (ts[1].tv_nsec == UTIME_OMIT)
+            ts[1] = get_stat_mtime (&st);
+          /* Note that st is good, in case utimensat gives ENOSYS.  */
+          adjustment_needed++;
+        }
+# endif /* __linux__ */
+# if HAVE_UTIMENSAT
+      if (fd < 0)
+        {
+          result = utimensat (AT_FDCWD, file, ts, 0);
+#  ifdef __linux__
+          /* Work around a kernel bug:
+             http://bugzilla.redhat.com/442352
+             http://bugzilla.redhat.com/449910
+             It appears that utimensat can mistakenly return 280 rather
+             than -1 upon ENOSYS failure.
+             FIXME: remove in 2010 or whenever the offending kernels
+             are no longer in common use.  */
+          if (0 < result)
+            errno = ENOSYS;
+#  endif /* __linux__ */
+          if (result == 0 || errno != ENOSYS)
+            {
+              utimensat_works_really = 1;
+              return result;
+            }
+        }
+# endif /* HAVE_UTIMENSAT */
+# if HAVE_FUTIMENS
+      if (0 <= fd)
+        {
+          result = futimens (fd, ts);
+#  ifdef __linux__
+          /* Work around the same bug as above.  */
+          if (0 < result)
+            errno = ENOSYS;
+#  endif /* __linux__ */
+          if (result == 0 || errno != ENOSYS)
+            {
+              utimensat_works_really = 1;
+              return result;
+            }
+        }
+# endif /* HAVE_FUTIMENS */
+    }
+  utimensat_works_really = -1;
+  lutimensat_works_really = -1;
+#endif /* HAVE_UTIMENSAT || HAVE_FUTIMENS */
+
+  /* The platform lacks an interface to set file timestamps with
+     nanosecond resolution, so do the best we can, discarding any
+     fractional part of the timestamp.  */
+
+  if (adjustment_needed || (REPLACE_FUNC_STAT_FILE && fd < 0))
+    {
+      if (adjustment_needed != 3
+          && (fd < 0 ? stat (file, &st) : fstat (fd, &st)))
+        return -1;
+      if (ts && update_timespec (&st, &ts))
+        return 0;
+    }
+
+  {
+#if HAVE_FUTIMESAT || HAVE_WORKING_UTIMES
+    struct timeval timeval[2];
+    struct timeval *t;
+    if (ts)
+      {
+        timeval[0].tv_sec = ts[0].tv_sec;
+        timeval[0].tv_usec = ts[0].tv_nsec / 1000;
+        timeval[1].tv_sec = ts[1].tv_sec;
+        timeval[1].tv_usec = ts[1].tv_nsec / 1000;
+        t = timeval;
+      }
+    else
+      t = NULL;
+
+    if (fd < 0)
+      {
+# if HAVE_FUTIMESAT
+        return futimesat (AT_FDCWD, file, t);
+# endif
+      }
+    else
+      {
+        /* If futimesat or futimes fails here, don't try to speed things
+           up by returning right away.  glibc can incorrectly fail with
+           errno == ENOENT if /proc isn't mounted.  Also, Mandrake 10.0
+           in high security mode doesn't allow ordinary users to read
+           /proc/self, so glibc incorrectly fails with errno == EACCES.
+           If errno == EIO, EPERM, or EROFS, it's probably safe to fail
+           right away, but these cases are rare enough that they're not
+           worth optimizing, and who knows what other messed-up systems
+           are out there?  So play it safe and fall back on the code
+           below.  */
+
+# if (HAVE_FUTIMESAT && !FUTIMESAT_NULL_BUG) || HAVE_FUTIMES
+#  if HAVE_FUTIMESAT && !FUTIMESAT_NULL_BUG
+#   undef futimes
+#   define futimes(fd, t) futimesat (fd, NULL, t)
+#  endif
+        if (futimes (fd, t) == 0)
+          {
+#  if __linux__ && __GLIBC__
+            /* Work around a longstanding glibc bug, still present as
+               of 2010-12-27.  On older Linux kernels that lack both
+               utimensat and utimes, glibc's futimes rounds instead of
+               truncating when falling back on utime.  The same bug
+               occurs in futimesat with a null 2nd arg.  */
+            if (t)
+              {
+                bool abig = 500000 <= t[0].tv_usec;
+                bool mbig = 500000 <= t[1].tv_usec;
+                if ((abig | mbig) && fstat (fd, &st) == 0)
+                  {
+                    /* If these two subtractions overflow, they'll
+                       track the overflows inside the buggy glibc.  */
+                    time_t adiff = st.st_atime - t[0].tv_sec;
+                    time_t mdiff = st.st_mtime - t[1].tv_sec;
+
+                    struct timeval *tt = NULL;
+                    struct timeval truncated_timeval[2];
+                    truncated_timeval[0] = t[0];
+                    truncated_timeval[1] = t[1];
+                    if (abig && adiff == 1 && get_stat_atime_ns (&st) == 0)
+                      {
+                        tt = truncated_timeval;
+                        tt[0].tv_usec = 0;
+                      }
+                    if (mbig && mdiff == 1 && get_stat_mtime_ns (&st) == 0)
+                      {
+                        tt = truncated_timeval;
+                        tt[1].tv_usec = 0;
+                      }
+                    if (tt)
+                      futimes (fd, tt);
+                  }
+              }
+#  endif
+
+            return 0;
+          }
+# endif
+      }
+#endif /* HAVE_FUTIMESAT || HAVE_WORKING_UTIMES */
+
+    if (!file)
+      {
+#if ! ((HAVE_FUTIMESAT && !FUTIMESAT_NULL_BUG)          \
+        || (HAVE_WORKING_UTIMES && HAVE_FUTIMES))
+        errno = ENOSYS;
+#endif
+        return -1;
+      }
+
+#if HAVE_WORKING_UTIMES
+    return utimes (file, t);
+#else
+    {
+      struct utimbuf utimbuf;
+      struct utimbuf *ut;
+      if (ts)
+        {
+          utimbuf.actime = ts[0].tv_sec;
+          utimbuf.modtime = ts[1].tv_sec;
+          ut = &utimbuf;
+        }
+      else
+        ut = NULL;
+
+      return utime (file, ut);
+    }
+#endif /* !HAVE_WORKING_UTIMES */
+  }
+}
+
+/* Set the access and modification time stamps of FILE to be
+   TIMESPEC[0] and TIMESPEC[1], respectively.  */
+int
+utimens (char const *file, struct timespec const timespec[2])
+{
+  return fdutimens (-1, file, timespec);
+}
+
+/* Set the access and modification time stamps of FILE to be
+   TIMESPEC[0] and TIMESPEC[1], respectively, without dereferencing
+   symlinks.  Fail with ENOSYS if the platform does not support
+   changing symlink timestamps, but FILE was a symlink.  */
+int
+lutimens (char const *file, struct timespec const timespec[2])
+{
+  struct timespec adjusted_timespec[2];
+  struct timespec *ts = timespec ? adjusted_timespec : NULL;
+  int adjustment_needed = 0;
+  struct stat st;
+
+  if (ts)
+    {
+      adjusted_timespec[0] = timespec[0];
+      adjusted_timespec[1] = timespec[1];
+      adjustment_needed = validate_timespec (ts);
+    }
+  if (adjustment_needed < 0)
+    return -1;
+
+  /* The Linux kernel did not support symlink timestamps until
+     utimensat, in version 2.6.22, so we don't need to mimic
+     fdutimens' worry about buggy NFS clients.  But we do have to
+     worry about bogus return values.  */
+
+#if HAVE_UTIMENSAT
+  if (0 <= lutimensat_works_really)
+    {
+      int result;
+# if __linux__
+      /* As recently as Linux kernel 2.6.32 (Dec 2009), several file
+         systems (xfs, ntfs-3g) have bugs with a single UTIME_OMIT,
+         but work if both times are either explicitly specified or
+         UTIME_NOW.  Work around it with a preparatory lstat prior to
+         calling utimensat; fortunately, there is not much timing
+         impact due to the extra syscall even on file systems where
+         UTIME_OMIT would have worked.  FIXME: Simplify this in 2012,
+         when file system bugs are no longer common.  */
+      if (adjustment_needed == 2)
+        {
+          if (lstat (file, &st))
+            return -1;
+          if (ts[0].tv_nsec == UTIME_OMIT)
+            ts[0] = get_stat_atime (&st);
+          else if (ts[1].tv_nsec == UTIME_OMIT)
+            ts[1] = get_stat_mtime (&st);
+          /* Note that st is good, in case utimensat gives ENOSYS.  */
+          adjustment_needed++;
+        }
+# endif /* __linux__ */
+      result = utimensat (AT_FDCWD, file, ts, AT_SYMLINK_NOFOLLOW);
+# ifdef __linux__
+      /* Work around a kernel bug:
+         http://bugzilla.redhat.com/442352
+         http://bugzilla.redhat.com/449910
+         It appears that utimensat can mistakenly return 280 rather
+         than -1 upon ENOSYS failure.
+         FIXME: remove in 2010 or whenever the offending kernels
+         are no longer in common use.  */
+      if (0 < result)
+        errno = ENOSYS;
+# endif
+      if (result == 0 || errno != ENOSYS)
+        {
+          utimensat_works_really = 1;
+          lutimensat_works_really = 1;
+          return result;
+        }
+    }
+  lutimensat_works_really = -1;
+#endif /* HAVE_UTIMENSAT */
+
+  /* The platform lacks an interface to set file timestamps with
+     nanosecond resolution, so do the best we can, discarding any
+     fractional part of the timestamp.  */
+
+  if (adjustment_needed || REPLACE_FUNC_STAT_FILE)
+    {
+      if (adjustment_needed != 3 && lstat (file, &st))
+        return -1;
+      if (ts && update_timespec (&st, &ts))
+        return 0;
+    }
+
+  /* On Linux, lutimes is a thin wrapper around utimensat, so there is
+     no point trying lutimes if utimensat failed with ENOSYS.  */
+#if HAVE_LUTIMES && !HAVE_UTIMENSAT
+  {
+    struct timeval timeval[2];
+    struct timeval *t;
+    int result;
+    if (ts)
+      {
+        timeval[0].tv_sec = ts[0].tv_sec;
+        timeval[0].tv_usec = ts[0].tv_nsec / 1000;
+        timeval[1].tv_sec = ts[1].tv_sec;
+        timeval[1].tv_usec = ts[1].tv_nsec / 1000;
+        t = timeval;
+      }
+    else
+      t = NULL;
+
+    result = lutimes (file, t);
+    if (result == 0 || errno != ENOSYS)
+      return result;
+  }
+#endif /* HAVE_LUTIMES && !HAVE_UTIMENSAT */
+
+  /* Out of luck for symlinks, but we still handle regular files.  */
+  if (!(adjustment_needed || REPLACE_FUNC_STAT_FILE) && lstat (file, &st))
+    return -1;
+  if (!S_ISLNK (st.st_mode))
+    return fdutimens (-1, file, ts);
+  errno = ENOSYS;
+  return -1;
+}
diff --git a/lib/utimens.h b/lib/utimens.h
new file mode 100644 (file)
index 0000000..8c47cf9
--- /dev/null
@@ -0,0 +1,19 @@
+#include <time.h>
+int fdutimens (int, char const *, struct timespec const [2]);
+int utimens (char const *, struct timespec const [2]);
+int lutimens (char const *, struct timespec const [2]);
+
+#if GNULIB_FDUTIMENSAT
+# include <fcntl.h>
+# include <sys/stat.h>
+
+int fdutimensat (int fd, int dir, char const *name, struct timespec const [2],
+                 int atflag);
+
+/* Using this function makes application code slightly more readable.  */
+static inline int
+lutimensat (int dir, char const *file, struct timespec const times[2])
+{
+  return utimensat (dir, file, times, AT_SYMLINK_NOFOLLOW);
+}
+#endif
index 9a8caad001d9d76148ca624633f9b8a4e8f4b0af..cef14ad1571eb64a9f4006f696645b265dbf339f 100644 (file)
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005-2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2012 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 # define _GL_VERIFY_H
 
 
-/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per the
-   C1X draft N1548 section 6.7.10.  This is supported by GCC 4.6.0 and
-   later, in C mode, and its use here generates easier-to-read diagnostics
-   when verify (R) fails.
+/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert works as per C11.
+   This is supported by GCC 4.6.0 and later, in C mode, and its use
+   here generates easier-to-read diagnostics when verify (R) fails.
 
-   Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per the
-   C++0X draft N3242 section 7.(4).
+   Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
    This will likely be supported by future GCC versions, in C++ mode.
 
    Use this only with GCC.  If we were willing to slow 'configure'
@@ -188,7 +186,7 @@ template <int w>
    trailing ';'.  If R is false, fail at compile-time, preferably
    with a diagnostic that includes the string-literal DIAGNOSTIC.
 
-   Unfortunately, unlike C1X, this implementation must appear as an
+   Unfortunately, unlike C11, this implementation must appear as an
    ordinary declaration, and cannot appear inside struct { ... }.  */
 
 # ifdef _GL_HAVE__STATIC_ASSERT
@@ -205,7 +203,7 @@ template <int w>
 #   define _Static_assert(R, DIAGNOSTIC) _GL_VERIFY (R, DIAGNOSTIC)
 #  endif
 #  if !defined _GL_HAVE_STATIC_ASSERT && !defined static_assert
-#   define static_assert _Static_assert /* Draft C1X requires this #define.  */
+#   define static_assert _Static_assert /* C11 requires this #define.  */
 #  endif
 # endif
 
index 1faebf5b0830319f9a7491db6e0be48a2ee3799c..1648aa3bea7a3073628b3bb7983f5d806e1b4215 100644 (file)
-2012-07-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+2012-07-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * progmodes/sh-script.el (sh-syntax-propertize-function): Fix last
        change (bug#11826).
 
-2012-07-02  Glenn Morris  <rgm@gnu.org>
+2012-07-17  Glenn Morris  <rgm@gnu.org>
+2012-07-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/cc-engine.el (c-forward-sws, c-backward-sws):
+       Avoid spuriously marking the buffer as modified because of c-is-sws.
+
+       * progmodes/sh-script.el (sh-syntax-propertize-function): Mark "${#VAR"
+       as not-a-comment (bug#11946).
+
+       * emacs-lisp/macroexp.el (macroexp-let2): Use more informative names
+       for uninterned vars.
+
+       * xt-mouse.el (xterm-mouse-translate-1, xterm-mouse-event-read):
+       Use read-event since we don't really want to read chars but bytes.
+
+       * textmodes/tex-mode.el (tex-font-lock-keywords-1): Highlight not only
+       $$..$$ but also $..$ using regexps (bug#11953).
+       Use tex-verbatim for \url and \path.
+       (tex-font-lock-keywords): Define as defconst like the others.
+       (tex-common-initialization): Don't use font-lock-syntax-table any more.
+
+2012-07-16  René Kyllingstad  <Rene@Kyllingstad.com>  (tiny change)
+
+       * international/mule-cmds.el (ucs-insert): Make it an obsolete
+       alias for insert-char.
+
+2012-07-16  Fabián Ezequiel Gallina  <fgallina@cuca>
+
+       * progmodes/python.el: Simplified imenu implementation.
+       (python-nav-jump-to-defun): Remove command.
+       (python-mode-map): Use `imenu' instead.
+       (python-nav-list-defun-positions-cache)
+       (python-imenu-include-defun-type, python-imenu-make-tree)
+       (python-imenu-subtree-root-label, python-imenu-index-alist):
+       Remove vars.
+       (python-nav-list-defun-positions, python-nav-read-defun)
+       (python-imenu-tree-assoc, python-imenu-make-element-tree)
+       (python-imenu-make-tree, python-imenu-create-index):
+       Remove functions.
+       (python-mode): Update to interact with imenu by setting
+       `imenu-extract-index-name-function' only.
+
+2012-07-16  Fabián Ezequiel Gallina  <fgallina@cuca>
+
+       * progmodes/python.el: Enhancements to navigation commands.
+       (python-nav-backward-sentence)
+       (python-nav-forward-sentence): Remove.
+       (python-nav-backward-statement, python-nav-forward-statement)
+       (python-nav-statement-start, python-nav-statement-end)
+       (python-nav-backward-block, python-nav-forward-block)
+       (python-nav-block-start, python-nav-block-end)
+       (python-nav-forward-sexp-function)
+       (python-info-current-line-comment-p)
+       (python-info-current-line-empty-p): New functions.
+       (python-indent-context): Use `python-nav-statement-start'.
+
+2012-07-16  Michael Albinus  <michael.albinus@gmx.de>
+
+       * eshell/em-ls.el (eshell/ls): Use `apply'.
+
+       * eshell/em-unix.el (eshell/su, eshell/sudo): Apply Tramp's ad-hoc
+       multi-hops, instead of Tramp internals.
+
+       * vc/ediff.el (ediff-directories): Add trailing space to prompts.
+
+       * vc/ediff-diff.el (ediff-same-file-contents): Handle the case,
+       when F1 and F2 are located on different hosts.
+
+2012-07-14  Chong Yidong  <cyd@gnu.org>
+
+       * xt-mouse.el: Implement extended mouse coordinates (Bug#10642).
+       (xterm-mouse-translate): Move code into xterm-mouse-translate-1.
+       (xterm-mouse-translate-extended, xterm-mouse-translate-1)
+       (xterm-mouse--read-event-sequence-1000)
+       (xterm-mouse--read-event-sequence-1006): New functions.  For old
+       mouse protocol, handle M-mouse-X events correctly.
+       (xterm-mouse-event): New arg specifying mouse protocol.
+       (turn-on-xterm-mouse-tracking-on-terminal)
+       (turn-off-xterm-mouse-tracking-on-terminal): Send DEC 1006
+       sequence to toggle extended coordinates on newer XTerms.
+       This appears to be harmless on terminals which do not support this.
+
+2012-07-14  Leo Liu  <sdl.web@gmail.com>
+
+       Add fringe bitmap indicators for flymake.  (Bug#11253)
+       * progmodes/flymake.el (flymake-highlight-line): Use fringe bitmaps.
+       (flymake-make-overlay): New arg BITMAP.
+       (flymake-error-bitmap, flymake-warning-bitmap)
+       (flymake-fringe-indicator-position): New user variables.
+
+       * fringe.el: New bitmap exclamation-mark.
+
+2012-07-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * progmodes/cc-cmds.el (c-defun-name): Recognize Objective-C methods
+       also (Bug#7879).
+
+2012-07-14  Chong Yidong  <cyd@gnu.org>
+
+       * electric.el (electric-pair-post-self-insert-function): Fix pair
+       insertion in empty-region case (Bug#11520).
+
+2012-07-14  Chong Yidong  <cyd@gnu.org>
+
+       * bindings.el: Consolidate ctl-x-r-map bindings.
+       Bind copy-rectangle-as-kill to C-x r w.
+
+       * rect.el, register.el: Move bindings to bindings.el.
+
+2012-07-14  Reuben Thomas  <rrt@sc3d.org>
+
+       * rect.el (copy-rectangle-as-kill): New command (Bug#739).
+
+2012-07-13  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * emacs-lisp/cl.el (labels): Remove spurious quote.  (Bug#11938)
+
+2012-07-13  Juanma Barranquero  <lekktu@gmail.com>
+
+       * bindings.el (top): Use `mapc' instead of `mapcar'.
+
+       * loadup.el (top): Remove bogus `if' choice (brought by 2008-06-21T01:38:39Z!monnier@iro.umontreal.ca).
+
+2012-07-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * progmodes/sql.el (sql-comint): Suppress the check for program on
+       remote hosts.  Reported by Francis Devereux <francis@devrx.org>.
+       (Bug#11908)
+
+2012-07-13  Chong Yidong  <cyd@gnu.org>
+
+       * bindings.el: Assign a non-nil permanent-local property to
+       per-buffer variables which lack a default value (Bug#11930).
+
+       * help-fns.el (describe-variable): In the "automatically becomes
+       local" notice, take note of permanent-local variables.
+
+2012-07-13  Chong Yidong  <cyd@gnu.org>
+
+       * files.el (toggle-read-only): Doc fix and code cleanup.  New arg
+       to allow printing the message when called from Lisp.
+
+       * emacs-lisp/bytecomp.el (byte-compile-interactive-only-functions):
+       Remove toggle-read-only.
+
+       * bs.el (bs-toggle-readonly):
+       * buff-menu.el (Buffer-menu-toggle-read-only):
+       Remove with-no-warnings around toggle-read-only.
+
+       * ffap.el (ffap--toggle-read-only): Accept a list of buffers.
+       Remove with-no-warnings around toggle-read-only.
+       (ffap-read-only, ffap-read-only-other-window)
+       (ffap-read-only-other-frame): Callers changed.
+
+       * help-mode.el: Don't require view package.
+       (help-mode-finish): Set buffer-read-only instead of calling
+       toggle-read-only.
+
+       * bindings.el (mode-line-toggle-read-only):
+       * dired.el (dired-toggle-read-only):
+       * ibuffer.el (ibuffer-do-toggle-read-only): Call toggle-read-only
+       with non-nil second arg.
+
+       * emacs-lisp/eieio-custom.el (eieio-customize-object):
+       * vc/ediff.el (ediff-set-read-only-in-buf-A): Set buffer-read-only
+       directly.
+
+2012-07-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * emacs-lisp/bytecomp.el (byte-recompile-directory): Use cl-incf,
+       not incf.
+
+2012-07-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       More CL cleanups and reduction of use of cl.el.
+       * woman.el, winner.el, vc/vc-rcs.el, vc/vc-hooks.el, vc/vc-hg.el:
+       * vc/vc-git.el, vc/vc-dir.el, vc/vc-bzr.el, vc/vc-annotate.el:
+       * textmodes/tex-mode.el, textmodes/sgml-mode.el, tar-mode.el:
+       * strokes.el, ses.el, server.el, progmodes/js.el, progmodes/gdb-mi.el:
+       * progmodes/flymake.el, progmodes/ebrowse.el, progmodes/compile.el:
+       * play/tetris.el, play/snake.el, play/pong.el, play/landmark.el:
+       * play/hanoi.el, play/decipher.el, play/5x5.el, nxml/nxml-mode.el:
+       * net/secrets.el, net/quickurl.el, midnight.el, mail/footnote.el:
+       * image-dired.el, ibuffer.el, ibuf-macs.el, ibuf-ext.el, hexl.el:
+       * eshell/eshell.el, eshell/esh-io.el, eshell/esh-ext.el:
+       * eshell/esh-cmd.el, eshell/em-ls.el, eshell/em-hist.el:
+       * eshell/em-cmpl.el, eshell/em-banner.el:
+       * calendar/parse-time.el: Use cl-lib.
+       * wid-browse.el, wdired.el, vc/vc.el, vc/vc-mtn.el, vc/vc-cvs.el:
+       * vc/vc-arch.el, tree-widget.el, textmodes/texinfo.el:
+       * textmodes/refill.el, textmodes/css-mode.el, term/tvi970.el:
+       * term/ns-win.el, term.el, shell.el, ps-samp.el:
+       * progmodes/perl-mode.el, progmodes/pascal.el, progmodes/gud.el:
+       * progmodes/glasses.el, progmodes/etags.el, progmodes/cwarn.el:
+       * play/gamegrid.el, play/bubbles.el, novice.el, notifications.el:
+       * net/zeroconf.el, net/xesam.el, net/snmp-mode.el, net/mairix.el:
+       * net/ldap.el, net/eudc.el, net/browse-url.el, man.el:
+       * mail/mailheader.el, mail/feedmail.el: Don't use CL.
+       * ibuf-ext.el (ibuffer-mark-old-buffers): Use float-time.
+       * eshell/esh-opt.el (eshell-eval-using-options): Quote code with
+       `lambda' rather than with `quote'.
+       (eshell-do-opt): Adjust accordingly.
+       (eshell-process-option): Simplify.
+       * eshell/esh-var.el:
+       * eshell/em-script.el: Require `esh-opt' for eshell-eval-using-options.
+       * emacs-lisp/pcase.el (pcase--dontcare-upats, pcase--let*)
+       (pcase--expand, pcase--u1): Rename pcase's internal `dontcare' pattern
+       to `pcase--dontcare'.
+       * emacs-lisp/cl.el (labels): Mark obsolete.
+       (cl--letf, letf): Move to cl-lib.
+       (cl--letf*, letf*): Remove.
+       * emacs-lisp/cl-lib.el (cl-nth-value): Use defalias.
+       * emacs-lisp/cl-macs.el (cl-dolist, cl-dotimes): Add indent rule.
+       (cl-progv): Rewrite.
+       (cl--letf, cl-letf): Move from cl.el.
+       (cl-letf*): New macro.
+       * emacs-lisp/cl-extra.el (cl--progv-before, cl--progv-after): Remove.
+
+2012-07-11  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/ange-ftp.el (ange-ftp-cf1): Update the files cache.
+
+2012-07-11  Chong Yidong  <cyd@gnu.org>
+
+       * vc/log-edit.el (log-edit-vc-backend): New variable.
+       (log-edit): Doc fix.
+
+       * vc/vc-dispatcher.el (vc-log-edit): New args.  Use PARAMS
+       argument of log-edit to set up all local variables.
+       (vc-start-logentry): New optional arg specifying VC backend.
+
+       * vc/vc.el (vc-checkin): Use it.
+       (vc-deduce-fileset): Handle Log Edit buffers.
+       (vc-diff): Make first argument optional too.
+
+       * vc/log-view.el (log-view-vc-fileset, log-view-vc-backend): Doc fix.
+
+2012-07-10  Michael Albinus  <michael.albinus@gmx.de>
+
+       * eshell/esh-ext.el (eshell-remote-command): Remove remote part of
+       command, just in case.  The function is not needed anymore.
+       (eshell-external-command): Do not call `eshell-remote-command'.
+
+2012-07-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Reduce use of (require 'cl).
+       * vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
+       * vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
+       * register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
+       * msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
+       * international/quail.el, info-xref.el, imenu.el, image-mode.el:
+       * font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
+       * battery.el, avoid.el, abbrev.el: Use cl-lib.
+       * vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
+       * vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
+       * jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
+       * emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
+       * calculator.el, autorevert.el, apropos.el: Don't require CL.
+       * emacs-lisp/bytecomp.el (byte-recompile-directory, display-call-tree)
+       (byte-compile-unfold-bcf, byte-compile-check-variable):
+       * emacs-lisp/byte-opt.el (byte-compile-trueconstp)
+       (byte-compile-nilconstp):
+       * emacs-lisp/autoload.el (make-autoload): Use pcase.
+       * face-remap.el (text-scale-adjust): Simplify pcase patterns.
+
+       * emacs-lisp/gv.el (cond): Make it a valid place.
+       (if): Simplify slightly.
+
+       * emacs-lisp/pcase.el (pcase): Accept self-quoting exps as "upatterns".
+       (pcase--self-quoting-p): New function.
+       (pcase--u1): Use it.
+
+2012-07-10  Glenn Morris  <rgm@gnu.org>
+
+       * emacs-lisp/authors.el (authors-fixed-entries):
+       (authors-renamed-files-alist): Update for configure.in -> configure.ac.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Rename configure.in to configure.ac (Bug#11603).
+       * emacs-lisp/authors.el (authors-canonical-file-name):
+       * progmodes/autoconf.el (autoconf-mode):
+       Prefer configure.ac to configure.in.
+
+2012-07-08  Chong Yidong  <cyd@gnu.org>
+
+       * mouse.el (mouse-drag-line): Rewrite the track-mouse loop.
+       Implement the mouse-1-click-follows-link handling properly.
+
+       * info.el (Info-link-keymap): Use follow-link mechanism for
+       header-line links (Bug#374).
+
+       * simple.el (deactivate-mark): Do not set the primary selection
+       if another program has acquired it (Bug#11772).
+
+2012-07-07  Kevin Ryde  <user42@zip.com.au>
+
+       * woman.el (woman-strings): Fix double-quote handling (Bug#1151).
+       (woman-decode-region): Replace escaped-escapes without destroying
+       bold or underline (Bug#11552).
+       (woman2-process-escapes): Handle nofill regions (Bug#11591).
+
+2012-07-07  Chong Yidong  <cyd@gnu.org>
+
+       * simple.el (yank-pop-change-selection): Doc fix (Bug#11361).
+       (interprogram-cut-function, interprogram-paste-function):
+       Mention that we typically mean the clipboard.
+
+2012-07-06  Glenn Morris  <rgm@gnu.org>
+
+       * kmacro.el (kmacro-call-macro): Restore repeat message.  (Bug#11817)
+
+       * files.el (toggle-read-only): Restrict message to interactive use.
+
+2012-07-06  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-restricted-shell-hosts-alist): New defcustom.
+
+       * net/tramp-sh.el (tramp-maybe-open-connection): Handle it.
+
+2012-07-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (compile-one-process): Rename from "recompile".
+
+       * Makefile.in (bzr-update): "compile" is the same as "recompile
+       autoloads", but parallelizable, so use that instead.
+
+2012-07-06  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * window.el (quit-window): Always restore window height when
+       it's saved in quit-restore parameter.
+
+2012-07-06  Glenn Morris  <rgm@gnu.org>
 
        * simple.el (kill-whole-line): Doc tweak.
 
-2012-07-01  Eli Zaretskii  <eliz@gnu.org>
+2012-07-06  Eli Zaretskii  <eliz@gnu.org>
+
+       * files.el (file-relative-name): Compare file names
+       case-insensitively if on MS-Windows or MS-DOS, or if
+       read-file-name-completion-ignore-case is non-nil.  Don't use
+       case-fold-search for this purpose.  (Bug#11827)
+
+2012-07-17  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * calendar/cal-dst.el (calendar-current-time-zone):
+       Return calendar-current-time-zone-cache if non-nil.
+
+2012-07-17  Masatake YAMATO  <yamato@redhat.com>
+2012-07-06  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * calendar/cal-dst.el (calendar-current-time-zone):
+       Return calendar-current-time-zone-cache if non-nil.
+
+2012-07-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (cvs-update): Remove old alias.
+
+2012-07-05  Michael Albinus  <michael.albinus@gmx.de>
+
+       Sync with Tramp 2.2.6-pre.
+
+       * net/tramp.el (tramp-drop-volume-letter): Provide an XEmacs
+       compatible declaration.
+
+       * net/tramp-cmds.el (tramp-append-tramp-buffers):
+       Protect `list-load-path-shadows' call.
+
+       * net/tramp-compat.el (top): Require packages, which aren't
+       autoloaded anymore for XEmacs.  Protect call of
+       `tramp-file-name-handler' by `tramp-compat-funcall', pacifying the
+       compiler.  Do not require tramp-util.el and tramp-vc.el anymore,
+       it hurts at least for SXEmacs.
+       (tramp-compat-temporary-file-directory): In XEmacs, there is no
+       standard-value for `temporary-file-directory'.
+
+       * net/tramp-sh.el (tramp-do-directory-files-and-attributes-with-stat):
+       Redirect stderr to /dev/null.
+       (tramp-sh-handle-write-region): uid and gid can be floats.
+       Reported by Russell Sim <russell.sim@gmail.com>.
+       (tramp-sh-handle-vc-registered): Hide errors.
+       (tramp-vc-file-name-handler): Use dummy results for `process-file'
+       and `start-file-process'.
+       (tramp-maybe-open-connection): Check also whether `non-essential'
+       is bound.
+
+2012-07-04  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el (xml--parse-buffer): Use xml-syntax-table.
+       (xml-parse-tag): Likewise, and avoid changing entity tables.
+       (xml-syntax-table): Define from scratch, making sure not to give
+       x2000 and other Unicode spaces whitespace syntax, since those are
+       not spaces in XML.
+       (xml-parse-fragment): Delete unused function.
+       (xml-name-start-char-re, xml-name-char-re, xml-name-re)
+       (xml-names-re, xml-nmtoken-re, xml-nmtokens-re, xml-char-ref-re)
+       (xml-entity-ref, xml-pe-reference-re)
+       (xml-reference-re,xml-att-value-re, xml-tokenized-type-re)
+       (xml-notation-type-re, xml-enumeration-re, xml-enumerated-type-re)
+       (xml-att-type-re, xml-default-decl-re, xml-att-def-re)
+       (xml-entity-value-re): Use syntax references in regexps where
+       possible; no need to define inside a let-binding.
+       (xml-parse-dtd): Use xml-pe-reference-re.
+       (xml-entity-or-char-ref-re): New defconst.
+       (xml-parse-string, xml-substitute-special): Use it.
+
+2012-07-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * files.el (locate-dominating-file): Allow `name' to be a predicate.
+       (find-file--read-only): New function.
+       (find-file-read-only, find-file-read-only-other-window)
+       (find-file-read-only-other-frame): Use it.
+       (insert-file-contents-literally): Don't `fset'.
+       (get-free-disk-space): Use locate-dominating-file.
+
+       * emacs-lisp/bytecomp.el (byte-compile): Don't signal an error if the
+       function is already compiled.
+
+       * xml.el (xml-name-regexp): Remove, redundant.  Use xml-name-re.
+
+2012-07-03  Michael Albinus  <michael.albinus@gmx.de>
+
+       * vc/ediff-diff.el (ediff-same-file-contents): Fix it for remote
+       files on the same host.
+
+2012-07-03  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * help-fns.el (describe-function-1): Only call
+       help-fns--autoloaded-p when we have a file name.  (Bug#11848)
+
+2012-07-03  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el: Protect parser against XML bombs.
+       (xml-entity-expansion-limit): New variable.
+       (xml-parse-string, xml-substitute-special): Use it.
+       (xml-parse-dtd): Avoid infloop if the DTD is not terminated.
+
+2012-07-03  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/bug-reference.el (bug-reference-bug-regexp):
+       Allow linking to specific messages in debbugs reports (eg 123#5).
+
+2012-07-02  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el: Fix entity and character reference expansion, allowing
+       them to expand into markup as per XML spec.
+       (xml-default-ns): New variable.
+       (xml-entity-alist): Use XML spec definitions for lt and amp.
+       (xml-parse-region): Make first two arguments optional.
+       Discard text properties.
+       (xml-parse-tag-1): New function, spun off from xml-parse-tag.
+       All callers changed.
+       (xml-parse-tag): Call xml-parse-tag-1.  For backward
+       compatibility, this function should not modify buffer contents.
+       (xml-parse-tag-1): Fix opening-tag regexp.
+       (xml-parse-string): Rewrite, handling entity and character
+       references properly.
+       (xml--entity-replacement-text): Signal an error if a parameter
+       entity is undefined.
+
+2012-07-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * comint.el (comint-output-filter): Filter out repeated prompts.
+
+       * net/ange-ftp.el (ange-ftp-expand-file-name): Use ange-ftp-ftp-name
+       and file-name-absolute-p.
+       (ange-ftp-file-exists-p): Use ange-ftp-file-exists-p for
+       internal calls.
+
+2012-07-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Spelling fixes.
+       * emacs-lisp/bytecomp.el (byte-compile--reify-function):
+       Rename from byte-compile--refiy-function.  All uses changed.
+
+2012-07-01  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el (xml--parse-buffer): New function.  Move most of
+       xml-parse-region here.
+       (xml-parse-region): Copy region into a temporary buffer, since
+       parameter entity substitution requires changing buffer contents.
+       Use xml--parse-buffer.
+       (xml-parse-file): Use xml--parse-buffer.
+       (xml-parse-dtd): Make parameter entity substitution work right.
+       Use proper regexps for ELEMENT declarations (Bug#7172).
+
+2012-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * comint.el (follow-comint-scroll-to-bottom): Fix declaration.
+
+       * net/secrets.el, net/tramp-gvfs.el, net/xesam.el, net/zeroconf.el:
+       Remove outdated and unnecessary dbus declarations.
+
+2012-06-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * emacs-lisp/timer.el (timer-until): Subtract results of
+       float-time, instead of taking float-time of the result of
+       time-subtract, since float-time signals an error for negative time
+       arguments.
+
+2012-06-30  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el (xml-*-re): Convert defvars into defconsts, and
+       eval-and-compile them so eval-and-compile works on derivatives.
+       (xml--entity-replacement-text): Use eval-and-comple.
+
+2012-06-30  Michael Albinus  <michael.albinus@gmx.de>
+
+       * vc/vc-git.el (vc-git-registered): Use cache property
+       `git-registered'.
+       (vc-git-mode-line-string): Call `vc-working-revision' instead of
+       `vc-git-working-revision' in order to benefit from the cache.
+       (vc-git-root): Use cache property `git-root'.  (Bug#11757)
+
+2012-06-30  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * vc/vc-hooks.el (vc-before-save): Clear cache if file has been
+       removed (likely outside Emacs).  (Bug#11757)
+
+2012-06-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-lib.el: Require macroexp.
+
+2012-06-30  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el: Implement XML parameter entities.
+       (xml-parameter-entity-alist): New variable.
+       (xml-parse-region, xml-parse-fragment): Preserve previous values
+       of xml-entity-alist and xml-parameter-entity-alist, so that
+       repeated calls on different documents do not change them.
+       (xml-parse-tag): Fix doctype regexp.
+       (xml--entity-replacement-text): New function.
+       (xml-parse-dtd): Use it.  Don't handle system entities; doing that
+       properly requires url retrieval which is unimplemented.
+       (xml-escape-string): Doc fix.
+
+2012-06-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-lib.el (cl-pushnew): Use macroexp-let2.
+
+2012-06-29  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * fringe.el (fringe-mode): Doc fix.
+
+2012-06-29  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/ange-ftp.el (ange-ftp-get-passwd): Throw if `non-essential'
+       is non-nil.
+       (ange-ftp-ignore-errors-if-non-essential): New defmacro.
+       (ange-ftp-file-name-all-completions): Use it.  (Bug#11808)
+
+2012-06-29  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * calendar/cal-dst.el (calendar-current-time-zone):
+       Return calendar-current-time-zone-cache if non-nil.
+
+2012-06-29  Masatake YAMATO  <yamato@redhat.com>
+
+       * progmodes/which-func.el (which-func-format):
+       Add mouse-face.  (Bug#11698)
+
+2012-06-29  Leo Liu  <sdl.web@gmail.com>
+
+       * textmodes/enriched.el (enriched-next-annotation): Use eq (Bug#11528).
+
+2012-06-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (minibuffer-confirm-exit-commands):
+       Add completion-at-point (bug#11725).
+
+2012-06-29  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/f90.el (f90-font-lock-keywords-2):
+       Add some preprocessor elements.  (Bug#10499)
+
+2012-06-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/cperl-mode.el (cperl-update-syntaxification):
+       Use syntax-propertize (bug#11739).
+
+2012-06-28  Juanma Barranquero  <lekktu@gmail.com>
+
+       * emacs-lisp/cl-lib.el (cl-pushnew): Don't capture X (bug#11811).
+
+2012-06-28  Julien Danjou  <julien@danjou.info>
+
+       * term.el (term-handle-colors-array): Use a set of new faces to
+       color the terminal.  Also uses :inverse-video property.
+       (term-default-fg-color): Set to nil by default, deprecate in favor
+       of `term-face'.
+       (term-default-bg-color): Set to nil by default, deprecate in favor
+       of `term-face'.
+       (term-current-face): Use `term-face' by default.
+       (term-bold-attribute): Variable deleted.
+
+2012-06-28  Glenn Morris  <rgm@gnu.org>
+
+       * simple.el (completion-list-mode-finish):
+       Don't use toggle-read-only.  (Since completion-list-mode has
+       a special mode-class, it wasn't doing anything extra anyway.)
+
+2012-06-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Make inlining of other-mode interpreted functions work (bug#11799).
+       * emacs-lisp/bytecomp.el (byte-compile--refiy-function): New fun.
+       (byte-compile): Use it to fix compilation of lexical-binding closures.
+       * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Compile the
+       function, if needed.
+
+2012-06-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * help-mode.el (help-make-xrefs): Don't just withstand
+       cyclic-variable-indirection but any error in documentation-property.
+
+       * loadup.el (purify-flag): Pre-grow the hash-table to reduce the
+       memory use.
+       * bindings.el (bindings--define-key): New function.
+       * vc/vc-hooks.el, replace.el, menu-bar.el, international/mule-cmds.el:
+       * emacs-lisp/lisp-mode.el, buff-menu.el, bookmark.el:
+       * bindings.el: Use it to purecopy define-key bindings.
+
+       * textmodes/rst.el (rst-adornment-faces-alist): Avoid copy-list.
+
+       * emacs-lisp/cl.el (flet): Mark obsolete.
+       * emacs-lisp/cl-macs.el (cl-flet*): New macro.
+       * vc/vc-rcs.el (vc-rcs-annotate-command, vc-rcs-parse):
+       * progmodes/js.el (js-c-fill-paragraph):
+       * progmodes/ebrowse.el (ebrowse-switch-member-buffer-to-sibling-class)
+       (ebrowse-switch-member-buffer-to-derived-class):
+       * play/5x5.el (5x5-solver): Use cl-flet.
+
+       * emacs-lisp/cl.el: Use lexical-binding.  Fix flet (bug#11780).
+       (cl--symbol-function): New macro.
+       (cl--letf, cl--letf*): Use it.
+
+       * emacs-lisp/easy-mmode.el (easy-mmode-pretty-mode-name):
+       Strip "toggle-" if any.
+
+2012-06-27  Glenn Morris  <rgm@gnu.org>
+
+       * info.el (Info-default-directory-list): Move here from paths.el.
+       * paths.el: Remove file, which is now empty.
+       * loadup.el: No longer load "paths".
+
+       * custom.el (custom-initialize-delay): Doc fix.
+
+       * eshell/em-alias.el, eshell/em-banner.el, eshell/em-basic.el:
+       * eshell/em-cmpl.el, eshell/em-dirs.el, eshell/em-glob.el:
+       * eshell/em-hist.el, eshell/em-ls.el, eshell/em-pred.el:
+       * eshell/em-prompt.el, eshell/em-rebind.el, eshell/em-script.el:
+       * eshell/em-smart.el, eshell/em-term.el, eshell/em-unix.el:
+       * eshell/em-xtra.el: Replace eshell-defgroup with "(progn (defgroup".
+       * eshell/eshell.el (eshell-defgroup): Remove alias.
+
+2012-06-27  Chong Yidong  <cyd@gnu.org>
+
+       * help.el (help-enable-auto-load): New variable.
+
+       * help-fns.el (help-fns--autoloaded-p): New function.
+       (describe-function-1): Refer to a function as "autoloaded" if it
+       was autoloaded at any time in the past.  Perform autoloading if
+       help-enable-auto-load is non-nil.
+
+2012-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (compile, compile-always): Depend on
+       update-subdirs, not on subdirs.el.  Otherwise, several different
+       sub-targets of 'bootstrap' running in parallel could
+       simultaneously write to subdirs.el, producing a garbled file.
+
+2012-06-26  Sam Steingold  <sds@gnu.org>
+
+       * files.el (file-name-base): New convenience function.
+       * autoinsert.el, cus-dep.el, doc-view.el, image-dired.el:
+       * woman.el, eshell/esh-cmd.el, progmodes/ada-xref.el:
+       * progmodes/cc-defs.el, progmodes/cperl-mode.el:
+       * progmodes/flymake.el, progmodes/gud.el, progmodes/idlwave.el:
+       * textmodes/ispell.el, textmodes/reftex-ref.el:
+       * textmodes/tex-mode.el: Use it.
+       Did not touch cedet and org because they are maintained elsewhere.
+
+2012-06-26  Martin Rudalics  <rudalics@gmx.at>
+
+       * calendar/calendar.el (calendar-exit): Don't try to delete or
+       iconify last frame.  See:
+       http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00372.html
+
+2012-06-25  Jim Diamond  <Jim.Diamond@AcadiaU.ca>  (tiny change)
+
+       * server.el (server-process-filter): Remember dir in the
+       process's `server-client-directory' properties.
+
+2012-06-24  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el (xml-parse-tag): Correctly handle comment embedded in
+       non-tag text.
+
+2012-06-23  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (COMPILE_FIRST): Synch with changes in 2012-06-22T21:24:54Z!monnier@iro.umontreal.ca.
+
+2012-06-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * help-fns.el (describe-variable): Don't croak when doc is not found.
+       * vc/pcvs.el (cvs-retrieve-revision): Avoid toggle-read-only.
+       * menu-bar.el (menu-bar-line-wrapping-menu): Purecopy a tiny bit more.
+       * emacs-lisp/syntax.el (syntax-ppss): Simplify with new `if' place.
+       * emacs-lisp/smie.el (smie-next-sexp): CSE.
+       * emacs-lisp/macroexp.el (macroexp-let2): Fix edebug spec and avoid
+       ((lambda ..) ..).
+       * emacs-lisp/eieio.el (eieio-oref, slot-value): Use simpler defsetf.
+
+2012-06-23  Chong Yidong  <cyd@gnu.org>
+
+       * info.el (Info-mouse-follow-link): Accept symbol values of
+       link-args.  Select window; suggested by Gerhard Kahl (Bug#11672).
+       (Info-fontify-node): Use Info-link-keymap for all navigation
+       buttons, with link-args property to perform the desired action.
+       (Info-link-keymap): Doc fix.
+       (Info-next-link-keymap, Info-prev-link-keymap)
+       (Info-up-link-keymap): Delete now-unused keymaps.
+
+2012-06-23  Chong Yidong  <cyd@gnu.org>
+
+       * mouse.el (mouse-drag-track): Deactivate the mark before popping.
+
+       * progmodes/python.el (python-skeleton-define): Mark abbrevs as
+       system abbrevs.
+
+       * ansi-color.el (ansi-color-apply-on-region): Doc fix.
+
+2012-06-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-macs.el (cl--make-usage-args): Handle improper lists
+       (bug#11719).
+
+       * minibuffer.el (completion--twq-try): Try to fail more gracefully when
+       the requote function doesn't work properly (bug#11714).
+
+2012-06-23  Glenn Morris  <rgm@gnu.org>
+
+       * pcmpl-rpm.el (pcmpl-rpm-packages): Give status messages.
+
+2012-06-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Further GV/CL cleanups.
+       * emacs-lisp/gv.el (gv-get): Autoload functions to find their
+       gv-expander.
+       (gv--defun-declaration): New function.
+       (defun-declarations-alist): Use it.
+       (gv-define-modify-macro, gv-pushnew!, gv-inc!, gv-dec!): Remove.
+       (gv-place): Autoload.
+       * emacs-lisp/cl.el (cl--dotimes, cl--dolist): Remember subr.el's
+       original definition of dotimes and dolist.
+       * emacs-lisp/cl-macs.el (cl-expr-access-order): Remove unused.
+       (cl-dolist, cl-dotimes): Use `dolist' and `dotimes'.
+       * emacs-lisp/cl-lib.el: Move gv handlers from cl-macs to here.
+       (cl-fifth, cl-sixth, cl-seventh, cl-eighth)
+       (cl-ninth, cl-tenth): Move gv handler to the function's definition.
+       * emacs-lisp/cl-extra.el (cl-subseq, cl-get, cl-getf): Move gv handler
+       to the function's definition.
+       * Makefile.in (COMPILE_FIRST): Re-order to speed it up by about 50%.
+       * window.el:
+       * files.el:
+       * faces.el:
+       * env.el: Don't use CL.
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Support higher-resolution time stamps (Bug#9000).
+
+       * calendar/time-date.el (with-decoded-time-value): New arg
+       PICO-SYMBOL in VARLIST.  It's optional, for backward compatibility.
+       (encode-time-value): New optional arg PICO.  New type 3.
+       (time-to-seconds) [!float-time]: Support the new picoseconds
+       component if it's used.
+       (seconds-to-time, time-subtract, time-add):
+       Support ps-resolution time stamps as well.
+
+       * emacs-lisp/timer.el (timer): New component psecs.  All uses changed.
+       (timerp): Timer vectors now have length 9, not 8.
+       (timer--time): Support new-style (4-part) time stamps.
+       (timer-next-integral-multiple-of-time): Time stamps now have
+       picosecond resolution, so take a bit more care about rounding.
+       (timer-relative-time, timer-inc-time): New optional arg psecs.
+       (timer-set-time-with-usecs): Set psecs to 0.
+       (timer--activate): Check psecs component, too.
+
+       * proced.el (proced-time-lessp): Support ps-resolution stamps.
+
+2012-06-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * icomplete.el (icomplete-minibuffer-setup, icomplete-completions):
+       Move the non-essential binding to the post/pre-command-hook where it is
+       more obviously correct.
+
+       * subr.el (read-passwd): Don't use a history at all.
+       * savehist.el (savehist-save): Remove password saved accidentally
+       because of the above bug.
+
+2012-06-22  Bastien Guerry  <bzg@gnu.org>
+
+       * files.el (toggle-read-only): Display a message telling whether
+       the buffer is read-only or not (bug#11726).
+
+2012-06-22  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/gv.el: New file.
+       * subr.el (push, pop): Extend to generalized variables.
+       * loadup.el (macroexp): Unload if preloaded and uncompiled (bug#11657).
+       * emacs-lisp/cl-lib.el (cl-pop, cl-push, cl--set-nthcdr): Remove.
+       * emacs-lisp/cl-macs.el: Require gv.  Use gv-define-setter,
+       gv-define-simple-setter, and gv-define-expander.
+       Remove setf-methods defined in gv.  Rename cl-setf -> setf.
+       (cl-setf, cl-do-pop, cl-get-setf-method): Remove.
+       (cl-letf, cl-letf*, cl-define-modify-macro, cl-defsetf)
+       (cl-define-setf-expander, cl-struct-setf-expander): Move to cl.el.
+       (cl-remf, cl-shiftf, cl-rotatef, cl-callf, cl-callf2): Rewrite with
+       gv-letplace.
+       (cl-defstruct): Don't define setf-method any more.
+       * emacs-lisp/cl.el (flet): Don't autoload.
+       (cl--letf, letf, cl--letf*, letf*, cl--gv-adapt)
+       (define-setf-expander, defsetf, define-modify-macro)
+       (cl-struct-setf-expander): Move from cl-lib.el.
+       * emacs-lisp/syntax.el:
+       * emacs-lisp/ewoc.el:
+       * emacs-lisp/smie.el:
+       * emacs-lisp/cconv.el:
+       * emacs-lisp/timer.el: Rename cl-setf -> setf, cl-push -> push.
+       (timer--time): Use gv-define-simple-setter.
+       * emacs-lisp/macroexp.el (macroexp-let2): Rename from macroexp-let²
+       to avoid coding-system problems in subr.el.  Adjust all users.
+       (macroexp--maxsize, macroexp-small-p): New functions.
+       * emacs-lisp/bytecomp.el (byte-compile-file): Don't use cl-letf.
+       * scroll-bar.el (scroll-bar-mode):
+       * simple.el (auto-fill-mode, overwrite-mode, binary-overwrite-mode)
+       (normal-erase-is-backspace-mode): Don't use the `eq' place.
+       * winner.el (winner-configuration, winner-make-point-alist)
+       (winner-set-conf, winner-get-point, winner-set): Don't abuse letf.
+       * files.el (locate-file-completion-table): Avoid list*.
+
+2012-06-22  Chong Yidong  <cyd@gnu.org>
+
+       * dired-aux.el (dired-do-create-files): Doc fix (Bug#11327).
+       (dired-create-files): Doc fix (Bug#11329).
+       (dired-do-copy): Doc fix (Bug#11334).
+       (dired-mark-read-string): Doc fix (Bug#11553).
+
+       * dired.el (dired-recursive-copies, dired-recursive-deletes):
+       Doc fix (Bug#11326).
+       (dired-make-relative): Doc fix (Bug#11332).  Remove unused arg.
+       (dired-dwim-target): Doc fix.
+
+       * wdired.el (wdired-mode): Doc fix.
+
+2012-06-22  Glenn Morris  <rgm@gnu.org>
+
+       * pcmpl-rpm.el (pcmpl-rpm-cache): New option.
+       (pcmpl-rpm-cache-stamp-file): New constant.
+       (pcmpl-rpm-cache-time, pcmpl-rpm-packages): New variables.
+       (pcmpl-rpm-packages): Optionally cache list of packages.
+
+       * pcmpl-rpm.el (pcmpl-rpm): New group.
+       (pcmpl-rpm-query-options): New option.
+       (pcmpl-rpm-packages): No need to inline it.
+       Use pcmpl-rpm-query-options.
+
+       * calendar/calendar.el (calendar-in-read-only-buffer):
+       Avoid some needless mode changes.
+
+2012-06-21  Chong Yidong  <cyd@gnu.org>
+
+       * desktop.el (desktop-read): Don't prompt if daemon (Bug#11674).
+       (desktop-path): Remove . from the default value (Bug#10977).
+       (desktop-read): Use user-emacs-directory if desktop-path is nil.
+
+2012-06-20  Chong Yidong  <cyd@gnu.org>
+
+       * term.el (term-send-raw-meta): Make C-M-<char> keys work (Bug#8172).
+
+2012-06-20  David Röthlisberger  <david@rothlis.net>  (tiny change)
+
+       * ido.el (ido-switch-buffer, ido-find-file): Fix up doc of C-j
+       (bug#11201).
+
+2012-06-20  Chong Yidong  <cyd@gnu.org>
+
+       * term.el (term-window-width): Handle the case of a missing right
+       fringe (Bug#8837).
+       (term-check-size): Use window-text-height (Bug#5445).
+       (term-mode): Use define-derived-mode.  Minor cleanups.
+       Set font-lock-defaults (Bug#7692).
+       (term-move-columns, term-insert-char, term-emulate-terminal)
+       (term-erase-in-line, term-insert-spaces): Use font-lock-face.
+
+2012-06-20  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/ange-ftp.el (ange-ftp-get-passwd):
+       Bind `enable-recursive-minibuffers'.
+       (ange-ftp-get-process): Throw if `non-essential' is non-nil.
+
+2012-06-19  David Röthlisberger  <david@rothlis.net>  (tiny change)
+
+       * ido.el (ido-find-file): Mention C-d binding in docstring (bug#11244).
+
+2012-06-19  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/python.el (python-mode): Derive from prog-mode.
+
+2012-06-19  Kevin Gallagher  <Kevin.Gallagher@boeing.com>
+
+       * emulation/edt.el (edt-default-menu-bar-update-buffers)
+       (edt-user-menu-bar-update-buffers): New functions.
+       (edt-default-emulation-setup, edt-user-emulation-setup): Use them.
+
+2012-06-19  Chong Yidong  <cyd@gnu.org>
+
+       * subr.el (with-selected-window): Preserve the selected window's
+       terminal's top-frame (Bug#4702).
+
+       * window.el (save-selected-window): Likewise.
+
+2012-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/python.el (python-rx-constituents): Move backquote.
+       (python-skeleton-define, python-define-auxiliary-skeleton):
+       Use `declare'.
+
+2012-06-18  Michael Albinus  <michael.albinus@gmx.de>
+
+       * minibuffer.el (read-file-name-default): Revert the patch from
+       2012-06-17.
+
+2012-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/pcase.el (pcase--expand): Warn for unused pattern.
+       (pcase--u1, pcase--q1): Don't use apply-partially.
+
+2012-06-18  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/python.el (python-proc, python-buffer)
+       (python-send-receive, python-send-string): Fix obsolete versions.
+
+2012-06-18  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (special-display-p): Completely remove stringp
+       check.  Suggested by Andreas Schwab <schwab@linux-m68k.org>.
+
+2012-06-17  Michael Albinus  <michael.albinus@gmx.de>
+
+       * minibuffer.el (read-file-name-default): Bind `non-essential' to `t'.
+
+       * net/tramp.el (tramp-file-name-handler): Catch 'non-essential.
+
+       * net/ange-ftp.el (ange-ftp-gwp-start, ange-ftp-start-process):
+       * net/tramp-sh.el (tramp-maybe-open-connection):
+       Throw if `non-essential' is non-nil.
+
+2012-06-17  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (special-display-p): Signal an error if BUFFER-NAME
+       is not a string (Bug#11713).
+
+2012-06-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * progmodes/python.el (python-info-beginning-of-backslash):
+       Rename from python-info-beginning-of-backlash, as a spelling fix.
+
+2012-06-17  Chong Yidong  <cyd@gnu.org>
+
+       * term.el (term-emulate-terminal): If term-check-size is called,
+       move point to the process mark without resetting point (Bug#4635).
+
+2012-06-17  Glenn Morris  <rgm@gnu.org>
+
+       * international/mule-cmds.el (mule-menu-keymap)
+       (set-language-environment, set-locale-environment): Doc tweaks.
+
+2012-06-16  Aurelien Aptel  <aurelien.aptel@gmail.com>
+
+       * cus-face.el (custom-face-attributes): Add wave-style underline
+       attribute.
+       * faces.el (set-face-attribute): Update docstring to describe
+       wave-style underline attribute.
+
+2012-06-16  Chong Yidong  <cyd@gnu.org>
+
+       * term/xterm.el (terminal-init-xterm): Discard input before
+       querying background mode (Bug#10959).
+
+2012-06-16  Stefan Merten  <smerten@oekonux.de>
+
+       * textmodes/rst.el: Added and corrected some comments.
+       (rst-re-alist-def): Improve symbol syntax.
+       (rst-mode-syntax-table): Correct syntax entries.
+       (rst-cvs-header, rst-svn-rev, rst-svn-timestamp)
+       (rst-official-version, rst-official-cvs-rev): Update version
+       information.
+
+2012-06-15  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (COMPILE_FIRST): Synch with makefile.in changes
+       in 2008-06-22T13:57:28Z!monnier@iro.umontreal.ca.
+
+2012-06-15  Fabián Ezequiel Gallina  <fgallina@cuca>
+
+       * progmodes/python.el: New python.el merge.
+       (python-guess-indent): Obsolete var.
+       (python-indent-guess-indent-offset): New defcustom.
+       (python-indent): Obsolete var.
+       (python-indent-offset): New defcustom.
+       (python-python-command, python-jython-command): Delete var.
+       (python-shell-interpreter): New defcustom.
+       (python-pdbtrack-do-tracking-p): Delete var.
+       (python-pdbtrack-activate): New defcustom.
+       (python-use-skeletons): Obsolete var.
+       (python-skeleton-autoinsert): New defcustom.
+       (inferior-python-filter-regexp, python-continuation-offset)
+       (python-honour-comment-indentation, python-indent-string-contents)
+       (python-jython-packages, python-mode-hook)
+       (python-pdbtrack-minor-mode-string, python-remove-cwd-from-path)
+       (python-shell-prompt-alist)
+       (python-source-modes): Delete defcustoms.
+       (python-check-buffer-name, python-eldoc-setup-code)
+       (python-eldoc-string-code, python-ffap-setup-code)
+       (python-ffap-string-code, python-fill-comment-function)
+       (python-fill-decorator-function, python-fill-paren-function)
+       (python-fill-string-function, python-imenu-include-defun-type)
+       (python-imenu-make-tree, python-imenu-subtree-root-label)
+       (python-pdbtrack-stacktrace-info-regexp, python-shell-buffer-name)
+       (python-shell-compilation-regexp-alist)
+       (python-shell-completion-module-string-code)
+       (python-shell-completion-pdb-string-code)
+       (python-shell-completion-setup-code)
+       (python-shell-completion-string-code)
+       (python-shell-enable-font-lock, python-shell-exec-path)
+       (python-shell-extra-pythonpaths)
+       (python-shell-internal-buffer-name, python-shell-interpreter-args)
+       (python-shell-process-environment)
+       (python-shell-prompt-block-regexp)
+       (python-shell-prompt-output-regexp)
+       (python-shell-prompt-pdb-regexp, python-shell-prompt-regexp)
+       (python-shell-send-setup-max-wait, python-shell-setup-codes)
+       (python-shell-virtualenv-path): New defcustoms.
+       (brm-menu, eldoc-documentation-function, inferior-python-mode-map)
+       (inferior-python-mode-syntax-table, python--prompt-regexp)
+       (python-buffer, python-command python-python-command)
+       (python-default-template, python-imports, python-indent-index)
+       (python-indent-list, python-indent-list-length)
+       (python-mode-running, python-pdbtrack-is-tracking-p)
+       (python-preoutput-continuation, python-preoutput-leftover)
+       (python-preoutput-result, python-preoutput-skip-next-prompt)
+       (python-prev-dir/file, python-recursing)
+       (python-saved-check-command, python-version-checked)
+       (python-which-func-length-limit)
+       (view-return-to-alist): Delete vars.
+       (python-check-custom-command, python-dotty-syntax-table)
+       (python-imenu-index-alist, python-indent-current-level)
+       (python-indent-dedenters, python-indent-levels)
+       (python-nav-beginning-of-defun-regexp)
+       (python-nav-list-defun-positions-cache)
+       (python-pdbtrack-buffers-to-kill, python-pdbtrack-tracked-buffer)
+       (python-shell-internal-buffer)
+       (python-skeleton-available): New vars.
+       (def-python-skeleton): Delete macro.
+       (python-skeleton-define): New macro.
+       (python-define-auxiliary-skeleton, python-rx): New macros.
+       (python-insert-class): Delete command.
+       (python-skeleton-class): New command.
+       (python-insert-def): Delete command.
+       (python-skeleton-def): New command.
+       (python-insert-for): Delete command.
+       (python-skeleton-for): New command.
+       (python-insert-if): Delete command.
+       (python-skeleton-if): New command.
+       (python-insert-try/except, python-insert-try/finally): Delete commands.
+       (python-skeleton-try): New command.
+       (python-insert-while): Delete command.
+       (python-skeleton-while): New command.
+       (python-backspace): Delete command.
+       (python-indent-dedent-line-backspace): New command.
+       (python-electric-colon): Delete command.
+       (python-indent-electric-colon): New command.
+       (python-guess-indent): Delete command.
+       (python-indent-guess-indent-offset): New command.
+       (python-shift-left): Delete command.
+       (python-indent-shift-left): New command.
+       (python-shift-right): Delete command.
+       (python-indent-shift-right): New command.
+       (python-find-function): Delete command.
+       (python-nav-jump-to-defun): New command.
+       (python-next-statement): Delete command.
+       (python-nav-forward-sentence): New command.
+       (python-previous-statement): Delete command.
+       (python-nav-backward-sentence): New command.
+       (python-fill-paragraph): Delete command.
+       (python-fill-paragraph-function): New command.
+       (python-send-buffer): Delete command.
+       (python-shell-send-buffer): New command.
+       (python-send-defun): Delete command.
+       (python-shell-send-defun): New command.
+       (python-send-region, python-send-region-and-go): Delete commands.
+       (python-shell-send-region)
+       (python-shell-switch-to-shell): New commands.
+       (python-send-string): Delete command.
+       (python-shell-send-string): New command.
+       (python-switch-to-python): Delete command.
+       (python-shell-switch-to-shell): New command.
+       (python-describe-symbol): Delete command.
+       (python-eldoc-at-point): New command.
+       (python--set-prompt-regexp, python-args-to-list)
+       (python-after-info-look, python-check-version)
+       (python-check-comint-prompt, python-find-imports)
+       (python-execute-file, turn-off-pdbtrack, turn-on-pdbtrack)
+       (python-unload-function, python-expand-template)
+       (python-maybe-jython, python-preoutput-filter)
+       (python-pdbtrack-get-source-buffer)
+       (python-pdbtrack-grub-for-buffer, python-pdbtrack-overlay-arrow)
+       (python-pdbtrack-toggle-stack-tracking)
+       (python-pdbtrack-track-stack-file, python-initial-text)
+       (python-first-word, python-comment-line-p, python-send-command)
+       (python-setup-brm, python-sentinel, python-set-proc)
+       (python-skip-out, python-input-filter, python-outdent-p)
+       (python-outline-level, python-backslash-continuation-line-p)
+       (python-end-of-block, python-end-of-statement, python-mark-block)
+       (python-beginning-of-block, python-beginning-of-statement)
+       (python-blank-line-p, python-beginning-of-string)
+       (python-open-block-statement-p): Delete functions.
+       (python-indent-line, python-indent-line-1): Delete functions.
+       (python-indent-line): New function.
+       (python-indentation-levels): Delete function.
+       (python-indent-calculate-levels): New function.
+       (python-proc): Delete function.
+       (python-shell-get-process): New function.
+       (python-send-receive): Delete function.
+       (python-shell-send-string-no-output): New function.
+       (python-module-path): Delete function.
+       (python-ffap-module-path): New function.
+       (python-completion-at-point)
+       (python-symbol-completions): Delete functions.
+       (python-completion-complete-at-point): New function.
+       (python-load-file): Delete function.
+       (python-shell-send-file): New function.
+       (python-calculate-indentation): Delete function.
+       (python-indent-calculate-indentation): New function.
+       (python-skip-comments/blanks): Delete function.
+       (python-util-forward-comment): New function.
+       (python-continuation-line-p): Delete function.
+       (python-info-continuation-line-p): New function.
+       (python-which-func, python-current-defun): Delete function.
+       (python-info-current-defun): New function.
+       (python-beginning-of-defun): Delete function.
+       (python-nav-beginning-of-defun): New function.
+       (python-close-block-statement-p)
+       (python-block-end-p): Delete function.
+       (python-info-closing-block): New function.
+       (python-comint-output-filter-function)
+       (python-eldoc--get-doc-at-point, python-end-of-defun-function)
+       (python-fill-comment, python-fill-decorator, python-fill-paren)
+       (python-fill-string, python-imenu-make-element-tree)
+       (python-imenu-make-tree, python-imenu-tree-assoc)
+       (python-indent-context, python-indent-dedent-line)
+       (python-indent-line-function)
+       (python-indent-post-self-insert-function)
+       (python-indent-toggle-levels)
+       (python-info-assignment-continuation-line-p)
+       (python-info-beginning-of-backlash)
+       (python-info-block-continuation-line-p)
+       (python-info-closing-block-message)
+       (python-info-line-ends-backslash-p)
+       (python-info-looking-at-beginning-of-defun)
+       (python-info-ppss-context, python-info-ppss-context-type)
+       (python-nav-list-defun-positions, python-nav-read-defun)
+       (python-nav-sentence-end, python-nav-sentence-start)
+       (python-pdbtrack-comint-output-filter-function)
+       (python-pdbtrack-set-tracked-buffer)
+       (python-shell-calculate-exec-path)
+       (python-shell-calculate-process-environment)
+       (python-shell-completion--do-completion-at-point)
+       (python-shell-completion--get-completions)
+       (python-shell-completion-complete-at-point)
+       (python-shell-completion-complete-or-indent)
+       (python-shell-get-or-create-process)
+       (python-shell-get-process-name)
+       (python-shell-internal-get-or-create-process)
+       (python-shell-internal-get-process-name)
+       (python-shell-internal-send-string, python-shell-make-comint)
+       (python-shell-parse-command, python-shell-send-setup-code)
+       (python-skeleton-add-menu-items)
+       (python-util-clone-local-variables, python-util-position)
+       (run-python-internal, python-indentation-levels)
+       (python-nav-beginning-of-defun)
+       (python-completion-complete-at-point): New functions.
+       (run-python): Change arguments.  New API requirements.
+
+2012-06-15  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-lib.el (cl--defsubst-expand): Autoload inliner
+       (bug#11649).
+
+       * emacs-lisp/macroexp.el (macroexp--compiler-macro): New function.
+       (macroexp--expand-all): Use it.
+
+       * emacs-lisp/cl-macs.el (cl--transform-function-property): Remove.
+       (cl-define-setf-expander, cl-deftype, cl-define-compiler-macro):
+       Use `cl-function' instead.
+
+2012-06-14  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (COMPILE_FIRST): Remove subr.el.
+       Suggested by Stefan Monnier while discussing bug#11657.
+
+2012-06-14  Sam Steingold  <sds@gnu.org>
+
+       * files.el (abort-if-file-too-large): Use `file-size-human-readable'.
+
+2012-06-14  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * play/doctor.el (doctor-doc): Remove parameter and use
+       doctor-sent instead of sent.
+       (doctor-read-print): Use doctor-sent instead of sent.  (Bug#11708)
+
+2012-06-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * files.el: Require cl-lib.
+       (file-name-non-special): Replace case -> cl-case.
+
+       * emacs-lisp/cl-macs.el (cl-defstruct): Don't add print-func.
+
+       * emacs-lisp/edebug.el (edebug-read-function): Remove old incorrect
+       mapping from #' to function*.
+
+2012-06-13  Chong Yidong  <cyd@gnu.org>
+
+       * mouse.el (mouse-drag-track): Do not set the mark if the user
+       releases the mouse without selecting anything (Bug#11588).
+
+2012-06-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * textmodes/tex-mode.el (latex-indent): Recognize tex-verbatim at EOB
+       as well (bug#11646).
+
+       * loadup.el: Count byte-code functions as well.
+
+       * emacs-lisp/byte-opt.el (featurep): Move compiler-macro...
+       * emacs-lisp/bytecomp.el (featurep): ...here (bug#11692).
+
+       * emacs-lisp/autoload.el (make-autoload): Accept nil doc-string-elt
+       (bug#11649).  Add cl-defun and cl-defmacro.
+
+2012-06-13  Drew Adams  <drew.adams@oracle.com>
+
+       * help-mode.el (help-bookmark-make-record, help-bookmark-jump):
+       Fix last change.
+
+2012-06-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/dbus.el (dbus-call-method): Use timeout for `read-event'.
+       Otherwise, it blocks in batch mode.
+
+2012-06-13  Juanma Barranquero  <lekktu@gmail.com>
+
+       * help-mode.el (bookmark-make-record-default): Declare.
+
+2012-06-13  Chong Yidong  <cyd@gnu.org>
+
+       * emacs-lisp/package.el (list-packages): Compute a list of
+       packages that are newly-available since the last list-packages
+       invocation.
+       (package-menu--new-package-list): New var.
+       (package-menu--generate, package-menu--print-info)
+       (package-menu--status-predicate, package-menu-mark-install):
+       Handle new status label "new".
+
+2012-06-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-macs.el (cl-remf): Fix error in recent
+       conversion to backquotes.
+
+2012-06-12  Chong Yidong  <cyd@gnu.org>
+
+       * emacs-lisp/edebug.el (edebug-inhibit-emacs-lisp-mode-bindings):
+       Rename from gud-inhibit-global-bindings.
+
+       * emacs-lisp/eieio.el (eieio-pre-method-execution-hooks): Doc fix.
+
+       * nxml/nxml-glyph.el (nxml-glyph-set-functions): Rename abnormal
+       hook from nxml-glyph-set-hook.
+
+       * progmodes/cwarn.el (cwarn-mode): Remove redundant variable
+       declaration.
+
+       * progmodes/pascal.el (pascal-toggle-completions): Doc fix.
+
+       * textmodes/bibtex.el (bibtex-string-file-path, bibtex-file-path):
+       Convert to defcustom.
+
+2012-06-12  Drew Adams  <drew.adams@oracle.com>
+
+       * help-mode.el (help-bookmark-make-record, help-bookmark-jump):
+       New functions.
+       (help-mode): Use them.
+
+2012-06-11  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/fortran.el (fortran-font-lock-keywords-3):
+       Use preprocessor face for directives.
+       (fortran-directive-re): Doc fix.
+
+2012-06-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-macs.el (cl-parse-loop-clause): Fix error in recent
+       conversion to backquotes (bug#11652).
+
+       Fix compiler-expansion of CL's cXXr functions (bug#11673).
+       * emacs-lisp/cl-lib.el (cl--defalias): New function.
+       (cl-values, cl-values-list, cl-copy-seq, cl-svref, cl-first)
+       (cl-second, cl-rest, cl-endp, cl-third, cl-fourth): Use it.
+       (cl-plusp, cl-minusp, cl-fifth, cl-sixth, cl-seventh, cl-eighth)
+       (cl-ninth, cl-tenth): Mark them as inlinable.
+       (cl-caaar, cl-caadr, cl-cadar, cl-caddr, cl-cdaar, cl-cdadr)
+       (cl-cddar, cl-cdddr, cl-caaaar, cl-caaadr, cl-caadar, cl-caaddr)
+       (cl-cadaar, cl-cadadr, cl-caddar, cl-cadddr, cl-cdaaar, cl-cdaadr)
+       (cl-cdadar, cl-cdaddr, cl-cddaar, cl-cddadr, cl-cdddar, cl-cddddr):
+       Add a compiler-macro declaration to use cl--compiler-macro-cXXr.
+       (cl-list*, cl-adjoin): Don't put an autoload manually.
+       * emacs-lisp/cl-macs.el (cl--compiler-macro-adjoin)
+       (cl--compiler-macro-list*): Add autoload cookie.
+       (cl--compiler-macro-cXXr): New function.
+
+       * help-fns.el (help-fns--compiler-macro): New function extracted from
+       describe-function-1; follow aliases and use `compiler-macro' property.
+       (describe-function-1): Use it.
+
+2012-06-11  Chong Yidong  <cyd@gnu.org>
+
+       * startup.el (fancy-splash-head): Use splash.svg even if librsvg
+       is uninstalled, if imagemagick is installed.
+
+2012-06-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-lib.el: Use lexical-binding.
+       (cl-map-extents, cl-maclisp-member): Remove.
+       (cl--set-elt, cl--set-nthcdr, cl--set-buffer-substring)
+       (cl--set-substring, cl--block-wrapper, cl--block-throw)
+       (cl--compiling-file, cl--mapcar-many, cl--do-subst): Use "cl--" prefix.
+       * emacs-lisp/cl-extra.el: Use lexical-binding.
+       (cl--mapcar-many, cl--map-keymap-recursively, cl--map-intervals)
+       (cl--map-overlays, cl--set-frame-visible-p, cl--progv-save)
+       (cl--progv-before, cl--progv-after, cl--finite-do, cl--set-getf)
+       (cl--do-remf, cl--do-prettyprint): Use "cl--" prefix.
+       * emacs-lisp/cl-seq.el: Use lexical-binding.
+       (cl--parsing-keywords, cl--check-key, cl--check-test-nokey)
+       (cl--check-test, cl--check-match): Use "cl--" prefix and backquotes.
+       (cl--alist, cl--sublis-rec, cl--nsublis-rec, cl--tree-equal-rec):
+       * emacs-lisp/cl-macs.el (cl--lambda-list-keywords): Use "cl--" prefix.
+       * edmacro.el (edmacro-mismatch): Simplify to remove dependence on
+       CL's internals.
+
+2012-06-11  Michael Albinus  <michael.albinus@gmx.de>
+
+       Sync with Tramp 2.2.6-pre.
+
+       * net/tramp-cache.el (tramp-dump-connection-properties): Let-bind
+       `print-length' and `print-level' to nil, in order to avoid
+       truncation.  Reported by Christopher Schmidt
+       <christopher@ristopher.com>.
+
+       * net/tramp-cmds.el (tramp-cleanup-connection): Delete also process.
+
+       * net/tramp-compat.el (tramp-compat-condition-case-unless-debug):
+       New defmacro.
+       (tramp-compat-copy-directory): Add optional argument
+       COPY-CONTENTS.  It is not handled yet.
+
+       * net/tramp-ftp.el (tramp-disable-ange-ftp): Fix docstring.
+       (tramp-ftp-file-name-p): Simplify.
+
+       * net/tramp-gvfs.el (tramp-gvfs-handle-expand-file-name):
+       * net/tramp-gw.el (tramp-gw-open-connection): Add hop to
+       connection vector.
+
+       * net/tramp-sh.el (tramp-copy-size-limit): Fix docstring.
+       (tramp-methods): Do not use `tramp-password-end-of-line'.
+       (tramp-completion-function-alist-putty): Handle UNIX case.
+       (tramp-remote-path): Add "/opt/bin", "/opt/sbin" and "/opt/local/bin".
+       (tramp-do-file-attributes-with-stat)
+       (tramp-do-directory-files-and-attributes-with-stat) Return uid and
+       gid as real numbers.  They could run out of integer range on cygwin.
+       (tramp-do-copy-or-rename-file-out-of-band): Better trace format.
+       (tramp-sh-handle-expand-file-name): Handle hops.
+       (tramp-open-connection-setup-interactive-shell):
+       Use `tramp-cleanup'.  Move check for busyboxes ...
+       (tramp-find-shell): ... here.  Simplify implementation.
+       Set "remote-shell" property also for alternative shells.
+       (tramp-remote-coding-commands): Check "test -c /dev/stdout".
+       If failing, a regular file would be written otherwise.
+       Reported by Dmitry Kurochkin <dmitry.kurochkin@gmail.com>.
+       (tramp-find-inline-encoding): Cache the coding commands in the
+       process cache.  Apply test command on the remote side, if defined.
+       (tramp-find-inline-compress): Cache the compress commands in the
+       process cache.
+       (tramp-compute-multi-hops): Save `tramp-default-proxies-alist'
+       when requested.  Handle hops.
+       (tramp-current-connection): New defvar.
+       (tramp-maybe-open-connection): Use `tramp-cleanup'.
+       Throw `suppress', if there was a failed connection shortly before.
+       Handle user interrupt.  (Bug#10187)
+       (tramp-get-inline-compress, tramp-get-inline-coding):
+       Read connection properties from the process cache.
+
+       * net/tramp-smb.el (tramp-smb-server-version)
+       (tramp-smb-wrong-passwd-regexp, tramp-smb-actions-with-tar):
+       New defconsts.
+       (tramp-smb-prompt): Extend for powershell prompt.
+       (tramp-smb-file-name-handler-alist): Add handlers for
+       `process-file', `shell-command' and `start-file-process'.
+       (tramp-smb-winexe-program, tramp-smb-winexe-shell-command)
+       (tramp-smb-winexe-shell-command-switch): New defcustoms.
+       (tramp-smb-file-name-p): Simplify.
+       (tramp-smb-action-with-tar, tramp-smb-handle-process-file)
+       (tramp-smb-kill-winexe-function, tramp-smb-call-winexe)
+       (tramp-smb-shell-quote-argument): New defuns.
+       (tramp-smb-handle-copy-directory): Add COPY-CONTENTS argument.
+       Implement using "tar".  By this, time-stamps are preserved.
+       (tramp-smb-handle-copy-file): Handle also the case of directories.
+       (tramp-smb-do-file-attributes-with-stat)
+       (tramp-smb-get-file-entries, tramp-smb-get-cifs-capabilities):
+       Use `tramp-get-connection-buffer').
+       (tramp-smb-handle-rename-file): Use "rename", when source and
+       target are on the same share.
+       (tramp-smb-maybe-open-connection): Handle wrong passwords.
+       Use `tramp-smb-server-version'.
+       (tramp-smb-wait-for-output): Remove prompt.
+
+       * net/tramp.el (top): Require 'cl.
+       (tramp-methods, tramp-rsh-end-of-line):
+       Remove `tramp-password-end-of-line' from docstring.
+       (tramp-save-ad-hoc-proxies): New defcustom.
+       (tramp-completion-function-alist): Adapt docstring.
+       (tramp-default-password-end-of-line): Remove defcustom.
+       (tramp-shell-prompt-pattern): Allow "[]" style prompts.  (Bug#11065)
+       (tramp-user-regexp, tramp-file-name-regexp-unified)
+       (tramp-file-name-regexp-url): Extend regexp by hop separator.
+       (tramp-postfix-hop-format, tramp-postfix-hop-regexp)
+       (tramp-remote-file-name-spec-regexp): New defconst.
+       (tramp-file-name-structure): Extend structure for hops.
+       (tramp-get-method-parameter): Move up.
+       (tramp-file-name-p, tramp-dissect-file-name)
+       (with-parsed-tramp-file-name): Handle hops.
+       (tramp-file-name-hop): New defun.
+       (tramp-make-tramp-file-name): New optional arg HOP.
+       (tramp-message-show-progress-reporter-message): New defvar.
+       (tramp-with-progress-reporter): Use it.  We cannot use
+       `tramp-message-show-message' here, because this suppresses also
+       error buffers.
+       (tramp-error-with-buffer): Suppress buffer view, if
+       `tramp-message-show-message' is nil.
+       Use `tramp-get-connection-buffer'.
+       (tramp-cleanup): New defun.
+       (tramp-rfn-eshadow-update-overlay): Let-bind `non-essential' to `t'.
+       (tramp-file-name-handler): If `debug-on-error' is set, propagate
+       an error unchanged.
+       (tramp-completion-handle-file-name-all-completions): Handle hops.
+       Fix an error when called from ido.
+       (tramp-completion-dissect-file-name): Use better local variable
+       name.  Add hop to the vector.
+       (tramp-handle-insert-file-contents): Use progress-reporter for the
+       whole scenario.
+       (tramp-action-password): Let-bind `enable-recursive-minibuffers'
+       to `t'.
+       (tramp-check-for-regexp): Simplify search.
+       (tramp-enter-password): Remove it.  Move implementation ...
+       (tramp-action-password): ... here.
+       (tramp-mode-string-to-int, tramp-local-host-p)
+       (tramp-make-tramp-temp-file, tramp-read-passwd)
+       (tramp-clear-passwd, tramp-time-less-p, tramp-time-diff):
+       Set tramp-autoload cookie.
+
+       * net/trampver.el: Update release number.
+
+2012-06-11  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
+           Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-set-completion-function): Fix docstring.
+       (tramp-parse-group, tramp-parse-file)
+       (tramp-parse-shostkeys-sknownhosts): New defuns.
+       (tramp-parse-rhosts, tramp-parse-rhosts-group, tramp-parse-shosts)
+       (tramp-parse-shosts-group, tramp-parse-sconfig)
+       (tramp-parse-sconfig-group, tramp-parse-shostkeys)
+       (tramp-parse-sknownhosts, tramp-parse-hosts)
+       (tramp-parse-hosts-group, tramp-parse-passwd, tramp-parse-netrc):
+       Use them.
+       (tramp-parse-passwd-group, tramp-parse-netrc-group)
+       (tramp-parse-putty-group): Don't narrow.
+       (tramp-parse-putty): Make a loop.
+       (tramp-file-name-handler): Catch the `suppress' signal.
+
+2012-06-11  Chong Yidong  <cyd@gnu.org>
+
+       * image.el (imagemagick-register-types): Put the ImageMagick entry
+       at the end of image-type-file-name-regexps.
+
+2012-06-11  Johan Bockgård  <bojohan@gnu.org>
+
+       * emacs-lisp/pcase.el (pcase-UPAT, pcase-QPAT): New edebug specs.
+       (pcase, pcase-let*, pcase-dolist): Use them.
+
+2012-06-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/pcase.el (pcase--let*): New function.
+       (pcase-let*): Use it.  Use pcase--memoize to avoid repeated expansions.
+       (pcase--expand): Use macroexp-let².
+
+2012-06-10  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/timer.el, emacs-lisp/syntax.el, emacs-lisp/smie.el:
+       * emacs-lisp/ewoc.el, emacs-lisp/cconv.el, emacs-lisp/bytecomp.el:
+       * emacs-lisp/byte-opt.el, emacs-lisp/autoload.el: Convert to cl-lib.
+       * emacs-lisp/easymenu.el, emacs-lisp/easy-mmode.el:
+       * emacs-lisp/derived.el: Use pcase instead of `cl'.
+       * emacs-lisp/cl-lib.el: Get rid of special cl-macs auto load.
+
+2012-06-10  Glenn Morris  <rgm@gnu.org>
+
+       * mail/rmail.el (rmail-yank-current-message): Leave point at
+       correct position.  (Bug#11660)
+
+2012-06-10  Chong Yidong  <cyd@gnu.org>
+
+       * allout-widgets.el: Fix code header.
+
+2012-06-10  Chong Yidong  <cyd@gnu.org>
+
+       * cus-edit.el (customize-changed-options-previous-release):
+       Bump to 24.1.
+
+2012-06-09  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * Makefile.in (BIG_STACK_DEPTH): Enlarge to 2200.
+
+2012-06-09  Chong Yidong  <cyd@gnu.org>
+
+       * ebuff-menu.el (electric-buffer-list): Preserve header line.
+
+2012-06-09  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (special-display-popup-frame): Don't use
+       window--display-buffer (Bug#11651).
+
+2012-06-09  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix parallel builds: make sure loaddefs.el is not being written
+       while Lisp files are compiled.
+       (compile): Don't depend on 'mh-autoloads'.
+       (compile-CMD, compile-SH): Depend on 'autoloads'.
+       (bootstrap): Don't depend on 'autoloads' and 'mh-autoloads'.
+
+       * makefile.w32-in (BIG_STACK_DEPTH): Enlarge to 2200.  (Bug#11649)
+
+2012-06-09  Chong Yidong  <cyd@gnu.org>
+
+       * face-remap.el (face-remap-add-relative, face-remap-set-base)
+       (buffer-face-set, buffer-face-toggle, buffer-face-mode-invoke):
+       Doc fixes (Bug#11225).
+
+2012-06-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/macroexp.el (macroexp--expand-all): Only autoload
+       a function if there's a clear indication that it has a compiler-macro.
+       * emacs-lisp/byte-run.el (defun-declarations-alist, defmacro, defun)
+       (macro-declarations-alist): Add arglist to declaration functions.
+       (defun-declarations-alist): Add `obsolete' and `compiler-macro'.
+       * emacs-lisp/cl-seq.el (cl-member, cl-assoc):
+       * emacs-lisp/cl-lib.el (cl-list*, cl-adjoin):
+       * emacs-lisp/cl-extra.el (cl-get): Use the new `declare' statement.
+       Also add autoload to find the compiler macro.
+       * emacs-lisp/cl-macs.el (eql) [compiler-macro]: Remove.
+       (cl--compiler-macro-member, cl--compiler-macro-assoc)
+       (cl--compiler-macro-adjoin, cl--compiler-macro-list*)
+       (cl--compiler-macro-get): New functions, replacing calls to
+       cl-define-compiler-macro.
+       (cl-typep) [compiler-macro]: Use macroexp-let².
+
+2012-06-08  Nick Dokos  <nicholas.dokos@hp.com>  (tiny change)
+
+       * calendar/icalendar.el (icalendar--parse-vtimezone): Import TZID
+       string properly, fixes Bug#11473.
+
+2012-06-08  Chong Yidong  <cyd@gnu.org>
+
+       * faces.el (set-face-attribute): Doc fix.
+       (modify-face): Don't use :bold and :italic.
+       (error, warning, success): Tweak definitions.
+
+       * cus-edit.el (custom-modified, custom-invalid, custom-rogue)
+       (custom-modified, custom-set, custom-changed, custom-themed)
+       (custom-saved, custom-button, custom-button-mouse)
+       (custom-button-pressed, custom-state, custom-comment-tag)
+       (custom-variable-tag, custom-group-tag-1, custom-group-tag)
+       (custom-group-subtitle): Use new-style face specs.
+       (custom-invalid-face, custom-rogue-face, custom-modified-face)
+       (custom-set-face, custom-changed-face, custom-saved-face)
+       (custom-button-face, custom-button-pressed-face)
+       (custom-documentation-face, custom-state-face)
+       (custom-comment-face, custom-comment-tag-face)
+       (custom-variable-tag-face, custom-variable-button-face)
+       (custom-face-tag-face, custom-group-tag-face-1)
+       (custom-group-tag-face): Remove obsolete face alias.
+
+       * epa.el (epa-validity-high, epa-validity-medium)
+       (epa-validity-low, epa-mark, epa-field-name, epa-string)
+       (epa-field-name, epa-field-body):
+       * font-lock.el (font-lock-comment-face, font-lock-string-face)
+       (font-lock-keyword-face, font-lock-builtin-face)
+       (font-lock-function-name-face, font-lock-variable-name-face)
+       (font-lock-type-face, font-lock-constant-face):
+       * ido.el (ido-first-match, ido-only-match, ido-subdir)
+       (ido-virtual, ido-indicator, ido-incomplete-regexp):
+       * speedbar.el (speedbar-button-face, speedbar-file-face)
+       (speedbar-directory-face, speedbar-tag-face)
+       (speedbar-selected-face, speedbar-highlight-face)
+       (speedbar-separator-face):
+       * whitespace.el (whitespace-newline, whitespace-space)
+       (whitespace-hspace, whitespace-tab, whitespace-trailing)
+       (whitespace-line, whitespace-space-before-tab)
+       (whitespace-space-after-tab, whitespace-indentation)
+       (whitespace-empty):
+       * emulation/cua-base.el (cua-global-mark):
+       * eshell/em-prompt.el (eshell-prompt):
+       * net/newst-plainview.el (newsticker-new-item-face)
+       (newsticker-old-item-face, newsticker-immortal-item-face)
+       (newsticker-obsolete-item-face, newsticker-date-face)
+       (newsticker-statistics-face, newsticker-default-face):
+       * net/newst-reader.el (newsticker-feed-face)
+       (newsticker-extra-face, newsticker-enclosure-face):
+       * net/newst-treeview.el (newsticker-treeview-face)
+       (newsticker-treeview-new-face, newsticker-treeview-old-face)
+       (newsticker-treeview-immortal-face)
+       (newsticker-treeview-obsolete-face)
+       (newsticker-treeview-selection-face):
+       * net/rcirc.el (rcirc-my-nick, rcirc-other-nick)
+       (rcirc-bright-nick, rcirc-server, rcirc-timestamp)
+       (rcirc-nick-in-message, rcirc-nick-in-message-full-line)
+       (rcirc-prompt, rcirc-track-keyword, rcirc-url, rcirc-keyword):
+       * nxml/nxml-outln.el (nxml-heading, nxml-outline-indicator)
+       (nxml-outline-active-indicator, nxml-outline-ellipsis):
+       * play/mpuz.el (mpuz-unsolved, mpuz-solved, mpuz-trivial)
+       (mpuz-text):
+       * progmodes/vera-mode.el (vera-font-lock-number)
+       (vera-font-lock-function, vera-font-lock-interface):
+       * textmodes/table.el (table-cell): Use new-style face specs, and
+       don't use the old :bold and :italic attributes.
+
+       * progmodes/ebrowse.el (ebrowse-tree-mark, ebrowse-root-class)
+       (ebrowse-member-attribute, ebrowse-default, ebrowse-file-name)
+       (ebrowse-member-class, ebrowse-progress): Likewise.
+       (ebrowse-tree-mark-face, ebrowse-root-class-face)
+       (ebrowse-file-name-face, ebrowse-default-face)
+       (ebrowse-member-attribute-face, ebrowse-member-class-face)
+       (ebrowse-progress-face): Remove obsolete faces.
+
+       * progmodes/flymake.el (flymake-errline, flymake-warnline):
+       Inherit from error and warning faces respectively.
+
+       * textmodes/flyspell.el (flyspell-incorrect, flyspell-duplicate):
+       Likewise.
+       (flyspell-incorrect-face, flyspell-duplicate-face):
+       Remove obsolete aliases.
+
+2012-06-08  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp-compat.el (tramp-compat-temporary-file-directory):
+       Avoid infloop.
+
+2012-06-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * startup.el (argv, argi): Make lexically scoped.
+       * emacs-lisp/float-sup.el (pi): Use internal-make-var-non-special.
+       * emacs-lisp/cl-macs.el: Use lexical-binding.
+       Rename cl-bind-* to cl--bind-*.
+       * files.el: Don't require `cl' since it doesn't use it.
+       * emacs-lisp/pcase.el, emacs-lisp/macroexp.el: Add coding cookie.
+
+2012-06-08  Juanma Barranquero  <lekktu@gmail.com>
+
+       * textmodes/texinfmt.el: Fix bug#11640 (reverts part of 2008-07-31T05:33:56Z!dann@ics.uci.edu).
+       (texinfo-format-printindex): Use `texinfo-sort-region' in all platforms,
+       instead of calling external sort utility.
+       (texinfo-sort-region, texinfo-sort-startkeyfun): Restore functions.
+
+2012-06-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * descr-text.el (describe-char): Mention how to insert the
+       character, if the current input method doesn't support it.
+       See the discussion in this thread for the details:
+       http://lists.gnu.org/archive/html/emacs-devel/2012-05/msg00533.html.
+
+2012-06-08  Sam Steingold  <sds@gnu.org>
+
+       * bindings.el (global-map): Bind XF86Forward to next-buffer and
+       XF86Back to previous-buffer.
+       (minibuffer-local-map): Bind them to next-history-element and
+       previous-history-element respectively.
+       * help-mode.el (help-mode-map): Bind them to help-go-forward and
+       help-go-back respectively.
+       * info.el (Info-mode-map): Bind them to Info-history-forward and
+       Info-history-back respectively.
+       These are the keys next to Up on the ThinkPad keyboard.
+
+2012-06-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Get rid of cl-lexical-let, keeping only lexical-let for compatibility.
+       * emacs-lisp/cl-macs.el: Provide itself.
+       (cl--labels-convert-cache): New var.
+       (cl--labels-convert): New function.
+       (cl-flet, cl-labels): New implementation with new semantics, relying on
+       lexical-binding.
+       * emacs-lisp/cl.el: Mark compatibility aliases as obsolete.
+       (cl-closure-vars, cl--function-convert-cache)
+       (cl--function-convert): Move from cl-macs.el.
+       (lexical-let, lexical-let*, flet, labels): Move from cl-macs.el and
+       rename by removing the "cl-" prefix.
+       * emacs-lisp/macroexp.el (macroexp-unprogn): New function.
+
+2012-06-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl.el (cl-macroexpand, cl-macro-environment)
+       (cl-macroexpand-all, cl-not-hash-table, cl-builtin-gethash)
+       (cl-builtin-remhash, cl-builtin-clrhash, cl-builtin-maphash)
+       (cl-map-keymap, cl-copy-tree, cl-gethash, cl-puthash, cl-remhash)
+       (cl-clrhash, cl-maphash, cl-make-hash-table, cl-hash-table-p)
+       (cl-hash-table-count): Add old compatibility aliases.
+
+       * emacs-lisp/cl-macs.el (cl-macro-environment): Remove var.
+       Use macroexpand-all-environment instead.
+       (cl--old-macroexpand): New var.
+       (cl--sm-macroexpand): New function.
+       (cl-symbol-macrolet): Use it during macro expansion.
+       (cl--function-convert-cache): New var.
+       (cl--function-convert): New function, extracted from
+       cl-macroexpand-all.
+       (cl-lexical-let): Use it.
+
+       * emacs-lisp/cl-lib.el (cl-macro-environment): Remove decl.
+       (cl-macroexpand): Move to cl-macs.el and rename to cl--sm-macroexpand.
+       (cl-member): Remove old alias.
+
+       * emacs-lisp/cl-extra.el (cl-map-keymap, cl-copy-tree)
+       (cl-not-hash-table, cl-builtin-gethash, cl-builtin-remhash)
+       (cl-builtin-clrhash, cl-builtin-maphash, cl-gethash, cl-puthash)
+       (cl-remhash, cl-clrhash, cl-maphash, cl-make-hash-table)
+       (cl-hash-table-p, cl-hash-table-count): Move to cl.el.
+       (cl-macroexpand-cmacs): Remove var.
+       (cl-macroexpand-all, cl-macroexpand-body): Remove funs.
+       Use macroexpand-all instead.
+
+2012-06-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/macroexp.el (macroexp-progn, macroexp-let*, macroexp-if)
+       (macroexp-let², macroexp--const-symbol-p, macroexp-const-p)
+       (macroexp-copyable-p): New functions and macros.
+       * emacs-lisp/edebug.el (edebug-unwrap):
+       * emacs-lisp/disass.el (disassemble-internal): Use macroexp-progn.
+       * emacs-lisp/pcase.el: Use macroexp-let*, macroexp-if, ...
+       (pcase--let*): Remove.
+       * emacs-lisp/bytecomp.el (byte-compile-const-symbol-p)
+       (byte-compile-constp): Remove.  Use macroexp--const-symbol-p and
+       macroexp-const-p instead.
+       * emacs-lisp/byte-opt.el: Use macroexp-const-p and macroexp-progn.
+
+       * emacs-lisp/cl-macs.el: Clean up the name space by using "cl--"
+       instead of "cl-" for internal definitions.  Use macroexp-const-p.
+       (cl-old-bc-file-form): Remove var.
+       (cl-const-exprs-p): Remove fun.
+       (cl-labels, cl-macrolet): Use backquote.
+       (cl-lexical-let): Use cl-symbol-macrolet.  Don't use cl-defun-expander.
+       (cl-defun-expander, cl-byte-compile-compiler-macro): Remove fun.
+       (cl-define-setf-expander): Rename from cl-define-setf-method.
+       * emacs-lisp/cl.el: Adjust alias for define-setf-method.
+
+       * international/mule-cmds.el: Don't require CL.
+       (view-hello-file): Don't use `letf'.
+
+2012-06-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * tmm.el (tmm-prompt): Use string-prefix-p.
+       (tmm-completion-delete-prompt): Don't affect current-buffer outside.
+       (tmm-add-prompt): Use minibuffer-completion-help.
+       (tmm-delete-map): Remove.
+
+       * subr.el (kbd): Make it its own function.
+
+2012-06-07  Stefan Merten  <smerten@oekonux.de>
+
+       * textmodes/rst.el: Use `eval-when-compile' for requiring `cl.el'.
+       Silence compiler warnings.  Fix versions.
+       (rst-position-if, rst-position, rst-some, rst-signum): New functions.
+       (rst-shift-region, rst-adornment-level, rst-compute-tabs)
+       (rst-indent-line, rst-shift-region, rst-forward-line): Use them.
+       (rst-package-emacs-version-alist): Correct Emacs version to
+       represent major merge with upstream.
+       (rst-transition, rst-adornment, rst-compile-toolsets): Fix versions.
+
+2012-06-06  Glenn Morris  <rgm@gnu.org>
+
+       * mail/emacsbug.el (report-emacs-bug): Add relevant EMACS env-vars.
+       Only print environment variables if set.
+
+2012-06-06  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/macroexp.el: Don't require CL since we don't use it.
+       (macroexp--cons): Rename from maybe-cons.
+       (macroexp--accumulate): Rename from macroexp-accumulate.
+       (macroexp--all-forms): Rename from macroexpand-all-forms.
+       (macroexp--all-clauses): Rename from macroexpand-all-clauses.
+       (macroexp--expand-all): Rename from macroexpand-all-1.
+
+2012-06-06  Sam Steingold  <sds@gnu.org>
+
+       * calendar/calendar.el (calendar-in-read-only-buffer):
+       Call `special-mode' to enable the standard read-only keybindings.
+
+2012-06-06  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/macroexp.el (macroexpand-all-1): Don't spam the output
+       with "loading" messages (bug#11635).
+
+2012-06-06  Michael Albinus  <michael.albinus@gmx.de>
+
+       * files.el (enable-remote-dir-locals): New option.
+       (hack-dir-local-variables): Use it.  (Bug#1933, Bug#6731)
+
+       * net/tramp-compat.el (tramp-compat-temporary-file-directory):
+       Ensure, that the temp directory is local.
+
+       * net/tramp-sh.el (tramp-sh-handle-write-region): Let-bind
+       `temporary-file-directory'.
+
+       * progmodes/python.el (python-send-region): Ensure, that the
+       temporary file is created also in the remote case.
+
+2012-06-06  Glenn Morris  <rgm@gnu.org>
+
+       * vc/vc-rcs.el (vc-rcs-rcs2log-program): New.
+       (vc-rcs-update-changelog): Use it.
+
+       * emacs-lisp/authors.el (authors-fixed-entries): Remove vcdiff.
+
+       * vc/vc-sccs.el (vc-sccs-write-revision): New function.
+       (vc-sccs-workfile-unchanged-p): Use vc-sccs-write-revision.
+       (vc-sccs-diff): Replace use of the external vcdiff script.
+
+2012-06-05  Glenn Morris  <rgm@gnu.org>
+
+       * ledit.el: Move to obsolete/.
+
+2012-06-05  Sam Steingold  <sds@gnu.org>
+
+       * calendar/calendar.el (calendar-exit): Reinstate the 2012-03-28
+       patch (Bug#11140).
+
+2012-06-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cust-print.el: Move to obsolete.
+
+       * emacs-lisp/macroexp.el (macroexpand-all-1): Tolerate errors during
+       compiler-macro expansion.
+
+       Add native compiler-macro support.
+       * emacs-lisp/macroexp.el (macroexpand-all-1):
+       Support compiler-macros directly.  Properly follow aliases and apply
+       the compiler macros more thoroughly.
+       * emacs-lisp/cl.el: Don't copy compiler-macro properties any more since
+       macroexpand now properly follows aliases.
+       * emacs-lisp/cl-macs.el (toplevel, cl-define-compiler-macro)
+       (cl-compiler-macroexpand): Use new prop.
+       * emacs-lisp/byte-opt.el (featurep): Optimize earlier.
+
+       * emacs-lisp/cl-lib.el (custom-print-functions): Add alias.
+
+2012-06-05  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (get-lru-window, get-mru-window, get-largest-window):
+       New argument NOT-SELECTED to avoid picking the selected window.
+       (window--display-buffer-1, window--display-buffer-2): Replace by
+       new function window--display-buffer
+       (display-buffer-same-window, display-buffer-reuse-window)
+       (display-buffer-pop-up-frame, display-buffer-pop-up-window):
+       Use window--display-buffer.
+       (display-buffer-use-some-window): Remove temporary dedication
+       hack by calling get-lru-window and get-largest-window with
+       NOT-SELECTED argument non-nil.  Call window--display-buffer.
+
+2012-06-05  Glenn Morris  <rgm@gnu.org>
+
+       * vc/vc-sccs.el (vc-sccs-workfile-unchanged-p):
+       Replace external vcdiff script.
+
+2012-06-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-lib.el (cl-values, cl-values-list): Fix up last change.
+
+2012-06-04  Chong Yidong  <cyd@gnu.org>
+
+       * image.el (imagemagick-types-inhibit): Revert last change.
+       Add INFO and M.
+       (imagemagick-enabled-types): Remove CIN and EPS*.
+
+2012-06-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-lib.el: Rename from cl.el.
+       * emacs-lisp/cl.el: New compatibility file.
+       * emacs-lisp/cl-lib.el, emacs-lisp/cl-seq.el, emacs-lisp/cl-macs.el:
+       * emacs-lisp/cl-extra.el: Rename all top-level functions and variables
+       to obey the "cl-" prefix.
+       * emacs-lisp/macroexp.el (macroexpand-all-1): Adjust to new name.
+
+2012-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * emacs-lisp/authors.el (authors-aliases): Addition.
+
+       * cus-start.el (tool-bar-style, tool-bar-max-label-size):
+       Fix :version.
+
+2012-06-03  Stefan Merten  <smerten@oekonux.de>
+
+       * textmodes/rst.el: Add comments.
+       (rst-transition, rst-adornment): New faces.
+       (rst-adornment-faces-alist): Make default safe to reevaluate.
+       Fixes
+       http://sourceforge.net/tracker/?func=detail&atid=422030&aid=3479603&group_id=38414.
+       Improve customization tags.
+       (rst-define-level-faces): Clarify meaning.
+
+2012-06-03  Chong Yidong  <cyd@gnu.org>
+
+       * progmodes/compile.el (compilation-mode-line-fail)
+       (compilation-mode-line-run, compilation-mode-line-exit):
+       New faces.
+       (compilation-start, compilation-handle-exit): Use them (Bug#11032).
+
+2012-06-03  Jack Duthen  <duthen.mac.01@gmail.com>  (tiny change)
+
+       * progmodes/which-func.el (which-func-update-ediff-windows):
+       New function.  Use it in ediff-select-hook (Bug#11478).
+
+2012-06-03  Chong Yidong  <cyd@gnu.org>
+
+       * bindings.el: Remove explicit help text from format-mode-line.
+       It is now supplied by mode-line-default-help-echo.
+       (mode-line-front-space, mode-line-end-spaces)
+       (mode-line-misc-info): New variables.
+       (mode-line-modes, mode-line-position): Move the default value to
+       the variable definition.
+       (mode-line-default-help-echo): New defcustom.
+       (mode-line-mule-info-help-echo, mode-line-read-only-help-echo)
+       (mode-line-modified-help-echo): New functions.
+       (mode-line-mule-info, mode-line-modified): Use them.
+       (mode-line-eol-desc, propertized-buffer-identification):
+       Consistency fixes for help text.
+       (mode-line-coding-system-map): Allow using mouse-3 to invoke
+       set-buffer-file-coding-system (Bug#289).
+       (mode-line-mule-info-help-echo): Update help text.
+
+2012-06-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * simple.el (execute-extended-command): Set real-this-command
+       (bug#11506).
+
+2012-06-02  Chong Yidong  <cyd@gnu.org>
+
+       Remove incorrect uses of "modeline" in comments, docstrings, and
+       function/variable names (Bug#10329).
+
+       * cus-edit.el (mode-line):
+       * dframe.el (dframe-mouse-hscroll):
+       * emacs-lisp/re-builder.el:
+       * emacs-lisp/easy-mmode.el (define-minor-mode):
+       * frame.el (set-frame-name):
+       * help.el (lookup-minor-mode-from-indicator):
+       * net/rcirc.el (rcirc-activity-string, rcirc-short-buffer-name):
+       * progmodes/cc-cmds.el (c-toggle-auto-newline)
+       (c-toggle-hungry-state):
+       * progmodes/antlr-mode.el (antlr-language-alist):
+       * progmodes/idlw-shell.el (idlwave-shell-electric-stop-line-face):
+       * progmodes/vhdl-mode.el (vhdl-mode):
+       * progmodes/which-func.el (which-func, which-func-cleanup-function):
+       * term/ns-win.el (ns-face-at-pos):
+       * term/sup-mouse.el (sup-mouse-report):
+       * textmodes/flyspell.el (flyspell-mode-line-string):
+       * textmodes/ispell.el (ispell-highlight-face):
+       * textmodes/reftex-global.el:
+       * vc/vc-arch.el (vc-arch-mode-line-string):
+       * vc/vc-cvs.el (vc-cvs-mode-line-string):
+       * vc/vc-git.el (vc-git-mode-line-string):
+       * vc/vc-hooks.el (vc-display-status)
+       (vc-default-mode-line-string):
+       * vc/vc-mtn.el (vc-mtn-mode-line-string): Doc fixes.
+
+       * ansi-color.el (ansi-color-faces-vector): Change default faces.
+
+       * dired.el (dired-sort-set-mode-line): Rename from
+       dired-sort-set-modeline.  All callers changed.
+
+       * eshell/esh-mode.el (eshell-status-in-mode-line): Rename from
+       eshell-status-in-modeline.
+
+       * foldout.el (foldout-mode-line-string): Rename from
+       foldout-modeline-string.  All callers changed.
+       (foldout-update-mode-line): Rename from foldout-update-modeline.
+
+       * subr.el (redraw-modeline): Make into obsolete alias.
+
+       * calendar/timeclock.el (timeclock-mode-line-display): Rename from
+       timeclock-modeline-display.  Make old name an alias.
+       (timeclock-update-mode-line): Likewise.  All callers changed.
+       (timeclock-mode-line-display): No need to check before using
+       add-hook.
+       (timeclock-relative, timeclock-day-over-hook)
+       (timeclock-use-elapsed, timeclock-mode-string)
+       (timeclock-mode-line-display): Doc fix, "modeline" -> "mode line".
+
+       * emulation/crisp.el (crisp-mode-mode-line-string): Rename from
+       crisp-mode-modeline-string.
+
+       * play/solitaire.el (solitaire-build-mode-line): Rename from
+       solitaire-build-modeline.  All callers changed.
+
+       * play/zone.el (zone-hiding-mode-line): Rename from
+       zone-hiding-modeline.  All callers changed.
+       (zone): Remove unusued `modeline-hidden-level' property.
+
+       * progmodes/xscheme.el (xscheme-mode-line-initialize): Rename from
+       xscheme-modeline-initialize.  All callers changed.
+
+       * strokes.el (strokes-lighter): Rename from
+       strokes-modeline-string.
+
+       * textmodes/sgml-mode.el (html-face-tag-alist)
+       (html-tag-face-alist): Use mode-line face instead of obsolete
+       alias modeline.
+
+2012-06-02  Stefan Merten  <smerten@oekonux.de>
+
+       * textmodes/rst.el: Always require `cl'.
+       (rst-mode-map): Fix meaning of C-M-a / C-M-e.
+
+2012-06-02  Chong Yidong  <cyd@gnu.org>
+
+       * image.el (imagemagick-enabled-types): Rename from
+       imagemagick-types-enable.  Add many more types.
+       (imagemagick-types-inhibit): Change default to nil.
+       (imagemagick-filter-types): Caller changed.
+
+2012-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-macs.el: Use backquotes.
+       (cl-transform-function-property): Use eval-and-compile rather than
+       abusing `require'.
+       (defstruct): Use declare-function instead of with-no-warnings.
+
+       * emacs-lisp/bytecomp.el: Fix last change (bug#11594).
+       (byte-compile-output-docform): Re-add the print-circle bindings.
+       (byte-compile-fix-header): Use #$ just because it's shorter.
+       (byte-compile-output-file-form): Remove defun/defmacro.
+
+2012-06-01  Martin Rudalics  <rudalics@gmx.at>
+
+       * simple.el (choose-completion): Remove now obsolete binding for
+       owindow.
+
+2012-06-01  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-check-for-regexp): Search from buffer end,
+       in order to avoid "Stack overflow in regexp matcher".
+
+2012-05-31  Glenn Morris  <rgm@gnu.org>
+
+       * image.el: For clarity, call imagemagick-register-types at
+       top-level, rather than relying on a custom :initialize.
+       (imagemagick-types-enable): New option.  (Bug#11557)
+       (imagemagick-filter-types): New function.  (Bug#7406)
+       (imagemagick-register-types): Use imagemagick-filter-types.
+       If disabling support, remove elements altogether rather
+       than using an impossible regexp.
+       (imagemagick-types-inhibit): Give it the default init function.
+
+2012-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/bytecomp.el (byte-compile-fix-header):
+       Handle arbitrary file name lengths (Bug#11585).
+
+2012-05-31  Martin Rudalics  <rudalics@gmx.at>
+
+       * desktop.el (desktop-read): Clear previous and next buffers for
+       all windows and bury *Messages* buffer (bug#11556).
+
+2012-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Add `declare' for `defun'.  Align `defmacro's with it.
+       * emacs-lisp/easy-mmode.el (define-minor-mode)
+       (define-globalized-minor-mode): Don't autoload the var definitions.
+       * emacs-lisp/byte-run.el: Use lexical-binding.
+       (defun-declarations-alist, macro-declarations-alist): New vars.
+       (defmacro, defun): Use them.
+       (make-obsolete, define-obsolete-function-alias)
+       (make-obsolete-variable, define-obsolete-variable-alias):
+       Use `declare'.
+       (macro-declaration-function): Mark obsolete.
+       * emacs-lisp/autoload.el: Use lexical-binding.
+       (make-autoload): Add `expansion' arg.  Rely more on macro expansion.
+
+2012-05-30  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-with-no-warnings):
+       Define as a macro.
+       (ispell-kill-ispell, ispell-change-dictionary):
+       Use `called-interactively-p' for Emacs instead of obsolete
+       `interactive-p'.
+
+2012-05-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/byte-run.el (defmacro, defun): Move from C.
+       (macro-declaration-function): Move var from C code.
+       (macro-declaration-function): Define function with defalias.
+       * emacs-lisp/macroexp.el (macroexpand-all-1):
+       * emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form):
+       * emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't handle
+       defun/defmacro any more.
+       * emacs-lisp/bytecomp.el (byte-compile-arglist-signature):
+       Provide fallback for unknown arglist.
+       (byte-compile-arglist-warn): Change calling convention.
+       (byte-compile-output-file-form): Move print-vars binding.
+       (byte-compile-output-docform): Simplify accordingly.
+       (byte-compile-file-form-defun, byte-compile-file-form-defmacro)
+       (byte-compile-defmacro-declaration): Remove.
+       (byte-compile-file-form-defmumble): Generalize to defalias.
+       (byte-compile-output-as-comment): Return byte-positions.
+       Simplify callers accordingly.
+       (byte-compile-lambda): Use `assert'.
+       (byte-compile-defun, byte-compile-defmacro): Remove.
+       (byte-compile-file-form-defalias):
+       Use byte-compile-file-form-defmumble.
+       (byte-compile-defalias-warn): Remove.
+
+2012-05-29  Stefan Merten  <smerten@oekonux.de>
+
+       * textmodes/rst.el: Silence `checkdoc-ispell' errors where
+       possible.  Fix authors.  Improve comments.  Improve loading of `cl'.
+
+       (rst-mode-abbrev-table): Merge definition.
+       (rst-mode): Make sure `font-lock-defaults' is buffer local.
+       (rst-define-key, rst-deprecated-keys, rst-call-deprecated): Refactor.
+
+2012-05-29  Ulf Jasper  <ulf.jasper@web.de>
+
+       * calendar/icalendar.el
+       (icalendar-export-region): Export UID properly.
+
+2012-05-29  Leo Liu  <sdl.web@gmail.com>
+       * calendar/icalendar.el (icalendar-import-format):
+       Add `icalendar-import-format-uid' (Bug#11525).
+       (icalendar-import-format-uid): New.
+       (icalendar--parse-summary-and-rest, icalendar--format-ical-event):
+       Export UID.
+
+2012-05-29  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/pcase.el (pcase--expand): Accept different sets of vars in
+       different alternative patterns.
+       (pcase-codegen): Be more careful to preserve identity.
+       (pcase--u1): Don't forget to mark vars as used.
+
+       * emacs-lisp/bytecomp.el (byte-compile-constp): Treat #'v as a constant.
+       (byte-compile-close-variables): Bind byte-compile--outbuffer here...
+       (byte-compile-from-buffer): ...rather than here.
+
+       * emacs-lisp/byte-opt.el (byte-compile-inline-expand): Don't re-preprocess
+       functions from byte-compile-function-environment.
+
+2012-05-29  Troels Nielsen  <bn.troels@gmail.com>
+
+       * window.el (window-deletable-p): Avoid deleting the root window
+       of a frame with an active minibuffer.
+
+2012-05-29  Martin Rudalics  <rudalics@gmx.at>
+
+       * simple.el (choose-completion): Use quit-window (Bug#11567).
+
+2012-05-29  Chong Yidong  <cyd@gnu.org>
+
+       * whitespace.el (whitespace-cleanup): Fix usage of
+       whitespace-empty-at-bob-regexp (Bug#11492).
+
+2012-05-29  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
+
+       * vc/vc.el (vc-revert, vc-rollback): Dont kill vc-diff buffer on
+       revert (Bug#11488).
+
+2012-05-29  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-mode-map): Bind `M-s _' to
+       `isearch-toggle-symbol'.  Bind `M-s c' to
+       `isearch-toggle-case-fold'.
+       (search-map): Bind `M-s _' to `isearch-forward-symbol'.
+       (isearch-forward): Add `M-s _' to the docstring.
+       (isearch-forward-symbol, isearch-toggle-case-fold)
+       (isearch-symbol-regexp): New functions.  (Bug#11381)
+
+2012-05-29  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-word): Add docstring.  (Bug#11381)
+       (isearch-occur, isearch-search-and-update): If `isearch-word' is
+       a function, call it to get the regexp.
+       (isearch-message-prefix): If `isearch-word' holds a symbol, use its
+       property `isearch-message-prefix' instead of the string "word ".
+       (isearch-search-fun-default): For the case of `isearch-word',
+       return a lambda that calls re-search-forward/re-search-backward
+       with a regexp returned by `word-search-regexp' or by the function
+       in `isearch-word'.
+
+2012-05-29  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-search-fun-default): New function.
+       (isearch-search-fun): Move default part to the new function
+       `isearch-search-fun-default'.
+       (isearch-search-fun-function): Set the default value to
+       `isearch-search-fun-default'.  (Bug#11381)
+
+       * comint.el (comint-history-isearch-end):
+       Use `isearch-search-fun-default'.
+       (comint-history-isearch-search): Use `isearch-search-fun-default'
+       and remove spacial case for `isearch-word'.
+       (comint-history-isearch-wrap): Remove spacial case for
+       `isearch-word'.
+
+       * hexl.el (hexl-isearch-search-function):
+       Use `isearch-search-fun-default'.
+
+       * info.el (Info-isearch-search): Use `isearch-search-fun-default'.
+       Use `word-search-regexp' for `isearch-word'.
+
+       * misearch.el (multi-isearch-search-fun):
+       Use `isearch-search-fun-default'.
+
+       * simple.el (minibuffer-history-isearch-search):
+       Use `isearch-search-fun-default' and remove spacial case for
+       `isearch-word'.
+       (minibuffer-history-isearch-wrap): Remove spacial case for
+       `isearch-word'.
+
+       * textmodes/reftex-global.el (reftex-isearch-wrap-function):
+       Remove spacial case for `isearch-word'.
+       (reftex-isearch-isearch-search): Use `isearch-search-fun-default'.
+
+2012-05-28  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
+
+       Decrease XEmacs incompatibilities.
+       * textmodes/flyspell.el (flyspell-check-pre-word-p):
+       Use `string-match'.
+       (flyspell-delete-region-overlays): Use alternative definition for
+       XEmacs.
+       (flyspell-delete-all-overlays): Use `flyspell-delete-region-overlays'.
+       (flyspell-word): Use `process-kill-without-query' if XEmacs.
+       (flyspell-mode-on): Use `interactive-p' if XEmacs.
+       (flyspell-incorrect-face, flyspell-duplicate-face): Do not use
+       `define-obsolete-face-alias' under XEmacs, but old method.
+
+       * textmodes/ispell.el (ispell-with-no-warnings): XEmacs alternative
+       `with-no-warnings' definition or Emacs alias.
+       (ispell-command-loop, ispell-message): Use `ispell-with-no-warnings'.
+       (ispell-word): Do not use `region-p' if XEmacs.
+
+2012-05-28  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-find-aspell-dictionaries):
+       Check for `ispell-dictionary-base-alist' instead of full
+       `ispell-dictionary-alist'.
+       (ispell-init-process): Show spellchecker when starting new Ispell
+       process.
+
+2012-05-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/vhdl-mode.el: Sync with upstream 3.33.28.
+       http://www.iis.ee.ethz.ch/~zimmi/emacs/vhdl-mode.html#release-notes-3.33
+
+2012-05-27  Juanma Barranquero  <lekktu@gmail.com>
+
+       * version.el (motif-version-string, gtk-version-string)
+       (ns-version-string): Declare.
+
+2012-05-27  Juri Linkov  <juri@jurta.org>
+
+       * emacs-lisp/lisp-mode.el (eval-defun-2): Use `eval-sexp-add-defvars'
+       after the `eval-defun-1' specialcaseing
+       like in `edebug-eval-defun' (bug#10181).
+
+       * emacs-lisp/edebug.el (edebug-eval-defun): Set `face-documentation'
+       like in `eval-defun-1'.
+
+2012-05-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * mail/sendmail.el (mail-yank-region):
+       Recognize rmail-yank-current-message in addition to insert-buffer.
+       Fixes mail-mode's "C-c C-r" that otherwise does nothing when invoked in
+       a *mail* buffer created through rmail-start-mail with sendmail as
+       mail-user-agent.
+
+2012-05-27  Chong Yidong  <cyd@gnu.org>
+
+       * net/gnutls.el (gnutls-min-prime-bits): Improve docstring.
+       Default to 256 (Bug#11267).
+
+       * help.el (describe-mode): Doc fix.
+
+2012-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * w32-fns.el (w32-init-info): Remove.
+       * paths.el (Info-default-directory-list): Add w32-init-info equivalent.
+
+       * info.el (info-initialize): For self-contained NS builds, put the
+       included info/ directory at the front.  (Bug#2791)
+
+       * paths.el (Info-default-directory-list): Make it a defcustom,
+       mainly so that we can use custom-initialize-delay.
+
+2012-05-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * subr.el (buffer-has-markers-at): Mark obsolete.
+
+       * subr.el (lambda): Use declare.
+
+       * emacs-lisp/lisp-mode.el (lambda):
+       * emacs-lisp/edebug.el (lambda): Move properties to its definition.
+
+2012-05-26  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
+
+       * thingatpt.el (forward-same-syntax): Handle no ARG case.  (Bug#11560)
+
+2012-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * progmodes/cc-mode.el (auto-mode-alist): Fix typo.
+
+2012-05-25  Glenn Morris  <rgm@gnu.org>
+
+       * paths.el: Remove no-byte-compile.
+       * loadup.el: No need to load paths.el uncompiled.
+
+       * image.el (imagemagick-types-inhibit): Doc fix.
+
+       * version.el: Remove no-byte-compile and associated formatting.
+       * loadup.el: No need to load version.el uncompiled.  AFAICS, this
+       is ancient code from when there was an "inc-vers.el".
+
+2012-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/gdb-mi.el: Minor style changes.
+       (gdb-enable-debug, gdb-speedbar-auto-raise, gdb-many-windows):
+       Turn into minor modes.
+       (gdb--if-arrow): Rename from gdb-if-arrow, make it hygienic.
+       (gdb-mouse-until, gdb-mouse-jump): Adjust uses accordingly.
+       (gdb-shell): Remove unneeded let-binding.
+       (gdb-get-many-fields): Eliminate O(n²) behavior.
+
+2012-05-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * cus-start.el <vertical-centering-font-regexp>: Avoid warning on
+       platforms that don't link in fontset.c.
+
+2012-05-25  Juri Linkov  <juri@jurta.org>
+
+       Use the same diff color scheme as in modern VCSes (bug#10181).
+
+       * vc/diff-mode.el (diff-header, diff-file-header): Remove "green"
+       to avoid confusion with `diff-added' that now uses green colors.
+       (diff-removed): Use shades of red.
+       (diff-added): Use shades of green.
+       (diff-changed): Leave just the yellow color.
+       (diff-use-changed-face): New variable.
+       (diff-font-lock-keywords): Use `diff-use-changed-face' to decide
+       how to highlight context diff changes.
+       (diff-refine-change): Use shades of yellow.
+       (diff-refine-removed): New face that uses shades of red.
+       (diff-refine-added): New face that uses shades of green.
+       (diff-refine-hunk): Use `diff-refine-change', `diff-refine-added',
+       `diff-refine-removed' in the call to `smerge-refine-subst'
+       depending on the value of `diff-use-changed-face'.
+
+       * vc/smerge-mode.el (smerge-mine): Use shades of red.
+       (smerge-other): Use shades of green.
+       (smerge-base): Use shades of yellow.
+       (smerge-refined-change): Empty face.
+       (smerge-refined-removed): New face that uses shades of red.
+       (smerge-refined-added): New face that uses shades of green.
+       (smerge-refine-subst): Rename arg `props' to `props-c'.  Add new
+       args `props-r' and `props-a', and use them.  Doc fix.
+       (smerge-refine): Evaluate `smerge-use-changed-face' and depending
+       on its value use different faces `smerge-refined-change',
+       `smerge-refined-removed', `smerge-refined-added' in the call to
+       `smerge-refine-subst'.
+
+       * vc/ediff-init.el (ediff-current-diff-A, ediff-fine-diff-A):
+       Add face condition `min-colors 88' with shades of red.
+       (ediff-current-diff-B, ediff-fine-diff-B): Add face condition
+       `min-colors 88' with shades of green.
+       (ediff-current-diff-C, ediff-fine-diff-C): Add face condition
+       `min-colors 88' with shades of yellow.
+
+2012-05-24  Glenn Morris  <rgm@gnu.org>
+
+       * paths.el (prune-directory-list, remote-shell-program): Move to...
+       * files.el (prune-directory-list, remote-shell-program): ...here.
+       For the latter, delay initialization, prefer ssh, just search PATH.
+
+       * paths.el (term-file-prefix): Move to faces.el (the only user).
+       * faces.el (term-file-prefix): Move here, make it a defcustom.
+
+       * paths.el (news-directory, news-path, news-inews-program):
+       Move to gnus/nnspool.el.
+
+       * paths.el (gnus-default-nntp-server): Remove (gnus.el defines it).
+
+       * paths.el (rmail-file-name, rmail-spool-directory): Move from here...
+       * mail/rmail.el (rmail-file-name, rmail-spool-directory): ... to here.
+       Make the latter a defcustom, with a delayed initialization.
+
+       * paths.el (gnus-nntp-service, gnus-local-organization): Remove.
+       These were deleted from Gnus itself late 2010.
+
+2012-05-22  Juanma Barranquero  <lekktu@gmail.com>
+
+       * progmodes/which-func.el (which-func-ff-hook):
+       Check against user-error, not error.
+
+       * emacs-lisp/edebug.el (top): Do not load or set up loading of
+       cl-specs.el, which no longer exists.
+
+2012-05-22  Glenn Morris  <rgm@gnu.org>
+
+       * info.el (info-emacs-bug): New command.
+       * menu-bar.el (menu-bar-help-menu): Add "How to Report a Bug" to Help.
+       * mail/emacsbug.el (report-emacs-bug): Replace with info-emacs-bug.
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * makefile.w32-in (update-subdirs-SH):
+       * Makefile.in (update-subdirs): Update for moved update-subdirs.
+
+2012-05-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * hi-lock.el (hi-lock-face-defaults): Move obsolete before definition.
+
+       * progmodes/compile.el (compilation-error-regexp-alist-alist):
+       Simplify Maven regexp, and make sure the file can't start with a space
+       (bug#11517).
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (setwins, setwins_almost, setwins_for_subdirs):
+       Scrap superfluous subshells.
+
+2012-05-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/bytecomp.el (byte-compile-root-dir): New var.
+       (byte-compile-warning-prefix, batch-byte-compile-file): Use it.
+
+2012-05-19  Jay Belanger  <jay.p.belanger@gmail.com>
+
+       * calc/calc.el (calc-ensure-consistent-units): New variable.
+
+       * calc/calc-units.el (math-consistent-units-p)
+       (math-check-unit-consistency): New functions.
+       (calc-quick-units, calc-convert-units):
+       Use `math-check-unit-consistency' when `calc-ensure-consistent-units'
+       is non-nil.
+       (calc-extract-units): Fix typo.
+
+2012-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc/vc-bzr.el (vc-bzr-state-heuristic): Save match-data around sha1.
+
+       * textmodes/flyspell.el: Commenting style, plus code simplifications.
+       (flyspell-default-deplacement-commands): Don't spell check after
+       repeated window/frame switches (e.g. triggered by mouse-movement).
+       (flyspell-delay-commands, flyspell-deplacement-commands): Use mapc.
+       (flyspell-debug-signal-word-checked): Simplify and fit in 80 cols.
+       (flyspell-casechars-cache, flyspell-ispell-casechars-cache)
+       (flyspell-not-casechars-cache, flyspell-ispell-not-casechars-cache):
+       Remove unused vars.
+       (flyspell-get-casechars, flyspell-get-not-casechars):
+       Simplify; Don't bother removing a ] just to add it back.
+       * textmodes/ispell.el (ispell-program-name): Use executable-find.
+
+2012-05-18  Rüdiger Sonderfeld  <ruediger@c-plusplus.de>
+
+       * calc/calc-lang.el (math-C-parse-bess, math-C-parse-fma):
+       New functions.
+       (math-function-table): Add support for more C functions.
+
+2012-05-18  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
+
+       * textmodes/flyspell.el (flyspell-check-pre-word-p)
+       (flyspell-check-word-p, flyspell-debug-signal-word-checked):
+       Protect delay handling for otherchars against empty otherchars.
+
+2012-05-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/lisp-mode.el (doc-string-elt): Move those properties to
+       their respective macro declarations.
+       * skeleton.el (define-skeleton):
+       * progmodes/compile.el (define-compilation-mode):
+       * ibuf-macs.el (define-ibuffer-sorter, define-ibuffer-op)
+       (define-ibuffer-filter):
+       * emacs-lisp/generic.el (define-generic-mode):
+       * emacs-lisp/easy-mmode.el (define-minor-mode)
+       (define-globalized-minor-mode):
+       * emacs-lisp/cl-macs.el (defun*, defmacro*, defstruct, deftype):
+       * emacs-lisp/byte-run.el (defsubst):
+       * custom.el (deftheme): Add doc-string metadata.
+
+2012-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-macs.el, emacs-lisp/cl.el: Move indent info.
+
+2012-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/pcase.el (pcase--u1): Avoid ((lambda ...) ...).
+
+       * emacs-lisp/cl.el: Add edebug specs from cl-specs.el.
+       * emacs-lisp/cl-macs.el: Idem.
+       * emacs-lisp/cl-specs.el: Remove.
+
+2012-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Minor renaming of internal CL functions and variables.
+       * emacs-lisp/cl-seq.el (cl--adjoin): Rename from cl-adjoin.
+       (cl--position): Rename from cl-position.
+       (cl--delete-duplicates): Rename from cl-delete-duplicates.
+       * emacs-lisp/cl.el (cl--gensym-counter): Rename from *gensym-counter*.
+       (cl--random-state): Rename from *random-state*.
+
+2012-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/cl-macs.el (cl-transform-lambda): Don't add spurious
+       parens around the arg list (bug#11499).
+
+2012-05-17  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (word-search-regexp, word-search-backward)
+       (word-search-forward, word-search-backward-lax)
+       (word-search-forward-lax): Move functions from search.c
+       (bug#10145, bug#11381).
+
+2012-05-16  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
+
+       * textmodes/flyspell.el (flyspell-check-pre-word-p)
+       (flyspell-check-word-p, flyspell-debug-signal-word-checked):
+       Delay for otherchars as for normal word components.
+
+2012-05-16  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion--sifn-requote): Fix last change.
+       (minibuffer-local-must-match-filename-map):
+       Move define-obsolete-variable-alias before its var.
+
+2012-05-15  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/pcase.el (pcase-let*, pcase-let): Fix edebug spec.
+
+       * minibuffer.el (completion--sifn-requote): Handle sifn's truncation
+       behavior.
+       (completion--string-equal-p): New function.
+       (completion--twq-all): Use it to get better assertion failure data.
+
+       Only handle ".." and '..' quoting in shell-mode (bug#11466).
+       * shell.el (shell--unquote&requote-argument, shell--unquote-argument)
+       (shell--requote-argument): New functions.
+       (shell-completion-vars): Use them.
+       (shell--parse-pcomplete-arguments): Rename from
+       shell-parse-pcomplete-arguments.
+       * comint.el (comint-word): Obey comint-file-name-quote-list.  Simplify.
+       (comint--unquote&requote-argument): Don't handle ".." and '..' quoting.
+       Obey comint-file-name-quote-list.
+
+       * emacs-lisp/smie.el (smie-indent--bolp-1): New function.
+       (smie-indent-keyword): Use it.
+
+2012-05-14  Stefan Merten  <smerten@oekonux.de>
+
+       * textmodes/rst.el (rst-re-alist): Fix loading (bug#11462).
+
+2012-05-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * net/rlogin.el (rlogin-mode-map): Fix last change.
+
+2012-05-14  Jason L. Wright  <jason.wright@inl.gov>  (tiny change)
+
+       * mail/smtpmail.el (smtpmail-send-command): Send the command and
+       the following \r\n using a single `process-send-string', since the
+       Lotus SMTP server refuses to accept any commands if they are sent
+       with two `process-send-string's (Bug#11444).
+
+2012-05-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * shell.el (shell-parse-pcomplete-arguments):
+       Obey pcomplete-arg-quote-list inside double-quoted args (Bug#11348).
+
+2012-05-14  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * image-mode.el: Fit to width/height for rotated images (Bug#11431).
+       (image-transform-scale, image-transform-right-angle-fudge): New vars.
+       (image-transform-width, image-transform-fit-width): New functions.
+       (image-transform-properties): Use them.
+       (image-transform-check-size): New function.
+       (image-toggle-display-image): Use it (for testing).
+       (image-transform-set-rotation): Reduce angle mod 360.
+       Delete obsolete comment.
+
+2012-05-14  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * image-mode.el: Fix scaling (bug#11399).
+       (image-transform-resize): Doc fix.
+       (image-transform-properties): Default scale is 1 and height should
+       be an integer.
+
+2012-05-13  Johan Bockgård  <bojohan@gnu.org>
+
+       * emacs-lisp/smie.el (smie-next-sexp): Use accessor `op-forw' rather
+       than hard-coding `car', to fix misbehavior when moving forward.
+
+2012-05-13  Chong Yidong  <cyd@gnu.org>
+
+       * emacs-lisp/tabulated-list.el (tabulated-list-format)
+       (tabulated-list-entries, tabulated-list-padding)
+       (tabulated-list-sort-key): Make permanent-local.
+
+       * ebuff-menu.el: Adapt to Buffer Menu changes (Bug#11455).
+       (electric-buffer-list): Put electric buffer menu
+       command descriptions in this docstring, instead of the docstring
+       of electric-buffer-menu-mode.  Code cleanups.
+       (electric-buffer-menu-mode): Use define-derived-mode.  Rename from
+       Electric-buffer-menu-mode.
+       (electric-buffer-update-highlight): Minor code cleanup.
+
+2012-05-13  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/dbus.el (dbus-call-method): Restore events not from D-Bus.
+       (Bug#11447)
+
+2012-05-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Move define-obsolete-variable-alias before the var's definition.
+       * vc/log-edit.el (vc-comment-ring, vc-comment-ring-index):
+       * tooltip.el (tooltip-hook):
+       * textmodes/reftex-toc.el (reftex-toc-map):
+       * textmodes/reftex-sel.el (reftex-select-label-map)
+       (reftex-select-bib-map):
+       * textmodes/reftex-index.el (reftex-index-map)
+       (reftex-index-phrases-map):
+       * speedbar.el (speedbar-syntax-table, speedbar-key-map):
+       * progmodes/meta-mode.el (meta-mode-map):
+       * novice.el (disabled-command-hook):
+       * loadhist.el (unload-hook-features-list):
+       * frame.el (blink-cursor):
+       * files.el (find-file-not-found-hooks, write-file-hooks)
+       (write-contents-hooks):
+       * emulation/tpu-edt.el (GOLD-map):
+       * emacs-lock.el (emacs-lock-from-exiting):
+       * emacs-lisp/generic.el (generic-font-lock-defaults):
+       * emacs-lisp/chart.el (chart-map):
+       * dos-fns.el (register-name-alist):
+       * dired-x.el (dired-omit-files-p):
+       * desktop.el (desktop-enable):
+       * cus-edit.el (custom-mode-hook):
+       * buff-menu.el (buffer-menu-mode-hook):
+       * bookmark.el (bookmark-read-annotation-text-func)
+       (bookmark-exit-hooks):
+       * allout.el (allout-mode-deactivate-hook)
+       (allout-exposure-change-hook, allout-structure-added-hook)
+       (allout-structure-deleted-hook, allout-structure-shifted-hook):
+       * dirtrack.el (dirtrack-toggle, dirtrackp, dirtrack-debug-toggle)
+       (dirtrack-debug): Move call to define-obsolete-variable-alias so it
+       comes before the corresponding variable's definition.
+
+2012-05-12  Chong Yidong  <cyd@gnu.org>
+
+       * buff-menu.el (Buffer-menu-buffer+size-width): Doc fix (Bug#11454).
+       (Buffer-menu-mouse-select): Restore function (Bug#11459).
+       (Buffer-menu-mode-map): Bind it.
+       (Buffer-menu--pretty-name): Add a mouse-face property.
+
+2012-05-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/prolog.el: Use SMIE.  Cleanup regexp setup.
+       (prolog-upper-case-string, prolog-lower-case-string)
+       (prolog-atom-char-regexp, prolog-atom-regexp): Initialize in defconst.
+       (prolog-use-smie, prolog-smie-grammar): New vars.
+       (prolog-smie-forward-token, prolog-smie-backward-token)
+       (prolog-smie-rules): New funs.
+       (prolog-comment-indent): Remove.
+       (prolog-mode-variables): Use default comment indentation instead.
+       Setup SMIE.
+       (prolog-build-case-strings, prolog-set-atom-regexps): Remove.
+       (prolog-mode): Don't call them any more.
+       (prolog-electric-colon, prolog-electric-dash)
+       (prolog-edit-menu-insert-move): Use indent-according-to-mode.
+
+       * dabbrev.el (dabbrev-expand): Make "no expansion found" a user-error.
+
+       * minibuffer.el (completion--twq-all): Again, allow case differences.
+
+       * term.el: Move keymap initialization code to be more idiomatic.
+       (term-signals-menu, term-mode-map, term-raw-map, term-raw-escape-map)
+       (term-terminal-menu): Move initialization into declaration.
+       (term-escape-char): Let the user set it in her .emacs.
+
+       * progmodes/sh-script.el: Use post-self-insert-hook&electric-pair-mode.
+       Provide SMIE-based indentation (not enabled by default yet).
+       (sh-mode-map): Don't bind electric keys.
+       Use electric-pair-mode instead of skeleton-pair.
+       (sh-assignment-regexp): Fit within 80 columns.
+       (sh-indent-supported): Specify actual shell name instead of boolean.
+       (sh--maybe-here-document): New fun, from sh-maybe-here-document.
+       (sh-maybe-here-document): Use it.  Make obsolete.
+       (sh-electric-here-document-mode) New minor mode.
+       (sh-mode): Use it.  Don't set sh-indent-supported-here here.
+       (sh-smie-sh-grammar, sh-smie--sh-operators, sh-smie--sh-operators-re)
+       (sh-smie--sh-operators-back-re, sh-indent-after-continuation)
+       (sh-smie-rc-grammar, sh-use-smie): New vars.
+       (sh-smie--keyword-p, sh-smie--newline-semi-p, sh-smie--sh-keyword-p)
+       (sh-smie-sh-forward-token, sh-smie--looking-back-at-continuation-p)
+       (sh-smie-sh-backward-token, sh-smie--continuation-start-indent)
+       (sh-smie-sh-rules, sh-smie-rc-rules, sh-smie--sh-keyword-in-p)
+       (sh-smie--rc-after-special-arg-p, sh-smie-rc-backward-token)
+       (sh-smie-sh-rules, sh-smie--rc-newline-semi-p): New functions.
+       (sh-set-shell): Use smie-setup if requested.
+
+       * term.el (term-set-escape-char): Properly set term-escape-char.
+       See http://stackoverflow.com/questions/10524656.
+
+2012-05-10  Chong Yidong  <cyd@gnu.org>
+
+       * ffap.el (ffap-url-unwrap-local): Make it work right (Bug#9131).
+       Use url-generic-parse-url, and handle host names and Windows
+       filenames properly.
+       (ffap-url-unwrap-remote): Use url-generic-parse-url.
+       (ffap-url-unwrap-remote): Accept list values, specifying a list of
+       URL schemes to work on.
+       (ffap--toggle-read-only): New function.
+       (ffap-read-only, ffap-read-only-other-window)
+       (ffap-read-only-other-frame): Use it.
+       (ffap-fixup-url): Don't check ffap-ftp-regexp, since it is not
+       necessary for ffap-url-unwrap-remote.
+
+2012-05-10  Dave Abrahams  <dave@boostpro.com>
+
+       * cus-start.el (create-lockfiles): Add it.
+
+2012-05-09  Chong Yidong  <cyd@gnu.org>
+
+       * net/browse-url.el (browse-url-url-encode-chars): Use upper-case.
+       (browse-url-encode-url): Encode spaces and quotes (Bug#6300).
+
+2012-05-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * shell.el (shell-completion-vars): Fix last change (bug#11348).
+
+2012-05-09  Chong Yidong  <cyd@gnu.org>
+
+       * ansi-color.el (ansi-color-process-output): Check for validity of
+       comint-last-output-start before using it.  This avoids a bad
+       interaction with gdb-mi's input/output buffer.
+
+2012-05-09  Glenn Morris  <rgm@gnu.org>
+
+       * files.el (dir-locals-read-from-file):
+       Mention dir-locals in any error message.
+
+2012-05-09  Chong Yidong  <cyd@gnu.org>
+
+       * emacs-lisp/package.el (package-built-in-p): Handle the `emacs'
+       package (Bug#11410).
+
+       * emacs-lisp/package.el (package-buffer-info): Avoid putting local
+       variables into description.
+
+2012-05-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * shell.el (shell-completion-vars): Set pcomplete-arg-quote-list like
+       shell-delimiter-argument-list (bug#11348).
+       (shell-parse-pcomplete-arguments): Obey pcomplete-arg-quote-list.
+
+2012-05-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * textmodes/rst.el: Silence byte-compiler warnings.
+       (rst-re-alist, rst-reset-section-caches): Move around.
+       (rst-re): Use `characterp', not `char-valid-p'.
+       (font-lock-beg, font-lock-end): Declare.
+
+       * progmodes/idlw-shell.el (specs): Remove reference to deleted
+       variable `idlwave-shell-activate-alt-keybindings' and simplify.
+
+       * eshell/esh-cmd.el (eshell-debug-command): Fix typo in previous change.
+
+2012-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * files.el (auto-mode-alist): Treat ".make" like ".mk".
+
+2012-05-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc/log-edit.el: Add GNU coding standards highlighting.
+       (log-edit-font-lock-gnu-style)
+       (log-edit-font-lock-gnu-keywords): New vars.
+       (log-edit-font-lock-keywords): New fun.
+       (log-edit-mode): Don't fold case in font-lock.
+       (log-edit-font-lock-keywords): Do not assume case-folding.
+
+       * imenu.el: Misc cleanup.  Make docstrings out of comments.
+       Use lexical-binding.
+       (imenu--index-alist, imenu--last-menubar-index-alist)
+       (imenu-menubar-modified-tick): Use defvar-local.
+       (imenu--split-menu): Remove unused var.
+       (imenu--cleanup-seen): Declare as global.
+       (imenu--cleanup): Use dolist.
+
+       * subr.el (defvar-local): Add debug spec and doc-string position.
+
+2012-05-08  Glenn Morris  <rgm@gnu.org>
+
+       * language/burmese.el, language/cham.el, language/czech.el:
+       * language/english.el, language/georgian.el, language/greek.el:
+       * language/japanese.el, language/khmer.el, language/korean.el:
+       * language/lao.el, language/misc-lang.el, language/romanian.el:
+       * language/sinhala.el, language/slovak.el, language/tai-viet.el:
+       * language/thai.el, language/utf-8-lang.el:
+       Remove no-byte-compile setting.
+
+       * play/zone.el (zone-pgm-stress): Don't pollute kill-ring.  (Bug#11388)
+
+2012-05-08  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
+
+       * progmodes/make-mode.el (makefile-browse):
+       Remove unnecessary interactive.  (Bug#11324)
+
+2012-05-07  Glenn Morris  <rgm@gnu.org>
+
+       * forms-d2.el, forms-pass.el: Move to ../etc/forms directory.
+
+       * international/mule.el (find-auto-coding): Make "unibyte: t" obsolete.
+
+2012-05-07  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * loadup.el: Preload newcomment.el.
+       * newcomment.el: Move autoload-only code to toplevel.
+
+       * buff-menu.el (list-buffers--refresh): Mark `size' as right-align.
+       * emacs-lisp/tabulated-list.el (tabulated-list-init-header):
+       Handle new :right-align column property.
+       (tabulated-list-print-col): Idem, plus use `display' text-property to
+       try and preserve alignment for variable pitch fonts.
+
+2012-05-07  Chong Yidong  <cyd@gnu.org>
+
+       * emacs-lisp/tabulated-list.el: Add no-header-line alternative.
+       (tabulated-list-use-header-line): New var.
+       (tabulated-list-init-header): Use it.
+       (tabulated-list-print-fake-header): New function.
+       (tabulated-list-print): Use it.
+       (tabulated-list-sort-button-map): Add non-header-line commands.
+       (tabulated-list-init-header): Add column name property to basic
+       labels as well.
+       (tabulated-list-col-sort): Handle non-header-line button case.
+       (tabulated-list--sort-by-column-name): Fix a corner case.
+
+       * buff-menu.el (list-buffers--refresh):
+       Handle Buffer-menu-use-header-line.
+
+2012-05-06  Chong Yidong  <cyd@gnu.org>
+
+       * buff-menu.el: Convert to Tabulated List mode.
+       (Buffer-menu-buffer+size-width): Make obsolete.
+       (Buffer-menu-name-width, Buffer-menu-size-width): New variables.
+       (Buffer-menu-mode-map): Inherit from tabulated-list-mode-map.
+       (Buffer-menu-mode): Derive from tabulated-list-mode.  Move command
+       documentation into docstring of buffer-menu.
+       (Buffer-menu-toggle-files-only): Add an informative message.
+       (Buffer-menu-sort): Convert to alias for tabulated-list-sort.
+       (Buffer-menu-buffer, Buffer-menu-beginning, Buffer-menu-mark)
+       (Buffer-menu-unmark, Buffer-menu-backup-unmark)
+       (Buffer-menu-delete, Buffer-menu-save, Buffer-menu-not-modified)
+       (Buffer-menu-execute, Buffer-menu-select)
+       (Buffer-menu-marked-buffers, Buffer-menu-toggle-read-only)
+       (Buffer-menu-bury): Use Tabulated List machinery.
+       (Buffer-menu-mouse-select, Buffer-menu-sort-by-column)
+       (Buffer-menu-sort-button-map, Buffer-menu-make-sort-button):
+       Delete.
+       (list-buffers--refresh): New function.
+       (list-buffers-noselect): Use it.
+       (tabulated-list-entry-size->, Buffer-menu--pretty-name)
+       (Buffer-menu--pretty-file-name): New helper functions.
+
+       * loadup.el: Preload tabulated-list.
+
+       * emacs-lisp/tabulated-list.el (tabulated-list-sort): Rename from
+       tabulated-list-sort-column.
+       (tabulated-list-init-header): Add the initial aligning space even
+       if tabulated-list-padding is zero.
+
+2012-05-06  Christopher Schmidt  <christopher@ch.ristopher.com>
+
+       * emacs-lisp/cl-macs.el (cl-expr-contains): Handle cons cells
+       whose cdr is not a cons cell correctly (bug#11038).
+
+2012-05-06  Chong Yidong  <cyd@gnu.org>
+
+       * emacs-lisp/tabulated-list.el (tabulated-list-format):
+       Accept additional plist in column descriptors.
+       (tabulated-list-init-header): Obey it.
+       (tabulated-list-get-entry): New function.
+       (tabulated-list-put-tag): Use it.  Use string-width instead of
+       length.
+       (tabulated-list--column-number): New function.
+       (tabulated-list-print): Use it.
+       (tabulated-list-print-col): New function.
+       Set `tabulated-list-column-name' property on each column's text.
+       (tabulated-list-print-entry): Use it.
+       (tabulated-list-delete-entry, tabulated-list-set-col):
+       New functions.
+       (tabulated-list-sort-column): New command (Bug#11337).
+
+       * buff-menu.el (list-buffers): Move C-x C-b binding from
+       buff-menu.el to bindings.el.
+
+       * ebuff-menu.el (Electric-buffer-menu-undefined): Use the
+       :advertised-binding feature.
+
+2012-05-06  Troels Nielsen  <bn.troels@gmail.com>  (tiny change)
+
+       * progmodes/compile.el (compilation-internal-error-properties):
+       Calculate start position correctly when end-col is set but
+       end-line is not (Bug#11382).
+
+2012-05-06  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * man.el (Man-unindent): Use text-property-default-nonsticky to
+       prevent untabify from inheriting face properties (Bug#11408).
+
+2012-05-05  Stefan Merten  <smerten@oekonux.de>
+
+       * textmodes/rst.el: Major merge with upstream development up to
+       Docutils SVN r7399 / rst.el V1.2.1.
+
+       Clarify maintainership and authors.
+
+       (rst-extract-version, rst-cvs-header, rst-cvs-rev)
+       (rst-cvs-timestamp, rst-svn-rev, rst-svn-timestamp)
+       (rst-official-version, rst-official-cvs-rev, rst-version)
+       (rst-package-emacs-version-alist): New functions and variables
+       for version information.
+
+       (rst-bullets, rst-uri-schemes, rst-adornment-chars)
+       (rst-max-inline-length, rst-re-alist-def, rst-re-alist)
+       (rst-mode-syntax-table, rst-mode): New and corrected functions
+       and variables representing reStructuredText features.
+
+       (rst-re): New function for reStructuredText regexes.  Use in
+       many places.
+
+       (rst-deprecated-keys, rst-call-deprecated, rst-define-key)
+       (rst-mode-map): Rebind keys.
+
+       (rst-mode-lazy, rst-font-lock-keywords)
+       (rst-font-lock-extend-region)
+       (rst-font-lock-extend-region-internal)
+       (rst-font-lock-extend-region-extend)
+       (rst-font-lock-find-unindented-line-limit)
+       (rst-font-lock-find-unindented-line-match)
+       (rst-adornment-level, rst-font-lock-adornment-level)
+       (rst-font-lock-adornment-match)
+       (rst-font-lock-handle-adornment-pre-match-form)
+       (rst-font-lock-handle-adornment-matcher): Major revision of
+       font-locking.  Integrate with other code.  Use `jit-lock-mode'.
+
+       (rst-preferred-adornments, rst-adjust-hook)
+       (rst-new-adornment-down, rst-preferred-bullets)
+       (rst-preferred-bullets, rst-indent, rst-indent-width)
+       (rst-indent-field, rst-indent-literal-normal)
+       (rst-indent-literal-minimized, rst-indent-comment): Change,
+       extend and improve customization.
+
+       (rst-line-homogeneous-p, rst-line-homogeneous-nodent-p)
+       (rst-normalize-cursor-position, rst-get-decoration)
+       (rst-straighten-deco-spacing, rst-re-bullets, rst-re-items)
+       (rst-rstrip, rst-toc-insert-find-delete-contents)
+       (rst-shift-fill-region, rst-compute-bullet-tabs)
+       (rst-debug-print-tabs, rst-debug-mark-found)
+       (rst-shift-region-guts, rst-shift-region-right)
+       (rst-shift-region-left, rst-use-char-classes)
+       (rst-font-lock-keywords-function)
+       (rst-font-lock-indentation-point)
+       (rst-font-lock-find-unindented-line-begin)
+       (rst-font-lock-find-unindented-line-end)
+       (rst-font-lock-find-unindented-line)
+       (rst-font-lock-adornment-point, rst-font-lock-level)
+       (rst-adornment-level-alist): Remove functions and variables.
+
+       (rst-compare-adornments, rst-get-adornment-match)
+       (rst-suggest-new-adornment, rst-get-adornments-around)
+       (rst-adornment-complete-p, rst-get-next-adornment)
+       (rst-adjust-adornment, rst-display-adornments-hierarchy)
+       (rst-straighten-adornments): Standardize function names to
+       use "adornment" instead of "decoration".  Correct callers.
+       Similar standardizing in many places.
+
+       (rst-update-section, rst-adjust, rst-promote-region)
+       (rst-enumerate-region, rst-bullet-list-region)
+       (rst-repeat-last-character): Correct use of `interactive'.
+
+       (rst-classify-adornment, rst-find-all-adornments)
+       (rst-get-hierarchy, rst-adjust-adornment, rst-toc-update)
+       (rst-find-leftmost-column, rst-repeat-last-character):
+       Refactor functions.
+
+       (rst-find-title-line, rst-reset-section-caches)
+       (rst-get-adornments-around, rst-adjust-adornment-work)
+       (rst-arabic-to-roman, rst-roman-to-arabic)
+       (rst-insert-list-pos, rst-insert-list-new-item)
+       (rst-insert-list-continue, rst-insert-list, rst-forward-line):
+       New functions.
+
+       (rst-all-sections, rst-section-hierarchy)
+       (rst-arabic-to-roman, rst-initial-enums, rst-initial-items):
+       New variables.
+
+       (rst-toc-return-wincfg, rst-toc-quit-window): Use window
+       configuration instead of only buffer.  Change where necessary.
+
+       (rst-line-tabs, rst-compute-tabs, rst-indent-line)
+       (rst-shift-region, rst-adaptive-fill): New functions for
+       indentation and filling.
+
+       (rst-comment-line-break, rst-comment-indent)
+       (rst-comment-insert-comment, rst-comment-region)
+       (rst-uncomment-region): New functions for handling comments.
+
+       (rst-compile): Quote shell arguments.
+
+       (rst-compile-pdf-preview, rst-compile-slides-preview):
+       Delete temporary files after use.
+
+2012-05-05  Glenn Morris  <rgm@gnu.org>
+
+       * calendar/cal-html.el: Optionally include holidays in the output.
+       Suggested by Ed Reingold <reingold@emr.cs.iit.edu>.
+       (cal-html-holidays): New option.
+       (cal-html-css-default): Add holiday entry.
+       (holiday-in-range): Autoload it.
+       (cal-html-htmlify-entry): Add optional class argument.
+       (cal-html-htmlify-list): Add optional holidays argument.
+       (cal-html-insert-agenda-days): Include holidays in the output.
+       (cal-html-one-month): Maybe include holidays.
+
+       * calendar/holidays.el (holiday-in-range):
+       Move here from cal-tex-list-holidays.
+       * calendar/cal-tex.el (cal-tex-list-holidays):
+       Make it an obsolete alias for holiday-in-range.  Update all callers.
+
+2012-05-05  Chong Yidong  <cyd@gnu.org>
+
+       * select.el (xselect--encode-string): Always use utf-8 for TEXT on
+       Nextstep.
+
+2012-05-05  Ransom Williams  <auvergnerw@gmail.com>  (tiny change)
+
+       * files.el (file-auto-mode-skip): New var.
+       (set-auto-mode-1): Use it.
+
+2012-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * repeat.el: Use lexical-binding.
+       (repeat-last-self-insert, repeat-num-input-keys-at-self-insert)
+       (repeat-undo-count): Remove.
+       (repeat):
+       * progmodes/octave-mod.el (octave-abbrev-start):
+       * progmodes/f90.el (f90-abbrev-start):
+       * face-remap.el (text-scale-adjust):
+       * kmacro.el (kmacro-call-macro): Use set-temporary-overlay-map.
+
+       * emacs-lisp/pcase.el (pcase--let*): New function.
+       (pcase--expand, pcase-codegen, pcase--q1): Use it to reduce nesting
+       a bit more.
+       (pcase--split-pred): Be more clever about ruling out overlap between
+       a predicate and some constant pattern.
+       (pcase--q1): Use `null' instead of (eq foo nil).
+
+       * subr.el (setq-local, defvar-local): New macros.
+       (kbd): Redefine as an alias.
+       (with-selected-window): Leave unrelated frames alone.
+       (set-temporary-overlay-map): New function.
+
+2012-05-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * subr.el (user-error): New function.
+       * window.el (switch-to-buffer):
+       * vc/smerge-mode.el (smerge-resolve-function, smerge-resolve)
+       (smerge-match-conflict):
+       * simple.el (previous-matching-history-element)
+       (next-matching-history-element, goto-history-element, undo-more)
+       (undo-start):
+       * progmodes/etags.el (visit-tags-table-buffer, find-tag-tag)
+       (find-tag-noselect, find-tag-in-order, etags-goto-tag-location)
+       (next-file, tags-loop-scan, list-tags, complete-tag):
+       * progmodes/compile.el (compilation-loop):
+       * mouse.el (mouse-minibuffer-check):
+       * man.el (Man-bgproc-sentinel, Man-goto-page):
+       * info.el (Info-find-node-2, Info-extract-pointer, Info-history-back)
+       (Info-history-forward, Info-follow-reference, Info-menu)
+       (Info-extract-menu-item, Info-extract-menu-counting)
+       (Info-forward-node, Info-backward-node, Info-next-menu-item)
+       (Info-last-menu-item, Info-next-preorder, Info-last-preorder)
+       (Info-next-reference, Info-prev-reference, Info-index)
+       (Info-index-next, Info-follow-nearest-node)
+       (Info-copy-current-node-name):
+       * imenu.el (imenu--make-index-alist)
+       (imenu-default-create-index-function, imenu-add-to-menubar):
+       * files.el (basic-save-buffer, recover-file):
+       * emacs-lisp/easy-mmode.el (easy-mmode-define-navigation):
+       * emacs-lisp/checkdoc.el (checkdoc-continue, checkdoc-comments)
+       (checkdoc-message-text, checkdoc-defun):
+       * dabbrev.el (dabbrev-completion, dabbrev--abbrev-at-point):
+       * cus-edit.el (customize-changed-options, customize-rogue)
+       (customize-saved, custom-variable-set, custom-variable-mark-to-save)
+       (custom-variable-mark-to-reset-standard)
+       (custom-variable-reset-backup, custom-face-mark-to-reset-standard)
+       (custom-file):
+       * completion.el (check-completion-length):
+       * comint.el (comint-search-arg)
+       (comint-previous-matching-input-string-position)
+       (comint-previous-matching-input)
+       (comint-replace-by-expanded-history-before-point, comint-send-input)
+       (comint-copy-old-input, comint-backward-matching-input)
+       (comint-goto-process-mark, comint-set-process-mark):
+       * calendar/calendar.el (calendar-cursor-to-date): Use it.
+       * bindings.el (debug-ignored-errors): Remove regexps, add `user-error'.
+
+2012-05-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * dabbrev.el (dabbrev--ignore-case-p): New function.
+       (dabbrev-completion, dabbrev-expand, dabbrev--substitute-expansion):
+       Use it.
+
+       * files.el (automount-dir-prefix): Mark as obsolete.
+
+2012-05-04  Glenn Morris  <rgm@gnu.org>
+
+       * patcomp.el, play/bruce.el: Move to obsolete/.
+
+2012-05-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix minor Y10k bugs.
+       * arc-mode.el (archive-unixdate):
+       * autoinsert.el (auto-insert-alist):
+       * calc/calc-forms.el (math-this-year):
+       * emacs-lisp/copyright.el (copyright-current-year)
+       (copyright-update-year, copyright):
+       * tar-mode.el (tar-clip-time-string):
+       * time.el (display-time-update):
+       Don't assume years have 4 digits.
+
+2012-05-04  Chong Yidong  <cyd@gnu.org>
+
+       * dos-w32.el (file-name-buffer-file-type-alist)
+       (direct-print-region-use-command-dot-com):
+       * ffap.el (ffap-menu-regexp):
+       * find-file.el (ff-special-constructs):
+       * follow.el (follow-debug):
+       * forms.el (forms--debug):
+       * iswitchb.el (iswitchb-all-frames):
+       * ido.el (ido-all-frames):
+       * emacs-lisp/timer.el (timer-max-repeats):
+       * mail/feedmail.el (feedmail-mail-send-hook)
+       (feedmail-mail-send-hook-queued):
+       * mail/footnote.el (footnote-signature-separator):
+       * mail/mailabbrev.el (mail-alias-separator-string)
+       (mail-abbrev-mode-regexp):
+       * mail/rmail.el (rmail-speedbar-match-folder-regexp):
+       * progmodes/idlwave.el (idlwave-libinfo-file)
+       (idlwave-default-completion-case-is-down)
+       (idlwave-library-routines): Convert defvars to defcustoms.
+
+       * mail/rmail.el (rmail-decode-mime-charset):
+       * progmodes/idlw-shell.el (idlwave-shell-print-expression-function)
+       (idlwave-shell-fix-inserted-breaks)
+       (idlwave-shell-activate-alt-keybindings)
+       (idlwave-shell-use-breakpoint-glyph):
+       * facemenu.el (facemenu-unlisted-faces): Delete obsolete vars.
+
+2012-05-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion--twq-all): Beware completion-ignore-case.
+
+2012-05-03  Wilson Snyder  <wsnyder@wsnyder.org>
+
+       * progmodes/verilog-mode.el (font-lock-keywords):
+       Fix mis-highligting auto.  Reported by Craig Barner.
+       (verilog-auto, verilog-auto-undef): Add AUTOUNDEF to remove
+       defines from global name space. Reported by Dan Dever.
+       (verilog-auto-reset, verilog-auto-reset-widths)
+       (verilog-auto-tieoff): Support using unbased numbers for
+       AUTORESET and AUTOTIEOFF.
+       (verilog-submit-bug-report): Update variable list.
+       (verilog-read-auto-params): Fix AUTOINPUT regexps containing
+       parenthesis from not matching. Reported by Michael Rytting.
+       (verilog-auto-template-lint): Fix hash error when linting modules
+       with no used templates.
+       (verilog-warn, verilog-warn-error)
+       (verilog-warn-fatal): When non-interactive report multiple
+       warnings before exiting.  Suggested by Brad Dobbie.
+       (verilog-auto-template-lint, verilog-auto-template-warn-unused)
+       (verilog-read-auto-template): Add `verilog-auto-template-warn-unused'
+       to report unused template errors.  Reported by Brad Dobbie.
+       (verilog-read-decls): Fix AUTOWIRE etc on supply0, supply1 type
+       nets, bug438. Reported by Vns Blore.
+       (verilog-auto-inout-module, verilog-auto-reg)
+       (verilog-read-decls, verilog-read-sub-decls-sig)
+       (verilog-signals-edit-wire-reg, verilog-signals-with):
+       Fix passing of Verilog data types in ANSI input/output ports
+       such as "output logic" into the AUTOs. Special case "wire" and
+       "reg" for backwards compatibility presuming Verilog 2001.
+       (verilog-auto-ascii-enum): Add "auto enum" as alias.
+       (verilog-preprocess): Fix replication of preprocess output.
+       Reported by Brad Dobbie.
+       (verilog-auto-inst-interfaced-ports):
+       Create verilog-auto-inst-interfaced-ports, bug429.
+       Reported by Julian Gorfajn.
+       (verilog-after-save-font-hook)
+       (verilog-before-save-font-hook): New variable.
+       (verilog-modi-cache-results, verilog-save-font-mod-hooked)
+       (verilog-save-font-mods): Wrap disabling fontification, reported
+       by David Rogoff.
+       (verilog-do-indent, verilog-pretty-declarations-auto)
+       (verilog-sk-def-reg): Fix obeying `verilog-auto-lineup', bug305.
+       Reported by Pierre-David Pfister.
+       (verilog-set-auto-endcomments): Fix endtask auto comments outside
+       of class declarations, bug292.  Reported by Kevin Heilman.
+       (verilog-read-decls): Fix 'parameter type' not appearing in
+       AUTOINSTPARAM, bug340.  Reported by Jonathan Greenlaw.
+       (verilog-auto-logic): Fix when AUTOLOGIC present to properly do
+       AUTOINPUTs, bug411. Reported by Jonathan Greenlaw.
+       (verilog-read-auto-lisp): Avoid syntax-ppss warning on AUTOLISP.
+       Reported by David Kravitz.
+
+2012-05-03  Michael McNamara  <mac@mail.brushroad.com>
+
+       * progmodes/verilog-mode.el (verilog-pretty-expr): Don't line up
+       assignment with tests in ifs and for loops.
+       (verilog-extended-complete-re, verilog-complete-reg): Change so
+       that DPI inport functions don't look like fuction declarations.
+       (verilog-pretty-expr): Don't line up assignment
+       operations to the test and increment in if and for loops
+       (verilog-extended-complete-re, verilog-complete-reg): Change so
+       that DPI inport functions don't look like fuction declarations.
+
+2012-05-03  Kenichi Handa  <handa@m17n.org>
+
+       * mail/rmailmm.el (rmail-show-mime): Catch an error caused by text
+       decoding, and show a warning message without signaling an error
+       (Bug#11282).
+
+2012-05-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/bytecomp.el
+       (byte-compile-file-form-custom-declare-variable): Compile all elements,
+       since cconv.el might have introduced :fun-body, internal-make-closure,
+       and friends for bytecomp to handle (bug#11391).
+       * custom.el (defcustom): Avoid ((λ ..) ..).
+
+2012-05-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * subr.el (read-passwd): Better clean after ourselves (bug#11392).
+
+2012-05-02  Juanma Barranquero  <lekktu@gmail.com>
+
+       * notifications.el (dbus-debug):
+       * term/linux.el (gpm-mouse-enable):
+       * term/screen.el (xterm-register-default-colors): Declare.
+
+2012-05-02  Chong Yidong  <cyd@gnu.org>
+
+       * cus-start.el (gc-cons-percentage, exec-suffixes)
+       (dos-display-scancodes, dos-hyper-key, dos-super-key)
+       (dos-keypad-mode, debug-on-signal, vertical-centering-font-regexp)
+       (make-cursor-line-fully-visible, void-text-area-pointer)
+       (font-list-limit): Add customization data.
+
+       * allout.el (allout-exposure-change-functions)
+       (allout-structure-added-functions)
+       (allout-structure-deleted-functions)
+       (allout-structure-shifted-functions): Rename abnormal hooks from
+       *-hook, and convert to defcustoms.
+       (allout-after-copy-or-kill-hook, allout-post-undo-hook):
+       Convert to defcustoms.
+       (allout-mode-hook, allout-mode-deactivate-hook): Doc fix.
+
+       * allout-widgets.el: Hook callers changed.
+
+2012-05-02  Eli Zaretskii  <eliz@gnu.org>
+
+       * mail/rmail.el (rmail-yank-current-message): Use the encoding of
+       the yanked message in preference to the default value of
+       buffer-file-coding-system.
+
+2012-05-02  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (display-buffer--action-function-custom-type):
+       Fix entry.
+
+2012-05-02  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-defs.el (c-version): Update to 5.32.3.
+
+2012-05-01  Glenn Morris  <rgm@gnu.org>
+
+       * cus-start.el (suggest-key-bindings): Remove, now it is in Lisp.
+
+       * eshell/esh-cmd.el (eshell-debug-command): Doc fix.  Add :set.
+
+       * cus-edit.el (custom-variable-documentation): Simplify with format.
+
+2012-05-01  Aaron S. Hawley  <aaron.s.hawley@gmail.com>
+            Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * simple.el (suggest-key-bindings, execute-extended-command):
+       Move from keyboard.c.
+
+2012-05-01  Chong Yidong  <cyd@gnu.org>
+
+       * follow.el: Eliminate advice.
+       (set-process-filter, process-filter, sit-for): Advice deleted.
+       (follow-mode-off-hook): Obsolete hook removed.
+       (follow-avoid-tail-recenter-p, follow-process-filter-alist):
+       Vars deleted.
+       (follow-auto): Use a :set function.
+       (follow-mode): Rewritten.  Don't advise process filters.
+       (follow-switch-to-current-buffer-all, follow-scroll-up)
+       (follow-scroll-down): Assume follow-mode is bound.
+       (follow-comint-scroll-to-bottom)
+       (follow-align-compilation-windows): New functions.
+       (follow--window-sorter): New function.
+       (follow-all-followers): Use it to explicitly sort windows by their
+       positions; don't make assumptions about next-window order.
+       (follow-windows-start-end, follow-delete-other-windows-and-split)
+       (follow-calc-win-start): Doc fix.
+       (follow-windows-aligned-p, follow-select-if-visible): Don't call
+       vertical-motion unnecessarily.
+       (follow-adjust-window): New function.
+       (follow-post-command-hook): Use it.
+       (follow-call-set-process-filter, follow-call-process-filter)
+       (follow-intercept-process-output, follow-tidy-process-filter-alist)
+       (follow-stop-intercept-process-output, follow-generic-filter):
+       Functions deleted.
+       (follow-scroll-bar-toolkit-scroll, follow-scroll-bar-drag)
+       (follow-scroll-bar-scroll-up, follow-scroll-bar-scroll-down):
+       New functions, replacing advice on scroll-bar-* commands.
+       (follow-mwheel-scroll): New function (Bug#4112).
+
+       * comint.el (comint-adjust-point): New function.
+       (comint-postoutput-scroll-to-bottom): Use it.
+       Call follow-comint-scroll-to-bottom for Follow mode buffers.
+
+2012-05-01  Glenn Morris  <rgm@gnu.org>
+
+       * term/AT386.el, term/apollo.el, term/bobcat.el, term/cygwin.el:
+       * term/iris-ansi.el, term/linux.el, term/lk201.el, term/news.el:
+       * term/screen.el, term/vt102.el, term/vt125.el, term/vt200.el:
+       * term/vt201.el, term/vt220.el, term/vt240.el, term/vt300.el:
+       * term/vt320.el, term/vt400.el, term/vt420.el, term/wyse50.el:
+       Remove no-byte-compile setting.
+
+2012-05-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion-table-with-quoting): Fix compatibility
+       all-completions code to not return a number in the last cdr.
+
+2012-04-30  Leo Liu  <sdl.web@gmail.com>
+
+       * ibuf-ext.el (ibuffer-diff-buffer-with-file-1): Avoid buffer
+       read-only error.
+
+2012-04-29  Chong Yidong  <cyd@gnu.org>
+
+       * follow.el (follow-calc-win-end): Rewrite to handle partial
+       screen lines correctly (Bug#8390).
+       (follow-avoid-tail-recenter): Minor cleanup.
+
+2012-04-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Avoid the obsolete `assoc' package.
+       * speedbar.el (speedbar-refresh): Avoid adelete.
+       (speedbar-file-lists): Simplify and avoid aput.
+       * man.el (Man--sections, Man--refpages): New vars, replacing
+       Man-sections-alist and Man-refpages-alist.
+       (Man-build-section-alist, Man-build-references-alist):
+       Use them; avoid aput.
+       (Man--last-section, Man--last-refpage): New vars.
+       (Man-follow-manual-reference): Use them.
+       Use the `default' arg of completing-read.
+       (Man-goto-section): Idem.  Move prompt to the `interactive' spec.
+
+2012-04-27  Chong Yidong  <cyd@gnu.org>
+
+       * vc/diff.el (diff-sentinel): Go to bob (Bug#10259).
+
+       * startup.el (x-apply-session-resources): New function.
+
+       * term/ns-win.el (ns-initialize-window-system):
+       * term/w32-win.el (w32-initialize-window-system):
+       * term/x-win.el (x-initialize-window-system): Use it to properly
+       set menu-bar-mode and other vars from X resources, even if the
+       initial frame is not a window-system frame (Bug#2299).
+
+       * subr.el (read-key): Avoid running filter function when setting
+       up temporary tool bar entries (Bug#9922).
+
+2012-04-27  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * vc/vc-git.el (vc-git-state): Fix regexp matching diff output.
+       (Bug#11344)
+
+2012-04-27  Chong Yidong  <cyd@gnu.org>
+
+       * select.el (xselect--encode-string): New function, split from
+       xselect-convert-to-string.
+       (xselect-convert-to-string): Use it.
+       (xselect-convert-to-filename, xselect-convert-to-os)
+       (xselect-convert-to-host, xselect-convert-to-user): Ensure that
+       returned strings are properly encoded (Bug#11315).
+
+2012-04-27  Chong Yidong  <cyd@gnu.org>
+
+       * simple.el (delete-active-region): Move to killing custom group.
+
+2012-04-27  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * progmodes/which-func.el (which-func-current): Quote %
+       characters for mode-line processing.
+
+2012-04-27  Chong Yidong  <cyd@gnu.org>
+
+       * xml.el (xml-parse-region, xml-parse-tag): Avoid errors due to
+       reaching eob (Bug#11286).
+
+2012-04-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * progmodes/gdb-mi.el (gdb-control-level): New variable.
+       (gdb): Make it buffer-local and init to zero.
+       (gdb-control-commands-regexp): New variable.
+       (gdb-send): Don't wrap in "-interpreter-exec console" if
+       gdb-control-level is positive.  Increment gdb-control-level
+       whenever the command matches gdb-control-commands-regexp, and
+       decrement it each time the command is "end".  (Bug#11279)
+
+2012-04-27  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (adjust-window-trailing-edge, enlarge-window)
+       (shrink-window, window-resize):
+       * mouse.el (mouse-drag-line): Fix resizing of minibuffer
+       windows (Bug#11276).
+
+2012-04-27  Chong Yidong  <cyd@gnu.org>
+
+       * progmodes/pascal.el (pascal--extra-indent): Rename from ind, to
+       fix "missing prefix" warning.  All callers changed.
+
+2012-04-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/assoc.el: Move to obsolete/.
+
+2012-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/assoc.el (aget): Fix dynamic-scoping issue (bug#11352).
+
+       * term/ns-win.el (ns-define-service):
+       * progmodes/pascal.el (pascal-goto-defun):
+       * progmodes/js.el (js--read-tab):
+       * progmodes/etags.el (tags-lazy-completion-table):
+       * emacs-lisp/syntax.el (syntax-propertize-via-font-lock):
+       * emacs-lisp/ewoc.el (ewoc--wrap):
+       * emacs-lisp/assoc.el (aput, adelete, amake):
+       * doc-view.el (doc-view-convert-current-doc):
+       * vc/diff.el (diff-no-select): Replace lexical-let by lexical-binding.
+
+2012-04-26  Chong Yidong  <cyd@gnu.org>
+
+       * image.el (image-type-from-buffer): Only return supported image
+       type (Bug#9045).
+
+       * vc/diff-mode.el (diff-beginning-of-hunk): Return a meaningful
+       value, for symmetry with diff-end-of-hunk.
+       (diff-split-hunk, diff-find-source-location)
+       (diff-ignore-whitespace-hunk, diff-refine-hunk): Use it.
+       (diff-bounds-of-hunk, diff-bounds-of-file): New functions.
+       (diff-restrict-view, diff-hunk-kill, diff-file-kill): Use them to
+       compute the relevant hunk or file properly (Bug#6005).
+       (diff-file-junk-re): Add bzr's "modified file" tag (Bug#6041).
+
+2012-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * vc/vc-mtn.el:
+       * vc/vc-hg.el:
+       * vc/vc-git.el:
+       * vc/vc-dir.el:
+       * vc/vc-cvs.el:
+       * vc/vc-bzr.el:
+       * vc/vc-arch.el:
+       * vc/vc.el: Replace lexical-let by lexical-binding.
+       * minibuffer.el (lazy-completion-table): Avoid ((λ ...) ...).
+       * emacs-lisp/cl-macs.el (lexical-let): Fix use in lexical-binding.
+       * emacs-lisp/cconv.el (cconv-analyse-form): Warn use of ((λ ...) ...).
+
+2012-04-26  Chong Yidong  <cyd@gnu.org>
+
+       * vc/diff-mode.el (diff-undo): New command (Bug#5302).
+       (diff-mode-shared-map): Bind it to / and [remap undo].
+
+       * vc/ediff-wind.el (ediff-setup-windows-default): New function.
+       (ediff-window-setup-function): Use it as the default, to set up
+       windows based on whether the current frame is graphical (Bug#2138).
+       (ediff-choose-window-setup-function-automatically): Make obsolete.
+
+       * vc/ediff-init.el: Always define ediff-pixel-width/height.
+
+2012-04-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * ffap.el: Remove old code for obsolete package.
+       (ffap-complete-as-file-p): Remove.
+
+       Use completion-table-with-quoting for comint and pcomplete.
+       * comint.el (comint--unquote&requote-argument)
+       (comint--unquote-argument, comint--requote-argument): New functions.
+       (comint--unquote&expand-filename, comint-unquote-filename): Obsolete.
+       (comint-quote-filename): Use regexp-opt-charset.
+       (comint--common-suffix, comint--common-quoted-suffix)
+       (comint--table-subvert): Remove.
+       (comint-unquote-function, comint-requote-function): New vars.
+       (comint--complete-file-name-data): Use them with
+       completion-table-with-quoting.
+       * pcmpl-unix.el (pcomplete/scp): Use completion-table-subvert.
+       * pcomplete.el (pcomplete-arg-quote-list)
+       (pcomplete-quote-arg-hook, pcomplete-quote-argument): Obsolete.
+       (pcomplete-unquote-argument-function): Default to non-nil.
+       (pcomplete-unquote-argument): Simplify.
+       (pcomplete--common-quoted-suffix): Remove.
+       (pcomplete-requote-argument-function): New var.
+       (pcomplete--common-suffix): New function.
+       (pcomplete-completions-at-point): Use completion-table-with-quoting
+       and completion-table-subvert.
+
+       * minibuffer.el: Use completion-table-with-quoting for read-file-name.
+       (minibuffer--double-dollars): Preserve properties.
+       (completion--sifn-requote): New function.
+       (completion--file-name-table): Rewrite using it and c-t-with-quoting.
+
+       * minibuffer.el: Add support for completion of quoted/escaped data.
+       (completion-table-with-quoting, completion-table-subvert): New funs.
+       (completion--twq-try, completion--twq-all): New functions.
+       (completion--nth-completion): New function.
+       (completion-try-completion, completion-all-completions): Use it.
+
+2012-04-25  Leo Liu  <sdl.web@gmail.com>
+
+       * progmodes/python.el (python-pdbtrack-get-source-buffer):
+       Use compilation-message if available to find real filename.
+
+2012-04-25  Chong Yidong  <cyd@gnu.org>
+
+       * vc/diff-mode.el (diff-setup-whitespace): New function.
+       (diff-mode): Use it.
+
+       * vc/diff.el (diff-sentinel):
+       * vc/vc.el (vc-diff-finish): Call diff-setup-whitespace to assign
+       Whitespace mode variables based on diff style (Bug#8612).
+
+2012-04-25  Leo Liu  <sdl.web@gmail.com>
+
+       * progmodes/python.el (python-send-region): Add suffix .py to the
+       temp file.
+
+       * files.el (auto-mode-alist): Use javascript-mode instead.
+
+2012-04-25  Alex Harsanyi  <AlexHarsanyi@gmail.com>
+
+       Sync with soap-client repository.  Support SOAP simpleType (Bug#10331).
+
+       * net/soap-client.el (soap-resolve-references-for-sequence-type)
+       (soap-resolve-references-for-array-type): Hack to prevent self
+       references, see Bug#9.
+       (soap-parse-envelope): Report the contents of the 'detail' node
+       when receiving a fault reply.
+       (soap-parse-envelope): Report the contents of the entire 'detail' node.
+
+       * net/soap-inspect.el (soap-sample-value-for-simple-type)
+       (soap-inspect-simple-type): New function.
+
+       * net/soap-client.el (soap-simple-type): New struct.
+       (soap-default-xsd-types, soap-default-soapenc-types)
+       (soap-decode-basic-type, soap-encode-basic-type):
+       support unsignedInt and double basic types.
+       (soap-resolve-references-for-simple-type)
+       (soap-parse-simple-type, soap-encode-simple-type): New function.
+       (soap-parse-schema): Parse xsd:simpleType declarations.
+
+       * net/soap-client.el (soap-default-xsd-types)
+       (soap-default-soapenc-types): Add integer, byte and anyURI types.
+       (soap-parse-complex-type-complex-content): Use `soap-wk2l' to find
+       the local name of "soapenc:Array".
+       (soap-decode-basic-type, soap-encode-basic-type): Support encoding
+       decoding integer, byte and anyURI xsd types.
+
+2012-04-25  Chong Yidong  <cyd@gnu.org>
+
+       * cus-edit.el (custom-buffer-create-internal): Update header text.
+
+2012-04-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * progmodes/gdb-mi.el (gdb-init-1): Condition Windows-specific
+       settings on 'system-type', not on 'window-system'.  On MS-Windows,
+       set interactive-mode on in GDB.
+
+2012-04-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/ruby-mode.el: Simplify last change, and cleanup code.
+       (ruby-syntax-propertize-regexp): Remove.
+       (ruby-syntax-propertize-function): Split regexp into chunks.
+       Match following code directly.
+
+2012-04-24  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el: Handle Cucumber defs (bug#6286).
+       (ruby-syntax-propertize-regexp): New function.
+       (ruby-syntax-propertize-function): Use it to handle regexp not preceded
+       by a special keyword.
+
+       * progmodes/ruby-mode.el: Handle general delimited literals (bug#6286).
+       (ruby-syntax-general-delimiters-goto-beg)
+       (ruby-syntax-propertize-general-delimiters): New functions.
+       (ruby-syntax-propertize-function): Use them to handle GDL.
+       (ruby-font-lock-keywords): Move old handling of GDL...
+       (ruby-font-lock-syntactic-keywords): .. to here.
+       (ruby-calculate-indent): Adjust indentation for GDL.
+
+2012-04-24  Michael Albinus  <michael.albinus@gmx.de>
+
+       * notifications.el (top): Remove unneeded declarations.
+       (notifications-specification-version): Change to "1.2".
+       (notifications-interface, notifications-notify-method)
+       (notifications-close-notification-method): Fix docstring.
+       (notifications-get-capabilities-method): New defconst.
+       (notifications-notify): Add :action-items, :resident and
+       :transient hints.  Change "image_data" to "image-data" and
+       "image_path" to "image-path".
+       (notifications-get-capabilities): New defun.
+
+2012-04-24  Leo Liu  <sdl.web@gmail.com>
+
+       * progmodes/python.el: Move hideshow setup to the end.
+
+2012-04-24  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (handle-select-window): Clear echo area since this is
+       no more done by read_char (Bug#11304).
+
+2012-04-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * ibuffer.el (ibuffer-mode-map): Bind `/ m' to filter-used-mode
+       and `/ M' to filter-derived-mode.
+       * ibuf-ext.el (ibuffer-list-buffer-modes): Simplify; avoid add-to-list.
+       (ibuffer-filter-by-mode, ibuffer-filter-by-used-mode)
+       (ibuffer-mark-by-mode): Use default rather than initial-input.
+       (ibuffer-filter-by-derived-mode): Autoload and require-match.
+
+2012-04-24  Ivan Andrus  <darthandrus@gmail.com>  (tiny change)
+
+       * ibuf-ext.el (ibuffer-list-buffer-modes): Add `include-parents' arg.
+       (ibuffer-filter-by-derived-mode): New filter.
+       * ibuffer.el (ibuffer-mode-map): Bind to `/ w'.
+
+2012-04-23  Andreas Politz  <politza@fh-trier.de>
+
+       * subr.el (accept-change-group): Fix arg usage (Bug#6095).
+
+2012-04-23  Chong Yidong  <cyd@gnu.org>
+
+       * cus-edit.el (customize-apropos, customize-apropos-options):
+       Disable matching of non-option variables (Bug#11176).
+       (customize-option, customize-option-other-window)
+       (customize-changed-options): Doc fix.
+       (customize-apropos-options, customize-apropos-faces)
+       (customize-apropos-groups): Use apropos-read-pattern (Bug#11124).
+
+       * apropos.el (apropos-read-pattern): Make prompt less cryptic.
+       Fix word list splitting (Bug#11132).
+       (apropos-symbol, apropos-keybinding, apropos-label)
+       (apropos-property, apropos-function-button)
+       (apropos-variable-button, apropos-misc-button): New faces.
+       (apropos-symbol-face, apropos-keybinding-face)
+       (apropos-label-face, apropos-property-face, apropos-match-face):
+       Variables removed (Bug#8396).
+       (apropos-library-button, apropos-format-plist, apropos-print)
+       (apropos-print-doc, apropos-describe-plist): Callers changed.
+
+2012-04-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/xesam.el (xesam-mode-map): Use let-bound map in
+       initialization.  (Bug#11292)
+
+2012-04-23  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
+
+       Preserve ispell session localwords when switching back to
+       original buffer.
+
+       * textmodes/ispell.el (ispell-buffer-session-localwords):
+       New buffer-local variable to hold buffer session localwords.
+       (ispell-kill-ispell): Add option 'clear to delete session
+       localwords.
+       (ispell-command-loop, ispell-change-dictionary)
+       (ispell-buffer-local-words): Preserve session localwords when
+       needed.
+
+       * textmodes/flyspell.el (flyspell-process-localwords)
+       (flyspell-do-correct): Preserve session localwords when needed.
+
+2012-04-23  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-insert-word) Remove unneeded function
+       using obsolete `translation-table-for-input'.
+       (ispell-word, ispell-process-line, ispell-complete-word):
+       Use plain `insert' instead of removed `ispell-insert-word'.
+
+2012-04-22  Chong Yidong  <cyd@gnu.org>
+
+       * cus-edit.el (custom-variable-menu)
+       (custom-variable-reset-saved, custom-face-menu)
+       (custom-face-reset-saved): If there is no saved value, make the
+       "reset-saved" operation bring back the default (Bug#9509).
+       (custom-face-state): Properly detect themed faces.
+
+       * faces.el (face-spec-set): Stop supporting deprecated form of
+       third arg.
+
+2012-04-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       Move functions from C to Lisp.  Make non-blocking method calls
+       the default.  Implement further D-Bus standard interfaces.
+
+       * net/dbus.el (dbus-message-internal): Declare function.
+       Remove unneeded function declarations.
+       (defvar dbus-message-type-invalid, dbus-message-type-method-call)
+       (dbus-message-type-method-return, dbus-message-type-error)
+       (dbus-message-type-signal): Declare variables.  Remove local
+       definitions.
+       (dbus-interface-dbus, dbus-interface-peer)
+       (dbus-interface-introspectable, dbus-interface-properties)
+       (dbus-path-emacs, dbus-interface-emacs, dbus-return-values-table):
+       Adapt docstring.
+       (dbus-interface-objectmanager): New defconst.
+       (dbus-call-method, dbus-call-method-asynchronously)
+       (dbus-send-signal, dbus-method-return-internal)
+       (dbus-method-error-internal, dbus-register-service)
+       (dbus-register-signal, dbus-register-method): New defuns, moved
+       from dbusbind.c
+       (dbus-call-method-handler, dbus-setenv)
+       (dbus-get-all-managed-objects, dbus-managed-objects-handler):
+       New defuns.
+       (dbus-call-method-non-blocking): Make it an obsolete function.
+       (dbus-unregister-object, dbus-unregister-service)
+       (dbus-handle-event, dbus-register-property)
+       (dbus-property-handler): Obey the new structure of
+       `bus-registered-objects'.
+       (dbus-introspect): Use `dbus-call-method'.  Use a timeout.
+       (dbus-get-property, dbus-set-property, dbus-get-all-properties):
+       Use `dbus-call-method'.
+
+2012-04-22  Chong Yidong  <cyd@gnu.org>
+
+       * cus-edit.el (custom-commands, custom-reset-menu)
+       (Custom-reset-standard): Tweak labels.
+       (custom-reset-button-menu): Change default to t.
+       (custom-buffer-create-internal): For the custom-reset-button-menu
+       case, put the revert button first.
+       (custom-group-subtitle): New face.
+       (custom-group-value-create): Align docstring to a specific column.
+
+       * wid-edit.el (widget-documentation-link-add): Don't handle
+       indentation in this function.
+       (widget-documentation-string-indent-to): New function.
+       (widget-documentation-string-value-create): Use it.
+
+       * autorevert.el (auto-revert):
+       * epg-config.el (epg):
+       * ibuffer.el (ibuffer):
+       * mpc.el (mpc):
+       * ses.el (ses):
+       * eshell/eshell.el (eshell):
+       * net/ange-ftp.el (ange-ftp):
+       * progmodes/ebnf2ps.el (postscript):
+       * progmodes/flymake.el (flymake):
+       * progmodes/prolog.el (prolog):
+       * progmodes/verilog-mode.el (verilog-mode):
+       * progmodes/which-func.el (which-func):
+       * term/xterm.el (xterm):
+       * textmodes/picture.el (picture):
+       * textmodes/tildify.el (tildify):
+       * vc/ediff.el (ediff): Tweak defgroups to improve presentation in
+       customization buffers.
+
+2012-04-22  Alan Mackenzie  <acm@muc.de>
+
+       * progmodes/cc-engine.el (c-append-lower-brace-pair-to-state-cache):
+       Adding a ) can hide the resulting (..) from searches.  Fix it.
+       Bound the backward search to the position of the existing (.
+
+2012-04-21  Juanma Barranquero  <lekktu@gmail.com>
+
+       * progmodes/verilog-mode.el (verilog-mode): Check whether
+       which-func-modes is t before adding verilog-mode.
+       Reported by Andy Moreton <andrewjmoreton@gmail.com>.
+
+2012-04-21  Leo Liu  <sdl.web@gmail.com>
+
+       * net/rcirc.el (rcirc): Avoid error when process-contact returns t.
+
+2012-04-21  Michael Vehrs  <Michael.Burschik@gmx.de>
+
+       * woman.el: Add support for "T{ T}" tbl syntax, and fix the
+       filling of the last column of a table (Bug#5635).
+       (woman-find-next-control-line): New arg, specifying an additional
+       regexp component for the control line.
+       (woman2-roff-buffer): Use it.
+       (woman-break-table): New function.
+       (woman2-TS): Use it.
+
+2012-04-21  Chong Yidong  <cyd@gnu.org>
+
+       * woman.el (woman-set-buffer-display-table, woman-decode-region)
+       (woman-horizontal-escapes, woman-negative-vertical-space)
+       (woman-tab-to-tab-stop, woman2-fc, woman2-TS)
+       (WoMan-warn-ignored): Use ?\s instead of ?\ .
+
+2012-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuffer.el (completion-file-name-table): Complete user names.
+
+2012-04-20  Leo Liu  <sdl.web@gmail.com>
+
+       * font-lock.el (lisp-font-lock-keywords-2): Add pcase, pcase-let
+       and pcase-let*.
+
+2012-04-20  Chong Yidong  <cyd@gnu.org>
+
+       * server.el (server-execute): Respect initial-buffer-choice if it
+       is a string and there are no files to open (Bug#2825).
+       (server-create-window-system-frame, server-create-tty-frame):
+       Don't switch buffers here.
+       (server-process-filter): Only try to open a window system frame if
+       compiled with graphical support (Bug#8314).
+
+2012-04-20  Dan Nicolaescu  <dann@gnu.org>
+
+       * battery.el (battery-echo-area-format): Display remaining time
+       for sysfs backend too (Bug#11269).
+       (battery-linux-sysfs): Fix conditional for the charge.
+
+2012-04-20  Chong Yidong  <cyd@gnu.org>
+
+       * progmodes/gdb-mi.el (gdb): Revert previous change.
+       (gdb-inferior-io--init-proc): New function.
+       (gdb-init-1): Use it.
+       (gdb-inferior-io-sentinel): New sentinel for the gdb-inferior pty,
+       responsible for allocating a new pty and hooking it to gdb when
+       the old pty gets an EIO due to process exit.
+       (gdb-delchar-or-quit): New command.  Bind it in gdb-mi buffers.
+       (gdb-tooltip-print): Don't use obsolete tooltip-use-echo-area.
+       (gdb-inferior-io--maybe-delete-pty): Move into gdb-reset.
+
+2012-04-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * window.el (window-min-size, window-sizable, window-min-delta)
+       (window-max-delta, window--resizable, window-resizable)
+       (window-total-size, window-full-height-p, window-full-width-p)
+       (window-in-direction, window--resize-mini-window, window-resize)
+       (window--resize-child-windows-normal)
+       (window--resize-child-windows, window--resize-siblings)
+       (window--resize-this-window, adjust-window-trailing-edge)
+       (enlarge-window, shrink-window): Doc fixes.
+
+2012-04-20  Chong Yidong  <cyd@gnu.org>
+
+       * progmodes/gdb-mi.el (gdb-inferior-io--maybe-delete-pty):
+       New function to call delete-process on the gdb-inferior buffer's pty.
+       (gdb-reset): Use it, instead of relying on kill-buffer to kill the
+       pty process (Bug#11273).
+       (gdb-update): New arg to suppress talking to the gdb process.
+       (gdb-done-or-error): Use it.
+       (gdb-stopped-functions): Rename from gdb-stopped-hooks.
+       (gdb): Call gdb-inferior-io--maybe-delete-pty as a workaround for
+       sentinel not being called.
+
+       * comint.el (make-comint-in-buffer, comint-exec): Doc fix.
+
+       * progmodes/grep.el (grep, rgrep): Doc fix (Bug#11268).
+
+2012-04-20  Glenn Morris  <rgm@gnu.org>
+
+       * net/network-stream.el (open-network-stream): Doc fix.
+
+2012-04-20  Chong Yidong  <cyd@gnu.org>
+
+       * emacs-lisp/tabulated-list.el (tabulated-list-print): Fix typos.
+
+2012-04-20  Alan Mackenzie  <acm@muc.de>
+
+       Ensure searching for keywords is case sensitive.
+
+       * progmodes/cc-cmds.el (c-electric-brace, c-electric-lt-gt)
+       (c-electric-paren, c-beginning-of-defun, c-end-of-defun)
+       (c-defun-name, c-mark-function, c-cpp-define-name)
+       (c-comment-indent, c-scan-conditionals, c-indent-defun)
+       (c-context-line-break): Bind case-fold-search to nil.
+
+       * progmodes/cc-mode.el (c-font-lock-fontify-region):
+       Bind case-fold-search to nil.
+
+2012-04-20  Chong Yidong  <cyd@gnu.org>
+
+       * mail/sendmail.el (mail-bury): Call return action with the right
+       Rmail buffer (Bug#11242).
+
+       * server.el (server-process-filter): Handle corner case where both
+       tty and nowait options are present (Bug#11102).
+
+2012-04-20  Eli Zaretskii  <eliz@gnu.org>
+
+       * version.el (emacs-bzr-version, emacs-bzr-get-version): Doc fixes.
+       (top level): Put into the executable the ident-style '$Id:' tag on
+       windows-nt as well.
+
+2012-04-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * electric.el (electric-indent-post-self-insert-function): Check that
+       electric-indent-mode is enabled in current buffer.
+
+2012-04-19  Juanma Barranquero  <lekktu@gmail.com>
+
+       * imenu.el (imenu-progress-message): Restore; it is "used" in
+       erc/erc-imenu.el and net/snmp-mode.el.
+
+2012-04-19  Juanma Barranquero  <lekktu@gmail.com>
+
+       * avoid.el (mouse-avoidance-mode): Mark unused arg.
+       (mouse-avoidance-nudge-mouse): Remove unused binding.
+
+       * bs.el (bs-toggle-readonly): Call `toggle-read-only' interactively.
+
+       * descr-text.el (describe-char):
+       * progmodes/python.el (python-describe-symbol):
+       Don't call `toggle-read-only', set `buffer-read-only'.
+
+       * imenu.el (imenu-default-goto-function): Mark unused args.
+       (imenu-progress-message): Remove obsolete macro; all callers changed.
+
+       * subr.el (keymap-canonicalize): Remove unused binding.
+       (read-passwd): Mark unused arg.
+
+       * tutorial.el (tutorial--display-changes): Remove unused binding.
+       (tutorial--save-tutorial-to): Remove unused variable.
+
+       * emacs-lisp/package.el (define-package, package-menu-mark-delete)
+       (package-menu-mark-install, package-menu-mark-unmark): Mark unused args.
+       (package-generate-autoloads, package-menu--generate)
+       (package-menu--find-upgrades): Remove unused bindings.
+
+       * emulation/cua-rect.el (cua-restrict-regexp-rectangle)
+       (cua-restrict-prefix-rectangle): Doc fixes.  Remove unused bindings.
+       (cua--mouse-ignore, cua--delete-rectangle, cua--extract-rectangle)
+       (cua--indent-rectangle, cua-open-rectangle, cua-close-rectangle)
+       (cua-blank-rectangle, cua-string-rectangle, cua-replace-in-rectangle)
+       (cua-incr-rectangle, cua-sequence-rectangle, cua--convert-rectangle-as)
+       (cua--rectangle-aux-replace, cua--left-fill-rectangle)
+       (cua-scroll-rectangle-up, cua-scroll-rectangle-down)
+       (cua-delete-char-rectangle): Mark unused args.
+       (cua-align-rectangle): Remove unused binding.
+
+       * mail/rmail.el (compilation--message->loc)
+       (epa--find-coding-system-for-mime-charset): Declare.
+
+       * net/dbus.el (dbus-register-service): Declare.
+       (dbus-name-owner-changed-handler): Remove unused binding.
+
+       * nxml/nxml-mode.el (nxml-electric-slash, nxml-in-mixed-content-p)
+       (nxml-compute-indent-from-matching-start-tag): Remove unused variables.
+       (nxml-scan-backward-within): Mark unused arg.
+       (nxml-dynamic-markup-word): Remove unused binding.
+
+       * mouse.el (mouse-menu-major-mode-map):
+       * emacs-lisp/authors.el (authors-scan-change-log)
+       (authors-add-to-author-list):
+       * emacs-lisp/avl-tree.el (avl-tree--enter-balance):
+       * emacs-lisp/smie.el (smie-auto-fill):
+       * mail/sendmail.el (mail-bury):
+       * mail/unrmail.el (unrmail):
+       * net/tls.el (open-tls-stream):
+       * textmodes/picture.el (picture-mouse-set-point):
+       Remove unused bindings.
+
+2012-04-19  Michael Albinus  <michael.albinus@gmx.de>
+
+       * net/tramp.el (tramp-action-password): Let-bind
+       `enable-recursive-minibuffers' to t.
+
+2012-04-18  Sam Steingold  <sds@gnu.org>
+
+       * progmodes/gud.el (gud-key-prefix): Use :type 'key-sequence
+       instead of 'string to accommodate values like [f11].
+       Always use `vconcat' instead of `concat' on it, like in `gud-def'.
+       * progmodes/gdb-mi.el: Likewise.
+
+2012-04-18  Leo Liu  <sdl.web@gmail.com>
+
+       * abbrev.el (edit-abbrevs): Move point to the abbrev table of
+       current buffer.
+       (prepare-abbrev-list-buffer): Enter edit-abbrevs-mode only if
+       LOCAL is nil.
+
+2012-04-18  Chong Yidong  <cyd@gnu.org>
+
+       * simple.el (line-move): Use forward-line if in batch mode
+       (Bug#11053).
+
+2012-04-18  Christopher Schmidt  <christopher@ch.ristopher.com>
+
+       * files.el (after-find-file): Do not try to add a final newline if
+       the buffer is read-only (Bug#11156).
+
+2012-04-17  Richard Stallman  <rms@gnu.org>
+
+       * mail/rmail.el (rmail-start-mail):
+       Pass (rmail-mail-return...) for the return-action.
+       Pass (rmail-yank-current-message...) for the yank-action.
+       (rmail-yank-current-message): New function.
+       (rmail-mail): Pass the Rmail buffer, not view buffer, for replybuffer.
+       (rmail-reply): Likewise.
+       (rmail-forward): Pass the Rmail buffer, not nil, for replybuffer.
+
+       * mail/sendmail.el (mail-bury): Choose the first rmail-mode
+       buffer, not the last.  Reject temp buffers.  Use the rmail-mode
+       buffer, not newbuf.
+
+2012-04-17  Juanma Barranquero  <lekktu@gmail.com>
+
+       * server.el (server-ensure-safe-dir): Simplify.
+
+2012-04-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * emacs-lisp/smie.el: Provide smarter auto-filling.
+       (smie-auto-fill): New function.
+       (smie-setup): Use it.
+
+       * newcomment.el (comment-choose-indent): Obey comment-inline-offset.
+
+2012-04-17  Philipp Haselwarter  <philipp.haselwarter@gmx.de>  (tiny change)
+
+       * newcomment.el (comment-inline-offset): New custom var (bug#11090).
+       (comment-indent): Use it.
+
+2012-04-17  Vincent Belaïche  <vincentb1@users.sourceforge.net>
+
+       * ses.el: The overall change is to add cell renaming, that is
+       setting fancy names for cell symbols other than name matching
+       "\\`[A-Z]+[0-9]+\\'" regexp .
+       (ses-localvars): Add ses--renamed-cell-symb-list.
+       (ses-create-cell-variable): New defun.
+       (ses-destroy-cell-variable-range): Respect ses--numrows, ses--numcols.
+       (ses-relocate-formula): Relocate formulas only for cells the
+       symbols of which are not renamed, i.e. symbols whose names do not
+       match regexp "\\`[A-Z]+[0-9]+\\'".
+       (ses-relocate-all): Relocate values only for cells the symbols of
+       which are not renamed.
+       (ses-load): Create cells variables as the (ses-cell ...) are read,
+       in order to check row col consistency with cell symbol name only
+       for cells that are not renamed.
+       (ses-replace-name-in-formula): New defun.
+       (ses-rename-cell): New defun.
+
+2012-04-17  Peter Oliver  <bzr@mavit.org.uk>  (tiny change)
+
+       * progmodes/perl-mode.el (perl-indent-parens-as-block):
+       New option (bug#11118).
+       (perl-calculate-indent): Respect it.
 
-       * files.el (file-relative-name): Compare file names
-       case-insensitively if on MS-Windows or MS-DOS, or if
-       read-file-name-completion-ignore-case is non-nil.  Don't use
-       case-fold-search for this purpose.  (Bug#11827)
+2012-04-17  Glenn Morris  <rgm@gnu.org>
 
-2012-06-28  Andreas Schwab  <schwab@linux-m68k.org>
+       * dired-aux.el (dired-mark-read-string): Doc fix.
 
-       * calendar/cal-dst.el (calendar-current-time-zone):
-       Return calendar-current-time-zone-cache if non-nil.
+2012-04-17  Dmitry Antipov  <dmantipov@yandex.ru>
 
-2012-06-25  Masatake YAMATO  <yamato@redhat.com>
+       * dired-aux.el (dired-mark-read-string): Offer optional completion.
+       (dired-do-chxxx): Complete chown, chgrp over users, groups.  (Bug#7900)
 
-       * progmodes/which-func.el (which-func-format):
-       Add mouse-face.  (Bug#11698)
+2012-04-17  Glenn Morris  <rgm@gnu.org>
 
-2012-06-24  Leo Liu  <sdl.web@gmail.com>
+       * mouse.el (mouse-drag-track):
+       * speedbar.el (speedbar-frame-mode):
+       Use auto-hscroll-mode rather than the alias automatic-hscrolling.
 
-       * ibuf-ext.el (ibuffer-diff-buffer-with-file-1): Avoid buffer
-       read-only error.
+2012-04-16  Leo Liu  <sdl.web@gmail.com>
 
-       * net/rcirc.el (rcirc): Avoid error when process-contact returns t.
+       * progmodes/python.el: Trivial cleanup.
 
-       * vc/diff-mode.el (diff-file-prev/next): Fix typo.
+2012-04-16  Glenn Morris  <rgm@gnu.org>
 
-2012-06-23  Leo Liu  <sdl.web@gmail.com>
+       * vc/vc.el (vc-string-prefix-p):
+       * vc/pcvs-util.el (cvs-string-prefix-p):
+       * textmodes/tex-mode.el (latex-string-prefix-p, tex-string-prefix-p):
+       * mpc.el (mpc-string-prefix-p):
+       Make all of these into obsolete aliases for string-prefix-p.
+       Update callers.
+       * vc/pcvs.el, vc/vc-dispatcher.el, vc/vc-dir.el: Update callers.
 
-       * textmodes/enriched.el (enriched-next-annotation):
-       Use eq (Bug#11528).
+       * textmodes/two-column.el: Move custom options to the start.
+       (frame-width): Remove compat definition.
+       (2C-associate-buffer, 2C-dissociate):
+       Use with-current-buffer rather than save-excursion.
+       (2C-dissociate): Force a mode-line update.
+       (2C-autoscroll): Use ignore-errors.
 
-2012-06-23  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * emacs-lisp/eieio-opt.el (describe-class, describe-generic):
+       Autoload trivia.
 
-       * minibuffer.el (minibuffer-confirm-exit-commands):
-       Add completion-at-point (bug#11725).
+       * emacs-lisp/cl-extra.el (*random-state*):
+       Remove unnecessary declaration.
 
-2012-06-21  Glenn Morris  <rgm@gnu.org>
+       * calendar/cal-tex.el (cal-tex-end-document): Trivial clarification.
 
-       * progmodes/f90.el (f90-font-lock-keywords-2):
-       Add some preprocessor elements.  (Bug#10499)
+       * play/cookie1.el (cookie-snarf):
+       Give an explicit error if input file cannot be read.
 
-2012-06-21  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * play/yow.el (yow-file): Use expand-file-name rather than concat.
 
-       * progmodes/cperl-mode.el (cperl-update-syntaxification):
-       Use syntax-propertize (bug#11739).
+       * progmodes/perl-mode.el (c-macro-expand):
+       Remove unnecessary autoload (it is in loaddefs.el).
 
-2012-06-13  Glenn Morris  <rgm@gnu.org>
+       * textmodes/picture.el (picture-desired-column)
+       (picture-update-desired-column): Convert comments to doc-strings.
+       (picture-substitute): Remove function.
+       (picture-mode-map): Initialize in the defvar.
 
-       * international/mule-cmds.el (mule-menu-keymap)
-       (set-language-environment, set-locale-environment): Doc tweaks.
+       * woman.el: Remove eval-after-load for tar-mode.
+       * tar-mode.el (tar-mode-map): Add woman binding and menu entry.
+       (woman-tar-extract-file): Autoload it.
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+       * frame.el (automatic-hscrolling): Make this alias obsolete.
 
-       * Version 24.1 released.
+2012-04-12  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
 
-2012-06-01  Glenn Morris  <rgm@gnu.org>
+       * textmodes/ispell.el (ispell-set-spellchecker-params): Post-process
+       `ispell-dictionary-alist' to use [:alpha:] and utf-8 if possible.
+       (ispell-dictionary-base-alist): Revert to original XEmacs
+       friendly version for default.  [:alpha:] will be added in
+       `ispell-set-spellchecker-params' if needed.
 
-       * mail/rmail.el (rmail-yank-current-message):
-       Leave point at correct position.  (Bug#11660)
+2012-04-16  Chong Yidong  <cyd@gnu.org>
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+       * image.el (imagemagick--extension-regexp): New variable.
+       (imagemagick-register-types): Use it.
+       (imagemagick-types-inhibit): Add :set function.  Allow new value
+       of t to inhibit all types.
 
-       * allout-widgets.el: Fix code header
+       * emacs-lisp/regexp-opt.el (regexp-opt-charset): Avoid cl macros,
+       so we can preload it.
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+       * loadup.el (fboundp): Preload regexp-opt, needed by
+       imagemagick-register-types.
 
-       * cus-edit.el (customize-changed-options-previous-release):
-       Bump to 23.4.
+2012-04-15  Chong Yidong  <cyd@gnu.org>
 
-2012-05-31  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * frame.el (scrolling): Remove nearly unused customization group.
 
-       * emacs-lisp/bytecomp.el (byte-compile-fix-header):
-       Handle arbitrary file name lengths (Bug#11585).
+       * scroll-all.el (scroll-all-mode): Move to windows group.
 
-2012-05-28  Martin Rudalics  <rudalics@gmx.at>
+2012-04-15  Chong Yidong  <cyd@gnu.org>
 
-       * desktop.el (desktop-read): Clear previous and next buffers for
-       all windows and bury *Messages* buffer (bug#11556).
+       * bindings.el (goto-map): Bind goto-char to M-g c (Bug#11240).
 
-2012-05-18  Eli Zaretskii  <eliz@gnu.org>
+2012-04-15  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * mail/sendmail.el (mail-yank-region):
-       Recognize rmail-yank-current-message in addition to insert-buffer.
-       Fixes mail-mode's "C-c C-r" that otherwise does nothing when invoked in
-       a *mail* buffer created through rmail-start-mail with sendmail as
-       mail-user-agent.
+       Avoid the use of ((lambda ...) ...) in lexical-binding code.
+       * emacs-lisp/easy-mmode.el (define-minor-mode): Use funcall (bug#11241).
 
-2012-05-17  Stefan Monnier  <monnier@iro.umontreal.ca>
+2012-04-15  Glenn Morris  <rgm@gnu.org>
 
-       * emacs-lisp/cl-macs.el (cl-transform-lambda): Don't add spurious
-       parens around the arg list (bug#11499).  Silly backport.
+       * simple.el (process-file-side-effects): Doc fix.
 
-2012-05-16  Chong Yidong  <cyd@gnu.org>
+2012-04-15  Glenn Morris  <rgm@gnu.org>
 
-       * net/gnutls.el (gnutls-min-prime-bits): Improve docstring.
+       * international/mule-cmds.el (set-language-environment): Doc fix.
 
-2012-05-15  Chong Yidong  <cyd@gnu.org>
+2012-04-14  Juanma Barranquero  <lekktu@gmail.com>
 
-       * help.el (describe-mode): Doc fix.
+       * server.el (server-auth-key, server-generate-key): Doc fixes.
+       (server-get-auth-key): Doc fix.  Use `string-match-p'.
+       (server-start): Reflow docstring.
 
-       * net/gnutls.el (gnutls-min-prime-bits): Default to 256 (Bug#11267).
+2012-04-14  Lars Ingebrigtsen  <larsi@gnus.org>
 
-2012-05-06  Troels Nielsen  <bn.troels@gmail.com>  (tiny change)
+       * server.el (server-generate-key): `called-interactively-p'
+       requires a parameter.
 
-       * progmodes/compile.el (compilation-internal-error-properties):
-       Calculate start position correctly when end-col is set but
-       end-line is not (Bug#11382).
+2012-04-14  Michal Nazarewicz  <mina86@mina86.com>
 
-2012-05-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * server.el (server-auth-key): New variable.
+       (server-generate-key, server-get-auth-key): New function.
+       (server-start): Use the new variable and functions to allow
+       setting a permanent server key (bug#9423).
 
-       * net/rlogin.el (rlogin-mode-map): Fix last change.
+2012-04-14  Leo Liu  <sdl.web@gmail.com>
 
-2012-05-09  Jason L. Wright  <jason.wright@inl.gov>  (tiny change)
+       * vc/diff-mode.el (diff-file-prev/next): Fix typo.
 
-       * mail/smtpmail.el (smtpmail-send-command): Send the command and
-       the following \r\n using a single `process-send-string', since the
-       Lotus SMTP server refuses to accept any commands if they are sent
-       with two `process-send-string's (bug#11444).
+2012-04-14  Paul Eggert  <eggert@cs.ucla.edu>
 
-2012-05-09  Stefan Monnier  <monnier@iro.umontreal.ca>
+       Spelling fixes.
+       * hexl.el (hexl-rulerize): Rename from hexl-rulerise, since
+       Emacs uses American spelling.
 
-       * shell.el (shell-parse-pcomplete-arguments): Obey
-       pcomplete-arg-quote-list inside double-quoted args as well (bug#11348).
+2012-04-14  Juanma Barranquero  <lekktu@gmail.com>
 
-2012-05-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * emacs-lock.el (emacs-lock-locked-buffer-functions): New hook.
+       (emacs-lock--exit-locked-buffer): Return the locked buffer.  Doc fix.
+       (emacs-lock--kill-emacs-hook, emacs-lock--kill-emacs-query-functions)
+       (emacs-lock--kill-buffer-query-functions): Run new hook.  (Bug#11017)
 
-       * shell.el (shell-completion-vars): Fix last change (bug#11348).
+2012-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2012-05-07  Chong Yidong  <cyd@gnu.org>
+       * progmodes/which-func.el (which-func-modes): Change default.
 
-       * ansi-color.el (ansi-color-process-output): Check for validity of
-       comint-last-output-start before using it.  This avoids a bad
-       interaction with gdb-mi's input/output buffer.
+2012-04-14  Kim F. Storm  <storm@cua.dk>
 
-2012-05-06  Glenn Morris  <rgm@gnu.org>
+       * emulation/cua-base.el (cua-exchange-point-and-mark): Just call
+       exchange-point-and-mark if cua-enable-cua-keys is nil (Bug#11191).
 
-       * files.el (dir-locals-read-from-file):
-       Mention dir-locals in any error message.
+2012-04-14  Chong Yidong  <cyd@gnu.org>
 
-2012-05-06  Chong Yidong  <cyd@gnu.org>
+       * custom.el (custom-theme-set-variables): Doc fix.
 
-       * emacs-lisp/package.el (package-built-in-p): Handle the `emacs'
-       package (Bug#11410).
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
-2012-05-05  Chong Yidong  <cyd@gnu.org>
+       * international/mule.el (set-auto-coding-for-load): Doc fix.
 
-       * emacs-lisp/package.el (package-buffer-info): Avoid putting local
-       variables into description.
+2012-04-14  Alan Mackenzie  <acm@muc.de>
 
-2012-05-05  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * progmodes/cc-menus.el (cc-imenu-objc-generic-expression): Make
+       imenu work again for Objective C Mode.  Correct the *-index values,
+       these having been disturbed by a previous change in 2011-08.
 
-       * shell.el (shell-completion-vars): Set pcomplete-arg-quote-list like
-       shell-delimiter-argument-list (bug#11348).
-       (shell-parse-pcomplete-arguments): Obey pcomplete-arg-quote-list.
+       * progmodes/cc-engine.el (c-before-change-check-<>-operators):
+       Correct two search limits.
 
-2012-05-04  Chong Yidong  <cyd@gnu.org>
+2012-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * select.el (xselect--encode-string): Always use utf-8 for TEXT on
-       Nextstep.
+       * startup.el (command-line-1): Inhibit splash from daemon (bug#10996).
 
-2012-05-03  Kenichi Handa  <handa@m17n.org>
+2012-04-14  Andreas Schwab  <schwab@linux-m68k.org>
 
-       * mail/rmailmm.el (rmail-show-mime): Catch an error caused by text
-       decoding, and show a warning message without signalling an error
-       (Bug#11282).
+       * international/characters.el: Fix sorting.
 
-2012-04-30  Eli Zaretskii  <eliz@gnu.org>
+2012-04-14  Eli Zaretskii  <eliz@gnu.org>
 
-       * mail/rmail.el (rmail-yank-current-message): Use the encoding of
-       the yanked message in preference to the default value of
-       buffer-file-coding-system.
+       * international/characters.el: Add more missing Latin case pairs.
 
-2012-04-30  Martin Rudalics  <rudalics@gmx.at>
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
-       * window.el (display-buffer--action-function-custom-type):
-       Fix entry.
+       * files.el (dir-locals-set-class-variables): Doc fix.
 
-2012-04-27  Alan Mackenzie  <acm@muc.de>
+2012-04-14  Eli Zaretskii  <eliz@gnu.org>
 
-       * progmodes/cc-defs.el (c-version): Update to 5.32.3.
+       * international/characters.el: Add set-case-syntax-pair call for
+       LATIN CAPITAL LETTER Y WITH DIAERESIS RET and its lower-case
+       counterpart.  (Bug#11209)
 
-2012-04-27  Chong Yidong  <cyd@gnu.org>
+       * simple.el (shell-command-on-region): Doc fix.  (Bug#11208)
 
-       * subr.el (read-key): Avoid running filter function when setting
-       up temporary tool bar entries (Bug#9922).
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
-2012-04-26  Andreas Schwab  <schwab@linux-m68k.org>
+       * calendar/holidays.el (calendar-check-holidays): Doc fix.
 
-       * vc/vc-git.el (vc-git-state): Fix regexp matching diff output.
-       (Bug#11344)
+2012-04-14  Eli Zaretskii  <eliz@gnu.org>
 
-2012-04-24  Chong Yidong  <cyd@gnu.org>
+       * textmodes/ispell.el (ispell-dictionary-base-alist):
+       Add data for Hebrew.
 
-       * select.el (xselect--encode-string): New function, split from
-       xselect-convert-to-string.
-       (xselect-convert-to-string): Use it.
-       (xselect-convert-to-filename, xselect-convert-to-os)
-       (xselect-convert-to-host, xselect-convert-to-user): Ensure that
-       returned strings are properly encoded (Bug#11315).
+2012-04-14  Chong Yidong  <cyd@gnu.org>
 
-2012-04-22  Chong Yidong  <cyd@gnu.org>
+       * net/rcirc.el (rcirc-cmd-quit):
+       Revert 2012-03-18 change (Bug#11192).
 
-       * simple.el (delete-active-region): Move to killing custom group.
+2012-04-14  Glenn Morris  <rgm@gnu.org>
 
-2012-04-21  Andreas Schwab  <schwab@linux-m68k.org>
+       * pcmpl-rpm.el (pcomplete/rpm): Handle -qf.
 
-       * progmodes/which-func.el (which-func-current): Quote %
-       characters for mode-line processing.
+2012-04-14  Eli Zaretskii  <eliz@gnu.org>
 
-2012-04-21  Chong Yidong  <cyd@gnu.org>
+       * minibuffer.el (completion-in-region-mode-map):
+       Bind completion-help-at-point to M-? rather than ?.  (Bug#11182)
 
-       * xml.el (xml-parse-region, xml-parse-tag): Avoid errors due to
-       reaching eob (Bug#11286).
+2012-04-13  Vivek Dasmohapatra  <vivek@etla.org>
 
-2012-04-20  Richard Stallman  <rms@gnu.org>
+       * hexl.el (hexl-insert-char): Make display sizes other than 16 work.
 
-       Fix logic for returning to and yanking from Rmail buffer.
+2012-04-13  Masatake YAMATO  <yamato@redhat.com>
 
-       * mail/rmail.el (rmail-start-mail):
-       Pass (rmail-mail-return...) for the return-action.
-       Pass (rmail-yank-current-message...) for the yank-action.
-       (rmail-yank-current-message): New function.
-       (rmail-mail): Pass the Rmail buffer, not view buffer, for replybuffer.
-       (rmail-reply): Likewise.
-       (rmail-forward): Pass the Rmail buffer, not nil, for replybuffer.
+       * minibuffer.el (minibuffer-local-filename-syntax): New variable
+       to allow `C-M-f' and `C-M-b' to move to the nearest path
+       separator (bug#9511).
 
-       * mail/sendmail.el (mail-bury): Choose the first rmail-mode
-       buffer, not the last.  Reject temp buffers.  Use the rmail-mode
-       buffer, not newbuf.
+2012-04-13  Lars Ingebrigtsen  <larsi@gnus.org>
 
-2012-04-20  Eli Zaretskii  <eliz@gnu.org>
+       * avoid.el: Require cl when compiling.  And also move the
+       `provide' to the end.
 
-       * progmodes/gdb-mi.el (gdb-control-level): New variable.
-       (gdb): Make it buffer-local and init to zero.
-       (gdb-control-commands-regexp): New variable.
-       (gdb-send): Don't wrap in "-interpreter-exec console" if
-       gdb-control-level is positive.  Increment gdb-control-level
-       whenever the command matches gdb-control-commands-regexp, and
-       decrement it each time the command is "end".  (Bug#11279)
+2012-04-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
 
-2012-04-20  Martin Rudalics  <rudalics@gmx.at>
+       * avoid.el (mouse-avoidance-banish-position): New variable.
+       (mouse-avoidance-banish-destination): Use it (bug#10165).
 
-       * window.el (adjust-window-trailing-edge, enlarge-window)
-       (shrink-window, window-resize):
-       * mouse.el (mouse-drag-line): Fix resizing of minibuffer
-       windows (Bug#11276).
+2012-04-13  Leo Liu  <sdl.web@gmail.com>
 
-2012-04-20  Dan Nicolaescu  <dann@gnu.org>
+       * progmodes/which-func.el (which-func-modes): Add objc-mode.
 
-       * battery.el (battery-echo-area-format): Display remaining time
-       for sysfs backend too (Bug#11269).
-       (battery-linux-sysfs): Fix conditional for the charge.
+2012-04-13  Ken Brown  <kbrown@cornell.edu>
 
-2012-04-20  Chong Yidong  <cyd@gnu.org>
+       * net/browse-url.el (browse-url-file-url): Remove Cygwin hack;
+       this is no longer needed now that cygstart understands file:// URLs.
+       (browse-url-filename-alist): For the same reason, don't modify
+       file:// URLs on Cygwin.
 
-       * progmodes/gdb-mi.el (gdb): Revert 2012-04-19 change.
-       (gdb-inferior-io--init-proc): New function.
-       (gdb-init-1): Use it.
-       (gdb-inferior-io-sentinel): New sentinel for the gdb-inferior pty,
-       responsible for allocating a new pty and hooking it to gdb when
-       the old pty gets an EIO due to process exit.
-       (gdb-delchar-or-quit): New command.  Bind it in gdb-mi buffers.
-       (gdb-tooltip-print): Don't use obsolete tooltip-use-echo-area.
-       (gdb-inferior-io--maybe-delete-pty): Move into gdb-reset.
+2012-04-13  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2012-04-20  Eli Zaretskii  <eliz@gnu.org>
+       * emulation/cua-base.el (cua--pre-command-handler-1): Don't activate
+       the region on shift if the binding is already shifted (bug#11221).
 
-       * window.el (window-min-size, window-sizable, window-min-delta)
-       (window-max-delta, window--resizable, window-resizable)
-       (window-total-size, window-full-height-p, window-full-width-p)
-       (window-in-direction, window--resize-mini-window, window-resize)
-       (window--resize-child-windows-normal)
-       (window--resize-child-windows, window--resize-siblings)
-       (window--resize-this-window, adjust-window-trailing-edge)
-       (enlarge-window, shrink-window): Doc fixes.
+2012-04-12  Glenn Morris  <rgm@gnu.org>
 
-2012-04-19  Chong Yidong  <cyd@gnu.org>
+       * mail/mailpost.el: Move to obsolete/.
 
-       * progmodes/gdb-mi.el (gdb-inferior-io--maybe-delete-pty):
-       New function to call delete-process on the gdb-inferior buffer's pty.
-       (gdb-reset): Use it, instead of relying on kill-buffer to kill the
-       pty process (Bug#11273).
-       (gdb-update): New arg to suppress talking to the gdb process.
-       (gdb-done-or-error): Use it.
-       (gdb-stopped-functions): Rename from gdb-stopped-hooks.
-       (gdb): Call gdb-inferior-io--maybe-delete-pty as a workaround for
-       sentinel not being called.
+2012-04-12  Drew Adams  <drew.adams@oracle.com>
 
-       * comint.el (make-comint-in-buffer, comint-exec): Doc fix.
+       * imenu.el (imenu--generic-function): Ignore invisible definitions
+       (bug#10123).
 
-2012-04-18  Chong Yidong  <cyd@gnu.org>
+2012-04-12  Vivek Dasmohapatra  <vivek@etla.org>
 
-       * progmodes/grep.el (grep, rgrep): Doc fix (Bug#11268).
+       * hexl.el (hexl-bits): New variable.
+       (hexl-options): Mention the variable in the doc string.
+       (hexl-rulerise, hexl-line-displen): New functions.
+       (hexl-mode): Mention the new variable.
+       (hexl-mode, hexl-current-address, hexl-current-address):
+       Use the displen.
+       (hexl-ascii-start-column): New function.
+       (hexl-address-to-marker, hexl-beginning-of-line, hexl-options)
+       (hexl-insert-char, hexl-mode-ruler): Use the displen (bug#4941).
 
-2012-04-18  Glenn Morris  <rgm@gnu.org>
+2012-04-12  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
 
-       * net/network-stream.el (open-network-stream): Doc fix.
+       * textmodes/flyspell.el (flyspell-large-region): For hunspell, use
+       '("-i" ENCODING), in 2 separate command-line arguments, to specify
+       the encoding, as expected by hunspell.
 
-2012-04-17  Chong Yidong  <cyd@gnu.org>
+2012-04-12  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * emacs-lisp/tabulated-list.el (tabulated-list-print): Fix typos.
+       * battery.el (battery--linux-sysfs-regexp): New const.
+       (battery-status-function): Use it.  Remove yeeloong special case.
+       (battery-yeeloong-sysfs): Remove.
+       (battery-echo-area-format): Remove yeeloong special case.
 
-2012-04-16  Alan Mackenzie  <acm@muc.de>
+2012-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       Ensure searching for keywords is case sensitive.
+       * imenu.el (imenu-add-to-menubar): `current-local-map' can be nil.
+       Reported by Noah Friedman.
 
-       * progmodes/cc-cmds.el (c-electric-brace, c-electric-lt-gt)
-       (c-electric-paren, c-beginning-of-defun, c-end-of-defun)
-       (c-defun-name, c-mark-function, c-cpp-define-name)
-       (c-comment-indent, c-scan-conditionals, c-indent-defun)
-       (c-context-line-break): bind case-fold-search to nil.
+       * subr.el (read-passwd): Use read-string.
 
-       * progmodes/cc-mode.el (c-font-lock-fontify-region):
-       bind case-fold-search to nil.
+2012-04-11  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
-2012-04-16  Chong Yidong  <cyd@gnu.org>
+       * vcursor.el (vcursor-move): Increase the priority of the overlay
+       (bug#9663).
 
-       * mail/sendmail.el (mail-bury): Call return action with the right
-       Rmail buffer (Bug#11242).
+2012-04-11  Deniz Dogan  <deniz.a.m.dogan@gmail.com>
 
-2012-04-15  Chong Yidong  <cyd@gnu.org>
+       * net/rcirc.el (rcirc-kill-channel-buffers): New variable.
+       (rcirc-kill-buffer-hook): Use it to kill channel buffers (bug#5128).
 
-       * server.el (server-process-filter): Handle corner case where both
-       tty and nowait options are present (Bug#11102).
+2012-04-11  William Stevenson  <yhvh2000@gmail.com>
 
-2012-04-15  Glenn Morris  <rgm@gnu.org>
+       * textmodes/artist.el (artist-mode): Convert artist-mode to use
+       define-minor-mode (bug#10760).
 
-       * simple.el (process-file-side-effects): Doc fix.
+2012-04-11  Wolfgang Jenkner  <wjenkner@inode.at>  (tiny change)
 
-2012-04-14  Glenn Morris  <rgm@gnu.org>
+       * progmodes/grep.el (rgrep): Tweak the find command line so
+       that directories matching `grep-find-ignored-files' won't be
+       pruned (bug#10351).
 
-       * international/mule-cmds.el (set-language-environment): Doc fix.
+2012-04-11  Chong Yidong  <cyd@gnu.org>
 
-2012-04-14  Stefan Monnier  <monnier@iro.umontreal.ca>
+       * startup.el (command-line): Remove support for long-obsolete
+       variable font-lock-face-attributes.
 
-       Avoid the use of ((lambda ...) ...) in lexical-binding code.
-       * emacs-lisp/easy-mmode.el (define-minor-mode):Use funcall (bug#11241).
+2012-04-11  Glenn Morris  <rgm@gnu.org>
 
-2012-04-13  Kim F. Storm  <storm@cua.dk>
+       * vc/vc-bzr.el (vc-bzr-status): Avoid condition-case-unless-debug.
 
-       * emulation/cua-base.el (cua-exchange-point-and-mark): Just call
-       exchange-point-and-mark if cua-enable-cua-keys is nil (Bug#11191).
+2012-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2012-04-12  Chong Yidong  <cyd@gnu.org>
+       * window.el (window--state-get-1): Obey window-point-insertion-type.
 
-       * custom.el (custom-theme-set-variables): Doc fix.
+2012-04-11  Lennart Borgman  <lennart.borgman@gmail.com>
 
-2012-04-12  Glenn Morris  <rgm@gnu.org>
+       * emacs-lisp/lisp.el (narrow-to-defun): `beginning-of-defun' goes
+       to previous function when point is on the first character of a
+       function.  Take care of that in `narrow-to-defun' (bug#6157).
 
-       * international/mule.el (set-auto-coding-for-load): Doc fix.
+2012-04-11  Glenn Morris  <rgm@gnu.org>
+
+       * vc/vc-bzr.el (vc-bzr-status): Handle all errors,
+       not just file-errors.
+
+       * vc/vc-bzr.el (vc-bzr-sha1-program, sha1-program): Remove.
+       (vc-bzr-sha1): Use internal sha1.
 
 2012-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * imenu.el (imenu-add-to-menubar): `current-local-map' can be nil.
-       Reported by Noah Friedman.  Backport from trunk.
+       * progmodes/flymake.el (flymake-mode): Beware read-only dirs (bug#8954).
 
-2012-04-11  Alan Mackenzie  <acm@muc.de>
+2012-04-10  Sébastien Gross  <seb@chezwam.org>  (tiny change)
 
-       * progmodes/cc-menus.el (cc-imenu-objc-generic-expression):
-       Make imenu work again for Objective C Mode.  Correct the *-index
-       values, these having been disturbed by a previous change in 2011-08.
+       * progmodes/hideshow.el (hs-hide-all): Don't infloop on comments
+       that start in the middle of the line (bug#10496).
 
-       * progmodes/cc-engine.el (c-before-change-check-<>-operators):
-       Correct two search limits.
+2012-04-10  Dan Nicolaescu  <dann@gnu.org>
+
+       * battery.el (battery-linux-proc-acpi): Only one battery is
+       discharged at a time, but that seems to confuse battery.el when
+       computing `rate-type' for the battery not being discharged
+       (bug#10332).
 
 2012-04-10  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * startup.el (command-line-1): Inhibit splash from daemon (bug#10996).
+       * emacs-lisp/autoload.el (autoload-make-program): Remove, unused.
 
-2012-04-10  Andreas Schwab  <schwab@linux-m68k.org>
+       * international/quail.el: Use dolist and simplify.
+       (quail-define-package, quail-update-keyboard-layout)
+       (quail-define-rules): Use dolist.
+       (quail-insert-kbd-layout, quail-get-translation): CSE.
 
-       * international/characters.el: Fix sorting.
+       * tmm.el: Use dolist, remove left over hook.
+       (tmm-prompt, tmm-define-keys, tmm-shortcut, tmm-get-keybind):
+       Use dolist.
+       (calendar-load-hook): Don't mess with it.
 
-2012-04-10  Eli Zaretskii  <eliz@gnu.org>
+       * vc/vc-annotate.el (vc-annotate-show-diff-revision-at-line-internal):
+       Use derived-mode-p.  Run the diff asynchronously.
 
-       * international/characters.el: Add more missing Latin case pairs.
+2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * obsolete/mouse-sel.el: Add an Obsolete-since header.
+
+2012-04-10  Juanma Barranquero  <lekktu@gmail.com>
+
+       * misc.el: Display absolute path of loaded DLLs (bug#10424).
+       (list-dynamic-libraries--loaded): New function.
+       (list-dynamic-libraries--refresh): Use it.
 
-2012-04-10  Andreas Schwab  <schwab@linux-m68k.org>
+2012-04-10  Nathan Weizenbaum  <nweiz@google.com>
 
-       * international/characters.el: Recover lost case pairs.
+       * progmodes/python.el (python-fill-paragraph):
+       Make python-fill-region in a multiline string work when font-lock is
+       disabled (bug#7018).
+
+2012-04-10  Laimonas Vėbra  <laimonas.vebra@gmail.com>  (tiny change)
+
+       * language/european.el (cp775): Add oem/legacy (en)coding on
+       DOS/MS Windows for the Baltic languages.  There are still plenty
+       of texts written in this encoding/codepage (bug#6519).
 
 2012-04-10  Glenn Morris  <rgm@gnu.org>
 
-       * files.el (dir-locals-set-class-variables): Doc fix.
+       * cus-start.el (eol-mnemonic-unix, eol-mnemonic-dos, eol-mnemonic-mac):
+       Add :standard values, reducing "rogue" customs in emacs -Q a bit more.
 
-2012-04-09  Eli Zaretskii  <eliz@gnu.org>
+2012-04-10  Florian Adamsky  <florian@adamsky.it>  (tiny change)
 
-       * international/characters.el: Add set-case-syntax-pair call for
-       LATIN CAPITAL LETTER Y WITH DIAERESIS RET and its lower-case
-       counterpart.  (Bug#11209)
+       * recentf.el (recentf-dialog-mode-map): Add two keybindings for
+       next-line "n" and previous-line "p" in order to make recentf more
+       consistent with ibuffer, dired or org-mode (bug#9387).
 
-       * simple.el (shell-command-on-region): Doc fix.  (Bug#11208)
+2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * image.el (put-image): Return the overlay created instead of the
+       optional input string (bug#7834).  Note that this may break code
+       that is (for some reason or other) depending on `put-image'
+       returning the string.
+
+       * mouse-sel.el (mouse-sel-mode): Mark as obsolete (bug#6174).
+
+       * simple.el (zap-to-char): Allow zapping using input methods
+       (bug#1580).
+
+       * textmodes/fill.el (fill-region): Leave point and mark where they
+       were before filling (bug#5399).
 
 2012-04-09  Glenn Morris  <rgm@gnu.org>
 
-       * calendar/holidays.el (calendar-check-holidays): Doc fix.
+       * version.el (emacs-bzr-get-version):
+       Handle lightweight checkouts of local branches.
+
+2012-04-09  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * international/characters.el: Recover lost case pairs.  (Bug#11209)
+
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * custom.el (custom-variable-p): Return nil for non-symbol
+       arguments instead of signaling an error.
+       (user-variable-p): Obsolete alias for custom-variable-p.
+
+       * apropos.el (apropos-variable):
+       * files-x.el (read-file-local-variable):
+       * simple.el (set-variable):
+       * woman.el (woman-mini-help):
+       * emacs-lisp/byte-opt.el (side-effect-free-fns): Callers changed.
+
+2012-04-09  Glenn Morris  <rgm@gnu.org>
+
+       * startup.el (normal-top-level): Don't look for leim-list.el
+       in places where it will not be found.  (Bug#910)
+
+       * international/mule-cmds.el (set-default-coding-systems):
+       * files.el (normal-mode):
+       Remove guarded calls to ucs-set-table-for-input.  (Bug#9821)
+       This function was removed with ucs-tables.el in 2008.
 
 2012-04-08  Eli Zaretskii  <eliz@gnu.org>
 
-       * textmodes/ispell.el (ispell-dictionary-base-alist): Add data for
-       Hebrew.
+       * textmodes/ispell.el (ispell-check-version): For hunspell, set
+       ispell-encoding8-command to "-i", without a trailing space.
+       (ispell-start-process): For hunspell, use '("-i" ENCODING), in 2
+       separate command-line arguments, to specify the encoding, since
+       that's how hunspell expects it.
 
-2012-04-08  Chong Yidong  <cyd@gnu.org>
+2012-04-08  Glenn Morris  <rgm@gnu.org>
 
-       * net/rcirc.el (rcirc-cmd-quit): Revert 2012-03-18 change
-       (Bug#11192).
+       * loadup.el: Load bindings before cus-start.
+       This reduces somewhat the number of "rogue" settings in emacs -Q.
 
 2012-04-07  Glenn Morris  <rgm@gnu.org>
 
-       * pcmpl-rpm.el (pcomplete/rpm): Handle -qf.
+       * version.el (emacs-bzr-get-version): New function.
+       (emacs-bzr-version): New variable.
+       * loadup.el (emacs-bzr-version): Set it.  (Bug#8054)
+       * mail/emacsbug.el (report-emacs-bug): Include bzr version.
 
 2012-04-07  Eli Zaretskii  <eliz@gnu.org>
 
-       * minibuffer.el (completion-in-region-mode-map):
-       Bind completion-help-at-point to M-? rather than ?.  (Bug#11182)
+       * international/uni-bidi.el, international/uni-category.el:
+       * international/uni-combining.el, international/uni-decimal.el:
+       * international/uni-decomposition.el, international/uni-digit.el:
+       * international/uni-lowercase.el, international/uni-mirrored.el:
+       * international/uni-name.el, international/uni-numeric.el:
+       * international/uni-titlecase.el, international/uni-uppercase.el:
+       Update for Unicode 6.1.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * term/w32-win.el (dynamic-library-alist): Add libxml2 DLLs.
 
 2012-04-05  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 
 2012-03-30  Agustín Martín Domingo  <agustin.martin@hispalinux.es>
 
-       * ispell.el (ispell-get-extended-character-mode): Disable
-       extended-char-mode for hunspell. hunspell does not support it and
-       treats ~word as ordinary words in pipe mode.
+       * textmodes/ispell.el (ispell-get-extended-character-mode):
+       Disable extended-char-mode for hunspell.  hunspell does not support it
+       and treats ~word as ordinary words in pipe mode.
 
 2012-03-30  Glenn Morris  <rgm@gnu.org>
 
        (hfy-face-to-css-default): Same as the earlier `hfy-face-to-css'.
        (hfy-face-to-css): Re-defined to be a variable.
        (hfy-compile-stylesheet): Modify.  Allow stylesheet to be built
-       over multiple runs. This is made possible by having the caller let
+       over multiple runs.  This is made possible by having the caller let
        bind a special variable `hfy-user-sheet-assoc'.
        (htmlfontify-string): New defun.
        (hfy-compile-face-map): Make sure that the last char in the
 
 2012-03-09  Michael Albinus  <michael.albinus@gmx.de>
 
-       * net/dbus.el: (dbus-property-handler): Return empty array if
+       * net/dbus.el (dbus-property-handler): Return empty array if
        there are no properties.
 
 2012-03-09  Leo Liu  <sdl.web@gmail.com>
        * term/x-win.el (x-initialize-window-system): Reduce default for
        x-selection-timeout to 5 seconds (Bug#8869).
 
-2012-02-24  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
-
-       * files.el (file-subdir-of-p): Fix typo.
-
 2012-02-24  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
 
        * files.el (files-equal-p, file-subdir-of-p): New functions.
        files from Git, SVN, Bazaar, and Mercurial.
        (save-place-to-alist): Use it.
 
-2012-02-17  Lawrence Mitchell <wence@gmx.li>
+2012-02-17  Lawrence Mitchell  <wence@gmx.li>
             Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * newcomment.el (uncomment-region-default): Don't leave extra space
 2012-02-12  Alan Mackenzie  <acm@muc.de>
 
        Fix infinite loop with long macros.
-       * cc-engine.el (c-state-safe-place): Handle macros properly.
+       * progmodes/cc-engine.el (c-state-safe-place): Handle macros properly.
 
 2012-02-12  Chong Yidong  <cyd@gnu.org>
 
 
 2012-02-06  Lars Ingebrigtsen  <larsi@gnus.org>
 
-       * progmodes/cc-mode.el
-       (c-standard-font-lock-fontify-region-function): Set the default at
-       load time, too, so that `font-lock-fontify-buffer' can be called
-       without setting up the entire mode first.  This fixes a bug in
-       `mm-inline-text' with C MIME parts.
+       * progmodes/cc-mode.el (c-standard-font-lock-fontify-region-function):
+       Set the default at load time, too, so that `font-lock-fontify-buffer'
+       can be called without setting up the entire mode first.  This fixes
+       a bug in `mm-inline-text' with C MIME parts.
 
 2012-02-06  Chong Yidong  <cyd@gnu.org>
 
 
        * net/tramp.el (tramp-action-login): Set connection property "login-as".
 
-       * net/tramp-cache.el (tramp-dump-connection-properties): Do not dump
-       properties, when "login-as" is set.
-
        * net/tramp-sh.el (tramp-methods): Add user spec to "pscp" and "psftp".
        (tramp-default-user-alist): Don't add "pscp".
        (tramp-do-copy-or-rename-file-out-of-band): Use connection
 
 2011-11-16  Michael Albinus  <michael.albinus@gmx.de>
 
-       * net/tramp-cache.el (tramp-flush-file-property): Flush also
-       properties of linked files.  (Bug#9879)
-
        * net/tramp-sh.el (tramp-sh-handle-file-truename): Cache only the
        local file name.
 
        insecure exception for current topic.  Also note that auto-saves
        are handled differently.
 
-       (allout-auto-save-temporarily-disabled), (allout-just-did-undo):
+       (allout-auto-save-temporarily-disabledallout-just-did-undo):
        State variables for tracking auto-save inhibition situation.
 
        (allout-write-contents-hook-handler): Rename from
        (newsticker--plainview-tool-bar-map): Move tool-bar icons to
        etc/images/newsticker.
 
-       * net/newst-backend.el (newsticker--do-run-auto-mark-filter),
-       (newsticker--process-auto-mark-filter-match): Tell user about
+       * net/newst-backend.el (newsticker--do-run-auto-mark-filter)
+       (newsticker--process-auto-mark-filter-match): Tell user about
        auto-marking.
 
 2011-05-13  Didier Verna  <didier@xemacs.org>
        * vc/log-view.el:
        * vc/smerge-mode.el:
        * textmodes/bibtex-style.el:
-       * textmodes/css.el:
+       * textmodes/css-mode.el:
        * startup.el:
        * uniquify.el:
        * minibuffer.el:
index 0b4e62f9e9171ff91314b159e755fd334f313cd7..8ea7d40c004c0657c013b82fefae9a704e207414 100644 (file)
 2004-01-29  Jari Aalto  <jari.aalto@poboxes.com>
 
        * progmodes/executable.el (executable-command-find-posix-p):
-       New.  Check if find handles arguments Posix-style.
+       New.  Check if find handles arguments POSIX-style.
 
        * progmodes/grep.el (grep-compute-defaults):
        Use executable-command-find-posix-p.
index 9611eaa21b4ab7bb23bbfae7cf5acbc8d8887f82..2361528abb3bc545c8507426e6d2b0f17032351d 100644 (file)
 
        * calendar/appt.el (diary-selective-display): Add defvar.
 
-       * sort.el (sort-columns): Use Posix arg syntax for `sort'.
+       * sort.el (sort-columns): Use POSIX arg syntax for `sort'.
 
        * isearch.el (search-whitespace-regexp): Fix custom type.
 
index e3890b80ec462ad674c154fe212f22f5b38509df..65a7baf44c40da73ba2f47c6ae3419a3a9e4a26f 100644 (file)
        * bookmark.el (bookmark-show-annotation): Use `when' instead of `if'.
        This is also from Thierry Volpiatto's patch in bug #6444.  However,
        because it was extraneous to the functional change in that patch,
-       and causes a re-indendation, I am committing it separately.
+       and causes a re-indentation, I am committing it separately.
 
 2010-07-13  Thierry Volpiatto  <thierry.volpiatto@gmail.com>
 
index 85301ef78e1a8941a2b46e95c0836ace0e2d8b1c..5d79470bd2a70e492200396c60c81e8754d83ee1 100644 (file)
 
        * ediff-diff.el (ediff-setup-fine-diff-regions):
        Allow diff options to be passed to the diff program.
-       (ediff-make-diff2-buffer): Don't run Posix diff on remote files.
+       (ediff-make-diff2-buffer): Don't run POSIX diff on remote files.
        (ediff-make-diff2-buffer): Refuses to diff remote files.
        (ediff-make-diff2-buffer, ediff-setup-diff-regions): Changed functions.
        (ediff-make-diff2-buffer): New function.
index b9b6cd5a03dbcdbd14c66bd320eb37b7505d4cfd..5c01f87299430dffd9a78a23ff3e7f46581cbc5b 100644 (file)
        (antlr-downcase-literals): New command.
        (antlr-upcase-literals): Ditto.
 
-       * antlr-mode.el: Minor changes: indendation, mode-name.
+       * antlr-mode.el: Minor changes: indentation, mode-name.
        (antlr-indent-line): Indent cpp directive at column 0.
        (antlr-mode): Use mode-name prefix "Antlr." instead of "Antlr/".
 
index d2c4e615577cea941989a3cda79ce64a2c7fc2c7..0cb142a72670eff303bb5eba12ceb390878bab71 100644 (file)
@@ -1,5 +1,5 @@
 # Maintenance productions for the Lisp directory
-# Copyright (C) 2000-2012  Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -86,19 +86,23 @@ AUTOGEN_VCS = \
 # During bootstrapping the byte-compiler is run interpreted when compiling
 # itself, and uses more stack than usual.
 #
-BIG_STACK_DEPTH = 1200
+BIG_STACK_DEPTH = 2200
 BIG_STACK_OPTS = --eval "(setq max-lisp-eval-depth $(BIG_STACK_DEPTH))"
 
 BYTE_COMPILE_FLAGS = $(BIG_STACK_OPTS) $(BYTE_COMPILE_EXTRA_FLAGS)
 
 # Files to compile before others during a bootstrap.  This is done to
-# speed up the bootstrap process.
+# speed up the bootstrap process.  They're ordered by size, so we use
+# the slowest-compiler on the smallest file and move to larger files as the
+# compiler gets faster.  `autoload.elc' comes last because it is not used by
+# the compiler (so its compilation does not speed up subsequent compilations),
+# it's only placed here so as to speed up generation of the loaddefs.el file.
 
 COMPILE_FIRST = \
-       $(lisp)/emacs-lisp/bytecomp.elc \
-       $(lisp)/emacs-lisp/byte-opt.elc \
        $(lisp)/emacs-lisp/macroexp.elc \
-       $(lisp)/emacs-lisp/cconv.elc \
+       $(lisp)/emacs-lisp/cconv.elc    \
+       $(lisp)/emacs-lisp/byte-opt.elc \
+       $(lisp)/emacs-lisp/bytecomp.elc \
        $(lisp)/emacs-lisp/autoload.elc
 
 # The actual Emacs command run in the targets below.
@@ -106,7 +110,7 @@ COMPILE_FIRST = \
 emacs = EMACSLOADPATH=$(lisp) LC_ALL=C $(EMACS) $(EMACSOPT)
 
 # Common command to find subdirectories
-setwins=subdirs=`(find . -type d -print)`; \
+setwins=subdirs=`find . -type d -print`; \
        for file in $$subdirs; do \
           case $$file in */.* | */.*/* | */=* ) ;; \
                *) wins="$$wins $$file" ;; \
@@ -114,7 +118,7 @@ setwins=subdirs=`(find . -type d -print)`; \
         done
 
 # Find all subdirectories except `obsolete' and `term'.
-setwins_almost=subdirs=`(find . -type d -print)`; \
+setwins_almost=subdirs=`find . -type d -print`; \
        for file in $$subdirs; do \
           case $$file in */.* | */.*/* | */=* | */obsolete | */term ) ;; \
                *) wins="$$wins $$file" ;; \
@@ -122,15 +126,13 @@ setwins_almost=subdirs=`(find . -type d -print)`; \
         done
 
 # Find all subdirectories in which we might want to create subdirs.el
-setwins_for_subdirs=subdirs=`(find . -type d -print)`; \
+setwins_for_subdirs=subdirs=`find . -type d -print`; \
        for file in $$subdirs; do \
           case $$file in */.* | */.*/* | */=* | */cedet* ) ;; \
                *) wins="$$wins $$file" ;; \
           esac; \
         done
 
-# `compile-main' tends to be slower than `recompile' but can be parallelized
-# with "make -j" and results in more deterministic compilation warnings.
 # cus-load and finder-inf are not explicitly requested by anything, so
 # we add them here to make sure they get built.
 all: compile-main $(lisp)/cus-load.el $(lisp)/finder-inf.el
@@ -179,16 +181,19 @@ $(lisp)/subdirs.el:
 update-subdirs: doit
        cd $(lisp); $(setwins_for_subdirs); \
        for file in $$wins; do \
-          $(top_srcdir)/update-subdirs $$file; \
+          $(top_srcdir)/build-aux/update-subdirs $$file; \
        done;
 
+# Some modes of make-dist use this.
 updates: update-subdirs autoloads finder-data custom-deps
 
-# This is useful after "bzr up".
-bzr-update: recompile autoloads finder-data custom-deps
-
-# For backwards compatibility:
-cvs-update: bzr-update
+# This is useful after "bzr up"; but it doesn't do anything that a
+# plain "make" at top-level doesn't.
+# The only difference between this and this directory's "all" rule
+# is that this runs "autoloads" as well (because it uses "compile"
+# rather than "compile-main").  In a bootstrap, $(lisp) in src/Makefile
+# triggers this directory's autoloads rule.
+bzr-update: compile finder-data custom-deps
 
 # Update the AUTHORS file.
 
@@ -314,19 +319,22 @@ backup-compiled-files:
 
 compile-after-backup: backup-compiled-files compile-always
 
-# Recompile all Lisp files which are newer than their .elc files and compile
-# new ones.
-# This has the same effect as compile-main.  recompile has some advantages:
-# i) It is faster (on a single processor), since it only has to start
-# Emacs once.  It was 33% faster on a test with a random 10% of the .el
-# files needing recompilation.
-# ii) The explicit cc-mode dependency.
-# recompile's disadvantages are:
-# i) Not parallelizable.
-# ii) Compiling multiple files in the same instance of Emacs is wrong,
-# since the environment of later files is affected by definitions in
-# earlier ones.
-recompile: doit $(LOADDEFS) compile-first $(lisp)/progmodes/cc-mode.elc
+# This does the same job as the "compile" rule, but in a different way.
+# Rather than spawning a separate Emacs instance to compile each file,
+# it uses the same Emacs instance to compile everything.
+# This is faster on a single core, since it avoids the overhead of
+# starting Emacs many times (it was 33% faster on a test with a
+# random 10% of the .el files needing recompilation).
+# Unlike compile, this is not parallelizable; so if you have more than
+# one core and use make -j#, compile will be (much) faster.
+# This rule also produces less accurate compilation warnings.
+# The environment of later files is affected by definitions in
+# earlier ones, so it does not produce some warnings that it should.
+# It can also produces spurious warnings about "invalid byte code" if
+# files that use byte-compile-dynamic are updated.
+# There is no reason to use this rule unless you only have a single
+# core and CPU time is an issue.
+compile-one-process: doit $(LOADDEFS) compile-first $(lisp)/progmodes/cc-mode.elc
        $(emacs) $(BYTE_COMPILE_FLAGS) \
            --eval "(batch-byte-recompile-directory 0)" $(lisp)
 
@@ -410,19 +418,6 @@ $(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC)
           --eval "(setq make-backup-files nil)" \
           -f batch-update-autoloads $(CAL_DIR)
 
-# Prepare a bootstrap in the lisp subdirectory.
-#
-# Build loaddefs.el to make sure it's up-to-date.  If it's not, that
-# might lead to errors during the bootstrap because something fails to
-# autoload as expected.  If there is no emacs binary, then we can't
-# build autoloads yet.  In that case we have to use ldefs-boot.el.
-# Bootstrap should always work with ldefs-boot.el.  Therefore,
-# whenever a new autoload cookie gets added that is necessary during
-# bootstrapping, ldefs-boot.el should be updated by overwriting it with
-# an up-to-date copy of loaddefs.el that is uncorrupted by
-# local changes.  (Because loaddefs.el is an automatically generated
-# file, we don't want to store it in the source repository).
-
 bootstrap-clean:
        cd $(lisp); rm -f *.elc */*.elc */*/*.elc */*/*/*.elc $(AUTOGENEL)
 
index 3845c4ce4e65622917feeec00b063c42d0662831..114afd8c813a0c9c9fea9aff65007ce1e10631b6 100644 (file)
@@ -31,7 +31,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup abbrev-mode nil
   "Word abbreviations mode."
@@ -134,10 +134,13 @@ Otherwise display all abbrevs."
                (push table empty-tables)
              (insert-abbrev-table-description table t)))
          (dolist (table (nreverse empty-tables))
-           (insert-abbrev-table-description table t))))
+           (insert-abbrev-table-description table t)))
+        ;; Note: `list-abbrevs' can display only local abbrevs, in
+        ;; which case editing could lose abbrevs of other tables. Thus
+        ;; enter `edit-abbrevs-mode' only if LOCAL is nil.
+        (edit-abbrevs-mode))
       (goto-char (point-min))
       (set-buffer-modified-p nil)
-      (edit-abbrevs-mode)
       (current-buffer))))
 
 (defun edit-abbrevs-mode ()
@@ -152,7 +155,8 @@ Otherwise display all abbrevs."
 
 (defun edit-abbrevs ()
   "Alter abbrev definitions by editing a list of them.
-Selects a buffer containing a list of abbrev definitions.
+Selects a buffer containing a list of abbrev definitions with
+point located in the abbrev table of current buffer.
 You can edit them and type \\<edit-abbrevs-map>\\[edit-abbrevs-redefine] to redefine abbrevs
 according to your editing.
 Buffer contains a header line for each abbrev table,
@@ -163,7 +167,12 @@ where NAME and EXPANSION are strings with quotes,
 USECOUNT is an integer, and HOOK is any valid function
 or may be omitted (it is usually omitted)."
   (interactive)
-  (switch-to-buffer (prepare-abbrev-list-buffer)))
+  (let ((table-name (abbrev-table-name local-abbrev-table)))
+    (switch-to-buffer (prepare-abbrev-list-buffer))
+    (when (and table-name
+               (search-forward
+                (concat "(" (symbol-name table-name) ")\n\n") nil t))
+      (goto-char (match-end 0)))))
 
 (defun edit-abbrevs-redefine ()
   "Redefine abbrevs according to current buffer contents."
@@ -531,7 +540,7 @@ the current abbrev table before abbrev lookup happens."
     (dotimes (i (length table))
       (aset table i 0))
     ;; Preserve the table's properties.
-    (assert sym)
+    (cl-assert sym)
     (let ((newsym (intern "" table)))
       (set newsym nil)      ; Make sure it won't be confused for an abbrev.
       (setplist newsym (symbol-plist sym)))
@@ -574,8 +583,8 @@ An obsolete but still supported calling form is:
 \(define-abbrev TABLE NAME EXPANSION &optional HOOK COUNT SYSTEM)."
   (when (and (consp props) (or (null (car props)) (numberp (car props))))
     ;; Old-style calling convention.
-    (setq props (list* :count (car props)
-                       (if (cadr props) (list :system (cadr props))))))
+    (setq props `(:count ,(car props)
+                  ,@(if (cadr props) (list :system (cadr props))))))
   (unless (plist-get props :count)
     (setq props (plist-put props :count 0)))
   (let ((system-flag (plist-get props :system))
@@ -612,7 +621,7 @@ current (if global is nil) or standard syntax table."
       (let ((badchars ())
             (pos 0))
         (while (string-match "\\W" abbrev pos)
-          (pushnew (aref abbrev (match-beginning 0)) badchars)
+          (cl-pushnew (aref abbrev (match-beginning 0)) badchars)
           (setq pos (1+ pos)))
         (error "Some abbrev characters (%s) are not word constituents %s"
                (apply 'string (nreverse badchars))
@@ -827,8 +836,7 @@ return value is that of `abbrev-insert'.)"
   (interactive)
   (run-hooks 'pre-abbrev-expand-hook)
   (with-wrapper-hook abbrev-expand-functions ()
-    (destructuring-bind (&optional sym name wordstart wordend)
-        (abbrev--before-point)
+    (pcase-let ((`(,sym ,name ,wordstart ,wordend) (abbrev--before-point)))
       (when sym
         (let ((startpos (copy-marker (point) t))
               (endmark (copy-marker wordend t)))
index f1e328bec7452e2ffa82a999d9ab7906168ae635..962a8fb557ac6addaabae1acef0d6605ab882840 100644 (file)
@@ -153,7 +153,7 @@ See `allout-widgets-mode' for allout widgets mode features."
  )
 ;; ;;;_  = allout-widgets-allow-unruly-edits
 ;; (defcustom allout-widgets-allow-unruly-edits nil
-;;   "*Control whether manual edits are restricted to maintain outline integrity.
+;;   "Control whether manual edits are restricted to maintain outline integrity.
 
 ;; When nil, manual edits must either be within an item's body or encompass
 ;; one or more items completely - eg, killing topics as entities, rather than
@@ -203,21 +203,21 @@ See `allout-widgets-mode' for allout widgets mode features."
 ;;;_   = allout-widgets-item-image-properties-emacs
 (defcustom allout-widgets-item-image-properties-emacs
   '(:ascent center :mask (heuristic t))
-  "*Default properties item widget images in mainline Emacs."
+  "Default properties item widget images in mainline Emacs."
   :version "24.1"
   :type 'plist
   :group 'allout-widgets)
 ;;;_   = allout-widgets-item-image-properties-xemacs
 (defcustom allout-widgets-item-image-properties-xemacs
   nil
-  "*Default properties item widget images in XEmacs."
+  "Default properties item widget images in XEmacs."
   :version "24.1"
   :type 'plist
   :group 'allout-widgets)
 ;;;_  . Developer
 ;;;_   = allout-widgets-run-unit-tests-on-load
 (defcustom allout-widgets-run-unit-tests-on-load nil
-  "*When non-nil, unit tests will be run at end of loading allout-widgets.
+  "When non-nil, unit tests will be run at end of loading allout-widgets.
 
 Generally, allout widgets code developers are the only ones who'll want to
 set this.
@@ -232,7 +232,7 @@ See `allout-widgets-run-unit-tests' to see what's run."
   :group 'allout-widgets-developer)
 ;;;_   = allout-widgets-time-decoration-activity
 (defcustom allout-widgets-time-decoration-activity nil
-  "*Retain timing info of the last cooperative redecoration.
+  "Retain timing info of the last cooperative redecoration.
 
 The details are retained as the value of
 `allout-widgets-last-decoration-timing'.
@@ -244,7 +244,7 @@ set this."
   :group 'allout-widgets-developer)
 ;;;_   = allout-widgets-hook-error-post-time 0
 (defcustom allout-widgets-hook-error-post-time 0
-  "*Amount of time to sit showing hook error messages.
+  "Amount of time to sit showing hook error messages.
 
 0 is minimal, or nil to not post to the message area.
 
@@ -254,7 +254,7 @@ This is for debugging purposes."
   :group 'allout-widgets-developer)
 ;;;_   = allout-widgets-maintain-tally nil
 (defcustom allout-widgets-maintain-tally nil
-  "*If non-nil, maintain a collection of widgets, `allout-widgets-tally'.
+  "If non-nil, maintain a collection of widgets, `allout-widgets-tally'.
 
 This is for debugging purposes.
 
@@ -290,7 +290,7 @@ The number varies according to the evanescence of objects on a
     (format ":%s" (hash-table-count allout-widgets-tally))))
 ;;;_   = allout-widgets-track-decoration nil
 (defcustom allout-widgets-track-decoration nil
-  "*If non-nil, show cursor position of each item decoration.
+  "If non-nil, show cursor position of each item decoration.
 
 This is for debugging purposes, and generally set at need in a
 buffer rather than as a prevailing configuration \(but it's handy
@@ -416,7 +416,7 @@ onto the front.")
 ;;;_   , Widget-specific outline text format
 ;;;_    = allout-escaped-prefix-regexp
 (defvar allout-escaped-prefix-regexp ""
-  "*Regular expression for body text that would look like an item prefix if
+  "Regular expression for body text that would look like an item prefix if
 not altered with an escape sequence.")
 (make-variable-buffer-local 'allout-escaped-prefix-regexp)
 ;;;_   , Widget element formatting
@@ -579,13 +579,13 @@ outline hot-spot navigation \(see `allout-mode')."
         (if (current-local-map)
             (set-keymap-parent allout-item-body-keymap (current-local-map)))
 
-        (add-hook 'allout-exposure-change-hook
+        (add-hook 'allout-exposure-change-functions
                   'allout-widgets-exposure-change-recorder nil 'local)
-        (add-hook 'allout-structure-added-hook
+        (add-hook 'allout-structure-added-functions
                   'allout-widgets-additions-recorder nil 'local)
-        (add-hook 'allout-structure-deleted-hook
+        (add-hook 'allout-structure-deleted-functions
                   'allout-widgets-deletions-recorder nil 'local)
-        (add-hook 'allout-structure-shifted-hook
+        (add-hook 'allout-structure-shifted-functions
                   'allout-widgets-shifts-recorder nil 'local)
         (add-hook 'allout-after-copy-or-kill-hook
                   'allout-widgets-after-copy-or-kill-function nil 'local)
@@ -626,13 +626,13 @@ outline hot-spot navigation \(see `allout-mode')."
 
       (remove-hook 'after-change-functions
                    'allout-widgets-after-change-handler 'local)
-      (remove-hook 'allout-exposure-change-hook
+      (remove-hook 'allout-exposure-change-functions
                    'allout-widgets-exposure-change-recorder 'local)
-      (remove-hook 'allout-structure-added-hook
+      (remove-hook 'allout-structure-added-functions
                    'allout-widgets-additions-recorder 'local)
-      (remove-hook 'allout-structure-deleted-hook
+      (remove-hook 'allout-structure-deleted-functions
                    'allout-widgets-deletions-recorder 'local)
-      (remove-hook 'allout-structure-shifted-hook
+      (remove-hook 'allout-structure-shifted-functions
                    'allout-widgets-shifts-recorder 'local)
       (remove-hook 'allout-after-copy-or-kill-hook
                    'allout-widgets-after-copy-or-kill-function 'local)
@@ -992,7 +992,7 @@ Records changes in `allout-widgets-changes-record'."
 (defun allout-widgets-exposure-change-processor (changes)
   "Widgetize and adjust item widgets tracking allout outline exposure changes.
 
-Generally invoked via `allout-exposure-change-hook'."
+Generally invoked via `allout-exposure-change-functions'."
 
   (let ((changes (sort changes (function (lambda (this next)
                                            (< (cadr this) (cadr next))))))
@@ -1059,7 +1059,7 @@ Generally invoked via `allout-exposure-change-hook'."
 (defun allout-widgets-additions-recorder (from to)
   "Record allout item additions for tracking during post-command processing.
 
-Intended for use on `allout-structure-added-hook'.
+Intended for use on `allout-structure-added-functions'.
 
 FROM point at the start of the first new item and TO is point at the start
 of the last one.
@@ -1106,8 +1106,7 @@ Dispatched by `allout-widgets-post-command-business' in response to
 ;;;_   > allout-widgets-deletions-recorder (depth from)
 (defun allout-widgets-deletions-recorder (depth from)
   "Record allout item deletions for tracking during post-command processing.
-
-Intended for use on `allout-structure-deleted-hook'.
+Intended for use on `allout-structure-deleted-functions'.
 
 DEPTH is the depth of the deleted subtree, and FROM is the point from which
 the subtree was deleted.
@@ -1134,8 +1133,7 @@ Dispatched by `allout-widgets-post-command-business' in response to
 ;;;_   > allout-widgets-shifts-recorder (shifted-amount at)
 (defun allout-widgets-shifts-recorder (shifted-amount at)
   "Record outline subtree shifts for tracking during post-command processing.
-
-Intended for use on `allout-structure-shifted-hook'.
+Intended for use on `allout-structure-shifted-functions'.
 
 SHIFTED-AMOUNT is the depth change and AT is the point at the start of the
 subtree that's been shifted.
index 3eed3c7d23e3fe0149427f295555859760dfce61..7077af55e60c0475a9f4bfef1b3953596d7a6b7d 100644 (file)
@@ -945,7 +945,7 @@ case the value of `allout-default-layout' is used.")
 ;;;_  : Topic header format
 ;;;_   = allout-regexp
 (defvar allout-regexp ""
-  "*Regular expression to match the beginning of a heading line.
+  "Regular expression to match the beginning of a heading line.
 
 Any line whose beginning matches this regexp is considered a
 heading.  This var is set according to the user configuration vars
@@ -965,7 +965,7 @@ and `allout-distinctive-bullets-string'.")
 (make-variable-buffer-local 'allout-bullets-string-len)
 ;;;_   = allout-depth-specific-regexp
 (defvar allout-depth-specific-regexp ""
-  "*Regular expression to match a heading line prefix for a particular depth.
+  "Regular expression to match a heading line prefix for a particular depth.
 
 This expression is used to search for depth-specific topic
 headers at depth 2 and greater.  Use `allout-depth-one-regexp'
@@ -978,7 +978,7 @@ topic prefix to be matched.")
 (make-variable-buffer-local 'allout-depth-specific-regexp)
 ;;;_   = allout-depth-one-regexp
 (defvar allout-depth-one-regexp ""
-  "*Regular expression to match a heading line prefix for depth one.
+  "Regular expression to match a heading line prefix for depth one.
 
 This var is set according to the user configuration vars by
 `set-allout-regexp'.  It is prepared with format strings for two
@@ -1403,19 +1403,21 @@ their settings before allout-mode was started."
      ,expr))
 ;;;_   = allout-mode-hook
 (defvar allout-mode-hook nil
-  "*Hook that's run when allout mode starts.")
+  "Hook run when allout mode starts.")
 ;;;_   = allout-mode-deactivate-hook
-(defvar allout-mode-deactivate-hook nil
-  "*Hook that's run when allout mode ends.")
 (define-obsolete-variable-alias 'allout-mode-deactivate-hook
   'allout-mode-off-hook "24.1")
+(defvar allout-mode-deactivate-hook nil
+  "Hook run when allout mode ends.")
 ;;;_   = allout-exposure-category
 (defvar allout-exposure-category nil
   "Symbol for use as allout invisible-text overlay category.")
-;;;_   = allout-exposure-change-hook
-(defvar allout-exposure-change-hook nil
-  "*Hook that's run after allout outline subtree exposure changes.
 
+;;;_   = allout-exposure-change-functions
+(define-obsolete-variable-alias 'allout-exposure-change-hook
+  'allout-exposure-change-functions "24.2")
+(defcustom allout-exposure-change-functions nil
+  "Abnormal hook run after allout outline subtree exposure changes.
 It is run at the conclusion of `allout-flag-region'.
 
 Functions on the hook must take three arguments:
@@ -1424,21 +1426,31 @@ Functions on the hook must take three arguments:
  - TO -- integer indicating the point of the end of the change.
  - FLAG -- change mode: nil for exposure, otherwise concealment.
 
-This hook might be invoked multiple times by a single command.")
-;;;_   = allout-structure-added-hook
-(defvar allout-structure-added-hook nil
-  "*Hook that's run after addition of items to the outline.
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.2")
 
+;;;_   = allout-structure-added-functions
+(define-obsolete-variable-alias 'allout-structure-added-hook
+  'allout-structure-added-functions "24.2")
+(defcustom allout-structure-added-functions nil
+  "Abnormal hook run after adding items to an Allout outline.
 Functions on the hook should take two arguments:
 
  - NEW-START -- integer indicating position of start of the first new item.
  - NEW-END -- integer indicating position of end of the last new item.
 
-This hook might be invoked multiple times by a single command.")
-;;;_   = allout-structure-deleted-hook
-(defvar allout-structure-deleted-hook nil
-  "*Hook that's run after disciplined deletion of subtrees from the outline.
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.2")
 
+;;;_   = allout-structure-deleted-functions
+(define-obsolete-variable-alias 'allout-structure-deleted-hook
+  'allout-structure-deleted-functions "24.2")
+(defcustom allout-structure-deleted-functions nil
+  "Abnormal hook run after deleting subtrees from an Allout outline.
 Functions on the hook must take two arguments:
 
  - DEPTH -- integer indicating the depth of the subtree that was deleted.
@@ -1447,11 +1459,16 @@ Functions on the hook must take two arguments:
 Some edits that remove or invalidate items may be missed by this hook:
 specifically edits that native allout routines do not control.
 
-This hook might be invoked multiple times by a single command.")
-;;;_   = allout-structure-shifted-hook
-(defvar allout-structure-shifted-hook nil
-  "*Hook that's run after shifting of items in the outline.
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.2")
 
+;;;_   = allout-structure-shifted-functions
+(define-obsolete-variable-alias 'allout-structure-shifted-hook
+  'allout-structure-shifted-functions "24.2")
+(defcustom allout-structure-shifted-functions nil
+  "Abnormal hook run after shifting items in an Allout outline.
 Functions on the hook should take two arguments:
 
  - DEPTH-CHANGE -- integer indicating depth increase, negative for decrease
@@ -1460,20 +1477,27 @@ Functions on the hook should take two arguments:
 Some edits that shift items can be missed by this hook: specifically edits
 that native allout routines do not control.
 
-This hook might be invoked multiple times by a single command.")
+This hook might be invoked multiple times by a single command."
+  :type 'hook
+  :group 'allout
+  :version "24.2")
+
 ;;;_   = allout-after-copy-or-kill-hook
-(defvar allout-after-copy-or-kill-hook nil
-  "*Hook that's run after copying outline text.
+(defcustom allout-after-copy-or-kill-hook nil
+  "Normal hook run after copying outline text.."
+  :type 'hook
+  :group 'allout
+  :version "24.2")
 
-Functions on the hook should not require any arguments.")
 ;;;_   = allout-post-undo-hook
-(defvar allout-post-undo-hook nil
-  "*Hook that's run after undo activity.
-
+(defcustom allout-post-undo-hook nil
+  "Normal hook run after undo activity.
 The item that's current when the hook is run *may* be the one
-that was affected by the undo.
+that was affected by the undo.."
+  :type 'hook
+  :group 'allout
+  :version "24.2")
 
-Functions on the hook should not require any arguments.")
 ;;;_   = allout-outside-normal-auto-fill-function
 (defvar allout-outside-normal-auto-fill-function nil
   "Value of `normal-auto-fill-function' outside of allout mode.
@@ -1883,10 +1907,10 @@ without changes to the allout core.  Here are key ones:
 `allout-mode-hook'
 `allout-mode-deactivate-hook' (deprecated)
 `allout-mode-off-hook'
-`allout-exposure-change-hook'
-`allout-structure-added-hook'
-`allout-structure-deleted-hook'
-`allout-structure-shifted-hook'
+`allout-exposure-change-functions'
+`allout-structure-added-functions'
+`allout-structure-deleted-functions'
+`allout-structure-shifted-functions'
 `allout-after-copy-or-kill-hook'
 `allout-post-undo-hook'
 
@@ -3845,7 +3869,7 @@ Nuances:
                           (allout-show-children)))
       (end-of-line)
 
-      (run-hook-with-args 'allout-structure-added-hook start end)
+      (run-hook-with-args 'allout-structure-added-functions start end)
       )
     )
   )
@@ -3970,7 +3994,7 @@ Note that refill of indented paragraphs is not done."
                                                nil     ;;; number-control
                                                nil     ;;; index
                                                t)      ;;; do-successors
-                      (run-hook-with-args 'allout-exposure-change-hook
+                      (run-hook-with-args 'allout-exposure-change-functions
                                           from to t))
       (setq arg (1- arg))
       (if (<= arg 0)
@@ -4071,7 +4095,7 @@ this function."
                (not (allout-encrypted-topic-p)))
          (allout-reindent-body current-depth new-depth))
 
-      (run-hook-with-args 'allout-exposure-change-hook mb me nil)
+      (run-hook-with-args 'allout-exposure-change-functions mb me nil)
 
       ;; Recursively rectify successive siblings of orig topic if
       ;; caller elected for it:
@@ -4333,7 +4357,7 @@ the file can be adjusted to any positive depth, however."
                   (allout-show-children))))))
     (let ((where (point)))
       (allout-rebullet-topic 1 (and (> arg 1) 'sans-offspring))
-      (run-hook-with-args 'allout-structure-shifted-hook arg where))))
+      (run-hook-with-args 'allout-structure-shifted-functions arg where))))
 ;;;_    > allout-shift-out (arg)
 (defun allout-shift-out (arg)
   "Decrease depth of current heading and any topics collapsed within it.
@@ -4373,7 +4397,7 @@ subtopics into siblings of the item."
                   (goto-char child-point)
                   (allout-shift-out 1))))
           (allout-rebullet-topic (* arg -1))))
-      (run-hook-with-args 'allout-structure-shifted-hook (* arg -1) where))))
+      (run-hook-with-args 'allout-structure-shifted-functions (* arg -1) where))))
 ;;;_   : Surgery (kill-ring) functions with special provisions for outlines:
 ;;;_    > allout-kill-line (&optional arg)
 (defun allout-kill-line (&optional arg)
@@ -4408,7 +4432,7 @@ subtopics into siblings of the item."
               (if (not (save-match-data (looking-at allout-regexp)))
                   (allout-next-heading))
               (allout-renumber-to-depth depth)))
-        (run-hook-with-args 'allout-structure-deleted-hook depth (point))))))
+        (run-hook-with-args 'allout-structure-deleted-functions depth (point))))))
 ;;;_    > allout-copy-line-as-kill ()
 (defun allout-copy-line-as-kill ()
   "Like `allout-kill-topic', but save to kill ring instead of deleting."
@@ -4456,7 +4480,7 @@ Topic exposure is marked with text-properties, to be used by
 
       (save-excursion
         (allout-renumber-to-depth depth))
-      (run-hook-with-args 'allout-structure-deleted-hook depth (point)))))
+      (run-hook-with-args 'allout-structure-deleted-functions depth (point)))))
 ;;;_    > allout-copy-topic-as-kill ()
 (defun allout-copy-topic-as-kill ()
   "Like `allout-kill-topic', but save to kill ring instead of deleting."
@@ -4668,7 +4692,7 @@ however, are left exactly like normal, non-allout-specific yanks."
         (allout-deannotate-hidden (allout-mark-marker t) (point)))
       (if (not resituate)
           (exchange-point-and-mark))
-      (run-hook-with-args 'allout-structure-added-hook subj-beg subj-end))))
+      (run-hook-with-args 'allout-structure-added-functions subj-beg subj-end))))
 ;;;_    > allout-yank (&optional arg)
 (defun allout-yank (&optional arg)
   "`allout-mode' yank, with depth and numbering adjustment of yanked topics.
@@ -4765,9 +4789,9 @@ by pops to non-distinctive yanks.  Bug..."
 ;;;_   > allout-flag-region (from to flag)
 (defun allout-flag-region (from to flag)
   "Conceal text between FROM and TO if FLAG is non-nil, else reveal it.
-
-Exposure-change hook `allout-exposure-change-hook' is run with the same
-arguments as this function, after the exposure changes are made."
+After the exposure changes are made, run the abnormal hook
+`allout-exposure-change-functions' with the same arguments as
+this function."
 
   ;; We use outline invisibility spec.
   (remove-overlays from to 'category 'allout-exposure-category)
@@ -4783,7 +4807,7 @@ arguments as this function, after the exposure changes are made."
                 (overlay-put o (pop props) (pop props))
               (error nil))))))
     (setq allout-this-command-hid-text t))
-  (run-hook-with-args 'allout-exposure-change-hook from to flag))
+  (run-hook-with-args 'allout-exposure-change-functions from to flag))
 ;;;_   > allout-flag-current-subtree (flag)
 (defun allout-flag-current-subtree (flag)
   "Conceal currently-visible topic's subtree if FLAG non-nil, else reveal it."
@@ -6022,7 +6046,7 @@ See `allout-toggle-current-subtree-encryption' for more details."
           (allout-inhibit-auto-save-info-for-decryption was-buffer-saved-size)
         (allout-maybe-resume-auto-save-info-after-encryption))
 
-      (run-hook-with-args 'allout-structure-added-hook
+      (run-hook-with-args 'allout-structure-added-functions
                           bullet-pos subtree-end))))
 ;;;_  > allout-encrypt-string (text decrypt allout-buffer keymode-cue
 ;;;                                 &optional rejected)
index 6a82f17667663e3437a65b53546b9c2a173d3f83..18b2c846274ea88032492abb2ff4a8c1659e9a22 100644 (file)
@@ -90,7 +90,7 @@ as a PDF file <URL:http://www.ecma.ch/ecma1/STAND/ECMA-048.HTM>."
   :group 'processes)
 
 (defcustom ansi-color-faces-vector
-  [default bold default italic underline bold bold-italic modeline]
+  [default bold default italic underline success warning error]
   "Faces used for SGR control sequences determining a face.
 This vector holds the faces used for SGR control sequence parameters 0
 to 7.
@@ -101,9 +101,9 @@ Parameter  Description        Face used by default
   2        faint              default
   3        italic             italic
   4        underlined         underline
-  5        slowly blinking    bold
-  6        rapidly blinking   bold-italic
-  7        negative image     modeline
+  5        slowly blinking    success
+  6        rapidly blinking   warning
+  7        negative image     error
 
 Note that the symbol `default' is special: It will not be combined
 with the current face.
@@ -358,11 +358,12 @@ it will override BEGIN, the start of the region.  Set
   "Translates SGR control sequences into overlays or extents.
 Delete all other control sequences without processing them.
 
-SGR control sequences are applied by setting foreground and
-background colors to the text between BEGIN and END using
-overlays.  The colors used are given in `ansi-color-faces-vector'
-and `ansi-color-names-vector'.  See `ansi-color-apply-sequence'
-for details.
+SGR control sequences are applied by calling the function
+specified by `ansi-color-apply-face-function'.  The default
+function sets foreground and background colors to the text
+between BEGIN and END, using overlays.  The colors used are given
+in `ansi-color-faces-vector' and `ansi-color-names-vector'.  See
+`ansi-color-apply-sequence' for details.
 
 Every call to this function will set and use the buffer-local variable
 `ansi-color-context-region' to save position and current face.  This
index 423656c21fa8d639347d2102128a23432f1722cd..e1c3e06752dbde87ccca4eb1db1d0d1cf48aaa75 100644 (file)
 ;; Fixed bug, current-local-map can return nil.
 ;; Change, doesn't calculate key-bindings unless needed.
 ;; Added super-apropos capability, changed print functions.
-;;; Made fast-apropos and super-apropos share code.
-;;; Sped up fast-apropos again.
+;; Made fast-apropos and super-apropos share code.
+;; Sped up fast-apropos again.
 ;; Added apropos-do-all option.
-;;; Added fast-command-apropos.
+;; Added fast-command-apropos.
 ;; Changed doc strings to comments for helping functions.
-;;; Made doc file buffer read-only, buried it.
+;; Made doc file buffer read-only, buried it.
 ;; Only call substitute-command-keys if do-all set.
 
 ;; Optionally use configurable faces to make the output more legible.
@@ -57,7 +57,6 @@
 ;;; Code:
 
 (require 'button)
-(eval-when-compile (require 'cl))
 
 (defgroup apropos nil
   "Apropos commands for users and programmers."
@@ -85,35 +84,48 @@ include key-binding information in its output."
   :group 'apropos
   :type 'boolean)
 
+(defface apropos-symbol
+  '((t (:inherit bold)))
+  "Face for the symbol name in Apropos output."
+  :group 'apropos
+  :version "24.2")
 
-(defcustom apropos-symbol-face 'bold
-  "Face for symbol name in Apropos output, or nil for none."
+(defface apropos-keybinding
+  '((t (:inherit underline)))
+  "Face for lists of keybinding in Apropos output."
   :group 'apropos
-  :type 'face)
+  :version "24.2")
 
-(defcustom apropos-keybinding-face 'underline
-  "Face for lists of keybinding in Apropos output, or nil for none."
+(defface apropos-property
+  '((t (:inherit font-lock-builtin-face)))
+  "Face for property name in apropos output, or nil for none."
   :group 'apropos
-  :type 'face)
+  :version "24.2")
 
-(defcustom apropos-label-face '(italic)
-  "Face for label (`Command', `Variable' ...) in Apropos output.
-A value of nil means don't use any special font for them, and also
-turns off mouse highlighting."
+(defface apropos-function-button
+  '((t (:inherit (font-lock-function-name-face button))))
+  "Button face indicating a function, macro, or command in Apropos."
   :group 'apropos
-  :type 'face)
+  :version "24.2")
 
-(defcustom apropos-property-face 'bold-italic
-  "Face for property name in apropos output, or nil for none."
+(defface apropos-variable-button
+  '((t (:inherit (font-lock-variable-name-face button))))
+  "Button face indicating a variable in Apropos."
   :group 'apropos
-  :type 'face)
+  :version "24.2")
+
+(defface apropos-misc-button
+  '((t (:inherit (font-lock-constant-face button))))
+  "Button face indicating a miscellaneous object type in Apropos."
+  :group 'apropos
+  :version "24.2")
 
 (defcustom apropos-match-face 'match
   "Face for matching text in Apropos documentation/value, or nil for none.
 This applies when you look for matches in the documentation or variable value
 for the pattern; the part that matches gets displayed in this font."
   :group 'apropos
-  :type 'face)
+  :version "24.2")
 
 (defcustom apropos-sort-by-scores nil
   "Non-nil means sort matches by scores; best match is shown first.
@@ -196,7 +208,7 @@ term, and the rest of the words are alternative terms.")
 ;;; Button types used by apropos
 
 (define-button-type 'apropos-symbol
-  'face apropos-symbol-face
+  'face 'apropos-symbol
   'help-echo "mouse-2, RET: Display more help on this symbol"
   'follow-link t
   'action #'apropos-symbol-button-display-help)
@@ -210,7 +222,7 @@ term, and the rest of the words are alternative terms.")
 (define-button-type 'apropos-function
   'apropos-label "Function"
   'apropos-short-label "f"
-  'face '(font-lock-function-name-face button)
+  'face 'apropos-function-button
   'help-echo "mouse-2, RET: Display more help on this function"
   'follow-link t
   'action (lambda (button)
@@ -219,7 +231,7 @@ term, and the rest of the words are alternative terms.")
 (define-button-type 'apropos-macro
   'apropos-label "Macro"
   'apropos-short-label "m"
-  'face '(font-lock-function-name-face button)
+  'face 'apropos-function-button
   'help-echo "mouse-2, RET: Display more help on this macro"
   'follow-link t
   'action (lambda (button)
@@ -228,7 +240,7 @@ term, and the rest of the words are alternative terms.")
 (define-button-type 'apropos-command
   'apropos-label "Command"
   'apropos-short-label "c"
-  'face '(font-lock-function-name-face button)
+  'face 'apropos-function-button
   'help-echo "mouse-2, RET: Display more help on this command"
   'follow-link t
   'action (lambda (button)
@@ -242,7 +254,7 @@ term, and the rest of the words are alternative terms.")
 (define-button-type 'apropos-variable
   'apropos-label "Variable"
   'apropos-short-label "v"
-  'face '(font-lock-variable-name-face button)
+  'face 'apropos-variable-button
   'help-echo "mouse-2, RET: Display more help on this variable"
   'follow-link t
   'action (lambda (button)
@@ -260,7 +272,7 @@ term, and the rest of the words are alternative terms.")
 (define-button-type 'apropos-group
   'apropos-label "Group"
   'apropos-short-label "g"
-  'face '(font-lock-builtin-face button)
+  'face 'apropos-misc-button
   'help-echo "mouse-2, RET: Display more help on this group"
   'follow-link t
   'action (lambda (button)
@@ -270,7 +282,7 @@ term, and the rest of the words are alternative terms.")
 (define-button-type 'apropos-widget
   'apropos-label "Widget"
   'apropos-short-label "w"
-  'face '(font-lock-builtin-face button)
+  'face 'apropos-misc-button
   'help-echo "mouse-2, RET: Display more help on this widget"
   'follow-link t
   'action (lambda (button)
@@ -279,7 +291,7 @@ term, and the rest of the words are alternative terms.")
 (define-button-type 'apropos-plist
   'apropos-label "Properties"
   'apropos-short-label "p"
-  'face '(font-lock-keyword-face button)
+  'face 'apropos-misc-button
   'help-echo "mouse-2, RET: Display more help on this plist"
   'follow-link t
   'action (lambda (button)
@@ -333,10 +345,10 @@ literally, or a string which is used as a regexp to search for.
 SUBJECT is a string that is included in the prompt to identify what
 kind of objects to search."
   (let ((pattern
-        (read-string (concat "Apropos " subject " (word list or regexp): "))))
+        (read-string (concat "Search for " subject " (word list or regexp): "))))
     (if (string-equal (regexp-quote pattern) pattern)
        ;; Split into words
-       (split-string pattern "[ \t]+")
+       (split-string pattern "[ \t]+" t)
       pattern)))
 
 (defun apropos-parse-pattern (pattern)
@@ -466,7 +478,7 @@ normal variables."
                       #'(lambda (symbol)
                           (and (boundp symbol)
                                (get symbol 'variable-documentation)))
-                    'user-variable-p)))
+                    'custom-variable-p)))
 
 ;; For auld lang syne:
 ;;;###autoload
@@ -587,7 +599,7 @@ Returns list of symbols and documentation found."
     (let ((name (copy-sequence (symbol-name sym))))
       (make-text-button name nil
                         'type 'apropos-library
-                        'face apropos-symbol-face
+                        'face 'apropos-symbol
                         'apropos-symbol name)
       name)))
 
@@ -627,11 +639,11 @@ the output includes key-bindings of commands."
             (setq lh (cdr lh)))))
       (unless lh-entry (error "Unknown library `%s'" file)))
     (dolist (x (cdr lh-entry))
-      (case (car-safe x)
+      (pcase (car-safe x)
        ;; (autoload (push (cdr x) autoloads))
-       (require (push (cdr x) requires))
-       (provide (push (cdr x) provides))
-       (t (push (or (cdr-safe x) x) symbols))))
+       (`require (push (cdr x) requires))
+       (`provide (push (cdr x) provides))
+       (_ (push (or (cdr-safe x) x) symbols))))
     (let ((apropos-pattern "")) ;Dummy binding for apropos-symbols-internal.
       (apropos-symbols-internal
        symbols apropos-do-all
@@ -837,9 +849,8 @@ Returns list of symbols and documentation found."
     (while pl
       (setq p (format "%s %S" (car pl) (nth 1 pl)))
       (if (or (not compare) (string-match apropos-regexp p))
-         (if apropos-property-face
-             (put-text-property 0 (length (symbol-name (car pl)))
-                                'face apropos-property-face p))
+         (put-text-property 0 (length (symbol-name (car pl)))
+                            'face 'apropos-property p)
        (setq p nil))
       (if p
          (progn
@@ -1031,10 +1042,7 @@ If non-nil TEXT is a string that will be printed as a heading."
          (insert-text-button (symbol-name symbol)
                              'type 'apropos-symbol
                              'skip apropos-multi-type
-                             ;; Can't use default, since user may have
-                             ;; changed the variable!
-                             ;; Just say `no' to variables containing faces!
-                             'face apropos-symbol-face)
+                             'face 'apropos-symbol)
          (if (and (eq apropos-sort-by-scores 'verbose)
                   (cadr apropos-item))
              (insert " (" (number-to-string (cadr apropos-item)) ") "))
@@ -1072,18 +1080,16 @@ If non-nil TEXT is a string that will be printed as a heading."
                          (setq key (condition-case ()
                                        (key-description key)
                                      (error)))
-                         (if apropos-keybinding-face
-                             (put-text-property 0 (length key)
-                                                'face apropos-keybinding-face
-                                                key))
+                        (put-text-property 0 (length key)
+                                           'face 'apropos-keybinding
+                                           key)
                          key)
                        item ", "))
                    (insert "M-x ... RET")
-                   (when apropos-keybinding-face
-                     (put-text-property (- (point) 11) (- (point) 8)
-                                        'face apropos-keybinding-face)
-                     (put-text-property (- (point) 3) (point)
-                                        'face apropos-keybinding-face))))
+                  (put-text-property (- (point) 11) (- (point) 8)
+                                     'face 'apropos-keybinding)
+                  (put-text-property (- (point) 3) (point)
+                                     'face 'apropos-keybinding)))
             (terpri))
          (apropos-print-doc 2
                             (if (commandp symbol)
@@ -1128,9 +1134,6 @@ If non-nil TEXT is a string that will be printed as a heading."
                 (format "<%s>" (button-type-get type 'apropos-short-label))
               (button-type-get type 'apropos-label))
             'type type
-            ;; Can't use the default button face, since user may have changed the
-            ;; variable!  Just say `no' to variables containing faces!
-            'face (append button-face apropos-label-face)
             'apropos-symbol (car apropos-item))
            (insert (if apropos-compact-layout " " ": ")))
 
@@ -1177,9 +1180,8 @@ If non-nil TEXT is a string that will be printed as a heading."
     (princ "Symbol ")
     (prin1 symbol)
     (princ "'s plist is\n (")
-    (if apropos-symbol-face
-       (put-text-property (+ (point-min) 7) (- (point) 14)
-                          'face apropos-symbol-face))
+    (put-text-property (+ (point-min) 7) (- (point) 14)
+                      'face 'apropos-symbol)
     (insert (apropos-format-plist symbol "\n  "))
     (princ ")")))
 
index 8b17208983f37985745c676443dc428d018b3a60..c776a3f8b5ce11a2149d7d6a6e53ad4d417db613 100644 (file)
@@ -622,11 +622,12 @@ the mode is invalid.  If ERROR is nil then nil will be returned."
 
 (defun archive-unixdate (low high)
   "Stringify Unix (LOW HIGH) date."
-  (let ((str (current-time-string (cons high low))))
+  (let* ((time (cons high low))
+        (str (current-time-string time)))
     (format "%s-%s-%s"
            (substring str 8 10)
            (substring str 4 7)
-           (substring str 20 24))))
+           (format-time-string "%Y" time))))
 
 (defun archive-unixtime (low high)
   "Stringify Unix (LOW HIGH) time."
index de2835580c29195f680d873eb35f5a0744b313e0..fbf8c466585ea38faf515e8af0291b6c0f6f0d4d 100644 (file)
@@ -135,19 +135,19 @@ If this contains a %s, that will be replaced by the matching rule."
 
     (("\\.[1-9]\\'" . "Man page skeleton")
      "Short description: "
-     ".\\\" Copyright (C), " (substring (current-time-string) -4) "  "
+     ".\\\" Copyright (C), " (format-time-string "%Y") "  "
      (getenv "ORGANIZATION") | (progn user-full-name)
      "
 .\\\" You may distribute this file under the terms of the GNU Free
 .\\\" Documentation License.
-.TH " (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))
+.TH " (file-name-base)
      " " (file-name-extension (buffer-file-name))
      " " (format-time-string "%Y-%m-%d ")
      "\n.SH NAME\n"
-     (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))
+     (file-name-base)
      " \\- " str
      "\n.SH SYNOPSIS
-.B " (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))
+.B " (file-name-base)
      "\n"
      _
      "
@@ -166,7 +166,7 @@ If this contains a %s, that will be replaced by the matching rule."
      "Short description: "
      ";;; " (file-name-nondirectory (buffer-file-name)) " --- " str "
 
-;; Copyright (C) " (substring (current-time-string) -4) "  "
+;; Copyright (C) " (format-time-string "%Y") "  "
  (getenv "ORGANIZATION") | (progn user-full-name) "
 
 ;; Author: " (user-full-name)
@@ -207,7 +207,7 @@ If this contains a %s, that will be replaced by the matching rule."
 
 
 \(provide '"
-       (file-name-sans-extension (file-name-nondirectory (buffer-file-name)))
+       (file-name-base)
        ")
 \;;; " (file-name-nondirectory (buffer-file-name)) " ends here\n")
     (("\\.texi\\(nfo\\)?\\'" . "Texinfo file skeleton")
@@ -215,14 +215,13 @@ If this contains a %s, that will be replaced by the matching rule."
      "\\input texinfo   @c -*-texinfo-*-
 @c %**start of header
 @setfilename "
-     (file-name-sans-extension
-      (file-name-nondirectory (buffer-file-name))) ".info\n"
+     (file-name-base) ".info\n"
       "@settitle " str "
 @c %**end of header
 @copying\n"
       (setq short-description (read-string "Short description: "))
       ".\n\n"
-      "Copyright @copyright{} " (substring (current-time-string) -4) "  "
+      "Copyright @copyright{} " (format-time-string "%Y") "  "
       (getenv "ORGANIZATION") | (progn user-full-name) "
 
 @quotation
index e0bde7c6dc580722427e50973321b1397bee60e8..0f082d2ee9c33edb3f49c2c2793731fd106f8c9a 100644 (file)
@@ -94,9 +94,6 @@
 
 (require 'timer)
 
-(eval-when-compile (require 'cl))
-
-
 ;; Custom Group:
 ;;
 ;; The two modes will be placed next to Auto Save Mode under the
 
 (defgroup auto-revert nil
   "Revert individual buffers when files on disk change.
-
-Auto-Revert Mode can be activated for individual buffer.
-Global Auto-Revert Mode applies to all buffers."
+Auto-Revert mode enables auto-revert in individual buffers.
+Global Auto-Revert mode does so in all buffers."
   :group 'files
   :group 'convenience)
 
index 17d99fd65177de60a5513ad49246db3eca3b3381..2fa6ef39e70eb3c7b74025190bfc60283d75653f 100644 (file)
@@ -67,7 +67,7 @@
 
 ;;; Code:
 
-(provide 'avoid)
+(eval-when-compile (require 'cl-lib))
 
 (defgroup avoid nil
   "Make mouse pointer stay out of the way of editing."
@@ -80,7 +80,7 @@
 See function `mouse-avoidance-mode' for possible values.
 Setting this variable directly does not take effect;
 use either \\[customize] or the function `mouse-avoidance-mode'."
-  :set (lambda (symbol value)
+  :set (lambda (_symbol value)
         ;; 'none below prevents toggling when value is nil.
         (mouse-avoidance-mode (or value 'none)))
   :initialize 'custom-initialize-default
@@ -115,6 +115,23 @@ Only applies in Mouse Avoidance modes `animate' and `jump'."
   :type 'integer
   :group 'avoid)
 
+(defcustom mouse-avoidance-banish-position '((frame-or-window . frame)
+                                             (side . right)
+                                             (side-pos . 3)
+                                             (top-or-bottom . top)
+                                             (top-or-bottom-pos . 0))
+  "Position to which Mouse Avoidance mode `banish' moves the mouse.
+An alist where keywords mean:
+FRAME-OR-WINDOW: banish the mouse to corner of frame or window.
+SIDE: banish the mouse on right or left corner of frame or window.
+SIDE-POS: Distance from right or left edge of frame or window.
+TOP-OR-BOTTOM: banish the mouse to top or bottom of frame or window.
+TOP-OR-BOTTOM-POS: Distance from top or bottom edge of frame or window."
+  :group   'avoid
+  :type    '(alist :key-type symbol :value-type symbol)
+  :options '(frame-or-window side (side-pos integer)
+             top-or-bottom (top-or-bottom-pos integer)))
+
 ;; Internal variables
 (defvar mouse-avoidance-state nil)
 (defvar mouse-avoidance-pointer-shapes nil)
@@ -183,13 +200,45 @@ Acceptable distance is defined by `mouse-avoidance-threshold'."
 
 (defun mouse-avoidance-banish-destination ()
   "The position to which Mouse Avoidance mode `banish' moves the mouse.
-You can redefine this if you want the mouse banished to a different corner."
-  (let* ((pos (window-edges)))
-    (cons (- (nth 2 pos) 2)
-         (nth 1 pos))))
+
+If you want the mouse banished to a different corner set
+`mouse-avoidance-banish-position' as you need."
+  (let* ((fra-or-win         (assoc-default
+                              'frame-or-window
+                              mouse-avoidance-banish-position 'eq))
+         (list-values        (pcase fra-or-win
+                               (`frame (list 0 0 (frame-width) (frame-height)))
+                               (`window (window-edges))))
+         (alist              (cl-loop for v in list-values
+                                      for k in '(left top right bottom)
+                                      collect (cons k v)))
+         (side               (assoc-default
+                              'side
+                              mouse-avoidance-banish-position #'eq))
+         (side-dist          (assoc-default
+                              'side-pos
+                              mouse-avoidance-banish-position #'eq))
+         (top-or-bottom      (assoc-default
+                              'top-or-bottom
+                              mouse-avoidance-banish-position #'eq))
+         (top-or-bottom-dist (assoc-default
+                              'top-or-bottom-pos
+                              mouse-avoidance-banish-position #'eq))
+         (side-fn            (pcase side
+                               (`left '+)
+                               (`right '-)))
+         (top-or-bottom-fn   (pcase top-or-bottom
+                               (`top '+)
+                               (`bottom '-))))
+    (cons (funcall side-fn                        ; -/+
+                   (assoc-default side alist 'eq) ; right or left
+                   side-dist)                     ; distance from side
+         (funcall top-or-bottom-fn                        ; -/+
+                   (assoc-default top-or-bottom alist 'eq) ; top/bottom
+                   top-or-bottom-dist)))) ; distance from top/bottom
 
 (defun mouse-avoidance-banish-mouse ()
-  ;; Put the mouse pointer in the upper-right corner of the current frame.
+  "Put the mouse pointer to `mouse-avoidance-banish-position'."
   (mouse-avoidance-set-mouse-position (mouse-avoidance-banish-destination)))
 
 (defsubst mouse-avoidance-delta (cur delta dist var min max)
@@ -218,7 +267,6 @@ You can redefine this if you want the mouse banished to a different corner."
   ;; For these modes, state keeps track of the total offset that we've
   ;; accumulated, and tries to keep it close to zero.
   (let* ((cur (mouse-position))
-        (cur-frame (car cur))
         (cur-pos (cdr cur))
         (pos (window-edges))
         (wleft (pop pos))
@@ -408,4 +456,6 @@ definition of \"random distance\".)"
 (if mouse-avoidance-mode
     (mouse-avoidance-mode mouse-avoidance-mode))
 
+(provide 'avoid)
+
 ;;; avoid.el ends here
index 5eb22b83f85a73eea4dd3e1e46aa57017e7354dc..8e98291b11ce569ddc4ef55e10cfe3084c75cc81 100644 (file)
 ;;; Code:
 
 (require 'timer)
-(eval-when-compile (require 'cl))
-
+(eval-when-compile (require 'cl-lib))
 \f
 (defgroup battery nil
   "Display battery status information."
   :prefix "battery-"
   :group 'hardware)
 
+;; Either BATn or yeeloong-bat, basically.
+(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9]?$")
+
 (defcustom battery-status-function
   (cond ((and (eq system-type 'gnu/linux)
              (file-readable-p "/proc/apm"))
         'battery-linux-proc-acpi)
        ((and (eq system-type 'gnu/linux)
              (file-directory-p "/sys/class/power_supply/")
-             (directory-files "/sys/class/power_supply/" nil "BAT[0-9]$"))
+             (directory-files "/sys/class/power_supply/" nil
+                               battery--linux-sysfs-regexp))
         'battery-linux-sysfs)
-       ((and (eq system-type 'gnu/linux)
-             (file-directory-p "/sys/class/power_supply/yeeloong-bat/")
-             (directory-files "/sys/class/power_supply/yeeloong-bat/" nil "charge_"))
-        'battery-yeeloong-sysfs)
        ((and (eq system-type 'darwin)
              (condition-case nil
                  (with-temp-buffer
@@ -81,8 +80,6 @@ introduced by a `%' character in a control string."
         "Power %L, battery %B (%p%% load, remaining time %t)")
        ((eq battery-status-function 'battery-pmset)
         "%L power, battery %B (%p%% load, remaining time %t)")
-       ((eq battery-status-function 'battery-yeeloong-sysfs)
-        "%L power, battery %B (%p%% load, remaining time %t)")
        (battery-status-function
         "Power %L, battery %B (%p%% load, remaining time %t)"))
   "Control string formatting the string to display in the echo area.
@@ -344,14 +341,15 @@ The following %-sequences are provided:
               (setq charging-state (match-string 1)))
          (when (re-search-forward "present rate: +\\([0-9]+\\) \\(m[AW]\\)$"
                                   nil t)
-           (setq rate (+ (or rate 0) (string-to-number (match-string 1)))
-                 rate-type (or (and rate-type
+           (setq rate (+ (or rate 0) (string-to-number (match-string 1))))
+           (when (> rate 0)
+             (setq rate-type (or (and rate-type
                                     (if (string= rate-type (match-string 2))
                                         rate-type
                                       (error
                                        "Inconsistent rate types (%s vs. %s)"
                                        rate-type (match-string 2))))
-                               (match-string 2))))
+                                 (match-string 2)))))
          (when (re-search-forward "remaining capacity: +\\([0-9]+\\) m[AW]h$"
                                   nil t)
            (setq capacity
@@ -361,16 +359,16 @@ The following %-sequences are provided:
        (when (re-search-forward "present: +yes$" nil t)
          (when (re-search-forward "design capacity: +\\([0-9]+\\) m[AW]h$"
                                   nil t)
-           (incf design-capacity (string-to-number (match-string 1))))
+           (cl-incf design-capacity (string-to-number (match-string 1))))
          (when (re-search-forward "last full capacity: +\\([0-9]+\\) m[AW]h$"
                                   nil t)
-           (incf last-full-capacity (string-to-number (match-string 1))))
+           (cl-incf last-full-capacity (string-to-number (match-string 1))))
          (when (re-search-forward
                 "design capacity warning: +\\([0-9]+\\) m[AW]h$" nil t)
-           (incf warn (string-to-number (match-string 1))))
+           (cl-incf warn (string-to-number (match-string 1))))
          (when (re-search-forward "design capacity low: +\\([0-9]+\\) m[AW]h$"
                                   nil t)
-           (incf low (string-to-number (match-string 1)))))))
+           (cl-incf low (string-to-number (match-string 1)))))))
     (setq full-capacity (if (> last-full-capacity 0)
                            last-full-capacity design-capacity))
     (and capacity rate
@@ -447,7 +445,8 @@ The following %-sequences are provided:
     (with-temp-buffer
       (dolist (dir (ignore-errors
                    (directory-files
-                    "/sys/class/power_supply/" t "BAT[0-9]$")))
+                    "/sys/class/power_supply/" t
+                     battery--linux-sysfs-regexp)))
        (erase-buffer)
        (ignore-errors (insert-file-contents
                        (expand-file-name "uevent" dir)))
@@ -524,91 +523,6 @@ The following %-sequences are provided:
                           "AC"
                         "BAT")
                     "N/A")))))
-
-(defun battery-yeeloong-sysfs ()
-  "Get ACPI status information from Linux (the kernel).
-This function works only on the Lemote Yeeloong.
-
-The following %-sequences are provided:
-%c Current capacity (mAh)
-%r Current rate
-%B Battery status (verbose)
-%b Battery status, empty means high, `-' means low,
-   `!' means critical, and `+' means charging
-%L AC line status (verbose)
-%p Battery load percentage
-%m Remaining time (to charge or discharge) in minutes
-%h Remaining time (to charge or discharge) in hours
-%t Remaining time (to charge or discharge) in the form `h:min'"
-
-  (let (capacity
-       capacity-level
-       status
-       ac-online
-       hours
-       current-now
-       charge-full
-       charge-now)
-
-    (with-temp-buffer
-      (ignore-errors
-       (insert-file-contents "/sys/class/power_supply/yeeloong-bat/uevent")
-       (goto-char 1)
-       (search-forward "POWER_SUPPLY_CHARGE_NOW=")
-       (setq charge-now (read (current-buffer)))
-       (goto-char 1)
-       (search-forward "POWER_SUPPLY_CHARGE_FULL=")
-       (setq charge-full (read (current-buffer)))
-       (goto-char 1)
-       (search-forward "POWER_SUPPLY_CURRENT_NOW=")
-       (setq current-now (read (current-buffer)))
-       (goto-char 1)
-       (search-forward "POWER_SUPPLY_CAPACITY_LEVEL=")
-       (setq capacity-level (buffer-substring (point) (line-end-position)))
-       (goto-char 1)
-       (search-forward "POWER_SUPPLY_STATUS=")
-       (setq status (buffer-substring (point) (line-end-position))))
-       
-      (erase-buffer)
-      (ignore-errors
-       (insert-file-contents
-        "/sys/class/power_supply/yeeloong-ac/online")
-       (goto-char 1)
-       (setq ac-online (read (current-buffer)))
-       (erase-buffer)))
-
-
-    (setq capacity (round (/ (* charge-now 100.0) charge-full)))
-    (when (and current-now (not (= current-now 0)))
-      (if (< current-now 0)
-         ;; Charging
-         (setq hours (/ (- charge-now charge-full) (+ 0.0 current-now)))
-       ;; Discharging
-       (setq hours (/ charge-now (+ 0.0 current-now)))))
-
-    (list (cons ?c (if charge-now
-                      (number-to-string charge-now)
-                    "N/A"))
-         (cons ?r current-now)
-         (cons ?B (cond ((equal capacity-level "Full") "full")
-                        ((equal status "Charging") "charging")
-                        ((equal capacity-level "Low") "low")
-                        ((equal capacity-level "Critical") "critical")
-                        (t "high")))
-         (cons ?b (cond ((equal capacity-level "Full") " ")
-                        ((equal status "Charging") "+")
-                        ((equal capacity-level "Low") "-")
-                        ((equal capacity-level "Critical") "!")
-                        (t " ")))
-         (cons ?h (if hours (number-to-string hours) "N/A"))
-         (cons ?m (if hours (number-to-string (* 60 hours)) "N/A"))
-         (cons ?t (if hours
-                      (format "%d:%d"
-                              (/ (round (* 60 hours)) 60)
-                              (% (round (* 60 hours)) 60))
-                    "N/A"))
-         (cons ?p (if capacity (number-to-string capacity) "N/A"))
-         (cons ?L (if (eq ac-online 1) "AC" "BAT")))))
 \f
 ;;; `pmset' interface for Darwin (OS X).
 
index a87f321c936f21a67eaf85a64a281a2eff95a127..e0555a17b15c7a3038ebb2f414291aa8ab47ca69 100644 (file)
@@ -40,10 +40,9 @@ corresponding to the mode line clicked."
   (interactive "e")
   (save-selected-window
     (select-window (posn-window (event-start event)))
-    (toggle-read-only)
+    (toggle-read-only nil t)
     (force-mode-line-update)))
 
-
 (defun mode-line-toggle-modified (event)
   "Toggle the buffer-modified flag from the mode-line."
   (interactive "e")
@@ -52,7 +51,6 @@ corresponding to the mode line clicked."
     (set-buffer-modified-p (not (buffer-modified-p)))
     (force-mode-line-update)))
 
-
 (defun mode-line-widen (event)
   "Widen a buffer from the mode-line."
   (interactive "e")
@@ -61,7 +59,6 @@ corresponding to the mode line clicked."
     (widen)
     (force-mode-line-update)))
 
-
 (defvar mode-line-input-method-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mode-line mouse-2]
@@ -81,7 +78,6 @@ corresponding to the mode line clicked."
          (describe-current-input-method))))
     (purecopy map)))
 
-
 (defvar mode-line-coding-system-map
   (let ((map (make-sparse-keymap)))
     (define-key map [mode-line mouse-1]
@@ -92,10 +88,15 @@ corresponding to the mode line clicked."
          (when (and enable-multibyte-characters
                     buffer-file-coding-system)
            (describe-coding-system buffer-file-coding-system)))))
+    (define-key map [mode-line mouse-3]
+      (lambda (e)
+       (interactive "e")
+       (save-selected-window
+         (select-window (posn-window (event-start e)))
+         (call-interactively 'set-buffer-file-coding-system))))
     (purecopy map))
   "Local keymap for the coding-system part of the mode line.")
 
-
 (defun mode-line-change-eol (event)
   "Cycle through the various possible kinds of end-of-line styles."
   (interactive "e")
@@ -116,7 +117,7 @@ corresponding to the mode line clicked."
       (setq desc
            (propertize
             mnemonic
-            'help-echo (format "End-of-line style: %s\nmouse-1 to cycle"
+            'help-echo (format "End-of-line style: %s\nmouse-1: Cycle"
                                (if (eq eol 0) "Unix-style LF"
                                  (if (eq eol 1) "DOS-style CRLF"
                                    (if (eq eol 2) "Mac-style CR"
@@ -130,13 +131,39 @@ corresponding to the mode line clicked."
       (push (cons eol (cons mnemonic desc)) mode-line-eol-desc-cache)
       desc)))
 
-(defvar mode-line-client
-  `(""
-    (:propertize ("" (:eval (if (frame-parameter nil 'client) "@" "")))
-                help-echo ,(purecopy "emacsclient frame")))
-  "Mode-line control for identifying emacsclient frames.")
-;;;###autoload
-(put 'mode-line-client 'risky-local-variable t)
+\f
+;;; Mode line contents
+
+(defcustom mode-line-default-help-echo
+  "mouse-1: Select (drag to resize)\n\
+mouse-2: Make current window occupy the whole frame\n\
+mouse-3: Remove current window from display"
+  "Default help text for the mode line.
+If the value is a string, it specifies the tooltip or echo area
+message to display when the mouse is moved over the mode line.
+If the text at the mouse position has a `help-echo' text
+property, that overrides this variable."
+  :type '(choice (const :tag "No help" :value nil) string)
+  :version "24.2"
+  :group 'mode-line)
+
+(defvar mode-line-front-space '(:eval (if (display-graphic-p) " " "-"))
+  "Mode line construct to put at the front of the mode line.
+By default, this construct is displayed right at the beginning of
+the mode line, except that if there is a memory-full message, it
+is displayed first.")
+(put 'mode-line-front-space 'risky-local-variable t)
+
+(defun mode-line-mule-info-help-echo (window _object _point)
+  "Return help text specifying WINDOW's buffer coding system."
+  (with-current-buffer (window-buffer window)
+    (if buffer-file-coding-system
+       (format "Buffer coding system (%s): %s
+mouse-1: Describe coding system
+mouse-3: Set coding system"
+               (if enable-multibyte-characters "multi-byte" "unibyte")
+               (symbol-name buffer-file-coding-system))
+      "Buffer coding system: none specified")))
 
 (defvar mode-line-mule-info
   `(""
@@ -152,88 +179,55 @@ mouse-3: Describe current input method"))
                  mouse-face mode-line-highlight))
     ,(propertize
       "%z"
-      'help-echo
-      (lambda (window _object _point)
-       (with-current-buffer (window-buffer window)
-         ;; Don't show this tip if the coding system is nil,
-         ;; it reads like a bug, and is not useful anyway.
-         (when buffer-file-coding-system
-           (format "Buffer coding system %s\nmouse-1: describe coding system"
-                   (if enable-multibyte-characters
-                       (concat "(multi-byte): "
-                               (symbol-name buffer-file-coding-system))
-                     (concat "(unibyte): "
-                             (symbol-name buffer-file-coding-system)))))))
+      'help-echo 'mode-line-mule-info-help-echo
       'mouse-face 'mode-line-highlight
       'local-map mode-line-coding-system-map)
     (:eval (mode-line-eol-desc)))
-  "Mode-line control for displaying information of multilingual environment.
+  "Mode line construct to report the multilingual environment.
 Normally it displays current input method (if any activated) and
 mnemonics of the following coding systems:
   coding system for saving or writing the current buffer
-  coding system for keyboard input (if Emacs is running on terminal)
-  coding system for terminal output (if Emacs is running on terminal)"
-  ;; Currently not:
-  ;;  coding system for decoding output of buffer process (if any)
-  ;;  coding system for encoding text to send to buffer process (if any)."
-)
-
+  coding system for keyboard input (on a text terminal)
+  coding system for terminal output (on a text terminal)")
 ;;;###autoload
 (put 'mode-line-mule-info 'risky-local-variable t)
 (make-variable-buffer-local 'mode-line-mule-info)
 
-;; MSDOS frames have window-system, but want the Fn identification.
-(defun mode-line-frame-control ()
-  "Compute mode-line control for frame identification.
-Value is used for `mode-line-frame-identification', which see."
-  (if (or (null window-system)
-         (eq window-system 'pc))
-      "-%F  "
-    "  "))
-
-;; We need to defer the call to mode-line-frame-control to the time
-;; the mode line is actually displayed.
-(defvar mode-line-frame-identification '(:eval (mode-line-frame-control))
-  "Mode-line control to describe the current frame.")
+(defvar mode-line-client
+  `(""
+    (:propertize ("" (:eval (if (frame-parameter nil 'client) "@" "")))
+                help-echo ,(purecopy "emacsclient frame")))
+  "Mode line construct for identifying emacsclient frames.")
 ;;;###autoload
-(put 'mode-line-frame-identification 'risky-local-variable t)
+(put 'mode-line-client 'risky-local-variable t)
 
-(defvar mode-line-process nil "\
-Mode-line control for displaying info on process status.
-Normally nil in most modes, since there is no process to display.")
+(defun mode-line-read-only-help-echo (window _object _point)
+  "Return help text specifying WINDOW's buffer read-only status."
+  (format "Buffer is %s\nmouse-1: Toggle"
+         (if (buffer-local-value 'buffer-read-only (window-buffer window))
+             "read-only"
+           "writable")))
 
-;;;###autoload
-(put 'mode-line-process 'risky-local-variable t)
-(make-variable-buffer-local 'mode-line-process)
+(defun mode-line-modified-help-echo (window _object _point)
+  "Return help text specifying WINDOW's buffer modification status."
+  (format "Buffer is %smodified\nmouse-1: Toggle modification state"
+         (if (buffer-modified-p (window-buffer window)) "" "not ")))
 
 (defvar mode-line-modified
   (list (propertize
         "%1*"
-        'help-echo (purecopy (lambda (window _object _point)
-                               (format "Buffer is %s\nmouse-1 toggles"
-                                       (save-selected-window
-                                         (select-window window)
-                                         (if buffer-read-only
-                                             "read-only"
-                                           "writable")))))
+        'help-echo 'mode-line-read-only-help-echo
         'local-map (purecopy (make-mode-line-mouse-map
                               'mouse-1
                               #'mode-line-toggle-read-only))
         'mouse-face 'mode-line-highlight)
        (propertize
         "%1+"
-        'help-echo  (purecopy (lambda (window _object _point)
-                                (format "Buffer is %sodified\nmouse-1 toggles modified state"
-                                        (save-selected-window
-                                          (select-window window)
-                                          (if (buffer-modified-p)
-                                            "m"
-                                          "not m")))))
+        'help-echo 'mode-line-modified-help-echo
         'local-map (purecopy (make-mode-line-mouse-map
                               'mouse-1 #'mode-line-toggle-modified))
         'mouse-face 'mode-line-highlight))
-  "Mode-line control for displaying whether current buffer is modified.")
-
+  "Mode line construct for displaying whether current buffer is modified.")
 ;;;###autoload
 (put 'mode-line-modified 'risky-local-variable t)
 (make-variable-buffer-local 'mode-line-modified)
@@ -251,33 +245,62 @@ Normally nil in most modes, since there is no process to display.")
                                               "Current directory is remote: "
                                             "Current directory is local: ")
                                           default-directory)))))))
-  "Mode-line flag to show if default-directory for current buffer is remote.")
+  "Mode line construct to indicate a remote buffer.")
 ;;;###autoload
 (put 'mode-line-remote 'risky-local-variable t)
-
 (make-variable-buffer-local 'mode-line-remote)
 
-;; Actual initialization is below.
-(defvar mode-line-position nil
-  "Mode-line control for displaying the position in the buffer.
-Normally displays the buffer percentage and, optionally, the
-buffer size, the line number and the column number.")
+;; MSDOS frames have window-system, but want the Fn identification.
+(defun mode-line-frame-control ()
+  "Compute mode line construct for frame identification.
+Value is used for `mode-line-frame-identification', which see."
+  (if (or (null window-system)
+         (eq window-system 'pc))
+      "-%F  "
+    "  "))
+
+;; We need to defer the call to mode-line-frame-control to the time
+;; the mode line is actually displayed.
+(defvar mode-line-frame-identification '(:eval (mode-line-frame-control))
+  "Mode line construct to describe the current frame.")
 ;;;###autoload
-(put 'mode-line-position 'risky-local-variable t)
+(put 'mode-line-frame-identification 'risky-local-variable t)
 
-(defvar mode-line-modes nil
-  "Mode-line control for displaying major and minor modes.")
+(defvar mode-line-process nil
+  "Mode line construct for displaying info on process status.
+Normally nil in most modes, since there is no process to display.")
 ;;;###autoload
-(put 'mode-line-modes 'risky-local-variable t)
+(put 'mode-line-process 'risky-local-variable t)
+(make-variable-buffer-local 'mode-line-process)
+
+(defun bindings--define-key (map key item)
+  "Make as much as possible of the menus pure."
+  (declare (indent 2))
+  (define-key map key
+    (cond
+     ((not (consp item)) item)     ;Not sure that could be other than a symbol.
+     ;; Keymaps can't be made pure otherwise users can't remove/add elements
+     ;; from/to them any more.
+     ((keymapp item) item)
+     ((stringp (car item))
+      (if (keymapp (cdr item))
+          (cons (purecopy (car item)) (cdr item))
+        (purecopy item)))
+     ((eq 'menu-item (car item))
+      (if (keymapp (nth 2 item))
+          `(menu-item ,(purecopy (nth 1 item)) ,(nth 2 item)
+                      ,@(purecopy (nthcdr 3 item)))
+        (purecopy item)))
+     (t (message "non-menu-item: %S" item) item))))
 
 (defvar mode-line-mode-menu (make-sparse-keymap "Minor Modes") "\
 Menu of mode operations in the mode line.")
 
 (defvar mode-line-major-mode-keymap
   (let ((map (make-sparse-keymap)))
-    (define-key map [mode-line down-mouse-1]
-      `(menu-item ,(purecopy "Menu Bar") ignore
-        :filter (lambda (_) (mouse-menu-major-mode-map))))
+    (bindings--define-key map [mode-line down-mouse-1]
+      `(menu-item "Menu Bar" ignore
+        :filter ,(lambda (_) (mouse-menu-major-mode-map))))
     (define-key map [mode-line mouse-2] 'describe-mode)
     (define-key map [mode-line down-mouse-3] mode-line-mode-menu)
     map) "\
@@ -292,129 +315,91 @@ Keymap to display on major mode.")
     map) "\
 Keymap to display on minor modes.")
 
+(defvar mode-line-modes
+  (let ((recursive-edit-help-echo "Recursive edit, type C-M-c to get out"))
+    (list (propertize "%[" 'help-echo recursive-edit-help-echo)
+         "("
+         `(:propertize ("" mode-name)
+                       help-echo "Major mode\n\
+mouse-1: Display major mode menu\n\
+mouse-2: Show help for major mode\n\
+mouse-3: Toggle minor modes"
+                       mouse-face mode-line-highlight
+                       local-map ,mode-line-major-mode-keymap)
+         '("" mode-line-process)
+         `(:propertize ("" minor-mode-alist)
+                       mouse-face mode-line-highlight
+                       help-echo "Minor mode\n\
+mouse-1: Display minor mode menu\n\
+mouse-2: Show help for minor mode\n\
+mouse-3: Toggle minor modes"
+                       local-map ,mode-line-minor-mode-keymap)
+         (propertize "%n" 'help-echo "mouse-2: Remove narrowing from buffer"
+                     'mouse-face 'mode-line-highlight
+                     'local-map (make-mode-line-mouse-map
+                                 'mouse-2 #'mode-line-widen))
+         ")"
+         (propertize "%]" 'help-echo recursive-edit-help-echo)
+         " "))
+  "Mode line construct for displaying major and minor modes.")
+(put 'mode-line-modes 'risky-local-variable t)
+
 (defvar mode-line-column-line-number-mode-map
   (let ((map (make-sparse-keymap))
        (menu-map (make-sparse-keymap "Toggle Line and Column Number Display")))
-    (define-key menu-map [line-number-mode]
-      `(menu-item ,(purecopy "Display Line Numbers") line-number-mode
-                 :help ,(purecopy "Toggle displaying line numbers in the mode-line")
+    (bindings--define-key menu-map [line-number-mode]
+      '(menu-item "Display Line Numbers" line-number-mode
+                 :help "Toggle displaying line numbers in the mode-line"
                  :button (:toggle . line-number-mode)))
-    (define-key menu-map [column-number-mode]
-      `(menu-item ,(purecopy "Display Column Numbers") column-number-mode
-                 :help ,(purecopy "Toggle displaying column numbers in the mode-line")
+    (bindings--define-key menu-map [column-number-mode]
+      '(menu-item "Display Column Numbers" column-number-mode
+                 :help "Toggle displaying column numbers in the mode-line"
                  :button (:toggle . column-number-mode)))
     (define-key map [mode-line down-mouse-1] menu-map)
     map) "\
 Keymap to display on column and line numbers.")
 
-(let* ((help-echo
-       ;; The multi-line message doesn't work terribly well on the
-       ;; bottom mode line...  Better ideas?
-       ;;        "\
-       ;; mouse-1: select window, mouse-2: delete others, mouse-3: delete,
-       ;; drag-mouse-1: resize, C-mouse-2: split horizontally"
-       "mouse-1: Select (drag to resize)\n\
-mouse-2: Make current window occupy the whole frame\n\
-mouse-3: Remove current window from display")
-       (recursive-edit-help-echo "Recursive edit, type C-M-c to get out")
-       (spaces (propertize " " 'help-echo help-echo))
-       (standard-mode-line-format
-       (list
-        "%e"
-        `(:eval (if (display-graphic-p)
-                    ,(propertize " " 'help-echo help-echo)
-                  ,(propertize "-" 'help-echo help-echo)))
-        'mode-line-mule-info
-        'mode-line-client
-        'mode-line-modified
-        'mode-line-remote
-        'mode-line-frame-identification
-        'mode-line-buffer-identification
-        (propertize "   " 'help-echo help-echo)
-        'mode-line-position
-        '(vc-mode vc-mode)
-        (propertize "  " 'help-echo help-echo)
-        'mode-line-modes
-        `(which-func-mode ("" which-func-format ,spaces))
-        `(global-mode-string ("" global-mode-string ,spaces))
-        `(:eval (unless (display-graphic-p)
-                  ,(propertize "-%-" 'help-echo help-echo)))))
-       (standard-mode-line-modes
-       (list
-        (propertize "%[" 'help-echo recursive-edit-help-echo)
-        (propertize "(" 'help-echo help-echo)
-        `(:propertize ("" mode-name)
-                      help-echo "Major mode\n\
-mouse-1: Display major mode menu\n\
-mouse-2: Show help for major mode\n\
-mouse-3: Toggle minor modes"
-                      mouse-face mode-line-highlight
-                      local-map ,mode-line-major-mode-keymap)
-        '("" mode-line-process)
-        `(:propertize ("" minor-mode-alist)
-                      mouse-face mode-line-highlight
-                      help-echo "Minor mode\n\
-mouse-1: Display minor mode menu\n\
-mouse-2: Show help for minor mode\n\
-mouse-3: Toggle minor modes"
-                      local-map ,mode-line-minor-mode-keymap)
-        (propertize "%n" 'help-echo "mouse-2: Remove narrowing from the current buffer"
-                    'mouse-face 'mode-line-highlight
-                    'local-map (make-mode-line-mouse-map
-                                'mouse-2 #'mode-line-widen))
-        (propertize ")" 'help-echo help-echo)
-        (propertize "%]" 'help-echo recursive-edit-help-echo)
-        spaces))
-
-       (standard-mode-line-position
-       `((-3 ,(propertize
-               "%p"
-               'local-map mode-line-column-line-number-mode-map
-               'mouse-face 'mode-line-highlight
-               ;; XXX needs better description
-               'help-echo "Size indication mode\n\
+(defvar mode-line-position
+  `((-3 ,(propertize
+         "%p"
+         'local-map mode-line-column-line-number-mode-map
+         'mouse-face 'mode-line-highlight
+         ;; XXX needs better description
+         'help-echo "Size indication mode\n\
 mouse-1: Display Line and Column Mode Menu"))
-         (size-indication-mode
-          (8 ,(propertize
-               " of %I"
-               'local-map mode-line-column-line-number-mode-map
-               'mouse-face 'mode-line-highlight
-               ;; XXX needs better description
-               'help-echo "Size indication mode\n\
+    (size-indication-mode
+     (8 ,(propertize
+         " of %I"
+         'local-map mode-line-column-line-number-mode-map
+         'mouse-face 'mode-line-highlight
+         ;; XXX needs better description
+         'help-echo "Size indication mode\n\
 mouse-1: Display Line and Column Mode Menu")))
-         (line-number-mode
-          ((column-number-mode
-            (10 ,(propertize
-                  " (%l,%c)"
-                  'local-map mode-line-column-line-number-mode-map
-                  'mouse-face 'mode-line-highlight
-                  'help-echo "Line number and Column number\n\
+    (line-number-mode
+     ((column-number-mode
+       (10 ,(propertize
+            " (%l,%c)"
+            'local-map mode-line-column-line-number-mode-map
+            'mouse-face 'mode-line-highlight
+            'help-echo "Line number and Column number\n\
 mouse-1: Display Line and Column Mode Menu"))
-            (6 ,(propertize
-                 " L%l"
-                 'local-map mode-line-column-line-number-mode-map
-                 'mouse-face 'mode-line-highlight
-                 'help-echo "Line Number\n\
+       (6 ,(propertize
+           " L%l"
+           'local-map mode-line-column-line-number-mode-map
+           'mouse-face 'mode-line-highlight
+           'help-echo "Line Number\n\
 mouse-1: Display Line and Column Mode Menu"))))
-          ((column-number-mode
-            (5 ,(propertize
-                 " C%c"
-                 'local-map mode-line-column-line-number-mode-map
-                 'mouse-face 'mode-line-highlight
-                 'help-echo "Column number\n\
-mouse-1: Display Line and Column Mode Menu"))))))))
-
-  (setq-default mode-line-format standard-mode-line-format)
-  (put 'mode-line-format 'standard-value
-       (list `(quote ,standard-mode-line-format)))
-
-  (setq-default mode-line-modes standard-mode-line-modes)
-  (put 'mode-line-modes 'standard-value
-       (list `(quote ,standard-mode-line-modes)))
-
-  (setq-default mode-line-position standard-mode-line-position)
-  (put 'mode-line-position 'standard-value
-       (list `(quote ,standard-mode-line-position))))
+     ((column-number-mode
+       (5 ,(propertize
+           " C%c"
+           'local-map mode-line-column-line-number-mode-map
+           'mouse-face 'mode-line-highlight
+           'help-echo "Column number\n\
+mouse-1: Display Line and Column Mode Menu"))))))
+  "Mode line construct for displaying the position in the buffer.
+Normally displays the buffer percentage and, optionally, the
+buffer size, the line number and the column number.")
+(put 'mode-line-position 'risky-local-variable t)
 
 (defvar mode-line-buffer-identification-keymap
   ;; Add menu of buffer operations to the buffer identification part
@@ -438,22 +423,55 @@ text properties for face, help-echo, and local-map to it."
   (list (propertize fmt
                    'face 'mode-line-buffer-id
                    'help-echo
-                   (purecopy "Buffer name\n\
-mouse-1: previous buffer\n\
-mouse-3: next buffer")
+                   (purecopy "Buffer name
+mouse-1: Previous buffer\nmouse-3: Next buffer")
                    'mouse-face 'mode-line-highlight
                    'local-map mode-line-buffer-identification-keymap)))
 
-(defvar mode-line-buffer-identification (propertized-buffer-identification "%12b") "\
-Mode-line control for identifying the buffer being displayed.
+(defvar mode-line-buffer-identification
+  (propertized-buffer-identification "%12b")
+  "Mode line construct for identifying the buffer being displayed.
 Its default value is (\"%12b\") with some text properties added.
 Major modes that edit things other than ordinary files may change this
 \(e.g. Info, Dired,...)")
-
 ;;;###autoload
 (put 'mode-line-buffer-identification 'risky-local-variable t)
 (make-variable-buffer-local 'mode-line-buffer-identification)
 
+(defvar mode-line-misc-info
+  '((which-func-mode ("" which-func-format " "))
+    (global-mode-string ("" global-mode-string " ")))
+  "Mode line construct for miscellaneous information.
+By default, this shows the information specified by
+`which-func-mode' and `global-mode-string'.")
+(put 'mode-line-misc-info 'risky-local-variable t)
+
+(defvar mode-line-end-spaces '(:eval (unless (display-graphic-p) "-%-"))
+  "Mode line construct to put at the end of the mode line.")
+(put 'mode-line-end-spaces 'risky-local-variable t)
+
+;; Default value of the top-level `mode-line-format' variable:
+(let ((standard-mode-line-format
+       (list "%e"
+            'mode-line-front-space
+            'mode-line-mule-info
+            'mode-line-client
+            'mode-line-modified
+            'mode-line-remote
+            'mode-line-frame-identification
+            'mode-line-buffer-identification
+            "   "
+            'mode-line-position
+            '(vc-mode vc-mode)
+            "  "
+            'mode-line-modes
+            'mode-line-misc-info
+            'mode-line-end-spaces)))
+  (setq-default mode-line-format standard-mode-line-format)
+  (put 'mode-line-format 'standard-value
+       (list `(quote ,standard-mode-line-format))))
+
+\f
 (defun mode-line-unbury-buffer (event) "\
 Call `unbury-buffer' in this window."
   (interactive "e")
@@ -493,51 +511,51 @@ Switch to the most recently selected buffer other than the current one."
 
 ;; Use mode-line-mode-menu for local minor-modes only.
 ;; Global ones can go on the menubar (Options --> Show/Hide).
-(define-key mode-line-mode-menu [overwrite-mode]
-  `(menu-item ,(purecopy "Overwrite (Ovwrt)") overwrite-mode
-             :help ,(purecopy "Overwrite mode: typed characters replace existing text")
+(bindings--define-key mode-line-mode-menu [overwrite-mode]
+  '(menu-item "Overwrite (Ovwrt)" overwrite-mode
+             :help "Overwrite mode: typed characters replace existing text"
              :button (:toggle . overwrite-mode)))
-(define-key mode-line-mode-menu [outline-minor-mode]
-  `(menu-item ,(purecopy "Outline (Outl)") outline-minor-mode
+(bindings--define-key mode-line-mode-menu [outline-minor-mode]
+  '(menu-item "Outline (Outl)" outline-minor-mode
              ;; XXX: This needs a good, brief description.
-             :help ,(purecopy "")
+             :help ""
              :button (:toggle . (bound-and-true-p outline-minor-mode))))
-(define-key mode-line-mode-menu [highlight-changes-mode]
-  `(menu-item ,(purecopy "Highlight changes (Chg)") highlight-changes-mode
-             :help ,(purecopy "Show changes in the buffer in a distinctive color")
+(bindings--define-key mode-line-mode-menu [highlight-changes-mode]
+  '(menu-item "Highlight changes (Chg)" highlight-changes-mode
+             :help "Show changes in the buffer in a distinctive color"
              :button (:toggle . (bound-and-true-p highlight-changes-mode))))
-(define-key mode-line-mode-menu [hide-ifdef-mode]
-  `(menu-item ,(purecopy "Hide ifdef (Ifdef)") hide-ifdef-mode
-             :help ,(purecopy "Show/Hide code within #ifdef constructs")
+(bindings--define-key mode-line-mode-menu [hide-ifdef-mode]
+  '(menu-item "Hide ifdef (Ifdef)" hide-ifdef-mode
+             :help "Show/Hide code within #ifdef constructs"
              :button (:toggle . (bound-and-true-p hide-ifdef-mode))))
-(define-key mode-line-mode-menu [glasses-mode]
-  `(menu-item ,(purecopy "Glasses (o^o)") glasses-mode
-             :help ,(purecopy "Insert virtual separators to make long identifiers easy to read")
+(bindings--define-key mode-line-mode-menu [glasses-mode]
+  '(menu-item "Glasses (o^o)" glasses-mode
+             :help "Insert virtual separators to make long identifiers easy to read"
              :button (:toggle . (bound-and-true-p glasses-mode))))
-(define-key mode-line-mode-menu [font-lock-mode]
-  `(menu-item ,(purecopy "Font Lock") font-lock-mode
-             :help ,(purecopy "Syntax coloring")
+(bindings--define-key mode-line-mode-menu [font-lock-mode]
+  '(menu-item "Font Lock" font-lock-mode
+             :help "Syntax coloring"
              :button (:toggle . font-lock-mode)))
-(define-key mode-line-mode-menu [flyspell-mode]
-  `(menu-item ,(purecopy "Flyspell (Fly)") flyspell-mode
-             :help ,(purecopy "Spell checking on the fly")
+(bindings--define-key mode-line-mode-menu [flyspell-mode]
+  '(menu-item "Flyspell (Fly)" flyspell-mode
+             :help "Spell checking on the fly"
              :button (:toggle . (bound-and-true-p flyspell-mode))))
-(define-key mode-line-mode-menu [auto-revert-tail-mode]
-  `(menu-item ,(purecopy "Auto revert tail (Tail)") auto-revert-tail-mode
-             :help ,(purecopy "Revert the tail of the buffer when buffer grows")
+(bindings--define-key mode-line-mode-menu [auto-revert-tail-mode]
+  '(menu-item "Auto revert tail (Tail)" auto-revert-tail-mode
+             :help "Revert the tail of the buffer when buffer grows"
              :enable (buffer-file-name)
              :button (:toggle . (bound-and-true-p auto-revert-tail-mode))))
-(define-key mode-line-mode-menu [auto-revert-mode]
-  `(menu-item ,(purecopy "Auto revert (ARev)") auto-revert-mode
-             :help ,(purecopy "Revert the buffer when the file on disk changes")
+(bindings--define-key mode-line-mode-menu [auto-revert-mode]
+  '(menu-item "Auto revert (ARev)" auto-revert-mode
+             :help "Revert the buffer when the file on disk changes"
              :button (:toggle . (bound-and-true-p auto-revert-mode))))
-(define-key mode-line-mode-menu [auto-fill-mode]
-  `(menu-item ,(purecopy "Auto fill (Fill)") auto-fill-mode
-             :help ,(purecopy "Automatically insert new lines")
+(bindings--define-key mode-line-mode-menu [auto-fill-mode]
+  '(menu-item "Auto fill (Fill)" auto-fill-mode
+             :help "Automatically insert new lines"
              :button (:toggle . auto-fill-function)))
-(define-key mode-line-mode-menu [abbrev-mode]
-  `(menu-item ,(purecopy "Abbrev (Abbrev)") abbrev-mode
-             :help ,(purecopy "Automatically expand abbreviations")
+(bindings--define-key mode-line-mode-menu [abbrev-mode]
+  '(menu-item "Abbrev (Abbrev)" abbrev-mode
+             :help "Automatically expand abbreviations"
              :button (:toggle . abbrev-mode)))
 
 (defun mode-line-minor-mode-help (event)
@@ -551,8 +569,8 @@ Alist saying how to show minor modes in the mode line.
 Each element looks like (VARIABLE STRING);
 STRING is included in the mode line if VARIABLE's value is non-nil.
 
-Actually, STRING need not be a string; any possible mode-line element
-is okay.  See `mode-line-format'.")
+Actually, STRING need not be a string; any mode-line construct is
+okay.  See `mode-line-format'.")
 ;;;###autoload
 (put 'minor-mode-alist 'risky-local-variable t)
 ;; Don't use purecopy here--some people want to change these strings.
@@ -623,29 +641,31 @@ is okay.  See `mode-line-format'.")
 ;; Packages should add to this list appropriately when they are
 ;; loaded, rather than listing everything here.
 (setq debug-ignored-errors
+      ;; FIXME: Maybe beginning-of-line, beginning-of-buffer, end-of-line,
+      ;; end-of-buffer, end-of-file, buffer-read-only, and
+      ;; file-supersession should all be user-errors!
       `(beginning-of-line beginning-of-buffer end-of-line
        end-of-buffer end-of-file buffer-read-only
        file-supersession
-       ,(purecopy "^Previous command was not a yank$")
-       ,(purecopy "^Minibuffer window is not active$")
-       ,(purecopy "^No previous history search regexp$")
-       ,(purecopy "^No later matching history item$")
-       ,(purecopy "^No earlier matching history item$")
-       ,(purecopy "^End of history; no default available$")
-       ,(purecopy "^End of defaults; no next item$")
-       ,(purecopy "^Beginning of history; no preceding item$")
-       ,(purecopy "^No recursive edit is in progress$")
-       ,(purecopy "^Changes to be undone are outside visible portion of buffer$")
-       ,(purecopy "^No undo information in this buffer$")
-       ,(purecopy "^No further undo information")
-       ,(purecopy "^Save not confirmed$")
-       ,(purecopy "^Recover-file cancelled\\.$")
-       ,(purecopy "^Cannot switch buffers in a dedicated window$")
+        user-error ;; That's the main one!
         ))
 
-
 (make-variable-buffer-local 'indent-tabs-mode)
 
+;; These per-buffer variables are never reset by
+;; `kill-all-local-variables', because they have no default value.
+;; For consistency, we give them the `permanent-local' property, even
+;; though `kill-all-local-variables' does not actually consult it.
+
+(mapc (lambda (sym) (put sym 'permanent-local t))
+      '(buffer-file-name default-directory buffer-backed-up
+       buffer-saved-size buffer-auto-save-file-name
+       buffer-read-only buffer-undo-list mark-active
+       point-before-scroll buffer-file-truename
+       buffer-file-format buffer-auto-save-file-format
+       buffer-display-count buffer-display-time
+       enable-multibyte-characters))
+
 ;; We have base64, md5 and sha1 functions built in now.
 (provide 'base64)
 (provide 'md5)
@@ -797,16 +817,20 @@ if `inhibit-field-text-motion' is non-nil."
 
 (define-key ctl-x-map [right] 'next-buffer)
 (define-key ctl-x-map [C-right] 'next-buffer)
+(define-key global-map [XF86Forward] 'next-buffer)
 (define-key ctl-x-map [left] 'previous-buffer)
 (define-key ctl-x-map [C-left] 'previous-buffer)
+(define-key global-map [XF86Back] 'previous-buffer)
 
 (let ((map minibuffer-local-map))
   (define-key map "\en"   'next-history-element)
   (define-key map [next]  'next-history-element)
   (define-key map [down]  'next-history-element)
+  (define-key map [XF86Forward] 'next-history-element)
   (define-key map "\ep"   'previous-history-element)
   (define-key map [prior] 'previous-history-element)
   (define-key map [up]    'previous-history-element)
+  (define-key map [XF86Back] 'previous-history-element)
   (define-key map "\es"   'next-matching-history-element)
   (define-key map "\er"   'previous-matching-history-element)
   ;; Override the global binding (which calls indent-relative via
@@ -868,6 +892,7 @@ if `inhibit-field-text-motion' is non-nil."
   "Keymap for navigation commands.")
 (define-key esc-map "g" goto-map)
 
+(define-key goto-map    "c" 'goto-char)
 (define-key goto-map    "g" 'goto-line)
 (define-key goto-map "\M-g" 'goto-line)
 (define-key goto-map    "n" 'next-error)
@@ -1158,7 +1183,30 @@ if `inhibit-field-text-motion' is non-nil."
 (define-key ctl-x-5-map "m" 'compose-mail-other-frame)
 \f
 
-(defvar ctl-x-r-map (make-sparse-keymap)
+(defvar ctl-x-r-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "c" 'clear-rectangle)
+    (define-key map "k" 'kill-rectangle)
+    (define-key map "d" 'delete-rectangle)
+    (define-key map "y" 'yank-rectangle)
+    (define-key map "o" 'open-rectangle)
+    (define-key map "t" 'string-rectangle)
+    (define-key map "N" 'rectangle-number-lines)
+    (define-key map "\M-w" 'copy-rectangle-as-kill)
+    (define-key map "\C-@" 'point-to-register)
+    (define-key map [?\C-\ ] 'point-to-register)
+    (define-key map " " 'point-to-register)
+    (define-key map "j" 'jump-to-register)
+    (define-key map "s" 'copy-to-register)
+    (define-key map "x" 'copy-to-register)
+    (define-key map "i" 'insert-register)
+    (define-key map "g" 'insert-register)
+    (define-key map "r" 'copy-rectangle-to-register)
+    (define-key map "n" 'number-to-register)
+    (define-key map "+" 'increment-register)
+    (define-key map "w" 'window-configuration-to-register)
+    (define-key map "f" 'frame-configuration-to-register)
+    map)
   "Keymap for subcommands of C-x r.")
 (define-key ctl-x-map "r" ctl-x-r-map)
 
@@ -1200,6 +1248,7 @@ if `inhibit-field-text-motion' is non-nil."
 ;; (define-key ctl-x-map "\-" 'inverse-add-global-abbrev)
 (define-key esc-map "'" 'abbrev-prefix-mark)
 (define-key ctl-x-map "'" 'expand-abbrev)
+(define-key ctl-x-map "\C-b" 'list-buffers)
 
 (define-key ctl-x-map "z" 'repeat)
 
index 33b91fd7db2555a1eaba2e3ea3b6e6924739c9ac..8e6fb94c0dd3002268380d1a9f57595666b239f6 100644 (file)
@@ -33,7 +33,7 @@
 ;;; Code:
 
 (require 'pp)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;; Misc comments:
 ;;
@@ -828,11 +828,11 @@ annotations."
          "#  Date:    " (current-time-string) "\n"))
 
 
+(define-obsolete-variable-alias 'bookmark-read-annotation-text-func
+  'bookmark-edit-annotation-text-func "23.1")
 (defvar bookmark-edit-annotation-text-func 'bookmark-default-annotation-text
   "Function to return default text to use for a bookmark annotation.
 It takes one argument, the name of the bookmark, as a string.")
-(define-obsolete-variable-alias 'bookmark-read-annotation-text-func
-  'bookmark-edit-annotation-text-func "23.1")
 
 (defvar bookmark-edit-annotation-mode-map
   (let ((map (make-sparse-keymap)))
@@ -2015,11 +2015,11 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\
         (tmp-list     ()))
     (while
         (let ((char (read-key (concat prompt bookmark-search-pattern))))
-          (case char
-            ((?\e ?\r) nil) ; RET or ESC break the search loop.
+          (pcase char
+            ((or ?\e ?\r) nil) ; RET or ESC break the search loop.
             (?\C-g (setq bookmark-quit-flag t) nil)
             (?\d (pop tmp-list) t) ; Delete last char of pattern with DEL
-            (t
+            (_
              (if (characterp char)
                  (push char tmp-list)
                (setq unread-command-events
@@ -2034,9 +2034,9 @@ To carry out the deletions that you've marked, use \\<bookmark-bmenu-mode-map>\\
 (defun bookmark-bmenu-filter-alist-by-regexp (regexp)
   "Filter `bookmark-alist' with bookmarks matching REGEXP and rebuild list."
   (let ((bookmark-alist
-         (loop for i in bookmark-alist
-               when (string-match regexp (car i)) collect i into new
-               finally return new)))
+         (cl-loop for i in bookmark-alist
+                  when (string-match regexp (car i)) collect i into new
+                  finally return new)))
     (bookmark-bmenu-list)))
 
 
@@ -2115,36 +2115,36 @@ strings returned are not."
 ;;;###autoload
 (defvar menu-bar-bookmark-map
   (let ((map (make-sparse-keymap "Bookmark functions")))
-    (define-key map [load]
-      `(menu-item ,(purecopy "Load a Bookmark File...") bookmark-load
-                 :help ,(purecopy "Load bookmarks from a bookmark file)")))
-    (define-key map [write]
-      `(menu-item ,(purecopy "Save Bookmarks As...") bookmark-write
-                 :help ,(purecopy "Write bookmarks to a file (reading the file name with the minibuffer)")))
-    (define-key map [save]
-      `(menu-item ,(purecopy "Save Bookmarks") bookmark-save
-                 :help ,(purecopy "Save currently defined bookmarks")))
-    (define-key map [edit]
-      `(menu-item ,(purecopy "Edit Bookmark List") bookmark-bmenu-list
-                 :help ,(purecopy "Display a list of existing bookmarks")))
-    (define-key map [delete]
-      `(menu-item ,(purecopy "Delete Bookmark...") bookmark-delete
-                 :help ,(purecopy "Delete a bookmark from the bookmark list")))
-    (define-key map [rename]
-      `(menu-item ,(purecopy "Rename Bookmark...") bookmark-rename
-                 :help ,(purecopy "Change the name of a bookmark")))
-    (define-key map [locate]
-      `(menu-item ,(purecopy "Insert Location...") bookmark-locate
-                 :help ,(purecopy "Insert the name of the file associated with a bookmark")))
-    (define-key map [insert]
-      `(menu-item ,(purecopy "Insert Contents...") bookmark-insert
-                 :help ,(purecopy "Insert the text of the file pointed to by a bookmark")))
-    (define-key map [set]
-      `(menu-item ,(purecopy "Set Bookmark...") bookmark-set
-                 :help ,(purecopy "Set a bookmark named inside a file.")))
-    (define-key map [jump]
-      `(menu-item ,(purecopy "Jump to Bookmark...") bookmark-jump
-                 :help ,(purecopy "Jump to a bookmark (a point in some file)")))
+    (bindings--define-key map [load]
+      '(menu-item "Load a Bookmark File..." bookmark-load
+                 :help "Load bookmarks from a bookmark file)"))
+    (bindings--define-key map [write]
+      '(menu-item "Save Bookmarks As..." bookmark-write
+                 :help "Write bookmarks to a file (reading the file name with the minibuffer)"))
+    (bindings--define-key map [save]
+      '(menu-item "Save Bookmarks" bookmark-save
+                 :help "Save currently defined bookmarks"))
+    (bindings--define-key map [edit]
+      '(menu-item "Edit Bookmark List" bookmark-bmenu-list
+                 :help "Display a list of existing bookmarks"))
+    (bindings--define-key map [delete]
+      '(menu-item "Delete Bookmark..." bookmark-delete
+                 :help "Delete a bookmark from the bookmark list"))
+    (bindings--define-key map [rename]
+      '(menu-item "Rename Bookmark..." bookmark-rename
+                 :help "Change the name of a bookmark"))
+    (bindings--define-key map [locate]
+      '(menu-item "Insert Location..." bookmark-locate
+                 :help "Insert the name of the file associated with a bookmark"))
+    (bindings--define-key map [insert]
+      '(menu-item "Insert Contents..." bookmark-insert
+                 :help "Insert the text of the file pointed to by a bookmark"))
+    (bindings--define-key map [set]
+      '(menu-item "Set Bookmark..." bookmark-set
+                 :help "Set a bookmark named inside a file."))
+    (bindings--define-key map [jump]
+      '(menu-item "Jump to Bookmark..." bookmark-jump
+                 :help "Jump to a bookmark (a point in some file)"))
     map))
 
 ;;;###autoload
@@ -2164,11 +2164,11 @@ strings returned are not."
   "Hook run at the end of loading library `bookmark.el'.")
 
 ;; Exit Hook, called from kill-emacs-hook
+(define-obsolete-variable-alias 'bookmark-exit-hooks
+  'bookmark-exit-hook "22.1")
 (defvar bookmark-exit-hook nil
   "Hook run when Emacs exits.")
 
-(define-obsolete-variable-alias 'bookmark-exit-hooks 'bookmark-exit-hook "22.1")
-
 (defun bookmark-exit-hook-internal ()
   "Save bookmark state, if necessary, at Emacs exit time.
 This also runs `bookmark-exit-hook'."
index 64c1183b64d2d1581b2dba536ac0a91171b4e9a3..45a7e4d44401ba691e6e6d45ddc3f472554ba47f 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;; ----------------------------------------------------------------------
 ;; Globals for customization
 ;; ----------------------------------------------------------------------
@@ -830,10 +828,10 @@ See `visit-tags-table'."
   (interactive)
   (let ((res
          (with-current-buffer (bs--current-buffer)
-           (setq bs-buffer-show-mark (case bs-buffer-show-mark
-                                       ((nil)   'never)
-                                       ((never) 'always)
-                                       (t       nil))))))
+           (setq bs-buffer-show-mark (pcase bs-buffer-show-mark
+                                       (`nil   'never)
+                                       (`never 'always)
+                                       (_       nil))))))
     (bs--update-current-line)
     (bs--set-window-height)
     (bs--show-config-message res)))
index e17937116073a5fdd3a60332fbd7f79f632da40f..6a65749e0c521c003005077d23214567e543e418 100644 (file)
@@ -1,4 +1,4 @@
-;;; buff-menu.el --- buffer menu main function and support functions -*- coding:utf-8 -*-
+;;; buff-menu.el --- Interface for viewing and manipulating buffers
 
 ;; Copyright (C) 1985-1987, 1993-1995, 2000-2012
 ;;   Free Software Foundation, Inc.
 
 ;;; Commentary:
 
-;; Edit, delete, or change attributes of all currently active Emacs
-;; buffers from a list summarizing their state.  A good way to browse
-;; any special or scratch buffers you have loaded, since you can't find
-;; them by filename.  The single entry point is `list-buffers',
-;; normally bound to C-x C-b.
-
-;;; Change Log:
-
-;; Buffer-menu-view: New function
-;; Buffer-menu-view-other-window: New function
-
-;; Merged by esr with recent mods to Emacs 19 buff-menu, 23 Mar 1993
-;;
-;; Modified by Bob Weiner, Motorola, Inc., 4/14/89
-;;
-;; Added optional backup argument to 'Buffer-menu-unmark' to make it undelete
-;; current entry and then move to previous one.
-;;
-;; Based on FSF code dating back to 1985.
+;; The Buffer Menu is used to view, edit, delete, or change attributes
+;; of buffers.  The entry points are C-x C-b (`list-buffers') and
+;; M-x buffer-menu.
 
 ;;; Code:
 
-;;Trying to preserve the old window configuration works well in
-;;simple scenarios, when you enter the buffer menu, use it, and exit it.
-;;But it does strange things when you switch back to the buffer list buffer
-;;with C-x b, later on, when the window configuration is different.
-;;The choice seems to be, either restore the window configuration
-;;in all cases, or in no cases.
-;;I decided it was better not to restore the window config at all. -- rms.
-
-;;But since then, I changed buffer-menu to use the selected window,
-;;so q now once again goes back to the previous window configuration.
-
-;;(defvar Buffer-menu-window-config nil
-;;  "Window configuration saved from entry to `buffer-menu'.")
-
-;; Put buffer *Buffer List* into proper mode right away
-;; so that from now on even list-buffers is enough to get a buffer menu.
+(require 'tabulated-list)
 
 (defgroup Buffer-menu nil
   "Show a menu of all buffers in a buffer."
   :group 'convenience)
 
 (defcustom Buffer-menu-use-header-line t
-  "Non-nil means to use an immovable header-line."
+  "If non-nil, use the header line to display Buffer Menu column titles."
   :type 'boolean
   :group 'Buffer-menu)
 
 (defface buffer-menu-buffer
   '((t (:weight bold)))
-  "Face used to highlight buffer names in the buffer menu."
+  "Face for buffer names in the Buffer Menu."
   :group 'Buffer-menu)
 (put 'Buffer-menu-buffer 'face-alias 'buffer-menu-buffer)
 
-(defcustom Buffer-menu-buffer+size-width 26
-  "How wide to jointly make the buffer name and size columns."
+(defcustom Buffer-menu-buffer+size-width nil
+  "Combined width of buffer name and size columns in Buffer Menu.
+If nil, use `Buffer-menu-name-width' and `Buffer-menu-size-width'.
+
+If non-nil, the value of `Buffer-menu-name-width' is overridden;
+the name column is assigned width `Buffer-menu-buffer+size-width'
+minus `Buffer-menu-size-width'.  This use is deprecated."
   :type 'number
-  :group 'Buffer-menu)
+  :group 'Buffer-menu
+  :version "24.2")
+
+(make-obsolete-variable 'Buffer-menu-buffer+size-width
+                       "`Buffer-menu-name-width' and `Buffer-menu-size-width'"
+                       "24.2")
+
+(defcustom Buffer-menu-name-width 19
+  "Width of buffer size column in the Buffer Menu."
+  :type 'number
+  :group 'Buffer-menu
+  :version "24.2")
+
+(defcustom Buffer-menu-size-width 7
+  "Width of buffer name column in the Buffer Menu."
+  :type 'number
+  :group 'Buffer-menu
+  :version "24.2")
 
 (defcustom Buffer-menu-mode-width 16
-  "How wide to make the mode name column."
+  "Width of mode name column in the Buffer Menu."
   :type 'number
   :group 'Buffer-menu)
 
@@ -99,35 +90,19 @@ as it is by default."
   :group 'Buffer-menu
   :version "22.1")
 
-;; This should get updated & resorted when you click on a column heading
-(defvar Buffer-menu-sort-column nil
-  "Which column to sort the menu on.
-Use 2 to sort by buffer names, or 5 to sort by file names.
-A nil value means sort by visited order (the default).")
-
-(defconst Buffer-menu-buffer-column 4)
-
 (defvar Buffer-menu-files-only nil
-  "Non-nil if the current buffer-menu lists only file buffers.
-This variable determines whether reverting the buffer lists only
-file buffers.  It affects both manual reverting and reverting by
-Auto Revert Mode.")
+  "Non-nil if the current Buffer Menu lists only file buffers.
+This is set by the prefix argument to `buffer-menu' and related
+commands.")
 (make-variable-buffer-local 'Buffer-menu-files-only)
 
-(defvar Buffer-menu--buffers nil
-  "If non-nil, list of buffers shown in the current buffer-menu.
-This variable determines whether reverting the buffer lists only
-these buffers.  It affects both manual reverting and reverting by
-Auto Revert Mode.")
-(make-variable-buffer-local 'Buffer-menu--buffers)
-
-(defvar Info-current-file) ;; from info.el
-(defvar Info-current-node) ;; from info.el
+(defvar Info-current-file) ; from info.el
+(defvar Info-current-node) ; from info.el
 
 (defvar Buffer-menu-mode-map
-  (let ((map (make-keymap))
+  (let ((map (make-sparse-keymap))
        (menu-map (make-sparse-keymap)))
-    (suppress-keymap map t)
+    (set-keymap-parent map tabulated-list-mode-map)
     (define-key map "v" 'Buffer-menu-select)
     (define-key map "2" 'Buffer-menu-2-window)
     (define-key map "1" 'Buffer-menu-1-window)
@@ -139,12 +114,10 @@ Auto Revert Mode.")
     (define-key map "s" 'Buffer-menu-save)
     (define-key map "d" 'Buffer-menu-delete)
     (define-key map "k" 'Buffer-menu-delete)
-    (define-key map "\C-d" 'Buffer-menu-delete-backwards)
     (define-key map "\C-k" 'Buffer-menu-delete)
+    (define-key map "\C-d" 'Buffer-menu-delete-backwards)
     (define-key map "x" 'Buffer-menu-execute)
     (define-key map " " 'next-line)
-    (define-key map "n" 'next-line)
-    (define-key map "p" 'previous-line)
     (define-key map "\177" 'Buffer-menu-backup-unmark)
     (define-key map "~" 'Buffer-menu-not-modified)
     (define-key map "u" 'Buffer-menu-unmark)
@@ -154,213 +127,196 @@ Auto Revert Mode.")
     (define-key map "b" 'Buffer-menu-bury)
     (define-key map "V" 'Buffer-menu-view)
     (define-key map "T" 'Buffer-menu-toggle-files-only)
-    (define-key map [mouse-2] 'Buffer-menu-mouse-select)
-    (define-key map [follow-link] 'mouse-face)
     (define-key map (kbd "M-s a C-s")   'Buffer-menu-isearch-buffers)
     (define-key map (kbd "M-s a M-C-s") 'Buffer-menu-isearch-buffers-regexp)
+
+    (define-key map [mouse-2] 'Buffer-menu-mouse-select)
+    (define-key map [follow-link] 'mouse-face)
+
     (define-key map [menu-bar Buffer-menu-mode] (cons (purecopy "Buffer-Menu") menu-map))
-    (define-key menu-map [quit]
-      `(menu-item ,(purecopy "Quit") quit-window
-                :help ,(purecopy "Remove the buffer menu from the display")))
-    (define-key menu-map [rev]
-      `(menu-item ,(purecopy "Refresh") revert-buffer
-                :help ,(purecopy "Refresh the *Buffer List* buffer contents")))
-    (define-key menu-map [s0] menu-bar-separator)
-    (define-key menu-map [tf]
-      `(menu-item ,(purecopy "Show Only File Buffers") Buffer-menu-toggle-files-only
+    (bindings--define-key menu-map [quit]
+      '(menu-item "Quit" quit-window
+                :help "Remove the buffer menu from the display"))
+    (bindings--define-key menu-map [rev]
+      '(menu-item "Refresh" revert-buffer
+                :help "Refresh the *Buffer List* buffer contents"))
+    (bindings--define-key menu-map [s0] menu-bar-separator)
+    (bindings--define-key menu-map [tf]
+      '(menu-item "Show Only File Buffers" Buffer-menu-toggle-files-only
                  :button (:toggle . Buffer-menu-files-only)
-                 :help ,(purecopy "Toggle whether the current buffer-menu displays only file buffers")))
-    (define-key menu-map [s1] menu-bar-separator)
+                 :help "Toggle whether the current buffer-menu displays only file buffers"))
+    (bindings--define-key menu-map [s1] menu-bar-separator)
     ;; FIXME: The "Select" entries could use better names...
-    (define-key menu-map [sel]
-      `(menu-item ,(purecopy "Select Marked") Buffer-menu-select
-                :help ,(purecopy "Select this line's buffer; also display buffers marked with `>'")))
-    (define-key menu-map [bm2]
-      `(menu-item ,(purecopy "Select Two") Buffer-menu-2-window
-                :help ,(purecopy "Select this line's buffer, with previous buffer in second window")))
-    (define-key menu-map [bm1]
-      `(menu-item ,(purecopy "Select Current") Buffer-menu-1-window
-                :help ,(purecopy "Select this line's buffer, alone, in full frame")))
-    (define-key menu-map [ow]
-      `(menu-item ,(purecopy "Select in Other Window") Buffer-menu-other-window
-                :help ,(purecopy "Select this line's buffer in other window, leaving buffer menu visible")))
-    (define-key menu-map [tw]
-      `(menu-item ,(purecopy "Select in Current Window") Buffer-menu-this-window
-                :help ,(purecopy "Select this line's buffer in this window")))
-    (define-key menu-map [s2] menu-bar-separator)
-    (define-key menu-map [is]
-      `(menu-item ,(purecopy "Regexp Isearch Marked Buffers...") Buffer-menu-isearch-buffers-regexp
-                :help ,(purecopy "Search for a regexp through all marked buffers using Isearch")))
-    (define-key menu-map [ir]
-      `(menu-item ,(purecopy "Isearch Marked Buffers...") Buffer-menu-isearch-buffers
-                :help ,(purecopy "Search for a string through all marked buffers using Isearch")))
-    (define-key menu-map [s3] menu-bar-separator)
-    (define-key menu-map [by]
-      `(menu-item ,(purecopy "Bury") Buffer-menu-bury
-                :help ,(purecopy "Bury the buffer listed on this line")))
-    (define-key menu-map [vt]
-      `(menu-item ,(purecopy "Set Unmodified") Buffer-menu-not-modified
-                :help ,(purecopy "Mark buffer on this line as unmodified (no changes to save)")))
-    (define-key menu-map [ex]
-      `(menu-item ,(purecopy "Execute") Buffer-menu-execute
-                :help ,(purecopy "Save and/or delete buffers marked with s or k commands")))
-    (define-key menu-map [s4] menu-bar-separator)
-    (define-key menu-map [delb]
-      `(menu-item ,(purecopy "Mark for Delete and Move Backwards") Buffer-menu-delete-backwards
-                :help ,(purecopy "Mark buffer on this line to be deleted by x command and move up one line")))
-    (define-key menu-map [del]
-      `(menu-item ,(purecopy "Mark for Delete") Buffer-menu-delete
-                :help ,(purecopy "Mark buffer on this line to be deleted by x command")))
-
-    (define-key menu-map [sv]
-      `(menu-item ,(purecopy "Mark for Save") Buffer-menu-save
-                :help ,(purecopy "Mark buffer on this line to be saved by x command")))
-    (define-key menu-map [umk]
-      `(menu-item ,(purecopy "Unmark") Buffer-menu-unmark
-                :help ,(purecopy "Cancel all requested operations on buffer on this line and move down")))
-    (define-key menu-map [mk]
-      `(menu-item ,(purecopy "Mark") Buffer-menu-mark
-                :help ,(purecopy "Mark buffer on this line for being displayed by v command")))
+    (bindings--define-key menu-map [sel]
+      '(menu-item "Select Marked" Buffer-menu-select
+                :help "Select this line's buffer; also display buffers marked with `>'"))
+    (bindings--define-key menu-map [bm2]
+      '(menu-item "Select Two" Buffer-menu-2-window
+                :help "Select this line's buffer, with previous buffer in second window"))
+    (bindings--define-key menu-map [bm1]
+      '(menu-item "Select Current" Buffer-menu-1-window
+                :help "Select this line's buffer, alone, in full frame"))
+    (bindings--define-key menu-map [ow]
+      '(menu-item "Select in Other Window" Buffer-menu-other-window
+                :help "Select this line's buffer in other window, leaving buffer menu visible"))
+    (bindings--define-key menu-map [tw]
+      '(menu-item "Select in Current Window" Buffer-menu-this-window
+                :help "Select this line's buffer in this window"))
+    (bindings--define-key menu-map [s2] menu-bar-separator)
+    (bindings--define-key menu-map [is]
+      '(menu-item "Regexp Isearch Marked Buffers..." Buffer-menu-isearch-buffers-regexp
+                :help "Search for a regexp through all marked buffers using Isearch"))
+    (bindings--define-key menu-map [ir]
+      '(menu-item "Isearch Marked Buffers..." Buffer-menu-isearch-buffers
+                :help "Search for a string through all marked buffers using Isearch"))
+    (bindings--define-key menu-map [s3] menu-bar-separator)
+    (bindings--define-key menu-map [by]
+      '(menu-item "Bury" Buffer-menu-bury
+                :help "Bury the buffer listed on this line"))
+    (bindings--define-key menu-map [vt]
+      '(menu-item "Set Unmodified" Buffer-menu-not-modified
+                :help "Mark buffer on this line as unmodified (no changes to save)"))
+    (bindings--define-key menu-map [ex]
+      '(menu-item "Execute" Buffer-menu-execute
+                :help "Save and/or delete buffers marked with s or k commands"))
+    (bindings--define-key menu-map [s4] menu-bar-separator)
+    (bindings--define-key menu-map [delb]
+      '(menu-item "Mark for Delete and Move Backwards" Buffer-menu-delete-backwards
+                :help "Mark buffer on this line to be deleted by x command and move up one line"))
+    (bindings--define-key menu-map [del]
+      '(menu-item "Mark for Delete" Buffer-menu-delete
+                :help "Mark buffer on this line to be deleted by x command"))
+
+    (bindings--define-key menu-map [sv]
+      '(menu-item "Mark for Save" Buffer-menu-save
+                :help "Mark buffer on this line to be saved by x command"))
+    (bindings--define-key menu-map [umk]
+      '(menu-item "Unmark" Buffer-menu-unmark
+                :help "Cancel all requested operations on buffer on this line and move down"))
+    (bindings--define-key menu-map [mk]
+      '(menu-item "Mark" Buffer-menu-mark
+                :help "Mark buffer on this line for being displayed by v command"))
     map)
   "Local keymap for `Buffer-menu-mode' buffers.")
 
-;; Buffer Menu mode is suitable only for specially formatted data.
-(put 'Buffer-menu-mode 'mode-class 'special)
+(define-obsolete-variable-alias 'buffer-menu-mode-hook
+  'Buffer-menu-mode-hook "23.1")
 
-(define-derived-mode Buffer-menu-mode special-mode "Buffer Menu"
-  "Major mode for editing a list of buffers.
-Each line describes one of the buffers in Emacs.
-Letters do not insert themselves; instead, they are commands.
-\\<Buffer-menu-mode-map>
-\\[Buffer-menu-mouse-select] -- select buffer you click on, in place of the buffer menu.
-\\[Buffer-menu-this-window] -- select current line's buffer in place of the buffer menu.
-\\[Buffer-menu-other-window] -- select that buffer in another window,
-  so the buffer menu buffer remains visible in its window.
-\\[Buffer-menu-view] -- select current line's buffer, but in view-mode.
-\\[Buffer-menu-view-other-window] -- select that buffer in
-  another window, in view-mode.
-\\[Buffer-menu-switch-other-window] -- make another window display that buffer.
-\\[Buffer-menu-mark] -- mark current line's buffer to be displayed.
-\\[Buffer-menu-select] -- select current line's buffer.
-  Also show buffers marked with m, in other windows.
-\\[Buffer-menu-1-window] -- select that buffer in full-frame window.
-\\[Buffer-menu-2-window] -- select that buffer in one window,
-  together with buffer selected before this one in another window.
-\\[Buffer-menu-isearch-buffers] -- Do incremental search in the marked buffers.
-\\[Buffer-menu-isearch-buffers-regexp] -- Isearch for regexp in the marked buffers.
-\\[Buffer-menu-visit-tags-table] -- visit-tags-table this buffer.
-\\[Buffer-menu-not-modified] -- clear modified-flag on that buffer.
-\\[Buffer-menu-save] -- mark that buffer to be saved, and move down.
-\\[Buffer-menu-delete] -- mark that buffer to be deleted, and move down.
-\\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted, and move up.
-\\[Buffer-menu-execute] -- delete or save marked buffers.
-\\[Buffer-menu-unmark] -- remove all kinds of marks from current line.
-  With prefix argument, also move up one line.
-\\[Buffer-menu-backup-unmark] -- back up a line and remove marks.
-\\[Buffer-menu-toggle-read-only] -- toggle read-only status of buffer on this line.
-\\[revert-buffer] -- update the list of buffers.
-\\[Buffer-menu-toggle-files-only] -- toggle whether the menu displays only file buffers.
-\\[Buffer-menu-bury] -- bury the buffer listed on this line."
-  (set (make-local-variable 'revert-buffer-function)
-       'Buffer-menu-revert-function)
+(define-derived-mode Buffer-menu-mode tabulated-list-mode "Buffer Menu"
+  "Major mode for Buffer Menu buffers.
+The Buffer Menu is invoked by the commands \\[list-buffers], \\[buffer-menu], and
+\\[buffer-menu-other-window].  See `buffer-menu' for details."
   (set (make-local-variable 'buffer-stale-function)
        (lambda (&optional _noconfirm) 'fast))
-  (setq truncate-lines t)
-  (setq buffer-read-only t)
-  ;; Force L2R direction, to avoid messing the display if the first
-  ;; buffer in the list happens to begin with a strong R2L character.
-  (setq bidi-paragraph-direction 'left-to-right))
+  (add-hook 'tabulated-list-revert-hook 'list-buffers--refresh nil t))
 
-(define-obsolete-variable-alias 'buffer-menu-mode-hook
-  'Buffer-menu-mode-hook "23.1")
+(defun buffer-menu (&optional arg)
+  "Switch to the Buffer Menu.
+By default, all buffers are listed except those whose names start
+with a space (which are for internal use).  With prefix argument
+ARG, show only buffers that are visiting files.
 
-(defun Buffer-menu-revert-function (_ignore1 _ignore2)
-  (or (eq buffer-undo-list t)
-      (setq buffer-undo-list nil))
-  ;; We can not use save-excursion here.  The buffer gets erased.
-  (let ((opoint (point))
-       (eobp (eobp))
-       (ocol (current-column))
-       (oline (progn (move-to-column Buffer-menu-buffer-column)
-                     (get-text-property (point) 'buffer)))
-       (prop (point-min))
-       ;; do not make undo records for the reversion.
-       (buffer-undo-list t))
-    ;; We can be called by Auto Revert Mode with the "*Buffer Menu*"
-    ;; temporarily the current buffer.  Make sure that the
-    ;; interactively current buffer is correctly identified with a `.'
-    ;; by `list-buffers-noselect'.
-    (with-current-buffer (window-buffer)
-      (list-buffers-noselect Buffer-menu-files-only Buffer-menu--buffers))
-    (if oline
-       (while (setq prop (next-single-property-change prop 'buffer))
-         (when (eq (get-text-property prop 'buffer) oline)
-           (goto-char prop)
-           (move-to-column ocol)))
-      (goto-char (if eobp (point-max) opoint)))))
+The first column (denoted \"C\") shows \".\" for the buffer from
+which you came.  It shows \">\" for buffers you mark to be
+displayed, and \"D\" for those you mark for deletion.
 
-(defun Buffer-menu-toggle-files-only (arg)
-  "Toggle whether the current buffer-menu displays only file buffers.
-With a positive ARG display only file buffers.  With zero or
-negative ARG, display other buffers as well."
-  (interactive "P")
-  (setq Buffer-menu-files-only
-       (cond ((not arg) (not Buffer-menu-files-only))
-             ((> (prefix-numeric-value arg) 0) t)))
-  (revert-buffer))
+The \"R\" column has a \"%\" if the buffer is read-only.
+The \"M\" column has a \"*\" if it is modified, or \"S\" if you
+have marked it for saving.
 
-\f
-(defun Buffer-menu-buffer (error-if-non-existent-p)
-  "Return buffer described by this line of buffer menu."
-  (let* ((where (+ (line-beginning-position) Buffer-menu-buffer-column))
-        (name (and (not (eobp)) (get-text-property where 'buffer-name)))
-        (buf (and (not (eobp)) (get-text-property where 'buffer))))
-    (if name
-       (or (get-buffer name)
-           (and buf (buffer-name buf) buf)
-           (if error-if-non-existent-p
-               (error "No buffer named `%s'" name)
-             nil))
-      (or (and buf (buffer-name buf) buf)
-         (if error-if-non-existent-p
-             (error "No buffer on this line")
-           nil)))))
-\f
-(defun buffer-menu (&optional arg)
-  "Make a menu of buffers so you can save, delete or select them.
-With argument, show only buffers that are visiting files.
-Type ? after invocation to get help on commands available.
-Type q to remove the buffer menu from the display.
-
-The first column shows `>' for a buffer you have
-marked to be displayed, `D' for one you have marked for
-deletion, and `.' for the current buffer.
-
-The C column has a `.' for the buffer from which you came.
-The R column has a `%' if the buffer is read-only.
-The M column has a `*' if it is modified,
-or `S' if you have marked it for saving.
-After this come the buffer name, its size in characters,
-its major mode, and the visited file name (if any)."
+After this come the buffer name, its size in characters, its
+major mode, and the visited file name (if any).
+
+
+In the Buffer Menu, the following commands are defined:
+\\<Buffer-menu-mode-map>
+\\[quit-window]    Remove the Buffer Menu from the display.
+\\[Buffer-menu-this-window]  Select current line's buffer in place of the buffer menu.
+\\[Buffer-menu-other-window]    Select that buffer in another window,
+     so the Buffer Menu remains visible in its window.
+\\[Buffer-menu-view]    Select current line's buffer, in View mode.
+\\[Buffer-menu-view-other-window]  Select that buffer in
+     another window, in view-mode.
+\\[Buffer-menu-switch-other-window]  Make another window display that buffer.
+\\[Buffer-menu-mark]    Mark current line's buffer to be displayed.
+\\[Buffer-menu-select]    Select current line's buffer.
+     Also show buffers marked with m, in other windows.
+\\[Buffer-menu-1-window]    Select that buffer in full-frame window.
+\\[Buffer-menu-2-window]    Select that buffer in one window, together with the
+     buffer selected before this one in another window.
+\\[Buffer-menu-isearch-buffers]  Incremental search in the marked buffers.
+\\[Buffer-menu-isearch-buffers-regexp]  Isearch for regexp in the marked buffers.
+\\[Buffer-menu-visit-tags-table]    visit-tags-table this buffer.
+\\[Buffer-menu-not-modified]    Clear modified-flag on that buffer.
+\\[Buffer-menu-save]    Mark that buffer to be saved, and move down.
+\\[Buffer-menu-delete]  Mark that buffer to be deleted, and move down.
+\\[Buffer-menu-delete-backwards]  Mark that buffer to be deleted, and move up.
+\\[Buffer-menu-execute]    Delete or save marked buffers.
+\\[Buffer-menu-unmark]    Remove all marks from current line.
+     With prefix argument, also move up one line.
+\\[Buffer-menu-backup-unmark]  Back up a line and remove marks.
+\\[Buffer-menu-toggle-read-only]    Toggle read-only status of buffer on this line.
+\\[revert-buffer]    Update the list of buffers.
+\\[Buffer-menu-toggle-files-only]    Toggle whether the menu displays only file buffers.
+\\[Buffer-menu-bury]    Bury the buffer listed on this line."
   (interactive "P")
-;;;  (setq Buffer-menu-window-config (current-window-configuration))
   (switch-to-buffer (list-buffers-noselect arg))
   (message
    "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help."))
 
 (defun buffer-menu-other-window (&optional arg)
-  "Display a list of buffers in another window.
-With the buffer list buffer, you can save, delete or select the buffers.
-With argument, show only buffers that are visiting files.
-Type ? after invocation to get help on commands available.
-Type q to remove the buffer menu from the display.
-For more information, see the function `buffer-menu'."
+  "Display the Buffer Menu in another window.
+See `buffer-menu' for a description of the Buffer Menu.
+
+By default, all buffers are listed except those whose names start
+with a space (which are for internal use).  With prefix argument
+ARG, show only buffers that are visiting files."
   (interactive "P")
-;;;  (setq Buffer-menu-window-config (current-window-configuration))
   (switch-to-buffer-other-window (list-buffers-noselect arg))
   (message
    "Commands: d, s, x, u; f, o, 1, 2, m, v; ~, %%; q to quit; ? for help."))
 
+;;;###autoload
+(defun list-buffers (&optional arg)
+  "Display a list of existing buffers.
+The list is displayed in a buffer named \"*Buffer List*\".
+See `buffer-menu' for details about the Buffer Menu buffer.
+
+By default, all buffers are listed except those whose names start
+with a space (which are for internal use).  With prefix argument
+ARG, show only buffers that are visiting files."
+  (interactive "P")
+  (display-buffer (list-buffers-noselect arg)))
+
+(defun Buffer-menu-toggle-files-only (arg)
+  "Toggle whether the current buffer-menu displays only file buffers.
+With a positive ARG, display only file buffers.  With zero or
+negative ARG, display other buffers as well."
+  (interactive "P")
+  (setq Buffer-menu-files-only
+       (cond ((not arg) (not Buffer-menu-files-only))
+             ((> (prefix-numeric-value arg) 0) t)))
+  (message (if Buffer-menu-files-only
+              "Showing only file-visiting buffers."
+            "Showing all non-internal buffers."))
+  (revert-buffer))
+
+(defalias 'Buffer-menu-sort 'tabulated-list-sort)
+\f
+
+(defun Buffer-menu-buffer (&optional error-if-non-existent-p)
+  "Return the buffer described by the current Buffer Menu line.
+If there is no buffer here, return nil if ERROR-IF-NON-EXISTENT-P
+is nil or omitted, and signal an error otherwise."
+  (let ((buffer (tabulated-list-get-id)))
+    (cond ((null buffer)
+          (if error-if-non-existent-p
+              (error "No buffer on this line")))
+         ((not (buffer-live-p buffer))
+          (if error-if-non-existent-p
+              (error "This buffer has been killed")))
+         (t buffer))))
+
 (defun Buffer-menu-no-header ()
   (beginning-of-line)
   (if (or Buffer-menu-use-header-line
@@ -370,166 +326,140 @@ For more information, see the function `buffer-menu'."
     (forward-line 1)
     nil))
 
+(defun Buffer-menu-beginning ()
+  (goto-char (point-min))
+  (unless Buffer-menu-use-header-line
+    (forward-line)))
+
+\f
+;;; Commands for modifying Buffer Menu entries.
+
 (defun Buffer-menu-mark ()
-  "Mark buffer on this line for being displayed by \\<Buffer-menu-mode-map>\\[Buffer-menu-select] command."
+  "Mark the Buffer menu entry at point for later display.
+It will be displayed by the \\<Buffer-menu-mode-map>\\[Buffer-menu-select] command."
   (interactive)
-  (when (Buffer-menu-no-header)
-    (let ((inhibit-read-only t))
-      (delete-char 1)
-      (insert ?>)
-      (forward-line 1))))
+  (tabulated-list-set-col 0 ">" t)
+  (forward-line))
 
 (defun Buffer-menu-unmark (&optional backup)
   "Cancel all requested operations on buffer on this line and move down.
 Optional prefix arg means move up."
   (interactive "P")
-  (when (Buffer-menu-no-header)
-    (let* ((buf (Buffer-menu-buffer t))
-          (mod (buffer-modified-p buf))
-          (readonly (with-current-buffer buf buffer-read-only))
-          (inhibit-read-only t))
-      (delete-char 3)
-      (insert (if readonly (if mod " %*" " % ") (if mod "  *" "   ")))))
+  (tabulated-list-set-col 0 " " t)
   (forward-line (if backup -1 1)))
 
 (defun Buffer-menu-backup-unmark ()
   "Move up and cancel all requested operations on buffer on line above."
   (interactive)
   (forward-line -1)
-  (Buffer-menu-unmark)
-  (forward-line -1))
+  (tabulated-list-set-col 0 " " t))
 
 (defun Buffer-menu-delete (&optional arg)
-  "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command.
-Prefix arg is how many buffers to delete.
-Negative arg means delete backwards."
+  "Mark the buffer on this Buffer Menu buffer line for deletion.
+A subsequent \\<Buffer-menu-mode-map>`\\[Buffer-menu-execute]' command
+will delete it.
+
+If prefix argument ARG is non-nil, it specifies the number of
+buffers to delete; a negative ARG means to delete backwards."
   (interactive "p")
-  (when (Buffer-menu-no-header)
-    (let ((inhibit-read-only t))
-      (if (or (null arg) (= arg 0))
-         (setq arg 1))
-      (while (> arg 0)
-       (delete-char 1)
-       (insert ?D)
-       (forward-line 1)
-       (setq arg (1- arg)))
-      (while (and (< arg 0)
-                 (Buffer-menu-no-header))
-       (delete-char 1)
-       (insert ?D)
-       (forward-line -1)
-       (setq arg (1+ arg))))))
+  (if (or (null arg) (= arg 0))
+      (setq arg 1))
+  (while (> arg 0)
+    (when (Buffer-menu-buffer)
+      (tabulated-list-set-col 0 "D" t))
+    (forward-line 1)
+    (setq arg (1- arg)))
+  (while (< arg 0)
+    (when (Buffer-menu-buffer)
+      (tabulated-list-set-col 0 "D" t))
+    (forward-line -1)
+    (setq arg (1+ arg))))
 
 (defun Buffer-menu-delete-backwards (&optional arg)
-  "Mark buffer on this line to be deleted by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command
-and then move up one line.  Prefix arg means move that many lines."
+  "Mark the buffer on this Buffer Menu line for deletion, and move up.
+Prefix ARG means move that many lines."
   (interactive "p")
   (Buffer-menu-delete (- (or arg 1))))
 
 (defun Buffer-menu-save ()
-  "Mark buffer on this line to be saved by \\<Buffer-menu-mode-map>\\[Buffer-menu-execute] command."
+  "Mark the buffer on this Buffer Menu line for saving.
+A subsequent \\<Buffer-menu-mode-map>`\\[Buffer-menu-execute]' command
+will save it."
   (interactive)
-  (when (Buffer-menu-no-header)
-    (let ((inhibit-read-only t))
-      (forward-char 2)
-      (delete-char 1)
-      (insert ?S)
-      (forward-line 1))))
+  (when (Buffer-menu-buffer)
+    (tabulated-list-set-col 2 "S" t)
+    (forward-line 1)))
 
 (defun Buffer-menu-not-modified (&optional arg)
-  "Mark buffer on this line as unmodified (no changes to save)."
+  "Mark the buffer on this line as unmodified (no changes to save).
+If ARG is non-nil (interactively, with a prefix argument), mark
+it as modified."
   (interactive "P")
   (with-current-buffer (Buffer-menu-buffer t)
     (set-buffer-modified-p arg))
-  (save-excursion
-   (beginning-of-line)
-   (forward-char 2)
-   (if (= (char-after) (if arg ?\s ?*))
-       (let ((inhibit-read-only t))
-        (delete-char 1)
-        (insert (if arg ?* ?\s))))))
-
-(defun Buffer-menu-beginning ()
-  (goto-char (point-min))
-  (unless Buffer-menu-use-header-line
-    (forward-line)))
+  (tabulated-list-set-col 2 (if arg "*" " ") t))
 
 (defun Buffer-menu-execute ()
-  "Save and/or delete buffers marked with \\<Buffer-menu-mode-map>\\[Buffer-menu-save] or \\<Buffer-menu-mode-map>\\[Buffer-menu-delete] commands."
+  "Save and/or delete marked buffers in the Buffer Menu.
+Buffers marked with \\<Buffer-menu-mode-map>`\\[Buffer-menu-save]' are saved.
+Buffers marked with \\<Buffer-menu-mode-map>`\\[Buffer-menu-delete]' are deleted."
   (interactive)
   (save-excursion
     (Buffer-menu-beginning)
-    (while (re-search-forward "^..S" nil t)
-      (let ((modp nil))
-       (with-current-buffer (Buffer-menu-buffer t)
-         (save-buffer)
-         (setq modp (buffer-modified-p)))
-       (let ((inhibit-read-only t))
-         (delete-char -1)
-         (insert (if modp ?* ?\s))))))
-  (save-excursion
-    (Buffer-menu-beginning)
-    (let ((buff-menu-buffer (current-buffer))
-         (inhibit-read-only t))
-      (while (re-search-forward "^D" nil t)
-       (forward-char -1)
-       (let ((buf (Buffer-menu-buffer nil)))
-         (or (eq buf nil)
-             (eq buf buff-menu-buffer)
-             (save-excursion (kill-buffer buf)))
-         (if (and buf (buffer-name buf))
-           (progn (delete-char 1)
-                  (insert ?\s))
-         (delete-region (point) (progn (forward-line 1) (point)))
-           (unless (bobp)
-             (forward-char -1))))))))
+    (while (not (eobp))
+      (let ((buffer (tabulated-list-get-id))
+           (entry  (tabulated-list-get-entry)))
+       (cond ((null entry)
+              (forward-line 1))
+             ((not (buffer-live-p buffer))
+              (tabulated-list-delete-entry))
+             (t
+              (let ((delete (eq (char-after) ?D)))
+                (when (equal (aref entry 2) "S")
+                  (condition-case nil
+                      (progn
+                        (with-current-buffer buffer
+                          (save-buffer))
+                        (tabulated-list-set-col 2 " " t))
+                    (error (warn "Error saving %s" buffer))))
+                (if delete
+                    (unless (eq buffer (current-buffer))
+                      (kill-buffer buffer)
+                      (tabulated-list-delete-entry))
+                  (forward-line 1)))))))))
 
 (defun Buffer-menu-select ()
-  "Select this line's buffer; also display buffers marked with `>'.
-You can mark buffers with the \\<Buffer-menu-mode-map>\\[Buffer-menu-mark] command.
+  "Select this line's buffer; also, display buffers marked with `>'.
+You can mark buffers with the \\<Buffer-menu-mode-map>`\\[Buffer-menu-mark]' command.
 This command deletes and replaces all the previously existing windows
 in the selected frame."
   (interactive)
-  (let ((buff (Buffer-menu-buffer t))
-       (menu (current-buffer))
-       (others ())
-       tem)
-    (Buffer-menu-beginning)
-    (while (re-search-forward "^>" nil t)
-      (setq tem (Buffer-menu-buffer t))
-      (let ((inhibit-read-only t))
-       (delete-char -1)
-       (insert ?\s))
-      (or (eq tem buff) (memq tem others) (setq others (cons tem others))))
-    (setq others (nreverse others)
-         tem (/ (1- (frame-height)) (1+ (length others))))
+  (let* ((this-buffer (Buffer-menu-buffer t))
+        (menu-buffer (current-buffer))
+        (others (delq this-buffer (Buffer-menu-marked-buffers t)))
+        (height (/ (1- (frame-height)) (1+ (length others)))))
     (delete-other-windows)
-    (switch-to-buffer buff)
-    (or (eq menu buff)
-       (bury-buffer menu))
-    (if (equal (length others) 0)
-       (progn
-;;;      ;; Restore previous window configuration before displaying
-;;;      ;; selected buffers.
-;;;      (if Buffer-menu-window-config
-;;;          (progn
-;;;            (set-window-configuration Buffer-menu-window-config)
-;;;            (setq Buffer-menu-window-config nil)))
-         (switch-to-buffer buff))
-      (while others
-       (split-window nil tem)
-       (other-window 1)
-       (switch-to-buffer (car others))
-       (setq others (cdr others)))
-      (other-window 1)                         ;back to the beginning!
-)))
-
-(defun Buffer-menu-marked-buffers ()
-  "Return a list of buffers marked with the \\<Buffer-menu-mode-map>\\[Buffer-menu-mark] command."
+    (switch-to-buffer this-buffer)
+    (unless (eq menu-buffer this-buffer)
+      (bury-buffer menu-buffer))
+    (dolist (buffer others)
+      (split-window nil height)
+      (other-window 1)
+      (switch-to-buffer buffer))
+    ;; Back to the beginning!
+    (other-window 1)))
+
+(defun Buffer-menu-marked-buffers (&optional unmark)
+  "Return the list of buffers marked with `Buffer-menu-mark'.
+If UNMARK is non-nil, unmark them."
   (let (buffers)
     (Buffer-menu-beginning)
     (while (re-search-forward "^>" nil t)
-      (setq buffers (cons (Buffer-menu-buffer t) buffers)))
+      (let ((buffer (Buffer-menu-buffer)))
+       (if (and buffer unmark)
+           (tabulated-list-set-col 0 " " t))
+       (if (buffer-live-p buffer)
+           (push buffer buffers))))
     (nreverse buffers)))
 
 (defun Buffer-menu-isearch-buffers ()
@@ -558,20 +488,6 @@ in the selected frame."
   (bury-buffer (other-buffer))
   (delete-other-windows))
 
-(defun Buffer-menu-mouse-select (event)
-  "Select the buffer whose line you click on."
-  (interactive "e")
-  (let (buffer)
-    (with-current-buffer (window-buffer (posn-window (event-end event)))
-      (save-excursion
-       (goto-char (posn-point (event-end event)))
-       (setq buffer (Buffer-menu-buffer t))))
-    (select-window (posn-window (event-end event)))
-    (if (and (window-dedicated-p (selected-window))
-            (eq (selected-window) (frame-root-window)))
-       (switch-to-buffer-other-frame buffer)
-      (switch-to-buffer buffer))))
-
 (defun Buffer-menu-this-window ()
   "Select this line's buffer in this window."
   (interactive)
@@ -599,343 +515,145 @@ The current window remains selected."
     (bury-buffer menu)))
 
 (defun Buffer-menu-toggle-read-only ()
-  "Toggle read-only status of buffer on this line, perhaps via version control."
+  "Toggle read-only status of buffer on this line.
+This behaves like invoking \\[toggle-read-only] in that buffer."
   (interactive)
-  (let (char)
+  (let (read-only)
     (with-current-buffer (Buffer-menu-buffer t)
       (toggle-read-only)
-      (setq char (if buffer-read-only ?% ?\s)))
-    (save-excursion
-      (beginning-of-line)
-      (forward-char 1)
-      (if (/= (following-char) char)
-          (let ((inhibit-read-only t))
-            (delete-char 1)
-            (insert char))))))
+      (setq read-only buffer-read-only))
+    (tabulated-list-set-col 1 (if read-only "%" " ") t)))
 
 (defun Buffer-menu-bury ()
   "Bury the buffer listed on this line."
   (interactive)
-  (when (Buffer-menu-no-header)
-    (save-excursion
-      (beginning-of-line)
-      (bury-buffer (Buffer-menu-buffer t))
-      (let ((line (buffer-substring (point) (progn (forward-line 1) (point))))
-            (inhibit-read-only t))
-        (delete-region (point) (progn (forward-line -1) (point)))
-        (goto-char (point-max))
-        (insert line))
-      (message "Buried buffer moved to the end"))))
-
+  (let ((buffer (tabulated-list-get-id)))
+    (cond ((null buffer))
+         ((buffer-live-p buffer)
+          (bury-buffer buffer)
+          (save-excursion
+            (let ((elt (tabulated-list-delete-entry)))
+              (goto-char (point-max))
+              (apply 'tabulated-list-print-entry elt)))
+          (message "Buffer buried."))
+         (t
+          (tabulated-list-delete-entry)
+          (message "Buffer is dead; removing from list.")))))
 
 (defun Buffer-menu-view ()
   "View this line's buffer in View mode."
   (interactive)
   (view-buffer (Buffer-menu-buffer t)))
 
-
 (defun Buffer-menu-view-other-window ()
   "View this line's buffer in View mode in another window."
   (interactive)
   (view-buffer-other-window (Buffer-menu-buffer t)))
 \f
+;;; Functions for populating the Buffer Menu.
 
 ;;;###autoload
-(define-key ctl-x-map "\C-b" 'list-buffers)
-
-;;;###autoload
-(defun list-buffers (&optional files-only)
-  "Display a list of names of existing buffers.
-The list is displayed in a buffer named `*Buffer List*'.
-Note that buffers with names starting with spaces are omitted.
-Non-null optional arg FILES-ONLY means mention only file buffers.
-
-For more information, see the function `buffer-menu'."
-  (interactive "P")
-  (display-buffer (list-buffers-noselect files-only)))
-
-(defconst Buffer-menu-short-ellipsis
-  ;; This file is preloaded, so we can't use char-displayable-p here
-  ;; because we don't know yet what display we're going to connect to.
-  ":" ;; (if (char-displayable-p ?…) "…" ":")
-  )
-
-(defun Buffer-menu-buffer+size (name size &optional name-props size-props)
-  (if (> (+ (string-width name) (string-width size) 2)
-         Buffer-menu-buffer+size-width)
-      (setq name
-            (let ((tail
-                   (if (string-match "<[0-9]+>$" name)
-                       (match-string 0 name)
-                     "")))
-              (concat (truncate-string-to-width
-                       name
-                       (- Buffer-menu-buffer+size-width
-                          (max (string-width size) 3)
-                          (string-width tail)
-                          2))
-                      Buffer-menu-short-ellipsis
-                      tail)))
-    ;; Don't put properties on (buffer-name).
-    (setq name (copy-sequence name)))
-  (add-text-properties 0 (length name) name-props name)
-  (add-text-properties 0 (length size) size-props size)
-  (let ((name+space-width (- Buffer-menu-buffer+size-width
-                            (string-width size))))
-    (concat name
-           (propertize (make-string (- name+space-width (string-width name))
-                                    ?\s)
-                       'display `(space :align-to
-                                        ,(+ Buffer-menu-buffer-column
-                                            name+space-width)))
-           size)))
-
-(defun Buffer-menu-sort (column)
-  "Sort the buffer menu by COLUMN."
-  (interactive "P")
-  (when column
-    (setq column (prefix-numeric-value column))
-    (if (< column 2) (setq column 2))
-    (if (> column 5) (setq column 5)))
-  (setq Buffer-menu-sort-column column)
-  (let ((inhibit-read-only t) l buf m1 m2)
-    (save-excursion
-      (Buffer-menu-beginning)
-      (while (not (eobp))
-       (when (buffer-live-p
-              (setq buf (get-text-property
-                         (+ (point)
-                            Buffer-menu-buffer-column)
-                         'buffer)))
-         (setq m1 (char-after)
-               m1 (if (memq m1 '(?> ?D)) m1)
-               m2 (char-after (+ (point) 2))
-               m2 (if (eq m2 ?S) m2))
-         (if (or m1 m2)
-             (push (list buf m1 m2) l)))
-       (forward-line)))
-    (revert-buffer)
-    (save-excursion
-      (Buffer-menu-beginning)
-      (while (not (eobp))
-       (when (setq buf (assq (get-text-property (+ (point)
-                                                   Buffer-menu-buffer-column)
-                                                'buffer) l))
-         (setq m1 (cadr buf)
-               m2 (cadr (cdr buf)))
-         (when m1
-           (delete-char 1)
-           (insert m1)
-           (backward-char 1))
-         (when m2
-           (forward-char 2)
-           (delete-char 1)
-           (insert m2)))
-       (forward-line)))))
-
-(defun Buffer-menu-sort-by-column (&optional e)
-  "Sort the buffer menu by the column clicked on."
-  (interactive (list last-input-event))
-  (if e (mouse-select-window e))
-  (let* ((pos (event-start e))
-        (obj (posn-object pos))
-        (col (if obj
-                 (get-text-property (cdr obj) 'column (car obj))
-               (get-text-property (posn-point pos) 'column))))
-    (Buffer-menu-sort col)))
-
-(defvar Buffer-menu-sort-button-map
-  (let ((map (make-sparse-keymap)))
-    ;; This keymap handles both nil and non-nil values for
-    ;; Buffer-menu-use-header-line.
-    (define-key map [header-line mouse-1] 'Buffer-menu-sort-by-column)
-    (define-key map [header-line mouse-2] 'Buffer-menu-sort-by-column)
-    (define-key map [mouse-2] 'Buffer-menu-sort-by-column)
-    (define-key map [follow-link] 'mouse-face)
-    (define-key map "\C-m" 'Buffer-menu-sort-by-column)
-    map)
-  "Local keymap for Buffer menu sort buttons.")
-
-(defun Buffer-menu-make-sort-button (name column)
-  (if (equal column Buffer-menu-sort-column) (setq column nil))
-  (propertize name
-             'column column
-             'help-echo (concat
-                         (if Buffer-menu-use-header-line
-                             "mouse-1, mouse-2: sort by "
-                           "mouse-2, RET: sort by ")
-                         (if column (downcase name) "visited order"))
-             'mouse-face 'highlight
-             'keymap Buffer-menu-sort-button-map))
-
 (defun list-buffers-noselect (&optional files-only buffer-list)
-  "Create and return a buffer with a list of names of existing buffers.
-The buffer is named `*Buffer List*'.
-Note that buffers with names starting with spaces are omitted.
-Non-null optional arg FILES-ONLY means mention only file buffers.
-
-If BUFFER-LIST is non-nil, it should be a list of buffers;
-it means list those buffers and no others.
-
-For more information, see the function `buffer-menu'."
-  (let* ((old-buffer (current-buffer))
-        (standard-output standard-output)
-        (mode-end (make-string (- Buffer-menu-mode-width 2) ?\s))
-        (header (concat "CRM "
-                        (Buffer-menu-buffer+size
-                         (Buffer-menu-make-sort-button "Buffer" 2)
-                         (Buffer-menu-make-sort-button "Size" 3))
-                        "  "
-                        (Buffer-menu-make-sort-button "Mode" 4) mode-end
-                        (Buffer-menu-make-sort-button "File" 5) "\n"))
-        list desired-point)
-    (when Buffer-menu-use-header-line
-      (let ((pos 0))
-       ;; Turn whitespace chars in the header into stretch specs so
-       ;; they work regardless of the header-line face.
-       (while (string-match "[ \t\n]+" header pos)
-         (setq pos (match-end 0))
-         (put-text-property (match-beginning 0) pos 'display
-                            ;; Assume fixed-size chars in the buffer.
-                            (list 'space :align-to pos)
-                            header)))
-      ;; Try to better align the one-char headers.
-      (put-text-property 0 3 'face 'fixed-pitch header)
-      ;; Add a "dummy" leading space to align the beginning of the header
-      ;; line with the beginning of the text (rather than with the left
-      ;; scrollbar or the left fringe).  --Stef
-      (setq header (concat (propertize " " 'display '(space :align-to 0))
-                          header)))
-    (with-current-buffer (get-buffer-create "*Buffer List*")
-      (setq buffer-read-only nil)
-      (erase-buffer)
-      (setq standard-output (current-buffer))
-      ;; Force L2R direction, to avoid messing the display if the
-      ;; first buffer in the list happens to begin with a strong R2L
-      ;; character.
-      (setq bidi-paragraph-direction 'left-to-right)
-      (unless Buffer-menu-use-header-line
-        ;; Use U+2014 (EM DASH) to underline if possible, else use ASCII
-        ;; (i.e. U+002D, HYPHEN-MINUS).
-       (let ((underline (if (char-displayable-p ?\u2014) ?\u2014 ?-)))
-         (insert header
-                 (apply 'string
-                        (mapcar (lambda (c)
-                                  (if (memq c '(?\n ?\s)) c underline))
-                                header)))))
-      ;; Collect info for every buffer we're interested in.
-      (dolist (buffer (or buffer-list
-                         (buffer-list
-                          (when Buffer-menu-use-frame-buffer-list
-                            (selected-frame)))))
-       (with-current-buffer buffer
-         (let ((name (buffer-name))
-               (file buffer-file-name))
-           (unless (and (not buffer-list)
-                        (or
-                         ;; Don't mention internal buffers.
-                         (and (string= (substring name 0 1) " ") (null file))
-                         ;; Maybe don't mention buffers without files.
-                         (and files-only (not file))
-                         (string= name "*Buffer List*")))
-             ;; Otherwise output info.
-             (let ((mode (concat (format-mode-line mode-name nil nil buffer)
-                                 (if mode-line-process
-                                     (format-mode-line mode-line-process
-                                                       nil nil buffer))))
-                   (bits (string
-                          (if (eq buffer old-buffer) ?. ?\s)
-                          ;; Handle readonly status.  The output buffer
-                          ;; is special cased to appear readonly; it is
-                          ;; actually made so at a later date.
-                          (if (or (eq buffer standard-output)
-                                  buffer-read-only)
-                              ?% ?\s)
-                          ;; Identify modified buffers.
-                          (if (buffer-modified-p) ?* ?\s)
-                          ;; Space separator.
-                          ?\s)))
-               (unless file
-                 ;; No visited file.  Check local value of
-                 ;; list-buffers-directory and, for Info buffers,
-                 ;; Info-current-file.
-                 (cond ((and (boundp 'list-buffers-directory)
-                             list-buffers-directory)
-                        (setq file list-buffers-directory))
-                       ((eq major-mode 'Info-mode)
-                        (setq file Info-current-file)
-                        (cond
-                         ((equal file "dir")
-                          (setq file "*Info Directory*"))
-                         ((eq file 'apropos)
-                          (setq file "*Info Apropos*"))
-                         ((eq file 'history)
-                          (setq file "*Info History*"))
-                         ((eq file 'toc)
-                          (setq file "*Info TOC*"))
-                         ((not (stringp file))  ;; avoid errors
-                          (setq file nil))
-                         (t
-                          (setq file (concat "("
-                                             (file-name-nondirectory file)
-                                             ") "
-                                             Info-current-node)))))))
-               (push (list buffer bits name (buffer-size) mode file)
-                     list))))))
-      ;; Preserve the original buffer-list ordering, just in case.
-      (setq list (nreverse list))
-      ;; Place the buffers's info in the output buffer, sorted if necessary.
-      (dolist (buffer
-              (if Buffer-menu-sort-column
-                  (sort list
-                        (if (eq Buffer-menu-sort-column 3)
-                            (lambda (a b)
-                              (< (nth Buffer-menu-sort-column a)
-                                 (nth Buffer-menu-sort-column b)))
-                          (lambda (a b)
-                            (string< (nth Buffer-menu-sort-column a)
-                                     (nth Buffer-menu-sort-column b)))))
-                list))
-       (if (eq (car buffer) old-buffer)
-           (setq desired-point (point)))
-       (insert (cadr buffer)
-               ;; Put the buffer name into a text property
-               ;; so we don't have to extract it from the text.
-               ;; This way we avoid problems with unusual buffer names.
-               (let ((name (nth 2 buffer))
-                     (size (int-to-string (nth 3 buffer))))
-                 (Buffer-menu-buffer+size name size
-                        `(buffer-name ,name
-                                      buffer ,(car buffer)
-                                      font-lock-face buffer-menu-buffer
-                                      mouse-face highlight
-                                      help-echo
-                                      ,(if (>= (length name)
-                                               (- Buffer-menu-buffer+size-width
-                                                  (max (length size) 3)
-                                                  2))
-                                           name
-                                         "mouse-2: select this buffer"))))
-               "  "
-               (if (> (string-width (nth 4 buffer)) Buffer-menu-mode-width)
-                   (truncate-string-to-width (nth 4 buffer)
-                                             Buffer-menu-mode-width)
-                 (nth 4 buffer)))
-       (when (nth 5 buffer)
-         (indent-to (+ Buffer-menu-buffer-column Buffer-menu-buffer+size-width
-                       Buffer-menu-mode-width 4) 1)
-         (princ (abbreviate-file-name (nth 5 buffer))))
-       (princ "\n"))
+  "Create and return a Buffer Menu buffer.
+This is called by `buffer-menu' and others as a subroutine.
+
+If FILES-ONLY is non-nil, show only file-visiting buffers.
+If BUFFER-LIST is non-nil, it should be a list of buffers; it
+means list those buffers and no others."
+  (let ((old-buffer (current-buffer))
+       (buffer (get-buffer-create "*Buffer List*")))
+    (with-current-buffer buffer
       (Buffer-menu-mode)
-      (when Buffer-menu-use-header-line
-       (setq header-line-format header))
-      ;; DESIRED-POINT doesn't have to be set; it is not when the
-      ;; current buffer is not displayed for some reason.
-      (and desired-point
-          (goto-char desired-point))
-      (setq Buffer-menu-files-only files-only)
-      (setq Buffer-menu--buffers buffer-list)
-      (set-buffer-modified-p nil)
-      (current-buffer))))
+      (setq Buffer-menu-files-only (and files-only (>= files-only 0)))
+      (list-buffers--refresh buffer-list old-buffer)
+      (tabulated-list-print))
+    buffer))
+
+(defun Buffer-menu-mouse-select (event)
+  "Select the buffer whose line you click on."
+  (interactive "e")
+  (select-window (posn-window (event-end event)))
+  (let ((buffer (tabulated-list-get-id (posn-point (event-end event)))))
+    (when (buffer-live-p buffer)
+      (if (and (window-dedicated-p (selected-window))
+              (eq (selected-window) (frame-root-window)))
+         (switch-to-buffer-other-frame buffer)
+       (switch-to-buffer buffer)))))
+
+(defun list-buffers--refresh (&optional buffer-list old-buffer)
+  ;; Set up `tabulated-list-format'.
+  (let ((name-width Buffer-menu-name-width)
+       (size-width Buffer-menu-size-width))
+    ;; Handle obsolete variable:
+    (if Buffer-menu-buffer+size-width
+       (setq name-width (- Buffer-menu-buffer+size-width size-width)))
+    (setq tabulated-list-format
+         (vector '("C" 1 t :pad-right 0)
+                 '("R" 1 t :pad-right 0)
+                 '("M" 1 t)
+                 `("Buffer" ,name-width t)
+                 `("Size" ,size-width tabulated-list-entry-size->
+                           :right-align t)
+                 `("Mode" ,Buffer-menu-mode-width t)
+                 '("File" 1 t))))
+  (setq tabulated-list-use-header-line Buffer-menu-use-header-line)
+  ;; Collect info for each buffer we're interested in.
+  (let ((buffer-menu-buffer (current-buffer))
+       (show-non-file (not Buffer-menu-files-only))
+       entries)
+    (dolist (buffer (or buffer-list
+                       (buffer-list (if Buffer-menu-use-frame-buffer-list
+                                        (selected-frame)))))
+      (with-current-buffer buffer
+       (let* ((name (buffer-name))
+              (file buffer-file-name))
+         (when (and (buffer-live-p buffer)
+                    (or buffer-list
+                        (and (not (string= (substring name 0 1) " "))
+                             (not (eq buffer buffer-menu-buffer))
+                             (or file show-non-file))))
+           (push (list buffer
+                       (vector (if (eq buffer old-buffer) "." " ")
+                               (if buffer-read-only "%" " ")
+                               (if (buffer-modified-p) "*" " ")
+                               (Buffer-menu--pretty-name name)
+                               (number-to-string (buffer-size))
+                               (concat (format-mode-line mode-name nil nil buffer)
+                                       (if mode-line-process
+                                           (format-mode-line mode-line-process
+                                                             nil nil buffer)))
+                               (Buffer-menu--pretty-file-name file)))
+                 entries)))))
+    (setq tabulated-list-entries (nreverse entries)))
+  (tabulated-list-init-header))
+
+(defun tabulated-list-entry-size-> (entry1 entry2)
+  (> (string-to-number (aref (cadr entry1) 4))
+     (string-to-number (aref (cadr entry2) 4))))
+
+(defun Buffer-menu--pretty-name (name)
+  (propertize name
+             'font-lock-face 'buffer-menu-buffer
+             'mouse-face 'highlight))
+
+(defun Buffer-menu--pretty-file-name (file)
+  (cond (file
+        (abbreviate-file-name file))
+       ((and (boundp 'list-buffers-directory)
+             list-buffers-directory)
+        list-buffers-directory)
+       ((eq major-mode 'Info-mode)
+        (Buffer-menu-info-node-description Info-current-file))
+       (t "")))
+
+(defun Buffer-menu-info-node-description (file)
+  (cond
+   ((equal file "dir") "*Info Directory*")
+   ((eq file 'apropos) "*Info Apropos*")
+   ((eq file 'history) "*Info History*")
+   ((eq file 'toc)     "*Info TOC*")
+   ((not (stringp file)) "") ; Avoid errors
+   (t
+    (concat "(" (file-name-nondirectory file) ") " Info-current-node))))
 
 ;;; buff-menu.el ends here
index 96cc74f7ef6f413c47a08b18b6180fe09c0210ee..dfc5dfc65889d5b856fb310069abb546e083751e 100644 (file)
 
 
 (defun math-this-year ()
-  (string-to-number (substring (current-time-string) -4)))
+  (nth 5 (decode-time)))
 
 (defun math-leap-year-p (year)
   (if (Math-lessp year 1752)
index c53f59eb0f41b5294a0a4106e7dd8b4ca9facf20..ec4c497a1c6a6ee552582af708191454b35117cf 100644 (file)
      ( asin       . calcFunc-arcsin )
      ( asinh      . calcFunc-arcsinh )
      ( atan       . calcFunc-arctan )
-     ( atan2      . calcFunc-arctan2 )
-     ( atanh      . calcFunc-arctanh )))
+     ( atan2       . calcFunc-arctan2 )
+     ( atanh       . calcFunc-arctanh )
+     ( fma         . (math-C-parse-fma))
+     ( fmax        . calcFunc-max )
+     ( j0          . (math-C-parse-bess))
+     ( jn          . calcFunc-besJ )
+     ( j1          . (math-C-parse-bess))
+     ( yn          . calcFunc-besY )
+     ( y0          . (math-C-parse-bess))
+     ( y1          . (math-C-parse-bess))
+     ( tgamma      . calcFunc-gamma )))
+
+(defun math-C-parse-bess (f val)
+  "Parse C's j0, j1, y0, y1 functions."
+  (let ((args (math-read-expr-list)))
+    (math-read-token)
+    (append
+     (cond ((eq val 'j0) '(calcFunc-besJ 0))
+           ((eq val 'j1) '(calcFunc-besJ 1))
+           ((eq val 'y0) '(calcFunc-besY 0))
+           ((eq val 'y1) '(calcFunc-besY 1)))
+     args)))
+
+(defun math-C-parse-fma (f val)
+  "Parse C's fma function fma(x,y,z) => (x * y + z)."
+  (let ((args (math-read-expr-list)))
+    (math-read-token)
+    (list 'calcFunc-add
+          (list 'calcFunc-mul
+                (nth 0 args)
+                (nth 1 args))
+          (nth 2 args))))
+
 
 (put 'c 'math-variable-table
   '( ( M_PI       . var-pi )
index dcbf845c3713bc3fbacfc12a02b33272bd40ae2c..e5c7b6737fb3d1bbcc73c691a4700fa0d999de48 100644 (file)
 
 
 (defvar math-additional-units nil
-  "*Additional units table for user-defined units.
+  "Additional units table for user-defined units.
 Must be formatted like `math-standard-units'.
 If you change this, be sure to set `math-units-table' to nil to ensure
 that the combined units table will be rebuilt.")
@@ -356,6 +356,8 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
                                  (math-to-standard-units (calc-top-n 1)
                                                          nil))))))
 
+(defvar calc-ensure-consistent-units)
+
 (defun calc-quick-units ()
   (interactive)
   (calc-slow-wrapper
@@ -370,8 +372,11 @@ Entries are (SYMBOL EXPR DOC-STRING TEMP-TYPE BASE-UNITS).")
      (unless (< pos (length units))
        (error "Unit number %d not defined" pos))
      (if (math-units-in-expr-p expr nil)
-        (calc-enter-result 1 (format "cun%d" num)
-                           (math-convert-units expr (nth pos units)))
+         (progn
+           (if calc-ensure-consistent-units
+               (math-check-unit-consistency expr (nth pos units)))
+           (calc-enter-result 1 (format "cun%d" num)
+                              (math-convert-units expr (nth pos units))))
        (calc-enter-result 1 (format "*un%d" num)
                          (math-simplify-units
                           (math-mul expr (nth pos units))))))))
@@ -477,6 +482,8 @@ If EXPR is nil, return nil."
      (setq units (math-read-expr new-units))
      (when (eq (car-safe units) 'error)
        (error "Bad format in units expression: %s" (nth 2 units)))
+     (if calc-ensure-consistent-units
+         (math-check-unit-consistency expr units))
      (math-put-default-units units)
      (let ((unew (math-units-in-expr-p units t))
           (std (and (eq (car-safe units) 'var)
@@ -560,7 +567,7 @@ If EXPR is nil, return nil."
 (defun calc-extract-units ()
   (interactive)
   (calc-slow-wrapper
-   (calc-enter-result 1 "rmun" (math-simplify-units
+   (calc-enter-result 1 "exun" (math-simplify-units
                                (math-extract-units (calc-top-n 1))))))
 
 ;; The variables calc-num-units and calc-den-units are local to
@@ -914,6 +921,20 @@ If EXPR is nil, return nil."
           (math-single-units-in-expr-p (nth 1 expr))))
        (t 'wrong)))
 
+(defun math-consistent-units-p (expr newunits)
+  "Non-nil if EXPR and NEWUNITS have consistent units."
+  (or
+   (and (eq (car-safe newunits) 'var)
+        (assq (nth 1 newunits) math-standard-units-systems))
+   (math-numberp (math-get-units (list '/ expr newunits)))))
+
+(defun math-check-unit-consistency (expr units)
+  "Give an error if EXPR and UNITS do not have consistent units."
+  (unless  (math-consistent-units-p expr units)
+    (error "New units (%s) are inconsistent with current units (%s)"
+           (math-format-value units)
+           (math-format-value (math-get-units expr)))))
+
 (defun math-check-unit-name (v)
   (and (eq (car-safe v) 'var)
        (or (assq (nth 1 v) (or math-units-table (math-build-units-table)))
index 41cdb491cfa956eb8c9a79dc1de4a7d8cde9ff35..4d64209dd3607ec19c55b000dfc9e9d885f74b49 100644 (file)
 
 
 (defgroup calc nil
-  "GNU Calc."
+  "Advanced desk calculator and mathematical tool."
   :prefix "calc-"
   :tag    "Calc"
   :group  'applications)
@@ -418,6 +418,13 @@ in normal mode."
   :group 'calc
   :type 'boolean)
 
+(defcustom calc-ensure-consistent-units
+  nil
+  "If non-nil, make sure new units are consistent with current units
+when converting units."
+  :group 'calc
+  :type 'boolean)
+
 (defcustom calc-undo-length
   100
   "The number of undo steps that will be preserved when Calc is quit."
@@ -817,7 +824,7 @@ If nil, selections displayed but ignored.")
 Used by `calc-user-invocation'.")
 
 (defcalcmodevar calc-show-banner t
-  "*If non-nil, show a friendly greeting above the stack.")
+  "If non-nil, show a friendly greeting above the stack.")
 
 (defconst calc-local-var-list '(calc-stack
                                calc-stack-top
index 6e935f246a0fbe72793b864f098e3911f18e868b..b1a3f9e075986bdccaf96917a02035fb14282aee 100644 (file)
@@ -43,8 +43,6 @@
 ;;; History:
 ;; I hate history.
 
-(eval-when-compile (require 'cl))
-
 ;;;=====================================================================
 ;;; Customization:
 
@@ -717,17 +715,17 @@ See the documentation for `calculator-mode' for more information."
       (cond
         ((not (get-buffer-window calculator-buffer))
          (let ((window-min-height 2))
-           ;; maybe leave two lines for our window because of the normal
-           ;; `raised' modeline in Emacs 21
+           ;; maybe leave two lines for our window because of the
+           ;; normal `raised' mode line
            (select-window
             (split-window-below
-             ;; If the modeline might interfere with the calculator buffer,
-             ;; use 3 lines instead.
+             ;; If the mode line might interfere with the calculator
+             ;; buffer, use 3 lines instead.
              (if (and (fboundp 'face-attr-construct)
                       (let* ((dh (plist-get (face-attr-construct 'default) :height))
-                             (mf (face-attr-construct 'modeline))
+                             (mf (face-attr-construct 'mode-line))
                              (mh (plist-get mf :height)))
-                        ;; If the modeline is shorter than the default,
+                        ;; If the mode line is shorter than the default,
                         ;; stick with 2 lines.  (It may be necessary to
                         ;; check how much shorter.)
                         (and
@@ -739,7 +737,7 @@ See the documentation for `calculator-mode' for more information."
                                    (not (integerp mh))
                                    (< mh 1))))
                          (or
-                          ;; If the modeline is taller than the default,
+                          ;; If the mode line is taller than the default,
                           ;; use 3 lines.
                           (and (integerp dh)
                                (integerp mh)
@@ -747,7 +745,7 @@ See the documentation for `calculator-mode' for more information."
                           (and (numberp mh)
                                (not (integerp mh))
                                (> mh 1))
-                          ;; If the modeline has a box with non-negative line-width,
+                          ;; If the mode line has a box with non-negative line-width,
                           ;; use 3 lines.
                           (let* ((bx (plist-get mf :box))
                                  (lh (plist-get bx :line-width)))
@@ -755,8 +753,8 @@ See the documentation for `calculator-mode' for more information."
                                  (or
                                   (not lh)
                                   (> lh 0))))
-                          ;; If the modeline has an overline, use 3 lines.
-                          (plist-get (face-attr-construct 'modeline) :overline)))))
+                          ;; If the mode line has an overline, use 3 lines.
+                          (plist-get (face-attr-construct 'mode-line) :overline)))))
                -3 -2)))
            (switch-to-buffer calculator-buffer)))
         ((not (eq (current-buffer) calculator-buffer))
index 8073295a41243b5ea89c0b2b7e862cb7410cdf50..679fae98bc835e48aff49a074293ec9fc3bd813a 100644 (file)
                  (string :tag "Sat"))
   :group 'calendar-html)
 
+(defcustom cal-html-holidays t
+  "If non-nil, include holidays as well as diary entries."
+  :version "24.2"
+  :type 'boolean
+  :group 'calendar-html)
+
 (defcustom cal-html-css-default
   (concat
    "<STYLE TYPE=\"text/css\">\n"
    "  SPAN.NO-YEAR  { color: #0b3; font-weight: bold; }\n"
    "  SPAN.ANN      { color: #0bb; font-weight: bold; }\n"
    "  SPAN.BLOCK    { color: #048; font-style: italic; }\n"
+   "  SPAN.HOLIDAY  { color: #f00; font-weight: bold; }\n"
    "</STYLE>\n\n")
   "Default cal-html css style.  You can override this with a \"cal.css\" file."
   :type 'string
+  :version "24.2"                       ; added SPAN.HOLIDAY
   :group 'calendar-html)
 
 ;;; End customizable variables.
@@ -227,6 +235,8 @@ Contains links to previous and next month and year, and current minical."
 ;;------------------------------------------------------------
 ;; minical: a small month calendar with links
 ;;------------------------------------------------------------
+(autoload 'holiday-in-range "holidays")
+
 (defun cal-html-insert-minical (month year)
   "Insert a minical for numeric MONTH of YEAR."
   (let* ((blank-days                    ; at start of month
@@ -313,10 +323,12 @@ Characters are replaced according to `cal-html-html-subst-list'."
     ""))
 
 
-(defun cal-html-htmlify-entry (entry)
-  "Convert a diary entry ENTRY to html with the appropriate class specifier."
+(defun cal-html-htmlify-entry (entry &optional class)
+  "Convert a diary entry ENTRY to html with the appropriate class specifier.
+Optional argument CLASS is the class specifier to use."
   (let ((start
          (cond
+          (class)
           ((string-match "block" (nth 2 entry)) "BLOCK")
           ((string-match "anniversary" (nth 2 entry)) "ANN")
           ((not (string-match
@@ -328,10 +340,12 @@ Characters are replaced according to `cal-html-html-subst-list'."
             (cal-html-htmlify-string (cadr entry)))))
 
 
-(defun cal-html-htmlify-list (date-list date)
+(defun cal-html-htmlify-list (date-list date &optional holidays)
   "Return a string of concatenated, HTML-ified diary entries.
-DATE-LIST is a list of diary entries.  Return only those matching DATE."
-  (mapconcat (lambda (x) (cal-html-htmlify-entry x))
+DATE-LIST is a list of diary entries.  Return only those matching DATE.
+Optional argument HOLIDAYS non-nil means the input is actually a list
+of holidays, rather than diary entries."
+  (mapconcat (lambda (x) (cal-html-htmlify-entry x (if holidays "HOLIDAY")))
              (let (result)
                (dolist (p date-list (reverse result))
                  (and (car p)
@@ -351,11 +365,11 @@ DATE-LIST is a list of diary entries.  Return only those matching DATE."
   (diary-list-entries (calendar-gregorian-from-absolute d1)
                       (1+ (- d2 d1)) t))
 
-
-(defun cal-html-insert-agenda-days (month year diary-list)
+(defun cal-html-insert-agenda-days (month year diary-list holiday-list)
   "Insert HTML commands for a range of days in monthly calendars.
 HTML commands are inserted for the days of the numeric MONTH in
-four-digit YEAR.  Diary entries in DIARY-LIST are included."
+four-digit YEAR.  Includes diary entries in DIARY-LIST, and
+holidays in HOLIDAY-LIST."
   (let ((blank-days                     ; at start of month
          (mod (- (calendar-day-of-week (list month 1 year))
                  calendar-week-start-day)
@@ -381,6 +395,8 @@ four-digit YEAR.  Diary entries in DIARY-LIST are included."
        cal-html-e-tableheader-string
        ;; Diary entries.
        cal-html-b-tabledata-string
+       (cal-html-htmlify-list holiday-list date t)
+       (and holiday-list diary-list "<BR>\n")
        (cal-html-htmlify-list diary-list date)
        cal-html-e-tabledata-string
        cal-html-e-tablerow-string)
@@ -395,16 +411,17 @@ four-digit YEAR.  Diary entries in DIARY-LIST are included."
 
 (defun cal-html-one-month (month year dir)
   "Write an HTML calendar file for numeric MONTH of YEAR in directory DIR."
-  (let ((diary-list (cal-html-list-diary-entries
-                     (calendar-absolute-from-gregorian (list month 1 year))
-                     (calendar-absolute-from-gregorian
+  (let* ((d1 (calendar-absolute-from-gregorian (list month 1 year)))
+         (d2 (calendar-absolute-from-gregorian
                       (list month
                             (calendar-last-day-of-month month year)
-                            year)))))
+                            year)))
+         (diary-list (cal-html-list-diary-entries d1 d2))
+         (holiday-list (if cal-html-holidays (holiday-in-range d1 d2))))
     (with-temp-buffer
       (insert cal-html-b-document-string)
       (cal-html-insert-month-header month year)
-      (cal-html-insert-agenda-days month year diary-list)
+      (cal-html-insert-agenda-days month year diary-list holiday-list)
       (insert cal-html-e-document-string)
       (write-file (expand-file-name
                    (cal-html-monthpage-name month year) dir)))))
index 14899431e2a743ad4994651e78f06491d26a3c14..2452f44448ce7293222fb9fc69a73e44f862e260 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
 
-;; Copyright (C) 1995, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: Steve Fisk <fisk@bowdoin.edu>
 ;;         Edward M. Reingold <reingold@cs.uiuc.edu>
@@ -237,31 +237,9 @@ The names are taken from `calendar-day-name-array'.")
   "LaTeX code to insert one box with date info in calendar.
 This definition is the heart of the calendar!")
 
-(autoload 'calendar-holiday-list "holidays")
-
-(defun cal-tex-list-holidays (d1 d2)
-  "Generate a list of all holidays from absolute date D1 to D2."
-  (let* ((start (calendar-gregorian-from-absolute d1))
-         (displayed-month (calendar-extract-month start))
-         (displayed-year (calendar-extract-year start))
-         (end (calendar-gregorian-from-absolute d2))
-         (end-month (calendar-extract-month end))
-         (end-year (calendar-extract-year end))
-         (number-of-intervals
-          (1+ (/ (calendar-interval displayed-month displayed-year
-                                    end-month end-year)
-                 3)))
-         holidays in-range a)
-    (calendar-increment-month displayed-month displayed-year 1)
-    (dotimes (_idummy number-of-intervals)
-      (setq holidays (append holidays (calendar-holiday-list)))
-      (calendar-increment-month displayed-month displayed-year 3))
-    (dolist (hol holidays)
-      (and (car hol)
-           (setq a (calendar-absolute-from-gregorian (car hol)))
-           (and (<= d1 a) (<= a d2))
-           (setq in-range (append (list hol) in-range))))
-    in-range))
+(autoload 'holiday-in-range "holidays")
+
+(define-obsolete-function-alias 'cal-tex-list-holidays 'holiday-in-range "24.2")
 
 (autoload 'diary-list-entries "diary-lib")
 
@@ -446,7 +424,7 @@ Optional EVENT indicates a buffer position to use instead of point."
                       (calendar-last-day-of-month end-month end-year)
                       end-year))))
          (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2)))
-         (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2)))
+         (holidays (if cal-tex-holidays (holiday-in-range d1 d2)))
          other-month other-year small-months-at-start)
     (cal-tex-insert-preamble (cal-tex-number-weeks month year 1) t "12pt")
     (cal-tex-cmd cal-tex-cal-one-month)
@@ -516,7 +494,7 @@ indicates a buffer position to use instead of point."
                       (calendar-last-day-of-month end-month end-year)
                       end-year))))
          (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2)))
-         (holidays (if cal-tex-holidays (cal-tex-list-holidays d1 d2))))
+         (holidays (if cal-tex-holidays (holiday-in-range d1 d2))))
     (cal-tex-insert-preamble (cal-tex-number-weeks month year n) nil "12pt")
     (if (> n 1)
         (cal-tex-cmd cal-tex-cal-multi-month)
@@ -697,7 +675,7 @@ entries are not shown).  The calendar shows the hours 8-12am, 1-5pm."
          (d1 (calendar-absolute-from-gregorian date))
          (d2 (+ (* 7 n) d1))
          (holidays (if cal-tex-holidays
-                       (cal-tex-list-holidays d1 d2))))
+                       (holiday-in-range d1 d2))))
     (cal-tex-preamble "11pt")
     (cal-tex-cmd "\\textwidth   6.5in")
     (cal-tex-cmd "\\textheight 10.5in")
@@ -752,7 +730,7 @@ Optional EVENT indicates a buffer position to use instead of point."
          (d1 (calendar-absolute-from-gregorian date))
          (d2 (+ (* 7 n) d1))
          (holidays (if cal-tex-holidays
-                       (cal-tex-list-holidays d1 d2))))
+                       (holiday-in-range d1 d2))))
     (cal-tex-preamble "12pt")
     (cal-tex-cmd "\\textwidth   6.5in")
     (cal-tex-cmd "\\textheight 10.5in")
@@ -836,7 +814,7 @@ position to use instead of point."
          (d1 (calendar-absolute-from-gregorian date))
          (d2 (+ (* 7 n) d1))
          (holidays (if cal-tex-holidays
-                       (cal-tex-list-holidays d1 d2)))
+                       (holiday-in-range d1 d2)))
          (diary-list (if cal-tex-diary
                          (cal-tex-list-diary-entries
                           ;; FIXME d1?
@@ -1052,7 +1030,7 @@ Optional EVENT indicates a buffer position to use instead of point."
          (d1 (calendar-absolute-from-gregorian date))
          (d2 (+ (* 7 n) d1))
          (holidays (if cal-tex-holidays
-                       (cal-tex-list-holidays d1 d2)))
+                       (holiday-in-range d1 d2)))
          (diary-list (if cal-tex-diary
                          (cal-tex-list-diary-entries
                           ;; FIXME d1?
@@ -1149,7 +1127,7 @@ Optional EVENT indicates a buffer position to use instead of point."
          (d1 (calendar-absolute-from-gregorian date))
          (d2 (+ (* 7 n) d1))
          (holidays (if cal-tex-holidays
-                       (cal-tex-list-holidays d1 d2)))
+                       (holiday-in-range d1 d2)))
          (diary-list (if cal-tex-diary
                          (cal-tex-list-diary-entries
                           ;; FIXME d1?
@@ -1292,7 +1270,7 @@ Optional EVENT indicates a buffer position to use instead of point."
          (d1 (calendar-absolute-from-gregorian date))
          (d2 (+ (* 7 n) d1))
          (holidays (if cal-tex-holidays
-                       (cal-tex-list-holidays d1 d2)))
+                       (holiday-in-range d1 d2)))
          (diary-list (if cal-tex-diary
                          (cal-tex-list-diary-entries
                           ;; FIXME d1?
@@ -1588,8 +1566,7 @@ informative header, and run HOOK."
   (cal-tex-e-document)
   (or (and cal-tex-preamble-extra
            (string-match "inputenc" cal-tex-preamble-extra))
-      (not (re-search-backward "[^[:ascii:]]" nil 'move))
-      (progn
+      (when (re-search-backward "[^[:ascii:]]" nil 'move)
         (goto-char (point-min))
         (when (search-forward "documentclass" nil t)
           (forward-line 1)
index d9ec27b4f88f4502024dd46c57e1f98647406805..d5514d14a32f8c3cbfe76cec64a5424d94c7980e 100644 (file)
@@ -1105,14 +1105,14 @@ inclusive.  The standard macro `dotimes' is preferable in most cases."
             ,index (1+ ,index)))
     sum))
 
-;; FIXME bind q to bury-buffer?
 (defmacro calendar-in-read-only-buffer (buffer &rest body)
-  "Switch to BUFFER and executes the forms in BODY.
+  "Switch to BUFFER and execute the forms in BODY.
 First creates or erases BUFFER as needed.  Leaves BUFFER read-only,
 with disabled undo.  Leaves point at point-min, displays BUFFER."
   (declare (indent 1) (debug t))
   `(progn
      (set-buffer (get-buffer-create ,buffer))
+     (or (derived-mode-p 'special-mode) (special-mode))
      (setq buffer-read-only nil
            buffer-undo-list t)
      (erase-buffer)
@@ -1793,19 +1793,6 @@ the STRINGS are just concatenated and the result truncated."
                          ?\s (- calendar-right-margin (1- start))))))
         (force-mode-line-update))))
 
-(defun calendar-window-list ()
-  "List of all calendar-related windows."
-  (let ((calendar-buffers (calendar-buffer-list))
-        list)
-    ;; Using 0 rather than t for last argument - see bug#2199.
-    ;; This is only used with calendar-hide-window, which ignores
-    ;; iconified frames anyway, so could use 'visible rather than 0.
-    (walk-windows (lambda (w)
-                    (if (memq (window-buffer w) calendar-buffers)
-                        (push w list)))
-                  nil 0)
-    list))
-
 (defun calendar-buffer-list ()
   "List of all calendar-related buffers (as buffers, not strings)."
   (let (buffs)
@@ -1817,41 +1804,30 @@ the STRINGS are just concatenated and the result truncated."
            (push b buffs)))
     buffs))
 
-(defun calendar-exit ()
+(defun calendar-exit (&optional kill)
   "Get out of the calendar window and hide it and related buffers."
-  (interactive)
-  (let ((diary-buffer (get-file-buffer diary-file)))
-    (if (or (not diary-buffer)
-            (not (buffer-modified-p diary-buffer))
-            (yes-or-no-p
-             "Diary modified; do you really want to exit the calendar? "))
-        ;; Need to do this multiple times because one time can replace some
-        ;; calendar-related buffers with other calendar-related buffers.
-        (mapc (lambda (x)
-                (mapc 'calendar-hide-window (calendar-window-list)))
-              (calendar-window-list)))))
+  (interactive "P")
+  (let ((diary-buffer (get-file-buffer diary-file))
+        (calendar-buffers (calendar-buffer-list)))
+    (when (or (not diary-buffer)
+              (not (buffer-modified-p diary-buffer))
+              (yes-or-no-p
+               "Diary modified; do you really want to exit the calendar? "))
+      (if (and calendar-setup (display-multi-frame-p))
+          ;; FIXME: replace this cruft with the `quit-restore' window property
+          (dolist (w (window-list-1 nil nil t))
+            (if (and (memq (window-buffer w) calendar-buffers)
+                     (window-dedicated-p w))
+                (if (eq (window-deletable-p w) 'frame)
+                   (if calendar-remove-frame-by-deleting
+                       (delete-frame (window-frame w))
+                     (iconify-frame (window-frame w)))
+                 (quit-window kill w))))
+        (dolist (b calendar-buffers)
+          (quit-windows-on b kill))))))
 
 (define-obsolete-function-alias 'exit-calendar 'calendar-exit "23.1")
 
-(defun calendar-hide-window (window)
-  "Hide WINDOW if it is calendar-related."
-  (let ((buffer (if (window-live-p window) (window-buffer window))))
-    (if (memq buffer (calendar-buffer-list))
-        (cond
-         ((and (display-multi-frame-p)
-               (eq 'icon (cdr (assoc 'visibility
-                                     (frame-parameters
-                                      (window-frame window))))))
-          nil)
-         ((and (display-multi-frame-p) (window-dedicated-p window))
-          (if calendar-remove-frame-by-deleting
-              (delete-frame (window-frame window))
-              (iconify-frame (window-frame window))))
-         ((not (and (select-window window) (one-window-p window)))
-          (delete-window window))
-         (t (set-buffer buffer)
-            (bury-buffer))))))
-
 (defun calendar-current-date (&optional offset)
   "Return the current date in a list (month day year).
 Optional integer OFFSET is a number of days from the current date."
@@ -1888,7 +1864,7 @@ use instead of point."
         ;; or on or before the digit of a 1-digit date.
         (if (not (and (looking-at "[ 0-9]?[0-9][^0-9]")
                       (get-text-property (point) 'date)))
-            (if error (error "Not on a date!"))
+            (if error (user-error "Not on a date!"))
           ;; Convert segment to real month and year.
           (if (zerop month) (setq month 12))
           ;; Go back to before the first date digit.
@@ -1903,8 +1879,6 @@ use instead of point."
                  ((and (= 1 month) (= segment 2)) (1+ displayed-year))
                  (t displayed-year))))))))
 
-(add-to-list 'debug-ignored-errors "Not on a date!")
-
 ;; The following version of calendar-gregorian-from-absolute is preferred for
 ;; reasons of clarity, BUT it's much slower than the version that follows it.
 
index 9edd353b889035cc4913236587e09f84f7e8556e..0bb3c23184020d4d48aa99b5e9de7b648e5e47c8 100644 (file)
@@ -645,6 +645,33 @@ strings describing those holidays that apply on DATE, or nil if none do."
 (define-obsolete-function-alias
   'check-calendar-holidays 'calendar-check-holidays "23.1")
 
+
+;; Formerly cal-tex-list-holidays.
+(defun holiday-in-range (d1 d2)
+  "Generate a list of all holidays in range from absolute date D1 to D2."
+  (let* ((start (calendar-gregorian-from-absolute d1))
+         (displayed-month (calendar-extract-month start))
+         (displayed-year (calendar-extract-year start))
+         (end (calendar-gregorian-from-absolute d2))
+         (end-month (calendar-extract-month end))
+         (end-year (calendar-extract-year end))
+         (number-of-intervals
+          (1+ (/ (calendar-interval displayed-month displayed-year
+                                    end-month end-year)
+                 3)))
+         holidays in-range a)
+    (calendar-increment-month displayed-month displayed-year 1)
+    (dotimes (_idummy number-of-intervals)
+      (setq holidays (append holidays (calendar-holiday-list)))
+      (calendar-increment-month displayed-month displayed-year 3))
+    (dolist (hol holidays)
+      (and (car hol)
+           (setq a (calendar-absolute-from-gregorian (car hol)))
+           (and (<= d1 a) (<= a d2))
+           (setq in-range (append (list hol) in-range))))
+    in-range))
+
+
 (declare-function x-popup-menu "menu.c" (position menu))
 
 ;;;###cal-autoload
index f1549ec20b1d3031684a620b472b516bc5d9cdba..7326aa530adbb9daa95e24b14ca1547a2761609d 100644 (file)
@@ -130,6 +130,7 @@ In case of a formatting STRING the following specifiers can be used:
 %s Summary, see `icalendar-import-format-summary'
 %t Status, see `icalendar-import-format-status'
 %u URL, see `icalendar-import-format-url'
+%U UID, see `icalendar-import-format-uid'
 
 A formatting FUNCTION will be called with a VEVENT as its only
 argument.  It must return a string.  See
@@ -179,6 +180,14 @@ the URL."
   :type 'string
   :group 'icalendar)
 
+(defcustom icalendar-import-format-uid
+  "\n UID: %s"
+  "Format string defining how the UID element is formatted.
+This applies only if the UID is not empty! `%s' is replaced by
+the UID."
+  :type 'string
+  :group 'icalendar)
+
 (defcustom icalendar-import-format-status
   "\n Status: %s"
   "Format string defining how the status element is formatted.
@@ -491,7 +500,8 @@ The strings are suitable for assembling into a TZ variable."
 (defun icalendar--parse-vtimezone (alist)
   "Turn a VTIMEZONE ALIST into a cons (ID . TZ-STRING).
 Return nil if timezone cannot be parsed."
-  (let* ((tz-id (icalendar--get-event-property alist 'TZID))
+  (let* ((tz-id (icalendar--convert-string-for-import
+                 (icalendar--get-event-property alist 'TZID)))
         (daylight (cadr (cdar (icalendar--get-children alist 'DAYLIGHT))))
         (day (and daylight (icalendar--convert-tz-offset daylight t)))
         (standard (cadr (cdar (icalendar--get-children alist 'STANDARD))))
@@ -1017,7 +1027,8 @@ FExport diary data into iCalendar file: ")
                     (org (cdr (assoc 'org other-elements)))
                     (sta (cdr (assoc 'sta other-elements)))
                     (sum (cdr (assoc 'sum other-elements)))
-                    (url (cdr (assoc 'url other-elements))))
+                    (url (cdr (assoc 'url other-elements)))
+                    (uid (cdr (assoc 'uid other-elements))))
                 (if cla
                     (setq contents (concat contents "\nCLASS:" cla)))
                 (if des
@@ -1031,10 +1042,12 @@ FExport diary data into iCalendar file: ")
                 ;;(if sum
                 ;;    (setq contents (concat contents "\nSUMMARY:" sum)))
                 (if url
-                    (setq contents (concat contents "\nURL:" url))))
+                    (setq contents (concat contents "\nURL:" url)))
 
-             (setq header (concat "\nBEGIN:VEVENT\nUID:"
-                                  (icalendar--create-uid entry-full contents)))
+                (setq header (concat "\nBEGIN:VEVENT\nUID:"
+                                     (or uid
+                                         (icalendar--create-uid entry-full 
+                                                                contents)))))
               (setq result (concat result header contents "\nEND:VEVENT")))
           ;; handle errors
           (error
@@ -1098,7 +1111,8 @@ Returns an alist."
         ;; can't do anything
         nil
       ;; split summary-and-rest
-      (let* ((s icalendar-import-format)
+      (let* ((case-fold-search nil)
+             (s icalendar-import-format)
              (p-cla (or (string-match "%c" icalendar-import-format) -1))
              (p-des (or (string-match "%d" icalendar-import-format) -1))
              (p-loc (or (string-match "%l" icalendar-import-format) -1))
@@ -1106,9 +1120,10 @@ Returns an alist."
              (p-sum (or (string-match "%s" icalendar-import-format) -1))
              (p-sta (or (string-match "%t" icalendar-import-format) -1))
              (p-url (or (string-match "%u" icalendar-import-format) -1))
-             (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url) '<))
+             (p-uid (or (string-match "%U" icalendar-import-format) -1))
+             (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url p-uid) '<))
             (ct 0)
-             pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url)
+             pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url pos-uid)
         (dotimes (i (length p-list))
          ;; Use 'ct' to keep track of current position in list
           (cond ((and (>= p-cla 0) (= (nth i p-list) p-cla))
@@ -1131,7 +1146,10 @@ Returns an alist."
                  (setq pos-sum (* 2 ct)))
                 ((and (>= p-url 0) (= (nth i p-list) p-url))
                 (setq ct (+ ct 1))
-                 (setq pos-url (* 2 ct)))) )
+                 (setq pos-url (* 2 ct)))
+                ((and (>= p-uid 0) (= (nth i p-list) p-uid))
+                (setq ct (+ ct 1))
+                 (setq pos-uid (* 2 ct)))) )
         (mapc (lambda (ij)
                 (setq s (icalendar--rris (car ij) (cadr ij) s t t)))
               (list
@@ -1149,13 +1167,15 @@ Returns an alist."
                (list "%t"
                      (concat "\\(" icalendar-import-format-status "\\)??"))
                (list "%u"
-                     (concat "\\(" icalendar-import-format-url "\\)??"))))
+                     (concat "\\(" icalendar-import-format-url "\\)??"))
+               (list "%U"
+                     (concat "\\(" icalendar-import-format-uid "\\)??"))))
        ;; Need the \' regexp in order to detect multi-line items
         (setq s (concat "\\`"
                           (icalendar--rris "%s" "\\(.*?\\)" s nil t)
                         "\\'"))
         (if (string-match s summary-and-rest)
-            (let (cla des loc org sta sum url)
+            (let (cla des loc org sta sum url uid)
               (if (and pos-sum (match-beginning pos-sum))
                   (setq sum (substring summary-and-rest
                                        (match-beginning pos-sum)
@@ -1184,13 +1204,18 @@ Returns an alist."
                   (setq url (substring summary-and-rest
                                        (match-beginning pos-url)
                                        (match-end pos-url))))
+              (if (and pos-uid (match-beginning pos-uid))
+                  (setq uid (substring summary-and-rest
+                                       (match-beginning pos-uid)
+                                       (match-end pos-uid))))
               (list (if cla (cons 'cla cla) nil)
                     (if des (cons 'des des) nil)
                     (if loc (cons 'loc loc) nil)
                     (if org (cons 'org org) nil)
                     (if sta (cons 'sta sta) nil)
                     ;;(if sum (cons 'sum sum) nil)
-                    (if url (cons 'url url) nil))))))))
+                    (if url (cons 'url url) nil)
+                    (if uid (cons 'uid uid) nil))))))))
 
 ;; subroutines for icalendar-export-region
 (defun icalendar--convert-ordinary-to-ical (nonmarker entry-main)
@@ -1864,6 +1889,7 @@ buffer `*icalendar-errors*'."
   (if (functionp icalendar-import-format)
       (funcall icalendar-import-format event)
     (let ((string icalendar-import-format)
+          (case-fold-search nil)
         (conversion-list
          '(("%c" CLASS       icalendar-import-format-class)
            ("%d" DESCRIPTION icalendar-import-format-description)
@@ -1871,7 +1897,8 @@ buffer `*icalendar-errors*'."
            ("%o" ORGANIZER   icalendar-import-format-organizer)
            ("%s" SUMMARY     icalendar-import-format-summary)
            ("%t" STATUS      icalendar-import-format-status)
-           ("%u" URL         icalendar-import-format-url))))
+           ("%u" URL         icalendar-import-format-url)
+           ("%U" UID         icalendar-import-format-uid))))
     ;; convert the specifiers in the format string
     (mapc (lambda (i)
            (let* ((spec (car i))
index baf920655503e4aea625e65057073f167dec46b4..f8f4c7b3fac646704aed5b1bae04e86b12f9a6c7 100644 (file)
@@ -34,7 +34,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))      ;and ah ain't kiddin' 'bout it
+(eval-when-compile (require 'cl-lib))
 
 (defvar parse-time-digits (make-vector 256 nil))
 
@@ -43,8 +43,8 @@
 (defvar parse-time-val)
 
 (unless (aref parse-time-digits ?0)
-  (loop for i from ?0 to ?9
-    do (aset parse-time-digits i (- i ?0))))
+  (cl-loop for i from ?0 to ?9
+           do (aset parse-time-digits i (- i ?0))))
 
 (defsubst digit-char-p (char)
   (aref parse-time-digits char))
        (index 0)
        (c nil))
     (while (< index end)
-      (while (and (< index end)                ;skip invalid characters
+      (while (and (< index end)                ;Skip invalid characters.
                  (not (setq c (parse-time-string-chars (aref string index)))))
-       (incf index))
+       (cl-incf index))
       (setq start index all-digits (eq c ?0))
-      (while (and (< (incf index) end) ;scan valid characters
+      (while (and (< (cl-incf index) end)      ;Scan valid characters.
                  (setq c (parse-time-string-chars (aref string index))))
        (setq all-digits (and all-digits (eq c ?0))))
       (if (<= index end)
index 46e38ae46a80104ff1ccaf5cd9281f612e3ea276..38b766084c91ecd9b2b42d217e89bff21631cb79 100644 (file)
 
 ;;; Commentary:
 
-;; Time values come in three formats.  The oldest format is a cons
+;; Time values come in several formats.  The oldest format is a cons
 ;; cell of the form (HIGH . LOW).  This format is obsolete, but still
-;; supported.  The two other formats are the lists (HIGH LOW) and
-;; (HIGH LOW MICRO).  The first two formats specify HIGH * 2^16 + LOW
-;; seconds; the third format specifies HIGH * 2^16 + LOW + MICRO /
-;; 1000000 seconds.  We should have 0 <= MICRO < 1000000 and 0 <= LOW
-;; < 2^16.  If the time value represents a point in time, then HIGH is
-;; nonnegative.  If the time value is a time difference, then HIGH can
-;; be negative as well.  The macro `with-decoded-time-value' and the
+;; supported.  The other formats are the lists (HIGH LOW), (HIGH LOW
+;; USEC), and (HIGH LOW USEC PSEC).  These formats specify the time
+;; value equal to HIGH * 2^16 + LOW + USEC * 10^-6 + PSEC * 10^-12
+;; seconds, where missing components are treated as zero.  HIGH can be
+;; negative, either because the value is a time difference, or because
+;; the machine supports negative time stamps that fall before the
+;; epoch.  The macro `with-decoded-time-value' and the
 ;; function `encode-time-value' make it easier to deal with these
 ;; three formats.  See `time-subtract' for an example of how to use
 ;; them.
 The value of the last form in BODY is returned.
 
 Each element of the list VARLIST is a list of the form
-\(HIGH-SYMBOL LOW-SYMBOL MICRO-SYMBOL [TYPE-SYMBOL] TIME-VALUE).
+\(HIGH-SYMBOL LOW-SYMBOL MICRO-SYMBOL [PICO-SYMBOL [TYPE-SYMBOL]] TIME-VALUE).
 The time value TIME-VALUE is decoded and the result it bound to
 the symbols HIGH-SYMBOL, LOW-SYMBOL and MICRO-SYMBOL.
+The optional PICO-SYMBOL is bound to the picoseconds part.
 
 The optional TYPE-SYMBOL is bound to the type of the time value.
 Type 0 is the cons cell (HIGH . LOW), type 1 is the list (HIGH
-LOW), and type 2 is the list (HIGH LOW MICRO)."
+LOW), type 2 is the list (HIGH LOW MICRO), and type 3 is the
+list (HIGH LOW MICRO PICO)."
   (declare (indent 1)
           (debug ((&rest (symbolp symbolp symbolp &or [symbolp form] form))
                   body)))
@@ -59,6 +61,8 @@ LOW), and type 2 is the list (HIGH LOW MICRO)."
             (high (pop elt))
             (low (pop elt))
             (micro (pop elt))
+            (pico (unless (<= (length elt) 2)
+                    (pop elt)))
             (type (unless (eq (length elt) 1)
                     (pop elt)))
             (time-value (car elt))
@@ -66,28 +70,44 @@ LOW), and type 2 is the list (HIGH LOW MICRO)."
        `(let* ,(append `((,gensym ,time-value)
                          (,high (pop ,gensym))
                          ,low ,micro)
+                       (when pico `(,pico))
                        (when type `(,type)))
           (if (consp ,gensym)
               (progn
                 (setq ,low (pop ,gensym))
                 (if ,gensym
-                    ,(append `(setq ,micro (car ,gensym))
-                             (when type `(,type 2)))
+                    (progn
+                      (setq ,micro (car ,gensym))
+                      ,(cond (pico
+                              `(if (cdr ,gensym)
+                                   ,(append `(setq ,pico (cadr ,gensym))
+                                            (when type `(,type 3)))
+                                 ,(append `(setq ,pico 0)
+                                          (when type `(,type 2)))))
+                             (type
+                              `(setq type 2))))
                   ,(append `(setq ,micro 0)
+                           (when pico `(,pico 0))
                            (when type `(,type 1)))))
             ,(append `(setq ,low ,gensym ,micro 0)
+                     (when pico `(,pico 0))
                      (when type `(,type 0))))
           (with-decoded-time-value ,varlist ,@body)))
     `(progn ,@body)))
 
-(defun encode-time-value (high low micro type)
-  "Encode HIGH, LOW, and MICRO into a time value of type TYPE.
+(defun encode-time-value (high low micro pico &optional type)
+  "Encode HIGH, LOW, MICRO, and PICO into a time value of type TYPE.
 Type 0 is the cons cell (HIGH . LOW), type 1 is the list (HIGH LOW),
-and type 2 is the list (HIGH LOW MICRO)."
+type 2 is (HIGH LOW MICRO), and type 3 is (HIGH LOW MICRO PICO).
+
+For backward compatibility, if only four arguments are given,
+it is assumed that PICO was omitted and should be treated as zero."
   (cond
    ((eq type 0) (cons high low))
    ((eq type 1) (list high low))
-   ((eq type 2) (list high low micro))))
+   ((eq type 2) (list high low micro))
+   ((eq type 3) (list high low micro pico))
+   ((null type) (encode-time-value high low micro 0 pico))))
 
 (autoload 'parse-time-string "parse-time")
 (autoload 'timezone-make-date-arpa-standard "timezone")
@@ -125,28 +145,45 @@ If DATE lacks timezone information, GMT is assumed."
            (subrp (symbol-function 'float-time)))
       (defun time-to-seconds (time)
         "Convert time value TIME to a floating point number."
-        (with-decoded-time-value ((high low micro time))
+        (with-decoded-time-value ((high low micro pico type time))
           (+ (* 1.0 high 65536)
              low
-             (/ micro 1000000.0))))))
+            (/ (+ (* micro 1e6) pico) 1e12))))))
 
 ;;;###autoload
 (defun seconds-to-time (seconds)
   "Convert SECONDS (a floating point number) to a time value."
-  (list (floor seconds 65536)
-       (floor (mod seconds 65536))
-       (floor (* (- seconds (ffloor seconds)) 1000000))))
+  (let* ((usec (* 1000000 (mod seconds 1)))
+        (ps (round (* 1000000 (mod usec 1))))
+        (us (floor usec))
+        (lo (floor (mod seconds 65536)))
+        (hi (floor seconds 65536)))
+    (if (eq ps 1000000)
+       (progn
+         (setq ps 0)
+         (setq us (1+ us))
+         (if (eq us 1000000)
+             (progn
+               (setq us 0)
+               (setq lo (1+ lo))
+               (if (eq lo 65536)
+                   (progn
+                     (setq lo 0)
+                     (setq hi (1+ hi))))))))
+    (list hi lo us ps)))
 
 ;;;###autoload
 (defun time-less-p (t1 t2)
   "Return non-nil if time value T1 is earlier than time value T2."
-  (with-decoded-time-value ((high1 low1 micro1 t1)
-                           (high2 low2 micro2 t2))
+  (with-decoded-time-value ((high1 low1 micro1 pico1 type1 t1)
+                           (high2 low2 micro2 pico2 type2 t2))
     (or (< high1 high2)
        (and (= high1 high2)
             (or (< low1 low2)
                 (and (= low1 low2)
-                     (< micro1 micro2)))))))
+                     (or (< micro1 micro2)
+                         (and (= micro1 micro2)
+                              (< pico1 pico2)))))))))
 
 ;;;###autoload
 (defun days-to-time (days)
@@ -173,36 +210,44 @@ TIME should be either a time value or a date-time string."
 (defun time-subtract (t1 t2)
   "Subtract two time values, T1 minus T2.
 Return the difference in the format of a time value."
-  (with-decoded-time-value ((high low micro type t1)
-                           (high2 low2 micro2 type2 t2))
+  (with-decoded-time-value ((high low micro pico type t1)
+                           (high2 low2 micro2 pico2 type2 t2))
     (setq high (- high high2)
          low (- low low2)
          micro (- micro micro2)
+         pico (- pico pico2)
          type (max type type2))
+    (when (< pico 0)
+      (setq micro (1- micro)
+           pico (+ pico 1000000)))
     (when (< micro 0)
       (setq low (1- low)
            micro (+ micro 1000000)))
     (when (< low 0)
       (setq high (1- high)
            low (+ low 65536)))
-    (encode-time-value high low micro type)))
+    (encode-time-value high low micro pico type)))
 
 ;;;###autoload
 (defun time-add (t1 t2)
   "Add two time values T1 and T2.  One should represent a time difference."
-  (with-decoded-time-value ((high low micro type t1)
-                           (high2 low2 micro2 type2 t2))
+  (with-decoded-time-value ((high low micro pico type t1)
+                           (high2 low2 micro2 pico2 type2 t2))
     (setq high (+ high high2)
          low (+ low low2)
          micro (+ micro micro2)
+         pico (+ pico pico2)
          type (max type type2))
+    (when (>= pico 1000000)
+      (setq micro (1+ micro)
+           pico (- pico 1000000)))
     (when (>= micro 1000000)
       (setq low (1+ low)
            micro (- micro 1000000)))
     (when (>= low 65536)
       (setq high (1+ high)
            low (- low 65536)))
-    (encode-time-value high low micro type)))
+    (encode-time-value high low micro pico type)))
 
 ;;;###autoload
 (defun date-to-day (date)
index 7f9b46dfd82466c44cde237b13b362d6cf972da9..8ca14b37d708451dff59fd2e79c506ffd7431daa 100644 (file)
 ;;   (define-key ctl-x-map "to" 'timeclock-out)
 ;;   (define-key ctl-x-map "tc" 'timeclock-change)
 ;;   (define-key ctl-x-map "tr" 'timeclock-reread-log)
-;;   (define-key ctl-x-map "tu" 'timeclock-update-modeline)
+;;   (define-key ctl-x-map "tu" 'timeclock-update-mode-line)
 ;;   (define-key ctl-x-map "tw" 'timeclock-when-to-leave-string)
 
 ;; If you want Emacs to display the amount of time "left" to your
-;; workday in the modeline, you can either set the value of
-;; `timeclock-modeline-display' to t using M-x customize, or you
-;; can add this code to your .emacs file:
+;; workday in the mode-line, you can either set the value of
+;; `timeclock-mode-line-display' to t using M-x customize, or you can
+;; add this code to your .emacs file:
 ;;
 ;;   (require 'timeclock)
-;;   (timeclock-modeline-display)
+;;   (timeclock-mode-line-display)
 ;;
-;; To cancel this modeline display at any time, just call
-;; `timeclock-modeline-display' again.
+;; To cancel this mode line display at any time, just call
+;; `timeclock-mode-line-display' again.
 
 ;; You may also want Emacs to ask you before exiting, if you are
 ;; currently working on a project.  This can be done either by setting
@@ -98,7 +98,7 @@ work four hours on Monday, then the amount of time \"remaining\" on
 Tuesday is twelve hours -- relative to an averaged work period of
 eight hours -- or eight hours, non-relative.  So relative time takes
 into account any discrepancy of time under-worked or over-worked on
-previous days.  This only affects the timeclock modeline display."
+previous days.  This only affects the timeclock mode line display."
   :type 'boolean
   :group 'timeclock)
 
@@ -145,39 +145,39 @@ This variable only has effect if set with \\[customize]."
 
 ;; For byte-compiler.
 (defvar display-time-hook)
-(defvar timeclock-modeline-display)
+(defvar timeclock-mode-line-display)
 
 (defcustom timeclock-use-display-time t
-  "If non-nil, use `display-time-hook' for doing modeline updates.
+  "If non-nil, use `display-time-hook' for doing mode line updates.
 The advantage of this is that one less timer has to be set running
 amok in Emacs's process space.  The disadvantage is that it requires
 you to have `display-time' running.  If you don't want to use
-`display-time', but still want the modeline to show how much time is
+`display-time', but still want the mode line to show how much time is
 left, set this variable to nil.  Changing the value of this variable
-while timeclock information is being displayed in the modeline has no
-effect.  You should call the function `timeclock-modeline-display' with
+while timeclock information is being displayed in the mode line has no
+effect.  You should call the function `timeclock-mode-line-display' with
 a positive argument to force an update."
   :set (lambda (symbol value)
         (let ((currently-displaying
-               (and (boundp 'timeclock-modeline-display)
-                    timeclock-modeline-display)))
+               (and (boundp 'timeclock-mode-line-display)
+                    timeclock-mode-line-display)))
           ;; if we're changing to the state that
-          ;; `timeclock-modeline-display' is already using, don't
+          ;; `timeclock-mode-line-display' is already using, don't
           ;; bother toggling it.  This happens on the initial loading
           ;; of timeclock.el.
           (if (and currently-displaying
                    (or (and value
                             (boundp 'display-time-hook)
-                            (memq 'timeclock-update-modeline
+                            (memq 'timeclock-update-mode-line
                                   display-time-hook))
                        (and (not value)
                             timeclock-update-timer)))
               (setq currently-displaying nil))
           (and currently-displaying
-               (set-variable 'timeclock-modeline-display nil))
+               (set-variable 'timeclock-mode-line-display nil))
           (setq timeclock-use-display-time value)
           (and currently-displaying
-               (set-variable 'timeclock-modeline-display t))
+               (set-variable 'timeclock-mode-line-display t))
           timeclock-use-display-time))
   :type 'boolean
   :group 'timeclock
@@ -205,7 +205,7 @@ to today."
 (defcustom timeclock-day-over-hook nil
   "A hook that is run when the workday has been completed.
 This hook is only run if the current time remaining is being displayed
-in the modeline.  See the variable `timeclock-modeline-display'."
+in the mode line.  See the variable `timeclock-mode-line-display'."
   :type 'hook
   :group 'timeclock)
 
@@ -251,7 +251,7 @@ worked so far today.  Also, if `timeclock-relative' is nil, this value
 will be the same as `timeclock-discrepancy'.")
 
 (defvar timeclock-use-elapsed nil
-  "Non-nil if the modeline should display time elapsed, not remaining.")
+  "Non-nil if the mode line should display time elapsed, not remaining.")
 
 (defvar timeclock-last-period nil
   "Integer representing the number of seconds in the last period.
@@ -259,7 +259,7 @@ Note that you shouldn't access this value, but instead should use the
 function `timeclock-last-period'.")
 
 (defvar timeclock-mode-string nil
-  "The timeclock string (optionally) displayed in the modeline.
+  "The timeclock string (optionally) displayed in the mode line.
 The time is bracketed by <> if you are clocked in, otherwise by [].")
 
 (defvar timeclock-day-over nil
@@ -267,15 +267,18 @@ The time is bracketed by <> if you are clocked in, otherwise by [].")
 
 ;;; User Functions:
 
+(define-obsolete-function-alias 'timeclock-modeline-display
+  'timeclock-mode-line-display "24.2")
+
 ;;;###autoload
-(defun timeclock-modeline-display (&optional arg)
-  "Toggle display of the amount of time left today in the modeline.
+(defun timeclock-mode-line-display (&optional arg)
+  "Toggle display of the amount of time left today in the mode line.
 If `timeclock-use-display-time' is non-nil (the default), then
-the function `display-time-mode' must be active, and the modeline
+the function `display-time-mode' must be active, and the mode line
 will be updated whenever the time display is updated.  Otherwise,
 the timeclock will use its own sixty second timer to do its
-updating.  With prefix ARG, turn modeline display on if and only
-if ARG is positive.  Returns the new status of timeclock modeline
+updating.  With prefix ARG, turn mode line display on if and only
+if ARG is positive.  Returns the new status of timeclock mode line
 display (non-nil means on)."
   (interactive "P")
   ;; cf display-time-mode.
@@ -283,49 +286,49 @@ display (non-nil means on)."
   (or global-mode-string (setq global-mode-string '("")))
   (let ((on-p (if arg
                  (> (prefix-numeric-value arg) 0)
-               (not timeclock-modeline-display))))
+               (not timeclock-mode-line-display))))
     (if on-p
         (progn
           (or (memq 'timeclock-mode-string global-mode-string)
               (setq global-mode-string
                     (append global-mode-string '(timeclock-mode-string))))
-         (unless (memq 'timeclock-update-modeline timeclock-event-hook)
-           (add-hook 'timeclock-event-hook 'timeclock-update-modeline))
+         (add-hook 'timeclock-event-hook 'timeclock-update-mode-line)
          (when timeclock-update-timer
            (cancel-timer timeclock-update-timer)
            (setq timeclock-update-timer nil))
          (if (boundp 'display-time-hook)
-             (remove-hook 'display-time-hook 'timeclock-update-modeline))
+             (remove-hook 'display-time-hook 'timeclock-update-mode-line))
          (if timeclock-use-display-time
               (progn
                 ;; Update immediately so there is a visible change
                 ;; on calling this function.
-                (if display-time-mode (timeclock-update-modeline)
+                (if display-time-mode
+                   (timeclock-update-mode-line)
                   (message "Activate `display-time-mode' or turn off \
 `timeclock-use-display-time' to see timeclock information"))
-                (add-hook 'display-time-hook 'timeclock-update-modeline))
+                (add-hook 'display-time-hook 'timeclock-update-mode-line))
            (setq timeclock-update-timer
-                 (run-at-time nil 60 'timeclock-update-modeline))))
+                 (run-at-time nil 60 'timeclock-update-mode-line))))
       (setq global-mode-string
            (delq 'timeclock-mode-string global-mode-string))
-      (remove-hook 'timeclock-event-hook 'timeclock-update-modeline)
+      (remove-hook 'timeclock-event-hook 'timeclock-update-mode-line)
       (if (boundp 'display-time-hook)
          (remove-hook 'display-time-hook
-                      'timeclock-update-modeline))
+                      'timeclock-update-mode-line))
       (when timeclock-update-timer
        (cancel-timer timeclock-update-timer)
        (setq timeclock-update-timer nil)))
     (force-mode-line-update)
-    (setq timeclock-modeline-display on-p)))
+    (setq timeclock-mode-line-display on-p)))
 
 ;; This has to be here so that the function definition of
-;; `timeclock-modeline-display' is known to the "set" function.
-(defcustom timeclock-modeline-display nil
-  "Toggle modeline display of time remaining.
+;; `timeclock-mode-line-display' is known to the "set" function.
+(defcustom timeclock-mode-line-display nil
+  "Toggle mode line display of time remaining.
 You must modify via \\[customize] for this variable to have an effect."
   :set (lambda (symbol value)
-        (setq timeclock-modeline-display
-              (timeclock-modeline-display (or value 0))))
+        (setq timeclock-mode-line-display
+              (timeclock-mode-line-display (or value 0))))
   :type 'boolean
   :group 'timeclock
   :require 'timeclock)
@@ -477,8 +480,8 @@ Returns the new value of `timeclock-discrepancy'."
   (interactive)
   (setq timeclock-discrepancy nil)
   (timeclock-find-discrep)
-  (if (and timeclock-discrepancy timeclock-modeline-display)
-      (timeclock-update-modeline))
+  (if (and timeclock-discrepancy timeclock-mode-line-display)
+      (timeclock-update-mode-line))
   timeclock-discrepancy)
 
 (defun timeclock-seconds-to-string (seconds &optional show-seconds
@@ -645,8 +648,11 @@ arguments of `completing-read'."
   (timeclock-completing-read "Reason for clocking out: "
                             (mapcar 'list timeclock-reason-list)))
 
-(defun timeclock-update-modeline ()
-  "Update the `timeclock-mode-string' displayed in the modeline.
+(define-obsolete-function-alias 'timeclock-update-modeline
+  'timeclock-update-mode-line "24.2")
+
+(defun timeclock-update-mode-line ()
+  "Update the `timeclock-mode-string' displayed in the mode line.
 The value of `timeclock-relative' affects the display as described in
 that variable's documentation."
   (interactive)
index 9d7da3430adfa1f0678f6684cc486b33be452890..d98ef42438c565eb9fdd8c127bed16279e3fdd4a 100644 (file)
@@ -1,6 +1,16 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-09  Andreas Schwab  <schwab@linux-m68k.org>
 
-       * Version 24.1 released.
+       * ede/project-am.el: Fix typo.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Rename configure.in to configure.ac (Bug#11603).
+       * ede/autoconf-edit.el (autoconf-find-query-for-program)
+       (autoconf-new-program):
+       * ede/emacs.el (ede-emacs-version):
+       * ede/proj.el (ede-proj-setup-buildenvironment):
+       * ede/project-am.el (project-am-autoconf-file-options):
+       Prefer configure.ac to configure.in.
 
 2012-03-12  David Engster  <deng@randomsample.de>
 
        (srecode-template-inserter-ask, srecode-template-inserter-width)
        (srecode-template-inserter-section-start)
        (srecode-template-inserter-section-end, srecode-insert-method):
+       Fix typos in docstrings.
 
 2010-01-12  Juanma Barranquero  <lekktu@gmail.com>
 
index d930a20fba5189698290ffee8f095dce6383e226..03dca6ceccc96d1524e948226f7ba64a91bcb72f 100644 (file)
@@ -872,7 +872,7 @@ If PARENT is non-nil, it is somehow related as a parent to thing."
   "Keymap used in data-debug.")
 
 (defcustom data-debug-mode-hook nil
-  "*Hook run when data-debug starts."
+  "Hook run when data-debug starts."
   :group 'data-debug
   :type 'hook)
 
index 666ba0b0a06b2af89261e3bdfd396a0db5158e6a..e3c9d2cb4f8a2b7e79df61a63546395afe37243d 100644 (file)
@@ -31,7 +31,7 @@
 (declare-function ede-srecode-insert "ede/srecode")
 
 (defun autoconf-new-program (rootdir program testfile)
-  "Initialize a new configure.in in ROOTDIR for PROGRAM using TESTFILE.
+  "Initialize a new configure.ac in ROOTDIR for PROGRAM using TESTFILE.
 ROOTDIR is the root directory of a given autoconf controlled project.
 PROGRAM is the program to be configured.
 TESTFILE is the file used with AC_INIT.
@@ -325,7 +325,7 @@ Optional argument PARAM is the parameter to pass to the macro as one string."
   "Position the cursor where PROG is queried.
 PROG is the VARIABLE to use in autoconf to identify the program.
 PROG excludes the _PROG suffix.  Thus if PROG were EMACS, then the
-variable in configure.in would be EMACS_PROG."
+variable in configure.ac would be EMACS_PROG."
   (let ((op (point))
        (found t)
        (builtin (assoc prog autoconf-program-builtin)))
index d7c83749ffa49e54905f982ed24dca97d4e54063..e3afe30063cb5dc9ffe6808fd4faccc896c18173 100644 (file)
@@ -74,13 +74,16 @@ DIR is the directory to search from."
   "Find the Emacs version for the Emacs src in DIR.
 Return a tuple of ( EMACSNAME . VERSION )."
   (let ((buff (get-buffer-create " *emacs-query*"))
+       (configure_ac "configure.ac")
        (emacs "Emacs")
        (ver ""))
     (with-current-buffer buff
       (erase-buffer)
       (setq default-directory (file-name-as-directory dir))
+      (or (file-exists-p configure_ac)
+         (setq configure_ac "configure.in"))
       ;(call-process "egrep" nil buff nil "-n" "-e" "^version=" "Makefile")
-      (call-process "egrep" nil buff nil "-n" "-e" "AC_INIT" "configure.in")
+      (call-process "egrep" nil buff nil "-n" "-e" "AC_INIT" configure_ac)
       (goto-char (point-min))
       ;(re-search-forward "version=\\([0-9.]+\\)")
       (cond
@@ -100,7 +103,7 @@ emacs_beta_version=\\([0-9]+\\)")
 
        ;; Vaguely recent version of GNU Emacs?
        (t
-       (insert-file-contents "configure.in")
+       (insert-file-contents configure_ac)
        (goto-char (point-min))
        (re-search-forward "AC_INIT(emacs,\\s-*\\([0-9.]+\\)\\s-*)")
        (setq ver (match-string 1))
index d80d55bf9164a612e71dabf2bfd9f35a01940863..a8afe9ec8048fc0f5a9c9ee3841161fdd7a2ed92 100644 (file)
@@ -642,7 +642,7 @@ MFILENAME is the makefile to generate."
 (defmethod ede-proj-setup-buildenvironment ((this ede-proj-project)
                                            &optional force)
   "Setup the build environment for project THIS.
-Handles the Makefile, or a Makefile.am configure.in combination.
+Handles the Makefile, or a Makefile.am configure.ac combination.
 Optional argument FORCE will force items to be regenerated."
   (if (not force)
       (ede-proj-makefile-create-maybe this (ede-proj-dist-makefile this))
index b775cddbc0ef8f8bb9c72129a7d24e7ff9a8a455..e951598ba555a7e33ec6cf333505ff50280ab184 100644 (file)
@@ -896,10 +896,10 @@ files in the project."
     out))
 
 
-;;; Configure.in queries.
+;;; Configure.ac queries.
 ;;
 (defvar project-am-autoconf-file-options
-  '("configure.in" "configure.ac")
+  '("configure.ac" "configure.in")
   "List of possible configure files to look in for project info.")
 
 (defun project-am-autoconf-file (dir)
@@ -948,7 +948,7 @@ Kill the Configure buffer if it was not already in a buffer."
        (configfiles nil)
        )
     (cond
-     ;; Try configure.in or configure.ac
+     ;; Try configure.ac or configure.in
      (conf-in
       (project-am-with-config-current conf-in
        (let ((aci (autoconf-parameters-for-macro "AC_INIT"))
index 7346e88797d7badb5b991b34b15ee0ecc7923ff6..11968f3fa3513c40122b9261f06304063c320910 100644 (file)
@@ -522,6 +522,9 @@ See also the function `define-overload'."
         (list (mode-local--override name args body))
       result)))
 
+;;;###autoload
+(put 'define-overloadable-function 'doc-string-elt 3)
+
 (defmacro define-overloadable-function (name args docstring &rest body)
   "Define a new function, as with `defun', which can be overloaded.
 NAME is the name of the function to create.
@@ -546,6 +549,7 @@ defined.  The default is to call the function `NAME-default' with the
 appropriate arguments deduced from ARGS.
 OVERARGS is a list of arguments passed to the override and
 `NAME-default' function, in place of those deduced from ARGS."
+  (declare (doc-string 3))
   `(eval-and-compile
      (defun ,name ,args
        ,docstring
index 746ee0b89af9db443cdc6989e46e8936ebff678e..8f367d918dc3dab89f31c3f3c6274317f5ff5eea 100644 (file)
@@ -77,7 +77,7 @@ this flag is ignored."
      (:background "#AAAA33"))
     (((class color) (background light))
      (:background "#FFFFAA")))
-  "*Face used at beginning of a highlight."
+  "Face used at beginning of a highlight."
   :group 'pulse)
 
 (defface pulse-highlight-face
@@ -85,7 +85,7 @@ this flag is ignored."
      (:background "#AAAA33"))
     (((class color) (background light))
      (:background "#FFFFAA")))
-  "*Face used during a pulse for display.  *DO NOT CUSTOMIZE*
+  "Face used during a pulse for display.  *DO NOT CUSTOMIZE*
 Face used for temporary highlighting of tags for effect."
   :group 'pulse)
 
index 0ed031019be6a50cffe8cebddf20c628205fd73b..aeb5241b2d0a803cf5ccba83b0a67c2d6fbc10aa 100644 (file)
@@ -550,14 +550,14 @@ is requested."
   )
 
 (defvar semantic-working-type 'percent
-  "*The type of working message to use when parsing.
+  "The type of working message to use when parsing.
 'percent means we are doing a linear parse through the buffer.
 'dynamic means we are reparsing specific tags.")
 (semantic-varalias-obsolete 'semantic-bovination-working-type
                            'semantic-working-type "23.2")
 
 (defvar semantic-minimum-working-buffer-size (* 1024 5)
-  "*The minimum size of a buffer before working messages are displayed.
+  "The minimum size of a buffer before working messages are displayed.
 Buffers smaller than this will parse silently.
 Buffers larger than this will display the working progress bar.")
 
index 1098167597154c85fcc663f53e62ad18352f936c..431d05b75c29c0fd399790aad9243774f9213471 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'ring)
 (require 'ansi-color)
+(require 'regexp-opt)                   ;For regexp-opt-charset.
 \f
 ;; Buffer Local Variables:
 ;;============================================================================
@@ -1075,10 +1075,10 @@ See also `comint-read-input-ring'."
 (defun comint-search-arg (arg)
   ;; First make sure there is a ring and that we are after the process mark
   (cond ((not (comint-after-pmark-p))
-        (error "Not at command line"))
+        (user-error "Not at command line"))
        ((or (null comint-input-ring)
             (ring-empty-p comint-input-ring))
-        (error "Empty input ring"))
+        (user-error "Empty input ring"))
        ((zerop arg)
         ;; arg of zero resets search from beginning, and uses arg of 1
         (setq comint-input-ring-index nil)
@@ -1145,7 +1145,7 @@ Moves relative to `comint-input-ring-index'."
 Moves relative to START, or `comint-input-ring-index'."
   (if (or (not (ring-p comint-input-ring))
          (ring-empty-p comint-input-ring))
-      (error "No history"))
+      (user-error "No history"))
   (let* ((len (ring-length comint-input-ring))
         (motion (if (> arg 0) 1 -1))
         (n (mod (- (or start (comint-search-start arg)) motion) len))
@@ -1185,7 +1185,7 @@ If N is negative, find the next or Nth next match."
   (let ((pos (comint-previous-matching-input-string-position regexp n)))
     ;; Has a match been found?
     (if (null pos)
-       (error "Not found")
+       (user-error "Not found")
       ;; If leaving the edit line, save partial input
       (if (null comint-input-ring-index)       ;not yet on ring
          (setq comint-stored-incomplete-input
@@ -1371,7 +1371,7 @@ actual side-effect."
                 (goto-char (match-beginning 0))
                 (if (not (search-forward old pos t))
                     (or silent
-                        (error "Not found"))
+                        (user-error "Not found"))
                   (replace-match new t t)
                   (message "History item: substituted"))))
              (t
@@ -1440,7 +1440,7 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'."
   (if comint-history-isearch-message-overlay
       (delete-overlay comint-history-isearch-message-overlay))
   (setq isearch-message-prefix-add nil)
-  (setq isearch-search-fun-function nil)
+  (setq isearch-search-fun-function 'isearch-search-fun-default)
   (setq isearch-message-function nil)
   (setq isearch-wrap-function nil)
   (setq isearch-push-state-function nil)
@@ -1462,67 +1462,59 @@ Intended to be added to `isearch-mode-hook' in `comint-mode'."
 
 (defun comint-history-isearch-search ()
   "Return the proper search function, for Isearch in input history."
-  (cond
-   (isearch-word
-    (if isearch-forward 'word-search-forward 'word-search-backward))
-   (t
-    (lambda (string bound noerror)
-      (let ((search-fun
-            ;; Use standard functions to search within comint text
-             (cond
-              (isearch-regexp
-               (if isearch-forward 're-search-forward 're-search-backward))
-              (t
-               (if isearch-forward 'search-forward 'search-backward))))
-           found)
-       ;; Avoid lazy-highlighting matches in the comint prompt and in the
-       ;; output when searching forward.  Lazy-highlight calls this lambda
-       ;; with the bound arg, so skip the prompt and the output.
-       (if (and bound isearch-forward (not (comint-after-pmark-p)))
-           (goto-char (process-mark (get-buffer-process (current-buffer)))))
-        (or
-        ;; 1. First try searching in the initial comint text
-        (funcall search-fun string
-                 (if isearch-forward bound (comint-line-beginning-position))
-                 noerror)
-        ;; 2. If the above search fails, start putting next/prev history
-        ;; elements in the comint successively, and search the string
-        ;; in them.  Do this only when bound is nil (i.e. not while
-        ;; lazy-highlighting search strings in the current comint text).
-        (unless bound
-          (condition-case nil
-              (progn
-                (while (not found)
-                  (cond (isearch-forward
-                         ;; Signal an error here explicitly, because
-                         ;; `comint-next-input' doesn't signal an error.
-                         (when (null comint-input-ring-index)
-                           (error "End of history; no next item"))
-                         (comint-next-input 1)
-                         (goto-char (comint-line-beginning-position)))
-                        (t
-                         ;; Signal an error here explicitly, because
-                         ;; `comint-previous-input' doesn't signal an error.
-                         (when (eq comint-input-ring-index
-                                   (1- (ring-length comint-input-ring)))
-                           (error "Beginning of history; no preceding item"))
-                         (comint-previous-input 1)
-                         (goto-char (point-max))))
-                  (setq isearch-barrier (point) isearch-opoint (point))
-                  ;; After putting the next/prev history element, search
-                  ;; the string in them again, until comint-next-input
-                  ;; or comint-previous-input raises an error at the
-                  ;; beginning/end of history.
-                  (setq found (funcall search-fun string
-                                       (unless isearch-forward
-                                         ;; For backward search, don't search
-                                         ;; in the comint prompt
-                                         (comint-line-beginning-position))
-                                       noerror)))
-                ;; Return point of the new search result
-                (point))
-            ;; Return nil on the error "no next/preceding item"
-            (error nil)))))))))
+  (lambda (string bound noerror)
+    (let ((search-fun
+          ;; Use standard functions to search within comint text
+          (isearch-search-fun-default))
+         found)
+      ;; Avoid lazy-highlighting matches in the comint prompt and in the
+      ;; output when searching forward.  Lazy-highlight calls this lambda
+      ;; with the bound arg, so skip the prompt and the output.
+      (if (and bound isearch-forward (not (comint-after-pmark-p)))
+         (goto-char (process-mark (get-buffer-process (current-buffer)))))
+      (or
+       ;; 1. First try searching in the initial comint text
+       (funcall search-fun string
+               (if isearch-forward bound (comint-line-beginning-position))
+               noerror)
+       ;; 2. If the above search fails, start putting next/prev history
+       ;; elements in the comint successively, and search the string
+       ;; in them.  Do this only when bound is nil (i.e. not while
+       ;; lazy-highlighting search strings in the current comint text).
+       (unless bound
+        (condition-case nil
+            (progn
+              (while (not found)
+                (cond (isearch-forward
+                       ;; Signal an error here explicitly, because
+                       ;; `comint-next-input' doesn't signal an error.
+                       (when (null comint-input-ring-index)
+                         (error "End of history; no next item"))
+                       (comint-next-input 1)
+                       (goto-char (comint-line-beginning-position)))
+                      (t
+                       ;; Signal an error here explicitly, because
+                       ;; `comint-previous-input' doesn't signal an error.
+                       (when (eq comint-input-ring-index
+                                 (1- (ring-length comint-input-ring)))
+                         (error "Beginning of history; no preceding item"))
+                       (comint-previous-input 1)
+                       (goto-char (point-max))))
+                (setq isearch-barrier (point) isearch-opoint (point))
+                ;; After putting the next/prev history element, search
+                ;; the string in them again, until comint-next-input
+                ;; or comint-previous-input raises an error at the
+                ;; beginning/end of history.
+                (setq found (funcall search-fun string
+                                     (unless isearch-forward
+                                       ;; For backward search, don't search
+                                       ;; in the comint prompt
+                                       (comint-line-beginning-position))
+                                     noerror)))
+              ;; Return point of the new search result
+              (point))
+          ;; Return nil on the error "no next/preceding item"
+          (error nil)))))))
 
 (defun comint-history-isearch-message (&optional c-q-hack ellipsis)
   "Display the input history search prompt.
@@ -1555,14 +1547,13 @@ Otherwise, it displays the standard Isearch message returned from
   "Wrap the input history search when search fails.
 Move point to the first history element for a forward search,
 or to the last history element for a backward search."
-  (unless isearch-word
-    ;; When `comint-history-isearch-search' fails on reaching the
-    ;; beginning/end of the history, wrap the search to the first/last
-    ;; input history element.
-    (if isearch-forward
-       (comint-goto-input (1- (ring-length comint-input-ring)))
-      (comint-goto-input nil))
-    (setq isearch-success t))
+  ;; When `comint-history-isearch-search' fails on reaching the
+  ;; beginning/end of the history, wrap the search to the first/last
+  ;; input history element.
+  (if isearch-forward
+      (comint-goto-input (1- (ring-length comint-input-ring)))
+    (comint-goto-input nil))
+  (setq isearch-success t)
   (goto-char (if isearch-forward (comint-line-beginning-position) (point-max))))
 
 (defun comint-history-isearch-push-state ()
@@ -1776,7 +1767,7 @@ Similarly for Soar, Scheme, etc."
   (interactive)
   ;; Note that the input string does not include its terminal newline.
   (let ((proc (get-buffer-process (current-buffer))))
-    (if (not proc) (error "Current buffer has no process")
+    (if (not proc) (user-error "Current buffer has no process")
       (widen)
       (let* ((pmark (process-mark proc))
              (intxt (if (>= (point) (marker-position pmark))
@@ -2014,6 +2005,20 @@ Make backspaces delete the previous character."
            (goto-char (process-mark process))
            (set-marker comint-last-output-start (point))
 
+            ;; Try to skip repeated prompts, which can occur as a result of
+            ;; commands sent without inserting them in the buffer.
+            (let ((bol (save-excursion (forward-line 0) (point)))) ;No fields.
+              (when (and (not (bolp))
+                         (looking-back comint-prompt-regexp bol))
+                (let* ((prompt (buffer-substring bol (point)))
+                       (prompt-re (concat "\\`" (regexp-quote prompt))))
+                  (while (string-match prompt-re string)
+                    (setq string (substring string (match-end 0)))))))
+            (while (string-match (concat "\\(^" comint-prompt-regexp
+                                         "\\)\\1+")
+                                 string)
+              (setq string (replace-match "\\1" nil nil string)))
+
            ;; insert-before-markers is a bad thing. XXX
            ;; Luckily we don't have to use it any more, we use
            ;; window-point-insertion-type instead.
@@ -2100,43 +2105,51 @@ This function should be a pre-command hook."
                        (select-window selected))))
               nil t))))))
 
+(defvar follow-mode)
+(declare-function follow-comint-scroll-to-bottom "follow" (&optional window))
+
 (defun comint-postoutput-scroll-to-bottom (_string)
   "Go to the end of buffer in some or all windows showing it.
-Does not scroll if the current line is the last line in the buffer.
+Do not scroll if the current line is the last line in the buffer.
 Depends on the value of `comint-move-point-for-output' and
 `comint-scroll-show-maximum-output'.
 
 This function should be in the list `comint-output-filter-functions'."
-  (let* ((selected (selected-window))
-        (current (current-buffer))
-        (process (get-buffer-process current))
-        (scroll comint-move-point-for-output))
+  (let* ((current (current-buffer))
+        (process (get-buffer-process current)))
     (unwind-protect
-       (if process
-           (walk-windows
-             (lambda (window)
-               (when (eq (window-buffer window) current)
-                 (select-window window)
-                 (if (and (< (point) (process-mark process))
-                          (or (eq scroll t) (eq scroll 'all)
-                              ;; Maybe user wants point to jump to end.
-                              (and (eq scroll 'this) (eq selected window))
-                              (and (eq scroll 'others) (not (eq selected window)))
-                              ;; If point was at the end, keep it at end.
-                              (and (marker-position comint-last-output-start)
-                                   (>= (point) comint-last-output-start))))
-                     (goto-char (process-mark process)))
-                 ;; Optionally scroll so that the text
-                 ;; ends at the bottom of the window.
-                 (if (and comint-scroll-show-maximum-output
-                          (= (point) (point-max)))
-                     (save-excursion
-                       (goto-char (point-max))
-                       (recenter (- -1 scroll-margin))))
-                 (select-window selected)))
-            nil t))
+       (cond
+        ((null process))
+        ((bound-and-true-p follow-mode)
+         (follow-comint-scroll-to-bottom))
+        (t
+         (let ((selected (selected-window)))
+           (dolist (w (get-buffer-window-list current nil t))
+             (select-window w)
+             (unwind-protect
+                 (progn
+                   (comint-adjust-point selected)
+                   ;; Optionally scroll to the bottom of the window.
+                   (and comint-scroll-show-maximum-output
+                        (eobp)
+                        (recenter (- -1 scroll-margin))))
+               (select-window selected))))))
       (set-buffer current))))
 
+(defun comint-adjust-point (selected)
+  "Move point in the selected window based on Comint settings.
+SELECTED is the window that was originally selected."
+  (let ((process (get-buffer-process (current-buffer))))
+    (and (< (point) (process-mark process))
+        (or (memq comint-move-point-for-output '(t all))
+            ;; Maybe user wants point to jump to end.
+            (eq comint-move-point-for-output
+                (if (eq (selected-window) selected) 'this 'others))
+            ;; If point was at the end, keep it at end.
+            (and (marker-position comint-last-output-start)
+                 (>= (point) comint-last-output-start)))
+        (goto-char (process-mark process)))))
+
 (defun comint-truncate-buffer (&optional _string)
   "Truncate the buffer to `comint-buffer-maximum-size'.
 This function could be on `comint-output-filter-functions' or bound to a key."
@@ -2192,7 +2205,7 @@ Calls `comint-get-old-input' to get old input."
   (let ((input (funcall comint-get-old-input))
        (process (get-buffer-process (current-buffer))))
     (if (not process)
-       (error "Current buffer has no process")
+       (user-error "Current buffer has no process")
       (goto-char (process-mark process))
       (insert input))))
 
@@ -2499,7 +2512,7 @@ If N is negative, find the next or Nth next match."
            (save-excursion
              (while (/= n 0)
                (unless (re-search-backward regexp nil t dir)
-                 (error "Not found"))
+                 (user-error "Not found"))
                (unless (get-char-property (point) 'field)
                  (setq n (- n dir))))
              (field-beginning))))
@@ -2672,6 +2685,7 @@ prompts should stay at the beginning of a line.  If this is not
 the case, this command just calls `kill-region' with all
 read-only properties intact.  The read-only status of newlines is
 updated using `comint-update-fence', if necessary."
+  (declare (advertised-calling-convention (beg end) "23.3"))
   (interactive "r")
   (save-excursion
     (let* ((true-beg (min beg end))
@@ -2690,8 +2704,6 @@ updated using `comint-update-fence', if necessary."
        (let ((inhibit-read-only t))
          (kill-region beg end yank-handler)
          (comint-update-fence))))))
-(set-advertised-calling-convention 'comint-kill-region '(beg end) "23.3")
-
 \f
 ;; Support for source-file processing commands.
 ;;============================================================================
@@ -2959,19 +2971,20 @@ This is a good thing to set in mode hooks.")
   "Return the word of WORD-CHARS at point, or nil if none is found.
 Word constituents are considered to be those in WORD-CHARS, which is like the
 inside of a \"[...]\" (see `skip-chars-forward'), plus all non-ASCII characters."
+  ;; FIXME: Need to handle "..." and '...' quoting in shell.el!
+  ;; This should be combined with completion parsing somehow.
   (save-excursion
     (let ((here (point))
          giveup)
       (while (not giveup)
        (let ((startpoint (point)))
          (skip-chars-backward (concat "\\\\" word-chars))
-         ;; Fixme: This isn't consistent with Bash, at least -- not
-         ;; all non-ASCII chars should be word constituents.
-         (if (and (> (- (point) 2) (point-min))
-                  (= (char-after (- (point) 2)) ?\\))
+         (if (and comint-file-name-quote-list
+                  (eq (char-before (1- (point))) ?\\))
              (forward-char -2))
-         (if (and (> (- (point) 1) (point-min))
-                  (>= (char-after (- (point) 1)) 128))
+         ;; FIXME: This isn't consistent with Bash, at least -- not
+         ;; all non-ASCII chars should be word constituents.
+         (if (and (not (bobp)) (>= (char-before) 128))
              (forward-char -1))
          (if (= (point) startpoint)
              (setq giveup t))))
@@ -3000,26 +3013,53 @@ interpreter (e.g., the percent notation of cmd.exe on Windows)."
 See `comint-word'."
   (comint-word comint-file-name-chars))
 
-(defun comint--unquote&expand-filename (filename)
-  ;; FIXME: The code below does unquote-then-expand which means that "\\$HOME"
-  ;; gets expanded to the same as "$HOME"
-  (comint-substitute-in-file-name
-   (comint-unquote-filename filename)))
+(defun comint--unquote&requote-argument (qstr &optional upos)
+  (unless upos (setq upos 0))
+  (let* ((qpos 0)
+         (ustrs '())
+         (re (concat
+              "\\$\\(?:\\([[:alpha:]][[:alnum:]]*\\)"
+              "\\|{\\(?1:[^{}]+\\)}\\)"
+              (when (memq system-type '(ms-dos windows-nt))
+                "\\|%\\(?1:[^\\\\/]*\\)%")
+              (when comint-file-name-quote-list
+                "\\|\\\\\\(.\\)")))
+         (qupos nil)
+         (push (lambda (str end)
+                 (push str ustrs)
+                 (setq upos (- upos (length str)))
+                 (unless (or qupos (> upos 0))
+                   (setq qupos (if (< end 0) (- end) (+ upos end))))))
+         match)
+    (while (setq match (string-match re qstr qpos))
+      (funcall push (substring qstr qpos match) match)
+      (cond
+       ((match-beginning 2) (funcall push (match-string 2 qstr) (match-end 0)))
+       ((match-beginning 1) (funcall push (getenv (match-string 1 qstr))
+                                     (- (match-end 0))))
+       (t (error "Unexpected case in comint--unquote&requote-argument!")))
+      (setq qpos (match-end 0)))
+    (funcall push (substring qstr qpos) (length qstr))
+    (list (mapconcat #'identity (nreverse ustrs) "")
+          qupos #'comint-quote-filename)))
+
+(defun comint--unquote-argument (str)
+  (car (comint--unquote&requote-argument str)))
+(define-obsolete-function-alias 'comint--unquote&expand-filename
+  #'comint--unquote-argument "24.2")
 
 (defun comint-match-partial-filename ()
   "Return the unquoted&expanded filename at point, or nil if none is found.
 Environment variables are substituted.  See `comint-word'."
   (let ((filename (comint--match-partial-filename)))
-    (and filename (comint--unquote&expand-filename filename))))
+    (and filename (comint--unquote-argument filename))))
 
 (defun comint-quote-filename (filename)
   "Return FILENAME with magic characters quoted.
 Magic characters are those in `comint-file-name-quote-list'."
   (if (null comint-file-name-quote-list)
       filename
-    (let ((regexp
-          (format "[%s]"
-                   (mapconcat 'char-to-string comint-file-name-quote-list ""))))
+    (let ((regexp (regexp-opt-charset comint-file-name-quote-list)))
       (save-match-data
        (let ((i 0))
          (while (string-match regexp filename i)
@@ -3033,6 +3073,12 @@ Magic characters are those in `comint-file-name-quote-list'."
       filename
     (save-match-data
       (replace-regexp-in-string "\\\\\\(.\\)" "\\1" filename t))))
+(make-obsolete 'comint-unquote-filename nil "24.2")
+
+(defun comint--requote-argument (upos qstr)
+  ;; See `completion-table-with-quoting'.
+  (let ((res (comint--unquote&requote-argument qstr upos)))
+    (cons (nth 1 res) (nth 2 res))))
 
 (defun comint-completion-at-point ()
   (run-hook-with-args-until-success 'comint-dynamic-complete-functions))
@@ -3066,87 +3112,6 @@ Returns t if successful."
   (when (comint--match-partial-filename)
     (comint--complete-file-name-data)))
 
-;; FIXME: comint--common-suffix, comint--common-quoted-suffix, and
-;; comint--table-subvert don't fully solve the problem, since
-;; selecting a file from *Completions* won't quote it, among several
-;; other problems.
-
-(defun comint--common-suffix (s1 s2)
-  (assert (not (or (string-match "\n" s1) (string-match "\n" s2))))
-  ;; Since S2 is expected to be the "unquoted/expanded" version of S1,
-  ;; there shouldn't be any case difference, even if the completion is
-  ;; case-insensitive.
-  (let ((case-fold-search nil))
-    (string-match ".*?\\(.*\\)\n.*\\1\\'" (concat s1 "\n" s2))
-    (- (match-end 1) (match-beginning 1))))
-
-(defun comint--common-quoted-suffix (s1 s2)
-  ;; FIXME: Copied in pcomplete.el.
-  "Find the common suffix between S1 and S2 where S1 is the expanded S2.
-S1 is expected to be the unquoted and expanded version of S2.
-Returns (PS1 . PS2), i.e. the shortest prefixes of S1 and S2, such that
-S1 = (concat PS1 SS1) and S2 = (concat PS2 SS2) and
-SS1 = (unquote SS2)."
-  (let* ((cs (comint--common-suffix s1 s2))
-         (ss1 (substring s1 (- (length s1) cs)))
-         (qss1 (comint-quote-filename ss1))
-         qc s2b)
-    (if (and (not (equal ss1 qss1))
-             (setq qc (comint-quote-filename (substring ss1 0 1)))
-            (setq s2b (- (length s2) cs (length qc) -1))
-            (>= s2b 0)                 ;bug#11158.
-             (eq t (compare-strings s2 s2b (- (length s2) cs -1)
-                                    qc nil nil)))
-        ;; The difference found is just that one char is quoted in S2
-        ;; but not in S1, keep looking before this difference.
-        (comint--common-quoted-suffix
-         (substring s1 0 (- (length s1) cs))
-         (substring s2 0 s2b))
-      (cons (substring s1 0 (- (length s1) cs))
-            (substring s2 0 (- (length s2) cs))))))
-
-(defun comint--table-subvert (table s1 s2 &optional quote-fun unquote-fun)
-  "Completion table that replaces the prefix S1 with S2 in STRING.
-The result is a completion table which completes strings of the
-form (concat S1 S) in the same way as TABLE completes strings of
-the form (concat S2 S)."
-  (lambda (string pred action)
-    (let* ((str (if (eq t (compare-strings string 0 (length s1) s1 nil nil
-                                           completion-ignore-case))
-                    (let ((rest (substring string (length s1))))
-                      (concat s2 (if unquote-fun
-                                     (funcall unquote-fun rest) rest)))))
-           (res (if str (complete-with-action action table str pred))))
-      (when res
-        (cond
-         ((and (eq (car-safe action) 'boundaries))
-          (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0)))
-            (list* 'boundaries
-                   (max (length s1)
-                        ;; FIXME: Adjust because of quoting/unquoting.
-                        (+ beg (- (length s1) (length s2))))
-                   (and (eq (car-safe res) 'boundaries) (cddr res)))))
-         ((stringp res)
-          (if (eq t (compare-strings res 0 (length s2) s2 nil nil
-                                     completion-ignore-case))
-              (let ((rest (substring res (length s2))))
-                (concat s1 (if quote-fun (funcall quote-fun rest) rest)))))
-         ((eq action t)
-          (let ((bounds (completion-boundaries str table pred "")))
-            (if (>= (car bounds) (length s2))
-                (if quote-fun (mapcar quote-fun res) res)
-              (let ((re (concat "\\`"
-                                (regexp-quote (substring s2 (car bounds))))))
-                (delq nil
-                      (mapcar (lambda (c)
-                                (if (string-match re c)
-                                    (let ((str (substring c (match-end 0))))
-                                      (if quote-fun
-                                          (funcall quote-fun str) str))))
-                              res))))))
-         ;; E.g. action=nil and it's the only completion.
-         (res))))))
-
 (defun comint-completion-file-name-table (string pred action)
   (if (not (file-name-absolute-p string))
       (completion-file-name-table string pred action)
@@ -3165,6 +3130,13 @@ the form (concat S2 S)."
           res)))
      (t (completion-file-name-table string pred action)))))
 
+(defvar comint-unquote-function #'comint--unquote-argument
+  "Function to use for completion of quoted data.
+See `completion-table-with-quoting' and `comint-requote-function'.")
+(defvar comint-requote-function #'comint--requote-argument
+  "Function to use for completion of quoted data.
+See `completion-table-with-quoting' and `comint-unquote-function'.")
+
 (defun comint--complete-file-name-data ()
   "Return the completion data for file name at point."
   (let* ((filesuffix (cond ((not comint-completion-addsuffix) "")
@@ -3175,14 +3147,11 @@ the form (concat S2 S)."
         (filename (comint--match-partial-filename))
         (filename-beg (if filename (match-beginning 0) (point)))
         (filename-end (if filename (match-end 0) (point)))
-         (unquoted (if filename (comint--unquote&expand-filename filename) ""))
          (table
-          (let ((prefixes (comint--common-quoted-suffix
-                           unquoted filename)))
-            (comint--table-subvert
-             #'comint-completion-file-name-table
-             (cdr prefixes) (car prefixes)
-             #'comint-quote-filename #'comint-unquote-filename))))
+          (completion-table-with-quoting
+           #'comint-completion-file-name-table
+           comint-unquote-function
+           comint-requote-function)))
     (nconc
      (list
       filename-beg filename-end
@@ -3390,7 +3359,7 @@ The process mark separates output, and input already sent,
 from input that has not yet been sent."
   (interactive)
   (let ((proc (or (get-buffer-process (current-buffer))
-                 (error "Current buffer has no process"))))
+                 (user-error "Current buffer has no process"))))
     (goto-char (process-mark proc))
     (when (called-interactively-p 'interactive)
       (message "Point is now at the process mark"))))
@@ -3415,7 +3384,7 @@ the process mark is at the beginning of the accumulated input."
   "Set the process mark at point."
   (interactive)
   (let ((proc (or (get-buffer-process (current-buffer))
-                 (error "Current buffer has no process"))))
+                 (user-error "Current buffer has no process"))))
     (set-marker (process-mark proc) (point))
     (message "Process mark set")))
 
@@ -3767,14 +3736,6 @@ REGEXP-GROUP is the regular expression group in REGEXP to use."
                (match-end regexp-group))
               results))
       results)))
-
-(dolist (x '("^Not at command line$"
-             "^Empty input ring$"
-             "^No history$"
-             "^Not found$"                     ; Too common?
-             "^Current buffer has no process$"))
-  (add-to-list 'debug-ignored-errors x))
-
 \f
 ;; Converting process modes to use comint mode
 ;; ===========================================================================
index ceb272fad6d3d34bf6279ccd78165e825976be09..75f8920920c588b2b61ff0dd21382a23fc674e59 100644 (file)
@@ -344,18 +344,18 @@ are automatically added to the completion database."
   :group 'completion)
 
 ;;(defvar *record-cmpl-statistics-p* nil
-;;  "*If non-nil, record completion statistics.")
+;;  "If non-nil, record completion statistics.")
 
 ;;(defvar *completion-auto-save-period* 1800
-;;  "*The period in seconds to wait for emacs to be idle before autosaving
+;;  "The period in seconds to wait for emacs to be idle before autosaving
 ;;the completions.  Default is a 1/2 hour.")
 
 (defvar completion-min-length 6
-  "*The minimum length of a stored completion.
+  "The minimum length of a stored completion.
 DON'T CHANGE WITHOUT RECOMPILING !  This is used by macros.")
 
 (defvar completion-max-length 200
-  "*The maximum length of a stored completion.
+  "The maximum length of a stored completion.
 DON'T CHANGE WITHOUT RECOMPILING !  This is used by macros.")
 
 (defvar completion-prefix-min-length 3
@@ -1301,8 +1301,8 @@ String must be longer than `completion-prefix-min-length'."
 
 (defun check-completion-length (string)
   (if (< (length string) completion-min-length)
-      (error "The string `%s' is too short to be saved as a completion"
-            string)
+      (user-error "The string `%s' is too short to be saved as a completion"
+                  string)
       (list string)))
 
 (defun add-completion (string &optional num-uses last-use-time)
@@ -2467,10 +2467,6 @@ if ARG is omitted or nil."
 (defvaralias 'cmpl-syntax-table 'completion-syntax-table)
 (defalias 'initialize-completions 'completion-initialize)
 
-(dolist (x '("^To complete, the point must be after a symbol at least [0-9]* character long\\.$"
-       "^The string \".*\" is too short to be saved as a completion\\.$"))
-  (add-to-list 'debug-ignored-errors x))
-
 (provide 'completion)
 
 ;;; completion.el ends here
index 72317ac470ef13630794bc601c65d4fbdc6ebd5b..4832848cb90eeb46ef670241c0be7e28ae469808 100644 (file)
@@ -29,8 +29,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defconst reference-point-alist
   '((tl . 0) (tc . 1) (tr . 2)
     (Bl . 3) (Bc . 4) (Br . 5)
index 23f3eac5d6677cbfac76cc696ce0a8c64cb2f94f..bfe3ae36c7eba0348978468cb18e0a0919ada4da 100644 (file)
@@ -25,7 +25,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'widget)
 (require 'cus-face)
 
@@ -53,9 +52,7 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
               (default-directory (expand-file-name subdir))
               (preloaded (concat "\\`"
                                  (regexp-opt (mapcar
-                                              (lambda (f)
-                                                (file-name-sans-extension
-                                                 (file-name-nondirectory f)))
+                                              'file-name-base
                                               preloaded-file-list) t)
                                  "\\.el\\'")))
           (dolist (file files)
index 4ac5122812f10507fae39c743d5519fe9aaf5eef..0ee2ea4a8bf759afc222f6dc41351d6aa948407c 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages
 ;;
-;; Copyright (C) 1996-1997, 1999-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 1999-2012 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
   :group 'emacs)
 
 (defgroup languages nil
-  "Specialized modes for editing programming languages."
+  "Modes for editing programming languages."
   :group 'programming)
 
 (defgroup lisp nil
   :group 'applications)
 
 (defgroup news nil
-  "Support for netnews reading and posting."
+  "Reading and posting to newsgroups."
   :link '(custom-manual "(gnus)")
   :group 'applications)
 
   :group 'environment)
 
 (defgroup unix nil
-  "Front-ends/assistants for, or emulators of, UNIX features."
+  "Interfaces, assistants, and emulators for UNIX features."
   :group 'environment)
 
 (defgroup i18n nil
   :group 'editing)
 
 (defgroup mode-line nil
-  "Content of the modeline."
+  "Contents of the mode line."
   :group 'environment)
 
 (defgroup editing-basics nil
@@ -544,12 +544,6 @@ WIDGET is the widget to apply the filter entries of MENU on."
           (erase-buffer)
           (princ symbol (current-buffer))
           (goto-char (point-min))
-          ;; FIXME: Boolean variables are not predicates, so they shouldn't
-          ;; end with `-p'.  -stef
-          ;; (when (and (eq (get symbol 'custom-type) 'boolean)
-          ;;         (re-search-forward "-p\\'" nil t))
-          ;;   (replace-match "" t t)
-          ;;   (goto-char (point-min)))
           (if custom-unlispify-remove-prefixes
               (let ((prefixes custom-prefix-list)
                     prefix)
@@ -732,26 +726,26 @@ groups after non-groups, if nil do not order groups at all."
 ;; `custom-buffer-create-internal' if `custom-buffer-verbose-help' is non-nil.
 
 (defvar custom-commands
-  '((" Set for current session " Custom-set t
-     "Apply all settings in this buffer to the current session"
+  '((" Apply " Custom-set t
+     "Apply settings (for the current session only)"
      "index"
      "Apply")
-    (" Save for future sessions " Custom-save
+    (" Apply and Save " Custom-save
      (or custom-file user-init-file)
-     "Apply all settings in this buffer and save them for future Emacs sessions."
+     "Apply settings and save for future sessions."
      "save"
      "Save")
-    (" Undo edits " Custom-reset-current t
-     "Restore all settings in this buffer to reflect their current values."
+    (" Undo Edits " Custom-reset-current t
+     "Restore customization buffer to reflect existing settings."
      "refresh"
      "Undo")
-    (" Reset to saved " Custom-reset-saved t
-     "Restore all settings in this buffer to their saved values (if any)."
+    (" Reset Customizations " Custom-reset-saved t
+     "Undo any settings applied only for the current session."
      "undo"
      "Reset")
-    (" Erase customizations " Custom-reset-standard
+    (" Erase Customizations " Custom-reset-standard
      (or custom-file user-init-file)
-     "Un-customize all settings in this buffer and save them with standard values."
+     "Un-customize settings in this and future sessions."
      "delete"
      "Uncustomize")
     (" Help for Customize " Custom-help t
@@ -766,9 +760,9 @@ groups after non-groups, if nil do not order groups at all."
   (info "(emacs)Easy Customization"))
 
 (defvar custom-reset-menu
-  '(("Undo Edits" . Custom-reset-current)
-    ("Reset to Saved" . Custom-reset-saved)
-    ("Erase Customizations (use standard values)" . Custom-reset-standard))
+  '(("Undo Edits in Customization Buffer" . Custom-reset-current)
+    ("Revert This Session's Customizations" . Custom-reset-saved)
+    ("Erase Customizations" . Custom-reset-standard))
   "Alist of actions for the `Reset' button.
 The key is a string containing the name of the action, the value is a
 Lisp function taking the widget as an element which will be called
@@ -901,7 +895,8 @@ making them as if they had never been customized at all."
            (memq (widget-get widget :custom-state)
                  '(modified set changed saved rogue))
            (widget-apply widget :custom-mark-to-reset-standard)))
-     "Erase all customizations for settings in this buffer? " t)
+     "The settings will revert to their default values, in this
+and future sessions.  Really erase customizations? " t)
     (custom-reset-standard-save-and-update)))
 
 ;;; The Customize Commands
@@ -1136,7 +1131,7 @@ If OTHER-WINDOW is non-nil, display in another window."
 
 ;;;###autoload
 (defun customize-option (symbol)
-  "Customize SYMBOL, which must be a user option variable."
+  "Customize SYMBOL, which must be a user option."
   (interactive (custom-variable-prompt))
   (unless symbol
     (error "No variable specified"))
@@ -1152,7 +1147,7 @@ If OTHER-WINDOW is non-nil, display in another window."
 
 ;;;###autoload
 (defun customize-option-other-window (symbol)
-  "Customize SYMBOL, which must be a user option variable.
+  "Customize SYMBOL, which must be a user option.
 Show the buffer in another window, but don't select it."
   (interactive (custom-variable-prompt))
   (unless symbol
@@ -1164,7 +1159,7 @@ Show the buffer in another window, but don't select it."
     (unless (eq symbol basevar)
       (message "`%s' is an alias for `%s'" symbol basevar))))
 
-(defvar customize-changed-options-previous-release "23.4"
+(defvar customize-changed-options-previous-release "24.1"
   "Version for `customize-changed-options' to refer back to by default.")
 
 ;; Packages will update this variable, so make it available.
@@ -1206,9 +1201,10 @@ the official name of the package, such as MH-E or Gnus.")
 ;;;###autoload
 (defun customize-changed-options (&optional since-version)
   "Customize all settings whose meanings have changed in Emacs itself.
-This includes new user option variables and faces, and new
-customization groups, as well as older options and faces whose meanings
-or default values have changed since the previous major Emacs release.
+This includes new user options and faces, and new customization
+groups, as well as older options and faces whose meanings or
+default values have changed since the previous major Emacs
+release.
 
 With argument SINCE-VERSION (a string), customize all settings
 that were added or redefined since that version."
@@ -1258,8 +1254,8 @@ that were added or redefined since that version."
     (if found
        (custom-buffer-create (custom-sort-items found t 'first)
                              "*Customize Changed Options*")
-      (error "No user option defaults have been changed since Emacs %s"
-            since-version))))
+      (user-error "No user option defaults have been changed since Emacs %s"
+                  since-version))))
 
 (defun customize-package-emacs-version (symbol package-version)
   "Return the Emacs version in which SYMBOL's meaning last changed.
@@ -1390,7 +1386,7 @@ suggest to customize that face, if it's customizable."
                                         (default-value symbol))))
                    (push (list symbol 'custom-variable) found)))))
     (if (not found)
-       (error "No rogue user options")
+       (user-error "No rogue user options")
       (custom-buffer-create (custom-sort-items found t nil)
                            "*Customize Rogue*"))))
 ;;;###autoload
@@ -1407,8 +1403,8 @@ suggest to customize that face, if it's customizable."
                         (get symbol 'saved-variable-comment))
                     (boundp symbol)
                     (push (list symbol 'custom-variable) found))))
-    (if (not found )
-       (error "No saved user options")
+    (if (not found)
+       (user-error "No saved user options")
       (custom-buffer-create (custom-sort-items found t nil)
                            "*Customize Saved*"))))
 
@@ -1416,7 +1412,7 @@ suggest to customize that face, if it's customizable."
 
 ;;;###autoload
 (defun customize-apropos (pattern &optional type)
-  "Customize all loaded options, faces and groups matching PATTERN.
+  "Customize loaded options, faces and groups matching PATTERN.
 PATTERN can be a word, a list of words (separated by spaces),
 or a regexp (using some regexp special characters).  If it is a word,
 search for matches for that word as a substring.  If it is a list of words,
@@ -1424,62 +1420,50 @@ search for matches for any two (or more) of those words.
 
 If TYPE is `options', include only options.
 If TYPE is `faces', include only faces.
-If TYPE is `groups', include only groups.
-If TYPE is t (interactively, with prefix arg), include variables
-that are not customizable options, as well as faces and groups
-\(but we recommend using `apropos-variable' instead)."
-  (interactive (list (apropos-read-pattern "symbol") current-prefix-arg))
+If TYPE is `groups', include only groups."
+  (interactive (list (apropos-read-pattern "symbol") nil))
   (require 'apropos)
+  (unless (memq type '(nil options faces groups))
+    (error "Invalid setting type %s" (symbol-name type)))
   (apropos-parse-pattern pattern)
   (let (found)
     (mapatoms
      `(lambda (symbol)
        (when (string-match apropos-regexp (symbol-name symbol))
-         ,(if (not (memq type '(faces options)))
+         ,(if (memq type '(nil groups))
               '(if (get symbol 'custom-group)
                    (push (list symbol 'custom-group) found)))
-         ,(if (not (memq type '(options groups)))
+         ,(if (memq type '(nil faces))
               '(if (custom-facep symbol)
                    (push (list symbol 'custom-face) found)))
-         ,(if (not (memq type '(groups faces)))
+         ,(if (memq type '(nil options))
               `(if (and (boundp symbol)
                         (eq (indirect-variable symbol) symbol)
                         (or (get symbol 'saved-value)
-                            (custom-variable-p symbol)
-                            ,(if (not (memq type '(nil options)))
-                                 '(get symbol 'variable-documentation))))
+                            (custom-variable-p symbol)))
                    (push (list symbol 'custom-variable) found))))))
-    (if (not found)
-       (error "No %s matching %s"
-              (if (eq type t)
-                  "items"
-                (format "customizable %s"
-                        (if (memq type '(options faces groups))
-                            (symbol-name type)
-                          "items")))
-              pattern)
-      (custom-buffer-create
-       (custom-sort-items found t custom-buffer-order-groups)
-       "*Customize Apropos*"))))
+    (unless found
+      (error "No customizable %s matching %s" (symbol-name type) pattern))
+    (custom-buffer-create
+     (custom-sort-items found t custom-buffer-order-groups)
+     "*Customize Apropos*")))
 
 ;;;###autoload
-(defun customize-apropos-options (regexp &optional arg)
-  "Customize all loaded customizable options matching REGEXP.
-With prefix ARG, include variables that are not customizable options
-\(but it is better to use `apropos-variable' if you want to find those)."
-  (interactive "sCustomize options (regexp): \nP")
-  (customize-apropos regexp (or arg 'options)))
+(defun customize-apropos-options (regexp &optional ignored)
+  "Customize all loaded customizable options matching REGEXP."
+  (interactive (list (apropos-read-pattern "options")))
+  (customize-apropos regexp 'options))
 
 ;;;###autoload
 (defun customize-apropos-faces (regexp)
   "Customize all loaded faces matching REGEXP."
-  (interactive "sCustomize faces (regexp): \n")
+  (interactive (list (apropos-read-pattern "faces")))
   (customize-apropos regexp 'faces))
 
 ;;;###autoload
 (defun customize-apropos-groups (regexp)
   "Customize all loaded groups matching REGEXP."
-  (interactive "sCustomize groups (regexp): \n")
+  (interactive (list (apropos-read-pattern "groups")))
   (customize-apropos regexp 'groups))
 
 ;;; Buffer.
@@ -1552,11 +1536,12 @@ that option."
   (switch-to-buffer-other-window (custom-get-fresh-buffer name))
   (custom-buffer-create-internal options description))
 
-(defcustom custom-reset-button-menu nil
+(defcustom custom-reset-button-menu t
   "If non-nil, only show a single reset button in customize buffers.
 This button will have a menu with all three reset operations."
   :type 'boolean
-  :group 'custom-buffer)
+  :group 'custom-buffer
+  :version "24.2")
 
 (defcustom custom-buffer-verbose-help t
   "If non-nil, include explanatory text in the customization buffer."
@@ -1606,13 +1591,12 @@ Otherwise use brackets."
   (let ((init-file (or custom-file user-init-file)))
     ;; Insert verbose help at the top of the custom buffer.
     (when custom-buffer-verbose-help
-      (widget-insert (if init-file
-                        "To apply changes, use the Save or Set buttons."
-                      "Custom settings cannot be saved; maybe you started Emacs with `-q'.")
-                    "\nFor details, see ")
+      (unless init-file
+       (widget-insert "Custom settings cannot be saved; maybe you started Emacs with `-q'.\n"))
+      (widget-insert "For help using this buffer, see ")
       (widget-create 'custom-manual
-                    :tag "Saving Customizations"
-                    "(emacs)Saving Customizations")
+                    :tag "Easy Customization"
+                    "(emacs)Easy Customization")
       (widget-insert " in the ")
       (widget-create 'custom-manual
                     :tag "Emacs manual"
@@ -1651,29 +1635,30 @@ or a regular expression.")
     ;; So now the buttons are always inserted in the buffer.  (Bug#1326)
     (if custom-buffer-verbose-help
        (widget-insert "
- Operate on all settings in this buffer:\n"))
+Operate on all settings in this buffer:\n"))
     (let ((button (lambda (tag action active help _icon _label)
                    (widget-insert " ")
                    (if (eval active)
                        (widget-create 'push-button :tag tag
                                       :help-echo help :action action))))
          (commands custom-commands))
-      (apply button (pop commands)) ; Set for current session
-      (apply button (pop commands)) ; Save for future sessions
       (if custom-reset-button-menu
          (progn
-           (widget-insert " ")
            (widget-create 'push-button
-                          :tag "Reset buffer"
+                          :tag " Revert... "
                           :help-echo "Show a menu with reset operations."
                           :mouse-down-action 'ignore
-                          :action 'custom-reset))
+                          :action 'custom-reset)
+           (apply button (pop commands))  ; Apply
+           (apply button (pop commands))) ; Apply and Save
+       (apply button (pop commands))   ; Apply
+       (apply button (pop commands))   ; Apply and Save
        (widget-insert "\n")
-       (apply button (pop commands)) ; Undo edits
-       (apply button (pop commands)) ; Reset to saved
-       (apply button (pop commands)) ; Erase customization
+       (apply button (pop commands))   ; Undo
+       (apply button (pop commands))   ; Reset
+       (apply button (pop commands))   ; Erase
        (widget-insert "  ")
-       (pop commands) ; Help (omitted)
+       (pop commands)                  ; Help (omitted)
        (apply button (pop commands)))) ; Exit
     (widget-insert "\n\n"))
 
@@ -1868,64 +1853,52 @@ item in another window.\n\n"))
   :group 'custom-buffer)
 
 (defface custom-invalid '((((class color))
-                          (:foreground "yellow1" :background "red1"))
-                         (t
-                          (:weight bold :slant italic :underline t)))
+                          :foreground "yellow1" :background "red1")
+                         (t :weight bold :slant italic :underline t))
   "Face used when the customize item is invalid."
   :group 'custom-magic-faces)
-(define-obsolete-face-alias 'custom-invalid-face 'custom-invalid "22.1")
 
 (defface custom-rogue '((((class color))
-                        (:foreground "pink" :background "black"))
-                       (t
-                        (:underline t)))
+                        :foreground "pink" :background "black")
+                       (t :underline t))
   "Face used when the customize item is not defined for customization."
   :group 'custom-magic-faces)
-(define-obsolete-face-alias 'custom-rogue-face 'custom-rogue "22.1")
 
 (defface custom-modified '((((min-colors 88) (class color))
-                           (:foreground "white" :background "blue1"))
+                           :foreground "white" :background "blue1")
                           (((class color))
-                           (:foreground "white" :background "blue"))
-                          (t
-                           (:slant italic :bold)))
+                           :foreground "white" :background "blue")
+                          (t :slant italic))
   "Face used when the customize item has been modified."
   :group 'custom-magic-faces)
-(define-obsolete-face-alias 'custom-modified-face 'custom-modified "22.1")
 
 (defface custom-set '((((min-colors 88) (class color))
-                      (:foreground "blue1" :background "white"))
+                      :foreground "blue1" :background "white")
                      (((class color))
-                      (:foreground "blue" :background "white"))
-                     (t
-                      (:slant italic)))
+                      :foreground "blue" :background "white")
+                     (t :slant italic))
   "Face used when the customize item has been set."
   :group 'custom-magic-faces)
-(define-obsolete-face-alias 'custom-set-face 'custom-set "22.1")
 
 (defface custom-changed '((((min-colors 88) (class color))
-                          (:foreground "white" :background "blue1"))
+                          :foreground "white" :background "blue1")
                          (((class color))
-                          (:foreground "white" :background "blue"))
-                         (t
-                          (:slant italic)))
+                          :foreground "white" :background "blue")
+                         (t :slant italic))
   "Face used when the customize item has been changed."
   :group 'custom-magic-faces)
-(define-obsolete-face-alias 'custom-changed-face 'custom-changed "22.1")
 
 (defface custom-themed '((((min-colors 88) (class color))
-                          (:foreground "white" :background "blue1"))
-                         (((class color))
-                          (:foreground "white" :background "blue"))
-                         (t
-                          (:slant italic)))
+                         :foreground "white" :background "blue1")
+                        (((class color))
+                         :foreground "white" :background "blue")
+                        (t :slant italic))
   "Face used when the customize item has been set by a theme."
   :group 'custom-magic-faces)
 
-(defface custom-saved '((t (:underline t)))
+(defface custom-saved '((t :underline t))
   "Face used when the customize item has been saved."
   :group 'custom-magic-faces)
-(define-obsolete-face-alias 'custom-saved-face 'custom-saved "22.1")
 
 (defconst custom-magic-alist
   '((nil "#" underline "\
@@ -2116,25 +2089,22 @@ and `face'."
 ;;; The `custom' Widget.
 
 (defface custom-button
-  '((((type x w32 ns) (class color))   ; Like default modeline
-     (:box (:line-width 2 :style released-button)
-          :background "lightgrey" :foreground "black"))
-    (t
-     nil))
+  '((((type x w32 ns) (class color))   ; Like default mode line
+     :box (:line-width 2 :style released-button)
+     :background "lightgrey" :foreground "black"))
   "Face for custom buffer buttons if `custom-raised-buttons' is non-nil."
   :version "21.1"
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-button-face 'custom-button "22.1")
 
 (defface custom-button-mouse
   '((((type x w32 ns) (class color))
-     (:box (:line-width 2 :style released-button)
-          :background "grey90" :foreground "black"))
+     :box (:line-width 2 :style released-button)
+     :background "grey90" :foreground "black")
     (t
      ;; This is for text terminals that support mouse, like GPM mouse
      ;; or the MS-DOS terminal: inverse-video makes the button stand
      ;; out on mouse-over.
-     (:inverse-video t)))
+     :inverse-video t))
   "Mouse face for custom buffer buttons if `custom-raised-buttons' is non-nil."
   :version "22.1"
   :group 'custom-faces)
@@ -2153,15 +2123,12 @@ and `face'."
 
 (defface custom-button-pressed
   '((((type x w32 ns) (class color))
-     (:box (:line-width 2 :style pressed-button)
-          :background "lightgrey" :foreground "black"))
-    (t
-     (:inverse-video t)))
+     :box (:line-width 2 :style pressed-button)
+     :background "lightgrey" :foreground "black")
+    (t :inverse-video t))
   "Face for pressed custom buttons if `custom-raised-buttons' is non-nil."
   :version "21.1"
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-button-pressed-face
-  'custom-button-pressed "22.1")
 
 (defface custom-button-pressed-unraised
   '((default :inherit custom-button-unraised)
@@ -2179,22 +2146,15 @@ and `face'."
 (defface custom-documentation '((t nil))
   "Face used for documentation strings in customization buffers."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-documentation-face
-  'custom-documentation "22.1")
-
-(defface custom-state '((((class color)
-                         (background dark))
-                        (:foreground "lime green"))
-                       (((class color)
-                         (background light))
-                        (:foreground "dark green"))
-                       (t nil))
+
+(defface custom-state '((((class color) (background dark))
+                        :foreground "lime green")
+                       (((class color) (background light))
+                        :foreground "dark green"))
   "Face used for State descriptions in the customize buffer."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-state-face 'custom-state "22.1")
 
-(defface custom-link
-  '((t :inherit link))
+(defface custom-link '((t :inherit link))
   "Face for links in customization buffers."
   :version "22.1"
   :group 'custom-faces)
@@ -2391,20 +2351,18 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
   "Face used for comments on variables or faces."
   :version "21.1"
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-comment-face 'custom-comment "22.1")
 
 ;; like font-lock-comment-face
 (defface custom-comment-tag
-  '((((class color) (background dark)) (:foreground "gray80"))
-    (((class color) (background light)) (:foreground "blue4"))
+  '((((class color) (background dark)) :foreground "gray80")
+    (((class color) (background light)) :foreground "blue4")
     (((class grayscale) (background light))
-     (:foreground "DimGray" :weight bold :slant italic))
+     :foreground "DimGray" :weight bold :slant italic)
     (((class grayscale) (background dark))
-     (:foreground "LightGray" :weight bold :slant italic))
-    (t (:weight bold)))
+     :foreground "LightGray" :weight bold :slant italic)
+    (t :weight bold))
   "Face used for the comment tag on variables or faces."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-comment-tag-face 'custom-comment-tag "22.1")
 
 (define-widget 'custom-comment 'string
   "User comment."
@@ -2443,26 +2401,19 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
 ;;; The `custom-variable' Widget.
 
 (defface custom-variable-tag
-  `((((class color)
-      (background dark))
-     (:foreground "light blue" :weight bold))
-    (((min-colors 88) (class color)
-      (background light))
-     (:foreground "blue1" :weight bold))
-    (((class color)
-      (background light))
-     (:foreground "blue" :weight bold))
-    (t (:weight bold)))
+  `((((class color) (background dark))
+     :foreground "light blue" :weight bold)
+    (((min-colors 88) (class color) (background light))
+     :foreground "blue1" :weight bold)
+    (((class color) (background light))
+     :foreground "blue" :weight bold)
+    (t :weight bold))
   "Face used for unpushable variable tags."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-variable-tag-face
-  'custom-variable-tag "22.1")
 
-(defface custom-variable-button '((t (:underline t :weight bold)))
+(defface custom-variable-button '((t :underline t :weight bold))
   "Face used for pushable variable tags."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-variable-button-face
-  'custom-variable-button "22.1")
 
 (defcustom custom-variable-default-form 'edit
   "Default form of displaying variable values."
@@ -2475,15 +2426,15 @@ If INITIAL-STRING is non-nil, use that rather than \"Parent groups:\"."
   "Return documentation of VARIABLE for use in Custom buffer.
 Normally just return the docstring.  But if VARIABLE automatically
 becomes buffer local when set, append a message to that effect."
-  (if (and (local-variable-if-set-p variable)
-          (or (not (local-variable-p variable))
-              (with-temp-buffer
-                (local-variable-if-set-p variable))))
-      (concat (documentation-property variable 'variable-documentation)
+  (format "%s%s" (documentation-property variable 'variable-documentation)
+         (if (and (local-variable-if-set-p variable)
+                  (or (not (local-variable-p variable))
+                      (with-temp-buffer
+                        (local-variable-if-set-p variable))))
              "\n
 This variable automatically becomes buffer-local when set outside Custom.
-However, setting it through Custom sets the default value.")
-    (documentation-property variable 'variable-documentation)))
+However, setting it through Custom sets the default value."
+           "")))
 
 (define-widget 'custom-variable 'custom
   "A widget for displaying a Custom variable.
@@ -2824,12 +2775,10 @@ If STATE is nil, the value is computed by `custom-variable-state'."
      (lambda (widget)
        (and (default-boundp (widget-value widget))
            (memq (widget-get widget :custom-state) '(modified changed)))))
-    ("Reset to Saved" custom-variable-reset-saved
+    ("Revert This Session's Customization" custom-variable-reset-saved
      (lambda (widget)
-       (and (or (get (widget-value widget) 'saved-value)
-               (get (widget-value widget) 'saved-variable-comment))
-           (memq (widget-get widget :custom-state)
-                 '(modified set changed rogue)))))
+       (memq (widget-get widget :custom-state)
+            '(modified set changed rogue))))
     ,@(when (or custom-file init-file-user)
        '(("Erase Customization" custom-variable-reset-standard
           (lambda (widget)
@@ -2896,7 +2845,7 @@ Optional EVENT is the location for the menu."
         (comment (widget-value comment-widget))
         val)
     (cond ((eq state 'hidden)
-          (error "Cannot set hidden variable"))
+          (user-error "Cannot set hidden variable"))
          ((setq val (widget-apply child :validate))
           (goto-char (widget-get val :from))
           (error "%s" (widget-get val :error)))
@@ -2938,7 +2887,7 @@ Optional EVENT is the location for the menu."
         (comment (widget-value comment-widget))
         val)
     (cond ((eq state 'hidden)
-          (error "Cannot set hidden variable"))
+          (user-error "Cannot set hidden variable"))
          ((setq val (widget-apply child :validate))
           (goto-char (widget-get val :from))
           (error "Saving %s: %s" symbol (widget-get val :error)))
@@ -2980,23 +2929,25 @@ Optional EVENT is the location for the menu."
   (custom-variable-state-set-and-redraw widget))
 
 (defun custom-variable-reset-saved (widget)
-  "Restore the saved value for the variable being edited by WIDGET.
-This also updates the buffer to show that value.
-The value that was current before this operation
-becomes the backup value, so you can get it again."
+  "Restore the value of the variable being edited by WIDGET.
+If there is a saved value, restore it; otherwise reset to the
+uncustomized (themed or standard) value.
+
+Update the widget to show that value.  The value that was current
+before this operation becomes the backup value."
   (let* ((symbol (widget-value widget))
-        (set (or (get symbol 'custom-set) 'set-default))
-        (value (get symbol 'saved-value))
+        (saved-value (get symbol 'saved-value))
         (comment (get symbol 'saved-variable-comment)))
-    (cond ((or value comment)
-          (put symbol 'variable-comment comment)
-          (custom-variable-backup-value widget)
-          (custom-push-theme 'theme-value symbol 'user 'set (car-safe value))
-          (condition-case nil
-              (funcall set symbol (eval (car value)))
-            (error nil)))
-         (t
-          (error "No saved value for %s" symbol)))
+    (custom-variable-backup-value widget)
+    (if (not (or saved-value comment))
+       ;; If there is no saved value, remove the setting.
+       (custom-push-theme 'theme-value symbol 'user 'reset)
+      ;; Otherwise, apply the saved value.
+      (put symbol 'variable-comment comment)
+      (custom-push-theme 'theme-value symbol 'user 'set (car-safe saved-value))
+      (ignore-errors
+       (funcall (or (get symbol 'custom-set) 'set-default)
+                symbol (eval (car saved-value)))))
     (put symbol 'customized-value nil)
     (put symbol 'customized-variable-comment nil)
     (widget-put widget :custom-state 'unknown)
@@ -3010,7 +2961,7 @@ redraw the widget immediately."
   (let* ((symbol (widget-value widget)))
     (if (get symbol 'standard-value)
        (custom-variable-backup-value widget)
-      (error "No standard setting known for %S" symbol))
+      (user-error "No standard setting known for %S" symbol))
     (put symbol 'variable-comment nil)
     (put symbol 'customized-value nil)
     (put symbol 'customized-variable-comment nil)
@@ -3072,7 +3023,7 @@ to switch between two values."
          (condition-case nil
              (funcall set symbol (car value))
             (error nil)))
-      (error "No backup value for %s" symbol))
+      (user-error "No backup value for %s" symbol))
     (put symbol 'customized-value (list (custom-quote (car value))))
     (put symbol 'variable-comment comment)
     (put symbol 'customized-variable-comment comment)
@@ -3329,10 +3280,9 @@ Only match frames that support the specified face attributes.")
 ;;; The `custom-face' Widget.
 
 (defface custom-face-tag
-  `((t :inherit custom-variable-tag))
+  '((t :inherit custom-variable-tag))
   "Face used for face tags."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-face-tag-face 'custom-face-tag "22.1")
 
 (defcustom custom-face-default-form 'selected
   "Default form of displaying face definition."
@@ -3620,10 +3570,9 @@ the present value is saved to its :shown-value property instead."
     ("Undo Edits" custom-redraw
      (lambda (widget)
        (memq (widget-get widget :custom-state) '(modified changed))))
-    ("Reset to Saved" custom-face-reset-saved
+    ("Revert This Session's Customization" custom-face-reset-saved
      (lambda (widget)
-       (or (get (widget-value widget) 'saved-face)
-          (get (widget-value widget) 'saved-face-comment))))
+       (memq (widget-get widget :custom-state) '(modified set changed))))
     ,@(when (or custom-file init-file-user)
        '(("Erase Customization" custom-face-reset-standard
           (lambda (widget)
@@ -3678,18 +3627,17 @@ This is one of `set', `saved', `changed', `themed', or `rogue'."
              'changed))
           ((or (get face 'saved-face)
                (get face 'saved-face-comment))
-           (if (equal (get face 'saved-face-comment) comment)
-               (cond
-                ((eq 'user (caar (get face 'theme-face)))
-                 'saved)
-                ((eq 'changed (caar (get face 'theme-face)))
-                 'changed)
-                (t 'themed))
-             'changed))
+           (cond ((not (equal (get face 'saved-face-comment) comment))
+                  'changed)
+                 ((eq 'user (caar (get face 'theme-face)))
+                  'saved)
+                 ((eq 'changed (caar (get face 'theme-face)))
+                  'changed)
+                 (t 'themed)))
           ((get face 'face-defface-spec)
-           (if (equal comment nil)
-               'standard
-             'changed))
+           (cond (comment 'changed)
+                 ((get face 'theme-face) 'themed)
+                 (t 'standard)))
           (t 'rogue))))
     ;; If the user called set-face-attribute to change the default for
     ;; new frames, this face is "set outside of Customize".
@@ -3779,24 +3727,26 @@ Optional EVENT is the location for the menu."
   "22.1")
 
 (defun custom-face-reset-saved (widget)
-  "Restore WIDGET to the face's default attributes."
-  (let* ((symbol (widget-value widget))
+  "Restore WIDGET to the face's default attributes.
+If there is a saved face, restore it; otherwise reset to the
+uncustomized (themed or standard) face."
+  (let* ((face (widget-value widget))
         (child (car (widget-get widget :children)))
-        (value (get symbol 'saved-face))
-        (comment (get symbol 'saved-face-comment))
+        (saved-face (get face 'saved-face))
+        (comment (get face 'saved-face-comment))
         (comment-widget (widget-get widget :comment-widget)))
-    (unless (or value comment)
-      (error "No saved value for this face"))
-    (put symbol 'customized-face nil)
-    (put symbol 'customized-face-comment nil)
-    (custom-push-theme 'theme-face symbol 'user 'set value)
-    (face-spec-set symbol value t)
-    (put symbol 'face-comment comment)
-    (widget-value-set child value)
+    (put face 'customized-face nil)
+    (put face 'customized-face-comment nil)
+    (custom-push-theme 'theme-face face 'user
+                      (if saved-face 'set 'reset)
+                      saved-face)
+    (face-spec-set face saved-face t)
+    (put face 'face-comment comment)
+    (widget-value-set child saved-face)
     ;; This call manages the comment visibility
     (widget-value-set comment-widget (or comment ""))
     (custom-face-state-set widget)
-    (custom-redraw-magic widget)))
+    (custom-redraw widget)))
 
 (defun custom-face-standard-value (widget)
   (get (widget-value widget) 'face-defface-spec))
@@ -3810,7 +3760,7 @@ redraw the widget immediately."
         (value (get symbol 'face-defface-spec))
         (comment-widget (widget-get widget :comment-widget)))
     (unless value
-      (error "No standard setting for this face"))
+      (user-error "No standard setting for this face"))
     (put symbol 'customized-face nil)
     (put symbol 'customized-face-comment nil)
     (custom-push-theme 'theme-face symbol 'user 'reset)
@@ -3940,8 +3890,6 @@ restoring it to the state of a face that has never been customized."
 ;;; The `custom-group' Widget.
 
 (defcustom custom-group-tag-faces nil
-  ;; In XEmacs, this ought to play games with font size.
-  ;; Fixme: make it do so in Emacs.
   "Face used for group tags.
 The first member is used for level 1 groups, the second for level 2,
 and so forth.  The remaining group tags are shown with `custom-group-tag'."
@@ -3949,34 +3897,28 @@ and so forth.  The remaining group tags are shown with `custom-group-tag'."
   :group 'custom-faces)
 
 (defface custom-group-tag-1
-  `((((class color)
-      (background dark))
-     (:foreground "pink" :weight bold :height 1.2 :inherit variable-pitch))
-    (((min-colors 88) (class color)
-      (background light))
-     (:foreground "red1" :weight bold :height 1.2 :inherit variable-pitch))
-    (((class color)
-      (background light))
-     (:foreground "red" :weight bold :height 1.2 :inherit variable-pitch))
-    (t (:weight bold)))
-  "Face used for group tags."
+  '((default :weight bold :height 1.2 :inherit variable-pitch)
+    (((class color) (background dark)) :foreground "pink")
+    (((min-colors 88) (class color) (background light)) :foreground "red1")
+    (((class color) (background light)) :foreground "red"))
+  "Face for group tags."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-group-tag-face-1 'custom-group-tag-1 "22.1")
 
 (defface custom-group-tag
-  `((((class color)
-      (background dark))
-     (:foreground "light blue" :weight bold :height 1.2 :inherit variable-pitch))
-    (((min-colors 88) (class color)
-      (background light))
-     (:foreground "blue1" :weight bold :height 1.2 :inherit variable-pitch))
-    (((class color)
-      (background light))
-     (:foreground "blue" :weight bold :height 1.2 :inherit variable-pitch))
-    (t (:weight bold)))
-  "Face used for low level group tags."
+  '((default :weight bold :height 1.2 :inherit variable-pitch)
+    (((class color) (background dark)) :foreground "light blue")
+    (((min-colors 88) (class color) (background light)) :foreground "blue1")
+    (((class color) (background light)) :foreground "blue")
+    (t :weight bold))
+  "Face for low level group tags."
   :group 'custom-faces)
-(define-obsolete-face-alias 'custom-group-tag-face 'custom-group-tag "22.1")
+
+(defface custom-group-subtitle
+  '((t :weight bold))
+  "Face for the \"Subgroups:\" subtitle in Custom buffers."
+  :group 'custom-faces)
+
+(defvar custom-group-doc-align-col 20)
 
 (define-widget 'custom-group 'custom
   "Customize group."
@@ -4043,11 +3985,9 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
           (custom-browse-insert-prefix prefix)
           (push (widget-create-child-and-convert
                  widget 'custom-browse-visibility
-                 ;; :tag-glyph "plus"
                  :tag "+")
                 buttons)
           (insert "-- ")
-          ;; (widget-glyph-insert nil "-- " "horizontal")
           (push (widget-create-child-and-convert
                  widget 'custom-browse-group-tag)
                 buttons)
@@ -4057,8 +3997,6 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
                (zerop (length members)))
           (custom-browse-insert-prefix prefix)
           (insert "[ ]-- ")
-          ;; (widget-glyph-insert nil "[ ]" "empty")
-          ;; (widget-glyph-insert nil "-- " "horizontal")
           (push (widget-create-child-and-convert
                  widget 'custom-browse-group-tag)
                 buttons)
@@ -4136,7 +4074,8 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
                    :action 'custom-toggle-parent
                    (not (eq state 'hidden)))
                   buttons))
-          (insert " : ")
+          (if (>= (current-column) custom-group-doc-align-col)
+              (insert "  "))
           ;; Create magic button.
           (let ((magic (widget-create-child-and-convert
                         widget 'custom-magic nil)))
@@ -4146,7 +4085,8 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
           (widget-put widget :buttons buttons)
           ;; Insert documentation.
           (if (and (eq custom-buffer-style 'links) (> level 1))
-              (widget-put widget :documentation-indent 0))
+              (widget-put widget :documentation-indent
+                          custom-group-doc-align-col))
           (widget-add-documentation-string-button
            widget :visibility-widget 'custom-visibility))
 
@@ -4224,25 +4164,34 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
                  (count 0)
                  (reporter (make-progress-reporter
                             "Creating group entries..." 0 len))
+                 (have-subtitle (and (not (eq symbol 'emacs))
+                                     (eq custom-buffer-order-groups 'last)))
+                 prev-type
                  children)
-            (setq children
-                  (mapcar
-                   (lambda (entry)
-                     (widget-insert "\n")
-                     (progress-reporter-update reporter (setq count (1+ count)))
-                     (let ((sym (nth 0 entry))
-                           (type (nth 1 entry)))
-                       (prog1
-                           (widget-create-child-and-convert
-                            widget type
-                            :group widget
-                            :tag (custom-unlispify-tag-name sym)
-                            :custom-prefixes custom-prefix-list
-                            :custom-level (1+ level)
-                            :value sym)
-                         (unless (eq (preceding-char) ?\n)
-                           (widget-insert "\n")))))
-                   members))
+
+            (dolist (entry members)
+              (unless (eq prev-type 'custom-group)
+                (widget-insert "\n"))
+              (progress-reporter-update reporter (setq count (1+ count)))
+              (let ((sym (nth 0 entry))
+                    (type (nth 1 entry)))
+                (when (and have-subtitle (eq type 'custom-group))
+                  (setq have-subtitle nil)
+                  (widget-insert
+                   (propertize "Subgroups:\n" 'face 'custom-group-subtitle)))
+                (setq prev-type type)
+                (push (widget-create-child-and-convert
+                       widget type
+                       :group widget
+                       :tag (custom-unlispify-tag-name sym)
+                       :custom-prefixes custom-prefix-list
+                       :custom-level (1+ level)
+                       :value sym)
+                      children)
+                (unless (eq (preceding-char) ?\n)
+                  (widget-insert "\n"))))
+
+            (setq children (nreverse children))
             (mapc 'custom-magic-reset children)
             (widget-put widget :children children)
             (custom-group-state-update widget)
@@ -4267,7 +4216,7 @@ If GROUPS-ONLY non-nil, return only those members that are groups."
     ("Undo Edits" custom-group-reset-current
      (lambda (widget)
        (memq (widget-get widget :custom-state) '(modified))))
-    ("Reset to Saved" custom-group-reset-saved
+    ("Revert This Session's Customizations" custom-group-reset-saved
      (lambda (widget)
        (memq (widget-get widget :custom-state) '(modified set))))
     ,@(when (or custom-file init-file-user)
@@ -4417,7 +4366,7 @@ if only the first line of the docstring is shown."))
       ;; sense.
       (if no-error
          nil
-       (error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
+       (user-error "Saving settings from \"emacs -q\" would overwrite existing customizations"))
     (file-chase-links (or custom-file user-init-file))))
 
 ;; If recentf-mode is non-nil, this is defined.
@@ -4828,6 +4777,7 @@ If several parents are listed, go to the first of them."
     (set (make-local-variable 'widget-link-suffix) ""))
   (setq show-trailing-whitespace nil))
 
+(define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.1")
 (define-derived-mode Custom-mode nil "Custom"
   "Major mode for editing customization buffers.
 
@@ -4876,20 +4826,8 @@ if that value is non-nil."
   (Custom-mode))
 (make-obsolete 'custom-mode 'Custom-mode "23.1")
 (put 'custom-mode 'mode-class 'special)
-(define-obsolete-variable-alias 'custom-mode-hook 'Custom-mode-hook "23.1")
 
-(dolist (regexp
-        '("^No user option defaults have been changed since Emacs "
-          "^Invalid face:? "
-          "^No \\(?:customized\\|rogue\\|saved\\) user options"
-          "^No customizable items matching "
-          "^There are unset changes"
-          "^Cannot set hidden variable"
-          "^No \\(?:saved\\|backup\\) value for "
-          "^No standard setting known for "
-          "^No standard setting for this face"
-          "^Saving settings from \"emacs -q\" would overwrite existing customizations"))
-  (add-to-list 'debug-ignored-errors regexp))
+(add-to-list 'debug-ignored-errors "^Invalid face:? ")
 
 ;;; The End.
 
index d725111b6fdddcdd6bc2699428d4ffb21ab20a74..3680a2648ce855b5ffda71e66be8e445d6fbcbf3 100644 (file)
      (choice :tag "Underline"
             :help-echo "Control text underlining."
             (const :tag "Off" nil)
-            (const :tag "On" t)
-            (color :tag "Colored")))
+            (list :tag "On"
+                  (const :format "" :value :color)
+                  (choice :tag "Color" (const :tag "Foreground Color" foreground-color) color)
+                   (const :format "" :value :style)
+                   (choice :tag "Style"
+                           (const :tag "Line" line)
+                           (const :tag "Wave" wave)))))
 
     (:overline
      (choice :tag "Overline"
index fbba49951d13ae4dc390d195b5e5e4313fe06b1e..c5f7f5b3d31edd56d3a451dd8afcc981a3997a9b 100644 (file)
@@ -1,7 +1,7 @@
 ;;; cus-start.el --- define customization properties of builtins
-;;
-;; Copyright (C) 1997, 1999-2012  Free Software Foundation, Inc.
-;;
+
+;; Copyright (C) 1997, 1999-2012 Free Software Foundation, Inc.
+
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Keywords: internal
 ;; Package: emacs
@@ -22,7 +22,7 @@
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
-;;
+
 ;; This file adds customize support for built-in variables.
 
 ;; While dumping Emacs, this file is loaded, but it only records
@@ -48,6 +48,7 @@
 ;; :tag - custom-tag property
 (let ((all '(;; alloc.c
             (gc-cons-threshold alloc integer)
+            (gc-cons-percentage alloc float)
             (garbage-collection-messages alloc boolean)
             ;; buffer.c
             (mode-line-format mode-line sexp) ;Hard to do right.
@@ -132,15 +133,25 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
             (exec-path execute
                        (repeat (choice (const :tag "default directory" nil)
                                        (directory :format "%v"))))
+            (exec-suffixes execute (repeat string))
             ;; charset.c
             (charset-map-path installation
                               (repeat (directory :format "%v")))
             ;; coding.c
             (inhibit-eol-conversion mule boolean)
             (eol-mnemonic-undecided mule string)
-            (eol-mnemonic-unix mule string)
-            (eol-mnemonic-dos mule string)
-            (eol-mnemonic-mac mule string)
+            ;; startup.el fiddles with the values.  IMO, would be
+            ;; simpler to just use #ifdefs in coding.c.
+            (eol-mnemonic-unix mule string nil
+                               :standard
+                               (if (memq system-type '(ms-dos windows-nt))
+                                   "(Unix)" ":"))
+            (eol-mnemonic-dos mule string nil
+                              :standard
+                              (if (memq system-type '(ms-dos windows-nt))
+                                  "\\" "(DOS)"))
+            (eol-mnemonic-mac mule string nil
+                              :standard "(Mac)")
             (file-coding-system-alist
              mule
              (alist
@@ -165,6 +176,13 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
             (inverse-video display boolean)
             (visible-bell display boolean)
             (no-redraw-on-reenter display boolean)
+
+            ;; dosfns.c
+            (dos-display-scancodes display boolean)
+            (dos-hyper-key keyboard integer)
+            (dos-super-key keyboard integer)
+            (dos-keypad-mode keyboard integer)
+
             ;; editfns.c
             (user-full-name mail string)
             ;; eval.c
@@ -181,10 +199,12 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
                                     (const :tag "always" t)))
             (debug-ignored-errors debug (repeat (choice symbol regexp)))
             (debug-on-quit debug boolean)
-             ;; fileio.c
-             (delete-by-moving-to-trash auto-save boolean "23.1")
+            (debug-on-signal debug boolean)
+            ;; fileio.c
+            (delete-by-moving-to-trash auto-save boolean "23.1")
             (auto-save-visited-file-name auto-save boolean)
             ;; filelock.c
+            (create-lockfiles files boolean "24.2")
             (temporary-file-directory
              ;; Darwin section added 24.1, does not seem worth :version bump.
              files directory nil
@@ -218,6 +238,8 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
             (use-dialog-box menu boolean "21.1")
             (use-file-dialog menu boolean "22.1")
             (focus-follows-mouse frames boolean "20.3")
+            ;; fontset.c
+            (vertical-centering-font-regexp display regexp)
             ;; frame.c
             (default-frame-alist frames
               (repeat (cons :format "%v"
@@ -260,9 +282,6 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
                                            (const :tag "only shift-selection or mouse-drag" only)
                                            (const :tag "off" nil))
                                    "24.1")
-            (suggest-key-bindings keyboard (choice (const :tag "off" nil)
-                                                   (integer :tag "time" 2)
-                                                   (other :tag "on")))
              (debug-on-event debug
                              (choice (const :tag "None" nil)
                                      (const :tag "When sent SIGUSR1" sigusr1)
@@ -413,6 +432,7 @@ since it could result in memory overflow and make Emacs crash."
             (hscroll-margin windows integer "22.1")
             (hscroll-step windows number "22.1")
             (truncate-partial-width-windows display boolean "23.1")
+            (make-cursor-line-fully-visible windows boolean)
             (mode-line-inverse-video mode-line boolean)
             (mode-line-in-non-selected-windows mode-line boolean "22.1")
             (line-number-display-limit display
@@ -440,13 +460,24 @@ since it could result in memory overflow and make Emacs crash."
                      (const :tag "Both" :value both)
                      (const :tag "Both-horiz" :value both-horiz)
                      (const :tag "Text-image-horiz" :value text-image-horiz)
-                     (const :tag "System default" :value nil)) "23.3")
-             (tool-bar-max-label-size frames integer "23.3")
+                     (const :tag "System default" :value nil)) "24.1")
+             (tool-bar-max-label-size frames integer "24.1")
             (auto-hscroll-mode scrolling boolean "21.1")
+            (void-text-area-pointer cursor
+                                    (choice
+                                     (const :tag "Standard (text pointer)" :value nil)
+                                     (const :tag "Arrow" :value arrow)
+                                     (const :tag "Text pointer" :value text)
+                                     (const :tag "Hand" :value hand)
+                                     (const :tag "Vertical dragger" :value vdrag)
+                                     (const :tag "Horizontal dragger" :value hdrag)
+                                     (const :tag "Same as mode line" :value modeline)
+                                     (const :tag "Hourglass" :value hourglass)))
             (display-hourglass cursor boolean)
             (hourglass-delay cursor number)
 
             ;; xfaces.c
+            (font-list-limit display integer)
             (scalable-fonts-allowed display boolean "22.1")
             ;; xfns.c
             (x-bitmap-file-path installation
@@ -518,6 +549,10 @@ since it could result in memory overflow and make Emacs crash."
                      ;; the condition for loadup.el to preload tool-bar.el.
                      ((string-match "tool-bar-" (symbol-name symbol))
                       (fboundp 'x-create-frame))
+                     ((equal "vertical-centering-font-regexp"
+                             (symbol-name symbol))
+                      ;; Any function from fontset.c will do.
+                      (fboundp 'new-fontset))
                      (t t))))
     (if (not (boundp symbol))
        ;; If variables are removed from C code, give an error here!
index 71dcfb424e5d369d71f076d94a64f95f39229223..edb7fe2eaadfb54abc17c49dc87d56cfec4039b2 100644 (file)
@@ -120,7 +120,9 @@ the :set function.
 For variables in preloaded files, you can simply use this
 function for the :initialize property.  For autoloaded variables,
 you will also need to add an autoload stanza calling this
-function, and another one setting the standard-value property."
+function, and another one setting the standard-value property.
+Or you can wrap the defcustom in a progn, to force the autoloader
+to include all of it."            ; see eg vc-sccs-search-project-dir
   ;; No longer true:
   ;; "See `send-mail-function' in sendmail.el for an example."
 
@@ -335,7 +337,7 @@ for more information."
          ;; expression is checked by the byte-compiler, and that
          ;; lexical-binding is obeyed, so quote the expression with
          ;; `lambda' rather than with `quote'.
-         `(list (lambda () ,standard))
+         ``(funcall #',(lambda () ,standard))
        `',standard)
     ,doc
     ,@args))
@@ -599,15 +601,17 @@ If NOSET is non-nil, don't bother autoloading LOAD when setting the variable."
   (put symbol 'custom-autoload (if noset 'noset t))
   (custom-add-load symbol load))
 
-;; This test is also in the C code of `user-variable-p'.
 (defun custom-variable-p (variable)
   "Return non-nil if VARIABLE is a customizable variable.
 A customizable variable is either (i) a variable whose property
 list contains a non-nil `standard-value' or `custom-autoload'
 property, or (ii) an alias for another customizable variable."
-  (setq variable (indirect-variable variable))
-  (or (get variable 'standard-value)
-      (get variable 'custom-autoload)))
+  (when (symbolp variable)
+    (setq variable (indirect-variable variable))
+    (or (get variable 'standard-value)
+       (get variable 'custom-autoload))))
+
+(define-obsolete-function-alias 'user-variable-p 'custom-variable-p "24.2")
 
 (defun custom-note-var-changed (variable)
   "Inform Custom that VARIABLE has been set (changed).
@@ -1046,6 +1050,7 @@ The optional argument DOC is a doc string describing the theme.
 
 Any theme `foo' should be defined in a file called `foo-theme.el';
 see `custom-make-theme-feature' for more information."
+  (declare (doc-string 2))
   (let ((feature (custom-make-theme-feature theme)))
     ;; It is better not to use backquote in this file,
     ;; because that makes a bootstrapping problem
index c5b370bfa61d8b33633df5f03fddcfbbb36fec4d..ab886edac25de810798572bc9fb7b40228fa8ae6 100644 (file)
@@ -361,6 +361,13 @@ this list."
 ;;??? Do we want this?
 ;;;###autoload (define-key esc-map [?\C-/] 'dabbrev-completion)
 
+(defun dabbrev--ignore-case-p (abbrev)
+  (and (if (eq dabbrev-case-fold-search 'case-fold-search)
+           case-fold-search
+         dabbrev-case-fold-search)
+       (or (not dabbrev-upcase-means-case-search)
+           (string= abbrev (downcase abbrev)))))
+
 ;;;###autoload
 (defun dabbrev-completion (&optional arg)
   "Completion on current word.
@@ -381,12 +388,7 @@ then it searches *all* buffers."
         (abbrev (dabbrev--abbrev-at-point))
          (beg (progn (search-backward abbrev) (point)))
          (end (progn (search-forward abbrev) (point)))
-        (ignore-case-p
-          (and (if (eq dabbrev-case-fold-search 'case-fold-search)
-                   case-fold-search
-                 dabbrev-case-fold-search)
-               (or (not dabbrev-upcase-means-case-search)
-                   (string= abbrev (downcase abbrev)))))
+        (ignore-case-p (dabbrev--ignore-case-p abbrev))
         (list 'uninitialized)
          (table
           (lambda (s p a)
@@ -404,10 +406,10 @@ then it searches *all* buffers."
                          (dabbrev--find-all-expansions abbrev ignore-case-p))
                         (completion-ignore-case ignore-case-p))
                     (or (consp completion-list)
-                        (error "No dynamic expansion for \"%s\" found%s"
-                               abbrev
-                               (if dabbrev--check-other-buffers
-                                   "" " in this-buffer")))
+                        (user-error "No dynamic expansion for \"%s\" found%s"
+                                    abbrev
+                                    (if dabbrev--check-other-buffers
+                                        "" " in this-buffer")))
                     (setq list
                           (cond
                            ((not (and ignore-case-p dabbrev-case-replace))
@@ -514,11 +516,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
          (setq expansion
                (dabbrev--find-expansion
                  abbrev direction
-                 (and (if (eq dabbrev-case-fold-search 'case-fold-search)
-                          case-fold-search
-                        dabbrev-case-fold-search)
-                      (or (not dabbrev-upcase-means-case-search)
-                          (string= abbrev (downcase abbrev))))))))
+                 (dabbrev--ignore-case-p abbrev)))))
     (cond
      ((not expansion)
       (dabbrev--reset-global-variables)
@@ -529,8 +527,8 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion]."
            (search-backward old)
            (insert abbrev)
            (delete-region (point) (+ (point) (length old)))))
-      (error "No%s dynamic expansion for `%s' found"
-            (if old " further" "") abbrev))
+      (user-error "No%s dynamic expansion for `%s' found"
+                  (if old " further" "") abbrev))
      (t
       (if (not (or (eq dabbrev--last-buffer dabbrev--last-buffer-found)
                   (minibuffer-window-active-p (selected-window))))
@@ -587,7 +585,7 @@ all skip characters."
   "Extract the symbol at point to serve as abbreviation."
   ;; Check for error
   (if (bobp)
-      (error "No possible abbreviation preceding point"))
+      (user-error "No possible abbreviation preceding point"))
   ;; Return abbrev at point
   (save-excursion
     ;; Record the end of the abbreviation.
@@ -605,7 +603,7 @@ all skip characters."
                                      "\\sw\\|\\s_")
                                  nil t)
              (forward-char 1)
-           (error "No possible abbreviation preceding point"))))
+           (user-error "No possible abbreviation preceding point"))))
     ;; Now find the beginning of that one.
     (dabbrev--goto-start-of-abbrev)
     (buffer-substring-no-properties
@@ -820,11 +818,7 @@ RECORD-CASE-PATTERN, if non-nil, means set `dabbrev--last-case-pattern'
 to record whether we upcased the expansion, downcased it, or did neither."
   ;;(undo-boundary)
   (let ((use-case-replace
-         (and (if (eq dabbrev-case-fold-search 'case-fold-search)
-                  case-fold-search
-                dabbrev-case-fold-search)
-              (or (not dabbrev-upcase-means-case-search)
-                  (string= abbrev (downcase abbrev)))
+         (and (dabbrev--ignore-case-p abbrev)
               (if (eq dabbrev-case-replace 'case-replace)
                   case-replace
                 dabbrev-case-replace))))
@@ -980,11 +974,6 @@ Leaves point at the location of the start of the expansion."
                (cons found-string dabbrev--last-table))
          result)))))
 
-(dolist (mess '("^No dynamic expansion for .* found"
-               "^No further dynamic expansion for .* found$"
-               "^No possible abbreviation preceding point$"))
-  (add-to-list 'debug-ignored-errors mess))
-
 (provide 'dabbrev)
 
 ;;; dabbrev.el ends here
index d2995ab790d1c5325ba2d5a9c020ebf0fe6af2c5..bcb95a54ad6da90c6a81f00e65ef9c9ae5c6a053 100644 (file)
@@ -597,7 +597,10 @@ relevant to POS."
                                  `(insert-text-button
                                    ,current-input-method
                                    'type 'help-input-method
-                                   'help-args '(,current-input-method)))))))
+                                   'help-args '(,current-input-method))
+                                "input method")
+                        (list
+                         "type \"C-x 8 RET HEX-CODEPOINT\" or \"C-x 8 RET NAME\"")))))
               ("buffer code"
                ,(if multibyte-p
                     (encoded-string-description
@@ -806,7 +809,7 @@ relevant to POS."
                             (format "  %s: %s\n" elt val)))))))
 
           (if text-props-desc (insert text-props-desc))
-          (toggle-read-only 1))))))
+          (setq buffer-read-only t))))))
 
 (define-obsolete-function-alias 'describe-char-after 'describe-char "22.1")
 
index ce3efb09a743730262ec06d5041955a5f2cb272f..2c2106e18b7ffbbe11f50b97fb724d56f8de1731 100644 (file)
@@ -145,6 +145,8 @@ backward compatibility.")
   "Save status of Emacs when you exit."
   :group 'frames)
 
+;; Maintained for backward compatibility
+(define-obsolete-variable-alias 'desktop-enable 'desktop-save-mode "22.1")
 ;;;###autoload
 (define-minor-mode desktop-save-mode
   "Toggle desktop saving (Desktop Save mode).
@@ -158,10 +160,6 @@ one session to another.  See variable `desktop-save' and function
   :global t
   :group 'desktop)
 
-;; Maintained for backward compatibility
-(define-obsolete-variable-alias 'desktop-enable
-                                'desktop-save-mode "22.1")
-
 (defun desktop-save-mode-off ()
   "Disable `desktop-save-mode'.  Provided for use in hooks."
   (desktop-save-mode 0))
@@ -222,7 +220,7 @@ the normal hook `desktop-not-loaded-hook' is run."
   :group 'desktop
   :version "22.2")
 
-(defcustom desktop-path (list "." user-emacs-directory "~")
+(defcustom desktop-path (list user-emacs-directory "~")
   "List of directories to search for the desktop file.
 The base name of the file is specified in `desktop-base-file-name'."
   :type '(repeat directory)
@@ -412,8 +410,7 @@ is passed as the argument DESKTOP-BUFFER-MISC to functions in
                         'desktop-save-buffer "22.1")
 
 ;;;###autoload
-(defvar desktop-buffer-mode-handlers
-  nil
+(defvar desktop-buffer-mode-handlers nil
   "Alist of major mode specific functions to restore a desktop buffer.
 Functions listed are called by `desktop-create-buffer' when `desktop-read'
 evaluates the desktop file.  List elements must have the form
@@ -473,8 +470,7 @@ this table.  See also `desktop-minor-mode-handlers'."
   :group 'desktop)
 
 ;;;###autoload
-(defvar desktop-minor-mode-handlers
-  nil
+(defvar desktop-minor-mode-handlers nil
   "Alist of functions to restore non-standard minor modes.
 Functions are called by `desktop-create-buffer' to restore minor modes.
 List elements must have the form
@@ -970,8 +966,8 @@ It returns t if a desktop file was loaded, nil otherwise."
                (and dirs (car dirs)))
              ;; If not found and `desktop-path' is non-nil, use its first element.
              (and desktop-path (car desktop-path))
-             ;; Default: Home directory.
-             "~"))))
+             ;; Default: .emacs.d.
+             user-emacs-directory))))
     (if (file-exists-p (desktop-full-file-name))
        ;; Desktop file found, but is it already in use?
        (let ((desktop-first-buffer nil)
@@ -983,6 +979,7 @@ It returns t if a desktop file was loaded, nil otherwise."
          (if (and owner
                   (memq desktop-load-locked-desktop '(nil ask))
                   (or (null desktop-load-locked-desktop)
+                      (daemonp)
                       (not (y-or-n-p (format "Warning: desktop file appears to be in use by PID %s.\n\
 Using it may cause conflicts.  Use it anyway? " owner)))))
              (let ((default-directory desktop-dirname))
index d3356197a2b12664440f88d64cf2e38015e8174f..59849e98c9ea9a69ce13405591cb0ca58cada4e6 100644 (file)
@@ -157,22 +157,22 @@ selected frame and the focus will change to that frame."
   :type 'hook)
 
 (defvar dframe-track-mouse-function nil
-  "*A function to call when the mouse is moved in the given frame.
+  "A function to call when the mouse is moved in the given frame.
 Typically used to display info about the line under the mouse.")
 (make-variable-buffer-local 'dframe-track-mouse-function)
 
 (defvar dframe-help-echo-function nil
-  "*A function to call when help-echo is used in newer versions of Emacs.
+  "A function to call when help-echo is used in newer versions of Emacs.
 Typically used to display info about the line under the mouse.")
 (make-variable-buffer-local 'dframe-help-echo-function)
 
 (defvar dframe-mouse-click-function nil
-  "*A function to call when the mouse is clicked.
+  "A function to call when the mouse is clicked.
 Valid clicks are mouse 2, our double mouse 1.")
 (make-variable-buffer-local 'dframe-mouse-click-function)
 
 (defvar dframe-mouse-position-function nil
-  "*A function to call to position the cursor for a mouse click.")
+  "A function to call to position the cursor for a mouse click.")
 (make-variable-buffer-local 'dframe-mouse-position-function)
 
 (defvar dframe-power-click nil
@@ -516,7 +516,7 @@ LOCATION can be one of 'random, 'left-right, or 'top-bottom."
 (defun dframe-needed-height (&optional frame)
   "The needed height for the tool bar FRAME (in characters)."
   (or frame (setq frame (selected-frame)))
-  ;; The 1 is the missing modeline/minibuffer
+  ;; The 1 is the missing mode line or minibuffer
   (+ 1 (/ (frame-pixel-height frame)
          ;; This obscure code avoids a byte compiler warning in Emacs.
          (let ((f 'face-height))
@@ -969,7 +969,7 @@ broken because of the dedicated frame."
       (switch-to-buffer buffer)
     (call-interactively 'switch-to-buffer nil nil)))
 
-;; XEmacs: this can be implemented using modeline keymaps, but there
+;; XEmacs: this can be implemented using mode line keymaps, but there
 ;; is no use, as we have horizontal scrollbar (as the docstring
 ;; hints.)
 (defun dframe-mouse-hscroll (e)
@@ -987,8 +987,7 @@ mode-line.  This is only useful for non-XEmacs."
          ((> click-col (- (window-width) 5))
           (scroll-right 2))
          (t (dframe-message
-             "Click on the edge of the modeline to scroll left/right")))
-    ))
+             "Click on the edge of the mode line to scroll left/right")))))
 
 (provide 'dframe)
 
index 0795b0175a2a788898d95d62006742ba2bfa6cdb..ffd93a85ee8ff5f277e409f01fab3bbe1c211d0c 100644 (file)
@@ -245,7 +245,11 @@ List has a form of (file-name full-file-name (attribute-list))."
                             " (default now): "
                           ": ")))
         (new-attribute (dired-mark-read-string prompt nil op-symbol
-                                               arg files default))
+                                               arg files default
+                                               (cond ((eq op-symbol 'chown)
+                                                      (system-users))
+                                                     ((eq op-symbol 'chgrp)
+                                                      (system-groups)))))
         (operation (concat program " " new-attribute))
         failures)
     (setq failures
@@ -385,23 +389,25 @@ Uses the shell command coming from variables `lpr-command' and
     (dired-run-shell-command (dired-shell-stuff-it command file-list nil))))
 
 (defun dired-mark-read-string (prompt initial op-symbol arg files
-                              &optional default-value)
+                              &optional default-value collection)
   "Read args for a Dired marked-files command, prompting with PROMPT.
 Return the user input (a string).
 
 INITIAL, if non-nil, is the initial minibuffer input.
 OP-SYMBOL is an operation symbol (see `dired-no-confirm').
-ARG is normally the prefix argument for the calling command.
-FILES should be a list of file names.
+ARG is normally the prefix argument for the calling command;
+it is passed as the first argument to `dired-mark-prompt'.
+FILES should be a list of marked files' names.
 
-DEFAULT-VALUE, if non-nil, should be a \"standard\" value or list
-of such values, available via history commands.  Note that if the
-user enters empty input, this function returns the empty string,
-not DEFAULT-VALUE."
+Optional arg DEFAULT-VALUE is a default value or list of default
+values, passed as the seventh arg to `completing-read'.
+
+Optional arg COLLECTION is a collection of possible completions,
+passed as the second arg to `completing-read'."
   (dired-mark-pop-up nil op-symbol files
-                    'read-from-minibuffer
+                    'completing-read
                     (format prompt (dired-mark-prompt arg files))
-                    initial nil nil nil default-value))
+                    collection nil nil initial nil default-value nil))
 \f
 ;;; Cleaning a directory: flagging some backups for deletion.
 
@@ -1401,9 +1407,9 @@ NAME-CONSTRUCTOR should be a function accepting a single
 argument, the name of an old file, and returning either the
 corresponding new file name or nil to skip.
 
-Optional MARKER-CHAR is a character with which to mark every
-newfile's entry, or t to use the current marker character if the
-old file was marked."
+If optional argument MARKER-CHAR is non-nil, mark each
+newly-created file's Dired entry with the character MARKER-CHAR,
+or with the current marker character if MARKER-CHAR is t."
   (let (dired-create-files-failures failures
        skipped (success-count 0) (total (length fn-list)))
     (let (to overwrite-query
@@ -1506,10 +1512,11 @@ ESC or `q' to not overwrite any of the remaining files,
                                        &optional marker-char op1
                                        how-to)
   "Create a new file for each marked file.
-Prompts user for target, which is a directory in which to create
-  the new files.  Target may also be a plain file if only one marked
-  file exists.  The way the default for the target directory is
-  computed depends on the value of `dired-dwim-target-directory'.
+Prompt user for a target directory in which to create the new
+  files.  The target may also be a non-directory file, if only
+  one file is marked.  The initial suggestion for target is the
+  Dired buffer's current directory (or, if `dired-dwim-target' is
+  non-nil, the current directory of a neighboring Dired window).
 OP-SYMBOL is the symbol for the operation.  Function `dired-mark-pop-up'
   will determine whether pop-ups are appropriate for this OP-SYMBOL.
 FILE-CREATOR and OPERATION as in `dired-create-files'.
@@ -1714,16 +1721,21 @@ See HOW-TO argument for `dired-do-create-files'.")
 ;;;###autoload
 (defun dired-do-copy (&optional arg)
   "Copy all marked (or next ARG) files, or copy the current file.
-This normally preserves the last-modified date when copying.
-When operating on just the current file, you specify the new name.
-When operating on multiple or marked files, you specify a directory,
-and new copies of these files are made in that directory
-with the same names that the files currently have.  The default
-suggested for the target directory depends on the value of
-`dired-dwim-target', which see.
+When operating on just the current file, prompt for the new name.
 
-This command copies symbolic links by creating new ones,
-like `cp -d'."
+When operating on multiple or marked files, prompt for a target
+directory, and make the new copies in that directory, with the
+same names as the original files.  The initial suggestion for the
+target directory is the Dired buffer's current directory (or, if
+`dired-dwim-target' is non-nil, the current directory of a
+neighboring Dired window).
+
+If `dired-copy-preserve-time' is non-nil, this command preserves
+the modification time of each old file in the copy, similar to
+the \"-p\" option for the \"cp\" shell command.
+
+This command copies symbolic links by creating new ones, similar
+to the \"-d\" option for the \"cp\" shell command."
   (interactive "P")
   (let ((dired-recursive-copies dired-recursive-copies))
     (dired-do-create-files 'copy (function dired-copy-file)
@@ -1989,9 +2001,10 @@ See Info node `(emacs)Subdir switches' for more details."
 
 ;;;###autoload
 (defun dired-insert-subdir (dirname &optional switches no-error-if-not-dir-p)
-  "Insert this subdirectory into the same dired buffer.
-If it is already present, overwrites previous entry,
-  else inserts it at its natural place (as `ls -lR' would have done).
+  "Insert this subdirectory into the same Dired buffer.
+If it is already present, overwrite the previous entry;
+  otherwise, insert it at its natural place (as `ls -lR' would
+  have done).
 With a prefix arg, you may edit the `ls' switches used for this listing.
   You can add `R' to the switches to expand the whole tree starting at
   this subdirectory.
index b45a340706f864c4b50555c4c78804f25214558a..f176cf7dbe0c5c3b73b714210b789ab041516e8d 100644 (file)
@@ -132,6 +132,8 @@ If nil, there is no maximum size."
   :type '(choice (const :tag "no maximum" nil) integer)
   :group 'dired-x)
 
+;; For backward compatibility
+(define-obsolete-variable-alias 'dired-omit-files-p 'dired-omit-mode "22.1")
 (define-minor-mode dired-omit-mode
   "Toggle omission of uninteresting files in Dired (Dired-Omit mode).
 With a prefix argument ARG, enable Dired-Omit mode if ARG is
@@ -157,9 +159,6 @@ See Info node `(dired-x) Omitting Variables' for more information."
 
 (put 'dired-omit-mode 'safe-local-variable 'booleanp)
 
-;; For backward compatibility
-(define-obsolete-variable-alias 'dired-omit-files-p 'dired-omit-mode "22.1")
-
 (defcustom dired-omit-files "^\\.?#\\|^\\.$\\|^\\.\\.$"
   "Filenames matching this regexp will not be displayed.
 This only has effect when `dired-omit-mode' is t.  See interactive function
@@ -801,8 +800,8 @@ See also `dired-enable-local-variables'."
                (hack-local-variables))
            ;; Delete this stuff: `eobp' is used to find last subdir by dired.el.
            (delete-region opoint (point-max)))
-         ;; Make sure that the modeline shows the proper information.
-         (dired-sort-set-modeline))))
+         ;; Make sure that the mode line shows the proper information.
+         (dired-sort-set-mode-line))))
 
 (make-obsolete 'dired-hack-local-variables
                'hack-dir-local-variables-non-file-buffer "24.1")
index d322752e15f336c97c454543da85c5174e23f4de..0e770773197b839af9ed71af868c11c8f2b11317 100644 (file)
@@ -34,8 +34,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;;; Customizable variables
 
 (defgroup dired nil
@@ -170,8 +168,9 @@ If a character, new links are unconditionally marked with that character."
 
 (defcustom dired-dwim-target nil
   "If non-nil, Dired tries to guess a default target directory.
-This means: if there is a dired buffer displayed in the next window,
-use its current subdir, instead of the current subdir of this dired buffer.
+This means: if there is a Dired buffer displayed in the next
+window, use its current directory, instead of this Dired buffer's
+current directory.
 
 The target is used in the prompt for file copy, rename etc."
   :type 'boolean
@@ -670,31 +669,31 @@ Don't use that together with FILTER."
 ;;         (dolist (ext completion-ignored-extensions)
 ;;           (if (eq ?/ (aref ext (1- (length ext)))) (push ext cie)))
 ;;         (setq cie (concat (regexp-opt cie "\\(?:") "\\'"))
-;;         (lexical-let* ((default (and buffer-file-name
-;;                                      (abbreviate-file-name buffer-file-name)))
-;;                        (cie cie)
-;;                        (completion-table
-;;                         ;; We need a mix of read-file-name and
-;;                         ;; read-directory-name so that completion to directories
-;;                         ;; is preferred, but if the user wants to enter a global
-;;                         ;; pattern, he can still use completion on filenames to
-;;                         ;; help him write the pattern.
-;;                         ;; Essentially, we want to use
-;;                         ;; (completion-table-with-predicate
-;;                         ;;  'read-file-name-internal 'file-directory-p nil)
-;;                         ;; but that doesn't work because read-file-name-internal
-;;                         ;; does not obey its `predicate' argument.
-;;                         (completion-table-in-turn
-;;                          (lambda (str pred action)
-;;                            (let ((read-file-name-predicate
-;;                                   (lambda (f)
-;;                                     (and (not (member f '("./" "../")))
-;;                                          ;; Hack! Faster than file-directory-p!
-;;                                          (eq (aref f (1- (length f))) ?/)
-;;                                          (not (string-match cie f))))))
-;;                              (complete-with-action
-;;                               action 'read-file-name-internal str nil)))
-;;                          'read-file-name-internal)))
+;;         (let* ((default (and buffer-file-name
+;;                              (abbreviate-file-name buffer-file-name)))
+;;                (cie cie)
+;;                (completion-table
+;;                 ;; We need a mix of read-file-name and
+;;                 ;; read-directory-name so that completion to directories
+;;                 ;; is preferred, but if the user wants to enter a global
+;;                 ;; pattern, he can still use completion on filenames to
+;;                 ;; help him write the pattern.
+;;                 ;; Essentially, we want to use
+;;                 ;; (completion-table-with-predicate
+;;                 ;;  'read-file-name-internal 'file-directory-p nil)
+;;                 ;; but that doesn't work because read-file-name-internal
+;;                 ;; does not obey its `predicate' argument.
+;;                 (completion-table-in-turn
+;;                  (lambda (str pred action)
+;;                    (let ((read-file-name-predicate
+;;                           (lambda (f)
+;;                             (and (not (member f '("./" "../")))
+;;                                  ;; Hack! Faster than file-directory-p!
+;;                                  (eq (aref f (1- (length f))) ?/)
+;;                                  (not (string-match cie f))))))
+;;                      (complete-with-action
+;;                       action 'read-file-name-internal str nil)))
+;;                  'read-file-name-internal)))
 ;;           (minibuffer-with-setup-hook
 ;;               (lambda ()
 ;;                 (setq minibuffer-default default)
@@ -1957,15 +1956,14 @@ You can use it to recover marks, killed lines or subdirs."
 Actual changes in files cannot be undone by Emacs."))
 
 (defun dired-toggle-read-only ()
-  "Edit dired buffer with Wdired, or set it read-only.
-Call `wdired-change-to-wdired-mode' in dired buffers whose editing is
-supported by Wdired (the major mode of the dired buffer is `dired-mode').
-Otherwise, for buffers inheriting from dired-mode, call `toggle-read-only'."
+  "Edit Dired buffer with Wdired, or make it read-only.
+If the current buffer can be edited with Wdired, (i.e. the major
+mode is `dired-mode'), call `wdired-change-to-wdired-mode'.
+Otherwise, call `toggle-read-only'."
   (interactive)
   (if (eq major-mode 'dired-mode)
       (wdired-change-to-wdired-mode)
-    (with-no-warnings
-      (toggle-read-only))))
+    (toggle-read-only nil t)))
 
 (defun dired-next-line (arg)
   "Move down lines then position at filename.
@@ -2209,10 +2207,11 @@ Optional arg GLOBAL means to replace all matches."
   ;; dired-get-filename.
   (concat (or dir default-directory) file))
 
-(defun dired-make-relative (file &optional dir _ignore)
+(defun dired-make-relative (file &optional dir)
   "Convert FILE (an absolute file name) to a name relative to DIR.
-If this is impossible, return FILE unchanged.
-DIR must be a directory name, not a file name."
+If DIR is omitted or nil, it defaults to `default-directory'.
+If FILE is not in the directory tree of DIR, return FILE
+unchanged."
   (or dir (setq dir default-directory))
   ;; This case comes into play if default-directory is set to
   ;; use ~.
@@ -2220,8 +2219,6 @@ DIR must be a directory name, not a file name."
       (setq dir (expand-file-name dir)))
   (if (string-match (concat "^" (regexp-quote dir)) file)
       (substring file (match-end 0))
-;;;  (or no-error
-;;;    (error "%s: not in directory tree growing at %s" file dir))
     file))
 \f
 ;;; Functions for finding the file name in a dired buffer line.
@@ -2467,8 +2464,6 @@ You can then feed the file name(s) to other commands with \\[yank]."
                                                  dired-subdir-alist))))
           cur-dir))))
 
-;(defun dired-get-subdir-min (elt)
-;  (cdr elt))
 ;; can't use macro,  must be redefinable for other alist format in dired-nstd.
 (defalias 'dired-get-subdir-min 'cdr)
 
@@ -2730,12 +2725,14 @@ Optional argument means return a file name relative to `default-directory'."
 ;; Deleting files
 
 (defcustom dired-recursive-deletes 'top
-  "Decide whether recursive deletes are allowed.
-A value of nil means no recursive deletes.
-`always' means delete recursively without asking.  This is DANGEROUS!
-`top' means ask for each directory at top level, but delete its subdirectories
-without asking.
-Anything else means ask for each directory."
+  "Whether Dired deletes directories recursively.
+If nil, Dired will not delete non-empty directories.
+`always' means to delete non-empty directories recursively,
+without asking.  This is dangerous!
+`top' means to ask for each top-level directory specified by the
+Dired deletion command, and delete its subdirectories without
+asking.
+Any other value means to ask for each directory."
   :type '(choice :tag "Delete non-empty directories"
                 (const :tag "Yes" always)
                 (const :tag "No--only delete empty directories" nil)
@@ -3460,9 +3457,9 @@ format, use `\\[universal-argument] \\[dired]'.")
   "Non-nil means the Dired sort command is disabled.
 The idea is to set this buffer-locally in special dired buffers.")
 
-(defun dired-sort-set-modeline ()
-  ;; Set modeline display according to dired-actual-switches.
-  ;; Modeline display of "by name" or "by date" guarantees the user a
+(defun dired-sort-set-mode-line ()
+  ;; Set mode line display according to dired-actual-switches.
+  ;; Mode line display of "by name" or "by date" guarantees the user a
   ;; match with the corresponding regexps.  Non-matching switches are
   ;; shown literally.
   (when (eq major-mode 'dired-mode)
@@ -3478,6 +3475,9 @@ The idea is to set this buffer-locally in special dired buffers.")
                   (concat "Dired " dired-actual-switches)))))
     (force-mode-line-update)))
 
+(define-obsolete-function-alias 'dired-sort-set-modeline
+  'dired-sort-set-mode-line "24.2")
+
 (defun dired-sort-toggle-or-edit (&optional arg)
   "Toggle sorting by date, and refresh the Dired buffer.
 With a prefix argument, edit the current listing switches instead."
@@ -3509,7 +3509,7 @@ With a prefix argument, edit the current listing switches instead."
     ;; Now, if we weren't sorting by date before, add the -t switch.
     (unless sorting-by-date
       (setq dired-actual-switches (concat dired-actual-switches " -t"))))
-  (dired-sort-set-modeline)
+  (dired-sort-set-mode-line)
   (revert-buffer))
 
 ;; Some user code loads dired especially for this.
@@ -3532,7 +3532,7 @@ set the minor mode accordingly, others appear literally in the mode line.
 With optional second arg NO-REVERT, don't refresh the listing afterwards."
   (dired-sort-R-check switches)
   (setq dired-actual-switches switches)
-  (dired-sort-set-modeline)
+  (dired-sort-set-mode-line)
   (or no-revert (revert-buffer)))
 
 (defvar dired-subdir-alist-pre-R nil
@@ -3574,11 +3574,11 @@ To be called first in body of `dired-sort-other', etc."
 ;;;;  Drag and drop support
 
 (defcustom dired-recursive-copies 'top
-  "Decide whether recursive copies are allowed.
-A value of nil means no recursive copies.
-`always' means copy recursively without asking.
-`top' means ask for each directory at top level.
-Anything else means ask for each directory."
+  "Whether Dired copies directories recursively.
+If nil, never copy recursively.
+`always' means to copy recursively without asking.
+`top' means to ask for each directory at top level.
+Any other value means to ask for each directory."
   :type '(choice :tag "Copy directories"
                 (const :tag "No recursive copies" nil)
                 (const :tag "Ask for each directory" t)
@@ -3736,7 +3736,7 @@ Ask means pop up a menu for the user to select one of copy, move or link."
 ;;;;;;  dired-run-shell-command dired-do-shell-command dired-do-async-shell-command
 ;;;;;;  dired-clean-directory dired-do-print dired-do-touch dired-do-chown
 ;;;;;;  dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff
-;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "58d623eb8e68e472e6164a1bcae83360")
+;;;;;;  dired-diff) "dired-aux" "dired-aux.el" "91d39bd8f7e9ce93dc752fe74bea78c2")
 ;;; Generated autoloads from dired-aux.el
 
 (autoload 'dired-diff "dired-aux" "\
@@ -3976,16 +3976,21 @@ If DIRECTORY already exists, signal an error.
 
 (autoload 'dired-do-copy "dired-aux" "\
 Copy all marked (or next ARG) files, or copy the current file.
-This normally preserves the last-modified date when copying.
-When operating on just the current file, you specify the new name.
-When operating on multiple or marked files, you specify a directory,
-and new copies of these files are made in that directory
-with the same names that the files currently have.  The default
-suggested for the target directory depends on the value of
-`dired-dwim-target', which see.
+When operating on just the current file, prompt for the new name.
+
+When operating on multiple or marked files, prompt for a target
+directory, and make the new copies in that directory, with the
+same names as the original files.  The initial suggestion for the
+target directory is the Dired buffer's current directory (or, if
+`dired-dwim-target' is non-nil, the current directory of a
+neighboring Dired window).
+
+If `dired-copy-preserve-time' is non-nil, this command preserves
+the modification time of each old file in the copy, similar to
+the \"-p\" option for the \"cp\" shell command.
 
-This command copies symbolic links by creating new ones,
-like `cp -d'.
+This command copies symbolic links by creating new ones, similar
+to the \"-d\" option for the \"cp\" shell command.
 
 \(fn &optional ARG)" t nil)
 
@@ -4088,9 +4093,10 @@ See Info node `(emacs)Subdir switches' for more details.
 \(fn DIRNAME &optional SWITCHES NO-ERROR-IF-NOT-DIR-P)" t nil)
 
 (autoload 'dired-insert-subdir "dired-aux" "\
-Insert this subdirectory into the same dired buffer.
-If it is already present, overwrites previous entry,
-  else inserts it at its natural place (as `ls -lR' would have done).
+Insert this subdirectory into the same Dired buffer.
+If it is already present, overwrite the previous entry;
+  otherwise, insert it at its natural place (as `ls -lR' would
+  have done).
 With a prefix arg, you may edit the `ls' switches used for this listing.
   You can add `R' to the switches to expand the whole tree starting at
   this subdirectory.
@@ -4200,7 +4206,7 @@ instead.
 ;;;***
 \f
 ;;;### (autoloads (dired-do-relsymlink dired-jump-other-window dired-jump)
-;;;;;;  "dired-x" "dired-x.el" "2a39a8306a5541c304bc4ab602876f92")
+;;;;;;  "dired-x" "dired-x.el" "d2461aa6efb8c1d7de8f245728ab448e")
 ;;; Generated autoloads from dired-x.el
 
 (autoload 'dired-jump "dired-x" "\
index 4f6236b240ebd2e554c97c17880c2a6284587b09..5e825032741b3e2dd62d1450634d034087c98169 100644 (file)
@@ -179,6 +179,8 @@ and ends with a forward slash."
     dir))
 
 
+(define-obsolete-function-alias 'dirtrack-toggle 'dirtrack-mode "23.1")
+(define-obsolete-variable-alias 'dirtrackp 'dirtrack-mode "23.1")
 ;;;###autoload
 (define-minor-mode dirtrack-mode
   "Toggle directory tracking in shell buffers (Dirtrack mode).
@@ -198,10 +200,10 @@ directory."
       (add-hook 'comint-preoutput-filter-functions 'dirtrack nil t)
     (remove-hook 'comint-preoutput-filter-functions 'dirtrack t)))
 
-(define-obsolete-function-alias 'dirtrack-toggle 'dirtrack-mode "23.1")
-(define-obsolete-variable-alias 'dirtrackp 'dirtrack-mode "23.1")
-
 
+(define-obsolete-function-alias 'dirtrack-debug-toggle 'dirtrack-debug-mode
+  "23.1")
+(define-obsolete-variable-alias 'dirtrack-debug 'dirtrack-debug-mode "23.1")
 (define-minor-mode dirtrack-debug-mode
   "Toggle Dirtrack debugging.
 With a prefix argument ARG, enable Dirtrack debugging if ARG is
@@ -211,11 +213,6 @@ the mode if ARG is omitted or nil."
   (if dirtrack-debug-mode
       (display-buffer (get-buffer-create dirtrack-debug-buffer))))
 
-(define-obsolete-function-alias 'dirtrack-debug-toggle 'dirtrack-debug-mode
-  "23.1")
-(define-obsolete-variable-alias 'dirtrack-debug 'dirtrack-debug-mode "23.1")
-
-
 (defun dirtrack-debug-message (msg1 msg2)
   "Insert strings at the end of `dirtrack-debug-buffer'."
   (when dirtrack-debug-mode
index 53e7811bad1e3c05505188b32bb2f1678a83506f..72b36feb1d8a090d00c1e5f431707104140e28d1 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'dired)
 (require 'image-mode)
 (require 'jka-compr)
@@ -259,9 +259,9 @@ of the page moves to the previous page."
       (setq ol nil))
     (if ol
         (progn
-          (assert (eq (overlay-buffer ol) (current-buffer)))
+          (cl-assert (eq (overlay-buffer ol) (current-buffer)))
           (setq ol (copy-overlay ol)))
-      (assert (not (get-char-property (point-min) 'display)))
+      (cl-assert (not (get-char-property (point-min) 'display)))
       (setq ol (make-overlay (point-min) (point-max) nil t))
       (overlay-put ol 'doc-view t))
     (overlay-put ol 'window (car winprops))
@@ -892,30 +892,30 @@ Start by converting PAGES, and then the rest."
 (defun doc-view-doc->txt (txt callback)
   "Convert the current document to text and call CALLBACK when done."
   (make-directory (doc-view-current-cache-dir) t)
-  (case doc-view-doc-type
-    (pdf
+  (pcase doc-view-doc-type
+    (`pdf
      ;; Doc is a PDF, so convert it to TXT
      (doc-view-pdf->txt doc-view-buffer-file-name txt callback))
-    (ps
+    (`ps
      ;; Doc is a PS, so convert it to PDF (which will be converted to
      ;; TXT thereafter).
      (let ((pdf (expand-file-name "doc.pdf"
                                  (doc-view-current-cache-dir))))
        (doc-view-ps->pdf doc-view-buffer-file-name pdf
                          (lambda () (doc-view-pdf->txt pdf txt callback)))))
-    (dvi
+    (`dvi
      ;; Doc is a DVI.  This means that a doc.pdf already exists in its
      ;; cache subdirectory.
      (doc-view-pdf->txt (expand-file-name "doc.pdf"
                                           (doc-view-current-cache-dir))
                         txt callback))
-    (odf
+    (`odf
      ;; Doc is some ODF (or MS Office) doc.  This means that a doc.pdf
      ;; already exists in its cache subdirectory.
      (doc-view-pdf->txt (expand-file-name "doc.pdf"
                                           (doc-view-current-cache-dir))
                         txt callback))
-    (t (error "DocView doesn't know what to do"))))
+    (_ (error "DocView doesn't know what to do"))))
 
 (defun doc-view-ps->pdf (ps pdf callback)
   "Convert PS to PDF asynchronously and call CALLBACK when finished."
@@ -950,23 +950,21 @@ Those files are saved in the directory given by the function
   (let ((png-file (expand-file-name "page-%d.png"
                                     (doc-view-current-cache-dir))))
     (make-directory (doc-view-current-cache-dir) t)
-    (case doc-view-doc-type
-      (dvi
+    (pcase doc-view-doc-type
+      (`dvi
        ;; DVI files have to be converted to PDF before Ghostscript can process
        ;; it.
        (let ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir)))
          (doc-view-dvi->pdf doc-view-buffer-file-name pdf
                             (lambda () (doc-view-pdf/ps->png pdf png-file)))))
-      (odf
+      (`odf
        ;; ODF files have to be converted to PDF before Ghostscript can
        ;; process it.
-       (lexical-let
-           ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))
-           (opdf (expand-file-name (concat (file-name-sans-extension
-                                            (file-name-nondirectory doc-view-buffer-file-name))
-                                           ".pdf")
-                                   doc-view-current-cache-dir))
-            (png-file png-file))
+       (let ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))
+             (opdf (expand-file-name (concat (file-name-base doc-view-buffer-file-name)
+                                             ".pdf")
+                                     doc-view-current-cache-dir))
+             (png-file png-file))
         ;; The unoconv tool only supports a output directory, but no
         ;; file name.  It's named like the input file with the
         ;; extension replaced by pdf.
@@ -975,11 +973,11 @@ Those files are saved in the directory given by the function
                              ;; Rename to doc.pdf
                              (rename-file opdf pdf)
                              (doc-view-pdf/ps->png pdf png-file)))))
-      (pdf
+      (`pdf
        (let ((pages (doc-view-active-pages)))
          ;; Convert PDF to PNG images starting with the active pages.
          (doc-view-pdf->png doc-view-buffer-file-name png-file pages)))
-      (t
+      (_
        ;; Convert to PNG images.
        (doc-view-pdf/ps->png doc-view-buffer-file-name png-file)))))
 
@@ -1105,7 +1103,7 @@ have the page we want to view."
                    (and (not (member pagefile prev-pages))
                         (member pagefile doc-view-current-files)))
            (with-selected-window win
-                                 (assert (eq (current-buffer) buffer))
+                                 (cl-assert (eq (current-buffer) buffer))
                                  (doc-view-goto-page page))))))))
 
 (defun doc-view-buffer-message ()
index 074fd642d6771d65150abe53f08b48aa0b403487..c317bf84db60fd1b14eaf76d92669e9d30b92151 100644 (file)
@@ -233,15 +233,15 @@ returned unaltered."
 
 (add-hook 'before-init-hook 'dos-reevaluate-defcustoms)
 
+(define-obsolete-variable-alias
+  'register-name-alist 'dos-register-name-alist "24.1")
+
 (defvar dos-register-name-alist
   '((ax . 0) (bx . 1) (cx . 2) (dx . 3) (si . 4) (di . 5)
     (cflag . 6) (flags . 7)
     (al . (0 . 0)) (bl . (1 . 0)) (cl . (2 . 0)) (dl . (3 . 0))
     (ah . (0 . 1)) (bh . (1 . 1)) (ch . (2 . 1)) (dh . (3 . 1))))
 
-(define-obsolete-variable-alias
-  'register-name-alist 'dos-register-name-alist "24.1")
-
 (defun dos-make-register ()
   (make-vector 8 0))
 
index d84e3737c91383452a6b21f59ba876b8718cb2c1..f68af7a73bed18fc819171dc17ae3cc2c166f1e4 100644 (file)
@@ -38,9 +38,8 @@
 (setq null-device "NUL")
 
 ;; For distinguishing file types based upon suffixes.
-(defvar file-name-buffer-file-type-alist
-  '(
-    ("[:/].*config.sys$" . nil)                ; config.sys text
+(defcustom file-name-buffer-file-type-alist
+  '(("[:/].*config.sys$" . nil)                ; config.sys text
     ("\\.\\(obj\\|exe\\|com\\|lib\\|sys\\|bin\\|ico\\|pif\\|class\\)$" . t)
                                        ; MS-Dos stuff
     ("\\.\\(dll\\|drv\\|386\\|vxd\\|fon\\|fnt\\|fot\\|ttf\\|grp\\)$" . t)
     ("\\.tp[ulpw]$" . t)               ; borland Pascal stuff
     ("[:/]tags$" . nil)                        ; emacs TAGS file
     )
-  "*Alist for distinguishing text files from binary files.
+  "Alist for distinguishing text files from binary files.
 Each element has the form (REGEXP . TYPE), where REGEXP is matched
-against the file name, and TYPE is nil for text, t for binary.")
+against the file name, and TYPE is nil for text, t for binary."
+  :type '(repeat (cons regexp boolean))
+  :group 'dos-fns
+  :group 'w32)
 
 ;; Return the pair matching filename on file-name-buffer-file-type-alist,
 ;; or nil otherwise.
@@ -282,8 +284,11 @@ filesystem mounted on drive Z:, FILESYSTEM could be \"Z:\"."
 
 ;;; Support for printing under DOS/Windows, see lpr.el and ps-print.el.
 
-(defvar direct-print-region-use-command-dot-com t
-  "*Control whether command.com is used to print on Windows 9x.")
+(defcustom direct-print-region-use-command-dot-com t
+  "If non-nil, use command.com to print on Windows 9x."
+  :type 'boolean
+  :group 'dos-fns
+  :group 'w32)
 
 ;; Function to actually send data to the printer port.
 ;; Supports writing directly, and using various programs.
index dcde6449d2283b04c4c51bf744449599fa346f72..f71554e9f669e273acbd50eef8aef5e611e57839 100644 (file)
@@ -31,9 +31,6 @@
 
 (require 'electric)
 
-;; this depends on the format of list-buffers (from src/buffer.c) and
-;; on stuff in lisp/buff-menu.el
-
 (defvar electric-buffer-menu-mode-map
   (let ((map (make-keymap)))
     (fillarray (car (cdr map)) 'Electric-buffer-menu-undefined)
     (define-key map [mouse-2] 'Electric-buffer-menu-mouse-select)
     map))
 
+(put 'Electric-buffer-menu-quit :advertised-binding "\C-c\C-c")
+(put 'Electric-buffer-menu-select :advertised-binding " ")
+(put 'Helper-help :advertised-binding (char-to-string help-char))
+(put 'Helper-describe-bindings :advertised-binding "?")
+
 (defvar electric-buffer-menu-mode-hook nil
-  "Normal hook run by `electric-buffer-list'.")
+  "Normal hook run by `electric-buffer-menu-mode'.")
 
 ;;;###autoload
 (defun electric-buffer-list (arg)
-  "Pop up a buffer describing the set of Emacs buffers.
-Vaguely like ITS lunar select buffer; combining typeoutoid buffer
-listing with menuoid buffer selection.
-
-If the very next character typed is a space then the buffer list
-window disappears.  Otherwise, one may move around in the buffer list
-window, marking buffers to be selected, saved or deleted.
-
-To exit and select a new buffer, type a space when the cursor is on
-the appropriate line of the buffer-list window.  Other commands are
-much like those of `Buffer-menu-mode'.
+  "Pop up the Buffer Menu in an \"electric\" window.
+If you type SPC or RET (`Electric-buffer-menu-select'), that
+selects the buffer at point and quits the \"electric\" window.
+Otherwise, you can move around in the Buffer Menu, marking
+buffers to be selected, saved or deleted; these other commands
+are much like those of `Buffer-menu-mode'.
 
 Run hooks in `electric-buffer-menu-mode-hook' on entry.
 
-\\{electric-buffer-menu-mode-map}"
+\\<electric-buffer-menu-mode-map>
+\\[keyboard-quit] or \\[Electric-buffer-menu-quit] -- exit buffer menu, returning to previous window and buffer
+  configuration.  If the very first character typed is a space, it
+  also has this effect.
+\\[Electric-buffer-menu-select] -- select buffer of line point is on.
+  Also show buffers marked with m in other windows,
+  deletes buffers marked with \"D\", and saves those marked with \"S\".
+\\[Buffer-menu-mark] -- mark buffer to be displayed.
+\\[Buffer-menu-not-modified] -- clear modified-flag on that buffer.
+\\[Buffer-menu-save] -- mark that buffer to be saved.
+\\[Buffer-menu-delete] or \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted.
+\\[Buffer-menu-unmark] -- remove all kinds of marks from current line.
+\\[Electric-buffer-menu-mode-view-buffer] -- view buffer, returning when done.
+\\[Buffer-menu-backup-unmark] -- back up a line and remove marks."
   (interactive "P")
   (let (select buffer)
     (save-window-excursion
       (setq buffer (list-buffers-noselect arg))
       (Electric-pop-up-window buffer)
       (unwind-protect
-         (progn
+         (let ((header header-line-format))
            (set-buffer buffer)
-           (Electric-buffer-menu-mode)
+           (electric-buffer-menu-mode)
+           (setq header-line-format header)
+           (goto-char (point-min))
+           (if (search-forward "\n." nil t)
+               (forward-char -1))
            (electric-buffer-update-highlight)
            (setq select
                  (catch 'electric-buffer-menu-select
-                   (message "<<< Press Return to bury the buffer list >>>")
-                   (if (eq (setq unread-command-events (list (read-event)))
-                           ?\s)
-                       (progn (setq unread-command-events nil)
-                              (throw 'electric-buffer-menu-select nil)))
+                   (message "<<< Type SPC or RET to bury the buffer list >>>")
+                   (setq unread-command-events (list (read-event)))
                    (let ((start-point (point))
                          (first (progn (goto-char (point-min))
                                        (unless Buffer-menu-use-header-line
@@ -145,15 +156,16 @@ Run hooks in `electric-buffer-menu-mode-hook' on entry.
        (Buffer-menu-mode)
        (bury-buffer)                ;Get rid of window, if dedicated.
        (message "")))
-    (if select
-       (progn (set-buffer buffer)
-              (let ((opoint (point-marker)))
-                (Buffer-menu-execute)
-                (goto-char (point-min))
-                (if (prog1 (search-forward "\n>" nil t)
-                      (goto-char opoint) (set-marker opoint nil))
-                    (Buffer-menu-select)
-                    (switch-to-buffer (Buffer-menu-buffer t))))))))
+    (when select
+      (set-buffer buffer)
+      (let ((opoint (point-marker)))
+       (Buffer-menu-execute)
+       (goto-char (point-min))
+       (if (prog1 (search-forward "\n>" nil t)
+             (goto-char opoint)
+             (set-marker opoint nil))
+           (Buffer-menu-select)
+         (switch-to-buffer (Buffer-menu-buffer t)))))))
 
 (defun electric-buffer-menu-looper (state condition)
   (cond ((and condition
@@ -174,50 +186,27 @@ Run hooks in `electric-buffer-menu-mode-hook' on entry.
 
 (defvar Helper-return-blurb)
 
-(put 'Electric-buffer-menu-mode 'mode-class 'special)
-(defun Electric-buffer-menu-mode ()
-  "Major mode for editing a list of buffers.
-Each line describes one of the buffers in Emacs.
-Letters do not insert themselves; instead, they are commands.
-\\<electric-buffer-menu-mode-map>
-\\[keyboard-quit] or \\[Electric-buffer-menu-quit] -- exit buffer menu, returning to previous window and buffer
-  configuration.  If the very first character typed is a space, it
-  also has this effect.
-\\[Electric-buffer-menu-select] -- select buffer of line point is on.
-  Also show buffers marked with m in other windows,
-  deletes buffers marked with \"D\", and saves those marked with \"S\".
-\\[Buffer-menu-mark] -- mark buffer to be displayed.
-\\[Buffer-menu-not-modified] -- clear modified-flag on that buffer.
-\\[Buffer-menu-save] -- mark that buffer to be saved.
-\\[Buffer-menu-delete] or \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted.
-\\[Buffer-menu-unmark] -- remove all kinds of marks from current line.
-\\[Electric-buffer-menu-mode-view-buffer] -- view buffer, returning when done.
-\\[Buffer-menu-backup-unmark] -- back up a line and remove marks.
+(define-derived-mode electric-buffer-menu-mode Buffer-menu-mode
+  "Electric Buffer Menu"
+  "Toggle Electric Buffer Menu mode in this buffer.
+With a prefix argument ARG, enable Long Lines mode if ARG is
+positive, and disable it otherwise.  If called from Lisp, enable
+the mode if ARG is omitted or nil.
 
-\\{electric-buffer-menu-mode-map}
-
-Entry to this mode via command `electric-buffer-list' calls the value of
-`electric-buffer-menu-mode-hook'."
-  (let ((saved header-line-format))
-    (kill-all-local-variables)
-    (setq header-line-format saved))
-  (use-local-map electric-buffer-menu-mode-map)
-  (setq mode-name "Electric Buffer Menu")
+Electric Buffer Menu mode is a minor mode which is automatically
+enabled and disabled by the \\[electric-buffer-list] command.
+See the documentation of `electric-buffer-list' for details."
   (setq mode-line-buffer-identification "Electric Buffer List")
-  (make-local-variable 'Helper-return-blurb)
-  (setq Helper-return-blurb "return to buffer editing")
-  (setq truncate-lines t)
-  (setq buffer-read-only t)
-  (setq major-mode 'Electric-buffer-menu-mode)
-  (goto-char (point-min))
-  (if (search-forward "\n." nil t) (forward-char -1))
-  (run-mode-hooks 'electric-buffer-menu-mode-hook))
+  (set (make-local-variable 'Helper-return-blurb)
+       "return to buffer editing"))
+
+(define-obsolete-function-alias 'Electric-buffer-menu-mode
+  'electric-buffer-menu-mode "24.2")
 
 ;; generally the same as Buffer-menu-mode-map
 ;;  (except we don't indirect to global-map)
 (put 'Electric-buffer-menu-undefined 'suppress-keymap t)
 
-
 (defun Electric-buffer-menu-exit ()
   (interactive)
   (setq unread-command-events (listify-key-sequence (this-command-keys)))
@@ -251,15 +240,10 @@ Skip execution of select, save, and delete commands."
   (interactive)
   (ding)
   (message "%s"
-          (if (and (eq (key-binding "\C-c\C-c") 'Electric-buffer-menu-quit)
-                   (eq (key-binding " ") 'Electric-buffer-menu-select)
-                   (eq (key-binding (char-to-string help-char)) 'Helper-help)
-                   (eq (key-binding "?") 'Helper-describe-bindings))
-              (substitute-command-keys "Type C-c C-c to exit, Space to select, \\[Helper-help] for help, ? for commands")
-            (substitute-command-keys "\
+          (substitute-command-keys "\
 Type \\[Electric-buffer-menu-quit] to exit, \
 \\[Electric-buffer-menu-select] to select, \
-\\[Helper-help] for help, \\[Helper-describe-bindings] for commands.")))
+\\[Helper-help] for help, \\[Helper-describe-bindings] for commands."))
   (sit-for 4))
 
 (defun Electric-buffer-menu-mode-view-buffer ()
@@ -274,13 +258,13 @@ Return to Electric Buffer Menu when done."
       (sit-for 4))))
 
 (defvar electric-buffer-overlay nil)
+
 (defun electric-buffer-update-highlight ()
-  (when (eq major-mode 'Electric-buffer-menu-mode)
+  (when (derived-mode-p 'electric-buffer-menu-mode)
     ;; Make sure we have an overlay to use.
     (or electric-buffer-overlay
-       (progn
-         (make-local-variable 'electric-buffer-overlay)
-         (setq electric-buffer-overlay (make-overlay (point) (point)))))
+       (set (make-local-variable 'electric-buffer-overlay)
+            (make-overlay (point) (point))))
     (move-overlay electric-buffer-overlay
                  (line-beginning-position)
                  (line-end-position))
index 32915e3ee6e1b6c44d9fa6ff50809c5d4b71cb8c..b1a24bc88a61c9eab4280d045823310b0ec65e5c 100644 (file)
@@ -63,8 +63,7 @@
 
 ;;; Code:
 \f
-(eval-when-compile
- (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'kmacro)
 
@@ -319,17 +318,18 @@ or nil, use a compact 80-column format."
                        mac))))
            (if no-keys
                (when cmd
-                 (loop for key in (where-is-internal cmd '(keymap)) do
-                       (global-unset-key key)))
+                 (cl-loop for key in (where-is-internal cmd '(keymap)) do
+                           (global-unset-key key)))
              (when keys
                (if (= (length mac) 0)
-                   (loop for key in keys do (global-unset-key key))
-                 (loop for key in keys do
-                       (global-set-key key
-                                       (or cmd
-                                           (if (and mac-counter mac-format)
-                                               (kmacro-lambda-form mac mac-counter mac-format)
-                                             mac))))))))))
+                   (cl-loop for key in keys do (global-unset-key key))
+                 (cl-loop for key in keys do
+                           (global-set-key key
+                                           (or cmd
+                                               (if (and mac-counter mac-format)
+                                                   (kmacro-lambda-form
+                                                    mac mac-counter mac-format)
+                                                 mac))))))))))
       (kill-buffer buf)
       (when (buffer-name obuf)
        (switch-to-buffer obuf))
@@ -437,9 +437,9 @@ doubt, use whitespace."
         (one-line (eq verbose 1)))
     (if one-line (setq verbose nil))
     (when (stringp macro)
-      (loop for i below (length macro) do
-           (when (>= (aref rest-mac i) 128)
-             (incf (aref rest-mac i) (- ?\M-\^@ 128)))))
+      (cl-loop for i below (length macro) do
+               (when (>= (aref rest-mac i) 128)
+                 (cl-incf (aref rest-mac i) (- ?\M-\^@ 128)))))
     (while (not (eq (aref rest-mac 0) 'end-macro))
       (let* ((prefix
              (or (and (integerp (aref rest-mac 0))
@@ -448,57 +448,58 @@ doubt, use whitespace."
                             '(digit-argument negative-argument))
                       (let ((i 1))
                         (while (memq (aref rest-mac i) (cdr mdigs))
-                          (incf i))
+                          (cl-incf i))
                         (and (not (memq (aref rest-mac i) pkeys))
                              (prog1 (vconcat "M-" (edmacro-subseq rest-mac 0 i) " ")
-                               (callf edmacro-subseq rest-mac i)))))
+                               (cl-callf edmacro-subseq rest-mac i)))))
                  (and (eq (aref rest-mac 0) ?\C-u)
                       (eq (key-binding [?\C-u]) 'universal-argument)
                       (let ((i 1))
                         (while (eq (aref rest-mac i) ?\C-u)
-                          (incf i))
+                          (cl-incf i))
                         (and (not (memq (aref rest-mac i) pkeys))
-                             (prog1 (loop repeat i concat "C-u ")
-                               (callf edmacro-subseq rest-mac i)))))
+                             (prog1 (cl-loop repeat i concat "C-u ")
+                               (cl-callf edmacro-subseq rest-mac i)))))
                  (and (eq (aref rest-mac 0) ?\C-u)
                       (eq (key-binding [?\C-u]) 'universal-argument)
                       (let ((i 1))
                         (when (eq (aref rest-mac i) ?-)
-                          (incf i))
+                          (cl-incf i))
                         (while (memq (aref rest-mac i)
                                      '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9))
-                          (incf i))
+                          (cl-incf i))
                         (and (not (memq (aref rest-mac i) pkeys))
                              (prog1 (vconcat "C-u " (edmacro-subseq rest-mac 1 i) " ")
-                               (callf edmacro-subseq rest-mac i)))))))
+                               (cl-callf edmacro-subseq rest-mac i)))))))
             (bind-len (apply 'max 1
-                             (loop for map in maps
-                                   for b = (lookup-key map rest-mac)
-                                   when b collect b)))
+                             (cl-loop for map in maps
+                                       for b = (lookup-key map rest-mac)
+                                       when b collect b)))
             (key (edmacro-subseq rest-mac 0 bind-len))
             (fkey nil) tlen tkey
-            (bind (or (loop for map in maps for b = (lookup-key map key)
-                            thereis (and (not (integerp b)) b))
+            (bind (or (cl-loop for map in maps for b = (lookup-key map key)
+                                thereis (and (not (integerp b)) b))
                       (and (setq fkey (lookup-key local-function-key-map rest-mac))
                            (setq tlen fkey tkey (edmacro-subseq rest-mac 0 tlen)
                                  fkey (lookup-key local-function-key-map tkey))
-                           (loop for map in maps
-                                 for b = (lookup-key map fkey)
-                                 when (and (not (integerp b)) b)
-                                 do (setq bind-len tlen key tkey)
-                                 and return b
-                                 finally do (setq fkey nil)))))
+                           (cl-loop for map in maps
+                                     for b = (lookup-key map fkey)
+                                     when (and (not (integerp b)) b)
+                                     do (setq bind-len tlen key tkey)
+                                     and return b
+                                     finally do (setq fkey nil)))))
             (first (aref key 0))
-            (text (loop for i from bind-len below (length rest-mac)
-                        for ch = (aref rest-mac i)
-                        while (and (integerp ch)
-                                   (> ch 32) (< ch maxkey) (/= ch 92)
-                                   (eq (key-binding (char-to-string ch))
-                                       'self-insert-command)
-                                   (or (> i (- (length rest-mac) 2))
-                                       (not (eq ch (aref rest-mac (+ i 1))))
-                                       (not (eq ch (aref rest-mac (+ i 2))))))
-                        finally return i))
+            (text
+              (cl-loop for i from bind-len below (length rest-mac)
+                       for ch = (aref rest-mac i)
+                       while (and (integerp ch)
+                                  (> ch 32) (< ch maxkey) (/= ch 92)
+                                  (eq (key-binding (char-to-string ch))
+                                      'self-insert-command)
+                                  (or (> i (- (length rest-mac) 2))
+                                      (not (eq ch (aref rest-mac (+ i 1))))
+                                      (not (eq ch (aref rest-mac (+ i 2))))))
+                       finally return i))
             desc)
        (if (stringp bind) (setq bind nil))
        (cond ((and (eq bind 'self-insert-command) (not prefix)
@@ -509,7 +510,7 @@ doubt, use whitespace."
                      (setq desc (concat (edmacro-subseq rest-mac 0 text)))
                      (when (string-match "^[ACHMsS]-." desc)
                        (setq text 2)
-                       (callf substring desc 0 2))
+                       (cl-callf substring desc 0 2))
                      (not (string-match
                            "^;;\\|^<.*>$\\|^\\\\[0-9]+$\\|^[0-9]+\\*."
                            desc))))
@@ -535,17 +536,17 @@ doubt, use whitespace."
                              (cond
                               ((integerp ch)
                                (concat
-                                (loop for pf across "ACHMsS"
-                                      for bit in '(?\A-\^@ ?\C-\^@ ?\H-\^@
-                                                   ?\M-\^@ ?\s-\^@ ?\S-\^@)
-                                      when (/= (logand ch bit) 0)
-                                      concat (format "%c-" pf))
+                                (cl-loop for pf across "ACHMsS"
+                                          for bit in '(?\A-\^@ ?\C-\^@ ?\H-\^@
+                                                       ?\M-\^@ ?\s-\^@ ?\S-\^@)
+                                          when (/= (logand ch bit) 0)
+                                          concat (format "%c-" pf))
                                 (let ((ch2 (logand ch (1- (lsh 1 18)))))
                                   (cond ((<= ch2 32)
-                                         (case ch2
+                                         (pcase ch2
                                            (0 "NUL") (9 "TAB") (10 "LFD")
                                            (13 "RET") (27 "ESC") (32 "SPC")
-                                           (t
+                                           (_
                                             (format "C-%c"
                                                     (+ (if (<= ch2 26) 96 64)
                                                        ch2)))))
@@ -563,30 +564,30 @@ doubt, use whitespace."
          (let ((times 1) (pos bind-len))
            (while (not (edmacro-mismatch rest-mac rest-mac
                                          0 bind-len pos (+ bind-len pos)))
-             (incf times)
-             (incf pos bind-len))
+             (cl-incf times)
+             (cl-incf pos bind-len))
            (when (> times 1)
              (setq desc (format "%d*%s" times desc))
              (setq bind-len (* bind-len times)))))
        (setq rest-mac (edmacro-subseq rest-mac bind-len))
        (if verbose
            (progn
-             (unless (equal res "") (callf concat res "\n"))
-             (callf concat res desc)
+             (unless (equal res "") (cl-callf concat res "\n"))
+             (cl-callf concat res desc)
              (when (and bind (or (stringp bind) (symbolp bind)))
-               (callf concat res
+               (cl-callf concat res
                  (make-string (max (- 3 (/ (length desc) 8)) 1) 9)
                  ";; " (if (stringp bind) bind (symbol-name bind))))
              (setq len 0))
          (if (and (> (+ len (length desc) 2) 72) (not one-line))
              (progn
-               (callf concat res "\n ")
+               (cl-callf concat res "\n ")
                (setq len 1))
            (unless (equal res "")
-             (callf concat res " ")
-             (incf len)))
-         (callf concat res desc)
-         (incf len (length desc)))))
+             (cl-callf concat res " ")
+             (cl-incf len)))
+         (cl-callf concat res desc)
+         (cl-incf len (length desc)))))
     res))
 
 (defun edmacro-mismatch (cl-seq1 cl-seq2 cl-start1 cl-end1 cl-start2 cl-end2)
@@ -594,28 +595,19 @@ doubt, use whitespace."
 Return nil if the sequences match.  If one sequence is a prefix of the
 other, the return value indicates the end of the shorted sequence.
 \n(fn SEQ1 SEQ2 START1 END1 START2 END2)"
-  (let (cl-test cl-test-not cl-key cl-from-end)
-    (or cl-end1 (setq cl-end1 (length cl-seq1)))
-    (or cl-end2 (setq cl-end2 (length cl-seq2)))
-    (if cl-from-end
-       (progn
-         (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
-                     (cl-check-match (elt cl-seq1 (1- cl-end1))
-                                     (elt cl-seq2 (1- cl-end2))))
-           (setq cl-end1 (1- cl-end1) cl-end2 (1- cl-end2)))
-         (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
-              (1- cl-end1)))
-      (let ((cl-p1 (and (listp cl-seq1) (nthcdr cl-start1 cl-seq1)))
-           (cl-p2 (and (listp cl-seq2) (nthcdr cl-start2 cl-seq2))))
-       (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
-                   (cl-check-match (if cl-p1 (car cl-p1)
-                                     (aref cl-seq1 cl-start1))
-                                   (if cl-p2 (car cl-p2)
-                                     (aref cl-seq2 cl-start2))))
-         (setq cl-p1 (cdr cl-p1) cl-p2 (cdr cl-p2)
-               cl-start1 (1+ cl-start1) cl-start2 (1+ cl-start2)))
-       (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
-            cl-start1)))))
+  (or cl-end1 (setq cl-end1 (length cl-seq1)))
+  (or cl-end2 (setq cl-end2 (length cl-seq2)))
+  (let ((cl-p1 (and (listp cl-seq1) (nthcdr cl-start1 cl-seq1)))
+        (cl-p2 (and (listp cl-seq2) (nthcdr cl-start2 cl-seq2))))
+    (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
+                (eql (if cl-p1 (car cl-p1)
+                       (aref cl-seq1 cl-start1))
+                     (if cl-p2 (car cl-p2)
+                       (aref cl-seq2 cl-start2))))
+      (setq cl-p1 (cdr cl-p1) cl-p2 (cdr cl-p2)
+            cl-start1 (1+ cl-start1) cl-start2 (1+ cl-start2)))
+    (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
+         cl-start1)))
 
 (defun edmacro-subseq (seq start &optional end)
   "Return the subsequence of SEQ from START to END.
@@ -647,9 +639,9 @@ If START or END is negative, it counts from the end."
 The string represents the same events; Meta is indicated by bit 7.
 This function assumes that the events can be stored in a string."
   (setq seq (copy-sequence seq))
-  (loop for i below (length seq) do
-        (when (logand (aref seq i) 128)
-          (setf (aref seq i) (logand (aref seq i) 127))))
+  (cl-loop for i below (length seq) do
+           (when (logand (aref seq i) 128)
+             (setf (aref seq i) (logand (aref seq i) 127))))
   seq)
 
 (defun edmacro-fix-menu-commands (macro &optional noerror)
@@ -664,7 +656,7 @@ This function assumes that the events can be stored in a string."
                ((eq (car ev) 'switch-frame))
                ((equal ev '(menu-bar))
                 (push 'menu-bar result))
-               ((equal (cadadr ev) '(menu-bar))
+               ((equal (cl-cadadr ev) '(menu-bar))
                 (push (vector 'menu-bar (car ev)) result))
                ;; It would be nice to do pop-up menus, too, but not enough
                ;; info is recorded in macros to make this possible.
@@ -724,30 +716,31 @@ This function assumes that the events can be stored in a string."
              (t
               (let ((orig-word word) (prefix 0) (bits 0))
                 (while (string-match "^[ACHMsS]-." word)
-                  (incf bits (cdr (assq (aref word 0)
+                  (cl-incf bits (cdr (assq (aref word 0)
                                         '((?A . ?\A-\^@) (?C . ?\C-\^@)
                                           (?H . ?\H-\^@) (?M . ?\M-\^@)
                                           (?s . ?\s-\^@) (?S . ?\S-\^@)))))
-                  (incf prefix 2)
-                  (callf substring word 2))
+                  (cl-incf prefix 2)
+                  (cl-callf substring word 2))
                 (when (string-match "^\\^.$" word)
-                  (incf bits ?\C-\^@)
-                  (incf prefix)
-                  (callf substring word 1))
+                  (cl-incf bits ?\C-\^@)
+                  (cl-incf prefix)
+                  (cl-callf substring word 1))
                 (let ((found (assoc word '(("NUL" . "\0") ("RET" . "\r")
                                            ("LFD" . "\n") ("TAB" . "\t")
                                            ("ESC" . "\e") ("SPC" . " ")
                                            ("DEL" . "\177")))))
                   (when found (setq word (cdr found))))
                 (when (string-match "^\\\\[0-7]+$" word)
-                  (loop for ch across word
-                        for n = 0 then (+ (* n 8) ch -48)
-                        finally do (setq word (vector n))))
+                  (cl-loop for ch across word
+                            for n = 0 then (+ (* n 8) ch -48)
+                            finally do (setq word (vector n))))
                 (cond ((= bits 0)
                        (setq key word))
                       ((and (= bits ?\M-\^@) (stringp word)
                             (string-match "^-?[0-9]+$" word))
-                       (setq key (loop for x across word collect (+ x bits))))
+                       (setq key (cl-loop for x across word
+                                           collect (+ x bits))))
                       ((/= (length word) 1)
                        (error "%s must prefix a single character, not %s"
                               (substring orig-word 0 prefix) word))
@@ -761,7 +754,7 @@ This function assumes that the events can be stored in a string."
                       (t
                        (setq key (list (+ bits (aref word 0)))))))))
        (when key
-         (loop repeat times do (callf vconcat res key)))))
+         (cl-loop repeat times do (cl-callf vconcat res key)))))
     (when (and (>= (length res) 4)
               (eq (aref res 0) ?\C-x)
               (eq (aref res 1) ?\()
@@ -769,13 +762,13 @@ This function assumes that the events can be stored in a string."
               (eq (aref res (- (length res) 1)) ?\)))
       (setq res (edmacro-subseq res 2 -2)))
     (if (and (not need-vector)
-            (loop for ch across res
-                  always (and (characterp ch)
-                              (let ((ch2 (logand ch (lognot ?\M-\^@))))
-                                (and (>= ch2 0) (<= ch2 127))))))
-       (concat (loop for ch across res
-                     collect (if (= (logand ch ?\M-\^@) 0)
-                                 ch (+ ch 128))))
+            (cl-loop for ch across res
+                      always (and (characterp ch)
+                                  (let ((ch2 (logand ch (lognot ?\M-\^@))))
+                                    (and (>= ch2 0) (<= ch2 127))))))
+       (concat (cl-loop for ch across res
+                         collect (if (= (logand ch ?\M-\^@) 0)
+                                     ch (+ ch 128))))
       res)))
 
 (provide 'edmacro)
index 50c9010a74ecc8b7fa80f12339b85da5a3eecb2d..3108a0ed4c0378bc9ab1375a26a54c0620ebd09f 100644 (file)
@@ -38,8 +38,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;; This loop is the guts for non-standard modes which retain control
 ;; until some event occurs.  It is a `do-forever', the only way out is
 ;; to throw.  It assumes that you have set up the keymap, window, and
@@ -215,6 +213,7 @@ point right after that char, and it should return t to cause indentation,
   ;; it looks challenging.
   (let (pos)
     (when (and
+           electric-indent-mode
            ;; Don't reindent while inserting spaces at beginning of line.
            (or (not (memq last-command-event '(?\s ?\t)))
                (save-excursion (skip-chars-backward " \t") (not (bolp))))
@@ -323,12 +322,13 @@ This can be convenient for people who find it easier to hit ) than C-f."
      ((and (memq syntax '(?\( ?\" ?\$)) (use-region-p))
       (if (> (mark) (point))
           (goto-char (mark))
-        ;; We already inserted the open-paren but at the end of the region,
-        ;; so we have to remove it and start over.
-        (delete-char -1)
-        (save-excursion
+       ;; We already inserted the open-paren but at the end of the
+       ;; region, so we have to remove it and start over.
+       (delete-char -1)
+       (save-excursion
           (goto-char (mark))
-          (insert last-command-event)))
+         ;; Do not insert after `save-excursion' marker (Bug#11520).
+          (insert-before-markers last-command-event)))
       (insert closer))
      ;; Backslash-escaped: no pairing, no skipping.
      ((save-excursion
@@ -393,16 +393,16 @@ arguments that returns one of those symbols.")
                (not (nth 8 (save-excursion (syntax-ppss pos)))))
       (let ((end (copy-marker (point) t)))
         (goto-char pos)
-        (case (if (functionp rule) (funcall rule) rule)
+        (pcase (if (functionp rule) (funcall rule) rule)
           ;; FIXME: we used `newline' down here which called
           ;; self-insert-command and ran post-self-insert-hook recursively.
           ;; It happened to make electric-indent-mode work automatically with
           ;; electric-layout-mode (at the cost of re-indenting lines
           ;; multiple times), but I'm not sure it's what we want.
-          (before (goto-char (1- pos)) (skip-chars-backward " \t")
+          (`before (goto-char (1- pos)) (skip-chars-backward " \t")
                   (unless (bolp) (insert "\n")))
-          (after  (insert "\n"))       ; FIXME: check eolp before inserting \n?
-          (around (save-excursion
+          (`after  (insert "\n"))      ; FIXME: check eolp before inserting \n?
+          (`around (save-excursion
                     (goto-char (1- pos)) (skip-chars-backward " \t")
                     (unless (bolp) (insert "\n")))
                   (insert "\n")))      ; FIXME: check eolp before inserting \n?
index 6f2c6f73eca974ec07f0f5ed4fa2f61773329320..20cc38cd9c2aa75ea2bf8cd3bdb48beba6fc3ead 100644 (file)
@@ -1,4 +1,4 @@
-;;; authors.el --- utility for maintaining Emacs's AUTHORS file -*-coding: utf-8;-*-
+;;; authors.el --- utility for maintaining Emacs's AUTHORS file -*-coding: utf-8 -*-
 
 ;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
@@ -176,6 +176,7 @@ files.")
     ("Torbjörn Einarsson" "Torbj.*rn Einarsson")
     ("Toru Tomabechi" "Toru Tomabechi,")
     ("Tsugutomo Enami" "enami tsugutomo")
+    ("Ulrich Müller" "Ulrich Mueller")
     ("Vincent Del Vecchio" "Vince Del Vecchio")
     ("William M. Perry" "Bill Perry")
     ("Wlodzimierz Bzyl" "W.*dek Bzyl")
@@ -398,7 +399,7 @@ Changes to files in this list are not listed.")
     ("Lawrence R. Dodd" :cowrote "dired-x.el")
     ;; No longer distributed.
 ;;;    ("Viktor Dukhovni" :wrote "unexsunos4.c")
-    ("Paul Eggert" :wrote "rcs2log" "vcdiff")
+    ("Paul Eggert" :wrote "rcs2log") ; "vcdiff"
     ("Fred Fish" :changed "unexcoff.c")
     ;; No longer distributed.
 ;;;    ("Tim Fleehart" :wrote "makefile.nt")
@@ -426,7 +427,7 @@ Changes to files in this list are not listed.")
     ;; No longer distributed.
 ;;;    ("Ishikawa Chiaki" :changed "aviion.h" "dgux.h")
     ;; ymakefile no longer distributed.
-    ("Michael K. Johnson" :changed "configure.in" "emacs.c" "intel386.h"
+    ("Michael K. Johnson" :changed "configure.ac" "emacs.c" "intel386.h"
      "mem-limits.h" "process.c" "template.h" "sysdep.c" "syssignal.h"
      "systty.h" "unexcoff.c" "linux.h")
     ;; No longer distributed.
@@ -579,6 +580,7 @@ in the repository.")
     ("s/windowsnt.h" . "s/ms-w32.h")
     ("winnt.el" . "w32-fns.el")
     ("config.emacs" . "configure")
+    ("configure.in" . "configure.ac")
     ("config.h.dist" . "config.in")
     ("config.h-dist" . "config.in")
     ("config.h.in" . "config.in")
@@ -701,7 +703,7 @@ or is on the list of removed files.  Returns the non-directory part of
 the file name.  Only uses the LOG-FILE position POS and associated AUTHOR
 to print a message if FILE is not found."
   ;; FILE should be re-checked in every different directory associated
-  ;; with a LOG-FILE.  Eg configure.in from src/ChangeLog is not the
+  ;; with a LOG-FILE.  Eg configure.ac from src/ChangeLog is not the
   ;; same as that from top-level/ChangeLog.
   (let* ((fullname (expand-file-name file (file-name-directory log-file)))
         (entry (assoc fullname authors-checked-files-alist))
@@ -829,7 +831,7 @@ with the file and the number of each action:
         (enable-local-eval nil)
         (existing-buffer (get-file-buffer log-file))
         (buffer (find-file-noselect log-file))
-        authors file pos)
+        authors pos)
     (with-current-buffer buffer
       (save-restriction
        (widen)
@@ -943,8 +945,7 @@ and changed by AUTHOR."
               (file (car change))
               (filestat (if (authors-public-domain-p file)
                             (concat file " (public domain)")
-                          file))
-              slot)
+                          file)))
          (cond ((assq :wrote actions)
                 (setq wrote-list (cons filestat wrote-list)))
                ((assq :cowrote actions)
index 5af666b9dedda4b4e423953ea121a69649b7ac8b..1bdd6d8fc4be1e51d1ee806bbdceeef8d01387ae 100644 (file)
@@ -1,4 +1,4 @@
-;; autoload.el --- maintain autoloads in loaddefs.el
+;; autoload.el --- maintain autoloads in loaddefs.el  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1991-1997, 2001-2012  Free Software Foundation, Inc.
 
@@ -32,7 +32,7 @@
 
 (require 'lisp-mode)                   ;for `doc-string-elt' properties.
 (require 'help-fns)                    ;for help-add-fundoc-usage.
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defvar generated-autoload-file nil
   "File into which to write autoload definitions.
@@ -86,78 +86,100 @@ that text will be copied verbatim to `generated-autoload-file'.")
 
 (defvar autoload-modified-buffers)      ;Dynamically scoped var.
 
-(defun make-autoload (form file)
+(defun make-autoload (form file &optional expansion)
   "Turn FORM into an autoload or defvar for source file FILE.
 Returns nil if FORM is not a special autoload form (i.e. a function definition
-or macro definition or a defcustom)."
+or macro definition or a defcustom).
+If EXPANSION is non-nil, we're processing the macro expansion of an
+expression, in which case we want to handle forms differently."
   (let ((car (car-safe form)) expand)
     (cond
+     ((and expansion (eq car 'defalias))
+      (pcase-let*
+          ((`(,_ ,_ ,arg . ,rest) form)
+           ;; `type' is non-nil if it defines a macro.
+           ;; `fun' is the function part of `arg' (defaults to `arg').
+           ((or (and (or `(cons 'macro ,fun) `'(macro . ,fun)) (let type t))
+                (and (let fun arg) (let type nil)))
+            arg)
+           ;; `lam' is the lambda expression in `fun' (or nil if not
+           ;; recognized).
+           (lam (if (memq (car-safe fun) '(quote function)) (cadr fun)))
+           ;; `args' is the list of arguments (or t if not recognized).
+           ;; `body' is the body of `lam' (or t if not recognized).
+           ((or `(lambda ,args . ,body)
+                (and (let args t) (let body t)))
+            lam)
+           ;; Get the `doc' from `body' or `rest'.
+           (doc (cond ((stringp (car-safe body)) (car body))
+                      ((stringp (car-safe rest)) (car rest))))
+           ;; Look for an interactive spec.
+           (interactive (pcase body
+                          ((or `((interactive . ,_) . ,_)
+                               `(,_ (interactive . ,_) . ,_)) t))))
+        ;; Add the usage form at the end where describe-function-1
+        ;; can recover it.
+        (when (listp args) (setq doc (help-add-fundoc-usage doc args)))
+        ;; (message "autoload of %S" (nth 1 form))
+        `(autoload ,(nth 1 form) ,file ,doc ,interactive ,type)))
+
+     ((and expansion (memq car '(progn prog1)))
+      (let ((end (memq :autoload-end form)))
+       (when end             ;Cut-off anything after the :autoload-end marker.
+          (setq form (copy-sequence form))
+          (setcdr (memq :autoload-end form) nil))
+        (let ((exps (delq nil (mapcar (lambda (form)
+                                        (make-autoload form file expansion))
+                                      (cdr form)))))
+          (when exps (cons 'progn exps)))))
+
      ;; For complex cases, try again on the macro-expansion.
      ((and (memq car '(easy-mmode-define-global-mode define-global-minor-mode
-                      define-globalized-minor-mode
+                       define-globalized-minor-mode defun defmacro
+                       ;; FIXME: we'd want `defmacro*' here as well, so as
+                       ;; to handle its `declare', but when autoload is run
+                       ;; CL is not loaded so macroexpand doesn't know how
+                       ;; to expand it!
                       easy-mmode-define-minor-mode define-minor-mode))
           (setq expand (let ((load-file-name file)) (macroexpand form)))
-          (eq (car expand) 'progn)
-          (memq :autoload-end expand))
-      (let ((end (memq :autoload-end expand)))
-       ;; Cut-off anything after the :autoload-end marker.
-       (setcdr end nil)
-       (cons 'progn
-             (mapcar (lambda (form) (make-autoload form file))
-                     (cdr expand)))))
+          (memq (car expand) '(progn prog1 defalias)))
+      (make-autoload expand file 'expansion)) ;Recurse on the expansion.
 
      ;; For special function-like operators, use the `autoload' function.
-     ((memq car '(defun define-skeleton defmacro define-derived-mode
+     ((memq car '(define-skeleton define-derived-mode
                    define-compilation-mode define-generic-mode
                   easy-mmode-define-global-mode define-global-minor-mode
                   define-globalized-minor-mode
                   easy-mmode-define-minor-mode define-minor-mode
-                  defun* defmacro* define-overloadable-function))
+                  cl-defun defun* cl-defmacro defmacro*
+                   define-overloadable-function))
       (let* ((macrop (memq car '(defmacro defmacro*)))
             (name (nth 1 form))
-            (args (case car
-                     ((defun defmacro defun* defmacro*
-                        define-overloadable-function) (nth 2 form))
-                     ((define-skeleton) '(&optional str arg))
-                     ((define-generic-mode define-derived-mode
-                        define-compilation-mode) nil)
-                     (t)))
-            (body (nthcdr (get car 'doc-string-elt) form))
+            (args (pcase car
+                     ((or `defun `defmacro
+                          `defun* `defmacro* `cl-defun `cl-defmacro
+                          `define-overloadable-function) (nth 2 form))
+                     (`define-skeleton '(&optional str arg))
+                     ((or `define-generic-mode `define-derived-mode
+                          `define-compilation-mode) nil)
+                     (_ t)))
+            (body (nthcdr (or (get car 'doc-string-elt) 3) form))
             (doc (if (stringp (car body)) (pop body))))
-       (when (listp args)
-         ;; Add the usage form at the end where describe-function-1
-         ;; can recover it.
-         (setq doc (help-add-fundoc-usage doc args)))
-        (let ((exp
-               ;; `define-generic-mode' quotes the name, so take care of that
-               (list 'autoload (if (listp name) name (list 'quote name))
-                     file doc
-                     (or (and (memq car '(define-skeleton define-derived-mode
-                                           define-generic-mode
-                                           easy-mmode-define-global-mode
-                                           define-global-minor-mode
-                                           define-globalized-minor-mode
-                                           easy-mmode-define-minor-mode
-                                           define-minor-mode)) t)
-                         (eq (car-safe (car body)) 'interactive))
-                     (if macrop (list 'quote 'macro) nil))))
-          (when macrop
-            ;; Special case to autoload some of the macro's declarations.
-            (let ((decls (nth (if (stringp (nth 3 form)) 4 3) form))
-                  (exps '()))
-              (when (eq (car-safe decls) 'declare)
-                ;; FIXME: We'd like to reuse macro-declaration-function,
-                ;; but we can't since it doesn't return anything.
-                (dolist (decl decls)
-                  (case (car-safe decl)
-                    (indent
-                     (push `(put ',name 'lisp-indent-function ',(cadr decl))
-                           exps))
-                    (doc-string
-                     (push `(put ',name 'doc-string-elt ',(cadr decl)) exps))))
-                (when exps
-                  (setq exp `(progn ,exp ,@exps))))))
-          exp)))
+        ;; Add the usage form at the end where describe-function-1
+        ;; can recover it.
+       (when (listp args) (setq doc (help-add-fundoc-usage doc args)))
+        ;; `define-generic-mode' quotes the name, so take care of that
+        (list 'autoload (if (listp name) name (list 'quote name))
+              file doc
+              (or (and (memq car '(define-skeleton define-derived-mode
+                                    define-generic-mode
+                                    easy-mmode-define-global-mode
+                                    define-global-minor-mode
+                                    define-globalized-minor-mode
+                                    easy-mmode-define-minor-mode
+                                    define-minor-mode)) t)
+                  (eq (car-safe (car body)) 'interactive))
+              (if macrop (list 'quote 'macro) nil))))
 
      ;; For defclass forms, use `eieio-defclass-autoload'.
      ((eq car 'defclass)
@@ -190,6 +212,11 @@ or macro definition or a defcustom)."
            (if (member ',file loads) nil
              (put ',groupname 'custom-loads (cons ',file loads))))))
 
+     ;; When processing a macro expansion, any expression
+     ;; before a :autoload-end should be included.  These are typically (put
+     ;; 'fun 'prop val) and things like that.
+     ((and expansion (consp form)) form)
+
      ;; nil here indicates that this is not a special autoload form.
      (t nil))))
 
@@ -481,7 +508,7 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
                   (search-forward generate-autoload-cookie)
                   (skip-chars-forward " \t")
                   (if (eolp)
-                      (condition-case err
+                      (condition-case-unless-debug err
                           ;; Read the next form and make an autoload.
                           (let* ((form (prog1 (read (current-buffer))
                                          (or (bolp) (forward-line 1))))
@@ -521,7 +548,7 @@ Return non-nil if and only if FILE adds no autoloads to OUTFILE
                 (save-excursion
                   ;; Insert the section-header line which lists the file name
                   ;; and which functions are in it, etc.
-                  (assert (= ostart output-start))
+                  (cl-assert (= ostart output-start))
                   (goto-char output-start)
                   (let ((relfile (file-relative-name absfile)))
                     (autoload-insert-section-header
@@ -671,9 +698,9 @@ file binds `generated-autoload-file' as a file-local variable,
 write its autoloads into the specified file instead."
   (interactive "DUpdate autoloads from directory: ")
   (let* ((files-re (let ((tmp nil))
-                    (dolist (suf (get-load-suffixes)
-                                 (concat "^[^=.].*" (regexp-opt tmp t) "\\'"))
-                      (unless (string-match "\\.elc" suf) (push suf tmp)))))
+                    (dolist (suf (get-load-suffixes))
+                      (unless (string-match "\\.elc" suf) (push suf tmp)))
+                     (concat "^[^=.].*" (regexp-opt tmp t) "\\'")))
         (files (apply 'nconc
                       (mapcar (lambda (dir)
                                 (directory-files (expand-file-name dir)
@@ -762,9 +789,6 @@ write its autoloads into the specified file instead."
 (define-obsolete-function-alias 'update-autoloads-from-directories
     'update-directory-autoloads "22.1")
 
-(defvar autoload-make-program (or (getenv "MAKE") "make")
-  "Name of the make program in use during the Emacs build process.")
-
 ;;;###autoload
 (defun batch-update-autoloads ()
   "Update loaddefs.el autoloads in batch mode.
index 9f3487674781372ff936c3bc51db20770c2fb9ee..1f00677cd0021b756cbc22798bcd281d3e96624d 100644 (file)
@@ -260,7 +260,7 @@ Return t if the height of the tree has grown."
        (opp (avl-tree--switch-dir dir))
        ;; direction 0,1 -> sign factor -1,+1
        (sgn (avl-tree--dir-to-sign dir))
-        p1 p2 b2 result)
+        p1 p2 b2)
     (cond
      ((< (* sgn (avl-tree--node-balance br)) 0)
       (setf (avl-tree--node-balance br) 0)
index 78ac29d89df8ad64edbf5d57a78600af5d9b7c9e..5a3fd7dddb1236ed39d0eb873176ddd94ab0c81b 100644 (file)
 ;;; Code:
 
 (require 'bytecomp)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
+(require 'macroexp)
 
 (defun byte-compile-log-lap-1 (format &rest args)
   ;; Newer byte codes for stack-ref make the slot 0 non-nil again.
        ;; (message "Inlining byte-code for %S!" name)
        ;; The byte-code will be really inlined in byte-compile-unfold-bcf.
        `(,fn ,@(cdr form)))
-      ((or (and `(lambda ,args . ,body) (let env nil))
-           `(closure ,env ,args . ,body))
+      ((or `(lambda . ,_) `(closure . ,_))
        (if (not (or (eq fn localfn)     ;From the same file => same mode.
-                    (eq (not lexical-binding) (not env)))) ;Same mode.
+                    (eq (car fn)        ;Same mode.
+                        (if lexical-binding 'closure 'lambda))))
            ;; While byte-compile-unfold-bcf can inline dynbind byte-code into
            ;; letbind byte-code (or any other combination for that matter), we
            ;; can only inline dynbind source into dynbind source or letbind
            ;; source into letbind source.
-           ;; FIXME: we could of course byte-compile the inlined function
-           ;; first, and then inline its byte-code.
-           form
-         (let ((renv ()))
-           ;; Turn the function's closed vars (if any) into local let bindings.
-           (dolist (binding env)
-             (cond
-              ((consp binding)
-               ;; We check shadowing by the args, so that the `let' can be
-               ;; moved within the lambda, which can then be unfolded.
-               ;; FIXME: Some of those bindings might be unused in `body'.
-               (unless (memq (car binding) args) ;Shadowed.
-                 (push `(,(car binding) ',(cdr binding)) renv)))
-              ((eq binding t))
-              (t (push `(defvar ,binding) body))))
-           (let ((newfn (byte-compile-preprocess
-                         (if (null renv)
-                             `(lambda ,args ,@body)
-                           `(lambda ,args (let ,(nreverse renv) ,@body))))))
-             (if (eq (car-safe newfn) 'function)
-                 (byte-compile-unfold-lambda `(,(cadr newfn) ,@(cdr form)))
-               (byte-compile-log-warning
-                (format "Inlining closure %S failed" name))
-               form)))))
+           (progn
+             ;; We can of course byte-compile the inlined function
+             ;; first, and then inline its byte-code.
+             (byte-compile name)
+             `(,(symbol-function name) ,@(cdr form)))
+         (let ((newfn (if (eq fn localfn)
+                          ;; If `fn' is from the same file, it has already
+                          ;; been preprocessed!
+                          `(function ,fn)
+                        (byte-compile-preprocess
+                         (byte-compile--reify-function fn)))))
+           (if (eq (car-safe newfn) 'function)
+               (byte-compile-unfold-lambda `(,(cadr newfn) ,@(cdr form)))
+             (byte-compile-log-warning
+              (format "Inlining closure %S failed" name))
+             form))))
 
       (t ;; Give up on inlining.
        form))))
                              clause))
                         (cdr form))))
          ((eq fn 'progn)
-          ;; as an extra added bonus, this simplifies (progn <x>) --> <x>
+          ;; As an extra added bonus, this simplifies (progn <x>) --> <x>.
           (if (cdr (cdr form))
-              (progn
-                (setq tmp (byte-optimize-body (cdr form) for-effect))
-                (if (cdr tmp) (cons 'progn tmp) (car tmp)))
+               (macroexp-progn (byte-optimize-body (cdr form) for-effect))
             (byte-optimize-form (nth 1 form) for-effect)))
          ((eq fn 'prog1)
           (if (cdr (cdr form))
                              (prin1-to-string form))
           nil)
 
-         ((memq fn '(defun defmacro function condition-case))
+         ((memq fn '(function condition-case))
           ;; These forms are compiled as constants or by breaking out
           ;; all the subexpressions and compiling them separately.
           form)
               (cons fn args)))))))
 
 (defun byte-optimize-all-constp (list)
-  "Non-nil if all elements of LIST satisfy `byte-compile-constp'."
+  "Non-nil if all elements of LIST satisfy `macroexp-const-p"
   (let ((constant t))
     (while (and list constant)
-      (unless (byte-compile-constp (car list))
+      (unless (macroexp-const-p (car list))
        (setq constant nil))
       (setq list (cdr list)))
     constant))
   (while (eq (car-safe form) 'progn)
     (setq form (car (last (cdr form)))))
   (cond ((consp form)
-         (case (car form)
-           (quote (cadr form))
+         (pcase (car form)
+           (`quote (cadr form))
            ;; Can't use recursion in a defsubst.
-           ;; (progn (byte-compile-trueconstp (car (last (cdr form)))))
+           ;; (`progn (byte-compile-trueconstp (car (last (cdr form)))))
            ))
         ((not (symbolp form)))
         ((eq form t))
   (while (eq (car-safe form) 'progn)
     (setq form (car (last (cdr form)))))
   (cond ((consp form)
-         (case (car form)
-           (quote (null (cadr form)))
+         (pcase (car form)
+           (`quote (null (cadr form)))
            ;; Can't use recursion in a defsubst.
-           ;; (progn (byte-compile-nilconstp (car (last (cdr form)))))
+           ;; (`progn (byte-compile-nilconstp (car (last (cdr form)))))
            ))
         ((not (symbolp form)) nil)
         ((null form))))
 
 
 (defun byte-optimize-binary-predicate (form)
-  (if (byte-compile-constp (nth 1 form))
-      (if (byte-compile-constp (nth 2 form))
+  (if (macroexp-const-p (nth 1 form))
+      (if (macroexp-const-p (nth 2 form))
          (condition-case ()
              (list 'quote (eval form))
            (error form))
   (let ((ok t)
        (rest (cdr form)))
     (while (and rest ok)
-      (setq ok (byte-compile-constp (car rest))
+      (setq ok (macroexp-const-p (car rest))
            rest (cdr rest)))
     (if ok
        (condition-case ()
 (defun byte-optimize-quote (form)
   (if (or (consp (nth 1 form))
          (and (symbolp (nth 1 form))
-              (not (byte-compile-const-symbol-p form))))
+              (not (macroexp--const-symbol-p form))))
       form
     (nth 1 form)))
 
 ;; optimize string-as-unibyte, string-as-multibyte, string-make-unibyte,
 ;; string-make-multibyte for constant args.
 
-(put 'featurep 'byte-optimizer 'byte-optimize-featurep)
-(defun byte-optimize-featurep (form)
-  ;; Emacs-21's byte-code doesn't run under XEmacs or SXEmacs anyway, so we
-  ;; can safely optimize away this test.
-  (if (member (cdr-safe form) '(((quote xemacs)) ((quote sxemacs))))
-      nil
-    (if (member (cdr-safe form) '(((quote emacs))))
-       t
-      form)))
-
 (put 'set 'byte-optimizer 'byte-optimize-set)
 (defun byte-optimize-set (form)
   (let ((var (car-safe (cdr-safe form))))
         string-to-multibyte
         tan truncate
         unibyte-char-to-multibyte upcase user-full-name
-        user-login-name user-original-login-name user-variable-p
+        user-login-name user-original-login-name custom-variable-p
         vconcat
         window-buffer window-dedicated-p window-edges window-height
         window-hscroll window-minibuffer-p window-width
             ;; This uses dynamic-scope magic.
             offset (disassemble-offset bytes))
       (let ((opcode (aref byte-code-vector bytedecomp-op)))
-       (assert opcode)
+       (cl-assert opcode)
        (setq bytedecomp-op opcode))
       (cond ((memq bytedecomp-op byte-goto-ops)
             ;; It's a pc.
@@ -1582,13 +1563,13 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
                        (not (eq (car lap0) 'byte-constant)))
                   nil
                 (setq keep-going t)
-                (if (memq (car lap0) '(byte-constant byte-dup))
-                    (progn
-                      (setq tmp (if (or (not tmp)
-                                        (byte-compile-const-symbol-p
-                                         (car (cdr lap0))))
-                                    (cdr lap0)
-                                  (byte-compile-get-constant t)))
+                 (if (memq (car lap0) '(byte-constant byte-dup))
+                     (progn
+                       (setq tmp (if (or (not tmp)
+                                         (macroexp--const-symbol-p
+                                          (car (cdr lap0))))
+                                     (cdr lap0)
+                                   (byte-compile-get-constant t)))
                       (byte-compile-log-lap "  %s %s %s\t-->\t%s %s %s"
                                             lap0 lap1 lap2 lap0 lap1
                                             (cons (car lap0) tmp))
@@ -1616,7 +1597,7 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
               (byte-compile-log-lap "  dup %s discard\t-->\t%s" lap1 lap1)
               (setq keep-going t
                     rest (cdr rest))
-               (if (eq 'byte-stack-set (car lap1)) (decf (cdr lap1)))
+               (if (eq 'byte-stack-set (car lap1)) (cl-decf (cdr lap1)))
               (setq lap (delq lap0 (delq lap2 lap))))
              ;;
              ;; not goto-X-if-nil              -->  goto-X-if-non-nil
index dc7166bc2ea775528a3f2b90221657d080bfe31f..925d275386f07cb8c3934e67099c06e778f84b6f 100644 (file)
@@ -1,4 +1,4 @@
-;;; byte-run.el --- byte-compiler support for inlining
+;;; byte-run.el --- byte-compiler support for inlining  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1992, 2001-2012  Free Software Foundation, Inc.
 
 
 ;;; Code:
 
-;; We define macro-declaration-function here because it is needed to
-;; handle declarations in macro definitions and this is the first file
-;; loaded by loadup.el that uses declarations in macros.
+;; `macro-declaration-function' are both obsolete (as marked at the end of this
+;; file) but used in many .elc files.
+
+(defvar macro-declaration-function #'macro-declaration-function
+  "Function to process declarations in a macro definition.
+The function will be called with two args MACRO and DECL.
+MACRO is the name of the macro being defined.
+DECL is a list `(declare ...)' containing the declarations.
+The value the function returns is not used.")
 
-(defun macro-declaration-function (macro decl)
-  "Process a declaration found in a macro definition.
+(defalias 'macro-declaration-function
+  #'(lambda (macro decl)
+      "Process a declaration found in a macro definition.
 This is set as the value of the variable `macro-declaration-function'.
 MACRO is the name of the macro being defined.
 DECL is a list `(declare ...)' containing the declarations.
 The return value of this function is not used."
-  ;; We can't use `dolist' or `cadr' yet for bootstrapping reasons.
-  (let (d)
-    ;; Ignore the first element of `decl' (it's always `declare').
-    (while (setq decl (cdr decl))
-      (setq d (car decl))
-      (if (and (consp d)
-              (listp (cdr d))
-              (null (cdr (cdr d))))
-         (cond ((eq (car d) 'indent)
-                (put macro 'lisp-indent-function (car (cdr d))))
-               ((eq (car d) 'debug)
-                (put macro 'edebug-form-spec (car (cdr d))))
-               ((eq (car d) 'doc-string)
-                (put macro 'doc-string-elt (car (cdr d))))
-               (t
-                (message "Unknown declaration %s" d)))
-       (message "Invalid declaration %s" d)))))
-
-
-(setq macro-declaration-function 'macro-declaration-function)
+      ;; We can't use `dolist' or `cadr' yet for bootstrapping reasons.
+      (let (d)
+        ;; Ignore the first element of `decl' (it's always `declare').
+        (while (setq decl (cdr decl))
+          (setq d (car decl))
+          (if (and (consp d)
+                   (listp (cdr d))
+                   (null (cdr (cdr d))))
+              (cond ((eq (car d) 'indent)
+                     (put macro 'lisp-indent-function (car (cdr d))))
+                    ((eq (car d) 'debug)
+                     (put macro 'edebug-form-spec (car (cdr d))))
+                    ((eq (car d) 'doc-string)
+                     (put macro 'doc-string-elt (car (cdr d))))
+                    (t
+                     (message "Unknown declaration %s" d)))
+            (message "Invalid declaration %s" d))))))
+
+;; We define macro-declaration-alist here because it is needed to
+;; handle declarations in macro definitions and this is the first file
+;; loaded by loadup.el that uses declarations in macros.
 
+(defvar defun-declarations-alist
+  (list
+   ;; We can only use backquotes inside the lambdas and not for those
+   ;; properties that are used by functions loaded before backquote.el.
+   (list 'advertised-calling-convention
+         #'(lambda (f _args arglist when)
+             (list 'set-advertised-calling-convention
+                   (list 'quote f) (list 'quote arglist) (list 'quote when))))
+   (list 'obsolete
+         #'(lambda (f _args new-name when)
+             `(make-obsolete ',f ',new-name ,when)))
+   (list 'compiler-macro
+         #'(lambda (f _args compiler-function)
+             `(put ',f 'compiler-macro #',compiler-function)))
+   (list 'doc-string
+         #'(lambda (f _args pos)
+             (list 'put (list 'quote f) ''doc-string-elt (list 'quote pos))))
+   (list 'indent
+         #'(lambda (f _args val)
+             (list 'put (list 'quote f)
+                   ''lisp-indent-function (list 'quote val)))))
+  "List associating function properties to their macro expansion.
+Each element of the list takes the form (PROP FUN) where FUN is
+a function.  For each (PROP . VALUES) in a function's declaration,
+the FUN corresponding to PROP is called with the function name,
+the function's arglist, and the VALUES and should return the code to use
+to set this property.")
+
+(defvar macro-declarations-alist
+  (cons
+   (list 'debug
+         #'(lambda (name _args spec)
+             (list 'progn :autoload-end
+                   (list 'put (list 'quote name)
+                         ''edebug-form-spec (list 'quote spec)))))
+   defun-declarations-alist)
+  "List associating properties of macros to their macro expansion.
+Each element of the list takes the form (PROP FUN) where FUN is
+a function.  For each (PROP . VALUES) in a macro's declaration,
+the FUN corresponding to PROP is called with the function name
+and the VALUES and should return the code to use to set this property.")
+
+(put 'defmacro 'doc-string-elt 3)
+(defalias 'defmacro
+  (cons
+   'macro
+   #'(lambda (name arglist &optional docstring decl &rest body)
+       "Define NAME as a macro.
+When the macro is called, as in (NAME ARGS...),
+the function (lambda ARGLIST BODY...) is applied to
+the list ARGS... as it appears in the expression,
+and the result should be a form to be evaluated instead of the original.
+DECL is a declaration, optional, of the form (declare DECLS...) where
+DECLS is a list of elements of the form (PROP . VALUES).  These are
+interpreted according to `macro-declarations-alist'.
+The return value is undefined."
+       (if (stringp docstring) nil
+         (if decl (setq body (cons decl body)))
+         (setq decl docstring)
+         (setq docstring nil))
+       (if (or (null decl) (eq 'declare (car-safe decl))) nil
+         (setq body (cons decl body))
+         (setq decl nil))
+       (if (null body) (setq body '(nil)))
+       (if docstring (setq body (cons docstring body)))
+       ;; Can't use backquote because it's not defined yet!
+       (let* ((fun (list 'function (cons 'lambda (cons arglist body))))
+              (def (list 'defalias
+                         (list 'quote name)
+                         (list 'cons ''macro fun)))
+              (declarations
+               (mapcar
+                #'(lambda (x)
+                    (let ((f (cdr (assq (car x) macro-declarations-alist))))
+                      (if f (apply (car f) name arglist (cdr x))
+                        (message "Warning: Unknown macro property %S in %S"
+                                 (car x) name))))
+                (cdr decl))))
+         (if declarations
+             (cons 'prog1 (cons def declarations))
+           def)))))
+
+;; Now that we defined defmacro we can use it!
+(defmacro defun (name arglist &optional docstring &rest body)
+  "Define NAME as a function.
+The definition is (lambda ARGLIST [DOCSTRING] BODY...).
+See also the function `interactive'.
+DECL is a declaration, optional, of the form (declare DECLS...) where
+DECLS is a list of elements of the form (PROP . VALUES).  These are
+interpreted according to `defun-declarations-alist'.
+The return value is undefined.
+
+\(fn NAME ARGLIST &optional DOCSTRING DECL &rest BODY)"
+  ;; We can't just have `decl' as an &optional argument, because we need
+  ;; to distinguish
+  ;;    (defun foo (arg) (toto) nil)
+  ;; from
+  ;;    (defun foo (arg) (toto)).
+  (declare (doc-string 3))
+  (let ((decls (cond
+                ((eq (car-safe docstring) 'declare)
+                 (prog1 (cdr docstring) (setq docstring nil)))
+                ((eq (car-safe (car body)) 'declare)
+                 (prog1 (cdr (car body)) (setq body (cdr body)))))))
+    (if docstring (setq body (cons docstring body))
+      (if (null body) (setq body '(nil))))
+    (let ((declarations
+           (mapcar
+            #'(lambda (x)
+                (let ((f (cdr (assq (car x) defun-declarations-alist))))
+                  (cond
+                   (f (apply (car f) name arglist (cdr x)))
+                   ;; Yuck!!
+                   ((and (featurep 'cl)
+                         (memq (car x)  ;C.f. cl-do-proclaim.
+                               '(special inline notinline optimize warn)))
+                    (if (null (stringp docstring))
+                        (push (list 'declare x) body)
+                      (setcdr body (cons (list 'declare x) (cdr body))))
+                    nil)
+                   (t (message "Warning: Unknown defun property %S in %S"
+                               (car x) name)))))
+                   decls))
+          (def (list 'defalias
+                     (list 'quote name)
+                     (list 'function
+                           (cons 'lambda
+                                 (cons arglist body))))))
+      (if declarations
+          (cons 'prog1 (cons def declarations))
+        def))))
 \f
 ;; Redefined in byte-optimize.el.
 ;; This is not documented--it's not clear that we should promote it.
@@ -93,10 +232,9 @@ The return value of this function is not used."
 ;;                      (list 'put x ''byte-optimizer nil)))
 ;;             fns)))
 
-;; This has a special byte-hunk-handler in bytecomp.el.
 (defmacro defsubst (name arglist &rest body)
   "Define an inline function.  The syntax is just like that of `defun'."
-  (declare (debug defun))
+  (declare (debug defun) (doc-string 3))
   (or (memq (get name 'byte-optimizer)
            '(nil byte-compile-inline-expand))
       (error "`%s' is a primitive" name))
@@ -107,7 +245,7 @@ The return value of this function is not used."
 
 (defvar advertised-signature-table (make-hash-table :test 'eq :weakness 'key))
 
-(defun set-advertised-calling-convention (function signature when)
+(defun set-advertised-calling-convention (function signature _when)
   "Set the advertised SIGNATURE of FUNCTION.
 This will allow the byte-compiler to warn the programmer when she uses
 an obsolete calling convention.  WHEN specifies since when the calling
@@ -122,15 +260,15 @@ If CURRENT-NAME is a string, that is the `use instead' message
 \(it should end with a period, and not start with a capital).
 WHEN should be a string indicating when the function
 was first made obsolete, for example a date or a release number."
+  (declare (advertised-calling-convention
+            ;; New code should always provide the `when' argument.
+            (obsolete-name current-name when) "23.1"))
   (interactive "aMake function obsolete: \nxObsoletion replacement: ")
   (put obsolete-name 'byte-obsolete-info
        ;; The second entry used to hold the `byte-compile' handler, but
        ;; is not used any more nowadays.
        (purecopy (list current-name nil when)))
   obsolete-name)
-(set-advertised-calling-convention
- ;; New code should always provide the `when' argument.
- 'make-obsolete '(obsolete-name current-name when) "23.1")
 
 (defmacro define-obsolete-function-alias (obsolete-name current-name
                                                   &optional when docstring)
@@ -144,14 +282,13 @@ is equivalent to the following two lines of code:
 \(make-obsolete 'old-fun 'new-fun \"22.1\")
 
 See the docstrings of `defalias' and `make-obsolete' for more details."
-  (declare (doc-string 4))
+  (declare (doc-string 4)
+           (advertised-calling-convention
+            ;; New code should always provide the `when' argument.
+            (obsolete-name current-name when &optional docstring) "23.1"))
   `(progn
      (defalias ,obsolete-name ,current-name ,docstring)
      (make-obsolete ,obsolete-name ,current-name ,when)))
-(set-advertised-calling-convention
- ;; New code should always provide the `when' argument.
- 'define-obsolete-function-alias
- '(obsolete-name current-name when &optional docstring) "23.1")
 
 (defun make-obsolete-variable (obsolete-name current-name &optional when access-type)
   "Make the byte-compiler warn that OBSOLETE-NAME is obsolete.
@@ -161,13 +298,13 @@ WHEN should be a string indicating when the variable
 was first made obsolete, for example a date or a release number.
 ACCESS-TYPE if non-nil should specify the kind of access that will trigger
   obsolescence warnings; it can be either `get' or `set'."
+  (declare (advertised-calling-convention
+            ;; New code should always provide the `when' argument.
+            (obsolete-name current-name when &optional access-type) "23.1"))
   (put obsolete-name 'byte-obsolete-variable
        (purecopy (list current-name access-type when)))
   obsolete-name)
-(set-advertised-calling-convention
- ;; New code should always provide the `when' argument.
- 'make-obsolete-variable
- '(obsolete-name current-name when &optional access-type) "23.1")
+
 
 (defmacro define-obsolete-variable-alias (obsolete-name current-name
                                                 &optional when docstring)
@@ -190,7 +327,10 @@ For the benefit of `custom-set-variables', if OBSOLETE-NAME has
 any of the following properties, they are copied to
 CURRENT-NAME, if it does not already have them:
 'saved-value, 'saved-variable-comment."
-  (declare (doc-string 4))
+  (declare (doc-string 4)
+           (advertised-calling-convention
+            ;; New code should always provide the `when' argument.
+            (obsolete-name current-name when &optional docstring) "23.1"))
   `(progn
      (defvaralias ,obsolete-name ,current-name ,docstring)
      ;; See Bug#4706.
@@ -199,10 +339,6 @@ CURRENT-NAME, if it does not already have them:
             (null (get ,current-name prop))
             (put ,current-name prop (get ,obsolete-name prop))))
      (make-obsolete-variable ,obsolete-name ,current-name ,when)))
-(set-advertised-calling-convention
- ;; New code should always provide the `when' argument.
- 'define-obsolete-variable-alias
- '(obsolete-name current-name when &optional docstring) "23.1")
 
 ;; FIXME This is only defined in this file because the variable- and
 ;; function- versions are too.  Unlike those two, this one is not used
@@ -283,4 +419,9 @@ In interpreted code, this is entirely equivalent to `progn'."
 ;;       (file-format emacs19))"
 ;;   nil)
 
+(make-obsolete-variable 'macro-declaration-function
+                        'macro-declarations-alist "24.2")
+(make-obsolete 'macro-declaration-function
+               'macro-declarations-alist "24.2")
+
 ;;; byte-run.el ends here
index b03e8e252fdf628c4c99512da9454d3e2bc8e0ab..97d7ab924edb25a6aa854bb049fc9fdb9d850b62 100644 (file)
 (require 'backquote)
 (require 'macroexp)
 (require 'cconv)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (or (fboundp 'defsubst)
     ;; This really ought to be loaded already!
@@ -355,7 +355,7 @@ else the global value will be modified."
 (defvar byte-compile-interactive-only-functions
   '(beginning-of-buffer end-of-buffer replace-string replace-regexp
     insert-file insert-buffer insert-file-literally previous-line next-line
-    goto-line comint-run delete-backward-char toggle-read-only)
+    goto-line comint-run delete-backward-char)
   "List of commands that are not meant to be called from Lisp.")
 
 (defvar byte-compile-not-obsolete-vars nil
@@ -738,7 +738,7 @@ BYTES and PC are updated after evaluating all the arguments."
        (bytes-var (car (last args 2)))
        (pc-var (car (last args))))
     `(setq ,bytes-var ,(if (null (cdr byte-exprs))
-                           `(progn (assert (<= 0 ,(car byte-exprs)))
+                           `(progn (cl-assert (<= 0 ,(car byte-exprs)))
                                    (cons ,@byte-exprs ,bytes-var))
                          `(nconc (list ,@(reverse byte-exprs)) ,bytes-var))
            ,pc-var (+ ,(length byte-exprs) ,pc-var))))
@@ -1002,12 +1002,14 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
 
 (defvar byte-compile-last-warned-form nil)
 (defvar byte-compile-last-logged-file nil)
+(defvar byte-compile-root-dir nil
+  "Directory relative to which file names in error messages are written.")
 
 ;; This is used as warning-prefix for the compiler.
 ;; It is always called with the warnings buffer current.
 (defun byte-compile-warning-prefix (level entry)
   (let* ((inhibit-read-only t)
-        (dir default-directory)
+        (dir (or byte-compile-root-dir default-directory))
         (file (cond ((stringp byte-compile-current-file)
                      (format "%s:" (file-relative-name
                                      byte-compile-current-file dir)))
@@ -1167,12 +1169,14 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
              (t fn)))))))
 
 (defun byte-compile-arglist-signature (arglist)
-  (if (integerp arglist)
-      ;; New style byte-code arglist.
-      (cons (logand arglist 127)             ;Mandatory.
-            (if (zerop (logand arglist 128)) ;No &rest.
-                (lsh arglist -8)))           ;Nonrest.
-    ;; Old style byte-code, or interpreted function.
+  (cond
+   ;; New style byte-code arglist.
+   ((integerp arglist)
+    (cons (logand arglist 127)             ;Mandatory.
+          (if (zerop (logand arglist 128)) ;No &rest.
+              (lsh arglist -8))))          ;Nonrest.
+   ;; Old style byte-code, or interpreted function.
+   ((listp arglist)
     (let ((args 0)
           opts
           restp)
@@ -1188,7 +1192,9 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
                    (setq opts (1+ opts))
                 (setq args (1+ args)))))
         (setq arglist (cdr arglist)))
-      (cons args (if restp nil (if opts (+ args opts) args))))))
+      (cons args (if restp nil (if opts (+ args opts) args)))))
+   ;; Unknown arglist.
+   (t '(0))))
 
 
 (defun byte-compile-arglist-signatures-congruent-p (old new)
@@ -1248,8 +1254,8 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
     ;; and/or remember its arity if it's unknown.
     (or (and (or def (fboundp (car form))) ; might be a subr or autoload.
             (not (memq (car form) byte-compile-noruntime-functions)))
-       (eq (car form) byte-compile-current-form) ; ## this doesn't work
-                                       ; with recursion.
+       (eq (car form) byte-compile-current-form) ; ## This doesn't work
+                                                  ; with recursion.
        ;; It's a currently-undefined function.
        ;; Remember number of args in call.
        (let ((cons (assq (car form) byte-compile-unresolved-functions))
@@ -1314,9 +1320,8 @@ extra args."
 
 ;; Warn if the function or macro is being redefined with a different
 ;; number of arguments.
-(defun byte-compile-arglist-warn (form macrop)
-  (let* ((name (nth 1 form))
-         (old (byte-compile-fdefinition name macrop))
+(defun byte-compile-arglist-warn (name arglist macrop)
+  (let* ((old (byte-compile-fdefinition name macrop))
          (initial (and macrop
                        (cdr (assq name
                                   byte-compile-initial-macro-environment)))))
@@ -1335,12 +1340,12 @@ extra args."
                          (`(closure ,_ ,args . ,_) args)
                          ((pred byte-code-function-p) (aref old 0))
                          (t '(&rest def)))))
-               (sig2 (byte-compile-arglist-signature (nth 2 form))))
+               (sig2 (byte-compile-arglist-signature arglist)))
            (unless (byte-compile-arglist-signatures-congruent-p sig1 sig2)
              (byte-compile-set-symbol-position name)
              (byte-compile-warn
               "%s %s used to take %s %s, now takes %s"
-              (if (eq (car form) 'defun) "function" "macro")
+              (if macrop "macro" "function")
               name
               (byte-compile-arglist-signature-string sig1)
               (if (equal sig1 '(1 . 1)) "argument" "arguments")
@@ -1354,7 +1359,7 @@ extra args."
                          'byte-compile-inline-expand))
             (byte-compile-warn "defsubst `%s' was used before it was defined"
                       name))
-          (setq sig (byte-compile-arglist-signature (nth 2 form))
+          (setq sig (byte-compile-arglist-signature arglist)
                 nums (sort (copy-sequence (cdr calls)) (function <))
                 min (car nums)
                 max (car (nreverse nums)))
@@ -1394,18 +1399,18 @@ extra args."
             ;; These aren't all aliases of subrs, so not trivial to
             ;; avoid hardwiring the list.
             (not (memq func
-                       '(cl-block-wrapper cl-block-throw
+                       '(cl--block-wrapper cl--block-throw
                          multiple-value-call nth-value
                          copy-seq first second rest endp cl-member
                          ;; These are included in generated code
                          ;; that can't be called except at compile time
                          ;; or unless cl is loaded anyway.
-                         cl-defsubst-expand cl-struct-setf-expander
+                         cl--defsubst-expand cl-struct-setf-expander
                          ;; These would sometimes be warned about
                          ;; but such warnings are never useful,
                          ;; so don't warn about them.
                          macroexpand cl-macroexpand-all
-                         cl-compiling-file))))
+                         cl--compiling-file))))
        (byte-compile-warn "function `%s' from cl package called at runtime"
                           func)))
   form)
@@ -1459,57 +1464,40 @@ extra args."
   nil)
 
 \f
-(defsubst byte-compile-const-symbol-p (symbol &optional any-value)
-  "Non-nil if SYMBOL is constant.
-If ANY-VALUE is nil, only return non-nil if the value of the symbol is the
-symbol itself."
-  (or (memq symbol '(nil t))
-      (keywordp symbol)
-      (if any-value
-         (or (memq symbol byte-compile-const-variables)
-             ;; FIXME: We should provide a less intrusive way to find out
-             ;; if a variable is "constant".
-             (and (boundp symbol)
-                  (condition-case nil
-                      (progn (set symbol (symbol-value symbol)) nil)
-                    (setting-constant t)))))))
-
-(defmacro byte-compile-constp (form)
-  "Return non-nil if FORM is a constant."
-  `(cond ((consp ,form) (eq (car ,form) 'quote))
-        ((not (symbolp ,form)))
-        ((byte-compile-const-symbol-p ,form))))
+;; Dynamically bound in byte-compile-from-buffer.
+;; NB also used in cl.el and cl-macs.el.
+(defvar byte-compile--outbuffer)
 
 (defmacro byte-compile-close-variables (&rest body)
   (declare (debug t))
-  (cons 'let
-       (cons '(;;
-               ;; Close over these variables to encapsulate the
-               ;; compilation state
-               ;;
-               (byte-compile-macro-environment
-                ;; Copy it because the compiler may patch into the
-                ;; macroenvironment.
-                (copy-alist byte-compile-initial-macro-environment))
-               (byte-compile-function-environment nil)
-               (byte-compile-bound-variables nil)
-               (byte-compile-const-variables nil)
-               (byte-compile-free-references nil)
-               (byte-compile-free-assignments nil)
-               ;;
-               ;; Close over these variables so that `byte-compiler-options'
-               ;; can change them on a per-file basis.
-               ;;
-               (byte-compile-verbose byte-compile-verbose)
-               (byte-optimize byte-optimize)
-               (byte-compile-dynamic byte-compile-dynamic)
-               (byte-compile-dynamic-docstrings
-                byte-compile-dynamic-docstrings)
-;;             (byte-compile-generate-emacs19-bytecodes
-;;              byte-compile-generate-emacs19-bytecodes)
-               (byte-compile-warnings byte-compile-warnings)
-               )
-             body)))
+  `(let (;;
+         ;; Close over these variables to encapsulate the
+         ;; compilation state
+         ;;
+         (byte-compile-macro-environment
+          ;; Copy it because the compiler may patch into the
+          ;; macroenvironment.
+          (copy-alist byte-compile-initial-macro-environment))
+         (byte-compile--outbuffer nil)
+         (byte-compile-function-environment nil)
+         (byte-compile-bound-variables nil)
+         (byte-compile-const-variables nil)
+         (byte-compile-free-references nil)
+         (byte-compile-free-assignments nil)
+         ;;
+         ;; Close over these variables so that `byte-compiler-options'
+         ;; can change them on a per-file basis.
+         ;;
+         (byte-compile-verbose byte-compile-verbose)
+         (byte-optimize byte-optimize)
+         (byte-compile-dynamic byte-compile-dynamic)
+         (byte-compile-dynamic-docstrings
+          byte-compile-dynamic-docstrings)
+         ;;            (byte-compile-generate-emacs19-bytecodes
+         ;;             byte-compile-generate-emacs19-bytecodes)
+         (byte-compile-warnings byte-compile-warnings)
+         )
+     ,@body))
 
 (defmacro displaying-byte-compile-warnings (&rest body)
   (declare (debug t))
@@ -1603,10 +1591,11 @@ that already has a `.elc' file."
                         (not (auto-save-file-name-p source))
                         (not (string-equal dir-locals-file
                                            (file-name-nondirectory source))))
-                   (progn (case (byte-recompile-file source force arg)
-                            (no-byte-compile (setq skip-count (1+ skip-count)))
-                            ((t) (setq file-count (1+ file-count)))
-                            ((nil) (setq fail-count (1+ fail-count))))
+                   (progn (cl-incf
+                           (pcase (byte-recompile-file source force arg)
+                             (`no-byte-compile skip-count)
+                             (`t file-count)
+                             (_ fail-count)))
                           (or noninteractive
                               (message "Checking %s..." directory))
                           (if (not (eq last-dir directory))
@@ -1737,14 +1726,18 @@ The value is non-nil if there were no errors, nil if errors."
        (set-buffer-multibyte nil))
       ;; Run hooks including the uncompression hook.
       ;; If they change the file name, then change it for the output also.
-      (letf ((buffer-file-name filename)
-             ((default-value 'major-mode) 'emacs-lisp-mode)
-             ;; Ignore unsafe local variables.
-             ;; We only care about a few of them for our purposes.
-             (enable-local-variables :safe)
-             (enable-local-eval nil))
-       ;; Arg of t means don't alter enable-local-variables.
-        (normal-mode t)
+      (let ((buffer-file-name filename)
+            (dmm (default-value 'major-mode))
+            ;; Ignore unsafe local variables.
+            ;; We only care about a few of them for our purposes.
+            (enable-local-variables :safe)
+            (enable-local-eval nil))
+        (unwind-protect
+            (progn
+              (setq-default major-mode 'emacs-lisp-mode)
+              ;; Arg of t means don't alter enable-local-variables.
+              (normal-mode t))
+          (setq-default major-mode dmm))
         ;; There may be a file local variable setting (bug#10419).
         (setq buffer-read-only nil
               filename buffer-file-name))
@@ -1850,13 +1843,8 @@ With argument ARG, insert value in current buffer after the form."
             (insert "\n"))
            ((message "%s" (prin1-to-string value)))))))
 
-;; Dynamically bound in byte-compile-from-buffer.
-;; NB also used in cl.el and cl-macs.el.
-(defvar byte-compile--outbuffer)
-
 (defun byte-compile-from-buffer (inbuffer)
-  (let (byte-compile--outbuffer
-       (byte-compile-current-buffer inbuffer)
+  (let ((byte-compile-current-buffer inbuffer)
        (byte-compile-read-position nil)
        (byte-compile-last-position nil)
        ;; Prevent truncation of flonums and lists as we read and print them
@@ -1928,8 +1916,8 @@ and will be removed soon.  See (elisp)Backquote in the manual."))
       ;; if the buffer contains multibyte characters.
       (and byte-compile-current-file
           (with-current-buffer byte-compile--outbuffer
-            (byte-compile-fix-header byte-compile-current-file)))))
-    byte-compile--outbuffer))
+            (byte-compile-fix-header byte-compile-current-file))))
+     byte-compile--outbuffer)))
 
 (defun byte-compile-fix-header (_filename)
   "If the current buffer has any multibyte characters, insert a version test."
@@ -1959,7 +1947,7 @@ and will be removed soon.  See (elisp)Backquote in the manual."))
        ;; Because the header must fit in a fixed width, we cannot
        ;; insert arbitrary-length file names (Bug#11585).
        "     (error \"`%s' was compiled for "
-       (format "Emacs %s or later\" load-file-name))\n\n" minimum-version))
+       (format "Emacs %s or later\" #$))\n\n" minimum-version))
       ;; Now compensate for any change in size, to make sure all
       ;; positions in the file remain valid.
       (setq delta (- (point-max) old-header-end))
@@ -2016,31 +2004,30 @@ Call from the source buffer."
        ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"))))
 
 (defun byte-compile-output-file-form (form)
-  ;; writes the given form to the output buffer, being careful of docstrings
-  ;; in defun, defmacro, defvar, defvaralias, defconst, autoload and
+  ;; Write the given form to the output buffer, being careful of docstrings
+  ;; in defvar, defvaralias, defconst, autoload and
   ;; custom-declare-variable because make-docfile is so amazingly stupid.
   ;; defalias calls are output directly by byte-compile-file-form-defmumble;
   ;; it does not pay to first build the defalias in defmumble and then parse
   ;; it here.
-  (if (and (memq (car-safe form) '(defun defmacro defvar defvaralias defconst
-                                    autoload custom-declare-variable))
-          (stringp (nth 3 form)))
-      (byte-compile-output-docform nil nil '("\n(" 3 ")") form nil
-                                  (memq (car form)
-                                        '(defvaralias autoload
-                                          custom-declare-variable)))
-    (let ((print-escape-newlines t)
-         (print-length nil)
-         (print-level nil)
-         (print-quoted t)
-         (print-gensym t)
-         (print-circle              ; handle circular data structures
-          (not byte-compile-disable-print-circle)))
+  (let ((print-escape-newlines t)
+        (print-length nil)
+        (print-level nil)
+        (print-quoted t)
+        (print-gensym t)
+        (print-circle                   ; Handle circular data structures.
+         (not byte-compile-disable-print-circle)))
+    (if (and (memq (car-safe form) '(defvar defvaralias defconst
+                                      autoload custom-declare-variable))
+             (stringp (nth 3 form)))
+        (byte-compile-output-docform nil nil '("\n(" 3 ")") form nil
+                                     (memq (car form)
+                                           '(defvaralias autoload
+                                              custom-declare-variable)))
       (princ "\n" byte-compile--outbuffer)
       (prin1 form byte-compile--outbuffer)
       nil)))
 
-(defvar print-gensym-alist)            ;Used before print-circle existed.
 (defvar byte-compile--for-effect)
 
 (defun byte-compile-output-docform (preface name info form specindex quoted)
@@ -2070,7 +2057,6 @@ list that represents a doc string reference.
                (setq position
                      (byte-compile-output-as-comment
                       (nth (nth 1 info) form) nil))
-               (setq position (- (position-bytes position) (point-min) -1))
                ;; If the doc string starts with * (a user variable),
                ;; negate POSITION.
                (if (and (stringp (nth (nth 1 info) form))
@@ -2083,19 +2069,18 @@ list that represents a doc string reference.
               (insert preface)
               (prin1 name byte-compile--outbuffer)))
         (insert (car info))
-        (let ((print-escape-newlines t)
-              (print-quoted t)
-              ;; For compatibility with code before print-circle,
-              ;; use a cons cell to say that we want
-              ;; print-gensym-alist not to be cleared
-              ;; between calls to print functions.
-              (print-gensym '(t))
-              (print-circle             ; handle circular data structures
-               (not byte-compile-disable-print-circle))
-              print-gensym-alist     ; was used before print-circle existed.
-              (print-continuous-numbering t)
+        (let ((print-continuous-numbering t)
               print-number-table
-              (index 0))
+              (index 0)
+              ;; FIXME: The bindings below are only needed for when we're
+              ;; called from ...-defmumble.
+              (print-escape-newlines t)
+              (print-length nil)
+              (print-level nil)
+              (print-quoted t)
+              (print-gensym t)
+              (print-circle             ; Handle circular data structures.
+               (not byte-compile-disable-print-circle)))
           (prin1 (car form) byte-compile--outbuffer)
           (while (setq form (cdr form))
             (setq index (1+ index))
@@ -2116,8 +2101,6 @@ list that represents a doc string reference.
                           (byte-compile-output-as-comment
                            (cons (car form) (nth 1 form))
                            t)))
-                     (setq position (- (position-bytes position)
-                                       (point-min) -1))
                      (princ (format "(#$ . %d) nil" position)
                             byte-compile--outbuffer)
                      (setq form (cdr form))
@@ -2203,7 +2186,7 @@ list that represents a doc string reference.
 (put 'autoload 'byte-hunk-handler 'byte-compile-file-form-autoload)
 (defun byte-compile-file-form-autoload (form)
   (and (let ((form form))
-        (while (if (setq form (cdr form)) (byte-compile-constp (car form))))
+        (while (if (setq form (cdr form)) (macroexp-const-p (car form))))
         (null form))                   ;Constants only
        (eval (nth 5 form))             ;Macro
        (eval form))                    ;Define the autoload.
@@ -2265,19 +2248,7 @@ list that represents a doc string reference.
   (when (byte-compile-warning-enabled-p 'callargs)
     (byte-compile-nogroup-warn form))
   (push (nth 1 (nth 1 form)) byte-compile-bound-variables)
-  ;; Don't compile the expression because it may be displayed to the user.
-  ;; (when (eq (car-safe (nth 2 form)) 'quote)
-  ;;   ;; (nth 2 form) is meant to evaluate to an expression, so if we have the
-  ;;   ;; final value already, we can byte-compile it.
-  ;;   (setcar (cdr (nth 2 form))
-  ;;           (byte-compile-top-level (cadr (nth 2 form)) nil 'file)))
-  (let ((tail (nthcdr 4 form)))
-    (while tail
-      (unless (keywordp (car tail))      ;No point optimizing keywords.
-        ;; Compile the keyword arguments.
-        (setcar tail (byte-compile-top-level (car tail) nil 'file)))
-      (setq tail (cdr tail))))
-  form)
+  (byte-compile-keep-pending form))
 
 (put 'require 'byte-hunk-handler 'byte-compile-file-form-require)
 (defun byte-compile-file-form-require (form)
@@ -2324,143 +2295,132 @@ list that represents a doc string reference.
       (nth 1 (nth 1 form))
     (byte-compile-keep-pending form)))
 
-(put 'defun 'byte-hunk-handler 'byte-compile-file-form-defun)
-(defun byte-compile-file-form-defun (form)
-  (byte-compile-file-form-defmumble form nil))
-
-(put 'defmacro 'byte-hunk-handler 'byte-compile-file-form-defmacro)
-(defun byte-compile-file-form-defmacro (form)
-  (byte-compile-file-form-defmumble form t))
-
-(defun byte-compile-defmacro-declaration (form)
-  "Generate code for declarations in macro definitions.
-Remove declarations from the body of the macro definition
-by side-effects."
-  (let ((tail (nthcdr 2 form))
-        (res '()))
-    (when (stringp (car (cdr tail)))
-      (setq tail (cdr tail)))
-    (while (and (consp (car (cdr tail)))
-                (eq (car (car (cdr tail))) 'declare))
-      (let ((declaration (car (cdr tail))))
-        (setcdr tail (cdr (cdr tail)))
-        (push `(if macro-declaration-function
-                   (funcall macro-declaration-function
-                            ',(car (cdr form)) ',declaration))
-              res)))
-    res))
-
-(defun byte-compile-file-form-defmumble (form macrop)
-  (let* ((name (car (cdr form)))
-        (this-kind (if macrop 'byte-compile-macro-environment
-                     'byte-compile-function-environment))
-        (that-kind (if macrop 'byte-compile-function-environment
-                     'byte-compile-macro-environment))
-        (this-one (assq name (symbol-value this-kind)))
-        (that-one (assq name (symbol-value that-kind)))
-        (byte-compile-free-references nil)
-        (byte-compile-free-assignments nil))
+(defun byte-compile-file-form-defmumble (name macro arglist body rest)
+  "Process a `defalias' for NAME.
+If MACRO is non-nil, the definition is known to be a macro.
+ARGLIST is the list of arguments, if it was recognized or t otherwise.
+BODY of the definition, or t if not recognized.
+Return non-nil if everything went as planned, or nil to imply that it decided
+not to take responsibility for the actual compilation of the code."
+  (let* ((this-kind (if macro 'byte-compile-macro-environment
+                      'byte-compile-function-environment))
+         (that-kind (if macro 'byte-compile-function-environment
+                      'byte-compile-macro-environment))
+         (this-one (assq name (symbol-value this-kind)))
+         (that-one (assq name (symbol-value that-kind)))
+         (byte-compile-current-form name)) ; For warnings.
+
     (byte-compile-set-symbol-position name)
     ;; When a function or macro is defined, add it to the call tree so that
     ;; we can tell when functions are not used.
     (if byte-compile-generate-call-tree
-       (or (assq name byte-compile-call-tree)
-           (setq byte-compile-call-tree
-                 (cons (list name nil nil) byte-compile-call-tree))))
+        (or (assq name byte-compile-call-tree)
+            (setq byte-compile-call-tree
+                  (cons (list name nil nil) byte-compile-call-tree))))
 
-    (setq byte-compile-current-form name) ; for warnings
     (if (byte-compile-warning-enabled-p 'redefine)
-       (byte-compile-arglist-warn form macrop))
+        (byte-compile-arglist-warn name arglist macro))
+
     (if byte-compile-verbose
-       (message "Compiling %s... (%s)"
-                 (or byte-compile-current-file "") (nth 1 form)))
-    (cond (that-one
-          (if (and (byte-compile-warning-enabled-p 'redefine)
-                   ;; don't warn when compiling the stubs in byte-run...
-                   (not (assq (nth 1 form)
-                              byte-compile-initial-macro-environment)))
-              (byte-compile-warn
+        (message "Compiling %s... (%s)"
+                 (or byte-compile-current-file "") name))
+    (cond ((not (or macro (listp body)))
+           ;; We do not know positively if the definition is a macro
+           ;; or a function, so we shouldn't emit warnings.
+           ;; This also silences "multiple definition" warnings for defmethods.
+           nil)
+          (that-one
+           (if (and (byte-compile-warning-enabled-p 'redefine)
+                    ;; Don't warn when compiling the stubs in byte-run...
+                    (not (assq name byte-compile-initial-macro-environment)))
+               (byte-compile-warn
                 "`%s' defined multiple times, as both function and macro"
-                (nth 1 form)))
-          (setcdr that-one nil))
-         (this-one
-          (when (and (byte-compile-warning-enabled-p 'redefine)
-                      ;; hack: don't warn when compiling the magic internal
+                name))
+           (setcdr that-one nil))
+          (this-one
+           (when (and (byte-compile-warning-enabled-p 'redefine)
+                      ;; Hack: Don't warn when compiling the magic internal
                       ;; byte-compiler macros in byte-run.el...
-                      (not (assq (nth 1 form)
-                                 byte-compile-initial-macro-environment)))
-            (byte-compile-warn "%s `%s' defined multiple times in this file"
-                               (if macrop "macro" "function")
-                               (nth 1 form))))
-         ((and (fboundp name)
-               (eq (car-safe (symbol-function name))
-                   (if macrop 'lambda 'macro)))
-          (when (byte-compile-warning-enabled-p 'redefine)
-            (byte-compile-warn "%s `%s' being redefined as a %s"
-                               (if macrop "function" "macro")
-                               (nth 1 form)
-                               (if macrop "macro" "function")))
-          ;; shadow existing definition
-          (set this-kind
-               (cons (cons name nil)
-                     (symbol-value this-kind))))
-         )
-    (let ((body (nthcdr 3 form)))
-      (when (and (stringp (car body))
-                (symbolp (car-safe (cdr-safe body)))
-                (car-safe (cdr-safe body))
-                (stringp (car-safe (cdr-safe (cdr-safe body)))))
-       (byte-compile-set-symbol-position (nth 1 form))
-       (byte-compile-warn "probable `\"' without `\\' in doc string of %s"
-                          (nth 1 form))))
-
-    ;; Generate code for declarations in macro definitions.
-    ;; Remove declarations from the body of the macro definition.
-    (when macrop
-      (dolist (decl (byte-compile-defmacro-declaration form))
-        (prin1 decl byte-compile--outbuffer)))
-
-    (let* ((code (byte-compile-lambda (nthcdr 2 form) t)))
-      (if this-one
-         ;; A definition in b-c-initial-m-e should always take precedence
-         ;; during compilation, so don't let it be redefined.  (Bug#8647)
-         (or (and macrop
-                  (assq name byte-compile-initial-macro-environment))
-             (setcdr this-one code))
-       (set this-kind
-            (cons (cons name code)
-                  (symbol-value this-kind))))
-      (byte-compile-flush-pending)
-      (if (not (stringp (nth 3 form)))
-          ;; No doc string.  Provide -1 as the "doc string index"
-          ;; so that no element will be treated as a doc string.
-          (byte-compile-output-docform
-           "\n(defalias '"
-           name
-           (if macrop '(" '(macro . #[" -1 "])") '(" #[" -1 "]"))
-           (append code nil)            ; Turn byte-code-function-p into list.
-           (and (atom code) byte-compile-dynamic
-                1)
-           nil)
-        ;; Output the form by hand, that's much simpler than having
-        ;; b-c-output-file-form analyze the defalias.
-        (byte-compile-output-docform
-         "\n(defalias '"
-         name
-         (if macrop '(" '(macro . #[" 4 "])") '(" #[" 4 "]"))
-         (append code nil)              ; Turn byte-code-function-p into list.
-         (and (atom code) byte-compile-dynamic
-              1)
-         nil))
-      (princ ")" byte-compile--outbuffer)
-      nil)))
+                      (not (assq name byte-compile-initial-macro-environment)))
+             (byte-compile-warn "%s `%s' defined multiple times in this file"
+                                (if macro "macro" "function")
+                                name)))
+          ((and (fboundp name)
+                (eq (car-safe (symbol-function name))
+                    (if macro 'lambda 'macro)))
+           (when (byte-compile-warning-enabled-p 'redefine)
+             (byte-compile-warn "%s `%s' being redefined as a %s"
+                                (if macro "function" "macro")
+                                name
+                                (if macro "macro" "function")))
+           ;; Shadow existing definition.
+           (set this-kind
+                (cons (cons name nil)
+                      (symbol-value this-kind))))
+          )
+
+    (when (and (listp body)
+               (stringp (car body))
+               (symbolp (car-safe (cdr-safe body)))
+               (car-safe (cdr-safe body))
+               (stringp (car-safe (cdr-safe (cdr-safe body)))))
+      ;; FIXME: We've done that already just above, so this looks wrong!
+      ;;(byte-compile-set-symbol-position name)
+      (byte-compile-warn "probable `\"' without `\\' in doc string of %s"
+                         name))
+
+    (if (not (listp body))
+        ;; The precise definition requires evaluation to find out, so it
+        ;; will only be known at runtime.
+        ;; For a macro, that means we can't use that macro in the same file.
+        (progn
+          (unless macro
+            (push (cons name (if (listp arglist) `(declared ,arglist) t))
+                  byte-compile-function-environment))
+          ;; Tell the caller that we didn't compile it yet.
+          nil)
+
+      (let* ((code (byte-compile-lambda (cons arglist body) t)))
+        (if this-one
+            ;; A definition in b-c-initial-m-e should always take precedence
+            ;; during compilation, so don't let it be redefined.  (Bug#8647)
+            (or (and macro
+                     (assq name byte-compile-initial-macro-environment))
+                (setcdr this-one code))
+          (set this-kind
+               (cons (cons name code)
+                     (symbol-value this-kind))))
+
+        (if rest
+            ;; There are additional args to `defalias' (like maybe a docstring)
+            ;; that the code below can't handle: punt!
+            nil
+          ;; Otherwise, we have a bona-fide defun/defmacro definition, and use
+          ;; special code to allow dynamic docstrings and byte-code.
+          (byte-compile-flush-pending)
+          (let ((index
+                 ;; If there's no doc string, provide -1 as the "doc string
+                 ;; index" so that no element will be treated as a doc string.
+                 (if (not (stringp (car body))) -1 4)))
+            ;; Output the form by hand, that's much simpler than having
+            ;; b-c-output-file-form analyze the defalias.
+            (byte-compile-output-docform
+             "\n(defalias '"
+             name
+             (if macro `(" '(macro . #[" ,index "])") `(" #[" ,index "]"))
+             (append code nil)          ; Turn byte-code-function-p into list.
+             (and (atom code) byte-compile-dynamic
+                  1)
+             nil))
+          (princ ")" byte-compile--outbuffer)
+          t)))))
 
-;; Print Lisp object EXP in the output file, inside a comment,
-;; and return the file position it will have.
-;; If QUOTED is non-nil, print with quoting; otherwise, print without quoting.
 (defun byte-compile-output-as-comment (exp quoted)
-  (let ((position (point)))
-    (with-current-buffer byte-compile--outbuffer
+  "Print Lisp object EXP in the output file, inside a comment,
+and return the file (byte) position it will have.
+If QUOTED is non-nil, print with quoting; otherwise, print without quoting."
+  (with-current-buffer byte-compile--outbuffer
+    (let ((position (point)))
 
       ;; Insert EXP, and make it a comment with #@LENGTH.
       (insert " ")
@@ -2485,15 +2445,33 @@ by side-effects."
                                    (position-bytes position))))
 
       ;; Save the file position of the object.
-      ;; Note we should add 1 to skip the space
-      ;; that we inserted before the actual doc string,
-      ;; and subtract 1 to convert from an 1-origin Emacs position
-      ;; to a file position; they cancel.
-      (setq position (point))
-      (goto-char (point-max)))
-    position))
-
-
+      ;; Note we add 1 to skip the space that we inserted before the actual doc
+      ;; string, and subtract point-min to convert from an 1-origin Emacs
+      ;; position to a file position.
+      (prog1
+          (- (position-bytes (point)) (point-min) -1)
+        (goto-char (point-max))))))
+
+(defun byte-compile--reify-function (fun)
+  "Return an expression which will evaluate to a function value FUN.
+FUN should be either a `lambda' value or a `closure' value."
+  (pcase-let* (((or (and `(lambda ,args . ,body) (let env nil))
+                    `(closure ,env ,args . ,body)) fun)
+               (renv ()))
+    ;; Turn the function's closed vars (if any) into local let bindings.
+    (dolist (binding env)
+      (cond
+       ((consp binding)
+        ;; We check shadowing by the args, so that the `let' can be moved
+        ;; within the lambda, which can then be unfolded.  FIXME: Some of those
+        ;; bindings might be unused in `body'.
+        (unless (memq (car binding) args) ;Shadowed.
+          (push `(,(car binding) ',(cdr binding)) renv)))
+       ((eq binding t))
+       (t (push `(defvar ,binding) body))))
+    (if (null renv)
+        `(lambda ,args ,@body)
+      `(lambda ,args (let ,(nreverse renv) ,@body)))))
 \f
 ;;;###autoload
 (defun byte-compile (form)
@@ -2501,23 +2479,39 @@ by side-effects."
 If FORM is a lambda or a macro, byte-compile it as a function."
   (displaying-byte-compile-warnings
    (byte-compile-close-variables
-    (let* ((fun (if (symbolp form)
+    (let* ((lexical-binding lexical-binding)
+           (fun (if (symbolp form)
                    (and (fboundp form) (symbol-function form))
                  form))
           (macro (eq (car-safe fun) 'macro)))
       (if macro
          (setq fun (cdr fun)))
-      (cond ((eq (car-safe fun) 'lambda)
-            ;; Expand macros.
-             (setq fun (byte-compile-preprocess fun))
-            ;; Get rid of the `function' quote added by the `lambda' macro.
-            (if (eq (car-safe fun) 'function) (setq fun (cadr fun)))
-            (setq fun (if macro
-                          (cons 'macro (byte-compile-lambda fun))
-                        (byte-compile-lambda fun)))
-            (if (symbolp form)
-                (defalias form fun)
-              fun)))))))
+      (cond
+       ;; Up until Emacs-24.1, byte-compile silently did nothing when asked to
+       ;; compile something invalid.  So let's tune down the complaint from an
+       ;; error to a simple message for the known case where signaling an error
+       ;; causes problems.
+       ((byte-code-function-p fun)
+        (message "Function %s is already compiled"
+                 (if (symbolp form) form "provided"))
+        fun)
+       (t
+        (when (symbolp form)
+          (unless (memq (car-safe fun) '(closure lambda))
+            (error "Don't know how to compile %S" fun))
+          (setq fun (byte-compile--reify-function fun))
+          (setq lexical-binding (eq (car fun) 'closure)))
+        (unless (eq (car-safe fun) 'lambda)
+          (error "Don't know how to compile %S" fun))
+        ;; Expand macros.
+        (setq fun (byte-compile-preprocess fun))
+        ;; Get rid of the `function' quote added by the `lambda' macro.
+        (if (eq (car-safe fun) 'function) (setq fun (cadr fun)))
+        (setq fun (byte-compile-lambda fun))
+        (if macro (push 'macro fun))
+        (if (symbolp form)
+            (fset form fun)
+          fun)))))))
 
 (defun byte-compile-sexp (sexp)
   "Compile and return SEXP."
@@ -2533,7 +2527,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
        (when (symbolp arg)
          (byte-compile-set-symbol-position arg))
        (cond ((or (not (symbolp arg))
-                  (byte-compile-const-symbol-p arg t))
+                  (macroexp--const-symbol-p arg t))
               (error "Invalid lambda variable %s" arg))
              ((eq arg '&rest)
               (unless (cdr list)
@@ -2588,14 +2582,15 @@ If FORM is a lambda or a macro, byte-compile it as a function."
               (lsh nonrest 8)
               (lsh rest 7)))))
 
-;; Byte-compile a lambda-expression and return a valid function.
-;; The value is usually a compiled function but may be the original
-;; lambda-expression.
-;; When ADD-LAMBDA is non-nil, the symbol `lambda' is added as head
-;; of the list FUN and `byte-compile-set-symbol-position' is not called.
-;; Use this feature to avoid calling `byte-compile-set-symbol-position'
-;; for symbols generated by the byte compiler itself.
+
 (defun byte-compile-lambda (fun &optional add-lambda reserved-csts)
+  "Byte-compile a lambda-expression and return a valid function.
+The value is usually a compiled function but may be the original
+lambda-expression.
+When ADD-LAMBDA is non-nil, the symbol `lambda' is added as head
+of the list FUN and `byte-compile-set-symbol-position' is not called.
+Use this feature to avoid calling `byte-compile-set-symbol-position'
+for symbols generated by the byte compiler itself."
   (if add-lambda
       (setq fun (cons 'lambda fun))
     (unless (eq 'lambda (car-safe fun))
@@ -2656,24 +2651,23 @@ If FORM is a lambda or a macro, byte-compile it as a function."
                                         (byte-compile-make-lambda-lexenv fun))
                                    reserved-csts)))
       ;; Build the actual byte-coded function.
-      (if (eq 'byte-code (car-safe compiled))
-          (apply 'make-byte-code
-                 (if lexical-binding
-                     (byte-compile-make-args-desc arglist)
-                   arglist)
-                 (append
-                  ;; byte-string, constants-vector, stack depth
-                  (cdr compiled)
-                  ;; optionally, the doc string.
-                  (cond (lexical-binding
-                         (require 'help-fns)
-                         (list (help-add-fundoc-usage doc arglist)))
-                        ((or doc int)
-                         (list doc)))
-                  ;; optionally, the interactive spec.
-                  (if int
-                      (list (nth 1 int)))))
-        (error "byte-compile-top-level did not return byte-code")))))
+      (cl-assert (eq 'byte-code (car-safe compiled)))
+      (apply #'make-byte-code
+             (if lexical-binding
+                 (byte-compile-make-args-desc arglist)
+               arglist)
+             (append
+              ;; byte-string, constants-vector, stack depth
+              (cdr compiled)
+              ;; optionally, the doc string.
+              (cond (lexical-binding
+                     (require 'help-fns)
+                     (list (help-add-fundoc-usage doc arglist)))
+                    ((or doc int)
+                     (list doc)))
+              ;; optionally, the interactive spec.
+              (if int
+                  (list (nth 1 int))))))))
 
 (defvar byte-compile-reserved-constants 0)
 
@@ -2700,7 +2694,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
       (while (and rest (< i limit))
        (cond
         ((numberp (car rest))
-         (assert (< (car rest) byte-compile-reserved-constants)))
+         (cl-assert (< (car rest) byte-compile-reserved-constants)))
         ((setq tmp (assq (car (car rest)) ret))
          (setcdr (car rest) (cdr tmp)))
         (t
@@ -2802,7 +2796,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
                   (if (if (eq (car (car rest)) 'byte-constant)
                           (or (consp tmp)
                               (and (symbolp tmp)
-                                   (not (byte-compile-const-symbol-p tmp)))))
+                                   (not (macroexp--const-symbol-p tmp)))))
                       (if maycall
                           (setq body (cons (list 'quote tmp) body)))
                     (setq body (cons tmp body))))
@@ -2847,7 +2841,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
   (push (cons fn
               (if (and (consp args) (listp (car args)))
                   (list 'declared (car args))
-                t))                     ; arglist not specified
+                t))                     ; Arglist not specified.
         byte-compile-function-environment)
   ;; We are stating that it _will_ be defined at runtime.
   (setq byte-compile-noruntime-functions
@@ -2873,7 +2867,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
   (let ((byte-compile--for-effect for-effect))
     (cond
      ((not (consp form))
-      (cond ((or (not (symbolp form)) (byte-compile-const-symbol-p form))
+      (cond ((or (not (symbolp form)) (macroexp--const-symbol-p form))
              (when (symbolp form)
                (byte-compile-set-symbol-position form))
              (byte-compile-constant form))
@@ -2886,7 +2880,7 @@ If FORM is a lambda or a macro, byte-compile it as a function."
      ((symbolp (car form))
       (let* ((fn (car form))
              (handler (get fn 'byte-compile)))
-        (when (byte-compile-const-symbol-p fn)
+        (when (macroexp--const-symbol-p fn)
           (byte-compile-warn "`%s' called as a function" fn))
         (and (byte-compile-warning-enabled-p 'interactive-only)
              (memq fn byte-compile-interactive-only-functions)
@@ -2897,14 +2891,12 @@ That command is designed for interactive use only" fn))
             (byte-compile-log-warning
              (format "Forgot to expand macro %s" (car form)) nil :error))
         (if (and handler
-                 ;; Make sure that function exists.  This is important
-                 ;; for CL compiler macros since the symbol may be
-                 ;; `cl-byte-compile-compiler-macro' but if CL isn't
-                 ;; loaded, this function doesn't exist.
-                 (and (not (eq handler
-                               ;; Already handled by macroexpand-all.
-                               'cl-byte-compile-compiler-macro))
-                      (functionp handler)))
+                 ;; Make sure that function exists.
+                 (and (functionp handler)
+                      ;; Ignore obsolete byte-compile function used by former
+                      ;; CL code to handle compiler macros (we do it
+                      ;; differently now).
+                      (not (eq handler 'cl-byte-compile-compiler-macro))))
             (funcall handler form)
           (byte-compile-normal-call form))
         (if (byte-compile-warning-enabled-p 'cl-functions)
@@ -2981,14 +2973,14 @@ That command is designed for interactive use only" fn))
     (mapc 'byte-compile-form (cdr form))
     (unless fmax2
       ;; Old-style byte-code.
-      (assert (listp fargs))
+      (cl-assert (listp fargs))
       (while fargs
-        (case (car fargs)
-          (&optional (setq fargs (cdr fargs)))
-          (&rest (setq fmax2 (+ (* 2 (length dynbinds)) 1))
+        (pcase (car fargs)
+          (`&optional (setq fargs (cdr fargs)))
+          (`&rest (setq fmax2 (+ (* 2 (length dynbinds)) 1))
                  (push (cadr fargs) dynbinds)
                  (setq fargs nil))
-          (t (push (pop fargs) dynbinds))))
+          (_ (push (pop fargs) dynbinds))))
       (unless fmax2 (setq fmax2 (* 2 (length dynbinds)))))
     (cond
      ((<= (+ alen alen) fmax2)
@@ -3002,7 +2994,7 @@ That command is designed for interactive use only" fn))
      (t
       ;; Turn &rest args into a list.
       (let ((n (- alen (/ (1- fmax2) 2))))
-        (assert (> n 0) nil "problem: fmax2=%S alen=%S n=%S" fmax2 alen n)
+        (cl-assert (> n 0) nil "problem: fmax2=%S alen=%S n=%S" fmax2 alen n)
         (if (< n 5)
             (byte-compile-out
              (aref [byte-list1 byte-list2 byte-list3 byte-list4] (1- n))
@@ -3015,14 +3007,14 @@ That command is designed for interactive use only" fn))
     ;; Unbind dynamic variables.
     (when dynbinds
       (byte-compile-out 'byte-unbind (length dynbinds)))
-    (assert (eq byte-compile-depth (1+ start-depth))
+    (cl-assert (eq byte-compile-depth (1+ start-depth))
             nil "Wrong depth start=%s end=%s" start-depth byte-compile-depth)))
 
 (defun byte-compile-check-variable (var access-type)
   "Do various error checks before a use of the variable VAR."
   (when (symbolp var)
     (byte-compile-set-symbol-position var))
-  (cond ((or (not (symbolp var)) (byte-compile-const-symbol-p var))
+  (cond ((or (not (symbolp var)) (macroexp--const-symbol-p var))
         (when (byte-compile-warning-enabled-p 'constants)
           (byte-compile-warn (if (eq access-type 'let-bind)
                                  "attempt to let-bind %s `%s`"
@@ -3033,10 +3025,10 @@ That command is designed for interactive use only" fn))
            (and od
                 (not (memq var byte-compile-not-obsolete-vars))
                 (not (memq var byte-compile-global-not-obsolete-vars))
-                (or (case (nth 1 od)
-                      (set (not (eq access-type 'reference)))
-                      (get (eq access-type 'reference))
-                      (t t)))))
+                (or (pcase (nth 1 od)
+                      (`set (not (eq access-type 'reference)))
+                      (`get (eq access-type 'reference))
+                      (_ t)))))
         (byte-compile-warn-obsolete var))))
 
 (defsubst byte-compile-dynamic-variable-op (base-op var)
@@ -3073,9 +3065,9 @@ That command is designed for interactive use only" fn))
   (byte-compile-check-variable var 'assign)
   (let ((lex-binding (assq var byte-compile--lexical-environment)))
     (if lex-binding
-       ;; VAR is lexically bound
+       ;; VAR is lexically bound.
         (byte-compile-stack-set (cdr lex-binding))
-      ;; VAR is dynamically bound
+      ;; VAR is dynamically bound.
       (unless (or (not (byte-compile-warning-enabled-p 'free-vars))
                  (boundp var)
                  (memq var byte-compile-bound-variables)
@@ -3360,7 +3352,8 @@ discarding."
            (body (nthcdr 3 form))
            (fun
             (byte-compile-lambda `(lambda ,vars . ,body) nil (length env))))
-      (assert (byte-code-function-p fun))
+      (cl-assert (> (length env) 0))       ;Otherwise, we don't need a closure.
+      (cl-assert (byte-code-function-p fun))
       (byte-compile-form `(make-byte-code
                            ',(aref fun 0) ',(aref fun 1)
                            (vconcat (vector . ,env) ',(aref fun 2))
@@ -3592,7 +3585,7 @@ discarding."
         (byte-compile-form (cons 'progn (nreverse setters))))
     (let ((var (car form)))
       (and (or (not (symbolp var))
-               (byte-compile-const-symbol-p var t))
+               (macroexp--const-symbol-p var t))
            (byte-compile-warning-enabled-p 'constants)
            (byte-compile-warn
             "variable assignment to %s `%s'"
@@ -3938,8 +3931,8 @@ binding slots have been popped."
         (if lexical-binding
             ;; Unbind both lexical and dynamic variables.
             (progn
-              (assert (or (eq byte-compile-depth init-stack-depth)
-                          (eq byte-compile-depth (1+ init-stack-depth))))
+              (cl-assert (or (eq byte-compile-depth init-stack-depth)
+                             (eq byte-compile-depth (1+ init-stack-depth))))
               (byte-compile-unbind clauses init-lexenv (> byte-compile-depth
                                                           init-stack-depth)))
           ;; Unbind dynamic variables.
@@ -4081,36 +4074,11 @@ binding slots have been popped."
 \f
 ;;; top-level forms elsewhere
 
-(byte-defop-compiler-1 defun)
-(byte-defop-compiler-1 defmacro)
 (byte-defop-compiler-1 defvar)
 (byte-defop-compiler-1 defconst byte-compile-defvar)
 (byte-defop-compiler-1 autoload)
 (byte-defop-compiler-1 lambda byte-compile-lambda-form)
 
-(defun byte-compile-defun (form)
-  ;; This is not used for file-level defuns with doc strings.
-  (if (symbolp (car form))
-      (byte-compile-set-symbol-position (car form))
-    (byte-compile-set-symbol-position 'defun)
-    (error "defun name must be a symbol, not %s" (car form)))
-  (byte-compile-push-constant 'defalias)
-  (byte-compile-push-constant (nth 1 form))
-  (byte-compile-push-constant (byte-compile-lambda (cdr (cdr form)) t))
-  (byte-compile-out 'byte-call 2))
-
-(defun byte-compile-defmacro (form)
-  ;; This is not used for file-level defmacros with doc strings.
-  (byte-compile-body-do-effect
-   (let ((decls (byte-compile-defmacro-declaration form))
-         (code (byte-compile-lambda (cdr (cdr form)) t)))
-     `((defalias ',(nth 1 form)
-         ,(if (eq (car-safe code) 'make-byte-code)
-              `(cons 'macro ,code)
-            `'(macro . ,(eval code))))
-       ,@decls
-       ',(nth 1 form)))))
-
 ;; If foo.el declares `toto' as obsolete, it is likely that foo.el will
 ;; actually use `toto' in order for this obsolete variable to still work
 ;; correctly, so paradoxically, while byte-compiling foo.el, the presence
@@ -4166,8 +4134,8 @@ binding slots have been popped."
 
 (defun byte-compile-autoload (form)
   (byte-compile-set-symbol-position 'autoload)
-  (and (byte-compile-constp (nth 1 form))
-       (byte-compile-constp (nth 5 form))
+  (and (macroexp-const-p (nth 1 form))
+       (macroexp-const-p (nth 5 form))
        (eval (nth 5 form))  ; macro-p
        (not (fboundp (eval (nth 1 form))))
        (byte-compile-warn
@@ -4186,38 +4154,53 @@ binding slots have been popped."
 (put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias)
 ;; Used for eieio--defalias as well.
 (defun byte-compile-file-form-defalias (form)
-  (if (and (consp (cdr form)) (consp (nth 1 form))
-          (eq (car (nth 1 form)) 'quote)
-          (consp (cdr (nth 1 form)))
-          (symbolp (nth 1 (nth 1 form))))
-      (let ((constant
-            (and (consp (nthcdr 2 form))
-                 (consp (nth 2 form))
-                 (eq (car (nth 2 form)) 'quote)
-                 (consp (cdr (nth 2 form)))
-                 (symbolp (nth 1 (nth 2 form))))))
-       (byte-compile-defalias-warn (nth 1 (nth 1 form)))
-       (push (cons (nth 1 (nth 1 form))
-                   (if constant (nth 1 (nth 2 form)) t))
-             byte-compile-function-environment)))
-  ;; We used to just do: (byte-compile-normal-call form)
-  ;; But it turns out that this fails to optimize the code.
-  ;; So instead we now do the same as what other byte-hunk-handlers do,
-  ;; which is to call back byte-compile-file-form and then return nil.
-  ;; Except that we can't just call byte-compile-file-form since it would
-  ;; call us right back.
-  (byte-compile-keep-pending form)
-  ;; Return nil so the form is not output twice.
-  nil)
-
-;; Turn off warnings about prior calls to the function being defalias'd.
-;; This could be smarter and compare those calls with
-;; the function it is being aliased to.
-(defun byte-compile-defalias-warn (new)
-  (let ((calls (assq new byte-compile-unresolved-functions)))
-    (if calls
-       (setq byte-compile-unresolved-functions
-             (delq calls byte-compile-unresolved-functions)))))
+  ;; For the compilation itself, we could largely get rid of this hunk-handler,
+  ;; if it weren't for the fact that we need to figure out when a defalias
+  ;; defines a macro, so as to add it to byte-compile-macro-environment.
+  ;;
+  ;; FIXME: we also use this hunk-handler to implement the function's dynamic
+  ;; docstring feature.  We could actually implement it more elegantly in
+  ;; byte-compile-lambda so it applies to all lambdas, but the problem is that
+  ;; the resulting .elc format will not be recognized by make-docfile, so
+  ;; either we stop using DOC for the docstrings of preloaded elc files (at the
+  ;; cost of around 24KB on 32bit hosts, double on 64bit hosts) or we need to
+  ;; build DOC in a more clever way (e.g. handle anonymous elements).
+  (let ((byte-compile-free-references nil)
+        (byte-compile-free-assignments nil))
+    (pcase form
+      ;; Decompose `form' into:
+      ;; - `name' is the name of the defined function.
+      ;; - `arg' is the expression to which it is defined.
+      ;; - `rest' is the rest of the arguments.
+      (`(,_ ',name ,arg . ,rest)
+       (pcase-let*
+           ;; `macro' is non-nil if it defines a macro.
+           ;; `fun' is the function part of `arg' (defaults to `arg').
+           (((or (and (or `(cons 'macro ,fun) `'(macro . ,fun)) (let macro t))
+                 (and (let fun arg) (let macro nil)))
+             arg)
+            ;; `lam' is the lambda expression in `fun' (or nil if not
+            ;; recognized).
+            ((or `(,(or `quote `function) ,lam) (let lam nil))
+             fun)
+            ;; `arglist' is the list of arguments (or t if not recognized).
+            ;; `body' is the body of `lam' (or t if not recognized).
+            ((or `(lambda ,arglist . ,body)
+                 ;; `(closure ,_ ,arglist . ,body)
+                 (and `(internal-make-closure ,arglist . ,_) (let body t))
+                 (and (let arglist t) (let body t)))
+             lam))
+         (unless (byte-compile-file-form-defmumble
+                  name macro arglist body rest)
+           (byte-compile-keep-pending form))))
+
+      ;; We used to just do: (byte-compile-normal-call form)
+      ;; But it turns out that this fails to optimize the code.
+      ;; So instead we now do the same as what other byte-hunk-handlers do,
+      ;; which is to call back byte-compile-file-form and then return nil.
+      ;; Except that we can't just call byte-compile-file-form since it would
+      ;; call us right back.
+      (t (byte-compile-keep-pending form)))))
 
 (byte-defop-compiler-1 with-no-warnings byte-compile-no-warnings)
 (defun byte-compile-no-warnings (form)
@@ -4369,21 +4352,21 @@ invoked interactively."
     (if byte-compile-call-tree-sort
        (setq byte-compile-call-tree
              (sort byte-compile-call-tree
-                   (case byte-compile-call-tree-sort
-                      (callers
+                   (pcase byte-compile-call-tree-sort
+                      (`callers
                        (lambda (x y) (< (length (nth 1 x))
                                    (length (nth 1 y)))))
-                      (calls
+                      (`calls
                        (lambda (x y) (< (length (nth 2 x))
                                    (length (nth 2 y)))))
-                      (calls+callers
+                      (`calls+callers
                        (lambda (x y) (< (+ (length (nth 1 x))
                                       (length (nth 2 x)))
                                    (+ (length (nth 1 y))
                                       (length (nth 2 y))))))
-                      (name
+                      (`name
                        (lambda (x y) (string< (car x) (car y))))
-                      (t (error "`byte-compile-call-tree-sort': `%s' - unknown sort mode"
+                      (_ (error "`byte-compile-call-tree-sort': `%s' - unknown sort mode"
                                 byte-compile-call-tree-sort))))))
     (message "Generating call tree...")
     (let ((rest byte-compile-call-tree)
@@ -4525,29 +4508,30 @@ already up-to-date."
     (kill-emacs (if error 1 0))))
 
 (defun batch-byte-compile-file (file)
-  (if debug-on-error
-      (byte-compile-file file)
-    (condition-case err
-       (byte-compile-file file)
-      (file-error
-       (message (if (cdr err)
-                   ">>Error occurred processing %s: %s (%s)"
-                 ">>Error occurred processing %s: %s")
-               file
-               (get (car err) 'error-message)
-               (prin1-to-string (cdr err)))
-       (let ((destfile (byte-compile-dest-file file)))
-        (if (file-exists-p destfile)
-            (delete-file destfile)))
-       nil)
-      (error
-       (message (if (cdr err)
-                   ">>Error occurred processing %s: %s (%s)"
-                 ">>Error occurred processing %s: %s")
-               file
-               (get (car err) 'error-message)
-               (prin1-to-string (cdr err)))
-       nil))))
+  (let ((byte-compile-root-dir (or byte-compile-root-dir default-directory)))
+    (if debug-on-error
+        (byte-compile-file file)
+      (condition-case err
+          (byte-compile-file file)
+        (file-error
+         (message (if (cdr err)
+                      ">>Error occurred processing %s: %s (%s)"
+                    ">>Error occurred processing %s: %s")
+                  file
+                  (get (car err) 'error-message)
+                  (prin1-to-string (cdr err)))
+         (let ((destfile (byte-compile-dest-file file)))
+           (if (file-exists-p destfile)
+               (delete-file destfile)))
+         nil)
+        (error
+         (message (if (cdr err)
+                      ">>Error occurred processing %s: %s (%s)"
+                    ">>Error occurred processing %s: %s")
+                  file
+                  (get (car err) 'error-message)
+                  (prin1-to-string (cdr err)))
+         nil)))))
 
 (defun byte-compile-refresh-preloaded ()
   "Reload any Lisp file that was changed since Emacs was dumped.
@@ -4595,6 +4579,16 @@ and corresponding effects."
     (setq command-line-args-left (cdr command-line-args-left)))
   (kill-emacs 0))
 
+;;; Core compiler macros.
+
+(put 'featurep 'compiler-macro
+     (lambda (form feature &rest _ignore)
+       ;; Emacs-21's byte-code doesn't run under XEmacs or SXEmacs anyway, so
+       ;; we can safely optimize away this test.
+       (if (member feature '('xemacs 'sxemacs 'emacs))
+           (eval form)
+         form)))
+
 (provide 'byte-compile)
 (provide 'bytecomp)
 
index b6b6a78a9bb2a5caf08a6c6854181d53ff977de3..5a1d62658488ddd96c14b515892116eeac05f778 100644 (file)
@@ -73,8 +73,6 @@
 ;;   since afterwards they can because obnoxious (warnings about an "unused
 ;;   variable" should not be emitted when the variable use has simply been
 ;;   optimized away).
-;; - turn defun and defmacro into macros (and remove special handling of
-;;   `declare' afterwards).
 ;; - let macros specify that some let-bindings come from the same source,
 ;;   so the unused warning takes all uses into account.
 ;; - let interactive specs return a function to build the args (to stash into
 ;;     ,@(mapcar (lambda (binder) (if (consp binder) (cadr binder)))
 ;;               binders)))
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defconst cconv-liftwhen 6
   "Try to do lambda lifting if the number of arguments + free variables
@@ -175,7 +173,7 @@ Returns a form where all lambdas don't have any free variables."
   ;; Here we assume that X appears at most once in M.
   (let* ((b (assq x m))
          (res (if b (remq b m) m)))
-    (assert (null (assq x res))) ;; Check the assumption was warranted.
+    (cl-assert (null (assq x res))) ;; Check the assumption was warranted.
     res))
 
 (defun cconv--map-diff-set (m s)
@@ -187,7 +185,7 @@ Returns a form where all lambdas don't have any free variables."
     (nreverse res)))
 
 (defun cconv--convert-function (args body env parentform)
-  (assert (equal body (caar cconv-freevars-alist)))
+  (cl-assert (equal body (caar cconv-freevars-alist)))
   (let* ((fvs (cdr (pop cconv-freevars-alist)))
          (body-new '())
          (letbind '())
@@ -253,11 +251,11 @@ ENV is a list where each entry takes the shape either:
 EXTEND is a list of variables which might need to be accessed even from places
 where they are shadowed, because some part of ENV causes them to be used at
 places where they originally did not directly appear."
-  (assert (not (delq nil (mapcar (lambda (mapping)
-                                   (if (eq (cadr mapping) 'apply-partially)
-                                       (cconv--set-diff (cdr (cddr mapping))
-                                                        extend)))
-                                 env))))
+  (cl-assert (not (delq nil (mapcar (lambda (mapping)
+                                      (if (eq (cadr mapping) 'apply-partially)
+                                          (cconv--set-diff (cdr (cddr mapping))
+                                                           extend)))
+                                    env))))
 
   ;; What's the difference between fvrs and envs?
   ;; Suppose that we have the code
@@ -289,10 +287,10 @@ places where they originally did not directly appear."
                   ;; Check if var is a candidate for lambda lifting.
                   ((and (member (cons binder form) cconv-lambda-candidates)
                         (progn
-                          (assert (and (eq (car value) 'function)
-                                       (eq (car (cadr value)) 'lambda)))
-                          (assert (equal (cddr (cadr value))
-                                         (caar cconv-freevars-alist)))
+                          (cl-assert (and (eq (car value) 'function)
+                                          (eq (car (cadr value)) 'lambda)))
+                          (cl-assert (equal (cddr (cadr value))
+                                            (caar cconv-freevars-alist)))
                           ;; Peek at the freevars to decide whether to λ-lift.
                           (let* ((fvs (cdr (car cconv-freevars-alist)))
                                  (fun (cadr value))
@@ -309,7 +307,7 @@ places where they originally did not directly appear."
                           (funcbody-env ()))
                      (push `(,var . (apply-partially ,var . ,fvs)) new-env)
                      (dolist (fv fvs)
-                       (pushnew fv new-extend)
+                       (cl-pushnew fv new-extend)
                        (if (and (eq 'car (car-safe (cdr (assq fv env))))
                                 (not (memq fv funargs)))
                            (push `(,fv . (car ,fv)) funcbody-env)))
@@ -347,14 +345,14 @@ places where they originally did not directly appear."
                      (mapcar (lambda (mapping)
                                (if (not (eq (cadr mapping) 'apply-partially))
                                    mapping
-                                 (assert (eq (car mapping) (nth 2 mapping)))
-                                 (list* (car mapping)
-                                        'apply-partially
-                                        (car mapping)
-                                        (mapcar (lambda (arg)
-                                                  (if (eq var arg)
-                                                      closedsym arg))
-                                                (nthcdr 3 mapping)))))
+                                 (cl-assert (eq (car mapping) (nth 2 mapping)))
+                                 `(,(car mapping)
+                                   apply-partially
+                                   ,(car mapping)
+                                   ,@(mapcar (lambda (arg)
+                                               (if (eq var arg)
+                                                   closedsym arg))
+                                             (nthcdr 3 mapping)))))
                              new-env))
                (setq new-extend (remq var new-extend))
                (push closedsym new-extend)
@@ -410,20 +408,6 @@ places where they originally did not directly appear."
             . ,(mapcar (lambda (form) (cconv-convert form env extend))
                        forms)))
 
-                                       ;defun, defmacro
-    (`(,(and sym (or `defun `defmacro))
-       ,func ,args . ,body)
-     (assert (equal body (caar cconv-freevars-alist)))
-     (assert (null (cdar cconv-freevars-alist)))
-
-     (let ((new (cconv--convert-function args body env form)))
-       (pcase new
-         (`(function (lambda ,newargs . ,new-body))
-          (assert (equal args newargs))
-          `(,sym ,func ,args . ,new-body))
-         (t (byte-compile-report-error
-             (format "Internal error in cconv of (%s %s ...)" sym func))))))
-
                                        ;condition-case
     (`(condition-case ,var ,protected-form . ,handlers)
      (let ((newform (cconv--convert-function
@@ -471,7 +455,7 @@ places where they originally did not directly appear."
      (let ((mapping (cdr (assq fun env))))
        (pcase mapping
          (`(apply-partially ,_ . ,(and fvs `(,_ . ,_)))
-          (assert (eq (cadr mapping) fun))
+          (cl-assert (eq (cadr mapping) fun))
           `(,callsym ,fun
                      ,@(mapcar (lambda (fv)
                                  (let ((exp (or (cdr (assq fv env)) fv)))
@@ -567,7 +551,7 @@ FORM is the parent form that binds this var."
     ;; Transfer uses collected in `envcopy' (via `newenv') back to `env';
     ;; and compute free variables.
     (while env
-      (assert (and envcopy (eq (caar env) (caar envcopy))))
+      (cl-assert (and envcopy (eq (caar env) (caar envcopy))))
       (let ((free nil)
             (x (cdr (car env)))
             (y (cdr (car envcopy))))
@@ -618,15 +602,6 @@ and updates the data stored in ENV."
        (dolist (vardata newvars)
          (cconv--analyse-use vardata form "variable"))))
 
-                                       ; defun special form
-    (`(,(or `defun `defmacro) ,func ,vrs . ,body-forms)
-     (when env
-       (byte-compile-log-warning
-        (format "Function %S will ignore its context %S"
-                func (mapcar #'car env))
-        t :warning))
-     (cconv--analyse-function vrs body-forms nil form))
-
     (`(function (lambda ,vrs . ,body-forms))
      (cconv--analyse-function vrs body-forms env form))
 
@@ -639,7 +614,9 @@ and updates the data stored in ENV."
        (cconv-analyse-form (cadr forms) env)
        (setq forms (cddr forms))))
 
-    (`((lambda . ,_) . ,_)             ; first element is lambda expression
+    (`((lambda . ,_) . ,_)             ; First element is lambda expression.
+     (byte-compile-log-warning
+      "Use of deprecated ((lambda ...) ...) form" t :warning)
      (dolist (exp `((function ,(car form)) . ,(cdr form)))
        (cconv-analyse-form exp env)))
 
index 19766feac5afcc15ad21a0960576d9dd01df0886..74087014d69d8c261c4b702db53f39e5e7b58734 100644 (file)
@@ -62,8 +62,8 @@
 (require 'eieio)
 
 ;;; Code:
-(defvar chart-mode-map (make-sparse-keymap) "Keymap used in chart mode.")
 (define-obsolete-variable-alias 'chart-map 'chart-mode-map "24.1")
+(defvar chart-mode-map (make-sparse-keymap) "Keymap used in chart mode.")
 
 (defvar chart-local-object nil
   "Local variable containing the locally displayed chart object.")
@@ -82,7 +82,7 @@ Colors will be the background color.")
 Useful if new Emacs is used on B&W display.")
 
 (defcustom chart-face-use-pixmaps nil
-  "*Non-nil to use fancy pixmaps in the background of chart face colors."
+  "Non-nil to use fancy pixmaps in the background of chart face colors."
   :group 'eieio
   :type 'boolean)
 
index 7a9a33fc2ccc20149dedc368857285c6b454f18d..ee8cbd2c3bceb3596bb0dbc68f34270d9f669136 100644 (file)
@@ -916,7 +916,7 @@ is the starting location.  If this is nil, `point-min' is used instead."
        (progn
          (goto-char wrong)
          (if (not take-notes)
-             (error "%s" (checkdoc-error-text msg)))))
+             (user-error "%s" (checkdoc-error-text msg)))))
     (checkdoc-show-diagnostics)
     (if (called-interactively-p 'interactive)
        (message "No style warnings."))))
@@ -949,7 +949,7 @@ if there is one."
         (e (checkdoc-file-comments-engine))
          (checkdoc-generate-compile-warnings-flag
           (or take-notes checkdoc-generate-compile-warnings-flag)))
-    (if e (error "%s" (checkdoc-error-text e)))
+    (if e (user-error "%s" (checkdoc-error-text e)))
     (checkdoc-show-diagnostics)
     e))
 
@@ -987,7 +987,7 @@ Optional argument TAKE-NOTES causes all errors to be logged."
     (if (not (called-interactively-p 'interactive))
        e
       (if e
-         (error "%s" (checkdoc-error-text e))
+         (user-error "%s" (checkdoc-error-text e))
        (checkdoc-show-diagnostics)))
     (goto-char p))
   (if (called-interactively-p 'interactive)
@@ -1027,19 +1027,14 @@ space at the end of each line."
              (car (memq checkdoc-spellcheck-documentation-flag
                          '(defun t))))
             (beg (save-excursion (beginning-of-defun) (point)))
-            (end (save-excursion (end-of-defun) (point)))
-            (msg (checkdoc-this-string-valid)))
-       (if msg (if no-error
-                   (message "%s" (checkdoc-error-text msg))
-                 (error "%s" (checkdoc-error-text msg)))
-         (setq msg (checkdoc-message-text-search beg end))
-         (if msg (if no-error
-                     (message "%s" (checkdoc-error-text msg))
-                   (error "%s" (checkdoc-error-text msg)))
-           (setq msg (checkdoc-rogue-space-check-engine beg end))
-           (if msg (if no-error
-                       (message "%s" (checkdoc-error-text msg))
-                     (error "%s" (checkdoc-error-text msg))))))
+            (end (save-excursion (end-of-defun) (point))))
+        (dolist (fun (list #'checkdoc-this-string-valid
+                           (lambda () (checkdoc-message-text-search beg end))
+                           (lambda () (checkdoc-rogue-space-check-engine beg end))))
+          (let ((msg (funcall fun)))
+            (if msg (if no-error
+                        (message "%s" (checkdoc-error-text msg))
+                      (user-error "%s" (checkdoc-error-text msg))))))
        (if (called-interactively-p 'interactive)
            (message "Checkdoc: done."))))))
 
@@ -2644,12 +2639,6 @@ function called to create the messages."
 
 (custom-add-option 'emacs-lisp-mode-hook 'checkdoc-minor-mode)
 
-(add-to-list 'debug-ignored-errors
-            "Argument `.*' should appear (as .*) in the doc string")
-(add-to-list 'debug-ignored-errors
-            "Lisp symbol `.*' should appear in quotes")
-(add-to-list 'debug-ignored-errors "Disambiguate .* by preceding .*")
-
 (provide 'checkdoc)
 
 ;;; checkdoc.el ends here
index 9ac5ce7d2f078d20a927f6f81363b8b406ca39fb..ea5e1cf9beb3b07a64367a3f47dad50a530450c8 100644 (file)
@@ -1,6 +1,6 @@
-;;; cl-extra.el --- Common Lisp features, part 2
+;;; cl-extra.el --- Common Lisp features, part 2  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2000-2012 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <daveg@synaptics.com>
 ;; Keywords: extensions
 
 ;;; Code:
 
-(require 'cl)
+(require 'cl-lib)
 
 ;;; Type coercion.
 
 ;;;###autoload
-(defun coerce (x type)
+(defun cl-coerce (x type)
   "Coerce OBJECT to type TYPE.
 TYPE is a Common Lisp type specifier.
 \n(fn OBJECT TYPE)"
@@ -51,16 +51,16 @@ TYPE is a Common Lisp type specifier.
        ((eq type 'string) (if (stringp x) x (concat x)))
        ((eq type 'array) (if (arrayp x) x (vconcat x)))
        ((and (eq type 'character) (stringp x) (= (length x) 1)) (aref x 0))
-       ((and (eq type 'character) (symbolp x)) (coerce (symbol-name x) type))
+       ((and (eq type 'character) (symbolp x)) (cl-coerce (symbol-name x) type))
        ((eq type 'float) (float x))
-       ((typep x type) x)
+       ((cl-typep x type) x)
        (t (error "Can't coerce %s to type %s" x type))))
 
 
 ;;; Predicates.
 
 ;;;###autoload
-(defun equalp (x y)
+(defun cl-equalp (x y)
   "Return t if two Lisp objects have similar structures and contents.
 This is like `equal', except that it accepts numerically equal
 numbers of different types (float vs. integer), and also compares
@@ -73,14 +73,14 @@ strings case-insensitively."
        ((numberp x)
         (and (numberp y) (= x y)))
        ((consp x)
-        (while (and (consp x) (consp y) (equalp (car x) (car y)))
+        (while (and (consp x) (consp y) (cl-equalp (car x) (car y)))
           (setq x (cdr x) y (cdr y)))
-        (and (not (consp x)) (equalp x y)))
+        (and (not (consp x)) (cl-equalp x y)))
        ((vectorp x)
         (and (vectorp y) (= (length x) (length y))
              (let ((i (length x)))
                (while (and (>= (setq i (1- i)) 0)
-                           (equalp (aref x i) (aref y i))))
+                           (cl-equalp (aref x i) (aref y i))))
                (< i 0))))
        (t (equal x y))))
 
@@ -88,7 +88,7 @@ strings case-insensitively."
 ;;; Control structures.
 
 ;;;###autoload
-(defun cl-mapcar-many (cl-func cl-seqs)
+(defun cl--mapcar-many (cl-func cl-seqs)
   (if (cdr (cdr cl-seqs))
       (let* ((cl-res nil)
             (cl-n (apply 'min (mapcar 'length cl-seqs)))
@@ -115,21 +115,21 @@ strings case-insensitively."
            (cl-i -1))
        (while (< (setq cl-i (1+ cl-i)) cl-n)
          (push (funcall cl-func
-                           (if (consp cl-x) (pop cl-x) (aref cl-x cl-i))
-                           (if (consp cl-y) (pop cl-y) (aref cl-y cl-i)))
-                  cl-res)))
+                         (if (consp cl-x) (pop cl-x) (aref cl-x cl-i))
+                         (if (consp cl-y) (pop cl-y) (aref cl-y cl-i)))
+                cl-res)))
       (nreverse cl-res))))
 
 ;;;###autoload
-(defun map (cl-type cl-func cl-seq &rest cl-rest)
+(defun cl-map (cl-type cl-func cl-seq &rest cl-rest)
   "Map a FUNCTION across one or more SEQUENCEs, returning a sequence.
 TYPE is the sequence type to return.
 \n(fn TYPE FUNCTION SEQUENCE...)"
-  (let ((cl-res (apply 'mapcar* cl-func cl-seq cl-rest)))
-    (and cl-type (coerce cl-res cl-type))))
+  (let ((cl-res (apply 'cl-mapcar cl-func cl-seq cl-rest)))
+    (and cl-type (cl-coerce cl-res cl-type))))
 
 ;;;###autoload
-(defun maplist (cl-func cl-list &rest cl-rest)
+(defun cl-maplist (cl-func cl-list &rest cl-rest)
   "Map FUNCTION to each sublist of LIST or LISTs.
 Like `mapcar', except applies to lists and their cdr's rather than to
 the elements themselves.
@@ -153,40 +153,40 @@ the elements themselves.
   "Like `mapcar', but does not accumulate values returned by the function.
 \n(fn FUNCTION SEQUENCE...)"
   (if cl-rest
-      (progn (apply 'map nil cl-func cl-seq cl-rest)
+      (progn (apply 'cl-map nil cl-func cl-seq cl-rest)
             cl-seq)
     (mapc cl-func cl-seq)))
 
 ;;;###autoload
-(defun mapl (cl-func cl-list &rest cl-rest)
-  "Like `maplist', but does not accumulate values returned by the function.
+(defun cl-mapl (cl-func cl-list &rest cl-rest)
+  "Like `cl-maplist', but does not accumulate values returned by the function.
 \n(fn FUNCTION LIST...)"
   (if cl-rest
-      (apply 'maplist cl-func cl-list cl-rest)
+      (apply 'cl-maplist cl-func cl-list cl-rest)
     (let ((cl-p cl-list))
       (while cl-p (funcall cl-func cl-p) (setq cl-p (cdr cl-p)))))
   cl-list)
 
 ;;;###autoload
-(defun mapcan (cl-func cl-seq &rest cl-rest)
+(defun cl-mapcan (cl-func cl-seq &rest cl-rest)
   "Like `mapcar', but nconc's together the values returned by the function.
 \n(fn FUNCTION SEQUENCE...)"
-  (apply 'nconc (apply 'mapcar* cl-func cl-seq cl-rest)))
+  (apply 'nconc (apply 'cl-mapcar cl-func cl-seq cl-rest)))
 
 ;;;###autoload
-(defun mapcon (cl-func cl-list &rest cl-rest)
-  "Like `maplist', but nconc's together the values returned by the function.
+(defun cl-mapcon (cl-func cl-list &rest cl-rest)
+  "Like `cl-maplist', but nconc's together the values returned by the function.
 \n(fn FUNCTION LIST...)"
-  (apply 'nconc (apply 'maplist cl-func cl-list cl-rest)))
+  (apply 'nconc (apply 'cl-maplist cl-func cl-list cl-rest)))
 
 ;;;###autoload
-(defun some (cl-pred cl-seq &rest cl-rest)
+(defun cl-some (cl-pred cl-seq &rest cl-rest)
   "Return true if PREDICATE is true of any element of SEQ or SEQs.
 If so, return the true (non-nil) value returned by PREDICATE.
 \n(fn PREDICATE SEQ...)"
   (if (or cl-rest (nlistp cl-seq))
       (catch 'cl-some
-       (apply 'map nil
+       (apply 'cl-map nil
               (function (lambda (&rest cl-x)
                           (let ((cl-res (apply cl-pred cl-x)))
                             (if cl-res (throw 'cl-some cl-res)))))
@@ -196,12 +196,12 @@ If so, return the true (non-nil) value returned by PREDICATE.
       cl-x)))
 
 ;;;###autoload
-(defun every (cl-pred cl-seq &rest cl-rest)
+(defun cl-every (cl-pred cl-seq &rest cl-rest)
   "Return true if PREDICATE is true of every element of SEQ or SEQs.
 \n(fn PREDICATE SEQ...)"
   (if (or cl-rest (nlistp cl-seq))
       (catch 'cl-every
-       (apply 'map nil
+       (apply 'cl-map nil
               (function (lambda (&rest cl-x)
                           (or (apply cl-pred cl-x) (throw 'cl-every nil))))
               cl-seq cl-rest) t)
@@ -210,23 +210,19 @@ If so, return the true (non-nil) value returned by PREDICATE.
     (null cl-seq)))
 
 ;;;###autoload
-(defun notany (cl-pred cl-seq &rest cl-rest)
+(defun cl-notany (cl-pred cl-seq &rest cl-rest)
   "Return true if PREDICATE is false of every element of SEQ or SEQs.
 \n(fn PREDICATE SEQ...)"
-  (not (apply 'some cl-pred cl-seq cl-rest)))
+  (not (apply 'cl-some cl-pred cl-seq cl-rest)))
 
 ;;;###autoload
-(defun notevery (cl-pred cl-seq &rest cl-rest)
+(defun cl-notevery (cl-pred cl-seq &rest cl-rest)
   "Return true if PREDICATE is false of some element of SEQ or SEQs.
 \n(fn PREDICATE SEQ...)"
-  (not (apply 'every cl-pred cl-seq cl-rest)))
+  (not (apply 'cl-every cl-pred cl-seq cl-rest)))
 
-;;; Support for `loop'.
 ;;;###autoload
-(defalias 'cl-map-keymap 'map-keymap)
-
-;;;###autoload
-(defun cl-map-keymap-recursively (cl-func-rec cl-map &optional cl-base)
+(defun cl--map-keymap-recursively (cl-func-rec cl-map &optional cl-base)
   (or cl-base
       (setq cl-base (copy-sequence [0])))
   (map-keymap
@@ -234,14 +230,14 @@ If so, return the true (non-nil) value returned by PREDICATE.
     (lambda (cl-key cl-bind)
       (aset cl-base (1- (length cl-base)) cl-key)
       (if (keymapp cl-bind)
-         (cl-map-keymap-recursively
+         (cl--map-keymap-recursively
           cl-func-rec cl-bind
           (vconcat cl-base (list 0)))
        (funcall cl-func-rec cl-base cl-bind))))
    cl-map))
 
 ;;;###autoload
-(defun cl-map-intervals (cl-func &optional cl-what cl-prop cl-start cl-end)
+(defun cl--map-intervals (cl-func &optional cl-what cl-prop cl-start cl-end)
   (or cl-what (setq cl-what (current-buffer)))
   (if (bufferp cl-what)
       (let (cl-mark cl-mark2 (cl-next t) cl-next2)
@@ -269,7 +265,7 @@ If so, return the true (non-nil) value returned by PREDICATE.
        (setq cl-start cl-next)))))
 
 ;;;###autoload
-(defun cl-map-overlays (cl-func &optional cl-buffer cl-start cl-end cl-arg)
+(defun cl--map-overlays (cl-func &optional cl-buffer cl-start cl-end cl-arg)
   (or cl-buffer (setq cl-buffer (current-buffer)))
   (if (fboundp 'overlay-lists)
 
@@ -311,36 +307,17 @@ If so, return the true (non-nil) value returned by PREDICATE.
 
 ;;; Support for `setf'.
 ;;;###autoload
-(defun cl-set-frame-visible-p (frame val)
+(defun cl--set-frame-visible-p (frame val)
   (cond ((null val) (make-frame-invisible frame))
        ((eq val 'icon) (iconify-frame frame))
        (t (make-frame-visible frame)))
   val)
 
-;;; Support for `progv'.
-(defvar cl-progv-save)
-;;;###autoload
-(defun cl-progv-before (syms values)
-  (while syms
-    (push (if (boundp (car syms))
-                (cons (car syms) (symbol-value (car syms)))
-              (car syms)) cl-progv-save)
-    (if values
-       (set (pop syms) (pop values))
-      (makunbound (pop syms)))))
-
-(defun cl-progv-after ()
-  (while cl-progv-save
-    (if (consp (car cl-progv-save))
-       (set (car (car cl-progv-save)) (cdr (car cl-progv-save)))
-      (makunbound (car cl-progv-save)))
-    (pop cl-progv-save)))
-
 
 ;;; Numbers.
 
 ;;;###autoload
-(defun gcd (&rest args)
+(defun cl-gcd (&rest args)
   "Return the greatest common divisor of the arguments."
   (let ((a (abs (or (pop args) 0))))
     (while args
@@ -349,18 +326,18 @@ If so, return the true (non-nil) value returned by PREDICATE.
     a))
 
 ;;;###autoload
-(defun lcm (&rest args)
+(defun cl-lcm (&rest args)
   "Return the least common multiple of the arguments."
   (if (memq 0 args)
       0
     (let ((a (abs (or (pop args) 1))))
       (while args
        (let ((b (abs (pop args))))
-         (setq a (* (/ a (gcd a b)) b))))
+         (setq a (* (/ a (cl-gcd a b)) b))))
       a)))
 
 ;;;###autoload
-(defun isqrt (x)
+(defun cl-isqrt (x)
   "Return the integer square root of the argument."
   (if (and (integerp x) (> x 0))
       (let ((g (cond ((<= x 100) 10) ((<= x 10000) 100)
@@ -372,35 +349,35 @@ If so, return the true (non-nil) value returned by PREDICATE.
     (if (eq x 0) 0 (signal 'arith-error nil))))
 
 ;;;###autoload
-(defun floor* (x &optional y)
+(defun cl-floor (x &optional y)
   "Return a list of the floor of X and the fractional part of X.
 With two arguments, return floor and remainder of their quotient."
   (let ((q (floor x y)))
     (list q (- x (if y (* y q) q)))))
 
 ;;;###autoload
-(defun ceiling* (x &optional y)
+(defun cl-ceiling (x &optional y)
   "Return a list of the ceiling of X and the fractional part of X.
 With two arguments, return ceiling and remainder of their quotient."
-  (let ((res (floor* x y)))
+  (let ((res (cl-floor x y)))
     (if (= (car (cdr res)) 0) res
       (list (1+ (car res)) (- (car (cdr res)) (or y 1))))))
 
 ;;;###autoload
-(defun truncate* (x &optional y)
+(defun cl-truncate (x &optional y)
   "Return a list of the integer part of X and the fractional part of X.
 With two arguments, return truncation and remainder of their quotient."
   (if (eq (>= x 0) (or (null y) (>= y 0)))
-      (floor* x y) (ceiling* x y)))
+      (cl-floor x y) (cl-ceiling x y)))
 
 ;;;###autoload
-(defun round* (x &optional y)
+(defun cl-round (x &optional y)
   "Return a list of X rounded to the nearest integer and the remainder.
 With two arguments, return rounding and remainder of their quotient."
   (if y
       (if (and (integerp x) (integerp y))
          (let* ((hy (/ y 2))
-                (res (floor* (+ x hy) y)))
+                (res (cl-floor (+ x hy) y)))
            (if (and (= (car (cdr res)) 0)
                     (= (+ hy hy) y)
                     (/= (% (car res) 2) 0))
@@ -413,29 +390,28 @@ With two arguments, return rounding and remainder of their quotient."
        (list q (- x q))))))
 
 ;;;###autoload
-(defun mod* (x y)
+(defun cl-mod (x y)
   "The remainder of X divided by Y, with the same sign as Y."
-  (nth 1 (floor* x y)))
+  (nth 1 (cl-floor x y)))
 
 ;;;###autoload
-(defun rem* (x y)
+(defun cl-rem (x y)
   "The remainder of X divided by Y, with the same sign as X."
-  (nth 1 (truncate* x y)))
+  (nth 1 (cl-truncate x y)))
 
 ;;;###autoload
-(defun signum (x)
+(defun cl-signum (x)
   "Return 1 if X is positive, -1 if negative, 0 if zero."
   (cond ((> x 0) 1) ((< x 0) -1) (t 0)))
 
 
 ;; Random numbers.
 
-(defvar *random-state*)
 ;;;###autoload
-(defun random* (lim &optional state)
+(defun cl-random (lim &optional state)
   "Return a random nonnegative number less than LIM, an integer or float.
 Optional second arg STATE is a random-state object."
-  (or state (setq state *random-state*))
+  (or state (setq state cl--random-state))
   ;; Inspired by "ran3" from Numerical Recipes.  Additive congruential method.
   (let ((vec (aref state 3)))
     (if (integerp vec)
@@ -444,29 +420,29 @@ Optional second arg STATE is a random-state object."
          (aset vec 0 j)
          (while (> (setq i (% (+ i 21) 55)) 0)
            (aset vec i (setq j (prog1 k (setq k (- j k))))))
-         (while (< (setq i (1+ i)) 200) (random* 2 state))))
+         (while (< (setq i (1+ i)) 200) (cl-random 2 state))))
     (let* ((i (aset state 1 (% (1+ (aref state 1)) 55)))
           (j (aset state 2 (% (1+ (aref state 2)) 55)))
           (n (logand 8388607 (aset vec i (- (aref vec i) (aref vec j))))))
       (if (integerp lim)
          (if (<= lim 512) (% n lim)
-           (if (> lim 8388607) (setq n (+ (lsh n 9) (random* 512 state))))
+           (if (> lim 8388607) (setq n (+ (lsh n 9) (cl-random 512 state))))
            (let ((mask 1023))
              (while (< mask (1- lim)) (setq mask (1+ (+ mask mask))))
-             (if (< (setq n (logand n mask)) lim) n (random* lim state))))
+             (if (< (setq n (logand n mask)) lim) n (cl-random lim state))))
        (* (/ n '8388608e0) lim)))))
 
 ;;;###autoload
-(defun make-random-state (&optional state)
-  "Return a copy of random-state STATE, or of `*random-state*' if omitted.
+(defun cl-make-random-state (&optional state)
+  "Return a copy of random-state STATE, or of the internal state if omitted.
 If STATE is t, return a new state object seeded from the time of day."
-  (cond ((null state) (make-random-state *random-state*))
-       ((vectorp state) (cl-copy-tree state t))
+  (cond ((null state) (cl-make-random-state cl--random-state))
+       ((vectorp state) (copy-tree state t))
        ((integerp state) (vector 'cl-random-state-tag -1 30 state))
-       (t (make-random-state (cl-random-time)))))
+       (t (cl-make-random-state (cl-random-time)))))
 
 ;;;###autoload
-(defun random-state-p (object)
+(defun cl-random-state-p (object)
   "Return t if OBJECT is a random-state object."
   (and (vectorp object) (= (length object) 4)
        (eq (aref object 0) 'cl-random-state-tag)))
@@ -474,8 +450,8 @@ If STATE is t, return a new state object seeded from the time of day."
 
 ;; Implementation limits.
 
-(defun cl-finite-do (func a b)
-  (condition-case err
+(defun cl--finite-do (func a b)
+  (condition-case _
       (let ((res (funcall func a b)))   ; check for IEEE infinity
        (and (numberp res) (/= res (/ res 2)) res))
     (arith-error nil)))
@@ -483,51 +459,55 @@ If STATE is t, return a new state object seeded from the time of day."
 ;;;###autoload
 (defun cl-float-limits ()
   "Initialize the Common Lisp floating-point parameters.
-This sets the values of: `most-positive-float', `most-negative-float',
-`least-positive-float', `least-negative-float', `float-epsilon',
-`float-negative-epsilon', `least-positive-normalized-float', and
-`least-negative-normalized-float'."
-  (or most-positive-float (not (numberp '2e1))
+This sets the values of: `cl-most-positive-float', `cl-most-negative-float',
+`cl-least-positive-float', `cl-least-negative-float', `cl-float-epsilon',
+`cl-float-negative-epsilon', `cl-least-positive-normalized-float', and
+`cl-least-negative-normalized-float'."
+  (or cl-most-positive-float (not (numberp '2e1))
       (let ((x '2e0) y z)
        ;; Find maximum exponent (first two loops are optimizations)
-       (while (cl-finite-do '* x x) (setq x (* x x)))
-       (while (cl-finite-do '* x (/ x 2)) (setq x (* x (/ x 2))))
-       (while (cl-finite-do '+ x x) (setq x (+ x x)))
+       (while (cl--finite-do '* x x) (setq x (* x x)))
+       (while (cl--finite-do '* x (/ x 2)) (setq x (* x (/ x 2))))
+       (while (cl--finite-do '+ x x) (setq x (+ x x)))
        (setq z x y (/ x 2))
-       ;; Now fill in 1's in the mantissa.
-       (while (and (cl-finite-do '+ x y) (/= (+ x y) x))
+       ;; Now cl-fill in 1's in the mantissa.
+       (while (and (cl--finite-do '+ x y) (/= (+ x y) x))
          (setq x (+ x y) y (/ y 2)))
-       (setq most-positive-float x
-             most-negative-float (- x))
+       (setq cl-most-positive-float x
+             cl-most-negative-float (- x))
        ;; Divide down until mantissa starts rounding.
        (setq x (/ x z) y (/ 16 z) x (* x y))
-       (while (condition-case err (and (= x (* (/ x 2) 2)) (> (/ y 2) 0))
+       (while (condition-case _ (and (= x (* (/ x 2) 2)) (> (/ y 2) 0))
                 (arith-error nil))
          (setq x (/ x 2) y (/ y 2)))
-       (setq least-positive-normalized-float y
-             least-negative-normalized-float (- y))
+       (setq cl-least-positive-normalized-float y
+             cl-least-negative-normalized-float (- y))
        ;; Divide down until value underflows to zero.
        (setq x (/ 1 z) y x)
-       (while (condition-case err (> (/ x 2) 0) (arith-error nil))
+       (while (condition-case _ (> (/ x 2) 0) (arith-error nil))
          (setq x (/ x 2)))
-       (setq least-positive-float x
-             least-negative-float (- x))
+       (setq cl-least-positive-float x
+             cl-least-negative-float (- x))
        (setq x '1e0)
        (while (/= (+ '1e0 x) '1e0) (setq x (/ x 2)))
-       (setq float-epsilon (* x 2))
+       (setq cl-float-epsilon (* x 2))
        (setq x '1e0)
        (while (/= (- '1e0 x) '1e0) (setq x (/ x 2)))
-       (setq float-negative-epsilon (* x 2))))
+       (setq cl-float-negative-epsilon (* x 2))))
   nil)
 
 
 ;;; Sequence functions.
 
 ;;;###autoload
-(defun subseq (seq start &optional end)
+(defun cl-subseq (seq start &optional end)
   "Return the subsequence of SEQ from START to END.
 If END is omitted, it defaults to the length of the sequence.
 If START or END is negative, it counts from the end."
+  (declare (gv-setter
+            (lambda (new)
+              `(progn (cl-replace ,seq ,new :start1 ,start :end1 ,end)
+                      ,new))))
   (if (stringp seq) (substring seq start end)
     (let (len)
       (and end (< end 0) (setq end (+ end (setq len (length seq)))))
@@ -550,7 +530,7 @@ If START or END is negative, it counts from the end."
               res))))))
 
 ;;;###autoload
-(defun concatenate (type &rest seqs)
+(defun cl-concatenate (type &rest seqs)
   "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
 \n(fn TYPE SEQUENCE...)"
   (cond ((eq type 'vector) (apply 'vconcat seqs))
@@ -562,17 +542,17 @@ If START or END is negative, it counts from the end."
 ;;; List functions.
 
 ;;;###autoload
-(defun revappend (x y)
+(defun cl-revappend (x y)
   "Equivalent to (append (reverse X) Y)."
   (nconc (reverse x) y))
 
 ;;;###autoload
-(defun nreconc (x y)
+(defun cl-nreconc (x y)
   "Equivalent to (nconc (nreverse X) Y)."
   (nconc (nreverse x) y))
 
 ;;;###autoload
-(defun list-length (x)
+(defun cl-list-length (x)
   "Return the length of list X.  Return nil if list is circular."
   (let ((n 0) (fast x) (slow x))
     (while (and (cdr fast) (not (and (eq fast slow) (> n 0))))
@@ -580,51 +560,62 @@ If START or END is negative, it counts from the end."
     (if fast (if (cdr fast) nil (1+ n)) n)))
 
 ;;;###autoload
-(defun tailp (sublist list)
+(defun cl-tailp (sublist list)
   "Return true if SUBLIST is a tail of LIST."
   (while (and (consp list) (not (eq sublist list)))
     (setq list (cdr list)))
   (if (numberp sublist) (equal sublist list) (eq sublist list)))
 
-(defalias 'cl-copy-tree 'copy-tree)
-
-
 ;;; Property lists.
 
 ;;;###autoload
-(defun get* (sym tag &optional def)    ; See compiler macro in cl-macs.el
+(defun cl-get (sym tag &optional def)
   "Return the value of SYMBOL's PROPNAME property, or DEFAULT if none.
 \n(fn SYMBOL PROPNAME &optional DEFAULT)"
+  (declare (compiler-macro cl--compiler-macro-get)
+           (gv-setter (lambda (store) `(put ,sym ,tag ,store))))
   (or (get sym tag)
       (and def
+           ;; Make sure `def' is really absent as opposed to set to nil.
           (let ((plist (symbol-plist sym)))
             (while (and plist (not (eq (car plist) tag)))
               (setq plist (cdr (cdr plist))))
             (if plist (car (cdr plist)) def)))))
+(autoload 'cl--compiler-macro-get "cl-macs")
 
 ;;;###autoload
-(defun getf (plist tag &optional def)
+(defun cl-getf (plist tag &optional def)
   "Search PROPLIST for property PROPNAME; return its value or DEFAULT.
 PROPLIST is a list of the sort returned by `symbol-plist'.
 \n(fn PROPLIST PROPNAME &optional DEFAULT)"
+  (declare (gv-expander
+            (lambda (do)
+              (gv-letplace (getter setter) plist
+                (macroexp-let2 nil k tag
+                  (macroexp-let2 nil d def
+                    (funcall do `(cl-getf ,getter ,k ,d)
+                             (lambda (v)
+                               (funcall setter
+                                        `(cl--set-getf ,getter ,k ,v))))))))))
   (setplist '--cl-getf-symbol-- plist)
   (or (get '--cl-getf-symbol-- tag)
-      ;; Originally we called get* here,
-      ;; but that fails, because get* has a compiler macro
+      ;; Originally we called cl-get here,
+      ;; but that fails, because cl-get has a compiler macro
       ;; definition that uses getf!
       (when def
+        ;; Make sure `def' is really absent as opposed to set to nil.
        (while (and plist (not (eq (car plist) tag)))
          (setq plist (cdr (cdr plist))))
        (if plist (car (cdr plist)) def))))
 
 ;;;###autoload
-(defun cl-set-getf (plist tag val)
+(defun cl--set-getf (plist tag val)
   (let ((p plist))
     (while (and p (not (eq (car p) tag))) (setq p (cdr (cdr p))))
-    (if p (progn (setcar (cdr p) val) plist) (list* tag val plist))))
+    (if p (progn (setcar (cdr p) val) plist) (cl-list* tag val plist))))
 
 ;;;###autoload
-(defun cl-do-remf (plist tag)
+(defun cl--do-remf (plist tag)
   (let ((p (cdr plist)))
     (while (and (cdr p) (not (eq (car (cdr p)) tag))) (setq p (cdr (cdr p))))
     (and (cdr p) (progn (setcdr p (cdr (cdr (cdr p)))) t))))
@@ -636,41 +627,7 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
   (let ((plist (symbol-plist sym)))
     (if (and plist (eq tag (car plist)))
        (progn (setplist sym (cdr (cdr plist))) t)
-      (cl-do-remf plist tag))))
-;;;###autoload
-(defalias 'remprop 'cl-remprop)
-
-
-
-;;; Hash tables.
-;; This is just kept for compatibility with code byte-compiled by Emacs-20.
-
-;; No idea if this might still be needed.
-(defun cl-not-hash-table (x &optional y &rest z)
-  (signal 'wrong-type-argument (list 'cl-hash-table-p (or y x))))
-
-(defvar cl-builtin-gethash (symbol-function 'gethash))
-(defvar cl-builtin-remhash (symbol-function 'remhash))
-(defvar cl-builtin-clrhash (symbol-function 'clrhash))
-(defvar cl-builtin-maphash (symbol-function 'maphash))
-
-;;;###autoload
-(defalias 'cl-gethash 'gethash)
-;;;###autoload
-(defalias 'cl-puthash 'puthash)
-;;;###autoload
-(defalias 'cl-remhash 'remhash)
-;;;###autoload
-(defalias 'cl-clrhash 'clrhash)
-;;;###autoload
-(defalias 'cl-maphash 'maphash)
-;; These three actually didn't exist in Emacs-20.
-;;;###autoload
-(defalias 'cl-make-hash-table 'make-hash-table)
-;;;###autoload
-(defalias 'cl-hash-table-p 'hash-table-p)
-;;;###autoload
-(defalias 'cl-hash-table-count 'hash-table-count)
+      (cl--do-remf plist tag))))
 
 ;;; Some debugging aids.
 
@@ -686,15 +643,15 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
       (forward-sexp)
       (delete-char 1))
     (goto-char (1+ pt))
-    (cl-do-prettyprint)))
+    (cl--do-prettyprint)))
 
-(defun cl-do-prettyprint ()
+(defun cl--do-prettyprint ()
   (skip-chars-forward " ")
   (if (looking-at "(")
       (let ((skip (or (looking-at "((") (looking-at "(prog")
                      (looking-at "(unwind-protect ")
                      (looking-at "(function (")
-                     (looking-at "(cl-block-wrapper ")))
+                     (looking-at "(cl--block-wrapper ")))
            (two (or (looking-at "(defun ") (looking-at "(defmacro ")))
            (let (or (looking-at "(let\\*? ") (looking-at "(while ")))
            (set (looking-at "(p?set[qf] ")))
@@ -704,104 +661,24 @@ PROPLIST is a list of the sort returned by `symbol-plist'.
                  (and (>= (current-column) 78) (progn (backward-sexp) t))))
            (let ((nl t))
              (forward-char 1)
-             (cl-do-prettyprint)
-             (or skip (looking-at ")") (cl-do-prettyprint))
-             (or (not two) (looking-at ")") (cl-do-prettyprint))
+             (cl--do-prettyprint)
+             (or skip (looking-at ")") (cl--do-prettyprint))
+             (or (not two) (looking-at ")") (cl--do-prettyprint))
              (while (not (looking-at ")"))
                (if set (setq nl (not nl)))
                (if nl (insert "\n"))
                (lisp-indent-line)
-               (cl-do-prettyprint))
+               (cl--do-prettyprint))
              (forward-char 1))))
     (forward-sexp)))
 
-(defvar cl-macroexpand-cmacs nil)
-(defvar cl-closure-vars nil)
-
-;;;###autoload
-(defun cl-macroexpand-all (form &optional env)
-  "Expand all macro calls through a Lisp FORM.
-This also does some trivial optimizations to make the form prettier."
-  (while (or (not (eq form (setq form (macroexpand form env))))
-            (and cl-macroexpand-cmacs
-                 (not (eq form (setq form (compiler-macroexpand form)))))))
-  (cond ((not (consp form)) form)
-       ((memq (car form) '(let let*))
-        (if (null (nth 1 form))
-            (cl-macroexpand-all (cons 'progn (cddr form)) env)
-          (let ((letf nil) (res nil) (lets (cadr form)))
-            (while lets
-              (push (if (consp (car lets))
-                           (let ((exp (cl-macroexpand-all (caar lets) env)))
-                             (or (symbolp exp) (setq letf t))
-                             (cons exp (cl-macroexpand-body (cdar lets) env)))
-                         (let ((exp (cl-macroexpand-all (car lets) env)))
-                           (if (symbolp exp) exp
-                             (setq letf t) (list exp nil)))) res)
-              (setq lets (cdr lets)))
-            (list* (if letf (if (eq (car form) 'let) 'letf 'letf*) (car form))
-                   (nreverse res) (cl-macroexpand-body (cddr form) env)))))
-       ((eq (car form) 'cond)
-        (cons (car form)
-              (mapcar (function (lambda (x) (cl-macroexpand-body x env)))
-                      (cdr form))))
-       ((eq (car form) 'condition-case)
-        (list* (car form) (nth 1 form) (cl-macroexpand-all (nth 2 form) env)
-               (mapcar (function
-                        (lambda (x)
-                          (cons (car x) (cl-macroexpand-body (cdr x) env))))
-                       (cdddr form))))
-       ((memq (car form) '(quote function))
-        (if (eq (car-safe (nth 1 form)) 'lambda)
-            (let ((body (cl-macroexpand-body (cddadr form) env)))
-              (if (and cl-closure-vars (eq (car form) 'function)
-                       (cl-expr-contains-any body cl-closure-vars))
-                  (let* ((new (mapcar 'gensym cl-closure-vars))
-                         (sub (pairlis cl-closure-vars new)) (decls nil))
-                    (while (or (stringp (car body))
-                               (eq (car-safe (car body)) 'interactive))
-                      (push (list 'quote (pop body)) decls))
-                    (put (car (last cl-closure-vars)) 'used t)
-                     `(list 'lambda '(&rest --cl-rest--)
-                            ,@(sublis sub (nreverse decls))
-                            (list 'apply
-                                  (list 'quote
-                                        #'(lambda ,(append new (cadadr form))
-                                            ,@(sublis sub body)))
-                                  ,@(nconc (mapcar (lambda (x) `(list 'quote ,x))
-                                                   cl-closure-vars)
-                                           '((quote --cl-rest--))))))
-                (list (car form) (list* 'lambda (cadadr form) body))))
-          (let ((found (assq (cadr form) env)))
-            (if (and found (ignore-errors
-                             (eq (cadr (caddr found)) 'cl-labels-args)))
-                (cl-macroexpand-all (cadr (caddr (cadddr found))) env)
-              form))))
-       ((memq (car form) '(defun defmacro))
-        (list* (car form) (nth 1 form) (cl-macroexpand-body (cddr form) env)))
-       ((and (eq (car form) 'progn) (not (cddr form)))
-        (cl-macroexpand-all (nth 1 form) env))
-       ((eq (car form) 'setq)
-        (let* ((args (cl-macroexpand-body (cdr form) env)) (p args))
-          (while (and p (symbolp (car p))) (setq p (cddr p)))
-          (if p (cl-macroexpand-all (cons 'setf args)) (cons 'setq args))))
-        ((consp (car form))
-         (cl-macroexpand-all (list* 'funcall
-                                    (list 'function (car form))
-                                    (cdr form))
-                             env))
-       (t (cons (car form) (cl-macroexpand-body (cdr form) env)))))
-
-(defun cl-macroexpand-body (body &optional env)
-  (mapcar (function (lambda (x) (cl-macroexpand-all x env))) body))
-
 ;;;###autoload
 (defun cl-prettyexpand (form &optional full)
   (message "Expanding...")
-  (let ((cl-macroexpand-cmacs full) (cl-compiling-file full)
+  (let ((cl--compiling-file full)
        (byte-compile-macro-environment nil))
-    (setq form (cl-macroexpand-all form
-                                  (and (not full) '((block) (eval-when)))))
+    (setq form (macroexpand-all form
+                                (and (not full) '((cl-block) (cl-eval-when)))))
     (message "Formatting...")
     (prog1 (cl-prettyprint form)
       (message ""))))
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
new file mode 100644 (file)
index 0000000..aa12c70
--- /dev/null
@@ -0,0 +1,751 @@
+;;; cl-lib.el --- Common Lisp extensions for Emacs  -*- lexical-binding: t -*-
+
+;; Copyright (C) 1993, 2001-2012  Free Software Foundation, Inc.
+
+;; Author: Dave Gillespie <daveg@synaptics.com>
+;; Version: 2.02
+;; Keywords: extensions
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; These are extensions to Emacs Lisp that provide a degree of
+;; Common Lisp compatibility, beyond what is already built-in
+;; in Emacs Lisp.
+;;
+;; This package was written by Dave Gillespie; it is a complete
+;; rewrite of Cesar Quiroz's original cl.el package of December 1986.
+;;
+;; Bug reports, comments, and suggestions are welcome!
+
+;; This file contains the portions of the Common Lisp extensions
+;; package which should always be present.
+
+
+;;; Future notes:
+
+;; Once Emacs 19 becomes standard, many things in this package which are
+;; messy for reasons of compatibility can be greatly simplified.  For now,
+;; I prefer to maintain one unified version.
+
+
+;;; Change Log:
+
+;; Version 2.02 (30 Jul 93):
+;;  * Added "cl-compat.el" file, extra compatibility with old package.
+;;  * Added `lexical-let' and `lexical-let*'.
+;;  * Added `define-modify-macro', `callf', and `callf2'.
+;;  * Added `ignore-errors'.
+;;  * Changed `(setf (nthcdr N PLACE) X)' to work when N is zero.
+;;  * Merged `*gentemp-counter*' into `*gensym-counter*'.
+;;  * Extended `subseq' to allow negative START and END like `substring'.
+;;  * Added `in-ref', `across-ref', `elements of-ref' loop clauses.
+;;  * Added `concat', `vconcat' loop clauses.
+;;  * Cleaned up a number of compiler warnings.
+
+;; Version 2.01 (7 Jul 93):
+;;  * Added support for FSF version of Emacs 19.
+;;  * Added `add-hook' for Emacs 18 users.
+;;  * Added `defsubst*' and `symbol-macrolet'.
+;;  * Added `maplist', `mapc', `mapl', `mapcan', `mapcon'.
+;;  * Added `map', `concatenate', `reduce', `merge'.
+;;  * Added `revappend', `nreconc', `tailp', `tree-equal'.
+;;  * Added `assert', `check-type', `typecase', `typep', and `deftype'.
+;;  * Added destructuring and `&environment' support to `defmacro*'.
+;;  * Added destructuring to `loop', and added the following clauses:
+;;      `elements', `frames', `overlays', `intervals', `buffers', `key-seqs'.
+;;  * Renamed `delete' to `delete*' and `remove' to `remove*'.
+;;  * Completed support for all keywords in `remove*', `substitute', etc.
+;;  * Added `most-positive-float' and company.
+;;  * Fixed hash tables to work with latest Lucid Emacs.
+;;  * `proclaim' forms are no longer compile-time-evaluating; use `declaim'.
+;;  * Syntax for `warn' declarations has changed.
+;;  * Improved implementation of `random*'.
+;;  * Moved most sequence functions to a new file, cl-seq.el.
+;;  * Moved `eval-when' into cl-macs.el.
+;;  * Moved `pushnew' and `adjoin' to cl.el for most common cases.
+;;  * Moved `provide' forms down to ends of files.
+;;  * Changed expansion of `pop' to something that compiles to better code.
+;;  * Changed so that no patch is required for Emacs 19 byte compiler.
+;;  * Made more things dependent on `optimize' declarations.
+;;  * Added a partial implementation of struct print functions.
+;;  * Miscellaneous minor changes.
+
+;; Version 2.00:
+;;  * First public release of this package.
+
+
+;;; Code:
+
+(require 'macroexp)
+
+(defvar cl-optimize-speed 1)
+(defvar cl-optimize-safety 1)
+
+;;;###autoload
+(define-obsolete-variable-alias
+  ;; This alias is needed for compatibility with .elc files that use defstruct
+  ;; and were compiled with Emacs<24.2.
+  'custom-print-functions 'cl-custom-print-functions "24.2")
+
+;;;###autoload
+(defvar cl-custom-print-functions nil
+  "This is a list of functions that format user objects for printing.
+Each function is called in turn with three arguments: the object, the
+stream, and the print level (currently ignored).  If it is able to
+print the object it returns true; otherwise it returns nil and the
+printer proceeds to the next function on the list.
+
+This variable is not used at present, but it is defined in hopes that
+a future Emacs interpreter will be able to use it.")
+
+(defun cl-unload-function ()
+  "Stop unloading of the Common Lisp extensions."
+  (message "Cannot unload the feature `cl'")
+  ;; Stop standard unloading!
+  t)
+
+;;; Generalized variables.
+;; These macros are defined here so that they
+;; can safely be used in .emacs files.
+
+(defmacro cl-incf (place &optional x)
+  "Increment PLACE by X (1 by default).
+PLACE may be a symbol, or any generalized variable allowed by `setf'.
+The return value is the incremented value of PLACE."
+  (declare (debug (place &optional form)))
+  (if (symbolp place)
+      (list 'setq place (if x (list '+ place x) (list '1+ place)))
+    (list 'cl-callf '+ place (or x 1))))
+
+(defmacro cl-decf (place &optional x)
+  "Decrement PLACE by X (1 by default).
+PLACE may be a symbol, or any generalized variable allowed by `setf'.
+The return value is the decremented value of PLACE."
+  (declare (debug cl-incf))
+  (if (symbolp place)
+      (list 'setq place (if x (list '- place x) (list '1- place)))
+    (list 'cl-callf '- place (or x 1))))
+
+(defmacro cl-pushnew (x place &rest keys)
+  "(cl-pushnew X PLACE): insert X at the head of the list if not already there.
+Like (push X PLACE), except that the list is unmodified if X is `eql' to
+an element already on the list.
+\nKeywords supported:  :test :test-not :key
+\n(fn X PLACE [KEYWORD VALUE]...)"
+  (declare (debug
+            (form place &rest
+                  &or [[&or ":test" ":test-not" ":key"] function-form]
+                  [keywordp form])))
+  (if (symbolp place)
+      (if (null keys)
+          (macroexp-let2 nil var x
+            `(if (memql ,var ,place)
+                 ;; This symbol may later on expand to actual code which then
+                 ;; trigger warnings like "value unused" since cl-pushnew's
+                 ;; return value is rarely used.  It should not matter that
+                 ;; other warnings may be silenced, since `place' is used
+                 ;; earlier and should have triggered them already.
+                 (with-no-warnings ,place)
+               (setq ,place (cons ,var ,place))))
+       (list 'setq place (cl-list* 'cl-adjoin x place keys)))
+    (cl-list* 'cl-callf2 'cl-adjoin x place keys)))
+
+(defun cl--set-elt (seq n val)
+  (if (listp seq) (setcar (nthcdr n seq) val) (aset seq n val)))
+
+(defun cl--set-buffer-substring (start end val)
+  (save-excursion (delete-region start end)
+                 (goto-char start)
+                 (insert val)
+                 val))
+
+(defun cl--set-substring (str start end val)
+  (if end (if (< end 0) (cl-incf end (length str)))
+    (setq end (length str)))
+  (if (< start 0) (cl-incf start (length str)))
+  (concat (and (> start 0) (substring str 0 start))
+         val
+         (and (< end (length str)) (substring str end))))
+
+
+;;; Blocks and exits.
+
+(defalias 'cl--block-wrapper 'identity)
+(defalias 'cl--block-throw 'throw)
+
+
+;;; Multiple values.
+;; True multiple values are not supported, or even
+;; simulated.  Instead, cl-multiple-value-bind and friends simply expect
+;; the target form to return the values as a list.
+
+(defun cl--defalias (cl-f el-f &optional doc)
+  (defalias cl-f el-f doc)
+  (put cl-f 'byte-optimizer 'byte-compile-inline-expand))
+
+(cl--defalias 'cl-values #'list
+  "Return multiple values, Common Lisp style.
+The arguments of `cl-values' are the values
+that the containing function should return.
+
+\(fn &rest VALUES)")
+
+(cl--defalias 'cl-values-list #'identity
+  "Return multiple values, Common Lisp style, taken from a list.
+LIST specifies the list of values
+that the containing function should return.
+
+\(fn LIST)")
+
+(defsubst cl-multiple-value-list (expression)
+  "Return a list of the multiple values produced by EXPRESSION.
+This handles multiple values in Common Lisp style, but it does not
+work right when EXPRESSION calls an ordinary Emacs Lisp function
+that returns just one value."
+  expression)
+
+(defsubst cl-multiple-value-apply (function expression)
+  "Evaluate EXPRESSION to get multiple values and apply FUNCTION to them.
+This handles multiple values in Common Lisp style, but it does not work
+right when EXPRESSION calls an ordinary Emacs Lisp function that returns just
+one value."
+  (apply function expression))
+
+(defalias 'cl-multiple-value-call 'apply
+  "Apply FUNCTION to ARGUMENTS, taking multiple values into account.
+This implementation only handles the case where there is only one argument.")
+
+(cl--defalias 'cl-nth-value #'nth
+  "Evaluate EXPRESSION to get multiple values and return the Nth one.
+This handles multiple values in Common Lisp style, but it does not work
+right when EXPRESSION calls an ordinary Emacs Lisp function that returns just
+one value.
+
+\(fn N EXPRESSION)")
+
+;;; Declarations.
+
+(defvar cl--compiling-file nil)
+(defun cl--compiling-file ()
+  (or cl--compiling-file
+      (and (boundp 'byte-compile--outbuffer)
+           (bufferp (symbol-value 'byte-compile--outbuffer))
+          (equal (buffer-name (symbol-value 'byte-compile--outbuffer))
+                 " *Compiler Output*"))))
+
+(defvar cl-proclaims-deferred nil)
+
+(defun cl-proclaim (spec)
+  (if (fboundp 'cl-do-proclaim) (cl-do-proclaim spec t)
+    (push spec cl-proclaims-deferred))
+  nil)
+
+(defmacro cl-declaim (&rest specs)
+  (let ((body (mapcar (function (lambda (x) (list 'cl-proclaim (list 'quote x))))
+                     specs)))
+    (if (cl--compiling-file) (cl-list* 'cl-eval-when '(compile load eval) body)
+      (cons 'progn body))))   ; avoid loading cl-macs.el for cl-eval-when
+
+
+;;; Symbols.
+
+(defun cl-random-time ()
+  (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0))
+    (while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i))))
+    v))
+
+(defvar cl--gensym-counter (* (logand (cl-random-time) 1023) 100))
+
+
+;;; Numbers.
+
+(defun cl-floatp-safe (object)
+  "Return t if OBJECT is a floating point number.
+On Emacs versions that lack floating-point support, this function
+always returns nil."
+  (and (numberp object) (not (integerp object))))
+
+(defsubst cl-plusp (number)
+  "Return t if NUMBER is positive."
+  (> number 0))
+
+(defsubst cl-minusp (number)
+  "Return t if NUMBER is negative."
+  (< number 0))
+
+(defun cl-oddp (integer)
+  "Return t if INTEGER is odd."
+  (eq (logand integer 1) 1))
+
+(defun cl-evenp (integer)
+  "Return t if INTEGER is even."
+  (eq (logand integer 1) 0))
+
+(defvar cl--random-state (vector 'cl-random-state-tag -1 30 (cl-random-time)))
+
+(defconst cl-most-positive-float nil
+  "The largest value that a Lisp float can hold.
+If your system supports infinities, this is the largest finite value.
+For IEEE machines, this is approximately 1.79e+308.
+Call `cl-float-limits' to set this.")
+
+(defconst cl-most-negative-float nil
+  "The largest negative value that a Lisp float can hold.
+This is simply -`cl-most-positive-float'.
+Call `cl-float-limits' to set this.")
+
+(defconst cl-least-positive-float nil
+  "The smallest value greater than zero that a Lisp float can hold.
+For IEEE machines, it is about 4.94e-324 if denormals are supported,
+or 2.22e-308 if they are not.
+Call `cl-float-limits' to set this.")
+
+(defconst cl-least-negative-float nil
+  "The smallest value less than zero that a Lisp float can hold.
+This is simply -`cl-least-positive-float'.
+Call `cl-float-limits' to set this.")
+
+(defconst cl-least-positive-normalized-float nil
+  "The smallest normalized Lisp float greater than zero.
+This is the smallest value for which IEEE denormalization does not lose
+precision.  For IEEE machines, this value is about 2.22e-308.
+For machines that do not support the concept of denormalization
+and gradual underflow, this constant equals `cl-least-positive-float'.
+Call `cl-float-limits' to set this.")
+
+(defconst cl-least-negative-normalized-float nil
+  "The smallest normalized Lisp float less than zero.
+This is simply -`cl-least-positive-normalized-float'.
+Call `cl-float-limits' to set this.")
+
+(defconst cl-float-epsilon nil
+  "The smallest positive float that adds to 1.0 to give a distinct value.
+Adding a number less than this to 1.0 returns 1.0 due to roundoff.
+For IEEE machines, epsilon is about 2.22e-16.
+Call `cl-float-limits' to set this.")
+
+(defconst cl-float-negative-epsilon nil
+  "The smallest positive float that subtracts from 1.0 to give a distinct value.
+For IEEE machines, it is about 1.11e-16.
+Call `cl-float-limits' to set this.")
+
+
+;;; Sequence functions.
+
+(cl--defalias 'cl-copy-seq 'copy-sequence)
+
+(declare-function cl--mapcar-many "cl-extra" (cl-func cl-seqs))
+
+(defun cl-mapcar (cl-func cl-x &rest cl-rest)
+  "Apply FUNCTION to each element of SEQ, and make a list of the results.
+If there are several SEQs, FUNCTION is called with that many arguments,
+and mapping stops as soon as the shortest list runs out.  With just one
+SEQ, this is like `mapcar'.  With several, it is like the Common Lisp
+`mapcar' function extended to arbitrary sequence types.
+\n(fn FUNCTION SEQ...)"
+  (if cl-rest
+      (if (or (cdr cl-rest) (nlistp cl-x) (nlistp (car cl-rest)))
+         (cl--mapcar-many cl-func (cons cl-x cl-rest))
+       (let ((cl-res nil) (cl-y (car cl-rest)))
+         (while (and cl-x cl-y)
+           (push (funcall cl-func (pop cl-x) (pop cl-y)) cl-res))
+         (nreverse cl-res)))
+    (mapcar cl-func cl-x)))
+
+(cl--defalias 'cl-svref 'aref)
+
+;;; List functions.
+
+(cl--defalias 'cl-first 'car)
+(cl--defalias 'cl-second 'cadr)
+(cl--defalias 'cl-rest 'cdr)
+(cl--defalias 'cl-endp 'null)
+
+(cl--defalias 'cl-third 'cl-caddr "Return the third element of the list X.")
+(cl--defalias 'cl-fourth 'cl-cadddr "Return the fourth element of the list X.")
+
+(defsubst cl-fifth (x)
+  "Return the fifth element of the list X."
+  (declare (gv-setter (lambda (store) `(setcar (nthcdr 4 ,x) ,store))))
+  (nth 4 x))
+
+(defsubst cl-sixth (x)
+  "Return the sixth element of the list X."
+  (declare (gv-setter (lambda (store) `(setcar (nthcdr 5 ,x) ,store))))
+  (nth 5 x))
+
+(defsubst cl-seventh (x)
+  "Return the seventh element of the list X."
+  (declare (gv-setter (lambda (store) `(setcar (nthcdr 6 ,x) ,store))))
+  (nth 6 x))
+
+(defsubst cl-eighth (x)
+  "Return the eighth element of the list X."
+  (declare (gv-setter (lambda (store) `(setcar (nthcdr 7 ,x) ,store))))
+  (nth 7 x))
+
+(defsubst cl-ninth (x)
+  "Return the ninth element of the list X."
+  (declare (gv-setter (lambda (store) `(setcar (nthcdr 8 ,x) ,store))))
+  (nth 8 x))
+
+(defsubst cl-tenth (x)
+  "Return the tenth element of the list X."
+  (declare (gv-setter (lambda (store) `(setcar (nthcdr 9 ,x) ,store))))
+  (nth 9 x))
+
+(defun cl-caaar (x)
+  "Return the `car' of the `car' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (car (car x))))
+
+(defun cl-caadr (x)
+  "Return the `car' of the `car' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (car (cdr x))))
+
+(defun cl-cadar (x)
+  "Return the `car' of the `cdr' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (cdr (car x))))
+
+(defun cl-caddr (x)
+  "Return the `car' of the `cdr' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (cdr (cdr x))))
+
+(defun cl-cdaar (x)
+  "Return the `cdr' of the `car' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (car (car x))))
+
+(defun cl-cdadr (x)
+  "Return the `cdr' of the `car' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (car (cdr x))))
+
+(defun cl-cddar (x)
+  "Return the `cdr' of the `cdr' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (cdr (car x))))
+
+(defun cl-cdddr (x)
+  "Return the `cdr' of the `cdr' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (cdr (cdr x))))
+
+(defun cl-caaaar (x)
+  "Return the `car' of the `car' of the `car' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (car (car (car x)))))
+
+(defun cl-caaadr (x)
+  "Return the `car' of the `car' of the `car' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (car (car (cdr x)))))
+
+(defun cl-caadar (x)
+  "Return the `car' of the `car' of the `cdr' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (car (cdr (car x)))))
+
+(defun cl-caaddr (x)
+  "Return the `car' of the `car' of the `cdr' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (car (cdr (cdr x)))))
+
+(defun cl-cadaar (x)
+  "Return the `car' of the `cdr' of the `car' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (cdr (car (car x)))))
+
+(defun cl-cadadr (x)
+  "Return the `car' of the `cdr' of the `car' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (cdr (car (cdr x)))))
+
+(defun cl-caddar (x)
+  "Return the `car' of the `cdr' of the `cdr' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (cdr (cdr (car x)))))
+
+(defun cl-cadddr (x)
+  "Return the `car' of the `cdr' of the `cdr' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (car (cdr (cdr (cdr x)))))
+
+(defun cl-cdaaar (x)
+  "Return the `cdr' of the `car' of the `car' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (car (car (car x)))))
+
+(defun cl-cdaadr (x)
+  "Return the `cdr' of the `car' of the `car' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (car (car (cdr x)))))
+
+(defun cl-cdadar (x)
+  "Return the `cdr' of the `car' of the `cdr' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (car (cdr (car x)))))
+
+(defun cl-cdaddr (x)
+  "Return the `cdr' of the `car' of the `cdr' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (car (cdr (cdr x)))))
+
+(defun cl-cddaar (x)
+  "Return the `cdr' of the `cdr' of the `car' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (cdr (car (car x)))))
+
+(defun cl-cddadr (x)
+  "Return the `cdr' of the `cdr' of the `car' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (cdr (car (cdr x)))))
+
+(defun cl-cdddar (x)
+  "Return the `cdr' of the `cdr' of the `cdr' of the `car' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (cdr (cdr (car x)))))
+
+(defun cl-cddddr (x)
+  "Return the `cdr' of the `cdr' of the `cdr' of the `cdr' of X."
+  (declare (compiler-macro cl--compiler-macro-cXXr))
+  (cdr (cdr (cdr (cdr x)))))
+
+;;(defun last* (x &optional n)
+;;  "Returns the last link in the list LIST.
+;;With optional argument N, returns Nth-to-last link (default 1)."
+;;  (if n
+;;      (let ((m 0) (p x))
+;;     (while (consp p) (cl-incf m) (pop p))
+;;     (if (<= n 0) p
+;;       (if (< n m) (nthcdr (- m n) x) x)))
+;;    (while (consp (cdr x)) (pop x))
+;;    x))
+
+(defun cl-list* (arg &rest rest)
+  "Return a new list with specified ARGs as elements, consed to last ARG.
+Thus, `(cl-list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
+`(cons A (cons B (cons C D)))'.
+\n(fn ARG...)"
+  (declare (compiler-macro cl--compiler-macro-list*))
+  (cond ((not rest) arg)
+       ((not (cdr rest)) (cons arg (car rest)))
+       (t (let* ((n (length rest))
+                 (copy (copy-sequence rest))
+                 (last (nthcdr (- n 2) copy)))
+            (setcdr last (car (cdr last)))
+            (cons arg copy)))))
+
+(defun cl-ldiff (list sublist)
+  "Return a copy of LIST with the tail SUBLIST removed."
+  (let ((res nil))
+    (while (and (consp list) (not (eq list sublist)))
+      (push (pop list) res))
+    (nreverse res)))
+
+(defun cl-copy-list (list)
+  "Return a copy of LIST, which may be a dotted list.
+The elements of LIST are not copied, just the list structure itself."
+  (if (consp list)
+      (let ((res nil))
+       (while (consp list) (push (pop list) res))
+       (prog1 (nreverse res) (setcdr res list)))
+    (car list)))
+
+;; Autoloaded, but we have not loaded cl-loaddefs yet.
+(declare-function cl-floor "cl-extra" (x &optional y))
+(declare-function cl-ceiling "cl-extra" (x &optional y))
+(declare-function cl-truncate "cl-extra" (x &optional y))
+(declare-function cl-round "cl-extra" (x &optional y))
+(declare-function cl-mod "cl-extra" (x y))
+
+(defun cl-adjoin (cl-item cl-list &rest cl-keys)
+  "Return ITEM consed onto the front of LIST only if it's not already there.
+Otherwise, return LIST unmodified.
+\nKeywords supported:  :test :test-not :key
+\n(fn ITEM LIST [KEYWORD VALUE]...)"
+  (declare (compiler-macro cl--compiler-macro-adjoin))
+  (cond ((or (equal cl-keys '(:test eq))
+            (and (null cl-keys) (not (numberp cl-item))))
+        (if (memq cl-item cl-list) cl-list (cons cl-item cl-list)))
+       ((or (equal cl-keys '(:test equal)) (null cl-keys))
+        (if (member cl-item cl-list) cl-list (cons cl-item cl-list)))
+       (t (apply 'cl--adjoin cl-item cl-list cl-keys))))
+
+(defun cl-subst (cl-new cl-old cl-tree &rest cl-keys)
+  "Substitute NEW for OLD everywhere in TREE (non-destructively).
+Return a copy of TREE with all elements `eql' to OLD replaced by NEW.
+\nKeywords supported:  :test :test-not :key
+\n(fn NEW OLD TREE [KEYWORD VALUE]...)"
+  (if (or cl-keys (and (numberp cl-old) (not (integerp cl-old))))
+      (apply 'cl-sublis (list (cons cl-old cl-new)) cl-tree cl-keys)
+    (cl--do-subst cl-new cl-old cl-tree)))
+
+(defun cl--do-subst (cl-new cl-old cl-tree)
+  (cond ((eq cl-tree cl-old) cl-new)
+       ((consp cl-tree)
+        (let ((a (cl--do-subst cl-new cl-old (car cl-tree)))
+              (d (cl--do-subst cl-new cl-old (cdr cl-tree))))
+          (if (and (eq a (car cl-tree)) (eq d (cdr cl-tree)))
+              cl-tree (cons a d))))
+       (t cl-tree)))
+
+(defun cl-acons (key value alist)
+  "Add KEY and VALUE to ALIST.
+Return a new list with (cons KEY VALUE) as car and ALIST as cdr."
+  (cons (cons key value) alist))
+
+(defun cl-pairlis (keys values &optional alist)
+  "Make an alist from KEYS and VALUES.
+Return a new alist composed by associating KEYS to corresponding VALUES;
+the process stops as soon as KEYS or VALUES run out.
+If ALIST is non-nil, the new pairs are prepended to it."
+  (nconc (cl-mapcar 'cons keys values) alist))
+
+
+;;; Generalized variables.
+
+;; These used to be in cl-macs.el since all macros that use them (like setf)
+;; were autoloaded from cl-macs.el.  But now that setf, push, and pop are in
+;; core Elisp, they need to either be right here or be autoloaded via
+;; cl-loaddefs.el, which is more trouble than it is worth.
+
+;; Some more Emacs-related place types.
+(gv-define-simple-setter buffer-file-name set-visited-file-name t)
+(gv-define-setter buffer-modified-p (flag &optional buf)
+  `(with-current-buffer ,buf
+     (set-buffer-modified-p ,flag)))
+(gv-define-simple-setter buffer-name rename-buffer t)
+(gv-define-setter buffer-string (store)
+  `(progn (erase-buffer) (insert ,store)))
+(gv-define-simple-setter buffer-substring cl--set-buffer-substring)
+(gv-define-simple-setter current-buffer set-buffer)
+(gv-define-simple-setter current-case-table set-case-table)
+(gv-define-simple-setter current-column move-to-column t)
+(gv-define-simple-setter current-global-map use-global-map t)
+(gv-define-setter current-input-mode (store)
+  `(progn (apply #'set-input-mode ,store) ,store))
+(gv-define-simple-setter current-local-map use-local-map t)
+(gv-define-simple-setter current-window-configuration
+                         set-window-configuration t)
+(gv-define-simple-setter default-file-modes set-default-file-modes t)
+(gv-define-simple-setter documentation-property put)
+(gv-define-setter face-background (x f &optional s)
+  `(set-face-background ,f ,x ,s))
+(gv-define-setter face-background-pixmap (x f &optional s)
+  `(set-face-background-pixmap ,f ,x ,s))
+(gv-define-setter face-font (x f &optional s) `(set-face-font ,f ,x ,s))
+(gv-define-setter face-foreground (x f &optional s)
+  `(set-face-foreground ,f ,x ,s))
+(gv-define-setter face-underline-p (x f &optional s)
+  `(set-face-underline-p ,f ,x ,s))
+(gv-define-simple-setter file-modes set-file-modes t)
+(gv-define-simple-setter frame-height set-screen-height t)
+(gv-define-simple-setter frame-parameters modify-frame-parameters t)
+(gv-define-simple-setter frame-visible-p cl--set-frame-visible-p)
+(gv-define-simple-setter frame-width set-screen-width t)
+(gv-define-simple-setter getenv setenv t)
+(gv-define-simple-setter get-register set-register)
+(gv-define-simple-setter global-key-binding global-set-key)
+(gv-define-simple-setter local-key-binding local-set-key)
+(gv-define-simple-setter mark set-mark t)
+(gv-define-simple-setter mark-marker set-mark t)
+(gv-define-simple-setter marker-position set-marker t)
+(gv-define-setter mouse-position (store scr)
+  `(set-mouse-position ,scr (car ,store) (cadr ,store)
+                       (cddr ,store)))
+(gv-define-simple-setter point goto-char)
+(gv-define-simple-setter point-marker goto-char t)
+(gv-define-setter point-max (store)
+  `(progn (narrow-to-region (point-min) ,store) ,store))
+(gv-define-setter point-min (store)
+  `(progn (narrow-to-region ,store (point-max)) ,store))
+(gv-define-setter read-mouse-position (store scr)
+  `(set-mouse-position ,scr (car ,store) (cdr ,store)))
+(gv-define-simple-setter screen-height set-screen-height t)
+(gv-define-simple-setter screen-width set-screen-width t)
+(gv-define-simple-setter selected-window select-window)
+(gv-define-simple-setter selected-screen select-screen)
+(gv-define-simple-setter selected-frame select-frame)
+(gv-define-simple-setter standard-case-table set-standard-case-table)
+(gv-define-simple-setter syntax-table set-syntax-table)
+(gv-define-simple-setter visited-file-modtime set-visited-file-modtime t)
+(gv-define-setter window-height (store)
+  `(progn (enlarge-window (- ,store (window-height))) ,store))
+(gv-define-setter window-width (store)
+  `(progn (enlarge-window (- ,store (window-width)) t) ,store))
+(gv-define-simple-setter x-get-secondary-selection x-own-secondary-selection t)
+(gv-define-simple-setter x-get-selection x-own-selection t)
+
+;; More complex setf-methods.
+
+;; This is a hack that allows (setf (eq a 7) B) to mean either
+;; (setq a 7) or (setq a nil) depending on whether B is nil or not.
+;; This is useful when you have control over the PLACE but not over
+;; the VALUE, as is the case in define-minor-mode's :variable.
+;; It turned out that :variable needed more flexibility anyway, so
+;; this doesn't seem too useful now.
+(gv-define-expander eq
+  (lambda (do place val)
+    (gv-letplace (getter setter) place
+      (macroexp-let2 nil val val
+        (funcall do `(eq ,getter ,val)
+                 (lambda (v)
+                   `(cond
+                     (,v ,(funcall setter val))
+                     ((eq ,getter ,val) ,(funcall setter `(not ,val))))))))))
+
+(gv-define-expander substring
+  (lambda (do place from &optional to)
+    (gv-letplace (getter setter) place
+      (macroexp-let2 nil start from
+        (macroexp-let2 nil end to
+          (funcall do `(substring ,getter ,start ,end)
+                   (lambda (v)
+                     (funcall setter `(cl--set-substring
+                                       ,getter ,start ,end ,v)))))))))
+
+;;; Miscellaneous.
+
+;;;###autoload
+(progn
+  ;; Make sure functions defined with cl-defsubst can be inlined even in
+  ;; packages which do not require CL.
+  (autoload 'cl--defsubst-expand "cl-macs")
+  ;; Autoload, so autoload.el and font-lock can use it even when CL
+  ;; is not loaded.
+  (put 'cl-defun    'doc-string-elt 3)
+  (put 'cl-defmacro 'doc-string-elt 3)
+  (put 'cl-defsubst 'doc-string-elt 3)
+  (put 'cl-defstruct 'doc-string-elt 2))
+
+(load "cl-loaddefs" nil 'quiet)
+
+(provide 'cl-lib)
+
+(run-hooks 'cl-load-hook)
+
+;; Local variables:
+;; byte-compile-dynamic: t
+;; byte-compile-warnings: (not cl-functions)
+;; End:
+
+;;; cl-lib.el ends here
index b75239d2a38d2250b4895371573cb1e09250b6b7..947fa9513bbb889866956d98baff119f6cbe1121 100644 (file)
@@ -3,23 +3,24 @@
 ;;; Code:
 
 \f
-;;;### (autoloads (cl-prettyexpand cl-macroexpand-all cl-remprop
-;;;;;;  cl-do-remf cl-set-getf getf get* tailp list-length nreconc
-;;;;;;  revappend concatenate subseq cl-float-limits random-state-p
-;;;;;;  make-random-state random* signum rem* mod* round* truncate*
-;;;;;;  ceiling* floor* isqrt lcm gcd cl-progv-before cl-set-frame-visible-p
-;;;;;;  cl-map-overlays cl-map-intervals cl-map-keymap-recursively
-;;;;;;  notevery notany every some mapcon mapcan mapl maplist map
-;;;;;;  cl-mapcar-many equalp coerce) "cl-extra" "cl-extra.el" "c172dda6770ce18b556561481bfefbb2")
+;;;### (autoloads (cl-prettyexpand cl-remprop cl--do-remf cl--set-getf
+;;;;;;  cl-getf cl-get cl-tailp cl-list-length cl-nreconc cl-revappend
+;;;;;;  cl-concatenate cl-subseq cl-float-limits cl-random-state-p
+;;;;;;  cl-make-random-state cl-random cl-signum cl-rem cl-mod cl-round
+;;;;;;  cl-truncate cl-ceiling cl-floor cl-isqrt cl-lcm cl-gcd cl--set-frame-visible-p
+;;;;;;  cl--map-overlays cl--map-intervals cl--map-keymap-recursively
+;;;;;;  cl-notevery cl-notany cl-every cl-some cl-mapcon cl-mapcan
+;;;;;;  cl-mapl cl-maplist cl-map cl--mapcar-many cl-equalp cl-coerce)
+;;;;;;  "cl-extra" "cl-extra.el" "535a24c1cff55a16e3d51219498a7858")
 ;;; Generated autoloads from cl-extra.el
 
-(autoload 'coerce "cl-extra" "\
+(autoload 'cl-coerce "cl-extra" "\
 Coerce OBJECT to type TYPE.
 TYPE is a Common Lisp type specifier.
 
 \(fn OBJECT TYPE)" nil nil)
 
-(autoload 'equalp "cl-extra" "\
+(autoload 'cl-equalp "cl-extra" "\
 Return t if two Lisp objects have similar structures and contents.
 This is like `equal', except that it accepts numerically equal
 numbers of different types (float vs. integer), and also compares
@@ -27,216 +28,211 @@ strings case-insensitively.
 
 \(fn X Y)" nil nil)
 
-(autoload 'cl-mapcar-many "cl-extra" "\
+(autoload 'cl--mapcar-many "cl-extra" "\
 
 
 \(fn CL-FUNC CL-SEQS)" nil nil)
 
-(autoload 'map "cl-extra" "\
+(autoload 'cl-map "cl-extra" "\
 Map a FUNCTION across one or more SEQUENCEs, returning a sequence.
 TYPE is the sequence type to return.
 
 \(fn TYPE FUNCTION SEQUENCE...)" nil nil)
 
-(autoload 'maplist "cl-extra" "\
+(autoload 'cl-maplist "cl-extra" "\
 Map FUNCTION to each sublist of LIST or LISTs.
 Like `mapcar', except applies to lists and their cdr's rather than to
 the elements themselves.
 
 \(fn FUNCTION LIST...)" nil nil)
 
-(autoload 'mapl "cl-extra" "\
-Like `maplist', but does not accumulate values returned by the function.
+(autoload 'cl-mapl "cl-extra" "\
+Like `cl-maplist', but does not accumulate values returned by the function.
 
 \(fn FUNCTION LIST...)" nil nil)
 
-(autoload 'mapcan "cl-extra" "\
+(autoload 'cl-mapcan "cl-extra" "\
 Like `mapcar', but nconc's together the values returned by the function.
 
 \(fn FUNCTION SEQUENCE...)" nil nil)
 
-(autoload 'mapcon "cl-extra" "\
-Like `maplist', but nconc's together the values returned by the function.
+(autoload 'cl-mapcon "cl-extra" "\
+Like `cl-maplist', but nconc's together the values returned by the function.
 
 \(fn FUNCTION LIST...)" nil nil)
 
-(autoload 'some "cl-extra" "\
+(autoload 'cl-some "cl-extra" "\
 Return true if PREDICATE is true of any element of SEQ or SEQs.
 If so, return the true (non-nil) value returned by PREDICATE.
 
 \(fn PREDICATE SEQ...)" nil nil)
 
-(autoload 'every "cl-extra" "\
+(autoload 'cl-every "cl-extra" "\
 Return true if PREDICATE is true of every element of SEQ or SEQs.
 
 \(fn PREDICATE SEQ...)" nil nil)
 
-(autoload 'notany "cl-extra" "\
+(autoload 'cl-notany "cl-extra" "\
 Return true if PREDICATE is false of every element of SEQ or SEQs.
 
 \(fn PREDICATE SEQ...)" nil nil)
 
-(autoload 'notevery "cl-extra" "\
+(autoload 'cl-notevery "cl-extra" "\
 Return true if PREDICATE is false of some element of SEQ or SEQs.
 
 \(fn PREDICATE SEQ...)" nil nil)
 
-(defalias 'cl-map-keymap 'map-keymap)
-
-(autoload 'cl-map-keymap-recursively "cl-extra" "\
+(autoload 'cl--map-keymap-recursively "cl-extra" "\
 
 
 \(fn CL-FUNC-REC CL-MAP &optional CL-BASE)" nil nil)
 
-(autoload 'cl-map-intervals "cl-extra" "\
+(autoload 'cl--map-intervals "cl-extra" "\
 
 
 \(fn CL-FUNC &optional CL-WHAT CL-PROP CL-START CL-END)" nil nil)
 
-(autoload 'cl-map-overlays "cl-extra" "\
+(autoload 'cl--map-overlays "cl-extra" "\
 
 
 \(fn CL-FUNC &optional CL-BUFFER CL-START CL-END CL-ARG)" nil nil)
 
-(autoload 'cl-set-frame-visible-p "cl-extra" "\
+(autoload 'cl--set-frame-visible-p "cl-extra" "\
 
 
 \(fn FRAME VAL)" nil nil)
 
-(autoload 'cl-progv-before "cl-extra" "\
-
-
-\(fn SYMS VALUES)" nil nil)
-
-(autoload 'gcd "cl-extra" "\
+(autoload 'cl-gcd "cl-extra" "\
 Return the greatest common divisor of the arguments.
 
 \(fn &rest ARGS)" nil nil)
 
-(autoload 'lcm "cl-extra" "\
+(autoload 'cl-lcm "cl-extra" "\
 Return the least common multiple of the arguments.
 
 \(fn &rest ARGS)" nil nil)
 
-(autoload 'isqrt "cl-extra" "\
+(autoload 'cl-isqrt "cl-extra" "\
 Return the integer square root of the argument.
 
 \(fn X)" nil nil)
 
-(autoload 'floor* "cl-extra" "\
+(autoload 'cl-floor "cl-extra" "\
 Return a list of the floor of X and the fractional part of X.
 With two arguments, return floor and remainder of their quotient.
 
 \(fn X &optional Y)" nil nil)
 
-(autoload 'ceiling* "cl-extra" "\
+(autoload 'cl-ceiling "cl-extra" "\
 Return a list of the ceiling of X and the fractional part of X.
 With two arguments, return ceiling and remainder of their quotient.
 
 \(fn X &optional Y)" nil nil)
 
-(autoload 'truncate* "cl-extra" "\
+(autoload 'cl-truncate "cl-extra" "\
 Return a list of the integer part of X and the fractional part of X.
 With two arguments, return truncation and remainder of their quotient.
 
 \(fn X &optional Y)" nil nil)
 
-(autoload 'round* "cl-extra" "\
+(autoload 'cl-round "cl-extra" "\
 Return a list of X rounded to the nearest integer and the remainder.
 With two arguments, return rounding and remainder of their quotient.
 
 \(fn X &optional Y)" nil nil)
 
-(autoload 'mod* "cl-extra" "\
+(autoload 'cl-mod "cl-extra" "\
 The remainder of X divided by Y, with the same sign as Y.
 
 \(fn X Y)" nil nil)
 
-(autoload 'rem* "cl-extra" "\
+(autoload 'cl-rem "cl-extra" "\
 The remainder of X divided by Y, with the same sign as X.
 
 \(fn X Y)" nil nil)
 
-(autoload 'signum "cl-extra" "\
+(autoload 'cl-signum "cl-extra" "\
 Return 1 if X is positive, -1 if negative, 0 if zero.
 
 \(fn X)" nil nil)
 
-(autoload 'random* "cl-extra" "\
+(autoload 'cl-random "cl-extra" "\
 Return a random nonnegative number less than LIM, an integer or float.
 Optional second arg STATE is a random-state object.
 
 \(fn LIM &optional STATE)" nil nil)
 
-(autoload 'make-random-state "cl-extra" "\
-Return a copy of random-state STATE, or of `*random-state*' if omitted.
+(autoload 'cl-make-random-state "cl-extra" "\
+Return a copy of random-state STATE, or of the internal state if omitted.
 If STATE is t, return a new state object seeded from the time of day.
 
 \(fn &optional STATE)" nil nil)
 
-(autoload 'random-state-p "cl-extra" "\
+(autoload 'cl-random-state-p "cl-extra" "\
 Return t if OBJECT is a random-state object.
 
 \(fn OBJECT)" nil nil)
 
 (autoload 'cl-float-limits "cl-extra" "\
 Initialize the Common Lisp floating-point parameters.
-This sets the values of: `most-positive-float', `most-negative-float',
-`least-positive-float', `least-negative-float', `float-epsilon',
-`float-negative-epsilon', `least-positive-normalized-float', and
-`least-negative-normalized-float'.
+This sets the values of: `cl-most-positive-float', `cl-most-negative-float',
+`cl-least-positive-float', `cl-least-negative-float', `cl-float-epsilon',
+`cl-float-negative-epsilon', `cl-least-positive-normalized-float', and
+`cl-least-negative-normalized-float'.
 
 \(fn)" nil nil)
 
-(autoload 'subseq "cl-extra" "\
+(autoload 'cl-subseq "cl-extra" "\
 Return the subsequence of SEQ from START to END.
 If END is omitted, it defaults to the length of the sequence.
 If START or END is negative, it counts from the end.
 
 \(fn SEQ START &optional END)" nil nil)
 
-(autoload 'concatenate "cl-extra" "\
+(autoload 'cl-concatenate "cl-extra" "\
 Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
 
 \(fn TYPE SEQUENCE...)" nil nil)
 
-(autoload 'revappend "cl-extra" "\
+(autoload 'cl-revappend "cl-extra" "\
 Equivalent to (append (reverse X) Y).
 
 \(fn X Y)" nil nil)
 
-(autoload 'nreconc "cl-extra" "\
+(autoload 'cl-nreconc "cl-extra" "\
 Equivalent to (nconc (nreverse X) Y).
 
 \(fn X Y)" nil nil)
 
-(autoload 'list-length "cl-extra" "\
+(autoload 'cl-list-length "cl-extra" "\
 Return the length of list X.  Return nil if list is circular.
 
 \(fn X)" nil nil)
 
-(autoload 'tailp "cl-extra" "\
+(autoload 'cl-tailp "cl-extra" "\
 Return true if SUBLIST is a tail of LIST.
 
 \(fn SUBLIST LIST)" nil nil)
 
-(autoload 'get* "cl-extra" "\
+(autoload 'cl-get "cl-extra" "\
 Return the value of SYMBOL's PROPNAME property, or DEFAULT if none.
 
 \(fn SYMBOL PROPNAME &optional DEFAULT)" nil nil)
 
-(autoload 'getf "cl-extra" "\
+(put 'cl-get 'compiler-macro #'cl--compiler-macro-get)
+
+(autoload 'cl-getf "cl-extra" "\
 Search PROPLIST for property PROPNAME; return its value or DEFAULT.
 PROPLIST is a list of the sort returned by `symbol-plist'.
 
 \(fn PROPLIST PROPNAME &optional DEFAULT)" nil nil)
 
-(autoload 'cl-set-getf "cl-extra" "\
+(autoload 'cl--set-getf "cl-extra" "\
 
 
 \(fn PLIST TAG VAL)" nil nil)
 
-(autoload 'cl-do-remf "cl-extra" "\
+(autoload 'cl--do-remf "cl-extra" "\
 
 
 \(fn PLIST TAG)" nil nil)
@@ -246,30 +242,6 @@ Remove from SYMBOL's plist the property PROPNAME and its value.
 
 \(fn SYMBOL PROPNAME)" nil nil)
 
-(defalias 'remprop 'cl-remprop)
-
-(defalias 'cl-gethash 'gethash)
-
-(defalias 'cl-puthash 'puthash)
-
-(defalias 'cl-remhash 'remhash)
-
-(defalias 'cl-clrhash 'clrhash)
-
-(defalias 'cl-maphash 'maphash)
-
-(defalias 'cl-make-hash-table 'make-hash-table)
-
-(defalias 'cl-hash-table-p 'hash-table-p)
-
-(defalias 'cl-hash-table-count 'hash-table-count)
-
-(autoload 'cl-macroexpand-all "cl-extra" "\
-Expand all macro calls through a Lisp FORM.
-This also does some trivial optimizations to make the form prettier.
-
-\(fn FORM &optional ENV)" nil nil)
-
 (autoload 'cl-prettyexpand "cl-extra" "\
 
 
@@ -277,105 +249,127 @@ This also does some trivial optimizations to make the form prettier.
 
 ;;;***
 \f
-;;;### (autoloads (defsubst* compiler-macroexpand define-compiler-macro
-;;;;;;  assert check-type typep deftype cl-struct-setf-expander defstruct
-;;;;;;  define-modify-macro callf2 callf letf* letf rotatef shiftf
-;;;;;;  remf cl-do-pop psetf setf get-setf-method defsetf define-setf-method
-;;;;;;  declare the locally multiple-value-setq multiple-value-bind
-;;;;;;  lexical-let* lexical-let symbol-macrolet macrolet labels
-;;;;;;  flet progv psetq do-all-symbols do-symbols dotimes dolist
-;;;;;;  do* do loop return-from return block etypecase typecase ecase
-;;;;;;  case load-time-value eval-when destructuring-bind function*
-;;;;;;  defmacro* defun* gentemp gensym) "cl-macs" "cl-macs.el" "0be85e9c7ef309d2ccbac18b9b0f1d42")
+;;;### (autoloads (cl--compiler-macro-cXXr cl--compiler-macro-list*
+;;;;;;  cl--compiler-macro-adjoin cl-defsubst cl-compiler-macroexpand
+;;;;;;  cl-define-compiler-macro cl-assert cl-check-type cl-typep
+;;;;;;  cl-deftype cl-defstruct cl-callf2 cl-callf cl-letf* cl-letf
+;;;;;;  cl-rotatef cl-shiftf cl-remf cl-psetf cl-declare cl-the cl-locally
+;;;;;;  cl-multiple-value-setq cl-multiple-value-bind cl-symbol-macrolet
+;;;;;;  cl-macrolet cl-labels cl-flet* cl-flet cl-progv cl-psetq
+;;;;;;  cl-do-all-symbols cl-do-symbols cl-dotimes cl-dolist cl-do*
+;;;;;;  cl-do cl-loop cl-return-from cl-return cl-block cl-etypecase
+;;;;;;  cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when
+;;;;;;  cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp
+;;;;;;  cl-gensym) "cl-macs" "cl-macs.el" "a175c7714223c21a617b0460e130f1d8")
 ;;; Generated autoloads from cl-macs.el
 
-(autoload 'gensym "cl-macs" "\
+(autoload 'cl-gensym "cl-macs" "\
 Generate a new uninterned symbol.
 The name is made by appending a number to PREFIX, default \"G\".
 
 \(fn &optional PREFIX)" nil nil)
 
-(autoload 'gentemp "cl-macs" "\
+(autoload 'cl-gentemp "cl-macs" "\
 Generate a new interned symbol with a unique name.
 The name is made by appending a number to PREFIX, default \"G\".
 
 \(fn &optional PREFIX)" nil nil)
 
-(autoload 'defun* "cl-macs" "\
+(autoload 'cl-defun "cl-macs" "\
 Define NAME as a function.
 Like normal `defun', except ARGLIST allows full Common Lisp conventions,
-and BODY is implicitly surrounded by (block NAME ...).
+and BODY is implicitly surrounded by (cl-block NAME ...).
+
+\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil t)
 
-\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil (quote macro))
+(put 'cl-defun 'doc-string-elt '3)
 
-(autoload 'defmacro* "cl-macs" "\
+(put 'cl-defun 'lisp-indent-function '2)
+
+(autoload 'cl-defmacro "cl-macs" "\
 Define NAME as a macro.
 Like normal `defmacro', except ARGLIST allows full Common Lisp conventions,
-and BODY is implicitly surrounded by (block NAME ...).
+and BODY is implicitly surrounded by (cl-block NAME ...).
+
+\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil t)
+
+(put 'cl-defmacro 'doc-string-elt '3)
 
-\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil (quote macro))
+(put 'cl-defmacro 'lisp-indent-function '2)
 
-(autoload 'function* "cl-macs" "\
+(autoload 'cl-function "cl-macs" "\
 Introduce a function.
 Like normal `function', except that if argument is a lambda form,
 its argument list allows full Common Lisp conventions.
 
-\(fn FUNC)" nil (quote macro))
+\(fn FUNC)" nil t)
 
-(autoload 'destructuring-bind "cl-macs" "\
+(autoload 'cl-destructuring-bind "cl-macs" "\
 
 
-\(fn ARGS EXPR &rest BODY)" nil (quote macro))
+\(fn ARGS EXPR &rest BODY)" nil t)
 
-(autoload 'eval-when "cl-macs" "\
+(put 'cl-destructuring-bind 'lisp-indent-function '2)
+
+(autoload 'cl-eval-when "cl-macs" "\
 Control when BODY is evaluated.
 If `compile' is in WHEN, BODY is evaluated when compiled at top-level.
 If `load' is in WHEN, BODY is evaluated when loaded after top-level compile.
 If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level.
 
-\(fn (WHEN...) BODY...)" nil (quote macro))
+\(fn (WHEN...) BODY...)" nil t)
+
+(put 'cl-eval-when 'lisp-indent-function '1)
 
-(autoload 'load-time-value "cl-macs" "\
+(autoload 'cl-load-time-value "cl-macs" "\
 Like `progn', but evaluates the body at load time.
 The result of the body appears to the compiler as a quoted constant.
 
-\(fn FORM &optional READ-ONLY)" nil (quote macro))
+\(fn FORM &optional READ-ONLY)" nil t)
 
-(autoload 'case "cl-macs" "\
+(autoload 'cl-case "cl-macs" "\
 Eval EXPR and choose among clauses on that value.
 Each clause looks like (KEYLIST BODY...).  EXPR is evaluated and compared
 against each key in each KEYLIST; the corresponding BODY is evaluated.
-If no clause succeeds, case returns nil.  A single atom may be used in
+If no clause succeeds, cl-case returns nil.  A single atom may be used in
 place of a KEYLIST of one atom.  A KEYLIST of t or `otherwise' is
 allowed only in the final clause, and matches if no other keys match.
 Key values are compared by `eql'.
 
-\(fn EXPR (KEYLIST BODY...)...)" nil (quote macro))
+\(fn EXPR (KEYLIST BODY...)...)" nil t)
 
-(autoload 'ecase "cl-macs" "\
-Like `case', but error if no case fits.
+(put 'cl-case 'lisp-indent-function '1)
+
+(autoload 'cl-ecase "cl-macs" "\
+Like `cl-case', but error if no case fits.
 `otherwise'-clauses are not allowed.
 
-\(fn EXPR (KEYLIST BODY...)...)" nil (quote macro))
+\(fn EXPR (KEYLIST BODY...)...)" nil t)
+
+(put 'cl-ecase 'lisp-indent-function '1)
 
-(autoload 'typecase "cl-macs" "\
+(autoload 'cl-typecase "cl-macs" "\
 Evals EXPR, chooses among clauses on that value.
 Each clause looks like (TYPE BODY...).  EXPR is evaluated and, if it
 satisfies TYPE, the corresponding BODY is evaluated.  If no clause succeeds,
-typecase returns nil.  A TYPE of t or `otherwise' is allowed only in the
+cl-typecase returns nil.  A TYPE of t or `otherwise' is allowed only in the
 final clause, and matches if no other keys match.
 
-\(fn EXPR (TYPE BODY...)...)" nil (quote macro))
+\(fn EXPR (TYPE BODY...)...)" nil t)
+
+(put 'cl-typecase 'lisp-indent-function '1)
 
-(autoload 'etypecase "cl-macs" "\
-Like `typecase', but error if no case fits.
+(autoload 'cl-etypecase "cl-macs" "\
+Like `cl-typecase', but error if no case fits.
 `otherwise'-clauses are not allowed.
 
-\(fn EXPR (TYPE BODY...)...)" nil (quote macro))
+\(fn EXPR (TYPE BODY...)...)" nil t)
 
-(autoload 'block "cl-macs" "\
+(put 'cl-etypecase 'lisp-indent-function '1)
+
+(autoload 'cl-block "cl-macs" "\
 Define a lexically-scoped block named NAME.
-NAME may be any symbol.  Code inside the BODY forms can call `return-from'
+NAME may be any symbol.  Code inside the BODY forms can call `cl-return-from'
 to jump prematurely out of the block.  This differs from `catch' and `throw'
 in two respects:  First, the NAME is an unevaluated symbol rather than a
 quoted symbol or other form; and second, NAME is lexically rather than
@@ -383,25 +377,29 @@ dynamically scoped:  Only references to it within BODY will work.  These
 references may appear inside macro expansions, but not inside functions
 called from BODY.
 
-\(fn NAME &rest BODY)" nil (quote macro))
+\(fn NAME &rest BODY)" nil t)
+
+(put 'cl-block 'lisp-indent-function '1)
 
-(autoload 'return "cl-macs" "\
+(autoload 'cl-return "cl-macs" "\
 Return from the block named nil.
-This is equivalent to `(return-from nil RESULT)'.
+This is equivalent to `(cl-return-from nil RESULT)'.
 
-\(fn &optional RESULT)" nil (quote macro))
+\(fn &optional RESULT)" nil t)
 
-(autoload 'return-from "cl-macs" "\
+(autoload 'cl-return-from "cl-macs" "\
 Return from the block named NAME.
-This jumps out to the innermost enclosing `(block NAME ...)' form,
+This jumps out to the innermost enclosing `(cl-block NAME ...)' form,
 returning RESULT from that form (or nil if RESULT is omitted).
 This is compatible with Common Lisp, but note that `defun' and
 `defmacro' do not create implicit blocks as they do in Common Lisp.
 
-\(fn NAME &optional RESULT)" nil (quote macro))
+\(fn NAME &optional RESULT)" nil t)
+
+(put 'cl-return-from 'lisp-indent-function '1)
 
-(autoload 'loop "cl-macs" "\
-The Common Lisp `loop' macro.
+(autoload 'cl-loop "cl-macs" "\
+The Common Lisp `cl-loop' macro.
 Valid clauses are:
   for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
   for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR,
@@ -414,54 +412,66 @@ Valid clauses are:
   do EXPRS..., initially EXPRS..., finally EXPRS..., return EXPR,
   finally return EXPR, named NAME.
 
-\(fn CLAUSE...)" nil (quote macro))
+\(fn CLAUSE...)" nil t)
 
-(autoload 'do "cl-macs" "\
-The Common Lisp `do' loop.
+(autoload 'cl-do "cl-macs" "\
+The Common Lisp `cl-do' loop.
 
-\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil (quote macro))
+\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t)
 
-(autoload 'do* "cl-macs" "\
-The Common Lisp `do*' loop.
+(put 'cl-do 'lisp-indent-function '2)
 
-\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil (quote macro))
+(autoload 'cl-do* "cl-macs" "\
+The Common Lisp `cl-do*' loop.
 
-(autoload 'dolist "cl-macs" "\
+\(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" nil t)
+
+(put 'cl-do* 'lisp-indent-function '2)
+
+(autoload 'cl-dolist "cl-macs" "\
 Loop over a list.
 Evaluate BODY with VAR bound to each `car' from LIST, in turn.
 Then evaluate RESULT to get return value, default nil.
 An implicit nil block is established around the loop.
 
-\(fn (VAR LIST [RESULT]) BODY...)" nil (quote macro))
+\(fn (VAR LIST [RESULT]) BODY...)" nil t)
+
+(put 'cl-dolist 'lisp-indent-function '1)
 
-(autoload 'dotimes "cl-macs" "\
+(autoload 'cl-dotimes "cl-macs" "\
 Loop a certain number of times.
 Evaluate BODY with VAR bound to successive integers from 0, inclusive,
 to COUNT, exclusive.  Then evaluate RESULT to get return value, default
 nil.
 
-\(fn (VAR COUNT [RESULT]) BODY...)" nil (quote macro))
+\(fn (VAR COUNT [RESULT]) BODY...)" nil t)
 
-(autoload 'do-symbols "cl-macs" "\
+(put 'cl-dotimes 'lisp-indent-function '1)
+
+(autoload 'cl-do-symbols "cl-macs" "\
 Loop over all symbols.
 Evaluate BODY with VAR bound to each interned symbol, or to each symbol
 from OBARRAY.
 
-\(fn (VAR [OBARRAY [RESULT]]) BODY...)" nil (quote macro))
+\(fn (VAR [OBARRAY [RESULT]]) BODY...)" nil t)
+
+(put 'cl-do-symbols 'lisp-indent-function '1)
 
-(autoload 'do-all-symbols "cl-macs" "\
+(autoload 'cl-do-all-symbols "cl-macs" "\
 
 
-\(fn SPEC &rest BODY)" nil (quote macro))
+\(fn SPEC &rest BODY)" nil t)
 
-(autoload 'psetq "cl-macs" "\
+(put 'cl-do-all-symbols 'lisp-indent-function '1)
+
+(autoload 'cl-psetq "cl-macs" "\
 Set SYMs to the values VALs in parallel.
 This is like `setq', except that all VAL forms are evaluated (in order)
 before assigning any symbols SYM to the corresponding values.
 
-\(fn SYM VAL SYM VAL ...)" nil (quote macro))
+\(fn SYM VAL SYM VAL ...)" nil t)
 
-(autoload 'progv "cl-macs" "\
+(autoload 'cl-progv "cl-macs" "\
 Bind SYMBOLS to VALUES dynamically in BODY.
 The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists.
 Each symbol in the first list is bound to the corresponding value in the
@@ -469,175 +479,127 @@ second list (or made unbound if VALUES is shorter than SYMBOLS); then the
 BODY forms are executed and their result is returned.  This is much like
 a `let' form, except that the list of symbols can be computed at run-time.
 
-\(fn SYMBOLS VALUES &rest BODY)" nil (quote macro))
+\(fn SYMBOLS VALUES &rest BODY)" nil t)
+
+(put 'cl-progv 'lisp-indent-function '2)
+
+(autoload 'cl-flet "cl-macs" "\
+Make temporary function definitions.
+Like `cl-labels' but the definitions are not recursive.
+
+\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t)
+
+(put 'cl-flet 'lisp-indent-function '1)
 
-(autoload 'flet "cl-macs" "\
+(autoload 'cl-flet* "cl-macs" "\
 Make temporary function definitions.
-This is an analogue of `let' that operates on the function cell of FUNC
-rather than its value cell.  The FORMs are evaluated with the specified
-function definitions in place, then the definitions are undone (the FUNCs
-go back to their previous definitions, or lack thereof).
+Like `cl-flet' but the definitions can refer to previous ones.
 
-\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil (quote macro))
+\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t)
 
-(autoload 'labels "cl-macs" "\
+(put 'cl-flet* 'lisp-indent-function '1)
+
+(autoload 'cl-labels "cl-macs" "\
 Make temporary function bindings.
-This is like `flet', except the bindings are lexical instead of dynamic.
-Unlike `flet', this macro is fully compliant with the Common Lisp standard.
+The bindings can be recursive and the scoping is lexical, but capturing them
+in closures will only work if `lexical-binding' is in use.
+
+\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil t)
 
-\(fn ((FUNC ARGLIST BODY...) ...) FORM...)" nil (quote macro))
+(put 'cl-labels 'lisp-indent-function '1)
 
-(autoload 'macrolet "cl-macs" "\
+(autoload 'cl-macrolet "cl-macs" "\
 Make temporary macro definitions.
-This is like `flet', but for macros instead of functions.
+This is like `cl-flet', but for macros instead of functions.
+
+\(fn ((NAME ARGLIST BODY...) ...) FORM...)" nil t)
 
-\(fn ((NAME ARGLIST BODY...) ...) FORM...)" nil (quote macro))
+(put 'cl-macrolet 'lisp-indent-function '1)
 
-(autoload 'symbol-macrolet "cl-macs" "\
+(autoload 'cl-symbol-macrolet "cl-macs" "\
 Make symbol macro definitions.
 Within the body FORMs, references to the variable NAME will be replaced
 by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
 
-\(fn ((NAME EXPANSION) ...) FORM...)" nil (quote macro))
-
-(autoload 'lexical-let "cl-macs" "\
-Like `let', but lexically scoped.
-The main visible difference is that lambdas inside BODY will create
-lexical closures as in Common Lisp.
-
-\(fn BINDINGS BODY)" nil (quote macro))
+\(fn ((NAME EXPANSION) ...) FORM...)" nil t)
 
-(autoload 'lexical-let* "cl-macs" "\
-Like `let*', but lexically scoped.
-The main visible difference is that lambdas inside BODY, and in
-successive bindings within BINDINGS, will create lexical closures
-as in Common Lisp.  This is similar to the behavior of `let*' in
-Common Lisp.
+(put 'cl-symbol-macrolet 'lisp-indent-function '1)
 
-\(fn BINDINGS BODY)" nil (quote macro))
-
-(autoload 'multiple-value-bind "cl-macs" "\
+(autoload 'cl-multiple-value-bind "cl-macs" "\
 Collect multiple return values.
 FORM must return a list; the BODY is then executed with the first N elements
 of this list bound (`let'-style) to each of the symbols SYM in turn.  This
-is analogous to the Common Lisp `multiple-value-bind' macro, using lists to
-simulate true multiple return values.  For compatibility, (values A B C) is
+is analogous to the Common Lisp `cl-multiple-value-bind' macro, using lists to
+simulate true multiple return values.  For compatibility, (cl-values A B C) is
 a synonym for (list A B C).
 
-\(fn (SYM...) FORM BODY)" nil (quote macro))
+\(fn (SYM...) FORM BODY)" nil t)
+
+(put 'cl-multiple-value-bind 'lisp-indent-function '2)
 
-(autoload 'multiple-value-setq "cl-macs" "\
+(autoload 'cl-multiple-value-setq "cl-macs" "\
 Collect multiple return values.
 FORM must return a list; the first N elements of this list are stored in
 each of the symbols SYM in turn.  This is analogous to the Common Lisp
-`multiple-value-setq' macro, using lists to simulate true multiple return
-values.  For compatibility, (values A B C) is a synonym for (list A B C).
+`cl-multiple-value-setq' macro, using lists to simulate true multiple return
+values.  For compatibility, (cl-values A B C) is a synonym for (list A B C).
+
+\(fn (SYM...) FORM)" nil t)
 
-\(fn (SYM...) FORM)" nil (quote macro))
+(put 'cl-multiple-value-setq 'lisp-indent-function '1)
 
-(autoload 'locally "cl-macs" "\
+(autoload 'cl-locally "cl-macs" "\
 
 
-\(fn &rest BODY)" nil (quote macro))
+\(fn &rest BODY)" nil t)
 
-(autoload 'the "cl-macs" "\
+(autoload 'cl-the "cl-macs" "\
 
 
-\(fn TYPE FORM)" nil (quote macro))
+\(fn TYPE FORM)" nil t)
 
-(autoload 'declare "cl-macs" "\
+(put 'cl-the 'lisp-indent-function '1)
+
+(autoload 'cl-declare "cl-macs" "\
 Declare SPECS about the current function while compiling.
 For instance
 
-  (declare (warn 0))
+  (cl-declare (warn 0))
 
 will turn off byte-compile warnings in the function.
 See Info node `(cl)Declarations' for details.
 
-\(fn &rest SPECS)" nil (quote macro))
-
-(autoload 'define-setf-method "cl-macs" "\
-Define a `setf' method.
-This method shows how to handle `setf's to places of the form (NAME ARGS...).
-The argument forms ARGS are bound according to ARGLIST, as if NAME were
-going to be expanded as a macro, then the BODY forms are executed and must
-return a list of five elements: a temporary-variables list, a value-forms
-list, a store-variables list (of length one), a store-form, and an access-
-form.  See `defsetf' for a simpler way to define most setf-methods.
-
-\(fn NAME ARGLIST BODY...)" nil (quote macro))
-
-(autoload 'defsetf "cl-macs" "\
-Define a `setf' method.
-This macro is an easy-to-use substitute for `define-setf-method' that works
-well for simple place forms.  In the simple `defsetf' form, `setf's of
-the form (setf (NAME ARGS...) VAL) are transformed to function or macro
-calls of the form (FUNC ARGS... VAL).  Example:
-
-  (defsetf aref aset)
-
-Alternate form: (defsetf NAME ARGLIST (STORE) BODY...).
-Here, the above `setf' call is expanded by binding the argument forms ARGS
-according to ARGLIST, binding the value form VAL to STORE, then executing
-BODY, which must return a Lisp form that does the necessary `setf' operation.
-Actually, ARGLIST and STORE may be bound to temporary variables which are
-introduced automatically to preserve proper execution order of the arguments.
-Example:
-
-  (defsetf nth (n x) (v) (list 'setcar (list 'nthcdr n x) v))
-
-\(fn NAME [FUNC | ARGLIST (STORE) BODY...])" nil (quote macro))
+\(fn &rest SPECS)" nil t)
 
-(autoload 'get-setf-method "cl-macs" "\
-Return a list of five values describing the setf-method for PLACE.
-PLACE may be any Lisp form which can appear as the PLACE argument to
-a macro like `setf' or `incf'.
-
-\(fn PLACE &optional ENV)" nil nil)
-
-(autoload 'setf "cl-macs" "\
-Set each PLACE to the value of its VAL.
-This is a generalized version of `setq'; the PLACEs may be symbolic
-references such as (car x) or (aref x i), as well as plain symbols.
-For example, (setf (cadar x) y) is equivalent to (setcar (cdar x) y).
-The return value is the last VAL in the list.
-
-\(fn PLACE VAL PLACE VAL ...)" nil (quote macro))
-
-(autoload 'psetf "cl-macs" "\
+(autoload 'cl-psetf "cl-macs" "\
 Set PLACEs to the values VALs in parallel.
 This is like `setf', except that all VAL forms are evaluated (in order)
 before assigning any PLACEs to the corresponding values.
 
-\(fn PLACE VAL PLACE VAL ...)" nil (quote macro))
-
-(autoload 'cl-do-pop "cl-macs" "\
-
+\(fn PLACE VAL PLACE VAL ...)" nil t)
 
-\(fn PLACE)" nil nil)
-
-(autoload 'remf "cl-macs" "\
+(autoload 'cl-remf "cl-macs" "\
 Remove TAG from property list PLACE.
 PLACE may be a symbol, or any generalized variable allowed by `setf'.
 The form returns true if TAG was found and removed, nil otherwise.
 
-\(fn PLACE TAG)" nil (quote macro))
+\(fn PLACE TAG)" nil t)
 
-(autoload 'shiftf "cl-macs" "\
+(autoload 'cl-shiftf "cl-macs" "\
 Shift left among PLACEs.
-Example: (shiftf A B C) sets A to B, B to C, and returns the old A.
+Example: (cl-shiftf A B C) sets A to B, B to C, and returns the old A.
 Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
 
-\(fn PLACE... VAL)" nil (quote macro))
+\(fn PLACE... VAL)" nil t)
 
-(autoload 'rotatef "cl-macs" "\
+(autoload 'cl-rotatef "cl-macs" "\
 Rotate left among PLACEs.
-Example: (rotatef A B C) sets A to B, B to C, and C to A.  It returns nil.
+Example: (cl-rotatef A B C) sets A to B, B to C, and C to A.  It returns nil.
 Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
 
-\(fn PLACE...)" nil (quote macro))
+\(fn PLACE...)" nil t)
 
-(autoload 'letf "cl-macs" "\
+(autoload 'cl-letf "cl-macs" "\
 Temporarily bind to PLACEs.
 This is the analogue of `let', but with generalized variables (in the
 sense of `setf') for the PLACEs.  Each PLACE is set to the corresponding
@@ -647,41 +609,37 @@ values.  Note that this macro is *not* available in Common Lisp.
 As a special case, if `(PLACE)' is used instead of `(PLACE VALUE)',
 the PLACE is not modified before executing BODY.
 
-\(fn ((PLACE VALUE) ...) BODY...)" nil (quote macro))
+\(fn ((PLACE VALUE) ...) BODY...)" nil t)
+
+(put 'cl-letf 'lisp-indent-function '1)
 
-(autoload 'letf* "cl-macs" "\
+(autoload 'cl-letf* "cl-macs" "\
 Temporarily bind to PLACEs.
-This is the analogue of `let*', but with generalized variables (in the
-sense of `setf') for the PLACEs.  Each PLACE is set to the corresponding
-VALUE, then the BODY forms are executed.  On exit, either normally or
-because of a `throw' or error, the PLACEs are set back to their original
-values.  Note that this macro is *not* available in Common Lisp.
-As a special case, if `(PLACE)' is used instead of `(PLACE VALUE)',
-the PLACE is not modified before executing BODY.
+Like `cl-letf' but where the bindings are performed one at a time,
+rather than all at the end (i.e. like `let*' rather than like `let').
 
-\(fn ((PLACE VALUE) ...) BODY...)" nil (quote macro))
+\(fn BINDINGS &rest BODY)" nil t)
 
-(autoload 'callf "cl-macs" "\
+(put 'cl-letf* 'lisp-indent-function '1)
+
+(autoload 'cl-callf "cl-macs" "\
 Set PLACE to (FUNC PLACE ARGS...).
 FUNC should be an unquoted function name.  PLACE may be a symbol,
 or any generalized variable allowed by `setf'.
 
-\(fn FUNC PLACE ARGS...)" nil (quote macro))
+\(fn FUNC PLACE &rest ARGS)" nil t)
 
-(autoload 'callf2 "cl-macs" "\
-Set PLACE to (FUNC ARG1 PLACE ARGS...).
-Like `callf', but PLACE is the second argument of FUNC, not the first.
+(put 'cl-callf 'lisp-indent-function '2)
 
-\(fn FUNC ARG1 PLACE ARGS...)" nil (quote macro))
+(autoload 'cl-callf2 "cl-macs" "\
+Set PLACE to (FUNC ARG1 PLACE ARGS...).
+Like `cl-callf', but PLACE is the second argument of FUNC, not the first.
 
-(autoload 'define-modify-macro "cl-macs" "\
-Define a `setf'-like modify macro.
-If NAME is called, it combines its PLACE argument with the other arguments
-from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)
+\(fn FUNC ARG1 PLACE ARGS...)" nil t)
 
-\(fn NAME ARGLIST FUNC &optional DOC)" nil (quote macro))
+(put 'cl-callf2 'lisp-indent-function '3)
 
-(autoload 'defstruct "cl-macs" "\
+(autoload 'cl-defstruct "cl-macs" "\
 Define a struct type.
 This macro defines a new data type called NAME that stores data
 in SLOTs.  It defines a `make-NAME' constructor, a `copy-NAME'
@@ -697,41 +655,40 @@ SLOT-OPTS are keyword-value pairs for that slot.  Currently, only
 one keyword is supported, `:read-only'.  If this has a non-nil
 value, that slot cannot be set via `setf'.
 
-\(fn NAME SLOTS...)" nil (quote macro))
+\(fn NAME SLOTS...)" nil t)
 
-(autoload 'cl-struct-setf-expander "cl-macs" "\
+(put 'cl-defstruct 'doc-string-elt '2)
 
-
-\(fn X NAME ACCESSOR PRED-FORM POS)" nil nil)
-
-(autoload 'deftype "cl-macs" "\
+(autoload 'cl-deftype "cl-macs" "\
 Define NAME as a new data type.
-The type name can then be used in `typecase', `check-type', etc.
+The type name can then be used in `cl-typecase', `cl-check-type', etc.
+
+\(fn NAME ARGLIST &rest BODY)" nil t)
 
-\(fn NAME ARGLIST &rest BODY)" nil (quote macro))
+(put 'cl-deftype 'doc-string-elt '3)
 
-(autoload 'typep "cl-macs" "\
+(autoload 'cl-typep "cl-macs" "\
 Check that OBJECT is of type TYPE.
 TYPE is a Common Lisp-style type specifier.
 
 \(fn OBJECT TYPE)" nil nil)
 
-(autoload 'check-type "cl-macs" "\
+(autoload 'cl-check-type "cl-macs" "\
 Verify that FORM is of type TYPE; signal an error if not.
 STRING is an optional description of the desired type.
 
-\(fn FORM TYPE &optional STRING)" nil (quote macro))
+\(fn FORM TYPE &optional STRING)" nil t)
 
-(autoload 'assert "cl-macs" "\
+(autoload 'cl-assert "cl-macs" "\
 Verify that FORM returns non-nil; signal an error if not.
 Second arg SHOW-ARGS means to include arguments of FORM in message.
 Other args STRING and ARGS... are arguments to be passed to `error'.
 They are not evaluated unless the assertion fails.  If STRING is
 omitted, a default message listing FORM itself is used.
 
-\(fn FORM &optional SHOW-ARGS STRING &rest ARGS)" nil (quote macro))
+\(fn FORM &optional SHOW-ARGS STRING &rest ARGS)" nil t)
 
-(autoload 'define-compiler-macro "cl-macs" "\
+(autoload 'cl-define-compiler-macro "cl-macs" "\
 Define a compiler-only macro.
 This is like `defmacro', but macro expansion occurs only if the call to
 FUNC is compiled (i.e., not interpreted).  Compiler macros should be used
@@ -743,51 +700,70 @@ possible.  Unlike regular macros, BODY can decide to \"punt\" and leave the
 original function call alone by declaring an initial `&whole foo' parameter
 and then returning foo.
 
-\(fn FUNC ARGS &rest BODY)" nil (quote macro))
+\(fn FUNC ARGS &rest BODY)" nil t)
 
-(autoload 'compiler-macroexpand "cl-macs" "\
+(autoload 'cl-compiler-macroexpand "cl-macs" "\
 
 
 \(fn FORM)" nil nil)
 
-(autoload 'defsubst* "cl-macs" "\
+(autoload 'cl-defsubst "cl-macs" "\
 Define NAME as a function.
 Like `defun', except the function is automatically declared `inline',
 ARGLIST allows full Common Lisp conventions, and BODY is implicitly
-surrounded by (block NAME ...).
+surrounded by (cl-block NAME ...).
+
+\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil t)
+
+(put 'cl-defsubst 'lisp-indent-function '2)
 
-\(fn NAME ARGLIST [DOCSTRING] BODY...)" nil (quote macro))
+(autoload 'cl--compiler-macro-adjoin "cl-macs" "\
+
+
+\(fn FORM A LIST &rest KEYS)" nil nil)
+
+(autoload 'cl--compiler-macro-list* "cl-macs" "\
+
+
+\(fn FORM ARG &rest OTHERS)" nil nil)
+
+(autoload 'cl--compiler-macro-cXXr "cl-macs" "\
+
+
+\(fn FORM X)" nil nil)
 
 ;;;***
 \f
-;;;### (autoloads (tree-equal nsublis sublis nsubst-if-not nsubst-if
-;;;;;;  nsubst subst-if-not subst-if subsetp nset-exclusive-or set-exclusive-or
-;;;;;;  nset-difference set-difference nintersection intersection
-;;;;;;  nunion union rassoc-if-not rassoc-if rassoc* assoc-if-not
-;;;;;;  assoc-if assoc* cl-adjoin member-if-not member-if member*
-;;;;;;  merge stable-sort sort* search mismatch count-if-not count-if
-;;;;;;  count position-if-not position-if position find-if-not find-if
-;;;;;;  find nsubstitute-if-not nsubstitute-if nsubstitute substitute-if-not
-;;;;;;  substitute-if substitute delete-duplicates remove-duplicates
-;;;;;;  delete-if-not delete-if delete* remove-if-not remove-if remove*
-;;;;;;  replace fill reduce) "cl-seq" "cl-seq.el" "99095e49c83af1c8bec0fdcf517b3f95")
+;;;### (autoloads (cl-tree-equal cl-nsublis cl-sublis cl-nsubst-if-not
+;;;;;;  cl-nsubst-if cl-nsubst cl-subst-if-not cl-subst-if cl-subsetp
+;;;;;;  cl-nset-exclusive-or cl-set-exclusive-or cl-nset-difference
+;;;;;;  cl-set-difference cl-nintersection cl-intersection cl-nunion
+;;;;;;  cl-union cl-rassoc-if-not cl-rassoc-if cl-rassoc cl-assoc-if-not
+;;;;;;  cl-assoc-if cl-assoc cl--adjoin cl-member-if-not cl-member-if
+;;;;;;  cl-member cl-merge cl-stable-sort cl-sort cl-search cl-mismatch
+;;;;;;  cl-count-if-not cl-count-if cl-count cl-position-if-not cl-position-if
+;;;;;;  cl-position cl-find-if-not cl-find-if cl-find cl-nsubstitute-if-not
+;;;;;;  cl-nsubstitute-if cl-nsubstitute cl-substitute-if-not cl-substitute-if
+;;;;;;  cl-substitute cl-delete-duplicates cl-remove-duplicates cl-delete-if-not
+;;;;;;  cl-delete-if cl-delete cl-remove-if-not cl-remove-if cl-remove
+;;;;;;  cl-replace cl-fill cl-reduce) "cl-seq" "cl-seq.el" "b444601641dcbd14a23ca5182bc80ffa")
 ;;; Generated autoloads from cl-seq.el
 
-(autoload 'reduce "cl-seq" "\
+(autoload 'cl-reduce "cl-seq" "\
 Reduce two-argument FUNCTION across SEQ.
 
 Keywords supported:  :start :end :from-end :initial-value :key
 
 \(fn FUNCTION SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'fill "cl-seq" "\
+(autoload 'cl-fill "cl-seq" "\
 Fill the elements of SEQ with ITEM.
 
 Keywords supported:  :start :end
 
 \(fn SEQ ITEM [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'replace "cl-seq" "\
+(autoload 'cl-replace "cl-seq" "\
 Replace the elements of SEQ1 with the elements of SEQ2.
 SEQ1 is destructively modified, then returned.
 
@@ -795,7 +771,7 @@ Keywords supported:  :start1 :end1 :start2 :end2
 
 \(fn SEQ1 SEQ2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'remove* "cl-seq" "\
+(autoload 'cl-remove "cl-seq" "\
 Remove all occurrences of ITEM in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
@@ -804,7 +780,7 @@ Keywords supported:  :test :test-not :key :count :start :end :from-end
 
 \(fn ITEM SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'remove-if "cl-seq" "\
+(autoload 'cl-remove-if "cl-seq" "\
 Remove all items satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
@@ -813,7 +789,7 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'remove-if-not "cl-seq" "\
+(autoload 'cl-remove-if-not "cl-seq" "\
 Remove all items not satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
@@ -822,7 +798,7 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'delete* "cl-seq" "\
+(autoload 'cl-delete "cl-seq" "\
 Remove all occurrences of ITEM in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 
@@ -830,7 +806,7 @@ Keywords supported:  :test :test-not :key :count :start :end :from-end
 
 \(fn ITEM SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'delete-if "cl-seq" "\
+(autoload 'cl-delete-if "cl-seq" "\
 Remove all items satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 
@@ -838,7 +814,7 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'delete-if-not "cl-seq" "\
+(autoload 'cl-delete-if-not "cl-seq" "\
 Remove all items not satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 
@@ -846,21 +822,21 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'remove-duplicates "cl-seq" "\
+(autoload 'cl-remove-duplicates "cl-seq" "\
 Return a copy of SEQ with all duplicate elements removed.
 
 Keywords supported:  :test :test-not :key :start :end :from-end
 
 \(fn SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'delete-duplicates "cl-seq" "\
+(autoload 'cl-delete-duplicates "cl-seq" "\
 Remove all duplicate elements from SEQ (destructively).
 
 Keywords supported:  :test :test-not :key :start :end :from-end
 
 \(fn SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'substitute "cl-seq" "\
+(autoload 'cl-substitute "cl-seq" "\
 Substitute NEW for OLD in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
@@ -869,7 +845,7 @@ Keywords supported:  :test :test-not :key :count :start :end :from-end
 
 \(fn NEW OLD SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'substitute-if "cl-seq" "\
+(autoload 'cl-substitute-if "cl-seq" "\
 Substitute NEW for all items satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
@@ -878,7 +854,7 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'substitute-if-not "cl-seq" "\
+(autoload 'cl-substitute-if-not "cl-seq" "\
 Substitute NEW for all items not satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
@@ -887,7 +863,7 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nsubstitute "cl-seq" "\
+(autoload 'cl-nsubstitute "cl-seq" "\
 Substitute NEW for OLD in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 
@@ -895,7 +871,7 @@ Keywords supported:  :test :test-not :key :count :start :end :from-end
 
 \(fn NEW OLD SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nsubstitute-if "cl-seq" "\
+(autoload 'cl-nsubstitute-if "cl-seq" "\
 Substitute NEW for all items satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 
@@ -903,7 +879,7 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nsubstitute-if-not "cl-seq" "\
+(autoload 'cl-nsubstitute-if-not "cl-seq" "\
 Substitute NEW for all items not satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 
@@ -911,7 +887,7 @@ Keywords supported:  :key :count :start :end :from-end
 
 \(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'find "cl-seq" "\
+(autoload 'cl-find "cl-seq" "\
 Find the first occurrence of ITEM in SEQ.
 Return the matching ITEM, or nil if not found.
 
@@ -919,7 +895,7 @@ Keywords supported:  :test :test-not :key :start :end :from-end
 
 \(fn ITEM SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'find-if "cl-seq" "\
+(autoload 'cl-find-if "cl-seq" "\
 Find the first item satisfying PREDICATE in SEQ.
 Return the matching item, or nil if not found.
 
@@ -927,7 +903,7 @@ Keywords supported:  :key :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'find-if-not "cl-seq" "\
+(autoload 'cl-find-if-not "cl-seq" "\
 Find the first item not satisfying PREDICATE in SEQ.
 Return the matching item, or nil if not found.
 
@@ -935,7 +911,7 @@ Keywords supported:  :key :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'position "cl-seq" "\
+(autoload 'cl-position "cl-seq" "\
 Find the first occurrence of ITEM in SEQ.
 Return the index of the matching item, or nil if not found.
 
@@ -943,7 +919,7 @@ Keywords supported:  :test :test-not :key :start :end :from-end
 
 \(fn ITEM SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'position-if "cl-seq" "\
+(autoload 'cl-position-if "cl-seq" "\
 Find the first item satisfying PREDICATE in SEQ.
 Return the index of the matching item, or nil if not found.
 
@@ -951,7 +927,7 @@ Keywords supported:  :key :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'position-if-not "cl-seq" "\
+(autoload 'cl-position-if-not "cl-seq" "\
 Find the first item not satisfying PREDICATE in SEQ.
 Return the index of the matching item, or nil if not found.
 
@@ -959,28 +935,28 @@ Keywords supported:  :key :start :end :from-end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'count "cl-seq" "\
+(autoload 'cl-count "cl-seq" "\
 Count the number of occurrences of ITEM in SEQ.
 
 Keywords supported:  :test :test-not :key :start :end
 
 \(fn ITEM SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'count-if "cl-seq" "\
+(autoload 'cl-count-if "cl-seq" "\
 Count the number of items satisfying PREDICATE in SEQ.
 
 Keywords supported:  :key :start :end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'count-if-not "cl-seq" "\
+(autoload 'cl-count-if-not "cl-seq" "\
 Count the number of items not satisfying PREDICATE in SEQ.
 
 Keywords supported:  :key :start :end
 
 \(fn PREDICATE SEQ [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'mismatch "cl-seq" "\
+(autoload 'cl-mismatch "cl-seq" "\
 Compare SEQ1 with SEQ2, return index of first mismatching element.
 Return nil if the sequences match.  If one sequence is a prefix of the
 other, the return value indicates the end of the shorter sequence.
@@ -989,7 +965,7 @@ Keywords supported:  :test :test-not :key :start1 :end1 :start2 :end2 :from-end
 
 \(fn SEQ1 SEQ2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'search "cl-seq" "\
+(autoload 'cl-search "cl-seq" "\
 Search for SEQ1 as a subsequence of SEQ2.
 Return the index of the leftmost element of the first match found;
 return nil if there are no matches.
@@ -998,7 +974,7 @@ Keywords supported:  :test :test-not :key :start1 :end1 :start2 :end2 :from-end
 
 \(fn SEQ1 SEQ2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'sort* "cl-seq" "\
+(autoload 'cl-sort "cl-seq" "\
 Sort the argument SEQ according to PREDICATE.
 This is a destructive function; it reuses the storage of SEQ if possible.
 
@@ -1006,7 +982,7 @@ Keywords supported:  :key
 
 \(fn SEQ PREDICATE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'stable-sort "cl-seq" "\
+(autoload 'cl-stable-sort "cl-seq" "\
 Sort the argument SEQ stably according to PREDICATE.
 This is a destructive function; it reuses the storage of SEQ if possible.
 
@@ -1014,7 +990,7 @@ Keywords supported:  :key
 
 \(fn SEQ PREDICATE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'merge "cl-seq" "\
+(autoload 'cl-merge "cl-seq" "\
 Destructively merge the two sequences to produce a new sequence.
 TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument
 sequences, and PREDICATE is a `less-than' predicate on the elements.
@@ -1023,7 +999,7 @@ Keywords supported:  :key
 
 \(fn TYPE SEQ1 SEQ2 PREDICATE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'member* "cl-seq" "\
+(autoload 'cl-member "cl-seq" "\
 Find the first occurrence of ITEM in LIST.
 Return the sublist of LIST whose car is ITEM.
 
@@ -1031,7 +1007,9 @@ Keywords supported:  :test :test-not :key
 
 \(fn ITEM LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'member-if "cl-seq" "\
+(put 'cl-member 'compiler-macro #'cl--compiler-macro-member)
+
+(autoload 'cl-member-if "cl-seq" "\
 Find the first item satisfying PREDICATE in LIST.
 Return the sublist of LIST whose car matches.
 
@@ -1039,7 +1017,7 @@ Keywords supported:  :key
 
 \(fn PREDICATE LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'member-if-not "cl-seq" "\
+(autoload 'cl-member-if-not "cl-seq" "\
 Find the first item not satisfying PREDICATE in LIST.
 Return the sublist of LIST whose car matches.
 
@@ -1047,54 +1025,56 @@ Keywords supported:  :key
 
 \(fn PREDICATE LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'cl-adjoin "cl-seq" "\
+(autoload 'cl--adjoin "cl-seq" "\
 
 
 \(fn CL-ITEM CL-LIST &rest CL-KEYS)" nil nil)
 
-(autoload 'assoc* "cl-seq" "\
+(autoload 'cl-assoc "cl-seq" "\
 Find the first item whose car matches ITEM in LIST.
 
 Keywords supported:  :test :test-not :key
 
 \(fn ITEM LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'assoc-if "cl-seq" "\
+(put 'cl-assoc 'compiler-macro #'cl--compiler-macro-assoc)
+
+(autoload 'cl-assoc-if "cl-seq" "\
 Find the first item whose car satisfies PREDICATE in LIST.
 
 Keywords supported:  :key
 
 \(fn PREDICATE LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'assoc-if-not "cl-seq" "\
+(autoload 'cl-assoc-if-not "cl-seq" "\
 Find the first item whose car does not satisfy PREDICATE in LIST.
 
 Keywords supported:  :key
 
 \(fn PREDICATE LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'rassoc* "cl-seq" "\
+(autoload 'cl-rassoc "cl-seq" "\
 Find the first item whose cdr matches ITEM in LIST.
 
 Keywords supported:  :test :test-not :key
 
 \(fn ITEM LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'rassoc-if "cl-seq" "\
+(autoload 'cl-rassoc-if "cl-seq" "\
 Find the first item whose cdr satisfies PREDICATE in LIST.
 
 Keywords supported:  :key
 
 \(fn PREDICATE LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'rassoc-if-not "cl-seq" "\
+(autoload 'cl-rassoc-if-not "cl-seq" "\
 Find the first item whose cdr does not satisfy PREDICATE in LIST.
 
 Keywords supported:  :key
 
 \(fn PREDICATE LIST [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'union "cl-seq" "\
+(autoload 'cl-union "cl-seq" "\
 Combine LIST1 and LIST2 using a set-union operation.
 The resulting list contains all items that appear in either LIST1 or LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -1104,7 +1084,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nunion "cl-seq" "\
+(autoload 'cl-nunion "cl-seq" "\
 Combine LIST1 and LIST2 using a set-union operation.
 The resulting list contains all items that appear in either LIST1 or LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
@@ -1114,7 +1094,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'intersection "cl-seq" "\
+(autoload 'cl-intersection "cl-seq" "\
 Combine LIST1 and LIST2 using a set-intersection operation.
 The resulting list contains all items that appear in both LIST1 and LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -1124,7 +1104,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nintersection "cl-seq" "\
+(autoload 'cl-nintersection "cl-seq" "\
 Combine LIST1 and LIST2 using a set-intersection operation.
 The resulting list contains all items that appear in both LIST1 and LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
@@ -1134,7 +1114,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'set-difference "cl-seq" "\
+(autoload 'cl-set-difference "cl-seq" "\
 Combine LIST1 and LIST2 using a set-difference operation.
 The resulting list contains all items that appear in LIST1 but not LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -1144,7 +1124,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nset-difference "cl-seq" "\
+(autoload 'cl-nset-difference "cl-seq" "\
 Combine LIST1 and LIST2 using a set-difference operation.
 The resulting list contains all items that appear in LIST1 but not LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
@@ -1154,7 +1134,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'set-exclusive-or "cl-seq" "\
+(autoload 'cl-set-exclusive-or "cl-seq" "\
 Combine LIST1 and LIST2 using a set-exclusive-or operation.
 The resulting list contains all items appearing in exactly one of LIST1, LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -1164,7 +1144,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nset-exclusive-or "cl-seq" "\
+(autoload 'cl-nset-exclusive-or "cl-seq" "\
 Combine LIST1 and LIST2 using a set-exclusive-or operation.
 The resulting list contains all items appearing in exactly one of LIST1, LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
@@ -1174,7 +1154,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'subsetp "cl-seq" "\
+(autoload 'cl-subsetp "cl-seq" "\
 Return true if LIST1 is a subset of LIST2.
 I.e., if every element of LIST1 also appears in LIST2.
 
@@ -1182,7 +1162,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn LIST1 LIST2 [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'subst-if "cl-seq" "\
+(autoload 'cl-subst-if "cl-seq" "\
 Substitute NEW for elements matching PREDICATE in TREE (non-destructively).
 Return a copy of TREE with all matching elements replaced by NEW.
 
@@ -1190,7 +1170,7 @@ Keywords supported:  :key
 
 \(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'subst-if-not "cl-seq" "\
+(autoload 'cl-subst-if-not "cl-seq" "\
 Substitute NEW for elts not matching PREDICATE in TREE (non-destructively).
 Return a copy of TREE with all non-matching elements replaced by NEW.
 
@@ -1198,7 +1178,7 @@ Keywords supported:  :key
 
 \(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nsubst "cl-seq" "\
+(autoload 'cl-nsubst "cl-seq" "\
 Substitute NEW for OLD everywhere in TREE (destructively).
 Any element of TREE which is `eql' to OLD is changed to NEW (via a call
 to `setcar').
@@ -1207,7 +1187,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn NEW OLD TREE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nsubst-if "cl-seq" "\
+(autoload 'cl-nsubst-if "cl-seq" "\
 Substitute NEW for elements matching PREDICATE in TREE (destructively).
 Any element of TREE which matches is changed to NEW (via a call to `setcar').
 
@@ -1215,7 +1195,7 @@ Keywords supported:  :key
 
 \(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nsubst-if-not "cl-seq" "\
+(autoload 'cl-nsubst-if-not "cl-seq" "\
 Substitute NEW for elements not matching PREDICATE in TREE (destructively).
 Any element of TREE which matches is changed to NEW (via a call to `setcar').
 
@@ -1223,7 +1203,7 @@ Keywords supported:  :key
 
 \(fn NEW PREDICATE TREE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'sublis "cl-seq" "\
+(autoload 'cl-sublis "cl-seq" "\
 Perform substitutions indicated by ALIST in TREE (non-destructively).
 Return a copy of TREE with all matching elements replaced.
 
@@ -1231,7 +1211,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn ALIST TREE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'nsublis "cl-seq" "\
+(autoload 'cl-nsublis "cl-seq" "\
 Perform substitutions indicated by ALIST in TREE (destructively).
 Any matching element of TREE is changed via a call to `setcar'.
 
@@ -1239,7 +1219,7 @@ Keywords supported:  :test :test-not :key
 
 \(fn ALIST TREE [KEYWORD VALUE]...)" nil nil)
 
-(autoload 'tree-equal "cl-seq" "\
+(autoload 'cl-tree-equal "cl-seq" "\
 Return t if trees TREE1 and TREE2 have `eql' leaves.
 Atoms are compared by `eql'; cons cells are compared recursively.
 
index f58fc70053fcafcb23496ef987634d5e231a0d54..31d20f274eddf1f19e0824f85804f90fe425ce39 100644 (file)
@@ -1,4 +1,4 @@
-;;; cl-macs.el --- Common Lisp macros
+;;; cl-macs.el --- Common Lisp macros  -*- lexical-binding: t; coding: utf-8 -*-
 
 ;; Copyright (C) 1993, 2001-2012  Free Software Foundation, Inc.
 
 
 ;;; Code:
 
-(require 'cl)
+(require 'cl-lib)
+(require 'macroexp)
+;; `gv' is required here because cl-macs can be loaded before loaddefs.el.
+(require 'gv)
 
 (defmacro cl-pop2 (place)
-  (list 'prog1 (list 'car (list 'cdr place))
-       (list 'setq place (list 'cdr (list 'cdr place)))))
-(put 'cl-pop2 'edebug-form-spec 'edebug-sexps)
+  (declare (debug edebug-sexps))
+  `(prog1 (car (cdr ,place))
+     (setq ,place (cdr (cdr ,place)))))
 
 (defvar cl-optimize-safety)
 (defvar cl-optimize-speed)
 
-
-;; This kludge allows macros which use cl-transform-function-property
-;; to be called at compile-time.
-
-(require
- (progn
-   (or (fboundp 'cl-transform-function-property)
-       (defalias 'cl-transform-function-property
-        (function (lambda (n p f)
-                    (list 'put (list 'quote n) (list 'quote p)
-                          (list 'function (cons 'lambda f)))))))
-   (car (or features (setq features (list 'cl-kludge))))))
-
-
 ;;; Initialization.
 
-(defvar cl-old-bc-file-form nil)
+;;; Some predicates for analyzing Lisp forms.
+;; These are used by various
+;; macro expanders to optimize the results in certain common cases.
 
-;;; Some predicates for analyzing Lisp forms.  These are used by various
-;;; macro expanders to optimize the results in certain common cases.
-
-(defconst cl-simple-funcs '(car cdr nth aref elt if and or + - 1+ 1- min max
+(defconst cl--simple-funcs '(car cdr nth aref elt if and or + - 1+ 1- min max
                            car-safe cdr-safe progn prog1 prog2))
-(defconst cl-safe-funcs '(* / % length memq list vector vectorp
+(defconst cl--safe-funcs '(* / % length memq list vector vectorp
                          < > <= >= = error))
 
-;;; Check if no side effects, and executes quickly.
-(defun cl-simple-expr-p (x &optional size)
+(defun cl--simple-expr-p (x &optional size)
+  "Check if no side effects, and executes quickly."
   (or size (setq size 10))
-  (if (and (consp x) (not (memq (car x) '(quote function function*))))
+  (if (and (consp x) (not (memq (car x) '(quote function cl-function))))
       (and (symbolp (car x))
-          (or (memq (car x) cl-simple-funcs)
+          (or (memq (car x) cl--simple-funcs)
               (get (car x) 'side-effect-free))
           (progn
             (setq size (1- size))
             (while (and (setq x (cdr x))
-                        (setq size (cl-simple-expr-p (car x) size))))
+                        (setq size (cl--simple-expr-p (car x) size))))
             (and (null x) (>= size 0) size)))
     (and (> size 0) (1- size))))
 
-(defun cl-simple-exprs-p (xs)
-  (while (and xs (cl-simple-expr-p (car xs)))
+(defun cl--simple-exprs-p (xs)
+  (while (and xs (cl--simple-expr-p (car xs)))
     (setq xs (cdr xs)))
   (not xs))
 
-;;; Check if no side effects.
-(defun cl-safe-expr-p (x)
-  (or (not (and (consp x) (not (memq (car x) '(quote function function*)))))
+(defun cl--safe-expr-p (x)
+  "Check if no side effects."
+  (or (not (and (consp x) (not (memq (car x) '(quote function cl-function)))))
       (and (symbolp (car x))
-          (or (memq (car x) cl-simple-funcs)
-              (memq (car x) cl-safe-funcs)
+          (or (memq (car x) cl--simple-funcs)
+              (memq (car x) cl--safe-funcs)
               (get (car x) 'side-effect-free))
           (progn
-            (while (and (setq x (cdr x)) (cl-safe-expr-p (car x))))
+            (while (and (setq x (cdr x)) (cl--safe-expr-p (car x))))
             (null x)))))
 
 ;;; Check if constant (i.e., no side effects or dependencies).
-(defun cl-const-expr-p (x)
+(defun cl--const-expr-p (x)
   (cond ((consp x)
         (or (eq (car x) 'quote)
-            (and (memq (car x) '(function function*))
+            (and (memq (car x) '(function cl-function))
                  (or (symbolp (nth 1 x))
                      (and (eq (car-safe (nth 1 x)) 'lambda) 'func)))))
        ((symbolp x) (and (memq x '(nil t)) t))
        (t t)))
 
-(defun cl-const-exprs-p (xs)
-  (while (and xs (cl-const-expr-p (car xs)))
-    (setq xs (cdr xs)))
-  (not xs))
+(defun cl--const-expr-val (x)
+  (and (macroexp-const-p x) (if (consp x) (nth 1 x) x)))
 
-(defun cl-const-expr-val (x)
-  (and (eq (cl-const-expr-p x) t) (if (consp x) (nth 1 x) x)))
-
-(defun cl-expr-access-order (x v)
-  ;; This apparently tries to return nil iff the expression X evaluates
-  ;; the variables V in the same order as they appear in V (so as to
-  ;; be able to replace those vars with the expressions they're bound
-  ;; to).
-  ;; FIXME: This is very naive, it doesn't even check to see if those
-  ;; variables appear more than once.
-  (if (cl-const-expr-p x) v
-    (if (consp x)
-       (progn
-         (while (setq x (cdr x)) (setq v (cl-expr-access-order (car x) v)))
-         v)
-      (if (eq x (car v)) (cdr v) '(t)))))
-
-;;; Count number of times X refers to Y.  Return nil for 0 times.
-(defun cl-expr-contains (x y)
+(defun cl--expr-contains (x y)
+  "Count number of times X refers to Y.  Return nil for 0 times."
+  ;; FIXME: This is naive, and it will cl-count Y as referred twice in
+  ;; (let ((Y 1)) Y) even though it should be 0.  Also it is often called on
+  ;; non-macroexpanded code, so it may also miss some occurrences that would
+  ;; only appear in the expanded code.
   (cond ((equal y x) 1)
-       ((and (consp x) (not (memq (car-safe x) '(quote function function*))))
+       ((and (consp x) (not (memq (car x) '(quote function cl-function))))
         (let ((sum 0))
-          (while x
-            (setq sum (+ sum (or (cl-expr-contains (pop x) y) 0))))
+          (while (consp x)
+            (setq sum (+ sum (or (cl--expr-contains (pop x) y) 0))))
+          (setq sum (+ sum (or (cl--expr-contains x y) 0)))
           (and (> sum 0) sum)))
        (t nil)))
 
-(defun cl-expr-contains-any (x y)
-  (while (and y (not (cl-expr-contains x (car y)))) (pop y))
+(defun cl--expr-contains-any (x y)
+  (while (and y (not (cl--expr-contains x (car y)))) (pop y))
   y)
 
-;;; Check whether X may depend on any of the symbols in Y.
-(defun cl-expr-depends-p (x y)
-  (and (not (cl-const-expr-p x))
-       (or (not (cl-safe-expr-p x)) (cl-expr-contains-any x y))))
+(defun cl--expr-depends-p (x y)
+  "Check whether X may depend on any of the symbols in Y."
+  (and (not (macroexp-const-p x))
+       (or (not (cl--safe-expr-p x)) (cl--expr-contains-any x y))))
 
 ;;; Symbols.
 
-(defvar *gensym-counter*)
+(defvar cl--gensym-counter)
 ;;;###autoload
-(defun gensym (&optional prefix)
+(defun cl-gensym (&optional prefix)
   "Generate a new uninterned symbol.
 The name is made by appending a number to PREFIX, default \"G\"."
   (let ((pfix (if (stringp prefix) prefix "G"))
        (num (if (integerp prefix) prefix
-              (prog1 *gensym-counter*
-                (setq *gensym-counter* (1+ *gensym-counter*))))))
+              (prog1 cl--gensym-counter
+                (setq cl--gensym-counter (1+ cl--gensym-counter))))))
     (make-symbol (format "%s%d" pfix num))))
 
 ;;;###autoload
-(defun gentemp (&optional prefix)
+(defun cl-gentemp (&optional prefix)
   "Generate a new interned symbol with a unique name.
 The name is made by appending a number to PREFIX, default \"G\"."
   (let ((pfix (if (stringp prefix) prefix "G"))
        name)
-    (while (intern-soft (setq name (format "%s%d" pfix *gensym-counter*)))
-      (setq *gensym-counter* (1+ *gensym-counter*)))
+    (while (intern-soft (setq name (format "%s%d" pfix cl--gensym-counter)))
+      (setq cl--gensym-counter (1+ cl--gensym-counter)))
     (intern name)))
 
 
 ;;; Program structure.
 
-;;;###autoload
-(defmacro defun* (name args &rest body)
-  "Define NAME as a function.
-Like normal `defun', except ARGLIST allows full Common Lisp conventions,
-and BODY is implicitly surrounded by (block NAME ...).
+(def-edebug-spec cl-declarations
+  (&rest ("cl-declare" &rest sexp)))
 
-\(fn NAME ARGLIST [DOCSTRING] BODY...)"
-  (let* ((res (cl-transform-lambda (cons args body) name))
-        (form (list* 'defun name (cdr res))))
-    (if (car res) (list 'progn (car res) form) form)))
+(def-edebug-spec cl-declarations-or-string
+  (&or stringp cl-declarations))
 
-;;;###autoload
-(defmacro defmacro* (name args &rest body)
-  "Define NAME as a macro.
-Like normal `defmacro', except ARGLIST allows full Common Lisp conventions,
-and BODY is implicitly surrounded by (block NAME ...).
+(def-edebug-spec cl-lambda-list
+  (([&rest arg]
+    [&optional ["&optional" cl-&optional-arg &rest cl-&optional-arg]]
+    [&optional ["&rest" arg]]
+    [&optional ["&key" [cl-&key-arg &rest cl-&key-arg]
+               &optional "&allow-other-keys"]]
+    [&optional ["&aux" &rest
+               &or (symbolp &optional def-form) symbolp]]
+    )))
 
-\(fn NAME ARGLIST [DOCSTRING] BODY...)"
-  (let* ((res (cl-transform-lambda (cons args body) name))
-        (form (list* 'defmacro name (cdr res))))
-    (if (car res) (list 'progn (car res) form) form)))
+(def-edebug-spec cl-&optional-arg
+  (&or (arg &optional def-form arg) arg))
 
-;;;###autoload
-(defmacro function* (func)
-  "Introduce a function.
-Like normal `function', except that if argument is a lambda form,
-its argument list allows full Common Lisp conventions."
-  (if (eq (car-safe func) 'lambda)
-      (let* ((res (cl-transform-lambda (cdr func) 'cl-none))
-            (form (list 'function (cons 'lambda (cdr res)))))
-       (if (car res) (list 'progn (car res) form) form))
-    (list 'function func)))
-
-(defun cl-transform-function-property (func prop form)
-  (let ((res (cl-transform-lambda form func)))
-    (append '(progn) (cdr (cdr (car res)))
-           (list (list 'put (list 'quote func) (list 'quote prop)
-                       (list 'function (cons 'lambda (cdr res))))))))
-
-(defconst lambda-list-keywords
-  '(&optional &rest &key &allow-other-keys &aux &whole &body &environment))
+(def-edebug-spec cl-&key-arg
+  (&or ([&or (symbolp arg) arg] &optional def-form arg) arg))
 
-(defvar cl-macro-environment nil
-  "Keep the list of currently active macros.
-It is a list of elements of the form either:
-- (SYMBOL . FUNCTION) where FUNCTION is the macro expansion function.
-- (SYMBOL-NAME . EXPANSION) where SYMBOL-NAME is the name of a symbol macro.")
-(defvar bind-block) (defvar bind-defs) (defvar bind-enquote)
-(defvar bind-inits) (defvar bind-lets) (defvar bind-forms)
+(defconst cl--lambda-list-keywords
+  '(&optional &rest &key &allow-other-keys &aux &whole &body &environment))
 
-(declare-function help-add-fundoc-usage "help-fns" (docstring arglist))
+(defvar cl--bind-block) (defvar cl--bind-defs) (defvar cl--bind-enquote)
+(defvar cl--bind-inits) (defvar cl--bind-lets) (defvar cl--bind-forms)
 
-(defun cl--make-usage-var (x)
-  "X can be a var or a (destructuring) lambda-list."
-  (cond
-   ((symbolp x) (make-symbol (upcase (symbol-name x))))
-   ((consp x) (cl--make-usage-args x))
-   (t x)))
-
-(defun cl--make-usage-args (arglist)
-  ;; `orig-args' can contain &cl-defs (an internal
-  ;; CL thingy I don't understand), so remove it.
-  (let ((x (memq '&cl-defs arglist)))
-    (when x (setq arglist (delq (car x) (remq (cadr x) arglist)))))
-  (let ((state nil))
-    (mapcar (lambda (x)
-              (cond
-               ((symbolp x)
-                (if (eq ?\& (aref (symbol-name x) 0))
-                    (setq state x)
-                  (make-symbol (upcase (symbol-name x)))))
-               ((not (consp x)) x)
-               ((memq state '(nil &rest)) (cl--make-usage-args x))
-               (t        ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR).
-                (list*
-                 (if (and (consp (car x)) (eq state '&key))
-                     (list (caar x) (cl--make-usage-var (nth 1 (car x))))
-                   (cl--make-usage-var (car x)))
-                 (nth 1 x)                          ;INITFORM.
-                 (cl--make-usage-args (nthcdr 2 x)) ;SVAR.
-                 ))))
-            arglist)))
-
-(defun cl-transform-lambda (form bind-block)
+(defun cl--transform-lambda (form bind-block)
   (let* ((args (car form)) (body (cdr form)) (orig-args args)
-        (bind-defs nil) (bind-enquote nil)
-        (bind-inits nil) (bind-lets nil) (bind-forms nil)
+        (cl--bind-block bind-block) (cl--bind-defs nil) (cl--bind-enquote nil)
+        (cl--bind-inits nil) (cl--bind-lets nil) (cl--bind-forms nil)
         (header nil) (simple-args nil))
     (while (or (stringp (car body))
-              (memq (car-safe (car body)) '(interactive declare)))
+              (memq (car-safe (car body)) '(interactive cl-declare)))
       (push (pop body) header))
-    (setq args (if (listp args) (copy-list args) (list '&rest args)))
+    (setq args (if (listp args) (cl-copy-list args) (list '&rest args)))
     (let ((p (last args))) (if (cdr p) (setcdr p (list '&rest (cdr p)))))
-    (if (setq bind-defs (cadr (memq '&cl-defs args)))
-       (setq args (delq '&cl-defs (delq bind-defs args))
-             bind-defs (cadr bind-defs)))
-    (if (setq bind-enquote (memq '&cl-quote args))
+    (if (setq cl--bind-defs (cadr (memq '&cl-defs args)))
+       (setq args (delq '&cl-defs (delq cl--bind-defs args))
+             cl--bind-defs (cadr cl--bind-defs)))
+    (if (setq cl--bind-enquote (memq '&cl-quote args))
        (setq args (delq '&cl-quote args)))
     (if (memq '&whole args) (error "&whole not currently implemented"))
-    (let* ((p (memq '&environment args)) (v (cadr p)))
+    (let* ((p (memq '&environment args)) (v (cadr p))
+           (env-exp 'macroexpand-all-environment))
       (if p (setq args (nconc (delq (car p) (delq v args))
-                             (list '&aux (list v 'cl-macro-environment))))))
+                              (list '&aux (list v env-exp))))))
     (while (and args (symbolp (car args))
                (not (memq (car args) '(nil &rest &body &key &aux)))
                (not (and (eq (car args) '&optional)
-                         (or bind-defs (consp (cadr args))))))
+                         (or cl--bind-defs (consp (cadr args))))))
       (push (pop args) simple-args))
-    (or (eq bind-block 'cl-none)
-       (setq body (list (list* 'block bind-block body))))
+    (or (eq cl--bind-block 'cl-none)
+       (setq body (list `(cl-block ,cl--bind-block ,@body))))
     (if (null args)
-       (list* nil (nreverse simple-args) (nconc (nreverse header) body))
+       (cl-list* nil (nreverse simple-args) (nconc (nreverse header) body))
       (if (memq '&optional simple-args) (push '&optional args))
-      (cl-do-arglist args nil (- (length simple-args)
-                                (if (memq '&optional simple-args) 1 0)))
-      (setq bind-lets (nreverse bind-lets))
-      (list* (and bind-inits (list* 'eval-when '(compile load eval)
-                                   (nreverse bind-inits)))
+      (cl--do-arglist args nil (- (length simple-args)
+                                  (if (memq '&optional simple-args) 1 0)))
+      (setq cl--bind-lets (nreverse cl--bind-lets))
+      (cl-list* (and cl--bind-inits `(cl-eval-when (compile load eval)
+                                ,@(nreverse cl--bind-inits)))
             (nconc (nreverse simple-args)
-                   (list '&rest (car (pop bind-lets))))
+                   (list '&rest (car (pop cl--bind-lets))))
             (nconc (let ((hdr (nreverse header)))
                       ;; Macro expansion can take place in the middle of
                       ;; apparently harmless computation, so it should not
@@ -317,233 +237,367 @@ It is a list of elements of the form either:
                                        (cons 'fn
                                              (cl--make-usage-args orig-args))))
                               hdr)))
-                   (list (nconc (list 'let* bind-lets)
-                                (nreverse bind-forms) body)))))))
+                   (list `(let* ,cl--bind-lets
+                             ,@(nreverse cl--bind-forms)
+                             ,@body)))))))
+
+;;;###autoload
+(defmacro cl-defun (name args &rest body)
+  "Define NAME as a function.
+Like normal `defun', except ARGLIST allows full Common Lisp conventions,
+and BODY is implicitly surrounded by (cl-block NAME ...).
+
+\(fn NAME ARGLIST [DOCSTRING] BODY...)"
+  (declare (debug
+            ;; Same as defun but use cl-lambda-list.
+            (&define [&or name ("setf" :name setf name)]
+                     cl-lambda-list
+                     cl-declarations-or-string
+                     [&optional ("interactive" interactive)]
+                     def-body))
+           (doc-string 3)
+           (indent 2))
+  (let* ((res (cl--transform-lambda (cons args body) name))
+        (form `(defun ,name ,@(cdr res))))
+    (if (car res) `(progn ,(car res) ,form) form)))
+
+;; The lambda list for macros is different from that of normal lambdas.
+;; Note that &environment is only allowed as first or last items in the
+;; top level list.
+
+(def-edebug-spec cl-macro-list
+  (([&optional "&environment" arg]
+    [&rest cl-macro-arg]
+    [&optional ["&optional" &rest
+               &or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
+    [&optional [[&or "&rest" "&body"] cl-macro-arg]]
+    [&optional ["&key" [&rest
+                       [&or ([&or (symbolp cl-macro-arg) arg]
+                             &optional def-form cl-macro-arg)
+                            arg]]
+               &optional "&allow-other-keys"]]
+    [&optional ["&aux" &rest
+               &or (symbolp &optional def-form) symbolp]]
+    [&optional "&environment" arg]
+    )))
+
+(def-edebug-spec cl-macro-arg
+  (&or arg cl-macro-list1))
+
+(def-edebug-spec cl-macro-list1
+  (([&optional "&whole" arg]  ;; only allowed at lower levels
+    [&rest cl-macro-arg]
+    [&optional ["&optional" &rest
+               &or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
+    [&optional [[&or "&rest" "&body"] cl-macro-arg]]
+    [&optional ["&key" [&rest
+                       [&or ([&or (symbolp cl-macro-arg) arg]
+                             &optional def-form cl-macro-arg)
+                            arg]]
+               &optional "&allow-other-keys"]]
+    [&optional ["&aux" &rest
+               &or (symbolp &optional def-form) symbolp]]
+    . [&or arg nil])))
+
+;;;###autoload
+(defmacro cl-defmacro (name args &rest body)
+  "Define NAME as a macro.
+Like normal `defmacro', except ARGLIST allows full Common Lisp conventions,
+and BODY is implicitly surrounded by (cl-block NAME ...).
+
+\(fn NAME ARGLIST [DOCSTRING] BODY...)"
+  (declare (debug
+            (&define name cl-macro-list cl-declarations-or-string def-body))
+           (doc-string 3)
+           (indent 2))
+  (let* ((res (cl--transform-lambda (cons args body) name))
+        (form `(defmacro ,name ,@(cdr res))))
+    (if (car res) `(progn ,(car res) ,form) form)))
+
+(def-edebug-spec cl-lambda-expr
+  (&define ("lambda" cl-lambda-list
+           ;;cl-declarations-or-string
+           ;;[&optional ("interactive" interactive)]
+           def-body)))
+
+;; Redefine function-form to also match cl-function
+(def-edebug-spec function-form
+  ;; form at the end could also handle "function",
+  ;; but recognize it specially to avoid wrapping function forms.
+  (&or ([&or "quote" "function"] &or symbolp lambda-expr)
+       ("cl-function" cl-function)
+       form))
+
+;;;###autoload
+(defmacro cl-function (func)
+  "Introduce a function.
+Like normal `function', except that if argument is a lambda form,
+its argument list allows full Common Lisp conventions."
+  (declare (debug (&or symbolp cl-lambda-expr)))
+  (if (eq (car-safe func) 'lambda)
+      (let* ((res (cl--transform-lambda (cdr func) 'cl-none))
+            (form `(function (lambda . ,(cdr res)))))
+       (if (car res) `(progn ,(car res) ,form) form))
+    `(function ,func)))
+
+(declare-function help-add-fundoc-usage "help-fns" (docstring arglist))
+
+(defun cl--make-usage-var (x)
+  "X can be a var or a (destructuring) lambda-list."
+  (cond
+   ((symbolp x) (make-symbol (upcase (symbol-name x))))
+   ((consp x) (cl--make-usage-args x))
+   (t x)))
 
-(defun cl-do-arglist (args expr &optional num)   ; uses bind-*
+(defun cl--make-usage-args (arglist)
+  (if (cdr-safe (last arglist))         ;Not a proper list.
+      (let* ((last (last arglist))
+             (tail (cdr last)))
+        (unwind-protect
+            (progn
+              (setcdr last nil)
+              (nconc (cl--make-usage-args arglist) (cl--make-usage-var tail)))
+          (setcdr last tail)))
+    ;; `orig-args' can contain &cl-defs (an internal
+    ;; CL thingy I don't understand), so remove it.
+    (let ((x (memq '&cl-defs arglist)))
+      (when x (setq arglist (delq (car x) (remq (cadr x) arglist)))))
+    (let ((state nil))
+      (mapcar (lambda (x)
+                (cond
+                 ((symbolp x)
+                  (if (eq ?\& (aref (symbol-name x) 0))
+                      (setq state x)
+                    (make-symbol (upcase (symbol-name x)))))
+                 ((not (consp x)) x)
+                 ((memq state '(nil &rest)) (cl--make-usage-args x))
+                 (t      ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR).
+                  (cl-list*
+                   (if (and (consp (car x)) (eq state '&key))
+                       (list (caar x) (cl--make-usage-var (nth 1 (car x))))
+                     (cl--make-usage-var (car x)))
+                   (nth 1 x)                        ;INITFORM.
+                   (cl--make-usage-args (nthcdr 2 x)) ;SVAR.
+                   ))))
+              arglist))))
+
+(defun cl--do-arglist (args expr &optional num)   ; uses bind-*
   (if (nlistp args)
-      (if (or (memq args lambda-list-keywords) (not (symbolp args)))
+      (if (or (memq args cl--lambda-list-keywords) (not (symbolp args)))
          (error "Invalid argument name: %s" args)
-       (push (list args expr) bind-lets))
-    (setq args (copy-list args))
+       (push (list args expr) cl--bind-lets))
+    (setq args (cl-copy-list args))
     (let ((p (last args))) (if (cdr p) (setcdr p (list '&rest (cdr p)))))
     (let ((p (memq '&body args))) (if p (setcar p '&rest)))
     (if (memq '&environment args) (error "&environment used incorrectly"))
     (let ((save-args args)
          (restarg (memq '&rest args))
-         (safety (if (cl-compiling-file) cl-optimize-safety 3))
+         (safety (if (cl--compiling-file) cl-optimize-safety 3))
          (keys nil)
          (laterarg nil) (exactarg nil) minarg)
       (or num (setq num 0))
       (if (listp (cadr restarg))
          (setq restarg (make-symbol "--cl-rest--"))
        (setq restarg (cadr restarg)))
-      (push (list restarg expr) bind-lets)
+      (push (list restarg expr) cl--bind-lets)
       (if (eq (car args) '&whole)
-         (push (list (cl-pop2 args) restarg) bind-lets))
+         (push (list (cl-pop2 args) restarg) cl--bind-lets))
       (let ((p args))
        (setq minarg restarg)
-       (while (and p (not (memq (car p) lambda-list-keywords)))
+       (while (and p (not (memq (car p) cl--lambda-list-keywords)))
          (or (eq p args) (setq minarg (list 'cdr minarg)))
          (setq p (cdr p)))
        (if (memq (car p) '(nil &aux))
-           (setq minarg (list '= (list 'length restarg)
-                              (length (ldiff args p)))
+           (setq minarg `(= (length ,restarg)
+                             ,(length (cl-ldiff args p)))
                  exactarg (not (eq args p)))))
-      (while (and args (not (memq (car args) lambda-list-keywords)))
+      (while (and args (not (memq (car args) cl--lambda-list-keywords)))
        (let ((poparg (list (if (or (cdr args) (not exactarg)) 'pop 'car)
                            restarg)))
-         (cl-do-arglist
+         (cl--do-arglist
           (pop args)
           (if (or laterarg (= safety 0)) poparg
-            (list 'if minarg poparg
-                  (list 'signal '(quote wrong-number-of-arguments)
-                        (list 'list (and (not (eq bind-block 'cl-none))
-                                         (list 'quote bind-block))
-                              (list 'length restarg)))))))
+            `(if ,minarg ,poparg
+                (signal 'wrong-number-of-arguments
+                        (list ,(and (not (eq cl--bind-block 'cl-none))
+                                    `',cl--bind-block)
+                              (length ,restarg)))))))
        (setq num (1+ num) laterarg t))
       (while (and (eq (car args) '&optional) (pop args))
-       (while (and args (not (memq (car args) lambda-list-keywords)))
+       (while (and args (not (memq (car args) cl--lambda-list-keywords)))
          (let ((arg (pop args)))
            (or (consp arg) (setq arg (list arg)))
-           (if (cddr arg) (cl-do-arglist (nth 2 arg) (list 'and restarg t)))
+           (if (cddr arg) (cl--do-arglist (nth 2 arg) `(and ,restarg t)))
            (let ((def (if (cdr arg) (nth 1 arg)
-                        (or (car bind-defs)
-                            (nth 1 (assq (car arg) bind-defs)))))
-                 (poparg (list 'pop restarg)))
-             (and def bind-enquote (setq def (list 'quote def)))
-             (cl-do-arglist (car arg)
-                            (if def (list 'if restarg poparg def) poparg))
+                        (or (car cl--bind-defs)
+                            (nth 1 (assq (car arg) cl--bind-defs)))))
+                 (poparg `(pop ,restarg)))
+             (and def cl--bind-enquote (setq def `',def))
+             (cl--do-arglist (car arg)
+                            (if def `(if ,restarg ,poparg ,def) poparg))
              (setq num (1+ num))))))
       (if (eq (car args) '&rest)
          (let ((arg (cl-pop2 args)))
-           (if (consp arg) (cl-do-arglist arg restarg)))
+           (if (consp arg) (cl--do-arglist arg restarg)))
        (or (eq (car args) '&key) (= safety 0) exactarg
-           (push (list 'if restarg
-                          (list 'signal '(quote wrong-number-of-arguments)
-                                (list 'list
-                                      (and (not (eq bind-block 'cl-none))
-                                           (list 'quote bind-block))
-                                      (list '+ num (list 'length restarg)))))
-                    bind-forms)))
+           (push `(if ,restarg
+                       (signal 'wrong-number-of-arguments
+                               (list
+                                ,(and (not (eq cl--bind-block 'cl-none))
+                                      `',cl--bind-block)
+                                (+ ,num (length ,restarg)))))
+                  cl--bind-forms)))
       (while (and (eq (car args) '&key) (pop args))
-       (while (and args (not (memq (car args) lambda-list-keywords)))
+       (while (and args (not (memq (car args) cl--lambda-list-keywords)))
          (let ((arg (pop args)))
            (or (consp arg) (setq arg (list arg)))
            (let* ((karg (if (consp (car arg)) (caar arg)
                           (intern (format ":%s" (car arg)))))
-                  (varg (if (consp (car arg)) (cadar arg) (car arg)))
+                  (varg (if (consp (car arg)) (cl-cadar arg) (car arg)))
                   (def (if (cdr arg) (cadr arg)
-                         (or (car bind-defs) (cadr (assq varg bind-defs)))))
-                  (look (list 'memq (list 'quote karg) restarg)))
-             (and def bind-enquote (setq def (list 'quote def)))
+                         (or (car cl--bind-defs) (cadr (assq varg cl--bind-defs)))))
+                  (look `(memq ',karg ,restarg)))
+             (and def cl--bind-enquote (setq def `',def))
              (if (cddr arg)
                  (let* ((temp (or (nth 2 arg) (make-symbol "--cl-var--")))
-                        (val (list 'car (list 'cdr temp))))
-                   (cl-do-arglist temp look)
-                   (cl-do-arglist varg
-                                  (list 'if temp
-                                        (list 'prog1 val (list 'setq temp t))
-                                        def)))
-               (cl-do-arglist
+                        (val `(car (cdr ,temp))))
+                   (cl--do-arglist temp look)
+                   (cl--do-arglist varg
+                                  `(if ,temp
+                                        (prog1 ,val (setq ,temp t))
+                                      ,def)))
+               (cl--do-arglist
                 varg
-                (list 'car
-                      (list 'cdr
-                            (if (null def)
+                `(car (cdr ,(if (null def)
                                 look
-                              (list 'or look
-                                    (if (eq (cl-const-expr-p def) t)
-                                        (list
-                                         'quote
-                                         (list nil (cl-const-expr-val def)))
-                                      (list 'list nil def))))))))
+                              `(or ,look
+                                    ,(if (eq (cl--const-expr-p def) t)
+                                        `'(nil ,(cl--const-expr-val def))
+                                      `(list nil ,def))))))))
              (push karg keys)))))
       (setq keys (nreverse keys))
       (or (and (eq (car args) '&allow-other-keys) (pop args))
          (null keys) (= safety 0)
          (let* ((var (make-symbol "--cl-keys--"))
                 (allow '(:allow-other-keys))
-                (check (list
-                        'while var
-                        (list
-                         'cond
-                         (list (list 'memq (list 'car var)
-                                     (list 'quote (append keys allow)))
-                               (list 'setq var (list 'cdr (list 'cdr var))))
-                         (list (list 'car
-                                     (list 'cdr
-                                           (list 'memq (cons 'quote allow)
-                                                 restarg)))
-                               (list 'setq var nil))
-                         (list t
-                               (list
-                                'error
-                                (format "Keyword argument %%s not one of %s"
-                                        keys)
-                                (list 'car var)))))))
-           (push (list 'let (list (list var restarg)) check) bind-forms)))
+                (check `(while ,var
+                           (cond
+                            ((memq (car ,var) ',(append keys allow))
+                             (setq ,var (cdr (cdr ,var))))
+                            ((car (cdr (memq (quote ,@allow) ,restarg)))
+                             (setq ,var nil))
+                            (t
+                             (error
+                              ,(format "Keyword argument %%s not one of %s"
+                                       keys)
+                              (car ,var)))))))
+           (push `(let ((,var ,restarg)) ,check) cl--bind-forms)))
       (while (and (eq (car args) '&aux) (pop args))
-       (while (and args (not (memq (car args) lambda-list-keywords)))
+       (while (and args (not (memq (car args) cl--lambda-list-keywords)))
          (if (consp (car args))
-             (if (and bind-enquote (cadar args))
-                 (cl-do-arglist (caar args)
-                                (list 'quote (cadr (pop args))))
-               (cl-do-arglist (caar args) (cadr (pop args))))
-           (cl-do-arglist (pop args) nil))))
+             (if (and cl--bind-enquote (cl-cadar args))
+                 (cl--do-arglist (caar args)
+                                `',(cadr (pop args)))
+               (cl--do-arglist (caar args) (cadr (pop args))))
+           (cl--do-arglist (pop args) nil))))
       (if args (error "Malformed argument list %s" save-args)))))
 
-(defun cl-arglist-args (args)
+(defun cl--arglist-args (args)
   (if (nlistp args) (list args)
     (let ((res nil) (kind nil) arg)
       (while (consp args)
        (setq arg (pop args))
-       (if (memq arg lambda-list-keywords) (setq kind arg)
+       (if (memq arg cl--lambda-list-keywords) (setq kind arg)
          (if (eq arg '&cl-defs) (pop args)
            (and (consp arg) kind (setq arg (car arg)))
            (and (consp arg) (cdr arg) (eq kind '&key) (setq arg (cadr arg)))
-           (setq res (nconc res (cl-arglist-args arg))))))
+           (setq res (nconc res (cl--arglist-args arg))))))
       (nconc res (and args (list args))))))
 
 ;;;###autoload
-(defmacro destructuring-bind (args expr &rest body)
-  (let* ((bind-lets nil) (bind-forms nil) (bind-inits nil)
-        (bind-defs nil) (bind-block 'cl-none) (bind-enquote nil))
-    (cl-do-arglist (or args '(&aux)) expr)
-    (append '(progn) bind-inits
-           (list (nconc (list 'let* (nreverse bind-lets))
-                        (nreverse bind-forms) body)))))
+(defmacro cl-destructuring-bind (args expr &rest body)
+  (declare (indent 2)
+           (debug (&define cl-macro-list def-form cl-declarations def-body)))
+  (let* ((cl--bind-lets nil) (cl--bind-forms nil) (cl--bind-inits nil)
+        (cl--bind-defs nil) (cl--bind-block 'cl-none) (cl--bind-enquote nil))
+    (cl--do-arglist (or args '(&aux)) expr)
+    (append '(progn) cl--bind-inits
+           (list `(let* ,(nreverse cl--bind-lets)
+                     ,@(nreverse cl--bind-forms) ,@body)))))
 
 
-;;; The `eval-when' form.
+;;; The `cl-eval-when' form.
 
 (defvar cl-not-toplevel nil)
 
 ;;;###autoload
-(defmacro eval-when (when &rest body)
+(defmacro cl-eval-when (when &rest body)
   "Control when BODY is evaluated.
 If `compile' is in WHEN, BODY is evaluated when compiled at top-level.
 If `load' is in WHEN, BODY is evaluated when loaded after top-level compile.
 If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level.
 
 \(fn (WHEN...) BODY...)"
-  (if (and (fboundp 'cl-compiling-file) (cl-compiling-file)
+  (declare (indent 1) (debug ((&rest &or "compile" "load" "eval") body)))
+  (if (and (fboundp 'cl--compiling-file) (cl--compiling-file)
           (not cl-not-toplevel) (not (boundp 'for-effect)))  ; horrible kludge
       (let ((comp (or (memq 'compile when) (memq :compile-toplevel when)))
            (cl-not-toplevel t))
        (if (or (memq 'load when) (memq :load-toplevel when))
-           (if comp (cons 'progn (mapcar 'cl-compile-time-too body))
-             (list* 'if nil nil body))
+           (if comp (cons 'progn (mapcar 'cl--compile-time-too body))
+             `(if nil nil ,@body))
          (progn (if comp (eval (cons 'progn body))) nil)))
     (and (or (memq 'eval when) (memq :execute when))
         (cons 'progn body))))
 
-(defun cl-compile-time-too (form)
+(defun cl--compile-time-too (form)
   (or (and (symbolp (car-safe form)) (get (car-safe form) 'byte-hunk-handler))
       (setq form (macroexpand
-                 form (cons '(eval-when) byte-compile-macro-environment))))
+                 form (cons '(cl-eval-when) byte-compile-macro-environment))))
   (cond ((eq (car-safe form) 'progn)
-        (cons 'progn (mapcar 'cl-compile-time-too (cdr form))))
-       ((eq (car-safe form) 'eval-when)
+        (cons 'progn (mapcar 'cl--compile-time-too (cdr form))))
+       ((eq (car-safe form) 'cl-eval-when)
         (let ((when (nth 1 form)))
           (if (or (memq 'eval when) (memq :execute when))
-              (list* 'eval-when (cons 'compile when) (cddr form))
+              `(cl-eval-when (compile ,@when) ,@(cddr form))
             form)))
        (t (eval form) form)))
 
 ;;;###autoload
-(defmacro load-time-value (form &optional read-only)
+(defmacro cl-load-time-value (form &optional _read-only)
   "Like `progn', but evaluates the body at load time.
 The result of the body appears to the compiler as a quoted constant."
-  (if (cl-compiling-file)
-      (let* ((temp (gentemp "--cl-load-time--"))
-            (set (list 'set (list 'quote temp) form)))
+  (declare (debug (form &optional sexp)))
+  (if (cl--compiling-file)
+      (let* ((temp (cl-gentemp "--cl-load-time--"))
+            (set `(set ',temp ,form)))
        (if (and (fboundp 'byte-compile-file-form-defmumble)
                 (boundp 'this-kind) (boundp 'that-one))
            (fset 'byte-compile-file-form
-                 (list 'lambda '(form)
-                       (list 'fset '(quote byte-compile-file-form)
-                             (list 'quote
-                                   (symbol-function 'byte-compile-file-form)))
-                       (list 'byte-compile-file-form (list 'quote set))
-                       '(byte-compile-file-form form)))
+                 `(lambda (form)
+                     (fset 'byte-compile-file-form
+                           ',(symbol-function 'byte-compile-file-form))
+                     (byte-compile-file-form ',set)
+                     (byte-compile-file-form form)))
          (print set (symbol-value 'byte-compile--outbuffer)))
-       (list 'symbol-value (list 'quote temp)))
-    (list 'quote (eval form))))
+       `(symbol-value ',temp))
+    `',(eval form)))
 
 
 ;;; Conditional control structures.
 
 ;;;###autoload
-(defmacro case (expr &rest clauses)
+(defmacro cl-case (expr &rest clauses)
   "Eval EXPR and choose among clauses on that value.
 Each clause looks like (KEYLIST BODY...).  EXPR is evaluated and compared
 against each key in each KEYLIST; the corresponding BODY is evaluated.
-If no clause succeeds, case returns nil.  A single atom may be used in
+If no clause succeeds, cl-case returns nil.  A single atom may be used in
 place of a KEYLIST of one atom.  A KEYLIST of t or `otherwise' is
 allowed only in the final clause, and matches if no other keys match.
 Key values are compared by `eql'.
 \n(fn EXPR (KEYLIST BODY...)...)"
-  (let* ((temp (if (cl-simple-expr-p expr 3) expr (make-symbol "--cl-var--")))
+  (declare (indent 1) (debug (form &rest (sexp body))))
+  (let* ((temp (if (cl--simple-expr-p expr 3) expr (make-symbol "--cl-var--")))
         (head-list nil)
         (body (cons
                'cond
@@ -551,39 +605,42 @@ Key values are compared by `eql'.
                 (function
                  (lambda (c)
                    (cons (cond ((memq (car c) '(t otherwise)) t)
-                               ((eq (car c) 'ecase-error-flag)
-                                (list 'error "ecase failed: %s, %s"
-                                      temp (list 'quote (reverse head-list))))
+                               ((eq (car c) 'cl--ecase-error-flag)
+                                `(error "cl-ecase failed: %s, %s"
+                                         ,temp ',(reverse head-list)))
                                ((listp (car c))
                                 (setq head-list (append (car c) head-list))
-                                (list 'member* temp (list 'quote (car c))))
+                                `(cl-member ,temp ',(car c)))
                                (t
                                 (if (memq (car c) head-list)
                                     (error "Duplicate key in case: %s"
                                            (car c)))
                                 (push (car c) head-list)
-                                (list 'eql temp (list 'quote (car c)))))
+                                `(eql ,temp ',(car c))))
                          (or (cdr c) '(nil)))))
                 clauses))))
     (if (eq temp expr) body
-      (list 'let (list (list temp expr)) body))))
+      `(let ((,temp ,expr)) ,body))))
 
 ;;;###autoload
-(defmacro ecase (expr &rest clauses)
-  "Like `case', but error if no case fits.
+(defmacro cl-ecase (expr &rest clauses)
+  "Like `cl-case', but error if no case fits.
 `otherwise'-clauses are not allowed.
 \n(fn EXPR (KEYLIST BODY...)...)"
-  (list* 'case expr (append clauses '((ecase-error-flag)))))
+  (declare (indent 1) (debug cl-case))
+  `(cl-case ,expr ,@clauses (cl--ecase-error-flag)))
 
 ;;;###autoload
-(defmacro typecase (expr &rest clauses)
+(defmacro cl-typecase (expr &rest clauses)
   "Evals EXPR, chooses among clauses on that value.
 Each clause looks like (TYPE BODY...).  EXPR is evaluated and, if it
 satisfies TYPE, the corresponding BODY is evaluated.  If no clause succeeds,
-typecase returns nil.  A TYPE of t or `otherwise' is allowed only in the
+cl-typecase returns nil.  A TYPE of t or `otherwise' is allowed only in the
 final clause, and matches if no other keys match.
 \n(fn EXPR (TYPE BODY...)...)"
-  (let* ((temp (if (cl-simple-expr-p expr 3) expr (make-symbol "--cl-var--")))
+  (declare (indent 1)
+           (debug (form &rest ([&or cl-type-spec "otherwise"] body))))
+  (let* ((temp (if (cl--simple-expr-p expr 3) expr (make-symbol "--cl-var--")))
         (type-list nil)
         (body (cons
                'cond
@@ -591,71 +648,76 @@ final clause, and matches if no other keys match.
                 (function
                  (lambda (c)
                    (cons (cond ((eq (car c) 'otherwise) t)
-                               ((eq (car c) 'ecase-error-flag)
-                                (list 'error "etypecase failed: %s, %s"
-                                      temp (list 'quote (reverse type-list))))
+                               ((eq (car c) 'cl--ecase-error-flag)
+                                `(error "cl-etypecase failed: %s, %s"
+                                         ,temp ',(reverse type-list)))
                                (t
                                 (push (car c) type-list)
-                                (cl-make-type-test temp (car c))))
+                                (cl--make-type-test temp (car c))))
                          (or (cdr c) '(nil)))))
                 clauses))))
     (if (eq temp expr) body
-      (list 'let (list (list temp expr)) body))))
+      `(let ((,temp ,expr)) ,body))))
 
 ;;;###autoload
-(defmacro etypecase (expr &rest clauses)
-  "Like `typecase', but error if no case fits.
+(defmacro cl-etypecase (expr &rest clauses)
+  "Like `cl-typecase', but error if no case fits.
 `otherwise'-clauses are not allowed.
 \n(fn EXPR (TYPE BODY...)...)"
-  (list* 'typecase expr (append clauses '((ecase-error-flag)))))
+  (declare (indent 1) (debug cl-typecase))
+  `(cl-typecase ,expr ,@clauses (cl--ecase-error-flag)))
 
 
 ;;; Blocks and exits.
 
 ;;;###autoload
-(defmacro block (name &rest body)
+(defmacro cl-block (name &rest body)
   "Define a lexically-scoped block named NAME.
-NAME may be any symbol.  Code inside the BODY forms can call `return-from'
+NAME may be any symbol.  Code inside the BODY forms can call `cl-return-from'
 to jump prematurely out of the block.  This differs from `catch' and `throw'
 in two respects:  First, the NAME is an unevaluated symbol rather than a
 quoted symbol or other form; and second, NAME is lexically rather than
 dynamically scoped:  Only references to it within BODY will work.  These
 references may appear inside macro expansions, but not inside functions
 called from BODY."
-  (if (cl-safe-expr-p (cons 'progn body)) (cons 'progn body)
-    (list 'cl-block-wrapper
-         (list* 'catch (list 'quote (intern (format "--cl-block-%s--" name)))
-                body))))
+  (declare (indent 1) (debug (symbolp body)))
+  (if (cl--safe-expr-p `(progn ,@body)) `(progn ,@body)
+    `(cl--block-wrapper
+      (catch ',(intern (format "--cl-block-%s--" name))
+        ,@body))))
 
 ;;;###autoload
-(defmacro return (&optional result)
+(defmacro cl-return (&optional result)
   "Return from the block named nil.
-This is equivalent to `(return-from nil RESULT)'."
-  (list 'return-from nil result))
+This is equivalent to `(cl-return-from nil RESULT)'."
+  (declare (debug (&optional form)))
+  `(cl-return-from nil ,result))
 
 ;;;###autoload
-(defmacro return-from (name &optional result)
+(defmacro cl-return-from (name &optional result)
   "Return from the block named NAME.
-This jumps out to the innermost enclosing `(block NAME ...)' form,
+This jumps out to the innermost enclosing `(cl-block NAME ...)' form,
 returning RESULT from that form (or nil if RESULT is omitted).
 This is compatible with Common Lisp, but note that `defun' and
 `defmacro' do not create implicit blocks as they do in Common Lisp."
+  (declare (indent 1) (debug (symbolp &optional form)))
   (let ((name2 (intern (format "--cl-block-%s--" name))))
-    (list 'cl-block-throw (list 'quote name2) result)))
+    `(cl--block-throw ',name2 ,result)))
 
 
-;;; The "loop" macro.
+;;; The "cl-loop" macro.
 
-(defvar loop-args) (defvar loop-accum-var) (defvar loop-accum-vars)
-(defvar loop-bindings) (defvar loop-body) (defvar loop-destr-temps)
-(defvar loop-finally) (defvar loop-finish-flag) (defvar loop-first-flag)
-(defvar loop-initially) (defvar loop-map-form) (defvar loop-name)
-(defvar loop-result) (defvar loop-result-explicit)
-(defvar loop-result-var) (defvar loop-steps) (defvar loop-symbol-macs)
+(defvar cl--loop-args) (defvar cl--loop-accum-var) (defvar cl--loop-accum-vars)
+(defvar cl--loop-bindings) (defvar cl--loop-body) (defvar cl--loop-destr-temps)
+(defvar cl--loop-finally) (defvar cl--loop-finish-flag)
+(defvar cl--loop-first-flag)
+(defvar cl--loop-initially) (defvar cl--loop-map-form) (defvar cl--loop-name)
+(defvar cl--loop-result) (defvar cl--loop-result-explicit)
+(defvar cl--loop-result-var) (defvar cl--loop-steps) (defvar cl--loop-symbol-macs)
 
 ;;;###autoload
-(defmacro loop (&rest loop-args)
-  "The Common Lisp `loop' macro.
+(defmacro cl-loop (&rest loop-args)
+  "The Common Lisp `cl-loop' macro.
 Valid clauses are:
   for VAR from/upfrom/downfrom NUM to/upto/downto/above/below NUM by NUM,
   for VAR in LIST by FUNC, for VAR on LIST by FUNC, for VAR = INIT then EXPR,
@@ -669,119 +731,272 @@ Valid clauses are:
   finally return EXPR, named NAME.
 
 \(fn CLAUSE...)"
-  (if (not (memq t (mapcar 'symbolp (delq nil (delq t (copy-list loop-args))))))
-      (list 'block nil (list* 'while t loop-args))
-    (let ((loop-name nil)      (loop-bindings nil)
-         (loop-body nil)       (loop-steps nil)
-         (loop-result nil)     (loop-result-explicit nil)
-         (loop-result-var nil) (loop-finish-flag nil)
-         (loop-accum-var nil)  (loop-accum-vars nil)
-         (loop-initially nil)  (loop-finally nil)
-         (loop-map-form nil)   (loop-first-flag nil)
-         (loop-destr-temps nil) (loop-symbol-macs nil))
-      (setq loop-args (append loop-args '(cl-end-loop)))
-      (while (not (eq (car loop-args) 'cl-end-loop)) (cl-parse-loop-clause))
-      (if loop-finish-flag
-         (push `((,loop-finish-flag t)) loop-bindings))
-      (if loop-first-flag
-         (progn (push `((,loop-first-flag t)) loop-bindings)
-                (push `(setq ,loop-first-flag nil) loop-steps)))
-      (let* ((epilogue (nconc (nreverse loop-finally)
-                             (list (or loop-result-explicit loop-result))))
-            (ands (cl-loop-build-ands (nreverse loop-body)))
-            (while-body (nconc (cadr ands) (nreverse loop-steps)))
+  (declare (debug (&rest &or symbolp form)))
+  (if (not (memq t (mapcar 'symbolp (delq nil (delq t (cl-copy-list loop-args))))))
+      `(cl-block nil (while t ,@loop-args))
+    (let ((cl--loop-args loop-args) (cl--loop-name nil) (cl--loop-bindings nil)
+         (cl--loop-body nil)   (cl--loop-steps nil)
+         (cl--loop-result nil) (cl--loop-result-explicit nil)
+         (cl--loop-result-var nil) (cl--loop-finish-flag nil)
+         (cl--loop-accum-var nil)      (cl--loop-accum-vars nil)
+         (cl--loop-initially nil)      (cl--loop-finally nil)
+         (cl--loop-map-form nil)   (cl--loop-first-flag nil)
+         (cl--loop-destr-temps nil) (cl--loop-symbol-macs nil))
+      (setq cl--loop-args (append cl--loop-args '(cl-end-loop)))
+      (while (not (eq (car cl--loop-args) 'cl-end-loop)) (cl-parse-loop-clause))
+      (if cl--loop-finish-flag
+         (push `((,cl--loop-finish-flag t)) cl--loop-bindings))
+      (if cl--loop-first-flag
+         (progn (push `((,cl--loop-first-flag t)) cl--loop-bindings)
+                (push `(setq ,cl--loop-first-flag nil) cl--loop-steps)))
+      (let* ((epilogue (nconc (nreverse cl--loop-finally)
+                             (list (or cl--loop-result-explicit cl--loop-result))))
+            (ands (cl--loop-build-ands (nreverse cl--loop-body)))
+            (while-body (nconc (cadr ands) (nreverse cl--loop-steps)))
             (body (append
-                   (nreverse loop-initially)
-                   (list (if loop-map-form
-                             (list 'block '--cl-finish--
-                                   (subst
-                                    (if (eq (car ands) t) while-body
-                                      (cons `(or ,(car ands)
-                                                 (return-from --cl-finish--
-                                                   nil))
-                                            while-body))
-                                    '--cl-map loop-map-form))
-                           (list* 'while (car ands) while-body)))
-                   (if loop-finish-flag
-                       (if (equal epilogue '(nil)) (list loop-result-var)
-                         `((if ,loop-finish-flag
-                               (progn ,@epilogue) ,loop-result-var)))
+                   (nreverse cl--loop-initially)
+                   (list (if cl--loop-map-form
+                             `(cl-block --cl-finish--
+                                 ,(cl-subst
+                                   (if (eq (car ands) t) while-body
+                                     (cons `(or ,(car ands)
+                                                (cl-return-from --cl-finish--
+                                                  nil))
+                                           while-body))
+                                   '--cl-map cl--loop-map-form))
+                           `(while ,(car ands) ,@while-body)))
+                   (if cl--loop-finish-flag
+                       (if (equal epilogue '(nil)) (list cl--loop-result-var)
+                         `((if ,cl--loop-finish-flag
+                               (progn ,@epilogue) ,cl--loop-result-var)))
                      epilogue))))
-       (if loop-result-var (push (list loop-result-var) loop-bindings))
-       (while loop-bindings
-         (if (cdar loop-bindings)
-             (setq body (list (cl-loop-let (pop loop-bindings) body t)))
+       (if cl--loop-result-var (push (list cl--loop-result-var) cl--loop-bindings))
+       (while cl--loop-bindings
+         (if (cdar cl--loop-bindings)
+             (setq body (list (cl--loop-let (pop cl--loop-bindings) body t)))
            (let ((lets nil))
-             (while (and loop-bindings
-                         (not (cdar loop-bindings)))
-               (push (car (pop loop-bindings)) lets))
-             (setq body (list (cl-loop-let lets body nil))))))
-       (if loop-symbol-macs
-           (setq body (list (list* 'symbol-macrolet loop-symbol-macs body))))
-       (list* 'block loop-name body)))))
+             (while (and cl--loop-bindings
+                         (not (cdar cl--loop-bindings)))
+               (push (car (pop cl--loop-bindings)) lets))
+             (setq body (list (cl--loop-let lets body nil))))))
+       (if cl--loop-symbol-macs
+           (setq body (list `(cl-symbol-macrolet ,cl--loop-symbol-macs ,@body))))
+       `(cl-block ,cl--loop-name ,@body)))))
+
+;; Below is a complete spec for cl-loop, in several parts that correspond
+;; to the syntax given in CLtL2.  The specs do more than specify where
+;; the forms are; it also specifies, as much as Edebug allows, all the
+;; syntactically valid cl-loop clauses.  The disadvantage of this
+;; completeness is rigidity, but the "for ... being" clause allows
+;; arbitrary extensions of the form: [symbolp &rest &or symbolp form].
+
+;; (def-edebug-spec cl-loop
+;;   ([&optional ["named" symbolp]]
+;;    [&rest
+;;     &or
+;;     ["repeat" form]
+;;     loop-for-as
+;;     loop-with
+;;     loop-initial-final]
+;;    [&rest loop-clause]
+;;    ))
+
+;; (def-edebug-spec loop-with
+;;   ("with" loop-var
+;;    loop-type-spec
+;;    [&optional ["=" form]]
+;;    &rest ["and" loop-var
+;;       loop-type-spec
+;;       [&optional ["=" form]]]))
+
+;; (def-edebug-spec loop-for-as
+;;   ([&or "for" "as"] loop-for-as-subclause
+;;    &rest ["and" loop-for-as-subclause]))
+
+;; (def-edebug-spec loop-for-as-subclause
+;;   (loop-var
+;;    loop-type-spec
+;;    &or
+;;    [[&or "in" "on" "in-ref" "across-ref"]
+;;     form &optional ["by" function-form]]
+
+;;    ["=" form &optional ["then" form]]
+;;    ["across" form]
+;;    ["being"
+;;     [&or "the" "each"]
+;;     &or
+;;     [[&or "element" "elements"]
+;;      [&or "of" "in" "of-ref"] form
+;;      &optional "using" ["index" symbolp]];; is this right?
+;;     [[&or "hash-key" "hash-keys"
+;;       "hash-value" "hash-values"]
+;;      [&or "of" "in"]
+;;      hash-table-p &optional ["using" ([&or "hash-value" "hash-values"
+;;                                        "hash-key" "hash-keys"] sexp)]]
+
+;;     [[&or "symbol" "present-symbol" "external-symbol"
+;;       "symbols" "present-symbols" "external-symbols"]
+;;      [&or "in" "of"] package-p]
+
+;;     ;; Extensions for Emacs Lisp, including Lucid Emacs.
+;;     [[&or "frame" "frames"
+;;       "screen" "screens"
+;;       "buffer" "buffers"]]
+
+;;     [[&or "window" "windows"]
+;;      [&or "of" "in"] form]
+
+;;     [[&or "overlay" "overlays"
+;;       "extent" "extents"]
+;;      [&or "of" "in"] form
+;;      &optional [[&or "from" "to"] form]]
+
+;;     [[&or "interval" "intervals"]
+;;      [&or "in" "of"] form
+;;      &optional [[&or "from" "to"] form]
+;;      ["property" form]]
+
+;;     [[&or "key-code" "key-codes"
+;;       "key-seq" "key-seqs"
+;;       "key-binding" "key-bindings"]
+;;      [&or "in" "of"] form
+;;      &optional ["using" ([&or "key-code" "key-codes"
+;;                           "key-seq" "key-seqs"
+;;                           "key-binding" "key-bindings"]
+;;                      sexp)]]
+;;     ;; For arbitrary extensions, recognize anything else.
+;;     [symbolp &rest &or symbolp form]
+;;     ]
+
+;;    ;; arithmetic - must be last since all parts are optional.
+;;    [[&optional [[&or "from" "downfrom" "upfrom"] form]]
+;;     [&optional [[&or "to" "downto" "upto" "below" "above"] form]]
+;;     [&optional ["by" form]]
+;;     ]))
+
+;; (def-edebug-spec loop-initial-final
+;;   (&or ["initially"
+;;     ;; [&optional &or "do" "doing"]  ;; CLtL2 doesn't allow this.
+;;     &rest loop-non-atomic-expr]
+;;        ["finally" &or
+;;     [[&optional &or "do" "doing"] &rest loop-non-atomic-expr]
+;;     ["return" form]]))
+
+;; (def-edebug-spec loop-and-clause
+;;   (loop-clause &rest ["and" loop-clause]))
+
+;; (def-edebug-spec loop-clause
+;;   (&or
+;;    [[&or "while" "until" "always" "never" "thereis"] form]
+
+;;    [[&or "collect" "collecting"
+;;      "append" "appending"
+;;      "nconc" "nconcing"
+;;      "concat" "vconcat"] form
+;;      [&optional ["into" loop-var]]]
+
+;;    [[&or "count" "counting"
+;;      "sum" "summing"
+;;      "maximize" "maximizing"
+;;      "minimize" "minimizing"] form
+;;      [&optional ["into" loop-var]]
+;;      loop-type-spec]
+
+;;    [[&or "if" "when" "unless"]
+;;     form loop-and-clause
+;;     [&optional ["else" loop-and-clause]]
+;;     [&optional "end"]]
+
+;;    [[&or "do" "doing"] &rest loop-non-atomic-expr]
+
+;;    ["return" form]
+;;    loop-initial-final
+;;    ))
+
+;; (def-edebug-spec loop-non-atomic-expr
+;;   ([&not atom] form))
+
+;; (def-edebug-spec loop-var
+;;   ;; The symbolp must be last alternative to recognize e.g. (a b . c)
+;;   ;; loop-var =>
+;;   ;; (loop-var . [&or nil loop-var])
+;;   ;; (symbolp . [&or nil loop-var])
+;;   ;; (symbolp . loop-var)
+;;   ;; (symbolp . (symbolp . [&or nil loop-var]))
+;;   ;; (symbolp . (symbolp . loop-var))
+;;   ;; (symbolp . (symbolp . symbolp)) == (symbolp symbolp . symbolp)
+;;   (&or (loop-var . [&or nil loop-var]) [gate symbolp]))
+
+;; (def-edebug-spec loop-type-spec
+;;   (&optional ["of-type" loop-d-type-spec]))
+
+;; (def-edebug-spec loop-d-type-spec
+;;   (&or (loop-d-type-spec . [&or nil loop-d-type-spec]) cl-type-spec))
+
+
 
 (defun cl-parse-loop-clause ()         ; uses loop-*
-  (let ((word (pop loop-args))
+  (let ((word (pop cl--loop-args))
        (hash-types '(hash-key hash-keys hash-value hash-values))
        (key-types '(key-code key-codes key-seq key-seqs
                     key-binding key-bindings)))
     (cond
 
-     ((null loop-args)
-      (error "Malformed `loop' macro"))
+     ((null cl--loop-args)
+      (error "Malformed `cl-loop' macro"))
 
      ((eq word 'named)
-      (setq loop-name (pop loop-args)))
+      (setq cl--loop-name (pop cl--loop-args)))
 
      ((eq word 'initially)
-      (if (memq (car loop-args) '(do doing)) (pop loop-args))
-      (or (consp (car loop-args)) (error "Syntax error on `initially' clause"))
-      (while (consp (car loop-args))
-       (push (pop loop-args) loop-initially)))
+      (if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
+      (or (consp (car cl--loop-args)) (error "Syntax error on `initially' clause"))
+      (while (consp (car cl--loop-args))
+       (push (pop cl--loop-args) cl--loop-initially)))
 
      ((eq word 'finally)
-      (if (eq (car loop-args) 'return)
-         (setq loop-result-explicit (or (cl-pop2 loop-args) '(quote nil)))
-       (if (memq (car loop-args) '(do doing)) (pop loop-args))
-       (or (consp (car loop-args)) (error "Syntax error on `finally' clause"))
-       (if (and (eq (caar loop-args) 'return) (null loop-name))
-           (setq loop-result-explicit (or (nth 1 (pop loop-args)) '(quote nil)))
-         (while (consp (car loop-args))
-           (push (pop loop-args) loop-finally)))))
+      (if (eq (car cl--loop-args) 'return)
+         (setq cl--loop-result-explicit (or (cl-pop2 cl--loop-args) '(quote nil)))
+       (if (memq (car cl--loop-args) '(do doing)) (pop cl--loop-args))
+       (or (consp (car cl--loop-args)) (error "Syntax error on `finally' clause"))
+       (if (and (eq (caar cl--loop-args) 'return) (null cl--loop-name))
+           (setq cl--loop-result-explicit (or (nth 1 (pop cl--loop-args)) '(quote nil)))
+         (while (consp (car cl--loop-args))
+           (push (pop cl--loop-args) cl--loop-finally)))))
 
      ((memq word '(for as))
       (let ((loop-for-bindings nil) (loop-for-sets nil) (loop-for-steps nil)
            (ands nil))
        (while
-           ;; Use `gensym' rather than `make-symbol'.  It's important that
+           ;; Use `cl-gensym' rather than `make-symbol'.  It's important that
            ;; (not (eq (symbol-name var1) (symbol-name var2))) because
-           ;; these vars get added to the cl-macro-environment.
-           (let ((var (or (pop loop-args) (gensym "--cl-var--"))))
-             (setq word (pop loop-args))
-             (if (eq word 'being) (setq word (pop loop-args)))
-             (if (memq word '(the each)) (setq word (pop loop-args)))
+           ;; these vars get added to the macro-environment.
+           (let ((var (or (pop cl--loop-args) (cl-gensym "--cl-var--"))))
+             (setq word (pop cl--loop-args))
+             (if (eq word 'being) (setq word (pop cl--loop-args)))
+             (if (memq word '(the each)) (setq word (pop cl--loop-args)))
              (if (memq word '(buffer buffers))
-                 (setq word 'in loop-args (cons '(buffer-list) loop-args)))
+                 (setq word 'in cl--loop-args (cons '(buffer-list) cl--loop-args)))
              (cond
 
               ((memq word '(from downfrom upfrom to downto upto
                             above below by))
-               (push word loop-args)
-               (if (memq (car loop-args) '(downto above))
-                   (error "Must specify `from' value for downward loop"))
-               (let* ((down (or (eq (car loop-args) 'downfrom)
-                                (memq (caddr loop-args) '(downto above))))
-                      (excl (or (memq (car loop-args) '(above below))
-                                (memq (caddr loop-args) '(above below))))
-                      (start (and (memq (car loop-args) '(from upfrom downfrom))
-                                  (cl-pop2 loop-args)))
-                      (end (and (memq (car loop-args)
+               (push word cl--loop-args)
+               (if (memq (car cl--loop-args) '(downto above))
+                   (error "Must specify `from' value for downward cl-loop"))
+               (let* ((down (or (eq (car cl--loop-args) 'downfrom)
+                                (memq (cl-caddr cl--loop-args) '(downto above))))
+                      (excl (or (memq (car cl--loop-args) '(above below))
+                                (memq (cl-caddr cl--loop-args) '(above below))))
+                      (start (and (memq (car cl--loop-args) '(from upfrom downfrom))
+                                  (cl-pop2 cl--loop-args)))
+                      (end (and (memq (car cl--loop-args)
                                       '(to upto downto above below))
-                                (cl-pop2 loop-args)))
-                      (step (and (eq (car loop-args) 'by) (cl-pop2 loop-args)))
-                      (end-var (and (not (cl-const-expr-p end))
+                                (cl-pop2 cl--loop-args)))
+                      (step (and (eq (car cl--loop-args) 'by) (cl-pop2 cl--loop-args)))
+                      (end-var (and (not (macroexp-const-p end))
                                     (make-symbol "--cl-var--")))
-                      (step-var (and (not (cl-const-expr-p step))
+                      (step-var (and (not (macroexp-const-p step))
                                      (make-symbol "--cl-var--"))))
                  (and step (numberp step) (<= step 0)
                       (error "Loop `by' value is not positive: %s" step))
@@ -792,7 +1007,7 @@ Valid clauses are:
                  (if end
                      (push (list
                             (if down (if excl '> '>=) (if excl '< '<=))
-                            var (or end-var end)) loop-body))
+                            var (or end-var end)) cl--loop-body))
                  (push (list var (list (if down '- '+) var
                                        (or step-var step 1)))
                        loop-for-steps)))
@@ -801,44 +1016,44 @@ Valid clauses are:
                (let* ((on (eq word 'on))
                       (temp (if (and on (symbolp var))
                                 var (make-symbol "--cl-var--"))))
-                 (push (list temp (pop loop-args)) loop-for-bindings)
-                 (push (list 'consp temp) loop-body)
+                 (push (list temp (pop cl--loop-args)) loop-for-bindings)
+                 (push `(consp ,temp) cl--loop-body)
                  (if (eq word 'in-ref)
-                     (push (list var (list 'car temp)) loop-symbol-macs)
+                     (push (list var `(car ,temp)) cl--loop-symbol-macs)
                    (or (eq temp var)
                        (progn
                          (push (list var nil) loop-for-bindings)
-                         (push (list var (if on temp (list 'car temp)))
+                         (push (list var (if on temp `(car ,temp)))
                                loop-for-sets))))
                  (push (list temp
-                             (if (eq (car loop-args) 'by)
-                                 (let ((step (cl-pop2 loop-args)))
+                             (if (eq (car cl--loop-args) 'by)
+                                 (let ((step (cl-pop2 cl--loop-args)))
                                    (if (and (memq (car-safe step)
                                                   '(quote function
-                                                          function*))
+                                                          cl-function))
                                             (symbolp (nth 1 step)))
                                        (list (nth 1 step) temp)
-                                     (list 'funcall step temp)))
-                               (list 'cdr temp)))
+                                     `(funcall ,step ,temp)))
+                               `(cdr ,temp)))
                        loop-for-steps)))
 
               ((eq word '=)
-               (let* ((start (pop loop-args))
-                      (then (if (eq (car loop-args) 'then) (cl-pop2 loop-args) start)))
+               (let* ((start (pop cl--loop-args))
+                      (then (if (eq (car cl--loop-args) 'then) (cl-pop2 cl--loop-args) start)))
                  (push (list var nil) loop-for-bindings)
-                 (if (or ands (eq (car loop-args) 'and))
+                 (if (or ands (eq (car cl--loop-args) 'and))
                      (progn
                        (push `(,var
-                               (if ,(or loop-first-flag
-                                        (setq loop-first-flag
+                               (if ,(or cl--loop-first-flag
+                                        (setq cl--loop-first-flag
                                               (make-symbol "--cl-var--")))
                                    ,start ,var))
                              loop-for-sets)
                        (push (list var then) loop-for-steps))
                    (push (list var
                                (if (eq start then) start
-                                 `(if ,(or loop-first-flag
-                                           (setq loop-first-flag
+                                 `(if ,(or cl--loop-first-flag
+                                           (setq cl--loop-first-flag
                                                  (make-symbol "--cl-var--")))
                                       ,start ,then)))
                          loop-for-sets))))
@@ -846,80 +1061,79 @@ Valid clauses are:
               ((memq word '(across across-ref))
                (let ((temp-vec (make-symbol "--cl-vec--"))
                      (temp-idx (make-symbol "--cl-idx--")))
-                 (push (list temp-vec (pop loop-args)) loop-for-bindings)
+                 (push (list temp-vec (pop cl--loop-args)) loop-for-bindings)
                  (push (list temp-idx -1) loop-for-bindings)
-                 (push (list '< (list 'setq temp-idx (list '1+ temp-idx))
-                             (list 'length temp-vec)) loop-body)
+                 (push `(< (setq ,temp-idx (1+ ,temp-idx))
+                            (length ,temp-vec)) cl--loop-body)
                  (if (eq word 'across-ref)
-                     (push (list var (list 'aref temp-vec temp-idx))
-                           loop-symbol-macs)
+                     (push (list var `(aref ,temp-vec ,temp-idx))
+                           cl--loop-symbol-macs)
                    (push (list var nil) loop-for-bindings)
-                   (push (list var (list 'aref temp-vec temp-idx))
+                   (push (list var `(aref ,temp-vec ,temp-idx))
                          loop-for-sets))))
 
               ((memq word '(element elements))
-               (let ((ref (or (memq (car loop-args) '(in-ref of-ref))
-                              (and (not (memq (car loop-args) '(in of)))
+               (let ((ref (or (memq (car cl--loop-args) '(in-ref of-ref))
+                              (and (not (memq (car cl--loop-args) '(in of)))
                                    (error "Expected `of'"))))
-                     (seq (cl-pop2 loop-args))
+                     (seq (cl-pop2 cl--loop-args))
                      (temp-seq (make-symbol "--cl-seq--"))
-                     (temp-idx (if (eq (car loop-args) 'using)
-                                   (if (and (= (length (cadr loop-args)) 2)
-                                            (eq (caadr loop-args) 'index))
-                                       (cadr (cl-pop2 loop-args))
+                     (temp-idx (if (eq (car cl--loop-args) 'using)
+                                   (if (and (= (length (cadr cl--loop-args)) 2)
+                                            (eq (cl-caadr cl--loop-args) 'index))
+                                       (cadr (cl-pop2 cl--loop-args))
                                      (error "Bad `using' clause"))
                                  (make-symbol "--cl-idx--"))))
                  (push (list temp-seq seq) loop-for-bindings)
                  (push (list temp-idx 0) loop-for-bindings)
                  (if ref
                      (let ((temp-len (make-symbol "--cl-len--")))
-                       (push (list temp-len (list 'length temp-seq))
+                       (push (list temp-len `(length ,temp-seq))
                              loop-for-bindings)
-                       (push (list var (list 'elt temp-seq temp-idx))
-                             loop-symbol-macs)
-                       (push (list '< temp-idx temp-len) loop-body))
+                       (push (list var `(elt ,temp-seq ,temp-idx))
+                             cl--loop-symbol-macs)
+                       (push `(< ,temp-idx ,temp-len) cl--loop-body))
                    (push (list var nil) loop-for-bindings)
-                   (push (list 'and temp-seq
-                               (list 'or (list 'consp temp-seq)
-                                     (list '< temp-idx
-                                           (list 'length temp-seq))))
-                         loop-body)
-                   (push (list var (list 'if (list 'consp temp-seq)
-                                         (list 'pop temp-seq)
-                                         (list 'aref temp-seq temp-idx)))
+                   (push `(and ,temp-seq
+                               (or (consp ,temp-seq)
+                                    (< ,temp-idx (length ,temp-seq))))
+                         cl--loop-body)
+                   (push (list var `(if (consp ,temp-seq)
+                                         (pop ,temp-seq)
+                                       (aref ,temp-seq ,temp-idx)))
                          loop-for-sets))
-                 (push (list temp-idx (list '1+ temp-idx))
+                 (push (list temp-idx `(1+ ,temp-idx))
                        loop-for-steps)))
 
               ((memq word hash-types)
-               (or (memq (car loop-args) '(in of)) (error "Expected `of'"))
-               (let* ((table (cl-pop2 loop-args))
-                      (other (if (eq (car loop-args) 'using)
-                                 (if (and (= (length (cadr loop-args)) 2)
-                                          (memq (caadr loop-args) hash-types)
-                                          (not (eq (caadr loop-args) word)))
-                                     (cadr (cl-pop2 loop-args))
+               (or (memq (car cl--loop-args) '(in of)) (error "Expected `of'"))
+               (let* ((table (cl-pop2 cl--loop-args))
+                      (other (if (eq (car cl--loop-args) 'using)
+                                 (if (and (= (length (cadr cl--loop-args)) 2)
+                                          (memq (cl-caadr cl--loop-args) hash-types)
+                                          (not (eq (cl-caadr cl--loop-args) word)))
+                                     (cadr (cl-pop2 cl--loop-args))
                                    (error "Bad `using' clause"))
                                (make-symbol "--cl-var--"))))
                  (if (memq word '(hash-value hash-values))
                      (setq var (prog1 other (setq other var))))
-                 (setq loop-map-form
+                 (setq cl--loop-map-form
                        `(maphash (lambda (,var ,other) . --cl-map) ,table))))
 
               ((memq word '(symbol present-symbol external-symbol
                             symbols present-symbols external-symbols))
-               (let ((ob (and (memq (car loop-args) '(in of)) (cl-pop2 loop-args))))
-                 (setq loop-map-form
+               (let ((ob (and (memq (car cl--loop-args) '(in of)) (cl-pop2 cl--loop-args))))
+                 (setq cl--loop-map-form
                        `(mapatoms (lambda (,var) . --cl-map) ,ob))))
 
               ((memq word '(overlay overlays extent extents))
                (let ((buf nil) (from nil) (to nil))
-                 (while (memq (car loop-args) '(in of from to))
-                   (cond ((eq (car loop-args) 'from) (setq from (cl-pop2 loop-args)))
-                         ((eq (car loop-args) 'to) (setq to (cl-pop2 loop-args)))
-                         (t (setq buf (cl-pop2 loop-args)))))
-                 (setq loop-map-form
-                       `(cl-map-extents
+                 (while (memq (car cl--loop-args) '(in of from to))
+                   (cond ((eq (car cl--loop-args) 'from) (setq from (cl-pop2 cl--loop-args)))
+                         ((eq (car cl--loop-args) 'to) (setq to (cl-pop2 cl--loop-args)))
+                         (t (setq buf (cl-pop2 cl--loop-args)))))
+                 (setq cl--loop-map-form
+                       `(cl--map-overlays
                          (lambda (,var ,(make-symbol "--cl-var--"))
                            (progn . --cl-map) nil)
                          ,buf ,from ,to))))
@@ -928,246 +1142,246 @@ Valid clauses are:
                (let ((buf nil) (prop nil) (from nil) (to nil)
                      (var1 (make-symbol "--cl-var1--"))
                      (var2 (make-symbol "--cl-var2--")))
-                 (while (memq (car loop-args) '(in of property from to))
-                   (cond ((eq (car loop-args) 'from) (setq from (cl-pop2 loop-args)))
-                         ((eq (car loop-args) 'to) (setq to (cl-pop2 loop-args)))
-                         ((eq (car loop-args) 'property)
-                          (setq prop (cl-pop2 loop-args)))
-                         (t (setq buf (cl-pop2 loop-args)))))
+                 (while (memq (car cl--loop-args) '(in of property from to))
+                   (cond ((eq (car cl--loop-args) 'from) (setq from (cl-pop2 cl--loop-args)))
+                         ((eq (car cl--loop-args) 'to) (setq to (cl-pop2 cl--loop-args)))
+                         ((eq (car cl--loop-args) 'property)
+                          (setq prop (cl-pop2 cl--loop-args)))
+                         (t (setq buf (cl-pop2 cl--loop-args)))))
                  (if (and (consp var) (symbolp (car var)) (symbolp (cdr var)))
                      (setq var1 (car var) var2 (cdr var))
-                   (push (list var (list 'cons var1 var2)) loop-for-sets))
-                 (setq loop-map-form
-                       `(cl-map-intervals
+                   (push (list var `(cons ,var1 ,var2)) loop-for-sets))
+                 (setq cl--loop-map-form
+                       `(cl--map-intervals
                          (lambda (,var1 ,var2) . --cl-map)
                          ,buf ,prop ,from ,to))))
 
               ((memq word key-types)
-               (or (memq (car loop-args) '(in of)) (error "Expected `of'"))
-               (let ((map (cl-pop2 loop-args))
-                     (other (if (eq (car loop-args) 'using)
-                                (if (and (= (length (cadr loop-args)) 2)
-                                         (memq (caadr loop-args) key-types)
-                                         (not (eq (caadr loop-args) word)))
-                                    (cadr (cl-pop2 loop-args))
+               (or (memq (car cl--loop-args) '(in of)) (error "Expected `of'"))
+               (let ((cl-map (cl-pop2 cl--loop-args))
+                     (other (if (eq (car cl--loop-args) 'using)
+                                (if (and (= (length (cadr cl--loop-args)) 2)
+                                         (memq (cl-caadr cl--loop-args) key-types)
+                                         (not (eq (cl-caadr cl--loop-args) word)))
+                                    (cadr (cl-pop2 cl--loop-args))
                                   (error "Bad `using' clause"))
                               (make-symbol "--cl-var--"))))
                  (if (memq word '(key-binding key-bindings))
                      (setq var (prog1 other (setq other var))))
-                 (setq loop-map-form
+                 (setq cl--loop-map-form
                        `(,(if (memq word '(key-seq key-seqs))
-                              'cl-map-keymap-recursively 'map-keymap)
-                         (lambda (,var ,other) . --cl-map) ,map))))
+                              'cl--map-keymap-recursively 'map-keymap)
+                         (lambda (,var ,other) . --cl-map) ,cl-map))))
 
               ((memq word '(frame frames screen screens))
                (let ((temp (make-symbol "--cl-var--")))
                  (push (list var  '(selected-frame))
                        loop-for-bindings)
                  (push (list temp nil) loop-for-bindings)
-                 (push (list 'prog1 (list 'not (list 'eq var temp))
-                             (list 'or temp (list 'setq temp var)))
-                       loop-body)
-                 (push (list var (list 'next-frame var))
+                 (push `(prog1 (not (eq ,var ,temp))
+                           (or ,temp (setq ,temp ,var)))
+                       cl--loop-body)
+                 (push (list var `(next-frame ,var))
                        loop-for-steps)))
 
               ((memq word '(window windows))
-               (let ((scr (and (memq (car loop-args) '(in of)) (cl-pop2 loop-args)))
+               (let ((scr (and (memq (car cl--loop-args) '(in of)) (cl-pop2 cl--loop-args)))
                      (temp (make-symbol "--cl-var--"))
                      (minip (make-symbol "--cl-minip--")))
                  (push (list var (if scr
-                                     (list 'frame-selected-window scr)
+                                     `(frame-selected-window ,scr)
                                    '(selected-window)))
                        loop-for-bindings)
                  ;; If we started in the minibuffer, we need to
                  ;; ensure that next-window will bring us back there
                  ;; at some point.  (Bug#7492).
-                 ;; (Consider using walk-windows instead of loop if
+                 ;; (Consider using walk-windows instead of cl-loop if
                  ;; you care about such things.)
                  (push (list minip `(minibufferp (window-buffer ,var)))
                        loop-for-bindings)
                  (push (list temp nil) loop-for-bindings)
-                 (push (list 'prog1 (list 'not (list 'eq var temp))
-                             (list 'or temp (list 'setq temp var)))
-                       loop-body)
-                 (push (list var (list 'next-window var minip))
+                 (push `(prog1 (not (eq ,var ,temp))
+                           (or ,temp (setq ,temp ,var)))
+                       cl--loop-body)
+                 (push (list var `(next-window ,var ,minip))
                        loop-for-steps)))
 
               (t
                (let ((handler (and (symbolp word)
-                                   (get word 'cl-loop-for-handler))))
+                                   (get word 'cl--loop-for-handler))))
                  (if handler
                      (funcall handler var)
                    (error "Expected a `for' preposition, found %s" word)))))
-             (eq (car loop-args) 'and))
+             (eq (car cl--loop-args) 'and))
          (setq ands t)
-         (pop loop-args))
+         (pop cl--loop-args))
        (if (and ands loop-for-bindings)
-           (push (nreverse loop-for-bindings) loop-bindings)
-         (setq loop-bindings (nconc (mapcar 'list loop-for-bindings)
-                                    loop-bindings)))
+           (push (nreverse loop-for-bindings) cl--loop-bindings)
+         (setq cl--loop-bindings (nconc (mapcar 'list loop-for-bindings)
+                                    cl--loop-bindings)))
        (if loop-for-sets
-           (push (list 'progn
-                       (cl-loop-let (nreverse loop-for-sets) 'setq ands)
-                       t) loop-body))
+           (push `(progn
+                     ,(cl--loop-let (nreverse loop-for-sets) 'setq ands)
+                     t) cl--loop-body))
        (if loop-for-steps
-           (push (cons (if ands 'psetq 'setq)
+           (push (cons (if ands 'cl-psetq 'setq)
                        (apply 'append (nreverse loop-for-steps)))
-                 loop-steps))))
+                 cl--loop-steps))))
 
      ((eq word 'repeat)
       (let ((temp (make-symbol "--cl-var--")))
-       (push (list (list temp (pop loop-args))) loop-bindings)
-       (push (list '>= (list 'setq temp (list '1- temp)) 0) loop-body)))
+       (push (list (list temp (pop cl--loop-args))) cl--loop-bindings)
+       (push `(>= (setq ,temp (1- ,temp)) 0) cl--loop-body)))
 
      ((memq word '(collect collecting))
-      (let ((what (pop loop-args))
-           (var (cl-loop-handle-accum nil 'nreverse)))
-       (if (eq var loop-accum-var)
-           (push (list 'progn (list 'push what var) t) loop-body)
-         (push (list 'progn
-                     (list 'setq var (list 'nconc var (list 'list what)))
-                     t) loop-body))))
+      (let ((what (pop cl--loop-args))
+           (var (cl--loop-handle-accum nil 'nreverse)))
+       (if (eq var cl--loop-accum-var)
+           (push `(progn (push ,what ,var) t) cl--loop-body)
+         (push `(progn
+                   (setq ,var (nconc ,var (list ,what)))
+                   t) cl--loop-body))))
 
      ((memq word '(nconc nconcing append appending))
-      (let ((what (pop loop-args))
-           (var (cl-loop-handle-accum nil 'nreverse)))
-       (push (list 'progn
-                   (list 'setq var
-                         (if (eq var loop-accum-var)
-                             (list 'nconc
-                                   (list (if (memq word '(nconc nconcing))
-                                             'nreverse 'reverse)
-                                         what)
-                                   var)
-                           (list (if (memq word '(nconc nconcing))
-                                     'nconc 'append)
-                                 var what))) t) loop-body)))
+      (let ((what (pop cl--loop-args))
+           (var (cl--loop-handle-accum nil 'nreverse)))
+       (push `(progn
+                 (setq ,var
+                       ,(if (eq var cl--loop-accum-var)
+                            `(nconc
+                              (,(if (memq word '(nconc nconcing))
+                                    #'nreverse #'reverse)
+                               ,what)
+                              ,var)
+                          `(,(if (memq word '(nconc nconcing))
+                                 #'nconc #'append)
+                            ,var ,what))) t) cl--loop-body)))
 
      ((memq word '(concat concating))
-      (let ((what (pop loop-args))
-           (var (cl-loop-handle-accum "")))
-       (push (list 'progn (list 'callf 'concat var what) t) loop-body)))
+      (let ((what (pop cl--loop-args))
+           (var (cl--loop-handle-accum "")))
+       (push `(progn (cl-callf concat ,var ,what) t) cl--loop-body)))
 
      ((memq word '(vconcat vconcating))
-      (let ((what (pop loop-args))
-           (var (cl-loop-handle-accum [])))
-       (push (list 'progn (list 'callf 'vconcat var what) t) loop-body)))
+      (let ((what (pop cl--loop-args))
+           (var (cl--loop-handle-accum [])))
+       (push `(progn (cl-callf vconcat ,var ,what) t) cl--loop-body)))
 
      ((memq word '(sum summing))
-      (let ((what (pop loop-args))
-           (var (cl-loop-handle-accum 0)))
-       (push (list 'progn (list 'incf var what) t) loop-body)))
+      (let ((what (pop cl--loop-args))
+           (var (cl--loop-handle-accum 0)))
+       (push `(progn (cl-incf ,var ,what) t) cl--loop-body)))
 
      ((memq word '(count counting))
-      (let ((what (pop loop-args))
-           (var (cl-loop-handle-accum 0)))
-       (push (list 'progn (list 'if what (list 'incf var)) t) loop-body)))
+      (let ((what (pop cl--loop-args))
+           (var (cl--loop-handle-accum 0)))
+       (push `(progn (if ,what (cl-incf ,var)) t) cl--loop-body)))
 
      ((memq word '(minimize minimizing maximize maximizing))
-      (let* ((what (pop loop-args))
-            (temp (if (cl-simple-expr-p what) what (make-symbol "--cl-var--")))
-            (var (cl-loop-handle-accum nil))
+      (let* ((what (pop cl--loop-args))
+            (temp (if (cl--simple-expr-p what) what (make-symbol "--cl-var--")))
+            (var (cl--loop-handle-accum nil))
             (func (intern (substring (symbol-name word) 0 3)))
-            (set (list 'setq var (list 'if var (list func var temp) temp))))
-       (push (list 'progn (if (eq temp what) set
-                            (list 'let (list (list temp what)) set))
-                   t) loop-body)))
+            (set `(setq ,var (if ,var (,func ,var ,temp) ,temp))))
+       (push `(progn ,(if (eq temp what) set
+                         `(let ((,temp ,what)) ,set))
+                      t) cl--loop-body)))
 
      ((eq word 'with)
       (let ((bindings nil))
-       (while (progn (push (list (pop loop-args)
-                                 (and (eq (car loop-args) '=) (cl-pop2 loop-args)))
+       (while (progn (push (list (pop cl--loop-args)
+                                 (and (eq (car cl--loop-args) '=) (cl-pop2 cl--loop-args)))
                            bindings)
-                     (eq (car loop-args) 'and))
-         (pop loop-args))
-       (push (nreverse bindings) loop-bindings)))
+                     (eq (car cl--loop-args) 'and))
+         (pop cl--loop-args))
+       (push (nreverse bindings) cl--loop-bindings)))
 
      ((eq word 'while)
-      (push (pop loop-args) loop-body))
+      (push (pop cl--loop-args) cl--loop-body))
 
      ((eq word 'until)
-      (push (list 'not (pop loop-args)) loop-body))
+      (push `(not ,(pop cl--loop-args)) cl--loop-body))
 
      ((eq word 'always)
-      (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-flag--")))
-      (push (list 'setq loop-finish-flag (pop loop-args)) loop-body)
-      (setq loop-result t))
+      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
+      (push `(setq ,cl--loop-finish-flag ,(pop cl--loop-args)) cl--loop-body)
+      (setq cl--loop-result t))
 
      ((eq word 'never)
-      (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-flag--")))
-      (push (list 'setq loop-finish-flag (list 'not (pop loop-args)))
-           loop-body)
-      (setq loop-result t))
+      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
+      (push `(setq ,cl--loop-finish-flag (not ,(pop cl--loop-args)))
+           cl--loop-body)
+      (setq cl--loop-result t))
 
      ((eq word 'thereis)
-      (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-flag--")))
-      (or loop-result-var (setq loop-result-var (make-symbol "--cl-var--")))
-      (push (list 'setq loop-finish-flag
-                 (list 'not (list 'setq loop-result-var (pop loop-args))))
-           loop-body))
+      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol "--cl-flag--")))
+      (or cl--loop-result-var (setq cl--loop-result-var (make-symbol "--cl-var--")))
+      (push `(setq ,cl--loop-finish-flag
+                   (not (setq ,cl--loop-result-var ,(pop cl--loop-args))))
+           cl--loop-body))
 
      ((memq word '(if when unless))
-      (let* ((cond (pop loop-args))
-            (then (let ((loop-body nil))
+      (let* ((cond (pop cl--loop-args))
+            (then (let ((cl--loop-body nil))
                     (cl-parse-loop-clause)
-                    (cl-loop-build-ands (nreverse loop-body))))
-            (else (let ((loop-body nil))
-                    (if (eq (car loop-args) 'else)
-                        (progn (pop loop-args) (cl-parse-loop-clause)))
-                    (cl-loop-build-ands (nreverse loop-body))))
+                    (cl--loop-build-ands (nreverse cl--loop-body))))
+            (else (let ((cl--loop-body nil))
+                    (if (eq (car cl--loop-args) 'else)
+                        (progn (pop cl--loop-args) (cl-parse-loop-clause)))
+                    (cl--loop-build-ands (nreverse cl--loop-body))))
             (simple (and (eq (car then) t) (eq (car else) t))))
-       (if (eq (car loop-args) 'end) (pop loop-args))
+       (if (eq (car cl--loop-args) 'end) (pop cl--loop-args))
        (if (eq word 'unless) (setq then (prog1 else (setq else then))))
        (let ((form (cons (if simple (cons 'progn (nth 1 then)) (nth 2 then))
                          (if simple (nth 1 else) (list (nth 2 else))))))
-         (if (cl-expr-contains form 'it)
+         (if (cl--expr-contains form 'it)
              (let ((temp (make-symbol "--cl-var--")))
-               (push (list temp) loop-bindings)
-               (setq form (list* 'if (list 'setq temp cond)
-                                 (subst temp 'it form))))
-           (setq form (list* 'if cond form)))
-         (push (if simple (list 'progn form t) form) loop-body))))
+               (push (list temp) cl--loop-bindings)
+               (setq form `(if (setq ,temp ,cond)
+                                ,@(cl-subst temp 'it form))))
+           (setq form `(if ,cond ,@form)))
+         (push (if simple `(progn ,form t) form) cl--loop-body))))
 
      ((memq word '(do doing))
       (let ((body nil))
-       (or (consp (car loop-args)) (error "Syntax error on `do' clause"))
-       (while (consp (car loop-args)) (push (pop loop-args) body))
-       (push (cons 'progn (nreverse (cons t body))) loop-body)))
+       (or (consp (car cl--loop-args)) (error "Syntax error on `do' clause"))
+       (while (consp (car cl--loop-args)) (push (pop cl--loop-args) body))
+       (push (cons 'progn (nreverse (cons t body))) cl--loop-body)))
 
      ((eq word 'return)
-      (or loop-finish-flag (setq loop-finish-flag (make-symbol "--cl-var--")))
-      (or loop-result-var (setq loop-result-var (make-symbol "--cl-var--")))
-      (push (list 'setq loop-result-var (pop loop-args)
-                 loop-finish-flag nil) loop-body))
+      (or cl--loop-finish-flag (setq cl--loop-finish-flag (make-symbol "--cl-var--")))
+      (or cl--loop-result-var (setq cl--loop-result-var (make-symbol "--cl-var--")))
+      (push `(setq ,cl--loop-result-var ,(pop cl--loop-args)
+                   ,cl--loop-finish-flag nil) cl--loop-body))
 
      (t
-      (let ((handler (and (symbolp word) (get word 'cl-loop-handler))))
-       (or handler (error "Expected a loop keyword, found %s" word))
+      (let ((handler (and (symbolp word) (get word 'cl--loop-handler))))
+       (or handler (error "Expected a cl-loop keyword, found %s" word))
        (funcall handler))))
-    (if (eq (car loop-args) 'and)
-       (progn (pop loop-args) (cl-parse-loop-clause)))))
+    (if (eq (car cl--loop-args) 'and)
+       (progn (pop cl--loop-args) (cl-parse-loop-clause)))))
 
-(defun cl-loop-let (specs body par)   ; uses loop-*
+(defun cl--loop-let (specs body par)   ; uses loop-*
   (let ((p specs) (temps nil) (new nil))
-    (while (and p (or (symbolp (car-safe (car p))) (null (cadar p))))
+    (while (and p (or (symbolp (car-safe (car p))) (null (cl-cadar p))))
       (setq p (cdr p)))
     (and par p
         (progn
           (setq par nil p specs)
           (while p
-            (or (cl-const-expr-p (cadar p))
+            (or (macroexp-const-p (cl-cadar p))
                 (let ((temp (make-symbol "--cl-var--")))
-                  (push (list temp (cadar p)) temps)
+                  (push (list temp (cl-cadar p)) temps)
                   (setcar (cdar p) temp)))
             (setq p (cdr p)))))
     (while specs
       (if (and (consp (car specs)) (listp (caar specs)))
          (let* ((spec (caar specs)) (nspecs nil)
                 (expr (cadr (pop specs)))
-                (temp (cdr (or (assq spec loop-destr-temps)
+                (temp (cdr (or (assq spec cl--loop-destr-temps)
                                (car (push (cons spec (or (last spec 0)
                                                          (make-symbol "--cl-var--")))
-                                          loop-destr-temps))))))
+                                          cl--loop-destr-temps))))))
            (push (list temp expr) new)
            (while (consp spec)
              (push (list (pop spec)
@@ -1176,27 +1390,27 @@ Valid clauses are:
            (setq specs (nconc (nreverse nspecs) specs)))
        (push (pop specs) new)))
     (if (eq body 'setq)
-       (let ((set (cons (if par 'psetq 'setq) (apply 'nconc (nreverse new)))))
-         (if temps (list 'let* (nreverse temps) set) set))
-      (list* (if par 'let 'let*)
-            (nconc (nreverse temps) (nreverse new)) body))))
-
-(defun cl-loop-handle-accum (def &optional func)   ; uses loop-*
-  (if (eq (car loop-args) 'into)
-      (let ((var (cl-pop2 loop-args)))
-       (or (memq var loop-accum-vars)
-           (progn (push (list (list var def)) loop-bindings)
-                  (push var loop-accum-vars)))
+       (let ((set (cons (if par 'cl-psetq 'setq) (apply 'nconc (nreverse new)))))
+         (if temps `(let* ,(nreverse temps) ,set) set))
+      `(,(if par 'let 'let*)
+        ,(nconc (nreverse temps) (nreverse new)) ,@body))))
+
+(defun cl--loop-handle-accum (def &optional func)   ; uses loop-*
+  (if (eq (car cl--loop-args) 'into)
+      (let ((var (cl-pop2 cl--loop-args)))
+       (or (memq var cl--loop-accum-vars)
+           (progn (push (list (list var def)) cl--loop-bindings)
+                  (push var cl--loop-accum-vars)))
        var)
-    (or loop-accum-var
+    (or cl--loop-accum-var
        (progn
-         (push (list (list (setq loop-accum-var (make-symbol "--cl-var--")) def))
-                  loop-bindings)
-         (setq loop-result (if func (list func loop-accum-var)
-                             loop-accum-var))
-         loop-accum-var))))
+         (push (list (list (setq cl--loop-accum-var (make-symbol "--cl-var--")) def))
+                  cl--loop-bindings)
+         (setq cl--loop-result (if func (list func cl--loop-accum-var)
+                             cl--loop-accum-var))
+         cl--loop-accum-var))))
 
-(defun cl-loop-build-ands (clauses)
+(defun cl--loop-build-ands (clauses)
   (let ((ands nil)
        (body nil))
     (while clauses
@@ -1206,7 +1420,7 @@ Valid clauses are:
              (setq clauses (cons (nconc (butlast (car clauses))
                                         (if (eq (car-safe (cadr clauses))
                                                 'progn)
-                                            (cdadr clauses)
+                                            (cl-cdadr clauses)
                                           (list (cadr clauses))))
                                  (cddr clauses)))
            (setq body (cdr (butlast (pop clauses)))))
@@ -1223,363 +1437,341 @@ Valid clauses are:
 ;;; Other iteration control structures.
 
 ;;;###autoload
-(defmacro do (steps endtest &rest body)
-  "The Common Lisp `do' loop.
+(defmacro cl-do (steps endtest &rest body)
+  "The Common Lisp `cl-do' loop.
 
 \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
+  (declare (indent 2)
+           (debug
+            ((&rest &or symbolp (symbolp &optional form form))
+             (form body)
+             cl-declarations body)))
   (cl-expand-do-loop steps endtest body nil))
 
 ;;;###autoload
-(defmacro do* (steps endtest &rest body)
-  "The Common Lisp `do*' loop.
+(defmacro cl-do* (steps endtest &rest body)
+  "The Common Lisp `cl-do*' loop.
 
 \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)"
+  (declare (indent 2) (debug cl-do))
   (cl-expand-do-loop steps endtest body t))
 
 (defun cl-expand-do-loop (steps endtest body star)
-  (list 'block nil
-       (list* (if star 'let* 'let)
-              (mapcar (function (lambda (c)
-                                  (if (consp c) (list (car c) (nth 1 c)) c)))
-                      steps)
-              (list* 'while (list 'not (car endtest))
-                     (append body
-                             (let ((sets (mapcar
-                                          (function
-                                           (lambda (c)
-                                             (and (consp c) (cdr (cdr c))
-                                                  (list (car c) (nth 2 c)))))
-                                          steps)))
-                               (setq sets (delq nil sets))
-                               (and sets
-                                    (list (cons (if (or star (not (cdr sets)))
-                                                    'setq 'psetq)
-                                                (apply 'append sets)))))))
-              (or (cdr endtest) '(nil)))))
+  `(cl-block nil
+     (,(if star 'let* 'let)
+      ,(mapcar (lambda (c) (if (consp c) (list (car c) (nth 1 c)) c))
+               steps)
+      (while (not ,(car endtest))
+        ,@body
+        ,@(let ((sets (mapcar (lambda (c)
+                                (and (consp c) (cdr (cdr c))
+                                     (list (car c) (nth 2 c))))
+                              steps)))
+            (setq sets (delq nil sets))
+            (and sets
+                 (list (cons (if (or star (not (cdr sets)))
+                                 'setq 'cl-psetq)
+                             (apply 'append sets))))))
+      ,@(or (cdr endtest) '(nil)))))
 
 ;;;###autoload
-(defmacro dolist (spec &rest body)
+(defmacro cl-dolist (spec &rest body)
   "Loop over a list.
 Evaluate BODY with VAR bound to each `car' from LIST, in turn.
 Then evaluate RESULT to get return value, default nil.
 An implicit nil block is established around the loop.
 
 \(fn (VAR LIST [RESULT]) BODY...)"
-  (let ((temp (make-symbol "--cl-dolist-temp--")))
-    ;; FIXME: Copy&pasted from subr.el.
-    `(block nil
-       ;; This is not a reliable test, but it does not matter because both
-       ;; semantics are acceptable, tho one is slightly faster with dynamic
-       ;; scoping and the other is slightly faster (and has cleaner semantics)
-       ;; with lexical scoping.
-       ,(if lexical-binding
-            `(let ((,temp ,(nth 1 spec)))
-               (while ,temp
-                 (let ((,(car spec) (car ,temp)))
-                   ,@body
-                   (setq ,temp (cdr ,temp))))
-               ,@(if (cdr (cdr spec))
-                     ;; FIXME: This let often leads to "unused var" warnings.
-                     `((let ((,(car spec) nil)) ,@(cdr (cdr spec))))))
-          `(let ((,temp ,(nth 1 spec))
-                 ,(car spec))
-             (while ,temp
-               (setq ,(car spec) (car ,temp))
-               ,@body
-               (setq ,temp (cdr ,temp)))
-             ,@(if (cdr (cdr spec))
-                   `((setq ,(car spec) nil) ,@(cddr spec))))))))
+  (declare (debug ((symbolp form &optional form) cl-declarations body))
+           (indent 1))
+  `(cl-block nil
+     (,(if (eq 'cl-dolist (symbol-function 'dolist)) 'cl--dolist 'dolist)
+      ,spec ,@body)))
 
 ;;;###autoload
-(defmacro dotimes (spec &rest body)
+(defmacro cl-dotimes (spec &rest body)
   "Loop a certain number of times.
 Evaluate BODY with VAR bound to successive integers from 0, inclusive,
 to COUNT, exclusive.  Then evaluate RESULT to get return value, default
 nil.
 
 \(fn (VAR COUNT [RESULT]) BODY...)"
-  (let ((temp (make-symbol "--cl-dotimes-temp--"))
-       (end (nth 1 spec)))
-    ;; FIXME: Copy&pasted from subr.el.
-    `(block nil
-       ;; This is not a reliable test, but it does not matter because both
-       ;; semantics are acceptable, tho one is slightly faster with dynamic
-       ;; scoping and the other has cleaner semantics.
-       ,(if lexical-binding
-            (let ((counter '--dotimes-counter--))
-              `(let ((,temp ,end)
-                     (,counter 0))
-                 (while (< ,counter ,temp)
-                   (let ((,(car spec) ,counter))
-                     ,@body)
-                   (setq ,counter (1+ ,counter)))
-                 ,@(if (cddr spec)
-                       ;; FIXME: This let often leads to "unused var" warnings.
-                       `((let ((,(car spec) ,counter)) ,@(cddr spec))))))
-          `(let ((,temp ,end)
-                 (,(car spec) 0))
-             (while (< ,(car spec) ,temp)
-               ,@body
-               (incf ,(car spec)))
-             ,@(cdr (cdr spec)))))))
+  (declare (debug cl-dolist) (indent 1))
+  `(cl-block nil
+     (,(if (eq 'cl-dotimes (symbol-function 'dotimes)) 'cl--dotimes 'dotimes)
+      ,spec ,@body)))
 
 ;;;###autoload
-(defmacro do-symbols (spec &rest body)
+(defmacro cl-do-symbols (spec &rest body)
   "Loop over all symbols.
 Evaluate BODY with VAR bound to each interned symbol, or to each symbol
 from OBARRAY.
 
 \(fn (VAR [OBARRAY [RESULT]]) BODY...)"
+  (declare (indent 1)
+           (debug ((symbolp &optional form form) cl-declarations body)))
   ;; Apparently this doesn't have an implicit block.
-  (list 'block nil
-       (list 'let (list (car spec))
-             (list* 'mapatoms
-                    (list 'function (list* 'lambda (list (car spec)) body))
-                    (and (cadr spec) (list (cadr spec))))
-             (caddr spec))))
+  `(cl-block nil
+     (let (,(car spec))
+       (mapatoms #'(lambda (,(car spec)) ,@body)
+                 ,@(and (cadr spec) (list (cadr spec))))
+       ,(cl-caddr spec))))
 
 ;;;###autoload
-(defmacro do-all-symbols (spec &rest body)
-  (list* 'do-symbols (list (car spec) nil (cadr spec)) body))
+(defmacro cl-do-all-symbols (spec &rest body)
+  (declare (indent 1) (debug ((symbolp &optional form) cl-declarations body)))
+  `(cl-do-symbols (,(car spec) nil ,(cadr spec)) ,@body))
 
 
 ;;; Assignments.
 
 ;;;###autoload
-(defmacro psetq (&rest args)
+(defmacro cl-psetq (&rest args)
   "Set SYMs to the values VALs in parallel.
 This is like `setq', except that all VAL forms are evaluated (in order)
 before assigning any symbols SYM to the corresponding values.
 
 \(fn SYM VAL SYM VAL ...)"
-  (cons 'psetf args))
+  (declare (debug setq))
+  (cons 'cl-psetf args))
 
 
 ;;; Binding control structures.
 
 ;;;###autoload
-(defmacro progv (symbols values &rest body)
+(defmacro cl-progv (symbols values &rest body)
   "Bind SYMBOLS to VALUES dynamically in BODY.
 The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists.
 Each symbol in the first list is bound to the corresponding value in the
 second list (or made unbound if VALUES is shorter than SYMBOLS); then the
 BODY forms are executed and their result is returned.  This is much like
 a `let' form, except that the list of symbols can be computed at run-time."
-  (list 'let '((cl-progv-save nil))
-       (list 'unwind-protect
-             (list* 'progn (list 'cl-progv-before symbols values) body)
-             '(cl-progv-after))))
+  (declare (indent 2) (debug (form form body)))
+  (let ((bodyfun (make-symbol "body"))
+        (binds (make-symbol "binds"))
+        (syms (make-symbol "syms"))
+        (vals (make-symbol "vals")))
+    `(progn
+       (defvar ,bodyfun)
+       (let* ((,syms ,symbols)
+              (,vals ,values)
+              (,bodyfun (lambda () ,@body))
+              (,binds ()))
+         (while ,syms
+           (push (list (pop ,syms) (list 'quote (pop ,vals))) ,binds))
+         (eval (list 'let ,binds '(funcall ,bodyfun)))))))
+
+(defvar cl--labels-convert-cache nil)
+
+(defun cl--labels-convert (f)
+  "Special macro-expander to rename (function F) references in `cl-labels'."
+  (cond
+   ;; ¡¡Big Ugly Hack!! We can't use a compiler-macro because those are checked
+   ;; *after* handling `function', but we want to stop macroexpansion from
+   ;; being applied infinitely, so we use a cache to return the exact `form'
+   ;; being expanded even though we don't receive it.
+   ((eq f (car cl--labels-convert-cache)) (cdr cl--labels-convert-cache))
+   (t
+    (let ((found (assq f macroexpand-all-environment)))
+      (if (and found (ignore-errors
+                       (eq (cadr (cl-caddr found)) 'cl-labels-args)))
+          (cadr (cl-caddr (cl-cadddr found)))
+        (let ((res `(function ,f)))
+          (setq cl--labels-convert-cache (cons f res))
+          res))))))
 
-;;; This should really have some way to shadow 'byte-compile properties, etc.
 ;;;###autoload
-(defmacro flet (bindings &rest body)
+(defmacro cl-flet (bindings &rest body)
   "Make temporary function definitions.
-This is an analogue of `let' that operates on the function cell of FUNC
-rather than its value cell.  The FORMs are evaluated with the specified
-function definitions in place, then the definitions are undone (the FUNCs
-go back to their previous definitions, or lack thereof).
+Like `cl-labels' but the definitions are not recursive.
 
 \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
-  (list* 'letf*
-        (mapcar
-         (function
-          (lambda (x)
-            (if (or (and (fboundp (car x))
-                         (eq (car-safe (symbol-function (car x))) 'macro))
-                    (cdr (assq (car x) cl-macro-environment)))
-                (error "Use `labels', not `flet', to rebind macro names"))
-            (let ((func (list 'function*
-                              (list 'lambda (cadr x)
-                                    (list* 'block (car x) (cddr x))))))
-              (when (cl-compiling-file)
-                ;; Bug#411.  It would be nice to fix this.
-                (and (get (car x) 'byte-compile)
-                     (error "Byte-compiling a redefinition of `%s' \
-will not work - use `labels' instead" (symbol-name (car x))))
-                ;; FIXME This affects the rest of the file, when it
-                ;; should be restricted to the flet body.
-                (and (boundp 'byte-compile-function-environment)
-                     (push (cons (car x) (eval func))
-                           byte-compile-function-environment)))
-              (list (list 'symbol-function (list 'quote (car x))) func))))
-         bindings)
-        body))
+  (declare (indent 1) (debug ((&rest (cl-defun)) cl-declarations body)))
+  (let ((binds ()) (newenv macroexpand-all-environment))
+    (dolist (binding bindings)
+      (let ((var (make-symbol (format "--cl-%s--" (car binding)))))
+       (push (list var `(cl-function (lambda . ,(cdr binding)))) binds)
+       (push (cons (car binding)
+                    `(lambda (&rest cl-labels-args)
+                       (cl-list* 'funcall ',var
+                                 cl-labels-args)))
+              newenv)))
+    `(let ,(nreverse binds)
+       ,@(macroexp-unprogn
+          (macroexpand-all
+           `(progn ,@body)
+           ;; Don't override lexical-let's macro-expander.
+           (if (assq 'function newenv) newenv
+             (cons (cons 'function #'cl--labels-convert) newenv)))))))
 
 ;;;###autoload
-(defmacro labels (bindings &rest body)
+(defmacro cl-flet* (bindings &rest body)
+  "Make temporary function definitions.
+Like `cl-flet' but the definitions can refer to previous ones.
+
+\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
+  (declare (indent 1) (debug cl-flet))
+  (cond
+   ((null bindings) (macroexp-progn body))
+   ((null (cdr bindings)) `(cl-flet ,bindings ,@body))
+   (t `(cl-flet (,(pop bindings)) (cl-flet* ,bindings ,@body)))))
+
+;;;###autoload
+(defmacro cl-labels (bindings &rest body)
   "Make temporary function bindings.
-This is like `flet', except the bindings are lexical instead of dynamic.
-Unlike `flet', this macro is fully compliant with the Common Lisp standard.
+The bindings can be recursive and the scoping is lexical, but capturing them
+in closures will only work if `lexical-binding' is in use.
 
 \(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
-  (let ((vars nil) (sets nil) (cl-macro-environment cl-macro-environment))
-    (while bindings
-      ;; Use `gensym' rather than `make-symbol'.  It's important that
-      ;; (not (eq (symbol-name var1) (symbol-name var2))) because these
-      ;; vars get added to the cl-macro-environment.
-      (let ((var (gensym "--cl-var--")))
-       (push var vars)
-       (push (list 'function* (cons 'lambda (cdar bindings))) sets)
-       (push var sets)
-       (push (list (car (pop bindings)) 'lambda '(&rest cl-labels-args)
-                      (list 'list* '(quote funcall) (list 'quote var)
-                            'cl-labels-args))
-                cl-macro-environment)))
-    (cl-macroexpand-all (list* 'lexical-let vars (cons (cons 'setq sets) body))
-                       cl-macro-environment)))
+  (declare (indent 1) (debug cl-flet))
+  (let ((binds ()) (newenv macroexpand-all-environment))
+    (dolist (binding bindings)
+      (let ((var (make-symbol (format "--cl-%s--" (car binding)))))
+       (push (list var `(cl-function (lambda . ,(cdr binding)))) binds)
+       (push (cons (car binding)
+                    `(lambda (&rest cl-labels-args)
+                       (cl-list* 'funcall ',var
+                                 cl-labels-args)))
+              newenv)))
+    (macroexpand-all `(letrec ,(nreverse binds) ,@body)
+                     ;; Don't override lexical-let's macro-expander.
+                     (if (assq 'function newenv) newenv
+                       (cons (cons 'function #'cl--labels-convert) newenv)))))
 
 ;; The following ought to have a better definition for use with newer
 ;; byte compilers.
 ;;;###autoload
-(defmacro macrolet (bindings &rest body)
+(defmacro cl-macrolet (bindings &rest body)
   "Make temporary macro definitions.
-This is like `flet', but for macros instead of functions.
+This is like `cl-flet', but for macros instead of functions.
 
 \(fn ((NAME ARGLIST BODY...) ...) FORM...)"
+  (declare (indent 1)
+           (debug
+            ((&rest (&define name (&rest arg) cl-declarations-or-string
+                             def-body))
+             cl-declarations body)))
   (if (cdr bindings)
-      (list 'macrolet
-           (list (car bindings)) (list* 'macrolet (cdr bindings) body))
+      `(cl-macrolet (,(car bindings)) (cl-macrolet ,(cdr bindings) ,@body))
     (if (null bindings) (cons 'progn body)
       (let* ((name (caar bindings))
-            (res (cl-transform-lambda (cdar bindings) name)))
+            (res (cl--transform-lambda (cdar bindings) name)))
        (eval (car res))
-       (cl-macroexpand-all (cons 'progn body)
-                           (cons (list* name 'lambda (cdr res))
-                                 cl-macro-environment))))))
+       (macroexpand-all (cons 'progn body)
+                         (cons (cons name `(lambda ,@(cdr res)))
+                               macroexpand-all-environment))))))
+
+(defconst cl--old-macroexpand
+  (if (and (boundp 'cl--old-macroexpand)
+           (eq (symbol-function 'macroexpand)
+               #'cl--sm-macroexpand))
+      cl--old-macroexpand
+    (symbol-function 'macroexpand)))
+
+(defun cl--sm-macroexpand (cl-macro &optional cl-env)
+  "Special macro expander used inside `cl-symbol-macrolet'.
+This function replaces `macroexpand' during macro expansion
+of `cl-symbol-macrolet', and does the same thing as `macroexpand'
+except that it additionally expands symbol macros."
+  (let ((macroexpand-all-environment cl-env))
+    (while
+        (progn
+          (setq cl-macro (funcall cl--old-macroexpand cl-macro cl-env))
+          (cond
+           ((symbolp cl-macro)
+            ;; Perform symbol-macro expansion.
+            (when (cdr (assq (symbol-name cl-macro) cl-env))
+              (setq cl-macro (cadr (assq (symbol-name cl-macro) cl-env)))))
+           ((eq 'setq (car-safe cl-macro))
+            ;; Convert setq to setf if required by symbol-macro expansion.
+            (let* ((args (mapcar (lambda (f) (cl--sm-macroexpand f cl-env))
+                                 (cdr cl-macro)))
+                   (p args))
+              (while (and p (symbolp (car p))) (setq p (cddr p)))
+              (if p (setq cl-macro (cons 'setf args))
+                (setq cl-macro (cons 'setq args))
+                ;; Don't loop further.
+                nil))))))
+    cl-macro))
 
 ;;;###autoload
-(defmacro symbol-macrolet (bindings &rest body)
+(defmacro cl-symbol-macrolet (bindings &rest body)
   "Make symbol macro definitions.
 Within the body FORMs, references to the variable NAME will be replaced
 by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...).
 
 \(fn ((NAME EXPANSION) ...) FORM...)"
-  (if (cdr bindings)
-      (list 'symbol-macrolet
-           (list (car bindings)) (list* 'symbol-macrolet (cdr bindings) body))
-    (if (null bindings) (cons 'progn body)
-      (cl-macroexpand-all (cons 'progn body)
-                         (cons (list (symbol-name (caar bindings))
-                                     (cadar bindings))
-                               cl-macro-environment)))))
-
-(defvar cl-closure-vars nil)
-;;;###autoload
-(defmacro lexical-let (bindings &rest body)
-  "Like `let', but lexically scoped.
-The main visible difference is that lambdas inside BODY will create
-lexical closures as in Common Lisp.
-\n(fn BINDINGS BODY)"
-  (let* ((cl-closure-vars cl-closure-vars)
-        (vars (mapcar (function
-                       (lambda (x)
-                         (or (consp x) (setq x (list x)))
-                         (push (make-symbol (format "--cl-%s--" (car x)))
-                               cl-closure-vars)
-                         (set (car cl-closure-vars) [bad-lexical-ref])
-                         (list (car x) (cadr x) (car cl-closure-vars))))
-                      bindings))
-        (ebody
-         (cl-macroexpand-all
-          (cons 'progn body)
-          (nconc (mapcar (function (lambda (x)
-                                     (list (symbol-name (car x))
-                                           (list 'symbol-value (caddr x))
-                                           t))) vars)
-                 (list '(defun . cl-defun-expander))
-                 cl-macro-environment))))
-    (if (not (get (car (last cl-closure-vars)) 'used))
-       (list 'let (mapcar (function (lambda (x)
-                                      (list (caddr x) (cadr x)))) vars)
-             (sublis (mapcar (function (lambda (x)
-                                         (cons (caddr x)
-                                               (list 'quote (caddr x)))))
-                             vars)
-                     ebody))
-      (list 'let (mapcar (function (lambda (x)
-                                    (list (caddr x)
-                                          (list 'make-symbol
-                                                (format "--%s--" (car x))))))
-                        vars)
-           (apply 'append '(setf)
-                  (mapcar (function
-                           (lambda (x)
-                             (list (list 'symbol-value (caddr x)) (cadr x))))
-                          vars))
-           ebody))))
-
-;;;###autoload
-(defmacro lexical-let* (bindings &rest body)
-  "Like `let*', but lexically scoped.
-The main visible difference is that lambdas inside BODY, and in
-successive bindings within BINDINGS, will create lexical closures
-as in Common Lisp.  This is similar to the behavior of `let*' in
-Common Lisp.
-\n(fn BINDINGS BODY)"
-  (if (null bindings) (cons 'progn body)
-    (setq bindings (reverse bindings))
-    (while bindings
-      (setq body (list (list* 'lexical-let (list (pop bindings)) body))))
-    (car body)))
-
-(defun cl-defun-expander (func &rest rest)
-  (list 'progn
-       (list 'defalias (list 'quote func)
-             (list 'function (cons 'lambda rest)))
-       (list 'quote func)))
-
+  (declare (indent 1) (debug ((&rest (symbol sexp)) cl-declarations body)))
+  (cond
+   ((cdr bindings)
+    `(cl-symbol-macrolet (,(car bindings))
+       (cl-symbol-macrolet ,(cdr bindings) ,@body)))
+   ((null bindings) (macroexp-progn body))
+   (t
+    (let ((previous-macroexpand (symbol-function 'macroexpand)))
+      (unwind-protect
+          (progn
+            (fset 'macroexpand #'cl--sm-macroexpand)
+            ;; FIXME: For N bindings, this will traverse `body' N times!
+            (macroexpand-all (cons 'progn body)
+                             (cons (list (symbol-name (caar bindings))
+                                         (cl-cadar bindings))
+                                   macroexpand-all-environment)))
+        (fset 'macroexpand previous-macroexpand))))))
 
 ;;; Multiple values.
 
 ;;;###autoload
-(defmacro multiple-value-bind (vars form &rest body)
+(defmacro cl-multiple-value-bind (vars form &rest body)
   "Collect multiple return values.
 FORM must return a list; the BODY is then executed with the first N elements
 of this list bound (`let'-style) to each of the symbols SYM in turn.  This
-is analogous to the Common Lisp `multiple-value-bind' macro, using lists to
-simulate true multiple return values.  For compatibility, (values A B C) is
+is analogous to the Common Lisp `cl-multiple-value-bind' macro, using lists to
+simulate true multiple return values.  For compatibility, (cl-values A B C) is
 a synonym for (list A B C).
 
 \(fn (SYM...) FORM BODY)"
+  (declare (indent 2) (debug ((&rest symbolp) form body)))
   (let ((temp (make-symbol "--cl-var--")) (n -1))
-    (list* 'let* (cons (list temp form)
-                      (mapcar (function
-                               (lambda (v)
-                                 (list v (list 'nth (setq n (1+ n)) temp))))
-                              vars))
-          body)))
+    `(let* ((,temp ,form)
+            ,@(mapcar (lambda (v)
+                        (list v `(nth ,(setq n (1+ n)) ,temp)))
+                      vars))
+       ,@body)))
 
 ;;;###autoload
-(defmacro multiple-value-setq (vars form)
+(defmacro cl-multiple-value-setq (vars form)
   "Collect multiple return values.
 FORM must return a list; the first N elements of this list are stored in
 each of the symbols SYM in turn.  This is analogous to the Common Lisp
-`multiple-value-setq' macro, using lists to simulate true multiple return
-values.  For compatibility, (values A B C) is a synonym for (list A B C).
+`cl-multiple-value-setq' macro, using lists to simulate true multiple return
+values.  For compatibility, (cl-values A B C) is a synonym for (list A B C).
 
 \(fn (SYM...) FORM)"
-  (cond ((null vars) (list 'progn form nil))
-       ((null (cdr vars)) (list 'setq (car vars) (list 'car form)))
+  (declare (indent 1) (debug ((&rest symbolp) form)))
+  (cond ((null vars) `(progn ,form nil))
+       ((null (cdr vars)) `(setq ,(car vars) (car ,form)))
        (t
         (let* ((temp (make-symbol "--cl-var--")) (n 0))
-          (list 'let (list (list temp form))
-                (list 'prog1 (list 'setq (pop vars) (list 'car temp))
-                      (cons 'setq (apply 'nconc
-                                         (mapcar (function
-                                                  (lambda (v)
-                                                    (list v (list
-                                                             'nth
-                                                             (setq n (1+ n))
-                                                             temp))))
-                                                 vars)))))))))
+          `(let ((,temp ,form))
+              (prog1 (setq ,(pop vars) (car ,temp))
+                (setq ,@(apply #'nconc
+                               (mapcar (lambda (v)
+                                         (list v `(nth ,(setq n (1+ n))
+                                                       ,temp)))
+                                       vars)))))))))
 
 
 ;;; Declarations.
 
 ;;;###autoload
-(defmacro locally (&rest body) (cons 'progn body))
+(defmacro cl-locally (&rest body)
+  (declare (debug t))
+  (cons 'progn body))
 ;;;###autoload
-(defmacro the (type form) form)
+(defmacro cl-the (_type form)
+  (declare (indent 1) (debug (cl-type-spec form)))
+  form)
 
 (defvar cl-proclaim-history t)    ; for future compilers
 (defvar cl-declare-stack t)       ; for future compilers
@@ -1618,7 +1810,7 @@ values.  For compatibility, (values A B C) is a synonym for (list A B C).
        ((and (eq (car-safe spec) 'warn) (boundp 'byte-compile-warnings))
         (while (setq spec (cdr spec))
           (if (consp (car spec))
-              (if (eq (cadar spec) 0)
+              (if (eq (cl-cadar spec) 0)
                    (byte-compile-disable-warning (caar spec))
                  (byte-compile-enable-warning (caar spec)))))))
   nil)
@@ -1630,15 +1822,15 @@ values.  For compatibility, (values A B C) is a synonym for (list A B C).
   (setq cl-proclaims-deferred nil))
 
 ;;;###autoload
-(defmacro declare (&rest specs)
+(defmacro cl-declare (&rest specs)
   "Declare SPECS about the current function while compiling.
 For instance
 
-  \(declare (warn 0))
+  \(cl-declare (warn 0))
 
 will turn off byte-compile warnings in the function.
 See Info node `(cl)Declarations' for details."
-  (if (cl-compiling-file)
+  (if (cl--compiling-file)
       (while specs
        (if (listp cl-declare-stack) (push (car specs) cl-declare-stack))
        (cl-do-proclaim (pop specs) nil)))
@@ -1646,498 +1838,145 @@ See Info node `(cl)Declarations' for details."
 
 
 
-;;; Generalized variables.
-
-;;;###autoload
-(defmacro define-setf-method (func args &rest body)
-  "Define a `setf' method.
-This method shows how to handle `setf's to places of the form (NAME ARGS...).
-The argument forms ARGS are bound according to ARGLIST, as if NAME were
-going to be expanded as a macro, then the BODY forms are executed and must
-return a list of five elements: a temporary-variables list, a value-forms
-list, a store-variables list (of length one), a store-form, and an access-
-form.  See `defsetf' for a simpler way to define most setf-methods.
-
-\(fn NAME ARGLIST BODY...)"
-  (append '(eval-when (compile load eval))
-         (if (stringp (car body))
-             (list (list 'put (list 'quote func) '(quote setf-documentation)
-                         (pop body))))
-         (list (cl-transform-function-property
-                func 'setf-method (cons args body)))))
-(defalias 'define-setf-expander 'define-setf-method)
-
-;;;###autoload
-(defmacro defsetf (func arg1 &rest args)
-  "Define a `setf' method.
-This macro is an easy-to-use substitute for `define-setf-method' that works
-well for simple place forms.  In the simple `defsetf' form, `setf's of
-the form (setf (NAME ARGS...) VAL) are transformed to function or macro
-calls of the form (FUNC ARGS... VAL).  Example:
-
-  (defsetf aref aset)
-
-Alternate form: (defsetf NAME ARGLIST (STORE) BODY...).
-Here, the above `setf' call is expanded by binding the argument forms ARGS
-according to ARGLIST, binding the value form VAL to STORE, then executing
-BODY, which must return a Lisp form that does the necessary `setf' operation.
-Actually, ARGLIST and STORE may be bound to temporary variables which are
-introduced automatically to preserve proper execution order of the arguments.
-Example:
-
-  (defsetf nth (n x) (v) (list 'setcar (list 'nthcdr n x) v))
-
-\(fn NAME [FUNC | ARGLIST (STORE) BODY...])"
-  (if (and (listp arg1) (consp args))
-      (let* ((largs nil) (largsr nil)
-            (temps nil) (tempsr nil)
-            (restarg nil) (rest-temps nil)
-            (store-var (car (prog1 (car args) (setq args (cdr args)))))
-            (store-temp (intern (format "--%s--temp--" store-var)))
-            (lets1 nil) (lets2 nil)
-            (docstr nil) (p arg1))
-       (if (stringp (car args))
-           (setq docstr (prog1 (car args) (setq args (cdr args)))))
-       (while (and p (not (eq (car p) '&aux)))
-         (if (eq (car p) '&rest)
-             (setq p (cdr p) restarg (car p))
-           (or (memq (car p) '(&optional &key &allow-other-keys))
-               (setq largs (cons (if (consp (car p)) (car (car p)) (car p))
-                                 largs)
-                     temps (cons (intern (format "--%s--temp--" (car largs)))
-                                 temps))))
-         (setq p (cdr p)))
-       (setq largs (nreverse largs) temps (nreverse temps))
-       (if restarg
-           (setq largsr (append largs (list restarg))
-                 rest-temps (intern (format "--%s--temp--" restarg))
-                 tempsr (append temps (list rest-temps)))
-         (setq largsr largs tempsr temps))
-       (let ((p1 largs) (p2 temps))
-         (while p1
-           (setq lets1 (cons `(,(car p2)
-                               (make-symbol ,(format "--cl-%s--" (car p1))))
-                             lets1)
-                 lets2 (cons (list (car p1) (car p2)) lets2)
-                 p1 (cdr p1) p2 (cdr p2))))
-       (if restarg (setq lets2 (cons (list restarg rest-temps) lets2)))
-       `(define-setf-method ,func ,arg1
-          ,@(and docstr (list docstr))
-          (let*
-              ,(nreverse
-                (cons `(,store-temp
-                        (make-symbol ,(format "--cl-%s--" store-var)))
-                      (if restarg
-                          `((,rest-temps
-                             (mapcar (lambda (_) (make-symbol "--cl-var--"))
-                                     ,restarg))
-                            ,@lets1)
-                        lets1)))
-            (list                      ; 'values
-             (,(if restarg 'list* 'list) ,@tempsr)
-             (,(if restarg 'list* 'list) ,@largsr)
-             (list ,store-temp)
-             (let*
-                 ,(nreverse
-                   (cons (list store-var store-temp)
-                         lets2))
-               ,@args)
-             (,(if restarg 'list* 'list)
-              ,@(cons (list 'quote func) tempsr))))))
-    `(defsetf ,func (&rest args) (store)
-       ,(let ((call `(cons ',arg1
-                          (append args (list store)))))
-         (if (car args)
-             `(list 'progn ,call store)
-           call)))))
-
-;;; Some standard place types from Common Lisp.
-(defsetf aref aset)
-(defsetf car setcar)
-(defsetf cdr setcdr)
-(defsetf caar (x) (val) (list 'setcar (list 'car x) val))
-(defsetf cadr (x) (val) (list 'setcar (list 'cdr x) val))
-(defsetf cdar (x) (val) (list 'setcdr (list 'car x) val))
-(defsetf cddr (x) (val) (list 'setcdr (list 'cdr x) val))
-(defsetf elt (seq n) (store)
-  (list 'if (list 'listp seq) (list 'setcar (list 'nthcdr n seq) store)
-       (list 'aset seq n store)))
-(defsetf get put)
-(defsetf get* (x y &optional d) (store) (list 'put x y store))
-(defsetf gethash (x h &optional d) (store) (list 'puthash x store h))
-(defsetf nth (n x) (store) (list 'setcar (list 'nthcdr n x) store))
-(defsetf subseq (seq start &optional end) (new)
-  (list 'progn (list 'replace seq new :start1 start :end1 end) new))
-(defsetf symbol-function fset)
-(defsetf symbol-plist setplist)
-(defsetf symbol-value set)
-
-;;; Various car/cdr aliases.  Note that `cadr' is handled specially.
-(defsetf first setcar)
-(defsetf second (x) (store) (list 'setcar (list 'cdr x) store))
-(defsetf third (x) (store) (list 'setcar (list 'cddr x) store))
-(defsetf fourth (x) (store) (list 'setcar (list 'cdddr x) store))
-(defsetf fifth (x) (store) (list 'setcar (list 'nthcdr 4 x) store))
-(defsetf sixth (x) (store) (list 'setcar (list 'nthcdr 5 x) store))
-(defsetf seventh (x) (store) (list 'setcar (list 'nthcdr 6 x) store))
-(defsetf eighth (x) (store) (list 'setcar (list 'nthcdr 7 x) store))
-(defsetf ninth (x) (store) (list 'setcar (list 'nthcdr 8 x) store))
-(defsetf tenth (x) (store) (list 'setcar (list 'nthcdr 9 x) store))
-(defsetf rest setcdr)
-
-;;; Some more Emacs-related place types.
-(defsetf buffer-file-name set-visited-file-name t)
-(defsetf buffer-modified-p (&optional buf) (flag)
-  (list 'with-current-buffer buf
-       (list 'set-buffer-modified-p flag)))
-(defsetf buffer-name rename-buffer t)
-(defsetf buffer-string () (store)
-  (list 'progn '(erase-buffer) (list 'insert store)))
-(defsetf buffer-substring cl-set-buffer-substring)
-(defsetf current-buffer set-buffer)
-(defsetf current-case-table set-case-table)
-(defsetf current-column move-to-column t)
-(defsetf current-global-map use-global-map t)
-(defsetf current-input-mode () (store)
-  (list 'progn (list 'apply 'set-input-mode store) store))
-(defsetf current-local-map use-local-map t)
-(defsetf current-window-configuration set-window-configuration t)
-(defsetf default-file-modes set-default-file-modes t)
-(defsetf default-value set-default)
-(defsetf documentation-property put)
-(defsetf face-background (f &optional s) (x) (list 'set-face-background f x s))
-(defsetf face-background-pixmap (f &optional s) (x)
-  (list 'set-face-background-pixmap f x s))
-(defsetf face-font (f &optional s) (x) (list 'set-face-font f x s))
-(defsetf face-foreground (f &optional s) (x) (list 'set-face-foreground f x s))
-(defsetf face-underline-p (f &optional s) (x)
-  (list 'set-face-underline-p f x s))
-(defsetf file-modes set-file-modes t)
-(defsetf frame-height set-screen-height t)
-(defsetf frame-parameters modify-frame-parameters t)
-(defsetf frame-visible-p cl-set-frame-visible-p)
-(defsetf frame-width set-screen-width t)
-(defsetf frame-parameter set-frame-parameter t)
-(defsetf terminal-parameter set-terminal-parameter)
-(defsetf getenv setenv t)
-(defsetf get-register set-register)
-(defsetf global-key-binding global-set-key)
-(defsetf keymap-parent set-keymap-parent)
-(defsetf local-key-binding local-set-key)
-(defsetf mark set-mark t)
-(defsetf mark-marker set-mark t)
-(defsetf marker-position set-marker t)
-(defsetf match-data set-match-data t)
-(defsetf mouse-position (scr) (store)
-  (list 'set-mouse-position scr (list 'car store) (list 'cadr store)
-       (list 'cddr store)))
-(defsetf overlay-get overlay-put)
-(defsetf overlay-start (ov) (store)
-  (list 'progn (list 'move-overlay ov store (list 'overlay-end ov)) store))
-(defsetf overlay-end (ov) (store)
-  (list 'progn (list 'move-overlay ov (list 'overlay-start ov) store) store))
-(defsetf point goto-char)
-(defsetf point-marker goto-char t)
-(defsetf point-max () (store)
-  (list 'progn (list 'narrow-to-region '(point-min) store) store))
-(defsetf point-min () (store)
-  (list 'progn (list 'narrow-to-region store '(point-max)) store))
-(defsetf process-buffer set-process-buffer)
-(defsetf process-filter set-process-filter)
-(defsetf process-sentinel set-process-sentinel)
-(defsetf process-get process-put)
-(defsetf read-mouse-position (scr) (store)
-  (list 'set-mouse-position scr (list 'car store) (list 'cdr store)))
-(defsetf screen-height set-screen-height t)
-(defsetf screen-width set-screen-width t)
-(defsetf selected-window select-window)
-(defsetf selected-screen select-screen)
-(defsetf selected-frame select-frame)
-(defsetf standard-case-table set-standard-case-table)
-(defsetf syntax-table set-syntax-table)
-(defsetf visited-file-modtime set-visited-file-modtime t)
-(defsetf window-buffer set-window-buffer t)
-(defsetf window-display-table set-window-display-table t)
-(defsetf window-dedicated-p set-window-dedicated-p t)
-(defsetf window-height () (store)
-  (list 'progn (list 'enlarge-window (list '- store '(window-height))) store))
-(defsetf window-hscroll set-window-hscroll)
-(defsetf window-parameter set-window-parameter)
-(defsetf window-point set-window-point)
-(defsetf window-start set-window-start)
-(defsetf window-width () (store)
-  (list 'progn (list 'enlarge-window (list '- store '(window-width)) t) store))
-(defsetf x-get-secondary-selection x-own-secondary-selection t)
-(defsetf x-get-selection x-own-selection t)
-
-;; This is a hack that allows (setf (eq a 7) B) to mean either
-;; (setq a 7) or (setq a nil) depending on whether B is nil or not.
-;; This is useful when you have control over the PLACE but not over
-;; the VALUE, as is the case in define-minor-mode's :variable.
-(define-setf-method eq (place val)
-  (let ((method (get-setf-method place cl-macro-environment))
-        (val-temp (make-symbol "--eq-val--"))
-        (store-temp (make-symbol "--eq-store--")))
-    (list (append (nth 0 method) (list val-temp))
-          (append (nth 1 method) (list val))
-          (list store-temp)
-          `(let ((,(car (nth 2 method))
-                  (if ,store-temp ,val-temp (not ,val-temp))))
-             ,(nth 3 method) ,store-temp)
-          `(eq ,(nth 4 method) ,val-temp))))
-
-;;; More complex setf-methods.
-;; These should take &environment arguments, but since full arglists aren't
-;; available while compiling cl-macs, we fake it by referring to the global
-;; variable cl-macro-environment directly.
-
-(define-setf-method apply (func arg1 &rest rest)
-  (or (and (memq (car-safe func) '(quote function function*))
-          (symbolp (car-safe (cdr-safe func))))
-      (error "First arg to apply in setf is not (function SYM): %s" func))
-  (let* ((form (cons (nth 1 func) (cons arg1 rest)))
-        (method (get-setf-method form cl-macro-environment)))
-    (list (car method) (nth 1 method) (nth 2 method)
-         (cl-setf-make-apply (nth 3 method) (cadr func) (car method))
-         (cl-setf-make-apply (nth 4 method) (cadr func) (car method)))))
-
-(defun cl-setf-make-apply (form func temps)
-  (if (eq (car form) 'progn)
-      (list* 'progn (cl-setf-make-apply (cadr form) func temps) (cddr form))
-    (or (equal (last form) (last temps))
-       (error "%s is not suitable for use with setf-of-apply" func))
-    (list* 'apply (list 'quote (car form)) (cdr form))))
-
-(define-setf-method nthcdr (n place)
-  (let ((method (get-setf-method place cl-macro-environment))
-       (n-temp (make-symbol "--cl-nthcdr-n--"))
-       (store-temp (make-symbol "--cl-nthcdr-store--")))
-    (list (cons n-temp (car method))
-         (cons n (nth 1 method))
-         (list store-temp)
-         (list 'let (list (list (car (nth 2 method))
-                                (list 'cl-set-nthcdr n-temp (nth 4 method)
-                                      store-temp)))
-               (nth 3 method) store-temp)
-         (list 'nthcdr n-temp (nth 4 method)))))
-
-(define-setf-method getf (place tag &optional def)
-  (let ((method (get-setf-method place cl-macro-environment))
-       (tag-temp (make-symbol "--cl-getf-tag--"))
-       (def-temp (make-symbol "--cl-getf-def--"))
-       (store-temp (make-symbol "--cl-getf-store--")))
-    (list (append (car method) (list tag-temp def-temp))
-         (append (nth 1 method) (list tag def))
-         (list store-temp)
-         (list 'let (list (list (car (nth 2 method))
-                                (list 'cl-set-getf (nth 4 method)
-                                      tag-temp store-temp)))
-               (nth 3 method) store-temp)
-         (list 'getf (nth 4 method) tag-temp def-temp))))
-
-(define-setf-method substring (place from &optional to)
-  (let ((method (get-setf-method place cl-macro-environment))
-       (from-temp (make-symbol "--cl-substring-from--"))
-       (to-temp (make-symbol "--cl-substring-to--"))
-       (store-temp (make-symbol "--cl-substring-store--")))
-    (list (append (car method) (list from-temp to-temp))
-         (append (nth 1 method) (list from to))
-         (list store-temp)
-         (list 'let (list (list (car (nth 2 method))
-                                (list 'cl-set-substring (nth 4 method)
-                                      from-temp to-temp store-temp)))
-               (nth 3 method) store-temp)
-         (list 'substring (nth 4 method) from-temp to-temp))))
-
-;;; Getting and optimizing setf-methods.
-;;;###autoload
-(defun get-setf-method (place &optional env)
-  "Return a list of five values describing the setf-method for PLACE.
-PLACE may be any Lisp form which can appear as the PLACE argument to
-a macro like `setf' or `incf'."
-  (if (symbolp place)
-      (let ((temp (make-symbol "--cl-setf--")))
-       (list nil nil (list temp) (list 'setq place temp) place))
-    (or (and (symbolp (car place))
-            (let* ((func (car place))
-                   (name (symbol-name func))
-                   (method (get func 'setf-method))
-                   (case-fold-search nil))
-              (or (and method
-                       (let ((cl-macro-environment env))
-                         (setq method (apply method (cdr place))))
-                       (if (and (consp method) (= (length method) 5))
-                           method
-                         (error "Setf-method for %s returns malformed method"
-                                func)))
-                  (and (string-match-p "\\`c[ad][ad][ad]?[ad]?r\\'" name)
-                       (get-setf-method (compiler-macroexpand place)))
-                  (and (eq func 'edebug-after)
-                       (get-setf-method (nth (1- (length place)) place)
-                                        env)))))
-       (if (eq place (setq place (macroexpand place env)))
-           (if (and (symbolp (car place)) (fboundp (car place))
-                    (symbolp (symbol-function (car place))))
-               (get-setf-method (cons (symbol-function (car place))
-                                      (cdr place)) env)
-             (error "No setf-method known for %s" (car place)))
-         (get-setf-method place env)))))
-
-(defun cl-setf-do-modify (place opt-expr)
-  (let* ((method (get-setf-method place cl-macro-environment))
-        (temps (car method)) (values (nth 1 method))
-        (lets nil) (subs nil)
-        (optimize (and (not (eq opt-expr 'no-opt))
-                       (or (and (not (eq opt-expr 'unsafe))
-                                (cl-safe-expr-p opt-expr))
-                           (cl-setf-simple-store-p (car (nth 2 method))
-                                                   (nth 3 method)))))
-        (simple (and optimize (consp place) (cl-simple-exprs-p (cdr place)))))
-    (while values
-      (if (or simple (cl-const-expr-p (car values)))
-         (push (cons (pop temps) (pop values)) subs)
-       (push (list (pop temps) (pop values)) lets)))
-    (list (nreverse lets)
-         (cons (car (nth 2 method)) (sublis subs (nth 3 method)))
-         (sublis subs (nth 4 method)))))
-
-(defun cl-setf-do-store (spec val)
-  (let ((sym (car spec))
-       (form (cdr spec)))
-    (if (or (cl-const-expr-p val)
-           (and (cl-simple-expr-p val) (eq (cl-expr-contains form sym) 1))
-           (cl-setf-simple-store-p sym form))
-       (subst val sym form)
-      (list 'let (list (list sym val)) form))))
-
-(defun cl-setf-simple-store-p (sym form)
-  (and (consp form) (eq (cl-expr-contains form sym) 1)
-       (eq (nth (1- (length form)) form) sym)
-       (symbolp (car form)) (fboundp (car form))
-       (not (eq (car-safe (symbol-function (car form))) 'macro))))
-
 ;;; The standard modify macros.
-;;;###autoload
-(defmacro setf (&rest args)
-  "Set each PLACE to the value of its VAL.
-This is a generalized version of `setq'; the PLACEs may be symbolic
-references such as (car x) or (aref x i), as well as plain symbols.
-For example, (setf (cadar x) y) is equivalent to (setcar (cdar x) y).
-The return value is the last VAL in the list.
 
-\(fn PLACE VAL PLACE VAL ...)"
-  (if (cdr (cdr args))
-      (let ((sets nil))
-       (while args (push (list 'setf (pop args) (pop args)) sets))
-       (cons 'progn (nreverse sets)))
-    (if (symbolp (car args))
-       (and args (cons 'setq args))
-      (let* ((method (cl-setf-do-modify (car args) (nth 1 args)))
-            (store (cl-setf-do-store (nth 1 method) (nth 1 args))))
-       (if (car method) (list 'let* (car method) store) store)))))
+;; `setf' is now part of core Elisp, defined in gv.el.
 
 ;;;###autoload
-(defmacro psetf (&rest args)
+(defmacro cl-psetf (&rest args)
   "Set PLACEs to the values VALs in parallel.
 This is like `setf', except that all VAL forms are evaluated (in order)
 before assigning any PLACEs to the corresponding values.
 
 \(fn PLACE VAL PLACE VAL ...)"
+  (declare (debug setf))
   (let ((p args) (simple t) (vars nil))
     (while p
-      (if (or (not (symbolp (car p))) (cl-expr-depends-p (nth 1 p) vars))
+      (if (or (not (symbolp (car p))) (cl--expr-depends-p (nth 1 p) vars))
          (setq simple nil))
       (if (memq (car p) vars)
          (error "Destination duplicated in psetf: %s" (car p)))
       (push (pop p) vars)
-      (or p (error "Odd number of arguments to psetf"))
+      (or p (error "Odd number of arguments to cl-psetf"))
       (pop p))
     (if simple
-       (list 'progn (cons 'setf args) nil)
+       `(progn (setf ,@args) nil)
       (setq args (reverse args))
-      (let ((expr (list 'setf (cadr args) (car args))))
+      (let ((expr `(setf ,(cadr args) ,(car args))))
        (while (setq args (cddr args))
-         (setq expr (list 'setf (cadr args) (list 'prog1 (car args) expr))))
-       (list 'progn expr nil)))))
-
-;;;###autoload
-(defun cl-do-pop (place)
-  (if (cl-simple-expr-p place)
-      (list 'prog1 (list 'car place) (list 'setf place (list 'cdr place)))
-    (let* ((method (cl-setf-do-modify place t))
-          (temp (make-symbol "--cl-pop--")))
-      (list 'let*
-           (append (car method)
-                   (list (list temp (nth 2 method))))
-           (list 'prog1
-                 (list 'car temp)
-                 (cl-setf-do-store (nth 1 method) (list 'cdr temp)))))))
+         (setq expr `(setf ,(cadr args) (prog1 ,(car args) ,expr))))
+       `(progn ,expr nil)))))
 
 ;;;###autoload
-(defmacro remf (place tag)
+(defmacro cl-remf (place tag)
   "Remove TAG from property list PLACE.
 PLACE may be a symbol, or any generalized variable allowed by `setf'.
 The form returns true if TAG was found and removed, nil otherwise."
-  (let* ((method (cl-setf-do-modify place t))
-        (tag-temp (and (not (cl-const-expr-p tag)) (make-symbol "--cl-remf-tag--")))
-        (val-temp (and (not (cl-simple-expr-p place))
-                       (make-symbol "--cl-remf-place--")))
-        (ttag (or tag-temp tag))
-        (tval (or val-temp (nth 2 method))))
-    (list 'let*
-         (append (car method)
-                 (and val-temp (list (list val-temp (nth 2 method))))
-                 (and tag-temp (list (list tag-temp tag))))
-         (list 'if (list 'eq ttag (list 'car tval))
-               (list 'progn
-                     (cl-setf-do-store (nth 1 method) (list 'cddr tval))
-                     t)
-               (list 'cl-do-remf tval ttag)))))
+  (declare (debug (place form)))
+  (gv-letplace (tval setter) place
+    (macroexp-let2 macroexp-copyable-p ttag tag
+      `(if (eq ,ttag (car ,tval))
+           (progn ,(funcall setter `(cddr ,tval))
+                  t)
+         (cl--do-remf ,tval ,ttag)))))
 
 ;;;###autoload
-(defmacro shiftf (place &rest args)
+(defmacro cl-shiftf (place &rest args)
   "Shift left among PLACEs.
-Example: (shiftf A B C) sets A to B, B to C, and returns the old A.
+Example: (cl-shiftf A B C) sets A to B, B to C, and returns the old A.
 Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
 
 \(fn PLACE... VAL)"
+  (declare (debug (&rest place)))
   (cond
    ((null args) place)
-   ((symbolp place) `(prog1 ,place (setq ,place (shiftf ,@args))))
+   ((symbolp place) `(prog1 ,place (setq ,place (cl-shiftf ,@args))))
    (t
-    (let ((method (cl-setf-do-modify place 'unsafe)))
-      `(let* ,(car method)
-        (prog1 ,(nth 2 method)
-          ,(cl-setf-do-store (nth 1 method) `(shiftf ,@args))))))))
+    (gv-letplace (getter setter) place
+      `(prog1 ,getter
+         ,(funcall setter `(cl-shiftf ,@args)))))))
 
 ;;;###autoload
-(defmacro rotatef (&rest args)
+(defmacro cl-rotatef (&rest args)
   "Rotate left among PLACEs.
-Example: (rotatef A B C) sets A to B, B to C, and C to A.  It returns nil.
+Example: (cl-rotatef A B C) sets A to B, B to C, and C to A.  It returns nil.
 Each PLACE may be a symbol, or any generalized variable allowed by `setf'.
 
 \(fn PLACE...)"
+  (declare (debug (&rest place)))
   (if (not (memq nil (mapcar 'symbolp args)))
       (and (cdr args)
           (let ((sets nil)
                 (first (car args)))
             (while (cdr args)
               (setq sets (nconc sets (list (pop args) (car args)))))
-            (nconc (list 'psetf) sets (list (car args) first))))
+            `(cl-psetf ,@sets ,(car args) ,first)))
     (let* ((places (reverse args))
           (temp (make-symbol "--cl-rotatef--"))
           (form temp))
       (while (cdr places)
-       (let ((method (cl-setf-do-modify (pop places) 'unsafe)))
-         (setq form (list 'let* (car method)
-                          (list 'prog1 (nth 2 method)
-                                (cl-setf-do-store (nth 1 method) form))))))
-      (let ((method (cl-setf-do-modify (car places) 'unsafe)))
-       (list 'let* (append (car method) (list (list temp (nth 2 method))))
-             (cl-setf-do-store (nth 1 method) form) nil)))))
+        (setq form
+              (gv-letplace (getter setter) (pop places)
+                `(prog1 ,getter ,(funcall setter form)))))
+      (gv-letplace (getter setter) (car places)
+       (macroexp-let* `((,temp ,getter))
+                       `(progn ,(funcall setter form) nil))))))
+
+;; FIXME: `letf' is unsatisfactory because it does not really "restore" the
+;; previous state.  If the getter/setter loses information, that info is
+;; not recovered.
+
+(defun cl--letf (bindings simplebinds binds body)
+  ;; It's not quite clear what the semantics of cl-letf should be.
+  ;; E.g. in (cl-letf ((PLACE1 VAL1) (PLACE2 VAL2)) BODY), while it's clear
+  ;; that the actual assignments ("bindings") should only happen after
+  ;; evaluating VAL1 and VAL2, it's not clear when the sub-expressions of
+  ;; PLACE1 and PLACE2 should be evaluated.  Should we have
+  ;;    PLACE1; VAL1; PLACE2; VAL2; bind1; bind2
+  ;; or
+  ;;    VAL1; VAL2; PLACE1; PLACE2; bind1; bind2
+  ;; or
+  ;;    VAL1; VAL2; PLACE1; bind1; PLACE2; bind2
+  ;; Common-Lisp's `psetf' does the first, so we'll do the same.
+  (if (null bindings)
+      (if (and (null binds) (null simplebinds)) (macroexp-progn body)
+        `(let* (,@(mapcar (lambda (x)
+                            (pcase-let ((`(,vold ,getter ,_setter ,_vnew) x))
+                              (list vold getter)))
+                          binds)
+                ,@simplebinds)
+           (unwind-protect
+               ,(macroexp-progn
+                 (append
+                  (delq nil
+                        (mapcar (lambda (x)
+                                  (pcase x
+                                    ;; If there's no vnew, do nothing.
+                                    (`(,_vold ,_getter ,setter ,vnew)
+                                     (funcall setter vnew))))
+                                binds))
+                  body))
+             ,@(mapcar (lambda (x)
+                         (pcase-let ((`(,vold ,_getter ,setter ,_vnew) x))
+                           (funcall setter vold)))
+                       binds))))
+    (let ((binding (car bindings)))
+      (gv-letplace (getter setter) (car binding)
+        (macroexp-let2 nil vnew (cadr binding)
+          (if (symbolp (car binding))
+              ;; Special-case for simple variables.
+              (cl--letf (cdr bindings)
+                        (cons `(,getter ,(if (cdr binding) vnew getter))
+                              simplebinds)
+                        binds body)
+            (cl--letf (cdr bindings) simplebinds
+                      (cons `(,(make-symbol "old") ,getter ,setter
+                              ,@(if (cdr binding) (list vnew)))
+                            binds)
+                      body)))))))
 
 ;;;###autoload
-(defmacro letf (bindings &rest body)
+(defmacro cl-letf (bindings &rest body)
   "Temporarily bind to PLACEs.
 This is the analogue of `let', but with generalized variables (in the
 sense of `setf') for the PLACEs.  Each PLACE is set to the corresponding
@@ -2148,119 +1987,53 @@ As a special case, if `(PLACE)' is used instead of `(PLACE VALUE)',
 the PLACE is not modified before executing BODY.
 
 \(fn ((PLACE VALUE) ...) BODY...)"
+  (declare (indent 1) (debug ((&rest (gate gv-place &optional form)) body)))
   (if (and (not (cdr bindings)) (cdar bindings) (symbolp (caar bindings)))
-      (list* 'let bindings body)
-    (let ((lets nil) (sets nil)
-         (unsets nil) (rev (reverse bindings)))
-      (while rev
-       (let* ((place (if (symbolp (caar rev))
-                         (list 'symbol-value (list 'quote (caar rev)))
-                       (caar rev)))
-              (value (cadar rev))
-              (method (cl-setf-do-modify place 'no-opt))
-              (save (make-symbol "--cl-letf-save--"))
-              (bound (and (memq (car place) '(symbol-value symbol-function))
-                          (make-symbol "--cl-letf-bound--")))
-              (temp (and (not (cl-const-expr-p value)) (cdr bindings)
-                         (make-symbol "--cl-letf-val--"))))
-         (setq lets (nconc (car method)
-                           (if bound
-                               (list (list bound
-                                           (list (if (eq (car place)
-                                                         'symbol-value)
-                                                     'boundp 'fboundp)
-                                                 (nth 1 (nth 2 method))))
-                                     (list save (list 'and bound
-                                                      (nth 2 method))))
-                             (list (list save (nth 2 method))))
-                           (and temp (list (list temp value)))
-                           lets)
-               body (list
-                     (list 'unwind-protect
-                           (cons 'progn
-                                 (if (cdr (car rev))
-                                     (cons (cl-setf-do-store (nth 1 method)
-                                                             (or temp value))
-                                           body)
-                                   body))
-                           (if bound
-                               (list 'if bound
-                                     (cl-setf-do-store (nth 1 method) save)
-                                     (list (if (eq (car place) 'symbol-value)
-                                               'makunbound 'fmakunbound)
-                                           (nth 1 (nth 2 method))))
-                             (cl-setf-do-store (nth 1 method) save))))
-               rev (cdr rev))))
-      (list* 'let* lets body))))
+      `(let ,bindings ,@body)
+    (cl--letf bindings () () body)))
 
 ;;;###autoload
-(defmacro letf* (bindings &rest body)
+(defmacro cl-letf* (bindings &rest body)
   "Temporarily bind to PLACEs.
-This is the analogue of `let*', but with generalized variables (in the
-sense of `setf') for the PLACEs.  Each PLACE is set to the corresponding
-VALUE, then the BODY forms are executed.  On exit, either normally or
-because of a `throw' or error, the PLACEs are set back to their original
-values.  Note that this macro is *not* available in Common Lisp.
-As a special case, if `(PLACE)' is used instead of `(PLACE VALUE)',
-the PLACE is not modified before executing BODY.
-
-\(fn ((PLACE VALUE) ...) BODY...)"
-  (if (null bindings)
-      (cons 'progn body)
-    (setq bindings (reverse bindings))
-    (while bindings
-      (setq body (list (list* 'letf (list (pop bindings)) body))))
-    (car body)))
+Like `cl-letf' but where the bindings are performed one at a time,
+rather than all at the end (i.e. like `let*' rather than like `let')."
+  (declare (indent 1) (debug cl-letf))
+  (dolist (binding (reverse bindings))
+    (setq body (list `(cl-letf (,binding) ,@body))))
+  (macroexp-progn body))
 
 ;;;###autoload
-(defmacro callf (func place &rest args)
+(defmacro cl-callf (func place &rest args)
   "Set PLACE to (FUNC PLACE ARGS...).
 FUNC should be an unquoted function name.  PLACE may be a symbol,
-or any generalized variable allowed by `setf'.
-
-\(fn FUNC PLACE ARGS...)"
-  (let* ((method (cl-setf-do-modify place (cons 'list args)))
-        (rargs (cons (nth 2 method) args)))
-    (list 'let* (car method)
-         (cl-setf-do-store (nth 1 method)
-                           (if (symbolp func) (cons func rargs)
-                             (list* 'funcall (list 'function func)
-                                    rargs))))))
+or any generalized variable allowed by `setf'."
+  (declare (indent 2) (debug (cl-function place &rest form)))
+  (gv-letplace (getter setter) place
+    (let* ((rargs (cons getter args)))
+      (funcall setter
+               (if (symbolp func) (cons func rargs)
+                 `(funcall #',func ,@rargs))))))
 
 ;;;###autoload
-(defmacro callf2 (func arg1 place &rest args)
+(defmacro cl-callf2 (func arg1 place &rest args)
   "Set PLACE to (FUNC ARG1 PLACE ARGS...).
-Like `callf', but PLACE is the second argument of FUNC, not the first.
+Like `cl-callf', but PLACE is the second argument of FUNC, not the first.
 
 \(fn FUNC ARG1 PLACE ARGS...)"
-  (if (and (cl-safe-expr-p arg1) (cl-simple-expr-p place) (symbolp func))
-      (list 'setf place (list* func arg1 place args))
-    (let* ((method (cl-setf-do-modify place (cons 'list args)))
-          (temp (and (not (cl-const-expr-p arg1)) (make-symbol "--cl-arg1--")))
-          (rargs (list* (or temp arg1) (nth 2 method) args)))
-      (list 'let* (append (and temp (list (list temp arg1))) (car method))
-           (cl-setf-do-store (nth 1 method)
-                             (if (symbolp func) (cons func rargs)
-                               (list* 'funcall (list 'function func)
-                                      rargs)))))))
-
-;;;###autoload
-(defmacro define-modify-macro (name arglist func &optional doc)
-  "Define a `setf'-like modify macro.
-If NAME is called, it combines its PLACE argument with the other arguments
-from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)"
-  (if (memq '&key arglist) (error "&key not allowed in define-modify-macro"))
-  (let ((place (make-symbol "--cl-place--")))
-    (list 'defmacro* name (cons place arglist) doc
-         (list* (if (memq '&rest arglist) 'list* 'list)
-                '(quote callf) (list 'quote func) place
-                (cl-arglist-args arglist)))))
-
+  (declare (indent 3) (debug (cl-function form place &rest form)))
+  (if (and (cl--safe-expr-p arg1) (cl--simple-expr-p place) (symbolp func))
+      `(setf ,place (,func ,arg1 ,place ,@args))
+    (macroexp-let2 nil a1 arg1
+      (gv-letplace (getter setter) place
+        (let* ((rargs (cl-list* a1 getter args)))
+          (funcall setter
+                   (if (symbolp func) (cons func rargs)
+                     `(funcall #',func ,@rargs))))))))
 
 ;;; Structures.
 
 ;;;###autoload
-(defmacro defstruct (struct &rest descs)
+(defmacro cl-defstruct (struct &rest descs)
   "Define a struct type.
 This macro defines a new data type called NAME that stores data
 in SLOTs.  It defines a `make-NAME' constructor, a `copy-NAME'
@@ -2277,6 +2050,26 @@ one keyword is supported, `:read-only'.  If this has a non-nil
 value, that slot cannot be set via `setf'.
 
 \(fn NAME SLOTS...)"
+  (declare (doc-string 2)
+           (debug
+            (&define                    ;Makes top-level form not be wrapped.
+             [&or symbolp
+                  (gate
+                   symbolp &rest
+                   (&or [":conc-name" symbolp]
+                        [":constructor" symbolp &optional cl-lambda-list]
+                        [":copier" symbolp]
+                        [":predicate" symbolp]
+                        [":include" symbolp &rest sexp] ;; Not finished.
+                        ;; The following are not supported.
+                        ;; [":print-function" ...]
+                        ;; [":type" ...]
+                        ;; [":initial-offset" ...]
+                        ))]
+             [&optional stringp]
+             ;; All the above is for the following def-form.
+             &rest &or symbolp (symbolp def-form
+                                        &optional ":read-only" sexp))))
   (let* ((name (if (consp struct) (car struct) struct))
         (opts (cdr-safe struct))
         (slots nil)
@@ -2287,7 +2080,7 @@ value, that slot cannot be set via `setf'.
         (copier (intern (format "copy-%s" name)))
         (predicate (intern (format "%s-p" name)))
         (print-func nil) (print-auto nil)
-        (safety (if (cl-compiling-file) cl-optimize-safety 3))
+        (safety (if (cl--compiling-file) cl-optimize-safety 3))
         (include nil)
         (tag (intern (format "cl-struct-%s" name)))
         (tag-symbol (intern (format "cl-struct-%s-tags" name)))
@@ -2298,8 +2091,8 @@ value, that slot cannot be set via `setf'.
         (forms nil)
         pred-form pred-check)
     (if (stringp (car descs))
-       (push (list 'put (list 'quote name) '(quote structure-documentation)
-                      (pop descs)) forms))
+       (push `(put ',name 'structure-documentation
+                    ,(pop descs)) forms))
     (setq descs (cons '(cl-tag-slot)
                      (mapcar (function (lambda (x) (if (consp x) x (list x))))
                              descs)))
@@ -2341,15 +2134,13 @@ value, that slot cannot be set via `setf'.
              (t
               (error "Slot option %s unrecognized" opt)))))
     (if print-func
-       (setq print-func (list 'progn
-                              (list 'funcall (list 'function print-func)
-                                    'cl-x 'cl-s 'cl-n) t))
+       (setq print-func
+              `(progn (funcall #',print-func cl-x cl-s cl-n) t))
       (or type (and include (not (get include 'cl-struct-print)))
          (setq print-auto t
                print-func (and (or (not (or include type)) (null print-func))
-                               (list 'progn
-                                     (list 'princ (format "#S(%s" name)
-                                           'cl-s))))))
+                               `(progn
+                                   (princ ,(format "#S(%s" name) cl-s))))))
     (if include
        (let ((inc-type (get include 'cl-struct-type))
              (old-descs (get include 'cl-struct-slots)))
@@ -2368,9 +2159,9 @@ value, that slot cannot be set via `setf'.
          (if (cadr inc-type) (setq tag name named t))
          (let ((incl include))
            (while incl
-             (push (list 'pushnew (list 'quote tag)
-                            (intern (format "cl-struct-%s-tags" incl)))
-                      forms)
+             (push `(cl-pushnew ',tag
+                              ,(intern (format "cl-struct-%s-tags" incl)))
+                    forms)
              (setq incl (get incl 'cl-struct-include)))))
       (if type
          (progn
@@ -2379,25 +2170,23 @@ value, that slot cannot be set via `setf'.
            (if named (setq tag name)))
        (setq type 'vector named 'true)))
     (or named (setq descs (delq (assq 'cl-tag-slot descs) descs)))
-    (push (list 'defvar tag-symbol) forms)
+    (push `(defvar ,tag-symbol) forms)
     (setq pred-form (and named
                         (let ((pos (- (length descs)
                                       (length (memq (assq 'cl-tag-slot descs)
                                                     descs)))))
                           (if (eq type 'vector)
-                              (list 'and '(vectorp cl-x)
-                                    (list '>= '(length cl-x) (length descs))
-                                    (list 'memq (list 'aref 'cl-x pos)
-                                          tag-symbol))
+                              `(and (vectorp cl-x)
+                                    (>= (length cl-x) ,(length descs))
+                                    (memq (aref cl-x ,pos) ,tag-symbol))
                             (if (= pos 0)
-                                (list 'memq '(car-safe cl-x) tag-symbol)
-                              (list 'and '(consp cl-x)
-                                    (list 'memq (list 'nth pos 'cl-x)
-                                          tag-symbol))))))
+                                `(memq (car-safe cl-x) ,tag-symbol)
+                              `(and (consp cl-x)
+                                    (memq (nth ,pos cl-x) ,tag-symbol))))))
          pred-check (and pred-form (> safety 0)
-                         (if (and (eq (caadr pred-form) 'vectorp)
+                         (if (and (eq (cl-caadr pred-form) 'vectorp)
                                   (= safety 1))
-                             (cons 'and (cdddr pred-form)) pred-form)))
+                             (cons 'and (cl-cdddr pred-form)) pred-form)))
     (let ((pos 0) (descp descs))
       (while descp
        (let* ((desc (pop descp))
@@ -2405,54 +2194,57 @@ value, that slot cannot be set via `setf'.
          (if (memq slot '(cl-tag-slot cl-skip-slot))
              (progn
                (push nil slots)
-               (push (and (eq slot 'cl-tag-slot) (list 'quote tag))
+               (push (and (eq slot 'cl-tag-slot) `',tag)
                         defaults))
            (if (assq slot descp)
                (error "Duplicate slots named %s in %s" slot name))
            (let ((accessor (intern (format "%s%s" conc-name slot))))
              (push slot slots)
              (push (nth 1 desc) defaults)
-             (push (list*
-                       'defsubst* accessor '(cl-x)
-                       (append
-                        (and pred-check
-                             (list (list 'or pred-check
-                                         `(error "%s accessing a non-%s"
-                                                 ',accessor ',name))))
-                        (list (if (eq type 'vector) (list 'aref 'cl-x pos)
-                                (if (= pos 0) '(car cl-x)
-                                  (list 'nth pos 'cl-x)))))) forms)
+             (push `(cl-defsubst ,accessor (cl-x)
+                       ,@(and pred-check
+                             (list `(or ,pred-check
+                                         (error "%s accessing a non-%s"
+                                                ',accessor ',name))))
+                       ,(if (eq type 'vector) `(aref cl-x ,pos)
+                          (if (= pos 0) '(car cl-x)
+                            `(nth ,pos cl-x)))) forms)
              (push (cons accessor t) side-eff)
-             (push (list 'define-setf-method accessor '(cl-x)
-                            (if (cadr (memq :read-only (cddr desc)))
-                                 (list 'progn '(ignore cl-x)
-                                       `(error "%s is a read-only slot"
-                                              ',accessor))
-                              ;; If cl is loaded only for compilation,
-                              ;; the call to cl-struct-setf-expander would
-                              ;; cause a warning because it may not be
-                              ;; defined at run time.  Suppress that warning.
-                              (list 'with-no-warnings
-                                    (list 'cl-struct-setf-expander 'cl-x
-                                          (list 'quote name) (list 'quote accessor)
-                                          (and pred-check (list 'quote pred-check))
-                                          pos))))
-                      forms)
+              ;; Don't bother defining a setf-expander, since gv-get can use
+              ;; the compiler macro to get the same result.
+              ;;(push `(gv-define-setter ,accessor (cl-val cl-x)
+              ;;         ,(if (cadr (memq :read-only (cddr desc)))
+              ;;              `(progn (ignore cl-x cl-val)
+              ;;                      (error "%s is a read-only slot"
+              ;;                             ',accessor))
+              ;;            ;; If cl is loaded only for compilation,
+              ;;            ;; the call to cl--struct-setf-expander would
+              ;;            ;; cause a warning because it may not be
+              ;;            ;; defined at run time.  Suppress that warning.
+              ;;            `(progn
+              ;;               (declare-function
+              ;;                cl--struct-setf-expander "cl-macs"
+              ;;                (x name accessor pred-form pos))
+              ;;               (cl--struct-setf-expander
+              ;;                cl-val cl-x ',name ',accessor
+              ;;                ,(and pred-check `',pred-check)
+              ;;                ,pos))))
+              ;;      forms)
              (if print-auto
                  (nconc print-func
-                        (list (list 'princ (format " %s" slot) 'cl-s)
-                              (list 'prin1 (list accessor 'cl-x) 'cl-s)))))))
+                        (list `(princ ,(format " %s" slot) cl-s)
+                              `(prin1 (,accessor cl-x) cl-s)))))))
        (setq pos (1+ pos))))
     (setq slots (nreverse slots)
          defaults (nreverse defaults))
     (and predicate pred-form
-        (progn (push (list 'defsubst* predicate '(cl-x)
-                              (if (eq (car pred-form) 'and)
-                                  (append pred-form '(t))
-                                (list 'and pred-form t))) forms)
+        (progn (push `(cl-defsubst ,predicate (cl-x)
+                         ,(if (eq (car pred-form) 'and)
+                              (append pred-form '(t))
+                            `(and ,pred-form t))) forms)
                (push (cons predicate 'error-free) side-eff)))
     (and copier
-        (progn (push (list 'defun copier '(x) '(copy-sequence x)) forms)
+        (progn (push `(defun ,copier (x) (copy-sequence x)) forms)
                (push (cons copier t) side-eff)))
     (if constructor
        (push (list constructor
@@ -2461,85 +2253,60 @@ value, that slot cannot be set via `setf'.
     (while constrs
       (let* ((name (caar constrs))
             (args (cadr (pop constrs)))
-            (anames (cl-arglist-args args))
-            (make (mapcar* (function (lambda (s d) (if (memq s anames) s d)))
+            (anames (cl--arglist-args args))
+            (make (cl-mapcar (function (lambda (s d) (if (memq s anames) s d)))
                            slots defaults)))
-       (push (list 'defsubst* name
-                      (list* '&cl-defs (list 'quote (cons nil descs)) args)
-                      (cons type make)) forms)
-       (if (cl-safe-expr-p (cons 'progn (mapcar 'second descs)))
+       (push `(cl-defsubst ,name
+                 (&cl-defs '(nil ,@descs) ,@args)
+                 (,type ,@make)) forms)
+       (if (cl--safe-expr-p `(progn ,@(mapcar #'cl-second descs)))
            (push (cons name t) side-eff))))
     (if print-auto (nconc print-func (list '(princ ")" cl-s) t)))
-    (if print-func
-       (push `(push
-                ;; The auto-generated function does not pay attention to
-                ;; the depth argument cl-n.
-                (lambda (cl-x cl-s ,(if print-auto '_cl-n 'cl-n))
-                  (and ,pred-form ,print-func))
-                custom-print-functions)
-              forms))
-    (push (list 'setq tag-symbol (list 'list (list 'quote tag))) forms)
-    (push (list* 'eval-when '(compile load eval)
-                   (list 'put (list 'quote name) '(quote cl-struct-slots)
-                         (list 'quote descs))
-                   (list 'put (list 'quote name) '(quote cl-struct-type)
-                         (list 'quote (list type (eq named t))))
-                   (list 'put (list 'quote name) '(quote cl-struct-include)
-                         (list 'quote include))
-                   (list 'put (list 'quote name) '(quote cl-struct-print)
-                         print-auto)
-                   (mapcar (function (lambda (x)
-                                       (list 'put (list 'quote (car x))
-                                             '(quote side-effect-free)
-                                             (list 'quote (cdr x)))))
-                           side-eff))
-            forms)
-    (cons 'progn (nreverse (cons (list 'quote name) forms)))))
-
-;;;###autoload
-(defun cl-struct-setf-expander (x name accessor pred-form pos)
-  (let* ((temp (make-symbol "--cl-x--")) (store (make-symbol "--cl-store--")))
-    (list (list temp) (list x) (list store)
-         (append '(progn)
-                 (and pred-form
-                      (list (list 'or (subst temp 'cl-x pred-form)
-                                  (list 'error
-                                        (format
-                                         "%s storing a non-%s" accessor name)))))
-                 (list (if (eq (car (get name 'cl-struct-type)) 'vector)
-                           (list 'aset temp pos store)
-                         (list 'setcar
-                               (if (<= pos 5)
-                                   (let ((xx temp))
-                                     (while (>= (setq pos (1- pos)) 0)
-                                       (setq xx (list 'cdr xx)))
-                                     xx)
-                                 (list 'nthcdr pos temp))
-                               store))))
-         (list accessor temp))))
-
+    ;; Don't bother adding to cl-custom-print-functions since it's not used
+    ;; by anything anyway!
+    ;;(if print-func
+    ;;    (push `(if (boundp 'cl-custom-print-functions)
+    ;;               (push
+    ;;                ;; The auto-generated function does not pay attention to
+    ;;                ;; the depth argument cl-n.
+    ;;                (lambda (cl-x cl-s ,(if print-auto '_cl-n 'cl-n))
+    ;;                  (and ,pred-form ,print-func))
+    ;;                cl-custom-print-functions))
+    ;;          forms))
+    (push `(setq ,tag-symbol (list ',tag)) forms)
+    (push `(cl-eval-when (compile load eval)
+             (put ',name 'cl-struct-slots ',descs)
+             (put ',name 'cl-struct-type ',(list type (eq named t)))
+             (put ',name 'cl-struct-include ',include)
+             (put ',name 'cl-struct-print ,print-auto)
+             ,@(mapcar (lambda (x)
+                         `(put ',(car x) 'side-effect-free ',(cdr x)))
+                       side-eff))
+          forms)
+    `(progn ,@(nreverse (cons `',name forms)))))
 
 ;;; Types and assertions.
 
 ;;;###autoload
-(defmacro deftype (name arglist &rest body)
+(defmacro cl-deftype (name arglist &rest body)
   "Define NAME as a new data type.
-The type name can then be used in `typecase', `check-type', etc."
-  (list 'eval-when '(compile load eval)
-       (cl-transform-function-property
-        name 'cl-deftype-handler (cons (list* '&cl-defs ''('*) arglist) body))))
+The type name can then be used in `cl-typecase', `cl-check-type', etc."
+  (declare (debug cl-defmacro) (doc-string 3))
+  `(cl-eval-when (compile load eval)
+     (put ',name 'cl-deftype-handler
+          (cl-function (lambda (&cl-defs '('*) ,@arglist) ,@body)))))
 
-(defun cl-make-type-test (val type)
+(defun cl--make-type-test (val type)
   (if (symbolp type)
       (cond ((get type 'cl-deftype-handler)
-            (cl-make-type-test val (funcall (get type 'cl-deftype-handler))))
+            (cl--make-type-test val (funcall (get type 'cl-deftype-handler))))
            ((memq type '(nil t)) type)
            ((eq type 'null) `(null ,val))
            ((eq type 'atom) `(atom ,val))
-           ((eq type 'float) `(floatp-safe ,val))
+           ((eq type 'float) `(cl-floatp-safe ,val))
            ((eq type 'real) `(numberp ,val))
            ((eq type 'fixnum) `(integerp ,val))
-           ;; FIXME: Should `character' accept things like ?\C-\M-a ?  -stef
+           ;; FIXME: Should `character' accept things like ?\C-\M-a ?  --Stef
            ((memq type '(character string-char)) `(characterp ,val))
            (t
             (let* ((name (symbol-name type))
@@ -2547,73 +2314,77 @@ The type name can then be used in `typecase', `check-type', etc."
               (if (fboundp namep) (list namep val)
                 (list (intern (concat name "-p")) val)))))
     (cond ((get (car type) 'cl-deftype-handler)
-          (cl-make-type-test val (apply (get (car type) 'cl-deftype-handler)
+          (cl--make-type-test val (apply (get (car type) 'cl-deftype-handler)
                                         (cdr type))))
          ((memq (car type) '(integer float real number))
-          (delq t (list 'and (cl-make-type-test val (car type))
-                        (if (memq (cadr type) '(* nil)) t
-                          (if (consp (cadr type)) (list '> val (caadr type))
-                            (list '>= val (cadr type))))
-                        (if (memq (caddr type) '(* nil)) t
-                          (if (consp (caddr type)) (list '< val (caaddr type))
-                            (list '<= val (caddr type)))))))
+          (delq t `(and ,(cl--make-type-test val (car type))
+                        ,(if (memq (cadr type) '(* nil)) t
+                            (if (consp (cadr type)) `(> ,val ,(cl-caadr type))
+                              `(>= ,val ,(cadr type))))
+                        ,(if (memq (cl-caddr type) '(* nil)) t
+                            (if (consp (cl-caddr type)) `(< ,val ,(cl-caaddr type))
+                              `(<= ,val ,(cl-caddr type)))))))
          ((memq (car type) '(and or not))
           (cons (car type)
-                (mapcar (function (lambda (x) (cl-make-type-test val x)))
+                (mapcar (function (lambda (x) (cl--make-type-test val x)))
                         (cdr type))))
-         ((memq (car type) '(member member*))
-          (list 'and (list 'member* val (list 'quote (cdr type))) t))
+         ((memq (car type) '(member cl-member))
+          `(and (cl-member ,val ',(cdr type)) t))
          ((eq (car type) 'satisfies) (list (cadr type) val))
          (t (error "Bad type spec: %s" type)))))
 
+(defvar cl--object)
 ;;;###autoload
-(defun typep (object type)   ; See compiler macro below.
+(defun cl-typep (object type)   ; See compiler macro below.
   "Check that OBJECT is of type TYPE.
 TYPE is a Common Lisp-style type specifier."
-  (eval (cl-make-type-test 'object type)))
+  (let ((cl--object object)) ;; Yuck!!
+    (eval (cl--make-type-test 'cl--object type))))
 
 ;;;###autoload
-(defmacro check-type (form type &optional string)
+(defmacro cl-check-type (form type &optional string)
   "Verify that FORM is of type TYPE; signal an error if not.
 STRING is an optional description of the desired type."
-  (and (or (not (cl-compiling-file))
+  (declare (debug (place cl-type-spec &optional stringp)))
+  (and (or (not (cl--compiling-file))
           (< cl-optimize-speed 3) (= cl-optimize-safety 3))
-       (let* ((temp (if (cl-simple-expr-p form 3)
+       (let* ((temp (if (cl--simple-expr-p form 3)
                        form (make-symbol "--cl-var--")))
-             (body (list 'or (cl-make-type-test temp type)
-                         (list 'signal '(quote wrong-type-argument)
-                               (list 'list (or string (list 'quote type))
-                                     temp (list 'quote form))))))
-        (if (eq temp form) (list 'progn body nil)
-          (list 'let (list (list temp form)) body nil)))))
+             (body `(or ,(cl--make-type-test temp type)
+                         (signal 'wrong-type-argument
+                                 (list ,(or string `',type)
+                                       ,temp ',form)))))
+        (if (eq temp form) `(progn ,body nil)
+          `(let ((,temp ,form)) ,body nil)))))
 
 ;;;###autoload
-(defmacro assert (form &optional show-args string &rest args)
+(defmacro cl-assert (form &optional show-args string &rest args)
+  ;; FIXME: This is actually not compatible with Common-Lisp's `assert'.
   "Verify that FORM returns non-nil; signal an error if not.
 Second arg SHOW-ARGS means to include arguments of FORM in message.
 Other args STRING and ARGS... are arguments to be passed to `error'.
 They are not evaluated unless the assertion fails.  If STRING is
 omitted, a default message listing FORM itself is used."
-  (and (or (not (cl-compiling-file))
+  (declare (debug (form &rest form)))
+  (and (or (not (cl--compiling-file))
           (< cl-optimize-speed 3) (= cl-optimize-safety 3))
        (let ((sargs (and show-args
-                        (delq nil (mapcar
-                                    (lambda (x)
-                                      (unless (cl-const-expr-p x)
-                                        x))
-                                   (cdr form))))))
-        (list 'progn
-              (list 'or form
-                    (if string
-                        (list* 'error string (append sargs args))
-                      (list 'signal '(quote cl-assertion-failed)
-                            (list* 'list (list 'quote form) sargs))))
-              nil))))
+                         (delq nil (mapcar (lambda (x)
+                                             (unless (macroexp-const-p x)
+                                               x))
+                                           (cdr form))))))
+        `(progn
+            (or ,form
+                ,(if string
+                     `(error ,string ,@sargs ,@args)
+                   `(signal 'cl-assertion-failed
+                            (list ',form ,@sargs))))
+            nil))))
 
 ;;; Compiler macros.
 
 ;;;###autoload
-(defmacro define-compiler-macro (func args &rest body)
+(defmacro cl-define-compiler-macro (func args &rest body)
   "Define a compiler-only macro.
 This is like `defmacro', but macro expansion occurs only if the call to
 FUNC is compiled (i.e., not interpreted).  Compiler macros should be used
@@ -2624,38 +2395,30 @@ compiler macros are expanded repeatedly until no further expansions are
 possible.  Unlike regular macros, BODY can decide to \"punt\" and leave the
 original function call alone by declaring an initial `&whole foo' parameter
 and then returning foo."
+  (declare (debug cl-defmacro))
   (let ((p args) (res nil))
     (while (consp p) (push (pop p) res))
     (setq args (nconc (nreverse res) (and p (list '&rest p)))))
-  (list 'eval-when '(compile load eval)
-       (cl-transform-function-property
-        func 'cl-compiler-macro
-        (cons (if (memq '&whole args) (delq '&whole args)
-                (cons '_cl-whole-arg args)) body))
-       (list 'or (list 'get (list 'quote func) '(quote byte-compile))
-             (list 'progn
-                   (list 'put (list 'quote func) '(quote byte-compile)
-                         '(quote cl-byte-compile-compiler-macro))
-                   ;; This is so that describe-function can locate
-                   ;; the macro definition.
-                   (list 'let
-                         (list (list
-                                'file
-                                (or buffer-file-name
-                                    (and (boundp 'byte-compile-current-file)
-                                         (stringp byte-compile-current-file)
-                                         byte-compile-current-file))))
-                         (list 'if 'file
-                               (list 'put (list 'quote func)
-                                     '(quote compiler-macro-file)
-                                     '(purecopy (file-name-nondirectory file)))))))))
+  `(cl-eval-when (compile load eval)
+     (put ',func 'compiler-macro
+          (cl-function (lambda ,(if (memq '&whole args) (delq '&whole args)
+                             (cons '_cl-whole-arg args))
+                         ,@body)))
+     ;; This is so that describe-function can locate
+     ;; the macro definition.
+     (let ((file ,(or buffer-file-name
+                      (and (boundp 'byte-compile-current-file)
+                           (stringp byte-compile-current-file)
+                           byte-compile-current-file))))
+       (if file (put ',func 'compiler-macro-file
+                     (purecopy (file-name-nondirectory file)))))))
 
 ;;;###autoload
-(defun compiler-macroexpand (form)
+(defun cl-compiler-macroexpand (form)
   (while
       (let ((func (car-safe form)) (handler nil))
        (while (and (symbolp func)
-                   (not (setq handler (get func 'cl-compiler-macro)))
+                   (not (setq handler (get func 'compiler-macro)))
                    (fboundp func)
                    (or (not (eq (car-safe (symbol-function func)) 'autoload))
                        (load (nth 1 (symbol-function func)))))
@@ -2664,18 +2427,13 @@ and then returning foo."
             (not (eq form (setq form (apply handler form (cdr form))))))))
   form)
 
-(defun cl-byte-compile-compiler-macro (form)
-  (if (eq form (setq form (compiler-macroexpand form)))
-      (byte-compile-normal-call form)
-    (byte-compile-form form)))
-
 ;; Optimize away unused block-wrappers.
 
-(defvar cl-active-block-names nil)
+(defvar cl--active-block-names nil)
 
-(define-compiler-macro cl-block-wrapper (cl-form)
+(cl-define-compiler-macro cl--block-wrapper (cl-form)
   (let* ((cl-entry (cons (nth 1 (nth 1 cl-form)) nil))
-         (cl-active-block-names (cons cl-entry cl-active-block-names))
+         (cl--active-block-names (cons cl-entry cl--active-block-names))
          (cl-body (macroexpand-all      ;Performs compiler-macro expansions.
                    (cons 'progn (cddr cl-form))
                    macroexpand-all-environment)))
@@ -2685,52 +2443,52 @@ and then returning foo."
         `(catch ,(nth 1 cl-form) ,@(cdr cl-body))
       cl-body)))
 
-(define-compiler-macro cl-block-throw (cl-tag cl-value)
-  (let ((cl-found (assq (nth 1 cl-tag) cl-active-block-names)))
+(cl-define-compiler-macro cl--block-throw (cl-tag cl-value)
+  (let ((cl-found (assq (nth 1 cl-tag) cl--active-block-names)))
     (if cl-found (setcdr cl-found t)))
   `(throw ,cl-tag ,cl-value))
 
 ;;;###autoload
-(defmacro defsubst* (name args &rest body)
+(defmacro cl-defsubst (name args &rest body)
   "Define NAME as a function.
 Like `defun', except the function is automatically declared `inline',
 ARGLIST allows full Common Lisp conventions, and BODY is implicitly
-surrounded by (block NAME ...).
+surrounded by (cl-block NAME ...).
 
 \(fn NAME ARGLIST [DOCSTRING] BODY...)"
-  (let* ((argns (cl-arglist-args args)) (p argns)
+  (declare (debug cl-defun) (indent 2))
+  (let* ((argns (cl--arglist-args args)) (p argns)
         (pbody (cons 'progn body))
-        (unsafe (not (cl-safe-expr-p pbody))))
-    (while (and p (eq (cl-expr-contains args (car p)) 1)) (pop p))
-    (list 'progn
-         (if p nil   ; give up if defaults refer to earlier args
-           (list 'define-compiler-macro name
-                 (if (memq '&key args)
-                     (list* '&whole 'cl-whole '&cl-quote args)
-                   (cons '&cl-quote args))
-                 (list* 'cl-defsubst-expand (list 'quote argns)
-                        (list 'quote (list* 'block name body))
-                         ;; We used to pass `simple' as
-                         ;; (not (or unsafe (cl-expr-access-order pbody argns)))
-                         ;; But this is much too simplistic since it
-                         ;; does not pay attention to the argvs (and
-                         ;; cl-expr-access-order itself is also too naive).
-                        nil
-                        (and (memq '&key args) 'cl-whole) unsafe argns)))
-         (list* 'defun* name args body))))
-
-(defun cl-defsubst-expand (argns body simple whole unsafe &rest argvs)
-  (if (and whole (not (cl-safe-expr-p (cons 'progn argvs)))) whole
-    (if (cl-simple-exprs-p argvs) (setq simple t))
+        (unsafe (not (cl--safe-expr-p pbody))))
+    (while (and p (eq (cl--expr-contains args (car p)) 1)) (pop p))
+    `(progn
+       ,(if p nil   ; give up if defaults refer to earlier args
+          `(cl-define-compiler-macro ,name
+             ,(if (memq '&key args)
+                  `(&whole cl-whole &cl-quote ,@args)
+                (cons '&cl-quote args))
+             (cl--defsubst-expand
+              ',argns '(cl-block ,name ,@body)
+              ;; We used to pass `simple' as
+              ;; (not (or unsafe (cl-expr-access-order pbody argns)))
+              ;; But this is much too simplistic since it
+              ;; does not pay attention to the argvs (and
+              ;; cl-expr-access-order itself is also too naive).
+              nil
+              ,(and (memq '&key args) 'cl-whole) ,unsafe ,@argns)))
+       (cl-defun ,name ,args ,@body))))
+
+(defun cl--defsubst-expand (argns body simple whole unsafe &rest argvs)
+  (if (and whole (not (cl--safe-expr-p (cons 'progn argvs)))) whole
+    (if (cl--simple-exprs-p argvs) (setq simple t))
     (let* ((substs ())
            (lets (delq nil
-                       (mapcar* (function
-                                 (lambda (argn argv)
-                                   (if (or simple (cl-const-expr-p argv))
-                                       (progn (push (cons argn argv) substs)
-                                              (and unsafe (list argn argv)))
-                                     (list argn argv))))
-                                argns argvs))))
+                       (cl-mapcar (lambda (argn argv)
+                                    (if (or simple (macroexp-const-p argv))
+                                        (progn (push (cons argn argv) substs)
+                                               (and unsafe (list argn argv)))
+                                      (list argn argv)))
+                                  argns argvs))))
       ;; FIXME: `sublis/subst' will happily substitute the symbol
       ;; `argn' in places where it's not used as a reference
       ;; to a variable.
@@ -2738,120 +2496,100 @@ surrounded by (block NAME ...).
       ;; scope, leading to name capture.
       (setq body (cond ((null substs) body)
                        ((null (cdr substs))
-                        (subst (cdar substs) (caar substs) body))
-                       (t (sublis substs body))))
-      (if lets (list 'let lets body) body))))
+                        (cl-subst (cdar substs) (caar substs) body))
+                       (t (cl-sublis substs body))))
+      (if lets `(let ,lets ,body) body))))
 
 
 ;; Compile-time optimizations for some functions defined in this package.
-;; Note that cl.el arranges to force cl-macs to be loaded at compile-time,
-;; mainly to make sure these macros will be present.
-
-(put 'eql 'byte-compile nil)
-(define-compiler-macro eql (&whole form a b)
-  (cond ((eq (cl-const-expr-p a) t)
-        (let ((val (cl-const-expr-val a)))
-          (if (and (numberp val) (not (integerp val)))
-              (list 'equal a b)
-            (list 'eq a b))))
-       ((eq (cl-const-expr-p b) t)
-        (let ((val (cl-const-expr-val b)))
-          (if (and (numberp val) (not (integerp val)))
-              (list 'equal a b)
-            (list 'eq a b))))
-       ((cl-simple-expr-p a 5)
-        (list 'if (list 'numberp a)
-              (list 'equal a b)
-              (list 'eq a b)))
-       ((and (cl-safe-expr-p a)
-             (cl-simple-expr-p b 5))
-        (list 'if (list 'numberp b)
-              (list 'equal a b)
-              (list 'eq a b)))
-       (t form)))
-
-(define-compiler-macro member* (&whole form a list &rest keys)
+
+(defun cl--compiler-macro-member (form a list &rest keys)
   (let ((test (and (= (length keys) 2) (eq (car keys) :test)
-                  (cl-const-expr-val (nth 1 keys)))))
-    (cond ((eq test 'eq) (list 'memq a list))
-         ((eq test 'equal) (list 'member a list))
-         ((or (null keys) (eq test 'eql)) (list 'memql a list))
+                  (cl--const-expr-val (nth 1 keys)))))
+    (cond ((eq test 'eq) `(memq ,a ,list))
+         ((eq test 'equal) `(member ,a ,list))
+         ((or (null keys) (eq test 'eql)) `(memql ,a ,list))
          (t form))))
 
-(define-compiler-macro assoc* (&whole form a list &rest keys)
+(defun cl--compiler-macro-assoc (form a list &rest keys)
   (let ((test (and (= (length keys) 2) (eq (car keys) :test)
-                  (cl-const-expr-val (nth 1 keys)))))
-    (cond ((eq test 'eq) (list 'assq a list))
-         ((eq test 'equal) (list 'assoc a list))
-         ((and (eq (cl-const-expr-p a) t) (or (null keys) (eq test 'eql)))
-          (if (floatp-safe (cl-const-expr-val a))
-              (list 'assoc a list) (list 'assq a list)))
+                  (cl--const-expr-val (nth 1 keys)))))
+    (cond ((eq test 'eq) `(assq ,a ,list))
+         ((eq test 'equal) `(assoc ,a ,list))
+         ((and (macroexp-const-p a) (or (null keys) (eq test 'eql)))
+          (if (cl-floatp-safe (cl--const-expr-val a))
+              `(assoc ,a ,list) `(assq ,a ,list)))
          (t form))))
 
-(define-compiler-macro adjoin (&whole form a list &rest keys)
-  (if (and (cl-simple-expr-p a) (cl-simple-expr-p list)
+;;;###autoload
+(defun cl--compiler-macro-adjoin (form a list &rest keys)
+  (if (and (cl--simple-expr-p a) (cl--simple-expr-p list)
           (not (memq :key keys)))
-      (list 'if (list* 'member* a list keys) list (list 'cons a list))
+      `(if (cl-member ,a ,list ,@keys) ,list (cons ,a ,list))
     form))
 
-(define-compiler-macro list* (arg &rest others)
+;;;###autoload
+(defun cl--compiler-macro-list* (_form arg &rest others)
   (let* ((args (reverse (cons arg others)))
         (form (car args)))
     (while (setq args (cdr args))
-      (setq form (list 'cons (car args) form)))
+      (setq form `(cons ,(car args) ,form)))
     form))
 
-(define-compiler-macro get* (sym prop &optional def)
+(defun cl--compiler-macro-get (_form sym prop &optional def)
   (if def
-      (list 'getf (list 'symbol-plist sym) prop def)
-    (list 'get sym prop)))
-
-(define-compiler-macro typep (&whole form val type)
-  (if (cl-const-expr-p type)
-      (let ((res (cl-make-type-test val (cl-const-expr-val type))))
-       (if (or (memq (cl-expr-contains res val) '(nil 1))
-               (cl-simple-expr-p val)) res
-         (let ((temp (make-symbol "--cl-var--")))
-           (list 'let (list (list temp val)) (subst temp val res)))))
-    form))
+      `(cl-getf (symbol-plist ,sym) ,prop ,def)
+    `(get ,sym ,prop)))
 
+(cl-define-compiler-macro cl-typep (&whole form val type)
+  (if (macroexp-const-p type)
+      (macroexp-let2 macroexp-copyable-p temp val
+        (cl--make-type-test temp (cl--const-expr-val type)))
+    form))
 
-(mapc (lambda (y)
-       (put (car y) 'side-effect-free t)
-       (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro)
-       (put (car y) 'cl-compiler-macro
-            `(lambda (w x)
-               ,(if (symbolp (cadr y))
-                    `(list ',(cadr y)
-                           (list ',(caddr y) x))
-                  (cons 'list (cdr y))))))
-      '((first 'car x) (second 'cadr x) (third 'caddr x) (fourth 'cadddr x)
-       (fifth 'nth 4 x) (sixth 'nth 5 x) (seventh 'nth 6 x)
-       (eighth 'nth 7 x) (ninth 'nth 8 x) (tenth 'nth 9 x)
-       (rest 'cdr x) (endp 'null x) (plusp '> x 0) (minusp '< x 0)
-       (caaar car caar) (caadr car cadr) (cadar car cdar)
-       (caddr car cddr) (cdaar cdr caar) (cdadr cdr cadr)
-       (cddar cdr cdar) (cdddr cdr cddr) (caaaar car caaar)
-       (caaadr car caadr) (caadar car cadar) (caaddr car caddr)
-       (cadaar car cdaar) (cadadr car cdadr) (caddar car cddar)
-       (cadddr car cdddr) (cdaaar cdr caaar) (cdaadr cdr caadr)
-       (cdadar cdr cadar) (cdaddr cdr caddr) (cddaar cdr cdaar)
-       (cddadr cdr cdadr) (cdddar cdr cddar) (cddddr cdr cdddr) ))
+;;;###autoload
+(defun cl--compiler-macro-cXXr (form x)
+  (let* ((head (car form))
+         (n (symbol-name (car form)))
+         (i (- (length n) 2)))
+    (if (not (string-match "c[ad]+r\\'" n))
+        (if (and (fboundp head) (symbolp (symbol-function head)))
+            (cl--compiler-macro-cXXr (cons (symbol-function head) (cdr form))
+                                     x)
+          (error "Compiler macro for cXXr applied to non-cXXr form"))
+      (while (> i (match-beginning 0))
+        (setq x (list (if (eq (aref n i) ?a) 'car 'cdr) x))
+        (setq i (1- i)))
+      x)))
+
+(dolist (y '(cl-first cl-second cl-third cl-fourth
+             cl-fifth cl-sixth cl-seventh
+             cl-eighth cl-ninth cl-tenth
+             cl-rest cl-endp cl-plusp cl-minusp
+             cl-caaar cl-caadr cl-cadar
+             cl-caddr cl-cdaar cl-cdadr
+             cl-cddar cl-cdddr cl-caaaar
+             cl-caaadr cl-caadar cl-caaddr
+             cl-cadaar cl-cadadr cl-caddar
+             cl-cadddr cl-cdaaar cl-cdaadr
+             cl-cdadar cl-cdaddr cl-cddaar
+             cl-cddadr cl-cdddar cl-cddddr))
+  (put y 'side-effect-free t))
 
 ;;; Things that are inline.
-(proclaim '(inline floatp-safe acons map concatenate notany notevery
-                  cl-set-elt revappend nreconc gethash))
+(cl-proclaim '(inline cl-floatp-safe cl-acons cl-map cl-concatenate cl-notany
+               cl-notevery cl--set-elt cl-revappend cl-nreconc gethash))
 
 ;;; Things that are side-effect-free.
 (mapc (lambda (x) (put x 'side-effect-free t))
-      '(oddp evenp signum last butlast ldiff pairlis gcd lcm
-       isqrt floor* ceiling* truncate* round* mod* rem* subseq
-       list-length get* getf))
+      '(cl-oddp cl-evenp cl-signum last butlast cl-ldiff cl-pairlis cl-gcd cl-lcm
+       cl-isqrt cl-floor cl-ceiling cl-truncate cl-round cl-mod cl-rem cl-subseq
+       cl-list-length cl-get cl-getf))
 
 ;;; Things that are side-effect-and-error-free.
 (mapc (lambda (x) (put x 'side-effect-free 'error-free))
-      '(eql floatp-safe list* subst acons equalp random-state-p
-       copy-tree sublis))
+      '(eql cl-floatp-safe cl-list* cl-subst cl-acons cl-equalp cl-random-state-p
+       copy-tree cl-sublis))
 
 
 (run-hooks 'cl-macs-load-hook)
@@ -2862,4 +2600,6 @@ surrounded by (block NAME ...).
 ;; generated-autoload-file: "cl-loaddefs.el"
 ;; End:
 
+(provide 'cl-macs)
+
 ;;; cl-macs.el ends here
index f1890fbccf66596e339e2e76c1dc3a9279662d6b..b55f1df5ba54841336b9ae38ee12cb612353f648 100644 (file)
@@ -1,4 +1,4 @@
-;;; cl-seq.el --- Common Lisp features, part 3
+;;; cl-seq.el --- Common Lisp features, part 3  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1993, 2001-2012  Free Software Foundation, Inc.
 
 
 ;;; Code:
 
-(require 'cl)
+(require 'cl-lib)
 
-;;; Keyword parsing.  This is special-cased here so that we can compile
-;;; this file independent from cl-macs.
+;; Keyword parsing.
+;; This is special-cased here so that we can compile
+;; this file independent from cl-macs.
 
-(defmacro cl-parsing-keywords (kwords other-keys &rest body)
+(defmacro cl--parsing-keywords (kwords other-keys &rest body)
   (declare (indent 2) (debug (sexp sexp &rest form)))
-  (cons
-   'let*
-   (cons (mapcar
-         (function
-          (lambda (x)
-            (let* ((var (if (consp x) (car x) x))
-                   (mem (list 'car (list 'cdr (list 'memq (list 'quote var)
-                                                    'cl-keys)))))
-              (if (eq var :test-not)
-                  (setq mem (list 'and mem (list 'setq 'cl-test mem) t)))
-              (if (eq var :if-not)
-                  (setq mem (list 'and mem (list 'setq 'cl-if mem) t)))
-              (list (intern
-                     (format "cl-%s" (substring (symbol-name var) 1)))
-                    (if (consp x) (list 'or mem (car (cdr x))) mem)))))
-         kwords)
-        (append
-         (and (not (eq other-keys t))
-              (list
-               (list 'let '((cl-keys-temp cl-keys))
-                     (list 'while 'cl-keys-temp
-                           (list 'or (list 'memq '(car cl-keys-temp)
-                                           (list 'quote
-                                                 (mapcar
-                                                  (function
-                                                   (lambda (x)
-                                                     (if (consp x)
-                                                         (car x) x)))
-                                                  (append kwords
-                                                          other-keys))))
-                                 '(car (cdr (memq (quote :allow-other-keys)
-                                                  cl-keys)))
-                                 '(error "Bad keyword argument %s"
-                                         (car cl-keys-temp)))
-                           '(setq cl-keys-temp (cdr (cdr cl-keys-temp)))))))
-         body))))
-
-(defmacro cl-check-key (x)
+  `(let* ,(mapcar
+           (lambda (x)
+             (let* ((var (if (consp x) (car x) x))
+                    (mem `(car (cdr (memq ',var cl-keys)))))
+               (if (eq var :test-not)
+                   (setq mem `(and ,mem (setq cl-test ,mem) t)))
+               (if (eq var :if-not)
+                   (setq mem `(and ,mem (setq cl-if ,mem) t)))
+               (list (intern
+                      (format "cl-%s" (substring (symbol-name var) 1)))
+                     (if (consp x) `(or ,mem ,(car (cdr x))) mem))))
+           kwords)
+     ,@(append
+        (and (not (eq other-keys t))
+             (list
+              (list 'let '((cl-keys-temp cl-keys))
+                    (list 'while 'cl-keys-temp
+                          (list 'or (list 'memq '(car cl-keys-temp)
+                                          (list 'quote
+                                                (mapcar
+                                                 (function
+                                                  (lambda (x)
+                                                    (if (consp x)
+                                                        (car x) x)))
+                                                 (append kwords
+                                                         other-keys))))
+                                '(car (cdr (memq (quote :allow-other-keys)
+                                                 cl-keys)))
+                                '(error "Bad keyword argument %s"
+                                        (car cl-keys-temp)))
+                          '(setq cl-keys-temp (cdr (cdr cl-keys-temp)))))))
+        body)))
+
+(defmacro cl--check-key (x)     ;Expects `cl-key' in context of generated code.
   (declare (debug edebug-forms))
-  (list 'if 'cl-key (list 'funcall 'cl-key x) x))
+  `(if cl-key (funcall cl-key ,x) ,x))
 
-(defmacro cl-check-test-nokey (item x)
+(defmacro cl--check-test-nokey (item x) ;cl-test cl-if cl-test-not cl-if-not.
   (declare (debug edebug-forms))
-  (list 'cond
-       (list 'cl-test
-             (list 'eq (list 'not (list 'funcall 'cl-test item x))
-                   'cl-test-not))
-       (list 'cl-if
-             (list 'eq (list 'not (list 'funcall 'cl-if x)) 'cl-if-not))
-       (list 't (list 'if (list 'numberp item)
-                      (list 'equal item x) (list 'eq item x)))))
-
-(defmacro cl-check-test (item x)
+  `(cond
+    (cl-test (eq (not (funcall cl-test ,item ,x))
+                 cl-test-not))
+    (cl-if (eq (not (funcall cl-if ,x)) cl-if-not))
+    (t (eql ,item ,x))))
+
+(defmacro cl--check-test (item x)       ;all of the above.
   (declare (debug edebug-forms))
-  (list 'cl-check-test-nokey item (list 'cl-check-key x)))
+  `(cl--check-test-nokey ,item (cl--check-key ,x)))
 
-(defmacro cl-check-match (x y)
+(defmacro cl--check-match (x y)         ;cl-key cl-test cl-test-not
   (declare (debug edebug-forms))
-  (setq x (list 'cl-check-key x) y (list 'cl-check-key y))
-  (list 'if 'cl-test
-       (list 'eq (list 'not (list 'funcall 'cl-test x y)) 'cl-test-not)
-       (list 'if (list 'numberp x)
-             (list 'equal x y) (list 'eq x y))))
+  (setq x `(cl--check-key ,x) y `(cl--check-key ,y))
+  `(if cl-test
+       (eq (not (funcall cl-test ,x ,y)) cl-test-not)
+     (eql ,x ,y)))
 
 (defvar cl-test) (defvar cl-test-not)
 (defvar cl-if) (defvar cl-if-not)
 (defvar cl-key)
 
-
 ;;;###autoload
-(defun reduce (cl-func cl-seq &rest cl-keys)
+(defun cl-reduce (cl-func cl-seq &rest cl-keys)
   "Reduce two-argument FUNCTION across SEQ.
 \nKeywords supported:  :start :end :from-end :initial-value :key
 \n(fn FUNCTION SEQ [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:from-end (:start 0) :end :initial-value :key) ()
+  (cl--parsing-keywords (:from-end (:start 0) :end :initial-value :key) ()
     (or (listp cl-seq) (setq cl-seq (append cl-seq nil)))
-    (setq cl-seq (subseq cl-seq cl-start cl-end))
+    (setq cl-seq (cl-subseq cl-seq cl-start cl-end))
     (if cl-from-end (setq cl-seq (nreverse cl-seq)))
     (let ((cl-accum (cond ((memq :initial-value cl-keys) cl-initial-value)
-                         (cl-seq (cl-check-key (pop cl-seq)))
+                         (cl-seq (cl--check-key (pop cl-seq)))
                          (t (funcall cl-func)))))
       (if cl-from-end
          (while cl-seq
-           (setq cl-accum (funcall cl-func (cl-check-key (pop cl-seq))
+           (setq cl-accum (funcall cl-func (cl--check-key (pop cl-seq))
                                    cl-accum)))
        (while cl-seq
          (setq cl-accum (funcall cl-func cl-accum
-                                 (cl-check-key (pop cl-seq))))))
+                                 (cl--check-key (pop cl-seq))))))
       cl-accum)))
 
 ;;;###autoload
-(defun fill (seq item &rest cl-keys)
+(defun cl-fill (seq item &rest cl-keys)
   "Fill the elements of SEQ with ITEM.
 \nKeywords supported:  :start :end
 \n(fn SEQ ITEM [KEYWORD VALUE]...)"
-  (cl-parsing-keywords ((:start 0) :end) ()
+  (cl--parsing-keywords ((:start 0) :end) ()
     (if (listp seq)
        (let ((p (nthcdr cl-start seq))
              (n (if cl-end (- cl-end cl-start) 8000000)))
     seq))
 
 ;;;###autoload
-(defun replace (cl-seq1 cl-seq2 &rest cl-keys)
+(defun cl-replace (cl-seq1 cl-seq2 &rest cl-keys)
   "Replace the elements of SEQ1 with the elements of SEQ2.
 SEQ1 is destructively modified, then returned.
 \nKeywords supported:  :start1 :end1 :start2 :end2
 \n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
-  (cl-parsing-keywords ((:start1 0) :end1 (:start2 0) :end2) ()
+  (cl--parsing-keywords ((:start1 0) :end1 (:start2 0) :end2) ()
     (if (and (eq cl-seq1 cl-seq2) (<= cl-start2 cl-start1))
        (or (= cl-start1 cl-start2)
            (let* ((cl-len (length cl-seq1))
                   (cl-n (min (- (or cl-end1 cl-len) cl-start1)
                              (- (or cl-end2 cl-len) cl-start2))))
              (while (>= (setq cl-n (1- cl-n)) 0)
-               (cl-set-elt cl-seq1 (+ cl-start1 cl-n)
+               (cl--set-elt cl-seq1 (+ cl-start1 cl-n)
                            (elt cl-seq2 (+ cl-start2 cl-n))))))
       (if (listp cl-seq1)
          (let ((cl-p1 (nthcdr cl-start1 cl-seq1))
@@ -202,21 +194,21 @@ SEQ1 is destructively modified, then returned.
     cl-seq1))
 
 ;;;###autoload
-(defun remove* (cl-item cl-seq &rest cl-keys)
+(defun cl-remove (cl-item cl-seq &rest cl-keys)
   "Remove all occurrences of ITEM in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
 \nKeywords supported:  :test :test-not :key :count :start :end :from-end
 \n(fn ITEM SEQ [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
+  (cl--parsing-keywords (:test :test-not :key :if :if-not :count :from-end
                        (:start 0) :end) ()
     (if (<= (or cl-count (setq cl-count 8000000)) 0)
        cl-seq
       (if (or (nlistp cl-seq) (and cl-from-end (< cl-count 4000000)))
-         (let ((cl-i (cl-position cl-item cl-seq cl-start cl-end
-                                  cl-from-end)))
+         (let ((cl-i (cl--position cl-item cl-seq cl-start cl-end
+                                    cl-from-end)))
            (if cl-i
-               (let ((cl-res (apply 'delete* cl-item (append cl-seq nil)
+               (let ((cl-res (apply 'cl-delete cl-item (append cl-seq nil)
                                     (append (if cl-from-end
                                                 (list :end (1+ cl-i))
                                               (list :start cl-i))
@@ -227,20 +219,20 @@ to avoid corrupting the original SEQ.
        (setq cl-end (- (or cl-end 8000000) cl-start))
        (if (= cl-start 0)
            (while (and cl-seq (> cl-end 0)
-                       (cl-check-test cl-item (car cl-seq))
+                       (cl--check-test cl-item (car cl-seq))
                        (setq cl-end (1- cl-end) cl-seq (cdr cl-seq))
                        (> (setq cl-count (1- cl-count)) 0))))
        (if (and (> cl-count 0) (> cl-end 0))
            (let ((cl-p (if (> cl-start 0) (nthcdr cl-start cl-seq)
                          (setq cl-end (1- cl-end)) (cdr cl-seq))))
              (while (and cl-p (> cl-end 0)
-                         (not (cl-check-test cl-item (car cl-p))))
+                         (not (cl--check-test cl-item (car cl-p))))
                (setq cl-p (cdr cl-p) cl-end (1- cl-end)))
              (if (and cl-p (> cl-end 0))
-                 (nconc (ldiff cl-seq cl-p)
+                 (nconc (cl-ldiff cl-seq cl-p)
                         (if (= cl-count 1) (cdr cl-p)
                           (and (cdr cl-p)
-                               (apply 'delete* cl-item
+                               (apply 'cl-delete cl-item
                                       (copy-sequence (cdr cl-p))
                                       :start 0 :end (1- cl-end)
                                       :count (1- cl-count) cl-keys))))
@@ -248,30 +240,30 @@ to avoid corrupting the original SEQ.
          cl-seq)))))
 
 ;;;###autoload
-(defun remove-if (cl-pred cl-list &rest cl-keys)
+(defun cl-remove-if (cl-pred cl-list &rest cl-keys)
   "Remove all items satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'remove* nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-remove nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun remove-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-remove-if-not (cl-pred cl-list &rest cl-keys)
   "Remove all items not satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'remove* nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-remove nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun delete* (cl-item cl-seq &rest cl-keys)
+(defun cl-delete (cl-item cl-seq &rest cl-keys)
   "Remove all occurrences of ITEM in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 \nKeywords supported:  :test :test-not :key :count :start :end :from-end
 \n(fn ITEM SEQ [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not :count :from-end
+  (cl--parsing-keywords (:test :test-not :key :if :if-not :count :from-end
                        (:start 0) :end) ()
     (if (<= (or cl-count (setq cl-count 8000000)) 0)
        cl-seq
@@ -279,8 +271,8 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
          (if (and cl-from-end (< cl-count 4000000))
              (let (cl-i)
                (while (and (>= (setq cl-count (1- cl-count)) 0)
-                           (setq cl-i (cl-position cl-item cl-seq cl-start
-                                                   cl-end cl-from-end)))
+                           (setq cl-i (cl--position cl-item cl-seq cl-start
+                                                     cl-end cl-from-end)))
                  (if (= cl-i 0) (setq cl-seq (cdr cl-seq))
                    (let ((cl-tail (nthcdr (1- cl-i) cl-seq)))
                      (setcdr cl-tail (cdr (cdr cl-tail)))))
@@ -291,7 +283,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
                (progn
                  (while (and cl-seq
                              (> cl-end 0)
-                             (cl-check-test cl-item (car cl-seq))
+                             (cl--check-test cl-item (car cl-seq))
                              (setq cl-end (1- cl-end) cl-seq (cdr cl-seq))
                              (> (setq cl-count (1- cl-count)) 0)))
                  (setq cl-end (1- cl-end)))
@@ -299,7 +291,7 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
            (if (and (> cl-count 0) (> cl-end 0))
                (let ((cl-p (nthcdr cl-start cl-seq)))
                  (while (and (cdr cl-p) (> cl-end 0))
-                   (if (cl-check-test cl-item (car (cdr cl-p)))
+                   (if (cl--check-test cl-item (car (cdr cl-p)))
                        (progn
                          (setcdr cl-p (cdr (cdr cl-p)))
                          (if (= (setq cl-count (1- cl-count)) 0)
@@ -307,49 +299,49 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
                      (setq cl-p (cdr cl-p)))
                    (setq cl-end (1- cl-end)))))
            cl-seq)
-       (apply 'remove* cl-item cl-seq cl-keys)))))
+       (apply 'cl-remove cl-item cl-seq cl-keys)))))
 
 ;;;###autoload
-(defun delete-if (cl-pred cl-list &rest cl-keys)
+(defun cl-delete-if (cl-pred cl-list &rest cl-keys)
   "Remove all items satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'delete* nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-delete nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun delete-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-delete-if-not (cl-pred cl-list &rest cl-keys)
   "Remove all items not satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'delete* nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-delete nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun remove-duplicates (cl-seq &rest cl-keys)
+(defun cl-remove-duplicates (cl-seq &rest cl-keys)
   "Return a copy of SEQ with all duplicate elements removed.
 \nKeywords supported:  :test :test-not :key :start :end :from-end
 \n(fn SEQ [KEYWORD VALUE]...)"
-  (cl-delete-duplicates cl-seq cl-keys t))
+  (cl--delete-duplicates cl-seq cl-keys t))
 
 ;;;###autoload
-(defun delete-duplicates (cl-seq &rest cl-keys)
+(defun cl-delete-duplicates (cl-seq &rest cl-keys)
   "Remove all duplicate elements from SEQ (destructively).
 \nKeywords supported:  :test :test-not :key :start :end :from-end
 \n(fn SEQ [KEYWORD VALUE]...)"
-  (cl-delete-duplicates cl-seq cl-keys nil))
+  (cl--delete-duplicates cl-seq cl-keys nil))
 
-(defun cl-delete-duplicates (cl-seq cl-keys cl-copy)
+(defun cl--delete-duplicates (cl-seq cl-keys cl-copy)
   (if (listp cl-seq)
-      (cl-parsing-keywords (:test :test-not :key (:start 0) :end :from-end :if)
+      (cl--parsing-keywords (:test :test-not :key (:start 0) :end :from-end :if)
          ()
        (if cl-from-end
            (let ((cl-p (nthcdr cl-start cl-seq)) cl-i)
              (setq cl-end (- (or cl-end (length cl-seq)) cl-start))
              (while (> cl-end 1)
                (setq cl-i 0)
-               (while (setq cl-i (cl-position (cl-check-key (car cl-p))
-                                              (cdr cl-p) cl-i (1- cl-end)))
+               (while (setq cl-i (cl--position (cl--check-key (car cl-p))
+                                                (cdr cl-p) cl-i (1- cl-end)))
                  (if cl-copy (setq cl-seq (copy-sequence cl-seq)
                                    cl-p (nthcdr cl-start cl-seq) cl-copy nil))
                  (let ((cl-tail (nthcdr cl-i cl-p)))
@@ -360,14 +352,14 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
              cl-seq)
          (setq cl-end (- (or cl-end (length cl-seq)) cl-start))
          (while (and (cdr cl-seq) (= cl-start 0) (> cl-end 1)
-                     (cl-position (cl-check-key (car cl-seq))
-                                  (cdr cl-seq) 0 (1- cl-end)))
+                     (cl--position (cl--check-key (car cl-seq))
+                                    (cdr cl-seq) 0 (1- cl-end)))
            (setq cl-seq (cdr cl-seq) cl-end (1- cl-end)))
          (let ((cl-p (if (> cl-start 0) (nthcdr (1- cl-start) cl-seq)
                        (setq cl-end (1- cl-end) cl-start 1) cl-seq)))
            (while (and (cdr (cdr cl-p)) (> cl-end 1))
-             (if (cl-position (cl-check-key (car (cdr cl-p)))
-                              (cdr (cdr cl-p)) 0 (1- cl-end))
+             (if (cl--position (cl--check-key (car (cdr cl-p)))
+                                (cdr (cdr cl-p)) 0 (1- cl-end))
                  (progn
                    (if cl-copy (setq cl-seq (copy-sequence cl-seq)
                                      cl-p (nthcdr (1- cl-start) cl-seq)
@@ -376,63 +368,63 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
                (setq cl-p (cdr cl-p)))
              (setq cl-end (1- cl-end) cl-start (1+ cl-start)))
            cl-seq)))
-    (let ((cl-res (cl-delete-duplicates (append cl-seq nil) cl-keys nil)))
+    (let ((cl-res (cl--delete-duplicates (append cl-seq nil) cl-keys nil)))
       (if (stringp cl-seq) (concat cl-res) (vconcat cl-res)))))
 
 ;;;###autoload
-(defun substitute (cl-new cl-old cl-seq &rest cl-keys)
+(defun cl-substitute (cl-new cl-old cl-seq &rest cl-keys)
   "Substitute NEW for OLD in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
 \nKeywords supported:  :test :test-not :key :count :start :end :from-end
 \n(fn NEW OLD SEQ [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not :count
+  (cl--parsing-keywords (:test :test-not :key :if :if-not :count
                        (:start 0) :end :from-end) ()
     (if (or (eq cl-old cl-new)
            (<= (or cl-count (setq cl-from-end nil cl-count 8000000)) 0))
        cl-seq
-      (let ((cl-i (cl-position cl-old cl-seq cl-start cl-end)))
+      (let ((cl-i (cl--position cl-old cl-seq cl-start cl-end)))
        (if (not cl-i)
            cl-seq
          (setq cl-seq (copy-sequence cl-seq))
          (or cl-from-end
-             (progn (cl-set-elt cl-seq cl-i cl-new)
+             (progn (cl--set-elt cl-seq cl-i cl-new)
                     (setq cl-i (1+ cl-i) cl-count (1- cl-count))))
-         (apply 'nsubstitute cl-new cl-old cl-seq :count cl-count
+         (apply 'cl-nsubstitute cl-new cl-old cl-seq :count cl-count
                 :start cl-i cl-keys))))))
 
 ;;;###autoload
-(defun substitute-if (cl-new cl-pred cl-list &rest cl-keys)
+(defun cl-substitute-if (cl-new cl-pred cl-list &rest cl-keys)
   "Substitute NEW for all items satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'substitute cl-new nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-substitute cl-new nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun substitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
+(defun cl-substitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
   "Substitute NEW for all items not satisfying PREDICATE in SEQ.
 This is a non-destructive function; it makes a copy of SEQ if necessary
 to avoid corrupting the original SEQ.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'substitute cl-new nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-substitute cl-new nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun nsubstitute (cl-new cl-old cl-seq &rest cl-keys)
+(defun cl-nsubstitute (cl-new cl-old cl-seq &rest cl-keys)
   "Substitute NEW for OLD in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 \nKeywords supported:  :test :test-not :key :count :start :end :from-end
 \n(fn NEW OLD SEQ [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not :count
+  (cl--parsing-keywords (:test :test-not :key :if :if-not :count
                        (:start 0) :end :from-end) ()
     (or (eq cl-old cl-new) (<= (or cl-count (setq cl-count 8000000)) 0)
        (if (and (listp cl-seq) (or (not cl-from-end) (> cl-count 4000000)))
            (let ((cl-p (nthcdr cl-start cl-seq)))
              (setq cl-end (- (or cl-end 8000000) cl-start))
              (while (and cl-p (> cl-end 0) (> cl-count 0))
-               (if (cl-check-test cl-old (car cl-p))
+               (if (cl--check-test cl-old (car cl-p))
                    (progn
                      (setcar cl-p cl-new)
                      (setq cl-count (1- cl-count))))
@@ -441,12 +433,12 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
          (if cl-from-end
              (while (and (< cl-start cl-end) (> cl-count 0))
                (setq cl-end (1- cl-end))
-               (if (cl-check-test cl-old (elt cl-seq cl-end))
+               (if (cl--check-test cl-old (elt cl-seq cl-end))
                    (progn
-                     (cl-set-elt cl-seq cl-end cl-new)
+                     (cl--set-elt cl-seq cl-end cl-new)
                      (setq cl-count (1- cl-count)))))
            (while (and (< cl-start cl-end) (> cl-count 0))
-             (if (cl-check-test cl-old (aref cl-seq cl-start))
+             (if (cl--check-test cl-old (aref cl-seq cl-start))
                  (progn
                    (aset cl-seq cl-start cl-new)
                    (setq cl-count (1- cl-count))))
@@ -454,63 +446,63 @@ This is a destructive function; it reuses the storage of SEQ whenever possible.
     cl-seq))
 
 ;;;###autoload
-(defun nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys)
+(defun cl-nsubstitute-if (cl-new cl-pred cl-list &rest cl-keys)
   "Substitute NEW for all items satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'nsubstitute cl-new nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-nsubstitute cl-new nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
+(defun cl-nsubstitute-if-not (cl-new cl-pred cl-list &rest cl-keys)
   "Substitute NEW for all items not satisfying PREDICATE in SEQ.
 This is a destructive function; it reuses the storage of SEQ whenever possible.
 \nKeywords supported:  :key :count :start :end :from-end
 \n(fn NEW PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-nsubstitute cl-new nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun find (cl-item cl-seq &rest cl-keys)
+(defun cl-find (cl-item cl-seq &rest cl-keys)
   "Find the first occurrence of ITEM in SEQ.
 Return the matching ITEM, or nil if not found.
 \nKeywords supported:  :test :test-not :key :start :end :from-end
 \n(fn ITEM SEQ [KEYWORD VALUE]...)"
-  (let ((cl-pos (apply 'position cl-item cl-seq cl-keys)))
+  (let ((cl-pos (apply 'cl-position cl-item cl-seq cl-keys)))
     (and cl-pos (elt cl-seq cl-pos))))
 
 ;;;###autoload
-(defun find-if (cl-pred cl-list &rest cl-keys)
+(defun cl-find-if (cl-pred cl-list &rest cl-keys)
   "Find the first item satisfying PREDICATE in SEQ.
 Return the matching item, or nil if not found.
 \nKeywords supported:  :key :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'find nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-find nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun find-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-find-if-not (cl-pred cl-list &rest cl-keys)
   "Find the first item not satisfying PREDICATE in SEQ.
 Return the matching item, or nil if not found.
 \nKeywords supported:  :key :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'find nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-find nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun position (cl-item cl-seq &rest cl-keys)
+(defun cl-position (cl-item cl-seq &rest cl-keys)
   "Find the first occurrence of ITEM in SEQ.
 Return the index of the matching item, or nil if not found.
 \nKeywords supported:  :test :test-not :key :start :end :from-end
 \n(fn ITEM SEQ [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not
+  (cl--parsing-keywords (:test :test-not :key :if :if-not
                        (:start 0) :end :from-end) ()
-    (cl-position cl-item cl-seq cl-start cl-end cl-from-end)))
+    (cl--position cl-item cl-seq cl-start cl-end cl-from-end)))
 
-(defun cl-position (cl-item cl-seq cl-start &optional cl-end cl-from-end)
+(defun cl--position (cl-item cl-seq cl-start &optional cl-end cl-from-end)
   (if (listp cl-seq)
       (let ((cl-p (nthcdr cl-start cl-seq)))
        (or cl-end (setq cl-end 8000000))
        (let ((cl-res nil))
          (while (and cl-p (< cl-start cl-end) (or (not cl-res) cl-from-end))
-           (if (cl-check-test cl-item (car cl-p))
+           (if (cl--check-test cl-item (car cl-p))
                (setq cl-res cl-start))
            (setq cl-p (cdr cl-p) cl-start (1+ cl-start)))
          cl-res))
@@ -518,73 +510,73 @@ Return the index of the matching item, or nil if not found.
     (if cl-from-end
        (progn
          (while (and (>= (setq cl-end (1- cl-end)) cl-start)
-                     (not (cl-check-test cl-item (aref cl-seq cl-end)))))
+                     (not (cl--check-test cl-item (aref cl-seq cl-end)))))
          (and (>= cl-end cl-start) cl-end))
       (while (and (< cl-start cl-end)
-                 (not (cl-check-test cl-item (aref cl-seq cl-start))))
+                 (not (cl--check-test cl-item (aref cl-seq cl-start))))
        (setq cl-start (1+ cl-start)))
       (and (< cl-start cl-end) cl-start))))
 
 ;;;###autoload
-(defun position-if (cl-pred cl-list &rest cl-keys)
+(defun cl-position-if (cl-pred cl-list &rest cl-keys)
   "Find the first item satisfying PREDICATE in SEQ.
 Return the index of the matching item, or nil if not found.
 \nKeywords supported:  :key :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'position nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-position nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun position-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-position-if-not (cl-pred cl-list &rest cl-keys)
   "Find the first item not satisfying PREDICATE in SEQ.
 Return the index of the matching item, or nil if not found.
 \nKeywords supported:  :key :start :end :from-end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'position nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-position nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun count (cl-item cl-seq &rest cl-keys)
+(defun cl-count (cl-item cl-seq &rest cl-keys)
   "Count the number of occurrences of ITEM in SEQ.
 \nKeywords supported:  :test :test-not :key :start :end
 \n(fn ITEM SEQ [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) ()
+  (cl--parsing-keywords (:test :test-not :key :if :if-not (:start 0) :end) ()
     (let ((cl-count 0) cl-x)
       (or cl-end (setq cl-end (length cl-seq)))
       (if (consp cl-seq) (setq cl-seq (nthcdr cl-start cl-seq)))
       (while (< cl-start cl-end)
        (setq cl-x (if (consp cl-seq) (pop cl-seq) (aref cl-seq cl-start)))
-       (if (cl-check-test cl-item cl-x) (setq cl-count (1+ cl-count)))
+       (if (cl--check-test cl-item cl-x) (setq cl-count (1+ cl-count)))
        (setq cl-start (1+ cl-start)))
       cl-count)))
 
 ;;;###autoload
-(defun count-if (cl-pred cl-list &rest cl-keys)
+(defun cl-count-if (cl-pred cl-list &rest cl-keys)
   "Count the number of items satisfying PREDICATE in SEQ.
 \nKeywords supported:  :key :start :end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'count nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-count nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun count-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-count-if-not (cl-pred cl-list &rest cl-keys)
   "Count the number of items not satisfying PREDICATE in SEQ.
 \nKeywords supported:  :key :start :end
 \n(fn PREDICATE SEQ [KEYWORD VALUE]...)"
-  (apply 'count nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-count nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun mismatch (cl-seq1 cl-seq2 &rest cl-keys)
+(defun cl-mismatch (cl-seq1 cl-seq2 &rest cl-keys)
   "Compare SEQ1 with SEQ2, return index of first mismatching element.
 Return nil if the sequences match.  If one sequence is a prefix of the
 other, the return value indicates the end of the shorter sequence.
 \nKeywords supported:  :test :test-not :key :start1 :end1 :start2 :end2 :from-end
 \n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :from-end
+  (cl--parsing-keywords (:test :test-not :key :from-end
                        (:start1 0) :end1 (:start2 0) :end2) ()
     (or cl-end1 (setq cl-end1 (length cl-seq1)))
     (or cl-end2 (setq cl-end2 (length cl-seq2)))
     (if cl-from-end
        (progn
          (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
-                     (cl-check-match (elt cl-seq1 (1- cl-end1))
+                     (cl--check-match (elt cl-seq1 (1- cl-end1))
                                      (elt cl-seq2 (1- cl-end2))))
            (setq cl-end1 (1- cl-end1) cl-end2 (1- cl-end2)))
          (and (or (< cl-start1 cl-end1) (< cl-start2 cl-end2))
@@ -592,7 +584,7 @@ other, the return value indicates the end of the shorter sequence.
       (let ((cl-p1 (and (listp cl-seq1) (nthcdr cl-start1 cl-seq1)))
            (cl-p2 (and (listp cl-seq2) (nthcdr cl-start2 cl-seq2))))
        (while (and (< cl-start1 cl-end1) (< cl-start2 cl-end2)
-                   (cl-check-match (if cl-p1 (car cl-p1)
+                   (cl--check-match (if cl-p1 (car cl-p1)
                                      (aref cl-seq1 cl-start1))
                                    (if cl-p2 (car cl-p2)
                                      (aref cl-seq2 cl-start2))))
@@ -602,26 +594,26 @@ other, the return value indicates the end of the shorter sequence.
             cl-start1)))))
 
 ;;;###autoload
-(defun search (cl-seq1 cl-seq2 &rest cl-keys)
+(defun cl-search (cl-seq1 cl-seq2 &rest cl-keys)
   "Search for SEQ1 as a subsequence of SEQ2.
 Return the index of the leftmost element of the first match found;
 return nil if there are no matches.
 \nKeywords supported:  :test :test-not :key :start1 :end1 :start2 :end2 :from-end
 \n(fn SEQ1 SEQ2 [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :from-end
+  (cl--parsing-keywords (:test :test-not :key :from-end
                        (:start1 0) :end1 (:start2 0) :end2) ()
     (or cl-end1 (setq cl-end1 (length cl-seq1)))
     (or cl-end2 (setq cl-end2 (length cl-seq2)))
     (if (>= cl-start1 cl-end1)
        (if cl-from-end cl-end2 cl-start2)
       (let* ((cl-len (- cl-end1 cl-start1))
-            (cl-first (cl-check-key (elt cl-seq1 cl-start1)))
+            (cl-first (cl--check-key (elt cl-seq1 cl-start1)))
             (cl-if nil) cl-pos)
        (setq cl-end2 (- cl-end2 (1- cl-len)))
        (while (and (< cl-start2 cl-end2)
-                   (setq cl-pos (cl-position cl-first cl-seq2
-                                             cl-start2 cl-end2 cl-from-end))
-                   (apply 'mismatch cl-seq1 cl-seq2
+                   (setq cl-pos (cl--position cl-first cl-seq2
+                                               cl-start2 cl-end2 cl-from-end))
+                   (apply 'cl-mismatch cl-seq1 cl-seq2
                           :start1 (1+ cl-start1) :end1 cl-end1
                           :start2 (1+ cl-pos) :end2 (+ cl-pos cl-len)
                           :from-end nil cl-keys))
@@ -629,14 +621,14 @@ return nil if there are no matches.
        (and (< cl-start2 cl-end2) cl-pos)))))
 
 ;;;###autoload
-(defun sort* (cl-seq cl-pred &rest cl-keys)
+(defun cl-sort (cl-seq cl-pred &rest cl-keys)
   "Sort the argument SEQ according to PREDICATE.
 This is a destructive function; it reuses the storage of SEQ if possible.
 \nKeywords supported:  :key
 \n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
   (if (nlistp cl-seq)
-      (replace cl-seq (apply 'sort* (append cl-seq nil) cl-pred cl-keys))
-    (cl-parsing-keywords (:key) ()
+      (cl-replace cl-seq (apply 'cl-sort (append cl-seq nil) cl-pred cl-keys))
+    (cl--parsing-keywords (:key) ()
       (if (memq cl-key '(nil identity))
          (sort cl-seq cl-pred)
        (sort cl-seq (function (lambda (cl-x cl-y)
@@ -644,15 +636,15 @@ This is a destructive function; it reuses the storage of SEQ if possible.
                                          (funcall cl-key cl-y)))))))))
 
 ;;;###autoload
-(defun stable-sort (cl-seq cl-pred &rest cl-keys)
+(defun cl-stable-sort (cl-seq cl-pred &rest cl-keys)
   "Sort the argument SEQ stably according to PREDICATE.
 This is a destructive function; it reuses the storage of SEQ if possible.
 \nKeywords supported:  :key
 \n(fn SEQ PREDICATE [KEYWORD VALUE]...)"
-  (apply 'sort* cl-seq cl-pred cl-keys))
+  (apply 'cl-sort cl-seq cl-pred cl-keys))
 
 ;;;###autoload
-(defun merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys)
+(defun cl-merge (cl-type cl-seq1 cl-seq2 cl-pred &rest cl-keys)
   "Destructively merge the two sequences to produce a new sequence.
 TYPE is the sequence type to return, SEQ1 and SEQ2 are the two argument
 sequences, and PREDICATE is a `less-than' predicate on the elements.
@@ -660,115 +652,117 @@ sequences, and PREDICATE is a `less-than' predicate on the elements.
 \n(fn TYPE SEQ1 SEQ2 PREDICATE [KEYWORD VALUE]...)"
   (or (listp cl-seq1) (setq cl-seq1 (append cl-seq1 nil)))
   (or (listp cl-seq2) (setq cl-seq2 (append cl-seq2 nil)))
-  (cl-parsing-keywords (:key) ()
+  (cl--parsing-keywords (:key) ()
     (let ((cl-res nil))
       (while (and cl-seq1 cl-seq2)
-       (if (funcall cl-pred (cl-check-key (car cl-seq2))
-                    (cl-check-key (car cl-seq1)))
+       (if (funcall cl-pred (cl--check-key (car cl-seq2))
+                    (cl--check-key (car cl-seq1)))
            (push (pop cl-seq2) cl-res)
          (push (pop cl-seq1) cl-res)))
-      (coerce (nconc (nreverse cl-res) cl-seq1 cl-seq2) cl-type))))
+      (cl-coerce (nconc (nreverse cl-res) cl-seq1 cl-seq2) cl-type))))
 
-;;; See compiler macro in cl-macs.el
 ;;;###autoload
-(defun member* (cl-item cl-list &rest cl-keys)
+(defun cl-member (cl-item cl-list &rest cl-keys)
   "Find the first occurrence of ITEM in LIST.
 Return the sublist of LIST whose car is ITEM.
 \nKeywords supported:  :test :test-not :key
 \n(fn ITEM LIST [KEYWORD VALUE]...)"
+  (declare (compiler-macro cl--compiler-macro-member))
   (if cl-keys
-      (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
-       (while (and cl-list (not (cl-check-test cl-item (car cl-list))))
+      (cl--parsing-keywords (:test :test-not :key :if :if-not) ()
+       (while (and cl-list (not (cl--check-test cl-item (car cl-list))))
          (setq cl-list (cdr cl-list)))
        cl-list)
     (if (and (numberp cl-item) (not (integerp cl-item)))
        (member cl-item cl-list)
       (memq cl-item cl-list))))
+(autoload 'cl--compiler-macro-member "cl-macs")
 
 ;;;###autoload
-(defun member-if (cl-pred cl-list &rest cl-keys)
+(defun cl-member-if (cl-pred cl-list &rest cl-keys)
   "Find the first item satisfying PREDICATE in LIST.
 Return the sublist of LIST whose car matches.
 \nKeywords supported:  :key
 \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
-  (apply 'member* nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-member nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun member-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-member-if-not (cl-pred cl-list &rest cl-keys)
   "Find the first item not satisfying PREDICATE in LIST.
 Return the sublist of LIST whose car matches.
 \nKeywords supported:  :key
 \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
-  (apply 'member* nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-member nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun cl-adjoin (cl-item cl-list &rest cl-keys)
-  (if (cl-parsing-keywords (:key) t
-       (apply 'member* (cl-check-key cl-item) cl-list cl-keys))
+(defun cl--adjoin (cl-item cl-list &rest cl-keys)
+  (if (cl--parsing-keywords (:key) t
+       (apply 'cl-member (cl--check-key cl-item) cl-list cl-keys))
       cl-list
     (cons cl-item cl-list)))
 
-;;; See compiler macro in cl-macs.el
 ;;;###autoload
-(defun assoc* (cl-item cl-alist &rest cl-keys)
+(defun cl-assoc (cl-item cl-alist &rest cl-keys)
   "Find the first item whose car matches ITEM in LIST.
 \nKeywords supported:  :test :test-not :key
 \n(fn ITEM LIST [KEYWORD VALUE]...)"
+  (declare (compiler-macro cl--compiler-macro-assoc))
   (if cl-keys
-      (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
+      (cl--parsing-keywords (:test :test-not :key :if :if-not) ()
        (while (and cl-alist
                    (or (not (consp (car cl-alist)))
-                       (not (cl-check-test cl-item (car (car cl-alist))))))
+                       (not (cl--check-test cl-item (car (car cl-alist))))))
          (setq cl-alist (cdr cl-alist)))
        (and cl-alist (car cl-alist)))
     (if (and (numberp cl-item) (not (integerp cl-item)))
        (assoc cl-item cl-alist)
       (assq cl-item cl-alist))))
+(autoload 'cl--compiler-macro-assoc "cl-macs")
 
 ;;;###autoload
-(defun assoc-if (cl-pred cl-list &rest cl-keys)
+(defun cl-assoc-if (cl-pred cl-list &rest cl-keys)
   "Find the first item whose car satisfies PREDICATE in LIST.
 \nKeywords supported:  :key
 \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
-  (apply 'assoc* nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-assoc nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun assoc-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-assoc-if-not (cl-pred cl-list &rest cl-keys)
   "Find the first item whose car does not satisfy PREDICATE in LIST.
 \nKeywords supported:  :key
 \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
-  (apply 'assoc* nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-assoc nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun rassoc* (cl-item cl-alist &rest cl-keys)
+(defun cl-rassoc (cl-item cl-alist &rest cl-keys)
   "Find the first item whose cdr matches ITEM in LIST.
 \nKeywords supported:  :test :test-not :key
 \n(fn ITEM LIST [KEYWORD VALUE]...)"
   (if (or cl-keys (numberp cl-item))
-      (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
+      (cl--parsing-keywords (:test :test-not :key :if :if-not) ()
        (while (and cl-alist
                    (or (not (consp (car cl-alist)))
-                       (not (cl-check-test cl-item (cdr (car cl-alist))))))
+                       (not (cl--check-test cl-item (cdr (car cl-alist))))))
          (setq cl-alist (cdr cl-alist)))
        (and cl-alist (car cl-alist)))
     (rassq cl-item cl-alist)))
 
 ;;;###autoload
-(defun rassoc-if (cl-pred cl-list &rest cl-keys)
+(defun cl-rassoc-if (cl-pred cl-list &rest cl-keys)
   "Find the first item whose cdr satisfies PREDICATE in LIST.
 \nKeywords supported:  :key
 \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
-  (apply 'rassoc* nil cl-list :if cl-pred cl-keys))
+  (apply 'cl-rassoc nil cl-list :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun rassoc-if-not (cl-pred cl-list &rest cl-keys)
+(defun cl-rassoc-if-not (cl-pred cl-list &rest cl-keys)
   "Find the first item whose cdr does not satisfy PREDICATE in LIST.
 \nKeywords supported:  :key
 \n(fn PREDICATE LIST [KEYWORD VALUE]...)"
-  (apply 'rassoc* nil cl-list :if-not cl-pred cl-keys))
+  (apply 'cl-rassoc nil cl-list :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun union (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-union (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-union operation.
 The resulting list contains all items that appear in either LIST1 or LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -782,14 +776,14 @@ to avoid corrupting the original LIST1 and LIST2.
             (setq cl-list1 (prog1 cl-list2 (setq cl-list2 cl-list1))))
         (while cl-list2
           (if (or cl-keys (numberp (car cl-list2)))
-              (setq cl-list1 (apply 'adjoin (car cl-list2) cl-list1 cl-keys))
+              (setq cl-list1 (apply 'cl-adjoin (car cl-list2) cl-list1 cl-keys))
             (or (memq (car cl-list2) cl-list1)
                 (push (car cl-list2) cl-list1)))
           (pop cl-list2))
         cl-list1)))
 
 ;;;###autoload
-(defun nunion (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-nunion (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-union operation.
 The resulting list contains all items that appear in either LIST1 or LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
@@ -797,10 +791,10 @@ whenever possible.
 \nKeywords supported:  :test :test-not :key
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
   (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
-       (t (apply 'union cl-list1 cl-list2 cl-keys))))
+       (t (apply 'cl-union cl-list1 cl-list2 cl-keys))))
 
 ;;;###autoload
-(defun intersection (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-intersection (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-intersection operation.
 The resulting list contains all items that appear in both LIST1 and LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -809,13 +803,13 @@ to avoid corrupting the original LIST1 and LIST2.
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
   (and cl-list1 cl-list2
        (if (equal cl-list1 cl-list2) cl-list1
-        (cl-parsing-keywords (:key) (:test :test-not)
+        (cl--parsing-keywords (:key) (:test :test-not)
           (let ((cl-res nil))
             (or (>= (length cl-list1) (length cl-list2))
                 (setq cl-list1 (prog1 cl-list2 (setq cl-list2 cl-list1))))
             (while cl-list2
               (if (if (or cl-keys (numberp (car cl-list2)))
-                      (apply 'member* (cl-check-key (car cl-list2))
+                      (apply 'cl-member (cl--check-key (car cl-list2))
                              cl-list1 cl-keys)
                     (memq (car cl-list2) cl-list1))
                   (push (car cl-list2) cl-res))
@@ -823,17 +817,17 @@ to avoid corrupting the original LIST1 and LIST2.
             cl-res)))))
 
 ;;;###autoload
-(defun nintersection (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-nintersection (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-intersection operation.
 The resulting list contains all items that appear in both LIST1 and LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
 whenever possible.
 \nKeywords supported:  :test :test-not :key
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
-  (and cl-list1 cl-list2 (apply 'intersection cl-list1 cl-list2 cl-keys)))
+  (and cl-list1 cl-list2 (apply 'cl-intersection cl-list1 cl-list2 cl-keys)))
 
 ;;;###autoload
-(defun set-difference (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-set-difference (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-difference operation.
 The resulting list contains all items that appear in LIST1 but not LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -841,11 +835,11 @@ to avoid corrupting the original LIST1 and LIST2.
 \nKeywords supported:  :test :test-not :key
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
   (if (or (null cl-list1) (null cl-list2)) cl-list1
-    (cl-parsing-keywords (:key) (:test :test-not)
+    (cl--parsing-keywords (:key) (:test :test-not)
       (let ((cl-res nil))
        (while cl-list1
          (or (if (or cl-keys (numberp (car cl-list1)))
-                 (apply 'member* (cl-check-key (car cl-list1))
+                 (apply 'cl-member (cl--check-key (car cl-list1))
                         cl-list2 cl-keys)
                (memq (car cl-list1) cl-list2))
              (push (car cl-list1) cl-res))
@@ -853,7 +847,7 @@ to avoid corrupting the original LIST1 and LIST2.
        cl-res))))
 
 ;;;###autoload
-(defun nset-difference (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-nset-difference (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-difference operation.
 The resulting list contains all items that appear in LIST1 but not LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
@@ -861,10 +855,10 @@ whenever possible.
 \nKeywords supported:  :test :test-not :key
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
   (if (or (null cl-list1) (null cl-list2)) cl-list1
-    (apply 'set-difference cl-list1 cl-list2 cl-keys)))
+    (apply 'cl-set-difference cl-list1 cl-list2 cl-keys)))
 
 ;;;###autoload
-(defun set-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-set-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-exclusive-or operation.
 The resulting list contains all items appearing in exactly one of LIST1, LIST2.
 This is a non-destructive function; it makes a copy of the data if necessary
@@ -873,11 +867,11 @@ to avoid corrupting the original LIST1 and LIST2.
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
   (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
        ((equal cl-list1 cl-list2) nil)
-       (t (append (apply 'set-difference cl-list1 cl-list2 cl-keys)
-                  (apply 'set-difference cl-list2 cl-list1 cl-keys)))))
+       (t (append (apply 'cl-set-difference cl-list1 cl-list2 cl-keys)
+                  (apply 'cl-set-difference cl-list2 cl-list1 cl-keys)))))
 
 ;;;###autoload
-(defun nset-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-nset-exclusive-or (cl-list1 cl-list2 &rest cl-keys)
   "Combine LIST1 and LIST2 using a set-exclusive-or operation.
 The resulting list contains all items appearing in exactly one of LIST1, LIST2.
 This is a destructive function; it reuses the storage of LIST1 and LIST2
@@ -886,127 +880,130 @@ whenever possible.
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
   (cond ((null cl-list1) cl-list2) ((null cl-list2) cl-list1)
        ((equal cl-list1 cl-list2) nil)
-       (t (nconc (apply 'nset-difference cl-list1 cl-list2 cl-keys)
-                 (apply 'nset-difference cl-list2 cl-list1 cl-keys)))))
+       (t (nconc (apply 'cl-nset-difference cl-list1 cl-list2 cl-keys)
+                 (apply 'cl-nset-difference cl-list2 cl-list1 cl-keys)))))
 
 ;;;###autoload
-(defun subsetp (cl-list1 cl-list2 &rest cl-keys)
+(defun cl-subsetp (cl-list1 cl-list2 &rest cl-keys)
   "Return true if LIST1 is a subset of LIST2.
 I.e., if every element of LIST1 also appears in LIST2.
 \nKeywords supported:  :test :test-not :key
 \n(fn LIST1 LIST2 [KEYWORD VALUE]...)"
   (cond ((null cl-list1) t) ((null cl-list2) nil)
        ((equal cl-list1 cl-list2) t)
-       (t (cl-parsing-keywords (:key) (:test :test-not)
+       (t (cl--parsing-keywords (:key) (:test :test-not)
             (while (and cl-list1
-                        (apply 'member* (cl-check-key (car cl-list1))
+                        (apply 'cl-member (cl--check-key (car cl-list1))
                                cl-list2 cl-keys))
               (pop cl-list1))
             (null cl-list1)))))
 
 ;;;###autoload
-(defun subst-if (cl-new cl-pred cl-tree &rest cl-keys)
+(defun cl-subst-if (cl-new cl-pred cl-tree &rest cl-keys)
   "Substitute NEW for elements matching PREDICATE in TREE (non-destructively).
 Return a copy of TREE with all matching elements replaced by NEW.
 \nKeywords supported:  :key
 \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
-  (apply 'sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
+  (apply 'cl-sublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun subst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
+(defun cl-subst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
   "Substitute NEW for elts not matching PREDICATE in TREE (non-destructively).
 Return a copy of TREE with all non-matching elements replaced by NEW.
 \nKeywords supported:  :key
 \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
-  (apply 'sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
+  (apply 'cl-sublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
 
 ;;;###autoload
-(defun nsubst (cl-new cl-old cl-tree &rest cl-keys)
+(defun cl-nsubst (cl-new cl-old cl-tree &rest cl-keys)
   "Substitute NEW for OLD everywhere in TREE (destructively).
 Any element of TREE which is `eql' to OLD is changed to NEW (via a call
 to `setcar').
 \nKeywords supported:  :test :test-not :key
 \n(fn NEW OLD TREE [KEYWORD VALUE]...)"
-  (apply 'nsublis (list (cons cl-old cl-new)) cl-tree cl-keys))
+  (apply 'cl-nsublis (list (cons cl-old cl-new)) cl-tree cl-keys))
 
 ;;;###autoload
-(defun nsubst-if (cl-new cl-pred cl-tree &rest cl-keys)
+(defun cl-nsubst-if (cl-new cl-pred cl-tree &rest cl-keys)
   "Substitute NEW for elements matching PREDICATE in TREE (destructively).
 Any element of TREE which matches is changed to NEW (via a call to `setcar').
 \nKeywords supported:  :key
 \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
-  (apply 'nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
+  (apply 'cl-nsublis (list (cons nil cl-new)) cl-tree :if cl-pred cl-keys))
 
 ;;;###autoload
-(defun nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
+(defun cl-nsubst-if-not (cl-new cl-pred cl-tree &rest cl-keys)
   "Substitute NEW for elements not matching PREDICATE in TREE (destructively).
 Any element of TREE which matches is changed to NEW (via a call to `setcar').
 \nKeywords supported:  :key
 \n(fn NEW PREDICATE TREE [KEYWORD VALUE]...)"
-  (apply 'nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
+  (apply 'cl-nsublis (list (cons nil cl-new)) cl-tree :if-not cl-pred cl-keys))
+
+(defvar cl--alist)
 
 ;;;###autoload
-(defun sublis (cl-alist cl-tree &rest cl-keys)
+(defun cl-sublis (cl-alist cl-tree &rest cl-keys)
   "Perform substitutions indicated by ALIST in TREE (non-destructively).
 Return a copy of TREE with all matching elements replaced.
 \nKeywords supported:  :test :test-not :key
 \n(fn ALIST TREE [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
-    (cl-sublis-rec cl-tree)))
+  (cl--parsing-keywords (:test :test-not :key :if :if-not) ()
+    (let ((cl--alist cl-alist))
+      (cl--sublis-rec cl-tree))))
 
-(defvar cl-alist)
-(defun cl-sublis-rec (cl-tree)   ; uses cl-alist/key/test*/if*
-  (let ((cl-temp (cl-check-key cl-tree)) (cl-p cl-alist))
-    (while (and cl-p (not (cl-check-test-nokey (car (car cl-p)) cl-temp)))
+(defun cl--sublis-rec (cl-tree)   ;Uses cl--alist cl-key/test*/if*.
+  (let ((cl-temp (cl--check-key cl-tree)) (cl-p cl--alist))
+    (while (and cl-p (not (cl--check-test-nokey (car (car cl-p)) cl-temp)))
       (setq cl-p (cdr cl-p)))
     (if cl-p (cdr (car cl-p))
       (if (consp cl-tree)
-         (let ((cl-a (cl-sublis-rec (car cl-tree)))
-               (cl-d (cl-sublis-rec (cdr cl-tree))))
+         (let ((cl-a (cl--sublis-rec (car cl-tree)))
+               (cl-d (cl--sublis-rec (cdr cl-tree))))
            (if (and (eq cl-a (car cl-tree)) (eq cl-d (cdr cl-tree)))
                cl-tree
              (cons cl-a cl-d)))
        cl-tree))))
 
 ;;;###autoload
-(defun nsublis (cl-alist cl-tree &rest cl-keys)
+(defun cl-nsublis (cl-alist cl-tree &rest cl-keys)
   "Perform substitutions indicated by ALIST in TREE (destructively).
 Any matching element of TREE is changed via a call to `setcar'.
 \nKeywords supported:  :test :test-not :key
 \n(fn ALIST TREE [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key :if :if-not) ()
-    (let ((cl-hold (list cl-tree)))
-      (cl-nsublis-rec cl-hold)
+  (cl--parsing-keywords (:test :test-not :key :if :if-not) ()
+    (let ((cl-hold (list cl-tree))
+          (cl--alist cl-alist))
+      (cl--nsublis-rec cl-hold)
       (car cl-hold))))
 
-(defun cl-nsublis-rec (cl-tree)   ; uses cl-alist/temp/p/key/test*/if*
+(defun cl--nsublis-rec (cl-tree)   ;Uses cl--alist cl-key/test*/if*.
   (while (consp cl-tree)
-    (let ((cl-temp (cl-check-key (car cl-tree))) (cl-p cl-alist))
-      (while (and cl-p (not (cl-check-test-nokey (car (car cl-p)) cl-temp)))
+    (let ((cl-temp (cl--check-key (car cl-tree))) (cl-p cl--alist))
+      (while (and cl-p (not (cl--check-test-nokey (car (car cl-p)) cl-temp)))
        (setq cl-p (cdr cl-p)))
       (if cl-p (setcar cl-tree (cdr (car cl-p)))
-       (if (consp (car cl-tree)) (cl-nsublis-rec (car cl-tree))))
-      (setq cl-temp (cl-check-key (cdr cl-tree)) cl-p cl-alist)
-      (while (and cl-p (not (cl-check-test-nokey (car (car cl-p)) cl-temp)))
+       (if (consp (car cl-tree)) (cl--nsublis-rec (car cl-tree))))
+      (setq cl-temp (cl--check-key (cdr cl-tree)) cl-p cl--alist)
+      (while (and cl-p (not (cl--check-test-nokey (car (car cl-p)) cl-temp)))
        (setq cl-p (cdr cl-p)))
       (if cl-p
          (progn (setcdr cl-tree (cdr (car cl-p))) (setq cl-tree nil))
        (setq cl-tree (cdr cl-tree))))))
 
 ;;;###autoload
-(defun tree-equal (cl-x cl-y &rest cl-keys)
+(defun cl-tree-equal (cl-x cl-y &rest cl-keys)
   "Return t if trees TREE1 and TREE2 have `eql' leaves.
 Atoms are compared by `eql'; cons cells are compared recursively.
 \nKeywords supported:  :test :test-not :key
 \n(fn TREE1 TREE2 [KEYWORD VALUE]...)"
-  (cl-parsing-keywords (:test :test-not :key) ()
-    (cl-tree-equal-rec cl-x cl-y)))
+  (cl--parsing-keywords (:test :test-not :key) ()
+    (cl--tree-equal-rec cl-x cl-y)))
 
-(defun cl-tree-equal-rec (cl-x cl-y)
+(defun cl--tree-equal-rec (cl-x cl-y)   ;Uses cl-key/test*.
   (while (and (consp cl-x) (consp cl-y)
-             (cl-tree-equal-rec (car cl-x) (car cl-y)))
+             (cl--tree-equal-rec (car cl-x) (car cl-y)))
     (setq cl-x (cdr cl-x) cl-y (cdr cl-y)))
-  (and (not (consp cl-x)) (not (consp cl-y)) (cl-check-match cl-x cl-y)))
+  (and (not (consp cl-x)) (not (consp cl-y)) (cl--check-match cl-x cl-y)))
 
 
 (run-hooks 'cl-seq-load-hook)
diff --git a/lisp/emacs-lisp/cl-specs.el b/lisp/emacs-lisp/cl-specs.el
deleted file mode 100644 (file)
index dbadf06..0000000
+++ /dev/null
@@ -1,471 +0,0 @@
-;;; cl-specs.el --- Edebug specs for cl.el -*- no-byte-compile: t -*-
-
-;; Copyright (C) 1993, 2001-2012 Free Software Foundation, Inc.
-;; Author: Daniel LaLiberte <liberte@holonexus.org>
-;; Keywords: lisp, tools, maint
-;; Package: emacs
-
-;; LCD Archive Entry:
-;; cl-specs.el|Daniel LaLiberte|liberte@holonexus.org
-;; |Edebug specs for cl.el
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; These specs are to be used with edebug.el version 3.3 or later and
-;; cl.el version 2.03 or later, by Dave Gillespie <daveg@synaptics.com>.
-
-;; This file need not be byte-compiled, but it shouldn't hurt.
-
-;;; Code:
-
-(provide 'cl-specs)
-;; Do the above provide before the following require.
-;; Otherwise if you load this before edebug if cl is already loaded
-;; an infinite loading loop would occur.
-(require 'edebug)
-
-;; Blocks
-
-(def-edebug-spec block (symbolp body))
-(def-edebug-spec return (&optional form))
-(def-edebug-spec return-from (symbolp &optional form))
-
-;; Loops
-
-(def-edebug-spec case (form &rest (sexp body)))
-(def-edebug-spec ecase case)
-(def-edebug-spec do
-  ((&rest &or symbolp (symbolp &optional form form))
-   (form body)
-   cl-declarations body))
-(def-edebug-spec do* do)
-(def-edebug-spec dolist
-  ((symbolp form &optional form) cl-declarations body))
-(def-edebug-spec dotimes dolist)
-(def-edebug-spec do-symbols
-  ((symbolp &optional form form) cl-declarations body))
-(def-edebug-spec do-all-symbols
-  ((symbolp &optional form) cl-declarations body))
-
-;; Multiple values
-
-(def-edebug-spec multiple-value-list (form))
-(def-edebug-spec multiple-value-call (function-form body))
-(def-edebug-spec multiple-value-bind
-  ((&rest symbolp) form body))
-(def-edebug-spec multiple-value-setq ((&rest symbolp) form))
-(def-edebug-spec multiple-value-prog1 (form body))
-
-;; Bindings
-
-(def-edebug-spec lexical-let let)
-(def-edebug-spec lexical-let* let)
-
-(def-edebug-spec psetq setq)
-(def-edebug-spec progv (form form body))
-
-(def-edebug-spec flet ((&rest (defun*)) cl-declarations body))
-(def-edebug-spec labels flet)
-
-(def-edebug-spec macrolet
-  ((&rest (&define name (&rest arg) cl-declarations-or-string def-body))
-   cl-declarations body))
-
-(def-edebug-spec symbol-macrolet
-  ((&rest (symbol sexp)) cl-declarations body))
-
-(def-edebug-spec destructuring-bind
-  (&define cl-macro-list def-form cl-declarations def-body))
-
-;; Setf
-
-(def-edebug-spec setf (&rest [place form])) ;; sexp is not specific enough
-(def-edebug-spec psetf setf)
-
-(def-edebug-spec letf  ;; *not* available in Common Lisp
-  ((&rest (gate place &optional form))
-   body))
-(def-edebug-spec letf* letf)
-
-
-(def-edebug-spec defsetf
-  (&define name
-          [&or [symbolp &optional stringp]
-               [cl-lambda-list (symbolp)]]
-          cl-declarations-or-string def-body))
-
-(def-edebug-spec define-setf-method
-  (&define name cl-lambda-list cl-declarations-or-string def-body))
-
-(def-edebug-spec define-modify-macro
-  (&define name cl-lambda-list ;; should exclude &key
-          symbolp &optional stringp))
-
-(def-edebug-spec callf (function* place &rest form))
-(def-edebug-spec callf2 (function* form place &rest form))
-
-;; Other operations on places
-
-(def-edebug-spec remf (place form))
-
-(def-edebug-spec incf (place &optional form))
-(def-edebug-spec decf incf)
-(def-edebug-spec push (form place))    ; different for CL
-(def-edebug-spec pushnew
-  (form place &rest
-       &or [[&or ":test" ":test-not" ":key"] function-form]
-       [keywordp form]))
-(def-edebug-spec pop (place))          ; different for CL
-
-(def-edebug-spec shiftf (&rest place))  ;; really [&rest place] form
-(def-edebug-spec rotatef (&rest place))
-
-
-;; Functions with function args.  These are only useful if the
-;; function arg is quoted with ' instead of function.
-
-(def-edebug-spec some (function-form form &rest form))
-(def-edebug-spec every some)
-(def-edebug-spec notany some)
-(def-edebug-spec notevery some)
-
-;; Mapping
-
-(def-edebug-spec map (form function-form form &rest form))
-(def-edebug-spec maplist (function-form form &rest form))
-(def-edebug-spec mapc maplist)
-(def-edebug-spec mapl maplist)
-(def-edebug-spec mapcan maplist)
-(def-edebug-spec mapcon maplist)
-
-;; Sequences
-
-(def-edebug-spec reduce (function-form form &rest form))
-
-;; Types and assertions
-
-(def-edebug-spec cl-type-spec (sexp)) ;; not worth the trouble to specify, yet.
-
-(def-edebug-spec deftype defmacro*)
-(def-edebug-spec check-type (place cl-type-spec &optional stringp))
-;; (def-edebug-spec assert (form &optional form stringp &rest form))
-(def-edebug-spec assert (form &rest form))
-(def-edebug-spec typecase (form &rest ([&or cl-type-spec "otherwise"] body)))
-(def-edebug-spec etypecase typecase)
-
-(def-edebug-spec ignore-errors t)
-
-;; Time of Evaluation
-
-(def-edebug-spec eval-when
-  ((&rest &or "compile" "load" "eval") body))
-(def-edebug-spec load-time-value (form &optional &or "t" "nil"))
-
-;; Declarations
-
-(def-edebug-spec cl-decl-spec
-  ((symbolp &rest sexp)))
-
-(def-edebug-spec cl-declarations
-  (&rest ("declare" &rest cl-decl-spec)))
-
-(def-edebug-spec cl-declarations-or-string
-  (&or stringp cl-declarations))
-
-(def-edebug-spec declaim (&rest cl-decl-spec))
-(def-edebug-spec declare (&rest cl-decl-spec))  ;; probably not needed.
-(def-edebug-spec locally (cl-declarations &rest form))
-(def-edebug-spec the (cl-type-spec form))
-
-;;======================================================
-;; Lambda things
-
-(def-edebug-spec cl-lambda-list
-  (([&rest arg]
-    [&optional ["&optional" cl-&optional-arg &rest cl-&optional-arg]]
-    [&optional ["&rest" arg]]
-    [&optional ["&key" [cl-&key-arg &rest cl-&key-arg]
-               &optional "&allow-other-keys"]]
-    [&optional ["&aux" &rest
-               &or (symbolp &optional def-form) symbolp]]
-    )))
-
-(def-edebug-spec cl-&optional-arg
-  (&or (arg &optional def-form arg) arg))
-
-(def-edebug-spec cl-&key-arg
-  (&or ([&or (symbolp arg) arg] &optional def-form arg) arg))
-
-;; The lambda list for macros is different from that of normal lambdas.
-;; Note that &environment is only allowed as first or last items in the
-;; top level list.
-
-(def-edebug-spec cl-macro-list
-  (([&optional "&environment" arg]
-    [&rest cl-macro-arg]
-    [&optional ["&optional" &rest
-               &or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
-    [&optional [[&or "&rest" "&body"] cl-macro-arg]]
-    [&optional ["&key" [&rest
-                       [&or ([&or (symbolp cl-macro-arg) arg]
-                             &optional def-form cl-macro-arg)
-                            arg]]
-               &optional "&allow-other-keys"]]
-    [&optional ["&aux" &rest
-               &or (symbolp &optional def-form) symbolp]]
-    [&optional "&environment" arg]
-    )))
-
-(def-edebug-spec cl-macro-arg
-  (&or arg cl-macro-list1))
-
-(def-edebug-spec cl-macro-list1
-  (([&optional "&whole" arg]  ;; only allowed at lower levels
-    [&rest cl-macro-arg]
-    [&optional ["&optional" &rest
-               &or (cl-macro-arg &optional def-form cl-macro-arg) arg]]
-    [&optional [[&or "&rest" "&body"] cl-macro-arg]]
-    [&optional ["&key" [&rest
-                       [&or ([&or (symbolp cl-macro-arg) arg]
-                             &optional def-form cl-macro-arg)
-                            arg]]
-               &optional "&allow-other-keys"]]
-    [&optional ["&aux" &rest
-               &or (symbolp &optional def-form) symbolp]]
-    . [&or arg nil])))
-
-
-(def-edebug-spec defun*
-  ;; Same as defun but use cl-lambda-list.
-  (&define [&or name
-               ("setf" :name setf name)]
-          cl-lambda-list
-          cl-declarations-or-string
-          [&optional ("interactive" interactive)]
-          def-body))
-(def-edebug-spec defsubst* defun*)
-
-(def-edebug-spec defmacro*
-  (&define name cl-macro-list cl-declarations-or-string def-body))
-(def-edebug-spec define-compiler-macro defmacro*)
-
-
-(def-edebug-spec function*
-  (&or symbolp cl-lambda-expr))
-
-(def-edebug-spec cl-lambda-expr
-  (&define ("lambda" cl-lambda-list
-           ;;cl-declarations-or-string
-           ;;[&optional ("interactive" interactive)]
-           def-body)))
-
-;; Redefine function-form to also match function*
-(def-edebug-spec function-form
-  ;; form at the end could also handle "function",
-  ;; but recognize it specially to avoid wrapping function forms.
-  (&or ([&or "quote" "function"] &or symbolp lambda-expr)
-       ("function*" function*)
-       form))
-
-;;======================================================
-;; Structures
-;; (def-edebug-spec defstruct (&rest sexp)) would be sufficient, but...
-
-;; defstruct may contain forms that are evaluated when a structure is created.
-(def-edebug-spec defstruct
-  (&define  ; makes top-level form not be wrapped
-   [&or symbolp
-       (gate
-        symbolp &rest
-                (&or [":conc-name" symbolp]
-                     [":constructor" symbolp &optional cl-lambda-list]
-                     [":copier" symbolp]
-                     [":predicate" symbolp]
-                     [":include" symbolp &rest sexp];; not finished
-                     ;; The following are not supported.
-                     ;; [":print-function" ...]
-                     ;; [":type" ...]
-                     ;; [":initial-offset" ...]
-                     ))]
-   [&optional stringp]
-   ;; All the above is for the following def-form.
-   &rest &or symbolp (symbolp def-form &optional ":read-only" sexp)))
-
-;;======================================================
-;; Loop
-
-;; The loop macro is very complex, and a full spec is found below.
-;; The following spec only minimally specifies that
-;; parenthesized forms are executable, but single variables used as
-;; expressions will be missed.  You may want to use this if the full
-;; spec causes problems for you.
-
-(def-edebug-spec loop
-  (&rest &or symbolp form))
-
-;; Below is a complete spec for loop, in several parts that correspond
-;; to the syntax given in CLtL2.  The specs do more than specify where
-;; the forms are; it also specifies, as much as Edebug allows, all the
-;; syntactically valid loop clauses.  The disadvantage of this
-;; completeness is rigidity, but the "for ... being" clause allows
-;; arbitrary extensions of the form: [symbolp &rest &or symbolp form].
-
-(def-edebug-spec loop
-  ([&optional ["named" symbolp]]
-   [&rest
-    &or
-    ["repeat" form]
-    loop-for-as
-    loop-with
-    loop-initial-final]
-   [&rest loop-clause]
-   ))
-
-(def-edebug-spec loop-with
-  ("with" loop-var
-   loop-type-spec
-   [&optional ["=" form]]
-   &rest ["and" loop-var
-         loop-type-spec
-         [&optional ["=" form]]]))
-
-(def-edebug-spec loop-for-as
-  ([&or "for" "as"] loop-for-as-subclause
-   &rest ["and" loop-for-as-subclause]))
-
-(def-edebug-spec loop-for-as-subclause
-  (loop-var
-   loop-type-spec
-   &or
-   [[&or "in" "on" "in-ref" "across-ref"]
-    form &optional ["by" function-form]]
-
-   ["=" form &optional ["then" form]]
-   ["across" form]
-   ["being"
-    [&or "the" "each"]
-    &or
-    [[&or "element" "elements"]
-     [&or "of" "in" "of-ref"] form
-     &optional "using" ["index" symbolp]];; is this right?
-    [[&or "hash-key" "hash-keys"
-         "hash-value" "hash-values"]
-     [&or "of" "in"]
-     hash-table-p &optional ["using" ([&or "hash-value" "hash-values"
-                                          "hash-key" "hash-keys"] sexp)]]
-
-    [[&or "symbol" "present-symbol" "external-symbol"
-         "symbols" "present-symbols" "external-symbols"]
-     [&or "in" "of"] package-p]
-
-    ;; Extensions for Emacs Lisp, including Lucid Emacs.
-    [[&or "frame" "frames"
-         "screen" "screens"
-         "buffer" "buffers"]]
-
-    [[&or "window" "windows"]
-     [&or "of" "in"] form]
-
-    [[&or "overlay" "overlays"
-         "extent" "extents"]
-     [&or "of" "in"] form
-     &optional [[&or "from" "to"] form]]
-
-    [[&or "interval" "intervals"]
-     [&or "in" "of"] form
-     &optional [[&or "from" "to"] form]
-     ["property" form]]
-
-    [[&or "key-code" "key-codes"
-         "key-seq" "key-seqs"
-         "key-binding" "key-bindings"]
-     [&or "in" "of"] form
-     &optional ["using" ([&or "key-code" "key-codes"
-                             "key-seq" "key-seqs"
-                             "key-binding" "key-bindings"]
-                        sexp)]]
-    ;; For arbitrary extensions, recognize anything else.
-    [symbolp &rest &or symbolp form]
-    ]
-
-   ;; arithmetic - must be last since all parts are optional.
-   [[&optional [[&or "from" "downfrom" "upfrom"] form]]
-    [&optional [[&or "to" "downto" "upto" "below" "above"] form]]
-    [&optional ["by" form]]
-    ]))
-
-(def-edebug-spec loop-initial-final
-  (&or ["initially"
-       ;; [&optional &or "do" "doing"]  ;; CLtL2 doesn't allow this.
-       &rest loop-non-atomic-expr]
-       ["finally" &or
-       [[&optional &or "do" "doing"] &rest loop-non-atomic-expr]
-       ["return" form]]))
-
-(def-edebug-spec loop-and-clause
-  (loop-clause &rest ["and" loop-clause]))
-
-(def-edebug-spec loop-clause
-  (&or
-   [[&or "while" "until" "always" "never" "thereis"] form]
-
-   [[&or "collect" "collecting"
-        "append" "appending"
-        "nconc" "nconcing"
-        "concat" "vconcat"] form
-        [&optional ["into" loop-var]]]
-
-   [[&or "count" "counting"
-        "sum" "summing"
-        "maximize" "maximizing"
-        "minimize" "minimizing"] form
-        [&optional ["into" loop-var]]
-        loop-type-spec]
-
-   [[&or "if" "when" "unless"]
-    form loop-and-clause
-    [&optional ["else" loop-and-clause]]
-    [&optional "end"]]
-
-   [[&or "do" "doing"] &rest loop-non-atomic-expr]
-
-   ["return" form]
-   loop-initial-final
-   ))
-
-(def-edebug-spec loop-non-atomic-expr
-  ([&not atom] form))
-
-(def-edebug-spec loop-var
-  ;; The symbolp must be last alternative to recognize e.g. (a b . c)
-  ;; loop-var =>
-  ;; (loop-var . [&or nil loop-var])
-  ;; (symbolp . [&or nil loop-var])
-  ;; (symbolp . loop-var)
-  ;; (symbolp . (symbolp . [&or nil loop-var]))
-  ;; (symbolp . (symbolp . loop-var))
-  ;; (symbolp . (symbolp . symbolp)) == (symbolp symbolp . symbolp)
-  (&or (loop-var . [&or nil loop-var]) [gate symbolp]))
-
-(def-edebug-spec loop-type-spec
-  (&optional ["of-type" loop-d-type-spec]))
-
-(def-edebug-spec loop-d-type-spec
-  (&or (loop-d-type-spec . [&or nil loop-d-type-spec]) cl-type-spec))
-
-;;; cl-specs.el ends here
index 971024fcbba214cf42b673fb5f0a36ecab142ce5..32cf1670744578e04f9c4bf96f507cbc0bae3769 100644 (file)
@@ -1,9 +1,8 @@
-;;; cl.el --- Common Lisp extensions for Emacs
+;;; cl.el --- Compatibility aliases for the old CL library.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2012  Free Software Foundation, Inc.
 
-;; Author: Dave Gillespie <daveg@synaptics.com>
-;; Version: 2.02
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: extensions
 
 ;; This file is part of GNU Emacs.
 
 ;;; Commentary:
 
-;; These are extensions to Emacs Lisp that provide a degree of
-;; Common Lisp compatibility, beyond what is already built-in
-;; in Emacs Lisp.
-;;
-;; This package was written by Dave Gillespie; it is a complete
-;; rewrite of Cesar Quiroz's original cl.el package of December 1986.
-;;
-;; Bug reports, comments, and suggestions are welcome!
-
-;; This file contains the portions of the Common Lisp extensions
-;; package which should always be present.
-
-
-;;; Future notes:
-
-;; Once Emacs 19 becomes standard, many things in this package which are
-;; messy for reasons of compatibility can be greatly simplified.  For now,
-;; I prefer to maintain one unified version.
-
-
-;;; Change Log:
-
-;; Version 2.02 (30 Jul 93):
-;;  * Added "cl-compat.el" file, extra compatibility with old package.
-;;  * Added `lexical-let' and `lexical-let*'.
-;;  * Added `define-modify-macro', `callf', and `callf2'.
-;;  * Added `ignore-errors'.
-;;  * Changed `(setf (nthcdr N PLACE) X)' to work when N is zero.
-;;  * Merged `*gentemp-counter*' into `*gensym-counter*'.
-;;  * Extended `subseq' to allow negative START and END like `substring'.
-;;  * Added `in-ref', `across-ref', `elements of-ref' loop clauses.
-;;  * Added `concat', `vconcat' loop clauses.
-;;  * Cleaned up a number of compiler warnings.
-
-;; Version 2.01 (7 Jul 93):
-;;  * Added support for FSF version of Emacs 19.
-;;  * Added `add-hook' for Emacs 18 users.
-;;  * Added `defsubst*' and `symbol-macrolet'.
-;;  * Added `maplist', `mapc', `mapl', `mapcan', `mapcon'.
-;;  * Added `map', `concatenate', `reduce', `merge'.
-;;  * Added `revappend', `nreconc', `tailp', `tree-equal'.
-;;  * Added `assert', `check-type', `typecase', `typep', and `deftype'.
-;;  * Added destructuring and `&environment' support to `defmacro*'.
-;;  * Added destructuring to `loop', and added the following clauses:
-;;      `elements', `frames', `overlays', `intervals', `buffers', `key-seqs'.
-;;  * Renamed `delete' to `delete*' and `remove' to `remove*'.
-;;  * Completed support for all keywords in `remove*', `substitute', etc.
-;;  * Added `most-positive-float' and company.
-;;  * Fixed hash tables to work with latest Lucid Emacs.
-;;  * `proclaim' forms are no longer compile-time-evaluating; use `declaim'.
-;;  * Syntax for `warn' declarations has changed.
-;;  * Improved implementation of `random*'.
-;;  * Moved most sequence functions to a new file, cl-seq.el.
-;;  * Moved `eval-when' into cl-macs.el.
-;;  * Moved `pushnew' and `adjoin' to cl.el for most common cases.
-;;  * Moved `provide' forms down to ends of files.
-;;  * Changed expansion of `pop' to something that compiles to better code.
-;;  * Changed so that no patch is required for Emacs 19 byte compiler.
-;;  * Made more things dependent on `optimize' declarations.
-;;  * Added a partial implementation of struct print functions.
-;;  * Miscellaneous minor changes.
-
-;; Version 2.00:
-;;  * First public release of this package.
-
+;; This is a compatibility file which provides the old names provided by CL
+;; before we cleaned up its namespace usage.
 
 ;;; Code:
 
-(defvar cl-optimize-speed 1)
-(defvar cl-optimize-safety 1)
-
-
-;;;###autoload
-(defvar custom-print-functions nil
-  "This is a list of functions that format user objects for printing.
-Each function is called in turn with three arguments: the object, the
-stream, and the print level (currently ignored).  If it is able to
-print the object it returns true; otherwise it returns nil and the
-printer proceeds to the next function on the list.
-
-This variable is not used at present, but it is defined in hopes that
-a future Emacs interpreter will be able to use it.")
-
-(defun cl-unload-function ()
-  "Stop unloading of the Common Lisp extensions."
-  (message "Cannot unload the feature `cl'")
-  ;; stop standard unloading!
-  t)
-
-;;; Generalized variables.
-;; These macros are defined here so that they
-;; can safely be used in .emacs files.
-
-(defmacro incf (place &optional x)
-  "Increment PLACE by X (1 by default).
-PLACE may be a symbol, or any generalized variable allowed by `setf'.
-The return value is the incremented value of PLACE."
-  (if (symbolp place)
-      (list 'setq place (if x (list '+ place x) (list '1+ place)))
-    (list 'callf '+ place (or x 1))))
-
-(defmacro decf (place &optional x)
-  "Decrement PLACE by X (1 by default).
-PLACE may be a symbol, or any generalized variable allowed by `setf'.
-The return value is the decremented value of PLACE."
-  (if (symbolp place)
-      (list 'setq place (if x (list '- place x) (list '1- place)))
-    (list 'callf '- place (or x 1))))
-
-;; Autoloaded, but we haven't loaded cl-loaddefs yet.
-(declare-function cl-do-pop "cl-macs" (place))
-
-(defmacro pop (place)
-  "Remove and return the head of the list stored in PLACE.
-Analogous to (prog1 (car PLACE) (setf PLACE (cdr PLACE))), though more
-careful about evaluating each argument only once and in the right order.
-PLACE may be a symbol, or any generalized variable allowed by `setf'."
-  (if (symbolp place)
-      (list 'car (list 'prog1 place (list 'setq place (list 'cdr place))))
-    (cl-do-pop place)))
-
-(defmacro push (x place)
-  "Insert X at the head of the list stored in PLACE.
-Analogous to (setf PLACE (cons X PLACE)), though more careful about
-evaluating each argument only once and in the right order.  PLACE may
-be a symbol, or any generalized variable allowed by `setf'."
-  (if (symbolp place) (list 'setq place (list 'cons x place))
-    (list 'callf2 'cons x place)))
-
-(defmacro pushnew (x place &rest keys)
-  "(pushnew X PLACE): insert X at the head of the list if not already there.
-Like (push X PLACE), except that the list is unmodified if X is `eql' to
-an element already on the list.
-\nKeywords supported:  :test :test-not :key
-\n(fn X PLACE [KEYWORD VALUE]...)"
-  (if (symbolp place)
-      (if (null keys)
-         `(let ((x ,x))
-            (if (memql x ,place)
-                 ;; This symbol may later on expand to actual code which then
-                 ;; trigger warnings like "value unused" since pushnew's return
-                 ;; value is rarely used.  It should not matter that other
-                 ;; warnings may be silenced, since `place' is used earlier and
-                 ;; should have triggered them already.
-                 (with-no-warnings ,place)
-               (setq ,place (cons x ,place))))
-       (list 'setq place (list* 'adjoin x place keys)))
-    (list* 'callf2 'adjoin x place keys)))
-
-(defun cl-set-elt (seq n val)
-  (if (listp seq) (setcar (nthcdr n seq) val) (aset seq n val)))
-
-(defsubst cl-set-nthcdr (n list x)
-  (if (<= n 0) x (setcdr (nthcdr (1- n) list) x) list))
-
-(defun cl-set-buffer-substring (start end val)
-  (save-excursion (delete-region start end)
-                 (goto-char start)
-                 (insert val)
-                 val))
-
-(defun cl-set-substring (str start end val)
-  (if end (if (< end 0) (incf end (length str)))
-    (setq end (length str)))
-  (if (< start 0) (incf start (length str)))
-  (concat (and (> start 0) (substring str 0 start))
-         val
-         (and (< end (length str)) (substring str end))))
-
-
-;;; Control structures.
-
-;; These macros are so simple and so often-used that it's better to have
-;; them all the time than to load them from cl-macs.el.
-
-(defun cl-map-extents (&rest cl-args)
-  (apply 'cl-map-overlays cl-args))
-
-
-;;; Blocks and exits.
-
-(defalias 'cl-block-wrapper 'identity)
-(defalias 'cl-block-throw 'throw)
-
-
-;;; Multiple values.
-;; True multiple values are not supported, or even
-;; simulated.  Instead, multiple-value-bind and friends simply expect
-;; the target form to return the values as a list.
-
-(defsubst values (&rest values)
-  "Return multiple values, Common Lisp style.
-The arguments of `values' are the values
-that the containing function should return."
-  values)
-
-(defsubst values-list (list)
-  "Return multiple values, Common Lisp style, taken from a list.
-LIST specifies the list of values
-that the containing function should return."
-  list)
-
-(defsubst multiple-value-list (expression)
-  "Return a list of the multiple values produced by EXPRESSION.
-This handles multiple values in Common Lisp style, but it does not
-work right when EXPRESSION calls an ordinary Emacs Lisp function
-that returns just one value."
-  expression)
-
-(defsubst multiple-value-apply (function expression)
-  "Evaluate EXPRESSION to get multiple values and apply FUNCTION to them.
-This handles multiple values in Common Lisp style, but it does not work
-right when EXPRESSION calls an ordinary Emacs Lisp function that returns just
-one value."
-  (apply function expression))
-
-(defalias 'multiple-value-call 'apply
-  "Apply FUNCTION to ARGUMENTS, taking multiple values into account.
-This implementation only handles the case where there is only one argument.")
-
-(defsubst nth-value (n expression)
-  "Evaluate EXPRESSION to get multiple values and return the Nth one.
-This handles multiple values in Common Lisp style, but it does not work
-right when EXPRESSION calls an ordinary Emacs Lisp function that returns just
-one value."
-  (nth n expression))
-
-;;; Macros.
-
-(defvar cl-macro-environment)
-(defvar cl-old-macroexpand (prog1 (symbol-function 'macroexpand)
-                            (defalias 'macroexpand 'cl-macroexpand)))
-
-(defun cl-macroexpand (cl-macro &optional cl-env)
-  "Return result of expanding macros at top level of FORM.
-If FORM is not a macro call, it is returned unchanged.
-Otherwise, the macro is expanded and the expansion is considered
-in place of FORM.  When a non-macro-call results, it is returned.
-
-The second optional arg ENVIRONMENT specifies an environment of macro
-definitions to shadow the loaded ones for use in file byte-compilation.
-\n(fn FORM &optional ENVIRONMENT)"
-  (let ((cl-macro-environment cl-env))
-    (while (progn (setq cl-macro (funcall cl-old-macroexpand cl-macro cl-env))
-                 (and (symbolp cl-macro)
-                      (cdr (assq (symbol-name cl-macro) cl-env))))
-      (setq cl-macro (cadr (assq (symbol-name cl-macro) cl-env))))
-    cl-macro))
-
-
-;;; Declarations.
-
-(defvar cl-compiling-file nil)
-(defun cl-compiling-file ()
-  (or cl-compiling-file
-      (and (boundp 'byte-compile--outbuffer)
-           (bufferp (symbol-value 'byte-compile--outbuffer))
-          (equal (buffer-name (symbol-value 'byte-compile--outbuffer))
-                 " *Compiler Output*"))))
-
-(defvar cl-proclaims-deferred nil)
-
-(defun proclaim (spec)
-  (if (fboundp 'cl-do-proclaim) (cl-do-proclaim spec t)
-    (push spec cl-proclaims-deferred))
-  nil)
-
-(defmacro declaim (&rest specs)
-  (let ((body (mapcar (function (lambda (x) (list 'proclaim (list 'quote x))))
-                     specs)))
-    (if (cl-compiling-file) (list* 'eval-when '(compile load eval) body)
-      (cons 'progn body))))   ; avoid loading cl-macs.el for eval-when
-
-
-;;; Symbols.
-
-(defun cl-random-time ()
-  (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0))
-    (while (>= (decf i) 0) (setq v (+ (* v 3) (aref time i))))
-    v))
-
-(defvar *gensym-counter* (* (logand (cl-random-time) 1023) 100))
-
-
-;;; Numbers.
-
-(defun floatp-safe (object)
-  "Return t if OBJECT is a floating point number.
-On Emacs versions that lack floating-point support, this function
-always returns nil."
-  (and (numberp object) (not (integerp object))))
-
-(defun plusp (number)
-  "Return t if NUMBER is positive."
-  (> number 0))
-
-(defun minusp (number)
-  "Return t if NUMBER is negative."
-  (< number 0))
-
-(defun oddp (integer)
-  "Return t if INTEGER is odd."
-  (eq (logand integer 1) 1))
-
-(defun evenp (integer)
-  "Return t if INTEGER is even."
-  (eq (logand integer 1) 0))
-
-(defvar *random-state* (vector 'cl-random-state-tag -1 30 (cl-random-time)))
-
-(defconst most-positive-float nil
-  "The largest value that a Lisp float can hold.
-If your system supports infinities, this is the largest finite value.
-For IEEE machines, this is approximately 1.79e+308.
-Call `cl-float-limits' to set this.")
-
-(defconst most-negative-float nil
-  "The largest negative value that a Lisp float can hold.
-This is simply -`most-positive-float'.
-Call `cl-float-limits' to set this.")
-
-(defconst least-positive-float nil
-  "The smallest value greater than zero that a Lisp float can hold.
-For IEEE machines, it is about 4.94e-324 if denormals are supported,
-or 2.22e-308 if they are not.
-Call `cl-float-limits' to set this.")
-
-(defconst least-negative-float nil
-  "The smallest value less than zero that a Lisp float can hold.
-This is simply -`least-positive-float'.
-Call `cl-float-limits' to set this.")
-
-(defconst least-positive-normalized-float nil
-  "The smallest normalized Lisp float greater than zero.
-This is the smallest value for which IEEE denormalization does not lose
-precision.  For IEEE machines, this value is about 2.22e-308.
-For machines that do not support the concept of denormalization
-and gradual underflow, this constant equals `least-positive-float'.
-Call `cl-float-limits' to set this.")
-
-(defconst least-negative-normalized-float nil
-  "The smallest normalized Lisp float less than zero.
-This is simply -`least-positive-normalized-float'.
-Call `cl-float-limits' to set this.")
-
-(defconst float-epsilon nil
-  "The smallest positive float that adds to 1.0 to give a distinct value.
-Adding a number less than this to 1.0 returns 1.0 due to roundoff.
-For IEEE machines, epsilon is about 2.22e-16.
-Call `cl-float-limits' to set this.")
-
-(defconst float-negative-epsilon nil
-  "The smallest positive float that subtracts from 1.0 to give a distinct value.
-For IEEE machines, it is about 1.11e-16.
-Call `cl-float-limits' to set this.")
-
-
-;;; Sequence functions.
-
-(defalias 'copy-seq 'copy-sequence)
-
-(declare-function cl-mapcar-many "cl-extra" (cl-func cl-seqs))
-
-(defun mapcar* (cl-func cl-x &rest cl-rest)
-  "Apply FUNCTION to each element of SEQ, and make a list of the results.
-If there are several SEQs, FUNCTION is called with that many arguments,
-and mapping stops as soon as the shortest list runs out.  With just one
-SEQ, this is like `mapcar'.  With several, it is like the Common Lisp
-`mapcar' function extended to arbitrary sequence types.
-\n(fn FUNCTION SEQ...)"
-  (if cl-rest
-      (if (or (cdr cl-rest) (nlistp cl-x) (nlistp (car cl-rest)))
-         (cl-mapcar-many cl-func (cons cl-x cl-rest))
-       (let ((cl-res nil) (cl-y (car cl-rest)))
-         (while (and cl-x cl-y)
-           (push (funcall cl-func (pop cl-x) (pop cl-y)) cl-res))
-         (nreverse cl-res)))
-    (mapcar cl-func cl-x)))
-
-(defalias 'svref 'aref)
-
-;;; List functions.
-
-(defalias 'first 'car)
-(defalias 'second 'cadr)
-(defalias 'rest 'cdr)
-(defalias 'endp 'null)
-
-(defun third (x)
-  "Return the third element of the list X."
-  (car (cdr (cdr x))))
-
-(defun fourth (x)
-  "Return the fourth element of the list X."
-  (nth 3 x))
-
-(defun fifth (x)
-  "Return the fifth element of the list X."
-  (nth 4 x))
-
-(defun sixth (x)
-  "Return the sixth element of the list X."
-  (nth 5 x))
-
-(defun seventh (x)
-  "Return the seventh element of the list X."
-  (nth 6 x))
-
-(defun eighth (x)
-  "Return the eighth element of the list X."
-  (nth 7 x))
-
-(defun ninth (x)
-  "Return the ninth element of the list X."
-  (nth 8 x))
-
-(defun tenth (x)
-  "Return the tenth element of the list X."
-  (nth 9 x))
-
-(defun caaar (x)
-  "Return the `car' of the `car' of the `car' of X."
-  (car (car (car x))))
-
-(defun caadr (x)
-  "Return the `car' of the `car' of the `cdr' of X."
-  (car (car (cdr x))))
-
-(defun cadar (x)
-  "Return the `car' of the `cdr' of the `car' of X."
-  (car (cdr (car x))))
-
-(defun caddr (x)
-  "Return the `car' of the `cdr' of the `cdr' of X."
-  (car (cdr (cdr x))))
-
-(defun cdaar (x)
-  "Return the `cdr' of the `car' of the `car' of X."
-  (cdr (car (car x))))
-
-(defun cdadr (x)
-  "Return the `cdr' of the `car' of the `cdr' of X."
-  (cdr (car (cdr x))))
-
-(defun cddar (x)
-  "Return the `cdr' of the `cdr' of the `car' of X."
-  (cdr (cdr (car x))))
-
-(defun cdddr (x)
-  "Return the `cdr' of the `cdr' of the `cdr' of X."
-  (cdr (cdr (cdr x))))
-
-(defun caaaar (x)
-  "Return the `car' of the `car' of the `car' of the `car' of X."
-  (car (car (car (car x)))))
-
-(defun caaadr (x)
-  "Return the `car' of the `car' of the `car' of the `cdr' of X."
-  (car (car (car (cdr x)))))
-
-(defun caadar (x)
-  "Return the `car' of the `car' of the `cdr' of the `car' of X."
-  (car (car (cdr (car x)))))
-
-(defun caaddr (x)
-  "Return the `car' of the `car' of the `cdr' of the `cdr' of X."
-  (car (car (cdr (cdr x)))))
-
-(defun cadaar (x)
-  "Return the `car' of the `cdr' of the `car' of the `car' of X."
-  (car (cdr (car (car x)))))
-
-(defun cadadr (x)
-  "Return the `car' of the `cdr' of the `car' of the `cdr' of X."
-  (car (cdr (car (cdr x)))))
-
-(defun caddar (x)
-  "Return the `car' of the `cdr' of the `cdr' of the `car' of X."
-  (car (cdr (cdr (car x)))))
-
-(defun cadddr (x)
-  "Return the `car' of the `cdr' of the `cdr' of the `cdr' of X."
-  (car (cdr (cdr (cdr x)))))
-
-(defun cdaaar (x)
-  "Return the `cdr' of the `car' of the `car' of the `car' of X."
-  (cdr (car (car (car x)))))
-
-(defun cdaadr (x)
-  "Return the `cdr' of the `car' of the `car' of the `cdr' of X."
-  (cdr (car (car (cdr x)))))
-
-(defun cdadar (x)
-  "Return the `cdr' of the `car' of the `cdr' of the `car' of X."
-  (cdr (car (cdr (car x)))))
-
-(defun cdaddr (x)
-  "Return the `cdr' of the `car' of the `cdr' of the `cdr' of X."
-  (cdr (car (cdr (cdr x)))))
-
-(defun cddaar (x)
-  "Return the `cdr' of the `cdr' of the `car' of the `car' of X."
-  (cdr (cdr (car (car x)))))
-
-(defun cddadr (x)
-  "Return the `cdr' of the `cdr' of the `car' of the `cdr' of X."
-  (cdr (cdr (car (cdr x)))))
-
-(defun cdddar (x)
-  "Return the `cdr' of the `cdr' of the `cdr' of the `car' of X."
-  (cdr (cdr (cdr (car x)))))
-
-(defun cddddr (x)
-  "Return the `cdr' of the `cdr' of the `cdr' of the `cdr' of X."
-  (cdr (cdr (cdr (cdr x)))))
-
-;;(defun last* (x &optional n)
-;;  "Returns the last link in the list LIST.
-;;With optional argument N, returns Nth-to-last link (default 1)."
-;;  (if n
-;;      (let ((m 0) (p x))
-;;     (while (consp p) (incf m) (pop p))
-;;     (if (<= n 0) p
-;;       (if (< n m) (nthcdr (- m n) x) x)))
-;;    (while (consp (cdr x)) (pop x))
-;;    x))
-
-(defun list* (arg &rest rest)   ; See compiler macro in cl-macs.el
-  "Return a new list with specified ARGs as elements, consed to last ARG.
-Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
-`(cons A (cons B (cons C D)))'.
-\n(fn ARG...)"
-  (cond ((not rest) arg)
-       ((not (cdr rest)) (cons arg (car rest)))
-       (t (let* ((n (length rest))
-                 (copy (copy-sequence rest))
-                 (last (nthcdr (- n 2) copy)))
-            (setcdr last (car (cdr last)))
-            (cons arg copy)))))
-
-(defun ldiff (list sublist)
-  "Return a copy of LIST with the tail SUBLIST removed."
-  (let ((res nil))
-    (while (and (consp list) (not (eq list sublist)))
-      (push (pop list) res))
-    (nreverse res)))
-
-(defun copy-list (list)
-  "Return a copy of LIST, which may be a dotted list.
-The elements of LIST are not copied, just the list structure itself."
-  (if (consp list)
-      (let ((res nil))
-       (while (consp list) (push (pop list) res))
-       (prog1 (nreverse res) (setcdr res list)))
-    (car list)))
+(require 'cl-lib)
+(require 'macroexp)
+
+;; (defun cl--rename ()
+;;   (let ((vdefs ())
+;;         (fdefs ())
+;;         (case-fold-search nil)
+;;         (files '("cl.el" "cl-macs.el" "cl-seq.el" "cl-extra.el")))
+;;     (dolist (file files)
+;;       (with-current-buffer (find-file-noselect file)
+;;         (goto-char (point-min))
+;;         (while (re-search-forward
+;;                 "^(\\(def[^ \t\n]*\\) +'?\\(\\(\\sw\\|\\s_\\)+\\)" nil t)
+;;           (let ((name (match-string-no-properties 2))
+;;                 (type (match-string-no-properties 1)))
+;;             (unless (string-match-p "\\`cl-" name)
+;;               (cond
+;;                ((member type '("defvar" "defconst"))
+;;                 (unless (member name vdefs) (push name vdefs)))
+;;                ((member type '("defun" "defsubst" "defalias" "defmacro"))
+;;                 (unless (member name fdefs) (push name fdefs)))
+;;                ((member type '("def-edebug-spec" "defsetf" "define-setf-method"
+;;                                "define-compiler-macro"))
+;;                 nil)
+;;                (t (error "Unknown type %S" type))))))))
+;;     (let ((re (concat "\\_<" (regexp-opt (append vdefs fdefs)) "\\_>"))
+;;           (conflicts ()))
+;;       (dolist (file files)
+;;         (with-current-buffer (find-file-noselect file)
+;;           (goto-char (point-min))
+;;           (while (re-search-forward re nil t)
+;;             (replace-match "cl-\\&"))
+;;           (save-buffer))))
+;;     (with-current-buffer (find-file-noselect "cl-rename.el")
+;;       (dolist (def vdefs)
+;;         (insert (format "(defvaralias '%s 'cl-%s)\n" def def)))
+;;       (dolist (def fdefs)
+;;         (insert (format "(defalias '%s 'cl-%s)\n" def def)))
+;;       (save-buffer))))
+
+;; (defun cl--unrename ()
+;;   ;; Taken from "Naming Conventions" node of the doc.
+;;   (let* ((names '(defun* defsubst* defmacro* function* member*
+;;                          assoc* rassoc* get* remove* delete*
+;;                          mapcar* sort* floor* ceiling* truncate*
+;;                          round* mod* rem* random*))
+;;          (files '("cl.el" "cl-lib.el" "cl-macs.el" "cl-seq.el" "cl-extra.el"))
+;;          (re (concat "\\_<cl-" (regexp-opt (mapcar #'symbol-name names))
+;;                      "\\_>")))
+;;     (dolist (file files)
+;;       (with-current-buffer (find-file-noselect file)
+;;         (goto-char (point-min))
+;;         (while (re-search-forward re nil t)
+;;           (delete-region (1- (point)) (point)))
+;;         (save-buffer)))))
+
+;;; Aliases to cl-lib's features.
+
+(dolist (var '(
+               ;; loop-result-var
+               ;; loop-result
+               ;; loop-initially
+               ;; loop-finally
+               ;; loop-bindings
+               ;; loop-args
+               ;; bind-inits
+               ;; bind-block
+               ;; lambda-list-keywords
+               float-negative-epsilon
+               float-epsilon
+               least-negative-normalized-float
+               least-positive-normalized-float
+               least-negative-float
+               least-positive-float
+               most-negative-float
+               most-positive-float
+               ;; custom-print-functions
+               ))
+  (defvaralias var (intern (format "cl-%s" var))))
+
+;; Before overwriting subr.el's `dotimes' and `dolist', let's remember
+;; them under a different name, so we can use them in our implementation
+;; of `dotimes' and `dolist'.
+(unless (fboundp 'cl--dotimes)
+  (defalias 'cl--dotimes (symbol-function 'dotimes) "The non-CL `dotimes'."))
+(unless (fboundp 'cl--dolist)
+  (defalias 'cl--dolist (symbol-function 'dolist) "The non-CL `dolist'."))
+
+(dolist (fun '(
+               (get* . cl-get)
+               (random* . cl-random)
+               (rem* . cl-rem)
+               (mod* . cl-mod)
+               (round* . cl-round)
+               (truncate* . cl-truncate)
+               (ceiling* . cl-ceiling)
+               (floor* . cl-floor)
+               (rassoc* . cl-rassoc)
+               (assoc* . cl-assoc)
+               (member* . cl-member)
+               (delete* . cl-delete)
+               (remove* . cl-remove)
+               (defsubst* . cl-defsubst)
+               (sort* . cl-sort)
+               (function* . cl-function)
+               (defmacro* . cl-defmacro)
+               (defun* . cl-defun)
+               (mapcar* . cl-mapcar)
+
+               remprop
+               getf
+               tailp
+               list-length
+               nreconc
+               revappend
+               concatenate
+               subseq
+               random-state-p
+               make-random-state
+               signum
+               isqrt
+               lcm
+               gcd
+               notevery
+               notany
+               every
+               some
+               mapcon
+               mapcan
+               mapl
+               maplist
+               map
+               equalp
+               coerce
+               tree-equal
+               nsublis
+               sublis
+               nsubst-if-not
+               nsubst-if
+               nsubst
+               subst-if-not
+               subst-if
+               subsetp
+               nset-exclusive-or
+               set-exclusive-or
+               nset-difference
+               set-difference
+               nintersection
+               intersection
+               nunion
+               union
+               rassoc-if-not
+               rassoc-if
+               assoc-if-not
+               assoc-if
+               member-if-not
+               member-if
+               merge
+               stable-sort
+               search
+               mismatch
+               count-if-not
+               count-if
+               count
+               position-if-not
+               position-if
+               position
+               find-if-not
+               find-if
+               find
+               nsubstitute-if-not
+               nsubstitute-if
+               nsubstitute
+               substitute-if-not
+               substitute-if
+               substitute
+               delete-duplicates
+               remove-duplicates
+               delete-if-not
+               delete-if
+               remove-if-not
+               remove-if
+               replace
+               fill
+               reduce
+               compiler-macroexpand
+               define-compiler-macro
+               assert
+               check-type
+               typep
+               deftype
+               defstruct
+               callf2
+               callf
+               letf*
+               ;; letf
+               rotatef
+               shiftf
+               remf
+               psetf
+               (define-setf-method . define-setf-expander)
+               declare
+               the
+               locally
+               multiple-value-setq
+               multiple-value-bind
+               symbol-macrolet
+               macrolet
+               progv
+               psetq
+               do-all-symbols
+               do-symbols
+               dotimes
+               dolist
+               do*
+               do
+               loop
+               return-from
+               return
+               block
+               etypecase
+               typecase
+               ecase
+               case
+               load-time-value
+               eval-when
+               destructuring-bind
+               gentemp
+               gensym
+               pairlis
+               acons
+               subst
+               adjoin
+               copy-list
+               ldiff
+               list*
+               cddddr
+               cdddar
+               cddadr
+               cddaar
+               cdaddr
+               cdadar
+               cdaadr
+               cdaaar
+               cadddr
+               caddar
+               cadadr
+               cadaar
+               caaddr
+               caadar
+               caaadr
+               caaaar
+               cdddr
+               cddar
+               cdadr
+               cdaar
+               caddr
+               cadar
+               caadr
+               caaar
+               tenth
+               ninth
+               eighth
+               seventh
+               sixth
+               fifth
+               fourth
+               third
+               endp
+               rest
+               second
+               first
+               svref
+               copy-seq
+               evenp
+               oddp
+               minusp
+               plusp
+               floatp-safe
+               declaim
+               proclaim
+               nth-value
+               multiple-value-call
+               multiple-value-apply
+               multiple-value-list
+               values-list
+               values
+               pushnew
+               decf
+               incf
+               ))
+  (let ((new (if (consp fun) (prog1 (cdr fun) (setq fun (car fun)))
+               (intern (format "cl-%s" fun)))))
+    (defalias fun new)
+    ;; If `cl-foo' is declare inline, then make `foo' inline as well, and
+    ;; similarly.  Same for edebug specifications, indent rules and
+    ;; doc-string position.
+    ;; FIXME: For most of them, we should instead follow aliases
+    ;; where applicable.
+    (dolist (prop '(byte-optimizer doc-string-elt edebug-form-spec
+                    lisp-indent-function))
+      (if (get new prop)
+        (put fun prop (get new prop))))))
+
+;;; Features provided a bit differently in Elisp.
+
+;; First, the old lexical-let is now better served by `lexical-binding', tho
+;; it's not 100% compatible.
+
+(defvar cl-closure-vars nil)
+(defvar cl--function-convert-cache nil)
+
+(defun cl--function-convert (f)
+  "Special macro-expander for special cases of (function F).
+The two cases that are handled are:
+- closure-conversion of lambda expressions for `lexical-let'.
+- renaming of F when it's a function defined via `cl-labels' or `labels'."
+  (require 'cl-macs)
+  (declare-function cl--expr-contains-any "cl-macs" (x y))
+  (cond
+   ;; ¡¡Big Ugly Hack!! We can't use a compiler-macro because those are checked
+   ;; *after* handling `function', but we want to stop macroexpansion from
+   ;; being applied infinitely, so we use a cache to return the exact `form'
+   ;; being expanded even though we don't receive it.
+   ((eq f (car cl--function-convert-cache)) (cdr cl--function-convert-cache))
+   ((eq (car-safe f) 'lambda)
+    (let ((body (mapcar (lambda (f)
+                          (macroexpand-all f macroexpand-all-environment))
+                        (cddr f))))
+      (if (and cl-closure-vars
+               (cl--expr-contains-any body cl-closure-vars))
+          (let* ((new (mapcar 'cl-gensym cl-closure-vars))
+                 (sub (cl-pairlis cl-closure-vars new)) (decls nil))
+            (while (or (stringp (car body))
+                       (eq (car-safe (car body)) 'interactive))
+              (push (list 'quote (pop body)) decls))
+            (put (car (last cl-closure-vars)) 'used t)
+            `(list 'lambda '(&rest --cl-rest--)
+                   ,@(cl-sublis sub (nreverse decls))
+                   (list 'apply
+                         (list 'quote
+                               #'(lambda ,(append new (cadr f))
+                                   ,@(cl-sublis sub body)))
+                         ,@(nconc (mapcar (lambda (x) `(list 'quote ,x))
+                                          cl-closure-vars)
+                                  '((quote --cl-rest--))))))
+        (let* ((newf `(lambda ,(cadr f) ,@body))
+               (res `(function ,newf)))
+          (setq cl--function-convert-cache (cons newf res))
+          res))))
+   (t
+    (let ((found (assq f macroexpand-all-environment)))
+      (if (and found (ignore-errors
+                       (eq (cadr (cl-caddr found)) 'cl-labels-args)))
+          (cadr (cl-caddr (cl-cadddr found)))
+        (let ((res `(function ,f)))
+          (setq cl--function-convert-cache (cons f res))
+          res))))))
+
+(defmacro lexical-let (bindings &rest body)
+  "Like `let', but lexically scoped.
+The main visible difference is that lambdas inside BODY will create
+lexical closures as in Common Lisp.
+\n(fn BINDINGS BODY)"
+  (declare (indent 1) (debug let))
+  (let* ((cl-closure-vars cl-closure-vars)
+        (vars (mapcar (function
+                       (lambda (x)
+                         (or (consp x) (setq x (list x)))
+                         (push (make-symbol (format "--cl-%s--" (car x)))
+                               cl-closure-vars)
+                         (set (car cl-closure-vars) [bad-lexical-ref])
+                         (list (car x) (cadr x) (car cl-closure-vars))))
+                      bindings))
+        (ebody
+         (macroexpand-all
+           `(cl-symbol-macrolet
+                ,(mapcar (lambda (x)
+                           `(,(car x) (symbol-value ,(cl-caddr x))))
+                         vars)
+              ,@body)
+          (cons (cons 'function #'cl--function-convert)
+                 macroexpand-all-environment))))
+    (if (not (get (car (last cl-closure-vars)) 'used))
+        ;; Turn (let ((foo (cl-gensym)))
+        ;;        (set foo <val>) ...(symbol-value foo)...)
+        ;; into (let ((foo <val>)) ...(symbol-value 'foo)...).
+        ;; This is good because it's more efficient but it only works with
+        ;; dynamic scoping, since with lexical scoping we'd need
+        ;; (let ((foo <val>)) ...foo...).
+       `(progn
+           ,@(mapcar (lambda (x) `(defvar ,(cl-caddr x))) vars)
+           (let ,(mapcar (lambda (x) (list (cl-caddr x) (cadr x))) vars)
+           ,(cl-sublis (mapcar (lambda (x)
+                              (cons (cl-caddr x)
+                                    `',(cl-caddr x)))
+                            vars)
+                    ebody)))
+      `(let ,(mapcar (lambda (x)
+                       (list (cl-caddr x)
+                             `(make-symbol ,(format "--%s--" (car x)))))
+                     vars)
+         (setf ,@(apply #'append
+                        (mapcar (lambda (x)
+                                  (list `(symbol-value ,(cl-caddr x)) (cadr x)))
+                                vars)))
+         ,ebody))))
+
+(defmacro lexical-let* (bindings &rest body)
+  "Like `let*', but lexically scoped.
+The main visible difference is that lambdas inside BODY, and in
+successive bindings within BINDINGS, will create lexical closures
+as in Common Lisp.  This is similar to the behavior of `let*' in
+Common Lisp.
+\n(fn BINDINGS BODY)"
+  (declare (indent 1) (debug let))
+  (if (null bindings) (cons 'progn body)
+    (setq bindings (reverse bindings))
+    (while bindings
+      (setq body (list `(lexical-let (,(pop bindings)) ,@body))))
+    (car body)))
+
+;; This should really have some way to shadow 'byte-compile properties, etc.
+(defmacro flet (bindings &rest body)
+  "Make temporary overriding function definitions.
+This is an analogue of a dynamically scoped `let' that operates on the function
+cell of FUNCs rather than their value cell.
+If you want the Common-Lisp style of `flet', you should use `cl-flet'.
+The FORMs are evaluated with the specified function definitions in place,
+then the definitions are undone (the FUNCs go back to their previous
+definitions, or lack thereof).
+
+\(fn ((FUNC ARGLIST BODY...) ...) FORM...)"
+  (declare (indent 1) (debug cl-flet)
+           (obsolete "Use either `cl-flet' or `cl-letf'."  "24.2"))
+  `(letf ,(mapcar
+           (lambda (x)
+             (if (or (and (fboundp (car x))
+                          (eq (car-safe (symbol-function (car x))) 'macro))
+                     (cdr (assq (car x) macroexpand-all-environment)))
+                 (error "Use `labels', not `flet', to rebind macro names"))
+             (let ((func `(cl-function
+                           (lambda ,(cadr x)
+                             (cl-block ,(car x) ,@(cddr x))))))
+               (when (cl--compiling-file)
+                 ;; Bug#411.  It would be nice to fix this.
+                 (and (get (car x) 'byte-compile)
+                      (error "Byte-compiling a redefinition of `%s' \
+will not work - use `labels' instead" (symbol-name (car x))))
+                 ;; FIXME This affects the rest of the file, when it
+                 ;; should be restricted to the flet body.
+                 (and (boundp 'byte-compile-function-environment)
+                      (push (cons (car x) (eval func))
+                            byte-compile-function-environment)))
+               (list `(symbol-function ',(car x)) func)))
+           bindings)
+     ,@body))
+
+(defmacro labels (bindings &rest body)
+  "Make temporary function bindings.
+Like `cl-labels' except that the lexical scoping is handled via `lexical-let'
+rather than relying on `lexical-binding'."
+  (declare (indent 1) (debug cl-flet) (obsolete cl-labels "24.2"))
+  (let ((vars nil) (sets nil) (newenv macroexpand-all-environment))
+    (dolist (binding bindings)
+      ;; It's important that (not (eq (symbol-name var1) (symbol-name var2)))
+      ;; because these var's *names* get added to the macro-environment.
+      (let ((var (make-symbol (format "--cl-%s--" (car binding)))))
+       (push var vars)
+       (push `(cl-function (lambda . ,(cdr binding))) sets)
+       (push var sets)
+       (push (cons (car binding)
+                    `(lambda (&rest cl-labels-args)
+                       (cl-list* 'funcall ',var
+                                 cl-labels-args)))
+              newenv)))
+    (macroexpand-all `(lexical-let ,vars (setq ,@sets) ,@body) newenv)))
+
+;; Generalized variables are provided by gv.el, but some details are
+;; not 100% compatible: not worth the trouble to add them to cl-lib.el, but we
+;; still need to support old users of cl.el.
+
+(defmacro cl--symbol-function (symbol)
+  "Like `symbol-function' but return `cl--unbound' if not bound."
+  ;; (declare (gv-setter (lambda (store)
+  ;;                       `(if (eq ,store 'cl--unbound)
+  ;;                            (fmakunbound ,symbol) (fset ,symbol ,store)))))
+  `(if (fboundp ,symbol) (symbol-function ,symbol) 'cl--unbound))
+(gv-define-setter cl--symbol-function (store symbol)
+  `(if (eq ,store 'cl--unbound) (fmakunbound ,symbol) (fset ,symbol ,store)))
+
+(defmacro letf (bindings &rest body)
+  "Dynamically scoped let-style bindings for places.
+Like `cl-letf', but with some extra backward compatibility."
+  ;; Like cl-letf, but with special handling of symbol-function.
+  `(cl-letf ,(mapcar (lambda (x) (if (eq (car-safe (car x)) 'symbol-function)
+                                `((cl--symbol-function ,@(cdar x)) ,@(cdr x))
+                              x))
+                     bindings)
+            ,@body))
+
+(defun cl--gv-adapt (cl-gv do)
+  ;; This function is used by all .elc files that use define-setf-expander and
+  ;; were compiled with Emacs>=24.2.
+  (let ((vars (nth 0 cl-gv))
+        (vals (nth 1 cl-gv))
+        (binds ())
+        (substs ()))
+    ;; Use cl-sublis as was done in cl-setf-do-modify.
+    (while vars
+      (if (macroexp-copyable-p (car vals))
+          (push (cons (pop vars) (pop vals)) substs)
+        (push (list (pop vars) (pop vals)) binds)))
+    (macroexp-let*
+     binds
+     (funcall do (cl-sublis substs (nth 4 cl-gv))
+              ;; We'd like to do something like
+              ;; (lambda ,(nth 2 cl-gv) ,(nth 3 cl-gv)).
+              (lambda (exp)
+                (macroexp-let2 macroexp-copyable-p v exp
+                  (cl-sublis (cons (cons (car (nth 2 cl-gv)) v)
+                                   substs)
+                             (nth 3 cl-gv))))))))
+
+(defmacro define-setf-expander (name arglist &rest body)
+  "Define a `setf' method.
+This method shows how to handle `setf's to places of the form (NAME ARGS...).
+The argument forms ARGS are bound according to ARGLIST, as if NAME were
+going to be expanded as a macro, then the BODY forms are executed and must
+return a list of five elements: a temporary-variables list, a value-forms
+list, a store-variables list (of length one), a store-form, and an access-
+form.  See `gv-define-expander', `gv-define-setter', and `gv-define-expander'
+for a better and simpler ways to define setf-methods."
+  (declare (debug
+            (&define name cl-lambda-list cl-declarations-or-string def-body)))
+  `(progn
+     ,@(if (stringp (car body))
+           (list `(put ',name 'setf-documentation ,(pop body))))
+     (gv-define-expander ,name
+       (cl-function
+        (lambda (do ,@arglist)
+          (cl--gv-adapt (progn ,@body) do))))))
+
+(defmacro defsetf (name arg1 &rest args)
+  "Define a `setf' method.
+This macro is an easy-to-use substitute for `define-setf-expander' that works
+well for simple place forms.  In the simple `defsetf' form, `setf's of
+the form (setf (NAME ARGS...) VAL) are transformed to function or macro
+calls of the form (FUNC ARGS... VAL).  Example:
+
+  (cl-defsetf aref aset)
+
+Alternate form: (cl-defsetf NAME ARGLIST (STORE) BODY...).
+Here, the above `setf' call is expanded by binding the argument forms ARGS
+according to ARGLIST, binding the value form VAL to STORE, then executing
+BODY, which must return a Lisp form that does the necessary `setf' operation.
+Actually, ARGLIST and STORE may be bound to temporary variables which are
+introduced automatically to preserve proper execution order of the arguments.
+Example:
+
+  (cl-defsetf nth (n x) (v) `(setcar (nthcdr ,n ,x) ,v))
+
+\(fn NAME [FUNC | ARGLIST (STORE) BODY...])"
+  (declare (debug
+            (&define name
+                     [&or [symbolp &optional stringp]
+                          [cl-lambda-list (symbolp)]]
+                     cl-declarations-or-string def-body)))
+  (if (and (listp arg1) (consp args))
+      ;; Like `gv-define-setter' but with `cl-function'.
+      `(gv-define-expander ,name
+         (lambda (do &rest args)
+           (gv--defsetter ',name
+                          (cl-function
+                           (lambda (,@(car args) ,@arg1) ,@(cdr args)))
+                         do args)))
+    `(gv-define-simple-setter ,name ,arg1)))
+
+;; FIXME: CL used to provide a setf method for `apply', but I haven't been able
+;; to find a case where it worked.  The code below tries to handle it as well.
+;; (defun cl--setf-apply (form last-witness last)
+;;   (cond
+;;    ((not (consp form)) form)
+;;    ((eq (ignore-errors (car (last form))) last-witness)
+;;     `(apply #',(car form) ,@(butlast (cdr form)) ,last))
+;;    ((and (memq (car form) '(let let*))
+;;          (rassoc (list last-witness) (cadr form)))
+;;     (let ((rebind (rassoc (list last-witness) (cadr form))))
+;;     `(,(car form) ,(remq rebind (cadr form))
+;;       ,@(mapcar (lambda (form) (cl--setf-apply form (car rebind) last))
+;;                 (cddr form)))))
+;;    (t (mapcar (lambda (form) (cl--setf-apply form last-witness last)) form))))
+;; (gv-define-setter apply (val fun &rest args)
+;;   (pcase fun (`#',(and (pred symbolp) f) (setq fun f))
+;;          (_ (error "First arg to apply in setf is not #'SYM: %S" fun)))
+;;   (let* ((butlast (butlast args))
+;;          (last (car (last args)))
+;;          (last-witness (make-symbol "--cl-tailarg--"))
+;;          (setter (macroexpand `(setf (,fun ,@butlast ,last-witness) ,val)
+;;                               macroexpand-all-environment)))
+;;     (cl--setf-apply setter last-witness last)))
+
+
+;; FIXME: CL used to provide get-setf-method, which was used by some
+;; setf-expanders, but now that we use gv.el, it is a lot more difficult
+;; and in general impossible to provide get-setf-method.  Hopefully, it
+;; won't be needed.  If needed, we'll have to do something nasty along the
+;; lines of
+;; (defun get-setf-method (place &optional env)
+;;   (let* ((witness (list 'cl-gsm))
+;;          (expansion (gv-letplace (getter setter) place
+;;                      `(,witness ,getter ,(funcall setter witness)))))
+;;     ...find "let prefix" of expansion, extract getter and setter from
+;;     ...the rest, and build the 5-tuple))
+(make-obsolete 'get-setf-method 'gv-letplace "24.2")
+
+(defmacro define-modify-macro (name arglist func &optional doc)
+  "Define a `setf'-like modify macro.
+If NAME is called, it combines its PLACE argument with the other arguments
+from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)"
+  (declare (debug
+            (&define name cl-lambda-list ;; should exclude &key
+                     symbolp &optional stringp)))
+  (if (memq '&key arglist)
+      (error "&key not allowed in define-modify-macro"))
+  (let ((place (make-symbol "--cl-place--")))
+    `(cl-defmacro ,name (,place ,@arglist)
+       ,doc
+       (,(if (memq '&rest arglist) #'cl-list* #'list)
+        #'cl-callf ',func ,place
+        ,@(cl--arglist-args arglist)))))
+
+;;; Additional compatibility code.
+;; For names that were clean but really aren't needed any more.
+
+(define-obsolete-function-alias 'cl-macroexpand 'macroexpand "24.2")
+(define-obsolete-variable-alias 'cl-macro-environment
+  'macroexpand-all-environment "24.2")
+(define-obsolete-function-alias 'cl-macroexpand-all 'macroexpand-all "24.2")
+
+;;; Hash tables.
+;; This is just kept for compatibility with code byte-compiled by Emacs-20.
+
+;; No idea if this might still be needed.
+(defun cl-not-hash-table (x &optional y &rest _z)
+  (declare (obsolete nil "24.2"))
+  (signal 'wrong-type-argument (list 'cl-hash-table-p (or y x))))
+
+(defvar cl-builtin-gethash (symbol-function 'gethash))
+(make-obsolete-variable 'cl-builtin-gethash nil "24.2")
+(defvar cl-builtin-remhash (symbol-function 'remhash))
+(make-obsolete-variable 'cl-builtin-remhash nil "24.2")
+(defvar cl-builtin-clrhash (symbol-function 'clrhash))
+(make-obsolete-variable 'cl-builtin-clrhash nil "24.2")
+(defvar cl-builtin-maphash (symbol-function 'maphash))
+
+(make-obsolete-variable 'cl-builtin-maphash nil "24.2")
+(define-obsolete-function-alias 'cl-map-keymap 'map-keymap "24.2")
+(define-obsolete-function-alias 'cl-copy-tree 'copy-tree "24.2")
+(define-obsolete-function-alias 'cl-gethash 'gethash "24.2")
+(define-obsolete-function-alias 'cl-puthash 'puthash "24.2")
+(define-obsolete-function-alias 'cl-remhash 'remhash "24.2")
+(define-obsolete-function-alias 'cl-clrhash 'clrhash "24.2")
+(define-obsolete-function-alias 'cl-maphash 'maphash "24.2")
+(define-obsolete-function-alias 'cl-make-hash-table 'make-hash-table "24.2")
+(define-obsolete-function-alias 'cl-hash-table-p 'hash-table-p "24.2")
+(define-obsolete-function-alias 'cl-hash-table-count 'hash-table-count "24.2")
 
 (defun cl-maclisp-member (item list)
+  (declare (obsolete member "24.2"))
   (while (and list (not (equal item (car list)))) (setq list (cdr list)))
   list)
 
-(defalias 'cl-member 'memq)   ; for compatibility with old CL package
-
-;; Autoloaded, but we have not loaded cl-loaddefs yet.
-(declare-function floor* "cl-extra" (x &optional y))
-(declare-function ceiling* "cl-extra" (x &optional y))
-(declare-function truncate* "cl-extra" (x &optional y))
-(declare-function round* "cl-extra" (x &optional y))
-(declare-function mod* "cl-extra" (x y))
-
-(defalias 'cl-floor 'floor*)
-(defalias 'cl-ceiling 'ceiling*)
-(defalias 'cl-truncate 'truncate*)
-(defalias 'cl-round 'round*)
-(defalias 'cl-mod 'mod*)
-
-(defun adjoin (cl-item cl-list &rest cl-keys)  ; See compiler macro in cl-macs
-  "Return ITEM consed onto the front of LIST only if it's not already there.
-Otherwise, return LIST unmodified.
-\nKeywords supported:  :test :test-not :key
-\n(fn ITEM LIST [KEYWORD VALUE]...)"
-  (cond ((or (equal cl-keys '(:test eq))
-            (and (null cl-keys) (not (numberp cl-item))))
-        (if (memq cl-item cl-list) cl-list (cons cl-item cl-list)))
-       ((or (equal cl-keys '(:test equal)) (null cl-keys))
-        (if (member cl-item cl-list) cl-list (cons cl-item cl-list)))
-       (t (apply 'cl-adjoin cl-item cl-list cl-keys))))
-
-(defun subst (cl-new cl-old cl-tree &rest cl-keys)
-  "Substitute NEW for OLD everywhere in TREE (non-destructively).
-Return a copy of TREE with all elements `eql' to OLD replaced by NEW.
-\nKeywords supported:  :test :test-not :key
-\n(fn NEW OLD TREE [KEYWORD VALUE]...)"
-  (if (or cl-keys (and (numberp cl-old) (not (integerp cl-old))))
-      (apply 'sublis (list (cons cl-old cl-new)) cl-tree cl-keys)
-    (cl-do-subst cl-new cl-old cl-tree)))
-
-(defun cl-do-subst (cl-new cl-old cl-tree)
-  (cond ((eq cl-tree cl-old) cl-new)
-       ((consp cl-tree)
-        (let ((a (cl-do-subst cl-new cl-old (car cl-tree)))
-              (d (cl-do-subst cl-new cl-old (cdr cl-tree))))
-          (if (and (eq a (car cl-tree)) (eq d (cdr cl-tree)))
-              cl-tree (cons a d))))
-       (t cl-tree)))
-
-(defun acons (key value alist)
-  "Add KEY and VALUE to ALIST.
-Return a new list with (cons KEY VALUE) as car and ALIST as cdr."
-  (cons (cons key value) alist))
-
-(defun pairlis (keys values &optional alist)
-  "Make an alist from KEYS and VALUES.
-Return a new alist composed by associating KEYS to corresponding VALUES;
-the process stops as soon as KEYS or VALUES run out.
-If ALIST is non-nil, the new pairs are prepended to it."
-  (nconc (mapcar* 'cons keys values) alist))
-
-
-;;; Miscellaneous.
-
-;; Define data for indentation and edebug.
-(dolist (entry
-         '(((defun* defmacro*) 2)
-           ((function*) nil
-            (&or symbolp ([&optional 'macro] 'lambda (&rest sexp) &rest form)))
-           ((eval-when) 1 (sexp &rest form))
-           ((declare) nil (&rest sexp))
-           ((the) 1 (sexp &rest form))
-           ((case ecase typecase etypecase) 1 (form &rest (sexp &rest form)))
-           ((block return-from) 1 (sexp &rest form))
-           ((return) nil (&optional form))
-           ((do do*) 2 ((&rest &or symbolp (symbolp &optional form form))
-                        (form &rest form)
-                        &rest form))
-           ((do-symbols) 1 ((symbolp form &optional form form) &rest form))
-           ((do-all-symbols) 1 ((symbolp form &optional form) &rest form))
-           ((psetq setf psetf) nil edebug-setq-form)
-           ((progv) 2 (&rest form))
-           ((flet labels macrolet) 1
-            ((&rest (sexp sexp &rest form)) &rest form))
-           ((symbol-macrolet lexical-let lexical-let*) 1
-            ((&rest &or symbolp (symbolp form)) &rest form))
-           ((multiple-value-bind) 2 ((&rest symbolp) &rest form))
-           ((multiple-value-setq) 1 ((&rest symbolp) &rest form))
-           ((incf decf remf pushnew shiftf rotatef) nil (&rest form))
-           ((letf letf*) 1 ((&rest (&rest form)) &rest form))
-           ((callf destructuring-bind) 2 (sexp form &rest form))
-           ((callf2) 3 (sexp form form &rest form))
-           ((loop) nil (&rest &or symbolp form))
-           ((ignore-errors) 0 (&rest form))))
-  (dolist (func (car entry))
-    (put func 'lisp-indent-function (nth 1 entry))
-    (put func 'lisp-indent-hook (nth 1 entry))
-    (or (get func 'edebug-form-spec)
-        (put func 'edebug-form-spec (nth 2 entry)))))
-
-;; Autoload the other portions of the package.
-;; We want to replace the basic versions of dolist, dotimes, declare below.
-(fmakunbound 'dolist)
-(fmakunbound 'dotimes)
-(fmakunbound 'declare)
-(load "cl-loaddefs" nil 'quiet)
-
-;; This goes here so that cl-macs can find it if it loads right now.
-(provide 'cl)
-
-;; Things to do after byte-compiler is loaded.
-
-(defvar cl-hacked-flag nil)
-(defun cl-hack-byte-compiler ()
-  (and (not cl-hacked-flag) (fboundp 'byte-compile-file-form)
-       (progn
-         (setq cl-hacked-flag t)  ; Do it first, to prevent recursion.
-         (load "cl-macs" nil t)
-         (run-hooks 'cl-hack-bytecomp-hook))))
-
-;; Try it now in case the compiler has already been loaded.
-(cl-hack-byte-compiler)
-
-;; Also make a hook in case compiler is loaded after this file.
-(add-hook 'bytecomp-load-hook 'cl-hack-byte-compiler)
-
-
-;; The following ensures that packages which expect the old-style cl.el
-;; will be happy with this one.
+;; Used in the expansion of the old `defstruct'.
+(defun cl-struct-setf-expander (x name accessor pred-form pos)
+  (declare (obsolete nil "24.2"))
+  (let* ((temp (make-symbol "--cl-x--")) (store (make-symbol "--cl-store--")))
+    (list (list temp) (list x) (list store)
+         `(progn
+             ,@(and pred-form
+                    (list `(or ,(cl-subst temp 'cl-x pred-form)
+                               (error ,(format
+                                        "%s storing a non-%s"
+                                        accessor name)))))
+             ,(if (eq (car (get name 'cl-struct-type)) 'vector)
+                  `(aset ,temp ,pos ,store)
+                `(setcar
+                  ,(if (<= pos 5)
+                       (let ((xx temp))
+                         (while (>= (setq pos (1- pos)) 0)
+                           (setq xx `(cdr ,xx)))
+                         xx)
+                     `(nthcdr ,pos ,temp))
+                  ,store)))
+         (list accessor temp))))
 
 (provide 'cl)
-
-(run-hooks 'cl-load-hook)
-
-;; Local variables:
-;; byte-compile-dynamic: t
-;; byte-compile-warnings: (not cl-functions)
-;; End:
-
 ;;; cl.el ends here
index 09b456b54babb436ef99e02f0ced9e145afb30f1..8e96d95c5dd0bfe00793b3e7fba1bc0103137812 100644 (file)
@@ -110,7 +110,7 @@ When this is `function', only ask when called non-interactively."
 
 ;; This is a defvar rather than a defconst, because the year can
 ;; change during the Emacs session.
-(defvar copyright-current-year (substring (current-time-string) -4)
+(defvar copyright-current-year (format-time-string "%Y")
   "String representing the current year.")
 
 (defsubst copyright-limit ()            ; re-search-forward BOUND
@@ -181,8 +181,7 @@ skips to the end of all the years."
   ;; This uses the match-data from copyright-find-copyright/end.
   (goto-char (match-end 1))
   (copyright-find-end)
-  ;; Note that `current-time-string' isn't locale-sensitive.
-  (setq copyright-current-year (substring (current-time-string) -4))
+  (setq copyright-current-year (format-time-string "%Y"))
   (unless (string= (buffer-substring (- (match-end 3) 2) (match-end 3))
                   (substring copyright-current-year -2))
     (if (or noquery
@@ -347,7 +346,7 @@ independently replaces consecutive years with a range."
   "Insert a copyright by $ORGANIZATION notice at cursor."
   "Company: "
   comment-start
-  "Copyright (C) " `(substring (current-time-string) -4) " by "
+  "Copyright (C) " `(format-time-string "%Y") " by "
   (or (getenv "ORGANIZATION")
       str)
   '(if (copyright-offset-too-large-p)
index 119479b2c0a28c7e376a63f9c3bd22bc071bbc2d..ea72e9492f0e366b6449fff006c2e8860effe4b7 100644 (file)
@@ -90,8 +90,6 @@
 \f
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;;; PRIVATE: defsubst must be defined before they are first used
 
 (defsubst derived-mode-hook-name (mode)
@@ -183,11 +181,11 @@ See Info node `(elisp)Derived Modes' for more details."
 
     ;; Process the keyword args.
     (while (keywordp (car body))
-      (case (pop body)
-       (:group (setq group (pop body)))
-       (:abbrev-table (setq abbrev (pop body)) (setq declare-abbrev nil))
-       (:syntax-table (setq syntax (pop body)) (setq declare-syntax nil))
-       (t (pop body))))
+      (pcase (pop body)
+       (`:group (setq group (pop body)))
+       (`:abbrev-table (setq abbrev (pop body)) (setq declare-abbrev nil))
+       (`:syntax-table (setq syntax (pop body)) (setq declare-syntax nil))
+       (_ (pop body))))
 
     (setq docstring (derived-mode-make-docstring
                     parent child docstring syntax abbrev))
index 506a737d36d0c5b1fe551015a1bf770368eabb48..ba720b42868972da37ada9b9e3d32b5fe92fdd09 100644 (file)
@@ -35,6 +35,8 @@
 
 ;;; Code:
 
+(require 'macroexp)
+
 ;;; The variable byte-code-vector is defined by the new bytecomp.el.
 ;;; The function byte-decompile-lapcode is defined in byte-opt.el.
 ;;; Since we don't use byte-decompile-lapcode, let's try not loading byte-opt.
@@ -155,7 +157,7 @@ redefine OBJECT if it is a symbol."
          (t
           (insert "Uncompiled body:  ")
           (let ((print-escape-newlines t))
-            (prin1 (if (cdr obj) (cons 'progn obj) (car obj))
+            (prin1 (macroexp-progn obj)
                    (current-buffer))))))
   (if interactive-p
       (message "")))
index 0d6716a2e637effd6d6c960a8eae26b586d287d5..ee4e36a9eba31bfc25fea24281436d7584f7c6c7 100644 (file)
@@ -51,8 +51,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defun easy-mmode-pretty-mode-name (mode &optional lighter)
   "Turn the symbol MODE into a string intended for the user.
 If provided, LIGHTER will be used to help choose capitalization by,
@@ -67,7 +65,8 @@ replacing its case-insensitive matches with the literal string in LIGHTER."
                        ;; "foo-bar-minor" -> "Foo-Bar-Minor"
                        (capitalize (replace-regexp-in-string
                                     ;; "foo-bar-minor-mode" -> "foo-bar-minor"
-                                    "-mode\\'" "" (symbol-name mode))))
+                                    "toggle-\\|-mode\\'" ""
+                                     (symbol-name mode))))
                       " mode")))
     (if (not (stringp lighter)) name
       ;; Strip leading and trailing whitespace from LIGHTER.
@@ -99,7 +98,7 @@ the mode if the argument is `toggle'.  If DOC is nil this
 function adds a basic doc-string stating these facts.
 
 Optional INIT-VALUE is the initial value of the mode's variable.
-Optional LIGHTER is displayed in the modeline when the mode is on.
+Optional LIGHTER is displayed in the mode line when the mode is on.
 Optional KEYMAP is the default keymap bound to the mode keymap.
   If non-nil, it should be a variable name (whose value is a keymap),
   or an expression that returns either a keymap or a list of
@@ -142,7 +141,8 @@ For example, you could write
   (define-minor-mode foo-mode \"If enabled, foo on you!\"
     :lighter \" Foo\" :require 'foo :global t :group 'hassle :version \"27.5\"
     ...BODY CODE...)"
-  (declare (debug (&define name stringp
+  (declare (doc-string 2)
+           (debug (&define name stringp
                           [&optional [&not keywordp] sexp
                            &optional [&not keywordp] sexp
                            &optional [&not keywordp] sexp]
@@ -152,10 +152,10 @@ For example, you could write
   ;; Allow skipping the first three args.
   (cond
    ((keywordp init-value)
-    (setq body (list* init-value lighter keymap body)
+    (setq body `(,init-value ,lighter ,keymap ,@body)
          init-value nil lighter nil keymap nil))
    ((keywordp lighter)
-    (setq body (list* lighter keymap body) lighter nil keymap nil))
+    (setq body `(,lighter ,keymap ,@body) lighter nil keymap nil))
    ((keywordp keymap) (push keymap body) (setq keymap nil)))
 
   (let* ((last-message (make-symbol "last-message"))
@@ -181,18 +181,18 @@ For example, you could write
     ;; Check keys.
     (while (keywordp (setq keyw (car body)))
       (setq body (cdr body))
-      (case keyw
-       (:init-value (setq init-value (pop body)))
-       (:lighter (setq lighter (purecopy (pop body))))
-       (:global (setq globalp (pop body)))
-       (:extra-args (setq extra-args (pop body)))
-       (:set (setq set (list :set (pop body))))
-       (:initialize (setq initialize (list :initialize (pop body))))
-       (:group (setq group (nconc group (list :group (pop body)))))
-       (:type (setq type (list :type (pop body))))
-       (:require (setq require (pop body)))
-       (:keymap (setq keymap (pop body)))
-        (:variable (setq variable (pop body))
+      (pcase keyw
+       (`:init-value (setq init-value (pop body)))
+       (`:lighter (setq lighter (purecopy (pop body))))
+       (`:global (setq globalp (pop body)))
+       (`:extra-args (setq extra-args (pop body)))
+       (`:set (setq set (list :set (pop body))))
+       (`:initialize (setq initialize (list :initialize (pop body))))
+       (`:group (setq group (nconc group (list :group (pop body)))))
+       (`:type (setq type (list :type (pop body))))
+       (`:require (setq require (pop body)))
+       (`:keymap (setq keymap (pop body)))
+        (`:variable (setq variable (pop body))
          (if (not (and (setq tmp (cdr-safe variable))
                        (or (symbolp tmp)
                            (functionp tmp))))
@@ -200,8 +200,8 @@ For example, you could write
              (setq mode variable)
            (setq mode (car variable))
            (setq setter (cdr variable))))
-       (:after-hook (setq after-hook (pop body)))
-       (t (push keyw extra-keywords) (push (pop body) extra-keywords))))
+       (`:after-hook (setq after-hook (pop body)))
+       (_ (push keyw extra-keywords) (push (pop body) extra-keywords))))
 
     (setq keymap-sym (if (and keymap (symbolp keymap)) keymap
                       (intern (concat mode-name "-map"))))
@@ -228,6 +228,7 @@ For example, you could write
          (variable nil)
          ((not globalp)
           `(progn
+             :autoload-end
              (defvar ,mode ,init-value ,(format "Non-nil if %s is enabled.
 Use the command `%s' to change this variable." pretty-name mode))
              (make-variable-buffer-local ',mode)))
@@ -335,7 +336,7 @@ enabled, then disabling and reenabling MODE should make MODE work
 correctly with the current major mode.  This is important to
 prevent problems with derived modes, that is, major modes that
 call another major mode in their body."
-
+  (declare (doc-string 2))
   (let* ((global-mode-name (symbol-name global-mode))
         (pretty-name (easy-mmode-pretty-mode-name mode))
         (pretty-global-name (easy-mmode-pretty-mode-name global-mode))
@@ -353,10 +354,10 @@ call another major mode in their body."
     ;; Check keys.
     (while (keywordp (setq keyw (car keys)))
       (setq keys (cdr keys))
-      (case keyw
-       (:group (setq group (nconc group (list :group (pop keys)))))
-       (:global (setq keys (cdr keys)))
-       (t (push keyw extra-keywords) (push (pop keys) extra-keywords))))
+      (pcase keyw
+       (`:group (setq group (nconc group (list :group (pop keys)))))
+       (`:global (setq keys (cdr keys)))
+       (_ (push keyw extra-keywords) (push (pop keys) extra-keywords))))
 
     (unless group
       ;; We might as well provide a best-guess default group.
@@ -365,8 +366,10 @@ call another major mode in their body."
                                "-mode\\'" "" (symbol-name mode))))))
 
     `(progn
-       (defvar ,MODE-major-mode nil)
-       (make-variable-buffer-local ',MODE-major-mode)
+       (progn
+         :autoload-end
+         (defvar ,MODE-major-mode nil)
+         (make-variable-buffer-local ',MODE-major-mode))
        ;; The actual global minor-mode
        (define-minor-mode ,global-mode
         ;; Very short lines to avoid too long lines in the generated
@@ -475,13 +478,13 @@ Valid keywords and arguments are:
     (while args
       (let ((key (pop args))
            (val (pop args)))
-       (case key
-        (:name (setq name val))
-        (:dense (setq dense val))
-        (:inherit (setq inherit val))
-        (:suppress (setq suppress val))
-        (:group)
-        (t (message "Unknown argument %s in defmap" key)))))
+       (pcase key
+        (`:name (setq name val))
+        (`:dense (setq dense val))
+        (`:inherit (setq inherit val))
+        (`:suppress (setq suppress val))
+        (`:group)
+        (_ (message "Unknown argument %s in defmap" key)))))
     (unless (keymapp m)
       (setq bs (append m bs))
       (setq m (if dense (make-keymap name) (make-sparse-keymap name))))
@@ -572,8 +575,6 @@ BODY is executed after moving to the destination location."
                  (when was-narrowed (,narrowfun)))))))
     (unless name (setq name base-name))
     `(progn
-       (add-to-list 'debug-ignored-errors
-                   ,(concat "^No \\(previous\\|next\\) " (regexp-quote name)))
        (defun ,next-sym (&optional count)
         ,(format "Go to the next COUNT'th %s." name)
         (interactive "p")
@@ -584,7 +585,7 @@ BODY is executed after moving to the destination location."
              `(if (not (re-search-forward ,re nil t count))
                   (if (looking-at ,re)
                       (goto-char (or ,(if endfun `(,endfun)) (point-max)))
-                    (error "No next %s" ,name))
+                    (user-error "No next %s" ,name))
                 (goto-char (match-beginning 0))
                 (when (and (eq (current-buffer) (window-buffer (selected-window)))
                            (called-interactively-p 'interactive))
@@ -603,7 +604,7 @@ BODY is executed after moving to the destination location."
         (if (< count 0) (,next-sym (- count))
            ,(funcall when-narrowed
              `(unless (re-search-backward ,re nil t count)
-                (error "No previous %s" ,name)))
+                (user-error "No previous %s" ,name)))
            ,@body))
        (put ',prev-sym 'definition-name ',base))))
 
index b3e54b415d8917f1e40f9c6c9c6f232e660db6b8..7f9f8a336348a8afb21f2ec3105c5eb4f4f9628c 100644 (file)
@@ -29,8 +29,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defvar easy-menu-precalculate-equivalent-keybindings nil
   "Determine when equivalent key bindings are computed for easy-menu menus.
 It can take some time to calculate the equivalent key bindings that are shown
@@ -236,14 +234,14 @@ possibly preceded by keyword pairs as described in `easy-menu-define'."
                (keywordp (setq keyword (car menu-items))))
       (setq arg (cadr menu-items))
       (setq menu-items (cddr menu-items))
-      (case keyword
-       (:filter
+      (pcase keyword
+       (`:filter
        (setq filter `(lambda (menu)
                        (easy-menu-filter-return (,arg menu) ,menu-name))))
-       ((:enable :active) (setq enable (or arg ''nil)))
-       (:label (setq label arg))
-       (:help (setq help arg))
-       ((:included :visible) (setq visible (or arg ''nil)))))
+       ((or `:enable `:active) (setq enable (or arg ''nil)))
+       (`:label (setq label arg))
+       (`:help (setq help arg))
+       ((or `:included `:visible) (setq visible (or arg ''nil)))))
     (if (equal visible ''nil)
        nil                             ; Invisible menu entry, return nil.
       (if (and visible (not (easy-menu-always-true-p visible)))
@@ -334,16 +332,16 @@ ITEM defines an item as in `easy-menu-define'."
                (setq keyword (aref item count))
                (setq arg (aref item (1+ count)))
                (setq count (+ 2 count))
-               (case keyword
-                  ((:included :visible) (setq visible (or arg ''nil)))
-                  (:key-sequence (setq cache arg cache-specified t))
-                  (:keys (setq keys arg no-name nil))
-                  (:label (setq label arg))
-                  ((:active :enable) (setq active (or arg ''nil)))
-                  (:help (setq prop (cons :help (cons arg prop))))
-                  (:suffix (setq suffix arg))
-                  (:style (setq style arg))
-                  (:selected (setq selected (or arg ''nil)))))
+               (pcase keyword
+                  ((or `:included `:visible) (setq visible (or arg ''nil)))
+                  (`:key-sequence (setq cache arg cache-specified t))
+                  (`:keys (setq keys arg no-name nil))
+                  (`:label (setq label arg))
+                  ((or `:active `:enable) (setq active (or arg ''nil)))
+                  (`:help (setq prop (cons :help (cons arg prop))))
+                  (`:suffix (setq suffix arg))
+                  (`:style (setq style arg))
+                  (`:selected (setq selected (or arg ''nil)))))
              (if suffix
                  (setq label
                        (if (stringp suffix)
index 67ffd6d5d31bc3379ea498603a5e1c1cded70de8..c1c65b6f66188aacb2d454b725f5fef78507fc75 100644 (file)
@@ -51,6 +51,8 @@
 
 ;;; Code:
 
+(require 'macroexp)
+
 ;;; Bug reporting
 
 (defalias 'edebug-submit-bug-report 'report-emacs-bug)
@@ -527,6 +529,7 @@ the minibuffer."
            (setq face-new-frame-defaults
                  (assq-delete-all (nth 1 form) face-new-frame-defaults))
            (put (nth 1 form) 'face-defface-spec nil)
+           (put (nth 1 form) 'face-documentation (nth 3 form))
           ;; See comments in `eval-defun-1' for purpose of code below
           (setq form (prog1 `(prog1 ,form
                                (put ',(nth 1 form) 'saved-face
@@ -916,8 +919,7 @@ already is one.)"
   (cond ((eq ?\' (following-char))
         (forward-char 1)
         (list
-         (edebug-storing-offsets (- (point) 2)
-           (if (featurep 'cl) 'function* 'function))
+         (edebug-storing-offsets (- (point) 2) 'function)
          (edebug-read-storing-offsets stream)))
        ((memq (following-char) '(?: ?B ?O ?X ?b ?o ?x ?1 ?2 ?3 ?4 ?5 ?6
                                  ?7 ?8 ?9 ?0))
@@ -1250,10 +1252,7 @@ expressions; a `progn' form will be returned enclosing these forms."
        ((eq 'edebug-after (car sexp))
        (nth 3 sexp))
        ((eq 'edebug-enter (car sexp))
-       (let ((forms (nthcdr 2 (nth 1 (nth 3 sexp)))))
-         (if (> (length forms) 1)
-             (cons 'progn forms)  ;; could return (values forms) instead.
-           (car forms))))
+        (macroexp-progn (nthcdr 2 (nth 1 (nth 3 sexp)))))
        (t sexp);; otherwise it is not wrapped, so just return it.
        )
     sexp))
@@ -1938,7 +1937,6 @@ expressions; a `progn' form will be returned enclosing these forms."
 
 ;;;; Edebug Form Specs
 ;;; ==========================================================
-;;; See cl-specs.el for common lisp specs.
 
 ;;;;* Spec for def-edebug-spec
 ;;; Out of date.
@@ -2011,12 +2009,6 @@ expressions; a `progn' form will be returned enclosing these forms."
 ;; A macro is allowed by Emacs.
 (def-edebug-spec function (&or symbolp lambda-expr))
 
-;; lambda is a macro in emacs 19.
-(def-edebug-spec lambda (&define lambda-list
-                                [&optional stringp]
-                                [&optional ("interactive" interactive)]
-                                def-body))
-
 ;; A macro expression is a lambda expression with "macro" prepended.
 (def-edebug-spec macro (&define "lambda" lambda-list def-body))
 
@@ -3062,7 +3054,6 @@ Otherwise, toggle for all windows."
       (edebug-toggle-save-selected-window)
     (edebug-toggle-save-all-windows)))
 
-
 (defun edebug-where ()
   "Show the debug windows and where we stopped in the program."
   (interactive)
@@ -3742,12 +3733,16 @@ This prints the value into current buffer."
 
 ;;; Edebug Minor Mode
 
-;; FIXME eh?
-(defvar gud-inhibit-global-bindings
-  "*Non-nil means don't do global rebindings of C-x C-a subcommands.")
+(defvar edebug-inhibit-emacs-lisp-mode-bindings nil
+  "If non-nil, inhibit Edebug bindings on the C-x C-a key.
+By default, loading the `edebug' library causes these bindings to
+be installed in `emacs-lisp-mode-map'.")
+
+(define-obsolete-variable-alias 'gud-inhibit-global-bindings
+  'edebug-inhibit-emacs-lisp-mode-bindings "24.2")
 
 ;; Global GUD bindings for all emacs-lisp-mode buffers.
-(unless gud-inhibit-global-bindings
+(unless edebug-inhibit-emacs-lisp-mode-bindings
   (define-key emacs-lisp-mode-map "\C-x\C-a\C-s" 'edebug-step-mode)
   (define-key emacs-lisp-mode-map "\C-x\C-a\C-n" 'edebug-next-mode)
   (define-key emacs-lisp-mode-map "\C-x\C-a\C-c" 'edebug-go-mode)
@@ -4437,13 +4432,6 @@ With prefix argument, make it a temporary breakpoint."
 \f
 ;;; Autoloading of Edebug accessories
 
-(if (featurep 'cl)
-    (add-hook 'edebug-setup-hook
-             (function (lambda () (require 'cl-specs))))
-  ;; The following causes cl-specs to be loaded if you load cl.el.
-  (add-hook 'cl-load-hook
-           (function (lambda () (require 'cl-specs)))))
-
 ;; edebug-cl-read and cl-read are available from liberte@cs.uiuc.edu
 (if (featurep 'cl-read)
     (add-hook 'edebug-setup-hook
index b09f6b6a0e95221c5ef9db42d689e155397c34e2..59aeb161d8e363d726ca9c2b7fc5c4e3ac6a3776 100644 (file)
@@ -345,7 +345,7 @@ These groups are specified with the `:group' slot flag."
                       (concat "*CUSTOMIZE "
                               (object-name obj) " "
                               (symbol-name g) "*")))
-    (toggle-read-only -1)
+    (setq buffer-read-only nil)
     (kill-all-local-variables)
     (erase-buffer)
     (let ((all (overlay-lists)))
index 10816aaa43c38b7e32a7fad85813726d51cff5f4..a899839f68a6223c5c7a7d5ef2fa56db41b12998 100644 (file)
@@ -72,8 +72,7 @@ Argument CH-PREFIX is another character prefix to display."
 
 ;;; CLASS COMPLETION / DOCUMENTATION
 
-;;;###autoload
-(defalias 'describe-class 'eieio-describe-class)
+;;;###autoload(defalias 'describe-class 'eieio-describe-class)
 
 ;;;###autoload
 (defun eieio-describe-class (class &optional headerfcn)
@@ -305,8 +304,7 @@ are not abstract."
 ;;; METHOD COMPLETION / DOC
 
 (defalias 'describe-method 'eieio-describe-generic)
-;;;###autoload
-(defalias 'describe-generic 'eieio-describe-generic)
+;;;###autoload(defalias 'describe-generic 'eieio-describe-generic)
 (defalias 'eieio-describe-method 'eieio-describe-generic)
 
 ;;;###autoload
index cdf7237b7663f73defe48957688afd202945ce18..dcd0608ebbaa22e7ba00ad04f65f109a62d0f628 100644 (file)
@@ -79,7 +79,7 @@
 ;;
 
 (defvar eieio-hook nil
-  "*This hook is executed, then cleared each time `defclass' is called.")
+  "This hook is executed, then cleared each time `defclass' is called.")
 
 (defvar eieio-error-unsupported-class-tags nil
   "Non-nil to throw an error if an encountered tag is unsupported.
@@ -87,7 +87,7 @@ This may prevent classes from CLOS applications from being used with EIEIO
 since EIEIO does not support all CLOS tags.")
 
 (defvar eieio-skip-typecheck nil
-  "*If non-nil, skip all slot typechecking.
+  "If non-nil, skip all slot typechecking.
 Set this to t permanently if a program is functioning well to get a
 small speed increase.  This variable is also used internally to handle
 default setting for optimization purposes.")
@@ -2044,7 +2044,7 @@ During executions, the list is first generated, then as each next method
 is called, the next method is popped off the stack.")
 
 (defvar eieio-pre-method-execution-hooks nil
-  "*Hooks run just before a method is executed.
+  "Abnormal hook run just before an EIEIO method is executed.
 The hook function must accept one argument, the list of forms
 about to be executed.")
 
@@ -2543,10 +2543,12 @@ This is usually a symbol that starts with `:'."
 ;;; Here are some CLOS items that need the CL package
 ;;
 
-(defsetf slot-value (obj slot) (store) (list 'eieio-oset obj slot store))
-(defsetf eieio-oref (obj slot) (store) (list 'eieio-oset obj slot store))
+(defsetf eieio-oref eieio-oset)
+;; FIXME: Not needed for Emacs>=24.2 since setf follows function aliases.
+(defsetf slot-value eieio-oset)
 
 ;; The below setf method was written by Arnd Kohrs <kohrs@acm.org>
+;; FIXME: Not needed for Emacs>=24.2 since setf expands macros.
 (define-setf-method oref (obj slot)
   (with-no-warnings
     (require 'cl)
@@ -3038,7 +3040,7 @@ Optional argument NOESCAPE is passed to `prin1-to-string' when appropriate."
 ;;; Start of automatically extracted autoloads.
 \f
 ;;;### (autoloads (customize-object) "eieio-custom" "eieio-custom.el"
-;;;;;;  "9cf80224540c52045d515a4c2c833543")
+;;;;;;  "928623502e8bf40454822355388542b5")
 ;;; Generated autoloads from eieio-custom.el
 
 (autoload 'customize-object "eieio-custom" "\
@@ -3051,7 +3053,7 @@ Optional argument GROUP is the sub-group of slots to display.
 \f
 ;;;### (autoloads (eieio-help-mode-augmentation-maybee eieio-describe-generic
 ;;;;;;  eieio-describe-constructor eieio-describe-class eieio-browse)
-;;;;;;  "eieio-opt" "eieio-opt.el" "e2814881441ad23759409687502f0ee1")
+;;;;;;  "eieio-opt" "eieio-opt.el" "d808328f9c0156ecbd412d77ba8c569e")
 ;;; Generated autoloads from eieio-opt.el
 
 (autoload 'eieio-browse "eieio-opt" "\
@@ -3060,7 +3062,6 @@ If optional ROOT-CLASS, then start with that, otherwise start with
 variable `eieio-default-superclass'.
 
 \(fn &optional ROOT-CLASS)" t nil)
-
 (defalias 'describe-class 'eieio-describe-class)
 
 (autoload 'eieio-describe-class "eieio-opt" "\
@@ -3075,7 +3076,6 @@ Describe the constructor function FCN.
 Uses `eieio-describe-class' to describe the class being constructed.
 
 \(fn FCN)" t nil)
-
 (defalias 'describe-generic 'eieio-describe-generic)
 
 (autoload 'eieio-describe-generic "eieio-opt" "\
index 5b82cd477f9be19cee31ad18a7267f584ce0aac5..559158138778d192eedd37765aacb4959e73b48d 100644 (file)
@@ -357,6 +357,8 @@ Returns the forms."
     (set (make-local-variable 'elint-buffer-env)
         (elint-init-env elint-buffer-forms))
     (if elint-preloaded-env
+        ;; FIXME: This doesn't do anything!  Should we setq the result to
+        ;; elint-buffer-env?
        (elint-env-add-env elint-preloaded-env elint-buffer-env))
     (set (make-local-variable 'elint-last-env-time) (buffer-modified-tick))
     elint-buffer-forms))
@@ -464,6 +466,9 @@ Return nil if there are no more forms, t otherwise."
        (add-to-list 'elint-features name)
        ;; cl loads cl-macs in an opaque manner.
        ;; Since cl-macs requires cl, we can just process cl-macs.
+        ;; FIXME: AFAIK, `cl' now behaves properly and does not need any
+        ;; special treatment any more.  Can someone who understands this
+        ;; code confirm?  --Stef
        (and (eq name 'cl) (not elint-doing-cl)
             ;; We need cl if elint-form is to be able to expand cl macros.
             (require 'cl)
index 257d0528cbc0ac962f0e6ae189d335c96d1f3baf..a7916354c9134f9aa1336c4b8ecfe96ef10dd00f 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2008, 2010-2012 Free Software Foundation, Inc.
 
 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
-;; Author: Christian Ohler <ohler@gnu.org>
+;;         Christian Ohler <ohler@gnu.org>
 
 ;; This file is part of GNU Emacs.
 
index 9cbe29bf322a98ed6e706e97289061f3e42a8672..ad5e20cb8a4fc642a6dbeb67eb282ef320a270ee 100644 (file)
@@ -1405,7 +1405,7 @@ RESULT must be an `ert-test-result-with-condition'."
 ;;; Running tests in batch mode.
 
 (defvar ert-batch-backtrace-right-margin 70
-  "*The maximum line length for printing backtraces in `ert-run-tests-batch'.")
+  "The maximum line length for printing backtraces in `ert-run-tests-batch'.")
 
 ;;;###autoload
 (defun ert-run-tests-batch (&optional selector)
index 4fd87209b389b2291b4b0a69f291f193c4f4d056..5de3da65174fd3dd1b5c915b729aba010b6580d6 100644 (file)
@@ -1,4 +1,4 @@
-;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer
+;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1991-2012 Free Software Foundation, Inc.
 
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; The doubly linked list is implemented as a circular list with a dummy
 ;; node first and last. The dummy node is used as "the dll".
-(defstruct (ewoc--node
+(cl-defstruct (ewoc--node
            (:type vector)              ;ewoc--node-nth needs this
             (:constructor nil)
            (:constructor ewoc--node-create (start-marker data)))
@@ -140,7 +140,7 @@ and (ewoc--node-nth dll -1) returns the last node."
 \f
 ;;; The ewoc data type
 
-(defstruct (ewoc
+(cl-defstruct (ewoc
            (:constructor nil)
            (:constructor ewoc--create (buffer pretty-printer dll))
            (:conc-name ewoc--))
@@ -216,10 +216,9 @@ NODE and leaving the new node's start there.  Return the new node."
     (ewoc--adjust m (point) R dll)))
 
 (defun ewoc--wrap (func)
-  (lexical-let ((ewoc--user-pp func))
-    (lambda (data)
-      (funcall ewoc--user-pp data)
-      (insert "\n"))))
+  (lambda (data)
+    (funcall func data)
+    (insert "\n")))
 
 \f
 ;;; ===========================================================================
index 375704ab6df40cb74ec7ba041b8e6d9a575b29ee..f7d6cdc3b753f087d0899a0a85bbb350e2b4c1d0 100644 (file)
 ;; Provide an easy hook to tell if we are running with floats or not.
 ;; Define pi and e via math-lib calls (much less prone to killer typos).
 (defconst float-pi (* 4 (atan 1)) "The value of Pi (3.1415926...).")
-(progn
-  ;; Simulate a defconst that doesn't declare the variable dynamically bound.
-  (setq-default pi float-pi)
-  (put 'pi 'variable-documentation
-       "Obsolete since Emacs-23.3.  Use `float-pi' instead.")
-  (put 'pi 'risky-local-variable t)
-  (push 'pi current-load-list))
+(defconst pi float-pi
+  "Obsolete since Emacs-23.3.  Use `float-pi' instead.")
+(internal-make-var-non-special 'pi)
 
 (defconst float-e (exp 1) "The value of e (2.7182818...).")
 
index 6667a101865aa446ed0ff5bff766e24f7744db89..80b6122822e8b7cbeca320189a7304c9d5424183 100644 (file)
 ;; Internal Variables
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(define-obsolete-variable-alias 'generic-font-lock-defaults
+  'generic-font-lock-keywords "22.1")
 (defvar generic-font-lock-keywords nil
   "Keywords for `font-lock-defaults' in a generic mode.")
 (make-variable-buffer-local 'generic-font-lock-keywords)
-(define-obsolete-variable-alias 'generic-font-lock-defaults 'generic-font-lock-keywords "22.1")
 
 ;;;###autoload
 (defvar generic-mode-list nil
@@ -150,7 +151,8 @@ mode hook `MODE-hook'.
 See the file generic-x.el for some examples of `define-generic-mode'."
   (declare (debug (sexp def-form def-form def-form form def-form
                        [&optional stringp] &rest [keywordp form]))
-          (indent 1))
+          (indent 1)
+           (doc-string 7))
 
   ;; Backward compatibility.
   (when (eq (car-safe mode) 'quote)
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
new file mode 100644 (file)
index 0000000..eb0e64e
--- /dev/null
@@ -0,0 +1,455 @@
+;;; gv.el --- Generalized variables  -*- lexical-binding: t -*-
+
+;; Copyright (C) 2012  Free Software Foundation, Inc.
+
+;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
+;; Keywords: extensions
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This is a re-implementation of the setf machinery using a different
+;; underlying approach than the one used earlier in CL, which was based on
+;; define-setf-expander.
+;; `define-setf-expander' makes every "place-expander" return a 5-tuple
+;;   (VARS VALUES STORES GETTER SETTER)
+;; where STORES is a list with a single variable (Common-Lisp allows multiple
+;; variables for use with multiple-return-values, but this is rarely used and
+;; not applicable to Elisp).
+;; It basically says that GETTER is an expression that returns the place's
+;; value, and (lambda STORES SETTER) is an expression that assigns the value(s)
+;; passed to that function to the place, and that you need to wrap the whole
+;; thing within a `(let* ,(zip VARS VALUES) ...).
+;;
+;; Instead, we use here a higher-order approach: instead
+;; of a 5-tuple, a place-expander returns a function.
+;; If you think about types, the old approach return things of type
+;;    {vars: List Var, values: List Exp,
+;;     stores: List Var, getter: Exp, setter: Exp}
+;; whereas the new approach returns a function of type
+;;    (do: ((getter: Exp, setter: ((store: Exp) -> Exp)) -> Exp)) -> Exp.
+;; You can get the new function from the old 5-tuple with something like:
+;;    (lambda (do)
+;;       `(let* ,(zip VARS VALUES)
+;;          (funcall do GETTER (lambda ,STORES ,SETTER))))
+;; You can't easily do the reverse, because this new approach is more
+;; expressive than the old one, so we can't provide a backward-compatible
+;; get-setf-method.
+;;
+;; While it may seem intimidating for people not used to higher-order
+;; functions, you will quickly see that its use (especially with the
+;; `gv-letplace' macro) is actually much easier and more elegant than the old
+;; approach which is clunky and often leads to unreadable code.
+
+;; Food for thought: the syntax of places does not actually conflict with the
+;; pcase patterns.  The `cons' gv works just like a `(,a . ,b) pcase
+;; pattern, and actually the `logand' gv is even closer since it should
+;; arguably fail when trying to set a value outside of the mask.
+;; Generally, places are used for destructors (gethash, aref, car, ...)
+;; whereas pcase patterns are used for constructors (backquote, constants,
+;; vectors, ...).
+
+;;; Code:
+
+(require 'macroexp)
+
+;; What we call a "gvar" is basically a function of type "(getter * setter ->
+;; code) -> code", where "getter" is code and setter is "code -> code".
+
+;; (defvar gv--macro-environment nil
+;;   "Macro expanders for generalized variables.")
+
+;;;###autoload
+(defun gv-get (place do)
+  "Build the code that applies DO to PLACE.
+PLACE must be a valid generalized variable.
+DO must be a function; it will be called with 2 arguments: GETTER and SETTER,
+where GETTER is a (copyable) Elisp expression that returns the value of PLACE,
+and SETTER is a function which returns the code to set PLACE when called
+with a (not necessarily copyable) Elisp expression that returns the value to
+set it to.
+DO must return an Elisp expression."
+  (if (symbolp place)
+      (funcall do place (lambda (v) `(setq ,place ,v)))
+    (let* ((head (car place))
+           (gf (get head 'gv-expander)))
+      ;; Autoload the head, if applicable, since that might define
+      ;; `gv-expander'.
+      (when (and (null gf) (fboundp head)
+                 (eq 'autoload (car-safe (symbol-function head))))
+        (with-demoted-errors
+          (load (nth 1 (symbol-function head)) 'noerror 'nomsg)
+          (setq gf (get head 'gv-expander))))
+      (if gf (apply gf do (cdr place))
+        (let ((me (macroexpand place    ;FIXME: expand one step at a time!
+                               ;; (append macroexpand-all-environment
+                               ;;         gv--macro-environment)
+                               macroexpand-all-environment)))
+          (if (and (eq me place) (get head 'compiler-macro))
+              ;; Expand compiler macros: this takes care of all the accessors
+              ;; defined via cl-defsubst, such as cXXXr and defstruct slots.
+              (setq me (apply (get head 'compiler-macro) place (cdr place))))
+          (if (and (eq me place) (fboundp head)
+                   (symbolp (symbol-function head)))
+              ;; Follow aliases.
+              (setq me (cons (symbol-function head) (cdr place))))
+          (if (eq me place)
+              (error "%S is not a valid place expression" place)
+            (gv-get me do)))))))
+
+;;;###autoload
+(defmacro gv-letplace (vars place &rest body)
+  "Build the code manipulating the generalized variable PLACE.
+GETTER will be bound to a copyable expression that returns the value
+of PLACE.
+SETTER will be bound to a function that takes an expression V and returns
+and new expression that sets PLACE to V.
+BODY should return some Elisp expression E manipulating PLACE via GETTER
+and SETTER.
+The returned value will then be an Elisp expression that first evaluates
+all the parts of PLACE that can be evaluated and then runs E.
+
+\(fn (GETTER SETTER) PLACE &rest BODY)"
+  (declare (indent 2) (debug (sexp form body)))
+  `(gv-get ,place (lambda ,vars ,@body)))
+
+;; Different ways to declare a generalized variable.
+;;;###autoload
+(defmacro gv-define-expander (name handler)
+  "Use HANDLER to handle NAME as a generalized var.
+NAME is a symbol: the name of a function, macro, or special form.
+HANDLER is a function which takes an argument DO followed by the same
+arguments as NAME.  DO is a function as defined in `gv-get'."
+  (declare (indent 1) (debug (sexp form)))
+  ;; Use eval-and-compile so the method can be used in the same file as it
+  ;; is defined.
+  ;; FIXME: Just like byte-compile-macro-environment, we should have something
+  ;; like byte-compile-symbolprop-environment so as to handle these things
+  ;; cleanly without affecting the running Emacs.
+  `(eval-and-compile (put ',name 'gv-expander ,handler)))
+
+;;;###autoload
+(defun gv--defun-declaration (symbol name args handler &optional fix)
+  `(progn
+     ;; No need to autoload this part, since gv-get will auto-load the
+     ;; function's definition before checking the `gv-expander' property.
+     :autoload-end
+     ,(pcase (cons symbol handler)
+        (`(gv-expander . (lambda (,do) . ,body))
+         `(gv-define-expander ,name (lambda (,do ,@args) ,@body)))
+        (`(gv-expander . ,(pred symbolp))
+         `(gv-define-expander ,name #',handler))
+        (`(gv-setter . (lambda (,store) . ,body))
+         `(gv-define-setter ,name (,store ,@args) ,@body))
+        (`(gv-setter . ,(pred symbolp))
+         `(gv-define-simple-setter ,name ,handler ,fix))
+        ;; (`(expand ,expander) `(gv-define-expand ,name ,expander))
+        (_ (message "Unknown %s declaration %S" symbol handler) nil))))
+
+;;;###autoload
+(push `(gv-expander ,(apply-partially #'gv--defun-declaration 'gv-expander))
+      defun-declarations-alist)
+;;;###autoload
+(push `(gv-setter ,(apply-partially #'gv--defun-declaration 'gv-setter))
+      defun-declarations-alist)
+
+;; (defmacro gv-define-expand (name expander)
+;;   "Use EXPANDER to handle NAME as a generalized var.
+;; NAME is a symbol: the name of a function, macro, or special form.
+;; EXPANDER is a function that will be called as a macro-expander to reduce
+;; uses of NAME to some other generalized variable."
+;;   (declare (debug (sexp form)))
+;;   `(eval-and-compile
+;;      (if (not (boundp 'gv--macro-environment))
+;;          (setq gv--macro-environment nil))
+;;      (push (cons ',name ,expander) gv--macro-environment)))
+
+(defun gv--defsetter (name setter do args &optional vars)
+  "Helper function used by code generated by `gv-define-setter'.
+NAME is the name of the getter function.
+SETTER is a function that generates the code for the setter.
+NAME accept ARGS as arguments and SETTER accepts (NEWVAL . ARGS).
+VARS is used internally for recursive calls."
+  (if (null args)
+      (let ((vars (nreverse vars)))
+        (funcall do `(,name ,@vars) (lambda (v) (apply setter v vars))))
+    ;; FIXME: Often it would be OK to skip this `let', but in general,
+    ;; `do' may have all kinds of side-effects.
+    (macroexp-let2 nil v (car args)
+      (gv--defsetter name setter do (cdr args) (cons v vars)))))
+
+;;;###autoload
+(defmacro gv-define-setter (name arglist &rest body)
+  "Define a setter method for generalized variable NAME.
+This macro is an easy-to-use substitute for `gv-define-expander' that works
+well for simple place forms.
+Assignments of VAL to (NAME ARGS...) are expanded by binding the argument
+forms (VAL ARGS...) according to ARGLIST, then executing BODY, which must
+return a Lisp form that does the assignment.
+Actually, ARGLIST may be bound to temporary variables which are introduced
+automatically to preserve proper execution order of the arguments.  Example:
+  (gv-define-setter aref (v a i) `(aset ,a ,i ,v))"
+  (declare (indent 2) (debug (&define name sexp body)))
+  `(gv-define-expander ,name
+     (lambda (do &rest args)
+       (gv--defsetter ',name (lambda ,arglist ,@body) do args))))
+
+;;;###autoload
+(defmacro gv-define-simple-setter (name setter &optional fix-return)
+  "Define a simple setter method for generalized variable NAME.
+This macro is an easy-to-use substitute for `gv-define-expander' that works
+well for simple place forms.  Assignments of VAL to (NAME ARGS...) are
+turned into calls of the form (SETTER ARGS... VAL).
+If FIX-RETURN is non-nil, then SETTER is not assumed to return VAL and
+instead the assignment is turned into (prog1 VAL (SETTER ARGS... VAL))
+so as to preserve the semantics of `setf'."
+  (declare (debug (sexp (&or symbolp lambda-expr) &optional sexp)))
+  (let ((set-call `(cons ',setter (append args (list val)))))
+  `(gv-define-setter ,name (val &rest args)
+     ,(if fix-return `(list 'prog1 val ,set-call) set-call))))
+
+;;; Typical operations on generalized variables.
+
+;;;###autoload
+(defmacro setf (&rest args)
+  "Set each PLACE to the value of its VAL.
+This is a generalized version of `setq'; the PLACEs may be symbolic
+references such as (car x) or (aref x i), as well as plain symbols.
+For example, (setf (cadr x) y) is equivalent to (setcar (cdr x) y).
+The return value is the last VAL in the list.
+
+\(fn PLACE VAL PLACE VAL ...)"
+  (declare (debug (gv-place form)))
+  (if (and args (null (cddr args)))
+      (let ((place (pop args))
+            (val (car args)))
+        (gv-letplace (_getter setter) place
+          (funcall setter val)))
+    (let ((sets nil))
+      (while args (push `(setf ,(pop args) ,(pop args)) sets))
+      (cons 'progn (nreverse sets)))))
+
+;; (defmacro gv-pushnew! (val place)
+;;   "Like `gv-push!' but only adds VAL if it's not yet in PLACE.
+;; Presence is checked with `member'.
+;; The return value is unspecified."
+;;   (declare (debug (form gv-place)))
+;;   (macroexp-let2 macroexp-copyable-p v val
+;;     (gv-letplace (getter setter) place
+;;       `(if (member ,v ,getter) nil
+;;          ,(funcall setter `(cons ,v ,getter))))))
+
+;; (defmacro gv-inc! (place &optional val)
+;;   "Increment PLACE by VAL (default to 1)."
+;;   (declare (debug (gv-place &optional form)))
+;;   (gv-letplace (getter setter) place
+;;     (funcall setter `(+ ,getter ,(or val 1)))))
+
+;; (defmacro gv-dec! (place &optional val)
+;;   "Decrement PLACE by VAL (default to 1)."
+;;   (declare (debug (gv-place &optional form)))
+;;   (gv-letplace (getter setter) place
+;;     (funcall setter `(- ,getter ,(or val 1)))))
+
+;; For Edebug, the idea is to let Edebug instrument gv-places just like it does
+;; for normal expressions, and then give it a gv-expander to DTRT.
+;; Maybe this should really be in edebug.el rather than here.
+
+;; Autoload this `put' since a user might use C-u C-M-x on an expression
+;; containing a non-trivial `push' even before gv.el was loaded.
+;;;###autoload
+(put 'gv-place 'edebug-form-spec 'edebug-match-form)
+;; CL did the equivalent of:
+;;(gv-define-expand edebug-after (lambda (before index place) place))
+
+(put 'edebug-after 'gv-expander
+     (lambda (do before index place)
+       (gv-letplace (getter setter) place
+         (funcall do `(edebug-after ,before ,index ,getter)
+                  setter))))
+
+;;; The common generalized variables.
+
+(gv-define-simple-setter aref aset)
+(gv-define-simple-setter car setcar)
+(gv-define-simple-setter cdr setcdr)
+;; FIXME: add compiler-macros for `cXXr' instead!
+(gv-define-setter caar (val x) `(setcar (car ,x) ,val))
+(gv-define-setter cadr (val x) `(setcar (cdr ,x) ,val))
+(gv-define-setter cdar (val x) `(setcdr (car ,x) ,val))
+(gv-define-setter cddr (val x) `(setcdr (cdr ,x) ,val))
+(gv-define-setter elt (store seq n)
+  `(if (listp ,seq) (setcar (nthcdr ,n ,seq) ,store)
+     (aset ,seq ,n ,store)))
+(gv-define-simple-setter get put)
+(gv-define-setter gethash (val k h &optional _d) `(puthash ,k ,val ,h))
+
+;; (gv-define-expand nth (lambda (idx list) `(car (nthcdr ,idx ,list))))
+(put 'nth 'gv-expander
+     (lambda (do idx list)
+       (macroexp-let2 nil c `(nthcdr ,idx ,list)
+         (funcall do `(car ,c) (lambda (v) `(setcar ,c ,v))))))
+(gv-define-simple-setter symbol-function fset)
+(gv-define-simple-setter symbol-plist setplist)
+(gv-define-simple-setter symbol-value set)
+
+(put 'nthcdr 'gv-expander
+     (lambda (do n place)
+       (macroexp-let2 nil idx n
+         (gv-letplace (getter setter) place
+           (funcall do `(nthcdr ,idx ,getter)
+                    (lambda (v) `(if (<= ,idx 0) ,(funcall setter v)
+                              (setcdr (nthcdr (1- ,idx) ,getter) ,v))))))))
+
+;;; Elisp-specific generalized variables.
+
+(gv-define-simple-setter default-value set-default)
+(gv-define-simple-setter frame-parameter set-frame-parameter 'fix)
+(gv-define-simple-setter terminal-parameter set-terminal-parameter)
+(gv-define-simple-setter keymap-parent set-keymap-parent)
+(gv-define-simple-setter match-data set-match-data 'fix)
+(gv-define-simple-setter overlay-get overlay-put)
+(gv-define-setter overlay-start (store ov)
+  `(progn (move-overlay ,ov ,store (overlay-end ,ov)) ,store))
+(gv-define-setter overlay-end (store ov)
+  `(progn (move-overlay ,ov (overlay-start ,ov) ,store) ,store))
+(gv-define-simple-setter process-buffer set-process-buffer)
+(gv-define-simple-setter process-filter set-process-filter)
+(gv-define-simple-setter process-sentinel set-process-sentinel)
+(gv-define-simple-setter process-get process-put)
+(gv-define-simple-setter window-buffer set-window-buffer)
+(gv-define-simple-setter window-display-table set-window-display-table 'fix)
+(gv-define-simple-setter window-dedicated-p set-window-dedicated-p)
+(gv-define-simple-setter window-hscroll set-window-hscroll)
+(gv-define-simple-setter window-parameter set-window-parameter)
+(gv-define-simple-setter window-point set-window-point)
+(gv-define-simple-setter window-start set-window-start)
+
+;;; Some occasionally handy extensions.
+
+;; While several of the "places" below are not terribly useful for direct use,
+;; they can show up as the output of the macro expansion of reasonable places,
+;; such as struct-accessors.
+
+(put 'progn 'gv-expander
+     (lambda (do &rest exps)
+       (let ((start (butlast exps))
+             (end (car (last exps))))
+         (if (null start) (gv-get end do)
+           `(progn ,@start ,(gv-get end do))))))
+
+(let ((let-expander
+       (lambda (letsym)
+         (lambda (do bindings &rest body)
+           `(,letsym ,bindings
+                     ,@(macroexp-unprogn
+                        (gv-get (macroexp-progn body) do)))))))
+  (put 'let 'gv-expander (funcall let-expander 'let))
+  (put 'let* 'gv-expander (funcall let-expander 'let*)))
+
+(put 'if 'gv-expander
+     (lambda (do test then &rest else)
+       (if (macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy)))
+           ;; This duplicates the `do' code, which is a problem if that
+           ;; code is large, but otherwise results in more efficient code.
+           `(if ,test ,(gv-get then do)
+              ,@(macroexp-unprogn (gv-get (macroexp-progn else) do)))
+         (let ((v (make-symbol "v")))
+           (macroexp-let2 nil
+               gv `(if ,test ,(gv-letplace (getter setter) then
+                                `(cons (lambda () ,getter)
+                                       (lambda (,v) ,(funcall setter v))))
+                     ,(gv-letplace (getter setter) (macroexp-progn else)
+                        `(cons (lambda () ,getter)
+                               (lambda (,v) ,(funcall setter v)))))
+             (funcall do `(funcall (car ,gv))
+                      (lambda (v) `(funcall (cdr ,gv) ,v))))))))
+
+(put 'cond 'gv-expander
+     (lambda (do &rest branches)
+       (if (macroexp-small-p (funcall do 'dummy (lambda (_) 'dummy)))
+           ;; This duplicates the `do' code, which is a problem if that
+           ;; code is large, but otherwise results in more efficient code.
+           `(cond
+             ,@(mapcar (lambda (branch)
+                         (if (cdr branch)
+                             (cons (car branch)
+                                   (macroexp-unprogn
+                                    (gv-get (macroexp-progn (cdr branch)) do)))
+                           (gv-get (car branch) do)))
+                       branches))
+         (let ((v (make-symbol "v")))
+           (macroexp-let2 nil
+               gv `(cond
+                    ,@(mapcar
+                       (lambda (branch)
+                         (if (cdr branch)
+                             `(,(car branch)
+                               ,@(macroexp-unprogn
+                                  (gv-letplace (getter setter)
+                                      (macroexp-progn (cdr branch))
+                                    `(cons (lambda () ,getter)
+                                           (lambda (,v) ,(funcall setter v))))))
+                           (gv-letplace (getter setter)
+                               (car branch)
+                             `(cons (lambda () ,getter)
+                                    (lambda (,v) ,(funcall setter v))))))
+                       branches))
+             (funcall do `(funcall (car ,gv))
+                      (lambda (v) `(funcall (cdr ,gv) ,v))))))))
+
+;;; Even more debatable extensions.
+
+(put 'cons 'gv-expander
+     (lambda (do a d)
+       (gv-letplace (agetter asetter) a
+         (gv-letplace (dgetter dsetter) d
+           (funcall do
+                    `(cons ,agetter ,dgetter)
+                    (lambda (v) `(progn
+                              ,(funcall asetter `(car ,v))
+                              ,(funcall dsetter `(cdr ,v)))))))))
+
+(put 'logand 'gv-expander
+     (lambda (do place &rest masks)
+       (gv-letplace (getter setter) place
+         (macroexp-let2 macroexp-copyable-p
+             mask (if (cdr masks) `(logand ,@masks) (car masks))
+           (funcall
+            do `(logand ,getter ,mask)
+            (lambda (v)
+              (funcall setter
+                       `(logior (logand ,v ,mask)
+                                (logand ,getter (lognot ,mask))))))))))
+
+;;; Vaguely related definitions that should be moved elsewhere.
+
+;; (defun alist-get (key alist)
+;;   "Get the value associated to KEY in ALIST."
+;;   (declare
+;;    (gv-expander
+;;     (lambda (do)
+;;       (macroexp-let2 macroexp-copyable-p k key
+;;         (gv-letplace (getter setter) alist
+;;           (macroexp-let2 nil p `(assoc ,k ,getter)
+;;             (funcall do `(cdr ,p)
+;;                      (lambda (v)
+;;                        `(if ,p (setcdr ,p ,v)
+;;                           ,(funcall setter
+;;                                     `(cons (cons ,k ,v) ,getter)))))))))))
+;;   (cdr (assoc key alist)))
+
+(provide 'gv)
+;;; gv.el ends here
index 95eb8c963be99bbcc99279d4e69d10dfb86213c7..350b0bd949d5adba7082dbecb2bea376fd7cbc92 100644 (file)
@@ -135,35 +135,12 @@ It has `lisp-mode-abbrev-table' as its parent."
 
 ;; This was originally in autoload.el and is still used there.
 (put 'autoload 'doc-string-elt 3)
-(put 'defun    'doc-string-elt 3)
-(put 'defun*    'doc-string-elt 3)
 (put 'defmethod 'doc-string-elt 3)
 (put 'defvar   'doc-string-elt 3)
-(put 'defcustom 'doc-string-elt 3)
-(put 'deftheme 'doc-string-elt 2)
-(put 'deftype 'doc-string-elt 3)
 (put 'defconst 'doc-string-elt 3)
-(put 'defmacro 'doc-string-elt 3)
-(put 'defmacro* 'doc-string-elt 3)
-(put 'defsubst 'doc-string-elt 3)
-(put 'defstruct 'doc-string-elt 2)
-(put 'define-skeleton 'doc-string-elt 2)
-(put 'define-derived-mode 'doc-string-elt 4)
-(put 'define-compilation-mode 'doc-string-elt 3)
-(put 'easy-mmode-define-minor-mode 'doc-string-elt 2)
-(put 'define-minor-mode 'doc-string-elt 2)
-(put 'easy-mmode-define-global-mode 'doc-string-elt 2)
-(put 'define-global-minor-mode 'doc-string-elt 2)
-(put 'define-globalized-minor-mode 'doc-string-elt 2)
-(put 'define-generic-mode 'doc-string-elt 7)
-(put 'define-ibuffer-filter 'doc-string-elt 2)
-(put 'define-ibuffer-op 'doc-string-elt 3)
-(put 'define-ibuffer-sorter 'doc-string-elt 2)
-(put 'lambda 'doc-string-elt 2)
 (put 'defalias 'doc-string-elt 3)
 (put 'defvaralias 'doc-string-elt 3)
 (put 'define-category 'doc-string-elt 2)
-(put 'define-overloadable-function 'doc-string-elt 3)
 
 (defvar lisp-doc-string-elt-property 'doc-string-elt
   "The symbol property that holds the docstring position info.")
@@ -287,110 +264,111 @@ font-lock keywords will not be case sensitive."
     (define-key map "\e\t" 'completion-at-point)
     (define-key map "\e\C-x" 'eval-defun)
     (define-key map "\e\C-q" 'indent-pp-sexp)
-    (define-key map [menu-bar emacs-lisp] (cons (purecopy "Emacs-Lisp") menu-map))
-    (define-key menu-map [eldoc]
-      `(menu-item ,(purecopy "Auto-Display Documentation Strings") eldoc-mode
+    (bindings--define-key map [menu-bar emacs-lisp]
+      (cons "Emacs-Lisp" menu-map))
+    (bindings--define-key menu-map [eldoc]
+      '(menu-item "Auto-Display Documentation Strings" eldoc-mode
                  :button (:toggle . (bound-and-true-p eldoc-mode))
-                 :help ,(purecopy "Display the documentation string for the item under cursor")))
-    (define-key menu-map [checkdoc]
-      `(menu-item ,(purecopy "Check Documentation Strings") checkdoc
-                 :help ,(purecopy "Check documentation strings for style requirements")))
-    (define-key menu-map [re-builder]
-      `(menu-item ,(purecopy "Construct Regexp") re-builder
-                 :help ,(purecopy "Construct a regexp interactively")))
-    (define-key menu-map [tracing] (cons (purecopy "Tracing") tracing-map))
-    (define-key tracing-map [tr-a]
-      `(menu-item ,(purecopy "Untrace All") untrace-all
-                 :help ,(purecopy "Untrace all currently traced functions")))
-    (define-key tracing-map [tr-uf]
-      `(menu-item ,(purecopy "Untrace Function...") untrace-function
-                 :help ,(purecopy "Untrace function, and possibly activate all remaining advice")))
-    (define-key tracing-map [tr-sep] menu-bar-separator)
-    (define-key tracing-map [tr-q]
-      `(menu-item ,(purecopy "Trace Function Quietly...") trace-function-background
-                 :help ,(purecopy "Trace the function with trace output going quietly to a buffer")))
-    (define-key tracing-map [tr-f]
-      `(menu-item ,(purecopy "Trace Function...") trace-function
-                 :help ,(purecopy "Trace the function given as an argument")))
-    (define-key menu-map [profiling] (cons (purecopy "Profiling") prof-map))
-    (define-key prof-map [prof-restall]
-      `(menu-item ,(purecopy "Remove Instrumentation for All Functions") elp-restore-all
-                 :help ,(purecopy "Restore the original definitions of all functions being profiled")))
-    (define-key prof-map [prof-restfunc]
-      `(menu-item ,(purecopy "Remove Instrumentation for Function...") elp-restore-function
-                 :help ,(purecopy "Restore an instrumented function to its original definition")))
-
-    (define-key prof-map [sep-rem] menu-bar-separator)
-    (define-key prof-map [prof-resall]
-      `(menu-item ,(purecopy "Reset Counters for All Functions") elp-reset-all
-                 :help ,(purecopy "Reset the profiling information for all functions being profiled")))
-    (define-key prof-map [prof-resfunc]
-      `(menu-item ,(purecopy "Reset Counters for Function...") elp-reset-function
-                 :help ,(purecopy "Reset the profiling information for a function")))
-    (define-key prof-map [prof-res]
-      `(menu-item ,(purecopy "Show Profiling Results") elp-results
-                 :help ,(purecopy "Display current profiling results")))
-    (define-key prof-map [prof-pack]
-      `(menu-item ,(purecopy "Instrument Package...") elp-instrument-package
-                 :help ,(purecopy "Instrument for profiling all function that start with a prefix")))
-    (define-key prof-map [prof-func]
-      `(menu-item ,(purecopy "Instrument Function...") elp-instrument-function
-                 :help ,(purecopy "Instrument a function for profiling")))
-    (define-key menu-map [lint] (cons (purecopy "Linting") lint-map))
-    (define-key lint-map [lint-di]
-      `(menu-item ,(purecopy "Lint Directory...") elint-directory
-                 :help ,(purecopy "Lint a directory")))
-    (define-key lint-map [lint-f]
-      `(menu-item ,(purecopy "Lint File...") elint-file
-                 :help ,(purecopy "Lint a file")))
-    (define-key lint-map [lint-b]
-      `(menu-item ,(purecopy "Lint Buffer") elint-current-buffer
-                 :help ,(purecopy "Lint the current buffer")))
-    (define-key lint-map [lint-d]
-      `(menu-item ,(purecopy "Lint Defun") elint-defun
-                 :help ,(purecopy "Lint the function at point")))
-    (define-key menu-map [edebug-defun]
-      `(menu-item ,(purecopy "Instrument Function for Debugging") edebug-defun
-                 :help ,(purecopy "Evaluate the top level form point is in, stepping through with Edebug")
-                 :keys ,(purecopy "C-u C-M-x")))
-    (define-key menu-map [separator-byte] menu-bar-separator)
-    (define-key menu-map [disas]
-      `(menu-item ,(purecopy "Disassemble Byte Compiled Object...") disassemble
-                 :help ,(purecopy "Print disassembled code for OBJECT in a buffer")))
-    (define-key menu-map [byte-recompile]
-      `(menu-item ,(purecopy "Byte-recompile Directory...") byte-recompile-directory
-                 :help ,(purecopy "Recompile every `.el' file in DIRECTORY that needs recompilation")))
-    (define-key menu-map [emacs-byte-compile-and-load]
-      `(menu-item ,(purecopy "Byte-compile and Load") emacs-lisp-byte-compile-and-load
-                 :help ,(purecopy "Byte-compile the current file (if it has changed), then load compiled code")))
-    (define-key menu-map [byte-compile]
-      `(menu-item ,(purecopy "Byte-compile This File") emacs-lisp-byte-compile
-                 :help ,(purecopy "Byte compile the file containing the current buffer")))
-    (define-key menu-map [separator-eval] menu-bar-separator)
-    (define-key menu-map [ielm]
-      `(menu-item ,(purecopy "Interactive Expression Evaluation") ielm
-                 :help ,(purecopy "Interactively evaluate Emacs Lisp expressions")))
-    (define-key menu-map [eval-buffer]
-      `(menu-item ,(purecopy "Evaluate Buffer") eval-buffer
-                 :help ,(purecopy "Execute the current buffer as Lisp code")))
-    (define-key menu-map [eval-region]
-      `(menu-item ,(purecopy "Evaluate Region") eval-region
-                 :help ,(purecopy "Execute the region as Lisp code")
+                 :help "Display the documentation string for the item under cursor"))
+    (bindings--define-key menu-map [checkdoc]
+      '(menu-item "Check Documentation Strings" checkdoc
+                 :help "Check documentation strings for style requirements"))
+    (bindings--define-key menu-map [re-builder]
+      '(menu-item "Construct Regexp" re-builder
+                 :help "Construct a regexp interactively"))
+    (bindings--define-key menu-map [tracing] (cons "Tracing" tracing-map))
+    (bindings--define-key tracing-map [tr-a]
+      '(menu-item "Untrace All" untrace-all
+                 :help "Untrace all currently traced functions"))
+    (bindings--define-key tracing-map [tr-uf]
+      '(menu-item "Untrace Function..." untrace-function
+                 :help "Untrace function, and possibly activate all remaining advice"))
+    (bindings--define-key tracing-map [tr-sep] menu-bar-separator)
+    (bindings--define-key tracing-map [tr-q]
+      '(menu-item "Trace Function Quietly..." trace-function-background
+                 :help "Trace the function with trace output going quietly to a buffer"))
+    (bindings--define-key tracing-map [tr-f]
+      '(menu-item "Trace Function..." trace-function
+                 :help "Trace the function given as an argument"))
+    (bindings--define-key menu-map [profiling] (cons "Profiling" prof-map))
+    (bindings--define-key prof-map [prof-restall]
+      '(menu-item "Remove Instrumentation for All Functions" elp-restore-all
+                 :help "Restore the original definitions of all functions being profiled"))
+    (bindings--define-key prof-map [prof-restfunc]
+      '(menu-item "Remove Instrumentation for Function..." elp-restore-function
+                 :help "Restore an instrumented function to its original definition"))
+
+    (bindings--define-key prof-map [sep-rem] menu-bar-separator)
+    (bindings--define-key prof-map [prof-resall]
+      '(menu-item "Reset Counters for All Functions" elp-reset-all
+                 :help "Reset the profiling information for all functions being profiled"))
+    (bindings--define-key prof-map [prof-resfunc]
+      '(menu-item "Reset Counters for Function..." elp-reset-function
+                 :help "Reset the profiling information for a function"))
+    (bindings--define-key prof-map [prof-res]
+      '(menu-item "Show Profiling Results" elp-results
+                 :help "Display current profiling results"))
+    (bindings--define-key prof-map [prof-pack]
+      '(menu-item "Instrument Package..." elp-instrument-package
+                 :help "Instrument for profiling all function that start with a prefix"))
+    (bindings--define-key prof-map [prof-func]
+      '(menu-item "Instrument Function..." elp-instrument-function
+                 :help "Instrument a function for profiling"))
+    (bindings--define-key menu-map [lint] (cons "Linting" lint-map))
+    (bindings--define-key lint-map [lint-di]
+      '(menu-item "Lint Directory..." elint-directory
+                 :help "Lint a directory"))
+    (bindings--define-key lint-map [lint-f]
+      '(menu-item "Lint File..." elint-file
+                 :help "Lint a file"))
+    (bindings--define-key lint-map [lint-b]
+      '(menu-item "Lint Buffer" elint-current-buffer
+                 :help "Lint the current buffer"))
+    (bindings--define-key lint-map [lint-d]
+      '(menu-item "Lint Defun" elint-defun
+                 :help "Lint the function at point"))
+    (bindings--define-key menu-map [edebug-defun]
+      '(menu-item "Instrument Function for Debugging" edebug-defun
+                 :help "Evaluate the top level form point is in, stepping through with Edebug"
+                 :keys "C-u C-M-x"))
+    (bindings--define-key menu-map [separator-byte] menu-bar-separator)
+    (bindings--define-key menu-map [disas]
+      '(menu-item "Disassemble Byte Compiled Object..." disassemble
+                 :help "Print disassembled code for OBJECT in a buffer"))
+    (bindings--define-key menu-map [byte-recompile]
+      '(menu-item "Byte-recompile Directory..." byte-recompile-directory
+                 :help "Recompile every `.el' file in DIRECTORY that needs recompilation"))
+    (bindings--define-key menu-map [emacs-byte-compile-and-load]
+      '(menu-item "Byte-compile and Load" emacs-lisp-byte-compile-and-load
+                 :help "Byte-compile the current file (if it has changed), then load compiled code"))
+    (bindings--define-key menu-map [byte-compile]
+      '(menu-item "Byte-compile This File" emacs-lisp-byte-compile
+                 :help "Byte compile the file containing the current buffer"))
+    (bindings--define-key menu-map [separator-eval] menu-bar-separator)
+    (bindings--define-key menu-map [ielm]
+      '(menu-item "Interactive Expression Evaluation" ielm
+                 :help "Interactively evaluate Emacs Lisp expressions"))
+    (bindings--define-key menu-map [eval-buffer]
+      '(menu-item "Evaluate Buffer" eval-buffer
+                 :help "Execute the current buffer as Lisp code"))
+    (bindings--define-key menu-map [eval-region]
+      '(menu-item "Evaluate Region" eval-region
+                 :help "Execute the region as Lisp code"
                  :enable mark-active))
-    (define-key menu-map [eval-sexp]
-      `(menu-item ,(purecopy "Evaluate Last S-expression") eval-last-sexp
-                 :help ,(purecopy "Evaluate sexp before point; print value in minibuffer")))
-    (define-key menu-map [separator-format] menu-bar-separator)
-    (define-key menu-map [comment-region]
-      `(menu-item ,(purecopy "Comment Out Region") comment-region
-                 :help ,(purecopy "Comment or uncomment each line in the region")
+    (bindings--define-key menu-map [eval-sexp]
+      '(menu-item "Evaluate Last S-expression" eval-last-sexp
+                 :help "Evaluate sexp before point; print value in minibuffer"))
+    (bindings--define-key menu-map [separator-format] menu-bar-separator)
+    (bindings--define-key menu-map [comment-region]
+      '(menu-item "Comment Out Region" comment-region
+                 :help "Comment or uncomment each line in the region"
                  :enable mark-active))
-    (define-key menu-map [indent-region]
-      `(menu-item ,(purecopy "Indent Region") indent-region
-                 :help ,(purecopy "Indent each nonblank line in the region")
+    (bindings--define-key menu-map [indent-region]
+      '(menu-item "Indent Region" indent-region
+                 :help "Indent each nonblank line in the region"
                  :enable mark-active))
-    (define-key menu-map [indent-line]
-      `(menu-item ,(purecopy "Indent Line") lisp-indent-line))
+    (bindings--define-key menu-map [indent-line]
+      '(menu-item "Indent Line" lisp-indent-line))
     map)
   "Keymap for Emacs Lisp mode.
 All commands in `lisp-mode-shared-map' are inherited by this map.")
@@ -453,16 +431,16 @@ if that value is non-nil."
     (set-keymap-parent map lisp-mode-shared-map)
     (define-key map "\e\C-x" 'lisp-eval-defun)
     (define-key map "\C-c\C-z" 'run-lisp)
-    (define-key map [menu-bar lisp] (cons (purecopy "Lisp") menu-map))
-    (define-key menu-map [run-lisp]
-      `(menu-item ,(purecopy "Run inferior Lisp") run-lisp
-                 :help ,(purecopy "Run an inferior Lisp process, input and output via buffer `*inferior-lisp*'")))
-    (define-key menu-map [ev-def]
-      `(menu-item ,(purecopy "Eval defun") lisp-eval-defun
-                 :help ,(purecopy "Send the current defun to the Lisp process made by M-x run-lisp")))
-    (define-key menu-map [ind-sexp]
-      `(menu-item ,(purecopy "Indent sexp") indent-sexp
-                 :help ,(purecopy "Indent each line of the list starting just after point")))
+    (bindings--define-key map [menu-bar lisp] (cons "Lisp" menu-map))
+    (bindings--define-key menu-map [run-lisp]
+      '(menu-item "Run inferior Lisp" run-lisp
+                 :help "Run an inferior Lisp process, input and output via buffer `*inferior-lisp*'"))
+    (bindings--define-key menu-map [ev-def]
+      '(menu-item "Eval defun" lisp-eval-defun
+                 :help "Send the current defun to the Lisp process made by M-x run-lisp"))
+    (bindings--define-key menu-map [ind-sexp]
+      '(menu-item "Indent sexp" indent-sexp
+                 :help "Indent each line of the list starting just after point"))
     map)
   "Keymap for ordinary Lisp mode.
 All commands in `lisp-mode-shared-map' are inherited by this map.")
@@ -510,23 +488,24 @@ if that value is non-nil."
     (define-key map "\e\C-q" 'indent-pp-sexp)
     (define-key map "\e\t" 'completion-at-point)
     (define-key map "\n" 'eval-print-last-sexp)
-    (define-key map [menu-bar lisp-interaction] (cons (purecopy "Lisp-Interaction") menu-map))
-    (define-key menu-map [eval-defun]
-      `(menu-item ,(purecopy "Evaluate Defun") eval-defun
-                 :help ,(purecopy "Evaluate the top-level form containing point, or after point")))
-    (define-key menu-map [eval-print-last-sexp]
-      `(menu-item ,(purecopy "Evaluate and Print") eval-print-last-sexp
-                 :help ,(purecopy "Evaluate sexp before point; print value into current buffer")))
-    (define-key menu-map [edebug-defun-lisp-interaction]
-      `(menu-item ,(purecopy "Instrument Function for Debugging") edebug-defun
-                 :help ,(purecopy "Evaluate the top level form point is in, stepping through with Edebug")
-                 :keys ,(purecopy "C-u C-M-x")))
-    (define-key menu-map [indent-pp-sexp]
-      `(menu-item ,(purecopy "Indent or Pretty-Print") indent-pp-sexp
-                 :help ,(purecopy "Indent each line of the list starting just after point, or prettyprint it")))
-    (define-key menu-map [complete-symbol]
-      `(menu-item ,(purecopy "Complete Lisp Symbol") completion-at-point
-                 :help ,(purecopy "Perform completion on Lisp symbol preceding point")))
+    (bindings--define-key map [menu-bar lisp-interaction]
+      (cons "Lisp-Interaction" menu-map))
+    (bindings--define-key menu-map [eval-defun]
+      '(menu-item "Evaluate Defun" eval-defun
+                 :help "Evaluate the top-level form containing point, or after point"))
+    (bindings--define-key menu-map [eval-print-last-sexp]
+      '(menu-item "Evaluate and Print" eval-print-last-sexp
+                 :help "Evaluate sexp before point; print value into current buffer"))
+    (bindings--define-key menu-map [edebug-defun-lisp-interaction]
+      '(menu-item "Instrument Function for Debugging" edebug-defun
+                 :help "Evaluate the top level form point is in, stepping through with Edebug"
+                 :keys "C-u C-M-x"))
+    (bindings--define-key menu-map [indent-pp-sexp]
+      '(menu-item "Indent or Pretty-Print" indent-pp-sexp
+                 :help "Indent each line of the list starting just after point, or prettyprint it"))
+    (bindings--define-key menu-map [complete-symbol]
+      '(menu-item "Complete Lisp Symbol" completion-at-point
+                 :help "Perform completion on Lisp symbol preceding point"))
     map)
   "Keymap for Lisp Interaction mode.
 All commands in `lisp-mode-shared-map' are inherited by this map.")
@@ -850,10 +829,10 @@ Return the result of evaluation."
           (end-of-defun)
           (beginning-of-defun)
           (setq beg (point))
-          (setq form (eval-sexp-add-defvars (read (current-buffer))))
+          (setq form (read (current-buffer)))
           (setq end (point)))
         ;; Alter the form if necessary.
-        (setq form (eval-defun-1 (macroexpand form)))
+        (setq form (eval-sexp-add-defvars (eval-defun-1 (macroexpand form))))
         (list beg end standard-output
               `(lambda (ignore)
                 ;; Skipping to the end of the specified region
@@ -1233,7 +1212,6 @@ Lisp function does not specify a special indentation."
 ;; like defun if the first form is placed on the next line, otherwise
 ;; it is indented like any other form (i.e. forms line up under first).
 
-(put 'lambda 'lisp-indent-function 'defun)
 (put 'autoload 'lisp-indent-function 'defun)
 (put 'progn 'lisp-indent-function 0)
 (put 'prog1 'lisp-indent-function 1)
index 4efdc3240cd723ec838be37adf3033f650abad8c..bcb7fab026bfe8596afd9f9deb6adeaebc53e006 100644 (file)
@@ -447,7 +447,21 @@ Optional ARG is ignored."
       ;; Try first in this order for the sake of languages with nested
       ;; functions where several can end at the same place as with
       ;; the offside rule, e.g. Python.
-      (beginning-of-defun)
+
+      ;; Finding the start of the function is a bit problematic since
+      ;; `beginning-of-defun' when we are on the first character of
+      ;; the function might go to the previous function.
+      ;;
+      ;; Therefore we first move one character forward and then call
+      ;; `beginning-of-defun'.  However now we must check that we did
+      ;; not move into the next function.
+      (let ((here (point)))
+        (unless (eolp)
+         (forward-char))
+        (beginning-of-defun)
+        (when (< (point) here)
+          (goto-char here)
+          (beginning-of-defun)))
       (setq beg (point))
       (end-of-defun)
       (setq end (point))
index 21c351159c297169c0da02c5948ca66a8a6a18f9..65a72aa5312aa1c1144941acd90c03b856108c51 100644 (file)
@@ -1,4 +1,4 @@
-;;; macroexp.el --- Additional macro-expansion support -*- lexical-binding: t -*-
+;;; macroexp.el --- Additional macro-expansion support -*- lexical-binding: t; coding: utf-8 -*-
 ;;
 ;; Copyright (C) 2004-2012 Free Software Foundation, Inc.
 ;;
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;; Bound by the top-level `macroexpand-all', and modified to include any
 ;; macros defined by `defmacro'.
 (defvar macroexpand-all-environment nil)
 
-(defun maybe-cons (car cdr original-cons)
+(defun macroexp--cons (car cdr original-cons)
   "Return (CAR . CDR), using ORIGINAL-CONS if possible."
   (if (and (eq car (car original-cons)) (eq cdr (cdr original-cons)))
       original-cons
@@ -43,9 +41,9 @@
 
 ;; We use this special macro to iteratively process forms and share list
 ;; structure of the result with the input.  Doing so recursively using
-;; `maybe-cons' results in excessively deep recursion for very long
+;; `macroexp--cons' results in excessively deep recursion for very long
 ;; input forms.
-(defmacro macroexp-accumulate (var+list &rest body)
+(defmacro macroexp--accumulate (var+list &rest body)
   "Return a list of the results of evaluating BODY for each element of LIST.
 Evaluate BODY with VAR bound to each `car' from LIST, in turn.
 Return a list of the values of the final form in BODY.
@@ -65,7 +63,7 @@ result will be eq to LIST).
            (,unshared nil)
            (,tail ,shared)
            ,var ,new-el)
-       (while ,tail
+       (while (consp ,tail)
         (setq ,var (car ,tail)
               ,new-el (progn ,@body))
         (unless (eq ,var ,new-el)
@@ -76,27 +74,33 @@ result will be eq to LIST).
         (setq ,tail (cdr ,tail)))
        (nconc (nreverse ,unshared) ,shared))))
 
-(defun macroexpand-all-forms (forms &optional skip)
+(defun macroexp--all-forms (forms &optional skip)
   "Return FORMS with macros expanded.  FORMS is a list of forms.
 If SKIP is non-nil, then don't expand that many elements at the start of
 FORMS."
-  (macroexp-accumulate (form forms)
+  (macroexp--accumulate (form forms)
     (if (or (null skip) (zerop skip))
-       (macroexpand-all-1 form)
+       (macroexp--expand-all form)
       (setq skip (1- skip))
       form)))
 
-(defun macroexpand-all-clauses (clauses &optional skip)
+(defun macroexp--all-clauses (clauses &optional skip)
   "Return CLAUSES with macros expanded.
 CLAUSES is a list of lists of forms; any clause that's not a list is ignored.
 If SKIP is non-nil, then don't expand that many elements at the start of
 each clause."
-  (macroexp-accumulate (clause clauses)
+  (macroexp--accumulate (clause clauses)
     (if (listp clause)
-       (macroexpand-all-forms clause skip)
+       (macroexp--all-forms clause skip)
       clause)))
 
-(defun macroexpand-all-1 (form)
+(defun macroexp--compiler-macro (handler form)
+  (condition-case err
+      (apply handler form (cdr form))
+    (error (message "Compiler-macro error for %S: %S" (car form) err)
+           form)))
+
+(defun macroexp--expand-all (form)
   "Expand all macros in FORM.
 This is an internal version of `macroexpand-all'.
 Assumes the caller has bound `macroexpand-all-environment'."
@@ -105,7 +109,7 @@ Assumes the caller has bound `macroexpand-all-environment'."
       ;; generates exceedingly deep expansions from relatively shallow input
       ;; forms.  We just process it `in reverse' -- first we expand all the
       ;; arguments, _then_ we expand the top-level definition.
-      (macroexpand (macroexpand-all-forms form 1)
+      (macroexpand (macroexp--all-forms form 1)
                   macroexpand-all-environment)
     ;; Normal form; get its expansion, and then expand arguments.
     (let ((new-form (macroexpand form macroexpand-all-environment)))
@@ -118,48 +122,34 @@ Assumes the caller has bound `macroexpand-all-environment'."
       (setq form new-form))
     (pcase form
       (`(cond . ,clauses)
-       (maybe-cons 'cond (macroexpand-all-clauses clauses) form))
+       (macroexp--cons 'cond (macroexp--all-clauses clauses) form))
       (`(condition-case . ,(or `(,err ,body . ,handlers) dontcare))
-       (maybe-cons
+       (macroexp--cons
         'condition-case
-        (maybe-cons err
-                    (maybe-cons (macroexpand-all-1 body)
-                                (macroexpand-all-clauses handlers 1)
+        (macroexp--cons err
+                    (macroexp--cons (macroexp--expand-all body)
+                                (macroexp--all-clauses handlers 1)
                                 (cddr form))
                     (cdr form))
         form))
-      (`(defmacro ,name . ,args-and-body)
-       (push (cons name (cons 'lambda args-and-body))
-             macroexpand-all-environment)
-       (let ((n 3))
-         ;; Don't macroexpand `declare' since it should really be "expanded"
-         ;; away when `defmacro' is expanded, but currently defmacro is not
-         ;; itself a macro.  So both `defmacro' and `declare' need to be
-         ;; handled directly in bytecomp.el.
-         ;; FIXME: Maybe a simpler solution is to (defalias 'declare 'quote).
-         (while (or (stringp (nth n form))
-                    (eq (car-safe (nth n form)) 'declare))
-           (setq n (1+ n)))
-         (macroexpand-all-forms form n)))
-      (`(defun . ,_) (macroexpand-all-forms form 3))
-      (`(,(or `defvar `defconst) . ,_) (macroexpand-all-forms form 2))
+      (`(,(or `defvar `defconst) . ,_) (macroexp--all-forms form 2))
       (`(function ,(and f `(lambda . ,_)))
-       (maybe-cons 'function
-                   (maybe-cons (macroexpand-all-forms f 2)
+       (macroexp--cons 'function
+                   (macroexp--cons (macroexp--all-forms f 2)
                                nil
                                (cdr form))
                    form))
       (`(,(or `function `quote) . ,_) form)
       (`(,(and fun (or `let `let*)) . ,(or `(,bindings . ,body) dontcare))
-       (maybe-cons fun
-                   (maybe-cons (macroexpand-all-clauses bindings 1)
-                               (macroexpand-all-forms body)
+       (macroexp--cons fun
+                   (macroexp--cons (macroexp--all-clauses bindings 1)
+                               (macroexp--all-forms body)
                                (cdr form))
                    form))
       (`(,(and fun `(lambda . ,_)) . ,args)
        ;; Embedded lambda in function position.
-       (maybe-cons (macroexpand-all-forms fun 2)
-                   (macroexpand-all-forms args)
+       (macroexp--cons (macroexp--all-forms fun 2)
+                   (macroexp--all-forms args)
                    form))
       ;; The following few cases are for normal function calls that
       ;; are known to funcall one of their arguments.  The byte
@@ -175,41 +165,58 @@ Assumes the caller has bound `macroexpand-all-environment'."
         (format "%s quoted with ' rather than with #'"
                 (list 'lambda (nth 1 f) '...))
         t)
-       ;; We don't use `maybe-cons' since there's clearly a change.
+       ;; We don't use `macroexp--cons' since there's clearly a change.
        (cons fun
-             (cons (macroexpand-all-1 (list 'function f))
-                   (macroexpand-all-forms args))))
+             (cons (macroexp--expand-all (list 'function f))
+                   (macroexp--all-forms args))))
       ;; Second arg is a function:
       (`(,(and fun (or `sort)) ,arg1 ',(and f `(lambda . ,_)) . ,args)
        (byte-compile-log-warning
         (format "%s quoted with ' rather than with #'"
                 (list 'lambda (nth 1 f) '...))
         t)
-       ;; We don't use `maybe-cons' since there's clearly a change.
+       ;; We don't use `macroexp--cons' since there's clearly a change.
        (cons fun
-             (cons (macroexpand-all-1 arg1)
-                   (cons (macroexpand-all-1
+             (cons (macroexp--expand-all arg1)
+                   (cons (macroexp--expand-all
                           (list 'function f))
-                         (macroexpand-all-forms args)))))
-      ;; Macro expand compiler macros.  This cannot be delayed to
-      ;; byte-optimize-form because the output of the compiler-macro can
-      ;; use macros.
-      ;; FIXME: Don't depend on CL.
-      (`(,(pred (lambda (fun)
-                  (and (symbolp fun)
-                       (eq (get fun 'byte-compile)
-                           'cl-byte-compile-compiler-macro)
-                       (functionp 'compiler-macroexpand))))
-         . ,_)
-       (let ((newform (with-no-warnings (compiler-macroexpand form))))
-         (if (eq form newform)
-             (macroexpand-all-forms form 1)
-           (macroexpand-all-1 newform))))
-      (`(,_ . ,_)
-       ;; For every other list, we just expand each argument (for
-       ;; setq/setq-default this works alright because the variable names
-       ;; are symbols).
-       (macroexpand-all-forms form 1))
+                         (macroexp--all-forms args)))))
+      (`(,func . ,_)
+       ;; Macro expand compiler macros.  This cannot be delayed to
+       ;; byte-optimize-form because the output of the compiler-macro can
+       ;; use macros.
+       (let ((handler nil))
+         (while (and (symbolp func)
+                     (not (setq handler (get func 'compiler-macro)))
+                     (fboundp func))
+           ;; Follow the sequence of aliases.
+           (setq func (symbol-function func)))
+         (if (null handler)
+             ;; No compiler macro.  We just expand each argument (for
+             ;; setq/setq-default this works alright because the variable names
+             ;; are symbols).
+             (macroexp--all-forms form 1)
+           ;; If the handler is not loaded yet, try (auto)loading the
+           ;; function itself, which may in turn load the handler.
+           (when (and (not (functionp handler))
+                      (fboundp func) (eq (car-safe (symbol-function func))
+                                         'autoload))
+             (ignore-errors
+               (load (nth 1 (symbol-function func))
+                     'noerror 'nomsg)))
+           (let ((newform (macroexp--compiler-macro handler form)))
+             (if (eq form newform)
+                 ;; The compiler macro did not find anything to do.
+                 (if (equal form (setq newform (macroexp--all-forms form 1)))
+                     form
+                   ;; Maybe after processing the args, some new opportunities
+                   ;; appeared, so let's try the compiler macro again.
+                   (setq form (macroexp--compiler-macro handler newform))
+                   (if (eq newform form)
+                       newform
+                     (macroexp--expand-all newform)))
+               (macroexp--expand-all newform))))))
+
       (t form))))
 
 ;;;###autoload
@@ -219,7 +226,110 @@ If no macros are expanded, FORM is returned unchanged.
 The second optional arg ENVIRONMENT specifies an environment of macro
 definitions to shadow the loaded ones for use in file byte-compilation."
   (let ((macroexpand-all-environment environment))
-    (macroexpand-all-1 form)))
+    (macroexp--expand-all form)))
+
+;;; Handy functions to use in macros.
+
+(defun macroexp-progn (exps)
+  "Return an expression equivalent to `(progn ,@EXPS)."
+  (if (cdr exps) `(progn ,@exps) (car exps)))
+
+(defun macroexp-unprogn (exp)
+  "Turn EXP into a list of expressions to execute in sequence."
+  (if (eq (car-safe exp) 'progn) (cdr exp) (list exp)))
+
+(defun macroexp-let* (bindings exp)
+  "Return an expression equivalent to `(let* ,bindings ,exp)."
+  (cond
+   ((null bindings) exp)
+   ((eq 'let* (car-safe exp)) `(let* (,@bindings ,@(cadr exp)) ,@(cddr exp)))
+   (t `(let* ,bindings ,exp))))
+
+(defun macroexp-if (test then else)
+  "Return an expression equivalent to `(if ,test ,then ,else)."
+  (cond
+   ((eq (car-safe else) 'if)
+    (if (equal test (nth 1 else))
+        ;; Doing a test a second time: get rid of the redundancy.
+        `(if ,test ,then ,@(nthcdr 3 else))
+      `(cond (,test ,then)
+             (,(nth 1 else) ,(nth 2 else))
+             (t ,@(nthcdr 3 else)))))
+   ((eq (car-safe else) 'cond)
+    `(cond (,test ,then)
+           ;; Doing a test a second time: get rid of the redundancy, as above.
+           ,@(remove (assoc test else) (cdr else))))
+   ;; Invert the test if that lets us reduce the depth of the tree.
+   ((memq (car-safe then) '(if cond)) (macroexp-if `(not ,test) else then))
+   (t `(if ,test ,then ,else))))
+
+(defmacro macroexp-let2 (test var exp &rest exps)
+  "Bind VAR to a copyable expression that returns the value of EXP.
+This is like `(let ((v ,EXP)) ,EXPS) except that `v' is a new generated
+symbol which EXPS can find in VAR.
+TEST should be the name of a predicate on EXP checking whether the `let' can
+be skipped; if nil, as is usual, `macroexp-const-p' is used."
+  (declare (indent 3) (debug (sexp sexp form body)))
+  (let ((bodysym (make-symbol "body"))
+        (expsym (make-symbol "exp")))
+    `(let* ((,expsym ,exp)
+            (,var (if (funcall #',(or test #'macroexp-const-p) ,expsym)
+                      ,expsym (make-symbol ,(symbol-name var))))
+            (,bodysym ,(macroexp-progn exps)))
+       (if (eq ,var ,expsym) ,bodysym
+         (macroexp-let* (list (list ,var ,expsym))
+                        ,bodysym)))))
+
+(defun macroexp--maxsize (exp size)
+  (cond ((< size 0) size)
+        ((symbolp exp) (1- size))
+        ((stringp exp) (- size (/ (length exp) 16)))
+        ((vectorp exp)
+         (dotimes (i (length exp))
+           (setq size (macroexp--maxsize (aref exp i) size)))
+         (1- size))
+        ((consp exp)
+         ;; We could try to be more clever with quote&function,
+         ;; but it is difficult to do so correctly, and it's not obvious that
+         ;; it would be worth the effort.
+         (dolist (e exp)
+           (setq size (macroexp--maxsize e size)))
+         (1- size))
+        (t -1)))
+
+(defun macroexp-small-p (exp)
+  "Return non-nil if EXP can be considered small."
+  (> (macroexp--maxsize exp 10) 0))
+
+(defsubst macroexp--const-symbol-p (symbol &optional any-value)
+  "Non-nil if SYMBOL is constant.
+If ANY-VALUE is nil, only return non-nil if the value of the symbol is the
+symbol itself."
+  (or (memq symbol '(nil t))
+      (keywordp symbol)
+      (if any-value
+         (or (memq symbol byte-compile-const-variables)
+             ;; FIXME: We should provide a less intrusive way to find out
+             ;; if a variable is "constant".
+             (and (boundp symbol)
+                  (condition-case nil
+                      (progn (set symbol (symbol-value symbol)) nil)
+                    (setting-constant t)))))))
+
+(defun macroexp-const-p (exp)
+  "Return non-nil if EXP will always evaluate to the same value."
+  (cond ((consp exp) (or (eq (car exp) 'quote)
+                         (and (eq (car exp) 'function)
+                              (symbolp (cadr exp)))))
+        ;; It would sometimes make sense to pass `any-value', but it's not
+        ;; always safe since a "constant" variable may not actually always have
+        ;; the same value.
+        ((symbolp exp) (macroexp--const-symbol-p exp))
+        (t t)))
+
+(defun macroexp-copyable-p (exp)
+  "Return non-nil if EXP can be copied without extra cost."
+  (or (symbolp exp) (macroexp-const-p exp)))
 
 (provide 'macroexp)
 
index 4ed8aacf0b6b616c829a1d17467dbcfeed0d05bd..b01cdbc7b8ed93b407fa3b566b13c71f9fdd7741 100644 (file)
@@ -527,7 +527,7 @@ Required package `%s-%s' is unavailable"
 
 (defun define-package (name-string version-string
                                &optional docstring requirements
-                               &rest extra-properties)
+                               &rest _extra-properties)
   "Define a new package.
 NAME-STRING is the name of the package, as a string.
 VERSION-STRING is the version of the package, as a string.
@@ -587,7 +587,7 @@ EXTRA-PROPERTIES is currently unused."
 (defun package-generate-autoloads (name pkg-dir)
   (require 'autoload)         ;Load before we let-bind generated-autoload-file!
   (let* ((auto-name (concat name "-autoloads.el"))
-        (ignore-name (concat name "-pkg.el"))
+        ;;(ignore-name (concat name "-pkg.el"))
         (generated-autoload-file (expand-file-name auto-name pkg-dir))
         (version-control 'never))
     (unless (fboundp 'autoload-ensure-default-file)
@@ -1362,6 +1362,9 @@ If optional arg NO-ACTIVATE is non-nil, don't activate packages."
     map)
   "Local keymap for `package-menu-mode' buffers.")
 
+(defvar package-menu--new-package-list nil
+  "List of newly-available packages since `list-packages' was last called.")
+
 (define-derived-mode package-menu-mode tabulated-list-mode "Package Menu"
   "Major mode for browsing a list of packages.
 Letters do not insert themselves; instead, they are commands.
@@ -1392,7 +1395,7 @@ If REMEMBER-POS is non-nil, keep point on the same entry.
 PACKAGES should be t, which means to display all known packages,
 or a list of package names (symbols) to display."
   ;; Construct list of ((PACKAGE . VERSION) STATUS DESCRIPTION).
-  (let (info-list name builtin)
+  (let (info-list name)
     ;; Installed packages:
     (dolist (elt package-alist)
       (setq name (car elt))
@@ -1415,9 +1418,10 @@ or a list of package names (symbols) to display."
       (when (or (eq packages t) (memq name packages))
        (let ((hold (assq name package-load-list)))
          (package--push name (cdr elt)
-                        (if (and hold (null (cadr hold)))
-                            "disabled"
-                          "available")
+                        (cond
+                         ((and hold (null (cadr hold))) "disabled")
+                         ((memq name package-menu--new-package-list) "new")
+                         (t "available"))
                         info-list))))
 
     ;; Obsolete packages:
@@ -1442,6 +1446,7 @@ identifier (NAME . VERSION-LIST)."
         (face (cond
                ((string= status "built-in")  'font-lock-builtin-face)
                ((string= status "available") 'default)
+               ((string= status "new") 'bold)
                ((string= status "held")      'font-lock-constant-face)
                ((string= status "disabled")  'font-lock-warning-face)
                ((string= status "installed") 'font-lock-comment-face)
@@ -1477,21 +1482,21 @@ If optional arg BUTTON is non-nil, describe its associated package."
        (describe-package package))))
 
 ;; fixme numeric argument
-(defun package-menu-mark-delete (&optional num)
+(defun package-menu-mark-delete (&optional _num)
   "Mark a package for deletion and move to the next line."
   (interactive "p")
   (if (member (package-menu-get-status) '("installed" "obsolete"))
       (tabulated-list-put-tag "D" t)
     (forward-line)))
 
-(defun package-menu-mark-install (&optional num)
+(defun package-menu-mark-install (&optional _num)
   "Mark a package for installation and move to the next line."
   (interactive "p")
-  (if (string-equal (package-menu-get-status) "available")
+  (if (member (package-menu-get-status) '("available" "new"))
       (tabulated-list-put-tag "I" t)
     (forward-line)))
 
-(defun package-menu-mark-unmark (&optional num)
+(defun package-menu-mark-unmark (&optional _num)
   "Clear any marks on a package and move to the next line."
   (interactive "p")
   (tabulated-list-put-tag " " t))
@@ -1533,11 +1538,10 @@ If optional arg BUTTON is non-nil, describe its associated package."
     (dolist (entry tabulated-list-entries)
       ;; ENTRY is ((NAME . VERSION) [NAME VERSION STATUS DOC])
       (let ((pkg (car entry))
-           (status (aref (cadr entry) 2))
-           old)
+           (status (aref (cadr entry) 2)))
        (cond ((equal status "installed")
               (push pkg installed))
-             ((equal status "available")
+             ((member status '("available" "new"))
               (push pkg available)))))
     ;; Loop through list of installed packages, finding upgrades
     (dolist (pkg installed)
@@ -1643,16 +1647,18 @@ packages marked for deletion are removed."
        (sB (aref (cadr B) 2)))
     (cond ((string= sA sB)
           (package-menu--name-predicate A B))
-         ((string= sA  "available") t)
+         ((string= sA "new") t)
+         ((string= sB "new") nil)
+         ((string= sA "available") t)
          ((string= sB "available") nil)
-         ((string= sA  "installed") t)
+         ((string= sA "installed") t)
          ((string= sB "installed") nil)
-         ((string= sA  "held") t)
+         ((string= sA "held") t)
          ((string= sB "held") nil)
-         ((string= sA  "built-in") t)
+         ((string= sA "built-in") t)
          ((string= sB "built-in") nil)
-         ((string= sA  "obsolete") t)
-         ((string= sB  "obsolete") nil)
+         ((string= sA "obsolete") t)
+         ((string= sB "obsolete") nil)
          (t (string< sA sB)))))
 
 (defun package-menu--description-predicate (A B)
@@ -1677,22 +1683,36 @@ The list is displayed in a buffer named `*Packages*'."
   ;; Initialize the package system if necessary.
   (unless package--initialized
     (package-initialize t))
-  (unless no-fetch
-    (package-refresh-contents))
-  (let ((buf (get-buffer-create "*Packages*")))
-    (with-current-buffer buf
-      (package-menu-mode)
-      (package-menu--generate nil t))
-    ;; The package menu buffer has keybindings.  If the user types
-    ;; `M-x list-packages', that suggests it should become current.
-    (switch-to-buffer buf))
-  (let ((upgrades (package-menu--find-upgrades)))
-    (if upgrades
-       (message "%d package%s can be upgraded; type `%s' to mark %s for upgrading."
-                (length upgrades)
-                (if (= (length upgrades) 1) "" "s")
-                (substitute-command-keys "\\[package-menu-mark-upgrades]")
-                (if (= (length upgrades) 1) "it" "them")))))
+  (let (old-archives new-packages)
+    (unless no-fetch
+      ;; Read the locally-cached archive-contents.
+      (package-read-all-archive-contents)
+      (setq old-archives package-archive-contents)
+      ;; Fetch the remote list of packages.
+      (package-refresh-contents)
+      ;; Find which packages are new.
+      (dolist (elt package-archive-contents)
+       (unless (assq (car elt) old-archives)
+         (push (car elt) new-packages))))
+
+    ;; Generate the Package Menu.
+    (let ((buf (get-buffer-create "*Packages*")))
+      (with-current-buffer buf
+       (package-menu-mode)
+       (set (make-local-variable 'package-menu--new-package-list)
+            new-packages)
+       (package-menu--generate nil t))
+      ;; The package menu buffer has keybindings.  If the user types
+      ;; `M-x list-packages', that suggests it should become current.
+      (switch-to-buffer buf))
+
+    (let ((upgrades (package-menu--find-upgrades)))
+      (if upgrades
+         (message "%d package%s can be upgraded; type `%s' to mark %s for upgrading."
+                  (length upgrades)
+                  (if (= (length upgrades) 1) "" "s")
+                  (substitute-command-keys "\\[package-menu-mark-upgrades]")
+                  (if (= (length upgrades) 1) "it" "them"))))))
 
 ;;;###autoload
 (defalias 'package-list-packages 'list-packages)
index afbc5df85ce5f4dffd2d110d5a5c0a99aa466642..3f4ce605cb0a0760dc0e4a53d323dac215fd5978 100644 (file)
@@ -1,4 +1,4 @@
-;;; pcase.el --- ML-style pattern-matching macro for Elisp -*- lexical-binding: t -*-
+;;; pcase.el --- ML-style pattern-matching macro for Elisp -*- lexical-binding: t; coding: utf-8 -*-
 
 ;; Copyright (C) 2010-2012  Free Software Foundation, Inc.
 
 ;; - along these lines, provide patterns to match CL structs.
 ;; - provide something like (setq VAR) so a var can be set rather than
 ;;   let-bound.
-;; - provide a way to fallthrough to subsequent cases.
+;; - provide a way to fallthrough to subsequent cases (not sure what I meant by
+;;   this :-()
 ;; - try and be more clever to reduce the size of the decision tree, and
 ;;   to reduce the number of leaves that need to be turned into function:
 ;;   - first, do the tests shared by all remaining branches (it will have
-;;     to be performed anyway, so better so it first so it's shared).
+;;     to be performed anyway, so better do it first so it's shared).
 ;;   - then choose the test that discriminates more (?).
+;; - provide Agda's `with' (along with its `...' companion).
+;; - implement (not UPAT).  This might require a significant redesign.
 ;; - ideally we'd want (pcase s ((re RE1) E1) ((re RE2) E2)) to be able to
 ;;   generate a lex-style DFA to decide whether to run E1 or E2.
 
 ;;; Code:
 
+(require 'macroexp)
+
 ;; Macro-expansion of pcase is reasonably fast, so it's not a problem
 ;; when byte-compiling a file, but when interpreting the code, if the pcase
 ;; is in a loop, the repeated macro-expansion becomes terribly costly, so we
 ;; memoize previous macro expansions to try and avoid recomputing them
 ;; over and over again.
 (defconst pcase--memoize (make-hash-table :weakness 'key :test 'eq))
-
-(defconst pcase--dontcare-upats '(t _ dontcare))
+;; (defconst pcase--memoize-1 (make-hash-table :test 'eq))
+;; (defconst pcase--memoize-2 (make-hash-table :weakness 'key :test 'equal))
+
+(defconst pcase--dontcare-upats '(t _ pcase--dontcare))
+
+(def-edebug-spec
+  pcase-UPAT
+  (&or symbolp
+       ("or" &rest pcase-UPAT)
+       ("and" &rest pcase-UPAT)
+       ("`" pcase-QPAT)
+       ("guard" form)
+       ("let" pcase-UPAT form)
+       ("pred"
+        &or lambda-expr
+        ;; Punt on macros/special forms.
+        (functionp &rest form)
+        sexp)
+       sexp))
+
+(def-edebug-spec
+  pcase-QPAT
+  (&or ("," pcase-UPAT)
+       (pcase-QPAT . pcase-QPAT)
+       sexp))
 
 ;;;###autoload
 (defmacro pcase (exp &rest cases)
@@ -66,6 +94,7 @@ CASES is a list of elements of the form (UPATTERN CODE...).
 
 UPatterns can take the following forms:
   _            matches anything.
+  SELFQUOTING  matches itself.  This includes keywords, numbers, and strings.
   SYMBOL       matches anything and binds it to SYMBOL.
   (or UPAT...) matches if any of the patterns matches.
   (and UPAT...)        matches if all the patterns match.
@@ -91,7 +120,7 @@ PRED patterns can refer to variables bound earlier in the pattern.
 E.g. you can match pairs where the cdr is larger than the car with a pattern
 like `(,a . ,(pred (< a))) or, with more checks:
 `(,(and a (pred numberp)) . ,(and (pred numberp) (pred (< a))))"
-  (declare (indent 1) (debug case))     ;FIXME: edebug `guard' and vars.
+  (declare (indent 1) (debug (form &rest (pcase-UPAT body))))
   ;; We want to use a weak hash table as a cache, but the key will unavoidably
   ;; be based on `exp' and `cases', yet `cases' is a fresh new list each time
   ;; we're called so it'll be immediately GC'd.  So we use (car cases) as key
@@ -102,37 +131,57 @@ like `(,a . ,(pred (< a))) or, with more checks:
     (if (and (equal exp (car data)) (equal cases (cadr data)))
         ;; We have the right expansion.
         (cddr data)
+      ;; (when (gethash (car cases) pcase--memoize-1)
+      ;;   (message "pcase-memoize failed because of weak key!!"))
+      ;; (when (gethash (car cases) pcase--memoize-2)
+      ;;   (message "pcase-memoize failed because of eq test on %S"
+      ;;            (car cases)))
       (when data
         (message "pcase-memoize: equal first branch, yet different"))
       (let ((expansion (pcase--expand exp cases)))
-        (puthash (car cases) (cons exp (cons cases expansion)) pcase--memoize)
+        (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize)
+        ;; (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize-1)
+        ;; (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize-2)
         expansion))))
 
+(defun pcase--let* (bindings body)
+  (cond
+   ((null bindings) (macroexp-progn body))
+   ((pcase--trivial-upat-p (caar bindings))
+    (macroexp-let* `(,(car bindings)) (pcase--let* (cdr bindings) body)))
+   (t
+    (let ((binding (pop bindings)))
+      (pcase--expand
+       (cadr binding)
+       `((,(car binding) ,(pcase--let* bindings body))
+         ;; We can either signal an error here, or just use `pcase--dontcare'
+         ;; which generates more efficient code.  In practice, if we use
+         ;; `pcase--dontcare' we will still often get an error and the few
+         ;; cases where we don't do not matter that much, so
+         ;; it's a better choice.
+         (pcase--dontcare nil)))))))
+
 ;;;###autoload
 (defmacro pcase-let* (bindings &rest body)
   "Like `let*' but where you can use `pcase' patterns for bindings.
 BODY should be an expression, and BINDINGS should be a list of bindings
 of the form (UPAT EXP)."
-  (declare (indent 1) (debug let))
-  (cond
-   ((null bindings) (if (> (length body) 1) `(progn ,@body) (car body)))
-   ((pcase--trivial-upat-p (caar bindings))
-    `(let (,(car bindings)) (pcase-let* ,(cdr bindings) ,@body)))
-   (t
-    `(pcase ,(cadr (car bindings))
-       (,(caar bindings) (pcase-let* ,(cdr bindings) ,@body))
-       ;; We can either signal an error here, or just use `dontcare' which
-       ;; generates more efficient code.  In practice, if we use `dontcare' we
-       ;; will still often get an error and the few cases where we don't do not
-       ;; matter that much, so it's a better choice.
-       (dontcare nil)))))
+  (declare (indent 1)
+           (debug ((&rest (pcase-UPAT &optional form)) body)))
+  (let ((cached (gethash bindings pcase--memoize)))
+    ;; cached = (BODY . EXPANSION)
+    (if (equal (car cached) body)
+        (cdr cached)
+      (let ((expansion (pcase--let* bindings body)))
+        (puthash bindings (cons body expansion) pcase--memoize)
+        expansion))))
 
 ;;;###autoload
 (defmacro pcase-let (bindings &rest body)
   "Like `let' but where you can use `pcase' patterns for bindings.
 BODY should be a list of expressions, and BINDINGS should be a list of bindings
 of the form (UPAT EXP)."
-  (declare (indent 1) (debug let))
+  (declare (indent 1) (debug pcase-let*))
   (if (null (cdr bindings))
       `(pcase-let* ,bindings ,@body)
     (let ((matches '()))
@@ -148,6 +197,7 @@ of the form (UPAT EXP)."
       `(let ,(nreverse bindings) (pcase-let* ,matches ,@body)))))
 
 (defmacro pcase-dolist (spec &rest body)
+  (declare (indent 1) (debug ((pcase-UPAT form) body)))
   (if (pcase--trivial-upat-p (car spec))
       `(dolist ,spec ,@body)
     (let ((tmpvar (make-symbol "x")))
@@ -162,64 +212,78 @@ of the form (UPAT EXP)."
 (defun pcase--expand (exp cases)
   ;; (message "pid=%S (pcase--expand %S ...hash=%S)"
   ;;          (emacs-pid) exp (sxhash cases))
-  (let* ((defs (if (symbolp exp) '()
-                 (let ((sym (make-symbol "x")))
-                   (prog1 `((,sym ,exp)) (setq exp sym)))))
-         (seen '())
-         (codegen
-          (lambda (code vars)
-            (let ((prev (assq code seen)))
-              (if (not prev)
-                  (let ((res (pcase-codegen code vars)))
-                    (push (list code vars res) seen)
-                    res)
-                ;; Since we use a tree-based pattern matching
-                ;; technique, the leaves (the places that contain the
-                ;; code to run once a pattern is matched) can get
-                ;; copied a very large number of times, so to avoid
-                ;; code explosion, we need to keep track of how many
-                ;; times we've used each leaf and move it
-                ;; to a separate function if that number is too high.
-                ;;
-                ;; We've already used this branch.  So it is shared.
-                (let* ((code (car prev))         (cdrprev (cdr prev))
-                       (prevvars (car cdrprev))  (cddrprev (cdr cdrprev))
-                       (res (car cddrprev)))
-                  (unless (symbolp res)
-                    ;; This is the first repeat, so we have to move
-                    ;; the branch to a separate function.
-                    (let ((bsym
-                           (make-symbol (format "pcase-%d" (length defs)))))
-                      (push `(,bsym (lambda ,(mapcar #'car prevvars) ,@code)) defs)
-                      (setcar res 'funcall)
-                      (setcdr res (cons bsym (mapcar #'cdr prevvars)))
-                      (setcar (cddr prev) bsym)
-                      (setq res bsym)))
-                  (setq vars (copy-sequence vars))
-                  (let ((args (mapcar (lambda (pa)
-                                        (let ((v (assq (car pa) vars)))
-                                          (setq vars (delq v vars))
-                                          (cdr v)))
-                                      prevvars)))
-                    (when vars          ;New additional vars.
-                      (error "The vars %s are only bound in some paths"
-                             (mapcar #'car vars)))
-                    `(funcall ,res ,@args)))))))
-         (main
-          (pcase--u
-           (mapcar (lambda (case)
-                     `((match ,exp . ,(car case))
-                       ,(apply-partially
-                         (if (pcase--small-branch-p (cdr case))
-                             ;; Don't bother sharing multiple
-                             ;; occurrences of this leaf since it's small.
-                             #'pcase-codegen codegen)
-                         (cdr case))))
-                   cases))))
-    (if (null defs) main
-      `(let ,defs ,main))))
+  (macroexp-let2 macroexp-copyable-p val exp
+    (let* ((defs ())
+           (seen '())
+           (codegen
+            (lambda (code vars)
+              (let ((prev (assq code seen)))
+                (if (not prev)
+                    (let ((res (pcase-codegen code vars)))
+                      (push (list code vars res) seen)
+                      res)
+                  ;; Since we use a tree-based pattern matching
+                  ;; technique, the leaves (the places that contain the
+                  ;; code to run once a pattern is matched) can get
+                  ;; copied a very large number of times, so to avoid
+                  ;; code explosion, we need to keep track of how many
+                  ;; times we've used each leaf and move it
+                  ;; to a separate function if that number is too high.
+                  ;;
+                  ;; We've already used this branch.  So it is shared.
+                  (let* ((code (car prev))         (cdrprev (cdr prev))
+                         (prevvars (car cdrprev))  (cddrprev (cdr cdrprev))
+                         (res (car cddrprev)))
+                    (unless (symbolp res)
+                      ;; This is the first repeat, so we have to move
+                      ;; the branch to a separate function.
+                      (let ((bsym
+                             (make-symbol (format "pcase-%d" (length defs)))))
+                        (push `(,bsym (lambda ,(mapcar #'car prevvars) ,@code))
+                              defs)
+                        (setcar res 'funcall)
+                        (setcdr res (cons bsym (mapcar #'cdr prevvars)))
+                        (setcar (cddr prev) bsym)
+                        (setq res bsym)))
+                    (setq vars (copy-sequence vars))
+                    (let ((args (mapcar (lambda (pa)
+                                          (let ((v (assq (car pa) vars)))
+                                            (setq vars (delq v vars))
+                                            (cdr v)))
+                                        prevvars)))
+                      ;; If some of `vars' were not found in `prevvars', that's
+                      ;; OK it just means those vars aren't present in all
+                      ;; branches, so they can be used within the pattern
+                      ;; (e.g. by a `guard/let/pred') but not in the branch.
+                      ;; FIXME: But if some of `prevvars' are not in `vars' we
+                      ;; should remove them from `prevvars'!
+                      `(funcall ,res ,@args)))))))
+           (used-cases ())
+           (main
+            (pcase--u
+             (mapcar (lambda (case)
+                       `((match ,val . ,(car case))
+                         ,(lambda (vars)
+                            (unless (memq case used-cases)
+                              ;; Keep track of the cases that are used.
+                              (push case used-cases))
+                            (funcall
+                             (if (pcase--small-branch-p (cdr case))
+                                 ;; Don't bother sharing multiple
+                                 ;; occurrences of this leaf since it's small.
+                                 #'pcase-codegen codegen)
+                             (cdr case)
+                             vars))))
+                     cases))))
+      (dolist (case cases)
+        (unless (or (memq case used-cases) (eq (car case) 'pcase--dontcare))
+          (message "Redundant pcase pattern: %S" (car case))))
+      (macroexp-let* defs main))))
 
 (defun pcase-codegen (code vars)
+  ;; Don't use let*, otherwise macroexp-let* may merge it with some surrounding
+  ;; let* which might prevent the setcar/setcdr in pcase--expand's fancy
+  ;; codegen from later metamorphosing this let into a funcall.
   `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
      ,@code))
 
@@ -237,23 +301,7 @@ of the form (UPAT EXP)."
   (cond
    ((eq else :pcase--dontcare) then)
    ((eq then :pcase--dontcare) (debug) else) ;Can/should this ever happen?
-   ((eq (car-safe else) 'if)
-    (if (equal test (nth 1 else))
-        ;; Doing a test a second time: get rid of the redundancy.
-        ;; FIXME: ideally, this should never happen because the pcase--split-*
-        ;; funs should have eliminated such things, but pcase--split-member
-        ;; is imprecise, so in practice it can happen occasionally.
-        `(if ,test ,then ,@(nthcdr 3 else))
-      `(cond (,test ,then)
-             (,(nth 1 else) ,(nth 2 else))
-             (t ,@(nthcdr 3 else)))))
-   ((eq (car-safe else) 'cond)
-    `(cond (,test ,then)
-           ;; Doing a test a second time: get rid of the redundancy, as above.
-           ,@(remove (assoc test else) (cdr else))))
-   ;; Invert the test if that lets us reduce the depth of the tree.
-   ((memq (car-safe then) '(if cond)) (pcase--if `(not ,test) else then))
-   (t `(if ,test ,then ,else))))
+   (t (macroexp-if test then else))))
 
 (defun pcase--upat (qpattern)
   (cond
@@ -433,26 +481,26 @@ MATCH is the pattern that needs to be matched, of the form:
 (defun pcase--split-pred (upat pat)
   ;; FIXME: For predicates like (pred (> a)), two such predicates may
   ;; actually refer to different variables `a'.
-  (cond
-   ((equal upat pat) (cons :pcase--succeed :pcase--fail))
-   ((and (eq 'pred (car upat))
-         (eq 'pred (car-safe pat))
-         (or (member (cons (cadr upat) (cadr pat))
-                     pcase-mutually-exclusive-predicates)
-             (member (cons (cadr pat) (cadr upat))
-                     pcase-mutually-exclusive-predicates)))
-    (cons :pcase--fail nil))
-   ;; ((and (eq 'pred (car upat))
-   ;;       (eq '\` (car-safe pat))
-   ;;       (symbolp (cadr upat))
-   ;;       (or (symbolp (cadr pat)) (stringp (cadr pat)) (numberp (cadr pat)))
-   ;;       (get (cadr upat) 'side-effect-free)
-   ;;       (progn (message "Trying predicate %S" (cadr upat))
-   ;;              (ignore-errors
-   ;;                (funcall (cadr upat) (cadr pat)))))
-   ;;  (message "Simplify pred %S against %S" upat pat)
-   ;;  (cons nil :pcase--fail))
-   ))
+  (let (test)
+    (cond
+     ((equal upat pat) (cons :pcase--succeed :pcase--fail))
+     ((and (eq 'pred (car upat))
+           (eq 'pred (car-safe pat))
+           (or (member (cons (cadr upat) (cadr pat))
+                       pcase-mutually-exclusive-predicates)
+               (member (cons (cadr pat) (cadr upat))
+                       pcase-mutually-exclusive-predicates)))
+      (cons :pcase--fail nil))
+     ((and (eq 'pred (car upat))
+           (eq '\` (car-safe pat))
+           (symbolp (cadr upat))
+           (or (symbolp (cadr pat)) (stringp (cadr pat)) (numberp (cadr pat)))
+           (get (cadr upat) 'side-effect-free)
+           (ignore-errors
+             (setq test (list (funcall (cadr upat) (cadr pat))))))
+      (if (car test)
+          (cons nil :pcase--fail)
+        (cons :pcase--fail nil))))))
 
 (defun pcase--fgrep (vars sexp)
   "Check which of the symbols VARS appear in SEXP."
@@ -463,6 +511,9 @@ MATCH is the pattern that needs to be matched, of the form:
     (and (memq sexp vars) (not (memq sexp res)) (push sexp res))
     res))
 
+(defun pcase--self-quoting-p (upat)
+  (or (keywordp upat) (numberp upat) (stringp upat)))
+
 ;; It's very tempting to use `pcase' below, tho obviously, it'd create
 ;; bootstrapping problems.
 (defun pcase--u1 (matches code vars rest)
@@ -525,12 +576,12 @@ Otherwise, it defers to REST which is a list of branches of the form
            (upat (cdr cdrpopmatches)))
       (cond
        ((memq upat '(t _)) (pcase--u1 matches code vars rest))
-       ((eq upat 'dontcare) :pcase--dontcare)
+       ((eq upat 'pcase--dontcare) :pcase--dontcare)
        ((memq (car-safe upat) '(guard pred))
         (if (eq (car upat) 'pred) (put sym 'pcase-used t))
         (let* ((splitrest
                 (pcase--split-rest
-                 sym (apply-partially #'pcase--split-pred upat) rest))
+                 sym (lambda (pat) (pcase--split-pred upat pat)) rest))
                (then-rest (car splitrest))
                (else-rest (cdr splitrest)))
           (pcase--if (if (and (eq (car upat) 'pred) (symbolp (cadr upat)))
@@ -548,7 +599,8 @@ Otherwise, it defers to REST which is a list of branches of the form
                                         (let ((newsym (make-symbol "x")))
                                           (push (list newsym sym) env)
                                           (setq sym newsym)))
-                                      (if (functionp exp) `(,exp ,sym)
+                                      (if (functionp exp)
+                                          `(funcall #',exp ,sym)
                                         `(,@exp ,sym)))))
                          (if (null vs)
                              call
@@ -558,6 +610,9 @@ Otherwise, it defers to REST which is a list of branches of the form
                            `(let* ,env ,call))))
                      (pcase--u1 matches code vars then-rest)
                      (pcase--u else-rest))))
+       ((pcase--self-quoting-p upat)
+        (put sym 'pcase-used t)
+        (pcase--q1 sym upat matches code vars rest))
        ((symbolp upat)
         (put sym 'pcase-used t)
         (if (not (assq upat vars))
@@ -570,21 +625,17 @@ Otherwise, it defers to REST which is a list of branches of the form
         ;; A upat of the form (let VAR EXP).
         ;; (pcase--u1 matches code
         ;;            (cons (cons (nth 1 upat) (nth 2 upat)) vars) rest)
-        (let* ((exp
-                (let* ((exp (nth 2 upat))
-                       (found (assq exp vars)))
-                  (if found (cdr found)
-                    (let* ((vs (pcase--fgrep (mapcar #'car vars) exp))
-                           (env (mapcar (lambda (v) (list v (cdr (assq v vars))))
-                                        vs)))
-                      (if env `(let* ,env ,exp) exp)))))
-               (sym (if (symbolp exp) exp (make-symbol "x")))
-               (body
-                (pcase--u1 (cons `(match ,sym . ,(nth 1 upat)) matches)
-                           code vars rest)))
-          (if (eq sym exp)
-              body
-            `(let* ((,sym ,exp)) ,body))))
+        (macroexp-let2
+            macroexp-copyable-p sym
+            (let* ((exp (nth 2 upat))
+                   (found (assq exp vars)))
+              (if found (cdr found)
+                (let* ((vs (pcase--fgrep (mapcar #'car vars) exp))
+                       (env (mapcar (lambda (v) (list v (cdr (assq v vars))))
+                                    vs)))
+                  (if env (macroexp-let* env exp) exp))))
+          (pcase--u1 (cons `(match ,sym . ,(nth 1 upat)) matches)
+                     code vars rest)))
        ((eq (car-safe upat) '\`)
         (put sym 'pcase-used t)
         (pcase--q1 sym (cadr upat) matches code vars rest))
@@ -593,19 +644,22 @@ Otherwise, it defers to REST which is a list of branches of the form
               (memq-fine t))
           (when all
             (dolist (alt (cdr upat))
-              (unless (and (eq (car-safe alt) '\`)
-                           (or (symbolp (cadr alt)) (integerp (cadr alt))
-                               (setq memq-fine nil)
-                               (stringp (cadr alt))))
+              (unless (or (pcase--self-quoting-p alt)
+                          (and (eq (car-safe alt) '\`)
+                               (or (symbolp (cadr alt)) (integerp (cadr alt))
+                                   (setq memq-fine nil)
+                                   (stringp (cadr alt)))))
                 (setq all nil))))
           (if all
               ;; Use memq for (or `a `b `c `d) rather than a big tree.
-              (let* ((elems (mapcar 'cadr (cdr upat)))
+              (let* ((elems (mapcar (lambda (x) (if (consp x) (cadr x) x))
+                                    (cdr upat)))
                      (splitrest
                       (pcase--split-rest
-                       sym (apply-partially #'pcase--split-member elems) rest))
+                       sym (lambda (pat) (pcase--split-member elems pat)) rest))
                      (then-rest (car splitrest))
                      (else-rest (cdr splitrest)))
+                (put sym 'pcase-used t)
                 (pcase--if `(,(if memq-fine #'memq #'member) ,sym ',elems)
                            (pcase--u1 matches code vars then-rest)
                            (pcase--u else-rest)))
@@ -659,7 +713,7 @@ Otherwise, it defers to REST which is a list of branches of the form
            (symd (make-symbol "xcdr"))
            (splitrest (pcase--split-rest
                        sym
-                       (apply-partially #'pcase--split-consp syma symd)
+                       (lambda (pat) (pcase--split-consp syma symd pat))
                        rest))
            (then-rest (car splitrest))
            (else-rest (cdr splitrest))
@@ -673,16 +727,22 @@ Otherwise, it defers to REST which is a list of branches of the form
        ;; The byte-compiler could do that for us, but it would have to pay
        ;; attention to the `consp' test in order to figure out that car/cdr
        ;; can't signal errors and our byte-compiler is not that clever.
-       `(let (,@(if (get syma 'pcase-used) `((,syma (car ,sym))))
+       ;; FIXME: Some of those let bindings occur too early (they are used in
+       ;; `then-body', but only within some sub-branch).
+       (macroexp-let*
+        `(,@(if (get syma 'pcase-used) `((,syma (car ,sym))))
               ,@(if (get symd 'pcase-used) `((,symd (cdr ,sym)))))
-          ,then-body)
+        then-body)
        (pcase--u else-rest))))
    ((or (integerp qpat) (symbolp qpat) (stringp qpat))
       (let* ((splitrest (pcase--split-rest
-                         sym (apply-partially 'pcase--split-equal qpat) rest))
+                         sym (lambda (pat) (pcase--split-equal qpat pat)) rest))
              (then-rest (car splitrest))
              (else-rest (cdr splitrest)))
-      (pcase--if `(,(if (stringp qpat) #'equal #'eq) ,sym ',qpat)
+      (pcase--if (cond
+                  ((stringp qpat) `(equal ,sym ,qpat))
+                  ((null qpat) `(null ,sym))
+                  (t `(eq ,sym ',qpat)))
                  (pcase--u1 matches code vars then-rest)
                  (pcase--u else-rest))))
    (t (error "Unknown QPattern %s" qpat))))
index c8733202f31d91c5c99c1164d5861f089c65f1f9..05bb7577d22384d32095ffa8faa4a6067c4d5162 100644 (file)
@@ -38,7 +38,7 @@
 ;; the target buffer are marked automatically with colored overlays
 ;; (for non-color displays see below) giving you feedback over the
 ;; extents of the matched (sub) expressions.  The (non-)validity is
-;; shown only in the modeline without throwing the errors at you.  If
+;; shown only in the mode line without throwing the errors at you.  If
 ;; you want to know the reason why RE Builder considers it as invalid
 ;; call `reb-force-update' ("\C-c\C-u") which should reveal the error.
 
index 6d12fe19277d2954a4fbed3de12cb6145ba0d78d..72e3c398dc01bdcffd22e11aa6f0c95eab1621d2 100644 (file)
@@ -136,9 +136,6 @@ This means the number of non-shy regexp grouping constructs
 \f
 ;;; Workhorse functions.
 
-(eval-when-compile
-  (require 'cl))
-
 (defun regexp-opt-group (strings &optional paren lax)
   "Return a regexp to match a string in the sorted list STRINGS.
 If PAREN non-nil, output regexp parentheses around returned regexp.
@@ -248,15 +245,15 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
     ;;
     ;; Make a character map but extract character set meta characters.
     (dolist (char chars)
-      (case char
-       (?\]
-        (setq bracket "]"))
-       (?^
-        (setq caret "^"))
-       (?-
-        (setq dash "-"))
-       (otherwise
-        (aset charmap char t))))
+      (cond
+       ((eq char ?\])
+       (setq bracket "]"))
+       ((eq char ?^)
+       (setq caret "^"))
+       ((eq char ?-)
+       (setq dash "-"))
+       (t
+       (aset charmap char t))))
     ;;
     ;; Make a character set from the map using ranges where applicable.
     (map-char-table
@@ -268,14 +265,14 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
                   (setq charset (format "%s%c-%c" charset start end))
                 (while (>= end start)
                   (setq charset (format "%s%c" charset start))
-                  (incf start)))
+                  (setq start (1+ start))))
               (setq start (car c) end (cdr c)))
           (if (= (1- c) end) (setq end c)
             (if (> end (+ start 2))
               (setq charset (format "%s%c-%c" charset start end))
             (while (>= end start)
               (setq charset (format "%s%c" charset start))
-              (incf start)))
+              (setq start (1+ start))))
             (setq start c end c)))))
      charmap)
     (when (>= end start)
@@ -283,7 +280,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
          (setq charset (format "%s%c-%c" charset start end))
        (while (>= end start)
          (setq charset (format "%s%c" charset start))
-         (incf start))))
+         (setq start (1+ start)))))
     ;;
     ;; Make sure a caret is not first and a dash is first or last.
     (if (and (string-equal charset "") (string-equal bracket ""))
index 2a12f03e5145562dad5eb413bd00ac4f9d01c120..9fa8a108236438275c4639f3f74922bdefc7c695 100644 (file)
 ;; - smie-indent-comment doesn't interact well with mis-indented lines (where
 ;;   the indent rules don't do what the user wants).  Not sure what to do.
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup smie nil
   "Simple Minded Indentation Engine."
 (defvar smie-warning-count 0)
 
 (defun smie-set-prec2tab (table x y val &optional override)
-  (assert (and x y))
+  (cl-assert (and x y))
   (let* ((key (cons x y))
          (old (gethash key table)))
     (if (and old (not (eq old val)))
             ;; don't hide real conflicts.
             (puthash key (gethash key override) table)
           (display-warning 'smie (format "Conflict: %s %s/%s %s" x old val y))
-          (incf smie-warning-count))
+          (cl-incf smie-warning-count))
       (puthash key val table))))
 
 (put 'smie-precs->prec2 'pure t)
@@ -268,8 +268,8 @@ be either:
           (unless (consp rhs)
             (signal 'wrong-type-argument `(consp ,rhs)))
           (if (not (member (car rhs) nts))
-              (pushnew (car rhs) first-ops)
-            (pushnew (car rhs) first-nts)
+              (cl-pushnew (car rhs) first-ops)
+            (cl-pushnew (car rhs) first-nts)
             (when (consp (cdr rhs))
               ;; If the first is not an OP we add the second (which
               ;; should be an OP if BNF is an "operator grammar").
@@ -282,16 +282,16 @@ be either:
               (when (member (cadr rhs) nts)
                 (error "Adjacent non-terminals: %s %s"
                        (car rhs) (cadr rhs)))
-              (pushnew (cadr rhs) first-ops)))
+              (cl-pushnew (cadr rhs) first-ops)))
           (let ((shr (reverse rhs)))
             (if (not (member (car shr) nts))
-                (pushnew (car shr) last-ops)
-              (pushnew (car shr) last-nts)
+                (cl-pushnew (car shr) last-ops)
+              (cl-pushnew (car shr) last-nts)
               (when (consp (cdr shr))
                 (when (member (cadr shr) nts)
                   (error "Adjacent non-terminals: %s %s"
                          (cadr shr) (car shr)))
-                (pushnew (cadr shr) last-ops)))))
+                (cl-pushnew (cadr shr) last-ops)))))
         (push (cons nt first-ops) first-ops-table)
         (push (cons nt last-ops) last-ops-table)
         (push (cons nt first-nts) first-nts-table)
@@ -416,12 +416,12 @@ from the table, e.g. the table will not include things like (\"if\" . \"else\").
           (if no-inners
               (let ((last (car (last rhs))))
                 (unless (member last nts)
-                  (pushnew (cons (car rhs) last) alist :test #'equal)))
+                  (cl-pushnew (cons (car rhs) last) alist :test #'equal)))
             ;; Reverse so that the "real" closer gets there first,
             ;; which is important for smie-close-block.
             (dolist (term (reverse (cdr rhs)))
               (unless (member term nts)
-                (pushnew (cons (car rhs) term) alist :test #'equal)))))))
+                (cl-pushnew (cons (car rhs) term) alist :test #'equal)))))))
     (nreverse alist)))
 
 (defun smie-bnf--set-class (table token class)
@@ -483,7 +483,7 @@ CSTS is a list of pairs representing arcs in a graph."
                            (push (concat "." (car elem)) res))
                        (if (eq (cddr elem) val)
                            (push (concat (car elem) ".") res)))
-                     (assert res)
+                     (cl-assert res)
                      res))
                  cycle)))
     (mapconcat
@@ -498,9 +498,9 @@ CSTS is a list of pairs representing arcs in a graph."
 ;;                      (right (nth 1 (assoc (cdr k) grammar))))
 ;;                  (when (and left right)
 ;;                    (cond
-;;                     ((< left right) (assert (eq v '<)))
-;;                     ((> left right) (assert (eq v '>)))
-;;                     (t (assert (eq v '=))))))))
+;;                     ((< left right) (cl-assert (eq v '<)))
+;;                     ((> left right) (cl-assert (eq v '>)))
+;;                     (t (cl-assert (eq v '=))))))))
 ;;            prec2))
 
 (put 'smie-prec2->grammar 'pure t)
@@ -514,25 +514,28 @@ PREC2 is a table as returned by `smie-precs->prec2' or
   ;; final `table'.  The value of each "variable" is kept in the `car'.
   (let ((table ())
         (csts ())
-        (eqs ())
-        tmp x y)
+        (eqs ()))
     ;; From `prec2' we construct a list of constraints between
     ;; variables (aka "precedence levels").  These can be either
     ;; equality constraints (in `eqs') or `<' constraints (in `csts').
     (maphash (lambda (k v)
                (when (consp k)
-                 (if (setq tmp (assoc (car k) table))
-                     (setq x (cddr tmp))
-                   (setq x (cons nil nil))
-                   (push (cons (car k) (cons nil x)) table))
-                 (if (setq tmp (assoc (cdr k) table))
-                     (setq y (cdr tmp))
-                   (setq y (cons nil (cons nil nil)))
-                   (push (cons (cdr k) y) table))
-                 (ecase v
-                   (= (push (cons x y) eqs))
-                   (< (push (cons x y) csts))
-                   (> (push (cons y x) csts)))))
+                 (let ((tmp (assoc (car k) table))
+                       x y)
+                   (if tmp
+                       (setq x (cddr tmp))
+                     (setq x (cons nil nil))
+                     (push (cons (car k) (cons nil x)) table))
+                   (if (setq tmp (assoc (cdr k) table))
+                       (setq y (cdr tmp))
+                     (setq y (cons nil (cons nil nil)))
+                     (push (cons (cdr k) y) table))
+                   (pcase v
+                     (`= (push (cons x y) eqs))
+                     (`< (push (cons x y) csts))
+                     (`> (push (cons y x) csts))
+                     (_ (error "SMIE error: prec2 has %S↦%S which ∉ {<,+,>}"
+                               k v))))))
              prec2)
     ;; First process the equality constraints.
     (let ((eqs eqs))
@@ -572,13 +575,13 @@ PREC2 is a table as returned by `smie-precs->prec2' or
               (unless (caar cst)
                 (setcar (car cst) i)
                 ;; (smie-check-grammar table prec2 'step1)
-                (incf i))
+                (cl-incf i))
               (setq csts (delq cst csts))))
           (unless progress
             (error "Can't resolve the precedence cycle: %s"
                    (smie-debug--describe-cycle
                     table (smie-debug--prec2-cycle csts)))))
-        (incf i 10))
+        (cl-incf i 10))
       ;; Propagate equality constraints back to their sources.
       (dolist (eq (nreverse eqs))
         (when (null (cadr eq))
@@ -589,8 +592,8 @@ PREC2 is a table as returned by `smie-precs->prec2' or
           ;; So set it here rather than below since doing it below
           ;; makes it more difficult to obey the equality constraints.
           (setcar (cdr eq) i)
-          (incf i))
-        (assert (or (null (caar eq)) (eq (caar eq) (cadr eq))))
+          (cl-incf i))
+        (cl-assert (or (null (caar eq)) (eq (caar eq) (cadr eq))))
         (setcar (car eq) (cadr eq))
         ;; (smie-check-grammar table prec2 'step2)
         )
@@ -599,17 +602,17 @@ PREC2 is a table as returned by `smie-precs->prec2' or
       (dolist (x table)
         (unless (nth 1 x)
           (setf (nth 1 x) i)
-          (incf i))                     ;See other (incf i) above.
+          (cl-incf i))                  ;See other (cl-incf i) above.
         (unless (nth 2 x)
           (setf (nth 2 x) i)
-          (incf i))))                   ;See other (incf i) above.
+          (cl-incf i))))                ;See other (cl-incf i) above.
     ;; Mark closers and openers.
     (dolist (x (gethash :smie-open/close-alist prec2))
       (let* ((token (car x))
-             (cons (case (cdr x)
-                     (closer (cddr (assoc token table)))
-                     (opener (cdr (assoc token table))))))
-        (assert (numberp (car cons)))
+             (cons (pcase (cdr x)
+                     (`closer (cddr (assoc token table)))
+                     (`opener (cdr (assoc token table))))))
+        (cl-assert (numberp (car cons)))
         (setf (car cons) (list (car cons)))))
     (let ((ca (gethash :smie-closer-alist prec2)))
       (when ca (push (cons :smie-closer-alist ca) table)))
@@ -688,6 +691,7 @@ Possible return values:
     is too high.  FORW-LEVEL is the forw-level of TOKEN,
     POS is its start position in the buffer.
   (t POS TOKEN): same thing when we bump on the wrong side of a paren.
+    Instead of t, the `car' can also be some other non-nil non-number value.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
   (catch 'return
@@ -704,20 +708,19 @@ Possible return values:
               (when (zerop (length token))
                 (condition-case err
                     (progn (goto-char pos) (funcall next-sexp 1) nil)
-                  (scan-error (throw 'return
-                                     (list t (caddr err)
-                                           (buffer-substring-no-properties
-                                            (caddr err)
-                                            (+ (caddr err)
-                                               (if (< (point) (caddr err))
-                                                   -1 1)))))))
+                  (scan-error
+                   (let ((pos (nth 2 err)))
+                     (throw 'return
+                            (list t pos
+                                  (buffer-substring-no-properties
+                                   pos (+ pos (if (< (point) pos) -1 1))))))))
                 (if (eq pos (point))
                     ;; We did not move, so let's abort the loop.
                     (throw 'return (list t (point))))))
              ((not (numberp (funcall op-back toklevels)))
               ;; A token like a paren-close.
-              (assert (numberp     ; Otherwise, why mention it in smie-grammar.
-                       (funcall op-forw toklevels)))
+              (cl-assert (numberp  ; Otherwise, why mention it in smie-grammar.
+                          (funcall op-forw toklevels)))
               (push toklevels levels))
              (t
               (while (and levels (< (funcall op-back toklevels)
@@ -728,7 +731,8 @@ Possible return values:
                 (if (and halfsexp (numberp (funcall op-forw toklevels)))
                     (push toklevels levels)
                   (throw 'return
-                         (prog1 (list (or (car toklevels) t) (point) token)
+                         (prog1 (list (or (funcall op-forw toklevels) t)
+                                      (point) token)
                            (goto-char pos)))))
                (t
                 (let ((lastlevels levels))
@@ -773,7 +777,8 @@ Possible return values:
                    ((and lastlevels
                          (smie--associative-p (car lastlevels)))
                     (throw 'return
-                           (prog1 (list (or (car toklevels) t) (point) token)
+                           (prog1 (list (or (funcall op-forw toklevels) t)
+                                        (point) token)
                              (goto-char pos))))
                    ;; - it's an associative operator within a larger construct
                    ;;   (e.g. an "elsif"), so we should just ignore it and keep
@@ -793,6 +798,7 @@ Possible return values:
     is too high.  LEFT-LEVEL is the left-level of TOKEN,
     POS is its start position in the buffer.
   (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
+    Instead of t, the `car' can also be some other non-nil non-number value.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
   (smie-next-sexp
@@ -812,7 +818,8 @@ Possible return values:
   (RIGHT-LEVEL POS TOKEN): we couldn't skip TOKEN because its left-level
     is too high.  RIGHT-LEVEL is the right-level of TOKEN,
     POS is its end position in the buffer.
-  (t POS TOKEN): same thing but for an open-paren or the beginning of buffer.
+  (t POS TOKEN): same thing but for a close-paren or the end of buffer.
+    Instead of t, the `car' can also be some other non-nil non-number value.
   (nil POS TOKEN): we skipped over a paren-like pair.
   nil: we skipped over an identifier, matched parentheses, ..."
   (smie-next-sexp
@@ -1074,6 +1081,16 @@ the beginning of a line."
   "Return non-nil if the current token is the first on the line."
   (save-excursion (skip-chars-backward " \t") (bolp)))
 
+(defun smie-indent--bolp-1 ()
+  ;; Like smie-indent--bolp but also returns non-nil if it's the first
+  ;; non-comment token.  Maybe we should simply always use this?
+  "Return non-nil if the current token is the first on the line.
+Comments are treated as spaces."
+  (let ((bol (line-beginning-position)))
+    (save-excursion
+      (forward-comment (- (point)))
+      (<= (point) bol))))
+
 ;; Dynamically scoped.
 (defvar smie--parent) (defvar smie--after) (defvar smie--token)
 
@@ -1350,9 +1367,12 @@ should not be computed on the basis of the following token."
         ;; - middle-of-line: "trust current position".
         (cond
          ((smie-indent--rule :before token))
-         ((smie-indent--bolp)           ;I.e. non-virtual indent.
+         ((smie-indent--bolp-1)         ;I.e. non-virtual indent.
           ;; For an open-paren-like thingy at BOL, always indent only
           ;; based on other rules (typically smie-indent-after-keyword).
+          ;; FIXME: we do the same if after a comment, since we may be trying
+          ;; to compute the indentation of this comment and we shouldn't indent
+          ;; based on the indentation of subsequent code.
           nil)
          (t
           ;; By default use point unless we're hanging.
@@ -1453,6 +1473,12 @@ should not be computed on the basis of the following token."
        (save-excursion
          (forward-comment (point-max))
          (skip-chars-forward " \t\r\n")
+         ;; FIXME: We assume here that smie-indent-calculate will compute the
+         ;; indentation of the next token based on text before the comment, but
+         ;; this is not guaranteed, so maybe we should let
+         ;; smie-indent-calculate return some info about which buffer position
+         ;; was used as the "indentation base" and check that this base is
+         ;; before `pos'.
          (smie-indent-calculate))))
 
 (defun smie-indent-comment-continue ()
@@ -1602,6 +1628,36 @@ to which that point should be aligned, if we were to reindent it.")
           (save-excursion (indent-line-to indent))
         (indent-line-to indent)))))
 
+(defun smie-auto-fill ()
+  (let ((fc (current-fill-column)))
+    (while (and fc (> (current-column) fc))
+      (cond
+       ((not (or (nth 8 (save-excursion
+                          (syntax-ppss (line-beginning-position))))
+                 (nth 8 (syntax-ppss))))
+        (save-excursion
+          (beginning-of-line)
+          (smie-indent-forward-token)
+          (let ((bsf (point))
+                (gain 0)
+                curcol)
+            (while (<= (setq curcol (current-column)) fc)
+              ;; FIXME?  `smie-indent-calculate' can (and often will)
+              ;; return a result that actually depends on the presence/absence
+              ;; of a newline, so the gain computed here may not be accurate,
+              ;; but in practice it seems to works well enough.
+              (let* ((newcol (smie-indent-calculate))
+                     (newgain (- curcol newcol)))
+                (when (> newgain gain)
+                  (setq gain newgain)
+                  (setq bsf (point))))
+              (smie-indent-forward-token))
+            (when (> gain 0)
+              (goto-char bsf)
+              (newline-and-indent)))))
+       (t (do-auto-fill))))))
+
+
 (defun smie-setup (grammar rules-function &rest keywords)
   "Setup SMIE navigation and indentation.
 GRAMMAR is a grammar table generated by `smie-prec2->grammar'.
@@ -1612,17 +1668,18 @@ KEYWORDS are additional arguments, which can use the following keywords:
   (set (make-local-variable 'smie-rules-function) rules-function)
   (set (make-local-variable 'smie-grammar) grammar)
   (set (make-local-variable 'indent-line-function) 'smie-indent-line)
+  (set (make-local-variable 'normal-auto-fill-function) 'smie-auto-fill)
   (set (make-local-variable 'forward-sexp-function)
        'smie-forward-sexp-command)
   (while keywords
     (let ((k (pop keywords))
           (v (pop keywords)))
-      (case k
-        (:forward-token
+      (pcase k
+        (`:forward-token
          (set (make-local-variable 'smie-forward-token-function) v))
-        (:backward-token
+        (`:backward-token
          (set (make-local-variable 'smie-backward-token-function) v))
-        (t (message "smie-setup: ignoring unknown keyword %s" k)))))
+        (_ (message "smie-setup: ignoring unknown keyword %s" k)))))
   (let ((ca (cdr (assq :smie-closer-alist grammar))))
     (when ca
       (set (make-local-variable 'smie-closer-alist) ca)
index 611a766922abc07f9c16ae5449a28eeb945e85dc..c3d78b3444bbda6b10118785474fce275e93fc3a 100644 (file)
@@ -1,4 +1,4 @@
-;;; syntax.el --- helper functions to find syntactic context
+;;; syntax.el --- helper functions to find syntactic context  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
@@ -41,7 +41,7 @@
 
 ;; Note: PPSS stands for `parse-partial-sexp state'
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defvar font-lock-beginning-of-syntax-function)
 
@@ -181,7 +181,7 @@ Note: back-references in REGEXPs do not work."
                  ;; If there's more than 1 rule, and the rule want to apply
                  ;; highlight to match 0, create an extra group to be able to
                  ;; tell when *this* match 0 has succeeded.
-                 (incf offset)
+                 (cl-incf offset)
                  (setq re (concat "\\(" re "\\)")))
                (setq re (syntax-propertize--shift-groups re offset))
                (let ((code '())
@@ -215,7 +215,7 @@ Note: back-references in REGEXPs do not work."
                      (setq offset 0)))
                  ;; Now construct the code for each subgroup rules.
                  (dolist (case (cdr rule))
-                   (assert (null (cddr case)))
+                   (cl-assert (null (cddr case)))
                    (let* ((gn (+ offset (car case)))
                           (action (nth 1 case))
                           (thiscode
@@ -260,7 +260,7 @@ Note: back-references in REGEXPs do not work."
                              code))))
                  (push (cons condition (nreverse code))
                        branches))
-               (incf offset (regexp-opt-depth orig-re))
+               (cl-incf offset (regexp-opt-depth orig-re))
                re))
            rules
            "\\|")))
@@ -274,13 +274,12 @@ Note: back-references in REGEXPs do not work."
   "Propertize for syntax in START..END using font-lock syntax.
 KEYWORDS obeys the format used in `font-lock-syntactic-keywords'.
 The return value is a function suitable for `syntax-propertize-function'."
-  (lexical-let ((keywords keywords))
-    (lambda (start end)
-      (with-no-warnings
-        (let ((font-lock-syntactic-keywords keywords))
-          (font-lock-fontify-syntactic-keywords-region start end)
-          ;; In case it was eval'd/compiled.
-          (setq keywords font-lock-syntactic-keywords))))))
+  (lambda (start end)
+    (with-no-warnings
+      (let ((font-lock-syntactic-keywords keywords))
+        (font-lock-fontify-syntactic-keywords-region start end)
+        ;; In case it was eval'd/compiled.
+        (setq keywords font-lock-syntactic-keywords)))))
 
 (defun syntax-propertize (pos)
   "Ensure that syntax-table properties are set until POS."
@@ -419,8 +418,8 @@ Point is at POS when this function returns."
                            (* 2 (/ (cdr (aref syntax-ppss-stats 5))
                                    (1+ (car (aref syntax-ppss-stats 5)))))))
            (progn
-             (incf (car (aref syntax-ppss-stats 0)))
-             (incf (cdr (aref syntax-ppss-stats 0)) (- pos old-pos))
+             (cl-incf (car (aref syntax-ppss-stats 0)))
+             (cl-incf (cdr (aref syntax-ppss-stats 0)) (- pos old-pos))
              (parse-partial-sexp old-pos pos nil nil old-ppss))
 
          (cond
@@ -436,8 +435,8 @@ Point is at POS when this function returns."
                 (setq pt-min (or (syntax-ppss-toplevel-pos old-ppss)
                                  (nth 2 old-ppss)))
                 (<= pt-min pos) (< (- pos pt-min) syntax-ppss-max-span))
-           (incf (car (aref syntax-ppss-stats 1)))
-           (incf (cdr (aref syntax-ppss-stats 1)) (- pos pt-min))
+           (cl-incf (car (aref syntax-ppss-stats 1)))
+           (cl-incf (cdr (aref syntax-ppss-stats 1)) (- pos pt-min))
            (setq ppss (parse-partial-sexp pt-min pos)))
           ;; The OLD-* data can't be used.  Consult the cache.
           (t
@@ -465,8 +464,8 @@ Point is at POS when this function returns."
              ;; Use the best of OLD-POS and CACHE.
              (if (or (not old-pos) (< old-pos pt-min))
                  (setq pt-best pt-min ppss-best ppss)
-               (incf (car (aref syntax-ppss-stats 4)))
-               (incf (cdr (aref syntax-ppss-stats 4)) (- pos old-pos))
+               (cl-incf (car (aref syntax-ppss-stats 4)))
+               (cl-incf (cdr (aref syntax-ppss-stats 4)) (- pos old-pos))
                (setq pt-best old-pos ppss-best old-ppss))
 
              ;; Use the `syntax-begin-function' if available.
@@ -491,31 +490,29 @@ Point is at POS when this function returns."
                         (not (memq (get-text-property (point) 'face)
                                    '(font-lock-string-face font-lock-doc-face
                                      font-lock-comment-face))))
-               (incf (car (aref syntax-ppss-stats 5)))
-               (incf (cdr (aref syntax-ppss-stats 5)) (- pos (point)))
+               (cl-incf (car (aref syntax-ppss-stats 5)))
+               (cl-incf (cdr (aref syntax-ppss-stats 5)) (- pos (point)))
                (setq pt-best (point) ppss-best nil))
 
              (cond
               ;; Quick case when we found a nearby pos.
               ((< (- pos pt-best) syntax-ppss-max-span)
-               (incf (car (aref syntax-ppss-stats 2)))
-               (incf (cdr (aref syntax-ppss-stats 2)) (- pos pt-best))
+               (cl-incf (car (aref syntax-ppss-stats 2)))
+               (cl-incf (cdr (aref syntax-ppss-stats 2)) (- pos pt-best))
                (setq ppss (parse-partial-sexp pt-best pos nil nil ppss-best)))
               ;; Slow case: compute the state from some known position and
               ;; populate the cache so we won't need to do it again soon.
               (t
-               (incf (car (aref syntax-ppss-stats 3)))
-               (incf (cdr (aref syntax-ppss-stats 3)) (- pos pt-min))
+               (cl-incf (car (aref syntax-ppss-stats 3)))
+               (cl-incf (cdr (aref syntax-ppss-stats 3)) (- pos pt-min))
 
                ;; If `pt-min' is too far, add a few intermediate entries.
                (while (> (- pos pt-min) (* 2 syntax-ppss-max-span))
                  (setq ppss (parse-partial-sexp
                              pt-min (setq pt-min (/ (+ pt-min pos) 2))
                              nil nil ppss))
-                 (let ((pair (cons pt-min ppss)))
-                   (if cache-pred
-                       (push pair (cdr cache-pred))
-                     (push pair syntax-ppss-cache))))
+                  (push (cons pt-min ppss)
+                        (if cache-pred (cdr cache-pred) syntax-ppss-cache)))
 
                ;; Compute the actual return value.
                (setq ppss (parse-partial-sexp pt-min pos nil nil ppss))
index 9439fba2b86fef47a039669812998e49a0bc0080..a56a7619ea959c1e1fc181f46ea27767b1030efb 100644 (file)
 
 ;;; Commentary:
 
-;; This file defines `tabulated-list-mode', a generic major mode for displaying
-;; lists of tabulated data, intended for other major modes to inherit from.  It
-;; provides several utility routines, e.g. for pretty-printing lines of
-;; tabulated data to fit into the appropriate columns.
+;; This file defines Tabulated List mode, a generic major mode for
+;; displaying lists of tabulated data, intended for other major modes
+;; to inherit from.  It provides several utility routines, e.g. for
+;; pretty-printing lines of tabulated data to fit into the appropriate
+;; columns.
 
 ;; For usage information, see the documentation of `tabulated-list-mode'.
 
-;; This package originated from Tom Tromey's Package Menu mode, extended and
-;; generalized to be used by other modes.
+;; This package originated from Tom Tromey's Package Menu mode,
+;; extended and generalized to be used by other modes.
 
 ;;; Code:
 
+;; The reason `tabulated-list-format' and other variables are
+;; permanent-local is to make it convenient to switch to a different
+;; major mode, switch back, and have the original Tabulated List data
+;; still valid.  See, for example, ebuff-menu.el.
+
 (defvar tabulated-list-format nil
   "The format of the current Tabulated List mode buffer.
-This should be a vector of elements (NAME WIDTH SORT), where:
+This should be a vector of elements (NAME WIDTH SORT . PROPS),
+where:
  - NAME is a string describing the column.
+   This is the label for the column in the header line.
+   Different columns must have non-`equal' names.
  - WIDTH is the width to reserve for the column.
    For the final element, its numerical value is ignored.
  - SORT specifies how to sort entries by this column.
@@ -45,8 +54,18 @@ This should be a vector of elements (NAME WIDTH SORT), where:
    If t, sort by comparing the string value printed in the column.
    Otherwise, it should be a predicate function suitable for
    `sort', accepting arguments with the same form as the elements
-   of `tabulated-list-entries'.")
+   of `tabulated-list-entries'.
+ - PROPS is a plist of additional column properties.
+   Currently supported properties are:
+   - `:right-align': if non-nil, the column should be right-aligned.
+   - `:pad-right': Number of additional padding spaces to the
+     right of the column (defaults to 1 if omitted).")
 (make-variable-buffer-local 'tabulated-list-format)
+(put 'tabulated-list-format 'permanent-local t)
+
+(defvar tabulated-list-use-header-line t
+  "Whether the Tabulated List buffer should use a header line.")
+(make-variable-buffer-local 'tabulated-list-use-header-line)
 
 (defvar tabulated-list-entries nil
   "Entries displayed in the current Tabulated List buffer.
@@ -67,12 +86,14 @@ where:
 If `tabulated-list-entries' is a function, it is called with no
 arguments and must return a list of the above form.")
 (make-variable-buffer-local 'tabulated-list-entries)
+(put 'tabulated-list-entries 'permanent-local t)
 
 (defvar tabulated-list-padding 0
   "Number of characters preceding each Tabulated List mode entry.
 By default, lines are padded with spaces, but you can use the
 function `tabulated-list-put-tag' to change this.")
 (make-variable-buffer-local 'tabulated-list-padding)
+(put 'tabulated-list-padding 'permanent-local t)
 
 (defvar tabulated-list-revert-hook nil
   "Hook run before reverting a Tabulated List buffer.
@@ -94,13 +115,20 @@ NAME is a string matching one of the column names in
 `tabulated-list-format' then specifies how to sort).  FLIP, if
 non-nil, means to invert the resulting sort.")
 (make-variable-buffer-local 'tabulated-list-sort-key)
+(put 'tabulated-list-sort-key 'permanent-local t)
 
-(defun tabulated-list-get-id (&optional pos)
-  "Obtain the entry ID of the Tabulated List mode entry at POS.
-This is an ID object from `tabulated-list-entries', or nil.
+(defsubst tabulated-list-get-id (&optional pos)
+  "Return the entry ID of the Tabulated List entry at POS.
+The value is an ID object from `tabulated-list-entries', or nil.
 POS, if omitted or nil, defaults to point."
   (get-text-property (or pos (point)) 'tabulated-list-id))
 
+(defsubst tabulated-list-get-entry (&optional pos)
+  "Return the Tabulated List entry at POS.
+The value is a vector of column descriptors, or nil if there is
+no entry at POS.  POS, if omitted or nil, defaults to point."
+  (get-text-property (or pos (point)) 'tabulated-list-entry))
+
 (defun tabulated-list-put-tag (tag &optional advance)
   "Put TAG in the padding area of the current line.
 TAG should be a string, with length <= `tabulated-list-padding'.
@@ -111,16 +139,16 @@ If ADVANCE is non-nil, move forward by one line afterwards."
     (error "Unable to tag the current line"))
   (save-excursion
     (beginning-of-line)
-    (when (get-text-property (point) 'tabulated-list-id)
+    (when (tabulated-list-get-entry)
       (let ((beg (point))
            (inhibit-read-only t))
        (forward-char tabulated-list-padding)
        (insert-and-inherit
-        (if (<= (length tag) tabulated-list-padding)
-            (concat tag
-                    (make-string (- tabulated-list-padding (length tag))
-                                 ?\s))
-          (substring tag 0 tabulated-list-padding)))
+        (let ((width (string-width tag)))
+          (if (<= width tabulated-list-padding)
+              (concat tag
+                      (make-string (- tabulated-list-padding width) ?\s))
+            (truncate-string-to-width tag tabulated-list-padding))))
        (delete-region beg (+ beg tabulated-list-padding)))))
   (if advance
       (forward-line)))
@@ -130,6 +158,7 @@ If ADVANCE is non-nil, move forward by one line afterwards."
     (set-keymap-parent map button-buffer-map)
     (define-key map "n" 'next-line)
     (define-key map "p" 'previous-line)
+    (define-key map "S" 'tabulated-list-sort)
     (define-key map [follow-link] 'mouse-face)
     (define-key map [mouse-2] 'mouse-select-window)
     map)
@@ -139,6 +168,9 @@ If ADVANCE is non-nil, move forward by one line afterwards."
   (let ((map (make-sparse-keymap)))
     (define-key map [header-line mouse-1] 'tabulated-list-col-sort)
     (define-key map [header-line mouse-2] 'tabulated-list-col-sort)
+    (define-key map [mouse-1] 'tabulated-list-col-sort)
+    (define-key map [mouse-2] 'tabulated-list-col-sort)
+    (define-key map "\C-m" 'tabulated-list-sort)
     (define-key map [follow-link] 'mouse-face)
     map)
   "Local keymap for `tabulated-list-mode' sort buttons.")
@@ -152,50 +184,79 @@ If ADVANCE is non-nil, move forward by one line afterwards."
     table)
   "The `glyphless-char-display' table in Tabulated List buffers.")
 
+(defvar tabulated-list--header-string nil)
+(defvar tabulated-list--header-overlay nil)
+
 (defun tabulated-list-init-header ()
   "Set up header line for the Tabulated List buffer."
-  (let ((x tabulated-list-padding)
+  ;; FIXME: Should share code with tabulated-list-print-col!
+  (let ((x (max tabulated-list-padding 0))
        (button-props `(help-echo "Click to sort by column"
                        mouse-face highlight
                        keymap ,tabulated-list-sort-button-map))
        (cols nil))
-    (if (> tabulated-list-padding 0)
-       (push (propertize " " 'display `(space :align-to ,x)) cols))
+    (push (propertize " " 'display `(space :align-to ,x)) cols)
     (dotimes (n (length tabulated-list-format))
       (let* ((col (aref tabulated-list-format n))
+            (label (nth 0 col))
             (width (nth 1 col))
-            (label (car col)))
-       (setq x (+ x 1 width))
-       (and (<= tabulated-list-padding 0)
-            (= n 0)
-            (setq label (concat " " label)))
+            (props (nthcdr 3 col))
+            (pad-right (or (plist-get props :pad-right) 1))
+             (right-align (plist-get props :right-align))
+             (next-x (+ x pad-right width)))
        (push
         (cond
          ;; An unsortable column
-         ((not (nth 2 col)) label)
+         ((not (nth 2 col))
+          (propertize label 'tabulated-list-column-name label))
          ;; The selected sort column
          ((equal (car col) (car tabulated-list-sort-key))
           (apply 'propertize
                  (concat label
                          (cond
-                          ((> (+ 2 (length label)) width)
-                           "")
-                          ((cdr tabulated-list-sort-key)
-                           " ▲")
+                          ((> (+ 2 (length label)) width) "")
+                          ((cdr tabulated-list-sort-key) " ▲")
                           (t " ▼")))
                  'face 'bold
-                 'tabulated-list-column-name (car col)
+                 'tabulated-list-column-name label
                  button-props))
          ;; Unselected sortable column.
          (t (apply 'propertize label
-                   'tabulated-list-column-name (car col)
+                   'tabulated-list-column-name label
                    button-props)))
-        cols))
-      (push (propertize " "
-                       'display (list 'space :align-to x)
-                       'face 'fixed-pitch)
-           cols))
-    (setq header-line-format (mapconcat 'identity (nreverse cols) ""))))
+        cols)
+        (when right-align
+          (let ((shift (- width (string-width (car cols)))))
+            (when (> shift 0)
+              (setq cols
+                    (cons (car cols)
+                          (cons (propertize (make-string shift ?\s)
+                                            'display
+                                            `(space :align-to ,(+ x shift)))
+                                (cdr cols))))
+              (setq x (+ x shift)))))
+       (if (> pad-right 0)
+           (push (propertize " "
+                             'display `(space :align-to ,next-x)
+                             'face 'fixed-pitch)
+                 cols))
+        (setq x next-x)))
+    (setq cols (apply 'concat (nreverse cols)))
+    (if tabulated-list-use-header-line
+       (setq header-line-format cols)
+      (setq header-line-format nil)
+      (set (make-local-variable 'tabulated-list--header-string) cols))))
+
+(defun tabulated-list-print-fake-header ()
+  "Insert a fake Tabulated List \"header line\" at the start of the buffer."
+  (goto-char (point-min))
+  (let ((inhibit-read-only t))
+    (insert tabulated-list--header-string "\n")
+    (if tabulated-list--header-overlay
+       (move-overlay tabulated-list--header-overlay (point-min) (point))
+      (set (make-local-variable 'tabulated-list--header-overlay)
+          (make-overlay (point-min) (point))))
+    (overlay-put tabulated-list--header-overlay 'face 'underline)))
 
 (defun tabulated-list-revert (&rest ignored)
   "The `revert-buffer-function' for `tabulated-list-mode'.
@@ -206,6 +267,17 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'."
   (run-hooks 'tabulated-list-revert-hook)
   (tabulated-list-print t))
 
+(defun tabulated-list--column-number (name)
+  (let ((len (length tabulated-list-format))
+       (n 0)
+       found)
+    (while (and (< n len) (null found))
+      (if (equal (car (aref tabulated-list-format n)) name)
+         (setq found n))
+      (setq n (1+ n)))
+    (or found
+       (error "No column named %s" name))))
+
 (defun tabulated-list-print (&optional remember-pos)
   "Populate the current Tabulated List mode buffer.
 This sorts the `tabulated-list-entries' list if sorting is
@@ -223,19 +295,16 @@ to the entry with the same ID element as the current line."
         (setq entry-id (tabulated-list-get-id))
         (setq saved-col (current-column)))
     (erase-buffer)
-    ;; Sort the buffers, if necessary.
-    (when tabulated-list-sort-key
-      (let ((sort-column (car tabulated-list-sort-key))
-           (len (length tabulated-list-format))
-           (n 0)
-           sorter)
-       ;; Which column is to be sorted?
-       (while (and (< n len)
-                   (not (equal (car (aref tabulated-list-format n))
-                               sort-column)))
-         (setq n (1+ n)))
-       (when (< n len)
-         (setq sorter (nth 2 (aref tabulated-list-format n)))
+    (unless tabulated-list-use-header-line
+      (tabulated-list-print-fake-header))
+    ;; Sort the entries, if necessary.
+    (when (and tabulated-list-sort-key
+              (car tabulated-list-sort-key))
+      (let* ((sort-column (car tabulated-list-sort-key))
+            (n (tabulated-list--column-number sort-column))
+            (sorter (nth 2 (aref tabulated-list-format n))))
+       ;; Is the specified column sortable?
+       (when sorter
          (when (eq sorter t)
            (setq sorter ; Default sorter checks column N:
                  (lambda (A B)
@@ -267,53 +336,153 @@ to the entry with the same ID element as the current line."
 This is the default `tabulated-list-printer' function.  ID is a
 Lisp object identifying the entry to print, and COLS is a vector
 of column descriptors."
-  (let ((beg (point))
-       (x (max tabulated-list-padding 0))
-       (len (length tabulated-list-format)))
+  (let ((beg   (point))
+       (x     (max tabulated-list-padding 0))
+       (ncols (length tabulated-list-format))
+       (inhibit-read-only t))
     (if (> tabulated-list-padding 0)
        (insert (make-string x ?\s)))
-    (dotimes (n len)
-      (let* ((format (aref tabulated-list-format n))
-            (desc   (aref cols n))
-            (width  (nth 1 format))
-            (label  (if (stringp desc) desc (car desc)))
-            (help-echo (concat (car format) ": " label)))
-       ;; Truncate labels if necessary (except last column).
-       (and (< (1+ n) len)
-            (> (string-width label) width)
-            (setq label (truncate-string-to-width label width nil nil t)))
-       (setq label (bidi-string-mark-left-to-right label))
-       (if (stringp desc)
-           (insert (propertize label 'help-echo help-echo))
-         (apply 'insert-text-button label (cdr desc)))
-       (setq x (+ x 1 width)))
-      ;; No need to append any spaces if this is the last column.
-      (if (< (1+ n) len)
-         (indent-to x 1)))
+    (dotimes (n ncols)
+      (setq x (tabulated-list-print-col n (aref cols n) x)))
     (insert ?\n)
-    (put-text-property beg (point) 'tabulated-list-id id)))
+    (put-text-property beg (point) 'tabulated-list-id id)
+    (put-text-property beg (point) 'tabulated-list-entry cols)))
+
+(defun tabulated-list-print-col (n col-desc x)
+  "Insert a specified Tabulated List entry at point.
+N is the column number, COL-DESC is a column descriptor \(see
+`tabulated-list-entries'), and X is the column number at point.
+Return the column number after insertion."
+  ;; TODO: don't truncate to `width' if the next column is align-right
+  ;; and has some space left.
+  (let* ((format    (aref tabulated-list-format n))
+        (name      (nth 0 format))
+        (width     (nth 1 format))
+        (props     (nthcdr 3 format))
+        (pad-right (or (plist-get props :pad-right) 1))
+         (right-align (plist-get props :right-align))
+        (label     (if (stringp col-desc) col-desc (car col-desc)))
+         (label-width (string-width label))
+        (help-echo (concat (car format) ": " label))
+        (opoint (point))
+        (not-last-col (< (1+ n) (length tabulated-list-format))))
+    ;; Truncate labels if necessary (except last column).
+    (and not-last-col
+        (> label-width width)
+        (setq label (truncate-string-to-width label width nil nil t)
+               label-width width))
+    (setq label (bidi-string-mark-left-to-right label))
+    (when (and right-align (> width label-width))
+      (let ((shift (- width label-width)))
+        (insert (propertize (make-string shift ?\s)
+                            'display `(space :align-to ,(+ x shift))))
+        (setq width (- width shift))
+        (setq x (+ x shift))))
+    (if (stringp col-desc)
+       (insert (propertize label 'help-echo help-echo))
+      (apply 'insert-text-button label (cdr col-desc)))
+    (let ((next-x (+ x pad-right width)))
+      ;; No need to append any spaces if this is the last column.
+      (when not-last-col
+        (when (> pad-right 0) (insert (make-string pad-right ?\s)))
+        (insert (propertize
+                 (make-string (- next-x x label-width pad-right) ?\s)
+                 'display `(space :align-to ,next-x))))
+      (put-text-property opoint (point) 'tabulated-list-column-name name)
+      next-x)))
+
+(defun tabulated-list-delete-entry ()
+  "Delete the Tabulated List entry at point.
+Return a list (ID COLS), where ID is the ID of the deleted entry
+and COLS is a vector of its column descriptors.  Move point to
+the beginning of the deleted entry.  Return nil if there is no
+entry at point.
+
+This function only changes the buffer contents; it does not alter
+`tabulated-list-entries'."
+  ;; Assume that each entry occupies one line.
+  (let* ((id (tabulated-list-get-id))
+        (cols (tabulated-list-get-entry))
+        (inhibit-read-only t))
+    (when cols
+      (delete-region (line-beginning-position) (1+ (line-end-position)))
+      (list id cols))))
+
+(defun tabulated-list-set-col (col desc &optional change-entry-data)
+  "Change the Tabulated List entry at point, setting COL to DESC.
+COL is the column number to change, or the name of the column to change.
+DESC is the new column descriptor, which is inserted via
+`tabulated-list-print-col'.
+
+If CHANGE-ENTRY-DATA is non-nil, modify the underlying entry data
+by setting the appropriate slot of the vector originally used to
+print this entry.  If `tabulated-list-entries' has a list value,
+this is the vector stored within it."
+  (let* ((opoint (point))
+        (eol    (line-end-position))
+        (pos    (line-beginning-position))
+        (id     (tabulated-list-get-id pos))
+        (entry  (tabulated-list-get-entry pos))
+        (prop 'tabulated-list-column-name)
+        (inhibit-read-only t)
+        name)
+    (cond ((numberp col)
+          (setq name (car (aref tabulated-list-format col))))
+         ((stringp col)
+          (setq name col
+                col (tabulated-list--column-number col)))
+         (t
+          (error "Invalid column %s" col)))
+    (unless entry
+      (error "No Tabulated List entry at position %s" opoint))
+    (unless (equal (get-text-property pos prop) name)
+      (while (and (setq pos
+                       (next-single-property-change pos prop nil eol))
+                 (< pos eol)
+                 (not (equal (get-text-property pos prop) name)))))
+    (when (< pos eol)
+      (delete-region pos (next-single-property-change pos prop nil eol))
+      (goto-char pos)
+      (tabulated-list-print-col col desc (current-column))
+      (if change-entry-data
+         (aset entry col desc))
+      (put-text-property pos (point) 'tabulated-list-id id)
+      (put-text-property pos (point) 'tabulated-list-entry entry)
+      (goto-char opoint))))
 
 (defun tabulated-list-col-sort (&optional e)
   "Sort Tabulated List entries by the column of the mouse click E."
   (interactive "e")
   (let* ((pos (event-start e))
-        (obj (posn-object pos))
-        (name (get-text-property (if obj (cdr obj) (posn-point pos))
-                                 'tabulated-list-column-name
-                                 (car obj))))
+        (obj (posn-object pos)))
     (with-current-buffer (window-buffer (posn-window pos))
-      (when (derived-mode-p 'tabulated-list-mode)
-       ;; Flip the sort order on a second click.
-       (if (equal name (car tabulated-list-sort-key))
-           (setcdr tabulated-list-sort-key
-                   (not (cdr tabulated-list-sort-key)))
-         (setq tabulated-list-sort-key (cons name nil)))
-       (tabulated-list-init-header)
-       (tabulated-list-print t)))))
+      (tabulated-list--sort-by-column-name
+       (get-text-property (if obj (cdr obj) (posn-point pos))
+                         'tabulated-list-column-name
+                         (car obj))))))
+
+(defun tabulated-list-sort (&optional n)
+  "Sort Tabulated List entries by the column at point.
+With a numeric prefix argument N, sort the Nth column."
+  (interactive "P")
+  (let ((name (if n
+                 (car (aref tabulated-list-format n))
+               (get-text-property (point)
+                                  'tabulated-list-column-name))))
+    (tabulated-list--sort-by-column-name name)))
+
+(defun tabulated-list--sort-by-column-name (name)
+  (when (and name (derived-mode-p 'tabulated-list-mode))
+    ;; Flip the sort order on a second click.
+    (if (equal name (car tabulated-list-sort-key))
+       (setcdr tabulated-list-sort-key
+               (not (cdr tabulated-list-sort-key)))
+      (setq tabulated-list-sort-key (cons name nil)))
+    (tabulated-list-init-header)
+    (tabulated-list-print t)))
 
 ;;; The mode definition:
 
-;;;###autoload
 (define-derived-mode tabulated-list-mode special-mode "Tabulated"
   "Generic major mode for browsing a list of items.
 This mode is usually not used directly; instead, other major
index b6b7c266263e115736aad397868159f389f209c0..a66d5972d826533790ac59399463b54b54112356 100644 (file)
 ;;; Code:
 
 ;; Layout of a timer vector:
-;; [triggered-p high-seconds low-seconds usecs repeat-delay
+;; [triggered-p high-seconds low-seconds usecs psecs repeat-delay
 ;;  function args idle-delay]
 ;; triggered-p is nil if the timer is active (waiting to be triggered),
 ;;  t if it is inactive ("already triggered", in theory)
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
-(defstruct (timer
+(cl-defstruct (timer
             (:constructor nil)
             (:copier nil)
             (:constructor timer-create ())
             (:type vector)
             (:conc-name timer--))
   (triggered t)
-  high-seconds low-seconds usecs repeat-delay function args idle-delay)
+  high-seconds low-seconds usecs psecs repeat-delay function args idle-delay)
 
 (defun timerp (object)
   "Return t if OBJECT is a timer."
-  (and (vectorp object) (= (length object) 8)))
+  (and (vectorp object) (= (length object) 9)))
 
 ;; Pseudo field `time'.
 (defun timer--time (timer)
   (list (timer--high-seconds timer)
         (timer--low-seconds timer)
-        (timer--usecs timer)))
+       (timer--usecs timer)
+       (timer--psecs timer)))
 
-(defsetf timer--time
+(gv-define-simple-setter timer--time
   (lambda (timer time)
     (or (timerp timer) (error "Invalid timer"))
     (setf (timer--high-seconds timer) (pop time))
-    (setf (timer--low-seconds timer)
-         (if (consp time) (car time) time))
-    (setf (timer--usecs timer) (or (and (consp time) (consp (cdr time))
-                                       (cadr time))
-                                  0))))
+    (let ((low time) (usecs 0) (psecs 0))
+      (if (consp time)
+         (progn
+           (setq low (pop time))
+           (if time
+               (progn
+                 (setq usecs (pop time))
+                 (if time
+                     (setq psecs (car time)))))))
+      (setf (timer--low-seconds timer) low)
+      (setf (timer--usecs timer) usecs)
+      (setf (timer--psecs timer) psecs))))
 
 
 (defun timer-set-time (timer time &optional delta)
@@ -77,7 +85,7 @@ fire repeatedly that many seconds apart."
 (defun timer-set-idle-time (timer secs &optional repeat)
   "Set the trigger idle time of TIMER to SECS.
 SECS may be an integer, floating point number, or the internal
-time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'.
+time format returned by, e.g., `current-idle-time'.
 If optional third argument REPEAT is non-nil, make the timer
 fire each time Emacs is idle for that many seconds."
   (if (consp secs)
@@ -91,41 +99,46 @@ fire each time Emacs is idle for that many seconds."
   "Yield the next value after TIME that is an integral multiple of SECS.
 More precisely, the next value, after TIME, that is an integral multiple
 of SECS seconds since the epoch.  SECS may be a fraction."
-  (let ((time-base (ash 1 16)))
-    ;; Use floating point, taking care to not lose precision.
-    (let* ((float-time-base (float time-base))
-          (million 1000000.0)
-          (time-usec (+ (* million
-                           (+ (* float-time-base (nth 0 time))
-                              (nth 1 time)))
-                        (nth 2 time)))
-          (secs-usec (* million secs))
-          (mod-usec (mod time-usec secs-usec))
-          (next-usec (+ (- time-usec mod-usec) secs-usec))
-          (time-base-million (* float-time-base million)))
-      (list (floor next-usec time-base-million)
-           (floor (mod next-usec time-base-million) million)
-           (floor (mod next-usec million))))))
-
-(defun timer-relative-time (time secs &optional usecs)
-  "Advance TIME by SECS seconds and optionally USECS microseconds.
-SECS may be either an integer or a floating point number."
+  (let* ((trillion 1e12)
+        (time-sec (+ (nth 1 time)
+                     (* 65536.0 (nth 0 time))))
+        (delta-sec (mod (- time-sec) secs))
+        (next-sec (+ time-sec (ffloor delta-sec)))
+        (next-sec-psec (ffloor (* trillion (mod delta-sec 1))))
+        (sub-time-psec (+ (or (nth 3 time) 0)
+                          (* 1e6 (nth 2 time))))
+        (psec-diff (- sub-time-psec next-sec-psec)))
+    (if (and (<= next-sec time-sec) (< 0 psec-diff))
+       (setq next-sec-psec (+ sub-time-psec
+                              (mod (- psec-diff) (* trillion secs)))))
+    (setq next-sec (+ next-sec (floor next-sec-psec trillion)))
+    (setq next-sec-psec (mod next-sec-psec trillion))
+    (list (floor next-sec 65536)
+         (floor (mod next-sec 65536))
+         (floor next-sec-psec 1000000)
+         (floor (mod next-sec-psec 1000000)))))
+
+(defun timer-relative-time (time secs &optional usecs psecs)
+  "Advance TIME by SECS seconds and optionally USECS nanoseconds
+and PSECS picoseconds.  SECS may be either an integer or a
+floating point number."
   (let ((delta (if (floatp secs)
                   (seconds-to-time secs)
                 (list (floor secs 65536) (mod secs 65536)))))
-    (if usecs
-       (setq delta (time-add delta (list 0 0 usecs))))
+    (if (or usecs psecs)
+       (setq delta (time-add delta (list 0 0 (or usecs 0) (or psecs 0)))))
     (time-add time delta)))
 
 (defun timer--time-less-p (t1 t2)
   "Say whether time value T1 is less than time value T2."
   (time-less-p (timer--time t1) (timer--time t2)))
 
-(defun timer-inc-time (timer secs &optional usecs)
-  "Increment the time set in TIMER by SECS seconds and USECS microseconds.
-SECS may be a fraction.  If USECS is omitted, that means it is zero."
+(defun timer-inc-time (timer secs &optional usecs psecs)
+  "Increment the time set in TIMER by SECS seconds, USECS nanoseconds,
+and PSECS picoseconds.  SECS may be a fraction.  If USECS or PSECS are
+omitted, they are treated as zero."
   (setf (timer--time timer)
-        (timer-relative-time (timer--time timer) secs usecs)))
+        (timer-relative-time (timer--time timer) secs usecs psecs)))
 
 (defun timer-set-time-with-usecs (timer time usecs &optional delta)
   "Set the trigger time of TIMER to TIME plus USECS.
@@ -135,6 +148,7 @@ If optional fourth argument DELTA is a positive number, make the timer
 fire repeatedly that many seconds apart."
   (setf (timer--time timer) time)
   (setf (timer--usecs timer) usecs)
+  (setf (timer--psecs timer) 0)
   (setf (timer--repeat-delay timer) (and (numberp delta) (> delta 0) delta))
   timer)
 (make-obsolete 'timer-set-time-with-usecs
@@ -154,6 +168,7 @@ fire repeatedly that many seconds apart."
           (integerp (timer--high-seconds timer))
           (integerp (timer--low-seconds timer))
           (integerp (timer--usecs timer))
+          (integerp (timer--psecs timer))
           (timer--function timer))
       (let ((timers (if idle timer-idle-list timer-list))
            last)
@@ -240,18 +255,20 @@ and idle timers such as are scheduled by `run-with-idle-timer'."
 (defvar timer-event-last-2 nil
   "Third-to-last timer that was run.")
 
-(defvar timer-max-repeats 10
-  "*Maximum number of times to repeat a timer, if many repeats are delayed.
+(defcustom timer-max-repeats 10
+  "Maximum number of times to repeat a timer, if many repeats are delayed.
 Timer invocations can be delayed because Emacs is suspended or busy,
 or because the system's time changes.  If such an occurrence makes it
 appear that many invocations are overdue, this variable controls
-how many will really happen.")
+how many will really happen."
+  :type 'integer
+  :group 'internal)
 
 (defun timer-until (timer time)
   "Calculate number of seconds from when TIMER will run, until TIME.
 TIMER is a timer, and stands for the time when its next repeat is scheduled.
 TIME is a time-list."
-  (float-time (time-subtract time (timer--time timer))))
+  (- (float-time time) (float-time (timer--time timer))))
 
 (defun timer-event-handler (timer)
   "Call the handler for the timer TIMER.
@@ -384,7 +401,7 @@ This function is for compatibility; see also `run-with-timer'."
   "Perform an action the next time Emacs is idle for SECS seconds.
 The action is to call FUNCTION with arguments ARGS.
 SECS may be an integer, a floating point number, or the internal
-time format (HIGH LOW USECS) returned by, e.g., `current-idle-time'.
+time format returned by, e.g., `current-idle-time'.
 If Emacs is currently idle, and has been idle for N seconds (N < SECS),
 then it will call FUNCTION in SECS - N seconds from now.
 
index fd66c9364f27e796e930fdd0cc1d505284046b1f..c6fff7aa4430139958b575fd907a219683a05736 100644 (file)
@@ -285,7 +285,7 @@ Activation is performed with `ad-update', hence remaining advice will get
 activated only if the advice of FUNCTION is currently active.  If FUNCTION
 was not traced this is a noop."
   (interactive
-   (list (ad-read-advised-function "Untrace function" 'trace-is-traced)))
+   (list (ad-read-advised-function "Untrace function" 'trace-is-traced)))
   (when (trace-is-traced function)
     (ad-remove-advice function 'around trace-advice-name)
     (ad-update function)))
index 743b828326c51d2139ce835b118ea128190dbc5f..6d91238f2b1e188dd98669de0d956480070a5833 100644 (file)
@@ -81,6 +81,13 @@ for both actions (NOT RECOMMENDED)."
   :group 'emacs-lock
   :version "24.1")
 
+(defcustom emacs-lock-locked-buffer-functions nil
+  "Abnormal hook run when Emacs Lock prevents exiting Emacs, or killing a buffer.
+The functions get one argument, the first locked buffer found."
+  :type 'hook
+  :group 'emacs-lock
+  :version "24.2")
+
 (defvar emacs-lock-mode nil
   "If non-nil, the current buffer is locked.
 It can be one of the following values:
@@ -119,40 +126,45 @@ See `emacs-lock-unlockable-modes'."
              (or (eq unlock 'all) (eq unlock action))))))
 
 (defun emacs-lock--exit-locked-buffer ()
-  "Return the name of the first exit-locked buffer found."
+  "Return the first exit-locked buffer found."
   (save-current-buffer
     (catch :found
       (dolist (buffer (buffer-list))
         (set-buffer buffer)
         (unless (or (emacs-lock--can-auto-unlock 'exit)
                     (memq emacs-lock-mode '(nil kill)))
-          (throw :found (buffer-name))))
+          (throw :found buffer)))
       nil)))
 
 (defun emacs-lock--kill-emacs-hook ()
   "Signal an error if any buffer is exit-locked.
 Used from `kill-emacs-hook' (which see)."
-  (let ((buffer-name (emacs-lock--exit-locked-buffer)))
-    (when buffer-name
-      (error "Emacs cannot exit because buffer %S is locked" buffer-name))))
+  (let ((locked (emacs-lock--exit-locked-buffer)))
+    (when locked
+      (run-hook-with-args 'emacs-lock-locked-buffer-functions locked)
+      (error "Emacs cannot exit because buffer %S is locked"
+             (buffer-name locked)))))
 
 (defun emacs-lock--kill-emacs-query-functions ()
   "Display a message if any buffer is exit-locked.
 Return a value appropriate for `kill-emacs-query-functions' (which see)."
   (let ((locked (emacs-lock--exit-locked-buffer)))
-    (or (not locked)
-        (progn
-          (message "Emacs cannot exit because buffer %S is locked" locked)
-          nil))))
+    (if (not locked)
+        t
+      (run-hook-with-args 'emacs-lock-locked-buffer-functions locked)
+      (message "Emacs cannot exit because buffer %S is locked"
+               (buffer-name locked))
+      nil)))
 
 (defun emacs-lock--kill-buffer-query-functions ()
   "Display a message if the current buffer is kill-locked.
 Return a value appropriate for `kill-buffer-query-functions' (which see)."
-  (or (emacs-lock--can-auto-unlock 'kill)
-      (memq emacs-lock-mode '(nil exit))
-      (progn
-        (message "Buffer %S is locked and cannot be killed" (buffer-name))
-        nil)))
+  (if (or (emacs-lock--can-auto-unlock 'kill)
+          (memq emacs-lock-mode '(nil exit)))
+      t
+    (run-hook-with-args 'emacs-lock-locked-buffer-functions (current-buffer))
+    (message "Buffer %S is locked and cannot be killed" (buffer-name))
+    nil))
 
 (defun emacs-lock--set-mode (mode arg)
   "Setter function for `emacs-lock-mode'."
@@ -174,6 +186,8 @@ Return a value appropriate for `kill-buffer-query-functions' (which see)."
                ;; anything else (turn off)
                mode))))
 
+(define-obsolete-variable-alias 'emacs-lock-from-exiting
+  'emacs-lock-mode "24.1")
 ;;;###autoload
 (define-minor-mode emacs-lock-mode
   "Toggle Emacs Lock mode in the current buffer.
@@ -233,8 +247,6 @@ Other values are interpreted as usual."
 
 ;;; Compatibility
 
-(define-obsolete-variable-alias 'emacs-lock-from-exiting 'emacs-lock-mode "24.1")
-
 (defun toggle-emacs-lock ()
   "Toggle `emacs-lock-from-exiting' for the current buffer."
   (interactive)
index 087a7e2898d6fc0d9dbd1bc3ed2a592902e50898..d29736d6860cac1df3b46dc180a175726b322e0b 100644 (file)
@@ -44,9 +44,9 @@
 ;; by default run `save-buffers-kill-emacs' instead of the command
 ;; `execute-extended-command'.
 
-;; Finally, if you want to change the string displayed in the modeline
-;; when this mode is in effect, override the definition of
-;; `crisp-mode-modeline-string' in your .emacs.  The default value is
+;; Finally, if you want to change the string displayed in the mode
+;; line when this mode is in effect, override the definition of
+;; `crisp-mode-mode-line-string' in your .emacs.  The default value is
 ;; " *Crisp*" which may be a bit lengthy if you have a lot of things
 ;; being displayed there.
 
@@ -54,8 +54,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;; local variables
 
 (defgroup crisp nil
 All the bindings are done here instead of globally to try and be
 nice to the world.")
 
-(defcustom crisp-mode-modeline-string " *CRiSP*"
-  "String to display in the modeline when CRiSP emulation mode is enabled."
+(defcustom crisp-mode-mode-line-string " *CRiSP*"
+  "String to display in the mode line when CRiSP emulation mode is enabled."
   :type 'string
   :group 'crisp)
 
+(define-obsolete-variable-alias 'crisp-mode-modeline-string
+  'crisp-mode-mode-line-string "24.2")
+
 ;;;###autoload
 (defcustom crisp-mode nil
   "Track status of CRiSP emulation mode.
@@ -354,11 +355,11 @@ With a prefix argument ARG, enable CRiSP mode if ARG is positive,
 and disable it otherwise.  If called from Lisp, enable the mode
 if ARG is omitted or nil."
   :keymap crisp-mode-map
-  :lighter crisp-mode-modeline-string
+  :lighter crisp-mode-mode-line-string
   (when crisp-mode
     ;; Make menu entries show M-u or f14 in preference to C-x u.
     (put 'undo :advertised-binding
-         (list* [?\M-u] [f14] (get 'undo :advertised-binding)))
+         `([?\M-u] [f14] ,@(get 'undo :advertised-binding)))
     ;; Force transient-mark-mode, so that the marking routines work as
     ;; expected.  If the user turns off transient mark mode, most
     ;; things will still work fine except the crisp-(copy|kill)
index c31f634dd5c5da56ed84f7a8f6b01aeecb4ecc99..6b9ae35141cc6287cc3959065e122743fb31266f 100644 (file)
@@ -463,7 +463,7 @@ Must be set prior to enabling CUA."
 (defface cua-global-mark
   '((((min-colors 88)(class color)) :foreground "black" :background "yellow1")
     (((class color)) :foreground "black" :background "yellow")
-    (t :bold t))
+    (t :weight bold))
   "Font used by CUA for highlighting the global mark."
   :group 'cua)
 
@@ -1252,22 +1252,7 @@ If ARG is the atom `-', scroll upward by nearly full screen."
    ;;   (and region not started with C-SPC).
    ;; If rectangle is active, expand rectangle in specified direction and
    ;;   ignore the movement.
-   ((if window-system
-        ;; Shortcut for window-system, assuming that input-decode-map is empty.
-       (memq 'shift (event-modifiers
-                     (aref (this-single-command-raw-keys) 0)))
-      (or
-       ;; Check if the final key-sequence was shifted.
-       (memq 'shift (event-modifiers
-                    (aref (this-single-command-keys) 0)))
-       ;; If not, maybe the raw key-sequence was mapped by input-decode-map
-       ;; to a shifted key (and then mapped down to its unshifted form).
-       (let* ((keys (this-single-command-raw-keys))
-              (ev (lookup-key input-decode-map keys)))
-         (or (and (vector ev) (memq 'shift (event-modifiers (aref ev 0))))
-             ;; Or maybe, the raw key-sequence was not an escape sequence
-             ;; and was shifted (and then mapped down to its unshifted form).
-             (memq 'shift (event-modifiers (aref keys 0)))))))
+   (this-command-keys-shift-translated
     (unless mark-active
       (push-mark-command nil t))
     (setq cua--last-region-shifted t)
index e3aade760dc13be50783a4428cdf98fe275d0e30..4286afba938af36bf10198c48b753bb977b62b0b 100644 (file)
@@ -465,7 +465,7 @@ If command is repeated at same position, delete the rectangle."
       (cua-copy-rectangle arg)
       (setq cua--mouse-last-pos (cons (point) cua--last-killed-rectangle)))))
 
-(defun cua--mouse-ignore (event)
+(defun cua--mouse-ignore (_event)
   (interactive "e")
   (setq this-command last-command))
 
@@ -609,12 +609,12 @@ If command is repeated at same position, delete the rectangle."
   (let ((lines 0))
     (if (not (cua--rectangle-virtual-edges))
        (cua--rectangle-operation nil nil t 2 t
-         (lambda (s e l r v)
+         (lambda (s e _l _r _v)
             (setq lines (1+ lines))
             (if (and (> e s) (<= e (point-max)))
                 (delete-region s e))))
       (cua--rectangle-operation nil 1 t nil t
-       (lambda (s e l r v)
+       (lambda (s e _l _r _v)
           (setq lines (1+ lines))
           (when (and (> e s) (<= e (point-max)))
             (delete-region s e)))))
@@ -624,10 +624,10 @@ If command is repeated at same position, delete the rectangle."
   (let (rect)
     (if (not (cua--rectangle-virtual-edges))
        (cua--rectangle-operation nil nil nil nil nil ; do not tabify
-         (lambda (s e r)
+         (lambda (s e _l _r)
             (setq rect (cons (cua--filter-buffer-noprops s e) rect))))
       (cua--rectangle-operation nil 1 nil nil nil ; do not tabify
-       (lambda (s e l r v)
+       (lambda (s e l r _v)
           (let ((copy t) (bs 0) (as 0) row)
             (if (= s e) (setq e (1+ e)))
             (goto-char s)
@@ -840,7 +840,7 @@ If command is repeated at same position, delete the rectangle."
         (pad (cua--rectangle-virtual-edges))
         indent)
     (cua--rectangle-operation (if clear 'clear 'corners) nil t pad nil
-      (lambda (s e l r)
+      (lambda (_s _e l _r)
          (move-to-column col pad)
          (if (and (eolp)
                   (< (current-column) col))
@@ -905,10 +905,10 @@ With prefix argument, activate previous rectangle if possible."
         (cua-help-for-region t))))
 
 (defun cua-restrict-regexp-rectangle (arg)
-  "Restrict rectangle to lines (not) matching REGEXP.
-With prefix argument, the toggle restriction."
+  "Restrict rectangle to lines (not) matching regexp.
+With prefix argument, toggle restriction."
   (interactive "P")
-  (let ((r (cua--rectangle-restriction)) regexp)
+  (let ((r (cua--rectangle-restriction)))
     (if (and r (null (car (cdr r))))
       (if arg
           (cua--rectangle-restriction (car r) nil (not (car (cdr (cdr r)))))
@@ -919,9 +919,9 @@ With prefix argument, the toggle restriction."
 
 (defun cua-restrict-prefix-rectangle (arg)
   "Restrict rectangle to lines (not) starting with CHAR.
-With prefix argument, the toggle restriction."
+With prefix argument, toggle restriction."
   (interactive "P")
-  (let ((r (cua--rectangle-restriction)) regexp)
+  (let ((r (cua--rectangle-restriction)))
     (if (and r (car (cdr r)))
       (if arg
           (cua--rectangle-restriction (car r) t (not (car (cdr (cdr r)))))
@@ -1000,7 +1000,7 @@ The text previously in the region is not overwritten by the blanks,
 but instead winds up to the right of the rectangle."
   (interactive)
   (cua--rectangle-operation 'corners nil t 1 nil
-   (lambda (e l r)
+   (lambda (_s _e l r)
       (skip-chars-forward " \t")
       (let ((ws (- (current-column) l))
             (p (point)))
@@ -1015,7 +1015,7 @@ at that column is deleted.
 With prefix arg, also delete whitespace to the left of that column."
   (interactive "P")
   (cua--rectangle-operation 'clear nil t 1 nil
-   (lambda (s e l r)
+   (lambda (s _e _l _r)
       (when arg
         (skip-syntax-backward " " (line-beginning-position))
         (setq s (point)))
@@ -1027,7 +1027,7 @@ With prefix arg, also delete whitespace to the left of that column."
 The text previously in the rectangle is overwritten by the blanks."
   (interactive)
   (cua--rectangle-operation 'keep nil nil 1 nil
-   (lambda (s e r)
+   (lambda (s e _l _r)
       (goto-char e)
       (skip-syntax-forward " " (line-end-position))
       (setq e (point))
@@ -1040,20 +1040,19 @@ The text previously in the rectangle is overwritten by the blanks."
 (defun cua-align-rectangle ()
   "Align rectangle lines to left column."
   (interactive)
-  (let (x)
-    (cua--rectangle-operation 'clear nil t t nil
-     (lambda (s e l r)
-        (let ((b (line-beginning-position)))
-          (skip-syntax-backward "^ " b)
-          (skip-syntax-backward " " b)
-          (setq s (point)))
-        (skip-syntax-forward " " (line-end-position))
-        (delete-region s (point))
-        (indent-to l))
-     (lambda (l r)
-        (move-to-column l)
-        ;; (setq cua-save-point (point))
-        ))))
+  (cua--rectangle-operation 'clear nil t t nil
+   (lambda (s _e l _r)
+      (let ((b (line-beginning-position)))
+       (skip-syntax-backward "^ " b)
+       (skip-syntax-backward " " b)
+       (setq s (point)))
+      (skip-syntax-forward " " (line-end-position))
+      (delete-region s (point))
+      (indent-to l))
+   (lambda (l _r)
+      (move-to-column l)
+      ;; (setq cua-save-point (point))
+      )))
 
 (declare-function cua--cut-rectangle-to-global-mark  "cua-gmrk" (as-text))
 (declare-function cua--copy-rectangle-to-global-mark "cua-gmrk" (as-text))
@@ -1087,7 +1086,7 @@ The text previously in the rectangle is overwritten by the blanks."
 The length of STRING need not be the same as the rectangle width."
   (interactive "sString rectangle: ")
   (cua--rectangle-operation 'keep nil t t nil
-     (lambda (s e l r)
+     (lambda (s e l _r)
         (delete-region s e)
         (skip-chars-forward " \t")
         (let ((ws (- (current-column) l)))
@@ -1095,7 +1094,7 @@ The length of STRING need not be the same as the rectangle width."
           (insert string)
           (indent-to (+ (current-column) ws))))
      (unless (cua--rectangle-restriction)
-       (lambda (l r)
+       (lambda (l _r)
           (cua--rectangle-right (max l (+ l (length string) -1)))))))
 
 (defun cua-fill-char-rectangle (character)
@@ -1113,7 +1112,7 @@ The length of STRING need not be the same as the rectangle width."
   (if buffer-read-only
       (message "Cannot replace in read-only buffer")
     (cua--rectangle-operation 'keep nil t 1 nil
-     (lambda (s e l r)
+     (lambda (_s e _l _r)
         (if (re-search-forward regexp e t)
             (replace-match newtext nil nil))))))
 
@@ -1121,7 +1120,7 @@ The length of STRING need not be the same as the rectangle width."
   "Increment each line of CUA rectangle by prefix amount."
   (interactive "p")
   (cua--rectangle-operation 'keep nil t 1 nil
-     (lambda (s e l r)
+     (lambda (_s e _l _r)
         (cond
          ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t)
           (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1)))
@@ -1154,14 +1153,14 @@ The numbers are formatted according to the FORMAT string."
       (setq format cua--rectangle-seq-format)
     (setq cua--rectangle-seq-format format))
   (cua--rectangle-operation 'clear nil t 1 nil
-     (lambda (s e r)
+     (lambda (s e _l _r)
          (delete-region s e)
          (insert (format format first))
          (setq first (+ first incr)))))
 
 (defmacro cua--convert-rectangle-as (command tabify)
   `(cua--rectangle-operation 'clear nil nil nil ,tabify
-    (lambda (s e r)
+    (lambda (s e _l _r)
        (,command s e))))
 
 (defun cua-upcase-rectangle ()
@@ -1218,7 +1217,7 @@ The numbers are formatted according to the FORMAT string."
       (if cua--debug
          (print z auxbuf))
       (cua--rectangle-operation nil nil t pad nil
-        (lambda (s e l r)
+        (lambda (s e l _r)
            (let (cc)
              (goto-char e)
              (skip-chars-forward " \t")
@@ -1249,7 +1248,7 @@ The numbers are formatted according to the FORMAT string."
 
 (put 'cua--rectangle-aux-replace 'lisp-indent-function 4)
 
-(defun cua--left-fill-rectangle (start end)
+(defun cua--left-fill-rectangle (_start _end)
   (beginning-of-line)
   (while (< (point) (point-max))
     (delete-horizontal-space nil)
@@ -1298,7 +1297,7 @@ With prefix arg, replace rectangle with output from command."
   "Remove the first line of the rectangle and scroll remaining lines up."
   (interactive)
   (cua--rectangle-aux-replace 0 t t t t
-    (lambda (s e)
+    (lambda (s _e)
        (if (= (forward-line 1) 0)
            (delete-region s (point))))))
 
@@ -1307,7 +1306,7 @@ With prefix arg, replace rectangle with output from command."
 The remaining lines are scrolled down, losing the last line."
   (interactive)
   (cua--rectangle-aux-replace 0 t t t t
-    (lambda (s e)
+    (lambda (s _e)
        (goto-char s)
        (insert "\n"))))
 
@@ -1337,7 +1336,7 @@ With prefix arg, indent to that column."
         (pad (cua--rectangle-virtual-edges))
         indent)
     (cua--rectangle-operation 'corners nil t pad nil
-     (lambda (e l r)
+     (lambda (_s _e l r)
         (move-to-column
          (if (cua--rectangle-right-side t)
              (max (1+ r) col) l)
index fbb2359ca1fc4ef65a78bccd056060e798e2af6b..dbd13a01a8b284ce0d34ccbc73efa43e0d26ada9 100644 (file)
@@ -2071,6 +2071,20 @@ created."
     (setq transient-mark-mode edt-orig-transient-mark-mode))
   (message "Original key bindings restored; EDT Emulation disabled"))
 
+(defun edt-default-menu-bar-update-buffers ()
+  ;; Update edt-default-global-map with latest copy of
+  ;; `global-buffers-menu-map' each time `menu-bar-update-buffers'
+  ;; updates global-map.
+  (define-key edt-default-global-map [menu-bar buffer]
+    (cons "Buffers" global-buffers-menu-map)))
+
+(defun edt-user-menu-bar-update-buffers ()
+  ;; We need to update edt-user-global-map with latest copy of
+  ;; `global-buffers-menu-map' each time `menu-bar-update-buffers'
+  ;; updates global-map.
+  (define-key edt-user-global-map [menu-bar buffer]
+    (cons "Buffers" global-buffers-menu-map)))
+
 (defun edt-default-emulation-setup (&optional user-setup)
   "Setup emulation of DEC's EDT editor.
 Optional argument USER-SETUP non-nil means  called from function
@@ -2110,10 +2124,8 @@ Optional argument USER-SETUP non-nil means  called from function
     (progn
       (fset 'edt-emulation-on (symbol-function 'edt-select-default-global-map))
       (edt-select-default-global-map)))
-  ;; We need to share `global-buffers-menu-map' with the saved global
-  ;; keymap, because `menu-bar-update-buffers' directly changes it.
-  (define-key (current-global-map) [menu-bar buffer]
-    (cons "Buffers" global-buffers-menu-map)))
+  ;; Keep the menu bar Buffers menu up-to-date in edt-default-global-map.
+  (add-hook 'menu-bar-update-hook 'edt-default-menu-bar-update-buffers))
 
 (defun edt-user-emulation-setup ()
   "Setup user custom emulation of DEC's EDT editor."
@@ -2134,7 +2146,9 @@ Optional argument USER-SETUP non-nil means  called from function
   ;; See Info node `edt' for more details, and sample edt-user.el file.
   (if (fboundp 'edt-setup-user-bindings)
       (edt-setup-user-bindings))
-  (edt-select-user-global-map))
+  (edt-select-user-global-map)
+  ;; Keep the menu bar Buffers menu up-to-date in edt-user-global-map.
+  (add-hook 'menu-bar-update-hook 'edt-user-menu-bar-update-buffers))
 
 (defun edt-select-default-global-map()
   "Select default EDT emulation key bindings."
index eaf88ccdf858cdb8a81f28500c0d96b6519279b2..b8d07e8b7442608efde4e5c514d7661447311638 100644 (file)
@@ -315,6 +315,7 @@ Otherwise, use `spell-region'."
 ;;;  Global Keymaps
 ;;;
 
+(define-obsolete-variable-alias 'GOLD-map 'tpu-gold-map "23.1")
 (defvar tpu-gold-map
   (let ((map (make-keymap)))
     ;; Previously we used escape sequences here.  We now instead presume
@@ -494,7 +495,6 @@ Otherwise, use `spell-region'."
     map)
   "Maps the function keys on the VT100 keyboard preceded by PF1.
 GOLD is the ASCII 7-bit escape sequence <ESC>OP.")
-(define-obsolete-variable-alias 'GOLD-map 'tpu-gold-map "23.1")
 
 (defvar tpu-global-map
   (let ((map (make-sparse-keymap)))
index 68f40349454e4d0ba71090ce6b61d5ae1f9db9e6..dc767f72e6201556d33d67d65cabeec7120497f4 100644 (file)
@@ -2119,7 +2119,7 @@ Undo previous insertion and inserts new."
 (defcustom viper-smart-suffix-list
   '("" "tex" "c" "cc" "C" "java" "el" "html" "htm" "xml"
     "pl" "flr" "P" "p" "h" "H")
-  "*List of suffixes that Viper tries to append to filenames ending with a `.'.
+  "List of suffixes that Viper tries to append to filenames ending with a `.'.
 This is useful when the current directory contains files with the same
 prefix and many different suffixes.  Usually, only one of the suffixes
 represents an editable file.  However, file completion will stop at the `.'
@@ -3462,7 +3462,7 @@ controlled by the sign of prefix numeric value."
 (defun viper-adjust-window ()
   (let ((win-height (if (featurep 'xemacs)
                        (window-displayed-height)
-                     (1- (window-height)))) ; adjust for modeline
+                     (1- (window-height)))) ; adjust for mode line
        (pt (point))
        at-top-p at-bottom-p
        min-scroll direction)
index 3d538f1bd0d12ea10823b80f40f74ff1172562b9..acaedde3004b297183eccadebf340bdfc553475e 100644 (file)
@@ -368,14 +368,14 @@ corresponding function symbol."
 (defvar viper-keep-reading-filename nil)
 
 (defcustom ex-cycle-other-window t
-  "*If t, :n and :b cycles through files and buffers in other window.
+  "If t, :n and :b cycles through files and buffers in other window.
 Then :N and :B cycles in the current window.  If nil, this behavior is
 reversed."
   :type 'boolean
   :group 'viper-ex)
 
 (defcustom ex-cycle-through-non-files nil
-  "*Cycle through *scratch* and other buffers that don't visit any file."
+  "Cycle through *scratch* and other buffers that don't visit any file."
   :type 'boolean
   :group 'viper-ex)
 
index f8ab5a1f80530a5c22d8d9631064fb675ae62b0d..76a8c4106769778dbcdede3dfb04246e380a8560 100644 (file)
@@ -372,7 +372,7 @@ Use `M-x viper-set-expert-level' to change this.")
 (defconst viper-buffer-undo-list-mark 'viper)
 
 (defcustom viper-keep-point-on-undo nil
-  "*Non-nil means not to move point while undoing commands.
+  "Non-nil means not to move point while undoing commands.
 This style is different from Emacs and Vi.  Try it to see if
 it better fits your working style."
   :type 'boolean
@@ -403,7 +403,7 @@ delete the text being replaced, as in standard Vi."
   :group 'viper)
 
 (defcustom viper-replace-overlay-cursor-color "Red"
-  "*Cursor color when Viper is in Replace state."
+  "Cursor color when Viper is in Replace state."
   :type 'string
   :group 'viper)
 
@@ -450,7 +450,7 @@ is non-nil."
 (defcustom viper-use-replace-region-delimiters
   (or (not (viper-has-face-support-p))
       (and (featurep 'xemacs) (eq (viper-device-type) 'tty)))
-  "*If non-nil, Viper will always use `viper-replace-region-end-delimiter' and
+  "If non-nil, Viper will always use `viper-replace-region-end-delimiter' and
 `viper-replace-region-start-delimiter' to delimit replacement regions, even on
 color displays.  By default, the delimiters are used only on TTYs."
   :type 'boolean
@@ -519,7 +519,7 @@ text."
 
 ;; Fast keyseq and ESC keyseq timeouts
 (defcustom viper-fast-keyseq-timeout 200
-  "*Key sequence separated by no more than this many milliseconds is viewed as a Vi-style macro, if such a macro is defined.
+  "Key sequence separated by no more than this many milliseconds is viewed as a Vi-style macro, if such a macro is defined.
 Setting this too high may slow down your typing.  Setting this value too low
 will make it hard to use Vi-style timeout macros."
   :type 'integer
@@ -549,14 +549,14 @@ will make it hard to use Vi-style timeout macros."
 
 (viper-deflocalvar viper-auto-indent nil "")
 (defcustom viper-auto-indent nil
-  "*Enable autoindent, if t.
+  "Enable autoindent, if t.
 This is a buffer-local variable."
   :type 'boolean
   :group 'viper)
 
 (viper-deflocalvar viper-electric-mode t "")
 (defcustom viper-electric-mode t
-  "*If t, electrify Viper.
+  "If t, electrify Viper.
 Currently, this only electrifies auto-indentation, making it appropriate to the
 mode of the buffer.
 This means that auto-indentation will depart from standard Vi and will indent
@@ -566,7 +566,7 @@ programs and LaTeX documents."
   :group 'viper)
 
 (defcustom viper-shift-width 8
-  "*The value of the shiftwidth.
+  "The value of the shiftwidth.
 This determines the number of columns by which the Ctl-t moves the cursor in
 the Insert state."
   :type 'integer
@@ -575,7 +575,7 @@ the Insert state."
 ;; Variables for repeating destructive commands
 
 (defcustom viper-keep-point-on-repeat t
-  "*If t, don't move point when repeating previous command.
+  "If t, don't move point when repeating previous command.
 This is useful for doing repeated changes with the '.' key.
 The user can change this to nil, if she likes when the cursor moves
 to a new place after repeating previous Vi command."
@@ -668,18 +668,18 @@ to a new place after repeating previous Vi command."
 (defvar viper-s-forward nil)
 
 (defcustom viper-case-fold-search nil
-  "*If not nil, search ignores cases."
+  "If not nil, search ignores cases."
   :type 'boolean
   :group 'viper-search)
 
 (defcustom viper-re-search t
-  "*If not nil, search is regexp search, otherwise vanilla search."
+  "If not nil, search is regexp search, otherwise vanilla search."
   :type 'boolean
   :tag "Regexp Search"
   :group 'viper-search)
 
 (defcustom viper-search-scroll-threshold 2
-  "*If search lands within this threshold from the window top/bottom,
+  "If search lands within this threshold from the window top/bottom,
 the window will be scrolled up or down appropriately, to reveal context.
 If you want Viper search to behave as usual in Vi, set this variable to a
 negative number."
@@ -687,32 +687,32 @@ negative number."
   :group 'viper-search)
 
 (defcustom viper-re-query-replace t
-  "*If t then do regexp replace, if nil then do string replace."
+  "If t then do regexp replace, if nil then do string replace."
   :type 'boolean
   :tag "Regexp Query Replace"
   :group 'viper-search)
 
 (defcustom viper-re-replace t
-  "*If t, do regexp replace.  nil means do string replace."
+  "If t, do regexp replace.  nil means do string replace."
   :type 'boolean
   :tag "Regexp Replace"
   :group 'viper-search)
 
 (defcustom viper-parse-sexp-ignore-comments t
-  "*If t, `%' ignores the parentheses that occur inside comments."
+  "If t, `%' ignores the parentheses that occur inside comments."
   :type 'boolean
   :group 'viper)
 
 (viper-deflocalvar viper-ex-style-motion t "")
 (defcustom viper-ex-style-motion t
-  "*If t, the commands l,h do not cross lines, etc (Ex-style).
+  "If t, the commands l,h do not cross lines, etc (Ex-style).
 If nil, these commands cross line boundaries."
   :type 'boolean
   :group 'viper)
 
 (viper-deflocalvar viper-ex-style-editing t "")
 (defcustom viper-ex-style-editing t
-  "*If t, Ex-style behavior while editing in Vi command and insert states.
+  "If t, Ex-style behavior while editing in Vi command and insert states.
 `Backspace' and `Delete' don't cross line boundaries in insert.
 `X' and `x' can't delete characters across line boundary in Vi, etc.
 Note: this doesn't preclude `Backspace' and `Delete' from deleting characters
@@ -724,32 +724,32 @@ If nil, the above commands can work across lines."
 
 (viper-deflocalvar viper-ESC-moves-cursor-back viper-ex-style-editing "")
 (defcustom viper-ESC-moves-cursor-back nil
-  "*If t, ESC moves cursor back when changing from insert to vi state.
+  "If t, ESC moves cursor back when changing from insert to vi state.
 If nil, the cursor stays where it was when ESC was hit."
   :type 'boolean
   :group 'viper)
 
 (viper-deflocalvar viper-delete-backwards-in-replace nil "")
 (defcustom viper-delete-backwards-in-replace nil
-  "*If t, DEL key will delete characters while moving the cursor backwards.
+  "If t, DEL key will delete characters while moving the cursor backwards.
 If nil, the cursor will move backwards without deleting anything."
   :type 'boolean
   :group 'viper)
 
 (defcustom viper-buffer-search-char nil
-  "*Key used for buffer-searching.  Must be a character type, e.g., ?g."
+  "Key used for buffer-searching.  Must be a character type, e.g., ?g."
   :type '(choice (const nil) character)
   :group 'viper-search)
 
 (defcustom viper-search-wrap-around t
-  "*If t, search wraps around."
+  "If t, search wraps around."
   :type 'boolean
   :tag "Search Wraps Around"
   :group 'viper-search)
 
 (viper-deflocalvar viper-related-files-and-buffers-ring nil "")
 (defcustom viper-related-files-and-buffers-ring nil
-  "*List of file and buffer names that are considered to be related to the current buffer.
+  "List of file and buffer names that are considered to be related to the current buffer.
 Related buffers can be cycled through via :R and :P commands."
   :type 'boolean
   :group 'viper-misc)
@@ -771,7 +771,7 @@ Related buffers can be cycled through via :R and :P commands."
          "^\\\\[sb][a-z]*{.*}\\s-*$\\|"                        ; latex
          "^@node\\|@table\\|^@m?enu\\|^@itemize\\|^@if\\|"     ; texinfo
          "^.+:-")                                              ; prolog
-  "*Regexps for Headings.  Used by \[\[ and \]\].")
+  "Regexps for Headings.  Used by \[\[ and \]\].")
 
 (defvar viper-heading-end
   (concat "^}\\|"                                              ; C/C++
@@ -826,7 +826,7 @@ Related buffers can be cycled through via :R and :P commands."
 (defface viper-search
   '((((class color)) (:foreground "Black" :background "khaki"))
     (t (:underline t :stipple "gray3")))
-  "*Face used to flash out the search pattern."
+  "Face used to flash out the search pattern."
   :group 'viper-highlighting)
 ;; An internal variable.  Viper takes the face from here.
 (defvar viper-search-face 'viper-search
@@ -838,7 +838,7 @@ this variable represents.")
 (defface viper-replace-overlay
   '((((class color)) (:foreground "Black" :background "darkseagreen2"))
     (t (:underline t :stipple "gray3")))
-  "*Face for highlighting replace regions on a window display."
+  "Face for highlighting replace regions on a window display."
   :group 'viper-highlighting)
 ;; An internal variable.  Viper takes the face from here.
 (defvar viper-replace-overlay-face 'viper-replace-overlay
@@ -946,19 +946,19 @@ Should be set in `~/.viper' file."
   :group 'viper)
 
 (defcustom viper-vi-state-hook 'viper-restore-cursor-type
-  "*Hooks run just before the switch to Vi mode is completed."
+  "Hooks run just before the switch to Vi mode is completed."
   :type 'hook
   :group 'viper-hooks)
 (defcustom viper-insert-state-hook 'viper-set-insert-cursor-type
-  "*Hooks run just before the switch to Insert mode is completed."
+  "Hooks run just before the switch to Insert mode is completed."
   :type 'hook
   :group 'viper-hooks)
 (defcustom viper-replace-state-hook 'viper-restore-cursor-type
-  "*Hooks run just before the switch to Replace mode is completed."
+  "Hooks run just before the switch to Replace mode is completed."
   :type 'hook
   :group 'viper-hooks)
 (defcustom viper-emacs-state-hook 'viper-restore-cursor-type
-  "*Hooks run just before the switch to Emacs mode is completed."
+  "Hooks run just before the switch to Emacs mode is completed."
   :type 'hook
   :group 'viper-hooks)
 
@@ -980,7 +980,7 @@ Should be set in `~/.viper' file."
     (setq cursor-type '(bar . 2))))
 
 (defun viper-ESC-keyseq-timeout ()
-  "*Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.
+  "Key sequence beginning with ESC and separated by no more than this many milliseconds is considered to be generated by a keyboard function key.
 Setting this too high may slow down switching from insert to vi state.  Setting
 this value too low will make it impossible to use function keys in insert mode
 on a dumb terminal."
index 65638dfff3c98d0f8c0cd512012188e2d80fa10b..ad1e32b55462e642ce8b3781d482ca313f0c9a74 100644 (file)
 ;;; Emacs keys in other states.
 
 (defcustom viper-want-emacs-keys-in-insert t
-  "*Set to nil if you want complete Vi compatibility in insert mode.
+  "Set to nil if you want complete Vi compatibility in insert mode.
 Complete compatibility with Vi is not recommended for power use of Viper."
   :type 'boolean
   :group 'viper)
 
 (defcustom viper-want-emacs-keys-in-vi t
-  "*Set to nil if you want complete Vi compatibility in Vi mode.
+  "Set to nil if you want complete Vi compatibility in Vi mode.
 Full Vi compatibility is not recommended for power use of Viper."
   :type 'boolean
   :group 'viper)
 
 (defcustom viper-no-multiple-ESC  t
-  "*If true, multiple ESC in Vi mode will cause bell to ring.
+  "If true, multiple ESC in Vi mode will cause bell to ring.
 This is set to t on a windowing terminal and to 'twice on a dumb
 terminal (unless the user level is 1, 2, or 5).  On a dumb terminal, this
 enables cursor keys and is generally more convenient, as terminals usually
@@ -71,7 +71,7 @@ as is allowed by the major mode in effect."
   :group 'viper)
 
 (defcustom viper-want-ctl-h-help nil
-  "*If non-nil, C-h gets bound to help-command; otherwise, C-h gets the usual Vi bindings."
+  "If non-nil, C-h gets bound to help-command; otherwise, C-h gets the usual Vi bindings."
   :type 'boolean
   :group 'viper)
 
index 58d8fb45b9298a5439c9528b82354dbc5ab4ae3c..eda1a7ec9373b8bb90352910b270df388905f499 100644 (file)
@@ -63,7 +63,7 @@
 (defvar viper-current-frame-saved (selected-frame))
 
 (defcustom viper-surrounding-word-function 'viper-surrounding-word
-  "*Function that determines what constitutes a word for clicking events.
+  "Function that determines what constitutes a word for clicking events.
 Takes two parameters: a COUNT, indicating how many words to return,
 and CLICK-COUNT, telling whether this is the first click, a double-click,
 or a triple-click."
@@ -77,7 +77,7 @@ or a triple-click."
                                          mouse-track-multi-click-time
                                        double-click-time)
                                    500)
-  "*Time interval in millisecond within which successive mouse clicks are
+  "Time interval in millisecond within which successive mouse clicks are
 considered related."
   :type 'integer
   :group 'viper-mouse)
@@ -624,7 +624,7 @@ bindings in the Viper manual."
 
 
 (defcustom viper-mouse-search-key '(meta shift 1)
-  "*Key used to click-search in Viper.
+  "Key used to click-search in Viper.
 This must be a list that specifies the mouse button and modifiers.
 The supported modifiers are `meta', `shift', and `control'.
 For instance, `(meta shift 1)' means that holding the meta and shift
@@ -640,7 +640,7 @@ This buffer may be different from the one where the click occurred."
   :group 'viper-mouse)
 
 (defcustom viper-mouse-insert-key '(meta shift 2)
-  "*Key used to click-insert in Viper.
+  "Key used to click-insert in Viper.
 Must be a list that specifies the mouse button and modifiers.
 The supported modifiers are `meta', `shift', and `control'.
 For instance, `(meta shift 2)' means that holding the meta and shift keys
index cdeef733bc5cba8d3099e00d95ea2ccaf1aaa498..4afa379f389d6625ab633c82988f493c21c5cb8c 100644 (file)
@@ -1323,7 +1323,7 @@ sets the default value."
   (viper-update-syntax-classes))
 
 (defcustom viper-syntax-preference 'reformed-vi
-  "*Syntax type characterizing Viper's alphanumeric symbols.
+  "Syntax type characterizing Viper's alphanumeric symbols.
 Affects movement and change commands that deal with Vi-style words.
 Works best when set in the hooks to various major modes.
 
index 12c186e234e9f6dffe7e1317c9169f5aacdf960b..9cf6c91265e45f59cbb9be263765bc934e35dcb2 100644 (file)
@@ -435,7 +435,7 @@ widget."
     view-mode
     vm-mode
     vm-summary-mode)
-  "*A list of major modes that should come up in Emacs state.
+  "A list of major modes that should come up in Emacs state.
 Normally, Viper would bring buffers up in Emacs state, unless the corresponding
 major mode has been placed on `viper-vi-state-mode-list' or
 `viper-insert-state-mode-list'.  So, don't place a new mode on this list,
@@ -451,7 +451,7 @@ unless it is coming up in a wrong Viper state."
     erc-mode
     eshell-mode
     shell-mode)
-  "*A list of major modes that should come up in Vi Insert state."
+  "A list of major modes that should come up in Vi Insert state."
   :type '(repeat symbol)
   :group 'viper-misc)
 
index 53922b5e26272dccc44a7f41de350fa7f16f9c0a..d0d8ed0b998356cd1b3cf3073df85bbb8c2428d6 100644 (file)
@@ -34,8 +34,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;; History list for environment variable names.
 (defvar read-envvar-name-history nil)
 
index 3b9933f6984edf08e54e029bc87affb10057c0ab..b796f5fa77c58089a1b3b581a0d07d5dda63643c 100644 (file)
@@ -50,97 +50,51 @@ the separate window."
   :group 'epa)
 
 (defface epa-validity-high
-  `((((class color) (background dark))
-     (:foreground "PaleTurquoise"
-                 ,@(if (assq ':weight custom-face-attributes)
-                       '(:weight bold)
-                     '(:bold t))))
-    (t
-     (,@(if (assq ':weight custom-face-attributes)
-           '(:weight bold)
-         '(:bold t)))))
-  "Face used for displaying the high validity."
+  '((default :weight bold)
+    (((class color) (background dark)) :foreground "PaleTurquoise"))
+  "Face for high validity EPA information."
   :group 'epa-faces)
 
 (defface epa-validity-medium
-  `((((class color) (background dark))
-     (:foreground "PaleTurquoise"
-                 ,@(if (assq ':slant custom-face-attributes)
-                       '(:slant italic)
-                     '(:italic t))))
-    (t
-     (,@(if (assq ':slant custom-face-attributes)
-           '(:slant italic)
-         '(:italic t)))))
-  "Face used for displaying the medium validity."
+  '((default :slant italic)
+    (((class color) (background dark)) :foreground "PaleTurquoise"))
+  "Face for medium validity EPA information."
   :group 'epa-faces)
 
 (defface epa-validity-low
-  `((t
-     (,@(if (assq ':slant custom-face-attributes)
-           '(:slant italic)
-         '(:italic t)))))
+  '((t :slant italic))
   "Face used for displaying the low validity."
   :group 'epa-faces)
 
 (defface epa-validity-disabled
-  `((t
-     (,@(if (assq ':slant custom-face-attributes)
-           '(:slant italic)
-         '(:italic t))
-       :inverse-video t)))
+  '((t :slant italic :inverse-video t))
   "Face used for displaying the disabled validity."
   :group 'epa-faces)
 
 (defface epa-string
   '((((class color) (background dark))
-     (:foreground "lightyellow"))
+     :foreground "lightyellow")
     (((class color) (background light))
-     (:foreground "blue4")))
+     :foreground "blue4"))
   "Face used for displaying the string."
   :group 'epa-faces)
 
 (defface epa-mark
-  `((((class color) (background dark))
-     (:foreground "orange"
-                 ,@(if (assq ':weight custom-face-attributes)
-                       '(:weight bold)
-                     '(:bold t))))
-    (((class color) (background light))
-     (:foreground "red"
-                 ,@(if (assq ':weight custom-face-attributes)
-                       '(:weight bold)
-                     '(:bold t))))
-    (t
-     (,@(if (assq ':weight custom-face-attributes)
-           '(:weight bold)
-         '(:bold t)))))
+  '((default :weight bold)
+    (((class color) (background dark))  :foreground "orange")
+    (((class color) (background light)) :foreground "red"))
   "Face used for displaying the high validity."
   :group 'epa-faces)
 
 (defface epa-field-name
-  `((((class color) (background dark))
-     (:foreground "PaleTurquoise"
-                 ,@(if (assq ':weight custom-face-attributes)
-                       '(:weight bold)
-                     '(:bold t))))
-    (t
-     (,@(if (assq ':weight custom-face-attributes)
-           '(:weight bold)
-         '(:bold t)))))
+  '((default :weight bold)
+    (((class color) (background dark)) :foreground "PaleTurquoise"))
   "Face for the name of the attribute field."
   :group 'epa)
 
 (defface epa-field-body
-  `((((class color) (background dark))
-     (:foreground "turquoise"
-                 ,@(if (assq ':slant custom-face-attributes)
-                       '(:slant italic)
-                     '(:italic t))))
-    (t
-     (,@(if (assq ':slant custom-face-attributes)
-           '(:slant italic)
-         '(:italic t)))))
+  '((default :slant italic)
+    (((class color) (background dark)) :foreground "turquoise"))
   "Face for the body of the attribute field."
   :group 'epa)
 
@@ -177,18 +131,18 @@ the separate window."
     (20 . ?G)))
 
 (defvar epa-protocol 'OpenPGP
-  "*The default protocol.
+  "The default protocol.
 The value can be either OpenPGP or CMS.
 
 You should bind this variable with `let', but do not set it globally.")
 
 (defvar epa-armor nil
-  "*If non-nil, epa commands create ASCII armored output.
+  "If non-nil, epa commands create ASCII armored output.
 
 You should bind this variable with `let', but do not set it globally.")
 
 (defvar epa-textmode nil
-  "*If non-nil, epa commands treat input files as text.
+  "If non-nil, epa commands treat input files as text.
 
 You should bind this variable with `let', but do not set it globally.")
 
index fd2468f9a4b429bda498b521153011e03ae1b796..aa052206bec1e3398ed74e55af67a5e0bee85f1e 100644 (file)
   "Report bugs to this address.")
 
 (defgroup epg ()
-  "The EasyPG library."
+  "Interface to the GNU Privacy Guard (GnuPG)."
+  :tag "EasyPG"
   :version "23.1"
-  :group 'data)
+  :group 'data
+  :group 'external)
 
 (defcustom epg-gpg-program (or (executable-find "gpg")
                               (executable-find "gpg2")
index b4d4586b6f373faa263e906c97f0f365a94f791e..f84df4c7b89391ac070f5789f9bd5403f2aca579 100644 (file)
@@ -1,6 +1,68 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-15  Julien Danjou  <julien@danjou.info>
 
-       * Version 24.1 released.
+       * erc.el (erc-open): Use `auth-source' for password retrieval when
+       possible.
+
+2012-06-12  Chong Yidong  <cyd@gnu.org>
+
+       * erc-dcc.el (erc-dcc-chat-filter-functions): Rename from
+       erc-dcc-chat-filter-hook, since this is an abnormal hook.
+
+2012-06-08  Chong Yidong  <cyd@gnu.org>
+
+       * erc.el (erc-direct-msg-face, erc-header-line, erc-input-face)
+       (erc-command-indicator-face, erc-notice-face, erc-action-face)
+       (erc-error-face, erc-my-nick-face, erc-nick-default-face)
+       (erc-nick-msg-face): Use new-style face specs, and avoid :bold.
+
+       * erc-button.el (erc-button):
+       * erc-goodies.el (erc-bold-face, erc-inverse-face)
+       (erc-underline-face, fg:erc-color-*):
+       * erc-match.el (erc-current-nick-face, erc-dangerous-host-face)
+       (erc-pal-face, erc-fool-face, erc-keyword-face):
+       * erc-stamp.el (erc-timestamp-face): Likewise.
+
+2012-06-02  Chong Yidong  <cyd@gnu.org>
+
+       * erc-track.el (erc-track, erc-track-faces-priority-list)
+       (erc-track-faces-normal-list, erc-track-find-face)
+       (erc-track-modified-channels): Fix modeline -> mode line in docs.
+
+2012-05-14  Mike Kazantsev  <mk.fraggod@gmail.com>  (tiny change)
+
+       * erc-dcc.el (erc-dcc-handle-ctcp-send): Fix a regression
+       introduced on 2011-11-28 when fixing quoted filenames matching,
+       the regex group was not corrected.
+
+2012-05-13  Teemu Likonen  <tlikonen@iki.fi>
+
+       * erc-backend.el (erc-server-timestamp-format): New variable to
+       allow specifying the timestamp format (bug#10779).
+
+2012-04-11  Vivek Dasmohapatra  <vivek@etla.org>
+
+       * erc-services.el (erc-nickserv-passwords): Don't display the
+       password (bug#4459).
+
+2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * erc-join.el (erc-server-join-channel): New function to look up
+       the channel password via auth-source.
+       (erc-autojoin-channels): Use it.
+       (erc-autojoin-after-ident): Ditto.
+       (erc-autojoin-channels-alist): Mention auth-source.
+
+2012-04-10  Deniz Dogan  <deniz@dogan.se>  (tiny change)
+
+       * erc.el (erc-display-prompt): Adds the field text property to the
+       ERC prompt.  This allows users to use `kill-whole-line' to kill
+       all text back to the prompt given that it's on a single line
+       (bug#10841).
+
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * erc.el (erc-cmd-SET): Call custom-variable-p instead of
+       user-variable-p.
 
 2012-02-08  Glenn Morris  <rgm@gnu.org>
 
index 699c4e20552efc9b646039cc4d61370c19927666..ab429a12589ea647d98095f3ce68ee6413fcc1e3 100644 (file)
@@ -138,7 +138,7 @@ Related variables: `erc-public-away-p' and `erc-away-nickname'."
      (remove-hook 'erc-server-305-functions 'erc-autoaway-reset-indicators))))
 
 (defcustom erc-autoaway-idle-method 'user
-  "*The method used to determine how long you have been idle.
+  "The method used to determine how long you have been idle.
 If 'user, the time of the last command sent to Emacs is used.
 If 'emacs, the idle time in Emacs is used.
 If 'irc, the time of the last IRC command is used.
@@ -160,7 +160,7 @@ definitions of being idle."
           (set sym val))))
 
 (defcustom erc-auto-set-away t
-  "*If non-nil, set away after `erc-autoaway-idle-seconds' seconds of idling.
+  "If non-nil, set away after `erc-autoaway-idle-seconds' seconds of idling.
 ERC autoaway mode can set you away when you idle, and set you no
 longer away when you type something.  This variable controls whether
 you will be set away when you idle.  See `erc-auto-discard-away' for
@@ -169,7 +169,7 @@ the other half."
   :type 'boolean)
 
 (defcustom erc-auto-discard-away t
-  "*If non-nil, sending anything when away automatically discards away state.
+  "If non-nil, sending anything when away automatically discards away state.
 ERC autoaway mode can set you away when you idle, and set you no
 longer away when you type something.  This variable controls whether
 you will be set no longer away when you type something.  See
@@ -179,13 +179,13 @@ See also `erc-autoaway-no-auto-discard-regexp'."
   :type 'boolean)
 
 (defcustom erc-autoaway-no-auto-discard-regexp "^/g?away.*$"
-  "*Input that matches this will not automatically discard away status.
+  "Input that matches this will not automatically discard away status.
 See `erc-auto-discard-away'."
   :group 'erc-autoaway
   :type 'regexp)
 
 (defcustom erc-autoaway-idle-seconds 1800
-  "*Number of seconds after which ERC will set you automatically away.
+  "Number of seconds after which ERC will set you automatically away.
 If you are changing this variable using lisp instead of customizing it,
 you have to run `erc-autoaway-reestablish-idletimer' afterwards."
   :group 'erc-autoaway
@@ -197,7 +197,7 @@ you have to run `erc-autoaway-reestablish-idletimer' afterwards."
 
 (defcustom erc-autoaway-message
   "I'm gone (autoaway after %i seconds of idletime)"
-  "*Message ERC will use when setting you automatically away.
+  "Message ERC will use when setting you automatically away.
 It is used as a `format' string with the argument of the idletime
 in seconds."
   :group 'erc-autoaway
index 7bc56584eafe42541cc47edad30cc98d5f5587ec..cce24e67cf4df7f851809997653cdacc8f08d7ab 100644 (file)
@@ -311,7 +311,7 @@ If a key is pressed while ERC is waiting, it will stop waiting."
   :type 'number)
 
 (defcustom erc-split-line-length 440
-  "*The maximum length of a single message.
+  "The maximum length of a single message.
 If a message exceeds this size, it is broken into multiple ones.
 
 IRC allows for lines up to 512 bytes. Two of them are CR LF.
@@ -379,27 +379,34 @@ It should take same arguments as `open-network-stream' does."
   :type 'function)
 
 (defcustom erc-server-prevent-duplicates '("301")
-  "*Either nil or a list of strings.
+  "Either nil or a list of strings.
 Each string is a IRC message type, like PRIVMSG or NOTICE.
 All Message types in that list of subjected to duplicate prevention."
   :type '(choice (const nil) (list string))
   :group 'erc-server)
 
 (defcustom erc-server-duplicate-timeout 60
-  "*The time allowed in seconds between duplicate messages.
+  "The time allowed in seconds between duplicate messages.
 
 If two identical messages arrive within this value of one another, the second
 isn't displayed."
   :type 'integer
   :group 'erc-server)
 
+(defcustom erc-server-timestamp-format "%Y-%m-%d %T"
+  "Timestamp format used with server response messages.
+This string is processed using `format-time-string'."
+  :version "24.2"
+  :type 'string
+  :group 'erc-server)
+
 ;;; Flood-related
 
 ;; Most of this is courtesy of Jorgen Schaefer and Circe
 ;; (http://www.nongnu.org/circe)
 
 (defcustom erc-server-flood-margin 10
-  "*A margin on how much excess data we send.
+  "A margin on how much excess data we send.
 The flood protection algorithm of ERC works like the one
 detailed in RFC 2813, section 5.8 \"Flood control of clients\".
 
@@ -423,14 +430,14 @@ protection algorithm."
 ;; Ping handling
 
 (defcustom erc-server-send-ping-interval 30
-  "*Interval of sending pings to the server, in seconds.
+  "Interval of sending pings to the server, in seconds.
 If this is set to nil, pinging the server is disabled."
   :group 'erc-server
   :type '(choice (const :tag "Disabled" nil)
                  (integer :tag "Seconds")))
 
 (defcustom erc-server-send-ping-timeout 120
-  "*If the time between ping and response is greater than this, reconnect.
+  "If the time between ping and response is greater than this, reconnect.
 The time is in seconds.
 
 This must be greater than or equal to the value for
@@ -1454,7 +1461,8 @@ add things to `%s' instead."
   "The channel topic has changed." nil
   (let* ((ch (first (erc-response.command-args parsed)))
          (topic (erc-trim-string (erc-response.contents parsed)))
-         (time (format-time-string "%T %m/%d/%y" (current-time))))
+         (time (format-time-string erc-server-timestamp-format
+                                   (current-time))))
     (multiple-value-bind (nick login host)
         (values-list (erc-parse-user (erc-response.sender parsed)))
       (erc-update-channel-member ch nick nick nil nil nil host login)
@@ -1647,7 +1655,7 @@ See `erc-display-server-message'." nil
   (multiple-value-bind (nick seconds-idle on-since time)
       (values-list (cdr (erc-response.command-args parsed)))
     (setq time (when on-since
-                 (format-time-string "%T %Y/%m/%d"
+                 (format-time-string erc-server-timestamp-format
                                      (erc-string-to-emacs-time on-since))))
     (erc-update-user-nick nick nick nil nil nil
                           (and time (format "on since %s" time)))
@@ -1724,7 +1732,8 @@ See `erc-display-server-message'." nil
                (third (erc-response.command-args parsed)))))
     (erc-display-message
      parsed 'notice (erc-get-buffer channel proc)
-     's329 ?c channel ?t (format-time-string "%A %Y/%m/%d %X" time))))
+     's329 ?c channel ?t (format-time-string erc-server-timestamp-format
+                                             time))))
 
 (define-erc-response-handler (330)
   "Nick is authed as (on Quakenet network)." nil
@@ -1761,7 +1770,7 @@ See `erc-display-server-message'." nil
   "Who set the topic, and when." nil
   (multiple-value-bind (channel nick time)
       (values-list (cdr (erc-response.command-args parsed)))
-    (setq time (format-time-string "%T %Y/%m/%d"
+    (setq time (format-time-string erc-server-timestamp-format
                                    (erc-string-to-emacs-time time)))
     (erc-update-channel-topic channel
                               (format "\C-o (%s, %s)" nick time)
index 17b8c457f38b964bc6ec766a4769fb01d4e3e627..c8a7fec32bd1746ae12be63e064cfe73034ade35 100644 (file)
@@ -66,7 +66,7 @@
 
 ;;; Variables
 
-(defface erc-button '((t (:bold t)))
+(defface erc-button '((t :weight bold))
   "ERC button face."
   :group 'erc-faces)
 
@@ -115,13 +115,13 @@ longer than `erc-fill-column'."
   :type 'boolean)
 
 (defcustom erc-button-rfc-url "http://www.faqs.org/rfcs/rfc%s.html"
-  "*URL used to browse rfc references.
+  "URL used to browse rfc references.
 %s is replaced by the number."
   :group 'erc-button
   :type 'string)
 
 (defcustom erc-button-google-url "http://www.google.com/search?q=%s"
-  "*URL used to browse Google search references.
+  "URL used to browse Google search references.
 %s is replaced by the search string."
   :group 'erc-button
   :type 'string)
@@ -155,7 +155,7 @@ longer than `erc-fill-column'."
      1)
     ;; other
     ("\\s-\\(@\\([0-9][0-9][0-9]\\)\\)" 1 t erc-button-beats-to-time 2))
-  "*Alist of regexps matching buttons in ERC buffers.
+  "Alist of regexps matching buttons in ERC buffers.
 Each entry has the form (REGEXP BUTTON FORM CALLBACK PAR...), where
 
 REGEXP is the string matching text around the button or a symbol
@@ -198,12 +198,12 @@ PAR is a number of a regexp grouping whose text will be passed to
                         (integer :tag "Regexp section number")))))
 
 (defcustom erc-emacswiki-url "http://www.emacswiki.org/cgi-bin/wiki.pl?"
-  "*URL of the EmacsWiki Homepage."
+  "URL of the EmacsWiki Homepage."
   :group 'erc-button
   :type 'string)
 
 (defcustom erc-emacswiki-lisp-url "http://www.emacswiki.org/elisp/"
-  "*URL of the EmacsWiki ELisp area."
+  "URL of the EmacsWiki ELisp area."
   :group 'erc-button
   :type 'string)
 
@@ -488,7 +488,7 @@ For use on `completion-at-point-functions'."
     ("Query" . (erc-cmd-QUERY nick))
     ("Whois" . (erc-cmd-WHOIS nick))
     ("Lastlog" . (erc-cmd-LASTLOG nick)))
-  "*An alist of possible actions to take on a nickname.
+  "An alist of possible actions to take on a nickname.
 An entry looks like (\"Action\" . SEXP) where SEXP is evaluated with
 the variable `nick' bound to the nick in question.
 
index f68b3591fbb0fdc54b1f3153b00f6795abfc1bd7..66256ee270e0acbed97e6495c01bb0cd7a41102a 100644 (file)
@@ -75,7 +75,7 @@ IRC users."
   :group 'erc)
 
 (defcustom erc-dcc-verbose nil
-  "*If non-nil, be verbose about DCC activity reporting."
+  "If non-nil, be verbose about DCC activity reporting."
   :group 'erc-dcc
   :type 'boolean)
 
@@ -316,7 +316,7 @@ Should be set to a string or nil.  If nil, use the value of
                     :valid-regexp erc-dcc-ipv4-regexp)))
 
 (defcustom erc-dcc-send-request 'ask
-  "*How to treat incoming DCC Send requests.
+  "How to treat incoming DCC Send requests.
 'ask - Report the Send request, and wait for the user to manually accept it
        You might want to set `erc-dcc-auto-masks' for this.
 'auto - Automatically accept the request and begin downloading the file
@@ -405,7 +405,7 @@ the accepted connection."
 ;;; Interactive command handling
 
 (defcustom erc-dcc-get-default-directory nil
-  "*Default directory for incoming DCC file transfers.
+  "Default directory for incoming DCC file transfers.
 If this is nil, then the current value of `default-directory' is used."
   :group 'erc-dcc
   :type '(choice (const nil :tag "Default directory") directory))
@@ -627,7 +627,7 @@ separated by a space."
 
 ;;;###autoload
 (defvar erc-ctcp-query-DCC-hook '(erc-ctcp-query-DCC)
-  "Hook variable for CTCP DCC queries")
+  "Hook variable for CTCP DCC queries.")
 
 (defvar erc-dcc-query-handler-alist
   '(("SEND" . erc-dcc-handle-ctcp-send)
@@ -674,7 +674,7 @@ It extracts the information about the dcc request and adds it to
        ?r "SEND" ?n nick ?u login ?h host))
      ((string-match erc-dcc-ctcp-query-send-regexp query)
       (let ((filename
-             (or (match-string 3 query)
+             (or (match-string 5 query)
                  (erc-dcc-unquote-filename (match-string 2 query))))
             (ip       (erc-decimal-to-ip (match-string 6 query)))
             (port     (match-string 7 query))
@@ -719,7 +719,7 @@ match, returns that regexp and nil otherwise."
   "^DCC CHAT +chat +\\([0-9]+\\) +\\([0-9]+\\)")
 
 (defcustom erc-dcc-chat-request 'ask
-  "*How to treat incoming DCC Chat requests.
+  "How to treat incoming DCC Chat requests.
 'ask - Report the Chat request, and wait for the user to manually accept it
 'auto - Automatically accept the request and open a new chat window
 'ignore - Ignore incoming DCC chat requests completely."
@@ -777,12 +777,12 @@ match, returns that regexp and nil otherwise."
 ;;; SEND handling
 
 (defcustom erc-dcc-block-size 1024
-  "*Block size to use for DCC SEND sessions."
+  "Block size to use for DCC SEND sessions."
   :group 'erc-dcc
   :type 'integer)
 
 (defcustom erc-dcc-pump-bytes nil
-  "*If set to an integer, keep sending until that number of bytes are
+  "If set to an integer, keep sending until that number of bytes are
 unconfirmed."
   :group 'erc-dcc
   :type '(choice (const nil) integer))
@@ -856,7 +856,7 @@ bytes sent."
 
 (defcustom erc-dcc-send-connect-hook
   '(erc-dcc-display-send erc-dcc-send-block)
-  "*Hook run whenever the remote end of a DCC SEND offer connected to your
+  "Hook run whenever the remote end of a DCC SEND offer connected to your
 listening port."
   :group 'erc-dcc
   :type 'hook)
@@ -1046,12 +1046,12 @@ transfer is complete."
 ;;; CHAT handling
 
 (defcustom erc-dcc-chat-buffer-name-format "DCC-CHAT-%s"
-  "*Format to use for DCC Chat buffer names."
+  "Format to use for DCC Chat buffer names."
   :group 'erc-dcc
   :type 'string)
 
 (defcustom erc-dcc-chat-mode-hook nil
-  "*Hook calls when `erc-dcc-chat-mode' finished setting up the buffer."
+  "Hook calls when `erc-dcc-chat-mode' finished setting up the buffer."
   :group 'erc-dcc
   :type 'hook)
 
@@ -1099,8 +1099,13 @@ Possible values are: ask, auto, ignore."
   (pcomplete-here '("auto" "ask" "ignore")))
 (defalias 'pcomplete/erc-mode/SREQ 'pcomplete/erc-mode/CREQ)
 
-(defvar erc-dcc-chat-filter-hook '(erc-dcc-chat-parse-output)
-  "*Hook to run after doing parsing (and possible insertion) of DCC messages.")
+(defvar erc-dcc-chat-filter-functions '(erc-dcc-chat-parse-output)
+  "Abnormal hook run after parsing (and maybe inserting) a DCC message.
+Each function is called with two arguments: the ERC process and
+the unprocessed output.")
+
+(define-obsolete-variable-alias 'erc-dcc-chat-filter-hook
+  'erc-dcc-chat-filter-functions "24.2")
 
 (defvar erc-dcc-chat-mode-map
   (let ((map (make-sparse-keymap)))
@@ -1195,8 +1200,8 @@ other client."
           (set-buffer (process-buffer proc))
           (setq erc-dcc-unprocessed-output
                 (concat erc-dcc-unprocessed-output str))
-          (run-hook-with-args 'erc-dcc-chat-filter-hook proc
-                           erc-dcc-unprocessed-output))
+          (run-hook-with-args 'erc-dcc-chat-filter-functions
+                              proc erc-dcc-unprocessed-output))
       (set-buffer orig-buffer))))
 
 (defun erc-dcc-chat-parse-output (proc str)
index bf74ed7be87fb4f9a322f0efdd1200b5bea6fdae..49820b78ff6273e59ab6c11acf792e3237dfb0e2 100644 (file)
@@ -183,7 +183,7 @@ themselves."
   :group 'erc)
 
 (defcustom erc-interpret-controls-p t
-  "*If non-nil, display IRC colors and other highlighting effects.
+  "If non-nil, display IRC colors and other highlighting effects.
 
 If this is set to the symbol `remove', ERC removes all IRC colors and
 highlighting effects.  When this variable is non-nil, it can cause Emacs to run
@@ -196,7 +196,7 @@ emergency (message flood) it can be turned off to save processing time.  See
                  (const :tag "Display raw control characters" nil)))
 
 (defcustom erc-interpret-mirc-color nil
-  "*If non-nil, ERC will interpret mIRC color codes."
+  "If non-nil, ERC will interpret mIRC color codes."
   :group 'erc-control-characters
   :type 'boolean)
 
@@ -206,112 +206,114 @@ The value `erc-interpret-controls-p' must also be t for this to work."
   :group 'erc-control-characters
   :type 'boolean)
 
-(defface erc-bold-face '((t (:bold t)))
+(defface erc-bold-face '((t :weight bold))
   "ERC bold face."
   :group 'erc-faces)
+
 (defface erc-inverse-face
-  '((t (:foreground "White" :background "Black")))
+  '((t :foreground "White" :background "Black"))
   "ERC inverse face."
   :group 'erc-faces)
-(defface erc-underline-face '((t (:underline t)))
+
+(defface erc-underline-face '((t :underline t))
   "ERC underline face."
   :group 'erc-faces)
 
-(defface fg:erc-color-face0 '((t (:foreground "White")))
+(defface fg:erc-color-face0 '((t :foreground "White"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face1 '((t (:foreground "black")))
+(defface fg:erc-color-face1 '((t :foreground "black"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face2 '((t (:foreground "blue4")))
+(defface fg:erc-color-face2 '((t :foreground "blue4"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face3 '((t (:foreground "green4")))
+(defface fg:erc-color-face3 '((t :foreground "green4"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face4 '((t (:foreground "red")))
+(defface fg:erc-color-face4 '((t :foreground "red"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face5 '((t (:foreground "brown")))
+(defface fg:erc-color-face5 '((t :foreground "brown"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face6 '((t (:foreground "purple")))
+(defface fg:erc-color-face6 '((t :foreground "purple"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face7 '((t (:foreground "orange")))
+(defface fg:erc-color-face7 '((t :foreground "orange"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face8 '((t (:foreground "yellow")))
+(defface fg:erc-color-face8 '((t :foreground "yellow"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face9 '((t (:foreground "green")))
+(defface fg:erc-color-face9 '((t :foreground "green"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face10 '((t (:foreground "lightblue1")))
+(defface fg:erc-color-face10 '((t :foreground "lightblue1"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face11 '((t (:foreground "cyan")))
+(defface fg:erc-color-face11 '((t :foreground "cyan"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face12 '((t (:foreground "blue")))
+(defface fg:erc-color-face12 '((t :foreground "blue"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face13 '((t (:foreground "deeppink")))
+(defface fg:erc-color-face13 '((t :foreground "deeppink"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face14 '((t (:foreground "gray50")))
+(defface fg:erc-color-face14 '((t :foreground "gray50"))
   "ERC face."
   :group 'erc-faces)
-(defface fg:erc-color-face15 '((t (:foreground "gray90")))
+(defface fg:erc-color-face15 '((t :foreground "gray90"))
   "ERC face."
   :group 'erc-faces)
 
-(defface bg:erc-color-face0 '((t (:background "White")))
+(defface bg:erc-color-face0 '((t :background "White"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face1 '((t (:background "black")))
+(defface bg:erc-color-face1 '((t :background "black"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face2 '((t (:background "blue4")))
+(defface bg:erc-color-face2 '((t :background "blue4"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face3 '((t (:background "green4")))
+(defface bg:erc-color-face3 '((t :background "green4"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face4 '((t (:background "red")))
+(defface bg:erc-color-face4 '((t :background "red"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face5 '((t (:background "brown")))
+(defface bg:erc-color-face5 '((t :background "brown"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face6 '((t (:background "purple")))
+(defface bg:erc-color-face6 '((t :background "purple"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face7 '((t (:background "orange")))
+(defface bg:erc-color-face7 '((t :background "orange"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face8 '((t (:background "yellow")))
+(defface bg:erc-color-face8 '((t :background "yellow"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face9 '((t (:background "green")))
+(defface bg:erc-color-face9 '((t :background "green"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face10 '((t (:background "lightblue1")))
+(defface bg:erc-color-face10 '((t :background "lightblue1"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face11 '((t (:background "cyan")))
+(defface bg:erc-color-face11 '((t :background "cyan"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face12 '((t (:background "blue")))
+(defface bg:erc-color-face12 '((t :background "blue"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face13 '((t (:background "deeppink")))
+(defface bg:erc-color-face13 '((t :background "deeppink"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face14 '((t (:background "gray50")))
+(defface bg:erc-color-face14 '((t :background "gray50"))
   "ERC face."
   :group 'erc-faces)
-(defface bg:erc-color-face15 '((t (:background "gray90")))
+(defface bg:erc-color-face15 '((t :background "gray90"))
   "ERC face."
   :group 'erc-faces)
 
index da894ba5977ea9e61bf348cabeddd41823d8e76b..85d1edf6427806c49c14ed028b8bfdf34b159829 100644 (file)
@@ -32,6 +32,7 @@
 ;;; Code:
 
 (require 'erc)
+(require 'auth-source)
 (eval-when-compile (require 'cl))
 
 (defgroup erc-autojoin nil
@@ -56,6 +57,13 @@ Every element in the alist has the form (SERVER . CHANNELS).
 SERVER is a regexp matching the server, and channels is the
 list of channels to join.
 
+If the channel(s) require channel keys for joining, the passwords
+are found via auth-source.  For instance, if you use ~/.authinfo
+as your auth-source backend, then put something like the
+following in that file:
+
+machine irc.example.net login \"#fsf\" password sEcReT
+
 Customize this variable to set the value for your first connect.
 Once you are connected and join and part channels, this alist
 keeps track of what channels you are on, and will join them
@@ -131,7 +139,7 @@ This function is run from `erc-nickserv-identified-hook'."
        (when (string-match (car l) server)
          (dolist (chan (cdr l))
            (unless (erc-member-ignore-case chan joined)
-             (erc-server-send (concat "join " chan))))))))
+             (erc-server-join-channel server chan)))))))
   nil)
 
 (defun erc-autojoin-channels (server nick)
@@ -148,10 +156,25 @@ This function is run from `erc-nickserv-identified-hook'."
     (dolist (l erc-autojoin-channels-alist)
       (when (string-match (car l) server)
        (dolist (chan (cdr l))
-         (erc-server-send (concat "join " chan))))))
+         (erc-server-join-channel server chan)))))
   ;; Return nil to avoid stomping on any other hook funcs.
   nil)
 
+(defun erc-server-join-channel (server channel)
+  (let* ((secret (plist-get (nth 0 (auth-source-search
+                                   :max 1
+                                   :host server
+                                   :port "irc"
+                                   :user channel))
+                           :secret))
+        (password (if (functionp secret)
+                      (funcall secret)
+                    secret)))
+    (erc-server-send (concat "join " channel
+                            (if password
+                                (concat " " password)
+                              "")))))
+
 (defun erc-autojoin-add (proc parsed)
   "Add the channel being joined to `erc-autojoin-channels-alist'."
   (let* ((chnl (erc-response.contents parsed))
index 9f50a1d117c34ed12d2e920b88182d384a8c9f61..eefe51ae706ba4b2efae2165c089afb61ca9ef1f 100644 (file)
   :group 'erc)
 
 (defcustom erc-generate-log-file-name-function 'erc-generate-log-file-name-long
-  "*A function to generate a log filename.
+  "A function to generate a log filename.
 The function must take five arguments: BUFFER, TARGET, NICK, SERVER and PORT.
 BUFFER is the buffer to be saved,
 TARGET is the name of the channel, or the target of the query,
@@ -157,12 +157,12 @@ arguments."
                 (const :tag "Disable logging" nil)))
 
 (defcustom erc-log-insert-log-on-open nil
-  "*Insert log file contents into the buffer if a log file exists."
+  "Insert log file contents into the buffer if a log file exists."
   :group 'erc-log
   :type 'boolean)
 
 (defcustom erc-save-buffer-on-part t
-  "*Save the channel buffer content using `erc-save-buffer-in-logs' on PART.
+  "Save the channel buffer content using `erc-save-buffer-in-logs' on PART.
 
 If you set this to nil, you may want to enable both
 `erc-log-write-after-send' and `erc-log-write-after-insert'."
@@ -170,7 +170,7 @@ If you set this to nil, you may want to enable both
   :type 'boolean)
 
 (defcustom erc-save-queries-on-quit t
-  "*Save all query (also channel) buffers of the server on QUIT.
+  "Save all query (also channel) buffers of the server on QUIT.
 
 If you set this to nil, you may want to enable both
 `erc-log-write-after-send' and `erc-log-write-after-insert'."
@@ -178,7 +178,7 @@ If you set this to nil, you may want to enable both
   :type 'boolean)
 
 (defcustom erc-log-write-after-send nil
-  "*If non-nil, write to log file after every message you send.
+  "If non-nil, write to log file after every message you send.
 
 If you set this to nil, you may want to enable both
 `erc-save-buffer-on-part' and `erc-save-queries-on-quit'."
@@ -186,7 +186,7 @@ If you set this to nil, you may want to enable both
   :type 'boolean)
 
 (defcustom erc-log-write-after-insert nil
-  "*If non-nil, write to log file when new text is added to a
+  "If non-nil, write to log file when new text is added to a
 logged ERC buffer.
 
 If you set this to nil, you may want to enable both
@@ -197,14 +197,14 @@ If you set this to nil, you may want to enable both
 (defcustom erc-log-file-coding-system (if (featurep 'xemacs)
                                          'binary
                                        'emacs-mule)
-  "*The coding system ERC should use for writing log files.
+  "The coding system ERC should use for writing log files.
 
 This should ideally, be a \"catch-all\" coding system, like
 `emacs-mule', or `iso-2022-7bit'."
   :group 'erc-log)
 
 (defcustom erc-log-filter-function nil
-  "*If non-nil, pass text through the given function before writing it to
+  "If non-nil, pass text through the given function before writing it to
 a log file.
 
 The function should take one argument, which is the text to filter."
index 2a61247307f1f32d56c6ccbfbeda61f1f2c84789..9fbe954467750f5bcc9862388a5bc5a5f0fa78a1 100644 (file)
@@ -83,7 +83,7 @@ Useful to mark nicks from dangerous hosts."
   :type '(repeat regexp))
 
 (defcustom erc-current-nick-highlight-type 'keyword
-  "*Determines how to highlight text in which your current nickname appears
+  "Determines how to highlight text in which your current nickname appears
 \(does not apply to text sent by you\).
 
 The following values are allowed:
@@ -105,7 +105,7 @@ Any other value disables highlighting of current nickname altogether."
                 (const all)))
 
 (defcustom erc-pal-highlight-type 'nick
-  "*Determines how to highlight messages by pals.
+  "Determines how to highlight messages by pals.
 See `erc-pals'.
 
 The following values are allowed:
@@ -121,7 +121,7 @@ Any other value disables pal highlighting altogether."
                 (const all)))
 
 (defcustom erc-fool-highlight-type 'nick
-  "*Determines how to highlight messages by fools.
+  "Determines how to highlight messages by fools.
 See `erc-fools'.
 
 The following values are allowed:
@@ -137,7 +137,7 @@ Any other value disables fool highlighting altogether."
                 (const all)))
 
 (defcustom erc-keyword-highlight-type 'keyword
-  "*Determines how to highlight messages containing keywords.
+  "Determines how to highlight messages containing keywords.
 See variable `erc-keywords'.
 
 The following values are allowed:
@@ -152,7 +152,7 @@ Any other value disables keyword highlighting altogether."
                 (const all)))
 
 (defcustom erc-dangerous-host-highlight-type 'nick
-  "*Determines how to highlight messages by nicks from dangerous-hosts.
+  "Determines how to highlight messages by nicks from dangerous-hosts.
 See `erc-dangerous-hosts'.
 
 The following values are allowed:
@@ -258,26 +258,26 @@ constituents.")
 
 ;; Faces:
 
-(defface erc-current-nick-face '((t (:bold t :foreground "DarkTurquoise")))
+(defface erc-current-nick-face '((t :weight bold :foreground "DarkTurquoise"))
   "ERC face for occurrences of your current nickname."
   :group 'erc-faces)
 
-(defface erc-dangerous-host-face '((t (:foreground "red")))
+(defface erc-dangerous-host-face '((t :foreground "red"))
   "ERC face for people on dangerous hosts.
 See `erc-dangerous-hosts'."
   :group 'erc-faces)
 
-(defface erc-pal-face '((t (:bold t :foreground "Magenta")))
+(defface erc-pal-face '((t :weight bold :foreground "Magenta"))
   "ERC face for your pals.
 See `erc-pals'."
   :group 'erc-faces)
 
-(defface erc-fool-face '((t (:foreground "dim gray")))
+(defface erc-fool-face '((t :foreground "dim gray"))
   "ERC face for fools on the channel.
 See `erc-fools'."
   :group 'erc-faces)
 
-(defface erc-keyword-face '((t (:bold t :foreground "pale green")))
+(defface erc-keyword-face '((t :weight bold :foreground "pale green"))
   "ERC face for your keywords.
 Note that this is the default face to use if
 `erc-keywords' does not specify another."
index d1a33405765d31f6c45810dc937da55b6c4cdd8f..3bf82c13f19728879081fcf0c06cf7e0e75e9a74 100644 (file)
   :group 'erc)
 
 (defcustom erc-notify-list nil
-  "*List of nicknames you want to be notified about online/offline
+  "List of nicknames you want to be notified about online/offline
 status change."
   :group 'erc-notify
   :type '(repeat string))
 
 (defcustom erc-notify-interval 60
-  "*Time interval (in seconds) for checking online status of notified
+  "Time interval (in seconds) for checking online status of notified
 people."
   :group 'erc-notify
   :type 'integer)
 
 (defcustom erc-notify-signon-hook nil
-  "*Hook run after someone on `erc-notify-list' has signed on.
+  "Hook run after someone on `erc-notify-list' has signed on.
 Two arguments are passed to the function, SERVER and NICK, both
 strings."
   :group 'erc-notify
@@ -60,7 +60,7 @@ strings."
   :options '(erc-notify-signon))
 
 (defcustom erc-notify-signoff-hook nil
-  "*Hook run after someone on `erc-notify-list' has signed off.
+  "Hook run after someone on `erc-notify-list' has signed off.
 Two arguments are passed to the function, SERVER and NICK, both
 strings."
   :group 'erc-notify
index ba27b0374aa39d6207dcfbd524c483378da1dba5..d3cbe8a580430d9efa4e706757727f223bc61a09 100644 (file)
@@ -49,7 +49,7 @@
   :group 'erc)
 
 (defcustom erc-pcomplete-nick-postfix ":"
-  "*When `pcomplete' is used in the first word after the prompt,
+  "When `pcomplete' is used in the first word after the prompt,
 add this string to nicks completed."
   :group 'erc-pcomplete
   :type 'string)
index 66eb341b47aaa36dfad0f3c59d7026e07541f606..5986d81efed234511975a7f4e01b4d0ab6401d59 100644 (file)
@@ -195,7 +195,8 @@ Example of use:
                (repeat :tag "Nickname and password"
                        (cons :tag "Identity"
                              (string :tag "Nick")
-                             (string :tag "Password"))))))
+                             (string :tag "Password"
+                                      :secret ?*))))))
 
 ;; Variables:
 
index 569abad2a08a8f45eb2358c4c043b987ff37dbd0..8b44cb5146c8cca22f710df9d7ba761440e04184 100644 (file)
@@ -62,7 +62,7 @@ and play sound files as requested."
   :group 'erc)
 
 (defcustom erc-play-sound t
-  "*Play sounds when you receive CTCP SOUND requests."
+  "Play sounds when you receive CTCP SOUND requests."
   :group 'erc-sound
   :type 'boolean)
 
index e02b045ebd2bf2a091b8447ef6da4a162b015264..5831233affedca012b2f32013d1d5c87fb3e49f6 100644 (file)
@@ -47,7 +47,7 @@ in your .emacs file or interactively using `load-library'."
   :group 'erc)
 
 (defcustom erc-timestamp-format "[%H:%M]"
-  "*If set to a string, messages will be timestamped.
+  "If set to a string, messages will be timestamped.
 This string is processed using `format-time-string'.
 Good examples are \"%T\" and \"%H:%M\".
 
@@ -57,7 +57,7 @@ If nil, timestamping is turned off."
                 (string)))
 
 (defcustom erc-timestamp-format-left "\n[%a %b %e %Y]\n"
-  "*If set to a string, messages will be timestamped.
+  "If set to a string, messages will be timestamped.
 This string is processed using `format-time-string'.
 Good examples are \"%T\" and \"%H:%M\".
 
@@ -71,7 +71,7 @@ If nil, timestamping is turned off."
                 (string)))
 
 (defcustom erc-timestamp-format-right " [%H:%M]"
-  "*If set to a string, messages will be timestamped.
+  "If set to a string, messages will be timestamped.
 This string is processed using `format-time-string'.
 Good examples are \"%T\" and \"%H:%M\".
 
@@ -85,7 +85,7 @@ If nil, timestamping is turned off."
                 (string)))
 
 (defcustom erc-insert-timestamp-function 'erc-insert-timestamp-left-and-right
-  "*Function to use to insert timestamps.
+  "Function to use to insert timestamps.
 
 It takes a single argument STRING which is the final string
 which all text-properties already appended.  This function only cares about
@@ -102,7 +102,7 @@ You will probably want to set
                 function))
 
 (defcustom erc-away-timestamp-format "<%H:%M>"
-  "*Timestamp format used when marked as being away.
+  "Timestamp format used when marked as being away.
 
 If nil, timestamping is turned off when away unless `erc-timestamp-format'
 is set.
@@ -114,7 +114,7 @@ If `erc-timestamp-format' is set, this will not be used."
 
 (defcustom erc-insert-away-timestamp-function
   'erc-insert-timestamp-left-and-right
-  "*Function to use to insert the away timestamp.
+  "Function to use to insert the away timestamp.
 
 See `erc-insert-timestamp-function' for details."
   :group 'erc-stamp
@@ -124,7 +124,7 @@ See `erc-insert-timestamp-function' for details."
                 function))
 
 (defcustom erc-hide-timestamps nil
-  "*If non-nil, timestamps will be invisible.
+  "If non-nil, timestamps will be invisible.
 
 This is useful for logging, because, although timestamps will be
 hidden, they will still be present in the logs."
@@ -132,7 +132,7 @@ hidden, they will still be present in the logs."
   :type 'boolean)
 
 (defcustom erc-echo-timestamps nil
-  "*If non-nil, print timestamp in the minibuffer when point is moved.
+  "If non-nil, print timestamp in the minibuffer when point is moved.
 Using this variable, you can turn off normal timestamping,
 and simply move point to an irc message to see its timestamp
 printed in the minibuffer."
@@ -140,19 +140,19 @@ printed in the minibuffer."
   :type 'boolean)
 
 (defcustom erc-echo-timestamp-format "Timestamped %A, %H:%M:%S"
-  "*Format string to be used when `erc-echo-timestamps' is non-nil.
+  "Format string to be used when `erc-echo-timestamps' is non-nil.
 This string specifies the format of the timestamp being echoed in
 the minibuffer."
   :group 'erc-stamp
   :type 'string)
 
 (defcustom erc-timestamp-intangible t
-  "*Whether the timestamps should be intangible, i.e. prevent the point
+  "Whether the timestamps should be intangible, i.e. prevent the point
 from entering them and instead jump over them."
   :group 'erc-stamp
   :type 'boolean)
 
-(defface erc-timestamp-face '((t (:bold t :foreground "green")))
+(defface erc-timestamp-face '((t :weight bold :foreground "green"))
   "ERC timestamp face."
   :group 'erc-faces)
 
@@ -205,7 +205,7 @@ This is used when `erc-insert-timestamp-function' is set to
 (make-variable-buffer-local 'erc-timestamp-last-inserted-right)
 
 (defcustom erc-timestamp-only-if-changed-flag t
-  "*Insert timestamp only if its value changed since last insertion.
+  "Insert timestamp only if its value changed since last insertion.
 If `erc-insert-timestamp-function' is `erc-insert-timestamp-left', a
 string of spaces which is the same size as the timestamp is added to
 the beginning of the line in its place. If you use
@@ -215,7 +215,7 @@ timestamp."
   :type 'boolean)
 
 (defcustom erc-timestamp-right-column nil
-  "*If non-nil, the column at which the timestamp is inserted,
+  "If non-nil, the column at which the timestamp is inserted,
 if the timestamp is to be printed to the right.  If nil,
 `erc-insert-timestamp-right' will use other means to determine
 the correct column."
@@ -227,7 +227,7 @@ the correct column."
 (defcustom erc-timestamp-use-align-to (and (not (featurep 'xemacs))
                                           (>= emacs-major-version 22)
                                           (eq window-system 'x))
-  "*If non-nil, use the :align-to display property to align the stamp.
+  "If non-nil, use the :align-to display property to align the stamp.
 This gives better results when variable-width characters (like
 Asian language characters and math symbols) precede a timestamp.
 Unfortunately, it only works in Emacs 22 and when using the X
index ac899302c3c3707bcde790afe91daff0ab29bd09..9c56c72422443f7c55a533078901aa1a0b468a24 100644 (file)
@@ -41,7 +41,7 @@
 ;;; Code:
 
 (defgroup erc-track nil
-  "Track active buffers and show activity in the modeline."
+  "Track active buffers and show activity in the mode line."
   :group 'erc)
 
 (defcustom erc-track-enable-keybindings 'ask
@@ -93,13 +93,13 @@ Activity means that there was no user input in the last 10 seconds."
   :type '(repeat string))
 
 (defcustom erc-track-remove-disconnected-buffers nil
-  "*If true, remove buffers associated with a server that is
+  "If true, remove buffers associated with a server that is
 disconnected from `erc-modified-channels-alist'."
   :group 'erc-track
   :type 'boolean)
 
 (defcustom erc-track-exclude-types '("NICK" "333" "353")
-  "*List of message types to be ignored.
+  "List of message types to be ignored.
 This list could look like '(\"JOIN\" \"PART\").
 
 By default, exclude changes of nicknames (NICK), display of who
@@ -109,7 +109,7 @@ channel (353)."
   :type 'erc-message-type)
 
 (defcustom erc-track-exclude-server-buffer nil
-  "*If true, don't perform tracking on the server buffer; this is
+  "If true, don't perform tracking on the server buffer; this is
 useful for excluding all the things like MOTDs from the server and
 other miscellaneous functions."
   :group 'erc-track
@@ -127,7 +127,7 @@ the mode-line should be reduced to."
   :type 'number)
 
 (defcustom erc-track-shorten-aggressively nil
-  "*If non-nil, channel names will be shortened more aggressively.
+  "If non-nil, channel names will be shortened more aggressively.
 Usually, names are not shortened if this will save only one character.
 Example: If there are two channels, #linux-de and #linux-fr, then
 normally these will not be shortened.  When shortening aggressively,
@@ -150,7 +150,7 @@ This setting is used by `erc-track-shorten-names'."
                 (const :tag "Max" max)))
 
 (defcustom erc-track-shorten-function 'erc-track-shorten-names
-  "*This function will be used to reduce the channel names before display.
+  "This function will be used to reduce the channel names before display.
 It takes one argument, CHANNEL-NAMES which is a list of strings.
 It should return a list of strings of the same number of elements.
 If nil instead of a function, shortening is disabled."
@@ -169,7 +169,7 @@ notification of channel activity."
   :type 'hook)
 
 (defcustom erc-track-use-faces t
-  "*Use faces in the mode-line.
+  "Use faces in the mode-line.
 The faces used are the same as used for text in the buffers.
 \(e.g. `erc-pal-face' is used if a pal sent a message to that channel.)"
   :group 'erc-track
@@ -196,7 +196,7 @@ The faces used are the same as used for text in the buffers.
     erc-notice-face
     erc-input-face
     erc-prompt-face)
-  "A list of faces used to highlight active buffer names in the modeline.
+  "A list of faces used to highlight active buffer names in the mode line.
 If a message contains one of the faces in this list, the buffer name will
 be highlighted using that face.  The first matching face is used."
   :group 'erc-track
@@ -228,10 +228,10 @@ setting this variable might not be very useful."
     erc-default-face
     erc-action-face)
   "A list of faces considered to be part of normal conversations.
-This list is used to highlight active buffer names in the modeline.
+This list is used to highlight active buffer names in the mode line.
 
 If a message contains one of the faces in this list, and the
-previous modeline face for this buffer is also in this list, then
+previous mode line face for this buffer is also in this list, then
 the buffer name will be highlighted using the face from the
 message.  This gives a rough indication that active conversations
 are occurring in these channels.
@@ -872,7 +872,7 @@ Use `erc-make-mode-line-buffer-name' to create buttons."
     (erc-modified-channels-display)))
 
 (defun erc-track-find-face (faces)
-  "Return the face to use in the modeline from the faces in FACES.
+  "Return the face to use in the mode line from the faces in FACES.
 If `erc-track-faces-priority-list' is set, the one from FACES who
 is first in that list will be used.  If nothing matches or if
 `erc-track-faces-priority-list' is not set, the default mode-line
@@ -906,7 +906,7 @@ element."
 
 (defun erc-track-modified-channels ()
   "Hook function for `erc-insert-post-hook' to check if the current
-buffer should be added to the modeline as a hidden, modified
+buffer should be added to the mode line as a hidden, modified
 channel.  Assumes it will only be called when current-buffer
 is in `erc-mode'."
   (let ((this-channel (or (erc-default-target)
index 6aa4e718d0a19df25fb8fb501a5efc3046e85ab4..dd47c601ea896af64bc5d19305b66e72dec05f22 100644 (file)
@@ -36,7 +36,7 @@
   :group 'erc)
 
 (defcustom erc-max-buffer-size 30000
-  "*Maximum size in chars of each ERC buffer.
+  "Maximum size in chars of each ERC buffer.
 Used only when auto-truncation is enabled.
 \(see `erc-truncate-buffer' and `erc-insert-post-hook')."
   :group 'erc-truncate
index 98e26dd9af01aaddc5224b9b76d9fac273372a96..0328c407aa0b83e4e407a4b67a1a14e94d006a5f 100644 (file)
 (require 'erc-dcc)
 
 (defcustom erc-xdcc-files nil
-  "*List of files to offer via XDCC.
+  "List of files to offer via XDCC.
 Your friends should issue \"/ctcp yournick XDCC list\" to see this."
   :group 'erc-dcc
   :type '(repeat file))
 
 (defcustom erc-xdcc-verbose-flag t
-  "*Report XDCC CTCP requests in the server buffer."
+  "Report XDCC CTCP requests in the server buffer."
   :group 'erc-dcc
   :type 'boolean)
 
@@ -43,7 +43,7 @@ Your friends should issue \"/ctcp yournick XDCC list\" to see this."
   '(("help" . erc-xdcc-help)
     ("list" . erc-xdcc-list)
     ("send" . erc-xdcc-send))
-  "*Sub-command handler alist for XDCC CTCP queries."
+  "Sub-command handler alist for XDCC CTCP queries."
   :group 'erc-dcc
   :type '(alist :key-type (string :tag "Sub-command") :value-type function))
 
@@ -54,7 +54,7 @@ Your friends should issue \"/ctcp yournick XDCC list\" to see this."
     ("Type \"/ctcp " (erc-current-nick)
      " XDCC list\" to see the list of offered files, then type \"/ctcp "
      (erc-current-nick) " XDCC send #\" to get a particular file number."))
-  "*Help text sent in response to XDCC help command.
+  "Help text sent in response to XDCC help command.
 A list of messages, each consisting of strings and expressions, expressions
 being evaluated and should return strings."
   :group 'erc-dcc
index b95d42b154a60284927e64947888ce2eea3cbbf1..0fc308621b12d1a9957fca0ba559f76a91890780 100644 (file)
@@ -71,6 +71,7 @@
 (require 'font-lock)
 (require 'pp)
 (require 'thingatpt)
+(require 'auth-source)
 (require 'erc-compat)
 
 (defvar erc-official-location
@@ -255,7 +256,7 @@ If nil, only \"> \" will be shown."
          (repeat :inline t :tag "Others" (string :tag "IRC Message Type"))))
 
 (defcustom erc-hide-list nil
-  "*List of IRC type messages to hide.
+  "List of IRC type messages to hide.
 A typical value would be '(\"JOIN\" \"PART\" \"QUIT\")."
   :group 'erc-ignore
   :type 'erc-message-type)
@@ -653,12 +654,12 @@ This only has any meaning if the variable `erc-command-indicator' is non-nil."
             prompt))))
 
 (defcustom erc-notice-prefix "*** "
-  "*Prefix for all notices."
+  "Prefix for all notices."
   :group 'erc-display
   :type 'string)
 
 (defcustom erc-notice-highlight-type 'all
-  "*Determines how to highlight notices.
+  "Determines how to highlight notices.
 See `erc-notice-prefix'.
 
 The following values are allowed:
@@ -673,7 +674,7 @@ Any other value disables notice's highlighting altogether."
                 (const :tag "don't highlight notices at all" nil)))
 
 (defcustom erc-echo-notice-hook nil
-  "*Specifies a list of functions to call to echo a private
+  "Specifies a list of functions to call to echo a private
 notice.  Each function is called with four arguments, the string
 to display, the parsed server message, the target buffer (or
 nil), and the sender.  The functions are called in order, until a
@@ -704,7 +705,7 @@ See also: `erc-echo-notice-always-hook',
 
 (defcustom erc-echo-notice-always-hook
   '(erc-echo-notice-in-default-buffer)
-  "*Specifies a list of functions to call to echo a private
+  "Specifies a list of functions to call to echo a private
 notice.  Each function is called with four arguments, the string
 to display, the parsed server message, the target buffer (or
 nil), and the sender.  The functions are called in order, and all
@@ -736,17 +737,17 @@ See also: `erc-echo-notice-hook',
 ;; other tunable parameters
 
 (defcustom erc-whowas-on-nosuchnick nil
-  "*If non-nil, do a whowas on a nick if no such nick."
+  "If non-nil, do a whowas on a nick if no such nick."
   :group 'erc
   :type 'boolean)
 
 (defcustom erc-verbose-server-ping nil
-  "*If non-nil, show every time you get a PING or PONG from the server."
+  "If non-nil, show every time you get a PING or PONG from the server."
   :group 'erc-paranoia
   :type 'boolean)
 
 (defcustom erc-public-away-p nil
-  "*Let others know you are back when you are no longer marked away.
+  "Let others know you are back when you are no longer marked away.
 This happens in this form:
 * <nick> is back (gone for <time>)
 
@@ -755,7 +756,7 @@ Many consider it impolite to do so automatically."
   :type 'boolean)
 
 (defcustom erc-away-nickname nil
-  "*The nickname to take when you are marked as being away."
+  "The nickname to take when you are marked as being away."
   :group 'erc
   :type '(choice (const nil)
                 string))
@@ -796,7 +797,7 @@ If nil, ERC will call `system-name' to get this information."
                 string))
 
 (defcustom erc-ignore-list nil
-  "*List of regexps matching user identifiers to ignore.
+  "List of regexps matching user identifiers to ignore.
 
 A user identifier has the form \"nick!login@host\".  If an
 identifier matches, the message from the person will not be
@@ -806,7 +807,7 @@ processed."
 (make-variable-buffer-local 'erc-ignore-list)
 
 (defcustom erc-ignore-reply-list nil
-  "*List of regexps matching user identifiers to ignore completely.
+  "List of regexps matching user identifiers to ignore completely.
 
 This differs from `erc-ignore-list' in that it also ignores any
 messages directed at the user.
@@ -824,7 +825,7 @@ people.  You can update the ERC internal info using /WHO *."
   :type '(repeat regexp))
 
 (defvar erc-flood-protect t
-  "*If non-nil, flood protection is enabled.
+  "If non-nil, flood protection is enabled.
 Flooding is sending too much information to the server in too
 short of an interval, which may cause the server to terminate the
 connection.
@@ -854,7 +855,7 @@ directory in the list."
   :type '(repeat directory))
 
 (defcustom erc-script-echo t
-  "*If non-nil, echo the IRC script commands locally."
+  "If non-nil, echo the IRC script commands locally."
   :group 'erc-scripts
   :type 'boolean)
 
@@ -929,7 +930,7 @@ will be used as the part message."
   :type '(repeat (list regexp (choice (string) (function)))))
 
 (defcustom erc-quit-reason 'erc-quit-reason-normal
-  "*A function which returns the reason for quitting.
+  "A function which returns the reason for quitting.
 
 The function is passed a single argument, the string typed by the
 user after \"/quit\"."
@@ -1140,61 +1141,58 @@ which the local user typed."
   "ERC default face."
   :group 'erc-faces)
 
-(defface erc-direct-msg-face '((t (:foreground "IndianRed")))
+(defface erc-direct-msg-face '((t :foreground "IndianRed"))
   "ERC face used for messages you receive in the main erc buffer."
   :group 'erc-faces)
 
 (defface erc-header-line
-  '((t (:foreground "grey20" :background "grey90")))
+  '((t :foreground "grey20" :background "grey90"))
   "ERC face used for the header line.
 
 This will only be used if `erc-header-line-face-method' is non-nil."
   :group 'erc-faces)
 
-(defface erc-input-face '((t (:foreground "brown")))
+(defface erc-input-face '((t :foreground "brown"))
   "ERC face used for your input."
   :group 'erc-faces)
 
 (defface erc-prompt-face
-  '((t (:bold t :foreground "Black" :background "lightBlue2")))
+  '((t :weight bold :foreground "Black" :background "lightBlue2"))
   "ERC face for the prompt."
   :group 'erc-faces)
 
 (defface erc-command-indicator-face
-    '((t (:bold t)))
+  '((t :weight bold))
   "ERC face for the command indicator.
 See the variable `erc-command-indicator'."
   :group 'erc-faces)
 
 (defface erc-notice-face
-  (if (or (featurep 'xemacs)
-         (< emacs-major-version 22))
-      '((t (:bold t :foreground "blue")))
-    '((((class color) (min-colors 88))
-       (:bold t :foreground "SlateBlue"))
-      (t (:bold t :foreground "blue"))))
+  '((default :weight bold)
+    (((class color) (min-colors 88)) :foreground "SlateBlue")
+    (t :foreground "blue"))
   "ERC face for notices."
   :group 'erc-faces)
 
-(defface erc-action-face '((t (:bold t)))
+(defface erc-action-face '((t :weight bold))
   "ERC face for actions generated by /ME."
   :group 'erc-faces)
 
-(defface erc-error-face '((t (:foreground "red")))
+(defface erc-error-face '((t :foreground "red"))
   "ERC face for errors."
   :group 'erc-faces)
 
 ;; same default color as `erc-input-face'
-(defface erc-my-nick-face '((t (:bold t :foreground "brown")))
+(defface erc-my-nick-face '((t :weight bold :foreground "brown"))
   "ERC face for your current nickname in messages sent by you.
 See also `erc-show-my-nick'."
   :group 'erc-faces)
 
-(defface erc-nick-default-face '((t (:bold t)))
+(defface erc-nick-default-face '((t :weight bold))
   "ERC nickname default face."
   :group 'erc-faces)
 
-(defface erc-nick-msg-face '((t (:bold t :foreground "IndianRed")))
+(defface erc-nick-msg-face '((t :weight bold :foreground "IndianRed"))
   "ERC nickname face for private messages."
   :group 'erc-faces)
 
@@ -1480,7 +1478,7 @@ The available choices are:
                 (const :tag "Use current buffer" t)))
 
 (defcustom erc-frame-alist nil
-  "*Alist of frame parameters for creating erc frames.
+  "Alist of frame parameters for creating erc frames.
 A value of nil means to use `default-frame-alist'."
   :group 'erc-buffers
   :type '(repeat (cons :format "%v"
@@ -1488,13 +1486,13 @@ A value of nil means to use `default-frame-alist'."
                       (sexp :tag "Value"))))
 
 (defcustom erc-frame-dedicated-flag nil
-  "*Non-nil means the erc frames are dedicated to that buffer.
+  "Non-nil means the erc frames are dedicated to that buffer.
 This only has effect when `erc-join-buffer' is set to `frame'."
   :group 'erc-buffers
   :type 'boolean)
 
 (defcustom erc-reuse-frames t
-  "*Determines whether new frames are always created.
+  "Determines whether new frames are always created.
 Non-nil means that a new frame is not created to display an ERC
 buffer if there is already a window displaying it.  This only has
 effect when `erc-join-buffer' is set to `frame'."
@@ -1511,7 +1509,7 @@ effect when `erc-join-buffer' is set to `frame'."
        (t nil)))
 
 (defcustom erc-reuse-buffers t
-  "*If nil, create new buffers on joining a channel/query.
+  "If nil, create new buffers on joining a channel/query.
 If non-nil, a new buffer will only be created when you join
 channels with same names on different servers, or have query buffers
 open with nicks of the same name on different servers.  Otherwise,
@@ -2009,7 +2007,19 @@ Returns the buffer for the given server or channel."
     ;; The local copy of `erc-nick' - the list of nicks to choose
     (setq erc-default-nicks (if (consp erc-nick) erc-nick (list erc-nick)))
     ;; password stuff
-    (setq erc-session-password passwd)
+    (setq erc-session-password (or passwd
+                                  (let ((secret
+                                         (plist-get
+                                          (nth 0
+                                               (auth-source-search :host server
+                                                                   :max 1
+                                                                   :user nick
+                                                                   :port port
+                                                                   :require '(:secret)))
+                                          :secret)))
+                                    (if (functionp secret)
+                                        (funcall secret)
+                                      secret))))
     ;; debug output buffer
     (setq erc-dbuf
          (when erc-log-p
@@ -2616,7 +2626,7 @@ VALUE is computed by evaluating the rest of LINE in Lisp."
                           (if (consp val)
                               (concat "\n" (pp-to-string val))
                             (format " %S\n" val)))))
-              (apropos-internal "^erc-" 'user-variable-p))))
+              (apropos-internal "^erc-" 'custom-variable-p))))
      (current-buffer)) t)
    (t nil)))
 (defalias 'erc-cmd-VAR 'erc-cmd-SET)
@@ -3646,6 +3656,7 @@ If FACE is non-nil, it will be used to propertize the prompt.  If it is nil,
                                     'start-open t ; XEmacs
                                     'rear-nonsticky t ; Emacs
                                     'erc-prompt t
+                                    'field t
                                     'front-sticky t
                                     'read-only t))
        (erc-put-text-property 0 (1- (length prompt))
@@ -3799,7 +3810,7 @@ This places `point' just after the prompt, or at the beginning of the line."
 
 (defcustom erc-default-server-hook '(erc-debug-missing-hooks
                                     erc-default-server-handler)
-  "*Default for server messages which aren't covered by `erc-server-hooks'."
+  "Default for server messages which aren't covered by `erc-server-hooks'."
   :group 'erc-server-hooks
   :type 'hook)
 
@@ -4017,7 +4028,7 @@ and as second argument the event parsed as a vector."
     str))
 
 (defcustom erc-format-nick-function 'erc-format-nick
-  "*Function to format a nickname for message display."
+  "Function to format a nickname for message display."
   :group 'erc-display
   :type 'function)
 
@@ -4575,7 +4586,7 @@ channel."
     (run-hooks 'erc-channel-members-changed-hook)))
 
 (defcustom erc-channel-members-changed-hook nil
-  "*This hook is called every time the variable `channel-members' changes.
+  "This hook is called every time the variable `channel-members' changes.
 The buffer where the change happened is current while this hook is called."
   :group 'erc-hooks
   :type 'hook)
@@ -6386,17 +6397,17 @@ See also `format-spec'."
 (add-hook 'kill-buffer-hook 'erc-kill-buffer-function)
 
 (defcustom erc-kill-server-hook '(erc-kill-server)
-  "*Invoked whenever a server-buffer is killed via `kill-buffer'."
+  "Invoked whenever a server-buffer is killed via `kill-buffer'."
   :group 'erc-hooks
   :type 'hook)
 
 (defcustom erc-kill-channel-hook '(erc-kill-channel)
-  "*Invoked whenever a channel-buffer is killed via `kill-buffer'."
+  "Invoked whenever a channel-buffer is killed via `kill-buffer'."
   :group 'erc-hooks
   :type 'hook)
 
 (defcustom erc-kill-buffer-hook nil
-  "*Hook run whenever a non-server or channel buffer is killed.
+  "Hook run whenever a non-server or channel buffer is killed.
 
 See also `kill-buffer'."
   :group 'erc-hooks
index d45f918113d7e62be46effbef1425fcb8488d5c2..4b62fec95e6e13145ac7e6aa63dbbd9b3679ed00 100644 (file)
 (require 'eshell)
 
 ;;;###autoload
-(eshell-defgroup eshell-alias nil
+(progn
+(defgroup eshell-alias nil
   "Command aliases allow for easy definition of alternate commands."
   :tag "Command aliases"
   ;; :link '(info-link "(eshell)Command aliases")
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 (defcustom eshell-aliases-file (expand-file-name "alias" eshell-directory-name)
   "The file in which aliases are kept.
index a96a3dfe6af94e18578b4d0075809c9cd97953f3..8fdad66f3f03a8e85f92b0a5cf2fb5d6226dd020 100644 (file)
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'esh-mode)
   (require 'eshell))
 
 (require 'esh-util)
 
 ;;;###autoload
-(eshell-defgroup eshell-banner nil
+(progn
+(defgroup eshell-banner nil
   "This sample module displays a welcome banner at login.
 It exists so that others wishing to create their own Eshell extension
 modules may have a simple template to begin with."
   :tag "Login banner"
   ;; :link '(info-link "(eshell)Login banner")
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
@@ -76,10 +77,10 @@ This can be any sexp, and should end with at least two newlines."
   ;; `insert', because `insert' doesn't know how to interact with the
   ;; I/O code used by Eshell
   (unless eshell-non-interactive-p
-    (assert eshell-mode)
-    (assert eshell-banner-message)
+    (cl-assert eshell-mode)
+    (cl-assert eshell-banner-message)
     (let ((msg (eval eshell-banner-message)))
-      (assert msg)
+      (cl-assert msg)
       (eshell-interactive-print msg))))
 
 (provide 'em-banner)
index ece029c39f213b7d3c3ab7ec705f03af248aec67..e07bc75f89adc02a1d2168c45e5e875c15995516 100644 (file)
 (require 'esh-opt)
 
 ;;;###autoload
-(eshell-defgroup eshell-basic nil
+(progn
+(defgroup eshell-basic nil
   "The \"basic\" code provides a set of convenience functions which
 are traditionally considered shell builtins.  Since all of the
 functionality provided by them is accessible through Lisp, they are
 not really builtins at all, but offer a command-oriented way to do the
 same thing."
   :tag "Basic shell commands"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 (defcustom eshell-plain-echo-behavior nil
   "If non-nil, `echo' tries to behave like an ordinary shell echo.
index a5e1b6194c728e286d217335ee2923f254be1c41..a67861e83a9a8b847805536751087393562b1ee5 100644 (file)
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'eshell))
 (require 'esh-util)
 
 ;;;###autoload
-(eshell-defgroup eshell-cmpl nil
+(progn
+(defgroup eshell-cmpl nil
   "This module provides a programmable completion function bound to
 the TAB key, which allows for completing command names, file names,
 variable names, arguments, etc."
   :tag "Argument completion"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
@@ -357,7 +358,7 @@ to writing a completion function."
            (nconc posns (list pos)))
        (setq pos (1+ pos))))
     (setq posns (cdr posns))
-    (assert (= (length args) (length posns)))
+    (cl-assert (= (length args) (length posns)))
     (let ((a args)
          (i 0)
          l final)
@@ -369,7 +370,7 @@ to writing a completion function."
       (and l
           (setq args (nthcdr (1+ l) args)
                 posns (nthcdr (1+ l) posns))))
-    (assert (= (length args) (length posns)))
+    (cl-assert (= (length args) (length posns)))
     (when (and args (eq (char-syntax (char-before end)) ? )
               (not (eq (char-before (1- end)) ?\\)))
       (nconc args (list ""))
@@ -382,7 +383,7 @@ to writing a completion function."
                         (let ((result
                                (eshell-do-eval
                                 (list 'eshell-commands arg) t)))
-                          (assert (eq (car result) 'quote))
+                          (cl-assert (eq (car result) 'quote))
                           (cadr result))
                       arg)))
                (if (numberp val)
index 992b5bdd77e85801a96e0a26cdb9b61fb1b01615..4a3fa54626bccc0d67d937db8865b9d323215cf0 100644 (file)
 (require 'esh-opt)
 
 ;;;###autoload
-(eshell-defgroup eshell-dirs nil
+(progn
+(defgroup eshell-dirs nil
   "Directory navigation involves changing directories, examining the
 current directory, maintaining a directory stack, and also keeping
 track of a history of the last directory locations the user was in.
 Emacs does provide standard Lisp definitions of `pwd' and `cd', but
 they lack somewhat in feel from the typical shell equivalents."
   :tag "Directory navigation"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
index 623d2c8e193cb4933229591cec3a25e20d7c5aef..288aa9b773befdf067acbed4ac35270c1e024da6 100644 (file)
 (require 'esh-util)
 
 ;;;###autoload
-(eshell-defgroup eshell-glob nil
+(progn
+(defgroup eshell-glob nil
   "This module provides extended globbing syntax, similar what is used
 by zsh for filename generation."
   :tag "Extended filename globbing"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
index 05097a8deaf80a12d7c66acad596a42c138e7705..64a7ad94c5318f4bde0d83056521e19239972cdb 100644 (file)
@@ -54,8 +54,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'ring)
 (require 'esh-opt)
 (require 'eshell)
 
 ;;;###autoload
-(eshell-defgroup eshell-hist nil
+(progn
+(defgroup eshell-hist nil
   "This module provides command history management."
   :tag "History list management"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
@@ -559,8 +559,8 @@ See also `eshell-read-history'."
          (forward-char))
        (setq posb (cdr posb)
              pose (cdr pose))
-       (assert (= (length posb) (length args)))
-       (assert (<= (length posb) (length pose))))
+       (cl-assert (= (length posb) (length args)))
+       (cl-assert (<= (length posb) (length pose))))
       (setq hist (buffer-substring-no-properties begin end))
       (let ((b posb) (e pose))
        (while b
@@ -570,7 +570,7 @@ See also `eshell-read-history'."
          (setq b (cdr b)
                e (cdr e))))
       (setq textargs (cdr textargs))
-      (assert (= (length textargs) (length args)))
+      (cl-assert (= (length textargs) (length args)))
       (list textargs posb pose))))
 
 (defun eshell-expand-history-references (beg end)
index 144b4dda8e2ba4e64c6be329248fbcfa9cb0bf84..2dd92ba35300c6df3ca1a0142b8563f5449504c8 100644 (file)
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'eshell))
 (require 'esh-util)
 (require 'esh-opt)
 
 ;;;###autoload
-(eshell-defgroup eshell-ls nil
+(progn
+(defgroup eshell-ls nil
   "This module implements the \"ls\" utility fully in Lisp.  If it is
 passed any unrecognized command switches, it will revert to the
 operating system's version.  This version of \"ls\" uses text
 properties to colorize its output based on the setting of
 `eshell-ls-use-colors'."
   :tag "Implementation of `ls' in Lisp"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
@@ -311,7 +312,7 @@ instead."
   (let ((insert-func 'eshell-buffered-print)
        (error-func 'eshell-error)
        (flush-func 'eshell-flush))
-    (eshell-do-ls args)))
+    (apply 'eshell-do-ls args)))
 
 (put 'eshell/ls 'eshell-no-numeric-conversions t)
 
@@ -462,7 +463,7 @@ name should be displayed as, etc.  Think of it as cooking a FILEINFO."
          (progn
            (setcdr fileinfo attr)
            (setcar fileinfo (eshell-ls-decorated-name fileinfo)))
-       (assert (eq listing-style 'long-listing))
+       (cl-assert (eq listing-style 'long-listing))
        (setcar fileinfo
                (concat (eshell-ls-decorated-name fileinfo) " -> "
                        (eshell-ls-decorated-name
@@ -697,7 +698,7 @@ Each member of FILES is either a string or a cons cell of the form
       (let* ((col-vals
              (if (eq listing-style 'by-columns)
                  (eshell-ls-find-column-lengths display-files)
-               (assert (eq listing-style 'by-lines))
+               (cl-assert (eq listing-style 'by-lines))
                (eshell-ls-find-column-widths display-files)))
             (col-widths (car col-vals))
             (display-files (cdr col-vals))
index 56b0fdfc9a219e707afb2a0d536de639c37c2b00..fc23c0099e8d5f612bcbc05cea15031ab8a7dbbe 100644 (file)
 (eval-when-compile (require 'eshell))
 
 ;;;###autoload
-(eshell-defgroup eshell-pred nil
+(progn
+(defgroup eshell-pred nil
   "This module allows for predicates to be applied to globbing
 patterns (similar to zsh), in addition to string modifiers which can
 be applied either to globbing results, variable references, or just
 ordinary strings."
   :tag "Value modifiers and predicates"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
index 3fe9995bb04069d246a93169fd2a882e9459847b..f4701ec35eae30ee3b26ed12525315d0ab6ced31 100644 (file)
 (eval-when-compile (require 'eshell))
 
 ;;;###autoload
-(eshell-defgroup eshell-prompt nil
+(progn
+(defgroup eshell-prompt nil
   "This module provides command prompts, and navigation between them,
 as is common with most shells."
   :tag "Command prompts"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
@@ -69,9 +70,9 @@ re-entered for it to take effect."
   :group 'eshell-prompt)
 
 (defface eshell-prompt
-  '((((class color) (background light)) (:foreground "Red" :bold t))
-    (((class color) (background dark)) (:foreground "Pink" :bold t))
-    (t (:bold t)))
+  '((default :weight bold)
+    (((class color) (background light)) :foreground "Red")
+    (((class color) (background dark))  :foreground "Pink"))
   "The face used to highlight prompt strings.
 For highlighting other kinds of strings -- similar to shell mode's
 behavior -- simply use an output filer which changes text properties."
index 243e71d7533f2671e19b75ee654af6133b76611a..929b74d789db11782539c29dbc3d52c08443d7e1 100644 (file)
@@ -26,7 +26,8 @@
 (eval-when-compile (require 'eshell))
 
 ;;;###autoload
-(eshell-defgroup eshell-rebind nil
+(progn
+(defgroup eshell-rebind nil
   "This module allows for special keybindings that only take effect
 while the point is in a region of input text.  By default, it binds
 C-a to move to the beginning of the input text (rather than just the
@@ -37,7 +38,7 @@ commands to cause the point to leave the input area, such as
 `backward-word', `previous-line', etc.  This module intends to mimic
 the behavior of normal shells while the user editing new input text."
   :tag "Rebind keys at input"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
index 8acbc2644bea1cbb2fd26a2bd02f8a6f1a1b1ae5..f219a4b6f1200fe90614f12588da034e7011e2ac 100644 (file)
 ;;; Code:
 
 (require 'eshell)
+(require 'esh-opt)
 
 ;;;###autoload
-(eshell-defgroup eshell-script nil
+(progn
+(defgroup eshell-script nil
   "This module allows for the execution of files containing Eshell
 commands, as a script file."
   :tag "Running script files."
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
index cdaed9b717cdd1cdfb3719733c5f32fa492bec27..b427fe69ea48ad66f1aa119132f4a4310c37651b 100644 (file)
@@ -71,7 +71,8 @@
 (eval-when-compile (require 'eshell))
 
 ;;;###autoload
-(eshell-defgroup eshell-smart nil
+(progn
+(defgroup eshell-smart nil
   "This module combines the facility of normal, modern shells with
 some of the edit/review concepts inherent in the design of Plan 9's
 9term.  See the docs for more details.
@@ -80,7 +81,7 @@ Most likely you will have to turn this option on and play around with
 it to get a real sense of how it works."
   :tag "Smart display of output"
   ;; :link '(info-link "(eshell)Smart display of output")
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
index 33c47d1c0ec3c77e5df9729feb40043db3f2b9a0..37fa939cc1027dad5e2508ed8c2bea6d99d0b99e 100644 (file)
 (require 'term)
 
 ;;;###autoload
-(eshell-defgroup eshell-term nil
+(progn
+(defgroup eshell-term nil
   "This module causes visual commands (e.g., 'vi') to be executed by
 the `term' package, which comes with Emacs.  This package handles most
 of the ANSI control codes, allowing curses-based applications to run
 within an Emacs window.  The variable `eshell-visual-commands' defines
 which commands are considered visual in nature."
   :tag "Running visual commands"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; User Variables:
 
index 1875506fe9dbb5ac1ac62ea832bae0b041941c46..35f7a0a9e3d08e3af15f051f61678cf05742fac0 100644 (file)
@@ -40,7 +40,8 @@
 (require 'pcomplete)
 
 ;;;###autoload
-(eshell-defgroup eshell-unix nil
+(progn
+(defgroup eshell-unix nil
   "This module defines many of the more common UNIX utilities as
 aliases implemented in Lisp.  These include mv, ln, cp, rm, etc.  If
 the user passes arguments which are too complex, or are unrecognized
@@ -51,7 +52,7 @@ with Eshell makes them more versatile than their traditional cousins
 \(such as being able to use `kill' to kill Eshell background processes
 by name)."
   :tag "UNIX commands in Lisp"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 (defcustom eshell-unix-load-hook nil
   "A list of functions to run when `eshell-unix' is loaded."
@@ -1036,12 +1037,8 @@ Show wall-clock time elapsed during execution of COMMAND.")
 
 (put 'eshell/occur 'eshell-no-numeric-conversions t)
 
-;; Pacify the byte-compiler.
-(defvar tramp-default-proxies-alist)
-
 (defun eshell/su (&rest args)
   "Alias \"su\" to call Tramp."
-  (require 'tramp)
   (setq args (eshell-stringify-list (eshell-flatten-list args)))
   (let ((orig-args (copy-tree args)))
     (eshell-eval-using-options
@@ -1056,29 +1053,29 @@ Become another USER during a login session.")
                  (host (or (file-remote-p default-directory 'host)
                            "localhost"))
                  (dir (or (file-remote-p default-directory 'localname)
-                          (expand-file-name default-directory))))
+                          (expand-file-name default-directory)))
+                 (prefix (file-remote-p default-directory)))
              (dolist (arg args)
                (if (string-equal arg "-") (setq login t) (setq user arg)))
              ;; `eshell-eval-using-options' does not handle "-".
              (if (member "-" orig-args) (setq login t))
              (if login (setq dir "~/"))
-             (if (and (file-remote-p default-directory)
+             (if (and prefix
                       (or
                        (not (string-equal
                              "su" (file-remote-p default-directory 'method)))
                        (not (string-equal
                              user (file-remote-p default-directory 'user)))))
-                 (add-to-list
-                  'tramp-default-proxies-alist
-                  (list host user (file-remote-p default-directory))))
-             (eshell-parse-command
-              "cd" (list (format "/su:%s@%s:%s" user host dir))))))))
+                 (eshell-parse-command
+                  "cd" (list (format "%s|su:%s@%s:%s"
+                                     (substring prefix 0 -1) user host dir)))
+               (eshell-parse-command
+                "cd" (list (format "/su:%s@%s:%s" user host dir)))))))))
 
 (put 'eshell/su 'eshell-no-numeric-conversions t)
 
 (defun eshell/sudo (&rest args)
   "Alias \"sudo\" to call Tramp."
-  (require 'tramp)
   (setq args (eshell-stringify-list (eshell-flatten-list args)))
   (let ((orig-args (copy-tree args)))
     (eshell-eval-using-options
@@ -1093,21 +1090,26 @@ Execute a COMMAND as the superuser or another USER.")
                  (host (or (file-remote-p default-directory 'host)
                            "localhost"))
                  (dir (or (file-remote-p default-directory 'localname)
-                          (expand-file-name default-directory))))
+                          (expand-file-name default-directory)))
+                 (prefix (file-remote-p default-directory)))
              ;; `eshell-eval-using-options' reads options of COMMAND.
              (while (and (stringp (car orig-args))
                          (member (car orig-args) '("-u" "--user")))
                (setq orig-args (cddr orig-args)))
-             (if (and (file-remote-p default-directory)
-                      (or
-                       (not (string-equal
-                             "sudo" (file-remote-p default-directory 'method)))
-                       (not (string-equal
-                             user (file-remote-p default-directory 'user)))))
-                 (add-to-list
-                  'tramp-default-proxies-alist
-                  (list host user (file-remote-p default-directory))))
-             (let ((default-directory (format "/sudo:%s@%s:%s" user host dir)))
+             (let ((default-directory
+                     (if (and prefix
+                              (or
+                               (not
+                                (string-equal
+                                 "sudo"
+                                 (file-remote-p default-directory 'method)))
+                               (not
+                                (string-equal
+                                 user
+                                 (file-remote-p default-directory 'user)))))
+                         (format "%s|sudo:%s@%s:%s"
+                                 (substring prefix 0 -1) user host dir)
+                       (format "/sudo:%s@%s:%s" user host dir))))
                (eshell-named-command (car orig-args) (cdr orig-args))))))))
 
 (put 'eshell/sudo 'eshell-no-numeric-conversions t)
index 3dfb33d37e379112ab70964e2f0c24be81e6b114..2e7a813cb75f51684bee8167efef59d895ffa0da 100644 (file)
 (require 'compile)
 
 ;;;###autoload
-(eshell-defgroup eshell-xtra nil
+(progn
+(defgroup eshell-xtra nil
   "This module defines some extra alias functions which are entirely
 optional.  They can be viewed as samples for how to write Eshell alias
 functions, or as aliases which make some of Emacs's behavior more
 naturally accessible within Emacs."
   :tag "Extra alias functions"
-  :group 'eshell-module)
+  :group 'eshell-module))
 
 ;;; Functions:
 
index 6075b56915b16cecabbdbe7217b777ae637027eb..515a23f81d77a74687cfb1cd80fe9b7ee1b8511e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; esh-cmd.el --- command invocation
 
-;; Copyright (C) 1999-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw@gnu.org>
 
 (require 'esh-ext)
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'pcomplete))
 
 
@@ -236,10 +236,14 @@ return non-nil if the command is complex."
   :group 'eshell-cmd)
 
 (defcustom eshell-debug-command nil
-  "If non-nil, enable debugging code.  SSLLOOWW.
-This option is only useful for reporting bugs.  If you enable it, you
-will have to visit the file 'eshell-cmd.el' and run the command
-\\[eval-buffer]."
+  "If non-nil, enable Eshell debugging code.
+This is slow, and only useful for debugging problems with Eshell.
+If you change this without using customize after Eshell has loaded,
+you must re-load 'esh-cmd.el'."
+  :initialize 'custom-initialize-default
+  :set (lambda (symbol value)
+        (set symbol value)
+        (load-library "esh-cmd"))
   :type 'boolean
   :group 'eshell-cmd)
 
@@ -600,7 +604,7 @@ For an external command, it means an exit code of 0."
                 (list
                  (if (<= (length pieces) 1)
                      (car pieces)
-                   (assert (not eshell-in-pipeline-p))
+                   (cl-assert (not eshell-in-pipeline-p))
                    `(eshell-execute-pipeline (quote ,pieces))))))
        (setq bp (cdr bp))))
     ;; `results' might be empty; this happens in the case of
@@ -611,7 +615,7 @@ For an external command, it means an exit code of 0."
          results (cdr results)
          sep-terms (nreverse sep-terms))
     (while results
-      (assert (car sep-terms))
+      (cl-assert (car sep-terms))
       (setq final (eshell-structure-basic-command
                   'if (string= (car sep-terms) "&&") "if"
                   `(eshell-protect ,(car results))
@@ -1022,7 +1026,7 @@ be finished later after the completion of an asynchronous subprocess."
        ;; `eshell-copy-tree' is needed here so that the test argument
        ;; doesn't get modified and thus always yield the same result.
        (when (car eshell-command-body)
-         (assert (not synchronous-p))
+         (cl-assert (not synchronous-p))
          (eshell-do-eval (car eshell-command-body))
          (setcar eshell-command-body nil)
          (setcar eshell-test-body nil))
@@ -1042,7 +1046,7 @@ be finished later after the completion of an asynchronous subprocess."
        ;; doesn't get modified and thus always yield the same result.
        (if (car eshell-command-body)
            (progn
-             (assert (not synchronous-p))
+             (cl-assert (not synchronous-p))
              (eshell-do-eval (car eshell-command-body)))
          (unless (car eshell-test-body)
            (setcar eshell-test-body (eshell-copy-tree (car args))))
@@ -1197,7 +1201,7 @@ COMMAND may result in an alias being executed, or a plain command."
   (setq eshell-last-arguments args
        eshell-last-command-name (eshell-stringify command))
   (run-hook-with-args 'eshell-prepare-command-hook)
-  (assert (stringp eshell-last-command-name))
+  (cl-assert (stringp eshell-last-command-name))
   (if eshell-last-command-name
       (or (run-hook-with-args-until-success
           'eshell-named-command-hook eshell-last-command-name
@@ -1216,9 +1220,7 @@ COMMAND may result in an alias being executed, or a plain command."
     (if (and file
             (string-match "\\(em\\|esh\\)-\\(.*\\)\\(\\.el\\)?\\'" file))
        (let ((module-sym
-              (intern (file-name-sans-extension
-                       (file-name-nondirectory
-                        (concat "eshell-" (match-string 2 file)))))))
+              (intern (file-name-base (concat "eshell-" (match-string 2 file))))))
          (if (and (functionp sym)
                   (or (null module-sym)
                       (eshell-using-module module-sym)
index f025c66df32a5b37ceb301fb11e950d64782218b..603da6f2e3069c97b03f0e20b58d0f5e5032e87c 100644 (file)
 (provide 'esh-ext)
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'esh-cmd))
 (require 'esh-util)
+(require 'esh-opt)
 
 (defgroup eshell-ext nil
   "External commands are invoked when operating system executables are
@@ -188,6 +189,7 @@ all the output from the remote command, and sends it all at once,
 causing the user to wonder if anything's really going on..."
   (let ((outbuf (generate-new-buffer " *eshell remote output*"))
        (errbuf (generate-new-buffer " *eshell remote error*"))
+       (command (or (file-remote-p command 'localname) command))
        (exitcode 1))
     (unwind-protect
        (progn
@@ -205,10 +207,10 @@ causing the user to wonder if anything's really going on..."
 (defun eshell-external-command (command args)
   "Insert output from an external COMMAND, using ARGS."
   (setq args (eshell-stringify-list (eshell-flatten-list args)))
-  (if (file-remote-p default-directory)
-      (eshell-remote-command command args))
+  ;; (if (file-remote-p default-directory)
+  ;;     (eshell-remote-command command args))
   (let ((interp (eshell-find-interpreter command)))
-    (assert interp)
+    (cl-assert interp)
     (if (functionp (car interp))
        (apply (car interp) (append (cdr interp) args))
       (eshell-gather-process-output
index c8230e0baad9fd63cf97f22b142d1f079b5bfd4f..9f3cfe0f6d0ff5cfc7d8ff225fcde4b149ddd387 100644 (file)
@@ -59,7 +59,7 @@
 (provide 'esh-io)
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'eshell))
 
 (defgroup eshell-io nil
@@ -298,7 +298,7 @@ completed successfully.  RESULT is the quoted value of the last
 command.  If nil, then the meta variables for keeping track of the
 last execution result should not be changed."
   (let ((idx 0))
-    (assert (or (not result) (eq (car result) 'quote)))
+    (cl-assert (or (not result) (eq (car result) 'quote)))
     (setq eshell-last-command-status exit-code
          eshell-last-command-result (cadr result))
     (while (< idx eshell-number-of-handles)
index 74320538fe9f5d9c80563dfc4566e677986a53b1..9da3f8e2e79dd5e9a1e2c08f0526cc93325973bf 100644 (file)
@@ -193,11 +193,14 @@ This is used by `eshell-watch-for-password-prompt'."
   :type '(choice (const nil) function)
   :group 'eshell-mode)
 
-(defcustom eshell-status-in-modeline t
-  "If non-nil, let the user know a command is running in the modeline."
+(defcustom eshell-status-in-mode-line t
+  "If non-nil, let the user know a command is running in the mode line."
   :type 'boolean
   :group 'eshell-mode)
 
+(define-obsolete-variable-alias 'eshell-status-in-modeline
+  'eshell-status-in-mode-line "24.2")
+
 (defvar eshell-first-time-p t
   "A variable which is non-nil the first time Eshell is loaded.")
 
@@ -314,14 +317,14 @@ and the hook `eshell-exit-hook'."
   (setq eshell-mode-map (make-sparse-keymap))
   (use-local-map eshell-mode-map)
 
-  (when eshell-status-in-modeline
+  (when eshell-status-in-mode-line
     (make-local-variable 'eshell-command-running-string)
     (let ((fmt (copy-sequence mode-line-format)))
       (make-local-variable 'mode-line-format)
       (setq mode-line-format fmt))
-    (let ((modeline (memq 'mode-line-modified mode-line-format)))
-      (if modeline
-         (setcar modeline 'eshell-command-running-string))))
+    (let ((mode-line-elt (memq 'mode-line-modified mode-line-format)))
+      (if mode-line-elt
+         (setcar mode-line-elt 'eshell-command-running-string))))
 
   (define-key eshell-mode-map [return] 'eshell-send-input)
   (define-key eshell-mode-map [(control ?m)] 'eshell-send-input)
@@ -434,7 +437,7 @@ and the hook `eshell-exit-hook'."
   (when eshell-scroll-show-maximum-output
     (set (make-local-variable 'scroll-conservatively) 1000))
 
-  (when eshell-status-in-modeline
+  (when eshell-status-in-mode-line
     (add-hook 'eshell-pre-command-hook 'eshell-command-started nil t)
     (add-hook 'eshell-post-command-hook 'eshell-command-finished nil t))
 
@@ -448,12 +451,12 @@ and the hook `eshell-exit-hook'."
 (put 'eshell-mode 'mode-class 'special)
 
 (defun eshell-command-started ()
-  "Indicate in the modeline that a command has started."
+  "Indicate in the mode line that a command has started."
   (setq eshell-command-running-string "**")
   (force-mode-line-update))
 
 (defun eshell-command-finished ()
-  "Indicate in the modeline that a command has finished."
+  "Indicate in the mode line that a command has finished."
   (setq eshell-command-running-string "--")
   (force-mode-line-update))
 
index 8875395e1d1d8732e091457ab19ca3cd9df8ba0e..2e3c6b8b7b5b27f3a07faffaf854d9333b5dacf9 100644 (file)
@@ -36,7 +36,9 @@ customizing the variable `eshell-modules-list'."
 
 ;; load the defgroup's for the standard extension modules, so that
 ;; documentation can be provided when the user customize's
-;; `eshell-modules-list'.
+;; `eshell-modules-list'.  We use "(progn (defgroup ..." in each file
+;; to force the autoloader into including the entire defgroup, rather
+;; than an abbreviated version.
 (load "esh-groups" nil 'nomessage)
 
 ;;; User Variables:
index edb115b7f4fd8cf64149ff458deadb3e4fc9beba..fed2d8f1c624acaededf3cad088c923abe563166 100644 (file)
@@ -106,7 +106,9 @@ interned variable `args' (created using a `let' form)."
                                       (and (listp opt) (nth 3 opt)))
                                     (cadr options)))
                   '(usage-msg last-value ext-command args))
-       (eshell-do-opt ,name ,options (quote ,body-forms)))))
+       ;; FIXME: `options' ends up hiding some variable names under `quote',
+       ;; which is incompatible with lexical scoping!!
+       (eshell-do-opt ,name ,options (lambda () ,@body-forms)))))
 
 ;;; Internal Functions:
 
@@ -117,7 +119,7 @@ interned variable `args' (created using a `let' form)."
 ;; Documented part of the interface; see eshell-eval-using-options.
 (defvar args)
 
-(defun eshell-do-opt (name options body-forms)
+(defun eshell-do-opt (name options body-fun)
   "Helper function for `eshell-eval-using-options'.
 This code doesn't really need to be macro expanded everywhere."
   (setq args temp-args)
@@ -133,8 +135,7 @@ This code doesn't really need to be macro expanded everywhere."
                      (throw 'eshell-usage
                             (eshell-show-usage name options)))
                  (setq args (eshell-process-args name args options)
-                       last-value (eval (append (list 'progn)
-                                                body-forms)))
+                       last-value (funcall body-fun))
                  nil))
           (error "%s" usage-msg))))
       (throw 'eshell-external
@@ -218,10 +219,8 @@ switch is unrecognized."
         found)
     (while opts
       (if (and (listp (car opts))
-                (nth kind (car opts))
-                (if (= kind 0)
-                    (eq switch (nth kind (car opts)))
-                  (string= switch (nth kind (car opts)))))
+               (nth kind (car opts))
+               (equal switch (nth kind (car opts))))
          (progn
            (eshell-set-option name ai (car opts) options)
            (setq found t opts nil))
index 28984c2747dafb9c1e39bb60423a36338982e968..6a0e159e82efcb9f9a4e4bdb3d3bf038aab17d08 100644 (file)
 (eval-when-compile
   (require 'pcomplete)
   (require 'esh-util)
-  (require 'esh-opt)
   (require 'esh-mode))
+(require 'esh-opt)
 (require 'env)
 (require 'ring)
 
index 224451eacbae510d23e850b2f7580ad5d2d91687..a1717756696b5749bcf2a2ef4f52c99aa7798e52 100644 (file)
 ;; things up.
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'esh-util))
 (require 'esh-util)
 (require 'esh-mode)
 
 (defgroup eshell nil
-  "A command shell implemented entirely in Emacs Lisp.
+  "Command shell implemented entirely in Emacs Lisp.
 It invokes no external processes beyond those requested by the
 user, and is intended to be a functional replacement for command
 shells such as bash, zsh, rc, 4dos."
-  :tag "The Emacs shell"
   :link '(info-link "(eshell)Top")
   :version "21.1"
   :group 'applications)
 
-;; This is hack to force make-autoload to put the whole definition
-;; into the autoload file (see esh-module.el).
-(defalias 'eshell-defgroup 'defgroup)
-
 ;;;_* User Options
 ;;
 ;; The following user options modify the behavior of Eshell overall.
@@ -303,7 +298,7 @@ switches to the session with that number, creating it if necessary.  A
 nonnumeric prefix arg means to create a new session.  Returns the
 buffer selected (or created)."
   (interactive "P")
-  (assert eshell-buffer-name)
+  (cl-assert eshell-buffer-name)
   (let ((buf (cond ((numberp arg)
                    (get-buffer-create (format "%s<%d>"
                                               eshell-buffer-name
@@ -317,7 +312,7 @@ buffer selected (or created)."
     ;; window that that command was invoked from.  To achieve this,
     ;; it's necessary to add `eshell-buffer-name' to the variable
     ;; `same-window-buffer-names', which is done when Eshell is loaded
-    (assert (and buf (buffer-live-p buf)))
+    (cl-assert (and buf (buffer-live-p buf)))
     (pop-to-buffer buf)
     (unless (eq major-mode 'eshell-mode)
       (eshell-mode))
@@ -385,11 +380,11 @@ With prefix ARG, insert output into the current buffer at point."
        (when intr
          (if (eshell-interactive-process)
              (eshell-wait-for-process (eshell-interactive-process)))
-         (assert (not (eshell-interactive-process)))
+         (cl-assert (not (eshell-interactive-process)))
          (goto-char (point-max))
          (while (and (bolp) (not (bobp)))
            (delete-char -1)))
-       (assert (and buf (buffer-live-p buf)))
+       (cl-assert (and buf (buffer-live-p buf)))
        (unless arg
          (let ((len (if (not intr) 2
                       (count-lines (point-min) (point-max)))))
@@ -429,7 +424,7 @@ corresponding to a successful execution."
                       (list 'eshell-commands
                             (list 'eshell-command-to-value
                                   (eshell-parse-command command))) t)))
-         (assert (eq (car result) 'quote))
+         (cl-assert (eq (car result) 'quote))
          (if (and status-var (symbolp status-var))
              (set status-var eshell-last-command-status))
          (cadr result))))))
index ca7a28328f9784caf8a2bb7e1fa5768195cd7e76..09503d7c1548557b1bd8f0f1756e5f48c25d9bf7 100644 (file)
@@ -109,14 +109,19 @@ The list structure of ENTRY may be destructively modified."
 Return a cookie which can be used to delete this remapping with
 `face-remap-remove-relative'.
 
-The remaining arguments, SPECS, should be either a list of face
-names, or a property list of face attribute/value pairs.  The
-remapping specified by SPECS takes effect alongside the
-remappings from other calls to `face-remap-add-relative', as well
-as the normal definition of FACE (at lowest priority).  This
-function tries to sort multiple remappings for the same face, so
-that remappings specifying relative face attributes are applied
-after remappings specifying absolute face attributes.
+The remaining arguments, SPECS, should form a list of faces.
+Each list element should be either a face name or a property list
+of face attribute/value pairs.  If more than one face is listed,
+that specifies an aggregate face, in the same way as in a `face'
+text property, except for possible priority changes noted below.
+
+The face remapping specified by SPECS takes effect alongside the
+remappings from other calls to `face-remap-add-relative' for the
+same FACE, as well as the normal definition of FACE (at lowest
+priority).  This function tries to sort multiple remappings for
+the same face, so that remappings specifying relative face
+attributes are applied after remappings specifying absolute face
+attributes.
 
 The base (lowest priority) remapping may be set to something
 other than the normal definition of FACE via `face-remap-set-base'."
@@ -165,9 +170,11 @@ to apply on top of the normal definition of FACE."
 (defun face-remap-set-base (face &rest specs)
   "Set the base remapping of FACE in the current buffer to SPECS.
 This causes the remappings specified by `face-remap-add-relative'
-to apply on top of the face specification given by SPECS.  SPECS
-should be either a list of face names, or a property list of face
-attribute/value pairs.
+to apply on top of the face specification given by SPECS.
+
+The remaining arguments, SPECS, should form a list of faces.
+Each list element should be either a face name or a property list
+of face attribute/value pairs, like in a `face' text property.
 
 If SPECS is empty, call `face-remap-reset-base' to use the normal
 definition of FACE as the base remapping; note that this is
@@ -303,26 +310,29 @@ a top-level keymap, `text-scale-increase' or
 `text-scale-decrease' may be more appropriate."
   (interactive "p")
   (let ((first t)
-       (step t)
        (ev last-command-event)
        (echo-keystrokes nil))
-    (while step
-      (let ((base (event-basic-type ev)))
-       (cond ((or (eq base ?+) (eq base ?=))
-              (setq step inc))
-             ((eq base ?-)
-              (setq step (- inc)))
-             ((eq base ?0)
-              (setq step 0))
-             (first
-              (setq step inc))
-             (t
-              (setq step nil))))
-      (when step
-       (text-scale-increase step)
-       (setq inc 1 first nil)
-       (setq ev (read-event "+,-,0 for further adjustment: "))))
-    (push ev unread-command-events)))
+    (let* ((base (event-basic-type ev))
+           (step
+            (pcase base
+              ((or ?+ ?=) inc)
+              (?- (- inc))
+              (?0 0)
+              (t inc))))
+      (text-scale-increase step)
+      ;; FIXME: do it after every "iteration of the loop".
+      (message "+,-,0 for further adjustment: ")
+      (set-temporary-overlay-map
+       (let ((map (make-sparse-keymap)))
+         (dolist (mods '(() (control)))
+           (define-key map (vector (append mods '(?-))) 'text-scale-decrease)
+           (define-key map (vector (append mods '(?+))) 'text-scale-increase)
+           ;; = is unshifted + on most keyboards.
+           (define-key map (vector (append mods '(?=))) 'text-scale-increase)
+           (define-key map (vector (append mods '(?0)))
+             (lambda () (interactive) (text-scale-increase 0))))
+         map)
+       t))))
 
 \f
 ;; ----------------------------------------------------------------
@@ -358,12 +368,14 @@ variable `buffer-face-mode-face' is used to display the buffer text."
 ;;;###autoload
 (defun buffer-face-set (&rest specs)
   "Enable `buffer-face-mode', using face specs SPECS.
-SPECS can be any value suitable for the `face' text property,
-including a face name, a list of face names, or a face-attribute
-If SPECS is nil, then `buffer-face-mode' is disabled.
-
-This function will make the variable `buffer-face-mode-face'
-buffer local, and set it to FACE."
+Each argument in SPECS should be a face, i.e. either a face name
+or a property list of face attributes and values.  If more than
+one face is listed, that specifies an aggregate face, like in a
+`face' text property.  If SPECS is nil or omitted, disable
+`buffer-face-mode'.
+
+This function makes the variable `buffer-face-mode-face' buffer
+local, and sets it to FACE."
   (interactive (list (read-face-name "Set buffer face")))
   (while (and (consp specs) (null (cdr specs)))
     (setq specs (car specs)))
@@ -375,8 +387,10 @@ buffer local, and set it to FACE."
 ;;;###autoload
 (defun buffer-face-toggle (&rest specs)
   "Toggle `buffer-face-mode', using face specs SPECS.
-SPECS can be any value suitable for the `face' text property,
-including a face name, a list of face names, or a face-attribute
+Each argument in SPECS should be a face, i.e. either a face name
+or a property list of face attributes and values.  If more than
+one face is listed, that specifies an aggregate face, like in a
+`face' text property.
 
 If `buffer-face-mode' is already enabled, and is currently using
 the face specs SPECS, then it is disabled; if buffer-face-mode is
@@ -399,10 +413,12 @@ buffer local, and set it to SPECS."
 ARG controls whether the mode is enabled or disabled, and is
 interpreted in the usual manner for minor-mode commands.
 
-SPECS can be any value suitable for the `face' text property,
-including a face name, a list of face names, or a face-attribute
+SPECS can be any value suitable for a `face' text property,
+including a face name, a plist of face attributes and values, or
+a list of faces.
 
-If INTERACTIVE is non-nil, a message will be displayed describing the result.
+If INTERACTIVE is non-nil, display a message describing the
+result.
 
 This is a wrapper function which calls `buffer-face-set' or
 `buffer-face-toggle' (depending on ARG), and prints a status
index 743115839b231b853ead176fe47776497c6a2ac4..bcef25eb893173cd0f64b39059bd5985f1d91ccb 100644 (file)
@@ -127,15 +127,6 @@ just before \"Other\" at the end."
   :type 'boolean
   :group 'facemenu)
 
-(defvar facemenu-unlisted-faces
-  `(modeline region secondary-selection highlight scratch-face
-    ,(purecopy "^font-lock-") ,(purecopy "^gnus-") ,(purecopy "^message-")
-    ,(purecopy "^ediff-") ,(purecopy "^term-") ,(purecopy "^vc-")
-    ,(purecopy "^widget-") ,(purecopy "^custom-") ,(purecopy "^vm-"))
-  "*List of faces that are of no interest to the user.")
-(make-obsolete-variable 'facemenu-unlisted-faces 'facemenu-listed-faces
-                       "22.1,\n  and has no effect on the Face menu")
-
 (defcustom facemenu-listed-faces nil
   "List of faces to include in the Face menu.
 Each element should be a symbol, the name of a face.
index 0256f8d951a8359c146508a5174c5c4a3fb92f13..68700c2455bcf50e0ff66c2b7089f05bc704b2b1 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(defcustom term-file-prefix (purecopy "term/")
+  "If non-nil, Emacs startup performs terminal-specific initialization.
+It does this by: (load (concat term-file-prefix (getenv \"TERM\")))
+
+You may set this variable to nil in your init file if you do not wish
+the terminal-initialization file to be loaded."
+  :type '(choice (const :tag "No terminal-specific initialization" nil)
+                (string :tag "Name of directory with term files"))
+  :group 'terminals)
 
 (declare-function xw-defined-colors "term/common-win" (&optional frame))
 
@@ -553,23 +560,23 @@ If FACE is a face-alias, get the documentation for the target face."
 
 (defun set-face-attribute (face frame &rest args)
   "Set attributes of FACE on FRAME from ARGS.
+This function overrides the face attributes specified by FACE's
+face spec.  It is mostly intended for internal use only.
 
-If FRAME is nil this function sets the attributes for all
-existing frames, and the default for new frames.  If FRAME is t,
-change the default for new frames (this is done automatically
-each time an attribute is changed on all frames).
+If FRAME is nil, set the attributes for all existing frames, as
+well as the default for new frames.  If FRAME is t, change the
+default for new frames only.
 
-ARGS must come in pairs ATTRIBUTE VALUE.  ATTRIBUTE must be a valid
-face attribute name.  All attributes can be set to `unspecified';
-this fact is not further mentioned below.
+ARGS must come in pairs ATTRIBUTE VALUE.  ATTRIBUTE must be a
+valid face attribute name.  All attributes can be set to
+`unspecified'; this fact is not further mentioned below.
 
 The following attributes are recognized:
 
 `:family'
 
-VALUE must be a string specifying the font family, e.g. ``monospace'',
-or a fontset alias name.  If a font family is specified, wild-cards `*'
-and `?' are allowed.
+VALUE must be a string specifying the font family
+\(e.g. \"Monospace\") or a fontset.
 
 `:foundry'
 
@@ -586,13 +593,13 @@ It must be one of the symbols `ultra-condensed', `extra-condensed',
 
 `:height'
 
-VALUE specifies the height of the font, in either absolute or relative
-terms.  An absolute height is an integer, and specifies font height in
-units of 1/10 pt.  A relative height is either a floating point number,
+VALUE specifies the relative or absolute height of the font.  An
+absolute height is an integer, and specifies font height in units
+of 1/10 pt.  A relative height is either a floating point number,
 which specifies a scaling factor for the underlying face height;
-or a function that takes a single argument (the underlying face height)
-and returns the new height.  Note that for the `default' face,
-you can only specify an absolute height (since there is nothing
+or a function that takes a single argument (the underlying face
+height) and returns the new height.  Note that for the `default'
+face, you must specify an absolute height (since there is nothing
 for it to be relative to).
 
 `:weight'
@@ -613,10 +620,21 @@ VALUE must be a color name, a string.
 
 `:underline'
 
-VALUE specifies whether characters in FACE should be underlined.  If
-VALUE is t, underline with foreground color of the face.  If VALUE is
-a string, underline with that color.  If VALUE is nil, explicitly
-don't underline.
+VALUE specifies whether characters in FACE should be underlined.
+If VALUE is t, underline with foreground color of the face.
+If VALUE is a string, underline with that color.
+If VALUE is nil, explicitly don't underline.
+
+Otherwise, VALUE must be a property list of the form:
+
+`(:color COLOR :style STYLE)'.
+
+COLOR can be a either a color name string or `foreground-color'.
+STYLE can be either `line' or `wave'.
+If a keyword/value pair is missing from the property list, a
+default value will be used for the value.
+The default value of COLOR is the foreground color of the face.
+The default value of STYLE is `line'.
 
 `:overline'
 
@@ -674,19 +692,26 @@ from an X font name:
 
 `:font'
 
-Set font-related face attributes from VALUE.  VALUE must be a valid
-XLFD font name.  If it is a font name pattern, the first matching font
-will be used.
-
-For compatibility with Emacs 20, keywords `:bold' and `:italic' can
-be used to specify that a bold or italic font should be used.  VALUE
-must be t or nil in that case.  A value of `unspecified' is not allowed.
+Set font-related face attributes from VALUE.  VALUE must be a
+valid font name or font object.  Setting this attribute will also
+set the `:family', `:foundry', `:width', `:height', `:weight',
+and `:slant' attributes.
 
 `:inherit'
 
-VALUE is the name of a face from which to inherit attributes, or a list
-of face names.  Attributes from inherited faces are merged into the face
-like an underlying face would be, with higher priority than underlying faces."
+VALUE is the name of a face from which to inherit attributes, or
+a list of face names.  Attributes from inherited faces are merged
+into the face like an underlying face would be, with higher
+priority than underlying faces.
+
+For backward compatibility, the keywords `:bold' and `:italic'
+can be used to specify weight and slant respectively.  This usage
+is considered obsolete.  For these two keywords, the VALUE must
+be either t or nil.  A value of t for `:bold' is equivalent to
+setting `:weight' to `bold', and a value of t for `:italic' is
+equivalent to setting `:slant' to `italic'.  But if `:weight' is
+specified in the face spec, `:bold' is ignored, and if `:slant'
+is specified, `:italic' is ignored."
   (setq args (purecopy args))
   (let ((where (if (null frame) 0 frame))
        (spec args)
@@ -968,28 +993,28 @@ Value is an alist of (NAME . VALUE) if ATTRIBUTE expects a value out
 of a set of discrete values.  Value is `integerp' if ATTRIBUTE expects
 an integer value."
   (let ((valid
-         (case attribute
-           (:family
+         (pcase attribute
+           (`:family
             (if (window-system frame)
                 (mapcar (lambda (x) (cons x x))
                         (font-family-list))
              ;; Only one font on TTYs.
              (list (cons "default" "default"))))
-           (:foundry
+           (`:foundry
            (list nil))
-          (:width
+          (`:width
            (mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
                    font-width-table))
-           (:weight
+           (`:weight
            (mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
                    font-weight-table))
-          (:slant
+          (`:slant
            (mapcar #'(lambda (x) (cons (symbol-name (aref x 1)) (aref x 1)))
                    font-slant-table))
-          (:inverse-video
+          (`:inverse-video
            (mapcar #'(lambda (x) (cons (symbol-name x) x))
                    (internal-lisp-face-attribute-values attribute)))
-           ((:underline :overline :strike-through :box)
+           ((or `:underline `:overline `:strike-through `:box)
             (if (window-system frame)
                 (nconc (mapcar #'(lambda (x) (cons (symbol-name x) x))
                                (internal-lisp-face-attribute-values attribute))
@@ -997,12 +1022,12 @@ an integer value."
                                (defined-colors frame)))
              (mapcar #'(lambda (x) (cons (symbol-name x) x))
                      (internal-lisp-face-attribute-values attribute))))
-           ((:foreground :background)
+           ((or `:foreground `:background)
             (mapcar #'(lambda (c) (cons c c))
                     (defined-colors frame)))
-           ((:height)
+           (`:height
             'integerp)
-           (:stipple
+           (`:stipple
             (and (memq (window-system frame) '(x ns)) ; No stipple on w32
                  (mapcar #'list
                          (apply #'nconc
@@ -1011,11 +1036,11 @@ an integer value."
                                                (file-directory-p dir)
                                                (directory-files dir)))
                                         x-bitmap-file-path)))))
-           (:inherit
+           (`:inherit
             (cons '("none" . nil)
                   (mapcar #'(lambda (c) (cons (symbol-name c) c))
                           (face-list))))
-           (t
+           (_
             (error "Internal error")))))
     (if (and (listp valid) (not (memq attribute '(:inherit))))
        (nconc (list (cons "unspecified" 'unspecified)) valid)
@@ -1178,8 +1203,8 @@ and the face and its settings are obtained by querying the user."
                          :foreground (or foreground 'unspecified)
                          :background (or background 'unspecified)
                          :stipple stipple
-                         :bold bold-p
-                         :italic italic-p
+                         :weight (if bold-p 'bold 'normal)
+                         :slant (if italic-p 'italic 'normal)
                          :underline underline
                          :inverse-video inverse-p)
     (setq face (read-face-name "Modify face"))
@@ -1212,7 +1237,7 @@ Value is a list (FACE NEW-VALUE) where FACE is the face read
 
 (defconst list-faces-sample-text
   "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-  "*Text string to display as the sample text for `list-faces-display'.")
+  "Text string to display as the sample text for `list-faces-display'.")
 
 
 ;; The name list-faces would be more consistent, but let's avoid a
@@ -1532,35 +1557,29 @@ If SPEC is nil, return nil."
                          face-attribute-name-alist)))))
 
 (defun face-spec-set (face spec &optional for-defface)
-  "Set FACE's face spec, which controls its appearance, to SPEC.
-If FOR-DEFFACE is t, set the base spec, the one that `defface'
-  and Custom set.  (In that case, the caller must put it in the
-  appropriate property, because that depends on the caller.)
-If FOR-DEFFACE is nil, set the overriding spec (and store it
-  in the `face-override-spec' property of FACE).
-
-The appearance of FACE is controlled by the base spec,
-by any custom theme specs on top of that, and by the
-overriding spec on top of all the rest.
-
-FOR-DEFFACE can also be a frame, in which case we set the
-frame-specific attributes of FACE for that frame based on SPEC.
-That usage is deprecated.
-
-See `defface' for information about the format and meaning of SPEC."
-  (if (framep for-defface)
-      ;; Handle the deprecated case where third arg is a frame.
-      (face-spec-set-2 face for-defface spec)
-    (if for-defface
-       ;; When we reset the face based on its custom spec, then it is
-       ;; unmodified as far as Custom is concerned.
-       (put (or (get face 'face-alias) face) 'face-modified nil)
-      ;; When we change a face based on a spec from outside custom,
-      ;; record it for future frames.
-      (put (or (get face 'face-alias) face) 'face-override-spec spec))
-    ;; Reset each frame according to the rules implied by all its specs.
-    (dolist (frame (frame-list))
-      (face-spec-recalc face frame))))
+  "Set and apply the face spec for FACE.
+If the optional argument FOR-DEFFACE is omitted or nil, set the
+overriding spec to SPEC, recording it in the `face-override-spec'
+property of FACE.  See `defface' for the format of SPEC.
+
+If FOR-DEFFACE is non-nil, set the base spec (the one set by
+`defface' and Custom).  In this case, SPEC is ignored; the caller
+is responsible for putting the face spec in the `saved-face',
+`customized-face', or `face-defface-spec', as appropriate.
+
+The appearance of FACE is controlled by the base spec, by any
+custom theme specs on top of that, and by the overriding spec on
+top of all the rest."
+  (if for-defface
+      ;; When we reset the face based on its custom spec, then it is
+      ;; unmodified as far as Custom is concerned.
+      (put (or (get face 'face-alias) face) 'face-modified nil)
+    ;; When we change a face based on a spec from outside custom,
+    ;; record it for future frames.
+    (put (or (get face 'face-alias) face) 'face-override-spec spec))
+  ;; Reset each frame according to the rules implied by all its specs.
+  (dolist (frame (frame-list))
+    (face-spec-recalc face frame)))
 
 (defun face-spec-recalc (face frame)
   "Reset the face attributes of FACE on FRAME according to its specs.
@@ -2435,33 +2454,31 @@ It is used for characters of no fonts too."
   :group 'basic-faces)
 
 (defface error
-  '((((class color) (min-colors 88) (background light)) (:foreground "Red1" :weight bold))
-    (((class color) (min-colors 88) (background dark)) (:foreground "Pink" :weight bold))
-    (((class color) (min-colors 16) (background light)) (:foreground "Red1" :weight bold))
-    (((class color) (min-colors 16) (background dark)) (:foreground "Pink" :weight bold))
-    (((class color) (min-colors 8)) (:foreground "red"))
-    (t (:inverse-video t :weight bold)))
+  '((default :weight bold)
+    (((class color) (min-colors 88) (background light)) :foreground "Red1")
+    (((class color) (min-colors 88) (background dark))  :foreground "Pink")
+    (((class color) (min-colors 16) (background light)) :foreground "Red1")
+    (((class color) (min-colors 16) (background dark))  :foreground "Pink")
+    (((class color) (min-colors 8)) :foreground "red")
+    (t :inverse-video t))
   "Basic face used to highlight errors and to denote failure."
   :version "24.1"
   :group 'basic-faces)
 
 (defface warning
-  '((((class color) (min-colors 16)) (:foreground "DarkOrange" :weight bold))
-    (((class color)) (:foreground "yellow" :weight bold))
-    (t (:weight bold)))
+  '((default :weight bold)
+    (((class color) (min-colors 16)) :foreground "DarkOrange")
+    (((class color)) :foreground "yellow"))
   "Basic face used to highlight warnings."
   :version "24.1"
   :group 'basic-faces)
 
 (defface success
-  '((((class color) (min-colors 16) (background light))
-     (:foreground "ForestGreen" :weight bold))
-    (((class color) (min-colors 88) (background dark))
-     (:foreground "Green1" :weight bold))
-    (((class color) (min-colors 16) (background dark))
-     (:foreground "Green" :weight bold))
-    (((class color)) (:foreground "green" :weight bold))
-    (t (:weight bold)))
+  '((default :weight bold)
+    (((class color) (min-colors 16) (background light)) :foreground "ForestGreen")
+    (((class color) (min-colors 88) (background dark))  :foreground "Green1")
+    (((class color) (min-colors 16) (background dark))  :foreground "Green")
+    (((class color)) :foreground "green"))
   "Basic face used to indicate successful operation."
   :version "24.1"
   :group 'basic-faces)
index 99017d274900445149afdcdc4c84e868e46c516b..3d1f402ab6c58e751d54a33ac26ae84efdf64ca0 100644 (file)
 \f
 ;;; Code:
 
+(require 'url-parse)
+
 (define-obsolete-variable-alias 'ffap-version 'emacs-version "23.2")
 
 (defgroup ffap nil
@@ -136,10 +138,7 @@ If nil, ffap doesn't do shell prompt stripping."
                   regexp)
   :group 'ffap)
 
-(defcustom ffap-ftp-regexp
-  ;; This used to test for ange-ftp or efs being present, but it should be
-  ;; harmless (and simpler) to give it this value unconditionally.
-  "\\`/[^/:]+:"
+(defcustom ffap-ftp-regexp "\\`/[^/:]+:"
   "File names matching this regexp are treated as remote ffap.
 If nil, ffap neither recognizes nor generates such names."
   :type '(choice (const :tag "Disable" nil)
@@ -148,15 +147,20 @@ If nil, ffap neither recognizes nor generates such names."
   :group 'ffap)
 
 (defcustom ffap-url-unwrap-local t
-  "If non-nil, convert `file:' URL to local file name before prompting."
+  "If non-nil, convert some URLs to local file names before prompting.
+Only \"file:\" and \"ftp:\" URLs are converted, and only if they
+do not specify a host, or the host is either \"localhost\" or
+equal to `system-name'."
   :type 'boolean
   :group 'ffap)
 
-(defcustom ffap-url-unwrap-remote t
-  "If non-nil, convert `ftp:' URL to remote file name before prompting.
-This is ignored if `ffap-ftp-regexp' is nil."
-  :type 'boolean
-  :group 'ffap)
+(defcustom ffap-url-unwrap-remote '("ftp")
+  "If non-nil, convert URLs to remote file names before prompting.
+If the value is a list of strings, that specifies a list of URL
+schemes (e.g. \"ftp\"); in that case, only convert those URLs."
+  :type '(choice (repeat string) boolean)
+  :group 'ffap
+  :version "24.2")
 
 (defcustom ffap-ftp-default-user "anonymous"
   "User name in ftp file names generated by `ffap-host-to-path'.
@@ -247,14 +251,14 @@ ffap most of the time."
 (defcustom ffap-file-finder 'find-file
   "The command called by `find-file-at-point' to find a file."
   :type 'function
-  :group 'ffap)
-(put 'ffap-file-finder 'risky-local-variable t)
+  :group 'ffap
+  :risky t)
 
 (defcustom ffap-directory-finder 'dired
   "The command called by `dired-at-point' to find a directory."
   :type 'function
-  :group 'ffap)
-(put 'ffap-directory-finder 'risky-local-variable t)
+  :group 'ffap
+  :risky t)
 
 (defcustom ffap-url-fetcher
   (if (fboundp 'browse-url)
@@ -271,8 +275,28 @@ For a fancy alternative, get `ffap-url.el'."
                 (const browse-url-netscape)
                 (const browse-url-mosaic)
                 function)
+  :group 'ffap
+  :risky t)
+
+(defcustom ffap-next-regexp
+  ;; If you want ffap-next to find URL's only, try this:
+  ;; (and ffap-url-regexp (string-match "\\\\`" ffap-url-regexp)
+  ;;     (concat "\\<" (substring ffap-url-regexp 2))))
+  ;;
+  ;; It pays to put a big fancy regexp here, since ffap-guesser is
+  ;; much more time-consuming than regexp searching:
+  "[/:.~[:alpha:]]/\\|@[[:alpha:]][-[:alnum:]]*\\."
+  "Regular expression governing movements of `ffap-next'."
+  :type 'regexp
   :group 'ffap)
-(put 'ffap-url-fetcher 'risky-local-variable t)
+
+(defcustom dired-at-point-require-prefix nil
+  "If non-nil, reverse the prefix argument to `dired-at-point'.
+This is nil so neophytes notice FFAP.  Experts may prefer to
+disable FFAP most of the time."
+  :type 'boolean
+  :group 'ffap
+  :version "20.3")
 
 \f
 ;;; Compatibility:
@@ -293,18 +317,6 @@ For a fancy alternative, get `ffap-url.el'."
 ;; then, broke it up into ffap-next-guess (noninteractive) and
 ;; ffap-next (a command).  It now work on files as well as url's.
 
-(defcustom ffap-next-regexp
-  ;; If you want ffap-next to find URL's only, try this:
-  ;; (and ffap-url-regexp (string-match "\\\\`" ffap-url-regexp)
-  ;;     (concat "\\<" (substring ffap-url-regexp 2))))
-  ;;
-  ;; It pays to put a big fancy regexp here, since ffap-guesser is
-  ;; much more time-consuming than regexp searching:
-  "[/:.~[:alpha:]]/\\|@[[:alpha:]][-[:alnum:]]*\\."
-  "Regular expression governing movements of `ffap-next'."
-  :type 'regexp
-  :group 'ffap)
-
 (defvar ffap-next-guess nil
   "Last value returned by `ffap-next-guess'.")
 
@@ -606,28 +618,45 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"."
         string)))
 
 ;; Broke these out of ffap-fixup-url, for use of ffap-url package.
-(defsubst ffap-url-unwrap-local (url)
-  "Return URL as a local file, or nil.  Ignores `ffap-url-regexp'."
-  (and (string-match "\\`\\(file\\|ftp\\):/?\\([^/]\\|\\'\\)" url)
-       (substring url (1+ (match-end 1)))))
-(defsubst ffap-url-unwrap-remote (url)
-  "Return URL as a remote file, or nil.  Ignores `ffap-url-regexp'."
-  (and (string-match "\\`\\(ftp\\|file\\)://\\([^:/]+\\):?\\(/.*\\)" url)
-       (concat
-       (ffap-host-to-filename (substring url (match-beginning 2) (match-end 2)))
-       (substring url (match-beginning 3) (match-end 3)))))
-;; Test: (ffap-url-unwrap-remote "ftp://foo.com/bar.boz")
+(defun ffap-url-unwrap-local (url)
+  "Return URL as a local file name, or nil."
+  (let* ((obj (url-generic-parse-url url))
+        (host (url-host obj))
+        (filename (car (url-path-and-query obj))))
+    (when (and (member (url-type obj) '("ftp" "file"))
+              (member host `("" "localhost" ,(system-name))))
+      ;; On Windows, "file:///C:/foo" should unwrap to "C:/foo"
+      (if (and (memq system-type '(ms-dos windows-nt cygwin))
+              (string-match "\\`/[a-zA-Z]:" filename))
+         (substring filename 1)
+       filename))))
+
+(defun ffap-url-unwrap-remote (url)
+  "Return URL as a remote file name, or nil."
+  (let* ((obj    (url-generic-parse-url url))
+        (scheme (url-type obj))
+        (valid-schemes (if (listp ffap-url-unwrap-remote)
+                           ffap-url-unwrap-remote
+                         '("ftp")))
+        (host (url-host obj))
+        (port (url-port-if-non-default obj))
+        (user (url-user obj))
+        (filename (car (url-path-and-query obj))))
+    (when (and (member scheme valid-schemes)
+              (string-match "\\`[a-zA-Z][-a-zA-Z0-9+.]*\\'" scheme)
+              (not (equal host "")))
+      (concat "/" scheme ":"
+             (if user (concat user "@"))
+             host
+             (if port (concat "#" (number-to-string port)))
+             ":" filename))))
 
 (defun ffap-fixup-url (url)
   "Clean up URL and return it, maybe as a file name."
   (cond
    ((not (stringp url)) nil)
-   ((and ffap-url-unwrap-local (ffap-url-unwrap-local url)))
-   ((and ffap-url-unwrap-remote ffap-ftp-regexp
-        (ffap-url-unwrap-remote url)))
-   ;; All this seems to do is remove any trailing "#anchor" part (Bug#898).
-;;;   ((fboundp 'url-normalize-url)    ; may autoload url (part of w3)
-;;;    (url-normalize-url url))
+   ((and ffap-url-unwrap-local  (ffap-url-unwrap-local url)))
+   ((and ffap-url-unwrap-remote (ffap-url-unwrap-remote url)))
    (url)))
 
 \f
@@ -1076,38 +1105,33 @@ Assumes the buffer has not changed."
   ;; ignore non-relative links, trim punctuation.  The other will
   ;; actually look back if point is in whitespace, but I would rather
   ;; ffap be less aggressive in such situations.
-  (and
-   ffap-url-regexp
-   (or
-    ;; In a w3 buffer button?
-    (and (eq major-mode 'w3-mode)
-        ;; interface recommended by wmperry:
-        (w3-view-this-url t))
-    ;; Is there a reason not to strip trailing colon?
-    (let ((name (ffap-string-at-point 'url)))
-      (cond
-       ((string-match "^url:" name) (setq name (substring name 4)))
-       ((and (string-match "\\`[^:</>@]+@[^:</>@]+[[:alnum:]]\\'" name)
-            ;; "foo@bar": could be "mailto" or "news" (a Message-ID).
-            ;; Without "<>" it must be "mailto".  Otherwise could be
-            ;; either, so consult `ffap-foo-at-bar-prefix'.
-            (let ((prefix (if (and (equal (ffap-string-around) "<>")
-                                   ;; Expect some odd characters:
-                                   (string-match "[$.0-9].*[$.0-9].*@" name))
-                              ;; Could be news:
-                              ffap-foo-at-bar-prefix
-                            "mailto")))
-              (and prefix (setq name (concat prefix ":" name))))))
-       ((ffap-newsgroup-p name) (setq name (concat "news:" name)))
-       ((and (string-match "\\`[[:alnum:]]+\\'" name) ; <mic> <root> <nobody>
-            (equal (ffap-string-around) "<>")
-            ;; (ffap-user-p name):
-            (not (string-match "~" (expand-file-name (concat "~" name))))
-            )
-       (setq name (concat "mailto:" name)))
-       )
-      (and (ffap-url-p name) name)
-      ))))
+  (when ffap-url-regexp
+    (or (and (eq major-mode 'w3-mode) ; In a w3 buffer button?
+            (w3-view-this-url t))
+       ;; Is there a reason not to strip trailing colon?
+       (let ((name (ffap-string-at-point 'url)))
+         (cond
+          ((string-match "^url:" name) (setq name (substring name 4)))
+          ((and (string-match "\\`[^:</>@]+@[^:</>@]+[[:alnum:]]\\'" name)
+                ;; "foo@bar": could be "mailto" or "news" (a Message-ID).
+                ;; Without "<>" it must be "mailto".  Otherwise could be
+                ;; either, so consult `ffap-foo-at-bar-prefix'.
+                (let ((prefix (if (and (equal (ffap-string-around) "<>")
+                                       ;; Expect some odd characters:
+                                       (string-match "[$.0-9].*[$.0-9].*@" name))
+                                  ;; Could be news:
+                                  ffap-foo-at-bar-prefix
+                                "mailto")))
+                  (and prefix (setq name (concat prefix ":" name))))))
+          ((ffap-newsgroup-p name) (setq name (concat "news:" name)))
+          ((and (string-match "\\`[[:alnum:]]+\\'" name) ; <mic> <root> <nobody>
+                (equal (ffap-string-around) "<>")
+                ;;     (ffap-user-p name):
+                (not (string-match "~" (expand-file-name (concat "~" name)))))
+           (setq name (concat "mailto:" name))))
+
+         (if (ffap-url-p name)
+             name)))))
 
 (defvar ffap-gopher-regexp
   "^.*\\<\\(Type\\|Name\\|Path\\|Host\\|Port\\) *= *\\(.*\\) *$"
@@ -1340,24 +1364,8 @@ which may actually result in an URL rather than a filename."
 ;; We must inform complete about whether our completion function
 ;; will do filename style completion.
 
-(defun ffap-complete-as-file-p ()
-  ;; Will `minibuffer-completion-table' complete the minibuffer
-  ;; contents as a filename?  Assumes the minibuffer is current.
-  ;; Note: t and non-nil mean somewhat different reasons.
-  (if (eq minibuffer-completion-table 'ffap-read-file-or-url-internal)
-      (not (ffap-url-p (buffer-string))) ; t
-    (and minibuffer-completing-file-name '(t)))) ;list
-
-(and
- (featurep 'complete)
- (if (boundp 'PC-completion-as-file-name-predicate)
-     ;; modern version of complete.el, just set the variable:
-     (setq PC-completion-as-file-name-predicate 'ffap-complete-as-file-p)))
-
 \f
 ;;; Highlighting (`ffap-highlight'):
-;;
-;; Based on overlay highlighting in Emacs 19.28 isearch.el.
 
 (defvar ffap-highlight t
   "If non-nil, ffap highlights the current buffer substring.")
@@ -1471,10 +1479,12 @@ and the functions `ffap-file-at-point' and `ffap-url-at-point'."
 \f
 ;;; Menu support (`ffap-menu'):
 
-(defvar ffap-menu-regexp nil
-  "*If non-nil, overrides `ffap-next-regexp' during `ffap-menu'.
+(defcustom ffap-menu-regexp nil
+  "If non-nil, regexp overriding `ffap-next-regexp' in `ffap-menu'.
 Make this more restrictive for faster menu building.
-For example, try \":/\" for URL (and some ftp) references.")
+For example, try \":/\" for URL (and some ftp) references."
+  :type '(choice (const nil) regexp)
+  :group 'ffap)
 
 (defvar ffap-menu-alist nil
   "Buffer local cache of menu presented by `ffap-menu'.")
@@ -1688,6 +1698,13 @@ Only intended for interactive use."
       (set-window-dedicated-p win wdp))
     value))
 
+(defun ffap--toggle-read-only (buffer-or-list)
+  (dolist (buffer (if (listp buffer-or-list)
+                     buffer-or-list
+                   (list buffer-or-list)))
+    (with-current-buffer buffer
+      (toggle-read-only 1))))
+
 (defun ffap-read-only ()
   "Like `ffap', but mark buffer as read-only.
 Only intended for interactive use."
@@ -1695,8 +1712,7 @@ Only intended for interactive use."
   (let ((value (call-interactively 'ffap)))
     (unless (or (bufferp value) (bufferp (car-safe value)))
       (setq value (current-buffer)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
+    (ffap--toggle-read-only value)
     value))
 
 (defun ffap-read-only-other-window ()
@@ -1704,8 +1720,7 @@ Only intended for interactive use."
 Only intended for interactive use."
   (interactive)
   (let ((value (ffap-other-window)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
+    (ffap--toggle-read-only value)
     value))
 
 (defun ffap-read-only-other-frame ()
@@ -1713,8 +1728,7 @@ Only intended for interactive use."
 Only intended for interactive use."
   (interactive)
   (let ((value (ffap-other-frame)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
+    (ffap--toggle-read-only value)
     value))
 
 (defun ffap-alternate-file ()
@@ -1755,8 +1769,7 @@ Only intended for interactive use."
 (defun ffap-ro-mode-hook ()
   "Bind `ffap-next' and `ffap-menu' to M-l and M-m, resp."
   (local-set-key "\M-l" 'ffap-next)
-  (local-set-key "\M-m" 'ffap-menu)
-  )
+  (local-set-key "\M-m" 'ffap-menu))
 
 (defun ffap-gnus-hook ()
   "Bind `ffap-gnus-next' and `ffap-gnus-menu' to M-l and M-m, resp."
@@ -1800,13 +1813,6 @@ Only intended for interactive use."
   (interactive) (ffap-gnus-wrapper '(ffap-menu)))
 
 \f
-(defcustom dired-at-point-require-prefix nil
-  "If set, reverses the prefix argument to `dired-at-point'.
-This is nil so neophytes notice ffap.  Experts may prefer to disable
-ffap most of the time."
-  :type 'boolean
-  :group 'ffap
-  :version "20.3")
 
 ;;;###autoload
 (defun dired-at-point (&optional filename)
@@ -1913,7 +1919,7 @@ Only intended for interactive use."
 ;;; Hooks to put in `file-name-at-point-functions':
 
 ;;;###autoload
-(progn (defun ffap-guess-file-name-at-point ()
+(defun ffap-guess-file-name-at-point ()
   "Try to get a file name at point.
 This hook is intended to be put in `file-name-at-point-functions'."
   (when (fboundp 'ffap-guesser)
@@ -1930,14 +1936,13 @@ This hook is intended to be put in `file-name-at-point-functions'."
       (when guess
        (if (file-directory-p guess)
            (file-name-as-directory guess)
-         guess))))))
+         guess)))))
 
 \f
 ;;; Offer default global bindings (`ffap-bindings'):
 
 (defvar ffap-bindings
-   '(
-     (global-set-key [S-mouse-3] 'ffap-at-mouse)
+   '((global-set-key [S-mouse-3] 'ffap-at-mouse)
      (global-set-key [C-S-mouse-3] 'ffap-menu)
 
      (global-set-key "\C-x\C-f" 'find-file-at-point)
@@ -1957,9 +1962,7 @@ This hook is intended to be put in `file-name-at-point-functions'."
      (add-hook 'gnus-summary-mode-hook 'ffap-gnus-hook)
      (add-hook 'gnus-article-mode-hook 'ffap-gnus-hook)
      (add-hook 'vm-mode-hook 'ffap-ro-mode-hook)
-     (add-hook 'rmail-mode-hook 'ffap-ro-mode-hook)
-     ;; (setq dired-x-hands-off-my-keys t) ; the default
-     )
+     (add-hook 'rmail-mode-hook 'ffap-ro-mode-hook))
      "List of binding forms evaluated by function `ffap-bindings'.
 A reasonable ffap installation needs just this one line:
   (ffap-bindings)
index b4a04401a776ae45dc3f4deef530118bdfc642a2..e28e2ba83e3f3c9f7b643f1815faf99f351c30f3 100644 (file)
@@ -49,7 +49,7 @@ Intended to be used in the `interactive' spec of
             (format "%s: " prompt))
           obarray
           (lambda (sym)
-            (or (user-variable-p sym)
+            (or (custom-variable-p sym)
                  (get sym 'safe-local-variable)
                 (memq sym '(mode eval coding unibyte))))
           nil nil nil default nil))
index cf9521731e289adcb2c2c908f7fbaa98fac84064..7fc7ccc8553f673c550493fc327db3ec28141efe 100644 (file)
@@ -28,8 +28,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defvar font-lock-keywords)
 
 (defgroup backup nil
@@ -415,13 +413,13 @@ location of point in the current buffer."
 
 ;;;It is not useful to make this a local variable.
 ;;;(put 'find-file-not-found-hooks 'permanent-local t)
+(define-obsolete-variable-alias 'find-file-not-found-hooks
+    'find-file-not-found-functions "22.1")
 (defvar find-file-not-found-functions nil
   "List of functions to be called for `find-file' on nonexistent file.
 These functions are called as soon as the error is detected.
 Variable `buffer-file-name' is already set up.
 The functions are called in the order given until one of them returns non-nil.")
-(define-obsolete-variable-alias 'find-file-not-found-hooks
-    'find-file-not-found-functions "22.1")
 
 ;;;It is not useful to make this a local variable.
 ;;;(put 'find-file-hooks 'permanent-local t)
@@ -435,6 +433,7 @@ functions are called."
   :options '(auto-insert)
   :version "22.1")
 
+(define-obsolete-variable-alias 'write-file-hooks 'write-file-functions "22.1")
 (defvar write-file-functions nil
   "List of functions to be called before writing out a buffer to a file.
 If one of them returns non-nil, the file is considered already written
@@ -451,13 +450,14 @@ coding system and setting mode bits.  (See Info
 node `(elisp)Saving Buffers'.)  To perform various checks or
 updates before the buffer is saved, use `before-save-hook'.")
 (put 'write-file-functions 'permanent-local t)
-(define-obsolete-variable-alias 'write-file-hooks 'write-file-functions "22.1")
 
 (defvar local-write-file-hooks nil)
 (make-variable-buffer-local 'local-write-file-hooks)
 (put 'local-write-file-hooks 'permanent-local t)
 (make-obsolete-variable 'local-write-file-hooks 'write-file-functions "22.1")
 
+(define-obsolete-variable-alias 'write-contents-hooks
+    'write-contents-functions "22.1")
 (defvar write-contents-functions nil
   "List of functions to be called before writing out a buffer to a file.
 If one of them returns non-nil, the file is considered already written
@@ -475,8 +475,6 @@ For hooks that _do_ pertain to the particular visited file, use
 To perform various checks or updates before the buffer is saved,
 use `before-save-hook'.")
 (make-variable-buffer-local 'write-contents-functions)
-(define-obsolete-variable-alias 'write-contents-hooks
-    'write-contents-functions "22.1")
 
 (defcustom enable-local-variables t
   "Control use of local variables in files you visit.
@@ -782,10 +780,10 @@ one or more of those symbols."
     (read-file-name-internal string pred action))
    ((eq (car-safe action) 'boundaries)
     (let ((suffix (cdr action)))
-      (list* 'boundaries
-             (length (file-name-directory string))
-             (let ((x (file-name-directory suffix)))
-               (if x (1- (length x)) (length suffix))))))
+      `(boundaries
+        ,(length (file-name-directory string))
+        ,@(let ((x (file-name-directory suffix)))
+            (if x (1- (length x)) (length suffix))))))
    (t
     (let ((names '())
           ;; If we have files like "foo.el" and "foo.elc", we could load one of
@@ -878,12 +876,12 @@ or mount points potentially requiring authentication as a different user.")
 ;;       nil)))
 
 (defun locate-dominating-file (file name)
-  "Look up the directory hierarchy from FILE for a file named NAME.
+  "Look up the directory hierarchy from FILE for a directory containing NAME.
 Stop at the first parent directory containing a file NAME,
 and return the directory.  Return nil if not found.
-
-This function only tests if FILE exists.  If you care about whether
-it is readable, regular, etc., you should test the result."
+Instead of a string, NAME can also be a predicate taking one argument
+\(a directory) and returning a non-nil value if that directory is the one for
+which we're looking."
   ;; We used to use the above locate-dominating-files code, but the
   ;; directory-files call is very costly, so we're much better off doing
   ;; multiple calls using the code in here.
@@ -910,16 +908,14 @@ it is readable, regular, etc., you should test the result."
                     ;;   (setq user (nth 2 (file-attributes file)))
                     ;;   (and prev-user (not (equal user prev-user))))
                     (string-match locate-dominating-stop-dir-regexp file)))
-      ;; FIXME? maybe this function should (optionally?)
-      ;; use file-readable-p instead.  In many cases, an unreadable
-      ;; FILE is no better than a non-existent one.
-      ;; See eg dir-locals-find-file.
-      (setq try (file-exists-p (expand-file-name name file)))
+      (setq try (if (stringp name)
+                    (file-exists-p (expand-file-name name file))
+                  (funcall name file)))
       (cond (try (setq root file))
             ((equal file (setq file (file-name-directory
                                      (directory-file-name file))))
              (setq file nil))))
-    root))
+    (if root (file-name-as-directory root))))
 
 
 (defun executable-find (command)
@@ -986,6 +982,29 @@ Tip: You can use this expansion of remote identifier components
        (funcall handler 'file-remote-p file identification connected)
       nil)))
 
+;; Probably this entire variable should be obsolete now, in favor of
+;; something Tramp-related (?).  It is not used in many places.
+;; It's not clear what the best file for this to be in is, but given
+;; it uses custom-initialize-delay, it is easier if it is preloaded
+;; rather than autoloaded.
+(defcustom remote-shell-program
+  ;; This used to try various hard-coded places for remsh, rsh, and
+  ;; rcmd, trying to guess based on location whether "rsh" was
+  ;; "restricted shell" or "remote shell", but I don't see the point
+  ;; in this day and age.  Almost everyone will use ssh, and have
+  ;; whatever command they want to use in PATH.
+  (purecopy
+   (let ((list '("ssh" "remsh" "rcmd" "rsh")))
+     (while (and list
+                (not (executable-find (car list)))
+                (setq list (cdr list))))
+     (or (car list) "ssh")))
+  "Program to use to execute commands on a remote host (e.g. ssh or rsh)."
+  :version "24.2"                      ; ssh rather than rsh, etc
+  :initialize 'custom-initialize-delay
+  :group 'environment
+  :type 'file)
+
 (defcustom remote-file-name-inhibit-cache 10
   "Whether to use the remote file-name cache for read access.
 When `nil', never expire cached values (caution)
@@ -1446,23 +1465,26 @@ file names with wildcards."
      (find-file filename)
      (current-buffer)))
 
-(defun find-file-read-only (filename &optional wildcards)
-  "Edit file FILENAME but don't allow changes.
-Like \\[find-file], but marks buffer as read-only.
-Use \\[toggle-read-only] to permit editing."
-  (interactive
-   (find-file-read-args "Find file read-only: "
-                        (confirm-nonexistent-file-or-buffer)))
+(defun find-file--read-only (fun filename wildcards)
   (unless (or (and wildcards find-file-wildcards
                   (not (string-match "\\`/:" filename))
                   (string-match "[[*?]" filename))
              (file-exists-p filename))
     (error "%s does not exist" filename))
-  (let ((value (find-file filename wildcards)))
+  (let ((value (funcall fun filename wildcards)))
     (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
          (if (listp value) value (list value)))
     value))
 
+(defun find-file-read-only (filename &optional wildcards)
+  "Edit file FILENAME but don't allow changes.
+Like \\[find-file], but marks buffer as read-only.
+Use \\[toggle-read-only] to permit editing."
+  (interactive
+   (find-file-read-args "Find file read-only: "
+                        (confirm-nonexistent-file-or-buffer)))
+  (find-file--read-only #'find-file filename wildcards))
+
 (defun find-file-read-only-other-window (filename &optional wildcards)
   "Edit file FILENAME in another window but don't allow changes.
 Like \\[find-file-other-window], but marks buffer as read-only.
@@ -1470,15 +1492,7 @@ Use \\[toggle-read-only] to permit editing."
   (interactive
    (find-file-read-args "Find file read-only other window: "
                         (confirm-nonexistent-file-or-buffer)))
-  (unless (or (and wildcards find-file-wildcards
-                  (not (string-match "\\`/:" filename))
-                  (string-match "[[*?]" filename))
-             (file-exists-p filename))
-    (error "%s does not exist" filename))
-  (let ((value (find-file-other-window filename wildcards)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
-    value))
+  (find-file--read-only #'find-file-other-window filename wildcards))
 
 (defun find-file-read-only-other-frame (filename &optional wildcards)
   "Edit file FILENAME in another frame but don't allow changes.
@@ -1487,15 +1501,7 @@ Use \\[toggle-read-only] to permit editing."
   (interactive
    (find-file-read-args "Find file read-only other frame: "
                         (confirm-nonexistent-file-or-buffer)))
-  (unless (or (and wildcards find-file-wildcards
-                  (not (string-match "\\`/:" filename))
-                  (string-match "[[*?]" filename))
-             (file-exists-p filename))
-    (error "%s does not exist" filename))
-  (let ((value (find-file-other-frame filename wildcards)))
-    (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1)))
-         (if (listp value) value (list value)))
-    value))
+  (find-file--read-only #'find-file-other-frame filename wildcards))
 
 (defun find-alternate-file-other-window (filename &optional wildcards)
   "Find file FILENAME as a replacement for the file in the next window.
@@ -1627,6 +1633,7 @@ Choose the buffer's name using `generate-new-buffer-name'."
   "Regexp to match the automounter prefix in a directory name."
   :group 'files
   :type 'regexp)
+(make-obsolete-variable 'automount-dir-prefix 'directory-abbrev-alist "24.2")
 
 (defvar abbreviated-home-dir nil
   "The user's homedir abbreviated according to `directory-abbrev-alist'.")
@@ -1752,9 +1759,9 @@ When nil, never request confirmation."
 OP-TYPE specifies the file operation being performed (for message to user)."
   (when (and large-file-warning-threshold size
             (> size large-file-warning-threshold)
-            (not (y-or-n-p (format "File %s is large (%dMB), really %s? "
+            (not (y-or-n-p (format "File %s is large (%s), really %s? "
                                    (file-name-nondirectory filename)
-                                   (/ size 1048576) op-type))))
+                                   (file-size-human-readable size) op-type))))
     (error "Aborted")))
 
 (defun find-file-noselect (filename &optional nowarn rawfile wildcards)
@@ -1998,6 +2005,8 @@ Do you want to revisit the file normally now? ")
        (after-find-file error (not nowarn)))
       (current-buffer))))
 \f
+(defvar file-name-buffer-file-type-alist) ;From dos-w32.el.
+
 (defun insert-file-contents-literally (filename &optional visit beg end replace)
   "Like `insert-file-contents', but only reads in the file literally.
 A buffer may be modified in several ways after reading into the buffer,
@@ -2009,21 +2018,14 @@ This function ensures that none of these modifications will take place."
        (after-insert-file-functions nil)
        (coding-system-for-read 'no-conversion)
        (coding-system-for-write 'no-conversion)
-       (find-buffer-file-type-function
-         (if (fboundp 'find-buffer-file-type)
-             (symbol-function 'find-buffer-file-type)
-           nil))
+       (file-name-buffer-file-type-alist '(("" . t)))
         (inhibit-file-name-handlers
+         ;; FIXME: Yuck!!  We should turn insert-file-contents-literally
+         ;; into a file operation instead!
          (append '(jka-compr-handler image-file-handler epa-file-handler)
                  inhibit-file-name-handlers))
         (inhibit-file-name-operation 'insert-file-contents))
-    (unwind-protect
-         (progn
-           (fset 'find-buffer-file-type (lambda (_filename) t))
-           (insert-file-contents filename visit beg end replace))
-      (if find-buffer-file-type-function
-         (fset 'find-buffer-file-type find-buffer-file-type-function)
-       (fmakunbound 'find-buffer-file-type)))))
+    (insert-file-contents filename visit beg end replace)))
 
 (defun insert-file-1 (filename insert-func)
   (if (file-directory-p filename)
@@ -2152,6 +2154,7 @@ unless NOMODES is non-nil."
         (/= (char-after (1- (point-max))) ?\n)
         (not (and (eq selective-display t)
                   (= (char-after (1- (point-max))) ?\r)))
+        (not buffer-read-only)
         (save-excursion
           (goto-char (point-max))
           (insert "\n")))
@@ -2205,10 +2208,7 @@ in that case, this function acts as if `enable-local-variables' were t."
              (boundp 'font-lock-keywords)
              (eq (car font-lock-keywords) t))
     (setq font-lock-keywords (cadr font-lock-keywords))
-    (font-lock-mode 1))
-
-  (if (fboundp 'ucs-set-table-for-input) ; don't lose when building
-      (ucs-set-table-for-input)))
+    (font-lock-mode 1)))
 
 (defcustom auto-mode-case-fold t
   "Non-nil means to try second pass through `auto-mode-alist'.
@@ -2263,9 +2263,11 @@ since only a single case-insensitive search through the alist is made."
      ("\\.makepp\\'" . makefile-makepp-mode)
      ,@(if (memq system-type '(berkeley-unix darwin))
           '(("\\.mk\\'" . makefile-bsdmake-mode)
+            ("\\.make\\'" . makefile-bsdmake-mode)
             ("GNUmakefile\\'" . makefile-gmake-mode)
             ("[Mm]akefile\\'" . makefile-bsdmake-mode))
         '(("\\.mk\\'" . makefile-gmake-mode)   ; Might be any make, give Gnu the host advantage
+          ("\\.make\\'" . makefile-gmake-mode)
           ("[Mm]akefile\\'" . makefile-gmake-mode)))
      ("\\.am\\'" . makefile-automake-mode)
      ;; Less common extensions come here
@@ -2342,8 +2344,8 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" . archive-mode)
      ("\\.dbk\\'" . xml-mode)
      ("\\.dtd\\'" . sgml-mode)
      ("\\.ds\\(ss\\)?l\\'" . dsssl-mode)
-     ("\\.js\\'" . js-mode)            ; javascript-mode would be better
-     ("\\.json\\'" . js-mode)
+     ("\\.js\\'" . javascript-mode)
+     ("\\.json\\'" . javascript-mode)
      ("\\.[ds]?vh?\\'" . verilog-mode)
      ;; .emacs or .gnus or .viper following a directory delimiter in
      ;; Unix, MSDOG or VMS syntax.
@@ -2783,6 +2785,11 @@ same, do nothing and return nil."
       (funcall mode)
       mode)))
 
+(defvar file-auto-mode-skip "^\\(#!\\|'\\\\\"\\)"
+  "Regexp of lines to skip when looking for file-local settings.
+If the first line matches this regular expression, then the -*-...-*- file-
+local settings will be consulted on the second line instead of the first.")
+
 (defun set-auto-mode-1 ()
   "Find the -*- spec in the buffer.
 Call with point at the place to start searching from.
@@ -2805,7 +2812,7 @@ have no effect."
                             ;; interpreter invocation.  The same holds
                             ;; for '\" in man pages (preprocessor
                             ;; magic for the `man' program).
-                            (and (looking-at "^\\(#!\\|'\\\\\"\\)") 2)) t)
+                            (and (looking-at file-auto-mode-skip) 2)) t)
      (progn
        (skip-chars-forward " \t")
        (setq beg (point))
@@ -3639,14 +3646,23 @@ is found.  Returns the new class name."
              class-name))
        (error (message "Error reading dir-locals: %S" err) nil)))))
 
+(defcustom enable-remote-dir-locals nil
+  "Non-nil means dir-local variables will be applied to remote files."
+  :version "24.2"
+  :type 'boolean
+  :group 'find-file)
+
 (defun hack-dir-local-variables ()
   "Read per-directory local variables for the current buffer.
 Store the directory-local variables in `dir-local-variables-alist'
 and `file-local-variables-alist', without applying them."
   (when (and enable-local-variables
-            (not (file-remote-p (or (buffer-file-name) default-directory))))
+            (or enable-remote-dir-locals
+                (not (file-remote-p (or (buffer-file-name)
+                                        default-directory)))))
     ;; Find the variables file.
-    (let ((variables-file (dir-locals-find-file (or (buffer-file-name) default-directory)))
+    (let ((variables-file (dir-locals-find-file
+                           (or (buffer-file-name) default-directory)))
          (class nil)
          (dir-name nil))
       (cond
@@ -4047,6 +4063,12 @@ the value is \"\"."
         (if period
             "")))))
 
+(defun file-name-base (&optional filename)
+  "Return the base name of the FILENAME: no directory, no extension.
+FILENAME defaults to `buffer-file-name'."
+  (file-name-sans-extension
+   (file-name-nondirectory (or filename (buffer-file-name)))))
+
 (defcustom make-backup-file-name-function nil
   "A function to use instead of the default `make-backup-file-name'.
 A value of nil gives the default `make-backup-file-name' behavior.
@@ -4501,7 +4523,7 @@ Before and after saving the buffer, this function runs
               (format
                "%s has changed since visited or saved.  Save anyway? "
                (file-name-nondirectory buffer-file-name)))
-             (error "Save not confirmed"))
+             (user-error "Save not confirmed"))
          (save-restriction
            (widen)
            (save-excursion
@@ -4802,37 +4824,51 @@ prints a message in the minibuffer.  Instead, use `set-buffer-modified-p'."
               "Modification-flag cleared"))
   (set-buffer-modified-p arg))
 
-(defun toggle-read-only (&optional arg)
-  "Change whether this buffer is read-only.
+(defun toggle-read-only (&optional arg message)
+  "Toggle the read-only state of the current buffer.
 With prefix argument ARG, make the buffer read-only if ARG is
-positive, otherwise make it writable.  If buffer is read-only
-and `view-read-only' is non-nil, enter view mode.
-
-This function is usually the wrong thing to use in a Lisp program.
-It can have side-effects beyond changing the read-only status of a buffer
-\(e.g., enabling view mode), and does not affect read-only regions that
-are caused by text properties.  To make a buffer read-only in Lisp code,
-set `buffer-read-only'.  To ignore read-only status (whether due to text
-properties or buffer state) and make changes, temporarily bind
-`inhibit-read-only'."
+positive; otherwise make it writable.
+
+When making the buffer read-only, enable View mode if
+`view-read-only' is non-nil.  When making the buffer writable,
+disable View mode if View mode is enabled.
+
+If called interactively, or if called from Lisp with MESSAGE
+non-nil, print a message reporting the buffer's new read-only
+status.
+
+Do not call this from a Lisp program unless you really intend to
+do the same thing as the \\[toggle-read-only] command, including
+possibly enabling or disabling View mode.  Also, note that this
+command works by setting the variable `buffer-read-only', which
+does not affect read-only regions caused by text properties.  To
+ignore read-only status in a Lisp program (whether due to text
+properties or buffer state), bind `inhibit-read-only' temporarily
+to a non-nil value."
   (interactive "P")
-  (if (and arg
-           (if (> (prefix-numeric-value arg) 0) buffer-read-only
-             (not buffer-read-only)))  ; If buffer-read-only is set correctly,
-      nil                             ; do nothing.
-    ;; Toggle.
-    (cond
-     ((and buffer-read-only view-mode)
-      (View-exit-and-edit)
-      (make-local-variable 'view-read-only)
-      (setq view-read-only t))         ; Must leave view mode.
-     ((and (not buffer-read-only) view-read-only
-          ;; If view-mode is already active, `view-mode-enter' is a nop.
-          (not view-mode)
-           (not (eq (get major-mode 'mode-class) 'special)))
-      (view-mode-enter))
-     (t (setq buffer-read-only (not buffer-read-only))
-        (force-mode-line-update)))))
+  (cond
+   ;; Do nothing if `buffer-read-only' already matches the state
+   ;; specified by ARG.
+   ((and arg
+        (if (> (prefix-numeric-value arg) 0)
+            buffer-read-only
+          (not buffer-read-only))))
+   ;; If View mode is enabled, exit it.
+   ((and buffer-read-only view-mode)
+    (View-exit-and-edit)
+    (set (make-local-variable 'view-read-only) t))
+   ;; If `view-read-only' is non-nil, enable View mode.
+   ((and view-read-only
+        (not buffer-read-only)
+        (not view-mode)
+        (not (eq (get major-mode 'mode-class) 'special)))
+    (view-mode-enter))
+   ;; The usual action: flip `buffer-read-only'.
+   (t (setq buffer-read-only (not buffer-read-only))
+      (force-mode-line-update)))
+  (if (or message (called-interactively-p 'interactive))
+      (message "Read-only %s for this buffer"
+              (if buffer-read-only "enabled" "disabled"))))
 
 (defun insert-file (filename)
   "Insert contents of file FILENAME into buffer after point.
@@ -5120,6 +5156,24 @@ directly into NEWNAME instead."
            (times (and keep-time (nth 5 (file-attributes directory)))))
        (if modes (set-file-modes newname modes))
        (if times (set-file-times newname times))))))
+
+\f
+;; At time of writing, only info uses this.
+(defun prune-directory-list (dirs &optional keep reject)
+  "Return a copy of DIRS with all non-existent directories removed.
+The optional argument KEEP is a list of directories to retain even if
+they don't exist, and REJECT is a list of directories to remove from
+DIRS, even if they exist; REJECT takes precedence over KEEP.
+
+Note that membership in REJECT and KEEP is checked using simple string
+comparison."
+  (apply #'nconc
+        (mapcar (lambda (dir)
+                  (and (not (member dir reject))
+                       (or (member dir keep) (file-directory-p dir))
+                       (list dir)))
+                dirs)))
+
 \f
 (put 'revert-buffer-function 'permanent-local t)
 (defvar revert-buffer-function nil
@@ -5368,7 +5422,7 @@ non-nil, it is called instead of rereading visited file contents."
             (insert-file-contents file-name nil)
             (set-buffer-file-coding-system coding-system))
           (after-find-file nil nil t))
-         (t (error "Recover-file cancelled")))))
+         (t (user-error "Recover-file cancelled")))))
 
 (defun recover-session ()
   "Recover auto save files from a previous Emacs session.
@@ -5897,11 +5951,12 @@ returns nil."
          (when (and directory-free-space-program
                     ;; Avoid failure if the default directory does
                     ;; not exist (Bug#2631, Bug#3911).
-                    (let ((default-directory "/"))
-                      (eq (call-process directory-free-space-program
+                     (let ((default-directory
+                             (locate-dominating-file dir 'file-directory-p)))
+                       (eq (process-file directory-free-space-program
                                         nil t nil
                                         directory-free-space-args
-                                        dir)
+                                         (file-relative-name dir))
                           0)))
            ;; Assume that the "available" column is before the
            ;; "capacity" column.  Find the "%" and scan backward.
@@ -6407,20 +6462,20 @@ only these files will be asked to be saved."
                           "/"
                         (substring (car pair) 2)))))
        (setq file-arg-indices (cdr file-arg-indices))))
-    (case method
-      (identity (car arguments))
-      (add (concat "/:" (apply operation arguments)))
-      (insert-file-contents
+    (pcase method
+      (`identity (car arguments))
+      (`add (concat "/:" (apply operation arguments)))
+      (`insert-file-contents
        (let ((visit (nth 1 arguments)))
          (prog1
-              (apply operation arguments)
+             (apply operation arguments)
            (when (and visit buffer-file-name)
              (setq buffer-file-name (concat "/:" buffer-file-name))))))
-      (unquote-then-quote
+      (`unquote-then-quote
        (let ((buffer-file-name (substring buffer-file-name 2)))
          (apply operation arguments)))
-         (t
-          (apply operation arguments)))))
+      (_
+       (apply operation arguments)))))
 \f
 ;; Symbolic modes and read-file-modes.
 
index 86ebe47580b0f49802cea58056eab5f3562429ff..6c24a4f43d6a17ee3baaa546455b29bfb809da3b 100644 (file)
@@ -88,9 +88,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
+(eval-when-compile (require 'cl-lib))
 
 ;;; Some variables
 
@@ -1286,11 +1284,11 @@ on-close-all ... Not used"
              (or entry
                  (filesets-get-external-viewer filename)))))
     (filesets-alist-get def
-                       (case event
-                         ((on-open-all)       ':ignore-on-open-all)
-                         ((on-grep)           ':ignore-on-read-text)
-                         ((on-cmd) nil)
-                         ((on-close-all) nil))
+                       (pcase event
+                         (`on-open-all       ':ignore-on-open-all)
+                         (`on-grep           ':ignore-on-read-text)
+                         (`on-cmd nil)
+                         (`on-close-all nil))
                        nil t)))
 
 (defun filesets-filetype-get-prop (property filename &optional entry)
@@ -1559,11 +1557,9 @@ SAVE-FUNCTION takes no argument, but works on the current buffer."
 
 (defun filesets-get-fileset-from-name (name &optional mode)
   "Get fileset definition for NAME."
-  (case mode
-    ((:ingroup :tree)
-     name)
-    (t
-     (assoc name filesets-data))))
+  (pcase mode
+    ((or `:ingroup `:tree) name)
+    (_ (assoc name filesets-data))))
 
 
 ;;; commands
@@ -1720,22 +1716,22 @@ Replace <file-name> or <<file-name>> with filename."
 Assume MODE (see `filesets-entry-mode'), if provided."
   (let* ((mode (or mode
                   (filesets-entry-mode entry)))
-        (fl (case mode
-              ((:files)
+        (fl (pcase mode
+              (:files
                (filesets-entry-get-files entry))
-              ((:file)
+              (:file
                (list (filesets-entry-get-file entry)))
-              ((:ingroup)
+              (:ingroup
                (let ((entry (expand-file-name
                              (if (stringp entry)
                                  entry
                                (filesets-entry-get-master entry)))))
                  (cons entry (filesets-ingroup-cache-get entry))))
-              ((:tree)
+              (:tree
                (let ((dir  (nth 0 entry))
                      (patt (nth 1 entry)))
                  (filesets-directory-files dir patt ':files t)))
-              ((:pattern)
+              (:pattern
                (let ((dirpatt (filesets-entry-get-pattern entry)))
                  (if dirpatt
                      (let ((dir (filesets-entry-get-pattern--dir dirpatt))
@@ -1904,12 +1900,12 @@ User will be queried, if no fileset name is provided."
       (let* ((result  nil)
             (factor (ceiling (/ (float bl)
                                 filesets-max-submenu-length))))
-       (do ((data  submenu-body (cdr data))
-            (n     1            (+ n 1))
-            (count 0            (+ count factor)))
+       (cl-do ((data  submenu-body (cdr data))
+                (n     1            (+ n 1))
+                (count 0            (+ count factor)))
            ((or (> count bl)
                 (null data)))
-;        (let ((sl (subseq submenu-body count
+         ;; (let ((sl (subseq submenu-body count
          (let ((sl (filesets-sublist submenu-body count
                                      (let ((x (+ count factor)))
                                        (if (>= bl x)
@@ -1926,7 +1922,7 @@ User will be queried, if no fileset name is provided."
                       `((,(concat
                            (filesets-get-shortcut n)
                            (let ((rv ""))
-                             (do ((x sl (cdr x)))
+                             (cl-do ((x sl (cdr x)))
                                  ((null x))
                                (let ((y (concat (elt (car x) 0)
                                                 (if (null (cdr x))
@@ -1952,8 +1948,8 @@ User will be queried, if no fileset name is provided."
   "Get submenu epilog for SOMETHING (usually a fileset).
 If mode is :tree or :ingroup, SOMETHING is some weird construct and
 LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
-  (case mode
-    ((:tree)
+  (pcase mode
+    (:tree
      `("---"
        ["Close all files" (filesets-close ',mode ',something ',lookup-name)]
        ["Run Command"     (filesets-run-cmd nil ',something ',mode)]
@@ -1962,14 +1958,14 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
        ,@(when rebuild-flag
           `(["Rebuild this submenu"
              (filesets-rebuild-this-submenu ',lookup-name)]))))
-    ((:ingroup)
+    (:ingroup
      `("---"
        ["Close all files" (filesets-close ',mode ',something ',lookup-name)]
        ["Run Command"     (filesets-run-cmd nil ',something ',mode)]
        ,@(when rebuild-flag
           `(["Rebuild this submenu"
              (filesets-rebuild-this-submenu ',lookup-name)]))))
-    ((:pattern)
+    (:pattern
      `("---"
        ["Close all files" (filesets-close ',mode ',something)]
        ["Run Command"     (filesets-run-cmd nil ',something ',mode)]
@@ -1986,7 +1982,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
        ,@(when rebuild-flag
           `(["Rebuild this submenu"
              (filesets-rebuild-this-submenu ',lookup-name)]))))
-    ((:files)
+    (:files
      `("---"
        [,(concat "Close all files") (filesets-close ',mode ',something)]
        ["Run Command"               (filesets-run-cmd nil ',something ',mode)]
@@ -1997,7 +1993,7 @@ LOOKUP-NAME is used as lookup name for retrieving fileset specific settings."
        ,@(when rebuild-flag
           `(["Rebuild this submenu"
              (filesets-rebuild-this-submenu ',lookup-name)]))))
-    (t
+    (_
      (filesets-error 'error "Filesets: malformed definition of " something))))
 
 (defun filesets-ingroup-get-data (master pos &optional fun)
@@ -2249,15 +2245,15 @@ Construct a shortcut from COUNT."
          (filesets-verbosity (filesets-entry-get-verbosity entry))
          (this-lookup-name (concat (filesets-get-shortcut count)
                                    lookup-name)))
-      (case mode
-       ((:file)
+      (pcase mode
+       (:file
         (let* ((file (filesets-entry-get-file entry)))
           `[,this-lookup-name
             (filesets-file-open nil ',file ',lookup-name)]))
-       (t
+       (_
         `(,this-lookup-name
-          ,@(case mode
-              ((:pattern)
+          ,@(pcase mode
+              (:pattern
                (let* ((files    (filesets-get-filelist entry mode 'on-ls))
                       (dirpatt  (filesets-entry-get-pattern entry))
                       (pattname (apply 'concat (cons "Pattern: " dirpatt)))
@@ -2276,7 +2272,7 @@ Construct a shortcut from COUNT."
                        files))
                    ,@(filesets-get-menu-epilog lookup-name mode
                                                lookup-name t))))
-              ((:ingroup)
+              (:ingroup
                (let* ((master (filesets-entry-get-master entry)))
                  ;;(filesets-message 3 "Filesets: parsing %S" master)
                  `([,(concat "Inclusion Group: "
@@ -2288,12 +2284,12 @@ Construct a shortcut from COUNT."
                    ,@(filesets-wrap-submenu
                       (filesets-build-ingroup-submenu lookup-name master))
                    ,@(filesets-get-menu-epilog master mode lookup-name t))))
-              ((:tree)
+              (:tree
                (let* ((dirpatt (filesets-entry-get-tree entry))
                       (dir     (car dirpatt))
                       (patt    (cadr dirpatt)))
                  (filesets-build-dir-submenu entry lookup-name dir patt)))
-              ((:files)
+              (:files
                (let ((files (filesets-get-filelist entry mode 'on-open-all))
                      (count 0))
                  `([,(concat "Files: " lookup-name)
@@ -2331,9 +2327,9 @@ bottom up, set `filesets-submenus' to nil, first.)"
     (setq filesets-has-changed-flag nil)
     (setq filesets-updated-buffers nil)
     (setq filesets-update-cache-file-flag t)
-    (do ((data  (filesets-conditional-sort filesets-data (function car))
-               (cdr data))
-        (count 1 (+ count 1)))
+    (cl-do ((data  (filesets-conditional-sort filesets-data (function car))
+                   (cdr data))
+            (count 1 (+ count 1)))
        ((null data))
       (let* ((this    (car data))
             (name    (filesets-data-get-name this))
index 19fa8283b0613fc79de9c6e98a08d92c45ba8f79..1deafc9734c837cd8dcbe6ca601d2811f5c70498 100644 (file)
@@ -181,21 +181,21 @@ To override this, give an argument to `ff-find-other-file'."
   :group 'ff)
 
 ;;;###autoload
-(defvar ff-special-constructs
-  `(
-    ;; C/C++ include, for NeXTstep too
-    (,(purecopy "^\#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]") .
+(defcustom ff-special-constructs
+  ;; C/C++ include, for NeXTstep too
+  `((,(purecopy "^\#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]") .
      (lambda ()
-       (buffer-substring (match-beginning 2) (match-end 2))))
-    )
+       (buffer-substring (match-beginning 2) (match-end 2)))))
   ;; We include `ff-treat-as-special' documentation here so that autoload
   ;; can make it available to be read prior to loading this file.
-  "*List of special constructs for `ff-treat-as-special' to recognize.
+  "List of special constructs recognized by `ff-treat-as-special'.
 Each element, tried in order, has the form (REGEXP . EXTRACT).
 If REGEXP matches the current line (from the beginning of the line),
 `ff-treat-as-special' calls function EXTRACT with no args.
 If EXTRACT returns nil, keep trying.  Otherwise, return the
-filename that EXTRACT returned.")
+filename that EXTRACT returned."
+  :type '(repeat (cons regexp function))
+  :group 'ff)
 
 (defvaralias 'ff-related-file-alist 'ff-other-file-alist)
 (defcustom ff-other-file-alist 'cc-other-file-alist
index 4081bfd282337a4b8b7ee2ead976896904b54e76..8d15416d5576fe7ce2231457aef77ba9ed2d912b 100644 (file)
@@ -39,7 +39,7 @@
 ;; look under one of the level-2 headings, position the cursor on it and do C-c
 ;; C-z again.  This exposes the level-2 body and its level-3 child subheadings
 ;; and narrows the buffer again.  You can keep on zooming in on successive
-;; subheadings as much as you like.  A string in the modeline tells you how
+;; subheadings as much as you like.  A string in the mode line tells you how
 ;; deep you've gone.
 ;;
 ;; When zooming in on a heading you might only want to see the child
 ;; shows only the subheadings.
 
 ;; 1.2   28-Jan-94
-;; Fixed a dumb bug - didn't make `foldout-modeline-string' buffer-local :-(
+;; Fixed a dumb bug - didn't make `foldout-mode-line-string' buffer-local :-(
 ;;
 ;; Changed `foldout-exit-fold' to use prefix arg to say how many folds to exit.
 ;; Negative arg means exit but don't hide text.  Zero arg means exit all folds.
 An end marker of nil means the fold ends after (point-max).")
 (make-variable-buffer-local 'foldout-fold-list)
 
-(defvar foldout-modeline-string nil
-  "Modeline string announcing that we are in an outline fold.")
-(make-variable-buffer-local 'foldout-modeline-string)
+(defvar foldout-mode-line-string nil
+  "Mode line string announcing that we are in an outline fold.")
+(make-variable-buffer-local 'foldout-mode-line-string)
 
 ;; put our minor mode string immediately following outline-minor-mode's
-(or (assq 'foldout-modeline-string minor-mode-alist)
+(or (assq 'foldout-mode-line-string minor-mode-alist)
     (let ((outl-entry (memq (assq 'outline-minor-mode minor-mode-alist)
                            minor-mode-alist))
-         (foldout-entry '((foldout-modeline-string foldout-modeline-string))))
+         (foldout-entry '((foldout-mode-line-string foldout-mode-line-string))))
 
       ;; something's wrong with outline if we can't find it
       (if (null outl-entry)
@@ -296,8 +296,8 @@ optional arg EXPOSURE \(interactively with prefix arg\) changes this:-
       (setq foldout-fold-list (cons (cons start-marker end-marker)
                                    foldout-fold-list))
 
-      ;; update the modeline
-      (foldout-update-modeline)
+      ;; update the mode line
+      (foldout-update-mode-line)
       )))
 \f
 
@@ -375,8 +375,7 @@ exited and text is left visible."
 
       ;; zap the markers so they don't slow down editing
       (set-marker start-marker nil)
-      (if end-marker (set-marker end-marker nil))
-      )
+      (if end-marker (set-marker end-marker nil)))
 
     ;; narrow to the enclosing fold if there is one
     (if foldout-fold-list
@@ -386,32 +385,29 @@ exited and text is left visible."
          (narrow-to-region start-marker
                            (if end-marker
                                (1- (marker-position end-marker))
-                             (point-max)))
-         ))
+                             (point-max)))))
     (recenter)
 
-    ;; update the modeline
-    (foldout-update-modeline)
-    ))
+    ;; update the mode line
+    (foldout-update-mode-line)))
 \f
 
-(defun foldout-update-modeline ()
-  "Set the modeline string to indicate our fold depth."
+(defun foldout-update-mode-line ()
+  "Set the mode line to indicate our fold depth."
   (let ((depth (length foldout-fold-list)))
-    (setq foldout-modeline-string
+    (setq foldout-mode-line-string
          (cond
           ;; if we're not in a fold, keep quiet
           ((zerop depth)
            nil)
-          ;; in outline-minor-mode we're after "Outl:xx" in the modeline
+          ;; in outline-minor-mode we're after "Outl:xx" in the mode line
           (outline-minor-mode
            (format ":%d" depth))
           ;; otherwise just announce the depth (I guess we're in outline-mode)
           ((= depth 1)
            " Inside 1 fold")
           (t
-           (format " Inside %d folds" depth))
-          ))))
+           (format " Inside %d folds" depth))))))
 \f
 
 (defun foldout-mouse-zoom (event)
index a29f733148c115c1075ca73116f4f233d16b124e..0dea1917f859cf103de9863ca0bb978ecd7f42ad 100644 (file)
@@ -1,5 +1,4 @@
 ;;; follow.el --- synchronize windows showing the same buffer
-
 ;; Copyright (C) 1995-1997, 1999, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren <andersl@andersl.com>
@@ -24,8 +23,6 @@
 
 ;;; Commentary:
 
-;;{{{ Documentation
-
 ;; `Follow mode' is a minor mode for Emacs and XEmacs that
 ;; combines windows into one tall virtual window.
 ;;
 ;; (setq truncate-partial-width-windows nil)
 
 
-;; Since the display of XEmacs is pixel-oriented, a line could be
-;; clipped in half at the bottom of the window.
-;;
-;; To make XEmacs avoid clipping (normal) lines, please place the
-;; following line in your init-file:
-;;
-;; (setq pixel-vertical-clip-threshold 30)
-
-
 ;; The correct way to configure Follow mode, or any other mode for
 ;; that matter, is to create one or more functions that do
 ;; whatever you would like to do.  These functions are then added to
 ;; a hook.
 ;;
-;; When `Follow' mode is activated, functions stored in the hook
-;; `follow-mode-hook' are called.  When it is deactivated
-;; `follow-mode-off-hook' is run.
-;;
 ;; The keymap `follow-key-map' contains key bindings activated by
 ;; `follow-mode'.
 ;;
 ;;    Example from my ~/.emacs:
 ;;     (global-set-key [f8] 'follow-mode)
 
-
 ;; Implementation:
 ;;
-;; In an ideal world, follow mode would have been implemented in the
-;; kernel of the display routines, making sure that the windows (using
-;; follow mode) ALWAYS are aligned.  On planet Earth, however, we must
-;; accept a solution where we ALMOST ALWAYS can make sure that the
-;; windows are aligned.
-;;
-;; Follow mode does this in three places:
-;; 1) After each user command.
-;; 2) After a process output has been performed.
-;; 3) When a scrollbar has been moved.
+;; The main method by which Follow mode aligns windows is via the
+;; function `follow-post-command-hook', which is run after each
+;; command.  This "fixes up" the alignment of other windows which are
+;; showing the same Follow mode buffer, on the same frame as the
+;; selected window.  It does not try to deal with buffers other than
+;; the buffer of the selected frame, or windows on other frames.
 ;;
-;; This will cover most situations. (Let me know if there are other
-;; situations that should be covered.)
-;;
-;; Note that only the selected window is checked, for the reason of
-;; efficiency and code complexity.  (I.e. it is possible to make a
-;; non-selected window unaligned.  It will, however, pop right back
-;; when it is selected.)
-
-;;}}}
+;; Comint mode specially calls `follow-comint-scroll-to-bottom' on
+;; Follow mode buffers.  This function scrolls the bottom-most window
+;; in a window chain and aligns the other windows accordingly.  Follow
+;; mode adds a function to `compilation-filter-hook' to align
+;; compilation buffers.
 
 ;;; Code:
 
-;;{{{ Preliminaries
-
-;; Make the compiler shut up!
-;; There are two strategies:
-;; 1) Shut warnings off completely.
-;; 2) Handle each warning separately.
-;;
-;; Since I would like to see real errors, I've selected the latter
-;; method.
-;;
-;; The problem with undefined variables and functions has been solved
-;; by using `set', `symbol-value' and `symbol-function' rather than
-;; `setq' and direct references to variables and functions.
-;;
-;; For example:
-;;     (if (boundp 'foo)   ... (symbol-value 'foo) )
-;;     (set 'foo ...)   <-- XEmacs doesn't fall for this one.
-;;     (funcall (symbol-function 'set) 'bar ...)
-;;
-;; Note: When this file is interpreted, `eval-when-compile' is
-;; evaluated.  Since it doesn't hurt to evaluate it, but it is a bit
-;; annoying, we test if the byte-compiler has been loaded.  This can,
-;; of course, lead to some occasional unintended evaluation...
-;;
-;; Should someone come up with a better solution, please let me
-;; know.
-
 (require 'easymenu)
 
-(eval-when-compile
-  (if (or (featurep 'bytecomp)
-         (featurep 'byte-compile))
-      (cond ((featurep 'xemacs)
-            ;; Make XEmacs shut up!  I'm using standard Emacs
-            ;; functions, they are NOT obsolete!
-            (if (eq (get 'force-mode-line-update 'byte-compile)
-                    'byte-compile-obsolete)
-                (put 'force-mode-line-update 'byte-compile 'nil))
-            (if (eq (get 'frame-first-window 'byte-compile)
-                    'byte-compile-obsolete)
-                (put 'frame-first-window 'byte-compile 'nil))))))
-
-;;}}}
-;;{{{ Variables
+;;; Variables
 
 (defgroup follow nil
   "Synchronize windows showing the same buffer."
-  :prefix "follow-"
   :group 'windows
   :group 'convenience)
 
   :type 'hook
   :group 'follow)
 
-(defcustom follow-mode-off-hook nil
-  "Hooks to run when Follow mode is turned off."
-  :type 'hook
-  :group 'follow)
-(make-obsolete-variable 'follow-mode-off-hook 'follow-mode-hook "22.2")
-
-;;{{{ Keymap/Menu
+;;; Keymap/Menu
 
 ;; Define keys for the follow-mode minor mode map and replace some
-;; functions in the global map.  All `follow' mode special functions
-;; can be found on (the somewhat cumbersome) "C-c . <key>"
-;; (Control-C dot <key>). (As of Emacs 19.29 the keys
-;; C-c <punctuation character> are reserved for minor modes.)
+;; functions in the global map.  All Follow mode special functions can
+;; be found on the `C-c .' prefix key.
 ;;
-;; To change the prefix, redefine `follow-mode-prefix' before
-;; `follow' is loaded, or see the section on `follow-mode-hook'
-;; above for an example of how to bind the keys the way you like.
-;;
-;; Please note that the keymap is defined the first time this file is
-;; loaded.  Also note that the only valid way to manipulate the
-;; keymap is to use `define-key'.  Don't change it using `setq' or
-;; similar!
+;; To change the prefix, redefine `follow-mode-prefix' before `follow'
+;; is loaded, or see the section on `follow-mode-hook' above for an
+;; example of how to bind the keys the way you like.
 
 (defcustom follow-mode-prefix "\C-c."
   "Prefix key to use for follow commands in Follow mode.
@@ -334,6 +254,12 @@ After that, changing the prefix key requires manipulating keymaps."
     ;; the look and feel of Follow mode.)
     (define-key mainmap [remap end-of-buffer] 'follow-end-of-buffer)
 
+    (define-key mainmap [remap scroll-bar-toolkit-scroll] 'follow-scroll-bar-toolkit-scroll)
+    (define-key mainmap [remap scroll-bar-drag] 'follow-scroll-bar-drag)
+    (define-key mainmap [remap scroll-bar-scroll-up] 'follow-scroll-bar-scroll-up)
+    (define-key mainmap [remap scroll-bar-scroll-down] 'follow-scroll-bar-scroll-down)
+    (define-key mainmap [remap mwheel-scroll] 'follow-mwheel-scroll)
+
     mainmap)
   "Minor mode keymap for Follow mode.")
 
@@ -345,16 +271,8 @@ After that, changing the prefix key requires manipulating keymaps."
     '(["Follow mode"   follow-mode
        :style toggle :selected follow-mode])))
 
-;; If there is a `tools' menu, we use it.  However, we can't add a
-;; minor-mode specific item to it (it's broken), so we make the
-;; contents ghosted when not in use, and add ourselves to the
-;; global map.
 (easy-menu-add-item nil '("Tools")
   '("Follow"
-    ;; The Emacs code used to just gray out operations when follow-mode was
-    ;; not enabled, whereas the XEmacs code used to remove it altogether.
-    ;; Not sure which is preferable, but clearly the preference should not
-    ;; depend on the flavor.
     :filter follow-menu-filter
     ["Scroll Up"       follow-scroll-up        follow-mode]
     ["Scroll Down"     follow-scroll-down      follow-mode]
@@ -373,8 +291,6 @@ After that, changing the prefix key requires manipulating keymaps."
     "--"
     ["Follow mode"     follow-mode :style toggle :selected follow-mode]))
 
-;;}}}
-
 (defcustom follow-mode-line-text " Follow"
   "Text shown in the mode line when Follow mode is active.
 Defaults to \" Follow\".  Examples of other values
@@ -385,30 +301,12 @@ are \" Fw\", or simply \"\"."
 (defcustom follow-auto nil
   "Non-nil activates Follow mode whenever a file is loaded."
   :type 'boolean
-  :group 'follow)
-
-(defcustom follow-intercept-processes (fboundp 'start-process)
-  "When non-nil, Follow mode will monitor process output."
-  :type 'boolean
-  :group 'follow)
-
-(defvar follow-avoid-tail-recenter-p (not (featurep 'xemacs))
-  "*When non-nil, patch Emacs so that tail windows won't be recentered.
-
-A \"tail window\" is a window that displays only the end of
-the buffer.  Normally it is practical for the user that empty
-windows are recentered automatically.  However, when using
-Follow mode it breaks the display when the end is displayed
-in a window \"above\" the last window.  This is for
-example the case when displaying a short page in info.
-
-Must be set before Follow mode is loaded.
-
-Please note that it is not possible to fully prevent Emacs from
-recentering empty windows.  Please report if you find a repeatable
-situation in which Emacs recenters empty windows.
-
-XEmacs, as of 19.12, does not recenter windows, good!")
+  :group 'follow
+  :set (lambda (symbol value)
+        (if value
+            (add-hook 'find-file-hook 'follow-find-file-hook t)
+          (remove-hook 'find-file-hook 'follow-find-file-hook))
+        (set-default symbol value)))
 
 (defvar follow-cache-command-list
   '(next-line previous-line forward-char backward-char)
@@ -423,18 +321,16 @@ The commands in this list are checked at load time.
 To mark other commands as suitable for caching, set the symbol
 property `follow-mode-use-cache' to non-nil.")
 
-(defvar follow-debug nil
-  "*Non-nil when debugging Follow mode.")
-
+(defcustom follow-debug nil
+  "If non-nil, emit Follow mode debugging messages."
+  :type 'boolean
+  :group 'follow)
 
 ;; Internal variables:
 
 (defvar follow-internal-force-redisplay nil
   "True when Follow mode should redisplay the windows.")
 
-(defvar follow-process-filter-alist '()
-  "The original filters for processes intercepted by Follow mode.")
-
 (defvar follow-active-menu nil
   "The menu visible when Follow mode is active.")
 
@@ -448,8 +344,7 @@ Used by `follow-window-size-change'.")
 (defvar follow-windows-start-end-cache nil
   "Cache used by `follow-window-start-end'.")
 
-;;}}}
-;;{{{ Debug messages
+;;; Debug messages
 
 ;; This inline function must be as small as possible!
 ;; Maybe we should define a macro that expands to nil if
@@ -460,15 +355,12 @@ Used by `follow-window-size-change'.")
   (if (and (boundp 'follow-debug) follow-debug)
       (apply 'message args)))
 
-;;}}}
-;;{{{ Cache
+;;; Cache
 
 (dolist (cmd follow-cache-command-list)
   (put cmd 'follow-mode-use-cache t))
 
-;;}}}
-
-;;{{{ The mode
+;;; The mode
 
 ;;;###autoload
 (defun turn-on-follow-mode ()
@@ -514,49 +406,35 @@ To split one large window into two side-by-side windows, the commands
 
 Only windows displayed in the same frame follow each other.
 
-If the variable `follow-intercept-processes' is non-nil, Follow mode
-will listen to the output of processes and redisplay accordingly.
-\(This is the default.)
-
 This command runs the normal hook `follow-mode-hook'.
 
 Keys specific to Follow mode:
 \\{follow-mode-map}"
   :keymap follow-mode-map
-  (when (and follow-mode follow-intercept-processes)
-    (follow-intercept-process-output))
-  (cond (follow-mode ; On
-         ;; XEmacs: If this is non-nil, the window will scroll before
-         ;; the point will have a chance to get into the next window.
-         (when (boundp 'scroll-on-clipped-lines)
-          (setq scroll-on-clipped-lines nil))
-         (force-mode-line-update)
-         (add-hook 'post-command-hook 'follow-post-command-hook t))
-
-        ((not follow-mode) ; Off
-         (force-mode-line-update))))
-
-;;}}}
-;;{{{ Find file hook
-
-;; This will start follow-mode whenever a new file is loaded, if
-;; the variable `follow-auto' is non-nil.
-
-(add-hook 'find-file-hook 'follow-find-file-hook t)
+  (if follow-mode
+      (progn
+       (add-hook 'compilation-filter-hook 'follow-align-compilation-windows t t)
+       (add-hook 'post-command-hook 'follow-post-command-hook t)
+       (add-hook 'window-size-change-functions 'follow-window-size-change t))
+    ;; Remove globally-installed hook functions only if there is no
+    ;; other Follow mode buffer.
+    (let ((buffers (buffer-list))
+         following)
+      (while (and (not following) buffers)
+       (setq following (buffer-local-value 'follow-mode (car buffers))
+             buffers (cdr buffers)))
+      (unless following
+       (remove-hook 'post-command-hook 'follow-post-command-hook)
+       (remove-hook 'window-size-change-functions 'follow-window-size-change)))
+    (remove-hook 'compilation-filter-hook 'follow-align-compilation-windows t)))
 
 (defun follow-find-file-hook ()
   "Find-file hook for Follow mode.  See the variable `follow-auto'."
-  (if follow-auto (follow-mode t)))
-
-;;}}}
+  (if follow-auto (follow-mode 1)))
 
-;;{{{ User functions
+;;; User functions
 
-;;;
-;;; User functions usable when in Follow mode.
-;;;
-
-;;{{{ Scroll
+;;; Scroll
 
 ;; `scroll-up' and `-down', but for windows in Follow mode.
 ;;
@@ -584,7 +462,7 @@ Negative ARG means scroll downward.
 
 Works like `scroll-up' when not in Follow mode."
   (interactive "P")
-  (cond ((not (and (boundp 'follow-mode) follow-mode))
+  (cond ((not follow-mode)
         (scroll-up arg))
        (arg
         (save-excursion (scroll-up arg))
@@ -613,7 +491,7 @@ Negative ARG means scroll upward.
 
 Works like `scroll-up' when not in Follow mode."
   (interactive "P")
-  (cond ((not (and (boundp 'follow-mode) follow-mode))
+  (cond ((not follow-mode)
         (scroll-up arg))
        (arg
         (save-excursion (scroll-down arg)))
@@ -633,8 +511,48 @@ Works like `scroll-up' when not in Follow mode."
             (vertical-motion (- next-screen-context-lines 1))
             (setq follow-internal-force-redisplay t))))))
 
-;;}}}
-;;{{{ Buffer
+(declare-function comint-adjust-point "comint" (window))
+(defvar comint-scroll-show-maximum-output)
+
+(defun follow-comint-scroll-to-bottom (&optional window)
+  "Scroll the bottom-most window in the current Follow chain.
+This is to be called by `comint-postoutput-scroll-to-bottom'."
+  (let* ((buffer (current-buffer))
+        (selected (selected-window))
+        (is-selected (eq (window-buffer) buffer))
+        some-window)
+    (when (or is-selected
+             (setq some-window (get-buffer-window)))
+      (let* ((pos (progn (comint-adjust-point nil) (point)))
+            (win (if is-selected
+                     selected
+                   (car (last (follow-all-followers some-window))))))
+       (select-window win)
+       (goto-char pos)
+       (setq follow-windows-start-end-cache nil)
+       (follow-adjust-window win pos)
+       (unless is-selected
+         (select-window selected)
+         (set-buffer buffer))))))
+
+(defun follow-align-compilation-windows ()
+  "Align the windows of the current Follow mode buffer.
+This is to be called from `compilation-filter-hook'."
+  (let ((buffer (current-buffer))
+       (win (get-buffer-window))
+       (selected (selected-window)))
+    (when (and follow-mode (waiting-for-user-input-p) win)
+      (let ((windows (follow-all-followers win)))
+       (unless (eq (window-buffer selected) buffer)
+         (setq win (car windows))
+         (select-window win))
+       (follow-redisplay windows win t)
+       (setq follow-windows-start-end-cache nil)
+       (unless (eq selected win)
+         (select-window selected)
+         (set-buffer buffer))))))
+
+;;; Buffer
 
 ;;;###autoload
 (defun follow-delete-other-windows-and-split (&optional arg)
@@ -649,11 +567,7 @@ two windows always will display two successive pages.
 
 If ARG is positive, the leftmost window is selected.  If negative,
 the rightmost is selected.  If ARG is nil, the leftmost window is
-selected if the original window is the first one in the frame.
-
-To bind this command to a hotkey, place the following line
-in your `~/.emacs' file, replacing [f7] by your favorite key:
-    (global-set-key [f7] 'follow-delete-other-windows-and-split)"
+selected if the original window is the first one in the frame."
   (interactive "P")
   (let ((other (or (and (null arg)
                        (not (eq (selected-window)
@@ -689,28 +603,22 @@ Defaults to current buffer."
                                  (current-buffer))))
   (or buffer (setq buffer (current-buffer)))
   (let ((orig-window (selected-window)))
-    (walk-windows
-     (function
-      (lambda (win)
-       (select-window win)
-       (switch-to-buffer buffer))))
+    (walk-windows (lambda (win)
+                   (select-window win)
+                   (switch-to-buffer buffer))
+                 'no-minibuf)
     (select-window orig-window)
     (follow-redisplay)))
 
 
 (defun follow-switch-to-current-buffer-all ()
-  "Show current buffer in all windows on this frame, and enter Follow mode.
-
-To bind this command to a hotkey place the following line
-in your `~/.emacs' file:
-       (global-set-key [f7] 'follow-switch-to-current-buffer-all)"
+  "Show current buffer in all windows on this frame, and enter Follow mode."
   (interactive)
-  (or (and (boundp 'follow-mode) follow-mode)
-      (follow-mode 1))
+  (unless follow-mode
+    (follow-mode 1))
   (follow-switch-to-buffer-all))
 
-;;}}}
-;;{{{ Movement
+;;; Movement
 
 ;; Note, these functions are not very useful, at least not unless you
 ;; rebind the rather cumbersome key sequence `C-c . p'.
@@ -744,8 +652,7 @@ in your `~/.emacs' file:
   (interactive)
   (select-window (car (reverse (follow-all-followers)))))
 
-;;}}}
-;;{{{ Redraw
+;;; Redraw
 
 (defun follow-recenter (&optional arg)
   "Recenter the middle window around point.
@@ -777,9 +684,7 @@ from the bottom."
           (win (nth (/ (- (length windows) 1) 2) windows)))
       (select-window win)
       (goto-char dest)
-      (recenter)
-      ;;(setq follow-internal-force-redisplay t)
-      )))
+      (recenter))))
 
 
 (defun follow-redraw ()
@@ -792,8 +697,7 @@ Follow mode since the windows should always be aligned."
   (sit-for 0)
   (follow-redisplay))
 
-;;}}}
-;;{{{ End of buffer
+;;; End of buffer
 
 (defun follow-end-of-buffer (&optional arg)
   "Move point to the end of the buffer, Follow mode style.
@@ -816,38 +720,37 @@ of the way from the true end."
     (with-no-warnings
       (end-of-buffer arg))))
 
-;;}}}
-
-;;}}}
-
-;;{{{ Display
-
-;;;; The display routines
-
-;;{{{ Information gathering functions
-
-(defun follow-all-followers (&optional testwin)
-  "Return all windows displaying the same buffer as the TESTWIN.
-The list contains only windows displayed in the same frame as TESTWIN.
-If TESTWIN is nil the selected window is used."
-  (or (window-live-p testwin)
-      (setq testwin (selected-window)))
-  (let* ((top (frame-first-window (window-frame testwin)))
-        (win top)
-        (done nil)
-        (windows '())
-        (buffer (window-buffer testwin)))
-    (while (and (not done) win)
-      (if (eq (window-buffer win) buffer)
-         (setq windows (cons win windows)))
-      (setq win (next-window win 'not))
-      (if (eq win top)
-         (setq done t)))
-    (nreverse windows)))
-
+;;; Display
+
+(defun follow--window-sorter (w1 w2)
+  "Sorting function for W1 and W2 based on their positions.
+Return non-nil if W1 is above W2; if their top-lines
+are at the same position, return non-nil if W1 is to the
+left of W2."
+  (let* ((edge-1 (window-pixel-edges w1))
+        (edge-2 (window-pixel-edges w2))
+        (y1 (nth 1 edge-1))
+        (y2 (nth 1 edge-2)))
+    (if (= y1 y2)
+       (< (car edge-1) (car edge-2))
+      (< y1 y2))))
+
+(defun follow-all-followers (&optional win)
+  "Return all windows displaying the same buffer as the WIN.
+The list is sorted with topmost and leftmost windows first, and
+contains only windows in the same frame as WIN.  If WIN is nil,
+it defaults to the selected window."
+  (unless (window-live-p win)
+    (setq win (selected-window)))
+  (let ((buffer (window-buffer win))
+       windows)
+    (dolist (w (window-list (window-frame win) 'no-minibuf win))
+      (if (eq (window-buffer w) buffer)
+         (push w windows)))
+    (sort windows 'follow--window-sorter)))
 
 (defun follow-split-followers (windows &optional win)
-  "Split the WINDOWS into the sets: predecessors and successors.
+  "Split WINDOWS into two sets: predecessors and successors.
 Return `(PRED . SUCC)' where `PRED' and `SUCC' are ordered starting
 from the selected window."
   (or win
@@ -858,62 +761,35 @@ from the selected window."
       (setq windows (cdr windows)))
     (cons pred (cdr windows))))
 
-
-;; This function is optimized function for speed!
-
 (defun follow-calc-win-end (&optional win)
-  "Calculate the presumed window end for WIN.
-
-Actually, the position returned is the start of the next
-window, normally is the end plus one.
-
-If WIN is nil, the selected window is used.
-
-Returns (end-pos end-of-buffer-p)"
-  (if (featurep 'xemacs)
-      ;; XEmacs can calculate the end of the window by using
-      ;; the 'guarantee options. GOOD!
-      (let ((end (window-end win t)))
-       (if (= end (point-max (window-buffer win)))
-           (list end t)
-         (list (+ end 1) nil)))
-    ;; Emacs: We have to calculate the end by ourselves.
-    ;; This code works on both XEmacs and Emacs, but now
-    ;; that XEmacs has got custom-written code, this could
-    ;; be optimized for Emacs.
-    (let (height buffer-end-p)
-      (with-selected-window (or win (selected-window))
-       (save-excursion
-         (goto-char (window-start))
-         (setq height
-               (- (window-height)
-                  (if header-line-format 2 1)))
-         (setq buffer-end-p
-               (if (bolp)
-                   (not (= height (vertical-motion height)))
-                 (save-restriction
-                   ;; Fix a mis-feature in `vertical-motion':
-                   ;; The start of the window is assumed to
-                   ;; coincide with the start of a line.
-                   (narrow-to-region (point) (point-max))
-                   (not (= height (vertical-motion height))))))
-         (list (point) buffer-end-p))))))
-
-
-;; Can't use `save-window-excursion' since it triggers a redraw.
-(defun follow-calc-win-start (windows pos win)
-  "Calculate where WIN will start if the first in WINDOWS start at POS.
+  "Calculate the end position for window WIN.
+Return (END-POS END-OF-BUFFER).
+
+Actually, the position returned is the start of the line after
+the last fully-visible line in WIN.  If WIN is nil, the selected
+window is used."
+  (let* ((win (or win (selected-window)))
+        (edges (window-inside-pixel-edges win))
+        (ht (- (nth 3 edges) (nth 1 edges)))
+        (last-line-pos (posn-point (posn-at-x-y 0 (1- ht) win))))
+    (if (pos-visible-in-window-p last-line-pos win)
+       (let ((end (window-end win t)))
+         (list end (= end (point-max))))
+      (list last-line-pos nil))))
 
-If WIN is nil the point below all windows is returned."
-  (let (start)
-    (while (and windows (not (eq (car windows) win)))
-      (setq start (window-start (car windows)))
+(defun follow-calc-win-start (windows pos win)
+  "Determine the start of window WIN in a Follow mode window chain.
+WINDOWS is a list of chained windows, and POS is the starting
+position for the first window in the list.  If WIN is nil, return
+the point below all windows."
+  (while (and windows (not (eq (car windows) win)))
+    (let ((old-start (window-start (car windows))))
+      ;; Can't use `save-window-excursion' since it triggers a redraw.
       (set-window-start (car windows) pos 'noforce)
       (setq pos (car (follow-calc-win-end (car windows))))
-      (set-window-start (car windows) start 'noforce)
-      (setq windows (cdr windows)))
-    pos))
-
+      (set-window-start (car windows) old-start 'noforce)
+      (setq windows (cdr windows))))
+  pos)
 
 ;; The result from `follow-windows-start-end' is cached when using
 ;; a handful simple commands, like cursor movement commands.
@@ -932,23 +808,8 @@ Note that this handles the case when the cache has been set to nil."
       (setq cache (cdr cache)))
     (and res (null windows) (null cache))))
 
-
-(defsubst follow-invalidate-cache ()
-  "Force `follow-windows-start-end' to recalculate the end of the window."
-  (setq follow-windows-start-end-cache nil))
-
-
-;; Build a list of windows and their start and end positions.
-;; Useful to avoid calculating start/end position whenever they are needed.
-;; The list has the format:
-;; ((Win Start End End-of-buffer-visible-p) ...)
-
-;; Used to have a `save-window-excursion', but it obviously triggered
-;; redraws of the display. Check if I used it for anything.
-
-
 (defun follow-windows-start-end (windows)
-  "Builds a list of (WIN START END BUFFER-END-P) for every window in WINDOWS."
+  "Return a list of (WIN START END BUFFER-END-P) for window list WINDOWS."
   (if (follow-cache-valid-p windows)
       follow-windows-start-end-cache
     (let ((orig-win (selected-window))
@@ -960,7 +821,6 @@ Note that this handles the case when the cache has been set to nil."
       (select-window orig-win)
       (setq follow-windows-start-end-cache (nreverse win-start-end)))))
 
-
 (defsubst follow-pos-visible (pos win win-start-end)
   "Non-nil when POS is visible in WIN."
   (let ((wstart-wend-bend (cdr (assq win win-start-end))))
@@ -974,20 +834,16 @@ Note that this handles the case when the cache has been set to nil."
 ;; should start at a full screen line.
 
 (defsubst follow-windows-aligned-p (win-start-end)
-  "Non-nil if the follower windows are aligned."
-  (let ((res t))
-    (save-excursion
-      (goto-char (window-start (caar win-start-end)))
-      (unless (bolp)
-       (vertical-motion 0 (caar win-start-end))
-       (setq res (eq (point) (window-start (caar win-start-end))))))
-    (while (and res (cdr win-start-end))
-      ;; At least two followers left
-      (setq res (eq (car (cdr (cdr (car win-start-end))))
-                   (car (cdr (car (cdr win-start-end))))))
+  "Non-nil if the follower windows are aligned.
+The argument, WIN-START-END, should be a list of the form
+returned by `follow-windows-start-end'."
+  (let ((result t))
+    (while (and win-start-end result)
+      (if (cdr win-start-end)
+         (setq result (eq (nth 2 (car win-start-end))
+                          (nth 1 (cadr win-start-end)))))
       (setq win-start-end (cdr win-start-end)))
-    res))
-
+    result))
 
 ;; Check if the point is visible in all windows. (So that
 ;; no one will be recentered.)
@@ -1023,43 +879,22 @@ Note that this handles the case when the cache has been set to nil."
        (vertical-motion 1 win)
        (set-window-start win (point) 'noforce)))))
 
-;;}}}
-;;{{{ Selection functions
-
-;; Make a window in WINDOWS selected if it currently
-;; is displaying the position DEST.
-;;
-;; We don't select a window if it just has been moved.
-
 (defun follow-select-if-visible (dest win-start-end)
   "Select and return a window, if DEST is visible in it.
 Return the selected window."
-  (let (win win-end)
+  (let (win win-end wse)
     (while (and (not win) win-start-end)
       ;; Don't select a window that was just moved. This makes it
-      ;; possible to later select the last window after a `end-of-buffer'
-      ;; command.
-      (when (follow-pos-visible dest (caar win-start-end) win-start-end)
-       (setq win (caar win-start-end)
-             win-end (car (cddr (car win-start-end))))
+      ;; possible to later select the last window after a
+      ;; `end-of-buffer' command.
+      (setq wse (car win-start-end))
+      (when (follow-pos-visible dest (car wse) win-start-end)
+       (setq win (car wse)
+             win-end (nth 2 wse))
        (select-window win))
       (setq win-start-end (cdr win-start-end)))
-    ;; The last line of the window may be partially visible; if so,
-    ;; and if point is visible in the next window, select the next
-    ;; window instead.
-    (and win
-        (/= dest (point-max))
-        win-start-end
-        (follow-pos-visible dest (caar win-start-end) win-start-end)
-        (save-excursion
-          (goto-char dest)
-          (vertical-motion 1 win)
-          (>= (point) win-end))
-        (setq win (caar win-start-end))
-        (select-window win))
     win))
 
-
 ;; Lets select a window showing the end. Make sure we only select it if
 ;; it wasn't just moved here. (I.e. M-> shall not unconditionally place
 ;; the point in the selected window.)
@@ -1112,8 +947,8 @@ Otherwise, return nil."
              (set-window-start (car windows) (point) 'noforce)
              (setq end-pos-end-p (follow-calc-win-end (car windows)))
              (goto-char (car end-pos-end-p))
-             ;; Visible, if dest above end, or if eob is visible inside
-             ;; the window.
+             ;; Visible, if dest above end, or if eob is visible
+             ;; inside the window.
              (if (or (car (cdr end-pos-end-p))
                      (< dest (point)))
                  (setq win (car windows))
@@ -1124,9 +959,7 @@ Otherwise, return nil."
       (goto-char dest))
     win))
 
-
-;;}}}
-;;{{{ Redisplay
+;;; Redisplay
 
 ;; Redraw all the windows on the screen, starting with the top window.
 ;; The window used as as marker is WIN, or the selected window if WIN
@@ -1167,7 +1000,6 @@ repositioning the other windows."
        (set-window-start w start))
       (setq start (car (follow-calc-win-end w))))))
 
-
 (defun follow-estimate-first-window-start (windows win start)
   "Estimate the position of the first window.
 The estimate is computed by assuming that the window WIN, which
@@ -1206,9 +1038,6 @@ should be a member of WINDOWS, starts at position START."
 
 ;; Find the starting point, start at GUESS and search upward.  Return
 ;; a point on the same line as GUESS, or above.
-;;
-;; (Is this ever used? I must make sure it works just in case it is
-;; ever called.)
 
 (defun follow-calculate-first-window-start-from-below
        (windows guess &optional win start)
@@ -1240,65 +1069,40 @@ should be a member of WINDOWS, starts at position START."
                 (setq res (point))))))
       res)))
 
-;;}}}
-;;{{{ Avoid tail recenter
+;;; Avoid tail recenter
 
-;; This sets the window internal flag `force_start'. The effect is that
-;; windows only displaying the tail aren't recentered.
-;; Has to be called before every redisplay... (Great isn't it?)
-;;
-;; XEmacs doesn't recenter the tail, GOOD!
-;;
-;; A window displaying only the tail, is a window whose
-;; window-start position is equal to (point-max) of the buffer it
-;; displays.
-;;
-;; This function is also added to `post-command-idle-hook', introduced
-;; in Emacs 19.30.  This is needed since the vaccine injected by the
-;; call from `post-command-hook' only works until the next redisplay.
-;; It is possible that the functions in the `post-command-idle-hook'
-;; can cause a redisplay, and hence a new vaccine is needed.
+;; This sets the window internal flag `force_start'. The effect is
+;; that windows only displaying the tail aren't recentered.
 ;;
-;; Sometimes, calling this function could actually cause a redisplay,
-;; especially if it is placed in the debug filter section.  I must
-;; investigate this further...
+;; A window displaying only the tail, is a window whose window-start
+;; position is equal to (point-max) of the buffer it displays.
 
 (defun follow-avoid-tail-recenter (&rest _rest)
   "Make sure windows displaying the end of a buffer aren't recentered.
-
 This is done by reading and rewriting the start position of
 non-first windows in Follow mode."
-  (if follow-avoid-tail-recenter-p
-      (let* ((orig-buffer (current-buffer))
-           (top (frame-first-window (selected-frame)))
-           (win top)
-           (who '())                   ; list of (buffer . frame)
-           start
-           pair)                       ; (buffer . frame)
-       ;; If the only window in the frame is a minibuffer
-       ;; window, `next-window' will never find it again...
-       (if (window-minibuffer-p top)
-           nil
-         (while  ;; look, no body!
-             (progn
-               (setq start (window-start win))
-               (set-buffer (window-buffer win))
-               (setq pair (cons (window-buffer win) (window-frame win)))
-               (if (member pair who)
-                   (if (and (boundp 'follow-mode) follow-mode
-                            (eq (point-max) start))
-                       ;; Write the same window start back, but don't
-                       ;; set the NOFORCE flag.
-                       (set-window-start win start))
-                 (setq who (cons pair who)))
-               (setq win (next-window win 'not t))
-               (not (eq win top))))  ;; Loop while this is true.
-         (set-buffer orig-buffer)))))
-
-;;}}}
-
-;;}}}
-;;{{{ Post Command Hook
+  (let* ((orig-buffer (current-buffer))
+        (top (frame-first-window (selected-frame)))
+        (win top)
+        who) ; list of (buffer . frame)
+    ;; If the only window in the frame is a minibuffer
+    ;; window, `next-window' will never find it again...
+    (unless (window-minibuffer-p top)
+      (while  ;; look, no body!
+         (let ((start (window-start win))
+               (pair (cons (window-buffer win) (window-frame win))))
+           (set-buffer (window-buffer win))
+           (cond ((null (member pair who))
+                  (setq who (cons pair who)))
+                 ((and follow-mode (eq (point-max) start))
+                  ;; Write the same window start back, but don't
+                  ;; set the NOFORCE flag.
+                  (set-window-start win start)))
+           (setq win (next-window win 'not t))
+           (not (eq win top))))  ;; Loop while this is true.
+      (set-buffer orig-buffer))))
+
+;;; Post Command Hook
 
 ;; The magic little box. This function is called after every command.
 
@@ -1319,149 +1123,151 @@ non-first windows in Follow mode."
       (with-current-buffer (window-buffer win)
        (unless (and (symbolp this-command)
                     (get this-command 'follow-mode-use-cache))
-         (follow-invalidate-cache))
-       (when (and follow-mode
-                  (not (window-minibuffer-p win)))
-         ;; The buffer shown in the selected window is in follow
-         ;; mode.  Find the current state of the display.
-         (let* ((windows (follow-all-followers win))
-                (dest (point))
-                (win-start-end (progn
-                                 (follow-update-window-start (car windows))
-                                 (follow-windows-start-end windows)))
-                (aligned (follow-windows-aligned-p win-start-end))
-                (visible (follow-pos-visible dest win win-start-end))
-                selected-window-up-to-date)
-           (unless (and aligned visible)
-             (follow-invalidate-cache))
-           (follow-avoid-tail-recenter)
-           ;; Select a window to display point.
-           (unless follow-internal-force-redisplay
-             (if (eq dest (point-max))
-                 ;; At point-max, we have to be careful since the
-                 ;; display can be aligned while `dest' can be
-                 ;; visible in several windows.
-                 (cond
-                  ;; Select the current window, but only when the
-                  ;; display is correct. (When inserting characters
-                  ;; in a tail window, the display is not correct, as
-                  ;; they are shown twice.)
-                  ;;
-                  ;; Never stick to the current window after a
-                  ;; deletion.  The reason is cosmetic: when typing
-                  ;; `DEL' in a window showing only the end of the
-                  ;; file, a character would be removed from the
-                  ;; window above, which is very unintuitive.
-                  ((and visible
-                        aligned
-                        (not (memq this-command
-                                   '(backward-delete-char
-                                     delete-backward-char
-                                     backward-delete-char-untabify
-                                     kill-region))))
-                   (follow-debug-message "Max: same"))
-                  ;; If the end is visible, and the window doesn't
-                  ;; seems like it just has been moved, select it.
-                  ((follow-select-if-end-visible win-start-end)
-                   (follow-debug-message "Max: end visible")
-                   (setq visible t aligned nil)
-                   (goto-char dest))
-                  ;; Just show the end...
-                  (t
-                   (follow-debug-message "Max: default")
-                   (select-window (car (reverse windows)))
-                   (goto-char dest)
-                   (setq visible nil aligned nil)))
-
-               ;; We're not at the end, here life is much simpler.
-               (cond
-                ;; This is the normal case!
-                ;; It should be optimized for speed.
-                ((and visible aligned)
-                 (follow-debug-message "same"))
-                ;; Pick a position in any window.  If the display is
-                ;; ok, this will pick the `correct' window.
-                ((follow-select-if-visible dest win-start-end)
-                 (follow-debug-message "visible")
-                 (goto-char dest)
-                 ;; We have to perform redisplay, since scrolling is
-                 ;; needed in case the line is partially visible.
-                 (setq visible nil))
-                ;; Not visible anywhere else, lets pick this one.
-                ;; (Is this case used?)
-                (visible
-                 (follow-debug-message "visible in selected."))
-                ;; Far out!
-                ((eq dest (point-min))
-                 (follow-debug-message "min")
-                 (select-window (car windows))
-                 (goto-char dest)
-                 (set-window-start (selected-window) (point-min))
-                 (setq win-start-end (follow-windows-start-end windows))
-                 (follow-invalidate-cache)
-                 (setq visible t aligned nil))
-                ;; If we can position the cursor without moving the first
-                ;; window, do it. This is the case that catches `RET'
-                ;; at the bottom of a window.
-                ((follow-select-if-visible-from-first dest windows)
-                 (follow-debug-message "Below first")
-                 (setq visible t aligned t))
-                ;; None of the above. For simplicity, we stick to the
-                ;; selected window.
-                (t
-                 (follow-debug-message "None")
-                 (setq visible nil aligned nil))))
-             ;; If a new window has been selected, make sure that the
-             ;; old is not scrolled when the point is outside the
-             ;; window.
-             (unless (eq win (selected-window))
-               (let ((p (window-point win)))
-                 (set-window-start win (window-start win) nil)
-                 (set-window-point win p))))
-           (unless visible
-             ;; If point may not be visible in the selected window,
-             ;; perform a redisplay; this ensures scrolling.
-             (redisplay)
-             (setq selected-window-up-to-date t)
-             (follow-avoid-tail-recenter)
-             (setq win-start-end (follow-windows-start-end windows))
-             (follow-invalidate-cache)
-             (setq aligned nil))
-           ;; Now redraw the windows around the selected window.
-           (unless (and (not follow-internal-force-redisplay)
-                        (or aligned
-                            (follow-windows-aligned-p win-start-end))
-                        (follow-point-visible-all-windows-p
-                         win-start-end))
-             (setq follow-internal-force-redisplay nil)
-             (follow-redisplay windows (selected-window)
-                               selected-window-up-to-date)
-             (setq win-start-end (follow-windows-start-end windows))
-             (follow-invalidate-cache)
-             ;; When the point ends up in another window. This
-             ;; happens when dest is in the beginning of the file and
-             ;; the selected window is not the first.  It can also,
-             ;; in rare situations happen when long lines are used
-             ;; and there is a big difference between the width of
-             ;; the windows.  (When scrolling one line in a wide
-             ;; window which will cause a move larger that an entire
-             ;; small window.)
-             (unless (follow-pos-visible dest win win-start-end)
-               (follow-select-if-visible dest win-start-end)
-               (goto-char dest)))
-
-           ;; If the region is visible, make it look good when spanning
-           ;; multiple windows.
-           (when (region-active-p)
-             (follow-maximize-region
-              (selected-window) windows win-start-end))))
-       ;; Whether or not the buffer was in follow mode, we must
-       ;; update the windows displaying the tail so that Emacs won't
-       ;; recenter them.
-       (follow-avoid-tail-recenter)))))
-
-;;}}}
-;;{{{ The region
+         (setq follow-windows-start-end-cache nil)))
+      (follow-adjust-window win (point)))))
+
+(defun follow-adjust-window (win dest)
+  ;; Adjust the window WIN and its followers.
+  (with-current-buffer (window-buffer win)
+    (when (and follow-mode
+              (not (window-minibuffer-p win)))
+      (let* ((windows (follow-all-followers win))
+            (win-start-end (progn
+                             (follow-update-window-start (car windows))
+                             (follow-windows-start-end windows)))
+            (aligned (follow-windows-aligned-p win-start-end))
+            (visible (follow-pos-visible dest win win-start-end))
+            selected-window-up-to-date)
+       (unless (and aligned visible)
+         (setq follow-windows-start-end-cache nil))
+
+       ;; Select a window to display point.
+       (unless follow-internal-force-redisplay
+         (if (eq dest (point-max))
+             ;; Be careful at point-max: the display can be aligned
+             ;; while DEST can be visible in several windows.
+             (cond
+              ;; Select the current window, but only when the display
+              ;; is correct. (When inserting characters in a tail
+              ;; window, the display is not correct, as they are
+              ;; shown twice.)
+              ;;
+              ;; Never stick to the current window after a deletion.
+              ;; Otherwise, when typing `DEL' in a window showing
+              ;; only the end of the file, a character would be
+              ;; removed from the window above, which is very
+              ;; unintuitive.
+              ((and visible
+                    aligned
+                    (not (memq this-command
+                               '(backward-delete-char
+                                 delete-backward-char
+                                 backward-delete-char-untabify
+                                 kill-region))))
+               (follow-debug-message "Max: same"))
+              ;; If the end is visible, and the window doesn't
+              ;; seems like it just has been moved, select it.
+              ((follow-select-if-end-visible win-start-end)
+               (follow-debug-message "Max: end visible")
+               (setq visible t aligned nil)
+               (goto-char dest))
+              ;; Just show the end...
+              (t
+               (follow-debug-message "Max: default")
+               (select-window (car (last windows)))
+               (goto-char dest)
+               (setq visible nil aligned nil)))
+
+           ;; We're not at the end, here life is much simpler.
+           (cond
+            ;; This is the normal case!
+            ;; It should be optimized for speed.
+            ((and visible aligned)
+             (follow-debug-message "same"))
+            ;; Pick a position in any window.  If the display is ok,
+            ;; this picks the `correct' window.
+            ((follow-select-if-visible dest win-start-end)
+             (follow-debug-message "visible")
+             (goto-char dest)
+             ;; Perform redisplay, in case line is partially visible.
+             (setq visible nil))
+            ;; Not visible anywhere else, lets pick this one.
+            (visible
+             (follow-debug-message "visible in selected."))
+            ;; If DEST is before the first window start, select the
+            ;; first window.
+            ((< dest (nth 1 (car win-start-end)))
+             (follow-debug-message "before first")
+             (select-window (car windows))
+             (goto-char dest)
+             (setq visible nil aligned nil))
+            ;; If we can position the cursor without moving the first
+            ;; window, do it. This is the case that catches `RET' at
+            ;; the bottom of a window.
+            ((follow-select-if-visible-from-first dest windows)
+             (follow-debug-message "Below first")
+             (setq visible t aligned t))
+            ;; None of the above.  Stick to the selected window.
+            (t
+             (follow-debug-message "None")
+             (setq visible nil aligned nil))))
+
+         ;; If a new window was selected, make sure that the old is
+         ;; not scrolled when the point is outside the window.
+         (unless (eq win (selected-window))
+           (let ((p (window-point win)))
+             (set-window-start win (window-start win) nil)
+             (set-window-point win p))))
+
+       (unless visible
+         ;; If point may not be visible in the selected window,
+         ;; perform a redisplay; this ensures scrolling.
+         (let ((opoint (point)))
+           (redisplay)
+           ;; If this `redisplay' moved point, we got clobbered by a
+           ;; previous call to `set-window-start'.  Try again.
+           (when (/= (point) opoint)
+             (goto-char opoint)
+             (redisplay)))
+
+         (setq selected-window-up-to-date t)
+         (follow-avoid-tail-recenter)
+         (setq win-start-end (follow-windows-start-end windows)
+               follow-windows-start-end-cache nil
+               aligned nil))
+
+       ;; Now redraw the windows around the selected window.
+       (unless (and (not follow-internal-force-redisplay)
+                    (or aligned
+                        (follow-windows-aligned-p win-start-end))
+                    (follow-point-visible-all-windows-p win-start-end))
+         (setq follow-internal-force-redisplay nil)
+         (follow-redisplay windows (selected-window)
+                           selected-window-up-to-date)
+         (setq win-start-end (follow-windows-start-end windows)
+               follow-windows-start-end-cache nil)
+         ;; The point can ends up in another window when DEST is at
+         ;; the beginning of the buffer and the selected window is
+         ;; not the first.  It can also happen when long lines are
+         ;; used and there is a big difference between the width of
+         ;; the windows.  (When scrolling one line in a wide window
+         ;; which will cause a move larger that an entire small
+         ;; window.)
+         (unless (follow-pos-visible dest win win-start-end)
+           (follow-select-if-visible dest win-start-end)
+           (goto-char dest)))
+
+       ;; If the region is visible, make it look good when spanning
+       ;; multiple windows.
+       (when (region-active-p)
+         (follow-maximize-region
+          (selected-window) windows win-start-end)))
+
+      ;; Whether or not the buffer was in follow mode, update windows
+      ;; displaying the tail so that Emacs won't recenter them.
+      (follow-avoid-tail-recenter))))
+
+;;; The region
 
 ;; Tries to make the highlighted area representing the region look
 ;; good when spanning several windows.
@@ -1484,440 +1290,70 @@ non-first windows in Follow mode."
       (set-window-point (car succ) (nth 1 (assq (car succ) win-start-end)))
       (setq succ (cdr succ)))))
 
-;;}}}
-;;{{{ Scroll bar
+;;; Scroll bar
 
 ;;;; Scroll-bar support code.
 
-;; Why is it needed? Well, if the selected window is in follow mode,
-;; all its followers stick to it blindly. If one of them is scrolled,
-;; it immediately returns to the original position when the mouse is
-;; released. If the selected window is not a follower of the dragged
-;; window the windows will be unaligned.
-
-;; The advices don't get compiled. Aesthetically, this might be a
-;; problem but in practical life it isn't.
-
-;; Discussion: Now when the other windows in the chain follow the
-;; dragged, should we really select it?
-
-(cond ((fboundp 'scroll-bar-drag)
-       ;;;
-       ;;; Emacs style scrollbars.
-       ;;;
-
-       ;; Select the dragged window if it is a follower of the
-       ;; selected window.
-       ;;
-       ;; Generate advices of the form:
-       ;; (defadvice scroll-bar-drag (after follow-scroll-bar-drag activate)
-       ;;   "Adviced by `follow-mode'."
-       ;;   (follow-redraw-after-event (ad-get-arg 0)))
-       (let ((cmds '(scroll-bar-drag
-                    scroll-bar-drag-1  ; Executed at every move.
-                    scroll-bar-scroll-down
-                    scroll-bar-scroll-up
-                    scroll-bar-set-window-start)))
-        (while cmds
-          (eval
-           `(defadvice ,(intern (symbol-name (car cmds)))
-                (after
-                 ,(intern (concat "follow-" (symbol-name (car cmds))))
-                 activate)
-                "Adviced by Follow mode."
-                (follow-redraw-after-event (ad-get-arg 0))))
-          (setq cmds (cdr cmds))))
-
-
-       (defun follow-redraw-after-event (event)
-        "Adviced by Follow mode."
-        (condition-case nil
-            (let* ((orig-win (selected-window))
-                   (win (nth 0 (funcall
-                                (symbol-function 'event-start) event)))
-                   (fmode (assq 'follow-mode
-                                (buffer-local-variables
-                                 (window-buffer win)))))
-              (if (and fmode (cdr fmode))
-                  ;; The selected window is in follow-mode
-                  (progn
-                    ;; Recenter around the dragged window.
-                    (select-window win)
-                    (follow-redisplay)
-                    (select-window orig-win))))
-          (error nil))))
-
-
-      ((fboundp 'scrollbar-vertical-drag)
-       ;;;
-       ;;; XEmacs style scrollbars.
-       ;;;
-
-       ;; Advice all scrollbar functions on the form:
-       ;;
-       ;; (defadvice scrollbar-line-down
-       ;;      (after follow-scrollbar-line-down activate)
-       ;;   (follow-xemacs-scrollbar-support (ad-get-arg 0)))
-
-      (let ((cmds '(scrollbar-line-down        ; Window
-                   scrollbar-line-up
-                   scrollbar-page-down ; Object
-                   scrollbar-page-up
-                   scrollbar-to-bottom ; Window
-                   scrollbar-to-top
-                   scrollbar-vertical-drag ; Object
-                   )))
-
-       (while cmds
-         (eval
-          `(defadvice ,(intern (symbol-name (car cmds)))
-               (after
-                ,(intern (concat "follow-" (symbol-name (car cmds))))
-                activate)
-               "Adviced by `follow-mode'."
-               (follow-xemacs-scrollbar-support (ad-get-arg 0))))
-         (setq cmds (cdr cmds))))
-
-
-      (defun follow-xemacs-scrollbar-support (window)
-       "Redraw windows showing the same buffer as shown in WINDOW.
-WINDOW is either the dragged window, or a cons containing the
-window as its first element.  This is called while the user drags
-the scrollbar.
-
-WINDOW can be an object or a window."
-       (condition-case nil
-           (progn
-             (if (consp window)
-                 (setq window (car window)))
-             (let ((fmode (assq 'follow-mode
-                                (buffer-local-variables
-                                 (window-buffer window))))
-                   (orig-win (selected-window)))
-               (if (and fmode (cdr fmode))
-                   (progn
-                     ;; Recenter around the dragged window.
-                     (select-window window)
-                     (follow-redisplay)
-                     (select-window orig-win)))))
-         (error nil)))))
-
-;;}}}
-;;{{{ Process output
-
-;; The following sections installs a spy that listens to process
-;; output and tries to reposition the windows whose buffers are in
-;; Follow mode.  We play safe as much as possible...
-;;
-;; When follow-mode is activated all active processes are
-;; intercepted.  All new processes that change their filter function
-;; using `set-process-filter' are also intercepted.  The reason is
-;; that a process can cause a redisplay recentering "tail" windows.
-;; Note that it doesn't hurt to spy on more processes than needed.
-;;
-;; Technically, we set the process filter to `follow-generic-filter'.
-;; The original filter is stored in `follow-process-filter-alist'.
-;; Our generic filter calls the original filter, or inserts the
-;; output into the buffer, if the buffer originally didn't have an
-;; output filter.  It also makes sure that the windows connected to
-;; the buffer are aligned.
-;;
-;; Discussion: How do we find processes that don't call
-;; `set-process-filter'?  (How often are processes created in a
-;; buffer after Follow mode are activated?)
-;;
-;; Discussion: Should we also advice `process-filter' to make our
-;; filter invisible to others?
-
-;;{{{ Advice for `set-process-filter'
-
-;; Do not call this with 'follow-generic-filter as the name of the
-;; filter...
-
-(defadvice set-process-filter (before follow-set-process-filter activate)
-  "Ensure process output will be displayed correctly in Follow mode buffers.
-
-Follow mode inserts its own process filter to do its
-magic stuff before the real process filter is called."
-  (if follow-intercept-processes
-      (progn
-       (setq follow-process-filter-alist
-             (delq (assq (ad-get-arg 0) follow-process-filter-alist)
-                   follow-process-filter-alist))
-       (follow-tidy-process-filter-alist)
-       (cond ((eq (ad-get-arg 1) t))
-             ((eq (ad-get-arg 1) nil)
-              (ad-set-arg 1 'follow-generic-filter))
-             (t
-              (setq follow-process-filter-alist
-                    (cons (cons (ad-get-arg 0) (ad-get-arg 1))
-                          follow-process-filter-alist))
-              (ad-set-arg 1 'follow-generic-filter))))))
-
-
-(defun follow-call-set-process-filter (proc filter)
-  "Call original `set-process-filter' without the Follow mode advice."
-  (ad-disable-advice 'set-process-filter 'before
-                    'follow-set-process-filter)
-  (ad-activate 'set-process-filter)
-  (prog1
-      (set-process-filter proc filter)
-    (ad-enable-advice 'set-process-filter 'before
-                     'follow-set-process-filter)
-    (ad-activate 'set-process-filter)))
-
-
-(defadvice process-filter (after follow-process-filter activate)
-  "Return the original process filter, not `follow-generic-filter'."
-  (cond ((eq ad-return-value 'follow-generic-filter)
-        (setq ad-return-value
-              (cdr-safe (assq (ad-get-arg 0)
-                              follow-process-filter-alist))))))
-
-
-(defun follow-call-process-filter (proc)
-  "Call original `process-filter' without the Follow mode advice."
-  (ad-disable-advice 'process-filter 'after
-                    'follow-process-filter)
-  (ad-activate 'process-filter)
-  (prog1
-      (process-filter proc)
-    (ad-enable-advice 'process-filter 'after
-                     'follow-process-filter)
-    (ad-activate 'process-filter)))
-
-
-(defun follow-tidy-process-filter-alist ()
-  "Remove old processes from `follow-process-filter-alist'."
-  (let ((alist follow-process-filter-alist)
-       (ps (process-list))
-       (new ()))
-    (while alist
-      (if (and (not (memq (process-status (car (car alist)))
-                         '(exit signal closed nil)))
-              (memq (car (car alist)) ps))
-         (setq new (cons (car alist) new)))
-      (setq alist (cdr alist)))
-    (setq follow-process-filter-alist new)))
-
-;;}}}
-;;{{{ Start/stop interception of processes.
-
-;; Normally, all new processes are intercepted by our `set-process-filter'.
-;; This is needed to intercept old processes that were started before we were
-;; loaded, and processes we have forgotten by calling
-;; `follow-stop-intercept-process-output'.
-
-(defun follow-intercept-process-output ()
-  "Intercept all active processes.
-
-This is needed so that Follow mode can track all display events in the
-system.  (See `follow-mode'.)"
-  (interactive)
-  (let ((list (process-list)))
-    (while list
-      (if (eq (process-filter (car list)) 'follow-generic-filter)
-         nil
-       ;; The custom `set-process-filter' defined above.
-       (set-process-filter (car list) (process-filter (car list))))
-      (setq list (cdr list))))
-  (setq follow-intercept-processes t))
-
-
-(defun follow-stop-intercept-process-output ()
-  "Stop Follow mode from spying on processes.
-
-All current spypoints are removed and no new will be added.
-
-The effect is that Follow mode won't be able to handle buffers
-connected to processes.
-
-The only reason to call this function is if the Follow mode spy filter
-would interfere with some other package.  If this happens, please
-report this using the `report-emacs-bug' function."
-  (interactive)
-  (follow-tidy-process-filter-alist)
-  (dolist (process (process-list))
-    (when (eq (follow-call-process-filter process) 'follow-generic-filter)
-      (follow-call-set-process-filter
-       process
-       (cdr-safe (assq process follow-process-filter-alist)))
-      (setq follow-process-filter-alist
-           (delq (assq process follow-process-filter-alist)
-                 follow-process-filter-alist))))
-  (setq follow-intercept-processes nil))
-
-;;}}}
-;;{{{ The filter
-
-;; The following section is a naive method to make buffers with
-;; process output to work with Follow mode. Whenever the start of the
-;; window displaying the buffer is moved, we move it back to its
-;; original position and try to select a new window.  (If we fail,
-;; the normal redisplay functions of Emacs will scroll it right
-;; back!)
-
-(defun follow-generic-filter (proc output)
-  "Process output filter for process connected to buffers in Follow mode."
-  (let* ((old-buffer (current-buffer))
-        (orig-win (selected-window))
-        (buf (process-buffer proc))
-        (win (and buf (if (eq buf (window-buffer orig-win))
-                          orig-win
-                        (get-buffer-window buf t))))
-        (return-to-orig-win (and win (not (eq win orig-win))))
-        (orig-window-start (and win (window-start win))))
-
-    ;; If input is pending, the `sit-for' below won't redraw the
-    ;; display. In that case, calling `follow-avoid-tail-recenter' may
-    ;; provoke the process handling code to schedule a redisplay.
-    ;(or (input-pending-p)
-    ; (follow-avoid-tail-recenter))
-
-    ;; Output the `output'.
-    (let ((filter (cdr-safe (assq proc follow-process-filter-alist))))
-      (cond
-       ;; Call the original filter function
-       (filter
-       (funcall filter proc output))
-
-       ;; No filter, but we've got a buffer. Just output into it.
-       (buf
-       (set-buffer buf)
-       (if (not (marker-buffer (process-mark proc)))
-           (set-marker (process-mark proc) (point-max)))
-       (let ((moving (= (point) (process-mark proc)))
-             deactivate-mark
-             (inhibit-read-only t))
-         (save-excursion
-           (goto-char (process-mark proc))
-           ;; `insert-before-markers' just in case the user's next
-           ;; command is M-y.
-           (insert-before-markers output)
-           (set-marker (process-mark proc) (point)))
-         (if moving (goto-char (process-mark proc)))))))
-
-    ;; If we're in follow mode, do our stuff.  Select a new window and
-    ;; redisplay.  (Actually, it is redundant to check `buf', but I
-    ;; feel it's more correct.)
-    (if (and buf (window-live-p win))
-       (progn
-         (set-buffer buf)
-         (if (and (boundp 'follow-mode) follow-mode)
-             (progn
-               (select-window win)
-               (let* ((windows (follow-all-followers win))
-                      (win-start-end (follow-windows-start-end windows))
-                      (new-window-start (window-start win))
-                      (new-window-point (window-point win)))
-                 (cond
-                  ;; The start of the selected window was repositioned.
-                  ;; Try to use the original start position and continue
-                  ;; working with a window to the "right" in the window
-                  ;; chain.  This will create the effect that the output
-                  ;; starts in one window and continues into the next.
-
-                  ;; If the display has changed so much that it is not
-                  ;; possible to keep the original window fixed and still
-                  ;; display the point then we give up and use the new
-                  ;; window start.
-
-                  ;; This case is typically used when the process filter
-                  ;; tries to reposition the start of the window in order
-                  ;; to view the tail of the output.
-                  ((not (eq orig-window-start new-window-start))
-                   (follow-debug-message "filter: Moved")
-                   (set-window-start win orig-window-start)
-                   (follow-redisplay windows win)
-                   (setq win-start-end (follow-windows-start-end windows))
-                   (follow-select-if-visible new-window-point
-                                             win-start-end)
-                   (goto-char new-window-point)
-                   (if (eq win (selected-window))
-                       (set-window-start win new-window-start))
-                   (setq win-start-end (follow-windows-start-end windows)))
-                  ;; Stick to this window, if point is visible in it.
-                  ((pos-visible-in-window-p new-window-point)
-                   (follow-debug-message "filter: Visible in window"))
-                  ;; Avoid redisplaying the first window. If the
-                  ;; point is visible at a window below,
-                  ;; redisplay and select it.
-                  ((follow-select-if-visible-from-first
-                    new-window-point windows)
-                   (follow-debug-message "filter: Seen from first")
-                   (setq win-start-end
-                         (follow-windows-start-end windows)))
-                  ;; None of the above. We stick to the current window.
-                  (t
-                   (follow-debug-message "filter: nothing")))
-
-                 ;; Here we have selected a window. Make sure the
-                 ;; windows are aligned and the point is visible
-                 ;; in the selected window.
-                 (if (and (not (follow-pos-visible
-                                (point) (selected-window) win-start-end))
-                          (not return-to-orig-win))
-                     (progn
-                       (sit-for 0)
-                       (setq win-start-end
-                             (follow-windows-start-end windows))))
-
-                 (if (or follow-internal-force-redisplay
-                         (not (follow-windows-aligned-p win-start-end)))
-                     (follow-redisplay windows)))))))
-
-    ;; return to the original window.
-    (if return-to-orig-win
-       (select-window orig-win))
-    ;; Restore the original buffer, unless the filter explicitly
-    ;; changed buffer or killed the old buffer.
-    (if (and (eq buf (current-buffer))
-            (buffer-name old-buffer))
-       (set-buffer old-buffer)))
-
-  (follow-invalidate-cache)
-
-  ;; Normally, if the display has been changed, it is redrawn.  All
-  ;; windows showing only the end of a buffer are unconditionally
-  ;; recentered; we can't prevent that by calling
-  ;; `follow-avoid-tail-recenter'.
-  ;;
-  ;; We force a redisplay here on our own, so Emacs does need to.
-  ;; (However, redisplaying when there's input available just seems
-  ;; to make things worse, so we exclude that case.)
-  (if (and follow-avoid-tail-recenter-p
-          (not (input-pending-p)))
-      (sit-for 0)))
-
-;;}}}
-
-;;}}}
-;;{{{ Window size change
-
-;; In Emacs 19.29, the functions in `window-size-change-functions' are
-;; called every time a window in a frame changes size. Most notably, it
-;; is called after the frame has been resized.
-;;
-;; We basically call our post-command-hook for every buffer that is
-;; visible in any window in the resized frame, which is in follow-mode.
-;;
-;; Since this function can be called indirectly from
-;; `follow-post-command-hook' we have a potential infinite loop.  We
-;; handle this problem by simply not doing anything at all in this
-;; situation.  The variable `follow-inside-post-command-hook' contains
-;; information about whether the execution actually is inside the
+;; This handles the case where the user drags the scroll bar of a
+;; non-selected window whose buffer is in Follow mode.
+
+(defun follow-scroll-bar-toolkit-scroll (event)
+  (interactive "e")
+  (scroll-bar-toolkit-scroll event)
+  (follow-redraw-after-event event))
+
+(defun follow-scroll-bar-drag (event)
+  (interactive "e")
+  (scroll-bar-drag event)
+  (follow-redraw-after-event event))
+
+(defun follow-scroll-bar-scroll-up (event)
+  (interactive "e")
+  (scroll-bar-scroll-up event)
+  (follow-redraw-after-event event))
+
+(defun follow-scroll-bar-scroll-down (event)
+  (interactive "e")
+  (scroll-bar-scroll-down event)
+  (follow-redraw-after-event event))
+
+(defun follow-mwheel-scroll (event)
+  (interactive "e")
+  (mwheel-scroll event)
+  (follow-redraw-after-event event))
+
+(defun follow-redraw-after-event (event)
+  "Re-align the Follow mode windows affected by EVENT."
+  (let* ((window (nth 0 (event-end event)))
+        (buffer (window-buffer window))
+        (orig-win (selected-window)))
+    (when (and (buffer-local-value 'follow-mode buffer)
+              ;; Ignore the case where we scroll the selected window;
+              ;; that is handled by the post-command hook function.
+              (not (eq window (selected-window))))
+      (select-window window)
+      (follow-redisplay)
+      (unless (eq (window-buffer orig-win) buffer)
+       (select-window orig-win)))))
+
+;;; Window size change
+
+;; The functions in `window-size-change-functions' are called every
+;; time a window in a frame changes size, most notably after the frame
+;; has been resized.  We call `follow-post-command-hook' for every
+;; Follow mode buffer visible in any window in the resized frame.
+;;
+;; Since `follow-window-size-change' can be called indirectly from
+;; `follow-post-command-hook' we have a potential infinite loop.  To
+;; avoid this, we simply do not do anything in this situation.  The
+;; variable `follow-inside-post-command-hook' contains information
+;; about whether the execution actually is inside the
 ;; post-command-hook or not.
 
-(if (boundp 'window-size-change-functions)
-    (add-hook 'window-size-change-functions 'follow-window-size-change))
-
-
 (defun follow-window-size-change (frame)
   "Redraw all windows in FRAME, when in Follow mode."
-  ;; Below, we call `post-command-hook'.  This makes sure that we
-  ;; don't start a mutually recursive endless loop.
-  (if follow-inside-post-command-hook
-      nil
+  ;; Below, we call `post-command-hook'.  Avoid an infloop.
+  (unless follow-inside-post-command-hook
     (let ((buffers '())
          (orig-window (selected-window))
          (orig-buffer (current-buffer))
@@ -1927,193 +1363,59 @@ report this using the `report-emacs-bug' function."
       (select-frame frame)
       (unwind-protect
          (walk-windows
-          (function
-           (lambda (win)
-             (setq buf (window-buffer win))
-             (if (memq buf buffers)
-                 nil
-               (set-buffer buf)
-               (if (and (boundp 'follow-mode)
-                        follow-mode)
-                   (progn
-                     (setq windows (follow-all-followers win))
-                     (if (memq orig-window windows)
-                         (progn
-                            ;; Make sure we're redrawing around the
-                            ;; selected window.
-                            ;;
-                            ;; We must be really careful not to do this
-                            ;; when we are (indirectly) called by
-                            ;; `post-command-hook'.
-                           (select-window orig-window)
-                           (follow-post-command-hook)
-                           (setq orig-window (selected-window)))
-                       (follow-redisplay windows win))
-                     (setq buffers (cons buf buffers))))))))
+          (lambda (win)
+            (setq buf (window-buffer win))
+            (unless (memq buf buffers)
+              (set-buffer buf)
+              (when follow-mode
+                (setq windows (follow-all-followers win))
+                (if (not (memq orig-window windows))
+                    (follow-redisplay windows win)
+                  ;; Make sure we're redrawing around the selected
+                  ;; window.
+                  (select-window orig-window)
+                  (follow-post-command-hook)
+                  (setq orig-window (selected-window)))
+                (setq buffers (cons buf buffers)))))
+          'no-minibuf)
        (select-frame orig-frame)
        (set-buffer orig-buffer)
        (select-window orig-window)))))
 
-;;}}}
-
-;;{{{ XEmacs isearch
-
-;; In XEmacs, isearch often finds matches in other windows than the
-;; currently selected.  However, when exiting the old window
-;; configuration is restored, with the exception of the beginning of
-;; the start of the window for the selected window.  This is not much
-;; help for us.
-;;
-;; We overwrite the stored window configuration with the current,
-;; unless we are in `slow-search-mode', i.e. only a few lines
-;; of text is visible.
-
-(if (featurep 'xemacs)
-    (defadvice isearch-done (before follow-isearch-done activate)
-      (if (and (boundp 'follow-mode)
-              follow-mode
-              (boundp 'isearch-window-configuration)
-              isearch-window-configuration
-              (boundp 'isearch-slow-terminal-mode)
-              (not isearch-slow-terminal-mode))
-         (let ((buf (current-buffer)))
-           (setq isearch-window-configuration
-                 (current-window-configuration))
-           (set-buffer buf)))))
-
-;;}}}
-;;{{{ Tail window handling
-
-;; In Emacs (not XEmacs) windows showing nothing are sometimes
-;; recentered.  When in Follow mode, this is not desirable for
-;; non-first windows in the window chain.  This section tries to
-;; make the windows stay where they should be.
-;;
-;; If the display is updated, all windows starting at (point-max) are
-;; going to be recentered at the next redisplay, unless we do a
-;; read-and-write cycle to update the `force' flag inside the windows.
-;;
-;; In 19.30, a new variable `window-scroll-functions' is called every
-;; time a window is recentered.  It is not perfect for our situation,
-;; since when it is called for a tail window, it is to late.  However,
-;; if it is called for another window, we can try to update our
-;; windows.
-;;
-;; By patching `sit-for' we can make sure that to catch all explicit
-;; updates initiated by lisp programs.  Internal calls, on the other
-;; hand, are not handled.
-;;
-;; Please note that the function `follow-avoid-tail-recenter' is also
-;; called from other places, e.g. `post-command-hook' and
-;; `post-command-idle-hook'.
-
-;; If this function is called it is too late for this window, but
-;; we might save other windows from being recentered.
-
-(if (and follow-avoid-tail-recenter-p (boundp 'window-scroll-functions))
-    (add-hook 'window-scroll-functions 'follow-avoid-tail-recenter t))
-
-
-;;  This prevents all packages that calls `sit-for' directly
-;;  to recenter tail windows.
-
-(if follow-avoid-tail-recenter-p
-    (defadvice sit-for (before follow-sit-for activate)
-      "Adviced by Follow mode.
+(add-hook 'window-scroll-functions 'follow-avoid-tail-recenter t)
 
-Avoid to recenter windows displaying only the end of a file as when
-displaying a short file in two windows, using Follow mode."
-      (follow-avoid-tail-recenter)))
-
-
-;;  Without this advice, `mouse-drag-region' would start to recenter
-;;  tail windows.
-
-(if (and follow-avoid-tail-recenter-p
-        (fboundp 'move-overlay))
-    (defadvice move-overlay (before follow-move-overlay activate)
-      "Adviced by Follow mode.
-Don't recenter windows showing only the end of a buffer.
-This prevents `mouse-drag-region' from messing things up."
-      (follow-avoid-tail-recenter)))
-
-;;}}}
-;;{{{ profile support
+;;; Profile support
 
 ;; The following (non-evaluated) section can be used to
 ;; profile this package using `elp'.
 ;;
 ;; Invalid indentation on purpose!
 
-(cond (nil
-(setq elp-function-list
-      '(window-end
-       vertical-motion
-       ; sit-for  ;; elp can't handle advices...
-       follow-mode
-       follow-all-followers
-       follow-split-followers
-       follow-redisplay
-       follow-estimate-first-window-start
-       follow-calculate-first-window-start-from-above
-       follow-calculate-first-window-start-from-below
-       follow-calc-win-end
-       follow-calc-win-start
-       follow-pos-visible
-       follow-windows-start-end
-       follow-cache-valid-p
-       follow-select-if-visible
-       follow-select-if-visible-from-first
-       follow-windows-aligned-p
-       follow-point-visible-all-windows-p
-       follow-avoid-tail-recenter
-       follow-update-window-start
-       follow-post-command-hook
-       ))))
-
-;;}}}
-
-;;{{{ The end
-
-(defun follow-unload-function ()
-  "Unload Follow mode library."
-  (easy-menu-remove-item nil '("Tools") "Follow")
-  (follow-stop-intercept-process-output)
-  (dolist (group '((before
-                   ;; XEmacs
-                   isearch-done
-                   ;; both
-                   set-process-filter sit-for move-overlay)
-                  (after
-                   ;; Emacs
-                   scroll-bar-drag scroll-bar-drag-1 scroll-bar-scroll-down
-                   scroll-bar-scroll-up scroll-bar-set-window-start
-                   ;; XEmacs
-                   scrollbar-line-down scrollbar-line-up scrollbar-page-down
-                   scrollbar-page-up scrollbar-to-bottom scrollbar-to-top
-                   scrollbar-vertical-drag
-                   ;; both
-                   process-filter)))
-    (let ((class (car group)))
-      (dolist (fun (cdr group))
-       (when (functionp fun)
-         (condition-case nil
-             (progn
-               (ad-remove-advice fun class
-                                 (intern (concat "follow-" (symbol-name fun))))
-               (ad-update fun))
-           (error nil))))))
-  ;; continue standard processing
-  nil)
-
-;;
-;; We're done!
-;;
+;; (setq elp-function-list
+;;       '(window-end
+;;     vertical-motion
+;;     follow-mode
+;;     follow-all-followers
+;;     follow-split-followers
+;;     follow-redisplay
+;;     follow-estimate-first-window-start
+;;     follow-calculate-first-window-start-from-above
+;;     follow-calculate-first-window-start-from-below
+;;     follow-calc-win-end
+;;     follow-calc-win-start
+;;     follow-pos-visible
+;;     follow-windows-start-end
+;;     follow-cache-valid-p
+;;     follow-select-if-visible
+;;     follow-select-if-visible-from-first
+;;     follow-windows-aligned-p
+;;     follow-point-visible-all-windows-p
+;;     follow-avoid-tail-recenter
+;;     follow-update-window-start
+;;     follow-post-command-hook))
 
 (provide 'follow)
 
-;;}}}
-
 ;; /------------------------------------------------------------------------\
 ;; | "I [..] am rarely happier then when spending an entire day programming |
 ;; | my computer to perform automatically a task that it would otherwise    |
index b65828ca1d7673de2a59536e2a9f2cf15b205dc0..f3e313e9c3505739cd21a81727e950216d4e37b5 100644 (file)
 ;;; Code:
 
 (require 'syntax)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; Define core `font-lock' group.
 (defgroup font-lock '((jit-lock custom-group))
@@ -492,11 +492,11 @@ This is normally set via `font-lock-add-keywords' and
 `font-lock-remove-keywords'.")
 
 (defvar font-lock-keywords-only nil
-  "*Non-nil means Font Lock should not fontify comments or strings.
+  "Non-nil means Font Lock should not fontify comments or strings.
 This is normally set via `font-lock-defaults'.")
 
 (defvar font-lock-keywords-case-fold-search nil
-  "*Non-nil means the patterns in `font-lock-keywords' are case-insensitive.
+  "Non-nil means the patterns in `font-lock-keywords' are case-insensitive.
 This is set via the function `font-lock-set-defaults', based on
 the CASE-FOLD argument of `font-lock-defaults'.")
 (make-variable-buffer-local 'font-lock-keywords-case-fold-search)
@@ -556,7 +556,7 @@ If this is nil, the major mode's syntax table is used.
 This is normally set via `font-lock-defaults'.")
 
 (defvar font-lock-beginning-of-syntax-function nil
-  "*Non-nil means use this function to move back outside all constructs.
+  "Non-nil means use this function to move back outside all constructs.
 When called with no args it should move point backward to a place which
 is not in a string or comment and not within any bracket-pairs (or else,
 a place such that any bracket-pairs outside it can be ignored for Emacs
@@ -571,7 +571,7 @@ This is normally set via `font-lock-defaults'.")
                         'syntax-begin-function "23.3" 'set)
 
 (defvar font-lock-mark-block-function nil
-  "*Non-nil means use this function to mark a block of text.
+  "Non-nil means use this function to mark a block of text.
 When called with no args it should leave point at the beginning of any
 enclosing textual block and mark at the end.
 This is normally set via `font-lock-defaults'.")
@@ -613,9 +613,6 @@ Major/minor modes can set this variable if they know which option applies.")
 ;; Font Lock mode.
 
 (eval-when-compile
-  ;;
-  ;; We don't do this at the top-level as we only use non-autoloaded macros.
-  (require 'cl)
   ;;
   ;; Borrowed from lazy-lock.el.
   ;; We use this to preserve or protect things when modifying text properties.
@@ -917,10 +914,10 @@ The value of this variable is used when Font Lock mode is turned on."
 (declare-function lazy-lock-mode "lazy-lock")
 
 (defun font-lock-turn-on-thing-lock ()
-  (case (font-lock-value-in-major-mode font-lock-support-mode)
-    (fast-lock-mode (fast-lock-mode t))
-    (lazy-lock-mode (lazy-lock-mode t))
-    (jit-lock-mode
+  (pcase (font-lock-value-in-major-mode font-lock-support-mode)
+    (`fast-lock-mode (fast-lock-mode t))
+    (`lazy-lock-mode (lazy-lock-mode t))
+    (`jit-lock-mode
      ;; Prepare for jit-lock
      (remove-hook 'after-change-functions
                   'font-lock-after-change-function t)
@@ -1654,7 +1651,7 @@ LOUDLY, if non-nil, allows progress-meter bar."
     ;; Fontify each item in `font-lock-keywords' from `start' to `end'.
     (while keywords
       (if loudly (message "Fontifying %s... (regexps..%s)" bufname
-                         (make-string (incf count) ?.)))
+                         (make-string (cl-incf count) ?.)))
       ;;
       ;; Find an occurrence of `matcher' from `start' to `end'.
       (setq keyword (car keywords) matcher (car keyword))
@@ -1877,22 +1874,22 @@ Sets various variables using `font-lock-defaults' and
 ;; `custom-declare-face'.
 (defface font-lock-comment-face
   '((((class grayscale) (background light))
-     (:foreground "DimGray" :weight bold :slant italic))
+     :foreground "DimGray" :weight bold :slant italic)
     (((class grayscale) (background dark))
-     (:foreground "LightGray" :weight bold :slant italic))
+     :foreground "LightGray" :weight bold :slant italic)
     (((class color) (min-colors 88) (background light))
-     (:foreground "Firebrick"))
+     :foreground "Firebrick")
     (((class color) (min-colors 88) (background dark))
-     (:foreground "chocolate1"))
+     :foreground "chocolate1")
     (((class color) (min-colors 16) (background light))
-     (:foreground "red"))
+     :foreground "red")
     (((class color) (min-colors 16) (background dark))
-     (:foreground "red1"))
+     :foreground "red1")
     (((class color) (min-colors 8) (background light))
-     (:foreground "red"))
+     :foreground "red")
     (((class color) (min-colors 8) (background dark))
-     (:foreground "yellow"))
-    (t (:weight bold :slant italic)))
+     :foreground "yellow")
+    (t :weight bold :slant italic))
   "Font Lock mode face used to highlight comments."
   :group 'font-lock-faces)
 
@@ -1902,14 +1899,14 @@ Sets various variables using `font-lock-defaults' and
   :group 'font-lock-faces)
 
 (defface font-lock-string-face
-  '((((class grayscale) (background light)) (:foreground "DimGray" :slant italic))
-    (((class grayscale) (background dark)) (:foreground "LightGray" :slant italic))
-    (((class color) (min-colors 88) (background light)) (:foreground "VioletRed4"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "LightSalmon"))
-    (((class color) (min-colors 16) (background light)) (:foreground "RosyBrown"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "LightSalmon"))
-    (((class color) (min-colors 8)) (:foreground "green"))
-    (t (:slant italic)))
+  '((((class grayscale) (background light)) :foreground "DimGray" :slant italic)
+    (((class grayscale) (background dark))  :foreground "LightGray" :slant italic)
+    (((class color) (min-colors 88) (background light)) :foreground "VioletRed4")
+    (((class color) (min-colors 88) (background dark))  :foreground "LightSalmon")
+    (((class color) (min-colors 16) (background light)) :foreground "RosyBrown")
+    (((class color) (min-colors 16) (background dark))  :foreground "LightSalmon")
+    (((class color) (min-colors 8)) :foreground "green")
+    (t :slant italic))
   "Font Lock mode face used to highlight strings."
   :group 'font-lock-faces)
 
@@ -1919,76 +1916,76 @@ Sets various variables using `font-lock-defaults' and
   :group 'font-lock-faces)
 
 (defface font-lock-keyword-face
-  '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
-    (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
-    (((class color) (min-colors 88) (background light)) (:foreground "Purple"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
-    (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
-    (((class color) (min-colors 8)) (:foreground "cyan" :weight bold))
-    (t (:weight bold)))
+  '((((class grayscale) (background light)) :foreground "LightGray" :weight bold)
+    (((class grayscale) (background dark))  :foreground "DimGray" :weight bold)
+    (((class color) (min-colors 88) (background light)) :foreground "Purple")
+    (((class color) (min-colors 88) (background dark))  :foreground "Cyan1")
+    (((class color) (min-colors 16) (background light)) :foreground "Purple")
+    (((class color) (min-colors 16) (background dark))  :foreground "Cyan")
+    (((class color) (min-colors 8)) :foreground "cyan" :weight bold)
+    (t :weight bold))
   "Font Lock mode face used to highlight keywords."
   :group 'font-lock-faces)
 
 (defface font-lock-builtin-face
-  '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
-    (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
-    (((class color) (min-colors 88) (background light)) (:foreground "dark slate blue"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "LightSteelBlue"))
-    (((class color) (min-colors 16) (background light)) (:foreground "Orchid"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "LightSteelBlue"))
-    (((class color) (min-colors 8)) (:foreground "blue" :weight bold))
-    (t (:weight bold)))
+  '((((class grayscale) (background light)) :foreground "LightGray" :weight bold)
+    (((class grayscale) (background dark))  :foreground "DimGray" :weight bold)
+    (((class color) (min-colors 88) (background light)) :foreground "dark slate blue")
+    (((class color) (min-colors 88) (background dark))  :foreground "LightSteelBlue")
+    (((class color) (min-colors 16) (background light)) :foreground "Orchid")
+    (((class color) (min-colors 16) (background dark)) :foreground "LightSteelBlue")
+    (((class color) (min-colors 8)) :foreground "blue" :weight bold)
+    (t :weight bold))
   "Font Lock mode face used to highlight builtins."
   :group 'font-lock-faces)
 
 (defface font-lock-function-name-face
-  '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
-    (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
-    (((class color) (min-colors 8)) (:foreground "blue" :weight bold))
-    (t (:inverse-video t :weight bold)))
+  '((((class color) (min-colors 88) (background light)) :foreground "Blue1")
+    (((class color) (min-colors 88) (background dark))  :foreground "LightSkyBlue")
+    (((class color) (min-colors 16) (background light)) :foreground "Blue")
+    (((class color) (min-colors 16) (background dark))  :foreground "LightSkyBlue")
+    (((class color) (min-colors 8)) :foreground "blue" :weight bold)
+    (t :inverse-video t :weight bold))
   "Font Lock mode face used to highlight function names."
   :group 'font-lock-faces)
 
 (defface font-lock-variable-name-face
   '((((class grayscale) (background light))
-     (:foreground "Gray90" :weight bold :slant italic))
+     :foreground "Gray90" :weight bold :slant italic)
     (((class grayscale) (background dark))
-     (:foreground "DimGray" :weight bold :slant italic))
-    (((class color) (min-colors 88) (background light)) (:foreground "sienna"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "LightGoldenrod"))
-    (((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
-    (((class color) (min-colors 8)) (:foreground "yellow" :weight light))
-    (t (:weight bold :slant italic)))
+     :foreground "DimGray" :weight bold :slant italic)
+    (((class color) (min-colors 88) (background light)) :foreground "sienna")
+    (((class color) (min-colors 88) (background dark))  :foreground "LightGoldenrod")
+    (((class color) (min-colors 16) (background light)) :foreground "DarkGoldenrod")
+    (((class color) (min-colors 16) (background dark))  :foreground "LightGoldenrod")
+    (((class color) (min-colors 8)) :foreground "yellow" :weight light)
+    (t :weight bold :slant italic))
   "Font Lock mode face used to highlight variable names."
   :group 'font-lock-faces)
 
 (defface font-lock-type-face
-  '((((class grayscale) (background light)) (:foreground "Gray90" :weight bold))
-    (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
-    (((class color) (min-colors 88) (background light)) (:foreground "ForestGreen"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "PaleGreen"))
-    (((class color) (min-colors 16) (background light)) (:foreground "ForestGreen"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "PaleGreen"))
-    (((class color) (min-colors 8)) (:foreground "green"))
-    (t (:weight bold :underline t)))
+  '((((class grayscale) (background light)) :foreground "Gray90" :weight bold)
+    (((class grayscale) (background dark))  :foreground "DimGray" :weight bold)
+    (((class color) (min-colors 88) (background light)) :foreground "ForestGreen")
+    (((class color) (min-colors 88) (background dark))  :foreground "PaleGreen")
+    (((class color) (min-colors 16) (background light)) :foreground "ForestGreen")
+    (((class color) (min-colors 16) (background dark))  :foreground "PaleGreen")
+    (((class color) (min-colors 8)) :foreground "green")
+    (t :weight bold :underline t))
   "Font Lock mode face used to highlight type and classes."
   :group 'font-lock-faces)
 
 (defface font-lock-constant-face
   '((((class grayscale) (background light))
-     (:foreground "LightGray" :weight bold :underline t))
+     :foreground "LightGray" :weight bold :underline t)
     (((class grayscale) (background dark))
-     (:foreground "Gray50" :weight bold :underline t))
-    (((class color) (min-colors 88) (background light)) (:foreground "dark cyan"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "Aquamarine"))
-    (((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
-    (((class color) (min-colors 8)) (:foreground "magenta"))
-    (t (:weight bold :underline t)))
+     :foreground "Gray50" :weight bold :underline t)
+    (((class color) (min-colors 88) (background light)) :foreground "dark cyan")
+    (((class color) (min-colors 88) (background dark))  :foreground "Aquamarine")
+    (((class color) (min-colors 16) (background light)) :foreground "CadetBlue")
+    (((class color) (min-colors 16) (background dark))  :foreground "Aquamarine")
+    (((class color) (min-colors 8)) :foreground "magenta")
+    (t :weight bold :underline t))
   "Font Lock mode face used to highlight constants and labels."
   :group 'font-lock-faces)
 
@@ -2285,10 +2282,10 @@ in which C preprocessor directives are used. e.g. `asm-mode' and
        (,(concat
          "(" (regexp-opt
               '("cond" "if" "while" "while-no-input" "let" "let*" "letrec"
-                "prog" "progn" "progv" "prog1" "prog2" "prog*"
-                "inline" "lambda" "save-restriction" "save-excursion"
-                "save-selected-window" "save-window-excursion"
-                "save-match-data" "save-current-buffer"
+                "pcase" "pcase-let" "pcase-let*" "prog" "progn" "progv"
+                 "prog1" "prog2" "prog*" "inline" "lambda"
+                 "save-restriction" "save-excursion" "save-selected-window"
+                 "save-window-excursion" "save-match-data" "save-current-buffer"
                 "combine-after-change-calls" "unwind-protect"
                 "condition-case" "condition-case-unless-debug"
                 "track-mouse" "eval-after-load" "eval-and-compile"
index 007d85caacf8906019e1569fd5100652d06b7c80..4626b28f46435a3090c0391a28c408b3e5881eff 100644 (file)
@@ -21,7 +21,7 @@
 
 ;;; Commentary:
 
-;; Visit a file using a form.  See forms-d2.el for examples.
+;; Visit a file using a form.  See etc/forms for examples.
 ;;
 ;; === Naming conventions
 ;;
@@ -669,7 +669,7 @@ Commands:                        Equivalent keys in read-only mode:
 
   ;;(message "forms: proceeding setup...")
 
-  ;; Since we aren't really implementing a minor mode, we hack the modeline
+  ;; Since we aren't really implementing a minor mode, we hack the mode line
   ;; directly to get the text " View " into forms-read-only form buffers.  For
   ;; that reason, this variable must be buffer only.
   (make-local-variable 'minor-mode-alist)
@@ -2030,8 +2030,10 @@ Usage: (setq forms-number-of-fields
 \f
 ;;; Debugging
 
-(defvar forms--debug nil
-  "*Enables forms-mode debugging if not nil.")
+(defcustom forms--debug nil
+  "If non-nil, enable Forms mode debugging."
+  :type 'boolean
+  :group 'forms)
 
 (defun forms--debug (&rest args)
   "Internal debugging routine."
index 1cd6c0cf181b131e2ddd13223c81a996d20a5ab6..778028390e7615f814adae6a55cb3553cc68aafd 100644 (file)
@@ -25,8 +25,6 @@
 ;;; Commentary:
 
 ;;; Code:
-(eval-when-compile (require 'cl))
-
 (defvar frame-creation-function-alist
   (list (cons nil
              (if (fboundp 'tty-create-frame-with-faces)
@@ -1227,8 +1225,8 @@ often have their own features for raising or lowering frames."
 (defun set-frame-name (name)
   "Set the name of the selected frame to NAME.
 When called interactively, prompt for the name of the frame.
-The frame name is displayed on the modeline if the terminal displays only
-one frame, otherwise the name is displayed on the frame's caption bar."
+On text terminals, the frame name is displayed on the mode line.
+On graphical displays, it is displayed on the frame's title bar."
   (interactive "sFrame name: ")
   (modify-frame-parameters (selected-frame)
                           (list (cons 'name name))))
@@ -1556,21 +1554,6 @@ left untouched.  FRAME nil or omitted means use the selected frame."
 (define-obsolete-variable-alias 'delete-frame-hook
     'delete-frame-functions "22.1")
 
-\f
-;; Highlighting trailing whitespace.
-
-(make-variable-buffer-local 'show-trailing-whitespace)
-
-\f
-;; Scrolling
-
-(defgroup scrolling nil
-  "Scrolling windows."
-  :version "21.1"
-  :group 'frames)
-
-(defvaralias 'automatic-hscrolling 'auto-hscroll-mode)
-
 \f
 ;; Blinking cursor
 
@@ -1627,6 +1610,8 @@ itself as a pre-command hook."
     (cancel-timer blink-cursor-timer)
     (setq blink-cursor-timer nil)))
 
+(define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1")
+
 (define-minor-mode blink-cursor-mode
   "Toggle cursor blinking (Blink Cursor mode).
 With a prefix argument ARG, enable Blink Cursor mode if ARG is
@@ -1653,8 +1638,6 @@ terminals, cursor blinking is controlled by the terminal."
                                blink-cursor-delay
                                'blink-cursor-start))))
 
-(define-obsolete-variable-alias 'blink-cursor 'blink-cursor-mode "22.1")
-
 \f
 ;;;; Key bindings
 
@@ -1663,6 +1646,15 @@ terminals, cursor blinking is controlled by the terminal."
 (define-key ctl-x-5-map "0" 'delete-frame)
 (define-key ctl-x-5-map "o" 'other-frame)
 
+\f
+;; Misc.
+
+;; Only marked as obsolete in 24.2.
+(define-obsolete-variable-alias 'automatic-hscrolling
+  'auto-hscroll-mode "22.1")
+
+(make-variable-buffer-local 'show-trailing-whitespace)
+
 (provide 'frame)
 
 ;;; frame.el ends here
index 70a28bd92f916c1ceb943f793f040ad1a734483f..329370b5fe5572add773e425e3417e54ec7a8f7b 100644 (file)
@@ -43,7 +43,7 @@
 ;; Define the built-in fringe bitmaps and setup default mappings
 
 (when (boundp 'fringe-bitmaps)
-  (let ((bitmaps '(question-mark
+  (let ((bitmaps '(question-mark exclamation-mark
                   left-arrow right-arrow up-arrow down-arrow
                   left-curly-arrow right-curly-arrow
                   left-triangle right-triangle
@@ -207,8 +207,8 @@ frame parameter is used."
   "Set the default appearance of fringes on all frames.
 
 When called interactively, query the user for MODE.  Valid values
-for MODE include `none', `default', `left-only', `right-only',
-`minimal' and `half'.
+for MODE include `no-fringes', `default', `left-only', `right-only',
+`minimal' and `half-width'.
 
 When used in a Lisp program, MODE can be a cons cell where the
 integer in car specifies the left fringe width and the integer in
index 4ddf8b04e91f87819456232e20af34519c07ccd6..6c1d2b9b6249011436b3e667e8b4ad521a233643 100644 (file)
-2012-07-10  Andreas Schwab  <schwab@linux-m68k.org>
+2012-07-17  Andreas Schwab  <schwab@linux-m68k.org>
 
        * shr.el (shr-expand-url): Handle URL starting with `//'.
 
-2012-06-10  Toke Høiland-Jørgensen  <toke@toke.dk>  (tiny change)
+2012-07-17  Toke Høiland-Jørgensen  <toke@toke.dk>  (tiny change)
+2012-07-13  Chong Yidong  <cyd@gnu.org>
+
+       * smime.el (smime-certificate-info): Set buffer-read-only directly,
+       instead of calling toggle-read-only with a (bogus) argument.
+
+2012-07-09  Tassilo Horn  <tassilo@member.fsf.org>
+
+       * gnus-sum.el (gnus-summary-limit-to-author): Use default value instead
+       of initial input when reading the author to restrict the summary to.
+
+2012-07-09  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-sum.el (gnus-select-newsgroup): Don't assume that the group
+       buffer exists, which it doesn't if we haven't started Gnus.
+
+2012-07-09  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-decode.el (mm-shr):
+       Allow overriding charset by mm-charset-override-alist.
+
+2012-07-03  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-art.el (gnus-article-view-part):
+       Toggle subparts of multipart/alternative part.
+
+2012-07-02  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sync.el: Simply require json.
+
+       * registry.el: Simply require eieio and eieio-base.
+
+2012-06-29  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * tests/gnustest-nntp.el, tests/gnustest-registry.el, tests/: Remove.
+
+2012-06-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * shr.el (shr-render-buffer): New command.
+       (shr-visit-file): Use it.
+
+2012-06-27  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * tests/gnustest-nntp.el, tests/gnustest-registry.el:
+       Set no-byte-compile and no-update-autoloads.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-decode.el: Add coding cookie for a soft hyphen that mm-shr uses.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-art.el (gnus-article-read-summary-keys): Protect against the key
+       being bound to a lambda form.
+
+2012-06-26  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * gnus-picon.el (gnus-picon-properties): New defcustom.
+       (gnus-picon-create-glyph): Use it.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * shr.el: Add a iso-8859-1 cookie to make stuff work under other
+       locales.
+
+       * mm-decode.el (mm-display-part): Dissect archives when hitting `RET'
+       on a handle.
+
+       * gnus-sum.el (gnus-summary-limit-to-author): Use the current From
+       address as the default.
+
+       * nnfolder.el (nnfolder-save-buffer): Delete old versions silently.
+       It makes no sense to query the user about internal files.
+
+       * gnus-spec.el: Remove all the byte-compilation stuff, since
+       benchmarking shows that it doesn't help when entering large summary
+       buffers.
+
+       * gnus-util.el (gnus-byte-code): Remove.
+
+       * gnus-spec.el (gnus-update-format-specifications): Remove outdated
+       grouplens stuff.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-msg.el (gnus-msg-mail): Warn the user about Gnus not running
+       (bug#11514).
+
+2012-06-26  Stephen Eglen  <S.J.Eglen@damtp.cam.ac.uk>
+
+       * message.el (message-buffers): Return all buffers derived from Message
+       to make `gnus-dired-attach' work with mu4e.
+
+2012-06-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * mm-decode.el (mm-inhibit-auto-detect-attachment): New variable.
+       (mm-dissect-singlepart): Don't guess the MIME type of
+       application/octet-stream parts if mm-inhibit-auto-detect-attachment is
+       set.
+       (mm-dissect-multipart): Bind mm-inhibit-auto-detect-attachment if the
+       toplevel MIME type is multipart/encrypted.
+
+2012-06-26  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * gnus-agent.el (gnus-agent-save-active): Deal with the "groups" format.
+       In particular, add an optional argument and a docstring.
+
+       * gnus-start.el (gnus-groups-to-gnus-format): Use it.
+
+       * nntp.el (nntp-finish-retrieve-group-infos): Make `nntp-server-buffer'
+       current before calling `gnus-groups-to-gnus-format'.
+       Note that this was already the case for `gnus-active-to-gnus-format'.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * pop3.el (pop3-wait-for-messages): Fix retrieved data size calculation.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * mm-decode.el (mm-dissect-buffer): Doc fix.
+
+       * gnus-sum.el (gnus-handle-ephemeral-exit):
+       Avoid creating the group buffer if it doesn't exist.
+
+       * gnus-group.el (gnus-group-read-ephemeral-group): If no quit-config
+       is given, mark the group as ephemeral with the current window conf.
+
+       * gnus-sum.el (gnus-set-global-variables): Don't assume that the group
+       buffer exists, which it doesn't if we haven't started Gnus.
+       (gnus-summary-exit): Allow quitting when we don't have a group buffer.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * mml.el (mml-generate-mime):
+       Allow specifying what the top-level part type is.
+
+       * gnus-sum.el (gnus-auto-center-summary):
+       `scroll-margin' isn't defined on XEmacs.
+
+2012-06-26  Philipp Haselwarter  <philipp.haselwarter@gmx.de>  (tiny change)
+
+       * gnus-sum.el (gnus-auto-center-summary):
+       Set default to respect `scroll-margin'.
+
+2012-06-26  Elias Oltmanns  <eo@nebensachen.de>  (tiny change)
+
+       * gnus-cite.el (gnus-dissect-cited-text): A single line without
+       citation prefix within a block of cited text should be considered
+       part of that block *only* if it is a blank line.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * shr.el (shr-find-fill-point): Remove unused code; don't break a line
+       before kinsoku-bol characters nor within kinsoku-eol characters.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sync.el (gnus-topic-alist, gnus-group-topic)
+       (gnus-topic-create-topic, gnus-topic-enter-dribble):
+       Silence compiler.
+       (gnus-sync-read): Use mapc instead of mapcar.
+
+       * mm-archive.el: Require mm-decode for some macros.
+       (gnus-recursive-directory-files, mailcap-extension-to-mime):
+       Silence the byte compiler.
+       (mm-archive-decoders): New function that returns the value of
+       the mm-archive-decoders variable.
+
+       * mm-decode.el:
+       Don't require mm-archive; autoload mm-archive functions instead.
+       (mm-dissect-singlepart): Use the function mm-archive-decoders.
+
+       * nnmail.el (mail-send-and-exit): Silence the byte compiler.
+
+2012-06-26  Peter Munster  <pmrb@free.fr>
+
+       * gnus-demon.el (gnus-demon-timers): Now a plist (function -> timer).
+       (gnus-demon-cancel): Ditto.
+       (gnus-demon-run-callback): When function cannot be called due to low
+       idleness, call it when idleness reaches the expected value, instead
+       of waiting another timer period.
+       (gnus-demon-init): Add `time' to arguments of call-back.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus.el: Register gnus-registry functions.
+
+       * gnus-registry.el (gnus-try-warping-via-registry):
+       Moved here and indent.
+
+       * gnus-int.el (gnus-warp-to-article):
+       Check whether the registry is enabled before warping.
+
+2012-06-26  Dave Abrahams  <dave@boostpro.com>
+
+       * gnus-sum.el (gnus-summary-insert-subject): Record information
+       in the registry about each article retrieved.
+
+       * gnus-int.el (gnus-select-group-with-message-id): New function.
+       (gnus-try-warping-via-registry): Ditto.
+       (gnus-warp-to-article): Fall back on the registry.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * nnimap.el (nnimap-fetch-partial-articles): Minor doc string fixup.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-msg.el (gnus-summary-resend-message-insert-gcc): Assume that
+       gnus-gcc-self-resent-messages may be a group parameter.
+       (gnus-summary-resend-message):
+       Don't encode encoded words in header when Gcc'ing resent message.
+
+2012-06-26  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * shr.el (shr-insert): Treat non-breaking space just like normal
+       space.  This seems to produce more pleasing results.
+       (shr-insert):
+       Only insert a blank line if we're starting from an image.
+       (shr-tag-br):
+       Allow <br> to end lines or to make a single blank line.
+       (shr-ensure-paragraph): Consider lines with white space to be blank.
+
+2012-06-26  Christopher Schmidt  <christopher@ch.ristopher.com>
+
+       * gnus-msg.el (gnus-inews-do-gcc): Add gnus-gcc-pre-body-encode-hook
+       and gnus-gcc-post-body-encode-hook.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * mm-decode.el (mm-dissect-singlepart):
+       Guess what the type of application/octet-stream parts really is.
+
+       * gnus-sum.el (gnus-propagate-marks): Remove.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * nntp.el (nntp-coding-system-for-read): Remove.
+       (nntp-coding-system-for-write): Ditto.
+       (nntp-open-connection): Just use `binary' directly.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * registry.el (registry-usage-test, registry-persistence-test):
+       Move to tests/gnustest-registry.el.
+       (registry-make-testable-db, registry-match-test)
+       (registry-instantiation-test): Move to tests/gnustest-registry.el.
+
+       * gnus-registry.el (gnus-registry-misc-test)
+       (gnus-registry-usage-test): Move to tests/gnustest-registry.el.
+
+       * tests/gnustest-registry.el:
+       New file with the registry and gnus-registry ERT tests.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-msg.el (gnus-summary-resend-message):
+       Make gnus-summary-resend-message-insert-gcc be last item in
+       message-header-setup-hook.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * nnfolder.el (nnfolder-marks-directory, nnfolder-marks-is-evil)
+       (nnfolder-marks, nnfolder-marks-file-suffix)
+       (nnfolder-marks-modtime): Remove.
+       (nnfolder-open-server): Don't use marks.
+       (nnfolder-request-delete-group): Ditto.
+       (nnfolder-request-rename-group): Ditto.
+       (nnfolder-request-set-mark, nnfolder-request-marks)
+       (nnfolder-group-marks-pathname, nnfolder-marks-changed-p)
+       (nnfolder-save-marks, nnfolder-open-marks): Remove.
+
+       * nnml.el (nnml-marks-is-evil, nnml-marks-file-name, nnml-marks)
+       (nnml-marks-modtime): Remove.
+       (nnml-request-delete-group): Don't use marks.
+       (nnml-request-rename-group): Ditto.
+       (nnml-request-set-mark, nnml-request-marks, nnml-marks-changed-p)
+       (nnml-save-marks, nnml-open-marks): Remove.
+
+       * nntp.el (nntp-marks-is-evil, nntp-marks-file-name, nntp-marks)
+       (nntp-marks-modtime, nntp-marks-directory, nntp-request-set-mark)
+       (nntp-request-marks, nntp-marks-directory, nntp-marks-changed-p)
+       (nntp-save-marks, nntp-open-marks, nntp-possibly-create-directory)
+       (nntp-server-to-method-cache): Remove.
+
+       * shr.el (shr-rescale-image): Fix wrong merge.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * shr.el (shr-remove-trailing-whitespace):
+       Really delete the padding on too-wide lines.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * mm-archive.el (mm-archive-dissect-and-inline): New function.
+       (mm-archive-dissect-and-inline): Fix up the undisplayer.
+
+       * mm-decode.el (mm-display-external): Output the text from
+       the command in the buffer after the command finished.
+       This makes text-based commands behave better.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * message.el (smtpmail-smtp-user): Silence compiler warning.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * message.el (message-multi-smtp-send-mail): Also allow specifying
+       the SMTP user name.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sum.el (gnus-summary-article-map): Fix typo.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * message.el (message-multi-smtp-send-mail): New function.
+       (message-multi-smtp-send-mail): Respect the X-Message-SMTP-Method
+       header to implement multi-SMTP functionality.
+
+       * gnus-agent.el (gnus-agent-send-mail-function): Removed.
+       (gnus-agentize): Don't set it.
+       (gnus-agent-send-mail): Don't use it.
+
+       * gnus-sum.el (gnus-summary-widget-backward):
+       New function and keystroke.
+
+       * shr.el (shr-put-image): Remove underlines from sliced images.
+       (shr-zoom-image): Compute the region to be replaced more correctly.
+
+2012-06-26  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-msg.el (gnus-gcc-self-resent-messages): New user option.
+       (gnus-summary-resend-message-insert-gcc): New function.
+       (gnus-summary-resend-message): Modify message-header-setup-hook and
+       message-sent-hook to make it work for Gcc.
+       (gnus-inews-do-gcc): Update the number of unread articles of groups
+       that messages are Gcc'd to.
+
+       * message.el (message-resend): Run message-sent-hook to do Gcc.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-registry.el (gnus-registry-fixup-registry):
+       Move the message to a higher level to silence compilation.
+
+       * gnus-art.el (gnus-shr-put-image): Take and pass on a `flags'
+       parameter to allow controlling the scaling.
+
+       * shr.el (shr-zoom-image): New command and keystroke.
+       (shr-put-image): Take a `size' flag to say how to scale the image.
+
+       * mm-archive.el (mm-dissect-archive): Use it to get all file names.
+       Use recursive deletion.
+       (mm-dissect-archive): Add support for zip files.
+
+       * gnus-util.el (gnus-recursive-directory-files): New function.
+
+       * mm-archive.el (mm-archive-list-files): Inline text and image parts.
+       (mm-archive-decoders): Add tgz support.
+
+       * mm-decode.el (mm-shr): Make sure that the HTML ends with a newline.
+       Otherwise inserting text into the Gnus buffer can look odd.
+
+       * gnus-art.el (gnus-mime-inline-part): Slight clean-up.
+
+       * mm-archive.el (mm-archive-decoders): Add support for tar.
+
+       * gnus.el (gnus-logo-color-alist): Change the colours for Ma Gnus.
+
+       * nnmail.el (nnmail-extra-headers): Add Cc to the default.
+
+2012-06-26  Lars Ingebrigtsen  <larsi@gnus.org>
+
+       * mm-decode.el (mm-dissect-singlepart): Check that the decoder exists.
+
+       * mm-archive.el: New file.
+
+       * mm-decode.el (mm-dissect-singlepart):
+       Use it to decode ms-tnef files.
+
+       * mm-util.el (mm-find-buffer-file-coding-system): Comment fix.
+
+       * message.el (message-goto-*): Make all the `message-goto-*' commands
+       push the mark before moving point.  This makes it easier to go back
+       to where you came from after editing whatever you jumped to.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-sync.el (gnus-sync-newsrc-groups): Quote normally.
+       (gnus-sync-lesync-pre-save-group-entry): Remove invalid invlists.
+       (gnus-sync-lesync-normalize-group-entry): Ignore a few more keys.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * spam.el: Move BBDB autoloads.
+       (spam-exists-in-BBDB-p):
+       New function to do the BBDB search directly in BBDB 2 and 3.
+       (spam-check-BBDB): Use it.
+       (spam-enter-ham-BBDB): Use it.
+
+2012-06-26  Peter Munster  <pmrb@free.fr>  (tiny change)
+
+       * gnus-group.el (gnus-group-get-new-news):
+       New parameter `one-level' for scanning exactly one level.
+
+       * gnus-start.el (gnus-get-unread-articles): Ditto.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-sync.el: More commentary about setup.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-sync.el: More commentary about `gnus-sync-read' issues.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-sync.el: Improve docs about CouchDB admins.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-sync.el (gnus-sync-lesync-setup): Fix salt when user setup is
+       not needed.  Provide xmlplistread list function to produce XML plist
+       output for non-Gnus LeSync clients.
+
+2012-06-26  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * gnus-sync.el: Add LeSync synchronization backend and logic to read
+       and save against it.  Group subscriptions, read marks, other marks,
+       subscription levels, topic names, and topic offsets (the group's
+       position within the topic) are saved.  This is an experimental
+       backend and may change significantly.  Load json.el from
+       the gnus-fallback-lib if it's not available otherwise.
+       (gnus-sync-save): Don't use `apply-partially' because of XEmacs.
+
+2012-06-26  David Engster  <dengste@eml.cc>
+
+       * tests/gnustest-nntp.el: New file for simple NNTP testing.
+
+2012-06-18  Nelson Ferreira  <nelson.ferreira@ieee.org>  (tiny change)
+
+       * gnus-win.el (gnus-configure-frame): Pass an arg to window-dedicated-p.
+
+2012-06-17  Toke Høiland-Jørgensen  <toke@toke.dk>  (tiny change)
 
        * nnmaildir.el (nnmaildir-request-expire-articles): Ensure that `time'
        is an integer to avoid later problems.
 
-2012-06-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+2012-06-17  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * shr.el: Add a iso-8859-1 cookie to make stuff work under other
        locales.
 
-2012-05-21  Katsumi Yamaoka  <yamaoka@jpl.org>
+2012-04-14  Wolfgang Jenkner  <wjenkner@inode.at>
+
+       * gnus-agent.el (gnus-agent-retrieve-headers): Recalculate the range of
+       articles when fetch-old is non-nil (bug#11370).
+
+2012-06-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-group.el (gnus-group-get-new-news): Respect
+       `gnus-group-use-permanent-levels', as documented (bug#11638).
+
+2012-06-10  Dave Abrahams  <dave@boostpro.com>
+
+       * gnus-int.el (gnus-warp-to-article): Limit registry warping to real
+       groups (bug#11641).
+
+2012-06-07  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-msg.el (gnus-msg-mail): Warn the user about Gnus not running
+       (bug#11514).
+
+2012-06-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * nntp.el: Stop the `letf' madness.
+       (nntp--report-1): New var.
+       (nntp-report): Merge nntp-report-1 into it.
+       (nntp-with-open-group-function): Set nntp--report-1 instead of modifying
+       the nntp-report function.
+
+       * auth-source.el: Fix comment-style to follow the convention.
+
+2012-05-27  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-msg.el (gnus-msg-mail): Ensure that gnus-newsgroup-name is
        a string so that Gcc works (bug#11514).
 
-2012-04-21  Andreas Schwab  <schwab@linux-m68k.org>
+2012-05-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * legacy-gnus-agent.el (gnus-agent-unhook-expire-days):
+       * gnus-demon.el (gnus-demon-init): Don't bother with type-of.
+
+2012-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * gnus-win.el (gnus-configure-frame): Don't signal an error when
+       jumping to *Server* from a dedicated *Group* window.
+       (gnus-configure-frame): CSE.
+
+       * gnus-registry.el: Minor style cleanup.
+       (gnus-registry--set/remove-mark): New function, extracted from
+       gnus-registry-install-shortcuts.
+       (gnus-registry-install-shortcuts): Use it.
+
+2012-05-25  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * nnspool.el (news-path): Use eval-and-compile.
+
+2012-05-24  Glenn Morris  <rgm@gnu.org>
+
+       * nnspool.el (news-directory, news-path, news-inews-program):
+       Move here from paths.el.  Don't see a need for these to be autoloaded.
+
+       * gnus.el (gnus-default-nntp-server): Make it a defcustom.
+       Merge in doc from paths.el version.  Don't see any need for this to be
+       autoloaded, or for the warning about users not setting it.
+
+2012-05-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix minor Y10k bug.
+       * nnweb.el (nnweb-google-parse-1): Don't assume years have 4 digits.
+
+2012-05-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * nnimap.el (nnimap-open-connection-1): Don't leave an "opening..."
+       message once it's actually open.
+
+2012-04-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * auth-source.el (auth-source--aput-1, auth-source--aput)
+       (auth-source--aget): New functions and macros.
+       Use them instead of aput/aget.
+
+2012-04-27  Andreas Schwab  <schwab@linux-m68k.org>
 
        * gnus.el (debbugs-gnu): Don't override existing autoload definition.
 
-2012-04-12  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+2012-04-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * plstore.el (plstore-called-interactively-p): New compat macro copied
+       from message.el.
+       (plstore-mode): Use it.
+
+2012-04-26  Daiki Ueno  <ueno@unixuser.org>
+
+       * plstore.el: Revive the editing feature.
+       (plstore-mode): New mode to edit plstore file.
+       (plstore-mode-toggle-display, plstore-mode-original)
+       (plstore-mode-decoded): New command.
+       (plstore--encode, plstore--decode, plstore--write-contents-functions)
+       (plstore--insert-buffer, plstore--make): New function.
+       (plstore-open, plstore-save): Simplify by using them.
+
+2012-04-16  Glenn Morris  <rgm@gnu.org>
+
+       * nndraft.el (nndraft-request-list): Fix declaration.
+
+2012-04-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * gnus-msg.el (gnus-inews-insert-gcc): Don't do the alist stuff when we
        don't have a current group.
 
-2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
-
        * gnus-msg.el (gnus-inews-insert-gcc): Protect against when we don't
        have a group name.
 
        * gnus-start.el (gnus-read-newsrc-el-file): Protect against broken
        .newsrc.el files.
 
+2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * gnus-msg.el (gnus-summary-cancel-article): See what From header we
+       would have gotten if we posted to the group, and use that to compare
+       against the message we want to cancel (bug#10808).
+
 2012-03-22  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
        * auth-source.el (auth-source-netrc-create): Quote tokens that contain
 2010-11-29  Binjo  <binjo.cn@gmail.com>  (tiny change)
 
        * nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't
-       seem to accept strings-with-numbers as port numbers,
+       seem to accept strings-with-numbers as port numbers.
 
 2010-11-29  Andrew Cohen  <cohen@andy.bu.edu>
 
 
 2010-11-25  Julien Danjou  <julien@danjou.info>
 
-       * shr-color.el (shr-color->hexadecimal): Use color-rgb->hex
+       * shr-color.el (shr-color->hexadecimal): Use color-rgb->hex.
 
        * color.el: Rename from color-lab.el
        (color-rgb->hex): Add.
 
 2004-05-20  Danny Siu  <dsiu@adobe.com>
 
-       * gnus-sum.el (gnus-summary-recenter): Summery buffer was not auto
-       centered even when gnus-auto-center-summary is t
+       * gnus-sum.el (gnus-summary-recenter): Summary buffer was not auto
+       centered even when gnus-auto-center-summary is t.
 
 2004-05-22  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 
        * gnus.el (gnus-method-to-server): Move defsubst before first use.
 
-       * gnus-diary.el (gnus-diary-header-schedule): caddr -> car (cddr
+       * gnus-diary.el (gnus-diary-header-schedule): caddr -> car (cddr.
 
        * gnus-art.el (gnus-article-edit-mode): Define before first
        reference.
 
        * gnus-sum.el (gnus-select-newgroup): Replace inline code with
        gnus-agent-possibly-alter-active.
-       (gnus-adjust-marked-articles): Faster handling of simple lists
+       (gnus-adjust-marked-articles): Faster handling of simple lists.
 
 2004-01-21  Jesper Harder  <harder@ifa.au.dk>
 
 
 See ChangeLog.2 for earlier changes.
 
-  Copyright (C) 2004-2012  Free Software Foundation, Inc.
+  Copyright (C) 2004-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index f3ba7bca4d4de2c332bda2669f536ad843bbe688..f223bd770859945aacb9e288fd69a0b17a83cb73 100644 (file)
 
 1997-11-25  Lars Magne Ingebrigtsen  <larsi@ifi.uio.no>
 
-       * gnus-move.el (gnus-move-group-to-server): Protect agains
+       * gnus-move.el (gnus-move-group-to-server): Protect against
        nil-ness.
 
 1997-11-25  Lars Magne Ingebrigtsen  <larsi@menja.ifi.uio.no>
index 34fe5afe7af4b57a13d37d11a9b2ac5489173ea8..47359500dc4283d2f3a12ac4daf72085fcd16ce2 100644 (file)
@@ -42,7 +42,6 @@
 (require 'password-cache)
 (require 'mm-util)
 (require 'gnus-util)
-(require 'assoc)
 
 (eval-when-compile (require 'cl))
 (require 'eieio)
@@ -92,9 +91,9 @@ let-binding."
                  (const :tag "30 Minutes" 1800)
                  (integer :tag "Seconds")))
 
-;;; The slots below correspond with the `auth-source-search' spec,
-;;; so a backend with :host set, for instance, would match only
-;;; searches for that host.  Normally they are nil.
+;; The slots below correspond with the `auth-source-search' spec,
+;; so a backend with :host set, for instance, would match only
+;; searches for that host.  Normally they are nil.
 (defclass auth-source-backend ()
   ((type :initarg :type
          :initform 'netrc
@@ -149,8 +148,8 @@ let-binding."
                        (repeat :tag "Names"
                                (string :tag "Name")))))
 
-;;; generate all the protocols in a format Customize can use
-;;; TODO: generate on the fly from auth-source-protocols
+;; Generate all the protocols in a format Customize can use.
+;; TODO: generate on the fly from auth-source-protocols
 (defconst auth-source-protocols-customize
   (mapcar (lambda (a)
             (let ((p (car-safe a)))
@@ -339,7 +338,7 @@ If the value is not a list, symmetric encryption will be used."
    msg))
 
 
-;;; (auth-source-read-char-choice "enter choice? " '(?a ?b ?q))
+;; (auth-source-read-char-choice "enter choice? " '(?a ?b ?q))
 (defun auth-source-read-char-choice (prompt choices)
   "Read one of CHOICES by `read-char-choice', or `read-char'.
 `dropdown-list' support is disabled because it doesn't work reliably.
@@ -711,10 +710,10 @@ must call it to obtain the actual value."
             (setq matches (append matches bmatches))))))
     matches))
 
-;;; (auth-source-search :max 1)
-;;; (funcall (plist-get (nth 0 (auth-source-search :max 1)) :secret))
-;;; (auth-source-search :host "nonesuch" :type 'netrc :K 1)
-;;; (auth-source-search :host "nonesuch" :type 'secrets)
+;; (auth-source-search :max 1)
+;; (funcall (plist-get (nth 0 (auth-source-search :max 1)) :secret))
+;; (auth-source-search :host "nonesuch" :type 'netrc :K 1)
+;; (auth-source-search :host "nonesuch" :type 'secrets)
 
 (defun* auth-source-delete (&rest spec
                                   &key delete
@@ -776,16 +775,16 @@ This is the same SPEC you passed to `auth-source-search'.
 Returns t or nil for forgotten or not found."
   (password-cache-remove (auth-source-format-cache-entry spec)))
 
-;;; (loop for sym being the symbols of password-data when (string-match (concat "^" auth-source-magic) (symbol-name sym)) collect (symbol-name sym))
+;; (loop for sym being the symbols of password-data when (string-match (concat "^" auth-source-magic) (symbol-name sym)) collect (symbol-name sym))
 
-;;; (auth-source-remember '(:host "wedd") '(4 5 6))
-;;; (auth-source-remembered-p '(:host "wedd"))
-;;; (auth-source-remember '(:host "xedd") '(1 2 3))
-;;; (auth-source-remembered-p '(:host "xedd"))
-;;; (auth-source-remembered-p '(:host "zedd"))
-;;; (auth-source-recall '(:host "xedd"))
-;;; (auth-source-recall '(:host t))
-;;; (auth-source-forget+ :host t)
+;; (auth-source-remember '(:host "wedd") '(4 5 6))
+;; (auth-source-remembered-p '(:host "wedd"))
+;; (auth-source-remember '(:host "xedd") '(1 2 3))
+;; (auth-source-remembered-p '(:host "xedd"))
+;; (auth-source-remembered-p '(:host "zedd"))
+;; (auth-source-recall '(:host "xedd"))
+;; (auth-source-recall '(:host t))
+;; (auth-source-forget+ :host t)
 
 (defun* auth-source-forget+ (&rest spec &allow-other-keys)
   "Forget any cached data matching SPEC.  Returns forgotten count.
@@ -819,8 +818,8 @@ while \(:host t) would find all host entries."
               (return 'no)))
           'no))))
 
-;;; (auth-source-pick-first-password :host "z.lifelogs.com")
-;;; (auth-source-pick-first-password :port "imap")
+;; (auth-source-pick-first-password :host "z.lifelogs.com")
+;; (auth-source-pick-first-password :port "imap")
 (defun auth-source-pick-first-password (&rest spec)
   "Pick the first secret found from applying SPEC to `auth-source-search'."
   (let* ((result (nth 0 (apply 'auth-source-search (plist-put spec :max 1))))
@@ -853,7 +852,22 @@ while \(:host t) would find all host entries."
 
 ;;; Backend specific parsing: netrc/authinfo backend
 
-;;; (auth-source-netrc-parse "~/.authinfo.gpg")
+(defun auth-source--aput-1 (alist key val)
+  (let ((seen ())
+        (rest alist))
+    (while (and (consp rest) (not (equal key (caar rest))))
+      (push (pop rest) seen))
+    (cons (cons key val)
+          (if (null rest) alist
+            (nconc (nreverse seen)
+                   (if (equal key (caar rest)) (cdr rest) rest))))))
+(defmacro auth-source--aput (var key val)
+  `(setq ,var (auth-source--aput-1 ,var ,key ,val)))
+
+(defun auth-source--aget (alist key)
+  (cdr (assoc key alist)))
+
+;; (auth-source-netrc-parse "~/.authinfo.gpg")
 (defun* auth-source-netrc-parse (&rest
                                  spec
                                  &key file max host user port delete require
@@ -888,10 +902,11 @@ Note that the MAX parameter is used so we can exit the parse early."
             ;; cache all netrc files (used to be just .gpg files)
             ;; Store the contents of the file heavily encrypted in memory.
             ;; (note for the irony-impaired: they are just obfuscated)
-            (aput 'auth-source-netrc-cache file
-                  (list :mtime (nth 5 (file-attributes file))
-                        :secret (lexical-let ((v (mapcar '1+ (buffer-string))))
-                                  (lambda () (apply 'string (mapcar '1- v)))))))
+            (auth-source--aput
+             auth-source-netrc-cache file
+             (list :mtime (nth 5 (file-attributes file))
+                   :secret (lexical-let ((v (mapcar '1+ (buffer-string))))
+                             (lambda () (apply 'string (mapcar '1- v)))))))
           (goto-char (point-min))
           ;; Go through the file, line by line.
           (while (and (not (eobp))
@@ -937,21 +952,21 @@ Note that the MAX parameter is used so we can exit the parse early."
                        (auth-source-search-collection
                         host
                         (or
-                         (aget alist "machine")
-                         (aget alist "host")
+                         (auth-source--aget alist "machine")
+                         (auth-source--aget alist "host")
                          t))
                        (auth-source-search-collection
                         user
                         (or
-                         (aget alist "login")
-                         (aget alist "account")
-                         (aget alist "user")
+                         (auth-source--aget alist "login")
+                         (auth-source--aget alist "account")
+                         (auth-source--aget alist "user")
                          t))
                        (auth-source-search-collection
                         port
                         (or
-                         (aget alist "port")
-                         (aget alist "protocol")
+                         (auth-source--aget alist "port")
+                         (auth-source--aget alist "protocol")
                          t))
                        (or
                         ;; the required list of keys is nil, or
@@ -1086,8 +1101,8 @@ FILE is the file from which we obtained this token."
               ret))
           alist))
 
-;;; (setq secret (plist-get (nth 0 (auth-source-search :host t :type 'netrc :K 1 :max 1)) :secret))
-;;; (funcall secret)
+;; (setq secret (plist-get (nth 0 (auth-source-search :host t :type 'netrc :K 1 :max 1)) :secret))
+;; (funcall secret)
 
 (defun* auth-source-netrc-search (&rest
                                   spec
@@ -1133,8 +1148,8 @@ See `auth-source-search' for details on SPEC."
       (nth 0 v)
     v))
 
-;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t)
-;;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t :create-extra-keys '((A "default A") (B)))
+;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t)
+;; (auth-source-search :host "nonesuch" :type 'netrc :max 1 :create t :create-extra-keys '((A "default A") (B)))
 
 (defun* auth-source-netrc-create (&rest spec
                                         &key backend
@@ -1166,7 +1181,7 @@ See `auth-source-search' for details on SPEC."
                           ;; just the value otherwise
                           (t (symbol-value br)))))
           (when br-choice
-            (aput 'valist br br-choice)))))
+            (auth-source--aput valist br br-choice)))))
 
     ;; for extra required elements, see if the spec includes a value for them
     (dolist (er create-extra)
@@ -1175,17 +1190,18 @@ See `auth-source-search' for details on SPEC."
                         collect (nth i spec))))
         (dolist (k keys)
           (when (equal (symbol-name k) name)
-            (aput 'valist er (plist-get spec k))))))
+            (auth-source--aput valist er (plist-get spec k))))))
 
     ;; for each required element
     (dolist (r required)
-      (let* ((data (aget valist r))
+      (let* ((data (auth-source--aget valist r))
              ;; take the first element if the data is a list
              (data (or (auth-source-netrc-element-or-first data)
                        (plist-get current-data
                                   (intern (format ":%s" r) obarray))))
              ;; this is the default to be offered
-             (given-default (aget auth-source-creation-defaults r))
+             (given-default (auth-source--aget
+                             auth-source-creation-defaults r))
              ;; the default supplementals are simple:
              ;; for the user, try `given-default' and then (user-login-name);
              ;; otherwise take `given-default'
@@ -1197,22 +1213,22 @@ See `auth-source-search' for details on SPEC."
                                   (cons 'user
                                         (or
                                          (auth-source-netrc-element-or-first
-                                          (aget valist 'user))
+                                          (auth-source--aget valist 'user))
                                          (plist-get artificial :user)
                                          "[any user]"))
                                   (cons 'host
                                         (or
                                          (auth-source-netrc-element-or-first
-                                          (aget valist 'host))
+                                          (auth-source--aget valist 'host))
                                          (plist-get artificial :host)
                                          "[any host]"))
                                   (cons 'port
                                         (or
                                          (auth-source-netrc-element-or-first
-                                          (aget valist 'port))
+                                          (auth-source--aget valist 'port))
                                          (plist-get artificial :port)
                                          "[any port]"))))
-             (prompt (or (aget auth-source-creation-prompts r)
+             (prompt (or (auth-source--aget auth-source-creation-prompts r)
                          (case r
                            (secret "%p password for %u@%h: ")
                            (user "%p user name for %h: ")
@@ -1221,9 +1237,9 @@ See `auth-source-search' for details on SPEC."
                          (format "Enter %s (%%u@%%h:%%p): " r)))
              (prompt (auth-source-format-prompt
                       prompt
-                      `((?u ,(aget printable-defaults 'user))
-                        (?h ,(aget printable-defaults 'host))
-                        (?p ,(aget printable-defaults 'port))))))
+                      `((?u ,(auth-source--aget printable-defaults 'user))
+                        (?h ,(auth-source--aget printable-defaults 'host))
+                        (?p ,(auth-source--aget printable-defaults 'port))))))
 
         ;; Store the data, prompting for the password if needed.
         (setq data (or data
@@ -1384,16 +1400,16 @@ Respects `auth-source-save-behavior'.  Uses
                file)
               (message "Saved new authentication information to %s" file)
               nil))))
-      (aput 'auth-source-netrc-cache key "ran"))))
+      (auth-source--aput auth-source-netrc-cache key "ran"))))
 
 ;;; Backend specific parsing: Secrets API backend
 
-;;; (let ((auth-sources '(default))) (auth-source-search :max 1 :create t))
-;;; (let ((auth-sources '(default))) (auth-source-search :max 1 :delete t))
-;;; (let ((auth-sources '(default))) (auth-source-search :max 1))
-;;; (let ((auth-sources '(default))) (auth-source-search))
-;;; (let ((auth-sources '("secrets:Login"))) (auth-source-search :max 1))
-;;; (let ((auth-sources '("secrets:Login"))) (auth-source-search :max 1 :signon_realm "https://git.gnus.org/Git"))
+;; (let ((auth-sources '(default))) (auth-source-search :max 1 :create t))
+;; (let ((auth-sources '(default))) (auth-source-search :max 1 :delete t))
+;; (let ((auth-sources '(default))) (auth-source-search :max 1))
+;; (let ((auth-sources '(default))) (auth-source-search))
+;; (let ((auth-sources '("secrets:Login"))) (auth-source-search :max 1))
+;; (let ((auth-sources '("secrets:Login"))) (auth-source-search :max 1 :signon_realm "https://git.gnus.org/Git"))
 
 (defun* auth-source-secrets-search (&rest
                                     spec
@@ -1609,7 +1625,7 @@ authentication tokens:
                           ;; just the value otherwise
                           (t (symbol-value br)))))
           (when br-choice
-            (aput 'valist br br-choice)))))
+            (auth-source--aput valist br br-choice)))))
 
     ;; for extra required elements, see if the spec includes a value for them
     (dolist (er create-extra)
@@ -1618,17 +1634,18 @@ authentication tokens:
                         collect (nth i spec))))
         (dolist (k keys)
           (when (equal (symbol-name k) name)
-            (aput 'valist er (plist-get spec k))))))
+            (auth-source--aput valist er (plist-get spec k))))))
 
     ;; for each required element
     (dolist (r required)
-      (let* ((data (aget valist r))
+      (let* ((data (auth-source--aget valist r))
              ;; take the first element if the data is a list
              (data (or (auth-source-netrc-element-or-first data)
                        (plist-get current-data
                                   (intern (format ":%s" r) obarray))))
              ;; this is the default to be offered
-             (given-default (aget auth-source-creation-defaults r))
+             (given-default (auth-source--aget
+                             auth-source-creation-defaults r))
              ;; the default supplementals are simple:
              ;; for the user, try `given-default' and then (user-login-name);
              ;; otherwise take `given-default'
@@ -1640,22 +1657,22 @@ authentication tokens:
                                   (cons 'user
                                         (or
                                          (auth-source-netrc-element-or-first
-                                          (aget valist 'user))
+                                          (auth-source--aget valist 'user))
                                          (plist-get artificial :user)
                                          "[any user]"))
                                   (cons 'host
                                         (or
                                          (auth-source-netrc-element-or-first
-                                          (aget valist 'host))
+                                          (auth-source--aget valist 'host))
                                          (plist-get artificial :host)
                                          "[any host]"))
                                   (cons 'port
                                         (or
                                          (auth-source-netrc-element-or-first
-                                          (aget valist 'port))
+                                          (auth-source--aget valist 'port))
                                          (plist-get artificial :port)
                                          "[any port]"))))
-             (prompt (or (aget auth-source-creation-prompts r)
+             (prompt (or (auth-source--aget auth-source-creation-prompts r)
                          (case r
                            (secret "%p password for %u@%h: ")
                            (user "%p user name for %h: ")
@@ -1664,20 +1681,21 @@ authentication tokens:
                          (format "Enter %s (%%u@%%h:%%p): " r)))
              (prompt (auth-source-format-prompt
                       prompt
-                      `((?u ,(aget printable-defaults 'user))
-                        (?h ,(aget printable-defaults 'host))
-                        (?p ,(aget printable-defaults 'port))))))
+                      `((?u ,(auth-source--aget printable-defaults 'user))
+                        (?h ,(auth-source--aget printable-defaults 'host))
+                        (?p ,(auth-source--aget printable-defaults 'port))))))
 
         ;; Store the data, prompting for the password if needed.
         (setq data (or data
                        (if (eq r 'secret)
                            (or (eval default) (read-passwd prompt))
                          (if (stringp default)
-                             (read-string (if (string-match ": *\\'" prompt)
-                                              (concat (substring prompt 0 (match-beginning 0))
-                                                      " (default " default "): ")
-                                            (concat prompt "(default " default ") "))
-                                          nil nil default)
+                             (read-string
+                              (if (string-match ": *\\'" prompt)
+                                  (concat (substring prompt 0 (match-beginning 0))
+                                          " (default " default "): ")
+                                (concat prompt "(default " default ") "))
+                              nil nil default)
                            (eval default)))))
 
         (when data
@@ -1701,7 +1719,7 @@ authentication tokens:
 
 ;;; older API
 
-;;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" t "tzz")
+;; (auth-source-user-or-password '("login" "password") "imap.myhost.com" t "tzz")
 
 ;; deprecate the old interface
 (make-obsolete 'auth-source-user-or-password
index bbd3c95265d681fd00528510d2ba0d3cc81fd8f5..525008c351f8d3051bb0e5256c414a50809696b7 100644 (file)
@@ -242,7 +242,6 @@ NOTES:
 (defvar gnus-category-group-cache nil)
 (defvar gnus-agent-spam-hashtb nil)
 (defvar gnus-agent-file-name nil)
-(defvar gnus-agent-send-mail-function nil)
 (defvar gnus-agent-file-coding-system 'raw-text)
 (defvar gnus-agent-file-loading-cache nil)
 (defvar gnus-agent-total-fetched-hashtb nil)
@@ -683,11 +682,7 @@ This will modify the `gnus-setup-news-hook', and
 minor mode in all Gnus buffers."
   (interactive)
   (gnus-open-agent)
-  (unless gnus-agent-send-mail-function
-    (setq gnus-agent-send-mail-function
-         (or message-send-mail-real-function
-             (function (lambda () (funcall message-send-mail-function))))
-         message-send-mail-real-function 'gnus-agent-send-mail))
+  (setq message-send-mail-real-function 'gnus-agent-send-mail)
 
   ;; If the servers file doesn't exist, auto-agentize some servers and
   ;; save the servers file so this auto-agentizing isn't invoked
@@ -723,7 +718,7 @@ Optional arg GROUP-NAME allows to specify another group."
 (defun gnus-agent-send-mail ()
   (if (or (not gnus-agent-queue-mail)
          (and gnus-plugged (not (eq gnus-agent-queue-mail 'always))))
-      (funcall gnus-agent-send-mail-function)
+      (message-multi-smtp-send-mail)
     (goto-char (point-min))
     (re-search-forward
      (concat "^" (regexp-quote mail-header-separator) "\n"))
@@ -1304,12 +1299,18 @@ This can be added to `gnus-select-article-hook' or
             (gnus-group-update-group group t)))
     nil))
 
-(defun gnus-agent-save-active (method)
+(defun gnus-agent-save-active (method &optional groups-p)
+  "Sync the agent's active file with the current buffer.
+Pass non-nil for GROUPS-P if the buffer starts out in groups format.
+Regardless, both the file and the buffer end up in active format
+if METHOD is agentized; otherwise the function is a no-op."
   (when (gnus-agent-method-p method)
     (let* ((gnus-command-method method)
           (new (gnus-make-hashtable (count-lines (point-min) (point-max))))
           (file (gnus-agent-lib-file "active")))
-      (gnus-active-to-gnus-format nil new)
+      (if groups-p
+         (gnus-groups-to-gnus-format nil new)
+       (gnus-active-to-gnus-format nil new))
       (gnus-agent-write-active file new)
       (erase-buffer)
       (let ((nnheader-file-coding-system gnus-agent-file-coding-system))
@@ -3742,6 +3743,13 @@ has been fetched."
       (gnus-make-directory (nnheader-translate-file-chars
                            (file-name-directory file) t))
 
+      (when fetch-old
+       (setq articles (gnus-uncompress-range
+                       (cons (if (numberp fetch-old)
+                                 (max 1 (- (car articles) fetch-old))
+                               1)
+                             (car (last articles))))))
+
       ;; Populate temp buffer with known headers
       (when (file-exists-p file)
        (with-current-buffer gnus-agent-overview-buffer
@@ -3778,12 +3786,7 @@ has been fetched."
                    (set-buffer nntp-server-buffer)
                    (let* ((fetched-articles (list nil))
                           (tail-fetched-articles fetched-articles)
-                          (min (cond ((numberp fetch-old)
-                                      (max 1 (- (car articles) fetch-old)))
-                                     (fetch-old
-                                      1)
-                                     (t
-                                      (car articles))))
+                          (min (car articles))
                           (max (car (last articles))))
 
                      ;; Get the list of articles that were fetched
@@ -3858,8 +3861,7 @@ has been fetched."
             (not (numberp fetch-old)))
        t                               ; Don't remove anything.
       (nnheader-nov-delete-outside-range
-       (if fetch-old (max 1 (- (car articles) fetch-old))
-        (car articles))
+       (car articles)
        (car (last articles)))
       t)
 
index b04615dc5a956d9d35657d4b389fc73832ab82b4..56c2a37c2aa1242c8e534a87a2eb6c49d15337a4 100644 (file)
@@ -2231,7 +2231,8 @@ unfolded."
                 (unfoldable
                  (or (equal gnus-article-unfold-long-headers t)
                      (and (stringp gnus-article-unfold-long-headers)
-                          (string-match gnus-article-unfold-long-headers header)))))
+                          (string-match gnus-article-unfold-long-headers
+                                        header)))))
            (with-temp-buffer
              (insert header)
              (goto-char (point-min))
@@ -5329,9 +5330,8 @@ Compressed files like .gz and .bz2 are decompressed."
                (or (cdr (assq arg
                               gnus-summary-show-article-charset-alist))
                    (mm-read-coding-system "Charset: "))))
-        (t
-         (if (mm-handle-undisplayer handle)
-             (mm-remove-part handle))))
+        ((mm-handle-undisplayer handle)
+         (mm-remove-part handle)))
        (forward-line 2)
         (mm-display-inline handle)
        (goto-char b)))))
@@ -5621,7 +5621,9 @@ all parts."
     (let ((handle (cdr (assq n gnus-article-mime-handle-alist))))
       (when (gnus-article-goto-part n)
        (if (equal (car handle) "multipart/alternative")
-           (gnus-article-press-button)
+           (progn
+             (beginning-of-line) ;; Make it toggle subparts
+             (gnus-article-press-button))
          (when (eq (gnus-mm-display-part handle) 'internal)
            (gnus-set-window-start)))))))
 
@@ -6200,12 +6202,13 @@ Provided for backwards compatibility."
             (not gnus-inhibit-hiding))
     (gnus-article-hide-headers)))
 
-(declare-function shr-put-image "shr" (data alt))
+(declare-function shr-put-image "shr" (data alt &optional flags))
 
-(defun gnus-shr-put-image (data alt)
+(defun gnus-shr-put-image (data alt &optional flags)
   "Put image DATA with a string ALT.  Enable image to be deleted."
   (let ((image (shr-put-image data (propertize (or alt "*")
-                                              'gnus-image-category 'shr))))
+                                              'gnus-image-category 'shr)
+                             flags)))
     (when image
       (gnus-add-image 'shr image))))
 
@@ -6524,7 +6527,8 @@ not have a face in `gnus-article-boring-faces'."
            (ding)
          (unless (member keys nosave-in-article)
            (set-buffer gnus-article-current-summary))
-         (when (get func 'disabled)
+         (when (and (symbolp func)
+                    (get func 'disabled))
            (error "Function %s disabled" func))
          (call-interactively func)
          (setq new-sum-point (point)))
index c7443446cebdb2e8fb29c1ed0bb1f9c26cab0579..6bcba714696a51bd9baa0890cf523efde4b12d4d 100644 (file)
@@ -509,6 +509,7 @@ Lines matching `gnus-cite-attribution-suffix' and perhaps
          (if (and (equal (cdadr m) "")
                   (equal (cdar m) (cdaddr m))
                   (goto-char (caadr m))
+                  (looking-at "[ \t]*$")
                   (forward-line 1)
                   (= (point) (caaddr m)))
              (setcdr m (cdddr m))
index d0baf25d5d9682abdcab910b052a793b9659689a..115c57774481a563c1913d01c9128e73fad2a5f5 100644 (file)
@@ -71,7 +71,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
 ;;; Internal variables.
 
 (defvar gnus-demon-timers nil
-  "List of idle timers which are running.")
+  "Plist of idle timers which are running.")
 (defvar gnus-inhibit-demon nil
   "If non-nil, no daemonic function will be run.")
 
@@ -98,15 +98,32 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
     (float-time (or (current-idle-time)
                     '(0 0 0)))))
 
-(defun gnus-demon-run-callback (func &optional idle)
-  "Run FUNC if Emacs has been idle for longer than IDLE seconds."
+(defun gnus-demon-run-callback (func &optional idle time special)
+  "Run FUNC if Emacs has been idle for longer than IDLE seconds.
+If not, and a TIME is given, restart a new idle timer, so FUNC
+can be called at the next opportunity. Such a special idle run is
+marked with SPECIAL."
   (unless gnus-inhibit-demon
-    (when (or (not idle)
-              (and (eq idle t) (> (gnus-demon-idle-since) 0))
-              (<= idle (gnus-demon-idle-since)))
+    (block run-callback
+      (when (eq idle t)
+        (setq idle 0.001))
+      (cond (special
+             (setq gnus-demon-timers
+                   (plist-put gnus-demon-timers func
+                              (run-with-timer time time 'gnus-demon-run-callback
+                                              func idle time))))
+            ((and idle (> idle (gnus-demon-idle-since)))
+             (when time
+               (nnheader-cancel-timer (plist-get gnus-demon-timers func))
+               (setq gnus-demon-timers
+                     (plist-put gnus-demon-timers func
+                               (run-with-idle-timer idle nil
+                                                    'gnus-demon-run-callback
+                                                    func idle time t))))
+             (return-from run-callback)))
       (with-local-quit
-       (ignore-errors
-         (funcall func))))))
+        (ignore-errors
+          (funcall func))))))
 
 (defun gnus-demon-init ()
   "Initialize the Gnus daemon."
@@ -116,7 +133,6 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
     ;; Set up the timer.
     (let* ((func (nth 0 handler))
            (time (nth 1 handler))
-           (time-type (type-of time))
            (idle (nth 2 handler))
            ;; Compute time according with timestep.
            ;; If t, replace by 1
@@ -140,13 +156,15 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
               (run-with-idle-timer idle t 'gnus-demon-run-callback func))
              ;; (func number any)
              ;; Call every `time'
-             ((eq time-type 'integer)
-              (run-with-timer time time 'gnus-demon-run-callback func idle))
+             ((integerp time)
+              (run-with-timer time time 'gnus-demon-run-callback
+                             func idle time))
              ;; (func string any)
-             ((eq time-type 'string)
-              (run-with-timer time (* 24 60 60) 'gnus-demon-run-callback func idle)))))
+             ((stringp time)
+              (run-with-timer time (* 24 60 60) 'gnus-demon-run-callback
+                             func idle)))))
       (when timer
-        (add-to-list 'gnus-demon-timers timer)))))
+        (setq gnus-demon-timers (plist-put gnus-demon-timers func timer))))))
 
 (defun gnus-demon-time-to-step (time)
   "Find out how many steps to TIME, which is on the form \"17:43\"."
@@ -185,8 +203,8 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
 (defun gnus-demon-cancel ()
   "Cancel any Gnus daemons."
   (interactive)
-  (dolist (timer gnus-demon-timers)
-    (nnheader-cancel-timer timer))
+  (dotimes (i (/ (length gnus-demon-timers) 2))
+    (nnheader-cancel-timer (nth (1+ (* i 2)) gnus-demon-timers)))
   (setq gnus-demon-timers nil))
 
 (defun gnus-demon-add-disconnection ()
index f97d9a69eae25b60cd5163fcf1f48fcb2f5f981c..8287a6bb86e958dd07aa775a236973150f8610d2 100644 (file)
@@ -56,7 +56,7 @@
 
 (autoload 'gnus-group-make-nnir-group "nnir")
 
-(defcustom gnus-no-groups-message "No Gnus is good news"
+(defcustom gnus-no-groups-message "No news is good news"
   "*Message displayed by Gnus when no groups are available."
   :group 'gnus-start
   :type 'string)
@@ -2290,9 +2290,12 @@ Return the name of the group if selection was successful."
     ;; (gnus-read-group "Group name: ")
     (gnus-group-completing-read)
     (gnus-read-method "From method")))
-  ;; Transform the select method into a unique server.
   (unless (gnus-alive-p)
-    (gnus-no-server))
+    (nnheader-init-server-buffer)
+    ;; Necessary because of funky inlining.
+    (require 'gnus-cache)
+    (setq gnus-newsrc-hashtb (gnus-make-hashtable)))
+  ;; Transform the select method into a unique server.
   (when (stringp method)
     (setq method (gnus-server-to-method method)))
   (let ((address-slot
@@ -2312,18 +2315,22 @@ Return the name of the group if selection was successful."
      `(-1 nil (,group
               ,gnus-level-default-subscribed nil nil ,method
               ,(cons
-                (cond
-                 (quit-config
-                  (cons 'quit-config quit-config))
-                 ((assq gnus-current-window-configuration
-                        gnus-buffer-configuration)
-                  (cons 'quit-config
+                (cons 'quit-config
+                      (cond
+                       (quit-config
+                        quit-config)
+                       ((assq gnus-current-window-configuration
+                              gnus-buffer-configuration)
                         (cons gnus-summary-buffer
-                              gnus-current-window-configuration))))
+                              gnus-current-window-configuration))
+                       (t
+                        (cons (current-buffer)
+                              (current-window-configuration)))))
                 parameters)))
      gnus-newsrc-hashtb)
     (push method gnus-ephemeral-servers)
-    (set-buffer gnus-group-buffer)
+    (when (gnus-buffer-live-p gnus-group-buffer)
+      (set-buffer gnus-group-buffer))
     (unless (gnus-check-server method)
       (error "Unable to contact server: %s" (gnus-status-message method)))
     (when activate
@@ -4014,11 +4021,13 @@ entail asking the server for the groups."
        (gnus-activate-foreign-newsgroups level))
     (gnus-group-get-new-news)))
 
-(defun gnus-group-get-new-news (&optional arg)
+(defun gnus-group-get-new-news (&optional arg one-level)
   "Get newly arrived articles.
 If ARG is a number, it specifies which levels you are interested in
 re-scanning.  If ARG is non-nil and not a number, this will force
-\"hard\" re-reading of the active files from all servers."
+\"hard\" re-reading of the active files from all servers.
+If ONE-LEVEL is not nil, then re-scan only the specified level,
+otherwise all levels below ARG will be scanned too."
   (interactive "P")
   (require 'nnmail)
   (let ((gnus-inhibit-demon t)
@@ -4032,7 +4041,8 @@ re-scanning.  If ARG is non-nil and not a number, this will force
     (unless gnus-slave
       (gnus-master-read-slave-newsrc))
 
-    (gnus-get-unread-articles arg)
+    (gnus-get-unread-articles (gnus-group-default-level arg t)
+                             nil one-level)
 
     ;; If the user wants it, we scan for new groups.
     (when (eq gnus-check-new-newsgroups 'always)
index 1190d79f778d09fe9bbfd13a989a68d22658dfc1..18e56ed9b3a4cd5a313ce8c4c8316172da514be9 100644 (file)
@@ -533,15 +533,69 @@ If BUFFER, insert the article in that group."
             header
             (gnus-group-real-name group))))
 
+(defun gnus-select-group-with-message-id (group message-id)
+  "Activate and select GROUP with the given MESSAGE-ID selected.
+Returns the article number of the message.
+
+If GROUP is not already selected, the message will be the only one in
+the group's summary.
+"
+  ;; TODO: is there a way to know at this point whether the group will
+  ;; be newly-selected?  If so we could clean up the logic at the end
+  ;;
+  ;; save the new group's display parameter, if any, so we
+  ;; can replace it temporarily with zero.
+  (let ((saved-display
+         (gnus-group-get-parameter group 'display :allow-list)))
+
+    ;; Tell gnus we really don't want any articles 
+    (gnus-group-set-parameter group 'display 0)
+
+    (unwind-protect
+        (gnus-summary-read-group-1
+         group (not :show-all) :no-article (not :kill-buffer)
+         ;; The combination of no-display and this dummy list of
+         ;; articles to select somehow makes it possible to open a
+         ;; group with no articles in it.  Black magic.
+         :no-display '(-1); select-articles
+         )
+      ;; Restore the new group's display parameter
+      (gnus-group-set-parameter group 'display saved-display)))
+
+  ;; The summary buffer was suppressed by :no-display above.
+  ;; Create it now and insert the message
+  (let ((group-is-new (gnus-summary-setup-buffer group)))
+    (condition-case err
+        (let ((article-number 
+               (gnus-summary-insert-subject message-id)))
+          (unless article-number
+            (signal 'error "message-id not in group"))
+          (gnus-summary-select-article nil nil nil article-number)
+          article-number)
+      ;; Clean up the new summary and propagate the error
+      (error (when group-is-new (gnus-summary-exit))
+             (apply 'signal err)))))
+
+(defun gnus-simplify-group-name (group)
+  "Return the simplest representation of the name of GROUP.
+This is the string that Gnus uses to identify the group."
+  (gnus-group-prefixed-name
+   (gnus-group-real-name group)
+   (gnus-group-method group)))
+
 (defun gnus-warp-to-article ()
   "Warps from an article in a virtual group to the article in its
 real group. Does nothing on a real group."
   (interactive)
-  (let ((gnus-command-method
-        (gnus-find-method-for-group gnus-newsgroup-name)))
-    (when (gnus-check-backend-function
-          'warp-to-article (car gnus-command-method))
-      (funcall (gnus-get-function gnus-command-method 'warp-to-article)))))
+  (when (gnus-virtual-group-p gnus-newsgroup-name)
+    (let ((gnus-command-method
+           (gnus-find-method-for-group gnus-newsgroup-name)))
+      (or
+       (when (gnus-check-backend-function
+              'warp-to-article (car gnus-command-method))
+         (funcall (gnus-get-function gnus-command-method 'warp-to-article)))
+       (and (bound-and-true-p gnus-registry-enabled)
+            (gnus-try-warping-via-registry))))))
 
 (defun gnus-request-head (article group)
   "Request the head of ARTICLE in GROUP."
index c6d0c3213a0a7b138de396b22f5ce6df5e1afcd3..d38f36a0c776f56c02ca6a325edca222e56776af 100644 (file)
@@ -163,6 +163,22 @@ if nil, attach files as normal parts."
                 (const all :tag "Any")
                 (string :tag "Regexp")))
 
+(defcustom gnus-gcc-self-resent-messages 'no-gcc-self
+  "Like `gcc-self' group parameter, only for unmodified resent messages.
+Applied to messages sent by `gnus-summary-resend-message'.  Non-nil
+value of this variable takes precedence over any existing Gcc header.
+
+If this is `none', no Gcc copy will be made.  If this is t, messages
+resent will be Gcc'd to the current group.  If this is a string, it
+specifies a group to which resent messages will be Gcc'd.  If this is
+nil, Gcc will be done according to existing Gcc header(s), if any.
+If this is `no-gcc-self', resent messages will be Gcc'd to groups that
+existing Gcc header specifies, except for the current group."
+  :version "24.2"
+  :group 'gnus-message
+  :type '(choice (const none) (const t) string (const nil)
+                (const no-gcc-self)))
+
 (gnus-define-group-parameter
  posting-charset-alist
  :type list
@@ -297,6 +313,22 @@ If nil, the address field will always be empty after invoking
   :group 'gnus-message
   :type 'boolean)
 
+(defcustom gnus-gcc-pre-body-encode-hook nil
+  "A hook called before encoding the body of the Gcc copy of a message.
+The current buffer (when the hook is run) contains the message
+including the message header.  Changes made to the message will
+only affect the Gcc copy, but not the original message."
+  :group 'gnus-message
+  :type 'hook)
+
+(defcustom gnus-gcc-post-body-encode-hook nil
+    "A hook called after encoding the body of the Gcc copy of a message.
+The current buffer (when the hook is run) contains the message
+including the message header.  Changes made to the message will
+only affect the Gcc copy, but not the original message."
+  :group 'gnus-message
+  :type 'hook)
+
 (autoload 'gnus-message-citation-mode "gnus-cite" nil t)
 
 ;;; Internal variables.
@@ -487,8 +519,10 @@ If Gnus isn't running, a plain `message-mail' setup is used
 instead."
   (interactive)
   (if (not (gnus-alive-p))
-      (message-mail to subject other-headers continue
-                    nil yank-action send-actions return-action)
+      (progn
+       (message "Gnus not running; using plain Message mode")
+       (message-mail to subject other-headers continue
+                     nil yank-action send-actions return-action))
     (let ((buf (current-buffer))
          (gnus-newsgroup-name (or gnus-newsgroup-name ""))
          mail-buf)
@@ -810,9 +844,21 @@ post using the current select method."
   (interactive (gnus-interactive "P\ny"))
   (let ((message-post-method
         `(lambda (arg)
-           (gnus-post-method (eq ',symp 'a) ,gnus-newsgroup-name))))
+           (gnus-post-method (eq ',symp 'a) ,gnus-newsgroup-name)))
+       (user-mail-address user-mail-address))
     (dolist (article (gnus-summary-work-articles n))
       (when (gnus-summary-select-article t nil nil article)
+       ;; Pretend that we're doing a followup so that we can see what
+       ;; the From header would have ended up being.
+       (save-window-excursion
+         (save-excursion
+           (gnus-summary-followup nil)
+           (let ((from (message-fetch-field "from")))
+             (when from
+               (setq user-mail-address
+                     (car (mail-header-parse-address from)))))
+           (kill-buffer (current-buffer))))
+       ;; Now cancel the article using the From header we got.
        (when (gnus-eval-in-buffer-window gnus-original-article-buffer
                (message-cancel-news))
          (gnus-summary-mark-as-read article gnus-canceled-mark)
@@ -1271,6 +1317,44 @@ For the \"inline\" alternatives, also see the variable
            (set-buffer gnus-original-article-buffer)
            (message-forward post)))))))
 
+(defun gnus-summary-resend-message-insert-gcc ()
+  "Insert Gcc header according to `gnus-gcc-self-resent-messages'."
+  (gnus-inews-insert-gcc)
+  (let ((gcc (mapcar
+             (lambda (group)
+               (mm-encode-coding-string
+                group
+                (gnus-group-name-charset (gnus-inews-group-method group)
+                                         group)))
+             (message-unquote-tokens
+              (message-tokenize-header (mail-fetch-field "gcc" nil t)
+                                       " ,"))))
+       (self (with-current-buffer gnus-summary-buffer
+               gnus-gcc-self-resent-messages)))
+    (message-remove-header "gcc")
+    (when gcc
+      (goto-char (point-max))
+      (cond ((eq self 'none))
+           ((eq self t)
+            (insert "Gcc: \"" gnus-newsgroup-name "\"\n"))
+           ((stringp self)
+            (insert "Gcc: "
+                    (mm-encode-coding-string
+                     (if (string-match " " self)
+                         (concat "\"" self "\"")
+                       self)
+                     (gnus-group-name-charset (gnus-inews-group-method self)
+                                              self))
+                    "\n"))
+           ((null self)
+            (insert "Gcc: " (mapconcat 'identity gcc ", ") "\n"))
+           ((eq self 'no-gcc-self)
+            (when (setq gcc (delete
+                             gnus-newsgroup-name
+                             (delete (concat "\"" gnus-newsgroup-name "\"")
+                                     gcc)))
+              (insert "Gcc: " (mapconcat 'identity gcc ", ") "\n")))))))
+
 (defun gnus-summary-resend-message (address n)
   "Resend the current article to ADDRESS."
   (interactive
@@ -1284,12 +1368,24 @@ For the \"inline\" alternatives, also see the variable
            (with-current-buffer gnus-original-article-buffer
              (nnmail-fetch-field "to"))))
         current-prefix-arg))
-  (dolist (article (gnus-summary-work-articles n))
-    (gnus-summary-select-article nil nil nil article)
-    (with-current-buffer gnus-original-article-buffer
-      (let ((gnus-gcc-externalize-attachments nil))
-       (message-resend address)))
-    (gnus-summary-mark-article-as-forwarded article)))
+  (let ((message-header-setup-hook (copy-sequence message-header-setup-hook))
+       (message-sent-hook (copy-sequence message-sent-hook)))
+    ;; `gnus-summary-resend-message-insert-gcc' must run last.
+    (add-hook 'message-header-setup-hook
+             'gnus-summary-resend-message-insert-gcc t)
+    (add-hook 'message-sent-hook
+             `(lambda ()
+                (let ((rfc2047-encode-encoded-words nil))
+                  ,(if gnus-agent
+                       '(gnus-agent-possibly-do-gcc)
+                     '(gnus-inews-do-gcc)))))
+    (dolist (article (gnus-summary-work-articles n))
+      (gnus-summary-select-article nil nil nil article)
+      (with-current-buffer gnus-original-article-buffer
+       (let ((gnus-gcc-externalize-attachments nil)
+             (message-inhibit-body-encoding t))
+         (message-resend address)))
+      (gnus-summary-mark-article-as-forwarded article))))
 
 ;; From: Matthieu Moy <Matthieu.Moy@imag.fr>
 (defun gnus-summary-resend-message-edit ()
@@ -1581,7 +1677,9 @@ this is a reply."
              (nnheader-set-temp-buffer " *acc*")
              (setq message-options (with-current-buffer cur message-options))
              (insert-buffer-substring cur)
+             (run-hooks 'gnus-gcc-pre-body-encode-hook)
              (message-encode-message-body)
+             (run-hooks 'gnus-gcc-post-body-encode-hook)
              (save-restriction
                (message-narrow-to-headers)
                (let* ((mail-parse-charset message-default-charset)
@@ -1630,12 +1728,16 @@ this is a reply."
              (when (and group-art
                         ;; FIXME: Should gcc-mark-as-read work when
                         ;; Gnus is not running?
-                        (gnus-alive-p)
-                        (or gnus-gcc-mark-as-read
-                            (and
-                             (boundp 'gnus-inews-mark-gcc-as-read)
-                             (symbol-value 'gnus-inews-mark-gcc-as-read))))
-               (gnus-group-mark-article-read group (cdr group-art)))
+                        (gnus-alive-p))
+               (if (or gnus-gcc-mark-as-read
+                       (and (boundp 'gnus-inews-mark-gcc-as-read)
+                            (symbol-value 'gnus-inews-mark-gcc-as-read)))
+                   (gnus-group-mark-article-read group (cdr group-art))
+                 (with-current-buffer gnus-group-buffer
+                   (let ((gnus-group-marked (list group))
+                         (gnus-get-new-news-hook nil)
+                         (inhibit-read-only t))
+                     (gnus-group-get-new-news-this-group nil t)))))
              (setq options message-options)
              (with-current-buffer cur (setq message-options options))
              (kill-buffer (current-buffer)))))))))
index 2f347efe57924bfba9af6b5ccad15288848c9e35..3b335b335dd9397110f60c621daa1e616e0113e5 100644 (file)
@@ -75,6 +75,12 @@ Some people may want to add \"unknown\" to this list."
   :type '(repeat string)
   :group 'gnus-picon)
 
+(defcustom gnus-picon-properties '(:color-symbols (("None" . "white")))
+  "List of image properties applied to picons."
+  :type 'list
+  :version "24.2"
+  :group 'gnus-picon)
+
 (defcustom gnus-picon-style 'inline
   "How should picons be displayed.
 If `inline', the textual representation is replaced.  If `right', picons are
@@ -157,9 +163,9 @@ replacement is added."
 
 (defun gnus-picon-create-glyph (file)
   (or (cdr (assoc file gnus-picon-glyph-alist))
-      (cdar (push (cons file (gnus-create-image
-                             file nil nil
-                             :color-symbols '(("None" . "white"))))
+      (cdar (push (cons file (apply 'gnus-create-image
+                                   file nil nil
+                                   gnus-picon-properties))
                  gnus-picon-glyph-alist))))
 
 ;;; Functions that does picon transformations:
index f1618b376ef57da84407cd82c31fabf9616496b6..8aecc98ee86583a8dd863a5e3487a229d12c2efc 100644 (file)
 
 (eval-when-compile (require 'cl))
 
-(eval-when-compile
-  (when (null (ignore-errors (require 'ert)))
-    (defmacro* ert-deftest (name () &body docstring-keys-and-body))))
-
-(ignore-errors
-  (require 'ert))
 (require 'gnus)
 (require 'gnus-int)
 (require 'gnus-sum)
@@ -96,7 +90,7 @@
 (defvar gnus-adaptive-word-syntax-table)
 
 (defvar gnus-registry-dirty t
- "Boolean set to t when the registry is modified")
+ "Boolean set to t when the registry is modified.")
 
 (defgroup gnus-registry nil
   "The Gnus registry."
@@ -267,7 +261,7 @@ the Bit Bucket."
             (append gnus-registry-track-extra
                     '(mark group keyword)))
       (when (not (equal old (oref db :tracked)))
-        (gnus-message 4 "Reindexing the Gnus registry (tracked change)")
+        (gnus-message 9 "Reindexing the Gnus registry (tracked change)")
         (registry-reindex db))))
   db)
 
@@ -284,7 +278,7 @@ the Bit Bucket."
     :tracked nil)))
 
 (defvar gnus-registry-db (gnus-registry-make-db)
-  "*The article registry by Message ID.  See `registry-db'")
+  "The article registry by Message ID.  See `registry-db'.")
 
 ;; top-level registry data management
 (defun gnus-registry-remake-db (&optional forsure)
@@ -418,9 +412,9 @@ This is not required after changing `gnus-registry-cache-file'."
 ;; Function for nn{mail|imap}-split-fancy: look up all references in
 ;; the cache and if a match is found, return that group.
 (defun gnus-registry-split-fancy-with-parent ()
-  "Split this message into the same group as its parent.  The parent
-is obtained from the registry.  This function can be used as an entry
-in `nnmail-split-fancy' or `nnimap-split-fancy', for example like
+  "Split this message into the same group as its parent.
+The parent is obtained from the registry.  This function can be used as an
+entry in `nnmail-split-fancy' or `nnimap-split-fancy', for example like
 this: (: gnus-registry-split-fancy-with-parent)
 
 This function tracks ALL backends, unlike
@@ -746,7 +740,7 @@ Overrides existing keywords with FORCE set non-nil."
   (registry-lookup-secondary-value gnus-registry-db 'keyword keyword))
 
 (defun gnus-registry-register-message-ids ()
-  "Register the Message-ID of every article in the group"
+  "Register the Message-ID of every article in the group."
   (unless (gnus-parameter-registry-ignore gnus-newsgroup-name)
     (dolist (article gnus-newsgroup-articles)
       (let* ((id (gnus-registry-fetch-message-id-fast article))
@@ -761,7 +755,7 @@ Overrides existing keywords with FORCE set non-nil."
 
 ;; message field fetchers
 (defun gnus-registry-fetch-message-id-fast (article)
-  "Fetch the Message-ID quickly, using the internal gnus-data-list function"
+  "Fetch the Message-ID quickly, using the internal gnus-data-list function."
   (if (and (numberp article)
            (assoc article (gnus-data-list nil)))
       (mail-header-id (gnus-data-header (assoc article (gnus-data-list nil))))
@@ -793,7 +787,7 @@ Addresses without a name will say \"noname\"."
     nil))
 
 (defun gnus-registry-fetch-simplified-message-subject-fast (article)
-  "Fetch the Subject quickly, using the internal gnus-data-list function"
+  "Fetch the Subject quickly, using the internal gnus-data-list function."
   (if (and (numberp article)
            (assoc article (gnus-data-list nil)))
       (gnus-string-remove-all-properties
@@ -811,7 +805,7 @@ Addresses without a name will say \"noname\"."
    (or (ignore-errors (gnus-registry-fetch-header-fast "To" article)) "")))
 
 (defun gnus-registry-fetch-header-fast (article header)
-  "Fetch the HEADER quickly, using the internal gnus-data-list function"
+  "Fetch the HEADER quickly, using the internal gnus-data-list function."
   (if (and (numberp article)
            (assoc article (gnus-data-list nil)))
       (gnus-string-remove-all-properties
@@ -831,7 +825,34 @@ FUNCTION should take two parameters, a mark symbol and the cell value."
       (when cell-data
         (funcall function mark cell-data)))))
 
-;;; this is ugly code, but I don't know how to do it better
+;; FIXME: Why not merge gnus-registry--set/remove-mark and
+;; gnus-registry-set-article-mark-internal?
+(defun gnus-registry--set/remove-mark (remove mark articles)
+  "Set/remove the MARK over process-marked ARTICLES."
+  ;; If this is called and the user doesn't want the
+  ;; registry enabled, we'll ask anyhow.
+  (unless gnus-registry-install
+    (let ((gnus-registry-install 'ask))
+      (gnus-registry-install-p)))
+
+  ;; Now the user is asked if gnus-registry-install is `ask'.
+  (when (gnus-registry-install-p)
+    (gnus-registry-set-article-mark-internal
+     ;; All this just to get the mark, I must be doing it wrong.
+     mark articles remove t)
+    ;; FIXME: Why do we do the above only here and not directly inside
+    ;; gnus-registry-set-article-mark-internal?  I.e. we wouldn't we want to do
+    ;; the things below when gnus-registry-set-article-mark-internal is called
+    ;; from gnus-registry-set-article-mark or
+    ;; gnus-registry-remove-article-mark?
+    (gnus-message 9 "Applying mark %s to %d articles"
+                  mark (length articles))
+    (dolist (article articles)
+      (gnus-summary-update-article
+       article
+       (assoc article (gnus-data-list nil))))))
+
+;; This is ugly code, but I don't know how to do it better.
 (defun gnus-registry-install-shortcuts ()
   "Install the keyboard shortcuts and menus for the registry.
 Uses `gnus-registry-marks' to find what shortcuts to install."
@@ -843,69 +864,41 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
        (let ((function-format
               (format "gnus-registry-%%s-article-%s-mark" mark)))
 
-;;; The following generates these functions:
-;;; (defun gnus-registry-set-article-Important-mark (&rest articles)
-;;;   "Apply the Important mark to process-marked ARTICLES."
-;;;   (interactive (gnus-summary-work-articles current-prefix-arg))
-;;;   (gnus-registry-set-article-mark-internal 'Important articles nil t))
-;;; (defun gnus-registry-remove-article-Important-mark (&rest articles)
-;;;   "Apply the Important mark to process-marked ARTICLES."
-;;;   (interactive (gnus-summary-work-articles current-prefix-arg))
-;;;   (gnus-registry-set-article-mark-internal 'Important articles t t))
+;;;  The following generates these functions:
+;;;  (defun gnus-registry-set-article-Important-mark (&rest articles)
+;;;    "Apply the Important mark to process-marked ARTICLES."
+;;;    (interactive (gnus-summary-work-articles current-prefix-arg))
+;;;    (gnus-registry-set-article-mark-internal 'Important articles nil t))
+;;;  (defun gnus-registry-remove-article-Important-mark (&rest articles)
+;;;    "Apply the Important mark to process-marked ARTICLES."
+;;;    (interactive (gnus-summary-work-articles current-prefix-arg))
+;;;    (gnus-registry-set-article-mark-internal 'Important articles t t))
 
          (dolist (remove '(t nil))
            (let* ((variant-name (if remove "remove" "set"))
-                  (function-name (format function-format variant-name))
-                  (shortcut (format "%c" data))
-                  (shortcut (if remove (upcase shortcut) shortcut)))
-             (unintern function-name obarray)
-             (eval
-              `(defun
-                 ;; function name
-                 ,(intern function-name)
-                 ;; parameter definition
-                 (&rest articles)
-                 ;; documentation
-                 ,(format
-                   "%s the %s mark over process-marked ARTICLES."
-                   (upcase-initials variant-name)
-                   mark)
-                 ;; interactive definition
-                 (interactive
-                  (gnus-summary-work-articles current-prefix-arg))
-                 ;; actual code
-
-                 ;; if this is called and the user doesn't want the
-                 ;; registry enabled, we'll ask anyhow
-                 (unless gnus-registry-install
-                   (let ((gnus-registry-install 'ask))
-                     (gnus-registry-install-p)))
-
-                 ;; now the user is asked if gnus-registry-install is 'ask
-                 (when (gnus-registry-install-p)
-                   (gnus-registry-set-article-mark-internal
-                    ;; all this just to get the mark, I must be doing it wrong
-                    (intern ,(symbol-name mark))
-                    articles ,remove t)
-                   (gnus-message
-                    9
-                    "Applying mark %s to %d articles"
-                    ,(symbol-name mark) (length articles))
-                   (dolist (article articles)
-                     (gnus-summary-update-article
-                      article
-                      (assoc article (gnus-data-list nil)))))))
-             (push (intern function-name) keys-plist)
+                  (function-name
+                   (intern (format function-format variant-name)))
+                  (shortcut (format "%c" (if remove (upcase data) data))))
+             (defalias function-name
+               ;; If it weren't for the function's docstring, we could
+               ;; use a closure, with lexical-let :-(
+               `(lambda (&rest articles)
+                  ,(format
+                    "%s the %s mark over process-marked ARTICLES."
+                    (upcase-initials variant-name)
+                    mark)
+                  (interactive
+                   (gnus-summary-work-articles current-prefix-arg))
+                  (gnus-registry--set/remove-mark ',mark ',remove articles)))
+             (push function-name keys-plist)
              (push shortcut keys-plist)
              (push (vector (format "%s %s"
                                    (upcase-initials variant-name)
                                    (symbol-name mark))
-                           (intern function-name) t)
+                           function-name t)
                    gnus-registry-misc-menus)
-             (gnus-message
-              9
-              "Defined mark handling function %s"
-              function-name))))))
+             (gnus-message 9 "Defined mark handling function %s"
+                           function-name))))))
     (gnus-define-keys-1
      '(gnus-registry-mark-map "M" gnus-summary-mark-map)
      keys-plist)
@@ -925,7 +918,7 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
 ;; use like this:
 ;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-chars)
 (defun gnus-registry-article-marks-to-chars (headers)
-  "Show the marks for an article by the :char property"
+  "Show the marks for an article by the :char property."
   (let* ((id (mail-header-message-id headers))
          (marks (when id (gnus-registry-get-id-key id 'mark))))
     (mapconcat (lambda (mark)
@@ -938,7 +931,7 @@ Uses `gnus-registry-marks' to find what shortcuts to install."
 ;; use like this:
 ;; (defalias 'gnus-user-format-function-M 'gnus-registry-article-marks-to-names)
 (defun gnus-registry-article-marks-to-names (headers)
-  "Show the marks for an article by name"
+  "Show the marks for an article by name."
   (let* ((id (mail-header-message-id headers))
          (marks (when id (gnus-registry-get-id-key id 'mark))))
     (mapconcat (lambda (mark) (symbol-name mark)) marks ",")))
@@ -1078,88 +1071,16 @@ only the last one's marks are returned."
             (gnus-registry-set-id-key id key val))))
       (message "Import done, collected %d entries" count))))
 
-(ert-deftest gnus-registry-misc-test ()
-  (should-error (gnus-registry-extract-addresses '("" "")))
-
-  (should (equal '("Ted Zlatanov <tzz@lifelogs.com>"
-                   "noname <ed@you.me>"
-                   "noname <cyd@stupidchicken.com>"
-                   "noname <tzz@lifelogs.com>")
-                 (gnus-registry-extract-addresses
-                  (concat "Ted Zlatanov <tzz@lifelogs.com>, "
-                          "ed <ed@you.me>, " ; "ed" is not a valid name here
-                          "cyd@stupidchicken.com, "
-                          "tzz@lifelogs.com")))))
-
-(ert-deftest gnus-registry-usage-test ()
-  (let* ((n 100)
-         (tempfile (make-temp-file "gnus-registry-persist"))
-         (db (gnus-registry-make-db tempfile))
-         (gnus-registry-db db)
-         back size)
-    (message "Adding %d keys to the test Gnus registry" n)
-    (dotimes (i n)
-      (let ((id (number-to-string i)))
-        (gnus-registry-handle-action id
-                                     (if (>= 50 i) "fromgroup" nil)
-                                     "togroup"
-                                     (when (>= 70 i)
-                                       (format "subject %d" (mod i 10)))
-                                     (when (>= 80 i)
-                                       (format "sender %d" (mod i 10))))))
-    (message "Testing Gnus registry size is %d" n)
-    (should (= n (registry-size db)))
-    (message "Looking up individual keys (registry-lookup)")
-    (should (equal (loop for e
-                         in (mapcar 'cadr
-                                    (registry-lookup db '("20" "83" "72")))
-                         collect (assq 'subject e)
-                         collect (assq 'sender e)
-                         collect (assq 'group e))
-                   '((subject "subject 0") (sender "sender 0") (group "togroup")
-                     (subject) (sender) (group "togroup")
-                     (subject) (sender "sender 2") (group "togroup"))))
-
-    (message "Looking up individual keys (gnus-registry-id-key)")
-    (should (equal (gnus-registry-get-id-key "34" 'group) '("togroup")))
-    (should (equal (gnus-registry-get-id-key "34" 'subject) '("subject 4")))
-    (message "Trying to insert a duplicate key")
-    (should-error (gnus-registry-insert db "55" '()))
-    (message "Looking up individual keys (gnus-registry-get-or-make-entry)")
-    (should (gnus-registry-get-or-make-entry "22"))
-    (message "Saving the Gnus registry to %s" tempfile)
-    (should (gnus-registry-save tempfile db))
-    (setq size (nth 7 (file-attributes tempfile)))
-    (message "Saving the Gnus registry to %s: size %d" tempfile size)
-    (should (< 0 size))
-    (with-temp-buffer
-      (insert-file-contents-literally tempfile)
-      (should (looking-at (concat ";; Object "
-                                  "Gnus Registry"
-                                  "\n;; EIEIO PERSISTENT OBJECT"))))
-    (message "Reading Gnus registry back")
-    (setq back (eieio-persistent-read tempfile))
-    (should back)
-    (message "Read Gnus registry back: %d keys, expected %d==%d"
-             (registry-size back) n (registry-size db))
-    (should (= (registry-size back) n))
-    (should (= (registry-size back) (registry-size db)))
-    (delete-file tempfile)
-    (message "Pruning Gnus registry to 0 by setting :max-soft")
-    (oset db :max-soft 0)
-    (registry-prune db)
-    (should (= (registry-size db) 0)))
-  (message "Done with Gnus registry usage testing."))
-
 ;;;###autoload
 (defun gnus-registry-initialize ()
-"Initialize the Gnus registry."
+  "Initialize the Gnus registry."
   (interactive)
   (gnus-message 5 "Initializing the registry")
   (gnus-registry-install-hooks)
   (gnus-registry-install-shortcuts)
   (gnus-registry-read))
 
+;; FIXME: Why autoload this function?
 ;;;###autoload
 (defun gnus-registry-install-hooks ()
   "Install the registry hooks."
@@ -1206,6 +1127,52 @@ the user is asked first.  Returns non-nil iff the registry is enabled."
       (gnus-registry-initialize)))
   gnus-registry-enabled)
 
+;; largely based on nnir-warp-to-article
+(defun gnus-try-warping-via-registry ()
+  "Try to warp via the registry.
+This will be done via the current article's source group based on
+data stored in the registry."
+  (interactive)
+  (when (gnus-summary-article-header)
+    (let* ((message-id (mail-header-id (gnus-summary-article-header)))
+           ;; Retrieve the message's group(s) from the registry
+           (groups (gnus-registry-get-id-key message-id 'group))
+           ;; If starting from an ephemeral group, this describes
+           ;; how to restore the window configuration
+           (quit-config
+            (gnus-ephemeral-group-p gnus-newsgroup-name))
+           (seen-groups (list (gnus-group-group-name))))
+
+      (catch 'found
+        (dolist (group (mapcar 'gnus-simplify-group-name groups))
+
+          ;; skip over any groups we really don't want to warp to.
+          (unless (or (member group seen-groups)
+                      (gnus-ephemeral-group-p group) ;; any ephemeral group
+                      (memq (car (gnus-find-method-for-group group))
+                           ;; Specific methods; this list may need to expand.
+                            '(nnir)))
+
+            ;; remember that we've seen this group already
+            (push group seen-groups)
+
+            ;; first exit from any ephemeral summary buffer.
+            (when quit-config
+              (gnus-summary-exit)
+              ;; and if the ephemeral summary buffer in turn came from
+              ;; another summary buffer we have to clean that summary
+              ;; up too.
+              (when (eq (cdr quit-config) 'summary)
+                (gnus-summary-exit))
+              ;; remember that we've already done this part
+              (setq quit-config nil))
+
+            ;; Try to activate the group.  If that fails, just move
+            ;; along.  We may have more groups to work with
+            (ignore-errors
+             (gnus-select-group-with-message-id group message-id))
+            (throw 'found t)))))))
+
 ;; TODO: a few things
 
 (provide 'gnus-registry)
index e1879202ef354210b70299f7f6eecb9496125448..f40177d5c609c8b33058709093423c9cd3937ab7 100644 (file)
@@ -101,66 +101,13 @@ text properties. This is only needed on XEmacs, as Emacs does this anyway."
                            (propertize (string 8206) 'invisible t)
                          ""))
 
-(defun gnus-summary-line-format-spec ()
-  (insert gnus-tmp-unread gnus-tmp-replied
-         gnus-tmp-score-char gnus-tmp-indentation)
-  (gnus-put-text-property
-   (point)
-   (progn
-     (insert
-      (format "%c%4s: %-23s%c" gnus-tmp-opening-bracket gnus-tmp-lines
-             (let ((val
-                    (inline
-                      (gnus-summary-from-or-to-or-newsgroups
-                       gnus-tmp-header gnus-tmp-from))))
-               (if (> (length val) 23)
-                   (if (gnus-lrm-string-p val)
-                       (concat (substring val 0 23) gnus-lrm-string)
-                     (substring val 0 23))
-                 val))
-             gnus-tmp-closing-bracket))
-     (point))
-   gnus-mouse-face-prop gnus-mouse-face)
-  (insert " " gnus-tmp-subject-or-nil "\n"))
-
-(defvar gnus-summary-line-format-spec
-  (gnus-byte-code 'gnus-summary-line-format-spec))
-
-(defun gnus-summary-dummy-line-format-spec ()
-  (insert "*  ")
-  (gnus-put-text-property
-   (point)
-   (progn
-     (insert ":                                 :")
-     (point))
-   gnus-mouse-face-prop gnus-mouse-face)
-  (insert " " gnus-tmp-subject "\n"))
-
-(defvar gnus-summary-dummy-line-format-spec
-  (gnus-byte-code 'gnus-summary-dummy-line-format-spec))
-
-(defun gnus-group-line-format-spec ()
-  (insert gnus-tmp-marked-mark gnus-tmp-subscribed
-         gnus-tmp-process-marked
-         gnus-group-indentation
-         (format "%5s: " gnus-tmp-number-of-unread))
-  (gnus-put-text-property
-   (point)
-   (progn
-     (insert gnus-tmp-group "\n")
-     (1- (point)))
-   gnus-mouse-face-prop gnus-mouse-face))
-(defvar gnus-group-line-format-spec
-  (gnus-byte-code 'gnus-group-line-format-spec))
+(defvar gnus-summary-line-format-spec nil)
+(defvar gnus-summary-dummy-line-format-spec nil)
+(defvar gnus-group-line-format-spec nil)
 
 (defvar gnus-format-specs
   `((version . ,emacs-version)
-    (gnus-version . ,(gnus-continuum-version))
-    (group "%M\%S\%p\%P\%5y: %(%g%)\n" ,gnus-group-line-format-spec)
-    (summary-dummy "*  %(:                          :%) %S\n"
-                  ,gnus-summary-dummy-line-format-spec)
-    (summary "%U%R%z%I%(%[%4L: %-23,23f%]%) %s\n"
-            ,gnus-summary-line-format-spec))
+    (gnus-version . ,(gnus-continuum-version)))
   "Alist of format specs.")
 
 (defvar gnus-default-format-specs gnus-format-specs)
@@ -214,15 +161,6 @@ Return a list of updated types."
            (not (equal emacs-version
                        (cdr (assq 'version gnus-format-specs)))))
     (setq gnus-format-specs nil))
-  ;; Flush the group format spec cache if there's the grouplens stuff
-  ;; or it doesn't support decoded group names.
-  (when (memq 'group types)
-    (let* ((spec (assq 'group gnus-format-specs))
-          (sspec (gnus-prin1-to-string (nth 2 spec))))
-      (when (or (string-match " gnus-tmp-grouplens[ )]" sspec)
-               (not (string-match " gnus-tmp-decoded-group[ )]" sspec)))
-       (setq gnus-format-specs (delq spec gnus-format-specs)))))
-
   ;; Go through all the formats and see whether they need updating.
   (let (new-format entry type val updated)
     (while (setq type (pop types))
@@ -778,36 +716,6 @@ If PROPS, insert the result."
        (gnus-add-text-properties (point) (progn (eval form) (point)) props)
       (eval form))))
 
-(defun gnus-compile ()
-  "Byte-compile the user-defined format specs."
-  (interactive)
-  (require 'bytecomp)
-  (let ((entries gnus-format-specs)
-       (byte-compile-warnings '(unresolved callargs redefine))
-       entry gnus-tmp-func)
-    (save-excursion
-      (gnus-message 7 "Compiling format specs...")
-
-      (while entries
-       (setq entry (pop entries))
-       (if (memq (car entry) '(gnus-version version))
-           (setq gnus-format-specs (delq entry gnus-format-specs))
-         (let ((form (caddr entry)))
-           (when (and (listp form)
-                      ;; Under GNU Emacs, it's (byte-code ...)
-                      (not (eq 'byte-code (car form)))
-                      ;; Under XEmacs, it's (funcall #<compiled-function ...>)
-                      (not (and (eq 'funcall (car form))
-                                (byte-code-function-p (cadr form)))))
-             (defalias 'gnus-tmp-func `(lambda () ,form))
-             (byte-compile 'gnus-tmp-func)
-             (setcar (cddr entry) (gnus-byte-code 'gnus-tmp-func))))))
-
-      (push (cons 'version emacs-version) gnus-format-specs)
-      ;; Mark the .newsrc.eld file as "dirty".
-      (gnus-dribble-touch)
-      (gnus-message 7 "Compiling user specs...done"))))
-
 (defun gnus-set-format (type &optional insertable)
   (set (intern (format "gnus-%s-line-format-spec" type))
        (gnus-parse-format
index f025960c3480aa3e0800ffca54039215cf6fc7cf..15bbf01c469b60866b7b6355eb22fcd2a03ab925 100644 (file)
@@ -1504,8 +1504,6 @@ backend check whether the group actually exists."
             ;; Return the new active info.
             active)))))
 
-(defvar gnus-propagate-marks)          ; gnus-sum
-
 (defun gnus-get-unread-articles-in-group (info active &optional update)
   (when (and info active)
     ;; Allow the backend to update the info in the group.
@@ -1515,13 +1513,6 @@ backend check whether the group actually exists."
                              (gnus-info-group info)))))
       (gnus-activate-group (gnus-info-group info) nil t))
 
-    ;; Allow backends to update marks,
-    (when gnus-propagate-marks
-      (let ((method (inline (gnus-find-method-for-group
-                            (gnus-info-group info)))))
-       (when (gnus-check-backend-function 'request-marks (car method))
-         (gnus-request-marks info method))))
-
     (let* ((range (gnus-info-read info))
           (num 0))
 
@@ -1610,7 +1601,7 @@ backend check whether the group actually exists."
 
 ;; Go though `gnus-newsrc-alist' and compare with `gnus-active-hashtb'
 ;; and compute how many unread articles there are in each group.
-(defun gnus-get-unread-articles (&optional level dont-connect)
+(defun gnus-get-unread-articles (&optional level dont-connect one-level)
   (setq gnus-server-method-cache nil)
   (require 'gnus-agent)
   (let* ((newsrc (cdr gnus-newsrc-alist))
@@ -1667,7 +1658,7 @@ backend check whether the group actually exists."
        (push (setq method-group-list (list method method-type nil nil))
              type-cache))
       ;; Only add groups that need updating.
-      (if (<= (gnus-info-level info)
+      (if (funcall (if one-level #'= #'<=) (gnus-info-level info)
              (if (eq (cadr method-group-list) 'foreign)
                  foreign-level
                alevel))
@@ -2230,7 +2221,7 @@ backend check whether the group actually exists."
             (gnus-online method)
             (gnus-agent-method-p method))
        (progn
-         (gnus-agent-save-active method)
+         (gnus-agent-save-active method t)
          (gnus-active-to-gnus-format method hashtb nil real-active))
 
       (goto-char (point-min))
index 7f095e15496870509678640c86e4270c49ae0624..8c4f67504e4f4dd3f9d69fefe0c726779ee89b00 100644 (file)
@@ -451,7 +451,8 @@ current article is unread."
   :group 'gnus-summary-maneuvering
   :type 'boolean)
 
-(defcustom gnus-auto-center-summary 2
+(defcustom gnus-auto-center-summary 
+  (max (or (bound-and-true-p scroll-margin) 0) 2)
   "*If non-nil, always center the current summary buffer.
 In particular, if `vertical' do only vertical recentering.  If non-nil
 and non-`vertical', do both horizontal and vertical recentering."
@@ -1243,13 +1244,6 @@ For example: ((1 . cn-gb-2312) (2 . big5))."
   :type 'boolean
   :group 'gnus-summary-marks)
 
-(defcustom gnus-propagate-marks nil
-  "If non-nil, Gnus will store and retrieve marks from the backends.
-This means that marks will be stored both in .newsrc.eld and in
-the backend, and will slow operation down somewhat."
-  :type 'boolean
-  :group 'gnus-summary-marks)
-
 (defcustom gnus-alter-articles-to-read-function nil
   "Function to be called to alter the list of articles to be selected."
   :type '(choice (const nil) function)
@@ -1918,6 +1912,7 @@ increase the score of each group you read."
   "x" gnus-summary-limit-to-unread
   "s" gnus-summary-isearch-article
   [tab] gnus-summary-widget-forward
+  [backtab] gnus-summary-widget-backward
   "t" gnus-summary-toggle-header
   "g" gnus-summary-show-article
   "l" gnus-summary-goto-last-article
@@ -2082,6 +2077,7 @@ increase the score of each group you read."
   "g" gnus-summary-show-article
   "s" gnus-summary-isearch-article
   [tab] gnus-summary-widget-forward
+  [backtab] gnus-summary-widget-backward
   "P" gnus-summary-print-article
   "S" gnus-sticky-article
   "M" gnus-mailing-list-insinuate
@@ -3558,7 +3554,7 @@ buffer that was in action when the last article was fetched."
            (push (eval (car locals)) vlist))
          (setq locals (cdr locals)))
        (setq vlist (nreverse vlist)))
-      (with-current-buffer gnus-group-buffer
+      (with-temp-buffer
        (setq gnus-newsgroup-name name
              gnus-newsgroup-marked marked
              gnus-newsgroup-spam-marked spam
@@ -5683,7 +5679,9 @@ If SELECT-ARTICLES, only select those articles from GROUP."
       ;; Init the dependencies hash table.
       (setq gnus-newsgroup-dependencies
            (gnus-make-hashtable (length articles)))
-      (gnus-set-global-variables)
+      (if (gnus-buffer-live-p gnus-group-buffer)
+         (gnus-set-global-variables)
+       (set-default 'gnus-newsgroup-name gnus-newsgroup-name))
       ;; Retrieve the headers and read them in.
 
       (setq gnus-newsgroup-headers (gnus-fetch-headers articles))
@@ -5965,7 +5963,6 @@ If SELECT-ARTICLES, only select those articles from GROUP."
       (setq mark (car marks)
            mark-type (gnus-article-mark-to-type mark)
            var (intern (format "gnus-newsgroup-%s" (car (rassq mark types)))))
-
       ;; We set the variable according to the type of the marks list,
       ;; and then adjust the marks to a subset of the active articles.
       (cond
@@ -6074,10 +6071,6 @@ If SELECT-ARTICLES, only select those articles from GROUP."
 
        (when (and (gnus-check-backend-function
                    'request-set-mark gnus-newsgroup-name)
-                  (or gnus-propagate-marks
-                      (gnus-method-option-p
-                       (gnus-find-method-for-group gnus-newsgroup-name)
-                       'server-marks))
                   (not (gnus-article-unpropagatable-p (cdr type))))
          (let* ((old (cdr (assq (cdr type) (gnus-info-marks info))))
                 ;; Don't do anything about marks for articles we
@@ -6289,10 +6282,9 @@ The resulting hash table is returned, or nil if no Xrefs were found."
         (info (nth 2 entry))
         (active (gnus-active group))
         (set-marks
-         (or gnus-propagate-marks
-             (gnus-method-option-p
-              (gnus-find-method-for-group group)
-              'server-marks)))
+         (gnus-method-option-p
+          (gnus-find-method-for-group group)
+          'server-marks))
         range)
     (if (not entry)
        ;; Group that Gnus doesn't know exists, but still allow the
@@ -6629,9 +6621,9 @@ too, instead of trying to fetch new headers."
       ;; article if ID is a number -- so that the next `P' or `N'
       ;; command will fetch the previous (or next) article even
       ;; if the one we tried to fetch this time has been canceled.
-      (when (> number gnus-newsgroup-end)
+      (unless (and gnus-newsgroup-end (< number gnus-newsgroup-end))
        (setq gnus-newsgroup-end number))
-      (when (< number gnus-newsgroup-begin)
+      (unless (and gnus-newsgroup-begin (> number gnus-newsgroup-begin))
        (setq gnus-newsgroup-begin number))
       (setq gnus-newsgroup-unselected
            (delq number gnus-newsgroup-unselected)))
@@ -7257,7 +7249,8 @@ If FORCE (the prefix), also save the .newsrc file(s)."
       (gnus-summary-update-info))
     (gnus-close-group group)
     ;; Make sure where we were, and go to next newsgroup.
-    (set-buffer gnus-group-buffer)
+    (when (buffer-live-p (get-buffer gnus-group-buffer))
+      (set-buffer gnus-group-buffer))
     (unless quit-config
       (gnus-group-jump-to-group group))
     (gnus-run-hooks 'gnus-summary-exit-hook)
@@ -7282,7 +7275,8 @@ If FORCE (the prefix), also save the .newsrc file(s)."
          (gnus-kill-buffer buf)))
 
       (setq gnus-current-select-method gnus-select-method)
-      (set-buffer gnus-group-buffer)
+      (when (gnus-buffer-live-p gnus-group-buffer)
+       (set-buffer gnus-group-buffer))
       (if quit-config
          (gnus-handle-ephemeral-exit quit-config)
        (goto-char group-point)
@@ -7361,7 +7355,8 @@ If FORCE (the prefix), also save the .newsrc file(s)."
   "Handle movement when leaving an ephemeral group.
 The state which existed when entering the ephemeral is reset."
   (if (not (buffer-live-p (car quit-config)))
-      (gnus-configure-windows 'group 'force)
+      (when (gnus-buffer-live-p gnus-group-buffer)
+       (gnus-configure-windows 'group 'force))
     (set-buffer (car quit-config))
     (unless (eq (cdr quit-config) 'group)
       (setq gnus-current-select-method
@@ -8236,9 +8231,17 @@ If NOT-MATCHING, excluding articles that have subjects that match a regexp."
   "Limit the summary buffer to articles that have authors that match a regexp.
 If NOT-MATCHING, excluding articles that have authors that match a regexp."
   (interactive
-   (list (read-string (if current-prefix-arg
-                         "Exclude author (regexp): "
-                       "Limit to author (regexp): "))
+   (list (let* ((header (gnus-summary-article-header))
+               (default (and header (car (mail-header-parse-address
+                                          (mail-header-from header))))))
+          (read-string (concat (if current-prefix-arg
+                                   "Exclude author (regexp"
+                                 "Limit to author (regexp")
+                               (if default
+                                   (concat ", default \"" default "\"): ")
+                                 "): "))
+                       nil nil
+                       default))
         current-prefix-arg))
   (gnus-summary-limit-to-subject from "from" not-matching))
 
@@ -9270,6 +9273,17 @@ With optional ARG, move across that many fields."
   (select-window (gnus-get-buffer-window gnus-article-buffer))
   (widget-forward arg))
 
+(defun gnus-summary-widget-backward (arg)
+  "Move point to the previous field or button in the article.
+With optional ARG, move across that many fields."
+  (interactive "p")
+  (gnus-summary-select-article)
+  (gnus-configure-windows 'article)
+  (select-window (gnus-get-buffer-window gnus-article-buffer))
+  (unless (widget-at (point))
+    (goto-char (point-max)))
+  (widget-backward arg))
+
 (defun gnus-summary-isearch-article (&optional regexp-p)
   "Do incremental search forward on the current article.
 If REGEXP-P (the prefix) is non-nil, do regexp isearch."
@@ -10080,10 +10094,9 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
                   to-group 'expire (list to-article) info))
 
                (when (and to-marks
-                          (or gnus-propagate-marks
-                              (gnus-method-option-p
-                               (gnus-find-method-for-group to-group)
-                               'server-marks)))
+                          (gnus-method-option-p
+                           (gnus-find-method-for-group to-group)
+                           'server-marks))
                  (gnus-request-set-mark
                   to-group (list (list (list to-article) 'add to-marks)))))
 
@@ -12418,6 +12431,13 @@ If REVERSE, save parts that do not match TYPE."
                (not (setq header (car (gnus-get-newsgroup-headers nil t)))))
            ()                          ; Malformed head.
          (unless (gnus-summary-article-sparse-p (mail-header-number header))
+            (when (and (bound-and-true-p gnus-registry-enabled)
+                       (not (gnus-ephemeral-group-p (car where))))
+              (gnus-registry-handle-action
+               (mail-header-id header) nil
+               (gnus-group-prefixed-name (car where) gnus-override-method)
+               (mail-header-subject header)
+               (mail-header-from header)))
            (when (and (stringp id)
                       (or
                        (not (string= (gnus-group-real-name group)
@@ -12565,10 +12585,9 @@ UNREAD is a sorted list."
        (save-excursion
          (let (setmarkundo)
            ;; Propagate the read marks to the backend.
-           (when (and (or gnus-propagate-marks
-                          (gnus-method-option-p
-                           (gnus-find-method-for-group group)
-                           'server-marks))
+           (when (and (gnus-method-option-p
+                       (gnus-find-method-for-group group)
+                       'server-marks)
                       (gnus-check-backend-function 'request-set-mark group))
              (let ((del (gnus-remove-from-range (gnus-info-read info) read))
                    (add (gnus-remove-from-range read (gnus-info-read info))))
index 6efd34e1596b50d5a46d9fc52492d70a91cc4cea..15d94810c3afe93ef915f3814b0900a27e5deec7 100644 (file)
 
 ;; This is the gnus-sync.el package.
 
-;; It's due for a rewrite using gnus-after-set-mark-hook and
-;; gnus-before-update-mark-hook, and my plan is to do this once No
-;; Gnus development is done.  Until then please consider it
-;; experimental.
-
 ;; Put this in your startup file (~/.gnus.el for instance)
 
 ;; possibilities for gnus-sync-backend:
 ;; Tramp over SSH: /ssh:user@host:/path/to/filename
-;; Tramp over IMAP: /imaps:user@yourhosthere.com:/INBOX.test/filename
 ;; ...or any other file Tramp and Emacs can handle...
 
 ;; (setq gnus-sync-backend "/remote:/path.gpg" ; will use Tramp+EPA if loaded
-;;       gnus-sync-global-vars `(gnus-newsrc-last-checked-date)
-;;       gnus-sync-newsrc-groups `("nntp" "nnrss")
-;;       gnus-sync-newsrc-offsets `(2 3))
+;;       gnus-sync-global-vars '(gnus-newsrc-last-checked-date)
+;;       gnus-sync-newsrc-groups '("nntp" "nnrss"))
+;;       gnus-sync-newsrc-offsets '(2 3))
+;; against a LeSync server (beware the vampire LeSync, who knows your newsrc)
+
+;; (setq gnus-sync-backend '(lesync "http://lesync.info:5984/tzz")
+;;       gnus-sync-newsrc-groups '("nntp" "nnrss"))
+
+;; What's a LeSync server?
+
+;; 1. install CouchDB, set up a real server admin user, and create a
+;; database, e.g. "tzz" and save the URL,
+;; e.g. http://lesync.info:5984/tzz
+
+;; 2. run `M-: (gnus-sync-lesync-setup "http://lesync.info:5984/tzz" "tzzadmin" "mypassword" "mysalt" t t)'
+
+;;    (If you run it more than once, you have to remove the entry from
+;;    _users yourself.  This is intentional.  This sets up a database
+;;    admin for the "tzz" database, distinct from the server admin
+;;    user in (1) above.)
+
+;; That's it, you can start using http://lesync.info:5984/tzz in your
+;; gnus-sync-backend as a LeSync backend.  Fan fiction about the
+;; vampire LeSync is welcome.
+
+;; You may not want to expose a CouchDB install to the Big Bad
+;; Internet, especially if your love of all things furry would be thus
+;; revealed.  Make sure it's not accessible by unauthorized users and
+;; guests, at least.
+
+;; If you want to try it out, I will create a test DB for you under
+;; http://lesync.info:5984/yourfavoritedbname
 
 ;; TODO:
 
-;; - after gnus-sync-read, the message counts are wrong.  So it's not
-;;   run automatically, you have to call it with M-x gnus-sync-read
+;; - after gnus-sync-read, the message counts look wrong until you do
+;;   `g'.  So it's not run automatically, you have to call it with M-x
+;;   gnus-sync-read
 
 ;; - use gnus-after-set-mark-hook and gnus-before-update-mark-hook to
 ;;   catch the mark updates
 
+;; - repositioning of groups within topic after a LeSync sync is a
+;;   weird sort of bubble sort ("buttle" sort: the old entry ends up
+;;   at the rear of the list); you will eventually end up with the
+;;   right order after calling `gnus-sync-read' a bunch of times.
+
+;; - installing topics and groups is inefficient and annoying, lots of
+;;   prompts could be avoided
+
 ;;; Code:
 
 (eval-when-compile (require 'cl))
+(require 'json)
 (require 'gnus)
 (require 'gnus-start)
 (require 'gnus-util)
 
+(defvar gnus-topic-alist) ;; gnus-group.el
+(eval-when-compile
+  (autoload 'gnus-group-topic "gnus-topic")
+  (autoload 'gnus-topic-create-topic "gnus-topic" nil t)
+  (autoload 'gnus-topic-enter-dribble "gnus-topic"))
+
 (defgroup gnus-sync nil
   "The Gnus synchronization facility."
   :version "24.1"
   :group 'gnus)
 
-(defcustom gnus-sync-newsrc-groups `("nntp" "nnrss")
+(defcustom gnus-sync-newsrc-groups '("nntp" "nnrss")
   "List of groups to be synchronized in the gnus-newsrc-alist.
 The group names are matched, they don't have to be fully
 qualified.  Typically you would choose all of these.  That's the
@@ -70,20 +109,12 @@ this setting is harmless until the user chooses a sync backend."
   :group 'gnus-sync
   :type '(repeat regexp))
 
-(defcustom gnus-sync-newsrc-offsets '(2 3)
-  "List of per-group data to be synchronized."
-  :group 'gnus-sync
-  :type '(set (const :tag "Read ranges" 2)
-              (const :tag "Marks" 3)))
-
 (defcustom gnus-sync-global-vars nil
   "List of global variables to be synchronized.
 You may want to sync `gnus-newsrc-last-checked-date' but pretty
 much any symbol is fair game.  You could additionally sync
 `gnus-newsrc-alist', `gnus-server-alist', `gnus-topic-topology',
-and `gnus-topic-alist' to cover all the variables in
-newsrc.eld (except for `gnus-format-specs' which should not be
-synchronized, I believe).  Also see `gnus-variable-list'."
+and `gnus-topic-alist'.  Also see `gnus-variable-list'."
   :group 'gnus-sync
   :type '(repeat (choice (variable :tag "A known variable")
                          (symbol :tag "Any symbol"))))
@@ -92,30 +123,625 @@ synchronized, I believe).  Also see `gnus-variable-list'."
   "The synchronization backend."
   :group 'gnus-sync
   :type '(radio (const :format "None" nil)
+                (list :tag "Sync server"
+                      (const :format "LeSync Server API" lesync)
+                      (string :tag "URL of a CouchDB database for API access"))
                 (string :tag "Sync to a file")))
 
 (defvar gnus-sync-newsrc-loader nil
   "Carrier for newsrc data")
 
-(defun gnus-sync-save ()
-"Save the Gnus sync data to the backend."
-  (interactive)
+(defcustom gnus-sync-lesync-name (system-name)
+  "The LeSync name for this machine."
+  :group 'gnus-sync
+  :type 'string)
+
+(defcustom  gnus-sync-lesync-install-topics 'ask
+  "Should LeSync install the recorded topics?"
+  :group 'gnus-sync
+  :type '(choice (const :tag "Never Install" nil)
+                 (const :tag "Always Install" t)
+                 (const :tag "Ask Me Once" ask)))
+
+(defvar gnus-sync-lesync-props-hash (make-hash-table :test 'equal)
+  "LeSync props, keyed by group name")
+
+(defvar gnus-sync-lesync-design-prefix "/_design/lesync"
+  "The LeSync design prefix for CouchDB")
+
+(defvar gnus-sync-lesync-security-object "/_security"
+  "The LeSync security object for CouchDB")
+
+(defun gnus-sync-lesync-parse ()
+  "Parse the result of a LeSync request."
+  (goto-char (point-min))
+  (condition-case nil
+      (when (search-forward-regexp "^$" nil t)
+        (json-read))
+    (error
+     (gnus-message
+      1
+      "gnus-sync-lesync-parse: Could not read the LeSync response!")
+     nil)))
+
+(defun gnus-sync-lesync-call (url method headers &optional kvdata)
+  "Make an access request to URL using KVDATA and METHOD.
+KVDATA must be an alist."
+  (flet ((json-alist-p (list) (gnus-sync-json-alist-p list))) ; temp patch
+    (let ((url-request-method method)
+          (url-request-extra-headers headers)
+          (url-request-data (if kvdata (json-encode kvdata) nil)))
+      (with-current-buffer (url-retrieve-synchronously url)
+        (let ((data (gnus-sync-lesync-parse)))
+          (gnus-message 12 "gnus-sync-lesync-call: %s URL %s sent %S got %S"
+                        method url `((headers . ,headers) (data ,kvdata)) data)
+          (kill-buffer (current-buffer))
+          data)))))
+
+(defun gnus-sync-lesync-PUT (url headers &optional data)
+  (gnus-sync-lesync-call url "PUT" headers data))
+
+(defun gnus-sync-lesync-POST (url headers &optional data)
+  (gnus-sync-lesync-call url "POST" headers data))
+
+(defun gnus-sync-lesync-GET (url headers &optional data)
+  (gnus-sync-lesync-call url "GET" headers data))
+
+(defun gnus-sync-lesync-DELETE (url headers &optional data)
+  (gnus-sync-lesync-call url "DELETE" headers data))
+
+;; this is not necessary with newer versions of json.el but 1.2 or older
+;; (which are in Emacs 24.1 and earlier) need it
+(defun gnus-sync-json-alist-p (list)
+  "Non-null if and only if LIST is an alist."
+  (while (consp list)
+    (setq list (if (consp (car list))
+                   (cdr list)
+                 'not-alist)))
+  (null list))
+
+;; this is not necessary with newer versions of json.el but 1.2 or older
+;; (which are in Emacs 24.1 and earlier) need it
+(defun gnus-sync-json-plist-p (list)
+  "Non-null if and only if LIST is a plist."
+  (while (consp list)
+    (setq list (if (and (keywordp (car list))
+                        (consp (cdr list)))
+                   (cddr list)
+                 'not-plist)))
+  (null list))
+
+; (gnus-sync-lesync-setup "http://lesync.info:5984/tzz" "tzzadmin" "mypassword" "mysalt" t t)
+; (gnus-sync-lesync-setup "http://lesync.info:5984/tzz")
+
+(defun gnus-sync-lesync-setup (url &optional user password salt reader admin)
+  (interactive "sEnter URL to set up: ")
+  "Set up the LeSync database at URL.
+Install USER as a READER and/or an ADMIN in the security object
+under \"_security\", and in the CouchDB \"_users\" table using
+PASSWORD and SALT.  Only one USER is thus supported for now.
+When SALT is nil, a random one will be generated using `random'."
+  (let* ((design-url (concat url gnus-sync-lesync-design-prefix))
+         (security-object (concat url "/_security"))
+         (user-record `((names . [,user]) (roles . [])))
+         (couch-user-name (format "org.couchdb.user:%s" user))
+         (salt (or salt (sha1 (format "%s" (random t)))))
+         (couch-user-record
+          `((_id . ,couch-user-name)
+            (type . user)
+            (name . ,(format "%s" user))
+            (roles . [])
+            (salt . ,salt)
+            (password_sha . ,(when password
+                               (sha1
+                                (format "%s%s" password salt))))))
+         (rev (progn
+                (gnus-sync-lesync-find-prop 'rev design-url design-url)
+                (gnus-sync-lesync-get-prop 'rev design-url)))
+         (latest-func "function(head,req)
+{
+  var tosend = [];
+  var row;
+  var ftime = (req.query['ftime'] || 0);
+  while (row = getRow())
+  {
+    if (row.value['float-time'] > ftime)
+    {
+      var s = row.value['_id'];
+      if (s) tosend.push('\"'+s.replace('\"', '\\\"')+'\"');
+    }
+  }
+  send('['+tosend.join(',') + ']');
+}")
+;; <key>read</key>
+;; <dict>
+;;   <key>de.alt.fan.ipod</key>
+;;   <array>
+;;       <integer>1</integer>
+;;       <integer>2</integer>
+;;       <dict>
+;;           <key>start</key>
+;;           <integer>100</integer>
+;;           <key>length</key>
+;;           <integer>100</integer>
+;;       </dict>
+;;   </array>
+;; </dict>
+         (xmlplistread-func "function(head, req) {
+  var row;
+  start({ 'headers': { 'Content-Type': 'text/xml' } });
+
+  send('<dict>');
+  send('<key>read</key>');
+  send('<dict>');
+  while(row = getRow())
+  {
+    var read = row.value.read;
+    if (read && read[0] && read[0] == 'invlist')
+    {
+      send('<key>'+row.key+'</key>');
+      //send('<invlist>'+read+'</invlist>');
+      send('<array>');
+
+      var from = 0;
+      var flip = false;
+
+      for (var i = 1; i < read.length && read[i]; i++)
+      {
+        var cur = read[i];
+        if (flip)
+        {
+          if (from == cur-1)
+          {
+            send('<integer>'+read[i]+'</integer>');
+          }
+          else
+          {
+            send('<dict>');
+            send('<key>start</key>');
+            send('<integer>'+from+'</integer>');
+            send('<key>end</key>');
+            send('<integer>'+(cur-1)+'</integer>');
+            send('</dict>');
+          }
+
+        }
+        flip = ! flip;
+        from = cur;
+      }
+      send('</array>');
+    }
+  }
+
+  send('</dict>');
+  send('</dict>');
+}
+")
+         (subs-func "function(doc){emit([doc._id, doc.source], doc._rev);}")
+         (revs-func "function(doc){emit(doc._id, doc._rev);}")
+         (bytimesubs-func "function(doc)
+{emit([(doc['float-time']||0), doc._id], doc._rev);}")
+         (bytime-func "function(doc)
+{emit([(doc['float-time']||0), doc._id], doc);}")
+         (groups-func "function(doc){emit(doc._id, doc);}"))
+    (and (if user
+             (and (assq 'ok (gnus-sync-lesync-PUT
+                             security-object
+                             nil
+                             (append (and reader
+                                          (list `(readers . ,user-record)))
+                                     (and admin
+                                          (list `(admins . ,user-record))))))
+                  (assq 'ok (gnus-sync-lesync-PUT
+                             (concat (file-name-directory url)
+                                     "_users/"
+                                     couch-user-name)
+                             nil
+                             couch-user-record)))
+           t)
+         (assq 'ok (gnus-sync-lesync-PUT
+                    design-url
+                    nil
+                    `(,@(when rev (list (cons '_rev rev)))
+                      (lists . ((latest . ,latest-func)
+                                (xmlplistread . ,xmlplistread-func)))
+                      (views . ((subs . ((map . ,subs-func)))
+                                (revs . ((map . ,revs-func)))
+                                (bytimesubs . ((map . ,bytimesubs-func)))
+                                (bytime . ((map . ,bytime-func)))
+                                (groups . ((map . ,groups-func)))))))))))
+
+(defun gnus-sync-lesync-find-prop (prop url key)
+  "Retrieve a PROPerty of a document KEY at URL.
+Calls `gnus-sync-lesync-set-prop'.
+For the 'rev PROP, uses '_rev against the document."
+  (gnus-sync-lesync-set-prop
+   prop key (cdr (assq (if (eq prop 'rev) '_rev prop)
+                       (gnus-sync-lesync-GET url nil)))))
+
+(defun gnus-sync-lesync-set-prop (prop key val)
+  "Update the PROPerty of document KEY at URL to VAL.
+Updates `gnus-sync-lesync-props-hash'."
+    (puthash (format "%s.%s" key prop) val gnus-sync-lesync-props-hash))
+
+(defun gnus-sync-lesync-get-prop (prop key)
+  "Get the PROPerty of KEY from `gnus-sync-lesync-props-hash'."
+    (gethash (format "%s.%s" key prop) gnus-sync-lesync-props-hash))
+
+(defun gnus-sync-deep-print (data)
+  (let* ((print-quoted t)
+         (print-readably t)
+         (print-escape-multibyte nil)
+         (print-escape-nonascii t)
+         (print-length nil)
+         (print-level nil)
+         (print-circle nil)
+         (print-escape-newlines t))
+    (format "%S" data)))
+
+(defun gnus-sync-newsrc-loader-builder (&optional only-modified)
+  (let* ((entries (cdr gnus-newsrc-alist))
+         entry name ret)
+    (while entries
+      (setq entry (pop entries)
+            name (car entry))
+      (when (gnus-grep-in-list name gnus-sync-newsrc-groups)
+        (if only-modified
+            (when (not (equal (gnus-sync-deep-print entry)
+                              (gnus-sync-lesync-get-prop 'checksum name)))
+              (gnus-message 9 "%s: add %s, it's modified"
+                            "gnus-sync-newsrc-loader-builder" name)
+              (push entry ret))
+          (push entry ret))))
+    ret))
+
+; (json-encode (gnus-sync-range2invlist '((1 . 47137) (47139 . 47714) 48129 48211 49231 49281 49342 49473 49475 49502)))
+(defun gnus-sync-range2invlist (ranges)
+  (append '(invlist)
+          (let ((ranges (delq nil ranges))
+                ret range from to)
+            (while ranges
+              (setq range (pop ranges))
+              (if (atom range)
+                  (setq from range
+                        to range)
+                (setq from (car range)
+                      to (cdr range)))
+              (push from ret)
+              (push (1+ to) ret))
+            (reverse ret))))
+
+; (let* ((d '((1 . 47137) (47139 . 47714) 48129 48211 49231 49281 49342 49473 49475 49502)) (j (format "%S" (gnus-sync-invlist2range (gnus-sync-range2invlist d))))) (or (equal (format "%S" d) j) j))
+(defun gnus-sync-invlist2range (inv)
+  (setq inv (append inv nil))
+  (if (equal (format "%s" (car inv)) "invlist")
+      (let ((i (cdr inv))
+            (start 0)
+            ret cur top flip)
+        (while i
+          (setq cur (pop i))
+          (when flip
+            (setq top (1- cur))
+            (if (= start top)
+                (push start ret)
+              (push (cons start top) ret)))
+          (setq flip (not flip))
+          (setq start cur))
+        (reverse ret))
+    inv))
+
+(defun gnus-sync-position (search list &optional test)
+  "Find the position of SEARCH in LIST using TEST, defaulting to `eq'."
+  (let ((pos 0)
+        (test (or test 'eq)))
+    (while (and list (not (funcall test (car list) search)))
+      (pop list)
+      (incf pos))
+    (if (funcall test (car list) search) pos nil)))
+
+(defun gnus-sync-topic-group-position (group topic-name)
+  (gnus-sync-position
+   group (cdr (assoc topic-name gnus-topic-alist)) 'equal))
+
+(defun gnus-sync-fix-topic-group-position (group topic-name position)
+  (unless (equal position (gnus-sync-topic-group-position group topic-name))
+    (let* ((loc "gnus-sync-fix-topic-group-position")
+           (groups (delete group (cdr (assoc topic-name gnus-topic-alist))))
+           (position (min position (1- (length groups))))
+           (old (nth position groups)))
+      (when (and old (not (equal old group)))
+        (setf (nth position groups) group)
+        (setcdr (assoc topic-name gnus-topic-alist)
+                (append groups (list old)))
+        (gnus-message 9 "%s: %s moved to %d, swap with %s"
+                      loc group position old)))))
+
+(defun gnus-sync-lesync-pre-save-group-entry (url nentry &rest passed-props)
+  (let* ((loc "gnus-sync-lesync-save-group-entry")
+         (k (car nentry))
+         (revision (gnus-sync-lesync-get-prop 'rev k))
+         (sname gnus-sync-lesync-name)
+         (topic (gnus-group-topic k))
+         (topic-offset (gnus-sync-topic-group-position k topic))
+         (sources (gnus-sync-lesync-get-prop 'source k)))
+    ;; set the revision so we don't have a conflict
+    `(,@(when revision
+          (list (cons '_rev revision)))
+      (_id . ,k)
+      ;; the time we saved
+      ,@passed-props
+      ;; add our name to the sources list for this key
+      (source ,@(if (member gnus-sync-lesync-name sources)
+                    sources
+                  (cons gnus-sync-lesync-name sources)))
+      ,(cons 'level (nth 1 nentry))
+      ,@(if topic (list (cons 'topic topic)) nil)
+      ,@(if topic-offset (list (cons 'topic-offset topic-offset)) nil)
+      ;; the read marks
+      ,(cons 'read (gnus-sync-range2invlist (nth 2 nentry)))
+      ;; the other marks
+      ,@(delq nil (mapcar (lambda (mark-entry)
+                            (gnus-message 12 "%s: prep param %s in %s"
+                                          loc
+                                          (car mark-entry)
+                                          (nth 3 nentry))
+                            (if (listp (cdr mark-entry))
+                                (cons (car mark-entry)
+                                      (gnus-sync-range2invlist
+                                       (cdr mark-entry)))
+                              (progn    ; else this is not a list
+                                (gnus-message 9 "%s: non-list param %s in %s"
+                                              loc
+                                              (car mark-entry)
+                                              (nth 3 nentry))
+                                nil)))
+                          (nth 3 nentry))))))
+
+(defun gnus-sync-lesync-post-save-group-entry (url entry)
+  (let* ((loc "gnus-sync-lesync-post-save-group-entry")
+         (k (cdr (assq 'id entry))))
+    (cond
+     ;; success!
+     ((and (assq 'rev entry) (assq 'id entry))
+      (progn
+        (gnus-sync-lesync-set-prop 'rev k (cdr (assq 'rev entry)))
+        (gnus-sync-lesync-set-prop 'checksum
+                                   k
+                                   (gnus-sync-deep-print
+                                    (assoc k gnus-newsrc-alist)))
+        (gnus-message 9 "%s: successfully synced %s to %s"
+                      loc k url)))
+     ;; specifically check for document conflicts
+     ((equal "conflict" (format "%s" (cdr-safe (assq 'error entry))))
+      (gnus-error
+       1
+       "%s: use `%s' to resolve the conflict synchronizing %s to %s: %s"
+       loc "gnus-sync-read" k url (cdr (assq 'reason entry))))
+     ;; generic errors
+     ((assq 'error entry)
+      (gnus-error 1 "%s: got error while synchronizing %s to %s: %s"
+                  loc k url (cdr (assq 'reason entry))))
+
+     (t
+      (gnus-message 2 "%s: unknown sync status after %s to %s: %S"
+                    loc k url entry)))
+    (assoc 'error entry)))
+
+(defun gnus-sync-lesync-groups-builder (url)
+  (let ((u (concat url gnus-sync-lesync-design-prefix "/_view/groups")))
+    (cdr (assq 'rows (gnus-sync-lesync-GET u nil)))))
+
+(defun gnus-sync-subscribe-group (name)
+  "Subscribe to group NAME.  Returns NAME on success, nil otherwise."
+  (gnus-subscribe-newsgroup name))
+
+(defun gnus-sync-lesync-read-group-entry (url name entry &rest passed-props)
+  "Read ENTRY information for NAME.  Returns NAME if successful.
+Skips entries whose sources don't contain
+`gnus-sync-lesync-name'.  When the alist PASSED-PROPS has a
+`subscribe-all' element that evaluates to true, we attempt to
+subscribe to unknown groups.  The user is also allowed to delete
+unwanted groups via the LeSync URL."
+  (let* ((loc "gnus-sync-lesync-read-group-entry")
+         (entry (gnus-sync-lesync-normalize-group-entry entry passed-props))
+         (subscribe-all (cdr (assq 'subscribe-all passed-props)))
+         (sources (cdr (assq 'source entry)))
+         (rev (cdr (assq 'rev entry)))
+         (in-sources (member gnus-sync-lesync-name sources))
+         (known (assoc name gnus-newsrc-alist))
+         cell)
+    (unless known
+      (if (and subscribe-all
+               (y-or-n-p (format "Subscribe to group %s?" name)))
+          (setq known (gnus-sync-subscribe-group name)
+                in-sources t)
+        ;; else...
+        (when (y-or-n-p (format "Delete group %s from server?" name))
+          (if (equal name (gnus-sync-lesync-delete-group url name))
+              (gnus-message 1 "%s: removed group %s from server %s"
+                            loc name url)
+            (gnus-error 1 "%s: could not remove group %s from server %s"
+                        loc name url)))))
+    (when known
+      (unless in-sources
+        (setq in-sources
+              (y-or-n-p
+               (format "Read group %s even though %s is not in sources %S?"
+                       name gnus-sync-lesync-name (or sources ""))))))
+    (when rev
+      (gnus-sync-lesync-set-prop 'rev name rev))
+
+    ;; if the source matches AND we have this group
+    (if (and known in-sources)
+        (progn
+          (gnus-message 10 "%s: reading LeSync entry %s, sources %S"
+                        loc name sources)
+          (while entry
+            (setq cell (pop entry))
+            (let ((k (car cell))
+                  (val (cdr cell)))
+              (gnus-sync-lesync-set-prop k name val)))
+          name)
+      ;; else...
+      (unless known
+        (gnus-message 5 "%s: ignoring entry %s, it wasn't subscribed.  %s"
+                        loc name "Call `gnus-sync-read' with C-u to force it."))
+      (unless in-sources
+        (gnus-message 5 "%s: ignoring entry %s, %s not in sources %S"
+                      loc name gnus-sync-lesync-name (or sources "")))
+      nil)))
+
+(defun gnus-sync-lesync-install-group-entry (name)
+  (let* ((master (assoc name gnus-newsrc-alist))
+         (old-topic-name (gnus-group-topic name))
+         (old-topic (assoc old-topic-name gnus-topic-alist))
+         (target-topic-name (gnus-sync-lesync-get-prop 'topic name))
+         (target-topic-offset (gnus-sync-lesync-get-prop 'topic-offset name))
+         (target-topic (assoc target-topic-name gnus-topic-alist))
+         (loc "gnus-sync-lesync-install-group-entry"))
+    (if master
+        (progn
+          (when (eq 'ask gnus-sync-lesync-install-topics)
+            (setq gnus-sync-lesync-install-topics
+                  (y-or-n-p "Install topics from LeSync?")))
+          (when (and (eq t gnus-sync-lesync-install-topics)
+                     target-topic-name)
+            (if (equal old-topic-name target-topic-name)
+                (gnus-message 12 "%s: %s is already in topic %s"
+                              loc name target-topic-name)
+              ;; see `gnus-topic-move-group'
+              (when (and old-topic target-topic)
+                (setcdr old-topic (gnus-delete-first name (cdr old-topic)))
+                (gnus-message 5 "%s: removing %s from topic %s"
+                              loc name old-topic-name))
+              (unless target-topic
+                (when (y-or-n-p (format "Create missing topic %s?"
+                                        target-topic-name))
+                  (gnus-topic-create-topic target-topic-name nil)
+                  (setq target-topic (assoc target-topic-name
+                                            gnus-topic-alist))))
+              (if target-topic
+                  (prog1
+                      (nconc target-topic (list name))
+                    (gnus-message 5 "%s: adding %s to topic %s"
+                                  loc name (car target-topic))
+                    (gnus-topic-enter-dribble))
+                (gnus-error 2 "%s: LeSync group %s can't go in missing topic %s"
+                            loc name target-topic-name)))
+            (when (and target-topic-offset target-topic)
+              (gnus-sync-fix-topic-group-position
+               name target-topic-name target-topic-offset)))
+          ;; install the subscription level
+          (when (gnus-sync-lesync-get-prop 'level name)
+            (setf (nth 1 master) (gnus-sync-lesync-get-prop 'level name)))
+          ;; install the read and other marks
+          (setf (nth 2 master) (gnus-sync-lesync-get-prop 'read name))
+          (setf (nth 3 master) (gnus-sync-lesync-get-prop 'marks name))
+          (gnus-sync-lesync-set-prop 'checksum
+                                     name
+                                     (gnus-sync-deep-print master))
+          nil)
+      (gnus-error 1 "%s: invalid LeSync group %s" loc name)
+      'invalid-name)))
+
+; (gnus-sync-lesync-delete-group (cdr gnus-sync-backend) "nntp+Gmane:gwene.org.slashdot")
+
+(defun gnus-sync-lesync-delete-group (url name)
+  "Returns NAME if successful deleting it from URL, an error otherwise."
+  (interactive "sEnter URL to set up: \rsEnter group name: ")
+  (let* ((u (concat (cadr gnus-sync-backend) "/" (url-hexify-string name)))
+         (del (gnus-sync-lesync-DELETE
+               u
+               `(,@(when (gnus-sync-lesync-get-prop 'rev name)
+                     (list (cons "If-Match"
+                                 (gnus-sync-lesync-get-prop 'rev name))))))))
+    (or (cdr (assq 'id del)) del)))
+
+;;; (gnus-sync-lesync-normalize-group-entry '((subscribe . ["invlist"]) (read . ["invlist"]) (topic-offset . 20) (topic . "news") (level . 6) (source . ["a" "b"]) (float-time . 1319671237.099285) (_rev . "10-edf5107f41e5e6f7f6629d1c0ee172f7") (_id . "nntp+news.net:alt.movies")) '((read-time 1319672156.486414) (subscribe-all nil)))
+
+(defun gnus-sync-lesync-normalize-group-entry (entry &optional passed-props)
+  (let (ret
+        marks
+        cell)
+    (setq entry (append passed-props entry))
+    (while (setq cell (pop entry))
+      (let ((k (car cell))
+            (val (cdr cell)))
+        (cond
+         ((eq k 'read)
+          (push (cons k (gnus-sync-invlist2range val)) ret))
+         ;; we ignore these parameters
+         ((member k '(_id subscribe-all _deleted_conflicts))
+          nil)
+         ((eq k '_rev)
+          (push (cons 'rev val) ret))
+         ((eq k 'source)
+          (push (cons 'source (append val nil)) ret))
+         ((or (eq k 'float-time)
+              (eq k 'level)
+              (eq k 'topic)
+              (eq k 'topic-offset)
+              (eq k 'read-time))
+          (push (cons k val) ret))
+;;; "How often have I said to you that when you have eliminated the
+;;; impossible, whatever remains, however improbable, must be the
+;;; truth?" --Sherlock Holmes
+          ;; everything remaining must be a mark
+          (t (push (cons k (gnus-sync-invlist2range val)) marks)))))
+    (cons (cons 'marks marks) ret)))
+
+(defun gnus-sync-save (&optional force)
+"Save the Gnus sync data to the backend.
+With a prefix, FORCE is set and all groups will be saved."
+  (interactive "P")
   (cond
+   ((and (listp gnus-sync-backend)
+         (eq (nth 0 gnus-sync-backend) 'lesync)
+         (stringp (nth 1 gnus-sync-backend)))
+
+    ;; refresh the revisions if we're forcing the save
+    (when force
+      (mapc (lambda (entry)
+              (when (and (assq 'key entry)
+                         (assq 'value entry))
+                (gnus-sync-lesync-set-prop
+                 'rev
+                 (cdr (assq 'key entry))
+                 (cdr (assq 'value entry)))))
+            ;; the revs view is key = name, value = rev
+            (cdr (assq 'rows (gnus-sync-lesync-GET
+                              (concat (nth 1 gnus-sync-backend)
+                                      gnus-sync-lesync-design-prefix
+                                      "/_view/revs")
+                              nil)))))
+
+    (let* ((ftime (float-time))
+           (url (nth 1 gnus-sync-backend))
+           (entries
+            (mapcar (lambda (entry)
+                      (gnus-sync-lesync-pre-save-group-entry
+                       (cadr gnus-sync-backend)
+                       entry
+                       (cons 'float-time ftime)))
+                    (gnus-sync-newsrc-loader-builder (not force))))
+           ;; when there are no entries, there's nothing to save
+           (sync (if entries
+                     (gnus-sync-lesync-POST
+                      (concat url "/_bulk_docs")
+                      '(("Content-Type" . "application/json"))
+                      `((docs . ,(vconcat entries nil))))
+                   (gnus-message
+                    2 "gnus-sync-save: nothing to save to the LeSync backend")
+                   nil)))
+      (mapcar (lambda (e) (gnus-sync-lesync-post-save-group-entry url e))
+              sync)))
    ((stringp gnus-sync-backend)
-    (gnus-message 7 "gnus-sync: saving to backend %s" gnus-sync-backend)
+    (gnus-message 7 "gnus-sync-save: saving to backend %s" gnus-sync-backend)
     ;; populate gnus-sync-newsrc-loader from all but the first dummy
     ;; entry in gnus-newsrc-alist whose group matches any of the
     ;; gnus-sync-newsrc-groups
     ;; TODO: keep the old contents for groups we don't have!
-    (let ((gnus-sync-newsrc-loader
-           (loop for entry in (cdr gnus-newsrc-alist)
-                 when (gnus-grep-in-list
-                       (car entry)     ;the group name
-                       gnus-sync-newsrc-groups)
-                 collect (cons (car entry)
-                               (mapcar (lambda (offset)
-                                         (cons offset (nth offset entry)))
-                                       gnus-sync-newsrc-offsets)))))
+    (let ((gnus-sync-newsrc-loader (gnus-sync-newsrc-loader-builder)))
       (with-temp-file gnus-sync-backend
         (progn
           (let ((coding-system-for-write gnus-ding-file-coding-system)
@@ -123,6 +749,7 @@ synchronized, I believe).  Also see `gnus-variable-list'."
             (princ (format ";; -*- mode:emacs-lisp; coding: %s; -*-\n"
                            gnus-ding-file-coding-system))
             (princ ";; Gnus sync data v. 0.0.1\n")
+            ;; TODO: replace with `gnus-sync-deep-print'
             (let* ((print-quoted t)
                    (print-readably t)
                    (print-escape-multibyte nil)
@@ -147,14 +774,14 @@ synchronized, I believe).  Also see `gnus-variable-list'."
                   (princ (symbol-name variable)))))
             (gnus-message
              7
-             "gnus-sync: stored variables %s and %d groups in %s"
+             "gnus-sync-save: stored variables %s and %d groups in %s"
              gnus-sync-global-vars
              (length gnus-sync-newsrc-loader)
              gnus-sync-backend)
 
             ;; Idea from Dan Christensen <jdc@chow.mat.jhu.edu>
             ;; Save the .eld file with extra line breaks.
-            (gnus-message 8 "gnus-sync: adding whitespace to %s"
+            (gnus-message 8 "gnus-sync-save: adding whitespace to %s"
                           gnus-sync-backend)
             (save-excursion
               (goto-char (point-min))
@@ -166,49 +793,74 @@ synchronized, I believe).  Also see `gnus-variable-list'."
     ;; the pass-through case: gnus-sync-backend is not a known choice
     (nil)))
 
-(defun gnus-sync-read ()
-"Load the Gnus sync data from the backend."
-  (interactive)
+(defun gnus-sync-read (&optional subscribe-all)
+  "Load the Gnus sync data from the backend.
+With a prefix, SUBSCRIBE-ALL is set and unknown groups will be subscribed."
+  (interactive "P")
   (when gnus-sync-backend
-    (gnus-message 7 "gnus-sync: loading from backend %s" gnus-sync-backend)
-    (cond ((stringp gnus-sync-backend)
-           ;; read data here...
-           (if (or debug-on-error debug-on-quit)
-               (load gnus-sync-backend nil t)
-             (condition-case var
-                 (load gnus-sync-backend nil t)
-               (error
-                (error "Error in %s: %s" gnus-sync-backend (cadr var)))))
-           (let ((valid-count 0)
-                 invalid-groups)
-             (dolist (node gnus-sync-newsrc-loader)
-               (if (gnus-gethash (car node) gnus-newsrc-hashtb)
-                   (progn
-                     (incf valid-count)
-                     (loop for store in (cdr node)
-                           do (setf (nth (car store)
-                                         (assoc (car node) gnus-newsrc-alist))
-                              (cdr store))))
-                 (push (car node) invalid-groups)))
-            (gnus-message
-             7
-             "gnus-sync: loaded %d groups (out of %d) from %s"
-             valid-count (length gnus-sync-newsrc-loader)
-             gnus-sync-backend)
-            (when invalid-groups
-              (gnus-message
-               7
-               "gnus-sync: skipped %d groups (out of %d) from %s"
-               (length invalid-groups)
-               (length gnus-sync-newsrc-loader)
-               gnus-sync-backend)
-              (gnus-message 9 "gnus-sync: skipped groups: %s"
-                            (mapconcat 'identity invalid-groups ", ")))))
-          (nil))
-    ;; make the hashtable again because the newsrc-alist may have been modified
-    (when gnus-sync-newsrc-offsets
-      (gnus-message 9 "gnus-sync: remaking the newsrc hashtable")
-      (gnus-make-hashtable-from-newsrc-alist))))
+    (gnus-message 7 "gnus-sync-read: loading from backend %s" gnus-sync-backend)
+    (cond
+     ((and (listp gnus-sync-backend)
+           (eq (nth 0 gnus-sync-backend) 'lesync)
+           (stringp (nth 1 gnus-sync-backend)))
+      (let ((errored nil)
+            name ftime)
+        (mapc (lambda (entry)
+               (setq name (cdr (assq 'id entry)))
+               ;; set ftime the FIRST time through this loop, that
+               ;; way it reflects the time we FINISHED reading
+               (unless ftime (setq ftime (float-time)))
+
+               (unless errored
+                 (setq errored
+                       (when (equal name
+                                    (gnus-sync-lesync-read-group-entry
+                                     (nth 1 gnus-sync-backend)
+                                     name
+                                     (cdr (assq 'value entry))
+                                     `(read-time ,ftime)
+                                     `(subscribe-all ,subscribe-all)))
+                         (gnus-sync-lesync-install-group-entry
+                          (cdr (assq 'id entry)))))))
+             (gnus-sync-lesync-groups-builder (nth 1 gnus-sync-backend)))))
+
+     ((stringp gnus-sync-backend)
+      ;; read data here...
+      (if (or debug-on-error debug-on-quit)
+          (load gnus-sync-backend nil t)
+        (condition-case var
+            (load gnus-sync-backend nil t)
+          (error
+           (error "Error in %s: %s" gnus-sync-backend (cadr var)))))
+      (let ((valid-count 0)
+            invalid-groups)
+        (dolist (node gnus-sync-newsrc-loader)
+          (if (gnus-gethash (car node) gnus-newsrc-hashtb)
+              (progn
+                (incf valid-count)
+                (loop for store in (cdr node)
+                      do (setf (nth (car store)
+                                    (assoc (car node) gnus-newsrc-alist))
+                               (cdr store))))
+            (push (car node) invalid-groups)))
+        (gnus-message
+         7
+         "gnus-sync-read: loaded %d groups (out of %d) from %s"
+         valid-count (length gnus-sync-newsrc-loader)
+         gnus-sync-backend)
+        (when invalid-groups
+          (gnus-message
+           7
+           "gnus-sync-read: skipped %d groups (out of %d) from %s"
+           (length invalid-groups)
+           (length gnus-sync-newsrc-loader)
+           gnus-sync-backend)
+          (gnus-message 9 "gnus-sync-read: skipped groups: %s"
+                        (mapconcat 'identity invalid-groups ", ")))))
+     (nil))
+
+    (gnus-message 9 "gnus-sync-read: remaking the newsrc hashtable")
+    (gnus-make-hashtable-from-newsrc-alist)))
 
 ;;;###autoload
 (defun gnus-sync-initialize ()
@@ -228,14 +880,11 @@ synchronized, I believe).  Also see `gnus-variable-list'."
 (defun gnus-sync-unload-hook ()
   "Uninstall the sync hooks."
   (interactive)
-  (remove-hook 'gnus-get-new-news-hook 'gnus-sync-read)
-  (remove-hook 'gnus-save-newsrc-hook 'gnus-sync-save)
-  (remove-hook 'gnus-read-newsrc-el-hook 'gnus-sync-read))
+  (remove-hook 'gnus-save-newsrc-hook 'gnus-sync-save))
 
 (add-hook 'gnus-sync-unload-hook 'gnus-sync-unload-hook)
 
-;; this is harmless by default, until the gnus-sync-backend is set
-(gnus-sync-initialize)
+(when gnus-sync-backend (gnus-sync-initialize))
 
 (provide 'gnus-sync)
 
index da899f4bf10bf9fb88364914e429ab98980fdd7c..072e7b5822aa9a53ae6636533fd3e9798936a84a 100644 (file)
@@ -169,15 +169,6 @@ This is a compatibility function for different Emacsen."
   `(delete-region (point-at-bol)
                  (progn (forward-line ,(or n 1)) (point))))
 
-(defun gnus-byte-code (func)
-  "Return a form that can be `eval'ed based on FUNC."
-  (let ((fval (indirect-function func)))
-    (if (byte-code-function-p fval)
-       (let ((flist (append fval nil)))
-         (setcar flist 'byte-code)
-         flist)
-      (cons 'progn (cddr fval)))))
-
 (defun gnus-extract-address-components (from)
   "Extract address components from a From header.
 Given an RFC-822 address FROM, extract full name and canonical address.
@@ -1927,6 +1918,19 @@ Sizes are in pixels."
                    image)))
       image)))
 
+(defun gnus-recursive-directory-files (dir)
+  "Return all regular files below DIR."
+  (let (files)
+    (dolist (file (directory-files dir t))
+      (when (and (not (member (file-name-nondirectory file) '("." "..")))
+                (file-readable-p file))
+       (cond
+        ((file-regular-p file)
+         (push file files))
+        ((file-directory-p file)
+         (setq files (append (gnus-recursive-directory-files file) files))))))
+    files))
+
 (defun gnus-list-memq-of-list (elements list)
   "Return non-nil if any of the members of ELEMENTS are in LIST."
   (let ((found nil))
index 579210c6138c2b6ceef7671580616b3256260fae..bd9ea10fdc4b802a498d6f68c0c2fda9e6aaef50 100644 (file)
@@ -239,7 +239,8 @@ See the Gnus manual for an explanation of the syntax used.")
 
 (defun gnus-configure-frame (split &optional window)
   "Split WINDOW according to SPLIT."
-  (let* ((current-window (or (get-buffer-window (current-buffer)) (selected-window)))
+  (let* ((current-window (or (get-buffer-window (current-buffer))
+                             (selected-window)))
          (window (or window current-window)))
     (select-window window)
     ;; The SPLIT might be something that is to be evalled to
@@ -269,9 +270,23 @@ See the Gnus manual for an explanation of the syntax used.")
          (let ((buf (gnus-get-buffer-create
                      (gnus-window-to-buffer-helper buffer))))
            (when (buffer-name buf)
-             (if (eq buf (window-buffer (selected-window)))
-                 (set-buffer buf)
-               (switch-to-buffer buf))))
+             (cond
+               ((eq buf (window-buffer (selected-window)))
+                (set-buffer buf))
+               ((eq t (window-dedicated-p
+                      ;; XEmacs version of `window-dedicated-p' requires it.
+                      (selected-window)))
+                ;; If the window is hard-dedicated, we have a problem because
+                ;; we just can't do what we're asked.  But signaling an error,
+                ;; like `switch-to-buffer' would do, is not an option because
+                ;; it would prevent things like "^" (to jump to the *Servers*)
+                ;; in a dedicated *Group*.
+                ;; FIXME: Maybe a better/additional fix would be to change
+                ;; gnus-configure-windows so that when called
+                ;; from a hard-dedicated frame, it creates (and
+                ;; configures) a new frame, leaving the dedicated frame alone.
+                (pop-to-buffer buf))
+               (t (switch-to-buffer buf)))))
          (when (memq 'frame-focus split)
            (setq gnus-window-frame-focus window))
          ;; We return the window if it has the `point' spec.
@@ -340,9 +355,9 @@ See the Gnus manual for an explanation of the syntax used.")
          ;; fashion.
          (setq comp-subs (nreverse comp-subs))
          (while comp-subs
-           (if (null (cdr comp-subs))
-               (setq new-win window)
-             (setq new-win
+           (setq new-win
+                  (if (null (cdr comp-subs))
+                      window
                    (split-window window (cadar comp-subs)
                                  (eq type 'horizontal))))
            (setq result (or (gnus-configure-frame
index 635bb6fc96f9ceaf0c11d003b9534184edb3d10e..a605f483ea4537a5c9f598be7beae5482123ccc7 100644 (file)
@@ -1009,10 +1009,11 @@ be set in `.emacs' instead."
     (purp "#9999cc" "#666699")
     (no "#ff0000" "#ffff00")
     (neutral "#b4b4b4" "#878787")
+    (ma "#2020e0" "#8080ff")
     (september "#bf9900" "#ffcc00"))
   "Color alist used for the Gnus logo.")
 
-(defcustom gnus-logo-color-style 'no
+(defcustom gnus-logo-color-style 'ma
   "*Color styles used for the Gnus logo."
   :type `(choice ,@(mapcar (lambda (elem) (list 'const (car elem)))
                           gnus-logo-color-alist))
@@ -1271,15 +1272,18 @@ Set this variable in `.emacs' instead."
   :type '(choice (const :tag "current" nil)
                 directory))
 
-;; Site dependent variables.  These variables should be defined in
-;; paths.el.
+;; Site dependent variables.
 
-(defvar gnus-default-nntp-server nil
-  "Specify a default NNTP server.
-This variable should be defined in paths.el, and should never be set
-by the user.
-If you want to change servers, you should use `gnus-select-method'.
-See the documentation to that variable.")
+;; Should this be obsolete?
+(defcustom gnus-default-nntp-server nil
+  "The hostname of the default NNTP server.
+The empty string, or nil, means to use the local host.
+You may wish to set this on a site-wide basis.
+
+If you want to change servers, you should use `gnus-select-method'."
+  :group 'gnus-server
+  :type '(choice (const :tag "local host" nil)
+                 (string :tag "host name")))
 
 (defcustom gnus-nntpserver-file "/etc/nntpserver"
   "A file with only the name of the nntp server in it."
@@ -1326,6 +1330,8 @@ If you use this variable, you must set `gnus-nntp-server' to nil.
 
 There is a lot more to know about select methods and virtual servers -
 see the manual for details."
+  ;; Emacs has set-after since 22.1.
+  ;set-after '(gnus-default-nntp-server)
   :group 'gnus-server
   :group 'gnus-start
   :initialize 'custom-initialize-default
@@ -2798,6 +2804,8 @@ gnus-registry.el will populate this if it's loaded.")
      ("gnus-kill" gnus-kill gnus-apply-kill-file-internal
       gnus-kill-file-edit-file gnus-kill-file-raise-followups-to-author
       gnus-execute gnus-expunge gnus-batch-kill gnus-batch-score)
+     ("gnus-registry" gnus-try-warping-via-registry
+      gnus-registry-handle-action)
      ("gnus-cache" gnus-cache-possibly-enter-article gnus-cache-save-buffers
       gnus-cache-possibly-remove-articles gnus-cache-request-article
       gnus-cache-retrieve-headers gnus-cache-possibly-alter-active
index afbebbff79f7607a0d030d1e10b5c8cc0f823023..ecde35dca8fbdf955a3912c3db520fed94567102 100644 (file)
@@ -206,29 +206,31 @@ converted to the compressed format."
 (gnus-convert-mark-converter-prompt 'gnus-agent-unlist-expire-days t)
 
 (defun gnus-agent-unhook-expire-days (converting-to)
-  "Remove every lambda from gnus-group-prepare-hook that mention the
-symbol gnus-agent-do-once in their definition.  This should NOT be
+  "Remove every lambda from `gnus-group-prepare-hook' that mention the
+symbol `gnus-agent-do-once' in their definition.  This should NOT be
 necessary as gnus-agent.el no longer adds them.  However, it is
 possible that the hook was persistently saved."
-    (let ((h t)) ; iterate from bgn of hook
+    (let ((h t)) ; Iterate from bgn of hook.
       (while h
         (let ((func (progn (when (eq h t)
-                             ;; init h to list of functions
+                             ;; Init h to list of functions.
                              (setq h (cond ((listp gnus-group-prepare-hook)
                                             gnus-group-prepare-hook)
                                            ((boundp 'gnus-group-prepare-hook)
                                             (list gnus-group-prepare-hook)))))
                            (pop h))))
 
-          (when (cond ((eq (type-of func) 'compiled-function)
-                       ;; Search def. of compiled function for gnus-agent-do-once string
+          (when (cond ((byte-code-function-p func)
+                       ;; Search def. of compiled function for
+                       ;; gnus-agent-do-once string.
                        (let* (definition
                                print-level
                                print-length
                                (standard-output
                                 (lambda (char)
                                   (setq definition (cons char definition)))))
-                         (princ func) ; populates definition with reversed list of characters
+                         (princ func) ; Populates definition with reversed list
+                                     ; of characters.
                          (let* ((i (length definition))
                                 (s (make-string i 0)))
                            (while definition
@@ -236,7 +238,7 @@ possible that the hook was persistently saved."
 
                            (string-match "\\bgnus-agent-do-once\\b" s))))
                       ((listp func)
-                       (eq (cadr (nth 2 func)) 'gnus-agent-do-once) ; handles eval'd lambda
+                       (eq (cadr (nth 2 func)) 'gnus-agent-do-once) ; Handles eval'd lambda.
                        ))
 
             (remove-hook 'gnus-group-prepare-hook func)
index 4ce9279114b47a26610cffd79964e1ecede5c0ad..21ce9e4a8735c4ecdd8d893b065d5f845f83d52c 100644 (file)
@@ -3057,66 +3057,79 @@ M-RET    `message-newline-and-reformat' (break the line and reformat)."
 (defun message-goto-to ()
   "Move point to the To header."
   (interactive)
+  (push-mark)
   (message-position-on-field "To"))
 
 (defun message-goto-from ()
   "Move point to the From header."
   (interactive)
+  (push-mark)
   (message-position-on-field "From"))
 
 (defun message-goto-subject ()
   "Move point to the Subject header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Subject"))
 
 (defun message-goto-cc ()
   "Move point to the Cc header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Cc" "To"))
 
 (defun message-goto-bcc ()
   "Move point to the Bcc  header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Bcc" "Cc" "To"))
 
 (defun message-goto-fcc ()
   "Move point to the Fcc header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Fcc" "To" "Newsgroups"))
 
 (defun message-goto-reply-to ()
   "Move point to the Reply-To header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Reply-To" "Subject"))
 
 (defun message-goto-newsgroups ()
   "Move point to the Newsgroups header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Newsgroups"))
 
 (defun message-goto-distribution ()
   "Move point to the Distribution header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Distribution"))
 
 (defun message-goto-followup-to ()
   "Move point to the Followup-To header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Followup-To" "Newsgroups"))
 
 (defun message-goto-mail-followup-to ()
   "Move point to the Mail-Followup-To header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Mail-Followup-To" "To"))
 
 (defun message-goto-keywords ()
   "Move point to the Keywords header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Keywords" "Subject"))
 
 (defun message-goto-summary ()
   "Move point to the Summary header."
   (interactive)
+  (push-mark)
   (message-position-on-field "Summary" "Subject"))
 
 (eval-when-compile
@@ -3137,6 +3150,7 @@ M-RET    `message-newline-and-reformat' (break the line and reformat)."
   (when (and (message-called-interactively-p 'any)
             (looking-at "[ \t]*\n"))
     (expand-abbrev))
+  (push-mark)
   (goto-char (point-min))
   (or (search-forward (concat "\n" mail-header-separator "\n") nil t)
       (search-forward-regexp "[^:]+:\\([^\n]\\|\n[ \t]\\)+\n\n" nil t)))
@@ -3157,6 +3171,7 @@ M-RET    `message-newline-and-reformat' (break the line and reformat)."
 If there is no signature in the article, go to the end and
 return nil."
   (interactive)
+  (push-mark)
   (goto-char (point-min))
   (if (re-search-forward message-signature-separator nil t)
       (forward-line 1)
@@ -3796,7 +3811,7 @@ prefix, and don't delete any headers."
     (save-current-buffer
       (dolist (buffer (buffer-list t))
        (set-buffer buffer)
-       (when (and (eq major-mode 'message-mode)
+       (when (and (derived-mode-p 'message-mode)
                   (null message-sent-message-via))
          (push (buffer-name buffer) buffers))))
     (nreverse buffers)))
@@ -4479,8 +4494,9 @@ This function could be useful in `message-setup-hook'."
              (end-of-line)
              (insert (format " (%d/%d)" n total))
              (widen)
-              (funcall (or message-send-mail-real-function
-                           message-send-mail-function)))
+             (if message-send-mail-real-function
+                 (funcall message-send-mail-real-function)
+               (message-multi-smtp-send-mail)))
            (setq n (+ n 1))
            (setq p (pop plist))
            (erase-buffer)))
@@ -4634,8 +4650,9 @@ If you always want Gnus to send messages in one piece, set
 ")))
              (progn
                (message "Sending via mail...")
-               (funcall (or message-send-mail-real-function
-                            message-send-mail-function)))
+               (if message-send-mail-real-function
+                   (funcall message-send-mail-real-function)
+                 (message-multi-smtp-send-mail)))
            (message-send-mail-partially))
          (setq options message-options))
       (kill-buffer tembuf))
@@ -4644,6 +4661,28 @@ If you always want Gnus to send messages in one piece, set
     (push 'mail message-sent-message-via)))
 
 (defvar sendmail-program)
+(defvar smtpmail-smtp-user)
+
+(defun message-multi-smtp-send-mail ()
+  "Send the current buffer to `message-send-mail-function'.
+Or, if there's a header that specifies a different method, use
+that instead."
+  (let ((method (message-field-value "X-Message-SMTP-Method")))
+    (if (not method)
+       (funcall message-send-mail-function)
+      (message-remove-header "X-Message-SMTP-Method")
+      (setq method (split-string method))
+      (cond
+       ((equal (car method) "sendmail")
+       (message-send-mail-with-sendmail))
+       ((equal (car method) "smtp")
+       (require 'smtpmail)
+       (let ((smtpmail-smtp-server (nth 1 method))
+             (smtpmail-smtp-service (nth 2 method))
+             (smtpmail-smtp-user (or (nth 3 method) smtpmail-smtp-user)))
+         (message-smtpmail-send-it)))
+       (t
+       (error "Unknown method %s" method))))))
 
 (defun message-send-mail-with-sendmail ()
   "Send off the prepared buffer with sendmail."
@@ -7530,7 +7569,7 @@ is for the internal use."
   (message "Resending message to %s..." address)
   (save-excursion
     (let ((cur (current-buffer))
-         beg)
+         gcc beg)
       ;; We first set up a normal mail buffer.
       (unless (message-mail-user-agent)
        (set-buffer (get-buffer-create " *message resend*"))
@@ -7543,6 +7582,8 @@ is for the internal use."
       ;; Insert our usual headers.
       (message-generate-headers '(From Date To Message-ID))
       (message-narrow-to-headers)
+      (when (setq gcc (mail-fetch-field "gcc" nil t))
+       (message-remove-header "gcc"))
       ;; Remove X-Draft-From header etc.
       (message-remove-header message-ignored-mail-headers t)
       ;; Rename them all to "Resent-*".
@@ -7584,6 +7625,10 @@ is for the internal use."
            message-generate-hashcash
            rfc2047-encode-encoded-words)
        (message-send-mail))
+      (when gcc
+       (message-goto-eoh)
+       (insert "Gcc: " gcc "\n"))
+      (run-hooks 'message-sent-hook)
       (kill-buffer (current-buffer)))
     (message "Resending message to %s...done" address)))
 
diff --git a/lisp/gnus/mm-archive.el b/lisp/gnus/mm-archive.el
new file mode 100644 (file)
index 0000000..7cfa465
--- /dev/null
@@ -0,0 +1,107 @@
+;;; mm-archive.el --- Functions for parsing archive files as MIME
+
+;; Copyright (C) 2012  Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'mm-decode)
+(eval-when-compile
+  (autoload 'gnus-recursive-directory-files "gnus-util")
+  (autoload 'mailcap-extension-to-mime "mailcap"))
+
+(defvar mm-archive-decoders
+  '(("application/ms-tnef" t "tnef" "-f" "-" "-C")
+    ("application/zip" nil "unzip" "-j" "-x" "%f" "-d")
+    ("application/x-gtar-compressed" nil "tar" "xzf" "-" "-C")
+    ("application/x-tar" nil "tar" "xf" "-" "-C")))
+
+(defun mm-archive-decoders () mm-archive-decoders)
+
+(defun mm-dissect-archive (handle)
+  (let ((decoder (cddr (assoc (car (mm-handle-type handle))
+                             mm-archive-decoders)))
+       (dir (mm-make-temp-file
+             (expand-file-name "emm." mm-tmp-directory) 'dir)))
+    (set-file-modes dir #o700)
+    (unwind-protect
+       (progn
+         (mm-with-unibyte-buffer
+           (mm-insert-part handle)
+           (if (member "%f" decoder)
+               (let ((file (expand-file-name "mail.zip" dir)))
+                 (write-region (point-min) (point-max) file nil 'silent)
+                 (setq decoder (copy-sequence decoder))
+                 (setcar (member "%f" decoder) file)
+                 (apply 'call-process (car decoder) nil nil nil
+                        (append (cdr decoder) (list dir)))
+                 (delete-file file))
+             (apply 'call-process-region (point-min) (point-max) (car decoder)
+                    nil (get-buffer-create "*tnef*")
+                    nil (append (cdr decoder) (list dir)))))
+         `("multipart/mixed"
+           ,handle
+           ,@(mm-archive-list-files (gnus-recursive-directory-files dir))))
+      (delete-directory dir t))))
+
+(defun mm-archive-list-files (files)
+  (let ((handles nil)
+       type disposition)
+    (dolist (file files)
+      (with-temp-buffer
+       (when (string-match "\\.\\([^.]+\\)$" file)
+         (setq type (mailcap-extension-to-mime (match-string 1 file))))
+       (unless type
+         (setq type "application/octet-stream"))
+       (setq disposition
+             (if (string-match "^image/\\|^text/" type)
+                 "inline"
+               "attachment"))
+       (insert (format "Content-type: %s\n" type))
+       (insert "Content-Transfer-Encoding: 8bit\n\n")
+       (insert-file-contents file)
+       (push
+        (mm-make-handle (mm-copy-to-buffer)
+                        (list type)
+                        '8bit nil
+                        `(,disposition (filename . ,file))
+                        nil nil nil)
+        handles)))
+    handles))
+
+(defun mm-archive-dissect-and-inline (handle)
+  (let ((start (point-marker)))
+    (save-restriction
+      (narrow-to-region (point) (point))
+      (dolist (handle (cddr (mm-dissect-archive handle)))
+       (goto-char (point-max))
+       (mm-display-inline handle))
+      (goto-char (point-max))
+      (mm-handle-set-undisplayer
+       handle
+       `(lambda ()
+         (let ((inhibit-read-only t)
+               (end ,(point-marker)))
+           (remove-images ,start end)
+           (delete-region ,start end)))))))
+
+(provide 'mm-archive)
+
+;; mm-archive.el ends here
index 4a6da2d437c0fd977c3e364954f20ed938a5361c..7982b745d6600bc2e95ceea84255ab6b60fdf900 100644 (file)
 (autoload 'mm-extern-cache-contents "mm-extern")
 (autoload 'mm-insert-inline "mm-view")
 
+(autoload 'mm-archive-decoders "mm-archive")
+(autoload 'mm-archive-dissect-and-inline "mm-archive")
+(autoload 'mm-dissect-archive "mm-archive")
+
 (defvar gnus-current-window-configuration)
 
 (add-hook 'gnus-exit-gnus-hook 'mm-destroy-postponed-undisplay-list)
@@ -248,6 +252,8 @@ before the external MIME handler is invoked."
     ("message/partial" mm-inline-partial identity)
     ("message/external-body" mm-inline-external-body identity)
     ("text/.*" mm-inline-text identity)
+    ("application/x-.?tar\\(-.*\\)?" mm-archive-dissect-and-inline identity)
+    ("application/zip" mm-archive-dissect-and-inline identity)
     ("audio/wav" mm-inline-audio
      (lambda (handle)
        (and (or (featurep 'nas-sound) (featurep 'native-sound))
@@ -275,7 +281,8 @@ before the external MIME handler is invoked."
                     (ignore-errors
                       (if (fboundp 'create-image)
                           (create-image (buffer-string) 'imagemagick 'data-p)
-                        (mm-create-image-xemacs (mm-handle-media-subtype handle))))))
+                        (mm-create-image-xemacs
+                         (mm-handle-media-subtype handle))))))
                (when image
                  (setcar (cdr handle) (list "image/imagemagick"))
                  (mm-image-fit-p handle)))))))
@@ -297,6 +304,9 @@ before the external MIME handler is invoked."
     "application/pgp-signature" "application/x-pkcs7-signature"
     "application/pkcs7-signature" "application/x-pkcs7-mime"
     "application/pkcs7-mime"
+    "application/x-gtar-compressed"
+    "application/x-tar"
+    "application/zip"
     ;; Mutt still uses this even though it has already been withdrawn.
     "application/pgp")
   "List of media types that are to be displayed inline.
@@ -448,6 +458,7 @@ If not set, `default-directory' will be used."
 (defvar mm-last-shell-command "")
 (defvar mm-content-id-alist nil)
 (defvar mm-postponed-undisplay-list nil)
+(defvar mm-inhibit-auto-detect-attachment nil)
 
 ;; According to RFC2046, in particular, in a digest, the default
 ;; Content-Type value for a body part is changed from "text/plain" to
@@ -567,7 +578,9 @@ Postpone undisplaying of viewers for types in
 (autoload 'message-fetch-field "message")
 
 (defun mm-dissect-buffer (&optional no-strict-mime loose-mime from)
-  "Dissect the current buffer and return a list of MIME handles."
+  "Dissect the current buffer and return a list of MIME handles.
+If NO-STRICT-MIME, don't require the message to have a
+MIME-Version header before proceeding."
   (save-excursion
     (let (ct ctl type subtype cte cd description id result)
       (save-restriction
@@ -653,8 +666,26 @@ Postpone undisplaying of viewers for types in
            (if (equal "text/plain" (car ctl))
                (assoc 'format ctl)
              t))
-    (mm-make-handle
-     (mm-copy-to-buffer) ctl cte nil cdl description nil id)))
+    ;; Guess what the type of application/octet-stream parts should
+    ;; really be.
+    (let ((filename (cdr (assq 'filename (cdr cdl)))))
+      (when (and (not mm-inhibit-auto-detect-attachment)
+                (equal (car ctl) "application/octet-stream")
+                filename
+                (string-match "\\.\\([^.]+\\)$" filename))
+       (let ((new-type (mailcap-extension-to-mime (match-string 1 filename))))
+         (when new-type
+           (setcar ctl new-type)))))
+    (let ((handle
+          (mm-make-handle
+           (mm-copy-to-buffer) ctl cte nil cdl description nil id))
+         (decoder (assoc (car ctl) (mm-archive-decoders))))
+      (if (and decoder
+              ;; Do automatic decoding
+              (cadr decoder)
+              (executable-find (caddr decoder)))
+         (mm-dissect-archive handle)
+       handle))))
 
 (defun mm-dissect-multipart (ctl from)
   (goto-char (point-min))
@@ -665,7 +696,9 @@ Postpone undisplaying of viewers for types in
                (goto-char (point-max))
                (if (re-search-backward close-delimiter nil t)
                    (match-beginning 0)
-                 (point-max)))))
+                 (point-max))))
+        (mm-inhibit-auto-detect-attachment
+         (equal (car ctl) "multipart/encrypted")))
     (setq boundary (concat (regexp-quote boundary) "[ \t]*$"))
     (while (and (< (point) end) (re-search-forward boundary end t))
       (goto-char (match-beginning 0))
@@ -736,23 +769,29 @@ external if displayed external."
                           (mail-content-type-get
                            (mm-handle-type handle) 'name)
                           "<file>"))
-            (external mm-enable-external))
-       (if (and (mm-inlinable-p ehandle)
-                (mm-inlined-p ehandle))
-           (progn
-             (forward-line 1)
-             (mm-display-inline handle)
-             'inline)
-         (when (or method
-                   (not no-default))
-           (if (and (not method)
-                    (equal "text" (car (split-string type "/"))))
-               (progn
-                 (forward-line 1)
-                 (mm-insert-inline handle (mm-get-part handle))
-                 'inline)
-             (setq external
-                    (and method ;; If nil, we always use "save".
+            (external mm-enable-external)
+            (decoder (assoc (car (mm-handle-type handle))
+                            (mm-archive-decoders))))
+       (cond
+        ((and decoder
+              (executable-find (caddr decoder)))
+         (mm-archive-dissect-and-inline handle)
+         'inline)
+        ((and (mm-inlinable-p ehandle)
+              (mm-inlined-p ehandle))
+         (forward-line 1)
+         (mm-display-inline handle)
+         'inline)
+        ((or method
+             (not no-default))
+         (if (and (not method)
+                  (equal "text" (car (split-string type "/"))))
+             (progn
+               (forward-line 1)
+               (mm-insert-inline handle (mm-get-part handle))
+               'inline)
+           (setq external
+                 (and method         ;; If nil, we always use "save".
                       (stringp method) ;; 'mailcap-save-binary-file
                       (or (eq mm-enable-external t)
                           (and (eq mm-enable-external 'ask)
@@ -765,12 +804,12 @@ external if displayed external."
                                      (concat
                                       " \"" (format method filename) "\"")
                                    "")
-                                    "? "))))))
-             (if external
-                 (mm-display-external
-                  handle (or method 'mailcap-save-binary-file))
+                                 "? "))))))
+           (if external
                (mm-display-external
-                handle 'mailcap-save-binary-file)))))))))
+                handle (or method 'mailcap-save-binary-file))
+             (mm-display-external
+              handle 'mailcap-save-binary-file)))))))))
 
 (declare-function gnus-configure-windows "gnus-win" (setting &optional force))
 (defvar mailcap-mime-extensions)       ; mailcap-mime-info autoloads
@@ -918,46 +957,38 @@ external if displayed external."
                                   shell-command-switch command)
                    (set-process-sentinel
                     (get-buffer-process buffer)
-                    (lexical-let ;; Don't use `let'.
-                        ;; Function used to remove temp file and directory.
-                        ((fn `(lambda nil
-                                ;; Don't use `ignore-errors'.
-                                (condition-case nil
-                                    (delete-file ,file)
-                                  (error))
-                                (condition-case nil
-                                    (delete-directory
-                                     ,(file-name-directory file))
-                                  (error))))
-                         ;; Form uses to kill the process buffer and
-                         ;; remove the undisplayer.
-                         (fm `(progn
-                                (kill-buffer ,buffer)
-                                ,(macroexpand
-                                  (list 'mm-handle-set-undisplayer
-                                        (list 'quote handle)
-                                        nil))))
-                         ;; Message to be issued when the process exits.
-                         (done (format "Displaying %s...done" command))
-                         ;; In particular, the timer object (which is
-                         ;; a vector in Emacs but is a list in XEmacs)
-                         ;; requires that it is lexically scoped.
-                         (timer (run-at-time 30.0 nil 'ignore)))
-                      (if (featurep 'xemacs)
-                          (lambda (process state)
-                            (when (eq 'exit (process-status process))
-                              (if (memq timer itimer-list)
-                                  (set-itimer-function timer fn)
-                                (funcall fn))
-                              (ignore-errors (eval fm))
-                              (message "%s" done)))
-                        (lambda (process state)
-                          (when (eq 'exit (process-status process))
-                            (if (memq timer timer-list)
-                                (timer-set-function timer fn)
-                              (funcall fn))
-                            (ignore-errors (eval fm))
-                            (message "%s" done)))))))
+                    (lexical-let ((outbuf outbuf)
+                                  (file file)
+                                  (buffer buffer)
+                                  (command command)
+                                  (handle handle))
+                      (run-at-time
+                       30.0 nil
+                       (lambda ()
+                         (ignore-errors
+                           (delete-file file))
+                         (ignore-errors
+                           (delete-directory (file-name-directory file)))))
+                      (lambda (process state)
+                        (when (eq (process-status process) 'exit)
+                          (condition-case nil
+                              (delete-file file)
+                            (error))
+                          (condition-case nil
+                              (delete-directory (file-name-directory file))
+                            (error))
+                          (when (buffer-live-p outbuf)
+                            (with-current-buffer outbuf
+                              (let ((buffer-read-only nil)
+                                    (point (point)))
+                                (forward-line 2)
+                                (mm-insert-inline
+                                 handle (with-current-buffer buffer
+                                          (buffer-string)))
+                                (goto-char point))))
+                          (when (buffer-live-p buffer)
+                            (kill-buffer buffer)))
+                        (message "Displaying %s...done" command)))))
                (mm-handle-set-external-undisplayer
                 handle (cons file buffer)))
              (message "Displaying %s..." command))
@@ -1741,7 +1772,8 @@ If RECURSIVE, search recursively."
         (insert (prog1
                     (if (and charset
                              (setq charset
-                                   (mm-charset-to-coding-system charset))
+                                   (mm-charset-to-coding-system charset
+                                                                nil t))
                              (not (eq charset 'ascii)))
                         (mm-decode-coding-string (buffer-string) charset)
                       (mm-string-as-multibyte (buffer-string)))
@@ -1762,6 +1794,8 @@ If RECURSIVE, search recursively."
         (while (search-forward "­" nil t)
           (replace-match "" t t))
         (libxml-parse-html-region (point-min) (point-max))))
+      (unless (bobp)
+       (insert "\n"))
       (mm-handle-set-undisplayer
        handle
        `(lambda ()
@@ -1778,4 +1812,8 @@ If RECURSIVE, search recursively."
 
 (provide 'mm-decode)
 
+;; Local Variables:
+;; coding: iso-8859-1
+;; End:
+
 ;;; mm-decode.el ends here
index e9119284a04f23e9cb51f6392a9f12e37e7b379b..4fb5ea704bda33f7ebc52cd58e8df9d85e617c60 100644 (file)
@@ -1592,7 +1592,7 @@ gzip, bzip2, etc. are allowed."
   (unless filename
     (setq filename buffer-file-name))
   (save-excursion
-    (let ((decomp (unless ;; No worth to examine charset of tar files.
+    (let ((decomp (unless ;; Not worth it to examine charset of tar files.
                      (and filename
                           (string-match
                            "\\.\\(?:tar\\.[^.]+\\|tbz\\|tgz\\)\\'"
index a9901d7163ea10362a88259104c2e388bcf59538..cc1aedf1b978294ba1f03f5dc545a6faea328234 100644 (file)
@@ -463,8 +463,10 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
 (defvar mml-multipart-number 0)
 (defvar mml-inhibit-compute-boundary nil)
 
-(defun mml-generate-mime ()
-  "Generate a MIME message based on the current MML document."
+(defun mml-generate-mime (&optional multipart-type)
+  "Generate a MIME message based on the current MML document.
+MULTIPART-TYPE defaults to \"mixed\", but can also
+be \"related\" or \"alternate\"."
   (let ((cont (mml-parse))
        (mml-multipart-number mml-multipart-number)
        (options message-options))
@@ -476,8 +478,9 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
            (if (and (consp (car cont))
                     (= (length cont) 1))
                (mml-generate-mime-1 (car cont))
-             (mml-generate-mime-1 (nconc (list 'multipart '(type . "mixed"))
-                                         cont)))
+             (mml-generate-mime-1
+              (nconc (list 'multipart (cons 'type (or multipart-type "mixed")))
+                     cont)))
            (setq options message-options)
            (buffer-string))
        (setq message-options options)))))
index 1800d0c02de353ab235f262932e936f0dfbd1a27..da50720ebbe856f134a9b7fb9b37a28856cb399a 100644 (file)
@@ -37,7 +37,8 @@
 (require 'mm-util)
 (eval-when-compile (require 'cl))
 
-(declare-function nndraft-request-list "nnmh" (&rest args))
+;; The nnoo-import at the end, I think.
+(declare-function nndraft-request-list "nndraft" (&rest args) t)
 
 (nnoo-declare nndraft
   nnmh)
index 89961dc7dad8ab2f50c850d9fea15724609257cb..e93bd7f43e0b7cc7d0ee04c62246a63b145f13f4 100644 (file)
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 1995-2012 Free Software Foundation, Inc.
 
-;; Author: Simon Josefsson <simon@josefsson.org> (adding MARKS)
+;; Author: Simon Josefsson <simon@josefsson.org>
 ;;      ShengHuo Zhu <zsh@cs.rochester.edu> (adding NOV)
 ;;      Scott Byer <byer@mv.us.adobe.com>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
   "The name of the nnfolder NOV directory.
 If nil, `nnfolder-directory' is used.")
 
-(defvoo nnfolder-marks-directory nil
-  "The name of the nnfolder MARKS directory.
-If nil, `nnfolder-directory' is used.")
-
 (defvoo nnfolder-active-file
     (nnheader-concat nnfolder-directory "active")
   "The name of the active file.")
@@ -134,21 +130,6 @@ all.  This may very well take some time.")
 
 (defvar nnfolder-nov-buffer-file-name nil)
 
-(defvoo nnfolder-marks-is-evil nil
-  "If non-nil, Gnus will never generate and use marks file for mail groups.
-Using marks files makes it possible to backup and restore mail groups
-separately from `.newsrc.eld'.  If you have, for some reason, set
-this to t, and want to set it to nil again, you should always remove
-the corresponding marks file (usually base nnfolder file name
-concatenated with `.mrk', but see `nnfolder-marks-file-suffix') for
-the group.  Then the marks file will be regenerated properly by Gnus.")
-
-(defvoo nnfolder-marks nil)
-
-(defvoo nnfolder-marks-file-suffix ".mrk")
-
-(defvar nnfolder-marks-modtime (gnus-make-hashtable))
-
 \f
 
 ;;; Interface functions
@@ -231,9 +212,6 @@ the group.  Then the marks file will be regenerated properly by Gnus.")
   (unless (or gnus-nov-is-evil nnfolder-nov-is-evil)
     (and nnfolder-nov-directory
         (gnus-make-directory nnfolder-nov-directory)))
-  (unless nnfolder-marks-is-evil
-    (and nnfolder-marks-directory
-        (gnus-make-directory nnfolder-marks-directory)))
   (cond
    ((not (file-exists-p nnfolder-directory))
     (nnfolder-close-server)
@@ -607,11 +585,9 @@ the group.  Then the marks file will be regenerated properly by Gnus.")
       ()                               ; Don't delete the articles.
     ;; Delete the file that holds the group.
     (let ((data (nnfolder-group-pathname group))
-         (nov (nnfolder-group-nov-pathname group))
-         (mrk (nnfolder-group-marks-pathname group)))
+         (nov (nnfolder-group-nov-pathname group)))
       (ignore-errors (delete-file data))
-      (ignore-errors (delete-file nov))
-      (ignore-errors (delete-file mrk))))
+      (ignore-errors (delete-file nov))))
   ;; Remove the group from all structures.
   (setq nnfolder-group-alist
        (delq (assoc group nnfolder-group-alist) nnfolder-group-alist)
@@ -632,11 +608,7 @@ the group.  Then the marks file will be regenerated properly by Gnus.")
             (when (file-exists-p (nnfolder-group-nov-pathname group))
               (setq new-file (nnfolder-group-nov-pathname new-name))
               (gnus-make-directory (file-name-directory new-file))
-              (rename-file (nnfolder-group-nov-pathname group) new-file))
-            (when (file-exists-p (nnfolder-group-marks-pathname group))
-              (setq new-file (nnfolder-group-marks-pathname new-name))
-              (gnus-make-directory (file-name-directory new-file))
-              (rename-file (nnfolder-group-marks-pathname group) new-file)))
+              (rename-file (nnfolder-group-nov-pathname group) new-file)))
           t)
         ;; That went ok, so we change the internal structures.
         (let ((entry (assoc group nnfolder-group-alist)))
@@ -1087,16 +1059,17 @@ This command does not work if you use short group names."
 
 (defun nnfolder-save-buffer ()
   "Save the buffer."
-  (when (buffer-modified-p)
-    (run-hooks 'nnfolder-save-buffer-hook)
-    (gnus-make-directory (file-name-directory (buffer-file-name)))
-    (let ((coding-system-for-write
-          (or nnfolder-file-coding-system-for-write
-              nnfolder-file-coding-system)))
-      (set (make-local-variable 'copyright-update) nil)
-      (save-buffer)))
-  (unless (or gnus-nov-is-evil nnfolder-nov-is-evil)
-    (nnfolder-save-nov)))
+  (let ((delete-old-versions t))
+    (when (buffer-modified-p)
+      (run-hooks 'nnfolder-save-buffer-hook)
+      (gnus-make-directory (file-name-directory (buffer-file-name)))
+      (let ((coding-system-for-write
+            (or nnfolder-file-coding-system-for-write
+                nnfolder-file-coding-system)))
+       (set (make-local-variable 'copyright-update) nil)
+       (save-buffer)))
+    (unless (or gnus-nov-is-evil nnfolder-nov-is-evil)
+      (nnfolder-save-nov))))
 
 (defun nnfolder-save-active (group-alist active-file)
   (let ((nnmail-active-file-coding-system
@@ -1182,100 +1155,6 @@ This command does not work if you use short group names."
     (mail-header-set-number headers article)
     (nnheader-insert-nov headers)))
 
-(deffoo nnfolder-request-set-mark (group actions &optional server)
-  (when (and server
-            (not (nnfolder-server-opened server)))
-    (nnfolder-open-server server))
-  (unless nnfolder-marks-is-evil
-    (nnfolder-open-marks group server)
-    (setq nnfolder-marks (nnheader-update-marks-actions nnfolder-marks actions))
-    (nnfolder-save-marks group server))
-  nil)
-
-(deffoo nnfolder-request-marks (group info &optional server)
-  ;; Change servers.
-  (when (and server
-            (not (nnfolder-server-opened server)))
-    (nnfolder-open-server server))
-  (when (and (not nnfolder-marks-is-evil) (nnfolder-marks-changed-p group))
-    (nnheader-message 8 "Updating marks for %s..." group)
-    (nnfolder-open-marks group server)
-    ;; Update info using `nnfolder-marks'.
-    (mapc (lambda (pred)
-           (unless (memq (cdr pred) gnus-article-unpropagated-mark-lists)
-             (gnus-info-set-marks
-              info
-              (gnus-update-alist-soft
-               (cdr pred)
-               (cdr (assq (cdr pred) nnfolder-marks))
-               (gnus-info-marks info))
-              t)))
-         gnus-article-mark-lists)
-    (let ((seen (cdr (assq 'read nnfolder-marks))))
-      (gnus-info-set-read info
-                         (if (and (integerp (car seen))
-                                  (null (cdr seen)))
-                             (list (cons (car seen) (car seen)))
-                           seen)))
-    (nnheader-message 8 "Updating marks for %s...done" group))
-  info)
-
-(defun nnfolder-group-marks-pathname (group)
-  "Make pathname for GROUP NOV."
-  (let ((nnfolder-directory (or nnfolder-marks-directory nnfolder-directory)))
-    (concat (nnfolder-group-pathname group) nnfolder-marks-file-suffix)))
-
-(defun nnfolder-marks-changed-p (group)
-  (let ((file (nnfolder-group-marks-pathname group)))
-    (if (null (gnus-gethash file nnfolder-marks-modtime))
-       t ;; never looked at marks file, assume it has changed
-      (not (equal (gnus-gethash file nnfolder-marks-modtime)
-                 (nth 5 (file-attributes file)))))))
-
-(defun nnfolder-save-marks (group server)
-  (let ((file-name-coding-system nnmail-pathname-coding-system)
-       (file (nnfolder-group-marks-pathname group)))
-    (condition-case err
-       (progn
-         (with-temp-file file
-           (erase-buffer)
-           (gnus-prin1 nnfolder-marks)
-           (insert "\n"))
-         (gnus-sethash file
-                       (nth 5 (file-attributes file))
-                       nnfolder-marks-modtime))
-      (error (or (gnus-yes-or-no-p
-                 (format "Could not write to %s (%s).  Continue? " file err))
-                (error "Cannot write to %s (%s)" file err))))))
-
-(defun nnfolder-open-marks (group server)
-  (let ((file (nnfolder-group-marks-pathname group)))
-    (if (file-exists-p file)
-       (condition-case err
-           (with-temp-buffer
-             (gnus-sethash file (nth 5 (file-attributes file))
-                           nnfolder-marks-modtime)
-             (nnheader-insert-file-contents file)
-             (setq nnfolder-marks (read (current-buffer)))
-             (dolist (el gnus-article-unpropagated-mark-lists)
-               (setq nnfolder-marks (gnus-remassoc el nnfolder-marks))))
-         (error (or (gnus-yes-or-no-p
-                     (format "Error reading nnfolder marks file %s (%s).  Continuing will use marks from .newsrc.eld.  Continue? " file err))
-                    (error "Cannot read nnfolder marks file %s (%s)" file err))))
-      ;; User didn't have a .marks file.  Probably first time
-      ;; user of the .marks stuff.  Bootstrap it from .newsrc.eld.
-      (let ((info (gnus-get-info
-                  (gnus-group-prefixed-name
-                   group
-                   (gnus-server-to-method (format "nnfolder:%s" server))))))
-       (nnheader-message 7 "Bootstrapping marks for %s..." group)
-       (setq nnfolder-marks (gnus-info-marks info))
-       (push (cons 'read (gnus-info-read info)) nnfolder-marks)
-       (dolist (el gnus-article-unpropagated-mark-lists)
-         (setq nnfolder-marks (gnus-remassoc el nnfolder-marks)))
-       (nnfolder-save-marks group server)
-       (nnheader-message 7 "Bootstrapping marks for %s...done" group)))))
-
 (provide 'nnfolder)
 
 ;;; nnfolder.el ends here
index f978b8c9906f0dcf3abd9c32e73e5c0398778064..5126c25f66b614db9b9f19d0d3b51bed7b305490 100644 (file)
@@ -117,7 +117,7 @@ some servers.")
 
 (defvoo nnimap-fetch-partial-articles nil
   "If non-nil, Gnus will fetch partial articles.
-If t, nnimap will fetch only the first part.  If a string, it
+If t, Gnus will fetch only the first part.  If a string, it
 will fetch all parts that have types that match that string.  A
 likely value would be \"text/\" to automatically fetch all
 textual parts.")
@@ -475,6 +475,8 @@ textual parts.")
            (when nnimap-object
              (when (nnimap-capability "QRESYNC")
                (nnimap-command "ENABLE QRESYNC"))
+              (nnheader-message 7 "Opening connection to %s...done"
+                               nnimap-address)
              (nnimap-process nnimap-object))))))))
 
 (autoload 'rfc2104-hash "rfc2104")
index 9c3a814d3eaf033406310352bac4c7bce6570e09..1645f49091f1e15ddb984e9e63c5141d9c083ba7 100644 (file)
@@ -40,6 +40,8 @@
 
 (autoload 'gnus-add-buffer "gnus")
 (autoload 'gnus-kill-buffer "gnus")
+(eval-when-compile
+  (autoload 'mail-send-and-exit "sendmail" nil t))
 
 (defgroup nnmail nil
   "Reading mail with Gnus."
@@ -553,11 +555,11 @@ parameter.  It should return nil, `warn' or `delete'."
                 (const warn)
                 (const delete)))
 
-(defcustom nnmail-extra-headers '(To Newsgroups)
+(defcustom nnmail-extra-headers '(To Newsgroups Cc)
   "Extra headers to parse.
 In addition to the standard headers, these extra headers will be
 included in NOV headers (and the like) when backends parse headers."
-  :version "21.1"
+  :version "24.2"
   :group 'nnmail
   :type '(repeat symbol))
 
index b8652600ae72bcec915b4c34aebb25dfc4f705d2..600a0d21e3c5ea020993ce205daa8040119ffdf2 100644 (file)
@@ -4,7 +4,7 @@
 ;;   Foundation, Inc.
 
 ;; Authors: Didier Verna <didier@xemacs.org> (adding compaction)
-;;     Simon Josefsson <simon@josefsson.org> (adding MARKS)
+;;     Simon Josefsson <simon@josefsson.org>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;; Keywords: news, mail
@@ -67,15 +67,6 @@ the `nnml-generate-nov-databases' command.  The function will go
 through all nnml directories and generate nov databases for them
 all.  This may very well take some time.")
 
-(defvoo nnml-marks-is-evil nil
-  "If non-nil, Gnus will never generate and use marks file for mail spools.
-Using marks files makes it possible to backup and restore mail groups
-separately from `.newsrc.eld'.  If you have, for some reason, set this
-to t, and want to set it to nil again, you should always remove the
-corresponding marks file (usually named `.marks' in the nnml group
-directory, but see `nnml-marks-file-name') for the group.  Then the
-marks file will be regenerated properly by Gnus.")
-
 (defvoo nnml-prepare-save-mail-hook nil
   "Hook run narrowed to an article before saving.")
 
@@ -102,7 +93,6 @@ non-nil.")
   "nnml version.")
 
 (defvoo nnml-nov-file-name ".overview")
-(defvoo nnml-marks-file-name ".marks")
 
 (defvoo nnml-current-directory nil)
 (defvoo nnml-current-group nil)
@@ -118,10 +108,6 @@ non-nil.")
 
 (defvoo nnml-file-coding-system nnmail-file-coding-system)
 
-(defvoo nnml-marks nil)
-
-(defvar nnml-marks-modtime (gnus-make-hashtable))
-
 \f
 ;;; Interface functions.
 
@@ -513,8 +499,7 @@ non-nil.")
                        nnml-current-directory t
                        (concat
                         nnheader-numerical-short-files
-                        "\\|" (regexp-quote nnml-nov-file-name) "$"
-                        "\\|" (regexp-quote nnml-marks-file-name) "$")))
+                        "\\|" (regexp-quote nnml-nov-file-name) "$")))
                      (decoded (nnml-decoded-group-name group server)))
                  (dolist (article articles)
                    (when (file-writable-p article)
@@ -554,10 +539,6 @@ non-nil.")
       (let ((overview (concat old-dir nnml-nov-file-name)))
        (when (file-exists-p overview)
          (rename-file overview (concat new-dir nnml-nov-file-name))))
-      ;; Move .marks file.
-      (let ((marks (concat old-dir nnml-marks-file-name)))
-       (when (file-exists-p marks)
-         (rename-file marks (concat new-dir nnml-marks-file-name))))
       (when (<= (length (directory-files old-dir)) 2)
        (ignore-errors (delete-directory old-dir)))
       ;; That went ok, so we change the internal structures.
@@ -1033,99 +1014,6 @@ Use the nov database for the current group if available."
          (forward-line 1))
        alist))))
 
-(deffoo nnml-request-set-mark (group actions &optional server)
-  (nnml-possibly-change-directory group server)
-  (unless nnml-marks-is-evil
-    (nnml-open-marks group server)
-    (setq nnml-marks (nnheader-update-marks-actions nnml-marks actions))
-    (nnml-save-marks group server))
-  nil)
-
-(deffoo nnml-request-marks (group info &optional server)
-  (nnml-possibly-change-directory group server)
-  (when (and (not nnml-marks-is-evil) (nnml-marks-changed-p group server))
-    (nnheader-message 8 "Updating marks for %s..." group)
-    (nnml-open-marks group server)
-    ;; Update info using `nnml-marks'.
-    (mapc (lambda (pred)
-           (unless (memq (cdr pred) gnus-article-unpropagated-mark-lists)
-             (gnus-info-set-marks
-              info
-              (gnus-update-alist-soft
-               (cdr pred)
-               (cdr (assq (cdr pred) nnml-marks))
-               (gnus-info-marks info))
-              t)))
-         gnus-article-mark-lists)
-    (let ((seen (cdr (assq 'read nnml-marks))))
-      (gnus-info-set-read info
-                         (if (and (integerp (car seen))
-                                  (null (cdr seen)))
-                             (list (cons (car seen) (car seen)))
-                           seen)))
-    (nnheader-message 8 "Updating marks for %s...done" group))
-  info)
-
-(defun nnml-marks-changed-p (group server)
-  (let ((file (nnml-group-pathname group nnml-marks-file-name server)))
-    (if (null (gnus-gethash file nnml-marks-modtime))
-       t ;; never looked at marks file, assume it has changed
-      (not (equal (gnus-gethash file nnml-marks-modtime)
-                 (nth 5 (file-attributes file)))))))
-
-(defun nnml-save-marks (group server)
-  (let ((file-name-coding-system nnmail-pathname-coding-system)
-       (file (nnml-group-pathname group nnml-marks-file-name server)))
-    (condition-case err
-       (progn
-         (nnml-possibly-create-directory group server)
-         (with-temp-file file
-           (erase-buffer)
-           (gnus-prin1 nnml-marks)
-           (insert "\n"))
-         (gnus-sethash file
-                       (nth 5 (file-attributes file))
-                       nnml-marks-modtime))
-      (error (or (gnus-yes-or-no-p
-                 (format "Could not write to %s (%s).  Continue? " file err))
-                (error "Cannot write to %s (%s)" file err))))))
-
-(defun nnml-open-marks (group server)
-  (let* ((decoded (nnml-decoded-group-name group server))
-        (file (nnmail-group-pathname decoded nnml-directory
-                                     nnml-marks-file-name))
-        (file-name-coding-system nnmail-pathname-coding-system))
-    (if (file-exists-p file)
-       (condition-case err
-           (with-temp-buffer
-             (gnus-sethash file (nth 5 (file-attributes file))
-                           nnml-marks-modtime)
-             (nnheader-insert-file-contents file)
-             (setq nnml-marks (read (current-buffer)))
-             (dolist (el gnus-article-unpropagated-mark-lists)
-               (setq nnml-marks (gnus-remassoc el nnml-marks))))
-         (error (or (gnus-yes-or-no-p
-                     (format "Error reading nnml marks file %s (%s).  Continuing will use marks from .newsrc.eld.  Continue? " file err))
-                    (error "Cannot read nnml marks file %s (%s)" file err))))
-      ;; User didn't have a .marks file.  Probably first time
-      ;; user of the .marks stuff.  Bootstrap it from .newsrc.eld.
-      (let ((info (gnus-get-info
-                  (gnus-group-prefixed-name
-                   group
-                   (gnus-server-to-method
-                    (format "nnml:%s" (or server "")))))))
-       (setq decoded (if (member server '(nil ""))
-                         (concat "nnml:" decoded)
-                       (format "nnml+%s:%s" server decoded)))
-       (nnheader-message 7 "Bootstrapping marks for %s..." decoded)
-       (setq nnml-marks (gnus-info-marks info))
-       (push (cons 'read (gnus-info-read info)) nnml-marks)
-       (dolist (el gnus-article-unpropagated-mark-lists)
-         (setq nnml-marks (gnus-remassoc el nnml-marks)))
-       (nnml-save-marks group server)
-       (nnheader-message 7 "Bootstrapping marks for %s...done" decoded)))))
-
-
 ;;;
 ;;; Group and server compaction. -- dvl
 ;;;
@@ -1275,19 +1163,11 @@ Use the nov database for the current group if available."
          (gnus-set-active group-full-name active))
        ;; 1 bis/
        ;; #### NOTE: normally, we should save the overview (NOV) file
-       ;; #### here, just like we save the marks file. However, there is no
-       ;; #### such function as nnml-save-nov for a single group. Only for
-       ;; #### all groups. Gnus inconsistency is getting worse every day...
-       ;; 2/ Rebuild marks file:
-       (unless nnml-marks-is-evil
-         ;; #### NOTE: this constant use of global variables everywhere is
-         ;; #### truly disgusting. Gnus really needs a *major* cleanup.
-         (setq nnml-marks (gnus-info-marks info))
-         (push (cons 'read (gnus-info-read info)) nnml-marks)
-         (dolist (el gnus-article-unpropagated-mark-lists)
-           (setq nnml-marks (gnus-remassoc el nnml-marks)))
-         (nnml-save-marks group server))
-       ;; 3/ Save everything if this was not part of a bigger operation:
+       ;; #### here. However, there is no such function as
+       ;; #### nnml-save-nov for a single group. Only for all
+       ;; #### groups. Gnus inconsistency is getting worse every
+       ;; #### day...  ;; 3/ Save everything if this was not part of
+       ;; #### a bigger operation:
        (if (not save)
            ;; Nothing to save (yet):
            t
@@ -1298,9 +1178,6 @@ Use the nov database for the current group if available."
          (nnml-save-nov)
          ;; b/ Save the active file:
          (nnmail-save-active nnml-group-alist nnml-active-file)
-         (let ((marks (nnml-group-pathname group nnml-marks-file-name server)))
-           (when (file-exists-p marks)
-             (delete-file marks)))
          t)))))
 
 (defun nnml-request-compact (&optional server)
index 2b024e20740920f9864b3ae068849e2fd092bdf3..ad9e9c62d6d715dc4793fe6ddb2d04a3dc59b9ea 100644 (file)
 (require 'nnoo)
 (eval-when-compile (require 'cl))
 
+;; Probably this entire thing should be obsolete.
+;; It's only used to init nnspool-spool-directory, so why not just
+;; set that variable's default directly?
+(eval-and-compile
+  (defvar news-directory (if (file-exists-p "/usr/spool/news/")
+                            "/usr/spool/news/"
+                          "/var/spool/news/")
+    "The root directory below which all news files are stored.")
+  (defvaralias 'news-path 'news-directory))
+
+;; Ditto re obsolescence.
+(defvar news-inews-program
+  (cond ((file-exists-p "/usr/bin/inews") "/usr/bin/inews")
+       ((file-exists-p "/usr/local/inews") "/usr/local/inews")
+       ((file-exists-p "/usr/local/bin/inews") "/usr/local/bin/inews")
+       ((file-exists-p "/usr/contrib/lib/news/inews") "/usr/contrib/lib/news/inews")
+       ((file-exists-p "/usr/lib/news/inews") "/usr/lib/news/inews")
+       (t "inews"))
+  "Program to post news.")
+
 (nnoo-declare nnspool)
 
 (defvoo nnspool-inews-program news-inews-program
index 621aece89205eeca359eb2efd221827f34ba79ca..c538d740209b5b16bc5fe816683630291fcdd77f 100644 (file)
@@ -222,27 +222,6 @@ then use this hook to rsh to the remote machine and start a proxy NNTP
 server there that you can connect to.  See also
 `nntp-open-connection-function'")
 
-(defvoo nntp-coding-system-for-read 'binary
-  "*Coding system to read from NNTP.")
-
-(defvoo nntp-coding-system-for-write 'binary
-  "*Coding system to write to NNTP.")
-
-;; Marks
-(defvoo nntp-marks-is-evil nil
-  "*If non-nil, Gnus will never generate and use marks file for nntp groups.
-See `nnml-marks-is-evil' for more information.")
-
-(defvoo nntp-marks-file-name ".marks")
-(defvoo nntp-marks nil)
-(defvar nntp-marks-modtime (gnus-make-hashtable))
-
-(defcustom nntp-marks-directory
-  (nnheader-concat gnus-directory "marks/")
-  "*The directory where marks for nntp groups will be stored."
-  :group 'nntp
-  :type 'directory)
-
 (defcustom nntp-authinfo-file "~/.authinfo"
   ".netrc-like file that holds nntp authinfo passwords."
   :group 'nntp
@@ -344,26 +323,26 @@ backend doesn't catch this error.")
     (insert (format-time-string "%Y%m%dT%H%M%S.%3N")
            " " nntp-address " " string "\n")))
 
+(defvar nntp--report-1 nil)
+
 (defun nntp-report (&rest args)
   "Report an error from the nntp backend.  The first string in ARGS
 can be a format string.  For some commands, the failed command may be
 retried once before actually displaying the error report."
+  (if nntp--report-1
+      (progn
+        ;; Throw out to nntp-with-open-group-error so that the connection may
+        ;; be restored and the command retried."
+        (when nntp-record-commands
+          (nntp-record-command "*** CONNECTION LOST ***"))
+        (throw 'nntp-with-open-group-error t))
 
-  (when nntp-record-commands
-    (nntp-record-command "*** CALLED nntp-report ***"))
-
-  (nnheader-report 'nntp args)
+    (when nntp-record-commands
+      (nntp-record-command "*** CALLED nntp-report ***"))
 
-  (apply 'error args))
+    (nnheader-report 'nntp args)
 
-(defun nntp-report-1 (&rest args)
-  "Throws out to nntp-with-open-group-error so that the connection may
-be restored and the command retried."
-
-  (when nntp-record-commands
-    (nntp-record-command "*** CONNECTION LOST ***"))
-
-  (throw 'nntp-with-open-group-error t))
+    (apply 'error args)))
 
 (defmacro nntp-copy-to-buffer (buffer start end)
   "Copy string from unibyte current buffer to multibyte buffer."
@@ -633,10 +612,6 @@ be restored and the command retried."
    (t
     nil)))
 
-(eval-when-compile
-  (defvar nntp-with-open-group-internal nil)
-  (defvar nntp-report-n nil))
-
 (defun nntp-with-open-group-function (-group -server -connectionless -bodyfun)
   "Protect against servers that don't like clients that keep idle connections opens.
 The problem being that these servers may either close a connection or
@@ -647,9 +622,9 @@ connection timeouts (which may be several minutes) or
 `nntp-connection-timeout' has expired.  When these occur
 `nntp-with-open-group', opens a new connection then re-issues the NNTP
 command whose response triggered the error."
-  (letf ((nntp-report-n (symbol-function 'nntp-report))
-         ((symbol-function 'nntp-report) (symbol-function 'nntp-report-1))
-         (nntp-with-open-group-internal nil))
+  (let ((nntp-report-n nntp--report-1)
+        (nntp--report-1 t)
+        (nntp-with-open-group-internal nil))
     (while (catch 'nntp-with-open-group-error
              ;; Open the connection to the server
              ;; NOTE: Existing connections are NOT tested.
@@ -685,7 +660,7 @@ command whose response triggered the error."
                  (when -timer
                    (nnheader-cancel-timer -timer)))
                nil))
-      (setf (symbol-function 'nntp-report) nntp-report-n))
+      (setq nntp--report-1 nntp-report-n))
     nntp-with-open-group-internal))
 
 (defmacro nntp-with-open-group (group server &optional connectionless &rest forms)
@@ -830,7 +805,8 @@ command whose response triggered the error."
              (progn
                (nntp-copy-to-buffer nntp-server-buffer
                                     (point-min) (point-max))
-               (gnus-groups-to-gnus-format method gnus-active-hashtb t))
+               (with-current-buffer nntp-server-buffer
+                 (gnus-groups-to-gnus-format method gnus-active-hashtb t)))
            ;; We have read active entries, so we just delete the
            ;; superfluous gunk.
            (goto-char (point-min))
@@ -1188,43 +1164,6 @@ command whose response triggered the error."
 (deffoo nntp-asynchronous-p ()
   t)
 
-(deffoo nntp-request-set-mark (group actions &optional server)
-  (when (and (not nntp-marks-is-evil)
-            nntp-marks-file-name)
-    (nntp-possibly-create-directory group server)
-    (nntp-open-marks group server)
-    (setq nntp-marks (nnheader-update-marks-actions nntp-marks actions))
-    (nntp-save-marks group server))
-  nil)
-
-(deffoo nntp-request-marks (group info &optional server)
-  (when (and (not nntp-marks-is-evil)
-            nntp-marks-file-name)
-    (nntp-possibly-create-directory group server)
-    (when (nntp-marks-changed-p group server)
-      (nnheader-message 8 "Updating marks for %s..." group)
-      (nntp-open-marks group server)
-      ;; Update info using `nntp-marks'.
-      (mapc (lambda (pred)
-             (unless (memq (cdr pred) gnus-article-unpropagated-mark-lists)
-               (gnus-info-set-marks
-                info
-                (gnus-update-alist-soft
-                 (cdr pred)
-                 (cdr (assq (cdr pred) nntp-marks))
-                 (gnus-info-marks info))
-                t)))
-           gnus-article-mark-lists)
-      (let ((seen (cdr (assq 'read nntp-marks))))
-       (gnus-info-set-read info
-                           (if (and (integerp (car seen))
-                                    (null (cdr seen)))
-                               (list (cons (car seen) (car seen)))
-                             seen)))
-      (nnheader-message 8 "Updating marks for %s...done" group)))
-  nil)
-
-
 
 ;;; Hooky functions.
 
@@ -1355,8 +1294,8 @@ password contained in '~/.nntp-authinfo'."
                   (nntp-kill-buffer ,pbuffer)))))
         (process
          (condition-case err
-             (let ((coding-system-for-read nntp-coding-system-for-read)
-                   (coding-system-for-write nntp-coding-system-for-write)
+             (let ((coding-system-for-read 'binary)
+                   (coding-system-for-write 'binary)
                    (map '((nntp-open-network-stream network)
                           (network-only plain) ; compat
                           (nntp-open-plain-stream plain)
@@ -2165,95 +2104,6 @@ Please refer to the following variables to customize the connection:
        (delete-region (point) (point-max)))
       proc)))
 
-;; Marks handling
-
-(defun nntp-marks-directory (server)
-  (expand-file-name server nntp-marks-directory))
-
-(defvar nntp-server-to-method-cache nil
-  "Alist of servers and select methods.")
-
-(defun nntp-group-pathname (server group &optional file)
-  "Return an absolute file name of FILE for GROUP on SERVER."
-  (let ((method (cdr (assoc server nntp-server-to-method-cache))))
-    (unless method
-      (push (cons server (setq method (or (gnus-server-to-method server)
-                                         (gnus-find-method-for-group group))))
-           nntp-server-to-method-cache))
-    (nnmail-group-pathname
-     (mm-decode-coding-string group
-                             (inline (gnus-group-name-charset method group)))
-     (nntp-marks-directory server)
-     file)))
-
-(defun nntp-possibly-create-directory (group server)
-  (let ((dir (nntp-group-pathname server group))
-       (file-name-coding-system nnmail-pathname-coding-system))
-    (unless (file-exists-p dir)
-      (make-directory (directory-file-name dir) t)
-      (nnheader-message 5 "Creating nntp marks directory %s" dir))))
-
-(autoload 'time-less-p "time-date")
-
-(defun nntp-marks-changed-p (group server)
-  (let ((file (nntp-group-pathname server group nntp-marks-file-name))
-       (file-name-coding-system nnmail-pathname-coding-system))
-    (if (null (gnus-gethash file nntp-marks-modtime))
-       t ;; never looked at marks file, assume it has changed
-      (time-less-p (gnus-gethash file nntp-marks-modtime)
-                  (nth 5 (file-attributes file))))))
-
-(defun nntp-save-marks (group server)
-  (let ((file-name-coding-system nnmail-pathname-coding-system)
-       (file (nntp-group-pathname server group nntp-marks-file-name)))
-    (condition-case err
-       (progn
-         (nntp-possibly-create-directory group server)
-         (with-temp-file file
-           (erase-buffer)
-           (gnus-prin1 nntp-marks)
-           (insert "\n"))
-         (gnus-sethash file
-                       (nth 5 (file-attributes file))
-                       nntp-marks-modtime))
-      (error (or (gnus-yes-or-no-p
-                 (format "Could not write to %s (%s).  Continue? " file err))
-                (error "Cannot write to %s (%s)" file err))))))
-
-(defun nntp-open-marks (group server)
-  (let ((file (nntp-group-pathname server group nntp-marks-file-name))
-       (file-name-coding-system nnmail-pathname-coding-system))
-    (if (file-exists-p file)
-       (condition-case err
-           (with-temp-buffer
-             (gnus-sethash file (nth 5 (file-attributes file))
-                           nntp-marks-modtime)
-             (nnheader-insert-file-contents file)
-             (setq nntp-marks (read (current-buffer)))
-             (dolist (el gnus-article-unpropagated-mark-lists)
-               (setq nntp-marks (gnus-remassoc el nntp-marks))))
-         (error (or (gnus-yes-or-no-p
-                     (format "Error reading nntp marks file %s (%s).  Continuing will use marks from .newsrc.eld.  Continue? " file err))
-                    (error "Cannot read nntp marks file %s (%s)" file err))))
-      ;; User didn't have a .marks file.  Probably first time
-      ;; user of the .marks stuff.  Bootstrap it from .newsrc.eld.
-      (let ((info (gnus-get-info
-                  (gnus-group-prefixed-name
-                   group
-                   (gnus-server-to-method (format "nntp:%s" server)))))
-           (decoded-name (mm-decode-coding-string
-                          group
-                          (gnus-group-name-charset
-                           (gnus-server-to-method server) group))))
-       (nnheader-message 7 "Bootstrapping marks for %s..." decoded-name)
-       (setq nntp-marks (gnus-info-marks info))
-       (push (cons 'read (gnus-info-read info)) nntp-marks)
-       (dolist (el gnus-article-unpropagated-mark-lists)
-         (setq nntp-marks (gnus-remassoc el nntp-marks)))
-       (nntp-save-marks group server)
-       (nnheader-message 7 "Bootstrapping marks for %s...done"
-                         decoded-name)))))
-
 (provide 'nntp)
 
 ;;; nntp.el ends here
index a171cb35ae405ff164eb2faeec7a132eef2d51c7..8c9c984ba2eef110d19eac654e2741b78b2532ed 100644 (file)
@@ -365,7 +365,7 @@ Valid types include `google', `dejanews', and `gmane'.")
                               (match-string 1)
                               (match-string 2)
                               (or (match-string 3)
-                                  (substring (current-time-string) -4)))
+                                  (format-time-string "%Y")))
                     (current-time-string)))
        (setq From (match-string 4)))
       (widen)
index cbd5e2a3b0a8f6ca60eb5cc8c9795a95fa4e16f9..6d5424e833d6964caa73e08450c67fa7a6da9f89 100644 (file)
 ;;
 ;; Editing:
 ;;
-;; Currently not supported but in the future plstore will provide a
-;; major mode to edit PLSTORE files.
+;; This file also provides `plstore-mode', a major mode for editing
+;; the PLSTORE format file.  Visit a non-existing file and put the
+;; following line:
+;;
+;; (("foo" :host "foo.example.org" :secret-user "user"))
+;;
+;; where the prefixing `:secret-' means the property (without
+;; `:secret-' prefix) is marked as secret.  Thus, when you save the
+;; buffer, the `:secret-user' property is encrypted as `:user'.
+;;
+;; You can toggle the view between encrypted form and the decrypted
+;; form with C-c C-c.
 
 ;;; Code:
 
@@ -107,6 +117,10 @@ symmetric encryption will be used.")
 
 (put 'plstore-encrypt-to 'permanent-local t)
 
+(defvar plstore-encoded nil)
+
+(put 'plstore-encoded 'permanent-local t)
+
 (defvar plstore-cache-passphrase-for-symmetric-encryption nil)
 (defvar plstore-passphrase-alist nil)
 
@@ -194,10 +208,6 @@ symmetric encryption will be used.")
                     (generate-new-buffer (format " plstore %s" filename))))
         (store (plstore--make buffer)))
     (with-current-buffer buffer
-      ;; In the future plstore will provide a major mode called
-      ;; `plstore-mode' to edit PLSTORE files.
-      (if (eq major-mode 'plstore-mode)
-         (error "%s is opened for editing; kill the buffer first" file))
       (erase-buffer)
       (condition-case nil
          (insert-file-contents-literally file)
@@ -435,6 +445,131 @@ If no one is selected, symmetric encryption will be performed.  "
     (plstore--insert-buffer plstore)
     (save-buffer)))
 
+(defun plstore--encode (plstore)
+  (plstore--decrypt plstore)
+  (let ((merged-alist (plstore--get-merged-alist plstore)))
+    (concat "("
+           (mapconcat
+            (lambda (entry)
+              (setq entry (copy-sequence entry))
+              (let ((merged-plist (cdr (assoc (car entry) merged-alist)))
+                    (plist (cdr entry)))
+                (while plist
+                  (if (string-match "\\`:secret-" (symbol-name (car plist)))
+                      (setcar (cdr plist)
+                              (plist-get
+                               merged-plist
+                               (intern (concat ":"
+                                               (substring (symbol-name
+                                                           (car plist))
+                                                          (match-end 0)))))))
+                  (setq plist (nthcdr 2 plist)))
+                (prin1-to-string entry)))
+            (plstore--get-alist plstore)
+            "\n")
+           ")")))
+
+(defun plstore--decode (string)
+  (let* ((alist (car (read-from-string string)))
+        (pointer alist)
+        secret-alist
+        plist
+        entry)
+    (while pointer
+      (unless (stringp (car (car pointer)))
+       (error "Invalid PLSTORE format %s" string))
+      (setq plist (cdr (car pointer)))
+      (while plist
+       (when (string-match "\\`:secret-" (symbol-name (car plist)))
+         (setq entry (assoc (car (car pointer)) secret-alist))
+         (unless entry
+           (setq entry (list (car (car pointer)))
+                 secret-alist (cons entry secret-alist)))
+         (setcdr entry (plist-put (cdr entry)
+                                  (intern (concat ":"
+                                               (substring (symbol-name
+                                                           (car plist))
+                                                          (match-end 0))))
+                                  (car (cdr plist))))
+         (setcar (cdr plist) t))
+       (setq plist (nthcdr 2 plist)))
+      (setq pointer (cdr pointer)))
+    (plstore--make nil alist nil secret-alist)))
+
+(defun plstore--write-contents-functions ()
+  (when plstore-encoded
+    (let ((store (plstore--decode (buffer-string)))
+         (file (buffer-file-name)))
+      (unwind-protect
+         (progn
+           (set-visited-file-name nil)
+           (with-temp-buffer
+             (plstore--insert-buffer store)
+             (write-region (buffer-string) nil file)))
+       (set-visited-file-name file)
+       (set-buffer-modified-p nil))
+      t)))
+
+(defun plstore-mode-original ()
+  "Show the original form of the this buffer."
+  (interactive)
+  (when plstore-encoded
+    (if (and (buffer-modified-p)
+            (y-or-n-p "Save buffer before reading the original form? "))
+       (save-buffer))
+    (erase-buffer)
+    (insert-file-contents-literally (buffer-file-name))
+    (set-buffer-modified-p nil)
+    (setq plstore-encoded nil)))
+
+(defun plstore-mode-decoded ()
+  "Show the decoded form of the this buffer."
+  (interactive)
+  (unless plstore-encoded
+    (if (and (buffer-modified-p)
+            (y-or-n-p "Save buffer before decoding? "))
+       (save-buffer))
+    (let ((store (plstore--make (current-buffer))))
+      (plstore--init-from-buffer store)
+      (erase-buffer)
+      (insert
+       (substitute-command-keys "\
+;;; You are looking at the decoded form of the PLSTORE file.\n\
+;;; To see the original form content, do \\[plstore-mode-toggle-display]\n\n"))
+      (insert (plstore--encode store))
+      (set-buffer-modified-p nil)
+      (setq plstore-encoded t))))
+
+(defun plstore-mode-toggle-display ()
+  "Toggle the display mode of PLSTORE between the original and decoded forms."
+  (interactive)
+  (if plstore-encoded
+      (plstore-mode-original)
+    (plstore-mode-decoded)))
+
+(eval-when-compile
+  (defmacro plstore-called-interactively-p (kind)
+    (condition-case nil
+        (progn
+          (eval '(called-interactively-p 'any))
+          ;; Emacs >=23.2
+          `(called-interactively-p ,kind))
+      ;; Emacs <23.2
+      (wrong-number-of-arguments '(called-interactively-p))
+      ;; XEmacs
+      (void-function '(interactive-p)))))
+
+;;;###autoload
+(define-derived-mode plstore-mode emacs-lisp-mode "PLSTORE"
+  "Major mode for editing PLSTORE files."
+  (make-local-variable 'plstore-encoded)
+  (add-hook 'write-contents-functions #'plstore--write-contents-functions)
+  (define-key plstore-mode-map "\C-c\C-c" #'plstore-mode-toggle-display)
+  ;; to create a new file with plstore-mode, mark it as already decoded
+  (if (plstore-called-interactively-p 'any)
+      (setq plstore-encoded t)
+    (plstore-mode-decoded)))
+
 (provide 'plstore)
 
 ;;; plstore.el ends here
index ee4345c2f4fee1f7e268a196779790bb2283ed89..25330989e00292ff4e464b29a74580a67e603a69 100644 (file)
@@ -194,10 +194,16 @@ Use streaming commands."
     (unless (memq (process-status process) '(open run))
       (error "pop3 process died"))
     (when total-size
-      (message "pop3 retrieved %dKB (%d%%)"
-              (truncate (/ (buffer-size) 1000))
-              (truncate (* (/ (* (buffer-size) 1.0)
-                              total-size) 100))))
+      (let ((size 0))
+       (goto-char (point-min))
+       (while (re-search-forward "^\\+OK.*\n" nil t)
+         (setq size (+ size (- (point))
+                       (if (re-search-forward "^\\.\r?\n" nil 'move)
+                           (match-beginning 0)
+                         (point)))))
+       (message "pop3 retrieved %dKB (%d%%)"
+                (truncate (/ size 1000))
+                (truncate (* (/ (* size 1.0) total-size) 100)))))
     (pop3-accept-process-output process))
   start-point)
 
index c54fe3e3d712221057c747056f445035eddaf611..7b1029a2690242a602274e5be4e408973ade2599 100644 (file)
 
 (eval-when-compile (require 'cl))
 
-(eval-when-compile
-  (when (null (ignore-errors (require 'ert)))
-    (defmacro* ert-deftest (name () &body docstring-keys-and-body))))
-
-(ignore-errors
-  (require 'ert))
-(eval-and-compile
-  (or (ignore-errors (progn
-                       (require 'eieio)
-                       (require 'eieio-base)))
-      ;; gnus-fallback-lib/ from gnus/lisp/gnus-fallback-lib
-      (ignore-errors
-        (let ((load-path (cons (expand-file-name
-                                "gnus-fallback-lib/eieio"
-                                (file-name-directory (locate-library "gnus")))
-                               load-path)))
-          (require 'eieio)
-          (require 'eieio-base)))
-      (error
-       "eieio not found in `load-path' or gnus-fallback-lib/ directory.")))
+(require 'eieio)
+(require 'eieio-base)
 
 (defclass registry-db (eieio-persistent)
   ((version :initarg :version
@@ -373,111 +355,5 @@ Proposes any entries over the max-hard limit minus size * prune-factor."
                             collect k)))
       (list limit candidates))))
 
-(ert-deftest registry-instantiation-test ()
-  (should (registry-db "Testing")))
-
-(ert-deftest registry-match-test ()
-  (let ((entry '((hello "goodbye" "bye") (blank))))
-
-    (message "Testing :regex matching")
-    (should (registry--match :regex entry '((hello "nye" "bye"))))
-    (should (registry--match :regex entry '((hello "good"))))
-    (should-not (registry--match :regex entry '((hello "nye"))))
-    (should-not (registry--match :regex entry '((hello))))
-
-    (message "Testing :member matching")
-    (should (registry--match :member entry '((hello "bye"))))
-    (should (registry--match :member entry '((hello "goodbye"))))
-    (should-not (registry--match :member entry '((hello "good"))))
-    (should-not (registry--match :member entry '((hello "nye"))))
-    (should-not (registry--match :member entry '((hello)))))
-  (message "Done with matching testing."))
-
-(defun registry-make-testable-db (n &optional name file)
-  (let* ((db (registry-db
-              (or name "Testing")
-              :file (or file "unused")
-              :max-hard n
-              :max-soft 0               ; keep nothing not precious
-              :precious '(extra more-extra)
-              :tracked '(sender subject groups))))
-    (dotimes (i n)
-      (registry-insert db i `((sender "me")
-                              (subject "about you")
-                              (more-extra) ; empty data key should be pruned
-                              ;; first 5 entries will NOT have this extra data
-                              ,@(when (< 5 i) (list (list 'extra "more data")))
-                              (groups ,(number-to-string i)))))
-    db))
-
-(ert-deftest registry-usage-test ()
-  (let* ((n 100)
-         (db (registry-make-testable-db n)))
-    (message "size %d" n)
-    (should (= n (registry-size db)))
-    (message "max-hard test")
-    (should-error (registry-insert db "new" '()))
-    (message "Individual lookup")
-    (should (= 58 (caadr (registry-lookup db '(1 58 99)))))
-    (message "Grouped individual lookup")
-    (should (= 3 (length (registry-lookup db '(1 58 99)))))
-    (when (boundp 'lexical-binding)
-      (message "Individual lookup (breaks before lexbind)")
-      (should (= 58
-                 (caadr (registry-lookup-breaks-before-lexbind db '(1 58 99)))))
-      (message "Grouped individual lookup (breaks before lexbind)")
-      (should (= 3
-                 (length (registry-lookup-breaks-before-lexbind db
-                                                                '(1 58 99))))))
-    (message "Search")
-    (should (= n (length (registry-search db :all t))))
-    (should (= n (length (registry-search db :member '((sender "me"))))))
-    (message "Secondary index search")
-    (should (= n (length (registry-lookup-secondary-value db 'sender "me"))))
-    (should (equal '(74) (registry-lookup-secondary-value db 'groups "74")))
-    (message "Delete")
-    (should (registry-delete db '(1) t))
-    (decf n)
-    (message "Search after delete")
-    (should (= n (length (registry-search db :all t))))
-    (message "Secondary search after delete")
-    (should (= n (length (registry-lookup-secondary-value db 'sender "me"))))
-    ;; (message "Pruning")
-    ;; (let* ((tokeep (registry-search db :member '((extra "more data"))))
-    ;;        (count (- n (length tokeep)))
-    ;;        (pruned (registry-prune db))
-    ;;        (prune-count (length pruned)))
-    ;;   (message "Expecting to prune %d entries and pruned %d"
-    ;;            count prune-count)
-    ;;   (should (and (= count 5)
-    ;;                (= count prune-count))))
-    (message "Done with usage testing.")))
-
-(ert-deftest registry-persistence-test ()
-  (let* ((n 100)
-         (tempfile (make-temp-file "registry-persistence-"))
-         (name "persistence tester")
-         (db (registry-make-testable-db n name tempfile))
-         size back)
-    (message "Saving to %s" tempfile)
-    (eieio-persistent-save db)
-    (setq size (nth 7 (file-attributes tempfile)))
-    (message "Saved to %s: size %d" tempfile size)
-    (should (< 0 size))
-    (with-temp-buffer
-      (insert-file-contents-literally tempfile)
-      (should (looking-at (concat ";; Object "
-                                  name
-                                  "\n;; EIEIO PERSISTENT OBJECT"))))
-    (message "Reading object back")
-    (setq back (eieio-persistent-read tempfile))
-    (should back)
-    (message "Read object back: %d keys, expected %d==%d"
-             (registry-size back) n (registry-size db))
-    (should (= (registry-size back) n))
-    (should (= (registry-size back) (registry-size db)))
-    (delete-file tempfile))
-  (message "Done with persistence testing."))
-
 (provide 'registry)
 ;;; registry.el ends here
index 0d9b052f42514a174224f3fb3b17fb561bdbf820..e7a6c5d20810b3bd0c4a7db432acb02859189532 100644 (file)
@@ -119,6 +119,7 @@ cid: URL as the argument.")
   (let ((map (make-sparse-keymap)))
     (define-key map "a" 'shr-show-alt-text)
     (define-key map "i" 'shr-browse-image)
+    (define-key map "z" 'shr-zoom-image)
     (define-key map "I" 'shr-insert-image)
     (define-key map "u" 'shr-copy-url)
     (define-key map "v" 'shr-browse-url)
@@ -128,17 +129,23 @@ cid: URL as the argument.")
 
 ;; Public functions and commands.
 
-(defun shr-visit-file (file)
-  "Parse FILE as an HTML document, and render it in a new buffer."
-  (interactive "fHTML file name: ")
+(defun shr-render-buffer (buffer)
+  "Display the HTML rendering of the current buffer."
+  (interactive (list (current-buffer)))
   (pop-to-buffer "*html*")
   (erase-buffer)
   (shr-insert-document
-   (with-temp-buffer
-     (insert-file-contents file)
+   (with-current-buffer buffer
      (libxml-parse-html-region (point-min) (point-max))))
   (goto-char (point-min)))
 
+(defun shr-visit-file (file)
+  "Parse FILE as an HTML document, and render it in a new buffer."
+  (interactive "fHTML file name: ")
+  (with-temp-buffer
+    (insert-file-contents file)
+    (shr-render-buffer (current-buffer))))
+
 ;;;###autoload
 (defun shr-insert-document (dom)
   "Render the parsed document DOM into the current buffer.
@@ -235,6 +242,40 @@ the URL of the image to the kill buffer instead."
                    (list (current-buffer) (1- (point)) (point-marker))
                    t t))))
 
+(defun shr-zoom-image ()
+  "Toggle the image size.
+The size will be rotated between the default size, the original
+size, and full-buffer size."
+  (interactive)
+  (let ((url (get-text-property (point) 'image-url))
+       (size (get-text-property (point) 'image-size))
+       (buffer-read-only nil))
+    (if (not url)
+       (message "No image under point")
+      ;; Delete the old picture.
+      (while (get-text-property (point) 'image-url)
+       (forward-char -1))
+      (forward-char 1)
+      (let ((start (point)))
+       (while (get-text-property (point) 'image-url)
+         (forward-char 1))
+       (forward-char -1)
+       (put-text-property start (point) 'display nil)
+       (when (> (- (point) start) 2)
+         (delete-region start (1- (point)))))
+      (message "Inserting %s..." url)
+      (url-retrieve url 'shr-image-fetched
+                   (list (current-buffer) (1- (point)) (point-marker)
+                         (list (cons 'size
+                                     (cond ((or (eq size 'default)
+                                                (null size))
+                                            'original)
+                                           ((eq size 'original)
+                                            'full)
+                                           ((eq size 'full)
+                                            'default)))))
+                   t))))
+
 ;;; Utility functions.
 
 (defun shr-transform-dom (dom)
@@ -298,6 +339,7 @@ the URL of the image to the kill buffer instead."
 
 (defun shr-insert (text)
   (when (and (eq shr-state 'image)
+            (not (bolp))
             (not (string-match "\\`[ \t\n]+\\'" text)))
     (insert "\n")
     (setq shr-state nil))
@@ -305,11 +347,11 @@ the URL of the image to the kill buffer instead."
    ((eq shr-folding-mode 'none)
     (insert text))
    (t
-    (when (and (string-match "\\`[ \t\n]" text)
+    (when (and (string-match "\\`[ \t\n ]" text)
               (not (bolp))
               (not (eq (char-after (1- (point))) ? )))
       (insert " "))
-    (dolist (elem (split-string text))
+    (dolist (elem (split-string text "[ \f\t\n\r\v ]+" t))
       (when (and (bolp)
                 (> shr-indentation 0))
        (shr-indent))
@@ -349,7 +391,7 @@ the URL of the image to the kill buffer instead."
            (shr-indent))
          (end-of-line))
        (insert " ")))
-    (unless (string-match "[ \t\n]\\'" text)
+    (unless (string-match "[ \t\n ]\\'" text)
       (delete-char -1)))))
 
 (defun shr-find-fill-point ()
@@ -408,32 +450,29 @@ the URL of the image to the kill buffer instead."
                         (shr-char-kinsoku-eol-p (following-char)))))
           (goto-char bp)))
        ((shr-char-kinsoku-eol-p (preceding-char))
-        (if (shr-char-kinsoku-eol-p (following-char))
-            ;; There are consecutive kinsoku-eol characters.
-            (setq failed t)
-          (let ((count 4))
-            (while
-                (progn
-                  (backward-char 1)
-                  (and (> (setq count (1- count)) 0)
-                       (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
-                       (or (shr-char-kinsoku-eol-p (preceding-char))
-                           (shr-char-kinsoku-bol-p (following-char)))))))
-          (if (setq failed (= (current-column) shr-indentation))
-              ;; There's no breakable point that doesn't violate kinsoku,
-              ;; so we go to the second best position.
-              (if (looking-at "\\(\\c<+\\)\\c<")
-                  (goto-char (match-end 1))
-                (forward-char 1)))))
-       (t
-        (if (shr-char-kinsoku-bol-p (preceding-char))
-            ;; There are consecutive kinsoku-bol characters.
-            (setq failed t)
-          (let ((count 4))
-            (while (and (>= (setq count (1- count)) 0)
+        ;; Find backward the point where kinsoku-eol characters begin.
+        (let ((count 4))
+          (while
+              (progn
+                (backward-char 1)
+                (and (> (setq count (1- count)) 0)
+                     (not (memq (preceding-char) (list ?\C-@ ?\n ? )))
+                     (or (shr-char-kinsoku-eol-p (preceding-char))
+                         (shr-char-kinsoku-bol-p (following-char)))))))
+        (if (setq failed (= (current-column) shr-indentation))
+            ;; There's no breakable point that doesn't violate kinsoku,
+            ;; so we go to the second best position.
+            (if (looking-at "\\(\\c<+\\)\\c<")
+                (goto-char (match-end 1))
+              (forward-char 1))))
+       ((shr-char-kinsoku-bol-p (following-char))
+        ;; Find forward the point where kinsoku-bol characters end.
+        (let ((count 4))
+          (while (progn
+                   (forward-char 1)
+                   (and (>= (setq count (1- count)) 0)
                         (shr-char-kinsoku-bol-p (following-char))
-                        (shr-char-breakable-p (following-char)))
-              (forward-char 1))))))
+                        (shr-char-breakable-p (following-char))))))))
        (when (eq (following-char) ? )
         (forward-char 1))))
     (not failed)))
@@ -468,7 +507,7 @@ the URL of the image to the kill buffer instead."
       (if (save-excursion
            (beginning-of-line)
            (looking-at " *$"))
-         (insert "\n")
+         (delete-region (match-beginning 0) (match-end 0))
        (insert "\n\n")))))
 
 (defun shr-indent ()
@@ -526,7 +565,7 @@ the URL of the image to the kill buffer instead."
                    (expand-file-name (file-name-nondirectory url)
                                      directory)))))
 
-(defun shr-image-fetched (status buffer start end)
+(defun shr-image-fetched (status buffer start end &optional flags)
   (let ((image-buffer (current-buffer)))
     (when (and (buffer-name buffer)
               (not (plist-get status :error)))
@@ -537,30 +576,53 @@ the URL of the image to the kill buffer instead."
          (with-current-buffer buffer
            (save-excursion
              (let ((alt (buffer-substring start end))
+                   (properties (text-properties-at start))
                    (inhibit-read-only t))
                (delete-region start end)
                (goto-char start)
-               (funcall shr-put-image-function data alt)))))))
+               (funcall shr-put-image-function data alt flags)
+               (while properties
+                 (let ((type (pop properties))
+                       (value (pop properties)))
+                   (unless (memq type '(display image-size))
+                     (put-text-property start (point) type value))))))))))
     (kill-buffer image-buffer)))
 
-(defun shr-put-image (data alt)
+(defun shr-put-image (data alt &optional flags)
   "Put image DATA with a string ALT.  Return image."
   (if (display-graphic-p)
-      (let ((image (ignore-errors
-                     (shr-rescale-image data))))
+      (let* ((size (cdr (assq 'size flags)))
+            (start (point))
+            (image (cond
+                    ((eq size 'original)
+                     (create-image data nil t :ascent 100))
+                    ((eq size 'full)
+                     (ignore-errors
+                       (shr-rescale-image data t)))
+                    (t
+                     (ignore-errors
+                       (shr-rescale-image data))))))
         (when image
          ;; When inserting big-ish pictures, put them at the
          ;; beginning of the line.
          (when (and (> (current-column) 0)
                     (> (car (image-size image t)) 400))
            (insert "\n"))
-         (insert-image image (or alt "*"))
+         (if (eq size 'original)
+             (let ((overlays (overlays-at (point))))
+               (insert-sliced-image image (or alt "*") nil 20 1)
+               (dolist (overlay overlays)
+                 (overlay-put overlay 'face 'default)))
+           (insert-image image (or alt "*")))
+         (put-text-property start (point) 'image-size size)
          (when (image-animated-p image)
            (image-animate image nil 60)))
        image)
     (insert alt)))
 
-(defun shr-rescale-image (data)
+(defun shr-rescale-image (data &optional force)
+  "Rescale DATA, if too big, to fit the current buffer.
+If FORCE, rescale the image anyway."
   (let ((image (create-image data nil t :ascent 100)))
     (if (or (not (fboundp 'imagemagick-types))
            (not (get-buffer-window (current-buffer))))
@@ -575,7 +637,8 @@ the URL of the image to the kill buffer instead."
             (window-height (truncate (* shr-max-image-proportion
                                         (- (nth 3 edges) (nth 1 edges)))))
             scaled-image)
-       (when (> height window-height)
+       (when (or force
+                 (> height window-height))
          (setq image (or (create-image data 'imagemagick t
                                        :height window-height
                                        :ascent 100)
@@ -987,7 +1050,12 @@ ones, in case fg and bg are nil."
     (shr-generic cont)))
 
 (defun shr-tag-br (cont)
-  (unless (bobp)
+  (when (and (not (bobp))
+            ;; Only add a newline if we break the current line, or
+            ;; the previous line isn't a blank line.
+            (or (not (bolp))
+                (and (> (- (point) 2) (point-min))
+                     (not (= (char-after (- (point) 2)) ?\n)))))
     (insert "\n")
     (shr-indent))
   (shr-generic cont))
index 73f4970fcd40f04f0eac9d1da6ce40201e9e12cd..7492142947e7cefea13e792cea546d7722587c3b 100644 (file)
@@ -678,7 +678,7 @@ The following commands are available:
                  "x509" "-in" (expand-file-name certfile) "-text")
     (fundamental-mode)
     (set-buffer-modified-p nil)
-    (toggle-read-only t)
+    (setq buffer-read-only t)
     (goto-char (point-min))))
 
 (defun smime-draw-buffer ()
index 3cfbd7dba3552b8742e7be5bf16dc5c7aae98d6e..c3be15adc1a0a92449faeeb3250e0e8a72ad3b68 100644 (file)
@@ -2088,11 +2088,6 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
 
 ;; all this is done inside a condition-case to trap errors
 
-(eval-when-compile
-  (autoload 'bbdb-buffer "bbdb")
-  (autoload 'bbdb-create-internal "bbdb")
-  (autoload 'bbdb-search-simple "bbdb"))
-
 ;; Autoloaded in message, which we require.
 (declare-function gnus-extract-address-components "gnus-util" (from))
 
@@ -2104,9 +2099,13 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
           (file-error
            ;; `bbdb-records' should not be bound as an autoload function
            ;; before loading bbdb because of `bbdb-hashtable-size'.
+           (defalias 'bbdb-buffer 'ignore)
+           (defalias 'bbdb-create-internal 'ignore)
            (defalias 'bbdb-records 'ignore)
            (defalias 'spam-BBDB-register-routine 'ignore)
            (defalias 'spam-enter-ham-BBDB 'ignore)
+           (defalias 'spam-exists-in-BBDB-p 'ignore)
+           (defalias 'bbdb-gethash 'ignore)
            nil))
 
     ;; when the BBDB changes, we want to clear out our cache
@@ -2126,7 +2125,7 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
                                     'ignore))
                  (net-address (nth 1 parsed-address))
                  (record (and net-address
-                              (bbdb-search-simple nil net-address))))
+                              (spam-exists-in-BBDB-p net-address))))
             (when net-address
               (gnus-message 6 "%s address %s %s BBDB"
                             (if remove "Deleting" "Adding")
@@ -2148,15 +2147,17 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
     (defun spam-BBDB-unregister-routine (articles)
       (spam-BBDB-register-routine articles t))
 
+    (defsubst spam-exists-in-BBDB-p (net)
+      (when (and (stringp net) (not (zerop (length net))))
+        (bbdb-records)
+        (bbdb-gethash (downcase net))))
+
     (defun spam-check-BBDB ()
       "Mail from people in the BBDB is classified as ham or non-spam"
-      (let ((who (message-fetch-field "from")))
-        (when who
-          (setq who (nth 1 (gnus-extract-address-components who)))
-          (if
-              (if (fboundp 'bbdb-search)
-                  (bbdb-search (bbdb-records) who) ;; v3
-                (bbdb-search-simple nil who)) ;; v2
+      (let ((net (message-fetch-field "from")))
+        (when net
+          (setq net (nth 1 (gnus-extract-address-components net)))
+          (if (spam-exists-in-BBDB-p net)
               t
             (if spam-use-BBDB-exclusive
                 spam-split-group
index ed52be6cc1e5264129be11b645774be99e81c532..2e56da0bcaa67223ada809e815e580bd36675ae7 100644 (file)
@@ -380,6 +380,42 @@ suitable file is found, return nil."
 
 (declare-function ad-get-advice-info "advice" (function))
 
+(defun help-fns--compiler-macro (function)
+  (let ((handler nil))
+    ;; FIXME: Copied from macroexp.el.
+    (while (and (symbolp function)
+                (not (setq handler (get function 'compiler-macro)))
+                (fboundp function))
+      ;; Follow the sequence of aliases.
+      (setq function (symbol-function function)))
+    (when handler
+      (princ "This function has a compiler macro")
+      (let ((lib (get function 'compiler-macro-file)))
+        ;; FIXME: rather than look at the compiler-macro-file property,
+        ;; just look at `handler' itself.
+        (when (stringp lib)
+          (princ (format " in `%s'" lib))
+          (with-current-buffer standard-output
+            (save-excursion
+              (re-search-backward "`\\([^`']+\\)'" nil t)
+              (help-xref-button 1 'help-function-cmacro function lib)))))
+      (princ ".\n\n"))))
+
+;; We could use `symbol-file' but this is a wee bit more efficient.
+(defun help-fns--autoloaded-p (function file)
+  "Return non-nil if FUNCTION has previously been autoloaded.
+FILE is the file where FUNCTION was probably defined."
+  (let* ((file (file-name-sans-extension (file-truename file)))
+        (load-hist load-history)
+        (target (cons t function))
+        found)
+    (while (and load-hist (not found))
+      (and (caar load-hist)
+          (equal (file-name-sans-extension (caar load-hist)) file)
+          (setq found (member target (cdar load-hist))))
+      (setq load-hist (cdr load-hist)))
+    found))
+
 ;;;###autoload
 (defun describe-function-1 (function)
   (let* ((advised (and (symbolp function) (featurep 'advice)
@@ -395,59 +431,67 @@ suitable file is found, return nil."
         (def (if (symbolp real-function)
                  (symbol-function real-function)
                function))
-        file-name string
-        (beg (if (commandp def) "an interactive " "a "))
+        (aliased (symbolp def))
+        (real-def (if aliased
+                      (let ((f def))
+                        (while (and (fboundp f)
+                                    (symbolp (symbol-function f)))
+                          (setq f (symbol-function f)))
+                        f)
+                    def))
+        (file-name (find-lisp-object-file-name function def))
          (pt1 (with-current-buffer (help-buffer) (point)))
-        errtype)
-    (setq string
-         (cond ((or (stringp def) (vectorp def))
-                "a keyboard macro")
-               ((subrp def)
-                (if (eq 'unevalled (cdr (subr-arity def)))
-                    (concat beg "special form")
-                  (concat beg "built-in function")))
-               ((byte-code-function-p def)
-                (concat beg "compiled Lisp function"))
-               ((symbolp def)
-                (while (and (fboundp def)
-                            (symbolp (symbol-function def)))
-                  (setq def (symbol-function def)))
-                ;; Handle (defalias 'foo 'bar), where bar is undefined.
-                (or (fboundp def) (setq errtype 'alias))
-                (format "an alias for `%s'" def))
-               ((eq (car-safe def) 'lambda)
-                (concat beg "Lisp function"))
-               ((eq (car-safe def) 'macro)
-                "a Lisp macro")
-               ((eq (car-safe def) 'closure)
-                (concat beg "Lisp closure"))
-               ((eq (car-safe def) 'autoload)
-                (format "%s autoloaded %s"
-                        (if (commandp def) "an interactive" "an")
-                        (if (eq (nth 4 def) 'keymap) "keymap"
-                          (if (nth 4 def) "Lisp macro" "Lisp function"))))
-                ((keymapp def)
-                 (let ((is-full nil)
-                       (elts (cdr-safe def)))
-                   (while elts
-                     (if (char-table-p (car-safe elts))
-                         (setq is-full t
-                               elts nil))
-                     (setq elts (cdr-safe elts)))
-                   (if is-full
-                       "a full keymap"
-                     "a sparse keymap")))
-               (t "")))
-    (princ string)
-    (if (eq errtype 'alias)
+        (beg (if (and (or (byte-code-function-p def)
+                          (keymapp def)
+                          (memq (car-safe def) '(macro lambda closure)))
+                      file-name
+                      (help-fns--autoloaded-p function file-name))
+                 (if (commandp def)
+                     "an interactive autoloaded "
+                   "an autoloaded ")
+               (if (commandp def) "an interactive " "a "))))
+
+    ;; Print what kind of function-like object FUNCTION is.
+    (princ (cond ((or (stringp def) (vectorp def))
+                 "a keyboard macro")
+                ((subrp def)
+                 (if (eq 'unevalled (cdr (subr-arity def)))
+                     (concat beg "special form")
+                   (concat beg "built-in function")))
+                ((byte-code-function-p def)
+                 (concat beg "compiled Lisp function"))
+                (aliased
+                 (format "an alias for `%s'" real-def))
+                ((eq (car-safe def) 'lambda)
+                 (concat beg "Lisp function"))
+                ((eq (car-safe def) 'macro)
+                 (concat beg "Lisp macro"))
+                ((eq (car-safe def) 'closure)
+                 (concat beg "Lisp closure"))
+                ((eq (car-safe def) 'autoload)
+                 (format "%s autoloaded %s"
+                         (if (commandp def) "an interactive" "an")
+                         (if (eq (nth 4 def) 'keymap) "keymap"
+                           (if (nth 4 def) "Lisp macro" "Lisp function"))))
+                ((keymapp def)
+                 (let ((is-full nil)
+                       (elts (cdr-safe def)))
+                   (while elts
+                     (if (char-table-p (car-safe elts))
+                         (setq is-full t
+                               elts nil))
+                     (setq elts (cdr-safe elts)))
+                   (concat beg (if is-full "keymap" "sparse keymap"))))
+                (t "")))
+
+    (if (and aliased (not (fboundp real-def)))
        (princ ",\nwhich is not defined.  Please make a bug report.")
       (with-current-buffer standard-output
        (save-excursion
          (save-match-data
            (when (re-search-backward "alias for `\\([^`']+\\)'" nil t)
-             (help-xref-button 1 'help-function def)))))
+             (help-xref-button 1 'help-function real-def)))))
 
-      (setq file-name (find-lisp-object-file-name function def))
       (when file-name
        (princ " in `")
        ;; We used to add .el to the file name,
@@ -509,25 +553,22 @@ suitable file is found, return nil."
            (fill-region-as-paragraph pt2 (point))
            (unless (looking-back "\n\n")
              (terpri)))))
-      ;; Note that list* etc do not get this property until
-      ;; cl-hack-byte-compiler runs, after bytecomp is loaded.
-      (when (and (symbolp function)
-                 (eq (get function 'byte-compile)
-                     'cl-byte-compile-compiler-macro))
-       (princ "This function has a compiler macro")
-       (let ((lib (get function 'compiler-macro-file)))
-         (when (stringp lib)
-           (princ (format " in `%s'" lib))
-           (with-current-buffer standard-output
-             (save-excursion
-               (re-search-backward "`\\([^`']+\\)'" nil t)
-               (help-xref-button 1 'help-function-cmacro function lib)))))
-       (princ ".\n\n"))
-      (let* ((advertised (gethash def advertised-signature-table t))
+      (help-fns--compiler-macro function)
+      (let* ((advertised (gethash real-def advertised-signature-table t))
             (arglist (if (listp advertised)
-                         advertised (help-function-arglist def)))
-            (doc (condition-case err (documentation function)
-                    (error (format "No Doc! %S" err))))
+                         advertised (help-function-arglist real-def)))
+            (doc-raw (condition-case err
+                         (documentation function t)
+                       (error (format "No Doc! %S" err))))
+            ;; If the function is autoloaded, and its docstring has
+            ;; key substitution constructs, load the library.
+            (doc (progn
+                   (and (eq (car-safe real-def) 'autoload)
+                        help-enable-auto-load
+                        (string-match "\\([^\\]=\\|[^=]\\|\\`\\)\\\\[[{<]"
+                                      doc-raw)
+                        (load (cadr real-def) t))
+                   (substitute-command-keys doc-raw)))
             (usage (help-split-fundoc doc function)))
        (with-current-buffer standard-output
          ;; If definition is a keymap, skip arglist note.
@@ -548,9 +589,9 @@ suitable file is found, return nil."
                                                          function)))))
                            usage)
                          (car usage))
-                        ((or (stringp def)
-                             (vectorp def))
-                         (format "\nMacro: %s" (format-kbd-macro def)))
+                        ((or (stringp real-def)
+                             (vectorp real-def))
+                         (format "\nMacro: %s" (format-kbd-macro real-def)))
                         (t "[Missing arglist.  Please make a bug report.]")))
                   (high (help-highlight-arguments use doc)))
              (let ((fill-begin (point)))
@@ -798,8 +839,12 @@ it is displayed along with the global value."
                    (obsolete (get variable 'byte-obsolete-variable))
                   (use (car obsolete))
                   (safe-var (get variable 'safe-local-variable))
-                   (doc (or (documentation-property variable 'variable-documentation)
-                            (documentation-property alias 'variable-documentation)))
+                   (doc (condition-case err
+                            (or (documentation-property
+                                 variable 'variable-documentation)
+                                (documentation-property
+                                 alias 'variable-documentation))
+                          (error (format "Doc not found: %S" err))))
                    (extra-line nil))
               ;; Add a note for variables that have been make-var-buffer-local.
               (when (and (local-variable-if-set-p variable)
@@ -807,7 +852,10 @@ it is displayed along with the global value."
                              (with-temp-buffer
                                (local-variable-if-set-p variable))))
                 (setq extra-line t)
-                (princ "  Automatically becomes buffer-local when set in any fashion.\n"))
+                (princ "  Automatically becomes ")
+               (if (get variable 'permanent-local)
+                   (princ "permanently "))
+               (princ "buffer-local when set.\n"))
 
               ;; Mention if it's an alias
               (unless (eq alias variable)
index b471962f21de1ee487e5ce3f4f5dce6330b79809..7b6490b6b13092a5b1df72fc7cb0a7180c36ed71 100644 (file)
@@ -30,7 +30,6 @@
 ;;; Code:
 
 (require 'button)
-(require 'view)
 (eval-when-compile (require 'easymenu))
 
 (defvar help-mode-map
@@ -40,6 +39,8 @@
     (define-key map [mouse-2] 'help-follow-mouse)
     (define-key map "\C-c\C-b" 'help-go-back)
     (define-key map "\C-c\C-f" 'help-go-forward)
+    (define-key map [XF86Back] 'help-go-back)
+    (define-key map [XF86Forward] 'help-go-forward)
     (define-key map "\C-c\C-c" 'help-follow-symbol)
     (define-key map "\r" 'help-follow)
     map)
@@ -265,6 +266,8 @@ The format is (FUNCTION ARGS...).")
   'help-function 'customize-create-theme
   'help-echo (purecopy "mouse-2, RET: edit this theme file"))
 \f
+(defvar bookmark-make-record-function)
+
 ;;;###autoload
 (define-derived-mode help-mode special-mode "Help"
   "Major mode for viewing help text and navigating references in it.
@@ -272,7 +275,9 @@ Entry to this mode runs the normal hook `help-mode-hook'.
 Commands:
 \\{help-mode-map}"
   (set (make-local-variable 'revert-buffer-function)
-       'help-mode-revert-buffer))
+       'help-mode-revert-buffer)
+  (set (make-local-variable 'bookmark-make-record-function)
+       'help-bookmark-make-record))
 
 ;;;###autoload
 (defun help-mode-setup ()
@@ -282,10 +287,7 @@ Commands:
 ;;;###autoload
 (defun help-mode-finish ()
   (when (eq major-mode 'help-mode)
-    ;; View mode's read-only status of existing *Help* buffer is lost
-    ;; by with-output-to-temp-buffer.
-    (toggle-read-only 1)
-
+    (setq buffer-read-only t)
     (save-excursion
       (goto-char (point-min))
       (let ((inhibit-read-only t))
@@ -494,14 +496,14 @@ that."
                            ((and
                              (or (boundp sym)
                                  (get sym 'variable-documentation))
-                             (or
-                              (documentation-property
-                               sym 'variable-documentation)
-                              (condition-case nil
+                             (condition-case err
+                                 (or
+                                  (documentation-property
+                                   sym 'variable-documentation)
                                   (documentation-property
                                    (indirect-variable sym)
-                                   'variable-documentation)
-                                (cyclic-variable-indirection nil))))
+                                   'variable-documentation))
+                               (error (message "No doc found: %S" err) nil)))
                             (help-xref-button 8 'help-variable sym))
                            ((fboundp sym)
                             (help-xref-button 8 'help-function sym)))))))
@@ -789,6 +791,37 @@ help buffer by other means."
   (with-output-to-temp-buffer (help-buffer)
     (insert string)))
 
+\f
+;; Bookmark support
+
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-make-record-default "bookmark"
+                  (&optional no-file no-context posn))
+
+(defun help-bookmark-make-record ()
+  "Create and return a help-mode bookmark record.
+Implements `bookmark-make-record-function' for help-mode buffers."
+  (unless (car help-xref-stack-item)
+    (error "Cannot create bookmark - help command not known"))
+  `(,@(bookmark-make-record-default 'NO-FILE 'NO-CONTEXT)
+      (help-fn     . ,(car help-xref-stack-item))
+      (help-args   . ,(cdr help-xref-stack-item))
+      (position    . ,(point))
+      (handler     . help-bookmark-jump)))
+
+;;;###autoload
+(defun help-bookmark-jump (bookmark)
+  "Jump to help-mode bookmark BOOKMARK.
+Handler function for record returned by `help-bookmark-make-record'.
+BOOKMARK is a bookmark name or a bookmark record."
+  (let ((help-fn    (bookmark-prop-get bookmark 'help-fn))
+        (help-args  (bookmark-prop-get bookmark 'help-args))
+        (position   (bookmark-prop-get bookmark 'position)))
+    (apply help-fn help-args)
+    (pop-to-buffer "*Help*")
+    (goto-char position)))
+
+
 (provide 'help-mode)
 
 ;;; help-mode.el ends here
index 317d5cf8f46520158ed78bdcbc13620d33d02ec9..c02b058fef9a54abecc8bc97bb30c0e20c95f33b 100644 (file)
@@ -942,7 +942,7 @@ is currently activated with completion."
       (error "Cannot find minor mode for `%s'" indicator))))
 
 (defun lookup-minor-mode-from-indicator (indicator)
-  "Return a minor mode symbol from its indicator on the modeline."
+  "Return a minor mode symbol from its indicator on the mode line."
   ;; remove first space if existed
   (if (and (< 0 (length indicator))
           (eq (aref indicator 0) ?\s))
@@ -1030,6 +1030,16 @@ by `with-help-window'"
   :group 'help
   :version "23.1")
 
+(defcustom help-enable-auto-load t
+  "Whether Help commands can perform autoloading.
+If non-nil, whenever \\[describe-function] is called for an
+autoloaded function whose docstring contains any key substitution
+construct (see `substitute-command-keys'), the library is loaded,
+so that the documentation can show the right key bindings."
+  :type 'boolean
+  :group 'help
+  :version "24.2")
+
 (defun help-window-display-message (quit-part window &optional scroll)
   "Display message telling how to quit and scroll help window.
 QUIT-PART is a string telling how to quit the help window WINDOW.
index 538d218e38e0eedba7ce6d88e50cfa757060a9d8..75094cd33b8008aaea16d57111560cfdd29bcc86 100644 (file)
@@ -41,7 +41,7 @@
 ;;; Code:
 
 (require 'eldoc)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;
 ;; vars here
   "Edit a file in a hex dump format using the hexl filter."
   :group 'data)
 
+(defcustom hexl-bits 16
+  "The bit grouping that hexl will use."
+  :type '(choice (const 8 )
+                 (const 16)
+                 (const 32)
+                 (const 64))
+  :group 'hexl
+  :version "24.2")
 
 (defcustom hexl-program "hexl"
   "The program that will hexlify and dehexlify its stdin.
@@ -67,7 +75,9 @@ and \"-de\" when dehexlifying a buffer."
 
 (defcustom hexl-options (format "-hex %s" hexl-iso)
   "Space separated options to `hexl-program' that suit your needs.
-Quoting cannot be used, so the arguments cannot themselves contain spaces."
+Quoting cannot be used, so the arguments cannot themselves contain spaces.
+If you wish to set the `-group-by-X-bits' options, set `hexl-bits' instead,
+as that will override any bit grouping options set here."
   :type 'string
   :group 'hexl)
 
@@ -212,10 +222,34 @@ Quoting cannot be used, so the arguments cannot themselves contain spaces."
      (2 'hexl-ascii-region t t)))
   "Font lock keywords used in `hexl-mode'.")
 
+(defun hexl-rulerize (string bits)
+  (let ((size (/ bits 4)) (strlen (length string)) (pos 0) (ruler ""))
+    (while (< pos strlen)
+      (setq ruler (concat ruler " " (substring string pos (+ pos size))))
+      (setq pos (+ pos size)))
+    (substring ruler 1) ))
+
+(defvar hexl-rulers
+  (mapcar
+   (lambda (bits)
+     (cons bits
+           (concat " 87654321  "
+                   (hexl-rulerize "00112233445566778899aabbccddeeff" bits)
+                   "  0123456789abcdef")))
+   '(8 16 32 64)))
 ;; routines
 
 (put 'hexl-mode 'mode-class 'special)
 
+;; 10 chars for the "address: "
+;; 32 chars for the hexlified bytes
+;; 1 char for the space
+;; 16 chars for the character display
+;; X chars for the spaces (128 bits divided by the hexl-bits)
+;; 1 char for the newline.
+(defun hexl-line-displen ()
+  "The length of a hexl display line (varies with `hexl-bits')."
+  (+ 60 (/ 128 (or hexl-bits 16))))
 
 (defun hexl-mode--minor-mode-p (var)
   (memq var '(ruler-mode hl-line-mode)))
@@ -248,7 +282,7 @@ using the function `hexlify-buffer'.
 Each line in the buffer has an \"address\" (displayed in hexadecimal)
 representing the offset into the file that the characters on this line
 are at and 16 characters from the file (displayed as hexadecimal
-values grouped every 16 bits) and as their ASCII values.
+values grouped every `hexl-bits' bits) and as their ASCII values.
 
 If any of the characters (displayed as ASCII characters) are
 unprintable (control or meta characters) they will be replaced as
@@ -330,10 +364,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
         (hexlify-buffer)
         (restore-buffer-modified-p modified))
       (set (make-local-variable 'hexl-max-address)
-           (let* ((full-lines (/ (buffer-size) 68))
-                  (last-line (% (buffer-size) 68))
-                  (last-line-bytes (% last-line 52)))
-             (+ last-line-bytes (* full-lines 16) -1)))
+           (+ (* (/ (1- (buffer-size)) (hexl-line-displen)) 16) 15))
       (condition-case nil
          (hexl-goto-address original-point)
        (error nil)))
@@ -389,8 +420,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
                                   " \\(?: .+\n[a-f0-9]+: \\)?"))
              textre))
         bound noerror count))
-    (let ((isearch-search-fun-function nil))
-      (isearch-search-fun))))
+    (isearch-search-fun-default)))
 
 (defvar hexl-in-save-buffer nil)
 
@@ -432,7 +462,7 @@ and edit the file in `hexl-mode'."
     (let ((completion-ignored-extensions nil))
       (read-file-name "Filename: " nil nil 'ret-must-match))))
   ;; Ignore the user's setting of default major-mode.
-  (letf (((default-value 'major-mode) 'fundamental-mode))
+  (cl-letf (((default-value 'major-mode) 'fundamental-mode))
     (find-file-literally filename))
   (if (not (eq major-mode 'hexl-mode))
       (hexl-mode)))
@@ -510,17 +540,20 @@ Ask the user for confirmation."
 (defun hexl-current-address (&optional validate)
   "Return current hexl-address."
   (interactive)
-  (let ((current-column (- (% (- (point) (point-min) -1) 68) 11))
+  (let ((current-column
+         (- (% (- (point) (point-min) -1) (hexl-line-displen)) 11))
        (hexl-address 0))
     (if (< current-column 0)
        (if validate
            (error "Point is not on a character in the file")
          (setq current-column 0)))
     (setq hexl-address
-         (+ (* (/ (- (point) (point-min) -1) 68) 16)
-            (if (>= current-column 41)
-                (- current-column 41)
-              (/ (- current-column  (/ current-column 5)) 2))))
+          (+ (* (/ (- (point) (point-min) -1)
+                   (hexl-line-displen)) 16)
+            (if (>= current-column (- (hexl-ascii-start-column) 10))
+                (- current-column (- (hexl-ascii-start-column) 10))
+               (/ (- current-column
+                     (/ current-column (1+ (/ hexl-bits 4)))) 2))))
     (when (called-interactively-p 'interactive)
       (message "Current address is %d/0x%08x" hexl-address hexl-address))
     hexl-address))
@@ -531,10 +564,18 @@ This function is intended to be used as eldoc callback."
   (let ((addr (hexl-current-address)))
     (format "Current address is %d/0x%08x" addr addr)))
 
+(defun hexl-ascii-start-column ()
+  "Column at which the ascii portion of the hexl display starts."
+  (+ 43 (/ 128 hexl-bits)))
+
 (defun hexl-address-to-marker (address)
   "Return buffer position for ADDRESS."
   (interactive "nAddress: ")
-  (+ (* (/ address 16) 68) 10 (point-min) (/ (* (% address 16) 5) 2)))
+  (let ((N (* (% address 16) 2)))
+    (+ (* (/ address 16) (hexl-line-displen)) ; hexl line no * display length
+       10                      ; 10 chars for the "address: " prefix
+       (point-min)             ; base offset (point usually starts at 1, not 0)
+       (+ N (/ N (/ hexl-bits 4))) )) ) ; char offset into hexl display line
 
 (defun hexl-goto-address (address)
   "Go to hexl-mode (decimal) address ADDRESS.
@@ -700,7 +741,7 @@ With prefix arg N, puts point N bytes of the way from the true beginning."
 (defun hexl-beginning-of-line ()
   "Goto beginning of line in hexl mode."
   (interactive)
-  (goto-char (+ (* (/ (point) 68) 68) 11)))
+  (goto-char (+ (* (/ (point) (hexl-line-displen)) (hexl-line-displen)) 11)))
 
 (defun hexl-end-of-line ()
   "Goto end of line in hexl mode."
@@ -776,6 +817,17 @@ You may also type octal digits, to insert a character with that code."
 
 ;00000000: 0011 2233 4455 6677 8899 aabb ccdd eeff  0123456789ABCDEF
 
+(defun hexl-options (&optional test)
+  "Combine `hexl-bits' with `hexl-options', altering `hexl-options' as needed
+to produce the command line options to pass to the hexl command."
+  (let ((opts (or test hexl-options)))
+    (when (memq hexl-bits '(8 16 32 64))
+      (when (string-match "\\(.*\\)-group-by-[0-9]+-bits\\(.*\\)" opts)
+        (setq opts (concat (match-string 1 opts)
+                           (match-string 2 opts))))
+      (setq opts (format "%s -group-by-%d-bits " opts hexl-bits)) )
+    opts))
+
 ;;;###autoload
 (defun hexlify-buffer ()
   "Convert a binary buffer to hexl format.
@@ -798,7 +850,7 @@ This discards the buffer's undo information."
            (mapcar (lambda (s)
                      (if (not (multibyte-string-p s)) s
                        (encode-coding-string s locale-coding-system)))
-                   (split-string hexl-options)))
+                   (split-string (hexl-options))))
     (if (> (point) (hexl-address-to-marker hexl-max-address))
        (hexl-goto-address hexl-max-address))))
 
@@ -815,7 +867,7 @@ This discards the buffer's undo information."
        (buffer-undo-list t))
     (apply 'call-process-region (point-min) (point-max)
           (expand-file-name hexl-program exec-directory)
-          t t nil "-de" (split-string hexl-options))))
+          t t nil "-de" (split-string (hexl-options)))))
 
 (defun hexl-char-after-point ()
   "Return char for ASCII hex digits at point."
@@ -911,13 +963,12 @@ CH must be a unibyte character whose value is between 0 and 255."
       (error "Invalid character 0x%x -- must be in the range [0..255]" ch))
   (let ((address (hexl-current-address t)))
     (while (> num 0)
-      (let ((hex-position
-            (+ (* (/ address 16) 68)
-               10 (point-min)
-               (* 2 (% address 16))
-               (/ (% address 16) 2)))
+      (let ((hex-position (hexl-address-to-marker address))
            (ascii-position
-            (+ (* (/ address 16) 68) 51 (point-min) (% address 16)))
+            (+ (* (/ address 16) (hexl-line-displen))
+                (hexl-ascii-start-column)
+                (point-min)
+                (% address 16)))
            at-ascii-position)
        (if (= (point) ascii-position)
            (setq at-ascii-position t))
@@ -933,7 +984,7 @@ CH must be a unibyte character whose value is between 0 and 255."
        (if at-ascii-position
            (progn
              (beginning-of-line)
-             (forward-char 51)
+             (forward-char (hexl-ascii-start-column))
              (forward-char (% address 16)))))
       (setq num (1- num)))))
 
@@ -1041,7 +1092,7 @@ This function is assumed to be used as callback function for `hl-line-mode'."
 
 (defun hexl-follow-ascii-find ()
   "Find and highlight the ASCII element corresponding to current point."
-  (let ((pos (+ 51
+  (let ((pos (+ (hexl-ascii-start-column)
                (- (point) (current-column))
                (mod (hexl-current-address) 16))))
     (move-overlay hexl-ascii-overlay pos (1+ pos))
@@ -1050,7 +1101,7 @@ This function is assumed to be used as callback function for `hl-line-mode'."
 (defun hexl-mode-ruler ()
   "Return a string ruler for hexl mode."
   (let* ((highlight (mod (hexl-current-address) 16))
-        (s " 87654321  0011 2233 4455 6677 8899 aabb ccdd eeff  0123456789abcdef")
+        (s (cdr (assq hexl-bits hexl-rulers)))
         (pos 0))
     (set-text-properties 0 (length s) nil s)
     ;; Turn spaces in the header into stretch specs so they work
@@ -1062,12 +1113,12 @@ This function is assumed to be used as callback function for `hl-line-mode'."
                         `(space :align-to ,(1- pos))
                         s))
     ;; Highlight the current column.
-    (put-text-property (+ 11 (/ (* 5 highlight) 2))
-                      (+ 13 (/ (* 5 highlight) 2))
-                      'face 'highlight s)
+    (let ( (offset (+ (* 2 highlight) (/ (* 8 highlight) hexl-bits))) )
+      (put-text-property (+ 11 offset) (+ 13 offset) 'face 'highlight s))
     ;; Highlight the current ascii column
-    (put-text-property (+ 13 39 highlight) (+ 13 40 highlight)
-                      'face 'highlight s)
+    (put-text-property (+ (hexl-ascii-start-column) highlight 1)
+                       (+ (hexl-ascii-start-column) highlight 2)
+                       'face 'highlight s)
     s))
 
 ;; startup stuff.
index 32a041e6c09c3cfc77a76abbb809105000fc770e..2c2d08e19ccc62e3dce371cf734e08b6f4d477a5 100644 (file)
@@ -204,16 +204,15 @@ patterns."
 (defvar hi-lock-interactive-patterns nil
   "Patterns provided to hi-lock by user.  Should not be changed.")
 
+(define-obsolete-variable-alias 'hi-lock-face-history
+                                'hi-lock-face-defaults "23.1")
 (defvar hi-lock-face-defaults
   '("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-black-b"
     "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb")
   "Default faces for hi-lock interactive functions.")
 
-;(dolist (f hi-lock-face-defaults) (unless (facep f) (error "%s not a face" f)))
-
-(define-obsolete-variable-alias 'hi-lock-face-history
-                                'hi-lock-face-defaults
-                                "23.1")
+;;(dolist (f hi-lock-face-defaults)
+;;  (unless (facep f) (error "%s not a face" f)))
 
 (define-obsolete-variable-alias 'hi-lock-regexp-history
                                 'regexp-history
index 4c9dfc213cecb2541818ffa5c6ed13633d0bb359..97df90a65af3a525181bc98e15150a3ee850d196 100644 (file)
@@ -35,7 +35,7 @@
 
 (eval-when-compile
   (require 'ibuf-macs)
-  (require 'cl))
+  (require 'cl-lib))
 
 ;;; Utility functions
 (defun ibuffer-delete-alist (key alist)
@@ -497,12 +497,12 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'."
 (defun ibuffer-included-in-filter-p-1 (buf filter)
   (not
    (not
-    (case (car filter)
-      (or
+    (pcase (car filter)
+      (`or
        (memq t (mapcar #'(lambda (x)
                           (ibuffer-included-in-filter-p buf x))
                       (cdr filter))))
-      (saved
+      (`saved
        (let ((data
              (assoc (cdr filter)
                     ibuffer-saved-filters)))
@@ -510,19 +510,13 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'."
           (ibuffer-filter-disable t)
           (error "Unknown saved filter %s" (cdr filter)))
         (ibuffer-included-in-filters-p buf (cadr data))))
-      (t
-       (let ((filterdat (assq (car filter)
-                             ibuffer-filtering-alist)))
-        ;; filterdat should be like (TYPE DESCRIPTION FUNC)
-        ;; just a sanity check
-       (unless filterdat
-         (ibuffer-filter-disable t)
-         (error "Undefined filter %s" (car filter)))
-       (not
-        (not
-         (funcall (caddr filterdat)
-                  buf
-                  (cdr filter))))))))))
+      (_
+       (pcase-let ((`(,_type ,_desc ,func)
+                    (assq (car filter) ibuffer-filtering-alist)))
+         (unless func
+           (ibuffer-filter-disable t)
+           (error "Undefined filter %s" (car filter)))
+         (funcall func buf (cdr filter))))))))
 
 (defun ibuffer-generate-filter-groups (bmarklist &optional noempty nodefault)
   (let ((filter-group-alist (if nodefault
@@ -536,14 +530,14 @@ To evaluate a form without viewing the buffer, see `ibuffer-do-eval'."
          (i 0))
       (dolist (filtergroup filter-group-alist)
        (let ((filterset (cdr filtergroup)))
-         (multiple-value-bind (hip-crowd lamers)
-             (values-list
+         (cl-multiple-value-bind (hip-crowd lamers)
+             (cl-values-list
               (ibuffer-split-list (lambda (bufmark)
                                     (ibuffer-included-in-filters-p (car bufmark)
                                                                    filterset))
                                   bmarklist))
            (aset vec i hip-crowd)
-           (incf i)
+           (cl-incf i)
            (setq bmarklist lamers))))
       (let (ret)
        (dotimes (j i ret)
@@ -689,7 +683,7 @@ See also `ibuffer-kill-filter-group'."
                  (if (equal (car groups) group)
                      (setq found t
                            groups nil)
-                   (incf res)
+                   (cl-incf res)
                    (setq groups (cdr groups))))
                res)))
     (cond ((not found)
@@ -810,12 +804,12 @@ turned into two separate filters [name: foo] and [mode: bar-mode]."
   (when (null ibuffer-filtering-qualifiers)
     (error "No filters in effect"))
   (let ((lim (pop ibuffer-filtering-qualifiers)))
-    (case (car lim)
-      (or
+    (pcase (car lim)
+      (`or
        (setq ibuffer-filtering-qualifiers (append
                                          (cdr lim)
                                          ibuffer-filtering-qualifiers)))
-      (saved
+      (`saved
        (let ((data
              (assoc (cdr lim)
                     ibuffer-saved-filters)))
@@ -825,10 +819,10 @@ turned into two separate filters [name: foo] and [mode: bar-mode]."
         (setq ibuffer-filtering-qualifiers (append
                                            (cadr data)
                                            ibuffer-filtering-qualifiers))))
-      (not
+      (`not
        (push (cdr lim)
             ibuffer-filtering-qualifiers))
-      (t
+      (_
        (error "Filter type %s is not compound" (car lim)))))
   (ibuffer-update nil t))
 
@@ -960,33 +954,30 @@ Interactively, prompt for NAME, and use the current filters."
     (ibuffer-format-qualifier-1 qualifier)))
 
 (defun ibuffer-format-qualifier-1 (qualifier)
-  (case (car qualifier)
-    (saved
+  (pcase (car qualifier)
+    (`saved
      (concat " [filter: " (cdr qualifier) "]"))
-    (or
+    (`or
      (concat " [OR" (mapconcat #'ibuffer-format-qualifier
                               (cdr qualifier) "") "]"))
-    (t
+    (_
      (let ((type (assq (car qualifier) ibuffer-filtering-alist)))
        (unless qualifier
         (error "Ibuffer: bad qualifier %s" qualifier))
        (concat " [" (cadr type) ": " (format "%s]" (cdr qualifier)))))))
 
 
-(defun ibuffer-list-buffer-modes ()
-  "Create an alist of buffer modes currently in use.
-The list returned will be of the form (\"MODE-NAME\" . MODE-SYMBOL)."
-  (let ((bufs (buffer-list))
-       (modes)
-       (this-mode))
-    (while bufs
-      (setq this-mode (buffer-local-value 'major-mode (car bufs))
-           bufs (cdr bufs))
-      (add-to-list
-       'modes
-       `(,(symbol-name this-mode) .
-        ,this-mode)))
-    modes))
+(defun ibuffer-list-buffer-modes (&optional include-parents)
+  "Create a completion table of buffer modes currently in use.
+If INCLUDE-PARENTS is non-nil then include parent modes."
+  (let ((modes))
+    (dolist (buf (buffer-list))
+      (let ((this-mode (buffer-local-value 'major-mode buf)))
+        (while (and this-mode (not (memq this-mode modes)))
+          (push this-mode modes)
+          (setq this-mode (and include-parents
+                               (get this-mode 'derived-mode-parent))))))
+    (mapcar #'symbol-name modes)))
 
 
 ;;; Extra operation definitions
@@ -996,16 +987,19 @@ The list returned will be of the form (\"MODE-NAME\" . MODE-SYMBOL)."
   "Toggle current view to buffers with major mode QUALIFIER."
   (:description "major mode"
    :reader
-   (intern
-    (completing-read "Filter by major mode: " obarray
-                    #'(lambda (e)
-                        (string-match "-mode$"
-                                      (symbol-name e)))
-                    t
-                    (let ((buf (ibuffer-current-buffer)))
-                      (if (and buf (buffer-live-p buf))
-                          (symbol-name (buffer-local-value 'major-mode buf))
-                        "")))))
+   (let* ((buf (ibuffer-current-buffer))
+          (default (if (and buf (buffer-live-p buf))
+                       (symbol-name (buffer-local-value
+                                     'major-mode buf)))))
+     (intern
+      (completing-read
+       (if default
+           (format "Filter by major mode (default %s): " default)
+         "Filter by major mode: ")
+       obarray
+       #'(lambda (e)
+           (string-match "-mode\\'" (symbol-name e)))
+       t nil nil default))))
   (eq qualifier (buffer-local-value 'major-mode buf)))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-used-mode "ibuf-ext")
@@ -1014,18 +1008,29 @@ The list returned will be of the form (\"MODE-NAME\" . MODE-SYMBOL)."
 Called interactively, this function allows selection of modes
 currently used by buffers."
   (:description "major mode in use"
+   :reader
+   (let* ((buf (ibuffer-current-buffer))
+          (default (if (and buf (buffer-live-p buf))
+                       (symbol-name (buffer-local-value
+                                     'major-mode buf)))))
+     (intern
+      (completing-read
+       (if default
+           (format "Filter by major mode (default %s): " default)
+         "Filter by major mode: ")
+       (ibuffer-list-buffer-modes) nil t nil nil default))))
+  (eq qualifier (buffer-local-value 'major-mode buf)))
+
+;;;###autoload (autoload 'ibuffer-filter-by-derived-mode "ibuf-ext")
+(define-ibuffer-filter derived-mode
+    "Toggle current view to buffers whose major mode inherits from QUALIFIER."
+  (:description "derived mode"
                :reader
                (intern
-                (completing-read "Filter by major mode: "
-                                 (ibuffer-list-buffer-modes)
-                                 nil
-                                 t
-                                 (let ((buf (ibuffer-current-buffer)))
-                                   (if (and buf (buffer-live-p buf))
-                                       (symbol-name (buffer-local-value
-                                                     'major-mode buf))
-                                     "")))))
-  (eq qualifier (buffer-local-value 'major-mode buf)))
+                (completing-read "Filter by derived mode: "
+                                 (ibuffer-list-buffer-modes t)
+                                  nil t)))
+  (with-current-buffer buf (derived-mode-p qualifier)))
 
 ;;;###autoload (autoload 'ibuffer-filter-by-name "ibuf-ext")
 (define-ibuffer-filter name
@@ -1403,14 +1408,14 @@ You can then feed the file name(s) to other commands with \\[yank]."
                 (concat ibuffer-copy-filename-as-kill-result
                         (let ((name (buffer-file-name buf)))
                           (if name
-                              (case type
-                                (full
+                              (pcase type
+                                (`full
                                  name)
-                                (relative
+                                (`relative
                                  (file-relative-name
                                   name (or ibuffer-default-directory
                                            default-directory)))
-                                (t
+                                (_
                                  (file-name-nondirectory name)))
                             ""))
                         " "))))
@@ -1466,19 +1471,16 @@ You can then feed the file name(s) to other commands with \\[yank]."
 (defun ibuffer-mark-by-mode (mode)
   "Mark all buffers whose major mode equals MODE."
   (interactive
-   (list (intern (completing-read "Mark by major mode: " obarray
-                                 #'(lambda (e)
-                                     ;; kind of a hack...
-                                      (and (fboundp e)
-                                           (string-match "-mode$"
-                                                         (symbol-name e))))
-                                 t
-                                 (let ((buf (ibuffer-current-buffer)))
-                                   (if (and buf (buffer-live-p buf))
-                                       (with-current-buffer buf
-                                         (cons (symbol-name major-mode)
-                                               0))
-                                     ""))))))
+   (let* ((buf (ibuffer-current-buffer))
+          (default (if (and buf (buffer-live-p buf))
+                       (symbol-name (buffer-local-value
+                                     'major-mode buf)))))
+     (list (intern
+            (completing-read
+             (if default
+                 (format "Mark by major mode (default %s): " default)
+               "Mark by major mode: ")
+             (ibuffer-list-buffer-modes) nil t nil nil default)))))
   (ibuffer-mark-on-buffer
    #'(lambda (buf)
        (eq (buffer-local-value 'major-mode buf) mode))))
@@ -1542,13 +1544,8 @@ You can then feed the file name(s) to other commands with \\[yank]."
        (with-current-buffer buf
         ;; hacked from midnight.el
         (when buffer-display-time
-          (let* ((tm (current-time))
-                 (now (+ (* (float (ash 1 16)) (car tm))
-                         (float (cadr tm)) (* 0.0000001 (caddr tm))))
-                 (then (+ (* (float (ash 1 16))
-                             (car buffer-display-time))
-                          (float (cadr buffer-display-time))
-                          (* 0.0000001 (caddr buffer-display-time)))))
+          (let* ((now (float-time))
+                 (then (float-time buffer-display-time)))
             (> (- now then) (* 60 60 ibuffer-old-time))))))))
 
 ;;;###autoload
index f47592e82bb6cb724d491a5c700cd6f5c30efbdb..ebf34c120e5af170427e9dd6dd874200fcae6a41 100644 (file)
@@ -27,8 +27,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; From Paul Graham's "ANSI Common Lisp", adapted for Emacs Lisp here.
 (defmacro ibuffer-aif (test true-body &rest false-body)
@@ -73,7 +72,7 @@ During evaluation of body, bind `it' to the value returned by TEST."
           (ibuffer-redisplay t))))))
 
 ;;;###autoload
-(defmacro* define-ibuffer-column (symbol (&key name inline props summarizer
+(cl-defmacro define-ibuffer-column (symbol (&key name inline props summarizer
                                               header-mouse-map) &rest body)
   "Define a column SYMBOL for use with `ibuffer-formats'.
 
@@ -129,7 +128,7 @@ change its definition, you should explicitly call
        :autoload-end)))
 
 ;;;###autoload
-(defmacro* define-ibuffer-sorter (name documentation
+(cl-defmacro define-ibuffer-sorter (name documentation
                                       (&key
                                        description)
                                       &rest body)
@@ -143,7 +142,7 @@ buffer object, and `b' bound to another.  BODY should return a non-nil
 value if and only if `a' is \"less than\" `b'.
 
 \(fn NAME DOCUMENTATION (&key DESCRIPTION) &rest BODY)"
-  (declare (indent 1))
+  (declare (indent 1) (doc-string 2))
   `(progn
      (defun ,(intern (concat "ibuffer-do-sort-by-" (symbol-name name))) ()
        ,(or documentation "No :documentation specified for this sorting method.")
@@ -160,7 +159,7 @@ value if and only if `a' is \"less than\" `b'.
      :autoload-end))
 
 ;;;###autoload
-(defmacro* define-ibuffer-op (op args
+(cl-defmacro define-ibuffer-op (op args
                                 documentation
                                 (&key
                                  interactive
@@ -202,7 +201,7 @@ COMPLEX means this function is special; see the source code of this
 macro for exactly what it does.
 
 \(fn OP ARGS DOCUMENTATION (&key INTERACTIVE MARK MODIFIER-P DANGEROUS OPSTRING ACTIVE-OPSTRING COMPLEX) &rest BODY)"
-  (declare (indent 2))
+  (declare (indent 2) (doc-string 3))
   `(progn
      (defun ,(intern (concat (if (string-match "^ibuffer-do" (symbol-name op))
                                 "" "ibuffer-do-") (symbol-name op)))
@@ -213,19 +212,19 @@ macro for exactly what it does.
        ,(if (not (null interactive))
            `(interactive ,interactive)
          '(interactive))
-       (assert (derived-mode-p 'ibuffer-mode))
+       (cl-assert (derived-mode-p 'ibuffer-mode))
        (setq ibuffer-did-modification nil)
-       (let ((marked-names  (,(case mark
+       (let ((marked-names  (,(pcase mark
                                (:deletion
                                 'ibuffer-deletion-marked-buffer-names)
-                               (t
+                               (_
                                 'ibuffer-marked-buffer-names)))))
         (when (null marked-names)
           (setq marked-names (list (buffer-name (ibuffer-current-buffer))))
-          (ibuffer-set-mark ,(case mark
+          (ibuffer-set-mark ,(pcase mark
                                (:deletion
                                 'ibuffer-deletion-char)
-                               (t
+                               (_
                                 'ibuffer-marked-char))))
         ,(let* ((finish (append
                          '(progn)
@@ -242,10 +241,10 @@ macro for exactly what it does.
                                      ,@body))
                                  t)))
                 (body `(let ((count
-                              (,(case mark
+                              (,(pcase mark
                                   (:deletion
                                    'ibuffer-map-deletion-lines)
-                                  (t
+                                  (_
                                    'ibuffer-map-marked-lines))
                                #'(lambda (buf mark)
                                    ,(if (eq modifier-p :maybe)
@@ -264,7 +263,7 @@ macro for exactly what it does.
      :autoload-end))
 
 ;;;###autoload
-(defmacro* define-ibuffer-filter (name documentation
+(cl-defmacro define-ibuffer-filter (name documentation
                                       (&key
                                        reader
                                        description)
@@ -280,7 +279,7 @@ will be evaluated with BUF bound to the buffer object, and QUALIFIER
 bound to the current value of the filter.
 
 \(fn NAME DOCUMENTATION (&key READER DESCRIPTION) &rest BODY)"
-  (declare (indent 2))
+  (declare (indent 2) (doc-string 2))
   (let ((fn-name (intern (concat "ibuffer-filter-by-" (symbol-name name)))))
     `(progn
        (defun ,fn-name (qualifier)
index 05be5dc2f5211dd1280df896d7772e9dd388e40b..d29653c41ae597b52babd3d495c3cf93a1f88c7f 100644 (file)
@@ -31,7 +31,7 @@
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'ibuf-macs)
   (require 'dired))
 
 (declare-function ibuffer-format-filter-group-data "ibuf-ext" (filter))
 
 (defgroup ibuffer nil
-  "An advanced replacement for `buffer-menu'.
-
-Ibuffer allows you to operate on buffers in a manner much like Dired.
-Operations include sorting, marking by regular expression, and
-the ability to filter the displayed buffers by various criteria."
+  "Advanced replacement for `buffer-menu'.
+Ibuffer lets you operate on buffers in a Dired-like way,
+with the ability to sort, mark by regular expression,
+and filter displayed buffers by various criteria."
   :version "22.1"
   :group 'convenience)
 
@@ -502,8 +501,8 @@ directory, like `default-directory'."
     (define-key map (kbd "s f") 'ibuffer-do-sort-by-filename/process)
     (define-key map (kbd "s m") 'ibuffer-do-sort-by-major-mode)
 
-    (define-key map (kbd "/ m") 'ibuffer-filter-by-mode)
-    (define-key map (kbd "/ M") 'ibuffer-filter-by-used-mode)
+    (define-key map (kbd "/ m") 'ibuffer-filter-by-used-mode)
+    (define-key map (kbd "/ M") 'ibuffer-filter-by-derived-mode)
     (define-key map (kbd "/ n") 'ibuffer-filter-by-name)
     (define-key map (kbd "/ c") 'ibuffer-filter-by-content)
     (define-key map (kbd "/ e") 'ibuffer-filter-by-predicate)
@@ -1018,7 +1017,7 @@ width and the longest string in LIST."
     (when (get-text-property (point) 'ibuffer-title)
       (forward-line 1)
       (setq arg 1))
-    (decf arg)))
+    (cl-decf arg)))
 
 (defun ibuffer-forward-line (&optional arg skip-group-names)
   "Move forward ARG lines, wrapping around the list if necessary."
@@ -1033,7 +1032,7 @@ width and the longest string in LIST."
            (and skip-group-names
                 (get-text-property (point) 'ibuffer-filter-group-name)))
     (when (> arg 0)
-      (decf arg))
+      (cl-decf arg))
     (ibuffer-skip-properties (append '(ibuffer-title)
                                     (when skip-group-names
                                       '(ibuffer-filter-group-name)))
@@ -1046,7 +1045,7 @@ width and the longest string in LIST."
                 (or (eobp)
                     (get-text-property (point) 'ibuffer-summary)))
        (goto-char (point-min)))
-      (decf arg)
+      (cl-decf arg)
       (ibuffer-skip-properties (append '(ibuffer-title)
                                       (when skip-group-names
                                         '(ibuffer-filter-group-name)))
@@ -1191,7 +1190,7 @@ a new window in the current frame, splitting vertically."
                        (setq trying nil))
                    (error
                     ;; Handle a failure
-                    (if (or (> (incf attempts) 4)
+                    (if (or (> (cl-incf attempts) 4)
                             (and (stringp (cadr err))
                                  ;; This definitely falls in the
                                  ;; ghetto hack category...
@@ -1244,7 +1243,7 @@ a new window in the current frame, splitting vertically."
   (ibuffer-map-on-mark ibuffer-deletion-char func))
 
 (defsubst ibuffer-assert-ibuffer-mode ()
-  (assert (derived-mode-p 'ibuffer-mode)))
+  (cl-assert (derived-mode-p 'ibuffer-mode)))
 
 (defun ibuffer-buffer-file-name ()
   (or buffer-file-name
@@ -1284,7 +1283,7 @@ With optional ARG, make read-only only if ARG is positive."
   (:opstring "toggled read only status in"
    :interactive "P"
    :modifier-p t)
-  (toggle-read-only arg))
+  (toggle-read-only arg t))
 
 (define-ibuffer-op ibuffer-do-delete ()
   "Kill marked buffers as with `kill-this-buffer'."
@@ -1505,11 +1504,11 @@ If point is on a group name, this function operates on that group."
     `(progn
        (setq tmp1 ,widthform
             tmp2 (/ tmp1 2))
-       ,(case alignment
+       ,(pcase alignment
          (:right `(concat ,left ,right ,strvar))
          (:center `(concat ,left ,strvar ,right))
          (:left `(concat ,strvar ,left ,right))
-         (t (error "Invalid alignment %s" alignment))))))
+         (_ (error "Invalid alignment %s" alignment))))))
 
 (defun ibuffer-compile-format (format)
   (let ((result nil)
@@ -1530,7 +1529,7 @@ If point is on a group name, this function operates on that group."
                (max (nth 2 form))
                (align (nth 3 form))
                (elide (nth 4 form)))
-          (let* ((from-end-p (when (minusp min)
+          (let* ((from-end-p (when (cl-minusp min)
                                (setq min (- min))
                                t))
                  (letbindings nil)
@@ -1813,10 +1812,10 @@ If point is on a group name, this function operates on that group."
 (defun ibuffer-format-column (str width alignment)
   (let ((left (make-string (/ width 2) ?\s))
        (right (make-string (- width (/ width 2)) ?\s)))
-    (case alignment
+    (pcase alignment
       (:right (concat left right str))
       (:center (concat left str right))
-      (t (concat str left right)))))
+      (_ (concat str left right)))))
 
 (defun ibuffer-buffer-name-face (buf mark)
   (cond ((char-equal mark ibuffer-marked-char)
@@ -1914,18 +1913,18 @@ the buffer object itself and the current mark symbol."
              ;; `nil' if it chose not to affect the buffer
              ;; `kill' means the remove line from the buffer list
              ;; `t' otherwise
-             (incf ibuffer-map-lines-total)
+             (cl-incf ibuffer-map-lines-total)
              (cond ((null result)
                     (forward-line 1))
                    ((eq result 'kill)
                     (delete-region (line-beginning-position)
                                    (1+ (line-end-position)))
-                    (incf ibuffer-map-lines-count)
+                    (cl-incf ibuffer-map-lines-count)
                     (when (< ibuffer-map-lines-total
                              orig-target-line)
-                      (decf target-line-offset)))
+                      (cl-decf target-line-offset)))
                    (t
-                    (incf ibuffer-map-lines-count)
+                    (cl-incf ibuffer-map-lines-count)
                     (forward-line 1)))))
          ibuffer-map-lines-count)
       (progn
@@ -2055,12 +2054,9 @@ the value of point at the beginning of the line for that buffer."
           (insert
            (if (stringp element)
                element
-             (let ((sym (car element))
-                   (min (cadr element))
-                   ;; (max (caddr element))
-                   (align (cadddr element)))
+             (pcase-let ((`(,sym ,min ,_max ,align) element))
                ;; Ignore a negative min when we're inserting the title
-               (when (minusp min)
+               (when (cl-minusp min)
                  (setq min (- min)))
                (let* ((name (or (get sym 'ibuffer-column-name)
                                 (error "Unknown column %s in ibuffer-formats" sym)))
@@ -2108,24 +2104,23 @@ the value of point at the beginning of the line for that buffer."
             (insert
              (if (stringp element)
                  (make-string (length element) ?\s)
-               (let ((sym (car element)))
-                 (let ((min (cadr element))
-                       ;; (max (caddr element))
-                       (align (cadddr element)))
-                   ;; Ignore a negative min when we're inserting the title
-                   (when (minusp min)
-                     (setq min (- min)))
-                   (let* ((summary (if (get sym 'ibuffer-column-summarizer)
-                                       (funcall (get sym 'ibuffer-column-summarizer)
-                                                (get sym 'ibuffer-column-summary))
-                                     (make-string (length (get sym 'ibuffer-column-name))
-                                                  ?\s)))
-                          (len (length summary)))
-                     (if (< len min)
-                         (ibuffer-format-column summary
-                                                (- min len)
-                                                align)
-                       summary)))))))
+               (pcase-let ((`(,sym ,min ,_max ,align) element))
+                  ;; Ignore a negative min when we're inserting the title.
+                  (when (cl-minusp min)
+                    (setq min (- min)))
+                  (let* ((summary
+                          (if (get sym 'ibuffer-column-summarizer)
+                              (funcall (get sym 'ibuffer-column-summarizer)
+                                       (get sym 'ibuffer-column-summary))
+                            (make-string
+                             (length (get sym 'ibuffer-column-name))
+                             ?\s)))
+                         (len (length summary)))
+                    (if (< len min)
+                        (ibuffer-format-column summary
+                                               (- min len)
+                                               align)
+                      summary))))))
           (point))
         `(ibuffer-summary t)))))
 
@@ -2169,7 +2164,7 @@ If optional arg SILENT is non-nil, do not display progress messages."
                      (eq ibuffer-always-show-last-buffer
                          :nomini)
                      (minibufferp (cadr bufs)))
-                    (caddr bufs)
+                    (cl-caddr bufs)
                   (cadr bufs))
                 (ibuffer-current-buffers-with-marks bufs)
                 ibuffer-display-maybe-show-predicates)))
@@ -2201,7 +2196,7 @@ If optional arg SILENT is non-nil, do not display progress messages."
     (require 'ibuf-ext))
   (let* ((sortdat (assq ibuffer-sorting-mode
                        ibuffer-sorting-functions-alist))
-        (func (caddr sortdat)))
+        (func (cl-caddr sortdat)))
     (let ((result
           ;; actually sort the buffers
           (if (and sortdat func)
@@ -2575,11 +2570,11 @@ will be inserted before the group at point."
   ;; `ibuffer-update' puts this on header-line-format when needed.
   (setq ibuffer-header-line-format
         ;; Display the part that won't be in the mode-line.
-        (list* "" mode-name
-               (mapcar (lambda (elem)
-                         (if (eq (car-safe elem) 'header-line-format)
-                             (nth 2 elem) elem))
-                       mode-line-process)))
+        `("" ,mode-name
+          ,@(mapcar (lambda (elem)
+                      (if (eq (car-safe elem) 'header-line-format)
+                          (nth 2 elem) elem))
+                    mode-line-process)))
 
   (setq buffer-read-only t)
   (buffer-disable-undo)
@@ -2646,7 +2641,7 @@ will be inserted before the group at point."
 ;;;;;;  ibuffer-backward-filter-group ibuffer-forward-filter-group
 ;;;;;;  ibuffer-toggle-filter-group ibuffer-mouse-toggle-filter-group
 ;;;;;;  ibuffer-interactive-filter-by-mode ibuffer-mouse-filter-by-mode
-;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "d075c17b63e67b28652ececf548385fc")
+;;;;;;  ibuffer-auto-mode) "ibuf-ext" "ibuf-ext.el" "c255d1ebe80ccabd8385f40bdd0b5451")
 ;;; Generated autoloads from ibuf-ext.el
 
 (autoload 'ibuffer-auto-mode "ibuf-ext" "\
@@ -2836,6 +2831,7 @@ Set this buffer's filters to filters with NAME from `ibuffer-saved-filters'.
 \(fn NAME)" t nil)
  (autoload 'ibuffer-filter-by-mode "ibuf-ext")
  (autoload 'ibuffer-filter-by-used-mode "ibuf-ext")
+ (autoload 'ibuffer-filter-by-derived-mode "ibuf-ext")
  (autoload 'ibuffer-filter-by-name "ibuf-ext")
  (autoload 'ibuffer-filter-by-filename "ibuf-ext")
  (autoload 'ibuffer-filter-by-size-gt  "ibuf-ext")
index 97a14b12891cd3b0675a761dda00f94264a5d20b..a4e3e3394706085ccccfca2d14f35a3f53ae0a02 100644 (file)
@@ -209,10 +209,12 @@ Usually run by inclusion in `minibuffer-setup-hook'."
   (when (and icomplete-mode (icomplete-simple-completing-p))
     (set (make-local-variable 'completion-show-inline-help) nil)
     (add-hook 'pre-command-hook
-             (lambda () (run-hooks 'icomplete-pre-command-hook))
+             (lambda () (let ((non-essential t))
+                      (run-hooks 'icomplete-pre-command-hook)))
              nil t)
     (add-hook 'post-command-hook
-             (lambda () (run-hooks 'icomplete-post-command-hook))
+             (lambda () (let ((non-essential t)) ;E.g. don't prompt for password!
+                      (run-hooks 'icomplete-post-command-hook)))
              nil t)
     (run-hooks 'icomplete-minibuffer-setup-hook)))
 ;\f
@@ -285,8 +287,7 @@ The displays for unambiguous matches have ` [Matched]' appended
 matches exist.  \(Keybindings for uniquely matched commands
 are exhibited within the square braces.)"
 
-  (let* ((non-essential t)
-         (md (completion--field-metadata (field-beginning)))
+  (let* ((md (completion--field-metadata (field-beginning)))
         (comps (completion-all-sorted-completions))
          (last (if (consp comps) (last comps)))
          (base-size (cdr last))
index fe94c7f225e7694ed26d40233dd042198ebc3a59..da30b132d2a6dd527e667fdcfc1c70cc2146009e 100644 (file)
@@ -791,44 +791,39 @@ subdirs in the alternatives."
   :type 'boolean
   :group 'ido)
 
-(defface ido-first-match  '((t (:bold t)))
+(defface ido-first-match  '((t :weight bold))
   "Face used by ido for highlighting first match."
   :group 'ido)
 
 (defface ido-only-match  '((((class color))
-                                 (:foreground "ForestGreen"))
-                                (t (:italic t)))
+                           :foreground "ForestGreen")
+                          (t :slant italic))
   "Face used by ido for highlighting only match."
   :group 'ido)
 
 (defface ido-subdir  '((((min-colors 88) (class color))
-                             (:foreground "red1"))
-                           (((class color))
-                             (:foreground "red"))
-                            (t (:underline t)))
+                       :foreground "red1")
+                      (((class color))
+                       :foreground "red")
+                      (t :underline t))
   "Face used by ido for highlighting subdirs in the alternatives."
   :group 'ido)
 
-(defface ido-virtual '((t (:inherit font-lock-builtin-face)))
+(defface ido-virtual '((t :inherit font-lock-builtin-face))
   "Face used by ido for matching virtual buffer names."
   :version "24.1"
   :group 'ido)
 
-(defface ido-indicator  '((((min-colors 88) (class color))
-                               (:foreground "yellow1"
-                                :background "red1"
-                                :width condensed))
-                              (((class color))
-                               (:foreground "yellow"
-                                :background "red"
-                                :width condensed))
-                              (t (:inverse-video t)))
+(defface ido-indicator '((((min-colors 88) (class color))
+                         :foreground "yellow1" :background "red1" :width condensed)
+                        (((class color))
+                         :foreground "yellow" :background "red" :width condensed)
+                        (t :inverse-video t))
   "Face used by ido for highlighting its indicators."
   :group 'ido)
 
 (defface ido-incomplete-regexp
-  '((t
-     (:inherit font-lock-warning-face)))
+  '((t :inherit font-lock-warning-face))
   "Ido face for indicating incomplete regexps."
   :group 'ido)
 
@@ -872,7 +867,7 @@ The following variables are available, but should not be changed:
   :group 'ido)
 
 (defvar ido-rewrite-file-prompt-rules nil
-  "*Alist of rewriting rules for directory names in ido prompts.
+  "Alist of rewriting rules for directory names in ido prompts.
 A list of elements of the form (FROM . TO) or (FROM . FUNC), each
 meaning to rewrite the directory name if matched by FROM by either
 substituting the matched string by TO or calling the function FUNC
@@ -893,9 +888,14 @@ Otherwise, only the current list of matches is shown."
   :type 'boolean
   :group 'ido)
 
-(defvar ido-all-frames 'visible
-  "*Argument to pass to `walk-windows' when finding visible files.
-See documentation of `walk-windows' for useful values.")
+(defcustom ido-all-frames 'visible
+  "Argument to pass to `walk-windows' when Ido is finding buffers.
+See documentation of `walk-windows' for useful values."
+  :type '(choice (const :tag "Selected frame only" nil)
+                (const :tag "All existing frames" t)
+                (const :tag "All visible frames" visible)
+                (const :tag "All frames on this terminal" 0))
+  :group 'ido)
 
 (defcustom ido-minibuffer-setup-hook nil
   "Ido-specific customization of minibuffer setup.
@@ -4046,8 +4046,7 @@ their normal keybindings, except for the following: \\<ido-buffer-completion-map
 RET Select the buffer at the front of the list of matches.  If the
 list is empty, possibly prompt to create new buffer.
 
-\\[ido-select-text] Select the current prompt as the buffer.
-If no buffer is found, prompt for a new one.
+\\[ido-select-text] Use the current input string verbatim.
 
 \\[ido-next-match] Put the first element at the end of the list.
 \\[ido-prev-match] Put the last element at the start of the list.
@@ -4133,8 +4132,7 @@ except for the following: \\<ido-file-completion-map>
 RET Select the file at the front of the list of matches.  If the
 list is empty, possibly prompt to create new file.
 
-\\[ido-select-text] Select the current prompt as the buffer or file.
-If no buffer or file is found, prompt for a new one.
+\\[ido-select-text] Use the current input string verbatim.
 
 \\[ido-next-match] Put the first element at the end of the list.
 \\[ido-prev-match] Put the last element at the start of the list.
@@ -4142,6 +4140,7 @@ If no buffer or file is found, prompt for a new one.
 matches all files.  If there is only one match, select that file.
 If there is no common suffix, show a list of all matching files
 in a separate window.
+\\[ido-magic-delete-char] Open the specified directory in Dired mode.
 \\[ido-edit-input] Edit input string (including directory).
 \\[ido-prev-work-directory] or \\[ido-next-work-directory] go to previous/next directory in work directory history.
 \\[ido-merge-work-directories] search for file in the work directory history.
index 8151985e7477176031fab82a0c79ce2f229e6a04..3659894f08dc5ad8265c6a92fe11d029b4608657 100644 (file)
 (require 'widget)
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'wid-edit))
 
 (defgroup image-dired nil
@@ -602,14 +602,14 @@ according to the Thumbnail Managing Standard."
                  (md5 (file-name-as-directory (file-name-directory f)))))
            (format "%s%s%s.thumb.%s"
                    (file-name-as-directory (expand-file-name (image-dired-dir)))
-                   (file-name-sans-extension (file-name-nondirectory f))
+                   (file-name-base f)
                    (if md5-hash (concat "_" md5-hash) "")
                    (file-name-extension f))))
         ((eq 'per-directory image-dired-thumbnail-storage)
          (let ((f (expand-file-name file)))
            (format "%s.image-dired/%s.thumb.%s"
                    (file-name-directory f)
-                   (file-name-sans-extension (file-name-nondirectory f))
+                   (file-name-base f)
                    (file-name-extension f))))))
 
 (defun image-dired-create-thumb (original-file thumbnail-file)
@@ -653,21 +653,24 @@ previous -ARG, if ARG<0) files."
           (image-file (dired-get-filename nil t))
           thumb-file
           overlay)
-     (when (and image-file (string-match-p (image-file-name-regexp) image-file))
+     (when (and image-file
+                (string-match-p (image-file-name-regexp) image-file))
        (setq thumb-file (image-dired-get-thumbnail-image image-file))
        ;; If image is not already added, then add it.
        (let ((cur-ov (overlays-in (point) (1+ (point)))))
          (if cur-ov
              (delete-overlay (car cur-ov))
           (put-image thumb-file image-pos)
-          (setq overlay (loop for o in (overlays-in (point) (1+ (point)))
-                              when (overlay-get o 'put-image) collect o into ov
-                              finally return (car ov)))
+          (setq overlay
+                 (cl-loop for o in (overlays-in (point) (1+ (point)))
+                          when (overlay-get o 'put-image) collect o into ov
+                          finally return (car ov)))
           (overlay-put overlay 'image-file image-file)
           (overlay-put overlay 'thumb-file thumb-file)))))
    arg             ; Show or hide image on ARG next files.
    'show-progress) ; Update dired display after each image is updated.
-  (add-hook 'dired-after-readin-hook 'image-dired-dired-after-readin-hook nil t))
+  (add-hook 'dired-after-readin-hook
+            'image-dired-dired-after-readin-hook nil t))
 
 (defun image-dired-dired-after-readin-hook ()
   "Relocate existing thumbnail overlays in dired buffer after reverting.
index 900cd725b92468b68e170b0cc39cfa73647c104f..fabc12c0219f41d32f3eea20b583bc01bc7b41c9 100644 (file)
@@ -34,7 +34,7 @@
 ;;; Code:
 
 (require 'image)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;; Image mode window-info management.
 
@@ -70,12 +70,11 @@ A winprops object has the shape (WINDOW . ALIST)."
     winprops))
 
 (defun image-mode-window-get (prop &optional winprops)
+  (declare (gv-setter (lambda (val)
+                        `(image-mode-window-put ,prop ,val ,winprops))))
   (unless (consp winprops) (setq winprops (image-mode-winprops winprops)))
   (cdr (assq prop (cdr winprops))))
 
-(defsetf image-mode-window-get (prop &optional winprops) (val)
-  `(image-mode-window-put ,prop ,val ,winprops))
-
 (defun image-mode-window-put (prop val &optional winprops)
   (unless (consp winprops) (setq winprops (image-mode-winprops winprops)))
   (setcdr winprops (cons (cons prop val)
@@ -532,6 +531,7 @@ was inserted."
     (setq image-type type)
     (if (eq major-mode 'image-mode)
        (setq mode-name (format "Image[%s]" type)))
+    (image-transform-check-size)
     (if (called-interactively-p 'any)
        (message "Repeat this command to go back to displaying the file as text"))))
 
@@ -608,23 +608,23 @@ Otherwise it plays once, then stops."
 \f
 
 ;; Not yet implemented.
-;;; (defvar image-transform-minor-mode-map
-;;;   (let ((map (make-sparse-keymap)))
-;;;     ;; (define-key map  [(control ?+)] 'image-scale-in)
-;;;     ;; (define-key map  [(control ?-)] 'image-scale-out)
-;;;     ;; (define-key map  [(control ?=)] 'image-scale-none)
-;;;     ;; (define-key map "c f h" 'image-scale-fit-height)
-;;;     ;; (define-key map "c ]" 'image-rotate-right)
-;;;     map)
-;;;   "Minor mode keymap `image-transform-mode'.")
-;;;
-;;; (define-minor-mode image-transform-mode
-;;;   "Minor mode for scaling and rotating images.
-;;; With a prefix argument ARG, enable the mode if ARG is positive,
-;;; and disable it otherwise.  If called from Lisp, enable the mode
-;;; if ARG is omitted or nil.  This minor mode requires Emacs to have
-;;; been compiled with ImageMagick support."
-;;;   nil "image-transform" image-transform-minor-mode-map)
+;; (defvar image-transform-minor-mode-map
+;;   (let ((map (make-sparse-keymap)))
+;;     ;; (define-key map  [(control ?+)] 'image-scale-in)
+;;     ;; (define-key map  [(control ?-)] 'image-scale-out)
+;;     ;; (define-key map  [(control ?=)] 'image-scale-none)
+;;     ;; (define-key map "c f h" 'image-scale-fit-height)
+;;     ;; (define-key map "c ]" 'image-rotate-right)
+;;     map)
+;;   "Minor mode keymap `image-transform-mode'.")
+;;
+;; (define-minor-mode image-transform-mode
+;;   "Minor mode for scaling and rotating images.
+;; With a prefix argument ARG, enable the mode if ARG is positive,
+;; and disable it otherwise.  If called from Lisp, enable the mode
+;; if ARG is omitted or nil.  This minor mode requires Emacs to have
+;; been compiled with ImageMagick support."
+;;   nil "image-transform" image-transform-minor-mode-map)
 
 
 ;; FIXME this doesn't seem mature yet. Document in manual when it is.
@@ -634,11 +634,124 @@ Its value should be one of the following:
  - nil, meaning no resizing.
  - `fit-height', meaning to fit the image to the window height.
  - `fit-width', meaning to fit the image to the window width.
- - A number, which is a scale factor (the default size is 100).")
+ - A number, which is a scale factor (the default size is 1).")
+
+(defvar image-transform-scale 1.0
+  "The scale factor of the image being displayed.")
 
 (defvar image-transform-rotation 0.0
   "Rotation angle for the image in the current Image mode buffer.")
 
+(defvar image-transform-right-angle-fudge 0.0001
+  "Snap distance to a multiple of a right angle.
+There's no deep theory behind the default value, it should just
+be somewhat larger than ImageMagick's MagickEpsilon.")
+
+(defsubst image-transform-width (width height)
+  "Return the bounding box width of a rotated WIDTH x HEIGHT rectangle.
+The rotation angle is the value of `image-transform-rotation' in degrees."
+  (let ((angle (degrees-to-radians image-transform-rotation)))
+    ;; Assume, w.l.o.g., that the vertices of the rectangle have the
+    ;; coordinates (+-w/2, +-h/2) and that (0, 0) is the center of the
+    ;; rotation by the angle A.  The projections onto the first axis
+    ;; of the vertices of the rotated rectangle are +- (w/2) cos A +-
+    ;; (h/2) sin A, and the difference between the largest and the
+    ;; smallest of the four values is the expression below.
+    (+ (* width (abs (cos angle))) (* height (abs (sin angle))))))
+
+;; The following comment and code snippet are from
+;; ImageMagick-6.7.4-4/magick/distort.c
+
+;;    /* Set the output image geometry to calculated 'best fit'.
+;;       Yes this tends to 'over do' the file image size, ON PURPOSE!
+;;       Do not do this for DePolar which needs to be exact for virtual tiling.
+;;    */
+;;    if ( fix_bounds ) {
+;;      geometry.x = (ssize_t) floor(min.x-0.5);
+;;      geometry.y = (ssize_t) floor(min.y-0.5);
+;;      geometry.width=(size_t) ceil(max.x-geometry.x+0.5);
+;;      geometry.height=(size_t) ceil(max.y-geometry.y+0.5);
+;;    }
+
+;; Other parts of the same file show that here the origin is in the
+;; left lower corner of the image rectangle, the center of the
+;; rotation is the center of the rectangle and min.x and max.x
+;; (resp. min.y and max.y) are the smallest and the largest of the
+;; projections of the vertices onto the first (resp. second) axis.
+
+(defun image-transform-fit-width (width height length)
+  "Return (w . h) so that a rotated w x h image has exactly width LENGTH.
+The rotation angle is the value of `image-transform-rotation'.
+Write W for WIDTH and H for HEIGHT.  Then the w x h rectangle is
+an \"approximately uniformly\" scaled W x H rectangle, which
+currently means that w is one of floor(s W) + {0, 1, -1} and h is
+floor(s H), where s can be recovered as the value of `image-transform-scale'.
+The value of `image-transform-rotation' may be replaced by
+a slightly different angle.  Currently this is done for values
+close to a multiple of 90, see `image-transform-right-angle-fudge'."
+  (cond ((< (abs (- (mod (+ image-transform-rotation 90) 180) 90))
+           image-transform-right-angle-fudge)
+        (cl-assert (not (zerop width)) t)
+        (setq image-transform-rotation
+              (float (round image-transform-rotation))
+              image-transform-scale (/ (float length) width))
+        (cons length nil))
+       ((< (abs (- (mod (+ image-transform-rotation 45) 90) 45))
+           image-transform-right-angle-fudge)
+        (cl-assert (not (zerop height)) t)
+        (setq image-transform-rotation
+              (float (round image-transform-rotation))
+              image-transform-scale (/ (float length) height))
+        (cons nil length))
+       (t
+        (cl-assert (not (and (zerop width) (zerop height))) t)
+        (setq image-transform-scale
+              (/ (float (1- length)) (image-transform-width width height)))
+        ;; Assume we have a w x h image and an angle A, and let l =
+        ;; l(w, h) = w |cos A| + h |sin A|, which is the actual width
+        ;; of the bounding box of the rotated image, as calculated by
+        ;; `image-transform-width'.  The code snippet quoted above
+        ;; means that ImageMagick puts the rotated image in
+        ;; a bounding box of width L = 2 ceil((w+l+1)/2) - w.
+        ;; Elementary considerations show that this is equivalent to
+        ;; L - w being even and L-3 < l(w, h) <= L-1.  In our case, L is
+        ;; the given `length' parameter and our job is to determine
+        ;; reasonable values for w and h which satisfy these
+        ;; conditions.
+        (let ((w (floor (* image-transform-scale width)))
+              (h (floor (* image-transform-scale height))))
+          ;; Let w and h as bound above.  Then l(w, h) <= l(s W, s H)
+          ;; = L-1 < l(w+1, h+1) = l(w, h) + l(1, 1) <= l(w, h) + 2,
+          ;; hence l(w, h) > (L-1) - 2 = L-3.
+          (cons
+           (cond ((= (mod w 2) (mod length 2))
+                  w)
+                 ;; l(w+1, h) >= l(w, h) > L-3, but does l(w+1, h) <=
+                 ;; L-1 hold?
+                 ((<= (image-transform-width (1+ w) h) (1- length))
+                  (1+ w))
+                 ;; No, it doesn't, but this implies that l(w-1, h) =
+                 ;; l(w+1, h) - l(2, 0) >= l(w+1, h) - 2 > (L-1) -
+                 ;; 2 = L-3.  Clearly, l(w-1, h) <= l(w, h) <= L-1.
+                 (t
+                  (1- w)))
+           h)))))
+
+(defun image-transform-check-size ()
+  "Check that the image exactly fits the width/height of the window."
+  (unless (numberp image-transform-resize)
+    (let ((size (image-display-size (image-get-display-property) t)))
+      (cond ((eq image-transform-resize 'fit-width)
+            (cl-assert (= (car size)
+                       (- (nth 2 (window-inside-pixel-edges))
+                          (nth 0 (window-inside-pixel-edges))))
+                    t))
+           ((eq image-transform-resize 'fit-height)
+            (cl-assert (= (cdr size)
+                       (- (nth 3 (window-inside-pixel-edges))
+                          (nth 1 (window-inside-pixel-edges))))
+                    t))))))
+
 (defun image-transform-properties (spec)
   "Return rescaling/rotation properties for image SPEC.
 These properties are determined by the Image mode variables
@@ -647,29 +760,36 @@ return value is suitable for appending to an image spec.
 
 Rescaling and rotation properties only take effect if Emacs is
 compiled with ImageMagick support."
+  (setq image-transform-scale 1.0)
   (when (or image-transform-resize
-           (not (equal image-transform-rotation 0.0)))
+           (/= image-transform-rotation 0.0))
     ;; Note: `image-size' looks up and thus caches the untransformed
     ;; image.  There's no easy way to prevent that.
     (let* ((size (image-size spec t))
-          (height
+          (resized
            (cond
             ((numberp image-transform-resize)
-             (unless (= image-transform-resize 100)
-               (* image-transform-resize (cdr size))))
+             (unless (= image-transform-resize 1)
+               (setq image-transform-scale image-transform-resize)
+               (cons nil (floor (* image-transform-resize (cdr size))))))
+            ((eq image-transform-resize 'fit-width)
+             (image-transform-fit-width
+              (car size) (cdr size)
+              (- (nth 2 (window-inside-pixel-edges))
+                 (nth 0 (window-inside-pixel-edges)))))
             ((eq image-transform-resize 'fit-height)
-             (- (nth 3 (window-inside-pixel-edges))
-                (nth 1 (window-inside-pixel-edges))))))
-          (width (if (eq image-transform-resize 'fit-width)
-                     (- (nth 2 (window-inside-pixel-edges))
-                        (nth 0 (window-inside-pixel-edges))))))
-      ;;TODO fit-to-* should consider the rotation angle
-      `(,@(if height (list :height height))
-       ,@(if width (list :width width))
-       ,@(if (not (equal 0.0 image-transform-rotation))
-             (list :rotation image-transform-rotation))))))
-
-;; FIXME 2 works, but eg 1.9 or 0.5 don't?
+             (let ((res (image-transform-fit-width
+                         (cdr size) (car size)
+                         (- (nth 3 (window-inside-pixel-edges))
+                            (nth 1 (window-inside-pixel-edges))))))
+               (cons (cdr res) (car res)))))))
+      `(,@(when (car resized)
+           (list :width (car resized)))
+       ,@(when (cdr resized)
+           (list :height (cdr resized)))
+       ,@(unless (= 0.0 image-transform-rotation)
+           (list :rotation image-transform-rotation))))))
+
 (defun image-transform-set-scale (scale)
   "Prompt for a number, and resize the current image by that amount.
 This command has no effect unless Emacs is compiled with
@@ -699,9 +819,7 @@ ImageMagick support."
 ROTATION should be in degrees.  This command has no effect unless
 Emacs is compiled with ImageMagick support."
   (interactive "nRotation angle (in degrees): ")
-  ;;TODO 0 90 180 270 degrees are the only reasonable angles here
-  ;;otherwise combining with rescaling will get very awkward
-  (setq image-transform-rotation (float rotation))
+  (setq image-transform-rotation (float (mod rotation 360)))
   (image-toggle-display-image))
 
 (provide 'image-mode)
index be1b1ef8f489b69483ad1368b484029d86f53f26..f5a2de5e595a9d6a3c06e5cb40ec89c33e355188 100644 (file)
@@ -282,7 +282,9 @@ be determined."
                  types nil)
          (setq types (cdr types)))))
     (goto-char opoint)
-    type))
+    (and type
+        (memq type image-types)
+        type)))
 
 
 ;;;###autoload
@@ -412,7 +414,8 @@ means display it in the right marginal area."
          (prop (if (null area) image (list (list 'margin area) image))))
       (put-text-property 0 (length string) 'display prop string)
       (overlay-put overlay 'put-image t)
-      (overlay-put overlay 'before-string string))))
+      (overlay-put overlay 'before-string string)
+      overlay)))
 
 
 ;;;###autoload
@@ -684,43 +687,135 @@ The minimum delay between successive frames is 0.01s."
                      image n count time-elapsed limit))))
 
 \f
-(defcustom imagemagick-types-inhibit
-  '(C HTML HTM TXT PDF)
-  "ImageMagick types that should not be visited in Image mode.
-This should be a list of symbols, each of which should be one of
-the ImageMagick types listed in `imagemagick-types'.  These image
-types are not registered by `imagemagick-register-types'.
-
-If Emacs is compiled without ImageMagick support, this variable
-has no effect."
-  :type '(choice (const :tag "Let ImageMagick handle all types it can" nil)
-                (repeat symbol))
-  ;; Ideally, would have a :set function that checks if we already did
-  ;; imagemagick-register-types, and if so undoes it, then redoes it.
-  :version "24.1"
-  :group 'image)
+(defvar imagemagick-types-inhibit)
+(defvar imagemagick-enabled-types)
+
+(defun imagemagick-filter-types ()
+  "Return a list of the ImageMagick types to be treated as images, or nil.
+This is the result of `imagemagick-types', including only elements
+that match `imagemagick-enabled-types' and do not match
+`imagemagick-types-inhibit'."
+  (when (fboundp 'imagemagick-types)
+    (cond ((null imagemagick-enabled-types) nil)
+         ((eq imagemagick-types-inhibit t) nil)
+         (t
+          (delq nil
+                (mapcar
+                 (lambda (type)
+                   (unless (memq type imagemagick-types-inhibit)
+                     (if (eq imagemagick-enabled-types t) type
+                       (catch 'found
+                         (dolist (enable imagemagick-enabled-types nil)
+                           (if (cond ((symbolp enable) (eq enable type))
+                                     ((stringp enable)
+                                      (string-match enable
+                                                    (symbol-name type))))
+                               (throw 'found type)))))))
+                 (imagemagick-types)))))))
+
+(defvar imagemagick--file-regexp nil
+  "File extension regexp for ImageMagick files, if any.
+This is the extension installed into `auto-mode-alist' and
+`image-type-file-name-regexps' by `imagemagick-register-types'.")
 
 ;;;###autoload
 (defun imagemagick-register-types ()
   "Register file types that can be handled by ImageMagick.
-This registers the ImageMagick types listed in `imagemagick-types',
-excluding those listed in `imagemagick-types-inhibit'.
+This function is called at startup, after loading the init file.
+It registers the ImageMagick types returned by `imagemagick-filter-types'.
 
 Registered image types are added to `auto-mode-alist', so that
 Emacs visits them in Image mode.  They are also added to
 `image-type-file-name-regexps', so that the `image-type' function
 recognizes these files as having image type `imagemagick'.
 
-If Emacs is compiled without ImageMagick support, do nothing."
+If Emacs is compiled without ImageMagick support, this does nothing."
   (when (fboundp 'imagemagick-types)
-    (let ((im-types '()))
-      (dolist (im-type (imagemagick-types))
-        (unless (memq im-type imagemagick-types-inhibit)
-          (push (downcase (symbol-name im-type)) im-types)))
-      (let ((extension (concat "\\." (regexp-opt im-types) "\\'")))
-        (push (cons extension 'image-mode) auto-mode-alist)
-        (push (cons extension 'imagemagick)
-              image-type-file-name-regexps)))))
+    (let* ((types (mapcar (lambda (type) (downcase (symbol-name type)))
+                         (imagemagick-filter-types)))
+          (re (if types (concat "\\." (regexp-opt types) "\\'")))
+          (ama-elt (car (member (cons imagemagick--file-regexp 'image-mode)
+                                auto-mode-alist)))
+          (itfnr-elt (car (member (cons imagemagick--file-regexp 'imagemagick)
+                                  image-type-file-name-regexps))))
+      (if (not re)
+         (setq auto-mode-alist (delete ama-elt auto-mode-alist)
+               image-type-file-name-regexps
+               (delete itfnr-elt image-type-file-name-regexps))
+       (if ama-elt
+           (setcar ama-elt re)
+         (push (cons re 'image-mode) auto-mode-alist))
+       (if itfnr-elt
+           (setcar itfnr-elt re)
+         ;; Append to `image-type-file-name-regexps', so that we
+         ;; preferentially use specialized image libraries.
+         (add-to-list 'image-type-file-name-regexps
+                      (cons re 'imagemagick) t)))
+      (setq imagemagick--file-regexp re))))
+
+(defcustom imagemagick-types-inhibit
+  '(C HTML HTM INFO M TXT PDF)
+  "List of ImageMagick types that should never be treated as images.
+This should be a list of symbols, each of which should be one of
+the ImageMagick types listed by `imagemagick-types'.  The listed
+image types are not registered by `imagemagick-register-types'.
+
+If the value is t, inhibit the use of ImageMagick for images.
+
+If you change this without using customize, you must call
+`imagemagick-register-types' afterwards.
+
+If Emacs is compiled without ImageMagick support, this variable
+has no effect."
+  :type '(choice (const :tag "Support all ImageMagick types" nil)
+                (const :tag "Disable all ImageMagick types" t)
+                (repeat symbol))
+  :initialize 'custom-initialize-default
+  :set (lambda (symbol value)
+        (set-default symbol value)
+        (imagemagick-register-types))
+  :version "24.2"
+  :group 'image)
+
+(defcustom imagemagick-enabled-types
+  '(3FR ART ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW
+    CUR CUT DCM DCR DCX DDS DJVU DNG DPX EXR FAX FITS GBR GIF
+    GIF87 GRB HRZ ICB ICO ICON J2C JNG JP2 JPC JPEG JPG JPX K25
+    KDC MIFF MNG MRW MSL MSVG MTV NEF ORF OTB PBM PCD PCDS PCL
+    PCT PCX PDB PEF PGM PICT PIX PJPEG PNG PNG24 PNG32 PNG8 PNM
+    PPM PSD PTIF PWP RAF RAS RBG RGB RGBA RGBO RLA RLE SCR SCT
+    SFW SGI SR2 SRF SUN SVG SVGZ TGA TIFF TIFF64 TILE TIM TTF
+    UYVY VDA VICAR VID VIFF VST WBMP WPG X3F XBM XC XCF XPM XV
+    XWD YCbCr YCbCrA YUV)
+  "List of ImageMagick types to treat as images.
+Each list element should be a string or symbol, representing one
+of the image types returned by `imagemagick-types'.  If the
+element is a string, it is handled as a regexp that enables all
+matching types.
+
+The value of `imagemagick-enabled-types' may also be t, meaning
+to enable all types that ImageMagick supports.
+
+The variable `imagemagick-types-inhibit' overrides this variable.
+
+If you change this without outside of Customize, you must call
+`imagemagick-register-types' afterwards.
+
+If Emacs is compiled without ImageMagick support, this variable
+has no effect."
+  :type '(choice (const :tag "Support all ImageMagick types" t)
+                (const :tag "Disable all ImageMagick types" nil)
+                (repeat :tag "List of types"
+                        (choice (symbol :tag "type")
+                                (regexp :tag "regexp"))))
+  :initialize 'custom-initialize-default
+  :set (lambda (symbol value)
+        (set-default symbol value)
+        (imagemagick-register-types))
+  :version "24.2"
+  :group 'image)
+
+(imagemagick-register-types)
 
 (provide 'image)
 
index 5472f4246d1ec50c484f88a826321923bc26eccd..8cef5161a37324ddca55f536eaa74bec80f67d01 100644 (file)
@@ -1,4 +1,4 @@
-;;; imenu.el --- framework for mode-specific buffer indexes
+;;; imenu.el --- framework for mode-specific buffer indexes  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1994-1998, 2001-2012 Free Software Foundation, Inc.
 
@@ -59,7 +59,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
@@ -266,12 +266,12 @@ The function in this variable is called when selecting a normal index-item.")
   (and (consp (cdr item)) (listp (cadr item))
        (not (eq (car (cadr item)) 'lambda))))
 
-;; Macro to display a progress message.
-;; RELPOS is the relative position to display.
-;; If RELPOS is nil, then the relative position in the buffer
-;; is calculated.
-;; PREVPOS is the variable in which we store the last position displayed.
-(defmacro imenu-progress-message (prevpos &optional relpos reverse)
+(defmacro imenu-progress-message (_prevpos &optional _relpos _reverse)
+  "Macro to display a progress message.
+RELPOS is the relative position to display.
+If RELPOS is nil, then the relative position in the buffer
+is calculated.
+PREVPOS is the variable in which we store the last position displayed."
 
 ;; Made obsolete/empty, as computers are now faster than the eye, and
 ;; it had problems updating the messages correctly, and could shadow
@@ -280,13 +280,13 @@ The function in this variable is called when selecting a normal index-item.")
 ;;  `(and
 ;;    imenu-scanning-message
 ;;    (let ((pos ,(if relpos
-;;                 relpos
-;;               `(imenu--relative-position ,reverse))))
-;;      (if ,(if relpos t
-;;          `(> pos (+ 5 ,prevpos)))
-;;       (progn
-;;         (message imenu-scanning-message pos)
-;;         (setq ,prevpos pos)))))
+;;                relpos
+;;              `(imenu--relative-position ,reverse))))
+;;     (if ,(if relpos t
+;;         `(> pos (+ 5 ,prevpos)))
+;;      (progn
+;;        (message imenu-scanning-message pos)
+;;        (setq ,prevpos pos)))))
 )
 
 
@@ -338,13 +338,10 @@ Don't move point."
   (let ((index-alist '())
        (index-var-alist '())
        (index-type-alist '())
-       (index-unknown-alist '())
-       prev-pos)
+       (index-unknown-alist '()))
     (goto-char (point-max))
-    (imenu-progress-message prev-pos 0)
     ;; Search for the function
     (while (beginning-of-defun)
-      (imenu-progress-message prev-pos nil t)
          (save-match-data
            (and (looking-at "(def")
                 (save-excursion
@@ -371,7 +368,6 @@ Don't move point."
                     (forward-sexp 2)
                     (push (imenu-example--name-and-position)
                       index-unknown-alist)))))))
-    (imenu-progress-message prev-pos 100)
     (and index-var-alist
         (push (cons "Variables" index-var-alist)
               index-alist))
@@ -396,15 +392,13 @@ Don't move point."
 
 (defun imenu-example--create-c-index (&optional regexp)
   (let ((index-alist '())
-       prev-pos char)
+       char)
     (goto-char (point-min))
-    (imenu-progress-message prev-pos 0)
     ;; Search for the function
     (save-match-data
       (while (re-search-forward
              (or regexp imenu-example--function-name-regexp-c)
              nil t)
-       (imenu-progress-message prev-pos)
        (backward-up-list 1)
        (save-excursion
          (goto-char (scan-sexps (point) 1))
@@ -412,7 +406,6 @@ Don't move point."
        ;; Skip this function name if it is a prototype declaration.
        (if (not (eq char ?\;))
            (push (imenu-example--name-and-position) index-alist))))
-    (imenu-progress-message prev-pos 100)
     (nreverse index-alist)))
 (make-obsolete 'imenu-example--create-c-index "your own" "23.2")
 
@@ -426,8 +419,7 @@ Don't move point."
 (defconst imenu--rescan-item '("*Rescan*" . -99))
 
 ;; The latest buffer index.
-;; Buffer local.
-(defvar imenu--index-alist nil
+(defvar-local imenu--index-alist nil
   "The buffer index alist computed for this buffer in Imenu.
 
 Simple elements in the alist look like (INDEX-NAME . POSITION).
@@ -446,16 +438,12 @@ There is one simple element with negative POSITION; selecting that
 element recalculates the buffer's index alist.")
 ;;;###autoload(put 'imenu--index-alist 'risky-local-variable t)
 
-(make-variable-buffer-local 'imenu--index-alist)
-
-(defvar imenu--last-menubar-index-alist nil
+(defvar-local imenu--last-menubar-index-alist nil
   "The latest buffer index alist used to update the menu bar menu.")
 
-(make-variable-buffer-local 'imenu--last-menubar-index-alist)
-
-;; History list for 'jump-to-function-in-buffer'.
-;; Making this buffer local caused it not to work!
-(defvar imenu--history-list nil)
+(defvar imenu--history-list nil
+  ;; Making this buffer local caused it not to work!
+  "History list for 'jump-to-function-in-buffer'.")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
@@ -463,21 +451,18 @@ element recalculates the buffer's index alist.")
 ;;;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-;;;
-;;; Sort function
-;;; Sorts the items depending on their index name.
-;;; An item looks like (NAME . POSITION).
-;;;
 (defun imenu--sort-by-name (item1 item2)
+  "Comparison function to sort items depending on their index name.
+An item looks like (NAME . POSITION)."
   (string-lessp (car item1) (car item2)))
 
 (defun imenu--sort-by-position (item1 item2)
   (< (cdr item1) (cdr item2)))
 
 (defun imenu--relative-position (&optional reverse)
-  ;; Support function to calculate relative position in buffer
-  ;; Beginning of buffer is 0 and end of buffer is 100
-  ;; If REVERSE is non-nil then the beginning is 100 and the end is 0.
+  "Support function to calculate relative position in buffer.
+Beginning of buffer is 0 and end of buffer is 100
+If REVERSE is non-nil then the beginning is 100 and the end is 0."
   (let ((pos (point))
        (total (buffer-size)))
     (and reverse (setq pos (- total pos)))
@@ -486,18 +471,17 @@ element recalculates the buffer's index alist.")
        (/ (1- pos) (max (/ total 100) 1))
       (/ (* 100 (1- pos)) (max total 1)))))
 
-;; Split LIST into sublists of max length N.
-;; Example (imenu--split '(1 2 3 4 5 6 7 8) 3)-> '((1 2 3) (4 5 6) (7 8))
-;;
-;; The returned list DOES NOT share structure with LIST.
 (defun imenu--split (list n)
+  "Split LIST into sublists of max length N.
+Example (imenu--split '(1 2 3 4 5 6 7 8) 3)-> '((1 2 3) (4 5 6) (7 8))
+The returned list DOES NOT share structure with LIST."
   (let ((remain list)
        (result '())
        (sublist '())
        (i 0))
     (while remain
       (push (pop remain) sublist)
-      (incf i)
+      (cl-incf i)
       (and (= i n)
           ;; We have finished a sublist
           (progn (push (nreverse sublist) result)
@@ -509,20 +493,18 @@ element recalculates the buffer's index alist.")
         (push (nreverse sublist) result))
     (nreverse result)))
 
-;;; Split the alist MENULIST into a nested alist, if it is long enough.
-;;; In any case, add TITLE to the front of the alist.
-;;; If IMENU--RESCAN-ITEM is present in MENULIST, it is moved to the
-;;; beginning of the returned alist.
-;;;
-;;; The returned alist DOES NOT share structure with MENULIST.
 (defun imenu--split-menu (menulist title)
+  "Split the alist MENULIST into a nested alist, if it is long enough.
+In any case, add TITLE to the front of the alist.
+If IMENU--RESCAN-ITEM is present in MENULIST, it is moved to the
+beginning of the returned alist.
+The returned alist DOES NOT share structure with MENULIST."
   (let ((menulist (copy-sequence menulist))
-        keep-at-top tail)
+        keep-at-top)
     (if (memq imenu--rescan-item menulist)
        (setq keep-at-top (list imenu--rescan-item)
              menulist (delq imenu--rescan-item menulist)))
-    (setq tail menulist)
-    (dolist (item tail)
+    (dolist (item menulist)
       (when (imenu--subalist-p item)
        (push item keep-at-top)
        (setq menulist (delq item menulist))))
@@ -537,32 +519,28 @@ element recalculates the buffer's index alist.")
     (cons title
          (nconc (nreverse keep-at-top) menulist))))
 
-;;; Split up each long alist that are nested within ALIST
-;;; into nested alists.
-;;;
-;;; Return a split and sorted copy of ALIST. The returned alist DOES
-;;; NOT share structure with ALIST.
 (defun imenu--split-submenus (alist)
-  (mapcar (function
-          (lambda (elt)
-            (if (and (consp elt)
-                     (stringp (car elt))
-                     (listp (cdr elt)))
-                (imenu--split-menu (cdr elt) (car elt))
-              elt)))
+  "Split up each long alist that are nested within ALIST into nested alists.
+Return a split and sorted copy of ALIST.  The returned alist DOES
+NOT share structure with ALIST."
+  (mapcar (lambda (elt)
+            (if (and (consp elt)
+                     (stringp (car elt))
+                     (listp (cdr elt)))
+                (imenu--split-menu (cdr elt) (car elt))
+              elt))
          alist))
 
-;;; Truncate all strings in MENULIST to imenu-max-item-length
 (defun imenu--truncate-items (menulist)
-  (mapcar (function
-          (lambda (item)
-            (cond
-             ((consp (cdr item))
-              (imenu--truncate-items (cdr item)))
-             ;; truncate if necessary
-             ((and (numberp imenu-max-item-length)
-                   (> (length (car item)) imenu-max-item-length))
-              (setcar item (substring (car item) 0 imenu-max-item-length))))))
+  "Truncate all strings in MENULIST to `imenu-max-item-length'."
+  (mapcar (lambda (item)
+            (cond
+             ((consp (cdr item))
+              (imenu--truncate-items (cdr item)))
+             ;; truncate if necessary
+             ((and (numberp imenu-max-item-length)
+                   (> (length (car item)) imenu-max-item-length))
+              (setcar item (substring (car item) 0 imenu-max-item-length)))))
          menulist))
 
 
@@ -586,19 +564,18 @@ See `imenu--index-alist' for the format of the index alist."
                  (funcall imenu-create-index-function))))
        (imenu--truncate-items imenu--index-alist)))
   (or imenu--index-alist noerror
-      (error "No items suitable for an index found in this buffer"))
+      (user-error "No items suitable for an index found in this buffer"))
   (or imenu--index-alist
       (setq imenu--index-alist (list nil)))
   ;; Add a rescan option to the index.
   (cons imenu--rescan-item imenu--index-alist))
 
-;;; Find all markers in alist and makes
-;;; them point nowhere.
-;;; The top-level call uses nil as the argument;
-;;; non-nil arguments are in recursive calls.
-(defvar imenu--cleanup-seen)
+(defvar imenu--cleanup-seen nil)
 
 (defun imenu--cleanup (&optional alist)
+  "Find all markers in ALIST and make them point nowhere.
+If ALIST is nil (the normal case), use `imenu--index-alist'.
+Non-nil arguments are in recursive calls."
   ;; If alist is provided use that list.
   ;; If not, empty the table of lists already seen
   ;; and use imenu--index-alist.
@@ -606,31 +583,27 @@ See `imenu--index-alist' for the format of the index alist."
       (setq imenu--cleanup-seen (cons alist imenu--cleanup-seen))
     (setq alist imenu--index-alist imenu--cleanup-seen (list alist)))
 
-  (and alist
-       (mapc
-       (lambda (item)
-         (cond
-          ((markerp (cdr item))
-           (set-marker (cdr item) nil))
-          ;; Don't process one alist twice.
-          ((memq (cdr item) imenu--cleanup-seen))
-          ((imenu--subalist-p item)
-           (imenu--cleanup (cdr item)))))
-       alist)
-       t))
+  (when alist
+    (dolist (item alist)
+      (cond
+       ((markerp (cdr item)) (set-marker (cdr item) nil))
+       ;; Don't process one alist twice.
+       ((memq (cdr item) imenu--cleanup-seen))
+       ((imenu--subalist-p item) (imenu--cleanup (cdr item)))))
+    t))
 
 (defun imenu--create-keymap (title alist &optional cmd)
-  (list* 'keymap title
-        (mapcar
-         (lambda (item)
-           (list* (car item) (car item)
-                  (cond
-                   ((imenu--subalist-p item)
-                    (imenu--create-keymap (car item) (cdr item) cmd))
-                   (t
-                    `(lambda () (interactive)
-                       ,(if cmd `(,cmd ',item) (list 'quote item)))))))
-         alist)))
+  `(keymap ,title
+           ,@(mapcar
+              (lambda (item)
+                `(,(car item) ,(car item)
+                  ,@(cond
+                     ((imenu--subalist-p item)
+                      (imenu--create-keymap (car item) (cdr item) cmd))
+                     (t
+                      `(lambda () (interactive)
+                         ,(if cmd `(,cmd ',item) (list 'quote item)))))))
+              alist)))
 
 (defun imenu--in-alist (str alist)
   "Check whether the string STR is contained in multi-level ALIST."
@@ -684,28 +657,25 @@ The alternate method, which is the one most often used, is to call
   (cond ((and imenu-prev-index-position-function
              imenu-extract-index-name-function)
         (let ((index-alist '()) (pos (point))
-              prev-pos name)
+              name)
           (goto-char (point-max))
-          (imenu-progress-message prev-pos 0 t)
           ;; Search for the function
           (while (funcall imenu-prev-index-position-function)
              (when (= pos (point))
                (error "Infinite loop at %s:%d: imenu-prev-index-position-function does not move point" (buffer-name) pos))
              (setq pos (point))
-            (imenu-progress-message prev-pos nil t)
             (save-excursion
               (setq name (funcall imenu-extract-index-name-function)))
             (and (stringp name)
                  ;; [ydi] updated for imenu-use-markers
                  (push (cons name (if imenu-use-markers (point-marker) (point)))
                        index-alist)))
-          (imenu-progress-message prev-pos 100 t)
           index-alist))
        ;; Use generic expression if possible.
        ((and imenu-generic-expression)
         (imenu--generic-function imenu-generic-expression))
        (t
-        (error "This buffer cannot use `imenu-default-create-index-function'"))))
+        (user-error "This buffer cannot use `imenu-default-create-index-function'"))))
 
 ;;;
 ;;; Generic index gathering function.
@@ -765,7 +735,6 @@ They may also be nested index alists like:
 depending on PATTERNS."
 
   (let ((index-alist (list 'dummy))
-       prev-pos
         (case-fold-search (if (or (local-variable-p 'imenu-case-fold-search)
                                  (not (local-variable-p 'font-lock-defaults)))
                              imenu-case-fold-search
@@ -782,7 +751,6 @@ depending on PATTERNS."
                 (modify-syntax-entry c (cdr syn) table))
               (car syn))))
     (goto-char (point-max))
-    (imenu-progress-message prev-pos 0 t)
     (unwind-protect                    ; for syntax table
        (save-match-data
          (set-syntax-table table)
@@ -800,7 +768,17 @@ depending on PATTERNS."
              (goto-char (point-max))
              (while (and (if (functionp regexp)
                              (funcall regexp)
-                           (re-search-backward regexp nil t))
+                           (and
+                            (re-search-backward regexp nil t)
+                            ;; Do not count invisible definitions.
+                            (let ((invis (invisible-p (point))))
+                              (or (not invis)
+                                  (progn
+                                    (while (and invis
+                                                (not (bobp)))
+                                      (setq invis (not (re-search-backward
+                                                        regexp nil 'move))))
+                                    (not invis))))))
                          ;; Exit the loop if we get an empty match,
                          ;; because it means a bad regexp was specified.
                          (not (= (match-beginning 0) (match-end 0))))
@@ -810,7 +788,6 @@ depending on PATTERNS."
                (goto-char (match-beginning index))
                (beginning-of-line)
                (setq beg (point))
-               (imenu-progress-message prev-pos nil t)
                ;; Add this sort of submenu only when we've found an
                ;; item for it, avoiding empty, duff menus.
                (unless (assoc menu-title index-alist)
@@ -835,7 +812,6 @@ depending on PATTERNS."
                ;; keep making progress backwards.
                (goto-char start))))
          (set-syntax-table old-table)))
-    (imenu-progress-message prev-pos 100 t)
     ;; Sort each submenu by position.
     ;; This is in case one submenu gets items from two different regexps.
     (dolist (item index-alist)
@@ -972,8 +948,8 @@ See the command `imenu' for more information."
            `(menu-item ,name ,(make-sparse-keymap "Imenu")))
          (use-local-map newmap)
          (add-hook 'menu-bar-update-hook 'imenu-update-menubar)))
-    (error "The mode `%s' does not support Imenu"
-           (format-mode-line mode-name))))
+    (user-error "The mode `%s' does not support Imenu"
+                (format-mode-line mode-name))))
 
 ;;;###autoload
 (defun imenu-add-menubar-index ()
@@ -985,10 +961,9 @@ A trivial interface to `imenu-add-to-menubar' suitable for use in a hook."
 
 (defvar imenu-buffer-menubar nil)
 
-(defvar imenu-menubar-modified-tick 0
+(defvar-local imenu-menubar-modified-tick 0
   "The value of (buffer-chars-modified-tick) as of the last call
 to `imenu-update-menubar'.")
-(make-variable-buffer-local 'imenu-menubar-modified-tick)
 
 (defun imenu-update-menubar ()
   (when (and (current-local-map)
@@ -1029,7 +1004,7 @@ to `imenu-update-menubar'.")
     (imenu item)
     nil))
 
-(defun imenu-default-goto-function (name position &optional rest)
+(defun imenu-default-goto-function (_name position &optional _rest)
   "Move to the given position.
 
 NAME is ignored.  POSITION is where to move.  REST is also ignored.
@@ -1062,12 +1037,6 @@ for more information."
       (apply function (car index-item) position rest))
     (run-hooks 'imenu-after-jump-hook)))
 
-(dolist (mess
-        '("^No items suitable for an index found in this buffer$"
-          "^This buffer cannot use `imenu-default-create-index-function'$"
-          "^The mode `.*' does not support Imenu$"))
-  (add-to-list 'debug-ignored-errors mess))
-
 (provide 'imenu)
 
 ;;; imenu.el ends here
index 5eca62ed1bd9704c88e308db1e675d4c1babbc3f..eb780fe562075442ad0bf2ce1d5d0e166fde0a5d 100644 (file)
@@ -732,7 +732,7 @@ Return nil if there is nothing appropriate in the buffer near point."
  :parse-rule "\\$[^({]\\|\\.[_A-Z]*\\|[_a-zA-Z0-9-]+\\|##\\|\\+="
  :doc-spec   '(
                ;; "(automake)Macro Index" is autoconf macros used in
-               ;; configure.in, not Makefile.am, so don't have that here.
+               ;; configure.ac, not Makefile.am, so don't have that here.
                ("(automake)Variable Index" nil "^[ \t]*`" "'")
                ;; In automake 1.4 macros and variables were a combined node.
                ("(automake)Macro and Variable Index" nil "^[ \t]*`" "'")
index 69ec00ce09d1097c2d5c336d4f7aee001c6e5738..ebe50551a692cfabf3e53b7eac25e420accb7c9b 100644 (file)
@@ -45,8 +45,7 @@
 ;;; Code:
 
 (require 'info)
-(eval-when-compile
-  (require 'cl)) ;; for `incf'
+(eval-when-compile (require 'cl-lib)) ;; for `incf'
 
 ;;-----------------------------------------------------------------------------
 ;; vaguely generic
@@ -239,11 +238,11 @@ buffer's line and column of point."
 
         ;; if the file exists, try the node
         (cond ((not (cdr (assoc file info-xref-xfile-alist)))
-               (incf info-xref-unavail))
+               (cl-incf info-xref-unavail))
               ((info-xref-goto-node-p node)
-               (incf info-xref-good))
+               (cl-incf info-xref-good))
               (t
-               (incf info-xref-bad)
+               (cl-incf info-xref-bad)
                (info-xref-output-error "no such node: %s" node)))))))
 
 
@@ -447,8 +446,8 @@ and can take a long time."
           (if (eq :tag (cadr link))
               (setq link (cddr link)))
           (if (info-xref-goto-node-p (cadr link))
-              (incf info-xref-good)
-            (incf info-xref-bad)
+              (cl-incf info-xref-good)
+            (cl-incf info-xref-bad)
             ;; symbol-file gives nil for preloaded variables, would need
             ;; to copy what describe-variable does to show the right place
             (info-xref-output "Symbol `%s' (file %s): cannot goto node: %s"
index 042ff1583620fb149824d5bd3b587a17d8ef849e..163e0af161af3e5f57140023727fc64fc2d3a47d 100644 (file)
@@ -1,6 +1,6 @@
 ;; info.el --- info package for Emacs
 
-;; Copyright (C) 1985-1986, 1992-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1992-2012 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: help
@@ -32,8 +32,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defgroup info nil
   "Info subsystem."
   :group 'help
@@ -169,6 +167,83 @@ A header-line does not scroll with the rest of the buffer."
   "Face for Info nodes in a node header."
   :group 'info)
 
+;; This is a defcustom largely so that we can get the benefit
+;; of custom-initialize-delay.  Perhaps it would work to make it a
+;; defvar and explicitly give it a standard-value property, and
+;; call custom-initialize-delay on it.
+;; The progn forces the autoloader to include the whole thing, not
+;; just an abbreviated version.
+;;;###autoload
+(progn
+(defcustom Info-default-directory-list
+  (let* ((config-dir
+         (file-name-as-directory
+          ;; Self-contained NS build with info/ in the app-bundle.
+          (or (and (featurep 'ns)
+                   (let ((dir (expand-file-name "../info" data-directory)))
+                     (if (file-directory-p dir) dir)))
+              configure-info-directory)))
+        (prefixes
+         ;; Directory trees in which to look for info subdirectories
+         (prune-directory-list '("/usr/local/" "/usr/" "/opt/" "/")))
+        (suffixes
+         ;; Subdirectories in each directory tree that may contain info
+         ;; directories.  Most of these are rather outdated.
+         ;; It ought to be fine to stop checking the "emacs" ones now,
+         ;; since this is Emacs and we have not installed info files
+         ;; into such directories for a looong time...
+         '("share/" "" "gnu/" "gnu/lib/" "gnu/lib/emacs/"
+           "emacs/" "lib/" "lib/emacs/"))
+        (standard-info-dirs
+         (apply #'nconc
+                (mapcar (lambda (pfx)
+                          (let ((dirs
+                                 (mapcar (lambda (sfx)
+                                           (concat pfx sfx "info/"))
+                                         suffixes)))
+                            (prune-directory-list dirs)))
+                        prefixes)))
+        ;; If $(prefix)/share/info is not one of the standard info
+        ;; directories, they are probably installing an experimental
+        ;; version of Emacs, so make sure that experimental version's Info
+        ;; files override the ones in standard directories.
+        (dirs
+         (if (member config-dir standard-info-dirs)
+             ;; FIXME?  What is the point of adding it again at the end
+             ;; when it is already present earlier in the list?
+             (nconc standard-info-dirs (list config-dir))
+           (cons config-dir standard-info-dirs))))
+    (if (not (eq system-type 'windows-nt))
+       dirs
+      ;; Include the info directory near where Emacs executable was installed.
+      (let* ((instdir (file-name-directory invocation-directory))
+            (dir1 (expand-file-name "../info/" instdir))
+            (dir2 (expand-file-name "../../../info/" instdir)))
+       (cond ((file-exists-p dir1) (append dirs (list dir1)))
+             ((file-exists-p dir2) (append dirs (list dir2)))
+             (t dirs)))))
+
+  "Default list of directories to search for Info documentation files.
+They are searched in the order they are given in the list.
+Therefore, the directory of Info files that come with Emacs
+normally should come last (so that local files override standard ones),
+unless Emacs is installed into a non-standard directory.  In the latter
+case, the directory of Info files that come with Emacs should be
+first in this list.
+
+Once Info is started, the list of directories to search
+comes from the variable `Info-directory-list'.
+This variable `Info-default-directory-list' is used as the default
+for initializing `Info-directory-list' when Info is started, unless
+the environment variable INFOPATH is set.
+
+Although this is a customizable variable, that is mainly for technical
+reasons.  Normally, you should either set INFOPATH or customize
+`Info-additional-directory-list', rather than changing this variable."
+  :initialize 'custom-initialize-delay
+  :type '(repeat directory)
+  :group 'info))
+
 (defvar Info-directory-list nil
   "List of directories to search for Info documentation files.
 If nil, meaning not yet initialized, Info uses the environment
@@ -618,7 +693,19 @@ in `Info-file-supports-index-cookies-list'."
                     (append (split-string (substring path 0 -1) sep)
                             (Info-default-dirs))
                   (split-string path sep))
-              (Info-default-dirs)))))))
+              (Info-default-dirs))))
+      ;; For a self-contained (ie relocatable) NS build, AFAICS we
+      ;; always want the included info directory to be at the head of
+      ;; the search path, unless it's already in INFOPATH somewhere.
+      ;; It's at the head of Info-default-directory-list,
+      ;; but there's no way to get it at the head of Info-directory-list
+      ;; except by doing it here.
+      (and path
+          (featurep 'ns)
+          (let ((dir (expand-file-name "../info" data-directory)))
+            (and (file-directory-p dir)
+                 (not (member dir (split-string path ":" t)))
+                 (push dir Info-directory-list)))))))
 
 ;;;###autoload
 (defun info-other-window (&optional file-or-node)
@@ -682,6 +769,12 @@ See a list of available Info commands in `Info-mode'."
   (interactive)
   (info "emacs"))
 
+;;;###autoload
+(defun info-emacs-bug ()
+  "Display the \"Reporting Bugs\" section of the Emacs manual in Info mode."
+  (interactive)
+  (info "(emacs)Bugs"))
+
 ;;;###autoload
 (defun info-standalone ()
   "Run Emacs as a standalone Info reader.
@@ -1071,7 +1164,7 @@ a case-insensitive match is tried."
                 (throw 'foo t))
 
               ;; No such anchor in tag table or node in tag table or file
-              (error "No such node or anchor: %s" nodename))
+              (user-error "No such node or anchor: %s" nodename))
 
            (Info-select-node)
            (goto-char (point-min))
@@ -1907,26 +2000,23 @@ If DIRECTION is `backward', search in the reverse direction."
 (defun Info-isearch-search ()
   (if Info-isearch-search
       (lambda (string &optional bound noerror count)
-       (if isearch-word
-           (Info-search (concat "\\b" (replace-regexp-in-string
-                                       "\\W+" "\\W+"
-                                       (replace-regexp-in-string
-                                        "^\\W+\\|\\W+$" "" string)
-                                       nil t)
-                                ;; Lax version of word search
-                                (if (or isearch-nonincremental
-                                        (eq (length string)
-                                            (length (isearch-string-state
-                                                     (car isearch-cmds)))))
-                                    "\\b"))
-                        bound noerror count
-                        (unless isearch-forward 'backward))
-         (Info-search (if isearch-regexp string (regexp-quote string))
-                      bound noerror count
-                      (unless isearch-forward 'backward)))
+       (Info-search
+        (cond
+         (isearch-word
+          ;; Lax version of word search
+          (let ((lax (not (or isearch-nonincremental
+                              (eq (length string)
+                                  (length (isearch-string-state
+                                           (car isearch-cmds))))))))
+            (if (functionp isearch-word)
+                (funcall isearch-word string lax)
+              (word-search-regexp string lax))))
+         (isearch-regexp string)
+         (t (regexp-quote string)))
+        bound noerror count
+        (unless isearch-forward 'backward))
        (point))
-    (let ((isearch-search-fun-function nil))
-      (isearch-search-fun))))
+    (isearch-search-fun-default)))
 
 (defun Info-isearch-wrap ()
   (if Info-isearch-search
@@ -2012,8 +2102,8 @@ if ERRORNAME is nil, just return nil."
                (concat name ":" (Info-following-node-name-re)) bound t)
               (match-string-no-properties 1))
              ((not (eq errorname t))
-              (error "Node has no %s"
-                     (capitalize (or errorname name)))))))))
+              (user-error "Node has no %s"
+                           (capitalize (or errorname name)))))))))
 
 (defun Info-following-node-name-re (&optional allowedchars)
   "Return a regexp matching a node name.
@@ -2082,7 +2172,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
   "Go back in the history to the last node visited."
   (interactive)
   (or Info-history
-      (error "This is the first Info node you looked at"))
+      (user-error "This is the first Info node you looked at"))
   (let ((history-forward
         (cons (list Info-current-file Info-current-node (point))
               Info-history-forward))
@@ -2102,7 +2192,7 @@ If SAME-FILE is non-nil, do not move to a different Info file."
   "Go forward in the history of visited nodes."
   (interactive)
   (or Info-history-forward
-      (error "This is the last Info node you looked at"))
+      (user-error "This is the last Info node you looked at"))
   (let ((history-forward (cdr Info-history-forward))
        filename nodename opoint)
     (setq filename (car (car Info-history-forward)))
@@ -2388,7 +2478,7 @@ new buffer."
                                       completions nil t)))
           (list (if (equal input "")
                     default input) current-prefix-arg))
-       (error "No cross-references in this node"))))
+       (user-error "No cross-references in this node"))))
 
   (unless footnotename
     (error "No reference was specified"))
@@ -2419,7 +2509,8 @@ new buffer."
                                  (abs (- prev-ref (point))))
                               next-ref prev-ref))
                          ((or next-ref prev-ref))
-                         ((error "No cross-reference named %s" footnotename))))
+                         ((user-error "No cross-reference named %s"
+                                      footnotename))))
         (setq target (Info-extract-menu-node-name t))))
     (while (setq i (string-match "[ \t\n]+" target i))
       (setq target (concat (substring target 0 i) " "
@@ -2564,7 +2655,7 @@ new buffer."
      (save-excursion
        (goto-char (point-min))
        (if (not (search-forward "\n* menu:" nil t))
-          (error "No menu in this node"))
+          (user-error "No menu in this node"))
        (setq beg (point))
        (and (< (point) p)
            (save-excursion
@@ -2605,10 +2696,10 @@ new buffer."
       (let ((case-fold-search t))
        (goto-char (point-min))
        (or (search-forward "\n* menu:" nil t)
-           (error "No menu in this node"))
+           (user-error "No menu in this node"))
        (or (re-search-forward (concat "\n\\* +" menu-item ":") nil t)
            (re-search-forward (concat "\n\\* +" menu-item) nil t)
-           (error "No such item in menu"))
+           (user-error "No such item in menu"))
        (beginning-of-line)
        (forward-char 2)
        (Info-extract-menu-node-name nil (Info-index-node))))))
@@ -2624,7 +2715,7 @@ new buffer."
                     (match-beginning 0))))
        (goto-char (point-min))
        (or (search-forward "\n* menu:" bound t)
-           (error "No menu in this node"))
+           (user-error "No menu in this node"))
        (if count
            (or (search-forward "\n* " bound t count)
                (error "Too few items in menu"))
@@ -2696,7 +2787,7 @@ N is the digit argument used to invoke this command."
               (if Info-history-skip-intermediate-nodes
                   (setq Info-history old-history)))))
          (no-error nil)
-         (t (error "No pointer forward from this node")))))
+         (t (user-error "No pointer forward from this node")))))
 
 (defun Info-backward-node ()
   "Go backward one node, considering all nodes as forming one sequence."
@@ -2705,7 +2796,7 @@ N is the digit argument used to invoke this command."
        (upnode (Info-extract-pointer "up" t))
        (case-fold-search t))
     (cond ((and upnode (string-match "(" upnode))
-          (error "First node in file"))
+          (user-error "First node in file"))
          ((and upnode (or (null prevnode)
                           ;; Use string-equal, not equal,
                           ;; to ignore text properties.
@@ -2723,7 +2814,7 @@ N is the digit argument used to invoke this command."
             (if Info-history-skip-intermediate-nodes
                 (setq Info-history old-history))))
          (t
-          (error "No pointer backward from this node")))))
+          (user-error "No pointer backward from this node")))))
 
 (defun Info-exit ()
   "Exit Info by selecting some other buffer."
@@ -2744,7 +2835,7 @@ N is the digit argument used to invoke this command."
            (and (search-forward "\n* " nil t)
                 (Info-extract-menu-node-name)))))
     (if node (Info-goto-node node)
-      (error "No more items in menu"))))
+      (user-error "No more items in menu"))))
 
 (defun Info-last-menu-item ()
   "Go to the node of the previous menu item."
@@ -2757,7 +2848,7 @@ N is the digit argument used to invoke this command."
                  (and (search-backward "\n* menu:" nil t)
                       (point)))))
       (or (and beg (search-backward "\n* " beg t))
-         (error "No previous items in menu")))
+         (user-error "No previous items in menu")))
     (Info-goto-node (save-excursion
                      (goto-char (match-end 0))
                      (Info-extract-menu-node-name)))))
@@ -2782,7 +2873,7 @@ N is the digit argument used to invoke this command."
           (if Info-history-skip-intermediate-nodes
               (setq Info-history old-history))))
        (t
-        (error "No more nodes"))))
+        (user-error "No more nodes"))))
 
 (defun Info-last-preorder ()
   "Go to the last node, popping up a level if there is none."
@@ -2822,7 +2913,7 @@ N is the digit argument used to invoke this command."
         (let ((case-fold-search t))
           (or (search-forward "\n* Menu:" nil t)
               (goto-char (point-max)))))
-       (t (error "No previous nodes"))))
+       (t (user-error "No previous nodes"))))
 
 (defun Info-scroll-up ()
   "Scroll one screenful forward in Info, considering all nodes as one sequence.
@@ -2911,11 +3002,11 @@ See `Info-scroll-down'."
          (or (re-search-forward pat nil t)
              (progn
                (goto-char old-pt)
-               (error "No cross references in this node")))))
+               (user-error "No cross references in this node")))))
     (goto-char (or (match-beginning 1) (match-beginning 0)))
     (if (looking-at "\\* Menu:")
        (if recur
-           (error "No cross references in this node")
+           (user-error "No cross references in this node")
          (Info-next-reference t))
       (if (looking-at "^\\* ")
          (forward-char 2)))))
@@ -2932,11 +3023,11 @@ See `Info-scroll-down'."
          (or (re-search-backward pat nil t)
              (progn
                (goto-char old-pt)
-               (error "No cross references in this node")))))
+               (user-error "No cross references in this node")))))
     (goto-char (or (match-beginning 1) (match-beginning 0)))
     (if (looking-at "\\* Menu:")
        (if recur
-           (error "No cross references in this node")
+           (user-error "No cross references in this node")
          (Info-prev-reference t))
       (if (looking-at "^\\* ")
          (forward-char 2)))))
@@ -3107,7 +3198,7 @@ Give an empty topic name to go to the Index node itself."
          (or matches
              (progn
                (Info-goto-node orignode)
-               (error "No `%s' in index" topic)))
+               (user-error "No `%s' in index" topic)))
          ;; Here it is a feature that assoc is case-sensitive.
          (while (setq found (assoc topic matches))
            (setq exact (cons found exact)
@@ -3120,7 +3211,7 @@ Give an empty topic name to go to the Index node itself."
   "Go to the next matching index item from the last \\<Info-mode-map>\\[Info-index] command."
   (interactive "p")
   (or Info-index-alternatives
-      (error "No previous `i' command"))
+      (user-error "No previous `i' command"))
   (while (< num 0)
     (setq num (+ num (length Info-index-alternatives))))
   (while (> num 0)
@@ -3640,7 +3731,7 @@ If FORK is a string, it is the name to use for the new buffer."
           ;; Don't raise an error when mouse-1 is bound to this - it's
           ;; often used to simply select the window or frame.
           (eq 'mouse-1 (event-basic-type last-input-event)))
-      (error "Point neither on reference nor in menu item description")))
+      (user-error "Point neither on reference nor in menu item description")))
 
 ;; Common subroutine.
 (defun Info-try-follow-nearest-node (&optional fork)
@@ -3676,15 +3767,22 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
 
 (defun Info-mouse-follow-link (click)
   "Follow a link where you click."
-  (interactive "e")
+  (interactive "@e")
   (let* ((position (event-start click))
         (posn-string (and position (posn-string position)))
-        (string (car-safe posn-string))
-        (string-pos (cdr-safe posn-string))
-        (link-args (and string string-pos
-                        (get-text-property string-pos 'link-args string))))
-    (when link-args
-      (Info-goto-node link-args))))
+        (link-args (if posn-string
+                       (get-text-property (cdr posn-string)
+                                          'link-args
+                                          (car posn-string))
+                     (get-char-property (posn-point position)
+                                        'link-args))))
+    (cond ((stringp link-args)
+          (Info-goto-node link-args))
+         ;; These special values of the `link-args' property are used
+         ;; for navigation; see `Info-fontify-node'.
+         ((eq link-args 'prev) (Info-prev))
+         ((eq link-args 'next) (Info-next))
+         ((eq link-args 'up)   (Info-up)))))
 
 \f
 (defvar Info-mode-map
@@ -3742,6 +3840,8 @@ If FORK is non-nil, it is passed to `Info-goto-node'."
     (define-key map "\177" 'Info-scroll-down)
     (define-key map [mouse-2] 'Info-mouse-follow-nearest-node)
     (define-key map [follow-link] 'mouse-face)
+    (define-key map [XF86Back] 'Info-history-back)
+    (define-key map [XF86Forward] 'Info-history-forward)
     map)
   "Keymap containing Info commands.")
 
@@ -3907,7 +4007,7 @@ The name of the Info file is prepended to the node name in parentheses.
 With a zero prefix arg, put the name inside a function call to `info'."
   (interactive "P")
   (unless Info-current-node
-    (error "No current Info node"))
+    (user-error "No current Info node"))
   (let ((node (if (stringp Info-current-file)
                  (concat "(" (file-name-nondirectory Info-current-file) ") "
                          Info-current-node))))
@@ -4257,45 +4357,17 @@ the variable `Info-file-list-for-emacs'."
          (t
           (Info-goto-emacs-command-node command)))))
 \f
-(defvar Info-next-link-keymap
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line mouse-1] 'Info-next)
-    (define-key keymap [header-line mouse-2] 'Info-next)
-    (define-key keymap [header-line down-mouse-1] 'ignore)
-    (define-key keymap [mouse-2] 'Info-next)
-    (define-key keymap [follow-link] 'mouse-face)
-    keymap)
-  "Keymap to put on the Next link in the text or the header line.")
-
-(defvar Info-prev-link-keymap
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line mouse-1] 'Info-prev)
-    (define-key keymap [header-line mouse-2] 'Info-prev)
-    (define-key keymap [header-line down-mouse-1] 'ignore)
-    (define-key keymap [mouse-2] 'Info-prev)
-    (define-key keymap [follow-link] 'mouse-face)
-    keymap)
-  "Keymap to put on the Prev link in the text or the header line.")
-
-(defvar Info-up-link-keymap
-  (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line mouse-1] 'Info-up)
-    (define-key keymap [header-line mouse-2] 'Info-up)
-    (define-key keymap [header-line down-mouse-1] 'ignore)
-    (define-key keymap [mouse-2] 'Info-up)
-    (define-key keymap [follow-link] 'mouse-face)
-    keymap)
-  "Keymap to put on the Up link in the text or the header line.")
-
 (defvar Info-link-keymap
   (let ((keymap (make-sparse-keymap)))
-    (define-key keymap [header-line mouse-1] 'Info-mouse-follow-link)
+    (define-key keymap [header-line down-mouse-1] 'mouse-drag-header-line)
+    (define-key keymap [header-line mouse-1] 'mouse-select-window)
     (define-key keymap [header-line mouse-2] 'Info-mouse-follow-link)
-    (define-key keymap [header-line down-mouse-1] 'ignore)
     (define-key keymap [mouse-2] 'Info-mouse-follow-link)
     (define-key keymap [follow-link] 'mouse-face)
     keymap)
-  "Keymap to put on the link in the text or the header line.")
+  "Keymap to put on Info links.
+This is used for the \"Next\", \"Prev\", and \"Up\" links in the
+first line or header line, and for breadcrumb links.")
 
 (defun Info-breadcrumbs ()
   (let ((nodes (Info-toc-nodes Info-current-file))
@@ -4384,15 +4456,14 @@ the variable `Info-file-list-for-emacs'."
                                  'help-echo
                                  (concat "mouse-2: Go to node "
                                          (buffer-substring nbeg nend)))
-              ;; Always set up the text property keymap.
-              ;; It will either be used in the buffer
-              ;; or copied in the header line.
-              (put-text-property
-              tbeg nend 'keymap
-              (cond
-               ((string-equal (downcase tag) "prev") Info-prev-link-keymap)
-               ((string-equal (downcase tag) "next") Info-next-link-keymap)
-               ((string-equal (downcase tag) "up"  ) Info-up-link-keymap))))))
+              ;; Set up the text property keymap.  Depending on
+              ;; `Info-use-header-line', it is either used in the
+              ;; buffer, or copied to the header line.  A symbol value
+              ;; of the `link-args' property is handled specially by
+              ;; `Info-mouse-follow-link'.
+              (put-text-property tbeg nend 'keymap Info-link-keymap)
+              (put-text-property tbeg nend 'link-args
+                                (intern (downcase tag))))))
 
         ;; (when (> Info-breadcrumbs-depth 0)
         ;;   (insert (Info-breadcrumbs)))
@@ -4899,25 +4970,8 @@ BUFFER is the buffer speedbar is requesting buttons for."
       (erase-buffer))
   (Info-speedbar-hierarchy-buttons nil 0))
 
-(dolist (mess '("^First node in file$"
-               "^No `.*' in index$"
-               "^No cross-reference named"
-               "^No cross.references in this node$"
-               "^No current Info node$"
-               "^No menu in this node$"
-               "^No more items in menu$"
-               "^No more nodes$"
-               "^No pointer \\(?:forward\\|backward\\) from this node$"
-               "^No previous `i' command$"
-               "^No previous items in menu$"
-               "^No previous nodes$"
-               "^No such item in menu$"
-               "^No such node or anchor"
-               "^Node has no"
-               "^Point neither on reference nor in menu item description$"
-               "^This is the \\(?:first\\|last\\) Info node you looked at$"
-               search-failed))
-  (add-to-list 'debug-ignored-errors mess))
+;; FIXME: Really?  Why here?
+(add-to-list 'debug-ignored-errors 'search-failed)
 
 ;;;;  Desktop support
 
index 0566b8ead5c9bc4b60f789d9816f01606507b90f..536cd231753ed8385615365b886971ca792ef4f4 100644 (file)
@@ -32,7 +32,6 @@
 ;;; Code:
 
 (require 'disp-table)
-(eval-when-compile (require 'cl))
 
 (defgroup iso-ascii nil
   "Set up char tables for ISO 8859/1 on ASCII terminals."
 With a prefix argument ARG, enable the mode if ARG is positive,
 and disable it otherwise.  If called from Lisp, enable the mode
 if ARG is omitted or nil."
-  :variable (eq standard-display-table iso-ascii-display-table)
-  (unless standard-display-table
-    (setq standard-display-table iso-ascii-standard-display-table)))
+  :variable ((eq standard-display-table iso-ascii-display-table)
+             . (lambda (v)
+                 (setq standard-display-table
+                       (cond
+                        (v iso-ascii-display-table)
+                        ((eq standard-display-table iso-ascii-display-table)
+                         iso-ascii-standard-display-table)
+                        (t standard-display-table))))))
 
 (provide 'iso-ascii)
 
index f6a24a42dc85f8f0f5207ff9ac794ab2fc62f55d..a91c71b0304329b8c03344423f165ad5424ab2b1 100644 (file)
@@ -30,8 +30,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))      ; letf
-
 (defvar dos-codepage)
 (autoload 'widget-value "wid-edit")
 
 
 (defvar describe-language-environment-map
   (let ((map (make-sparse-keymap "Describe Language Environment")))
-    (define-key map
-      [Default] `(menu-item ,(purecopy "Default") describe-specified-language-support))
+    (bindings--define-key map
+      [Default] '(menu-item "Default" describe-specified-language-support))
     map))
 
 (defvar setup-language-environment-map
   (let ((map (make-sparse-keymap "Set Language Environment")))
-    (define-key map
-      [Default] `(menu-item ,(purecopy "Default") setup-specified-language-environment))
+    (bindings--define-key map
+      [Default] '(menu-item "Default" setup-specified-language-environment))
     map))
 
 (defvar set-coding-system-map
   (let ((map (make-sparse-keymap "Set Coding System")))
-    (define-key-after map [universal-coding-system-argument]
-      `(menu-item ,(purecopy "For Next Command") universal-coding-system-argument
-        :help ,(purecopy "Coding system to be used by next command")))
-    (define-key-after map [separator-1] menu-bar-separator)
-    (define-key-after map [set-buffer-file-coding-system]
-      `(menu-item ,(purecopy "For Saving This Buffer") set-buffer-file-coding-system
-        :help ,(purecopy "How to encode this buffer when saved")))
-    (define-key-after map [revert-buffer-with-coding-system]
-      `(menu-item ,(purecopy "For Reverting This File Now")
-        revert-buffer-with-coding-system
-        :enable buffer-file-name
-        :help ,(purecopy "Revisit this file immediately using specified coding system")))
-    (define-key-after map [set-file-name-coding-system]
-      `(menu-item ,(purecopy "For File Name") set-file-name-coding-system
-        :help ,(purecopy "How to decode/encode file names")))
-    (define-key-after map [separator-2] menu-bar-separator)
-
-    (define-key-after map [set-keyboard-coding-system]
-      `(menu-item ,(purecopy "For Keyboard") set-keyboard-coding-system
-        :help ,(purecopy "How to decode keyboard input")))
-    (define-key-after map [set-terminal-coding-system]
-      `(menu-item ,(purecopy "For Terminal") set-terminal-coding-system
-        :enable (null (memq initial-window-system '(x w32 ns)))
-        :help ,(purecopy "How to encode terminal output")))
-    (define-key-after map [separator-3] menu-bar-separator)
-
-    (define-key-after map [set-selection-coding-system]
-      `(menu-item ,(purecopy "For X Selections/Clipboard") set-selection-coding-system
-        :visible (display-selections-p)
-        :help ,(purecopy "How to en/decode data to/from selection/clipboard")))
-    (define-key-after map [set-next-selection-coding-system]
-      `(menu-item ,(purecopy "For Next X Selection") set-next-selection-coding-system
-        :visible (display-selections-p)
-        :help ,(purecopy "How to en/decode next selection/clipboard operation")))
-    (define-key-after map [set-buffer-process-coding-system]
-      `(menu-item ,(purecopy "For I/O with Subprocess") set-buffer-process-coding-system
+    (bindings--define-key map [set-buffer-process-coding-system]
+      '(menu-item "For I/O with Subprocess" set-buffer-process-coding-system
         :visible (fboundp 'start-process)
         :enable (get-buffer-process (current-buffer))
-        :help ,(purecopy "How to en/decode I/O from/to subprocess connected to this buffer")))
+        :help "How to en/decode I/O from/to subprocess connected to this buffer"))
+    (bindings--define-key map [set-next-selection-coding-system]
+      '(menu-item "For Next X Selection" set-next-selection-coding-system
+        :visible (display-selections-p)
+        :help "How to en/decode next selection/clipboard operation"))
+    (bindings--define-key map [set-selection-coding-system]
+      '(menu-item "For X Selections/Clipboard" set-selection-coding-system
+        :visible (display-selections-p)
+        :help "How to en/decode data to/from selection/clipboard"))
+
+    (bindings--define-key map [separator-3] menu-bar-separator)
+    (bindings--define-key map [set-terminal-coding-system]
+      '(menu-item "For Terminal" set-terminal-coding-system
+        :enable (null (memq initial-window-system '(x w32 ns)))
+        :help "How to encode terminal output"))
+    (bindings--define-key map [set-keyboard-coding-system]
+      '(menu-item "For Keyboard" set-keyboard-coding-system
+        :help "How to decode keyboard input"))
+    
+    (bindings--define-key map [separator-2] menu-bar-separator)
+    (bindings--define-key map [set-file-name-coding-system]
+      '(menu-item "For File Name" set-file-name-coding-system
+        :help "How to decode/encode file names"))
+    (bindings--define-key map [revert-buffer-with-coding-system]
+      '(menu-item "For Reverting This File Now"
+        revert-buffer-with-coding-system
+        :enable buffer-file-name
+        :help "Revisit this file immediately using specified coding system"))
+    (bindings--define-key map [set-buffer-file-coding-system]
+      '(menu-item "For Saving This Buffer" set-buffer-file-coding-system
+        :help "How to encode this buffer when saved"))
+    (bindings--define-key map [separator-1] menu-bar-separator)
+    (bindings--define-key map [universal-coding-system-argument]
+      '(menu-item "For Next Command" universal-coding-system-argument
+        :help "Coding system to be used by next command"))
     map))
 
 (defvar mule-menu-keymap
   (let ((map (make-sparse-keymap "Mule (Multilingual Environment)")))
-    (define-key-after map [set-language-environment]
-      `(menu-item  ,(purecopy "Set Language Environment") ,setup-language-environment-map))
-    (define-key-after map [separator-mule] menu-bar-separator)
-
-    (define-key-after map [toggle-input-method]
-      `(menu-item ,(purecopy "Toggle Input Method") toggle-input-method))
-    (define-key-after map [set-input-method]
-      `(menu-item ,(purecopy "Select Input Method...") set-input-method))
-    (define-key-after map [describe-input-method]
-      `(menu-item ,(purecopy "Describe Input Method")  describe-input-method))
-    (define-key-after map [separator-input-method] menu-bar-separator)
-
-    (define-key-after map [set-various-coding-system]
-      `(menu-item ,(purecopy "Set Coding Systems") ,set-coding-system-map
-                 :enable (default-value 'enable-multibyte-characters)))
-    (define-key-after map [view-hello-file]
-      `(menu-item ,(purecopy "Show Multilingual Sample Text") view-hello-file
+    (bindings--define-key map [mule-diag]
+      '(menu-item "Show All Multilingual Settings" mule-diag
+        :help "Display multilingual environment settings"))
+    (bindings--define-key map [list-character-sets]
+      '(menu-item "List Character Sets" list-character-sets
+        :help "Show table of available character sets"))
+    (bindings--define-key map [describe-coding-system]
+      '(menu-item "Describe Coding System..." describe-coding-system))
+    (bindings--define-key map [describe-input-method]
+      '(menu-item "Describe Input Method..." describe-input-method
+        :help "Keyboard layout for a specific input method"))
+    (bindings--define-key map [describe-language-environment]
+      `(menu-item "Describe Language Environment"
+            ,describe-language-environment-map
+            :help "Show multilingual settings for a specific language"))
+    
+    (bindings--define-key map [separator-coding-system] menu-bar-separator)
+    (bindings--define-key map [view-hello-file]
+      '(menu-item "Show Multilingual Sample Text" view-hello-file
         :enable (file-readable-p
                  (expand-file-name "HELLO" data-directory))
-        :help ,(purecopy "Demonstrate various character sets")))
-    (define-key-after map [separator-coding-system] menu-bar-separator)
+        :help "Demonstrate various character sets"))
+    (bindings--define-key map [set-various-coding-system]
+      `(menu-item "Set Coding Systems" ,set-coding-system-map
+                 :enable (default-value 'enable-multibyte-characters)))
 
-    (define-key-after map [describe-language-environment]
-      `(menu-item ,(purecopy "Describe Language Environment")
-            ,describe-language-environment-map
-            :help ,(purecopy "Show multilingual settings for a specific language")))
-    (define-key-after map [describe-input-method]
-      `(menu-item ,(purecopy "Describe Input Method...") describe-input-method
-        :help ,(purecopy "Keyboard layout for a specific input method")))
-    (define-key-after map [describe-coding-system]
-      `(menu-item ,(purecopy "Describe Coding System...") describe-coding-system))
-    (define-key-after map [list-character-sets]
-      `(menu-item ,(purecopy "List Character Sets") list-character-sets
-        :help ,(purecopy "Show table of available character sets")))
-    (define-key-after map [mule-diag]
-      `(menu-item ,(purecopy "Show All Multilingual Settings") mule-diag
-        :help ,(purecopy "Display multilingual environment settings")))
+    (bindings--define-key map [separator-input-method] menu-bar-separator)
+    (bindings--define-key map [describe-input-method]
+      '(menu-item "Describe Input Method"  describe-input-method))
+    (bindings--define-key map [set-input-method]
+      '(menu-item "Select Input Method..." set-input-method))
+    (bindings--define-key map [toggle-input-method]
+      '(menu-item "Toggle Input Method" toggle-input-method))
+
+    (bindings--define-key map [separator-mule] menu-bar-separator)
+    (bindings--define-key map [set-language-environment]
+      `(menu-item  "Set Language Environment" ,setup-language-environment-map))
     map)
   "Keymap for Mule (Multilingual environment) menu specific commands.")
 
@@ -285,7 +283,7 @@ wrong, use this command again to toggle back to the right mode."
   "Display the HELLO file, which lists many languages and characters."
   (interactive)
   ;; We have to decode the file in any environment.
-  (letf ((coding-system-for-read 'iso-2022-7bit))
+  (let ((coding-system-for-read 'iso-2022-7bit))
     (view-file (expand-file-name "HELLO" data-directory))))
 
 (defun universal-coding-system-argument (coding-system)
@@ -353,10 +351,6 @@ This also sets the following values:
       if CODING-SYSTEM is ASCII-compatible"
   (check-coding-system coding-system)
   (setq-default buffer-file-coding-system coding-system)
-  (if (fboundp 'ucs-set-table-for-input)
-      (dolist (buffer (buffer-list))
-       (or (local-variable-p 'buffer-file-coding-system buffer)
-           (ucs-set-table-for-input buffer))))
 
   (if (eq system-type 'darwin)
       ;; The file-name coding system on Darwin systems is always utf-8.
@@ -2960,43 +2954,7 @@ point or a number in hash notation, e.g. #o21430 for octal,
      (t
       (cdr (assoc-string input (ucs-names) t))))))
 
-(defun ucs-insert (character &optional count inherit)
-  "Insert COUNT copies of CHARACTER of the given Unicode code point.
-Interactively, prompts for a Unicode character name or a hex number
-using `read-char-by-name'.
-
-You can type a few of the first letters of the Unicode name and
-use completion.  If you type a substring of the Unicode name
-preceded by an asterisk `*' and use completion, it will show all
-the characters whose names include that substring, not necessarily
-at the beginning of the name.
-
-This function also accepts a hexadecimal number of Unicode code
-point or a number in hash notation, e.g. #o21430 for octal,
-#x2318 for hex, or #10r8984 for decimal.
-
-The optional third arg INHERIT (non-nil when called interactively),
-says to inherit text properties from adjoining text, if those
-properties are sticky."
-  (interactive
-   (list (read-char-by-name "Unicode (name or hex): ")
-        (prefix-numeric-value current-prefix-arg)
-        t))
-  (unless count (setq count 1))
-  (if (and (stringp character)
-          (string-match-p "\\`[0-9a-fA-F]+\\'" character))
-      (setq character (string-to-number character 16)))
-  (cond
-   ((null character)
-    (error "Not a Unicode character"))
-   ((not (integerp character))
-    (error "Not a Unicode character code: %S" character))
-   ((or (< character 0) (> character #x10FFFF))
-    (error "Not a Unicode character code: 0x%X" character)))
-  (if inherit
-      (dotimes (i count) (insert-and-inherit character))
-    (dotimes (i count) (insert character))))
-
-(define-key ctl-x-map "8\r" 'ucs-insert)
+(define-obsolete-variable-alias 'ucs-insert 'insert-char "24.2")
+(define-key ctl-x-map "8\r" 'insert-char)
 
 ;;; mule-cmds.el ends here
index 1f88df52fd4a7ec3a597f9868f6c08206a6e817a..4d567a6e9d8d4ee86ca741b4c5edfff8eb8ba72d 100644 (file)
@@ -30,6 +30,7 @@
 
 ;;; Code:
 
+;; FIXME?  Are these still relevant?  Nothing uses them AFAICS.
 (defconst mule-version "6.0 (HANACHIRUSATO)" "\
 Version number and name of this version of MULE (multilingual environment).")
 
@@ -1835,6 +1836,8 @@ If nothing is specified, the return value is nil."
                       (re-search-forward
                        "\\(.*;\\)?[ \t]*unibyte:[ \t]*\\([^ ;]+\\)"
                        head-end t))
+              (display-warning 'mule "`unibyte: t' is obsolete; \
+use \"coding: 'raw-text\" instead." :warning)
              (setq coding-system 'raw-text))
            (when (and (not coding-system)
                       (re-search-forward
@@ -1887,6 +1890,8 @@ If nothing is specified, the return value is nil."
                (goto-char pos)
                (when (and set-auto-coding-for-load
                           (re-search-forward re-unibyte tail-end t))
+                  (display-warning 'mule "`unibyte: t' is obsolete; \
+use \"coding: 'raw-text\" instead." :warning)
                  (setq coding-system 'raw-text))
                (when (and (not coding-system)
                           (re-search-forward re-coding tail-end t))
index 70e6d4b69cb58e1f6d59d23122b3a7bd1a7c7e6f..fecc94277314886fa87bcc8cd45a29be8cc5640c 100644 (file)
@@ -53,7 +53,7 @@
 ;;; Code:
 
 (require 'help-mode)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup quail nil
   "Quail: multilingual input method."
@@ -486,19 +486,15 @@ non-Quail commands."
          (setq translation-keymap (copy-keymap
                                    (if simple quail-simple-translation-keymap
                                      quail-translation-keymap)))
-         (while translation-keys
-           (define-key translation-keymap
-             (car (car translation-keys)) (cdr (car translation-keys)))
-           (setq translation-keys (cdr translation-keys))))
+         (dolist (trans translation-keys)
+           (define-key translation-keymap (car trans) (cdr trans))))
       (setq translation-keymap
            (if simple quail-simple-translation-keymap
              quail-translation-keymap)))
     (when conversion-keys
       (setq conversion-keymap (copy-keymap quail-conversion-keymap))
-      (while conversion-keys
-       (define-key conversion-keymap
-         (car (car conversion-keys)) (cdr (car conversion-keys)))
-       (setq conversion-keys (cdr conversion-keys))))
+      (dolist (conv conversion-keys)
+       (define-key conversion-keymap (car conv) (cdr conv))))
     (quail-add-package
      (list name title (list nil) guidance (or docstring "")
           translation-keymap
@@ -720,12 +716,11 @@ The command `quail-set-keyboard-layout' usually sets this variable."
       (setq quail-keyboard-layout-substitution subst-list)
       ;; If there are additional key locations, map them to missing
       ;; key locations.
-      (while missing-list
+      (dolist (missing missing-list)
        (while (and subst-list (cdr (car subst-list)))
          (setq subst-list (cdr subst-list)))
        (if subst-list
-           (setcdr (car subst-list) (car missing-list)))
-       (setq missing-list (cdr missing-list))))))
+           (setcdr (car subst-list) missing))))))
 
 (defcustom quail-keyboard-layout-type "standard"
   "Type of keyboard layout used in Quail base input method.
@@ -806,9 +801,10 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'."
        (if translation
            (progn
              (if (consp translation)
-                 (if (> (length (cdr translation)) 0)
-                     (setq translation (aref (cdr translation) 0))
-                   (setq translation " ")))
+                 (setq translation
+                        (if (> (length (cdr translation)) 0)
+                            (aref (cdr translation) 0)
+                          " ")))
              (setq done-list (cons translation done-list)))
          (setq translation (aref kbd-layout i)))
        (aset layout i translation))
@@ -834,17 +830,19 @@ The format of KBD-LAYOUT is the same as `quail-keyboard-layout'."
        (if (< (if (stringp lower) (string-width lower) (char-width lower)) 2)
            (insert " "))
        (if (characterp lower)
-           (if (eq (get-char-code-property lower 'general-category) 'Mn)
-               ;; Pad the left and right of non-spacing characters.
-               (setq lower (compose-string (string lower) 0 1
-                                           (format "\t%c\t" lower)))
-             (setq lower (string lower))))
+            (setq lower
+                  (if (eq (get-char-code-property lower 'general-category) 'Mn)
+                      ;; Pad the left and right of non-spacing characters.
+                      (compose-string (string lower) 0 1
+                                      (format "\t%c\t" lower))
+                    (string lower))))
        (if (characterp upper)
-           (if (eq (get-char-code-property upper 'general-category) 'Mn)
-               ;; Pad the left and right of non-spacing characters.
-               (setq upper (compose-string (string upper) 0 1
-                                           (format "\t%c\t" upper)))
-             (setq upper (string upper))))
+           (setq upper
+                  (if (eq (get-char-code-property upper 'general-category) 'Mn)
+                      ;; Pad the left and right of non-spacing characters.
+                      (compose-string (string upper) 0 1
+                                      (format "\t%c\t" upper))
+                    (string upper))))
        (insert (bidi-string-mark-left-to-right lower)
                (propertize " " 'invisible t)
                (bidi-string-mark-left-to-right upper))
@@ -1032,8 +1030,8 @@ the following annotation types are supported.
       (let ((map (list nil))
            (decode-map (if (not no-decode-map) (list 'decode-map)))
            key trans)
-       (while l
-         (setq key (car (car l)) trans (car (cdr (car l))) l (cdr l))
+       (dolist (el l)
+         (setq key (car el) trans (car (cdr el)))
          (quail-defrule-internal key trans map t decode-map props))
        `(if (prog1 (quail-decode-map)
               (quail-install-map ',map))
@@ -1201,7 +1199,7 @@ function `quail-define-rules' for the detail."
                (if (stringp trans)
                    (setq trans (string-to-vector trans))))
               (let ((new (quail-vunion prevchars trans)))
-             (setq trans
+                (setq trans
                       (if (equal new prevchars)
                           ;; Nothing to change, get back to orig value.
                           prev
@@ -1215,10 +1213,8 @@ where VECTOR is a vector of candidates (character or string) for
 the translation, and INDEX points into VECTOR to specify the currently
 selected translation."
   (if (and def (symbolp def))
-      (if (functionp def)
-         ;; DEF is a symbol of a function which returns valid translation.
-         (setq def (funcall def key len))
-       (setq def nil)))
+      ;; DEF is a symbol of a function which returns valid translation.
+      (setq def (if (functionp def) (funcall def key len))))
   (if (and (consp def) (not (vectorp (cdr def))))
       (setq def (car def)))
 
@@ -2399,10 +2395,10 @@ should be made by `quail-build-decode-map' (which see)."
                    (let ((last-col-elt (or (nth (1- (* (1+ col) newrows))
                                                 single-list)
                                            (car (last single-list)))))
-                     (incf width (+ (max 3 (length (car last-col-elt)))
-                                    1 single-trans-width 1))))
+                     (cl-incf width (+ (max 3 (length (car last-col-elt)))
+                                       1 single-trans-width 1))))
                  (< width window-width))
-          (incf cols))
+          (cl-incf cols))
         (setq rows (/ (+ len cols -1) cols)) ;Round up.
         (let ((key-width (max 3 (length (car (nth (1- rows) single-list))))))
           (insert "key")
index c50277686ff92c5abb2ccf38750626ac6a375a0c..73a06bb2ccd607a66bcc56e90faaf1206091efce 100644 (file)
 
 ;; Use the symbol `robin-use-package' as the third argument.
 
-;; The fourth argument is the prompt that appears in modeline when this
+;; The fourth argument is the prompt that appears in mode line when this
 ;; input method is active.
 
 ;; The fifth argument is a documentation string; it may or may not be
index cc75cc21cbe976d740574a081a786e6495ea9c57..54566e1d00430373839aebe2be4e04ff3f4f53c1 100644 (file)
 
 (defconst ucs-normalize-version "1.2")
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (declare-function nfd "ucs-normalize" (char))
 
   (let ((char 0) ccc decomposition)
     (mapc
      (lambda (start-end)
-       (do ((char (car start-end) (+ char 1))) ((> char (cdr start-end)))
+       (cl-do ((char (car start-end) (+ char 1))) ((> char (cdr start-end)))
          (setq ccc (ucs-normalize-ccc char))
          (setq decomposition (get-char-code-property
                               char 'decomposition))
@@ -270,7 +270,7 @@ Note that Hangul are excluded.")
     (let (decomposition alist)
       (mapc
        (lambda (start-end)
-         (do ((char (car start-end) (+ char 1))) ((> char (cdr start-end)))
+         (cl-do ((char (car start-end) (+ char 1))) ((> char (cdr start-end)))
            (setq decomposition (funcall decomposition-function char))
            (if decomposition
                (setq alist (cons (cons char
@@ -391,7 +391,7 @@ decomposition."
     (let (entries decomposition composition)
       (mapc
        (lambda (start-end)
-         (do ((i (car start-end) (+ i 1))) ((> i (cdr start-end)))
+         (cl-do ((i (car start-end) (+ i 1))) ((> i (cdr start-end)))
            (setq decomposition
                  (string-to-list
                   (with-temp-buffer
index 4d86fc821fa035dbe356474c419789f73dabe02b..0dfabdd65da121576661d4f55ed0b1cc4f63e241 100644 (file)
@@ -4,9 +4,9 @@
 ;; See lisp/international/README for the copyright and permission notice.
 (define-char-code-property 'bidi-class #^[1 nil char-code-property-table 
 #^^[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 
-#^^[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] "\ 2\ 5Â\85\ 6\ 5Â\9a\ f\13\ eÂ\84\13Â\84\ 1\13\13\ 5\13\13\ e\ e\ 3\ 3\13\ 1\13Â\83\ 3\ 1\13Â\85\ 1Â\97\13\ 1Â\9f\13\ 1Â\88" 1 1 1 "\ 2\ 1¹\13\13\ 1Â\87\13Â\8e\ 1\ 1\13Â\8e\ 1Â\85\13Â\89\ 1\13Â\91" "\ 2\10ð\ 1Â\84\13\13\ 1Â\88\13\ 1" "\ 2\ 1Â\84\13\13\ 1\13\ 1î\13\ 1Â\89" 1 "\ 2\ 1Â\83\10Â\87\ 1ö" 1 "\ 2\ 1Â\8a\13\ 1Â\85\ 2\10­\ 2\10\ 2\10\10\ 2\10\10\ 2\10\ 2¸" "\ 2\ 4Â\84\a\a\13\13\a\ e\ e\a\ f\a\13\13\10Â\8b\a°\10Â\95\ 4Â\8a\ e\ 4\ 4\aÂ\83\10\aÂ\8f" "\ 2\aÃ\96\10Â\87\ 4\13\10Â\86\a\a\10\10\13\10Â\84\a\a\ 3Â\8a\aÂ\86" "\ 2\aÂ\8e\ 1\ 4\a\10\aÂ\9e\10Â\9b\ 1\ 1\a³" "\ 2\a¦\10Â\8b\a\ 1Â\8e\ 2«\10Â\89\ 2\ 2\13Â\84\ 2Â\86" "\ 2\ 2Â\96\10Â\84\ 2\10Â\89\ 2\10Â\83\ 2\10Â\85\ 2«\10Â\83\ 2¤" 2 "\ 2\10Â\83\ 1·\10\ 1\10\ 1Â\84\10Â\88\ 1Â\84\10\ 1Â\83\10Â\87\ 1Â\8a\10\10\ 1Â\9c" "\ 2\ 1\10\ 1º\10\ 1Â\84\10Â\84\ 1Â\88\10\ 1Â\94\10\10\ 1Â\8e\ e\ e\ 1Â\87\ e\ 1Â\84" "\ 2\ 1\10\10\ 1¹\10\ 1Â\84\10\10\ 1Â\84\10\10\ 1\ 1\10Â\83\ 1Â\83\10\ 1Â\9e\10\10\ 1Â\83\10\ 1Â\8a" "\ 2\ 1\10\10\ 1¹\10\ 1Â\84\10Â\85\ 1\10\10\ 1Â\84\10\ 1Â\94\10\10\ 1Â\8d\ e\ 1Â\8e" "\ 2\ 1\10\ 1º\10\ 1\ 1\10\ 1\10Â\84\ 1Â\88\10\ 1Â\88\10\ 1Â\8b\10\10\ 1Â\9c" "\ 2\ 1\ 1\10\ 1½\10\ 1Â\8c\10\ 1Â¥\13Â\86\ e\13\ 1Â\85" "\ 2\ 1¾\10Â\83\ 1Â\85\10Â\83\ 1\10Â\84\ 1Â\87\10\10\ 1Â\8b\10\10\ 1Â\94\13Â\87\ 1" "\ 2\ 1¼\10\ 1Â\8f\10\10\ 1Â\94\10\10\ 1Â\9c" "\ 2\ 1Ã\81\10Â\84\ 1Â\88\10\ 1Â\94\10\10\ 1Â\9c" "\ 2\ 1Ã\8a\10\ 1Â\87\10Â\83\ 1\10\ 1©" "\ 2\ 1±\10\ 1\ 1\10Â\87\ 1Â\84\ e\ 1Â\87\10Â\88\ 1±" "\ 2\ 1±\10\ 1\ 1\10Â\86\ 1\10\10\ 1Â\8b\10Â\86\ 1²" "\ 2\ 1Â\98\10\10\ 1Â\9b\10\ 1\10\ 1\10\13Â\84\ 1³\10Â\8e\ 1" "\ 2\10Â\85\ 1\10\10\ 1Â\85\10Â\8b\ 1\10¤\ 1Â\89\10\ 1¹"] #^^[2 4096 "\ 2\ 1­\10Â\84\ 1\10Â\86\ 1\10\10\ 1\ 1\10\10\ 1Â\99\10\10\ 1Â\84\10Â\83\ 1Â\90\10Â\84\ 1Â\8b" "\ 2\ 1\ 1\10\ 1\ 1\10\10\ 1Â\86\10\ 1Â\8f\10\ 1â" 1 1 1 1 "\ 2\ 1Ã\9d\10Â\83\ 1 " "\ 2\ 1Â\90\13Â\8a\ 1æ" "\ 2\13\ 1ÿ" 1 1 1 1 "\ 2\12\ 1Â\9a\13\13\ 1ã" "\ 2\ 1Â\92\10Â\83\ 1Â\9d\10Â\83\ 1Â\9d\10\10\ 1Â\9e\10\10\ 1Â\8c" "\ 2\ 1·\10Â\87\ 1Â\88\10\ 1\ 1\10Â\8b\ 1Â\87\ e\ 1\10\ 1Â\92\13Â\8a\ 1Â\86" "\ 2\13Â\8b\10Â\83\12\ 1ñ" "\ 2\ 1©\10\ 1Ã\96" "\ 2\ 1 \10Â\83\ 1Â\84\10\10\ 1Â\89\10\ 1Â\86\10Â\83\ 1Â\84\13\ 1Â\83\13\13\ 1º" "\ 2\ 1Ã\9e\13¢" "\ 2\ 1Â\97\10\10\ 1½\10\ 1\10Â\87\ 1\10\ 1\10\ 1\ 1\10Â\88\ 1Â\86\10Â\8a\ 1\ 1\10" 1 "\ 2\10Â\84\ 1°\10\ 1\10Â\85\ 1\10\ 1Â\85\10\ 1¨\10Â\89\ 1Â\8c" "\ 2\10\10\ 1 \10Â\84\ 1\ 1\10\10\ 1¼\10\ 1\10\10\ 1Â\83\10\ 1\10Â\83\ 1Â\8e" "\ 2\ 1¬\10Â\88\ 1\ 1\10\10\ 1Ã\88" "\ 2\ 1Ã\90\10Â\83\ 1\10Â\8d\ 1\10Â\87\ 1Â\84\10\ 1Â\92" 1 "\ 2\ 1À\10§\ 1\95\10\84" 1 1 1 "\ 2\ 1½\13\ 1\13\83\ 1\8b\13\83\ 1\8d\13\83\ 1\8d\13\83\ 1\8d\13\13\ 1"] #^^[2 8192 "\ 2\12\8b\ 5\83\ 1\ 2\13\98\12\ 6\b
-\f      \v\ f\ e\85\13\8f\ f\13\9a\12\ 5\85\ 1\85\ 5\86\ 3\ 1\83\ 3\86\r\r\13\83\ 1" "\ 2\ 3\8a\r\r\13\83\ 1\91\ e\9a\ 1\96\10¡\ 1\8f" "\ 2\13\13\ 1\13\84\ 1\13\13\ 1\8a\13\ 1\13\83\ 1\85\13\86\ 1\13\ 1\13\ 1\13\ 1\84\ e\ 1\8b\13\13\ 1\84\13\85\ 1\85\13\84\ 1\ 1\13\90\ 1 " "\ 2\ 1\89\13\ 1\86\13ð" "\ 2\13\92\r\ e\13ì" 19 "\ 2\13\ 1Å\13\85" "\ 2\13\95\ 1\13Þ\ 1\8c" "\ 2\13§\ 1\99\13\8b\ 1\95\13 " "\ 2\13\88\ 3\94\ 1Î\13\96" 19 19 19 "\ 2\13¬\ 1\13Ó" "\ 2\ 1\13ÿ" "\ 2\13Ë\ 1\13\ 1\13²" 1 1 19 19 19 19 "\ 2\13Í\ 1\83\13\8a\ 1¦" 1 1 "\ 2\ 1å\13\86\ 1\84\10\83\ 1\87\13\87" "\ 2\ 1ÿ\10" "\ 2\ 1à\10 " "\ 2\13²\ 1Î" "\ 2\13\9a\ 1\13Ù\ 1\8c" 19 "\ 2\13Ö\ 1\9a\13\8c\ 1\84"] #^^[2 12288 "\ 2\12\13\84\ 1\83\13\99\ 1\89\10\86\13\ 1\85\13\13\ 1\85\13\83\ 1À" "\ 2\ 1\99\10\10\13\13\ 1\83\13\ 1Ú\13\ 1\84" 1 "\ 2\ 1À\13¤\ 1\9c" "\ 2\ 1\9d\13\13\ 1±\13\90\ 1\9c\13\83\ 1" "\ 2\ 1±\13\8f\ 1\8c\13\84\ 1°" "\ 2\ 1÷\13\84\ 1\85" "\ 2\ 1Þ\13\13\ 1\9f\13" 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 "\ 2\ 1À\13À" 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 
-#^^[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 "\ 2\ 1\90\13·\ 1¹" 1 1 "\ 2\ 1\8d\13\83\ 1ß\10\84\13\ 1\88\10\10\13\13" "\ 2\ 1ð\10\10\ 1\8e" "\ 2\13¢\ 1Þ" "\ 2\ 1\88\13\ 1÷" "\ 2\ 1\ 1\10\ 1\83\10\ 1\84\10\ 1\99\10\10\ 1\13\84\ 1\8c\ e\ e\ 1º\13\84\ 1\88" "\ 2\ 1Ä\10\ 1\9b\10\92\ 1\8e" "\ 2\ 1¦\10\88\ 1\99\10\8b\ 1®" "\ 2\10\83\ 1°\10\ 1\ 1\10\84\ 1\ 1\10\ 1Ã" "\ 2\ 1©\10\86\ 1\ 1\10\10\ 1\ 1\10\10\ 1\8c\10\ 1\88\10\ 1³" "\ 2\ 1°\10\ 1\10\83\ 1\ 1\10\10\ 1\85\10\10\ 1\10\ 1¾" 1 "\ 2\ 1å\10\ 1\ 1\10\ 1\84\10\ 1\92" 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 "\ 2\ 1\9d\ 2\10\ 2\8a\r\ 2¦\a°" 7 7 7 "\ 2\a¾\13\13\aÀ" "\ 2\aý\13\a\a" "\ 2\10\90\13\8a\ 1\86\10\87\ 1\89\13 \ f\13\ f\ 1\13\ f\13\89\ e\13\13\r\r\13\83\ 1\13\ e\ e\13\ 1\84\a\90" "\ 2\aÿ\ 5" "\ 2\ 1\13\13\ e\83\13\85\r\ f\r\ f\ f\ 3\8a\ f\13\86\ 1\9a\13\86\ 1\9a\13\8b\ 1\9a" "\ 2\ 1à\ e\ e\13\83\ e\ e\ 1\13\87\ 1\8a\13\85\ 1\ 1"]] #^^[1 65536 #^^[2 65536 1 1 "\ 2\ 1\13\ 1¾\13À" "\ 2\13\8b\ 1\85\13\8c\ 1á\10\ 1\ 1" 1 1 1 1 1 1 1 1 1 1 1 1 2 2 "\ 2\ 2\9f\13\ 2à" 2 "\ 2\ 2\10\83\ 2\10\10\ 2\85\10\84\ 2¨\10\83\ 2\84\10\ 2À" 2 "\ 2\ 2¹\13\87\ 2À" 2 2 2 2 2 "\ 2\ 2à\ 4\9f\ 2" 2 2 2] #^^[2 69632 "\ 2\ 1\10\ 1\10\8f\ 1\8b\13\94\ 1\9a" "\ 2\10\10\ 1±\10\84\ 1\ 1\10\10\ 1Å" 1 1 1 1 1 1 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 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 "\ 2\ 1ç\10\83\ 1\89\ 5\88\10\85" "\ 2\10\83\ 1\ 1\10\87\ 1\9e\10\84\ 1Ò" "\ 2\13Â\10\83\13\ 1º" 1 "\ 2\13×\ 1©" 1 1 1 1 1 1 "\ 2\ 1Û\13\ 1¤" "\ 2\ 1\95\13\ 1¹\13\ 1°" "\ 2\ 1\89\13\ 1¹\13\ 1\8a\ 3²" 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 2] #^^[2 126976 "\ 2\13¬\ 1\84\13Ð" "\ 2\13\94\ 1\8c\13\8f\ 1\ 1\13\8e\ 1\ 1\13\8f\ 1\13\8f\ 1 " "\ 2\ 3\8b\ 1õ" 1 1 1 "\ 2\13¡\ 1\8f\13\86\ 1\13Æ\ 1\83" "\ 2\13\94\ 1\8c\13¥\ 1\13\85\ 1\95\13\91\ 1\8f" "\ 2\13¿\ 1\13\ 1\13¾" "\ 2\13\8c\ 1\13ë\ 1\13\84\ 1\83" "\ 2\13¤\ 1\13\99\ 1\92\13\98\ 1\98" "\ 2\ 1û\13\85" "\ 2\ 1\13\90\ 1\13\83\ 1\13\ 1\13\ 1\13\ 1\13\83\ 1\13\86\ 1\ 1\13\84\ 1\13\ 1\ 1\13\84\ 1\13\8c\ 1\84\13\8b\ 1°" "\ 2\13Æ\ 1º" "\ 2\13ô\ 1\8c" 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 
+#^^[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] "\ 2\ 5Â\85\ 6\ 5Â\9a\ f\13\ eÂ\84\13Â\84\ 1\13\13\ 5\13\13\ e\ e\ 3\ 3\13\ 1\13Â\83\ 3\ 1\13Â\85\ 1Â\97\13\ 1Â\9f\13\ 1Â\88" 1 1 1 "\ 2\ 1¹\13\13\ 1Â\87\13Â\8e\ 1\ 1\13Â\8e\ 1Â\85\13Â\89\ 1\13Â\91" "\ 2\10ð\ 1Â\84\13\13\ 1Â\88\13\ 1" "\ 2\ 1Â\84\13\13\ 1\13\ 1î\13\ 1Â\89" 1 "\ 2\ 1Â\83\10Â\87\ 1ö" 1 "\ 2\ 1Â\8a\13\ 1Â\84\ e\ 2\10­\ 2\10\ 2\10\10\ 2\10\10\ 2\10\ 2¸" "\ 2\ 4Â\85\a\13\13\a\ e\ e\a\ f\a\13\13\10Â\8b\a°\10Â\95\ 4Â\8a\ e\ 4\ 4\aÂ\83\10\aÂ\8f" "\ 2\aÃ\96\10Â\87\ 4\13\10Â\86\a\a\10\10\13\10Â\84\a\a\ 3Â\8a\aÂ\86" "\ 2\aÂ\8e\ 1\a\a\10\aÂ\9e\10Â\9b\ 1\ 1\a³" "\ 2\a¦\10Â\8b\a\ 1Â\8e\ 2«\10Â\89\ 2\ 2\13Â\84\ 2Â\86" "\ 2\ 2Â\96\10Â\84\ 2\10Â\89\ 2\10Â\83\ 2\10Â\85\ 2«\10Â\83\ 2¤" "\ 2\ 2 \a\ 2\aÂ\8b\ 2·\10Â\9b\ 2" "\ 2\10Â\83\ 1·\10\ 1\10\ 1Â\84\10Â\88\ 1Â\84\10\ 1Â\83\10Â\87\ 1Â\8a\10\10\ 1Â\9c" "\ 2\ 1\10\ 1º\10\ 1Â\84\10Â\84\ 1Â\88\10\ 1Â\94\10\10\ 1Â\8e\ e\ e\ 1Â\87\ e\ 1Â\84" "\ 2\ 1\10\10\ 1¹\10\ 1Â\84\10\10\ 1Â\84\10\10\ 1\ 1\10Â\83\ 1Â\83\10\ 1Â\9e\10\10\ 1Â\83\10\ 1Â\8a" "\ 2\ 1\10\10\ 1¹\10\ 1Â\84\10Â\85\ 1\10\10\ 1Â\84\10\ 1Â\94\10\10\ 1Â\8d\ e\ 1Â\8e" "\ 2\ 1\10\ 1º\10\ 1\ 1\10\ 1\10Â\84\ 1Â\88\10\ 1Â\88\10\ 1Â\8b\10\10\ 1Â\9c" "\ 2\ 1\ 1\10\ 1½\10\ 1Â\8c\10\ 1Â¥\13Â\86\ e\13\ 1Â\85" "\ 2\ 1¾\10Â\83\ 1Â\85\10Â\83\ 1\10Â\84\ 1Â\87\10\10\ 1Â\8b\10\10\ 1Â\94\13Â\87\ 1" "\ 2\ 1¼\10\ 1Â\8f\10\10\ 1Â\94\10\10\ 1Â\9c" "\ 2\ 1Ã\81\10Â\84\ 1Â\88\10\ 1Â\94\10\10\ 1Â\9c" "\ 2\ 1Ã\8a\10\ 1Â\87\10Â\83\ 1\10\ 1©" "\ 2\ 1±\10\ 1\ 1\10Â\87\ 1Â\84\ e\ 1Â\87\10Â\88\ 1±" "\ 2\ 1±\10\ 1\ 1\10Â\86\ 1\10\10\ 1Â\8b\10Â\86\ 1²" "\ 2\ 1Â\98\10\10\ 1Â\9b\10\ 1\10\ 1\10\13Â\84\ 1³\10Â\8e\ 1" "\ 2\10Â\85\ 1\10\10\ 1Â\85\10Â\8b\ 1\10¤\ 1Â\89\10\ 1¹"] #^^[2 4096 "\ 2\ 1­\10Â\84\ 1\10Â\86\ 1\10\10\ 1\ 1\10\10\ 1Â\99\10\10\ 1Â\84\10Â\83\ 1Â\90\10Â\84\ 1Â\8b" "\ 2\ 1\ 1\10\ 1\ 1\10\10\ 1Â\86\10\ 1Â\8f\10\ 1â" 1 1 1 1 "\ 2\ 1Ã\9d\10Â\83\ 1 " "\ 2\ 1Â\90\13Â\8a\ 1æ" "\ 2\13\ 1ÿ" 1 1 1 1 "\ 2\12\ 1Â\9a\13\13\ 1ã" "\ 2\ 1Â\92\10Â\83\ 1Â\9d\10Â\83\ 1Â\9d\10\10\ 1Â\9e\10\10\ 1Â\8c" "\ 2\ 1´\10\10\ 1\10Â\87\ 1Â\88\10\ 1\ 1\10Â\8b\ 1Â\87\ e\ 1\10\ 1Â\92\13Â\8a\ 1Â\86" "\ 2\13Â\8b\10Â\83\12\ 1ñ" "\ 2\ 1©\10\ 1Ã\96" "\ 2\ 1 \10Â\83\ 1Â\84\10\10\ 1Â\89\10\ 1Â\86\10Â\83\ 1Â\84\13\ 1Â\83\13\13\ 1º" "\ 2\ 1Ã\9e\13¢" "\ 2\ 1Â\97\10\10\ 1½\10\ 1\10Â\87\ 1\10\ 1\10\ 1\ 1\10Â\88\ 1Â\86\10Â\8a\ 1\ 1\10" 1 "\ 2\10Â\84\ 1°\10\ 1\10Â\85\ 1\10\ 1Â\85\10\ 1¨\10Â\89\ 1Â\8c" "\ 2\10\10\ 1 \10Â\84\ 1\ 1\10\10\ 1\10\ 1º\10\ 1\10\10\ 1Â\83\10\ 1\10Â\83\ 1Â\8e" "\ 2\ 1¬\10Â\88\ 1\ 1\10\10\ 1Ã\88" "\ 2\ 1Ã\90\10Â\83\ 1\10Â\8d\ 1\10Â\87\ 1Â\84\10\ 1Â\86\10\ 1Â\8b" 1 "\ 2\ 1À\10§\ 1\95\10\84" 1 1 1 "\ 2\ 1½\13\ 1\13\83\ 1\8b\13\83\ 1\8d\13\83\ 1\8d\13\83\ 1\8d\13\13\ 1"] #^^[2 8192 "\ 2\12\8b\ 5\83\ 1\ 2\13\98\12\ 6\b
+\f      \v\ f\ e\85\13\8f\ f\13\9a\12\ 5\85\ 1\85\ 5\86\ 3\ 1\83\ 3\86\r\r\13\83\ 1" "\ 2\ 3\8a\r\r\13\83\ 1\91\ e\9a\ 1\96\10¡\ 1\8f" "\ 2\13\13\ 1\13\84\ 1\13\13\ 1\8a\13\ 1\13\83\ 1\85\13\86\ 1\13\ 1\13\ 1\13\ 1\84\ e\ 1\8b\13\13\ 1\84\13\85\ 1\85\13\84\ 1\ 1\13\90\ 1 " "\ 2\ 1\89\13\ 1\86\13ð" "\ 2\13\92\r\ e\13ì" 19 "\ 2\13\ 1Å\13\85" "\ 2\13\95\ 1\13Þ\ 1\8c" "\ 2\13§\ 1\99\13\8b\ 1\95\13 " "\ 2\13\88\ 3\94\ 1Î\13\96" 19 19 19 "\ 2\13¬\ 1\13Ó" "\ 2\ 1\13ÿ" 19 1 1 19 19 19 19 "\ 2\13Í\ 1\83\13\8a\ 1¦" 1 1 "\ 2\ 1å\13\86\ 1\84\10\83\ 1\87\13\87" "\ 2\ 1ÿ\10" "\ 2\ 1à\10 " "\ 2\13¼\ 1Ä" "\ 2\13\9a\ 1\13Ù\ 1\8c" 19 "\ 2\13Ö\ 1\9a\13\8c\ 1\84"] #^^[2 12288 "\ 2\12\13\84\ 1\83\13\99\ 1\89\10\84\ 1\ 1\13\ 1\85\13\13\ 1\85\13\83\ 1À" "\ 2\ 1\99\10\10\13\13\ 1\83\13\ 1Ú\13\ 1\84" 1 "\ 2\ 1À\13¤\ 1\9c" "\ 2\ 1\9d\13\13\ 1±\13\90\ 1\9c\13\83\ 1" "\ 2\ 1±\13\8f\ 1\8c\13\84\ 1°" "\ 2\ 1÷\13\84\ 1\85" "\ 2\ 1Þ\13\13\ 1\9f\13" 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 "\ 2\ 1À\13À" 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 
+#^^[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 "\ 2\ 1\90\13·\ 1¹" 1 1 "\ 2\ 1\8d\13\83\ 1ß\10\84\13\10\8a\13\13" "\ 2\ 1\9f\10\ 1Ð\10\10\ 1\8e" "\ 2\13¢\ 1Þ" "\ 2\ 1\88\13\ 1÷" "\ 2\ 1\ 1\10\ 1\83\10\ 1\84\10\ 1\99\10\10\ 1\13\84\ 1\8c\ e\ e\ 1º\13\84\ 1\88" "\ 2\ 1Ä\10\ 1\9b\10\92\ 1\8e" "\ 2\ 1¦\10\88\ 1\99\10\8b\ 1®" "\ 2\10\83\ 1°\10\ 1\ 1\10\84\ 1\ 1\10\ 1Ã" "\ 2\ 1©\10\86\ 1\ 1\10\10\ 1\ 1\10\10\ 1\8c\10\ 1\88\10\ 1³" "\ 2\ 1°\10\ 1\10\83\ 1\ 1\10\10\ 1\85\10\10\ 1\10\ 1ª\10\10\ 1\88\10\ 1\89" 1 "\ 2\ 1å\10\ 1\ 1\10\ 1\84\10\ 1\92" 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 "\ 2\ 1\9d\ 2\10\ 2\8a\r\ 2¦\a°" 7 7 7 "\ 2\a¾\13\13\aÀ" "\ 2\aý\13\a\a" "\ 2\10\90\13\8a\ 1\86\10\87\ 1\89\13 \ f\13\ f\ 1\13\ f\13\89\ e\13\13\r\r\13\83\ 1\13\ e\ e\13\ 1\84\a\90" "\ 2\aÿ\ 5" "\ 2\ 1\13\13\ e\83\13\85\r\ f\r\ f\ f\ 3\8a\ f\13\86\ 1\9a\13\86\ 1\9a\13\8b\ 1\9a" "\ 2\ 1à\ e\ e\13\83\ e\ e\ 1\13\87\ 1\8a\13\85\ 1\ 1"]] #^^[1 65536 #^^[2 65536 1 1 "\ 2\ 1\13\ 1¾\13À" "\ 2\13\8b\ 1\85\13\8c\ 1á\10\ 1\ 1" 1 1 1 1 1 1 1 1 1 1 1 1 2 2 "\ 2\ 2\9f\13\ 2à" 2 "\ 2\ 2\10\83\ 2\10\10\ 2\85\10\84\ 2¨\10\83\ 2\84\10\ 2À" 2 "\ 2\ 2¹\13\87\ 2À" 2 2 2 2 2 "\ 2\ 2à\ 4\9f\ 2" 2 2 2] #^^[2 69632 "\ 2\ 1\10\ 1\10\8f\ 1\8b\13\94\ 1\9a" "\ 2\10\10\ 1±\10\84\ 1\ 1\10\10\ 1Å" "\ 2\10\83\ 1¤\10\85\ 1\10\88\ 1Ë" "\ 2\10\10\ 1´\10\89\ 1Á" 1 1 1 1 1 1 1 1 1 "\ 2\ 1«\10\ 1\10\ 1\ 1\10\86\ 1\10\ 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 "\ 2\ 1\8f\10\84\ 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 "\ 2\ 1ç\10\83\ 1\89\ 5\88\10\85" "\ 2\10\83\ 1\ 1\10\87\ 1\9e\10\84\ 1Ò" "\ 2\13Â\10\83\13\ 1º" 1 "\ 2\13×\ 1©" 1 1 1 1 1 1 "\ 2\ 1Û\13\ 1¤" "\ 2\ 1\95\13\ 1¹\13\ 1°" "\ 2\ 1\89\13\ 1¹\13\ 1\8a\ 3²" 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\a\84\ 2\a\9b\ 2\a\a\ 2\a\ 2\ 2\a\ 2\a\8a\ 2\a\84\ 2\a\ 2\a\ 2\86\a\ 2\84\a\ 2\a\ 2\a\ 2\a\83\ 2\a\a\ 2\a\ 2\ 2\a\ 2\a\ 2\a\ 2\a\ 2\a\ 2\a\a\ 2\a\ 2\ 2\a\84\ 2\a\87\ 2\a\84\ 2\a\84\ 2\a\ 2" "\ 2\a\8a\ 2\a\91\ 2\85\a\83\ 2\a\85\ 2\a\91\ 2´\13\13\ 2\8e" 2 2] #^^[2 126976 "\ 2\13¬\ 1\84\13Ð" "\ 2\13\94\ 1\8c\13\8f\ 1\ 1\13\8e\ 1\ 1\13\8f\ 1\13\8f\ 1 " "\ 2\ 3\8b\ 1ß\13\13\ 1\94" 1 1 1 "\ 2\13¡\ 1\8f\13\86\ 1\13Æ\ 1\83" "\ 2\13\94\ 1\8c\13¥\ 1\13\85\ 1\95\13\91\ 1\8f" "\ 2\13¿\ 1\13\ 1\13¾" "\ 2\13ø\ 1\13\84\ 1\83" "\ 2\13¾\ 1\ 1\13\84\ 1\8c\13\98\ 1\98" "\ 2\ 1û\13\85" "\ 2\13Á\ 1\84\13\8b\ 1°" "\ 2\13Æ\ 1º" "\ 2\13ô\ 1\8c" 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 
 #^^[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 
 #^^[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 
 #^^[3 178176 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 192512 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]] 1 1 1 1 1 1 1 1 1 1 1 #^^[1 917504 #^^[2 917504 "\ 2\ 1\ 5\ 1\9e\ 5à" 1 16 "\ 2\10ð\ 1\90" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[1 983040 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #^^[2 1044480 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
index 94b7c18b6e2f99a8be1aac32cd9f2eba9f187679..f0ccde477cc7ea108dab1ecf813d71413446dc4b 100644 (file)
@@ -4,21 +4,21 @@
 ;; See lisp/international/README for the copyright and permission notice.
 (define-char-code-property 'general-category #^[30 nil char-code-property-table 
 #^^[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 
-#^^[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\1a \17\12\14\84\16\16\15\16\ 2\10\13\e\16\15\16\13\v\v\15\ 2\16\12\15\v\ 2\11\v\83\12\ 1\97\13\ 1\87\ 2\98\13\ 2\88" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 2\ 2" "\ 2\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\83\ 2\ 2\ 1\84\ 2\ 1\ 1\ 2\ 1\83\ 2\83\ 1\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 1\ 2\ 1\83\ 2\ 1\ 2\ 1\ 1\ 2\ 2\ 5\ 1\ 2\83\ 5\84\ 1\ 3\ 2\ 1\ 3\ 2\ 1\ 3\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 3\ 2\ 1\ 2\ 1\83\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\87\ 1\ 1\ 2\ 1\ 1\ 2\ 2\ 1\ 2\ 1\84\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2±" "\ 2\ 2\94\ 5\ 2\9b\ 4\92\15\84\ 4\8c\15\8e\ 4\85\15\87\ 4\15\ 4\15\91" "\ 2\ 6ð\ 1\ 2\ 1\ 2\ 4\15\ 1\ 2\1e\1e\ 4\ 2\83\12\1e" "\ 2\1e\84\15\15\ 1\12\ 1\83\1e\ 1\1e\ 1\ 1\ 2\ 1\91\1e\ 1\89\ 2£\ 1\ 2\ 2\ 1\83\ 2\83\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\85\ 1\ 2\13\ 1\ 2\ 1\ 1\ 2\ 2\ 1\83" "\ 2\ 1°\ 2°\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\16\ 6\85\b\b\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\1e\89\ 1¦\1e\1e\ 4\12\86\1e\ 2\9f" "\ 2\ 2\88\1e\12\r\1e\86\ 6­\r\ 6\12\ 6\ 6\12\ 6\ 6\12\ 6\1e\88\ 5\9b\1e\85\ 5\83\12\12\1e\8b" "\ 2\e\84\1e\1e\13\83\12\12\14\12\12\16\16\ 6\8b\12\1e\1e\12\12\ 5 \ 4\ 5\8a\ 6\95    \8a\12\84\ 5\ 5\ 6\ 5\8f" "\ 2\ 5Ô\12\ 5\ 6\87\e\16\ 6\86\ 4\ 4\ 6\ 6\16\ 6\84\ 5\ 5  \8a\ 5\83\16\16\ 5" "\ 2\12\8e\1e\e\ 5\ 6\ 5\9e\ 6\9b\1e\1e\ 5³" "\ 2\ 5¦\ 6\8b\ 5\1e\8e    \8a\ 5¡\ 6\89\ 4\ 4\16\12\83\ 4\1e\85" "\ 2\ 5\96\ 6\84\ 4\ 6\89\ 4\ 6\83\ 4\ 6\85\1e\1e\12\8f\1e\ 5\99\ 6\83\1e\1e\12\1e¡" 30 "\ 2\ 6\83\a\ 5\ 6\a\ 6\ 5\a\83\ 6\88\a\84\ 6\a\a\ 5\ 6\87\ 5\8a\ 6\ 6\12\12     \8a\12\ 4\ 5\86\1e\ 5\87" "\ 2\1e\ 6\a\a\1e\ 5\88\1e\1e\ 5\ 5\1e\1e\ 5\96\1e\ 5\87\1e\ 5\1e\83\ 5\84\1e\1e\ 6\ 5\a\83\ 6\84\1e\1e\a\a\1e\1e\a\a\ 6\ 5\1e\88\a\1e\84\ 5\ 5\1e\ 5\83\ 6\ 6\1e\1e       \8a\ 5\ 5\14\14\v\86\16\14\1e\84" "\ 2\1e\ 6\ 6\a\1e\ 5\86\1e\84\ 5\ 5\1e\1e\ 5\96\1e\ 5\87\1e\ 5\ 5\1e\ 5\ 5\1e\ 5\ 5\1e\1e\ 6\1e\a\83\ 6\ 6\1e\84\ 6\ 6\1e\1e\ 6\83\1e\83\ 6\1e\87\ 5\84\1e\ 5\1e\87     \8a\ 6\ 6\ 5\83\ 6\1e\8a" "\ 2\1e\ 6\ 6\a\1e\ 5\89\1e\ 5\83\1e\ 5\96\1e\ 5\87\1e\ 5\ 5\1e\ 5\85\1e\1e\ 6\ 5\a\83\ 6\85\1e\ 6\ 6\a\1e\a\a\ 6\1e\1e\ 5\1e\8f\ 5\ 5\ 6\ 6\1e\1e        \8a\1e\14\1e\8e" "\ 2\1e\ 6\a\a\1e\ 5\88\1e\1e\ 5\ 5\1e\1e\ 5\96\1e\ 5\87\1e\ 5\ 5\1e\ 5\85\1e\1e\ 6\ 5\a\ 6\a\ 6\84\1e\1e\a\a\1e\1e\a\a\ 6\1e\88\ 6\a\1e\84\ 5\ 5\1e\ 5\83\ 6\ 6\1e\1e    \8a\16\ 5\v\86\1e\88" "\ 2\1e\1e\ 6\ 5\1e\ 5\86\1e\83\ 5\83\1e\ 5\84\1e\83\ 5\ 5\1e\ 5\1e\ 5\ 5\1e\83\ 5\ 5\1e\83\ 5\83\1e\83\ 5\8c\1e\84\a\a\ 6\a\a\1e\83\a\83\1e\a\83\ 6\1e\1e\ 5\1e\86\a\1e\8e        \8a\v\83\16\86\14\16\1e\85" "\ 2\1e\a\83\1e\ 5\88\1e\ 5\83\1e\ 5\97\1e\ 5\8a\1e\ 5\85\1e\83\ 5\ 6\83\a\84\1e\ 6\83\1e\ 6\84\1e\87\ 6\ 6\1e\ 5\ 5\1e\86\ 5\ 5\ 6\ 6\1e\1e    \8a\1e\88\v\87\16" "\ 2\1e\1e\a\a\1e\ 5\88\1e\ 5\83\1e\ 5\97\1e\ 5\8a\1e\ 5\85\1e\1e\ 6\ 5\a\ 6\a\85\1e\ 6\a\a\1e\a\a\ 6\ 6\1e\87\a\a\1e\87\ 5\1e\ 5\ 5\ 6\ 6\1e\1e \8a\1e\ 5\ 5\1e\8d" "\ 2\1e\1e\a\a\1e\ 5\88\1e\ 5\83\1e\ 5©\1e\1e\ 5\a\83\ 6\84\1e\a\83\1e\a\83\ 6\ 5\1e\88\a\1e\88\ 5\ 5\ 6\ 6\1e\1e    \8a\v\86\1e\83\16\ 5\86" "\ 2\1e\1e\a\a\1e\ 5\92\1e\83\ 5\98\1e\ 5\89\1e\ 5\1e\1e\ 5\87\1e\83\ 6\1e\84\a\83\ 6\83\1e\ 6\1e\a\88\1e\92\a\a\12\1e\8b" "\ 2\1e\ 5°\ 6\ 5\ 5\ 6\87\1e\84\14\ 5\86\ 4\ 6\88\12 \8a\12\12\1e¤" "\ 2\1e\ 5\ 5\1e\ 5\1e\1e\ 5\ 5\1e\ 5\1e\1e\ 5\1e\86\ 5\84\1e\ 5\87\1e\ 5\83\1e\ 5\1e\ 5\1e\1e\ 5\ 5\1e\ 5\84\ 6\ 5\ 5\ 6\86\1e\ 6\ 6\ 5\1e\1e\ 5\85\1e\ 4\1e\ 6\86\1e\1e      \8a\1e\1e\ 5\ 5\1e¢" "\ 2\ 5\16\83\12\8f\16\85\ 6\ 6\16\86    \8a\v\8a\16\ 6\16\ 6\16\ 6\ e\ f\ e\ f\a\a\ 5\88\1e\ 5¤\1e\84\ 6\8e\a" "\ 2\ 6\85\12\ 6\ 6\ 5\85\ 6\8b\1e\ 6¤\1e\16\88\ 6\16\86\1e\16\16\12\85\16\84\12\12\1e¥"] #^^[2 4096 "\ 2\ 5«\a\a\ 6\84\a\ 6\86\a\ 6\ 6\a\a\ 6\ 6\ 5   \8a\12\86\ 5\86\a\a\ 6\ 6\ 5\84\ 6\83\ 5\a\83\ 5\ 5\a\87\ 5\83\ 6\84\ 5\8b" "\ 2\ 5\ 5\ 6\a\a\ 6\ 6\a\86\ 6\ 5\a   \8a\a\83\ 6\16\16\ 1¦\1e\8a\ 5«\12\ 4\1e\83" 5 5 "\ 2\ 5É\1e\ 5\84\1e\1e\ 5\87\1e\ 5\1e\ 5\84\1e\1e\ 5 " "\ 2\ 5\89\1e\ 5\84\1e\1e\ 5¡\1e\ 5\84\1e\1e\ 5\87\1e\ 5\1e\ 5\84\1e\1e\ 5\8f\1e\ 5¨" "\ 2\ 5\91\1e\ 5\84\1e\1e\ 5Ã\1e\1e\ 6\83\16\12\88\v\94\1e\83" "\ 2\ 5\90\16\8a\1e\86\ 5Õ\1e\8b" "\ 2\r\ 5ÿ" 5 5 5 "\ 2\ 5í\12\12\ 5\91" "\ 2\17\ 5\9a\ e\ f\1e\83\ 5Ë\12\83
-\83\1e\8f" "\ 2\ 5\8d\1e\ 5\84\ 6\83\1e\8b\ 5\92\ 6\83\12\12\1e\89\ 5\92\ 6\ 6\1e\8c\ 5\8d\1e\ 5\83\1e\ 6\ 6\1e\8c" "\ 2\ 5´\e\e\a\ 6\87\a\88\ 6\a\a\ 6\8b\12\83\ 4\12\83\14\ 5\ 6\1e\1e       \8a\1e\86\v\8a\1e\86" "\ 2\12\86\r\12\84\ 6\83\17\1e     \8a\1e\86\ 5£\ 4\ 5´\1e\88" "\ 2\ 5©\ 6\ 5\1e\85\ 5Æ\1e\8a" "\ 2\ 5\9d\1e\83\ 6\83\a\84\ 6\ 6\a\83\1e\84\a\a\ 6\a\86\ 6\83\1e\84\16\1e\83\12\12     \8a\ 5\9e\1e\1e\ 5\85\1e\8b" "\ 2\ 5¬\1e\84\a\91\ 5\87\a\a\1e\86      \8a\v\1e\83\16¢" "\ 2\ 5\97\ 6\ 6\a\83\1e\1e\12\12\ 5µ\a\ 6\a\ 6\87\1e\ 6\a\ 6\a\a\ 6\88\a\86\ 6\8a\1e\1e\ 6" "\ 2        \8a\1e\86   \8a\1e\86\12\87\ 4\12\86\1eÒ" "\ 2\ 6\84\a\ 5¯\ 6\a\ 6\85\a\ 6\a\85\ 6\a\a\ 5\87\1e\84   \8a\12\87\16\8a\ 6\89\16\89\1e\83" "\ 2\ 6\ 6\a\ 5\9e\a\ 6\84\a\a\ 6\ 6\a\1e\83\ 5\ 5       \8a\1e\86\ 5¦\ 6\a\ 6\ 6\a\83\ 6\a\ 6\83\a\a\1e\88\12\84" "\ 2\ 5¤\a\88\ 6\88\a\a\ 6\ 6\1e\83\12\85     \8a\1e\83\ 5\83        \8a\ 5\9e\ 4\86\12\12" "\ 2\1eÐ\ 6\83\12\ 6\8d\a\ 6\87\ 5\84\ 6\ 5\84\a\1e\8d" "\ 2\ 2¬\ 4\ 2\96\ 4\ 2\87" "\ 2\ 2\9b\ 4¥\ 6§\1e\95\ 6\84" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\89\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 2\88\ 1\88\ 2\86\1e\1e\ 1\86\1e\1e\ 2\88\ 1\88\ 2\88\ 1\88\ 2\86\1e\1e\ 1\86\1e\1e\ 2\88\1e\ 1\1e\ 1\1e\ 1\1e\ 1\ 2\88\ 1\88\ 2\8e\1e\1e" "\ 2\ 2\88\ 3\88\ 2\88\ 3\88\ 2\88\ 3\88\ 2\85\1e\ 2\ 2\ 1\84\ 3\15\ 2\15\83\ 2\83\1e\ 2\ 2\ 1\84\ 3\15\83\ 2\84\1e\1e\ 2\ 2\ 1\84\1e\15\83\ 2\88\ 1\85\15\83\1e\1e\ 2\83\1e\ 2\ 2\ 1\84\ 3\15\15\1e"] #^^[2 8192 "\ 2\17\8b\e\85\r\86\12\12\10\11\ e\10\10\11\ e\10\12\88\18\19\e\85\17\12\89\10\11\12\84\f\f\12\83\13\ e\ f\12\8b\13\12\f\12\8a\17\e\85\1e\85\e\86\v\ 4\1e\1e\v\86\13\83\ e\ f\ 4" "\ 2\v\8a\13\83\ e\ f\1e\ 4\8d\1e\83\14\9a\1e\96\ 6\8d\b\84\ 6\b\83\ 6\8c\1e\8f" "\ 2\16\16\ 1\16\84\ 1\16\16\ 2\ 1\83\ 2\ 2\ 1\83\ 2\16\ 1\16\16\13\ 1\85\16\86\ 1\16\ 1\16\ 1\16\ 1\84\16\ 2\ 1\84\ 2\ 5\84\ 2\16\16\ 2\ 2\ 1\ 1\13\85\ 1\ 2\84\16\13\16\16\ 2\16\v\90
+#^^[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\1a \17\12\14\84\16\12\15\16\ 5\10\13\e\16\15\16\13\v\v\15\ 2\12\12\15\v\ 5\11\v\83\12\ 1\97\13\ 1\87\ 2\98\13\ 2\88" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 2\ 2" "\ 2\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\83\ 2\ 2\ 1\84\ 2\ 1\ 1\ 2\ 1\83\ 2\83\ 1\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 1\ 2\ 1\83\ 2\ 1\ 2\ 1\ 1\ 2\ 2\ 5\ 1\ 2\83\ 5\84\ 1\ 3\ 2\ 1\ 3\ 2\ 1\ 3\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 3\ 2\ 1\ 2\ 1\83\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\87\ 1\ 1\ 2\ 1\ 1\ 2\ 2\ 1\ 2\ 1\84\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2±" "\ 2\ 2\94\ 5\ 2\9b\ 4\92\15\84\ 4\8c\15\8e\ 4\85\15\87\ 4\15\ 4\15\91" "\ 2\ 6ð\ 1\ 2\ 1\ 2\ 4\15\ 1\ 2\1e\1e\ 4\ 2\83\12\1e" "\ 2\1e\84\15\15\ 1\12\ 1\83\1e\ 1\1e\ 1\ 1\ 2\ 1\91\1e\ 1\89\ 2£\ 1\ 2\ 2\ 1\83\ 2\83\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\85\ 1\ 2\13\ 1\ 2\ 1\ 1\ 2\ 2\ 1\83" "\ 2\ 1°\ 2°\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\16\ 6\85\b\b\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\1e\89\ 1¦\1e\1e\ 4\12\86\1e\ 2\9f" "\ 2\ 2\88\1e\12\r\1e\84\14\1e\ 6­\r\ 6\12\ 6\ 6\12\ 6\ 6\12\ 6\1e\88\ 5\9b\1e\85\ 5\83\12\12\1e\8b" "\ 2\e\85\1e\13\83\12\12\14\12\12\16\16\ 6\8b\12\1e\1e\12\12\ 5 \ 4\ 5\8a\ 6\95   \8a\12\84\ 5\ 5\ 6\ 5\8f" "\ 2\ 5Ô\12\ 5\ 6\87\e\16\ 6\86\ 4\ 4\ 6\ 6\16\ 6\84\ 5\ 5  \8a\ 5\83\16\16\ 5" "\ 2\12\8e\1e\e\ 5\ 6\ 5\9e\ 6\9b\1e\1e\ 5³" "\ 2\ 5¦\ 6\8b\ 5\1e\8e    \8a\ 5¡\ 6\89\ 4\ 4\16\12\83\ 4\1e\85" "\ 2\ 5\96\ 6\84\ 4\ 6\89\ 4\ 6\83\ 4\ 6\85\1e\1e\12\8f\1e\ 5\99\ 6\83\1e\1e\12\1e¡" "\ 2\1e \ 5\1e\ 5\8b\1e·\ 6\9b\1e" "\ 2\ 6\83\a\ 5\ 6\a\ 6\ 5\a\83\ 6\88\a\84\ 6\a\a\ 5\ 6\87\ 5\8a\ 6\ 6\12\12     \8a\12\ 4\ 5\86\1e\ 5\87" "\ 2\1e\ 6\a\a\1e\ 5\88\1e\1e\ 5\ 5\1e\1e\ 5\96\1e\ 5\87\1e\ 5\1e\83\ 5\84\1e\1e\ 6\ 5\a\83\ 6\84\1e\1e\a\a\1e\1e\a\a\ 6\ 5\1e\88\a\1e\84\ 5\ 5\1e\ 5\83\ 6\ 6\1e\1e       \8a\ 5\ 5\14\14\v\86\16\14\1e\84" "\ 2\1e\ 6\ 6\a\1e\ 5\86\1e\84\ 5\ 5\1e\1e\ 5\96\1e\ 5\87\1e\ 5\ 5\1e\ 5\ 5\1e\ 5\ 5\1e\1e\ 6\1e\a\83\ 6\ 6\1e\84\ 6\ 6\1e\1e\ 6\83\1e\83\ 6\1e\87\ 5\84\1e\ 5\1e\87     \8a\ 6\ 6\ 5\83\ 6\1e\8a" "\ 2\1e\ 6\ 6\a\1e\ 5\89\1e\ 5\83\1e\ 5\96\1e\ 5\87\1e\ 5\ 5\1e\ 5\85\1e\1e\ 6\ 5\a\83\ 6\85\1e\ 6\ 6\a\1e\a\a\ 6\1e\1e\ 5\1e\8f\ 5\ 5\ 6\ 6\1e\1e        \8a\12\14\1e\8e" "\ 2\1e\ 6\a\a\1e\ 5\88\1e\1e\ 5\ 5\1e\1e\ 5\96\1e\ 5\87\1e\ 5\ 5\1e\ 5\85\1e\1e\ 6\ 5\a\ 6\a\ 6\84\1e\1e\a\a\1e\1e\a\a\ 6\1e\88\ 6\a\1e\84\ 5\ 5\1e\ 5\83\ 6\ 6\1e\1e    \8a\16\ 5\v\86\1e\88" "\ 2\1e\1e\ 6\ 5\1e\ 5\86\1e\83\ 5\83\1e\ 5\84\1e\83\ 5\ 5\1e\ 5\1e\ 5\ 5\1e\83\ 5\ 5\1e\83\ 5\83\1e\83\ 5\8c\1e\84\a\a\ 6\a\a\1e\83\a\83\1e\a\83\ 6\1e\1e\ 5\1e\86\a\1e\8e        \8a\v\83\16\86\14\16\1e\85" "\ 2\1e\a\83\1e\ 5\88\1e\ 5\83\1e\ 5\97\1e\ 5\8a\1e\ 5\85\1e\83\ 5\ 6\83\a\84\1e\ 6\83\1e\ 6\84\1e\87\ 6\ 6\1e\ 5\ 5\1e\86\ 5\ 5\ 6\ 6\1e\1e    \8a\1e\88\v\87\16" "\ 2\1e\1e\a\a\1e\ 5\88\1e\ 5\83\1e\ 5\97\1e\ 5\8a\1e\ 5\85\1e\1e\ 6\ 5\a\ 6\a\85\1e\ 6\a\a\1e\a\a\ 6\ 6\1e\87\a\a\1e\87\ 5\1e\ 5\ 5\ 6\ 6\1e\1e \8a\1e\ 5\ 5\1e\8d" "\ 2\1e\1e\a\a\1e\ 5\88\1e\ 5\83\1e\ 5©\1e\1e\ 5\a\83\ 6\84\1e\a\83\1e\a\83\ 6\ 5\1e\88\a\1e\88\ 5\ 5\ 6\ 6\1e\1e    \8a\v\86\1e\83\16\ 5\86" "\ 2\1e\1e\a\a\1e\ 5\92\1e\83\ 5\98\1e\ 5\89\1e\ 5\1e\1e\ 5\87\1e\83\ 6\1e\84\a\83\ 6\83\1e\ 6\1e\a\88\1e\92\a\a\12\1e\8b" "\ 2\1e\ 5°\ 6\ 5\ 5\ 6\87\1e\84\14\ 5\86\ 4\ 6\88\12 \8a\12\12\1e¤" "\ 2\1e\ 5\ 5\1e\ 5\1e\1e\ 5\ 5\1e\ 5\1e\1e\ 5\1e\86\ 5\84\1e\ 5\87\1e\ 5\83\1e\ 5\1e\ 5\1e\1e\ 5\ 5\1e\ 5\84\ 6\ 5\ 5\ 6\86\1e\ 6\ 6\ 5\1e\1e\ 5\85\1e\ 4\1e\ 6\86\1e\1e      \8a\1e\1e\ 5\84\1e " "\ 2\ 5\16\83\12\8f\16\12\16\83\ 6\ 6\16\86 \8a\v\8a\16\ 6\16\ 6\16\ 6\ e\ f\ e\ f\a\a\ 5\88\1e\ 5¤\1e\84\ 6\8e\a" "\ 2\ 6\85\12\ 6\ 6\ 5\85\ 6\8b\1e\ 6¤\1e\16\88\ 6\16\86\1e\16\16\12\85\16\84\12\12\1e¥"] #^^[2 4096 "\ 2\ 5«\a\a\ 6\84\a\ 6\86\a\ 6\ 6\a\a\ 6\ 6\ 5   \8a\12\86\ 5\86\a\a\ 6\ 6\ 5\84\ 6\83\ 5\a\83\ 5\ 5\a\87\ 5\83\ 6\84\ 5\8b" "\ 2\ 5\ 5\ 6\a\a\ 6\ 6\a\86\ 6\ 5\a   \8a\a\83\ 6\16\16\ 1¦\1e\ 1\1e\85\ 1\1e\1e\ 5«\12\ 4\ 5\83" 5 5 "\ 2\ 5É\1e\ 5\84\1e\1e\ 5\87\1e\ 5\1e\ 5\84\1e\1e\ 5 " "\ 2\ 5\89\1e\ 5\84\1e\1e\ 5¡\1e\ 5\84\1e\1e\ 5\87\1e\ 5\1e\ 5\84\1e\1e\ 5\8f\1e\ 5¨" "\ 2\ 5\91\1e\ 5\84\1e\1e\ 5Ã\1e\1e\ 6\83\12\89\v\94\1e\83" "\ 2\ 5\90\16\8a\1e\86\ 5Õ\1e\8b" "\ 2\r\ 5ÿ" 5 5 5 "\ 2\ 5í\12\12\ 5\91" "\ 2\17\ 5\9a\ e\ f\1e\83\ 5Ë\12\83
+\83\1e\8f" "\ 2\ 5\8d\1e\ 5\84\ 6\83\1e\8b\ 5\92\ 6\83\12\12\1e\89\ 5\92\ 6\ 6\1e\8c\ 5\8d\1e\ 5\83\1e\ 6\ 6\1e\8c" "\ 2\ 5´\ 6\ 6\a\ 6\87\a\88\ 6\a\a\ 6\8b\12\83\ 4\12\83\14\ 5\ 6\1e\1e       \8a\1e\86\v\8a\1e\86" "\ 2\12\86\r\12\84\ 6\83\17\1e     \8a\1e\86\ 5£\ 4\ 5´\1e\88" "\ 2\ 5©\ 6\ 5\1e\85\ 5Æ\1e\8a" "\ 2\ 5\9d\1e\83\ 6\83\a\84\ 6\ 6\a\83\1e\84\a\a\ 6\a\86\ 6\83\1e\84\16\1e\83\12\12     \8a\ 5\9e\1e\1e\ 5\85\1e\8b" "\ 2\ 5¬\1e\84\a\91\ 5\87\a\a\1e\86      \8a\v\1e\83\16¢" "\ 2\ 5\97\ 6\ 6\a\83\1e\1e\12\12\ 5µ\a\ 6\a\ 6\87\1e\ 6\a\ 6\a\a\ 6\88\a\86\ 6\8a\1e\1e\ 6" "\ 2        \8a\1e\86   \8a\1e\86\12\87\ 4\12\86\1eÒ" "\ 2\ 6\84\a\ 5¯\ 6\a\ 6\85\a\ 6\a\85\ 6\a\a\ 5\87\1e\84   \8a\12\87\16\8a\ 6\89\16\89\1e\83" "\ 2\ 6\ 6\a\ 5\9e\a\ 6\84\a\a\ 6\ 6\a\ 6\a\a\ 5\ 5       \8a\ 5¬\ 6\a\ 6\ 6\a\83\ 6\a\ 6\83\a\a\1e\88\12\84" "\ 2\ 5¤\a\88\ 6\88\a\a\ 6\ 6\1e\83\12\85        \8a\1e\83\ 5\83        \8a\ 5\9e\ 4\86\12\12" "\ 2\1eÀ\12\88\1e\88\ 6\83\12\ 6\8d\a\ 6\87\ 5\84\ 6\ 5\84\a\a\ 6\ 5\ 5\1e\89" "\ 2\ 2¬\ 4¿\ 2\8d\ 4\ 2\87" "\ 2\ 2\9b\ 4¥\ 6§\1e\95\ 6\84" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\89\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2" "\ 2\ 2\88\ 1\88\ 2\86\1e\1e\ 1\86\1e\1e\ 2\88\ 1\88\ 2\88\ 1\88\ 2\86\1e\1e\ 1\86\1e\1e\ 2\88\1e\ 1\1e\ 1\1e\ 1\1e\ 1\ 2\88\ 1\88\ 2\8e\1e\1e" "\ 2\ 2\88\ 3\88\ 2\88\ 3\88\ 2\88\ 3\88\ 2\85\1e\ 2\ 2\ 1\84\ 3\15\ 2\15\83\ 2\83\1e\ 2\ 2\ 1\84\ 3\15\83\ 2\84\1e\1e\ 2\ 2\ 1\84\1e\15\83\ 2\88\ 1\85\15\83\1e\1e\ 2\83\1e\ 2\ 2\ 1\84\ 3\15\15\1e"] #^^[2 8192 "\ 2\17\8b\e\85\r\86\12\12\10\11\ e\10\10\11\ e\10\12\88\18\19\e\85\17\12\89\10\11\12\84\f\f\12\83\13\ e\ f\12\8b\13\12\f\12\8a\17\e\85\1e\85\e\86\v\ 4\1e\1e\v\86\13\83\ e\ f\ 4" "\ 2\v\8a\13\83\ e\ f\1e\ 4\8d\1e\83\14\9a\1e\96\ 6\8d\b\84\ 6\b\83\ 6\8c\1e\8f" "\ 2\16\16\ 1\16\84\ 1\16\16\ 2\ 1\83\ 2\ 2\ 1\83\ 2\16\ 1\16\16\13\ 1\85\16\86\ 1\16\ 1\16\ 1\16\ 1\84\16\ 2\ 1\84\ 2\ 5\84\ 2\16\16\ 2\ 2\ 1\ 1\13\85\ 1\ 2\84\16\13\16\16\ 2\16\v\90
  " "\ 2
 \83\ 1\ 2
\84\v\1eÂ\86\13Â\85\16Â\85\13\13\16Â\84\13\16\16\13\16\16\13\16Â\87\13\16Â\9f\13\13\16\16\13\16\13\16Â\9f\13Â\8c" 19 19 "\ 2\16Â\88\13Â\84\16Â\94\13\13\16Â\87\ e\ f\16Ã\91\13\16Â\83" "\ 2\16Â\9b\13Â\99\16¨\13Â\86\16Â\92\1eÂ\8c" "\ 2\16§\1eÂ\99\16Â\8b\1eÂ\95\v " "\ 2\vÂ\9c\16Ã\8e\vÂ\96" 22 "\ 2\16·\13\16Â\89\13\16¶\13Â\88" "\ 2\16ï\13\16Â\90" 22 "\ 2\1e\16ç\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\vÂ\8a" "\ 2\vÂ\94\16¬\13Â\85\ e\ f\13Â\84\1e\13\1e\13Â\98\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\13Â\90" 22 22 19 "\ 2\13Â\83\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\13¿\ e\ f\ e\ f\13 \ e\ f\13\13" 19 19 "\ 2\16°\13Â\95\16\16\13Â\86\1eÂ\83\16Â\8a\1e¦" 30 "\ 2\ 1¯\1e\ 2¯\1e\ 1\ 2\ 1Â\83\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1Â\84\ 2\ 1\ 2\ 2\ 1\ 2Â\87\ 4\ 1\ 1" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\16Â\86\ 1\ 2\ 1\ 2\ 6Â\83\1eÂ\87\12Â\84\v\12\12" "\ 2\ 2¦\1eÂ\8a\ 5¶\1eÂ\89\ 4\12\1eÂ\8e\ 6" "\ 2\ 5Â\97\1eÂ\89\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 6 " "\ 2\12\12\10\11\10\11\12Â\83\10\11\12\10\11\12Â\89\r\12\12\r\12\10\11\12\12\10\11\ e\ f\ e\ f\ e\ f\ e\ f\12Â\85\ 4\12\12\1eÃ\8e" "\ 2\16\9a\1e\16Ù\1e\8c" 22 "\ 2\16Ö\1e\9a\16\8c\1e\84"] #^^[2 12288 "\ 2\17\12\83\16\ 4\ 5
\84\v\1eÂ\86\13Â\85\16Â\85\13\13\16Â\84\13\16\16\13\16\16\13\16Â\87\13\16Â\9f\13\13\16\16\13\16\13\16Â\9f\13Â\8c" 19 19 "\ 2\16Â\88\13Â\84\16Â\94\13\13\16Â\87\ e\ f\16Ã\91\13\16Â\83" "\ 2\16Â\9b\13Â\99\16¨\13Â\86\16Â\92\1eÂ\8c" "\ 2\16§\1eÂ\99\16Â\8b\1eÂ\95\v " "\ 2\vÂ\9c\16Ã\8e\vÂ\96" 22 "\ 2\16·\13\16Â\89\13\16¶\13Â\88" "\ 2\16ï\13\16Â\90" 22 "\ 2\1e\16ç\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\vÂ\8a" "\ 2\vÂ\94\16¬\13Â\85\ e\ f\13Â\9f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\13Â\90" 22 22 19 "\ 2\13Â\83\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\13¿\ e\ f\ e\ f\13 \ e\ f\13\13" 19 19 "\ 2\16°\13Â\95\16\16\13Â\86\1eÂ\83\16Â\8a\1e¦" 30 "\ 2\ 1¯\1e\ 2¯\1e\ 1\ 2\ 1Â\83\ 2\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1Â\84\ 2\ 1\ 2\ 2\ 1\ 2Â\86\ 4\ 4\ 1\ 1" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 2\16Â\86\ 1\ 2\ 1\ 2\ 6Â\83\ 1\ 2\1eÂ\85\12Â\84\v\12\12" "\ 2\ 2¦\1e\ 2\1eÂ\85\ 2\1e\1e\ 5¸\1eÂ\87\ 4\12\1eÂ\8e\ 6" "\ 2\ 5Â\97\1eÂ\89\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 5Â\87\1e\ 6 " "\ 2\12\12\10\11\10\11\12Â\83\10\11\12\10\11\12Â\89\r\12\12\r\12\10\11\12\12\10\11\ e\ f\ e\ f\ e\ f\ e\ f\12Â\85\ 4\12Â\8a\r\r\1eÃ\84" "\ 2\16\9a\1e\16Ù\1e\8c" 22 "\ 2\16Ö\1e\9a\16\8c\1e\84"] #^^[2 12288 "\ 2\17\12\83\16\ 4\ 5
 \ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\16\16\ e\ f\ e\ f\ e\ f\ e\ f\r\ e\ f\ f\16
\89\ 6Â\86\r\ 4\85\16\16
\83\ 4\ 5\12\16\16\1e\ 5¿" "\ 2\ 5Â\97\1e\1e\ 6\ 6\15\15\ 4\ 4\ 5\r\ 5Ã\9a\12\ 4Â\83\ 5" "\ 2\1eÂ\85\ 5©\1eÂ\83\ 5Ã\8f" "\ 2\ 5Â\8f\1e\16\16\vÂ\84\16Â\8a\ 5Â\9b\1eÂ\85\16¤\1eÂ\8c\ 5Â\90" "\ 2\16Â\9f\1e\vÂ\8a\16§\v\8f\16 " "\ 2\v\8a\16§\v\8f\16¿\1e" 22 22 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5] #^^[2 16384 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 "\ 2\ 5\1e\8a\16À" 5 5 5 5] 5 5 5 5 #^^[2 36864 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 
-#^^[3 40832 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30]] #^^[2 40960 "\ 2\ 5\95\ 4\ 5ê" 5 5 5 5 5 5 5 5 "\ 2\ 5\8d\1e\83\16·\1e\89\ 5¨\ 4\86\12\12" 5 5 "\ 2\ 5\8c\ 4\12\83\ 5\90      \8a\ 5\ 5\1e\94\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 5\ 6\b\83\12\1e\88\ 6\ 6\12\ 4" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\1e\88\ 5Æ
-\8a\ 6\ 6\12\86\1e\88" "\ 2\15\97\ 4\89\15\15\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\83\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 4\ 2\88\ 1\ 2\ 1\ 2\ 1\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 4\15\15\ 1\ 2\ 1\ 2\1e\ 1\ 2\1e\8e\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\1eÐ\ 2\ 5\85" "\ 2\ 5\ 5\ 6\ 5\83\ 6\ 5\84\ 6\ 5\97\a\a\ 6\ 6\a\16\84\1e\84\v\86\16\16\14\16\1e\86\ 5´\12\84\1e\88" "\ 2\a\a\ 5²\a\90\ 6\1e\89\12\12    \8a\1e\86\ 6\92\ 5\86\12\83\ 5\1e\84" "\ 2  \8a\ 5\9c\ 6\88\12\12\ 5\97\ 6\8b\a\a\1e\8b\12\ 5\9d\1e\83" "\ 2\ 6\83\a\ 5¯\ 6\a\a\ 6\84\a\a\ 6\a\84\12\8d\1e\ 4        \8a\1e\84\12\12\1e " "\ 2\ 5©\ 6\86\a\a\ 6\ 6\a\a\ 6\ 6\1e\89\ 5\83\ 6\ 5\88\ 6\a\1e\1e      \8a\1e\1e\12\84\ 5\90\ 4\ 5\86\16\83\ 5\a\1e\84" "\ 2\ 5°\ 6\ 5\ 6\83\ 5\ 5\ 6\ 6\ 5\85\ 6\ 6\ 5\ 6\ 5\1e\98\ 5\ 5\ 4\12\12\1e " "\ 2\1e\ 5\86\1e\1e\ 5\86\1e\1e\ 5\86\1e\89\ 5\87\1e\ 5\87\1eÑ" "\ 2\1eÀ\ 5£\a\a\ 6\a\a\ 6\a\a\12\a\ 6\1e\1e \8a\1e\86" 5 5 5 5 5 5 5 5] 5 5 #^^[2 53248 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 "\ 2\ 5¤\1e\8c\ 5\97\1e\84\ 5±\1e\84" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 29 #^^[2 61440 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 5 5 "\ 2\ 5®\1e\1e\ 5¾\1e\1e\ 5\90" "\ 2\ 5Ú\1e¦" "\ 2\ 2\87\1e\8c\ 2\85\1e\85\ 5\ 6\ 5\8a\13\ 5\8d\1e\ 5\85\1e\ 5\1e\ 5\ 5\1e\ 5\ 5\1e\ 5º" "\ 2\ 5²\15\90\1e\91\ 5­" 5 5 "\ 2\ 5¾\ e\ f\1e\90\ 5°" "\ 2\ 5\90\1e\1e\ 5\1e¨\ 5\8c\14\16\1e\1e" "\ 2\ 6\90\12\87\ e\ f\12\1e\86\ 6\87\1e\89\12\r\r\f\f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\12\12\ e\ f\12\84\f\83\12\83\1e\12\84\r\ e\ f\ e\ f\ e\ f\12\83\13\r\13\83\1e\12\14\12\12\1e\84\ 5\85\1e\ 5\8a" "\ 2\ 5ý\1e\1e\e" "\ 2\1e\12\83\14\12\83\ e\ f\12\13\12\r\12\12       \8a\12\12\13\83\12\12\ 1\9a\ e\12\ f\15\f\15\ 2\9a\ e\13\ f\13\ e\ f\12\ e\ f\12\12\ 5\8a\ 4\ 5\8f" "\ 2\ 5\9e\ 4\ 4\ 5\9f\1e\83\ 5\86\1e\1e\ 5\86\1e\1e\ 5\86\1e\1e\ 5\83\1e\83\14\14\13\15\16\14\14\1e\16\13\84\16\16\1e\8a\e\83\16\16\1e\1e"]] #^^[1 65536 #^^[2 65536 "\ 2\ 5\8c\1e\ 5\9a\1e\ 5\93\1e\ 5\ 5\1e\ 5\8f\1e\1e\ 5\8e\1e¢" "\ 2\ 5û\1e\85" "\ 2\12\12\16\1e\84\v­\1e\83\16\89
\89\ 6Â\84\a\a\r\ 4\85\16\16
\83\ 4\ 5\12\16\16\1e\ 5¿" "\ 2\ 5Â\97\1e\1e\ 6\ 6\15\15\ 4\ 4\ 5\r\ 5Ã\9a\12\ 4Â\83\ 5" "\ 2\1eÂ\85\ 5©\1eÂ\83\ 5Ã\8f" "\ 2\ 5Â\8f\1e\16\16\vÂ\84\16Â\8a\ 5Â\9b\1eÂ\85\16¤\1eÂ\8c\ 5Â\90" "\ 2\16Â\9f\1e\vÂ\8a\16Â\9e\vÂ\88\16\v\8f\16 " "\ 2\v\8a\16§\v\8f\16¿\1e" 22 22 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5] #^^[2 16384 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 "\ 2\ 5\1e\8a\16À" 5 5 5 5] 5 5 5 5 #^^[2 36864 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 
+#^^[3 40832 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30]] #^^[2 40960 "\ 2\ 5\95\ 4\ 5ê" 5 5 5 5 5 5 5 5 "\ 2\ 5\8d\1e\83\16·\1e\89\ 5¨\ 4\86\12\12" 5 5 "\ 2\ 5\8c\ 4\12\83\ 5\90       \8a\ 5\ 5\1e\94\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 5\ 6\b\83\12\ 6\8a\12\ 4" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\1e\87\ 6\ 5Æ
+\8a\ 6\ 6\12\86\1e\88" "\ 2\15\97\ 4\89\15\15\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\83\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 4\ 2\88\ 1\ 2\ 1\ 2\ 1\ 1\ 2" "\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 4\15\15\ 1\ 2\ 1\ 2\1e\ 1\ 2\ 1\ 2\1e\8c\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\ 2\ 1\1eÍ\ 4\ 4\ 2\ 5\85" "\ 2\ 5\ 5\ 6\ 5\83\ 6\ 5\84\ 6\ 5\97\a\a\ 6\ 6\a\16\84\1e\84\v\86\16\16\14\16\1e\86\ 5´\12\84\1e\88" "\ 2\a\a\ 5²\a\90\ 6\1e\89\12\12       \8a\1e\86\ 6\92\ 5\86\12\83\ 5\1e\84" "\ 2  \8a\ 5\9c\ 6\88\12\12\ 5\97\ 6\8b\a\a\1e\8b\12\ 5\9d\1e\83" "\ 2\ 6\83\a\ 5¯\ 6\a\a\ 6\84\a\a\ 6\a\84\12\8d\1e\ 4        \8a\1e\84\12\12\1e " "\ 2\ 5©\ 6\86\a\a\ 6\ 6\a\a\ 6\ 6\1e\89\ 5\83\ 6\ 5\88\ 6\a\1e\1e      \8a\1e\1e\12\84\ 5\90\ 4\ 5\86\16\83\ 5\a\1e\84" "\ 2\ 5°\ 6\ 5\ 6\83\ 5\ 5\ 6\ 6\ 5\85\ 6\ 6\ 5\ 6\ 5\1e\98\ 5\ 5\ 4\12\12\ 5\8b\a\ 6\ 6\a\a\12\12\ 5\ 4\ 4\a\ 6\1e\89" "\ 2\1e\ 5\86\1e\1e\ 5\86\1e\1e\ 5\86\1e\89\ 5\87\1e\ 5\87\1eÑ" "\ 2\1eÀ\ 5£\a\a\ 6\a\a\ 6\a\a\12\a\ 6\1e\1e  \8a\1e\86" 5 5 5 5 5 5 5 5] 5 5 #^^[2 53248 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 "\ 2\ 5¤\1e\8c\ 5\97\1e\84\ 5±\1e\84" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 29 #^^[2 61440 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 5 5 "\ 2\ 5î\1e\1e\ 5\90" "\ 2\ 5Ú\1e¦" "\ 2\ 2\87\1e\8c\ 2\85\1e\85\ 5\ 6\ 5\8a\13\ 5\8d\1e\ 5\85\1e\ 5\1e\ 5\ 5\1e\ 5\ 5\1e\ 5º" "\ 2\ 5²\15\90\1e\91\ 5­" 5 5 "\ 2\ 5¾\ e\ f\1e\90\ 5°" "\ 2\ 5\90\1e\1e\ 5\1e¨\ 5\8c\14\16\1e\1e" "\ 2\ 6\90\12\87\ e\ f\12\1e\86\ 6\87\1e\89\12\r\r\f\f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\ e\ f\12\12\ e\ f\12\84\f\83\12\83\1e\12\84\r\ e\ f\ e\ f\ e\ f\12\83\13\r\13\83\1e\12\14\12\12\1e\84\ 5\85\1e\ 5\8a" "\ 2\ 5ý\1e\1e\e" "\ 2\1e\12\83\14\12\83\ e\ f\12\13\12\r\12\12    \8a\12\12\13\83\12\12\ 1\9a\ e\12\ f\15\f\15\ 2\9a\ e\13\ f\13\ e\ f\12\ e\ f\12\12\ 5\8a\ 4\ 5\8f" "\ 2\ 5\9e\ 4\ 4\ 5\9f\1e\83\ 5\86\1e\1e\ 5\86\1e\1e\ 5\86\1e\1e\ 5\83\1e\83\14\14\13\15\16\14\14\1e\16\13\84\16\16\1e\8a\e\83\16\16\1e\1e"]] #^^[1 65536 #^^[2 65536 "\ 2\ 5\8c\1e\ 5\9a\1e\ 5\93\1e\ 5\ 5\1e\ 5\8f\1e\1e\ 5\8e\1e¢" "\ 2\ 5û\1e\85" "\ 2\12\83\1e\84\v­\1e\83\16\89
 µ\v\84\16\87" "\ 2\16\8a\v\1e\85\16\8c\1e´\16­\ 6\1e\1e" 30 "\ 2\ 5\9d\1e\83\ 5±\1e¯" "\ 2\ 5\9f\1e\v\84\1e\8c\ 5\91
 \ 5\88
 \1eµ" "\ 2\ 5\9e\1e\12\ 5¤\1e\84\ 5\88\12
-\85\1eª" "\ 2\ 1¨\ 2¨\ 5°" "\ 2\ 5\9e\1e\1e    \8a\1eÖ" 30 30 30 30 30 30 "\ 2\ 5\86\1e\1e\ 5\1e\ 5¬\1e\ 5\ 5\1e\83\ 5\1e\1e\ 5\97\1e\12\v\88\1e " 30 "\ 2\ 5\96\v\86\1e\83\12\ 5\9a\1e\85\12\1eÀ" 30 "\ 2\ 5\ 6\83\1e\ 6\ 6\1e\85\ 6\84\ 5\84\1e\ 5\83\1e\ 5\9b\1e\84\ 6\83\1e\84\ 6\v\88\1e\88\12\89\1e\87\ 5\9d\v\v\12" 30 "\ 2\ 5\1e\83\12\87\ 5\96\1e\1e\v\88\ 5\93\1e\85\v\88" 30 "\ 2\ 5É\1e·" 30 30 30 "\ 2\1eà\v\9f\1e" 30 30 30] #^^[2 69632 "\ 2\a\ 6\a\ 5µ\ 6\8f\12\87\1e\84\v\94   \8a\1e\90" "\ 2\ 6\ 6\a\ 5­\a\83\ 6\84\a\a\ 6\ 6\12\12\e\12\84\1e¾" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] #^^[2 73728 5 5 5 5 5 5 "\ 2\ 5ï\1e\91" 30 "\ 2
\1e\8d\12\84\1e\8c" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] #^^[2 77824 5 5 5 5 5 5 5 5 "\ 2\ 5¯\1eÑ" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 30 #^^[2 90112 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 5 5 5 5 "\ 2\ 5¹\1eÇ" 30 30 30 30 30 30 30 30 30 30 30] 30 30 30 30 #^^[2 110592 "\ 2\ 5\ 5\1eþ" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 #^^[2 118784 22 "\ 2\16ö\1e\8a" "\ 2\16§\1e\1e\16¼\a\a\ 6\83\16\83\a\86\e\88\ 6\85" "\ 2\ 6\83\16\16\ 6\87\16\9e\ 6\84\16°\1e¢" "\ 2\16Â\ 6\83\16\1eº" 30 "\ 2\16×\1e\89\v\92\1e\8e" 30 "\ 2\ 1\9a\ 2\9a\ 1\9a\ 2\87\1e\ 2\92\ 1\98" "\ 2\ 1\ 1\ 2\9a\ 1\1e\ 1\ 1\1e\1e\ 1\1e\1e\ 1\ 1\1e\1e\ 1\84\1e\ 1\88\ 2\84\1e\ 2\1e\ 2\87\1e\ 2\8b\ 1\9a\ 2\96" "\ 2\ 2\84\ 1\ 1\1e\ 1\84\1e\1e\ 1\88\1e\ 1\87\1e\ 2\9a\ 1\ 1\1e\ 1\84\1e\ 1\85\1e\ 1\1e\83\ 1\87\1e\ 2\9a\ 1\94" "\ 2\ 1\86\ 2\9a\ 1\9a\ 2\9a\ 1\9a\ 2\92" "\ 2\ 2\88\ 1\9a\ 2\9a\ 1\9a\ 2\9a\ 1\90" "\ 2\ 1\8a\ 2\9c\1e\1e\ 1\99\13\ 2\99\13\ 2\86\ 1\99\13\ 2\84" "\ 2\ 2\95\13\ 2\86\ 1\99\13\ 2\99\13\ 2\86\ 1\99\13\ 2\90" "\ 2\ 2\89\13\ 2\86\ 1\99\13\ 2\99\13\ 2\86\ 1\ 2\1e\1e   ²" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 #^^[2 126976 "\ 2\16¬\1e\84\16Ð" "\ 2\16\94\1e\8c\16\8f\1e\1e\16\8e\1e\1e\16\8f\1e\16\8f\1e " "\ 2\v\8b\1e\85\16\9f\1e\16º\1e\86\16\90" "\ 2\16\9b\1eË\16\9a" "\ 2\16\83\1e\8d\16«\1e\85\16\89\1e\87\16\16\1e®" 30 "\ 2\16¡\1e\8f\16\86\1e\16Æ\1e\83" "\ 2\16\94\1e\8c\16¥\1e\16\85\1e\95\16\91\1e\8f" "\ 2\16¿\1e\16\1e\16¾" "\ 2\16ø\1e\16\84\1e\83" "\ 2\16¾\1e\92\16\98\1e\98" "\ 2\1eû\16\85" "\ 2\1e\16\90\1e\16\83\1e\16\1e\16\1e\16\1e\16\83\1e\16\86\1e\1e\16\84\1e\16\1e\1e\16\84\1e\16\8c\1e\84\16\8b\1e°" "\ 2\16Æ\1eº" "\ 2\16ô\1e\8c" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30]] #^^[1 131072 5 5 5 5 5 5 5 5 5 5 #^^[2 172032 5 5 5 5 5 5 5 5 5 5 5 5 5 
+\85\1eª" "\ 2\ 1¨\ 2¨\ 5°" "\ 2\ 5\9e\1e\1e    \8a\1eÖ" 30 30 30 30 30 30 "\ 2\ 5\86\1e\1e\ 5\1e\ 5¬\1e\ 5\ 5\1e\83\ 5\1e\1e\ 5\97\1e\12\v\88\1e " 30 "\ 2\ 5\96\v\86\1e\83\12\ 5\9a\1e\85\12\1eÀ" "\ 2\ 5¸\1e\86\ 5\ 5\1eÀ" "\ 2\ 5\ 6\83\1e\ 6\ 6\1e\85\ 6\84\ 5\84\1e\ 5\83\1e\ 5\9b\1e\84\ 6\83\1e\84\ 6\v\88\1e\88\12\89\1e\87\ 5\9d\v\v\12" 30 "\ 2\ 5\1e\83\12\87\ 5\96\1e\1e\v\88\ 5\93\1e\85\v\88" 30 "\ 2\ 5É\1e·" 30 30 30 "\ 2\1eà\v\9f\1e" 30 30 30] #^^[2 69632 "\ 2\a\ 6\a\ 5µ\ 6\8f\12\87\1e\84\v\94       \8a\1e\90" "\ 2\ 6\ 6\a\ 5­\a\83\ 6\84\a\a\ 6\ 6\12\12\e\12\84\1e\8e\ 5\99\1e\87        \8a\1e\86" "\ 2\ 6\83\ 5¤\ 6\85\a\ 6\88\1e \8a\12\84\1e¼" "\ 2\ 6\ 6\a\ 5°\a\83\ 6\89\a\a\ 5\84\12\84\1e\87     \8a\1e¦" 30 30 30 30 30 30 30 30 30 "\ 2\ 5«\ 6\a\ 6\a\a\ 6\86\a\ 6\1e\88    \8a\1e¶" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] #^^[2 73728 5 5 5 5 5 5 "\ 2\ 5ï\1e\91" 30 "\ 2
\1e\8d\12\84\1e\8c" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] #^^[2 77824 5 5 5 5 5 5 5 5 "\ 2\ 5¯\1eÑ" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 30 #^^[2 90112 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 5 5 5 5 "\ 2\ 5¹\1eÇ" 30 30 30 30 30 30 30 30 30 "\ 2\ 5Å\1e\8b\ 5\a®\1e" "\ 2\1e\8f\ 6\84\ 4\8d\1eà"] 30 30 30 30 #^^[2 110592 "\ 2\ 5\ 5\1eþ" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 #^^[2 118784 22 "\ 2\16ö\1e\8a" "\ 2\16§\1e\1e\16¼\a\a\ 6\83\16\83\a\86\e\88\ 6\85" "\ 2\ 6\83\16\16\ 6\87\16\9e\ 6\84\16°\1e¢" "\ 2\16Â\ 6\83\16\1eº" 30 "\ 2\16×\1e\89\v\92\1e\8e" 30 "\ 2\ 1\9a\ 2\9a\ 1\9a\ 2\87\1e\ 2\92\ 1\98" "\ 2\ 1\ 1\ 2\9a\ 1\1e\ 1\ 1\1e\1e\ 1\1e\1e\ 1\ 1\1e\1e\ 1\84\1e\ 1\88\ 2\84\1e\ 2\1e\ 2\87\1e\ 2\8b\ 1\9a\ 2\96" "\ 2\ 2\84\ 1\ 1\1e\ 1\84\1e\1e\ 1\88\1e\ 1\87\1e\ 2\9a\ 1\ 1\1e\ 1\84\1e\ 1\85\1e\ 1\1e\83\ 1\87\1e\ 2\9a\ 1\94" "\ 2\ 1\86\ 2\9a\ 1\9a\ 2\9a\ 1\9a\ 2\92" "\ 2\ 2\88\ 1\9a\ 2\9a\ 1\9a\ 2\9a\ 1\90" "\ 2\ 1\8a\ 2\9c\1e\1e\ 1\99\13\ 2\99\13\ 2\86\ 1\99\13\ 2\84" "\ 2\ 2\95\13\ 2\86\ 1\99\13\ 2\99\13\ 2\86\ 1\99\13\ 2\90" "\ 2\ 2\89\13\ 2\86\ 1\99\13\ 2\99\13\ 2\86\ 1\ 2\1e\1e  ²" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] #^^[2 122880 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 "\ 2\ 5\84\1e\ 5\9b\1e\ 5\ 5\1e\ 5\1e\1e\ 5\1e\ 5\8a\1e\ 5\84\1e\ 5\1e\ 5\1e\86\ 5\1e\84\ 5\1e\ 5\1e\ 5\1e\ 5\83\1e\ 5\ 5\1e\ 5\1e\1e\ 5\1e\ 5\1e\ 5\1e\ 5\1e\ 5\1e\ 5\ 5\1e\ 5\1e\1e\ 5\84\1e\ 5\87\1e\ 5\84\1e\ 5\84\1e\ 5\1e" "\ 2\ 5\8a\1e\ 5\91\1e\85\ 5\83\1e\ 5\85\1e\ 5\91\1e´\13\13\1e\8e" 30 30] #^^[2 126976 "\ 2\16¬\1e\84\16Ð" "\ 2\16\94\1e\8c\16\8f\1e\1e\16\8e\1e\1e\16\8f\1e\16\8f\1e " "\ 2\v\8b\1e\85\16\9f\1e\16¼\1e\84\16\90" "\ 2\16\9b\1eË\16\9a" "\ 2\16\83\1e\8d\16«\1e\85\16\89\1e\87\16\16\1e®" 30 "\ 2\16¡\1e\8f\16\86\1e\16Æ\1e\83" "\ 2\16\94\1e\8c\16¥\1e\16\85\1e\95\16\91\1e\8f" "\ 2\16¿\1e\16\1e\16¾" "\ 2\16ø\1e\16\84\1e\83" "\ 2\16¾\1e\1e\16\84\1e\8c\16\98\1e\98" "\ 2\1eû\16\85" "\ 2\16Á\1e\84\16\8b\1e°" "\ 2\16Æ\1eº" "\ 2\16ô\1e\8c" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30]] #^^[1 131072 5 5 5 5 5 5 5 5 5 5 #^^[2 172032 5 5 5 5 5 5 5 5 5 5 5 5 5 
 #^^[3 173696 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5] #^^[2 176128 5 5 5 5 5 5 5 5 5 5 5 5 5 5 
 #^^[3 177920 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 30 30 30 30 30 30 30 30 30 30 30 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5] 5 
 #^^[3 178176 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 30 30 #^^[2 192512 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 5 5 5 5 "\ 2\ 5\9e\1eâ" 30 30 30 30 30 30 30 30 30 30 30]] 30 30 30 30 30 30 30 30 30 30 30 #^^[1 917504 #^^[2 917504 "\ 2\1e\e\1e\9e\eà" 30 6 "\ 2\ 6ð\1e\90" 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30] #^^[1 983040 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 #^^[2 1044480 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 
index 1437ff9acbd88a1036df3dc0de61b0f21a503785..3863f95f8812ff13d952f3e335bd2ae98a9c65d8 100644 (file)
@@ -6,9 +6,9 @@
 
        
 
-       \ 2\8d\ 1\90" 1 1 "\ 2\ 1\83\ 2\85\ 1ø" 1 "\ 2\ 1\91\ 4\ 2\84\ 4\ 2\83\v\ 4\ 2\86\ 4\86\ 2\ 2\ 4\ 2\ 2\v\f\ 2\r\ e\ f\10\11\12\13\14\15\16\16\17\18\19\ 1\1a\ 1\e\1c\ 1\ 2\ 4\ 1\15\ 1¸" "\ 2\ 1\90\ 2\88\1d\1e\1f\ 1° !\"\1d\1e\1f#$\ 2\ 2\ 4\ 4\ 2\85\ 4\ 2\ 2\ 4\ 1\90%\ 1\8f" "\ 2\ 1Ö\ 2\87\ 1\ 1\ 2\84\ 4\ 2\ 1\ 1\ 2\ 2\ 1\ 4\ 2\ 2\ 4\ 1\92" "\ 2\ 1\91&\ 1\9e\ 2\ 4\ 2\ 2\ 4\ 2\ 2\ 4\83\ 2\ 4\ 4\ 2\ 4\ 2\83\ 4\ 2\ 4\ 2\ 4\ 2\ 4\ 2\ 2\ 1µ" "\ 2\ 1ë\ 2\87\ 4\ 2\ 1\8c" "\ 2\ 1\96\ 2\84\ 1\ 2\89\ 1\ 2\83\ 1\ 2\85\ 1«\ 4\83\ 1¤" 1 "\ 2\ 1¼'\ 1\90(\ 1\83\ 2\ 4\ 2\ 2\ 1«" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1Í(\ 1²" "\ 2\ 1Í(\ 1\87)*\ 1©" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1Í(\ 1²" "\ 2\ 1Ê(\ 1µ" "\ 2\ 1¸++(\ 1\8d,\84\ 1´" "\ 2\ 1¸--\ 1\8e.\84\ 1´" "\ 2\ 1\98\ 4\ 4\ 1\9b\ 4\ 1\ 4\ 1\ 5\ 1·/0\ 11\ 1\850\84\ 1\ 1" "\ 20\ 1\ 2\ 2(\ 1\ 2\ 2\ 1¾\ 4\ 1¹"] #^^[2 4096 "\ 2\ 1·'\ 1((\ 1Å" "\ 2\ 1\8d\ 4\ 1ò" 1 1 1 1 "\ 2\ 1Ý\ 2\83\ 1 " 1 1 1 1 1 1 1 "\ 2\ 1\94(\ 1\9f(\ 1Ë" "\ 2\ 1Ò(\ 1\8a\ 2\ 1¢" 1 "\ 2\ 1©\f\ 1Ö" "\ 2\ 1¹\v\ 2\ 4\ 1Ä" 1 "\ 2\ 1\97\ 2\ 4\ 1Ç(\ 1\94\ 2\88\ 1\ 1\ 4" 1 "\ 2\ 1´'\ 1\8f(\ 1¦\ 2\ 4\ 2\87\ 1\8c" "\ 2\ 1ª(\ 1»'\ 1\8b((\ 1\8c" "\ 2\ 1·'\ 1È" "\ 2\ 1Ð\ 2\83\ 1\a\ 4\85\ 2\ 2\ 4\84\ 2\ 1\a\87\ 1\84\ 4\ 1\92" 1 "\ 2\ 1À\ 2\ 2\ 4\ 2\87\ 4\ 2\ 2
+       \ 2\8d\ 1\90" 1 1 "\ 2\ 1\83\ 2\85\ 1ø" 1 "\ 2\ 1\91\ 4\ 2\84\ 4\ 2\83\v\ 4\ 2\86\ 4\86\ 2\ 2\ 4\ 2\ 2\v\f\ 2\r\ e\ f\10\11\12\13\14\15\16\16\17\18\19\ 1\1a\ 1\e\1c\ 1\ 2\ 4\ 1\15\ 1¸" "\ 2\ 1\90\ 2\88\1d\1e\1f\ 1° !\"\1d\1e\1f#$\ 2\ 2\ 4\ 4\ 2\85\ 4\ 2\ 2\ 4\ 1\90%\ 1\8f" "\ 2\ 1Ö\ 2\87\ 1\ 1\ 2\84\ 4\ 2\ 1\ 1\ 2\ 2\ 1\ 4\ 2\ 2\ 4\ 1\92" "\ 2\ 1\91&\ 1\9e\ 2\ 4\ 2\ 2\ 4\ 2\ 2\ 4\83\ 2\ 4\ 4\ 2\ 4\ 2\83\ 4\ 2\ 4\ 2\ 4\ 2\ 4\ 2\ 2\ 1µ" "\ 2\ 1ë\ 2\87\ 4\ 2\ 1\8c" "\ 2\ 1\96\ 2\84\ 1\ 2\89\ 1\ 2\83\ 1\ 2\85\ 1«\ 4\83\ 1¤" "\ 2\ 1ä\ 2\ 2\ 4\ 2\ 2\ 4\ 2\83\ 4\83 !\"\ 2\83\ 4\ 2\ 2\ 4\ 4\ 2\84\ 1" "\ 2\ 1¼'\ 1\90(\ 1\83\ 2\ 4\ 2\ 2\ 1«" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1Í(\ 1²" "\ 2\ 1Í(\ 1\87)*\ 1©" "\ 2\ 1¼'\ 1\90(\ 1²" "\ 2\ 1Í(\ 1²" "\ 2\ 1Ê(\ 1µ" "\ 2\ 1¸++(\ 1\8d,\84\ 1´" "\ 2\ 1¸--\ 1\8e.\84\ 1´" "\ 2\ 1\98\ 4\ 4\ 1\9b\ 4\ 1\ 4\ 1\ 5\ 1·/0\ 11\ 1\850\84\ 1\ 1" "\ 20\ 1\ 2\ 2(\ 1\ 2\ 2\ 1¾\ 4\ 1¹"] #^^[2 4096 "\ 2\ 1·'\ 1((\ 1Å" "\ 2\ 1\8d\ 4\ 1ò" 1 1 1 1 "\ 2\ 1Ý\ 2\83\ 1 " 1 1 1 1 1 1 1 "\ 2\ 1\94(\ 1\9f(\ 1Ë" "\ 2\ 1Ò(\ 1\8a\ 2\ 1¢" 1 "\ 2\ 1©\f\ 1Ö" "\ 2\ 1¹\v\ 2\ 4\ 1Ä" 1 "\ 2\ 1\97\ 2\ 4\ 1Ç(\ 1\94\ 2\88\ 1\ 1\ 4" 1 "\ 2\ 1´'\ 1\8f(\ 1¦\ 2\ 4\ 2\87\ 1\8c" "\ 2\ 1ª((\ 1º'\ 1\8b((\ 1\8c" "\ 2\ 1·'\ 1È" "\ 2\ 1Ð\ 2\83\ 1\a\ 4\85\ 2\ 2\ 4\84\ 2\ 1\a\87\ 1\84\ 4\ 1\86\ 2\ 1\8b" 1 "\ 2\ 1À\ 2\ 2\ 4\ 2\87\ 4\ 2\ 2
 2\ 4\ 6\ 2\96\ 1\95      \ 4\ 2\ 4" 1 1 1 1] #^^[2 8192 1 "\ 2\ 1Ð\ 2\ 2\a\a\ 2\84\a\83\ 2\ 2\ 1\84\ 2\ 1\83\a\a\ 2\ 4\ 2\a\a\ 4\84\ 2\ 1\8f" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "\ 2\ 1ï\ 2\83\ 1\8e" "\ 2\ 1ÿ(" "\ 2\ 1à\ 2 " 1 1 1 1] #^^[2 12288 "\ 2\ 1ª3\f\ 3\v44\ 1Ð" "\ 2\ 1\9955\ 1å" 1 1 1 1 1 1 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 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 
-#^^[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 "\ 2\ 1ï\ 2\ 1Â\8c\ 2\ 2\ 1\ 1" "\ 2\ 1ð\ 2\ 2\ 1Â\8e" 1 1 "\ 2\ 1Â\86(\ 1ù" "\ 2\ 1Ã\84(\ 1Â\9b\ 2Â\92\ 1Â\8e" "\ 2\ 1«\ 4Â\83\ 1Â¥(\ 1¬" "\ 2\ 1³'\ 1Â\8c(\ 1¿" 1 "\ 2\ 1°\ 2\ 1\ 2\ 2\ 4\ 1\ 1\ 2\ 2\ 1Â\85\ 2\ 2\ 1\ 2\ 1¾" 1 "\ 2\ 1í(\ 1Â\92" 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 "\ 2\ 1Â\9e6\ 1á" 1 1 1 1 1 "\ 2\ 1 \ 2Â\87\ 1Ã\99" 1 1 1]] #^^[1 65536 #^^[2 65536 1 1 1 "\ 2\ 1ý\ 4\ 1\ 1" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "\ 2\ 1Â\8d\ 4\ 1\ 2\ 1¨\ 2\a\ 4\ 1Â\84(\ 1Ã\80" 1 1 1 1 1 1 1 1 1 1 1] #^^[2 69632 "\ 2\ 1Ã\86(\ 1¹" "\ 2\ 1¹('\ 1Ã\85" 1 1 1 1 1 1 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 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 "\ 2\ 1Ã¥\ 5\ 5\aÂ\83\ 1Â\837\ 5Â\85\ 1Â\88\ 4Â\85" "\ 2\ 4Â\83\ 1\ 1\ 2Â\85\ 4\ 4\ 1Â\9e\ 2Â\84\ 1Ã\92" "\ 2\ 1Ã\82\ 2Â\83\ 1»" 1 1 1 1 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 126976 1 1 1 1 1 1 1 1 1 1 1 1 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 
+#^^[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 "\ 2\ 1ï\ 2\ 1Â\84\ 2Â\8a\ 1\ 1" "\ 2\ 1Â\9f\ 2\ 1Ã\90\ 2\ 2\ 1Â\8e" 1 1 "\ 2\ 1Â\86(\ 1ù" "\ 2\ 1Ã\84(\ 1Â\9b\ 2Â\92\ 1Â\8e" "\ 2\ 1«\ 4Â\83\ 1Â¥(\ 1¬" "\ 2\ 1³'\ 1Â\8c(\ 1¿" 1 "\ 2\ 1°\ 2\ 1\ 2\ 2\ 4\ 1\ 1\ 2\ 2\ 1Â\85\ 2\ 2\ 1\ 2\ 1´(\ 1Â\89" 1 "\ 2\ 1í(\ 1Â\92" 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 "\ 2\ 1Â\9e6\ 1á" 1 1 1 1 1 "\ 2\ 1 \ 2Â\87\ 1Ã\99" 1 1 1]] #^^[1 65536 #^^[2 65536 1 1 1 "\ 2\ 1ý\ 4\ 1\ 1" 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 "\ 2\ 1Â\8d\ 4\ 1\ 2\ 1¨\ 2\a\ 4\ 1Â\84(\ 1Ã\80" 1 1 1 1 1 1 1 1 1 1 1] #^^[2 69632 "\ 2\ 1Ã\86(\ 1¹" "\ 2\ 1¹('\ 1Ã\85" "\ 2\ 2Â\83\ 1°((\ 1Ã\8b" "\ 2\ 1Ã\80(\ 1¿" 1 1 1 1 1 1 1 1 1 "\ 2\ 1¶('\ 1Ã\88" 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 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 "\ 2\ 1Ã¥\ 5\ 5\aÂ\83\ 1Â\837\ 5Â\85\ 1Â\88\ 4Â\85" "\ 2\ 4Â\83\ 1\ 1\ 2Â\85\ 4\ 4\ 1Â\9e\ 2Â\84\ 1Ã\92" "\ 2\ 1Ã\82\ 2Â\83\ 1»" 1 1 1 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[2 126976 1 1 1 1 1 1 1 1 1 1 1 1 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 
 #^^[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 
 #^^[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 
 #^^[3 178176 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 192512 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1]] 1 1 1 1 1 1 1 1 1 1 1 #^^[1 917504 #^^[2 917504 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1] #^^[1 983040 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 #^^[2 1044480 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
index 096257add209bbb8d16621e3f7451b12fb2865d7..1866e7c4354b26ccc45d8beeb3674cd806f67a57 100644 (file)
Binary files a/lisp/international/uni-decimal.el and b/lisp/international/uni-decimal.el differ
index b9660cdab0aa2724492461cbf7414e9e80e5d24f..2bcca9e60fbc02a70ccf0440caf13c590ba19f5d 100644 (file)
Binary files a/lisp/international/uni-decomposition.el and b/lisp/international/uni-decomposition.el differ
index efb78b0e43dd04993b15f2adfb604bf732ca2249..405d59784a779b9a0ee1eafe3848aac3e3fde0f4 100644 (file)
Binary files a/lisp/international/uni-digit.el and b/lisp/international/uni-digit.el differ
index 7afd9503cb3e84cab181fbb14bcb908460f46049..811964991506e75ebc63bef038cd0ae4ec325c2c 100644 (file)
Binary files a/lisp/international/uni-lowercase.el and b/lisp/international/uni-lowercase.el differ
index e650166c24c23f60a327a9d0462d5b44a9a56fd0..c34184c0d6b2eaedb49e1110c24f938cf3c163ca 100644 (file)
Binary files a/lisp/international/uni-mirrored.el and b/lisp/international/uni-mirrored.el differ
index c3e5f2e5907209828794f13b0b5b04c7b96c6a66..458957ef36684fe23409d12f6745b1346ac4b8de 100644 (file)
Binary files a/lisp/international/uni-name.el and b/lisp/international/uni-name.el differ
index a1865f1fb233ddfcf21848c56a60edfb5cb6d8a2..9f0d30792590cbfe8d23f5dcb04bcaedbd514fa1 100644 (file)
Binary files a/lisp/international/uni-numeric.el and b/lisp/international/uni-numeric.el differ
index 517edb20445e18a87ab8186e98a7e932295f9b41..e3454a4dd3d4f2fcfbb0a0b93c7f85fe3f9e1f81 100644 (file)
Binary files a/lisp/international/uni-titlecase.el and b/lisp/international/uni-titlecase.el differ
index fcb22d72470964a719b6039f6fdcf74931eec737..85112406d757b255b236d6e5b01eebf93f2dd9f7 100644 (file)
Binary files a/lisp/international/uni-uppercase.el and b/lisp/international/uni-uppercase.el differ
index 9d69443b6a433dce5e49081ea1543b07109fb79c..8fe2aba94995f57c8e5e42f07354aaa00e530601 100644 (file)
@@ -501,8 +501,10 @@ This is like `describe-bindings', but displays only Isearch keys."
     (define-key map "\M-r" 'isearch-toggle-regexp)
     (define-key map "\M-e" 'isearch-edit-string)
 
+    (define-key map "\M-sc" 'isearch-toggle-case-fold)
     (define-key map "\M-sr" 'isearch-toggle-regexp)
     (define-key map "\M-sw" 'isearch-toggle-word)
+    (define-key map "\M-s_" 'isearch-toggle-symbol)
 
     (define-key map [?\M-%] 'isearch-query-replace)
     (define-key map [?\C-\M-%] 'isearch-query-replace-regexp)
@@ -530,8 +532,13 @@ This is like `describe-bindings', but displays only Isearch keys."
 
 (defvar isearch-forward nil)   ; Searching in the forward direction.
 (defvar isearch-regexp nil)    ; Searching for a regexp.
-(defvar isearch-word nil)      ; Searching for words.
-(defvar isearch-hidden nil) ; Non-nil if the string exists but is invisible.
+(defvar isearch-word nil
+  "Regexp-based search mode for words/symbols.
+If t, do incremental search for a sequence of words, ignoring punctuation.
+If the value is a function (e.g. `isearch-symbol-regexp'), it is called to
+convert the search string to a regexp used by regexp search functions.
+The property `isearch-message-prefix' put on this function specifies the
+prefix string displayed in the search message.")
 
 (defvar isearch-cmds nil
   "Stack of search status sets.
@@ -592,6 +599,9 @@ Each set is a vector of the form:
 ;; Accumulate here the overlays opened during searching.
 (defvar isearch-opened-overlays nil)
 
+;; Non-nil if the string exists but is invisible.
+(defvar isearch-hidden nil)
+
 ;; The value of input-method-function when isearch is invoked.
 (defvar isearch-input-method-function nil)
 
@@ -614,6 +624,7 @@ Each set is a vector of the form:
 (define-key global-map "\C-r" 'isearch-backward)
 (define-key esc-map "\C-r" 'isearch-backward-regexp)
 (define-key search-map "w" 'isearch-forward-word)
+(define-key search-map "_" 'isearch-forward-symbol)
 
 ;; Entry points to isearch-mode.
 
@@ -653,6 +664,7 @@ If you try to exit with the search string still empty, it invokes
 Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity.
 Type \\[isearch-toggle-regexp] to toggle regular-expression mode.
 Type \\[isearch-toggle-word] to toggle word mode.
+Type \\[isearch-toggle-symbol] to toggle symbol mode.
 Type \\[isearch-edit-string] to edit the search string in the minibuffer.
 
 Also supported is a search ring of the previous 16 search strings.
@@ -720,6 +732,16 @@ See the command `isearch-forward' for more information."
   (interactive "P\np")
   (isearch-mode t nil nil (not no-recursive-edit) (null not-word)))
 
+(defun isearch-forward-symbol (&optional not-symbol no-recursive-edit)
+  "\
+Do incremental search forward for a symbol.
+The prefix argument is currently unused.
+Like ordinary incremental search except that your input is treated
+as a symbol surrounded by symbol boundary constructs \\_< and \\_>.
+See the command `isearch-forward' for more information."
+  (interactive "P\np")
+  (isearch-mode t nil nil (not no-recursive-edit) 'isearch-symbol-regexp))
+
 (defun isearch-backward (&optional regexp-p no-recursive-edit)
   "\
 Do incremental search backward.
@@ -747,14 +769,14 @@ as a regexp.  See the command `isearch-forward' for more information."
 ;;  "List of commands for which isearch-mode does not recursive-edit.")
 
 
-(defun isearch-mode (forward &optional regexp op-fun recursive-edit word-p)
+(defun isearch-mode (forward &optional regexp op-fun recursive-edit word)
   "Start Isearch minor mode.
 It is called by the function `isearch-forward' and other related functions."
 
   ;; Initialize global vars.
   (setq isearch-forward forward
        isearch-regexp regexp
-       isearch-word word-p
+       isearch-word word
        isearch-op-fun op-fun
        isearch-last-case-fold-search isearch-case-fold-search
        isearch-case-fold-search case-fold-search
@@ -1367,6 +1389,14 @@ Use `isearch-exit' to quit without signaling."
   (setq isearch-success t isearch-adjusted t)
   (isearch-update))
 
+(defun isearch-toggle-symbol ()
+  "Toggle symbol searching on or off."
+  (interactive)
+  (setq isearch-word (unless (eq isearch-word 'isearch-symbol-regexp)
+                      'isearch-symbol-regexp))
+  (setq isearch-success t isearch-adjusted t)
+  (isearch-update))
+
 (defun isearch-toggle-case-fold ()
   "Toggle case folding in searching on or off."
   (interactive)
@@ -1381,6 +1411,104 @@ Use `isearch-exit' to quit without signaling."
   (sit-for 1)
   (isearch-update))
 
+\f
+;; Word search
+
+(defun word-search-regexp (string &optional lax)
+  "Return a regexp which matches words, ignoring punctuation.
+Given STRING, a string of words separated by word delimiters,
+compute a regexp that matches those exact words separated by
+arbitrary punctuation.  If LAX is non-nil, the end of the string
+need not match a word boundary unless it ends in whitespace.
+
+Used in `word-search-forward', `word-search-backward',
+`word-search-forward-lax', `word-search-backward-lax'."
+  (if (string-match-p "^\\W*$" string)
+      ""
+    (concat
+     "\\b"
+     (mapconcat 'identity (split-string string "\\W+" t) "\\W+")
+     (if (or (not lax) (string-match-p "\\W$" string)) "\\b"))))
+
+(defun word-search-backward (string &optional bound noerror count)
+  "Search backward from point for STRING, ignoring differences in punctuation.
+Set point to the beginning of the occurrence found, and return point.
+An optional second argument bounds the search; it is a buffer position.
+The match found must not extend before that position.
+Optional third argument, if t, means if fail just return nil (no error).
+  If not nil and not t, move to limit of search and return nil.
+Optional fourth argument is repeat count--search for successive occurrences.
+
+Relies on the function `word-search-regexp' to convert a sequence
+of words in STRING to a regexp used to search words without regard
+to punctuation."
+  (interactive "sWord search backward: ")
+  (re-search-backward (word-search-regexp string nil) bound noerror count))
+
+(defun word-search-forward (string &optional bound noerror count)
+  "Search forward from point for STRING, ignoring differences in punctuation.
+Set point to the end of the occurrence found, and return point.
+An optional second argument bounds the search; it is a buffer position.
+The match found must not extend after that position.
+Optional third argument, if t, means if fail just return nil (no error).
+  If not nil and not t, move to limit of search and return nil.
+Optional fourth argument is repeat count--search for successive occurrences.
+
+Relies on the function `word-search-regexp' to convert a sequence
+of words in STRING to a regexp used to search words without regard
+to punctuation."
+  (interactive "sWord search: ")
+  (re-search-forward (word-search-regexp string nil) bound noerror count))
+
+(defun word-search-backward-lax (string &optional bound noerror count)
+  "Search backward from point for STRING, ignoring differences in punctuation.
+Set point to the beginning of the occurrence found, and return point.
+
+Unlike `word-search-backward', the end of STRING need not match a word
+boundary, unless STRING ends in whitespace.
+
+An optional second argument bounds the search; it is a buffer position.
+The match found must not extend before that position.
+Optional third argument, if t, means if fail just return nil (no error).
+  If not nil and not t, move to limit of search and return nil.
+Optional fourth argument is repeat count--search for successive occurrences.
+
+Relies on the function `word-search-regexp' to convert a sequence
+of words in STRING to a regexp used to search words without regard
+to punctuation."
+  (interactive "sWord search backward: ")
+  (re-search-backward (word-search-regexp string t) bound noerror count))
+
+(defun word-search-forward-lax (string &optional bound noerror count)
+  "Search forward from point for STRING, ignoring differences in punctuation.
+Set point to the end of the occurrence found, and return point.
+
+Unlike `word-search-forward', the end of STRING need not match a word
+boundary, unless STRING ends in whitespace.
+
+An optional second argument bounds the search; it is a buffer position.
+The match found must not extend after that position.
+Optional third argument, if t, means if fail just return nil (no error).
+  If not nil and not t, move to limit of search and return nil.
+Optional fourth argument is repeat count--search for successive occurrences.
+
+Relies on the function `word-search-regexp' to convert a sequence
+of words in STRING to a regexp used to search words without regard
+to punctuation."
+  (interactive "sWord search: ")
+  (re-search-forward (word-search-regexp string t) bound noerror count))
+
+;; Symbol search
+
+(defun isearch-symbol-regexp (string &optional lax)
+  "Return a regexp which matches STRING as a symbol.
+Creates a regexp where STRING is surrounded by symbol delimiters \\_< and \\_>.
+If LAX is non-nil, the end of the string need not match a symbol boundary."
+  (concat "\\_<" (regexp-quote string) (unless lax "\\_>")))
+
+(put 'isearch-symbol-regexp 'isearch-message-prefix "symbol ")
+
+\f
 (defun isearch-query-replace (&optional delimited regexp-flag)
   "Start `query-replace' with string to replace from last search string.
 The arg DELIMITED (prefix arg if interactive), if non-nil, means replace
@@ -1446,6 +1574,8 @@ characters in that string."
   (interactive
    (let* ((perform-collect (consp current-prefix-arg))
          (regexp (cond
+                  ((functionp isearch-word)
+                   (funcall isearch-word isearch-string))
                   (isearch-word (word-search-regexp isearch-string))
                   (isearch-regexp isearch-string)
                   (t (regexp-quote isearch-string)))))
@@ -1661,6 +1791,8 @@ Subword is used when `subword-mode' is activated. "
                       (setq case-fold-search
                             (isearch-no-upper-case-p isearch-string isearch-regexp)))
                   (looking-at (cond
+                               ((functionp isearch-word)
+                                (funcall isearch-word isearch-string t))
                                (isearch-word (word-search-regexp isearch-string t))
                                (isearch-regexp isearch-string)
                                (t (regexp-quote isearch-string)))))
@@ -2241,7 +2373,11 @@ If there is no completion possible, say so and continue searching."
                              (< (point) isearch-opoint)))
                       "over")
                   (if isearch-wrapped "wrapped ")
-                  (if isearch-word "word " "")
+                  (if isearch-word
+                      (or (and (symbolp isearch-word)
+                               (get isearch-word 'isearch-message-prefix))
+                          "word ")
+                    "")
                   (if isearch-regexp "regexp " "")
                   (if multi-isearch-next-buffer-current-function "multi " "")
                   (or isearch-message-prefix-add "")
@@ -2268,8 +2404,8 @@ If there is no completion possible, say so and continue searching."
 \f
 ;; Searching
 
-(defvar isearch-search-fun-function nil
-  "Overrides the default `isearch-search-fun' behavior.
+(defvar isearch-search-fun-function 'isearch-search-fun-default
+  "Non-default value overrides the behavior of `isearch-search-fun-default'.
 This variable's value should be a function, which will be called
 with no arguments, and should return a function that takes three
 arguments: STRING, BOUND, and NOERROR.
@@ -2280,22 +2416,29 @@ search for the first occurrence of STRING or its translation.")
 (defun isearch-search-fun ()
   "Return the function to use for the search.
 Can be changed via `isearch-search-fun-function' for special needs."
-  (if isearch-search-fun-function
-      (funcall isearch-search-fun-function)
-    (cond
-     (isearch-word
+  (funcall (or isearch-search-fun-function 'isearch-search-fun-default)))
+
+(defun isearch-search-fun-default ()
+  "Return default functions to use for the search."
+  (cond
+   (isearch-word
+    (lambda (string &optional bound noerror count)
       ;; Use lax versions to not fail at the end of the word while
       ;; the user adds and removes characters in the search string
       ;; (or when using nonincremental word isearch)
-      (if (or isearch-nonincremental
-             (eq (length isearch-string)
-                 (length (isearch-string-state (car isearch-cmds)))))
-         (if isearch-forward 'word-search-forward 'word-search-backward)
-       (if isearch-forward 'word-search-forward-lax 'word-search-backward-lax)))
-     (isearch-regexp
-      (if isearch-forward 're-search-forward 're-search-backward))
-     (t
-      (if isearch-forward 'search-forward 'search-backward)))))
+      (let ((lax (not (or isearch-nonincremental
+                         (eq (length isearch-string)
+                             (length (isearch-string-state (car isearch-cmds))))))))
+       (funcall
+        (if isearch-forward #'re-search-forward #'re-search-backward)
+        (if (functionp isearch-word)
+            (funcall isearch-word string lax)
+          (word-search-regexp string lax))
+        bound noerror count))))
+   (isearch-regexp
+    (if isearch-forward 're-search-forward 're-search-backward))
+   (t
+    (if isearch-forward 'search-forward 'search-backward))))
 
 (defun isearch-search-string (string bound noerror)
   "Search for the first occurrence of STRING or its translation.
index 86cef14960e1f698cf04878697c3926725e5ebbd..6493a8f800c8ca0c37a7215e67a66d4c27d0f7df 100644 (file)
@@ -372,9 +372,14 @@ See also `iswitchb-newbuffer'."
   :type 'string
   :group 'iswitchb)
 
-(defvar iswitchb-all-frames 'visible
-  "*Argument to pass to `walk-windows' when finding visible buffers.
-See documentation of `walk-windows' for useful values.")
+(defcustom iswitchb-all-frames 'visible
+  "Argument to pass to `walk-windows' when iswitchb is finding buffers.
+See documentation of `walk-windows' for useful values."
+  :type '(choice (const :tag "Selected frame only" nil)
+                (const :tag "All existing frames" t)
+                (const :tag "All visible frames" visible)
+                (const :tag "All frames on this terminal" 0))
+  :group 'iswitchb)
 
 (defcustom iswitchb-minibuffer-setup-hook nil
   "Iswitchb-specific customization of minibuffer setup.
index ec44b17835c9011389a2caf955c44224067f2f8b..55e25e4c262edb46adc06a7227540301adf2500f 100644 (file)
@@ -29,8 +29,6 @@
 
 
 (eval-when-compile
-  (require 'cl)
-
   (defmacro with-buffer-prepared-for-jit-lock (&rest body)
     "Execute BODY in current buffer, overriding several variables.
 Preserves the `buffer-modified-p' state of the current buffer."
index c8dd05f7c4d1375b6d2d48b20bea01cd62511f77..6ecac2cdf284c9552911898136548a9973f71b8d 100644 (file)
@@ -231,12 +231,12 @@ macro to be executed before appending to it."
 ;;; Keyboard macro counter
 
 (defvar kmacro-counter 0
-  "*Current keyboard macro counter.")
+  "Current keyboard macro counter.")
 
 (defvar kmacro-default-counter-format "%d")
 
 (defvar kmacro-counter-format "%d"
-  "*Current keyboard macro counter format.")
+  "Current keyboard macro counter format.")
 
 (defvar kmacro-counter-format-start kmacro-counter-format
   "Macro format at start of macro execution.")
@@ -625,10 +625,11 @@ for details on how to adjust or disable this behavior.
 To make a macro permanent so you can call it even after defining
 others, use \\[kmacro-name-last-macro]."
   (interactive "p")
-  (let ((repeat-key (and (null no-repeat)
-                        (> (length (this-single-command-keys)) 1)
-                        last-input-event))
-       repeat-key-str)
+  (let ((repeat-key (and (or (and (null no-repeat)
+                                  (> (length (this-single-command-keys)) 1))
+                             ;; Used when we're in the process of repeating.
+                             (eq no-repeat 'repeating))
+                        last-input-event)))
     (if end-macro
        (kmacro-end-macro arg)
       (call-last-kbd-macro arg #'kmacro-loop-setup-function))
@@ -639,25 +640,23 @@ others, use \\[kmacro-name-last-macro]."
                     (if (eq kmacro-call-repeat-key t)
                         repeat-key
                       kmacro-call-repeat-key)))
-      (setq repeat-key-str (format-kbd-macro (vector repeat-key) nil))
-      (while repeat-key
-       ;; Issue a hint to the user, if the echo area isn't in use.
-       (unless (current-message)
-         (message "(Type %s to repeat macro%s)"
-                  repeat-key-str
-                  (if (and kmacro-call-repeat-with-arg
-                           arg (> arg 1))
-                      (format " %d times" arg) "")))
-       (if (equal repeat-key (read-event))
-           (progn
-             (clear-this-command-keys t)
-             (call-last-kbd-macro (and kmacro-call-repeat-with-arg arg)
-                                  #'kmacro-loop-setup-function)
-             (setq last-input-event nil))
-         (setq repeat-key nil)))
-      (when last-input-event
-       (clear-this-command-keys t)
-       (setq unread-command-events (list last-input-event))))))
+      ;; Issue a hint to the user, if the echo area isn't in use.
+      (unless (current-message)
+       (message "(Type %s to repeat macro%s)"
+                (format-kbd-macro (vector repeat-key) nil)
+                (if (and kmacro-call-repeat-with-arg
+                         arg (> arg 1))
+                    (format " %d times" arg) "")))
+      ;; Can't use the `keep-pred' arg because this overlay keymap needs to be
+      ;; removed during the next run of the kmacro (i.e. we need to add&remove
+      ;; this overlay-map at each repetition).
+      (set-temporary-overlay-map
+       (let ((map (make-sparse-keymap)))
+         (define-key map (vector repeat-key)
+           `(lambda () (interactive)
+              (kmacro-call-macro ,(and kmacro-call-repeat-with-arg arg)
+                                 'repeating)))
+         map)))))
 
 
 ;;; Combined function key bindings:
index 9fce05831618bd4de4e57755de5ce0a0bedf09ce..420e8d74919a1b556313db12a802bbca17dea5df 100644 (file)
@@ -1,4 +1,4 @@
-;;; burmese.el --- support for Burmese -*- coding: utf-8; no-byte-compile: t -*-
+;;; burmese.el --- support for Burmese -*- coding: utf-8 -*-
 
 ;; Copyright (C) 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index b2962fb28899fec085b8be99db1a059c9656c9de..a025ff0d209b73a409410c644aa195fc6aff44b3 100644 (file)
@@ -1,4 +1,4 @@
-;;; cham.el --- support for Cham -*- coding: utf-8; no-byte-compile: t -*-
+;;; cham.el --- support for Cham -*- coding: utf-8 -*-
 
 ;; Copyright (C) 2008, 2009, 2010, 2011, 2012
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index 93f75694555252e6e533861a3bed4e6968404f00..5bda5d1faa1e534e7987e412cda3c2ce3412d703 100644 (file)
@@ -1,6 +1,6 @@
-;;; czech.el --- support for Czech -*- coding: iso-2022-7bit; no-byte-compile: t -*-
+;;; czech.el --- support for Czech -*- coding: iso-2022-7bit -*-
 
-;; Copyright (C) 1998, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <pdm@zamazal.org>
 ;; Maintainer: Pavel Jan\e,Am\e(Bk <Pavel@Janik.cz>
index 6d106a5e07060bfcf4c4fa4a3e7c1a1954b86a3e..4f4c6788cae827ccf08b32c459bd82e42ef912ce 100644 (file)
@@ -1,6 +1,6 @@
-;;; english.el --- support for English -*- no-byte-compile: t -*-
+;;; english.el --- support for English
 
-;; Copyright (C) 1997, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2012 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index e61645c10fc5ed7dad0c3b2117b7ce6688de4e4f..90e649c574cf6de3f82d27f8a00dada0e6a2ffe8 100644 (file)
 ;;
 
 (defvar ethio-primary-language 'tigrigna
-  "*Symbol that defines the primary language in SERA --> FIDEL conversion.
+  "Symbol that defines the primary language in SERA --> FIDEL conversion.
 The value should be one of: `tigrigna', `amharic' or `english'.")
 
 (defvar ethio-secondary-language 'english
-  "*Symbol that defines the secondary language in SERA --> FIDEL conversion.
+  "Symbol that defines the secondary language in SERA --> FIDEL conversion.
 The value should be one of: `tigrigna', `amharic' or `english'.")
 
 (defvar ethio-use-colon-for-colon nil
-  "*Non-nil means associate ASCII colon with Ethiopic colon.
+  "Non-nil means associate ASCII colon with Ethiopic colon.
 If nil, associate ASCII colon with Ethiopic word separator, i.e., two
 vertically stacked dots.  All SERA <--> FIDEL converters refer this
 variable.")
 
 (defvar ethio-use-three-dot-question nil
-  "*Non-nil means associate ASCII question mark with Ethiopic old style question mark (three vertically stacked dots).
+  "Non-nil means associate ASCII question mark with Ethiopic old style question mark (three vertically stacked dots).
 If nil, associate ASCII question mark with Ethiopic stylized question
 mark.  All SERA <--> FIDEL converters refer this variable.")
 
 (defvar ethio-quote-vowel-always nil
-  "*Non-nil means always put an apostrophe before an isolated vowel (except at word initial) in FIDEL --> SERA conversion.
+  "Non-nil means always put an apostrophe before an isolated vowel (except at word initial) in FIDEL --> SERA conversion.
 If nil, put an apostrophe only between a 6th-form consonant and an
 isolated vowel.")
 
 (defvar ethio-W-sixth-always nil
-  "*Non-nil means convert the Wu-form of a 12-form consonant to \"W'\" instead of \"Wu\" in FIDEL --> SERA conversion.")
+  "Non-nil means convert the Wu-form of a 12-form consonant to \"W'\" instead of \"Wu\" in FIDEL --> SERA conversion.")
 
 (defvar ethio-numeric-reduction 0
-  "*Degree of reduction in converting Ethiopic digits into Arabic digits.
+  "Degree of reduction in converting Ethiopic digits into Arabic digits.
 Should be 0, 1 or 2.
 For example, ({10}{9}{100}{80}{7}) is converted into:
     `10`9`100`80`7  if `ethio-numeric-reduction' is 0,
@@ -134,7 +134,7 @@ For example, ({10}{9}{100}{80}{7}) is converted into:
     `10900807      if `ethio-numeric-reduction' is 2.")
 
 (defvar ethio-java-save-lowercase nil
-  "*Non-nil means save Ethiopic characters in lowercase hex numbers to Java files.
+  "Non-nil means save Ethiopic characters in lowercase hex numbers to Java files.
 If nil, use uppercases.")
 
 (defun ethio-prefer-amharic-p ()
index b658f93d90f3b4626e490aed76fec099cd92b9fc..259c06755a0d7b27fc8428237360cb00167ede2f 100644 (file)
@@ -324,6 +324,14 @@ Latin-9 is sometimes nicknamed `Latin-0'."))
   :mime-charset 'windows-1257)
 (define-coding-system-alias 'cp1257 'windows-1257)
 
+(define-coding-system 'cp775
+  "DOS codepage 775 (PC Baltic, MS-DOS Baltic Rim)"
+  :coding-type 'charset
+  :mnemonic ?D
+  :charset-list '(cp775)
+  :mime-charset 'cp775)
+(define-coding-system-alias 'ibm775 'cp775)
+
 (define-coding-system 'cp850
   "DOS codepage 850 (Western European)"
   :coding-type 'charset
index fcbd395e13146f379e8e802c4211233bd9f3ba7a..a410a722db33768e0b2d21ca010598c7c1971080 100644 (file)
@@ -1,6 +1,6 @@
-;;; georgian.el --- language support for Georgian -*- no-byte-compile: t -*-
+;;; georgian.el --- language support for Georgian
 
-;; Copyright (C) 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
index e4d239cdf27a694a9d94cf3ede9c6e6dba5bb041..1c8330936c91b1a93570802a7ca5891eae4fb44c 100644 (file)
@@ -1,4 +1,4 @@
-;;; greek.el --- support for Greek -*- no-byte-compile: t -*-
+;;; greek.el --- support for Greek
 
 ;; Copyright (C) 2002 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
index 256263edbb394049e8a8628ad6bf8327628c6f22..83c8fcf66c93c74a57c9b0858c494059f6e6f80f 100644 (file)
@@ -1,6 +1,6 @@
-;;; japanese.el --- support for Japanese -*- coding: iso-2022-7bit; no-byte-compile: t -*-
+;;; japanese.el --- support for Japanese -*- coding: iso-2022-7bit -*-
 
-;; Copyright (C) 1997, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2012 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index d01fa3b33bdb2e7a17bc9b366cc23fc67378fa23..8663ff22ca0e9b94b1c0beb97495eab4b837d4cd 100644 (file)
@@ -1,4 +1,4 @@
-;;; khmer.el --- support for Khmer -*- coding: utf-8; no-byte-compile: t -*-
+;;; khmer.el --- support for Khmer -*- coding: utf-8 -*-
 
 ;; Copyright (C) 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index f8dfdf45d00f421fe6b9c137cff0f4ef72e51b38..ee8ebb7b2e732d9c5516f0cc6bcf954ed9c22447 100644 (file)
@@ -32,7 +32,7 @@
    (purecopy (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") ""))
       "3"
     ""))
-  "*The kind of Korean keyboard for Korean input method.
+   "The kind of Korean keyboard for Korean input method.
 \"\" for 2, \"3\" for 3.")
 
 ;; functions useful for Korean text input
index 9f93f76a74e3f79c2ae4e411f15cf36c3b44f092..711d24a5b00d2409cbf2f63219c220f2a2426c50 100644 (file)
@@ -1,6 +1,6 @@
-;;; korean.el --- support for Korean -*- coding: iso-2022-7bit; no-byte-compile: t -*-
+;;; korean.el --- support for Korean -*- coding: iso-2022-7bit -*-
 
-;; Copyright (C) 1998, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2012 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index 28449bad0711b793411bbe27aad4d6b77ff462d5..6a0d431f3ec1c0258702752de8551e769b519821 100644 (file)
@@ -1,6 +1,6 @@
-;;; lao.el --- support for Lao -*- coding: utf-8; no-byte-compile: t -*-
+;;; lao.el --- support for Lao -*- coding: utf-8 -*-
 
-;; Copyright (C) 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2001-2012 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 ;;   2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index 6fa54ff5c8046249634fd5e750d2dba7379b170f..1286b36189247eed7e9389a89b6bc67b79f94e20 100644 (file)
@@ -1,4 +1,4 @@
-;;; misc-lang.el --- support for miscellaneous languages (characters) -*- no-byte-compile: t -*-
+;;; misc-lang.el --- support for miscellaneous languages (characters)
 
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
index 75483917a3bd8175ecc526bed77cbc2fb3b85fee..ff5db222bd231ec449a0a65b6a1cb09d335ca576 100644 (file)
@@ -1,6 +1,6 @@
-;;; romanian.el --- support for Romanian -*- coding: iso-latin-2; no-byte-compile: t -*-
+;;; romanian.el --- support for Romanian -*- coding: iso-latin-2 -*-
 
-;; Copyright (C) 1998, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author:    Dan Nicolaescu <done@ece.arizona.edu>
 ;; Keywords: multilingual, Romanian, i18n
index ea8a6a34cd8ce0719fef3a2303b0f25cf7b50edd..037d753f52acb814cc0581edac06575c74982f02 100644 (file)
@@ -1,4 +1,4 @@
-;;; sinhala.el --- support for Sinhala -*- coding: utf-8; no-byte-compile: t -*-
+;;; sinhala.el --- support for Sinhala -*- coding: utf-8 -*-
 
 ;; Copyright (C) 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index b17dab8e31508a17648e7834b6b06d318440f6b9..27e43fa22cf282162007aa95545bc38221651011 100644 (file)
@@ -1,6 +1,6 @@
-;;; slovak.el --- support for Slovak -*- coding: iso-2022-7bit; no-byte-compile: t -*-
+;;; slovak.el --- support for Slovak -*- coding: iso-2022-7bit -*-
 
-;; Copyright (C) 1998, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2012 Free Software Foundation, Inc.
 
 ;; Authors:    Tibor \e,B)\e(Bimko <tibor.simko@fmph.uniba.sk>,
 ;;             Milan Zamazal <pdm@zamazal.org>
index f8b7a9d6df86443bfccff454e919491ad277b234..496453f650261f60058fb867bcd5c19f1b77af72 100644 (file)
@@ -1,6 +1,6 @@
-;;; tai-viet.el --- support for Tai Viet -*- coding: utf-8; no-byte-compile: t -*-
+;;; tai-viet.el --- support for Tai Viet -*- coding: utf-8 -*-
 
-;; Copyright (C) 2007-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
 ;; Copyright (C) 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
index 9bebe6ef185ad06c833b48b8aeccc04c1bff9762..c7522f94ec81e4b11a1a2e0f8134369eba51eb5c 100644 (file)
@@ -1,6 +1,6 @@
-;;; thai.el --- support for Thai -*- coding: iso-2022-7bit; no-byte-compile: t -*-
+;;; thai.el --- support for Thai -*- coding: iso-2022-7bit -*-
 
-;; Copyright (C) 1997-1998, 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2012 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
index 66795201f7f9a8dc3ee91f9258632a64cb058142..f6dd15bf222674027ef1a8d00bc55b7cde9900fe 100644 (file)
@@ -398,7 +398,7 @@ See also docstring of the function tibetan-compose-region."
        ))))
 
 (defvar tibetan-strict-unicode t
-  "*Flag to control Tibetan canonicalizing for Unicode.
+  "Flag to control Tibetan canonicalizing for Unicode.
 
 If non-nil, the vowel a is removed and composite vowels are decomposed
 before writing buffer in Unicode.  See also
index eb0828694d454792eb2157c36f2cd2e7d622ca30..e03138703237d4d1ea7824f7ff4807c6315e5072 100644 (file)
@@ -1,6 +1,6 @@
-;;; utf-8-lang.el --- generic UTF-8 language environment -*- no-byte-compile: t -*-
+;;; utf-8-lang.el --- generic UTF-8 language environment
 
-;; Copyright (C) 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <fx@gnu.org>
 ;; Keywords: i18n
index f004f03e8f3cb7add9594c0ab439ffca02819085..b23133392356d012f08cb8ec7d5a92345920e63b 100644 (file)
@@ -5,7 +5,7 @@
 \f
 ;;;### (autoloads (5x5-crack 5x5-crack-xor-mutate 5x5-crack-mutating-best
 ;;;;;;  5x5-crack-mutating-current 5x5-crack-randomly 5x5) "5x5"
-;;;;;;  "play/5x5.el" (20352 65510))
+;;;;;;  "play/5x5.el" (20459 40320 865360 0))
 ;;; Generated autoloads from play/5x5.el
 
 (autoload '5x5 "5x5" "\
@@ -68,7 +68,7 @@ should return a grid vector array that is the new solution.
 ;;;***
 \f
 ;;;### (autoloads (ada-mode ada-add-extensions) "ada-mode" "progmodes/ada-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from progmodes/ada-mode.el
 
 (autoload 'ada-add-extensions "ada-mode" "\
@@ -88,7 +88,7 @@ Ada mode is the major mode for editing Ada code.
 ;;;***
 \f
 ;;;### (autoloads (ada-header) "ada-stmt" "progmodes/ada-stmt.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/ada-stmt.el
 
 (autoload 'ada-header "ada-stmt" "\
@@ -99,7 +99,7 @@ Insert a descriptive header at the top of the file.
 ;;;***
 \f
 ;;;### (autoloads (ada-find-file) "ada-xref" "progmodes/ada-xref.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from progmodes/ada-xref.el
 
 (autoload 'ada-find-file "ada-xref" "\
@@ -114,7 +114,7 @@ Completion is available.
 ;;;;;;  add-change-log-entry-other-window add-change-log-entry find-change-log
 ;;;;;;  prompt-for-change-log-name add-log-mailing-address add-log-full-name
 ;;;;;;  add-log-current-defun-function) "add-log" "vc/add-log.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from vc/add-log.el
 
 (put 'change-log-default-name 'safe-local-variable 'string-or-null-p)
@@ -214,13 +214,13 @@ Runs `change-log-mode-hook'.
 \(fn)" t nil)
 
 (defvar add-log-lisp-like-modes '(emacs-lisp-mode lisp-mode scheme-mode dsssl-mode lisp-interaction-mode) "\
-*Modes that look like Lisp to `add-log-current-defun'.")
+Modes that look like Lisp to `add-log-current-defun'.")
 
 (defvar add-log-c-like-modes '(c-mode c++-mode c++-c-mode objc-mode) "\
-*Modes that look like C to `add-log-current-defun'.")
+Modes that look like C to `add-log-current-defun'.")
 
 (defvar add-log-tex-like-modes '(TeX-mode plain-TeX-mode LaTeX-mode tex-mode) "\
-*Modes that look like TeX to `add-log-current-defun'.")
+Modes that look like TeX to `add-log-current-defun'.")
 
 (autoload 'add-log-current-defun "add-log" "\
 Return name of function definition point is in, or nil.
@@ -253,7 +253,7 @@ old-style time formats for entries are supported.
 \f
 ;;;### (autoloads (defadvice ad-activate ad-add-advice ad-disable-advice
 ;;;;;;  ad-enable-advice ad-default-compilation-action ad-redefinition-action)
-;;;;;;  "advice" "emacs-lisp/advice.el" (20352 65510))
+;;;;;;  "advice" "emacs-lisp/advice.el" (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/advice.el
 
 (defvar ad-redefinition-action 'warn "\
@@ -390,7 +390,7 @@ usage: (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...)
           [DOCSTRING] [INTERACTIVE-FORM]
           BODY...)
 
-\(fn FUNCTION ARGS &rest BODY)" nil (quote macro))
+\(fn FUNCTION ARGS &rest BODY)" nil t)
 
 (put 'defadvice 'doc-string-elt '3)
 
@@ -398,7 +398,7 @@ usage: (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...)
 \f
 ;;;### (autoloads (align-newline-and-indent align-unhighlight-rule
 ;;;;;;  align-highlight-rule align-current align-entire align-regexp
-;;;;;;  align) "align" "align.el" (20352 65510))
+;;;;;;  align) "align" "align.el" (20355 10021 546955 0))
 ;;; Generated autoloads from align.el
 
 (autoload 'align "align" "\
@@ -489,7 +489,7 @@ A replacement function for `newline-and-indent', aligning as it goes.
 \f
 ;;;### (autoloads (outlineify-sticky allout-mode allout-mode-p allout-auto-activation
 ;;;;;;  allout-setup allout-auto-activation-helper) "allout" "allout.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20399 35365 4050 0))
 ;;; Generated autoloads from allout.el
 
 (autoload 'allout-auto-activation-helper "allout" "\
@@ -566,7 +566,7 @@ With value nil, inhibit any automatic allout-mode activation.")
 (autoload 'allout-mode-p "allout" "\
 Return t if `allout-mode' is active in current buffer.
 
-\(fn)" nil (quote macro))
+\(fn)" nil t)
 
 (autoload 'allout-mode "allout" "\
 Toggle Allout outline mode.
@@ -746,10 +746,10 @@ without changes to the allout core.  Here are key ones:
 `allout-mode-hook'
 `allout-mode-deactivate-hook' (deprecated)
 `allout-mode-off-hook'
-`allout-exposure-change-hook'
-`allout-structure-added-hook'
-`allout-structure-deleted-hook'
-`allout-structure-shifted-hook'
+`allout-exposure-change-functions'
+`allout-structure-added-functions'
+`allout-structure-deleted-functions'
+`allout-structure-shifted-functions'
 `allout-after-copy-or-kill-hook'
 `allout-post-undo-hook'
 
@@ -850,7 +850,7 @@ for details on preparing Emacs for automatic allout activation.
 \f
 ;;;### (autoloads (allout-widgets-mode allout-widgets-auto-activation
 ;;;;;;  allout-widgets-setup allout-widgets) "allout-widgets" "allout-widgets.el"
-;;;;;;  (20432 47835))
+;;;;;;  (20437 50597 545250 0))
 ;;; Generated autoloads from allout-widgets.el
 
 (let ((loads (get 'allout-widgets 'custom-loads))) (if (member '"allout-widgets" loads) nil (put 'allout-widgets 'custom-loads (cons '"allout-widgets" loads))))
@@ -910,7 +910,7 @@ outline hot-spot navigation (see `allout-mode').
 ;;;***
 \f
 ;;;### (autoloads (ange-ftp-hook-function ange-ftp-reread-dir) "ange-ftp"
-;;;;;;  "net/ange-ftp.el" (20400 62402))
+;;;;;;  "net/ange-ftp.el" (20461 32935 300400 0))
 ;;; Generated autoloads from net/ange-ftp.el
 
 (defalias 'ange-ftp-re-read-dir 'ange-ftp-reread-dir)
@@ -932,7 +932,7 @@ directory, so that Emacs will know its current contents.
 ;;;***
 \f
 ;;;### (autoloads (animate-birthday-present animate-sequence animate-string)
-;;;;;;  "animate" "play/animate.el" (20400 62402))
+;;;;;;  "animate" "play/animate.el" (20355 10021 546955 0))
 ;;; Generated autoloads from play/animate.el
 
 (autoload 'animate-string "animate" "\
@@ -965,7 +965,7 @@ the buffer *Birthday-Present-for-Name*.
 ;;;***
 \f
 ;;;### (autoloads (ansi-color-process-output ansi-color-for-comint-mode-on)
-;;;;;;  "ansi-color" "ansi-color.el" (20391 15703))
+;;;;;;  "ansi-color" "ansi-color.el" (20453 38823 158957 0))
 ;;; Generated autoloads from ansi-color.el
 
 (autoload 'ansi-color-for-comint-mode-on "ansi-color" "\
@@ -991,7 +991,8 @@ This is a good function to put in `comint-output-filter-functions'.
 ;;;***
 \f
 ;;;### (autoloads (antlr-set-tabs antlr-mode antlr-show-makefile-rules)
-;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (20400 62402))
+;;;;;;  "antlr-mode" "progmodes/antlr-mode.el" (20427 14766 970343
+;;;;;;  0))
 ;;; Generated autoloads from progmodes/antlr-mode.el
 
 (autoload 'antlr-show-makefile-rules "antlr-mode" "\
@@ -1027,7 +1028,7 @@ Used in `antlr-mode'.  Also a useful function in `java-mode-hook'.
 ;;;***
 \f
 ;;;### (autoloads (appt-activate appt-add) "appt" "calendar/appt.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from calendar/appt.el
 
 (autoload 'appt-add "appt" "\
@@ -1050,7 +1051,8 @@ ARG is positive, otherwise off.
 \f
 ;;;### (autoloads (apropos-documentation apropos-value apropos-library
 ;;;;;;  apropos apropos-documentation-property apropos-command apropos-variable
-;;;;;;  apropos-read-pattern) "apropos" "apropos.el" (20400 62402))
+;;;;;;  apropos-read-pattern) "apropos" "apropos.el" (20374 32165
+;;;;;;  855366 0))
 ;;; Generated autoloads from apropos.el
 
 (autoload 'apropos-read-pattern "apropos" "\
@@ -1158,8 +1160,8 @@ Returns list of symbols and documentation found.
 
 ;;;***
 \f
-;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (archive-mode) "arc-mode" "arc-mode.el" (20387
+;;;;;;  44199 24128 0))
 ;;; Generated autoloads from arc-mode.el
 
 (autoload 'archive-mode "arc-mode" "\
@@ -1179,7 +1181,8 @@ archive.
 
 ;;;***
 \f
-;;;### (autoloads (array-mode) "array" "array.el" (20352 65510))
+;;;### (autoloads (array-mode) "array" "array.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from array.el
 
 (autoload 'array-mode "array" "\
@@ -1250,13 +1253,13 @@ Entering array mode calls the function `array-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (20357
+;;;;;;  58785 834364 0))
 ;;; Generated autoloads from textmodes/artist.el
 
 (autoload 'artist-mode "artist" "\
 Toggle Artist mode.
-With argument STATE, turn Artist mode on if STATE is positive.
+With argument ARG, turn Artist mode on if ARG is positive.
 Artist lets you draw lines, squares, rectangles and poly-lines,
 ellipses and circles with your mouse and/or keyboard.
 
@@ -1445,20 +1448,19 @@ Variables
 
 Hooks
 
- When entering artist-mode, the hook `artist-mode-init-hook' is called.
- When quitting artist-mode, the hook `artist-mode-exit-hook' is called.
+ Turning the mode on or off runs `artist-mode-hook'.
 
 
 Keymap summary
 
 \\{artist-mode-map}
 
-\(fn &optional STATE)" t nil)
+\(fn &optional ARG)" t nil)
 
 ;;;***
 \f
-;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (asm-mode) "asm-mode" "progmodes/asm-mode.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/asm-mode.el
 
 (autoload 'asm-mode "asm-mode" "\
@@ -1486,7 +1488,7 @@ Special commands:
 ;;;***
 \f
 ;;;### (autoloads (auth-source-cache-expiry) "auth-source" "gnus/auth-source.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20425 59428 310626 0))
 ;;; Generated autoloads from gnus/auth-source.el
 
 (defvar auth-source-cache-expiry 7200 "\
@@ -1499,7 +1501,7 @@ let-binding.")
 ;;;***
 \f
 ;;;### (autoloads (autoarg-kp-mode autoarg-mode) "autoarg" "autoarg.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from autoarg.el
 
 (defvar autoarg-mode nil "\
@@ -1560,7 +1562,7 @@ This is similar to `autoarg-mode' but rebinds the keypad keys
 ;;;***
 \f
 ;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/autoconf.el
 
 (autoload 'autoconf-mode "autoconf" "\
@@ -1571,7 +1573,7 @@ Major mode for editing Autoconf configure.in files.
 ;;;***
 \f
 ;;;### (autoloads (auto-insert-mode define-auto-insert auto-insert)
-;;;;;;  "autoinsert" "autoinsert.el" (20400 62402))
+;;;;;;  "autoinsert" "autoinsert.el" (20458 56750 651721 0))
 ;;; Generated autoloads from autoinsert.el
 
 (autoload 'auto-insert "autoinsert" "\
@@ -1611,7 +1613,7 @@ insert a template for the file depending on the mode of the buffer.
 \f
 ;;;### (autoloads (batch-update-autoloads update-directory-autoloads
 ;;;;;;  update-file-autoloads) "autoload" "emacs-lisp/autoload.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20440 54677 388705 0))
 ;;; Generated autoloads from emacs-lisp/autoload.el
 
 (put 'generated-autoload-file 'safe-local-variable 'stringp)
@@ -1662,7 +1664,7 @@ should be non-nil).
 \f
 ;;;### (autoloads (global-auto-revert-mode turn-on-auto-revert-tail-mode
 ;;;;;;  auto-revert-tail-mode turn-on-auto-revert-mode auto-revert-mode)
-;;;;;;  "autorevert" "autorevert.el" (20400 62402))
+;;;;;;  "autorevert" "autorevert.el" (20373 11301 906925 0))
 ;;; Generated autoloads from autorevert.el
 
 (autoload 'auto-revert-mode "autorevert" "\
@@ -1751,7 +1753,7 @@ specifies in the mode line.
 ;;;***
 \f
 ;;;### (autoloads (mouse-avoidance-mode mouse-avoidance-mode) "avoid"
-;;;;;;  "avoid.el" (20400 62402))
+;;;;;;  "avoid.el" (20369 14251 85829 0))
 ;;; Generated autoloads from avoid.el
 
 (defvar mouse-avoidance-mode nil "\
@@ -1792,7 +1794,7 @@ definition of \"random distance\".)
 ;;;***
 \f
 ;;;### (autoloads (display-battery-mode battery) "battery" "battery.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20369 14251 85829 0))
 ;;; Generated autoloads from battery.el
  (put 'battery-mode-line-string 'risky-local-variable t)
 
@@ -1828,7 +1830,8 @@ seconds.
 ;;;***
 \f
 ;;;### (autoloads (benchmark benchmark-run-compiled benchmark-run)
-;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (20352 65510))
+;;;;;;  "benchmark" "emacs-lisp/benchmark.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from emacs-lisp/benchmark.el
 
 (autoload 'benchmark-run "benchmark" "\
@@ -1840,7 +1843,7 @@ Return a list of the total elapsed time for execution, the number of
 garbage collections that ran, and the time taken by garbage collection.
 See also `benchmark-run-compiled'.
 
-\(fn &optional REPETITIONS &rest FORMS)" nil (quote macro))
+\(fn &optional REPETITIONS &rest FORMS)" nil t)
 
 (autoload 'benchmark-run-compiled "benchmark" "\
 Time execution of compiled version of FORMS.
@@ -1848,7 +1851,7 @@ This is like `benchmark-run', but what is timed is a funcall of the
 byte code obtained by wrapping FORMS in a `lambda' and compiling the
 result.  The overhead of the `lambda's is accounted for.
 
-\(fn &optional REPETITIONS &rest FORMS)" nil (quote macro))
+\(fn &optional REPETITIONS &rest FORMS)" nil t)
 
 (autoload 'benchmark "benchmark" "\
 Print the time taken for REPETITIONS executions of FORM.
@@ -1861,7 +1864,7 @@ For non-interactive use see also `benchmark-run' and
 ;;;***
 \f
 ;;;### (autoloads (bibtex-search-entry bibtex-mode bibtex-initialize)
-;;;;;;  "bibtex" "textmodes/bibtex.el" (20400 62402))
+;;;;;;  "bibtex" "textmodes/bibtex.el" (20439 5925 915283 0))
 ;;; Generated autoloads from textmodes/bibtex.el
 
 (autoload 'bibtex-initialize "bibtex" "\
@@ -1950,7 +1953,7 @@ A prefix arg negates the value of `bibtex-search-entry-globally'.
 ;;;***
 \f
 ;;;### (autoloads (bibtex-style-mode) "bibtex-style" "textmodes/bibtex-style.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/bibtex-style.el
 
 (autoload 'bibtex-style-mode "bibtex-style" "\
@@ -1962,7 +1965,7 @@ Major mode for editing BibTeX style files.
 \f
 ;;;### (autoloads (binhex-decode-region binhex-decode-region-external
 ;;;;;;  binhex-decode-region-internal) "binhex" "mail/binhex.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mail/binhex.el
 
 (defconst binhex-begin-line "^:...............................................................$" "\
@@ -1986,8 +1989,8 @@ Binhex decode region between START and END.
 
 ;;;***
 \f
-;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from play/blackbox.el
 
 (autoload 'blackbox "blackbox" "\
@@ -2110,7 +2113,7 @@ a reflection.
 ;;;;;;  bookmark-save bookmark-write bookmark-delete bookmark-insert
 ;;;;;;  bookmark-rename bookmark-insert-location bookmark-relocate
 ;;;;;;  bookmark-jump-other-window bookmark-jump bookmark-set) "bookmark"
-;;;;;;  "bookmark.el" (20400 62402))
+;;;;;;  "bookmark.el" (20459 40320 865360 0))
 ;;; Generated autoloads from bookmark.el
  (define-key ctl-x-r-map "b" 'bookmark-jump)
  (define-key ctl-x-r-map "m" 'bookmark-set)
@@ -2297,7 +2300,7 @@ Incremental search of bookmarks, hiding the non-matches as we go.
 
 \(fn)" t nil)
 
-(defvar menu-bar-bookmark-map (let ((map (make-sparse-keymap "Bookmark functions"))) (define-key map [load] `(menu-item ,(purecopy "Load a Bookmark File...") bookmark-load :help ,(purecopy "Load bookmarks from a bookmark file)"))) (define-key map [write] `(menu-item ,(purecopy "Save Bookmarks As...") bookmark-write :help ,(purecopy "Write bookmarks to a file (reading the file name with the minibuffer)"))) (define-key map [save] `(menu-item ,(purecopy "Save Bookmarks") bookmark-save :help ,(purecopy "Save currently defined bookmarks"))) (define-key map [edit] `(menu-item ,(purecopy "Edit Bookmark List") bookmark-bmenu-list :help ,(purecopy "Display a list of existing bookmarks"))) (define-key map [delete] `(menu-item ,(purecopy "Delete Bookmark...") bookmark-delete :help ,(purecopy "Delete a bookmark from the bookmark list"))) (define-key map [rename] `(menu-item ,(purecopy "Rename Bookmark...") bookmark-rename :help ,(purecopy "Change the name of a bookmark"))) (define-key map [locate] `(menu-item ,(purecopy "Insert Location...") bookmark-locate :help ,(purecopy "Insert the name of the file associated with a bookmark"))) (define-key map [insert] `(menu-item ,(purecopy "Insert Contents...") bookmark-insert :help ,(purecopy "Insert the text of the file pointed to by a bookmark"))) (define-key map [set] `(menu-item ,(purecopy "Set Bookmark...") bookmark-set :help ,(purecopy "Set a bookmark named inside a file."))) (define-key map [jump] `(menu-item ,(purecopy "Jump to Bookmark...") bookmark-jump :help ,(purecopy "Jump to a bookmark (a point in some file)"))) map))
+(defvar menu-bar-bookmark-map (let ((map (make-sparse-keymap "Bookmark functions"))) (bindings--define-key map [load] '(menu-item "Load a Bookmark File..." bookmark-load :help "Load bookmarks from a bookmark file)")) (bindings--define-key map [write] '(menu-item "Save Bookmarks As..." bookmark-write :help "Write bookmarks to a file (reading the file name with the minibuffer)")) (bindings--define-key map [save] '(menu-item "Save Bookmarks" bookmark-save :help "Save currently defined bookmarks")) (bindings--define-key map [edit] '(menu-item "Edit Bookmark List" bookmark-bmenu-list :help "Display a list of existing bookmarks")) (bindings--define-key map [delete] '(menu-item "Delete Bookmark..." bookmark-delete :help "Delete a bookmark from the bookmark list")) (bindings--define-key map [rename] '(menu-item "Rename Bookmark..." bookmark-rename :help "Change the name of a bookmark")) (bindings--define-key map [locate] '(menu-item "Insert Location..." bookmark-locate :help "Insert the name of the file associated with a bookmark")) (bindings--define-key map [insert] '(menu-item "Insert Contents..." bookmark-insert :help "Insert the text of the file pointed to by a bookmark")) (bindings--define-key map [set] '(menu-item "Set Bookmark..." bookmark-set :help "Set a bookmark named inside a file.")) (bindings--define-key map [jump] '(menu-item "Jump to Bookmark..." bookmark-jump :help "Jump to a bookmark (a point in some file)")) map))
 
 (defalias 'menu-bar-bookmark-map menu-bar-bookmark-map)
 
@@ -2311,7 +2314,7 @@ Incremental search of bookmarks, hiding the non-matches as we go.
 ;;;;;;  browse-url-xdg-open browse-url-at-mouse browse-url-at-point
 ;;;;;;  browse-url browse-url-of-region browse-url-of-dired-file
 ;;;;;;  browse-url-of-buffer browse-url-of-file browse-url-browser-function)
-;;;;;;  "browse-url" "net/browse-url.el" (20400 62402))
+;;;;;;  "browse-url" "net/browse-url.el" (20395 3526 841101 0))
 ;;; Generated autoloads from net/browse-url.el
 
 (defvar browse-url-browser-function 'browse-url-default-browser "\
@@ -2624,26 +2627,10 @@ from `browse-url-elinks-wrapper'.
 
 \(fn URL &optional NEW-WINDOW)" t nil)
 
-;;;***
-\f
-;;;### (autoloads (snarf-bruces bruce) "bruce" "play/bruce.el" (20400
-;;;;;;  62402))
-;;; Generated autoloads from play/bruce.el
-
-(autoload 'bruce "bruce" "\
-Adds that special touch of class to your outgoing mail.
-
-\(fn)" t nil)
-
-(autoload 'snarf-bruces "bruce" "\
-Return a vector containing the lines from `bruce-phrases-file'.
-
-\(fn)" nil nil)
-
 ;;;***
 \f
 ;;;### (autoloads (bs-show bs-customize bs-cycle-previous bs-cycle-next)
-;;;;;;  "bs" "bs.el" (20400 62402))
+;;;;;;  "bs" "bs.el" (20369 14251 85829 0))
 ;;; Generated autoloads from bs.el
 
 (autoload 'bs-cycle-next "bs" "\
@@ -2683,7 +2670,8 @@ name of buffer configuration.
 
 ;;;***
 \f
-;;;### (autoloads (bubbles) "bubbles" "play/bubbles.el" (20352 65510))
+;;;### (autoloads (bubbles) "bubbles" "play/bubbles.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from play/bubbles.el
 
 (autoload 'bubbles "bubbles" "\
@@ -2705,7 +2693,7 @@ columns on its right towards the left.
 ;;;***
 \f
 ;;;### (autoloads (bug-reference-prog-mode bug-reference-mode) "bug-reference"
-;;;;;;  "progmodes/bug-reference.el" (20352 65510))
+;;;;;;  "progmodes/bug-reference.el" (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/bug-reference.el
 
 (put 'bug-reference-url-format 'safe-local-variable (lambda (s) (or (stringp s) (and (symbolp s) (get s 'bug-reference-url-format)))))
@@ -2729,7 +2717,7 @@ Like `bug-reference-mode', but only buttonize in comments and strings.
 ;;;;;;  batch-byte-compile-if-not-done display-call-tree byte-compile
 ;;;;;;  compile-defun byte-compile-file byte-recompile-directory
 ;;;;;;  byte-force-recompile byte-compile-enable-warning byte-compile-disable-warning)
-;;;;;;  "bytecomp" "emacs-lisp/bytecomp.el" (20423 1775))
+;;;;;;  "bytecomp" "emacs-lisp/bytecomp.el" (20460 12069 586020 0))
 ;;; Generated autoloads from emacs-lisp/bytecomp.el
 (put 'byte-compile-dynamic 'safe-local-variable 'booleanp)
 (put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp)
@@ -2849,8 +2837,8 @@ and corresponding effects.
 
 ;;;***
 \f
-;;;### (autoloads nil "cal-china" "calendar/cal-china.el" (20352
-;;;;;;  65510))
+;;;### (autoloads nil "cal-china" "calendar/cal-china.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from calendar/cal-china.el
 
 (put 'calendar-chinese-time-zone 'risky-local-variable t)
@@ -2859,7 +2847,8 @@ and corresponding effects.
 
 ;;;***
 \f
-;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (20352 65510))
+;;;### (autoloads nil "cal-dst" "calendar/cal-dst.el" (20461 32935
+;;;;;;  300400 0))
 ;;; Generated autoloads from calendar/cal-dst.el
 
 (put 'calendar-daylight-savings-starts 'risky-local-variable t)
@@ -2871,7 +2860,7 @@ and corresponding effects.
 ;;;***
 \f
 ;;;### (autoloads (calendar-hebrew-list-yahrzeits) "cal-hebrew" "calendar/cal-hebrew.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from calendar/cal-hebrew.el
 
 (autoload 'calendar-hebrew-list-yahrzeits "cal-hebrew" "\
@@ -2887,8 +2876,8 @@ from the cursor position.
 \f
 ;;;### (autoloads (defmath calc-embedded-activate calc-embedded calc-grab-rectangle
 ;;;;;;  calc-grab-region full-calc-keypad calc-keypad calc-eval quick-calc
-;;;;;;  full-calc calc calc-dispatch) "calc" "calc/calc.el" (20400
-;;;;;;  62402))
+;;;;;;  full-calc calc calc-dispatch) "calc" "calc/calc.el" (20407
+;;;;;;  29477 794904 0))
 ;;; Generated autoloads from calc/calc.el
  (define-key ctl-x-map "*" 'calc-dispatch)
 
@@ -2966,14 +2955,14 @@ actual Lisp function name.
 
 See Info node `(calc)Defining Functions'.
 
-\(fn FUNC ARGS &rest BODY)" nil (quote macro))
+\(fn FUNC ARGS &rest BODY)" nil t)
 
 (put 'defmath 'doc-string-elt '3)
 
 ;;;***
 \f
-;;;### (autoloads (calc-undo) "calc-undo" "calc/calc-undo.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (calc-undo) "calc-undo" "calc/calc-undo.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from calc/calc-undo.el
 
 (autoload 'calc-undo "calc-undo" "\
@@ -2983,8 +2972,8 @@ See Info node `(calc)Defining Functions'.
 
 ;;;***
 \f
-;;;### (autoloads (calculator) "calculator" "calculator.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (calculator) "calculator" "calculator.el" (20427
+;;;;;;  14766 970343 0))
 ;;; Generated autoloads from calculator.el
 
 (autoload 'calculator "calculator" "\
@@ -2995,8 +2984,8 @@ See the documentation for `calculator-mode' for more information.
 
 ;;;***
 \f
-;;;### (autoloads (calendar) "calendar" "calendar/calendar.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (calendar) "calendar" "calendar/calendar.el" (20457
+;;;;;;  35879 688143 0))
 ;;; Generated autoloads from calendar/calendar.el
 
 (autoload 'calendar "calendar" "\
@@ -3040,7 +3029,7 @@ This function is suitable for execution in a .emacs file.
 ;;;***
 \f
 ;;;### (autoloads (canlock-verify canlock-insert-header) "canlock"
-;;;;;;  "gnus/canlock.el" (20352 65510))
+;;;;;;  "gnus/canlock.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/canlock.el
 
 (autoload 'canlock-insert-header "canlock" "\
@@ -3058,7 +3047,7 @@ it fails.
 ;;;***
 \f
 ;;;### (autoloads (capitalized-words-mode) "cap-words" "progmodes/cap-words.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/cap-words.el
 
 (autoload 'capitalized-words-mode "cap-words" "\
@@ -3097,15 +3086,15 @@ Obsoletes `c-forward-into-nomenclature'.
 
 ;;;***
 \f
-;;;### (autoloads nil "cc-compat" "progmodes/cc-compat.el" (20352
-;;;;;;  65510))
+;;;### (autoloads nil "cc-compat" "progmodes/cc-compat.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/cc-compat.el
 (put 'c-indent-level 'safe-local-variable 'integerp)
 
 ;;;***
 \f
 ;;;### (autoloads (c-guess-basic-syntax) "cc-engine" "progmodes/cc-engine.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20373 11301 906925 0))
 ;;; Generated autoloads from progmodes/cc-engine.el
 
 (autoload 'c-guess-basic-syntax "cc-engine" "\
@@ -3117,7 +3106,8 @@ Return the syntactic context of the current line.
 \f
 ;;;### (autoloads (c-guess-install c-guess-region-no-install c-guess-region
 ;;;;;;  c-guess-buffer-no-install c-guess-buffer c-guess-no-install
-;;;;;;  c-guess) "cc-guess" "progmodes/cc-guess.el" (20352 65510))
+;;;;;;  c-guess) "cc-guess" "progmodes/cc-guess.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from progmodes/cc-guess.el
 
 (defvar c-guess-guessed-offsets-alist nil "\
@@ -3217,7 +3207,7 @@ the absolute file name of the file if STYLE-NAME is nil.
 \f
 ;;;### (autoloads (awk-mode pike-mode idl-mode java-mode objc-mode
 ;;;;;;  c++-mode c-mode c-initialize-cc-mode) "cc-mode" "progmodes/cc-mode.el"
-;;;;;;  (20365 1028))
+;;;;;;  (20416 44451 205563 0))
 ;;; Generated autoloads from progmodes/cc-mode.el
 
 (autoload 'c-initialize-cc-mode "cc-mode" "\
@@ -3347,7 +3337,7 @@ Key bindings:
 
 (defvar pike-mode-syntax-table nil "\
 Syntax table used in pike-mode buffers.")
- (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(.in\\)?\\)\\'" . pike-mode))
+ (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode))
  (add-to-list 'interpreter-mode-alist '("pike" . pike-mode))
 
 (autoload 'pike-mode "cc-mode" "\
@@ -3394,7 +3384,7 @@ Key bindings:
 ;;;***
 \f
 ;;;### (autoloads (c-set-offset c-add-style c-set-style) "cc-styles"
-;;;;;;  "progmodes/cc-styles.el" (20352 65510))
+;;;;;;  "progmodes/cc-styles.el" (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/cc-styles.el
 
 (autoload 'c-set-style "cc-styles" "\
@@ -3445,7 +3435,8 @@ and exists only for compatibility reasons.
 
 ;;;***
 \f
-;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (20352 65510))
+;;;### (autoloads nil "cc-vars" "progmodes/cc-vars.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from progmodes/cc-vars.el
 (put 'c-basic-offset 'safe-local-variable 'integerp)
 (put 'c-backslash-column 'safe-local-variable 'integerp)
@@ -3455,7 +3446,7 @@ and exists only for compatibility reasons.
 \f
 ;;;### (autoloads (ccl-execute-with-args check-ccl-program define-ccl-program
 ;;;;;;  declare-ccl-program ccl-dump ccl-compile) "ccl" "international/ccl.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from international/ccl.el
 
 (autoload 'ccl-compile "ccl" "\
@@ -3479,7 +3470,7 @@ execution.
 
 Optional arg VECTOR is a compiled CCL code of the CCL program.
 
-\(fn NAME &optional VECTOR)" nil (quote macro))
+\(fn NAME &optional VECTOR)" nil t)
 
 (autoload 'define-ccl-program "ccl" "\
 Set NAME the compiled code of CCL-PROGRAM.
@@ -3692,7 +3683,7 @@ MAP-IDs := MAP-ID ...
 MAP-SET := MAP-IDs | (MAP-IDs) MAP-SET
 MAP-ID := integer
 
-\(fn NAME CCL-PROGRAM &optional DOC)" nil (quote macro))
+\(fn NAME CCL-PROGRAM &optional DOC)" nil t)
 
 (put 'define-ccl-program 'doc-string-elt '3)
 
@@ -3703,7 +3694,7 @@ CCL-PROGRAM, else return nil.
 If CCL-PROGRAM is a vector and optional arg NAME (symbol) is supplied,
 register CCL-PROGRAM by name NAME, and return NAME.
 
-\(fn CCL-PROGRAM &optional NAME)" nil (quote macro))
+\(fn CCL-PROGRAM &optional NAME)" nil t)
 
 (autoload 'ccl-execute-with-args "ccl" "\
 Execute CCL-PROGRAM with registers initialized by the remaining args.
@@ -3716,7 +3707,7 @@ See the documentation of `define-ccl-program' for the detail of CCL program.
 ;;;***
 \f
 ;;;### (autoloads (cconv-closure-convert) "cconv" "emacs-lisp/cconv.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20453 5437 764254 0))
 ;;; Generated autoloads from emacs-lisp/cconv.el
 
 (autoload 'cconv-closure-convert "cconv" "\
@@ -3731,7 +3722,7 @@ Returns a form where all lambdas don't have any free variables.
 ;;;***
 \f
 ;;;### (autoloads (cfengine-auto-mode cfengine2-mode cfengine3-mode)
-;;;;;;  "cfengine" "progmodes/cfengine.el" (20400 62402))
+;;;;;;  "cfengine" "progmodes/cfengine.el" (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/cfengine.el
 
 (autoload 'cfengine3-mode "cfengine" "\
@@ -3761,7 +3752,7 @@ on the buffer contents
 ;;;***
 \f
 ;;;### (autoloads (check-declare-directory check-declare-file) "check-declare"
-;;;;;;  "emacs-lisp/check-declare.el" (20370 20099))
+;;;;;;  "emacs-lisp/check-declare.el" (20378 29222 722320 0))
 ;;; Generated autoloads from emacs-lisp/check-declare.el
 
 (autoload 'check-declare-file "check-declare" "\
@@ -3786,7 +3777,7 @@ Returns non-nil if any false statements are found.
 ;;;;;;  checkdoc-comments checkdoc-continue checkdoc-start checkdoc-current-buffer
 ;;;;;;  checkdoc-eval-current-buffer checkdoc-message-interactive
 ;;;;;;  checkdoc-interactive checkdoc checkdoc-list-of-strings-p)
-;;;;;;  "checkdoc" "emacs-lisp/checkdoc.el" (20400 62402))
+;;;;;;  "checkdoc" "emacs-lisp/checkdoc.el" (20388 65061 302484 0))
 ;;; Generated autoloads from emacs-lisp/checkdoc.el
 (put 'checkdoc-force-docstrings-flag 'safe-local-variable 'booleanp)
 (put 'checkdoc-force-history-flag 'safe-local-variable 'booleanp)
@@ -3982,7 +3973,7 @@ checking of documentation strings.
 \f
 ;;;### (autoloads (pre-write-encode-hz post-read-decode-hz encode-hz-buffer
 ;;;;;;  encode-hz-region decode-hz-buffer decode-hz-region) "china-util"
-;;;;;;  "language/china-util.el" (20352 65510))
+;;;;;;  "language/china-util.el" (20355 10021 546955 0))
 ;;; Generated autoloads from language/china-util.el
 
 (autoload 'decode-hz-region "china-util" "\
@@ -4020,7 +4011,7 @@ Encode the text in the current buffer to HZ.
 ;;;***
 \f
 ;;;### (autoloads (command-history list-command-history repeat-matching-complex-command)
-;;;;;;  "chistory" "chistory.el" (20352 65510))
+;;;;;;  "chistory" "chistory.el" (20355 10021 546955 0))
 ;;; Generated autoloads from chistory.el
 
 (autoload 'repeat-matching-complex-command "chistory" "\
@@ -4057,25 +4048,10 @@ and runs the normal hook `command-history-hook'.
 
 \(fn)" t nil)
 
-;;;***
-\f
-;;;### (autoloads nil "cl" "emacs-lisp/cl.el" (20352 65510))
-;;; Generated autoloads from emacs-lisp/cl.el
-
-(defvar custom-print-functions nil "\
-This is a list of functions that format user objects for printing.
-Each function is called in turn with three arguments: the object, the
-stream, and the print level (currently ignored).  If it is able to
-print the object it returns true; otherwise it returns nil and the
-printer proceeds to the next function on the list.
-
-This variable is not used at present, but it is defined in hopes that
-a future Emacs interpreter will be able to use it.")
-
 ;;;***
 \f
 ;;;### (autoloads (common-lisp-indent-function) "cl-indent" "emacs-lisp/cl-indent.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/cl-indent.el
 
 (autoload 'common-lisp-indent-function "cl-indent" "\
@@ -4151,10 +4127,38 @@ For example, the function `case' has an indent property
 
 \(fn INDENT-POINT STATE)" nil nil)
 
+;;;***
+\f
+;;;### (autoloads nil "cl-lib" "emacs-lisp/cl-lib.el" (20464 9124
+;;;;;;  585807 0))
+;;; Generated autoloads from emacs-lisp/cl-lib.el
+
+(define-obsolete-variable-alias 'custom-print-functions 'cl-custom-print-functions "24.2")
+
+(defvar cl-custom-print-functions nil "\
+This is a list of functions that format user objects for printing.
+Each function is called in turn with three arguments: the object, the
+stream, and the print level (currently ignored).  If it is able to
+print the object it returns true; otherwise it returns nil and the
+printer proceeds to the next function on the list.
+
+This variable is not used at present, but it is defined in hopes that
+a future Emacs interpreter will be able to use it.")
+
+(autoload 'cl--defsubst-expand "cl-macs")
+
+(put 'cl-defun 'doc-string-elt 3)
+
+(put 'cl-defmacro 'doc-string-elt 3)
+
+(put 'cl-defsubst 'doc-string-elt 3)
+
+(put 'cl-defstruct 'doc-string-elt 2)
+
 ;;;***
 \f
 ;;;### (autoloads (c-macro-expand) "cmacexp" "progmodes/cmacexp.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/cmacexp.el
 
 (autoload 'c-macro-expand "cmacexp" "\
@@ -4174,8 +4178,8 @@ For use inside Lisp programs, see also `c-macro-expansion'.
 
 ;;;***
 \f
-;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (run-scheme) "cmuscheme" "cmuscheme.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from cmuscheme.el
 
 (autoload 'run-scheme "cmuscheme" "\
@@ -4195,7 +4199,8 @@ is run).
 
 ;;;***
 \f
-;;;### (autoloads (color-name-to-rgb) "color" "color.el" (20352 65510))
+;;;### (autoloads (color-name-to-rgb) "color" "color.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from color.el
 
 (autoload 'color-name-to-rgb "color" "\
@@ -4217,7 +4222,7 @@ If FRAME cannot display COLOR, return nil.
 ;;;### (autoloads (comint-redirect-results-list-from-process comint-redirect-results-list
 ;;;;;;  comint-redirect-send-command-to-process comint-redirect-send-command
 ;;;;;;  comint-run make-comint make-comint-in-buffer) "comint" "comint.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20464 9124 585807 0))
 ;;; Generated autoloads from comint.el
 
 (defvar comint-output-filter-functions '(ansi-color-process-output comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) "\
@@ -4317,7 +4322,7 @@ REGEXP-GROUP is the regular expression group in REGEXP to use.
 ;;;***
 \f
 ;;;### (autoloads (compare-windows) "compare-w" "vc/compare-w.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from vc/compare-w.el
 
 (autoload 'compare-windows "compare-w" "\
@@ -4354,8 +4359,8 @@ on third call it again advances points to the next difference and so on.
 ;;;;;;  compilation-shell-minor-mode compilation-mode compilation-start
 ;;;;;;  compile compilation-disable-input compile-command compilation-search-path
 ;;;;;;  compilation-ask-about-save compilation-window-height compilation-start-hook
-;;;;;;  compilation-mode-hook) "compile" "progmodes/compile.el" (20400
-;;;;;;  62402))
+;;;;;;  compilation-mode-hook) "compile" "progmodes/compile.el" (20428
+;;;;;;  35620 209002 0))
 ;;; Generated autoloads from progmodes/compile.el
 
 (defvar compilation-mode-hook nil "\
@@ -4379,7 +4384,7 @@ Number of lines in a compilation window.  If nil, use Emacs default.")
 (custom-autoload 'compilation-window-height "compile" t)
 
 (defvar compilation-process-setup-function nil "\
-*Function to call to customize the compilation process.
+Function to call to customize the compilation process.
 This function is called immediately before the compilation process is
 started.  It can be used to set any variables or functions that are used
 while processing the output of the compilation process.")
@@ -4501,6 +4506,8 @@ Runs `compilation-mode-hook' with `run-mode-hooks' (which see).
 
 \(fn &optional NAME-OF-MODE)" t nil)
 
+(put 'define-compilation-mode 'doc-string-elt 3)
+
 (autoload 'compilation-shell-minor-mode "compile" "\
 Toggle Compilation Shell minor mode.
 With a prefix argument ARG, enable Compilation Shell minor mode
@@ -4535,7 +4542,7 @@ This is the value of `next-error-function' in Compilation buffers.
 ;;;***
 \f
 ;;;### (autoloads (dynamic-completion-mode) "completion" "completion.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20388 65061 302484 0))
 ;;; Generated autoloads from completion.el
 
 (defvar dynamic-completion-mode nil "\
@@ -4560,7 +4567,7 @@ if ARG is omitted or nil.
 ;;;### (autoloads (conf-xdefaults-mode conf-ppd-mode conf-colon-mode
 ;;;;;;  conf-space-keywords conf-space-mode conf-javaprop-mode conf-windows-mode
 ;;;;;;  conf-unix-mode conf-mode) "conf-mode" "textmodes/conf-mode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/conf-mode.el
 
 (autoload 'conf-mode "conf-mode" "\
@@ -4716,7 +4723,7 @@ For details see `conf-mode'.  Example:
 ;;;***
 \f
 ;;;### (autoloads (shuffle-vector cookie-snarf cookie-insert cookie)
-;;;;;;  "cookie1" "play/cookie1.el" (20400 62402))
+;;;;;;  "cookie1" "play/cookie1.el" (20364 27900 192709 741000))
 ;;; Generated autoloads from play/cookie1.el
 
 (autoload 'cookie "cookie1" "\
@@ -4748,8 +4755,8 @@ Randomly permute the elements of VECTOR (all permutations equally likely).
 ;;;***
 \f
 ;;;### (autoloads (copyright-update-directory copyright copyright-fix-years
-;;;;;;  copyright-update) "copyright" "emacs-lisp/copyright.el" (20400
-;;;;;;  62402))
+;;;;;;  copyright-update) "copyright" "emacs-lisp/copyright.el" (20387
+;;;;;;  44199 24128 0))
 ;;; Generated autoloads from emacs-lisp/copyright.el
 (put 'copyright-at-end-flag 'safe-local-variable 'booleanp)
 (put 'copyright-names-regexp 'safe-local-variable 'stringp)
@@ -4788,7 +4795,8 @@ If FIX is non-nil, run `copyright-fix-years' instead.
 ;;;***
 \f
 ;;;### (autoloads (cperl-perldoc-at-point cperl-perldoc cperl-mode)
-;;;;;;  "cperl-mode" "progmodes/cperl-mode.el" (20352 65510))
+;;;;;;  "cperl-mode" "progmodes/cperl-mode.el" (20461 32935 300400
+;;;;;;  0))
 ;;; Generated autoloads from progmodes/cperl-mode.el
 (put 'cperl-indent-level 'safe-local-variable 'integerp)
 (put 'cperl-brace-offset 'safe-local-variable 'integerp)
@@ -4987,7 +4995,7 @@ Run a `perldoc' on the word around point.
 ;;;***
 \f
 ;;;### (autoloads (cpp-parse-edit cpp-highlight-buffer) "cpp" "progmodes/cpp.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/cpp.el
 
 (autoload 'cpp-highlight-buffer "cpp" "\
@@ -5006,7 +5014,7 @@ Edit display information for cpp conditionals.
 ;;;***
 \f
 ;;;### (autoloads (crisp-mode crisp-mode) "crisp" "emulation/crisp.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from emulation/crisp.el
 
 (defvar crisp-mode nil "\
@@ -5032,7 +5040,7 @@ if ARG is omitted or nil.
 ;;;***
 \f
 ;;;### (autoloads (completing-read-multiple) "crm" "emacs-lisp/crm.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/crm.el
 
 (autoload 'completing-read-multiple "crm" "\
@@ -5067,8 +5075,8 @@ INHERIT-INPUT-METHOD.
 
 ;;;***
 \f
-;;;### (autoloads (css-mode) "css-mode" "textmodes/css-mode.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (css-mode) "css-mode" "textmodes/css-mode.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from textmodes/css-mode.el
 
 (autoload 'css-mode "css-mode" "\
@@ -5079,7 +5087,7 @@ Major mode to edit Cascading Style Sheets.
 ;;;***
 \f
 ;;;### (autoloads (cua-selection-mode cua-mode) "cua-base" "emulation/cua-base.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20434 17809 692608 0))
 ;;; Generated autoloads from emulation/cua-base.el
 
 (defvar cua-mode nil "\
@@ -5139,7 +5147,7 @@ Enable CUA selection mode without the C-z/C-x/C-c/C-v bindings.
 ;;;;;;  customize-mode customize customize-push-and-save customize-save-variable
 ;;;;;;  customize-set-variable customize-set-value custom-menu-sort-alphabetically
 ;;;;;;  custom-buffer-sort-alphabetically custom-browse-sort-alphabetically)
-;;;;;;  "cus-edit" "cus-edit.el" (20424 24226))
+;;;;;;  "cus-edit" "cus-edit.el" (20437 50597 545250 0))
 ;;; Generated autoloads from cus-edit.el
 
 (defvar custom-browse-sort-alphabetically nil "\
@@ -5244,14 +5252,14 @@ Customize GROUP, which must be a customization group, in another window.
 (defalias 'customize-variable 'customize-option)
 
 (autoload 'customize-option "cus-edit" "\
-Customize SYMBOL, which must be a user option variable.
+Customize SYMBOL, which must be a user option.
 
 \(fn SYMBOL)" t nil)
 
 (defalias 'customize-variable-other-window 'customize-option-other-window)
 
 (autoload 'customize-option-other-window "cus-edit" "\
-Customize SYMBOL, which must be a user option variable.
+Customize SYMBOL, which must be a user option.
 Show the buffer in another window, but don't select it.
 
 \(fn SYMBOL)" t nil)
@@ -5291,9 +5299,10 @@ the official name of the package, such as MH-E or Gnus.")
 
 (autoload 'customize-changed-options "cus-edit" "\
 Customize all settings whose meanings have changed in Emacs itself.
-This includes new user option variables and faces, and new
-customization groups, as well as older options and faces whose meanings
-or default values have changed since the previous major Emacs release.
+This includes new user options and faces, and new customization
+groups, as well as older options and faces whose meanings or
+default values have changed since the previous major Emacs
+release.
 
 With argument SINCE-VERSION (a string), customize all settings
 that were added or redefined since that version.
@@ -5337,7 +5346,7 @@ Customize all saved options and faces.
 \(fn)" t nil)
 
 (autoload 'customize-apropos "cus-edit" "\
-Customize all loaded options, faces and groups matching PATTERN.
+Customize loaded options, faces and groups matching PATTERN.
 PATTERN can be a word, a list of words (separated by spaces),
 or a regexp (using some regexp special characters).  If it is a word,
 search for matches for that word as a substring.  If it is a list of words,
@@ -5346,18 +5355,13 @@ search for matches for any two (or more) of those words.
 If TYPE is `options', include only options.
 If TYPE is `faces', include only faces.
 If TYPE is `groups', include only groups.
-If TYPE is t (interactively, with prefix arg), include variables
-that are not customizable options, as well as faces and groups
-\(but we recommend using `apropos-variable' instead).
 
 \(fn PATTERN &optional TYPE)" t nil)
 
 (autoload 'customize-apropos-options "cus-edit" "\
 Customize all loaded customizable options matching REGEXP.
-With prefix ARG, include variables that are not customizable options
-\(but it is better to use `apropos-variable' if you want to find those).
 
-\(fn REGEXP &optional ARG)" t nil)
+\(fn REGEXP &optional IGNORED)" t nil)
 
 (autoload 'customize-apropos-faces "cus-edit" "\
 Customize all loaded faces matching REGEXP.
@@ -5455,8 +5459,8 @@ The format is suitable for use with `easy-menu-define'.
 ;;;***
 \f
 ;;;### (autoloads (customize-themes describe-theme custom-theme-visit-theme
-;;;;;;  customize-create-theme) "cus-theme" "cus-theme.el" (20352
-;;;;;;  65510))
+;;;;;;  customize-create-theme) "cus-theme" "cus-theme.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from cus-theme.el
 
 (autoload 'customize-create-theme "cus-theme" "\
@@ -5490,7 +5494,7 @@ omitted, a buffer named *Custom Themes* is used.
 ;;;***
 \f
 ;;;### (autoloads (cvs-status-mode) "cvs-status" "vc/cvs-status.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from vc/cvs-status.el
 
 (autoload 'cvs-status-mode "cvs-status" "\
@@ -5501,7 +5505,7 @@ Mode used for cvs status output.
 ;;;***
 \f
 ;;;### (autoloads (global-cwarn-mode turn-on-cwarn-mode cwarn-mode)
-;;;;;;  "cwarn" "progmodes/cwarn.el" (20400 62402))
+;;;;;;  "cwarn" "progmodes/cwarn.el" (20439 5925 915283 0))
 ;;; Generated autoloads from progmodes/cwarn.el
 
 (autoload 'cwarn-mode "cwarn" "\
@@ -5552,7 +5556,7 @@ See `cwarn-mode' for more information on Cwarn mode.
 \f
 ;;;### (autoloads (standard-display-cyrillic-translit cyrillic-encode-alternativnyj-char
 ;;;;;;  cyrillic-encode-koi8-r-char) "cyril-util" "language/cyril-util.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from language/cyril-util.el
 
 (autoload 'cyrillic-encode-koi8-r-char "cyril-util" "\
@@ -5581,7 +5585,7 @@ If the argument is nil, we return the display table to its standard state.
 ;;;***
 \f
 ;;;### (autoloads (dabbrev-expand dabbrev-completion) "dabbrev" "dabbrev.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20397 45851 446679 0))
 ;;; Generated autoloads from dabbrev.el
 (put 'dabbrev-case-fold-search 'risky-local-variable t)
 (put 'dabbrev-case-replace 'risky-local-variable t)
@@ -5628,7 +5632,7 @@ See also `dabbrev-abbrev-char-regexp' and \\[dabbrev-completion].
 ;;;***
 \f
 ;;;### (autoloads (data-debug-new-buffer) "data-debug" "cedet/data-debug.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from cedet/data-debug.el
 
 (autoload 'data-debug-new-buffer "data-debug" "\
@@ -5638,8 +5642,8 @@ Create a new data-debug buffer with NAME.
 
 ;;;***
 \f
-;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (20440
+;;;;;;  54677 388705 0))
 ;;; Generated autoloads from net/dbus.el
 
 (autoload 'dbus-handle-event "dbus" "\
@@ -5652,8 +5656,8 @@ If the HANDLER returns a `dbus-error', it is propagated as return message.
 
 ;;;***
 \f
-;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (dcl-mode) "dcl-mode" "progmodes/dcl-mode.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/dcl-mode.el
 
 (autoload 'dcl-mode "dcl-mode" "\
@@ -5780,7 +5784,7 @@ There is some minimal font-lock support (see vars
 ;;;***
 \f
 ;;;### (autoloads (cancel-debug-on-entry debug-on-entry debug) "debug"
-;;;;;;  "emacs-lisp/debug.el" (20352 65510))
+;;;;;;  "emacs-lisp/debug.el" (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/debug.el
 
 (setq debugger 'debug)
@@ -5824,7 +5828,7 @@ To specify a nil argument interactively, exit with an empty minibuffer.
 ;;;***
 \f
 ;;;### (autoloads (decipher-mode decipher) "decipher" "play/decipher.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from play/decipher.el
 
 (autoload 'decipher "decipher" "\
@@ -5853,8 +5857,8 @@ The most useful commands are:
 ;;;***
 \f
 ;;;### (autoloads (delimit-columns-rectangle delimit-columns-region
-;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (20352
-;;;;;;  65510))
+;;;;;;  delimit-columns-customize) "delim-col" "delim-col.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from delim-col.el
 
 (autoload 'delimit-columns-customize "delim-col" "\
@@ -5878,8 +5882,8 @@ START and END delimits the corners of text rectangle.
 
 ;;;***
 \f
-;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (delphi-mode) "delphi" "progmodes/delphi.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/delphi.el
 
 (autoload 'delphi-mode "delphi" "\
@@ -5930,8 +5934,8 @@ with no args, if that value is non-nil.
 
 ;;;***
 \f
-;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from delsel.el
 
 (defalias 'pending-delete-mode 'delete-selection-mode)
@@ -5961,7 +5965,7 @@ any selection.
 ;;;***
 \f
 ;;;### (autoloads (derived-mode-init-mode-variables define-derived-mode)
-;;;;;;  "derived" "emacs-lisp/derived.el" (20352 65510))
+;;;;;;  "derived" "emacs-lisp/derived.el" (20437 50597 545250 0))
 ;;; Generated autoloads from emacs-lisp/derived.el
 
 (autoload 'define-derived-mode "derived" "\
@@ -6013,7 +6017,7 @@ The new mode runs the hook constructed by the function
 
 See Info node `(elisp)Derived Modes' for more details.
 
-\(fn CHILD PARENT NAME &optional DOCSTRING &rest BODY)" nil (quote macro))
+\(fn CHILD PARENT NAME &optional DOCSTRING &rest BODY)" nil t)
 
 (put 'define-derived-mode 'doc-string-elt '4)
 
@@ -6028,7 +6032,7 @@ the first time the mode is used.
 ;;;***
 \f
 ;;;### (autoloads (describe-char describe-text-properties) "descr-text"
-;;;;;;  "descr-text.el" (20400 62402))
+;;;;;;  "descr-text.el" (20433 53542 563193 0))
 ;;; Generated autoloads from descr-text.el
 
 (autoload 'describe-text-properties "descr-text" "\
@@ -6065,7 +6069,7 @@ relevant to POS.
 ;;;### (autoloads (desktop-revert desktop-save-in-desktop-dir desktop-change-dir
 ;;;;;;  desktop-load-default desktop-read desktop-remove desktop-save
 ;;;;;;  desktop-clear desktop-locals-to-save desktop-save-mode) "desktop"
-;;;;;;  "desktop.el" (20420 42151))
+;;;;;;  "desktop.el" (20450 62630 628906 0))
 ;;; Generated autoloads from desktop.el
 
 (defvar desktop-save-mode nil "\
@@ -6252,7 +6256,7 @@ Revert to the last loaded desktop.
 \f
 ;;;### (autoloads (gnus-article-outlook-deuglify-article gnus-outlook-deuglify-article
 ;;;;;;  gnus-article-outlook-repair-attribution gnus-article-outlook-unwrap-lines)
-;;;;;;  "deuglify" "gnus/deuglify.el" (20352 65510))
+;;;;;;  "deuglify" "gnus/deuglify.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/deuglify.el
 
 (autoload 'gnus-article-outlook-unwrap-lines "deuglify" "\
@@ -6285,7 +6289,7 @@ Deuglify broken Outlook (Express) articles and redisplay.
 ;;;***
 \f
 ;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib"
-;;;;;;  "calendar/diary-lib.el" (20352 65510))
+;;;;;;  "calendar/diary-lib.el" (20355 10021 546955 0))
 ;;; Generated autoloads from calendar/diary-lib.el
 
 (autoload 'diary "diary-lib" "\
@@ -6328,7 +6332,7 @@ Major mode for editing the diary file.
 ;;;***
 \f
 ;;;### (autoloads (diff-buffer-with-file diff-backup diff diff-command
-;;;;;;  diff-switches) "diff" "vc/diff.el" (20400 62402))
+;;;;;;  diff-switches) "diff" "vc/diff.el" (20379 50083 187499 0))
 ;;; Generated autoloads from vc/diff.el
 
 (defvar diff-switches (purecopy "-c") "\
@@ -6372,7 +6376,7 @@ This requires the external program `diff' to be in your `exec-path'.
 ;;;***
 \f
 ;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "vc/diff-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20415 23587 118149 0))
 ;;; Generated autoloads from vc/diff-mode.el
 
 (autoload 'diff-mode "diff-mode" "\
@@ -6404,7 +6408,7 @@ the mode if ARG is omitted or nil.
 
 ;;;***
 \f
-;;;### (autoloads (dig) "dig" "net/dig.el" (20352 65510))
+;;;### (autoloads (dig) "dig" "net/dig.el" (20355 10021 546955 0))
 ;;; Generated autoloads from net/dig.el
 
 (autoload 'dig "dig" "\
@@ -6416,7 +6420,8 @@ Optional arguments are passed to `dig-invoke'.
 ;;;***
 \f
 ;;;### (autoloads (dired-mode dired-noselect dired-other-frame dired-other-window
-;;;;;;  dired dired-listing-switches) "dired" "dired.el" (20400 62402))
+;;;;;;  dired dired-listing-switches) "dired" "dired.el" (20452 17962
+;;;;;;  966427 0))
 ;;; Generated autoloads from dired.el
 
 (defvar dired-listing-switches (purecopy "-al") "\
@@ -6538,7 +6543,7 @@ Keybindings:
 ;;;***
 \f
 ;;;### (autoloads (dirtrack dirtrack-mode) "dirtrack" "dirtrack.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20399 35365 4050 0))
 ;;; Generated autoloads from dirtrack.el
 
 (autoload 'dirtrack-mode "dirtrack" "\
@@ -6568,8 +6573,8 @@ from `default-directory'.
 
 ;;;***
 \f
-;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (disassemble) "disass" "emacs-lisp/disass.el" (20433
+;;;;;;  53542 563193 0))
 ;;; Generated autoloads from emacs-lisp/disass.el
 
 (autoload 'disassemble "disass" "\
@@ -6588,7 +6593,7 @@ redefine OBJECT if it is a symbol.
 ;;;;;;  standard-display-g1 standard-display-ascii standard-display-default
 ;;;;;;  standard-display-8bit describe-current-display-table describe-display-table
 ;;;;;;  set-display-table-slot display-table-slot make-display-table)
-;;;;;;  "disp-table" "disp-table.el" (20352 65510))
+;;;;;;  "disp-table" "disp-table.el" (20355 10021 546955 0))
 ;;; Generated autoloads from disp-table.el
 
 (autoload 'make-display-table "disp-table" "\
@@ -6710,7 +6715,7 @@ in `.emacs'.
 ;;;***
 \f
 ;;;### (autoloads (dissociated-press) "dissociate" "play/dissociate.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from play/dissociate.el
 
 (autoload 'dissociated-press "dissociate" "\
@@ -6726,7 +6731,8 @@ Default is 2.
 
 ;;;***
 \f
-;;;### (autoloads (dnd-protocol-alist) "dnd" "dnd.el" (20352 65510))
+;;;### (autoloads (dnd-protocol-alist) "dnd" "dnd.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from dnd.el
 
 (defvar dnd-protocol-alist `((,(purecopy "^file:///") . dnd-open-local-file) (,(purecopy "^file://") . dnd-open-file) (,(purecopy "^file:") . dnd-open-local-file) (,(purecopy "^\\(https?\\|ftp\\|file\\|nfs\\)://") . dnd-open-file)) "\
@@ -6747,7 +6753,7 @@ if some action was made, or nil if the URL is ignored.")
 ;;;***
 \f
 ;;;### (autoloads (dns-mode-soa-increment-serial dns-mode) "dns-mode"
-;;;;;;  "textmodes/dns-mode.el" (20352 65510))
+;;;;;;  "textmodes/dns-mode.el" (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/dns-mode.el
 
 (autoload 'dns-mode "dns-mode" "\
@@ -6771,8 +6777,8 @@ Locate SOA record and increment the serial field.
 ;;;***
 \f
 ;;;### (autoloads (doc-view-bookmark-jump doc-view-minor-mode doc-view-mode-maybe
-;;;;;;  doc-view-mode doc-view-mode-p) "doc-view" "doc-view.el" (20400
-;;;;;;  62402))
+;;;;;;  doc-view-mode doc-view-mode-p) "doc-view" "doc-view.el" (20458
+;;;;;;  56750 651721 0))
 ;;; Generated autoloads from doc-view.el
 
 (autoload 'doc-view-mode-p "doc-view" "\
@@ -6818,7 +6824,8 @@ See the command `doc-view-mode' for more information on this mode.
 
 ;;;***
 \f
-;;;### (autoloads (doctor) "doctor" "play/doctor.el" (20352 65510))
+;;;### (autoloads (doctor) "doctor" "play/doctor.el" (20443 2992
+;;;;;;  177196 0))
 ;;; Generated autoloads from play/doctor.el
 
 (autoload 'doctor "doctor" "\
@@ -6828,7 +6835,8 @@ Switch to *doctor* buffer and start giving psychotherapy.
 
 ;;;***
 \f
-;;;### (autoloads (double-mode) "double" "double.el" (20352 65510))
+;;;### (autoloads (double-mode) "double" "double.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from double.el
 
 (autoload 'double-mode "double" "\
@@ -6844,7 +6852,8 @@ strings when pressed twice.  See `double-map' for details.
 
 ;;;***
 \f
-;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (20352 65510))
+;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from play/dunnet.el
 
 (autoload 'dunnet "dunnet" "\
@@ -6856,7 +6865,7 @@ Switch to *dungeon* buffer and start game.
 \f
 ;;;### (autoloads (easy-mmode-defsyntax easy-mmode-defmap easy-mmode-define-keymap
 ;;;;;;  define-globalized-minor-mode define-minor-mode) "easy-mmode"
-;;;;;;  "emacs-lisp/easy-mmode.el" (20400 62402))
+;;;;;;  "emacs-lisp/easy-mmode.el" (20459 40320 865360 0))
 ;;; Generated autoloads from emacs-lisp/easy-mmode.el
 
 (defalias 'easy-mmode-define-minor-mode 'define-minor-mode)
@@ -6876,7 +6885,7 @@ the mode if the argument is `toggle'.  If DOC is nil this
 function adds a basic doc-string stating these facts.
 
 Optional INIT-VALUE is the initial value of the mode's variable.
-Optional LIGHTER is displayed in the modeline when the mode is on.
+Optional LIGHTER is displayed in the mode line when the mode is on.
 Optional KEYMAP is the default keymap bound to the mode keymap.
   If non-nil, it should be a variable name (whose value is a keymap),
   or an expression that returns either a keymap or a list of
@@ -6920,7 +6929,9 @@ For example, you could write
     :lighter \" Foo\" :require 'foo :global t :group 'hassle :version \"27.5\"
     ...BODY CODE...)
 
-\(fn MODE DOC &optional INIT-VALUE LIGHTER KEYMAP &rest BODY)" nil (quote macro))
+\(fn MODE DOC &optional INIT-VALUE LIGHTER KEYMAP &rest BODY)" nil t)
+
+(put 'define-minor-mode 'doc-string-elt '2)
 
 (defalias 'easy-mmode-define-global-mode 'define-globalized-minor-mode)
 
@@ -6945,7 +6956,9 @@ correctly with the current major mode.  This is important to
 prevent problems with derived modes, that is, major modes that
 call another major mode in their body.
 
-\(fn GLOBAL-MODE MODE TURN-ON &rest KEYS)" nil (quote macro))
+\(fn GLOBAL-MODE MODE TURN-ON &rest KEYS)" nil t)
+
+(put 'define-globalized-minor-mode 'doc-string-elt '2)
 
 (autoload 'easy-mmode-define-keymap "easy-mmode" "\
 Return a keymap built from bindings BS.
@@ -6971,19 +6984,19 @@ Define a constant M whose value is the result of `easy-mmode-define-keymap'.
 The M, BS, and ARGS arguments are as per that function.  DOC is
 the constant's documentation.
 
-\(fn M BS DOC &rest ARGS)" nil (quote macro))
+\(fn M BS DOC &rest ARGS)" nil t)
 
 (autoload 'easy-mmode-defsyntax "easy-mmode" "\
 Define variable ST as a syntax-table.
 CSS contains a list of syntax specifications of the form (CHAR . SYNTAX).
 
-\(fn ST CSS DOC &rest ARGS)" nil (quote macro))
+\(fn ST CSS DOC &rest ARGS)" nil t)
 
 ;;;***
 \f
 ;;;### (autoloads (easy-menu-change easy-menu-create-menu easy-menu-do-define
-;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (20352
-;;;;;;  65510))
+;;;;;;  easy-menu-define) "easymenu" "emacs-lisp/easymenu.el" (20437
+;;;;;;  50597 545250 0))
 ;;; Generated autoloads from emacs-lisp/easymenu.el
 
 (autoload 'easy-menu-define "easymenu" "\
@@ -7092,7 +7105,7 @@ as a solid horizontal line.
 
 A menu item can be a list with the same format as MENU.  This is a submenu.
 
-\(fn SYMBOL MAPS DOC MENU)" nil (quote macro))
+\(fn SYMBOL MAPS DOC MENU)" nil t)
 
 (put 'easy-menu-define 'lisp-indent-function 'defun)
 
@@ -7137,7 +7150,7 @@ To implement dynamic menus, either call this from
 ;;;;;;  ebnf-eps-file ebnf-eps-directory ebnf-spool-region ebnf-spool-buffer
 ;;;;;;  ebnf-spool-file ebnf-spool-directory ebnf-print-region ebnf-print-buffer
 ;;;;;;  ebnf-print-file ebnf-print-directory ebnf-customize) "ebnf2ps"
-;;;;;;  "progmodes/ebnf2ps.el" (20400 62402))
+;;;;;;  "progmodes/ebnf2ps.el" (20373 11301 906925 0))
 ;;; Generated autoloads from progmodes/ebnf2ps.el
 
 (autoload 'ebnf-customize "ebnf2ps" "\
@@ -7411,8 +7424,8 @@ See `ebnf-style-database' documentation.
 ;;;;;;  ebrowse-tags-find-declaration-other-window ebrowse-tags-find-definition
 ;;;;;;  ebrowse-tags-view-definition ebrowse-tags-find-declaration
 ;;;;;;  ebrowse-tags-view-declaration ebrowse-member-mode ebrowse-electric-choose-tree
-;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (20400
-;;;;;;  62402))
+;;;;;;  ebrowse-tree-mode) "ebrowse" "progmodes/ebrowse.el" (20459
+;;;;;;  40320 865360 0))
 ;;; Generated autoloads from progmodes/ebrowse.el
 
 (autoload 'ebrowse-tree-mode "ebrowse" "\
@@ -7561,32 +7574,40 @@ Display statistics for a class tree.
 ;;;***
 \f
 ;;;### (autoloads (electric-buffer-list) "ebuff-menu" "ebuff-menu.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20436 29731 313079 0))
 ;;; Generated autoloads from ebuff-menu.el
 
 (autoload 'electric-buffer-list "ebuff-menu" "\
-Pop up a buffer describing the set of Emacs buffers.
-Vaguely like ITS lunar select buffer; combining typeoutoid buffer
-listing with menuoid buffer selection.
-
-If the very next character typed is a space then the buffer list
-window disappears.  Otherwise, one may move around in the buffer list
-window, marking buffers to be selected, saved or deleted.
-
-To exit and select a new buffer, type a space when the cursor is on
-the appropriate line of the buffer-list window.  Other commands are
-much like those of `Buffer-menu-mode'.
+Pop up the Buffer Menu in an \"electric\" window.
+If you type SPC or RET (`Electric-buffer-menu-select'), that
+selects the buffer at point and quits the \"electric\" window.
+Otherwise, you can move around in the Buffer Menu, marking
+buffers to be selected, saved or deleted; these other commands
+are much like those of `Buffer-menu-mode'.
 
 Run hooks in `electric-buffer-menu-mode-hook' on entry.
 
-\\{electric-buffer-menu-mode-map}
+\\<electric-buffer-menu-mode-map>
+\\[keyboard-quit] or \\[Electric-buffer-menu-quit] -- exit buffer menu, returning to previous window and buffer
+  configuration.  If the very first character typed is a space, it
+  also has this effect.
+\\[Electric-buffer-menu-select] -- select buffer of line point is on.
+  Also show buffers marked with m in other windows,
+  deletes buffers marked with \"D\", and saves those marked with \"S\".
+\\[Buffer-menu-mark] -- mark buffer to be displayed.
+\\[Buffer-menu-not-modified] -- clear modified-flag on that buffer.
+\\[Buffer-menu-save] -- mark that buffer to be saved.
+\\[Buffer-menu-delete] or \\[Buffer-menu-delete-backwards] -- mark that buffer to be deleted.
+\\[Buffer-menu-unmark] -- remove all kinds of marks from current line.
+\\[Electric-buffer-menu-mode-view-buffer] -- view buffer, returning when done.
+\\[Buffer-menu-backup-unmark] -- back up a line and remove marks.
 
 \(fn ARG)" t nil)
 
 ;;;***
 \f
 ;;;### (autoloads (Electric-command-history-redo-expression) "echistory"
-;;;;;;  "echistory.el" (20352 65510))
+;;;;;;  "echistory.el" (20355 10021 546955 0))
 ;;; Generated autoloads from echistory.el
 
 (autoload 'Electric-command-history-redo-expression "echistory" "\
@@ -7598,7 +7619,7 @@ With prefix arg NOCONFIRM, execute current line as-is without editing.
 ;;;***
 \f
 ;;;### (autoloads (ecomplete-setup) "ecomplete" "gnus/ecomplete.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/ecomplete.el
 
 (autoload 'ecomplete-setup "ecomplete" "\
@@ -7608,7 +7629,8 @@ With prefix arg NOCONFIRM, execute current line as-is without editing.
 
 ;;;***
 \f
-;;;### (autoloads (global-ede-mode) "ede" "cedet/ede.el" (20352 65510))
+;;;### (autoloads (global-ede-mode) "ede" "cedet/ede.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from cedet/ede.el
 
 (defvar global-ede-mode nil "\
@@ -7635,7 +7657,7 @@ an EDE controlled project.
 \f
 ;;;### (autoloads (edebug-all-forms edebug-all-defs edebug-eval-top-level-form
 ;;;;;;  edebug-basic-spec edebug-all-forms edebug-all-defs) "edebug"
-;;;;;;  "emacs-lisp/edebug.el" (20400 62402))
+;;;;;;  "emacs-lisp/edebug.el" (20440 54677 388705 0))
 ;;; Generated autoloads from emacs-lisp/edebug.el
 
 (defvar edebug-all-defs nil "\
@@ -7708,7 +7730,8 @@ Toggle edebugging of all forms.
 ;;;;;;  ediff-merge-directories-with-ancestor ediff-merge-directories
 ;;;;;;  ediff-directories3 ediff-directory-revisions ediff-directories
 ;;;;;;  ediff-buffers3 ediff-buffers ediff-backup ediff-current-file
-;;;;;;  ediff-files3 ediff-files) "ediff" "vc/ediff.el" (20400 62402))
+;;;;;;  ediff-files3 ediff-files) "ediff" "vc/ediff.el" (20373 11301
+;;;;;;  906925 0))
 ;;; Generated autoloads from vc/ediff.el
 
 (autoload 'ediff-files "ediff" "\
@@ -7940,7 +7963,7 @@ With optional NODE, goes to that node.
 ;;;***
 \f
 ;;;### (autoloads (ediff-customize) "ediff-help" "vc/ediff-help.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from vc/ediff-help.el
 
 (autoload 'ediff-customize "ediff-help" "\
@@ -7951,7 +7974,7 @@ With optional NODE, goes to that node.
 ;;;***
 \f
 ;;;### (autoloads (ediff-show-registry) "ediff-mult" "vc/ediff-mult.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from vc/ediff-mult.el
 
 (autoload 'ediff-show-registry "ediff-mult" "\
@@ -7964,7 +7987,7 @@ Display Ediff's registry.
 ;;;***
 \f
 ;;;### (autoloads (ediff-toggle-use-toolbar ediff-toggle-multiframe)
-;;;;;;  "ediff-util" "vc/ediff-util.el" (20352 65510))
+;;;;;;  "ediff-util" "vc/ediff-util.el" (20355 10021 546955 0))
 ;;; Generated autoloads from vc/ediff-util.el
 
 (autoload 'ediff-toggle-multiframe "ediff-util" "\
@@ -7985,7 +8008,7 @@ To change the default, set the variable `ediff-use-toolbar-p', which see.
 \f
 ;;;### (autoloads (format-kbd-macro read-kbd-macro edit-named-kbd-macro
 ;;;;;;  edit-last-kbd-macro edit-kbd-macro) "edmacro" "edmacro.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20438 24016 194668 0))
 ;;; Generated autoloads from edmacro.el
 
 (autoload 'edit-kbd-macro "edmacro" "\
@@ -8034,7 +8057,7 @@ or nil, use a compact 80-column format.
 ;;;***
 \f
 ;;;### (autoloads (edt-emulation-on edt-set-scroll-margins) "edt"
-;;;;;;  "emulation/edt.el" (20352 65510))
+;;;;;;  "emulation/edt.el" (20448 20900 17488 0))
 ;;; Generated autoloads from emulation/edt.el
 
 (autoload 'edt-set-scroll-margins "edt" "\
@@ -8052,7 +8075,7 @@ Turn on EDT Emulation.
 ;;;***
 \f
 ;;;### (autoloads (electric-helpify with-electric-help) "ehelp" "ehelp.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from ehelp.el
 
 (autoload 'with-electric-help "ehelp" "\
@@ -8089,7 +8112,7 @@ BUFFER is put back into its original major mode.
 ;;;***
 \f
 ;;;### (autoloads (turn-on-eldoc-mode eldoc-mode eldoc-minor-mode-string)
-;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (20352 65510))
+;;;;;;  "eldoc" "emacs-lisp/eldoc.el" (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/eldoc.el
 
 (defvar eldoc-minor-mode-string (purecopy " ElDoc") "\
@@ -8136,7 +8159,7 @@ Emacs Lisp mode) that support ElDoc.")
 ;;;***
 \f
 ;;;### (autoloads (electric-layout-mode electric-pair-mode electric-indent-mode)
-;;;;;;  "electric" "electric.el" (20400 62402))
+;;;;;;  "electric" "electric.el" (20369 14251 85829 0))
 ;;; Generated autoloads from electric.el
 
 (defvar electric-indent-chars '(10) "\
@@ -8206,8 +8229,8 @@ The variable `electric-layout-rules' says when and how to insert newlines.
 
 ;;;***
 \f
-;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (elide-head) "elide-head" "elide-head.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from elide-head.el
 
 (autoload 'elide-head "elide-head" "\
@@ -8224,7 +8247,7 @@ This is suitable as an entry on `find-file-hook' or appropriate mode hooks.
 \f
 ;;;### (autoloads (elint-initialize elint-defun elint-current-buffer
 ;;;;;;  elint-directory elint-file) "elint" "emacs-lisp/elint.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20421 62373 255269 0))
 ;;; Generated autoloads from emacs-lisp/elint.el
 
 (autoload 'elint-file "elint" "\
@@ -8260,8 +8283,8 @@ optional prefix argument REINIT is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (elp-results elp-instrument-package elp-instrument-list
-;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (20352
-;;;;;;  65510))
+;;;;;;  elp-instrument-function) "elp" "emacs-lisp/elp.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/elp.el
 
 (autoload 'elp-instrument-function "elp" "\
@@ -8296,7 +8319,7 @@ displayed.
 ;;;***
 \f
 ;;;### (autoloads (emacs-lock-mode) "emacs-lock" "emacs-lock.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20399 35365 4050 0))
 ;;; Generated autoloads from emacs-lock.el
 
 (autoload 'emacs-lock-mode "emacs-lock" "\
@@ -8324,7 +8347,7 @@ Other values are interpreted as usual.
 ;;;***
 \f
 ;;;### (autoloads (report-emacs-bug-query-existing-bugs report-emacs-bug)
-;;;;;;  "emacsbug" "mail/emacsbug.el" (20400 62402))
+;;;;;;  "emacsbug" "mail/emacsbug.el" (20431 40251 885267 983000))
 ;;; Generated autoloads from mail/emacsbug.el
 
 (autoload 'report-emacs-bug "emacsbug" "\
@@ -8345,7 +8368,7 @@ The result is an alist with items of the form (URL SUBJECT NO).
 ;;;;;;  emerge-revisions emerge-files-with-ancestor-remote emerge-files-remote
 ;;;;;;  emerge-files-with-ancestor-command emerge-files-command emerge-buffers-with-ancestor
 ;;;;;;  emerge-buffers emerge-files-with-ancestor emerge-files) "emerge"
-;;;;;;  "vc/emerge.el" (20400 62402))
+;;;;;;  "vc/emerge.el" (20355 10021 546955 0))
 ;;; Generated autoloads from vc/emerge.el
 
 (autoload 'emerge-files "emerge" "\
@@ -8406,7 +8429,7 @@ Emerge two RCS revisions of a file, with another revision as ancestor.
 ;;;***
 \f
 ;;;### (autoloads (enriched-decode enriched-encode enriched-mode)
-;;;;;;  "enriched" "textmodes/enriched.el" (20352 65510))
+;;;;;;  "enriched" "textmodes/enriched.el" (20461 32935 300400 0))
 ;;; Generated autoloads from textmodes/enriched.el
 
 (autoload 'enriched-mode "enriched" "\
@@ -8446,8 +8469,8 @@ Commands:
 ;;;;;;  epa-sign-region epa-verify-cleartext-in-region epa-verify-region
 ;;;;;;  epa-decrypt-armor-in-region epa-decrypt-region epa-encrypt-file
 ;;;;;;  epa-sign-file epa-verify-file epa-decrypt-file epa-select-keys
-;;;;;;  epa-list-secret-keys epa-list-keys) "epa" "epa.el" (20400
-;;;;;;  62402))
+;;;;;;  epa-list-secret-keys epa-list-keys) "epa" "epa.el" (20434
+;;;;;;  17809 692608 0))
 ;;; Generated autoloads from epa.el
 
 (autoload 'epa-list-keys "epa" "\
@@ -8625,7 +8648,8 @@ Insert selected KEYS after the point.
 ;;;***
 \f
 ;;;### (autoloads (epa-dired-do-encrypt epa-dired-do-sign epa-dired-do-verify
-;;;;;;  epa-dired-do-decrypt) "epa-dired" "epa-dired.el" (20352 65510))
+;;;;;;  epa-dired-do-decrypt) "epa-dired" "epa-dired.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from epa-dired.el
 
 (autoload 'epa-dired-do-decrypt "epa-dired" "\
@@ -8651,7 +8675,7 @@ Encrypt marked files.
 ;;;***
 \f
 ;;;### (autoloads (epa-file-disable epa-file-enable epa-file-handler)
-;;;;;;  "epa-file" "epa-file.el" (20352 65510))
+;;;;;;  "epa-file" "epa-file.el" (20355 10021 546955 0))
 ;;; Generated autoloads from epa-file.el
 
 (autoload 'epa-file-handler "epa-file" "\
@@ -8673,7 +8697,7 @@ Encrypt marked files.
 \f
 ;;;### (autoloads (epa-global-mail-mode epa-mail-import-keys epa-mail-encrypt
 ;;;;;;  epa-mail-sign epa-mail-verify epa-mail-decrypt epa-mail-mode)
-;;;;;;  "epa-mail" "epa-mail.el" (20352 65510))
+;;;;;;  "epa-mail" "epa-mail.el" (20355 10021 546955 0))
 ;;; Generated autoloads from epa-mail.el
 
 (autoload 'epa-mail-mode "epa-mail" "\
@@ -8743,7 +8767,8 @@ if ARG is omitted or nil.
 
 ;;;***
 \f
-;;;### (autoloads (epg-make-context) "epg" "epg.el" (20352 65510))
+;;;### (autoloads (epg-make-context) "epg" "epg.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from epg.el
 
 (autoload 'epg-make-context "epg" "\
@@ -8754,7 +8779,7 @@ Return a context object.
 ;;;***
 \f
 ;;;### (autoloads (epg-expand-group epg-check-configuration epg-configuration)
-;;;;;;  "epg-config" "epg-config.el" (20400 62402))
+;;;;;;  "epg-config" "epg-config.el" (20373 11301 906925 0))
 ;;; Generated autoloads from epg-config.el
 
 (autoload 'epg-configuration "epg-config" "\
@@ -8775,7 +8800,7 @@ Look at CONFIG and try to expand GROUP.
 ;;;***
 \f
 ;;;### (autoloads (erc-handle-irc-url erc-tls erc erc-select-read-args)
-;;;;;;  "erc" "erc/erc.el" (20400 62402))
+;;;;;;  "erc" "erc/erc.el" (20444 23842 968143 0))
 ;;; Generated autoloads from erc/erc.el
 
 (autoload 'erc-select-read-args "erc" "\
@@ -8823,33 +8848,36 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-autoaway" "erc/erc-autoaway.el" (20400
-;;;;;;  62402))
+;;;### (autoloads nil "erc-autoaway" "erc/erc-autoaway.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from erc/erc-autoaway.el
  (autoload 'erc-autoaway-mode "erc-autoaway")
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-button" "erc/erc-button.el" (20400 62402))
+;;;### (autoloads nil "erc-button" "erc/erc-button.el" (20434 17809
+;;;;;;  692608 0))
 ;;; Generated autoloads from erc/erc-button.el
  (autoload 'erc-button-mode "erc-button" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-capab" "erc/erc-capab.el" (20352 65510))
+;;;### (autoloads nil "erc-capab" "erc/erc-capab.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from erc/erc-capab.el
  (autoload 'erc-capab-identify-mode "erc-capab" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-compat" "erc/erc-compat.el" (20352 65510))
+;;;### (autoloads nil "erc-compat" "erc/erc-compat.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from erc/erc-compat.el
  (autoload 'erc-define-minor-mode "erc-compat")
 
 ;;;***
 \f
 ;;;### (autoloads (erc-ctcp-query-DCC pcomplete/erc-mode/DCC erc-cmd-DCC)
-;;;;;;  "erc-dcc" "erc/erc-dcc.el" (20400 62402))
+;;;;;;  "erc-dcc" "erc/erc-dcc.el" (20439 5925 915283 0))
 ;;; Generated autoloads from erc/erc-dcc.el
  (autoload 'erc-dcc-mode "erc-dcc")
 
@@ -8867,7 +8895,7 @@ Provides completion for the /DCC command.
 \(fn)" nil nil)
 
 (defvar erc-ctcp-query-DCC-hook '(erc-ctcp-query-DCC) "\
-Hook variable for CTCP DCC queries")
+Hook variable for CTCP DCC queries.")
 
 (autoload 'erc-ctcp-query-DCC "erc-dcc" "\
 The function called when a CTCP DCC request is detected by the client.
@@ -8882,7 +8910,7 @@ that subcommand.
 ;;;;;;  erc-ezb-add-session erc-ezb-end-of-session-list erc-ezb-init-session-list
 ;;;;;;  erc-ezb-identify erc-ezb-notice-autodetect erc-ezb-lookup-action
 ;;;;;;  erc-ezb-get-login erc-cmd-ezb) "erc-ezbounce" "erc/erc-ezbounce.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-ezbounce.el
 
 (autoload 'erc-cmd-ezb "erc-ezbounce" "\
@@ -8944,8 +8972,8 @@ Add EZBouncer convenience functions to ERC.
 
 ;;;***
 \f
-;;;### (autoloads (erc-fill) "erc-fill" "erc/erc-fill.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (erc-fill) "erc-fill" "erc/erc-fill.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from erc/erc-fill.el
  (autoload 'erc-fill-mode "erc-fill" nil t)
 
@@ -8958,7 +8986,7 @@ You can put this on `erc-insert-modify-hook' and/or `erc-send-modify-hook'.
 ;;;***
 \f
 ;;;### (autoloads (erc-identd-stop erc-identd-start) "erc-identd"
-;;;;;;  "erc/erc-identd.el" (20352 65510))
+;;;;;;  "erc/erc-identd.el" (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-identd.el
  (autoload 'erc-identd-mode "erc-identd")
 
@@ -8980,7 +9008,7 @@ system.
 ;;;***
 \f
 ;;;### (autoloads (erc-create-imenu-index) "erc-imenu" "erc/erc-imenu.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-imenu.el
 
 (autoload 'erc-create-imenu-index "erc-imenu" "\
@@ -8990,20 +9018,22 @@ system.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-join" "erc/erc-join.el" (20400 62402))
+;;;### (autoloads nil "erc-join" "erc/erc-join.el" (20356 2211 532900
+;;;;;;  0))
 ;;; Generated autoloads from erc/erc-join.el
  (autoload 'erc-autojoin-mode "erc-join" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-list" "erc/erc-list.el" (20352 65510))
+;;;### (autoloads nil "erc-list" "erc/erc-list.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from erc/erc-list.el
  (autoload 'erc-list-mode "erc-list")
 
 ;;;***
 \f
 ;;;### (autoloads (erc-save-buffer-in-logs erc-logging-enabled) "erc-log"
-;;;;;;  "erc/erc-log.el" (20400 62402))
+;;;;;;  "erc/erc-log.el" (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-log.el
  (autoload 'erc-log-mode "erc-log" nil t)
 
@@ -9035,7 +9065,7 @@ You can save every individual message by putting this function on
 ;;;### (autoloads (erc-delete-dangerous-host erc-add-dangerous-host
 ;;;;;;  erc-delete-keyword erc-add-keyword erc-delete-fool erc-add-fool
 ;;;;;;  erc-delete-pal erc-add-pal) "erc-match" "erc/erc-match.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20434 17809 692608 0))
 ;;; Generated autoloads from erc/erc-match.el
  (autoload 'erc-match-mode "erc-match")
 
@@ -9081,14 +9111,15 @@ Delete dangerous-host interactively to `erc-dangerous-hosts'.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (20352 65510))
+;;;### (autoloads nil "erc-menu" "erc/erc-menu.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from erc/erc-menu.el
  (autoload 'erc-menu-mode "erc-menu" nil t)
 
 ;;;***
 \f
 ;;;### (autoloads (erc-cmd-WHOLEFT) "erc-netsplit" "erc/erc-netsplit.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-netsplit.el
  (autoload 'erc-netsplit-mode "erc-netsplit")
 
@@ -9100,7 +9131,7 @@ Show who's gone.
 ;;;***
 \f
 ;;;### (autoloads (erc-server-select erc-determine-network) "erc-networks"
-;;;;;;  "erc/erc-networks.el" (20352 65510))
+;;;;;;  "erc/erc-networks.el" (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-networks.el
 
 (autoload 'erc-determine-network "erc-networks" "\
@@ -9118,7 +9149,7 @@ Interactively select a server to connect to using `erc-server-alist'.
 ;;;***
 \f
 ;;;### (autoloads (pcomplete/erc-mode/NOTIFY erc-cmd-NOTIFY) "erc-notify"
-;;;;;;  "erc/erc-notify.el" (20400 62402))
+;;;;;;  "erc/erc-notify.el" (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-notify.el
  (autoload 'erc-notify-mode "erc-notify" nil t)
 
@@ -9136,33 +9167,37 @@ with args, toggle notify status of people.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-page" "erc/erc-page.el" (20352 65510))
+;;;### (autoloads nil "erc-page" "erc/erc-page.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from erc/erc-page.el
  (autoload 'erc-page-mode "erc-page")
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-pcomplete" "erc/erc-pcomplete.el" (20400
-;;;;;;  62402))
+;;;### (autoloads nil "erc-pcomplete" "erc/erc-pcomplete.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from erc/erc-pcomplete.el
  (autoload 'erc-completion-mode "erc-pcomplete" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-replace" "erc/erc-replace.el" (20352 65510))
+;;;### (autoloads nil "erc-replace" "erc/erc-replace.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from erc/erc-replace.el
  (autoload 'erc-replace-mode "erc-replace")
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (20352 65510))
+;;;### (autoloads nil "erc-ring" "erc/erc-ring.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from erc/erc-ring.el
  (autoload 'erc-ring-mode "erc-ring" nil t)
 
 ;;;***
 \f
 ;;;### (autoloads (erc-nickserv-identify erc-nickserv-identify-mode)
-;;;;;;  "erc-services" "erc/erc-services.el" (20400 62402))
+;;;;;;  "erc-services" "erc/erc-services.el" (20357 58785 834364
+;;;;;;  0))
 ;;; Generated autoloads from erc/erc-services.el
  (autoload 'erc-services-mode "erc-services" nil t)
 
@@ -9179,14 +9214,15 @@ When called interactively, read the password using `read-passwd'.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-sound" "erc/erc-sound.el" (20400 62402))
+;;;### (autoloads nil "erc-sound" "erc/erc-sound.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from erc/erc-sound.el
  (autoload 'erc-sound-mode "erc-sound")
 
 ;;;***
 \f
 ;;;### (autoloads (erc-speedbar-browser) "erc-speedbar" "erc/erc-speedbar.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-speedbar.el
 
 (autoload 'erc-speedbar-browser "erc-speedbar" "\
@@ -9197,21 +9233,22 @@ This will add a speedbar major display mode.
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-spelling" "erc/erc-spelling.el" (20352
-;;;;;;  65510))
+;;;### (autoloads nil "erc-spelling" "erc/erc-spelling.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from erc/erc-spelling.el
  (autoload 'erc-spelling-mode "erc-spelling" nil t)
 
 ;;;***
 \f
-;;;### (autoloads nil "erc-stamp" "erc/erc-stamp.el" (20400 62402))
+;;;### (autoloads nil "erc-stamp" "erc/erc-stamp.el" (20434 17809
+;;;;;;  692608 0))
 ;;; Generated autoloads from erc/erc-stamp.el
  (autoload 'erc-timestamp-mode "erc-stamp" nil t)
 
 ;;;***
 \f
 ;;;### (autoloads (erc-track-minor-mode) "erc-track" "erc/erc-track.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from erc/erc-track.el
 
 (defvar erc-track-minor-mode nil "\
@@ -9237,7 +9274,8 @@ keybindings will not do anything useful.
 ;;;***
 \f
 ;;;### (autoloads (erc-truncate-buffer erc-truncate-buffer-to-size)
-;;;;;;  "erc-truncate" "erc/erc-truncate.el" (20400 62402))
+;;;;;;  "erc-truncate" "erc/erc-truncate.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from erc/erc-truncate.el
  (autoload 'erc-truncate-mode "erc-truncate" nil t)
 
@@ -9257,7 +9295,7 @@ Meant to be used in hooks, like `erc-insert-post-hook'.
 ;;;***
 \f
 ;;;### (autoloads (erc-xdcc-add-file) "erc-xdcc" "erc/erc-xdcc.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from erc/erc-xdcc.el
  (autoload 'erc-xdcc-mode "erc-xdcc")
 
@@ -9270,7 +9308,7 @@ Add a file to `erc-xdcc-files'.
 \f
 ;;;### (autoloads (ert-describe-test ert-run-tests-interactively
 ;;;;;;  ert-run-tests-batch-and-exit ert-run-tests-batch ert-deftest)
-;;;;;;  "ert" "emacs-lisp/ert.el" (20400 62402))
+;;;;;;  "ert" "emacs-lisp/ert.el" (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/ert.el
 
 (autoload 'ert-deftest "ert" "\
@@ -9290,10 +9328,6 @@ description of valid values for RESULT-TYPE.
 
 \(fn NAME () [DOCSTRING] [:expected-result RESULT-TYPE] [:tags '(TAG...)] BODY...)" nil (quote macro))
 
-(put 'ert-deftest 'lisp-indent-function '2)
-
-(put 'ert-deftest 'doc-string-elt '3)
-
 (put 'ert-deftest 'lisp-indent-function 2)
 
 (put 'ert-info 'lisp-indent-function 1)
@@ -9340,7 +9374,7 @@ Display the documentation for TEST-OR-TEST-NAME (a symbol or ert-test).
 ;;;***
 \f
 ;;;### (autoloads (ert-kill-all-test-buffers) "ert-x" "emacs-lisp/ert-x.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20364 28960 773408 688000))
 ;;; Generated autoloads from emacs-lisp/ert-x.el
 
 (put 'ert-with-test-buffer 'lisp-indent-function 1)
@@ -9352,8 +9386,8 @@ Kill all test buffers that are still live.
 
 ;;;***
 \f
-;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (20427
+;;;;;;  14766 970343 0))
 ;;; Generated autoloads from eshell/esh-mode.el
 
 (autoload 'eshell-mode "esh-mode" "\
@@ -9366,7 +9400,7 @@ Emacs shell interactive mode.
 ;;;***
 \f
 ;;;### (autoloads (eshell-command-result eshell-command eshell) "eshell"
-;;;;;;  "eshell/eshell.el" (20400 62402))
+;;;;;;  "eshell/eshell.el" (20458 56750 651721 0))
 ;;; Generated autoloads from eshell/eshell.el
 
 (autoload 'eshell "eshell" "\
@@ -9407,11 +9441,11 @@ corresponding to a successful execution.
 ;;;;;;  visit-tags-table tags-table-mode find-tag-default-function
 ;;;;;;  find-tag-hook tags-add-tables tags-compression-info-list
 ;;;;;;  tags-table-list tags-case-fold-search) "etags" "progmodes/etags.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20388 65061 302484 0))
 ;;; Generated autoloads from progmodes/etags.el
 
 (defvar tags-file-name nil "\
-*File name of tags table.
+File name of tags table.
 To switch to a new tags table, setting this variable is sufficient.
 If you set this variable, do not also set `tags-table-list'.
 Use the `etags' program to make a tags table file.")
@@ -9419,14 +9453,14 @@ Use the `etags' program to make a tags table file.")
  (put 'tags-file-name 'safe-local-variable 'stringp)
 
 (defvar tags-case-fold-search 'default "\
-*Whether tags operations should be case-sensitive.
+Whether tags operations should be case-sensitive.
 A value of t means case-insensitive, a value of nil means case-sensitive.
 Any other value means use the setting of `case-fold-search'.")
 
 (custom-autoload 'tags-case-fold-search "etags" t)
 
 (defvar tags-table-list nil "\
-*List of file names of tags tables to search.
+List of file names of tags tables to search.
 An element that is a directory means the file \"TAGS\" in that directory.
 To switch to a new list of tags tables, setting this variable is sufficient.
 If you set this variable, do not also set `tags-file-name'.
@@ -9435,7 +9469,7 @@ Use the `etags' program to make a tags table file.")
 (custom-autoload 'tags-table-list "etags" t)
 
 (defvar tags-compression-info-list (purecopy '("" ".Z" ".bz2" ".gz" ".xz" ".tgz")) "\
-*List of extensions tried by etags when jka-compr is used.
+List of extensions tried by etags when jka-compr is used.
 An empty string means search the non-compressed file.
 These extensions will be tried only if jka-compr was activated
 \(i.e. via customize of `auto-compression-mode' or by calling the function
@@ -9444,7 +9478,7 @@ These extensions will be tried only if jka-compr was activated
 (custom-autoload 'tags-compression-info-list "etags" t)
 
 (defvar tags-add-tables 'ask-user "\
-*Control whether to add a new tags table to the current list.
+Control whether to add a new tags table to the current list.
 t means do; nil means don't (always start a new list).
 Any other value means ask the user whether to add a new tags table
 to the current list (as opposed to starting a new list).")
@@ -9452,14 +9486,14 @@ to the current list (as opposed to starting a new list).")
 (custom-autoload 'tags-add-tables "etags" t)
 
 (defvar find-tag-hook nil "\
-*Hook to be run by \\[find-tag] after finding a tag.  See `run-hooks'.
+Hook to be run by \\[find-tag] after finding a tag.  See `run-hooks'.
 The value in the buffer in which \\[find-tag] is done is used,
 not the value in the buffer \\[find-tag] goes to.")
 
 (custom-autoload 'find-tag-hook "etags" t)
 
 (defvar find-tag-default-function nil "\
-*A function of no arguments used by \\[find-tag] to pick a default tag.
+A function of no arguments used by \\[find-tag] to pick a default tag.
 If nil, and the symbol that is the value of `major-mode'
 has a `find-tag-default-function' property (see `put'), that is used.
 Otherwise, `find-tag-default' is used.")
@@ -9725,7 +9759,7 @@ for \\[find-tag] (which see).
 ;;;;;;  ethio-fidel-to-sera-marker ethio-fidel-to-sera-region ethio-fidel-to-sera-buffer
 ;;;;;;  ethio-sera-to-fidel-marker ethio-sera-to-fidel-region ethio-sera-to-fidel-buffer
 ;;;;;;  setup-ethiopic-environment-internal) "ethio-util" "language/ethio-util.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from language/ethio-util.el
 
 (autoload 'setup-ethiopic-environment-internal "ethio-util" "\
@@ -9895,7 +9929,7 @@ With ARG, insert that many delimiters.
 \f
 ;;;### (autoloads (eudc-load-eudc eudc-query-form eudc-expand-inline
 ;;;;;;  eudc-get-phone eudc-get-email eudc-set-server) "eudc" "net/eudc.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from net/eudc.el
 
 (autoload 'eudc-set-server "eudc" "\
@@ -9951,7 +9985,7 @@ This does nothing except loading eudc by autoload side-effect.
 \f
 ;;;### (autoloads (eudc-display-jpeg-as-button eudc-display-jpeg-inline
 ;;;;;;  eudc-display-sound eudc-display-mail eudc-display-url eudc-display-generic-binary)
-;;;;;;  "eudc-bob" "net/eudc-bob.el" (20352 65510))
+;;;;;;  "eudc-bob" "net/eudc-bob.el" (20355 10021 546955 0))
 ;;; Generated autoloads from net/eudc-bob.el
 
 (autoload 'eudc-display-generic-binary "eudc-bob" "\
@@ -9987,7 +10021,7 @@ Display a button for the JPEG DATA.
 ;;;***
 \f
 ;;;### (autoloads (eudc-try-bbdb-insert eudc-insert-record-at-point-into-bbdb)
-;;;;;;  "eudc-export" "net/eudc-export.el" (20352 65510))
+;;;;;;  "eudc-export" "net/eudc-export.el" (20355 10021 546955 0))
 ;;; Generated autoloads from net/eudc-export.el
 
 (autoload 'eudc-insert-record-at-point-into-bbdb "eudc-export" "\
@@ -10004,7 +10038,7 @@ Call `eudc-insert-record-at-point-into-bbdb' if on a record.
 ;;;***
 \f
 ;;;### (autoloads (eudc-edit-hotlist) "eudc-hotlist" "net/eudc-hotlist.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from net/eudc-hotlist.el
 
 (autoload 'eudc-edit-hotlist "eudc-hotlist" "\
@@ -10014,8 +10048,8 @@ Edit the hotlist of directory servers in a specialized buffer.
 
 ;;;***
 \f
-;;;### (autoloads (ewoc-create) "ewoc" "emacs-lisp/ewoc.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (ewoc-create) "ewoc" "emacs-lisp/ewoc.el" (20453
+;;;;;;  5437 764254 0))
 ;;; Generated autoloads from emacs-lisp/ewoc.el
 
 (autoload 'ewoc-create "ewoc" "\
@@ -10044,7 +10078,7 @@ fourth arg NOSEP non-nil inhibits this.
 ;;;### (autoloads (executable-make-buffer-file-executable-if-script-p
 ;;;;;;  executable-self-display executable-set-magic executable-interpret
 ;;;;;;  executable-command-find-posix-p) "executable" "progmodes/executable.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/executable.el
 
 (autoload 'executable-command-find-posix-p "executable" "\
@@ -10087,7 +10121,7 @@ file modes.
 \f
 ;;;### (autoloads (expand-jump-to-next-slot expand-jump-to-previous-slot
 ;;;;;;  expand-abbrev-hook expand-add-abbrevs) "expand" "expand.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from expand.el
 
 (autoload 'expand-add-abbrevs "expand" "\
@@ -10136,7 +10170,8 @@ This is used only in conjunction with `expand-add-abbrevs'.
 
 ;;;***
 \f
-;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (20400 62402))
+;;;### (autoloads (f90-mode) "f90" "progmodes/f90.el" (20461 32935
+;;;;;;  300400 0))
 ;;; Generated autoloads from progmodes/f90.el
 
 (autoload 'f90-mode "f90" "\
@@ -10206,8 +10241,8 @@ with no args, if that value is non-nil.
 ;;;### (autoloads (variable-pitch-mode buffer-face-toggle buffer-face-set
 ;;;;;;  buffer-face-mode text-scale-adjust text-scale-decrease text-scale-increase
 ;;;;;;  text-scale-set face-remap-set-base face-remap-reset-base
-;;;;;;  face-remap-add-relative) "face-remap" "face-remap.el" (20400
-;;;;;;  62402))
+;;;;;;  face-remap-add-relative) "face-remap" "face-remap.el" (20445
+;;;;;;  44711 217937 0))
 ;;; Generated autoloads from face-remap.el
 
 (autoload 'face-remap-add-relative "face-remap" "\
@@ -10215,14 +10250,19 @@ Add a face remapping entry of FACE to SPECS in the current buffer.
 Return a cookie which can be used to delete this remapping with
 `face-remap-remove-relative'.
 
-The remaining arguments, SPECS, should be either a list of face
-names, or a property list of face attribute/value pairs.  The
-remapping specified by SPECS takes effect alongside the
-remappings from other calls to `face-remap-add-relative', as well
-as the normal definition of FACE (at lowest priority).  This
-function tries to sort multiple remappings for the same face, so
-that remappings specifying relative face attributes are applied
-after remappings specifying absolute face attributes.
+The remaining arguments, SPECS, should form a list of faces.
+Each list element should be either a face name or a property list
+of face attribute/value pairs.  If more than one face is listed,
+that specifies an aggregate face, in the same way as in a `face'
+text property, except for possible priority changes noted below.
+
+The face remapping specified by SPECS takes effect alongside the
+remappings from other calls to `face-remap-add-relative' for the
+same FACE, as well as the normal definition of FACE (at lowest
+priority).  This function tries to sort multiple remappings for
+the same face, so that remappings specifying relative face
+attributes are applied after remappings specifying absolute face
+attributes.
 
 The base (lowest priority) remapping may be set to something
 other than the normal definition of FACE via `face-remap-set-base'.
@@ -10239,9 +10279,11 @@ to apply on top of the normal definition of FACE.
 (autoload 'face-remap-set-base "face-remap" "\
 Set the base remapping of FACE in the current buffer to SPECS.
 This causes the remappings specified by `face-remap-add-relative'
-to apply on top of the face specification given by SPECS.  SPECS
-should be either a list of face names, or a property list of face
-attribute/value pairs.
+to apply on top of the face specification given by SPECS.
+
+The remaining arguments, SPECS, should form a list of faces.
+Each list element should be either a face name or a property list
+of face attribute/value pairs, like in a `face' text property.
 
 If SPECS is empty, call `face-remap-reset-base' to use the normal
 definition of FACE as the base remapping; note that this is
@@ -10320,19 +10362,23 @@ variable `buffer-face-mode-face' is used to display the buffer text.
 
 (autoload 'buffer-face-set "face-remap" "\
 Enable `buffer-face-mode', using face specs SPECS.
-SPECS can be any value suitable for the `face' text property,
-including a face name, a list of face names, or a face-attribute
-If SPECS is nil, then `buffer-face-mode' is disabled.
+Each argument in SPECS should be a face, i.e. either a face name
+or a property list of face attributes and values.  If more than
+one face is listed, that specifies an aggregate face, like in a
+`face' text property.  If SPECS is nil or omitted, disable
+`buffer-face-mode'.
 
-This function will make the variable `buffer-face-mode-face'
-buffer local, and set it to FACE.
+This function makes the variable `buffer-face-mode-face' buffer
+local, and sets it to FACE.
 
 \(fn &rest SPECS)" t nil)
 
 (autoload 'buffer-face-toggle "face-remap" "\
 Toggle `buffer-face-mode', using face specs SPECS.
-SPECS can be any value suitable for the `face' text property,
-including a face name, a list of face names, or a face-attribute
+Each argument in SPECS should be a face, i.e. either a face name
+or a property list of face attributes and values.  If more than
+one face is listed, that specifies an aggregate face, like in a
+`face' text property.
 
 If `buffer-face-mode' is already enabled, and is currently using
 the face specs SPECS, then it is disabled; if buffer-face-mode is
@@ -10355,7 +10401,8 @@ Besides the choice of face, it is the same as `buffer-face-mode'.
 \f
 ;;;### (autoloads (feedmail-queue-reminder feedmail-run-the-queue
 ;;;;;;  feedmail-run-the-queue-global-prompt feedmail-run-the-queue-no-prompts
-;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (20400 62402))
+;;;;;;  feedmail-send-it) "feedmail" "mail/feedmail.el" (20387 44199
+;;;;;;  24128 0))
 ;;; Generated autoloads from mail/feedmail.el
 
 (autoload 'feedmail-send-it "feedmail" "\
@@ -10408,8 +10455,9 @@ you can set `feedmail-queue-reminder-alist' to nil.
 
 ;;;***
 \f
-;;;### (autoloads (ffap-bindings dired-at-point ffap-at-mouse ffap-menu
-;;;;;;  find-file-at-point ffap-next) "ffap" "ffap.el" (20400 62402))
+;;;### (autoloads (ffap-bindings ffap-guess-file-name-at-point dired-at-point
+;;;;;;  ffap-at-mouse ffap-menu find-file-at-point ffap-next) "ffap"
+;;;;;;  "ffap.el" (20395 38306 463596 0))
 ;;; Generated autoloads from ffap.el
 
 (autoload 'ffap-next "ffap" "\
@@ -10459,9 +10507,11 @@ If `dired-at-point-require-prefix' is set, the prefix meaning is reversed.
 
 \(fn &optional FILENAME)" t nil)
 
-(defun ffap-guess-file-name-at-point nil "\
+(autoload 'ffap-guess-file-name-at-point "ffap" "\
 Try to get a file name at point.
-This hook is intended to be put in `file-name-at-point-functions'." (when (fboundp (quote ffap-guesser)) (let ((guess (ffap-guesser))) (setq guess (if (or (not guess) (and (fboundp (quote ffap-url-p)) (ffap-url-p guess)) (and (fboundp (quote ffap-file-remote-p)) (ffap-file-remote-p guess))) guess (abbreviate-file-name (expand-file-name guess)))) (when guess (if (file-directory-p guess) (file-name-as-directory guess) guess)))))
+This hook is intended to be put in `file-name-at-point-functions'.
+
+\(fn)" nil nil)
 
 (autoload 'ffap-bindings "ffap" "\
 Evaluate the forms in variable `ffap-bindings'.
@@ -10473,7 +10523,7 @@ Evaluate the forms in variable `ffap-bindings'.
 ;;;### (autoloads (file-cache-minibuffer-complete file-cache-add-directory-recursively
 ;;;;;;  file-cache-add-directory-using-locate file-cache-add-directory-using-find
 ;;;;;;  file-cache-add-file file-cache-add-directory-list file-cache-add-directory)
-;;;;;;  "filecache" "filecache.el" (20352 65510))
+;;;;;;  "filecache" "filecache.el" (20355 10021 546955 0))
 ;;; Generated autoloads from filecache.el
 
 (autoload 'file-cache-add-directory "filecache" "\
@@ -10533,7 +10583,8 @@ the name is considered already unique; only the second substitution
 ;;;;;;  copy-file-locals-to-dir-locals delete-dir-local-variable
 ;;;;;;  add-dir-local-variable delete-file-local-variable-prop-line
 ;;;;;;  add-file-local-variable-prop-line delete-file-local-variable
-;;;;;;  add-file-local-variable) "files-x" "files-x.el" (20400 62402))
+;;;;;;  add-file-local-variable) "files-x" "files-x.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from files-x.el
 
 (autoload 'add-file-local-variable "files-x" "\
@@ -10598,8 +10649,8 @@ Copy directory-local variables to the -*- line.
 
 ;;;***
 \f
-;;;### (autoloads (filesets-init) "filesets" "filesets.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (filesets-init) "filesets" "filesets.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from filesets.el
 
 (autoload 'filesets-init "filesets" "\
@@ -10610,7 +10661,8 @@ Set up hooks, load the cache file -- if existing -- and build the menu.
 
 ;;;***
 \f
-;;;### (autoloads (find-cmd) "find-cmd" "find-cmd.el" (20352 65510))
+;;;### (autoloads (find-cmd) "find-cmd" "find-cmd.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from find-cmd.el
 
 (autoload 'find-cmd "find-cmd" "\
@@ -10630,7 +10682,7 @@ result is a string that should be ready for the command line.
 ;;;***
 \f
 ;;;### (autoloads (find-grep-dired find-name-dired find-dired) "find-dired"
-;;;;;;  "find-dired.el" (20352 65510))
+;;;;;;  "find-dired.el" (20355 10021 546955 0))
 ;;; Generated autoloads from find-dired.el
 
 (autoload 'find-dired "find-dired" "\
@@ -10669,18 +10721,20 @@ use in place of \"-ls\" as the final argument.
 ;;;***
 \f
 ;;;### (autoloads (ff-mouse-find-other-file-other-window ff-mouse-find-other-file
-;;;;;;  ff-find-other-file ff-get-other-file) "find-file" "find-file.el"
-;;;;;;  (20400 62402))
+;;;;;;  ff-find-other-file ff-get-other-file ff-special-constructs)
+;;;;;;  "find-file" "find-file.el" (20387 44199 24128 0))
 ;;; Generated autoloads from find-file.el
 
 (defvar ff-special-constructs `((,(purecopy "^#\\s *\\(include\\|import\\)\\s +[<\"]\\(.*\\)[>\"]") lambda nil (buffer-substring (match-beginning 2) (match-end 2)))) "\
-*List of special constructs for `ff-treat-as-special' to recognize.
+List of special constructs recognized by `ff-treat-as-special'.
 Each element, tried in order, has the form (REGEXP . EXTRACT).
 If REGEXP matches the current line (from the beginning of the line),
 `ff-treat-as-special' calls function EXTRACT with no args.
 If EXTRACT returns nil, keep trying.  Otherwise, return the
 filename that EXTRACT returned.")
 
+(custom-autoload 'ff-special-constructs "find-file" t)
+
 (autoload 'ff-get-other-file "find-file" "\
 Find the header or source file corresponding to this file.
 See also the documentation for `ff-find-other-file'.
@@ -10764,7 +10818,7 @@ Visit the file you click on in another window.
 ;;;;;;  find-variable find-variable-noselect find-function-other-frame
 ;;;;;;  find-function-other-window find-function find-function-noselect
 ;;;;;;  find-function-search-for-symbol find-library) "find-func"
-;;;;;;  "emacs-lisp/find-func.el" (20352 65510))
+;;;;;;  "emacs-lisp/find-func.el" (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/find-func.el
 
 (autoload 'find-library "find-func" "\
@@ -10923,7 +10977,8 @@ Define some key bindings for the find-function family of functions.
 ;;;***
 \f
 ;;;### (autoloads (find-lisp-find-dired-filter find-lisp-find-dired-subdirectories
-;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (20352 65510))
+;;;;;;  find-lisp-find-dired) "find-lisp" "find-lisp.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from find-lisp.el
 
 (autoload 'find-lisp-find-dired "find-lisp" "\
@@ -10944,7 +10999,7 @@ Change the filter on a find-lisp-find-dired buffer to REGEXP.
 ;;;***
 \f
 ;;;### (autoloads (finder-by-keyword finder-commentary finder-list-keywords)
-;;;;;;  "finder" "finder.el" (20352 65510))
+;;;;;;  "finder" "finder.el" (20355 10021 546955 0))
 ;;; Generated autoloads from finder.el
 
 (autoload 'finder-list-keywords "finder" "\
@@ -10966,7 +11021,7 @@ Find packages matching a given keyword.
 ;;;***
 \f
 ;;;### (autoloads (enable-flow-control-on enable-flow-control) "flow-ctrl"
-;;;;;;  "flow-ctrl.el" (20352 65510))
+;;;;;;  "flow-ctrl.el" (20355 10021 546955 0))
 ;;; Generated autoloads from flow-ctrl.el
 
 (autoload 'enable-flow-control "flow-ctrl" "\
@@ -10988,7 +11043,7 @@ to get the effect of a C-q.
 ;;;***
 \f
 ;;;### (autoloads (fill-flowed fill-flowed-encode) "flow-fill" "gnus/flow-fill.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/flow-fill.el
 
 (autoload 'fill-flowed-encode "flow-fill" "\
@@ -11004,7 +11059,8 @@ to get the effect of a C-q.
 ;;;***
 \f
 ;;;### (autoloads (flymake-find-file-hook flymake-mode-off flymake-mode-on
-;;;;;;  flymake-mode) "flymake" "progmodes/flymake.el" (20400 62402))
+;;;;;;  flymake-mode) "flymake" "progmodes/flymake.el" (20458 56750
+;;;;;;  651721 0))
 ;;; Generated autoloads from progmodes/flymake.el
 
 (autoload 'flymake-mode "flymake" "\
@@ -11034,7 +11090,7 @@ Turn flymake mode off.
 \f
 ;;;### (autoloads (flyspell-buffer flyspell-region flyspell-mode-off
 ;;;;;;  turn-off-flyspell turn-on-flyspell flyspell-mode flyspell-prog-mode)
-;;;;;;  "flyspell" "textmodes/flyspell.el" (20400 62402))
+;;;;;;  "flyspell" "textmodes/flyspell.el" (20434 17809 692608 0))
 ;;; Generated autoloads from textmodes/flyspell.el
 
 (autoload 'flyspell-prog-mode "flyspell" "\
@@ -11106,7 +11162,7 @@ Flyspell whole buffer.
 \f
 ;;;### (autoloads (follow-delete-other-windows-and-split follow-mode
 ;;;;;;  turn-off-follow-mode turn-on-follow-mode) "follow" "follow.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20387 44199 24128 0))
 ;;; Generated autoloads from follow.el
 
 (autoload 'turn-on-follow-mode "follow" "\
@@ -11149,10 +11205,6 @@ To split one large window into two side-by-side windows, the commands
 
 Only windows displayed in the same frame follow each other.
 
-If the variable `follow-intercept-processes' is non-nil, Follow mode
-will listen to the output of processes and redisplay accordingly.
-\(This is the default.)
-
 This command runs the normal hook `follow-mode-hook'.
 
 Keys specific to Follow mode:
@@ -11174,16 +11226,12 @@ If ARG is positive, the leftmost window is selected.  If negative,
 the rightmost is selected.  If ARG is nil, the leftmost window is
 selected if the original window is the first one in the frame.
 
-To bind this command to a hotkey, place the following line
-in your `~/.emacs' file, replacing [f7] by your favorite key:
-    (global-set-key [f7] 'follow-delete-other-windows-and-split)
-
 \(fn &optional ARG)" t nil)
 
 ;;;***
 \f
-;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (footnote-mode) "footnote" "mail/footnote.el" (20387
+;;;;;;  44199 24128 0))
 ;;; Generated autoloads from mail/footnote.el
 
 (autoload 'footnote-mode "footnote" "\
@@ -11202,7 +11250,7 @@ play around with the following keys:
 ;;;***
 \f
 ;;;### (autoloads (forms-find-file-other-window forms-find-file forms-mode)
-;;;;;;  "forms" "forms.el" (20400 62402))
+;;;;;;  "forms" "forms.el" (20427 14766 970343 0))
 ;;; Generated autoloads from forms.el
 
 (autoload 'forms-mode "forms" "\
@@ -11239,7 +11287,7 @@ Visit a file in Forms mode in other window.
 ;;;***
 \f
 ;;;### (autoloads (fortran-mode) "fortran" "progmodes/fortran.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20438 24024 724594 589000))
 ;;; Generated autoloads from progmodes/fortran.el
 
 (autoload 'fortran-mode "fortran" "\
@@ -11317,7 +11365,8 @@ with no args, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (fortune fortune-to-signature fortune-compile fortune-from-region
-;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (20352 65510))
+;;;;;;  fortune-add-fortune) "fortune" "play/fortune.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from play/fortune.el
 
 (autoload 'fortune-add-fortune "fortune" "\
@@ -11366,13 +11415,24 @@ and choose the directory as the fortune-file.
 ;;;***
 \f
 ;;;### (autoloads (gdb gdb-enable-debug) "gdb-mi" "progmodes/gdb-mi.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20415 53309 822770 0))
 ;;; Generated autoloads from progmodes/gdb-mi.el
 
 (defvar gdb-enable-debug nil "\
-Non-nil means record the process input and output in `gdb-debug-log'.")
+Non-nil if Gdb-Enable-Debug mode is enabled.
+See the command `gdb-enable-debug' for a description of this minor mode.")
 
-(custom-autoload 'gdb-enable-debug "gdb-mi" t)
+(custom-autoload 'gdb-enable-debug "gdb-mi" nil)
+
+(autoload 'gdb-enable-debug "gdb-mi" "\
+Toggle logging of transaction between Emacs and Gdb.
+The log is stored in `gdb-debug-log' as an alist with elements
+whose cons is send, send-item or recv and whose cdr is the string
+being transferred.  This list may grow up to a size of
+`gdb-debug-log-max' after which the oldest element (at the end of
+the list) is deleted every time a new one is added (at the front).
+
+\(fn &optional ARG)" t nil)
 
 (autoload 'gdb "gdb-mi" "\
 Run gdb on program FILE in buffer *gud-FILE*.
@@ -11433,8 +11493,8 @@ detailed description of this mode.
 ;;;***
 \f
 ;;;### (autoloads (generic-make-keywords-list generic-mode generic-mode-internal
-;;;;;;  define-generic-mode) "generic" "emacs-lisp/generic.el" (20400
-;;;;;;  62402))
+;;;;;;  define-generic-mode) "generic" "emacs-lisp/generic.el" (20406
+;;;;;;  8611 875037 0))
 ;;; Generated autoloads from emacs-lisp/generic.el
 
 (defvar generic-mode-list nil "\
@@ -11476,10 +11536,12 @@ mode hook `MODE-hook'.
 
 See the file generic-x.el for some examples of `define-generic-mode'.
 
-\(fn MODE COMMENT-LIST KEYWORD-LIST FONT-LOCK-LIST AUTO-MODE-LIST FUNCTION-LIST &optional DOCSTRING)" nil (quote macro))
+\(fn MODE COMMENT-LIST KEYWORD-LIST FONT-LOCK-LIST AUTO-MODE-LIST FUNCTION-LIST &optional DOCSTRING)" nil t)
 
 (put 'define-generic-mode 'lisp-indent-function '1)
 
+(put 'define-generic-mode 'doc-string-elt '7)
+
 (autoload 'generic-mode-internal "generic" "\
 Go into the generic mode MODE.
 
@@ -11511,7 +11573,7 @@ regular expression that can be used as an element of
 ;;;***
 \f
 ;;;### (autoloads (glasses-mode) "glasses" "progmodes/glasses.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/glasses.el
 
 (autoload 'glasses-mode "glasses" "\
@@ -11527,7 +11589,7 @@ add virtual separators (like underscores) at places they belong to.
 \f
 ;;;### (autoloads (gmm-tool-bar-from-list gmm-widget-p gmm-error
 ;;;;;;  gmm-message gmm-regexp-concat) "gmm-utils" "gnus/gmm-utils.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gmm-utils.el
 
 (autoload 'gmm-regexp-concat "gmm-utils" "\
@@ -11582,7 +11644,8 @@ DEFAULT-MAP specifies the default key map for ICON-LIST.
 ;;;***
 \f
 ;;;### (autoloads (gnus gnus-other-frame gnus-slave gnus-no-server
-;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (20370 31722))
+;;;;;;  gnus-slave-no-server) "gnus" "gnus/gnus.el" (20458 56750
+;;;;;;  651721 0))
 ;;; Generated autoloads from gnus/gnus.el
 (when (fboundp 'custom-autoload)
  (custom-autoload 'gnus-select-method "gnus"))
@@ -11635,7 +11698,7 @@ prompt the user for the name of an NNTP server to use.
 ;;;;;;  gnus-agent-get-undownloaded-list gnus-agent-delete-group
 ;;;;;;  gnus-agent-rename-group gnus-agent-possibly-save-gcc gnus-agentize
 ;;;;;;  gnus-slave-unplugged gnus-plugged gnus-unplugged) "gnus-agent"
-;;;;;;  "gnus/gnus-agent.el" (20352 65510))
+;;;;;;  "gnus/gnus-agent.el" (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-agent.el
 
 (autoload 'gnus-unplugged "gnus-agent" "\
@@ -11726,7 +11789,7 @@ If CLEAN, obsolete (ignore).
 ;;;***
 \f
 ;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el"
-;;;;;;  (20358 29669))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-art.el
 
 (autoload 'gnus-article-prepare-display "gnus-art" "\
@@ -11737,7 +11800,8 @@ Make the current buffer look like a nice article.
 ;;;***
 \f
 ;;;### (autoloads (gnus-bookmark-bmenu-list gnus-bookmark-jump gnus-bookmark-set)
-;;;;;;  "gnus-bookmark" "gnus/gnus-bookmark.el" (20352 65510))
+;;;;;;  "gnus-bookmark" "gnus/gnus-bookmark.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from gnus/gnus-bookmark.el
 
 (autoload 'gnus-bookmark-set "gnus-bookmark" "\
@@ -11762,8 +11826,8 @@ deletion, or > if it is flagged for displaying.
 \f
 ;;;### (autoloads (gnus-cache-delete-group gnus-cache-rename-group
 ;;;;;;  gnus-cache-generate-nov-databases gnus-cache-generate-active
-;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (20352
-;;;;;;  65510))
+;;;;;;  gnus-jog-cache) "gnus-cache" "gnus/gnus-cache.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-cache.el
 
 (autoload 'gnus-jog-cache "gnus-cache" "\
@@ -11805,7 +11869,7 @@ supported.
 ;;;***
 \f
 ;;;### (autoloads (gnus-delay-initialize gnus-delay-send-queue gnus-delay-article)
-;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (20352 65510))
+;;;;;;  "gnus-delay" "gnus/gnus-delay.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-delay.el
 
 (autoload 'gnus-delay-article "gnus-delay" "\
@@ -11841,7 +11905,7 @@ Checking delayed messages is skipped if optional arg NO-CHECK is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (gnus-user-format-function-D gnus-user-format-function-d)
-;;;;;;  "gnus-diary" "gnus/gnus-diary.el" (20352 65510))
+;;;;;;  "gnus-diary" "gnus/gnus-diary.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-diary.el
 
 (autoload 'gnus-user-format-function-d "gnus-diary" "\
@@ -11857,7 +11921,7 @@ Checking delayed messages is skipped if optional arg NO-CHECK is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (turn-on-gnus-dired-mode) "gnus-dired" "gnus/gnus-dired.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-dired.el
 
 (autoload 'turn-on-gnus-dired-mode "gnus-dired" "\
@@ -11868,7 +11932,7 @@ Convenience method to turn on gnus-dired-mode.
 ;;;***
 \f
 ;;;### (autoloads (gnus-draft-reminder) "gnus-draft" "gnus/gnus-draft.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-draft.el
 
 (autoload 'gnus-draft-reminder "gnus-draft" "\
@@ -11880,8 +11944,8 @@ Reminder user if there are unsent drafts.
 \f
 ;;;### (autoloads (gnus-convert-png-to-face gnus-convert-face-to-png
 ;;;;;;  gnus-face-from-file gnus-x-face-from-file gnus-insert-random-x-face-header
-;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (20352
-;;;;;;  65510))
+;;;;;;  gnus-random-x-face) "gnus-fun" "gnus/gnus-fun.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-fun.el
 
 (autoload 'gnus-random-x-face "gnus-fun" "\
@@ -11926,7 +11990,8 @@ FILE should be a PNG file that's 48x48 and smaller than or equal to
 ;;;***
 \f
 ;;;### (autoloads (gnus-treat-mail-gravatar gnus-treat-from-gravatar)
-;;;;;;  "gnus-gravatar" "gnus/gnus-gravatar.el" (20352 65510))
+;;;;;;  "gnus-gravatar" "gnus/gnus-gravatar.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from gnus/gnus-gravatar.el
 
 (autoload 'gnus-treat-from-gravatar "gnus-gravatar" "\
@@ -11944,7 +12009,7 @@ If gravatars are already displayed, remove them.
 ;;;***
 \f
 ;;;### (autoloads (gnus-fetch-group-other-frame gnus-fetch-group)
-;;;;;;  "gnus-group" "gnus/gnus-group.el" (20352 65510))
+;;;;;;  "gnus-group" "gnus/gnus-group.el" (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-group.el
 
 (autoload 'gnus-fetch-group "gnus-group" "\
@@ -11962,7 +12027,7 @@ Pop up a frame and enter GROUP.
 ;;;***
 \f
 ;;;### (autoloads (gnus-html-prefetch-images gnus-article-html) "gnus-html"
-;;;;;;  "gnus/gnus-html.el" (20352 65510))
+;;;;;;  "gnus/gnus-html.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-html.el
 
 (autoload 'gnus-article-html "gnus-html" "\
@@ -11978,7 +12043,7 @@ Pop up a frame and enter GROUP.
 ;;;***
 \f
 ;;;### (autoloads (gnus-batch-score) "gnus-kill" "gnus/gnus-kill.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-kill.el
 
 (defalias 'gnus-batch-kill 'gnus-batch-score)
@@ -11993,7 +12058,7 @@ Usage: emacs -batch -l ~/.emacs -l gnus -f gnus-batch-score
 \f
 ;;;### (autoloads (gnus-mailing-list-mode gnus-mailing-list-insinuate
 ;;;;;;  turn-on-gnus-mailing-list-mode) "gnus-ml" "gnus/gnus-ml.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-ml.el
 
 (autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" "\
@@ -12018,7 +12083,7 @@ Minor mode for providing mailing-list commands.
 \f
 ;;;### (autoloads (gnus-group-split-fancy gnus-group-split gnus-group-split-update
 ;;;;;;  gnus-group-split-setup) "gnus-mlspl" "gnus/gnus-mlspl.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-mlspl.el
 
 (autoload 'gnus-group-split-setup "gnus-mlspl" "\
@@ -12119,7 +12184,7 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns:
 ;;;***
 \f
 ;;;### (autoloads (gnus-button-reply gnus-button-mailto gnus-msg-mail)
-;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (20420 42151))
+;;;;;;  "gnus-msg" "gnus/gnus-msg.el" (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-msg.el
 
 (autoload 'gnus-msg-mail "gnus-msg" "\
@@ -12147,7 +12212,7 @@ Like `message-reply'.
 \f
 ;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon
 ;;;;;;  gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-picon.el
 
 (autoload 'gnus-treat-from-picon "gnus-picon" "\
@@ -12174,7 +12239,7 @@ If picons are already displayed, remove them.
 ;;;;;;  gnus-sorted-nintersection gnus-sorted-range-intersection
 ;;;;;;  gnus-sorted-intersection gnus-intersection gnus-sorted-complement
 ;;;;;;  gnus-sorted-ndifference gnus-sorted-difference) "gnus-range"
-;;;;;;  "gnus/gnus-range.el" (20352 65510))
+;;;;;;  "gnus/gnus-range.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-range.el
 
 (autoload 'gnus-sorted-difference "gnus-range" "\
@@ -12242,7 +12307,8 @@ Add NUM into sorted LIST by side effect.
 ;;;***
 \f
 ;;;### (autoloads (gnus-registry-install-hooks gnus-registry-initialize)
-;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (20352 65510))
+;;;;;;  "gnus-registry" "gnus/gnus-registry.el" (20458 56750 651721
+;;;;;;  0))
 ;;; Generated autoloads from gnus/gnus-registry.el
 
 (autoload 'gnus-registry-initialize "gnus-registry" "\
@@ -12258,8 +12324,8 @@ Install the registry hooks.
 ;;;***
 \f
 ;;;### (autoloads (gnus-sieve-article-add-rule gnus-sieve-generate
-;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (20352
-;;;;;;  65510))
+;;;;;;  gnus-sieve-update) "gnus-sieve" "gnus/gnus-sieve.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from gnus/gnus-sieve.el
 
 (autoload 'gnus-sieve-update "gnus-sieve" "\
@@ -12287,7 +12353,7 @@ See the documentation for these variables and functions for details.
 ;;;***
 \f
 ;;;### (autoloads (gnus-update-format) "gnus-spec" "gnus/gnus-spec.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-spec.el
 
 (autoload 'gnus-update-format "gnus-spec" "\
@@ -12298,7 +12364,7 @@ Update the format specification near point.
 ;;;***
 \f
 ;;;### (autoloads (gnus-declare-backend) "gnus-start" "gnus/gnus-start.el"
-;;;;;;  (20358 29669))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-start.el
 
 (autoload 'gnus-declare-backend "gnus-start" "\
@@ -12309,7 +12375,7 @@ Declare back end NAME with ABILITIES as a Gnus back end.
 ;;;***
 \f
 ;;;### (autoloads (gnus-summary-bookmark-jump) "gnus-sum" "gnus/gnus-sum.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-sum.el
 
 (autoload 'gnus-summary-bookmark-jump "gnus-sum" "\
@@ -12321,7 +12387,7 @@ BOOKMARK is a bookmark name or a bookmark record.
 ;;;***
 \f
 ;;;### (autoloads (gnus-sync-install-hooks gnus-sync-initialize)
-;;;;;;  "gnus-sync" "gnus/gnus-sync.el" (20352 65510))
+;;;;;;  "gnus-sync" "gnus/gnus-sync.el" (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/gnus-sync.el
 
 (autoload 'gnus-sync-initialize "gnus-sync" "\
@@ -12337,7 +12403,7 @@ Install the sync hooks.
 ;;;***
 \f
 ;;;### (autoloads (gnus-add-configuration) "gnus-win" "gnus/gnus-win.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20447 49522 409090 0))
 ;;; Generated autoloads from gnus/gnus-win.el
 
 (autoload 'gnus-add-configuration "gnus-win" "\
@@ -12348,7 +12414,7 @@ Add the window configuration CONF to `gnus-buffer-configuration'.
 ;;;***
 \f
 ;;;### (autoloads (gnutls-min-prime-bits) "gnutls" "net/gnutls.el"
-;;;;;;  (20403 5511))
+;;;;;;  (20417 65331 139825 0))
 ;;; Generated autoloads from net/gnutls.el
 
 (defvar gnutls-min-prime-bits 256 "\
@@ -12364,7 +12430,8 @@ A value of nil says to use the default GnuTLS value.")
 
 ;;;***
 \f
-;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (20400 62402))
+;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from play/gomoku.el
 
 (autoload 'gomoku "gomoku" "\
@@ -12391,8 +12458,8 @@ Use \\[describe-mode] for more info.
 ;;;***
 \f
 ;;;### (autoloads (goto-address-prog-mode goto-address-mode goto-address
-;;;;;;  goto-address-at-point) "goto-addr" "net/goto-addr.el" (20400
-;;;;;;  62402))
+;;;;;;  goto-address-at-point) "goto-addr" "net/goto-addr.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from net/goto-addr.el
 
 (define-obsolete-function-alias 'goto-address-at-mouse 'goto-address-at-point "22.1")
@@ -12434,7 +12501,7 @@ Like `goto-address-mode', but only for comments and strings.
 ;;;***
 \f
 ;;;### (autoloads (gravatar-retrieve-synchronously gravatar-retrieve)
-;;;;;;  "gravatar" "gnus/gravatar.el" (20352 65510))
+;;;;;;  "gravatar" "gnus/gravatar.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/gravatar.el
 
 (autoload 'gravatar-retrieve "gravatar" "\
@@ -12452,11 +12519,12 @@ Retrieve MAIL-ADDRESS gravatar and returns it.
 \f
 ;;;### (autoloads (zrgrep rgrep lgrep grep-find grep grep-mode grep-compute-defaults
 ;;;;;;  grep-process-setup grep-setup-hook grep-find-command grep-command
-;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (20400 62402))
+;;;;;;  grep-window-height) "grep" "progmodes/grep.el" (20369 14251
+;;;;;;  85829 0))
 ;;; Generated autoloads from progmodes/grep.el
 
 (defvar grep-window-height nil "\
-*Number of lines in a grep window.  If nil, use `compilation-window-height'.")
+Number of lines in a grep window.  If nil, use `compilation-window-height'.")
 
 (custom-autoload 'grep-window-height "grep" t)
 
@@ -12615,7 +12683,8 @@ file name to `*.gz', and sets `grep-highlight-matches' to `always'.
 
 ;;;***
 \f
-;;;### (autoloads (gs-load-image) "gs" "gs.el" (20352 65510))
+;;;### (autoloads (gs-load-image) "gs" "gs.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from gs.el
 
 (autoload 'gs-load-image "gs" "\
@@ -12629,7 +12698,8 @@ the form \"WINDOW-ID PIXMAP-ID\".  Value is non-nil if successful.
 ;;;***
 \f
 ;;;### (autoloads (gud-tooltip-mode gdb-script-mode jdb pdb perldb
-;;;;;;  xdb dbx sdb gud-gdb) "gud" "progmodes/gud.el" (20400 62402))
+;;;;;;  xdb dbx sdb gud-gdb) "gud" "progmodes/gud.el" (20458 56750
+;;;;;;  651721 0))
 ;;; Generated autoloads from progmodes/gud.el
 
 (autoload 'gud-gdb "gud" "\
@@ -12717,8 +12787,98 @@ it if ARG is omitted or nil.
 
 ;;;***
 \f
-;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (setf gv-define-simple-setter gv-define-setter
+;;;;;;  gv--defun-declaration gv-define-expander gv-letplace gv-get)
+;;;;;;  "gv" "emacs-lisp/gv.el" (20453 5437 764254 0))
+;;; Generated autoloads from emacs-lisp/gv.el
+
+(autoload 'gv-get "gv" "\
+Build the code that applies DO to PLACE.
+PLACE must be a valid generalized variable.
+DO must be a function; it will be called with 2 arguments: GETTER and SETTER,
+where GETTER is a (copyable) Elisp expression that returns the value of PLACE,
+and SETTER is a function which returns the code to set PLACE when called
+with a (not necessarily copyable) Elisp expression that returns the value to
+set it to.
+DO must return an Elisp expression.
+
+\(fn PLACE DO)" nil nil)
+
+(autoload 'gv-letplace "gv" "\
+Build the code manipulating the generalized variable PLACE.
+GETTER will be bound to a copyable expression that returns the value
+of PLACE.
+SETTER will be bound to a function that takes an expression V and returns
+and new expression that sets PLACE to V.
+BODY should return some Elisp expression E manipulating PLACE via GETTER
+and SETTER.
+The returned value will then be an Elisp expression that first evaluates
+all the parts of PLACE that can be evaluated and then runs E.
+
+\(fn (GETTER SETTER) PLACE &rest BODY)" nil t)
+
+(put 'gv-letplace 'lisp-indent-function '2)
+
+(autoload 'gv-define-expander "gv" "\
+Use HANDLER to handle NAME as a generalized var.
+NAME is a symbol: the name of a function, macro, or special form.
+HANDLER is a function which takes an argument DO followed by the same
+arguments as NAME.  DO is a function as defined in `gv-get'.
+
+\(fn NAME HANDLER)" nil t)
+
+(put 'gv-define-expander 'lisp-indent-function '1)
+
+(autoload 'gv--defun-declaration "gv" "\
+
+
+\(fn SYMBOL NAME ARGS HANDLER &optional FIX)" nil nil)
+
+(push `(gv-expander ,(apply-partially #'gv--defun-declaration 'gv-expander)) defun-declarations-alist)
+
+(push `(gv-setter ,(apply-partially #'gv--defun-declaration 'gv-setter)) defun-declarations-alist)
+
+(autoload 'gv-define-setter "gv" "\
+Define a setter method for generalized variable NAME.
+This macro is an easy-to-use substitute for `gv-define-expander' that works
+well for simple place forms.
+Assignments of VAL to (NAME ARGS...) are expanded by binding the argument
+forms (VAL ARGS...) according to ARGLIST, then executing BODY, which must
+return a Lisp form that does the assignment.
+Actually, ARGLIST may be bound to temporary variables which are introduced
+automatically to preserve proper execution order of the arguments.  Example:
+  (gv-define-setter aref (v a i) `(aset ,a ,i ,v))
+
+\(fn NAME ARGLIST &rest BODY)" nil t)
+
+(put 'gv-define-setter 'lisp-indent-function '2)
+
+(autoload 'gv-define-simple-setter "gv" "\
+Define a simple setter method for generalized variable NAME.
+This macro is an easy-to-use substitute for `gv-define-expander' that works
+well for simple place forms.  Assignments of VAL to (NAME ARGS...) are
+turned into calls of the form (SETTER ARGS... VAL).
+If FIX-RETURN is non-nil, then SETTER is not assumed to return VAL and
+instead the assignment is turned into (prog1 VAL (SETTER ARGS... VAL))
+so as to preserve the semantics of `setf'.
+
+\(fn NAME SETTER &optional FIX-RETURN)" nil t)
+
+(autoload 'setf "gv" "\
+Set each PLACE to the value of its VAL.
+This is a generalized version of `setq'; the PLACEs may be symbolic
+references such as (car x) or (aref x i), as well as plain symbols.
+For example, (setf (cadr x) y) is equivalent to (setcar (cdr x) y).
+The return value is the last VAL in the list.
+
+\(fn PLACE VAL PLACE VAL ...)" nil t)
+
+(put 'gv-place 'edebug-form-spec 'edebug-match-form)
+
+;;;***
+\f
+;;;### (autoloads (handwrite) "handwrite" "play/handwrite.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from play/handwrite.el
 
 (autoload 'handwrite "handwrite" "\
@@ -12736,7 +12896,7 @@ Variables: `handwrite-linespace'     (default 12)
 ;;;***
 \f
 ;;;### (autoloads (hanoi-unix-64 hanoi-unix hanoi) "hanoi" "play/hanoi.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from play/hanoi.el
 
 (autoload 'hanoi "hanoi" "\
@@ -12765,7 +12925,7 @@ to be updated.
 \f
 ;;;### (autoloads (mail-check-payment mail-add-payment-async mail-add-payment
 ;;;;;;  hashcash-verify-payment hashcash-insert-payment-async hashcash-insert-payment)
-;;;;;;  "hashcash" "mail/hashcash.el" (20400 62402))
+;;;;;;  "hashcash" "mail/hashcash.el" (20355 10021 546955 0))
 ;;; Generated autoloads from mail/hashcash.el
 
 (autoload 'hashcash-insert-payment "hashcash" "\
@@ -12810,7 +12970,8 @@ Prefix arg sets default accept amount temporarily.
 ;;;### (autoloads (scan-buf-previous-region scan-buf-next-region
 ;;;;;;  scan-buf-move-to-region help-at-pt-display-when-idle help-at-pt-set-timer
 ;;;;;;  help-at-pt-cancel-timer display-local-help help-at-pt-kbd-string
-;;;;;;  help-at-pt-string) "help-at-pt" "help-at-pt.el" (20352 65510))
+;;;;;;  help-at-pt-string) "help-at-pt" "help-at-pt.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from help-at-pt.el
 
 (autoload 'help-at-pt-string "help-at-pt" "\
@@ -12940,7 +13101,7 @@ different regions.  With numeric argument ARG, behaves like
 ;;;### (autoloads (doc-file-to-info doc-file-to-man describe-categories
 ;;;;;;  describe-syntax describe-variable variable-at-point describe-function-1
 ;;;;;;  find-lisp-object-file-name help-C-file-name describe-function)
-;;;;;;  "help-fns" "help-fns.el" (20352 65510))
+;;;;;;  "help-fns" "help-fns.el" (20458 56750 651721 0))
 ;;; Generated autoloads from help-fns.el
 
 (autoload 'describe-function "help-fns" "\
@@ -13020,7 +13181,7 @@ Produce a texinfo buffer with sorted doc-strings from the DOC file.
 ;;;***
 \f
 ;;;### (autoloads (three-step-help) "help-macro" "help-macro.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from help-macro.el
 
 (defvar three-step-help nil "\
@@ -13034,10 +13195,10 @@ gives the window that lists the options.")
 
 ;;;***
 \f
-;;;### (autoloads (help-xref-on-pp help-insert-xref-button help-xref-button
-;;;;;;  help-make-xrefs help-buffer help-setup-xref help-mode-finish
-;;;;;;  help-mode-setup help-mode) "help-mode" "help-mode.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (help-bookmark-jump help-xref-on-pp help-insert-xref-button
+;;;;;;  help-xref-button help-make-xrefs help-buffer help-setup-xref
+;;;;;;  help-mode-finish help-mode-setup help-mode) "help-mode" "help-mode.el"
+;;;;;;  (20459 40320 865360 0))
 ;;; Generated autoloads from help-mode.el
 
 (autoload 'help-mode "help-mode" "\
@@ -13127,10 +13288,17 @@ Add xrefs for symbols in `pp's output between FROM and TO.
 
 \(fn FROM TO)" nil nil)
 
+(autoload 'help-bookmark-jump "help-mode" "\
+Jump to help-mode bookmark BOOKMARK.
+Handler function for record returned by `help-bookmark-make-record'.
+BOOKMARK is a bookmark name or a bookmark record.
+
+\(fn BOOKMARK)" nil nil)
+
 ;;;***
 \f
 ;;;### (autoloads (Helper-help Helper-describe-bindings) "helper"
-;;;;;;  "emacs-lisp/helper.el" (20352 65510))
+;;;;;;  "emacs-lisp/helper.el" (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/helper.el
 
 (autoload 'Helper-describe-bindings "helper" "\
@@ -13146,7 +13314,7 @@ Provide help for current mode.
 ;;;***
 \f
 ;;;### (autoloads (hexlify-buffer hexl-find-file hexl-mode) "hexl"
-;;;;;;  "hexl.el" (20400 62402))
+;;;;;;  "hexl.el" (20420 41510 996439 0))
 ;;; Generated autoloads from hexl.el
 
 (autoload 'hexl-mode "hexl" "\
@@ -13161,7 +13329,7 @@ using the function `hexlify-buffer'.
 Each line in the buffer has an \"address\" (displayed in hexadecimal)
 representing the offset into the file that the characters on this line
 are at and 16 characters from the file (displayed as hexadecimal
-values grouped every 16 bits) and as their ASCII values.
+values grouped every `hexl-bits' bits) and as their ASCII values.
 
 If any of the characters (displayed as ASCII characters) are
 unprintable (control or meta characters) they will be replaced as
@@ -13243,7 +13411,7 @@ This discards the buffer's undo information.
 ;;;### (autoloads (hi-lock-write-interactive-patterns hi-lock-unface-buffer
 ;;;;;;  hi-lock-face-phrase-buffer hi-lock-face-buffer hi-lock-line-face-buffer
 ;;;;;;  global-hi-lock-mode hi-lock-mode) "hi-lock" "hi-lock.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20410 5673 834266 0))
 ;;; Generated autoloads from hi-lock.el
 
 (autoload 'hi-lock-mode "hi-lock" "\
@@ -13382,7 +13550,7 @@ be found in variable `hi-lock-interactive-patterns'.
 ;;;***
 \f
 ;;;### (autoloads (hide-ifdef-mode) "hideif" "progmodes/hideif.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/hideif.el
 
 (autoload 'hide-ifdef-mode "hideif" "\
@@ -13426,11 +13594,11 @@ Several variables affect how the hiding is done:
 ;;;***
 \f
 ;;;### (autoloads (turn-off-hideshow hs-minor-mode) "hideshow" "progmodes/hideshow.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20356 55829 180242 0))
 ;;; Generated autoloads from progmodes/hideshow.el
 
 (defvar hs-special-modes-alist (mapcar 'purecopy '((c-mode "{" "}" "/[*/]" nil nil) (c++-mode "{" "}" "/[*/]" nil nil) (bibtex-mode ("@\\S(*\\(\\s(\\)" 1)) (java-mode "{" "}" "/[*/]" nil nil) (js-mode "{" "}" "/[*/]" nil))) "\
-*Alist for initializing the hideshow variables for different modes.
+Alist for initializing the hideshow variables for different modes.
 Each element has the form
   (MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC).
 
@@ -13492,8 +13660,8 @@ Unconditionally turn off `hs-minor-mode'.
 ;;;;;;  highlight-compare-buffers highlight-changes-rotate-faces
 ;;;;;;  highlight-changes-previous-change highlight-changes-next-change
 ;;;;;;  highlight-changes-remove-highlight highlight-changes-visible-mode
-;;;;;;  highlight-changes-mode) "hilit-chg" "hilit-chg.el" (20352
-;;;;;;  65510))
+;;;;;;  highlight-changes-mode) "hilit-chg" "hilit-chg.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from hilit-chg.el
 
 (autoload 'highlight-changes-mode "hilit-chg" "\
@@ -13628,7 +13796,7 @@ See `highlight-changes-mode' for more information on Highlight-Changes mode.
 ;;;;;;  hippie-expand-ignore-buffers hippie-expand-max-buffers hippie-expand-no-restriction
 ;;;;;;  hippie-expand-dabbrev-as-symbol hippie-expand-dabbrev-skip-space
 ;;;;;;  hippie-expand-verbose hippie-expand-try-functions-list) "hippie-exp"
-;;;;;;  "hippie-exp.el" (20352 65510))
+;;;;;;  "hippie-exp.el" (20355 10021 546955 0))
 ;;; Generated autoloads from hippie-exp.el
 
 (defvar hippie-expand-try-functions-list '(try-complete-file-name-partially try-complete-file-name try-expand-all-abbrevs try-expand-list try-expand-line try-expand-dabbrev try-expand-dabbrev-all-buffers try-expand-dabbrev-from-kill try-complete-lisp-symbol-partially try-complete-lisp-symbol) "\
@@ -13696,12 +13864,12 @@ Construct a function similar to `hippie-expand'.
 Make it use the expansion functions in TRY-LIST.  An optional second
 argument VERBOSE non-nil makes the function verbose.
 
-\(fn TRY-LIST &optional VERBOSE)" nil (quote macro))
+\(fn TRY-LIST &optional VERBOSE)" nil t)
 
 ;;;***
 \f
 ;;;### (autoloads (global-hl-line-mode hl-line-mode) "hl-line" "hl-line.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from hl-line.el
 
 (autoload 'hl-line-mode "hl-line" "\
@@ -13754,7 +13922,7 @@ Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and
 ;;;;;;  holiday-bahai-holidays holiday-islamic-holidays holiday-christian-holidays
 ;;;;;;  holiday-hebrew-holidays holiday-other-holidays holiday-local-holidays
 ;;;;;;  holiday-oriental-holidays holiday-general-holidays) "holidays"
-;;;;;;  "calendar/holidays.el" (20400 62402))
+;;;;;;  "calendar/holidays.el" (20390 20388 254308 0))
 ;;; Generated autoloads from calendar/holidays.el
 
 (define-obsolete-variable-alias 'general-holidays 'holiday-general-holidays "23.1")
@@ -13902,8 +14070,8 @@ The optional LABEL is used to label the buffer created.
 
 ;;;***
 \f
-;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (html2text) "html2text" "gnus/html2text.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from gnus/html2text.el
 
 (autoload 'html2text "html2text" "\
@@ -13914,7 +14082,7 @@ Convert HTML to plain text in the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (htmlfontify-copy-and-link-dir htmlfontify-buffer)
-;;;;;;  "htmlfontify" "htmlfontify.el" (20352 65510))
+;;;;;;  "htmlfontify" "htmlfontify.el" (20355 10021 546955 0))
 ;;; Generated autoloads from htmlfontify.el
 
 (autoload 'htmlfontify-buffer "htmlfontify" "\
@@ -13947,8 +14115,8 @@ You may also want to set `hfy-page-header' and `hfy-page-footer'.
 ;;;***
 \f
 ;;;### (autoloads (define-ibuffer-filter define-ibuffer-op define-ibuffer-sorter
-;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (20352
-;;;;;;  65510))
+;;;;;;  define-ibuffer-column) "ibuf-macs" "ibuf-macs.el" (20406
+;;;;;;  8611 875037 0))
 ;;; Generated autoloads from ibuf-macs.el
 
 (autoload 'define-ibuffer-column "ibuf-macs" "\
@@ -13976,8 +14144,6 @@ change its definition, you should explicitly call
 
 \(fn SYMBOL (&key NAME INLINE PROPS SUMMARIZER) &rest BODY)" nil (quote macro))
 
-(put 'define-ibuffer-column 'lisp-indent-function 'defun)
-
 (autoload 'define-ibuffer-sorter "ibuf-macs" "\
 Define a method of sorting named NAME.
 DOCUMENTATION is the documentation of the function, which will be called
@@ -13990,8 +14156,6 @@ value if and only if `a' is \"less than\" `b'.
 
 \(fn NAME DOCUMENTATION (&key DESCRIPTION) &rest BODY)" nil (quote macro))
 
-(put 'define-ibuffer-sorter 'lisp-indent-function '1)
-
 (autoload 'define-ibuffer-op "ibuf-macs" "\
 Generate a function which operates on a buffer.
 OP becomes the name of the function; if it doesn't begin with
@@ -14025,8 +14189,6 @@ macro for exactly what it does.
 
 \(fn OP ARGS DOCUMENTATION (&key INTERACTIVE MARK MODIFIER-P DANGEROUS OPSTRING ACTIVE-OPSTRING COMPLEX) &rest BODY)" nil (quote macro))
 
-(put 'define-ibuffer-op 'lisp-indent-function '2)
-
 (autoload 'define-ibuffer-filter "ibuf-macs" "\
 Define a filter named NAME.
 DOCUMENTATION is the documentation of the function.
@@ -14040,12 +14202,10 @@ bound to the current value of the filter.
 
 \(fn NAME DOCUMENTATION (&key READER DESCRIPTION) &rest BODY)" nil (quote macro))
 
-(put 'define-ibuffer-filter 'lisp-indent-function '2)
-
 ;;;***
 \f
 ;;;### (autoloads (ibuffer ibuffer-other-window ibuffer-list-buffers)
-;;;;;;  "ibuffer" "ibuffer.el" (20400 62402))
+;;;;;;  "ibuffer" "ibuffer.el" (20383 47352 714562 935000))
 ;;; Generated autoloads from ibuffer.el
 
 (autoload 'ibuffer-list-buffers "ibuffer" "\
@@ -14086,7 +14246,7 @@ FORMATS is the value to use for `ibuffer-formats'.
 \f
 ;;;### (autoloads (icalendar-import-buffer icalendar-import-file
 ;;;;;;  icalendar-export-region icalendar-export-file) "icalendar"
-;;;;;;  "calendar/icalendar.el" (20352 65510))
+;;;;;;  "calendar/icalendar.el" (20434 17809 692608 0))
 ;;; Generated autoloads from calendar/icalendar.el
 
 (autoload 'icalendar-export-file "icalendar" "\
@@ -14138,8 +14298,8 @@ buffer `*icalendar-errors*'.
 
 ;;;***
 \f
-;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (icomplete-mode) "icomplete" "icomplete.el" (20453
+;;;;;;  5437 764254 0))
 ;;; Generated autoloads from icomplete.el
 
 (defvar icomplete-mode nil "\
@@ -14161,7 +14321,8 @@ the mode if ARG is omitted or nil.
 
 ;;;***
 \f
-;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (20400 62402))
+;;;### (autoloads (icon-mode) "icon" "progmodes/icon.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from progmodes/icon.el
 
 (autoload 'icon-mode "icon" "\
@@ -14202,7 +14363,7 @@ with no args, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (idlwave-shell) "idlw-shell" "progmodes/idlw-shell.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from progmodes/idlw-shell.el
 
 (autoload 'idlwave-shell "idlw-shell" "\
@@ -14228,7 +14389,7 @@ See also the variable `idlwave-shell-prompt-pattern'.
 ;;;***
 \f
 ;;;### (autoloads (idlwave-mode) "idlwave" "progmodes/idlwave.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from progmodes/idlwave.el
 
 (autoload 'idlwave-mode "idlwave" "\
@@ -14362,8 +14523,8 @@ The main features of this mode are
 ;;;;;;  ido-find-alternate-file ido-find-file-other-window ido-find-file
 ;;;;;;  ido-find-file-in-dir ido-switch-buffer-other-frame ido-insert-buffer
 ;;;;;;  ido-kill-buffer ido-display-buffer ido-switch-buffer-other-window
-;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (20400
-;;;;;;  62402))
+;;;;;;  ido-switch-buffer ido-mode ido-mode) "ido" "ido.el" (20450
+;;;;;;  62630 628906 0))
 ;;; Generated autoloads from ido.el
 
 (defvar ido-mode nil "\
@@ -14407,8 +14568,7 @@ their normal keybindings, except for the following: \\<ido-buffer-completion-map
 RET Select the buffer at the front of the list of matches.  If the
 list is empty, possibly prompt to create new buffer.
 
-\\[ido-select-text] Select the current prompt as the buffer.
-If no buffer is found, prompt for a new one.
+\\[ido-select-text] Use the current input string verbatim.
 
 \\[ido-next-match] Put the first element at the end of the list.
 \\[ido-prev-match] Put the last element at the start of the list.
@@ -14484,8 +14644,7 @@ except for the following: \\<ido-file-completion-map>
 RET Select the file at the front of the list of matches.  If the
 list is empty, possibly prompt to create new file.
 
-\\[ido-select-text] Select the current prompt as the buffer or file.
-If no buffer or file is found, prompt for a new one.
+\\[ido-select-text] Use the current input string verbatim.
 
 \\[ido-next-match] Put the first element at the end of the list.
 \\[ido-prev-match] Put the last element at the start of the list.
@@ -14493,6 +14652,7 @@ If no buffer or file is found, prompt for a new one.
 matches all files.  If there is only one match, select that file.
 If there is no common suffix, show a list of all matching files
 in a separate window.
+\\[ido-magic-delete-char] Open the specified directory in Dired mode.
 \\[ido-edit-input] Edit input string (including directory).
 \\[ido-prev-work-directory] or \\[ido-next-work-directory] go to previous/next directory in work directory history.
 \\[ido-merge-work-directories] search for file in the work directory history.
@@ -14623,7 +14783,7 @@ DEF, if non-nil, is the default value.
 
 ;;;***
 \f
-;;;### (autoloads (ielm) "ielm" "ielm.el" (20352 65510))
+;;;### (autoloads (ielm) "ielm" "ielm.el" (20355 10021 546955 0))
 ;;; Generated autoloads from ielm.el
 
 (autoload 'ielm "ielm" "\
@@ -14634,7 +14794,8 @@ Switches to the buffer `*ielm*', or creates it if it does not exist.
 
 ;;;***
 \f
-;;;### (autoloads (iimage-mode) "iimage" "iimage.el" (20352 65510))
+;;;### (autoloads (iimage-mode) "iimage" "iimage.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from iimage.el
 
 (define-obsolete-function-alias 'turn-on-iimage-mode 'iimage-mode "24.1")
@@ -14655,7 +14816,7 @@ the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'.
 ;;;;;;  create-image image-type-auto-detected-p image-type-available-p
 ;;;;;;  image-type image-type-from-file-name image-type-from-file-header
 ;;;;;;  image-type-from-buffer image-type-from-data) "image" "image.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20437 50597 545250 0))
 ;;; Generated autoloads from image.el
 
 (autoload 'image-type-from-data "image" "\
@@ -14828,21 +14989,21 @@ Example:
    (defimage test-image ((:type xpm :file \"~/test1.xpm\")
                          (:type xbm :file \"~/test1.xbm\")))
 
-\(fn SYMBOL SPECS &optional DOC)" nil (quote macro))
+\(fn SYMBOL SPECS &optional DOC)" nil t)
 
 (put 'defimage 'doc-string-elt '3)
 
 (autoload 'imagemagick-register-types "image" "\
 Register file types that can be handled by ImageMagick.
-This registers the ImageMagick types listed in `imagemagick-types',
-excluding those listed in `imagemagick-types-inhibit'.
+This function is called at startup, after loading the init file.
+It registers the ImageMagick types returned by `imagemagick-filter-types'.
 
 Registered image types are added to `auto-mode-alist', so that
 Emacs visits them in Image mode.  They are also added to
 `image-type-file-name-regexps', so that the `image-type' function
 recognizes these files as having image type `imagemagick'.
 
-If Emacs is compiled without ImageMagick support, do nothing.
+If Emacs is compiled without ImageMagick support, this does nothing.
 
 \(fn)" nil nil)
 
@@ -14855,7 +15016,7 @@ If Emacs is compiled without ImageMagick support, do nothing.
 ;;;;;;  image-dired-jump-thumbnail-buffer image-dired-delete-tag
 ;;;;;;  image-dired-tag-files image-dired-show-all-from-dir image-dired-display-thumbs
 ;;;;;;  image-dired-dired-with-window-configuration image-dired-dired-toggle-marked-thumbs)
-;;;;;;  "image-dired" "image-dired.el" (20352 65510))
+;;;;;;  "image-dired" "image-dired.el" (20458 56750 651721 0))
 ;;; Generated autoloads from image-dired.el
 
 (autoload 'image-dired-dired-toggle-marked-thumbs "image-dired" "\
@@ -14993,7 +15154,7 @@ easy-to-use form.
 \f
 ;;;### (autoloads (auto-image-file-mode insert-image-file image-file-name-regexp
 ;;;;;;  image-file-name-regexps image-file-name-extensions) "image-file"
-;;;;;;  "image-file.el" (20352 65510))
+;;;;;;  "image-file.el" (20355 10021 546955 0))
 ;;; Generated autoloads from image-file.el
 
 (defvar image-file-name-extensions (purecopy '("png" "jpeg" "jpg" "gif" "tiff" "tif" "xbm" "xpm" "pbm" "pgm" "ppm" "pnm" "svg")) "\
@@ -15056,7 +15217,8 @@ An image file is one whose name has an extension in
 ;;;***
 \f
 ;;;### (autoloads (image-bookmark-jump image-mode-as-text image-minor-mode
-;;;;;;  image-mode) "image-mode" "image-mode.el" (20400 62402))
+;;;;;;  image-mode) "image-mode" "image-mode.el" (20420 41510 996439
+;;;;;;  0))
 ;;; Generated autoloads from image-mode.el
 
 (autoload 'image-mode "image-mode" "\
@@ -15101,7 +15263,8 @@ on these modes.
 ;;;***
 \f
 ;;;### (autoloads (imenu imenu-add-menubar-index imenu-add-to-menubar
-;;;;;;  imenu-sort-function) "imenu" "imenu.el" (20400 62402))
+;;;;;;  imenu-sort-function) "imenu" "imenu.el" (20393 22044 766544
+;;;;;;  0))
 ;;; Generated autoloads from imenu.el
 
 (defvar imenu-sort-function nil "\
@@ -15218,7 +15381,7 @@ for more information.
 \f
 ;;;### (autoloads (indian-2-column-to-ucs-region in-is13194-pre-write-conversion
 ;;;;;;  in-is13194-post-read-conversion indian-compose-string indian-compose-region)
-;;;;;;  "ind-util" "language/ind-util.el" (20352 65510))
+;;;;;;  "ind-util" "language/ind-util.el" (20355 10021 546955 0))
 ;;; Generated autoloads from language/ind-util.el
 
 (autoload 'indian-compose-region "ind-util" "\
@@ -15250,11 +15413,11 @@ Convert old Emacs Devanagari characters to UCS.
 \f
 ;;;### (autoloads (inferior-lisp inferior-lisp-prompt inferior-lisp-load-command
 ;;;;;;  inferior-lisp-program inferior-lisp-filter-regexp) "inf-lisp"
-;;;;;;  "progmodes/inf-lisp.el" (20400 62402))
+;;;;;;  "progmodes/inf-lisp.el" (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/inf-lisp.el
 
 (defvar inferior-lisp-filter-regexp (purecopy "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'") "\
-*What not to save on inferior Lisp's input history.
+What not to save on inferior Lisp's input history.
 Input matching this regexp is not saved on the input history in Inferior Lisp
 mode.  Default is whitespace followed by 0 or 1 single-letter colon-keyword
 \(as in :a, :c, etc.)")
@@ -15262,12 +15425,12 @@ mode.  Default is whitespace followed by 0 or 1 single-letter colon-keyword
 (custom-autoload 'inferior-lisp-filter-regexp "inf-lisp" t)
 
 (defvar inferior-lisp-program (purecopy "lisp") "\
-*Program name for invoking an inferior Lisp in Inferior Lisp mode.")
+Program name for invoking an inferior Lisp in Inferior Lisp mode.")
 
 (custom-autoload 'inferior-lisp-program "inf-lisp" t)
 
 (defvar inferior-lisp-load-command (purecopy "(load \"%s\")\n") "\
-*Format-string for building a Lisp expression to load a file.
+Format-string for building a Lisp expression to load a file.
 This format string should use `%s' to substitute a file name
 and should result in a Lisp expression that will command the inferior Lisp
 to load that file.  The default works acceptably on most Lisps.
@@ -15296,7 +15459,7 @@ This is a fine thing to set in your .emacs file or through Custom.")
 (custom-autoload 'inferior-lisp-prompt "inf-lisp" t)
 
 (defvar inferior-lisp-mode-hook 'nil "\
-*Hook for customizing Inferior Lisp mode.")
+Hook for customizing Inferior Lisp mode.")
 
 (autoload 'inferior-lisp "inf-lisp" "\
 Run an inferior Lisp process, input and output via buffer `*inferior-lisp*'.
@@ -15316,10 +15479,30 @@ of `inferior-lisp-program').  Runs the hooks from
 ;;;### (autoloads (info-display-manual Info-bookmark-jump Info-speedbar-browser
 ;;;;;;  Info-goto-emacs-key-command-node Info-goto-emacs-command-node
 ;;;;;;  Info-mode info-finder info-apropos Info-index Info-directory
-;;;;;;  Info-on-current-buffer info-standalone info-emacs-manual
-;;;;;;  info info-other-window) "info" "info.el" (20400 62402))
+;;;;;;  Info-on-current-buffer info-standalone info-emacs-bug info-emacs-manual
+;;;;;;  info info-other-window) "info" "info.el" (20458 56750 651721
+;;;;;;  0))
 ;;; Generated autoloads from info.el
 
+(defcustom Info-default-directory-list (let* ((config-dir (file-name-as-directory (or (and (featurep 'ns) (let ((dir (expand-file-name "../info" data-directory))) (if (file-directory-p dir) dir))) configure-info-directory))) (prefixes (prune-directory-list '("/usr/local/" "/usr/" "/opt/" "/"))) (suffixes '("share/" "" "gnu/" "gnu/lib/" "gnu/lib/emacs/" "emacs/" "lib/" "lib/emacs/")) (standard-info-dirs (apply #'nconc (mapcar (lambda (pfx) (let ((dirs (mapcar (lambda (sfx) (concat pfx sfx "info/")) suffixes))) (prune-directory-list dirs))) prefixes))) (dirs (if (member config-dir standard-info-dirs) (nconc standard-info-dirs (list config-dir)) (cons config-dir standard-info-dirs)))) (if (not (eq system-type 'windows-nt)) dirs (let* ((instdir (file-name-directory invocation-directory)) (dir1 (expand-file-name "../info/" instdir)) (dir2 (expand-file-name "../../../info/" instdir))) (cond ((file-exists-p dir1) (append dirs (list dir1))) ((file-exists-p dir2) (append dirs (list dir2))) (t dirs))))) "\
+Default list of directories to search for Info documentation files.
+They are searched in the order they are given in the list.
+Therefore, the directory of Info files that come with Emacs
+normally should come last (so that local files override standard ones),
+unless Emacs is installed into a non-standard directory.  In the latter
+case, the directory of Info files that come with Emacs should be
+first in this list.
+
+Once Info is started, the list of directories to search
+comes from the variable `Info-directory-list'.
+This variable `Info-default-directory-list' is used as the default
+for initializing `Info-directory-list' when Info is started, unless
+the environment variable INFOPATH is set.
+
+Although this is a customizable variable, that is mainly for technical
+reasons.  Normally, you should either set INFOPATH or customize
+`Info-additional-directory-list', rather than changing this variable." :initialize (quote custom-initialize-delay) :type (quote (repeat directory)) :group (quote info))
+
 (autoload 'info-other-window "info" "\
 Like `info' but show the Info buffer in another window.
 
@@ -15355,6 +15538,11 @@ Display the Emacs manual in Info mode.
 
 \(fn)" t nil)
 
+(autoload 'info-emacs-bug "info" "\
+Display the \"Reporting Bugs\" section of the Emacs manual in Info mode.
+
+\(fn)" t nil)
+
 (autoload 'info-standalone "info" "\
 Run Emacs as a standalone Info reader.
 Usage:  emacs -f info-standalone [filename]
@@ -15503,7 +15691,7 @@ Go to Info buffer that displays MANUAL, creating it if none already exists.
 \f
 ;;;### (autoloads (info-complete-file info-complete-symbol info-lookup-file
 ;;;;;;  info-lookup-symbol info-lookup-reset) "info-look" "info-look.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from info-look.el
 
 (autoload 'info-lookup-reset "info-look" "\
@@ -15552,7 +15740,7 @@ Perform completion on file preceding point.
 \f
 ;;;### (autoloads (info-xref-docstrings info-xref-check-all-custom
 ;;;;;;  info-xref-check-all info-xref-check) "info-xref" "info-xref.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from info-xref.el
 
 (autoload 'info-xref-check "info-xref" "\
@@ -15635,7 +15823,8 @@ the sources handy.
 ;;;***
 \f
 ;;;### (autoloads (batch-info-validate Info-validate Info-split Info-split-threshold
-;;;;;;  Info-tagify) "informat" "informat.el" (20352 65510))
+;;;;;;  Info-tagify) "informat" "informat.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from informat.el
 
 (autoload 'Info-tagify "informat" "\
@@ -15682,7 +15871,7 @@ For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"
 \f
 ;;;### (autoloads (isearch-process-search-multibyte-characters isearch-toggle-input-method
 ;;;;;;  isearch-toggle-specified-input-method) "isearch-x" "international/isearch-x.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from international/isearch-x.el
 
 (autoload 'isearch-toggle-specified-input-method "isearch-x" "\
@@ -15702,8 +15891,8 @@ Toggle input method in interactive search.
 
 ;;;***
 \f
-;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (isearchb-activate) "isearchb" "isearchb.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from isearchb.el
 
 (autoload 'isearchb-activate "isearchb" "\
@@ -15719,7 +15908,7 @@ accessed via isearchb.
 ;;;### (autoloads (iso-cvt-define-menu iso-cvt-write-only iso-cvt-read-only
 ;;;;;;  iso-sgml2iso iso-iso2sgml iso-iso2duden iso-iso2gtex iso-gtex2iso
 ;;;;;;  iso-tex2iso iso-iso2tex iso-german iso-spanish) "iso-cvt"
-;;;;;;  "international/iso-cvt.el" (20352 65510))
+;;;;;;  "international/iso-cvt.el" (20355 10021 546955 0))
 ;;; Generated autoloads from international/iso-cvt.el
 
 (autoload 'iso-spanish "iso-cvt" "\
@@ -15810,7 +15999,7 @@ Add submenus to the File menu, to convert to and from various formats.
 ;;;***
 \f
 ;;;### (autoloads nil "iso-transl" "international/iso-transl.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from international/iso-transl.el
  (or key-translation-map (setq key-translation-map (make-sparse-keymap)))
  (define-key key-translation-map "\C-x8" 'iso-transl-ctl-x-8-map)
@@ -15822,13 +16011,13 @@ Add submenus to the File menu, to convert to and from various formats.
 ;;;;;;  ispell-complete-word ispell-continue ispell-buffer ispell-comments-and-strings
 ;;;;;;  ispell-region ispell-change-dictionary ispell-kill-ispell
 ;;;;;;  ispell-help ispell-pdict-save ispell-word ispell-personal-dictionary)
-;;;;;;  "ispell" "textmodes/ispell.el" (20400 62402))
+;;;;;;  "ispell" "textmodes/ispell.el" (20458 56750 651721 0))
 ;;; Generated autoloads from textmodes/ispell.el
 
 (put 'ispell-check-comments 'safe-local-variable (lambda (a) (memq a '(nil t exclusive))))
 
 (defvar ispell-personal-dictionary nil "\
-*File name of your personal spelling dictionary, or nil.
+File name of your personal spelling dictionary, or nil.
 If nil, the default personal dictionary, (\"~/.ispell_DICTNAME\" for ispell or
 \"~/.aspell.LANG.pws\" for aspell) is used, where DICTNAME is the name of your
 default dictionary and LANG the two letter language code.")
@@ -15847,7 +16036,7 @@ and added as a submenu of the \"Edit\" menu.")
 
 (defvar ispell-menu-map-needed (and (not ispell-menu-map) (not (featurep 'xemacs)) 'reload))
 
-(if ispell-menu-map-needed (progn (setq ispell-menu-map (make-sparse-keymap "Spell")) (define-key ispell-menu-map [ispell-change-dictionary] `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary :help ,(purecopy "Supply explicit dictionary file name"))) (define-key ispell-menu-map [ispell-kill-ispell] `(menu-item ,(purecopy "Kill Process") ispell-kill-ispell :enable (and (boundp 'ispell-process) ispell-process (eq (ispell-process-status) 'run)) :help ,(purecopy "Terminate Ispell subprocess"))) (define-key ispell-menu-map [ispell-pdict-save] `(menu-item ,(purecopy "Save Dictionary") (lambda nil (interactive) (ispell-pdict-save t t)) :help ,(purecopy "Save personal dictionary"))) (define-key ispell-menu-map [ispell-customize] `(menu-item ,(purecopy "Customize...") (lambda nil (interactive) (customize-group 'ispell)) :help ,(purecopy "Customize spell checking options"))) (define-key ispell-menu-map [ispell-help] `(menu-item ,(purecopy "Help") (lambda nil (interactive) (describe-function 'ispell-help)) :help ,(purecopy "Show standard Ispell keybindings and commands"))) (define-key ispell-menu-map [flyspell-mode] `(menu-item ,(purecopy "Automatic spell checking (Flyspell)") flyspell-mode :help ,(purecopy "Check spelling while you edit the text") :button (:toggle bound-and-true-p flyspell-mode))) (define-key ispell-menu-map [ispell-complete-word] `(menu-item ,(purecopy "Complete Word") ispell-complete-word :help ,(purecopy "Complete word at cursor using dictionary"))) (define-key ispell-menu-map [ispell-complete-word-interior-frag] `(menu-item ,(purecopy "Complete Word Fragment") ispell-complete-word-interior-frag :help ,(purecopy "Complete word fragment at cursor")))))
+(if ispell-menu-map-needed (progn (setq ispell-menu-map (make-sparse-keymap "Spell")) (define-key ispell-menu-map [ispell-change-dictionary] `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary :help ,(purecopy "Supply explicit dictionary file name"))) (define-key ispell-menu-map [ispell-kill-ispell] `(menu-item ,(purecopy "Kill Process") (lambda nil (interactive) (ispell-kill-ispell nil 'clear)) :enable (and (boundp 'ispell-process) ispell-process (eq (ispell-process-status) 'run)) :help ,(purecopy "Terminate Ispell subprocess"))) (define-key ispell-menu-map [ispell-pdict-save] `(menu-item ,(purecopy "Save Dictionary") (lambda nil (interactive) (ispell-pdict-save t t)) :help ,(purecopy "Save personal dictionary"))) (define-key ispell-menu-map [ispell-customize] `(menu-item ,(purecopy "Customize...") (lambda nil (interactive) (customize-group 'ispell)) :help ,(purecopy "Customize spell checking options"))) (define-key ispell-menu-map [ispell-help] `(menu-item ,(purecopy "Help") (lambda nil (interactive) (describe-function 'ispell-help)) :help ,(purecopy "Show standard Ispell keybindings and commands"))) (define-key ispell-menu-map [flyspell-mode] `(menu-item ,(purecopy "Automatic spell checking (Flyspell)") flyspell-mode :help ,(purecopy "Check spelling while you edit the text") :button (:toggle bound-and-true-p flyspell-mode))) (define-key ispell-menu-map [ispell-complete-word] `(menu-item ,(purecopy "Complete Word") ispell-complete-word :help ,(purecopy "Complete word at cursor using dictionary"))) (define-key ispell-menu-map [ispell-complete-word-interior-frag] `(menu-item ,(purecopy "Complete Word Fragment") ispell-complete-word-interior-frag :help ,(purecopy "Complete word fragment at cursor")))))
 
 (if ispell-menu-map-needed (progn (define-key ispell-menu-map [ispell-continue] `(menu-item ,(purecopy "Continue Spell-Checking") ispell-continue :enable (and (boundp 'ispell-region-end) (marker-position ispell-region-end) (equal (marker-buffer ispell-region-end) (current-buffer))) :help ,(purecopy "Continue spell checking last region"))) (define-key ispell-menu-map [ispell-word] `(menu-item ,(purecopy "Spell-Check Word") ispell-word :help ,(purecopy "Spell-check word at cursor"))) (define-key ispell-menu-map [ispell-comments-and-strings] `(menu-item ,(purecopy "Spell-Check Comments") ispell-comments-and-strings :help ,(purecopy "Spell-check only comments and strings")))))
 
@@ -15863,7 +16052,7 @@ Valid forms include:
   (KEY FUNCTION ARGS) - FUNCTION called with ARGS returns end of region.")
 
 (defvar ispell-tex-skip-alists (purecopy '((("\\\\addcontentsline" ispell-tex-arg-end 2) ("\\\\add\\(tocontents\\|vspace\\)" ispell-tex-arg-end) ("\\\\\\([aA]lph\\|arabic\\)" ispell-tex-arg-end) ("\\\\bibliographystyle" ispell-tex-arg-end) ("\\\\makebox" ispell-tex-arg-end 0) ("\\\\e?psfig" ispell-tex-arg-end) ("\\\\document\\(class\\|style\\)" . "\\\\begin[       \n]*{[  \n]*document[   \n]*}")) (("\\(figure\\|table\\)\\*?" ispell-tex-arg-end 0) ("list" ispell-tex-arg-end 2) ("program" . "\\\\end[        \n]*{[  \n]*program[    \n]*}") ("verbatim\\*?" . "\\\\end[     \n]*{[  \n]*verbatim\\*?[       \n]*}")))) "\
-*Lists of regions to be skipped in TeX mode.
+Lists of regions to be skipped in TeX mode.
 First list is used raw.
 Second list has key placed inside \\begin{}.
 
@@ -15871,7 +16060,7 @@ Delete or add any regions you want to be automatically selected
 for skipping in latex mode.")
 
 (defconst ispell-html-skip-alists '(("<[cC][oO][dD][eE]\\>[^>]*>" "</[cC][oO][dD][eE]*>") ("<[sS][cC][rR][iI][pP][tT]\\>[^>]*>" "</[sS][cC][rR][iI][pP][tT]>") ("<[aA][pP][pP][lL][eE][tT]\\>[^>]*>" "</[aA][pP][pP][lL][eE][tT]>") ("<[vV][eE][rR][bB]\\>[^>]*>" "<[vV][eE][rR][bB]\\>[^>]*>") ("<[tT][tT]/" "/") ("<[^       \n>]" ">") ("&[^        \n;]" "[;       \n]")) "\
-*Lists of start and end keys to skip in HTML buffers.
+Lists of start and end keys to skip in HTML buffers.
 Same format as `ispell-skip-region-alist'.
 Note - substrings of other matches must come last
  (e.g. \"<[tT][tT]/\" and \"<[^ \\t\\n>]\").")
@@ -15945,8 +16134,9 @@ SPC:   Accept word this time.
 (autoload 'ispell-kill-ispell "ispell" "\
 Kill current Ispell process (so that you may start a fresh one).
 With NO-ERROR, just return non-nil if there was no Ispell running.
+With CLEAR, buffer session localwords are cleaned.
 
-\(fn &optional NO-ERROR)" t nil)
+\(fn &optional NO-ERROR CLEAR)" t nil)
 
 (autoload 'ispell-change-dictionary "ispell" "\
 Change to dictionary DICT for Ispell.
@@ -16048,8 +16238,8 @@ You can bind this to the key C-c i in GNUS or mail by adding to
 
 ;;;***
 \f
-;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (iswitchb-mode) "iswitchb" "iswitchb.el" (20387
+;;;;;;  44199 24128 0))
 ;;; Generated autoloads from iswitchb.el
 
 (defvar iswitchb-mode nil "\
@@ -16077,7 +16267,8 @@ between buffers using substrings.  See `iswitchb' for details.
 ;;;### (autoloads (read-hiragana-string japanese-zenkaku-region japanese-hankaku-region
 ;;;;;;  japanese-hiragana-region japanese-katakana-region japanese-zenkaku
 ;;;;;;  japanese-hankaku japanese-hiragana japanese-katakana setup-japanese-environment-internal)
-;;;;;;  "japan-util" "language/japan-util.el" (20352 65510))
+;;;;;;  "japan-util" "language/japan-util.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from language/japan-util.el
 
 (autoload 'setup-japanese-environment-internal "japan-util" "\
@@ -16155,7 +16346,7 @@ If non-nil, second arg INITIAL-INPUT is a string to insert before reading.
 ;;;***
 \f
 ;;;### (autoloads (jka-compr-uninstall jka-compr-handler) "jka-compr"
-;;;;;;  "jka-compr.el" (20352 65510))
+;;;;;;  "jka-compr.el" (20355 10021 546955 0))
 ;;; Generated autoloads from jka-compr.el
 
 (defvar jka-compr-inhibit nil "\
@@ -16178,7 +16369,8 @@ by `jka-compr-installed'.
 
 ;;;***
 \f
-;;;### (autoloads (js-mode) "js" "progmodes/js.el" (20400 62402))
+;;;### (autoloads (js-mode) "js" "progmodes/js.el" (20459 40320 865360
+;;;;;;  0))
 ;;; Generated autoloads from progmodes/js.el
 
 (autoload 'js-mode "js" "\
@@ -16192,7 +16384,7 @@ Major mode for editing JavaScript.
 \f
 ;;;### (autoloads (keypad-setup keypad-numlock-shifted-setup keypad-shifted-setup
 ;;;;;;  keypad-numlock-setup keypad-setup) "keypad" "emulation/keypad.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emulation/keypad.el
 
 (defvar keypad-setup nil "\
@@ -16248,7 +16440,7 @@ the decimal key on the keypad is mapped to DECIMAL instead of `.'
 ;;;***
 \f
 ;;;### (autoloads (kinsoku) "kinsoku" "international/kinsoku.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from international/kinsoku.el
 
 (autoload 'kinsoku "kinsoku" "\
@@ -16269,8 +16461,8 @@ the context of text formatting.
 
 ;;;***
 \f
-;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (kkc-region) "kkc" "international/kkc.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from international/kkc.el
 
 (defvar kkc-after-update-conversion-functions nil "\
@@ -16295,7 +16487,7 @@ and the return value is the length of the conversion.
 ;;;### (autoloads (kmacro-end-call-mouse kmacro-end-and-call-macro
 ;;;;;;  kmacro-end-or-call-macro kmacro-start-macro-or-insert-counter
 ;;;;;;  kmacro-call-macro kmacro-end-macro kmacro-start-macro kmacro-exec-ring-item)
-;;;;;;  "kmacro" "kmacro.el" (20400 62402))
+;;;;;;  "kmacro" "kmacro.el" (20388 65061 302484 0))
 ;;; Generated autoloads from kmacro.el
  (global-set-key "\C-x(" 'kmacro-start-macro)
  (global-set-key "\C-x)" 'kmacro-end-macro)
@@ -16406,11 +16598,11 @@ If kbd macro currently being defined end it before activating it.
 ;;;***
 \f
 ;;;### (autoloads (setup-korean-environment-internal) "korea-util"
-;;;;;;  "language/korea-util.el" (20400 62402))
+;;;;;;  "language/korea-util.el" (20355 10021 546955 0))
 ;;; Generated autoloads from language/korea-util.el
 
 (defvar default-korean-keyboard (purecopy (if (string-match "3" (or (getenv "HANGUL_KEYBOARD_TYPE") "")) "3" "")) "\
-*The kind of Korean keyboard for Korean input method.
+The kind of Korean keyboard for Korean input method.
 \"\" for 2, \"3\" for 3.")
 
 (autoload 'setup-korean-environment-internal "korea-util" "\
@@ -16421,7 +16613,7 @@ If kbd macro currently being defined end it before activating it.
 ;;;***
 \f
 ;;;### (autoloads (landmark landmark-test-run) "landmark" "play/landmark.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from play/landmark.el
 
 (defalias 'landmark-repeat 'landmark-test-run)
@@ -16453,7 +16645,7 @@ Use \\[describe-mode] for more info.
 \f
 ;;;### (autoloads (lao-compose-region lao-composition-function lao-transcribe-roman-to-lao-string
 ;;;;;;  lao-transcribe-single-roman-syllable-to-lao lao-compose-string)
-;;;;;;  "lao-util" "language/lao-util.el" (20352 65510))
+;;;;;;  "lao-util" "language/lao-util.el" (20355 10021 546955 0))
 ;;; Generated autoloads from language/lao-util.el
 
 (autoload 'lao-compose-string "lao-util" "\
@@ -16492,7 +16684,8 @@ Transcribe Romanized Lao string STR to Lao character string.
 \f
 ;;;### (autoloads (latexenc-find-file-coding-system latexenc-coding-system-to-inputenc
 ;;;;;;  latexenc-inputenc-to-coding-system latex-inputenc-coding-alist)
-;;;;;;  "latexenc" "international/latexenc.el" (20352 65510))
+;;;;;;  "latexenc" "international/latexenc.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from international/latexenc.el
 
 (defvar latex-inputenc-coding-alist (purecopy '(("ansinew" . windows-1252) ("applemac" . mac-roman) ("ascii" . us-ascii) ("cp1250" . windows-1250) ("cp1252" . windows-1252) ("cp1257" . cp1257) ("cp437de" . cp437) ("cp437" . cp437) ("cp850" . cp850) ("cp852" . cp852) ("cp858" . cp858) ("cp865" . cp865) ("latin1" . iso-8859-1) ("latin2" . iso-8859-2) ("latin3" . iso-8859-3) ("latin4" . iso-8859-4) ("latin5" . iso-8859-5) ("latin9" . iso-8859-15) ("next" . next) ("utf8" . utf-8) ("utf8x" . utf-8))) "\
@@ -16524,7 +16717,8 @@ coding system names is determined from `latex-inputenc-coding-alist'.
 ;;;***
 \f
 ;;;### (autoloads (latin1-display-ucs-per-lynx latin1-display latin1-display)
-;;;;;;  "latin1-disp" "international/latin1-disp.el" (20352 65510))
+;;;;;;  "latin1-disp" "international/latin1-disp.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from international/latin1-disp.el
 
 (defvar latin1-display nil "\
@@ -16566,7 +16760,7 @@ use either \\[customize] or the function `latin1-display'.")
 ;;;***
 \f
 ;;;### (autoloads (ld-script-mode) "ld-script" "progmodes/ld-script.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/ld-script.el
 
 (autoload 'ld-script-mode "ld-script" "\
@@ -16576,43 +16770,8 @@ A major mode to edit GNU ld script files
 
 ;;;***
 \f
-;;;### (autoloads (ledit-from-lisp-mode ledit-mode) "ledit" "ledit.el"
-;;;;;;  (20352 65510))
-;;; Generated autoloads from ledit.el
-
-(defconst ledit-save-files t "\
-*Non-nil means Ledit should save files before transferring to Lisp.")
-
-(defconst ledit-go-to-lisp-string "%?lisp" "\
-*Shell commands to execute to resume Lisp job.")
-
-(defconst ledit-go-to-liszt-string "%?liszt" "\
-*Shell commands to execute to resume Lisp compiler job.")
-
-(autoload 'ledit-mode "ledit" "\
-\\<ledit-mode-map>Major mode for editing text and stuffing it to a Lisp job.
-Like Lisp mode, plus these special commands:
-  \\[ledit-save-defun] -- record defun at or after point
-          for later transmission to Lisp job.
-  \\[ledit-save-region] -- record region for later transmission to Lisp job.
-  \\[ledit-go-to-lisp] -- transfer to Lisp job and transmit saved text.
-  \\[ledit-go-to-liszt] -- transfer to Liszt (Lisp compiler) job
-          and transmit saved text.
-
-\\{ledit-mode-map}
-To make Lisp mode automatically change to Ledit mode,
-do (setq lisp-mode-hook 'ledit-from-lisp-mode)
-
-\(fn)" t nil)
-
-(autoload 'ledit-from-lisp-mode "ledit" "\
-
-
-\(fn)" nil nil)
-
-;;;***
-\f
-;;;### (autoloads (life) "life" "play/life.el" (20352 65510))
+;;;### (autoloads (life) "life" "play/life.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from play/life.el
 
 (autoload 'life "life" "\
@@ -16626,7 +16785,7 @@ generations (this defaults to 1).
 ;;;***
 \f
 ;;;### (autoloads (global-linum-mode linum-mode linum-format) "linum"
-;;;;;;  "linum.el" (20352 65510))
+;;;;;;  "linum.el" (20355 10021 546955 0))
 ;;; Generated autoloads from linum.el
 
 (defvar linum-format 'dynamic "\
@@ -16671,8 +16830,8 @@ See `linum-mode' for more information on Linum mode.
 
 ;;;***
 \f
-;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (unload-feature) "loadhist" "loadhist.el" (20399
+;;;;;;  35365 4050 0))
 ;;; Generated autoloads from loadhist.el
 
 (autoload 'unload-feature "loadhist" "\
@@ -16704,7 +16863,7 @@ something strange, such as redefining an Emacs function.
 ;;;***
 \f
 ;;;### (autoloads (locate-with-filter locate locate-ls-subdir-switches)
-;;;;;;  "locate" "locate.el" (20352 65510))
+;;;;;;  "locate" "locate.el" (20355 10021 546955 0))
 ;;; Generated autoloads from locate.el
 
 (defvar locate-ls-subdir-switches (purecopy "-al") "\
@@ -16756,7 +16915,8 @@ except that FILTER is not optional.
 
 ;;;***
 \f
-;;;### (autoloads (log-edit) "log-edit" "vc/log-edit.el" (20400 62402))
+;;;### (autoloads (log-edit) "log-edit" "vc/log-edit.el" (20399 35365
+;;;;;;  4050 0))
 ;;; Generated autoloads from vc/log-edit.el
 
 (autoload 'log-edit "log-edit" "\
@@ -16783,8 +16943,8 @@ uses the current buffer.
 
 ;;;***
 \f
-;;;### (autoloads (log-view-mode) "log-view" "vc/log-view.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (log-view-mode) "log-view" "vc/log-view.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from vc/log-view.el
 
 (autoload 'log-view-mode "log-view" "\
@@ -16794,8 +16954,8 @@ Major mode for browsing CVS log output.
 
 ;;;***
 \f
-;;;### (autoloads (longlines-mode) "longlines" "longlines.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (longlines-mode) "longlines" "longlines.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from longlines.el
 
 (autoload 'longlines-mode "longlines" "\
@@ -16821,8 +16981,8 @@ newlines are indicated with a symbol.
 ;;;***
 \f
 ;;;### (autoloads (print-region lpr-region print-buffer lpr-buffer
-;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (20352
-;;;;;;  65510))
+;;;;;;  lpr-command lpr-switches printer-name) "lpr" "lpr.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from lpr.el
 
 (defvar lpr-windows-system (memq system-type '(ms-dos windows-nt)) "\
@@ -16918,7 +17078,7 @@ for further customization of the printer command.
 ;;;***
 \f
 ;;;### (autoloads (ls-lisp-support-shell-wildcards) "ls-lisp" "ls-lisp.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from ls-lisp.el
 
 (defvar ls-lisp-support-shell-wildcards t "\
@@ -16929,8 +17089,8 @@ Otherwise they are treated as Emacs regexps (for backward compatibility).")
 
 ;;;***
 \f
-;;;### (autoloads (lunar-phases) "lunar" "calendar/lunar.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (lunar-phases) "lunar" "calendar/lunar.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from calendar/lunar.el
 
 (autoload 'lunar-phases "lunar" "\
@@ -16944,8 +17104,8 @@ This function is suitable for execution in a .emacs file.
 
 ;;;***
 \f
-;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (m4-mode) "m4-mode" "progmodes/m4-mode.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/m4-mode.el
 
 (autoload 'm4-mode "m4-mode" "\
@@ -16956,7 +17116,7 @@ A major mode to edit m4 macro files.
 ;;;***
 \f
 ;;;### (autoloads (macroexpand-all) "macroexp" "emacs-lisp/macroexp.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20454 59685 195070 0))
 ;;; Generated autoloads from emacs-lisp/macroexp.el
 
 (autoload 'macroexpand-all "macroexp" "\
@@ -16970,7 +17130,8 @@ definitions to shadow the loaded ones for use in file byte-compilation.
 ;;;***
 \f
 ;;;### (autoloads (apply-macro-to-region-lines kbd-macro-query insert-kbd-macro
-;;;;;;  name-last-kbd-macro) "macros" "macros.el" (20352 65510))
+;;;;;;  name-last-kbd-macro) "macros" "macros.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from macros.el
 
 (autoload 'name-last-kbd-macro "macros" "\
@@ -17059,7 +17220,7 @@ and then select the region of un-tablified names and use
 ;;;***
 \f
 ;;;### (autoloads (what-domain mail-extract-address-components) "mail-extr"
-;;;;;;  "mail/mail-extr.el" (20400 62402))
+;;;;;;  "mail/mail-extr.el" (20355 10021 546955 0))
 ;;; Generated autoloads from mail/mail-extr.el
 
 (autoload 'mail-extract-address-components "mail-extr" "\
@@ -17091,7 +17252,7 @@ Convert mail domain DOMAIN to the country it corresponds to.
 \f
 ;;;### (autoloads (mail-hist-put-headers-into-history mail-hist-keep-history
 ;;;;;;  mail-hist-enable mail-hist-define-keys) "mail-hist" "mail/mail-hist.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mail/mail-hist.el
 
 (autoload 'mail-hist-define-keys "mail-hist" "\
@@ -17105,7 +17266,7 @@ Define keys for accessing mail header history.  For use in hooks.
 \(fn)" nil nil)
 
 (defvar mail-hist-keep-history t "\
-*Non-nil means keep a history for headers and text of outgoing mail.")
+Non-nil means keep a history for headers and text of outgoing mail.")
 
 (custom-autoload 'mail-hist-keep-history "mail-hist" t)
 
@@ -17123,7 +17284,7 @@ This function normally would be called when the message is sent.
 ;;;### (autoloads (mail-fetch-field mail-unquote-printable-region
 ;;;;;;  mail-unquote-printable mail-quote-printable-region mail-quote-printable
 ;;;;;;  mail-file-babyl-p mail-dont-reply-to-names mail-use-rfc822)
-;;;;;;  "mail-utils" "mail/mail-utils.el" (20352 65510))
+;;;;;;  "mail-utils" "mail/mail-utils.el" (20355 10021 546955 0))
 ;;; Generated autoloads from mail/mail-utils.el
 
 (defvar mail-use-rfc822 nil "\
@@ -17198,8 +17359,8 @@ matches may be returned from the message body.
 ;;;***
 \f
 ;;;### (autoloads (define-mail-abbrev build-mail-abbrevs mail-abbrevs-setup
-;;;;;;  mail-abbrevs-mode) "mailabbrev" "mail/mailabbrev.el" (20400
-;;;;;;  62402))
+;;;;;;  mail-abbrevs-mode) "mailabbrev" "mail/mailabbrev.el" (20387
+;;;;;;  44199 24128 0))
 ;;; Generated autoloads from mail/mailabbrev.el
 
 (defvar mail-abbrevs-mode nil "\
@@ -17250,7 +17411,7 @@ double-quotes.
 \f
 ;;;### (autoloads (mail-complete mail-completion-at-point-function
 ;;;;;;  define-mail-alias expand-mail-aliases mail-complete-style)
-;;;;;;  "mailalias" "mail/mailalias.el" (20352 65510))
+;;;;;;  "mailalias" "mail/mailalias.el" (20355 10021 546955 0))
 ;;; Generated autoloads from mail/mailalias.el
 
 (defvar mail-complete-style 'angles "\
@@ -17302,7 +17463,7 @@ current header, calls `mail-complete-function' and passes prefix ARG if any.
 ;;;***
 \f
 ;;;### (autoloads (mailclient-send-it) "mailclient" "mail/mailclient.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mail/mailclient.el
 
 (autoload 'mailclient-send-it "mailclient" "\
@@ -17316,7 +17477,8 @@ The mail client is taken to be the handler of mailto URLs.
 \f
 ;;;### (autoloads (makefile-imake-mode makefile-bsdmake-mode makefile-makepp-mode
 ;;;;;;  makefile-gmake-mode makefile-automake-mode makefile-mode)
-;;;;;;  "make-mode" "progmodes/make-mode.el" (20400 62402))
+;;;;;;  "make-mode" "progmodes/make-mode.el" (20392 30149 675975
+;;;;;;  59000))
 ;;; Generated autoloads from progmodes/make-mode.el
 
 (autoload 'makefile-mode "make-mode" "\
@@ -17433,8 +17595,8 @@ An adapted `makefile-mode' that knows about imake.
 
 ;;;***
 \f
-;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (make-command-summary) "makesum" "makesum.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from makesum.el
 
 (autoload 'make-command-summary "makesum" "\
@@ -17446,7 +17608,7 @@ Previous contents of that buffer are killed first.
 ;;;***
 \f
 ;;;### (autoloads (Man-bookmark-jump man-follow man) "man" "man.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20390 20388 254308 0))
 ;;; Generated autoloads from man.el
 
 (defalias 'manual-entry 'man)
@@ -17500,7 +17662,8 @@ Default bookmark handler for Man buffers.
 
 ;;;***
 \f
-;;;### (autoloads (master-mode) "master" "master.el" (20352 65510))
+;;;### (autoloads (master-mode) "master" "master.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from master.el
 
 (autoload 'master-mode "master" "\
@@ -17523,7 +17686,7 @@ yourself the value of `master-of' by calling `master-show-slave'.
 ;;;***
 \f
 ;;;### (autoloads (minibuffer-depth-indicate-mode) "mb-depth" "mb-depth.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mb-depth.el
 
 (defvar minibuffer-depth-indicate-mode nil "\
@@ -17556,7 +17719,7 @@ recursion depth in the minibuffer prompt.  This is only useful if
 ;;;;;;  message-forward-make-body message-forward message-recover
 ;;;;;;  message-supersede message-cancel-news message-followup message-wide-reply
 ;;;;;;  message-reply message-news message-mail message-mode) "message"
-;;;;;;  "gnus/message.el" (20352 65510))
+;;;;;;  "gnus/message.el" (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/message.el
 
 (define-mail-user-agent 'message-user-agent 'message-mail 'message-send-and-exit 'message-kill-buffer 'message-send-hook)
@@ -17722,7 +17885,7 @@ which specify the range to operate on.
 ;;;***
 \f
 ;;;### (autoloads (metapost-mode metafont-mode) "meta-mode" "progmodes/meta-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20399 35365 4050 0))
 ;;; Generated autoloads from progmodes/meta-mode.el
 
 (autoload 'metafont-mode "meta-mode" "\
@@ -17739,7 +17902,7 @@ Major mode for editing MetaPost sources.
 \f
 ;;;### (autoloads (metamail-region metamail-buffer metamail-interpret-body
 ;;;;;;  metamail-interpret-header) "metamail" "mail/metamail.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mail/metamail.el
 
 (autoload 'metamail-interpret-header "metamail" "\
@@ -17784,7 +17947,7 @@ redisplayed as output is inserted.
 \f
 ;;;### (autoloads (mh-fully-kill-draft mh-send-letter mh-user-agent-compose
 ;;;;;;  mh-smail-batch mh-smail-other-window mh-smail) "mh-comp"
-;;;;;;  "mh-e/mh-comp.el" (20352 65510))
+;;;;;;  "mh-e/mh-comp.el" (20355 10021 546955 0))
 ;;; Generated autoloads from mh-e/mh-comp.el
 
 (autoload 'mh-smail "mh-comp" "\
@@ -17874,7 +18037,8 @@ delete the draft message.
 
 ;;;***
 \f
-;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (20352 65510))
+;;;### (autoloads (mh-version) "mh-e" "mh-e/mh-e.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from mh-e/mh-e.el
 
 (put 'mh-progs 'risky-local-variable t)
@@ -17891,7 +18055,7 @@ Display version information about MH-E and the MH mail handling system.
 ;;;***
 \f
 ;;;### (autoloads (mh-folder-mode mh-nmail mh-rmail) "mh-folder"
-;;;;;;  "mh-e/mh-folder.el" (20400 62402))
+;;;;;;  "mh-e/mh-folder.el" (20371 55972 331861 0))
 ;;; Generated autoloads from mh-e/mh-folder.el
 
 (autoload 'mh-rmail "mh-folder" "\
@@ -17973,7 +18137,7 @@ perform the operation on all messages in that region.
 ;;;***
 \f
 ;;;### (autoloads (midnight-delay-set clean-buffer-list) "midnight"
-;;;;;;  "midnight.el" (20352 65510))
+;;;;;;  "midnight.el" (20355 10021 546955 0))
 ;;; Generated autoloads from midnight.el
 
 (autoload 'clean-buffer-list "midnight" "\
@@ -18000,7 +18164,7 @@ to its second argument TM.
 ;;;***
 \f
 ;;;### (autoloads (minibuffer-electric-default-mode) "minibuf-eldef"
-;;;;;;  "minibuf-eldef.el" (20400 62402))
+;;;;;;  "minibuf-eldef.el" (20355 10021 546955 0))
 ;;; Generated autoloads from minibuf-eldef.el
 
 (defvar minibuffer-electric-default-mode nil "\
@@ -18030,7 +18194,7 @@ is modified to remove the default indication.
 ;;;***
 \f
 ;;;### (autoloads (list-dynamic-libraries butterfly) "misc" "misc.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20356 27828 24951 0))
 ;;; Generated autoloads from misc.el
 
 (autoload 'butterfly "misc" "\
@@ -18060,7 +18224,7 @@ The return value is always nil.
 \f
 ;;;### (autoloads (multi-isearch-files-regexp multi-isearch-files
 ;;;;;;  multi-isearch-buffers-regexp multi-isearch-buffers multi-isearch-setup)
-;;;;;;  "misearch" "misearch.el" (20352 65510))
+;;;;;;  "misearch" "misearch.el" (20420 41510 996439 0))
 ;;; Generated autoloads from misearch.el
  (add-hook 'isearch-mode-hook 'multi-isearch-setup)
 
@@ -18142,7 +18306,7 @@ whose file names match the specified wildcard.
 ;;;***
 \f
 ;;;### (autoloads (mixal-mode) "mixal-mode" "progmodes/mixal-mode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/mixal-mode.el
 
 (autoload 'mixal-mode "mixal-mode" "\
@@ -18153,7 +18317,7 @@ Major mode for the mixal asm language.
 ;;;***
 \f
 ;;;### (autoloads (mm-default-file-encoding) "mm-encode" "gnus/mm-encode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/mm-encode.el
 
 (autoload 'mm-default-file-encoding "mm-encode" "\
@@ -18164,7 +18328,7 @@ Return a default encoding for FILE.
 ;;;***
 \f
 ;;;### (autoloads (mm-inline-external-body mm-extern-cache-contents)
-;;;;;;  "mm-extern" "gnus/mm-extern.el" (20352 65510))
+;;;;;;  "mm-extern" "gnus/mm-extern.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/mm-extern.el
 
 (autoload 'mm-extern-cache-contents "mm-extern" "\
@@ -18183,7 +18347,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing.
 ;;;***
 \f
 ;;;### (autoloads (mm-inline-partial) "mm-partial" "gnus/mm-partial.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/mm-partial.el
 
 (autoload 'mm-inline-partial "mm-partial" "\
@@ -18197,7 +18361,7 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing.
 ;;;***
 \f
 ;;;### (autoloads (mm-url-insert-file-contents-external mm-url-insert-file-contents)
-;;;;;;  "mm-url" "gnus/mm-url.el" (20352 65510))
+;;;;;;  "mm-url" "gnus/mm-url.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/mm-url.el
 
 (autoload 'mm-url-insert-file-contents "mm-url" "\
@@ -18214,7 +18378,7 @@ Insert file contents of URL using `mm-url-program'.
 ;;;***
 \f
 ;;;### (autoloads (mm-uu-dissect-text-parts mm-uu-dissect) "mm-uu"
-;;;;;;  "gnus/mm-uu.el" (20352 65510))
+;;;;;;  "gnus/mm-uu.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/mm-uu.el
 
 (autoload 'mm-uu-dissect "mm-uu" "\
@@ -18234,7 +18398,7 @@ Assume text has been decoded if DECODED is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (mml-attach-file mml-to-mime) "mml" "gnus/mml.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/mml.el
 
 (autoload 'mml-to-mime "mml" "\
@@ -18259,7 +18423,7 @@ body) or \"attachment\" (separate from the body).
 ;;;***
 \f
 ;;;### (autoloads (mml1991-sign mml1991-encrypt) "mml1991" "gnus/mml1991.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/mml1991.el
 
 (autoload 'mml1991-encrypt "mml1991" "\
@@ -18276,7 +18440,7 @@ body) or \"attachment\" (separate from the body).
 \f
 ;;;### (autoloads (mml2015-self-encrypt mml2015-sign mml2015-encrypt
 ;;;;;;  mml2015-verify-test mml2015-verify mml2015-decrypt-test mml2015-decrypt)
-;;;;;;  "mml2015" "gnus/mml2015.el" (20352 65510))
+;;;;;;  "mml2015" "gnus/mml2015.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/mml2015.el
 
 (autoload 'mml2015-decrypt "mml2015" "\
@@ -18316,8 +18480,16 @@ body) or \"attachment\" (separate from the body).
 
 ;;;***
 \f
-;;;### (autoloads (m2-mode) "modula2" "progmodes/modula2.el" (20400
-;;;;;;  62402))
+;;;### (autoloads nil "mode-local" "cedet/mode-local.el" (20406 8611
+;;;;;;  875037 0))
+;;; Generated autoloads from cedet/mode-local.el
+
+(put 'define-overloadable-function 'doc-string-elt 3)
+
+;;;***
+\f
+;;;### (autoloads (m2-mode) "modula2" "progmodes/modula2.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/modula2.el
 
 (defalias 'modula-2-mode 'm2-mode)
@@ -18351,7 +18523,7 @@ followed by the first character of the construct.
 ;;;***
 \f
 ;;;### (autoloads (denato-region nato-region unmorse-region morse-region)
-;;;;;;  "morse" "play/morse.el" (20352 65510))
+;;;;;;  "morse" "play/morse.el" (20355 10021 546955 0))
 ;;; Generated autoloads from play/morse.el
 
 (autoload 'morse-region "morse" "\
@@ -18377,7 +18549,7 @@ Convert NATO phonetic alphabet in region to ordinary ASCII text.
 ;;;***
 \f
 ;;;### (autoloads (mouse-drag-drag mouse-drag-throw) "mouse-drag"
-;;;;;;  "mouse-drag.el" (20400 62402))
+;;;;;;  "mouse-drag.el" (20355 10021 546955 0))
 ;;; Generated autoloads from mouse-drag.el
 
 (autoload 'mouse-drag-throw "mouse-drag" "\
@@ -18424,51 +18596,7 @@ To test this function, evaluate:
 
 ;;;***
 \f
-;;;### (autoloads (mouse-sel-mode) "mouse-sel" "mouse-sel.el" (20400
-;;;;;;  62402))
-;;; Generated autoloads from mouse-sel.el
-
-(defvar mouse-sel-mode nil "\
-Non-nil if Mouse-Sel mode is enabled.
-See the command `mouse-sel-mode' for a description of this minor mode.
-Setting this variable directly does not take effect;
-either customize it (see the info node `Easy Customization')
-or call the function `mouse-sel-mode'.")
-
-(custom-autoload 'mouse-sel-mode "mouse-sel" nil)
-
-(autoload 'mouse-sel-mode "mouse-sel" "\
-Toggle Mouse Sel mode.
-With a prefix argument ARG, enable Mouse Sel mode if ARG is
-positive, and disable it otherwise.  If called from Lisp, enable
-the mode if ARG is omitted or nil.
-
-Mouse Sel mode is a global minor mode.  When enabled, mouse
-selection is enhanced in various ways:
-
-- Double-clicking on symbol constituents selects symbols.
-Double-clicking on quotes or parentheses selects sexps.
-Double-clicking on whitespace selects whitespace.
-Triple-clicking selects lines.
-Quad-clicking selects paragraphs.
-
-- Selecting sets the region & X primary selection, but does NOT affect
-the `kill-ring', nor do the kill-ring functions change the X selection.
-Because the mouse handlers set the primary selection directly,
-mouse-sel sets the variables `interprogram-cut-function' and
-`interprogram-paste-function' to nil.
-
-- Clicking mouse-2 inserts the contents of the primary selection at
-the mouse position (or point, if `mouse-yank-at-point' is non-nil).
-
-- mouse-2 while selecting or extending copies selection to the
-kill ring; mouse-1 or mouse-3 kills it.
-
-\(fn &optional ARG)" t nil)
-
-;;;***
-\f
-;;;### (autoloads (mpc) "mpc" "mpc.el" (20400 62402))
+;;;### (autoloads (mpc) "mpc" "mpc.el" (20378 29222 722320 0))
 ;;; Generated autoloads from mpc.el
 
 (autoload 'mpc "mpc" "\
@@ -18478,7 +18606,8 @@ Main entry point for MPC.
 
 ;;;***
 \f
-;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (20352 65510))
+;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (20434 17809 692608
+;;;;;;  0))
 ;;; Generated autoloads from play/mpuz.el
 
 (autoload 'mpuz "mpuz" "\
@@ -18488,7 +18617,7 @@ Multiplication puzzle with GNU Emacs.
 
 ;;;***
 \f
-;;;### (autoloads (msb-mode) "msb" "msb.el" (20400 62402))
+;;;### (autoloads (msb-mode) "msb" "msb.el" (20355 10021 546955 0))
 ;;; Generated autoloads from msb.el
 
 (defvar msb-mode nil "\
@@ -18518,7 +18647,7 @@ different buffer menu using the function `msb'.
 ;;;;;;  describe-current-coding-system describe-current-coding-system-briefly
 ;;;;;;  describe-coding-system describe-character-set list-charset-chars
 ;;;;;;  read-charset list-character-sets) "mule-diag" "international/mule-diag.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from international/mule-diag.el
 
 (autoload 'list-character-sets "mule-diag" "\
@@ -18655,7 +18784,8 @@ The default is 20.  If LIMIT is negative, do not limit the listing.
 ;;;;;;  coding-system-translation-table-for-decode coding-system-pre-write-conversion
 ;;;;;;  coding-system-post-read-conversion lookup-nested-alist set-nested-alist
 ;;;;;;  truncate-string-to-width store-substring string-to-sequence)
-;;;;;;  "mule-util" "international/mule-util.el" (20352 65510))
+;;;;;;  "mule-util" "international/mule-util.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from international/mule-util.el
 
 (autoload 'string-to-sequence "mule-util" "\
@@ -18764,7 +18894,7 @@ CODING-SYSTEMS is a list of coding systems.  See `set-coding-system-priority'.
 This affects the implicit sorting of lists of coding systems returned by
 operations such as `find-coding-systems-region'.
 
-\(fn CODING-SYSTEMS &rest BODY)" nil (quote macro))
+\(fn CODING-SYSTEMS &rest BODY)" nil t)
 (put 'with-coding-priority 'lisp-indent-function 1)
 
 (autoload 'detect-coding-with-priority "mule-util" "\
@@ -18772,7 +18902,7 @@ Detect a coding system of the text between FROM and TO with PRIORITY-LIST.
 PRIORITY-LIST is an alist of coding categories vs the corresponding
 coding systems ordered by priority.
 
-\(fn FROM TO PRIORITY-LIST)" nil (quote macro))
+\(fn FROM TO PRIORITY-LIST)" nil t)
 
 (autoload 'detect-coding-with-language-environment "mule-util" "\
 Detect a coding system for the text between FROM and TO with LANG-ENV.
@@ -18795,8 +18925,8 @@ per-character basis, this may not be accurate.
 ;;;### (autoloads (network-connection network-connection-to-service
 ;;;;;;  whois-reverse-lookup whois finger ftp run-dig dns-lookup-host
 ;;;;;;  nslookup nslookup-host ping traceroute route arp netstat
-;;;;;;  iwconfig ifconfig) "net-utils" "net/net-utils.el" (20352
-;;;;;;  65510))
+;;;;;;  iwconfig ifconfig) "net-utils" "net/net-utils.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from net/net-utils.el
 
 (autoload 'ifconfig "net-utils" "\
@@ -18890,8 +19020,8 @@ Open a network connection to HOST on PORT.
 
 ;;;***
 \f
-;;;### (autoloads (netrc-credentials) "netrc" "net/netrc.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (netrc-credentials) "netrc" "net/netrc.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from net/netrc.el
 
 (autoload 'netrc-credentials "netrc" "\
@@ -18904,7 +19034,7 @@ listed in the PORTS list.
 ;;;***
 \f
 ;;;### (autoloads (open-network-stream) "network-stream" "net/network-stream.el"
-;;;;;;  (20366 22869))
+;;;;;;  (20369 14251 85829 0))
 ;;; Generated autoloads from net/network-stream.el
 
 (autoload 'open-network-stream "network-stream" "\
@@ -18992,256 +19122,10 @@ STARTTLS upgrades even if Emacs doesn't have built-in TLS functionality.
 
 (defalias 'open-protocol-stream 'open-network-stream)
 
-;;;***
-\f
-;;;### (autoloads (comment-indent-new-line comment-auto-fill-only-comments
-;;;;;;  comment-dwim comment-or-uncomment-region comment-box comment-region
-;;;;;;  uncomment-region comment-kill comment-set-column comment-indent
-;;;;;;  comment-indent-default comment-normalize-vars comment-multi-line
-;;;;;;  comment-padding comment-style comment-column) "newcomment"
-;;;;;;  "newcomment.el" (20400 62402))
-;;; Generated autoloads from newcomment.el
-
-(defalias 'indent-for-comment 'comment-indent)
-
-(defalias 'set-comment-column 'comment-set-column)
-
-(defalias 'kill-comment 'comment-kill)
-
-(defalias 'indent-new-comment-line 'comment-indent-new-line)
-
-(defvar comment-use-syntax 'undecided "\
-Non-nil if syntax-tables can be used instead of regexps.
-Can also be `undecided' which means that a somewhat expensive test will
-be used to try to determine whether syntax-tables should be trusted
-to understand comments or not in the given buffer.
-Major modes should set this variable.")
-
-(defvar comment-column 32 "\
-Column to indent right-margin comments to.
-Each mode may establish a different default value for this variable; you
-can set the value for a particular mode using that mode's hook.
-Comments might be indented to a different value in order not to go beyond
-`comment-fill-column' or in order to align them with surrounding comments.")
-
-(custom-autoload 'comment-column "newcomment" t)
-(put 'comment-column 'safe-local-variable 'integerp)
-
-(defvar comment-start nil "\
-*String to insert to start a new comment, or nil if no comment syntax.")
-(put 'comment-start 'safe-local-variable 'string-or-null-p)
-
-(defvar comment-start-skip nil "\
-*Regexp to match the start of a comment plus everything up to its body.
-If there are any \\(...\\) pairs, the comment delimiter text is held to begin
-at the place matched by the close of the first pair.")
-(put 'comment-start-skip 'safe-local-variable 'string-or-null-p)
-
-(defvar comment-end-skip nil "\
-Regexp to match the end of a comment plus everything back to its body.")
-(put 'comment-end-skip 'safe-local-variable 'string-or-null-p)
-
-(defvar comment-end (purecopy "") "\
-*String to insert to end a new comment.
-Should be an empty string if comments are terminated by end-of-line.")
-(put 'comment-end 'safe-local-variable 'string-or-null-p)
-
-(defvar comment-indent-function 'comment-indent-default "\
-Function to compute desired indentation for a comment.
-This function is called with no args with point at the beginning of
-the comment's starting delimiter and should return either the desired
-column indentation or nil.
-If nil is returned, indentation is delegated to `indent-according-to-mode'.")
-
-(defvar comment-insert-comment-function nil "\
-Function to insert a comment when a line doesn't contain one.
-The function has no args.
-
-Applicable at least in modes for languages like fixed-format Fortran where
-comments always start in column zero.")
-
-(defconst comment-styles '((plain nil nil nil nil "Start in column 0 (do not indent), as in Emacs-20") (indent-or-triple nil nil nil multi-char "Start in column 0, but only for single-char starters") (indent nil nil nil t "Full comment per line, ends not aligned") (aligned nil t nil t "Full comment per line, ends aligned") (box nil t t t "Full comment per line, ends aligned, + top and bottom") (extra-line t nil t t "One comment for all lines, end on a line by itself") (multi-line t nil nil t "One comment for all lines, end on last commented line") (box-multi t t t t "One comment for all lines, + top and bottom")) "\
-Comment region style definitions.
-Each style is defined with a form (STYLE . (MULTI ALIGN EXTRA INDENT DOC)).
-DOC should succinctly describe the style.
-STYLE should be a mnemonic symbol.
-MULTI specifies that comments are allowed to span multiple lines.
-  e.g. in C it comments regions as
-     /* blabla
-      * bli */
-  rather than
-     /* blabla */
-     /* bli */
-  if `comment-end' is empty, this has no effect.
-
-ALIGN specifies that the `comment-end' markers should be aligned.
-  e.g. in C it comments regions as
-     /* blabla */
-     /* bli    */
-  rather than
-     /* blabla */
-     /* bli */
-  if `comment-end' is empty, this has no effect, unless EXTRA is also set,
-  in which case the comment gets wrapped in a box.
-
-EXTRA specifies that an extra line should be used before and after the
-  region to comment (to put the `comment-end' and `comment-start').
-  e.g. in C it comments regions as
-     /*
-      * blabla
-      * bli
-      */
-  rather than
-     /* blabla
-      * bli */
-  if the comment style is not multi line, this has no effect, unless ALIGN
-  is also set, in which case the comment gets wrapped in a box.
-
-INDENT specifies that the `comment-start' markers should not be put at the
-  left margin but at the current indentation of the region to comment.
-If INDENT is `multi-char', that means indent multi-character
-  comment starters, but not one-character comment starters.")
-
-(defvar comment-style 'indent "\
-Style to be used for `comment-region'.
-See `comment-styles' for a list of available styles.")
-
-(custom-autoload 'comment-style "newcomment" t)
-
-(defvar comment-padding (purecopy " ") "\
-Padding string that `comment-region' puts between comment chars and text.
-Can also be an integer which will be automatically turned into a string
-of the corresponding number of spaces.
-
-Extra spacing between the comment characters and the comment text
-makes the comment easier to read.  Default is 1.  nil means 0.")
-
-(custom-autoload 'comment-padding "newcomment" t)
-
-(defvar comment-multi-line nil "\
-Non-nil means `comment-indent-new-line' continues comments.
-That is, it inserts no new terminator or starter.
-This affects `auto-fill-mode', which is the main reason to
-customize this variable.
-
-It also affects \\[indent-new-comment-line].  However, if you want this
-behavior for explicit filling, you might as well use \\[newline-and-indent].")
-
-(custom-autoload 'comment-multi-line "newcomment" t)
-
-(autoload 'comment-normalize-vars "newcomment" "\
-Check and setup the variables needed by other commenting functions.
-Functions autoloaded from newcomment.el, being entry points, should call
-this function before any other, so the rest of the code can assume that
-the variables are properly set.
-
-\(fn &optional NOERROR)" nil nil)
-
-(autoload 'comment-indent-default "newcomment" "\
-Default for `comment-indent-function'.
-
-\(fn)" nil nil)
-
-(autoload 'comment-indent "newcomment" "\
-Indent this line's comment to `comment-column', or insert an empty comment.
-If CONTINUE is non-nil, use the `comment-continue' markers if any.
-
-\(fn &optional CONTINUE)" t nil)
-
-(autoload 'comment-set-column "newcomment" "\
-Set the comment column based on point.
-With no ARG, set the comment column to the current column.
-With just minus as arg, kill any comment on this line.
-With any other arg, set comment column to indentation of the previous comment
- and then align or create a comment on this line at that column.
-
-\(fn ARG)" t nil)
-
-(autoload 'comment-kill "newcomment" "\
-Kill the first comment on this line, if any.
-With prefix ARG, kill comments on that many lines starting with this one.
-
-\(fn ARG)" t nil)
-
-(autoload 'uncomment-region "newcomment" "\
-Uncomment each line in the BEG .. END region.
-The numeric prefix ARG can specify a number of chars to remove from the
-comment markers.
-
-\(fn BEG END &optional ARG)" t nil)
-
-(autoload 'comment-region "newcomment" "\
-Comment or uncomment each line in the region.
-With just \\[universal-argument] prefix arg, uncomment each line in region BEG .. END.
-Numeric prefix ARG means use ARG comment characters.
-If ARG is negative, delete that many comment characters instead.
-
-The strings used as comment starts are built from `comment-start'
-and `comment-padding'; the strings used as comment ends are built
-from `comment-end' and `comment-padding'.
-
-By default, the `comment-start' markers are inserted at the
-current indentation of the region, and comments are terminated on
-each line (even for syntaxes in which newline does not end the
-comment and blank lines do not get comments).  This can be
-changed with `comment-style'.
-
-\(fn BEG END &optional ARG)" t nil)
-
-(autoload 'comment-box "newcomment" "\
-Comment out the BEG .. END region, putting it inside a box.
-The numeric prefix ARG specifies how many characters to add to begin- and
-end- comment markers additionally to what `comment-add' already specifies.
-
-\(fn BEG END &optional ARG)" t nil)
-
-(autoload 'comment-or-uncomment-region "newcomment" "\
-Call `comment-region', unless the region only consists of comments,
-in which case call `uncomment-region'.  If a prefix arg is given, it
-is passed on to the respective function.
-
-\(fn BEG END &optional ARG)" t nil)
-
-(autoload 'comment-dwim "newcomment" "\
-Call the comment command you want (Do What I Mean).
-If the region is active and `transient-mark-mode' is on, call
-`comment-region' (unless it only consists of comments, in which
-case it calls `uncomment-region').
-Else, if the current line is empty, call `comment-insert-comment-function'
-if it is defined, otherwise insert a comment and indent it.
-Else if a prefix ARG is specified, call `comment-kill'.
-Else, call `comment-indent'.
-You can configure `comment-style' to change the way regions are commented.
-
-\(fn ARG)" t nil)
-
-(defvar comment-auto-fill-only-comments nil "\
-Non-nil means to only auto-fill inside comments.
-This has no effect in modes that do not define a comment syntax.")
-
-(custom-autoload 'comment-auto-fill-only-comments "newcomment" t)
-
-(autoload 'comment-indent-new-line "newcomment" "\
-Break line at point and indent, continuing comment if within one.
-This indents the body of the continued comment
-under the previous comment line.
-
-This command is intended for styles where you write a comment per line,
-starting a new comment (and terminating it if necessary) on each line.
-If you want to continue one comment across several lines, use \\[newline-and-indent].
-
-If a fill column is specified, it overrides the use of the comment column
-or comment indentation.
-
-The inserted newline is marked hard if variable `use-hard-newlines' is true,
-unless optional argument SOFT is non-nil.
-
-\(fn &optional SOFT)" t nil)
-
 ;;;***
 \f
 ;;;### (autoloads (newsticker-start newsticker-running-p) "newst-backend"
-;;;;;;  "net/newst-backend.el" (20352 65510))
+;;;;;;  "net/newst-backend.el" (20355 10021 546955 0))
 ;;; Generated autoloads from net/newst-backend.el
 
 (autoload 'newsticker-running-p "newst-backend" "\
@@ -19263,7 +19147,7 @@ Run `newsticker-start-hook' if newsticker was not running already.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-plainview) "newst-plainview" "net/newst-plainview.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20434 17809 692608 0))
 ;;; Generated autoloads from net/newst-plainview.el
 
 (autoload 'newsticker-plainview "newst-plainview" "\
@@ -19274,7 +19158,7 @@ Start newsticker plainview.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-show-news) "newst-reader" "net/newst-reader.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20434 17809 692608 0))
 ;;; Generated autoloads from net/newst-reader.el
 
 (autoload 'newsticker-show-news "newst-reader" "\
@@ -19285,7 +19169,8 @@ Start reading news.  You may want to bind this to a key.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-start-ticker newsticker-ticker-running-p)
-;;;;;;  "newst-ticker" "net/newst-ticker.el" (20352 65510))
+;;;;;;  "newst-ticker" "net/newst-ticker.el" (20427 14766 970343
+;;;;;;  0))
 ;;; Generated autoloads from net/newst-ticker.el
 
 (autoload 'newsticker-ticker-running-p "newst-ticker" "\
@@ -19306,7 +19191,7 @@ running already.
 ;;;***
 \f
 ;;;### (autoloads (newsticker-treeview) "newst-treeview" "net/newst-treeview.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20434 17809 692608 0))
 ;;; Generated autoloads from net/newst-treeview.el
 
 (autoload 'newsticker-treeview "newst-treeview" "\
@@ -19317,7 +19202,7 @@ Start newsticker treeview.
 ;;;***
 \f
 ;;;### (autoloads (nndiary-generate-nov-databases) "nndiary" "gnus/nndiary.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/nndiary.el
 
 (autoload 'nndiary-generate-nov-databases "nndiary" "\
@@ -19327,8 +19212,8 @@ Generate NOV databases in all nndiary directories.
 
 ;;;***
 \f
-;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (nndoc-add-type) "nndoc" "gnus/nndoc.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from gnus/nndoc.el
 
 (autoload 'nndoc-add-type "nndoc" "\
@@ -19343,7 +19228,7 @@ symbol in the alist.
 ;;;***
 \f
 ;;;### (autoloads (nnfolder-generate-active-file) "nnfolder" "gnus/nnfolder.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/nnfolder.el
 
 (autoload 'nnfolder-generate-active-file "nnfolder" "\
@@ -19355,7 +19240,7 @@ This command does not work if you use short group names.
 ;;;***
 \f
 ;;;### (autoloads (nnml-generate-nov-databases) "nnml" "gnus/nnml.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from gnus/nnml.el
 
 (autoload 'nnml-generate-nov-databases "nnml" "\
@@ -19366,15 +19251,15 @@ Generate NOV databases in all nnml directories.
 ;;;***
 \f
 ;;;### (autoloads (disable-command enable-command disabled-command-function)
-;;;;;;  "novice" "novice.el" (20400 62402))
+;;;;;;  "novice" "novice.el" (20399 35365 4050 0))
 ;;; Generated autoloads from novice.el
 
+(define-obsolete-variable-alias 'disabled-command-hook 'disabled-command-function "22.1")
+
 (defvar disabled-command-function 'disabled-command-function "\
 Function to call to handle disabled commands.
 If nil, the feature is disabled, i.e., all commands work normally.")
 
-(define-obsolete-variable-alias 'disabled-command-hook 'disabled-command-function "22.1")
-
 (autoload 'disabled-command-function "novice" "\
 
 
@@ -19399,7 +19284,7 @@ to future sessions.
 ;;;***
 \f
 ;;;### (autoloads (nroff-mode) "nroff-mode" "textmodes/nroff-mode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/nroff-mode.el
 
 (autoload 'nroff-mode "nroff-mode" "\
@@ -19414,7 +19299,7 @@ closing requests for requests that are used in matched pairs.
 ;;;***
 \f
 ;;;### (autoloads (nxml-glyph-display-string) "nxml-glyph" "nxml/nxml-glyph.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20439 5925 915283 0))
 ;;; Generated autoloads from nxml/nxml-glyph.el
 
 (autoload 'nxml-glyph-display-string "nxml-glyph" "\
@@ -19426,8 +19311,8 @@ Return nil if the face cannot display a glyph for N.
 
 ;;;***
 \f
-;;;### (autoloads (nxml-mode) "nxml-mode" "nxml/nxml-mode.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (nxml-mode) "nxml-mode" "nxml/nxml-mode.el" (20439
+;;;;;;  5925 915283 0))
 ;;; Generated autoloads from nxml/nxml-mode.el
 
 (autoload 'nxml-mode "nxml-mode" "\
@@ -19489,7 +19374,7 @@ Many aspects this mode can be customized using
 ;;;***
 \f
 ;;;### (autoloads (nxml-enable-unicode-char-name-sets) "nxml-uchnm"
-;;;;;;  "nxml/nxml-uchnm.el" (20352 65510))
+;;;;;;  "nxml/nxml-uchnm.el" (20355 10021 546955 0))
 ;;; Generated autoloads from nxml/nxml-uchnm.el
 
 (autoload 'nxml-enable-unicode-char-name-sets "nxml-uchnm" "\
@@ -19513,7 +19398,7 @@ the variable `nxml-enabled-unicode-blocks'.
 ;;;;;;  org-babel-pop-to-session-maybe org-babel-load-in-session-maybe
 ;;;;;;  org-babel-expand-src-block-maybe org-babel-view-src-block-info
 ;;;;;;  org-babel-execute-maybe org-babel-execute-safely-maybe) "ob"
-;;;;;;  "org/ob.el" (20420 42151))
+;;;;;;  "org/ob.el" (20417 65331 139825 0))
 ;;; Generated autoloads from org/ob.el
 
 (autoload 'org-babel-execute-safely-maybe "ob" "\
@@ -19648,7 +19533,7 @@ body ------------- string holding the body of the code block
 beg-body --------- point at the beginning of the body
 end-body --------- point at the end of the body
 
-\(fn FILE &rest BODY)" nil (quote macro))
+\(fn FILE &rest BODY)" nil t)
 
 (put 'org-babel-map-src-blocks 'lisp-indent-function '1)
 
@@ -19657,7 +19542,7 @@ Evaluate BODY forms on each inline source-block in FILE.
 If FILE is nil evaluate BODY forms on source blocks in current
 buffer.
 
-\(fn FILE &rest BODY)" nil (quote macro))
+\(fn FILE &rest BODY)" nil t)
 
 (put 'org-babel-map-inline-src-blocks 'lisp-indent-function '1)
 
@@ -19666,14 +19551,14 @@ Evaluate BODY forms on each call line in FILE.
 If FILE is nil evaluate BODY forms on source blocks in current
 buffer.
 
-\(fn FILE &rest BODY)" nil (quote macro))
+\(fn FILE &rest BODY)" nil t)
 
 (put 'org-babel-map-call-lines 'lisp-indent-function '1)
 
 (autoload 'org-babel-map-executables "ob" "\
 
 
-\(fn FILE &rest BODY)" nil (quote macro))
+\(fn FILE &rest BODY)" nil t)
 
 (put 'org-babel-map-executables 'lisp-indent-function '1)
 
@@ -19736,7 +19621,7 @@ Mark current src block
 ;;;***
 \f
 ;;;### (autoloads (org-babel-describe-bindings) "ob-keys" "org/ob-keys.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/ob-keys.el
 
 (autoload 'org-babel-describe-bindings "ob-keys" "\
@@ -19747,7 +19632,8 @@ Describe all keybindings behind `org-babel-key-prefix'.
 ;;;***
 \f
 ;;;### (autoloads (org-babel-lob-get-info org-babel-lob-execute-maybe
-;;;;;;  org-babel-lob-ingest) "ob-lob" "org/ob-lob.el" (20352 65510))
+;;;;;;  org-babel-lob-ingest) "ob-lob" "org/ob-lob.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from org/ob-lob.el
 
 (autoload 'org-babel-lob-ingest "ob-lob" "\
@@ -19772,7 +19658,7 @@ Return a Library of Babel function call as a string.
 \f
 ;;;### (autoloads (org-babel-tangle org-babel-tangle-file org-babel-load-file
 ;;;;;;  org-babel-tangle-lang-exts) "ob-tangle" "org/ob-tangle.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/ob-tangle.el
 
 (defvar org-babel-tangle-lang-exts '(("emacs-lisp" . "el")) "\
@@ -19814,7 +19700,7 @@ exported source code blocks by language.
 ;;;***
 \f
 ;;;### (autoloads (inferior-octave) "octave-inf" "progmodes/octave-inf.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/octave-inf.el
 
 (autoload 'inferior-octave "octave-inf" "\
@@ -19837,7 +19723,7 @@ startup file, `~/.emacs-octave'.
 ;;;***
 \f
 ;;;### (autoloads (octave-mode) "octave-mod" "progmodes/octave-mod.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20388 65061 302484 0))
 ;;; Generated autoloads from progmodes/octave-mod.el
 
 (autoload 'octave-mode "octave-mod" "\
@@ -19925,7 +19811,7 @@ including a reproducible test case and send the message.
 ;;;;;;  org-insert-link-global org-store-link org-run-like-in-org-mode
 ;;;;;;  turn-on-orgstruct++ turn-on-orgstruct orgstruct-mode org-global-cycle
 ;;;;;;  org-mode org-version org-babel-do-load-languages) "org" "org/org.el"
-;;;;;;  (20420 42151))
+;;;;;;  (20420 41510 996439 0))
 ;;; Generated autoloads from org/org.el
 
 (autoload 'org-babel-do-load-languages "org" "\
@@ -20158,7 +20044,8 @@ Call the customize function with org as argument.
 ;;;;;;  org-diary org-agenda-list-stuck-projects org-tags-view org-todo-list
 ;;;;;;  org-search-view org-agenda-list org-batch-store-agenda-views
 ;;;;;;  org-store-agenda-views org-batch-agenda-csv org-batch-agenda
-;;;;;;  org-agenda) "org-agenda" "org/org-agenda.el" (20404 23547))
+;;;;;;  org-agenda) "org-agenda" "org/org-agenda.el" (20420 41510
+;;;;;;  996439 0))
 ;;; Generated autoloads from org/org-agenda.el
 
 (autoload 'org-agenda "org-agenda" "\
@@ -20205,7 +20092,7 @@ longer string it is used as a tags/todo match string.
 Parameters are alternating variable names and values that will be bound
 before running the agenda command.
 
-\(fn CMD-KEY &rest PARAMETERS)" nil (quote macro))
+\(fn CMD-KEY &rest PARAMETERS)" nil t)
 
 (autoload 'org-batch-agenda-csv "org-agenda" "\
 Run an agenda command in batch mode and send the result to STDOUT.
@@ -20242,7 +20129,7 @@ priority-l   The priority letter if any was given
 priority-n   The computed numerical priority
 agenda-day   The day in the agenda where this is listed
 
-\(fn CMD-KEY &rest PARAMETERS)" nil (quote macro))
+\(fn CMD-KEY &rest PARAMETERS)" nil t)
 
 (autoload 'org-store-agenda-views "org-agenda" "\
 
@@ -20252,7 +20139,7 @@ agenda-day   The day in the agenda where this is listed
 (autoload 'org-batch-store-agenda-views "org-agenda" "\
 Run all custom agenda commands that have a file argument.
 
-\(fn &rest PARAMETERS)" nil (quote macro))
+\(fn &rest PARAMETERS)" nil t)
 
 (autoload 'org-agenda-list "org-agenda" "\
 Produce a daily/weekly view from all files in variable `org-agenda-files'.
@@ -20412,7 +20299,7 @@ details and examples.
 \f
 ;;;### (autoloads (org-archive-subtree-default-with-confirmation
 ;;;;;;  org-archive-subtree-default) "org-archive" "org/org-archive.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-archive.el
 
 (autoload 'org-archive-subtree-default "org-archive" "\
@@ -20432,8 +20319,8 @@ This command is set with the variable `org-archive-default-command'.
 ;;;### (autoloads (org-export-as-ascii org-export-region-as-ascii
 ;;;;;;  org-replace-region-by-ascii org-export-as-ascii-to-buffer
 ;;;;;;  org-export-as-utf8-to-buffer org-export-as-utf8 org-export-as-latin1-to-buffer
-;;;;;;  org-export-as-latin1) "org-ascii" "org/org-ascii.el" (20352
-;;;;;;  65510))
+;;;;;;  org-export-as-latin1) "org-ascii" "org/org-ascii.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from org/org-ascii.el
 
 (autoload 'org-export-as-latin1 "org-ascii" "\
@@ -20506,8 +20393,8 @@ publishing directory.
 
 ;;;***
 \f
-;;;### (autoloads (org-attach) "org-attach" "org/org-attach.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (org-attach) "org-attach" "org/org-attach.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from org/org-attach.el
 
 (autoload 'org-attach "org-attach" "\
@@ -20519,7 +20406,7 @@ Shows a list of commands and prompts for another key to execute a command.
 ;;;***
 \f
 ;;;### (autoloads (org-bbdb-anniversaries) "org-bbdb" "org/org-bbdb.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-bbdb.el
 
 (autoload 'org-bbdb-anniversaries "org-bbdb" "\
@@ -20530,7 +20417,8 @@ Extract anniversaries from BBDB for display in the agenda.
 ;;;***
 \f
 ;;;### (autoloads (org-capture-import-remember-templates org-capture-insert-template-here
-;;;;;;  org-capture) "org-capture" "org/org-capture.el" (20352 65510))
+;;;;;;  org-capture) "org-capture" "org/org-capture.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from org/org-capture.el
 
 (autoload 'org-capture "org-capture" "\
@@ -20568,7 +20456,7 @@ Set org-capture-templates to be similar to `org-remember-templates'.
 ;;;***
 \f
 ;;;### (autoloads (org-clock-persistence-insinuate org-get-clocktable)
-;;;;;;  "org-clock" "org/org-clock.el" (20377 65403))
+;;;;;;  "org-clock" "org/org-clock.el" (20427 14766 970343 0))
 ;;; Generated autoloads from org/org-clock.el
 
 (autoload 'org-get-clocktable "org-clock" "\
@@ -20586,7 +20474,7 @@ Set up hooks for clock persistence.
 ;;;***
 \f
 ;;;### (autoloads (org-datetree-find-date-create) "org-datetree"
-;;;;;;  "org/org-datetree.el" (20352 65510))
+;;;;;;  "org/org-datetree.el" (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-datetree.el
 
 (autoload 'org-datetree-find-date-create "org-datetree" "\
@@ -20602,7 +20490,7 @@ tree can be found.
 ;;;### (autoloads (org-export-as-docbook org-export-as-docbook-pdf-and-open
 ;;;;;;  org-export-as-docbook-pdf org-export-region-as-docbook org-replace-region-by-docbook
 ;;;;;;  org-export-as-docbook-to-buffer org-export-as-docbook-batch)
-;;;;;;  "org-docbook" "org/org-docbook.el" (20352 65510))
+;;;;;;  "org-docbook" "org/org-docbook.el" (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-docbook.el
 
 (autoload 'org-export-as-docbook-batch "org-docbook" "\
@@ -20679,7 +20567,7 @@ publishing directory.
 \f
 ;;;### (autoloads (org-insert-export-options-template org-export-as-org
 ;;;;;;  org-export-visible org-export) "org-exp" "org/org-exp.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-exp.el
 
 (autoload 'org-export "org-exp" "\
@@ -20740,8 +20628,8 @@ Insert into the buffer a template with information for exporting.
 ;;;***
 \f
 ;;;### (autoloads (org-feed-show-raw-feed org-feed-goto-inbox org-feed-update
-;;;;;;  org-feed-update-all) "org-feed" "org/org-feed.el" (20352
-;;;;;;  65510))
+;;;;;;  org-feed-update-all) "org-feed" "org/org-feed.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from org/org-feed.el
 
 (autoload 'org-feed-update-all "org-feed" "\
@@ -20769,7 +20657,7 @@ Show the raw feed buffer of a feed.
 ;;;***
 \f
 ;;;### (autoloads (org-footnote-normalize org-footnote-action) "org-footnote"
-;;;;;;  "org/org-footnote.el" (20377 65403))
+;;;;;;  "org/org-footnote.el" (20378 29222 722320 0))
 ;;; Generated autoloads from org/org-footnote.el
 
 (autoload 'org-footnote-action "org-footnote" "\
@@ -20820,7 +20708,7 @@ Additional note on `org-footnote-insert-pos-for-preprocessor':
 ;;;### (autoloads (org-freemind-to-org-mode org-freemind-from-org-sparse-tree
 ;;;;;;  org-freemind-from-org-mode org-freemind-from-org-mode-node
 ;;;;;;  org-freemind-show org-export-as-freemind) "org-freemind"
-;;;;;;  "org/org-freemind.el" (20352 65510))
+;;;;;;  "org/org-freemind.el" (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-freemind.el
 
 (autoload 'org-export-as-freemind "org-freemind" "\
@@ -20881,7 +20769,7 @@ Convert FreeMind file MM-FILE to `org-mode' file ORG-FILE.
 ;;;### (autoloads (org-export-htmlize-generate-css org-export-as-html
 ;;;;;;  org-export-region-as-html org-replace-region-by-html org-export-as-html-to-buffer
 ;;;;;;  org-export-as-html-batch org-export-as-html-and-open) "org-html"
-;;;;;;  "org/org-html.el" (20352 65510))
+;;;;;;  "org/org-html.el" (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-html.el
 
 (put 'org-export-html-style-include-default 'safe-local-variable 'booleanp)
@@ -20975,7 +20863,7 @@ that uses these same face definitions.
 \f
 ;;;### (autoloads (org-export-icalendar-combine-agenda-files org-export-icalendar-all-agenda-files
 ;;;;;;  org-export-icalendar-this-file) "org-icalendar" "org/org-icalendar.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-icalendar.el
 
 (autoload 'org-export-icalendar-this-file "org-icalendar" "\
@@ -21003,7 +20891,7 @@ The file is stored under the name `org-combined-agenda-icalendar-file'.
 ;;;### (autoloads (org-id-store-link org-id-find-id-file org-id-find
 ;;;;;;  org-id-goto org-id-get-with-outline-drilling org-id-get-with-outline-path-completion
 ;;;;;;  org-id-get org-id-copy org-id-get-create) "org-id" "org/org-id.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-id.el
 
 (autoload 'org-id-get-create "org-id" "\
@@ -21072,7 +20960,7 @@ Store a link to the current entry, using its ID.
 ;;;***
 \f
 ;;;### (autoloads (org-indent-mode) "org-indent" "org/org-indent.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-indent.el
 
 (autoload 'org-indent-mode "org-indent" "\
@@ -21090,7 +20978,7 @@ during idle time.
 ;;;***
 \f
 ;;;### (autoloads (org-irc-store-link) "org-irc" "org/org-irc.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-irc.el
 
 (autoload 'org-irc-store-link "org-irc" "\
@@ -21103,7 +20991,7 @@ Dispatch to the appropriate function to store a link to an IRC session.
 ;;;### (autoloads (org-export-as-pdf-and-open org-export-as-pdf org-export-as-latex
 ;;;;;;  org-export-region-as-latex org-replace-region-by-latex org-export-as-latex-to-buffer
 ;;;;;;  org-export-as-latex-batch) "org-latex" "org/org-latex.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-latex.el
 
 (autoload 'org-export-as-latex-batch "org-latex" "\
@@ -21184,7 +21072,7 @@ Export as LaTeX, then process through to PDF, and open.
 \f
 ;;;### (autoloads (org-lparse-region org-replace-region-by org-lparse-to-buffer
 ;;;;;;  org-lparse-batch org-lparse-and-open) "org-lparse" "org/org-lparse.el"
-;;;;;;  (20420 42151))
+;;;;;;  (20417 65331 139825 0))
 ;;; Generated autoloads from org/org-lparse.el
 
 (autoload 'org-lparse-and-open "org-lparse" "\
@@ -21241,8 +21129,8 @@ in a window.  A non-interactive call will only return the buffer.
 ;;;***
 \f
 ;;;### (autoloads (org-mobile-create-sumo-agenda org-mobile-pull
-;;;;;;  org-mobile-push) "org-mobile" "org/org-mobile.el" (20352
-;;;;;;  65510))
+;;;;;;  org-mobile-push) "org-mobile" "org/org-mobile.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from org/org-mobile.el
 
 (autoload 'org-mobile-push "org-mobile" "\
@@ -21268,7 +21156,7 @@ Create a file that contains all custom agenda views.
 \f
 ;;;### (autoloads (org-export-as-odf-and-open org-export-as-odf org-export-odt-convert
 ;;;;;;  org-export-as-odt org-export-as-odt-batch org-export-as-odt-and-open)
-;;;;;;  "org-odt" "org/org-odt.el" (20420 42151))
+;;;;;;  "org-odt" "org/org-odt.el" (20417 65331 139825 0))
 ;;; Generated autoloads from org/org-odt.el
 
 (autoload 'org-export-as-odt-and-open "org-odt" "\
@@ -21338,7 +21226,7 @@ formula file.
 ;;;***
 \f
 ;;;### (autoloads (org-plot/gnuplot) "org-plot" "org/org-plot.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-plot.el
 
 (autoload 'org-plot/gnuplot "org-plot" "\
@@ -21352,7 +21240,7 @@ line directly before or after the table.
 \f
 ;;;### (autoloads (org-publish-current-project org-publish-current-file
 ;;;;;;  org-publish-all org-publish) "org-publish" "org/org-publish.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-publish.el
 
 (defalias 'org-publish-project 'org-publish)
@@ -21386,7 +21274,7 @@ the project.
 \f
 ;;;### (autoloads (org-remember-handler org-remember org-remember-apply-template
 ;;;;;;  org-remember-annotation org-remember-insinuate) "org-remember"
-;;;;;;  "org/org-remember.el" (20352 65510))
+;;;;;;  "org/org-remember.el" (20420 41510 996439 0))
 ;;; Generated autoloads from org/org-remember.el
 
 (autoload 'org-remember-insinuate "org-remember" "\
@@ -21462,7 +21350,7 @@ See also the variable `org-reverse-note-order'.
 ;;;***
 \f
 ;;;### (autoloads (org-table-to-lisp orgtbl-mode turn-on-orgtbl)
-;;;;;;  "org-table" "org/org-table.el" (20404 23547))
+;;;;;;  "org-table" "org/org-table.el" (20417 65331 139825 0))
 ;;; Generated autoloads from org/org-table.el
 
 (autoload 'turn-on-orgtbl "org-table" "\
@@ -21486,7 +21374,8 @@ The table is taken from the parameter TXT, or from the buffer at point.
 ;;;***
 \f
 ;;;### (autoloads (org-export-as-taskjuggler-and-open org-export-as-taskjuggler)
-;;;;;;  "org-taskjuggler" "org/org-taskjuggler.el" (20352 65510))
+;;;;;;  "org-taskjuggler" "org/org-taskjuggler.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from org/org-taskjuggler.el
 
 (autoload 'org-export-as-taskjuggler "org-taskjuggler" "\
@@ -21514,7 +21403,7 @@ with the TaskJuggler GUI.
 \f
 ;;;### (autoloads (org-timer-set-timer org-timer-item org-timer-change-times-in-region
 ;;;;;;  org-timer org-timer-start) "org-timer" "org/org-timer.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-timer.el
 
 (autoload 'org-timer-start "org-timer" "\
@@ -21575,7 +21464,7 @@ replace any running timer.
 ;;;***
 \f
 ;;;### (autoloads (org-export-as-xoxo) "org-xoxo" "org/org-xoxo.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from org/org-xoxo.el
 
 (autoload 'org-export-as-xoxo "org-xoxo" "\
@@ -21587,7 +21476,7 @@ The XOXO buffer is named *xoxo-<source buffer name>*
 ;;;***
 \f
 ;;;### (autoloads (outline-minor-mode outline-mode) "outline" "outline.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from outline.el
 (put 'outline-regexp 'safe-local-variable 'stringp)
 (put 'outline-heading-end-regexp 'safe-local-variable 'stringp)
@@ -21651,7 +21540,7 @@ See the command `outline-mode' for more information on this mode.
 ;;;### (autoloads (list-packages describe-package package-initialize
 ;;;;;;  package-refresh-contents package-install-file package-install-from-buffer
 ;;;;;;  package-install package-enable-at-startup) "package" "emacs-lisp/package.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20440 26788 208175 0))
 ;;; Generated autoloads from emacs-lisp/package.el
 
 (defvar package-enable-at-startup t "\
@@ -21721,7 +21610,8 @@ The list is displayed in a buffer named `*Packages*'.
 
 ;;;***
 \f
-;;;### (autoloads (show-paren-mode) "paren" "paren.el" (20400 62402))
+;;;### (autoloads (show-paren-mode) "paren" "paren.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from paren.el
 
 (defvar show-paren-mode nil "\
@@ -21748,7 +21638,7 @@ matching parenthesis is highlighted in `show-paren-style' after
 ;;;***
 \f
 ;;;### (autoloads (parse-time-string) "parse-time" "calendar/parse-time.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from calendar/parse-time.el
 (put 'parse-time-rules 'risky-local-variable t)
 
@@ -21761,8 +21651,8 @@ unknown are returned as nil.
 
 ;;;***
 \f
-;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (pascal-mode) "pascal" "progmodes/pascal.el" (20439
+;;;;;;  5925 915283 0))
 ;;; Generated autoloads from progmodes/pascal.el
 
 (autoload 'pascal-mode "pascal" "\
@@ -21815,7 +21705,8 @@ no args, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (password-in-cache-p password-cache-expiry password-cache)
-;;;;;;  "password-cache" "password-cache.el" (20352 65510))
+;;;;;;  "password-cache" "password-cache.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from password-cache.el
 
 (defvar password-cache t "\
@@ -21837,7 +21728,7 @@ Check if KEY is in the cache.
 ;;;***
 \f
 ;;;### (autoloads (pcase-let pcase-let* pcase) "pcase" "emacs-lisp/pcase.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20453 5437 764254 0))
 ;;; Generated autoloads from emacs-lisp/pcase.el
 
 (autoload 'pcase "pcase" "\
@@ -21872,7 +21763,7 @@ E.g. you can match pairs where the cdr is larger than the car with a pattern
 like `(,a . ,(pred (< a))) or, with more checks:
 `(,(and a (pred numberp)) . ,(and (pred numberp) (pred (< a))))
 
-\(fn EXP &rest CASES)" nil (quote macro))
+\(fn EXP &rest CASES)" nil t)
 
 (put 'pcase 'lisp-indent-function '1)
 
@@ -21881,7 +21772,7 @@ Like `let*' but where you can use `pcase' patterns for bindings.
 BODY should be an expression, and BINDINGS should be a list of bindings
 of the form (UPAT EXP).
 
-\(fn BINDINGS &rest BODY)" nil (quote macro))
+\(fn BINDINGS &rest BODY)" nil t)
 
 (put 'pcase-let* 'lisp-indent-function '1)
 
@@ -21890,14 +21781,14 @@ Like `let' but where you can use `pcase' patterns for bindings.
 BODY should be a list of expressions, and BINDINGS should be a list of bindings
 of the form (UPAT EXP).
 
-\(fn BINDINGS &rest BODY)" nil (quote macro))
+\(fn BINDINGS &rest BODY)" nil t)
 
 (put 'pcase-let 'lisp-indent-function '1)
 
 ;;;***
 \f
-;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (pcomplete/cvs) "pcmpl-cvs" "pcmpl-cvs.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from pcmpl-cvs.el
 
 (autoload 'pcomplete/cvs "pcmpl-cvs" "\
@@ -21908,7 +21799,7 @@ Completion rules for the `cvs' command.
 ;;;***
 \f
 ;;;### (autoloads (pcomplete/tar pcomplete/make pcomplete/bzip2 pcomplete/gzip)
-;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (20352 65510))
+;;;;;;  "pcmpl-gnu" "pcmpl-gnu.el" (20355 10021 546955 0))
 ;;; Generated autoloads from pcmpl-gnu.el
 
 (autoload 'pcomplete/gzip "pcmpl-gnu" "\
@@ -21936,7 +21827,7 @@ Completion for the GNU tar utility.
 ;;;***
 \f
 ;;;### (autoloads (pcomplete/mount pcomplete/umount pcomplete/kill)
-;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (20352 65510))
+;;;;;;  "pcmpl-linux" "pcmpl-linux.el" (20355 10021 546955 0))
 ;;; Generated autoloads from pcmpl-linux.el
 
 (autoload 'pcomplete/kill "pcmpl-linux" "\
@@ -21956,8 +21847,8 @@ Completion for GNU/Linux `mount'.
 
 ;;;***
 \f
-;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (20453
+;;;;;;  5408 87415 759000))
 ;;; Generated autoloads from pcmpl-rpm.el
 
 (autoload 'pcomplete/rpm "pcmpl-rpm" "\
@@ -21969,7 +21860,8 @@ Completion for the `rpm' command.
 \f
 ;;;### (autoloads (pcomplete/scp pcomplete/ssh pcomplete/chgrp pcomplete/chown
 ;;;;;;  pcomplete/which pcomplete/xargs pcomplete/rm pcomplete/rmdir
-;;;;;;  pcomplete/cd) "pcmpl-unix" "pcmpl-unix.el" (20400 62402))
+;;;;;;  pcomplete/cd) "pcmpl-unix" "pcmpl-unix.el" (20376 40834 914217
+;;;;;;  0))
 ;;; Generated autoloads from pcmpl-unix.el
 
 (autoload 'pcomplete/cd "pcmpl-unix" "\
@@ -22026,8 +21918,8 @@ Includes files as well as host names followed by a colon.
 \f
 ;;;### (autoloads (pcomplete-shell-setup pcomplete-comint-setup pcomplete-list
 ;;;;;;  pcomplete-help pcomplete-expand pcomplete-continue pcomplete-expand-and-complete
-;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (20400
-;;;;;;  62402))
+;;;;;;  pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (20376
+;;;;;;  40834 914217 0))
 ;;; Generated autoloads from pcomplete.el
 
 (autoload 'pcomplete "pcomplete" "\
@@ -22086,7 +21978,7 @@ Setup `shell-mode' to use pcomplete.
 \f
 ;;;### (autoloads (cvs-dired-use-hook cvs-dired-action cvs-status
 ;;;;;;  cvs-update cvs-examine cvs-quickdir cvs-checkout) "pcvs"
-;;;;;;  "vc/pcvs.el" (20400 62402))
+;;;;;;  "vc/pcvs.el" (20454 59685 195070 0))
 ;;; Generated autoloads from vc/pcvs.el
 
 (autoload 'cvs-checkout "pcvs" "\
@@ -22161,7 +22053,8 @@ The exact behavior is determined also by `cvs-dired-use-hook'." (when (stringp d
 
 ;;;***
 \f
-;;;### (autoloads nil "pcvs-defs" "vc/pcvs-defs.el" (20400 62402))
+;;;### (autoloads nil "pcvs-defs" "vc/pcvs-defs.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from vc/pcvs-defs.el
 
 (defvar cvs-global-menu (let ((m (make-sparse-keymap "PCL-CVS"))) (define-key m [status] `(menu-item ,(purecopy "Directory Status") cvs-status :help ,(purecopy "A more verbose status of a workarea"))) (define-key m [checkout] `(menu-item ,(purecopy "Checkout Module") cvs-checkout :help ,(purecopy "Check out a module from the repository"))) (define-key m [update] `(menu-item ,(purecopy "Update Directory") cvs-update :help ,(purecopy "Fetch updates from the repository"))) (define-key m [examine] `(menu-item ,(purecopy "Examine Directory") cvs-examine :help ,(purecopy "Examine the current state of a workarea"))) (fset 'cvs-global-menu m)) "\
@@ -22170,7 +22063,7 @@ Global menu used by PCL-CVS.")
 ;;;***
 \f
 ;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20365 17199 85293 0))
 ;;; Generated autoloads from progmodes/perl-mode.el
 (put 'perl-indent-level 'safe-local-variable 'integerp)
 (put 'perl-continued-statement-offset 'safe-local-variable 'integerp)
@@ -22232,7 +22125,7 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'.
 ;;;***
 \f
 ;;;### (autoloads (picture-mode) "picture" "textmodes/picture.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20373 11301 906925 0))
 ;;; Generated autoloads from textmodes/picture.el
 
 (autoload 'picture-mode "picture" "\
@@ -22312,8 +22205,8 @@ they are not by default assigned to keys.
 
 ;;;***
 \f
-;;;### (autoloads (plstore-open) "plstore" "gnus/plstore.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (plstore-mode plstore-open) "plstore" "gnus/plstore.el"
+;;;;;;  (20378 29222 722320 0))
 ;;; Generated autoloads from gnus/plstore.el
 
 (autoload 'plstore-open "plstore" "\
@@ -22321,10 +22214,15 @@ Create a plstore instance associated with FILE.
 
 \(fn FILE)" nil nil)
 
+(autoload 'plstore-mode "plstore" "\
+Major mode for editing PLSTORE files.
+
+\(fn)" t nil)
+
 ;;;***
 \f
 ;;;### (autoloads (po-find-file-coding-system) "po" "textmodes/po.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/po.el
 
 (autoload 'po-find-file-coding-system "po" "\
@@ -22335,7 +22233,8 @@ Called through `file-coding-system-alist', before the file is visited for real.
 
 ;;;***
 \f
-;;;### (autoloads (pong) "pong" "play/pong.el" (20352 65510))
+;;;### (autoloads (pong) "pong" "play/pong.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from play/pong.el
 
 (autoload 'pong "pong" "\
@@ -22351,7 +22250,8 @@ pong-mode keybindings:\\<pong-mode-map>
 
 ;;;***
 \f
-;;;### (autoloads (pop3-movemail) "pop3" "gnus/pop3.el" (20352 65510))
+;;;### (autoloads (pop3-movemail) "pop3" "gnus/pop3.el" (20458 56750
+;;;;;;  651721 0))
 ;;; Generated autoloads from gnus/pop3.el
 
 (autoload 'pop3-movemail "pop3" "\
@@ -22364,7 +22264,7 @@ Use streaming commands.
 \f
 ;;;### (autoloads (pp-macroexpand-last-sexp pp-eval-last-sexp pp-macroexpand-expression
 ;;;;;;  pp-eval-expression pp pp-buffer pp-to-string) "pp" "emacs-lisp/pp.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/pp.el
 
 (autoload 'pp-to-string "pp" "\
@@ -22432,7 +22332,7 @@ Ignores leading comment characters.
 ;;;;;;  pr-ps-buffer-print pr-ps-buffer-using-ghostscript pr-ps-buffer-preview
 ;;;;;;  pr-ps-directory-ps-print pr-ps-directory-print pr-ps-directory-using-ghostscript
 ;;;;;;  pr-ps-directory-preview pr-interface) "printing" "printing.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from printing.el
 
 (autoload 'pr-interface "printing" "\
@@ -23019,7 +22919,8 @@ are both set to t.
 
 ;;;***
 \f
-;;;### (autoloads (proced) "proced" "proced.el" (20352 65510))
+;;;### (autoloads (proced) "proced" "proced.el" (20453 5437 764254
+;;;;;;  0))
 ;;; Generated autoloads from proced.el
 
 (autoload 'proced "proced" "\
@@ -23035,7 +22936,7 @@ See `proced-mode' for a description of features available in Proced buffers.
 ;;;***
 \f
 ;;;### (autoloads (run-prolog mercury-mode prolog-mode) "prolog"
-;;;;;;  "progmodes/prolog.el" (20400 62402))
+;;;;;;  "progmodes/prolog.el" (20397 45851 446679 0))
 ;;; Generated autoloads from progmodes/prolog.el
 
 (autoload 'prolog-mode "prolog" "\
@@ -23070,8 +22971,8 @@ With prefix argument ARG, restart the Prolog process if running before.
 
 ;;;***
 \f
-;;;### (autoloads (bdf-directory-list) "ps-bdf" "ps-bdf.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (bdf-directory-list) "ps-bdf" "ps-bdf.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from ps-bdf.el
 
 (defvar bdf-directory-list (if (memq system-type '(ms-dos windows-nt)) (list (expand-file-name "fonts/bdf" installation-directory)) '("/usr/local/share/emacs/fonts/bdf")) "\
@@ -23082,8 +22983,8 @@ The default value is '(\"/usr/local/share/emacs/fonts/bdf\").")
 
 ;;;***
 \f
-;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (ps-mode) "ps-mode" "progmodes/ps-mode.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/ps-mode.el
 
 (autoload 'ps-mode "ps-mode" "\
@@ -23134,8 +23035,8 @@ Typing \\<ps-run-mode-map>\\[ps-run-goto-error] when the cursor is at the number
 ;;;;;;  ps-spool-region ps-spool-buffer-with-faces ps-spool-buffer
 ;;;;;;  ps-print-region-with-faces ps-print-region ps-print-buffer-with-faces
 ;;;;;;  ps-print-buffer ps-print-customize ps-print-color-p ps-paper-type
-;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (20352
-;;;;;;  65510))
+;;;;;;  ps-page-dimensions-database) "ps-print" "ps-print.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from ps-print.el
 
 (defvar ps-page-dimensions-database (purecopy (list (list 'a4 (/ (* 72 21.0) 2.54) (/ (* 72 29.7) 2.54) "A4") (list 'a3 (/ (* 72 29.7) 2.54) (/ (* 72 42.0) 2.54) "A3") (list 'letter (* 72 8.5) (* 72 11.0) "Letter") (list 'legal (* 72 8.5) (* 72 14.0) "Legal") (list 'letter-small (* 72 7.68) (* 72 10.16) "LetterSmall") (list 'tabloid (* 72 11.0) (* 72 17.0) "Tabloid") (list 'ledger (* 72 17.0) (* 72 11.0) "Ledger") (list 'statement (* 72 5.5) (* 72 8.5) "Statement") (list 'executive (* 72 7.5) (* 72 10.0) "Executive") (list 'a4small (* 72 7.47) (* 72 10.85) "A4Small") (list 'b4 (* 72 10.125) (* 72 14.33) "B4") (list 'b5 (* 72 7.16) (* 72 10.125) "B5") '(addresslarge 236.0 99.0 "AddressLarge") '(addresssmall 236.0 68.0 "AddressSmall") '(cuthanging13 90.0 222.0 "CutHanging13") '(cuthanging15 90.0 114.0 "CutHanging15") '(diskette 181.0 136.0 "Diskette") '(eurofilefolder 139.0 112.0 "EuropeanFilefolder") '(eurofoldernarrow 526.0 107.0 "EuroFolderNarrow") '(eurofolderwide 526.0 136.0 "EuroFolderWide") '(euronamebadge 189.0 108.0 "EuroNameBadge") '(euronamebadgelarge 223.0 136.0 "EuroNameBadgeLarge") '(filefolder 230.0 37.0 "FileFolder") '(jewelry 76.0 136.0 "Jewelry") '(mediabadge 180.0 136.0 "MediaBadge") '(multipurpose 126.0 68.0 "MultiPurpose") '(retaillabel 90.0 104.0 "RetailLabel") '(shipping 271.0 136.0 "Shipping") '(slide35mm 26.0 104.0 "Slide35mm") '(spine8mm 187.0 26.0 "Spine8mm") '(topcoated 425.19685 136.0 "TopCoatedPaper") '(topcoatedpaper 396.0 136.0 "TopcoatedPaper150") '(vhsface 205.0 127.0 "VHSFace") '(vhsspine 400.0 50.0 "VHSSpine") '(zipdisk 156.0 136.0 "ZipDisk"))) "\
@@ -23331,94 +23232,27 @@ If EXTENSION is any other symbol, it is ignored.
 
 ;;;***
 \f
-;;;### (autoloads (jython-mode python-mode python-after-info-look
-;;;;;;  run-python) "python" "progmodes/python.el" (20400 62402))
+;;;### (autoloads (python-mode) "python" "progmodes/python.el" (20453
+;;;;;;  38823 158957 0))
 ;;; Generated autoloads from progmodes/python.el
 
-(add-to-list 'interpreter-mode-alist (cons (purecopy "jython") 'jython-mode))
-
-(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode))
-
 (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode))
 
-(autoload 'run-python "python" "\
-Run an inferior Python process, input and output via buffer *Python*.
-CMD is the Python command to run.  NOSHOW non-nil means don't
-show the buffer automatically.
-
-Interactively, a prefix arg means to prompt for the initial
-Python command line (default is `python-command').
-
-A new process is started if one isn't running attached to
-`python-buffer', or if called from Lisp with non-nil arg NEW.
-Otherwise, if a process is already running in `python-buffer',
-switch to that buffer.
-
-This command runs the hook `inferior-python-mode-hook' after
-running `comint-mode-hook'.  Type \\[describe-mode] in the
-process buffer for a list of commands.
-
-By default, Emacs inhibits the loading of Python modules from the
-current working directory, for security reasons.  To disable this
-behavior, change `python-remove-cwd-from-path' to nil.
-
-\(fn &optional CMD NOSHOW NEW)" t nil)
-
-(autoload 'python-after-info-look "python" "\
-Set up info-look for Python.
-Used with `eval-after-load'.
-
-\(fn)" nil nil)
+(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode))
 
 (autoload 'python-mode "python" "\
 Major mode for editing Python files.
-Turns on Font Lock mode unconditionally since it is currently required
-for correct parsing of the source.
-See also `jython-mode', which is actually invoked if the buffer appears to
-contain Jython code.  See also `run-python' and associated Python mode
-commands for running Python under Emacs.
-
-The Emacs commands which work with `defun's, e.g. \\[beginning-of-defun], deal
-with nested `def' and `class' blocks.  They take the innermost one as
-current without distinguishing method and class definitions.  Used multiple
-times, they move over others at the same indentation level until they reach
-the end of definitions at that level, when they move up a level.
-\\<python-mode-map>
-Colon is electric: it outdents the line if appropriate, e.g. for
-an else statement.  \\[python-backspace] at the beginning of an indented statement
-deletes a level of indentation to close the current block; otherwise it
-deletes a character backward.  TAB indents the current line relative to
-the preceding code.  Successive TABs, with no intervening command, cycle
-through the possibilities for indentation on the basis of enclosing blocks.
-
-\\[fill-paragraph] fills comments and multi-line strings appropriately, but has no
-effect outside them.
-
-Supports Eldoc mode (only for functions, using a Python process),
-Info-Look and Imenu.  In Outline minor mode, `class' and `def'
-lines count as headers.  Symbol completion is available in the
-same way as in the Python shell using the `rlcompleter' module
-and this is added to the Hippie Expand functions locally if
-Hippie Expand mode is turned on.  Completion of symbols of the
-form x.y only works if the components are literal
-module/attribute names, not variables.  An abbrev table is set up
-with skeleton expansions for compound statement templates.
 
 \\{python-mode-map}
-
-\(fn)" t nil)
-
-(autoload 'jython-mode "python" "\
-Major mode for editing Jython files.
-Like `python-mode', but sets up parameters for Jython subprocesses.
-Runs `jython-mode-hook' after `python-mode-hook'.
+Entry to this mode calls the value of `python-mode-hook'
+if that value is non-nil.
 
 \(fn)" t nil)
 
 ;;;***
 \f
 ;;;### (autoloads (quoted-printable-decode-region) "qp" "gnus/qp.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/qp.el
 
 (autoload 'quoted-printable-decode-region "qp" "\
@@ -23441,7 +23275,7 @@ them into characters should be done separately.
 ;;;;;;  quail-defrule quail-install-decode-map quail-install-map
 ;;;;;;  quail-define-rules quail-show-keyboard-layout quail-set-keyboard-layout
 ;;;;;;  quail-define-package quail-use-package quail-title) "quail"
-;;;;;;  "international/quail.el" (20400 62402))
+;;;;;;  "international/quail.el" (20356 55829 180242 0))
 ;;; Generated autoloads from international/quail.el
 
 (autoload 'quail-title "quail" "\
@@ -23591,7 +23425,7 @@ the following annotation types are supported.
   no-decode-map --- the value non-nil means that decoding map is not
        generated for the following translations.
 
-\(fn &rest RULES)" nil (quote macro))
+\(fn &rest RULES)" nil t)
 
 (autoload 'quail-install-map "quail" "\
 Install the Quail map MAP in the current Quail package.
@@ -23672,8 +23506,8 @@ of each directory.
 \f
 ;;;### (autoloads (quickurl-list quickurl-list-mode quickurl-edit-urls
 ;;;;;;  quickurl-browse-url-ask quickurl-browse-url quickurl-add-url
-;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (20400
-;;;;;;  62402))
+;;;;;;  quickurl-ask quickurl) "quickurl" "net/quickurl.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from net/quickurl.el
 
 (defconst quickurl-reread-hook-postfix "\n;; Local Variables:\n;; eval: (progn (require 'quickurl) (add-hook 'local-write-file-hooks (lambda () (quickurl-read) nil)))\n;; End:\n" "\
@@ -23745,7 +23579,7 @@ Display `quickurl-list' as a formatted list using `quickurl-list-mode'.
 ;;;***
 \f
 ;;;### (autoloads (rcirc-track-minor-mode rcirc-connect rcirc) "rcirc"
-;;;;;;  "net/rcirc.el" (20400 62402))
+;;;;;;  "net/rcirc.el" (20434 17809 692608 0))
 ;;; Generated autoloads from net/rcirc.el
 
 (autoload 'rcirc "rcirc" "\
@@ -23783,8 +23617,8 @@ if ARG is omitted or nil.
 
 ;;;***
 \f
-;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (remote-compile) "rcompile" "net/rcompile.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from net/rcompile.el
 
 (autoload 'remote-compile "rcompile" "\
@@ -23796,7 +23630,7 @@ See \\[compile].
 ;;;***
 \f
 ;;;### (autoloads (re-builder) "re-builder" "emacs-lisp/re-builder.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from emacs-lisp/re-builder.el
 
 (defalias 'regexp-builder 're-builder)
@@ -23814,7 +23648,8 @@ matching parts of the target buffer will be highlighted.
 
 ;;;***
 \f
-;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (20400 62402))
+;;;### (autoloads (recentf-mode) "recentf" "recentf.el" (20356 2211
+;;;;;;  532900 0))
 ;;; Generated autoloads from recentf.el
 
 (defvar recentf-mode nil "\
@@ -23844,7 +23679,7 @@ were operated on recently.
 ;;;;;;  string-rectangle delete-whitespace-rectangle open-rectangle
 ;;;;;;  insert-rectangle yank-rectangle kill-rectangle extract-rectangle
 ;;;;;;  delete-extract-rectangle delete-rectangle) "rect" "rect.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from rect.el
  (define-key ctl-x-r-map "c" 'clear-rectangle)
  (define-key ctl-x-r-map "k" 'kill-rectangle)
@@ -23980,8 +23815,8 @@ with a prefix argument, prompt for START-AT and FORMAT.
 
 ;;;***
 \f
-;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (refill-mode) "refill" "textmodes/refill.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from textmodes/refill.el
 
 (autoload 'refill-mode "refill" "\
@@ -24002,7 +23837,8 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead.
 ;;;***
 \f
 ;;;### (autoloads (reftex-reset-scanning-information reftex-mode
-;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (20352 65510))
+;;;;;;  turn-on-reftex) "reftex" "textmodes/reftex.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from textmodes/reftex.el
 
 (autoload 'turn-on-reftex "reftex" "\
@@ -24058,7 +23894,7 @@ This enforces rescanning the buffer on next use.
 ;;;***
 \f
 ;;;### (autoloads (reftex-citation) "reftex-cite" "textmodes/reftex-cite.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/reftex-cite.el
 
 (autoload 'reftex-citation "reftex-cite" "\
@@ -24088,7 +23924,7 @@ While entering the regexp, completion on knows citation keys is possible.
 ;;;***
 \f
 ;;;### (autoloads (reftex-isearch-minor-mode) "reftex-global" "textmodes/reftex-global.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from textmodes/reftex-global.el
 
 (autoload 'reftex-isearch-minor-mode "reftex-global" "\
@@ -24105,7 +23941,7 @@ With no argument, this command toggles
 ;;;***
 \f
 ;;;### (autoloads (reftex-index-phrases-mode) "reftex-index" "textmodes/reftex-index.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20399 35365 4050 0))
 ;;; Generated autoloads from textmodes/reftex-index.el
 
 (autoload 'reftex-index-phrases-mode "reftex-index" "\
@@ -24138,7 +23974,7 @@ Here are all local bindings.
 ;;;***
 \f
 ;;;### (autoloads (reftex-all-document-files) "reftex-parse" "textmodes/reftex-parse.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/reftex-parse.el
 
 (autoload 'reftex-all-document-files "reftex-parse" "\
@@ -24150,8 +23986,8 @@ of master file.
 
 ;;;***
 \f
-;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (20400
-;;;;;;  62402))
+;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from textmodes/reftex-vars.el
 (put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
 (put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
@@ -24161,7 +23997,7 @@ of master file.
 ;;;***
 \f
 ;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20363 61861 222722 0))
 ;;; Generated autoloads from emacs-lisp/regexp-opt.el
 
 (autoload 'regexp-opt "regexp-opt" "\
@@ -24192,7 +24028,7 @@ This means the number of non-shy regexp grouping constructs
 \f
 ;;;### (autoloads (remember-diary-extract-entries remember-clipboard
 ;;;;;;  remember-other-frame remember) "remember" "textmodes/remember.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/remember.el
 
 (autoload 'remember "remember" "\
@@ -24223,7 +24059,8 @@ Extract diary entries from the region.
 
 ;;;***
 \f
-;;;### (autoloads (repeat) "repeat" "repeat.el" (20400 62402))
+;;;### (autoloads (repeat) "repeat" "repeat.el" (20388 65061 302484
+;;;;;;  0))
 ;;; Generated autoloads from repeat.el
 
 (autoload 'repeat "repeat" "\
@@ -24246,7 +24083,7 @@ recently executed command not bound to an input event\".
 ;;;***
 \f
 ;;;### (autoloads (reporter-submit-bug-report) "reporter" "mail/reporter.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mail/reporter.el
 
 (autoload 'reporter-submit-bug-report "reporter" "\
@@ -24278,7 +24115,7 @@ mail-sending package is used for editing and sending the message.
 ;;;***
 \f
 ;;;### (autoloads (reposition-window) "reposition" "reposition.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from reposition.el
 
 (autoload 'reposition-window "reposition" "\
@@ -24305,7 +24142,7 @@ first comment line visible (if point is in a comment).
 ;;;***
 \f
 ;;;### (autoloads (global-reveal-mode reveal-mode) "reveal" "reveal.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from reveal.el
 
 (autoload 'reveal-mode "reveal" "\
@@ -24341,7 +24178,7 @@ the mode if ARG is omitted or nil.
 ;;;***
 \f
 ;;;### (autoloads (make-ring ring-p) "ring" "emacs-lisp/ring.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/ring.el
 
 (autoload 'ring-p "ring" "\
@@ -24356,7 +24193,8 @@ Make a ring that can contain SIZE elements.
 
 ;;;***
 \f
-;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (20398 608))
+;;;### (autoloads (rlogin) "rlogin" "net/rlogin.el" (20402 11562
+;;;;;;  85788 0))
 ;;; Generated autoloads from net/rlogin.el
 
 (autoload 'rlogin "rlogin" "\
@@ -24404,10 +24242,25 @@ variable.
 ;;;;;;  rmail rmail-show-message-hook rmail-secondary-file-regexp
 ;;;;;;  rmail-secondary-file-directory rmail-primary-inbox-list rmail-highlighted-headers
 ;;;;;;  rmail-retry-ignored-headers rmail-displayed-headers rmail-ignored-headers
-;;;;;;  rmail-user-mail-address-regexp rmail-movemail-variant-p)
-;;;;;;  "rmail" "mail/rmail.el" (20436 17935))
+;;;;;;  rmail-user-mail-address-regexp rmail-movemail-variant-p rmail-spool-directory
+;;;;;;  rmail-file-name) "rmail" "mail/rmail.el" (20437 50597 545250
+;;;;;;  0))
 ;;; Generated autoloads from mail/rmail.el
 
+(defvar rmail-file-name (purecopy "~/RMAIL") "\
+Name of user's primary mail file.")
+
+(custom-autoload 'rmail-file-name "rmail" t)
+
+(put 'rmail-spool-directory 'standard-value '((cond ((file-exists-p "/var/mail") "/var/mail/") ((file-exists-p "/var/spool/mail") "/var/spool/mail/") ((memq system-type '(hpux usg-unix-v irix)) "/usr/mail/") (t "/usr/spool/mail/"))))
+
+(defvar rmail-spool-directory (purecopy (cond ((file-exists-p "/var/mail") "/var/mail/") ((file-exists-p "/var/spool/mail") "/var/spool/mail/") ((memq system-type '(hpux usg-unix-v irix)) "/usr/mail/") (t "/usr/spool/mail/"))) "\
+Name of directory used by system mailer for delivering new mail.
+Its name should end with a slash.")
+
+(custom-autoload 'rmail-spool-directory "rmail" t)
+(custom-initialize-delay 'rmail-spool-directory nil)
+
 (autoload 'rmail-movemail-variant-p "rmail" "\
 Return t if the current movemail variant is any of VARIANTS.
 Currently known variants are 'emacs and 'mailutils.
@@ -24589,7 +24442,8 @@ Set PASSWORD to be used for retrieving mail from a POP or IMAP server.
 ;;;***
 \f
 ;;;### (autoloads (rmail-output-body-to-file rmail-output-as-seen
-;;;;;;  rmail-output) "rmailout" "mail/rmailout.el" (20352 65510))
+;;;;;;  rmail-output) "rmailout" "mail/rmailout.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from mail/rmailout.el
 (put 'rmail-output-file-alist 'risky-local-variable t)
 
@@ -24654,7 +24508,7 @@ than appending to it.  Deletes the message after writing if
 ;;;***
 \f
 ;;;### (autoloads (rng-c-load-schema) "rng-cmpct" "nxml/rng-cmpct.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from nxml/rng-cmpct.el
 
 (autoload 'rng-c-load-schema "rng-cmpct" "\
@@ -24666,7 +24520,7 @@ Return a pattern.
 ;;;***
 \f
 ;;;### (autoloads (rng-nxml-mode-init) "rng-nxml" "nxml/rng-nxml.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from nxml/rng-nxml.el
 
 (autoload 'rng-nxml-mode-init "rng-nxml" "\
@@ -24679,7 +24533,7 @@ Validation will be enabled if `rng-nxml-auto-validate-flag' is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (rng-validate-mode) "rng-valid" "nxml/rng-valid.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from nxml/rng-valid.el
 
 (autoload 'rng-validate-mode "rng-valid" "\
@@ -24709,8 +24563,8 @@ to use for finding the schema.
 
 ;;;***
 \f
-;;;### (autoloads (rng-xsd-compile) "rng-xsd" "nxml/rng-xsd.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (rng-xsd-compile) "rng-xsd" "nxml/rng-xsd.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from nxml/rng-xsd.el
 
 (put 'http://www\.w3\.org/2001/XMLSchema-datatypes 'rng-dt-compile 'rng-xsd-compile)
@@ -24738,7 +24592,7 @@ must be equal.
 ;;;***
 \f
 ;;;### (autoloads (robin-use-package robin-modify-package robin-define-package)
-;;;;;;  "robin" "international/robin.el" (20352 65510))
+;;;;;;  "robin" "international/robin.el" (20427 14766 970343 0))
 ;;; Generated autoloads from international/robin.el
 
 (autoload 'robin-define-package "robin" "\
@@ -24752,7 +24606,7 @@ OUTPUT is either a character or a string.  RULES are not evaluated.
 If there already exists a robin package whose name is NAME, the new
 one replaces the old one.
 
-\(fn NAME DOCSTRING &rest RULES)" nil (quote macro))
+\(fn NAME DOCSTRING &rest RULES)" nil t)
 
 (autoload 'robin-modify-package "robin" "\
 Change a rule in an already defined robin package.
@@ -24771,7 +24625,8 @@ Start using robin package NAME, which is a string.
 ;;;***
 \f
 ;;;### (autoloads (toggle-rot13-mode rot13-other-window rot13-region
-;;;;;;  rot13-string rot13) "rot13" "rot13.el" (20352 65510))
+;;;;;;  rot13-string rot13) "rot13" "rot13.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from rot13.el
 
 (autoload 'rot13 "rot13" "\
@@ -24809,23 +24664,17 @@ Toggle the use of ROT13 encoding for the current window.
 ;;;***
 \f
 ;;;### (autoloads (rst-minor-mode rst-mode) "rst" "textmodes/rst.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20459 40320 865360 0))
 ;;; Generated autoloads from textmodes/rst.el
  (add-to-list 'auto-mode-alist (purecopy '("\\.re?st\\'" . rst-mode)))
 
 (autoload 'rst-mode "rst" "\
 Major mode for editing reStructuredText documents.
 \\<rst-mode-map>
-There are a number of convenient keybindings provided by
-Rst mode.  The main one is \\[rst-adjust], it updates or rotates
-the section title around point or promotes/demotes the
-decorations within the region (see full details below).
-Use negative prefix arg to rotate in the other direction.
 
 Turning on `rst-mode' calls the normal hooks `text-mode-hook'
 and `rst-mode-hook'.  This mode also supports font-lock
-highlighting.  You may customize `rst-mode-lazy' to toggle
-font-locking of blocks.
+highlighting.
 
 \\{rst-mode-map}
 
@@ -24846,7 +24695,7 @@ for modes derived from Text mode, like Mail mode.
 ;;;***
 \f
 ;;;### (autoloads (ruby-mode) "ruby-mode" "progmodes/ruby-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20375 53029 572236 0))
 ;;; Generated autoloads from progmodes/ruby-mode.el
 
 (autoload 'ruby-mode "ruby-mode" "\
@@ -24867,8 +24716,8 @@ The variable `ruby-indent-level' controls the amount of indentation.
 
 ;;;***
 \f
-;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (ruler-mode) "ruler-mode" "ruler-mode.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from ruler-mode.el
 
 (defvar ruler-mode nil "\
@@ -24885,8 +24734,8 @@ if ARG is omitted or nil.
 
 ;;;***
 \f
-;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/rx.el
 
 (autoload 'rx-to-string "rx" "\
@@ -25193,12 +25042,12 @@ enclosed in `(and ...)'.
 `(regexp REGEXP)'
      include REGEXP in string notation in the result.
 
-\(fn &rest REGEXPS)" nil (quote macro))
+\(fn &rest REGEXPS)" nil t)
 
 ;;;***
 \f
-;;;### (autoloads (savehist-mode) "savehist" "savehist.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (savehist-mode) "savehist" "savehist.el" (20453
+;;;;;;  5437 764254 0))
 ;;; Generated autoloads from savehist.el
 
 (defvar savehist-mode nil "\
@@ -25230,7 +25079,7 @@ histories, which is probably undesirable.
 ;;;***
 \f
 ;;;### (autoloads (dsssl-mode scheme-mode) "scheme" "progmodes/scheme.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from progmodes/scheme.el
 
 (autoload 'scheme-mode "scheme" "\
@@ -25240,7 +25089,7 @@ Editing commands are similar to those of `lisp-mode'.
 In addition, if an inferior Scheme process is running, some additional
 commands will be defined, for evaluating expressions and controlling
 the interpreter, and the state of the process will be displayed in the
-modeline of all Scheme buffers.  The names of commands that interact
+mode line of all Scheme buffers.  The names of commands that interact
 with the Scheme process start with \"xscheme-\" if you use the MIT
 Scheme-specific `xscheme' package; for more information see the
 documentation for `xscheme-interaction-mode'.  Use \\[run-scheme] to
@@ -25272,7 +25121,7 @@ that variable's value is a string.
 ;;;***
 \f
 ;;;### (autoloads (gnus-score-mode) "score-mode" "gnus/score-mode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/score-mode.el
 
 (autoload 'gnus-score-mode "score-mode" "\
@@ -25286,7 +25135,7 @@ This mode is an extended emacs-lisp mode.
 ;;;***
 \f
 ;;;### (autoloads (scroll-all-mode) "scroll-all" "scroll-all.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20363 61861 222722 0))
 ;;; Generated autoloads from scroll-all.el
 
 (defvar scroll-all-mode nil "\
@@ -25312,7 +25161,7 @@ one window apply to all visible windows in the same frame.
 ;;;***
 \f
 ;;;### (autoloads (scroll-lock-mode) "scroll-lock" "scroll-lock.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from scroll-lock.el
 
 (autoload 'scroll-lock-mode "scroll-lock" "\
@@ -25328,7 +25177,8 @@ vertically fixed relative to window boundaries during scrolling.
 
 ;;;***
 \f
-;;;### (autoloads nil "secrets" "net/secrets.el" (20352 65510))
+;;;### (autoloads nil "secrets" "net/secrets.el" (20464 9124 585807
+;;;;;;  0))
 ;;; Generated autoloads from net/secrets.el
 (when (featurep 'dbusbind)
  (autoload 'secrets-show-secrets "secrets" nil t))
@@ -25336,7 +25186,7 @@ vertically fixed relative to window boundaries during scrolling.
 ;;;***
 \f
 ;;;### (autoloads (semantic-mode semantic-default-submodes) "semantic"
-;;;;;;  "cedet/semantic.el" (20400 62402))
+;;;;;;  "cedet/semantic.el" (20355 10021 546955 0))
 ;;; Generated autoloads from cedet/semantic.el
 
 (defvar semantic-default-submodes '(global-semantic-idle-scheduler-mode global-semanticdb-minor-mode) "\
@@ -25390,7 +25240,7 @@ Semantic mode.
 ;;;;;;  mail-personal-alias-file mail-default-reply-to mail-archive-file-name
 ;;;;;;  mail-header-separator send-mail-function mail-interactive
 ;;;;;;  mail-self-blind mail-specify-envelope-from mail-from-style)
-;;;;;;  "sendmail" "mail/sendmail.el" (20420 42151))
+;;;;;;  "sendmail" "mail/sendmail.el" (20417 65331 139825 0))
 ;;; Generated autoloads from mail/sendmail.el
 
 (defvar mail-from-style 'default "\
@@ -25593,7 +25443,7 @@ header when sending a message to a mailing list.")
 (custom-autoload 'mail-mailing-lists "sendmail" t)
 
 (defvar sendmail-coding-system nil "\
-*Coding system for encoding the outgoing mail.
+Coding system for encoding the outgoing mail.
 This has higher priority than the default `buffer-file-coding-system'
 and `default-sendmail-coding-system',
 but lower priority than the local value of `buffer-file-coding-system'.
@@ -25672,8 +25522,8 @@ Like `mail' command, but display mail buffer in another frame.
 ;;;***
 \f
 ;;;### (autoloads (server-save-buffers-kill-terminal server-mode
-;;;;;;  server-force-delete server-start) "server" "server.el" (20400
-;;;;;;  62402))
+;;;;;;  server-force-delete server-start) "server" "server.el" (20457
+;;;;;;  35879 688143 0))
 ;;; Generated autoloads from server.el
 
 (put 'server-host 'risky-local-variable t)
@@ -25684,10 +25534,10 @@ Like `mail' command, but display mail buffer in another frame.
 
 (autoload 'server-start "server" "\
 Allow this Emacs process to be a server for client processes.
-This starts a server communications subprocess through which
-client \"editors\" can send your editing commands to this Emacs
-job.  To use the server, set up the program `emacsclient' in the
-Emacs distribution as your standard \"editor\".
+This starts a server communications subprocess through which client
+\"editors\" can send your editing commands to this Emacs job.
+To use the server, set up the program `emacsclient' in the Emacs
+distribution as your standard \"editor\".
 
 Optional argument LEAVE-DEAD (interactively, a prefix arg) means just
 kill any existing server communications subprocess.
@@ -25740,7 +25590,7 @@ only these files will be asked to be saved.
 
 ;;;***
 \f
-;;;### (autoloads (ses-mode) "ses" "ses.el" (20400 62402))
+;;;### (autoloads (ses-mode) "ses" "ses.el" (20459 40320 865360 0))
 ;;; Generated autoloads from ses.el
 
 (autoload 'ses-mode "ses" "\
@@ -25759,7 +25609,7 @@ These are active only in the minibuffer, when entering or editing a formula:
 ;;;***
 \f
 ;;;### (autoloads (html-mode sgml-mode) "sgml-mode" "textmodes/sgml-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from textmodes/sgml-mode.el
 
 (autoload 'sgml-mode "sgml-mode" "\
@@ -25825,7 +25675,7 @@ To work around that, do:
 ;;;***
 \f
 ;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20397 18394 841411 0))
 ;;; Generated autoloads from progmodes/sh-script.el
 (put 'sh-shell 'safe-local-variable 'symbolp)
 
@@ -25872,9 +25722,8 @@ buffer indents as it currently is indented.
 \\[sh-set-shell]        Set this buffer's shell, and maybe its magic number.
 \\[sh-execute-region]   Have optional header and region be executed in a subshell.
 
-\\[sh-maybe-here-document]      Without prefix, following an unquoted < inserts here document.
-{, (, [, ', \", `
-       Unless quoted with \\, insert the pairs {}, (), [], or '', \"\", ``.
+`sh-electric-here-document-mode' controls whether insertion of two
+unquoted < insert a here document.
 
 If you generally program a shell different from your login shell you can
 set `sh-shell-file' accordingly.  If your shell's file name doesn't correctly
@@ -25890,7 +25739,7 @@ with your script for an edit-interpret-debug cycle.
 ;;;***
 \f
 ;;;### (autoloads (list-load-path-shadows) "shadow" "emacs-lisp/shadow.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/shadow.el
 
 (autoload 'list-load-path-shadows "shadow" "\
@@ -25940,8 +25789,8 @@ function, `load-path-shadows-find'.
 ;;;***
 \f
 ;;;### (autoloads (shadow-initialize shadow-define-regexp-group shadow-define-literal-group
-;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (20352
-;;;;;;  65510))
+;;;;;;  shadow-define-cluster) "shadowfile" "shadowfile.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from shadowfile.el
 
 (autoload 'shadow-define-cluster "shadowfile" "\
@@ -25980,7 +25829,7 @@ Set up file shadowing.
 ;;;***
 \f
 ;;;### (autoloads (shell shell-dumb-shell-regexp) "shell" "shell.el"
-;;;;;;  (20396 34067))
+;;;;;;  (20402 36105 904047 0))
 ;;; Generated autoloads from shell.el
 
 (defvar shell-dumb-shell-regexp (purecopy "cmd\\(proxy\\)?\\.exe") "\
@@ -26028,8 +25877,8 @@ Otherwise, one argument `-i' is passed to the shell.
 
 ;;;***
 \f
-;;;### (autoloads (shr-insert-document) "shr" "gnus/shr.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (shr-insert-document) "shr" "gnus/shr.el" (20459
+;;;;;;  40320 865360 0))
 ;;; Generated autoloads from gnus/shr.el
 
 (autoload 'shr-insert-document "shr" "\
@@ -26042,7 +25891,7 @@ DOM should be a parse tree as generated by
 ;;;***
 \f
 ;;;### (autoloads (sieve-upload-and-bury sieve-upload sieve-manage)
-;;;;;;  "sieve" "gnus/sieve.el" (20352 65510))
+;;;;;;  "sieve" "gnus/sieve.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/sieve.el
 
 (autoload 'sieve-manage "sieve" "\
@@ -26063,7 +25912,7 @@ DOM should be a parse tree as generated by
 ;;;***
 \f
 ;;;### (autoloads (sieve-mode) "sieve-mode" "gnus/sieve-mode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/sieve-mode.el
 
 (autoload 'sieve-mode "sieve-mode" "\
@@ -26078,8 +25927,8 @@ Turning on Sieve mode runs `sieve-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (simula-mode) "simula" "progmodes/simula.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from progmodes/simula.el
 
 (autoload 'simula-mode "simula" "\
@@ -26128,7 +25977,8 @@ with no arguments, if that value is non-nil.
 ;;;***
 \f
 ;;;### (autoloads (skeleton-pair-insert-maybe skeleton-insert skeleton-proxy-new
-;;;;;;  define-skeleton) "skeleton" "skeleton.el" (20400 62402))
+;;;;;;  define-skeleton) "skeleton" "skeleton.el" (20406 8611 875037
+;;;;;;  0))
 ;;; Generated autoloads from skeleton.el
 
 (defvar skeleton-filter-function 'identity "\
@@ -26139,7 +25989,9 @@ Define a user-configurable COMMAND that enters a statement skeleton.
 DOCUMENTATION is that of the command.
 SKELETON is as defined under `skeleton-insert'.
 
-\(fn COMMAND DOCUMENTATION &rest SKELETON)" nil (quote macro))
+\(fn COMMAND DOCUMENTATION &rest SKELETON)" nil t)
+
+(put 'define-skeleton 'doc-string-elt '2)
 
 (autoload 'skeleton-proxy-new "skeleton" "\
 Insert SKELETON.
@@ -26238,7 +26090,7 @@ symmetrical ones, and the same character twice for the others.
 ;;;***
 \f
 ;;;### (autoloads (smerge-start-session smerge-mode smerge-ediff)
-;;;;;;  "smerge-mode" "vc/smerge-mode.el" (20400 62402))
+;;;;;;  "smerge-mode" "vc/smerge-mode.el" (20415 23587 118149 0))
 ;;; Generated autoloads from vc/smerge-mode.el
 
 (autoload 'smerge-ediff "smerge-mode" "\
@@ -26266,7 +26118,7 @@ If no conflict maker is found, turn off `smerge-mode'.
 ;;;***
 \f
 ;;;### (autoloads (smiley-buffer smiley-region) "smiley" "gnus/smiley.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/smiley.el
 
 (autoload 'smiley-region "smiley" "\
@@ -26284,7 +26136,7 @@ interactively.  If there's no argument, do it at the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (smtpmail-send-queued-mail smtpmail-send-it) "smtpmail"
-;;;;;;  "mail/smtpmail.el" (20396 34067))
+;;;;;;  "mail/smtpmail.el" (20402 11562 85788 0))
 ;;; Generated autoloads from mail/smtpmail.el
 
 (autoload 'smtpmail-send-it "smtpmail" "\
@@ -26299,7 +26151,8 @@ Send mail that was queued as a result of setting `smtpmail-queue-mail'.
 
 ;;;***
 \f
-;;;### (autoloads (snake) "snake" "play/snake.el" (20352 65510))
+;;;### (autoloads (snake) "snake" "play/snake.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from play/snake.el
 
 (autoload 'snake "snake" "\
@@ -26323,7 +26176,7 @@ Snake mode keybindings:
 ;;;***
 \f
 ;;;### (autoloads (snmpv2-mode snmp-mode) "snmp-mode" "net/snmp-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from net/snmp-mode.el
 
 (autoload 'snmp-mode "snmp-mode" "\
@@ -26352,8 +26205,8 @@ then `snmpv2-mode-hook'.
 
 ;;;***
 \f
-;;;### (autoloads (sunrise-sunset) "solar" "calendar/solar.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (sunrise-sunset) "solar" "calendar/solar.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from calendar/solar.el
 
 (autoload 'sunrise-sunset "solar" "\
@@ -26368,8 +26221,8 @@ This function is suitable for execution in a .emacs file.
 
 ;;;***
 \f
-;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (solitaire) "solitaire" "play/solitaire.el" (20427
+;;;;;;  14766 970343 0))
 ;;; Generated autoloads from play/solitaire.el
 
 (autoload 'solitaire "solitaire" "\
@@ -26446,7 +26299,8 @@ Pick your favorite shortcuts:
 \f
 ;;;### (autoloads (reverse-region sort-columns sort-regexp-fields
 ;;;;;;  sort-fields sort-numeric-fields sort-pages sort-paragraphs
-;;;;;;  sort-lines sort-subr) "sort" "sort.el" (20352 65510))
+;;;;;;  sort-lines sort-subr) "sort" "sort.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from sort.el
 (put 'sort-fold-case 'safe-local-variable 'booleanp)
 
@@ -26590,8 +26444,8 @@ From a program takes two point or marker arguments, BEG and END.
 
 ;;;***
 \f
-;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (spam-initialize) "spam" "gnus/spam.el" (20458
+;;;;;;  56750 651721 0))
 ;;; Generated autoloads from gnus/spam.el
 
 (autoload 'spam-initialize "spam" "\
@@ -26607,7 +26461,7 @@ installed through `spam-necessary-extra-headers'.
 \f
 ;;;### (autoloads (spam-report-deagentize spam-report-agentize spam-report-url-to-file
 ;;;;;;  spam-report-url-ping-mm-url spam-report-process-queue) "spam-report"
-;;;;;;  "gnus/spam-report.el" (20352 65510))
+;;;;;;  "gnus/spam-report.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/spam-report.el
 
 (autoload 'spam-report-process-queue "spam-report" "\
@@ -26650,7 +26504,7 @@ Spam reports will be queued with the method used when
 ;;;***
 \f
 ;;;### (autoloads (speedbar-get-focus speedbar-frame-mode) "speedbar"
-;;;;;;  "speedbar.el" (20400 62402))
+;;;;;;  "speedbar.el" (20434 17809 692608 0))
 ;;; Generated autoloads from speedbar.el
 
 (defalias 'speedbar 'speedbar-frame-mode)
@@ -26674,8 +26528,8 @@ selected.  If the speedbar frame is active, then select the attached frame.
 
 ;;;***
 \f
-;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (snarf-spooks spook) "spook" "play/spook.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from play/spook.el
 
 (autoload 'spook "spook" "\
@@ -26694,7 +26548,7 @@ Return a vector containing the lines from `spook-phrases-file'.
 ;;;;;;  sql-ms sql-ingres sql-solid sql-mysql sql-sqlite sql-informix
 ;;;;;;  sql-sybase sql-oracle sql-product-interactive sql-connect
 ;;;;;;  sql-mode sql-help sql-add-product-keywords) "sql" "progmodes/sql.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/sql.el
 
 (autoload 'sql-add-product-keywords "sql" "\
@@ -27190,7 +27044,7 @@ buffer.
 ;;;***
 \f
 ;;;### (autoloads (srecode-template-mode) "srecode/srt-mode" "cedet/srecode/srt-mode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from cedet/srecode/srt-mode.el
 
 (autoload 'srecode-template-mode "srecode/srt-mode" "\
@@ -27203,7 +27057,7 @@ Major-mode for writing SRecode macros.
 ;;;***
 \f
 ;;;### (autoloads (starttls-open-stream) "starttls" "gnus/starttls.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/starttls.el
 
 (autoload 'starttls-open-stream "starttls" "\
@@ -27230,8 +27084,8 @@ GnuTLS requires a port number.
 ;;;;;;  strokes-mode strokes-list-strokes strokes-load-user-strokes
 ;;;;;;  strokes-help strokes-describe-stroke strokes-do-complex-stroke
 ;;;;;;  strokes-do-stroke strokes-read-complex-stroke strokes-read-stroke
-;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (20352
-;;;;;;  65510))
+;;;;;;  strokes-global-set-stroke) "strokes" "strokes.el" (20427
+;;;;;;  14766 970343 0))
 ;;; Generated autoloads from strokes.el
 
 (autoload 'strokes-global-set-stroke "strokes" "\
@@ -27345,7 +27199,7 @@ Read a complex stroke and insert its glyph into the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (studlify-buffer studlify-word studlify-region)
-;;;;;;  "studly" "play/studly.el" (20352 65510))
+;;;;;;  "studly" "play/studly.el" (20355 10021 546955 0))
 ;;; Generated autoloads from play/studly.el
 
 (autoload 'studlify-region "studly" "\
@@ -27366,7 +27220,7 @@ Studlify-case the current buffer.
 ;;;***
 \f
 ;;;### (autoloads (global-subword-mode subword-mode) "subword" "progmodes/subword.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/subword.el
 
 (autoload 'subword-mode "subword" "\
@@ -27422,7 +27276,7 @@ See `subword-mode' for more information on Subword mode.
 ;;;***
 \f
 ;;;### (autoloads (sc-cite-original) "supercite" "mail/supercite.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mail/supercite.el
 
 (autoload 'sc-cite-original "supercite" "\
@@ -27454,8 +27308,8 @@ and `sc-post-hook' is run after the guts of this function.
 
 ;;;***
 \f
-;;;### (autoloads (gpm-mouse-mode) "t-mouse" "t-mouse.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (gpm-mouse-mode) "t-mouse" "t-mouse.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from t-mouse.el
 
 (define-obsolete-function-alias 't-mouse-mode 'gpm-mouse-mode "23.1")
@@ -27483,7 +27337,8 @@ It relies on the `gpm' daemon being activated.
 
 ;;;***
 \f
-;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (20352 65510))
+;;;### (autoloads (tabify untabify) "tabify" "tabify.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from tabify.el
 
 (autoload 'untabify "tabify" "\
@@ -27518,7 +27373,7 @@ The variable `tab-width' controls the spacing of tab stops.
 ;;;;;;  table-recognize table-insert-row-column table-insert-column
 ;;;;;;  table-insert-row table-insert table-point-left-cell-hook
 ;;;;;;  table-point-entered-cell-hook table-load-hook table-cell-map-hook)
-;;;;;;  "table" "textmodes/table.el" (20400 62402))
+;;;;;;  "table" "textmodes/table.el" (20434 17809 692608 0))
 ;;; Generated autoloads from textmodes/table.el
 
 (defvar table-cell-map-hook nil "\
@@ -28106,50 +27961,8 @@ converts a table into plain text without frames.  It is a companion to
 
 ;;;***
 \f
-;;;### (autoloads (tabulated-list-mode) "tabulated-list" "emacs-lisp/tabulated-list.el"
-;;;;;;  (20400 62402))
-;;; Generated autoloads from emacs-lisp/tabulated-list.el
-
-(autoload 'tabulated-list-mode "tabulated-list" "\
-Generic major mode for browsing a list of items.
-This mode is usually not used directly; instead, other major
-modes are derived from it, using `define-derived-mode'.
-
-In this major mode, the buffer is divided into multiple columns,
-which are labeled using the header line.  Each non-empty line
-belongs to one \"entry\", and the entries can be sorted according
-to their column values.
-
-An inheriting mode should usually do the following in their body:
-
- - Set `tabulated-list-format', specifying the column format.
- - Set `tabulated-list-revert-hook', if the buffer contents need
-   to be specially recomputed prior to `revert-buffer'.
- - Maybe set a `tabulated-list-entries' function (see below).
- - Maybe set `tabulated-list-printer' (see below).
- - Maybe set `tabulated-list-padding'.
- - Call `tabulated-list-init-header' to initialize `header-line-format'
-   according to `tabulated-list-format'.
-
-An inheriting mode is usually accompanied by a \"list-FOO\"
-command (e.g. `list-packages', `list-processes').  This command
-creates or switches to a buffer and enables the major mode in
-that buffer.  If `tabulated-list-entries' is not a function, the
-command should initialize it to a list of entries for displaying.
-Finally, it should call `tabulated-list-print'.
-
-`tabulated-list-print' calls the printer function specified by
-`tabulated-list-printer', once for each entry.  The default
-printer is `tabulated-list-print-entry', but a mode that keeps
-data in an ewoc may instead specify a printer function (e.g., one
-that calls `ewoc-enter-last'), with `tabulated-list-print-entry'
-as the ewoc pretty-printer.
-
-\(fn)" t nil)
-
-;;;***
-\f
-;;;### (autoloads (talk talk-connect) "talk" "talk.el" (20352 65510))
+;;;### (autoloads (talk talk-connect) "talk" "talk.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from talk.el
 
 (autoload 'talk-connect "talk" "\
@@ -28164,7 +27977,8 @@ Connect to the Emacs talk group from the current X display or tty frame.
 
 ;;;***
 \f
-;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (20400 62402))
+;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (20387 44199
+;;;;;;  24128 0))
 ;;; Generated autoloads from tar-mode.el
 
 (autoload 'tar-mode "tar-mode" "\
@@ -28188,7 +28002,7 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
 ;;;***
 \f
 ;;;### (autoloads (tcl-help-on-word inferior-tcl tcl-mode) "tcl"
-;;;;;;  "progmodes/tcl.el" (20400 62402))
+;;;;;;  "progmodes/tcl.el" (20355 10021 546955 0))
 ;;; Generated autoloads from progmodes/tcl.el
 
 (autoload 'tcl-mode "tcl" "\
@@ -28236,7 +28050,8 @@ Prefix argument means invert sense of `tcl-use-smart-word-finder'.
 
 ;;;***
 \f
-;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (20352 65510))
+;;;### (autoloads (rsh telnet) "telnet" "net/telnet.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from net/telnet.el
 
 (autoload 'telnet "telnet" "\
@@ -28262,7 +28077,7 @@ Normally input is edited in Emacs and sent a line at a time.
 ;;;***
 \f
 ;;;### (autoloads (serial-term ansi-term term make-term) "term" "term.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20461 32935 300400 0))
 ;;; Generated autoloads from term.el
 
 (autoload 'make-term "term" "\
@@ -28304,8 +28119,8 @@ use in that buffer.
 
 ;;;***
 \f
-;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (terminal-emulator) "terminal" "terminal.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from terminal.el
 
 (autoload 'terminal-emulator "terminal" "\
@@ -28342,7 +28157,7 @@ subprocess started.
 ;;;***
 \f
 ;;;### (autoloads (testcover-this-defun) "testcover" "emacs-lisp/testcover.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/testcover.el
 
 (autoload 'testcover-this-defun "testcover" "\
@@ -28352,7 +28167,8 @@ Start coverage on function under point.
 
 ;;;***
 \f
-;;;### (autoloads (tetris) "tetris" "play/tetris.el" (20352 65510))
+;;;### (autoloads (tetris) "tetris" "play/tetris.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from play/tetris.el
 
 (autoload 'tetris "tetris" "\
@@ -28383,7 +28199,7 @@ tetris-mode keybindings:
 ;;;;;;  tex-start-commands tex-start-options slitex-run-command latex-run-command
 ;;;;;;  tex-run-command tex-offer-save tex-main-file tex-first-line-header-regexp
 ;;;;;;  tex-directory tex-shell-file-name) "tex-mode" "textmodes/tex-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20458 56750 651721 0))
 ;;; Generated autoloads from textmodes/tex-mode.el
 
 (defvar tex-shell-file-name nil "\
@@ -28685,7 +28501,7 @@ Major mode to edit DocTeX files.
 ;;;***
 \f
 ;;;### (autoloads (texi2info texinfo-format-region texinfo-format-buffer)
-;;;;;;  "texinfmt" "textmodes/texinfmt.el" (20400 62402))
+;;;;;;  "texinfmt" "textmodes/texinfmt.el" (20434 17809 692608 0))
 ;;; Generated autoloads from textmodes/texinfmt.el
 
 (autoload 'texinfo-format-buffer "texinfmt" "\
@@ -28725,7 +28541,7 @@ if large.  You can use `Info-split' to do this manually.
 ;;;***
 \f
 ;;;### (autoloads (texinfo-mode texinfo-close-quote texinfo-open-quote)
-;;;;;;  "texinfo" "textmodes/texinfo.el" (20352 65510))
+;;;;;;  "texinfo" "textmodes/texinfo.el" (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/texinfo.el
 
 (defvar texinfo-open-quote (purecopy "``") "\
@@ -28811,7 +28627,7 @@ value of `texinfo-mode-hook'.
 \f
 ;;;### (autoloads (thai-composition-function thai-compose-buffer
 ;;;;;;  thai-compose-string thai-compose-region) "thai-util" "language/thai-util.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from language/thai-util.el
 
 (autoload 'thai-compose-region "thai-util" "\
@@ -28840,7 +28656,7 @@ Compose Thai characters in the current buffer.
 \f
 ;;;### (autoloads (list-at-point number-at-point symbol-at-point
 ;;;;;;  sexp-at-point thing-at-point bounds-of-thing-at-point forward-thing)
-;;;;;;  "thingatpt" "thingatpt.el" (20352 65510))
+;;;;;;  "thingatpt" "thingatpt.el" (20416 44451 205563 0))
 ;;; Generated autoloads from thingatpt.el
 
 (autoload 'forward-thing "thingatpt" "\
@@ -28903,7 +28719,7 @@ Return the Lisp list at point, or nil if none is found.
 \f
 ;;;### (autoloads (thumbs-dired-setroot thumbs-dired-show thumbs-dired-show-marked
 ;;;;;;  thumbs-show-from-dir thumbs-find-thumb) "thumbs" "thumbs.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from thumbs.el
 
 (autoload 'thumbs-find-thumb "thumbs" "\
@@ -28941,8 +28757,8 @@ In dired, call the setroot program on the image at point.
 ;;;;;;  tibetan-post-read-conversion tibetan-compose-buffer tibetan-decompose-buffer
 ;;;;;;  tibetan-decompose-string tibetan-decompose-region tibetan-compose-region
 ;;;;;;  tibetan-compose-string tibetan-transcription-to-tibetan tibetan-tibetan-to-transcription
-;;;;;;  tibetan-char-p) "tibet-util" "language/tibet-util.el" (20400
-;;;;;;  62402))
+;;;;;;  tibetan-char-p) "tibet-util" "language/tibet-util.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from language/tibet-util.el
 
 (autoload 'tibetan-char-p "tibet-util" "\
@@ -29016,7 +28832,7 @@ See also docstring of the function tibetan-compose-region.
 ;;;***
 \f
 ;;;### (autoloads (tildify-buffer tildify-region) "tildify" "textmodes/tildify.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20373 11301 906925 0))
 ;;; Generated autoloads from textmodes/tildify.el
 
 (autoload 'tildify-region "tildify" "\
@@ -29041,7 +28857,7 @@ This function performs no refilling of the changed text.
 \f
 ;;;### (autoloads (emacs-init-time emacs-uptime display-time-world
 ;;;;;;  display-time-mode display-time display-time-day-and-date)
-;;;;;;  "time" "time.el" (20400 62402))
+;;;;;;  "time" "time.el" (20387 44199 24128 0))
 ;;; Generated autoloads from time.el
 
 (defvar display-time-day-and-date nil "\
@@ -29107,7 +28923,7 @@ Return a string giving the duration of the Emacs initialization.
 ;;;;;;  time-to-day-in-year date-leap-year-p days-between date-to-day
 ;;;;;;  time-add time-subtract time-since days-to-time time-less-p
 ;;;;;;  seconds-to-time date-to-time) "time-date" "calendar/time-date.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20453 5437 764254 0))
 ;;; Generated autoloads from calendar/time-date.el
 
 (autoload 'date-to-time "time-date" "\
@@ -29221,7 +29037,7 @@ This function does not work for SECONDS greater than `most-positive-fixnum'.
 ;;;***
 \f
 ;;;### (autoloads (time-stamp-toggle-active time-stamp) "time-stamp"
-;;;;;;  "time-stamp.el" (20352 65510))
+;;;;;;  "time-stamp.el" (20355 10021 546955 0))
 ;;; Generated autoloads from time-stamp.el
 (put 'time-stamp-format 'safe-local-variable 'stringp)
 (put 'time-stamp-time-zone 'safe-local-variable 'string-or-null-p)
@@ -29264,18 +29080,18 @@ With ARG, turn time stamping on if and only if arg is positive.
 ;;;### (autoloads (timeclock-when-to-leave-string timeclock-workday-elapsed-string
 ;;;;;;  timeclock-workday-remaining-string timeclock-reread-log timeclock-query-out
 ;;;;;;  timeclock-change timeclock-status-string timeclock-out timeclock-in
-;;;;;;  timeclock-modeline-display) "timeclock" "calendar/timeclock.el"
-;;;;;;  (20352 65510))
+;;;;;;  timeclock-mode-line-display) "timeclock" "calendar/timeclock.el"
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from calendar/timeclock.el
 
-(autoload 'timeclock-modeline-display "timeclock" "\
-Toggle display of the amount of time left today in the modeline.
+(autoload 'timeclock-mode-line-display "timeclock" "\
+Toggle display of the amount of time left today in the mode line.
 If `timeclock-use-display-time' is non-nil (the default), then
-the function `display-time-mode' must be active, and the modeline
+the function `display-time-mode' must be active, and the mode line
 will be updated whenever the time display is updated.  Otherwise,
 the timeclock will use its own sixty second timer to do its
-updating.  With prefix ARG, turn modeline display on if and only
-if ARG is positive.  Returns the new status of timeclock modeline
+updating.  With prefix ARG, turn mode line display on if and only
+if ARG is positive.  Returns the new status of timeclock mode line
 display (non-nil means on).
 
 \(fn &optional ARG)" t nil)
@@ -29365,7 +29181,7 @@ relative only to the time worked today, and not to past time.
 ;;;***
 \f
 ;;;### (autoloads (batch-titdic-convert titdic-convert) "titdic-cnv"
-;;;;;;  "international/titdic-cnv.el" (20352 65510))
+;;;;;;  "international/titdic-cnv.el" (20355 10021 546955 0))
 ;;; Generated autoloads from international/titdic-cnv.el
 
 (autoload 'titdic-convert "titdic-cnv" "\
@@ -29388,7 +29204,7 @@ To get complete usage, invoke \"emacs -batch -f batch-titdic-convert -h\".
 ;;;***
 \f
 ;;;### (autoloads (tmm-prompt tmm-menubar-mouse tmm-menubar) "tmm"
-;;;;;;  "tmm.el" (20400 62402))
+;;;;;;  "tmm.el" (20433 53542 563193 0))
 ;;; Generated autoloads from tmm.el
  (define-key global-map "\M-`" 'tmm-menubar)
  (define-key global-map [menu-bar mouse-1] 'tmm-menubar-mouse)
@@ -29428,7 +29244,7 @@ Its value should be an event that has a binding in MENU.
 \f
 ;;;### (autoloads (todo-show todo-cp todo-mode todo-print todo-top-priorities
 ;;;;;;  todo-insert-item todo-add-item-non-interactively todo-add-category)
-;;;;;;  "todo-mode" "calendar/todo-mode.el" (20352 65510))
+;;;;;;  "todo-mode" "calendar/todo-mode.el" (20355 10021 546955 0))
 ;;; Generated autoloads from calendar/todo-mode.el
 
 (autoload 'todo-add-category "todo-mode" "\
@@ -29488,7 +29304,7 @@ Show TODO list.
 \f
 ;;;### (autoloads (tool-bar-local-item-from-menu tool-bar-add-item-from-menu
 ;;;;;;  tool-bar-local-item tool-bar-add-item toggle-tool-bar-mode-from-frame)
-;;;;;;  "tool-bar" "tool-bar.el" (20352 65510))
+;;;;;;  "tool-bar" "tool-bar.el" (20355 10021 546955 0))
 ;;; Generated autoloads from tool-bar.el
 
 (autoload 'toggle-tool-bar-mode-from-frame "tool-bar" "\
@@ -29559,7 +29375,7 @@ holds a keymap.
 ;;;***
 \f
 ;;;### (autoloads (tpu-edt-on tpu-edt-mode) "tpu-edt" "emulation/tpu-edt.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20399 35365 4050 0))
 ;;; Generated autoloads from emulation/tpu-edt.el
 
 (defvar tpu-edt-mode nil "\
@@ -29589,7 +29405,7 @@ Turn on TPU/edt emulation.
 ;;;***
 \f
 ;;;### (autoloads (tpu-mapper) "tpu-mapper" "emulation/tpu-mapper.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emulation/tpu-mapper.el
 
 (autoload 'tpu-mapper "tpu-mapper" "\
@@ -29623,7 +29439,8 @@ your local X guru can try to figure out why the key is being ignored.
 
 ;;;***
 \f
-;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (20352 65510))
+;;;### (autoloads (tq-create) "tq" "emacs-lisp/tq.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from emacs-lisp/tq.el
 
 (autoload 'tq-create "tq" "\
@@ -29637,7 +29454,7 @@ to a tcp server on another machine.
 ;;;***
 \f
 ;;;### (autoloads (trace-function-background trace-function trace-buffer)
-;;;;;;  "trace" "emacs-lisp/trace.el" (20352 65510))
+;;;;;;  "trace" "emacs-lisp/trace.el" (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/trace.el
 
 (defvar trace-buffer (purecopy "*trace-output*") "\
@@ -29674,11 +29491,11 @@ BUFFER defaults to `trace-buffer'.
 ;;;### (autoloads (tramp-unload-tramp tramp-completion-handle-file-name-completion
 ;;;;;;  tramp-completion-handle-file-name-all-completions tramp-unload-file-name-handlers
 ;;;;;;  tramp-file-name-handler tramp-syntax tramp-mode) "tramp"
-;;;;;;  "net/tramp.el" (20400 62402))
+;;;;;;  "net/tramp.el" (20447 37 83194 0))
 ;;; Generated autoloads from net/tramp.el
 
 (defvar tramp-mode t "\
-*Whether Tramp is enabled.
+Whether Tramp is enabled.
 If it is set to nil, all remote file names are used literally.")
 
 (custom-autoload 'tramp-mode "tramp" t)
@@ -29694,7 +29511,7 @@ It can have the following values:
 
 (custom-autoload 'tramp-syntax "tramp" t)
 
-(defconst tramp-file-name-regexp-unified (if (memq system-type '(cygwin windows-nt)) "\\`/\\([^[/:]\\{2,\\}\\|[^/]\\{2,\\}]\\):" "\\`/\\([^[/:]+\\|[^/]+]\\):") "\
+(defconst tramp-file-name-regexp-unified (if (memq system-type '(cygwin windows-nt)) "\\`/\\([^[/|:]\\{2,\\}\\|[^/|]\\{2,\\}]\\):" "\\`/\\([^[/|:]+\\|[^/|]+]\\):") "\
 Value for `tramp-file-name-regexp' for unified remoting.
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
 Tramp.  See `tramp-file-name-structure' for more explanations.
@@ -29706,12 +29523,12 @@ Value for `tramp-file-name-regexp' for separate remoting.
 XEmacs uses a separate filename syntax for Tramp and EFS.
 See `tramp-file-name-structure' for more explanations.")
 
-(defconst tramp-file-name-regexp-url "\\`/[^/:]+://" "\
+(defconst tramp-file-name-regexp-url "\\`/[^/|:]+://" "\
 Value for `tramp-file-name-regexp' for URL-like remoting.
 See `tramp-file-name-structure' for more explanations.")
 
 (defconst tramp-file-name-regexp (cond ((equal tramp-syntax 'ftp) tramp-file-name-regexp-unified) ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate) ((equal tramp-syntax 'url) tramp-file-name-regexp-url) (t (error "Wrong `tramp-syntax' defined"))) "\
-*Regular expression matching file names handled by Tramp.
+Regular expression matching file names handled by Tramp.
 This regexp should match Tramp file names but no other file names.
 When tramp.el is loaded, this regular expression is prepended to
 `file-name-handler-alist', and that is searched sequentially.  Thus,
@@ -29743,7 +29560,7 @@ Value for `tramp-completion-file-name-regexp' for URL-like remoting.
 See `tramp-file-name-structure' for more explanations.")
 
 (defconst tramp-completion-file-name-regexp (cond ((equal tramp-syntax 'ftp) tramp-completion-file-name-regexp-unified) ((equal tramp-syntax 'sep) tramp-completion-file-name-regexp-separate) ((equal tramp-syntax 'url) tramp-completion-file-name-regexp-url) (t (error "Wrong `tramp-syntax' defined"))) "\
-*Regular expression matching file names handled by Tramp completion.
+Regular expression matching file names handled by Tramp completion.
 This regexp should match partial Tramp file names only.
 
 Please note that the entry in `file-name-handler-alist' is made when
@@ -29807,7 +29624,7 @@ Discard Tramp from loading remote files.
 ;;;***
 \f
 ;;;### (autoloads (tramp-ftp-enable-ange-ftp) "tramp-ftp" "net/tramp-ftp.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20438 24016 194668 0))
 ;;; Generated autoloads from net/tramp-ftp.el
 
 (autoload 'tramp-ftp-enable-ange-ftp "tramp-ftp" "\
@@ -29817,8 +29634,8 @@ Discard Tramp from loading remote files.
 
 ;;;***
 \f
-;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (20369
+;;;;;;  14251 85829 0))
 ;;; Generated autoloads from tutorial.el
 
 (autoload 'help-with-tutorial "tutorial" "\
@@ -29843,7 +29660,7 @@ resumed later.
 ;;;***
 \f
 ;;;### (autoloads (tai-viet-composition-function) "tv-util" "language/tv-util.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from language/tv-util.el
 
 (autoload 'tai-viet-composition-function "tv-util" "\
@@ -29854,7 +29671,7 @@ resumed later.
 ;;;***
 \f
 ;;;### (autoloads (2C-split 2C-associate-buffer 2C-two-columns) "two-column"
-;;;;;;  "textmodes/two-column.el" (20400 62402))
+;;;;;;  "textmodes/two-column.el" (20364 31990 752722 691000))
 ;;; Generated autoloads from textmodes/two-column.el
  (autoload '2C-command "two-column" () t 'keymap)
  (global-set-key "\C-x6" '2C-command)
@@ -29905,7 +29722,7 @@ First column's text    sSs  Second column's text
 ;;;;;;  type-break type-break-mode type-break-keystroke-threshold
 ;;;;;;  type-break-good-break-interval type-break-good-rest-interval
 ;;;;;;  type-break-interval type-break-mode) "type-break" "type-break.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from type-break.el
 
 (defvar type-break-mode nil "\
@@ -30087,7 +29904,8 @@ FRAC should be the inverse of the fractional value; for example, a value of
 
 ;;;***
 \f
-;;;### (autoloads (uce-reply-to-uce) "uce" "mail/uce.el" (20352 65510))
+;;;### (autoloads (uce-reply-to-uce) "uce" "mail/uce.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from mail/uce.el
 
 (autoload 'uce-reply-to-uce "uce" "\
@@ -30105,7 +29923,7 @@ You might need to set `uce-mail-reader' before using this.
 ;;;;;;  ucs-normalize-NFKC-string ucs-normalize-NFKC-region ucs-normalize-NFKD-string
 ;;;;;;  ucs-normalize-NFKD-region ucs-normalize-NFC-string ucs-normalize-NFC-region
 ;;;;;;  ucs-normalize-NFD-string ucs-normalize-NFD-region) "ucs-normalize"
-;;;;;;  "international/ucs-normalize.el" (20352 65510))
+;;;;;;  "international/ucs-normalize.el" (20355 10021 546955 0))
 ;;; Generated autoloads from international/ucs-normalize.el
 
 (autoload 'ucs-normalize-NFD-region "ucs-normalize" "\
@@ -30171,7 +29989,7 @@ Normalize the string STR by the Unicode NFC and Mac OS's HFS Plus.
 ;;;***
 \f
 ;;;### (autoloads (ununderline-region underline-region) "underline"
-;;;;;;  "textmodes/underline.el" (20352 65510))
+;;;;;;  "textmodes/underline.el" (20355 10021 546955 0))
 ;;; Generated autoloads from textmodes/underline.el
 
 (autoload 'underline-region "underline" "\
@@ -30192,7 +30010,7 @@ which specify the range to operate on.
 ;;;***
 \f
 ;;;### (autoloads (unrmail batch-unrmail) "unrmail" "mail/unrmail.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20369 14251 85829 0))
 ;;; Generated autoloads from mail/unrmail.el
 
 (autoload 'batch-unrmail "unrmail" "\
@@ -30211,8 +30029,8 @@ Convert old-style Rmail Babyl file FILE to system inbox format file TO-FILE.
 
 ;;;***
 \f
-;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (unsafep) "unsafep" "emacs-lisp/unsafep.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/unsafep.el
 
 (autoload 'unsafep "unsafep" "\
@@ -30225,12 +30043,14 @@ UNSAFEP-VARS is a list of symbols with local bindings.
 ;;;***
 \f
 ;;;### (autoloads (url-retrieve-synchronously url-retrieve) "url"
-;;;;;;  "url/url.el" (20400 62402))
+;;;;;;  "url/url.el" (20450 62630 628906 0))
 ;;; Generated autoloads from url/url.el
 
 (autoload 'url-retrieve "url" "\
 Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
-URL is either a string or a parsed URL.
+URL is either a string or a parsed URL.  If it is a string
+containing characters that are not valid in a URI, those
+characters are percent-encoded; see `url-encode-url'.
 
 CALLBACK is called when the object has been completely retrieved, with
 the current buffer containing the object, and any MIME headers associated
@@ -30255,6 +30075,8 @@ take effect.
 If SILENT, then don't message progress reports and the like.
 If INHIBIT-COOKIES, cookies will neither be stored nor sent to
 the server.
+If URL is a multibyte string, it will be encoded as utf-8 and
+URL-encoded before it's used.
 
 \(fn URL CALLBACK &optional CBARGS SILENT INHIBIT-COOKIES)" nil nil)
 
@@ -30269,7 +30091,7 @@ no further processing).  URL is either a string or a parsed URL.
 ;;;***
 \f
 ;;;### (autoloads (url-register-auth-scheme url-get-authentication)
-;;;;;;  "url-auth" "url/url-auth.el" (20352 65510))
+;;;;;;  "url-auth" "url/url-auth.el" (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-auth.el
 
 (autoload 'url-get-authentication "url-auth" "\
@@ -30311,7 +30133,7 @@ RATING   a rating between 1 and 10 of the strength of the authentication.
 ;;;***
 \f
 ;;;### (autoloads (url-cache-extract url-is-cached url-store-in-cache)
-;;;;;;  "url-cache" "url/url-cache.el" (20352 65510))
+;;;;;;  "url-cache" "url/url-cache.el" (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-cache.el
 
 (autoload 'url-store-in-cache "url-cache" "\
@@ -30332,7 +30154,8 @@ Extract FNAM from the local disk cache.
 
 ;;;***
 \f
-;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (20352 65510))
+;;;### (autoloads (url-cid) "url-cid" "url/url-cid.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from url/url-cid.el
 
 (autoload 'url-cid "url-cid" "\
@@ -30343,7 +30166,7 @@ Extract FNAM from the local disk cache.
 ;;;***
 \f
 ;;;### (autoloads (url-dav-vc-registered url-dav-supported-p) "url-dav"
-;;;;;;  "url/url-dav.el" (20400 62402))
+;;;;;;  "url/url-dav.el" (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-dav.el
 
 (autoload 'url-dav-supported-p "url-dav" "\
@@ -30358,8 +30181,8 @@ Extract FNAM from the local disk cache.
 
 ;;;***
 \f
-;;;### (autoloads (url-file) "url-file" "url/url-file.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (url-file) "url-file" "url/url-file.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from url/url-file.el
 
 (autoload 'url-file "url-file" "\
@@ -30370,7 +30193,7 @@ Handle file: and ftp: URLs.
 ;;;***
 \f
 ;;;### (autoloads (url-open-stream url-gateway-nslookup-host) "url-gw"
-;;;;;;  "url/url-gw.el" (20352 65510))
+;;;;;;  "url/url-gw.el" (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-gw.el
 
 (autoload 'url-gateway-nslookup-host "url-gw" "\
@@ -30390,7 +30213,7 @@ Might do a non-blocking connection; use `process-status' to check.
 \f
 ;;;### (autoloads (url-insert-file-contents url-file-local-copy url-copy-file
 ;;;;;;  url-file-handler url-handler-mode) "url-handlers" "url/url-handlers.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20440 54677 388705 0))
 ;;; Generated autoloads from url/url-handlers.el
 
 (defvar url-handler-mode nil "\
@@ -30445,7 +30268,8 @@ accessible.
 ;;;***
 \f
 ;;;### (autoloads (url-http-options url-http-file-attributes url-http-file-exists-p
-;;;;;;  url-http) "url-http" "url/url-http.el" (20400 62402))
+;;;;;;  url-http) "url-http" "url/url-http.el" (20415 53309 822770
+;;;;;;  0))
 ;;; Generated autoloads from url/url-http.el
 
 (autoload 'url-http "url-http" "\
@@ -30514,7 +30338,8 @@ HTTPS retrievals are asynchronous.")
 
 ;;;***
 \f
-;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (20352 65510))
+;;;### (autoloads (url-irc) "url-irc" "url/url-irc.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from url/url-irc.el
 
 (autoload 'url-irc "url-irc" "\
@@ -30524,8 +30349,8 @@ HTTPS retrievals are asynchronous.")
 
 ;;;***
 \f
-;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (20400
-;;;;;;  62402))
+;;;### (autoloads (url-ldap) "url-ldap" "url/url-ldap.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from url/url-ldap.el
 
 (autoload 'url-ldap "url-ldap" "\
@@ -30539,7 +30364,7 @@ URL can be a URL string, or a URL vector of the type returned by
 ;;;***
 \f
 ;;;### (autoloads (url-mailto url-mail) "url-mailto" "url/url-mailto.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-mailto.el
 
 (autoload 'url-mail "url-mailto" "\
@@ -30555,7 +30380,8 @@ Handle the mailto: URL syntax.
 ;;;***
 \f
 ;;;### (autoloads (url-data url-generic-emulator-loader url-info
-;;;;;;  url-man) "url-misc" "url/url-misc.el" (20352 65510))
+;;;;;;  url-man) "url-misc" "url/url-misc.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from url/url-misc.el
 
 (autoload 'url-man "url-misc" "\
@@ -30587,7 +30413,7 @@ Fetch a data URL (RFC 2397).
 ;;;***
 \f
 ;;;### (autoloads (url-snews url-news) "url-news" "url/url-news.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-news.el
 
 (autoload 'url-news "url-news" "\
@@ -30604,7 +30430,7 @@ Fetch a data URL (RFC 2397).
 \f
 ;;;### (autoloads (url-ns-user-pref url-ns-prefs isInNet isResolvable
 ;;;;;;  dnsResolve dnsDomainIs isPlainHostName) "url-ns" "url/url-ns.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-ns.el
 
 (autoload 'isPlainHostName "url-ns" "\
@@ -30645,7 +30471,7 @@ Fetch a data URL (RFC 2397).
 ;;;***
 \f
 ;;;### (autoloads (url-generic-parse-url url-recreate-url) "url-parse"
-;;;;;;  "url/url-parse.el" (20400 62402))
+;;;;;;  "url/url-parse.el" (20395 38306 463596 0))
 ;;; Generated autoloads from url/url-parse.el
 
 (autoload 'url-recreate-url "url-parse" "\
@@ -30656,14 +30482,48 @@ Recreate a URL string from the parsed URLOBJ.
 (autoload 'url-generic-parse-url "url-parse" "\
 Return an URL-struct of the parts of URL.
 The CL-style struct contains the following fields:
-TYPE USER PASSWORD HOST PORTSPEC FILENAME TARGET ATTRIBUTES FULLNESS.
+
+TYPE     is the URI scheme (string or nil).
+USER     is the user name (string or nil).
+PASSWORD is the password (string [deprecated] or nil).
+HOST     is the host (a registered name, IP literal in square
+         brackets, or IPv4 address in dotted-decimal form).
+PORTSPEC is the specified port (a number), or nil.
+FILENAME is the path AND the query component of the URI.
+TARGET   is the fragment identifier component (used to refer to a
+         subordinate resource, e.g. a part of a webpage).
+ATTRIBUTES is nil; this slot originally stored the attribute and
+         value alists for IMAP URIs, but this feature was removed
+         since it conflicts with RFC 3986.
+FULLNESS is non-nil iff the hierarchical sequence component of
+         the URL starts with two slashes, \"//\".
+
+The parser follows RFC 3986, except that it also tries to handle
+URIs that are not fully specified (e.g. lacking TYPE), and it
+does not check for or perform %-encoding.
+
+Here is an example.  The URL
+
+  foo://bob:pass@example.com:42/a/b/c.dtb?type=animal&name=narwhal#nose
+
+parses to
+
+  TYPE     = \"foo\"
+  USER     = \"bob\"
+  PASSWORD = \"pass\"
+  HOST     = \"example.com\"
+  PORTSPEC = 42
+  FILENAME = \"/a/b/c.dtb?type=animal&name=narwhal\"
+  TARGET   = \"nose\"
+  ATTRIBUTES = nil
+  FULLNESS = t
 
 \(fn URL)" nil nil)
 
 ;;;***
 \f
 ;;;### (autoloads (url-setup-privacy-info) "url-privacy" "url/url-privacy.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-privacy.el
 
 (autoload 'url-setup-privacy-info "url-privacy" "\
@@ -30674,7 +30534,7 @@ Setup variables that expose info about you and your system.
 ;;;***
 \f
 ;;;### (autoloads (url-queue-retrieve) "url-queue" "url/url-queue.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from url/url-queue.el
 
 (autoload 'url-queue-retrieve "url-queue" "\
@@ -30689,12 +30549,13 @@ The variable `url-queue-timeout' sets a timeout.
 ;;;***
 \f
 ;;;### (autoloads (url-view-url url-truncate-url-for-viewing url-file-extension
-;;;;;;  url-hexify-string url-unhex-string url-parse-query-string
-;;;;;;  url-file-nondirectory url-file-directory url-percentage url-display-percentage
-;;;;;;  url-pretty-length url-strip-leading-spaces url-eat-trailing-space
-;;;;;;  url-get-normalized-date url-lazy-message url-normalize-url
-;;;;;;  url-insert-entities-in-string url-parse-args url-debug url-debug)
-;;;;;;  "url-util" "url/url-util.el" (20400 62402))
+;;;;;;  url-encode-url url-hexify-string url-unhex-string url-build-query-string
+;;;;;;  url-parse-query-string url-file-nondirectory url-file-directory
+;;;;;;  url-percentage url-display-percentage url-pretty-length url-strip-leading-spaces
+;;;;;;  url-eat-trailing-space url-get-normalized-date url-lazy-message
+;;;;;;  url-normalize-url url-insert-entities-in-string url-parse-args
+;;;;;;  url-debug url-debug) "url-util" "url/url-util.el" (20402
+;;;;;;  11562 85788 0))
 ;;; Generated autoloads from url/url-util.el
 
 (defvar url-debug nil "\
@@ -30788,6 +30649,18 @@ Return the nondirectory part of FILE, for a URL.
 
 \(fn QUERY &optional DOWNCASE ALLOW-NEWLINES)" nil nil)
 
+(autoload 'url-build-query-string "url-util" "\
+Build a query-string.
+
+Given a QUERY in the form:
+'((key1 val1)
+  (key2 val2)
+  (key3 val1 val2)
+  (key4)
+  (key5 
+
+\(fn QUERY &optional SEMICOLONS KEEP-EMPTY)" nil nil)
+
 (autoload 'url-unhex-string "url-util" "\
 Remove %XX embedded spaces, etc in a URL.
 If optional second argument ALLOW-NEWLINES is non-nil, then allow the
@@ -30797,13 +30670,27 @@ forbidden in URL encoding.
 \(fn STR &optional ALLOW-NEWLINES)" nil nil)
 
 (autoload 'url-hexify-string "url-util" "\
-Return a new string that is STRING URI-encoded.
-First, STRING is converted to utf-8, if necessary.  Then, for each
-character in the utf-8 string, those found in `url-unreserved-chars'
-are left as-is, all others are represented as a three-character
-string: \"%\" followed by two lowercase hex digits.
+URI-encode STRING and return the result.
+If STRING is multibyte, it is first converted to a utf-8 byte
+string.  Each byte corresponding to an allowed character is left
+as-is, while all other bytes are converted to a three-character
+string: \"%\" followed by two upper-case hex digits.
+
+The allowed characters are specified by ALLOWED-CHARS.  If this
+argument is nil, the list `url-unreserved-chars' determines the
+allowed characters.  Otherwise, ALLOWED-CHARS should be a vector
+whose Nth element is non-nil if character N is allowed.
+
+\(fn STRING &optional ALLOWED-CHARS)" nil nil)
+
+(autoload 'url-encode-url "url-util" "\
+Return a properly URI-encoded version of URL.
+This function also performs URI normalization, e.g. converting
+the scheme to lowercase if it is uppercase.  Apart from
+normalization, if URL is already URI-encoded, this function
+should return it unchanged.
 
-\(fn STRING)" nil nil)
+\(fn URL)" nil nil)
 
 (autoload 'url-file-extension "url-util" "\
 Return the filename extension of FNAME.
@@ -30830,7 +30717,7 @@ This uses `url-current-object', set locally to the buffer.
 ;;;***
 \f
 ;;;### (autoloads (ask-user-about-supersession-threat ask-user-about-lock)
-;;;;;;  "userlock" "userlock.el" (20352 65510))
+;;;;;;  "userlock" "userlock.el" (20355 10021 546955 0))
 ;;; Generated autoloads from userlock.el
 
 (autoload 'ask-user-about-lock "userlock" "\
@@ -30860,7 +30747,7 @@ The buffer in question is current when this function is called.
 \f
 ;;;### (autoloads (utf-7-imap-pre-write-conversion utf-7-pre-write-conversion
 ;;;;;;  utf-7-imap-post-read-conversion utf-7-post-read-conversion)
-;;;;;;  "utf-7" "international/utf-7.el" (20352 65510))
+;;;;;;  "utf-7" "international/utf-7.el" (20355 10021 546955 0))
 ;;; Generated autoloads from international/utf-7.el
 
 (autoload 'utf-7-post-read-conversion "utf-7" "\
@@ -30885,7 +30772,8 @@ The buffer in question is current when this function is called.
 
 ;;;***
 \f
-;;;### (autoloads (utf7-encode) "utf7" "gnus/utf7.el" (20352 65510))
+;;;### (autoloads (utf7-encode) "utf7" "gnus/utf7.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from gnus/utf7.el
 
 (autoload 'utf7-encode "utf7" "\
@@ -30897,7 +30785,7 @@ Encode UTF-7 STRING.  Use IMAP modification if FOR-IMAP is non-nil.
 \f
 ;;;### (autoloads (uudecode-decode-region uudecode-decode-region-internal
 ;;;;;;  uudecode-decode-region-external) "uudecode" "mail/uudecode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from mail/uudecode.el
 
 (autoload 'uudecode-decode-region-external "uudecode" "\
@@ -30927,8 +30815,8 @@ If FILE-NAME is non-nil, save the result to FILE-NAME.
 ;;;;;;  vc-print-log vc-retrieve-tag vc-create-tag vc-merge vc-insert-headers
 ;;;;;;  vc-revision-other-window vc-root-diff vc-ediff vc-version-ediff
 ;;;;;;  vc-diff vc-version-diff vc-register vc-next-action vc-before-checkin-hook
-;;;;;;  vc-checkin-hook vc-checkout-hook) "vc" "vc/vc.el" (20400
-;;;;;;  62402))
+;;;;;;  vc-checkin-hook vc-checkout-hook) "vc" "vc/vc.el" (20421
+;;;;;;  62373 255269 0))
 ;;; Generated autoloads from vc/vc.el
 
 (defvar vc-checkout-hook nil "\
@@ -31206,7 +31094,7 @@ Return the branch part of a revision number REV.
 ;;;***
 \f
 ;;;### (autoloads (vc-annotate) "vc-annotate" "vc/vc-annotate.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20356 55829 180242 0))
 ;;; Generated autoloads from vc/vc-annotate.el
 
 (autoload 'vc-annotate "vc-annotate" "\
@@ -31243,7 +31131,8 @@ mode-specific menu.  `vc-annotate-color-map' and
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-arch" "vc/vc-arch.el" (20400 62402))
+;;;### (autoloads nil "vc-arch" "vc/vc-arch.el" (20427 14766 970343
+;;;;;;  0))
 ;;; Generated autoloads from vc/vc-arch.el
  (defun vc-arch-registered (file)
   (if (vc-find-root file "{arch}/=tagging-method")
@@ -31253,7 +31142,8 @@ mode-specific menu.  `vc-annotate-color-map' and
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-bzr" "vc/vc-bzr.el" (20400 62402))
+;;;### (autoloads nil "vc-bzr" "vc/vc-bzr.el" (20406 55122 186927
+;;;;;;  0))
 ;;; Generated autoloads from vc/vc-bzr.el
 
 (defconst vc-bzr-admin-dirname ".bzr" "\
@@ -31269,7 +31159,8 @@ Name of the format file in a .bzr directory.")
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-cvs" "vc/vc-cvs.el" (20400 62402))
+;;;### (autoloads nil "vc-cvs" "vc/vc-cvs.el" (20427 14766 970343
+;;;;;;  0))
 ;;; Generated autoloads from vc/vc-cvs.el
 (defun vc-cvs-registered (f)
   "Return non-nil if file F is registered with CVS."
@@ -31280,7 +31171,8 @@ Name of the format file in a .bzr directory.")
 
 ;;;***
 \f
-;;;### (autoloads (vc-dir) "vc-dir" "vc/vc-dir.el" (20400 62402))
+;;;### (autoloads (vc-dir) "vc-dir" "vc/vc-dir.el" (20377 8374 887348
+;;;;;;  0))
 ;;; Generated autoloads from vc/vc-dir.el
 
 (autoload 'vc-dir "vc-dir" "\
@@ -31305,7 +31197,7 @@ These are the commands available for use in the file status buffer:
 ;;;***
 \f
 ;;;### (autoloads (vc-do-command) "vc-dispatcher" "vc/vc-dispatcher.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20364 45187 886974 270000))
 ;;; Generated autoloads from vc/vc-dispatcher.el
 
 (autoload 'vc-do-command "vc-dispatcher" "\
@@ -31328,7 +31220,8 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-git" "vc/vc-git.el" (20400 62402))
+;;;### (autoloads nil "vc-git" "vc/vc-git.el" (20464 9124 585807
+;;;;;;  0))
 ;;; Generated autoloads from vc/vc-git.el
  (defun vc-git-registered (file)
   "Return non-nil if FILE is registered with git."
@@ -31339,7 +31232,7 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-hg" "vc/vc-hg.el" (20400 62402))
+;;;### (autoloads nil "vc-hg" "vc/vc-hg.el" (20377 8374 887348 0))
 ;;; Generated autoloads from vc/vc-hg.el
  (defun vc-hg-registered (file)
   "Return non-nil if FILE is registered with hg."
@@ -31350,7 +31243,8 @@ case, and the process object in the asynchronous case.
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (20400 62402))
+;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (20427 14766 970343
+;;;;;;  0))
 ;;; Generated autoloads from vc/vc-mtn.el
 
 (defconst vc-mtn-admin-dir "_MTN" "\
@@ -31367,7 +31261,7 @@ Name of the monotone directory's format file.")
 ;;;***
 \f
 ;;;### (autoloads (vc-rcs-master-templates) "vc-rcs" "vc/vc-rcs.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20459 40320 865360 0))
 ;;; Generated autoloads from vc/vc-rcs.el
 
 (defvar vc-rcs-master-templates (purecopy '("%sRCS/%s,v" "%s%s,v" "%sRCS/%s")) "\
@@ -31381,7 +31275,7 @@ For a description of possible values, see `vc-check-master-templates'.")
 ;;;***
 \f
 ;;;### (autoloads (vc-sccs-master-templates) "vc-sccs" "vc/vc-sccs.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20430 41939 815258 390000))
 ;;; Generated autoloads from vc/vc-sccs.el
 
 (defvar vc-sccs-master-templates (purecopy '("%sSCCS/s.%s" "%ss.%s" vc-sccs-search-project-dir)) "\
@@ -31398,7 +31292,8 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
 
 ;;;***
 \f
-;;;### (autoloads nil "vc-svn" "vc/vc-svn.el" (20352 65510))
+;;;### (autoloads nil "vc-svn" "vc/vc-svn.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from vc/vc-svn.el
  (defun vc-svn-registered (f)
   (let ((admin-dir (cond ((and (eq system-type 'windows-nt)
@@ -31412,7 +31307,7 @@ find any project directory." (let ((project-dir (getenv "PROJECTDIR")) dirs dir)
 ;;;***
 \f
 ;;;### (autoloads (vera-mode) "vera-mode" "progmodes/vera-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20434 17809 692608 0))
 ;;; Generated autoloads from progmodes/vera-mode.el
  (add-to-list 'auto-mode-alist (cons (purecopy "\\.vr[hi]?\\'")  'vera-mode))
 
@@ -31470,7 +31365,7 @@ Key bindings:
 ;;;***
 \f
 ;;;### (autoloads (verilog-mode) "verilog-mode" "progmodes/verilog-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20420 41510 996439 0))
 ;;; Generated autoloads from progmodes/verilog-mode.el
 
 (autoload 'verilog-mode "verilog-mode" "\
@@ -31609,7 +31504,7 @@ Key bindings specific to `verilog-mode-map' are:
 ;;;***
 \f
 ;;;### (autoloads (vhdl-mode) "vhdl-mode" "progmodes/vhdl-mode.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20427 14766 970343 0))
 ;;; Generated autoloads from progmodes/vhdl-mode.el
 
 (autoload 'vhdl-mode "vhdl-mode" "\
@@ -31626,7 +31521,7 @@ Usage:
     brackets and removed if the queried string is left empty.  Prompts for
     mandatory arguments remain in the code if the queried string is left
     empty.  They can be queried again by `C-c C-t C-q'.  Enabled
-    electrification is indicated by `/e' in the modeline.
+    electrification is indicated by `/e' in the mode line.
 
       Typing `M-SPC' after a keyword inserts a space without calling the
     template generator.  Automatic template generation (i.e.
@@ -31653,7 +31548,7 @@ Usage:
     Double striking of some keys inserts cumbersome VHDL syntax elements.
     Stuttering can be disabled (enabled) by typing `C-c C-m C-s' or by
     option `vhdl-stutter-mode'.  Enabled stuttering is indicated by `/s' in
-    the modeline.  The stuttering keys and their effects are:
+    the mode line.  The stuttering keys and their effects are:
 
       ;;   -->  \" : \"       [   -->  (        --    -->  comment
       ;;;  -->  \" := \"      [[  -->  [        --CR  -->  comment-out code
@@ -31687,8 +31582,10 @@ Usage:
                    with a comment in between.
         `--CR'     comments out code on that line.  Re-hitting CR comments
                    out following lines.
-        `C-c c'    comments out a region if not commented out,
-                   uncomments a region if already commented out.
+        `C-c C-c'  comments out a region if not commented out,
+                   uncomments a region if already commented out.  Option
+                   `comment-style' defines where the comment characters
+                   should be placed (beginning of line, indent, etc.).
 
       You are prompted for comments after object definitions (i.e. signals,
     variables, constants, ports) and after subprogram and process
@@ -31709,7 +31606,8 @@ Usage:
     `TAB' indents a line if at the beginning of the line.  The amount of
     indentation is specified by option `vhdl-basic-offset'.  `C-c C-i C-l'
     always indents the current line (is bound to `TAB' if option
-    `vhdl-intelligent-tab' is nil).
+    `vhdl-intelligent-tab' is nil).  If a region is active, `TAB' indents
+    the entire region.
 
       Indentation can be done for a group of lines (`C-c C-i C-g'), a region
     (`M-C-\\') or the entire buffer (menu).  Argument and port lists are
@@ -31723,6 +31621,10 @@ Usage:
       Syntax-based indentation can be very slow in large files.  Option
     `vhdl-indent-syntax-based' allows to use faster but simpler indentation.
 
+      Option `vhdl-indent-comment-like-next-code-line' controls whether
+    comment lines are indented like the preceding or like the following code
+    line.
+
 
   ALIGNMENT:
     The alignment functions align operators, keywords, and inline comments
@@ -31851,12 +31753,12 @@ Usage:
 
 
   STRUCTURAL COMPOSITION:
-    Enables simple structural composition.  `C-c C-c C-n' creates a skeleton
+    Enables simple structural composition.  `C-c C-m C-n' creates a skeleton
     for a new component.  Subcomponents (i.e. component declaration and
     instantiation) can be automatically placed from a previously read port
-    (`C-c C-c C-p') or directly from the hierarchy browser (`P').  Finally,
+    (`C-c C-m C-p') or directly from the hierarchy browser (`P').  Finally,
     all subcomponents can be automatically connected using internal signals
-    and ports (`C-c C-c C-w') following these rules:
+    and ports (`C-c C-m C-w') following these rules:
       - subcomponent actual ports with same name are considered to be
         connected by a signal (internal signal or port)
       - signals that are only inputs to subcomponents are considered as
@@ -31877,25 +31779,25 @@ Usage:
 
       Component declarations can be placed in a components package (option
     `vhdl-use-components-package') which can be automatically generated for
-    an entire directory or project (`C-c C-c M-p').  The VHDL'93 direct
+    an entire directory or project (`C-c C-m M-p').  The VHDL'93 direct
     component instantiation is also supported (option
     `vhdl-use-direct-instantiation').
 
-|     Configuration declarations can automatically be generated either from
-|   the menu (`C-c C-c C-f') (for the architecture the cursor is in) or from
-|   the speedbar menu (for the architecture under the cursor).  The
-|   configurations can optionally be hierarchical (i.e. include all
-|   component levels of a hierarchical design, option
-|   `vhdl-compose-configuration-hierarchical') or include subconfigurations
-|   (option `vhdl-compose-configuration-use-subconfiguration').  For
-|   subcomponents in hierarchical configurations, the most-recently-analyzed
-|   (mra) architecture is selected.  If another architecture is desired, it
-|   can be marked as most-recently-analyzed (speedbar menu) before
-|   generating the configuration.
-|
-|     Note: Configurations of subcomponents (i.e. hierarchical configuration
-|   declarations) are currently not considered when displaying
-|   configurations in speedbar.
+      Configuration declarations can automatically be generated either from
+    the menu (`C-c C-m C-f') (for the architecture the cursor is in) or from
+    the speedbar menu (for the architecture under the cursor).  The
+    configurations can optionally be hierarchical (i.e. include all
+    component levels of a hierarchical design, option
+    `vhdl-compose-configuration-hierarchical') or include subconfigurations
+    (option `vhdl-compose-configuration-use-subconfiguration').  For
+    subcomponents in hierarchical configurations, the most-recently-analyzed
+    (mra) architecture is selected.  If another architecture is desired, it
+    can be marked as most-recently-analyzed (speedbar menu) before
+    generating the configuration.
+      Note: Configurations of subcomponents (i.e. hierarchical configuration
+    declarations) are currently not considered when displaying
+    configurations in speedbar.
 
       See the options group `vhdl-compose' for all relevant user options.
 
@@ -31927,11 +31829,13 @@ Usage:
 
       The Makefile's default target \"all\" compiles the entire design, the
     target \"clean\" removes it and the target \"library\" creates the
-    library directory if not existent.  The Makefile also includes a target
-    for each primary library unit which allows selective compilation of this
-    unit, its secondary units and its subhierarchy (example: compilation of
-    a design specified by a configuration).  User specific parts can be
-    inserted into a Makefile with option `vhdl-makefile-generation-hook'.
+    library directory if not existent.  These target names can be customized
+    by option `vhdl-makefile-default-targets'.  The Makefile also includes a
+    target for each primary library unit which allows selective compilation
+    of this unit, its secondary units and its subhierarchy (example:
+    compilation of a design specified by a configuration).  User specific
+    parts can be inserted into a Makefile with option
+    `vhdl-makefile-generation-hook'.
 
     Limitations:
       - Only library units and dependencies within the current library are
@@ -31977,7 +31881,7 @@ Usage:
 
   VHDL STANDARDS:
     The VHDL standards to be used are specified in option `vhdl-standard'.
-    Available standards are: VHDL'87/'93, VHDL-AMS, and Math Packages.
+    Available standards are: VHDL'87/'93(02), VHDL-AMS, and Math Packages.
 
 
   KEYWORD CASE:
@@ -32053,6 +31957,9 @@ Usage:
         - Out parameters of procedures are considered to be read.
       Use option `vhdl-entity-file-name' to specify the entity file name
       (used to obtain the port names).
+      Use option `vhdl-array-index-record-field-in-sensitivity-list' to
+      specify whether to include array indices and record fields in
+      sensitivity lists.
 
 
   CODE FIXING:
@@ -32126,16 +32033,17 @@ releases.  You are kindly invited to participate in beta testing.  Subscribe
 to above mailing lists by sending an email to <reto@gnu.org>.
 
 VHDL Mode is officially distributed at
-URL `http://opensource.ethz.ch/emacs/vhdl-mode.html'
+http://www.iis.ee.ethz.ch/~zimmi/emacs/vhdl-mode.html
 where the latest version can be found.
 
 
 Known problems:
 ---------------
 
-- Indentation bug in simultaneous if- and case-statements (VHDL-AMS).
 - XEmacs: Incorrect start-up when automatically opening speedbar.
 - XEmacs: Indentation in XEmacs 21.4 (and higher).
+- Indentation incorrect for new 'postponed' VHDL keyword.
+- Indentation incorrect for 'protected body' construct.
 
 
                                                 The VHDL Mode Authors
@@ -32150,7 +32058,8 @@ Key bindings:
 
 ;;;***
 \f
-;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (20352 65510))
+;;;### (autoloads (vi-mode) "vi" "emulation/vi.el" (20355 10021 546955
+;;;;;;  0))
 ;;; Generated autoloads from emulation/vi.el
 
 (autoload 'vi-mode "vi" "\
@@ -32205,7 +32114,7 @@ Syntax table and abbrevs while in vi mode remain as they were in Emacs.
 ;;;### (autoloads (viqr-pre-write-conversion viqr-post-read-conversion
 ;;;;;;  viet-encode-viqr-buffer viet-encode-viqr-region viet-decode-viqr-buffer
 ;;;;;;  viet-decode-viqr-region viet-encode-viscii-char) "viet-util"
-;;;;;;  "language/viet-util.el" (20352 65510))
+;;;;;;  "language/viet-util.el" (20355 10021 546955 0))
 ;;; Generated autoloads from language/viet-util.el
 
 (autoload 'viet-encode-viscii-char "viet-util" "\
@@ -32253,7 +32162,7 @@ Convert Vietnamese characters of the current buffer to `VIQR' mnemonics.
 ;;;;;;  view-mode view-buffer-other-frame view-buffer-other-window
 ;;;;;;  view-buffer view-file-other-frame view-file-other-window
 ;;;;;;  view-file kill-buffer-if-not-modified view-remove-frame-by-deleting)
-;;;;;;  "view" "view.el" (20352 65510))
+;;;;;;  "view" "view.el" (20355 10021 546955 0))
 ;;; Generated autoloads from view.el
 
 (defvar view-remove-frame-by-deleting t "\
@@ -32507,8 +32416,8 @@ Exit View mode and make the current buffer editable.
 
 ;;;***
 \f
-;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from emulation/vip.el
 
 (autoload 'vip-setup "vip" "\
@@ -32524,7 +32433,7 @@ Turn on VIP emulation of VI.
 ;;;***
 \f
 ;;;### (autoloads (viper-mode toggle-viper-mode) "viper" "emulation/viper.el"
-;;;;;;  (20400 62402))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emulation/viper.el
 
 (autoload 'toggle-viper-mode "viper" "\
@@ -32541,7 +32450,7 @@ Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'.
 ;;;***
 \f
 ;;;### (autoloads (warn lwarn display-warning) "warnings" "emacs-lisp/warnings.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emacs-lisp/warnings.el
 
 (defvar warning-prefix-function nil "\
@@ -32631,7 +32540,7 @@ this is equivalent to `display-warning', using
 ;;;***
 \f
 ;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20452 17962 966427 0))
 ;;; Generated autoloads from wdired.el
 
 (autoload 'wdired-change-to-wdired-mode "wdired" "\
@@ -32647,7 +32556,8 @@ See `wdired-mode'.
 
 ;;;***
 \f
-;;;### (autoloads (webjump) "webjump" "net/webjump.el" (20400 62402))
+;;;### (autoloads (webjump) "webjump" "net/webjump.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from net/webjump.el
 
 (autoload 'webjump "webjump" "\
@@ -32664,7 +32574,7 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke
 ;;;***
 \f
 ;;;### (autoloads (which-function-mode which-func-mode) "which-func"
-;;;;;;  "progmodes/which-func.el" (20400 62402))
+;;;;;;  "progmodes/which-func.el" (20461 32935 300400 0))
 ;;; Generated autoloads from progmodes/which-func.el
  (put 'which-func-format 'risky-local-variable t)
  (put 'which-func-current 'risky-local-variable t)
@@ -32700,7 +32610,8 @@ in certain major modes.
 ;;;### (autoloads (whitespace-report-region whitespace-report whitespace-cleanup-region
 ;;;;;;  whitespace-cleanup global-whitespace-toggle-options whitespace-toggle-options
 ;;;;;;  global-whitespace-newline-mode global-whitespace-mode whitespace-newline-mode
-;;;;;;  whitespace-mode) "whitespace" "whitespace.el" (20352 65510))
+;;;;;;  whitespace-mode) "whitespace" "whitespace.el" (20434 17809
+;;;;;;  692608 0))
 ;;; Generated autoloads from whitespace.el
 
 (autoload 'whitespace-mode "whitespace" "\
@@ -33099,7 +33010,8 @@ cleaning up these problems.
 ;;;***
 \f
 ;;;### (autoloads (widget-minor-mode widget-browse-other-window widget-browse
-;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (20352 65510))
+;;;;;;  widget-browse-at) "wid-browse" "wid-browse.el" (20355 10021
+;;;;;;  546955 0))
 ;;; Generated autoloads from wid-browse.el
 
 (autoload 'widget-browse-at "wid-browse" "\
@@ -33128,8 +33040,8 @@ if ARG is omitted or nil.
 ;;;***
 \f
 ;;;### (autoloads (widget-setup widget-insert widget-delete widget-create
-;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (20400
-;;;;;;  62402))
+;;;;;;  widget-prompt-value widgetp) "wid-edit" "wid-edit.el" (20373
+;;;;;;  11301 906925 0))
 ;;; Generated autoloads from wid-edit.el
 
 (autoload 'widgetp "wid-edit" "\
@@ -33172,8 +33084,8 @@ Setup current buffer so editing string widgets works.
 ;;;***
 \f
 ;;;### (autoloads (windmove-default-keybindings windmove-down windmove-right
-;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (20352
-;;;;;;  65510))
+;;;;;;  windmove-up windmove-left) "windmove" "windmove.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from windmove.el
 
 (autoload 'windmove-left "windmove" "\
@@ -33226,7 +33138,7 @@ Default MODIFIER is 'shift.
 ;;;***
 \f
 ;;;### (autoloads (winner-mode winner-mode) "winner" "winner.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20453 5437 764254 0))
 ;;; Generated autoloads from winner.el
 
 (defvar winner-mode nil "\
@@ -33245,7 +33157,8 @@ With arg, turn Winner mode on if and only if arg is positive.
 ;;;***
 \f
 ;;;### (autoloads (woman-bookmark-jump woman-find-file woman-dired-find-file
-;;;;;;  woman woman-locale) "woman" "woman.el" (20400 62402))
+;;;;;;  woman woman-locale) "woman" "woman.el" (20458 56750 651721
+;;;;;;  0))
 ;;; Generated autoloads from woman.el
 
 (defvar woman-locale nil "\
@@ -33294,7 +33207,7 @@ Default bookmark handler for Woman buffers.
 ;;;***
 \f
 ;;;### (autoloads (wordstar-mode) "ws-mode" "emulation/ws-mode.el"
-;;;;;;  (20352 65510))
+;;;;;;  (20355 10021 546955 0))
 ;;; Generated autoloads from emulation/ws-mode.el
 
 (autoload 'wordstar-mode "ws-mode" "\
@@ -33406,7 +33319,8 @@ The key bindings are:
 
 ;;;***
 \f
-;;;### (autoloads (xesam-search) "xesam" "net/xesam.el" (20400 62402))
+;;;### (autoloads (xesam-search) "xesam" "net/xesam.el" (20464 9124
+;;;;;;  585807 0))
 ;;; Generated autoloads from net/xesam.el
 
 (autoload 'xesam-search "xesam" "\
@@ -33426,13 +33340,12 @@ Example:
 ;;;***
 \f
 ;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el"
-;;;;;;  (20370 33496))
+;;;;;;  (20464 9124 585807 0))
 ;;; Generated autoloads from xml.el
 
 (autoload 'xml-parse-file "xml" "\
 Parse the well-formed XML file FILE.
-If FILE is already visited, use its buffer and don't kill it.
-Returns the top node with all its children.
+Return the top node with all its children.
 If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.
 If PARSE-NS is non-nil, then QNAMES are expanded.
 
@@ -33452,7 +33365,7 @@ If PARSE-NS is non-nil, then QNAMES are expanded.
 ;;;***
 \f
 ;;;### (autoloads (xmltok-get-declared-encoding-position) "xmltok"
-;;;;;;  "nxml/xmltok.el" (20352 65510))
+;;;;;;  "nxml/xmltok.el" (20355 10021 546955 0))
 ;;; Generated autoloads from nxml/xmltok.el
 
 (autoload 'xmltok-get-declared-encoding-position "xmltok" "\
@@ -33470,8 +33383,8 @@ If LIMIT is non-nil, then do not consider characters beyond LIMIT.
 
 ;;;***
 \f
-;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (20352
-;;;;;;  65510))
+;;;### (autoloads (xterm-mouse-mode) "xt-mouse" "xt-mouse.el" (20355
+;;;;;;  10021 546955 0))
 ;;; Generated autoloads from xt-mouse.el
 
 (defvar xterm-mouse-mode nil "\
@@ -33501,7 +33414,7 @@ down the SHIFT key while pressing the mouse button.
 ;;;***
 \f
 ;;;### (autoloads (yenc-extract-filename yenc-decode-region) "yenc"
-;;;;;;  "gnus/yenc.el" (20352 65510))
+;;;;;;  "gnus/yenc.el" (20355 10021 546955 0))
 ;;; Generated autoloads from gnus/yenc.el
 
 (autoload 'yenc-decode-region "yenc" "\
@@ -33517,7 +33430,7 @@ Extract file name from an yenc header.
 ;;;***
 \f
 ;;;### (autoloads (psychoanalyze-pinhead apropos-zippy insert-zippyism
-;;;;;;  yow) "yow" "play/yow.el" (20400 62402))
+;;;;;;  yow) "yow" "play/yow.el" (20364 42504 244840 586000))
 ;;; Generated autoloads from play/yow.el
 
 (autoload 'yow "yow" "\
@@ -33543,7 +33456,8 @@ Zippy goes to the analyst.
 
 ;;;***
 \f
-;;;### (autoloads (zone) "zone" "play/zone.el" (20400 62402))
+;;;### (autoloads (zone) "zone" "play/zone.el" (20427 14766 970343
+;;;;;;  0))
 ;;; Generated autoloads from play/zone.el
 
 (autoload 'zone "zone" "\
@@ -33586,19 +33500,19 @@ Zone out, completely.
 ;;;;;;  "cedet/ede/project-am.el" "cedet/ede/shell.el" "cedet/ede/simple.el"
 ;;;;;;  "cedet/ede/source.el" "cedet/ede/speedbar.el" "cedet/ede/srecode.el"
 ;;;;;;  "cedet/ede/system.el" "cedet/ede/util.el" "cedet/inversion.el"
-;;;;;;  "cedet/mode-local.el" "cedet/pulse.el" "cedet/semantic/analyze.el"
-;;;;;;  "cedet/semantic/analyze/complete.el" "cedet/semantic/analyze/debug.el"
-;;;;;;  "cedet/semantic/analyze/fcn.el" "cedet/semantic/analyze/refs.el"
-;;;;;;  "cedet/semantic/bovine.el" "cedet/semantic/bovine/c-by.el"
-;;;;;;  "cedet/semantic/bovine/c.el" "cedet/semantic/bovine/debug.el"
-;;;;;;  "cedet/semantic/bovine/el.el" "cedet/semantic/bovine/gcc.el"
-;;;;;;  "cedet/semantic/bovine/make-by.el" "cedet/semantic/bovine/make.el"
-;;;;;;  "cedet/semantic/bovine/scm-by.el" "cedet/semantic/bovine/scm.el"
-;;;;;;  "cedet/semantic/chart.el" "cedet/semantic/complete.el" "cedet/semantic/ctxt.el"
-;;;;;;  "cedet/semantic/db-debug.el" "cedet/semantic/db-ebrowse.el"
-;;;;;;  "cedet/semantic/db-el.el" "cedet/semantic/db-file.el" "cedet/semantic/db-find.el"
-;;;;;;  "cedet/semantic/db-global.el" "cedet/semantic/db-javascript.el"
-;;;;;;  "cedet/semantic/db-mode.el" "cedet/semantic/db-ref.el" "cedet/semantic/db-typecache.el"
+;;;;;;  "cedet/pulse.el" "cedet/semantic/analyze.el" "cedet/semantic/analyze/complete.el"
+;;;;;;  "cedet/semantic/analyze/debug.el" "cedet/semantic/analyze/fcn.el"
+;;;;;;  "cedet/semantic/analyze/refs.el" "cedet/semantic/bovine.el"
+;;;;;;  "cedet/semantic/bovine/c-by.el" "cedet/semantic/bovine/c.el"
+;;;;;;  "cedet/semantic/bovine/debug.el" "cedet/semantic/bovine/el.el"
+;;;;;;  "cedet/semantic/bovine/gcc.el" "cedet/semantic/bovine/make-by.el"
+;;;;;;  "cedet/semantic/bovine/make.el" "cedet/semantic/bovine/scm-by.el"
+;;;;;;  "cedet/semantic/bovine/scm.el" "cedet/semantic/chart.el"
+;;;;;;  "cedet/semantic/complete.el" "cedet/semantic/ctxt.el" "cedet/semantic/db-debug.el"
+;;;;;;  "cedet/semantic/db-ebrowse.el" "cedet/semantic/db-el.el"
+;;;;;;  "cedet/semantic/db-file.el" "cedet/semantic/db-find.el" "cedet/semantic/db-global.el"
+;;;;;;  "cedet/semantic/db-javascript.el" "cedet/semantic/db-mode.el"
+;;;;;;  "cedet/semantic/db-ref.el" "cedet/semantic/db-typecache.el"
 ;;;;;;  "cedet/semantic/db.el" "cedet/semantic/debug.el" "cedet/semantic/decorate.el"
 ;;;;;;  "cedet/semantic/decorate/include.el" "cedet/semantic/decorate/mode.el"
 ;;;;;;  "cedet/semantic/dep.el" "cedet/semantic/doc.el" "cedet/semantic/ede-grammar.el"
@@ -33628,52 +33542,52 @@ Zone out, completely.
 ;;;;;;  "cedet/srecode/srt-wy.el" "cedet/srecode/srt.el" "cedet/srecode/table.el"
 ;;;;;;  "cedet/srecode/template.el" "cedet/srecode/texi.el" "cus-dep.el"
 ;;;;;;  "dframe.el" "dired-aux.el" "dired-x.el" "dos-fns.el" "dos-vars.el"
-;;;;;;  "dos-w32.el" "dynamic-setting.el" "emacs-lisp/assoc.el" "emacs-lisp/authors.el"
+;;;;;;  "dos-w32.el" "dynamic-setting.el" "emacs-lisp/authors.el"
 ;;;;;;  "emacs-lisp/avl-tree.el" "emacs-lisp/bindat.el" "emacs-lisp/byte-opt.el"
 ;;;;;;  "emacs-lisp/chart.el" "emacs-lisp/cl-extra.el" "emacs-lisp/cl-loaddefs.el"
-;;;;;;  "emacs-lisp/cl-macs.el" "emacs-lisp/cl-seq.el" "emacs-lisp/cl-specs.el"
-;;;;;;  "emacs-lisp/cust-print.el" "emacs-lisp/eieio-base.el" "emacs-lisp/eieio-custom.el"
-;;;;;;  "emacs-lisp/eieio-datadebug.el" "emacs-lisp/eieio-opt.el"
-;;;;;;  "emacs-lisp/eieio-speedbar.el" "emacs-lisp/eieio.el" "emacs-lisp/find-gc.el"
-;;;;;;  "emacs-lisp/gulp.el" "emacs-lisp/lisp-mnt.el" "emacs-lisp/package-x.el"
-;;;;;;  "emacs-lisp/regi.el" "emacs-lisp/smie.el" "emacs-lisp/tcover-ses.el"
-;;;;;;  "emacs-lisp/tcover-unsafep.el" "emulation/cua-gmrk.el" "emulation/cua-rect.el"
-;;;;;;  "emulation/edt-lk201.el" "emulation/edt-mapper.el" "emulation/edt-pc.el"
-;;;;;;  "emulation/edt-vt100.el" "emulation/tpu-extras.el" "emulation/viper-cmd.el"
-;;;;;;  "emulation/viper-ex.el" "emulation/viper-init.el" "emulation/viper-keym.el"
-;;;;;;  "emulation/viper-macs.el" "emulation/viper-mous.el" "emulation/viper-util.el"
-;;;;;;  "erc/erc-backend.el" "erc/erc-goodies.el" "erc/erc-ibuffer.el"
-;;;;;;  "erc/erc-lang.el" "eshell/em-alias.el" "eshell/em-banner.el"
-;;;;;;  "eshell/em-basic.el" "eshell/em-cmpl.el" "eshell/em-dirs.el"
-;;;;;;  "eshell/em-glob.el" "eshell/em-hist.el" "eshell/em-ls.el"
-;;;;;;  "eshell/em-pred.el" "eshell/em-prompt.el" "eshell/em-rebind.el"
-;;;;;;  "eshell/em-script.el" "eshell/em-smart.el" "eshell/em-term.el"
-;;;;;;  "eshell/em-unix.el" "eshell/em-xtra.el" "eshell/esh-arg.el"
-;;;;;;  "eshell/esh-cmd.el" "eshell/esh-ext.el" "eshell/esh-io.el"
-;;;;;;  "eshell/esh-module.el" "eshell/esh-opt.el" "eshell/esh-proc.el"
-;;;;;;  "eshell/esh-util.el" "eshell/esh-var.el" "ezimage.el" "foldout.el"
-;;;;;;  "format-spec.el" "forms-d2.el" "forms-pass.el" "fringe.el"
-;;;;;;  "generic-x.el" "gnus/compface.el" "gnus/gnus-async.el" "gnus/gnus-bcklg.el"
-;;;;;;  "gnus/gnus-cite.el" "gnus/gnus-cus.el" "gnus/gnus-demon.el"
-;;;;;;  "gnus/gnus-dup.el" "gnus/gnus-eform.el" "gnus/gnus-ems.el"
-;;;;;;  "gnus/gnus-int.el" "gnus/gnus-logic.el" "gnus/gnus-mh.el"
-;;;;;;  "gnus/gnus-salt.el" "gnus/gnus-score.el" "gnus/gnus-setup.el"
-;;;;;;  "gnus/gnus-srvr.el" "gnus/gnus-topic.el" "gnus/gnus-undo.el"
-;;;;;;  "gnus/gnus-util.el" "gnus/gnus-uu.el" "gnus/gnus-vm.el" "gnus/gssapi.el"
-;;;;;;  "gnus/ietf-drums.el" "gnus/legacy-gnus-agent.el" "gnus/mail-parse.el"
-;;;;;;  "gnus/mail-prsvr.el" "gnus/mail-source.el" "gnus/mailcap.el"
-;;;;;;  "gnus/messcompat.el" "gnus/mm-bodies.el" "gnus/mm-decode.el"
-;;;;;;  "gnus/mm-util.el" "gnus/mm-view.el" "gnus/mml-sec.el" "gnus/mml-smime.el"
-;;;;;;  "gnus/nnagent.el" "gnus/nnbabyl.el" "gnus/nndir.el" "gnus/nndraft.el"
-;;;;;;  "gnus/nneething.el" "gnus/nngateway.el" "gnus/nnheader.el"
-;;;;;;  "gnus/nnimap.el" "gnus/nnir.el" "gnus/nnmail.el" "gnus/nnmaildir.el"
-;;;;;;  "gnus/nnmairix.el" "gnus/nnmbox.el" "gnus/nnmh.el" "gnus/nnnil.el"
-;;;;;;  "gnus/nnoo.el" "gnus/nnregistry.el" "gnus/nnrss.el" "gnus/nnspool.el"
-;;;;;;  "gnus/nntp.el" "gnus/nnvirtual.el" "gnus/nnweb.el" "gnus/registry.el"
-;;;;;;  "gnus/rfc1843.el" "gnus/rfc2045.el" "gnus/rfc2047.el" "gnus/rfc2104.el"
-;;;;;;  "gnus/rfc2231.el" "gnus/rtree.el" "gnus/shr-color.el" "gnus/sieve-manage.el"
-;;;;;;  "gnus/smime.el" "gnus/spam-stat.el" "gnus/spam-wash.el" "hex-util.el"
-;;;;;;  "hfy-cmap.el" "ibuf-ext.el" "international/cp51932.el" "international/eucjp-ms.el"
+;;;;;;  "emacs-lisp/cl-macs.el" "emacs-lisp/cl-seq.el" "emacs-lisp/cl.el"
+;;;;;;  "emacs-lisp/eieio-base.el" "emacs-lisp/eieio-custom.el" "emacs-lisp/eieio-datadebug.el"
+;;;;;;  "emacs-lisp/eieio-opt.el" "emacs-lisp/eieio-speedbar.el"
+;;;;;;  "emacs-lisp/eieio.el" "emacs-lisp/find-gc.el" "emacs-lisp/gulp.el"
+;;;;;;  "emacs-lisp/lisp-mnt.el" "emacs-lisp/package-x.el" "emacs-lisp/regi.el"
+;;;;;;  "emacs-lisp/smie.el" "emacs-lisp/tcover-ses.el" "emacs-lisp/tcover-unsafep.el"
+;;;;;;  "emulation/cua-gmrk.el" "emulation/cua-rect.el" "emulation/edt-lk201.el"
+;;;;;;  "emulation/edt-mapper.el" "emulation/edt-pc.el" "emulation/edt-vt100.el"
+;;;;;;  "emulation/tpu-extras.el" "emulation/viper-cmd.el" "emulation/viper-ex.el"
+;;;;;;  "emulation/viper-init.el" "emulation/viper-keym.el" "emulation/viper-macs.el"
+;;;;;;  "emulation/viper-mous.el" "emulation/viper-util.el" "erc/erc-backend.el"
+;;;;;;  "erc/erc-goodies.el" "erc/erc-ibuffer.el" "erc/erc-lang.el"
+;;;;;;  "eshell/em-alias.el" "eshell/em-banner.el" "eshell/em-basic.el"
+;;;;;;  "eshell/em-cmpl.el" "eshell/em-dirs.el" "eshell/em-glob.el"
+;;;;;;  "eshell/em-hist.el" "eshell/em-ls.el" "eshell/em-pred.el"
+;;;;;;  "eshell/em-prompt.el" "eshell/em-rebind.el" "eshell/em-script.el"
+;;;;;;  "eshell/em-smart.el" "eshell/em-term.el" "eshell/em-unix.el"
+;;;;;;  "eshell/em-xtra.el" "eshell/esh-arg.el" "eshell/esh-cmd.el"
+;;;;;;  "eshell/esh-ext.el" "eshell/esh-io.el" "eshell/esh-module.el"
+;;;;;;  "eshell/esh-opt.el" "eshell/esh-proc.el" "eshell/esh-util.el"
+;;;;;;  "eshell/esh-var.el" "ezimage.el" "foldout.el" "format-spec.el"
+;;;;;;  "fringe.el" "generic-x.el" "gnus/compface.el" "gnus/gnus-async.el"
+;;;;;;  "gnus/gnus-bcklg.el" "gnus/gnus-cite.el" "gnus/gnus-cus.el"
+;;;;;;  "gnus/gnus-demon.el" "gnus/gnus-dup.el" "gnus/gnus-eform.el"
+;;;;;;  "gnus/gnus-ems.el" "gnus/gnus-int.el" "gnus/gnus-logic.el"
+;;;;;;  "gnus/gnus-mh.el" "gnus/gnus-salt.el" "gnus/gnus-score.el"
+;;;;;;  "gnus/gnus-setup.el" "gnus/gnus-srvr.el" "gnus/gnus-topic.el"
+;;;;;;  "gnus/gnus-undo.el" "gnus/gnus-util.el" "gnus/gnus-uu.el"
+;;;;;;  "gnus/gnus-vm.el" "gnus/gssapi.el" "gnus/ietf-drums.el" "gnus/legacy-gnus-agent.el"
+;;;;;;  "gnus/mail-parse.el" "gnus/mail-prsvr.el" "gnus/mail-source.el"
+;;;;;;  "gnus/mailcap.el" "gnus/messcompat.el" "gnus/mm-archive.el"
+;;;;;;  "gnus/mm-bodies.el" "gnus/mm-decode.el" "gnus/mm-util.el"
+;;;;;;  "gnus/mm-view.el" "gnus/mml-sec.el" "gnus/mml-smime.el" "gnus/nnagent.el"
+;;;;;;  "gnus/nnbabyl.el" "gnus/nndir.el" "gnus/nndraft.el" "gnus/nneething.el"
+;;;;;;  "gnus/nngateway.el" "gnus/nnheader.el" "gnus/nnimap.el" "gnus/nnir.el"
+;;;;;;  "gnus/nnmail.el" "gnus/nnmaildir.el" "gnus/nnmairix.el" "gnus/nnmbox.el"
+;;;;;;  "gnus/nnmh.el" "gnus/nnnil.el" "gnus/nnoo.el" "gnus/nnregistry.el"
+;;;;;;  "gnus/nnrss.el" "gnus/nnspool.el" "gnus/nntp.el" "gnus/nnvirtual.el"
+;;;;;;  "gnus/nnweb.el" "gnus/registry.el" "gnus/rfc1843.el" "gnus/rfc2045.el"
+;;;;;;  "gnus/rfc2047.el" "gnus/rfc2104.el" "gnus/rfc2231.el" "gnus/rtree.el"
+;;;;;;  "gnus/shr-color.el" "gnus/sieve-manage.el" "gnus/smime.el"
+;;;;;;  "gnus/spam-stat.el" "gnus/spam-wash.el" "hex-util.el" "hfy-cmap.el"
+;;;;;;  "ibuf-ext.el" "international/cp51932.el" "international/eucjp-ms.el"
 ;;;;;;  "international/fontset.el" "international/iso-ascii.el" "international/ja-dic-cnv.el"
 ;;;;;;  "international/ja-dic-utl.el" "international/ogonek.el" "international/uni-bidi.el"
 ;;;;;;  "international/uni-category.el" "international/uni-combining.el"
@@ -33684,14 +33598,13 @@ Zone out, completely.
 ;;;;;;  "international/uni-old-name.el" "international/uni-titlecase.el"
 ;;;;;;  "international/uni-uppercase.el" "json.el" "kermit.el" "language/hanja-util.el"
 ;;;;;;  "language/thai-word.el" "ldefs-boot.el" "loadup.el" "mail/blessmail.el"
-;;;;;;  "mail/mailheader.el" "mail/mailpost.el" "mail/mspools.el"
-;;;;;;  "mail/rfc2368.el" "mail/rfc822.el" "mail/rmail-spam-filter.el"
-;;;;;;  "mail/rmailedit.el" "mail/rmailkwd.el" "mail/rmailmm.el"
-;;;;;;  "mail/rmailmsc.el" "mail/rmailsort.el" "mail/rmailsum.el"
-;;;;;;  "mail/undigest.el" "md4.el" "mh-e/mh-acros.el" "mh-e/mh-alias.el"
-;;;;;;  "mh-e/mh-buffers.el" "mh-e/mh-compat.el" "mh-e/mh-funcs.el"
-;;;;;;  "mh-e/mh-gnus.el" "mh-e/mh-identity.el" "mh-e/mh-inc.el"
-;;;;;;  "mh-e/mh-junk.el" "mh-e/mh-letter.el" "mh-e/mh-limit.el"
+;;;;;;  "mail/mailheader.el" "mail/mspools.el" "mail/rfc2368.el"
+;;;;;;  "mail/rfc822.el" "mail/rmail-spam-filter.el" "mail/rmailedit.el"
+;;;;;;  "mail/rmailkwd.el" "mail/rmailmm.el" "mail/rmailmsc.el" "mail/rmailsort.el"
+;;;;;;  "mail/rmailsum.el" "mail/undigest.el" "md4.el" "mh-e/mh-acros.el"
+;;;;;;  "mh-e/mh-alias.el" "mh-e/mh-buffers.el" "mh-e/mh-compat.el"
+;;;;;;  "mh-e/mh-funcs.el" "mh-e/mh-gnus.el" "mh-e/mh-identity.el"
+;;;;;;  "mh-e/mh-inc.el" "mh-e/mh-junk.el" "mh-e/mh-letter.el" "mh-e/mh-limit.el"
 ;;;;;;  "mh-e/mh-loaddefs.el" "mh-e/mh-mime.el" "mh-e/mh-print.el"
 ;;;;;;  "mh-e/mh-scan.el" "mh-e/mh-search.el" "mh-e/mh-seq.el" "mh-e/mh-show.el"
 ;;;;;;  "mh-e/mh-speed.el" "mh-e/mh-thread.el" "mh-e/mh-tool-bar.el"
@@ -33731,30 +33644,30 @@ Zone out, completely.
 ;;;;;;  "org/org-mew.el" "org/org-mhe.el" "org/org-mks.el" "org/org-mouse.el"
 ;;;;;;  "org/org-pcomplete.el" "org/org-protocol.el" "org/org-rmail.el"
 ;;;;;;  "org/org-special-blocks.el" "org/org-src.el" "org/org-vm.el"
-;;;;;;  "org/org-w3m.el" "org/org-wl.el" "patcomp.el" "play/gamegrid.el"
-;;;;;;  "play/gametree.el" "play/meese.el" "progmodes/ada-prj.el"
-;;;;;;  "progmodes/cc-align.el" "progmodes/cc-awk.el" "progmodes/cc-bytecomp.el"
-;;;;;;  "progmodes/cc-cmds.el" "progmodes/cc-defs.el" "progmodes/cc-fonts.el"
-;;;;;;  "progmodes/cc-langs.el" "progmodes/cc-menus.el" "progmodes/ebnf-abn.el"
-;;;;;;  "progmodes/ebnf-bnf.el" "progmodes/ebnf-dtd.el" "progmodes/ebnf-ebx.el"
-;;;;;;  "progmodes/ebnf-iso.el" "progmodes/ebnf-otz.el" "progmodes/ebnf-yac.el"
-;;;;;;  "progmodes/idlw-complete-structtag.el" "progmodes/idlw-help.el"
-;;;;;;  "progmodes/idlw-toolbar.el" "progmodes/mantemp.el" "progmodes/xscheme.el"
-;;;;;;  "ps-def.el" "ps-mule.el" "ps-samp.el" "saveplace.el" "sb-image.el"
-;;;;;;  "scroll-bar.el" "select.el" "soundex.el" "subdirs.el" "tempo.el"
-;;;;;;  "textmodes/bib-mode.el" "textmodes/makeinfo.el" "textmodes/page-ext.el"
-;;;;;;  "textmodes/refbib.el" "textmodes/refer.el" "textmodes/reftex-auc.el"
-;;;;;;  "textmodes/reftex-dcr.el" "textmodes/reftex-ref.el" "textmodes/reftex-sel.el"
-;;;;;;  "textmodes/reftex-toc.el" "textmodes/texnfo-upd.el" "timezone.el"
-;;;;;;  "tooltip.el" "tree-widget.el" "uniquify.el" "url/url-about.el"
-;;;;;;  "url/url-cookie.el" "url/url-dired.el" "url/url-expand.el"
-;;;;;;  "url/url-ftp.el" "url/url-future.el" "url/url-history.el"
-;;;;;;  "url/url-imap.el" "url/url-methods.el" "url/url-nfs.el" "url/url-proxy.el"
+;;;;;;  "org/org-w3m.el" "org/org-wl.el" "play/gamegrid.el" "play/gametree.el"
+;;;;;;  "play/meese.el" "progmodes/ada-prj.el" "progmodes/cc-align.el"
+;;;;;;  "progmodes/cc-awk.el" "progmodes/cc-bytecomp.el" "progmodes/cc-cmds.el"
+;;;;;;  "progmodes/cc-defs.el" "progmodes/cc-fonts.el" "progmodes/cc-langs.el"
+;;;;;;  "progmodes/cc-menus.el" "progmodes/ebnf-abn.el" "progmodes/ebnf-bnf.el"
+;;;;;;  "progmodes/ebnf-dtd.el" "progmodes/ebnf-ebx.el" "progmodes/ebnf-iso.el"
+;;;;;;  "progmodes/ebnf-otz.el" "progmodes/ebnf-yac.el" "progmodes/idlw-complete-structtag.el"
+;;;;;;  "progmodes/idlw-help.el" "progmodes/idlw-toolbar.el" "progmodes/mantemp.el"
+;;;;;;  "progmodes/xscheme.el" "ps-def.el" "ps-mule.el" "ps-samp.el"
+;;;;;;  "saveplace.el" "sb-image.el" "scroll-bar.el" "select.el"
+;;;;;;  "soundex.el" "subdirs.el" "tempo.el" "textmodes/bib-mode.el"
+;;;;;;  "textmodes/makeinfo.el" "textmodes/page-ext.el" "textmodes/refbib.el"
+;;;;;;  "textmodes/refer.el" "textmodes/reftex-auc.el" "textmodes/reftex-dcr.el"
+;;;;;;  "textmodes/reftex-ref.el" "textmodes/reftex-sel.el" "textmodes/reftex-toc.el"
+;;;;;;  "textmodes/texnfo-upd.el" "timezone.el" "tooltip.el" "tree-widget.el"
+;;;;;;  "uniquify.el" "url/url-about.el" "url/url-cookie.el" "url/url-dired.el"
+;;;;;;  "url/url-domsuf.el" "url/url-expand.el" "url/url-ftp.el"
+;;;;;;  "url/url-future.el" "url/url-history.el" "url/url-imap.el"
+;;;;;;  "url/url-methods.el" "url/url-nfs.el" "url/url-proxy.el"
 ;;;;;;  "url/url-vars.el" "vc/ediff-diff.el" "vc/ediff-init.el" "vc/ediff-merg.el"
 ;;;;;;  "vc/ediff-ptch.el" "vc/ediff-vers.el" "vc/ediff-wind.el"
 ;;;;;;  "vc/pcvs-info.el" "vc/pcvs-parse.el" "vc/pcvs-util.el" "vc/vc-dav.el"
 ;;;;;;  "vcursor.el" "vt-control.el" "vt100-led.el" "w32-fns.el"
-;;;;;;  "w32-vars.el" "x-dnd.el") (20436 19807 651595))
+;;;;;;  "w32-vars.el" "x-dnd.el") (20464 9462 647923 919000))
 
 ;;;***
 \f
index d747eb13b799747039a42dec46a3639a2c27bc85..88aa9f53b75015b6753190b535443f1133e2336d 100644 (file)
@@ -29,8 +29,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defun feature-symbols (feature)
   "Return the file and list of definitions associated with FEATURE.
 The value is actually the element of `load-history'
@@ -143,13 +141,13 @@ These are symbols with hooklike values whose names don't end in
 `-hook' or `-hooks', from which `unload-feature' should try to remove
 pertinent symbols.")
 
+(define-obsolete-variable-alias 'unload-hook-features-list
+    'unload-function-defs-list "22.2")
 (defvar unload-function-defs-list nil
   "List of definitions in the Lisp library being unloaded.
 
 This is meant to be used by `FEATURE-unload-function'; see the
 documentation of `unload-feature' for details.")
-(define-obsolete-variable-alias 'unload-hook-features-list
-    'unload-function-defs-list "22.2")
 
 (defun unload--set-major-mode ()
   (save-current-buffer
@@ -254,11 +252,11 @@ something strange, such as redefining an Emacs function."
 
       (dolist (x unload-function-defs-list)
        (if (consp x)
-           (case (car x)
+           (pcase (car x)
              ;; Remove any feature names that this file provided.
-             (provide
+             (`provide
               (setq features (delq (cdr x) features)))
-             ((defun autoload)
+             ((or `defun `autoload)
               (let ((fun (cdr x)))
                 (when (fboundp fun)
                   (when (fboundp 'ad-unadvise)
@@ -270,9 +268,9 @@ something strange, such as redefining an Emacs function."
              ;; (t . SYMBOL) comes before (defun . SYMBOL)
              ;; and says we should restore SYMBOL's autoload
              ;; when we undefine it.
-             ((t) (setq restore-autoload (cdr x)))
-             ((require defface) nil)
-             (t (message "Unexpected element %s in load-history" x)))
+             (`t (setq restore-autoload (cdr x)))
+             ((or `require `defface) nil)
+             (_ (message "Unexpected element %s in load-history" x)))
          ;; Kill local values as much as possible.
          (dolist (buf (buffer-list))
            (with-current-buffer buf
index b7af41d6246f1d6f3c7d53efb46e4cb4d1ca8342..a460fcab339bb21b74286120a73854f04d551dbc 100644 (file)
 
 ;; Add subdirectories to the load-path for files that might get
 ;; autoloaded when bootstrapping.
+;; This is because PATH_DUMPLOADSEARCH is just "../lisp".
+;; Note that we reset load-path below just before dumping,
+;; since lread.c:init_lread checks for changes to load-path
+;; in deciding whether to modify it.
 (if (or (equal (nth 3 command-line-args) "bootstrap")
        (equal (nth 4 command-line-args) "bootstrap")
        (equal (nth 3 command-line-args) "unidata-gen.el")
@@ -61,7 +65,7 @@
 
 (if (eq t purify-flag)
     ;; Hash consing saved around 11% of pure space in my tests.
-    (setq purify-flag (make-hash-table :test 'equal)))
+    (setq purify-flag (make-hash-table :test 'equal :size 70000)))
 
 (message "Using load-path %s" load-path)
 
 ;; implemented in subr.el.
 (add-hook 'after-load-functions (lambda (f) (garbage-collect)))
 
-;; We specify .el in case someone compiled version.el by mistake.
-(load "version.el")
+(load "version")
 
 (load "widget")
 (load "custom")
 (load "emacs-lisp/map-ynp")
-(load "cus-start")
 (load "international/mule")
 (load "international/mule-conf")
 (load "env")
 (load "format")
 (load "bindings")
+(load "cus-start")
 (load "window")  ; Needed here for `replace-buffer-in-windows'.
 (setq load-source-file-function 'load-with-code-conversion)
 (load "files")
 (load "button")
 (load "startup")
 
+;; We don't want to store loaddefs.el in the repository because it is
+;; a generated file; but it is required in order to compile the lisp files.
+;; When bootstrapping, we cannot generate loaddefs.el until an
+;; emacs binary has been built.  We therefore compromise and keep
+;; ldefs-boot.el in the repository.  This does not need to be updated
+;; as often as the real loaddefs.el would.  Bootstrap should always
+;; work with ldefs-boot.el.  Therefore, Whenever a new autoload cookie
+;; gets added that is necessary during bootstrapping, ldefs-boot.el
+;; should be updated by overwriting it with an up-to-date copy of
+;; loaddefs.el that is uncorrupted by local changes.
+;; autogen/update_autogen can be used to periodically update ldefs-boot.
 (condition-case nil
     ;; Don't get confused if someone compiled this by mistake.
     (load "loaddefs.el")
 (load "rfn-eshadow")
 
 (load "menu-bar")
-(load "paths.el")  ;Don't get confused if someone compiled paths by mistake.
 (load "emacs-lisp/lisp")
 (load "textmodes/page")
 (load "register")
 (load "emacs-lisp/lisp-mode")
 (load "textmodes/text-mode")
 (load "textmodes/fill")
+(load "newcomment")
 
 (load "replace")
+(load "emacs-lisp/tabulated-list")
 (load "buff-menu")
 
 (if (fboundp 'x-create-frame)
     (progn
       (load "fringe")
+      ;; Needed by `imagemagick-register-types'
+      (load "emacs-lisp/regexp-opt")
       (load "image")
       (load "international/fontset")
       (load "dnd")
 ;For other systems, you must edit ../src/Makefile.in.
 (load "site-load" t)
 
+;; ¡¡¡ Big Ugly Hack !!!
+;; src/bootstrap-emacs is mostly used to compile .el files, so it needs
+;; macroexp, bytecomp, cconv, and byte-opt to be fast.  Generally this is done
+;; by compiling those files first, but this only makes a difference if those
+;; files are not preloaded.  As it so happens, macroexp.el tends to be
+;; accidentally preloaded in src/bootstrap-emacs because cl.el and cl-macs.el
+;; require it.  So let's unload it here, if needed, to make sure the
+;; byte-compiled version is used.
+(if (or (not (fboundp 'macroexpand-all))
+        (byte-code-function-p (symbol-function 'macroexpand-all)))
+    nil
+  (fmakunbound 'macroexpand-all)
+  (setq features (delq 'macroexp features))
+  (autoload 'macroexpand-all "macroexp"))
+
 ;; Determine which last version number to use
 ;; based on the executables that now exist.
 (if (and (or (equal (nth 3 command-line-args) "dump")
           (versions (mapcar (function (lambda (name)
                                         (string-to-number (substring name (length base)))))
                             files)))
+      (setq emacs-bzr-version (condition-case nil (emacs-bzr-get-version)
+                              (error nil)))
       ;; `emacs-version' is a constant, so we shouldn't change it with `setq'.
       (defconst emacs-version
        (format "%s.%d"
 ;; At this point, we're ready to resume undo recording for scratch.
 (buffer-enable-undo "*scratch*")
 
+(when (hash-table-p purify-flag)
+  (let ((strings 0)
+        (vectors 0)
+        (bytecodes 0)
+        (conses 0)
+        (others 0))
+    (maphash (lambda (k v)
+               (cond
+                ((stringp k) (setq strings (1+ strings)))
+                ((vectorp k) (setq vectors (1+ vectors)))
+                ((consp k)   (setq conses  (1+ conses)))
+                ((byte-code-function-p v) (setq bytecodes (1+ bytecodes)))
+                (t           (setq others  (1+ others)))))
+             purify-flag)
+    (message "Pure-hashed: %d strings, %d vectors, %d conses, %d bytecodes, %d others"
+             strings vectors conses bytecodes others)))
+
 ;; Avoid error if user loads some more libraries now and make sure the
 ;; hash-consing hash table is GC'd.
 (setq purify-flag nil)
 (if (or (member (nth 3 command-line-args) '("dump" "bootstrap"))
        (member (nth 4 command-line-args) '("dump" "bootstrap")))
     (progn
-      (if (memq system-type '(ms-dos windows-nt cygwin))
-          (message "Dumping under the name emacs")
-        (message "Dumping under the name emacs"))
+      (message "Dumping under the name emacs")
       (condition-case ()
          (delete-file "emacs")
        (file-error nil))
index 65295a7f86051d77f0516a7b9d5fd7ebc5f4f60a..b31d19b624f793e9979663c6b9700c33212946ed 100644 (file)
@@ -29,8 +29,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 ;;;###autoload
 (defvar lpr-windows-system
   (memq system-type '(ms-dos windows-nt))
@@ -281,10 +279,10 @@ for further customization of the printer command."
           (if (markerp end)
               (set-marker end nil))
           (message "Spooling%s...done%s%s" switch-string
-                   (case (count-lines (point-min) (point-max))
+                   (pcase (count-lines (point-min) (point-max))
                      (0 "")
                      (1 ": ")
-                     (t ":\n"))
+                     (_ ":\n"))
                    (buffer-string)))))))
 
 ;; This function copies the text between start and end
index dd76ce90809ee25837f4f55acd23d489603fd136..40ea8fa4a825dba8cdc934ff8160a5c2363c1778 100644 (file)
   :group 'news)
 
 (defcustom binhex-decoder-program "hexbin"
-  "*Non-nil value should be a string that names a binhex decoder.
+  "Non-nil value should be a string that names a binhex decoder.
 The program should expect to read binhex data on its standard
 input and write the converted data to its standard output."
   :type 'string
   :group 'binhex)
 
 (defcustom binhex-decoder-switches '("-d")
-  "*List of command line flags passed to the command `binhex-decoder-program'."
+  "List of command line flags passed to the command `binhex-decoder-program'."
   :group 'binhex
   :type '(repeat string))
 
 (defcustom binhex-use-external
   (executable-find binhex-decoder-program)
-  "*Use external binhex program."
+  "Use external binhex program."
   :version "22.1"
   :group 'binhex
   :type 'boolean)
index 1a02ae7c5193c90563524a0eaa1b6ce926f736e9..94c223556d1bbd8a44e7f4760214e7dcfa922f8a 100644 (file)
@@ -239,6 +239,8 @@ usually do not have translators for other languages.\n\n")))
     (add-text-properties (1+ user-point) (point) prompt-properties)
 
     (insert "\n\nIn " (emacs-version) "\n")
+    (if (stringp emacs-bzr-version)
+       (insert "Bzr revision: " emacs-bzr-version "\n"))
     (if (fboundp 'x-server-vendor)
        (condition-case nil
             ;; This is used not only for X11 but also W32 and others.
@@ -254,8 +256,10 @@ usually do not have translators for other languages.\n\n")))
     (insert "Important settings:\n")
     (mapc
      (lambda (var)
-       (insert (format "  value of $%s: %s\n" var (getenv var))))
-     '("LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES"
+       (let ((val (getenv var)))
+        (if val (insert (format "  value of $%s: %s\n" var val)))))
+     '("EMACSDATA" "EMACSDOC" "EMACSLOADPATH" "EMACSPATH"
+       "LC_ALL" "LC_COLLATE" "LC_CTYPE" "LC_MESSAGES"
        "LC_MONETARY" "LC_NUMERIC" "LC_TIME" "LANG" "XMODIFIERS"))
     (insert (format "  locale-coding-system: %s\n" locale-coding-system))
     (insert (format "  default enable-multibyte-characters: %s\n"
@@ -314,7 +318,7 @@ usually do not have translators for other languages.\n\n")))
     (fill-region (line-beginning-position 0) (point))
     ;; This is so the user has to type something in order to send easily.
     (use-local-map (nconc (make-sparse-keymap) (current-local-map)))
-    (define-key (current-local-map) "\C-c\C-i" 'report-emacs-bug-info)
+    (define-key (current-local-map) "\C-c\C-i" 'info-emacs-bug)
     (if can-insert-mail
        (define-key (current-local-map) "\C-cm"
          'report-emacs-bug-insert-to-mailer))
@@ -337,7 +341,7 @@ usually do not have translators for other languages.\n\n")))
                    "  Type \\[report-emacs-bug-insert-to-mailer] to copy text to your preferred mail program.\n")))
        (terpri)
        (princ (substitute-command-keys
-               "  Type \\[report-emacs-bug-info] to visit in Info the Emacs Manual section
+               "  Type \\[info-emacs-bug] to visit in Info the Emacs Manual section
     about when and how to write a bug report, and what
     information you should include to help fix the bug.")))
       (shrink-window-if-larger-than-buffer (get-buffer-window "*Bug Help*")))
@@ -351,10 +355,7 @@ usually do not have translators for other languages.\n\n")))
           (buffer-substring-no-properties (point-min) (point)))
     (goto-char user-point)))
 
-(defun report-emacs-bug-info ()
-  "Go to the Info node on reporting Emacs bugs."
-  (interactive)
-  (info "(emacs)Bugs"))
+(define-obsolete-function-alias 'report-emacs-bug-info 'info-emacs-bug "24.2")
 
 ;; It's the default mail mode, so it seems OK to use its features.
 (autoload 'message-bogus-recipient-p "message")
index 039f3dca4a23c701539710d21c7cc4cb2546255a..c6d1d2287809f5d4eb9c14ef6206e52e9f0e0d9e 100644 (file)
 (require 'mail-utils)               ; pick up mail-strip-quoted-names
 
 (eval-when-compile
-  (require 'smtpmail)
-  (require 'cl))
+  (require 'smtpmail))
 
 (autoload 'mail-do-fcc "sendmail")
 
@@ -1340,7 +1339,7 @@ Example 'defadvice' for mail-send:
 
 
 (defvar feedmail-queue-runner-is-active nil
-  "*Non-nil means we're inside the logic of the queue-running loop.
+  "Non-nil means we're inside the logic of the queue-running loop.
 That is, iterating over all messages in the queue to send them.  In
 that case, the value is the name of the queued message file currently
 being processed.  This can be used for differentiating customized code
@@ -1366,17 +1365,19 @@ call to `feedmail-run-the-queue'."
   (feedmail-say-debug ">in-> feedmail-mail-send-hook-splitter %s" feedmail-queue-runner-is-active)
   (if feedmail-queue-runner-is-active
       (run-hooks 'feedmail-mail-send-hook-queued)
-    (run-hooks 'feedmail-mail-send-hook))
-  )
-
-
-(defvar feedmail-mail-send-hook nil
-  "*See documentation for `feedmail-mail-send-hook-splitter'.")
+    (run-hooks 'feedmail-mail-send-hook)))
 
+(defcustom feedmail-mail-send-hook nil
+  "Hook run by `feedmail-mail-send-hook-splitter' for immediate mail.
+See documentation of `feedmail-mail-send-hook-splitter' for details."
+  :type 'hook
+  :group 'feedmail)
 
-(defvar feedmail-mail-send-hook-queued nil
-  "*See documentation for `feedmail-mail-send-hook-splitter'.")
-
+(defcustom feedmail-mail-send-hook-queued nil
+  "Hook run by `feedmail-mail-send-hook-splitter' for queued mail.
+See documentation of `feedmail-mail-send-hook-splitter' for details."
+  :type 'hook
+  :group 'feedmail)
 
 (defun feedmail-confirm-addresses-hook-example ()
   "An example of a `feedmail-last-chance-hook'.
@@ -1387,9 +1388,7 @@ It shows the simple addresses and gets a confirmation.  Use as:
     (erase-buffer)
     (insert (mapconcat 'identity feedmail-address-list " "))
     (if (not (y-or-n-p "How do you like them apples? "))
-       (error "FQM: Sending...gave up in last chance hook")
-      )))
-
+       (error "FQM: Sending...gave up in last chance hook"))))
 
 (defcustom feedmail-last-chance-hook nil
   "User's last opportunity to modify the message on its way out.
@@ -1514,7 +1513,7 @@ function, for example, to archive all of your sent messages someplace
 
 
 (defvar feedmail-is-a-resend nil
-  "*Non-nil means the message is a Resend (in the RFC-822 sense).
+  "Non-nil means the message is a Resend (in the RFC-822 sense).
 This affects the composition of certain headers.  feedmail sets this
 variable as soon as it starts prepping the message text buffer, so any
 user-supplied functions can rely on it.  Users shouldn't set or change this
@@ -1586,7 +1585,7 @@ messages to make sure it works as expected."
 
 
 ;; feedmail-buffer-to-binmail, feedmail-buffer-to-sendmail, and
-;; feedmail-buffer-to-smptmail are the only things provided for values
+;; feedmail-buffer-to-smtpmail are the only things provided for values
 ;; for the variable feedmail-buffer-eating-function.  It's pretty easy
 ;; to write your own, though.
 (defun feedmail-buffer-to-binmail (prepped errors-to addr-listoid)
@@ -1951,9 +1950,6 @@ bail out with an appropriate answer to the global confirmation prompt."
   (feedmail-say-debug ">in-> feedmail-run-the-queue-global-prompts")
   (let ((feedmail-queue-runner-confirm-global t)) (feedmail-run-the-queue arg)))
 
-;; letf fools the byte-compiler.
-(defvar file-name-buffer-file-type-alist)
-
 ;;;###autoload
 (defun feedmail-run-the-queue (&optional arg)
   "Visit each message in the feedmail queue directory and send it out.
@@ -2027,12 +2023,6 @@ backup file names and the like)."
              (if (looking-at ".*\r\n.*\r\n")
                  (while (search-forward "\r\n" nil t)
                    (replace-match "\n" nil t)))
-;;                ;; work around text-vs-binary weirdness
-;;                ;; if we don't find the normal M-H-S, try reading the file a different way
-;;                (if (not (feedmail-find-eoh t))
-;;                        (let ((file-name-buffer-file-type-alist nil) (default-buffer-file-type nil))
-;;                              (erase-buffer)
-;;                              (insert-file-contents maybe-file)))
              (funcall feedmail-queue-runner-mode-setter arg)
              (condition-case signal-stuff ; don't give up the loop if user skips some
                  (let ((feedmail-enable-queue nil)
@@ -2398,8 +2388,10 @@ mapped to mostly alphanumerics for safety."
 (defun feedmail-send-it-immediately ()
   "Handle immediate sending, including during a queue run."
   (feedmail-say-debug ">in-> feedmail-send-it-immediately")
-  (let ((feedmail-error-buffer (get-buffer-create " *FQM Outgoing Email Errors*"))
-       (feedmail-prepped-text-buffer (get-buffer-create " *FQM Outgoing Email Text*"))
+  (let ((feedmail-error-buffer
+         (get-buffer-create " *FQM Outgoing Email Errors*"))
+       (feedmail-prepped-text-buffer
+         (get-buffer-create " *FQM Outgoing Email Text*"))
        (feedmail-raw-text-buffer (current-buffer))
        (feedmail-address-list)
        (eoh-marker)
@@ -2411,7 +2403,7 @@ mapped to mostly alphanumerics for safety."
        (a-re-dtcb  "^\\(To\\|Cc\\|Bcc\\):")
        (a-re-dtc   "^\\(To\\|Cc\\):")
        (a-re-db    "^Bcc:")
-       ;; to get a temporary changeable copy
+       ;; To get a temporary changeable copy.
        (mail-header-separator mail-header-separator)
        )
     (unwind-protect
@@ -2419,10 +2411,10 @@ mapped to mostly alphanumerics for safety."
          (set-buffer feedmail-error-buffer) (erase-buffer)
          (set-buffer feedmail-prepped-text-buffer) (erase-buffer)
 
-         ;; jam contents of user-supplied mail buffer into our scratch buffer
+         ;; Jam contents of user-supplied mail buffer into our scratch buffer.
          (insert-buffer-substring feedmail-raw-text-buffer)
 
-         ;; require one newline at the end.
+         ;; Require one newline at the end.
          (goto-char (point-max))
          (or (= (preceding-char) ?\n) (insert ?\n))
 
@@ -2443,54 +2435,69 @@ mapped to mostly alphanumerics for safety."
                  (and (fboundp 'expand-mail-aliases) mail-aliases))
              (expand-mail-aliases (point-min) eoh-marker))
 
-         ;; make it pretty
+         ;; Make it pretty.
          (if feedmail-fill-to-cc (feedmail-fill-to-cc-function eoh-marker))
-         ;; ignore any blank lines in the header
+         ;; Ignore any blank lines in the header.
          (goto-char (point-min))
-         (while (and (re-search-forward "\n\n\n*" eoh-marker t) (< (point) eoh-marker))
+         (while (and (re-search-forward "\n\n\n*" eoh-marker t)
+                      (< (point) eoh-marker))
            (replace-match "\n"))
 
          (let ((case-fold-search t) (addr-regexp))
            (goto-char (point-min))
-           ;; there are some RFC-822 combinations/cases missed here,
-           ;; but probably good enough and what users expect
+           ;; There are some RFC-822 combinations/cases missed here,
+           ;; but probably good enough and what users expect.
            ;;
-           ;; use resent-* stuff only if there is at least one non-empty one
+           ;; Use resent-* stuff only if there is at least one non-empty one.
            (setq feedmail-is-a-resend
                  (re-search-forward
-                  ;; header name, followed by optional whitespace, followed by
-                  ;; non-whitespace, followed by anything, followed by newline;
-                  ;; the idea is empty Resent-* headers are ignored
+                  ;; Header name, followed by optional whitespace, followed by
+                  ;; non-whitespace, followed by anything, followed by
+                   ;; newline; the idea is empty Resent-* headers are ignored.
                   "^\\(Resent-To:\\|Resent-Cc:\\|Resent-Bcc:\\)\\s-*\\S-+.*$"
                   eoh-marker t))
-           ;; if we say so, gather the Bcc stuff before the main course
-           (if (eq feedmail-deduce-bcc-where 'first)
-               (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db))
-                      (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
-           ;; the main course
-           (if (or (eq feedmail-deduce-bcc-where 'first) (eq feedmail-deduce-bcc-where 'last))
-               ;; handled by first or last cases, so don't get Bcc stuff
-               (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtc) (setq addr-regexp a-re-dtc))
-                      (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list)))
-             ;; not handled by first or last cases, so also get Bcc stuff
-             (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rtcb) (setq addr-regexp a-re-dtcb))
-                    (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
-           ;; if we say so, gather the Bcc stuff after the main course
-           (if (eq feedmail-deduce-bcc-where 'last)
-               (progn (if feedmail-is-a-resend (setq addr-regexp a-re-rb) (setq addr-regexp a-re-db))
-                      (setq feedmail-address-list (feedmail-deduce-address-list feedmail-prepped-text-buffer (point-min) eoh-marker addr-regexp feedmail-address-list))))
-           (if (not feedmail-address-list) (error "FQM: Sending...abandoned, no addressees"))
-           ;; not needed, but meets user expectations
+           ;; If we say so, gather the Bcc stuff before the main course.
+           (when (eq feedmail-deduce-bcc-where 'first)
+              (setq addr-regexp (if feedmail-is-a-resend a-re-rb a-re-db))
+              (setq feedmail-address-list
+                    (feedmail-deduce-address-list
+                     feedmail-prepped-text-buffer (point-min) eoh-marker
+                     addr-regexp feedmail-address-list)))
+           ;; The main course.
+            (setq addr-regexp
+                  (if (memq feedmail-deduce-bcc-where '(first last))
+                      ;; Handled by first or last cases, so don't get
+                      ;; Bcc stuff.
+                      (if feedmail-is-a-resend a-re-rtc a-re-dtc)
+                    ;; Not handled by first or last cases, so also get
+                    ;; Bcc stuff.
+                    (if feedmail-is-a-resend a-re-rtcb a-re-dtcb)))
+            (setq feedmail-address-list
+                  (feedmail-deduce-address-list
+                   feedmail-prepped-text-buffer (point-min) eoh-marker
+                   addr-regexp feedmail-address-list))
+           ;; If we say so, gather the Bcc stuff after the main course.
+           (when (eq feedmail-deduce-bcc-where 'last)
+              (setq addr-regexp (if feedmail-is-a-resend a-re-rb a-re-db))
+              (setq feedmail-address-list
+                    (feedmail-deduce-address-list
+                     feedmail-prepped-text-buffer (point-min) eoh-marker
+                     addr-regexp feedmail-address-list)))
+           (if (not feedmail-address-list)
+                (error "FQM: Sending...abandoned, no addressees"))
+           ;; Not needed, but meets user expectations.
            (setq feedmail-address-list (nreverse feedmail-address-list))
            ;; Find and handle any Bcc fields.
-           (setq bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^Bcc:"))
-           (setq resent-bcc-holder (feedmail-accume-n-nuke-header eoh-marker "^Resent-Bcc:"))
-           (if (and bcc-holder (not feedmail-nuke-bcc))
-               (progn (goto-char (point-min))
-                      (insert bcc-holder)))
-           (if (and resent-bcc-holder (not feedmail-nuke-resent-bcc))
-               (progn (goto-char (point-min))
-                      (insert resent-bcc-holder)))
+           (setq bcc-holder
+                  (feedmail-accume-n-nuke-header eoh-marker "^Bcc:"))
+           (setq resent-bcc-holder
+                  (feedmail-accume-n-nuke-header eoh-marker "^Resent-Bcc:"))
+           (when (and bcc-holder (not feedmail-nuke-bcc))
+              (goto-char (point-min))
+              (insert bcc-holder))
+           (when (and resent-bcc-holder (not feedmail-nuke-resent-bcc))
+              (goto-char (point-min))
+              (insert resent-bcc-holder))
            (goto-char (point-min))
 
            ;; fiddle about, fiddle about, fiddle about....
@@ -2498,16 +2505,20 @@ mapped to mostly alphanumerics for safety."
            (feedmail-fiddle-sender)
            (feedmail-fiddle-x-mailer)
            (feedmail-fiddle-message-id
-            (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer)))
+            (or feedmail-queue-runner-is-active
+                 (buffer-file-name feedmail-raw-text-buffer)))
            (feedmail-fiddle-date
-            (or feedmail-queue-runner-is-active (buffer-file-name feedmail-raw-text-buffer)))
-           (feedmail-fiddle-list-of-fiddle-plexes feedmail-fiddle-plex-user-list)
+            (or feedmail-queue-runner-is-active
+                 (buffer-file-name feedmail-raw-text-buffer)))
+           (feedmail-fiddle-list-of-fiddle-plexes
+             feedmail-fiddle-plex-user-list)
 
            ;; don't send out a blank headers of various sorts
            ;; (this loses on continued line with a blank first line)
            (goto-char (point-min))
            (and feedmail-nuke-empty-headers ; hey, who's an empty-header?
-                (while (re-search-forward "^[A-Za-z0-9-]+:[ \t]*\n" eoh-marker t)
+                (while (re-search-forward "^[A-Za-z0-9-]+:[ \t]*\n"
+                                           eoh-marker t)
                   (replace-match ""))))
 
          (feedmail-say-debug "last chance hook: %s" feedmail-last-chance-hook)
@@ -2519,79 +2530,90 @@ mapped to mostly alphanumerics for safety."
                (confirm (cond
                          ((eq feedmail-confirm-outgoing 'immediate)
                           (not feedmail-queue-runner-is-active))
-                         ((eq feedmail-confirm-outgoing 'queued) feedmail-queue-runner-is-active)
+                         ((eq feedmail-confirm-outgoing 'queued)
+                           feedmail-queue-runner-is-active)
                          (t feedmail-confirm-outgoing)))
                (fullframe (cond
                            ((eq feedmail-display-full-frame 'immediate)
                             (not feedmail-queue-runner-is-active))
-                           ((eq feedmail-display-full-frame 'queued) feedmail-queue-runner-is-active)
+                           ((eq feedmail-display-full-frame 'queued)
+                             feedmail-queue-runner-is-active)
                            (t feedmail-display-full-frame))))
            (if fullframe
                (progn
                  (switch-to-buffer feedmail-prepped-text-buffer t)
                  (delete-other-windows)))
-           (if (or (not confirm) (feedmail-one-last-look feedmail-prepped-text-buffer))
-               (let ((user-mail-address (feedmail-envelope-deducer eoh-marker)))
+           (if (or (not confirm)
+                    (feedmail-one-last-look feedmail-prepped-text-buffer))
+               (let ((user-mail-address
+                       (feedmail-envelope-deducer eoh-marker)))
                  (feedmail-say-debug "give it to buffer-eater")
                  (feedmail-give-it-to-buffer-eater)
                  (feedmail-say-debug "gave it to buffer-eater")
-                 (if (and (not feedmail-queue-runner-is-active) (setq also-file (buffer-file-name feedmail-raw-text-buffer)))
-                     (progn            ; if a file but not running the queue, offer to delete it
+                 (if (and (not feedmail-queue-runner-is-active)
+                           (setq also-file
+                                 (buffer-file-name feedmail-raw-text-buffer)))
+                     (progn
+                        ;; If a file but not running the queue,
+                        ;; offer to delete it
                        (setq also-file (expand-file-name also-file))
                        (when (or feedmail-queue-auto-file-nuke
                                   (y-or-n-p
                                    (format "FQM: Delete message file %s? "
                                            also-file)))
-                          ;; if we delete the affiliated file, get rid
+                          ;; If we delete the affiliated file, get rid
                           ;; of the file name association and make sure we
-                          ;; don't annoy people with a prompt on exit
+                          ;; don't annoy people with a prompt on exit.
                           (delete-file also-file)
                           (with-current-buffer feedmail-raw-text-buffer
                             (setq buffer-offer-save nil)
                             (setq buffer-file-name nil)))))
                  (goto-char (point-min))
-                 ;; re-insert and handle any Fcc fields (and, optionally, any Bcc).
-                 (if fcc (letf (((default-value 'buffer-file-type)
-                                  feedmail-force-binary-write))
-                           (insert fcc)
-                           (if (not feedmail-nuke-bcc-in-fcc)
-                               (progn (if bcc-holder (insert bcc-holder))
-                                      (if resent-bcc-holder (insert resent-bcc-holder))))
-
-                           (run-hooks 'feedmail-before-fcc-hook)
-
-                           (if feedmail-nuke-body-in-fcc
-                               (progn (goto-char eoh-marker)
-                                      (if (natnump feedmail-nuke-body-in-fcc)
-                                          (forward-line feedmail-nuke-body-in-fcc))
-                                      (delete-region (point) (point-max))
-                                      ))
-                           (mail-do-fcc eoh-marker)
-                           )))
-             ;; user bailed out of one-last-look
+                 ;; Re-insert and handle any Fcc fields (and, optionally,
+                  ;; any Bcc).
+                 (when fcc
+                    (let ((old (default-value 'buffer-file-type)))
+                      (unwind-protect
+                          (progn
+                            (setq-default buffer-file-type 
+                                          feedmail-force-binary-write)
+                            (insert fcc)
+                            (unless feedmail-nuke-bcc-in-fcc
+                              (if bcc-holder (insert bcc-holder))
+                              (if resent-bcc-holder
+                                  (insert resent-bcc-holder)))
+                          
+                            (run-hooks 'feedmail-before-fcc-hook)
+                          
+                            (when feedmail-nuke-body-in-fcc
+                              (goto-char eoh-marker)
+                              (if (natnump feedmail-nuke-body-in-fcc)
+                                  (forward-line feedmail-nuke-body-in-fcc))
+                              (delete-region (point) (point-max)))
+                            (mail-do-fcc eoh-marker))
+                        (setq-default buffer-file-type old)))))
+             ;; User bailed out of one-last-look.
              (if feedmail-queue-runner-is-active
                  (throw 'skip-me-q 'skip-me-q)
                (throw 'skip-me-i 'skip-me-i))
              )))) ; unwind-protect body (save-excursion)
 
-      ;; unwind-protect cleanup forms
+      ;; unwind-protect cleanup forms.
       (kill-buffer feedmail-prepped-text-buffer)
       (set-buffer feedmail-error-buffer)
       (if (zerop (buffer-size)) (kill-buffer feedmail-error-buffer)
-       (progn (display-buffer feedmail-error-buffer)
-              ;; read fast ... the meter is running
-              (if feedmail-queue-runner-is-active
-                  (progn
-                    (ding t)
-                    (feedmail-say-chatter "Sending...failed")))
-              (error "FQM: Sending...failed")))
+        (display-buffer feedmail-error-buffer)
+        ;; Read fast ... the meter is running.
+        (if feedmail-queue-runner-is-active
+            (progn
+              (ding t)
+              (feedmail-say-chatter "Sending...failed")))
+        (error "FQM: Sending...failed"))
       (set-buffer feedmail-raw-text-buffer))
     )                                  ; let
-  (if (and feedmail-queue-chatty (not feedmail-queue-runner-is-active))
-      (progn
-       (feedmail-queue-reminder 'after-immediate)
-       (sit-for feedmail-queue-chatty-sit-for)))
-  )
+  (when (and feedmail-queue-chatty (not feedmail-queue-runner-is-active))
+    (feedmail-queue-reminder 'after-immediate)
+    (sit-for feedmail-queue-chatty-sit-for)))
 
 
 (defun feedmail-fiddle-header (name value &optional action folding)
index 05949d0eccfd39cb9ccc2807c81f55bb8822daef..e342e0ae97790165778e2022f2c7f52449548d6f 100644 (file)
@@ -35,9 +35,8 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl)
-  (defvar filladapt-token-table))
+(eval-when-compile (require 'cl-lib))
+(defvar filladapt-token-table)
 
 (defgroup footnote nil
   "Support for footnotes in mail and news messages."
@@ -126,10 +125,12 @@ has no effect on buffers already displaying footnotes."
   :type 'string
   :group 'footnote)
 
-(defvar footnote-signature-separator (if (boundp 'message-signature-separator)
-                                        message-signature-separator
-                                      "^-- $")
-  "*String used to recognize .signatures.")
+(defcustom footnote-signature-separator (if (boundp 'message-signature-separator)
+                                           message-signature-separator
+                                         "^-- $")
+  "Regexp used by Footnote mode to recognize signatures."
+  :type 'regexp
+  :group 'footnote)
 
 ;;; Private variables
 
@@ -642,12 +643,12 @@ If the variable `footnote-narrow-to-footnotes-when-editing' is set,
 the buffer is narrowed to the footnote body.  The restriction is removed
 by using `Footnote-back-to-message'."
   (interactive "*P")
-  (let (num)
-    (if footnote-text-marker-alist
-       (if (< (point) (cadar (last footnote-pointer-marker-alist)))
-           (setq num (Footnote-make-hole))
-         (setq num (1+ (caar (last footnote-text-marker-alist)))))
-      (setq num 1))
+  (let ((num
+         (if footnote-text-marker-alist
+             (if (< (point) (cl-cadar (last footnote-pointer-marker-alist)))
+                 (Footnote-make-hole)
+               (1+ (caar (last footnote-text-marker-alist))))
+           1)))
     (message "Adding footnote %d" num)
     (Footnote-insert-footnote num)
     (insert-before-markers (make-string footnote-body-tag-spacing ? ))
index 279b5f7b4603f63069272717a5d3e8c5aa6e7f47..fd8d2633818e01ad0e665d05d10431975d479032 100644 (file)
   :group 'mail)
 
 (defcustom hashcash-default-payment 20
-  "*The default number of bits to pay to unknown users.
+  "The default number of bits to pay to unknown users.
 If this is zero, no payment header will be generated.
 See `hashcash-payment-alist'."
   :type 'integer
   :group 'hashcash)
 
 (defcustom hashcash-payment-alist '()
-  "*An association list mapping email addresses to payment amounts.
+  "An association list mapping email addresses to payment amounts.
 Elements may consist of (ADDR AMOUNT) or (ADDR STRING AMOUNT), where
 ADDR is the email address of the intended recipient and AMOUNT is
 the value of hashcash payment to be made to that user.  STRING, if
@@ -80,33 +80,33 @@ present, is the string to be hashed; if not present ADDR will be used."
   :group 'hashcash)
 
 (defcustom hashcash-default-accept-payment 20
-  "*The default minimum number of bits to accept on incoming payments."
+  "The default minimum number of bits to accept on incoming payments."
   :type 'integer
   :group 'hashcash)
 
 (defcustom hashcash-accept-resources `((,user-mail-address nil))
-  "*An association list mapping hashcash resources to payment amounts.
+  "An association list mapping hashcash resources to payment amounts.
 Resources named here are to be accepted in incoming payments.  If the
 corresponding AMOUNT is NIL, the value of `hashcash-default-accept-payment'
 is used instead."
   :group 'hashcash)
 
 (defcustom hashcash-path (executable-find "hashcash")
-  "*The path to the hashcash binary."
+  "The path to the hashcash binary."
   :group 'hashcash)
 
 (defcustom hashcash-extra-generate-parameters nil
-  "*A list of parameter strings passed to `hashcash-path' when minting.
+  "A list of parameter strings passed to `hashcash-path' when minting.
 For example, you may want to set this to '(\"-Z2\") to reduce header length."
   :type '(repeat string)
   :group 'hashcash)
 
 (defcustom hashcash-double-spend-database "hashcash.db"
-  "*The path to the double-spending database."
+  "The path to the double-spending database."
   :group 'hashcash)
 
 (defcustom hashcash-in-news nil
-  "*Specifies whether or not hashcash payments should be made to newsgroups."
+  "Specifies whether or not hashcash payments should be made to newsgroups."
   :type 'boolean
   :group 'hashcash)
 
index 6af9c2478fcc834094ee7cd86b09a4757c4d7c8c..32f99ac14652ebbe7812574d82d6aa06340913d0 100644 (file)
 ;;
 
 (defcustom mail-extr-guess-middle-initial nil
-  "*Whether to try to guess middle initial from mail address.
+  "Whether to try to guess middle initial from mail address.
 If true, then when we see an address like \"John Smith <jqs@host.com>\"
 we will assume that \"John Q. Smith\" is the fellow's name."
   :type 'boolean
   :group 'mail-extr)
 
 (defcustom mail-extr-ignore-single-names nil
-  "*Whether to ignore a name that is just a single word.
+  "Whether to ignore a name that is just a single word.
 If true, then when we see an address like \"Idiot <dumb@stupid.com>\"
 we will act as though we couldn't find a full name in the address."
   :type 'boolean
@@ -244,19 +244,19 @@ we will act as though we couldn't find a full name in the address."
 (defcustom mail-extr-full-name-prefixes
   (purecopy
    "\\(Prof\\|D[Rr]\\|Mrs?\\|Rev\\|Rabbi\\|SysOp\\|LCDR\\)\\.?[ \t\n]")
-  "*Matches prefixes to the full name that identify a person's position.
+  "Matches prefixes to the full name that identify a person's position.
 These are stripped from the full name because they do not contribute to
 uniquely identifying the person."
   :type 'regexp
   :group 'mail-extr)
 
 (defcustom mail-extr-@-binds-tighter-than-! nil
-  "*Whether the local mail transport agent looks at ! before @."
+  "Whether the local mail transport agent looks at ! before @."
   :type 'boolean
   :group 'mail-extr)
 
 (defcustom mail-extr-mangle-uucp nil
-  "*Whether to throw away information in UUCP addresses
+  "Whether to throw away information in UUCP addresses
 by translating things like \"foo!bar!baz@host\" into \"baz@bar.UUCP\"."
   :type 'boolean
   :group 'mail-extr)
@@ -1454,7 +1454,7 @@ consing a string.)"
     ))
 
 (defcustom mail-extr-disable-voodoo "\\cj"
-  "*If it is a regexp, names matching it will never be modified.
+  "If it is a regexp, names matching it will never be modified.
 If it is neither nil nor a string, modifying of names will never take
 place.  It affects how `mail-extract-address-components' works."
   :type '(choice (regexp :size 0)
index 0e79992aebefd3780d2ad3050a0f3fd5167dd4cd..dd489e3c6a9324e27fc6919c27afd80d1fc7002c 100644 (file)
@@ -78,14 +78,14 @@ Used for knowing which history list to look in when the user asks for
 previous/next input.")
 
 (defcustom mail-hist-history-size (or kill-ring-max 1729)
-  "*The maximum number of elements in a mail field's history.
+  "The maximum number of elements in a mail field's history.
 Oldest elements are dumped first."
   :type 'integer
   :group 'mail-hist)
 
 ;;;###autoload
 (defcustom mail-hist-keep-history t
-  "*Non-nil means keep a history for headers and text of outgoing mail."
+  "Non-nil means keep a history for headers and text of outgoing mail."
   :type 'boolean
   :group 'mail-hist)
 
@@ -182,7 +182,7 @@ HEADER is a string without the colon."
   (cdr (assoc header mail-hist-header-ring-alist)))
 
 (defcustom mail-hist-text-size-limit nil
-  "*Don't store any header or body with more than this many characters.
+  "Don't store any header or body with more than this many characters.
 If the value is nil, that means no limit on text size."
   :type '(choice (const nil) integer)
   :group 'mail-hist)
index 51a4c6506be5519dd44739ec8b9dcb418bb27476..290c57c1c55d93ba98af923e89297ed0db3639b4 100644 (file)
@@ -254,10 +254,12 @@ By default this is the file specified by `mail-personal-alias-file'."
     mail-abbrevs)
   (message "Parsing %s... done" file))
 
-(defvar mail-alias-separator-string ", "
-  "*A string inserted between addresses in multi-address mail aliases.
+(defcustom mail-alias-separator-string ", "
+  "String inserted between addresses in multi-address mail aliases.
 This has to contain a comma, so \", \" is a reasonable value.  You might
-also want something like \",\\n    \" to get each address on its own line.")
+also want something like \",\\n    \" to get each address on its own line."
+  :type 'string
+  :group 'mail-abbrev)
 
 ;; define-mail-abbrev sets this flag, which causes mail-resolve-all-aliases
 ;; to be called before expanding abbrevs if it's necessary.
@@ -421,14 +423,16 @@ fill-column, break the line at the previous comma, and indent the next line."
 \f
 ;;; Syntax tables and abbrev-expansion
 
-(defvar mail-abbrev-mode-regexp
+(defcustom mail-abbrev-mode-regexp
   "^\\(Resent-\\)?\\(To\\|From\\|CC\\|BCC\\|Reply-to\\):"
-  "*Regexp to select mail-headers in which mail abbrevs should be expanded.
+  "Regexp matching mail headers in which mail abbrevs should be expanded.
 This string will be handed to `looking-at' with point at the beginning
 of the current line; if it matches, abbrev mode will be turned on, otherwise
 it will be turned off.  (You don't need to worry about continuation lines.)
 This should be set to match those mail fields in which you want abbreviations
-turned on.")
+turned on."
+  :type 'regexp
+  :group 'mail-abbrev)
 
 (defvar mail-abbrev-syntax-table nil
   "The syntax-table used for abbrev-expansion purposes.
index 1c917a05dfb842dc1527c978a568fc4aa441b78c..6adcb25904b7c56bad24d50d2b4fb701086d39ab 100644 (file)
@@ -45,9 +45,6 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
 (defun mail-header-extract ()
   "Extract headers from current buffer after point.
 Returns a header alist, where each element is a cons cell (name . value),
@@ -110,6 +107,8 @@ If the value is a string, it is the original value of the header.  If the
 value is a list, its first element is the original value of the header,
 with any subsequent elements being the result of parsing the value.
 If HEADER-ALIST is nil, the dynamically bound variable `headers' is used."
+  (declare (gv-setter (lambda (value)
+                        `(mail-header-set ,header ,value ,header-alist))))
   (cdr (assq header (or header-alist headers))))
 
 (defun mail-header-set (header value &optional header-alist)
@@ -123,9 +122,6 @@ See `mail-header' for the semantics of VALUE."
        (nconc alist (list (cons header value)))))
   value)
 
-(defsetf mail-header (header &optional header-alist) (value)
-  `(mail-header-set ,header ,value ,header-alist))
-
 (defun mail-header-merge (merge-rules headers)
   "Return a new header alist with MERGE-RULES applied to HEADERS.
 MERGE-RULES is an alist whose keys are header names (symbols) and whose
index ed2c4a66b7a6d8e823cae2c0e61bbca82ebf039a..60dcd5210e1820e003de710d26309f12877ce441 100644 (file)
   :group 'processes)
 
 (defcustom metamail-program-name "metamail"
-  "*Metamail program name."
+  "Metamail program name."
   :type 'string
   :group 'metamail)
 
 (defcustom metamail-mailer-name "emacs"
-  "*Mailer name set to MM_MAILER environment variable."
+  "Mailer name set to MM_MAILER environment variable."
   :type 'string
   :group 'metamail)
 
 (defvar metamail-environment '("KEYHEADS=*" "MM_QUIET=1")
-  "*Environment variables passed to `metamail'.
+  "Environment variables passed to `metamail'.
 It must be a list of strings that have the format ENVVARNAME=VALUE.
 It is not expected to be altered globally by `set' or `setq'.
 Instead, change its value temporary using `let' or `let*' form.")
 
 (defcustom metamail-switches '("-x" "-d" "-z")
-  "*Switches for `metamail' program.
+  "Switches for `metamail' program.
 `-z' is required to remove zap file.
 It is not expected to be altered globally by `set' or `setq'.
 Instead, change its value temporary using `let' or `let*' form.
index d52d9633ee770f759e0948c9603b93931237d311..9f9c9c68285ab4b6208c7d7078cc70ef5c977e47 100644 (file)
 )
 
 (defcustom mspools-update nil
-  "*Non-nil means update *spools* buffer after visiting any folder."
+  "Non-nil means update *spools* buffer after visiting any folder."
   :type 'boolean
   :group 'mspools)
 
 (defcustom mspools-suffix "spool"
-  "*Extension used for spool files (not including full stop)."
+  "Extension used for spool files (not including full stop)."
   :type 'string
   :group 'mspools)
 
 (defcustom mspools-using-vm  (fboundp 'vm)
-  "*Non-nil if VM is used as mail reader, otherwise RMAIL is used."
+  "Non-nil if VM is used as mail reader, otherwise RMAIL is used."
   :type 'boolean
   :group 'mspools)
 
   (if (boundp 'vm-folder-directory)
       vm-folder-directory
     "~/MAIL/")
-  "*Directory where mail folders are kept.  Ensure it has a trailing /.
+  "Directory where mail folders are kept.  Ensure it has a trailing /.
 Defaults to `vm-folder-directory' if bound else to ~/MAIL/."
   :type 'directory
   :group 'mspools)
@@ -151,7 +151,7 @@ Defaults to `vm-folder-directory' if bound else to ~/MAIL/."
 (defcustom mspools-vm-system-mail (or (getenv "MAIL")
                                      (concat rmail-spool-directory
                                              (user-login-name)))
-  "*Spool file for main mailbox.  Only used by VM.
+  "Spool file for main mailbox.  Only used by VM.
 This needs to be set to your primary mail spool - mspools will not run
 without it.  By default this will be set to the environment variable
 $MAIL.  Otherwise it will use `rmail-spool-directory' to guess where
index 18f89737f199e9d83b71925564af6bf2b1f69adc..9fe8f28a59fee636d000f9c63b97c4e1f4b0c807 100644 (file)
@@ -40,6 +40,9 @@
 (require 'mail-utils)
 (require 'rfc2047)
 
+(declare-function compilation--message->loc "compile" (cl-x) t)
+(declare-function epa--find-coding-system-for-mime-charset "epa" (mime-charset))
+
 (defconst rmail-attribute-header "X-RMAIL-ATTRIBUTES"
   "The header that stores the Rmail attribute data.")
 
@@ -97,8 +100,6 @@ its character representation and its display representation.")
   "The current header display style choice, one of
 'normal (selected headers) or 'full (all headers).")
 
-;; rmail-spool-directory and rmail-file-name are defined in paths.el.
-
 (defgroup rmail nil
   "Mail reader for Emacs."
   :group 'mail)
@@ -140,6 +141,40 @@ its character representation and its display representation.")
   :prefix "rmail-edit-"
   :group 'rmail)
 
+;;;###autoload
+(defcustom rmail-file-name (purecopy "~/RMAIL")
+  "Name of user's primary mail file."
+  :type 'string
+  :group 'rmail
+  :version "21.1")
+
+;;;###autoload
+(put 'rmail-spool-directory 'standard-value
+     '((cond ((file-exists-p "/var/mail") "/var/mail/")
+            ((file-exists-p "/var/spool/mail") "/var/spool/mail/")
+            ((memq system-type '(hpux usg-unix-v irix)) "/usr/mail/")
+            (t "/usr/spool/mail/"))))
+
+;;;###autoload
+(defcustom rmail-spool-directory
+  (purecopy
+  (cond ((file-exists-p "/var/mail")
+        ;; SVR4 and recent BSD are said to use this.
+        ;; Rather than trying to know precisely which systems use it,
+        ;; let's assume this dir is never used for anything else.
+        "/var/mail/")
+       ;; Many GNU/Linux systems use this name.
+       ((file-exists-p "/var/spool/mail") "/var/spool/mail/")
+       ((memq system-type '(hpux usg-unix-v irix)) "/usr/mail/")
+       (t "/usr/spool/mail/")))
+  "Name of directory used by system mailer for delivering new mail.
+Its name should end with a slash."
+  :initialize 'custom-initialize-delay
+  :type 'directory
+  :group 'rmail)
+
+;;;###autoload(custom-initialize-delay 'rmail-spool-directory nil)
+
 (defcustom rmail-movemail-program nil
   "If non-nil, the file name of the `movemail' program."
   :group 'rmail-retrieve
@@ -710,19 +745,6 @@ to an appropriate value, and optionally also set
 `rmail-insert-mime-forwarded-message-function', and
 `rmail-insert-mime-resent-message-function'.")
 
-;; FIXME this is unused since 23.1.
-(defvar rmail-decode-mime-charset t
-  "*Non-nil means a message is decoded by MIME's charset specification.
-If this variable is nil, or the message has not MIME specification,
-the message is decoded as normal way.
-
-If the variable `rmail-enable-mime' is non-nil, this variable is
-ignored, and all the decoding work is done by a feature specified by
-the variable `rmail-mime-feature'.")
-
-(make-obsolete-variable 'rmail-decode-mime-charset
-                       "it does nothing." "23.1")
-
 (defvar rmail-mime-charset-pattern
   (concat "^content-type:[ \t]*text/plain;"
          "\\(?:[ \t\n]*\\(?:format\\|delsp\\)=\"?[-a-z0-9]+\"?;\\)*"
@@ -4228,10 +4250,13 @@ This has an effect only if a summary buffer exists."
 ;;; Speedbar support for RMAIL files.
 (eval-when-compile (require 'speedbar))
 
-(defvar rmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$"
-  "*This regex is used to match folder names to be displayed in speedbar.
-Enabling this will permit speedbar to display your folders for easy
-browsing, and moving of messages.")
+(defcustom rmail-speedbar-match-folder-regexp "^[A-Z0-9]+\\(\\.[A-Z0-9]+\\)?$"
+  "Regexp matching Rmail folder names to be displayed in Speedbar.
+Enabling this permits Speedbar to display your folders for easy
+browsing, and moving of messages."
+  :type 'regexp
+  :group 'rmail
+  :group 'speedbar)
 
 (defvar rmail-speedbar-last-user nil
   "The last user to be displayed in the speedbar.")
@@ -4722,7 +4747,7 @@ SENDERS is a string of regexps separated by commas.
 ;;;***
 \f
 ;;;### (autoloads (unforward-rmail-message undigestify-rmail-message)
-;;;;;;  "undigest" "undigest.el" "a31a35802a2adbc51be42959c3043dbd")
+;;;;;;  "undigest" "undigest.el" "9f270a2571bbbbfabc27498a8d4089c7")
 ;;; Generated autoloads from undigest.el
 
 (autoload 'undigestify-rmail-message "undigest" "\
index 5ae4c44060f871a023973f5929fa98da55f2d527..3b262e3fb53cf9ea3d9d7235503cdc342a402dc1 100644 (file)
@@ -856,8 +856,7 @@ Prefix arg means don't delete this window."
 (defun mail-bury (&optional arg)
   "Bury this mail buffer."
   (let ((newbuf (other-buffer (current-buffer)))
-       (return-action mail-return-action)
-       some-rmail)
+       (return-action mail-return-action))
     (bury-buffer (current-buffer))
     ;; If there is an Rmail buffer, return to it nicely
     ;; even if this message was not started by an Rmail command.
@@ -992,7 +991,7 @@ This function uses `mail-envelope-from'."
 
 ;;;###autoload
 (defvar sendmail-coding-system nil
-  "*Coding system for encoding the outgoing mail.
+  "Coding system for encoding the outgoing mail.
 This has higher priority than the default `buffer-file-coding-system'
 and `default-sendmail-coding-system',
 but lower priority than the local value of `buffer-file-coding-system'.
index e34a3a4d71e3e026b8974ecded0960acbaf766a9..916a977c5469455addeb7efe5d16b05854ae1078 100644 (file)
@@ -32,7 +32,7 @@
 
 (defcustom rmail-forward-separator-regex
   "^----.*\\([Ff]orwarded\\|[Oo]riginal\\).*[Mm]essage"
-  "*Regexp to match the string that introduces forwarded messages.
+  "Regexp to match the string that introduces forwarded messages.
 This is not a header, but a string contained in the body of the message.
 You may need to customize it for local needs."
   :type 'regexp
index af16bbf8c73f873e40e6b7d1e4a3a7ed0db34bcd..bf7b9abe2c16874e4d68bdd35c584edae77b4c39 100644 (file)
@@ -61,8 +61,7 @@ For example, invoke `emacs -batch -f batch-unrmail RMAIL'."
        (error "This file is not in Babyl format"))
 
     ;; Decode the file contents just as Rmail did.
-    (let ((modifiedp (buffer-modified-p))
-         (coding-system rmail-file-coding-system)
+    (let ((coding-system rmail-file-coding-system)
          from to)
       (goto-char (point-min))
       (search-forward "\n\^_" nil t)   ; Skip BABYL header.
index d4bf89ffaa162d6a538a5fdb4f3fb61f36a91e6a..f415c143473146ad44dd32829333f0a725b9ad6e 100644 (file)
   :group 'news)
 
 (defcustom uudecode-decoder-program "uudecode"
-  "*Non-nil value should be a string that names a uu decoder.
+  "Non-nil value should be a string that names a uu decoder.
 The program should expect to read uu data on its standard
 input and write the converted data to its standard output."
   :type 'string
   :group 'uudecode)
 
 (defcustom uudecode-decoder-switches nil
-  "*List of command line flags passed to `uudecode-decoder-program'."
+  "List of command line flags passed to `uudecode-decoder-program'."
   :group 'uudecode
   :type '(repeat string))
 
 (defcustom uudecode-use-external
   (executable-find uudecode-decoder-program)
-  "*Use external uudecode program."
+  "Use external uudecode program."
   :version "22.1"
   :group 'uudecode
   :type 'boolean)
index 7907c5f10ceca25375f83f3ccfe11f8389264b0b..0c021cec779cd55436a73a17db3401cb8fb5a77c 100644 (file)
@@ -1,5 +1,5 @@
 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
-# Copyright (C) 2000-2012  Free Software Foundation, Inc.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -70,25 +70,20 @@ AUTOGENEL = $(lisp)/loaddefs.el $(LOADDEFS) $(lisp)/cus-load.el \
 # During bootstrapping the byte-compiler is run interpreted when compiling
 # itself, and uses more stack than usual.
 #
-BIG_STACK_DEPTH = 1200
+BIG_STACK_DEPTH = 2200
 BIG_STACK_OPTS = --eval "(setq max-lisp-eval-depth $(BIG_STACK_DEPTH))"
 
 BYTE_COMPILE_FLAGS = $(BIG_STACK_OPTS) $(BYTE_COMPILE_EXTRA_FLAGS)
 
 # Files to compile before others during a bootstrap.  This is done to
-# speed up the bootstrap process.  The CC files are compiled first
-# because CC mode tweaks the compilation process, and requiring
-# cc-mode when it is not compiled doesn't work during the
-# bootstrapping.
+# speed up the bootstrap process.
 
 COMPILE_FIRST = \
-       $(lisp)/emacs-lisp/byte-opt.el \
-       $(lisp)/emacs-lisp/bytecomp.el \
        $(lisp)/emacs-lisp/macroexp.el \
        $(lisp)/emacs-lisp/cconv.el \
-       $(lisp)/subr.el \
-       $(lisp)/progmodes/cc-mode.el \
-       $(lisp)/progmodes/cc-vars.el
+       $(lisp)/emacs-lisp/byte-opt.el \
+       $(lisp)/emacs-lisp/bytecomp.el \
+       $(lisp)/emacs-lisp/autoload.el
 
 # The actual Emacs command run in the targets below.
 # The quotes around $(EMACS) are here because the user could type
@@ -243,9 +238,9 @@ update-subdirs-CMD: doit
        echo ;; End:>> $(lisp)/subdirs.el
 
 update-subdirs-SH: doit
-       $(srcdir)/update-subdirs $(lisp); \
+       $(srcdir)/build-aux/update-subdirs $(lisp); \
        for file in $(WINS_SUBDIR); do \
-          $(srcdir)/update-subdirs $$file; \
+          $(srcdir)/build-aux/update-subdirs $$file; \
        done;
 
 updates: update-subdirs autoloads mh-autoloads finder-data custom-deps
@@ -316,16 +311,16 @@ TAGS-LISP-CMD: $(lisptagsfiles1) $(lisptagsfiles2) $(lisptagsfiles3) $(lisptagsf
 # compiled find the right files.
 
 # Need separate version for sh and native cmd.exe
-compile: $(lisp)/subdirs.el mh-autoloads compile-$(SHELLTYPE) doit
+compile: update-subdirs compile-$(SHELLTYPE) doit
 
-compile-CMD:
+compile-CMD: autoloads
 #      -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
        for %%f in ($(COMPILE_FIRST)) do \
          $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f batch-byte-compile-if-not-done %%f
        for %%f in (. $(WINS)) do for %%g in (%%f/*.el) do \
          $(emacs) -l loaddefs $(BYTE_COMPILE_FLAGS) -f batch-byte-compile-if-not-done %%f/%%g
 
-compile-SH:
+compile-SH: autoloads
 #      for elc in $(lisp)/*.elc $(lisp)/*/*.elc; do attrib -r $$elc; done
        for el in $(COMPILE_FIRST); do \
          echo Compiling $$el; \
@@ -345,7 +340,7 @@ compile-SH:
 # unconditionally.  Some files don't actually get compiled because they
 # set the local variable no-byte-compile.
 
-compile-always: $(lisp)/subdirs.el compile-always-$(SHELLTYPE) doit
+compile-always: update-subdirs compile-always-$(SHELLTYPE) doit
 
 compile-always-CMD:
 #      -for %%f in ($(lisp) $(WINS)) do for %%g in (%%f\*.elc) do @attrib -r %%g
@@ -501,7 +496,7 @@ bootstrap-clean-SH:
 # When done, remove bootstrap-emacs from ../bin, so that
 # it will not be mistaken for an installed binary.
 
-bootstrap: update-subdirs autoloads mh-autoloads compile finder-data custom-deps
+bootstrap: update-subdirs compile finder-data custom-deps
        - $(DEL) "$(EMACS)"
 
 #
index 0a7b831ca8ef73610c313aa3fc6646a4c7861598..6f437c017b3bc4e1611005e51e6cbdf1c54bca13 100644 (file)
@@ -88,8 +88,6 @@
 \f
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-(require 'assoc)
 (require 'button)
 
 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
@@ -360,10 +358,10 @@ Otherwise, the value is whatever the function
 (make-variable-buffer-local 'Man-arguments)
 (put 'Man-arguments 'permanent-local t)
 
-(defvar Man-sections-alist nil)
-(make-variable-buffer-local 'Man-sections-alist)
-(defvar Man-refpages-alist nil)
-(make-variable-buffer-local 'Man-refpages-alist)
+(defvar Man--sections nil)
+(make-variable-buffer-local 'Man--sections)
+(defvar Man--refpages nil)
+(make-variable-buffer-local 'Man--refpages)
 (defvar Man-page-list nil)
 (make-variable-buffer-local 'Man-page-list)
 (defvar Man-current-page 0)
@@ -990,41 +988,41 @@ Return the buffer in which the manpage will appear."
 See the variable `Man-notify-method' for the different notification behaviors."
   (let ((saved-frame (with-current-buffer man-buffer
                       Man-original-frame)))
-    (case Man-notify-method
-     (newframe
-      ;; Since we run asynchronously, perhaps while Emacs is waiting
-      ;; for input, we must not leave a different buffer current.  We
-      ;; can't rely on the editor command loop to reselect the
-      ;; selected window's buffer.
-      (save-excursion
-       (let ((frame (make-frame Man-frame-parameters)))
-         (set-window-buffer (frame-selected-window frame) man-buffer)
-          (set-window-dedicated-p (frame-selected-window frame) t)
-         (or (display-multi-frame-p frame)
-             (select-frame frame)))))
-     (pushy
-      (switch-to-buffer man-buffer))
-     (bully
-      (and (frame-live-p saved-frame)
-          (select-frame saved-frame))
-      (pop-to-buffer man-buffer)
-      (delete-other-windows))
-     (aggressive
-      (and (frame-live-p saved-frame)
-          (select-frame saved-frame))
-      (pop-to-buffer man-buffer))
-     (friendly
-      (and (frame-live-p saved-frame)
-          (select-frame saved-frame))
-      (display-buffer man-buffer 'not-this-window))
-     (polite
-      (beep)
-      (message "Manual buffer %s is ready" (buffer-name man-buffer)))
-     (quiet
-      (message "Manual buffer %s is ready" (buffer-name man-buffer)))
-     (t ;; meek
-      (message ""))
-     )))
+    (pcase Man-notify-method
+      (`newframe
+       ;; Since we run asynchronously, perhaps while Emacs is waiting
+       ;; for input, we must not leave a different buffer current.  We
+       ;; can't rely on the editor command loop to reselect the
+       ;; selected window's buffer.
+       (save-excursion
+         (let ((frame (make-frame Man-frame-parameters)))
+           (set-window-buffer (frame-selected-window frame) man-buffer)
+           (set-window-dedicated-p (frame-selected-window frame) t)
+           (or (display-multi-frame-p frame)
+               (select-frame frame)))))
+      (`pushy
+       (switch-to-buffer man-buffer))
+      (`bully
+       (and (frame-live-p saved-frame)
+            (select-frame saved-frame))
+       (pop-to-buffer man-buffer)
+       (delete-other-windows))
+      (`aggressive
+       (and (frame-live-p saved-frame)
+            (select-frame saved-frame))
+       (pop-to-buffer man-buffer))
+      (`friendly
+       (and (frame-live-p saved-frame)
+            (select-frame saved-frame))
+       (display-buffer man-buffer 'not-this-window))
+      (`polite
+       (beep)
+       (message "Manual buffer %s is ready" (buffer-name man-buffer)))
+      (`quiet
+       (message "Manual buffer %s is ready" (buffer-name man-buffer)))
+      (_ ;; meek
+       (message ""))
+      )))
 
 (defun Man-softhyphen-to-minus ()
   ;; \255 is SOFT HYPHEN in Latin-N.  Versions of Debian man, at
@@ -1062,14 +1060,14 @@ Same for the ANSI bold and normal escape sequences."
       (setq faces
            (cond
             ((match-beginning 2)
-             (delq (case (char-after (match-beginning 2))
+             (delq (pcase (char-after (match-beginning 2))
                      (?2 Man-overstrike-face)
                      (?4 Man-underline-face)
                      (?7 Man-reverse-face))
                    faces))
             ((eq (char-after (match-beginning 1)) ?0) nil)
             (t
-             (cons (case (char-after (match-beginning 1))
+             (cons (pcase (char-after (match-beginning 1))
                      (?1 Man-overstrike-face)
                      (?4 Man-underline-face)
                      (?7 Man-reverse-face))
@@ -1274,8 +1272,8 @@ manpage command."
          (if (not Man-page-list)
              (let ((args Man-arguments))
                (kill-buffer (current-buffer))
-               (error "Can't find the %s manpage"
-                      (Man-page-from-arguments args)))
+               (user-error "Can't find the %s manpage"
+                            (Man-page-from-arguments args)))
            (set-buffer-modified-p nil))))
        ;; Restore case-fold-search before calling
        ;; Man-notify-when-ready because it may switch buffers.
@@ -1370,17 +1368,19 @@ The following key bindings are currently in effect in the buffer:
   (run-mode-hooks 'Man-mode-hook))
 
 (defsubst Man-build-section-alist ()
-  "Build the association list of manpage sections."
-  (setq Man-sections-alist nil)
+  "Build the list of manpage sections."
+  (setq Man--sections nil)
   (goto-char (point-min))
   (let ((case-fold-search nil))
     (while (re-search-forward Man-heading-regexp (point-max) t)
-      (aput 'Man-sections-alist (match-string 1))
+      (let ((section (match-string 1)))
+        (unless (member section Man--sections)
+          (push section Man--sections)))
       (forward-line 1))))
 
 (defsubst Man-build-references-alist ()
-  "Build the association list of references (in the SEE ALSO section)."
-  (setq Man-refpages-alist nil)
+  "Build the list of references (in the SEE ALSO section)."
+  (setq Man--refpages nil)
   (save-excursion
     (if (Man-find-section Man-see-also-regexp)
        (let ((start (progn (forward-line 1) (point)))
@@ -1406,10 +1406,11 @@ The following key bindings are currently in effect in the buffer:
                              len (1- (length word))))
                    (if (memq (aref word len) '(?- ?­))
                        (setq hyphenated (substring word 0 len)))
-                   (if (string-match Man-reference-regexp word)
-                       (aput 'Man-refpages-alist word))))
+                   (and (string-match Man-reference-regexp word)
+                         (not (member word Man--refpages))
+                         (push word Man--refpages))))
              (skip-chars-forward " \t\n,"))))))
-  (setq Man-refpages-alist (nreverse Man-refpages-alist)))
+  (setq Man--refpages (nreverse Man--refpages)))
 
 (defun Man-build-page-list ()
   "Build the list of separate manpages in the buffer."
@@ -1473,7 +1474,12 @@ The following key bindings are currently in effect in the buffer:
            (nindent 0))
        (narrow-to-region (car page) (car (cdr page)))
        (if Man-uses-untabify-flag
-           (untabify (point-min) (point-max)))
+           ;; The space characters inserted by `untabify' inherit
+           ;; sticky text properties, which is unnecessary and looks
+           ;; ugly with underlining (Bug#11408).
+           (let ((text-property-default-nonsticky
+                  (cons '(face . t) text-property-default-nonsticky)))
+             (untabify (point-min) (point-max))))
        (if (catch 'unindent
              (goto-char (point-min))
              (if (not (re-search-forward Man-first-heading-regexp nil t))
@@ -1541,21 +1547,22 @@ Returns t if section is found, nil otherwise."
       nil)
     ))
 
-(defun Man-goto-section ()
-  "Query for section to move point to."
-  (interactive)
-  (aput 'Man-sections-alist
-       (let* ((default (aheadsym Man-sections-alist))
-              (completion-ignore-case t)
-              chosen
-              (prompt (concat "Go to section (default " default "): ")))
-         (setq chosen (completing-read prompt Man-sections-alist))
-         (if (or (not chosen)
-                 (string= chosen ""))
-             default
-           chosen)))
-  (unless (Man-find-section (aheadsym Man-sections-alist))
-    (error "Section not found")))
+(defvar Man--last-section nil)
+
+(defun Man-goto-section (section)
+  "Move point to SECTION."
+  (interactive
+   (let* ((default (if (member Man--last-section Man--sections)
+                       Man--last-section
+                     (car Man--sections)))
+          (completion-ignore-case t)
+          (prompt (concat "Go to section (default " default "): "))
+          (chosen (completing-read prompt Man--sections
+                                   nil nil nil nil default)))
+     (list chosen)))
+  (setq Man--last-section section)
+  (unless (Man-find-section section)
+    (error "Section %s not found" section)))
 
 
 (defun Man-goto-see-also-section ()
@@ -1586,11 +1593,13 @@ as \"tcgetp-grp(3V)\", and point is at \"grp(3V)\", we return
            (setq word (current-word))))
       word)))
 
+(defvar Man--last-refpage nil)
+
 (defun Man-follow-manual-reference (reference)
   "Get one of the manpages referred to in the \"SEE ALSO\" section.
 Specify which REFERENCE to use; default is based on word at point."
   (interactive
-   (if (not Man-refpages-alist)
+   (if (not Man--refpages)
        (error "There are no references in the current man page")
      (list
       (let* ((default (or
@@ -1603,26 +1612,22 @@ Specify which REFERENCE to use; default is based on word at point."
                                   (substring word 0
                                              (match-beginning 0))
                                 word))
-                            Man-refpages-alist))
-                      (aheadsym Man-refpages-alist)))
+                            Man--refpages))
+                       (if (member Man--last-refpage Man--refpages)
+                           Man--last-refpage
+                         (car Man--refpages))))
             (defaults
               (mapcar 'substring-no-properties
-                      (delete-dups
-                       (delq nil (cons default
-                                       (mapcar 'car Man-refpages-alist))))))
-            chosen
-            (prompt (concat "Refer to (default " default "): ")))
-       (setq chosen (completing-read prompt Man-refpages-alist
-                                     nil nil nil nil defaults))
-       (if (or (not chosen)
-               (string= chosen ""))
-           default
-         chosen)))))
-  (if (not Man-refpages-alist)
+                       (cons default Man--refpages)))
+            (prompt (concat "Refer to (default " default "): "))
+            (chosen (completing-read prompt Man--refpages
+                                     nil nil nil nil defaults)))
+        chosen))))
+  (if (not Man--refpages)
       (error "Can't find any references in the current manpage")
-    (aput 'Man-refpages-alist reference)
+    (setq Man--last-refpage reference)
     (Man-getpage-in-background
-     (Man-translate-references (aheadsym Man-refpages-alist)))))
+     (Man-translate-references reference))))
 
 (defun Man-kill ()
   "Kill the buffer containing the manpage."
@@ -1648,7 +1653,7 @@ Specify which REFERENCE to use; default is based on word at point."
   (when Man-page-list
     (if (or (< page 1)
            (> page (length Man-page-list)))
-       (error "No manpage %d found" page))
+       (user-error "No manpage %d found" page))
     (let* ((page-range (nth (1- page) Man-page-list))
           (page-start (car page-range))
           (page-end (car (cdr page-range))))
@@ -1741,9 +1746,6 @@ Uses `Man-name-local-regexp'."
 ;; Init the man package variables, if not already done.
 (Man-init-defvars)
 
-(add-to-list 'debug-ignored-errors "^No manpage [0-9]* found$")
-(add-to-list 'debug-ignored-errors "^Can't find the .* manpage$")
-
 (provide 'man)
 
 ;;; man.el ends here
index 1f57601a71122b44cbd6ab25f7682f9d5690595d..619510e8833014d2da7b3783f4f705d10a741f10 100644 (file)
@@ -1,6 +1,6 @@
 ;;; menu-bar.el --- define a default menu bar
 
-;; Copyright (C) 1993-1995, 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2012 Free Software Foundation, Inc.
 
 ;; Author: RMS
 ;; Maintainer: FSF
       (setq menu-bar-final-items '(buffer services help-menu))
     (setq menu-bar-final-items '(buffer services hide-app quit))
     ;; Add standard top-level items to GNUstep menu.
-    (define-key global-map [menu-bar quit]
-      `(menu-item ,(purecopy "Quit") save-buffers-kill-emacs
-                  :help ,(purecopy "Save unsaved buffers, then exit")))
-    (define-key global-map [menu-bar hide-app]
-      `(menu-item ,(purecopy "Hide") ns-do-hide-emacs
-                  :help ,(purecopy "Hide Emacs"))))
-  (define-key global-map [menu-bar services] ; set-up in ns-win
-    (cons (purecopy "Services") (make-sparse-keymap "Services"))))
+    (bindings--define-key global-map [menu-bar quit]
+      '(menu-item "Quit" save-buffers-kill-emacs
+                   :help "Save unsaved buffers, then exit"))
+    (bindings--define-key global-map [menu-bar hide-app]
+      '(menu-item "Hide" ns-do-hide-emacs
+                  :help "Hide Emacs")))
+  (bindings--define-key global-map [menu-bar services] ; Set-up in ns-win.
+    (cons "Services" (make-sparse-keymap "Services"))))
 
 ;; This definition is just to show what this looks like.
 ;; It gets modified in place when menu-bar-update-buffers is called.
   (let ((menu (make-sparse-keymap "File")))
 
     ;; The "File" menu items
-    (define-key menu [exit-emacs]
-      `(menu-item ,(purecopy "Quit") save-buffers-kill-terminal
-                  :help ,(purecopy "Save unsaved buffers, then exit")))
+    (bindings--define-key menu [exit-emacs]
+      '(menu-item "Quit" save-buffers-kill-terminal
+                  :help "Save unsaved buffers, then exit"))
 
-    (define-key menu [separator-exit]
+    (bindings--define-key menu [separator-exit]
       menu-bar-separator)
 
     ;; Don't use delete-frame as event name because that is a special
     ;; event.
-    (define-key menu [delete-this-frame]
-      `(menu-item ,(purecopy "Delete Frame") delete-frame
+    (bindings--define-key menu [delete-this-frame]
+      '(menu-item "Delete Frame" delete-frame
                   :visible (fboundp 'delete-frame)
                   :enable (delete-frame-enabled-p)
-                  :help ,(purecopy "Delete currently selected frame")))
-    (define-key menu [make-frame-on-display]
-      `(menu-item ,(purecopy "New Frame on Display...") make-frame-on-display
+                  :help "Delete currently selected frame"))
+    (bindings--define-key menu [make-frame-on-display]
+      '(menu-item "New Frame on Display..." make-frame-on-display
                   :visible (fboundp 'make-frame-on-display)
-                  :help ,(purecopy "Open a new frame on another display")))
-    (define-key menu [make-frame]
-      `(menu-item ,(purecopy "New Frame") make-frame-command
+                  :help "Open a new frame on another display"))
+    (bindings--define-key menu [make-frame]
+      '(menu-item "New Frame" make-frame-command
                   :visible (fboundp 'make-frame-command)
-                  :help ,(purecopy "Open a new frame")))
+                  :help "Open a new frame"))
 
-    (define-key menu [separator-frame]
+    (bindings--define-key menu [separator-frame]
       menu-bar-separator)
 
-    (define-key menu [one-window]
-      `(menu-item ,(purecopy "Remove Other Windows") delete-other-windows
+    (bindings--define-key menu [one-window]
+      '(menu-item "Remove Other Windows" delete-other-windows
                   :enable (not (one-window-p t nil))
-                  :help ,(purecopy "Make selected window fill whole frame")))
+                  :help "Make selected window fill whole frame"))
 
-    (define-key menu [new-window-on-right]
-      `(menu-item ,(purecopy "New Window on Right") split-window-right
+    (bindings--define-key menu [new-window-on-right]
+      '(menu-item "New Window on Right" split-window-right
                   :enable (and (menu-bar-menu-frame-live-and-visible-p)
                                (menu-bar-non-minibuffer-window-p))
-                  :help ,(purecopy "Make new window on right of selected one")))
+                  :help "Make new window on right of selected one"))
 
-    (define-key menu [new-window-below]
-      `(menu-item ,(purecopy "New Window Below") split-window-below
+    (bindings--define-key menu [new-window-below]
+      '(menu-item "New Window Below" split-window-below
                   :enable (and (menu-bar-menu-frame-live-and-visible-p)
                                (menu-bar-non-minibuffer-window-p))
-                  :help ,(purecopy "Make new window below selected one")))
+                  :help "Make new window below selected one"))
 
-    (define-key menu [separator-window]
+    (bindings--define-key menu [separator-window]
       menu-bar-separator)
 
-    (define-key menu [ps-print-region]
-      `(menu-item ,(purecopy "PostScript Print Region (B+W)") ps-print-region
+    (bindings--define-key menu [ps-print-region]
+      '(menu-item "PostScript Print Region (B+W)" ps-print-region
                   :enable mark-active
-                  :help ,(purecopy "Pretty-print marked region in black and white to PostScript printer")))
-    (define-key menu [ps-print-buffer]
-      `(menu-item ,(purecopy "PostScript Print Buffer (B+W)") ps-print-buffer
+                  :help "Pretty-print marked region in black and white to PostScript printer"))
+    (bindings--define-key menu [ps-print-buffer]
+      '(menu-item "PostScript Print Buffer (B+W)" ps-print-buffer
                   :enable (menu-bar-menu-frame-live-and-visible-p)
-                  :help ,(purecopy "Pretty-print current buffer in black and white to PostScript printer")))
-    (define-key menu [ps-print-region-faces]
-      `(menu-item ,(purecopy "PostScript Print Region")
+                  :help "Pretty-print current buffer in black and white to PostScript printer"))
+    (bindings--define-key menu [ps-print-region-faces]
+      '(menu-item "PostScript Print Region"
                   ps-print-region-with-faces
                   :enable mark-active
-                  :help ,(purecopy
-                          "Pretty-print marked region to PostScript printer")))
-    (define-key menu [ps-print-buffer-faces]
-      `(menu-item ,(purecopy "PostScript Print Buffer")
+                  :help "Pretty-print marked region to PostScript printer"))
+    (bindings--define-key menu [ps-print-buffer-faces]
+      '(menu-item "PostScript Print Buffer"
                   ps-print-buffer-with-faces
                   :enable (menu-bar-menu-frame-live-and-visible-p)
-                  :help ,(purecopy "Pretty-print current buffer to PostScript printer")))
-    (define-key menu [print-region]
-      `(menu-item ,(purecopy "Print Region") print-region
+                  :help "Pretty-print current buffer to PostScript printer"))
+    (bindings--define-key menu [print-region]
+      '(menu-item "Print Region" print-region
                   :enable mark-active
-                  :help ,(purecopy "Print region between mark and current position")))
-    (define-key menu [print-buffer]
-      `(menu-item ,(purecopy "Print Buffer") print-buffer
+                  :help "Print region between mark and current position"))
+    (bindings--define-key menu [print-buffer]
+      '(menu-item "Print Buffer" print-buffer
                   :enable (menu-bar-menu-frame-live-and-visible-p)
-                  :help ,(purecopy "Print current buffer with page headings")))
+                  :help "Print current buffer with page headings"))
 
-    (define-key menu [separator-print]
+    (bindings--define-key menu [separator-print]
       menu-bar-separator)
 
-    (define-key menu [recover-session]
-      `(menu-item ,(purecopy "Recover Crashed Session") recover-session
+    (bindings--define-key menu [recover-session]
+      '(menu-item "Recover Crashed Session" recover-session
                   :enable
                   (and auto-save-list-file-prefix
                        (file-directory-p
                                  (file-name-nondirectory
                                   auto-save-list-file-prefix)))
                         t))
-                  :help ,(purecopy "Recover edits from a crashed session")))
-    (define-key menu [revert-buffer]
-      `(menu-item ,(purecopy "Revert Buffer") revert-buffer
+                  :help "Recover edits from a crashed session"))
+    (bindings--define-key menu [revert-buffer]
+      '(menu-item "Revert Buffer" revert-buffer
                   :enable (or revert-buffer-function
                               revert-buffer-insert-file-contents-function
                               (and buffer-file-number
                                    (or (buffer-modified-p)
                                        (not (verify-visited-file-modtime
                                              (current-buffer))))))
-                  :help ,(purecopy "Re-read current buffer from its file")))
-    (define-key menu [write-file]
-      `(menu-item ,(purecopy "Save As...") write-file
+                  :help "Re-read current buffer from its file"))
+    (bindings--define-key menu [write-file]
+      '(menu-item "Save As..." write-file
                   :enable (and (menu-bar-menu-frame-live-and-visible-p)
                                (menu-bar-non-minibuffer-window-p))
-                  :help ,(purecopy "Write current buffer to another file")))
-    (define-key menu [save-buffer]
-      `(menu-item ,(purecopy "Save") save-buffer
+                  :help "Write current buffer to another file"))
+    (bindings--define-key menu [save-buffer]
+      '(menu-item "Save" save-buffer
                   :enable (and (buffer-modified-p)
                                (buffer-file-name)
                                (menu-bar-non-minibuffer-window-p))
-                  :help ,(purecopy "Save current buffer to its file")))
+                  :help "Save current buffer to its file"))
 
-    (define-key menu [separator-save]
+    (bindings--define-key menu [separator-save]
       menu-bar-separator)
 
 
-    (define-key menu [kill-buffer]
-      `(menu-item ,(purecopy "Close") kill-this-buffer
+    (bindings--define-key menu [kill-buffer]
+      '(menu-item "Close" kill-this-buffer
                   :enable (kill-this-buffer-enabled-p)
-                  :help ,(purecopy "Discard (kill) current buffer")))
-    (define-key menu [insert-file]
-      `(menu-item ,(purecopy "Insert File...") insert-file
+                  :help "Discard (kill) current buffer"))
+    (bindings--define-key menu [insert-file]
+      '(menu-item "Insert File..." insert-file
                   :enable (menu-bar-non-minibuffer-window-p)
-                  :help ,(purecopy "Insert another file into current buffer")))
-    (define-key menu [dired]
-      `(menu-item ,(purecopy "Open Directory...") dired
+                  :help "Insert another file into current buffer"))
+    (bindings--define-key menu [dired]
+      '(menu-item "Open Directory..." dired
                   :enable (menu-bar-non-minibuffer-window-p)
-                  :help ,(purecopy
-                          "Read a directory, to operate on its files")))
-    (define-key menu [open-file]
-      `(menu-item ,(purecopy "Open File...") menu-find-file-existing
+                  :help "Read a directory, to operate on its files"))
+    (bindings--define-key menu [open-file]
+      '(menu-item "Open File..." menu-find-file-existing
                   :enable (menu-bar-non-minibuffer-window-p)
-                  :help ,(purecopy
-                          "Read an existing file into an Emacs buffer")))
-    (define-key menu [new-file]
-      `(menu-item ,(purecopy "Visit New File...") find-file
+                  :help "Read an existing file into an Emacs buffer"))
+    (bindings--define-key menu [new-file]
+      '(menu-item "Visit New File..." find-file
                   :enable (menu-bar-non-minibuffer-window-p)
-                  :help ,(purecopy
-                          "Specify a new file's name, to edit the file")))
+                  :help "Specify a new file's name, to edit the file"))
 
     menu))
 
 ;; The Edit->Search->Incremental Search menu
 (defvar menu-bar-i-search-menu
   (let ((menu (make-sparse-keymap "Incremental Search")))
-    (define-key menu [isearch-backward-regexp]
-      `(menu-item ,(purecopy "Backward Regexp...") isearch-backward-regexp
-        :help ,(purecopy
-                "Search backwards for a regular expression as you type it")))
-    (define-key menu [isearch-forward-regexp]
-      `(menu-item ,(purecopy "Forward Regexp...") isearch-forward-regexp
-        :help ,(purecopy
-                "Search forward for a regular expression as you type it")))
-    (define-key menu [isearch-backward]
-      `(menu-item ,(purecopy "Backward String...") isearch-backward
-        :help ,(purecopy "Search backwards for a string as you type it")))
-    (define-key menu [isearch-forward]
-      `(menu-item ,(purecopy "Forward String...") isearch-forward
-        :help ,(purecopy "Search forward for a string as you type it")))
+    (bindings--define-key menu [isearch-backward-regexp]
+      '(menu-item "Backward Regexp..." isearch-backward-regexp
+        :help "Search backwards for a regular expression as you type it"))
+    (bindings--define-key menu [isearch-forward-regexp]
+      '(menu-item "Forward Regexp..." isearch-forward-regexp
+        :help "Search forward for a regular expression as you type it"))
+    (bindings--define-key menu [isearch-backward]
+      '(menu-item "Backward String..." isearch-backward
+        :help "Search backwards for a string as you type it"))
+    (bindings--define-key menu [isearch-forward]
+      '(menu-item "Forward String..." isearch-forward
+        :help "Search forward for a string as you type it"))
     menu))
 
 (defvar menu-bar-search-menu
   (let ((menu (make-sparse-keymap "Search")))
 
-    (define-key menu [i-search]
-      `(menu-item ,(purecopy "Incremental Search") ,menu-bar-i-search-menu))
-    (define-key menu [separator-tag-isearch]
+    (bindings--define-key menu [i-search]
+      `(menu-item "Incremental Search" ,menu-bar-i-search-menu))
+    (bindings--define-key menu [separator-tag-isearch]
       menu-bar-separator)
 
-    (define-key menu [tags-continue]
-      `(menu-item ,(purecopy "Continue Tags Search") tags-loop-continue
-                  :help ,(purecopy "Continue last tags search operation")))
-    (define-key menu [tags-srch]
-      `(menu-item ,(purecopy "Search Tagged Files...") tags-search
-                  :help ,(purecopy "Search for a regexp in all tagged files")))
-    (define-key menu [separator-tag-search] menu-bar-separator)
+    (bindings--define-key menu [tags-continue]
+      '(menu-item "Continue Tags Search" tags-loop-continue
+                  :help "Continue last tags search operation"))
+    (bindings--define-key menu [tags-srch]
+      '(menu-item "Search Tagged Files..." tags-search
+                  :help "Search for a regexp in all tagged files"))
+    (bindings--define-key menu [separator-tag-search] menu-bar-separator)
 
-    (define-key menu [repeat-search-back]
-      `(menu-item ,(purecopy "Repeat Backwards")
+    (bindings--define-key menu [repeat-search-back]
+      '(menu-item "Repeat Backwards"
                   nonincremental-repeat-search-backward
                   :enable (or (and (eq menu-bar-last-search-type 'string)
                                    search-ring)
                               (and (eq menu-bar-last-search-type 'regexp)
                                    regexp-search-ring))
-                  :help ,(purecopy "Repeat last search backwards")))
-    (define-key menu [repeat-search-fwd]
-      `(menu-item ,(purecopy "Repeat Forward")
+                  :help "Repeat last search backwards"))
+    (bindings--define-key menu [repeat-search-fwd]
+      '(menu-item "Repeat Forward"
                   nonincremental-repeat-search-forward
                   :enable (or (and (eq menu-bar-last-search-type 'string)
                                    search-ring)
                               (and (eq menu-bar-last-search-type 'regexp)
                                    regexp-search-ring))
-                  :help ,(purecopy "Repeat last search forward")))
-    (define-key menu [separator-repeat-search]
+                  :help "Repeat last search forward"))
+    (bindings--define-key menu [separator-repeat-search]
       menu-bar-separator)
 
-    (define-key menu [re-search-backward]
-      `(menu-item ,(purecopy "Regexp Backwards...")
+    (bindings--define-key menu [re-search-backward]
+      '(menu-item "Regexp Backwards..."
                   nonincremental-re-search-backward
-                  :help ,(purecopy
-                          "Search backwards for a regular expression")))
-    (define-key menu [re-search-forward]
-      `(menu-item ,(purecopy "Regexp Forward...")
+                  :help "Search backwards for a regular expression"))
+    (bindings--define-key menu [re-search-forward]
+      '(menu-item "Regexp Forward..."
                   nonincremental-re-search-forward
-                  :help ,(purecopy "Search forward for a regular expression")))
+                  :help "Search forward for a regular expression"))
 
-    (define-key menu [search-backward]
-      `(menu-item ,(purecopy "String Backwards...")
+    (bindings--define-key menu [search-backward]
+      '(menu-item "String Backwards..."
                   nonincremental-search-backward
-                  :help ,(purecopy "Search backwards for a string")))
-    (define-key menu [search-forward]
-      `(menu-item ,(purecopy "String Forward...") nonincremental-search-forward
-                  :help ,(purecopy "Search forward for a string")))
+                  :help "Search backwards for a string"))
+    (bindings--define-key menu [search-forward]
+      '(menu-item "String Forward..." nonincremental-search-forward
+                  :help "Search forward for a string"))
     menu))
 
 ;; The Edit->Replace submenu
 
 (defvar menu-bar-replace-menu
   (let ((menu (make-sparse-keymap "Replace")))
-    (define-key menu [tags-repl-continue]
-      `(menu-item ,(purecopy "Continue Replace") tags-loop-continue
-                  :help ,(purecopy "Continue last tags replace operation")))
-    (define-key menu [tags-repl]
-      `(menu-item ,(purecopy "Replace in Tagged Files...") tags-query-replace
-        :help ,(purecopy
-                "Interactively replace a regexp in all tagged files")))
-    (define-key menu [separator-replace-tags]
+    (bindings--define-key menu [tags-repl-continue]
+      '(menu-item "Continue Replace" tags-loop-continue
+                  :help "Continue last tags replace operation"))
+    (bindings--define-key menu [tags-repl]
+      '(menu-item "Replace in Tagged Files..." tags-query-replace
+        :help "Interactively replace a regexp in all tagged files"))
+    (bindings--define-key menu [separator-replace-tags]
       menu-bar-separator)
 
-    (define-key menu [query-replace-regexp]
-      `(menu-item ,(purecopy "Replace Regexp...") query-replace-regexp
+    (bindings--define-key menu [query-replace-regexp]
+      '(menu-item "Replace Regexp..." query-replace-regexp
                   :enable (not buffer-read-only)
-                  :help ,(purecopy "Replace regular expression interactively, ask about each occurrence")))
-    (define-key menu [query-replace]
-      `(menu-item ,(purecopy "Replace String...") query-replace
+                  :help "Replace regular expression interactively, ask about each occurrence"))
+    (bindings--define-key menu [query-replace]
+      '(menu-item "Replace String..." query-replace
         :enable (not buffer-read-only)
-        :help ,(purecopy
-                "Replace string interactively, ask about each occurrence")))
+        :help "Replace string interactively, ask about each occurrence"))
     menu))
 
 ;;; Assemble the top-level Edit menu items.
 (defvar menu-bar-goto-menu
   (let ((menu (make-sparse-keymap "Go To")))
 
-    (define-key menu [set-tags-name]
-      `(menu-item ,(purecopy "Set Tags File Name...") visit-tags-table
-                  :help ,(purecopy "Tell Tags commands which tag table file to use")))
+    (bindings--define-key menu [set-tags-name]
+      '(menu-item "Set Tags File Name..." visit-tags-table
+                  :help "Tell Tags commands which tag table file to use"))
 
-    (define-key menu [separator-tag-file]
+    (bindings--define-key menu [separator-tag-file]
       menu-bar-separator)
 
-    (define-key menu [apropos-tags]
-      `(menu-item ,(purecopy "Tags Apropos...") tags-apropos
-                  :help ,(purecopy "Find function/variables whose names match regexp")))
-    (define-key menu [next-tag-otherw]
-      `(menu-item ,(purecopy "Next Tag in Other Window")
+    (bindings--define-key menu [apropos-tags]
+      '(menu-item "Tags Apropos..." tags-apropos
+                  :help "Find function/variables whose names match regexp"))
+    (bindings--define-key menu [next-tag-otherw]
+      '(menu-item "Next Tag in Other Window"
                   menu-bar-next-tag-other-window
                   :enable (and (boundp 'tags-location-ring)
                                (not (ring-empty-p tags-location-ring)))
-                  :help ,(purecopy "Find next function/variable matching last tag name in another window")))
+                  :help "Find next function/variable matching last tag name in another window"))
 
-    (define-key menu [next-tag]
-      `(menu-item ,(purecopy "Find Next Tag")
+    (bindings--define-key menu [next-tag]
+      '(menu-item "Find Next Tag"
                   menu-bar-next-tag
                   :enable (and (boundp 'tags-location-ring)
                                (not (ring-empty-p tags-location-ring)))
-                  :help ,(purecopy "Find next function/variable matching last tag name")))
-    (define-key menu [find-tag-otherw]
-      `(menu-item ,(purecopy "Find Tag in Other Window...") find-tag-other-window
-                  :help ,(purecopy "Find function/variable definition in another window")))
-    (define-key menu [find-tag]
-      `(menu-item ,(purecopy "Find Tag...") find-tag
-                  :help ,(purecopy "Find definition of function or variable")))
-
-    (define-key menu [separator-tags]
+                  :help "Find next function/variable matching last tag name"))
+    (bindings--define-key menu [find-tag-otherw]
+      '(menu-item "Find Tag in Other Window..." find-tag-other-window
+                  :help "Find function/variable definition in another window"))
+    (bindings--define-key menu [find-tag]
+      '(menu-item "Find Tag..." find-tag
+                  :help "Find definition of function or variable"))
+
+    (bindings--define-key menu [separator-tags]
       menu-bar-separator)
 
-    (define-key menu [end-of-buf]
-      `(menu-item ,(purecopy "Goto End of Buffer") end-of-buffer))
-    (define-key menu [beg-of-buf]
-      `(menu-item ,(purecopy "Goto Beginning of Buffer") beginning-of-buffer))
-    (define-key menu [go-to-pos]
-      `(menu-item ,(purecopy "Goto Buffer Position...") goto-char
-                  :help ,(purecopy "Read a number N and go to buffer position N")))
-    (define-key menu [go-to-line]
-      `(menu-item ,(purecopy "Goto Line...") goto-line
-                  :help ,(purecopy "Read a line number and go to that line")))
+    (bindings--define-key menu [end-of-buf]
+      '(menu-item "Goto End of Buffer" end-of-buffer))
+    (bindings--define-key menu [beg-of-buf]
+      '(menu-item "Goto Beginning of Buffer" beginning-of-buffer))
+    (bindings--define-key menu [go-to-pos]
+      '(menu-item "Goto Buffer Position..." goto-char
+                  :help "Read a number N and go to buffer position N"))
+    (bindings--define-key menu [go-to-line]
+      '(menu-item "Goto Line..." goto-line
+                  :help "Read a line number and go to that line"))
     menu))
 
 
 (defvar menu-bar-edit-menu
   (let ((menu (make-sparse-keymap "Edit")))
 
-    (define-key menu [props]
-      `(menu-item ,(purecopy "Text Properties") facemenu-menu))
+    (bindings--define-key menu [props]
+      `(menu-item "Text Properties" facemenu-menu))
 
     ;; ns-win.el said: Add spell for platform consistency.
     (if (featurep 'ns)
-        (define-key menu [spell]
-          `(menu-item ,(purecopy "Spell") ispell-menu-map)))
+        (bindings--define-key menu [spell]
+          `(menu-item "Spell" ispell-menu-map)))
 
-    (define-key menu [fill]
-      `(menu-item ,(purecopy "Fill") fill-region
+    (bindings--define-key menu [fill]
+      `(menu-item "Fill" fill-region
                   :enable (and mark-active (not buffer-read-only))
                   :help
-                  ,(purecopy "Fill text in region to fit between left and right margin")))
+                  "Fill text in region to fit between left and right margin"))
 
-    (define-key menu [separator-bookmark]
+    (bindings--define-key menu [separator-bookmark]
       menu-bar-separator)
 
-    (define-key menu [bookmark]
-      `(menu-item ,(purecopy "Bookmarks") menu-bar-bookmark-map))
+    (bindings--define-key menu [bookmark]
+      `(menu-item "Bookmarks" menu-bar-bookmark-map))
 
-    (define-key menu [goto]
-      `(menu-item ,(purecopy "Go To") ,menu-bar-goto-menu))
+    (bindings--define-key menu [goto]
+      `(menu-item "Go To" ,menu-bar-goto-menu))
 
-    (define-key menu [replace]
-      `(menu-item ,(purecopy "Replace") ,menu-bar-replace-menu))
+    (bindings--define-key menu [replace]
+      `(menu-item "Replace" ,menu-bar-replace-menu))
 
-    (define-key menu [search]
-      `(menu-item ,(purecopy "Search") ,menu-bar-search-menu))
+    (bindings--define-key menu [search]
+      `(menu-item "Search" ,menu-bar-search-menu))
 
-    (define-key menu [separator-search]
+    (bindings--define-key menu [separator-search]
       menu-bar-separator)
 
-    (define-key menu [mark-whole-buffer]
-      `(menu-item ,(purecopy "Select All") mark-whole-buffer
-                  :help ,(purecopy "Mark the whole buffer for a subsequent cut/copy")))
-    (define-key menu [clear]
-      `(menu-item ,(purecopy "Clear") delete-region
+    (bindings--define-key menu [mark-whole-buffer]
+      '(menu-item "Select All" mark-whole-buffer
+                  :help "Mark the whole buffer for a subsequent cut/copy"))
+    (bindings--define-key menu [clear]
+      '(menu-item "Clear" delete-region
                   :enable (and mark-active
                                (not buffer-read-only))
                   :help
-                  ,(purecopy "Delete the text in region between mark and current position")))
+                  "Delete the text in region between mark and current position"))
 
 
-    (define-key menu (if (featurep 'ns) [select-paste]
+    (bindings--define-key menu (if (featurep 'ns) [select-paste]
                        [paste-from-menu])
       ;; ns-win.el said: Change text to be more consistent with
       ;; surrounding menu items `paste', etc."
-      `(menu-item ,(purecopy (if (featurep 'ns) "Select and Paste"
-                               "Paste from Kill Menu")) yank-menu
-                               :enable (and (cdr yank-menu) (not buffer-read-only))
-                               :help ,(purecopy "Choose a string from the kill ring and paste it")))
-    (define-key menu [paste]
-      `(menu-item ,(purecopy "Paste") yank
+      `(menu-item ,(if (featurep 'ns) "Select and Paste"
+                     "Paste from Kill Menu") yank-menu
+                  :enable (and (cdr yank-menu) (not buffer-read-only))
+                  :help "Choose a string from the kill ring and paste it"))
+    (bindings--define-key menu [paste]
+      '(menu-item "Paste" yank
                   :enable (and (or
                                 ;; Emacs compiled --without-x (or --with-ns)
                                 ;; doesn't have x-selection-exists-p.
                                     (cdr yank-menu)
                                   kill-ring))
                                (not buffer-read-only))
-                  :help ,(purecopy "Paste (yank) text most recently cut/copied")))
-    (define-key menu [copy]
+                  :help "Paste (yank) text most recently cut/copied"))
+    (bindings--define-key menu [copy]
       ;; ns-win.el said: Substitute a Copy function that works better
       ;; under X (for GNUstep).
-      `(menu-item ,(purecopy "Copy") ,(if (featurep 'ns)
-                                          'ns-copy-including-secondary
-                                        'kill-ring-save)
+      `(menu-item "Copy" ,(if (featurep 'ns)
+                              'ns-copy-including-secondary
+                            'kill-ring-save)
                   :enable mark-active
-                  :help ,(purecopy "Copy text in region between mark and current position")
-                  :keys ,(purecopy (if (featurep 'ns)
-                                       "\\[ns-copy-including-secondary]"
-                                     "\\[kill-ring-save]"))))
-    (define-key menu [cut]
-      `(menu-item ,(purecopy "Cut") kill-region
+                  :help "Copy text in region between mark and current position"
+                  :keys ,(if (featurep 'ns)
+                             "\\[ns-copy-including-secondary]"
+                           "\\[kill-ring-save]")))
+    (bindings--define-key menu [cut]
+      '(menu-item "Cut" kill-region
                   :enable (and mark-active (not buffer-read-only))
                   :help
-                  ,(purecopy "Cut (kill) text in region between mark and current position")))
+                  "Cut (kill) text in region between mark and current position"))
     ;; ns-win.el said: Separate undo from cut/paste section.
     (if (featurep 'ns)
-        (define-key menu [separator-undo] menu-bar-separator))
+        (bindings--define-key menu [separator-undo] menu-bar-separator))
 
-    (define-key menu [undo]
-      `(menu-item ,(purecopy "Undo") undo
+    (bindings--define-key menu [undo]
+      '(menu-item "Undo" undo
                   :enable (and (not buffer-read-only)
                                (not (eq t buffer-undo-list))
                                (if (eq last-command 'undo)
                                    (listp pending-undo-list)
                                  (consp buffer-undo-list)))
-                  :help ,(purecopy "Undo last operation")))
+                  :help "Undo last operation"))
 
     menu))
 
@@ -598,45 +589,45 @@ Do the same for the keys of the same name."
 (defvar menu-bar-custom-menu
   (let ((menu (make-sparse-keymap "Customize")))
 
-    (define-key menu [customize-apropos-faces]
-      `(menu-item ,(purecopy "Faces Matching...") customize-apropos-faces
-                  :help ,(purecopy "Browse faces matching a regexp or word list")))
-    (define-key menu [customize-apropos-options]
-      `(menu-item ,(purecopy "Options Matching...") customize-apropos-options
-                  :help ,(purecopy "Browse options matching a regexp or word list")))
-    (define-key menu [customize-apropos]
-      `(menu-item ,(purecopy "All Settings Matching...") customize-apropos
-                  :help ,(purecopy "Browse customizable settings matching a regexp or word list")))
-    (define-key menu [separator-1]
+    (bindings--define-key menu [customize-apropos-faces]
+      '(menu-item "Faces Matching..." customize-apropos-faces
+                  :help "Browse faces matching a regexp or word list"))
+    (bindings--define-key menu [customize-apropos-options]
+      '(menu-item "Options Matching..." customize-apropos-options
+                  :help "Browse options matching a regexp or word list"))
+    (bindings--define-key menu [customize-apropos]
+      '(menu-item "All Settings Matching..." customize-apropos
+                  :help "Browse customizable settings matching a regexp or word list"))
+    (bindings--define-key menu [separator-1]
       menu-bar-separator)
-    (define-key menu [customize-group]
-      `(menu-item ,(purecopy "Specific Group...") customize-group
-                  :help ,(purecopy "Customize settings of specific group")))
-    (define-key menu [customize-face]
-      `(menu-item ,(purecopy "Specific Face...") customize-face
-                  :help ,(purecopy "Customize attributes of specific face")))
-    (define-key menu [customize-option]
-      `(menu-item ,(purecopy "Specific Option...") customize-option
-                  :help ,(purecopy "Customize value of specific option")))
-    (define-key menu [separator-2]
+    (bindings--define-key menu [customize-group]
+      '(menu-item "Specific Group..." customize-group
+                  :help "Customize settings of specific group"))
+    (bindings--define-key menu [customize-face]
+      '(menu-item "Specific Face..." customize-face
+                  :help "Customize attributes of specific face"))
+    (bindings--define-key menu [customize-option]
+      '(menu-item "Specific Option..." customize-option
+                  :help "Customize value of specific option"))
+    (bindings--define-key menu [separator-2]
       menu-bar-separator)
-    (define-key menu [customize-changed-options]
-      `(menu-item ,(purecopy "New Options...") customize-changed-options
-                  :help ,(purecopy "Options added or changed in recent Emacs versions")))
-    (define-key menu [customize-saved]
-      `(menu-item ,(purecopy "Saved Options") customize-saved
-                  :help ,(purecopy "Customize previously saved options")))
-    (define-key menu [separator-3]
+    (bindings--define-key menu [customize-changed-options]
+      '(menu-item "New Options..." customize-changed-options
+                  :help "Options added or changed in recent Emacs versions"))
+    (bindings--define-key menu [customize-saved]
+      '(menu-item "Saved Options" customize-saved
+                  :help "Customize previously saved options"))
+    (bindings--define-key menu [separator-3]
       menu-bar-separator)
-    (define-key menu [customize-browse]
-      `(menu-item ,(purecopy "Browse Customization Groups") customize-browse
-                  :help ,(purecopy "Browse all customization groups")))
-    (define-key menu [customize]
-      `(menu-item ,(purecopy "Top-level Customization Group") customize
-                  :help ,(purecopy "The master group called `Emacs'")))
-    (define-key menu [customize-themes]
-      `(menu-item ,(purecopy "Custom Themes") customize-themes
-                  :help ,(purecopy "Choose a pre-defined customization theme")))
+    (bindings--define-key menu [customize-browse]
+      '(menu-item "Browse Customization Groups" customize-browse
+                  :help "Browse all customization groups"))
+    (bindings--define-key menu [customize]
+      '(menu-item "Top-level Customization Group" customize
+                  :help "The master group called `Emacs'"))
+    (bindings--define-key menu [customize-themes]
+      '(menu-item "Custom Themes" customize-themes
+                  :help "Choose a pre-defined customization theme"))
     menu))
 ;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
 
@@ -646,9 +637,9 @@ FNAME is the minor mode's name (variable and function).
 DOC is the text to use for the menu entry.
 HELP is the text to use for the tooltip.
 PROPS are additional properties."
-  `(list 'menu-item  (purecopy ,doc) ',fname
+  `(list 'menu-item ,doc ',fname
         ,@(mapcar (lambda (p) (list 'quote p)) props)
-        :help (purecopy ,help)
+        :help ,help
         :button '(:toggle . (and (default-boundp ',fname)
                                  (default-value ',fname)))))
 
@@ -673,8 +664,8 @@ by \"Save Options\" in Custom buffers.")
        ;; a candidate for "Save Options", and we do not want to save options
        ;; the user have already set explicitly in his init file.
        (if interactively (customize-mark-as-set ',variable)))
-     (list 'menu-item (purecopy ,doc) ',name
-          :help (purecopy ,help)
+     (list 'menu-item ,doc ',name
+          :help ,help
           :button '(:toggle . (and (default-boundp ',variable)
                                    (default-value ',variable))))))
 
@@ -775,46 +766,46 @@ by \"Save Options\" in Custom buffers.")
 (defvar menu-bar-showhide-fringe-ind-menu
   (let ((menu (make-sparse-keymap "Buffer boundaries")))
 
-    (define-key menu [customize]
-      `(menu-item ,(purecopy "Other (Customize)")
+    (bindings--define-key menu [customize]
+      '(menu-item "Other (Customize)"
                   menu-bar-showhide-fringe-ind-customize
-                  :help ,(purecopy "Additional choices available through Custom buffer")
+                  :help "Additional choices available through Custom buffer"
                   :visible (display-graphic-p)
                   :button (:radio . (not (member indicate-buffer-boundaries
                                                  '(nil left right
                                                    ((top . left) (bottom . right))
                                                    ((t . right) (top . left))))))))
 
-    (define-key menu [mixed]
-      `(menu-item ,(purecopy "Opposite, Arrows Right") menu-bar-showhide-fringe-ind-mixed
+    (bindings--define-key menu [mixed]
+      '(menu-item "Opposite, Arrows Right" menu-bar-showhide-fringe-ind-mixed
                   :help
-                  ,(purecopy "Show top/bottom indicators in opposite fringes, arrows in right")
+                  "Show top/bottom indicators in opposite fringes, arrows in right"
                   :visible (display-graphic-p)
                   :button (:radio . (equal indicate-buffer-boundaries
                                            '((t . right) (top . left))))))
 
-    (define-key menu [box]
-      `(menu-item ,(purecopy "Opposite, No Arrows") menu-bar-showhide-fringe-ind-box
-                  :help ,(purecopy "Show top/bottom indicators in opposite fringes, no arrows")
+    (bindings--define-key menu [box]
+      '(menu-item "Opposite, No Arrows" menu-bar-showhide-fringe-ind-box
+                  :help "Show top/bottom indicators in opposite fringes, no arrows"
                   :visible (display-graphic-p)
                   :button (:radio . (equal indicate-buffer-boundaries
                                            '((top . left) (bottom . right))))))
 
-    (define-key menu [right]
-      `(menu-item ,(purecopy "In Right Fringe") menu-bar-showhide-fringe-ind-right
-                  :help ,(purecopy "Show buffer boundaries and arrows in right fringe")
+    (bindings--define-key menu [right]
+      '(menu-item "In Right Fringe" menu-bar-showhide-fringe-ind-right
+                  :help "Show buffer boundaries and arrows in right fringe"
                   :visible (display-graphic-p)
                   :button (:radio . (eq indicate-buffer-boundaries 'right))))
 
-    (define-key menu [left]
-      `(menu-item ,(purecopy "In Left Fringe") menu-bar-showhide-fringe-ind-left
-                  :help ,(purecopy "Show buffer boundaries and arrows in left fringe")
+    (bindings--define-key menu [left]
+      '(menu-item "In Left Fringe" menu-bar-showhide-fringe-ind-left
+                  :help "Show buffer boundaries and arrows in left fringe"
                   :visible (display-graphic-p)
                   :button (:radio . (eq indicate-buffer-boundaries 'left))))
 
-    (define-key menu [none]
-      `(menu-item ,(purecopy "No Indicators") menu-bar-showhide-fringe-ind-none
-                  :help ,(purecopy "Hide all buffer boundary indicators and arrows")
+    (bindings--define-key menu [none]
+      '(menu-item "No Indicators" menu-bar-showhide-fringe-ind-none
+                  :help "Hide all buffer boundary indicators and arrows"
                   :visible (display-graphic-p)
                   :button (:radio . (eq indicate-buffer-boundaries nil))))
     menu))
@@ -850,43 +841,43 @@ by \"Save Options\" in Custom buffers.")
 (defvar menu-bar-showhide-fringe-menu
   (let ((menu (make-sparse-keymap "Fringe")))
 
-    (define-key menu [showhide-fringe-ind]
-      `(menu-item ,(purecopy "Buffer Boundaries") ,menu-bar-showhide-fringe-ind-menu
+    (bindings--define-key menu [showhide-fringe-ind]
+      `(menu-item "Buffer Boundaries" ,menu-bar-showhide-fringe-ind-menu
                   :visible (display-graphic-p)
-                  :help ,(purecopy "Indicate buffer boundaries in fringe")))
+                  :help "Indicate buffer boundaries in fringe"))
 
-    (define-key menu [indicate-empty-lines]
+    (bindings--define-key menu [indicate-empty-lines]
       (menu-bar-make-toggle toggle-indicate-empty-lines indicate-empty-lines
                             "Empty Line Indicators"
                             "Indicating of empty lines %s"
                             "Indicate trailing empty lines in fringe, globally"))
 
-    (define-key menu [customize]
-      `(menu-item ,(purecopy "Customize Fringe") menu-bar-showhide-fringe-menu-customize
-                  :help ,(purecopy "Detailed customization of fringe")
+    (bindings--define-key menu [customize]
+      '(menu-item "Customize Fringe" menu-bar-showhide-fringe-menu-customize
+                  :help "Detailed customization of fringe"
                   :visible (display-graphic-p)))
 
-    (define-key menu [default]
-      `(menu-item ,(purecopy "Default") menu-bar-showhide-fringe-menu-customize-reset
-                  :help ,(purecopy "Default width fringe on both left and right side")
+    (bindings--define-key menu [default]
+      '(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset
+                  :help "Default width fringe on both left and right side"
                   :visible (display-graphic-p)
                   :button (:radio . (eq fringe-mode nil))))
 
-    (define-key menu [right]
-      `(menu-item ,(purecopy "On the Right") menu-bar-showhide-fringe-menu-customize-right
-                  :help ,(purecopy "Fringe only on the right side")
+    (bindings--define-key menu [right]
+      '(menu-item "On the Right" menu-bar-showhide-fringe-menu-customize-right
+                  :help "Fringe only on the right side"
                   :visible (display-graphic-p)
                   :button (:radio . (equal fringe-mode '(0 . nil)))))
 
-    (define-key menu [left]
-      `(menu-item ,(purecopy "On the Left") menu-bar-showhide-fringe-menu-customize-left
-                  :help ,(purecopy "Fringe only on the left side")
+    (bindings--define-key menu [left]
+      '(menu-item "On the Left" menu-bar-showhide-fringe-menu-customize-left
+                  :help "Fringe only on the left side"
                   :visible (display-graphic-p)
                   :button (:radio . (equal fringe-mode '(nil . 0)))))
 
-    (define-key menu [none]
-      `(menu-item ,(purecopy "None") menu-bar-showhide-fringe-menu-customize-disable
-                  :help ,(purecopy "Turn off fringe")
+    (bindings--define-key menu [none]
+      '(menu-item "None" menu-bar-showhide-fringe-menu-customize-disable
+                  :help "Turn off fringe"
                   :visible (display-graphic-p)
                   :button (:radio . (eq fringe-mode 0))))
     menu))
@@ -909,26 +900,26 @@ by \"Save Options\" in Custom buffers.")
 (defvar menu-bar-showhide-scroll-bar-menu
   (let ((menu (make-sparse-keymap "Scroll-bar")))
 
-    (define-key menu [right]
-      `(menu-item ,(purecopy "On the Right")
+    (bindings--define-key menu [right]
+      '(menu-item "On the Right"
                   menu-bar-right-scroll-bar
-                  :help ,(purecopy "Scroll-bar on the right side")
+                  :help "Scroll-bar on the right side"
                   :visible (display-graphic-p)
                   :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
                                                    (frame-parameters))) 'right))))
 
-    (define-key menu [left]
-      `(menu-item ,(purecopy "On the Left")
+    (bindings--define-key menu [left]
+      '(menu-item "On the Left"
                   menu-bar-left-scroll-bar
-                  :help ,(purecopy "Scroll-bar on the left side")
+                  :help "Scroll-bar on the left side"
                   :visible (display-graphic-p)
                   :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
                                                    (frame-parameters))) 'left))))
 
-    (define-key menu [none]
-      `(menu-item ,(purecopy "None")
+    (bindings--define-key menu [none]
+      '(menu-item "None"
                   menu-bar-no-scroll-bar
-                  :help ,(purecopy "Turn off scroll-bar")
+                  :help "Turn off scroll-bar"
                   :visible (display-graphic-p)
                   :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
                                                    (frame-parameters))) nil))))
@@ -973,10 +964,10 @@ by \"Save Options\" in Custom buffers.")
   (defvar menu-bar-showhide-tool-bar-menu
     (let ((menu (make-sparse-keymap "Tool-bar")))
 
-      (define-key menu [showhide-tool-bar-left]
-        `(menu-item ,(purecopy "On the Left")
+      (bindings--define-key menu [showhide-tool-bar-left]
+        '(menu-item "On the Left"
                     menu-bar-showhide-tool-bar-menu-customize-enable-left
-                    :help ,(purecopy "Tool-bar at the left side")
+                    :help "Tool-bar at the left side"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
@@ -985,10 +976,10 @@ by \"Save Options\" in Custom buffers.")
                                         'tool-bar-position)
                                        'left)))))
 
-      (define-key menu [showhide-tool-bar-right]
-        `(menu-item ,(purecopy "On the Right")
+      (bindings--define-key menu [showhide-tool-bar-right]
+        '(menu-item "On the Right"
                     menu-bar-showhide-tool-bar-menu-customize-enable-right
-                    :help ,(purecopy "Tool-bar at the right side")
+                    :help "Tool-bar at the right side"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
@@ -997,10 +988,10 @@ by \"Save Options\" in Custom buffers.")
                                         'tool-bar-position)
                                        'right)))))
 
-      (define-key menu [showhide-tool-bar-bottom]
-        `(menu-item ,(purecopy "On the Bottom")
+      (bindings--define-key menu [showhide-tool-bar-bottom]
+        '(menu-item "On the Bottom"
                     menu-bar-showhide-tool-bar-menu-customize-enable-bottom
-                    :help ,(purecopy "Tool-bar at the bottom")
+                    :help "Tool-bar at the bottom"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
@@ -1009,10 +1000,10 @@ by \"Save Options\" in Custom buffers.")
                                         'tool-bar-position)
                                        'bottom)))))
 
-      (define-key menu [showhide-tool-bar-top]
-        `(menu-item ,(purecopy "On the Top")
+      (bindings--define-key menu [showhide-tool-bar-top]
+        '(menu-item "On the Top"
                     menu-bar-showhide-tool-bar-menu-customize-enable-top
-                    :help ,(purecopy "Tool-bar at the top")
+                    :help "Tool-bar at the top"
                     :visible (display-graphic-p)
                     :button
                     (:radio . (and tool-bar-mode
@@ -1021,10 +1012,10 @@ by \"Save Options\" in Custom buffers.")
                                         'tool-bar-position)
                                        'top)))))
 
-      (define-key menu [showhide-tool-bar-none]
-        `(menu-item ,(purecopy "None")
+      (bindings--define-key menu [showhide-tool-bar-none]
+        '(menu-item "None"
                     menu-bar-showhide-tool-bar-menu-customize-disable
-                    :help ,(purecopy "Turn tool-bar off")
+                    :help "Turn tool-bar off"
                     :visible (display-graphic-p)
                     :button (:radio . (eq tool-bar-mode nil))))
       menu)))
@@ -1032,64 +1023,64 @@ by \"Save Options\" in Custom buffers.")
 (defvar menu-bar-showhide-menu
   (let ((menu (make-sparse-keymap "Show/Hide")))
 
-    (define-key menu [column-number-mode]
+    (bindings--define-key menu [column-number-mode]
       (menu-bar-make-mm-toggle column-number-mode
                                "Column Numbers"
                                "Show the current column number in the mode line"))
 
-    (define-key menu [line-number-mode]
+    (bindings--define-key menu [line-number-mode]
       (menu-bar-make-mm-toggle line-number-mode
                                "Line Numbers"
                                "Show the current line number in the mode line"))
 
-    (define-key menu [size-indication-mode]
+    (bindings--define-key menu [size-indication-mode]
       (menu-bar-make-mm-toggle size-indication-mode
                                "Size Indication"
                                "Show the size of the buffer in the mode line"))
 
-    (define-key menu [linecolumn-separator]
+    (bindings--define-key menu [linecolumn-separator]
       menu-bar-separator)
 
-    (define-key menu [showhide-battery]
+    (bindings--define-key menu [showhide-battery]
       (menu-bar-make-mm-toggle display-battery-mode
                                "Battery Status"
                                "Display battery status information in mode line"))
 
-    (define-key menu [showhide-date-time]
+    (bindings--define-key menu [showhide-date-time]
       (menu-bar-make-mm-toggle display-time-mode
                                "Time, Load and Mail"
                                "Display time, system load averages and \
 mail status in mode line"))
 
-    (define-key menu [datetime-separator]
+    (bindings--define-key menu [datetime-separator]
       menu-bar-separator)
 
-    (define-key menu [showhide-speedbar]
-      `(menu-item ,(purecopy "Speedbar") speedbar-frame-mode
-                  :help ,(purecopy "Display a Speedbar quick-navigation frame")
+    (bindings--define-key menu [showhide-speedbar]
+      '(menu-item "Speedbar" speedbar-frame-mode
+                  :help "Display a Speedbar quick-navigation frame"
                   :button (:toggle
                            . (and (boundp 'speedbar-frame)
                                   (frame-live-p (symbol-value 'speedbar-frame))
                                   (frame-visible-p
                                    (symbol-value 'speedbar-frame))))))
 
-    (define-key menu [showhide-fringe]
-      `(menu-item ,(purecopy "Fringe") ,menu-bar-showhide-fringe-menu
+    (bindings--define-key menu [showhide-fringe]
+      `(menu-item "Fringe" ,menu-bar-showhide-fringe-menu
                   :visible (display-graphic-p)))
 
-    (define-key menu [showhide-scroll-bar]
-      `(menu-item ,(purecopy "Scroll-bar") ,menu-bar-showhide-scroll-bar-menu
+    (bindings--define-key menu [showhide-scroll-bar]
+      `(menu-item "Scroll-bar" ,menu-bar-showhide-scroll-bar-menu
                   :visible (display-graphic-p)))
 
-    (define-key menu [showhide-tooltip-mode]
-      `(menu-item ,(purecopy "Tooltips") tooltip-mode
-                  :help ,(purecopy "Turn tooltips on/off")
+    (bindings--define-key menu [showhide-tooltip-mode]
+      '(menu-item "Tooltips" tooltip-mode
+                  :help "Turn tooltips on/off"
                   :visible (and (display-graphic-p) (fboundp 'x-show-tip))
                   :button (:toggle . tooltip-mode)))
 
-    (define-key menu [menu-bar-mode]
-      `(menu-item ,(purecopy "Menu-bar") toggle-menu-bar-mode-from-frame
-                  :help ,(purecopy "Turn menu-bar on/off")
+    (bindings--define-key menu [menu-bar-mode]
+      '(menu-item "Menu-bar" toggle-menu-bar-mode-from-frame
+                  :help "Turn menu-bar on/off"
                   :button
                   (:toggle . (menu-bar-positive-p
                               (frame-parameter (menu-bar-frame-for-menubar)
@@ -1097,13 +1088,13 @@ mail status in mode line"))
 
     (if (and (boundp 'menu-bar-showhide-tool-bar-menu)
              (keymapp menu-bar-showhide-tool-bar-menu))
-        (define-key menu [showhide-tool-bar]
-          `(menu-item ,(purecopy "Tool-bar") ,menu-bar-showhide-tool-bar-menu
+        (bindings--define-key menu [showhide-tool-bar]
+          `(menu-item "Tool-bar" ,menu-bar-showhide-tool-bar-menu
                       :visible (display-graphic-p)))
       ;; else not tool bar that can move.
-      (define-key menu [showhide-tool-bar]
-        `(menu-item ,(purecopy "Tool-bar") toggle-tool-bar-mode-from-frame
-                    :help ,(purecopy "Turn tool-bar on/off")
+      (bindings--define-key menu [showhide-tool-bar]
+        '(menu-item "Tool-bar" toggle-tool-bar-mode-from-frame
+                    :help "Turn tool-bar on/off"
                     :visible (display-graphic-p)
                     :button
                     (:toggle . (menu-bar-positive-p
@@ -1123,119 +1114,120 @@ mail status in mode line"))
 (defvar menu-bar-line-wrapping-menu
   (let ((menu (make-sparse-keymap "Line Wrapping")))
 
-    (define-key menu [word-wrap]
-      `(menu-item
-       ,(purecopy "Word Wrap (Visual Line mode)")
-       (lambda ()
-         (interactive)
-         (unless visual-line-mode
-           (visual-line-mode 1))
-         (message ,(purecopy "Visual-Line mode enabled")))
-       :help ,(purecopy "Wrap long lines at word boundaries")
-       :button (:radio . (and (null truncate-lines)
-                              (not (truncated-partial-width-window-p))
-                              word-wrap))
-       :visible (menu-bar-menu-frame-live-and-visible-p)))
-
-    (define-key menu [truncate]
-      `(menu-item ,(purecopy "Truncate Long Lines")
-                  (lambda ()
-                    (interactive)
-                    (if visual-line-mode (visual-line-mode 0))
-                    (setq word-wrap nil)
-                    (toggle-truncate-lines 1))
-                  :help ,(purecopy "Truncate long lines at window edge")
+    (bindings--define-key menu [word-wrap]
+      `(menu-item "Word Wrap (Visual Line mode)"
+                  ,(lambda ()
+                     (interactive)
+                     (unless visual-line-mode
+                       (visual-line-mode 1))
+                     (message "Visual-Line mode enabled"))
+                  :help "Wrap long lines at word boundaries"
+                  :button (:radio
+                           . (and (null truncate-lines)
+                                  (not (truncated-partial-width-window-p))
+                                  word-wrap))
+                  :visible (menu-bar-menu-frame-live-and-visible-p)))
+
+    (bindings--define-key menu [truncate]
+      `(menu-item "Truncate Long Lines"
+                  ,(lambda ()
+                     (interactive)
+                     (if visual-line-mode (visual-line-mode 0))
+                     (setq word-wrap nil)
+                     (toggle-truncate-lines 1))
+                  :help "Truncate long lines at window edge"
                   :button (:radio . (or truncate-lines
                                         (truncated-partial-width-window-p)))
                   :visible (menu-bar-menu-frame-live-and-visible-p)
                   :enable (not (truncated-partial-width-window-p))))
 
-    (define-key menu [window-wrap]
-      `(menu-item ,(purecopy "Wrap at Window Edge")
-                  (lambda () (interactive)
-                    (if visual-line-mode (visual-line-mode 0))
-                    (setq word-wrap nil)
-                    (if truncate-lines (toggle-truncate-lines -1)))
-                  :help ,(purecopy "Wrap long lines at window edge")
-                  :button (:radio . (and (null truncate-lines)
-                                         (not (truncated-partial-width-window-p))
-                                         (not word-wrap)))
+    (bindings--define-key menu [window-wrap]
+      `(menu-item "Wrap at Window Edge"
+                  ,(lambda () (interactive)
+                     (if visual-line-mode (visual-line-mode 0))
+                     (setq word-wrap nil)
+                     (if truncate-lines (toggle-truncate-lines -1)))
+                  :help "Wrap long lines at window edge"
+                  :button (:radio
+                           . (and (null truncate-lines)
+                                  (not (truncated-partial-width-window-p))
+                                  (not word-wrap)))
                   :visible (menu-bar-menu-frame-live-and-visible-p)
                   :enable (not (truncated-partial-width-window-p))))
     menu))
 
 (defvar menu-bar-options-menu
   (let ((menu (make-sparse-keymap "Options")))
-    (define-key menu [customize]
-      `(menu-item ,(purecopy "Customize Emacs") ,menu-bar-custom-menu))
+    (bindings--define-key menu [customize]
+      `(menu-item "Customize Emacs" ,menu-bar-custom-menu))
 
-    (define-key menu [package]
+    (bindings--define-key menu [package]
       '(menu-item "Manage Emacs Packages" package-list-packages
         :help "Install or uninstall additional Emacs packages"))
 
-    (define-key menu [save]
-      `(menu-item ,(purecopy "Save Options") menu-bar-options-save
-                  :help ,(purecopy "Save options set from the menu above")))
+    (bindings--define-key menu [save]
+      '(menu-item "Save Options" menu-bar-options-save
+                  :help "Save options set from the menu above"))
 
-    (define-key menu [custom-separator]
+    (bindings--define-key menu [custom-separator]
       menu-bar-separator)
 
-    (define-key menu [menu-set-font]
-      `(menu-item ,(purecopy "Set Default Font...") menu-set-font
+    (bindings--define-key menu [menu-set-font]
+      '(menu-item "Set Default Font..." menu-set-font
                   :visible (display-multi-font-p)
-                  :help ,(purecopy "Select a default font")))
+                  :help "Select a default font"))
 
     (if (featurep 'system-font-setting)
-        (define-key menu [menu-system-font]
+        (bindings--define-key menu [menu-system-font]
           (menu-bar-make-toggle
            toggle-use-system-font font-use-system-font
            "Use System Font"
            "Use system font: %s"
            "Use the monospaced font defined by the system")))
 
-    (define-key menu [showhide]
-      `(menu-item ,(purecopy "Show/Hide") ,menu-bar-showhide-menu))
+    (bindings--define-key menu [showhide]
+      `(menu-item "Show/Hide" ,menu-bar-showhide-menu))
 
-    (define-key menu [showhide-separator]
+    (bindings--define-key menu [showhide-separator]
       menu-bar-separator)
 
-    (define-key menu [mule]
+    (bindings--define-key menu [mule]
       ;; It is better not to use backquote here,
       ;; because that makes a bootstrapping problem
       ;; if you need to recompile all the Lisp files using interpreted code.
-      `(menu-item ,(purecopy "Multilingual Environment") ,mule-menu-keymap
+      `(menu-item "Multilingual Environment" ,mule-menu-keymap
                   ;; Most of the MULE menu actually does make sense in
                   ;; unibyte mode, e.g. language selection.
                   ;; :visible '(default-value 'enable-multibyte-characters)
                   ))
     ;;(setq menu-bar-final-items (cons 'mule menu-bar-final-items))
-    ;;(define-key menu [preferences]
-    ;;  `(menu-item ,(purecopy "Preferences") ,menu-bar-preferences-menu
-    ;;       :help ,(purecopy "Toggle important global options")))
+    ;;(bindings--define-key menu [preferences]
+    ;;  `(menu-item "Preferences" ,menu-bar-preferences-menu
+    ;;       :help "Toggle important global options"))
 
-    (define-key menu [mule-separator]
+    (bindings--define-key menu [mule-separator]
       menu-bar-separator)
 
-    (define-key menu [debug-on-quit]
+    (bindings--define-key menu [debug-on-quit]
       (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
                             "Enter Debugger on Quit/C-g" "Debug on Quit %s"
                             "Enter Lisp debugger when C-g is pressed"))
-    (define-key menu [debug-on-error]
+    (bindings--define-key menu [debug-on-error]
       (menu-bar-make-toggle toggle-debug-on-error debug-on-error
                             "Enter Debugger on Error" "Debug on Error %s"
                             "Enter Lisp debugger when an error is signaled"))
-    (define-key menu [debugger-separator]
+    (bindings--define-key menu [debugger-separator]
       menu-bar-separator)
 
-    (define-key menu [blink-cursor-mode]
+    (bindings--define-key menu [blink-cursor-mode]
       (menu-bar-make-mm-toggle
        blink-cursor-mode
        "Blink Cursor"
        "Whether the cursor blinks (Blink Cursor mode)"))
-    (define-key menu [cursor-separator]
+    (bindings--define-key menu [cursor-separator]
       menu-bar-separator)
 
-    (define-key menu [save-place]
+    (bindings--define-key menu [save-place]
       (menu-bar-make-toggle
        toggle-save-place-globally save-place
        "Save Place in Files between Sessions"
@@ -1247,7 +1239,7 @@ mail status in mode line"))
        (set-default
        'save-place (not (symbol-value 'save-place)))))
 
-    (define-key menu [uniquify]
+    (bindings--define-key menu [uniquify]
       (menu-bar-make-toggle
        toggle-uniquify-buffer-names uniquify-buffer-name-style
        "Use Directory Names in Buffer Names"
@@ -1258,9 +1250,9 @@ mail status in mode line"))
             (if (not uniquify-buffer-name-style)
                 'forward))))
 
-    (define-key menu [edit-options-separator]
+    (bindings--define-key menu [edit-options-separator]
       menu-bar-separator)
-    (define-key menu [cua-mode]
+    (bindings--define-key menu [cua-mode]
       (menu-bar-make-mm-toggle
        cua-mode
        "Use CUA Keys (Cut/Paste with C-x/C-c/C-v)"
@@ -1268,7 +1260,7 @@ mail status in mode line"))
        (:visible (or (not (boundp 'cua-enable-cua-keys))
                     cua-enable-cua-keys))))
 
-    (define-key menu [cua-emulation-mode]
+    (bindings--define-key menu [cua-emulation-mode]
       (menu-bar-make-mm-toggle
        cua-mode
        "Shift movement mark region (CUA)"
@@ -1276,35 +1268,35 @@ mail status in mode line"))
        (:visible (and (boundp 'cua-enable-cua-keys)
                      (not cua-enable-cua-keys)))))
 
-    (define-key menu [case-fold-search]
+    (bindings--define-key menu [case-fold-search]
       (menu-bar-make-toggle
        toggle-case-fold-search case-fold-search
        "Ignore Case for Search"
        "Case-Insensitive Search %s"
        "Ignore letter-case in search commands"))
 
-    (define-key menu [auto-fill-mode]
-      `(menu-item
-       ,(purecopy "Auto Fill in Text Modes")
+    (bindings--define-key menu [auto-fill-mode]
+      '(menu-item
+ "Auto Fill in Text Modes"
        menu-bar-text-mode-auto-fill
-       :help ,(purecopy "Automatically fill text while typing (Auto Fill mode)")
+       :help "Automatically fill text while typing (Auto Fill mode)"
        :button (:toggle . (if (listp text-mode-hook)
                               (member 'turn-on-auto-fill text-mode-hook)
                             (eq 'turn-on-auto-fill text-mode-hook)))))
 
-    (define-key menu [line-wrapping]
-      `(menu-item ,(purecopy "Line Wrapping in This Buffer")
+    (bindings--define-key menu [line-wrapping]
+      `(menu-item "Line Wrapping in This Buffer"
                  ,menu-bar-line-wrapping-menu))
 
 
-    (define-key menu [highlight-separator]
+    (bindings--define-key menu [highlight-separator]
       menu-bar-separator)
-    (define-key menu [highlight-paren-mode]
+    (bindings--define-key menu [highlight-paren-mode]
       (menu-bar-make-mm-toggle
        show-paren-mode
        "Highlight Matching Parentheses"
        "Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))
-    (define-key menu [transient-mark-mode]
+    (bindings--define-key menu [transient-mark-mode]
       (menu-bar-make-mm-toggle
        transient-mark-mode
        "Highlight Active Region"
@@ -1338,109 +1330,109 @@ mail status in mode line"))
 (defvar menu-bar-games-menu
   (let ((menu (make-sparse-keymap "Games")))
 
-    (define-key menu [zone]
-      `(menu-item ,(purecopy "Zone Out")  zone
-                  :help ,(purecopy "Play tricks with Emacs display when Emacs is idle")))
-    (define-key menu [tetris]
-      `(menu-item ,(purecopy "Tetris")  tetris
-                  :help ,(purecopy "Falling blocks game")))
-    (define-key menu [solitaire]
-      `(menu-item ,(purecopy "Solitaire")  solitaire
-                  :help ,(purecopy "Get rid of all the stones")))
-    (define-key menu [snake]
-      `(menu-item ,(purecopy "Snake")  snake
-                  :help ,(purecopy "Move snake around avoiding collisions")))
-    (define-key menu [pong]
-      `(menu-item ,(purecopy "Pong") pong
-                  :help ,(purecopy "Bounce the ball to your opponent")))
-    (define-key menu [mult]
-      `(menu-item ,(purecopy "Multiplication Puzzle")  mpuz
-                  :help ,(purecopy "Exercise brain with multiplication")))
-    (define-key menu [life]
-      `(menu-item ,(purecopy "Life")  life
-                  :help ,(purecopy "Watch how John Conway's cellular automaton evolves")))
-    (define-key menu [land]
-      `(menu-item ,(purecopy "Landmark") landmark
-                  :help ,(purecopy "Watch a neural-network robot learn landmarks")))
-    (define-key menu [hanoi]
-      `(menu-item ,(purecopy "Towers of Hanoi") hanoi
-                  :help ,(purecopy "Watch Towers-of-Hanoi puzzle solved by Emacs")))
-    (define-key menu [gomoku]
-      `(menu-item ,(purecopy "Gomoku")  gomoku
-                  :help ,(purecopy "Mark 5 contiguous squares (like tic-tac-toe)")))
-    (define-key menu [bubbles]
-      `(menu-item ,(purecopy "Bubbles") bubbles
-                  :help ,(purecopy "Remove all bubbles using the fewest moves")))
-    (define-key menu [black-box]
-      `(menu-item ,(purecopy "Blackbox")  blackbox
-                  :help ,(purecopy "Find balls in a black box by shooting rays")))
-    (define-key menu [adventure]
-      `(menu-item ,(purecopy "Adventure")  dunnet
-                  :help ,(purecopy "Dunnet, a text Adventure game for Emacs")))
-    (define-key menu [5x5]
-      `(menu-item ,(purecopy "5x5") 5x5
-                  :help ,(purecopy "Fill in all the squares on a 5x5 board")))
+    (bindings--define-key menu [zone]
+      '(menu-item "Zone Out" zone
+                  :help "Play tricks with Emacs display when Emacs is idle"))
+    (bindings--define-key menu [tetris]
+      '(menu-item "Tetris" tetris
+                  :help "Falling blocks game"))
+    (bindings--define-key menu [solitaire]
+      '(menu-item "Solitaire" solitaire
+                  :help "Get rid of all the stones"))
+    (bindings--define-key menu [snake]
+      '(menu-item "Snake" snake
+                  :help "Move snake around avoiding collisions"))
+    (bindings--define-key menu [pong]
+      '(menu-item "Pong" pong
+                  :help "Bounce the ball to your opponent"))
+    (bindings--define-key menu [mult]
+      '(menu-item "Multiplication Puzzle"  mpuz
+                  :help "Exercise brain with multiplication"))
+    (bindings--define-key menu [life]
+      '(menu-item "Life"  life
+                  :help "Watch how John Conway's cellular automaton evolves"))
+    (bindings--define-key menu [land]
+      '(menu-item "Landmark" landmark
+                  :help "Watch a neural-network robot learn landmarks"))
+    (bindings--define-key menu [hanoi]
+      '(menu-item "Towers of Hanoi" hanoi
+                  :help "Watch Towers-of-Hanoi puzzle solved by Emacs"))
+    (bindings--define-key menu [gomoku]
+      '(menu-item "Gomoku"  gomoku
+                  :help "Mark 5 contiguous squares (like tic-tac-toe)"))
+    (bindings--define-key menu [bubbles]
+      '(menu-item "Bubbles" bubbles
+                  :help "Remove all bubbles using the fewest moves"))
+    (bindings--define-key menu [black-box]
+      '(menu-item "Blackbox"  blackbox
+                  :help "Find balls in a black box by shooting rays"))
+    (bindings--define-key menu [adventure]
+      '(menu-item "Adventure"  dunnet
+                  :help "Dunnet, a text Adventure game for Emacs"))
+    (bindings--define-key menu [5x5]
+      '(menu-item "5x5" 5x5
+                  :help "Fill in all the squares on a 5x5 board"))
     menu))
 
 (defvar menu-bar-encryption-decryption-menu
   (let ((menu (make-sparse-keymap "Encryption/Decryption")))
-    (define-key menu [insert-keys]
-      `(menu-item ,(purecopy "Insert Keys") epa-insert-keys
-                  :help ,(purecopy "Insert public keys after the current point")))
+    (bindings--define-key menu [insert-keys]
+      '(menu-item "Insert Keys" epa-insert-keys
+                  :help "Insert public keys after the current point"))
 
-    (define-key menu [export-keys]
-      `(menu-item ,(purecopy "Export Keys") epa-export-keys
-                  :help ,(purecopy "Export public keys to a file")))
+    (bindings--define-key menu [export-keys]
+      '(menu-item "Export Keys" epa-export-keys
+                  :help "Export public keys to a file"))
 
-    (define-key menu [import-keys-region]
-      `(menu-item ,(purecopy "Import Keys from Region") epa-import-keys-region
-                  :help ,(purecopy "Import public keys from the current region")))
+    (bindings--define-key menu [import-keys-region]
+      '(menu-item "Import Keys from Region" epa-import-keys-region
+                  :help "Import public keys from the current region"))
 
-    (define-key menu [import-keys]
-      `(menu-item ,(purecopy "Import Keys from File...") epa-import-keys
-                  :help ,(purecopy "Import public keys from a file")))
+    (bindings--define-key menu [import-keys]
+      '(menu-item "Import Keys from File..." epa-import-keys
+                  :help "Import public keys from a file"))
 
-    (define-key menu [list-keys]
-      `(menu-item ,(purecopy "List Keys") epa-list-keys
-                  :help ,(purecopy "Browse your public keyring")))
+    (bindings--define-key menu [list-keys]
+      '(menu-item "List Keys" epa-list-keys
+                  :help "Browse your public keyring"))
 
-    (define-key menu [separator-keys]
+    (bindings--define-key menu [separator-keys]
       menu-bar-separator)
 
-    (define-key menu [sign-region]
-      `(menu-item ,(purecopy "Sign Region") epa-sign-region
-                  :help ,(purecopy "Create digital signature of the current region")))
+    (bindings--define-key menu [sign-region]
+      '(menu-item "Sign Region" epa-sign-region
+                  :help "Create digital signature of the current region"))
 
-    (define-key menu [verify-region]
-      `(menu-item ,(purecopy "Verify Region") epa-verify-region
-                  :help ,(purecopy "Verify digital signature of the current region")))
+    (bindings--define-key menu [verify-region]
+      '(menu-item "Verify Region" epa-verify-region
+                  :help "Verify digital signature of the current region"))
 
-    (define-key menu [encrypt-region]
-      `(menu-item ,(purecopy "Encrypt Region") epa-encrypt-region
-                  :help ,(purecopy "Encrypt the current region")))
+    (bindings--define-key menu [encrypt-region]
+      '(menu-item "Encrypt Region" epa-encrypt-region
+                  :help "Encrypt the current region"))
 
-    (define-key menu [decrypt-region]
-      `(menu-item ,(purecopy "Decrypt Region") epa-decrypt-region
-                  :help ,(purecopy "Decrypt the current region")))
+    (bindings--define-key menu [decrypt-region]
+      '(menu-item "Decrypt Region" epa-decrypt-region
+                  :help "Decrypt the current region"))
 
-    (define-key menu [separator-file]
+    (bindings--define-key menu [separator-file]
       menu-bar-separator)
 
-    (define-key menu [sign-file]
-      `(menu-item ,(purecopy "Sign File...") epa-sign-file
-                  :help ,(purecopy "Create digital signature of a file")))
+    (bindings--define-key menu [sign-file]
+      '(menu-item "Sign File..." epa-sign-file
+                  :help "Create digital signature of a file"))
 
-    (define-key menu [verify-file]
-      `(menu-item ,(purecopy "Verify File...") epa-verify-file
-                  :help ,(purecopy "Verify digital signature of a file")))
+    (bindings--define-key menu [verify-file]
+      '(menu-item "Verify File..." epa-verify-file
+                  :help "Verify digital signature of a file"))
 
-    (define-key menu [encrypt-file]
-      `(menu-item ,(purecopy "Encrypt File...") epa-encrypt-file
-                  :help ,(purecopy "Encrypt a file")))
+    (bindings--define-key menu [encrypt-file]
+      '(menu-item "Encrypt File..." epa-encrypt-file
+                  :help "Encrypt a file"))
 
-    (define-key menu [decrypt-file]
-      `(menu-item ,(purecopy "Decrypt File...") epa-decrypt-file
-                  :help ,(purecopy "Decrypt a file")))
+    (bindings--define-key menu [decrypt-file]
+      '(menu-item "Decrypt File..." epa-decrypt-file
+                  :help "Decrypt a file"))
 
     menu))
 
@@ -1452,102 +1444,103 @@ mail status in mode line"))
 (defvar menu-bar-tools-menu
   (let ((menu (make-sparse-keymap "Tools")))
 
-    (define-key menu [games]
-      `(menu-item ,(purecopy "Games") ,menu-bar-games-menu))
+    (bindings--define-key menu [games]
+      `(menu-item "Games" ,menu-bar-games-menu))
 
-    (define-key menu [separator-games]
+    (bindings--define-key menu [separator-games]
       menu-bar-separator)
 
-    (define-key menu [encryption-decryption]
-      `(menu-item ,(purecopy "Encryption/Decryption") ,menu-bar-encryption-decryption-menu))
+    (bindings--define-key menu [encryption-decryption]
+      `(menu-item "Encryption/Decryption"
+                  ,menu-bar-encryption-decryption-menu))
 
-    (define-key menu [separator-encryption-decryption]
+    (bindings--define-key menu [separator-encryption-decryption]
       menu-bar-separator)
 
-    (define-key menu [simple-calculator]
-      `(menu-item ,(purecopy "Simple Calculator") calculator
-                  :help ,(purecopy "Invoke the Emacs built-in quick calculator")))
-    (define-key menu [calc]
-      `(menu-item ,(purecopy "Programmable Calculator") calc
-                  :help ,(purecopy "Invoke the Emacs built-in full scientific calculator")))
-    (define-key menu [calendar]
-      `(menu-item ,(purecopy "Calendar") calendar
-                  :help ,(purecopy "Invoke the Emacs built-in calendar")))
-
-    (define-key menu [separator-net]
+    (bindings--define-key menu [simple-calculator]
+      '(menu-item "Simple Calculator" calculator
+                  :help "Invoke the Emacs built-in quick calculator"))
+    (bindings--define-key menu [calc]
+      '(menu-item "Programmable Calculator" calc
+                  :help "Invoke the Emacs built-in full scientific calculator"))
+    (bindings--define-key menu [calendar]
+      '(menu-item "Calendar" calendar
+                  :help "Invoke the Emacs built-in calendar"))
+
+    (bindings--define-key menu [separator-net]
       menu-bar-separator)
 
-    (define-key menu [directory-search]
-      `(menu-item ,(purecopy "Directory Search") eudc-tools-menu))
-    (define-key menu [compose-mail]
-      `(menu-item (format "Send Mail (with %s)" (send-mail-item-name)) compose-mail
+    (bindings--define-key menu [directory-search]
+      '(menu-item "Directory Search" eudc-tools-menu))
+    (bindings--define-key menu [compose-mail]
+      '(menu-item (format "Send Mail (with %s)" (send-mail-item-name)) compose-mail
                   :visible (and mail-user-agent (not (eq mail-user-agent 'ignore)))
-                  :help ,(purecopy "Send a mail message")))
-    (define-key menu [rmail]
-      `(menu-item (format "Read Mail (with %s)" (read-mail-item-name))
+                  :help "Send a mail message"))
+    (bindings--define-key menu [rmail]
+      '(menu-item (format "Read Mail (with %s)" (read-mail-item-name))
                   menu-bar-read-mail
                   :visible (and read-mail-command
                                 (not (eq read-mail-command 'ignore)))
-                  :help ,(purecopy "Read your mail and reply to it")))
+                  :help "Read your mail and reply to it"))
 
-    (define-key menu [gnus]
-      `(menu-item ,(purecopy "Read Net News (Gnus)") gnus
-                  :help ,(purecopy "Read network news groups")))
+    (bindings--define-key menu [gnus]
+      '(menu-item "Read Net News (Gnus)" gnus
+                  :help "Read network news groups"))
 
-    (define-key menu [separator-vc]
+    (bindings--define-key menu [separator-vc]
       menu-bar-separator)
 
-    (define-key menu [pcl-cvs]
-      `(menu-item ,(purecopy "PCL-CVS") cvs-global-menu))
-    (define-key menu [vc] nil) ;Create the place for the VC menu.
+    (bindings--define-key menu [pcl-cvs]
+      '(menu-item "PCL-CVS" cvs-global-menu))
+    (bindings--define-key menu [vc] nil) ;Create the place for the VC menu.
 
-    (define-key menu [separator-compare]
+    (bindings--define-key menu [separator-compare]
       menu-bar-separator)
 
-    (define-key menu [epatch]
-      `(menu-item ,(purecopy "Apply Patch") menu-bar-epatch-menu))
-    (define-key menu [ediff-merge]
-      `(menu-item ,(purecopy "Merge") menu-bar-ediff-merge-menu))
-    (define-key menu [compare]
-      `(menu-item ,(purecopy "Compare (Ediff)") menu-bar-ediff-menu))
+    (bindings--define-key menu [epatch]
+      '(menu-item "Apply Patch" menu-bar-epatch-menu))
+    (bindings--define-key menu [ediff-merge]
+      '(menu-item "Merge" menu-bar-ediff-merge-menu))
+    (bindings--define-key menu [compare]
+      '(menu-item "Compare (Ediff)" menu-bar-ediff-menu))
 
-    (define-key menu [separator-spell]
+    (bindings--define-key menu [separator-spell]
       menu-bar-separator)
 
-    (define-key menu [spell]
-      `(menu-item ,(purecopy "Spell Checking") ispell-menu-map))
+    (bindings--define-key menu [spell]
+      '(menu-item "Spell Checking" ispell-menu-map))
 
-    (define-key menu [separator-prog]
+    (bindings--define-key menu [separator-prog]
       menu-bar-separator)
 
-    (define-key menu [semantic]
-      `(menu-item ,(purecopy "Source Code Parsers (Semantic)")
+    (bindings--define-key menu [semantic]
+      '(menu-item "Source Code Parsers (Semantic)"
                   semantic-mode
-                  :help ,(purecopy "Toggle automatic parsing in source code buffers (Semantic mode)")
+                  :help "Toggle automatic parsing in source code buffers (Semantic mode)"
                   :button (:toggle . (bound-and-true-p semantic-mode))))
 
-    (define-key menu [ede]
-      `(menu-item ,(purecopy "Project support (EDE)")
+    (bindings--define-key menu [ede]
+      '(menu-item "Project support (EDE)"
                   global-ede-mode
-                  :help ,(purecopy "Toggle the Emacs Development Environment (Global EDE mode)")
+                  :help "Toggle the Emacs Development Environment (Global EDE mode)"
                   :button (:toggle . (bound-and-true-p global-ede-mode))))
 
-    (define-key menu [gdb]
-      `(menu-item ,(purecopy "Debugger (GDB)...") gdb
-                  :help ,(purecopy "Debug a program from within Emacs with GDB")))
-    (define-key menu [shell-on-region]
-      `(menu-item ,(purecopy "Shell Command on Region...") shell-command-on-region
+    (bindings--define-key menu [gdb]
+      '(menu-item "Debugger (GDB)..." gdb
+                  :help "Debug a program from within Emacs with GDB"))
+    (bindings--define-key menu [shell-on-region]
+      '(menu-item "Shell Command on Region..." shell-command-on-region
                   :enable mark-active
-                  :help ,(purecopy "Pass marked region to a shell command")))
-    (define-key menu [shell]
-      `(menu-item ,(purecopy "Shell Command...") shell-command
-                  :help ,(purecopy "Invoke a shell command and catch its output")))
-    (define-key menu [compile]
-      `(menu-item ,(purecopy "Compile...") compile
-                  :help ,(purecopy "Invoke compiler or Make, view compilation errors")))
-    (define-key menu [grep]
-      `(menu-item ,(purecopy "Search Files (Grep)...") grep
-                  :help ,(purecopy "Search files for strings or regexps (with Grep)")))
+                  :help "Pass marked region to a shell command"))
+    (bindings--define-key menu [shell]
+      '(menu-item "Shell Command..." shell-command
+                  :help "Invoke a shell command and catch its output"))
+    (bindings--define-key menu [compile]
+      '(menu-item "Compile..." compile
+                  :help "Invoke compiler or Make, view compilation errors"))
+    (bindings--define-key menu [grep]
+      '(menu-item "Search Files (Grep)..." grep
+                  :help "Search files for strings or regexps (with Grep)"))
     menu))
 \f
 ;; The "Help" menu items
@@ -1555,54 +1548,54 @@ mail status in mode line"))
 (defvar menu-bar-describe-menu
   (let ((menu (make-sparse-keymap "Describe")))
 
-    (define-key menu [mule-diag]
-      `(menu-item ,(purecopy "Show All of Mule Status") mule-diag
+    (bindings--define-key menu [mule-diag]
+      '(menu-item "Show All of Mule Status" mule-diag
                   :visible (default-value 'enable-multibyte-characters)
-                  :help ,(purecopy "Display multilingual environment settings")))
-    (define-key menu [describe-coding-system-briefly]
-      `(menu-item ,(purecopy "Describe Coding System (Briefly)")
+                  :help "Display multilingual environment settings"))
+    (bindings--define-key menu [describe-coding-system-briefly]
+      '(menu-item "Describe Coding System (Briefly)"
                   describe-current-coding-system-briefly
                   :visible (default-value 'enable-multibyte-characters)))
-    (define-key menu [describe-coding-system]
-      `(menu-item ,(purecopy "Describe Coding System...") describe-coding-system
+    (bindings--define-key menu [describe-coding-system]
+      '(menu-item "Describe Coding System..." describe-coding-system
                   :visible (default-value 'enable-multibyte-characters)))
-    (define-key menu [describe-input-method]
-      `(menu-item ,(purecopy "Describe Input Method...") describe-input-method
+    (bindings--define-key menu [describe-input-method]
+      '(menu-item "Describe Input Method..." describe-input-method
                   :visible (default-value 'enable-multibyte-characters)
-                  :help ,(purecopy "Keyboard layout for specific input method")))
-    (define-key menu [describe-language-environment]
-      `(menu-item ,(purecopy "Describe Language Environment")
+                  :help "Keyboard layout for specific input method"))
+    (bindings--define-key menu [describe-language-environment]
+      `(menu-item "Describe Language Environment"
                   ,describe-language-environment-map))
 
-    (define-key menu [separator-desc-mule]
+    (bindings--define-key menu [separator-desc-mule]
       menu-bar-separator)
 
-    (define-key menu [list-keybindings]
-      `(menu-item ,(purecopy "List Key Bindings") describe-bindings
-                  :help ,(purecopy "Display all current key bindings (keyboard shortcuts)")))
-    (define-key menu [describe-current-display-table]
-      `(menu-item ,(purecopy "Describe Display Table") describe-current-display-table
-                  :help ,(purecopy "Describe the current display table")))
-    (define-key menu [describe-package]
-      `(menu-item ,(purecopy "Describe Package...") describe-package
-                  :help ,(purecopy "Display documentation of a Lisp package")))
-    (define-key menu [describe-face]
-      `(menu-item ,(purecopy "Describe Face...") describe-face
-                  :help ,(purecopy "Display the properties of a face")))
-    (define-key menu [describe-variable]
-      `(menu-item ,(purecopy "Describe Variable...") describe-variable
-                  :help ,(purecopy "Display documentation of variable/option")))
-    (define-key menu [describe-function]
-      `(menu-item ,(purecopy "Describe Function...") describe-function
-                  :help ,(purecopy "Display documentation of function/command")))
-    (define-key menu [describe-key-1]
-      `(menu-item ,(purecopy "Describe Key or Mouse Operation...") describe-key
+    (bindings--define-key menu [list-keybindings]
+      '(menu-item "List Key Bindings" describe-bindings
+                  :help "Display all current key bindings (keyboard shortcuts)"))
+    (bindings--define-key menu [describe-current-display-table]
+      '(menu-item "Describe Display Table" describe-current-display-table
+                  :help "Describe the current display table"))
+    (bindings--define-key menu [describe-package]
+      '(menu-item "Describe Package..." describe-package
+                  :help "Display documentation of a Lisp package"))
+    (bindings--define-key menu [describe-face]
+      '(menu-item "Describe Face..." describe-face
+                  :help "Display the properties of a face"))
+    (bindings--define-key menu [describe-variable]
+      '(menu-item "Describe Variable..." describe-variable
+                  :help "Display documentation of variable/option"))
+    (bindings--define-key menu [describe-function]
+      '(menu-item "Describe Function..." describe-function
+                  :help "Display documentation of function/command"))
+    (bindings--define-key menu [describe-key-1]
+      '(menu-item "Describe Key or Mouse Operation..." describe-key
                   ;; Users typically don't identify keys and menu items...
-                  :help ,(purecopy "Display documentation of command bound to a \
-key, a click, or a menu-item")))
-    (define-key menu [describe-mode]
-      `(menu-item ,(purecopy "Describe Buffer Modes") describe-mode
-                  :help ,(purecopy "Describe this buffer's major and minor mode")))
+                  :help "Display documentation of command bound to a \
+key, a click, or a menu-item"))
+    (bindings--define-key menu [describe-mode]
+      '(menu-item "Describe Buffer Modes" describe-mode
+                  :help "Describe this buffer's major and minor mode"))
     menu))
 
 (defun menu-bar-read-lispref ()
@@ -1635,64 +1628,64 @@ key, a click, or a menu-item")))
 (defvar menu-bar-search-documentation-menu
   (let ((menu (make-sparse-keymap "Search Documentation")))
 
-    (define-key menu [search-documentation-strings]
-      `(menu-item ,(purecopy "Search Documentation Strings...") apropos-documentation
+    (bindings--define-key menu [search-documentation-strings]
+      '(menu-item "Search Documentation Strings..." apropos-documentation
                   :help
-                  ,(purecopy "Find functions and variables whose doc strings match a regexp")))
-    (define-key menu [find-any-object-by-name]
-      `(menu-item ,(purecopy "Find Any Object by Name...") apropos
-                  :help ,(purecopy "Find symbols of any kind whose names match a regexp")))
-    (define-key menu [find-option-by-value]
-      `(menu-item ,(purecopy "Find Options by Value...") apropos-value
-                  :help ,(purecopy "Find variables whose values match a regexp")))
-    (define-key menu [find-options-by-name]
-      `(menu-item ,(purecopy "Find Options by Name...") apropos-variable
-                  :help ,(purecopy "Find variables whose names match a regexp")))
-    (define-key menu [find-commands-by-name]
-      `(menu-item ,(purecopy "Find Commands by Name...") apropos-command
-                  :help ,(purecopy "Find commands whose names match a regexp")))
-    (define-key menu [sep1]
+                  "Find functions and variables whose doc strings match a regexp"))
+    (bindings--define-key menu [find-any-object-by-name]
+      '(menu-item "Find Any Object by Name..." apropos
+                  :help "Find symbols of any kind whose names match a regexp"))
+    (bindings--define-key menu [find-option-by-value]
+      '(menu-item "Find Options by Value..." apropos-value
+                  :help "Find variables whose values match a regexp"))
+    (bindings--define-key menu [find-options-by-name]
+      '(menu-item "Find Options by Name..." apropos-variable
+                  :help "Find variables whose names match a regexp"))
+    (bindings--define-key menu [find-commands-by-name]
+      '(menu-item "Find Commands by Name..." apropos-command
+                  :help "Find commands whose names match a regexp"))
+    (bindings--define-key menu [sep1]
       menu-bar-separator)
-    (define-key menu [lookup-command-in-manual]
-      `(menu-item ,(purecopy "Look Up Command in User Manual...") Info-goto-emacs-command-node
-                  :help ,(purecopy "Display manual section that describes a command")))
-    (define-key menu [lookup-key-in-manual]
-      `(menu-item ,(purecopy "Look Up Key in User Manual...") Info-goto-emacs-key-command-node
-                  :help ,(purecopy "Display manual section that describes a key")))
-    (define-key menu [lookup-subject-in-elisp-manual]
-      `(menu-item ,(purecopy "Look Up Subject in ELisp Manual...") elisp-index-search
-                  :help ,(purecopy "Find description of a subject in Emacs Lisp manual")))
-    (define-key menu [lookup-subject-in-emacs-manual]
-      `(menu-item ,(purecopy "Look Up Subject in User Manual...") emacs-index-search
-                  :help ,(purecopy "Find description of a subject in Emacs User manual")))
-    (define-key menu [emacs-terminology]
-      `(menu-item ,(purecopy "Emacs Terminology") search-emacs-glossary
-                  :help ,(purecopy "Display the Glossary section of the Emacs manual")))
+    (bindings--define-key menu [lookup-command-in-manual]
+      '(menu-item "Look Up Command in User Manual..." Info-goto-emacs-command-node
+                  :help "Display manual section that describes a command"))
+    (bindings--define-key menu [lookup-key-in-manual]
+      '(menu-item "Look Up Key in User Manual..." Info-goto-emacs-key-command-node
+                  :help "Display manual section that describes a key"))
+    (bindings--define-key menu [lookup-subject-in-elisp-manual]
+      '(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search
+                  :help "Find description of a subject in Emacs Lisp manual"))
+    (bindings--define-key menu [lookup-subject-in-emacs-manual]
+      '(menu-item "Look Up Subject in User Manual..." emacs-index-search
+                  :help "Find description of a subject in Emacs User manual"))
+    (bindings--define-key menu [emacs-terminology]
+      '(menu-item "Emacs Terminology" search-emacs-glossary
+                  :help "Display the Glossary section of the Emacs manual"))
     menu))
 
 (defvar menu-bar-manuals-menu
   (let ((menu (make-sparse-keymap "More Manuals")))
 
-    (define-key menu [man]
-      `(menu-item ,(purecopy "Read Man Page...") manual-entry
-                  :help ,(purecopy "Man-page docs for external commands and libraries")))
-    (define-key menu [sep2]
+    (bindings--define-key menu [man]
+      '(menu-item "Read Man Page..." manual-entry
+                  :help "Man-page docs for external commands and libraries"))
+    (bindings--define-key menu [sep2]
       menu-bar-separator)
-    (define-key menu [order-emacs-manuals]
-      `(menu-item ,(purecopy "Ordering Manuals") view-order-manuals
-                  :help ,(purecopy "How to order manuals from the Free Software Foundation")))
-    (define-key menu [lookup-subject-in-all-manuals]
-      `(menu-item ,(purecopy "Lookup Subject in all Manuals...") info-apropos
-                  :help ,(purecopy "Find description of a subject in all installed manuals")))
-    (define-key menu [other-manuals]
-      `(menu-item ,(purecopy "All Other Manuals (Info)") Info-directory
-                  :help ,(purecopy "Read any of the installed manuals")))
-    (define-key menu [emacs-lisp-reference]
-      `(menu-item ,(purecopy "Emacs Lisp Reference") menu-bar-read-lispref
-                  :help ,(purecopy "Read the Emacs Lisp Reference manual")))
-    (define-key menu [emacs-lisp-intro]
-      `(menu-item ,(purecopy "Introduction to Emacs Lisp") menu-bar-read-lispintro
-                  :help ,(purecopy "Read the Introduction to Emacs Lisp Programming")))
+    (bindings--define-key menu [order-emacs-manuals]
+      '(menu-item "Ordering Manuals" view-order-manuals
+                  :help "How to order manuals from the Free Software Foundation"))
+    (bindings--define-key menu [lookup-subject-in-all-manuals]
+      '(menu-item "Lookup Subject in all Manuals..." info-apropos
+                  :help "Find description of a subject in all installed manuals"))
+    (bindings--define-key menu [other-manuals]
+      '(menu-item "All Other Manuals (Info)" Info-directory
+                  :help "Read any of the installed manuals"))
+    (bindings--define-key menu [emacs-lisp-reference]
+      '(menu-item "Emacs Lisp Reference" menu-bar-read-lispref
+                  :help "Read the Emacs Lisp Reference manual"))
+    (bindings--define-key menu [emacs-lisp-intro]
+      '(menu-item "Introduction to Emacs Lisp" menu-bar-read-lispintro
+                  :help "Read the Introduction to Emacs Lisp Programming"))
     menu))
 
 (defun menu-bar-help-extra-packages ()
@@ -1710,91 +1703,94 @@ key, a click, or a menu-item")))
 
 (defvar menu-bar-help-menu
   (let ((menu (make-sparse-keymap "Help")))
-    (define-key menu [about-gnu-project]
-      `(menu-item ,(purecopy "About GNU") describe-gnu-project
-                  :help ,(purecopy "About the GNU System, GNU Project, and GNU/Linux")))
-    (define-key menu [about-emacs]
-      `(menu-item ,(purecopy "About Emacs") about-emacs
-                  :help ,(purecopy "Display version number, copyright info, and basic help")))
-    (define-key menu [sep4]
+    (bindings--define-key menu [about-gnu-project]
+      '(menu-item "About GNU" describe-gnu-project
+                  :help "About the GNU System, GNU Project, and GNU/Linux"))
+    (bindings--define-key menu [about-emacs]
+      '(menu-item "About Emacs" about-emacs
+                  :help "Display version number, copyright info, and basic help"))
+    (bindings--define-key menu [sep4]
       menu-bar-separator)
-    (define-key menu [describe-no-warranty]
-      `(menu-item ,(purecopy "(Non)Warranty") describe-no-warranty
-                  :help ,(purecopy "Explain that Emacs has NO WARRANTY")))
-    (define-key menu [describe-copying]
-      `(menu-item ,(purecopy "Copying Conditions") describe-copying
-                  :help ,(purecopy "Show the Emacs license (GPL)")))
-    (define-key menu [getting-new-versions]
-      `(menu-item ,(purecopy "Getting New Versions") describe-distribution
-                  :help ,(purecopy "How to get the latest version of Emacs")))
-    (define-key menu [sep2]
+    (bindings--define-key menu [describe-no-warranty]
+      '(menu-item "(Non)Warranty" describe-no-warranty
+                  :help "Explain that Emacs has NO WARRANTY"))
+    (bindings--define-key menu [describe-copying]
+      '(menu-item "Copying Conditions" describe-copying
+                  :help "Show the Emacs license (GPL)"))
+    (bindings--define-key menu [getting-new-versions]
+      '(menu-item "Getting New Versions" describe-distribution
+                  :help "How to get the latest version of Emacs"))
+    (bindings--define-key menu [sep2]
       menu-bar-separator)
-    (define-key menu [external-packages]
-      `(menu-item ,(purecopy "Finding Extra Packages") menu-bar-help-extra-packages
-                  :help ,(purecopy "Lisp packages distributed separately for use in Emacs")))
-    (define-key menu [find-emacs-packages]
-      `(menu-item ,(purecopy "Search Built-in Packages") finder-by-keyword
-                  :help ,(purecopy "Find built-in packages and features by keyword")))
-    (define-key menu [more-manuals]
-      `(menu-item ,(purecopy "More Manuals") ,menu-bar-manuals-menu))
-    (define-key menu [emacs-manual]
-      `(menu-item ,(purecopy "Read the Emacs Manual") info-emacs-manual
-                  :help ,(purecopy "Full documentation of Emacs features")))
-    (define-key menu [describe]
-      `(menu-item ,(purecopy "Describe") ,menu-bar-describe-menu))
-    (define-key menu [search-documentation]
-      `(menu-item ,(purecopy "Search Documentation") ,menu-bar-search-documentation-menu))
-    (define-key menu [sep1]
+    (bindings--define-key menu [external-packages]
+      '(menu-item "Finding Extra Packages" menu-bar-help-extra-packages
+                  :help "Lisp packages distributed separately for use in Emacs"))
+    (bindings--define-key menu [find-emacs-packages]
+      '(menu-item "Search Built-in Packages" finder-by-keyword
+                  :help "Find built-in packages and features by keyword"))
+    (bindings--define-key menu [more-manuals]
+      `(menu-item "More Manuals" ,menu-bar-manuals-menu))
+    (bindings--define-key menu [emacs-manual]
+      '(menu-item "Read the Emacs Manual" info-emacs-manual
+                  :help "Full documentation of Emacs features"))
+    (bindings--define-key menu [describe]
+      `(menu-item "Describe" ,menu-bar-describe-menu))
+    (bindings--define-key menu [search-documentation]
+      `(menu-item "Search Documentation" ,menu-bar-search-documentation-menu))
+    (bindings--define-key menu [sep1]
       menu-bar-separator)
-    (define-key menu [emacs-psychotherapist]
-      `(menu-item ,(purecopy "Emacs Psychotherapist") doctor
-                  :help ,(purecopy "Our doctor will help you feel better")))
-    (define-key menu [send-emacs-bug-report]
-      `(menu-item ,(purecopy "Send Bug Report...") report-emacs-bug
-                  :help ,(purecopy "Send e-mail to Emacs maintainers")))
-    (define-key menu [emacs-known-problems]
-      `(menu-item ,(purecopy "Emacs Known Problems") view-emacs-problems
-                  :help ,(purecopy "Read about known problems with Emacs")))
-    (define-key menu [emacs-news]
-      `(menu-item ,(purecopy "Emacs News") view-emacs-news
-                  :help ,(purecopy "New features of this version")))
-    (define-key menu [emacs-faq]
-      `(menu-item ,(purecopy "Emacs FAQ") view-emacs-FAQ
-                  :help ,(purecopy "Frequently asked (and answered) questions about Emacs")))
-
-    (define-key menu [emacs-tutorial-language-specific]
-      `(menu-item ,(purecopy "Emacs Tutorial (choose language)...")
+    (bindings--define-key menu [emacs-psychotherapist]
+      '(menu-item "Emacs Psychotherapist" doctor
+                  :help "Our doctor will help you feel better"))
+    (bindings--define-key menu [send-emacs-bug-report]
+      '(menu-item "Send Bug Report..." report-emacs-bug
+                  :help "Send e-mail to Emacs maintainers"))
+    (bindings--define-key menu [emacs-manual-bug]
+      '(menu-item "How to Report a Bug" info-emacs-bug
+                  :help "Read about how to report an Emacs bug"))
+    (bindings--define-key menu [emacs-known-problems]
+      '(menu-item "Emacs Known Problems" view-emacs-problems
+                  :help "Read about known problems with Emacs"))
+    (bindings--define-key menu [emacs-news]
+      '(menu-item "Emacs News" view-emacs-news
+                  :help "New features of this version"))
+    (bindings--define-key menu [emacs-faq]
+      '(menu-item "Emacs FAQ" view-emacs-FAQ
+                  :help "Frequently asked (and answered) questions about Emacs"))
+
+    (bindings--define-key menu [emacs-tutorial-language-specific]
+      '(menu-item "Emacs Tutorial (choose language)..."
                   help-with-tutorial-spec-language
-                  :help ,(purecopy "Learn how to use Emacs (choose a language)")))
-    (define-key menu [emacs-tutorial]
-      `(menu-item ,(purecopy "Emacs Tutorial") help-with-tutorial
-                  :help ,(purecopy "Learn how to use Emacs")))
+                  :help "Learn how to use Emacs (choose a language)"))
+    (bindings--define-key menu [emacs-tutorial]
+      '(menu-item "Emacs Tutorial" help-with-tutorial
+                  :help "Learn how to use Emacs"))
 
     ;; In OS X it's in the app menu already.
     ;; FIXME? There already is an "About Emacs" (sans ...) entry in the Help menu.
     (and (featurep 'ns)
          (not (eq system-type 'darwin))
-         (define-key menu [info-panel]
-           `(menu-item ,(purecopy "About Emacs...") ns-do-emacs-info-panel)))
+         (bindings--define-key menu [info-panel]
+           '(menu-item "About Emacs..." ns-do-emacs-info-panel)))
     menu))
 
-(define-key global-map [menu-bar tools]
-  (cons (purecopy "Tools") menu-bar-tools-menu))
-(define-key global-map [menu-bar buffer]
-  (cons (purecopy "Buffers") global-buffers-menu-map))
-(define-key global-map [menu-bar options]
-  (cons (purecopy "Options") menu-bar-options-menu))
-(define-key global-map [menu-bar edit]
-  (cons (purecopy "Edit") menu-bar-edit-menu))
-(define-key global-map [menu-bar file]
-  (cons (purecopy "File") menu-bar-file-menu))
+(bindings--define-key global-map [menu-bar tools]
+  (cons "Tools" menu-bar-tools-menu))
+(bindings--define-key global-map [menu-bar buffer]
+  (cons "Buffers" global-buffers-menu-map))
+(bindings--define-key global-map [menu-bar options]
+  (cons "Options" menu-bar-options-menu))
+(bindings--define-key global-map [menu-bar edit]
+  (cons "Edit" menu-bar-edit-menu))
+(bindings--define-key global-map [menu-bar file]
+  (cons "File" menu-bar-file-menu))
 
 ;; Put "Help" menu at the end, or Info at the front.
 ;; If running under GNUstep, "Help" is moved and renamed "Info" (see below).
 (if (and (featurep 'ns)
          (not (eq system-type 'darwin)))
-    (define-key global-map [menu-bar help-menu]
-      (cons (purecopy "Info") menu-bar-help-menu))
+    (bindings--define-key global-map [menu-bar help-menu]
+      (cons "Info" menu-bar-help-menu))
   (define-key-after global-map [menu-bar help-menu]
     (cons (purecopy "Help") menu-bar-help-menu)))
 
@@ -2114,40 +2110,40 @@ It must accept a buffer as its only required argument.")
                   ;; This shouldn't be necessary, but there's a funny
                   ;; bug in keymap.c that I don't understand yet.  -stef
                   minibuffer-local-completion-map))
-  (define-key map [menu-bar minibuf]
-    (cons (purecopy "Minibuf") (make-sparse-keymap "Minibuf"))))
+  (bindings--define-key map [menu-bar minibuf]
+    (cons "Minibuf" (make-sparse-keymap "Minibuf"))))
 
 (let ((map minibuffer-local-completion-map))
-  (define-key map [menu-bar minibuf ?\?]
-    `(menu-item ,(purecopy "List Completions") minibuffer-completion-help
-               :help ,(purecopy "Display all possible completions")))
-  (define-key map [menu-bar minibuf space]
-    `(menu-item ,(purecopy "Complete Word") minibuffer-complete-word
-               :help ,(purecopy "Complete at most one word")))
-  (define-key map [menu-bar minibuf tab]
-    `(menu-item ,(purecopy "Complete") minibuffer-complete
-               :help ,(purecopy "Complete as far as possible"))))
+  (bindings--define-key map [menu-bar minibuf ?\?]
+    '(menu-item "List Completions" minibuffer-completion-help
+               :help "Display all possible completions"))
+  (bindings--define-key map [menu-bar minibuf space]
+    '(menu-item "Complete Word" minibuffer-complete-word
+               :help "Complete at most one word"))
+  (bindings--define-key map [menu-bar minibuf tab]
+    '(menu-item "Complete" minibuffer-complete
+               :help "Complete as far as possible")))
 
 (let ((map minibuffer-local-map))
-  (define-key map [menu-bar minibuf quit]
-    `(menu-item ,(purecopy "Quit") abort-recursive-edit
-               :help ,(purecopy "Abort input and exit minibuffer")))
-  (define-key map [menu-bar minibuf return]
-    `(menu-item ,(purecopy "Enter") exit-minibuffer
-               :key-sequence ,(purecopy "\r")
-               :help ,(purecopy "Terminate input and exit minibuffer")))
-  (define-key map [menu-bar minibuf isearch-forward]
-    `(menu-item ,(purecopy "Isearch History Forward") isearch-forward
-               :help ,(purecopy "Incrementally search minibuffer history forward")))
-  (define-key map [menu-bar minibuf isearch-backward]
-    `(menu-item ,(purecopy "Isearch History Backward") isearch-backward
-               :help ,(purecopy "Incrementally search minibuffer history backward")))
-  (define-key map [menu-bar minibuf next]
-    `(menu-item ,(purecopy "Next History Item") next-history-element
-               :help ,(purecopy "Put next minibuffer history element in the minibuffer")))
-  (define-key map [menu-bar minibuf previous]
-    `(menu-item ,(purecopy "Previous History Item") previous-history-element
-               :help ,(purecopy "Put previous minibuffer history element in the minibuffer"))))
+  (bindings--define-key map [menu-bar minibuf quit]
+    '(menu-item "Quit" abort-recursive-edit
+               :help "Abort input and exit minibuffer"))
+  (bindings--define-key map [menu-bar minibuf return]
+    '(menu-item "Enter" exit-minibuffer
+               :key-sequence "\r"
+               :help "Terminate input and exit minibuffer"))
+  (bindings--define-key map [menu-bar minibuf isearch-forward]
+    '(menu-item "Isearch History Forward" isearch-forward
+               :help "Incrementally search minibuffer history forward"))
+  (bindings--define-key map [menu-bar minibuf isearch-backward]
+    '(menu-item "Isearch History Backward" isearch-backward
+               :help "Incrementally search minibuffer history backward"))
+  (bindings--define-key map [menu-bar minibuf next]
+    '(menu-item "Next History Item" next-history-element
+               :help "Put next minibuffer history element in the minibuffer"))
+  (bindings--define-key map [menu-bar minibuf previous]
+    '(menu-item "Previous History Item" previous-history-element
+               :help "Put previous minibuffer history element in the minibuffer")))
 \f
 (define-minor-mode menu-bar-mode
   "Toggle display of a menu bar on each frame (Menu Bar mode).
index 0a15a65dc715f653f832ff6b3379ba7e67e06a0a..6eedef1980e971a92a77d20690b9d5aa8ee679bf 100644 (file)
@@ -1,6 +1,11 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-04-25  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * Version 24.1 released.
+       * mh-utils.el (minibuffer-completing-file-name): Don't declare, unused.
+
+2012-04-21  Juanma Barranquero  <lekktu@gmail.com>
+
+       * mh-folder.el (top): Check whether which-func-modes is t before
+       adding mh-folder-mode.
 
 2011-11-20  Bill Wohler  <wohler@newt.com>
 
 
        * mh-mime.el (mh-decode-message-subject): New function to decode
        RFC2047 encoded Subject lines.  Used for reply drafts.
-       * mh-comp.el (mh-compose-and-send-mail): Call
-       `mh-decode-message-subject' on (reply or forward) message drafts.
+       * mh-comp.el (mh-compose-and-send-mail):
+       Call `mh-decode-message-subject' on (reply or forward) message drafts.
 
 2010-05-07  Chong Yidong  <cyd@stupidchicken.com>
 
        * mh-show.el (mh-show-preferred-alternative)
        * mh-e.el (mh-annotate-msg-hook): Sync docstring with manual.
 
-       * mh-comp.el (mh-send-letter, mh-redistribute): Mention
-       mh-annotate-msg-hook in docstring.
+       * mh-comp.el (mh-send-letter, mh-redistribute):
+       Mention mh-annotate-msg-hook in docstring.
 
 2008-06-29  Jeffrey C Honig  <jch@honig.net>
 
 
 2008-05-23  Bill Wohler  <wohler@newt.com>
 
-       * mh-e.el (mh-invisible-header-fields-internal): Remove
-       DKIM-Signature as it is covered by DKIM-.  Fully qualify X-EID.
+       * mh-e.el (mh-invisible-header-fields-internal):
+       Remove DKIM-Signature as it is covered by DKIM-.  Fully qualify X-EID.
 
 2008-05-19  Sergey Poznyakoff  <gray@gnu.org.ua>
 
 
 2007-08-21  Jeffrey C Honig  <jch@honig.net>
 
-       * mh-folder.el (mh-folder-message-menu, mh-folder-mode-map): Add
-       folder mode support for mh-show-preferred-alternative (closes SF
+       * mh-folder.el (mh-folder-message-menu, mh-folder-mode-map):
+       Add folder mode support for mh-show-preferred-alternative (closes SF
        #1777321).
 
        * mh-show.el (mh-show-preferred-alternative)
        HTML when text content is lacking (closes SF #1777321).
 
        * mh-e.el:
-       (mh-invisible-header-fields-internal): Exclude Fax and Phone.  Put
-       known exclusions as comments before the list and move parens to
+       (mh-invisible-header-fields-internal): Exclude Fax and Phone.
+       Put known exclusions as comments before the list and move parens to
        separate lines to aid in sorting (closes SF #1701231).
 
        * mh-mime.el (mm-decode-body): Remove explicit autoload of
        (mh-tool-bar-folder-buttons-set, mh-tool-bar-letter-buttons-set):
        Call it (closes SF #1452718).
 
-       * mh-folder.el (mh-folder-buttons-init-flag): Delete.  Use
-       mh-folder-tool-bar-map instead.
+       * mh-folder.el (mh-folder-buttons-init-flag): Delete.
+       Use mh-folder-tool-bar-map instead.
        (image-load-path): Delete.  No longer used.
-       (mh-folder-mode): Moved setting of image-load-path into
+       (mh-folder-mode): Move setting of image-load-path into
        mh-tool-bar-folder-buttons-init.
 
-       * mh-letter.el (mh-letter-buttons-init-flag): Delete.  Use
-       mh-letter-tool-bar-map instead.
+       * mh-letter.el (mh-letter-buttons-init-flag): Delete.
+       Use mh-letter-tool-bar-map instead.
        (image-load-path): Delete.  No longer used.
-       (mh-letter-mode): Moved setting of image-load-path into
+       (mh-letter-mode): Move setting of image-load-path into
        mh-tool-bar-letter-buttons-init.
 
        * mh-seq.el (mh-narrow-to-seq, mh-widen): Use with-current-buffer
        (mh-print-background-flag, mh-show-maximum-size)
        (mh-show-use-xface-flag, mh-store-default-directory)
        (mh-summary-height, mh-speed-update-interval)
-       (mh-show-threads-flag, mh-tool-bar-search-function): Add
-       :package-version keyword to these options (closes SF #1452724).
+       (mh-show-threads-flag, mh-tool-bar-search-function):
+       Add :package-version keyword to these options (closes SF #1452724).
        (mh-after-commands-processed-hook)
        (mh-alias-reloaded-hook, mh-before-commands-processed-hook)
        (mh-before-quit-hook, mh-before-send-letter-hook)
        (mh-speedbar-selected-folder-with-unseen-messages): : Add
        :package-version keyword to these faces (closes SF #1452724).
 
-       * mh-tool-bar.el (mh-tool-bar-define): Added commented-out
+       * mh-tool-bar.el (mh-tool-bar-define): Add commented-out
        :package-version keywords (closes SF #1452724).
 
 2006-03-28  Bill Wohler  <wohler@newt.com>
 
        * mh-tool-bar.el: Use clipboard-kill-region,
        clipboard-kill-ring-save, and clipboard-yank instead of undo,
-       kill-region, and menu-bar-kill-ring-save respectively.  In
-       MH-Letter mode, move save-buffer and mh-fully-kill-draft icons in
+       kill-region, and menu-bar-kill-ring-save respectively.
+       In MH-Letter mode, move save-buffer and mh-fully-kill-draft icons in
        front of mh-compose-insertion to be consistent with other mailers,
        such as Evolution.  In MH-Folder mode, move vanilla reply icon to
        the left of the other reply icons.  Use mail/inbox icon instead of
 
 2006-03-14  Bill Wohler  <wohler@newt.com>
 
-       * mh-compat.el (mh-image-load-path-for-library): Incorporate
-       changes from image-load-path-for-library, which are:
+       * mh-compat.el (mh-image-load-path-for-library):
+       Incorporate changes from image-load-path-for-library, which are:
        (image-load-path-for-library): Pass value of path rather than
        symbol.  Always return list of directories.  Guarantee that image
        directory comes first.
        flag to replace-in-string.  This was badly needed by
        mh-quote-pick-expr in order to properly quote subjects when using
        / s on XEmacs (closes SF #1447598).
-       (mh-image-load-path-for-library): Merged changes from Reiner.  Add
-       no-error argument.  If path t, just return directory.
+       (mh-image-load-path-for-library): Merged changes from Reiner.
+       Add no-error argument.  If path t, just return directory.
 
        * mh-e.el (mh-profile-component): Drop `s' from mhparam
        -components for Mailutils compatibility (closes SF #1446985).
        local variable mh-image-directory to image-directory.  Move error
        checks to default case in cond and simplify.
 
-       * mh-comp.el (mh-send-letter, mh-insert-auto-fields): Sync
-       docstrings with manual.
+       * mh-comp.el (mh-send-letter, mh-insert-auto-fields):
+       Sync docstrings with manual.
 
 2006-03-02  Bill Wohler  <wohler@newt.com>
 
 
        * mh-utils.el (mh-image-directory)
        (mh-image-load-path-called-flag): Delete.
-       (mh-image-load-path): Incorporate changes from Gnus team.  Biggest
-       changes are that it no longer uses/sets mh-image-directory or
+       (mh-image-load-path): Incorporate changes from Gnus team.
+       Biggest changes are that it no longer uses/sets mh-image-directory or
        mh-image-load-path-called-flag, and returns the updated path
        rather than change it.
        (mh-logo-display): Change usage of mh-image-load-path.
        goto-addr.el.
        (mh-alias-suggest-alias): Use goto-address-mail-regexp instead of
        mh-address-mail-regexp.
-       (mh-alias-add-address-under-point): Use
-       goto-address-find-address-at-point instead of
+       (mh-alias-add-address-under-point):
+       Use goto-address-find-address-at-point instead of
        mh-goto-address-find-address-at-point.
 
        * mh-e.el (mh-show-use-goto-addr-flag): Delete.
 
 2006-02-08  Peter S Galbraith  <psg@debian.org>
 
-       * mh-e.el (mh-invisible-header-fields-internal): Added entries
+       * mh-e.el (mh-invisible-header-fields-internal): Add entries
        "X-BrightmailFiltered:", "X-Brightmail-Tracker:" and "X-Hashcash".
 
 2006-02-04  Bill Wohler  <wohler@newt.com>
 
        * mh-search.el (which-func-mode): Shush compiler on Emacs 21 too.
 
-       * mh-alias.el (mh-alias-gecos-name): Use
-       mh-replace-regexp-in-string instead of replace-regexp-in-string.
+       * mh-alias.el (mh-alias-gecos-name):
+       Use mh-replace-regexp-in-string instead of replace-regexp-in-string.
        (crm, multi-prompt): Use mh-require instead of require.
-       (mh-goto-address-find-address-at-point): Use
-       mh-line-beginning-position and mh-line-end-position instead of
-       line-beginning-position and line-end-position.  Use
-       mh-match-string-no-properties instead of
+       (mh-goto-address-find-address-at-point):
+       Use mh-line-beginning-position and mh-line-end-position instead of
+       line-beginning-position and line-end-position.
+       Use mh-match-string-no-properties instead of
        match-string-no-properties.
 
-       * mh-comp.el (mh-modify-header-field): Use
-       mh-line-beginning-position and mh-line-end-position instead of
+       * mh-comp.el (mh-modify-header-field):
+       Use mh-line-beginning-position and mh-line-end-position instead of
        line-beginning-position and line-end-position.
 
        * mh-compat.el (mailabbrev): Use mh-require instead of require.
        mh-line-end-position instead of line-beginning-position and
        line-end-position.
 
-       * mh-limit.el (mh-subject-to-sequence-unthreaded): Use
-       mh-match-string-no-properties instead of
+       * mh-limit.el (mh-subject-to-sequence-unthreaded):
+       Use mh-match-string-no-properties instead of
        match-string-no-properties.
        (mh-narrow-to-header-field): Use mh-line-beginning-position and
        mh-line-end-position instead of line-beginning-position and
        line-end-position.
 
        * mh-mime.el (mh-mime-inline-part, mh-mm-display-part)
-       (mh-mh-quote-unescaped-sharp, mh-mh-directive-present-p): Use
-       mh-line-beginning-position and mh-line-end-position instead of
+       (mh-mh-quote-unescaped-sharp, mh-mh-directive-present-p):
+       Use mh-line-beginning-position and mh-line-end-position instead of
        line-beginning-position and line-end-position.
 
        * mh-search.el (which-func): Use mh-require instead of require.
        (mh-mairix-next-result, mh-namazu-next-result)
        (mh-pick-next-result, mh-grep-next-result)
        (mh-index-create-imenu-index, mh-index-match-checksum)
-       (mh-md5sum-parser, mh-openssl-parser, mh-index-update-maps): Use
-       mh-line-beginning-position and mh-line-end-position instead of
+       (mh-md5sum-parser, mh-openssl-parser, mh-index-update-maps):
+       Use mh-line-beginning-position and mh-line-end-position instead of
        line-beginning-position and line-end-position.
 
        * mh-seq.el (mh-list-sequences): Use mh-view-mode-enter instead of
        (mh-speed-flists): Use mh-cancel-timer instead of cancel-timer.
 
        * mh-thread.el (mh-thread-find-children)
-       (mh-thread-parse-scan-line, mh-thread-generate): Use
-       mh-line-beginning-position and mh-line-end-position instead of
+       (mh-thread-parse-scan-line, mh-thread-generate):
+       Use mh-line-beginning-position and mh-line-end-position instead of
        line-beginning-position and line-end-position.
 
        * mh-utils.el (mh-colors-available-p): Use mh-display-color-cells
        (mh-letter-header-field-regexp, mh-pgp-support-flag)
        (mh-x-mailer-string): Move here from mh-comp.el.
        (mh-folder-line-matches-show-buffer-p): Move to mh-alias.el.
-       (mh-thread-scan-line-map, mh-thread-scan-line-map-stack): Move
-       here from mh-seq.el.
+       (mh-thread-scan-line-map, mh-thread-scan-line-map-stack):
+       Move here from mh-seq.el.
        (mh-draft-folder, mh-inbox, mh-user-path, mh-current-folder)
        (mh-previous-window-config, mh-seen-list, mh-seq-list)
        (mh-show-buffer, mh-showing-mode, mh-globals-hash)
        (mh-show-mouse, mh-modify, mh-goto-msg, mh-set-folder-modified-p):
        Move to new file mh-folder.el.
        (with-mh-folder-updating, mh-in-show-buffer)
-       (mh-do-at-event-location, mh-seq-msgs): Moved to mh-acros.el.
+       (mh-do-at-event-location, mh-seq-msgs): Move to mh-acros.el.
        (mh-make-seq, mh-seq-name, mh-notate, mh-find-seq)
        (mh-seq-to-msgs, mh-add-msgs-to-seq, mh-canonicalize-sequence):
-       Moved to mh-seq.el.
+       Move to mh-seq.el.
        (mh-show-xface-function, mh-uncompface-executable, mh-face-to-png)
        (mh-uncompface, mh-icontopbm, mh-face-foreground-compat)
        (mh-face-background-compat, mh-face-display-function)
        mh-init.el.
        (mh-help-messages): Now an alist of modes to an alist of messages.
        (mh-set-help): New function used to set mh-help-messages.
-       (mh-help): Adjust for new format of mh-help-messages.  Add
-       help-messages argument.
+       (mh-help): Adjust for new format of mh-help-messages.
+       Add help-messages argument.
        (mh-prefix-help): Refactor to use mh-help.
        (mh-coalesce-msg-list, mh-greaterp, mh-lessp): Move here from
        mh-e.el.
        (mh-search-mode-map): Autoload so that keys are shown in help even
        before mh-search is loaded.
        (mh-search-mode): Sync docstring with manual.
-       (mh-index-do-search): Rename argument indexer to searcher.  Sync
-       docstring with manual.
+       (mh-index-do-search): Rename argument indexer to searcher.
+       Sync docstring with manual.
        (mh-pick-do-search): Sync docstring with manual.
        (mh-index-p): Rename to mh-search-p.
        (mh-indexer-choices): Rename to mh-search-choices.
 
 2006-01-13  Bill Wohler  <wohler@newt.com>
 
-       * mh-acros.el (require): Added Satyaki's comment regarding what
+       * mh-acros.el (require): Add Satyaki's comment regarding what
        needs to happen to remove this defadvice which caused a little
        discussion on emacs-devel today (see Subject: mh-e/mh-acros.el
        advices `require' incorrectly).
        * mh-gnus.el: Require mh-acros.
        (mh-defmacro-compat, mh-defun-compat): Move to mh-acros.el.
 
-       * mh-utils.el (mh-x-image-url-cache-canonicalize): Use
-       url-hexify-string to remove special characters from filenames
+       * mh-utils.el (mh-x-image-url-cache-canonicalize):
+       Use url-hexify-string to remove special characters from filenames
        (closes SF #1396499).  Note that this invalidates the existing
        names in your cache so you might as well remove
        ~/Mail/.mhe-x-image-cache/* now.
        than file-executable-p which returns t for directories.
        (mh-file-command-p): Move here from mh-utils, since
        mh-variant-*-info are the only functions to use it.
-       (mh-variant-set, mh-variant-set-variant, mh-variant-p): Use
-       function mh-variants instead of variable.  More robust.
+       (mh-variant-set, mh-variant-set-variant, mh-variant-p):
+       Use function mh-variants instead of variable.  More robust.
        (mh-find-path-run): Move here from mh-utils.el.  Mention that
        checking this variable is unnecessary.
        (mh-find-path): Move here from mh-utils.el.  With the advent of MH
        variants and an mhparam command that doesn't work if there isn't
-       an MH profile, we can't get libdir for running install-mh.  So
-       don't bother.  If there's an issue with the environment, direct the
-       user to install MH and run install-mh (closes SF #835192).  Don't
-       read ~/.mh_profile directly.  Use mh-profile-component which uses
+       an MH profile, we can't get libdir for running install-mh.
+       So don't bother.  If there's an issue with the environment, direct the
+       user to install MH and run install-mh (closes SF #835192).
+       Don't read ~/.mh_profile directly.  Use mh-profile-component which uses
        mhparam (closes SF #1016027).
 
        * mh-utils.el (mh-get-profile-field): Rename to
        (mh-no-install, mh-install): Delete.
 
        * mh-customize.el (mh-folder-msg-number):
-       * mh-mime.el (mh-file-mime-type): Removed trailing whitespace.
+       * mh-mime.el (mh-file-mime-type): Remove trailing whitespace.
 
 2006-01-09  Bill Wohler  <wohler@newt.com>
 
-       * mh-init.el (mh-variant-mu-mh-info, mh-variant-nmh-info): Applied
-       patch from Satyaki from SF #1016027.
+       * mh-init.el (mh-variant-mu-mh-info, mh-variant-nmh-info):
+       Applied patch from Satyaki from SF #1016027.
 
        * mh-e.el (mh-rescan-folder): Try to keep cursor at current
        message, even if cur sequence is no longer present (closes SF
 
        * mh-comp.el: Require cleanup, wrap compiler-shushing defvars with
        eval-when-compile.
-       (mh-file-is-vcard-p): Removed redundant test.
+       (mh-file-is-vcard-p): Remove redundant test.
 
        * mh-customize.el: Require cleanup, wrap compiler-shushing defvars
        with eval-when-compile.
 
        * mh-mime.el: Wrap compiler-shushing defvars with
        eval-when-compile.
-       (mh-have-file-command): Initialize variable to 'undefined.  Add
-       docstring.  Update function of same name accordingly.  Also don't
+       (mh-have-file-command): Initialize variable to 'undefined.
+       Add docstring.  Update function of same name accordingly.  Also don't
        need to load executable any more.
        (mh-mime-content-types): Delete.
        (mh-minibuffer-read-type): Prompt user for type if
        with manual.
        (mh-yank-cur-msg): Mention that mh-ins-buf-prefix isn't used if
        you have added a mail-citation-hook and neither are used if you
-       use one of the supercite flavors of mh-yank-behavior.  Sync
-       docstrings with manual.
+       use one of the supercite flavors of mh-yank-behavior.
+       Sync docstrings with manual.
 
-       * mh-customize.el (mh-kill-folder-suppress-prompt-hooks): Rename
-       from mh-kill-folder-suppress-prompt-hook since it is an abnormal
+       * mh-customize.el (mh-kill-folder-suppress-prompt-hooks):
+       Rename from mh-kill-folder-suppress-prompt-hook since it is an abnormal
        hook.  Use "Hook run by `function'..." instead of "Invoked...".
        Sync docstrings with manual.
        (mh-ins-buf-prefix, mh-yank-behavior): Mention that
 
        * mh-customize.el (mh-speed-flists-interval): Rename to
        mh-speed-update-interval.
-       (mh-speed-run-flists-flag): Delete.  Setting
-       mh-speed-flists-interval to 0 accomplishes the same thing.
+       (mh-speed-run-flists-flag): Delete.
+       Setting mh-speed-flists-interval to 0 accomplishes the same thing.
 
-       * mh-speed.el (mh-folder-speedbar-buttons, mh-speed-flists): Use
-       mh-speed-update-interval instead of mh-speed-run-flists-flag.
-       (mh-speed-toggle, mh-speed-view, mh-speed-refresh): Sync
-       docstrings with manual.
+       * mh-speed.el (mh-folder-speedbar-buttons, mh-speed-flists):
+       Use mh-speed-update-interval instead of mh-speed-run-flists-flag.
+       (mh-speed-toggle, mh-speed-view, mh-speed-refresh):
+       Sync docstrings with manual.
 
 2005-12-09  Bill Wohler  <wohler@newt.com>
 
        (mh-invisible-header-fields-internal): Add X-Bugzilla-* and
        X-Virus-Scanned.
 
-       * mh-customize.el (mh-insert-signature-hook): Rename
-       mh-letter-insert-signature-hook to mh-insert-signature-hook.
+       * mh-customize.el (mh-insert-signature-hook):
+       Rename mh-letter-insert-signature-hook to mh-insert-signature-hook.
 
        * mh-comp.el (mh-insert-signature): Ditto.
 
        (mh-next-undeleted-msg, mh-previous-undeleted-msg): Rename arg to
        count.  Sync docstrings with manual.
        (mh-refile-or-write-again): Use output from mh-write-msg-to-file
-       so that message doesn't change when using this command.  Sync
-       docstrings with manual.
-       (mh-page-msg, mh-previous-page): Rename arg to lines.  Sync
-       docstrings with manual.
+       so that message doesn't change when using this command.
+       Sync docstrings with manual.
+       (mh-page-msg, mh-previous-page): Rename arg to lines.
+       Sync docstrings with manual.
        (mh-write-msg-to-file): Rename msg to message.  Rename no-headers
        to no-header.  Sync docstrings with manual.
        (mh-ps-print-map): Delete keybindings for deleted commands
        Sync docstrings with manual.
        (mh-toggle-mh-decode-mime-flag): Use English in message, not Lisp.
        Sync docstrings with manual.
-       (mh-mm-display-part, mh-mm-inline-message): Use
-       mh-highlight-citation-style instead of mh-highlight-citation-p.
+       (mh-mm-display-part, mh-mm-inline-message):
+       Use mh-highlight-citation-style instead of mh-highlight-citation-p.
        (mh-press-button): Sync docstrings with manual.
        (mh-display-with-external-viewer): Fix default output in
        minibuffer.  Sync docstrings with manual.
        (mh-smail, mh-extract-rejected-mail, mh-forward, mh-redistribute)
        (mh-reply, mh-send, mh-send-other-window)
        (mh-fill-paragraph-function): Sync docstrings with manual.
-       (mh-edit-again, mh-extract-rejected-mail, mh-redistribute): Rename
-       msg argument to message (to make for a better docstring).
+       (mh-edit-again, mh-extract-rejected-mail, mh-redistribute):
+       Rename msg argument to message (to make for a better docstring).
 
        * mh-customize.el (mh-redist-full-contents-flag): Convert defvar
        to defcustom.  Rename by adding -flag.
        * mh-customize.el (mh-compose-space-does-completion-flag)
        (mh-signature-separator-flag, mh-interpret-number-as-range-flag)
        (mh-adaptive-cmd-note-flag): Use "Non-nil means" instead of "On
-       means" to remain checkdoc clean and consistent with Emacs.  I
-       raised this issue with the Emacs developers and Stallman agrees
+       means" to remain checkdoc clean and consistent with Emacs.
+       raised this issue with the Emacs developers and Stallman agrees
        that "On means" should be allowed in custom docstrings but that
        this change requires thought and should wait until after the Emacs
        22 release.
 
        * mh-customize.el (mh-interpret-number-as-range-flag): Add * to
        docstring.
-       (mh-adaptive-cmd-note-flag-check, mh-scan-format-file-check): New
-       functions to check input for mh-adaptive-cmd-note-flag and
+       (mh-adaptive-cmd-note-flag-check, mh-scan-format-file-check):
+       New functions to check input for mh-adaptive-cmd-note-flag and
        mh-scan-format-file respectively.
        (mh-adaptive-cmd-note-flag, mh-scan-format-file): Docstring fixes,
        add :set.
 
-       * mh-e.el (mh-scan-field-destination-offset): New variable.  The
-       destination is the -, t, b, c, or n character for Replied, To, cc,
+       * mh-e.el (mh-scan-field-destination-offset): New variable.
+       The destination is the -, t, b, c, or n character for Replied, To, cc,
        Bcc, or Newsgroups respectively.
        (mh-make-folder, mh-regenerate-headers, mh-generate-new-cmd-note):
        Call new function mh-msg-num-width-to-column to make leap between
 
 2005-10-23  Bill Wohler  <wohler@newt.com>
 
-       * mh-comp.el (mh-letter-menu): Rename
-       mh-mhn-compose-external-compressed-tar to
-       mh-mh-compose-external-compressed-tar.  Rename
-       mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp.  Rename
+       * mh-comp.el (mh-letter-menu):
+       Rename mh-mhn-compose-external-compressed-tar to
+       mh-mh-compose-external-compressed-tar.
+       Rename mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp.  Rename
        mh-edit-mhn to mh-mh-to-mime.  Rename mh-mhn-directive-present-p to
        mh-mh-directive-present-p.  Rename mh-revert-mhn-edit to
        mh-mh-to-mime-undo.  Rename mh-gnus-pgp-support-flag to
        mh-mh-directive-present-p.
        (mh-send-letter): Rename mh-mhn-directive-present-p to
        mh-mh-directive-present-p.  Rename mh-edit-mhn to mh-mh-to-mime.
-       (mh-letter-mode-map): Rename mh-edit-mhn to mh-mh-to-mime.  Rename
-       mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp.  Rename
-       mh-mhn-compose-external-compressed-tar to
+       (mh-letter-mode-map): Rename mh-edit-mhn to mh-mh-to-mime.
+       Rename mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp.
+       Rename mh-mhn-compose-external-compressed-tar to
        mh-mh-compose-external-compressed-tar.  Rename mh-revert-mhn-edit
        to mh-mh-to-mime-undo.  Rename mh-mhn-compose-external-type to
        mh-mh-compose-external-type.  Rename mh-mhn-compose-anon-ftp to
-       mh-mh-compose-anon-ftp.  Rename
-       mh-mhn-compose-external-compressed-tar to
+       mh-mh-compose-anon-ftp.
+       Rename mh-mhn-compose-external-compressed-tar to
        mh-mh-compose-external-compressed-tar.  Rename mh-revert-mhn-edit
        to mh-mh-to-mime-undo.  Rename mh-mhn-compose-external-type to
        mh-mh-compose-external-type.
        (mh-send-letter, mh-letter-mode-map): Rename mh-edit-mhn to
        mh-mh-to-mime, mh-revert-mhn-edit to mh-mh-to-mime-undo.
-       (mh-reply, mh-yank-cur-msg, mh-insert-prefix-string): Rename
-       mh-yank-from-start-of-msg to mh-yank-behavior.
+       (mh-reply, mh-yank-cur-msg, mh-insert-prefix-string):
+       Rename mh-yank-from-start-of-msg to mh-yank-behavior.
        (mh-letter-mode, mh-to-field, mh-to-fcc, mh-insert-signature)
        (mh-check-whom, mh-insert-auto-fields, mh-send-letter)
        (mh-insert-letter, mh-yank-cur-msg, mh-insert-prefix-string)
        (mh-mhn-compose-anon-ftp): Rename to mh-mh-compose-anon-ftp.
        Rename mh-mhn-compose-external-type to mh-mh-compose-external-type.
        (mh-mhn-compose-external-compressed-tar): Rename to
-       mh-mh-compose-external-compressed-tar.  Rename
-       mh-mhn-compose-external-type to mh-mh-compose-external-type.
+       mh-mh-compose-external-compressed-tar.
+       Rename mh-mhn-compose-external-type to mh-mh-compose-external-type.
        (mh-mhn-compose-external-type): Rename to mh-mh-compose-external-type.
        (mh-edit-mhn): Rename to mh-mh-to-mime.  Rename mh-mhn-args to
        mh-mh-to-mime-args.  Rename mh-edit-mhn-hook to mh-mh-to-mime-hook.
        (mh-mh-compose-external-type): Rename extra-param argument to
        parameters.
        (mh-mml-to-mime, mh-secure-message, mh-mml-unsecure-message)
-       (mh-mime-display-part, mh-mime-display-single): Rename
-       mh-gnus-pgp-support-flag to mh-pgp-support-flag.
+       (mh-mime-display-part, mh-mime-display-single):
+       Rename mh-gnus-pgp-support-flag to mh-pgp-support-flag.
        (mh-compose-insertion): Rename mh-mhn-compose-insertion to
        mh-mh-attach-file.
        (mh-compose-forward): Rename mh-mhn-compose-forw to
 
        * mh-init.el (mh-image-load-path-called-flag): New variable which
        is used by mh-image-load-path so that it runs only once.
-       (mh-image-load-path): Modify so that it gets run only once.  Also
-       flatten out heavily nested if statements to make it clearer.
+       (mh-image-load-path): Modify so that it gets run only once.
+       Also flatten out heavily nested if statements to make it clearer.
 
        * mh-e.el (mh-folder-mode): Call mh-image-load-path to allow Emacs
        to find images used in the toolbar.
        need to be indented.
 
        * mh-e.el: mh-folder-tick-face had been renamed to mh-folder-tick
-       but the code that invoked the face had not been updated.  Tick
-       highlighting working again.
+       but the code that invoked the face had not been updated.
+       Tick highlighting working again.
 
-       * mh-seq.el (mh-non-seq-mode-line-annotation): Move
-       make-variable-buffer-local call to top level to avoid warnings in
+       * mh-seq.el (mh-non-seq-mode-line-annotation):
+       Move make-variable-buffer-local call to top level to avoid warnings in
        CVS Emacs.
 
        * mh-comp.el (mh-insert-letter): Replace deprecated read-input
index 71ef87385ca5d83dcd9209242a62c82a78e162ae..d9e6c74f3f392907e4099ddbf5ee0c098ef1f0dd 100644 (file)
@@ -520,7 +520,7 @@ font-lock is done highlighting.")
 
 ;; Register mh-folder-mode as supporting which-function-mode...
 (mh-require 'which-func nil t)
-(when (boundp 'which-func-modes)
+(when (and (boundp 'which-func-modes) (listp which-func-modes))
   (add-to-list 'which-func-modes 'mh-folder-mode))
 
 ;; Shush compiler.
index 1944a4cd08f1bbdda415a11dbe0ed83fda6a2323..2b5e51cfb34b17cf0e9df31c299d79ac8684ace4 100644 (file)
@@ -732,8 +732,7 @@ See Info node `(elisp) Programmed Completion' for details."
 
 ;; Shush compiler.
 (mh-do-in-xemacs
-  (defvar completion-root-regexp)
-  (defvar minibuffer-completing-file-name))
+  (defvar completion-root-regexp))
 
 (defun mh-folder-completing-read (prompt default allow-root-folder-flag)
   "Read folder name with PROMPT and default result DEFAULT.
index 3c0923d7e587dc0d389cd787363bbeece37f21d9..40e66b8ce9bb57c732bd31340a11a476b0c81c42 100644 (file)
@@ -36,8 +36,7 @@
 
 ;;; Code:
 
-(eval-when-compile
- (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup midnight nil
   "Run something every day at midnight."
@@ -138,9 +137,9 @@ two lists will NOT be killed if it also matches anything in this list."
 
 (defun midnight-find (el ls test &optional key)
   "A stopgap solution to the absence of `find' in ELisp."
-  (dolist (rr ls)
+  (cl-dolist (rr ls)
     (when (funcall test (if key (funcall key rr) rr) el)
-      (return rr))))
+      (cl-return rr))))
 
 (defun clean-buffer-list-delay (name)
   "Return the delay, in seconds, before killing a buffer named NAME.
@@ -196,8 +195,7 @@ The default value is `clean-buffer-list'."
 
 (defun midnight-next ()
   "Return the number of seconds till the next midnight."
-  (multiple-value-bind (sec min hrs)
-      (values-list (decode-time))
+  (pcase-let ((`(,sec ,min ,hrs) (decode-time)))
     (- (* 24 60 60) (* 60 60 hrs) (* 60 min) sec)))
 
 ;;;###autoload
@@ -205,8 +203,8 @@ The default value is `clean-buffer-list'."
   "Modify `midnight-timer' according to `midnight-delay'.
 Sets the first argument SYMB (which must be symbol `midnight-delay')
 to its second argument TM."
-  (assert (eq symb 'midnight-delay) t
-          "Invalid argument to `midnight-delay-set': `%s'")
+  (cl-assert (eq symb 'midnight-delay) t
+             "Invalid argument to `midnight-delay-set': `%s'")
   (set symb tm)
   (when (timerp midnight-timer) (cancel-timer midnight-timer))
   (setq midnight-timer
index ef1bb115a2330176c92bd71ddd2329028c900914..4387fc625c6563e3427430115d850f2649a0ff92 100644 (file)
@@ -35,7 +35,7 @@
 
 (defvar minibuffer-default-in-prompt-regexps
   '(("\\( (default\\>.*)\\):? \\'" . 1) ("\\( \\[.*\\]\\):? *\\'" . 1))
-  "*A list of regexps matching the parts of minibuffer prompts showing defaults.
+  "A list of regexps matching the parts of minibuffer prompts showing defaults.
 When `minibuffer-electric-default-mode' is active, these regexps are
 used to identify the portions of prompts to elide.
 
index c4f09664e1bec1ab6121f2a461cff0608bbf50d8..5c2c14d1fdb370c0486af12ac4d7fc9a39972694 100644 (file)
 ;;   corresponding to the displayed completions because we only
 ;;   provide the start info but not the end info in
 ;;   completion-base-position.
-;; - quoting is problematic.  E.g. the double-dollar quoting used in
-;;   substitute-in-file-name (and hence read-file-name-internal) bumps
-;;   into various bugs:
-;; - choose-completion doesn't know how to quote the text it inserts.
-;;   E.g. it fails to double the dollars in file-name completion, or
-;;   to backslash-escape spaces and other chars in comint completion.
-;;   - when completing ~/tmp/fo$$o, the highlighting in *Completions*
-;;     is off by one position.
-;;   - all code like PCM which relies on all-completions to match
-;;     its argument gets confused because all-completions returns unquoted
-;;     texts (as desired for *Completions* output).
 ;; - C-x C-f ~/*/sr ? should not list "~/./src".
 ;; - minibuffer-force-complete completes ~/src/emacs/t<!>/lisp/minibuffer.el
 ;;   to ~/src/emacs/trunk/ and throws away lisp/minibuffer.el.
 ;; - Make things like icomplete-mode or lightning-completion work with
 ;;   completion-in-region-mode.
 ;; - extend `metadata':
-;;   - quoting/unquoting (so we can complete files names with envvars
-;;     and backslashes, and all-completion can list names without
-;;     quoting backslashes and dollars).
 ;;   - indicate how to turn all-completion's output into
 ;;     try-completion's output: e.g. completion-ignored-extensions.
-;;     maybe that could be merged with the "quote" operation above.
+;;     maybe that could be merged with the "quote" operation.
 ;;   - indicate that `all-completions' doesn't do prefix-completion
 ;;     but just returns some list that relates in some other way to
 ;;     the provided string (as is the case in filecache.el), in which
@@ -95,7 +81,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;; Completion table manipulation
 
@@ -213,7 +199,7 @@ You should give VAR a non-nil `risky-local-variable' property."
     `(completion-table-dynamic
       (lambda (,str)
         (when (functionp ,var)
-          (setq ,var (,fun)))
+          (setq ,var (funcall #',fun)))
         ,var))))
 
 (defun completion-table-case-fold (table &optional dont-fold)
@@ -224,6 +210,42 @@ case sensitive instead."
     (let ((completion-ignore-case (not dont-fold)))
       (complete-with-action action table string pred))))
 
+(defun completion-table-subvert (table s1 s2)
+  "Completion table that replaces the prefix S1 with S2 in STRING.
+The result is a completion table which completes strings of the
+form (concat S1 S) in the same way as TABLE completes strings of
+the form (concat S2 S)."
+  (lambda (string pred action)
+    (let* ((str (if (eq t (compare-strings string 0 (length s1) s1 nil nil
+                                           completion-ignore-case))
+                    (concat s2 (substring string (length s1)))))
+           (res (if str (complete-with-action action table str pred))))
+      (when res
+        (cond
+         ((eq (car-safe action) 'boundaries)
+          (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0)))
+            `(boundaries
+              ,(max (length s1)
+                    (+ beg (- (length s1) (length s2))))
+              . ,(and (eq (car-safe res) 'boundaries) (cddr res)))))
+         ((stringp res)
+          (if (eq t (compare-strings res 0 (length s2) s2 nil nil
+                                     completion-ignore-case))
+              (concat s1 (substring res (length s2)))))
+         ((eq action t)
+          (let ((bounds (completion-boundaries str table pred "")))
+            (if (>= (car bounds) (length s2))
+                res
+              (let ((re (concat "\\`"
+                                (regexp-quote (substring s2 (car bounds))))))
+                (delq nil
+                      (mapcar (lambda (c)
+                                (if (string-match re c)
+                                    (substring c (match-end 0))))
+                              res))))))
+         ;; E.g. action=nil and it's the only completion.
+         (res))))))
+
 (defun completion-table-with-context (prefix table string pred action)
   ;; TODO: add `suffix' maybe?
   (let ((pred
@@ -245,7 +267,7 @@ case sensitive instead."
     (if (eq (car-safe action) 'boundaries)
         (let* ((len (length prefix))
                (bound (completion-boundaries string table pred (cdr action))))
-          (list* 'boundaries (+ (car bound) len) (cdr bound)))
+          `(boundaries ,(+ (car bound) len) . ,(cdr bound)))
       (let ((comp (complete-with-action action table string pred)))
         (cond
          ;; In case of try-completion, add the prefix.
@@ -278,8 +300,8 @@ instead of a string, a function that takes the completion and returns the
                                   (cdr terminator) (regexp-quote terminator)))
            (max (and terminator-regexp
                      (string-match terminator-regexp suffix))))
-      (list* 'boundaries (car bounds)
-             (min (cdr bounds) (or max (length suffix))))))
+      `(boundaries ,(car bounds)
+                   . ,(min (cdr bounds) (or max (length suffix))))))
    ((eq action nil)
     (let ((comp (try-completion string table pred)))
       (if (consp terminator) (setq terminator (car terminator)))
@@ -347,6 +369,208 @@ Note: TABLE needs to be a proper completion table which obeys predicates."
                         (complete-with-action action table string pred))
                       tables)))
 
+(defun completion-table-with-quoting (table unquote requote)
+  ;; A difficult part of completion-with-quoting is to map positions in the
+  ;; quoted string to equivalent positions in the unquoted string and
+  ;; vice-versa.  There is no efficient and reliable algorithm that works for
+  ;; arbitrary quote and unquote functions.
+  ;; So to map from quoted positions to unquoted positions, we simply assume
+  ;; that `concat' and `unquote' commute (which tends to be the case).
+  ;; And we ask `requote' to do the work of mapping from unquoted positions
+  ;; back to quoted positions.
+  "Return a new completion table operating on quoted text.
+TABLE operates on the unquoted text.
+UNQUOTE is a function that takes a string and returns a new unquoted string.
+REQUOTE is a function of 2 args (UPOS QSTR) where
+  QSTR is a string entered by the user (and hence indicating
+  the user's preferred form of quoting); and
+  UPOS is a position within the unquoted form of QSTR.
+REQUOTE should return a pair (QPOS . QFUN) such that QPOS is the
+position corresponding to UPOS but in QSTR, and QFUN is a function
+of one argument (a string) which returns that argument appropriately quoted
+for use at QPOS."
+  ;; FIXME: One problem with the current setup is that `qfun' doesn't know if
+  ;; its argument is "the end of the completion", so if the quoting used double
+  ;; quotes (for example), we end up completing "fo" to "foobar and throwing
+  ;; away the closing double quote.
+  (lambda (string pred action)
+    (cond
+     ((eq action 'metadata)
+      (append (completion-metadata string table pred)
+              '((completion--unquote-requote . t))))
+
+     ((eq action 'lambda) ;;test-completion
+      (let ((ustring (funcall unquote string)))
+        (test-completion ustring table pred)))
+
+     ((eq (car-safe action) 'boundaries)
+      (let* ((ustring (funcall unquote string))
+             (qsuffix (cdr action))
+             (ufull (if (zerop (length qsuffix)) ustring
+                      (funcall unquote (concat string qsuffix))))
+             (_ (cl-assert (string-prefix-p ustring ufull)))
+             (usuffix (substring ufull (length ustring)))
+             (boundaries (completion-boundaries ustring table pred usuffix))
+             (qlboundary (car (funcall requote (car boundaries) string)))
+             (qrboundary (if (zerop (cdr boundaries)) 0 ;Common case.
+                           (let* ((urfullboundary
+                                   (+ (cdr boundaries) (length ustring))))
+                             (- (car (funcall requote urfullboundary
+                                              (concat string qsuffix)))
+                                (length string))))))
+        `(boundaries ,qlboundary . ,qrboundary)))
+
+     ;; In "normal" use a c-t-with-quoting completion table should never be
+     ;; called with action in (t nil) because `completion--unquote' should have
+     ;; been called before and would have returned a different completion table
+     ;; to apply to the unquoted text.  But there's still a lot of code around
+     ;; that likes to use all/try-completions directly, so we do our best to
+     ;; handle those calls as well as we can.
+
+     ((eq action nil) ;;try-completion
+      (let* ((ustring (funcall unquote string))
+             (completion (try-completion ustring table pred)))
+        ;; Most forms of quoting allow several ways to quote the same string.
+        ;; So here we could simply requote `completion' in a kind of
+        ;; "canonical" quoted form without paying attention to the way
+        ;; `string' was quoted.  But since we have to solve the more complex
+        ;; problems of "pay attention to the original quoting" for
+        ;; all-completions, we may as well use it here, since it provides
+        ;; a nicer behavior.
+        (if (not (stringp completion)) completion
+          (car (completion--twq-try
+                string ustring completion 0 unquote requote)))))
+
+     ((eq action t) ;;all-completions
+      ;; When all-completions is used for completion-try/all-completions
+      ;; (e.g. for `pcm' style), we can't do the job properly here because
+      ;; the caller will match our output against some pattern derived from
+      ;; the user's (quoted) input, and we don't have access to that
+      ;; pattern, so we can't know how to requote our output so that it
+      ;; matches the quoting used in the pattern.  It is to fix this
+      ;; fundamental problem that we have to introduce the new
+      ;; unquote-requote method so that completion-try/all-completions can
+      ;; pass the unquoted string to the style functions.
+      (pcase-let*
+          ((ustring (funcall unquote string))
+           (completions (all-completions ustring table pred))
+           (boundary (car (completion-boundaries ustring table pred "")))
+           (completions
+            (completion--twq-all
+             string ustring completions boundary unquote requote))
+           (last (last completions)))
+        (when (consp last) (setcdr last nil))
+        completions))
+
+     ((eq action 'completion--unquote)
+      (let ((ustring (funcall unquote string))
+            (uprefix (funcall unquote (substring string 0 pred))))
+        ;; We presume (more or less) that `concat' and `unquote' commute.
+        (cl-assert (string-prefix-p uprefix ustring))
+        (list ustring table (length uprefix)
+              (lambda (unquoted-result op)
+                (pcase op
+                  (1 ;;try
+                   (if (not (stringp (car-safe unquoted-result)))
+                       unquoted-result
+                     (completion--twq-try
+                      string ustring
+                      (car unquoted-result) (cdr unquoted-result)
+                      unquote requote)))
+                  (2 ;;all
+                   (let* ((last (last unquoted-result))
+                          (base (or (cdr last) 0)))
+                     (when last
+                       (setcdr last nil)
+                       (completion--twq-all string ustring
+                                            unquoted-result base
+                                            unquote requote))))))))))))
+
+(defun completion--twq-try (string ustring completion point
+                                   unquote requote)
+  ;; Basically two cases: either the new result is
+  ;; - commonprefix1 <point> morecommonprefix <qpos> suffix
+  ;; - commonprefix <qpos> newprefix <point> suffix
+  (pcase-let*
+      ((prefix (fill-common-string-prefix ustring completion))
+       (suffix (substring completion (max point (length prefix))))
+       (`(,qpos . ,qfun) (funcall requote (length prefix) string))
+       (qstr1 (if (> point (length prefix))
+                  (funcall qfun (substring completion (length prefix) point))))
+       (qsuffix (funcall qfun suffix))
+       (qstring (concat (substring string 0 qpos) qstr1 qsuffix))
+       (qpoint
+        (cond
+         ((zerop point) 0)
+         ((> point (length prefix)) (+ qpos (length qstr1)))
+         (t (car (funcall requote point string))))))
+    ;; Make sure `requote' worked.
+    (if (equal (funcall unquote qstring) completion)
+       (cons qstring qpoint)
+      ;; If requote failed (e.g. because sifn-requote did not handle
+      ;; Tramp's "/foo:/bar//baz -> /foo:/baz" truncation), then at least
+      ;; try requote properly.
+      (let ((qstr (funcall qfun completion)))
+       (cons qstr (length qstr))))))
+
+(defun completion--string-equal-p (s1 s2)
+  (eq t (compare-strings s1 nil nil s2 nil nil 'ignore-case)))
+
+(defun completion--twq-all (string ustring completions boundary
+                                   unquote requote)
+  (when completions
+    (pcase-let*
+        ((prefix
+          (let ((completion-regexp-list nil))
+            (try-completion "" (cons (substring ustring boundary)
+                                     completions))))
+         (`(,qfullpos . ,qfun)
+          (funcall requote (+ boundary (length prefix)) string))
+         (qfullprefix (substring string 0 qfullpos))
+         (_ (cl-assert (completion--string-equal-p
+                        (funcall unquote qfullprefix)
+                        (concat (substring ustring 0 boundary) prefix))
+                       t))
+         (qboundary (car (funcall requote boundary string)))
+         (_ (cl-assert (<= qboundary qfullpos)))
+         ;; FIXME: this split/quote/concat business messes up the carefully
+         ;; placed completions-common-part and completions-first-difference
+         ;; faces.  We could try within the mapcar loop to search for the
+         ;; boundaries of those faces, pass them to `requote' to find their
+         ;; equivalent positions in the quoted output and re-add the faces:
+         ;; this might actually lead to correct results but would be
+         ;; pretty expensive.
+         ;; The better solution is to not quote the *Completions* display,
+         ;; which nicely circumvents the problem.  The solution I used here
+         ;; instead is to hope that `qfun' preserves the text-properties and
+         ;; presume that the `first-difference' is not within the `prefix';
+         ;; this presumption is not always true, but at least in practice it is
+         ;; true in most cases.
+         (qprefix (propertize (substring qfullprefix qboundary)
+                              'face 'completions-common-part)))
+
+      ;; Here we choose to quote all elements returned, but a better option
+      ;; would be to return unquoted elements together with a function to
+      ;; requote them, so that *Completions* can show nicer unquoted values
+      ;; which only get quoted when needed by choose-completion.
+      (nconc
+       (mapcar (lambda (completion)
+                 (cl-assert (string-prefix-p prefix completion 'ignore-case) t)
+                 (let* ((new (substring completion (length prefix)))
+                        (qnew (funcall qfun new))
+                        (qcompletion (concat qprefix qnew)))
+                   (cl-assert
+                    (completion--string-equal-p
+                    (funcall unquote
+                             (concat (substring string 0 qboundary)
+                                     qcompletion))
+                    (concat (substring ustring 0 boundary)
+                            completion))
+                   t)
+                   qcompletion))
+               completions)
+       qboundary))))
+
 ;; (defmacro complete-in-turn (a b) `(completion-table-in-turn ,a ,b))
 ;; (defmacro dynamic-completion-table (fun) `(completion-table-dynamic ,fun))
 (define-obsolete-function-alias
@@ -535,21 +759,47 @@ completing buffer and file names, respectively."
         (delete-dups (append (cdr over) (copy-sequence completion-styles)))
        completion-styles)))
 
+(defun completion--nth-completion (n string table pred point metadata)
+  "Call the Nth method of completion styles."
+  (unless metadata
+    (setq metadata
+          (completion-metadata (substring string 0 point) table pred)))
+  ;; We provide special support for quoting/unquoting here because it cannot
+  ;; reliably be done within the normal completion-table routines: Completion
+  ;; styles such as `substring' or `partial-completion' need to match the
+  ;; output of all-completions with the user's input, and since most/all
+  ;; quoting mechanisms allow several equivalent quoted forms, the
+  ;; completion-style can't do this matching (e.g. `substring' doesn't know
+  ;; that "\a\b\e" is a valid (quoted) substring of "label").
+  ;; The quote/unquote function needs to come from the completion table (rather
+  ;; than from completion-extra-properties) because it may apply only to some
+  ;; part of the string (e.g. substitute-in-file-name).
+  (let ((requote
+         (when (completion-metadata-get metadata 'completion--unquote-requote)
+           (let ((new (funcall table string point 'completion--unquote)))
+             (setq string (pop new))
+             (setq table (pop new))
+             (setq point (pop new))
+             (pop new))))
+       (result
+        (completion--some (lambda (style)
+                            (funcall (nth n (assq style
+                                                  completion-styles-alist))
+                                     string table pred point))
+                          (completion--styles metadata))))
+    (if requote
+        (funcall requote result n)
+      result)))
+
 (defun completion-try-completion (string table pred point &optional metadata)
   "Try to complete STRING using completion table TABLE.
 Only the elements of table that satisfy predicate PRED are considered.
 POINT is the position of point within STRING.
 The return value can be either nil to indicate that there is no completion,
 t to indicate that STRING is the only possible completion,
-or a pair (STRING . NEWPOINT) of the completed result string together with
+or a pair (NEWSTRING . NEWPOINT) of the completed result string together with
 a new position for point."
-  (completion--some (lambda (style)
-                      (funcall (nth 1 (assq style completion-styles-alist))
-                               string table pred point))
-                    (completion--styles (or metadata
-                                            (completion-metadata
-                                             (substring string 0 point)
-                                             table pred)))))
+  (completion--nth-completion 1 string table pred point metadata))
 
 (defun completion-all-completions (string table pred point &optional metadata)
   "List the possible completions of STRING in completion table TABLE.
@@ -559,13 +809,7 @@ The return value is a list of completions and may contain the base-size
 in the last `cdr'."
   ;; FIXME: We need to additionally return the info needed for the
   ;; second part of completion-base-position.
-  (completion--some (lambda (style)
-                      (funcall (nth 2 (assq style completion-styles-alist))
-                               string table pred point))
-                    (completion--styles (or metadata
-                                            (completion-metadata
-                                             (substring string 0 point)
-                                             table pred)))))
+  (completion--nth-completion 2 string table pred point metadata))
 
 (defun minibuffer--bitset (modified completions exact)
   (logior (if modified    4 0)
@@ -750,9 +994,9 @@ when the buffer's text is already an exact match."
                                         'exact 'unknown))))
              ;; Show the completion table, if requested.
              ((not exact)
-             (if (case completion-auto-help
-                    (lazy (eq this-command last-command))
-                    (t completion-auto-help))
+             (if (pcase completion-auto-help
+                    (`lazy (eq this-command last-command))
+                    (_ completion-auto-help))
                   (minibuffer-completion-help)
                 (completion--message "Next char not unique")))
              ;; If the last exact completion and this one were the same, it
@@ -797,9 +1041,9 @@ scroll the window of possible completions."
    ((and completion-cycling completion-all-sorted-completions)
     (minibuffer-force-complete)
     t)
-   (t (case (completion--do-completion)
+   (t (pcase (completion--do-completion)
         (#b000 nil)
-        (t     t)))))
+        (_     t)))))
 
 (defun completion--cache-all-sorted-completions (comps)
   (add-hook 'after-change-functions
@@ -959,15 +1203,15 @@ If `minibuffer-completion-confirm' is `confirm-after-completion',
 
      (t
       ;; Call do-completion, but ignore errors.
-      (case (condition-case nil
+      (pcase (condition-case nil
                 (completion--do-completion nil 'expect-exact)
               (error 1))
-        ((#b001 #b011) (exit-minibuffer))
+        ((or #b001 #b011) (exit-minibuffer))
         (#b111 (if (not minibuffer-completion-confirm)
                    (exit-minibuffer)
                  (minibuffer-message "Confirm")
                  nil))
-        (t nil))))))
+        (_ nil))))))
 
 (defun completion--try-word-completion (string table predicate point md)
   (let ((comp (completion-try-completion string table predicate point md)))
@@ -1062,9 +1306,9 @@ After one word is completed as much as possible, a space or hyphen
 is added, provided that matches some possible completion.
 Return nil if there is no valid completion, else t."
   (interactive)
-  (case (completion--do-completion 'completion--try-word-completion)
+  (pcase (completion--do-completion 'completion--try-word-completion)
     (#b000 nil)
-    (t     t)))
+    (_     t)))
 
 (defface completions-annotations '((t :inherit italic))
   "Face to use for annotations in the *Completions* buffer.")
@@ -1311,7 +1555,7 @@ variables.")
 (defun completion--done (string &optional finished message)
   (let* ((exit-fun (plist-get completion-extra-properties :exit-function))
          (pre-msg (and exit-fun (current-message))))
-    (assert (memq finished '(exact sole finished unknown)))
+    (cl-assert (memq finished '(exact sole finished unknown)))
     ;; FIXME: exit-fun should receive `finished' as a parameter.
     (when exit-fun
       (when (eq finished 'unknown)
@@ -1483,7 +1727,7 @@ Return nil if there is no valid completion, else t.
 Point needs to be somewhere between START and END.
 PREDICATE (a function called with no arguments) says when to
 exit."
-  (assert (<= start (point)) (<= (point) end))
+  (cl-assert (<= start (point)) (<= (point) end))
   (with-wrapper-hook
       ;; FIXME: Maybe we should use this hook to provide a "display
       ;; completions" operation as well.
@@ -1550,7 +1794,7 @@ the mode if ARG is omitted or nil."
       (unless (equal "*Completions*" (buffer-name (window-buffer)))
        (minibuffer-hide-completions))
     ;; (add-hook 'pre-command-hook #'completion-in-region--prech)
-    (assert completion-in-region-mode-predicate)
+    (cl-assert completion-in-region-mode-predicate)
     (setq completion-in-region-mode--predicate
          completion-in-region-mode-predicate)
     (add-hook 'post-command-hook #'completion-in-region--postch)
@@ -1593,10 +1837,10 @@ a completion function or god knows what else.")
   ;; always return the same kind of data, but this breaks down with functions
   ;; like comint-completion-at-point or mh-letter-completion-at-point, which
   ;; could be sometimes safe and sometimes misbehaving (and sometimes neither).
-  (if (case which
-        (all t)
-        (safe (member fun completion--capf-safe-funs))
-        (optimist (not (member fun completion--capf-misbehave-funs))))
+  (if (pcase which
+        (`all t)
+        (`safe (member fun completion--capf-safe-funs))
+        (`optimist (not (member fun completion--capf-misbehave-funs))))
       (let ((res (funcall fun)))
         (cond
          ((and (consp res) (not (functionp res)))
@@ -1714,10 +1958,10 @@ The completion method is determined by `completion-at-point-functions'."
 Gets combined either with `minibuffer-local-completion-map' or
 with `minibuffer-local-must-match-map'.")
 
-(defvar minibuffer-local-filename-must-match-map (make-sparse-keymap))
-(make-obsolete-variable 'minibuffer-local-filename-must-match-map nil "24.1")
 (define-obsolete-variable-alias 'minibuffer-local-must-match-filename-map
   'minibuffer-local-filename-must-match-map "23.1")
+(defvar minibuffer-local-filename-must-match-map (make-sparse-keymap))
+(make-obsolete-variable 'minibuffer-local-filename-must-match-map nil "24.1")
 
 (let ((map minibuffer-local-ns-map))
   (define-key map " " 'exit-minibuffer)
@@ -1755,7 +1999,10 @@ This is only used when the minibuffer area has no active minibuffer.")
 ;;; Completion tables.
 
 (defun minibuffer--double-dollars (str)
-  (replace-regexp-in-string "\\$" "$$" str))
+  ;; Reuse the actual "$" from the string to preserve any text-property it
+  ;; might have, such as `face'.
+  (replace-regexp-in-string "\\$" (lambda (dollar) (concat dollar dollar))
+                            str))
 
 (defun completion--make-envvar-table ()
   (mapcar (lambda (enventry)
@@ -1799,10 +2046,10 @@ same as `substitute-in-file-name'."
           (if (eq action 'metadata)
               '(metadata (category . environment-variable))
             (let ((suffix (cdr action)))
-              (list* 'boundaries
-                     (or (match-beginning 2) (match-beginning 1))
-                     (when (string-match "[^[:alnum:]_]" suffix)
-                       (match-beginning 0)))))))
+              `(boundaries
+                ,(or (match-beginning 2) (match-beginning 1))
+                . ,(when (string-match "[^[:alnum:]_]" suffix)
+                     (match-beginning 0)))))))
        (t
         (if (eq (aref string (1- beg)) ?{)
             (setq table (apply-partially 'completion-table-with-terminator
@@ -1818,17 +2065,23 @@ same as `substitute-in-file-name'."
   (condition-case nil
       (cond
        ((eq action 'metadata) '(metadata (category . file)))
+       ((string-match-p "\\`~[^/\\]*\\'" string)
+        (completion-table-with-context "~"
+                                       (mapcar (lambda (u) (concat u "/"))
+                                               (system-users))
+                                       (substring string 1)
+                                       pred action))
        ((eq (car-safe action) 'boundaries)
         (let ((start (length (file-name-directory string)))
               (end (string-match-p "/" (cdr action))))
-          (list* 'boundaries
-                 ;; if `string' is "C:" in w32, (file-name-directory string)
-                 ;; returns "C:/", so `start' is 3 rather than 2.
-                 ;; Not quite sure what is The Right Fix, but clipping it
-                 ;; back to 2 will work for this particular case.  We'll
-                 ;; see if we can come up with a better fix when we bump
-                 ;; into more such problematic cases.
-                 (min start (length string)) end)))
+          `(boundaries
+            ;; if `string' is "C:" in w32, (file-name-directory string)
+            ;; returns "C:/", so `start' is 3 rather than 2.
+            ;; Not quite sure what is The Right Fix, but clipping it
+            ;; back to 2 will work for this particular case.  We'll
+            ;; see if we can come up with a better fix when we bump
+            ;; into more such problematic cases.
+            ,(min start (length string)) . ,end)))
 
        ((eq action 'lambda)
         (if (zerop (length string))
@@ -1875,58 +2128,66 @@ same as `substitute-in-file-name'."
 (make-obsolete-variable 'read-file-name-predicate
                         "use the regular PRED argument" "23.2")
 
-(defun completion--file-name-table (string pred action)
+(defun completion--sifn-requote (upos qstr)
+  ;; We're looking for `qupos' such that:
+  ;; (equal (substring (substitute-in-file-name qstr) 0 upos)
+  ;;        (substitute-in-file-name (substring qstr 0 qupos)))
+  ;; Big problem here: we have to reverse engineer substitute-in-file-name to
+  ;; find the position corresponding to UPOS in QSTR, but
+  ;; substitute-in-file-name can do anything, depending on file-name-handlers.
+  ;; Kind of like in rfn-eshadow-update-overlay, only worse.
+  ;; FIXME: example of thing we do not handle: Tramp's makes
+  ;; (substitute-in-file-name "/foo:~/bar//baz") -> "/scpc:foo:/baz".
+  ;; FIXME: One way to try and handle "all" cases is to require
+  ;; substitute-in-file-name to preserve text-properties, so we could
+  ;; apply text-properties to the input string and then look for them in
+  ;; the output to understand what comes from where.
+  (let ((qpos 0))
+    ;; Handle substitute-in-file-name's truncation behavior.
+    (let (tpos)
+      (while (and (string-match "[\\/][~/\\]" qstr qpos)
+                  ;; Hopefully our regexp covers all truncation cases.
+                  ;; Also let's make sure sifn indeed truncates here.
+                  (progn
+                    (setq tpos (1+ (match-beginning 0)))
+                    (equal (substitute-in-file-name qstr)
+                           (substitute-in-file-name (substring qstr tpos)))))
+        (setq qpos tpos)))
+    ;; `upos' is relative to the position corresponding to `qpos' in
+    ;; (substitute-in-file-name qstr), so as qpos moves forward, upos
+    ;; gets smaller.
+    (while (and (> upos 0)
+                (string-match "\\$\\(\\$\\|\\([[:alnum:]_]+\\|{[^}]*}\\)\\)?"
+                              qstr qpos))
+      (cond
+       ((>= (- (match-beginning 0) qpos) upos) ; UPOS is before current match.
+        (setq qpos (+ qpos upos))
+        (setq upos 0))
+       ((not (match-end 1))             ;A sole $: probably an error.
+        (setq upos (- upos (- (match-end 0) qpos)))
+        (setq qpos (match-end 0)))
+       (t
+        (setq upos (- upos (- (match-beginning 0) qpos)))
+        (setq qpos (match-end 0))
+        (setq upos (- upos (length (substitute-in-file-name
+                                    (match-string 0 qstr))))))))
+    ;; If `upos' is negative, it's because it's within the expansion of an
+    ;; envvar, i.e. there is no exactly matching qpos, so we just use the next
+    ;; available qpos right after the envvar.
+    (cons (if (>= upos 0) (+ qpos upos) qpos)
+         #'minibuffer--double-dollars)))
+
+(defalias 'completion--file-name-table
+  (completion-table-with-quoting #'completion-file-name-table
+                                 #'substitute-in-file-name
+                                 #'completion--sifn-requote)
   "Internal subroutine for `read-file-name'.  Do not call this.
 This is a completion table for file names, like `completion-file-name-table'
-except that it passes the file name through `substitute-in-file-name'."
-  (cond
-   ((eq (car-safe action) 'boundaries)
-    ;; For the boundaries, we can't really delegate to
-    ;; substitute-in-file-name+completion-file-name-table and then fix
-    ;; them up (as we do for the other actions), because it would
-    ;; require us to track the relationship between `str' and
-    ;; `string', which is difficult.  And in any case, if
-    ;; substitute-in-file-name turns "fo-$TO-ba" into "fo-o/b-ba",
-    ;; there's no way for us to return proper boundaries info, because
-    ;; the boundary is not (yet) in `string'.
-    ;;
-    ;; FIXME: Actually there is a way to return correct boundaries
-    ;; info, at the condition of modifying the all-completions
-    ;; return accordingly. But for now, let's not bother.
-    (completion-file-name-table string pred action))
-
-   (t
-    (let* ((default-directory
-             (if (stringp pred)
-                 ;; It used to be that `pred' was abused to pass `dir'
-                 ;; as an argument.
-                 (prog1 (file-name-as-directory (expand-file-name pred))
-                   (setq pred nil))
-               default-directory))
-           (str (condition-case nil
-                    (substitute-in-file-name string)
-                  (error string)))
-           (comp (completion-file-name-table
-                  str
-                 (with-no-warnings (or pred read-file-name-predicate))
-                 action)))
-
-      (cond
-       ((stringp comp)
-        ;; Requote the $s before returning the completion.
-        (minibuffer--double-dollars comp))
-       ((and (null action) comp
-             ;; Requote the $s before checking for changes.
-             (setq str (minibuffer--double-dollars str))
-             (not (string-equal string str)))
-        ;; If there's no real completion, but substitute-in-file-name
-        ;; changed the string, then return the new string.
-        str)
-       (t comp))))))
+except that it passes the file name through `substitute-in-file-name'.")
 
 (defalias 'read-file-name-internal
-  (completion-table-in-turn 'completion--embedded-envvar-table
-                            'completion--file-name-table)
+  (completion-table-in-turn #'completion--embedded-envvar-table
+                            #'completion--file-name-table)
   "Internal subroutine for `read-file-name'.  Do not call this.")
 
 (defvar read-file-name-function 'read-file-name-default
@@ -2046,6 +2307,21 @@ and `read-file-name-function'."
   (funcall (or read-file-name-function #'read-file-name-default)
            prompt dir default-filename mustmatch initial predicate))
 
+(defvar minibuffer-local-filename-syntax
+  (let ((table (make-syntax-table))
+       (punctuation (car (string-to-syntax "."))))
+    ;; Convert all punctuation entries to symbol.
+    (map-char-table (lambda (c syntax)
+                     (when (eq (car syntax) punctuation)
+                       (modify-syntax-entry c "_" table)))
+                   table)
+    (mapc
+     (lambda (c)
+       (modify-syntax-entry c "." table))
+     '(?/ ?: ?\\))
+    table)
+  "Syntax table to be used in minibuffer for reading file name.")
+
 ;; minibuffer-completing-file-name is a variable used internally in minibuf.c
 ;; to determine whether to use minibuffer-local-filename-completion-map or
 ;; minibuffer-local-completion-map.  It shouldn't be exported to Elisp.
@@ -2053,7 +2329,7 @@ and `read-file-name-function'."
 ;; use (eq minibuffer-completion-table #'read-file-name-internal), which is
 ;; probably even worse.  Maybe We should add some read-file-name-setup-hook
 ;; instead, but for now, let's keep this non-obsolete.
-;;(make-obsolete-variable 'minibuffer-completing-file-name nil "24.1" 'get)
+;;(make-obsolete-variable 'minibuffer-completing-file-name nil "future" 'get)
 
 (defun read-file-name-default (prompt &optional dir default-filename mustmatch initial predicate)
   "Default method for reading file names.
@@ -2114,7 +2390,8 @@ See `read-file-name' for the meaning of the arguments."
                                (lambda ()
                                  (with-current-buffer
                                      (window-buffer (minibuffer-selected-window))
-                                  (read-file-name--defaults dir initial)))))
+                                  (read-file-name--defaults dir initial))))
+                         (set-syntax-table minibuffer-local-filename-syntax))
                       (completing-read prompt 'read-file-name-internal
                                        pred mustmatch insdef
                                        'file-name-history default-filename)))
@@ -2386,7 +2663,7 @@ or a symbol, see `completion-pcm--merge-completions'."
               (setq p0 (1+ p)))
           (push 'any pattern)
           (setq p0 p))
-        (incf p))
+        (cl-incf p))
 
       ;; An empty string might be erroneously added at the beginning.
       ;; It should be avoided properly, but it's so easy to remove it here.
@@ -2411,7 +2688,7 @@ or a symbol, see `completion-pcm--merge-completions'."
 (defun completion-pcm--all-completions (prefix pattern table pred)
   "Find all completions for PATTERN in TABLE obeying PRED.
 PATTERN is as returned by `completion-pcm--string->pattern'."
-  ;; (assert (= (car (completion-boundaries prefix table pred ""))
+  ;; (cl-assert (= (car (completion-boundaries prefix table pred ""))
   ;;            (length prefix)))
   ;; Find an initial list of possible completions.
   (if (completion-pcm--pattern-trivial-p pattern)
@@ -2485,9 +2762,9 @@ filter out additional entries (because TABLE might not obey PRED)."
         ;; The prefix has no completions at all, so we should try and fix
         ;; that first.
         (let ((substring (substring prefix 0 -1)))
-          (destructuring-bind (subpat suball subprefix _subsuffix)
-              (completion-pcm--find-all-completions
-               substring table pred (length substring) filter)
+          (pcase-let ((`(,subpat ,suball ,subprefix ,_subsuffix)
+                       (completion-pcm--find-all-completions
+                        substring table pred (length substring) filter)))
             (let ((sep (aref prefix (1- (length prefix))))
                   ;; Text that goes between the new submatches and the
                   ;; completion substring.
@@ -2551,22 +2828,22 @@ filter out additional entries (because TABLE might not obey PRED)."
         (list pattern all prefix suffix)))))
 
 (defun completion-pcm-all-completions (string table pred point)
-  (destructuring-bind (pattern all &optional prefix _suffix)
-      (completion-pcm--find-all-completions string table pred point)
+  (pcase-let ((`(,pattern ,all ,prefix ,_suffix)
+               (completion-pcm--find-all-completions string table pred point)))
     (when all
       (nconc (completion-pcm--hilit-commonality pattern all)
              (length prefix)))))
 
 (defun completion--sreverse (str)
   "Like `reverse' but for a string STR rather than a list."
-  (apply 'string (nreverse (mapcar 'identity str))))
+  (apply #'string (nreverse (mapcar 'identity str))))
 
 (defun completion--common-suffix (strs)
   "Return the common suffix of the strings STRS."
   (completion--sreverse
    (try-completion
     ""
-    (mapcar 'completion--sreverse strs))))
+    (mapcar #'completion--sreverse strs))))
 
 (defun completion-pcm--merge-completions (strs pattern)
   "Extract the commonality in STRS, with the help of PATTERN.
@@ -2651,7 +2928,7 @@ the same set of elements."
                     ;; `any' it could lead to a merged completion that
                     ;; doesn't itself match the candidates.
                     (let ((suffix (completion--common-suffix comps)))
-                      (assert (stringp suffix))
+                      (cl-assert (stringp suffix))
                       (unless (equal suffix "")
                         (push suffix res)))))
                 (setq fixed "")))))
@@ -2715,11 +2992,11 @@ the same set of elements."
       (cons (concat prefix merged suffix) (+ newpos (length prefix)))))))
 
 (defun completion-pcm-try-completion (string table pred point)
-  (destructuring-bind (pattern all prefix suffix)
-      (completion-pcm--find-all-completions
-       string table pred point
-       (if minibuffer-completing-file-name
-           'completion-pcm--filename-try-filter))
+  (pcase-let ((`(,pattern ,all ,prefix ,suffix)
+               (completion-pcm--find-all-completions
+                string table pred point
+                (if minibuffer-completing-file-name
+                    'completion-pcm--filename-try-filter))))
     (completion-pcm--merge-try pattern all prefix suffix)))
 
 ;;; Substring completion
@@ -2740,15 +3017,17 @@ the same set of elements."
     (list all pattern prefix suffix (car bounds))))
 
 (defun completion-substring-try-completion (string table pred point)
-  (destructuring-bind (all pattern prefix suffix _carbounds)
-      (completion-substring--all-completions string table pred point)
+  (pcase-let ((`(,all ,pattern ,prefix ,suffix ,_carbounds)
+               (completion-substring--all-completions
+                string table pred point)))
     (if minibuffer-completing-file-name
         (setq all (completion-pcm--filename-try-filter all)))
     (completion-pcm--merge-try pattern all prefix suffix)))
 
 (defun completion-substring-all-completions (string table pred point)
-  (destructuring-bind (all pattern prefix _suffix _carbounds)
-      (completion-substring--all-completions string table pred point)
+  (pcase-let ((`(,all ,pattern ,prefix ,_suffix ,_carbounds)
+               (completion-substring--all-completions
+                string table pred point)))
     (when all
       (nconc (completion-pcm--hilit-commonality pattern all)
              (length prefix)))))
index 4706c918db3c9231a6ccbac3276b060f0016a780..cb52ecbd36eed555547b7120e14db7e4254177d1 100644 (file)
@@ -138,6 +138,19 @@ variation of `C-x M-c M-butterfly' from url `http://xkcd.com/378/'."
 (defvar list-dynamic-libraries--loaded-only-p)
 (make-variable-buffer-local 'list-dynamic-libraries--loaded-only-p)
 
+(defun list-dynamic-libraries--loaded (from)
+  "Compute the \"Loaded from\" column.
+Internal use only."
+  (if from
+      (let ((name (car from))
+            (path (or (cdr from) "<unknown>")))
+        ;; This is a roundabout way to change the tooltip without
+        ;; having to replace the default printer function
+        (propertize name
+                    'display (propertize name
+                                         'help-echo (concat "Loaded from: " path))))
+    ""))
+
 (defun list-dynamic-libraries--refresh ()
   "Recompute the list of dynamic libraries.
 Internal use only."
@@ -159,7 +172,7 @@ Internal use only."
       (when (or from
                 (not list-dynamic-libraries--loaded-only-p))
         (push (list id (vector (symbol-name id)
-                               (or from "")
+                               (list-dynamic-libraries--loaded from)
                                (mapconcat 'identity (cdr lib) ", ")))
               tabulated-list-entries)))))
 
index 22021bac57092ef7e086e2ef5ac6a4d898707b33..4848b6691bcb786556bedda62014e25491a611ed 100644 (file)
@@ -130,13 +130,7 @@ Intended to be added to `isearch-mode-hook'."
   (lambda (string bound noerror)
     (let ((search-fun
           ;; Use standard functions to search within one buffer
-          (cond
-           (isearch-word
-            (if isearch-forward 'word-search-forward 'word-search-backward))
-           (isearch-regexp
-            (if isearch-forward 're-search-forward 're-search-backward))
-           (t
-            (if isearch-forward 'search-forward 'search-backward))))
+          (isearch-search-fun-default))
          found buffer)
       (or
        ;; 1. First try searching in the initial buffer
index 17591ef12dd844b573019b0b35a6f369e6334537..7fb10505355aacddae64dcf2330a715c06710167 100644 (file)
@@ -169,7 +169,7 @@ Basically, we check for existing horizontal scrolling."
             nil))))))
 
 (defvar mouse-throw-with-scroll-bar nil
-  "*Set direction of mouse-throwing.
+  "Set direction of mouse-throwing.
 If nil, the text moves in the direction the mouse moves.
 If t, the scroll bar moves in the direction the mouse moves.")
 (defconst mouse-throw-magnifier-min -6)
index 20a78e556517c1d990a6fee2a777bedab2dbd4ca..a0d10a6494550befc5f25c17a5ac0bc26b216357 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mouse.el --- window system-independent mouse support
 
-;; Copyright (C) 1993-1995, 1999-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1999-2012 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: hardware, mouse
@@ -194,8 +194,7 @@ items `Turn Off' and `Help'."
         (newmap (if ancestor
                     (make-sparse-keymap (concat (format-mode-line mode-name)
                                                  " Mode"))
-                  menu-bar-edit-menu))
-        uniq)
+                  menu-bar-edit-menu)))
     (if ancestor
        (set-keymap-parent newmap ancestor))
     newmap))
@@ -299,7 +298,7 @@ Use the former if the menu bar is showing, otherwise the latter."
   (let ((w (posn-window (event-start event))))
     (and (window-minibuffer-p w)
         (not (minibuffer-window-active-p w))
-        (error "Minibuffer window is not active")))
+        (user-error "Minibuffer window is not active")))
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook))
 
@@ -389,10 +388,11 @@ This command must be bound to a mouse click."
 
 ;; Note that `window-in-direction' replaces `mouse-drag-window-above'
 ;; and `mouse-drag-vertical-line-rightward-window' with Emacs 24.1.
+
 (defun mouse-drag-line (start-event line)
-  "Drag some line with the mouse.
+  "Drag a mode line, header line, or vertical line with the mouse.
 START-EVENT is the starting mouse-event of the drag action.  LINE
-must be one of the symbols header, mode, or vertical."
+must be one of the symbols `header', `mode', or `vertical'."
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (let* ((echo-keystrokes 0)
@@ -401,122 +401,85 @@ must be one of the symbols header, mode, or vertical."
         (frame (window-frame window))
         (minibuffer-window (minibuffer-window frame))
          (on-link (and mouse-1-click-follows-link
-                      (or mouse-1-click-in-non-selected-windows
-                          (eq window (selected-window)))
                       (mouse-on-link-p start)))
-        (resize-minibuffer
-         ;; Resize the minibuffer window if it's on the same frame as
-         ;; and immediately below the position window and it's either
-         ;; active or `resize-mini-windows' is nil.
-         (and (eq line 'mode)
-              (eq (window-frame minibuffer-window) frame)
-              (= (nth 1 (window-edges minibuffer-window))
-                 (nth 3 (window-edges window)))
-              (or (not resize-mini-windows)
-                  (eq minibuffer-window (active-minibuffer-window)))))
-        (which-side
-         (and (eq line 'vertical)
-              (or (cdr (assq 'vertical-scroll-bars (frame-parameters frame)))
-                  'right)))
-        done event mouse growth dragged)
+        (side (and (eq line 'vertical)
+                   (or (cdr (assq 'vertical-scroll-bars
+                                  (frame-parameters frame)))
+                       'right)))
+        (draggable t)
+        event position growth dragged)
     (cond
      ((eq line 'header)
       ;; Check whether header-line can be dragged at all.
       (if (window-at-side-p window 'top)
-         (setq done t)
+         (setq draggable nil)
        (setq window (window-in-direction 'above window t))))
      ((eq line 'mode)
       ;; Check whether mode-line can be dragged at all.
-      (when (and (window-at-side-p window 'bottom)
-                (not resize-minibuffer))
-       (setq done t)))
+      (and (window-at-side-p window 'bottom)
+          ;; Allow resizing the minibuffer window if it's on the same
+          ;; frame as and immediately below the clicked window, and
+          ;; it's active or `resize-mini-windows' is nil.
+          (not (and (eq (window-frame minibuffer-window) frame)
+                    (= (nth 1 (window-edges minibuffer-window))
+                       (nth 3 (window-edges window)))
+                    (or (not resize-mini-windows)
+                        (eq minibuffer-window
+                            (active-minibuffer-window)))))
+          (setq draggable nil)))
      ((eq line 'vertical)
-      ;; Get the window to adjust for the vertical case.
-      (setq window
-           (if (eq which-side 'right)
-               ;; If the scroll bar is on the window's right or there's
-               ;; no scroll bar at all, adjust the window where the
-               ;; start-event occurred.
-               window
-             ;; If the scroll bar is on the start-event window's left,
-             ;; adjust the window on the left of it.
-             (window-in-direction 'left window t)))))
+      ;; Get the window to adjust for the vertical case.  If the
+      ;; scroll bar is on the window's right or there's no scroll bar
+      ;; at all, adjust the window where the start-event occurred.  If
+      ;; the scroll bar is on the start-event window's left, adjust
+      ;; the window on the left of it.
+      (unless (eq side 'right)
+       (setq window (window-in-direction 'left window t)))))
 
     ;; Start tracking.
     (track-mouse
-      ;; Loop reading events and sampling the position of the mouse.
-      (while (not done)
-       (setq event (read-event))
-       (setq mouse (mouse-position))
-       ;; Do nothing if
-       ;;   - there is a switch-frame event.
-       ;;   - the mouse isn't in the frame that we started in
-       ;;   - the mouse isn't in any Emacs frame
-       ;; Drag if
-       ;;   - there is a mouse-movement event
-       ;;   - there is a scroll-bar-movement event (??)
-       ;;     (same as mouse movement for our purposes)
-       ;; Quit if
-       ;;   - there is a keyboard event or some other unknown event.
+      ;; Loop reading events and sampling the position of the mouse,
+      ;; until there is a non-mouse-movement event.  Also,
+      ;; scroll-bar-movement events are the same as mouse movement for
+      ;; our purposes.  (Why? -- cyd)
+      (while (progn
+              (setq event (read-event))
+              (memq (car-safe event) '(mouse-movement scroll-bar-movement)))
+       (setq position (mouse-position))
        (cond
-        ((not (consp event))
-         (setq done t))
-        ((memq (car event) '(switch-frame select-window))
-         nil)
-        ((not (memq (car event) '(mouse-movement scroll-bar-movement)))
-         (when (consp event)
-           ;; Do not unread a drag-mouse-1 event to avoid selecting
-           ;; some other window.  For vertical line dragging do not
-           ;; unread mouse-1 events either (but only if we dragged at
-           ;; least once to allow mouse-1 clicks get through.
-           (unless (and dragged
-                        (if (eq line 'vertical)
-                            (memq (car event) '(drag-mouse-1 mouse-1))
-                          (eq (car event) 'drag-mouse-1)))
-             (push event unread-command-events)))
-         (setq done t))
-        ((or (not (eq (car mouse) frame)) (null (car (cdr mouse))))
+        ((or (not (eq (car position) frame))
+             (null (cadr position)))
          nil)
         ((eq line 'vertical)
-         ;; Drag vertical divider (the calculations below are those
-         ;; from Emacs 23).
-         (setq growth
-               (- (- (cadr mouse)
-                     (if (eq which-side 'right) 0 2))
-                  (nth 2 (window-edges window))
-                  -1))
+         ;; Drag vertical divider.
+         (setq growth (- (cadr position)
+                         (if (eq side 'right) 0 2)
+                         (nth 2 (window-edges window))
+                         -1))
          (unless (zerop growth)
-           ;; Remember that we dragged.
            (setq dragged t))
          (adjust-window-trailing-edge window growth t))
-        (t
-         ;; Drag horizontal divider (the calculations below are those
-         ;; from Emacs 23).
+        (draggable
+         ;; Drag horizontal divider.
          (setq growth
                (if (eq line 'mode)
-                   (- (cddr mouse) (nth 3 (window-edges window)) -1)
+                   (- (cddr position) (nth 3 (window-edges window)) -1)
                  ;; The window's top includes the header line!
-                 (- (nth 3 (window-edges window)) (cddr mouse))))
-
+                 (- (nth 3 (window-edges window)) (cddr position))))
          (unless (zerop growth)
-           ;; Remember that we dragged.
            (setq dragged t))
+         (adjust-window-trailing-edge window (if (eq line 'mode)
+                                                 growth
+                                               (- growth)))))))
+    ;; Process the terminating event.
+    (when (and (mouse-event-p event) on-link (not dragged)
+              (mouse--remap-link-click-p start-event event))
+      ;; If mouse-2 has never been done by the user, it doesn't have
+      ;; the necessary property to be interpreted correctly.
+      (put 'mouse-2 'event-kind 'mouse-click)
+      (setcar event 'mouse-2))
+    (push event unread-command-events)))
 
-         (if (eq line 'mode)
-             (adjust-window-trailing-edge window growth)
-           (adjust-window-trailing-edge window (- growth))))))
-
-      ;; Presumably, if this was just a click, the last event should be
-      ;; `mouse-1', whereas if this did move the mouse, it should be a
-      ;; `drag-mouse-1'.  `dragged' nil tells us that we never dragged
-      ;; and `on-link' tells us that there is a link to follow.
-      (when (and on-link (not dragged)
-                (eq 'mouse-1 (car-safe (car unread-command-events))))
-       ;; If mouse-2 has never been done by the user, it doesn't
-       ;; have the necessary property to be interpreted correctly.
-       (put 'mouse-2 'event-kind 'mouse-click)
-       (setcar unread-command-events
-               (cons 'mouse-2 (cdar unread-command-events)))))))
 
 (defun mouse-drag-mode-line (start-event)
   "Change the height of a window by dragging on the mode line."
@@ -792,10 +755,8 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
                   ;; Don't count the mode line.
                   (1- (nth 3 bounds))))
         (on-link (and mouse-1-click-follows-link
-                      (or mouse-1-click-in-non-selected-windows
-                          (eq start-window original-window))
                        ;; Use start-point before the intangibility
-                       ;; treatment, in case we click on a link inside an
+                       ;; treatment, in case we click on a link inside
                        ;; intangible text.
                        (mouse-on-link-p start-posn)))
         (click-count (1- (event-click-count start-event)))
@@ -804,9 +765,9 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
                                  (= click-count 1)))
         ;; Suppress automatic hscrolling, because that is a nuisance
         ;; when setting point near the right fringe (but see below).
-        (automatic-hscrolling-saved automatic-hscrolling)
-        (automatic-hscrolling nil)
-        event end end-point)
+        (auto-hscroll-mode-saved auto-hscroll-mode)
+        (auto-hscroll-mode nil)
+        moved-off-start event end end-point)
 
     (setq mouse-selection-click-count click-count)
     ;; In case the down click is in the middle of some intangible text,
@@ -837,10 +798,13 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
          ;; Automatic hscrolling did not occur during the call to
          ;; `read-event'; but if the user subsequently drags the
          ;; mouse, go ahead and hscroll.
-         (let ((automatic-hscrolling automatic-hscrolling-saved))
+         (let ((auto-hscroll-mode auto-hscroll-mode-saved))
            (redisplay))
          (setq end (event-end event)
                end-point (posn-point end))
+         ;; Note whether the mouse has left the starting position.
+         (unless (eq end-point start-point)
+           (setq moved-off-start t))
          (if (and (eq (posn-window end) start-window)
                   (integer-or-marker-p end-point))
              (mouse--drag-set-mark-and-point start-point
@@ -881,11 +845,13 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
                   (let (deactivate-mark)
                     (copy-region-as-kill (mark) (point)))))
 
-         ;; If point hasn't moved, run the binding of the
-         ;; terminating up-event.
+         ;; Otherwise, run binding of terminating up-event.
          (if do-multi-click
              (goto-char start-point)
-           (deactivate-mark))
+           (deactivate-mark)
+           (unless moved-off-start
+             (pop-mark)))
+
          (when (and (functionp fun)
                     (= start-hscroll (window-hscroll start-window))
                     ;; Don't run the up-event handler if the window
index 614f2bd68066ee4679c92305f926b5ba0f544d15..ff5ce801c63ab35d1d63baa2944e9681d6f9c30e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mpc.el --- A client for the Music Player Daemon   -*- coding: utf-8; lexical-binding: t -*-
 
-;; Copyright (C) 2006-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
 ;; Keywords: multimedia
 ;; UI-commands       : mpc-
 ;; internal          : mpc--
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup mpc ()
-  "A Client for the Music Player Daemon."
+  "Client for the Music Player Daemon (mpd)."
   :prefix "mpc-"
   :group 'multimedia
   :group 'applications)
@@ -184,10 +184,7 @@ numerically rather than lexicographically."
                     (abs res))
                 res))))))))
 
-(defun mpc-string-prefix-p (str1 str2)
-  ;; FIXME: copied from pcvs-util.el.
-  "Tell whether STR1 is a prefix of STR2."
-  (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
+(define-obsolete-function-alias 'mpc-string-prefix-p 'string-prefix-p "24.2")
 
 ;; This can speed up mpc--song-search significantly.  The table may grow
 ;; very large, tho.  It's only bounded by the fact that it gets flushed
@@ -295,7 +292,7 @@ and HOST defaults to localhost."
 (defconst mpc--proc-alist-to-alists-starters '(file directory))
 
 (defun mpc--proc-alist-to-alists (alist)
-  (assert (or (null alist)
+  (cl-assert (or (null alist)
               (memq (caar alist) mpc--proc-alist-to-alists-starters)))
   (let ((starter (caar alist))
         (alists ())
@@ -409,7 +406,7 @@ which will be concatenated with proper quoting before passing them to MPD."
                             (funcall callback (prog1 (mpc-proc-buf-to-alist
                                                       (current-buffer))
                                                 (set-buffer buf))))))
-    ;; (lexical-let ((res nil))
+    ;; (let ((res nil))
     ;;   (mpc-proc-cmd-to-alist cmd (lambda (alist) (setq res alist)))
     ;;   (mpc-proc-sync)
     ;;   res)
@@ -460,7 +457,7 @@ to call FUN for any change whatsoever.")
   (let ((old-status mpc-status))
     ;; Update the alist.
     (setq mpc-status (mpc-proc-buf-to-alist))
-    (assert mpc-status)
+    (cl-assert mpc-status)
     (unless (equal old-status mpc-status)
       ;; Run the relevant refresher functions.
       (dolist (pair mpc-status-callbacks)
@@ -547,7 +544,7 @@ Any call to `mpc-status-refresh' may cause it to be restarted."
 ;; (defun mpc--queue-pop ()
 ;;   (when mpc-queue                       ;Can be nil if out of sync.
 ;;     (let ((song (car mpc-queue)))
-;;       (assert song)
+;;       (cl-assert song)
 ;;       (push (if (and (consp song) (cddr song))
 ;;                 ;; The queue's first element is itself a list of
 ;;                 ;; songs, where the first element isn't itself a song
@@ -556,7 +553,7 @@ Any call to `mpc-status-refresh' may cause it to be restarted."
 ;;               (prog1 (if (consp song) (cadr song) song)
 ;;                 (setq mpc-queue (cdr mpc-queue))))
 ;;             mpc-queue-back)
-;;       (assert (stringp (car mpc-queue-back))))))
+;;       (cl-assert (stringp (car mpc-queue-back))))))
 
 ;; (defun mpc--queue-refresh ()
 ;;   ;; Maintain the queue.
@@ -614,7 +611,7 @@ The songs are returned as alists."
                        (i 0))
                    (mapcar (lambda (s)
                              (prog1 (cons (cons 'Pos (number-to-string i)) s)
-                               (incf i)))
+                               (cl-incf i)))
                            l)))
                 ((eq tag 'Search)
                  (mpc-proc-buf-to-alists
@@ -830,8 +827,8 @@ If PLAYLIST is t or nil or missing, use the main playlist."
                          (list "move" song-pos dest-pos))
                   (if (< song-pos dest-pos)
                       ;; This move has shifted dest-pos by 1.
-                      (decf dest-pos))
-                  (incf i)))
+                      (cl-decf dest-pos))
+                  (cl-incf i)))
               ;; Sort them from last to first, so the renumbering
               ;; caused by the earlier deletions affect
               ;; later ones a bit less.
@@ -975,8 +972,8 @@ If PLAYLIST is t or nil or missing, use the main playlist."
                (right-align (match-end 1))
                (text
                 (if (eq info 'self) (symbol-name tag)
-                  (case tag
-                    ((Time Duration)
+                  (pcase tag
+                    ((or `Time `Duration)
                      (let ((time (cdr (or (assq 'time info) (assq 'Time info)))))
                        (setq pred (list nil)) ;Just assume it's never eq.
                        (when time
@@ -984,7 +981,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
                                                     (string-match ":" time))
                                                (substring time (match-end 0))
                                              time)))))
-                    (Cover
+                    (`Cover
                      (let* ((dir (file-name-directory (cdr (assq 'file info))))
                             (cover (concat dir "cover.jpg"))
                             (file (condition-case err
@@ -1007,7 +1004,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
                              (mpc-tempfiles-add image tempfile)))
                          (setq size nil)
                          (propertize dir 'display image))))
-                    (t (let ((val (cdr (assq tag info))))
+                    (_ (let ((val (cdr (assq tag info))))
                          ;; For Streaming URLs, there's no other info
                          ;; than the URL in `file'.  Pretend it's in `Title'.
                          (when (and (null val) (eq tag 'Title))
@@ -1225,7 +1222,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
   (beginning-of-line))
 
 (defun mpc-select-make-overlay ()
-  (assert (not (get-char-property (point) 'mpc-select)))
+  (cl-assert (not (get-char-property (point) 'mpc-select)))
   (let ((ol (make-overlay
              (line-beginning-position) (line-beginning-position 2))))
     (overlay-put ol 'mpc-select t)
@@ -1261,7 +1258,7 @@ If PLAYLIST is t or nil or missing, use the main playlist."
                    (> (overlay-end ol) (point)))
               (delete-overlay ol)
             (push ol ols)))
-        (assert (= (1+ (length ols)) (length mpc-select)))
+        (cl-assert (= (1+ (length ols)) (length mpc-select)))
         (setq mpc-select ols)))
      ;; We're trying to select *ALL* additionally to others.
      ((mpc-tagbrowser-all-p) nil)
@@ -1289,12 +1286,12 @@ If PLAYLIST is t or nil or missing, use the main playlist."
           (while (and (zerop (forward-line 1))
                       (get-char-property (point) 'mpc-select))
             (setq end (1+ (point)))
-            (incf after))
+            (cl-incf after))
           (goto-char mid)
           (while (and (zerop (forward-line -1))
                       (get-char-property (point) 'mpc-select))
             (setq start (point))
-            (incf before))
+            (cl-incf before))
           (if (and (= after 0) (= before 0))
               ;; Shortening an already minimum-size region: do nothing.
               nil
@@ -1318,13 +1315,13 @@ If PLAYLIST is t or nil or missing, use the main playlist."
               (start (line-beginning-position)))
           (while (and (zerop (forward-line 1))
                       (not (get-char-property (point) 'mpc-select)))
-            (incf count))
+            (cl-incf count))
           (unless (get-char-property (point) 'mpc-select)
             (setq count nil))
           (goto-char start)
           (while (and (zerop (forward-line -1))
                       (not (get-char-property (point) 'mpc-select)))
-            (incf before))
+            (cl-incf before))
           (unless (get-char-property (point) 'mpc-select)
             (setq before nil))
           (when (and before (or (null count) (< before count)))
@@ -1433,7 +1430,7 @@ when constructing the set of constraints."
   (mpc-select-save
     (widen)
     (goto-char (point-min))
-    (assert (looking-at (regexp-quote mpc-tagbrowser-all-name)))
+    (cl-assert (looking-at (regexp-quote mpc-tagbrowser-all-name)))
     (forward-line 1)
     (let ((inhibit-read-only t))
       (delete-region (point) (point-max))
@@ -1690,7 +1687,7 @@ Return non-nil if a selection was deactivated."
         (process-put (mpc-proc) prop
                      (delq nil
                            (mapcar (lambda (x)
-                                     (if (mpc-string-prefix-p name x)
+                                     (if (string-prefix-p name x)
                                          nil x))
                                    new)))))
     (mpc-tagbrowser-refresh)))
@@ -1919,7 +1916,7 @@ This is used so that they can be compared with `eq', which is needed for
                                                 (cdr (assq 'file song1))
                                                 (cdr (assq 'file song2)))))
                                       (and (integerp cmp) (< cmp 0)))))))
-              (incf totaltime (string-to-number (or (cdr (assq 'Time song)) "0")))
+              (cl-incf totaltime (string-to-number (or (cdr (assq 'Time song)) "0")))
               (mpc-format mpc-songs-format song)
               (delete-char (- (skip-chars-backward " "))) ;Remove trailing space.
               (insert "\n")
@@ -2043,7 +2040,7 @@ This is used so that they can be compared with `eq', which is needed for
                                        (- (point) (car prev)))
                                     next prev)
                               (or next prev)))))
-              (assert sn)
+              (cl-assert sn)
               (mpc-proc-cmd (concat "play " sn))))))))))
 
 (define-derived-mode mpc-songs-mode mpc-mode "MPC-song"
@@ -2158,12 +2155,12 @@ This is used so that they can be compared with `eq', which is needed for
     (dolist (song (car context))
       (and (zerop (forward-line -1))
            (eq (get-text-property (point) 'mpc-file) song)
-           (incf count)))
+           (cl-incf count)))
     (goto-char pos)
     (dolist (song (cdr context))
       (and (zerop (forward-line 1))
            (eq (get-text-property (point) 'mpc-file) song)
-           (incf count)))
+           (cl-incf count)))
     count))
 
 (defun mpc-songpointer-refresh-hairy ()
@@ -2204,13 +2201,13 @@ This is used so that they can be compared with `eq', which is needed for
                ((< score context-size) nil)
                (t
                 ;; Score is equal and increasing context might help: try it.
-                (incf context-size)
+                (cl-incf context-size)
                 (let ((new-context
                        (mpc-songpointer-context context-size plbuf)))
                   (if (null new-context)
                       ;; There isn't more context: choose one arbitrarily
                       ;; and keep looking for a better match elsewhere.
-                      (decf context-size)
+                      (cl-decf context-size)
                     (setq context new-context)
                     (setq score (mpc-songpointer-score context pos))
                     (save-excursion
index 2c759b1c89d23530fdfb73d25c518564d9b79e6c..d9fb2c55d8736d33bf2e3019a595a1653210a3d0 100644 (file)
 ;; hacked on by Dave Love.
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
-;;;
-;;; Some example constants to be used for `msb-menu-cond'.  See that
-;;; variable for more information.  Please note that if the condition
-;;; returns `multi', then the buffer can appear in several menus.
-;;;
+;;
+;; Some example constants to be used for `msb-menu-cond'.  See that
+;; variable for more information.  Please note that if the condition
+;; returns `multi', then the buffer can appear in several menus.
+;;
 (defconst msb--few-menus
   '(((and (boundp 'server-buffer-clients)
          server-buffer-clients
@@ -271,7 +271,7 @@ that differs by this value or more."
   :group 'msb)
 
 (defvar msb-files-by-directory-sort-key 0
-  "*The sort key for files sorted by directory.")
+  "The sort key for files sorted by directory.")
 
 (defcustom msb-max-menu-items 15
   "The maximum number of items in a menu.
@@ -316,7 +316,7 @@ No buffers at all if less than 1 or nil (or any non-number)."
   :group 'msb)
 
 (defvar msb-horizontal-shift-function (lambda () 0)
-  "*Function that specifies how many pixels to shift the top menu leftwards.")
+  "Function that specifies how many pixels to shift the top menu leftwards.")
 
 (defcustom msb-display-invisible-buffers-p nil
   "Show invisible buffers or not.
@@ -327,7 +327,7 @@ names that starts with a space character."
   :group 'msb)
 
 (defvar msb-item-handling-function 'msb-item-handler
-  "*The appearance of a buffer menu.
+  "The appearance of a buffer menu.
 
 The default function to call for handling the appearance of a menu
 item.  It should take two arguments, BUFFER and MAX-BUFFER-NAME-LENGTH,
@@ -702,18 +702,18 @@ See `msb-menu-cond' for a description of its elements."
        (multi-flag nil)
        function-info-list)
     (setq function-info-list
-         (loop for fi
-               across function-info-vector
-               if (and (setq result
-                             (eval (aref fi 1))) ;Test CONDITION
-                       (not (and (eq result 'no-multi)
-                                 multi-flag))
-                       (progn (when (eq result 'multi)
-                                (setq multi-flag t))
-                              t))
-               collect fi
-               until (and result
-                          (not (eq result 'multi)))))
+         (cl-loop for fi
+                   across function-info-vector
+                   if (and (setq result
+                                 (eval (aref fi 1))) ;Test CONDITION
+                           (not (and (eq result 'no-multi)
+                                     multi-flag))
+                           (progn (when (eq result 'multi)
+                                    (setq multi-flag t))
+                                  t))
+                   collect fi
+                   until (and result
+                              (not (eq result 'multi)))))
     (when (and (not function-info-list)
               (not result))
       (error "No catch-all in msb-menu-cond!"))
@@ -817,7 +817,7 @@ results in
 (defun msb--mode-menu-cond ()
   (let ((key msb-modes-key))
     (mapcar (lambda (item)
-             (incf key)
+             (cl-incf key)
              (list `( eq major-mode (quote ,(car item)))
                    key
                    (concat (cdr item) " (%d)")))
@@ -841,18 +841,18 @@ It takes the form ((TITLE . BUFFER-LIST)...)."
             (> msb-display-most-recently-used 0))
     (let* ((buffers (cdr (buffer-list)))
           (most-recently-used
-           (loop with n = 0
-                 for buffer in buffers
-                 if (with-current-buffer buffer
-                      (and (not (msb-invisible-buffer-p))
-                           (not (eq major-mode 'dired-mode))))
-                 collect (with-current-buffer buffer
-                           (cons (funcall msb-item-handling-function
-                                          buffer
-                                          max-buffer-name-length)
-                                 buffer))
-                 and do (incf n)
-                 until (>= n msb-display-most-recently-used))))
+           (cl-loop with n = 0
+                     for buffer in buffers
+                     if (with-current-buffer buffer
+                          (and (not (msb-invisible-buffer-p))
+                               (not (eq major-mode 'dired-mode))))
+                     collect (with-current-buffer buffer
+                               (cons (funcall msb-item-handling-function
+                                              buffer
+                                              max-buffer-name-length)
+                                     buffer))
+                     and do (cl-incf n)
+                     until (>= n msb-display-most-recently-used))))
       (cons (if (stringp msb-most-recently-used-title)
                (format msb-most-recently-used-title
                        (length most-recently-used))
@@ -899,29 +899,29 @@ It takes the form ((TITLE . BUFFER-LIST)...)."
     (when file-buffers
       (setq file-buffers
            (mapcar (lambda (buffer-list)
-                     (list* msb-files-by-directory-sort-key
-                             (car buffer-list)
-                             (sort
-                              (mapcar (lambda (buffer)
-                                        (cons (with-current-buffer buffer
-                                                (funcall
-                                                 msb-item-handling-function
-                                                 buffer
-                                                 max-buffer-name-length))
-                                              buffer))
-                                      (cdr buffer-list))
-                              (lambda (item1 item2)
-                                (string< (car item1) (car item2))))))
+                     `(,msb-files-by-directory-sort-key
+                        ,(car buffer-list)
+                        ,@(sort
+                           (mapcar (lambda (buffer)
+                                     (cons (with-current-buffer buffer
+                                             (funcall
+                                              msb-item-handling-function
+                                              buffer
+                                              max-buffer-name-length))
+                                           buffer))
+                                   (cdr buffer-list))
+                           (lambda (item1 item2)
+                             (string< (car item1) (car item2))))))
                     (msb--choose-file-menu file-buffers))))
     ;; Now make the menu - a list of (TITLE . BUFFER-LIST)
     (let* (menu
           (most-recently-used
            (msb--most-recently-used-menu max-buffer-name-length))
           (others (nconc file-buffers
-                          (loop for elt
-                                across function-info-vector
-                                for value = (msb--create-sort-item elt)
-                                if value collect value))))
+                          (cl-loop for elt
+                                   across function-info-vector
+                                   for value = (msb--create-sort-item elt)
+                                   if value collect value))))
       (setq menu
            (mapcar 'cdr                ;Remove the SORT-KEY
                    ;; Sort the menus - not the items.
@@ -1039,7 +1039,7 @@ variable `msb-menu-cond'."
          (tmp-list nil))
       (while (< count msb-max-menu-items)
        (push (pop list) tmp-list)
-       (incf count))
+       (cl-incf count))
       (setq tmp-list (nreverse tmp-list))
       (setq sub-name (concat (car (car tmp-list)) "..."))
       (push (nconc (list mcount sub-name
@@ -1076,7 +1076,7 @@ variable `msb-menu-cond'."
                                  (cons (buffer-name (cdr item))
                                        (cons (car item) end)))
                                (cdr sub-menu))))
-          (nconc (list (incf mcount) (car sub-menu)
+          (nconc (list (cl-incf mcount) (car sub-menu)
                        'keymap (car sub-menu))
                  (msb--split-menus buffers))))))
      raw-menu)))
index 2a44148e4ce4039b78f9336ef048b1196cdcf1f2..dd695c29c78729a25e2d54d65f4d8d2facf582dc 100644 (file)
 ;;;; ------------------------------------------------------------
 
 (defgroup ange-ftp nil
-  "Accessing remote files and directories using FTP
-   made as simple and transparent as possible."
+  "Accessing remote files and directories using FTP."
   :group 'files
   :group 'comm
   :prefix "ange-ftp-")
@@ -697,11 +696,11 @@ parenthesized expressions in REGEXP for the components (in that order)."
 
 (defvar ange-ftp-multi-msgs
   "^150-\\|^220-\\|^230-\\|^226\\|^25.-\\|^221-\\|^200-\\|^331-\\|^4[25]1-\\|^530-"
-  "*Regular expression matching the start of a multiline FTP reply.")
+  "Regular expression matching the start of a multiline FTP reply.")
 
 (defvar ange-ftp-good-msgs
   "^220 \\|^230 \\|^226 \\|^25. \\|^221 \\|^200 \\|^[Hh]ash mark"
-  "*Regular expression matching FTP \"success\" messages.")
+  "Regular expression matching FTP \"success\" messages.")
 
 ;; CMS and the odd VMS machine say 200 Port rather than 200 PORT.
 ;; Also CMS machines use a multiline 550- reply to say that you
@@ -908,7 +907,7 @@ matches the login banner."
   (if (eq system-type 'hpux)
       "stty -onlcr -echo\n"
     "stty -echo nl\n")
-  "*Set up terminal after logging in to the gateway machine.
+  "Set up terminal after logging in to the gateway machine.
 This command should stop the terminal from echoing each command, and
 arrange to strip out trailing ^M characters.")
 
@@ -1201,6 +1200,11 @@ only return the directory part of FILE."
 
 (defun ange-ftp-get-passwd (host user)
   "Return the password for specified HOST and USER, asking user if necessary."
+  ;; If `non-essential' is non-nil, don't ask for a password.  It will
+  ;; be caught in Tramp.
+  (when non-essential
+    (throw 'non-essential 'non-essential))
+
   (ange-ftp-parse-netrc)
 
   ;; look up password in the hash table first; user might have overridden the
@@ -1231,7 +1235,8 @@ only return the directory part of FILE."
        ;; see if same user has logged in to other hosts; if so then prompt
        ;; with the password that was used there.
        (t
-        (let* ((other (ange-ftp-get-host-with-passwd user))
+        (let* ((enable-recursive-minibuffers t)
+               (other (ange-ftp-get-host-with-passwd user))
                (passwd (if other
 
                            ;; found another machine with the same user.
@@ -1775,6 +1780,10 @@ good, skip, fatal, or unknown."
 
 (defun ange-ftp-gwp-start (host user name args)
   "Login to the gateway machine and fire up an FTP process."
+  ;; If `non-essential' is non-nil, don't reopen a new connection.  It
+  ;; will be caught in Tramp.
+  (when non-essential
+    (throw 'non-essential 'non-essential))
   (let (;; It would be nice to make process-connection-type nil,
        ;; but that doesn't work: ftp never responds.
        ;; Can anyone find a fix for that?
@@ -1906,6 +1915,10 @@ been queued with no result.  CONT will still be called, however."
   "Spawn a new FTP process ready to connect to machine HOST and give it NAME.
 If HOST is only FTP-able through a gateway machine then spawn a shell
 on the gateway machine to do the FTP instead."
+  ;; If `non-essential' is non-nil, don't reopen a new connection.  It
+  ;; will be caught in Tramp.
+  (when non-essential
+    (throw 'non-essential 'non-essential))
   (let* ((use-gateway (ange-ftp-use-gateway-p host))
         (use-smart-ftp (and (not ange-ftp-gateway-host)
                             (ange-ftp-use-smart-gateway-p host)))
@@ -2098,7 +2111,7 @@ suffix of the form #PORT to specify a non-default port."
 ;; ange@hplb.hpl.hp.com says this should not be changed.
 (defvar ange-ftp-hash-mark-msgs
   "[hH]ash mark [^0-9]*\\([0-9]+\\)"
-  "*Regexp matching the FTP client's output upon doing a HASH command.")
+  "Regexp matching the FTP client's output upon doing a HASH command.")
 
 (defun ange-ftp-guess-hash-mark-size (proc)
   (if ange-ftp-send-hash
@@ -2124,6 +2137,11 @@ Create a new process if needed."
         (proc (get-process name)))
     (if (and proc (memq (process-status proc) '(run open)))
        proc
+      ;; If `non-essential' is non-nil, don't reopen a new connection.  It
+      ;; will be caught in Tramp.
+      (when non-essential
+       (throw 'non-essential 'non-essential))
+
       ;; Must delete dead process so that new process can reuse the name.
       (if proc (delete-process proc))
       (let ((pass (ange-ftp-quote-string
@@ -3125,21 +3143,15 @@ logged in as user USER and cd'd to directory DIR."
   "Documented as `expand-file-name'."
   (save-match-data
     (setq default (or default default-directory))
-    (cond ((eq (string-to-char name) ?~)
-          (ange-ftp-real-expand-file-name name))
-         ((eq (string-to-char name) ?/)
-          (ange-ftp-canonize-filename name))
-         ((and (eq system-type 'windows-nt)
-               (eq (string-to-char name) ?\\))
-          (ange-ftp-canonize-filename name))
-         ((and (eq system-type 'windows-nt)
-               (or (string-match "\\`[a-zA-Z]:" name)
-                   (string-match "\\`[a-zA-Z]:" default)))
-          (ange-ftp-real-expand-file-name name default))
-         ((zerop (length name))
-          (ange-ftp-canonize-filename default))
-         ((ange-ftp-canonize-filename
-           (concat (file-name-as-directory default) name))))))
+    (cond
+     ((ange-ftp-ftp-name name)
+      ;; `default' is irrelevant.
+      (ange-ftp-canonize-filename name))
+     ((file-name-absolute-p name)
+      ;; `name' is absolute but is not an ange-ftp name => not ange-ftp.
+      (ange-ftp-real-expand-file-name name "/"))
+     ((ange-ftp-canonize-filename
+       (concat (file-name-as-directory default) name))))))
 \f
 ;;; These are problems--they are currently not enabled.
 
@@ -3372,7 +3384,7 @@ system TYPE.")
       (if (ange-ftp-file-entry-p name)
          (let ((file-ent (ange-ftp-get-file-entry name)))
            (if (stringp file-ent)
-               (file-exists-p
+               (ange-ftp-file-exists-p
                 (ange-ftp-expand-symlink file-ent
                                          (file-name-directory
                                           (directory-file-name name))))
@@ -3781,7 +3793,8 @@ so return the size on the remote host exactly. See RFC 3659."
                   (format "Copying %s to %s" f-abbr t-abbr)))
             (list 'ange-ftp-cf2
                   newname t-host t-user binary temp1 temp2 cont)
-            nowait))
+            nowait)
+           (ange-ftp-add-file-entry newname))
 
        ;; newname wasn't remote.
        (ange-ftp-cf2 t nil newname t-host t-user binary temp1 temp2 cont))
@@ -3956,10 +3969,15 @@ E.g.,
           (string-match "\\`[a-zA-Z]:[/\\]\\'" dir))
       (string-equal "/" dir)))
 
+(defmacro ange-ftp-ignore-errors-if-non-essential (&rest body)
+  `(if non-essential
+       (ignore-errors ,@body)
+     (progn ,@body)))
+
 (defun ange-ftp-file-name-all-completions (file dir)
   (let ((ange-ftp-this-dir (expand-file-name dir)))
     (if (ange-ftp-ftp-name ange-ftp-this-dir)
-       (progn
+       (ange-ftp-ignore-errors-if-non-essential
          (ange-ftp-barf-if-not-directory ange-ftp-this-dir)
          (setq ange-ftp-this-dir
                (ange-ftp-real-file-name-as-directory ange-ftp-this-dir))
@@ -6079,7 +6097,7 @@ Other orders of $ and _ seem to all work just fine.")
 
 (defcustom ange-ftp-bs2000-additional-pubsets
   nil
-  "*List of additional pubsets available to all users."
+  "List of additional pubsets available to all users."
   :group 'ange-ftp
   :type '(repeat string))
 
index 0bfc8eda3b1510ae08b6ab43cdf1b1c12d7faa44..20d712159266d003e87266feb0c5347f02663711 100644 (file)
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Variables
 
-(eval-when-compile (require 'cl))
-
 (defgroup browse-url nil
   "Use a web browser to look at a URL."
   :prefix "browse-url-"
@@ -467,7 +465,7 @@ commands reverses the effect of this variable.  Requires Netscape version
     ;; it in anonymous cases.  If it's not anonymous the next regexp
     ;; applies.
     ("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/")
-    ,@(if (memq system-type '(windows-nt ms-dos cygwin))
+    ,@(if (memq system-type '(windows-nt ms-dos))
           '(("^\\([a-zA-Z]:\\)[\\/]" . "file:///\\1/")
             ("^[\\/][\\/]+" . "file://")))
     ("^/+" . "file:///"))
@@ -642,7 +640,7 @@ CHARS is a regexp-like character alternative (e.g., \"[)$]\")."
        (s 0))
     (while (setq s (string-match chars encoded-text s))
       (setq encoded-text
-           (replace-match (format "%%%x"
+           (replace-match (format "%%%X"
                                   (string-to-char (match-string 0 encoded-text)))
                           t t encoded-text)
            s (1+ s)))
@@ -655,7 +653,7 @@ regarding its parameter treatment."
   ;; FIXME: Is there an actual example of a web browser getting
   ;; confused?  (This used to encode commas, but at least Firefox
   ;; handles commas correctly and doesn't accept encoded commas.)
-  (browse-url-url-encode-chars url "[)$]"))
+  (browse-url-url-encode-chars url "[\")$] "))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; URL input
@@ -724,12 +722,6 @@ interactively.  Turn the filename into a URL with function
 (defun browse-url-file-url (file)
   "Return the URL corresponding to FILE.
 Use variable `browse-url-filename-alist' to map filenames to URLs."
-  ;; De-munge Cygwin filenames before passing them to Windows browser.
-  (if (eq system-type 'cygwin)
-      (let ((winfile (with-output-to-string
-                      (call-process "cygpath" nil standard-output
-                                    nil "-m" file))))
-       (setq file (substring winfile 0 -1))))
   (let ((coding (and (default-value 'enable-multibyte-characters)
                     (or file-name-coding-system
                         default-file-name-coding-system))))
@@ -1627,22 +1619,21 @@ from `browse-url-elinks-wrapper'."
 
 (defun browse-url-elinks-sentinel (process url)
   "Determines if Elinks is running or a new one has to be started."
-  (let ((exit-status (process-exit-status process)))
-    ;; Try to determine if an instance is running or if we have to
-    ;; create a new one.
-    (case exit-status
-         (5
-          ;; No instance, start a new one.
-          (browse-url-elinks-new-window url))
-         (0
-          ;; Found an instance, open URL in new tab.
-          (let ((process-environment (browse-url-process-environment)))
-            (start-process (concat "elinks:" url) nil
-                           "elinks" "-remote"
-                           (concat "openURL(\"" url "\",new-tab)"))))
-         (otherwise
-          (error "Unrecognized exit-code %d of process `elinks'"
-                 exit-status)))))
+  ;; Try to determine if an instance is running or if we have to
+  ;; create a new one.
+  (pcase (process-exit-status process)
+    (5
+     ;; No instance, start a new one.
+     (browse-url-elinks-new-window url))
+    (0
+     ;; Found an instance, open URL in new tab.
+     (let ((process-environment (browse-url-process-environment)))
+       (start-process (concat "elinks:" url) nil
+                      "elinks" "-remote"
+                      (concat "openURL(\"" url "\",new-tab)"))))
+    (exit-status
+     (error "Unrecognized exit-code %d of process `elinks'"
+            exit-status))))
 
 (provide 'browse-url)
 
index feef78a305fe6f7ca423563b86f1f24e20c2aa51..d0200f4cb9dc9c99226c8c00dd9f6ed06b4ccd81 100644 (file)
 
 ;; Low-level language bindings are implemented in src/dbusbind.c.
 
+;; D-Bus support in the Emacs core can be disabled with configuration
+;; option "--without-dbus".
+
 ;;; Code:
 
-;; D-Bus support in the Emacs core can be disabled with configuration
-;; option "--without-dbus".  Declare used subroutines and variables.
-(declare-function dbus-call-method "dbusbind.c")
-(declare-function dbus-call-method-asynchronously "dbusbind.c")
+;; Declare used subroutines and variables.
+(declare-function dbus-message-internal "dbusbind.c")
 (declare-function dbus-init-bus "dbusbind.c")
-(declare-function dbus-method-return-internal "dbusbind.c")
-(declare-function dbus-method-error-internal "dbusbind.c")
-(declare-function dbus-register-signal "dbusbind.c")
-(declare-function dbus-register-method "dbusbind.c")
-(declare-function dbus-send-signal "dbusbind.c")
+(defvar dbus-message-type-invalid)
+(defvar dbus-message-type-method-call)
+(defvar dbus-message-type-method-return)
+(defvar dbus-message-type-error)
+(defvar dbus-message-type-signal)
 (defvar dbus-debug)
 (defvar dbus-registered-objects-table)
 
 ;; Pacify byte compiler.
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'xml)
 
 (defconst dbus-path-dbus "/org/freedesktop/DBus"
   "The object path used to talk to the bus itself.")
 
+;; Default D-Bus interfaces.
+
 (defconst dbus-interface-dbus "org.freedesktop.DBus"
-  "The interface exported by the object with `dbus-service-dbus' and `dbus-path-dbus'.")
+  "The interface exported by the service `dbus-service-dbus'.")
 
 (defconst dbus-interface-peer (concat dbus-interface-dbus ".Peer")
-  "The interface for peer objects.")
+  "The interface for peer objects.
+See URL `http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-peer'.")
+
+;; <interface name="org.freedesktop.DBus.Peer">
+;;   <method name="Ping">
+;;   </method>
+;;   <method name="GetMachineId">
+;;     <arg name="machine_uuid" type="s" direction="out"/>
+;;   </method>
+;; </interface>
 
 (defconst dbus-interface-introspectable
   (concat dbus-interface-dbus ".Introspectable")
-  "The interface supported by introspectable objects.")
+  "The interface supported by introspectable objects.
+See URL `http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-introspectable'.")
 
-(defconst dbus-interface-properties (concat dbus-interface-dbus ".Properties")
-  "The interface for property objects.")
+;; <interface name="org.freedesktop.DBus.Introspectable">
+;;   <method name="Introspect">
+;;     <arg name="data" type="s" direction="out"/>
+;;   </method>
+;; </interface>
 
+(defconst dbus-interface-properties (concat dbus-interface-dbus ".Properties")
+  "The interface for property objects.
+See URL `http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties'.")
+
+;; <interface name="org.freedesktop.DBus.Properties">
+;;   <method name="Get">
+;;     <arg name="interface" type="s" direction="in"/>
+;;     <arg name="propname"  type="s" direction="in"/>
+;;     <arg name="value"     type="v" direction="out"/>
+;;   </method>
+;;   <method name="Set">
+;;     <arg name="interface" type="s" direction="in"/>
+;;     <arg name="propname"  type="s" direction="in"/>
+;;     <arg name="value"     type="v" direction="in"/>
+;;   </method>
+;;   <method name="GetAll">
+;;     <arg name="interface" type="s" direction="in"/>
+;;     <arg name="props"     type="a{sv}" direction="out"/>
+;;   </method>
+;;   <signal name="PropertiesChanged">
+;;     <arg name="interface" type="s"/>
+;;     <arg name="changed_properties"     type="a{sv}"/>
+;;     <arg name="invalidated_properties" type="as"/>
+;;   </signal>
+;; </interface>
+
+(defconst dbus-interface-objectmanager
+  (concat dbus-interface-dbus ".ObjectManager")
+  "The object manager interface.
+See URL `http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager'.")
+
+;; <interface name="org.freedesktop.DBus.ObjectManager">
+;;   <method name="GetManagedObjects">
+;;     <arg name="object_paths_interfaces_and_properties"
+;;          type="a{oa{sa{sv}}}" direction="out"/>
+;;   </method>
+;;   <signal name="InterfacesAdded">
+;;     <arg name="object_path"               type="o"/>
+;;     <arg name="interfaces_and_properties" type="a{sa{sv}}"/>
+;;   </signal>
+;;   <signal name="InterfacesRemoved">
+;;     <arg name="object_path"               type="o"/>
+;;     <arg name="interfaces"                type="as"/>
+;;   </signal>
+;; </interface>
+
+;; Emacs defaults.
 (defconst dbus-service-emacs "org.gnu.Emacs"
   "The well known service name of Emacs.")
 
 (defconst dbus-path-emacs "/org/gnu/Emacs"
-  "The object path head used by Emacs.")
+  "The object path namespace used by Emacs.
+All object paths provided by the service `dbus-service-emacs'
+shall be subdirectories of this path.")
 
-(defconst dbus-message-type-invalid 0
-  "This value is never a valid message type.")
+(defconst dbus-interface-emacs "org.gnu.Emacs"
+  "The interface namespace used by Emacs.")
 
-(defconst dbus-message-type-method-call 1
-  "Message type of a method call message.")
-
-(defconst dbus-message-type-method-return 2
-  "Message type of a method return message.")
-
-(defconst dbus-message-type-error 3
-  "Message type of an error reply message.")
-
-(defconst dbus-message-type-signal 4
-  "Message type of a signal message.")
+;; D-Bus constants.
 
 (defmacro dbus-ignore-errors (&rest body)
   "Execute BODY; signal D-Bus error when `dbus-debug' is non-nil.
@@ -104,15 +158,271 @@ Every function must accept two arguments, the event and the error variable
 caught in `condition-case' by `dbus-error'.")
 
 \f
-;;; Hash table of registered functions.
+;;; Basic D-Bus message functions.
 
 (defvar dbus-return-values-table (make-hash-table :test 'equal)
   "Hash table for temporary storing arguments of reply messages.
-A key in this hash table is a list (BUS SERIAL).  BUS is either a
-Lisp symbol, `:system' or `:session', or a string denoting the
-bus address.  SERIAL is the serial number of the reply message.
-See `dbus-call-method-non-blocking-handler' and
-`dbus-call-method-non-blocking'.")
+A key in this hash table is a list (:serial BUS SERIAL), like in
+`dbus-registered-objects-table'.  BUS is either a Lisp symbol,
+`:system' or `:session', or a string denoting the bus address.
+SERIAL is the serial number of the reply message.")
+
+(defun dbus-call-method-handler (&rest args)
+  "Handler for reply messages of asynchronous D-Bus message calls.
+It calls the function stored in `dbus-registered-objects-table'.
+The result will be made available in `dbus-return-values-table'."
+  (puthash (list  :serial
+                 (dbus-event-bus-name last-input-event)
+                (dbus-event-serial-number last-input-event))
+          (if (= (length args) 1) (car args) args)
+          dbus-return-values-table))
+
+(defun dbus-call-method (bus service path interface method &rest args)
+  "Call METHOD on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name to be used.  PATH is the D-Bus
+object path SERVICE is registered at.  INTERFACE is an interface
+offered by SERVICE.  It must provide METHOD.
+
+If the parameter `:timeout' is given, the following integer TIMEOUT
+specifies the maximum number of milliseconds the method call must
+return.  The default value is 25,000.  If the method call doesn't
+return in time, a D-Bus error is raised.
+
+All other arguments ARGS are passed to METHOD as arguments.  They are
+converted into D-Bus types via the following rules:
+
+  t and nil => DBUS_TYPE_BOOLEAN
+  number    => DBUS_TYPE_UINT32
+  integer   => DBUS_TYPE_INT32
+  float     => DBUS_TYPE_DOUBLE
+  string    => DBUS_TYPE_STRING
+  list      => DBUS_TYPE_ARRAY
+
+All arguments can be preceded by a type symbol.  For details about
+type symbols, see Info node `(dbus)Type Conversion'.
+
+`dbus-call-method' returns the resulting values of METHOD as a list of
+Lisp objects.  The type conversion happens the other direction as for
+input arguments.  It follows the mapping rules:
+
+  DBUS_TYPE_BOOLEAN     => t or nil
+  DBUS_TYPE_BYTE        => number
+  DBUS_TYPE_UINT16      => number
+  DBUS_TYPE_INT16       => integer
+  DBUS_TYPE_UINT32      => number or float
+  DBUS_TYPE_UNIX_FD     => number or float
+  DBUS_TYPE_INT32       => integer or float
+  DBUS_TYPE_UINT64      => number or float
+  DBUS_TYPE_INT64       => integer or float
+  DBUS_TYPE_DOUBLE      => float
+  DBUS_TYPE_STRING      => string
+  DBUS_TYPE_OBJECT_PATH => string
+  DBUS_TYPE_SIGNATURE   => string
+  DBUS_TYPE_ARRAY       => list
+  DBUS_TYPE_VARIANT     => list
+  DBUS_TYPE_STRUCT      => list
+  DBUS_TYPE_DICT_ENTRY  => list
+
+Example:
+
+\(dbus-call-method
+  :session \"org.gnome.seahorse\" \"/org/gnome/seahorse/keys/openpgp\"
+  \"org.gnome.seahorse.Keys\" \"GetKeyField\"
+  \"openpgp:657984B8C7A966DD\" \"simple-name\")
+
+  => (t (\"Philip R. Zimmermann\"))
+
+If the result of the METHOD call is just one value, the converted Lisp
+object is returned instead of a list containing this single Lisp object.
+
+\(dbus-call-method
+  :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/devices/computer\"
+  \"org.freedesktop.Hal.Device\" \"GetPropertyString\"
+  \"system.kernel.machine\")
+
+  => \"i686\""
+
+  (or (memq bus '(:system :session)) (stringp bus)
+      (signal 'wrong-type-argument (list 'keywordp bus)))
+  (or (stringp service)
+      (signal 'wrong-type-argument (list 'stringp service)))
+  (or (stringp path)
+      (signal 'wrong-type-argument (list 'stringp path)))
+  (or (stringp interface)
+      (signal 'wrong-type-argument (list 'stringp interface)))
+  (or (stringp method)
+      (signal 'wrong-type-argument (list 'stringp method)))
+
+  (let ((timeout (plist-get args :timeout))
+       (key
+        (apply
+         'dbus-message-internal dbus-message-type-method-call
+         bus service path interface method 'dbus-call-method-handler args)))
+
+    ;; Wait until `dbus-call-method-handler' has put the result into
+    ;; `dbus-return-values-table'.  If no timeout is given, use the
+    ;; default 25".  Events which are not from D-Bus must be restored.
+    (with-timeout ((if timeout (/ timeout 1000.0) 25))
+      (while (eq (gethash key dbus-return-values-table :ignore) :ignore)
+       (let ((event (let (unread-command-events) (read-event nil nil 0.1))))
+         (when (and event (not (ignore-errors (dbus-check-event event))))
+           (setq unread-command-events
+                 (append unread-command-events (list event)))))))
+
+    ;; Cleanup `dbus-return-values-table'.  Return the result.
+    (prog1
+       (gethash key dbus-return-values-table)
+      (remhash key dbus-return-values-table))))
+
+;; `dbus-call-method' works non-blocking now.
+(defalias 'dbus-call-method-non-blocking 'dbus-call-method)
+(make-obsolete 'dbus-call-method-non-blocking 'dbus-call-method "24.2")
+
+(defun dbus-call-method-asynchronously
+ (bus service path interface method handler &rest args)
+ "Call METHOD on the D-Bus BUS asynchronously.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name to be used.  PATH is the D-Bus
+object path SERVICE is registered at.  INTERFACE is an interface
+offered by SERVICE.  It must provide METHOD.
+
+HANDLER is a Lisp function, which is called when the corresponding
+return message has arrived.  If HANDLER is nil, no return message
+will be expected.
+
+If the parameter `:timeout' is given, the following integer TIMEOUT
+specifies the maximum number of milliseconds the method call must
+return.  The default value is 25,000.  If the method call doesn't
+return in time, a D-Bus error is raised.
+
+All other arguments ARGS are passed to METHOD as arguments.  They are
+converted into D-Bus types via the following rules:
+
+  t and nil => DBUS_TYPE_BOOLEAN
+  number    => DBUS_TYPE_UINT32
+  integer   => DBUS_TYPE_INT32
+  float     => DBUS_TYPE_DOUBLE
+  string    => DBUS_TYPE_STRING
+  list      => DBUS_TYPE_ARRAY
+
+All arguments can be preceded by a type symbol.  For details about
+type symbols, see Info node `(dbus)Type Conversion'.
+
+If HANDLER is a Lisp function, the function returns a key into the
+hash table `dbus-registered-objects-table'.  The corresponding entry
+in the hash table is removed, when the return message has been arrived,
+and HANDLER is called.
+
+Example:
+
+\(dbus-call-method-asynchronously
+  :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/devices/computer\"
+  \"org.freedesktop.Hal.Device\" \"GetPropertyString\" 'message
+  \"system.kernel.machine\")
+
+  => \(:serial :system 2)
+
+  -| i686"
+
+  (or (memq bus '(:system :session)) (stringp bus)
+      (signal 'wrong-type-argument (list 'keywordp bus)))
+  (or (stringp service)
+      (signal 'wrong-type-argument (list 'stringp service)))
+  (or (stringp path)
+      (signal 'wrong-type-argument (list 'stringp path)))
+  (or (stringp interface)
+      (signal 'wrong-type-argument (list 'stringp interface)))
+  (or (stringp method)
+      (signal 'wrong-type-argument (list 'stringp method)))
+  (or (null handler) (functionp handler)
+      (signal 'wrong-type-argument (list 'functionp handler)))
+
+  (apply 'dbus-message-internal dbus-message-type-method-call
+        bus service path interface method handler args))
+
+(defun dbus-send-signal (bus service path interface signal &rest args)
+  "Send signal SIGNAL on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.  The signal is sent from the D-Bus object
+Emacs is registered at BUS.
+
+SERVICE is the D-Bus name SIGNAL is sent to.  It can be either a known
+name or a unique name.  If SERVICE is nil, the signal is sent as
+broadcast message.  PATH is the D-Bus object path SIGNAL is sent from.
+INTERFACE is an interface available at PATH.  It must provide signal
+SIGNAL.
+
+All other arguments ARGS are passed to SIGNAL as arguments.  They are
+converted into D-Bus types via the following rules:
+
+  t and nil => DBUS_TYPE_BOOLEAN
+  number    => DBUS_TYPE_UINT32
+  integer   => DBUS_TYPE_INT32
+  float     => DBUS_TYPE_DOUBLE
+  string    => DBUS_TYPE_STRING
+  list      => DBUS_TYPE_ARRAY
+
+All arguments can be preceded by a type symbol.  For details about
+type symbols, see Info node `(dbus)Type Conversion'.
+
+Example:
+
+\(dbus-send-signal
+  :session nil \"/org/gnu/Emacs\" \"org.gnu.Emacs.FileManager\"
+  \"FileModified\" \"/home/albinus/.emacs\")"
+
+  (or (memq bus '(:system :session)) (stringp bus)
+      (signal 'wrong-type-argument (list 'keywordp bus)))
+  (or (null service) (stringp service)
+      (signal 'wrong-type-argument (list 'stringp service)))
+  (or (stringp path)
+      (signal 'wrong-type-argument (list 'stringp path)))
+  (or (stringp interface)
+      (signal 'wrong-type-argument (list 'stringp interface)))
+  (or (stringp signal)
+      (signal 'wrong-type-argument (list 'stringp signal)))
+
+  (apply 'dbus-message-internal dbus-message-type-signal
+        bus service path interface signal args))
+
+(defun dbus-method-return-internal (bus service serial &rest args)
+  "Return for message SERIAL on the D-Bus BUS.
+This is an internal function, it shall not be used outside dbus.el."
+
+  (or (memq bus '(:system :session)) (stringp bus)
+      (signal 'wrong-type-argument (list 'keywordp bus)))
+  (or (stringp service)
+      (signal 'wrong-type-argument (list 'stringp service)))
+  (or (natnump serial)
+      (signal 'wrong-type-argument (list 'natnump serial)))
+
+  (apply 'dbus-message-internal dbus-message-type-method-return
+        bus service serial args))
+
+(defun dbus-method-error-internal (bus service serial &rest args)
+  "Return error message for message SERIAL on the D-Bus BUS.
+This is an internal function, it shall not be used outside dbus.el."
+
+  (or (memq bus '(:system :session)) (stringp bus)
+      (signal 'wrong-type-argument (list 'keywordp bus)))
+  (or (stringp service)
+      (signal 'wrong-type-argument (list 'stringp service)))
+  (or (natnump serial)
+      (signal 'wrong-type-argument (list 'natnump serial)))
+
+  (apply 'dbus-message-internal dbus-message-type-error
+        bus service serial args))
+
+\f
+;;; Hash table of registered functions.
 
 (defun dbus-list-hash-table ()
   "Returns all registered member registrations to D-Bus.
@@ -125,6 +435,313 @@ hash table."
      dbus-registered-objects-table)
     result))
 
+(defun dbus-setenv (bus variable value)
+  "Set the value of the BUS environment variable named VARIABLE to VALUE.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.  Both VARIABLE and VALUE should be strings.
+
+Normally, services inherit the environment of the BUS daemon.  This
+function adds to or modifies that environment when activating services.
+
+Some bus instances, such as `:system', may disable setting the environment."
+  (dbus-call-method
+   bus dbus-service-dbus dbus-path-dbus
+   dbus-interface-dbus "UpdateActivationEnvironment"
+   `(:array (:dict-entry ,variable ,value))))
+
+(defun dbus-register-service (bus service &rest flags)
+  "Register known name SERVICE on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name that should be registered.  It must
+be a known name.
+
+FLAGS are keywords, which control how the service name is registered.
+The following keywords are recognized:
+
+`:allow-replacement': Allow another service to become the primary
+owner if requested.
+
+`:replace-existing': Request to replace the current primary owner.
+
+`:do-not-queue': If we can not become the primary owner do not place
+us in the queue.
+
+The function returns a keyword, indicating the result of the
+operation.  One of the following keywords is returned:
+
+`:primary-owner': Service has become the primary owner of the
+requested name.
+
+`:in-queue': Service could not become the primary owner and has been
+placed in the queue.
+
+`:exists': Service is already in the queue.
+
+`:already-owner': Service is already the primary owner."
+
+  ;; Add ObjectManager handler.
+  (dbus-register-method
+   bus service nil dbus-interface-objectmanager "GetManagedObjects"
+   'dbus-managed-objects-handler 'dont-register)
+
+  (let ((arg 0)
+       reply)
+    (dolist (flag flags)
+      (setq arg
+           (+ arg
+              (pcase flag
+                (:allow-replacement 1)
+                (:replace-existing 2)
+                (:do-not-queue 4)
+                (_ (signal 'wrong-type-argument (list flag)))))))
+    (setq reply (dbus-call-method
+                bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+                "RequestName" service arg))
+    (pcase reply
+      (1 :primary-owner)
+      (2 :in-queue)
+      (3 :exists)
+      (4 :already-owner)
+      (_ (signal 'dbus-error (list "Could not register service" service))))))
+
+(defun dbus-unregister-service (bus service)
+  "Unregister all objects related to SERVICE from D-Bus BUS.
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.  SERVICE must be a known service name.
+
+The function returns a keyword, indicating the result of the
+operation.  One of the following keywords is returned:
+
+`:released': Service has become the primary owner of the name.
+
+`:non-existent': Service name does not exist on this bus.
+
+`:not-owner': We are neither the primary owner nor waiting in the
+queue of this service."
+
+  (maphash
+   (lambda (key value)
+     (dolist (elt value)
+       (ignore-errors
+        (when (and (equal bus (cadr key)) (string-equal service (cadr elt)))
+          (unless
+              (puthash key (delete elt value) dbus-registered-objects-table)
+            (remhash key dbus-registered-objects-table))))))
+   dbus-registered-objects-table)
+  (let ((reply (dbus-call-method
+               bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+               "ReleaseName" service)))
+    (pcase reply
+      (1 :released)
+      (2 :non-existent)
+      (3 :not-owner)
+      (_ (signal 'dbus-error (list "Could not unregister service" service))))))
+
+(defun dbus-register-signal
+  (bus service path interface signal handler &rest args)
+  "Register for a signal on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name used by the sending D-Bus object.
+It can be either a known name or the unique name of the D-Bus object
+sending the signal.
+
+PATH is the D-Bus object path SERVICE is registered.  INTERFACE
+is an interface offered by SERVICE.  It must provide SIGNAL.
+HANDLER is a Lisp function to be called when the signal is
+received.  It must accept as arguments the values SIGNAL is
+sending.
+
+SERVICE, PATH, INTERFACE and SIGNAL can be nil.  This is
+interpreted as a wildcard for the respective argument.
+
+The remaining arguments ARGS can be keywords or keyword string pairs.
+The meaning is as follows:
+
+`:argN' STRING:
+`:pathN' STRING: This stands for the Nth argument of the
+signal.  `:pathN' arguments can be used for object path wildcard
+matches as specified by D-Bus, while an `:argN' argument
+requires an exact match.
+
+`:arg-namespace' STRING: Register for the signals, which first
+argument defines the service or interface namespace STRING.
+
+`:path-namespace' STRING: Register for the object path namespace
+STRING.  All signals sent from an object path, which has STRING as
+the preceding string, are matched.  This requires PATH to be nil.
+
+`:eavesdrop': Register for unicast signals which are not directed
+to the D-Bus object Emacs is registered at D-Bus BUS, if the
+security policy of BUS allows this.
+
+Example:
+
+\(defun my-signal-handler (device)
+  (message \"Device %s added\" device))
+
+\(dbus-register-signal
+  :system \"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\"
+  \"org.freedesktop.Hal.Manager\" \"DeviceAdded\" 'my-signal-handler)
+
+  => \(\(:signal :system \"org.freedesktop.Hal.Manager\" \"DeviceAdded\")
+      \(\"org.freedesktop.Hal\" \"/org/freedesktop/Hal/Manager\" my-signal-handler))
+
+`dbus-register-signal' returns an object, which can be used in
+`dbus-unregister-object' for removing the registration."
+
+  (let ((counter 0)
+       (rule "type='signal'")
+       uname key key1 value)
+
+    ;; Retrieve unique name of service.  If service is a known name,
+    ;; we will register for the corresponding unique name, if any.
+    ;; Signals are sent always with the unique name as sender.  Note:
+    ;; the unique name of `dbus-service-dbus' is that string itself.
+    (if (and (stringp service)
+            (not (zerop (length service)))
+            (not (string-equal service dbus-service-dbus))
+            (not (string-match "^:" service)))
+       (setq uname (dbus-get-name-owner bus service))
+      (setq uname service))
+
+    (setq rule (concat rule
+                      (when uname (format ",sender='%s'" uname))
+                      (when interface (format ",interface='%s'" interface))
+                      (when signal (format ",member='%s'" signal))
+                      (when path (format ",path='%s'" path))))
+
+    ;; Add arguments to the rule.
+    (if (or (stringp (car args)) (null (car args)))
+       ;; As backward compatibility option, we allow just strings.
+       (dolist (arg args)
+         (if (stringp arg)
+             (setq rule (concat rule (format ",arg%d='%s'" counter arg)))
+           (if arg (signal 'wrong-type-argument (list "Wrong argument" arg))))
+         (setq counter (1+ counter)))
+
+      ;; Parse keywords.
+      (while args
+       (setq
+        key (car args)
+        rule (concat
+              rule
+              (cond
+               ;; `:arg0' .. `:arg63', `:path0' .. `:path63'.
+               ((and (keywordp key)
+                     (string-match
+                      "^:\\(arg\\|path\\)\\([[:digit:]]+\\)$"
+                      (symbol-name key)))
+                (setq counter (match-string 2 (symbol-name key))
+                      args (cdr args)
+                      value (car args))
+                (unless (and (<= counter 63) (stringp value))
+                  (signal 'wrong-type-argument
+                          (list "Wrong argument" key value)))
+                (format
+                 ",arg%s%s='%s'"
+                 counter
+                 (if (string-equal (match-string 1 (symbol-name key)) "path")
+                     "path" "")
+                 value))
+               ;; `:arg-namespace', `:path-namespace'.
+               ((and (keywordp key)
+                     (string-match
+                      "^:\\(arg\\|path\\)-namespace$" (symbol-name key)))
+                (setq args (cdr args)
+                      value (car args))
+                (unless (stringp value)
+                  (signal 'wrong-type-argument
+                          (list "Wrong argument" key value)))
+                (format
+                 ",%s='%s'"
+                 (if (string-equal (match-string 1 (symbol-name key)) "path")
+                     "path_namespace" "arg0namespace")
+                 value))
+               ;; `:eavesdrop'.
+               ((eq key :eavesdrop)
+                ",eavesdrop='true'")
+               (t (signal 'wrong-type-argument (list "Wrong argument" key)))))
+        args (cdr args))))
+
+    ;; Add the rule to the bus.
+    (condition-case err
+       (dbus-call-method
+        bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+        "AddMatch" rule)
+      (dbus-error
+       (if (not (string-match "eavesdrop" rule))
+          (signal (car err) (cdr err))
+        ;; The D-Bus spec says we shall fall back to a rule without eavesdrop.
+        (when dbus-debug (message "Removing eavesdrop from rule %s" rule))
+        (setq rule (replace-regexp-in-string ",eavesdrop='true'" "" rule))
+        (dbus-call-method
+         bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+         "AddMatch" rule))))
+
+    (when dbus-debug (message "Matching rule \"%s\" created" rule))
+
+    ;; Create a hash table entry.
+    (setq key (list :signal bus interface signal)
+         key1 (list uname service path handler rule)
+         value (gethash key dbus-registered-objects-table))
+    (unless  (member key1 value)
+      (puthash key (cons key1 value) dbus-registered-objects-table))
+
+    ;; Return the object.
+    (list key (list service path handler))))
+
+(defun dbus-register-method
+  (bus service path interface method handler &optional dont-register-service)
+  "Register for method METHOD on the D-Bus BUS.
+
+BUS is either a Lisp symbol, `:system' or `:session', or a string
+denoting the bus address.
+
+SERVICE is the D-Bus service name of the D-Bus object METHOD is
+registered for.  It must be a known name (See discussion of
+DONT-REGISTER-SERVICE below).
+
+PATH is the D-Bus object path SERVICE is registered (See discussion of
+DONT-REGISTER-SERVICE below).  INTERFACE is the interface offered by
+SERVICE.  It must provide METHOD.
+
+HANDLER is a Lisp function to be called when a method call is
+received.  It must accept the input arguments of METHOD.  The return
+value of HANDLER is used for composing the returning D-Bus message.
+In case HANDLER shall return a reply message with an empty argument
+list, HANDLER must return the symbol `:ignore'.
+
+When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not
+registered.  This means that other D-Bus clients have no way of
+noticing the newly registered method.  When interfaces are constructed
+incrementally by adding single methods or properties at a time,
+DONT-REGISTER-SERVICE can be used to prevent other clients from
+discovering the still incomplete interface."
+
+  ;; Register SERVICE.
+  (unless (or dont-register-service
+             (member service (dbus-list-names bus)))
+    (dbus-register-service bus service))
+
+  ;; Create a hash table entry.  We use nil for the unique name,
+  ;; because the method might be called from anybody.
+  (let* ((key (list :method bus interface method))
+        (key1 (list nil service path handler))
+        (value (gethash key dbus-registered-objects-table)))
+
+    (unless  (member key1 value)
+      (puthash key (cons key1 value) dbus-registered-objects-table))
+
+    ;; Return the object.
+    (list key (list service path handler))))
+
 (defun dbus-unregister-object (object)
   "Unregister OBJECT from D-Bus.
 OBJECT must be the result of a preceding `dbus-register-method',
@@ -140,12 +757,13 @@ association to the service from D-Bus."
 
   ;; Find the corresponding entry in the hash table.
   (let* ((key (car object))
+        (type (car key))
+        (bus (cadr key))
         (value (cadr object))
-        (bus (car key))
         (service (car value))
         (entry (gethash key dbus-registered-objects-table))
         ret)
-    ;; key has the structure (BUS INTERFACE MEMBER).
+    ;; key has the structure (TYPE BUS INTERFACE MEMBER).
     ;; value has the structure (SERVICE PATH [HANDLER]).
     ;; entry has the structure ((UNAME SERVICE PATH MEMBER [RULE]) ...).
     ;; MEMBER is either a string (the handler), or a cons cell (a
@@ -163,155 +781,35 @@ association to the service from D-Bus."
        (unless (puthash key (delete elt entry) dbus-registered-objects-table)
          (remhash key dbus-registered-objects-table))
        ;; Remove match rule of signals.
-       (let ((rule (nth 4 elt)))
-         (when (stringp rule)
-           (setq service nil) ; We do not need to unregister the service.
-           (dbus-call-method
-            bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-            "RemoveMatch" rule)))))
+       (when (eq type :signal)
+         (dbus-call-method
+          bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
+          "RemoveMatch" (nth 4 elt)))))
+
     ;; Check, whether there is still a registered function or property
     ;; for the given service.  If not, unregister the service from the
     ;; bus.
-    (when service
-      (dolist (elt entry)
-       (let (found)
-         (maphash
-          (lambda (k v)
-            (dolist (e v)
-              (ignore-errors
-                (when (and (equal bus (car k)) (string-equal service (cadr e)))
-                  (setq found t)))))
-          dbus-registered-objects-table)
-         (unless found
-           (dbus-call-method
-            bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-            "ReleaseName" service)))))
+    (when (and service (memq type '(:method :property))
+              (not (catch :found
+                     (progn
+                       (maphash
+                        (lambda (k v)
+                          (dolist (e v)
+                            (ignore-errors
+                              (and
+                               ;; Bus.
+                               (equal bus (cadr k))
+                               ;; Service.
+                               (string-equal service (cadr e))
+                               ;; Non-empty object path.
+                               (cl-caddr e)
+                               (throw :found t)))))
+                        dbus-registered-objects-table)
+                       nil))))
+      (dbus-unregister-service bus service))
     ;; Return.
     ret))
 
-(defun dbus-unregister-service (bus service)
-  "Unregister all objects related to SERVICE from D-Bus BUS.
-BUS is either a Lisp symbol, `:system' or `:session', or a string
-denoting the bus address.  SERVICE must be a known service name.
-
-The function returns a keyword, indicating the result of the
-operation.  One of the following keywords is returned:
-
-`:released': Service has become the primary owner of the name.
-
-`:non-existent': Service name does not exist on this bus.
-
-`:not-owner': We are neither the primary owner nor waiting in the
-queue of this service."
-
-  (maphash
-   (lambda (key value)
-     (dolist (elt value)
-       (ignore-errors
-        (when (and (equal bus (car key)) (string-equal service (cadr elt)))
-          (unless
-              (puthash key (delete elt value) dbus-registered-objects-table)
-            (remhash key dbus-registered-objects-table))))))
-   dbus-registered-objects-table)
-  (let ((reply (dbus-call-method
-               bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-               "ReleaseName" service)))
-    (case reply
-      (1 :released)
-      (2 :non-existent)
-      (3 :not-owner)
-      (t (signal 'dbus-error (list "Could not unregister service" service))))))
-
-(defun dbus-call-method-non-blocking-handler (&rest args)
-  "Handler for reply messages of asynchronous D-Bus message calls.
-It calls the function stored in `dbus-registered-objects-table'.
-The result will be made available in `dbus-return-values-table'."
-  (puthash (list (dbus-event-bus-name last-input-event)
-                (dbus-event-serial-number last-input-event))
-          (if (= (length args) 1) (car args) args)
-          dbus-return-values-table))
-
-(defun dbus-call-method-non-blocking
-  (bus service path interface method &rest args)
-  "Call METHOD on the D-Bus BUS, but don't block the event queue.
-This is necessary for communicating to registered D-Bus methods,
-which are running in the same Emacs process.
-
-The arguments are the same as in `dbus-call-method'.
-
-usage: (dbus-call-method-non-blocking
-         BUS SERVICE PATH INTERFACE METHOD
-         &optional :timeout TIMEOUT &rest ARGS)"
-
-  (let ((key
-        (apply
-         'dbus-call-method-asynchronously
-         bus service path interface method
-         'dbus-call-method-non-blocking-handler args)))
-    ;; Wait until `dbus-call-method-non-blocking-handler' has put the
-    ;; result into `dbus-return-values-table'.
-    (while (eq (gethash key dbus-return-values-table :ignore) :ignore)
-      (read-event nil nil 0.1))
-
-    ;; Cleanup `dbus-return-values-table'.  Return the result.
-    (prog1
-       (gethash key dbus-return-values-table nil)
-      (remhash key dbus-return-values-table))))
-
-(defun dbus-name-owner-changed-handler (&rest args)
-  "Reapplies all member registrations to D-Bus.
-This handler is applied when a \"NameOwnerChanged\" signal has
-arrived.  SERVICE is the object name for which the name owner has
-been changed.  OLD-OWNER is the previous owner of SERVICE, or the
-empty string if SERVICE was not owned yet.  NEW-OWNER is the new
-owner of SERVICE, or the empty string if SERVICE loses any name owner.
-
-usage: (dbus-name-owner-changed-handler service old-owner new-owner)"
-  (save-match-data
-    ;; Check the arguments.  We should silently ignore it when they
-    ;; are wrong.
-    (if (and (= (length args) 3)
-            (stringp (car args))
-            (stringp (cadr args))
-            (stringp (caddr args)))
-       (let ((service (car args))
-             (old-owner (cadr args))
-             (new-owner (caddr args)))
-         ;; Check whether SERVICE is a known name.
-         (when (not (string-match "^:" service))
-           (maphash
-            (lambda (key value)
-               (dolist (elt value)
-                 ;; key has the structure (BUS INTERFACE MEMBER).
-                 ;; elt has the structure (UNAME SERVICE PATH HANDLER).
-                 (when (string-equal old-owner (car elt))
-                   ;; Remove old key, and add new entry with changed name.
-                   (dbus-unregister-object (list key (cdr elt)))
-                   ;; Maybe we could arrange the lists a little bit better
-                   ;; that we don't need to extract every single element?
-                   (dbus-register-signal
-                    ;; BUS      SERVICE     PATH
-                    (nth 0 key) (nth 1 elt) (nth 2 elt)
-                    ;; INTERFACE MEMBER     HANDLER
-                    (nth 1 key) (nth 2 key) (nth 3 elt)))))
-            (copy-hash-table dbus-registered-objects-table))))
-      ;; The error is reported only in debug mode.
-      (when  dbus-debug
-       (signal
-        'dbus-error
-        (cons
-         (format "Wrong arguments of %s.NameOwnerChanged" dbus-interface-dbus)
-         args))))))
-
-;; Register the handler.
-(when nil ;ignore-errors
-  (dbus-register-signal
-   :system dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-   "NameOwnerChanged" 'dbus-name-owner-changed-handler)
-  (dbus-register-signal
-   :session dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-   "NameOwnerChanged" 'dbus-name-owner-changed-handler))
-
 \f
 ;;; D-Bus type conversion.
 
@@ -437,9 +935,9 @@ If the HANDLER returns a `dbus-error', it is propagated as return message."
          (dbus-ignore-errors
            (if (eq result :ignore)
                (dbus-method-return-internal
-                (nth 1 event) (nth 3 event) (nth 4 event))
+                (nth 1 event) (nth 4 event) (nth 3 event))
              (apply 'dbus-method-return-internal
-                    (nth 1 event) (nth 3 event) (nth 4 event)
+                    (nth 1 event) (nth 4 event) (nth 3 event)
                     (if (consp result) result (list result)))))))
     ;; Error handling.
     (dbus-error
@@ -447,7 +945,7 @@ If the HANDLER returns a `dbus-error', it is propagated as return message."
      (when (= dbus-message-type-method-call (nth 2 event))
        (dbus-ignore-errors
         (dbus-method-error-internal
-         (nth 1 event) (nth 3 event) (nth 4 event) (cadr err))))
+         (nth 1 event) (nth 4 event) (nth 3 event) (cadr err))))
      ;; Propagate D-Bus error messages.
      (run-hook-with-args 'dbus-event-error-hooks event err)
      (when (or dbus-debug (= dbus-message-type-error (nth 2 event)))
@@ -594,13 +1092,11 @@ denoting the bus address.  SERVICE must be a known service name,
 and PATH must be a valid object path.  The last two parameters
 are strings.  The result, the introspection data, is a string in
 XML format."
-  ;; We don't want to raise errors.  `dbus-call-method-non-blocking'
-  ;; is used, because the handler can be registered in our Emacs
-  ;; instance; caller an callee would block each other.
+  ;; We don't want to raise errors.
   (dbus-ignore-errors
-    (funcall
-     (if noninteractive 'dbus-call-method 'dbus-call-method-non-blocking)
-     bus service path dbus-interface-introspectable "Introspect")))
+    (dbus-call-method
+     bus service path dbus-interface-introspectable "Introspect"
+     :timeout 1000)))
 
 (defun dbus-introspect-xml (bus service path)
   "Return the introspection data of SERVICE in D-Bus BUS at object path PATH.
@@ -854,12 +1350,11 @@ be \"out\"."
 It will be checked at BUS, SERVICE, PATH.  The result can be any
 valid D-Bus value, or `nil' if there is no PROPERTY."
   (dbus-ignore-errors
-    ;; "Get" returns a variant, so we must use the `car'.
-    (car
-     (funcall
-      (if noninteractive 'dbus-call-method 'dbus-call-method-non-blocking)
-      bus service path dbus-interface-properties
-      "Get" :timeout 500 interface property))))
+   ;; "Get" returns a variant, so we must use the `car'.
+   (car
+    (dbus-call-method
+     bus service path dbus-interface-properties
+     "Get" :timeout 500 interface property))))
 
 (defun dbus-set-property (bus service path interface property value)
   "Set value of PROPERTY of INTERFACE to VALUE.
@@ -867,13 +1362,12 @@ It will be checked at BUS, SERVICE, PATH.  When the value has
 been set successful, the result is VALUE.  Otherwise, `nil' is
 returned."
   (dbus-ignore-errors
-    ;; "Set" requires a variant.
-    (funcall
-     (if noninteractive 'dbus-call-method 'dbus-call-method-non-blocking)
-     bus service path dbus-interface-properties
-     "Set" :timeout 500 interface property (list :variant value))
-    ;; Return VALUE.
-    (dbus-get-property bus service path interface property)))
+   ;; "Set" requires a variant.
+   (dbus-call-method
+    bus service path dbus-interface-properties
+    "Set" :timeout 500 interface property (list :variant value))
+   ;; Return VALUE.
+   (dbus-get-property bus service path interface property)))
 
 (defun dbus-get-all-properties (bus service path interface)
   "Return all properties of INTERFACE at BUS, SERVICE, PATH.
@@ -884,14 +1378,11 @@ name of the property, and its value.  If there are no properties,
     ;; "GetAll" returns "a{sv}".
     (let (result)
       (dolist (dict
-              (funcall
-               (if noninteractive
-                   'dbus-call-method
-                 'dbus-call-method-non-blocking)
+              (dbus-call-method
                bus service path dbus-interface-properties
                "GetAll" :timeout 500 interface)
               result)
-       (add-to-list 'result (cons (car dict) (caadr dict)) 'append)))))
+       (add-to-list 'result (cons (car dict) (cl-caadr dict)) 'append)))))
 
 (defun dbus-register-property
   (bus service path interface property access value
@@ -931,14 +1422,7 @@ constructed incrementally by adding single methods or properties
 at a time, DONT-REGISTER-SERVICE can be used to prevent other
 clients from discovering the still incomplete interface."
   (unless (member access '(:read :readwrite))
-    (signal 'dbus-error (list "Access type invalid" access)))
-
-  ;; Register SERVICE.
-  (unless (or dont-register-service
-             (member service (dbus-list-names bus)))
-    (dbus-call-method
-     bus dbus-service-dbus dbus-path-dbus dbus-interface-dbus
-     "RequestName" service 0))
+    (signal 'wrong-type-argument (list "Access type invalid" access)))
 
   ;; Add handlers for the three property-related methods.
   (dbus-register-method
@@ -951,20 +1435,20 @@ clients from discovering the still incomplete interface."
    bus service path dbus-interface-properties "Set"
    'dbus-property-handler 'dont-register)
 
-  ;; Register the name SERVICE with BUS.
-  (unless dont-register-service
+  ;; Register SERVICE.
+  (unless (or dont-register-service (member service (dbus-list-names bus)))
     (dbus-register-service bus service))
 
   ;; Send the PropertiesChanged signal.
   (when emits-signal
     (dbus-send-signal
      bus service path dbus-interface-properties "PropertiesChanged"
-     (list (list :dict-entry property (list :variant value)))
+     `((:dict-entry ,property (:variant ,value)))
      '(:array)))
 
   ;; Create a hash table entry.  We use nil for the unique name,
   ;; because the property might be accessed from anybody.
-  (let ((key (list bus interface property))
+  (let ((key (list :property bus interface property))
        (val
         (list
          (list
@@ -979,7 +1463,7 @@ clients from discovering the still incomplete interface."
 
 (defun dbus-property-handler (&rest args)
   "Default handler for the \"org.freedesktop.DBus.Properties\" interface.
-It will be registered for all objects created by `dbus-register-object'."
+It will be registered for all objects created by `dbus-register-property'."
   (let ((bus (dbus-event-bus-name last-input-event))
        (service (dbus-event-service-name last-input-event))
        (path (dbus-event-path-name last-input-event))
@@ -989,15 +1473,15 @@ It will be registered for all objects created by `dbus-register-object'."
     (cond
      ;; "Get" returns a variant.
      ((string-equal method "Get")
-      (let ((entry (gethash (list bus interface property)
+      (let ((entry (gethash (list :property bus interface property)
                            dbus-registered-objects-table)))
        (when (string-equal path (nth 2 (car entry)))
-         (list (list :variant (cdar (last (car entry))))))))
+         `((:variant ,(cdar (last (car entry))))))))
 
      ;; "Set" expects a variant.
      ((string-equal method "Set")
       (let* ((value (caar (cddr args)))
-            (entry (gethash (list bus interface property)
+            (entry (gethash (list :property bus interface property)
                             dbus-registered-objects-table))
             ;; The value of the hash table is a list; in case of
             ;; properties it contains just one element (UNAME SERVICE
@@ -1012,7 +1496,7 @@ It will be registered for all objects created by `dbus-register-object'."
        (unless (member :readwrite (car object))
          (signal 'dbus-error
                  (list "Property not writable at path" property path)))
-       (puthash (list bus interface property)
+       (puthash (list :property bus interface property)
                 (list (append (butlast (car entry))
                               (list (cons (car object) value))))
                 dbus-registered-objects-table)
@@ -1020,7 +1504,7 @@ It will be registered for all objects created by `dbus-register-object'."
        (when (member :emits-signal (car object))
          (dbus-send-signal
           bus service path dbus-interface-properties "PropertiesChanged"
-          (list (list :dict-entry property (list :variant value)))
+          `((:dict-entry ,property (:variant ,value)))
           '(:array)))
        ;; Return empty reply.
        :ignore))
@@ -1030,7 +1514,7 @@ It will be registered for all objects created by `dbus-register-object'."
       (let (result)
        (maphash
         (lambda (key val)
-          (when (and (equal (butlast key) (list bus interface))
+          (when (and (equal (butlast key) (list :property bus interface))
                      (string-equal path (nth 2 (car val)))
                      (not (functionp (car (last (car val))))))
             (add-to-list
@@ -1042,15 +1526,151 @@ It will be registered for all objects created by `dbus-register-object'."
        ;; Return the result, or an empty array.
        (list :array (or result '(:signature "{sv}"))))))))
 
+\f
+;;; D-Bus object manager.
+
+(defun dbus-get-all-managed-objects (bus service path)
+  "Return all objects at BUS, SERVICE, PATH, and the children of PATH.
+The result is a list of objects.  Every object is a cons of an
+existing path name, and the list of available interface objects.
+An interface object is another cons, which car is the interface
+name, and the cdr is the list of properties as returned by
+`dbus-get-all-properties' for that path and interface.  Example:
+
+\(dbus-get-all-managed-objects :session \"org.gnome.SettingsDaemon\" \"/\")
+
+  => \(\(\"/org/gnome/SettingsDaemon/MediaKeys\"
+       \(\"org.gnome.SettingsDaemon.MediaKeys\")
+       \(\"org.freedesktop.DBus.Peer\")
+       \(\"org.freedesktop.DBus.Introspectable\")
+       \(\"org.freedesktop.DBus.Properties\")
+       \(\"org.freedesktop.DBus.ObjectManager\"))
+      \(\"/org/gnome/SettingsDaemon/Power\"
+       \(\"org.gnome.SettingsDaemon.Power.Keyboard\")
+       \(\"org.gnome.SettingsDaemon.Power.Screen\")
+       \(\"org.gnome.SettingsDaemon.Power\"
+        \(\"Icon\" . \". GThemedIcon battery-full-charged-symbolic \")
+        \(\"Tooltip\" . \"Laptop battery is charged\"))
+       \(\"org.freedesktop.DBus.Peer\")
+       \(\"org.freedesktop.DBus.Introspectable\")
+       \(\"org.freedesktop.DBus.Properties\")
+       \(\"org.freedesktop.DBus.ObjectManager\"))
+      ...)
+
+If possible, \"org.freedesktop.DBus.ObjectManager.GetManagedObjects\"
+is used for retrieving the information.  Otherwise, the information
+is collected via \"org.freedesktop.DBus.Introspectable.Introspect\"
+and \"org.freedesktop.DBus.Properties.GetAll\", which is slow."
+    (let ((result
+          ;; Direct call.  Fails, if the target does not support the
+          ;; object manager interface.
+          (dbus-ignore-errors
+           (dbus-call-method
+            bus service path dbus-interface-objectmanager
+            "GetManagedObjects" :timeout 1000))))
+
+      (if result
+         ;; Massage the returned structure.
+         (dolist (entry result result)
+           ;; "a{oa{sa{sv}}}".
+           (dolist (entry1 (cdr entry))
+             ;; "a{sa{sv}}".
+             (dolist (entry2 entry1)
+               ;; "a{sv}".
+               (if (cadr entry2)
+                   ;; "sv".
+                   (dolist (entry3 (cadr entry2))
+                     (setcdr entry3 (cl-caadr entry3)))
+                 (setcdr entry2 nil)))))
+
+       ;; Fallback: collect the information.  Slooow!
+       (dolist (object
+                (dbus-introspect-get-all-nodes bus service path)
+                result)
+         (let (result1)
+           (dolist
+               (interface
+                (dbus-introspect-get-interface-names bus service object)
+                result1)
+             (add-to-list
+              'result1
+              (cons interface
+                    (dbus-get-all-properties bus service object interface))))
+           (when result1
+             (add-to-list 'result (cons object result1))))))))
+
+(defun dbus-managed-objects-handler ()
+  "Default handler for the \"org.freedesktop.DBus.ObjectManager\" interface.
+It will be registered for all objects created by `dbus-register-method'."
+  (let* ((last-input-event last-input-event)
+        (bus (dbus-event-bus-name last-input-event))
+        (service (dbus-event-service-name last-input-event))
+        (path (dbus-event-path-name last-input-event)))
+    ;; "GetManagedObjects" returns "a{oa{sa{sv}}}".
+    (let (interfaces result)
+
+      ;; Check for object path wildcard interfaces.
+      (maphash
+       (lambda (key val)
+        (when (and (equal (butlast key 2) (list :method bus))
+                   (null (nth 2 (car-safe val))))
+          (add-to-list 'interfaces (nth 2 key))))
+       dbus-registered-objects-table)
+
+      ;; Check all registered object paths.
+      (maphash
+       (lambda (key val)
+        (let ((object (or (nth 2 (car-safe val)) ""))
+              (interface (nth 2 key)))
+          (when (and (equal (butlast key 2) (list :method bus))
+                     (string-prefix-p path object))
+            (dolist (interface (cons (nth 2 key) interfaces))
+              (unless (assoc object result)
+                (add-to-list 'result (list object)))
+              (unless (assoc interface (cdr (assoc object result)))
+                (setcdr
+                 (assoc object result)
+                 (append
+                  (list (cons
+                   interface
+                   ;; We simulate "org.freedesktop.DBus.Properties.GetAll"
+                   ;; by using an appropriate D-Bus event.
+                   (let ((last-input-event
+                          (append
+                           (butlast last-input-event 4)
+                           (list object dbus-interface-properties
+                                 "GetAll" 'dbus-property-handler))))
+                     (dbus-property-handler interface))))
+                  (cdr (assoc object result)))))))))
+       dbus-registered-objects-table)
+
+      ;; Return the result, or an empty array.
+      (list
+       :array
+       (or
+       (mapcar
+        (lambda (x)
+          (list
+           :dict-entry :object-path (car x)
+           (cons :array (mapcar (lambda (y) (cons :dict-entry y)) (cdr x)))))
+        result)
+       '(:signature "{oa{sa{sv}}}"))))))
+
  \f
-;; Initialize :system and :session buses.  This adds their file
+;; Initialize `:system' and `:session' buses.  This adds their file
 ;; descriptors to input_wait_mask, in order to detect incoming
 ;; messages immediately.
 (when (featurep 'dbusbind)
   (dbus-ignore-errors
-    (dbus-init-bus :system)
+    (dbus-init-bus :system))
+  (dbus-ignore-errors
     (dbus-init-bus :session)))
 
 (provide 'dbus)
 
+;;; TODO:
+
+;; * Implement org.freedesktop.DBus.ObjectManager.InterfacesAdded and
+;;   org.freedesktop.DBus.ObjectManager.InterfacesRemoved.
+
 ;;; dbus.el ends here
index 3f24a78cbbe403b4b3be655e419ed8ea6d8d1256..0e9707e57f39dfdc893c18b2dfb1c9da7ee06450 100644 (file)
@@ -48,9 +48,7 @@
 
 (eval-and-compile
   (if (not (fboundp 'make-overlay))
-      (require 'overlay))
-  (if (not (fboundp 'unless))
-      (require 'cl)))
+      (require 'overlay)))
 
 (unless (fboundp 'custom-menu-create)
   (autoload 'custom-menu-create "cus-edit"))
@@ -1213,7 +1211,7 @@ queries the server for the existing fields and displays a corresponding form."
 ;;; Load the options file
 (if (and (not noninteractive)
         (and (locate-library eudc-options-file)
-             (progn (message "") t))   ; Remove modeline message
+             (progn (message "") t))   ; Remove mode line message
         (not (featurep 'eudc-options-file)))
     (load eudc-options-file))
 
index a306384c7752b129ca7340f4e332add8c395a9dd..d33480afb2891d83826f3cab323c176eaa96377d 100644 (file)
@@ -35,7 +35,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup gnutls nil
   "Emacs interface to the GnuTLS library."
@@ -120,7 +120,7 @@ trust and key files, and priority string."
 (declare-function gnutls-boot "gnutls.c" (proc type proplist))
 (declare-function gnutls-errorp "gnutls.c" (error))
 
-(defun* gnutls-negotiate
+(cl-defun gnutls-negotiate
     (&rest spec
            &key process type hostname priority-string
            trustfiles crlfiles keylist min-prime-bits
index e5fe45b5bf0238e37c77361d7755bd4511a5a30a..6a9d80f96727b59a0339371ae4aaf556903d5022 100644 (file)
 
 ;; I don't expect users to want fontify'ing without highlighting.
 (defcustom goto-address-fontify-p t
-  "*Non-nil means URLs and e-mail addresses in buffer are fontified.
+  "Non-nil means URLs and e-mail addresses in buffer are fontified.
 But only if `goto-address-highlight-p' is also non-nil."
   :type 'boolean
   :group 'goto-address)
 
 (defcustom goto-address-highlight-p t
-  "*Non-nil means URLs and e-mail addresses in buffer are highlighted."
+  "Non-nil means URLs and e-mail addresses in buffer are highlighted."
   :type 'boolean
   :group 'goto-address)
 
 (defcustom goto-address-fontify-maximum-size 30000
-  "*Maximum size of file in which to fontify and/or highlight URLs.
+  "Maximum size of file in which to fontify and/or highlight URLs.
 A value of t means there is no limit--fontify regardless of the size."
   :type '(choice (integer :tag "Maximum size") (const :tag "No limit" t))
   :group 'goto-address)
index 6a25be736151cd46e91776d89e630358318848da..853839c206105a9703e469984555f52f06b3936b 100644 (file)
@@ -211,7 +211,7 @@ until a successful connection is made."
   :type '(repeat string))
 
 (defcustom imap-process-connection-type nil
-  "*Value for `process-connection-type' to use for Kerberos4, GSSAPI, shell, and SSL.
+  "Value for `process-connection-type' to use for Kerberos4, GSSAPI, shell, and SSL.
 The `process-connection-type' variable controls the type of device
 used to communicate with subprocesses.  Values are nil to use a
 pipe, or t or `pty' to use a pty.  The value has no effect if the
@@ -271,7 +271,7 @@ See also `imap-log'."
                                  (symbol-name system-type))
                                 1.0
                               0.1)
-  "*How long to wait between checking for the end of output.
+  "How long to wait between checking for the end of output.
 Shorter values mean quicker response, but is more CPU intensive."
   :type 'number
   :group 'imap)
index 941b6d7787c96a8004bc1f9f9bf929106b3bc73f..eb696798b6f20cc9ebd5a98560b768044366cdfe 100644 (file)
@@ -34,7 +34,6 @@
 ;;; Code:
 
 (require 'custom)
-(eval-when-compile (require 'cl))
 
 (autoload 'auth-source-search "auth-source")
 
@@ -465,12 +464,12 @@ Additional search parameters can be specified through
       (error "No LDAP host specified"))
   (let ((host-plist (cdr (assoc host ldap-host-parameters-alist)))
        result)
-    (setq result (ldap-search-internal (list* 'host host
-                                             'filter filter
-                                             'attributes attributes
-                                             'attrsonly attrsonly
-                                             'withdn withdn
-                                             host-plist)))
+    (setq result (ldap-search-internal `(host ,host
+                                        filter ,filter
+                                         attributes ,attributes
+                                         attrsonly ,attrsonly
+                                         withdn ,withdn
+                                         ,@host-plist)))
     (if ldap-ignore-attribute-codings
        result
       (mapcar (lambda (record)
index a8e969a18c5009220b1e713d75eccb7799ddfaf3..f85983e6e9fa00b210657fde1c90485e518b5362 100644 (file)
@@ -70,8 +70,6 @@
 (require 'widget)
 (require 'cus-edit)
 
-(eval-when-compile
-  (require 'cl))
 
 ;;; Keymappings
 
index 04db3a29d31f56a1037e0d9a9788f5af370c6b86..5597e0a6ddc32074f5726541b72daa06c48109d8 100644 (file)
@@ -155,61 +155,39 @@ The following printf-like specifiers can be used:
 ;; ======================================================================
 ;; faces
 
-(defface newsticker-new-item-face
-  '((((class color) (background dark))
-     (:family "sans" :bold t))
-    (((class color) (background light))
-     (:family "sans" :bold t)))
+(defface newsticker-new-item-face '((t :weight bold))
   "Face for new news items."
   :group 'newsticker-faces)
 
 (defface newsticker-old-item-face
-  '((((class color) (background dark))
-     (:family "sans" :bold t :foreground "orange3"))
-    (((class color) (background light))
-     (:family "sans" :bold t :foreground "red4")))
+  '((default :weight bold)
+    (((class color) (background dark))  :foreground "orange3")
+    (((class color) (background light)) :foreground "red4"))
   "Face for old news items."
   :group 'newsticker-faces)
 
 (defface newsticker-immortal-item-face
-  '((((class color) (background dark))
-     (:family "sans" :bold t :italic t :foreground "orange"))
-    (((class color) (background light))
-     (:family "sans" :bold t :italic t :foreground "blue")))
+  '((default :weight bold :slant italic)
+    (((class color) (background dark))  :foreground "orange")
+    (((class color) (background light)) :foreground "blue"))
   "Face for immortal news items."
   :group 'newsticker-faces)
 
 (defface newsticker-obsolete-item-face
-  '((((class color) (background dark))
-     (:family "sans" :bold t :strike-through t))
-    (((class color) (background light))
-     (:family "sans" :bold t :strike-through t)))
+  '((t :weight bold :strike-through t))
   "Face for old news items."
   :group 'newsticker-faces)
 
-(defface newsticker-date-face
-  '((((class color) (background dark))
-     (:family "sans" :italic t :height 0.8))
-    (((class color) (background light))
-     (:family "sans" :italic t :height 0.8)))
+(defface newsticker-date-face '((t :slant italic :height 0.8))
   "Face for newsticker dates."
   :group 'newsticker-faces)
 
-(defface newsticker-statistics-face
-  '((((class color) (background dark))
-     (:family "sans" :italic t :height 0.8))
-    (((class color) (background light))
-     (:family "sans" :italic t :height 0.8)))
+(defface newsticker-statistics-face '((t :slant italic :height 0.8))
   "Face for newsticker dates."
   :group 'newsticker-faces)
 
-(defface newsticker-default-face
-  '((((class color) (background dark))
-     (:inherit default))
-    (((class color) (background light))
-     (:inherit default)))
+(defface newsticker-default-face '((t))
   "Face for the description of news items."
-  ;;:set 'newsticker--set-customvar
   :group 'newsticker-faces)
 
 (defcustom newsticker-hide-old-items-in-newsticker-buffer
index 14e6584e9abc7c17b50a0a2898a1ba086876ed34..40da787cb198590b2b309b3e13d713facc90a2ab 100644 (file)
@@ -129,26 +129,23 @@ See `format-time-string' for a list of valid specifiers."
   :group 'newsticker-reader)
 
 (defface newsticker-feed-face
-  '((((class color) (background dark))
-     (:family "sans" :bold t :height 1.2 :foreground "white"))
-    (((class color) (background light))
-     (:family "sans" :bold t :height 1.2 :foreground "black")))
+  '((default :weight bold :height 1.2)
+    (((class color) (background dark))  :foreground "white")
+    (((class color) (background light)) :foreground "black"))
   "Face for news feeds."
   :group 'newsticker-faces)
 
 (defface newsticker-extra-face
-  '((((class color) (background dark))
-     (:italic t :foreground "gray50" :height 0.8))
-    (((class color) (background light))
-     (:italic t :foreground "gray50" :height 0.8)))
+  '((default :slant italic :height 0.8)
+    (((class color) (background dark))  :foreground "gray50")
+    (((class color) (background light)) :foreground "gray50"))
   "Face for newsticker dates."
   :group 'newsticker-faces)
 
 (defface newsticker-enclosure-face
-  '((((class color) (background dark))
-     (:bold t :background "orange"))
-    (((class color) (background light))
-     (:bold t :background "orange")))
+  '((default :weight bold)
+    (((class color) (background dark))  :background "orange")
+    (((class color) (background light)) :background "orange"))
   "Face for enclosed elements."
   :group 'newsticker-faces)
 
index e62dd284f7acc1ff2549a1ffd58610dbbbab0525..4b5ac3143d3b7e2ad1db6d737ea71bcaaa83d117 100644 (file)
@@ -1,4 +1,4 @@
-;; newst-ticker.el --- modeline ticker for newsticker.
+;; newst-ticker.el --- mode line ticker for newsticker.
 
 ;; Copyright (C) 2003-2012  Free Software Foundation, Inc.
 
index d003554e5470e3d9ce0ccafd948528e873a615ab..b44f1f9c86dfa1ed42e2fe819e00e16b77e767ef 100644 (file)
   :group 'newsticker-reader)
 
 (defface newsticker-treeview-face
-  '((((class color) (background dark))
-     (:family "sans" :foreground "white" :bold nil))
-    (((class color) (background light))
-     (:family "sans" :foreground "black" :bold nil)))
+  '((((class color) (background dark))  :foreground "white")
+    (((class color) (background light)) :foreground "black"))
   "Face for newsticker tree."
   :group 'newsticker-treeview)
 
 (defface newsticker-treeview-new-face
-  '((((class color) (background dark))
-     (:inherit newsticker-treeview-face :bold t))
-    (((class color) (background light))
-     (:inherit newsticker-treeview-face :bold t)))
+  '((t :inherit newsticker-treeview-face :weight bold))
   "Face for newsticker tree."
   :group 'newsticker-treeview)
 
 (defface newsticker-treeview-old-face
-  '((((class color) (background dark))
-     (:inherit newsticker-treeview-face))
-    (((class color) (background light))
-     (:inherit newsticker-treeview-face)))
+  '((t :inherit newsticker-treeview-face))
   "Face for newsticker tree."
   :group 'newsticker-treeview)
 
 (defface newsticker-treeview-immortal-face
-  '((((class color) (background dark))
-     (:inherit newsticker-treeview-face :foreground "orange" :italic t))
-    (((class color) (background light))
-     (:inherit newsticker-treeview-face :foreground "blue" :italic t)))
+  '((default :inherit newsticker-treeview-face :slant italic)
+    (((class color) (background dark))  :foreground "orange")
+    (((class color) (background light)) :foreground "blue"))
   "Face for newsticker tree."
   :group 'newsticker-treeview)
 
 (defface newsticker-treeview-obsolete-face
-  '((((class color) (background dark))
-     (:inherit newsticker-treeview-face :strike-through t))
-    (((class color) (background light))
-     (:inherit newsticker-treeview-face :strike-through t)))
+  '((t :inherit newsticker-treeview-face :strike-through t))
   "Face for newsticker tree."
   :group 'newsticker-treeview)
 
 (defface newsticker-treeview-selection-face
-  '((((class color) (background dark))
-     (:background "#bbbbff"))
-    (((class color) (background light))
-     (:background "#bbbbff")))
+  '((((class color) (background dark))  :background "#bbbbff")
+    (((class color) (background light)) :background "#bbbbff"))
   "Face for newsticker selection."
   :group 'newsticker-treeview)
 
index fc518c2484323397930e3263dfad2936c36aada8..5d673faf0db03c4c821c5cdee066766d9b610918 100644 (file)
 ;; -----
 ;; The command newsticker-show-news will display all available headlines in
 ;; a special buffer, called `*newsticker*'.  It will also start the
-;; asynchronous download of headlines.  The modeline in the `*newsticker*'
+;; asynchronous download of headlines.  The mode line in the `*newsticker*'
 ;; buffer informs whenever new headlines have arrived.  Clicking
 ;; mouse-button 2 or pressing RET in this buffer on a headline will call
 ;; browse-url to load the corresponding news story in your favorite web
index 8d6aedff562947885ae0c16091706b966d8841b7..f3b0e372de42022876075a85d38301b6cfafc685 100644 (file)
@@ -81,8 +81,7 @@
 
 ;; Things we need:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'thingatpt)
 (require 'pp)
 (require 'browse-url)
   :prefix "quickurl-")
 
 (defcustom quickurl-url-file (convert-standard-filename "~/.quickurls")
-  "*File that contains the URL list."
+  "File that contains the URL list."
   :type  'file
   :group 'quickurl)
 
 (defcustom quickurl-format-function (lambda (url) (format "<URL:%s>" (quickurl-url-url url)))
-  "*Function to format the URL before insertion into the current buffer."
+  "Function to format the URL before insertion into the current buffer."
   :type  'function
   :group 'quickurl)
 
                                             (string<
                                              (downcase (quickurl-url-description x))
                                              (downcase (quickurl-url-description y))))))
-  "*Function to sort the URL list."
+  "Function to sort the URL list."
   :type  'function
   :group 'quickurl)
 
 (defcustom quickurl-grab-lookup-function #'current-word
-  "*Function to grab the thing to lookup."
+  "Function to grab the thing to lookup."
   :type  'function
   :group 'quickurl)
 
 (defcustom quickurl-assoc-function #'assoc-ignore-case
-  "*Function to use for alist lookup into `quickurl-urls'."
+  "Function to use for alist lookup into `quickurl-urls'."
   :type  'function
   :group 'quickurl)
 
 (defcustom quickurl-completion-ignore-case t
-  "*Should `quickurl-ask' ignore case when doing the input lookup?"
+  "Should `quickurl-ask' ignore case when doing the input lookup?"
   :type  'boolean
   :group 'quickurl)
 
 (defcustom quickurl-prefix ";; -*- lisp -*-\n\n"
-  "*Text to write to `quickurl-url-file' before writing the URL list."
+  "Text to write to `quickurl-url-file' before writing the URL list."
   :type  'string
   :group 'quickurl)
 
 (defcustom quickurl-postfix ""
-  "*Text to write to `quickurl-url-file' after writing the URL list.
+  "Text to write to `quickurl-url-file' after writing the URL list.
 
 See the constant `quickurl-reread-hook-postfix' for some example text that
 could be used here."
@@ -144,7 +143,7 @@ could be used here."
   :group 'quickurl)
 
 (defcustom quickurl-list-mode-hook nil
-  "*Hooks for `quickurl-list-mode'."
+  "Hooks for `quickurl-list-mode'."
   :type  'hook
   :group 'quickurl)
 
@@ -206,47 +205,40 @@ in your ~/.emacs (after loading/requiring quickurl).")
       (list keyword url comment)
     (cons keyword url)))
 
-(defun quickurl-url-keyword (url)
+(defalias 'quickurl-url-keyword #'car
   "Return the keyword for the URL.
-
-Note that this function is a setfable place."
-  (car url))
-
-(defsetf quickurl-url-keyword (url) (store)
-  `(setf (car ,url) ,store))
+\n\(fn URL)")
 
 (defun quickurl-url-url (url)
   "Return the actual URL of the URL.
 
 Note that this function is a setfable place."
+  (declare (gv-setter (lambda (store)
+                        `(setf (if (quickurl-url-commented-p ,url)
+                                   (cadr ,url)
+                                 (cdr ,url))
+                               ,store))))
   (if (quickurl-url-commented-p url)
       (cadr url)
     (cdr url)))
 
-(defsetf quickurl-url-url (url) (store)
-  `
-  (if (quickurl-url-commented-p ,url)
-      (setf (cadr ,url) ,store)
-    (setf (cdr ,url) ,store)))
-
 (defun quickurl-url-comment (url)
   "Get the comment from a URL.
 
 If the URL has no comment an empty string is returned. Also note that this
 function is a setfable place."
+  (declare
+   (gv-setter (lambda (store)
+                `(if (quickurl-url-commented-p ,url)
+                     (if (zerop (length ,store))
+                         (setf (cdr ,url) (cadr ,url))
+                       (setf (nth 2 ,url) ,store))
+                   (unless (zerop (length ,store))
+                     (setf (cdr ,url) (list (cdr ,url) ,store)))))))
   (if (quickurl-url-commented-p url)
       (nth 2 url)
     ""))
 
-(defsetf quickurl-url-comment (url) (store)
-  `
-  (if (quickurl-url-commented-p ,url)
-      (if (zerop (length ,store))
-          (setf (cdr ,url) (cadr ,url))
-        (setf (nth 2 ,url) ,store))
-    (unless (zerop (length ,store))
-      (setf (cdr ,url) (list (cdr ,url) ,store)))))
-
 (defun quickurl-url-description (url)
   "Return a description for the URL.
 
@@ -259,14 +251,14 @@ returned."
 
 ;; Main code:
 
-(defun* quickurl-read (&optional buffer)
+(cl-defun quickurl-read (&optional buffer)
   "`read' the URL list from BUFFER into `quickurl-urls'.
 
 BUFFER, if nil, defaults to current buffer.
 Note that this function moves point to `point-min' before doing the `read'
 It also restores point after the `read'."
   (save-excursion
-    (setf (point) (point-min))
+    (goto-char (point-min))
     (setq quickurl-urls (funcall quickurl-sort-function
                                  (read (or buffer (current-buffer)))))))
 
@@ -303,7 +295,7 @@ Also display a `message' saying what the URL was unless SILENT is non-nil."
     (message "Found %s" (quickurl-url-url url))))
 
 ;;;###autoload
-(defun* quickurl (&optional lookup)
+(cl-defun quickurl (&optional lookup)
   "Insert a URL based on LOOKUP.
 
 If not supplied LOOKUP is taken to be the word at point in the current
@@ -464,20 +456,21 @@ The key bindings for `quickurl-list-mode' are:
 (defun quickurl-list-populate-buffer ()
   "Populate the `quickurl-list' buffer."
   (with-current-buffer (get-buffer quickurl-list-buffer-name)
-    (let ((buffer-read-only nil)
-          (fmt (format "%%-%ds %%s\n"
-                       (apply #'max (or (loop for url in quickurl-urls
-                                              collect (length (quickurl-url-description url)))
-                                        (list 20))))))
-      (setf (buffer-string) "")
-      (loop for url in quickurl-urls
-            do (let ((start (point)))
-                 (insert (format fmt (quickurl-url-description url)
-                                 (quickurl-url-url url)))
-                 (add-text-properties start (1- (point))
-                                    '(mouse-face highlight
-                                     help-echo "mouse-2: insert this URL"))))
-      (setf (point) (point-min)))))
+    (let* ((sizes (or (cl-loop for url in quickurl-urls
+                               collect (length (quickurl-url-description url)))
+                      (list 20)))
+           (fmt (format "%%-%ds %%s\n" (apply #'max sizes)))
+           (inhibit-read-only t))
+      (erase-buffer)
+      (cl-loop for url in quickurl-urls
+               do (let ((start (point)))
+                    (insert (format fmt (quickurl-url-description url)
+                                    (quickurl-url-url url)))
+                    (add-text-properties
+                     start (1- (point))
+                     '(mouse-face highlight
+                       help-echo "mouse-2: insert this URL"))))
+      (goto-char (point-min)))))
 
 (defun quickurl-list-add-url (word url comment)
   "Wrapper for `quickurl-add-url' that doesn't guess the parameters."
@@ -494,7 +487,7 @@ The key bindings for `quickurl-list-mode' are:
 (defun quickurl-list-mouse-select (event)
   "Select the URL under the mouse click."
   (interactive "e")
-  (setf (point) (posn-point (event-end event)))
+  (goto-char (posn-point (event-end event)))
   (quickurl-list-insert-url))
 
 (defun quickurl-list-insert (type)
@@ -510,16 +503,16 @@ TYPE dictates what will be inserted, options are:
     (if url
         (with-current-buffer quickurl-list-last-buffer
           (insert
-           (case type
-             (url         (funcall quickurl-format-function url))
-             (naked-url   (quickurl-url-url url))
-             (with-lookup (format "%s <URL:%s>"
+           (pcase type
+             (`url         (funcall quickurl-format-function url))
+             (`naked-url   (quickurl-url-url url))
+             (`with-lookup (format "%s <URL:%s>"
                                    (quickurl-url-keyword url)
                                    (quickurl-url-url url)))
-             (with-desc   (format "%S <URL:%s>"
+             (`with-desc   (format "%S <URL:%s>"
                                    (quickurl-url-description url)
                                    (quickurl-url-url url)))
-             (lookup      (quickurl-url-keyword url)))))
+             (`lookup      (quickurl-url-keyword url)))))
       (error "No URL details on that line"))
     url))
 
index e34b7c79b3bae9df6b5598c0e517e04de9b79c19..85a13a8cf625836eedef535c84420128accca647 100644 (file)
@@ -30,7 +30,7 @@
 ;; one-to-one communication.
 
 ;; Rcirc has simple defaults and clear and consistent behavior.
-;; Message arrival timestamps, activity notification on the modeline,
+;; Message arrival timestamps, activity notification on the mode line,
 ;; message filling, nick completion, and keepalive pings are all
 ;; enabled by default, but can easily be adjusted or turned off.  Each
 ;; discussion takes place in its own buffer and there is a single
@@ -139,12 +139,12 @@ for connections using SSL/TLS."
   :group 'rcirc)
 
 (defcustom rcirc-fill-flag t
-  "*Non-nil means line-wrap messages printed in channel buffers."
+  "Non-nil means line-wrap messages printed in channel buffers."
   :type 'boolean
   :group 'rcirc)
 
 (defcustom rcirc-fill-column nil
-  "*Column beyond which automatic line-wrapping should happen.
+  "Column beyond which automatic line-wrapping should happen.
 If nil, use value of `fill-column'.  If 'frame-width, use the
 maximum frame width."
   :type '(choice (const :tag "Value of `fill-column'")
@@ -153,7 +153,7 @@ maximum frame width."
   :group 'rcirc)
 
 (defcustom rcirc-fill-prefix nil
-  "*Text to insert before filled lines.
+  "Text to insert before filled lines.
 If nil, calculate the prefix dynamically to line up text
 underneath each nick."
   :type '(choice (const :tag "Dynamic" nil)
@@ -174,23 +174,23 @@ Use the command `rcirc-omit-mode' to change this variable.")
 (make-variable-buffer-local 'rcirc-omit-mode)
 
 (defcustom rcirc-time-format "%H:%M "
-  "*Describes how timestamps are printed.
+  "Describes how timestamps are printed.
 Used as the first arg to `format-time-string'."
   :type 'string
   :group 'rcirc)
 
 (defcustom rcirc-input-ring-size 1024
-  "*Size of input history ring."
+  "Size of input history ring."
   :type 'integer
   :group 'rcirc)
 
 (defcustom rcirc-read-only-flag t
-  "*Non-nil means make text in IRC buffers read-only."
+  "Non-nil means make text in IRC buffers read-only."
   :type 'boolean
   :group 'rcirc)
 
 (defcustom rcirc-buffer-maximum-lines nil
-  "*The maximum size in lines for rcirc buffers.
+  "The maximum size in lines for rcirc buffers.
 Channel buffers are truncated from the top to be no greater than this
 number.  If zero or nil, no truncating is done."
   :type '(choice (const :tag "No truncation" nil)
@@ -198,7 +198,7 @@ number.  If zero or nil, no truncating is done."
   :group 'rcirc)
 
 (defcustom rcirc-scroll-show-maximum-output t
-  "*If non-nil, scroll buffer to keep the point at the bottom of
+  "If non-nil, scroll buffer to keep the point at the bottom of
 the window."
   :type 'boolean
   :group 'rcirc)
@@ -244,13 +244,13 @@ Examples:
   :group 'rcirc)
 
 (defcustom rcirc-auto-authenticate-flag t
-  "*Non-nil means automatically send authentication string to server.
+  "Non-nil means automatically send authentication string to server.
 See also `rcirc-authinfo'."
   :type 'boolean
   :group 'rcirc)
 
 (defcustom rcirc-authenticate-before-join t
-  "*Non-nil means authenticate to services before joining channels.
+  "Non-nil means authenticate to services before joining channels.
 Currently only works with NickServ on some networks."
   :version "24.1"
   :type 'boolean
@@ -361,6 +361,14 @@ of a line.  The string is passed as the first argument to
   :type 'string
   :group 'rcirc)
 
+(defcustom rcirc-kill-channel-buffers nil
+  "When non-nil, kill channel buffers when the server buffer is killed.
+Only the channel buffers associated with the server in question
+will be killed."
+  :version "24.2"
+  :type 'boolean
+  :group 'rcirc)
+
 (defvar rcirc-nick nil)
 
 (defvar rcirc-prompt-start-marker nil)
@@ -386,7 +394,7 @@ of a line.  The string is passed as the first argument to
   "List of buffers with unviewed activity.")
 
 (defvar rcirc-activity-string ""
-  "String displayed in modeline representing `rcirc-activity'.")
+  "String displayed in mode line representing `rcirc-activity'.")
 (put 'rcirc-activity-string 'risky-local-variable t)
 
 (defvar rcirc-server-buffer nil
@@ -1090,12 +1098,20 @@ Logfiles are kept in `rcirc-log-directory'."
   :group 'rcirc)
 
 (defun rcirc-kill-buffer-hook ()
-  "Part the channel when killing an rcirc buffer."
+  "Part the channel when killing an rcirc buffer.
+
+If `rcirc-kill-channel-buffers' is non-nil and the killed buffer
+is a server buffer, kills all of the channel buffers associated
+with it."
   (when (eq major-mode 'rcirc-mode)
     (when (and rcirc-log-flag
                rcirc-log-directory)
       (rcirc-log-write))
-    (rcirc-clean-up-buffer "Killed buffer")))
+    (rcirc-clean-up-buffer "Killed buffer")
+    (when (and rcirc-buffer-alist ;; it's a server buffer
+               rcirc-kill-channel-buffers)
+      (dolist (channel rcirc-buffer-alist)
+       (kill-buffer (cdr channel))))))
 
 (defun rcirc-change-major-mode-hook ()
   "Part the channel when changing the major-mode."
@@ -1583,7 +1599,7 @@ record activity."
          (buffer-disable-undo)
          (buffer-enable-undo))
 
-       ;; record modeline activity
+       ;; record mode line activity
        (when (and activity
                   (not rcirc-ignore-buffer-activity-flag)
                   (not (and rcirc-dim-nicks sender
@@ -1987,7 +2003,7 @@ activity.  Only run if the buffer is not visible and
             buffers ","))
 
 (defun rcirc-short-buffer-name (buffer)
-  "Return a short name for BUFFER to use in the modeline indicator."
+  "Return a short name for BUFFER to use in the mode line indicator."
   (with-current-buffer buffer
     (or rcirc-short-buffer-name (buffer-name))))
 
@@ -2870,67 +2886,65 @@ Passwords are stored in `rcirc-authinfo' (which see)."
   :group 'faces)
 
 (defface rcirc-my-nick                 ; font-lock-function-name-face
-  '((((class color) (min-colors 88) (background light)) (:foreground "Blue1"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "LightSkyBlue"))
-    (((class color) (min-colors 16) (background light)) (:foreground "Blue"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "LightSkyBlue"))
-    (((class color) (min-colors 8)) (:foreground "blue" :weight bold))
-    (t (:inverse-video t :weight bold)))
-  "The face used to highlight my messages."
+  '((((class color) (min-colors 88) (background light)) :foreground "Blue1")
+    (((class color) (min-colors 88) (background dark))  :foreground "LightSkyBlue")
+    (((class color) (min-colors 16) (background light)) :foreground "Blue")
+    (((class color) (min-colors 16) (background dark))  :foreground "LightSkyBlue")
+    (((class color) (min-colors 8)) :foreground "blue" :weight bold)
+    (t :inverse-video t :weight bold))
+  "Rcirc face for my messages."
   :group 'rcirc-faces)
 
 (defface rcirc-other-nick           ; font-lock-variable-name-face
   '((((class grayscale) (background light))
-     (:foreground "Gray90" :weight bold :slant italic))
+     :foreground "Gray90" :weight bold :slant italic)
     (((class grayscale) (background dark))
-     (:foreground "DimGray" :weight bold :slant italic))
-    (((class color) (min-colors 88) (background light)) (:foreground "DarkGoldenrod"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "LightGoldenrod"))
-    (((class color) (min-colors 16) (background light)) (:foreground "DarkGoldenrod"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "LightGoldenrod"))
-    (((class color) (min-colors 8)) (:foreground "yellow" :weight light))
-    (t (:weight bold :slant italic)))
-  "The face used to highlight other messages."
+     :foreground "DimGray" :weight bold :slant italic)
+    (((class color) (min-colors 88) (background light)) :foreground "DarkGoldenrod")
+    (((class color) (min-colors 88) (background dark))  :foreground "LightGoldenrod")
+    (((class color) (min-colors 16) (background light)) :foreground "DarkGoldenrod")
+    (((class color) (min-colors 16) (background dark))  :foreground "LightGoldenrod")
+    (((class color) (min-colors 8)) :foreground "yellow" :weight light)
+    (t :weight bold :slant italic))
+  "Rcirc face for other users' messages."
   :group 'rcirc-faces)
 
 (defface rcirc-bright-nick
   '((((class grayscale) (background light))
-     (:foreground "LightGray" :weight bold :underline t))
+     :foreground "LightGray" :weight bold :underline t)
     (((class grayscale) (background dark))
-     (:foreground "Gray50" :weight bold :underline t))
-    (((class color) (min-colors 88) (background light)) (:foreground "CadetBlue"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "Aquamarine"))
-    (((class color) (min-colors 16) (background light)) (:foreground "CadetBlue"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "Aquamarine"))
-    (((class color) (min-colors 8)) (:foreground "magenta"))
-    (t (:weight bold :underline t)))
-  "Face used for nicks matched by `rcirc-bright-nicks'."
+     :foreground "Gray50" :weight bold :underline t)
+    (((class color) (min-colors 88) (background light)) :foreground "CadetBlue")
+    (((class color) (min-colors 88) (background dark))  :foreground "Aquamarine")
+    (((class color) (min-colors 16) (background light)) :foreground "CadetBlue")
+    (((class color) (min-colors 16) (background dark))  :foreground "Aquamarine")
+    (((class color) (min-colors 8)) :foreground "magenta")
+    (t :weight bold :underline t))
+  "Rcirc face for nicks matched by `rcirc-bright-nicks'."
   :group 'rcirc-faces)
 
 (defface rcirc-dim-nick
   '((t :inherit default))
-  "Face used for nicks in `rcirc-dim-nicks'."
+  "Rcirc face for nicks in `rcirc-dim-nicks'."
   :group 'rcirc-faces)
 
 (defface rcirc-server                  ; font-lock-comment-face
   '((((class grayscale) (background light))
-     (:foreground "DimGray" :weight bold :slant italic))
+     :foreground "DimGray" :weight bold :slant italic)
     (((class grayscale) (background dark))
-     (:foreground "LightGray" :weight bold :slant italic))
+     :foreground "LightGray" :weight bold :slant italic)
     (((class color) (min-colors 88) (background light))
-     (:foreground "Firebrick"))
+     :foreground "Firebrick")
     (((class color) (min-colors 88) (background dark))
-     (:foreground "chocolate1"))
+     :foreground "chocolate1")
     (((class color) (min-colors 16) (background light))
-     (:foreground "red"))
+     :foreground "red")
     (((class color) (min-colors 16) (background dark))
-     (:foreground "red1"))
-    (((class color) (min-colors 8) (background light))
-     )
-    (((class color) (min-colors 8) (background dark))
-     )
-    (t (:weight bold :slant italic)))
-  "The face used to highlight server messages."
+     :foreground "red1")
+    (((class color) (min-colors 8) (background light)))
+    (((class color) (min-colors 8) (background dark)))
+    (t :weight bold :slant italic))
+  "Rcirc face for server messages."
   :group 'rcirc-faces)
 
 (defface rcirc-server-prefix    ; font-lock-comment-delimiter-face
@@ -2941,57 +2955,53 @@ Passwords are stored in `rcirc-authinfo' (which see)."
      :foreground "red")
     (((class color) (min-colors 8) (background dark))
      :foreground "red1"))
-  "The face used to highlight server prefixes."
+  "Rcirc face for server prefixes."
   :group 'rcirc-faces)
 
 (defface rcirc-timestamp
-  '((t (:inherit default)))
-  "The face used to highlight timestamps."
+  '((t :inherit default))
+  "Rcirc face for timestamps."
   :group 'rcirc-faces)
 
 (defface rcirc-nick-in-message         ; font-lock-keyword-face
-  '((((class grayscale) (background light)) (:foreground "LightGray" :weight bold))
-    (((class grayscale) (background dark)) (:foreground "DimGray" :weight bold))
-    (((class color) (min-colors 88) (background light)) (:foreground "Purple"))
-    (((class color) (min-colors 88) (background dark)) (:foreground "Cyan1"))
-    (((class color) (min-colors 16) (background light)) (:foreground "Purple"))
-    (((class color) (min-colors 16) (background dark)) (:foreground "Cyan"))
-    (((class color) (min-colors 8)) (:foreground "cyan" :weight bold))
-    (t (:weight bold)))
-  "The face used to highlight instances of your nick within messages."
+  '((((class grayscale) (background light)) :foreground "LightGray" :weight bold)
+    (((class grayscale) (background dark)) :foreground "DimGray" :weight bold)
+    (((class color) (min-colors 88) (background light)) :foreground "Purple")
+    (((class color) (min-colors 88) (background dark))  :foreground "Cyan1")
+    (((class color) (min-colors 16) (background light)) :foreground "Purple")
+    (((class color) (min-colors 16) (background dark))  :foreground "Cyan")
+    (((class color) (min-colors 8)) :foreground "cyan" :weight bold)
+    (t :weight bold))
+  "Rcirc face for instances of your nick within messages."
   :group 'rcirc-faces)
 
-(defface rcirc-nick-in-message-full-line
-  '((t (:bold t)))
-  "The face used emphasize the entire message when your nick is mentioned."
+(defface rcirc-nick-in-message-full-line '((t :weight bold))
+  "Rcirc face for emphasizing the entire message when your nick is mentioned."
   :group 'rcirc-faces)
 
 (defface rcirc-prompt                  ; comint-highlight-prompt
-  '((((min-colors 88) (background dark)) (:foreground "cyan1"))
-    (((background dark)) (:foreground "cyan"))
-    (t (:foreground "dark blue")))
-  "The face used to highlight prompts."
+  '((((min-colors 88) (background dark)) :foreground "cyan1")
+    (((background dark)) :foreground "cyan")
+    (t :foreground "dark blue"))
+  "Rcirc face for prompts."
   :group 'rcirc-faces)
 
 (defface rcirc-track-nick
-  '((((type tty)) (:inherit default))
-    (t (:inverse-video t)))
-  "The face used in the mode-line when your nick is mentioned."
+  '((((type tty)) :inherit default)
+    (t :inverse-video t))
+  "Rcirc face used in the mode-line when your nick is mentioned."
   :group 'rcirc-faces)
 
-(defface rcirc-track-keyword
-  '((t (:bold t )))
-  "The face used in the mode-line when keywords are mentioned."
+(defface rcirc-track-keyword '((t :weight bold))
+  "Rcirc face used in the mode-line when keywords are mentioned."
   :group 'rcirc-faces)
 
-(defface rcirc-url
-  '((t (:bold t)))
-  "The face used to highlight urls."
+(defface rcirc-url '((t :weight bold))
+  "Rcirc face used to highlight urls."
   :group 'rcirc-faces)
 
-(defface rcirc-keyword
-  '((t (:inherit highlight)))
-  "The face used to highlight keywords."
+(defface rcirc-keyword '((t :inherit highlight))
+  "Rcirc face used to highlight keywords."
   :group 'rcirc-faces)
 
 \f
index a79defed295524adcf81854c1b13201003699441..96b74b2f8e28823e65af73e64e21275aeb48bf46 100644 (file)
 ;; Pacify byte-compiler.  D-Bus support in the Emacs core can be
 ;; disabled with configuration option "--without-dbus".  Declare used
 ;; subroutines and variables of `dbus' therefore.
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
-(declare-function dbus-call-method "dbusbind.c")
-(declare-function dbus-register-signal "dbusbind.c")
 (defvar dbus-debug)
 
 (require 'dbus)
@@ -650,7 +647,7 @@ If there is no such item, return nil."
   (let ((item-path (secrets-item-path collection item)))
     (unless (secrets-empty-path item-path)
       (dbus-byte-array-to-string
-       (caddr
+       (cl-caddr
        (dbus-call-method
         :session secrets-service item-path secrets-interface-item
         "GetSecret" :object-path secrets-session-path))))))
index 42b6f4826656d6a3672412df47defdf7af34b142..c155d53b6d01da99c6160f093ee0014d874ef380 100644 (file)
@@ -85,7 +85,6 @@
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)
   (require 'imenu)   ; Need this stuff when compiling for imenu macros, etc.
   (require 'tempo))
 
@@ -141,10 +140,10 @@ This is used during Tempo template completion."
   :group 'snmp)
 
 (defvar snmp-tempo-tags nil
-  "*Tempo tags for SNMP mode.")
+  "Tempo tags for SNMP mode.")
 
 (defvar snmpv2-tempo-tags nil
-  "*Tempo tags for SNMPv2 mode.")
+  "Tempo tags for SNMPv2 mode.")
 
 
 ;; Enable fontification for SNMP MIBs
index e17b283c55f86d16b7631300b93f48fa2ae95468..93ba0a7e16742c31a1f472480552f7a8b4cb01f2 100644 (file)
@@ -369,6 +369,9 @@ binding) but the same name."
   kind                              ; a symbol of: string, dateTime, long, int
   )
 
+(defstruct (soap-simple-type (:include soap-basic-type))
+  enumeration)
+
 (defstruct soap-sequence-element
   name type nillable? multiple?)
 
@@ -415,8 +418,9 @@ binding) but the same name."
 (defun soap-default-xsd-types ()
   "Return a namespace containing some of the XMLSchema types."
   (let ((ns (make-soap-namespace :name "http://www.w3.org/2001/XMLSchema")))
-    (dolist (type '("string" "dateTime" "boolean" "long" "int" "float"
-                    "base64Binary" "anyType" "Array" "byte[]"))
+    (dolist (type '("string" "dateTime" "boolean"
+                    "long" "int" "integer" "unsignedInt" "byte" "float" "double"
+                    "base64Binary" "anyType" "anyURI" "Array" "byte[]"))
       (soap-namespace-put
        (make-soap-basic-type :name type :kind (intern type))
        ns))
@@ -425,9 +429,10 @@ binding) but the same name."
 (defun soap-default-soapenc-types ()
   "Return a namespace containing some of the SOAPEnc types."
   (let ((ns (make-soap-namespace
-            :name "http://schemas.xmlsoap.org/soap/encoding/")))
-    (dolist (type '("string" "dateTime" "boolean" "long" "int" "float"
-                    "base64Binary" "anyType" "Array" "byte[]"))
+             :name "http://schemas.xmlsoap.org/soap/encoding/")))
+    (dolist (type '("string" "dateTime" "boolean"
+                    "long" "int" "integer" "unsignedInt" "byte" "float" "double"
+                    "base64Binary" "anyType" "anyURI" "Array" "byte[]"))
       (soap-namespace-put
        (make-soap-basic-type :name type :kind (intern type))
        ns))
@@ -555,6 +560,15 @@ updated."
     (when resolver
       (funcall resolver element wsdl))))
 
+(defun soap-resolve-references-for-simple-type (type wsdl)
+  "Resolve the base type for the simple TYPE using the WSDL
+  document."
+  (let ((kind (soap-basic-type-kind type)))
+    (unless (symbolp kind)
+      (let ((basic-type (soap-wsdl-get kind wsdl 'soap-basic-type-p)))
+        (setf (soap-basic-type-kind type)
+              (soap-basic-type-kind basic-type))))))
+
 (defun soap-resolve-references-for-sequence-type (type wsdl)
   "Resolve references for a sequence TYPE using WSDL document.
 See also `soap-resolve-references-for-element' and
@@ -562,12 +576,18 @@ See also `soap-resolve-references-for-element' and
   (let ((parent (soap-sequence-type-parent type)))
     (when (or (consp parent) (stringp parent))
       (setf (soap-sequence-type-parent type)
-            (soap-wsdl-get parent wsdl 'soap-type-p))))
+            (soap-wsdl-get
+             parent wsdl
+             ;; Prevent self references, see Bug#9
+             (lambda (e) (and (not (eq e type)) (soap-type-p e)))))))
   (dolist (element (soap-sequence-type-elements type))
     (let ((element-type (soap-sequence-element-type element)))
       (cond ((or (consp element-type) (stringp element-type))
              (setf (soap-sequence-element-type element)
-                   (soap-wsdl-get element-type wsdl 'soap-type-p)))
+                   (soap-wsdl-get
+                    element-type wsdl
+                    ;; Prevent self references, see Bug#9
+                    (lambda (e) (and (not (eq e type)) (soap-type-p e))))))
             ((soap-element-p element-type)
              ;; since the element already has a child element, it
              ;; could be an inline structure.  we must resolve
@@ -582,7 +602,10 @@ See also `soap-resolve-references-for-element' and
   (let ((element-type (soap-array-type-element-type type)))
     (when (or (consp element-type) (stringp element-type))
       (setf (soap-array-type-element-type type)
-            (soap-wsdl-get element-type wsdl 'soap-type-p)))))
+            (soap-wsdl-get
+             element-type wsdl
+             ;; Prevent self references, see Bug#9
+             (lambda (e) (and (not (eq e type)) (soap-type-p e))))))))
 
 (defun soap-resolve-references-for-message (message wsdl)
   "Resolve references for a MESSAGE type using the WSDL document.
@@ -679,6 +702,8 @@ See also `soap-resolve-references-for-element' and
 
 ;; Install resolvers for our types
 (progn
+  (put (aref (make-soap-simple-type) 0) 'soap-resolve-references
+       'soap-resolve-references-for-simple-type)
   (put (aref (make-soap-sequence-type) 0) 'soap-resolve-references
        'soap-resolve-references-for-sequence-type)
   (put (aref (make-soap-array-type) 0) 'soap-resolve-references
@@ -854,6 +879,9 @@ Return a SOAP-NAMESPACE containing the elements."
     (let ((ns (make-soap-namespace :name (soap-get-target-namespace node))))
       ;; NOTE: we only extract the complexTypes from the schema, we wouldn't
       ;; know how to handle basic types beyond the built in ones anyway.
+      (dolist (node (soap-xml-get-children1 node 'xsd:simpleType))
+        (soap-namespace-put (soap-parse-simple-type node) ns))
+
       (dolist (node (soap-xml-get-children1 node 'xsd:complexType))
         (soap-namespace-put (soap-parse-complex-type node) ns))
 
@@ -862,6 +890,26 @@ Return a SOAP-NAMESPACE containing the elements."
 
       ns)))
 
+(defun soap-parse-simple-type (node)
+  "Parse NODE and construct a simple type from it."
+  (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:simpleType)
+          nil
+          "soap-parse-complex-type: expecting xsd:simpleType node, got %s"
+          (soap-l2wk (xml-node-name node)))
+  (let ((name (xml-get-attribute-or-nil node 'name))
+        type
+        enumeration
+        (restriction (car-safe
+                      (soap-xml-get-children1 node 'xsd:restriction))))
+    (unless restriction
+      (error "simpleType %s has no base type" name))
+
+    (setq type (xml-get-attribute-or-nil restriction 'base))
+    (dolist (e (soap-xml-get-children1 restriction 'xsd:enumeration))
+      (push (xml-get-attribute e 'value) enumeration))
+
+    (make-soap-simple-type :name name :kind type :enumeration enumeration)))
+
 (defun soap-parse-schema-element (node)
   "Parse NODE and construct a schema element from it."
   (assert (eq (soap-l2wk (xml-node-name node)) 'xsd:element)
@@ -975,7 +1023,7 @@ contents."
                                   extension 'xsd:sequence)))))
             (restriction
              (let ((base (xml-get-attribute-or-nil restriction 'base)))
-               (assert (equal base "soapenc:Array")
+               (assert (equal base (soap-wk2l "soapenc:Array"))
                        nil
                        "restrictions supported only for soapenc:Array types, this is a %s"
                        base))
@@ -1245,9 +1293,9 @@ type-info stored in TYPE."
     (if (null contents)
         nil
         (ecase type-kind
-          (string (car contents))
+          ((string anyURI) (car contents))
           (dateTime (car contents))     ; TODO: convert to a date time
-          ((long int float) (string-to-number (car contents)))
+          ((long int integer unsignedInt byte float double) (string-to-number (car contents)))
           (boolean (string= (downcase (car contents)) "true"))
           (base64Binary (base64-decode-string (car contents)))
           (anyType (soap-decode-any-type node))
@@ -1293,6 +1341,10 @@ This is because it is easier to work with list results in LISP."
 (progn
   (put (aref (make-soap-basic-type) 0)
        'soap-decoder 'soap-decode-basic-type)
+  ;; just use the basic type decoder for the simple type -- we accept any
+  ;; value and don't do any validation on it.
+  (put (aref (make-soap-simple-type) 0)
+       'soap-decoder 'soap-decode-basic-type)
   (put (aref (make-soap-sequence-type) 0)
        'soap-decoder 'soap-decode-sequence-type)
   (put (aref (make-soap-array-type) 0)
@@ -1322,10 +1374,11 @@ WSDL is used to decode the NODE"
                                           fault 'faultcode))))
                               (car-safe (xml-node-children n))))
                 (fault-string (let ((n (car (xml-get-children
-                                            fault 'faultstring))))
-                                (car-safe (xml-node-children n)))))
+                                             fault 'faultstring))))
+                                (car-safe (xml-node-children n))))
+                (detail (xml-get-children fault 'detail)))
           (while t
-            (signal 'soap-error (list fault-code fault-string))))))
+            (signal 'soap-error (list fault-code fault-string detail))))))
 
       ;; First (non string) element of the body is the root node of he
       ;; response
@@ -1457,7 +1510,7 @@ instead."
         (progn
           (insert ">")
           (case basic-type
-            (string
+            ((string anyURI)
              (unless (stringp value)
                (error "Soap-encode-basic-type(%s, %s, %s): not a string value"
                       xml-tag value xsi-type))
@@ -1484,10 +1537,19 @@ instead."
                       xml-tag value xsi-type))
              (insert (if value "true" "false")))
 
-            ((long int)
+            ((long int integer byte unsignedInt)
              (unless (integerp value)
                (error "Soap-encode-basic-type(%s, %s, %s): not an integer value"
                       xml-tag value xsi-type))
+             (when (and (eq basic-type 'unsignedInt) (< value 0))
+               (error "Soap-encode-basic-type(%s, %s, %s): not a positive integer"
+                      xml-tag value xsi-type))
+             (insert (number-to-string value)))
+
+            ((float double)
+             (unless (numberp value)
+               (error "Soap-encode-basic-type(%s, %s, %s): not a number"
+                      xml-tag value xsi-type))
              (insert (number-to-string value)))
 
             (base64Binary
@@ -1504,6 +1566,20 @@ instead."
         (insert " xsi:nil=\"true\">"))
     (insert "</" xml-tag ">\n")))
 
+(defun soap-encode-simple-type (xml-tag value type)
+  "Encode inside XML-TAG the LISP VALUE according to TYPE."
+
+  ;; Validate VALUE against the simple type's enumeration, than just encode it
+  ;; using `soap-encode-basic-type'
+
+  (let ((enumeration (soap-simple-type-enumeration type)))
+    (unless (and (> (length enumeration) 1)
+                 (member value enumeration))
+      (error "soap-encode-simple-type(%s, %s, %s): bad value, should be one of %s"
+             xml-tag value (soap-element-fq-name type) enumeration)))
+
+  (soap-encode-basic-type xml-tag value type))
+
 (defun soap-encode-sequence-type (xml-tag value type)
   "Encode inside XML-TAG the LISP VALUE according to TYPE.
 Do not call this function directly, use `soap-encode-value'
@@ -1564,6 +1640,8 @@ instead."
 (progn
   (put (aref (make-soap-basic-type) 0)
        'soap-encoder 'soap-encode-basic-type)
+  (put (aref (make-soap-simple-type) 0)
+       'soap-encoder 'soap-encode-simple-type)
   (put (aref (make-soap-sequence-type) 0)
        'soap-encoder 'soap-encode-sequence-type)
   (put (aref (make-soap-array-type) 0)
index 823f815d58f5f4cb278f90df1dbeddf7af650645..877ac71f4c1b3442cb7ee878e6face001d41228b 100644 (file)
@@ -66,6 +66,15 @@ use `soap-sample-value' instead."
     ;; TODO: we need better sample values for more types.
     (t (format "%s" (soap-basic-type-kind type)))))
 
+(defun soap-sample-value-for-simple-type (type)
+  "Provide a sample value for TYPE which is a simple type.
+This is a specific function which should not be called directly,
+use `soap-sample-value' instead."
+  (let ((enumeration (soap-simple-type-enumeration type)))
+    (if (> (length enumeration) 1)
+        (elt enumeration (random (length enumeration)))
+        (soap-sample-value-for-basic-type type))))
+
 (defun soap-sample-value-for-seqence-type (type)
   "Provide a sample value for TYPE which is a sequence type.
 Values for sequence types are ALISTS of (slot-name . VALUE) for
@@ -115,6 +124,9 @@ use `soap-sample-value' instead."
   (put (aref (make-soap-basic-type) 0) 'soap-sample-value
        'soap-sample-value-for-basic-type)
 
+  (put (aref (make-soap-simple-type) 0) 'soap-sample-value
+       'soap-sample-value-for-simple-type)
+
   (put (aref (make-soap-sequence-type) 0) 'soap-sample-value
        'soap-sample-value-for-seqence-type)
 
@@ -204,6 +216,16 @@ entire WSDL can be inspected."
   (insert "\nSample value\n")
   (pp (soap-sample-value basic-type) (current-buffer)))
 
+(defun soap-inspect-simple-type (simple-type)
+  "Insert information about SIMPLE-TYPE into the current buffer"
+  (insert "Simple type: " (soap-element-fq-name simple-type) "\n")
+  (insert "Base: " (symbol-name (soap-basic-type-kind simple-type)) "\n")
+  (let ((enumeration (soap-simple-type-enumeration simple-type)))
+    (when (> (length enumeration) 1)
+      (insert "Valid values: ")
+      (dolist (e enumeration)
+        (insert "\"" e "\" ")))))
+
 (defun soap-inspect-sequence-type (sequence)
   "Insert information about SEQUENCE into the current buffer."
   (insert "Sequence type: " (soap-element-fq-name sequence) "\n")
@@ -331,6 +353,9 @@ entire WSDL can be inspected."
   (put (aref (make-soap-basic-type) 0) 'soap-inspect
        'soap-inspect-basic-type)
 
+  (put (aref (make-soap-simple-type) 0) 'soap-inspect
+       'soap-inspect-simple-type)
+
   (put (aref (make-soap-sequence-type) 0) 'soap-inspect
        'soap-inspect-sequence-type)
 
index 3c94e7d1b2245ee0f2b01b8a2a119250674f9466..306376f8af225c37d75655a0237d2f79a90e9f0e 100644 (file)
@@ -343,7 +343,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
 ;; could get a wrapper hook, or defer to open-network-stream-function.
 
 (defvar socks-override-functions nil
-  "*Whether to overwrite the open-network-stream function with the SOCKSified
+  "Whether to overwrite the open-network-stream function with the SOCKSified
 version.")
 
 (require 'network-stream)
@@ -480,7 +480,7 @@ version.")
 \f
 ;; Replacement functions for open-network-stream, etc.
 (defvar socks-noproxy nil
-  "*List of regexps matching hosts that we should not socksify connections to")
+  "List of regexps matching hosts that we should not socksify connections to")
 
 (defun socks-find-route (host service)
   (let ((route socks-server)
@@ -626,7 +626,7 @@ version.")
 
 \f
 (defcustom socks-nslookup-program "nslookup"
-  "*If non-NIL then a string naming the nslookup program."
+  "If non-NIL then a string naming the nslookup program."
   :type '(choice (const :tag "None" :value nil) string)
   :group 'socks)
 
index d232095444bdb3087893492f79dedeac5add3bb6..75d178e3225371a6e4658c511206808da9a501e6 100644 (file)
@@ -231,8 +231,7 @@ Fourth arg PORT is an integer specifying a port to connect to."
                 ?h host
                 ?p (if (integerp port)
                        (int-to-string port)
-                     port))))
-             response)
+                     port)))))
          (message "Opening TLS connection with `%s'..." formatted-cmd)
          (setq process (start-process
                         name buffer shell-file-name shell-command-switch
index d222dd1011d70098ea16d98047af7e250f460c10..fe5eb0049d089c82a1a8272303842237d2d329a5 100644 (file)
@@ -328,7 +328,8 @@ KEY identifies the connection, it is either a process or a vector."
               (not (zerop (hash-table-count tramp-cache-data)))
               tramp-cache-data-changed
               (stringp tramp-persistency-file-name))
-      (let ((cache (copy-hash-table tramp-cache-data)))
+      (let ((cache (copy-hash-table tramp-cache-data))
+           print-length print-level)
        ;; Remove temporary data.  If there is the key "login-as", we
        ;; don't save either, because all other properties might
        ;; depend on the login name, and we want to give the
index e0d15eb85f6779137c96340b76da0861a27b0085..06aae1f6af2729c92a9ba77a9c90c9d88c1f0f87 100644 (file)
@@ -89,7 +89,9 @@ When called interactively, a Tramp connection has to be selected."
     (tramp-flush-directory-property vec "")
 
     ;; Flush connection cache.
-    (tramp-flush-connection-property (tramp-get-connection-process vec))
+    (when (processp (tramp-get-connection-process vec))
+      (delete-process (tramp-get-connection-process vec))
+      (tramp-flush-connection-property (tramp-get-connection-process vec)))
     (tramp-flush-connection-property vec)
 
     ;; Remove buffers.
@@ -293,8 +295,9 @@ buffer in your bug report.
   ;; Dump load-path shadows.
   (insert "\nload-path shadows:\n==================\n")
   (ignore-errors
-    (mapc (lambda (x) (when (string-match "tramp" x) (insert x "\n")))
-         (split-string (list-load-path-shadows t) "\n")))
+    (mapc
+     (lambda (x) (when (string-match "tramp" x) (insert x "\n")))
+     (split-string (tramp-compat-funcall 'list-load-path-shadows t) "\n")))
 
   ;; Append buffers only when we are in message mode.
   (when (and
index 2aea87e66ed5138b73ca1ca0714739b87411502e..c3552ae023b82f8ee08174b38a95fa74073525e3 100644 (file)
@@ -29,8 +29,6 @@
 
 ;;; Code:
 
-(require 'tramp-loaddefs)
-
 (eval-when-compile
 
   ;; Pacify byte-compiler.
 
 (eval-and-compile
 
+  ;; Some packages must be required for XEmacs, because we compile
+  ;; with -no-autoloads.
+  (when (featurep 'xemacs)
+    (require 'cus-edit)
+    (require 'env)
+    (require 'executable)
+    (require 'outline)
+    (require 'passwd)
+    (require 'pp)
+    (require 'regexp-opt))
+
   (require 'advice)
   (require 'custom)
   (require 'format-spec)
   (require 'shell)
 
+  (require 'tramp-loaddefs)
+
   ;; As long as password.el is not part of (X)Emacs, it shouldn't be
   ;; mandatory.
   (if (featurep 'xemacs)
@@ -61,7 +72,8 @@
     (require 'timer))
 
   ;; We check whether `start-file-process' is bound.
-  (unless (fboundp 'start-file-process)
+  ;; Note: we deactivate this.  There are problems, at least in SXEmacs.
+  (unless t;(fboundp 'start-file-process)
 
     ;; tramp-util offers integration into other (X)Emacs packages like
     ;; compile.el, gud.el etc.  Not necessary in Emacs 23.
     (defalias 'file-remote-p
       (lambda (file &optional identification connected)
        (when (tramp-tramp-file-p file)
-         (tramp-file-name-handler
+         (tramp-compat-funcall
+          'tramp-file-name-handler
           'file-remote-p file identification connected)))))
 
   ;; `process-file' does not exist in XEmacs.
     (defalias 'set-file-times
       (lambda (filename &optional time)
        (when (tramp-tramp-file-p filename)
-         (tramp-file-name-handler
-          'set-file-times filename time)))))
+         (tramp-compat-funcall
+          'tramp-file-name-handler 'set-file-times filename time)))))
 
   ;; We currently use "[" and "]" in the filename format for IPv6
   ;; hosts of GNU Emacs.  This means that Emacs wants to expand
     "Display MESSAGE temporarily if non-nil while BODY is evaluated."
     `(progn ,@body)))
 
+;; `condition-case-unless-debug' is introduced with Emacs 24.
+(if (fboundp 'condition-case-unless-debug)
+    (defalias 'tramp-compat-condition-case-unless-debug
+      'condition-case-unless-debug)
+  (defmacro tramp-compat-condition-case-unless-debug
+    (var bodyform &rest handlers)
+  "Like `condition-case' except that it does not catch anything when debugging."
+    (declare (debug condition-case) (indent 2))
+    (let ((bodysym (make-symbol "body")))
+      `(let ((,bodysym (lambda () ,bodyform)))
+        (if debug-on-error
+            (funcall ,bodysym)
+          (condition-case ,var
+              (funcall ,bodysym)
+            ,@handlers))))))
+
 ;; `font-lock-add-keywords' does not exist in XEmacs.
 (defun tramp-compat-font-lock-add-keywords (mode keywords &optional how)
   "Add highlighting KEYWORDS for MODE."
   "Return name of directory for temporary files (compat function).
 For Emacs, this is the variable `temporary-file-directory', for XEmacs
 this is the function `temp-directory'."
-  (cond
-   ((boundp 'temporary-file-directory) (symbol-value 'temporary-file-directory))
-   ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory))
-   ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
-    (file-name-as-directory (getenv "TEMP")))
-   ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
-    (file-name-as-directory (getenv "TMP")))
-   ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
-    (file-name-as-directory (getenv "TMPDIR")))
-   ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
-   (t (message (concat "Neither `temporary-file-directory' nor "
-                      "`temp-directory' is defined -- using /tmp."))
-      (file-name-as-directory "/tmp"))))
+  (let (file-name-handler-alist)
+    ;; We must return a local directory.  If it is remote, we could
+    ;; run into an infloop.
+    (cond
+     ((and (boundp 'temporary-file-directory)
+          (eval (car (get 'temporary-file-directory 'standard-value)))))
+     ((fboundp 'temp-directory) (tramp-compat-funcall 'temp-directory))
+     ((let ((d (getenv "TEMP"))) (and d (file-directory-p d)))
+      (file-name-as-directory (getenv "TEMP")))
+     ((let ((d (getenv "TMP"))) (and d (file-directory-p d)))
+      (file-name-as-directory (getenv "TMP")))
+     ((let ((d (getenv "TMPDIR"))) (and d (file-directory-p d)))
+      (file-name-as-directory (getenv "TMPDIR")))
+     ((file-exists-p "c:/temp") (file-name-as-directory "c:/temp"))
+     (t (message (concat "Neither `temporary-file-directory' nor "
+                        "`temp-directory' is defined -- using /tmp."))
+       (file-name-as-directory "/tmp")))))
 
 ;; `make-temp-file' exists in Emacs only.  On XEmacs, we use our own
 ;; implementation with `make-temp-name', creating the temporary file
@@ -282,7 +315,8 @@ Not actually used.  Use `(format \"%o\" i)' instead?"
    ((or (null id-format) (eq id-format 'integer))
     (file-attributes filename))
    ((tramp-tramp-file-p filename)
-    (tramp-file-name-handler 'file-attributes filename id-format))
+    (tramp-compat-funcall
+     'tramp-file-name-handler 'file-attributes filename id-format))
    (t (condition-case nil
          (tramp-compat-funcall 'file-attributes filename id-format)
        (wrong-number-of-arguments (file-attributes filename))))))
@@ -308,43 +342,49 @@ Not actually used.  Use `(format \"%o\" i)' instead?"
 ;; `copy-directory' is a new function in Emacs 23.2.  Implementation
 ;; is taken from there.
 (defun tramp-compat-copy-directory
-  (directory newname &optional keep-time parents)
+  (directory newname &optional keep-time parents copy-contents)
   "Make a copy of DIRECTORY (compat function)."
-  (if (fboundp 'copy-directory)
-      (tramp-compat-funcall 'copy-directory directory newname keep-time parents)
-
-    ;; If `default-directory' is a remote directory, make sure we find
-    ;; its `copy-directory' handler.
-    (let ((handler (or (find-file-name-handler directory 'copy-directory)
-                      (find-file-name-handler newname 'copy-directory))))
-      (if handler
-         (funcall handler 'copy-directory directory newname keep-time parents)
-
-       ;; Compute target name.
-       (setq directory (directory-file-name (expand-file-name directory))
-             newname   (directory-file-name (expand-file-name newname)))
-       (if (and (file-directory-p newname)
-                (not (string-equal (file-name-nondirectory directory)
-                                   (file-name-nondirectory newname))))
-           (setq newname
-                 (expand-file-name
-                  (file-name-nondirectory directory) newname)))
-       (if (not (file-directory-p newname)) (make-directory newname parents))
-
-       ;; Copy recursively.
-       (mapc
-        (lambda (file)
-          (if (file-directory-p file)
-              (tramp-compat-copy-directory file newname keep-time parents)
-            (copy-file file newname t keep-time)))
-        ;; We do not want to delete "." and "..".
-        (directory-files
-         directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))
-
-       ;; Set directory attributes.
-       (set-file-modes newname (file-modes directory))
-       (if keep-time
-           (set-file-times newname (nth 5 (file-attributes directory))))))))
+  (condition-case nil
+      (tramp-compat-funcall
+       'copy-directory directory newname keep-time parents copy-contents)
+
+    ;; `copy-directory' is either not implemented, or it does not
+    ;; support the the COPY-CONTENTS flag.  For the time being, we
+    ;; ignore COPY-CONTENTS as well.
+
+    (error
+     ;; If `default-directory' is a remote directory, make sure we
+     ;; find its `copy-directory' handler.
+     (let ((handler (or (find-file-name-handler directory 'copy-directory)
+                       (find-file-name-handler newname 'copy-directory))))
+       (if handler
+          (funcall handler 'copy-directory directory newname keep-time parents)
+
+        ;; Compute target name.
+        (setq directory (directory-file-name (expand-file-name directory))
+              newname   (directory-file-name (expand-file-name newname)))
+        (if (and (file-directory-p newname)
+                 (not (string-equal (file-name-nondirectory directory)
+                                    (file-name-nondirectory newname))))
+            (setq newname
+                  (expand-file-name
+                   (file-name-nondirectory directory) newname)))
+        (if (not (file-directory-p newname)) (make-directory newname parents))
+
+        ;; Copy recursively.
+        (mapc
+         (lambda (file)
+           (if (file-directory-p file)
+               (tramp-compat-copy-directory file newname keep-time parents)
+             (copy-file file newname t keep-time)))
+         ;; We do not want to delete "." and "..".
+         (directory-files
+          directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))
+
+        ;; Set directory attributes.
+        (set-file-modes newname (file-modes directory))
+        (if keep-time
+            (set-file-times newname (nth 5 (file-attributes directory)))))))))
 
 ;; TRASH has been introduced with Emacs 24.1.
 (defun tramp-compat-delete-file (filename &optional trash)
index 4b5b08cf7e1cadcd81aa226f791a74c92daa377e..44ae176c6c902378398b6727f3530a42fa0bbc02 100644 (file)
@@ -49,9 +49,8 @@
 (defun tramp-disable-ange-ftp ()
   "Turn Ange-FTP off.
 This is useful for unified remoting.  See
-`tramp-file-name-structure-unified' and
-`tramp-file-name-structure-separate' for details.  Requests suitable
-for Ange-FTP will be forwarded to Ange-FTP.  Also see the variables
+`tramp-file-name-structure' for details.  Requests suitable for
+Ange-FTP will be forwarded to Ange-FTP.  Also see the variables
 `tramp-ftp-method', `tramp-default-method', and
 `tramp-default-method-alist'.
 
@@ -99,7 +98,7 @@ present for backward compatibility."
 ;; Define FTP method ...
 ;;;###tramp-autoload
 (defconst tramp-ftp-method "ftp"
-  "*When this method name is used, forward all calls to Ange-FTP.")
+  "When this method name is used, forward all calls to Ange-FTP.")
 
 ;; ... and add it to the method list.
 ;;;###tramp-autoload
@@ -204,8 +203,8 @@ pass to the OPERATION."
 ;;;###tramp-autoload
 (defsubst tramp-ftp-file-name-p (filename)
   "Check if it's a filename that should be forwarded to Ange-FTP."
-  (let ((v (tramp-dissect-file-name filename)))
-    (string= (tramp-file-name-method v) tramp-ftp-method)))
+  (string= (tramp-file-name-method (tramp-dissect-file-name filename))
+          tramp-ftp-method))
 
 ;;;###tramp-autoload
 (unless (featurep 'xemacs)
index 6f3c5e04236f4b814c7cf5b68a55be35ca0c5803..f78122ec704a48ae852fd7bbdf7691ac6c21e378 100644 (file)
 
 ;; D-Bus support in the Emacs core can be disabled with configuration
 ;; option "--without-dbus".  Declare used subroutines and variables.
-(declare-function dbus-call-method "dbusbind.c")
-(declare-function dbus-call-method-asynchronously "dbusbind.c")
 (declare-function dbus-get-unique-name "dbusbind.c")
-(declare-function dbus-register-method "dbusbind.c")
-(declare-function dbus-register-signal "dbusbind.c")
 
 ;; Pacify byte-compiler
 (eval-when-compile
 
 ;;;###tramp-autoload
 (defcustom tramp-gvfs-methods '("dav" "davs" "obex" "synce")
-  "*List of methods for remote files, accessed with GVFS."
+  "List of methods for remote files, accessed with GVFS."
   :group 'tramp
   :version "23.2"
   :type '(repeat (choice (const "dav")
 (add-to-list 'tramp-default-user-alist '("\\`synce\\'" nil nil))
 
 (defcustom tramp-gvfs-zeroconf-domain "local"
-  "*Zeroconf domain to be used for discovering services, like host names."
+  "Zeroconf domain to be used for discovering services, like host names."
   :group 'tramp
   :version "23.2"
   :type 'string)
@@ -625,7 +621,7 @@ is no information where to trace the message.")
       ;; If there is a default location, expand tilde.
       (when (string-match "\\`\\(~\\)\\(/\\|\\'\\)" localname)
        (save-match-data
-         (tramp-gvfs-maybe-open-connection (vector method user host "/")))
+         (tramp-gvfs-maybe-open-connection (vector method user host "/" hop)))
        (setq localname
              (replace-match
               (tramp-get-file-property  v "/" "default-location" "~")
index de42c402a63604b01408ab5e080c9ab6581c4107..3aa25e2caa6426e9cdfbeb1e3a014b6a2dacc91b 100644 (file)
 ;; Define HTTP tunnel method ...
 ;;;###tramp-autoload
 (defconst tramp-gw-tunnel-method "tunnel"
-  "*Method to connect HTTP gateways.")
+  "Method to connect HTTP gateways.")
 
 ;; ... and port.
 (defconst tramp-gw-default-tunnel-port 8080
-  "*Default port for HTTP gateways.")
+  "Default port for HTTP gateways.")
 
 ;; Define SOCKS method ...
 ;;;###tramp-autoload
 (defconst tramp-gw-socks-method "socks"
-  "*Method to connect SOCKS servers.")
+  "Method to connect SOCKS servers.")
 
 ;; ... and port.
 (defconst tramp-gw-default-socks-port 1080
-  "*Default port for SOCKS servers.")
+  "Default port for SOCKS servers.")
 
 ;; Autoload the socks library.  It is used only when we access a SOCKS server.
 (autoload 'socks-open-network-stream "socks")
@@ -154,7 +154,7 @@ instead of the host name declared in TARGET-VEC."
               (memq (process-status tramp-gw-aux-proc) '(listen)))
     (let ((aux-vec
           (vector "aux" (tramp-file-name-user gw-vec)
-                  (tramp-file-name-host gw-vec) nil)))
+                  (tramp-file-name-host gw-vec) nil nil)))
       (setq tramp-gw-aux-proc
            (make-network-process
             :name (tramp-buffer-name aux-vec) :buffer nil :host 'local
index 1c23a6f20f32f353368a92356494afd83a829491..afb25509e4f7649a651f6472342631e8d9616e92 100644 (file)
@@ -43,7 +43,7 @@
 ;; `dired-insert-set-properties'.
 
 (defcustom tramp-inline-compress-start-size 4096
-  "*The minimum size of compressing where inline transfer.
+  "The minimum size of compressing where inline transfer.
 When inline transfer, compress transferred data of file
 whose size is this value or above (up to `tramp-copy-size-limit').
 If it is nil, no compression at all will be applied."
@@ -51,14 +51,15 @@ If it is nil, no compression at all will be applied."
   :type '(choice (const nil) integer))
 
 (defcustom tramp-copy-size-limit 10240
-  "*The maximum file size where inline copying is preferred over an out-of-the-band copy.
-If it is nil, inline out-of-the-band copy will be used without a check."
+  "The maximum file size where inline copying is preferred over an \
+out-of-the-band copy.
+If it is nil, out-of-the-band copy will be used without a check."
   :group 'tramp
   :type '(choice (const nil) integer))
 
 ;;;###tramp-autoload
 (defcustom tramp-terminal-type "dumb"
-  "*Value of TERM environment variable for logging in to remote host.
+  "Value of TERM environment variable for logging in to remote host.
 Because Tramp wants to parse the output of the remote shell, it is easily
 confused by ANSI color escape sequences and suchlike.  Often, shell init
 files conditionalize this setup based on the TERM environment variable."
@@ -347,7 +348,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
     (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
     (tramp-remote-shell         "/bin/sh")
     (tramp-remote-shell-args    ("-c"))
-    (tramp-password-end-of-line "xy") ;see docstring for "xy"
     (tramp-default-port         22)))
 ;;;###tramp-autoload
 (add-to-list 'tramp-methods
@@ -356,7 +356,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
     (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-1" "-ssh") ("%h")))
     (tramp-remote-shell         "/bin/sh")
     (tramp-remote-shell-args    ("-c"))
-    (tramp-password-end-of-line "xy") ;see docstring for "xy"
     (tramp-default-port         22)))
 ;;;###tramp-autoload
 (add-to-list 'tramp-methods
@@ -384,7 +383,6 @@ detected as prompt when being sent on echoing hosts, therefore.")
                                 ("-q") ("-r")))
     (tramp-copy-keep-date       t)
     (tramp-copy-recursive       t)
-    (tramp-password-end-of-line "xy") ;see docstring for "xy"
     (tramp-default-port         22)))
 ;;;###tramp-autoload
 (add-to-list 'tramp-methods
@@ -397,8 +395,7 @@ detected as prompt when being sent on echoing hosts, therefore.")
     (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
                                 ("-q") ("-r")))
     (tramp-copy-keep-date       t)
-    (tramp-copy-recursive       t)
-    (tramp-password-end-of-line "xy"))) ;see docstring for "xy"
+    (tramp-copy-recursive       t)))
 ;;;###tramp-autoload
 (add-to-list 'tramp-methods
   '("fcp"
@@ -462,9 +459,11 @@ detected as prompt when being sent on echoing hosts, therefore.")
 
 ;;;###tramp-autoload
 (defconst tramp-completion-function-alist-putty
-  '((tramp-parse-putty
-     "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions"))
-  "Default list of (FUNCTION REGISTRY) pairs to be examined for putty methods.")
+  `((tramp-parse-putty
+     ,(if (memq system-type '(windows-nt))
+         "HKEY_CURRENT_USER\\Software\\SimonTatham\\PuTTY\\Sessions"
+       "~/.putty/sessions")))
+  "Default list of (FUNCTION REGISTRY) pairs to be examined for putty sessions.")
 
 ;;;###tramp-autoload
 (eval-after-load 'tramp
@@ -513,10 +512,11 @@ detected as prompt when being sent on echoing hosts, therefore.")
 ;; IRIX64: /usr/bin
 ;;;###tramp-autoload
 (defcustom tramp-remote-path
-  '(tramp-default-remote-path "/bin" "/usr/bin" "/usr/sbin" "/usr/local/bin"
-    "/local/bin" "/local/freeware/bin" "/local/gnu/bin"
-    "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin")
-  "*List of directories to search for executables on remote host.
+  '(tramp-default-remote-path "/bin" "/usr/bin" "/usr/sbin"
+    "/usr/local/bin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin"
+    "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin"
+    "/opt/bin" "/opt/sbin" "/opt/local/bin")
+  "List of directories to search for executables on remote host.
 For every remote host, this variable will be set buffer local,
 keeping the list of existing directories on that host.
 
@@ -545,8 +545,7 @@ as given in your `~/.profile'."
     ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
     "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=\"\""
     "autocorrect=" "correct=")
-
-  "*List of environment variables to be set on the remote host.
+  "List of environment variables to be set on the remote host.
 
 Each element should be a string of the form ENVVARNAME=VALUE.  An
 entry ENVVARNAME= disables the corresponding environment variable,
@@ -558,7 +557,7 @@ not be set here. Instead, it should be set via `tramp-remote-path'."
   :type '(repeat string))
 
 (defcustom tramp-sh-extra-args '(("/bash\\'" . "-norc -noprofile"))
-  "*Alist specifying extra arguments to pass to the remote shell.
+  "Alist specifying extra arguments to pass to the remote shell.
 Entries are (REGEXP . ARGS) where REGEXP is a regular expression
 matching the shell file name and ARGS is a string specifying the
 arguments.
@@ -1180,9 +1179,6 @@ target of the symlink differ."
            (tramp-get-file-exists-command v)
            (tramp-shell-quote-argument localname)))))))
 
-;; CCC: This should check for an error condition and signal failure
-;;      when something goes wrong.
-;; Daniel Pittman <daniel@danann.net>
 (defun tramp-sh-handle-file-attributes (filename &optional id-format)
   "Like `file-attributes' for Tramp files."
   (unless id-format (setq id-format 'integer))
@@ -1318,8 +1314,8 @@ target of the symlink differ."
     (tramp-get-test-command vec)
     (tramp-shell-quote-argument localname)
     (tramp-get-remote-stat vec)
-    (if (eq id-format 'integer) "%u" "\"%U\"")
-    (if (eq id-format 'integer) "%g" "\"%G\"")
+    (if (eq id-format 'integer) "%ue0" "\"%U\"")
+    (if (eq id-format 'integer) "%ge0" "\"%G\"")
     (tramp-shell-quote-argument localname))))
 
 (defun tramp-sh-handle-set-visited-file-modtime (&optional time-list)
@@ -1696,14 +1692,15 @@ and gid of the corresponding user is taken.  Both parameters must be integers."
      ;; "-"; this would confuse xargs.  "ls -aQ" might be a solution,
      ;; but it does not work on all remote systems.  Therefore, we
      ;; quote the filenames via sed.
-     "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | xargs "
-     "%s -c '(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'); "
-     "echo \")\"")
+     "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | "
+     "xargs %s -c "
+     "'(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'"
+     " 2>/dev/null); echo \")\"")
     (tramp-shell-quote-argument localname)
     (tramp-get-ls-command vec)
     (tramp-get-remote-stat vec)
-    (if (eq id-format 'integer) "%u" "\"%U\"")
-    (if (eq id-format 'integer) "%g" "\"%G\""))))
+    (if (eq id-format 'integer) "%ue0" "\"%U\"")
+    (if (eq id-format 'integer) "%ge0" "\"%G\""))))
 
 ;; This function should return "foo/" for directories and "bar" for
 ;; files.
@@ -2394,7 +2391,7 @@ The method used must be an out-of-band method."
                   p v nil tramp-actions-copy-out-of-band)))
 
            ;; Reset the transfer process properties.
-           (tramp-message orig-vec 6 "%s" (buffer-string))
+           (tramp-message orig-vec 6 "\n%s" (buffer-string))
            (tramp-set-connection-property v "process-name" nil)
            (tramp-set-connection-property v "process-buffer" nil)))
 
@@ -2457,11 +2454,11 @@ The method used must be an out-of-band method."
   "Recursively delete the directory given.
 This is like `dired-recursive-delete-directory' for Tramp files."
   (with-parsed-tramp-file-name filename nil
-    ;; Run a shell command 'rm -r <localname>'
+    ;; Run a shell command 'rm -r <localname>'.
     ;; Code shamelessly stolen from the dired implementation and, um, hacked :)
     (unless (file-exists-p filename)
       (tramp-error v 'file-error "No such directory: %s" filename))
-    ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>)
+    ;; Which is better, -r or -R? (-r works for me <daniel@danann.net>).
     (tramp-send-command
      v
      (format "rm -rf %s" (tramp-shell-quote-argument localname))
@@ -2699,7 +2696,8 @@ the result will be a local, non-Tramp, filename."
         method user host
         (tramp-drop-volume-letter
          (tramp-run-real-handler
-          'expand-file-name (list localname))))))))
+          'expand-file-name (list localname)))
+        hop)))))
 
 ;;; Remote commands:
 
@@ -3093,22 +3091,25 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
           'write-region
           (list start end localname append 'no-message lockname confirm))
 
-       (let ((modes (save-excursion (tramp-default-file-modes filename)))
-             ;; We use this to save the value of
-             ;; `last-coding-system-used' after writing the tmp
-             ;; file.  At the end of the function, we set
-             ;; `last-coding-system-used' to this saved value.  This
-             ;; way, any intermediary coding systems used while
-             ;; talking to the remote shell or suchlike won't hose
-             ;; this variable.  This approach was snarfed from
-             ;; ange-ftp.el.
-             coding-system-used
-             ;; Write region into a tmp file.  This isn't really
-             ;; needed if we use an encoding function, but currently
-             ;; we use it always because this makes the logic
-             ;; simpler.
-             (tmpfile (or tramp-temp-buffer-file-name
-                          (tramp-compat-make-temp-file filename))))
+       (let* ((modes (save-excursion (tramp-default-file-modes filename)))
+              ;; We use this to save the value of
+              ;; `last-coding-system-used' after writing the tmp
+              ;; file.  At the end of the function, we set
+              ;; `last-coding-system-used' to this saved value.  This
+              ;; way, any intermediary coding systems used while
+              ;; talking to the remote shell or suchlike won't hose
+              ;; this variable.  This approach was snarfed from
+              ;; ange-ftp.el.
+              coding-system-used
+              ;; Write region into a tmp file.  This isn't really
+              ;; needed if we use an encoding function, but currently
+              ;; we use it always because this makes the logic
+              ;; simpler.  We must also set `temporary-file-directory',
+              ;; because it could point to a remote directory.
+              (temporary-file-directory
+               (tramp-compat-temporary-file-directory))
+              (tmpfile (or tramp-temp-buffer-file-name
+                           (tramp-compat-make-temp-file filename))))
 
          ;; If `append' is non-nil, we copy the file locally, and let
          ;; the native `write-region' implementation do the job.
@@ -3284,14 +3285,14 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
       (let (last-coding-system-used (need-chown t))
        ;; Set file modification time.
        (when (or (eq visit t) (stringp visit))
-          (let ((file-attr (file-attributes filename)))
+          (let ((file-attr (tramp-compat-file-attributes filename 'integer)))
             (set-visited-file-modtime
              ;; We must pass modtime explicitly, because filename can
              ;; be different from (buffer-file-name), f.e. if
              ;; `file-precious-flag' is set.
              (nth 5 file-attr))
-            (when (and (eq (nth 2 file-attr) uid)
-                       (eq (nth 3 file-attr) gid))
+            (when (and (= (nth 2 file-attr) uid)
+                       (= (nth 3 file-attr) gid))
               (setq need-chown nil))))
 
        ;; Set the ownership.
@@ -3332,7 +3333,7 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file."
               `((,tramp-file-name-regexp . tramp-vc-file-name-handler))))
 
          ;; Here we collect only file names, which need an operation.
-         (tramp-run-real-handler 'vc-registered (list file))
+         (ignore-errors (tramp-run-real-handler 'vc-registered (list file)))
          (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
 
          ;; Send just one command, in order to fill the cache.
@@ -3400,10 +3401,12 @@ Fall back to normal file name handler if no Tramp handler exists."
         ((and fn (memq operation '(file-exists-p file-readable-p)))
          (add-to-list 'tramp-vc-registered-file-names localname 'append)
          nil)
+        ;; `process-file' and `start-file-process' shall be ignored.
+        ((and fn (eq operation 'process-file) 0))
+        ((and fn (eq operation 'start-file-process) nil))
         ;; Tramp file name handlers like `expand-file-name'.  They
         ;; must still work.
-        (fn
-         (save-match-data (apply (cdr fn) args)))
+        (fn (save-match-data (apply (cdr fn) args)))
         ;; Default file name handlers, we don't care.
         (t (tramp-run-real-handler operation args)))))))
 
@@ -3606,37 +3609,48 @@ file exists and nonzero exit status otherwise."
 
 (defun tramp-find-shell (vec)
   "Opens a shell on the remote host which groks tilde expansion."
-  (unless (tramp-get-connection-property vec "remote-shell" nil)
-    (let (shell)
+  (with-connection-property vec "remote-shell"
+    (let ((shell (tramp-get-method-parameter
+                 (tramp-file-name-method vec) 'tramp-remote-shell)))
       (with-current-buffer (tramp-get-buffer vec)
+       ;; CCC: "root" does not exist always, see QNAP 459.  Which
+       ;; check could we apply instead?
        (tramp-send-command vec "echo ~root" t)
-       (cond
-        ((or (string-match "^~root$" (buffer-string))
-             ;; The default shell (ksh93) of OpenSolaris and Solaris
-             ;; is buggy.  We've got reports for "SunOS 5.10" and
-             ;; "SunOS 5.11" so far.
-             (string-match (regexp-opt '("SunOS 5.10" "SunOS 5.11"))
-                           (tramp-get-connection-property vec "uname" "")))
-         (setq shell
-               (or (tramp-find-executable
-                    vec "bash" (tramp-get-remote-path vec) t t)
-                   (tramp-find-executable
-                    vec "ksh" (tramp-get-remote-path vec) t t)))
-         (unless shell
-           (tramp-error
-            vec 'file-error
-            "Couldn't find a shell which groks tilde expansion"))
-         (tramp-message
-          vec 5 "Starting remote shell `%s' for tilde expansion"
-          (tramp-set-connection-property vec "remote-shell" shell))
-         (tramp-open-shell vec shell))
-
-        (t (tramp-message
-            vec 5 "Remote `%s' groks tilde expansion, good"
-            (tramp-set-connection-property
-             vec "remote-shell"
-             (tramp-get-method-parameter
-              (tramp-file-name-method vec) 'tramp-remote-shell)))))))))
+       (when (or (string-match "^~root$" (buffer-string))
+                 ;; The default shell (ksh93) of OpenSolaris and
+                 ;; Solaris is buggy.  We've got reports for "SunOS
+                 ;; 5.10" and "SunOS 5.11" so far.
+                 (string-match (regexp-opt '("SunOS 5.10" "SunOS 5.11"))
+                               (tramp-get-connection-property vec "uname" "")))
+         (if (setq shell
+                   (or (tramp-find-executable
+                        vec "bash" (tramp-get-remote-path vec) t t)
+                       (tramp-find-executable
+                        vec "ksh" (tramp-get-remote-path vec) t t)))
+             (progn
+               (tramp-message
+                vec 5 "Starting remote shell `%s' for tilde expansion" shell)
+               (tramp-open-shell vec shell))
+
+           ;; Maybe it works at least for some other commands.
+           (setq shell
+                 (tramp-get-method-parameter
+                  (tramp-file-name-method vec) 'tramp-remote-shell))
+           (tramp-message
+            vec 2
+            (concat
+             "Couldn't find a remote shell which groks tilde expansion, "
+             "using `%s'")
+            shell)))
+
+       ;; Busyboxes tend to behave strange.  We check for the existence.
+       (with-connection-property vec "busybox"
+         (tramp-send-command vec (format "%s --version" shell) t)
+         (let ((case-fold-search t))
+           (and (string-match "busybox" (buffer-string)) t)))
+
+       ;; Return the shell.
+       shell))))
 
 ;; Utility functions.
 
@@ -3744,21 +3758,12 @@ process to set up.  VEC specifies the connection."
          vec "uname"
          (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
     (when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
-      (with-current-buffer (tramp-get-debug-buffer vec)
-       ;; Keep the debug buffer.
-       (rename-buffer
-        (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
-       (tramp-cleanup-connection vec)
-       (if (= (point-min) (point-max))
-           (kill-buffer nil)
-         (rename-buffer (tramp-debug-buffer-name vec) 'unique))
-       ;; We call `tramp-get-buffer' in order to keep the debug buffer.
-       (tramp-get-buffer vec)
-       (tramp-message
-        vec 3
-        "Connection reset, because remote host changed from `%s' to `%s'"
-        old-uname new-uname)
-       (throw 'uname-changed (tramp-maybe-open-connection vec)))))
+      (tramp-cleanup vec)
+      (tramp-message
+       vec 3
+       "Connection reset, because remote host changed from `%s' to `%s'"
+       old-uname new-uname)
+      (throw 'uname-changed (tramp-maybe-open-connection vec))))
 
   ;; Check whether the remote host suffers from buggy
   ;; `send-process-string'.  This is known for FreeBSD (see comment in
@@ -3795,17 +3800,6 @@ process to set up.  VEC specifies the connection."
   ;; Disable unexpected output.
   (tramp-send-command vec "mesg n; biff n" t)
 
-  ;; Busyboxes tend to behave strange.  We check for the existence.
-  (with-connection-property vec "busybox"
-    (tramp-send-command
-     vec
-     (format
-      "%s --version" (tramp-get-connection-property vec "remote-shell" "echo"))
-     t)
-    (with-current-buffer (process-buffer proc)
-      (let ((case-fold-search t))
-       (and (string-match "busybox" (buffer-string)) t))))
-
   ;; IRIX64 bash expands "!" even when in single quotes.  This
   ;; destroys our shell functions, we must disable it.  See
   ;; <http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>.
@@ -3899,7 +3893,7 @@ with the encoded or decoded results, respectively.")
     (b64 "recode data..base64" "recode base64..data")
     (b64 tramp-perl-encode-with-module tramp-perl-decode-with-module)
     (b64 tramp-perl-encode tramp-perl-decode)
-    (uu  "uuencode xxx" "uudecode -o /dev/stdout")
+    (uu  "uuencode xxx" "uudecode -o /dev/stdout" "test -c /dev/stdout")
     (uu  "uuencode xxx" "uudecode -o -")
     (uu  "uuencode xxx" "uudecode -p")
     (uu  "uuencode xxx" tramp-uudecode)
@@ -3909,7 +3903,7 @@ with the encoded or decoded results, respectively.")
   "List of remote coding commands for inline transfer.
 Each item is a list that looks like this:
 
-\(FORMAT ENCODING DECODING\)
+\(FORMAT ENCODING DECODING [TEST]\)
 
 FORMAT is  symbol describing the encoding/decoding format.  It can be
 `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing.
@@ -3923,7 +3917,10 @@ input.
 
 If they are variables, this variable is a string containing a Perl
 implementation for this functionality.  This Perl program will be transferred
-to the remote host, and it is available as shell function with the same name.")
+to the remote host, and it is available as shell function with the same name.
+
+The optional TEST command can be used for further tests, whether
+ENCODING and DECODING are applicable.")
 
 (defun tramp-find-inline-encoding (vec)
   "Find an inline transfer encoding that works.
@@ -3932,7 +3929,8 @@ Goes through the list `tramp-local-coding-commands' and
   (save-excursion
     (let ((local-commands tramp-local-coding-commands)
          (magic "xyzzy")
-         loc-enc loc-dec rem-enc rem-dec litem ritem found)
+         (p (tramp-get-connection-process vec))
+         loc-enc loc-dec rem-enc rem-dec rem-test litem ritem found)
       (while (and local-commands (not found))
        (setq litem (pop local-commands))
        (catch 'wont-work-local
@@ -3965,6 +3963,13 @@ Goes through the list `tramp-local-coding-commands' and
                (when (equal format (nth 0 ritem))
                  (setq rem-enc (nth 1 ritem))
                  (setq rem-dec (nth 2 ritem))
+                 (setq rem-test (nth 3 ritem))
+                 ;; Check the remote test command if exists.
+                 (when (stringp rem-test)
+                   (tramp-message
+                    vec 5 "Checking remote test command `%s'" rem-test)
+                   (unless (tramp-send-command-and-check vec rem-test t)
+                     (throw 'wont-work-remote nil)))
                  ;; Check if remote encoding and decoding commands can be
                  ;; called remotely with null input and output.  This makes
                  ;; sure there are no syntax errors and the command is really
@@ -4016,15 +4021,16 @@ Goes through the list `tramp-local-coding-commands' and
        (tramp-error
         vec 'file-error "Couldn't find an inline transfer encoding"))
 
-      ;; Set connection properties.
+      ;; Set connection properties.  Since the commands are risky (due
+      ;; to output direction), we cache them in the process cache.
       (tramp-message vec 5 "Using local encoding `%s'" loc-enc)
-      (tramp-set-connection-property vec "local-encoding" loc-enc)
+      (tramp-set-connection-property p "local-encoding" loc-enc)
       (tramp-message vec 5 "Using local decoding `%s'" loc-dec)
-      (tramp-set-connection-property vec "local-decoding" loc-dec)
+      (tramp-set-connection-property p "local-decoding" loc-dec)
       (tramp-message vec 5 "Using remote encoding `%s'" rem-enc)
-      (tramp-set-connection-property vec "remote-encoding" rem-enc)
+      (tramp-set-connection-property p "remote-encoding" rem-enc)
       (tramp-message vec 5 "Using remote decoding `%s'" rem-dec)
-      (tramp-set-connection-property vec "remote-decoding" rem-dec))))
+      (tramp-set-connection-property p "remote-decoding" rem-dec))))
 
 (defun tramp-call-local-coding-command (cmd input output)
   "Call the local encoding or decoding command.
@@ -4062,8 +4068,8 @@ Goes through the list `tramp-inline-compress-commands'."
   (save-excursion
     (let ((commands tramp-inline-compress-commands)
          (magic "xyzzy")
-         item compress decompress
-         found)
+         (p (tramp-get-connection-process vec))
+         item compress decompress found)
       (while (and commands (not found))
        (catch 'next
          (setq item (pop commands)
@@ -4097,16 +4103,18 @@ Goes through the list `tramp-inline-compress-commands'."
       ;; Did we find something?
       (if found
          (progn
-           ;; Set connection properties.
+           ;; Set connection properties.  Since the commands are
+           ;; risky (due to output direction), we cache them in the
+           ;; process cache.
            (tramp-message
             vec 5 "Using inline transfer compress command `%s'" compress)
-           (tramp-set-connection-property vec "inline-compress" compress)
+           (tramp-set-connection-property p "inline-compress" compress)
            (tramp-message
             vec 5 "Using inline transfer decompress command `%s'" decompress)
-           (tramp-set-connection-property vec "inline-decompress" decompress))
+           (tramp-set-connection-property p "inline-decompress" decompress))
 
-       (tramp-set-connection-property vec "inline-compress" nil)
-       (tramp-set-connection-property vec "inline-decompress" nil)
+       (tramp-set-connection-property p "inline-compress" nil)
+       (tramp-set-connection-property p "inline-decompress" nil)
        (tramp-message
         vec 2 "Couldn't find an inline transfer compress command")))))
 
@@ -4114,18 +4122,43 @@ Goes through the list `tramp-inline-compress-commands'."
   "Expands VEC according to `tramp-default-proxies-alist'.
 Gateway hops are already opened."
   (let ((target-alist `(,vec))
-       (choices tramp-default-proxies-alist)
-       item proxy)
+       (hops (or (tramp-file-name-hop vec) ""))
+       (item vec)
+       choices proxy)
+
+    ;; Ad-hoc proxy definitions.
+    (dolist (proxy (reverse (split-string hops tramp-postfix-hop-regexp 'omit)))
+      (let ((user (tramp-file-name-user item))
+           (host (tramp-file-name-host item))
+           (proxy (concat
+                   tramp-prefix-format proxy tramp-postfix-host-format)))
+       (tramp-message
+        vec 5 "Add proxy (\"%s\" \"%s\" \"%s\")"
+        (and (stringp host) (regexp-quote host))
+        (and (stringp user) (regexp-quote user))
+        proxy)
+       ;; Add the hop.
+       (add-to-list
+        'tramp-default-proxies-alist
+        (list (and (stringp host) (regexp-quote host))
+              (and (stringp user) (regexp-quote user))
+              proxy))
+       (setq item (tramp-dissect-file-name proxy))))
+    ;; Save the new value.
+    (when (and hops tramp-save-ad-hoc-proxies)
+      (customize-save-variable
+       'tramp-default-proxies-alist tramp-default-proxies-alist))
 
     ;; Look for proxy hosts to be passed.
+    (setq choices tramp-default-proxies-alist)
     (while choices
       (setq item (pop choices)
            proxy (eval (nth 2 item)))
       (when (and
-            ;; host
+            ;; Host.
             (string-match (or (eval (nth 0 item)) "")
                           (or (tramp-file-name-host (car target-alist)) ""))
-            ;; user
+            ;; User.
             (string-match (or (eval (nth 1 item)) "")
                           (or (tramp-file-name-user (car target-alist)) "")))
        (if (null proxy)
@@ -4161,7 +4194,7 @@ Gateway hops are already opened."
         'target-alist
         (vector
          (tramp-file-name-method hop) (tramp-file-name-user hop)
-         (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil))
+         (tramp-compat-funcall 'tramp-gw-open-connection vec gw hop) nil nil))
        ;; For the password prompt, we need the correct values.
        ;; Therefore, we must remember the gateway vector.  But we
        ;; cannot do it as connection property, because it shouldn't
@@ -4209,6 +4242,9 @@ Gateway hops are already opened."
     ;; Result.
     target-alist))
 
+(defvar tramp-current-connection nil
+  "Last connection timestamp.")
+
 (defun tramp-maybe-open-connection (vec)
   "Maybe open a connection VEC.
 Does not do anything if a connection is already open, but re-opens the
@@ -4219,6 +4255,16 @@ connection if a previous connection has died for some reason."
          (process-environment (copy-sequence process-environment))
          (pos (with-current-buffer (tramp-get-connection-buffer vec) (point))))
 
+      ;; If Tramp opens the same connection within a short time frame,
+      ;; there is a problem.  We shall signal this.
+      (unless (or (and p (processp p) (memq (process-status p) '(run open)))
+                 (not (equal (butlast (append vec nil))
+                             (car tramp-current-connection)))
+                 (> (tramp-time-diff
+                     (current-time) (cdr tramp-current-connection))
+                    5))
+       (throw 'suppress 'suppress))
+
       ;; If too much time has passed since last command was sent, look
       ;; whether process is still alive.  If it isn't, kill it.  When
       ;; using ssh, it can sometimes happen that the remote end has
@@ -4239,9 +4285,7 @@ connection if a previous connection has died for some reason."
              ;; The error will be caught locally.
              (tramp-error vec 'file-error "Awake did fail")))
        (file-error
-        (tramp-flush-connection-property vec)
-        (tramp-flush-connection-property p)
-        (delete-process p)
+        (tramp-cleanup vec)
         (setq p nil)))
 
       ;; New connection must be opened.
@@ -4251,6 +4295,11 @@ connection if a previous connection has died for some reason."
            ;; We call `tramp-get-buffer' in order to get a debug
            ;; buffer for messages from the beginning.
            (tramp-get-buffer vec)
+
+           ;; If `non-essential' is non-nil, don't reopen a new connection.
+           (when (and (boundp 'non-essential) (symbol-value 'non-essential))
+             (throw 'non-essential 'non-essential))
+
            (tramp-with-progress-reporter
                vec 3
                (if (zerop (length (tramp-file-name-user vec)))
@@ -4290,6 +4339,9 @@ connection if a previous connection has died for some reason."
                (tramp-set-connection-property p "vector" vec)
                (set-process-sentinel p 'tramp-process-sentinel)
                (tramp-compat-set-process-query-on-exit-flag p nil)
+               (setq tramp-current-connection
+                     (cons (butlast (append vec nil)) (current-time))
+                     tramp-current-host (system-name))
 
                (tramp-message
                 vec 6 "%s" (mapconcat 'identity (process-command p) " "))
@@ -4336,7 +4388,7 @@ connection if a previous connection has died for some reason."
                            (expand-file-name
                             tramp-temp-name-prefix
                             (tramp-compat-temporary-file-directory)))))
-                        spec)
+                        spec r-shell)
 
                    ;; Add arguments for asynchronous processes.
                    (when (and process-name async-args)
@@ -4352,6 +4404,11 @@ connection if a previous connection has died for some reason."
                      (setq l-port (match-string 2 l-host)
                            l-host (match-string 1 l-host)))
 
+                   ;; Check, whether there is a restricted shell.
+                   (dolist (elt tramp-restricted-shell-hosts-alist)
+                     (when (string-match elt tramp-current-host)
+                       (setq r-shell t)))
+
                    ;; Set variables for computing the prompt for
                    ;; reading password.  They can also be derived
                    ;; from a gateway.
@@ -4370,7 +4427,7 @@ connection if a previous connection has died for some reason."
                     (concat
                      ;; We do not want to see the trailing local
                      ;; prompt in `start-file-process'.
-                     (unless (memq system-type '(windows-nt)) "exec ")
+                     (unless r-shell "exec ")
                      command " "
                      (mapconcat
                       (lambda (x)
@@ -4379,9 +4436,10 @@ connection if a previous connection has died for some reason."
                       login-args " ")
                      ;; Local shell could be a Windows COMSPEC.  It
                      ;; doesn't know the ";" syntax, but we must exit
-                     ;; always for `start-file-process'.  "exec" does
-                     ;; not work either.
-                     (if (memq system-type '(windows-nt)) " && exit || exit")))
+                     ;; always for `start-file-process'.  It could
+                     ;; also be a restricted shell, which does not
+                     ;; allow "exec".
+                     (when r-shell " && exit || exit")))
 
                    ;; Send the command.
                    (tramp-message vec 3 "Sending command `%s'" command)
@@ -4398,11 +4456,7 @@ connection if a previous connection has died for some reason."
 
        ;; When the user did interrupt, we must cleanup.
        (quit
-        (let ((p (tramp-get-connection-process vec)))
-          (when (and p (processp p))
-            (tramp-flush-connection-property vec)
-            (tramp-flush-connection-property p)
-            (delete-process p)))
+        (tramp-cleanup vec)
         ;; Propagate the quit signal.
         (signal (car err) (cdr err)))))))
 
@@ -4939,9 +4993,10 @@ the length of the file to be compressed.
 If no corresponding command is found, nil is returned."
   (when (and (integerp tramp-inline-compress-start-size)
             (> size tramp-inline-compress-start-size))
-    (with-connection-property vec prop
+    (with-connection-property (tramp-get-connection-process vec) prop
       (tramp-find-inline-compress vec)
-      (tramp-get-connection-property vec prop nil))))
+      (tramp-get-connection-property
+       (tramp-get-connection-process vec) prop nil))))
 
 (defun tramp-get-inline-coding (vec prop size)
   "Return the coding command related to PROP.
@@ -4959,9 +5014,10 @@ function cell is returned to be applied on a buffer."
   ;; no inline coding is found.
   (ignore-errors
     (let ((coding
-          (with-connection-property vec prop
+          (with-connection-property (tramp-get-connection-process vec) prop
             (tramp-find-inline-encoding vec)
-            (tramp-get-connection-property vec prop nil)))
+            (tramp-get-connection-property
+             (tramp-get-connection-process vec) prop nil)))
          (prop1 (if (string-match "encoding" prop)
                     "inline-compress" "inline-decompress"))
          compress)
index d3f0d8afb12999d1bca7bf65d5680576e86db3d4..1ea2719a23fde39e77813f96ae767a9d2a0f29a6 100644 (file)
@@ -33,7 +33,7 @@
 ;; Define SMB method ...
 ;;;###tramp-autoload
 (defconst tramp-smb-method "smb"
-  "*Method to connect SAMBA and M$ SMB servers.")
+  "Method to connect SAMBA and M$ SMB servers.")
 
 ;; ... and add it to the method list.
 ;;;###tramp-autoload
@@ -43,7 +43,7 @@
       ;; We define an empty command, because `tramp-smb-call-winexe'
       ;; opens already the powershell.  Used in `tramp-handle-shell-command'.
       (tramp-remote-shell "")
-      ;; This is just a guess.  We don't know whether the share "$C"
+      ;; This is just a guess.  We don't know whether the share "C$"
       ;; is available for public use, and whether the user has write
       ;; access.
       (tramp-tmpdir "/C$/Temp"))))
     '((tramp-parse-netrc "~/.netrc"))))
 
 (defcustom tramp-smb-program "smbclient"
-  "*Name of SMB client to run."
+  "Name of SMB client to run."
   :group 'tramp
   :type 'string)
 
 (defcustom tramp-smb-conf "/dev/null"
-  "*Path of the smb.conf file.
+  "Path of the smb.conf file.
 If it is nil, no smb.conf will be added to the `tramp-smb-program'
 call, letting the SMB client use the default one."
   :group 'tramp
   :type '(choice (const nil) (file :must-match t)))
 
 (defvar tramp-smb-version nil
-  "*Version string of the SMB client.")
+  "Version string of the SMB client.")
 
-(defconst tramp-smb-prompt "^smb: .+> \\|^\\s-+Server\\s-+Comment$"
-  "Regexp used as prompt in smbclient.")
+(defconst tramp-smb-server-version
+  "Domain=\\[[^]]*\\] OS=\\[[^]]*\\] Server=\\[[^]]*\\]"
+  "Regexp of SMB server identification.")
+
+(defconst tramp-smb-prompt "^\\(smb:\\|PS\\) .+> \\|^\\s-+Server\\s-+Comment$"
+  "Regexp used as prompt in smbclient or powershell.")
+
+(defconst tramp-smb-wrong-passwd-regexp
+  (regexp-opt
+   '("NT_STATUS_LOGON_FAILURE"
+     "NT_STATUS_WRONG_PASSWORD"))
+  "Regexp for login error strings of SMB servers.")
 
 (defconst tramp-smb-errors
   (mapconcat
@@ -155,6 +165,16 @@ This list is used for login to SMB servers.
 
 See `tramp-actions-before-shell' for more info.")
 
+(defconst tramp-smb-actions-with-tar
+  '((tramp-password-prompt-regexp tramp-action-password)
+    (tramp-wrong-passwd-regexp tramp-action-permission-denied)
+    (tramp-smb-errors tramp-action-permission-denied)
+    (tramp-process-alive-regexp tramp-smb-action-with-tar))
+  "List of pattern/action pairs.
+This list is used for tar-like copy of directories.
+
+See `tramp-actions-before-shell' for more info.")
+
 ;; New handlers should be added here.
 (defconst tramp-smb-file-name-handler-alist
   '(
@@ -205,12 +225,14 @@ See `tramp-actions-before-shell' for more info.")
     (make-directory . tramp-smb-handle-make-directory)
     (make-directory-internal . tramp-smb-handle-make-directory-internal)
     (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
+    (process-file . tramp-smb-handle-process-file)
     (rename-file . tramp-smb-handle-rename-file)
     (set-file-modes . tramp-smb-handle-set-file-modes)
     ;; `set-file-selinux-context' performed by default handler.
     (set-file-times . ignore)
     (set-visited-file-modtime . ignore)
-    (shell-command . ignore)
+    (shell-command . tramp-handle-shell-command)
+    (start-file-process . tramp-smb-handle-start-file-process)
     (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)
     (unhandled-file-name-directory . tramp-handle-unhandled-file-name-directory)
     (vc-registered . ignore)
@@ -220,11 +242,34 @@ See `tramp-actions-before-shell' for more info.")
   "Alist of handler functions for Tramp SMB method.
 Operations not mentioned here will be handled by the default Emacs primitives.")
 
+;; Options for remote processes via winexe.
+(defcustom tramp-smb-winexe-program "winexe"
+  "Name of winexe client to run.
+If it isn't found in the local $PATH, the absolute path of winexe
+shall be given.  This is needed for remote processes."
+  :group 'tramp
+  :type 'string
+  :version "24.2")
+
+(defcustom tramp-smb-winexe-shell-command "powershell.exe"
+  "Shell to be used for processes on remote machines.
+This must be Powershell V2 compatible."
+  :group 'tramp
+  :type 'string
+  :version "24.2")
+
+(defcustom tramp-smb-winexe-shell-command-switch "-file -"
+  "Command switch used together with `tramp-smb-winexe-shell-command'.
+This can be used to disable echo etc."
+  :group 'tramp
+  :type 'string
+  :version "24.2")
+
 ;;;###tramp-autoload
 (defsubst tramp-smb-file-name-p (filename)
   "Check if it's a filename for SMB servers."
-  (let ((v (tramp-dissect-file-name filename)))
-    (string= (tramp-file-name-method v) tramp-smb-method)))
+  (string= (tramp-file-name-method (tramp-dissect-file-name filename))
+          tramp-smb-method))
 
 ;;;###tramp-autoload
 (defun tramp-smb-file-name-handler (operation &rest args)
@@ -287,14 +332,31 @@ pass to the OPERATION."
         "error with add-name-to-file, see buffer `%s' for details"
         (buffer-name))))))
 
+(defun tramp-smb-action-with-tar (proc vec)
+  "Untar from connection buffer."
+  (if (not (memq (process-status proc) '(run open)))
+      (throw 'tramp-action 'process-died)
+
+    (with-current-buffer (tramp-get-connection-buffer vec)
+      (goto-char (point-min))
+      (when (search-forward-regexp tramp-smb-server-version nil t)
+       ;; There might be a hidden password prompt.
+       (widen)
+       (forward-line)
+       (tramp-message vec 6 (buffer-substring (point-min) (point)))
+       (delete-region (point-min) (point))
+       (throw 'tramp-action 'ok)))))
+
 (defun tramp-smb-handle-copy-directory
   (dirname newname &optional keep-date parents copy-contents)
-  "Like `copy-directory' for Tramp files.  KEEP-DATE is not handled."
+  "Like `copy-directory' for Tramp files."
   (setq dirname (expand-file-name dirname)
        newname (expand-file-name newname))
   (let ((t1 (tramp-tramp-file-p dirname))
        (t2 (tramp-tramp-file-p newname)))
     (with-parsed-tramp-file-name (if t1 dirname newname) nil
+      (tramp-with-progress-reporter
+         v 0 (format "Copying %s to %s" dirname newname)
       (cond
        ;; We must use a local temporary directory.
        ((and t1 t2)
@@ -311,46 +373,121 @@ pass to the OPERATION."
 
        ;; We can copy recursively.
        ((or t1 t2)
-       (let ((prompt (tramp-smb-send-command v "prompt"))
-             (recurse (tramp-smb-send-command v "recurse")))
-         (unless (file-directory-p newname)
+       (when (and (file-directory-p newname)
+                  (not (string-equal (file-name-nondirectory dirname)
+                                     (file-name-nondirectory newname))))
+         (setq newname
+               (expand-file-name
+                (file-name-nondirectory dirname) newname))
+         (if t2 (setq v (tramp-dissect-file-name newname))))
+       (if (not (file-directory-p newname))
            (make-directory newname parents))
+
+       (setq tramp-current-method (tramp-file-name-method v)
+             tramp-current-user (tramp-file-name-user v)
+             tramp-current-host (tramp-file-name-real-host v))
+
+       (let* ((real-user (tramp-file-name-real-user v))
+              (real-host (tramp-file-name-real-host v))
+              (domain    (tramp-file-name-domain v))
+              (port      (tramp-file-name-port v))
+              (share     (tramp-smb-get-share v))
+              (localname (file-name-as-directory
+                          (replace-regexp-in-string
+                           "\\\\" "/" (tramp-smb-get-localname v))))
+              (tmpdir    (make-temp-name
+                          (expand-file-name
+                           tramp-temp-name-prefix
+                           (tramp-compat-temporary-file-directory))))
+              (args      (list tramp-smb-program
+                               (concat "//" real-host "/" share) "-E")))
+
+         (if (not (zerop (length real-user)))
+             (setq args (append args (list "-U" real-user)))
+           (setq args (append args (list "-N"))))
+
+         (when domain (setq args (append args (list "-W" domain))))
+         (when port   (setq args (append args (list "-p" port))))
+         (when tramp-smb-conf
+           (setq args (append args (list "-s" tramp-smb-conf))))
+         (setq args
+               (if t1
+                   ;; Source is remote.
+                   (append args
+                           (list "-D" (shell-quote-argument localname)
+                                 "-c" (shell-quote-argument "tar qc - *")
+                                 "|" "tar" "xfC" "-"
+                                 (shell-quote-argument tmpdir)))
+                 ;; Target is remote.
+                 (append (list "tar" "cfC" "-" (shell-quote-argument dirname)
+                               "." "|")
+                         args
+                         (list "-D" (shell-quote-argument localname)
+                               "-c" (shell-quote-argument "tar qx -")))))
+
          (unwind-protect
-             (unless
-                 (and
-                  prompt recurse
-                  (tramp-smb-send-command
-                   v (format "cd \"%s\"" (tramp-smb-get-localname v)))
-                  (tramp-smb-send-command
-                   v (format "lcd \"%s\"" (if t1 newname dirname)))
-                  (if t1
-                      (tramp-smb-send-command v "mget *")
-                    (tramp-smb-send-command v "mput *")))
-               ;; Error.
-               (with-current-buffer (tramp-get-connection-buffer v)
-                 (goto-char (point-min))
-                 (search-forward-regexp tramp-smb-errors nil t)
-                 (tramp-error
-                  v 'file-error
-                  "%s `%s'" (match-string 0) (if t1 dirname newname))))
-           ;; Go home.
-           (tramp-smb-send-command
-            v (format
-               "cd %s" (if (tramp-smb-get-cifs-capabilities v) "/" "\\")))
-           ;; Toggle prompt and recurse OFF.
-           (if prompt (tramp-smb-send-command v "prompt"))
-           (if recurse (tramp-smb-send-command v "recurse")))))
+             (with-temp-buffer
+               ;; Set the transfer process properties.
+               (tramp-set-connection-property
+                v "process-name" (buffer-name (current-buffer)))
+               (tramp-set-connection-property
+                v "process-buffer" (current-buffer))
+
+               (when t1
+                 ;; The smbclient tar command creates always complete
+                 ;; paths.  We must emulate the directory structure,
+                 ;; and symlink to the real target.
+                 (make-directory
+                  (expand-file-name ".." (concat tmpdir localname)) 'parents)
+                 (make-symbolic-link
+                  newname (directory-file-name (concat tmpdir localname))))
+
+               ;; Use an asynchronous processes.  By this, password
+               ;; can be handled.
+               (let* ((default-directory tmpdir)
+                      (p (start-process-shell-command
+                          (tramp-get-connection-name v)
+                          (tramp-get-connection-buffer v)
+                          (mapconcat 'identity args " "))))
+
+                 (tramp-message
+                  v 6 "%s" (mapconcat 'identity (process-command p) " "))
+                 (tramp-compat-set-process-query-on-exit-flag p nil)
+                 (tramp-process-actions p v nil tramp-smb-actions-with-tar)
+
+                 (while (memq (process-status p) '(run open))
+                   (sit-for 0.1))
+                 (tramp-message v 6 "\n%s" (buffer-string))))
+
+           ;; Reset the transfer process properties.
+           (tramp-set-connection-property v "process-name" nil)
+           (tramp-set-connection-property v "process-buffer" nil)
+           (when t1 (delete-directory tmpdir 'recurse))))
+
+       ;; Handle KEEP-DATE argument.
+       (when keep-date
+         (set-file-times newname (nth 5 (file-attributes dirname))))
+
+       ;; Set the mode.
+       (unless keep-date
+         (set-file-modes newname (tramp-default-file-modes dirname)))
+
+       ;; When newname did exist, we have wrong cached values.
+       (when t2
+         (with-parsed-tramp-file-name newname nil
+           (tramp-flush-file-property v (file-name-directory localname))
+           (tramp-flush-file-property v localname))))
 
        ;; We must do it file-wise.
        (t
        (tramp-run-real-handler
-        'copy-directory (list dirname newname keep-date parents)))))))
+        'copy-directory (list dirname newname keep-date parents))))))))
 
 (defun tramp-smb-handle-copy-file
   (filename newname &optional ok-if-already-exists keep-date
            preserve-uid-gid preserve-selinux-context)
   "Like `copy-file' for Tramp files.
-KEEP-DATE is not handled in case NEWNAME resides on an SMB server.
+KEEP-DATE has no effect in case NEWNAME resides on an SMB server.
 PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
   (setq filename (expand-file-name filename)
        newname (expand-file-name newname))
@@ -358,40 +495,43 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
       (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
       0 (format "Copying %s to %s" filename newname)
 
-    (let ((tmpfile (file-local-copy filename)))
-
-      (if tmpfile
-         ;; Remote filename.
-         (condition-case err
-             (rename-file tmpfile newname ok-if-already-exists)
-           ((error quit)
-            (delete-file tmpfile)
-            (signal (car err) (cdr err))))
-
-       ;; Remote newname.
-       (when (file-directory-p newname)
-         (setq newname
-               (expand-file-name (file-name-nondirectory filename) newname)))
-
-       (with-parsed-tramp-file-name newname nil
-         (when (and (not ok-if-already-exists)
-                    (file-exists-p newname))
-           (tramp-error v 'file-already-exists newname))
-
-         ;; We must also flush the cache of the directory, because
-         ;; `file-attributes' reads the values from there.
-         (tramp-flush-file-property v (file-name-directory localname))
-         (tramp-flush-file-property v localname)
-         (unless (tramp-smb-get-share v)
-           (tramp-error
-            v 'file-error "Target `%s' must contain a share name" newname))
-         (unless (tramp-smb-send-command
-                  v (format "put \"%s\" \"%s\""
-                            filename (tramp-smb-get-localname v)))
-           (tramp-error v 'file-error "Cannot copy `%s'" filename))))))
+    (if (file-directory-p filename)
+       (tramp-compat-copy-directory filename newname keep-date t t)
+
+      (let ((tmpfile (file-local-copy filename)))
+       (if tmpfile
+           ;; Remote filename.
+           (condition-case err
+               (rename-file tmpfile newname ok-if-already-exists)
+             ((error quit)
+              (delete-file tmpfile)
+              (signal (car err) (cdr err))))
+
+         ;; Remote newname.
+         (when (file-directory-p newname)
+           (setq newname
+                 (expand-file-name (file-name-nondirectory filename) newname)))
+
+         (with-parsed-tramp-file-name newname nil
+           (when (and (not ok-if-already-exists)
+                      (file-exists-p newname))
+             (tramp-error v 'file-already-exists newname))
+
+           ;; We must also flush the cache of the directory, because
+           ;; `file-attributes' reads the values from there.
+           (tramp-flush-file-property v (file-name-directory localname))
+           (tramp-flush-file-property v localname)
+           (unless (tramp-smb-get-share v)
+             (tramp-error
+              v 'file-error "Target `%s' must contain a share name" newname))
+           (unless (tramp-smb-send-command
+                    v (format "put \"%s\" \"%s\""
+                              filename (tramp-smb-get-localname v)))
+             (tramp-error v 'file-error "Cannot copy `%s'" filename))))))
 
-  ;; KEEP-DATE handling.
-  (when keep-date (set-file-times newname (nth 5 (file-attributes filename)))))
+    ;; KEEP-DATE handling.
+    (when keep-date
+      (set-file-times newname (nth 5 (file-attributes filename))))))
 
 (defun tramp-smb-handle-delete-directory (directory &optional recursive)
   "Like `delete-directory' for Tramp files."
@@ -539,7 +679,7 @@ PRESERVE-UID-GID and PRESERVE-SELINUX-CONTEXT are completely ignored."
   "Implement `file-attributes' for Tramp files using stat command."
   (tramp-message
    vec 5 "file attributes with stat: %s" (tramp-file-name-localname vec))
-  (with-current-buffer (tramp-get-buffer vec)
+  (with-current-buffer (tramp-get-connection-buffer vec)
     (let* (size id link uid gid atime mtime ctime mode inode)
       (when (tramp-smb-send-command
             vec (format "stat \"%s\"" (tramp-smb-get-localname vec)))
@@ -845,44 +985,170 @@ target of the symlink differ."
         "error with make-symbolic-link, see buffer `%s' for details"
         (buffer-name))))))
 
+(defun tramp-smb-handle-process-file
+  (program &optional infile destination display &rest args)
+  "Like `process-file' for Tramp files."
+  ;; The implementation is not complete yet.
+  (when (and (numberp destination) (zerop destination))
+    (error "Implementation does not handle immediate return"))
+
+  (with-parsed-tramp-file-name default-directory nil
+    (let* ((name (file-name-nondirectory program))
+          (name1 name)
+          (i 0)
+          input tmpinput outbuf command ret)
+
+      ;; Determine input.
+      (when infile
+       (setq infile (expand-file-name infile))
+       (if (tramp-equal-remote default-directory infile)
+           ;; INFILE is on the same remote host.
+           (setq input (with-parsed-tramp-file-name infile nil localname))
+         ;; INFILE must be copied to remote host.
+         (setq input (tramp-make-tramp-temp-file v)
+               tmpinput (tramp-make-tramp-file-name method user host input))
+         (copy-file infile tmpinput t))
+       ;; Transform input into a filename powershell does understand.
+       (setq input (format "//%s%s" host input)))
+
+      ;; Determine output.
+      (cond
+       ;; Just a buffer.
+       ((bufferp destination)
+       (setq outbuf destination))
+       ;; A buffer name.
+       ((stringp destination)
+       (setq outbuf (get-buffer-create destination)))
+       ;; (REAL-DESTINATION ERROR-DESTINATION)
+       ((consp destination)
+       ;; output.
+       (cond
+        ((bufferp (car destination))
+         (setq outbuf (car destination)))
+        ((stringp (car destination))
+         (setq outbuf (get-buffer-create (car destination))))
+        ((car destination)
+         (setq outbuf (current-buffer))))
+       ;; stderr.
+       (tramp-message v 2 "%s" "STDERR not supported"))
+       ;; 't
+       (destination
+       (setq outbuf (current-buffer))))
+
+      ;; Construct command.
+      (setq command (mapconcat 'identity (cons program args) " ")
+           command (if input
+                       (format
+                        "get-content %s | & %s"
+                        (tramp-smb-shell-quote-argument input) command)
+                     (format "& %s" command)))
+
+      (while (get-process name1)
+       ;; NAME must be unique as process name.
+       (setq i (1+ i)
+             name1 (format "%s<%d>" name i)))
+
+      ;; Set the new process properties.
+      (tramp-set-connection-property v "process-name" name1)
+      (tramp-set-connection-property
+       v "process-buffer"
+       (or outbuf (generate-new-buffer tramp-temp-buffer-name)))
+
+      ;; Call it.
+      (condition-case nil
+         (with-current-buffer (tramp-get-connection-buffer v)
+           ;; Preserve buffer contents.
+           (narrow-to-region (point-max) (point-max))
+           (tramp-smb-call-winexe v)
+           (when (tramp-smb-get-share v)
+             (tramp-smb-send-command
+              v (format "cd \"//%s%s\"" host (file-name-directory localname))))
+           (tramp-smb-send-command v command)
+           ;; Preserve command output.
+           (narrow-to-region (point-max) (point-max))
+           (let ((p (tramp-get-connection-process v)))
+             (tramp-smb-send-command v "exit $lasterrorcode")
+             (while (memq (process-status p) '(run open))
+               (sleep-for 0.1)
+               (setq ret (process-exit-status p))))
+           (delete-region (point-min) (point-max))
+           (widen))
+
+       ;; When the user did interrupt, we should do it also.  We use
+       ;; return code -1 as marker.
+       (quit
+        (setq ret -1))
+       ;; Handle errors.
+       (error
+        (setq ret 1)))
+
+      ;; We should show the output anyway.
+      (when (and outbuf display) (display-buffer outbuf))
+
+      ;; Cleanup.  We remove all file cache values for the connection,
+      ;; because the remote process could have changed them.
+      (tramp-set-connection-property v "process-name" nil)
+      (tramp-set-connection-property v "process-buffer" nil)
+      (when tmpinput (delete-file tmpinput))
+      (unless outbuf
+       (kill-buffer (tramp-get-connection-property v "process-buffer" nil)))
+
+      ;; `process-file-side-effects' has been introduced with GNU
+      ;; Emacs 23.2.  If set to `nil', no remote file will be changed
+      ;; by `program'.  If it doesn't exist, we assume its default
+      ;; value `t'.
+      (unless (and (boundp 'process-file-side-effects)
+                  (not (symbol-value 'process-file-side-effects)))
+       (tramp-flush-directory-property v ""))
+
+      ;; Return exit status.
+      (if (equal ret -1)
+         (keyboard-quit)
+       ret))))
+
 (defun tramp-smb-handle-rename-file
   (filename newname &optional ok-if-already-exists)
   "Like `rename-file' for Tramp files."
   (setq filename (expand-file-name filename)
        newname (expand-file-name newname))
+
+  (when (and (not ok-if-already-exists)
+            (file-exists-p newname))
+    (tramp-error
+     (tramp-dissect-file-name
+      (if (file-remote-p filename) filename newname))
+     'file-already-exists newname))
+
   (tramp-with-progress-reporter
       (tramp-dissect-file-name (if (file-remote-p filename) filename newname))
       0 (format "Renaming %s to %s" filename newname)
 
-    (let ((tmpfile (file-local-copy filename)))
-
-      (if tmpfile
-         ;; Remote filename.
-         (condition-case err
-             (rename-file tmpfile newname ok-if-already-exists)
-           ((error quit)
-            (delete-file tmpfile)
-            (signal (car err) (cdr err))))
-
-       ;; Remote newname.
-       (when (file-directory-p newname)
-         (setq newname (expand-file-name
-                        (file-name-nondirectory filename) newname)))
-
-       (with-parsed-tramp-file-name newname nil
-         (when (and (not ok-if-already-exists)
-                    (file-exists-p newname))
-           (tramp-error v 'file-already-exists newname))
-         ;; We must also flush the cache of the directory, because
-         ;; `file-attributes' reads the values from there.
-         (tramp-flush-file-property v (file-name-directory localname))
-         (tramp-flush-file-property v localname)
-         (unless (tramp-smb-send-command
-                  v (format "put %s \"%s\""
-                            filename (tramp-smb-get-localname v)))
-           (tramp-error v 'file-error "Cannot rename `%s'" filename)))))
+    (if (and (tramp-equal-remote filename newname)
+            (string-equal
+             (tramp-smb-get-share (tramp-dissect-file-name filename))
+             (tramp-smb-get-share (tramp-dissect-file-name newname))))
+       ;; We can rename directly.
+       (with-parsed-tramp-file-name filename v1
+         (with-parsed-tramp-file-name newname v2
+
+           ;; We must also flush the cache of the directory, because
+           ;; `file-attributes' reads the values from there.
+           (tramp-flush-file-property v2 (file-name-directory v2-localname))
+           (tramp-flush-file-property v2 v2-localname)
+           (unless (tramp-smb-get-share v2)
+             (tramp-error
+              v2 'file-error "Target `%s' must contain a share name" newname))
+           (unless (tramp-smb-send-command
+                    v2 (format "rename \"%s\" \"%s\""
+                               (tramp-smb-get-localname v1)
+                               (tramp-smb-get-localname v2)))
+             (tramp-error v2 'file-error "Cannot rename `%s'" filename))))
 
-    (delete-file filename)))
+      ;; We must rename via copy.
+      (tramp-compat-copy-file filename newname ok-if-already-exists t t t)
+      (if (file-directory-p filename)
+         (tramp-compat-delete-directory filename 'recursive)
+       (delete-file filename)))))
 
 (defun tramp-smb-handle-set-file-modes (filename mode)
   "Like `set-file-modes' for Tramp files."
@@ -896,6 +1162,54 @@ target of the symlink differ."
        (tramp-error
         v 'file-error "Error while changing file's mode %s" filename)))))
 
+;; We use BUFFER also as connection buffer during setup. Because of
+;; this, its original contents must be saved, and restored once
+;; connection has been setup.
+(defun tramp-smb-handle-start-file-process (name buffer program &rest args)
+  "Like `start-file-process' for Tramp files."
+  (with-parsed-tramp-file-name default-directory nil
+    (let ((command (mapconcat 'identity (cons program args) " "))
+         (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
+         (name1 name)
+         (i 0))
+      (unwind-protect
+         (save-excursion
+           (save-restriction
+             (unless buffer
+               ;; BUFFER can be nil.  We use a temporary buffer.
+               (setq buffer (generate-new-buffer tramp-temp-buffer-name)))
+             (while (get-process name1)
+               ;; NAME must be unique as process name.
+               (setq i (1+ i)
+                     name1 (format "%s<%d>" name i)))
+             ;; Set the new process properties.
+             (tramp-set-connection-property v "process-name" name1)
+             (tramp-set-connection-property v "process-buffer" buffer)
+             ;; Activate narrowing in order to save BUFFER contents.
+             (with-current-buffer (tramp-get-connection-buffer v)
+               (let ((buffer-undo-list t))
+                 (narrow-to-region (point-max) (point-max))
+                 (tramp-smb-call-winexe v)
+                 (when (tramp-smb-get-share v)
+                   (tramp-smb-send-command
+                    v (format
+                       "cd \"//%s%s\""
+                       host (file-name-directory localname))))
+                 (tramp-message v 6 "(%s); exit" command)
+                 (tramp-send-string v command)))
+             ;; Return value.
+             (tramp-get-connection-process v)))
+
+       ;; Save exit.
+       (with-current-buffer (tramp-get-connection-buffer v)
+         (if (string-match tramp-temp-buffer-name (buffer-name))
+             (progn
+               (set-process-buffer (tramp-get-connection-process v) nil)
+               (kill-buffer (current-buffer)))
+           (set-buffer-modified-p bmp)))
+       (tramp-set-connection-property v "process-name" nil)
+       (tramp-set-connection-property v "process-buffer" nil)))))
+
 (defun tramp-smb-handle-substitute-in-file-name (filename)
   "Like `handle-substitute-in-file-name' for Tramp files.
 \"//\" substitutes only in the local filename part.  Catches
@@ -999,7 +1313,7 @@ Result is a list of (LOCALNAME MODE SIZE MONTH DAY TIME YEAR)."
   (with-parsed-tramp-file-name (file-name-as-directory directory) nil
     (setq localname (or localname "/"))
     (with-file-property v localname "file-entries"
-      (with-current-buffer (tramp-get-buffer v)
+      (with-current-buffer (tramp-get-connection-buffer v)
        (let* ((share (tramp-smb-get-share v))
               (cache (tramp-get-connection-property v "share-cache" nil))
               res entry)
@@ -1187,7 +1501,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
          (tramp-get-connection-process vec) "cifs-capabilities"
        (save-match-data
          (when (tramp-smb-send-command vec "posix")
-           (with-current-buffer (tramp-get-buffer vec)
+           (with-current-buffer (tramp-get-connection-buffer vec)
              (goto-char (point-min))
              (when
                  (re-search-forward "Server supports CIFS capabilities" nil t)
@@ -1216,18 +1530,20 @@ Returns nil if there has been an error message from smbclient."
   (tramp-send-string vec command)
   (tramp-smb-wait-for-output vec))
 
-(defun tramp-smb-maybe-open-connection (vec)
+(defun tramp-smb-maybe-open-connection (vec &optional argument)
   "Maybe open a connection to HOST, log in as USER, using `tramp-smb-program'.
 Does not do anything if a connection is already open, but re-opens the
-connection if a previous connection has died for some reason."
+connection if a previous connection has died for some reason.
+If ARGUMENT is non-nil, use it as argument for
+`tramp-smb-winexe-program', and suppress any checks."
   (let* ((share (tramp-smb-get-share vec))
-        (buf (tramp-get-buffer vec))
+        (buf (tramp-get-connection-buffer vec))
         (p (get-buffer-process buf)))
 
     ;; Check whether we still have the same smbclient version.
     ;; Otherwise, we must delete the connection cache, because
     ;; capabilities migh have changed.
-    (unless (processp p)
+    (unless (or argument (processp p))
       (let ((default-directory (tramp-compat-temporary-file-directory))
            (command (concat tramp-smb-program " -V")))
 
@@ -1271,9 +1587,10 @@ connection if a previous connection has died for some reason."
     ;; Check whether it is still the same share.
     (unless
        (and p (processp p) (memq (process-status p) '(run open))
-            (string-equal
-             share
-             (tramp-get-connection-property p "smb-share" "")))
+            (or argument
+                (string-equal
+                 share
+                 (tramp-get-connection-property p "smb-share" ""))))
 
       (save-match-data
        ;; There might be unread output from checking for share names.
@@ -1288,9 +1605,13 @@ connection if a previous connection has died for some reason."
               (port      (tramp-file-name-port vec))
               args)
 
-         (if share
-             (setq args (list (concat "//" real-host "/" share)))
-           (setq args (list "-g" "-L" real-host )))
+         (cond
+          (argument
+           (setq args (list (concat "//" real-host))))
+          (share
+           (setq args (list (concat "//" real-host "/" share))))
+          (t
+           (setq args (list "-g" "-L" real-host ))))
 
          (if (not (zerop (length real-user)))
              (setq args (append args (list "-U" real-user)))
@@ -1300,6 +1621,8 @@ connection if a previous connection has died for some reason."
          (when port   (setq args (append args (list "-p" port))))
          (when tramp-smb-conf
            (setq args (append args (list "-s" tramp-smb-conf))))
+         (when argument
+           (setq args (append args (list argument))))
 
          ;; OK, let's go.
          (tramp-with-progress-reporter
@@ -1313,8 +1636,11 @@ connection if a previous connection has died for some reason."
                   (p (let ((default-directory
                              (tramp-compat-temporary-file-directory)))
                        (apply #'start-process
-                              (tramp-buffer-name vec) (tramp-get-buffer vec)
-                              tramp-smb-program args))))
+                              (tramp-get-connection-name vec)
+                              (tramp-get-connection-buffer vec)
+                              (if argument
+                                  tramp-smb-winexe-program tramp-smb-program)
+                              args))))
 
              (tramp-message
               vec 6 "%s" (mapconcat 'identity (process-command p) " "))
@@ -1325,40 +1651,58 @@ connection if a previous connection has died for some reason."
                    tramp-current-user user
                    tramp-current-host host)
 
-             ;; Play login scenario.
-             (tramp-process-actions
-              p vec nil
-              (if share
-                  tramp-smb-actions-with-share
-                tramp-smb-actions-without-share))
-
-             ;; Check server version.
-             (with-current-buffer (tramp-get-connection-buffer vec)
-               (goto-char (point-min))
-               (search-forward-regexp
-                "Domain=\\[[^]]*\\] OS=\\[[^]]*\\] Server=\\[[^]]*\\]" nil t)
-               (let ((smbserver-version (match-string 0)))
-                 (unless
-                     (string-equal
-                      smbserver-version
-                      (tramp-get-connection-property
-                       vec "smbserver-version" smbserver-version))
-                   (tramp-flush-directory-property vec "")
-                   (tramp-flush-connection-property vec))
-                 (tramp-set-connection-property
-                  vec "smbserver-version" smbserver-version)))
-
-             ;; Set chunksize.  Otherwise, `tramp-send-string' might
-             ;; try it itself.
-             (tramp-set-connection-property p "smb-share" share)
-             (tramp-set-connection-property
-              p "chunksize" tramp-chunksize))))))))
+             (condition-case err
+                 (let (tramp-message-show-message)
+                   ;; Play login scenario.
+                   (tramp-process-actions
+                    p vec nil
+                    (if (or argument share)
+                        tramp-smb-actions-with-share
+                      tramp-smb-actions-without-share))
+
+                   ;; Check server version.
+                   (unless argument
+                     (with-current-buffer (tramp-get-connection-buffer vec)
+                       (goto-char (point-min))
+                       (search-forward-regexp tramp-smb-server-version nil t)
+                       (let ((smbserver-version (match-string 0)))
+                         (unless
+                             (string-equal
+                              smbserver-version
+                              (tramp-get-connection-property
+                               vec "smbserver-version" smbserver-version))
+                           (tramp-flush-directory-property vec "")
+                           (tramp-flush-connection-property vec))
+                         (tramp-set-connection-property
+                          vec "smbserver-version" smbserver-version))))
+
+                   ;; Set chunksize.  Otherwise, `tramp-send-string' might
+                   ;; try it itself.
+                   (tramp-set-connection-property p "smb-share" share)
+                   (tramp-set-connection-property
+                    p "chunksize" tramp-chunksize))
+
+               ;; Check for the error reason.  If it was due to wrong
+               ;; password, reestablish the connection.  We cannot
+               ;; handle this in `tramp-process-actions', because
+               ;; smbclient does not ask for the password, again.
+               (error
+                (with-current-buffer (tramp-get-connection-buffer vec)
+                  (goto-char (point-min))
+                  (if (search-forward-regexp
+                       tramp-smb-wrong-passwd-regexp nil t)
+                      ;; Disable `auth-source' and `password-cache'.
+                      (let (auth-sources)
+                        (tramp-cleanup vec)
+                        (tramp-smb-maybe-open-connection vec argument))
+                    ;; Propagate the error.
+                    (signal (car err) (cdr err)))))))))))))
 
 ;; We don't use timeouts.  If needed, the caller shall wrap around.
 (defun tramp-smb-wait-for-output (vec)
   "Wait for output from smbclient command.
 Returns nil if an error message has appeared."
-  (with-current-buffer (tramp-get-buffer vec)
+  (with-current-buffer (tramp-get-connection-buffer vec)
     (let ((p (get-buffer-process (current-buffer)))
          (found (progn (goto-char (point-min))
                        (re-search-forward tramp-smb-prompt nil t)))
@@ -1392,10 +1736,68 @@ Returns nil if an error message has appeared."
        (goto-char (point-min))
        (setq found (re-search-forward tramp-smb-prompt nil t)))
 
-      ;; Return value is whether no error message has appeared.
       (tramp-message vec 6 "\n%s" (buffer-string))
+
+      ;; Remove prompt.
+      (when found
+       (goto-char (point-max))
+       (re-search-backward tramp-smb-prompt nil t)
+       (delete-region (point) (point-max)))
+
+      ;; Return value is whether no error message has appeared.
       (not err))))
 
+(defun tramp-smb-kill-winexe-function ()
+  "Send SIGKILL to the winexe process."
+  (ignore-errors
+    (let ((p (get-buffer-process (current-buffer))))
+      (when (and p (processp p) (memq (process-status p) '(run open)))
+       (signal-process (process-id p) 'SIGINT)))))
+
+(defun tramp-smb-call-winexe (vec)
+  "Apply a remote command, if possible, using `tramp-smb-winexe-program'."
+
+  ;; We call `tramp-get-buffer' in order to get a debug buffer for
+  ;; messages.
+  (tramp-get-buffer vec)
+
+  ;; Check for program.
+  (unless (let ((default-directory
+                 (tramp-compat-temporary-file-directory)))
+           (executable-find tramp-smb-winexe-program))
+    (tramp-error
+     vec 'file-error "Cannot find program: %s" tramp-smb-winexe-program))
+
+  ;; winexe does not supports ports.
+  (when (tramp-file-name-port vec)
+    (tramp-error vec 'file-error "Port not supported for remote processes"))
+
+  (tramp-smb-maybe-open-connection
+   vec
+   (format
+    "%s %s"
+    tramp-smb-winexe-shell-command tramp-smb-winexe-shell-command-switch))
+
+  (set (make-local-variable 'kill-buffer-hook)
+       '(tramp-smb-kill-winexe-function))
+
+  ;; Suppress "^M".  Shouldn't we specify utf8?
+  (set-process-coding-system (tramp-get-connection-process vec) 'raw-text-dos)
+
+  ;; Set width to 128.  This avoids mixing prompt and long error messages.
+  (tramp-smb-send-command vec "$rawui = (Get-Host).UI.RawUI")
+  (tramp-smb-send-command vec "$bufsize = $rawui.BufferSize")
+  (tramp-smb-send-command vec "$winsize = $rawui.WindowSize")
+  (tramp-smb-send-command vec "$bufsize.Width = 128")
+  (tramp-smb-send-command vec "$winsize.Width = 128")
+  (tramp-smb-send-command vec "$rawui.BufferSize = $bufsize")
+  (tramp-smb-send-command vec "$rawui.WindowSize = $winsize"))
+
+(defun tramp-smb-shell-quote-argument (s)
+  "Similar to `shell-quote-argument', but uses windows cmd syntax."
+  (let ((system-type 'ms-dos))
+    (shell-quote-argument s)))
+
 (add-hook 'tramp-unload-hook
          (lambda ()
            (unload-feature 'tramp-smb 'force)))
@@ -1404,12 +1806,9 @@ Returns nil if an error message has appeared."
 
 ;;; TODO:
 
-;; * Error handling in case password is wrong.
 ;; * Return more comprehensive file permission string.
 ;; * Try to remove the inclusion of dummy "" directory.  Seems to be at
 ;;   several places, especially in `tramp-smb-handle-insert-directory'.
-;; * (RMS) Use unwind-protect to clean up the state so as to make the state
-;;   regular again.
 ;; * Ignore case in file names.
 
 ;;; tramp-smb.el ends here
index c092202b10a252031c79faaf781f95b81046e07a..58506ce82f7c1b5a576dcb61f6e4720b221237f6 100644 (file)
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))      ; ignore-errors
 (require 'tramp-compat)
 
 ;;; User Customizable Internal Variables:
 
 (defgroup tramp nil
-  "Edit remote files with a combination of rsh and rcp or similar programs."
+  "Edit remote files with a combination of ssh, scp, etc."
   :group 'files
   :group 'comm
   :version "22.1")
 ;; Maybe we need once a real Tramp mode, with key bindings etc.
 ;;;###autoload
 (defcustom tramp-mode t
-  "*Whether Tramp is enabled.
+  "Whether Tramp is enabled.
 If it is set to nil, all remote file names are used literally."
   :group 'tramp
   :type 'boolean)
 
 (defcustom tramp-verbose 3
-  "*Verbosity level for Tramp messages.
+  "Verbosity level for Tramp messages.
 Any level x includes messages for all levels 1 .. x-1.  The levels are
 
  0  silent (no tramp messages at all)
@@ -116,7 +117,7 @@ policy for local files."
 (eval-and-compile
   (when (featurep 'xemacs)
     (defcustom tramp-bkup-backup-directory-info nil
-      "*Alist of (FILE-REGEXP BACKUP-DIR OPTIONS ...))
+      "Alist of (FILE-REGEXP BACKUP-DIR OPTIONS ...))
 It has the same meaning like `bkup-backup-directory-info' from package
 `backup-dir'.  If a Tramp file is backed up, and BACKUP-DIR is a local
 file name, the backup directory is prepended with Tramp file name prefix
@@ -137,7 +138,7 @@ policy for local files."
       :group 'tramp)))
 
 (defcustom tramp-auto-save-directory nil
-  "*Put auto-save files in this directory, if set.
+  "Put auto-save files in this directory, if set.
 The idea is to use a local directory so that auto-saving is faster."
   :group 'tramp
   :type '(choice (const nil) string))
@@ -146,7 +147,7 @@ The idea is to use a local directory so that auto-saving is faster."
   (if (memq system-type '(windows-nt))
       (getenv "COMSPEC")
     "/bin/sh")
-  "*Use this program for encoding and decoding commands on the local host.
+  "Use this program for encoding and decoding commands on the local host.
 This shell is used to execute the encoding and decoding command on the
 local host, so if you want to use `~' in those commands, you should
 choose a shell here which groks tilde expansion.  `/bin/sh' normally
@@ -172,14 +173,14 @@ use for the remote host."
   (if (string-match "cmd\\.exe" tramp-encoding-shell)
       "/c"
     "-c")
-  "*Use this switch together with `tramp-encoding-shell' for local commands.
+  "Use this switch together with `tramp-encoding-shell' for local commands.
 See the variable `tramp-encoding-shell' for more information."
   :group 'tramp
   :type 'string)
 
 (defcustom tramp-encoding-command-interactive
   (unless (string-match "cmd\\.exe" tramp-encoding-shell) "-i")
-  "*Use this switch together with `tramp-encoding-shell' for interactive shells.
+  "Use this switch together with `tramp-encoding-shell' for interactive shells.
 See the variable `tramp-encoding-shell' for more information."
   :version "24.1"
   :group 'tramp
@@ -187,7 +188,7 @@ See the variable `tramp-encoding-shell' for more information."
 
 ;;;###tramp-autoload
 (defvar tramp-methods nil
-  "*Alist of methods for remote files.
+  "Alist of methods for remote files.
 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
 Each NAME stands for a remote access method.  Each PARAM is a
 pair of the form (KEY VALUE).  The following KEYs are defined:
@@ -247,15 +248,6 @@ pair of the form (KEY VALUE).  The following KEYs are defined:
   * `tramp-gw-args'
     As the attribute name says, additional arguments are specified here
     when a method is applied via a gateway.
-  * `tramp-password-end-of-line'
-    This specifies the string to use for terminating the line after
-    submitting the password.  If this method parameter is nil, then the
-    value of the normal variable `tramp-default-password-end-of-line'
-    is used.  This parameter is necessary because the \"plink\" program
-    requires any two characters after sending the password.  These do
-    not have to be newline or carriage return characters.  Other login
-    programs are happy with just one character, the newline character.
-    We use \"xy\" as the value for methods using \"plink\".
   * `tramp-tmpdir'
     A directory on the remote host for temporary files.  If not
     specified, \"/tmp\" is taken as default.
@@ -334,7 +326,7 @@ shouldn't return t when it isn't."
      (t "ssh")))
    ;; Fallback.
    (t "ftp"))
-  "*Default method to use for transferring files.
+  "Default method to use for transferring files.
 See `tramp-methods' for possibilities.
 Also see `tramp-default-method-alist'."
   :group 'tramp
@@ -342,7 +334,7 @@ Also see `tramp-default-method-alist'."
 
 ;;;###tramp-autoload
 (defcustom tramp-default-method-alist nil
-  "*Default method to use for specific host/user pairs.
+  "Default method to use for specific host/user pairs.
 This is an alist of items (HOST USER METHOD).  The first matching item
 specifies the method to use for a file name which does not specify a
 method.  HOST and USER are regular expressions or nil, which is
@@ -359,7 +351,7 @@ See `tramp-methods' for a list of possibilities for METHOD."
                       (choice :tag "Method name" string (const nil)))))
 
 (defcustom tramp-default-user nil
-  "*Default user to use for transferring files.
+  "Default user to use for transferring files.
 It is nil by default; otherwise settings in configuration files like
 \"~/.ssh/config\" would be overwritten.  Also see `tramp-default-user-alist'.
 
@@ -369,7 +361,7 @@ This variable is regarded as obsolete, and will be removed soon."
 
 ;;;###tramp-autoload
 (defcustom tramp-default-user-alist nil
-  "*Default user to use for specific method/host pairs.
+  "Default user to use for specific method/host pairs.
 This is an alist of items (METHOD HOST USER).  The first matching item
 specifies the user to use for a file name which does not specify a
 user.  METHOD and USER are regular expressions or nil, which is
@@ -384,13 +376,13 @@ empty string for the method name."
                       (choice :tag "    User name" string (const nil)))))
 
 (defcustom tramp-default-host (system-name)
-  "*Default host to use for transferring files.
+  "Default host to use for transferring files.
 Useful for su and sudo methods mostly."
   :group 'tramp
   :type 'string)
 
 (defcustom tramp-default-proxies-alist nil
-  "*Route to be followed for specific host/user pairs.
+  "Route to be followed for specific host/user pairs.
 This is an alist of items (HOST USER PROXY).  The first matching
 item specifies the proxy to be passed for a file name located on
 a remote target matching USER@HOST.  HOST and USER are regular
@@ -408,6 +400,23 @@ interpreted as a regular expression which always matches."
                       (choice :tag "User regexp" regexp sexp)
                       (choice :tag " Proxy name" string (const nil)))))
 
+(defcustom tramp-save-ad-hoc-proxies nil
+  "Whether to save ad-hoc proxies persistently."
+  :group 'tramp
+  :type 'boolean)
+
+(defcustom tramp-restricted-shell-hosts-alist
+  (when (memq system-type '(windows-nt))
+    (list (concat "\\`" (regexp-quote (system-name)) "\\'")))
+  "List of hosts, which run a restricted shell.
+This is a list of regular expressions, which denote hosts running
+a registered shell like \"rbash\".  Those hosts can be used as
+proxies only, see `tramp-default-proxies-alist'.  If the local
+host runs a registered shell, it shall be added to this list, too."
+  :version "24.2"
+  :group 'tramp
+  :type '(repeat (regexp :tag "Host regexp")))
+
 ;;;###tramp-autoload
 (defconst tramp-local-host-regexp
   (concat
@@ -415,10 +424,10 @@ interpreted as a regular expression which always matches."
    (regexp-opt
     (list "localhost" "localhost6" (system-name) "127\.0\.0\.1" "::1") t)
    "\\'")
-  "*Host names which are regarded as local host.")
+  "Host names which are regarded as local host.")
 
 (defvar tramp-completion-function-alist nil
-  "*Alist of methods for remote files.
+  "Alist of methods for remote files.
 This is a list of entries of the form \(NAME PAIR1 PAIR2 ...\).
 Each NAME stands for a remote access method.  Each PAIR is of the form
 \(FUNCTION FILE\).  FUNCTION is responsible to extract user names and host
@@ -432,7 +441,7 @@ names from FILE for completion.  The following predefined FUNCTIONs exists:
  * `tramp-parse-hosts'       for \"/etc/hosts\" like files,
  * `tramp-parse-passwd'      for \"/etc/passwd\" like files.
  * `tramp-parse-netrc'       for \"~/.netrc\" like files.
- * `tramp-parse-putty'       for PuTTY registry keys.
+ * `tramp-parse-putty'       for PuTTY registered sessions.
 
 FUNCTION can also be a customer defined function.  For more details see
 the info pages.")
@@ -463,38 +472,21 @@ the remote shell.")
 
 (defcustom tramp-local-end-of-line
   (if (memq system-type '(windows-nt)) "\r\n" "\n")
-  "*String used for end of line in local processes."
+  "String used for end of line in local processes."
   :version "24.1"
   :group 'tramp
   :type 'string)
 
 (defcustom tramp-rsh-end-of-line "\n"
-  "*String used for end of line in rsh connections.
+  "String used for end of line in rsh connections.
 I don't think this ever needs to be changed, so please tell me about it
-if you need to change this.
-Also see the method parameter `tramp-password-end-of-line' and the normal
-variable `tramp-default-password-end-of-line'."
-  :group 'tramp
-  :type 'string)
-
-(defcustom tramp-default-password-end-of-line
-  tramp-rsh-end-of-line
-  "*String used for end of line after sending a password.
-This variable provides the default value for the method parameter
-`tramp-password-end-of-line', see `tramp-methods' for more details.
-
-It seems that people using plink under Windows need to send
-\"\\r\\n\" (carriage-return, then newline) after a password, but just
-\"\\n\" after all other lines.  This variable can be used for the
-password, see `tramp-rsh-end-of-line' for the other cases.
-
-The default value is to use the same value as `tramp-rsh-end-of-line'."
+if you need to change this."
   :group 'tramp
   :type 'string)
 
 (defcustom tramp-login-prompt-regexp
   ".*ogin\\( .*\\)?: *"
-  "*Regexp matching login-like prompts.
+  "Regexp matching login-like prompts.
 The regexp should match at end of buffer.
 
 Sometimes the prompt is reported to look like \"login as:\"."
@@ -505,8 +497,10 @@ Sometimes the prompt is reported to look like \"login as:\"."
   ;; Allow a prompt to start right after a ^M since it indeed would be
   ;; displayed at the beginning of the line (and Zsh uses it).  This
   ;; regexp works only for GNU Emacs.
+  ;; Allow also [] style prompts.  They can appear only during
+  ;; connection initialization; Tramp redefines the prompt afterwards.
   (concat (if (featurep 'xemacs) "" "\\(?:^\\|\r\\)")
-         "[^#$%>\n]*#?[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*")
+         "[^]#$%>\n]*#?[]#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*")
   "Regexp to match prompts from remote shell.
 Normally, Tramp expects you to configure `shell-prompt-pattern'
 correctly, but sometimes it happens that you are connecting to a
@@ -523,7 +517,7 @@ This regexp must match both `tramp-initial-end-of-output' and
 
 (defcustom tramp-password-prompt-regexp
   "^.*\\([pP]assword\\|[pP]assphrase\\).*:\^@? *"
-  "*Regexp matching password-like prompts.
+  "Regexp matching password-like prompts.
 The regexp should match at end of buffer.
 
 The `sudo' program appears to insert a `^@' character into the prompt."
@@ -549,7 +543,7 @@ The `sudo' program appears to insert a `^@' character into the prompt."
          ;; Here comes a list of regexes, separated by \\|
          "Received signal [0-9]+"
          "\\).*")
-  "*Regexp matching a `login failed' message.
+  "Regexp matching a `login failed' message.
 The regexp should match at end of buffer."
   :group 'tramp
   :type 'regexp)
@@ -620,7 +614,7 @@ The answer will be provided by `tramp-action-process-alive',
   :type 'regexp)
 
 (defconst tramp-temp-name-prefix "tramp."
-  "*Prefix to use for temporary files.
+  "Prefix to use for temporary files.
 If this is a relative file name (such as \"tramp.\"), it is considered
 relative to the directory name returned by the function
 `tramp-compat-temporary-file-directory' (which see).  It may also be an
@@ -670,76 +664,76 @@ It can have the following values:
        ((equal tramp-syntax 'sep) "/[")
        ((equal tramp-syntax 'url) "/")
        (t (error "Wrong `tramp-syntax' defined")))
-  "*String matching the very beginning of Tramp file names.
+  "String matching the very beginning of Tramp file names.
 Used in `tramp-make-tramp-file-name'.")
 
 (defconst tramp-prefix-regexp
   (concat "^" (regexp-quote tramp-prefix-format))
-  "*Regexp matching the very beginning of Tramp file names.
+  "Regexp matching the very beginning of Tramp file names.
 Should always start with \"^\". Derived from `tramp-prefix-format'.")
 
 (defconst tramp-method-regexp
   "[a-zA-Z_0-9-]+"
-  "*Regexp matching methods identifiers.")
+  "Regexp matching methods identifiers.")
 
 (defconst tramp-postfix-method-format
   (cond ((equal tramp-syntax 'ftp) ":")
        ((equal tramp-syntax 'sep) "/")
        ((equal tramp-syntax 'url) "://")
        (t (error "Wrong `tramp-syntax' defined")))
-  "*String matching delimiter between method and user or host names.
+  "String matching delimiter between method and user or host names.
 Used in `tramp-make-tramp-file-name'.")
 
 (defconst tramp-postfix-method-regexp
   (regexp-quote tramp-postfix-method-format)
-  "*Regexp matching delimiter between method and user or host names.
+  "Regexp matching delimiter between method and user or host names.
 Derived from `tramp-postfix-method-format'.")
 
-(defconst tramp-user-regexp "[^:/ \t]+"
-  "*Regexp matching user names.")
+(defconst tramp-user-regexp "[^/|: \t]+"
+  "Regexp matching user names.")
 
 ;;;###tramp-autoload
 (defconst tramp-prefix-domain-format "%"
-  "*String matching delimiter between user and domain names.")
+  "String matching delimiter between user and domain names.")
 
 ;;;###tramp-autoload
 (defconst tramp-prefix-domain-regexp
   (regexp-quote tramp-prefix-domain-format)
-  "*Regexp matching delimiter between user and domain names.
+  "Regexp matching delimiter between user and domain names.
 Derived from `tramp-prefix-domain-format'.")
 
 (defconst tramp-domain-regexp "[-a-zA-Z0-9_.]+"
-  "*Regexp matching domain names.")
+  "Regexp matching domain names.")
 
 (defconst tramp-user-with-domain-regexp
   (concat "\\(" tramp-user-regexp "\\)"
                tramp-prefix-domain-regexp
          "\\(" tramp-domain-regexp "\\)")
-  "*Regexp matching user names with domain names.")
+  "Regexp matching user names with domain names.")
 
 (defconst tramp-postfix-user-format "@"
-  "*String matching delimiter between user and host names.
+  "String matching delimiter between user and host names.
 Used in `tramp-make-tramp-file-name'.")
 
 (defconst tramp-postfix-user-regexp
   (regexp-quote tramp-postfix-user-format)
-  "*Regexp matching delimiter between user and host names.
+  "Regexp matching delimiter between user and host names.
 Derived from `tramp-postfix-user-format'.")
 
 (defconst tramp-host-regexp "[a-zA-Z0-9_.-]+"
-  "*Regexp matching host names.")
+  "Regexp matching host names.")
 
 (defconst tramp-prefix-ipv6-format
   (cond ((equal tramp-syntax 'ftp) "[")
        ((equal tramp-syntax 'sep) "")
        ((equal tramp-syntax 'url) "[")
        (t (error "Wrong `tramp-syntax' defined")))
-  "*String matching left hand side of IPv6 addresses.
+  "String matching left hand side of IPv6 addresses.
 Used in `tramp-make-tramp-file-name'.")
 
 (defconst tramp-prefix-ipv6-regexp
   (regexp-quote tramp-prefix-ipv6-format)
-  "*Regexp matching left hand side of IPv6 addresses.
+  "Regexp matching left hand side of IPv6 addresses.
 Derived from `tramp-prefix-ipv6-format'.")
 
 ;; The following regexp is a bit sloppy.  But it shall serve our
@@ -747,19 +741,19 @@ Derived from `tramp-prefix-ipv6-format'.")
 ;; "::ffff:192.168.0.1".
 (defconst tramp-ipv6-regexp
   "\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+"
-  "*Regexp matching IPv6 addresses.")
+  "Regexp matching IPv6 addresses.")
 
 (defconst tramp-postfix-ipv6-format
   (cond ((equal tramp-syntax 'ftp) "]")
        ((equal tramp-syntax 'sep) "")
        ((equal tramp-syntax 'url) "]")
        (t (error "Wrong `tramp-syntax' defined")))
-  "*String matching right hand side of IPv6 addresses.
+  "String matching right hand side of IPv6 addresses.
 Used in `tramp-make-tramp-file-name'.")
 
 (defconst tramp-postfix-ipv6-regexp
   (regexp-quote tramp-postfix-ipv6-format)
-  "*Regexp matching right hand side of IPv6 addresses.
+  "Regexp matching right hand side of IPv6 addresses.
 Derived from `tramp-postfix-ipv6-format'.")
 
 (defconst tramp-prefix-port-format
@@ -767,56 +761,68 @@ Derived from `tramp-postfix-ipv6-format'.")
        ((equal tramp-syntax 'sep) "#")
        ((equal tramp-syntax 'url) ":")
        (t (error "Wrong `tramp-syntax' defined")))
-  "*String matching delimiter between host names and port numbers.")
+  "String matching delimiter between host names and port numbers.")
 
 (defconst tramp-prefix-port-regexp
   (regexp-quote tramp-prefix-port-format)
-  "*Regexp matching delimiter between host names and port numbers.
+  "Regexp matching delimiter between host names and port numbers.
 Derived from `tramp-prefix-port-format'.")
 
 (defconst tramp-port-regexp "[0-9]+"
-  "*Regexp matching port numbers.")
+  "Regexp matching port numbers.")
 
 (defconst tramp-host-with-port-regexp
   (concat "\\(" tramp-host-regexp "\\)"
                tramp-prefix-port-regexp
          "\\(" tramp-port-regexp "\\)")
-  "*Regexp matching host names with port numbers.")
+  "Regexp matching host names with port numbers.")
+
+(defconst tramp-postfix-hop-format "|"
+  "String matching delimiter after ad-hoc hop definitions.")
+
+(defconst tramp-postfix-hop-regexp
+  (regexp-quote tramp-postfix-hop-format)
+  "Regexp matching delimiter after ad-hoc hop definitions.
+Derived from `tramp-postfix-hop-format'.")
 
 (defconst tramp-postfix-host-format
   (cond ((equal tramp-syntax 'ftp) ":")
        ((equal tramp-syntax 'sep) "]")
        ((equal tramp-syntax 'url) "")
        (t (error "Wrong `tramp-syntax' defined")))
-  "*String matching delimiter between host names and localnames.
+  "String matching delimiter between host names and localnames.
 Used in `tramp-make-tramp-file-name'.")
 
 (defconst tramp-postfix-host-regexp
   (regexp-quote tramp-postfix-host-format)
-  "*Regexp matching delimiter between host names and localnames.
+  "Regexp matching delimiter between host names and localnames.
 Derived from `tramp-postfix-host-format'.")
 
 (defconst tramp-localname-regexp ".*$"
-  "*Regexp matching localnames.")
+  "Regexp matching localnames.")
 
 ;;; File name format:
 
+(defconst tramp-remote-file-name-spec-regexp
+  (concat
+   "\\(?:" "\\("   tramp-method-regexp "\\)" tramp-postfix-method-regexp "\\)?"
+   "\\(?:" "\\("   tramp-user-regexp   "\\)" tramp-postfix-user-regexp   "\\)?"
+   "\\("   "\\(?:" tramp-host-regexp   "\\|"
+                  tramp-prefix-ipv6-regexp  tramp-ipv6-regexp
+                                            tramp-postfix-ipv6-regexp "\\)"
+          "\\(?:" tramp-prefix-port-regexp  tramp-port-regexp "\\)?" "\\)?")
+"Regular expression matching a Tramp file name between prefix and postfix.")
+
 (defconst tramp-file-name-structure
   (list
    (concat
     tramp-prefix-regexp
-    "\\(" "\\(" tramp-method-regexp "\\)" tramp-postfix-method-regexp "\\)?"
-    "\\(" "\\(" tramp-user-regexp "\\)"   tramp-postfix-user-regexp   "\\)?"
-    "\\(" "\\(" tramp-host-regexp
-               "\\|"
-               tramp-prefix-ipv6-regexp  tramp-ipv6-regexp
-                                         tramp-postfix-ipv6-regexp "\\)"
-         "\\(" tramp-prefix-port-regexp  tramp-port-regexp "\\)?" "\\)?"
-    tramp-postfix-host-regexp
+    "\\(" "\\(?:" tramp-remote-file-name-spec-regexp
+                  tramp-postfix-hop-regexp "\\)+" "\\)?"
+    tramp-remote-file-name-spec-regexp tramp-postfix-host-regexp
     "\\(" tramp-localname-regexp "\\)")
-   2 4 5 8)
-
-  "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
+   5 6 7 8 1)
+  "List of six elements (REGEXP METHOD USER HOST FILE HOP), detailing \
 the Tramp file name structure.
 
 The first element REGEXP is a regular expression matching a Tramp file
@@ -827,6 +833,9 @@ The second element METHOD is a number, saying which pair of
 parentheses matches the method name.  The third element USER is
 similar, but for the user name.  The fourth element HOST is similar,
 but for the host name.  The fifth element FILE is for the file name.
+The last element HOP is the ad-hoc hop definition, which could be a
+cascade of several hops.
+
 These numbers are passed directly to `match-string', which see.  That
 means the opening parentheses are counted to identify the pair.
 
@@ -835,8 +844,8 @@ See also `tramp-file-name-regexp'.")
 ;;;###autoload
 (defconst tramp-file-name-regexp-unified
   (if (memq system-type '(cygwin windows-nt))
-      "\\`/\\([^[/:]\\{2,\\}\\|[^/]\\{2,\\}]\\):"
-    "\\`/\\([^[/:]+\\|[^/]+]\\):")
+      "\\`/\\([^[/|:]\\{2,\\}\\|[^/|]\\{2,\\}]\\):"
+    "\\`/\\([^[/|:]+\\|[^/|]+]\\):")
   "Value for `tramp-file-name-regexp' for unified remoting.
 Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
 Tramp.  See `tramp-file-name-structure' for more explanations.
@@ -850,7 +859,7 @@ XEmacs uses a separate filename syntax for Tramp and EFS.
 See `tramp-file-name-structure' for more explanations.")
 
 ;;;###autoload
-(defconst tramp-file-name-regexp-url "\\`/[^/:]+://"
+(defconst tramp-file-name-regexp-url "\\`/[^/|:]+://"
   "Value for `tramp-file-name-regexp' for URL-like remoting.
 See `tramp-file-name-structure' for more explanations.")
 
@@ -860,7 +869,7 @@ See `tramp-file-name-structure' for more explanations.")
        ((equal tramp-syntax 'sep) tramp-file-name-regexp-separate)
        ((equal tramp-syntax 'url) tramp-file-name-regexp-url)
        (t (error "Wrong `tramp-syntax' defined")))
-  "*Regular expression matching file names handled by Tramp.
+  "Regular expression matching file names handled by Tramp.
 This regexp should match Tramp file names but no other file names.
 When tramp.el is loaded, this regular expression is prepended to
 `file-name-handler-alist', and that is searched sequentially.  Thus,
@@ -904,7 +913,7 @@ See `tramp-file-name-structure' for more explanations.")
        ((equal tramp-syntax 'sep) tramp-completion-file-name-regexp-separate)
        ((equal tramp-syntax 'url) tramp-completion-file-name-regexp-url)
        (t (error "Wrong `tramp-syntax' defined")))
-  "*Regular expression matching file names handled by Tramp completion.
+  "Regular expression matching file names handled by Tramp completion.
 This regexp should match partial Tramp file names only.
 
 Please note that the entry in `file-name-handler-alist' is made when
@@ -926,7 +935,7 @@ Also see `tramp-file-name-structure'.")
 ;; Parentheses in docstring starting at beginning of line are escaped.
 ;; Fontification is messed up when
 ;; `open-paren-in-column-0-is-defun-start' set to t.
-  "*If non-nil, chunksize for sending input to local process.
+  "If non-nil, chunksize for sending input to local process.
 It is necessary only on systems which have a buggy `process-send-string'
 implementation.  The necessity, whether this variable must be set, can be
 checked via the following code:
@@ -1041,9 +1050,15 @@ calling HANDLER.")
 ;; internal data structure.  Convenience functions for internal
 ;; data structure.
 
+(defun tramp-get-method-parameter (method param)
+  "Return the method parameter PARAM.
+If the `tramp-methods' entry does not exist, return nil."
+  (let ((entry (assoc param (assoc method tramp-methods))))
+    (when entry (cadr entry))))
+
 (defun tramp-file-name-p (vec)
   "Check, whether VEC is a Tramp object."
-  (and (vectorp vec) (= 4 (length vec))))
+  (and (vectorp vec) (= 5 (length vec))))
 
 (defun tramp-file-name-method (vec)
   "Return method component of VEC."
@@ -1061,6 +1076,10 @@ calling HANDLER.")
   "Return localname component of VEC."
   (and (tramp-file-name-p vec) (aref vec 3)))
 
+(defun tramp-file-name-hop (vec)
+  "Return hop component of VEC."
+  (and (tramp-file-name-p vec) (aref vec 4)))
+
 ;; The user part of a Tramp file name vector can be of kind
 ;; "user%domain".  Sometimes, we must extract these parts.
 (defun tramp-file-name-real-user (vec)
@@ -1157,19 +1176,20 @@ values."
       (let ((method    (match-string (nth 1 tramp-file-name-structure) name))
            (user      (match-string (nth 2 tramp-file-name-structure) name))
            (host      (match-string (nth 3 tramp-file-name-structure) name))
-           (localname (match-string (nth 4 tramp-file-name-structure) name)))
+           (localname (match-string (nth 4 tramp-file-name-structure) name))
+           (hop       (match-string (nth 5 tramp-file-name-structure) name)))
        (when host
          (when (string-match tramp-prefix-ipv6-regexp host)
            (setq host (replace-match "" nil t host)))
          (when (string-match tramp-postfix-ipv6-regexp host)
            (setq host (replace-match "" nil t host))))
        (if nodefault
-           (vector method user host localname)
+           (vector method user host localname hop)
          (vector
           (tramp-find-method method user host)
           (tramp-find-user   method user host)
           (tramp-find-host   method user host)
-          localname))))))
+          localname hop))))))
 
 (defun tramp-buffer-name (vec)
   "A name for the connection buffer VEC."
@@ -1183,9 +1203,10 @@ values."
        (format "*tramp/%s %s@%s*" method user host)
       (format "*tramp/%s %s*" method host))))
 
-(defun tramp-make-tramp-file-name (method user host localname)
-  "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME."
-  (concat tramp-prefix-format
+(defun tramp-make-tramp-file-name (method user host localname &optional hop)
+  "Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME.
+When not nil, an optional HOP is prepended."
+  (concat tramp-prefix-format hop
          (when (not (zerop (length method)))
            (concat method tramp-postfix-method-format))
          (when (not (zerop (length user)))
@@ -1357,6 +1378,10 @@ ARGS to actually emit the message (if applicable)."
 This variable is used to disable messages from `tramp-error'.
 The messages are visible anyway, because an error is raised.")
 
+(defvar tramp-message-show-progress-reporter-message t
+  "Show Tramp progress reporter message in the minibuffer.
+This variable is used to disable recursive progress reporter messages.")
+
 (defsubst tramp-message (vec-or-proc level fmt-string &rest args)
   "Emit a message depending on verbosity level.
 VEC-OR-PROC identifies the Tramp buffer to use.  It can be either a
@@ -1422,13 +1447,14 @@ an input event arrives.  The other arguments are passed to `tramp-error'."
     (unwind-protect
        (apply 'tramp-error vec-or-proc signal fmt-string args)
       (when (and vec-or-proc
+                tramp-message-show-message
                 (not (zerop tramp-verbose))
                 (not (tramp-completion-mode-p)))
        (let ((enable-recursive-minibuffers t))
          (pop-to-buffer
           (or (and (bufferp buffer) buffer)
               (and (processp vec-or-proc) (process-buffer vec-or-proc))
-              (tramp-get-buffer vec-or-proc)))
+              (tramp-get-connection-buffer vec-or-proc)))
          (sit-for 30))))))
 
 (defmacro with-parsed-tramp-file-name (filename var &rest body)
@@ -1439,13 +1465,14 @@ Second arg VAR is a symbol.  It is used as a variable name to hold
 the filename structure.  It is also used as a prefix for the variables
 holding the components.  For example, if VAR is the symbol `foo', then
 `foo' will be bound to the whole structure, `foo-method' will be bound to
-the method component, and so on for `foo-user', `foo-host', `foo-localname'.
+the method component, and so on for `foo-user', `foo-host', `foo-localname',
+`foo-hop'.
 
 Remaining args are Lisp expressions to be evaluated (inside an implicit
 `progn').
 
 If VAR is nil, then we bind `v' to the structure and `method', `user',
-`host', `localname' to the components."
+`host', `localname', `hop' to the components."
   `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
          (,(if var (intern (concat (symbol-name var) "-method")) 'method)
           (tramp-file-name-method ,(or var 'v)))
@@ -1454,7 +1481,9 @@ If VAR is nil, then we bind `v' to the structure and `method', `user',
          (,(if var (intern (concat (symbol-name var) "-host")) 'host)
           (tramp-file-name-host ,(or var 'v)))
          (,(if var (intern (concat (symbol-name var) "-localname")) 'localname)
-          (tramp-file-name-localname ,(or var 'v))))
+          (tramp-file-name-localname ,(or var 'v)))
+         (,(if var (intern (concat (symbol-name var) "-hop")) 'hop)
+          (tramp-file-name-hop ,(or var 'v))))
      ,@body))
 
 (put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
@@ -1478,7 +1507,8 @@ progress reporter."
      (tramp-message ,vec ,level "%s..." ,message)
      ;; We start a pulsing progress reporter after 3 seconds.  Feature
      ;; introduced in Emacs 24.1.
-     (when (and tramp-message-show-message
+     (when (and tramp-message-show-progress-reporter-message
+               tramp-message-show-message
                ;; Display only when there is a minimum level.
                (<= ,level (min tramp-verbose 3)))
        (ignore-errors
@@ -1486,11 +1516,10 @@ progress reporter."
               tm (when pr
                    (run-at-time 3 0.1 'tramp-progress-reporter-update pr)))))
      (unwind-protect
-        ;; Execute the body.  Unset `tramp-message-show-message' when
-        ;; the timer object is created, in order to suppress
-        ;; concurrent timers.
-        (let ((tramp-message-show-message
-               (and tramp-message-show-message (not tm))))
+        ;; Execute the body.  Suppress concurrent progress reporter
+        ;; messages.
+        (let ((tramp-message-show-progress-reporter-message
+               (and tramp-message-show-progress-reporter-message (not tm))))
           ,@body)
        ;; Stop progress reporter.
        (if tm (tramp-compat-funcall 'cancel-timer tm))
@@ -1514,6 +1543,22 @@ letter into the file name.  This function removes it."
 
     'identity))
 
+(if (featurep 'xemacs)
+    (defalias 'tramp-drop-volume-letter 'identity))
+
+(defun tramp-cleanup (vec)
+  "Cleanup connection VEC, but keep the debug buffer."
+  (with-current-buffer (tramp-get-debug-buffer vec)
+    ;; Keep the debug buffer.
+    (rename-buffer
+     (generate-new-buffer-name tramp-temp-buffer-name) 'unique)
+    (tramp-cleanup-connection vec)
+    (if (= (point-min) (point-max))
+       (kill-buffer nil)
+      (rename-buffer (tramp-debug-buffer-name vec) 'unique))
+    ;; We call `tramp-get-buffer' in order to keep the debug buffer.
+    (tramp-get-buffer vec)))
+
 ;;; Config Manipulation Functions:
 
 ;;;###tramp-autoload
@@ -1522,9 +1567,7 @@ letter into the file name.  This function removes it."
 FUNCTION-LIST is a list of entries of the form (FUNCTION FILE).
 The FUNCTION is intended to parse FILE according its syntax.
 It might be a predefined FUNCTION, or a user defined FUNCTION.
-Predefined FUNCTIONs are `tramp-parse-rhosts', `tramp-parse-shosts',
-`tramp-parse-sconfig', `tramp-parse-hosts', `tramp-parse-passwd',
-and `tramp-parse-netrc'.
+For the list of predefined FUNCTIONs see `tramp-completion-function-alist'.
 
 Example:
 
@@ -1617,7 +1660,9 @@ been set up by `rfn-eshadow-setup-minibuffer'."
   (ignore-errors
     (let ((end (or (tramp-compat-funcall
                    'overlay-end (symbol-value 'rfn-eshadow-overlay))
-                  (tramp-compat-funcall 'minibuffer-prompt-end))))
+                  (tramp-compat-funcall 'minibuffer-prompt-end)))
+         ;; We do not want to send any remote command.
+         (non-essential t))
       (when
          (file-remote-p
           (tramp-compat-funcall
@@ -1810,7 +1855,7 @@ ARGS are the arguments OPERATION has been called with."
                  ;; Emacs 23+ only.
                  'copy-directory
                  ;; Emacs 24+ only.
-                 'file-equal-p 'file-in-directory-p
+                 'file-in-directory-p 'file-equal-p
                  ;; XEmacs only.
                  'dired-make-relative-symlink
                  'vm-imap-move-mail 'vm-pop-move-mail 'vm-spool-move-mail))
@@ -1886,8 +1931,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
          (with-parsed-tramp-file-name filename nil
            ;; Call the backend function.
            (if foreign
-               (condition-case err
-                   (let ((sf (symbol-function foreign)))
+               (tramp-compat-condition-case-unless-debug err
+                   (let ((sf (symbol-function foreign))
+                         result)
                      ;; Some packages set the default directory to a
                      ;; remote path, before respective Tramp packages
                      ;; are already loaded.  This results in
@@ -1897,7 +1943,32 @@ Falls back to normal file name handler if no Tramp file name handler exists."
                        (let ((default-directory
                                (tramp-compat-temporary-file-directory)))
                          (load (cadr sf) 'noerror 'nomessage)))
-                     (apply foreign operation args))
+                     ;; If `non-essential' is non-nil, Tramp shall
+                     ;; not open a new connection.
+                     ;; If Tramp detects that it shouldn't continue
+                     ;; to work, it throws the `suppress' event.
+                     ;; This could happen for example, when Tramp
+                     ;; tries to open the same connection twice in a
+                     ;; short time frame.
+                     ;; In both cases, we try the default handler then.
+                     (setq result
+                           (catch 'non-essential
+                             (catch 'suppress
+                               (apply foreign operation args))))
+                     (cond
+                      ((eq result 'non-essential)
+                       (tramp-message
+                        v 5 "Non-essential received in operation %s"
+                        (append (list operation) args))
+                       (tramp-run-real-handler operation args))
+                      ((eq result 'suppress)
+                       (let (tramp-message-show-message)
+                         (tramp-message
+                          v 1 "Suppress received in operation %s"
+                          (append (list operation) args))
+                         (tramp-cleanup v)
+                         (tramp-run-real-handler operation args)))
+                      (t result)))
 
                  ;; Trace that somebody has interrupted the operation.
                  ((debug quit)
@@ -1912,8 +1983,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
                  ;; operations shall return at least a default value
                  ;; in order to give the user a chance to correct the
                  ;; file name in the minibuffer.
-                 ;; We cannot use `debug' as error handler.  In order
-                 ;; to get a full backtrace, one could apply
+                 ;; In order to get a full backtrace, one could apply
                  ;;   (setq debug-on-error t debug-on-signal t)
                  (error
                   (cond
@@ -2124,18 +2194,27 @@ not in completion mode."
 (defun tramp-completion-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for partial Tramp files."
 
-  (let* ((fullname (tramp-drop-volume-letter
-                   (expand-file-name filename directory)))
-        ;; Possible completion structures.
-        (v (tramp-completion-dissect-file-name fullname))
-        result result1)
-
-    (while v
-      (let* ((car (car v))
-            (method (tramp-file-name-method car))
-            (user (tramp-file-name-user car))
-            (host (tramp-file-name-host car))
-            (localname (tramp-file-name-localname car))
+  (let ((fullname
+        (tramp-drop-volume-letter (expand-file-name filename directory)))
+       hop result result1)
+
+    ;; Suppress hop from completion.
+    (when (string-match
+          (concat
+           tramp-prefix-regexp
+           "\\(" "\\(" tramp-remote-file-name-spec-regexp
+                       tramp-postfix-hop-regexp
+           "\\)+" "\\)")
+          fullname)
+      (setq hop (match-string 1 fullname)
+           fullname (replace-match "" nil nil fullname 1)))
+
+    ;; Possible completion structures.
+    (dolist (elt (tramp-completion-dissect-file-name fullname))
+      (let* ((method (tramp-file-name-method elt))
+            (user (tramp-file-name-user elt))
+            (host (tramp-file-name-host elt))
+            (localname (tramp-file-name-localname elt))
             (m (tramp-find-method method user host))
             (tramp-current-user user) ; see `tramp-parse-passwd'
             all-user-hosts)
@@ -2163,18 +2242,16 @@ not in completion mode."
 
            ;; Possible methods.
            (setq result
-                 (append result (tramp-get-completion-methods m)))))
-
-       (setq v (cdr v))))
+                 (append result (tramp-get-completion-methods m)))))))
 
-    ;; Unify list, remove nil elements.
-    (while result
-      (let ((car (car result)))
-       (when car
-         (add-to-list
-          'result1
-          (substring car (length (tramp-drop-volume-letter directory)))))
-       (setq result (cdr result))))
+    ;; Unify list, add hop, remove nil elements.
+    (dolist (elt result)
+      (when elt
+       (string-match tramp-prefix-regexp elt)
+       (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt))
+       (add-to-list
+        'result1
+        (substring elt (length (tramp-drop-volume-letter directory))))))
 
     ;; Complete local parts.
     (append
@@ -2322,9 +2399,9 @@ They are collected by `tramp-completion-dissect-file-name1'."
             (concat tramp-prefix-regexp "/$"))
           1 nil 3 nil)))
 
-    (mapc (lambda (regexp)
+    (mapc (lambda (structure)
       (add-to-list 'result
-       (tramp-completion-dissect-file-name1 regexp name)))
+       (tramp-completion-dissect-file-name1 structure name)))
       (list
        tramp-completion-file-name-structure1
        tramp-completion-file-name-structure2
@@ -2358,7 +2435,7 @@ remote host and localname (filename on remote host)."
                            (match-string (nth 3 structure) name)))
            (localname (and (nth 4 structure)
                            (match-string (nth 4 structure) name))))
-       (vector method user host localname)))))
+       (vector method user host localname nil)))))
 
 ;; This function returns all possible method completions, adding the
 ;; trailing method delimiter.
@@ -2372,7 +2449,8 @@ remote host and localname (filename on remote host)."
    (mapcar 'car tramp-methods)))
 
 ;; Compares partial user and host names with possible completions.
-(defun tramp-get-completion-user-host (method partial-user partial-host user host)
+(defun tramp-get-completion-user-host
+  (method partial-user partial-host user host)
   "Returns the most expanded string for user and host name completion.
 PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
   (cond
@@ -2403,21 +2481,36 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match HOST."
   (unless (zerop (+ (length user) (length host)))
     (tramp-completion-make-tramp-file-name method user host nil)))
 
-;;;###tramp-autoload
-(defun tramp-parse-rhosts (filename)
+;; Generic function.
+(defun tramp-parse-group (regexp match-level skip-regexp)
+   "Return a (user host) tuple allowed to access.
+User is always nil."
+   (let (result)
+     (when (re-search-forward regexp (point-at-eol) t)
+       (setq result (list nil (match-string match-level))))
+     (or
+      (> (skip-chars-forward skip-regexp) 0)
+      (forward-line 1))
+     result))
+
+;; Generic function.
+(defun tramp-parse-file (filename function)
   "Return a list of (user host) tuples allowed to access.
-Either user or host may be nil."
+User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
-  (let ((default-directory (tramp-compat-temporary-file-directory))
-       res)
+  (let ((default-directory (tramp-compat-temporary-file-directory)))
     (when (file-readable-p filename)
       (with-temp-buffer
        (insert-file-contents filename)
        (goto-char (point-min))
-       (while (not (eobp))
-         (push (tramp-parse-rhosts-group) res))))
-    res))
+        (loop while (not (eobp)) collect (funcall function))))))
+
+;;;###tramp-autoload
+(defun tramp-parse-rhosts (filename)
+  "Return a list of (user host) tuples allowed to access.
+Either user or host may be nil."
+  (tramp-parse-file filename 'tramp-parse-rhosts-group))
 
 (defun tramp-parse-rhosts-group ()
    "Return a (user host) tuple allowed to access.
@@ -2427,10 +2520,8 @@ Either user or host may be nil."
          (concat
           "^\\(" tramp-host-regexp "\\)"
           "\\([ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
-     (narrow-to-region (point) (point-at-eol))
-     (when (re-search-forward regexp nil t)
+     (when (re-search-forward regexp (point-at-eol) t)
        (setq result (append (list (match-string 3) (match-string 1)))))
-     (widen)
      (forward-line 1)
      result))
 
@@ -2438,124 +2529,63 @@ Either user or host may be nil."
 (defun tramp-parse-shosts (filename)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  ;; On Windows, there are problems in completion when
-  ;; `default-directory' is remote.
-  (let ((default-directory (tramp-compat-temporary-file-directory))
-       res)
-    (when (file-readable-p filename)
-      (with-temp-buffer
-       (insert-file-contents filename)
-       (goto-char (point-min))
-       (while (not (eobp))
-         (push (tramp-parse-shosts-group) res))))
-    res))
+  (tramp-parse-file filename 'tramp-parse-shosts-group))
 
 (defun tramp-parse-shosts-group ()
    "Return a (user host) tuple allowed to access.
 User is always nil."
-   (let ((result)
-        (regexp (concat "^\\(" tramp-host-regexp "\\)")))
-     (narrow-to-region (point) (point-at-eol))
-     (when (re-search-forward regexp nil t)
-       (setq result (list nil (match-string 1))))
-     (widen)
-     (or
-      (> (skip-chars-forward ",") 0)
-      (forward-line 1))
-     result))
+   (tramp-parse-group (concat "^\\(" tramp-host-regexp "\\)") 1 ","))
 
 ;;;###tramp-autoload
 (defun tramp-parse-sconfig (filename)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  ;; On Windows, there are problems in completion when
-  ;; `default-directory' is remote.
-  (let ((default-directory (tramp-compat-temporary-file-directory))
-       res)
-    (when (file-readable-p filename)
-      (with-temp-buffer
-       (insert-file-contents filename)
-       (goto-char (point-min))
-       (while (not (eobp))
-         (push (tramp-parse-sconfig-group) res))))
-    res))
+  (tramp-parse-file filename 'tramp-parse-sconfig-group))
 
 (defun tramp-parse-sconfig-group ()
    "Return a (user host) tuple allowed to access.
 User is always nil."
-   (let ((result)
-        (regexp (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)")))
-     (narrow-to-region (point) (point-at-eol))
-     (when (re-search-forward regexp nil t)
-       (setq result (list nil (match-string 1))))
-     (widen)
-     (or
-      (> (skip-chars-forward ",") 0)
-      (forward-line 1))
-     result))
+   (tramp-parse-group
+    (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)") 1 ","))
 
-;;;###tramp-autoload
-(defun tramp-parse-shostkeys (dirname)
+;; Generic function.
+(defun tramp-parse-shostkeys-sknownhosts (dirname regexp)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
   ;; On Windows, there are problems in completion when
   ;; `default-directory' is remote.
   (let* ((default-directory (tramp-compat-temporary-file-directory))
-        (regexp (concat "^key_[0-9]+_\\(" tramp-host-regexp "\\)\\.pub$"))
-        (files (when (file-directory-p dirname) (directory-files dirname)))
-        result)
-    (while files
-      (when (string-match regexp (car files))
-       (push (list nil (match-string 1 (car files))) result))
-      (setq files (cdr files)))
-    result))
+        (files (and (file-directory-p dirname) (directory-files dirname))))
+    (loop for f in files
+         when (and (not (string-match "^\\.\\.?$" f)) (string-match regexp f))
+         collect (list nil (match-string 1 f)))))
 
+;;;###tramp-autoload
+(defun tramp-parse-shostkeys (dirname)
+  "Return a list of (user host) tuples allowed to access.
+User is always nil."
+  (tramp-parse-shostkeys-sknownhosts
+   dirname (concat "^key_[0-9]+_\\(" tramp-host-regexp "\\)\\.pub$")))
+
+;;;###tramp-autoload
 (defun tramp-parse-sknownhosts (dirname)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  ;; On Windows, there are problems in completion when
-  ;; `default-directory' is remote.
-  (let* ((default-directory (tramp-compat-temporary-file-directory))
-        (regexp (concat "^\\(" tramp-host-regexp
-                        "\\)\\.ssh-\\(dss\\|rsa\\)\\.pub$"))
-        (files (when (file-directory-p dirname) (directory-files dirname)))
-        result)
-    (while files
-      (when (string-match regexp (car files))
-       (push (list nil (match-string 1 (car files))) result))
-      (setq files (cdr files)))
-    result))
+  (tramp-parse-shostkeys-sknownhosts
+   dirname
+   (concat "^\\(" tramp-host-regexp "\\)\\.ssh-\\(dss\\|rsa\\)\\.pub$")))
 
 ;;;###tramp-autoload
 (defun tramp-parse-hosts (filename)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  ;; On Windows, there are problems in completion when
-  ;; `default-directory' is remote.
-  (let ((default-directory (tramp-compat-temporary-file-directory))
-       res)
-    (when (file-readable-p filename)
-      (with-temp-buffer
-       (insert-file-contents filename)
-       (goto-char (point-min))
-       (while (not (eobp))
-         (push (tramp-parse-hosts-group) res))))
-    res))
+  (tramp-parse-file filename 'tramp-parse-hosts-group))
 
 (defun tramp-parse-hosts-group ()
    "Return a (user host) tuple allowed to access.
 User is always nil."
-   (let ((result)
-        (regexp
-         (concat "^\\(" tramp-ipv6-regexp "\\|" tramp-host-regexp "\\)")))
-     (narrow-to-region (point) (point-at-eol))
-     (when (re-search-forward regexp nil t)
-       (setq result (list nil (match-string 1))))
-     (widen)
-     (or
-      (> (skip-chars-forward " \t") 0)
-      (forward-line 1))
-     result))
+   (tramp-parse-group
+    (concat "^\\(" tramp-ipv6-regexp "\\|" tramp-host-regexp "\\)") 1 " \t"))
 
 ;; For su-alike methods it would be desirable to return "root@localhost"
 ;; as default.  Unfortunately, we have no information whether any user name
@@ -2565,29 +2595,17 @@ User is always nil."
 (defun tramp-parse-passwd (filename)
   "Return a list of (user host) tuples allowed to access.
 Host is always \"localhost\"."
-  ;; On Windows, there are problems in completion when
-  ;; `default-directory' is remote.
-  (let ((default-directory (tramp-compat-temporary-file-directory))
-       res)
-    (if (zerop (length tramp-current-user))
-       '(("root" nil))
-      (when (file-readable-p filename)
-       (with-temp-buffer
-         (insert-file-contents filename)
-         (goto-char (point-min))
-         (while (not (eobp))
-           (push (tramp-parse-passwd-group) res))))
-      res)))
+  (if (zerop (length tramp-current-user))
+      '(("root" nil))
+    (tramp-parse-file filename 'tramp-parse-passwd-group)))
 
 (defun tramp-parse-passwd-group ()
    "Return a (user host) tuple allowed to access.
 Host is always \"localhost\"."
    (let ((result)
         (regexp (concat "^\\(" tramp-user-regexp "\\):")))
-     (narrow-to-region (point) (point-at-eol))
-     (when (re-search-forward regexp nil t)
+     (when (re-search-forward regexp (point-at-eol) t)
        (setq result (list (match-string 1) "localhost")))
-     (widen)
      (forward-line 1)
      result))
 
@@ -2595,17 +2613,7 @@ Host is always \"localhost\"."
 (defun tramp-parse-netrc (filename)
   "Return a list of (user host) tuples allowed to access.
 User may be nil."
-  ;; On Windows, there are problems in completion when
-  ;; `default-directory' is remote.
-  (let ((default-directory (tramp-compat-temporary-file-directory))
-       res)
-    (when (file-readable-p filename)
-      (with-temp-buffer
-       (insert-file-contents filename)
-       (goto-char (point-min))
-       (while (not (eobp))
-         (push (tramp-parse-netrc-group) res))))
-    res))
+  (tramp-parse-file filename 'tramp-parse-netrc-group))
 
 (defun tramp-parse-netrc-group ()
    "Return a (user host) tuple allowed to access.
@@ -2615,37 +2623,33 @@ User may be nil."
          (concat
           "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)"
           "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
-     (narrow-to-region (point) (point-at-eol))
-     (when (re-search-forward regexp nil t)
+     (when (re-search-forward regexp (point-at-eol) t)
        (setq result (list (match-string 3) (match-string 1))))
-     (widen)
      (forward-line 1)
      result))
 
 ;;;###tramp-autoload
-(defun tramp-parse-putty (registry)
+(defun tramp-parse-putty (registry-or-dirname)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  ;; On Windows, there are problems in completion when
-  ;; `default-directory' is remote.
-  (let ((default-directory (tramp-compat-temporary-file-directory))
-       res)
-    (with-temp-buffer
-      (when (zerop (tramp-compat-call-process "reg" nil t nil "query" registry))
-       (goto-char (point-min))
-       (while (not (eobp))
-         (push (tramp-parse-putty-group registry) res))))
-    res))
+  (if (memq system-type '(windows-nt))
+      (with-temp-buffer
+       (when (zerop (tramp-compat-call-process
+                     "reg" nil t nil "query" registry-or-dirname))
+         (goto-char (point-min))
+         (loop while (not (eobp)) collect
+               (tramp-parse-putty-group registry-or-dirname))))
+    ;; UNIX case.
+    (tramp-parse-shostkeys-sknownhosts
+     registry-or-dirname (concat "^\\(" tramp-host-regexp "\\)$"))))
 
 (defun tramp-parse-putty-group (registry)
    "Return a (user host) tuple allowed to access.
 User is always nil."
    (let ((result)
         (regexp (concat (regexp-quote registry) "\\\\\\(.+\\)")))
-     (narrow-to-region (point) (point-at-eol))
-     (when (re-search-forward regexp nil t)
+     (when (re-search-forward regexp (point-at-eol) t)
        (setq result (list nil (match-string 1))))
-     (widen)
      (forward-line 1)
      result))
 
@@ -2855,78 +2859,80 @@ User is always nil."
   (setq filename (expand-file-name filename))
   (let (result local-copy remote-copy)
     (with-parsed-tramp-file-name filename nil
-      (unwind-protect
-         (if (not (file-exists-p filename))
-             ;; We don't raise a Tramp error, because it might be
-             ;; suppressed, like in `find-file-noselect-1'.
-             (signal 'file-error
-                     (list "File not found on remote host" filename))
-
-           (if (and (tramp-local-host-p v)
-                    (let (file-name-handler-alist)
-                      (file-readable-p localname)))
-               ;; Short track: if we are on the local host, we can
-               ;; run directly.
-               (setq result
-                     (tramp-run-real-handler
-                      'insert-file-contents
-                      (list localname visit beg end replace)))
-
-             ;; When we shall insert only a part of the file, we copy
-             ;; this part.
-             (when (or beg end)
-               (setq remote-copy (tramp-make-tramp-temp-file v))
-               ;; This is defined in tramp-sh.el.  Let's assume this
-               ;; is loaded already.
-               (tramp-compat-funcall 'tramp-send-command
-                v
-                (cond
-                 ((and beg end)
-                  (format "dd bs=1 skip=%d if=%s count=%d of=%s"
-                          beg (tramp-shell-quote-argument localname)
-                          (- end beg) remote-copy))
-                 (beg
-                  (format "dd bs=1 skip=%d if=%s of=%s"
-                          beg (tramp-shell-quote-argument localname)
-                          remote-copy))
-                 (end
-                  (format "dd bs=1 count=%d if=%s of=%s"
-                          end (tramp-shell-quote-argument localname)
-                          remote-copy)))))
-
-             ;; `insert-file-contents-literally' takes care to avoid
-             ;; calling jka-compr.  By let-binding
-             ;; `inhibit-file-name-operation', we propagate that care
-             ;; to the `file-local-copy' operation.
-             (setq local-copy
-                   (let ((inhibit-file-name-operation
-                          (when (eq inhibit-file-name-operation
-                                    'insert-file-contents)
-                            'file-local-copy)))
-                     (cond
-                      ((stringp remote-copy)
-                       (file-local-copy
-                        (tramp-make-tramp-file-name
-                         method user host remote-copy)))
-                      ((stringp tramp-temp-buffer-file-name)
-                       (copy-file filename tramp-temp-buffer-file-name 'ok)
-                       tramp-temp-buffer-file-name)
-                      (t (file-local-copy filename)))))
-
-             ;; When the file is not readable for the owner, it
-             ;; cannot be inserted, even if it is readable for the
-             ;; group or for everybody.
-             (set-file-modes local-copy (tramp-compat-octal-to-decimal "0600"))
-
-             (when (and (null remote-copy)
-                        (tramp-get-method-parameter
-                         method 'tramp-copy-keep-tmpfile))
-               ;; We keep the local file for performance reasons,
-               ;; useful for "rsync".
-               (setq tramp-temp-buffer-file-name local-copy))
-
-             (tramp-with-progress-reporter
-                 v 3 (format "Inserting local temp file `%s'" local-copy)
+      (tramp-with-progress-reporter
+         v 3 (format "Inserting `%s'" filename)
+       (unwind-protect
+           (if (not (file-exists-p filename))
+               ;; We don't raise a Tramp error, because it might be
+               ;; suppressed, like in `find-file-noselect-1'.
+               (signal 'file-error
+                       (list "File not found on remote host" filename))
+
+             (if (and (tramp-local-host-p v)
+                      (let (file-name-handler-alist)
+                        (file-readable-p localname)))
+                 ;; Short track: if we are on the local host, we can
+                 ;; run directly.
+                 (setq result
+                       (tramp-run-real-handler
+                        'insert-file-contents
+                        (list localname visit beg end replace)))
+
+               ;; When we shall insert only a part of the file, we
+               ;; copy this part.
+               (when (or beg end)
+                 (setq remote-copy (tramp-make-tramp-temp-file v))
+                 ;; This is defined in tramp-sh.el.  Let's assume
+                 ;; this is loaded already.
+                 (tramp-compat-funcall
+                  'tramp-send-command
+                  v
+                  (cond
+                   ((and beg end)
+                    (format "dd bs=1 skip=%d if=%s count=%d of=%s"
+                            beg (tramp-shell-quote-argument localname)
+                            (- end beg) remote-copy))
+                   (beg
+                    (format "dd bs=1 skip=%d if=%s of=%s"
+                            beg (tramp-shell-quote-argument localname)
+                            remote-copy))
+                   (end
+                    (format "dd bs=1 count=%d if=%s of=%s"
+                            end (tramp-shell-quote-argument localname)
+                            remote-copy)))))
+
+               ;; `insert-file-contents-literally' takes care to
+               ;; avoid calling jka-compr.  By let-binding
+               ;; `inhibit-file-name-operation', we propagate that
+               ;; care to the `file-local-copy' operation.
+               (setq local-copy
+                     (let ((inhibit-file-name-operation
+                            (when (eq inhibit-file-name-operation
+                                      'insert-file-contents)
+                              'file-local-copy)))
+                       (cond
+                        ((stringp remote-copy)
+                         (file-local-copy
+                          (tramp-make-tramp-file-name
+                           method user host remote-copy)))
+                        ((stringp tramp-temp-buffer-file-name)
+                         (copy-file filename tramp-temp-buffer-file-name 'ok)
+                         tramp-temp-buffer-file-name)
+                        (t (file-local-copy filename)))))
+
+               ;; When the file is not readable for the owner, it
+               ;; cannot be inserted, even if it is readable for the
+               ;; group or for everybody.
+               (set-file-modes
+                local-copy (tramp-compat-octal-to-decimal "0600"))
+
+               (when (and (null remote-copy)
+                          (tramp-get-method-parameter
+                           method 'tramp-copy-keep-tmpfile))
+                 ;; We keep the local file for performance reasons,
+                 ;; useful for "rsync".
+                 (setq tramp-temp-buffer-file-name local-copy))
+
                ;; We must ensure that `file-coding-system-alist'
                ;; matches `local-copy'.
                (let ((file-coding-system-alist
@@ -2934,21 +2940,21 @@ User is always nil."
                        filename local-copy)))
                  (setq result
                        (insert-file-contents
-                        local-copy nil nil nil replace))))))
-
-       ;; Save exit.
-       (progn
-         (when visit
-           (setq buffer-file-name filename)
-           (setq buffer-read-only (not (file-writable-p filename)))
-           (set-visited-file-modtime)
-           (set-buffer-modified-p nil))
-         (when (and (stringp local-copy)
-                    (or remote-copy (null tramp-temp-buffer-file-name)))
-           (delete-file local-copy))
-         (when (stringp remote-copy)
-           (delete-file
-            (tramp-make-tramp-file-name method user host remote-copy))))))
+                        local-copy nil nil nil replace)))))
+
+         ;; Save exit.
+         (progn
+           (when visit
+             (setq buffer-file-name filename)
+             (setq buffer-read-only (not (file-writable-p filename)))
+             (set-visited-file-modtime)
+             (set-buffer-modified-p nil))
+           (when (and (stringp local-copy)
+                      (or remote-copy (null tramp-temp-buffer-file-name)))
+             (delete-file local-copy))
+           (when (stringp remote-copy)
+             (delete-file
+              (tramp-make-tramp-file-name method user host remote-copy)))))))
 
     ;; Result.
     (list (expand-file-name filename)
@@ -3133,11 +3139,15 @@ beginning of local filename are not substituted."
 (defun tramp-action-password (proc vec)
   "Query the user for a password."
   (with-current-buffer (process-buffer proc)
-    (tramp-check-for-regexp proc tramp-password-prompt-regexp)
-    (tramp-message vec 3 "Sending %s" (match-string 1))
-    (tramp-enter-password proc)
-    ;; Hide password prompt.
-    (narrow-to-region (point-max) (point-max))))
+    (let ((enable-recursive-minibuffers t))
+      (tramp-check-for-regexp proc tramp-password-prompt-regexp)
+      (tramp-message vec 3 "Sending %s" (match-string 1))
+      ;; We don't call `tramp-send-string' in order to hide the
+      ;; password from the debug buffer.
+      (process-send-string
+       proc (concat (tramp-read-passwd proc) tramp-local-end-of-line))
+      ;; Hide password prompt.
+      (narrow-to-region (point-max) (point-max)))))
 
 (defun tramp-action-succeed (proc vec)
   "Signal success in finding shell prompt."
@@ -3239,7 +3249,7 @@ set, is the starting point of the region to be deleted in the
 connection buffer."
   ;; Preserve message for `progress-reporter'.
   (tramp-compat-with-temp-message ""
-    ;; Enable auth-source and password-cache.  We must use
+    ;; Enable `auth-source' and `password-cache'.  We must use
     ;; tramp-current-* variables in case we have several hops.
     (tramp-set-connection-property
      (tramp-dissect-file-name
@@ -3314,8 +3324,12 @@ Erase echoed commands if exists."
                     'buffer-substring-no-properties
                     1 (min (1+ tramp-echo-mark-marker-length) (point-max))))))
       ;; No echo to be handled, now we can look for the regexp.
-      (goto-char (point-min))
-      (re-search-forward regexp nil t))))
+      ;; Sometimes, lines are much to long, and we run into a "Stack
+      ;; overflow in regexp matcher".  For example, //DIRED// lines of
+      ;; directory listings with some thousand files.  Therefore, we
+      ;; look from the end.
+      (goto-char (point-max))
+      (ignore-errors (re-search-backward regexp nil t)))))
 
 (defun tramp-wait-for-regexp (proc timeout regexp)
   "Wait for a REGEXP to appear from process PROC within TIMEOUT seconds.
@@ -3355,18 +3369,6 @@ nil."
          (tramp-error proc 'file-error "[[Regexp `%s' not found]]" regexp)))
       found)))
 
-;; We don't call `tramp-send-string' in order to hide the password
-;; from the debug buffer, and because end-of-line handling of the
-;; string.
-(defun tramp-enter-password (proc)
-  "Prompt for a password and send it to the remote end."
-  (process-send-string
-   proc (concat (tramp-read-passwd proc)
-               (or (tramp-get-method-parameter
-                    tramp-current-method
-                    'tramp-password-end-of-line)
-                   tramp-default-password-end-of-line))))
-
 ;; It seems that Tru64 Unix does not like it if long strings are sent
 ;; to it in one go.  (This happens when sending the Perl
 ;; `file-attributes' implementation, for instance.)  Therefore, we
@@ -3439,12 +3441,7 @@ would yield `t'.  On the other hand, the following check results in nil:
        (stringp (file-remote-p file2))
        (string-equal (file-remote-p file1) (file-remote-p file2))))
 
-(defun tramp-get-method-parameter (method param)
-  "Return the method parameter PARAM.
-If the `tramp-methods' entry does not exist, return nil."
-  (let ((entry (assoc param (assoc method tramp-methods))))
-    (when entry (cadr entry))))
-
+;;;###tramp-autoload
 (defun tramp-mode-string-to-int (mode-string)
   "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits."
   (let* (case-fold-search
@@ -3516,6 +3513,7 @@ If the `tramp-methods' entry does not exist, return nil."
        (t (error "Tenth char `%c' must be one of `xtT-'"
                  other-execute-or-sticky)))))))
 
+;;;###tramp-autoload
 (defun tramp-local-host-p (vec)
   "Return t if this points to the local host, nil otherwise."
   ;; We cannot use `tramp-file-name-real-host'.  A port is an
@@ -3557,6 +3555,7 @@ If the `tramp-methods' entry does not exist, return nil."
          dir
        (tramp-error vec 'file-error "Directory %s not accessible" dir)))))
 
+;;;###tramp-autoload
 (defun tramp-make-tramp-temp-file (vec)
   "Create a temporary file on the remote host identified by VEC.
 Return the local name of the temporary file."
@@ -3651,6 +3650,7 @@ ALIST is of the form ((FROM . TO) ...)."
 
 ;;; Compatibility functions section:
 
+;;;###tramp-autoload
 (defun tramp-read-passwd (proc &optional prompt)
   "Read a password from user (compat function).
 Consults the auth-source package.
@@ -3701,6 +3701,7 @@ Invokes `password-read' if available, `read-passwd' else."
           (read-passwd pw-prompt))
        (tramp-set-connection-property v "first-password-request" nil)))))
 
+;;;###tramp-autoload
 (defun tramp-clear-passwd (vec)
   "Clear password cache for connection related to VEC."
   (tramp-compat-funcall
@@ -3723,6 +3724,7 @@ Invokes `password-read' if available, `read-passwd' else."
     ("oct" . 10) ("nov" . 11) ("dec" . 12))
   "Alist mapping month names to integers.")
 
+;;;###tramp-autoload
 (defun tramp-time-less-p (t1 t2)
   "Say whether time value T1 is less than time value T2."
   (unless t1 (setq t1 '(0 0)))
@@ -3740,6 +3742,7 @@ Return the difference in the format of a time value."
     (list (- (car t1) (car t2) (if borrow 1 0))
          (- (+ (if borrow 65536 0) (cadr t1)) (cadr t2)))))
 
+;;;###tramp-autoload
 (defun tramp-time-diff (t1 t2)
   "Return the difference between the two times, in seconds.
 T1 and T2 are time values (as returned by `current-time' for example)."
@@ -3834,8 +3837,6 @@ Only works for Bourne-like shells."
 ;;   again.  (Greg Stark)
 ;; * Username and hostname completion.
 ;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode-p'.
-;; ** Unify `tramp-parse-{rhosts,shosts,sconfig,hosts,passwd,netrc}'.
-;;    Code is nearly identical.
 ;; * Make `tramp-default-user' obsolete.
 ;; * Implement a general server-local-variable mechanism, as there are
 ;;   probably other variables that need different values for different
@@ -3856,9 +3857,6 @@ Only works for Bourne-like shells."
 ;; * Run emerge on two remote files.  Bug is described here:
 ;;   <http://www.mail-archive.com/tramp-devel@nongnu.org/msg01041.html>.
 ;;   (Bug#6850)
-;; * It would be very useful if it were possible to load or save a
-;;   buffer using Tramp in a non-blocking way so that use of Emacs on
-;;   other buffers could continue.  (Bug#9617)
 
 ;;; tramp.el ends here
 
index f028c6e943f67be93e71523c1e239ffa306f8db1..499af730788cc58e9596fc748dfbbbb0f1c51e95 100644 (file)
@@ -31,7 +31,7 @@
 ;; should be changed only there.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.2.3-24.1"
+(defconst tramp-version "2.2.6-pre"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -44,7 +44,7 @@
                      (= emacs-major-version 21)
                      (>= emacs-minor-version 4)))
             "ok"
-          (format "Tramp 2.2.3-24.1 is not fit for %s"
+          (format "Tramp 2.2.6-pre is not fit for %s"
                   (when (string-match "^.*$" (emacs-version))
                     (match-string 0 (emacs-version)))))))
   (unless (string-match "\\`ok\\'" x) (error "%s" x)))
index 4b8fbe1e2cfa0b84211a1bac0748df6166db4e3c..232e5ca581af8f8bbd5d7f928689eb99392905b0 100644 (file)
@@ -276,7 +276,7 @@ function and the `webjump-sites' variable.")
 
 (defvar webjump-sites
   webjump-sample-sites
-  "*Hotlist for WebJump.
+  "Hotlist for WebJump.
 
 The hotlist is represented as an association list, with the CAR of each cell
 being the name of the Web site, and the CDR being the definition for the URL of
index f47eeda8d975eb9c87690f758367e2241f842ecd..585e5eed52d73bcd4d340ad891cb9ac4e5161ca6 100644 (file)
 
 ;;; Code:
 
-;; D-Bus support in the Emacs core can be disabled with configuration
-;; option "--without-dbus".  Declare used subroutines and variables.
-(declare-function dbus-call-method "dbusbind.c")
-(declare-function dbus-register-signal "dbusbind.c")
-
 (require 'dbus)
 
-;; Pacify byte compiler.
-(eval-when-compile
-  (require 'cl))
-
 ;; Widgets are used to highlight the search results.
 (require 'widget)
 (require 'wid-edit)
@@ -414,24 +405,24 @@ If there is no registered search engine at all, the function returns `nil'."
        ;; That is not the case now, so we set it ourselves.
        ;; Hopefully, this will change later.
        (setq hit-fields
-             (case (intern vendor-id)
-               (Beagle
+             (pcase (intern vendor-id)
+               (`Beagle
                 '("xesam:mimeType" "xesam:url"))
-               (Strigi
+               (`Strigi
                 '("xesam:author" "xesam:cc" "xesam:charset"
                   "xesam:contentType" "xesam:fileExtension"
                   "xesam:id" "xesam:lineCount" "xesam:links"
                   "xesam:mimeType" "xesam:name" "xesam:size"
                   "xesam:sourceModified" "xesam:subject" "xesam:to"
                   "xesam:url"))
-               (TrackerXesamSession
+               (`TrackerXesamSession
                 '("xesam:relevancyRating" "xesam:url"))
-               (Debbugs
+               (`Debbugs
                 '("xesam:keyword" "xesam:owner" "xesam:title"
                   "xesam:url" "xesam:sourceModified" "xesam:mimeType"
                   "debbugs:key"))
                ;; xesam-tools yahoo service.
-               (t '("xesam:contentModified" "xesam:mimeType" "xesam:summary"
+               (_ '("xesam:contentModified" "xesam:mimeType" "xesam:summary"
                     "xesam:title" "xesam:url" "yahoo:displayUrl"))))
 
        (xesam-set-property engine "hit.fields" hit-fields)
@@ -449,7 +440,7 @@ If there is no registered search engine at all, the function returns `nil'."
 
 (defvar xesam-mode-map
   (let ((map (copy-keymap special-mode-map)))
-    (set-keymap-parent xesam-mode-map widget-keymap)
+    (set-keymap-parent map widget-keymap)
     map))
 
 (define-derived-mode xesam-mode special-mode "Xesam"
index b994cdeaa685510ec5e58c769dff15abbd476df7..6a1a009410b76b678d6b59262c10e3f256a6a75d 100644 (file)
 ;;  Pacify byte-compiler.  D-Bus support in the Emacs core can be
 ;; disabled with configuration option "--without-dbus".  Declare used
 ;; subroutines and variables of `dbus' therefore.
-(eval-when-compile
-  (require 'cl))
-
-(declare-function dbus-call-method "dbusbind.c")
-(declare-function dbus-register-signal "dbusbind.c")
 (defvar dbus-debug)
 
 (require 'dbus)
@@ -548,7 +543,7 @@ DOMAIN is nil, the local domain is used."
    ((string-equal (dbus-event-member-name last-input-event) "ItemNew")
     ;; Parameters: (interface protocol type domain flags)
     ;; Register a service browser.
-    (let ((object-path (zeroconf-register-service-browser (nth-value 2 val))))
+    (let ((object-path (zeroconf-register-service-browser (nth 2 val))))
       ;; Register the signals.
       (dolist (member '("ItemNew" "ItemRemove" "Failure"))
        (dbus-register-signal
index 40bb36daf45927ee010e83c5c38cfc813d11da37..5c8829ff72ed3ed360a9fb31ae6d640a2140c8c4 100644 (file)
@@ -102,30 +102,35 @@ Comments might be indented to a different value in order not to go beyond
   :type 'integer
   :group 'comment)
 (make-variable-buffer-local 'comment-column)
-;;;###autoload(put 'comment-column 'safe-local-variable 'integerp)
+;;;###autoload
+(put 'comment-column 'safe-local-variable 'integerp)
 
 ;;;###autoload
 (defvar comment-start nil
-  "*String to insert to start a new comment, or nil if no comment syntax.")
-;;;###autoload(put 'comment-start 'safe-local-variable 'string-or-null-p)
+  "String to insert to start a new comment, or nil if no comment syntax.")
+;;;###autoload
+(put 'comment-start 'safe-local-variable 'string-or-null-p)
 
 ;;;###autoload
 (defvar comment-start-skip nil
-  "*Regexp to match the start of a comment plus everything up to its body.
+  "Regexp to match the start of a comment plus everything up to its body.
 If there are any \\(...\\) pairs, the comment delimiter text is held to begin
 at the place matched by the close of the first pair.")
-;;;###autoload(put 'comment-start-skip 'safe-local-variable 'string-or-null-p)
+;;;###autoload
+(put 'comment-start-skip 'safe-local-variable 'string-or-null-p)
 
 ;;;###autoload
 (defvar comment-end-skip nil
   "Regexp to match the end of a comment plus everything back to its body.")
-;;;###autoload(put 'comment-end-skip 'safe-local-variable 'string-or-null-p)
+;;;###autoload
+(put 'comment-end-skip 'safe-local-variable 'string-or-null-p)
 
 ;;;###autoload
 (defvar comment-end (purecopy "")
-  "*String to insert to end a new comment.
+  "String to insert to end a new comment.
 Should be an empty string if comments are terminated by end-of-line.")
-;;;###autoload(put 'comment-end 'safe-local-variable 'string-or-null-p)
+;;;###autoload
+(put 'comment-end 'safe-local-variable 'string-or-null-p)
 
 ;;;###autoload
 (defvar comment-indent-function 'comment-indent-default
@@ -269,6 +274,19 @@ makes the comment easier to read.  Default is 1.  nil means 0."
   :type '(choice string integer (const nil))
   :group 'comment)
 
+(defcustom comment-inline-offset 1
+  "Inline comments have to be preceded by at least this many spaces.
+This is useful when style-conventions require a certain minimal offset.
+Python's PEP8 for example recommends two spaces, so you could do:
+
+\(add-hook 'python-mode-hook
+   (lambda () (set (make-local-variable 'comment-inline-offset) 2)))
+
+See `comment-padding' for whole-line comments."
+  :version "24.2"
+  :type 'integer
+  :group 'comment)
+
 ;;;###autoload
 (defcustom comment-multi-line nil
   "Non-nil means `comment-indent-new-line' continues comments.
@@ -587,7 +605,7 @@ Point is expected to be at the start of the comment."
                    (save-excursion (end-of-line) (current-column)))))
         (other nil)
         (min (save-excursion (skip-chars-backward " \t")
-                             (if (bolp) 0 (1+ (current-column))))))
+                             (if (bolp) 0 (+ comment-inline-offset (current-column))))))
     ;; Fix up the range.
     (if (< max min) (setq max min))
     ;; Don't move past the fill column.
@@ -687,7 +705,8 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any."
          (save-excursion
            (skip-chars-backward " \t")
            (unless (bolp)
-             (setq indent (max indent (1+ (current-column))))))
+             (setq indent (max indent
+                                (+ (current-column) comment-inline-offset)))))
          ;; If that's different from comment's current position, change it.
          (unless (= (current-column) indent)
            (delete-region (point) (progn (skip-chars-backward " \t") (point)))
index b825eb65abfbdbda752f445bbc6226196130712a..c762bb104eed8b795f0aa2d56b257e57b0f74d8e 100644 (file)
@@ -23,7 +23,7 @@
 ;;; Commentary:
 
 ;; This package provides an implementation of the Desktop Notifications
-;; <http://www.galago-project.org/specs/notification/>.
+;; <http://developer.gnome.org/notification-spec/>.
 
 ;; In order to activate this package, you must add the following code
 ;; into your .emacs:
 ;; active D-Bus session bus.
 
 ;;; Code:
-(eval-when-compile
-  (require 'cl))
-
-;; Pacify byte-compiler.  D-Bus support in the Emacs core can be
-;; disabled with configuration option "--without-dbus".  Declare used
-;; subroutines and variables of `dbus' therefore.
-(declare-function dbus-call-method "dbusbind.c")
-(declare-function dbus-register-signal "dbusbind.c")
-
 (require 'dbus)
 
-(defconst notifications-specification-version "1.1"
+(defconst notifications-specification-version "1.2"
   "The version of the Desktop Notifications Specification implemented.")
 
 (defconst notifications-application-name "Emacs"
   "D-Bus notifications service path.")
 
 (defconst notifications-interface "org.freedesktop.Notifications"
-  "D-Bus notifications service path.")
+  "D-Bus notifications service interface.")
 
 (defconst notifications-notify-method "Notify"
-  "D-Bus notifications service path.")
+  "D-Bus notifications notify method.")
 
 (defconst notifications-close-notification-method "CloseNotification"
-  "D-Bus notifications service path.")
+  "D-Bus notifications close notification method.")
+
+(defconst notifications-get-capabilities-method "GetCapabilities"
+  "D-Bus notifications get capabilities method.")
 
 (defconst notifications-action-signal "ActionInvoked"
   "D-Bus notifications action signal.")
@@ -154,6 +148,8 @@ Various PARAMS can be set:
                  Default value is -1.
  :urgency        The urgency level.
                  Either `low', `normal' or `critical'.
+ :action-items   Whether the TITLE of the actions is interpreted as
+                 a named icon.
  :category       The type of notification this is.
  :desktop-entry  This specifies the name of the desktop filename representing
                  the calling program.
@@ -170,6 +166,11 @@ Various PARAMS can be set:
                  be \"message-new-instant\".
  :suppress-sound Causes the server to suppress playing any sounds, if it has
                  that ability.
+ :resident       When set the server will not automatically remove the
+                 notification when an action has been invoked.
+ :transient      When set the server will treat the notification as transient
+                 and by-pass the server's persistence capability, if it
+                 should exist.
  :x              Specifies the X location on the screen that the notification
                  should point to.  The \"y\" hint must also be specified.
  :y              Specifies the Y location on the screen that the notification
@@ -188,6 +189,9 @@ Various PARAMS can be set:
                    - `undefined' if the notification server hasn't provided
                      a reason
 
+Which parameters are accepted by the notification server can be
+checked via `notifications-get-capabilities'.
+
 This function returns a notification id, an integer, which can be
 used to manipulate the notification item with
 `notifications-close-notification' or the `:replaces-id' argument
@@ -206,9 +210,12 @@ of another `notifications-notify' call."
         (desktop-entry (plist-get params :desktop-entry))
         (image-data (plist-get params :image-data))
         (image-path (plist-get params :image-path))
+       (action-items (plist-get params :action-items))
         (sound-file (plist-get params :sound-file))
         (sound-name (plist-get params :sound-name))
         (suppress-sound (plist-get params :suppress-sound))
+       (resident (plist-get params :resident))
+       (transient (plist-get params :transient))
         (x (plist-get params :x))
         (y (plist-get params :y))
         id)
@@ -216,10 +223,10 @@ of another `notifications-notify' call."
     (when urgency
       (add-to-list 'hints `(:dict-entry
                             "urgency"
-                            (:variant :byte ,(case urgency
-                                               (low 0)
-                                               (critical 2)
-                                               (t 1)))) t))
+                            (:variant :byte ,(pcase urgency
+                                               (`low 0)
+                                               (`critical 2)
+                                               (_ 1)))) t))
     (when category
       (add-to-list 'hints `(:dict-entry
                             "category"
@@ -230,12 +237,16 @@ of another `notifications-notify' call."
                             (:variant :string ,desktop-entry)) t))
     (when image-data
       (add-to-list 'hints `(:dict-entry
-                            "image_data"
+                            "image-data"
                             (:variant :struct ,image-data)) t))
     (when image-path
       (add-to-list 'hints `(:dict-entry
-                            "image_path"
+                            "image-path"
                             (:variant :string ,image-path)) t))
+    (when action-items
+      (add-to-list 'hints `(:dict-entry
+                            "action-items"
+                            (:variant :boolean ,action-items)) t))
     (when sound-file
       (add-to-list 'hints `(:dict-entry
                             "sound-file"
@@ -248,6 +259,14 @@ of another `notifications-notify' call."
       (add-to-list 'hints `(:dict-entry
                             "suppress-sound"
                             (:variant :boolean ,suppress-sound)) t))
+    (when resident
+      (add-to-list 'hints `(:dict-entry
+                            "resident"
+                            (:variant :boolean ,resident)) t))
+    (when transient
+      (add-to-list 'hints `(:dict-entry
+                            "transient"
+                            (:variant :boolean ,transient)) t))
     (when x
       (add-to-list 'hints `(:dict-entry "x" (:variant :int32 ,x)) t))
     (when y
@@ -322,4 +341,36 @@ of another `notifications-notify' call."
                     notifications-close-notification-method
                     :int32 id))
 
+(defvar dbus-debug) ; used in the macroexpansion of dbus-ignore-errors
+
+(defun notifications-get-capabilities ()
+  "Return the capabilities of the notification server, a list of strings.
+The following capabilities can be expected:
+
+  :actions         The server will provide the specified actions
+                   to the user.
+  :action-icons    Supports using icons instead of text for
+                   displaying actions.
+  :body            Supports body text.
+  :body-hyperlinks The server supports hyperlinks in the notifications.
+  :body-images     The server supports images in the notifications.
+  :body-markup     Supports markup in the body text.
+  :icon-multi      The server will render an animation of all the
+                   frames in a given image array.
+  :icon-static     Supports display of exactly 1 frame of any
+                   given image array.  This value is mutually exclusive
+                   with `:icon-multi'.
+  :persistence     The server supports persistence of notifications.
+  :sound           The server supports sounds on notifications.
+
+Further vendor-specific caps start with `:x-vendor', like `:x-gnome-foo-cap'."
+  (dbus-ignore-errors
+   (mapcar
+    (lambda (x) (intern (concat ":" x)))
+    (dbus-call-method :session
+                     notifications-service
+                     notifications-path
+                     notifications-interface
+                     notifications-get-capabilities-method))))
+
 (provide 'notifications)
index a5d38a3a57f753f94b328a316cfb69c88880876c..bcc94c86c9d86936fa9565a80609062fdc85d463 100644 (file)
 ;; The command is found in this-command
 ;; and the keys are returned by (this-command-keys).
 
-(eval-when-compile (require 'cl))
-
+;;;###autoload
+(define-obsolete-variable-alias 'disabled-command-hook
+  'disabled-command-function "22.1")
 ;;;###autoload
 (defvar disabled-command-function 'disabled-command-function
   "Function to call to handle disabled commands.
 If nil, the feature is disabled, i.e., all commands work normally.")
 
-;;;###autoload
-(define-obsolete-variable-alias 'disabled-command-hook 'disabled-command-function "22.1")
-
 ;; It is ok here to assume that this-command is a symbol
 ;; because we won't get called otherwise.
 ;;;###autoload
@@ -101,7 +99,7 @@ SPC to try the command just this once, but leave it disabled.
         (ding)
         (message "Please type y, n, ! or SPC (the space bar): "))))
     (setq char (downcase char))
-    (case char
+    (pcase char
      (?\C-g (setq quit-flag t))
      (?! (setq disabled-command-function nil))
      (?y
index ba940cd513eb491af2c801492f884935fe810a46..86b14e66398402887506eb39fb240b77612de6f7 100644 (file)
@@ -25,7 +25,7 @@
 ;; The entry point to this file is `nxml-glyph-display-string'.
 ;; The current implementation is heuristic due to a lack of
 ;; Emacs primitives necessary to implement it properly.  The user
-;; can tweak the heuristics using `nxml-glyph-set-hook'.
+;; can tweak the heuristics using `nxml-glyph-set-functions'.
 
 ;;; Code:
 
@@ -332,21 +332,26 @@ This repertoire is supported for the following fonts:
    (#xFB01 . #xFB02)]
   "Glyph set corresponding to Windows Glyph List 4.")
 
-(defvar nxml-glyph-set-hook nil
-  "*Hook for determining the set of glyphs in a face.
-The hook will receive a single argument FACE.  If it can determine
-the set of glyphs representable by FACE, it must set the variable
-`nxml-glyph-set' and return non-nil.  Otherwise, it must return nil.
-The hook will be run until success.  The constants
-`nxml-ascii-glyph-set', `nxml-latin1-glyph-set',
+(defvar nxml-glyph-set-functions nil
+  "Abnormal hook for determining the set of glyphs in a face.
+Each function in this hook is called in turn, unless one of them
+returns non-nil.  Each function is called with a single argument
+FACE.  If it can determine the set of glyphs representable by
+FACE, it must set the variable `nxml-glyph-set' and return
+non-nil.  Otherwise, it must return nil.
+
+The constants `nxml-ascii-glyph-set', `nxml-latin1-glyph-set',
 `nxml-misc-fixed-1-glyph-set', `nxml-misc-fixed-2-glyph-set',
 `nxml-misc-fixed-3-glyph-set' and `nxml-wgl4-glyph-set' are
-predefined for use by `nxml-glyph-set-hook'.")
+predefined for use by `nxml-glyph-set-functions'.")
+
+(define-obsolete-variable-alias 'nxml-glyph-set-hook
+  'nxml-glyph-set-functions "24.2")
 
 (defvar nxml-glyph-set nil
-  "Used by `nxml-glyph-set-hook' to return set of glyphs in a FACE.
+  "Used by `nxml-glyph-set-functions' to return set of glyphs in a FACE.
 This should dynamically bound by any function that runs
-`nxml-glyph-set-hook'.  The value must be either nil representing an
+`nxml-glyph-set-functions'.  The value must be either nil representing an
 empty set or a vector. Each member of the vector is either a single
 integer or a cons (FIRST . LAST) representing the range of integers
 from FIRST to LAST.  An integer represents a glyph with that Unicode
@@ -367,7 +372,7 @@ code-point.  The vector must be ordered.")
 (defun nxml-terminal-set-glyph-set (face)
   (setq nxml-glyph-set nxml-ascii-glyph-set))
 
-(add-hook 'nxml-glyph-set-hook
+(add-hook 'nxml-glyph-set-functions
          (or (cdr (assq window-system
                         '((x . nxml-x-set-glyph-set)
                           (w32 . nxml-w32-set-glyph-set)
@@ -381,7 +386,7 @@ code-point.  The vector must be ordered.")
 FACE gives the face that will be used for displaying the string.
 Return nil if the face cannot display a glyph for N."
   (let ((nxml-glyph-set nil))
-    (run-hook-with-args-until-success 'nxml-glyph-set-hook face)
+    (run-hook-with-args-until-success 'nxml-glyph-set-functions face)
     (and nxml-glyph-set
         (nxml-glyph-set-contains-p n nxml-glyph-set)
         (let ((ch (decode-char 'ucs n)))
index f9122e7245e70786a97650593a52b8d5e51f4680..1e0e692be265218d2923253d8f338a51a6f812ad 100644 (file)
@@ -29,7 +29,7 @@
 (when (featurep 'mucs)
   (error "nxml-mode is not compatible with Mule-UCS"))
 
-(eval-when-compile (require 'cl))      ; for assert
+(eval-when-compile (require 'cl-lib))
 
 (require 'xmltok)
 (require 'nxml-enc)
@@ -54,9 +54,9 @@
 
 (defcustom nxml-char-ref-display-glyph-flag t
   "Non-nil means display glyph following character reference.
-The glyph is displayed in face `nxml-glyph'.  The hook
-`nxml-glyph-set-hook' can be used to customize for which characters
-glyphs are displayed."
+The glyph is displayed in face `nxml-glyph'.  The abnormal hook
+`nxml-glyph-set-functions' can be used to change the characters
+for which glyphs are displayed."
   :group 'nxml
   :type 'boolean)
 
@@ -930,16 +930,16 @@ Called with `font-lock-beg' and `font-lock-end' dynamically bound."
     (nxml-debug-change "nxml-fontify-matcher" (point) bound)
 
     (when (< (point) nxml-prolog-end)
-      ;; prolog needs to be fontified in one go, and
+      ;; Prolog needs to be fontified in one go, and
       ;; nxml-extend-region makes sure we start at BOB.
-      (assert (bobp))
+      (cl-assert (bobp))
       (nxml-fontify-prolog)
       (goto-char nxml-prolog-end))
 
     (let (xmltok-dependent-regions
           xmltok-errors)
       (while (and (nxml-tokenize-forward)
-                  (<= (point) bound)) ; intervals are open-ended
+                  (<= (point) bound))   ; Intervals are open-ended.
         (nxml-apply-fontify-rule)))
 
     (setq nxml-last-fontify-end (point)))
@@ -1236,7 +1236,7 @@ on the line, reindent the line."
     (unless arg
       (if nxml-slash-auto-complete-flag
          (if end-tag-p
-             (condition-case err
+             (condition-case nil
                  (let ((start-tag-end
                         (nxml-scan-element-backward (1- slash-pos) t)))
                    (when start-tag-end
@@ -1434,7 +1434,7 @@ its line.  Otherwise return nil."
                 (nxml-token-after)
                 (= xmltok-start bol))
               (eq xmltok-type 'data))
-          (condition-case err
+          (condition-case nil
               (nxml-scan-element-backward
                (point)
                nil
@@ -1559,8 +1559,7 @@ This expects the xmltok-* variables to be set up as by `xmltok-forward'."
        (off 0))
     (if value-boundary
        ;; inside an attribute value
-       (let ((value-start (car value-boundary))
-             (value-end (cdr value-boundary)))
+       (let ((value-start (car value-boundary)))
          (goto-char pos)
          (forward-line -1)
          (if (< (point) value-start)
@@ -1753,7 +1752,7 @@ single name.  A character reference contains a character number."
         xmltok-name-end)
        (t end)))
 
-(defun nxml-scan-backward-within (end)
+(defun nxml-scan-backward-within (_end)
   (setq xmltok-start
        (+ xmltok-start
           (nxml-start-delimiter-length xmltok-type)))
@@ -2263,7 +2262,7 @@ ENDP is t in the former case, nil in the latter."
                 'nxml-in-mixed-content-hook))
           nil)
          ;; See if the matching tag does not start or end a line.
-         ((condition-case err
+         ((condition-case nil
               (progn
                 (setq matching-tag-pos
                       (xmltok-save
@@ -2401,7 +2400,7 @@ Repeating \\[nxml-dynamic-markup-word] immediately after successful
 \\[nxml-dynamic-markup-word] removes the previously inserted markup
 and attempts to find another possible way to do the markup."
   (interactive "*")
-  (let (search-start-pos done)
+  (let (search-start-pos)
     (if (and (integerp nxml-dynamic-markup-prev-pos)
             (= nxml-dynamic-markup-prev-pos (point))
             (eq last-command this-command)
index cf8cc820cecb582f9f960f2d8f900d1419b8a080..850c31cfc9ec4921dd2038df658928896fd0f5f5 100644 (file)
@@ -109,23 +109,20 @@ See the variable `nxml-section-element-name-regexp' for more details."
   :group 'nxml
   :type 'integer)
 
-(defface nxml-heading
-  '((t (:weight bold)))
-  "Face used for the contents of abbreviated heading elements."
+(defface nxml-heading '((t :weight bold))
+  "Face for the contents of abbreviated heading elements."
   :group 'nxml-faces)
 
-(defface nxml-outline-indicator
-  '((t (:inherit default)))
-  "Face used for `+' or `-' before element names in outlines."
+(defface nxml-outline-indicator '((t))
+  "Face for `+' or `-' before element names in outlines."
   :group 'nxml-faces)
 
 (defface nxml-outline-active-indicator
-  '((t (:box t :inherit nxml-outline-indicator)))
-  "Face used for clickable `+' or `-' before element names in outlines."
+  '((t :box t :inherit nxml-outline-indicator))
+  "Face for clickable `+' or `-' before element names in outlines."
   :group 'nxml-faces)
 
-(defface nxml-outline-ellipsis
-  '((t (:bold t :inherit default)))
+(defface nxml-outline-ellipsis '((t :weight bold))
   "Face used for `...' in outlines."
   :group 'nxml-faces)
 
index 1047ead1b13a3d2cb7ff664b08ba5613efa4cbf7..a587c14e01a0f67d495bbb0cf307044fdf69ac5f 100644 (file)
@@ -54,7 +54,7 @@
   :group 'relax-ng)
 
 (defvar rng-complete-end-tags-after-< t
-  "*Non-nil means immediately after < complete on end-tag names.
+  "Non-nil means immediately after < complete on end-tag names.
 Complete on start-tag names regardless.")
 
 (defvar rng-nxml-easy-menu
similarity index 92%
rename from lisp/emacs-lisp/assoc.el
rename to lisp/obsolete/assoc.el
index 264374ed7216d9465851de0d452a4ebc71cc7281..d0738dfeb2c30a96c90e383c1de71d0992ef0927 100644 (file)
@@ -1,9 +1,10 @@
-;;; assoc.el --- insert/delete functions on association lists
+;;; assoc.el --- insert/delete functions on association lists  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1996, 2001-2012  Free Software Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <bwarsaw@cen.com>
 ;; Keywords: extensions
+;; Obsolete-since: 24.2
 
 ;; This file is part of GNU Emacs.
 
@@ -36,7 +37,7 @@ the order of any other key-value pair.  Side effect sets alist to new
 sorted list."
   (set alist-symbol
        (sort (copy-alist (symbol-value alist-symbol))
-            (function (lambda (a b) (equal (car a) key))))))
+             (lambda (a _b) (equal (car a) key)))))
 
 
 (defun aelement (key value)
@@ -71,8 +72,8 @@ If VALUE is not supplied, or is nil, the key-value pair will not be
 modified, but will be moved to the head of the alist.  If the key-value
 pair cannot be found in the alist, it will be inserted into the head
 of the alist (with value nil if VALUE is nil or not supplied)."
-  (lexical-let ((elem (aelement key value))
-               alist)
+  (let ((elem (aelement key value))
+        alist)
     (asort alist-symbol key)
     (setq alist (symbol-value alist-symbol))
     (cond ((null alist) (set alist-symbol elem))
@@ -86,7 +87,7 @@ of the alist (with value nil if VALUE is nil or not supplied)."
 Alist is referenced by ALIST-SYMBOL and the key-value pair to remove
 is pair matching KEY.  Returns the altered alist."
   (asort alist-symbol key)
-  (lexical-let ((alist (symbol-value alist-symbol)))
+  (let ((alist (symbol-value alist-symbol)))
     (cond ((null alist) nil)
          ((anot-head-p alist key) alist)
          (t (set alist-symbol (cdr alist))))))
@@ -101,6 +102,7 @@ returned.
 
 If no key-value pair matching KEY could be found in ALIST, or ALIST is
 nil then nil is returned.  ALIST is not altered."
+  (defvar copy)
   (let ((copy (copy-alist alist)))
     (cond ((null alist) nil)
          ((progn (asort 'copy key)
@@ -123,10 +125,10 @@ KEYLIST and VALUELIST should have the same number of elements, but
 this isn't enforced.  If VALUELIST is smaller than KEYLIST, remaining
 keys are associated with nil.  If VALUELIST is larger than KEYLIST,
 extra values are ignored.  Returns the created alist."
-  (lexical-let ((keycar (car keylist))
-               (keycdr (cdr keylist))
-               (valcar (car valuelist))
-               (valcdr (cdr valuelist)))
+  (let ((keycar (car keylist))
+        (keycdr (cdr keylist))
+        (valcar (car valuelist))
+        (valcdr (cdr valuelist)))
     (cond ((null keycdr)
           (aput alist-symbol keycar valcar))
          (t
similarity index 99%
rename from lisp/play/bruce.el
rename to lisp/obsolete/bruce.el
index b8b2f53097d3683237b1f988ef7c82f684b3a204..1dd69c129a0bc61248d9d4e5f317fa21a28d96e7 100644 (file)
@@ -6,6 +6,7 @@
 ;; Maintainer: FSF
 ;; Keywords: games
 ;; Created: Jan 1997
+;; Obsolete-since: 24.2
 
 ;; This file is part of GNU Emacs.
 
similarity index 99%
rename from lisp/emacs-lisp/cust-print.el
rename to lisp/obsolete/cust-print.el
index b456d59e8dacf3752d29c6c517f1125309d9d783..6be200d245cbaf24a4844df788750938fe14d3fb 100644 (file)
@@ -1,10 +1,11 @@
 ;;; cust-print.el --- handles print-level and print-circle
 
-;; Copyright (C) 1992, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <liberte@holonexus.org>
 ;; Adapted-By: ESR
 ;; Keywords: extensions
+;; Obsolete-since: 24.2
 
 ;; LCD Archive Entry:
 ;; cust-print|Daniel LaLiberte|liberte@holonexus.org
index 6cc45c21727440703b1d01551c42c72aeb0a71d5..8e939169a6074e21edca3416db4017073252687f 100644 (file)
@@ -73,7 +73,7 @@ or you may use an arbitrary lisp expression."
   :group 'erc-hecomplete)
 
 (defcustom erc-nick-completion-ignore-case t
-  "*Non-nil means don't consider case significant in nick completion.
+  "Non-nil means don't consider case significant in nick completion.
 Case will be automatically corrected when non-nil.
 For instance if you type \"dely TAB\" the word completes and changes to
 \"delYsid\"."
@@ -92,7 +92,7 @@ typing \"f o TAB\" will directly give you foobar.  Use this with
    (erc-get-channel-nickname-list)))
 
 (defcustom erc-nick-completion-postfix ": "
-  "*When `erc-complete' is used in the first word after the prompt,
+  "When `erc-complete' is used in the first word after the prompt,
 add this string when a unique expansion was found."
   :group 'erc-hecomplete
   :type 'string)
index 9eb1d0569f0dfa308e377ada4be683fb29fe235e..125a5dbf6e01f7fac400156eda718e5bef0d99cb 100644 (file)
 ;; User Variables:
 
 (defcustom fast-lock-minimum-size 25600
-  "*Minimum size of a buffer for cached fontification.
+  "Minimum size of a buffer for cached fontification.
 Only buffers more than this can have associated Font Lock cache files saved.
 If nil, means cache files are never created.
 If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE),
@@ -271,7 +271,7 @@ for buffers in Rmail mode, and size is irrelevant otherwise."
 (defcustom fast-lock-cache-directories '("~/.emacs-flc")
 ; - `internal', keep each file's Font Lock cache file in the same file.
 ; - `external', keep each file's Font Lock cache file in the same directory.
-  "*Directories in which Font Lock cache files are saved and read.
+  "Directories in which Font Lock cache files are saved and read.
 Each item should be either DIR or a cons pair of the form (REGEXP . DIR) where
 DIR is a directory name (relative or absolute) and REGEXP is a regexp.
 
@@ -297,7 +297,7 @@ to avoid the possibility of using the cache of another user."
 (put 'fast-lock-cache-directories 'risky-local-variable t)
 
 (defcustom fast-lock-save-events '(kill-buffer kill-emacs)
-  "*Events under which caches will be saved.
+  "Events under which caches will be saved.
 Valid events are `save-buffer', `kill-buffer' and `kill-emacs'.
 If concurrent editing sessions use the same associated cache file for a file's
 buffer, then you should add `save-buffer' to this list."
@@ -307,14 +307,14 @@ buffer, then you should add `save-buffer' to this list."
   :group 'fast-lock)
 
 (defcustom fast-lock-save-others t
-  "*If non-nil, save Font Lock cache files irrespective of file owner.
+  "If non-nil, save Font Lock cache files irrespective of file owner.
 If nil, means only buffer files known to be owned by you can have associated
 Font Lock cache files saved.  Ownership may be unknown for networked files."
   :type 'boolean
   :group 'fast-lock)
 
 (defcustom fast-lock-verbose font-lock-verbose
-  "*If non-nil, means show status messages for cache processing.
+  "If non-nil, means show status messages for cache processing.
 If a number, only buffers greater than this size have processing messages."
   :type '(choice (const :tag "never" nil)
                 (other :tag "always" t)
index 5a7e99197b85fb12fd1b31649d939cfe34331ea6..7e81c4bfb9d183cda04b5318fa22ed39f19d445a 100644 (file)
@@ -73,7 +73,7 @@
   :group 'i18n)
 
 (defcustom iso-accents-insert-offset nonascii-insert-offset
-  "*Offset added by ISO Accents mode to character codes 0200 and above."
+  "Offset added by ISO Accents mode to character codes 0200 and above."
   :type 'integer
   :group 'iso-acc)
 
@@ -262,7 +262,7 @@ Change it with the `iso-accents-customize' function.")
   "Association list for ISO accent combinations, for the chosen language.")
 
 (defcustom iso-accents-mode nil
-  "*Non-nil enables ISO Accents mode.
+  "Non-nil enables ISO Accents mode.
 Setting this variable makes it local to the current buffer.
 See the function `iso-accents-mode'."
   :type 'boolean
@@ -270,7 +270,7 @@ See the function `iso-accents-mode'."
 (make-variable-buffer-local 'iso-accents-mode)
 
 (defcustom iso-accents-enable '(?' ?` ?^ ?\" ?~ ?/)
-  "*List of accent keys that become prefixes in ISO Accents mode.
+  "List of accent keys that become prefixes in ISO Accents mode.
 The default is (?' ?` ?^ ?\" ?~ ?/), which contains all the supported
 accent keys.  If you set this variable to a list in which some of those
 characters are missing, the missing ones do not act as accents.
similarity index 98%
rename from lisp/ledit.el
rename to lisp/obsolete/ledit.el
index d9a2b4c5c47fc8e3c75537524aa8bcc5e86fc500..08e71aa5d2ddb038fdce425181239ad6b1f7e531 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: languages
+;; Obsolete-since: 24.2
 
 ;; This file is part of GNU Emacs.
 
@@ -22,7 +23,7 @@
 
 ;;; Commentary:
 
-;; This is a major mode for editing Liszt.  See etc/LEDIT for details.
+;; This is a major mode for editing Liszt.
 
 ;;; Code:
 
similarity index 99%
rename from lisp/mail/mailpost.el
rename to lisp/obsolete/mailpost.el
index 7c4bea830d8f5fc93dcff6c5de96306a950f490b..158523e8ef2ec3a6e4b8bd275c7a572ded042c75 100644 (file)
@@ -9,6 +9,7 @@
 ;; Maintainer: FSF
 ;; Created: 13 Jan 1986
 ;; Keywords: mail
+;; Obsolete-since: 24.2
 
 ;;; Commentary:
 
similarity index 99%
rename from lisp/mouse-sel.el
rename to lisp/obsolete/mouse-sel.el
index 6323ef0369610224af016e6524ea00fa40cf7f91..45396d30ea5595934e0fa6f4d76d65f85fbc1c57 100644 (file)
@@ -4,6 +4,7 @@
 
 ;; Author: Mike Williams <mdub@bigfoot.com>
 ;; Keywords: mouse
+;; Obsolete-since: 24.2
 
 ;; This file is part of GNU Emacs.
 
@@ -262,6 +263,8 @@ kill ring; mouse-1 or mouse-3 kills it."
              interprogram-paste-function
              mouse-sel-original-interprogram-paste-function))))
 
+(make-obsolete 'mouse-sel-mode "use the normal mouse modes" "24.2")
+
 ;;=== Internal Variables/Constants ========================================
 
 (defvar mouse-sel-primary-thing nil
index 3cd5d3a0c38cd01bb6930d095aaba10bd56ee242..02c8115f23a961a685aa7cf7b12b918d903a93ae 100644 (file)
@@ -35,9 +35,9 @@
 ;; 4. Spaces followed by a TAB.  (Almost always, we never want that).
 ;; 5. Spaces or TABS at the end of a line.
 ;;
-;; Whitespace errors are reported in a buffer, and on the modeline.
+;; Whitespace errors are reported in a buffer, and on the mode line.
 ;;
-;; Modeline will show a W:<x>!<y> to denote a particular type of whitespace,
+;; Mode line will show a W:<x>!<y> to denote a particular type of whitespace,
 ;; where `x' and `y' can be one (or more) of:
 ;;
 ;; e - End-of-Line whitespace.
@@ -46,7 +46,7 @@
 ;; s - Space followed by Tab.
 ;; t - Trailing whitespace.
 ;;
-;; If any of the whitespace checks is turned off, the modeline will display a
+;; If any of the whitespace checks is turned off, the mode line will display a
 ;; !<y>.
 ;;
 ;;     (since (3) is the most controversial one, here is the rationale: Most
@@ -230,7 +230,7 @@ this variable."
   :group 'whitespace)
 
 (defcustom whitespace-silent nil
-  "All whitespace errors will be shown only in the modeline when t.
+  "All whitespace errors will be shown only in the mode line when t.
 
 Note that setting this may cause all whitespaces introduced in a file to go
 unnoticed when the buffer is killed, unless the user visits the `*Whitespace
@@ -653,7 +653,7 @@ If highlighting is enabled, highlight these characters."
       nil)))
 
 (defun whitespace-update-modeline (&optional whitespace-err)
-  "Update modeline with whitespace errors.
+  "Update mode line with whitespace errors.
 Also with whitespaces whose testing has been turned off."
   (if whitespace-display-in-modeline
       (progn
similarity index 96%
rename from lisp/patcomp.el
rename to lisp/obsolete/patcomp.el
index c1965a763ca037f7298b0ac6a4be11e187ddbb2e..b8304143e9f9eb26bd33bf2fd04881bcedcf55a5 100644 (file)
@@ -2,6 +2,8 @@
 
 ;; This file is part of GNU Emacs.
 
+;; Obsolete-since: 24.2
+
 ;;; Commentary:
 
 ;;; Code:
index 905ea07459a90fe120f3fbed35f0d3ad39821ac4..0d4c815722e6c193546db5c582aee77d01aac160 100644 (file)
@@ -47,7 +47,7 @@
 ;;; Code:
 
 (defvar resume-emacs-args-file (expand-file-name "~/.emacs_args")
-  "*This file is where arguments are placed for a suspended Emacs job.")
+  "This file is where arguments are placed for a suspended Emacs job.")
 
 (defvar resume-emacs-args-buffer " *Command Line Args*"
   "Buffer that is used by `resume-process-args'.")
index c46c834338f6027416bdb6669df763a92a4563b7..7ff944c14dfad4a84feeb8c01ce46a314c9753f6 100644 (file)
   "Abbrev table used while in scribe mode.")
 
 (defcustom scribe-fancy-paragraphs nil
-  "*Non-nil makes Scribe mode use a different style of paragraph separation."
+  "Non-nil makes Scribe mode use a different style of paragraph separation."
   :type 'boolean
   :group 'scribe)
 
 (defcustom scribe-electric-quote nil
-  "*Non-nil makes insert of double quote use `` or '' depending on context."
+  "Non-nil makes insert of double quote use `` or '' depending on context."
   :type 'boolean
   :group 'scribe)
 
 (defcustom scribe-electric-parenthesis nil
-  "*Non-nil makes parenthesis char ( (]}> ) automatically insert its close
+  "Non-nil makes parenthesis char ( (]}> ) automatically insert its close
 if typed after an @Command form."
   :type 'boolean
   :group 'scribe)
index dc3b532b537b2e81d2fe214bb7f5e1a4e28e4a51..eae83f044a0e522724ceee0d152d3245092438c5 100644 (file)
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-02  Chong Yidong  <cyd@gnu.org>
 
-       * Version 24.1 released.
+       * org-clock.el (org-clock-string-limit)
+       (org-clock-modeline-total, org-clock-task-overrun-text)
+       (org-clock-mode-line-entry): Doc fix, "modeline" -> "mode line".
 
-2012-05-25 Mark Shoulson <mark@kli.org>  (tiny change)
+2012-05-27  Mark Shoulson  <mark@kli.org>  (tiny change)
 
-       * org.el (org-fontify-entities): Fix bug: The entities \sup[123]
-       and \there4 were not "prettified" when org-pretty-entities was
-       enabled.
+       * org.el (org-fontify-entities): Fix bug: The entities \sup[123] and
+       \there4 were not "prettified" when org-pretty-entities was enabled.
 
-2012-05-25  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-05-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
-       * org.el (org-font-lock-add-priority-faces): Restrict priorities
-       fontification to headlines and inlinetasks.
+       * org.el (org-font-lock-add-priority-faces):
+       Restrict priorities fontification to headlines and inlinetasks.
 
-2012-05-25  Jambunathan K  <kjambunathan@gmail.com>
-
-       * org-odt.el (org-odt-init-outfile): Fix previous commit.  Make
-       sure that nxml-mode is loaded before let-binding
-       `nxml-auto-insert-xml-declaration-flag'.
-
-2012-05-25  Jambunathan K  <kjambunathan@gmail.com>
+2012-05-27  Jambunathan K  <kjambunathan@gmail.com>
 
        * org-odt.el (org-odt-init-outfile)
-       (org-odt-write-manifest-file): Disable
-       `nxml-auto-insert-xml-declaration-flag'.
+       (org-odt-write-manifest-file):
+       Disable `nxml-auto-insert-xml-declaration-flag'.
 
-       * org-lparse.el (org-do-lparse): Don't trigger auto-mode
-       processing.
+       * org-lparse.el (org-do-lparse): Don't trigger auto-mode processing.
 
-2012-05-25  Bastien Guerry  <bzg@gnu.org>
-
-       * org.el (org-scan-tags): Fix bug when building the scanner
-       regexp.
+2012-05-27  Bastien Guerry  <bzg@gnu.org>
 
-2012-05-25  Eric Schulte  <eric.schulte@gmx.com>
+       * org.el (org-scan-tags): Fix bug when building the scanner regexp.
 
-       * ob.el (org-babel-capitalize-examplize-region-markers): Controls
-       the capitalization of begin and end example blocks.
-       (org-babel-examplize-region): Optionally capitalize example block
-       delimiters.
+2012-05-27  Eric Schulte  <eric.schulte@gmx.com>
 
-2012-05-25  Eric Schulte  <eric.schulte@gmx.com>
+       * ob.el (org-babel-capitalize-examplize-region-markers):
+       Controls the capitalization of begin and end example blocks.
+       (org-babel-examplize-region):
+       Optionally capitalize example block delimiters.
 
-       * ob-plantuml.el (org-babel-execute:plantuml): Adding a :java
-       header argument to plantuml.
+       * ob-plantuml.el (org-babel-execute:plantuml):
+       Add a :java header argument to plantuml.
 
-2012-05-25  Eric Schulte  <eric.schulte@gmx.com>
-
-       * org-exp-blocks.el (org-export-blocks-preprocess): Even when the
-       body of a block is not indented the boundary markers should be
-       indented to their original positions so things like list
+       * org-exp-blocks.el (org-export-blocks-preprocess):
+       Even when the body of a block is not indented the boundary markers
+       should be indented to their original positions so things like list
        indentation still work.
 
-2012-05-16  Eric Schulte  <eric.schulte@gmx.com>
+       * ob.el (org-babel-parse-src-block-match):
+       Save match data during indentation check.
 
-       * ob.el (org-babel-parse-src-block-match): Save match data during
-       indentation check.
-
-2012-05-16  Bastien Guerry  <bzg@gnu.org>
+2012-05-27  Bastien Guerry  <bzg@gnu.org>
 
        * org.el (org-scan-tags): Correctly match TODO keywords.
 
-2012-05-16  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-05-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-list.el (org-list-struct): Fix white spaces.
-       (org-list-swap-items, org-list-send-item): Fix visibility
-       preservation.
-
-2012-05-16  Nicolas Goaziou  <n.goaziou@gmail.com>
+       (org-list-swap-items, org-list-send-item): Fix visibility preservation.
 
-       * org-list.el (org-list-swap-items, org-list-send-item): Preserve
-       visibility when moving items.
+       * org-list.el (org-list-swap-items, org-list-send-item):
+       Preserve visibility when moving items.
 
-2012-05-16  Mark E. Shoulson  <mark@kli.org>  (tiny change)
+2012-05-27  Mark E. Shoulson  <mark@kli.org>  (tiny change)
 
-       * org.el (org-fontify-entities): Hide {} when prettifying
-       entities.
+       * org.el (org-fontify-entities): Hide {} when prettifying entities.
 
-2012-05-16  Bastien Guerry  <bzg@gnu.org>
+2012-05-27  Bastien Guerry  <bzg@gnu.org>
 
        * org.el (org-cycle-internal-global): Prevent the display of
        messages when cycling from with a Gnus article buffer.
 
-2012-05-16  Bastien Guerry  <bzg@gnu.org>
+       * org-table.el (org-table-time-seconds-to-string):
+       Fix bug about handling a negative duration value.
 
-       * org-table.el (org-table-time-seconds-to-string): Fix bug about
-       handling a negative duration value.
-
-2012-05-16  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-05-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org.el (org-link-expand-abbrev): Fix docstring.
 
-2012-05-16  Nicolas Goaziou  <n.goaziou@gmail.com>
-
        * org.el (org-translate-link): Fix bug.
 
-2012-05-16  Bastien Guerry  <bzg@gnu.org>
+2012-05-27  Bastien Guerry  <bzg@gnu.org>
 
-       * org-agenda.el (org-agenda-bulk-mark-regexp): Fix bug when
-       setting the number of marked entries.
+       * org-agenda.el (org-agenda-bulk-mark-regexp):
+       Fix bug when setting the number of marked entries.
 
-2012-05-16  Bastien Guerry  <bzg@gnu.org>
-
-       * org-table.el (org-tbl-calc-modes): Rename from
-       `org-table-modes'.
+       * org-table.el (org-tbl-calc-modes): Rename from `org-table-modes'.
        (org-set-calc-mode, org-table-eval-formula): Use it.
 
-2012-05-16  Eric Schulte  <eric.schulte@gmx.com>
+2012-05-27  Eric Schulte  <eric.schulte@gmx.com>
 
-       * ob.el (org-babel-find-named-result): Fix bug finding empty named
-       results.
+       * ob.el (org-babel-find-named-result):
+       Fix bug finding empty named results.
 
-2012-05-16  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-05-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
-       * org.el (org-set-regexps-and-options): Fix
-       `org-planning-or-clock-line-re' regexp.  Indeed "\\>" will never
+       * org.el (org-set-regexps-and-options):
+       Fix `org-planning-or-clock-line-re' regexp.  Indeed "\\>" will never
        match since time keywords must end with colons, which are not word
-       constituent.
+       constituents.
+
+2012-05-27  Bastien Guerry  <bzg@gnu.org>
 
-2012-05-16  Bastien Guerry  <bzg@gnu.org>
+       * org-ctags.el (org-ctags-new-topic-template):
+       Fix the option default value back again.
 
-       * org-ctags.el (org-ctags-new-topic-template): Fix the option
-       default value back again.
+2012-05-27  Eric Schulte  <eric.schulte@gmx.com>
 
-2012-05-16  Eric Schulte  <eric.schulte@gmx.com>
+       * org-bibtex.el (org-bibtex-export-to-kill-ring):
+       Don't rely on kill-new to return a string.
 
-       * org-bibtex.el (org-bibtex-export-to-kill-ring): Don't rely on
-       kill-new to return a string.
+       * org-bibtex.el (org-bibtex-headline):
+       Remove call to bibtex-reformat which often hangs.
 
-2012-05-16  Eric Schulte  <eric.schulte@gmx.com>
+2012-04-27  Glenn Morris  <rgm@gnu.org>
 
-       * org-bibtex.el (org-bibtex-headline): Remove call to
-       bibtex-reformat which often hangs.
+       * org-ctags.el (org-ctags-new-topic-template):
+       Revert 2012-04-09 removal of * from defcustom value, not doc.
 
-2012-04-26  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-04-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-table.el (org-table-number-fraction): Fix typo.
 
-2012-04-26  Eric Schulte  <eric.schulte@gmx.com>
+2012-04-27  Eric Schulte  <eric.schulte@gmx.com>
 
        * ob-python.el (org-babel-execute:python): Ensure newline precedes
        automatically-added returns.
 
-2012-04-26  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-04-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-mouse.el (org-mode-hook): Do not move point when clicking on
        a footnote reference.
 
-2012-04-26  Bastien Guerry  <bzg@gnu.org>
+2012-04-27  Bastien Guerry  <bzg@gnu.org>
 
        * org-faces.el (org-date-selected): Fix docstring.
 
-2012-04-26  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-04-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-list.el (org-list-struct-indent): Follow
        `org-list-demote-modify-bullet' specifications for ordered
        * org.el (org-shiftmetaleft, org-shiftmetaright): Allow to operate
        on a region.
 
-2012-04-26  Nicolas Goaziou  <n.goaziou@gmail.com>
+2012-04-27  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-footnote.el (org-footnote-normalize): Fix positioning in
        HTML export without a footnote section.
 
-2012-04-26  Madan Ramakrishnan  <madanr79@gmail.com>  (tiny change)
+2012-04-27  Madan Ramakrishnan  <madanr79@gmail.com>  (tiny change)
 
        * org-agenda.el (org-agenda-bulk-mark): Truly make arg optional as
        advertised by the function.
 
-2012-04-26  Zachary Kanfer  <zkanfer@gmail.com>  (tiny change)
+2012-04-27  Zachary Kanfer  <zkanfer@gmail.com>  (tiny change)
 
        * org.el (org-read-date-display): Fix bug when displaying the
        overlay.
 
-2012-04-26  Bastien Guerry  <bzg@gnu.org>
+2012-04-27  Bastien Guerry  <bzg@gnu.org>
 
        * org.el (org-mode): Don't use `buffer-face-mode' by default.
 
-2012-04-26  Bastien Guerry  <bzg@gnu.org>
+2012-04-27  Bastien Guerry  <bzg@gnu.org>
 
        * org-faces.el (org-date-selected): New face.
 
-2012-04-26  Jambunathan K  <kjambunathan@gmail.com>
+2012-04-27  Jambunathan K  <kjambunathan@gmail.com>
 
        * org-odt.el (org-odt-format-org-link): Pay no heed to whether the
        internal links destined for headlines provide a description or
        not.  In fact, the `org-store-link' and `org-insert-link' create
        internal links which do have a description.
 
-2012-04-26  Bastien Guerry  <bzg@gnu.org>
+2012-04-27  Bastien Guerry  <bzg@gnu.org>
 
        * org-clock.el (org-program-exists): Fix docstring.
 
-2012-04-11  Bastien Guerry  <bzg@gnu.org>
+2012-04-14  Bastien Guerry  <bzg@gnu.org>
 
        * org.el (org-point-at-end-of-empty-headline): Only try to match
-       ̀org-todo-line-regexp' when the value is non-nil, e.g. in non-org
+       `org-todo-line-regexp' when the value is non-nil, e.g. in non-org
        modes.
        (org-fontify-meta-lines-and-blocks-1): Prevent errors when trying
        to fontify beyond (point-max).
        (org-table-get-range): Fix bug: make sure references to $0 are
        correctly handled.
 
-       * org-pcomplete.el (pcomplete/org-mode/file-option): Fix bug in
-       `pcomplete/org-mode/file-option'.
+       * org-pcomplete.el (pcomplete/org-mode/file-option):
+       Fix bug in `pcomplete/org-mode/file-option'.
        (org-thing-at-point): Also match line options like LATEX_CLASS
        when pcompleting from LATEX_.
 
        * org-agenda.el (org-agenda-filter-make-matcher)
        (org-agenda-filter-apply): Allow filtering entries out by
        category.  Using `C-u <' from the agenda view will redisplay
-       the agenda without entries from categories of the current
-       line.
+       the agenda without entries from categories of the current line.
 
-2012-04-11  Eric Schulte  <eric.schulte@gmx.com>
+2012-04-14  Eric Schulte  <eric.schulte@gmx.com>
 
-       * ob-C.el (org-babel-C-ensure-main-wrap): Add an explicit return
-       to automatically generated main methods.
+       * ob-C.el (org-babel-C-ensure-main-wrap):
+       Add an explicit return to automatically generated main methods.
 
-2012-04-11  Matt Lundin  <mdl@imapmail.org>
+2012-04-14  Matt Lundin  <mdl@imapmail.org>
 
-       * org.el (org-after-todo-state-change-hook): Fix docstring to
-       reflect name change of state to `org-state'.
+       * org.el (org-after-todo-state-change-hook):
+       Fix docstring to reflect name change of state to `org-state'.
 
-2012-04-11  Mike Sperber  <sperber@deinprogramm.de>  (tiny change)
+2012-04-14  Mike Sperber  <sperber@deinprogramm.de>  (tiny change)
 
-       * org-footnote.el (org-footnote-normalize): Correctly pass keyword
-       arguments to `org-export-preprocess-string'.
+       * org-footnote.el (org-footnote-normalize):
+       Correctly pass keyword arguments to `org-export-preprocess-string'.
 
 2012-04-03  Bastien Guerry  <bzg@gnu.org>
 
 2012-04-01  Ilya Shlyakhter  <ilya_shl@alum.mit.edu>  (tiny change)
 
        * org-colview.el (org-columns-cleanup-item): Handle case of empty
-       headline
+       headline.
 
 2012-04-01  Nicolas Goaziou  <n.goaziou@gmail.com>
 
 
 2012-04-01  Ilya Shlyakhter  <ilya_shl@alum.mit.edu>
 
-       * org-clock.el: (org-clock-get-table-data): Make sure todo-only
+       * org-clock.el (org-clock-get-table-data): Make sure todo-only
        does not leak when it is set by make-org-tags-macher.
 
 2012-04-01  Bastien Guerry  <bzg@gnu.org>
 2012-04-01  Bernt Hansen  <bernt@norang.ca>
 
        * org.el (org-clone-subtree-with-time-shift): Fix task cloning for
-       repeating tasks using .+n and ++n syntax
+       repeating tasks using .+n and ++n syntax.
 
 2012-04-01  Karl Fogel  <kfogel@red-bean.com>  (tiny change)
 
 
 2012-04-01  Toby S. Cubitt  <tsc25@cantab.net>  (tiny change)
 
-       * org.el (org-goto): call org-refile-get-location with NO-EXCLUDE
+       * org.el (org-goto): Call org-refile-get-location with NO-EXCLUDE
        argument set, otherwise not only are headlines in the current
        subtree excluded, but it throws an error if point happens not to
        be within a subtree (e.g. at start of buffer).
        * org-clock.el (org-in-clocktable-p): Moved to org.el.
 
        * org.el (org-in-clocktable-p): New function. Moved from
-       org-clock.el
+       org-clock.el.
 
 2012-04-01  David Maus  <dmaus@ictsoc.de>
 
 
 2012-04-01  Toby S. Cubitt  <tsc25@cantab.net>  (tiny change)
 
-       * org.el (org-goto): call org-refile-get-location with NO-EXCLUDE
+       * org.el (org-goto): Call org-refile-get-location with NO-EXCLUDE
        argument set, otherwise not only are headlines in the current
        subtree excluded, but it throws an error if point happens not to
        be within a subtree (e.g. at start of buffer).
 2012-04-01  Bernt Hansen  <bernt@norang.ca>
 
        * org-clock.el (org-clock-out): Do not delete the current clocking
-       task when org-clock-out-hook clocks in another task
+       task when org-clock-out-hook clocks in another task.
 
 2012-04-01  David Maus  <dmaus@ictsoc.de>
 
 
        * org-clock.el (org-in-clocktable-p): Moved to org.el.
 
-       * org.el (org-in-clocktable-p): New function. Moved from org-clock.el
+       * org.el (org-in-clocktable-p): New function.  Moved from org-clock.el.
 
 2012-04-01  David Maus  <dmaus@ictsoc.de>
 
 2012-04-01  Jambunathan K  <kjambunathan@gmail.com>
 
        * org-odt.el (org-odt-label-styles): Add a new style.
-       (org-odt-category-map-alist):  Use it.
+       (org-odt-category-map-alist): Use it.
 
 2012-04-01  Jambunathan K  <kjambunathan@gmail.com>
 
 
 2012-04-01  Bernt Hansen  <bernt@norang.ca>
 
-       * org-agenda.el (org-agenda-switch-to): Widen org buffer only if point is
-       outside the current restriction
+       * org-agenda.el (org-agenda-switch-to): Widen org buffer only if point
+       is outside the current restriction.
 
 2012-04-01  Bernt Hansen  <bernt@norang.ca>
 
-       * org-agenda.el (org-agenda-clock-in): Save restriction when clocking in from the agenda
+       * org-agenda.el (org-agenda-clock-in): Save restriction when clocking
+       in from the agenda.
 
 2012-04-01  Bernt Hansen  <bernt@norang.ca>
 
-       * org.el: Honour existing restrictions when regenerating the agenda
+       * org.el: Honour existing restrictions when regenerating the agenda.
 
 2012-04-01  Bastien Guerry  <bzg@gnu.org>
 
 2012-04-01  Martyn Jago  <martyn.jago@btinternet.com>
 
        * ob-emacs-lisp.el: A comment on the last line of an emacs-lisp
-       code block would cause an error when the block is was executed. This
-       fix cures this behaviour.
+       code block would cause an error when the block is was executed.
+       This fix cures this behaviour.
 
 2012-04-01  Eric Schulte  <eric.schulte@gmx.com>
 
 
 2012-01-03  Litvinov Sergey  <slitvinov@gmail.com>
 
-       * ob-octave.el: add graphical output to png file
+       * ob-octave.el: Add graphical output to png file.
 
 2012-01-03  Eric Schulte  <eric.schulte@gmx.com>
 
 
 2012-01-03  Michael Brand  <michael.ch.brand@gmail.com>
 
-       * org.el (Key bindings): remap the Outline functions from
+       * org.el (Key bindings): Remap the Outline functions from
        `outline-mode-prefix-map' where possible.
 
 2012-01-03  Christian Moe  <mail@christianmoe.com>  (tiny change)
        * org-special-blocks.el
        (org-special-blocks-convert-html-special-cookies): Close
        paragraph before opening or closing the <div>, and open
-       paragraph after. Also changed newline placement to be the same
+       paragraph after.  Also changed newline placement to be the same
        as for other blocks.
 
 2012-01-03  Roberto Huelga  <rhuelga@gmail.com>
        * ob-asymptote.el (org-babel-asymptote-table-to-array):
        Require a new argument TYPE specifying the detected type of
        array.  If it's a string array, make sure every element is
-       returned as a string. Also improve doc-string.
-       (org-babel-asymptote-var-to-asymptote): Fill new argument.  Small
-       refactoring.
+       returned as a string.  Also improve doc-string.
+       (org-babel-asymptote-var-to-asymptote): Fill new argument.
+       Small refactoring.
        (org-babel-asymptote-define-type): Rewrite to avoid stopping
        search at first float found, as strings have precedence over
        floats.
 
        * org-footnote.el (org-footnote-get-definition): The function has
        to widen buffer if definition has not been found in the current
-       narrowed part. Be sure to restore that restriction once the
+       narrowed part.  Be sure to restore that restriction once the
        definition is found.
 
 2012-01-03  Michal Sojka  <sojka@os.inf.tu-dresden.de>  (tiny change)
 2012-01-03  Suvayu Ali  <fatkasuvayu+linux@gmail.com>  (tiny change)
 
        * org-inlinetask.el (org-inlinetask): New customizable face
-       for inlinetasks
+       for inlinetasks.
 
 2012-01-03  Bastien Guerry  <bzg@gnu.org>
 
        (org-indent-agent-resume-delay): Change value.
        (org-indent-initialize-buffer): Change argument name.
        (org-indent-add-properties): Change argument name and type
-       expected. It must be a time value now.
+       expected.  It must be a time value now.
 
 2012-01-03  Bastien Guerry  <bzg@gnu.org>
 
        (org-indent-initialize-agent): New function.
        (org-indent-initialize-buffer): Now requires a mandatory
        buffer argument.
-       (org-indent-add-properties): Reflect changes to variables. The resume
-       timer is now global.
+       (org-indent-add-properties): Reflect changes to variables.
+       The resume timer is now global.
 
 2012-01-03  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-indent.el (org-indent-modified-headline-flag): Renamed from
        `org-indent-deleted-headline-flag'
        (org-indent-notify-modified-headline): Renamed from
-       `org-indent-notify-deleted-headline'. Handle situations when
+       `org-indent-notify-deleted-headline'.  Handle situations when
        the stars of an headline are modified.
        (org-indent-refresh-maybe): Remove case now handled by
        previous function.
        (org-indent-initial-timer, org-indent-initial-lock): New
        variables.
        (org-indent-mode): At initialization, start an idle timer to indent
-       the whole buffer. When the user is asking for control, interrupt the
+       the whole buffer.  When the user is asking for control, interrupt the
        process, and resume at the same point when idle again.
        (org-indent-initialize-buffer): New function.
        (org-indent-add-properties): Throw an interrupt when indentation of
 2012-01-03  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-indent.el (org-indent-mode): Completely refresh buffer
-       before starting org-indent-mode. Also set idle timer to refresh
+       before starting org-indent-mode.  Also set idle timer to refresh
        only visible portion of buffer, and refresh the subtree instead of
        section when promoting or demoting it.
        (org-indent-add-properties): Rewrite function to proceed line by
        template for html so that the exported file is valid
        xhtml.  Added template for odt.
        (org-inlinetask-export-handler): Fix typo in the regexp that
-       trims content. Make sure that the content is flanked by
+       trims content.  Make sure that the content is flanked by
        paragraph boundaries on either side.
 
 2012-01-03  Bastien Guerry  <bzg@gnu.org>
 2012-01-03  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org.el (org-in-regexps-block-p): Return an useful value when
-       point is between START-RE and END-RE. No incomplete block is
+       point is between START-RE and END-RE.  No incomplete block is
        allowed anymore.  Add another optional argument to bound the
        bottom part of the search.
        (org-narrow-to-block, org-in-block-p): Apply modifications.
 2011-07-28  Matt Lundin  <mdl@imapmail.org>
 
        * org-bibtex.el (org-bibtex-create, org-bibtex-write): Change
-       argument of `org-toggle-tag' to 'on. (Other arguments, e.g., t,
+       argument of `org-toggle-tag' to 'on.  (Other arguments, e.g., t,
        have no effect).
 
 2011-07-28  Eric Schulte  <schulte.eric@gmail.com>
 
        * ob-haskell.el (org-babel-haskell-export-to-lhs): Call
        `kill-buffer' with argument indiciating to kill current
-       buffer. Emacs 22 compatibility.
+       buffer.  Emacs 22 compatibility.
 
 2011-07-28  David Maus  <dmaus@ictsoc.de>
 
 
        * org-exp.el (org-export-preprocess-string): If the last subtree
        is commented, footnotes inserted during normalizing at the end of
-       the buffer may get deleted. This patch ensures deletion comes
+       the buffer may get deleted.  This patch ensures deletion comes
        first, normalization second.
 
 2011-07-28  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-footnote.el (org-footnote-goto-definition): Now, determining
        if point is at a footnote reference is entirely determined by
-       `org-footnote-at-reference-p'. No need to check if pattern isn't
+       `org-footnote-at-reference-p'.  No need to check if pattern isn't
        at beginning of the line elsewhere.
 
 2011-07-28  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-exp.el (org-export-backends): New variable.
        (org-export-select-backend-specific-text): Use above
-       variable. Also mark text between #+BACKEND and
+       variable.  Also mark text between #+BACKEND and
        #+BEGIN_BACKEND...#+END_BACKEND with org-native-text property.
        This text property is currently used only by the new line-oriented
        generic exporter (which is not yet part of the repo).
        * org-exp.el (org-export): Use new compatibility function
        `org-activate-mark'.
 
-       * org-compat.el (org-activate-mark): New function. Provide
+       * org-compat.el (org-activate-mark): New function.  Provide
        `activate-mark' if not present (e.g. Emacs 22).
 
 2011-07-28  David Maus  <dmaus@ictsoc.de>
        * org-html.el (org-export-as-html): Don't expand non-data lines of
        table.el tables.
        (org-html-expand): Removed the (buggy) test for non-data lines
-       in table.el tables. The test is now done as part of
+       in table.el tables.  The test is now done as part of
        org-export-as-html.
        (org-format-table-table-html-using-table-generate-source):
        Added test for spanning of cells in table.el tables using
-       table.el's own library routine. Optionlly Suppress export of
+       table.el's own library routine.  Optionally suppress export of
        simple table.el tables.
        (org-format-table-html): Removed the (buggy) test for spanned
-       table.el tables. The test is now done as part of
+       table.el tables.  The test is now done as part of
        org-format-table-table-html-using-table-generate-source.
 
 2011-07-28  Carsten Dominik  <carsten.dominik@gmail.com>
        function would not pay attention to drawers or blocks indentation.
        Thus, such constructs couldn't consistently end an item or a list.
        This patch ensures line indentation is stored (if applicable)
-       before skipping them. Also fixed doc-string and comments.
+       before skipping them.  Also fixed doc-string and comments.
 
 2011-07-28  Carsten Dominik  <carsten.dominik@gmail.com>
 
 2011-07-28  Julien Danjou  <julien@danjou.info>
 
        * org-latex.el (org-export-latex-date-format): Change default date
-       format to \today. This has the same result but respects the
+       format to \today.  This has the same result but respects the
        language set in the document by default.
 
 2011-07-28  Nicolas Goaziou  <n.goaziou@gmail.com>
        (org-agenda-change-all-lines): Stop using prefix-length.
 
        * org-colview.el (org-columns-display-here): Stop using
-       prefix-length. Always return claned items.
+       prefix-length.  Always return claned items.
 
        * org-mobile.el (org-mobile-write-agenda-for-mobile): Stop using
        prefix-length.
 
 2011-07-28  Bastien Guerry  <bzg@gnu.org>
 
-       * org-html.el (org-export-as-html): bugfix: insert email
+       * org-html.el (org-export-as-html): Bugfix: insert email
        correctly.
 
 2011-07-28  Bastien Guerry  <bzg@gnu.org>
 2011-07-28  Julien Danjou  <julien@danjou.info>
 
        * org-macs.el (org-with-point-at): Store evaluated version of
-       pom. This fixes a potential bug when using (org-with-point-at
+       pom.  This fixes a potential bug when using (org-with-point-at
        (func) …), where (func) would be evaluated multiple times,
        therefore might return different results if a marker was returned
        and different each time.
 
 2011-07-28  Nicolas Goaziou  <n.goaziou@gmail.com>
 
-       * org.el (org-toggle-item): Now accepts a prefix argument. When
+       * org.el (org-toggle-item): Now accepts a prefix argument.  When
        used without argument on normal text, it will make the whole
        region one item.  With an argument, it defaults to old behavior:
        change each line in region into an item.
        * org-inlinetask.el (org-inlinetask-export-templates): Slightly
        modify templates so environment boundaries don't interfere with
        content of task.  Unprotect content of task so it might benefit
-       from further transformations. Set original-indentation property to
+       from further transformations.  Set original-indentation property to
        a high value to ensure that task is always in the last item of the
        list.  Also, apply templates later in export process.
 
        * org-exp.el (org-export-preprocess-string): Mark list endings
        before babel blocks preprocessing starts, so blank lines that may
        be inserted do not break list's structure.  Then, mark list with
-       special properties required by exporters. Thus output from babel
+       special properties required by exporters.  Thus output from babel
        can easily be included in lists.
        (org-export-mark-list-end): New function.
        (org-export-mark-list-properties): New function.
        helper function is not optional anymore.
        (org-list-get-all-items): Shorten code with the help of cl.el.
        (org-list-get-children): Now returns all children of item, even if
-       they do not belong to the same list. Renamed from
+       they do not belong to the same list.  Renamed from
        `org-list-get-all-children'.
        (org-list-get-list-begin): Function wasn't return value when item
        was already the first item of the list at point.
 2010-11-11  Carsten Dominik  <carsten.dominik@gmail.com>
 
        * org-capture.el (org-capture-templates): New capture property
-       `:kill-buffer'. (org-capture-finalize): Kill target buffer if that
-       is desired.
-       (org-capture-target-buffer): Remember if we have to make the
-       buffer.
+       `:kill-buffer'.
+       (org-capture-finalize): Kill target buffer if that is desired.
+       (org-capture-target-buffer): Remember if we have to make the buffer.
 
 2010-11-11  Carsten Dominik  <carsten.dominik@gmail.com>
 
 2010-11-11  Nicolas Goaziou  <n.goaziou@gmail.com>
 
        * org-list.el (org-list-insert-item-generic): Updating checkboxes
-       can modifiy bottom point of a list, so make it a marker before
+       can modify bottom point of a list, so make it a marker before
        calling `org-update-checkbox-count-maybe'.
 
 2010-11-11  Dan Davison  <davison@stats.ox.ac.uk>
 
        * org.el (org-src-fontify-natively): Set to nil by default.
-       Supply cutomize interface.
+       Supply customize interface.
 
 2010-11-11  Bastien Guerry  <bzg@gnu.org>
 
 
        * org-list.el (org-insert-item-internal): New function to handle
        positioning and contents of an item being inserted at a specific
-       pos. It is not possible anymore to split a term in a description
+       pos.  It is not possible anymore to split a term in a description
        list or a checkbox when inserting a new item.
 
        * org-list.el (org-insert-item): Refactored by using the new
 
 2009-11-13  John Wiegley  <jwiegley@gmail.com>
 
-       * org-clock.el
-       (org-clock-auto-clock-resolution): Now takes three values: nil, t
-       and `when-no-clock-is-running'.
+       * org-clock.el (org-clock-auto-clock-resolution): Now takes three
+       values: nil, t and `when-no-clock-is-running'.
        (org-clock-in): Use `org-clock-auto-clock-resolution' to determine
        whether or not to resolve Org buffers on clock in.
 
 ;; add-log-time-zone-rule: t
 ;; End:
 
-       Copyright (C) 2008-2012  Free Software Foundation, Inc.
+       Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index 367d8e8447199860a3106dd72def233a30da653a..2b4a001979bc34572a193b5f8b8a885f59fd5795 100644 (file)
@@ -799,7 +799,7 @@ because you will take care of it on the day when scheduled."
   :group 'org-agenda-daily/weekly
   :version "24.1"
   :type '(choice
-         (const :tag "Alwas show prewarning" nil)
+         (const :tag "Always show prewarning" nil)
          (const :tag "Remove prewarning if entry is scheduled" t)
          (integer :tag "Restart prewarning N days before deadline")))
 
index aabcfc187db3f018a9c22eac2eba954a8205637f..c39fb249e74cb8fd09154b0175cd8511659fe0f7 100644 (file)
@@ -143,7 +143,7 @@ The function is called with point at the beginning of the headline."
   :type 'function)
 
 (defcustom org-clock-string-limit 0
-  "Maximum length of clock strings in the modeline.  0 means no limit."
+  "Maximum length of clock strings in the mode line.  0 means no limit."
   :group 'org-clock
   :type 'integer)
 
@@ -202,7 +202,7 @@ file name  play this sound file.  If not possible, fall back to beep"
          (file :tag "Play sound file")))
 
 (defcustom org-clock-modeline-total 'auto
-  "Default setting for the time included for the modeline clock.
+  "Default setting for the time included for the mode line clock.
 This can be overruled locally using the CLOCK_MODELINE_TOTAL property.
 Allowed values are:
 
@@ -221,7 +221,7 @@ auto     Automatically, either `all', or `repeat' for repeating tasks"
 
 (defvaralias 'org-task-overrun-text 'org-clock-task-overrun-text)
 (defcustom org-clock-task-overrun-text nil
-  "The extra modeline text that should indicate that the clock is overrun.
+  "Extra mode line text to indicate that the clock is overrun.
 The can be nil to indicate that instead of adding text, the clock time
 should get a different face (`org-mode-line-clock-overrun').
 When this is a string, it is prepended to the clock string as an indication,
@@ -669,7 +669,7 @@ Use alsa's aplay tool if available."
       (= 0 (call-process "which" nil nil nil program-name))))
 
 (defvar org-clock-mode-line-entry nil
-  "Information for the modeline about the running clock.")
+  "Information for the mode line about the running clock.")
 
 (defun org-find-open-clocks (file)
   "Search through the given file and find all open clocks."
index 65e92bab016597fbe2083f6f85a6a3544b2d2384..d1d863c28456627822418f690148b09ad6416b41 100644 (file)
@@ -64,7 +64,7 @@ and `org-remember-default-headline'.  To force prompting anyway, use
 \\[universal-argument] \\[org-remember-finalize] to file the note.
 
 When this variable is nil, \\[org-remember-finalize] gives you the prompts, and
-\\[universal-argument] \\[org-remember-finalize] triggers the fasttrack."
+\\[universal-argument] \\[org-remember-finalize] triggers the fast track."
   :group 'org-remember
   :type 'boolean)
 
index 972f7801afc159f696c093a64830d32ce865d942..f431c19bf5120fa6328218d50946f3f69ac986c0 100644 (file)
@@ -3031,7 +3031,7 @@ is better to limit inheritance to certain tags using the variables
          (const :tag "List them, indented with leading dots" indented)))
 
 (defcustom org-tags-sort-function nil
-  "When set, tags are sorted using this function as a comparator."
+  "When set, tags are sorted using this comparison function."
   :group 'org-tags
   :type '(choice
          (const :tag "No sorting" nil)
index da5519f95eb4debdc6a9e9294862d44282bf969f..40974a2c8294d7c35d0ed622ede49f3730ce5708 100644 (file)
@@ -284,10 +284,10 @@ in the file it applies to."
   "Normal hook to be run after outline visibility changes.")
 
 (defvar outline-mode-hook nil
-  "*This hook is run when outline mode starts.")
+  "This hook is run when outline mode starts.")
 
 (defvar outline-blank-line nil
-  "*Non-nil means to leave unhidden blank line before heading.")
+  "Non-nil means to leave unhidden blank line before heading.")
 
 ;;;###autoload
 (define-derived-mode outline-mode text-mode "Outline"
@@ -380,7 +380,7 @@ See the command `outline-mode' for more information on this mode."
     (show-all)))
 \f
 (defvar outline-level 'outline-level
-  "*Function of no args to compute a header's nesting level in an outline.
+  "Function of no args to compute a header's nesting level in an outline.
 It can assume point is at the beginning of a header line and that the match
 data reflects the `outline-regexp'.")
 ;;;###autoload(put 'outline-level 'risky-local-variable t)
index 49d2777fd0b3a3060ac059712a8c0c05e8f2ae94..2d6c42478e18453a7e182d0032b2c7f1aeada854 100644 (file)
@@ -96,7 +96,7 @@ otherwise)."
   'show-paren-mismatch "22.1")
 
 (defvar show-paren-highlight-openparen t
-  "*Non-nil turns on openparen highlighting when matching forward.")
+  "Non-nil turns on openparen highlighting when matching forward.")
 
 (defvar show-paren-idle-timer nil)
 
diff --git a/lisp/paths.el b/lisp/paths.el
deleted file mode 100644 (file)
index 70b5ca5..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-;;; paths.el --- define pathnames for use by various Emacs commands -*- no-byte-compile: t -*-
-
-;; Copyright (C) 1986, 1988, 1994, 1999-2012  Free Software Foundation, Inc.
-
-;; Maintainer: FSF
-;; Keywords: internal
-;; Package: emacs
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; These are default settings for names of certain files and directories
-;; that Emacs needs to refer to from time to time.
-
-;; If these settings are not right, override them with `setq'
-;; in site-init.el.  Do not change this file.
-
-;;; Code:
-
-;; Docstrings in this file should, where reasonable, follow the
-;; conventions described in make-docfile, so that they get put in the
-;; DOC file rather than in memory.
-
-(defun prune-directory-list (dirs &optional keep reject)
-  "\
-Return a copy of DIRS with all non-existent directories removed.
-The optional argument KEEP is a list of directories to retain even if
-they don't exist, and REJECT is a list of directories to remove from
-DIRS, even if they exist; REJECT takes precedence over KEEP.
-
-Note that membership in REJECT and KEEP is checked using simple string
-comparison."
-  (apply #'nconc
-        (mapcar (lambda (dir)
-                  (and (not (member dir reject))
-                       (or (member dir keep) (file-directory-p dir))
-                       (list dir)))
-                   dirs)))
-
-(defvar Info-default-directory-list
-  (let* ((config-dir
-         (file-name-as-directory configure-info-directory))
-        (config
-         (list config-dir))
-        (unpruned-prefixes
-         ;; Directory trees that may not exist at installation time, and
-         ;; so shouldn't be pruned based on existence.
-         '("/usr/local/"))
-        (prefixes
-         ;; Directory trees in which to look for info subdirectories
-         (prune-directory-list '("/usr/local/" "/usr/" "/opt/" "/")
-                               unpruned-prefixes))
-        (suffixes
-         ;; Subdirectories in each directory tree that may contain info
-         ;; directories.
-         '("share/" "" "gnu/" "gnu/lib/" "gnu/lib/emacs/"
-           "emacs/" "lib/" "lib/emacs/"))
-        (standard-info-dirs
-         (apply #'nconc
-                (mapcar (lambda (pfx)
-                          (let ((dirs
-                                 (mapcar (lambda (sfx)
-                                           (concat pfx sfx "info/"))
-                                         suffixes)))
-                            (if (member pfx unpruned-prefixes)
-                                dirs
-                              (prune-directory-list dirs config))))
-                        prefixes))))
-    ;; If $(prefix)/share/info is not one of the standard info
-    ;; directories, they are probably installing an experimental
-    ;; version of Emacs, so make sure that experimental version's Info
-    ;; files override the ones in standard directories.
-    (if (member config-dir standard-info-dirs)
-       (nconc standard-info-dirs config)
-      (cons config-dir standard-info-dirs)))
-  "Default list of directories to search for Info documentation files.
-They are searched in the order they are given in the list.
-Therefore, the directory of Info files that come with Emacs
-normally should come last (so that local files override standard ones),
-unless Emacs is installed into a non-standard directory.  In the latter
-case, the directory of Info files that come with Emacs should be
-first in this list.
-
-Once Info is started, the list of directories to search
-comes from the variable `Info-directory-list'.
-This variable `Info-default-directory-list' is used as the default
-for initializing `Info-directory-list' when Info is started, unless
-the environment variable INFOPATH is set.")
-
-(defvar news-directory
-  (purecopy (if (file-exists-p "/usr/spool/news/")
-      "/usr/spool/news/"
-    "/var/spool/news/"))
-  "The root directory below which all news files are stored.")
-(defvaralias 'news-path 'news-directory)
-
-(defvar news-inews-program
-  (purecopy
-  (cond ((file-exists-p "/usr/bin/inews") "/usr/bin/inews")
-       ((file-exists-p "/usr/local/inews") "/usr/local/inews")
-       ((file-exists-p "/usr/local/bin/inews") "/usr/local/bin/inews")
-       ((file-exists-p "/usr/contrib/lib/news/inews") "/usr/contrib/lib/news/inews")
-       ((file-exists-p "/usr/lib/news/inews") "/usr/lib/news/inews")
-       (t "inews")))
-  "Program to post news.")
-
-;; set this to your local server
-(defvar gnus-default-nntp-server (purecopy "") "\
-The name of the host running an NNTP server.
-The null string means use the local host as the server site.")
-
-(defvar gnus-nntp-service (purecopy "nntp") "\
-NNTP service name, usually \"nntp\" or 119.
-Go to a local news spool if its value is nil, in which case `gnus-nntp-server'
-should be set to `(system-name)'.")
-
-(defvar gnus-local-organization nil "\
-*The name of your organization, as a string.
-The `ORGANIZATION' environment variable is used instead if defined.")
-
-(defcustom rmail-file-name (purecopy "~/RMAIL") "\
-Name of user's primary mail file."
-  :type 'string
-  :group 'rmail
-  :version "21.1")
-
-(defvar rmail-spool-directory
-  (purecopy
-  (cond ((file-exists-p "/var/mail")
-        ;; SVR4 and recent BSD are said to use this.
-        ;; Rather than trying to know precisely which systems use it,
-        ;; let's assume this dir is never used for anything else.
-        "/var/mail/")
-       ;; Many GNU/Linux systems use this name.
-       ((file-exists-p "/var/spool/mail")
-        "/var/spool/mail/")
-       ((memq system-type '(hpux usg-unix-v irix))
-        "/usr/mail/")
-       (t "/usr/spool/mail/")))
-  "Name of directory used by system mailer for delivering new mail.
-Its name should end with a slash.")
-
-(defcustom remote-shell-program
-  (purecopy
-  (cond
-   ;; Some systems use rsh for the remote shell; others use that name for the
-   ;; restricted shell and use remsh for the remote shell.  Let's try to guess
-   ;; based on what we actually find out there.  The restricted shell is
-   ;; almost certainly in /bin or /usr/bin, so it's probably safe to assume
-   ;; that an rsh found elsewhere is the remote shell program.  The converse
-   ;; is not true: /usr/bin/rsh could be either one, so check that last.
-   ((file-exists-p "/usr/ucb/remsh") "/usr/ucb/remsh")
-   ((file-exists-p "/usr/bsd/remsh") "/usr/bsd/remsh")
-   ((file-exists-p "/bin/remsh") "/bin/remsh")
-   ((file-exists-p "/usr/bin/remsh") "/usr/bin/remsh")
-   ((file-exists-p "/usr/local/bin/remsh") "/usr/local/bin/remsh")
-   ((file-exists-p "/usr/ucb/rsh") "/usr/ucb/rsh")
-   ((file-exists-p "/usr/bsd/rsh") "/usr/bsd/rsh")
-   ((file-exists-p "/usr/local/bin/rsh") "/usr/local/bin/rsh")
-   ((file-exists-p "/usr/bin/rcmd") "/usr/bin/rcmd")
-   ((file-exists-p "/bin/rcmd") "/bin/rcmd")
-   ((file-exists-p "/bin/rsh") "/bin/rsh")
-   ((file-exists-p "/usr/bin/rsh") "/usr/bin/rsh")
-   (t "rsh")))
-  "File name for remote-shell program (often rsh or remsh)."
-  :group 'environment
-  :type 'file)
-
-(defvar term-file-prefix (purecopy "term/") "\
-If non-nil, Emacs startup does (load (concat term-file-prefix (getenv \"TERM\")))
-You may set this variable to nil in your `.emacs' file if you do not wish
-the terminal-initialization file to be loaded.")
-
-;;; paths.el ends here
index f28469d791bfe2495eea1410698c8896d2908ddb..e637c3407f03123e40bccef65648a185524f315e 100644 (file)
 
 (require 'pcomplete)
 
+(defgroup pcmpl-rpm nil
+  "Options for rpm completion."
+  :group 'pcomplete
+  :prefix "pcmpl-rpm-")
+
+;; rpm -qa can be slow.  Adding --nodigest --nosignature is MUCH faster.
+(defcustom pcmpl-rpm-query-options
+  (let (opts)
+    (with-temp-buffer
+      (when (ignore-errors (call-process "rpm" nil t nil "--help"))
+        (if (search-backward "--nodigest " nil 'move)
+            (setq opts '("--nodigest")))
+        (goto-char (point-min))
+        (if (search-forward "--nosignature " nil t)
+            (push "--nosignature" opts))))
+    opts)
+  "String, or list of strings, with extra options for an rpm query command."
+  :version "24.2"
+  :type '(choice (const :tag "No options" nil)
+                 (string :tag "Single option")
+                 (repeat :tag "List of options" string))
+  :group 'pcmpl-rpm)
+
+(defcustom pcmpl-rpm-cache t
+  "Whether to cache the list of installed packages."
+  :version "24.2"
+  :type 'boolean
+  :group 'pcmpl-rpm)
+
+(defconst pcmpl-rpm-cache-stamp-file "/var/lib/rpm/Packages"
+  "File used to check that the list of installed packages is up-to-date.")
+
+(defvar pcmpl-rpm-cache-time nil
+  "Time at which the list of installed packages was updated.")
+
+(defvar pcmpl-rpm-packages nil
+  "List of installed packages.")
+
 ;; Functions:
 
-;; FIXME rpm -qa can be slow, so:
-;; Adding --nodigest --nosignature is MUCH faster.
-;; (Probably need to test --help for those options though.)
-;; Consider caching the result (cf woman).
-;; Consider printing an explanatory message before running -qa.
-;;
-;; Seems pointless for this to be a defsubst.
-(defsubst pcmpl-rpm-packages ()
-  (split-string (pcomplete-process-result "rpm" "-q" "-a")))
+(defun pcmpl-rpm-packages ()
+  "Return a list of all installed rpm packages."
+  (if (and pcmpl-rpm-cache
+           pcmpl-rpm-cache-time
+           (let ((mtime (nth 5 (file-attributes pcmpl-rpm-cache-stamp-file))))
+             (and mtime (not (time-less-p pcmpl-rpm-cache-time mtime)))))
+      pcmpl-rpm-packages
+    (message "Getting list of installed rpms...")
+    (setq pcmpl-rpm-cache-time (current-time)
+          pcmpl-rpm-packages
+          (split-string (apply 'pcomplete-process-result "rpm"
+                               (append '("-q" "-a")
+                                       (if (stringp pcmpl-rpm-query-options)
+                                           (list pcmpl-rpm-query-options)
+                                         pcmpl-rpm-query-options)))))
+    (message "Getting list of installed rpms...done")
+    pcmpl-rpm-packages))
 
+;; Should this use pcmpl-rpm-query-options?
+;; I don't think it would speed it up at all (?).
 (defun pcmpl-rpm-all-query (flag)
   (message "Querying all packages with `%s'..." flag)
   (let ((pkgs (pcmpl-rpm-packages))
index 3af22c82dfbf90f983c63e57f2e83bd4dea087a6..ae4bd270b09afcbbc4cec5fe6960d7d6d3c99095 100644 (file)
@@ -205,8 +205,8 @@ Includes files as well as host names followed by a colon."
                           ;; Avoid connecting to the remote host when we're
                           ;; only completing the host name.
                           (list string)
-                        (comint--table-subvert (pcomplete-all-entries)
-                                               "" "/ssh:")))
+                        (completion-table-subvert (pcomplete-all-entries)
+                                                   "" "/ssh:")))
                       ((string-match "/" string) ; Local file name.
                        (pcomplete-all-entries))
                       (t                ;Host name or local file name.
index cad2ffb2a2cd414e5f8d4b2478f4cf46ba758fb8..b71bfb202dbbb73e2dcacc2b80d7430fc7ca04cf 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'comint)
 
 (defgroup pcomplete nil
@@ -165,22 +164,8 @@ A non-nil value is useful if `pcomplete-autolist' is non-nil too."
   :type 'boolean
   :group 'pcomplete)
 
-(defcustom pcomplete-arg-quote-list nil
-  "List of characters to quote when completing an argument."
-  :type '(choice (repeat character)
-                (const :tag "Don't quote" nil))
-  :group 'pcomplete)
-
-(defcustom pcomplete-quote-arg-hook nil
-  "A hook which is run to quote a character within a filename.
-Each function is passed both the filename to be quoted, and the index
-to be considered.  If the function wishes to provide an alternate
-quoted form, it need only return the replacement string.  If no
-function provides a replacement, quoting shall proceed as normal,
-using a backslash to quote any character which is a member of
-`pcomplete-arg-quote-list'."
-  :type 'hook
-  :group 'pcomplete)
+(define-obsolete-variable-alias
+  'pcomplete-arg-quote-list 'comint-file-name-quote-list "24.2")
 
 (defcustom pcomplete-man-function 'man
   "A function to that will be called to display a manual page.
@@ -370,48 +355,28 @@ modified to be an empty string, or the desired separation string."
 ;; it pretty much impossible to have completion other than
 ;; prefix-completion.
 ;;
-;; pcomplete--common-quoted-suffix and comint--table-subvert try to
-;; work around this difficulty with heuristics, but it's
-;; really a hack.
-
-(defvar pcomplete-unquote-argument-function nil)
-
-(defun pcomplete-unquote-argument (s)
-  (cond
-   (pcomplete-unquote-argument-function
-    (funcall pcomplete-unquote-argument-function s))
-   ((null pcomplete-arg-quote-list) s)
-   (t
-    (replace-regexp-in-string "\\\\\\(.\\)" "\\1" s t))))
-
-(defun pcomplete--common-quoted-suffix (s1 s2)
-  ;; FIXME: Copied in comint.el.
-  "Find the common suffix between S1 and S2 where S1 is the expanded S2.
-S1 is expected to be the unquoted and expanded version of S2.
-Returns (PS1 . PS2), i.e. the shortest prefixes of S1 and S2, such that
-S1 = (concat PS1 SS1) and S2 = (concat PS2 SS2) and
-SS1 = (unquote SS2)."
-  (let* ((cs (comint--common-suffix s1 s2))
-         (ss1 (substring s1 (- (length s1) cs)))
-         (qss1 (pcomplete-quote-argument ss1))
-         qc s2b)
-    (if (and (not (equal ss1 qss1))
-             (setq qc (pcomplete-quote-argument (substring ss1 0 1)))
-            (setq s2b (- (length s2) cs (length qc) -1))
-            (>= s2b 0)                 ;bug#11158.
-             (eq t (compare-strings s2 s2b (- (length s2) cs -1)
-                                    qc nil nil)))
-        ;; The difference found is just that one char is quoted in S2
-        ;; but not in S1, keep looking before this difference.
-        (pcomplete--common-quoted-suffix
-         (substring s1 0 (- (length s1) cs))
-         (substring s2 0 s2b))
-      (cons (substring s1 0 (- (length s1) cs))
-            (substring s2 0 (- (length s2) cs))))))
-
-;; I don't think such commands are usable before first setting up buffer-local
-;; variables to parse args, so there's no point autoloading it.
-;; ;;;###autoload
+;; pcomplete--common-suffix and completion-table-subvert try to work around
+;; this difficulty with heuristics, but it's really a hack.
+
+(defvar pcomplete-unquote-argument-function #'comint--unquote-argument)
+
+(defsubst pcomplete-unquote-argument (s)
+  (funcall pcomplete-unquote-argument-function s))
+
+(defvar pcomplete-requote-argument-function #'comint--requote-argument)
+
+(defun pcomplete--common-suffix (s1 s2)
+  ;; Since S2 is expected to be the "unquoted/expanded" version of S1,
+  ;; there shouldn't be any case difference, even if the completion is
+  ;; case-insensitive.
+  (let ((case-fold-search nil))
+    (string-match
+     ;; \x3FFF7F is just an arbitrary char among the ones Emacs accepts
+     ;; that hopefully will never appear in normal text.
+     "\\(?:.\\|\n\\)*?\\(\\(?:.\\|\n\\)*\\)\x3FFF7F\\(?:.\\|\n\\)*\\1\\'"
+     (concat s1 "\x3FFF7F" s2))
+    (- (match-end 1) (match-beginning 1))))
+
 (defun pcomplete-completions-at-point ()
   "Provide standard completion using pcomplete's completion tables.
 Same as `pcomplete' but using the standard completion UI."
@@ -442,34 +407,31 @@ Same as `pcomplete' but using the standard completion UI."
            ;; pcomplete-stub and works from the buffer's text instead,
            ;; we need to trick minibuffer-complete, into using
            ;; pcomplete-stub without its knowledge.  To that end, we
-           ;; use comint--table-subvert to construct a completion
+           ;; use completion-table-subvert to construct a completion
            ;; table which expects strings using a prefix from the
            ;; buffer's text but internally uses the corresponding
            ;; prefix from pcomplete-stub.
            (beg (max (- (point) (length pcomplete-stub))
                      (pcomplete-begin)))
-           (buftext (buffer-substring beg (point))))
+           (buftext (pcomplete-unquote-argument
+                     (buffer-substring beg (point)))))
       (when completions
         (let ((table
-               (cond
-                ((not (equal pcomplete-stub buftext))
-                 ;; This isn't always strictly right (e.g. if
-                 ;; FOO="toto/$FOO", then completion of /$FOO/bar may
-                 ;; result in something incorrect), but given the lack of
-                 ;; any other info, it's about as good as it gets, and in
-                 ;; practice it should work just fine (fingers crossed).
-                 (let ((prefixes (pcomplete--common-quoted-suffix
+               (completion-table-with-quoting
+                (if (equal pcomplete-stub buftext)
+                    completions
+                  ;; This may not always be strictly right, but given the lack
+                  ;; of any other info, it's about as good as it gets, and in
+                  ;; practice it should work just fine (fingers crossed).
+                  (let ((suf-len (pcomplete--common-suffix
                                   pcomplete-stub buftext)))
-                   (comint--table-subvert
-                    completions (cdr prefixes) (car prefixes)
-                    #'pcomplete-quote-argument #'pcomplete-unquote-argument)))
-                (t
-                 (lambda (string pred action)
-                   (let ((res (complete-with-action
-                               action completions string pred)))
-                     (if (stringp res)
-                         (pcomplete-quote-argument res)
-                       res))))))
+                    (completion-table-subvert
+                     completions
+                     (substring buftext 0 (- (length buftext) suf-len))
+                     (substring pcomplete-stub 0
+                                (- (length pcomplete-stub) suf-len)))))
+                pcomplete-unquote-argument-function
+                pcomplete-requote-argument-function))
               (pred
                ;; Pare it down, if applicable.
                (when (and pcomplete-use-paring pcomplete-seen)
@@ -828,22 +790,8 @@ this is `comint-dynamic-complete-functions'."
              (throw 'pcompleted t)
            pcomplete-args))))))
 
-(defun pcomplete-quote-argument (filename)
-  "Return FILENAME with magic characters quoted.
-Magic characters are those in `pcomplete-arg-quote-list'."
-  (if (null pcomplete-arg-quote-list)
-      filename
-    (let ((index 0))
-      (mapconcat (lambda (c)
-                   (prog1
-                       (or (run-hook-with-args-until-success
-                            'pcomplete-quote-arg-hook filename index)
-                           (when (memq c pcomplete-arg-quote-list)
-                             (string ?\\ c))
-                           (char-to-string c))
-                     (setq index (1+ index))))
-                 filename
-                 ""))))
+(define-obsolete-function-alias
+  'pcomplete-quote-argument #'comint-quote-filename "24.2")
 
 ;; file-system completion lists
 
@@ -926,9 +874,9 @@ component, `default-directory' is used as the basis for completion."
                 ;; The env-var is "out of bounds".
                 (if (eq action t)
                     (complete-with-action action table newstring pred)
-                  (list* 'boundaries
-                         (+ (car bounds) (- orig-length (length newstring)))
-                         (cdr bounds)))
+                  `(boundaries
+                    ,(+ (car bounds) (- orig-length (length newstring)))
+                    . ,(cdr bounds)))
               ;; The env-var is in the file bounds.
               (if (eq action t)
                   (let ((comps (complete-with-action
@@ -937,9 +885,9 @@ component, `default-directory' is used as the basis for completion."
                     ;; Strip the part of each completion that's actually
                     ;; coming from the env-var.
                     (mapcar (lambda (s) (substring s len)) comps))
-                (list* 'boundaries
-                       (+ envpos (- orig-length (length newstring)))
-                       (cdr bounds))))))))))
+                `(boundaries
+                  ,(+ envpos (- orig-length (length newstring)))
+                  . ,(cdr bounds))))))))))
 
 (defsubst pcomplete-all-entries (&optional regexp predicate)
   "Like `pcomplete-entries', but doesn't ignore any entries."
@@ -1179,14 +1127,14 @@ Returns non-nil if a space was appended at the end."
     (if (not pcomplete-ignore-case)
        (insert-and-inherit (if raw-p
                                (substring entry (length stub))
-                             (pcomplete-quote-argument
+                             (comint-quote-filename
                               (substring entry (length stub)))))
       ;; the stub is not quoted at this time, so to determine the
       ;; length of what should be in the buffer, we must quote it
       ;; FIXME: Here we presume that quoting `stub' gives us the exact
       ;; text in the buffer before point, which is not guaranteed;
       ;; e.g. it is not the case in eshell when completing ${FOO}tm[TAB].
-      (delete-char (- (length (pcomplete-quote-argument stub))))
+      (delete-char (- (length (comint-quote-filename stub))))
       ;; if there is already a backslash present to handle the first
       ;; character, don't bother quoting it
       (when (eq (char-before) ?\\)
@@ -1194,7 +1142,7 @@ Returns non-nil if a space was appended at the end."
        (setq entry (substring entry 1)))
       (insert-and-inherit (if raw-p
                              entry
-                           (pcomplete-quote-argument entry))))
+                           (comint-quote-filename entry))))
     (let (space-added)
       (when (and (not (memq (char-before) pcomplete-suffix-list))
                 addsuffix)
@@ -1204,7 +1152,7 @@ Returns non-nil if a space was appended at the end."
            pcomplete-last-completion-stub stub)
       space-added)))
 
-;; selection of completions
+;; Selection of completions.
 
 (defun pcomplete-do-complete (stub completions)
   "Dynamically complete at point using STUB and COMPLETIONS.
index b2fffb49840aab16a61026fc5cb43d385947935a..e6df0df828213a283474923c0c296b1b927912a6 100644 (file)
@@ -50,8 +50,7 @@
 
 ;; Things we need.
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; Customize options.
 
@@ -260,8 +259,8 @@ Quit current game           \\[5x5-quit-game]"
 (defun 5x5-make-new-grid ()
   "Create and return a new `5x5' grid structure."
   (let ((grid (make-vector 5x5-grid-size nil)))
-    (loop for y from 0 to (1- 5x5-grid-size) do
-          (aset grid y (make-vector 5x5-grid-size nil)))
+    (dotimes (y 5x5-grid-size)
+      (aset grid y (make-vector 5x5-grid-size nil)))
     grid))
 
 (defun 5x5-cell (grid y x)
@@ -279,9 +278,9 @@ Quit current game           \\[5x5-quit-game]"
 (defun 5x5-copy-grid (grid)
   "Make a new copy of GRID."
   (let ((copy (5x5-make-new-grid)))
-    (loop for y from 0 to (1- 5x5-grid-size) do
-          (loop for x from 0 to (1- 5x5-grid-size) do
-                (5x5-set-cell copy y x (5x5-cell grid y x))))
+    (dotimes (y 5x5-grid-size)
+      (dotimes (x 5x5-grid-size)
+        (5x5-set-cell copy y x (5x5-cell grid y x))))
     copy))
 
 (defun 5x5-make-move (grid row col)
@@ -299,45 +298,46 @@ Quit current game           \\[5x5-quit-game]"
 
 (defun 5x5-row-value (row)
   "Get the \"on-value\" for grid row ROW."
-  (loop for y from 0 to (1- 5x5-grid-size) sum (if (aref row y) 1 0)))
+  (cl-loop for y from 0 to (1- 5x5-grid-size) sum (if (aref row y) 1 0)))
 
 (defun 5x5-grid-value (grid)
   "Get the \"on-value\" for grid GRID."
-  (loop for y from 0 to (1- 5x5-grid-size) sum (5x5-row-value (aref grid y))))
+  (cl-loop for y from 0 to (1- 5x5-grid-size)
+           sum (5x5-row-value (aref grid y))))
 
 (defun 5x5-draw-grid-end ()
   "Draw the top/bottom of the grid."
   (insert "+")
-  (loop for x from 0 to (1- 5x5-grid-size) do
-        (insert "-" (make-string 5x5-x-scale ?-)))
+  (dotimes (x 5x5-grid-size)
+    (insert "-" (make-string 5x5-x-scale ?-)))
   (insert "-+ "))
 
 (defun 5x5-draw-grid (grids)
   "Draw the grids GRIDS into the current buffer."
   (let ((inhibit-read-only t) grid-org)
     (erase-buffer)
-    (loop for grid in grids do (5x5-draw-grid-end))
+    (dolist (grid grids) (5x5-draw-grid-end))
     (insert "\n")
     (setq grid-org (point))
-    (loop for y from 0 to (1- 5x5-grid-size) do
-          (loop for lines from 0 to (1- 5x5-y-scale) do
-                (loop for grid in grids do
-                      (loop for x from 0 to (1- 5x5-grid-size) do
-                            (insert (if (zerop x) "| " " ")
-                                    (make-string 5x5-x-scale
-                                                 (if (5x5-cell grid y x) ?# ?.))))
-                      (insert " | "))
-                (insert "\n")))
+    (dotimes (y 5x5-grid-size)
+      (dotimes (lines 5x5-y-scale)
+        (dolist (grid grids)
+          (dotimes (x 5x5-grid-size)
+            (insert (if (zerop x) "| " " ")
+                    (make-string 5x5-x-scale
+                                 (if (5x5-cell grid y x) ?# ?.))))
+          (insert " | "))
+        (insert "\n")))
     (when 5x5-solver-output
       (if (= (car 5x5-solver-output) 5x5-moves)
          (save-excursion
            (goto-char grid-org)
            (beginning-of-line (+ 1 (/ 5x5-y-scale 2)))
-           (let ((solution-grid (cdadr 5x5-solver-output)))
-             (dotimes (y  5x5-grid-size)
+           (let ((solution-grid (cl-cdadr 5x5-solver-output)))
+             (dotimes (y 5x5-grid-size)
                (save-excursion
                  (forward-char  (+ 1 (/ (1+ 5x5-x-scale) 2)))
-                 (dotimes (x   5x5-grid-size)
+                 (dotimes (x 5x5-grid-size)
                    (when (5x5-cell solution-grid y x)
                      (if (= 0 (mod 5x5-x-scale 2))
                          (progn
@@ -350,7 +350,7 @@ Quit current game           \\[5x5-quit-game]"
                    (forward-char  (1+ 5x5-x-scale))))
                (forward-line  5x5-y-scale))))
        (setq 5x5-solver-output nil)))
-    (loop for grid in grids do (5x5-draw-grid-end))
+    (dolist (grid grids) (5x5-draw-grid-end))
     (insert "\n")
     (insert (format "On: %d  Moves: %d" (5x5-grid-value (car grids)) 5x5-moves))))
 
@@ -362,16 +362,16 @@ Quit current game           \\[5x5-quit-game]"
 
 (defun 5x5-made-move ()
   "Keep track of how many moves have been made."
-  (incf 5x5-moves))
+  (cl-incf 5x5-moves))
 
 (defun 5x5-make-random-grid (&optional move)
   "Make a random grid."
   (setq move (or move (symbol-function '5x5-flip-cell)))
   (let ((grid (5x5-make-new-grid)))
-    (loop for y from 0 to (1- 5x5-grid-size) do
-          (loop for x from 0 to (1- 5x5-grid-size) do
-                (if (zerop (random 2))
-                    (funcall move grid y x))))
+    (dotimes (y 5x5-grid-size)
+      (dotimes (x 5x5-grid-size)
+        (if (zerop (random 2))
+            (funcall move grid y x))))
     grid))
 
 ;; Cracker functions.
@@ -444,20 +444,20 @@ should return a grid vector array that is the new solution."
 (defun 5x5-make-xor-with-mutation (current best)
   "Xor current and best solution then mutate the result."
   (let ((xored (5x5-make-new-grid)))
-    (loop for y from 0 to (1- 5x5-grid-size) do
-          (loop for x from 0 to (1- 5x5-grid-size) do
-                (5x5-set-cell xored y x
-                              (5x5-xor (5x5-cell current y x)
-                                       (5x5-cell best    y x)))))
+    (dotimes (y 5x5-grid-size)
+      (dotimes (x 5x5-grid-size)
+        (5x5-set-cell xored y x
+                      (5x5-xor (5x5-cell current y x)
+                               (5x5-cell best    y x)))))
     (5x5-mutate-solution xored)))
 
 (defun 5x5-mutate-solution (solution)
   "Randomly flip bits in the solution."
-  (loop for y from 0 to (1- 5x5-grid-size) do
-        (loop for x from 0 to (1- 5x5-grid-size) do
-              (if (= (random (/ (* 5x5-grid-size 5x5-grid-size) 2))
-                     (/ (/ (* 5x5-grid-size 5x5-grid-size) 2) 2))
-                  (5x5-flip-cell solution y x))))
+  (dotimes (y 5x5-grid-size)
+    (dotimes (x 5x5-grid-size)
+      (if (= (random (/ (* 5x5-grid-size 5x5-grid-size) 2))
+             (/ (/ (* 5x5-grid-size 5x5-grid-size) 2) 2))
+          (5x5-flip-cell solution y x))))
   solution)
 
 (defun 5x5-play-solution (solution best)
@@ -465,15 +465,15 @@ should return a grid vector array that is the new solution."
 in progress because it is an animated attempt."
   (5x5-new-game)
   (let ((inhibit-quit t))
-    (loop for y from 0 to (1- 5x5-grid-size) do
-          (loop for x from 0 to (1- 5x5-grid-size) do
-                (setq 5x5-y-pos y
-                      5x5-x-pos x)
-                (if (5x5-cell solution y x)
-                    (5x5-flip-current))
-                (5x5-draw-grid (list 5x5-grid solution best))
-                (5x5-position-cursor)
-                (sit-for 5x5-animate-delay))))
+    (dotimes (y 5x5-grid-size)
+      (dotimes (x 5x5-grid-size)
+        (setq 5x5-y-pos y
+              5x5-x-pos x)
+        (if (5x5-cell solution y x)
+            (5x5-flip-current))
+        (5x5-draw-grid (list 5x5-grid solution best))
+        (5x5-position-cursor)
+        (sit-for 5x5-animate-delay))))
   5x5-grid)
 
 ;; Arithmetic solver
@@ -568,14 +568,14 @@ to complete the 5x5.
 
 Solutions are sorted from least to greatest Hamming weight."
   (require 'calc-ext)
-  (flet ((5x5-mat-mode-2
-         (a)
-         (math-map-vec
-          (lambda (y)
-            (math-map-vec
-             (lambda (x) `(mod ,x 2))
-             y))
-          a)))
+  (cl-flet ((5x5-mat-mode-2
+             (a)
+             (math-map-vec
+              (lambda (y)
+                (math-map-vec
+                 (lambda (x) `(mod ,x 2))
+                 y))
+              a)))
     (let* (calc-command-flags
           (grid-size-squared (* 5x5-grid-size 5x5-grid-size))
 
@@ -658,8 +658,8 @@ Solutions are sorted from least to greatest Hamming weight."
                       (cdr (5x5-mat-mode-2
                             '(vec (vec 0 1 1 1 0 1 0 1 0 1 1 1 0 1
                                        1 1 0 1 0 1 0 1 1 1 0)
-                                  (vec 1 1 0 1 1 0 0 0 0 0 1 1 0 1
-                                       1 0 0 0 0 0 1 1 0 1 1)))))
+                               (vec 1 1 0 1 1 0 0 0 0 0 1 1 0 1
+                                    1 0 0 0 0 0 1 1 0 1 1)))))
               (calcFunc-trn id))))
 
           (inv-base-change
@@ -758,9 +758,9 @@ Solutions are sorted from least to greatest Hamming weight."
                    ;; The Hamming Weight is computed by matrix reduction
                    ;; with an ad-hoc operator.
                    (math-reduce-vec
-                    ;; (cadadr '(vec (mod x 2))) => x
-                    (lambda (r x) (+ (if (integerp r) r (cadadr r))
-                                     (cadadr x)))
+                    ;; (cl-cadadr '(vec (mod x 2))) => x
+                    (lambda (r x) (+ (if (integerp r) r (cl-cadadr r))
+                                     (cl-cadadr x)))
                     solution); car
                    (5x5-vec-to-grid
                     (calcFunc-arrange solution 5x5-grid-size));cdr
@@ -878,28 +878,28 @@ lest."
   "Move up."
   (interactive)
   (unless (zerop 5x5-y-pos)
-    (decf 5x5-y-pos)
+    (cl-decf 5x5-y-pos)
     (5x5-position-cursor)))
 
 (defun 5x5-down ()
   "Move down."
   (interactive)
   (unless (= 5x5-y-pos (1- 5x5-grid-size))
-    (incf 5x5-y-pos)
+    (cl-incf 5x5-y-pos)
     (5x5-position-cursor)))
 
 (defun 5x5-left ()
   "Move left."
   (interactive)
   (unless (zerop 5x5-x-pos)
-    (decf 5x5-x-pos)
+    (cl-decf 5x5-x-pos)
     (5x5-position-cursor)))
 
 (defun 5x5-right ()
   "Move right."
   (interactive)
   (unless (= 5x5-x-pos (1- 5x5-grid-size))
-    (incf 5x5-x-pos)
+    (cl-incf 5x5-x-pos)
     (5x5-position-cursor)))
 
 (defun 5x5-bol ()
index a1420e62f029a0ee4bf26bf55878ea20174f3fa7..9919600202f246e1bcb8d94dca0e67be5cf94ca4 100644 (file)
@@ -92,7 +92,7 @@
 "*Number of steps `animate-string' will place a char before its last position.")
 
 (defvar animation-buffer-name nil
-  "*String naming the default buffer for animations.
+  "String naming the default buffer for animations.
 When nil animations displayed in the buffer named *Animation*.")
 
 ;;;###autoload
index a786f687124c411bde67e935f1027d9da4e18db2..1f04099a6ae9ef44ffa505f18b2bfd330f1dda09 100644 (file)
@@ -82,7 +82,6 @@
 (defconst bubbles-version "0.5" "Version number of bubbles.el.")
 
 (require 'gamegrid)
-(eval-when-compile (require 'cl))       ; for 'case
 
 ;; User options
 
@@ -718,58 +717,58 @@ static char * dot3d_xpm[] = {
 
 (defsubst bubbles--grid-width ()
   "Return the grid width for the current game theme."
-  (car (case bubbles-game-theme
-         (easy
+  (car (pcase bubbles-game-theme
+         (`easy
           bubbles--grid-small)
-         (medium
+         (`medium
           bubbles--grid-medium)
-         (difficult
+         (`difficult
           bubbles--grid-large)
-         (hard
+         (`hard
           bubbles--grid-huge)
-         (user-defined
+         (`user-defined
           bubbles-grid-size))))
 
 (defsubst bubbles--grid-height ()
   "Return the grid height for the current game theme."
-  (cdr (case bubbles-game-theme
-         (easy
+  (cdr (pcase bubbles-game-theme
+         (`easy
           bubbles--grid-small)
-         (medium
+         (`medium
           bubbles--grid-medium)
-         (difficult
+         (`difficult
           bubbles--grid-large)
-         (hard
+         (`hard
           bubbles--grid-huge)
-         (user-defined
+         (`user-defined
           bubbles-grid-size))))
 
 (defsubst bubbles--colors ()
   "Return the color list for the current game theme."
-  (case bubbles-game-theme
-    (easy
+  (pcase bubbles-game-theme
+    (`easy
      bubbles--colors-2)
-    (medium
+    (`medium
      bubbles--colors-3)
-    (difficult
+    (`difficult
      bubbles--colors-4)
-    (hard
+    (`hard
      bubbles--colors-5)
-    (user-defined
+    (`user-defined
      bubbles-colors)))
 
 (defsubst bubbles--shift-mode ()
   "Return the shift mode for the current game theme."
-  (case bubbles-game-theme
-    (easy
+  (pcase bubbles-game-theme
+    (`easy
      'default)
-    (medium
+    (`medium
      'default)
-    (difficult
+    (`difficult
      'always)
-    (hard
+    (`hard
      'always)
-    (user-defined
+    (`user-defined
      bubbles-shift-mode)))
 
 (defun bubbles-save-settings ()
@@ -1345,12 +1344,12 @@ Return t if new char is non-empty."
   "Prepare images for playing `bubbles'."
   (when (and (display-images-p)
              (not (eq bubbles-graphics-theme 'ascii)))
-    (let ((template (case bubbles-graphics-theme
-                      (circles bubbles--image-template-circle)
-                      (balls bubbles--image-template-ball)
-                      (squares bubbles--image-template-square)
-                      (diamonds bubbles--image-template-diamond)
-                      (emacs bubbles--image-template-emacs))))
+    (let ((template (pcase bubbles-graphics-theme
+                      (`circles bubbles--image-template-circle)
+                      (`balls bubbles--image-template-ball)
+                      (`squares bubbles--image-template-square)
+                      (`diamonds bubbles--image-template-diamond)
+                      (`emacs bubbles--image-template-emacs))))
       (setq bubbles--empty-image
             (create-image (replace-regexp-in-string
                            "^\"\\(.*\\)\t.*c .*\",$"
index 06bd962d9257fb6a3dbed750c5b4864d1d785dd7..cbf29a26a713bf1bd7c4d95c2f068d0d5d8a1d92 100644 (file)
@@ -96,6 +96,8 @@ of load, ENDMSG at the end."
   "Reads in the PHRASE-FILE, returns it as a vector of strings.
 Emit STARTMSG and ENDMSG before and after.  Caches the result; second
 and subsequent calls on the same file won't go to disk."
+  (or (file-readable-p phrase-file)
+      (error "Cannot read file `%s'" phrase-file))
   (let ((sym (intern-soft phrase-file cookie-cache)))
     (and sym (not (equal (symbol-function sym)
                         (nth 5 (file-attributes phrase-file))))
index 438fae4383d30823950496930fc786e24e1f695e..8d9506a161448cd6d1da9e5a238ea337a69d0d3c 100644 (file)
@@ -88,8 +88,7 @@
 ;;; Variables:
 ;;;===================================================================
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup decipher nil
   "Cryptanalyze monoalphabetic substitution ciphers."
@@ -170,7 +169,7 @@ in your `.emacs' file.")
     (let ((key ?a))
       (while (<= key ?z)
        (define-key map (vector key) 'decipher-keypress)
-       (incf key)))
+       (cl-incf key)))
     map)
   "Keymap for Decipher mode.")
 
@@ -194,7 +193,7 @@ in your `.emacs' file.")
         (c ?0))
     (while (<= c ?9)
       (modify-syntax-entry c "_" table) ;Digits are not part of words
-      (incf c))
+      (cl-incf c))
     (setq decipher-mode-syntax-table table)))
 
 (defvar decipher-alphabet nil)
@@ -414,7 +413,7 @@ The most useful commands are:
   (if undo-rec
       (progn
         (push undo-rec decipher-undo-list)
-        (incf decipher-undo-list-size)
+        (cl-incf decipher-undo-list-size)
         (if (> decipher-undo-list-size decipher-undo-limit)
             (let ((new-size (- decipher-undo-limit 100)))
               ;; Truncate undo list to NEW-SIZE elements:
@@ -588,7 +587,7 @@ you have determined the keyword."
           (progn
             (while (rassoc cipher-char decipher-alphabet)
               ;; Find the next unused letter
-              (incf cipher-char))
+              (cl-incf cipher-char))
             (push (cons ?\s cipher-char) undo-rec)
             (decipher-set-map cipher-char (car plain-map) t))))
     (decipher-add-undo undo-rec)))
@@ -644,7 +643,7 @@ You should use this if you edit the ciphertext."
       (while (>= plain-char ?a)
         (backward-char)
         (push (cons plain-char (following-char)) decipher-alphabet)
-        (decf plain-char)))))
+        (cl-decf plain-char)))))
 
 ;;;===================================================================
 ;;; Analyzing ciphertext:
@@ -805,8 +804,8 @@ TOTAL is the total number of letters in the ciphertext."
       (while temp-list
         (insert (caar temp-list)
                 (format "%4d%3d%%  "
-                        (cadar temp-list)
-                        (/ (* 100 (cadar temp-list)) total)))
+                        (cl-cadar temp-list)
+                        (/ (* 100 (cl-cadar temp-list)) total)))
         (setq temp-list (nthcdr 4 temp-list)))
       (insert ?\n)
       (setq freq-list (cdr freq-list)
@@ -838,17 +837,17 @@ TOTAL is the total number of letters in the ciphertext."
   ;;     A vector of 26 integers, counting the number of occurrences
   ;;     of the corresponding characters.
   (setq decipher--digram (format "%c%c" decipher--prev-char decipher-char))
-  (incf (cdr (or (assoc decipher--digram decipher--digram-list)
+  (cl-incf (cdr (or (assoc decipher--digram decipher--digram-list)
                  (car (push (cons decipher--digram 0)
                             decipher--digram-list)))))
   (and (>= decipher--prev-char ?A)
-       (incf (aref (aref decipher--before (- decipher--prev-char ?A))
+       (cl-incf (aref (aref decipher--before (- decipher--prev-char ?A))
                    (if (equal decipher-char ?\s)
                        26
                      (- decipher-char ?A)))))
   (and (>= decipher-char ?A)
-       (incf (aref decipher--freqs (- decipher-char ?A)))
-       (incf (aref (aref decipher--after (- decipher-char ?A))
+       (cl-incf (aref decipher--freqs (- decipher-char ?A)))
+       (cl-incf (aref (aref decipher--after (- decipher-char ?A))
                    (if (equal decipher--prev-char ?\s)
                        26
                      (- decipher--prev-char ?A)))))
@@ -859,8 +858,8 @@ TOTAL is the total number of letters in the ciphertext."
   (let ((total 0))
     (concat
      (mapconcat (lambda (x)
-                  (cond ((> x 99) (incf total) "XX")
-                        ((> x 0)  (incf total) (format "%2d" x))
+                  (cond ((> x 99) (cl-incf total) "XX")
+                        ((> x 0)  (cl-incf total) (format "%2d" x))
                         (t        "  ")))
                 counts
                 "")
@@ -873,10 +872,10 @@ TOTAL is the total number of letters in the ciphertext."
   ;; We do not include spaces (word divisions) in this count.
   (let ((total 0)
         (i 26))
-    (while (>= (decf i) 0)
+    (while (>= (cl-decf i) 0)
       (if (or (> (aref before-count i) 0)
               (> (aref after-count  i) 0))
-          (incf total)))
+          (cl-incf total)))
     total))
 
 (defun decipher-analyze-buffer ()
@@ -890,7 +889,7 @@ Creates the statistics buffer if it doesn't exist."
         decipher--digram decipher--digram-list freq-list)
     (message "Scanning buffer...")
     (let ((i 26))
-      (while (>= (decf i) 0)
+      (while (>= (cl-decf i) 0)
         (aset decipher--before i (make-vector 27 0))
         (aset decipher--after  i (make-vector 27 0))))
     (if decipher-ignore-spaces
@@ -898,7 +897,7 @@ Creates the statistics buffer if it doesn't exist."
           (decipher-loop-no-breaks 'decipher--analyze)
           ;; The first character of ciphertext was marked as following a space:
           (let ((i 26))
-            (while (>= (decf i) 0)
+            (while (>= (cl-decf i) 0)
               (aset (aref decipher--after  i) 26 0))))
       (decipher-loop-with-breaks 'decipher--analyze))
     (message "Processing results...")
@@ -913,7 +912,7 @@ Creates the statistics buffer if it doesn't exist."
     ;;   of times it occurs, and DIFFERENT is the number of different
     ;;   letters it appears next to.
     (let ((i 26))
-      (while (>= (decf i) 0)
+      (while (>= (cl-decf i) 0)
         (setq freq-list
               (cons (list (+ i ?A)
                           (aref decipher--freqs i)
@@ -933,7 +932,7 @@ Creates the statistics buffer if it doesn't exist."
       (insert ?\n)
       ;; Display frequency counts for letters in order of frequency:
       (setq freq-list (sort freq-list
-                            (lambda (a b) (> (second a) (second b)))))
+                            (lambda (a b) (> (cl-second a) (cl-second b)))))
       (decipher-insert-frequency-counts freq-list total-chars)
       ;; Display letters in order of frequency:
       (insert ?\n (mapconcat (lambda (a) (char-to-string (car a)))
@@ -957,11 +956,11 @@ Creates the statistics buffer if it doesn't exist."
       ;; Display adjacency list for each letter, sorted in descending
       ;; order of the number of adjacent letters:
       (setq freq-list (sort freq-list
-                            (lambda (a b) (> (third a) (third b)))))
+                            (lambda (a b) (> (cl-third a) (cl-third b)))))
       (let ((temp-list freq-list)
             entry i)
         (while (setq entry (pop temp-list))
-          (if (equal 0 (second entry))
+          (if (equal 0 (cl-second entry))
               nil                       ;This letter was not used
             (setq i (- (car entry) ?A))
             (insert ?\n "  "
@@ -969,8 +968,8 @@ Creates the statistics buffer if it doesn't exist."
                     (car entry)
                     ": A B C D E F G H I J K L M N O P Q R S T U V W X Y Z *"
                     (format "%4d %4d %3d%%\n  "
-                            (third entry) (second entry)
-                            (/ (* 100 (second entry)) total-chars))
+                            (cl-third entry) (cl-second entry)
+                            (/ (* 100 (cl-second entry)) total-chars))
                     (decipher--digram-counts (aref decipher--after  i)) ?\n))))
       (setq buffer-read-only t)
       (set-buffer-modified-p nil)
index d79f9cd31bd6eda2fe36eead78f8ebadbedd912b..fdae2ec93261f242a64a58de03a23855892199cc 100644 (file)
@@ -832,17 +832,17 @@ Otherwise call the Doctor to parse preceding sentence."
       (doctor-read-print)
     (newline arg)))
 
-(defun doctor-read-print nil
+(defun doctor-read-print ()
   "Top level loop."
   (interactive)
-  (let ((sent (doctor-readin)))
-    (insert "\n")
-    (setq doctor--lincount (1+ doctor--lincount))
-    (doctor-doc sent)
-    (insert "\n")
-    (setq doctor--bak sent)))
-
-(defun doctor-readin nil
+  (setq doctor-sent (doctor-readin))
+  (insert "\n")
+  (setq doctor--lincount (1+ doctor--lincount))
+  (doctor-doc)
+  (insert "\n")
+  (setq doctor--bak doctor-sent))
+
+(defun doctor-readin ()
   "Read a sentence.  Return it as a list of words."
   (let (sentence)
     (backward-sentence 1)
@@ -860,25 +860,25 @@ Otherwise call the Doctor to parse preceding sentence."
 \f
 ;; Main processing function for sentences that have been read.
 
-(defun doctor-doc (sent)
+(defun doctor-doc ()
   (cond
-   ((equal sent '(foo))
+   ((equal doctor-sent '(foo))
     (doctor-type '(bar! (doc$ doctor--please) (doc$ doctor--continue) \.)))
-   ((member sent doctor--howareyoulst)
+   ((member doctor-sent doctor--howareyoulst)
     (doctor-type '(i\'m ok \.  (doc$ doctor--describe) yourself \.)))
-   ((or (member sent '((good bye) (see you later) (i quit) (so long)
-                      (go away) (get lost)))
-       (memq (car sent)
+   ((or (member doctor-sent '((good bye) (see you later) (i quit) (so long)
+                             (go away) (get lost)))
+       (memq (car doctor-sent)
              '(bye halt break quit done exit goodbye
                    bye\, stop pause goodbye\, stop pause)))
     (doctor-type (doc$ doctor--bye)))
-   ((and (eq (car sent) 'you)
-        (memq (cadr sent) doctor--abusewords))
-    (setq doctor-found (cadr sent))
+   ((and (eq (car doctor-sent) 'you)
+        (memq (cadr doctor-sent) doctor--abusewords))
+    (setq doctor-found (cadr doctor-sent))
     (doctor-type (doc$ doctor--abuselst)))
-   ((eq (car sent) 'whatmeans)
-    (doctor-def (cadr sent)))
-   ((equal sent '(parse))
+   ((eq (car doctor-sent) 'whatmeans)
+    (doctor-def (cadr doctor-sent)))
+   ((equal doctor-sent '(parse))
     (doctor-type (list  'subj '= doctor-subj ",  "
                        'verb '= doctor-verb "\n"
                        'object 'phrase '= doctor-obj ","
@@ -890,29 +890,31 @@ Otherwise call the Doctor to parse preceding sentence."
                        'sentence 'used 'was
                        "..."
                        '(doc// doctor--bak))))
-   ((memq (car sent) '(are is do has have how when where who why))
+   ((memq (car doctor-sent) '(are is do has have how when where who why))
     (doctor-type (doc$ doctor--qlist)))
    ;;   ((eq (car sent) 'forget)
    ;;    (set (cadr sent) nil)
    ;;    (doctor-type '((doc$ doctor--isee) (doc$ doctor--please)
    ;;     (doc$ doctor--continue)\.)))
    (t
-    (if (doctor-defq sent) (doctor-define sent doctor-found))
-    (if (> (length sent) 12) (setq sent (doctor-shorten sent)))
-    (setq sent (doctor-correct-spelling (doctor-replace sent doctor--replist)))
-    (cond ((and (not (memq 'me sent)) (not (memq 'i sent))
-               (memq 'am sent))
-          (setq sent (doctor-replace sent '((am . (are)))))))
-    (cond ((equal (car sent) 'yow) (doctor-zippy))
-         ((< (length sent) 2)
-          (cond ((eq (doctor-meaning (car sent)) 'howdy)
+    (if (doctor-defq doctor-sent) (doctor-define doctor-sent doctor-found))
+    (if (> (length doctor-sent) 12)
+       (setq doctor-sent (doctor-shorten doctor-sent)))
+    (setq doctor-sent (doctor-correct-spelling
+                      (doctor-replace doctor-sent doctor--replist)))
+    (cond ((and (not (memq 'me doctor-sent)) (not (memq 'i doctor-sent))
+               (memq 'am doctor-sent))
+          (setq doctor-sent (doctor-replace doctor-sent '((am . (are)))))))
+    (cond ((equal (car doctor-sent) 'yow) (doctor-zippy))
+         ((< (length doctor-sent) 2)
+          (cond ((eq (doctor-meaning (car doctor-sent)) 'howdy)
                  (doctor-howdy))
                 (t (doctor-short))))
          (t
-          (if (memq 'am sent)
-              (setq sent (doctor-replace sent '((me . (i))))))
-          (setq sent (doctor-fixup sent))
-          (if (and (eq (car sent) 'do) (eq (cadr sent) 'not))
+          (if (memq 'am doctor-sent)
+              (setq doctor-sent (doctor-replace doctor-sent '((me . (i))))))
+          (setq doctor-sent (doctor-fixup doctor-sent))
+          (if (and (eq (car doctor-sent) 'do) (eq (cadr doctor-sent) 'not))
               (cond ((zerop (random 3))
                      (doctor-type '(are you (doc$ doctor--afraidof) that \?)))
                     ((zerop (random 2))
@@ -921,9 +923,9 @@ Otherwise call the Doctor to parse preceding sentence."
                      (doctor-rthing))
                     (t
                      (doctor-type '((doc$ doctor--whysay) that i shouldn\'t
-                                    (cddr sent)
+                                    (cddr doctor-sent)
                                     \?))))
-            (doctor-go (doctor-wherego sent))))))))
+            (doctor-go (doctor-wherego doctor-sent))))))))
 \f
 ;; Things done to process sentences once read.
 
index 3b2e6c196f6f33cb56431a38b771a81feaca18b0..f3e277e338cde89604ce3b0b926ce30423ec557b 100644 (file)
@@ -26,9 +26,6 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
 ;; ;;;;;;;;;;;;; buffer-local variables ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 (defvar gamegrid-use-glyphs t
@@ -212,20 +209,20 @@ static unsigned char gamegrid_bits[] = {
 (defun gamegrid-make-face (data-spec-list color-spec-list)
   (let ((data (gamegrid-match-spec-list data-spec-list))
        (color (gamegrid-match-spec-list color-spec-list)))
-    (case data
-      (color-x
+    (pcase data
+      (`color-x
        (gamegrid-make-color-x-face color))
-      (grid-x
+      (`grid-x
        (unless gamegrid-grid-x-face
         (setq gamegrid-grid-x-face (gamegrid-make-grid-x-face)))
        gamegrid-grid-x-face)
-      (mono-x
+      (`mono-x
        (unless gamegrid-mono-x-face
         (setq gamegrid-mono-x-face (gamegrid-make-mono-x-face)))
        gamegrid-mono-x-face)
-      (color-tty
+      (`color-tty
        (gamegrid-make-color-tty-face color))
-      (mono-tty
+      (`mono-tty
        (unless gamegrid-mono-tty-face
         (setq gamegrid-mono-tty-face (gamegrid-make-mono-tty-face)))
        gamegrid-mono-tty-face))))
@@ -311,13 +308,13 @@ static unsigned char gamegrid_bits[] = {
                   (intern (concat "gamegrid-face-" (buffer-name)))))
   (when (eq gamegrid-display-mode 'glyph)
     (let ((max-height nil))
-      (loop for c from 0 to 255 do
-           (let ((glyph (aref gamegrid-display-table c)))
-             (when (and (listp glyph) (eq (car  glyph) 'image))
-               (let ((height (cdr (image-size glyph))))
-                 (if (or (null max-height)
-                         (< max-height height))
-                     (setq max-height height))))))
+      (dotimes (c 256)
+        (let ((glyph (aref gamegrid-display-table c)))
+          (when (and (listp glyph) (eq (car  glyph) 'image))
+            (let ((height (cdr (image-size glyph))))
+              (if (or (null max-height)
+                      (< max-height height))
+                  (setq max-height height))))))
       (when (and max-height (< max-height 1))
        (let ((default-font-height (face-attribute 'default :height))
              (resy (/ (display-pixel-height) (/ (display-mm-height) 25.4)))
@@ -332,10 +329,10 @@ static unsigned char gamegrid_bits[] = {
   (setq gamegrid-display-mode (gamegrid-display-type))
   (setq gamegrid-display-table (make-display-table))
   (setq gamegrid-face-table (make-vector 256 nil))
-  (loop for c from 0 to 255 do
+  (dotimes (c 256)
     (let* ((spec (aref gamegrid-display-options c))
-          (glyph (gamegrid-make-glyph (car spec) (caddr spec)))
-          (face (gamegrid-make-face (cadr spec) (caddr spec))))
+          (glyph (gamegrid-make-glyph (car spec) (nth 2 spec)))
+          (face (gamegrid-make-face (cadr spec) (nth 2 spec))))
       (aset gamegrid-face-table c face)
       (aset gamegrid-display-table c glyph)))
   (gamegrid-setup-default-font)
@@ -451,10 +448,10 @@ group.  You probably need special user privileges to do this.
 On non-POSIX systems Emacs searches for FILE in the directory
 specified by the variable `temporary-file-directory'.  If necessary,
 FILE is created there."
-  (case system-type
-    ((ms-dos windows-nt)
+  (pcase system-type
+    ((or `ms-dos `windows-nt)
      (gamegrid-add-score-insecure file score))
-    (t
+    (_
      (gamegrid-add-score-with-update-game-score file score))))
 
 
index 6b6e81dfaba8fdb922a70dcecbe3ce633219d4b2..6d73e2ccb65daa035bf51a814798a6be51b3e6aa 100644 (file)
@@ -89,16 +89,16 @@ One useful value to include is `turn-on-font-lock' to highlight the pieces."
 ;; look rectangular, but spacings SHOULD be at least 2 (MUST BE at least 1).
 
 (defconst gomoku-square-width 4
-  "*Horizontal spacing between squares on the Gomoku board.")
+  "Horizontal spacing between squares on the Gomoku board.")
 
 (defconst gomoku-square-height 2
-  "*Vertical spacing between squares on the Gomoku board.")
+  "Vertical spacing between squares on the Gomoku board.")
 
 (defconst gomoku-x-offset 3
-  "*Number of columns between the Gomoku board and the side of the window.")
+  "Number of columns between the Gomoku board and the side of the window.")
 
 (defconst gomoku-y-offset 1
-  "*Number of lines between the Gomoku board and the top of the window.")
+  "Number of lines between the Gomoku board and the top of the window.")
 
 
 (defvar gomoku-mode-map
@@ -173,7 +173,7 @@ One useful value to include is `turn-on-font-lock' to highlight the pieces."
   '(("O" . 'gomoku-O)
     ("X" . 'gomoku-X)
     ("[-|/\\]" 0 (if gomoku-emacs-won 'gomoku-O 'gomoku-X)))
-  "*Font lock rules for Gomoku.")
+  "Font lock rules for Gomoku.")
 
 (put 'gomoku-mode 'front-sticky
      (put 'gomoku-mode 'rear-nonsticky '(intangible)))
index 31a6d6f425b969b9d856d40ea0cb648fb15f98d1..9e8b6ff97eb50e04e0e0e8ab2716c6fd75a06823 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl)
-  ;; dynamic bondage:
-  (defvar baseward-step)
-  (defvar fly-step)
-  (defvar fly-row-start)
-  (defvar pole-width)
-  (defvar pole-char)
-  (defvar line-offset))
+(eval-when-compile (require 'cl-lib))
+;; dynamic bondage:
+(defvar baseward-step)
+(defvar fly-step)
+(defvar fly-row-start)
+(defvar pole-width)
+(defvar pole-char)
+(defvar line-offset)
 
 (defgroup hanoi nil
   "The Towers of Hanoi."
@@ -124,9 +123,9 @@ second since 1970-01-01 00:00:00 GMT.
 Repent before ring 31 moves."
   (interactive)
   (let* ((start (ftruncate (float-time)))
-        (bits (loop repeat 32
-                    for x = (/ start (expt 2.0 31)) then (* x 2.0)
-                    collect (truncate (mod x 2.0))))
+        (bits (cl-loop repeat 32
+                        for x = (/ start (expt 2.0 31)) then (* x 2.0)
+                        collect (truncate (mod x 2.0))))
         (hanoi-move-period 1.0))
     (hanoi-internal 32 bits start)))
 
@@ -138,9 +137,9 @@ current-time interface is made s2G-compliant, hanoi.el will need
 to be updated."
   (interactive)
   (let* ((start (ftruncate (float-time)))
-        (bits (loop repeat 64
-                    for x = (/ start (expt 2.0 63)) then (* x 2.0)
-                    collect (truncate (mod x 2.0))))
+        (bits (cl-loop repeat 64
+                        for x = (/ start (expt 2.0 63)) then (* x 2.0)
+                        collect (truncate (mod x 2.0))))
         (hanoi-move-period 1.0))
     (hanoi-internal 64 bits start)))
 
@@ -197,22 +196,22 @@ BITS must be of length nrings.  Start at START-TIME."
              (setq fly-row-start (1- line-offset))
              (setq fly-step line-offset)
              (setq baseward-step -1)
-             (loop repeat base-len do
-                   (unless (zerop base-lines)
-                     (insert-char ?\  (1- base-lines))
-                     (insert base-char)
-                     (hanoi-put-face (1- (point)) (point) hanoi-base-face))
-                   (insert-char ?\  (+ 2 nrings))
-                   (insert ?\n))
+             (cl-loop repeat base-len do
+                       (unless (zerop base-lines)
+                         (insert-char ?\  (1- base-lines))
+                         (insert base-char)
+                         (hanoi-put-face (1- (point)) (point) hanoi-base-face))
+                       (insert-char ?\  (+ 2 nrings))
+                       (insert ?\n))
              (delete-char -1)
-             (loop for coord in pole-coords do
-                   (loop for row from (- coord (/ pole-width 2))
-                         for start = (+ (* row line-offset) base-lines 1)
-                         repeat pole-width do
-                         (subst-char-in-region start (+ start nrings 1)
-                                               ?\  pole-char)
-                         (hanoi-put-face start (+ start nrings 1)
-                                         hanoi-pole-face))))
+             (dolist (coord pole-coords)
+                (cl-loop for row from (- coord (/ pole-width 2))
+                         for start = (+ (* row line-offset) base-lines 1)
+                         repeat pole-width do
+                         (subst-char-in-region start (+ start nrings 1)
+                                               ?\  pole-char)
+                         (hanoi-put-face start (+ start nrings 1)
+                                         hanoi-pole-face))))
          ;; vertical
          (setq line-offset (1+ base-len))
          (setq fly-step 1)
@@ -222,17 +221,17 @@ BITS must be of length nrings.  Start at START-TIME."
            (setq fly-row-start (point))
            (insert-char ?\  base-len)
            (insert ?\n)
-           (loop repeat (1+ nrings)
-                 with pole-line =
-                 (loop with line = (make-string base-len ?\ )
-                       for coord in pole-coords
-                       for start = (- coord (/ pole-width 2))
-                       for end = (+ start pole-width) do
-                       (hanoi-put-face start end hanoi-pole-face line)
-                       (loop for i from start below end do
-                             (aset line i pole-char))
-                       finally return line)
-                 do (insert pole-line ?\n))
+           (cl-loop repeat (1+ nrings)
+                     with pole-line =
+                     (cl-loop with line = (make-string base-len ?\ )
+                              for coord in pole-coords
+                              for start = (- coord (/ pole-width 2))
+                              for end = (+ start pole-width) do
+                              (hanoi-put-face start end hanoi-pole-face line)
+                              (cl-loop for i from start below end do
+                                       (aset line i pole-char))
+                              finally return line)
+                     do (insert pole-line ?\n))
            (insert-char base-char base-len)
            (hanoi-put-face (- (point) base-len) (point) hanoi-base-face)
            (set-window-start (selected-window)
@@ -244,40 +243,41 @@ BITS must be of length nrings.  Start at START-TIME."
             ;; the car is the position of the top ring currently on the pole,
             ;;   (or the base of the pole if it is empty).
             ;; the cdr is in the fly-row just above the pole.
-            (poles (loop for coord in pole-coords
-                         for fly-pos = (+ fly-row-start (* fly-step coord))
-                         for base = (+ fly-pos (* baseward-step (+ 2 nrings)))
-                         collect (cons base fly-pos)))
+            (poles
+              (cl-loop for coord in pole-coords
+                       for fly-pos = (+ fly-row-start (* fly-step coord))
+                       for base = (+ fly-pos (* baseward-step (+ 2 nrings)))
+                       collect (cons base fly-pos)))
             ;; compute the string for each ring and make the list of
             ;; ring pairs.  Each ring pair is initially (str . diameter).
             ;; Once placed in buffer it is changed to (center-pos . diameter).
             (rings
-             (loop
-               ;; radii are measured from the edge of the pole out.
-               ;; So diameter = 2 * radius + pole-width.  When
-               ;; there's room, we make each ring's radius =
-               ;; pole-number + 1.  If there isn't room, we step
-               ;; evenly from the max radius down to 1.
-               with max-radius = (min nrings
-                                      (/ (- max-ring-diameter pole-width) 2))
-               for n from (1- nrings) downto 0
-               for radius =  (1+ (/ (* n max-radius) nrings))
-               for diameter = (+ pole-width (* 2 radius))
-               with format-str = (format "%%0%dd" pole-width)
-               for str = (concat (if vert "<" "^")
-                                 (make-string (1- radius) (if vert ?\- ?\|))
-                                 (format format-str n)
-                                 (make-string (1- radius) (if vert ?\- ?\|))
-                                 (if vert ">" "v"))
-               for face =
-                 (if (eq (logand n 1) 1) ; oddp would require cl at runtime
-                     hanoi-odd-ring-face hanoi-even-ring-face)
-               do (hanoi-put-face 0 (length str) face str)
-               collect (cons str diameter)))
+             (cl-loop
+               ;; radii are measured from the edge of the pole out.
+               ;; So diameter = 2 * radius + pole-width.  When
+               ;; there's room, we make each ring's radius =
+               ;; pole-number + 1.  If there isn't room, we step
+               ;; evenly from the max radius down to 1.
+               with max-radius = (min nrings
+                                      (/ (- max-ring-diameter pole-width) 2))
+               for n from (1- nrings) downto 0
+               for radius =  (1+ (/ (* n max-radius) nrings))
+               for diameter = (+ pole-width (* 2 radius))
+               with format-str = (format "%%0%dd" pole-width)
+               for str = (concat (if vert "<" "^")
+                                 (make-string (1- radius) (if vert ?\- ?\|))
+                                 (format format-str n)
+                                 (make-string (1- radius) (if vert ?\- ?\|))
+                                 (if vert ">" "v"))
+               for face =
+               (if (eq (logand n 1) 1)  ; oddp would require cl at runtime
+                   hanoi-odd-ring-face hanoi-even-ring-face)
+               do (hanoi-put-face 0 (length str) face str)
+               collect (cons str diameter)))
             ;; Disable display of line and column numbers, for speed.
             (line-number-mode nil) (column-number-mode nil))
          ;; do it!
-         (hanoi-n bits rings (car poles) (cadr poles) (caddr poles)
+         (hanoi-n bits rings (car poles) (cadr poles) (cl-caddr poles)
                   start-time))
        (message "Done"))
     (setq buffer-read-only t)
@@ -322,14 +322,14 @@ BITS must be of length nrings.  Start at START-TIME."
 
 ;; put never-before-placed RING on POLE and update their cars.
 (defun hanoi-insert-ring (ring pole)
-  (decf (car pole) baseward-step)
+  (cl-decf (car pole) baseward-step)
   (let ((str (car ring))
        (start (- (car pole) (* (/ (cdr ring) 2) fly-step))))
     (setcar ring (car pole))
-    (loop for pos upfrom start by fly-step
-             for i below (cdr ring) do
-             (subst-char-in-region pos (1+ pos) (char-after pos) (aref str i))
-             (set-text-properties pos (1+ pos) (text-properties-at i str)))
+    (cl-loop for pos upfrom start by fly-step
+             for i below (cdr ring) do
+             (subst-char-in-region pos (1+ pos) (char-after pos) (aref str i))
+             (set-text-properties pos (1+ pos) (text-properties-at i str)))
     (hanoi-goto-char (car pole))))
 
 ;; like goto-char, but if position is outside the window, then move to
@@ -341,8 +341,8 @@ BITS must be of length nrings.  Start at START-TIME."
 
 ;; do one pole-to-pole move and update the ring and pole pairs.
 (defun hanoi-move-ring (ring from to start-time)
-  (incf (car from) baseward-step)
-  (decf (car to) baseward-step)
+  (cl-incf (car from) baseward-step)
+  (cl-decf (car to) baseward-step)
   (let* ;; We move flywards-steps steps up the pole to the fly row,
        ;; then fly fly-steps steps across the fly row, then go
        ;; baseward-steps steps down the new pole.
@@ -378,15 +378,15 @@ BITS must be of length nrings.  Start at START-TIME."
                    (/ (- tick flyward-ticks fly-ticks)
                       ticks-per-pole-step))))))))
     (if hanoi-move-period
-       (loop for elapsed = (- (float-time) start-time)
-             while (< elapsed hanoi-move-period)
-             with tick-period = (/ (float hanoi-move-period) total-ticks)
-             for tick = (ceiling (/ elapsed tick-period)) do
-             (hanoi-ring-to-pos ring (funcall tick-to-pos tick))
-             (hanoi-sit-for (- (* tick tick-period) elapsed)))
-      (loop for tick from 1 to total-ticks by 2 do
-           (hanoi-ring-to-pos ring (funcall tick-to-pos tick))
-           (hanoi-sit-for 0)))
+       (cl-loop for elapsed = (- (float-time) start-time)
+                 while (< elapsed hanoi-move-period)
+                 with tick-period = (/ (float hanoi-move-period) total-ticks)
+                 for tick = (ceiling (/ elapsed tick-period)) do
+                 (hanoi-ring-to-pos ring (funcall tick-to-pos tick))
+                 (hanoi-sit-for (- (* tick tick-period) elapsed)))
+      (cl-loop for tick from 1 to total-ticks by 2 do
+               (hanoi-ring-to-pos ring (funcall tick-to-pos tick))
+               (hanoi-sit-for 0)))
     ;; Always make last move to keep pole and ring data consistent
     (hanoi-ring-to-pos ring (car to))
     (if hanoi-move-period (+ start-time hanoi-move-period))))
@@ -403,11 +403,12 @@ BITS must be of length nrings.  Start at START-TIME."
     (let* ((start (- (car ring) (* (/ (cdr ring) 2) fly-step)))
           (new-start (- pos (- (car ring) start))))
       (if hanoi-horizontal-flag
-         (loop for i below (cdr ring)
-               for j = (if (< new-start start) i (- (cdr ring) i 1))
-               for old-pos = (+ start (* j fly-step))
-               for new-pos = (+ new-start (* j fly-step)) do
-               (transpose-regions old-pos (1+ old-pos) new-pos (1+ new-pos)))
+         (cl-loop for i below (cdr ring)
+                   for j = (if (< new-start start) i (- (cdr ring) i 1))
+                   for old-pos = (+ start (* j fly-step))
+                   for new-pos = (+ new-start (* j fly-step)) do
+                   (transpose-regions old-pos (1+ old-pos)
+                                      new-pos (1+ new-pos)))
        (let ((end (+ start (cdr ring)))
              (new-end (+ new-start (cdr ring))))
          (if (< (abs (- new-start start)) (- end start))
@@ -425,9 +426,9 @@ BITS must be of length nrings.  Start at START-TIME."
             (curr-char (if on-pole ?\  pole-char))
             (face (if on-pole hanoi-pole-face nil)))
        (if hanoi-horizontal-flag
-           (loop for pos from pole-start below pole-end by line-offset do
-                 (subst-char-in-region pos (1+ pos) curr-char new-char)
-                 (hanoi-put-face pos (1+ pos) face))
+           (cl-loop for pos from pole-start below pole-end by line-offset do
+                     (subst-char-in-region pos (1+ pos) curr-char new-char)
+                     (hanoi-put-face pos (1+ pos) face))
          (subst-char-in-region pole-start pole-end curr-char new-char)
          (hanoi-put-face pole-start pole-end face))))
     (setcar ring pos))
index 29bb8a40e8f84520c06f3432827a42e7250fc045..e9f555093dbf86fa4694ff85af10620a704d6009 100644 (file)
@@ -56,7 +56,7 @@
 ;; concise problem description.
 
 ;;;_* Require
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;;_* From Gomoku
 
 ;; look rectangular, but spacings SHOULD be at least 2 (MUST BE at least 1).
 
 (defconst landmark-square-width 2
-  "*Horizontal spacing between squares on the Landmark board.")
+  "Horizontal spacing between squares on the Landmark board.")
 
 (defconst landmark-square-height 1
-  "*Vertical spacing between squares on the Landmark board.")
+  "Vertical spacing between squares on the Landmark board.")
 
 (defconst landmark-x-offset 3
-  "*Number of columns between the Landmark board and the side of the window.")
+  "Number of columns between the Landmark board and the side of the window.")
 
 (defconst landmark-y-offset 1
-  "*Number of lines between the Landmark board and the top of the window.")
+  "Number of lines between the Landmark board and the top of the window.")
 
 
 ;;;_ +  LANDMARK MODE AND KEYMAP.
 
 
 (defvar landmark-emacs-won ()
-  "*For making font-lock use the winner's face for the line.")
+  "For making font-lock use the winner's face for the line.")
 
 (defface landmark-font-lock-face-O '((((class color)) :foreground "red")
                               (t :weight bold))
     ("[-|/\\]" 0 (if landmark-emacs-won
                     'landmark-font-lock-face-O
                   'landmark-font-lock-face-X)))
-  "*Font lock rules for Landmark.")
+  "Font lock rules for Landmark.")
 
 (put 'landmark-mode 'front-sticky
      (put 'landmark-mode 'rear-nonsticky '(intangible)))
@@ -1417,7 +1417,7 @@ After this limit is reached, landmark-random-move is called to push him out of i
   (put 'z 't-1 (get 'z 't))
   (put 'z 't (calc-smell-internal 'landmark-tree))
   (if (= (- (get 'z 't) (get 'z 't-1)) 0.0)
-      (incf landmark-no-payoff)
+      (cl-incf landmark-no-payoff)
     (setf landmark-no-payoff 0)))
 
 (defun landmark-store-old-y_t ()
@@ -1464,7 +1464,7 @@ After this limit is reached, landmark-random-move is called to push him out of i
            (landmark-e forward-char)
            (landmark-w backward-char)))
   (landmark-plot-square (landmark-point-square) 1)
-  (incf landmark-number-of-moves)
+  (cl-incf landmark-number-of-moves)
   (if landmark-output-moves
       (message "Moves made: %d" landmark-number-of-moves)))
 
@@ -1591,11 +1591,11 @@ If the game is finished, this command requests for another game."
 ; this a worka!
 ; (eval  (cons '+ list))
 ;;;_  - landmark-set-landmark-signal-strengths ()
-;;; on a screen higher than wide, I noticed that the robot would amble
-;;; left and right and not move forward. examining *landmark-blackbox*
-;;; revealed that there was no scent from the north and south
-;;; landmarks, hence, they need less factoring down of the effect of
-;;; distance on scent.
+;; on a screen higher than wide, I noticed that the robot would amble
+;; left and right and not move forward. examining *landmark-blackbox*
+;; revealed that there was no scent from the north and south
+;; landmarks, hence, they need less factoring down of the effect of
+;; distance on scent.
 
 (defun landmark-set-landmark-signal-strengths ()
   (setq landmark-tree-r (* (sqrt (+ (square landmark-cx) (square landmark-cy))) 1.5))
index f086931d196f0cd6055065a6d0af799346c9d753..c0c8803f8963decba10f7f958e16cdb4f62bd7cc 100644 (file)
@@ -56,26 +56,26 @@ The value t means never ding, and `error' means only ding on wrong input."
   :group 'mpuz)
 
 (defface mpuz-unsolved
-  '((((class color)) (:foreground "red1" :bold t))
-    (t (:bold t)))
-  "Face to use for letters to be solved."
+  '((default :weight bold)
+    (((class color)) :foreground "red1"))
+  "Face for letters to be solved."
   :group 'mpuz)
 
 (defface mpuz-solved
-  '((((class color)) (:foreground "green1" :bold t))
-    (t (:bold t)))
-  "Face to use for solved digits."
+  '((default :weight bold)
+    (((class color)) :foreground "green1"))
+  "Face for solved digits."
   :group 'mpuz)
 
 (defface mpuz-trivial
-  '((((class color)) (:foreground "blue" :bold t))
-    (t (:bold t)))
-  "Face to use for trivial digits solved for you."
+  '((default :weight bold)
+    (((class color)) :foreground "blue"))
+  "Face for trivial digits solved for you."
   :group 'mpuz)
 
 (defface mpuz-text
-  '((t (:inherit variable-pitch)))
-  "Face to use for text on right."
+  '((t :inherit variable-pitch))
+  "Face for text on right."
   :group 'mpuz)
 
 \f
index 5742a5c7849b8fa87b947bde0303a7f4a74eb070..cb165cdf31ed483dec611a48c4dedd10f570cd7b 100644 (file)
@@ -26,7 +26,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'gamegrid)
 
 (defun pong-display-options ()
   "Computes display options (required by gamegrid for colors)."
   (let ((options (make-vector 256 nil)))
-    (loop for c from 0 to 255 do
+    (dotimes (c 256)
       (aset options c
-           (cond ((= c pong-blank)
-                  pong-blank-options)
+            (cond ((= c pong-blank)
+                   pong-blank-options)
                   ((= c pong-bat)
-                  pong-bat-options)
+                   pong-bat-options)
                   ((= c pong-ball)
-                  pong-ball-options)
+                   pong-ball-options)
                   ((= c pong-border)
-                  pong-border-options)
+                   pong-border-options)
                   (t
-                  '(nil nil nil)))))
+                   '(nil nil nil)))))
     options))
 
 
                        ?\s)
 
   (let ((buffer-read-only nil))
-    (loop for y from 0 to (1- pong-height) do
-         (loop for x from 0 to (1- pong-width) do
-               (gamegrid-set-cell x y pong-border)))
-    (loop for y from 1 to (- pong-height 2) do
-         (loop for x from 1 to (- pong-width 2) do
-               (gamegrid-set-cell x y pong-blank))))
-
-  (loop for y from pong-bat-player1 to (1- (+ pong-bat-player1 pong-bat-width)) do
-       (gamegrid-set-cell 2 y pong-bat))
-  (loop for y from pong-bat-player2 to (1- (+ pong-bat-player2 pong-bat-width)) do
-       (gamegrid-set-cell (- pong-width 3) y pong-bat)))
+    (dotimes (y pong-height)
+      (dotimes (x pong-width)
+        (gamegrid-set-cell x y pong-border)))
+    (cl-loop for y from 1 to (- pong-height 2) do
+             (cl-loop for x from 1 to (- pong-width 2) do
+                      (gamegrid-set-cell x y pong-blank))))
 
+  (cl-loop for y from pong-bat-player1
+           to (1- (+ pong-bat-player1 pong-bat-width))
+           do (gamegrid-set-cell 2 y pong-bat))
+  (cl-loop for y from pong-bat-player2
+           to (1- (+ pong-bat-player2 pong-bat-width))
+           do (gamegrid-set-cell (- pong-width 3) y pong-bat)))
 
 
 (defun pong-move-left ()
@@ -401,13 +402,12 @@ detection and checks if a player scores."
 
 (defun pong-update-score ()
   "Update score and print it on bottom of the game grid."
-  (let* ((string (format "Score:  %d / %d" pong-score-player1 pong-score-player2))
+  (let* ((string (format "Score:  %d / %d"
+                         pong-score-player1 pong-score-player2))
         (len (length string)))
-    (loop for x from 0 to (1- len) do
-         (if (string-equal (buffer-name (current-buffer)) pong-buffer-name)
-             (gamegrid-set-cell x
-                                pong-height
-                                (aref string x))))))
+    (dotimes (x len)
+      (if (string-equal (buffer-name (current-buffer)) pong-buffer-name)
+          (gamegrid-set-cell x pong-height (aref string x))))))
 
 
 
index db54039c237c9d36227ca147e4c2bf9c33fe3be7..a3480d0b0fa266cedfb14ce4d5b87d7eed01e7b5 100644 (file)
@@ -25,8 +25,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'gamegrid)
 
@@ -195,7 +194,7 @@ and then start moving it leftwards.")
 
 (defun snake-display-options ()
   (let ((options (make-vector 256 nil)))
-    (loop for c from 0 to 255 do
+    (dotimes (c 256)
       (aset options c
            (cond ((= c snake-blank)
                   snake-blank-options)
@@ -214,7 +213,7 @@ and then start moving it leftwards.")
 (defun snake-update-score ()
   (let* ((string (format "Score:  %05d" snake-score))
         (len (length string)))
-    (loop for x from 0 to (1- len) do
+    (dotimes (x len)
       (gamegrid-set-cell (+ snake-score-x x)
                         snake-score-y
                         (aref string x)))))
@@ -224,12 +223,12 @@ and then start moving it leftwards.")
                        snake-buffer-height
                        snake-space)
   (let ((buffer-read-only nil))
-    (loop for y from 0 to (1- snake-height) do
-         (loop for x from 0 to (1- snake-width) do
-               (gamegrid-set-cell x y snake-border)))
-    (loop for y from 1 to (- snake-height 2) do
-         (loop for x from 1 to (- snake-width 2) do
-               (gamegrid-set-cell x y snake-blank)))))
+    (dotimes (y snake-height)
+      (dotimes (x snake-width)
+        (gamegrid-set-cell x y snake-border)))
+    (cl-loop for y from 1 to (- snake-height 2) do
+             (cl-loop for x from 1 to (- snake-width 2) do
+                      (gamegrid-set-cell x y snake-blank)))))
 
 (defun snake-reset-game ()
   (gamegrid-kill-timer)
@@ -248,8 +247,8 @@ and then start moving it leftwards.")
     (dotimes (i snake-length)
       (gamegrid-set-cell x y snake-snake)
       (setq snake-positions (cons (vector x y) snake-positions))
-      (incf x snake-velocity-x)
-      (incf y snake-velocity-y)))
+      (cl-incf x snake-velocity-x)
+      (cl-incf y snake-velocity-y)))
   (snake-update-score))
 
 (defun snake-update-game (snake-buffer)
@@ -267,8 +266,8 @@ Argument SNAKE-BUFFER is the name of the buffer."
              (= c snake-snake))
          (snake-end-game)
        (cond ((= c snake-dot)
-              (incf snake-length)
-              (incf snake-score)
+              (cl-incf snake-length)
+              (cl-incf snake-score)
               (snake-update-score))
              (t
               (let* ((last-cons (nthcdr (- snake-length 2)
@@ -280,7 +279,7 @@ Argument SNAKE-BUFFER is the name of the buffer."
                                    (if (= (% snake-cycle 5) 0)
                                        snake-dot
                                      snake-blank))
-                (incf snake-cycle)
+                (cl-incf snake-cycle)
                 (setcdr last-cons nil))))
        (gamegrid-set-cell x y snake-snake)
        (setq snake-positions
index f282fa68b2aa71b82c1e1f5c91884b29ef976196..f249faa0e15d2a533bfb9e1ac5e630c36127df2e 100644 (file)
@@ -201,12 +201,12 @@ Pick your favorite shortcuts:
     (setq buffer-read-only t)
     (setq solitaire-stones 32)
     (solitaire-insert-board)
-    (solitaire-build-modeline)
+    (solitaire-build-mode-line)
     (goto-char (point-max))
     (setq solitaire-center (search-backward "."))
     (setq buffer-undo-list (list (point)))))
 
-(defun solitaire-build-modeline ()
+(defun solitaire-build-mode-line ()
   (setq mode-line-format
        (list "" "---" 'mode-line-buffer-identification
              (if (< 1 solitaire-stones)
@@ -353,7 +353,7 @@ which a stone will be taken away) and target."
        (insert ?o)
        (goto-char target)
        (setq solitaire-stones (1- solitaire-stones))
-       (solitaire-build-modeline)
+       (solitaire-build-mode-line)
        (if solitaire-auto-eval (solitaire-do-check))))))
 
 (defun solitaire-undo (arg)
@@ -372,7 +372,7 @@ which a stone will be taken away) and target."
                   (<= (solitaire-current-line) solitaire-end-y)
                   (setq count (1+ count))))
            count)))
-  (solitaire-build-modeline)
+  (solitaire-build-mode-line)
   (when solitaire-auto-eval (solitaire-do-check)))
 
 (defun solitaire-check ()
index 24d1c3f2417d27be1da08d1b94839a13b9ea8dd1..b811a21605b4f0f4c259b1d26c773ea1788046fd 100644 (file)
@@ -26,8 +26,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'gamegrid)
 
@@ -285,20 +284,20 @@ each one of its four blocks.")
 
 (defun tetris-display-options ()
   (let ((options (make-vector 256 nil)))
-    (loop for c from 0 to 255 do
+    (dotimes (c 256)
       (aset options c
            (cond ((= c tetris-blank)
-                   tetris-blank-options)
+                   tetris-blank-options)
                   ((and (>= c 0) (<= c 6))
                   (append
                    tetris-cell-options
                    `((((glyph color-x) ,(aref tetris-x-colors c))
                       (color-tty ,(aref tetris-tty-colors c))
                       (t nil)))))
-                  ((= c tetris-border)
-                   tetris-border-options)
-                  ((= c tetris-space)
-                   tetris-space-options)
+                  ((= c tetris-border)
+                   tetris-border-options)
+                  ((= c tetris-space)
+                   tetris-space-options)
                   (t
                    '(nil nil nil)))))
     options))
@@ -325,13 +324,13 @@ each one of its four blocks.")
   (let ((strings (vector (format "Shapes: %05d" tetris-n-shapes)
                         (format "Rows:   %05d" tetris-n-rows)
                         (format "Score:  %05d" tetris-score))))
-    (loop for y from 0 to 2 do
-         (let* ((string (aref strings y))
-                (len (length string)))
-           (loop for x from 0 to (1- len) do
-                 (gamegrid-set-cell (+ tetris-score-x x)
-                                    (+ tetris-score-y y)
-                                    (aref string x)))))))
+    (dotimes (y 3)
+      (let* ((string (aref strings y))
+             (len (length string)))
+        (dotimes (x len)
+          (gamegrid-set-cell (+ tetris-score-x x)
+                             (+ tetris-score-y y)
+                             (aref string x)))))))
 
 (defun tetris-update-score ()
   (tetris-draw-score)
@@ -351,88 +350,88 @@ each one of its four blocks.")
     (tetris-update-score)))
 
 (defun tetris-draw-next-shape ()
-  (loop for x from 0 to 3 do
-        (loop for y from 0 to 3 do
-              (gamegrid-set-cell (+ tetris-next-x x)
-                                 (+ tetris-next-y y)
-                                 tetris-blank)))
-  (loop for i from 0 to 3 do
-        (let ((tetris-shape tetris-next-shape)
-              (tetris-rot 0))
-          (gamegrid-set-cell (+ tetris-next-x
-                                (aref (tetris-get-shape-cell i) 0))
-                             (+ tetris-next-y
-                                (aref (tetris-get-shape-cell i) 1))
-                             tetris-shape))))
+  (dotimes (x 4)
+    (dotimes (y 4)
+      (gamegrid-set-cell (+ tetris-next-x x)
+                         (+ tetris-next-y y)
+                         tetris-blank)))
+  (dotimes (i 4)
+    (let ((tetris-shape tetris-next-shape)
+          (tetris-rot 0))
+      (gamegrid-set-cell (+ tetris-next-x
+                            (aref (tetris-get-shape-cell i) 0))
+                         (+ tetris-next-y
+                            (aref (tetris-get-shape-cell i) 1))
+                         tetris-shape))))
 
 (defun tetris-draw-shape ()
-  (loop for i from 0 to 3 do
-        (let ((c (tetris-get-shape-cell i)))
-          (gamegrid-set-cell (+ tetris-top-left-x
-                                tetris-pos-x
-                                (aref c 0))
-                             (+ tetris-top-left-y
-                                tetris-pos-y
-                                (aref c 1))
-                             tetris-shape))))
+  (dotimes (i 4)
+    (let ((c (tetris-get-shape-cell i)))
+      (gamegrid-set-cell (+ tetris-top-left-x
+                            tetris-pos-x
+                            (aref c 0))
+                         (+ tetris-top-left-y
+                            tetris-pos-y
+                            (aref c 1))
+                         tetris-shape))))
 
 (defun tetris-erase-shape ()
-  (loop for i from 0 to 3 do
-        (let ((c (tetris-get-shape-cell i)))
-          (gamegrid-set-cell (+ tetris-top-left-x
-                                tetris-pos-x
-                                (aref c 0))
-                             (+ tetris-top-left-y
-                                tetris-pos-y
-                                (aref c 1))
-                             tetris-blank))))
+  (dotimes (i 4)
+    (let ((c (tetris-get-shape-cell i)))
+      (gamegrid-set-cell (+ tetris-top-left-x
+                            tetris-pos-x
+                            (aref c 0))
+                         (+ tetris-top-left-y
+                            tetris-pos-y
+                            (aref c 1))
+                         tetris-blank))))
 
 (defun tetris-test-shape ()
   (let ((hit nil))
-    (loop for i from 0 to 3 do
-          (unless hit
-            (setq hit
-                  (let* ((c (tetris-get-shape-cell i))
-                         (xx (+ tetris-pos-x
-                                (aref c 0)))
-                         (yy (+ tetris-pos-y
-                                (aref c 1))))
-                    (or (>= xx tetris-width)
-                        (>= yy tetris-height)
-                        (/= (gamegrid-get-cell
-                             (+ xx tetris-top-left-x)
-                             (+ yy tetris-top-left-y))
-                            tetris-blank))))))
+    (dotimes (i 4)
+      (unless hit
+        (setq hit
+              (let* ((c (tetris-get-shape-cell i))
+                     (xx (+ tetris-pos-x
+                            (aref c 0)))
+                     (yy (+ tetris-pos-y
+                            (aref c 1))))
+                (or (>= xx tetris-width)
+                    (>= yy tetris-height)
+                    (/= (gamegrid-get-cell
+                         (+ xx tetris-top-left-x)
+                         (+ yy tetris-top-left-y))
+                        tetris-blank))))))
     hit))
 
 (defun tetris-full-row (y)
   (let ((full t))
-    (loop for x from 0 to (1- tetris-width) do
-         (if (= (gamegrid-get-cell (+ tetris-top-left-x x)
-                                   (+ tetris-top-left-y y))
-                tetris-blank)
-             (setq full nil)))
+    (dotimes (x tetris-width)
+      (if (= (gamegrid-get-cell (+ tetris-top-left-x x)
+                                (+ tetris-top-left-y y))
+             tetris-blank)
+          (setq full nil)))
     full))
 
 (defun tetris-shift-row (y)
   (if (= y 0)
-      (loop for x from 0 to (1- tetris-width) do
+      (dotimes (x tetris-width)
        (gamegrid-set-cell (+ tetris-top-left-x x)
                           (+ tetris-top-left-y y)
                           tetris-blank))
-  (loop for x from 0 to (1- tetris-width) do
-       (let ((c (gamegrid-get-cell (+ tetris-top-left-x x)
-                                   (+ tetris-top-left-y y -1))))
-         (gamegrid-set-cell (+ tetris-top-left-x x)
-                            (+ tetris-top-left-y y)
+    (dotimes (x tetris-width)
+      (let ((c (gamegrid-get-cell (+ tetris-top-left-x x)
+                                  (+ tetris-top-left-y y -1))))
+        (gamegrid-set-cell (+ tetris-top-left-x x)
+                           (+ tetris-top-left-y y)
                           c)))))
 
 (defun tetris-shift-down ()
-  (loop for y0 from 0 to (1- tetris-height) do
-       (if (tetris-full-row y0)
-           (progn (setq tetris-n-rows (1+ tetris-n-rows))
-                  (loop for y from y0 downto 0 do
-                        (tetris-shift-row y))))))
+  (dotimes (y0 tetris-height)
+    (when (tetris-full-row y0)
+      (setq tetris-n-rows (1+ tetris-n-rows))
+      (cl-loop for y from y0 downto 0 do
+               (tetris-shift-row y)))))
 
 (defun tetris-draw-border-p ()
   (or (not (eq gamegrid-display-mode 'glyph))
@@ -444,22 +443,22 @@ each one of its four blocks.")
                        tetris-space)
   (let ((buffer-read-only nil))
     (if (tetris-draw-border-p)
-       (loop for y from -1 to tetris-height do
-             (loop for x from -1 to tetris-width do
-                   (gamegrid-set-cell (+ tetris-top-left-x x)
-                                      (+ tetris-top-left-y y)
-                                      tetris-border))))
-    (loop for y from 0 to (1- tetris-height) do
-         (loop for x from 0 to (1- tetris-width) do
-               (gamegrid-set-cell (+ tetris-top-left-x x)
-                                  (+ tetris-top-left-y y)
-                                  tetris-blank)))
+       (cl-loop for y from -1 to tetris-height do
+                 (cl-loop for x from -1 to tetris-width do
+                          (gamegrid-set-cell (+ tetris-top-left-x x)
+                                             (+ tetris-top-left-y y)
+                                             tetris-border))))
+    (dotimes (y tetris-height)
+      (dotimes (x tetris-width)
+        (gamegrid-set-cell (+ tetris-top-left-x x)
+                           (+ tetris-top-left-y y)
+                           tetris-blank)))
     (if (tetris-draw-border-p)
-       (loop for y from -1 to 4 do
-             (loop for x from -1 to 4 do
-                   (gamegrid-set-cell (+ tetris-next-x x)
-                                      (+ tetris-next-y y)
-                                      tetris-border))))))
+       (cl-loop for y from -1 to 4 do
+                 (cl-loop for x from -1 to 4 do
+                          (gamegrid-set-cell (+ tetris-next-x x)
+                                             (+ tetris-next-y y)
+                                             tetris-border))))))
 
 (defun tetris-reset-game ()
   (gamegrid-kill-timer)
index fa32fdf82729c442a97d652a4a3d61a4493c94fb..cb02a839cde55bc3b92654c2c46e8b0b2eee62c7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; yow.el --- quote random zippyisms
 
-;; Copyright (C) 1993-1995, 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2012 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Author: Richard Mlynarik
 ;;; Commentary:
 
 ;; Important pinheadery for GNU Emacs.
-;;
-;; See cookie1.el for implementation.  Note --- the `n' argument of yow
-;; from the 18.xx implementation is no longer; we only support *random*
-;; random access now.
 
 ;;; Code:
 
@@ -38,7 +34,7 @@
   :prefix "yow-"
   :group 'games)
 
-(defcustom yow-file (concat data-directory "yow.lines")
+(defcustom yow-file (expand-file-name "yow.lines" data-directory)
    "File containing pertinent pinhead phrases."
   :type 'file
   :group 'yow)
index f1d42aafb9cd5f26780133bc56ec08421e3b9251..34e21193437642dea738f18d826d3f17259d1947 100644 (file)
@@ -1,6 +1,6 @@
 ;;; zone.el --- idle display hacks
 
-;; Copyright (C) 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
 ;; Author: Victor Zandy <zandy@cs.wisc.edu>
 ;; Maintainer: Thien-Thi Nguyen <ttn@gnu.org>
@@ -30,9 +30,6 @@
 ;; Bored by the zone pyrotechnics?  Write your own!  Add it to
 ;; `zone-programs'.  See `zone-call' for higher-ordered zoning.
 
-;; WARNING: Not appropriate for Emacs sessions over modems or
-;;          computers as slow as mine.
-
 ;; THANKS: Christopher Mayer, Scott Flinchbaugh,
 ;;         Rachel Kalmar, Max Froumentin, Juri Linkov,
 ;;         Luigi Panzeri, John Paul Wallington.
@@ -43,7 +40,7 @@
   "The timer we use to decide when to zone out, or nil if none.")
 
 (defvar zone-timeout nil
-  "*Seconds to timeout the zoning.
+  "Seconds to timeout the zoning.
 If nil, don't interrupt for about 1^26 seconds.")
 
 ;; Vector of functions that zone out.  `zone' will execute one of
@@ -78,7 +75,7 @@ If nil, don't interrupt for about 1^26 seconds.")
   `(with-current-buffer (get 'zone 'orig-buffer)
      ,@body))
 
-(defmacro zone-hiding-modeline (&rest body)
+(defmacro zone-hiding-mode-line (&rest body)
   ;; This formerly worked by temporarily altering face `mode-line',
   ;; which did not even work right, it seems.
   `(let (mode-line-format)
@@ -116,7 +113,6 @@ If the element is a function or a list of a function and a number,
           (wp (1+ (- (window-point (selected-window))
                      (window-start)))))
       (put 'zone 'orig-buffer (current-buffer))
-      (put 'zone 'modeline-hidden-level 0)
       (switch-to-buffer outbuf)
       (setq mode-name "Zone")
       (erase-buffer)
@@ -586,7 +582,7 @@ If the element is a function or a list of a function and a number,
         (setq ok (zerop (forward-line 1))
               lines (cons (buffer-substring p (point)) lines))))
     (sit-for 5)
-    (zone-hiding-modeline
+    (zone-hiding-mode-line
      (let ((msg "Zoning... (zone-pgm-stress)"))
        (while (not (string= msg ""))
          (message (setq msg (substring msg 1)))
@@ -595,8 +591,7 @@ If the element is a function or a list of a function and a number,
        (when (< 50 (random 100))
          (goto-char (point-max))
          (forward-line -1)
-         (let ((kill-whole-line t))
-           (kill-line))
+         (delete-region (point) (line-beginning-position 2))
          (goto-char (point-min))
          (insert (nth (random (length lines)) lines)))
        (message (concat (make-string (random (- (frame-width) 5)) ? ) "grrr"))
@@ -604,7 +599,7 @@ If the element is a function or a list of a function and a number,
 
 (defun zone-pgm-stress-destress ()
   (zone-call 'zone-pgm-stress 25)
-  (zone-hiding-modeline
+  (zone-hiding-mode-line
    (sit-for 3)
    (erase-buffer)
    (sit-for 3)
@@ -623,7 +618,7 @@ If the element is a function or a list of a function and a number,
 ;;;; the lyfe so short the craft so long to lerne --chaucer
 
 (defvar zone-pgm-random-life-wait nil
-  "*Seconds to wait between successive `life' generations.
+  "Seconds to wait between successive `life' generations.
 If nil, `zone-pgm-random-life' chooses a value from 0-3 (inclusive).")
 
 (defvar life-patterns) ; from life.el
index da82186fe30de3bfb26964ae1d700f247df8482c..78afcac9f502e44d23ce50ab763dd82e1ea62df0 100644 (file)
@@ -1170,14 +1170,16 @@ Return nil otherwise."
 (defun proced-time-lessp (t1 t2)
   "Return t if time value T1 is less than time value T2.
 Return `equal' if T1 equals T2.  Return nil otherwise."
-  (with-decoded-time-value ((high1 low1 micro1 t1)
-                           (high2 low2 micro2 t2))
+  (with-decoded-time-value ((high1 low1 micro1 pico1 type1 t1)
+                           (high2 low2 micro2 pico2 type2 t2))
     (cond ((< high1 high2))
           ((< high2 high1) nil)
           ((< low1 low2))
           ((< low2 low1) nil)
           ((< micro1 micro2))
           ((< micro2 micro1) nil)
+         ((< pico1 pico2))
+         ((< pico2 pico1) nil)
           (t 'equal))))
 
 ;;; Sorting
@@ -1651,8 +1653,8 @@ After updating a displayed Proced buffer run the normal hook
           (goto-char new-pos)
         (goto-char (point-min))
         (proced-move-to-goal-column)))
-    ;; update modeline
-    ;; Does the long `mode-name' clutter the modeline?  It would be nice
+    ;; update mode line
+    ;; Does the long `mode-name' clutter the mode line?  It would be nice
     ;; to have some other location for displaying the values of the various
     ;; flags that affect the behavior of proced (flags one might want
     ;; to change on the fly).  Where??
index d8768dd5986b607555e59542659a2030baac6b21..1825098a55e048b262f93d438e23b8a273bc517a 100644 (file)
 ;; should be loaded before the ada-mode, which will then setup some variables
 ;; to improve the support for Ada code.
 ;; Here is the list of these modes:
-;;   `which-function-mode': Display in the modeline the name of the subprogram
+;;   `which-function-mode': Display in the mode line the name of the subprogram
 ;;      the cursor is in.
 ;;   `outline-mode': Provides the capability to collapse or expand the code
 ;;      for specific language constructs, for instance if you want to hide the
       version-string)))
 
 (defvar ada-mode-hook nil
-  "*List of functions to call when Ada mode is invoked.
+  "List of functions to call when Ada mode is invoked.
 This hook is automatically executed after the `ada-mode' is
 fully loaded.
 This is a good place to add Ada environment specific bindings.")
@@ -150,13 +150,13 @@ This is a good place to add Ada environment specific bindings.")
   :group 'languages)
 
 (defcustom ada-auto-case t
-  "*Non-nil means automatically change case of preceding word while typing.
+  "Non-nil means automatically change case of preceding word while typing.
 Casing is done according to `ada-case-keyword', `ada-case-identifier'
 and `ada-case-attribute'."
   :type 'boolean :group 'ada)
 
 (defcustom ada-broken-decl-indent 0
-  "*Number of columns to indent a broken declaration.
+  "Number of columns to indent a broken declaration.
 
 An example is :
   declare
@@ -165,7 +165,7 @@ An example is :
   :type 'integer :group 'ada)
 
 (defcustom ada-broken-indent 2
-  "*Number of columns to indent the continuation of a broken line.
+  "Number of columns to indent the continuation of a broken line.
 
 An example is :
    My_Var : My_Type := (Field1 =>
@@ -173,7 +173,7 @@ An example is :
   :type 'integer :group 'ada)
 
 (defcustom ada-continuation-indent ada-broken-indent
-  "*Number of columns to indent the continuation of broken lines in parenthesis.
+  "Number of columns to indent the continuation of broken lines in parenthesis.
 
 An example is :
    Func (Param1,
@@ -181,7 +181,7 @@ An example is :
   :type 'integer :group 'ada)
 
 (defcustom ada-case-attribute 'ada-capitalize-word
-  "*Function to call to adjust the case of Ada attributes.
+  "Function to call to adjust the case of Ada attributes.
 It may be `downcase-word', `upcase-word', `ada-loose-case-word',
 `ada-capitalize-word' or `ada-no-auto-case'."
   :type '(choice (const downcase-word)
@@ -193,7 +193,7 @@ It may be `downcase-word', `upcase-word', `ada-loose-case-word',
 
 (defcustom ada-case-exception-file
   (list (convert-standard-filename' "~/.emacs_case_exceptions"))
-  "*List of special casing exceptions dictionaries for identifiers.
+  "List of special casing exceptions dictionaries for identifiers.
 The first file is the one where new exceptions will be saved by Emacs
 when you call `ada-create-case-exception'.
 
@@ -207,7 +207,7 @@ by a comment."
   :group 'ada)
 
 (defcustom ada-case-keyword 'downcase-word
-  "*Function to call to adjust the case of an Ada keywords.
+  "Function to call to adjust the case of an Ada keywords.
 It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
 `ada-capitalize-word'."
   :type '(choice (const downcase-word)
@@ -218,7 +218,7 @@ It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
   :group 'ada)
 
 (defcustom ada-case-identifier 'ada-loose-case-word
-  "*Function to call to adjust the case of an Ada identifier.
+  "Function to call to adjust the case of an Ada identifier.
 It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
 `ada-capitalize-word'."
   :type '(choice (const downcase-word)
@@ -229,7 +229,7 @@ It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
   :group 'ada)
 
 (defcustom ada-clean-buffer-before-saving t
-  "*Non-nil means remove trailing spaces and untabify the buffer before saving."
+  "Non-nil means remove trailing spaces and untabify the buffer before saving."
   :type 'boolean :group 'ada)
 (make-obsolete-variable 'ada-clean-buffer-before-saving
                        "use the `write-file-functions' hook."
@@ -237,7 +237,7 @@ It may be `downcase-word', `upcase-word', `ada-loose-case-word' or
 
 
 (defcustom ada-indent 3
-  "*Size of Ada indentation.
+  "Size of Ada indentation.
 
 An example is :
 procedure Foo is
@@ -246,11 +246,11 @@ begin
   :type 'integer  :group 'ada)
 
 (defcustom ada-indent-after-return t
-  "*Non-nil means automatically indent after RET or LFD."
+  "Non-nil means automatically indent after RET or LFD."
   :type 'boolean :group 'ada)
 
 (defcustom ada-indent-align-comments t
-  "*Non-nil means align comments on previous line comments, if any.
+  "Non-nil means align comments on previous line comments, if any.
 If nil, indentation is calculated as usual.
 Note that indentation is calculated only if `ada-indent-comment-as-code' is t.
 
@@ -260,12 +260,12 @@ For instance:
   :type 'boolean :group 'ada)
 
 (defcustom ada-indent-comment-as-code t
-  "*Non-nil means indent comment lines as code.
+  "Non-nil means indent comment lines as code.
 A nil value means do not auto-indent comments."
   :type 'boolean :group 'ada)
 
 (defcustom ada-indent-handle-comment-special nil
-  "*Non-nil if comment lines should be handled specially inside parenthesis.
+  "Non-nil if comment lines should be handled specially inside parenthesis.
 By default, if the line that contains the open parenthesis has some
 text following it, then the following lines will be indented in the
 same column as this text.  This will not be true if the first line is
@@ -287,11 +287,11 @@ type A is
   :type 'boolean :group 'ada)
 
 (defcustom ada-indent-is-separate t
-  "*Non-nil means indent 'is separate' or 'is abstract' if on a single line."
+  "Non-nil means indent 'is separate' or 'is abstract' if on a single line."
   :type 'boolean :group 'ada)
 
 (defcustom ada-indent-record-rel-type 3
-  "*Indentation for 'record' relative to 'type' or 'use'.
+  "Indentation for 'record' relative to 'type' or 'use'.
 
 An example is:
    type A is
@@ -299,7 +299,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-indent-renames ada-broken-indent
-  "*Indentation for renames relative to the matching function statement.
+  "Indentation for renames relative to the matching function statement.
 If `ada-indent-return' is null or negative, the indentation is done relative to
 the open parenthesis (if there is no parenthesis, `ada-broken-indent' is used).
 
@@ -310,7 +310,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-indent-return 0
-  "*Indentation for 'return' relative to the matching 'function' statement.
+  "Indentation for 'return' relative to the matching 'function' statement.
 If `ada-indent-return' is null or negative, the indentation is done relative to
 the open parenthesis (if there is no parenthesis, `ada-broken-indent' is used).
 
@@ -320,22 +320,22 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-indent-to-open-paren t
-  "*Non-nil means indent according to the innermost open parenthesis."
+  "Non-nil means indent according to the innermost open parenthesis."
   :type 'boolean :group 'ada)
 
 (defcustom ada-fill-comment-prefix "--  "
-  "*Text inserted in the first columns when filling a comment paragraph.
+  "Text inserted in the first columns when filling a comment paragraph.
 Note: if you modify this variable, you will have to invoke `ada-mode'
 again to take account of the new value."
   :type 'string :group 'ada)
 
 (defcustom ada-fill-comment-postfix " --"
-  "*Text inserted at the end of each line when filling a comment paragraph.
+  "Text inserted at the end of each line when filling a comment paragraph.
 Used by `ada-fill-comment-paragraph-postfix'."
   :type 'string :group 'ada)
 
 (defcustom ada-label-indent -4
-  "*Number of columns to indent a label.
+  "Number of columns to indent a label.
 
 An example is:
 procedure Foo is
@@ -346,15 +346,15 @@ This is also used for <<..>> labels"
   :type 'integer :group 'ada)
 
 (defcustom ada-language-version 'ada95
-  "*Ada language version; one of `ada83', `ada95', `ada2005'."
+  "Ada language version; one of `ada83', `ada95', `ada2005'."
   :type '(choice (const ada83) (const ada95) (const ada2005)) :group 'ada)
 
 (defcustom ada-move-to-declaration nil
-  "*Non-nil means `ada-move-to-start' moves to the subprogram declaration, not to 'begin'."
+  "Non-nil means `ada-move-to-start' moves to the subprogram declaration, not to 'begin'."
   :type 'boolean :group 'ada)
 
 (defcustom ada-popup-key '[down-mouse-3]
-  "*Key used for binding the contextual menu.
+  "Key used for binding the contextual menu.
 If nil, no contextual menu is available."
   :type '(restricted-sexp :match-alternatives (stringp vectorp))
   :group 'ada)
@@ -364,7 +364,7 @@ If nil, no contextual menu is available."
          (split-string (or (getenv "ADA_INCLUDE_PATH") "") ":")
          '("/usr/adainclude" "/usr/local/adainclude"
            "/opt/gnu/adainclude"))
-  "*Default list of directories to search for Ada files.
+  "Default list of directories to search for Ada files.
 See the description for the `ff-search-directories' variable.  This variable
 is the initial value of `ada-search-directories-internal'."
   :type '(repeat (choice :tag "Directory"
@@ -379,7 +379,7 @@ and the standard runtime location, and the value of the user-defined
 `ada-search-directories'.")
 
 (defcustom ada-stmt-end-indent 0
-  "*Number of columns to indent the end of a statement on a separate line.
+  "Number of columns to indent the end of a statement on a separate line.
 
 An example is:
    if A = B
@@ -387,7 +387,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-tab-policy 'indent-auto
-  "*Control the behavior of the TAB key.
+  "Control the behavior of the TAB key.
 Must be one of :
 `indent-rigidly' : always adds `ada-indent' blanks at the beginning of the line.
 `indent-auto'    : use indentation functions in this file.
@@ -398,7 +398,7 @@ Must be one of :
   :group 'ada)
 
 (defcustom ada-use-indent ada-broken-indent
-  "*Indentation for the lines in a 'use' statement.
+  "Indentation for the lines in a 'use' statement.
 
 An example is:
    use Ada.Text_IO,
@@ -406,7 +406,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-when-indent 3
-  "*Indentation for 'when' relative to 'exception' or 'case'.
+  "Indentation for 'when' relative to 'exception' or 'case'.
 
 An example is:
    case A is
@@ -414,7 +414,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-with-indent ada-broken-indent
-  "*Indentation for the lines in a 'with' statement.
+  "Indentation for the lines in a 'with' statement.
 
 An example is:
    with Ada.Text_IO,
@@ -422,7 +422,7 @@ An example is:
   :type 'integer :group 'ada)
 
 (defcustom ada-which-compiler 'gnat
-  "*Name of the compiler to use.
+  "Name of the compiler to use.
 This will determine what features are made available through the Ada mode.
 The possible choices are:
 `gnat': Use Ada Core Technologies' GNAT compiler.  Add some cross-referencing
@@ -5055,7 +5055,7 @@ Since the search can be long, the results are cached."
                    (re-search-backward ada-imenu-subprogram-menu-re nil t))
 
          ;; Get the function name, but not the properties, or this changes
-         ;; the face in the modeline on Emacs 21
+         ;; the face in the mode line on Emacs 21
          (setq func-name (match-string-no-properties 3))
          (if (and (not (ada-in-comment-p))
                   (not (save-excursion
index 1e07ac4cf09fb74f314203352e8768cc24a4ccae..1bee783bb17e4cccb73fb240f39fef979ca6a077 100644 (file)
 
 ;; ------ User variables
 (defcustom ada-xref-other-buffer t
-  "*If nil, always display the cross-references in the same buffer.
+  "If nil, always display the cross-references in the same buffer.
 Otherwise create either a new buffer or a new frame."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-create-ali nil
-  "*If non-nil, run gcc whenever the cross-references are not up-to-date.
+  "If non-nil, run gcc whenever the cross-references are not up-to-date.
 If nil, the cross-reference mode never runs gcc."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-confirm-compile nil
-  "*If non-nil, ask for confirmation before compiling or running the application."
+  "If non-nil, ask for confirmation before compiling or running the application."
   :type 'boolean :group 'ada)
 
 (defcustom ada-krunch-args "0"
-  "*Maximum number of characters for filenames created by `gnatkr'.
+  "Maximum number of characters for filenames created by `gnatkr'.
 Set to 0, if you don't use crunched filenames.  This should be a string."
   :type 'string :group 'ada)
 
@@ -76,7 +76,7 @@ is faster, available from Ada mode web site."
   :type 'string :group 'ada)
 
 (defcustom ada-gnatls-args '("-v")
-  "*Arguments to pass to `gnatls' to find location of the runtime.
+  "Arguments to pass to `gnatls' to find location of the runtime.
 Typical use is to pass `--RTS=soft-floats' on some systems that support it.
 
 You can also add `-I-' if you do not want the current directory to be included.
@@ -125,7 +125,7 @@ The command `gnatfind' is used every time you choose the menu
 (defcustom ada-prj-default-check-cmd
   (concat "${cross_prefix}gnatmake -u -c -gnatc ${gnatmake_opt} ${full_current}"
          " -cargs ${comp_opt}")
-  "*Default command to be used to compile a single file.
+  "Default command to be used to compile a single file.
 Emacs will substitute the current filename for ${full_current}, or add
 the filename at the end.  This is the same syntax as in the project file."
   :type 'string :group 'ada)
@@ -133,35 +133,35 @@ the filename at the end.  This is the same syntax as in the project file."
 (defcustom ada-prj-default-comp-cmd
   (concat "${cross_prefix}gnatmake -u -c ${gnatmake_opt} ${full_current} -cargs"
          " ${comp_opt}")
-  "*Default command to be used to compile a single file.
+  "Default command to be used to compile a single file.
 Emacs will substitute the current filename for ${full_current}, or add
 the filename at the end.  This is the same syntax as in the project file."
   :type 'string :group 'ada)
 
 (defcustom ada-prj-default-debugger "${cross_prefix}gdb"
-  "*Default name of the debugger."
+  "Default name of the debugger."
   :type 'string :group 'ada)
 
 (defcustom ada-prj-default-make-cmd
   (concat "${cross_prefix}gnatmake -o ${main} ${main} ${gnatmake_opt} "
          "-cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}")
-  "*Default command to be used to compile the application.
+  "Default command to be used to compile the application.
 This is the same syntax as in the project file."
   :type 'string :group 'ada)
 
 (defcustom ada-prj-default-project-file ""
-  "*Name of the current project file.
+  "Name of the current project file.
 Emacs will not try to use the search algorithm to find the project file if
 this string is not empty.  It is set whenever a project file is found."
   :type '(file :must-match t) :group 'ada)
 
 (defcustom ada-gnatstub-opts "-q -I${src_dir}"
-  "*Options to pass to `gnatsub' to generate the body of a package.
+  "Options to pass to `gnatsub' to generate the body of a package.
 This has the same syntax as in the project file (with variable substitution)."
   :type 'string :group 'ada)
 
 (defcustom ada-always-ask-project nil
-  "*If nil, use default values when no project file was found.
+  "If nil, use default values when no project file was found.
 Otherwise, ask the user for the name of the project file to use."
   :type 'boolean :group 'ada)
 
@@ -169,12 +169,12 @@ Otherwise, ask the user for the name of the project file to use."
   "True if we are running on Windows.")
 
 (defcustom ada-tight-gvd-integration nil
-  "*If non-nil, a new Emacs frame will be swallowed in GVD when debugging.
+  "If non-nil, a new Emacs frame will be swallowed in GVD when debugging.
 If GVD is not the debugger used, nothing happens."
   :type 'boolean :group 'ada)
 
 (defcustom ada-xref-search-with-egrep t
-  "*If non-nil, use egrep to find the possible declarations for an entity.
+  "If non-nil, use egrep to find the possible declarations for an entity.
 This alternate method is used when the exact location was not found in the
 information provided by GNAT.  However, it might be expensive if you have a lot
 of sources, since it will search in all the files in your project."
@@ -1544,9 +1544,7 @@ the project file."
   ;;      also a separate.
 
   (with-current-buffer (get-file-buffer file)
-    (let ((short-ali-file-name
-          (concat (file-name-sans-extension (file-name-nondirectory file))
-                  ".ali"))
+    (let ((short-ali-file-name (concat (file-name-base file) ".ali"))
          ali-file-name
          is-spec)
 
@@ -1566,10 +1564,7 @@ the project file."
       (if is-spec
          (set 'ali-file-name
               (ada-find-ali-file-in-dir
-               (concat (file-name-sans-extension
-                        (file-name-nondirectory
-                         (ada-other-file-name)))
-                       ".ali"))))
+               (concat (file-name-base (ada-other-file-name)) ".ali"))))
 
 
       (setq ali-file-name
@@ -1584,15 +1579,12 @@ the project file."
                ;;  file_s.ada and file_b.ada), try to go to the other file
                ;;  and look for its ali file
                (ada-find-ali-file-in-dir
-                (concat (file-name-sans-extension
-                         (file-name-nondirectory (ada-other-file-name)))
-                        ".ali"))
+                (concat (file-name-base (ada-other-file-name)) ".ali"))
 
 
                ;;  If we still don't have an ali file, try to get the one
                ;;  from the parent unit, in case we have a separate entity.
-               (let ((parent-name (file-name-sans-extension
-                                   (file-name-nondirectory file))))
+               (let ((parent-name (file-name-base file)))
 
                  (while (and (not ali-file-name)
                              (string-match "^\\(.*\\)[.-][^.-]*" parent-name))
index 9c9a8e09d49769ecefa5182c5c5c38ff3e106a24..4062646c967e2befe46e57f8d94c76ec368fb775 100644 (file)
@@ -235,11 +235,11 @@ MAJOR-MODE, the major mode of the code in the grammar's actions, is the
 value of `antlr-language' if the first group in the string matched by
 REGEXP in `antlr-language-limit-n-regexp' is one of the OPTION-VALUEs.
 An OPTION-VALUE of nil denotes the fallback element.  MODELINE-STRING is
-also displayed in the modeline next to \"Antlr\"."
+also displayed in the mode line next to \"Antlr\"."
   :group 'antlr
   :type '(repeat (group :value (java-mode "")
                        (function :tag "Major mode")
-                       (string :tag "Modeline string")
+                       (string :tag "Mode line string")
                        (repeat :tag "ANTLR language option" :inline t
                                (choice (const :tag "Default" nil)
                                        string )))))
@@ -269,7 +269,7 @@ greater than this number."
                 (integer :tag "Hidden if longer than" :value 3)))
 
 (defcustom antlr-indent-comment 'tab
-  "*Non-nil, if the indentation should touch lines in block comments.
+  "Non-nil, if the indentation should touch lines in block comments.
 If nil, no continuation line of a block comment is changed.  If t, they
 are changed according to `c-indentation-line'.  When not nil and not t,
 they are only changed by \\[antlr-indent-command]."
@@ -296,7 +296,7 @@ ANTLR's and Java's indentation styles.  Used by `antlr-set-tabs'."
                        (boolean :tag "Indent-tabs-mode"))))
 
 (defcustom antlr-indent-style "java"
-  "*If non-nil, cc-mode indentation style used for `antlr-mode'.
+  "If non-nil, cc-mode indentation style used for `antlr-mode'.
 See `c-set-style' and for details, where the most interesting part in
 `c-style-alist' is the value of `c-basic-offset'."
   :group 'antlr
@@ -339,14 +339,14 @@ to the normal rules of `antlr-indent-line'."
 ;;;===========================================================================
 
 (defcustom antlr-options-use-submenus t
-  "*Non-nil, if the major mode menu should include option submenus.
+  "Non-nil, if the major mode menu should include option submenus.
 If nil, the menu just includes a command to insert options.  Otherwise,
 it includes four submenus to insert file/grammar/rule/subrule options."
   :group 'antlr
   :type 'boolean)
 
 (defcustom antlr-tool-version 20701
-  "*The version number of the Antlr tool.
+  "The version number of the Antlr tool.
 The value is an integer of the form XYYZZ which stands for vX.YY.ZZ.
 This variable is used to warn about non-supported options and to supply
 version correct option values when using \\[antlr-insert-option].
@@ -358,7 +358,7 @@ can make this variable buffer-local."
   :type 'integer)
 
 (defcustom antlr-options-auto-colon t
-  "*Non-nil, if `:' is inserted with a rule or subrule options section.
+  "Non-nil, if `:' is inserted with a rule or subrule options section.
 A `:' is only inserted if this value is non-nil, if a rule or subrule
 option is inserted with \\[antlr-insert-option], if there was no rule or
 subrule options section before, and if a `:' is not already present
@@ -378,7 +378,7 @@ is `language-as-string'.  See also `antlr-read-value'."
   :type '(repeat (symbol :tag "Style symbol")))
 
 (defcustom antlr-options-push-mark t
-  "*Non-nil, if inserting an option should set & push mark.
+  "Non-nil, if inserting an option should set & push mark.
 If nil, never set mark when inserting an option with command
 \\[antlr-insert-option].  If t, always set mark via `push-mark'.  If a
 number, only set mark if point was outside the options area before and
@@ -392,7 +392,7 @@ options area before."
                (sexp :tag "If outside options" :format "%t" :value outside)))
 
 (defcustom antlr-options-assign-string " = "
-  "*String containing `=' to use between option name and value.
+  "String containing `=' to use between option name and value.
 This string is only used if the option to insert did not exist before
 or if there was no `=' after it.  In other words, the spacing around an
 existing `=' won't be changed when changing an option value."
@@ -578,21 +578,21 @@ AS-STRING is non-nil and is either t or a symbol which is a member of
 ;;;===========================================================================
 
 (defcustom antlr-tool-command "java antlr.Tool"
-  "*Command used in \\[antlr-run-tool] to run the Antlr tool.
+  "Command used in \\[antlr-run-tool] to run the Antlr tool.
 This variable should include all options passed to Antlr except the
 option \"-glib\" which is automatically suggested if necessary."
   :group 'antlr
   :type 'string)
 
 (defcustom antlr-ask-about-save t
-  "*If not nil, \\[antlr-run-tool] asks which buffers to save.
+  "If not nil, \\[antlr-run-tool] asks which buffers to save.
 Otherwise, it saves all modified buffers before running without asking."
   :group 'antlr
   :type 'boolean)
 
 (defcustom antlr-makefile-specification
   '("\n" ("GENS" "GENS%d" " \\\n\t") "$(ANTLR)")
-  "*Variable to specify the appearance of the generated makefile rules.
+  "Variable to specify the appearance of the generated makefile rules.
 This variable influences the output of \\[antlr-show-makefile-rules].
 It looks like \(RULE-SEP GEN-VAR-SPEC COMMAND).
 
@@ -650,7 +650,7 @@ See variable `antlr-file-formats-alist' for language dependent
 formats.")
 
 (defvar antlr-unknown-file-formats '("?%s?.g" "?%s?")
-  "*Formats which specify the names of unknown files.
+  "Formats which specify the names of unknown files.
 The value looks like \(SUPER-GRAMMAR-FILE-FORMAT SUPER-EVOCAB-FORMAT).
 
 SUPER-GRAMMAR-FORMAT is a format string, it specifies with substitution
@@ -685,7 +685,7 @@ DIRECTORY is the name of the current directory.")
 ;;;===========================================================================
 
 (defcustom antlr-imenu-name t ; (featurep 'xemacs) ; TODO: Emacs-21 bug?
-  "*Non-nil, if a \"Index\" menu should be added to the menubar.
+  "Non-nil, if a \"Index\" menu should be added to the menubar.
 If it is a string, it is used instead \"Index\".  Requires package
 imenu."
   :group 'antlr
@@ -774,7 +774,7 @@ imenu."
 ;;;===========================================================================
 
 (defcustom antlr-font-lock-maximum-decoration 'inherit
-  "*The maximum decoration level for fontifying actions.
+  "The maximum decoration level for fontifying actions.
 Value `none' means, do not fontify actions, just normal grammar code
 according to `antlr-font-lock-additional-keywords'.  Value `inherit'
 means, use value of `font-lock-maximum-decoration'.  Any other value is
index cfa977d90225f27e93b4c87861711675acbc0df9..5e15371b406c4f024e0d2cf1333e0c1ec6bd0045 100644 (file)
@@ -53,7 +53,7 @@
   :group 'languages)
 
 (defcustom asm-comment-char ?\;
-  "*The comment-start character assumed by Asm mode."
+  "The comment-start character assumed by Asm mode."
   :type 'character
   :group 'asm)
 
index a7242f6c23235f8211951781ae5de8ffe498663c..3225fef2dfa6dc8d9843f90d7a0a16a806b7de29 100644 (file)
@@ -1,4 +1,4 @@
-;;; autoconf.el --- mode for editing Autoconf configure.in files
+;;; autoconf.el --- mode for editing Autoconf configure.ac files
 
 ;; Copyright (C) 2000-2012  Free Software Foundation, Inc.
 
 ;;; Commentary:
 
 ;; Provides fairly minimal font-lock, imenu and indentation support
-;; for editing configure.in files.  Only Autoconf syntax is processed.
+;; for editing configure.ac files.  Only Autoconf syntax is processed.
 ;; There is no attempt to deal with shell text -- probably that will
 ;; always lose.
 
-;; This is specialized for configure.in files.  It doesn't inherit the
+;; This is specialized for configure.ac files.  It doesn't inherit the
 ;; general M4 stuff from M4 mode.
 
 ;; There is also an autoconf-mode.el in existence.  That appears to be
-;; for editing the Autoconf M4 source, rather than configure.in files.
+;; for editing the Autoconf M4 source, rather than configure.ac files.
 
 ;;; Code:
 
@@ -49,7 +49,7 @@
   `(("\\_<A[CHMS]_\\sw+" . font-lock-keyword-face)
     (,autoconf-definition-regexp
      3 font-lock-function-name-face)
-    ;; Are any other M4 keywords really appropriate for configure.in,
+    ;; Are any other M4 keywords really appropriate for configure.ac,
     ;; given that we do `dnl'?
     ("changequote" . font-lock-keyword-face)))
 
@@ -78,7 +78,7 @@ searching backwards at another AC_... command."
 
 ;;;###autoload
 (define-derived-mode autoconf-mode prog-mode "Autoconf"
-  "Major mode for editing Autoconf configure.in files."
+  "Major mode for editing Autoconf configure.ac files."
   (set (make-local-variable 'parens-require-spaces) nil) ; for M4 arg lists
   (set (make-local-variable 'defun-prompt-regexp)
        "^[ \t]*A[CM]_\\(\\sw\\|\\s_\\)+")
index 015b9a9ceafcbf0b1e8ea22066d5bcc54fafc767..48ef5da12aee5e3243906356a24c2bdc3525f2f6 100644 (file)
@@ -62,7 +62,7 @@ so that it is considered safe, see `enable-local-variables'.")
                 (get s 'bug-reference-url-format)))))
 
 (defconst bug-reference-bug-regexp
-  "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\)"
+  "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)"
   "Regular expression which matches bug references.")
 
 (defun bug-reference-set-overlay-properties ()
index 9cf20ccb516c441a5bbbf582a6c25c6ea565d880..94b296bf59e824c1124905161bf693ee35733be6 100644 (file)
@@ -310,7 +310,7 @@ left out.
 Turning on auto-newline automatically enables electric indentation.
 
 When the auto-newline feature is enabled (indicated by \"/la\" on the
-modeline after the mode name) newlines are automatically inserted
+mode line after the mode name) newlines are automatically inserted
 after special characters such as brace, comma, semi-colon, and colon."
   (interactive "P")
   (setq c-auto-newline
@@ -329,7 +329,7 @@ positive, turns it off when negative, and just toggles it when zero or
 left out.
 
 When the hungry-delete-key feature is enabled (indicated by \"/h\" on
-the modeline after the mode name) the delete key gobbles all preceding
+the mode line after the mode name) the delete key gobbles all preceding
 whitespace in one fell swoop."
   (interactive "P")
   (setq c-hungry-delete-key (c-calculate-state arg c-hungry-delete-key))
@@ -1826,6 +1826,15 @@ with a brace block."
            ;; DEFFLAGSET(syslog_opt_flags,LOG_PID ...) ==> syslog_opt_flags
            (match-string-no-properties 1))
 
+          ;; Objective-C method starting with + or -.
+          ((and (derived-mode-p 'objc-mode)
+                (looking-at "[-+]\s*("))
+           (when (c-syntactic-re-search-forward ")\s*" nil t)
+             (c-forward-token-2)
+             (setq name-end (point))
+             (c-backward-token-2)
+             (buffer-substring-no-properties (point) name-end)))
+
           (t
            ;; Normal function or initializer.
            (when (c-syntactic-re-search-forward "[{(]" nil t)
index 5d758b53b569af73eca95c64c339590b705f8a76..8bccb44f308d131ed6a91784b19b881bd8613fc0 100644 (file)
@@ -1818,9 +1818,7 @@ system."
               (t
                ;; Being evaluated interactively.
                (buffer-file-name)))))
-    (and file
-        (file-name-sans-extension
-         (file-name-nondirectory file)))))
+    (and file (file-name-base file))))
 
 (defmacro c-lang-defconst-eval-immediately (form)
   "Can be used inside a VAL in `c-lang-defconst' to evaluate FORM
index 65e28c11e21c663c8488611ad68bef440d69edb9..142ec4cdd66a4cbd3915421de87c10d0bf3b7fe6 100644 (file)
@@ -1688,6 +1688,7 @@ comment at the start of cc-engine.el for more info."
        ;; high as possible.
        (setq rung-pos (point)))
 
+      (with-silent-modifications
       (while
          (progn
            (while
@@ -1843,7 +1844,7 @@ comment at the start of cc-engine.el for more info."
                (1- last-put-in-sws-pos))
               (c-remove-is-and-in-sws (1- last-put-in-sws-pos)
                                       last-put-in-sws-pos))))
-      )))
+      ))))
 
 (defun c-backward-sws ()
   ;; Used by `c-backward-syntactic-ws' to implement the unbounded search.
@@ -1881,6 +1882,7 @@ comment at the start of cc-engine.el for more info."
          (goto-char (setq rung-pos rung-is-marked))
        (goto-char simple-ws-beg))
 
+      (with-silent-modifications
       (while
          (progn
            (while
@@ -2066,7 +2068,7 @@ comment at the start of cc-engine.el for more info."
                last-put-in-sws-pos)
               (c-remove-is-and-in-sws last-put-in-sws-pos
                                       (1+ last-put-in-sws-pos)))))
-      )))
+      ))))
 
 \f
 ;; Other whitespace tools
@@ -2612,13 +2614,24 @@ comment at the start of cc-engine.el for more info."
   (setq c-state-point-min (point-min)))
 
 (defun c-append-lower-brace-pair-to-state-cache (from &optional upper-lim)
-  ;; If there is a brace pair preceding FROM in the buffer (not necessarily
-  ;; immediately preceding), push a cons onto `c-state-cache' to represent it.
-  ;; FROM must not be inside a literal.  If UPPER-LIM is non-nil, we append
-  ;; the highest brace pair whose "}" is below UPPER-LIM.
+  ;; If there is a brace pair preceding FROM in the buffer, at the same level
+  ;; of nesting (not necessarily immediately preceding), push a cons onto
+  ;; `c-state-cache' to represent it.  FROM must not be inside a literal.  If
+  ;; UPPER-LIM is non-nil, we append the highest brace pair whose "}" is below
+  ;; UPPER-LIM.
   ;;
   ;; Return non-nil when this has been done.
   ;;
+  ;; The situation it copes with is this transformation:
+  ;;
+  ;; OLD:   {                       (.)    {...........}
+  ;;                                       ^             ^
+  ;;                                     FROM          HERE
+  ;;                                     
+  ;; NEW:   {             {....}    (.)    {.........
+  ;;                         ^           ^           ^
+  ;;                LOWER BRACE PAIR   HERE   or   HERE
+  ;;                                       
   ;; This routine should be fast.  Since it can get called a LOT, we maintain
   ;; `c-state-brace-pair-desert', a small cache of "failures", such that we
   ;; reduce the time wasted in repeated fruitless searches in brace deserts.
@@ -2637,10 +2650,25 @@ comment at the start of cc-engine.el for more info."
        (unless (and c-state-brace-pair-desert
                     (eq cache-pos (car c-state-brace-pair-desert))
                     (<= from (cdr c-state-brace-pair-desert)))
-         ;; Only search what we absolutely need to:
-         (if (and c-state-brace-pair-desert
-                  (eq cache-pos (car c-state-brace-pair-desert)))
-             (narrow-to-region (cdr c-state-brace-pair-desert) (point-max)))
+         ;; DESERT-LIM.  Only search what we absolutely need to,
+         (let ((desert-lim
+                (and c-state-brace-pair-desert
+                     (eq cache-pos (car c-state-brace-pair-desert))
+                     (cdr c-state-brace-pair-desert)))
+               ;; CACHE-LIM.  This limit will be necessary when an opening
+               ;; paren at `cache-pos' has just had its matching close paren
+               ;; inserted.  `cache-pos' continues to be a search bound, even
+               ;; though the algorithm below would skip over the new paren
+               ;; pair.
+               (cache-lim (and cache-pos (< cache-pos from) cache-pos)))
+           (narrow-to-region
+               (cond
+                ((and desert-lim cache-lim)
+                 (max desert-lim cache-lim))
+                (desert-lim)
+                (cache-lim)
+                ((point-min)))
+               (point-max)))
 
          ;; In the next pair of nested loops, the inner one moves back past a
          ;; pair of (mis-)matching parens or brackets; the outer one moves
@@ -2674,7 +2702,7 @@ comment at the start of cc-engine.el for more info."
                          (cons new-cons (cdr c-state-cache))))
                 (t (setq c-state-cache (cons new-cons c-state-cache)))))
 
-           ;; We haven't found a brace pair.  Record this.
+           ;; We haven't found a brace pair.  Record this in the cache.
            (setq c-state-brace-pair-desert (cons cache-pos from))))))))
 
 (defsubst c-state-push-any-brace-pair (bra+1 macro-start-or-here)
index ff18f56bbe81ed10f2931e480df42dcbe6614f77..2a000957589e50b2a56e4cd1c0811490ecef5da8 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cc-mode.el --- major mode for editing C and similar languages
 
-;; Copyright (C) 1985, 1987, 1992-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2012 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -1584,7 +1584,7 @@ Key bindings:
 (easy-menu-define c-pike-menu pike-mode-map "Pike Mode Commands"
                  (cons "Pike" (c-lang-const c-mode-menu pike)))
 
-;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(.in\\)?\\)\\'" . pike-mode))
+;;;###autoload (add-to-list 'auto-mode-alist '("\\.\\(u?lpc\\|pike\\|pmod\\(\\.in\\)?\\)\\'" . pike-mode))
 ;;;###autoload (add-to-list 'interpreter-mode-alist '("pike" . pike-mode))
 
 ;;;###autoload
index 4e9a10e3cebf4d59396335638df86cdff2fca2b8..64e99fb1f3d8e8aeb6f5e0d2ed4ce60420f6975b 100644 (file)
@@ -54,7 +54,7 @@
   :group 'languages)
 
 (defcustom cfengine-indent 2
-  "*Size of a CFEngine indentation step in columns."
+  "Size of a CFEngine indentation step in columns."
   :group 'cfengine
   :type 'integer)
 
index 88c36e8c4525dd8058d1149c3690a481f6ed487d..0feefd99715b87bba7330760eba599a498d468b5 100644 (file)
 
 
 (defcustom c-macro-shrink-window-flag nil
-  "*Non-nil means shrink the *Macroexpansion* window to fit its contents."
+  "Non-nil means shrink the *Macroexpansion* window to fit its contents."
   :type 'boolean
   :group 'c-macro)
 
 (defcustom c-macro-prompt-flag nil
-  "*Non-nil makes `c-macro-expand' prompt for preprocessor arguments."
+  "Non-nil makes `c-macro-expand' prompt for preprocessor arguments."
   :type 'boolean
   :group 'c-macro)
 
@@ -141,7 +141,7 @@ option, or to set an equivalent one."
   :group 'c-macro)
 
 (defcustom c-macro-cppflags ""
-  "*Preprocessor flags used by `c-macro-expand'."
+  "Preprocessor flags used by `c-macro-expand'."
   :type 'string
   :group 'c-macro)
 
index cdaff4134445797ccc00384a9fe784e9e8122f8e..c008e1c4da30ea6e26f06c8fcbdd7fd917776bf2 100644 (file)
@@ -30,7 +30,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'tool-bar)
 (require 'comint)
 
@@ -78,7 +78,7 @@ after `call-process' inserts the grep output into the buffer.")
 This is bound before running `compilation-filter-hook'.")
 
 (defvar compilation-first-column 1
-  "*This is how compilers number the first column, usually 1 or 0.
+  "This is how compilers number the first column, usually 1 or 0.
 If this is buffer-local in the destination buffer, Emacs obeys
 that value, otherwise it uses the value in the *compilation*
 buffer.  This enables a major-mode to specify its own value.")
@@ -90,7 +90,7 @@ in the compilation output, and should return a transformed file name.")
 
 ;;;###autoload
 (defvar compilation-process-setup-function nil
-  "*Function to call to customize the compilation process.
+  "Function to call to customize the compilation process.
 This function is called immediately before the compilation process is
 started.  It can be used to set any variables or functions that are used
 while processing the output of the compilation process.")
@@ -209,7 +209,7 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1))
     ;; due to matching filenames via \\(.*?\\).  This might be faster.
     (maven
      ;; Maven is a popular free software build tool for Java.
-     "\\([0-9]*[^0-9\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\] " 1 2 3)
+     "\\([\n]\\(?:[^\n :]\\| [^-/\n]\\|:[^ \n]\\)*?\\):\\[\\([0-9]+\\),\\([0-9]+\\)\\] " 1 2 3)
 
     (jikes-line
      "^ *\\([0-9]+\\)\\.[ \t]+.*\n +\\(<-*>\n\\*\\*\\* \\(?:Error\\|Warnin\\(g\\)\\)\\)"
@@ -633,7 +633,7 @@ This only affects platforms that support asynchronous processes (see
 (defvar compilation-locs ())
 
 (defvar compilation-debug nil
-  "*Set this to t before creating a *compilation* buffer.
+  "Set this to t before creating a *compilation* buffer.
 Then every error line will have a debug text property with the matcher that
 fit this line and the match data.  Use `describe-text-properties'.")
 
@@ -674,6 +674,34 @@ starting the compilation process."
   :group 'compilation
   :version "22.1")
 
+;; The next three faces must be able to stand out against the
+;; `mode-line' and `mode-line-inactive' faces.
+
+(defface compilation-mode-line-fail
+  '((default :inherit compilation-error)
+    (((class color) (min-colors 16)) (:foreground "Red1" :weight bold))
+    (((class color) (min-colors 8)) (:foreground "red"))
+    (t (:inverse-video t :weight bold)))
+  "Face for Compilation mode's \"error\" mode line indicator."
+  :group 'compilation
+  :version "24.2")
+
+(defface compilation-mode-line-run
+  '((t :inherit compilation-warning))
+  "Face for Compilation mode's \"running\" mode line indicator."
+  :group 'compilation
+  :version "24.2")
+
+(defface compilation-mode-line-exit
+  '((default :inherit compilation-info)
+    (((class color) (min-colors 16))
+     (:foreground "ForestGreen" :weight bold))
+    (((class color)) (:foreground "green" :weight bold))
+    (t (:weight bold)))
+  "Face for Compilation mode's \"exit\" mode line indicator."
+  :group 'compilation
+  :version "24.2")
+
 (defface compilation-line-number
   '((t :inherit font-lock-keyword-face))
   "Face for displaying line numbers in compiler messages."
@@ -739,7 +767,7 @@ Faces `compilation-error-face', `compilation-warning-face',
 ;; (make-variable-buffer-local 'compilation-buffer-modtime)
 
 (defvar compilation-skip-to-next-location t
-  "*If non-nil, skip multiple error messages for the same source location.")
+  "If non-nil, skip multiple error messages for the same source location.")
 
 (defcustom compilation-skip-threshold 1
   "Compilation motion commands skip less important messages.
@@ -763,7 +791,7 @@ info, are considered errors."
          3)))
   (setq compilation-skip-threshold level)
   (message "Skipping %s"
-           (case compilation-skip-threshold
+           (pcase compilation-skip-threshold
              (0 "Nothing")
              (1 "Info messages")
              (2 "Warnings and info"))))
@@ -798,7 +826,7 @@ from a different message."
 ;; modified using the same *compilation* buffer. this necessitates
 ;; re-parsing markers.
 
-;; (defstruct (compilation--loc
+;; (cl-defstruct (compilation--loc
 ;;             (:constructor nil)
 ;;             (:copier nil)
 ;;             (:constructor compilation--make-loc
@@ -847,7 +875,7 @@ from a different message."
 ;; These are the value of the `compilation-message' text-properties in the
 ;; compilation buffer.
 
-(defstruct (compilation--message
+(cl-defstruct (compilation--message
             (:constructor nil)
             (:copier nil)
             ;; (:type list)                ;Old representation.
@@ -1184,7 +1212,7 @@ FMTS is a list of format specs for transforming the file name.
   (goto-char end)
   (unless (bolp)
     ;; We generally don't like to parse partial lines.
-    (assert (eobp))
+    (cl-assert (eobp))
     (when (let ((proc (get-buffer-process (current-buffer))))
             (and proc (memq (process-status proc) '(run open))))
       (setq end (line-beginning-position))))
@@ -1626,7 +1654,7 @@ Returns the compilation buffer created."
                                                       outbuf command))))
              ;; Make the buffer's mode line show process state.
              (setq mode-line-process
-                   (list (propertize ":%s" 'face 'compilation-warning)))
+                   '(:propertize ":%s" face compilation-mode-line-run))
              (set-process-sentinel proc 'compilation-sentinel)
              (unless (eq mode t)
                ;; Keep the comint filter, since it's needed for proper handling
@@ -1646,9 +1674,9 @@ Returns the compilation buffer created."
                    (cons proc compilation-in-progress)))
          ;; No asynchronous processes available.
          (message "Executing `%s'..." command)
-         ;; Fake modeline display as if `start-process' were run.
+         ;; Fake mode line display as if `start-process' were run.
          (setq mode-line-process
-               (list (propertize ":run" 'face 'compilation-warning)))
+               '(:propertize ":run" face compilation-mode-line-run))
          (force-mode-line-update)
          (sit-for 0)                   ; Force redisplay
          (save-excursion
@@ -1884,6 +1912,9 @@ Runs `compilation-mode-hook' with `run-mode-hooks' (which see).
   (setq buffer-read-only t)
   (run-mode-hooks 'compilation-mode-hook))
 
+;;;###autoload
+(put 'define-compilation-mode 'doc-string-elt 3)
+
 (defmacro define-compilation-mode (mode name doc &rest body)
   "This is like `define-derived-mode' without the PARENT argument.
 The parent is always `compilation-mode' and the customizable `compilation-...'
@@ -2043,9 +2074,10 @@ commands of Compilation major mode are available.  See
                                                        (car status)))))
            (message "%s" msg)
            (propertize out-string
-                       'help-echo msg 'face (if (> exit-status 0)
-                                                'compilation-error
-                                              'compilation-info))))
+                       'help-echo msg
+                       'face (if (> exit-status 0)
+                                 'compilation-mode-line-fail
+                               'compilation-mode-line-exit))))
     ;; Force mode line redisplay soon.
     (force-mode-line-update)
     (if (and opoint (< opoint omax))
@@ -2132,14 +2164,14 @@ and runs `compilation-filter-hook'."
           (if (or (eq (get-text-property ,limit 'compilation-message)
                       (get-text-property opt 'compilation-message))
                   (eq pt opt))
-              (error ,error compilation-error)
+              (user-error ,error compilation-error)
             (setq pt ,limit)))
        ;; prop 'compilation-message usually has 2 changes, on and off, so
        ;; re-search if off
        (or (setq msg (get-text-property pt 'compilation-message))
           (if (setq pt (,property-change pt 'compilation-message nil ,limit))
               (setq msg (get-text-property pt 'compilation-message)))
-          (error ,error compilation-error))
+          (user-error ,error compilation-error))
        (or (< (compilation--message->type msg) compilation-skip-threshold)
           (if different-file
               (eq (prog1 last
@@ -2383,7 +2415,7 @@ region and the first line of the next region."
     (push fs compilation-gcpro)
     (let ((loc (compilation-assq (or line 1) (cdr fs))))
       (setq loc (compilation-assq col loc))
-      (assert (null (cdr loc)))
+      (cl-assert (null (cdr loc)))
       (setcdr loc (compilation--make-cdrloc line fs marker))
       loc)))
 
@@ -2653,16 +2685,13 @@ The file-structure looks like this:
 (defun compilation--flush-file-structure (file)
   (or (consp file) (setq file (list file)))
   (let ((fs (compilation-get-file-structure file)))
-    (assert (eq fs (gethash file compilation-locs)))
-    (assert (eq fs (gethash (cons (caar fs) (cadr (car fs)))
+    (cl-assert (eq fs (gethash file compilation-locs)))
+    (cl-assert (eq fs (gethash (cons (caar fs) (cadr (car fs)))
                             compilation-locs)))
     (maphash (lambda (k v)
                (if (eq v fs) (remhash k compilation-locs)))
              compilation-locs)))
 
-(add-to-list 'debug-ignored-errors "\\`No more [-a-z ]+s yet\\'")
-(add-to-list 'debug-ignored-errors "\\`Moved past last .*")
-
 ;;; Compatibility with the old compile.el.
 
 (defvaralias 'compilation-last-buffer 'next-error-last-buffer)
index 2c258fb446a35a9e756d329d056fe36887c91ae5..f04994249527a4951a852676b3d7e0625eae4cda 100644 (file)
@@ -2322,8 +2322,7 @@ to nil."
                                                 nil t)))) ; Only one
                     (progn
                       (forward-word 1)
-                      (setq name (file-name-sans-extension
-                                  (file-name-nondirectory (buffer-file-name)))
+                      (setq name (file-name-base)
                             p (point))
                       (insert " NAME\n\n" name
                               " - \n\n=head1 SYNOPSIS\n\n\n\n"
index 8ecfe79de3b42da0ad647da81e2bb08e3f3e60f1..1b36fe2800d8e9a8ada57448e0320df4dcddce5a 100644 (file)
@@ -52,7 +52,7 @@
   :prefix "cpp-")
 
 (defcustom cpp-config-file (convert-standard-filename ".cpp.el")
-  "*File name to save cpp configuration."
+  "File name to save cpp configuration."
   :type 'file
   :group 'cpp)
 
   :type '(choice (const invisible) (face)))
 
 (defcustom cpp-known-face 'invisible
-  "*Face used for known cpp symbols."
+  "Face used for known cpp symbols."
   :type 'cpp-face
   :group 'cpp)
 
 (defcustom cpp-unknown-face 'highlight
-  "*Face used for unknown cpp symbols."
+  "Face used for unknown cpp symbols."
   :type 'cpp-face
   :group 'cpp)
 
 (defcustom cpp-face-type 'light
-  "*Indicate what background face type you prefer.
+  "Indicate what background face type you prefer.
 Can be either light or dark for color screens, mono for monochrome
 screens, and none if you don't use a window system and don't have
 a color-capable display."
@@ -80,12 +80,12 @@ a color-capable display."
   :group 'cpp)
 
 (defcustom cpp-known-writable t
-  "*Non-nil means you are allowed to modify the known conditionals."
+  "Non-nil means you are allowed to modify the known conditionals."
   :type 'boolean
   :group 'cpp)
 
 (defcustom cpp-unknown-writable t
-  "*Non-nil means you are allowed to modify the unknown conditionals."
+  "Non-nil means you are allowed to modify the unknown conditionals."
   :type 'boolean
   :group 'cpp)
 
index 74ca5a6d76f6654ba7a285df0dee7c6bac6e7a0e..9ea71ad36f5098be4c370d9999b83ab02491a247 100644 (file)
 
 ;;{{{ Dependencies
 
-(eval-when-compile (require 'cl))
-
 (require 'custom)
 (require 'font-lock)
 (require 'cc-mode)
   :version "21.1"
   :group 'faces)
 
-(defvar cwarn-mode nil
-  "*Non-nil when Cwarn mode is active.
-
-Never set this variable directly, use the command `cwarn-mode'
-instead.")
-
 (defcustom cwarn-configuration
   '((c-mode (not reference))
     (c++-mode t))
index 166065131b2d6ff6ee3e7f8098fb2ab18768de28..af0ae9d11237bddeaf60f444bd98208309b839dc 100644 (file)
@@ -98,7 +98,7 @@ Presently this includes some syntax, .OP.erators, and \"f$\" lexicals.")
   :group 'languages)
 
 (defcustom dcl-basic-offset 4
-  "*Number of columns to indent a block in DCL.
+  "Number of columns to indent a block in DCL.
 A block is the commands between THEN-ELSE-ENDIF and between the commands
 dcl-block-begin-regexp and dcl-block-end-regexp.
 
@@ -109,7 +109,7 @@ dcl-calc-command-indent-function is set to a function."
 
 
 (defcustom dcl-continuation-offset 6
-  "*Number of columns to indent a continuation line in DCL.
+  "Number of columns to indent a continuation line in DCL.
 A continuation line is a line that follows a line ending with `-'.
 
 The meaning of this variable may be changed if
@@ -119,7 +119,7 @@ dcl-calc-cont-indent-function is set to a function."
 
 
 (defcustom dcl-margin-offset 8
-  "*Indentation for the first command line in DCL.
+  "Indentation for the first command line in DCL.
 The first command line in a file or after a SUBROUTINE statement is indented
 this much.  Other command lines are indented the same number of columns as
 the preceding command line.
@@ -129,7 +129,7 @@ A command line is a line that starts with `$'."
 
 
 (defcustom dcl-margin-label-offset 2
-  "*Number of columns to indent a margin label in DCL.
+  "Number of columns to indent a margin label in DCL.
 A margin label is a label that doesn't begin or end a block, i.e. it
 doesn't match dcl-block-begin-regexp or dcl-block-end-regexp."
   :type 'integer
@@ -137,28 +137,28 @@ doesn't match dcl-block-begin-regexp or dcl-block-end-regexp."
 
 
 (defcustom dcl-comment-line-regexp "^\\$!"
-  "*Regexp describing the start of a comment line in DCL.
+  "Regexp describing the start of a comment line in DCL.
 Comment lines are not indented."
   :type 'regexp
   :group 'dcl)
 
 
 (defcustom dcl-block-begin-regexp "loop[0-9]*:"
-  "*Regexp describing a command that begins an indented block in DCL.
+  "Regexp describing a command that begins an indented block in DCL.
 Set to nil to only indent at THEN-ELSE-ENDIF."
   :type 'regexp
   :group 'dcl)
 
 
 (defcustom dcl-block-end-regexp "endloop[0-9]*:"
-  "*Regexp describing a command that ends an indented block in DCL.
+  "Regexp describing a command that ends an indented block in DCL.
 Set to nil to only indent at THEN-ELSE-ENDIF."
   :type 'regexp
   :group 'dcl)
 
 
 (defcustom dcl-calc-command-indent-function nil
-  "*Function to calculate indentation for a command line in DCL.
+  "Function to calculate indentation for a command line in DCL.
 If this variable is non-nil it is called as a function:
 
 \(func INDENT-TYPE CUR-INDENT EXTRA-INDENT LAST-POINT THIS-POINT)
@@ -190,7 +190,7 @@ This package includes two functions suitable for this:
 
 
 (defcustom dcl-calc-cont-indent-function 'dcl-calc-cont-indent-relative
-  "*Function to calculate indentation for a continuation line.
+  "Function to calculate indentation for a continuation line.
 If this variable is non-nil it is called as a function:
 
 \(func CUR-INDENT EXTRA-INDENT)
@@ -208,7 +208,7 @@ This package includes one function suitable for this:
 
 
 (defcustom dcl-tab-always-indent t
-  "*Controls the operation of the TAB key in DCL mode.
+  "Controls the operation of the TAB key in DCL mode.
 If t, pressing TAB always indents the current line.
 If nil, pressing TAB indents the current line if point is at the left margin.
 Data lines (i.e. lines not part of a command line or continuation line) are
@@ -218,43 +218,43 @@ never indented."
 
 
 (defcustom dcl-electric-characters t
-  "*Non-nil means reindent immediately when a label, ELSE or ENDIF is inserted."
+  "Non-nil means reindent immediately when a label, ELSE or ENDIF is inserted."
   :type 'boolean
   :group 'dcl)
 
 
 (defcustom dcl-tempo-comma ", "
-  "*Text to insert when a comma is needed in a template, in DCL mode."
+  "Text to insert when a comma is needed in a template, in DCL mode."
   :type 'string
   :group 'dcl)
 
 (defcustom dcl-tempo-left-paren "("
-  "*Text to insert when a left parenthesis is needed in a template in DCL."
+  "Text to insert when a left parenthesis is needed in a template in DCL."
   :type 'string
   :group 'dcl)
 
 
 (defcustom dcl-tempo-right-paren ")"
-  "*Text to insert when a right parenthesis is needed in a template in DCL."
+  "Text to insert when a right parenthesis is needed in a template in DCL."
   :type 'string
   :group 'dcl)
 
 ; I couldn't decide what looked best, so I'll let you decide...
 ; Remember, you can also customize this with imenu-submenu-name-format.
 (defcustom dcl-imenu-label-labels "Labels"
-  "*Imenu menu title for sub-listing with label names."
+  "Imenu menu title for sub-listing with label names."
   :type 'string
   :group 'dcl)
 (defcustom dcl-imenu-label-goto "GOTO"
-  "*Imenu menu title for sub-listing with GOTO statements."
+  "Imenu menu title for sub-listing with GOTO statements."
   :type 'string
   :group 'dcl)
 (defcustom dcl-imenu-label-gosub "GOSUB"
-  "*Imenu menu title for sub-listing with GOSUB statements."
+  "Imenu menu title for sub-listing with GOSUB statements."
   :type 'string
   :group 'dcl)
 (defcustom dcl-imenu-label-call "CALL"
-  "*Imenu menu title for sub-listing with CALL statements."
+  "Imenu menu title for sub-listing with CALL statements."
   :type 'string
   :group 'dcl)
 
@@ -265,7 +265,7 @@ never indented."
     (,dcl-imenu-label-goto "\\s-GOTO[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
     (,dcl-imenu-label-gosub "\\s-GOSUB[ \t]+\\([A-Za-z0-9_\$]+\\)" 1)
     (,dcl-imenu-label-call "\\s-CALL[ \t]+\\([A-Za-z0-9_\$]+\\)" 1))
-  "*Default imenu generic expression for DCL.
+  "Default imenu generic expression for DCL.
 
 The default includes SUBROUTINE labels in the main listing and
 sub-listings for other labels, CALL, GOTO and GOSUB statements.
@@ -275,7 +275,7 @@ See `imenu-generic-expression' for details."
 
 
 (defcustom dcl-mode-hook nil
-  "*Hook called by `dcl-mode'."
+  "Hook called by `dcl-mode'."
   :type 'hook
   :group 'dcl)
 
@@ -400,7 +400,7 @@ optionally followed by a comment, followed by a newline."
 
 (defcustom dcl-electric-reindent-regexps
   (list "endif" "else" dcl-label-r)
-  "*Regexps that can trigger an electric reindent.
+  "Regexps that can trigger an electric reindent.
 A list of regexps that will trigger a reindent if the last letter
 is defined as dcl-electric-character.
 
index dd8d267683c04586e371dc1a6d6024aceb861c68..d533135c70d818b70c41ab3768399504bbab5c91 100644 (file)
@@ -74,7 +74,7 @@
   "True if in debug mode.")
 
 (defcustom delphi-search-path "."
-  "*Directories to search when finding external units.
+  "Directories to search when finding external units.
 It is a list of directory strings.  If only a single directory,
 it can be a single string instead of a list.  If a directory
 ends in \"...\" then that directory is recursively searched."
@@ -82,7 +82,7 @@ ends in \"...\" then that directory is recursively searched."
   :group 'delphi)
 
 (defcustom delphi-indent-level 3
-  "*Indentation of Delphi statements with respect to containing block.
+  "Indentation of Delphi statements with respect to containing block.
 E.g.
 
 begin
@@ -92,7 +92,7 @@ end;"
   :group 'delphi)
 
 (defcustom delphi-compound-block-indent 0
-  "*Extra indentation for blocks in compound statements. E.g.
+  "Extra indentation for blocks in compound statements. E.g.
 
 // block indent = 0     vs      // block indent = 2
 if b then                       if b then
@@ -105,7 +105,7 @@ end;                            else
   :group 'delphi)
 
 (defcustom delphi-case-label-indent delphi-indent-level
-  "*Extra indentation for case statement labels. E.g.
+  "Extra indentation for case statement labels. E.g.
 
 // case indent = 0      vs      // case indent = 3
 case value of                   case value of
@@ -118,18 +118,18 @@ end;                            end;"
   :group 'delphi)
 
 (defcustom delphi-verbose t ; nil
-  "*If true then Delphi token processing progress is reported to the user."
+  "If true then Delphi token processing progress is reported to the user."
   :type 'boolean
   :group 'delphi)
 
 (defcustom delphi-tab-always-indents t
-  "*Non-nil means TAB in Delphi mode should always reindent the current line,
+  "Non-nil means TAB in Delphi mode should always reindent the current line,
 regardless of where in the line point is when the TAB command is used."
   :type 'boolean
   :group 'delphi)
 
 (defcustom delphi-newline-always-indents t
-  "*Non-nil means NEWLINE in Delphi mode should always reindent the current
+  "Non-nil means NEWLINE in Delphi mode should always reindent the current
 line, insert a blank line and move to the default indent column of the blank
 line.  If nil, then no indentation occurs, and NEWLINE does the usual
 behavior.  This is useful when one needs to do customized indentation that
@@ -138,22 +138,22 @@ differs from the default."
   :group 'delphi)
 
 (defcustom delphi-comment-face 'font-lock-comment-face
-  "*Face used to color Delphi comments."
+  "Face used to color Delphi comments."
   :type 'face
   :group 'delphi)
 
 (defcustom delphi-string-face 'font-lock-string-face
-  "*Face used to color Delphi strings."
+  "Face used to color Delphi strings."
   :type 'face
   :group 'delphi)
 
 (defcustom delphi-keyword-face 'font-lock-keyword-face
-  "*Face used to color Delphi keywords."
+  "Face used to color Delphi keywords."
   :type 'face
   :group 'delphi)
 
 (defcustom delphi-other-face nil
-  "*Face used to color everything else."
+  "Face used to color everything else."
   :type '(choice (const :tag "None" nil) face)
   :group 'delphi)
 
index 5d0bfad0366470240d1823f1c4f0782727f80dfc..b7cbdcc70186664b57217ebbe74f65feeceb173c 100644 (file)
@@ -1181,10 +1181,10 @@ Elements of ALIST that are not conses are ignored."
 ;;; Interface to the command system
 
 (defgroup postscript nil
-  "PostScript Group."
+  "Printing with PostScript"
   :tag "PostScript"
   :version "20"
-  :group 'emacs)
+  :group 'environment)
 
 
 (defgroup ebnf2ps nil
@@ -1276,14 +1276,14 @@ Elements of ALIST that are not conses are ignored."
 
 
 (defcustom ebnf-horizontal-orientation nil
-  "*Non-nil means productions are drawn horizontally."
+  "Non-nil means productions are drawn horizontally."
   :type 'boolean
   :version "20"
   :group 'ebnf-displacement)
 
 
 (defcustom ebnf-horizontal-max-height nil
-  "*Non-nil means to use maximum production height in horizontal orientation.
+  "Non-nil means to use maximum production height in horizontal orientation.
 
 It is only used when `ebnf-horizontal-orientation' is non-nil."
   :type 'boolean
@@ -1292,7 +1292,7 @@ It is only used when `ebnf-horizontal-orientation' is non-nil."
 
 
 (defcustom ebnf-production-horizontal-space 0.0 ; use ebnf2ps default value
-  "*Specify horizontal space in points between productions.
+  "Specify horizontal space in points between productions.
 
 Value less or equal to zero forces ebnf2ps to set a proper default value."
   :type 'number
@@ -1301,7 +1301,7 @@ Value less or equal to zero forces ebnf2ps to set a proper default value."
 
 
 (defcustom ebnf-production-vertical-space 0.0 ; use ebnf2ps default value
-  "*Specify vertical space in points between productions.
+  "Specify vertical space in points between productions.
 
 Value less or equal to zero forces ebnf2ps to set a proper default value."
   :type 'number
@@ -1310,7 +1310,7 @@ Value less or equal to zero forces ebnf2ps to set a proper default value."
 
 
 (defcustom ebnf-justify-sequence 'center
-  "*Specify justification of terms in a sequence inside alternatives.
+  "Specify justification of terms in a sequence inside alternatives.
 
 Valid values are:
 
@@ -1324,14 +1324,14 @@ Valid values are:
 
 
 (defcustom ebnf-special-show-delimiter t
-  "*Non-nil means special delimiter (character `?') is shown."
+  "Non-nil means special delimiter (character `?') is shown."
   :type 'boolean
   :version "20"
   :group 'ebnf-special)
 
 
 (defcustom ebnf-special-font '(7 Courier "Black" "Gray95" bold italic)
-  "*Specify special font.
+  "Specify special font.
 
 See documentation for `ebnf-production-font'."
   :type '(list :tag "Special Font"
@@ -1353,7 +1353,7 @@ See documentation for `ebnf-production-font'."
 
 
 (defcustom ebnf-special-shape 'bevel
-  "*Specify special box shape.
+  "Specify special box shape.
 
 See documentation for `ebnf-non-terminal-shape'."
   :type '(radio :tag "Special Shape"
@@ -1363,28 +1363,28 @@ See documentation for `ebnf-non-terminal-shape'."
 
 
 (defcustom ebnf-special-shadow nil
-  "*Non-nil means special box will have a shadow."
+  "Non-nil means special box will have a shadow."
   :type 'boolean
   :version "20"
   :group 'ebnf-special)
 
 
 (defcustom ebnf-special-border-width 0.5
-  "*Specify border width for special box."
+  "Specify border width for special box."
   :type 'number
   :version "20"
   :group 'ebnf-special)
 
 
 (defcustom ebnf-special-border-color "Black"
-  "*Specify border color for special box."
+  "Specify border color for special box."
   :type 'string
   :version "20"
   :group 'ebnf-special)
 
 
 (defcustom ebnf-except-font '(7 Courier "Black" "Gray90" bold italic)
-  "*Specify except font.
+  "Specify except font.
 
 See documentation for `ebnf-production-font'."
   :type '(list :tag "Except Font"
@@ -1406,7 +1406,7 @@ See documentation for `ebnf-production-font'."
 
 
 (defcustom ebnf-except-shape 'bevel
-  "*Specify except box shape.
+  "Specify except box shape.
 
 See documentation for `ebnf-non-terminal-shape'."
   :type '(radio :tag "Except Shape"
@@ -1416,28 +1416,28 @@ See documentation for `ebnf-non-terminal-shape'."
 
 
 (defcustom ebnf-except-shadow nil
-  "*Non-nil means except box will have a shadow."
+  "Non-nil means except box will have a shadow."
   :type 'boolean
   :version "20"
   :group 'ebnf-except)
 
 
 (defcustom ebnf-except-border-width 0.25
-  "*Specify border width for except box."
+  "Specify border width for except box."
   :type 'number
   :version "20"
   :group 'ebnf-except)
 
 
 (defcustom ebnf-except-border-color "Black"
-  "*Specify border color for except box."
+  "Specify border color for except box."
   :type 'string
   :version "20"
   :group 'ebnf-except)
 
 
 (defcustom ebnf-repeat-font '(7 Courier "Black" "Gray85" bold italic)
-  "*Specify repeat font.
+  "Specify repeat font.
 
 See documentation for `ebnf-production-font'."
   :type '(list :tag "Repeat Font"
@@ -1459,7 +1459,7 @@ See documentation for `ebnf-production-font'."
 
 
 (defcustom ebnf-repeat-shape 'bevel
-  "*Specify repeat box shape.
+  "Specify repeat box shape.
 
 See documentation for `ebnf-non-terminal-shape'."
   :type '(radio :tag "Repeat Shape"
@@ -1469,28 +1469,28 @@ See documentation for `ebnf-non-terminal-shape'."
 
 
 (defcustom ebnf-repeat-shadow nil
-  "*Non-nil means repeat box will have a shadow."
+  "Non-nil means repeat box will have a shadow."
   :type 'boolean
   :version "20"
   :group 'ebnf-repeat)
 
 
 (defcustom ebnf-repeat-border-width 0.0
-  "*Specify border width for repeat box."
+  "Specify border width for repeat box."
   :type 'number
   :version "20"
   :group 'ebnf-repeat)
 
 
 (defcustom ebnf-repeat-border-color "Black"
-  "*Specify border color for repeat box."
+  "Specify border color for repeat box."
   :type 'string
   :version "20"
   :group 'ebnf-repeat)
 
 
 (defcustom ebnf-terminal-font '(7 Courier "Black" "White")
-  "*Specify terminal font.
+  "Specify terminal font.
 
 See documentation for `ebnf-production-font'."
   :type '(list :tag "Terminal Font"
@@ -1512,7 +1512,7 @@ See documentation for `ebnf-production-font'."
 
 
 (defcustom ebnf-terminal-shape 'miter
-  "*Specify terminal box shape.
+  "Specify terminal box shape.
 
 See documentation for `ebnf-non-terminal-shape'."
   :type '(radio :tag "Terminal Shape"
@@ -1522,35 +1522,35 @@ See documentation for `ebnf-non-terminal-shape'."
 
 
 (defcustom ebnf-terminal-shadow nil
-  "*Non-nil means terminal box will have a shadow."
+  "Non-nil means terminal box will have a shadow."
   :type 'boolean
   :version "20"
   :group 'ebnf-terminal)
 
 
 (defcustom ebnf-terminal-border-width 1.0
-  "*Specify border width for terminal box."
+  "Specify border width for terminal box."
   :type 'number
   :version "20"
   :group 'ebnf-terminal)
 
 
 (defcustom ebnf-terminal-border-color "Black"
-  "*Specify border color for terminal box."
+  "Specify border color for terminal box."
   :type 'string
   :version "20"
   :group 'ebnf-terminal)
 
 
 (defcustom ebnf-production-name-p t
-  "*Non-nil means production name will be printed."
+  "Non-nil means production name will be printed."
   :type 'boolean
   :version "20"
   :group 'ebnf-production)
 
 
 (defcustom ebnf-sort-production nil
-  "*Specify how productions are sorted.
+  "Specify how productions are sorted.
 
 Valid values are:
 
@@ -1566,7 +1566,7 @@ Valid values are:
 
 
 (defcustom ebnf-production-font '(10 Helvetica "Black" "White" bold)
-  "*Specify production header font.
+  "Specify production header font.
 
 It is a list with the following form:
 
@@ -1609,7 +1609,7 @@ See `ps-font-info-database' for valid font name."
 
 
 (defcustom ebnf-non-terminal-font '(7 Helvetica "Black" "White")
-  "*Specify non-terminal font.
+  "Specify non-terminal font.
 
 See documentation for `ebnf-production-font'."
   :type '(list :tag "Non-Terminal Font"
@@ -1631,7 +1631,7 @@ See documentation for `ebnf-production-font'."
 
 
 (defcustom ebnf-non-terminal-shape 'round
-  "*Specify non-terminal box shape.
+  "Specify non-terminal box shape.
 
 Valid values are:
 
@@ -1655,28 +1655,28 @@ Any other value is treated as `miter'."
 
 
 (defcustom ebnf-non-terminal-shadow nil
-  "*Non-nil means non-terminal box will have a shadow."
+  "Non-nil means non-terminal box will have a shadow."
   :type 'boolean
   :version "20"
   :group 'ebnf-non-terminal)
 
 
 (defcustom ebnf-non-terminal-border-width 1.0
-  "*Specify border width for non-terminal box."
+  "Specify border width for non-terminal box."
   :type 'number
   :version "20"
   :group 'ebnf-non-terminal)
 
 
 (defcustom ebnf-non-terminal-border-color "Black"
-  "*Specify border color for non-terminal box."
+  "Specify border color for non-terminal box."
   :type 'string
   :version "20"
   :group 'ebnf-non-terminal)
 
 
 (defcustom ebnf-arrow-shape 'hollow
-  "*Specify the arrow shape.
+  "Specify the arrow shape.
 
 Valid values are:
 
@@ -1733,7 +1733,7 @@ Any other value is treated as `none'."
 
 
 (defcustom ebnf-chart-shape 'round
-  "*Specify chart flow shape.
+  "Specify chart flow shape.
 
 See documentation for `ebnf-non-terminal-shape'."
   :type '(radio :tag "Chart Flow Shape"
@@ -1743,7 +1743,7 @@ See documentation for `ebnf-non-terminal-shape'."
 
 
 (defcustom ebnf-user-arrow nil
-  "*Specify a sexp for user arrow shape (a PostScript code).
+  "Specify a sexp for user arrow shape (a PostScript code).
 
 When evaluated, the sexp should return nil or a string containing PostScript
 code.  PostScript code should draw a right arrow.
@@ -1783,7 +1783,7 @@ symbol `user'."
 
 
 (defcustom ebnf-syntax 'ebnf
-  "*Specify syntax to be recognized.
+  "Specify syntax to be recognized.
 
 Valid values are:
 
@@ -1827,7 +1827,7 @@ Any other value is treated as `ebnf'."
 
 
 (defcustom ebnf-lex-comment-char ?\;
-  "*Specify the line comment character.
+  "Specify the line comment character.
 
 It's used only when `ebnf-syntax' is `ebnf'."
   :type 'character
@@ -1836,7 +1836,7 @@ It's used only when `ebnf-syntax' is `ebnf'."
 
 
 (defcustom ebnf-lex-eop-char ?.
-  "*Specify the end of production character.
+  "Specify the end of production character.
 
 It's used only when `ebnf-syntax' is `ebnf'."
   :type 'character
@@ -1845,7 +1845,7 @@ It's used only when `ebnf-syntax' is `ebnf'."
 
 
 (defcustom ebnf-terminal-regexp nil
-  "*Specify how it's a terminal name.
+  "Specify how it's a terminal name.
 
 If it's nil, the terminal name must be enclosed by `\"'.
 If it's a string, it should be a regexp that it'll be used to determine a
@@ -1859,7 +1859,7 @@ It's used only when `ebnf-syntax' is `ebnf'."
 
 
 (defcustom ebnf-case-fold-search nil
-  "*Non-nil means ignore case on matching.
+  "Non-nil means ignore case on matching.
 
 It's only used when `ebnf-terminal-regexp' is non-nil and when `ebnf-syntax' is
 `ebnf'."
@@ -1869,7 +1869,7 @@ It's only used when `ebnf-terminal-regexp' is non-nil and when `ebnf-syntax' is
 
 
 (defcustom ebnf-iso-alternative-p nil
-  "*Non-nil means use alternative ISO EBNF.
+  "Non-nil means use alternative ISO EBNF.
 
 It's only used when `ebnf-syntax' is `iso-ebnf'.
 
@@ -1888,7 +1888,7 @@ This variable affects the following symbol set:
 
 
 (defcustom ebnf-iso-normalize-p nil
-  "*Non-nil means normalize ISO EBNF syntax names.
+  "Non-nil means normalize ISO EBNF syntax names.
 
 Normalize a name means that several contiguous spaces inside name become a
 single space, so \"A  B   C\" is normalized to  \"A B C\".
@@ -1900,7 +1900,7 @@ It's only used when `ebnf-syntax' is `iso-ebnf'."
 
 
 (defcustom ebnf-file-suffix-regexp "\.[Bb][Nn][Ff]$"
-  "*Specify file name suffix that contains EBNF.
+  "Specify file name suffix that contains EBNF.
 
 See `ebnf-eps-directory' command."
   :type 'regexp
@@ -1909,7 +1909,7 @@ See `ebnf-eps-directory' command."
 
 
 (defcustom ebnf-eps-prefix "ebnf--"
-  "*Specify EPS prefix file name.
+  "Specify EPS prefix file name.
 
 See `ebnf-eps-buffer' and `ebnf-eps-region' commands."
   :type 'string
@@ -1918,7 +1918,7 @@ See `ebnf-eps-buffer' and `ebnf-eps-region' commands."
 
 
 (defcustom ebnf-eps-header-font '(11 Helvetica "Black" "White" bold)
-  "*Specify EPS header font.
+  "Specify EPS header font.
 
 See documentation for `ebnf-production-font'.
 
@@ -1942,7 +1942,7 @@ See `ebnf-eps-buffer' and `ebnf-eps-region' commands."
 
 
 (defcustom ebnf-eps-header nil
-  "*Specify EPS header.
+  "Specify EPS header.
 
 The value should be a string, a symbol or nil.
 
@@ -1978,7 +1978,7 @@ empty string, no header is generated until a non-empty header is specified or
 
 
 (defcustom ebnf-eps-footer-font '(7 Helvetica "Black" "White" bold)
-  "*Specify EPS footer font.
+  "Specify EPS footer font.
 
 See documentation for `ebnf-production-font'.
 
@@ -2002,7 +2002,7 @@ See `ebnf-eps-buffer' and `ebnf-eps-region' commands."
 
 
 (defcustom ebnf-eps-footer nil
-  "*Specify EPS footer.
+  "Specify EPS footer.
 
 The value should be a string, a symbol or nil.
 
@@ -2038,7 +2038,7 @@ empty string, no footer is generated until a non-empty footer is specified or
 
 
 (defcustom ebnf-entry-percentage 0.5   ; middle
-  "*Specify entry height on alternatives.
+  "Specify entry height on alternatives.
 
 It must be a float between 0.0 (top) and 1.0 (bottom)."
   :type 'number
@@ -2047,7 +2047,7 @@ It must be a float between 0.0 (top) and 1.0 (bottom)."
 
 
 (defcustom ebnf-default-width 0.6
-  "*Specify additional border width over default terminal, non-terminal or
+  "Specify additional border width over default terminal, non-terminal or
 special."
   :type 'number
   :version "20"
@@ -2057,21 +2057,21 @@ special."
 ;; Printing color requires x-color-values.
 (defcustom ebnf-color-p (or (fboundp 'x-color-values) ; Emacs
                            (fboundp 'color-instance-rgb-components)) ; XEmacs
-  "*Non-nil means use color."
+  "Non-nil means use color."
   :type 'boolean
   :version "20"
   :group 'ebnf2ps)
 
 
 (defcustom ebnf-line-width 1.0
-  "*Specify flow line width."
+  "Specify flow line width."
   :type 'number
   :version "20"
   :group 'ebnf2ps)
 
 
 (defcustom ebnf-line-color "Black"
-  "*Specify flow line color."
+  "Specify flow line color."
   :type 'string
   :version "20"
   :group 'ebnf2ps)
@@ -2081,7 +2081,7 @@ special."
   (if (eq ebnf-arrow-shape 'none)
       0.0
     (* (sqrt 5.0) 0.65 ebnf-line-width))
-  "*Specify extra width for arrow shape drawing.
+  "Specify extra width for arrow shape drawing.
 
 The extra width is used to avoid that the arrowhead and the terminal border
 overlap.  It depends on `ebnf-arrow-shape' and `ebnf-line-width'."
@@ -2091,7 +2091,7 @@ overlap.  It depends on `ebnf-arrow-shape' and `ebnf-line-width'."
 
 
 (defcustom ebnf-arrow-scale 1.0
-  "*Specify the arrow scale.
+  "Specify the arrow scale.
 
 Values lower than 1.0, shrink the arrow.
 Values greater than 1.0, expand the arrow."
@@ -2101,7 +2101,7 @@ Values greater than 1.0, expand the arrow."
 
 
 (defcustom ebnf-debug-ps nil
-  "*Non-nil means to generate PostScript debug procedures.
+  "Non-nil means to generate PostScript debug procedures.
 
 It is intended to help PostScript programmers in debugging."
   :type 'boolean
@@ -2110,7 +2110,7 @@ It is intended to help PostScript programmers in debugging."
 
 
 (defcustom ebnf-use-float-format t
-  "*Non-nil means use `%f' float format.
+  "Non-nil means use `%f' float format.
 
 The advantage of using float format is that ebnf2ps generates a little short
 PostScript file.
@@ -2126,14 +2126,14 @@ when executing ebnf2ps, set `ebnf-use-float-format' to nil."
 
 
 (defcustom ebnf-stop-on-error nil
-  "*Non-nil means signal error and stop.  Otherwise, signal error and continue."
+  "Non-nil means signal error and stop.  Otherwise, signal error and continue."
   :type 'boolean
   :version "20"
   :group 'ebnf2ps)
 
 
 (defcustom ebnf-yac-ignore-error-recovery nil
-  "*Non-nil means ignore error recovery.
+  "Non-nil means ignore error recovery.
 
 It's only used when `ebnf-syntax' is `yacc'."
   :type 'boolean
@@ -2142,7 +2142,7 @@ It's only used when `ebnf-syntax' is `yacc'."
 
 
 (defcustom ebnf-ignore-empty-rule nil
-  "*Non-nil means ignore empty rules.
+  "Non-nil means ignore empty rules.
 
 It's interesting to set this variable if your Yacc/Bison grammar has a lot of
 middle action rule."
@@ -2152,7 +2152,7 @@ middle action rule."
 
 
 (defcustom ebnf-optimize nil
-  "*Non-nil means optimize syntactic chart of rules.
+  "Non-nil means optimize syntactic chart of rules.
 
 The following optimizations are done:
 
@@ -2179,7 +2179,7 @@ The above optimizations are specially useful when `ebnf-syntax' is `yacc'."
 
 
 (defcustom ebnf-log nil
-  "*Non-nil means generate log messages.
+  "Non-nil means generate log messages.
 
 The log messages are generated into the buffer *Ebnf2ps Log*.
 These messages are intended to help debugging ebnf2ps."
index 4a07392c30955da4b15e1e48a37bb15c37a79fb5..1d29011762e429157f7e1dd42708039dc75e44ea 100644 (file)
@@ -38,7 +38,7 @@
 (require 'ebuff-menu)
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'helper))
 
 \f
@@ -48,9 +48,8 @@
   "Settings for the C++ class browser."
   :group 'tools)
 
-
 (defcustom ebrowse-search-path nil
-  "*List of directories to search for source files in a class tree.
+  "List of directories to search for source files in a class tree.
 Elements should be directory names; nil as an element means to try
 to find source files relative to the location of the BROWSE file loaded."
   :group 'ebrowse
@@ -59,25 +58,25 @@ to find source files relative to the location of the BROWSE file loaded."
 
 
 (defcustom ebrowse-view/find-hook nil
-  "*Hooks run after finding or viewing a member or class."
+  "Hooks run after finding or viewing a member or class."
   :group 'ebrowse
   :type 'hook)
 
 
 (defcustom ebrowse-not-found-hook nil
-  "*Hooks run when finding or viewing a member or class was not successful."
+  "Hooks run when finding or viewing a member or class was not successful."
   :group 'ebrowse
   :type 'hook)
 
 
 (defcustom ebrowse-electric-list-mode-hook nil
-  "*Hook called by `ebrowse-electric-position-mode'."
+  "Hook called by `ebrowse-electric-position-mode'."
   :group 'ebrowse
   :type 'hook)
 
 
 (defcustom ebrowse-max-positions 50
-  "*Number of markers saved on electric position stack."
+  "Number of markers saved on electric position stack."
   :group 'ebrowse
   :type 'integer)
 
@@ -89,31 +88,31 @@ to find source files relative to the location of the BROWSE file loaded."
 
 
 (defcustom ebrowse-tree-mode-hook nil
-  "*Hook run in each new tree buffer."
+  "Hook run in each new tree buffer."
   :group 'ebrowse-tree
   :type 'hook)
 
 
 (defcustom ebrowse-tree-buffer-name "*Tree*"
-  "*The default name of class tree buffers."
+  "The default name of class tree buffers."
   :group 'ebrowse-tree
   :type 'string)
 
 
 (defcustom ebrowse--indentation 4
-  "*The amount by which subclasses are indented in the tree."
+  "The amount by which subclasses are indented in the tree."
   :group 'ebrowse-tree
   :type 'integer)
 
 
 (defcustom ebrowse-source-file-column 40
-  "*The column in which source file names are displayed in the tree."
+  "The column in which source file names are displayed in the tree."
   :group 'ebrowse-tree
   :type 'integer)
 
 
 (defcustom ebrowse-tree-left-margin 2
-  "*Amount of space left at the left side of the tree display.
+  "Amount of space left at the left side of the tree display.
 This space is used to display markers."
   :group 'ebrowse-tree
   :type 'integer)
@@ -126,25 +125,25 @@ This space is used to display markers."
 
 
 (defcustom ebrowse-default-declaration-column 25
-  "*The column in which member declarations are displayed in member buffers."
+  "The column in which member declarations are displayed in member buffers."
   :group 'ebrowse-member
   :type 'integer)
 
 
 (defcustom ebrowse-default-column-width 25
-  "*The width of the columns in member buffers (short display form)."
+  "The width of the columns in member buffers (short display form)."
   :group 'ebrowse-member
   :type 'integer)
 
 
 (defcustom ebrowse-member-buffer-name "*Members*"
-  "*The name of the buffer for member display."
+  "The name of the buffer for member display."
   :group 'ebrowse-member
   :type 'string)
 
 
 (defcustom ebrowse-member-mode-hook nil
-  "*Run in each new member buffer."
+  "Run in each new member buffer."
   :group 'ebrowse-member
   :type 'hook)
 
@@ -154,61 +153,42 @@ This space is used to display markers."
   "Faces used by Ebrowse."
   :group 'ebrowse)
 
-
 (defface ebrowse-tree-mark
-  '((((min-colors 88)) (:foreground "red1"))
-    (t (:foreground "red")))
-  "*The face used for the mark character in the tree."
+  '((((min-colors 88)) :foreground "red1")
+    (t :foreground "red"))
+  "Face for the mark character in the Ebrowse tree."
   :group 'ebrowse-faces)
-(define-obsolete-face-alias 'ebrowse-tree-mark-face 'ebrowse-tree-mark "22.1")
-
 
 (defface ebrowse-root-class
-  '((((min-colors 88)) (:weight bold :foreground "blue1"))
-    (t (:weight bold :foreground "blue")))
-  "*The face used for root classes in the tree."
+  '((((min-colors 88)) :weight bold :foreground "blue1")
+    (t :weight bold :foreground "blue"))
+  "Face for root classes in the Ebrowse tree."
   :group 'ebrowse-faces)
-(define-obsolete-face-alias 'ebrowse-root-class-face 'ebrowse-root-class "22.1")
 
-
-(defface ebrowse-file-name
-  '((t (:italic t)))
-  "*The face for filenames displayed in the tree."
+(defface ebrowse-file-name '((t :slant italic))
+  "Face for filenames in the Ebrowse tree."
   :group 'ebrowse-faces)
-(define-obsolete-face-alias 'ebrowse-file-name-face 'ebrowse-file-name "22.1")
-
 
-(defface ebrowse-default
-  '((t nil))
-  "*Face for everything else in the tree not having other faces."
+(defface ebrowse-default '((t))
+  "Face for items in the Ebrowse tree which do not have other faces."
   :group 'ebrowse-faces)
-(define-obsolete-face-alias 'ebrowse-default-face 'ebrowse-default "22.1")
-
 
 (defface ebrowse-member-attribute
-  '((((min-colors 88)) (:foreground "red1"))
-    (t (:foreground "red")))
-  "*Face used to display member attributes."
+  '((((min-colors 88)) :foreground "red1")
+    (t :foreground "red"))
+  "Face for member attributes."
   :group 'ebrowse-faces)
-(define-obsolete-face-alias 'ebrowse-member-attribute-face
-  'ebrowse-member-attribute "22.1")
-
 
 (defface ebrowse-member-class
-  '((t (:foreground "purple")))
-  "*Face used to display the class title in member buffers."
+  '((t :foreground "purple"))
+  "Face used to display the class title in member buffers."
   :group 'ebrowse-faces)
-(define-obsolete-face-alias 'ebrowse-member-class-face
-  'ebrowse-member-class "22.1")
-
 
 (defface ebrowse-progress
-  '((((min-colors 88)) (:background "blue1"))
-    (t (:background "blue")))
-  "*Face for progress indicator."
+  '((((min-colors 88)) :background "blue1")
+    (t :background "blue"))
+  "Face for progress indicator."
   :group 'ebrowse-faces)
-(define-obsolete-face-alias 'ebrowse-progress-face 'ebrowse-progress "22.1")
-
 
 \f
 ;;; Utilities.
@@ -269,6 +249,7 @@ This is a destructive operation."
 (defmacro ebrowse-output (&rest body)
   "Eval BODY with a writable current buffer.
 Preserve buffer's modified state."
+  (declare (indent 0) (debug t))
   (let ((modified (make-symbol "--ebrowse-output--")))
     `(let (buffer-read-only (,modified (buffer-modified-p)))
        (unwind-protect
@@ -278,35 +259,30 @@ Preserve buffer's modified state."
 
 (defmacro ebrowse-ignoring-completion-case (&rest body)
   "Eval BODY with `completion-ignore-case' bound to t."
+  (declare (indent 0) (debug t))
   `(let ((completion-ignore-case t))
      ,@body))
 
-
 (defmacro ebrowse-save-selective (&rest body)
   "Eval BODY with `selective-display' restored at the end."
-  (let ((var (make-symbol "var")))
-    `(let ((,var selective-display))
-       (unwind-protect
-          (progn ,@body)
-        (setq selective-display ,var)))))
-
+  (declare (indent 0) (debug t))
+  ;; FIXME: Don't use selective-display.
+  `(let ((selective-display selective-display))
+     ,@body))
 
 (defmacro ebrowse-for-all-trees (spec &rest body)
   "For all trees in SPEC, eval BODY."
+  (declare (indent 1) (debug ((sexp form) body)))
   (let ((var (make-symbol "var"))
        (spec-var (car spec))
        (array (cadr spec)))
-    `(loop for ,var being the symbols of ,array
-          as ,spec-var = (get ,var 'ebrowse-root) do
-          (when (vectorp ,spec-var)
-            ,@body))))
+    `(cl-loop for ,var being the symbols of ,array
+              as ,spec-var = (get ,var 'ebrowse-root) do
+              (when (vectorp ,spec-var)
+                ,@body))))
 
 ;;; Set indentation for macros above.
 
-(put 'ebrowse-output 'lisp-indent-hook 0)
-(put 'ebrowse-ignoring-completion-case 'lisp-indent-hook 0)
-(put 'ebrowse-save-selective 'lisp-indent-hook 0)
-(put 'ebrowse-for-all-trees 'lisp-indent-hook 1)
 
 
 (defsubst ebrowse-set-face (start end face)
@@ -327,17 +303,6 @@ is STRING, but point is placed POSITION characters into the string."
   (ebrowse-ignoring-completion-case
     (completing-read prompt table nil t initial-input)))
 
-
-(defun ebrowse-value-in-buffer (sym buffer)
-  "Return the value of SYM in BUFFER."
-  (let ((old-buffer (current-buffer)))
-    (unwind-protect
-        (progn
-          (set-buffer buffer)
-          (symbol-value sym))
-      (set-buffer old-buffer))))
-
-
 (defun ebrowse-rename-buffer (new-name)
   "Rename current buffer to NEW-NAME.
 If a buffer with name NEW-NAME already exists, delete it first."
@@ -353,9 +318,9 @@ If a buffer with name NEW-NAME already exists, delete it first."
 Replace sequences of newlines with a single space."
   (when (string-match "^[ \t\n\r]+" string)
     (setq string (substring string (match-end 0))))
-  (loop while (string-match "[\n]+" string)
-        finally return string do
-       (setq string (replace-match " " nil t string))))
+  (cl-loop while (string-match "[\n]+" string)
+           finally return string do
+           (setq string (replace-match " " nil t string))))
 
 
 (defun ebrowse-width-of-drawable-area ()
@@ -370,7 +335,7 @@ otherwise use the current frame's width."
 \f
 ;;; Structure definitions
 
-(defstruct (ebrowse-hs (:type vector) :named)
+(cl-defstruct (ebrowse-hs (:type vector) :named)
   "Header structure found at the head of BROWSE files."
   ;; A version string that is compared against the version number of
   ;; the Lisp package when the file is loaded.  This is done to
@@ -387,7 +352,7 @@ otherwise use the current frame's width."
   member-table)
 
 
-(defstruct (ebrowse-ts (:type vector) :named)
+(cl-defstruct (ebrowse-ts (:type vector) :named)
   "Tree structure.
 Following the header structure, a BROWSE file contains a number
 of `ebrowse-ts' structures, each one describing one root class of
@@ -407,7 +372,7 @@ the class hierarchy with all its subclasses."
   mark)
 
 
-(defstruct (ebrowse-bs (:type vector) :named)
+(cl-defstruct (ebrowse-bs (:type vector) :named)
   "Common sub-structure.
 A common structure defining an occurrence of some name in the
 source files."
@@ -434,14 +399,14 @@ source files."
   point)
 
 
-(defstruct (ebrowse-cs (:include ebrowse-bs) (:type vector) :named)
+(cl-defstruct (ebrowse-cs (:include ebrowse-bs) (:type vector) :named)
   "Class structure.
 This is the structure stored in the CLASS slot of a `ebrowse-ts'
 structure.  It describes the location of the class declaration."
   source-file)
 
 
-(defstruct (ebrowse-ms (:include ebrowse-bs) (:type vector) :named)
+(cl-defstruct (ebrowse-ms (:include ebrowse-bs) (:type vector) :named)
   "Member structure.
 This is the structure describing a single member.  The `ebrowse-ts'
 structure contains various lists for the different types of
@@ -711,7 +676,7 @@ MARKED-ONLY non-nil means include marked classes only."
     (ebrowse-for-all-trees (tree ebrowse--tree-obarray)
       (when (or (not marked-only) (ebrowse-ts-mark tree))
        (let ((class (ebrowse-ts-class tree)))
-         (when (zerop (% (incf i) 20))
+         (when (zerop (% (cl-incf i) 20))
            (ebrowse-show-progress "Preparing file list" (zerop i)))
          ;; Add files mentioned in class description
          (let ((source-file (ebrowse-cs-source-file class))
@@ -721,14 +686,14 @@ MARKED-ONLY non-nil means include marked classes only."
            (when file
              (puthash file file files))
            ;; For all member lists in this class
-           (loop for accessor in ebrowse-member-list-accessors do
-                 (loop for m in (funcall accessor tree)
-                       for file = (ebrowse-ms-file m)
-                       for def-file = (ebrowse-ms-definition-file m) do
-                       (when file
-                         (puthash file file files))
-                       (when def-file
-                         (puthash def-file def-file files))))))))
+           (dolist (accessor ebrowse-member-list-accessors)
+              (cl-loop for m in (funcall accessor tree)
+                       for file = (ebrowse-ms-file m)
+                       for def-file = (ebrowse-ms-definition-file m) do
+                       (when file
+                         (puthash file file files))
+                       (when def-file
+                         (puthash def-file def-file files))))))))
     files))
 
 
@@ -741,11 +706,11 @@ MARKED-ONLY non-nil means include marked classes only."
     list))
 
 
-(defun* ebrowse-marked-classes-p ()
+(cl-defun ebrowse-marked-classes-p ()
   "Value is non-nil if any class in the current class tree is marked."
   (ebrowse-for-all-trees (tree ebrowse--tree-obarray)
     (when (ebrowse-ts-mark tree)
-      (return-from ebrowse-marked-classes-p tree))))
+      (cl-return-from ebrowse-marked-classes-p tree))))
 
 
 (defsubst ebrowse-globals-tree-p (tree)
@@ -772,12 +737,13 @@ The class tree is found in the buffer-local variable `ebrowse--tree-obarray'."
     (if qualified-names-p
        (ebrowse-for-all-trees (tree ebrowse--tree-obarray)
          (setq alist
-               (acons (ebrowse-qualified-class-name (ebrowse-ts-class tree))
-                      tree alist)))
+               (cl-acons (ebrowse-qualified-class-name
+                           (ebrowse-ts-class tree))
+                          tree alist)))
       (ebrowse-for-all-trees (tree ebrowse--tree-obarray)
        (setq alist
-             (acons (ebrowse-cs-name (ebrowse-ts-class tree))
-                    tree alist))))
+             (cl-acons (ebrowse-cs-name (ebrowse-ts-class tree))
+                        tree alist))))
     alist))
 
 
@@ -812,15 +778,15 @@ This function must be used instead of the struct slot
 computes this information lazily."
   (or (ebrowse-ts-base-classes tree)
       (setf (ebrowse-ts-base-classes tree)
-           (loop with to-search = (list tree)
-                 with result = nil
-                 as search = (pop to-search)
-                 while search finally return result
-                 do (ebrowse-for-all-trees (ti ebrowse--tree-obarray)
-                      (when (memq search (ebrowse-ts-subclasses ti))
-                        (unless (memq ti result)
-                          (setq result (nconc result (list ti))))
-                        (push ti to-search)))))))
+           (cl-loop with to-search = (list tree)
+                     with result = nil
+                     as search = (pop to-search)
+                     while search finally return result
+                     do (ebrowse-for-all-trees (ti ebrowse--tree-obarray)
+                          (when (memq search (ebrowse-ts-subclasses ti))
+                            (unless (memq ti result)
+                              (setq result (nconc result (list ti))))
+                            (push ti to-search)))))))
 
 
 (defun ebrowse-direct-base-classes (tree)
@@ -840,8 +806,8 @@ computes this information lazily."
 ACCESSOR is the accessor function for the member list.
 Elements of the result have the form (NAME . ACCESSOR), where NAME
 is the member name."
-  (loop for member in (funcall accessor tree)
-       collect (cons (ebrowse-ms-name member) accessor)))
+  (cl-loop for member in (funcall accessor tree)
+           collect (cons (ebrowse-ms-name member) accessor)))
 
 
 (defun ebrowse-name/accessor-alist-for-visible-members ()
@@ -854,10 +820,10 @@ structure.  The list includes inherited members if these are visible."
                                            ebrowse--accessor)))
     (if ebrowse--show-inherited-flag
        (nconc list
-              (loop for tree in (ebrowse-base-classes
-                                 ebrowse--displayed-class)
-                    nconc (ebrowse-name/accessor-alist
-                           tree ebrowse--accessor)))
+              (cl-loop for tree in (ebrowse-base-classes
+                                     ebrowse--displayed-class)
+                        nconc (ebrowse-name/accessor-alist
+                               tree ebrowse--accessor)))
       list)))
 
 
@@ -928,8 +894,7 @@ and TREE is a list of `ebrowse-ts' structures forming the class tree."
 See that variable's documentation for the meaning of IGNORE-AUTO-SAVE and
 NOCONFIRM."
   (when (or noconfirm (yes-or-no-p "Revert tree from disk? "))
-    (loop for member-buffer in (ebrowse-same-tree-member-buffer-list)
-         do (kill-buffer member-buffer))
+    (mapc #'kill-buffer (ebrowse-same-tree-member-buffer-list))
     (erase-buffer)
     (with-no-warnings
       (insert-file (or buffer-file-name ebrowse--tags-file-name)))
@@ -954,9 +919,9 @@ Return the buffer created."
          ebrowse--frozen-flag nil)
     (ebrowse-redraw-tree)
     (set-buffer-modified-p nil)
-    (case pop
-      (switch (switch-to-buffer name))
-      (pop (pop-to-buffer name)))
+    (pcase pop
+      (`switch (switch-to-buffer name))
+      (`pop (pop-to-buffer name)))
     (current-buffer)))
 
 
@@ -982,14 +947,14 @@ type `ebrowse-hs' is set to the resulting obarray."
     (garbage-collect)
     ;; For all classes...
     (ebrowse-for-all-trees (c ebrowse--tree-obarray)
-      (when (zerop (% (incf i) 10))
+      (when (zerop (% (cl-incf i) 10))
        (ebrowse-show-progress "Preparing member lookup" (zerop i)))
-      (loop for f in ebrowse-member-list-accessors do
-           (loop for m in (funcall f c) do
-                 (let* ((member-name (ebrowse-ms-name m))
-                        (value (gethash member-name members)))
-                   (push (list c f m) value)
-                   (puthash member-name value members)))))
+      (dolist (f ebrowse-member-list-accessors)
+        (dolist (m (funcall f c))
+          (let* ((member-name (ebrowse-ms-name m))
+                 (value (gethash member-name members)))
+            (push (list c f m) value)
+            (puthash member-name value members)))))
     (setf (ebrowse-hs-member-table ebrowse--header) members)))
 
 
@@ -997,11 +962,11 @@ type `ebrowse-hs' is set to the resulting obarray."
   "Return the member obarray.  Build it if it hasn't been set up yet.
 HEADER is the tree header structure of the class tree."
   (when (null (ebrowse-hs-member-table header))
-    (loop for buffer in (ebrowse-browser-buffer-list)
-         until (eq header (ebrowse-value-in-buffer 'ebrowse--header buffer))
-         finally do
-         (with-current-buffer buffer
-           (ebrowse-fill-member-table))))
+    (cl-loop for buffer in (ebrowse-browser-buffer-list)
+             until (eq header (buffer-local-value 'ebrowse--header buffer))
+             finally do
+             (with-current-buffer buffer
+               (ebrowse-fill-member-table))))
   (ebrowse-hs-member-table header))
 
 
@@ -1013,11 +978,12 @@ HEADER is the tree header structure of the class tree."
 Build obarray of all classes in TREE."
   (let ((classes (make-vector 127 0)))
     ;; Add root classes...
-    (loop for root in tree
-         as sym =
-         (intern (ebrowse-qualified-class-name (ebrowse-ts-class root)) classes)
-         do (unless (get sym 'ebrowse-root)
-              (setf (get sym 'ebrowse-root) root)))
+    (cl-loop for root in tree
+             as sym =
+             (intern (ebrowse-qualified-class-name (ebrowse-ts-class root))
+                     classes)
+             do (unless (get sym 'ebrowse-root)
+                  (setf (get sym 'ebrowse-root) root)))
     ;; Process subclasses
     (ebrowse-insert-supers tree classes)
     classes))
@@ -1035,29 +1001,30 @@ beginning of the base-class list.
 
 We have to be cautious here not to end up in an infinite recursion
 if for some reason a circle is in the inheritance graph."
-  (loop for class in tree
-       as subclasses = (ebrowse-ts-subclasses class) do
-       ;; Make sure every class is represented by a unique object
-       (loop for subclass on subclasses
-             as sym = (intern
-                       (ebrowse-qualified-class-name (ebrowse-ts-class (car subclass)))
-                       classes)
-             as next = nil
-             do
-             ;; Replace the subclass tree with the one found in
-             ;; CLASSES if there is already an entry for that class
-             ;; in it. Otherwise make a new entry.
-             ;;
-             ;; CAVEAT: If by some means (e.g., use of the
-             ;; preprocessor in class declarations, a name is marked
-             ;; as a subclass of itself on some path, we would end up
-             ;; in an endless loop. We have to omit subclasses from
-             ;; the recursion that already have been processed.
-             (if (get sym 'ebrowse-root)
-                 (setf (car subclass) (get sym 'ebrowse-root))
-               (setf (get sym 'ebrowse-root) (car subclass))))
-       ;; Process subclasses
-       (ebrowse-insert-supers subclasses classes)))
+  (cl-loop for class in tree
+           as subclasses = (ebrowse-ts-subclasses class) do
+           ;; Make sure every class is represented by a unique object
+           (cl-loop for subclass on subclasses
+                    as sym = (intern
+                              (ebrowse-qualified-class-name
+                               (ebrowse-ts-class (car subclass)))
+                              classes)
+                    as next = nil
+                    do
+                    ;; Replace the subclass tree with the one found in
+                    ;; CLASSES if there is already an entry for that class
+                    ;; in it. Otherwise make a new entry.
+                    ;;
+                    ;; CAVEAT: If by some means (e.g., use of the
+                    ;; preprocessor in class declarations, a name is marked
+                    ;; as a subclass of itself on some path, we would end up
+                    ;; in an endless loop. We have to omit subclasses from
+                    ;; the recursion that already have been processed.
+                    (if (get sym 'ebrowse-root)
+                        (setf (car subclass) (get sym 'ebrowse-root))
+                      (setf (get sym 'ebrowse-root) (car subclass))))
+           ;; Process subclasses
+           (ebrowse-insert-supers subclasses classes)))
 
 \f
 ;;; Tree buffers
@@ -1131,7 +1098,7 @@ Tree mode key bindings:
 
     (unless (zerop (buffer-size))
       (goto-char (point-min))
-      (multiple-value-setq (header tree) (values-list (ebrowse-read)))
+      (cl-multiple-value-setq (header tree) (cl-values-list (ebrowse-read)))
       (message "Sorting. Please be patient...")
       (setq tree (ebrowse-sort-tree-list tree))
       (erase-buffer)
@@ -1219,32 +1186,32 @@ If given a numeric N-TIMES argument, mark that many classes."
     ;; Get the classes whose mark must be toggled. Note that
     ;; ebrowse-tree-at-point might issue an error.
     (ignore-errors
-      (loop repeat (or n-times 1)
-           as tree = (ebrowse-tree-at-point)
-           do (progn
-                (setf (ebrowse-ts-mark tree) (not (ebrowse-ts-mark tree)))
-                (forward-line 1)
-                (push tree to-change))))
+      (cl-loop repeat (or n-times 1)
+               as tree = (ebrowse-tree-at-point)
+               do (progn
+                    (setf (ebrowse-ts-mark tree) (not (ebrowse-ts-mark tree)))
+                    (forward-line 1)
+                    (push tree to-change))))
     (save-excursion
       ;; For all these classes, reverse the mark char in the display
       ;; by a regexp replace over the whole buffer. The reason for this
       ;; is that classes might have multiple base classes. If this is
       ;; the case, they are displayed more than once in the tree.
       (ebrowse-output
-       (loop for tree in to-change
-             as regexp = (concat "^.*\\b"
-                                 (regexp-quote
-                                  (ebrowse-cs-name (ebrowse-ts-class tree)))
-                                 "\\b")
-             do
-             (goto-char (point-min))
-             (loop while (re-search-forward regexp nil t)
-                   do (progn
-                        (goto-char (match-beginning 0))
-                        (delete-char 1)
-                        (insert-char (if (ebrowse-ts-mark tree) ?> ? ) 1)
-                        (ebrowse-set-mark-props (1- (point)) (point) tree)
-                        (goto-char (match-end 0)))))))))
+       (cl-loop
+         for tree in to-change
+         as regexp = (concat "^.*\\b"
+                             (regexp-quote
+                              (ebrowse-cs-name (ebrowse-ts-class tree)))
+                             "\\b")
+         do
+         (goto-char (point-min))
+         (while (re-search-forward regexp nil t)
+           (goto-char (match-beginning 0))
+           (delete-char 1)
+           (insert-char (if (ebrowse-ts-mark tree) ?> ? ) 1)
+           (ebrowse-set-mark-props (1- (point)) (point) tree)
+           (goto-char (match-end 0))))))))
 
 
 (defun ebrowse-mark-all-classes (prefix)
@@ -1365,7 +1332,7 @@ one buffer.  Prefer tree buffers over member buffers."
        (set (make-hash-table))
        result)
     (dolist (buffer buffers)
-      (let ((tree (ebrowse-value-in-buffer 'ebrowse--tree buffer)))
+      (let ((tree (buffer-local-value 'ebrowse--tree buffer)))
        (unless (gethash tree set)
          (push buffer result))
        (puthash tree t set)))
@@ -1376,7 +1343,7 @@ one buffer.  Prefer tree buffers over member buffers."
   "Return a list of members buffers with same tree as current buffer."
   (ebrowse-delete-if-not
    (lambda (buffer)
-     (eq (ebrowse-value-in-buffer 'ebrowse--tree buffer)
+     (eq (buffer-local-value 'ebrowse--tree buffer)
         ebrowse--tree))
    (ebrowse-member-buffer-list)))
 
@@ -1387,7 +1354,7 @@ one buffer.  Prefer tree buffers over member buffers."
 Switch to buffer if prefix ARG.
 If no member buffer exists, make one."
   (interactive "P")
-  (let ((buf (or (first (ebrowse-same-tree-member-buffer-list))
+  (let ((buf (or (cl-first (ebrowse-same-tree-member-buffer-list))
                 (get-buffer ebrowse-member-buffer-name)
                 (ebrowse-tree-command:show-member-functions))))
     (when buf
@@ -1411,9 +1378,9 @@ If no member buffer exists, make one."
 
 (defun ebrowse-kill-member-buffers-displaying (tree)
   "Kill all member buffers displaying TREE."
-  (loop for buffer in (ebrowse-member-buffer-list)
-       as class = (ebrowse-value-in-buffer 'ebrowse--displayed-class buffer)
-       when (eq class tree) do (kill-buffer buffer)))
+  (cl-loop for buffer in (ebrowse-member-buffer-list)
+           as class = (buffer-local-value 'ebrowse--displayed-class buffer)
+           when (eq class tree) do (kill-buffer buffer)))
 
 
 (defun ebrowse-frozen-tree-buffer-name (tags-file)
@@ -1449,7 +1416,7 @@ Pop to member buffer if no prefix ARG, to tree buffer otherwise."
                                           (int-to-string ebrowse--indentation)
                                           "): ")
                                   nil nil ebrowse--indentation))))
-    (when (plusp width)
+    (when (cl-plusp width)
       (set (make-local-variable 'ebrowse--indentation) width)
       (ebrowse-redraw-tree))))
 
@@ -1524,7 +1491,7 @@ Read a class name from the minibuffer if CLASS is nil."
       (error "Not on a class")))
 
 
-(defun* ebrowse-view/find-class-declaration (&key view where)
+(cl-defun ebrowse-view/find-class-declaration (&key view where)
   "View or find the declarator of the class point is on.
 VIEW non-nil means view it.  WHERE is additional position info."
   (let* ((class (ebrowse-ts-class (ebrowse-tree-at-point)))
@@ -1603,9 +1570,9 @@ and possibly kill the viewed buffer."
            exit-action ebrowse--view-exit-action))
     ;; Delete the frame in which we viewed.
     (mapc 'delete-frame
-         (loop for frame in (frame-list)
-            when (not (assq frame original-frame-configuration))
-            collect frame))
+         (cl-loop for frame in (frame-list)
+                   when (not (assq frame original-frame-configuration))
+                   collect frame))
     (when exit-action
       (funcall exit-action buffer))))
 
@@ -1659,15 +1626,15 @@ specifies where to find/view the result."
         (unless (boundp 'view-mode-hook)
           (setq view-mode-hook nil))
         (push 'ebrowse-find-pattern view-mode-hook)
-        (case where
-          (other-window (view-file-other-window file))
-          (other-frame  (ebrowse-view-file-other-frame file))
-          (t            (view-file file))))
+        (pcase where
+          (`other-window (view-file-other-window file))
+          (`other-frame  (ebrowse-view-file-other-frame file))
+          (            (view-file file))))
        (t
-        (case where
-          (other-window (find-file-other-window file))
-          (other-frame  (find-file-other-frame file))
-          (t            (find-file file)))
+        (pcase where
+          (`other-window (find-file-other-window file))
+          (`other-frame  (find-file-other-frame file))
+          (            (find-file file)))
         (ebrowse-find-pattern struc info))))
 
 
@@ -1677,14 +1644,14 @@ This is `regexp-quote' for most symbols, except for operator names
 which may contain whitespace.  For these symbols, replace white
 space in the symbol name (generated by BROWSE) with a regular
 expression matching any number of whitespace characters."
-  (loop with regexp = (regexp-quote name)
-       with start = 0
-       finally return regexp
-       while (string-match "[ \t]+" regexp start)
-       do (setq regexp (concat (substring regexp 0 (match-beginning 0))
-                               "[ \t]*"
-                               (substring regexp (match-end 0)))
-                start (+ (match-beginning 0) 5))))
+  (cl-loop with regexp = (regexp-quote name)
+           with start = 0
+           finally return regexp
+           while (string-match "[ \t]+" regexp start)
+           do (setq regexp (concat (substring regexp 0 (match-beginning 0))
+                                   "[ \t]*"
+                                   (substring regexp (match-end 0)))
+                    start (+ (match-beginning 0) 5))))
 
 
 (defun ebrowse-class-declaration-regexp (name)
@@ -1712,7 +1679,7 @@ expression matching any number of whitespace characters."
   (concat "^[ \t]*#[ \t]*define[ \t]+" (regexp-quote name)))
 
 
-(defun* ebrowse-find-pattern (&optional position info &aux viewing)
+(cl-defun ebrowse-find-pattern (&optional position info &aux viewing)
   "Find a pattern.
 
 This is a kluge: Ebrowse allows you to find or view a file containing
@@ -1731,25 +1698,26 @@ INFO is a list (TREE-HEADER TREE-OR-MEMBER MEMBER-LIST)."
         (start (ebrowse-bs-point position))
         (offset 100)
         found)
-    (destructuring-bind (header class-or-member member-list) info
+    (pcase-let ((`(,header ,class-or-member ,member-list) info))
       ;; If no pattern is specified, construct one from the member name.
       (when (stringp pattern)
        (setq pattern (concat "^.*" (regexp-quote pattern))))
       ;; Construct a regular expression if none given.
       (unless pattern
-       (typecase class-or-member
+       (cl-typecase class-or-member
          (ebrowse-ms
-          (case member-list
-            ((ebrowse-ts-member-variables
-              ebrowse-ts-static-variables
-              ebrowse-ts-types)
-             (setf pattern (ebrowse-variable-declaration-regexp
-                            (ebrowse-bs-name position))))
-            (otherwise
-             (if (ebrowse-define-p class-or-member)
-                 (setf pattern (ebrowse-pp-define-regexp (ebrowse-bs-name position)))
-               (setf pattern (ebrowse-function-declaration/definition-regexp
-                              (ebrowse-bs-name position)))))))
+           (setf pattern
+                 (pcase member-list
+                   ((or `ebrowse-ts-member-variables
+                        `ebrowse-ts-static-variables
+                        `ebrowse-ts-types)
+                    (ebrowse-variable-declaration-regexp
+                     (ebrowse-bs-name position)))
+                   (_
+                    (if (ebrowse-define-p class-or-member)
+                        (ebrowse-pp-define-regexp (ebrowse-bs-name position))
+                      (ebrowse-function-declaration/definition-regexp
+                       (ebrowse-bs-name position)))))))
          (ebrowse-cs
           (setf pattern (ebrowse-class-declaration-regexp
                          (ebrowse-bs-name position))))))
@@ -1763,10 +1731,11 @@ INFO is a list (TREE-HEADER TREE-OR-MEMBER MEMBER-LIST)."
        (y-or-n-p (format "start = %d? " start))
        (y-or-n-p pattern))
       (setf found
-           (loop do (goto-char (max (point-min) (- start offset)))
-                 when (re-search-forward pattern (+ start offset) t) return t
-                 never (bobp)
-                 do (incf offset offset)))
+           (cl-loop do (goto-char (max (point-min) (- start offset)))
+                     when (re-search-forward pattern (+ start offset) t)
+                       return t
+                     never (bobp)
+                     do (cl-incf offset offset)))
       (cond (found
             (beginning-of-line)
             (run-hooks 'ebrowse-view/find-hook))
@@ -1810,57 +1779,57 @@ TREE denotes the class shown."
   (ebrowse-set-face start end 'ebrowse-tree-mark))
 
 
-(defun* ebrowse-draw-tree-fn (&aux stack1 stack2 start)
+(cl-defun ebrowse-draw-tree-fn (&aux stack1 stack2 start)
   "Display a single class and recursively its subclasses.
 This function may look weird, but this is faster than recursion."
   (setq stack1 (make-list (length ebrowse--tree) 0)
        stack2 (copy-sequence ebrowse--tree))
-  (loop while stack2
-       as level = (pop stack1)
-       as tree = (pop stack2)
-       as class = (ebrowse-ts-class tree) do
-       (let ((start-of-line (point))
-             start-of-class-name end-of-class-name)
-         ;; Insert mark
-         (insert (if (ebrowse-ts-mark tree) ">" " "))
-
-         ;; Indent and insert class name
-         (indent-to (+ (* level ebrowse--indentation)
-                       ebrowse-tree-left-margin))
-         (setq start (point))
-         (insert (ebrowse-qualified-class-name class))
-
-         ;; If template class, add <>
-         (when (ebrowse-template-p class)
-           (insert "<>"))
-         (ebrowse-set-face start (point) (if (zerop level)
-                                             'ebrowse-root-class
-                                           'ebrowse-default))
-         (setf start-of-class-name start
-               end-of-class-name (point))
-         ;; If filenames are to be displayed...
-         (when ebrowse--show-file-names-flag
-           (indent-to ebrowse-source-file-column)
-           (setq start (point))
-           (insert "("
-                   (or (ebrowse-cs-file class)
-                       "unknown")
-                   ")")
-           (ebrowse-set-face start (point) 'ebrowse-file-name))
-         (ebrowse-set-mark-props start-of-line (1+ start-of-line) tree)
-         (add-text-properties
-          start-of-class-name end-of-class-name
-          `(mouse-face highlight ebrowse-what class-name
-                       ebrowse-tree ,tree
-                       help-echo "double-mouse-1: (un)expand tree; mouse-2: member functions, mouse-3: menu"))
-         (insert "\n"))
-       ;; Push subclasses, if any.
-       (when (ebrowse-ts-subclasses tree)
-         (setq stack2
-               (nconc (copy-sequence (ebrowse-ts-subclasses tree)) stack2)
-               stack1
-               (nconc (make-list (length (ebrowse-ts-subclasses tree))
-                                 (1+ level)) stack1)))))
+  (cl-loop while stack2
+           as level = (pop stack1)
+           as tree = (pop stack2)
+           as class = (ebrowse-ts-class tree) do
+           (let ((start-of-line (point))
+                 start-of-class-name end-of-class-name)
+             ;; Insert mark
+             (insert (if (ebrowse-ts-mark tree) ">" " "))
+
+             ;; Indent and insert class name
+             (indent-to (+ (* level ebrowse--indentation)
+                           ebrowse-tree-left-margin))
+             (setq start (point))
+             (insert (ebrowse-qualified-class-name class))
+
+             ;; If template class, add <>
+             (when (ebrowse-template-p class)
+               (insert "<>"))
+             (ebrowse-set-face start (point) (if (zerop level)
+                                                 'ebrowse-root-class
+                                               'ebrowse-default))
+             (setf start-of-class-name start
+                   end-of-class-name (point))
+             ;; If filenames are to be displayed...
+             (when ebrowse--show-file-names-flag
+               (indent-to ebrowse-source-file-column)
+               (setq start (point))
+               (insert "("
+                       (or (ebrowse-cs-file class)
+                           "unknown")
+                       ")")
+               (ebrowse-set-face start (point) 'ebrowse-file-name))
+             (ebrowse-set-mark-props start-of-line (1+ start-of-line) tree)
+             (add-text-properties
+              start-of-class-name end-of-class-name
+              `(mouse-face highlight ebrowse-what class-name
+                           ebrowse-tree ,tree
+                           help-echo "double-mouse-1: (un)expand tree; mouse-2: member functions, mouse-3: menu"))
+             (insert "\n"))
+           ;; Push subclasses, if any.
+           (when (ebrowse-ts-subclasses tree)
+             (setq stack2
+                   (nconc (copy-sequence (ebrowse-ts-subclasses tree)) stack2)
+                   stack1
+                   (nconc (make-list (length (ebrowse-ts-subclasses tree))
+                                     (1+ level)) stack1)))))
 
 
 \f
@@ -2116,8 +2085,8 @@ See 'Electric-command-loop' for a description of STATE and CONDITION."
   "Read a browser buffer name from the minibuffer and return that buffer."
   (let* ((buffers (ebrowse-known-class-trees-buffer-list)))
     (if buffers
-       (if (not (second buffers))
-           (first buffers)
+       (if (not (cl-second buffers))
+           (cl-first buffers)
          (or (ebrowse-electric-choose-tree) (error "No tree buffer")))
       (let* ((insert-default-directory t)
             (file (read-file-name "Find tree: " nil nil t)))
@@ -2303,7 +2272,7 @@ The new width is read from the minibuffer."
                                            ebrowse--decl-column
                                          ebrowse--column-width))
                         "): ")))))
-    (when (plusp width)
+    (when (cl-plusp width)
       (if ebrowse--long-display-flag
          (setq ebrowse--decl-column width)
        (setq ebrowse--column-width width))
@@ -2343,15 +2312,15 @@ make one."
   (let ((index (ebrowse-position ebrowse--accessor
                                 ebrowse-member-list-accessors)))
     (setf ebrowse--accessor
-         (cond ((plusp incr)
+         (cond ((cl-plusp incr)
                 (or (nth (1+ index)
                          ebrowse-member-list-accessors)
-                    (first ebrowse-member-list-accessors)))
-               ((minusp incr)
-                (or (and (>= (decf index) 0)
+                    (cl-first ebrowse-member-list-accessors)))
+               ((cl-minusp incr)
+                (or (and (>= (cl-decf index) 0)
                          (nth index
                               ebrowse-member-list-accessors))
-                    (first (last ebrowse-member-list-accessors))))))
+                    (cl-first (last ebrowse-member-list-accessors))))))
     (ebrowse-display-member-list-for-accessor ebrowse--accessor)))
 
 
@@ -2536,7 +2505,7 @@ find file in another frame."
   (ebrowse-view/find-member-declaration/definition prefix t))
 
 
-(defun* ebrowse-view/find-member-declaration/definition
+(cl-defun ebrowse-view/find-member-declaration/definition
     (prefix view &optional definition info header tags-file)
   "Find or view a member declaration or definition.
 With PREFIX 4. find file in another window, with prefix 5
@@ -2556,15 +2525,15 @@ TAGS-FILE is the file name of the BROWSE file."
     ;; If not given as parameters, get the necessary information
     ;; out of the member buffer.
     (if info
-       (setq tree (first info)
-             accessor (second info)
-             member (third info))
-      (multiple-value-setq (tree member on-class)
-       (values-list (ebrowse-member-info-from-point)))
+       (setq tree (cl-first info)
+             accessor (cl-second info)
+             member (cl-third info))
+      (cl-multiple-value-setq (tree member on-class)
+       (cl-values-list (ebrowse-member-info-from-point)))
       (setq accessor ebrowse--accessor))
     ;; View/find class if on a line containing a class name.
     (when on-class
-      (return-from ebrowse-view/find-member-declaration/definition
+      (cl-return-from ebrowse-view/find-member-declaration/definition
        (ebrowse-view/find-file-and-search-pattern
         (ebrowse-ts-class tree)
         (list ebrowse--header (ebrowse-ts-class tree) nil)
@@ -2822,11 +2791,11 @@ TREE is the class tree in which the members are found."
                          mouse-face highlight
                          ebrowse-tree ,tree
                          help-echo "mouse-2: view definition; mouse-3: menu"))
-         (incf i)
+         (cl-incf i)
          (when (>= i ebrowse--n-columns)
            (setf i 0)
            (insert "\n")))))
-    (when (plusp i)
+    (when (cl-plusp i)
       (insert "\n"))
     (goto-char (point-min))))
 
@@ -2904,7 +2873,7 @@ REPEAT, if specified, says repeat the search REPEAT times."
       (error "Not found"))))
 
 
-(defun* ebrowse-move-point-to-member (name &optional count &aux member)
+(cl-defun ebrowse-move-point-to-member (name &optional count &aux member)
   "Set point on member NAME in the member buffer
 COUNT, if specified, says search the COUNT'th member with the same name."
   (goto-char (point-min))
@@ -2925,8 +2894,8 @@ COUNT, if specified, says search the COUNT'th member with the same name."
   "Switch member buffer to a class read from the minibuffer.
 Use TITLE as minibuffer prompt.
 COMPL-LIST is a completion list to use."
-  (let* ((initial (unless (second compl-list)
-                   (first (first compl-list))))
+  (let* ((initial (unless (cl-second compl-list)
+                   (cl-first (cl-first compl-list))))
         (class (or (ebrowse-completing-read-value title compl-list initial)
                    (error "Not found"))))
     (setf ebrowse--displayed-class class
@@ -2946,14 +2915,14 @@ COMPL-LIST is a completion list to use."
   (interactive "P")
   (let ((supers (or (ebrowse-direct-base-classes ebrowse--displayed-class)
                    (error "No base classes"))))
-    (if (and arg (second supers))
-       (let ((alist (loop for s in supers
-                          collect (cons (ebrowse-qualified-class-name
-                                         (ebrowse-ts-class s))
-                                        s))))
+    (if (and arg (cl-second supers))
+       (let ((alist (cl-loop for s in supers
+                              collect (cons (ebrowse-qualified-class-name
+                                             (ebrowse-ts-class s))
+                                            s))))
          (ebrowse-switch-member-buffer-to-other-class
           "Goto base class: " alist))
-      (setq ebrowse--displayed-class (first supers)
+      (setq ebrowse--displayed-class (cl-first supers)
            ebrowse--member-list
            (funcall ebrowse--accessor ebrowse--displayed-class))
       (ebrowse-redisplay-member-buffer))))
@@ -2977,21 +2946,22 @@ Prefix arg INC specifies which one."
   (let ((containing-list ebrowse--tree)
        index cls
        (supers (ebrowse-direct-base-classes ebrowse--displayed-class)))
-    (flet ((trees-alist (trees)
-                       (loop for tr in trees
-                             collect (cons (ebrowse-cs-name
-                                            (ebrowse-ts-class tr)) tr))))
+    (cl-flet ((trees-alist (trees)
+                           (cl-loop for tr in trees
+                                    collect (cons (ebrowse-cs-name
+                                                   (ebrowse-ts-class tr))
+                                                  tr))))
       (when supers
-       (let ((tree (if (second supers)
+       (let ((tree (if (cl-second supers)
                        (ebrowse-completing-read-value
                         "Relative to base class: "
                         (trees-alist supers) nil)
-                     (first supers))))
+                     (cl-first supers))))
          (unless tree (error "Not found"))
          (setq containing-list (ebrowse-ts-subclasses tree)))))
     (setq index (+ inc (ebrowse-position ebrowse--displayed-class
                                         containing-list)))
-    (cond ((minusp index) (message "No previous class"))
+    (cond ((cl-minusp index) (message "No previous class"))
          ((null (nth index containing-list)) (message "No next class")))
     (setq index (max 0 (min index (1- (length containing-list)))))
     (setq cls (nth index containing-list))
@@ -3005,17 +2975,17 @@ Prefix arg INC specifies which one."
 Prefix arg ARG says which class should be displayed.  Default is
 the first derived class."
   (interactive "P")
-  (flet ((ebrowse-tree-obarray-as-alist ()
-                                       (loop for s in (ebrowse-ts-subclasses
-                                                       ebrowse--displayed-class)
-                                             collect (cons (ebrowse-cs-name
-                                                            (ebrowse-ts-class s)) s))))
+  (cl-flet ((ebrowse-tree-obarray-as-alist ()
+               (cl-loop for s in (ebrowse-ts-subclasses
+                                  ebrowse--displayed-class)
+                        collect (cons (ebrowse-cs-name
+                                       (ebrowse-ts-class s)) s))))
     (let ((subs (or (ebrowse-ts-subclasses ebrowse--displayed-class)
                    (error "No derived classes"))))
-      (if (and arg (second subs))
+      (if (and arg (cl-second subs))
          (ebrowse-switch-member-buffer-to-other-class
           "Goto derived class: " (ebrowse-tree-obarray-as-alist))
-       (setq ebrowse--displayed-class (first subs)
+       (setq ebrowse--displayed-class (cl-first subs)
              ebrowse--member-list
              (funcall ebrowse--accessor ebrowse--displayed-class))
        (ebrowse-redisplay-member-buffer)))))
@@ -3211,15 +3181,15 @@ the first derived class."
 EVENT is the mouse event."
   (interactive "e")
   (mouse-set-point event)
-  (case (event-click-count event)
+  (pcase (event-click-count event)
     (2 (ebrowse-find-member-definition))
-    (1 (case (get-text-property (posn-point (event-start event))
-                               'ebrowse-what)
-        (member-name
+    (1 (pcase (get-text-property (posn-point (event-start event))
+                                 'ebrowse-what)
+        (`member-name
          (ebrowse-popup-menu ebrowse-member-name-object-menu event))
-        (class-name
+        (`class-name
          (ebrowse-popup-menu ebrowse-member-class-name-object-menu event))
-        (t
+        (_
          (ebrowse-popup-menu ebrowse-member-buffer-object-menu event))))))
 
 
@@ -3228,11 +3198,11 @@ EVENT is the mouse event."
 EVENT is the mouse event."
   (interactive "e")
   (mouse-set-point event)
-  (case (event-click-count event)
+  (pcase (event-click-count event)
     (2 (ebrowse-find-member-definition))
-    (1 (case (get-text-property (posn-point (event-start event))
+    (1 (pcase (get-text-property (posn-point (event-start event))
                                'ebrowse-what)
-        (member-name
+        (`member-name
          (ebrowse-view-member-definition 0))))))
 
 
@@ -3253,11 +3223,11 @@ member was found.  The CDR of the acons is described in function
        alist)
     (when name
       (dolist (info (gethash name table) alist)
-       (unless (memq (first info) known-classes)
-         (setf alist (acons (ebrowse-qualified-class-name
-                             (ebrowse-ts-class (first info)))
-                            info alist)
-               known-classes (cons (first info) known-classes)))))))
+       (unless (memq (cl-first info) known-classes)
+         (setf alist (cl-acons (ebrowse-qualified-class-name
+                                 (ebrowse-ts-class (cl-first info)))
+                                info alist)
+               known-classes (cons (cl-first info) known-classes)))))))
 
 
 (defun ebrowse-choose-tree ()
@@ -3267,8 +3237,8 @@ the one he wants.  Value is (TREE HEADER BUFFER), with TREE being
 the class tree, HEADER the header structure of the tree, and BUFFER
 being the tree or member buffer containing the tree."
   (let* ((buffer (ebrowse-choose-from-browser-buffers)))
-    (if buffer (list (ebrowse-value-in-buffer 'ebrowse--tree buffer)
-                    (ebrowse-value-in-buffer 'ebrowse--header buffer)
+    (if buffer (list (buffer-local-value 'ebrowse--tree buffer)
+                    (buffer-local-value 'ebrowse--header buffer)
                     buffer))))
 
 
@@ -3279,8 +3249,8 @@ Prompt with PROMPT.  Insert into the minibuffer a C++ identifier read
 from point as default.  Value is a list (CLASS-NAME MEMBER-NAME)."
   (save-excursion
     (let ((members (ebrowse-member-table header)))
-      (multiple-value-bind (class-name member-name)
-         (values-list (ebrowse-tags-read-member+class-name))
+      (cl-multiple-value-bind (class-name member-name)
+         (cl-values-list (ebrowse-tags-read-member+class-name))
        (unless member-name
          (error "No member name at point"))
        (if members
@@ -3292,7 +3262,7 @@ from point as default.  Value is a list (CLASS-NAME MEMBER-NAME)."
              (unless (gethash name members)
                (if (y-or-n-p "No exact match found.  Try substrings? ")
                    (setq name
-                         (or (first (ebrowse-list-of-matching-members
+                         (or (cl-first (ebrowse-list-of-matching-members
                                      members (regexp-quote name) name))
                              (error "Sorry, nothing found")))
                  (error "Canceled")))
@@ -3325,15 +3295,15 @@ Value is a list (TREE ACCESSOR MEMBER) for the member."
   (let ((alist (or (ebrowse-class-alist-for-member header name)
                   (error "No classes with member `%s' found" name))))
     (ebrowse-ignoring-completion-case
-      (if (null (second alist))
-         (cdr (first alist))
+      (if (null (cl-second alist))
+         (cdr (cl-first alist))
        (push ?\? unread-command-events)
        (cdr (assoc (completing-read "In class: "
                                     alist nil t initial-class-name)
                    alist))))))
 
 
-(defun* ebrowse-tags-view/find-member-decl/defn
+(cl-defun ebrowse-tags-view/find-member-decl/defn
     (prefix &key view definition member-name)
   "If VIEW is t, view, else find an occurrence of MEMBER-NAME.
 
@@ -3344,16 +3314,16 @@ of all classes containing a member with the given name and lets
 the user choose the class to use.  As a last step, a tags search
 is performed that positions point on the member declaration or
 definition."
-  (multiple-value-bind
-      (tree header tree-buffer) (values-list (ebrowse-choose-tree))
+  (cl-multiple-value-bind
+      (tree header tree-buffer) (cl-values-list (ebrowse-choose-tree))
     (unless tree (error "No class tree"))
     (let* ((marker (point-marker))
           class-name
           (name member-name)
           info)
       (unless name
-       (multiple-value-setq (class-name name)
-         (values-list
+       (cl-multiple-value-setq (class-name name)
+         (cl-values-list
           (ebrowse-tags-read-name
            header
            (concat (if view "View" "Find") " member "
@@ -3364,7 +3334,7 @@ definition."
       (ebrowse-view/find-member-declaration/definition
        prefix view definition info
        header
-       (ebrowse-value-in-buffer 'ebrowse--tags-file-name tree-buffer))
+       (buffer-local-value 'ebrowse--tags-file-name tree-buffer))
       ;; Record position jumped to
       (ebrowse-push-position (point-marker) info t))))
 
@@ -3459,14 +3429,14 @@ It is a list (TREE ACCESSOR MEMBER)."
     (cond ((null buffer)
           (set-buffer tree-buffer)
           (switch-to-buffer (ebrowse-display-member-buffer
-                             (second info) nil (first info))))
+                             (cl-second info) nil (cl-first info))))
          (t
           (switch-to-buffer buffer)
-          (setq ebrowse--displayed-class (first info)
-                ebrowse--accessor (second info)
+          (setq ebrowse--displayed-class (cl-first info)
+                ebrowse--accessor (cl-second info)
                 ebrowse--member-list (funcall ebrowse--accessor ebrowse--displayed-class))
           (ebrowse-redisplay-member-buffer)))
-    (ebrowse-move-point-to-member (ebrowse-ms-name (third info)))))
+    (ebrowse-move-point-to-member (ebrowse-ms-name (cl-third info)))))
 
 
 (defun ebrowse-tags-display-member-buffer (&optional fix-name)
@@ -3474,13 +3444,13 @@ It is a list (TREE ACCESSOR MEMBER)."
 FIX-NAME non-nil means display the buffer for that member.
 Otherwise read a member name from point."
   (interactive)
-  (multiple-value-bind
-      (tree header tree-buffer) (values-list (ebrowse-choose-tree))
+  (cl-multiple-value-bind
+      (tree header tree-buffer) (cl-values-list (ebrowse-choose-tree))
     (unless tree (error "No class tree"))
     (let* ((marker (point-marker)) class-name (name fix-name) info)
       (unless name
-       (multiple-value-setq (class-name name)
-         (values-list
+       (cl-multiple-value-setq (class-name name)
+         (cl-values-list
           (ebrowse-tags-read-name header
                                   (concat "Find member list of: ")))))
       (setq info (ebrowse-tags-choose-class tree header name class-name))
@@ -3507,7 +3477,7 @@ are not performed."
   (interactive)
   (let* ((buffer (or (ebrowse-choose-from-browser-buffers)
                     (error "No tree buffer")))
-        (header (ebrowse-value-in-buffer 'ebrowse--header buffer))
+        (header (buffer-local-value 'ebrowse--header buffer))
         (members (ebrowse-member-table header))
         temp-buffer-setup-hook
         (regexp (read-from-minibuffer "List members matching regexp: ")))
@@ -3515,9 +3485,9 @@ are not performed."
       (set-buffer standard-output)
       (erase-buffer)
       (insert "Members matching `" regexp "'\n\n")
-      (loop for s in (ebrowse-list-of-matching-members members regexp) do
-           (loop for info in (gethash s members) do
-                 (ebrowse-draw-file-member-info info))))))
+      (cl-loop for s in (ebrowse-list-of-matching-members members regexp) do
+               (cl-loop for info in (gethash s members) do
+                        (ebrowse-draw-file-member-info info))))))
 
 
 (defun ebrowse-tags-list-members-in-file ()
@@ -3528,50 +3498,50 @@ The file name is read from the minibuffer."
                     (error "No tree buffer")))
         (files (with-current-buffer buffer (ebrowse-files-table)))
         (file (completing-read "List members in file: " files nil t))
-        (header (ebrowse-value-in-buffer 'ebrowse--header buffer))
+        (header (buffer-local-value 'ebrowse--header buffer))
         temp-buffer-setup-hook
         (members (ebrowse-member-table header)))
     (with-output-to-temp-buffer (concat "*Members in file " file "*")
       (set-buffer standard-output)
       (maphash
        (lambda (_member-name list)
-        (loop for info in list
-              as member = (third info)
-              as class = (ebrowse-ts-class (first info))
-               when (or (and (null (ebrowse-ms-file member))
-                             (string= (ebrowse-cs-file class) file))
-                        (string= file (ebrowse-ms-file member)))
-             do (ebrowse-draw-file-member-info info "decl.")
-             when (or (and (null (ebrowse-ms-definition-file member))
-                           (string= (ebrowse-cs-source-file class) file))
-                      (string= file (ebrowse-ms-definition-file member)))
-             do (ebrowse-draw-file-member-info info "defn.")))
+        (cl-loop for info in list
+                  as member = (cl-third info)
+                  as class = (ebrowse-ts-class (cl-first info))
+                  when (or (and (null (ebrowse-ms-file member))
+                                (string= (ebrowse-cs-file class) file))
+                           (string= file (ebrowse-ms-file member)))
+                  do (ebrowse-draw-file-member-info info "decl.")
+                  when (or (and (null (ebrowse-ms-definition-file member))
+                                (string= (ebrowse-cs-source-file class) file))
+                           (string= file (ebrowse-ms-definition-file member)))
+                  do (ebrowse-draw-file-member-info info "defn.")))
        members))))
 
 
-(defun* ebrowse-draw-file-member-info (info &optional (kind ""))
+(cl-defun ebrowse-draw-file-member-info (info &optional (kind ""))
   "Display a line in the members info buffer.
 INFO describes the member.  It has the form (TREE ACCESSOR MEMBER).
 TREE is the class of the member to display.
 ACCESSOR is the accessor symbol of its member list.
 MEMBER is the member structure.
 KIND is an additional string printed in the buffer."
-  (let* ((tree (first info))
+  (let* ((tree (cl-first info))
         (globals-p (ebrowse-globals-tree-p tree)))
     (unless globals-p
       (insert (ebrowse-cs-name (ebrowse-ts-class tree))))
-    (insert "::" (ebrowse-ms-name (third info)))
+    (insert "::" (ebrowse-ms-name (cl-third info)))
     (indent-to 40)
     (insert kind)
     (indent-to 50)
-    (insert (case (second info)
-             (ebrowse-ts-member-functions "member function")
-             (ebrowse-ts-member-variables "member variable")
-             (ebrowse-ts-static-functions "static function")
-             (ebrowse-ts-static-variables "static variable")
-             (ebrowse-ts-friends (if globals-p "define" "friend"))
-             (ebrowse-ts-types "type")
-             (t "unknown"))
+    (insert (pcase (cl-second info)
+             (`ebrowse-ts-member-functions "member function")
+             (`ebrowse-ts-member-variables "member variable")
+             (`ebrowse-ts-static-functions "static function")
+             (`ebrowse-ts-static-variables "static variable")
+             (`ebrowse-ts-friends (if globals-p "define" "friend"))
+             (`ebrowse-ts-types "type")
+             (_ "unknown"))
            "\n")))
 
 (defvar ebrowse-last-completion nil
@@ -3602,11 +3572,11 @@ KIND is an additional string printed in the buffer."
 If there's only one tree loaded, use that.  Otherwise let the
 use choose a tree."
   (let* ((buffers (ebrowse-known-class-trees-buffer-list))
-        (buffer (cond ((and (first buffers) (not (second buffers)))
-                       (first buffers))
+        (buffer (cond ((and (cl-first buffers) (not (cl-second buffers)))
+                       (cl-first buffers))
                       (t (or (ebrowse-electric-choose-tree)
                              (error "No tree buffer")))))
-        (header (ebrowse-value-in-buffer 'ebrowse--header buffer)))
+        (header (buffer-local-value 'ebrowse--header buffer)))
     (ebrowse-member-table header)))
 
 
@@ -3614,13 +3584,13 @@ use choose a tree."
   "Return the item following STRING in LIST.
 If STRING is the last element, return the first element as successor."
   (or (nth (1+ (ebrowse-position string list 'string=)) list)
-      (first list)))
+      (cl-first list)))
 
 \f
 ;;; Symbol completion
 
 ;;;###autoload
-(defun* ebrowse-tags-complete-symbol (prefix)
+(cl-defun ebrowse-tags-complete-symbol (prefix)
   "Perform completion on the C++ symbol preceding point.
 A second call of this function without changing point inserts the next match.
 A call with prefix PREFIX reads the symbol to insert from the minibuffer with
@@ -3660,7 +3630,7 @@ completion."
      ;; buffer: Start new completion.
      (t
       (let* ((members (ebrowse-some-member-table))
-            (completion (first (all-completions pattern members nil))))
+            (completion (cl-first (all-completions pattern members nil))))
        (cond ((eq completion t))
              ((null completion)
               (error "Can't find completion for `%s'" pattern))
@@ -3786,15 +3756,15 @@ Searches in all files mentioned in a class tree for something that
 looks like a function call to the member."
   (interactive)
   ;; Choose the tree to use if there is more than one.
-  (multiple-value-bind (tree header tree-buffer)
-      (values-list (ebrowse-choose-tree))
+  (cl-multiple-value-bind (tree header tree-buffer)
+      (cl-values-list (ebrowse-choose-tree))
     (unless tree
       (error "No class tree"))
     ;; Get the member name NAME (class-name is ignored).
     (let ((name fix-name) class-name regexp)
       (unless name
-       (multiple-value-setq (class-name name)
-         (values-list (ebrowse-tags-read-name header "Find calls of: "))))
+       (cl-multiple-value-setq (class-name name)
+         (cl-values-list (ebrowse-tags-read-name header "Find calls of: "))))
       ;; Set tags loop form to search for member and begin loop.
       (setq regexp (concat "\\<" name "[ \t]*(")
            ebrowse-tags-loop-form (list 're-search-forward regexp nil t))
@@ -3806,7 +3776,7 @@ looks like a function call to the member."
 
 ;;; Structures of this kind are the elements of the position stack.
 
-(defstruct (ebrowse-position (:type vector) :named)
+(cl-defstruct (ebrowse-position (:type vector) :named)
   file-name                            ; in which file
   point                                        ; point in file
   target                               ; t if target of a jump
@@ -3826,8 +3796,8 @@ looks like a function call to the member."
 The string is printed in the electric position list buffer."
   (let ((info (ebrowse-position-info position)))
     (concat (if (ebrowse-position-target position) "at " "to ")
-           (ebrowse-cs-name (ebrowse-ts-class (first info)))
-           "::" (ebrowse-ms-name (third info)))))
+           (ebrowse-cs-name (ebrowse-ts-class (cl-first info)))
+           "::" (ebrowse-ms-name (cl-third info)))))
 
 
 (defun ebrowse-view/find-position (position &optional view)
@@ -3857,7 +3827,7 @@ Positions in buffers that have no file names are not saved."
     (let ((too-much (- (length ebrowse-position-stack)
                       ebrowse-max-positions)))
       ;; Do not let the stack grow to infinity.
-      (when (plusp too-much)
+      (when (cl-plusp too-much)
        (setq ebrowse-position-stack
              (butlast ebrowse-position-stack too-much)))
       ;; Push the position.
@@ -4128,9 +4098,9 @@ Otherwise, FILE-NAME specifies the file to save the tree in."
   (let ((tree-file (buffer-file-name))
        temp-buffer-setup-hook)
     (with-output-to-temp-buffer "*Tree Statistics*"
-      (multiple-value-bind (classes member-functions member-variables
+      (cl-multiple-value-bind (classes member-functions member-variables
                                    static-functions static-variables)
-         (values-list (ebrowse-gather-statistics))
+         (cl-values-list (ebrowse-gather-statistics))
        (set-buffer standard-output)
        (erase-buffer)
        (insert "STATISTICS FOR TREE " (or tree-file "unknown") ":\n\n")
@@ -4162,11 +4132,11 @@ NUMBER-OF-STATIC-VARIABLES:"
   (let ((classes 0) (member-functions 0) (member-variables 0)
        (static-functions 0) (static-variables 0))
     (ebrowse-for-all-trees (tree ebrowse--tree-obarray)
-      (incf classes)
-      (incf member-functions (length (ebrowse-ts-member-functions tree)))
-      (incf member-variables (length (ebrowse-ts-member-variables tree)))
-      (incf static-functions (length (ebrowse-ts-static-functions tree)))
-      (incf static-variables (length (ebrowse-ts-static-variables tree))))
+      (cl-incf classes)
+      (cl-incf member-functions (length (ebrowse-ts-member-functions tree)))
+      (cl-incf member-variables (length (ebrowse-ts-member-variables tree)))
+      (cl-incf static-functions (length (ebrowse-ts-static-functions tree)))
+      (cl-incf static-variables (length (ebrowse-ts-static-variables tree))))
     (list classes member-functions member-variables
          static-functions static-variables)))
 
@@ -4178,7 +4148,7 @@ NUMBER-OF-STATIC-VARIABLES:"
 ;; prefix `\C-c\C-m' to browse commands.
 
 (defvar ebrowse-global-map nil
-  "*Keymap for Ebrowse commands.")
+  "Keymap for Ebrowse commands.")
 
 
 (defvar ebrowse-global-prefix-key "\C-c\C-m"
@@ -4410,12 +4380,12 @@ EVENT is the mouse event."
   (mouse-set-point event)
   (let* ((where (posn-point (event-start event)))
         (property (get-text-property where 'ebrowse-what)))
-    (case (event-click-count event)
+    (pcase (event-click-count event)
       (1
-       (case property
-        (class-name
+       (pcase property
+        (`class-name
          (ebrowse-popup-menu ebrowse-tree-buffer-class-object-menu event))
-        (t
+        (_
          (ebrowse-popup-menu ebrowse-tree-buffer-object-menu event)))))))
 
 
@@ -4426,9 +4396,9 @@ EVENT is the mouse event."
   (mouse-set-point event)
   (let* ((where (posn-point (event-start event)))
         (property (get-text-property where 'ebrowse-what)))
-    (case (event-click-count event)
-      (1 (case property
-          (class-name
+    (pcase (event-click-count event)
+      (1 (pcase property
+          (`class-name
            (ebrowse-tree-command:show-member-functions)))))))
 
 
@@ -4439,13 +4409,13 @@ EVENT is the mouse event."
   (mouse-set-point event)
   (let* ((where (posn-point (event-start event)))
         (property (get-text-property where 'ebrowse-what)))
-    (case (event-click-count event)
-      (2 (case property
-          (class-name
+    (pcase (event-click-count event)
+      (2 (pcase property
+          (`class-name
            (let ((collapsed (save-excursion (skip-chars-forward "^\r\n")
                                             (looking-at "\r"))))
              (ebrowse-collapse-fn (not collapsed))))
-          (mark
+          (`mark
            (ebrowse-toggle-mark-at-point 1)))))))
 
 
index 6bb86738df000b77010abc39f8a381c9d3e4dae1..071a0fb6037698a6181087548b6ae7a168139ecf 100644 (file)
@@ -1,4 +1,4 @@
-;;; etags.el --- etags facility for Emacs
+;;; etags.el --- etags facility for Emacs  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2012
 ;;   Free Software Foundation, Inc.
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
 (require 'ring)
 (require 'button)
 
 ;;;###autoload
 (defvar tags-file-name nil
-  "*File name of tags table.
+  "File name of tags table.
 To switch to a new tags table, setting this variable is sufficient.
 If you set this variable, do not also set `tags-table-list'.
 Use the `etags' program to make a tags table file.")
@@ -46,7 +44,7 @@ Use the `etags' program to make a tags table file.")
 
 ;;;###autoload
 (defcustom tags-case-fold-search 'default
-  "*Whether tags operations should be case-sensitive.
+  "Whether tags operations should be case-sensitive.
 A value of t means case-insensitive, a value of nil means case-sensitive.
 Any other value means use the setting of `case-fold-search'."
   :group 'etags
@@ -58,7 +56,7 @@ Any other value means use the setting of `case-fold-search'."
 ;;;###autoload
 ;; Use `visit-tags-table-buffer' to cycle through tags tables in this list.
 (defcustom tags-table-list nil
-  "*List of file names of tags tables to search.
+  "List of file names of tags tables to search.
 An element that is a directory means the file \"TAGS\" in that directory.
 To switch to a new list of tags tables, setting this variable is sufficient.
 If you set this variable, do not also set `tags-file-name'.
@@ -69,7 +67,7 @@ Use the `etags' program to make a tags table file."
 ;;;###autoload
 (defcustom tags-compression-info-list
   (purecopy '("" ".Z" ".bz2" ".gz" ".xz" ".tgz"))
-  "*List of extensions tried by etags when jka-compr is used.
+  "List of extensions tried by etags when jka-compr is used.
 An empty string means search the non-compressed file.
 These extensions will be tried only if jka-compr was activated
 \(i.e. via customize of `auto-compression-mode' or by calling the function
@@ -90,7 +88,7 @@ These extensions will be tried only if jka-compr was activated
 
 ;;;###autoload
 (defcustom tags-add-tables 'ask-user
-  "*Control whether to add a new tags table to the current list.
+  "Control whether to add a new tags table to the current list.
 t means do; nil means don't (always start a new list).
 Any other value means ask the user whether to add a new tags table
 to the current list (as opposed to starting a new list)."
@@ -100,7 +98,7 @@ to the current list (as opposed to starting a new list)."
                 (other :tag "Ask" ask-user)))
 
 (defcustom tags-revert-without-query nil
-  "*Non-nil means reread a TAGS table without querying, if it has changed."
+  "Non-nil means reread a TAGS table without querying, if it has changed."
   :group 'etags
   :type 'boolean)
 
@@ -131,7 +129,7 @@ Each element is a list of strings which are file names.")
 
 ;;;###autoload
 (defcustom find-tag-hook nil
-  "*Hook to be run by \\[find-tag] after finding a tag.  See `run-hooks'.
+  "Hook to be run by \\[find-tag] after finding a tag.  See `run-hooks'.
 The value in the buffer in which \\[find-tag] is done is used,
 not the value in the buffer \\[find-tag] goes to."
   :group 'etags
@@ -139,7 +137,7 @@ not the value in the buffer \\[find-tag] goes to."
 
 ;;;###autoload
 (defcustom find-tag-default-function nil
-  "*A function of no arguments used by \\[find-tag] to pick a default tag.
+  "A function of no arguments used by \\[find-tag] to pick a default tag.
 If nil, and the symbol that is the value of `major-mode'
 has a `find-tag-default-function' property (see `put'), that is used.
 Otherwise, `find-tag-default' is used."
@@ -147,13 +145,13 @@ Otherwise, `find-tag-default' is used."
   :type '(choice (const nil) function))
 
 (defcustom find-tag-marker-ring-length 16
-  "*Length of marker rings `find-tag-marker-ring' and `tags-location-ring'."
+  "Length of marker rings `find-tag-marker-ring' and `tags-location-ring'."
   :group 'etags
   :type 'integer
   :version "20.3")
 
 (defcustom tags-tag-face 'default
-  "*Face for tags in the output of `tags-apropos'."
+  "Face for tags in the output of `tags-apropos'."
   :group 'etags
   :type 'face
   :version "21.1")
@@ -554,11 +552,10 @@ Returns t if it visits a tags table, or nil if there are no more in the list."
   (cond ((eq cont 'same)
         ;; Use the ambient value of tags-file-name.
         (or tags-file-name
-            (error "%s"
-                   (substitute-command-keys
-                    (concat "No tags table in use; "
-                            "use \\[visit-tags-table] to select one")))))
-
+            (user-error "%s"
+                         (substitute-command-keys
+                          (concat "No tags table in use; "
+                                  "use \\[visit-tags-table] to select one")))))
        ((eq t cont)
         ;; Find the next table.
         (if (tags-next-table)
@@ -566,7 +563,6 @@ Returns t if it visits a tags table, or nil if there are no more in the list."
             (while (and (not (or (get-file-buffer tags-file-name)
                                  (file-exists-p tags-file-name)))
                         (tags-next-table)))))
-
        (t
         ;; Pick a table out of our hat.
         (tags-table-check-computed-list) ;Get it up to date, we might use it.
@@ -706,7 +702,8 @@ Returns t if it visits a tags table, or nil if there are no more in the list."
        (kill-local-variable 'tags-file-name)
        (if (eq local-tags-file-name tags-file-name)
            (setq tags-file-name nil))
-       (error "File %s is not a valid tags table" local-tags-file-name)))))
+       (user-error "File %s is not a valid tags table"
+                    local-tags-file-name)))))
 
 (defun tags-reset-tags-tables ()
   "Reset tags state to cancel effect of any previous \\[visit-tags-table] or \\[find-tag]."
@@ -781,7 +778,7 @@ tags table and its (recursively) included tags tables."
              (setq tags-completion-table nil)))))
 
 (defun tags-lazy-completion-table ()
-  (lexical-let ((buf (current-buffer)))
+  (let ((buf (current-buffer)))
     (lambda (string pred action)
       (with-current-buffer buf
         (save-excursion
@@ -831,7 +828,7 @@ If no tags table is loaded, do nothing and return nil."
                                (tags-lazy-completion-table)
                                nil nil nil nil default)))
     (if (equal spec "")
-       (or default (error "There is no default tag"))
+       (or default (user-error "There is no default tag"))
       spec)))
 
 (defvar last-tag nil
@@ -886,7 +883,7 @@ See documentation of variable `tags-file-name'."
     (if (eq '- next-p)
        ;; Pop back to a previous location.
        (if (ring-empty-p tags-location-ring)
-           (error "No previous tag locations")
+           (user-error "No previous tag locations")
          (let ((marker (ring-remove tags-location-ring 0)))
            (prog1
                ;; Move to the saved location.
@@ -1150,8 +1147,8 @@ error message."
          (set-marker (car tag-lines-already-matched) nil nil)
          (setq tag-lines-already-matched (cdr tag-lines-already-matched)))
        (set-marker match-marker nil nil)
-       (error "No %stags %s %s" (if first-search "" "more ")
-              matching pattern))
+       (user-error "No %stags %s %s" (if first-search "" "more ")
+                    matching pattern))
 
       ;; Found a tag; extract location info.
       (beginning-of-line)
@@ -1391,8 +1388,8 @@ hits the start of file."
              offset (* 3 offset)))     ; expand search window
       (or found
          (re-search-forward pat nil t)
-         (error "Rerun etags: `%s' not found in %s"
-                pat buffer-file-name)))
+         (user-error "Rerun etags: `%s' not found in %s"
+                      pat buffer-file-name)))
     ;; Position point at the right place
     ;; if the search string matched an extra Ctrl-m at the beginning.
     (and (eq selective-display t)
@@ -1687,7 +1684,7 @@ Point should be just after a string that matches TAG."
           (re-search-backward re bol t)))))
 \f
 (defcustom tags-loop-revert-buffers nil
-  "*Non-nil means tags-scanning loops should offer to reread changed files.
+  "Non-nil means tags-scanning loops should offer to reread changed files.
 These loops normally read each file into Emacs, but when a file
 is already visited, they use the existing buffer.
 When this flag is non-nil, they offer to revert the existing buffer
@@ -1742,7 +1739,7 @@ if the file was newly read in, the value is the filename."
     (and novisit
         (get-buffer " *next-file*")
         (kill-buffer " *next-file*"))
-    (error "All files processed"))
+    (user-error "All files processed"))
   (let* ((next (car next-file-list))
         (buffer (get-file-buffer next))
         (new (not buffer)))
@@ -1775,9 +1772,9 @@ if the file was newly read in, the value is the filename."
   "Form for `tags-loop-continue' to eval to change one file.")
 
 (defvar tags-loop-scan
-  '(error "%s"
-         (substitute-command-keys
-          "No \\[tags-search] or \\[tags-query-replace] in progress"))
+  '(user-error "%s"
+              (substitute-command-keys
+               "No \\[tags-search] or \\[tags-query-replace] in progress"))
   "Form for `tags-loop-continue' to eval to scan one file.
 If it returns non-nil, this file needs processing by evalling
 \`tags-loop-operate'.  Otherwise, move on to the next file.")
@@ -1937,7 +1934,7 @@ directory specification."
          (if (funcall list-tags-function file)
              (setq gotany t)))
        (or gotany
-           (error "File %s not in current tags tables" file)))))
+           (user-error "File %s not in current tags tables" file)))))
   (with-current-buffer "*Tags List*"
     (require 'apropos)
     (with-no-warnings
@@ -2067,28 +2064,15 @@ for \\[find-tag] (which see)."
   (interactive)
   (or tags-table-list
       tags-file-name
-      (error "%s"
-            (substitute-command-keys
-             "No tags table loaded; try \\[visit-tags-table]")))
+      (user-error "%s"
+                  (substitute-command-keys
+                   "No tags table loaded; try \\[visit-tags-table]")))
   (let ((comp-data (tags-completion-at-point-function)))
     (if (null comp-data)
-       (error "Nothing to complete")
+       (user-error "Nothing to complete")
       (completion-in-region (car comp-data) (cadr comp-data)
                            (nth 2 comp-data)
                            (plist-get (nthcdr 3 comp-data) :predicate)))))
-
-(dolist (x '("^No tags table in use; use .* to select one$"
-            "^There is no default tag$"
-            "^No previous tag locations$"
-            "^File .* is not a valid tags table$"
-            "^No \\(more \\|\\)tags \\(matching\\|containing\\) "
-            "^Rerun etags: `.*' not found in "
-            "^All files processed$"
-            "^No .* or .* in progress$"
-            "^File .* not in current tags tables$"
-            "^No tags table loaded"
-            "^Nothing to complete$"))
-       (add-to-list 'debug-ignored-errors x))
 \f
 (provide 'etags)
 
index c44f1d735011ad39251ba8c6fd18eedb7e1a8f0f..e51425719721052092b89d1dbdefd309558cde6a 100644 (file)
@@ -57,7 +57,7 @@
 ;; This used to default to `other', but that doesn't seem to have any
 ;; significance.  fx 2000-02-11.
 (defcustom executable-insert t         ; 'other
-  "*Non-nil means offer to add a magic number to a file.
+  "Non-nil means offer to add a magic number to a file.
 This takes effect when you switch to certain major modes,
 including Shell-script mode (`sh-mode').
 When you type \\[executable-set-magic], it always offers to add or
@@ -70,7 +70,7 @@ update the magic number."
 
 
 (defcustom executable-query 'function
-  "*If non-nil, ask user before changing an existing magic number.
+  "If non-nil, ask user before changing an existing magic number.
 When this is `function', only ask when called non-interactively."
   :type '(choice (const :tag "Don't Ask" nil)
                 (const :tag "Ask when non-interactive" function)
@@ -79,19 +79,19 @@ When this is `function', only ask when called non-interactively."
 
 
 (defcustom executable-magicless-file-regexp "/[Mm]akefile$\\|/\\.\\(z?profile\\|bash_profile\\|z?login\\|bash_login\\|z?logout\\|bash_logout\\|.+shrc\\|esrc\\|rcrc\\|[kz]shenv\\)$"
-  "*On files with this kind of name no magic is inserted or changed."
+  "On files with this kind of name no magic is inserted or changed."
   :type 'regexp
   :group 'executable)
 
 
 (defcustom executable-prefix "#! "
-  "*Interpreter magic number prefix inserted when there was no magic number."
+  "Interpreter magic number prefix inserted when there was no magic number."
   :type 'string
   :group 'executable)
 
 
 (defcustom executable-chmod 73
-  "*After saving, if the file is not executable, set this mode.
+  "After saving, if the file is not executable, set this mode.
 This mode passed to `set-file-modes' is taken absolutely when negative, or
 relative to the files existing modes.  Do nothing if this is nil.
 Typical values are 73 (+x) or -493 (rwxr-xr-x)."
@@ -103,7 +103,7 @@ Typical values are 73 (+x) or -493 (rwxr-xr-x)."
 (defvar executable-command nil)
 
 (defcustom executable-self-display "tail"
-  "*Command you use with argument `+2' to make text files self-display.
+  "Command you use with argument `+2' to make text files self-display.
 Note that the like of `more' doesn't work too well under Emacs \\[shell]."
   :type 'string
   :group 'executable)
@@ -111,7 +111,7 @@ Note that the like of `more' doesn't work too well under Emacs \\[shell]."
 
 (defvar executable-font-lock-keywords
   '(("\\`#!.*/\\([^ \t\n]+\\)" 1 font-lock-keyword-face t))
-  "*Rules for highlighting executable scripts' magic number.
+  "Rules for highlighting executable scripts' magic number.
 This can be included in `font-lock-keywords' by modes that call `executable'.")
 
 
index 0c8071cdc4dfb47e22c1f8a56e93282d3f087ecf..cc1251f6a75d06e8540636c7db1a2932e636cf06 100644 (file)
@@ -659,7 +659,7 @@ logical\\|double[ \t]*precision\\|type[ \t]*(\\sw+)\\|none\\)[ \t]*"
 
 (defvar f90-font-lock-keywords
   f90-font-lock-keywords-2
-  "*Default expressions to highlight in F90 mode.
+  "Default expressions to highlight in F90 mode.
 Can be overridden by the value of `font-lock-maximum-decoration'.")
 
 
@@ -2212,18 +2212,13 @@ Leave point at the end of line."
   "Typing `\\[help-command] or `? lists all the F90 abbrevs.
 Any other key combination is executed normally."
   (interactive "*")
-  (insert last-command-event)
-  (let (char event)
-    (if (fboundp 'next-command-event) ; XEmacs
-        (setq event (next-command-event)
-              char (and (fboundp 'event-to-character)
-                        (event-to-character event)))
-      (setq event (read-event)
-            char event))
-    ;; Insert char if not equal to `?', or if abbrev-mode is off.
-    (if (and abbrev-mode (memq char (list ?? help-char)))
-        (f90-abbrev-help)
-      (setq unread-command-events (list event)))))
+  (self-insert-command 1)
+  (when abbrev-mode
+    (set-temporary-overlay-map
+     (let ((map (make-sparse-keymap)))
+       (define-key map [??] 'f90-abbrev-help)
+       (define-key map (vector help-char) 'f90-abbrev-help)
+       map))))
 
 (defun f90-abbrev-help ()
   "List the currently defined abbrevs in F90 mode."
index 07393c6954d70869ac6e89f67929f257b2519720..ad285274928e4ac699d6d25d76faba89e6e1b664 100644 (file)
@@ -35,7 +35,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (if (featurep 'xemacs) (require 'overlay))
 
 (defvar flymake-is-running nil
@@ -253,7 +253,7 @@ are the string substitutions (see `format')."
 (make-variable-buffer-local 'flymake-output-residual)
 
 (defgroup flymake nil
-  "A universal on-the-fly syntax checker."
+  "Universal on-the-fly syntax checker."
   :version "23.1"
   :group 'tools)
 
@@ -408,7 +408,7 @@ File contents are not checked."
 This function is used in sort to move most possible file names
 to the beginning of the list (File.h -> File.cpp moved to top)."
   (and (equal (file-name-sans-extension flymake-included-file-name)
-             (file-name-sans-extension (file-name-nondirectory file-one)))
+             (file-name-base file-one))
        (not (equal file-one file-two))))
 
 (defcustom flymake-check-file-limit 8192
@@ -684,7 +684,7 @@ It's flymake process filter."
 (defun flymake-er-get-line-err-info-list (err-info)
   (nth 1 err-info))
 
-(defstruct (flymake-ler
+(cl-defstruct (flymake-ler
             (:constructor nil)
             (:constructor flymake-ler-make-ler (file line type text &optional full-file)))
   file line type text full-file)
@@ -763,15 +763,46 @@ line number outside the file being compiled."
   "Determine whether overlay OV was created by flymake."
   (and (overlayp ov) (overlay-get ov 'flymake-overlay)))
 
-(defun flymake-make-overlay (beg end tooltip-text face mouse-face)
+(defcustom flymake-error-bitmap '(exclamation-mark error)
+  "Bitmap used in the fringe for indicating errors.
+The value may also be a list of two elements where the second
+element specifies the face for the bitmap."
+  :group 'flymake
+  :type 'symbol)
+
+(defcustom flymake-warning-bitmap 'question-mark
+  "Bitmap used in the fringe for indicating warnings.
+The value may also be a list of two elements where the second
+element specifies the face for the bitmap."
+  :group 'flymake
+  :type 'symbol)
+
+(defcustom flymake-fringe-indicator-position 'left-fringe
+  "The position to put flymake fringe indicator.
+The value can be nil, left-fringe or right-fringe.
+Fringe indicators are disabled if nil."
+  :group 'flymake
+  :type '(choice (const left-fringe)
+                (const right-fringe)
+                (const :tag "No fringe indicators" nil)))
+
+(defun flymake-make-overlay (beg end tooltip-text face bitmap mouse-face)
   "Allocate a flymake overlay in range BEG and END."
   (when (not (flymake-region-has-flymake-overlays beg end))
-    (let ((ov (make-overlay beg end nil t t)))
+    (let ((ov (make-overlay beg end nil t t))
+         (fringe (and flymake-fringe-indicator-position
+                      (propertize "!" 'display
+                                  (cons flymake-fringe-indicator-position
+                                        (if (listp bitmap)
+                                            bitmap
+                                          (list bitmap)))))))
       (overlay-put ov 'face           face)
       (overlay-put ov 'mouse-face     mouse-face)
       (overlay-put ov 'help-echo      tooltip-text)
       (overlay-put ov 'flymake-overlay  t)
       (overlay-put ov 'priority 100)
+      (overlay-put ov 'evaporate t)
+      (overlay-put ov 'before-string fringe)
       ;;+(flymake-log 3 "created overlay %s" ov)
       ov)
     (flymake-log 3 "created an overlay at (%d-%d)" beg end)))
@@ -796,16 +827,12 @@ Return t if it has at least one flymake overlay, nil if no overlay."
     has-flymake-overlays))
 
 (defface flymake-errline
-  '((((class color) (background dark)) (:background "Firebrick4"))
-    (((class color) (background light)) (:background "LightPink"))
-    (t (:bold t)))
+  '((t :inherit error))
   "Face used for marking error lines."
   :group 'flymake)
 
 (defface flymake-warnline
-  '((((class color) (background dark)) (:background "DarkBlue"))
-    (((class color) (background light)) (:background "LightBlue2"))
-    (t (:bold t)))
+  '((t :inherit warning))
   "Face used for marking warning lines."
   :group 'flymake)
 
@@ -819,7 +846,8 @@ Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting."
         (beg      line-beg)
         (end      line-end)
         (tooltip-text (flymake-ler-text (nth 0 line-err-info-list)))
-        (face     nil))
+        (face     nil)
+        (bitmap   nil))
 
     (goto-char line-beg)
     (while (looking-at "[ \t]")
@@ -843,10 +871,12 @@ Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting."
       (setq end (point)))
 
     (if (> (flymake-get-line-err-count line-err-info-list "e") 0)
-       (setq face 'flymake-errline)
-      (setq face 'flymake-warnline))
+       (setq face 'flymake-errline
+             bitmap flymake-error-bitmap)
+      (setq face 'flymake-warnline
+           bitmap flymake-warning-bitmap))
 
-    (flymake-make-overlay beg end tooltip-text face nil)))
+    (flymake-make-overlay beg end tooltip-text face bitmap nil)))
 
 (defun flymake-parse-err-lines (err-info-list lines)
   "Parse err LINES, store info in ERR-INFO-LIST."
@@ -1356,8 +1386,12 @@ if ARG is omitted or nil."
       (setq flymake-timer
             (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
 
-      (when flymake-start-syntax-check-on-find-file
-        (flymake-start-syntax-check)))))
+      (when (and flymake-start-syntax-check-on-find-file
+                 ;; Since we write temp files in current dir, there's no point
+                 ;; trying if the directory is read-only (bug#8954).
+                 (file-writable-p (file-name-directory buffer-file-name)))
+        (with-demoted-errors
+          (flymake-start-syntax-check))))))
 
    ;; Turning the mode OFF.
    (t
index 8d488fe9be41117f6374ed279fd3b87399a432de..665b0767b2ced5de5368b5ab964b1f9abdc7141c 100644 (file)
@@ -165,7 +165,7 @@ allow trailing comments on a line."
 (defcustom fortran-directive-re
   "^[ \t]*#.*"
   "Regexp to match a directive line.
-The matching text will be fontified with `font-lock-keyword-face'.
+The matching text will be fontified with `font-lock-preprocessor-face'.
 The matching line will be given zero indentation."
   :version "22.1"
   :type    'regexp
@@ -452,7 +452,7 @@ The only difference is, it returns t in a case when the default returns nil."
     ;; Standard continuation character and in a TAB-formatted line.
     '("^ \\{5\\}\\([^ 0\n]\\)" 1 font-lock-string-face)
     '("^\t\\([1-9]\\)"         1 font-lock-string-face))
-   `((,fortran-directive-re (0 font-lock-keyword-face t)))
+   `((,fortran-directive-re (0 font-lock-preprocessor-face t)))
    ;; `fortran-font-lock-keywords-2' without types (see above).
    (cdr (nthcdr (length fortran-font-lock-keywords-1)
                 fortran-font-lock-keywords-2)))
index b19c828d1710226d4da6cd258e52c1898995c865..23a34b85194eef63c2b6c3ad8b022d9f0e7737a1 100644 (file)
@@ -91,7 +91,7 @@
 (require 'gud)
 (require 'json)
 (require 'bindat)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (declare-function speedbar-change-initial-expansion-list
                   "speedbar" (new-default))
@@ -459,9 +459,14 @@ Most recent commands are listed first.  This list stores only the last
 `gdb-debug-log-max' values.  This variable is used to debug GDB-MI.")
 
 ;;;###autoload
-(defcustom gdb-enable-debug nil
-  "Non-nil means record the process input and output in `gdb-debug-log'."
-  :type 'boolean
+(define-minor-mode gdb-enable-debug
+  "Toggle logging of transaction between Emacs and Gdb.
+The log is stored in `gdb-debug-log' as an alist with elements
+whose cons is send, send-item or recv and whose cdr is the string
+being transferred.  This list may grow up to a size of
+`gdb-debug-log-max' after which the oldest element (at the end of
+the list) is deleted every time a new one is added (at the front)."
+  :global t
   :group 'gdb
   :version "22.1")
 
@@ -512,21 +517,6 @@ Also display the main routine in the disassembly buffer if present."
          ;; Force mode line redisplay soon.
          (force-mode-line-update)))))
 
-(defun gdb-enable-debug (arg)
-  "Toggle logging of transaction between Emacs and Gdb.
-The log is stored in `gdb-debug-log' as an alist with elements
-whose cons is send, send-item or recv and whose cdr is the string
-being transferred.  This list may grow up to a size of
-`gdb-debug-log-max' after which the oldest element (at the end of
-the list) is deleted every time a new one is added (at the front)."
-  (interactive "P")
-  (setq gdb-enable-debug
-       (if (null arg)
-           (not gdb-enable-debug)
-         (> (prefix-numeric-value arg) 0)))
-  (message (format "Logging of transaction %sabled"
-                  (if gdb-enable-debug "en" "dis"))))
-
 ;; These two are used for menu and toolbar
 (defun gdb-control-all-threads ()
   "Switch to non-stop/A mode."
@@ -830,7 +820,7 @@ detailed description of this mode.
   (run-hooks 'gdb-mode-hook))
 
 (defun gdb-init-1 ()
-  ;; (re-)initialize
+  ;; (Re-)initialize.
   (setq gdb-selected-frame nil
        gdb-frame-number nil
         gdb-thread-number nil
@@ -865,8 +855,13 @@ detailed description of this mode.
   (gdb-clear-inferior-io)
   (gdb-inferior-io--init-proc (get-process "gdb-inferior"))
 
-  (if (eq window-system 'w32)
-      (gdb-input "-gdb-set new-console off" 'ignore))
+  (when (eq system-type 'windows-nt)
+    ;; Don't create a separate console window for the debuggee.
+    (gdb-input "-gdb-set new-console off" 'ignore)
+    ;; Force GDB to behave as if its input and output stream were
+    ;; connected to a TTY device (since on Windows we use pipes for
+    ;; communicating with GDB).
+    (gdb-input "-gdb-set interactive-mode on" 'ignore))
   (gdb-input "-gdb-set height 0" 'ignore)
 
   (when gdb-non-stop
@@ -874,7 +869,7 @@ detailed description of this mode.
 
   (gdb-input "-enable-pretty-printing" 'ignore)
 
-  ;; find source file and compilation directory here
+  ;; Find source file and compilation directory here.
   (if gdb-create-source-file-list
       ;; Needs GDB 6.2 onwards.
       (gdb-input "-file-list-exec-source-files" 'gdb-get-source-file-list))
@@ -974,15 +969,17 @@ no input, and GDB is waiting for input."
     (gdb-create-define-alist)
     (add-hook 'after-save-hook 'gdb-create-define-alist nil t)))
 
-(defmacro gdb-if-arrow (arrow-position &rest body)
-  `(if ,arrow-position
-       (let ((buffer (marker-buffer ,arrow-position)) (line))
-         (if (equal buffer (window-buffer (posn-window end)))
-             (with-current-buffer buffer
-               (when (or (equal start end)
-                         (equal (posn-point start)
-                                (marker-position ,arrow-position)))
-                 ,@body))))))
+(defmacro gdb--if-arrow (arrow-position start-posn end-posn &rest body)
+  (declare (indent 3))
+  (let ((buffer (make-symbol "buffer")))
+    `(if ,arrow-position
+         (let ((,buffer (marker-buffer ,arrow-position)))
+           (if (equal ,buffer (window-buffer (posn-window ,end-posn)))
+               (with-current-buffer ,buffer
+                 (when (or (equal ,start-posn ,end-posn)
+                           (equal (posn-point ,start-posn)
+                                  (marker-position ,arrow-position)))
+                   ,@body)))))))
 
 (defun gdb-mouse-until (event)
   "Continue running until a source line past the current line.
@@ -992,15 +989,15 @@ with mouse-1 (default bindings)."
   (interactive "e")
   (let ((start (event-start event))
        (end (event-end event)))
-    (gdb-if-arrow gud-overlay-arrow-position
-                 (setq line (line-number-at-pos (posn-point end)))
-                 (gud-call (concat "until " (number-to-string line))))
-    (gdb-if-arrow gdb-disassembly-position
-                 (save-excursion
-                   (goto-char (point-min))
-                   (forward-line (1- (line-number-at-pos (posn-point end))))
-                   (forward-char 2)
-                   (gud-call (concat "until *%a"))))))
+    (gdb--if-arrow gud-overlay-arrow-position start end
+      (let ((line (line-number-at-pos (posn-point end))))
+        (gud-call (concat "until " (number-to-string line)))))
+    (gdb--if-arrow gdb-disassembly-position start end
+      (save-excursion
+        (goto-char (point-min))
+        (forward-line (1- (line-number-at-pos (posn-point end))))
+        (forward-char 2)
+        (gud-call (concat "until *%a"))))))
 
 (defun gdb-mouse-jump (event)
   "Set execution address/line.
@@ -1011,19 +1008,17 @@ line, and no execution takes place."
   (interactive "e")
   (let ((start (event-start event))
        (end (event-end event)))
-    (gdb-if-arrow gud-overlay-arrow-position
-                 (setq line (line-number-at-pos (posn-point end)))
-                 (progn
-                   (gud-call (concat "tbreak " (number-to-string line)))
-                   (gud-call (concat "jump " (number-to-string line)))))
-    (gdb-if-arrow gdb-disassembly-position
-                 (save-excursion
-                   (goto-char (point-min))
-                   (forward-line (1- (line-number-at-pos (posn-point end))))
-                   (forward-char 2)
-                   (progn
-                     (gud-call (concat "tbreak *%a"))
-                     (gud-call (concat "jump *%a")))))))
+    (gdb--if-arrow gud-overlay-arrow-position start end
+      (let ((line (line-number-at-pos (posn-point end))))
+        (gud-call (concat "tbreak " (number-to-string line)))
+        (gud-call (concat "jump " (number-to-string line)))))
+    (gdb--if-arrow gdb-disassembly-position start end
+      (save-excursion
+        (goto-char (point-min))
+        (forward-line (1- (line-number-at-pos (posn-point end))))
+        (forward-char 2)
+        (gud-call (concat "tbreak *%a"))
+        (gud-call (concat "jump *%a"))))))
 
 (defcustom gdb-show-changed-values t
   "If non-nil change the face of out of scope variables and changed values.
@@ -1045,10 +1040,11 @@ Changed values are highlighted with the face `font-lock-warning-face'."
   :group 'gdb
   :version "22.2")
 
-(defcustom gdb-speedbar-auto-raise nil
-  "If non-nil raise speedbar every time display of watch expressions is\
- updated."
-  :type 'boolean
+(define-minor-mode gdb-speedbar-auto-raise
+  "Minor mode to automatically raise the speedbar for watch expressions.
+With prefix argument ARG, automatically raise speedbar if ARG is
+positive, otherwise don't automatically raise it."
+  :global t
   :group 'gdb
   :version "22.1")
 
@@ -1058,20 +1054,8 @@ Changed values are highlighted with the face `font-lock-warning-face'."
   :group 'gdb
   :version "22.1")
 
-(defun gdb-speedbar-auto-raise (arg)
-  "Toggle automatic raising of the speedbar for watch expressions.
-With prefix argument ARG, automatically raise speedbar if ARG is
-positive, otherwise don't automatically raise it."
-  (interactive "P")
-  (setq gdb-speedbar-auto-raise
-       (if (null arg)
-           (not gdb-speedbar-auto-raise)
-         (> (prefix-numeric-value arg) 0)))
-  (message (format "Auto raising %sabled"
-                  (if gdb-speedbar-auto-raise "en" "dis"))))
-
 (define-key gud-minor-mode-map "\C-c\C-w" 'gud-watch)
-(define-key global-map (concat gud-key-prefix "\C-w") 'gud-watch)
+(define-key global-map (vconcat gud-key-prefix "\C-w") 'gud-watch)
 
 (declare-function tooltip-identifier-from-point "tooltip" (point))
 
@@ -1207,8 +1191,8 @@ With arg, enter name of variable to be watched in the minibuffer."
 (defun gdb-edit-value (_text _token _indent)
   "Assign a value to a variable displayed in the speedbar."
   (let* ((var (nth (- (count-lines (point-min) (point)) 2) gdb-var-list))
-        (varnum (car var)) (value))
-    (setq value (read-string "New value: "))
+        (varnum (car var))
+         (value (read-string "New value: ")))
     (gdb-input (concat "-var-assign " varnum " " value)
               `(lambda () (gdb-edit-value-handler ,value)))))
 
@@ -1860,7 +1844,7 @@ is running."
     (setq gud-running
           (string= (bindat-get-field (gdb-current-buffer-thread) 'state)
                    "running"))
-    ;; Set frame number to "0" when _current_ threads stops
+    ;; Set frame number to "0" when _current_ threads stops.
     (when (and (gdb-current-buffer-thread)
                (not (eq gud-running old-value)))
       (setq gdb-frame-number "0"))))
@@ -1928,10 +1912,10 @@ is running."
             (> (length gdb-debug-log) gdb-debug-log-max))
        (setcdr (nthcdr (1- gdb-debug-log-max) gdb-debug-log) nil)))
 
-  ;; Recall the left over gud-marker-acc from last time
+  ;; Recall the left over gud-marker-acc from last time.
   (setq gud-marker-acc (concat gud-marker-acc string))
 
-  ;; Start accumulating output for the GUD buffer
+  ;; Start accumulating output for the GUD buffer.
   (setq gdb-filter-output "")
   (let (output-record-list)
 
@@ -1977,9 +1961,8 @@ is running."
 (defun gdb-gdb (_output-field))
 
 (defun gdb-shell (output-field)
-  (let ((gdb-output-sink gdb-output-sink))
-    (setq gdb-filter-output
-          (concat output-field gdb-filter-output))))
+  (setq gdb-filter-output
+        (concat output-field gdb-filter-output)))
 
 (defun gdb-ignored-notification (_output-field))
 
@@ -2063,14 +2046,15 @@ current thread and update GDB buffers."
                             (concat " --thread " thread-id)))
                 'gdb-register-names-handler))
 
-;;; Don't set gud-last-frame here as it's currently done in gdb-frame-handler
-;;; because synchronous GDB doesn't give these fields with CLI.
-;;;     (when file
-;;;       (setq
-;;;        ;; Extract the frame position from the marker.
-;;;        gud-last-frame (cons file
-;;;                        (string-to-number
-;;;                         (match-string 6 gud-marker-acc)))))
+    ;; Don't set gud-last-frame here as it's currently done in
+    ;; gdb-frame-handler because synchronous GDB doesn't give these fields
+    ;; with CLI.
+    ;;(when file
+    ;;  (setq
+    ;;   ;; Extract the frame position from the marker.
+    ;;   gud-last-frame (cons file
+    ;;                     (string-to-number
+    ;;                      (match-string 6 gud-marker-acc)))))
 
     (setq gdb-inferior-status (or reason "unknown"))
     (gdb-force-mode-line-update
@@ -2285,8 +2269,7 @@ Return position where LINE begins."
 ;; gdb-table struct is a way to programmatically construct simple
 ;; tables. It help to reliably align columns of data in GDB buffers
 ;; and provides
-(defstruct
-  gdb-table
+(cl-defstruct gdb-table
   (column-sizes nil)
   (rows nil)
   (row-properties nil)
@@ -2354,8 +2337,9 @@ calling `gdb-table-string'."
 (defun gdb-get-many-fields (struct &rest fields)
   "Return a list of FIELDS values from STRUCT."
   (let ((values))
-    (dolist (field fields values)
-      (setq values (append values (list (bindat-get-field struct field)))))))
+    (dolist (field fields)
+      (push (bindat-get-field struct field) values))
+    (nreverse values)))
 
 (defmacro def-gdb-auto-update-trigger (trigger-name gdb-command
                                                     handler-name
@@ -2772,9 +2756,9 @@ corresponding to the mode line clicked."
         (add-to-list 'gdb-threads-list
                      (cons (bindat-get-field thread 'id)
                            thread))
-        (if running
-            (incf gdb-running-threads-count)
-          (incf gdb-stopped-threads-count))
+        (cl-incf (if running
+                     gdb-running-threads-count
+                   gdb-stopped-threads-count))
 
         (gdb-table-add-row table
                            (list
@@ -4129,31 +4113,19 @@ window is dedicated."
                              nil win5))
     (select-window win0)))
 
-(defcustom gdb-many-windows nil
+(define-minor-mode gdb-many-windows
   "If nil just pop up the GUD buffer unless `gdb-show-main' is t.
 In this case it starts with two windows: one displaying the GUD
 buffer and the other with the source file with the main routine
 of the debugged program.  Non-nil means display the layout shown for
 `gdb'."
-  :type 'boolean
+  :global t
   :group 'gdb
-  :version "22.1")
-
-(defun gdb-many-windows (arg)
-  "Toggle the number of windows in the basic arrangement.
-With arg, display additional buffers iff arg is positive."
-  (interactive "P")
-  (setq gdb-many-windows
-        (if (null arg)
-            (not gdb-many-windows)
-          (> (prefix-numeric-value arg) 0)))
-  (message (format "Display of other windows %sabled"
-                   (if gdb-many-windows "en" "dis")))
+  :version "22.1"
   (if (and gud-comint-buffer
            (buffer-name gud-comint-buffer))
-      (condition-case nil
-          (gdb-restore-windows)
-        (error nil))))
+      (ignore-errors
+        (gdb-restore-windows))))
 
 (defun gdb-restore-windows ()
   "Restore the basic arrangement of windows used by gdb.
index b49739a94d50a119a4c9843e450262e06746f94b..a5ac7b43057bac500f478009f3930b47ce335df7 100644 (file)
 ;;; Code:
 
 
-(eval-when-compile
-  (require 'cl))
-
-
 ;;; User variables
 
 
@@ -78,7 +74,7 @@ string."
 
 
 (defcustom glasses-original-separator "_"
-  "*String to be displayed as `glasses-separator' in separator positions.
+  "String to be displayed as `glasses-separator' in separator positions.
 For instance, if you set it to \"_\" and set `glasses-separator' to \"-\",
 underscore separators are displayed as hyphens.
 If `glasses-original-separator' is an empty string, no such display change is
index 79c351003678ed1f7e26b32f1de8d97301ce87bf..a6ae42f86b19d2f2a3cb56eecb7e3414bbacefbb 100644 (file)
@@ -61,7 +61,7 @@ SYMBOL should be one of `grep-command', `grep-template',
 
 ;;;###autoload
 (defcustom grep-window-height nil
-  "*Number of lines in a grep window.  If nil, use `compilation-window-height'."
+  "Number of lines in a grep window.  If nil, use `compilation-window-height'."
   :type '(choice (const :tag "Default" nil)
                 integer)
   :version "22.1"
@@ -104,7 +104,7 @@ To change the default value, use Customize or call the function
   :group 'grep)
 
 (defcustom grep-scroll-output nil
-  "*Non-nil to scroll the *grep* buffer window as output appears.
+  "Non-nil to scroll the *grep* buffer window as output appears.
 
 Setting it causes the grep commands to put point at the end of their
 output window so that the end of the output is always visible rather
@@ -203,13 +203,13 @@ Customize or call the function `grep-apply-setting'."
     ("tex" .   "*.tex")
     ("texi" .  "*.texi")
     ("asm" .   "*.[sS]"))
-  "*Alist of aliases for the FILES argument to `lgrep' and `rgrep'."
+  "Alist of aliases for the FILES argument to `lgrep' and `rgrep'."
   :type 'alist
   :group 'grep)
 
 (defcustom grep-find-ignored-directories
   vc-directory-exclusion-list
-  "*List of names of sub-directories which `rgrep' shall not recurse into.
+  "List of names of sub-directories which `rgrep' shall not recurse into.
 If an element is a cons cell, the car is called on the search directory
 to determine whether cdr should not be recursed into."
   :type '(choice (repeat :tag "Ignored directories" string)
@@ -221,7 +221,7 @@ to determine whether cdr should not be recursed into."
                                  (unless (string-match-p "/\\'" s)
                                    (concat "*" s)))
                                completion-ignored-extensions)))
-  "*List of file names which `rgrep' and `lgrep' shall exclude.
+  "List of file names which `rgrep' and `lgrep' shall exclude.
 If an element is a cons cell, the car is called on the search directory
 to determine whether cdr should not be excluded."
   :type '(choice (repeat :tag "Ignored file" string)
@@ -229,7 +229,7 @@ to determine whether cdr should not be excluded."
   :group 'grep)
 
 (defcustom grep-error-screen-columns nil
-  "*If non-nil, column numbers in grep hits are screen columns.
+  "If non-nil, column numbers in grep hits are screen columns.
 See `compilation-error-screen-columns'"
   :type '(choice (const :tag "Default" nil)
                 integer)
@@ -1025,7 +1025,8 @@ to specify a command to run."
                                    (shell-quote-argument ")")
                                    " -prune -o "))
                       (and grep-find-ignored-files
-                           (concat (shell-quote-argument "(")
+                           (concat (shell-quote-argument "!") " -type d "
+                                   (shell-quote-argument "(")
                                    ;; we should use shell-quote-argument here
                                    " -name "
                                    (mapconcat
index 121a023cd5420047ad7786cabac4aee9914c9b06..8912e67d6031ce29fdc64b2d8a94883895a3d313 100644 (file)
@@ -37,8 +37,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl)) ; for case macro
-
 (require 'comint)
 
 (defvar gdb-active-process)
 ;; GUD commands must be visible in C buffers visited by GUD
 
 (defgroup gud nil
-  "Grand Unified Debugger mode for gdb and other debuggers under Emacs.
-Supported debuggers include gdb, sdb, dbx, xdb, perldb, pdb (Python) and jdb."
+  "The \"Grand Unified Debugger\" interface.
+Supported debuggers include gdb, sdb, dbx, xdb, perldb,
+pdb (Python), and jdb."
   :group 'processes
   :group 'tools)
 
 
 (defcustom gud-key-prefix "\C-x\C-a"
   "Prefix of all GUD commands valid in C buffers."
-  :type 'string
+  :type 'key-sequence
   :group 'gud)
 
-(global-set-key (concat gud-key-prefix "\C-l") 'gud-refresh)
+(global-set-key (vconcat gud-key-prefix "\C-l") 'gud-refresh)
 (define-key ctl-x-map " " 'gud-break)  ;; backward compatibility hack
 
 (defvar gud-marker-filter nil)
@@ -527,10 +526,10 @@ required by the caller."
                       nil 'gdb-edit-value)
                   nil
                   (if gdb-show-changed-values
-                      (or parent (case status
-                                   (changed 'font-lock-warning-face)
-                                   (out-of-scope 'shadow)
-                                   (t t)))
+                      (or parent (pcase status
+                                   (`changed 'font-lock-warning-face)
+                                   (`out-of-scope 'shadow)
+                                   (_ t)))
                     t)
                   depth)
                (if (eq status 'out-of-scope) (setq parent 'shadow))
@@ -548,10 +547,10 @@ required by the caller."
                         nil 'gdb-edit-value)
                     nil
                     (if gdb-show-changed-values
-                        (or parent (case status
-                                     (changed 'font-lock-warning-face)
-                                     (out-of-scope 'shadow)
-                                     (t t)))
+                        (or parent (pcase status
+                                     (`changed 'font-lock-warning-face)
+                                     (`out-of-scope 'shadow)
+                                     (_ t)))
                       t)
                     depth)
                  (speedbar-make-tag-line
@@ -1046,7 +1045,7 @@ and source-file directory for your debugger."
 (defvar gud-dbx-history nil)
 
 (defcustom gud-dbx-directories nil
-  "*A list of directories that dbx should search for source code.
+  "A list of directories that dbx should search for source code.
 If nil, only source files in the program directory
 will be known to dbx.
 
@@ -1358,7 +1357,7 @@ and source-file directory for your debugger."
 (defvar gud-xdb-history nil)
 
 (defcustom gud-xdb-directories nil
-  "*A list of directories that xdb should search for source code.
+  "A list of directories that xdb should search for source code.
 If nil, only source files in the program directory
 will be known to xdb.
 
@@ -1811,7 +1810,7 @@ source file information.")
 
 ;; List of Java source file directories.
 (defvar gud-jdb-directories (list ".")
-  "*A list of directories that gud jdb should search for source code.
+  "A list of directories that gud jdb should search for source code.
 The file names should be absolute, or relative to the current
 directory.
 
@@ -2762,10 +2761,9 @@ Obeying it means displaying in another window the specified file and line."
                                                  (buffer-file-name)
                                                (car frame)))))
         ((eq key ?F)
-         (setq subst (file-name-sans-extension
-                      (file-name-nondirectory (if insource
-                                                  (buffer-file-name)
-                                                (car frame))))))
+         (setq subst (file-name-base (if insource
+                                          (buffer-file-name)
+                                        (car frame)))))
         ((eq key ?d)
          (setq subst (file-name-directory (if insource
                                               (buffer-file-name)
@@ -3412,11 +3410,11 @@ With arg, dereference expr if ARG is positive, otherwise do not dereference."
 
 (defun gud-tooltip-print-command (expr)
   "Return a suitable command to print the expression EXPR."
-  (case gud-minor-mode
-       (gdbmi (concat "-data-evaluate-expression " expr))
-       (dbx (concat "print " expr))
-       ((xdb pdb) (concat "p " expr))
-       (sdb (concat expr "/"))))
+  (pcase gud-minor-mode
+    (`gdbmi (concat "-data-evaluate-expression " expr))
+    (`dbx (concat "print " expr))
+    ((or `xdb `pdb) (concat "p " expr))
+    (`sdb (concat expr "/"))))
 
 (declare-function gdb-input "gdb-mi" (command handler))
 (declare-function tooltip-expr-to-print "tooltip" (event))
index 26db60ddbc2647dc85e1d182abf7a58c8e08fc2a..b6d2b5e319cdfdeba073362c29047babfb4cff1e 100644 (file)
   :group 'languages)
 
 (defcustom hs-hide-comments-when-hiding-all t
-  "*Hide the comments too when you do an `hs-hide-all'."
+  "Hide the comments too when you do an `hs-hide-all'."
   :type 'boolean
   :group 'hideshow)
 
 (defcustom hs-minor-mode-hook nil
-  "*Hook called when hideshow minor mode is activated or deactivated."
+  "Hook called when hideshow minor mode is activated or deactivated."
   :type 'hook
   :group 'hideshow
   :version "21.1")
 
 (defcustom hs-isearch-open 'code
-  "*What kind of hidden blocks to open when doing `isearch'.
+  "What kind of hidden blocks to open when doing `isearch'.
 One of the following symbols:
 
   code    -- open only code blocks
@@ -272,7 +272,7 @@ This has effect only if `search-invisible' is set to `open'."
     (bibtex-mode ("@\\S(*\\(\\s(\\)" 1))
     (java-mode "{" "}" "/[*/]" nil nil)
     (js-mode "{" "}" "/[*/]" nil)))
-  "*Alist for initializing the hideshow variables for different modes.
+  "Alist for initializing the hideshow variables for different modes.
 Each element has the form
   (MODE START END COMMENT-START FORWARD-SEXP-FUNC ADJUST-BEG-FUNC).
 
@@ -300,25 +300,25 @@ appropriate values.  The regexps should not contain leading or trailing
 whitespace.  Case does not matter.")
 
 (defvar hs-hide-all-non-comment-function nil
-  "*Function called if non-nil when doing `hs-hide-all' for non-comments.")
+  "Function called if non-nil when doing `hs-hide-all' for non-comments.")
 
 (defvar hs-allow-nesting nil
-  "*If non-nil, hiding remembers internal blocks.
+  "If non-nil, hiding remembers internal blocks.
 This means that when the outer block is shown again,
 any previously hidden internal blocks remain hidden.")
 
 (defvar hs-hide-hook nil
-  "*Hook called (with `run-hooks') at the end of commands to hide text.
+  "Hook called (with `run-hooks') at the end of commands to hide text.
 These commands include the toggling commands (when the result is to hide
 a block), `hs-hide-all', `hs-hide-block' and `hs-hide-level'.")
 
 (defvar hs-show-hook nil
-  "*Hook called (with `run-hooks') at the end of commands to show text.
+  "Hook called (with `run-hooks') at the end of commands to show text.
 These commands include the toggling commands (when the result is to show
 a block), `hs-show-all' and `hs-show-block'.")
 
 (defvar hs-set-up-overlay nil
-  "*Function called with one arg, OV, a newly initialized overlay.
+  "Function called with one arg, OV, a newly initialized overlay.
 Hideshow puts a unique overlay on each range of text to be hidden
 in the buffer.  Here is a simple example of how to use this variable:
 
@@ -802,12 +802,15 @@ If `hs-hide-comments-when-hiding-all' is non-nil, also hide the comments."
                   (forward-comment (point-max)))
                 (re-search-forward re (point-max) t))
          (if (match-beginning 1)
-             ;; we have found a block beginning
+             ;; We have found a block beginning.
              (progn
                (goto-char (match-beginning 1))
-               (if hs-hide-all-non-comment-function
-                   (funcall hs-hide-all-non-comment-function)
-                 (hs-hide-block-at-point t)))
+              (unless (if hs-hide-all-non-comment-function
+                          (funcall hs-hide-all-non-comment-function)
+                        (hs-hide-block-at-point t))
+                ;; Go to end of matched data to prevent from getting stuck
+                ;; with an endless loop.
+                (goto-char (match-end 0))))
            ;; found a comment, probably
            (let ((c-reg (hs-inside-comment-p)))
              (when (and c-reg (car c-reg))
index 35c29e106279595fee557d2c6c88405ec6918b4c..205b226160aa1fb0c8f8a2b2b4fb83a33e27c446 100644 (file)
   :group 'languages)
 
 (defcustom icon-indent-level 4
-  "*Indentation of Icon statements with respect to containing block."
+  "Indentation of Icon statements with respect to containing block."
   :type 'integer
   :group 'icon)
 
 (defcustom icon-brace-imaginary-offset 0
-  "*Imagined indentation of a Icon open brace that actually follows a statement."
+  "Imagined indentation of a Icon open brace that actually follows a statement."
   :type 'integer
   :group 'icon)
 
 (defcustom icon-brace-offset 0
-  "*Extra indentation for braces, compared with other text in same context."
+  "Extra indentation for braces, compared with other text in same context."
   :type 'integer
   :group 'icon)
 
 (defcustom icon-continued-statement-offset 4
-  "*Extra indent for Icon lines not starting new statements."
+  "Extra indent for Icon lines not starting new statements."
   :type 'integer
   :group 'icon)
 
 (defcustom icon-continued-brace-offset 0
-  "*Extra indent for Icon substatements that start with open-braces.
+  "Extra indent for Icon substatements that start with open-braces.
 This is in addition to `icon-continued-statement-offset'."
   :type 'integer
   :group 'icon)
 
 (defcustom icon-auto-newline nil
-  "*Non-nil means automatically newline before and after braces Icon code.
+  "Non-nil means automatically newline before and after braces Icon code.
 This applies when braces are inserted."
   :type 'boolean
   :group 'icon)
 
 (defcustom icon-tab-always-indent t
-  "*Non-nil means TAB in Icon mode should always reindent the current line.
+  "Non-nil means TAB in Icon mode should always reindent the current line.
 It will then reindent, regardless of where in the line point is
 when the TAB command is used."
   :type 'boolean
index f2f9fd30ed4ad2202292731c5d66145c85a34e91..0cb8b7da4aa8bc1f15ac8ef02878af07a62cb959 100644 (file)
@@ -115,7 +115,7 @@ must be explicitly set non-nil in order for the variable
   "Obsolete variable.  See `idlwave-html-help-location'.")
 
 (defcustom idlwave-help-use-dedicated-frame t
-  "*Non-nil means, use a separate frame for Online Help if possible."
+  "Non-nil means, use a separate frame for Online Help if possible."
   :group 'idlwave-online-help
   :type 'boolean)
 
@@ -164,12 +164,12 @@ probably a good idea to still call this function as a fallback."
   :type 'symbol)
 
 (defcustom idlwave-help-fontify-source-code nil
-  "*Non-nil means, fontify source code displayed as help like normal code."
+  "Non-nil means, fontify source code displayed as help like normal code."
   :group 'idlwave-online-help
   :type 'boolean)
 
 (defcustom idlwave-help-source-try-header t
-  "*Non-nil means, try to find help in routine header when displaying source.
+  "Non-nil means, try to find help in routine header when displaying source.
 Routines which are not documented in the system manual use their source as
 help text.  When this variable is non-nil, we try to find a description of
 the help item in the first routine doclib header above the routine definition.
@@ -180,14 +180,14 @@ definition is displayed instead."
 
 
 (defcustom idlwave-help-doclib-name "name"
-  "*A regexp for the heading word to search for in doclib headers
+  "A regexp for the heading word to search for in doclib headers
 which specifies the `name' section.  Can be used for localization
 support."
   :group 'idlwave-online-help
   :type 'string)
 
 (defcustom idlwave-help-doclib-keyword "KEYWORD"
-  "*A regexp for the heading word to search for in doclib headers
+  "A regexp for the heading word to search for in doclib headers
 which specifies the `keywords' section.  Can be used for localization
 support."
   :group 'idlwave-online-help
index 55a085fbde0251ba39fcf500b7fec1c766dfddbc..4f9109284ae7035dce6896407832f73429301120 100644 (file)
   :group 'idlwave)
 
 (defcustom idlwave-shell-prompt-pattern "^\r? ?IDL> "
-  "*Regexp to match IDL prompt at beginning of a line.
+  "Regexp to match IDL prompt at beginning of a line.
 For example, \"^\r?IDL> \" or \"^\r?WAVE> \".
 The \"^\r?\" is needed, to indicate the beginning of the line, with
 optional return character (which IDL seems to output randomly).
@@ -118,7 +118,7 @@ This is a fine thing to set in your `.emacs' file."
   :type 'regexp)
 
 (defcustom idlwave-shell-process-name "idl"
-  "*Name to be associated with the IDL process.  The buffer for the
+  "Name to be associated with the IDL process.  The buffer for the
 process output is made by surrounding this name with `*'s."
   :group 'idlwave-shell-general-setup
   :type 'string)
@@ -126,12 +126,12 @@ process output is made by surrounding this name with `*'s."
 ;; (defcustom idlwave-shell-automatic-start...)  See idlwave.el
 
 (defcustom idlwave-shell-use-dedicated-window nil
-  "*Non-nil means, never replace the shell frame with another buffer."
+  "Non-nil means, never replace the shell frame with another buffer."
   :group 'idlwave-shell-general-setup
   :type 'boolean)
 
 (defcustom idlwave-shell-use-dedicated-frame nil
-  "*Non-nil means, IDLWAVE should use a special frame to display shell buffer."
+  "Non-nil means, IDLWAVE should use a special frame to display shell buffer."
   :group 'idlwave-shell-general-setup
   :type 'boolean)
 
@@ -145,12 +145,12 @@ The default makes the frame splittable, so that completion works correctly."
          (cons symbol sexp)))
 
 (defcustom idlwave-shell-raise-frame t
-  "*Non-nil means, `idlwave-shell' raises the frame showing the shell window."
+  "Non-nil means, `idlwave-shell' raises the frame showing the shell window."
   :group 'idlwave-shell-general-setup
   :type 'boolean)
 
 (defcustom idlwave-shell-arrows-do-history t
-  "*Non-nil means UP and DOWN arrows move through command history.
+  "Non-nil means UP and DOWN arrows move through command history.
 This variable can have 3 values:
 nil        Arrows just move the cursor
 t          Arrows force the cursor back to the current command line and
@@ -166,7 +166,7 @@ t          Arrows force the cursor back to the current command line and
 ;; FIXME: add comint-input-ring-size?
 
 (defcustom idlwave-shell-use-toolbar t
-  "*Non-nil means, use the debugging toolbar in all IDL related buffers.
+  "Non-nil means, use the debugging toolbar in all IDL related buffers.
 Starting the shell will then add the toolbar to all idlwave-mode buffers.
 Exiting the shell will removed everywhere.
 Available on XEmacs and on Emacs 21.x or later.
@@ -176,21 +176,15 @@ At any time you can toggle the display of the toolbar with
   :type 'boolean)
 
 (defcustom idlwave-shell-temp-pro-prefix "/tmp/idltemp"
-  "*The prefix for temporary IDL files used when compiling regions.
+  "The prefix for temporary IDL files used when compiling regions.
 It should be an absolute pathname.
 The full temporary file name is obtained by using `make-temp-file'
 so that the name will be unique among multiple Emacs processes."
   :group 'idlwave-shell-general-setup
   :type 'string)
 
-(defvar idlwave-shell-fix-inserted-breaks nil
-  "*OBSOLETE VARIABLE, is no longer used.
-
-The documentation of this variable used to be:
-If non-nil then run `idlwave-shell-remove-breaks' to clean up IDL messages.")
-
 (defcustom idlwave-shell-prefix-key "\C-c\C-d"
-  "*The prefix key for the debugging map `idlwave-shell-mode-prefix-map'.
+  "The prefix key for the debugging map `idlwave-shell-mode-prefix-map'.
 This variable must already be set when idlwave-shell.el is loaded.
 Setting it in the mode-hook is too late."
   :group 'idlwave-shell-general-setup
@@ -223,11 +217,8 @@ window, but is useful for stepping, etc."
 
 ;; (defcustom idlwave-shell-debug-modifiers... See idlwave.el
 
-(defvar idlwave-shell-activate-alt-keybindings nil
-  "Obsolete variable.  See `idlwave-shell-debug-modifiers'.")
-
 (defcustom idlwave-shell-use-truename nil
-  "*Non-nil means, use `file-truename' when looking for buffers.
+  "Non-nil means, use `file-truename' when looking for buffers.
 If this variable is non-nil, Emacs will use the function `file-truename' to
 resolve symbolic links in the file paths printed by e.g., STOP commands.
 This means, unvisited files will be loaded under their truename.
@@ -247,7 +238,7 @@ because these are used as separators by IDL."
   :type 'string)
 
 (defcustom idlwave-shell-mode-hook '()
-  "*Hook for customizing `idlwave-shell-mode'."
+  "Hook for customizing `idlwave-shell-mode'."
   :group 'idlwave-shell-general-setup
   :type 'hook)
 
@@ -292,7 +283,7 @@ is non-nil."
 
 (defcustom idlwave-shell-show-commands
   '(run misc breakpoint)
-  "*A list of command types to show output from in the shell.
+  "A list of command types to show output from in the shell.
 Possibilities are 'run, 'debug, 'breakpoint, and 'misc.  Unselected
 types are not displayed in the shell.  The type 'everything causes all
 the copious shell traffic to be displayed."
@@ -335,11 +326,8 @@ expression being examined."
           (string :tag "Label  ")
           (string :tag "Command"))))
 
-(defvar idlwave-shell-print-expression-function nil
-  "*OBSOLETE VARIABLE, is no longer used.")
-
 (defcustom idlwave-shell-separate-examine-output t
-  "*Non-nil means, put output of examine commands in their own buffer."
+  "Non-nil means, put output of examine commands in their own buffer."
   :group 'idlwave-shell-command-setup
   :type 'boolean)
 
@@ -359,12 +347,12 @@ newly created."
          (cons variable sexp)))
 
 (defcustom idlwave-shell-query-for-class t
-  "*Non-nil means query the shell for object class on object completions."
+  "Non-nil means query the shell for object class on object completions."
   :group 'idlwave-shell-command-setup
   :type 'boolean)
 
 (defcustom idlwave-shell-use-input-mode-magic nil
-  "*Non-nil means, IDLWAVE should check for input mode spells in output.
+  "Non-nil means, IDLWAVE should check for input mode spells in output.
 The spells are strings printed by your IDL program and matched
 by the regular expressions in `idlwave-shell-input-mode-spells'.
 When these expressions match, IDLWAVE switches to character input mode and
@@ -432,7 +420,7 @@ end"
          (regexp :tag "Line-mode regexp")))
 
 (defcustom idlwave-shell-breakpoint-popup-menu t
-  "*If non-nil, provide a menu on mouse-3 on breakpoint lines, and
+  "If non-nil, provide a menu on mouse-3 on breakpoint lines, and
 popup help text on the line."
   :group 'idlwave-shell-command-setup
   :type 'boolean)
@@ -449,7 +437,7 @@ popup help text on the line."
   :group 'idlwave)
 
 (defcustom idlwave-shell-mark-stop-line t
-  "*Non-nil means, mark the source code line where IDL is currently stopped.
+  "Non-nil means, mark the source code line where IDL is currently stopped.
 Value decides about the method which is used to mark the line.  Valid values
 are:
 
@@ -471,7 +459,7 @@ hides any code, so setting this to 'arrow on Emacs 21 sounds like a good idea."
          (const :tag "Face or arrow." t)))
 
 (defcustom idlwave-shell-overlay-arrow ">"
-  "*The overlay arrow to display at source lines where execution halts.
+  "The overlay arrow to display at source lines where execution halts.
 We use a single character by default, since the main block of IDL procedures
 often has no indentation.  Where possible, IDLWAVE will use overlays to
 display the stop-lines.  The arrow is only used on character-based terminals.
@@ -480,33 +468,33 @@ See also `idlwave-shell-use-overlay-arrow'."
   :type 'string)
 
 (defcustom idlwave-shell-stop-line-face 'highlight
-  "*The face for `idlwave-shell-stop-line-overlay'.
+  "The face for `idlwave-shell-stop-line-overlay'.
 Allows you to choose the font, color and other properties for
 line where IDL is stopped.  See also `idlwave-shell-mark-stop-line'."
   :group 'idlwave-shell-highlighting-and-faces
   :type 'symbol)
 
 (defcustom idlwave-shell-electric-stop-color "Violet"
-  "*The color for the default face or overlay arrow when stopped."
+  "The color for the default face or overlay arrow when stopped."
   :group 'idlwave-shell-highlighting-and-faces
   :type 'string)
 
 (defcustom idlwave-shell-electric-stop-line-face
   (prog1
-      (copy-face 'modeline 'idlwave-shell-electric-stop-line)
+      (copy-face 'mode-line 'idlwave-shell-electric-stop-line)
     (set-face-background 'idlwave-shell-electric-stop-line
                         idlwave-shell-electric-stop-color)
     (condition-case nil
        (set-face-foreground 'idlwave-shell-electric-stop-line nil)
       (error nil)))
-  "*The face for `idlwave-shell-stop-line-overlay' when in electric debug mode.
+  "The face for `idlwave-shell-stop-line-overlay' when in electric debug mode.
 Allows you to choose the font, color and other properties for the line
 where IDL is stopped, when in Electric Debug Mode."
   :group 'idlwave-shell-highlighting-and-faces
   :type 'symbol)
 
 (defcustom idlwave-shell-mark-breakpoints t
-  "*Non-nil means, mark breakpoints in the source files.
+  "Non-nil means, mark breakpoints in the source files.
 Valid values are:
 nil        Do not mark breakpoints.
 'face      Highlight line with `idlwave-shell-breakpoint-face'.
@@ -520,11 +508,8 @@ t          Glyph when possible, otherwise face (same effect as 'glyph)."
          (const :tag "Display glyph (red dot)" glyph)
          (const :tag "Glyph or face." t)))
 
-(defvar idlwave-shell-use-breakpoint-glyph t
-  "Obsolete variable.  See `idlwave-shell-mark-breakpoints'.")
-
 (defcustom idlwave-shell-breakpoint-face 'idlwave-shell-bp
-  "*The face for breakpoint lines in the source code.
+  "The face for breakpoint lines in the source code.
 Allows you to choose the font, color and other properties for
 lines which have a breakpoint.  See also `idlwave-shell-mark-breakpoints'."
   :group 'idlwave-shell-highlighting-and-faces
@@ -542,7 +527,7 @@ lines which have a breakpoint.  See also `idlwave-shell-mark-breakpoints'."
 
 (defcustom idlwave-shell-disabled-breakpoint-face
   'idlwave-shell-disabled-bp
-  "*The face for disabled breakpoint lines in the source code.
+  "The face for disabled breakpoint lines in the source code.
 Allows you to choose the font, color and other properties for
 lines which have a breakpoint.  See also `idlwave-shell-mark-breakpoints'."
   :group 'idlwave-shell-highlighting-and-faces
@@ -560,14 +545,14 @@ lines which have a breakpoint.  See also `idlwave-shell-mark-breakpoints'."
 
 
 (defcustom idlwave-shell-expression-face 'secondary-selection
-  "*The face for `idlwave-shell-expression-overlay'.
+  "The face for `idlwave-shell-expression-overlay'.
 Allows you to choose the font, color and other properties for
 the expression printed by IDL."
   :group 'idlwave-shell-highlighting-and-faces
   :type 'symbol)
 
 (defcustom idlwave-shell-output-face 'secondary-selection
-  "*The face for `idlwave-shell-output-overlay'.
+  "The face for `idlwave-shell-output-overlay'.
 Allows you to choose the font, color and other properties for
 the expression output by IDL."
   :group 'idlwave-shell-highlighting-and-faces
@@ -784,7 +769,7 @@ with `*'s."
     "^% Skipped to:"
     "^% Stop encountered:"
     )
-  "*A list of regular expressions matching IDL messages.
+  "A list of regular expressions matching IDL messages.
 These are the messages containing file and line information where
 IDL is currently stopped.")
 
@@ -795,19 +780,19 @@ IDL is currently stopped.")
 
 (defconst idlwave-shell-trace-message-re
   "^% At "    ;; First line of a trace message
-  "*A regular expression matching IDL trace messages.  These are the
+  "A regular expression matching IDL trace messages.  These are the
 messages containing file and line information of a current
 traceback.")
 
 (defconst idlwave-shell-step-messages
   '("^% Stepped to:"
     )
-  "*A list of regular expressions matching stepped execution messages.
+  "A list of regular expressions matching stepped execution messages.
 These are IDL messages containing file and line information where
 IDL has currently stepped.")
 
 (defvar idlwave-shell-break-message "^% Breakpoint at:"
-  "*Regular expression matching an IDL breakpoint message line.")
+  "Regular expression matching an IDL breakpoint message line.")
 
 (defconst idlwave-shell-electric-debug-help
   "   ==> IDLWAVE Electric Debug Mode Help <==
@@ -1672,7 +1657,7 @@ number.")
    "\\([ \t]*\n[ \t]*[^ \t\n]+\\)*"      ; continuation lines file name (6)
    "\\)"                                 ; end line number group (5)
    )
-  "*A regular expression to parse out the file name and line number.
+  "A regular expression to parse out the file name and line number.
 The 1st group should match the subroutine name.
 The 3rd group is the line number.
 The 5th group is the file name.
@@ -4198,12 +4183,8 @@ Otherwise, just expand the file name."
          ([(        ?[)]   ?[   idlwave-shell-goto-previous-bp t t)
          ([(        ?])]   ?]   idlwave-shell-goto-next-bp t t)
          ([(control ?f)]   ?f   idlwave-shell-window)))
-       (mod (cond ((and idlwave-shell-debug-modifiers
-                       (listp idlwave-shell-debug-modifiers)
-                       (not (equal '() idlwave-shell-debug-modifiers)))
-                  idlwave-shell-debug-modifiers)
-                 (idlwave-shell-activate-alt-keybindings
-                  '(alt))))
+       (mod (and (listp idlwave-shell-debug-modifiers)
+                idlwave-shell-debug-modifiers))
        (shift (memq 'shift mod))
        (mod-noshift (delete 'shift (copy-sequence mod)))
        s k1 c2 k2 cmd electric only-buffer cannotshift)
index 31fe20698b93e61049e81183d9a90bb9c836e5e9..a35ffd3e45d43a0a901173124204979a792fc6c8 100644 (file)
   :group 'idlwave)
 
 (defcustom idlwave-main-block-indent 2
-  "*Extra indentation for the main block of code.
+  "Extra indentation for the main block of code.
 That is the block between the FUNCTION/PRO statement and the END
 statement for that program unit."
   :group 'idlwave-code-formatting
   :type 'integer)
 
 (defcustom idlwave-block-indent 3
-  "*Extra indentation applied to block lines.
+  "Extra indentation applied to block lines.
 If you change this, you probably also want to change `idlwave-end-offset'."
   :group 'idlwave-code-formatting
   :type 'integer)
 
 (defcustom idlwave-end-offset -3
-  "*Extra indentation applied to block END lines.
+  "Extra indentation applied to block END lines.
 A value equal to negative `idlwave-block-indent' will make END lines
 line up with the block BEGIN lines."
   :group 'idlwave-code-formatting
   :type 'integer)
 
 (defcustom idlwave-continuation-indent 3
-  "*Extra indentation applied to continuation lines.
+  "Extra indentation applied to continuation lines.
 This extra offset applies to the first of a set of continuation lines.
 The following lines receive the same indentation as the first."
   :group 'idlwave-code-formatting
   :type 'integer)
 
 (defcustom idlwave-max-extra-continuation-indent 40
-  "*Maximum additional indentation for special continuation indent.
+  "Maximum additional indentation for special continuation indent.
 Several special indentations are tried to help line up continuation
 lines in routine calls or definitions, other statements with
 parentheses, or assignment statements.  This variable specifies a
@@ -236,7 +236,7 @@ this variable."
   :type 'integer)
 
 (defcustom idlwave-indent-to-open-paren t
-  "*Non-nil means, indent continuation lines to innermost open parenthesis.
+  "Non-nil means, indent continuation lines to innermost open parenthesis.
 This indentation occurs even if otherwise disallowed by
 `idlwave-max-extra-continuation-indent'.  Matching parens and the
 interleaving args are lined up.  Example:
@@ -260,38 +260,38 @@ would yield:
   :type 'boolean)
 
 (defcustom idlwave-indent-parens-nested nil
-  "*Non-nil means, indent continuation lines with parens by nesting
+  "Non-nil means, indent continuation lines with parens by nesting
 lines at consecutively deeper levels."
  :group 'idlwave-code-formatting
   :type 'boolean)
 
 
 (defcustom idlwave-hanging-indent t
-  "*If set non-nil then comment paragraphs are indented under the
+  "If set non-nil then comment paragraphs are indented under the
 hanging indent given by `idlwave-hang-indent-regexp' match in the first line
 of the paragraph."
   :group 'idlwave-code-formatting
   :type 'boolean)
 
 (defcustom idlwave-hang-indent-regexp "- "
-  "*Regular expression matching the position of the hanging indent
+  "Regular expression matching the position of the hanging indent
 in the first line of a comment paragraph.  The size of the indent
 extends to the end of the match for the regular expression."
   :group 'idlwave-code-formatting
   :type 'regexp)
 
 (defcustom idlwave-use-last-hang-indent nil
-  "*If non-nil then use last match on line for `idlwave-indent-regexp'."
+  "If non-nil then use last match on line for `idlwave-indent-regexp'."
   :group 'idlwave-code-formatting
   :type 'boolean)
 
 (defcustom idlwave-fill-comment-line-only t
-  "*If non-nil then auto fill will only operate on comment lines."
+  "If non-nil then auto fill will only operate on comment lines."
   :group 'idlwave-code-formatting
   :type 'boolean)
 
 (defcustom idlwave-auto-fill-split-string t
-  "*If non-nil then auto fill will split strings with the IDL `+' operator.
+  "If non-nil then auto fill will split strings with the IDL `+' operator.
 When the line end falls within a string, string concatenation with the
 '+' operator will be used to distribute a long string over lines.
 If nil and a string is split then a terminal beep and warning are issued.
@@ -302,7 +302,7 @@ non-nil, since in this case code is not auto-filled."
   :type 'boolean)
 
 (defcustom idlwave-split-line-string t
-  "*If non-nil then `idlwave-split-line' will split strings with `+'.
+  "If non-nil then `idlwave-split-line' will split strings with `+'.
 When the splitting point of a line falls inside a string, split the string
 using the `+' string concatenation operator.  If nil and a string is
 split then a terminal beep and warning are issued."
@@ -310,14 +310,14 @@ split then a terminal beep and warning are issued."
   :type 'boolean)
 
 (defcustom idlwave-no-change-comment ";;;"
-  "*The indentation of a comment that starts with this regular
+  "The indentation of a comment that starts with this regular
 expression will not be changed.  Note that the indentation of a comment
 at the beginning of a line is never changed."
   :group 'idlwave-code-formatting
   :type 'string)
 
 (defcustom idlwave-begin-line-comment nil
-  "*A comment anchored at the beginning of line.
+  "A comment anchored at the beginning of line.
 A comment matching this regular expression will not have its
 indentation changed.  If nil the default is \"^;\", i.e., any line
 beginning with a \";\".  Expressions for comments at the beginning of
@@ -327,7 +327,7 @@ the line should begin with \"^\"."
                 'regexp))
 
 (defcustom idlwave-code-comment ";;[^;]"
-  "*A comment that starts with this regular expression on a line by
+  "A comment that starts with this regular expression on a line by
 itself is indented as if it is a part of IDL code.  As a result if
 the comment is not preceded by whitespace it is unchanged."
   :group 'idlwave-code-formatting
@@ -343,7 +343,7 @@ the comment is not preceded by whitespace it is unchanged."
   :group 'idlwave)
 
 (defcustom idlwave-use-library-catalogs t
-  "*Non-nil means search the IDL path for library catalog files.
+  "Non-nil means search the IDL path for library catalog files.
 
 These files, named .idlwave_catalog, document routine information for
 individual directories and libraries of IDL .pro files.  Many popular
@@ -353,7 +353,7 @@ usually a good idea."
   :type 'boolean)
 
 (defcustom idlwave-init-rinfo-when-idle-after 10
-  "*Seconds of idle time before routine info is automatically initialized.
+  "Seconds of idle time before routine info is automatically initialized.
 Initializing the routine info can take a long time, in particular if a
 large number of library catalogs are involved.  When Emacs is idle for
 more than the number of seconds specified by this variable, it starts
@@ -370,7 +370,7 @@ needed, and initialize then."
   :type 'number)
 
 (defcustom idlwave-scan-all-buffers-for-routine-info t
-  "*Non-nil means, scan buffers for IDL programs when updating info.
+  "Non-nil means, scan buffers for IDL programs when updating info.
 The scanning is done by the command `idlwave-update-routine-info'.
 The following values are allowed:
 
@@ -384,7 +384,7 @@ current   Scan only the current buffer, but no other buffers."
          (const :tag "Current buffer only" 'current)))
 
 (defcustom idlwave-query-shell-for-routine-info t
-  "*Non-nil means query the shell for info about compiled routines.
+  "Non-nil means query the shell for info about compiled routines.
 Querying the shell is useful to get information about compiled modules,
 and it is turned on by default.  However, when you have a complete library
 scan, this is not necessary."
@@ -393,7 +393,7 @@ scan, this is not necessary."
 
 (defcustom idlwave-auto-routine-info-updates
   '(find-file save-buffer kill-buffer compile-buffer)
-  "*Controls under what circumstances routine info is updated automatically.
+  "Controls under what circumstances routine info is updated automatically.
 Possible values:
 nil       Never
 t         All available
@@ -413,7 +413,7 @@ t         All available
               (const :tag "After a buffer was compiled successfully, update shell info" compile-buffer))))
 
 (defcustom idlwave-rinfo-max-source-lines 5
-  "*Maximum number of source files displayed in the Routine Info window.
+  "Maximum number of source files displayed in the Routine Info window.
 When an integer, it is the maximum number of source files displayed.
 A value of t means to show all source files."
   :group 'idlwave-routine-info
@@ -448,7 +448,7 @@ value of `!DIR'.  See also `idlwave-library-path'."
 ;; Configuration files
 (defcustom idlwave-config-directory
   (convert-standard-filename "~/.idlwave")
-  "*Directory for configuration files and user-library catalog."
+  "Directory for configuration files and user-library catalog."
   :group 'idlwave-routine-info
   :type 'file)
 
@@ -456,9 +456,6 @@ value of `!DIR'.  See also `idlwave-library-path'."
 (defvar idlwave-xml-system-rinfo-converted-file "idl_xml_rinfo.el")
 (defvar idlwave-path-file "idlpath.el")
 
-(defvar idlwave-libinfo-file nil
-  "*Obsolete variable, no longer used.")
-
 (defcustom idlwave-special-lib-alist nil
   "Alist of regular expressions matching special library directories.
 When listing routine source locations, IDLWAVE gives a short hint where
@@ -538,7 +535,7 @@ After changing this variable, you need to either restart Emacs or press
                ,idlwave-tmp)))
 
 (defcustom idlwave-completion-force-default-case nil
-  "*Non-nil means, completion will always honor `idlwave-completion-case'.
+  "Non-nil means, completion will always honor `idlwave-completion-case'.
 When nil, only the completion of a mixed case or upper case string
 will honor the default settings in `idlwave-completion-case', while
 the completion of lower case strings will be completed entirely in
@@ -547,7 +544,7 @@ lower case."
   :type 'boolean)
 
 (defcustom idlwave-complete-empty-string-as-lower-case nil
-  "*Non-nil means, the empty string is considered downcase for completion.
+  "Non-nil means, the empty string is considered downcase for completion.
 The case of what is already in the buffer determines the case of completions.
 When this variable is non-nil, the empty string is considered to be downcase.
 Completing on the empty string then offers downcase versions of the possible
@@ -555,12 +552,8 @@ completions."
   :group 'idlwave-completion
   :type 'boolean)
 
-(defvar idlwave-default-completion-case-is-down nil
-  "Obsolete variable.  See `idlwave-complete-empty-string-as-lower-case' and
-`idlwave-completion-case'.")
-
 (defcustom idlwave-buffer-case-takes-precedence nil
-  "*Non-nil means, the case of tokens in buffers dominates over system stuff.
+  "Non-nil means, the case of tokens in buffers dominates over system stuff.
 To make this possible, we need to re-case everything each time we update
 the routine info from the buffers.  This is slow.
 The default is to consider the case given in the system and library files
@@ -569,7 +562,7 @@ first which makes updating much faster."
   :type 'boolean)
 
 (defcustom idlwave-highlight-help-links-in-completion t
-  "*Non-nil means, highlight completions for which system help is available.
+  "Non-nil means, highlight completions for which system help is available.
 Help can then be accessed with mouse-3.
 This option is only effective when the online help system is installed."
   :group 'idlwave-completion
@@ -594,7 +587,7 @@ for which to assume this can be set here."
 
 
 (defcustom idlwave-completion-show-classes 1
-  "*Number of classes to show when completing object methods and keywords.
+  "Number of classes to show when completing object methods and keywords.
 When completing methods or keywords for an object with unknown class,
 the *Completions* buffer will show the valid classes for each completion
 like this:
@@ -613,7 +606,7 @@ negative integer, the `help-echo' property will be suppressed."
                 (integer :tag "Number of classes shown" 1)))
 
 (defcustom idlwave-completion-fontify-classes t
-  "*Non-nil means, fontify the classes in completions buffer.
+  "Non-nil means, fontify the classes in completions buffer.
 This makes it easier to distinguish the completion items from the extra
 class info listed.  See `idlwave-completion-show-classes'."
   :group 'idlwave-completion
@@ -673,7 +666,7 @@ method, add an entry (\"INIT\" . t).  The method name must be ALL-CAPS."
                 (boolean :tag "Determine class for this method")))))
 
 (defcustom idlwave-store-inquired-class t
-  "*Non-nil means, store class of a method call as text property on `->'.
+  "Non-nil means, store class of a method call as text property on `->'.
 IDLWAVE sometimes has to ask the user for the class associated with a
 particular object method call.  This happens during the commands
 `idlwave-routine-info' and `idlwave-complete', depending upon the
@@ -698,7 +691,7 @@ at point."
   :type 'boolean)
 
 (defcustom idlwave-class-arrow-face 'bold
-  "*Face to highlight object operator arrows `->' which carry a class property.
+  "Face to highlight object operator arrows `->' which carry a class property.
 When IDLWAVE stores a class name as text property on an object arrow
 \(see variable `idlwave-store-inquired-class', it highlights the arrow
 with this font in order to remind the user that this arrow is special."
@@ -706,17 +699,17 @@ with this font in order to remind the user that this arrow is special."
   :type 'symbol)
 
 (defcustom idlwave-resize-routine-help-window t
-  "*Non-nil means, resize the Routine-info *Help* window to fit the content."
+  "Non-nil means, resize the Routine-info *Help* window to fit the content."
   :group 'idlwave-completion
   :type 'boolean)
 
 (defcustom idlwave-keyword-completion-adds-equal t
-  "*Non-nil means, completion automatically adds `=' after completed keywords."
+  "Non-nil means, completion automatically adds `=' after completed keywords."
   :group 'idlwave-completion
   :type 'boolean)
 
 (defcustom idlwave-function-completion-adds-paren t
-  "*Non-nil means, completion automatically adds `(' after completed function.
+  "Non-nil means, completion automatically adds `(' after completed function.
 nil means, don't add anything.
 A value of `2' means, also add the closing parenthesis and position cursor
 between the two."
@@ -726,7 +719,7 @@ between the two."
                 (const :tag "()" 2)))
 
 (defcustom idlwave-completion-restore-window-configuration t
-  "*Non-nil means, try to restore the window configuration after completion.
+  "Non-nil means, try to restore the window configuration after completion.
 When completion is not unique, Emacs displays a list of completions.
 This messes up your window configuration.  With this variable set, IDLWAVE
 restores the old configuration after successful completion."
@@ -741,13 +734,13 @@ The variables in this group govern this."
   :group 'idlwave)
 
 (defcustom idlwave-do-actions nil
-  "*Non-nil means performs actions when indenting.
+  "Non-nil means performs actions when indenting.
 The actions that can be performed are listed in `idlwave-indent-action-table'."
   :group 'idlwave-abbrev-and-indent-action
   :type 'boolean)
 
 (defcustom idlwave-abbrev-start-char "\\"
-  "*A single character string used to start abbreviations in abbrev mode.
+  "A single character string used to start abbreviations in abbrev mode.
 Possible characters to chose from: ~`\%
 or even '?'.  '.' is not a good choice because it can make structure
 field names act like abbrevs in certain circumstances.
@@ -759,7 +752,7 @@ is loaded."
   :type 'string)
 
 (defcustom idlwave-surround-by-blank nil
-  "*Non-nil means, enable `idlwave-surround'.
+  "Non-nil means, enable `idlwave-surround'.
 If non-nil, `=',`<',`>',`&',`,', `->' are surrounded with spaces by
 `idlwave-surround'.
 See help for `idlwave-indent-action-table' for symbols using `idlwave-surround'.
@@ -774,7 +767,7 @@ Also see help for `idlwave-surround'."
   :type 'boolean)
 
 (defcustom idlwave-pad-keyword t
-  "*Non-nil means pad '=' in keywords (routine calls or defs) like assignment.
+  "Non-nil means pad '=' in keywords (routine calls or defs) like assignment.
 Whenever `idlwave-surround' is non-nil then this affects how '=' is
 padded for keywords and for variables.  If t, pad the same as for
 assignments.  If nil then spaces are removed.  With any other value,
@@ -786,22 +779,22 @@ spaces are left unchanged."
          (const :tag "Keep space near `='" 'keep)))
 
 (defcustom idlwave-show-block t
-  "*Non-nil means point blinks to block beginning for `idlwave-show-begin'."
+  "Non-nil means point blinks to block beginning for `idlwave-show-begin'."
   :group 'idlwave-abbrev-and-indent-action
   :type 'boolean)
 
 (defcustom idlwave-expand-generic-end nil
-  "*Non-nil means expand generic END to ENDIF/ENDELSE/ENDWHILE etc."
+  "Non-nil means expand generic END to ENDIF/ENDELSE/ENDWHILE etc."
   :group 'idlwave-abbrev-and-indent-action
   :type 'boolean)
 
 (defcustom idlwave-reindent-end t
-  "*Non-nil means re-indent line after END was typed."
+  "Non-nil means re-indent line after END was typed."
   :group 'idlwave-abbrev-and-indent-action
   :type 'boolean)
 
 (defcustom idlwave-abbrev-move t
-  "*Non-nil means the abbrev hook can move point.
+  "Non-nil means the abbrev hook can move point.
 Set to nil by `idlwave-expand-region-abbrevs'.  To see the abbrev
 definitions, use the command `list-abbrevs', for abbrevs that move
 point.  Moving point is useful, for example, to place point between
@@ -812,7 +805,7 @@ See `idlwave-check-abbrev'."
   :type 'boolean)
 
 (defcustom idlwave-abbrev-change-case nil
-  "*Non-nil means all abbrevs will be forced to either upper or lower case.
+  "Non-nil means all abbrevs will be forced to either upper or lower case.
 If the value t, all expanded abbrevs will be upper case.
 If the value is 'down then abbrevs will be forced to lower case.
 If nil, the case will not change.
@@ -822,7 +815,7 @@ upper case, regardless of this variable."
   :type 'boolean)
 
 (defcustom idlwave-reserved-word-upcase nil
-  "*Non-nil means, reserved words will be made upper case via abbrev expansion.
+  "Non-nil means, reserved words will be made upper case via abbrev expansion.
 If nil case of reserved words is controlled by `idlwave-abbrev-change-case'.
 Has effect only if in abbrev-mode."
   :group 'idlwave-abbrev-and-indent-action
@@ -859,7 +852,7 @@ Has effect only if in abbrev-mode."
 ;;                           '(capitalize-word -1) t)
 
 (defvar idlwave-indent-action-table nil
-  "*Associated array containing action lists of search string (car),
+  "Associated array containing action lists of search string (car),
 and function as a cdr.  This table is used by `idlwave-indent-line'.
 See documentation for `idlwave-do-action' for a complete description of
 the action lists.
@@ -869,7 +862,7 @@ binding is not requested.
 See help on `idlwave-action-and-binding' for examples.")
 
 (defvar idlwave-indent-expand-table nil
-  "*Associated array containing action lists of search string (car),
+  "Associated array containing action lists of search string (car),
 and function as a cdr.  The table is used by the
 `idlwave-indent-and-action' function.  See documentation for
 `idlwave-do-action' for a complete description of the action lists.
@@ -948,14 +941,14 @@ See help on `idlwave-action-and-binding' for examples.")
 ;
 ;-
 ")
-  "*A list (PATHNAME STRING) specifying the doc-header template to use for
+  "A list (PATHNAME STRING) specifying the doc-header template to use for
 summarizing a file.  If PATHNAME is non-nil then this file will be included.
 Otherwise STRING is used.  If nil, the file summary will be omitted.
 For example you might set PATHNAME to the path for the
 lib_template.pro file included in the IDL distribution.")
 
 (defcustom idlwave-header-to-beginning-of-file t
-  "*Non-nil means, the documentation header will always be at start of file.
+  "Non-nil means, the documentation header will always be at start of file.
 When nil, the header is positioned between the PRO/FUNCTION line of
 the current routine and the code, allowing several routine headers in
 a file."
@@ -963,12 +956,12 @@ a file."
   :type 'boolean)
 
 (defcustom idlwave-timestamp-hook 'idlwave-default-insert-timestamp
-  "*The hook function used to update the timestamp of a function."
+  "The hook function used to update the timestamp of a function."
   :group 'idlwave-documentation
   :type 'function)
 
 (defcustom idlwave-doc-modifications-keyword "HISTORY"
-  "*The modifications keyword to use with the log documentation commands.
+  "The modifications keyword to use with the log documentation commands.
 A ':' is added to the keyword end.
 Inserted by doc-header and used to position logs by doc-modification.
 If nil it will not be inserted."
@@ -976,12 +969,12 @@ If nil it will not be inserted."
   :type 'string)
 
 (defcustom idlwave-doclib-start "^;+\\+"
-  "*Regexp matching the start of a document library header."
+  "Regexp matching the start of a document library header."
   :group 'idlwave-documentation
   :type 'regexp)
 
 (defcustom idlwave-doclib-end "^;+-"
-  "*Regexp matching the end of a document library header."
+  "Regexp matching the end of a document library header."
   :group 'idlwave-documentation
   :type 'regexp)
 
@@ -992,7 +985,7 @@ If nil it will not be inserted."
   :group 'idlwave)
 
 (defcustom idlwave-shell-explicit-file-name "idl"
-  "*If non-nil, this is the command to run IDL.
+  "If non-nil, this is the command to run IDL.
 Should be an absolute file path or path relative to the current environment
 execution search path.  If you want to specify command line switches
 for the IDL program, use `idlwave-shell-command-line-options'.
@@ -1003,7 +996,7 @@ it without compromising backwards-compatibility."
   :type 'string)
 
 (defcustom idlwave-shell-command-line-options nil
-  "*A list of command line options for calling the IDL program.
+  "A list of command line options for calling the IDL program.
 Since IDL is executed directly without going through a shell like /bin/sh,
 this should be a list of strings like '(\"-rt=file\" \"-nw\") with a separate
 string for each argument.  But you may also give a single string which
@@ -1015,7 +1008,7 @@ split it for you."
   :group 'idlwave-external-programs)
 
 (defcustom idlwave-help-application "idlhelp"
-  "*The external application providing reference help for programming.
+  "The external application providing reference help for programming.
 Obsolete, if the IDL Assistant is being used for help."
   :group 'idlwave-external-programs
   :type 'string)
@@ -1040,7 +1033,7 @@ are `control', `meta', `super', `hyper', `alt', and `shift'."
               (const shift)))
 
 (defcustom idlwave-shell-automatic-start nil
-  "*If non-nil attempt invoke `idlwave-shell' if not already running.
+  "If non-nil attempt invoke `idlwave-shell' if not already running.
 This is checked when an attempt to send a command to an
 IDL process is made."
   :group 'idlwave-shell-general-setup
@@ -1054,7 +1047,7 @@ IDL process is made."
   :group 'idlwave)
 
 (defcustom idlwave-startup-message t
-  "*Non-nil displays a startup message when `idlwave-mode' is first called."
+  "Non-nil displays a startup message when `idlwave-mode' is first called."
   :group 'idlwave-misc
   :type 'boolean)
 
@@ -4525,8 +4518,6 @@ information updated immediately, leave NO-CONCATENATE nil."
                   nil 'idlwave-load-rinfo-next-step)))
        (error nil))))
 
-(defvar idlwave-library-routines nil "Obsolete variable.")
-
 ;;------ XML Help routine info system
 (defun idlwave-load-system-routine-info ()
   ;; Load the system routine info from the cached routine info file,
@@ -5244,9 +5235,7 @@ Can run from `after-save-hook'."
          class
          (cond ((not (boundp 'idlwave-scanning-lib))
                 (list  'buffer (buffer-file-name)))
-;              ((string= (downcase
-;                         (file-name-sans-extension
-;                          (file-name-nondirectory (buffer-file-name))))
+;              ((string= (downcase (file-name-base))
 ;                        (downcase name))
 ;               (list 'lib))
 ;              (t (cons 'lib (file-name-nondirectory (buffer-file-name))))
index 73e167d1587b92e6abbb2f2c5eaa2af43298e002..cd6c8869d9f0c75c46b1a245b92de5a671c46640 100644 (file)
@@ -72,7 +72,7 @@
 ;;;###autoload
 (defcustom inferior-lisp-filter-regexp
   (purecopy "\\`\\s *\\(:\\(\\w\\|\\s_\\)\\)?\\s *\\'")
-  "*What not to save on inferior Lisp's input history.
+  "What not to save on inferior Lisp's input history.
 Input matching this regexp is not saved on the input history in Inferior Lisp
 mode.  Default is whitespace followed by 0 or 1 single-letter colon-keyword
 \(as in :a, :c, etc.)"
@@ -139,13 +139,13 @@ mode.  Default is whitespace followed by 0 or 1 single-letter colon-keyword
 
 ;;;###autoload
 (defcustom inferior-lisp-program (purecopy "lisp")
-  "*Program name for invoking an inferior Lisp in Inferior Lisp mode."
+  "Program name for invoking an inferior Lisp in Inferior Lisp mode."
   :type 'string
   :group 'inferior-lisp)
 
 ;;;###autoload
 (defcustom inferior-lisp-load-command (purecopy "(load \"%s\")\n")
-  "*Format-string for building a Lisp expression to load a file.
+  "Format-string for building a Lisp expression to load a file.
 This format string should use `%s' to substitute a file name
 and should result in a Lisp expression that will command the inferior Lisp
 to load that file.  The default works acceptably on most Lisps.
@@ -211,7 +211,7 @@ buffer with \\[set-variable].")
 
 ;;;###autoload
 (defvar inferior-lisp-mode-hook '()
-  "*Hook for customizing Inferior Lisp mode.")
+  "Hook for customizing Inferior Lisp mode.")
 
 (put 'inferior-lisp-mode 'mode-class 'special)
 
@@ -453,7 +453,7 @@ This holds a cons cell of the form `(DIRECTORY . FILE)'
 describing the last `lisp-load-file' or `lisp-compile-file' command.")
 
 (defcustom lisp-source-modes '(lisp-mode)
-  "*Used to determine if a buffer contains Lisp source code.
+  "Used to determine if a buffer contains Lisp source code.
 If it's loaded into a buffer that is in one of these major modes, it's
 considered a Lisp source file by `lisp-load-file' and `lisp-compile-file'.
 Used by these commands to determine defaults."
index 69da673752090a76388748c36782a0849d4e99ec..519e5aef2bc1a56715dd5e6b3d7ea86ef0a9dda0 100644 (file)
@@ -1,4 +1,4 @@
-;;; js.el --- Major mode for editing JavaScript
+;;; js.el --- Major mode for editing JavaScript  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
@@ -54,7 +54,7 @@
 (require 'json nil t)
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'comint)
   (require 'ido))
 
@@ -240,12 +240,11 @@ name as matched contains
 ")
 
 (defconst js--available-frameworks
-  (loop with available-frameworks
-        for style in js--class-styles
-        for framework = (plist-get style :framework)
-        unless (memq framework available-frameworks)
-        collect framework into available-frameworks
-        finally return available-frameworks)
+  (cl-loop for style in js--class-styles
+           for framework = (plist-get style :framework)
+           unless (memq framework available-frameworks)
+           collect framework into available-frameworks
+           finally return available-frameworks)
   "List of available JavaScript frameworks symbols.")
 
 (defconst js--function-heading-1-re
@@ -374,7 +373,7 @@ Match group 1 is the name of the macro.")
 ;; (The exception for b-end and its caveats is described below.)
 ;;
 
-(defstruct (js--pitem (:type list))
+(cl-defstruct (js--pitem (:type list))
   ;; IMPORTANT: Do not alter the position of fields within the list.
   ;; Various bits of code depend on their positions, particularly
   ;; anything that manipulates the list of children.
@@ -555,10 +554,10 @@ getting timeout messages."
 (make-variable-buffer-local 'js--state-at-last-parse-pos)
 
 (defun js--flatten-list (list)
-  (loop for item in list
-        nconc (cond ((consp item)
-                     (js--flatten-list item))
-                    (item (list item)))))
+  (cl-loop for item in list
+           nconc (cond ((consp item)
+                        (js--flatten-list item))
+                       (item (list item)))))
 
 (defun js--maybe-join (prefix separator suffix &rest list)
   "Helper function for `js--update-quick-match-re'.
@@ -768,13 +767,13 @@ If invoked while inside a macro, treat the macro as normal text."
   "Move forward over a whole JavaScript expression.
 This function doesn't move over expressions continued across
 lines."
-  (loop
+  (cl-loop
    ;; non-continued case; simplistic, but good enough?
-   do (loop until (or (eolp)
-                      (progn
-                        (forward-comment most-positive-fixnum)
-                        (memq (char-after) '(?\, ?\; ?\] ?\) ?\}))))
-            do (forward-sexp))
+   do (cl-loop until (or (eolp)
+                         (progn
+                           (forward-comment most-positive-fixnum)
+                           (memq (char-after) '(?\, ?\; ?\] ?\) ?\}))))
+               do (forward-sexp))
 
    while (and (eq (char-after) ?\n)
               (save-excursion
@@ -788,7 +787,7 @@ This puts point at the 'function' keyword.
 If this is a syntactically-correct non-expression function,
 return the name of the function, or t if the name could not be
 determined.  Otherwise, return nil."
-  (assert (looking-at "\\_<function\\_>"))
+  (cl-assert (looking-at "\\_<function\\_>"))
   (let ((name t))
     (forward-word)
     (forward-comment most-positive-fixnum)
@@ -847,32 +846,32 @@ anything."
   "Helper function for `js--beginning-of-defun-nested'.
 If PSTATE represents a non-empty top-level defun, return the
 top-most pitem.  Otherwise, return nil."
-  (loop for pitem in pstate
-        with func-depth = 0
-        with func-pitem
-        if (eq 'function (js--pitem-type pitem))
-        do (incf func-depth)
-        and do (setq func-pitem pitem)
-        finally return (if (eq func-depth 1) func-pitem)))
+  (cl-loop for pitem in pstate
+           with func-depth = 0
+           with func-pitem
+           if (eq 'function (js--pitem-type pitem))
+           do (cl-incf func-depth)
+           and do (setq func-pitem pitem)
+           finally return (if (eq func-depth 1) func-pitem)))
 
 (defun js--beginning-of-defun-nested ()
   "Helper function for `js--beginning-of-defun'.
 Return the pitem of the function we went to the beginning of."
   (or
    ;; Look for the smallest function that encloses point...
-   (loop for pitem in (js--parse-state-at-point)
-         if (and (eq 'function (js--pitem-type pitem))
-                 (js--inside-pitem-p pitem))
-         do (goto-char (js--pitem-h-begin pitem))
-         and return pitem)
+   (cl-loop for pitem in (js--parse-state-at-point)
+            if (and (eq 'function (js--pitem-type pitem))
+                    (js--inside-pitem-p pitem))
+            do (goto-char (js--pitem-h-begin pitem))
+            and return pitem)
 
    ;; ...and if that isn't found, look for the previous top-level
    ;; defun
-   (loop for pstate = (js--backward-pstate)
-         while pstate
-         if (js--pstate-is-toplevel-defun pstate)
-         do (goto-char (js--pitem-h-begin it))
-         and return it)))
+   (cl-loop for pstate = (js--backward-pstate)
+            while pstate
+            if (js--pstate-is-toplevel-defun pstate)
+            do (goto-char (js--pitem-h-begin it))
+            and return it)))
 
 (defun js--beginning-of-defun-flat ()
   "Helper function for `js-beginning-of-defun'."
@@ -884,7 +883,7 @@ Return the pitem of the function we went to the beginning of."
   "Value of `beginning-of-defun-function' for `js-mode'."
   (setq arg (or arg 1))
   (while (and (not (eobp)) (< arg 0))
-    (incf arg)
+    (cl-incf arg)
     (when (and (not js-flat-functions)
                (or (eq (js-syntactic-context) 'function)
                    (js--function-prologue-beginning)))
@@ -896,7 +895,7 @@ Return the pitem of the function we went to the beginning of."
       (goto-char (point-max))))
 
   (while (> arg 0)
-    (decf arg)
+    (cl-decf arg)
     ;; If we're just past the end of a function, the user probably wants
     ;; to go to the beginning of *that* function
     (when (eq (char-before) ?})
@@ -925,14 +924,14 @@ BEG defaults to `point-min', meaning to flush the entire cache."
 (defun js--ensure-cache--pop-if-ended (open-items paren-depth)
   (let ((top-item (car open-items)))
     (when (<= paren-depth (js--pitem-paren-depth top-item))
-      (assert (not (get-text-property (1- (point)) 'js-pend)))
+      (cl-assert (not (get-text-property (1- (point)) 'js-pend)))
       (put-text-property (1- (point)) (point) 'js--pend top-item)
       (setf (js--pitem-b-end top-item) (point))
       (setq open-items
             ;; open-items must contain at least two items for this to
             ;; work, but because we push a dummy item to start with,
             ;; that assumption holds.
-            (cons (js--pitem-add-child (second open-items) top-item)
+            (cons (js--pitem-add-child (cl-second open-items) top-item)
                   (cddr open-items)))))
   open-items)
 
@@ -950,7 +949,7 @@ the body of `js--ensure-cache'."
               ;; Make sure parse-partial-sexp doesn't stop because we *entered*
               ;; the given depth -- i.e., make sure we're deeper than the target
               ;; depth.
-              (assert (> (nth 0 parse)
+              (cl-assert (> (nth 0 parse)
                          (js--pitem-paren-depth (car open-items))))
               (setq parse (parse-partial-sexp
                            prev-parse-point goal-point
@@ -1036,24 +1035,19 @@ LIMIT defaults to point."
 
     (c-save-buffer-state
         (open-items
-         orig-match-start
-         orig-match-end
-         orig-depth
          parse
          prev-parse-point
          name
          case-fold-search
          filtered-class-styles
-         new-item
-         goal-point
-         end-prop)
+         goal-point)
 
       ;; Figure out which class styles we need to look for
       (setq filtered-class-styles
-            (loop for style in js--class-styles
-                  if (memq (plist-get style :framework)
-                           js-enabled-frameworks)
-                  collect style))
+            (cl-loop for style in js--class-styles
+                     if (memq (plist-get style :framework)
+                              js-enabled-frameworks)
+                     collect style))
 
       (save-excursion
         (save-restriction
@@ -1072,7 +1066,7 @@ LIMIT defaults to point."
               (unless (bobp)
                 (setq open-items (get-text-property (1- (point))
                                                     'js--pstate))
-                (assert open-items))))
+                (cl-assert open-items))))
 
           (unless open-items
             ;; Make a placeholder for the top-level definition
@@ -1085,97 +1079,98 @@ LIMIT defaults to point."
 
           (narrow-to-region (point-min) limit)
 
-          (loop while (re-search-forward js--quick-match-re-func nil t)
-                for orig-match-start = (goto-char (match-beginning 0))
-                for orig-match-end = (match-end 0)
-                do (js--ensure-cache--update-parse)
-                for orig-depth = (nth 0 parse)
-
-                ;; Each of these conditions should return non-nil if
-                ;; we should add a new item and leave point at the end
-                ;; of the new item's header (h-end in the
-                ;; js--pitem diagram). This point is the one
-                ;; after the last character we need to unambiguously
-                ;; detect this construct. If one of these evaluates to
-                ;; nil, the location of the point is ignored.
-                if (cond
-                    ;; In comment or string
-                    ((nth 8 parse) nil)
-
-                    ;; Regular function declaration
-                    ((and (looking-at "\\_<function\\_>")
-                          (setq name (js--forward-function-decl)))
-
-                     (when (eq name t)
-                       (setq name (js--guess-function-name orig-match-end))
-                       (if name
-                           (when js--guess-function-name-start
-                             (setq orig-match-start
-                                   js--guess-function-name-start))
-
-                         (setq name t)))
-
-                     (assert (eq (char-after) ?{))
-                     (forward-char)
-                     (make-js--pitem
-                      :paren-depth orig-depth
-                      :h-begin orig-match-start
-                      :type 'function
-                      :name (if (eq name t)
-                                name
-                              (js--split-name name))))
-
-                    ;; Macro
-                    ((looking-at js--macro-decl-re)
-
-                     ;; Macros often contain unbalanced parentheses.
-                     ;; Make sure that h-end is at the textual end of
-                     ;; the macro no matter what the parenthesis say.
-                     (c-end-of-macro)
-                     (js--ensure-cache--update-parse)
-
-                     (make-js--pitem
-                      :paren-depth (nth 0 parse)
-                      :h-begin orig-match-start
-                      :type 'macro
-                      :name (list (match-string-no-properties 1))))
-
-                    ;; "Prototype function" declaration
-                    ((looking-at js--plain-method-re)
-                     (goto-char (match-beginning 3))
-                     (when (save-match-data
-                             (js--forward-function-decl))
-                       (forward-char)
-                       (make-js--pitem
-                        :paren-depth orig-depth
-                        :h-begin orig-match-start
-                        :type 'function
-                        :name (nconc (js--split-name
-                                      (match-string-no-properties 1))
-                                     (list (match-string-no-properties 2))))))
-
-                    ;; Class definition
-                    ((loop with syntactic-context =
-                           (js--syntactic-context-from-pstate open-items)
-                           for class-style in filtered-class-styles
-                           if (and (memq syntactic-context
-                                         (plist-get class-style :contexts))
-                                   (looking-at (plist-get class-style
-                                                          :class-decl)))
-                           do (goto-char (match-end 0))
-                           and return
-                           (make-js--pitem
-                            :paren-depth orig-depth
-                            :h-begin orig-match-start
-                            :type class-style
-                            :name (js--split-name
-                                   (match-string-no-properties 1))))))
-
-                do (js--ensure-cache--update-parse)
-                and do (push it open-items)
-                and do (put-text-property
-                        (1- (point)) (point) 'js--pstate open-items)
-                else do (goto-char orig-match-end))
+          (cl-loop while (re-search-forward js--quick-match-re-func nil t)
+                   for orig-match-start = (goto-char (match-beginning 0))
+                   for orig-match-end = (match-end 0)
+                   do (js--ensure-cache--update-parse)
+                   for orig-depth = (nth 0 parse)
+
+                   ;; Each of these conditions should return non-nil if
+                   ;; we should add a new item and leave point at the end
+                   ;; of the new item's header (h-end in the
+                   ;; js--pitem diagram). This point is the one
+                   ;; after the last character we need to unambiguously
+                   ;; detect this construct. If one of these evaluates to
+                   ;; nil, the location of the point is ignored.
+                   if (cond
+                       ;; In comment or string
+                       ((nth 8 parse) nil)
+
+                       ;; Regular function declaration
+                       ((and (looking-at "\\_<function\\_>")
+                             (setq name (js--forward-function-decl)))
+
+                        (when (eq name t)
+                          (setq name (js--guess-function-name orig-match-end))
+                          (if name
+                              (when js--guess-function-name-start
+                                (setq orig-match-start
+                                      js--guess-function-name-start))
+
+                            (setq name t)))
+
+                        (cl-assert (eq (char-after) ?{))
+                        (forward-char)
+                        (make-js--pitem
+                         :paren-depth orig-depth
+                         :h-begin orig-match-start
+                         :type 'function
+                         :name (if (eq name t)
+                                   name
+                                 (js--split-name name))))
+
+                       ;; Macro
+                       ((looking-at js--macro-decl-re)
+
+                        ;; Macros often contain unbalanced parentheses.
+                        ;; Make sure that h-end is at the textual end of
+                        ;; the macro no matter what the parenthesis say.
+                        (c-end-of-macro)
+                        (js--ensure-cache--update-parse)
+
+                        (make-js--pitem
+                         :paren-depth (nth 0 parse)
+                         :h-begin orig-match-start
+                         :type 'macro
+                         :name (list (match-string-no-properties 1))))
+
+                       ;; "Prototype function" declaration
+                       ((looking-at js--plain-method-re)
+                        (goto-char (match-beginning 3))
+                        (when (save-match-data
+                                (js--forward-function-decl))
+                          (forward-char)
+                          (make-js--pitem
+                           :paren-depth orig-depth
+                           :h-begin orig-match-start
+                           :type 'function
+                           :name (nconc (js--split-name
+                                         (match-string-no-properties 1))
+                                        (list (match-string-no-properties 2))))))
+
+                       ;; Class definition
+                       ((cl-loop
+                         with syntactic-context =
+                         (js--syntactic-context-from-pstate open-items)
+                         for class-style in filtered-class-styles
+                         if (and (memq syntactic-context
+                                       (plist-get class-style :contexts))
+                                 (looking-at (plist-get class-style
+                                                        :class-decl)))
+                         do (goto-char (match-end 0))
+                         and return
+                         (make-js--pitem
+                          :paren-depth orig-depth
+                          :h-begin orig-match-start
+                          :type class-style
+                          :name (js--split-name
+                                 (match-string-no-properties 1))))))
+
+                   do (js--ensure-cache--update-parse)
+                   and do (push it open-items)
+                   and do (put-text-property
+                           (1- (point)) (point) 'js--pstate open-items)
+                   else do (goto-char orig-match-end))
 
           (goto-char limit)
           (js--ensure-cache--update-parse)
@@ -1186,12 +1181,12 @@ LIMIT defaults to point."
 
 (defun js--end-of-defun-flat ()
   "Helper function for `js-end-of-defun'."
-  (loop while (js--re-search-forward "}" nil t)
-        do (js--ensure-cache)
-        if (get-text-property (1- (point)) 'js--pend)
-        if (eq 'function (js--pitem-type it))
-        return t
-        finally do (goto-char (point-max))))
+  (cl-loop while (js--re-search-forward "}" nil t)
+           do (js--ensure-cache)
+           if (get-text-property (1- (point)) 'js--pend)
+           if (eq 'function (js--pitem-type it))
+           return t
+           finally do (goto-char (point-max))))
 
 (defun js--end-of-defun-nested ()
   "Helper function for `js-end-of-defun'."
@@ -1223,14 +1218,14 @@ LIMIT defaults to point."
   "Value of `end-of-defun-function' for `js-mode'."
   (setq arg (or arg 1))
   (while (and (not (bobp)) (< arg 0))
-    (incf arg)
+    (cl-incf arg)
     (js-beginning-of-defun)
     (js-beginning-of-defun)
     (unless (bobp)
       (js-end-of-defun)))
 
   (while (> arg 0)
-    (decf arg)
+    (cl-decf arg)
     ;; look for function backward. if we're inside it, go to that
     ;; function's end. otherwise, search for the next function's end and
     ;; go there
@@ -1354,7 +1349,7 @@ REGEXPS, but only if FRAMEWORK is in `js-enabled-frameworks'."
 If FUNC is supplied, call it with no arguments before every
 variable name in the spec.  Return true iff this was actually a
 spec.  FUNC must preserve the match data."
-  (case (char-after)
+  (pcase (char-after)
     (?\[
      (forward-char)
      (while
@@ -1559,8 +1554,8 @@ point of view of font-lock.  It applies highlighting directly with
 (defun js--inside-pitem-p (pitem)
   "Return whether point is inside the given pitem's header or body."
   (js--ensure-cache)
-  (assert (js--pitem-h-begin pitem))
-  (assert (js--pitem-paren-depth pitem))
+  (cl-assert (js--pitem-h-begin pitem))
+  (cl-assert (js--pitem-paren-depth pitem))
 
   (and (> (point) (js--pitem-h-begin pitem))
        (or (null (js--pitem-b-end pitem))
@@ -1581,11 +1576,11 @@ will be returned."
 
         ;; Loop until we either hit a pitem at BOB or pitem ends after
         ;; point (or at point if we're at eob)
-        (loop for pitem = (car pstate)
-              until (or (eq (js--pitem-type pitem)
-                            'toplevel)
-                        (js--inside-pitem-p pitem))
-              do (pop pstate))
+        (cl-loop for pitem = (car pstate)
+                 until (or (eq (js--pitem-type pitem)
+                               'toplevel)
+                           (js--inside-pitem-p pitem))
+                 do (pop pstate))
 
         pstate))))
 
@@ -1614,22 +1609,22 @@ context."
 (defun js--class-decl-matcher (limit)
   "Font lock function used by `js-mode'.
 This performs fontification according to `js--class-styles'."
-  (loop initially (js--ensure-cache limit)
-        while (re-search-forward js--quick-match-re limit t)
-        for orig-end = (match-end 0)
-        do (goto-char (match-beginning 0))
-        if (loop for style in js--class-styles
-                 for decl-re = (plist-get style :class-decl)
-                 if (and (memq (plist-get style :framework)
-                               js-enabled-frameworks)
-                         (memq (js-syntactic-context)
-                               (plist-get style :contexts))
-                         decl-re
-                         (looking-at decl-re))
-                 do (goto-char (match-end 0))
-                 and return t)
-        return t
-        else do (goto-char orig-end)))
+  (cl-loop initially (js--ensure-cache limit)
+           while (re-search-forward js--quick-match-re limit t)
+           for orig-end = (match-end 0)
+           do (goto-char (match-beginning 0))
+           if (cl-loop for style in js--class-styles
+                       for decl-re = (plist-get style :class-decl)
+                       if (and (memq (plist-get style :framework)
+                                     js-enabled-frameworks)
+                               (memq (js-syntactic-context)
+                                     (plist-get style :contexts))
+                               decl-re
+                               (looking-at decl-re))
+                       do (goto-char (match-end 0))
+                       and return t)
+           return t
+           else do (goto-char orig-end)))
 
 (defconst js--font-lock-keywords
   '(js--font-lock-keywords-3 js--font-lock-keywords-1
@@ -1651,6 +1646,11 @@ This performs fontification according to `js--class-styles'."
   (funcall
    (syntax-propertize-rules
     ;; Distinguish /-division from /-regexp chars (and from /-comment-starter).
+    ;; FIXME: Allow regexps after infix ops like + ...
+    ;; https://developer.mozilla.org/en/JavaScript/Reference/Operators
+    ;; We can probably just add +, -, !, <, >, %, ^, ~, |, &, ?, : at which
+    ;; point I think only * and / would be missing which could also be added,
+    ;; but need care to avoid affecting the // and */ comment markers.
     ("\\(?:^\\|[=([{,:;]\\)\\(?:[ \t]\\)*\\(/\\)[^/*]"
      (1 (ignore
         (forward-char -1)
@@ -1789,7 +1789,7 @@ nil."
                              js-expr-indent-offset))
                          (t
                           (+ (current-column) js-indent-level
-                             (case (char-after (nth 1 parse-status))
+                             (pcase (char-after (nth 1 parse-status))
                                (?\( js-paren-indent-offset)
                                (?\[ js-square-indent-offset)
                                (?\{ js-curly-indent-offset))))))
@@ -1821,15 +1821,17 @@ nil."
 (defun js-c-fill-paragraph (&optional justify)
   "Fill the paragraph with `c-fill-paragraph'."
   (interactive "*P")
-  (flet ((c-forward-sws
-          (&optional limit)
-          (js--forward-syntactic-ws limit))
-         (c-backward-sws
-          (&optional limit)
-          (js--backward-syntactic-ws limit))
-         (c-beginning-of-macro
-          (&optional limit)
-          (js--beginning-of-macro limit)))
+  ;; FIXME: Such redefinitions are bad style.  We should try and use some other
+  ;; way to get the same result.
+  (cl-letf (((symbol-function 'c-forward-sws)
+             (lambda (&optional limit)
+               (js--forward-syntactic-ws limit)))
+            ((symbol-function 'c-backward-sws)
+             (lambda (&optional limit)
+               (js--backward-syntactic-ws limit)))
+            ((symbol-function 'c-beginning-of-macro)
+             (lambda (&optional limit)
+               (js--beginning-of-macro limit))))
     (let ((fill-paragraph-function 'c-fill-paragraph))
       (c-fill-paragraph justify))))
 
@@ -1924,8 +1926,8 @@ the broken-down class name of the item to insert."
              name-parts
              (mapcar #'js--pitem-name items))
 
-    (assert (stringp top-name))
-    (assert (> (length top-name) 0))
+    (cl-assert (stringp top-name))
+    (cl-assert (> (length top-name) 0))
 
     ;; If top-name isn't found in items, then we build a copy of items
     ;; and throw it away. But that's okay, since most of the time, we
@@ -1990,10 +1992,10 @@ the broken-down class name of the item to insert."
 
 (defun js--pitem-add-child (pitem child)
   "Copy `js--pitem' PITEM, and push CHILD onto its list of children."
-  (assert (integerp (js--pitem-h-begin child)))
-  (assert (if (consp (js--pitem-name child))
-              (loop for part in (js--pitem-name child)
-                    always (stringp part))
+  (cl-assert (integerp (js--pitem-h-begin child)))
+  (cl-assert (if (consp (js--pitem-name child))
+              (cl-loop for part in (js--pitem-name child)
+                       always (stringp part))
             t))
 
   ;; This trick works because we know (based on our defstructs) that
@@ -2015,7 +2017,7 @@ the broken-down class name of the item to insert."
             ;; name is a list here because down in
             ;; `js--ensure-cache', we made sure to only add
             ;; class entries with lists for :name
-            (assert (consp name))
+            (cl-assert (consp name))
             (js--splice-into-items (car pitem) child name))
 
            (t
@@ -2040,11 +2042,11 @@ the broken-down class name of the item to insert."
       (setq pitem-name (js--pitem-strname pitem))
       (when (eq pitem-name t)
         (setq pitem-name (format "[unknown %s]"
-                                 (incf (car unknown-ctr)))))
+                                 (cl-incf (car unknown-ctr)))))
 
       (cond
        ((memq pitem-type '(function macro))
-        (assert (integerp (js--pitem-h-begin pitem)))
+        (cl-assert (integerp (js--pitem-h-begin pitem)))
         (push (cons pitem-name
                     (js--maybe-make-marker
                      (js--pitem-h-begin pitem)))
@@ -2059,7 +2061,7 @@ the broken-down class name of the item to insert."
                      imenu-items))
 
               ((js--pitem-h-begin pitem)
-               (assert (integerp (js--pitem-h-begin pitem)))
+               (cl-assert (integerp (js--pitem-h-begin pitem)))
                (setq subitems (list
                                (cons "[empty]"
                                      (js--maybe-make-marker
@@ -2078,7 +2080,7 @@ the broken-down class name of the item to insert."
       (widen)
       (goto-char (point-max))
       (js--ensure-cache)
-      (assert (or (= (point-min) (point-max))
+      (cl-assert (or (= (point-min) (point-max))
                   (eq js--last-parse-pos (point))))
       (when js--last-parse-pos
         (let ((state js--state-at-last-parse-pos)
@@ -2087,10 +2089,10 @@ the broken-down class name of the item to insert."
           ;; Make sure everything is closed
           (while (cdr state)
             (setq state
-                  (cons (js--pitem-add-child (second state) (car state))
+                  (cons (js--pitem-add-child (cl-second state) (car state))
                         (cddr state))))
 
-          (assert (= (length state) 1))
+          (cl-assert (= (length state) 1))
 
           ;; Convert the new-finalized state into what imenu expects
           (js--pitems-to-imenu
@@ -2104,34 +2106,34 @@ the broken-down class name of the item to insert."
   (mapconcat #'identity parts "."))
 
 (defun js--imenu-to-flat (items prefix symbols)
-  (loop for item in items
-        if (imenu--subalist-p item)
-        do (js--imenu-to-flat
-            (cdr item) (concat prefix (car item) ".")
-            symbols)
-        else
-        do (let* ((name (concat prefix (car item)))
-                  (name2 name)
-                  (ctr 0))
+  (cl-loop for item in items
+           if (imenu--subalist-p item)
+           do (js--imenu-to-flat
+               (cdr item) (concat prefix (car item) ".")
+               symbols)
+           else
+           do (let* ((name (concat prefix (car item)))
+                     (name2 name)
+                     (ctr 0))
 
-             (while (gethash name2 symbols)
-               (setq name2 (format "%s<%d>" name (incf ctr))))
+                (while (gethash name2 symbols)
+                  (setq name2 (format "%s<%d>" name (cl-incf ctr))))
 
-             (puthash name2 (cdr item) symbols))))
+                (puthash name2 (cdr item) symbols))))
 
 (defun js--get-all-known-symbols ()
   "Return a hash table of all JavaScript symbols.
 This searches all existing `js-mode' buffers. Each key is the
 name of a symbol (possibly disambiguated with <N>, where N > 1),
 and each value is a marker giving the location of that symbol."
-  (loop with symbols = (make-hash-table :test 'equal)
-        with imenu-use-markers = t
-        for buffer being the buffers
-        for imenu-index = (with-current-buffer buffer
-                            (when (derived-mode-p 'js-mode)
-                              (js--imenu-create-index)))
-        do (js--imenu-to-flat imenu-index "" symbols)
-        finally return symbols))
+  (cl-loop with symbols = (make-hash-table :test 'equal)
+           with imenu-use-markers = t
+           for buffer being the buffers
+           for imenu-index = (with-current-buffer buffer
+                               (when (derived-mode-p 'js-mode)
+                                 (js--imenu-create-index)))
+           do (js--imenu-to-flat imenu-index "" symbols)
+           finally return symbols))
 
 (defvar js--symbol-history nil
   "History of entered JavaScript symbols.")
@@ -2149,8 +2151,8 @@ marker."
 
   (let ((choice (ido-completing-read
                  prompt
-                 (loop for key being the hash-keys of symbols-table
-                       collect key)
+                 (cl-loop for key being the hash-keys of symbols-table
+                          collect key)
                  nil t initial-input 'js--symbol-history)))
     (cons choice (gethash choice symbols-table))))
 
@@ -2204,20 +2206,20 @@ On timeout, return nil.  On success, return t with match data
 set.  If START is non-nil, look for output starting from START.
 Otherwise, use the current value of `process-mark'."
   (with-current-buffer (process-buffer process)
-    (loop with start-pos = (or start
-                               (marker-position (process-mark process)))
-          with end-time = (+ (float-time) timeout)
-          for time-left = (- end-time (float-time))
-          do (goto-char (point-max))
-          if (looking-back regexp start-pos) return t
-          while (> time-left 0)
-          do (accept-process-output process time-left nil t)
-          do (goto-char (process-mark process))
-          finally do (signal
-                      'js-moz-bad-rpc
-                      (list (format "Timed out waiting for output matching %S" regexp))))))
-
-(defstruct js--js-handle
+    (cl-loop with start-pos = (or start
+                                  (marker-position (process-mark process)))
+             with end-time = (+ (float-time) timeout)
+             for time-left = (- end-time (float-time))
+             do (goto-char (point-max))
+             if (looking-back regexp start-pos) return t
+             while (> time-left 0)
+             do (accept-process-output process time-left nil t)
+             do (goto-char (process-mark process))
+             finally do (signal
+                         'js-moz-bad-rpc
+                         (list (format "Timed out waiting for output matching %S" regexp))))))
+
+(cl-defstruct js--js-handle
   ;; Integer, mirrors the value we see in JS
   (id nil :read-only t)
 
@@ -2626,11 +2628,11 @@ with `js--js-encode-value'."
        (inferior-moz-process) js--js-repl-prompt-regexp
        js-js-timeout))
 
-    (incf js--js-repl-depth)))
+    (cl-incf js--js-repl-depth)))
 
 (defun js--js-leave-repl ()
-  (assert (> js--js-repl-depth 0))
-  (when (= 0 (decf js--js-repl-depth))
+  (cl-assert (> js--js-repl-depth 0))
+  (when (= 0 (cl-decf js--js-repl-depth))
     (with-current-buffer inferior-moz-buffer
       (goto-char (point-max))
       (js--js-wait-for-eval-prompt)
@@ -2649,33 +2651,33 @@ with `js--js-encode-value'."
 (eval-and-compile
   (defun js--optimize-arglist (arglist)
     "Convert immediate js< and js! references to deferred ones."
-    (loop for item in arglist
-          if (eq (car-safe item) 'js<)
-          collect (append (list 'list ''js--funcall
-                                '(list 'interactor "_getProp"))
-                          (js--optimize-arglist (cdr item)))
-          else if (eq (car-safe item) 'js>)
-          collect (append (list 'list ''js--funcall
-                                '(list 'interactor "_putProp"))
-
-                          (if (atom (cadr item))
-                              (list (cadr item))
-                            (list
-                             (append
-                              (list 'list ''js--funcall
-                                    '(list 'interactor "_mkArray"))
-                              (js--optimize-arglist (cadr item)))))
-                          (js--optimize-arglist (cddr item)))
-          else if (eq (car-safe item) 'js!)
-          collect (destructuring-bind (ignored function &rest body) item
-                    (append (list 'list ''js--funcall
-                                  (if (consp function)
-                                      (cons 'list
-                                            (js--optimize-arglist function))
-                                    function))
-                            (js--optimize-arglist body)))
-          else
-          collect item)))
+    (cl-loop for item in arglist
+             if (eq (car-safe item) 'js<)
+             collect (append (list 'list ''js--funcall
+                                   '(list 'interactor "_getProp"))
+                             (js--optimize-arglist (cdr item)))
+             else if (eq (car-safe item) 'js>)
+             collect (append (list 'list ''js--funcall
+                                   '(list 'interactor "_putProp"))
+
+                             (if (atom (cadr item))
+                                 (list (cadr item))
+                               (list
+                                (append
+                                 (list 'list ''js--funcall
+                                       '(list 'interactor "_mkArray"))
+                                 (js--optimize-arglist (cadr item)))))
+                             (js--optimize-arglist (cddr item)))
+             else if (eq (car-safe item) 'js!)
+             collect (pcase-let ((`(,_ ,function . ,body) item))
+                       (append (list 'list ''js--funcall
+                                     (if (consp function)
+                                         (cons 'list
+                                               (js--optimize-arglist function))
+                                       function))
+                               (js--optimize-arglist body)))
+             else
+             collect item)))
 
 (defmacro js--js-get-service (class-name interface-name)
     `(js! ("Components" "classes" ,class-name "getService")
@@ -2698,56 +2700,56 @@ Inside the lexical scope of `with-js', `js?', `js!',
   `(progn
      (js--js-enter-repl)
      (unwind-protect
-         (macrolet ((js? (&rest body) `(js--js-true ,@body))
-                    (js! (function &rest body)
-                         `(js--js-funcall
-                           ,(if (consp function)
-                                (cons 'list
-                                      (js--optimize-arglist function))
-                              function)
-                           ,@(js--optimize-arglist body)))
-
-                    (js-new (function &rest body)
-                            `(js--js-new
+         (cl-macrolet ((js? (&rest body) `(js--js-true ,@body))
+                       (js! (function &rest body)
+                            `(js--js-funcall
                               ,(if (consp function)
                                    (cons 'list
                                          (js--optimize-arglist function))
                                  function)
-                              ,@body))
-
-                    (js-eval (thisobj js)
-                            `(js--js-eval
-                              ,@(js--optimize-arglist
-                                 (list thisobj js))))
-
-                    (js-list (&rest args)
-                             `(js--js-list
-                               ,@(js--optimize-arglist args)))
-
-                    (js-get-service (&rest args)
-                                    `(js--js-get-service
-                                      ,@(js--optimize-arglist args)))
-
-                    (js-create-instance (&rest args)
-                                        `(js--js-create-instance
-                                          ,@(js--optimize-arglist args)))
-
-                    (js-qi (&rest args)
-                           `(js--js-qi
-                             ,@(js--optimize-arglist args)))
-
-                    (js< (&rest body) `(js--js-get
-                                        ,@(js--optimize-arglist body)))
-                    (js> (props value)
-                         `(js--js-funcall
-                           '(interactor "_putProp")
-                           ,(if (consp props)
-                                (cons 'list
-                                      (js--optimize-arglist props))
-                              props)
-                           ,@(js--optimize-arglist (list value))
-                           ))
-                    (js-handle? (arg) `(js--js-handle-p ,arg)))
+                              ,@(js--optimize-arglist body)))
+
+                       (js-new (function &rest body)
+                               `(js--js-new
+                                 ,(if (consp function)
+                                      (cons 'list
+                                            (js--optimize-arglist function))
+                                    function)
+                                 ,@body))
+
+                       (js-eval (thisobj js)
+                                `(js--js-eval
+                                  ,@(js--optimize-arglist
+                                     (list thisobj js))))
+
+                       (js-list (&rest args)
+                                `(js--js-list
+                                  ,@(js--optimize-arglist args)))
+
+                       (js-get-service (&rest args)
+                                       `(js--js-get-service
+                                         ,@(js--optimize-arglist args)))
+
+                       (js-create-instance (&rest args)
+                                           `(js--js-create-instance
+                                             ,@(js--optimize-arglist args)))
+
+                       (js-qi (&rest args)
+                              `(js--js-qi
+                                ,@(js--optimize-arglist args)))
+
+                       (js< (&rest body) `(js--js-get
+                                           ,@(js--optimize-arglist body)))
+                       (js> (props value)
+                            `(js--js-funcall
+                              '(interactor "_putProp")
+                              ,(if (consp props)
+                                   (cons 'list
+                                         (js--optimize-arglist props))
+                                 props)
+                              ,@(js--optimize-arglist (list value))
+                              ))
+                       (js-handle? (arg) `(js--js-handle-p ,arg)))
            ,@forms)
        (js--js-leave-repl))))
 
@@ -2756,21 +2758,22 @@ Inside the lexical scope of `with-js', `js?', `js!',
 If nil, the whole Array is treated as a JS symbol.")
 
 (defun js--js-decode-retval (result)
-  (ecase (intern (first result))
-         (atom (second result))
-         (special (intern (second result)))
-         (array
-          (mapcar #'js--js-decode-retval (second result)))
-         (objid
-          (or (gethash (second result)
-                       js--js-references)
-              (puthash (second result)
-                       (make-js--js-handle
-                        :id (second result)
-                        :process (inferior-moz-process))
-                       js--js-references)))
-
-         (error (signal 'js-js-error (list (second result))))))
+  (pcase (intern (cl-first result))
+    (`atom (cl-second result))
+    (`special (intern (cl-second result)))
+    (`array
+     (mapcar #'js--js-decode-retval (cl-second result)))
+    (`objid
+     (or (gethash (cl-second result)
+                  js--js-references)
+         (puthash (cl-second result)
+                  (make-js--js-handle
+                   :id (cl-second result)
+                   :process (inferior-moz-process))
+                  js--js-references)))
+
+    (`error (signal 'js-js-error (list (cl-second result))))
+    (x (error "Unmatched case in js--js-decode-retval: %S" x))))
 
 (defun js--js-funcall (function &rest arguments)
   "Call the Mozilla function FUNCTION with arguments ARGUMENTS.
@@ -2853,9 +2856,9 @@ With argument, run even if no intervening GC has happened."
                    (looking-back js--js-prompt-regexp
                                  (save-excursion (forward-line 0) (point))))))
 
-      (setq keys (loop for x being the hash-keys
-                       of js--js-references
-                       collect x))
+      (setq keys (cl-loop for x being the hash-keys
+                          of js--js-references
+                          collect x))
       (setq num (js--js-funcall '(repl "_jsGC") (or keys [])))
 
       (setq js--js-last-gcs-done this-gcs-done)
@@ -2889,58 +2892,58 @@ left-to-right."
   (with-js
    (let (windows)
 
-     (loop with window-mediator = (js! ("Components" "classes"
-                                        "@mozilla.org/appshell/window-mediator;1"
-                                        "getService")
-                                       (js< "Components" "interfaces"
-                                            "nsIWindowMediator"))
-           with enumerator = (js! (window-mediator "getEnumerator") nil)
-
-           while (js? (js! (enumerator "hasMoreElements")))
-           for window = (js! (enumerator "getNext"))
-           for window-info = (js-list window
-                                      (js< window "document" "title")
-                                      (js! (window "location" "toString"))
-                                      (js< window "closed")
-                                      (js< window "windowState"))
-
-           unless (or (js? (fourth window-info))
-                      (eq (fifth window-info) 2))
-           do (push window-info windows))
-
-     (loop for window-info in windows
-           for window = (first window-info)
-           collect (list (second window-info)
-                         (third window-info)
-                         window)
-
-           for gbrowser = (js< window "gBrowser")
-           if (js-handle? gbrowser)
-           nconc (loop
-                  for x below (js< gbrowser "browsers" "length")
-                  collect (js-list (js< gbrowser
-                                        "browsers"
-                                        x
-                                        "contentDocument"
-                                        "title")
-
-                                   (js! (gbrowser
-                                         "browsers"
-                                         x
-                                         "contentWindow"
-                                         "location"
-                                         "toString"))
-                                   (js< gbrowser
-                                        "browsers"
-                                        x)
-
-                                   (js! (gbrowser
-                                         "tabContainer"
-                                         "childNodes"
-                                         "item")
-                                        x)
-
-                                   gbrowser))))))
+     (cl-loop with window-mediator = (js! ("Components" "classes"
+                                           "@mozilla.org/appshell/window-mediator;1"
+                                           "getService")
+                                          (js< "Components" "interfaces"
+                                               "nsIWindowMediator"))
+              with enumerator = (js! (window-mediator "getEnumerator") nil)
+
+              while (js? (js! (enumerator "hasMoreElements")))
+              for window = (js! (enumerator "getNext"))
+              for window-info = (js-list window
+                                         (js< window "document" "title")
+                                         (js! (window "location" "toString"))
+                                         (js< window "closed")
+                                         (js< window "windowState"))
+
+              unless (or (js? (cl-fourth window-info))
+                         (eq (cl-fifth window-info) 2))
+              do (push window-info windows))
+
+     (cl-loop for window-info in windows
+              for window = (cl-first window-info)
+              collect (list (cl-second window-info)
+                            (cl-third window-info)
+                            window)
+
+              for gbrowser = (js< window "gBrowser")
+              if (js-handle? gbrowser)
+              nconc (cl-loop
+                     for x below (js< gbrowser "browsers" "length")
+                     collect (js-list (js< gbrowser
+                                           "browsers"
+                                           x
+                                           "contentDocument"
+                                           "title")
+
+                                      (js! (gbrowser
+                                            "browsers"
+                                            x
+                                            "contentWindow"
+                                            "location"
+                                            "toString"))
+                                      (js< gbrowser
+                                           "browsers"
+                                           x)
+
+                                      (js! (gbrowser
+                                            "tabContainer"
+                                            "childNodes"
+                                            "item")
+                                           x)
+
+                                      gbrowser))))))
 
 (defvar js-read-tab-history nil)
 
@@ -2956,111 +2959,114 @@ browser, respectively."
     (ido-mode -1))
 
   (with-js
-   (lexical-let ((tabs (js--get-tabs)) selected-tab-cname
-                 selected-tab prev-hitab)
+   (let ((tabs (js--get-tabs)) selected-tab-cname
+         selected-tab prev-hitab)
 
      ;; Disambiguate names
-     (setq tabs (loop with tab-names = (make-hash-table :test 'equal)
-                      for tab in tabs
-                      for cname = (format "%s (%s)" (second tab) (first tab))
-                      for num = (incf (gethash cname tab-names -1))
-                      if (> num 0)
-                      do (setq cname (format "%s <%d>" cname num))
-                      collect (cons cname tab)))
-
-     (labels ((find-tab-by-cname
-               (cname)
-               (loop for tab in tabs
-                     if (equal (car tab) cname)
-                     return (cdr tab)))
-
-              (mogrify-highlighting
-               (hitab unhitab)
-
-               ;; Hack to reduce the number of
-               ;; round-trips to mozilla
-               (let (cmds)
-                 (cond
-                  ;; Highlighting tab
-                  ((fourth hitab)
-                   (push '(js! ((fourth hitab) "setAttribute")
-                               "style"
-                               "color: red; font-weight: bold")
-                         cmds)
-
-                   ;; Highlight window proper
-                   (push '(js! ((third hitab)
-                                "setAttribute")
-                               "style"
-                               "border: 8px solid red")
-                         cmds)
-
-                   ;; Select tab, when appropriate
-                   (when js-js-switch-tabs
-                     (push
-                      '(js> ((fifth hitab) "selectedTab") (fourth hitab))
-                      cmds)))
-
-                  ;; Highlighting whole window
-                  ((third hitab)
-                   (push '(js! ((third hitab) "document"
-                                "documentElement" "setAttribute")
-                               "style"
-                               (concat "-moz-appearance: none;"
-                                       "border: 8px solid red;"))
-                         cmds)))
-
-                 (cond
-                  ;; Unhighlighting tab
-                  ((fourth unhitab)
-                   (push '(js! ((fourth unhitab) "setAttribute") "style" "")
-                         cmds)
-                   (push '(js! ((third unhitab) "setAttribute") "style" "")
-                         cmds))
-
-                  ;; Unhighlighting window
-                  ((third unhitab)
-                   (push '(js! ((third unhitab) "document"
-                                "documentElement" "setAttribute")
-                               "style" "")
-                         cmds)))
-
-                 (eval (list 'with-js
-                             (cons 'js-list (nreverse cmds))))))
-
-              (command-hook
-               ()
-               (let* ((tab (find-tab-by-cname (car ido-matches))))
-                 (mogrify-highlighting tab prev-hitab)
-                 (setq prev-hitab tab)))
-
-              (setup-hook
-               ()
-               ;; Fiddle with the match list a bit: if our first match
-               ;; is a tabbrowser window, rotate the match list until
-               ;; the active tab comes up
-               (let ((matched-tab (find-tab-by-cname (car ido-matches))))
-                 (when (and matched-tab
-                            (null (fourth matched-tab))
-                            (equal "navigator:browser"
-                                   (js! ((third matched-tab)
-                                         "document"
-                                         "documentElement"
-                                         "getAttribute")
-                                        "windowtype")))
-
-                   (loop with tab-to-match = (js< (third matched-tab)
-                                                  "gBrowser"
-                                                  "selectedTab")
-
-                         with index = 0
-                         for match in ido-matches
-                         for candidate-tab = (find-tab-by-cname match)
-                         if (eq (fourth candidate-tab) tab-to-match)
-                         do (setq ido-cur-list (ido-chop ido-cur-list match))
-                         and return t)))
-
-               (add-hook 'post-command-hook #'command-hook t t)))
+     (setq tabs
+           (cl-loop with tab-names = (make-hash-table :test 'equal)
+                    for tab in tabs
+                    for cname = (format "%s (%s)"
+                                        (cl-second tab) (cl-first tab))
+                    for num = (cl-incf (gethash cname tab-names -1))
+                    if (> num 0)
+                    do (setq cname (format "%s <%d>" cname num))
+                    collect (cons cname tab)))
+
+     (cl-labels
+         ((find-tab-by-cname
+           (cname)
+           (cl-loop for tab in tabs
+                    if (equal (car tab) cname)
+                    return (cdr tab)))
+
+          (mogrify-highlighting
+           (hitab unhitab)
+
+           ;; Hack to reduce the number of
+           ;; round-trips to mozilla
+           (let (cmds)
+             (cond
+              ;; Highlighting tab
+              ((cl-fourth hitab)
+               (push '(js! ((cl-fourth hitab) "setAttribute")
+                       "style"
+                       "color: red; font-weight: bold")
+                     cmds)
+
+               ;; Highlight window proper
+               (push '(js! ((cl-third hitab)
+                            "setAttribute")
+                       "style"
+                       "border: 8px solid red")
+                     cmds)
+
+               ;; Select tab, when appropriate
+               (when js-js-switch-tabs
+                 (push
+                  '(js> ((cl-fifth hitab) "selectedTab") (cl-fourth hitab))
+                  cmds)))
+
+              ;; Highlighting whole window
+              ((cl-third hitab)
+               (push '(js! ((cl-third hitab) "document"
+                            "documentElement" "setAttribute")
+                       "style"
+                       (concat "-moz-appearance: none;"
+                               "border: 8px solid red;"))
+                     cmds)))
+
+             (cond
+              ;; Unhighlighting tab
+              ((cl-fourth unhitab)
+               (push '(js! ((cl-fourth unhitab) "setAttribute") "style" "")
+                     cmds)
+               (push '(js! ((cl-third unhitab) "setAttribute") "style" "")
+                     cmds))
+
+              ;; Unhighlighting window
+              ((cl-third unhitab)
+               (push '(js! ((cl-third unhitab) "document"
+                            "documentElement" "setAttribute")
+                       "style" "")
+                     cmds)))
+
+             (eval (list 'with-js
+                         (cons 'js-list (nreverse cmds))))))
+
+          (command-hook
+           ()
+           (let* ((tab (find-tab-by-cname (car ido-matches))))
+             (mogrify-highlighting tab prev-hitab)
+             (setq prev-hitab tab)))
+
+          (setup-hook
+           ()
+           ;; Fiddle with the match list a bit: if our first match
+           ;; is a tabbrowser window, rotate the match list until
+           ;; the active tab comes up
+           (let ((matched-tab (find-tab-by-cname (car ido-matches))))
+             (when (and matched-tab
+                        (null (cl-fourth matched-tab))
+                        (equal "navigator:browser"
+                               (js! ((cl-third matched-tab)
+                                     "document"
+                                     "documentElement"
+                                     "getAttribute")
+                                    "windowtype")))
+
+               (cl-loop with tab-to-match = (js< (cl-third matched-tab)
+                                                 "gBrowser"
+                                                 "selectedTab")
+
+                        for match in ido-matches
+                        for candidate-tab = (find-tab-by-cname match)
+                        if (eq (cl-fourth candidate-tab) tab-to-match)
+                        do (setq ido-cur-list
+                                 (ido-chop ido-cur-list match))
+                        and return t)))
+
+           (add-hook 'post-command-hook #'command-hook t t)))
 
 
        (unwind-protect
@@ -3079,13 +3085,12 @@ browser, respectively."
 
        (add-to-history 'js-read-tab-history selected-tab-cname)
 
-       (setq selected-tab (loop for tab in tabs
-                                if (equal (car tab) selected-tab-cname)
-                                return (cdr tab)))
+       (setq selected-tab (cl-loop for tab in tabs
+                                   if (equal (car tab) selected-tab-cname)
+                                   return (cdr tab)))
 
-       (if (fourth selected-tab)
-           (cons 'browser (third selected-tab))
-         (cons 'window (third selected-tab)))))))
+       (cons (if (cl-fourth selected-tab) 'browser 'window)
+             (cl-third selected-tab))))))
 
 (defun js--guess-eval-defun-info (pstate)
   "Helper function for `js-eval-defun'.
@@ -3093,19 +3098,19 @@ Return a list (NAME . CLASSPARTS), where CLASSPARTS is a list of
 strings making up the class name and NAME is the name of the
 function part."
   (cond ((and (= (length pstate) 3)
-              (eq (js--pitem-type (first pstate)) 'function)
-              (= (length (js--pitem-name (first pstate))) 1)
-              (consp (js--pitem-type (second pstate))))
+              (eq (js--pitem-type (cl-first pstate)) 'function)
+              (= (length (js--pitem-name (cl-first pstate))) 1)
+              (consp (js--pitem-type (cl-second pstate))))
 
-         (append (js--pitem-name (second pstate))
-                 (list (first (js--pitem-name (first pstate))))))
+         (append (js--pitem-name (cl-second pstate))
+                 (list (cl-first (js--pitem-name (cl-first pstate))))))
 
         ((and (= (length pstate) 2)
-              (eq (js--pitem-type (first pstate)) 'function))
+              (eq (js--pitem-type (cl-first pstate)) 'function))
 
          (append
-          (butlast (js--pitem-name (first pstate)))
-          (list (car (last (js--pitem-name (first pstate)))))))
+          (butlast (js--pitem-name (cl-first pstate)))
+          (list (car (last (js--pitem-name (cl-first pstate)))))))
 
         (t (error "Function not a toplevel defun or class member"))))
 
@@ -3149,19 +3154,21 @@ If one hasn't been set, or if it's stale, prompt for a new one."
   (with-js
    (when (or (null js--js-context)
              (js--js-handle-expired-p (cdr js--js-context))
-             (ecase (car js--js-context)
-               (window (js? (js< (cdr js--js-context) "closed")))
-               (browser (not (js? (js< (cdr js--js-context)
-                                       "contentDocument"))))))
+             (pcase (car js--js-context)
+               (`window (js? (js< (cdr js--js-context) "closed")))
+               (`browser (not (js? (js< (cdr js--js-context)
+                                        "contentDocument"))))
+               (x (error "Unmatched case in js--get-js-context: %S" x))))
      (setq js--js-context (js--read-tab "Javascript Context: ")))
    js--js-context))
 
 (defun js--js-content-window (context)
   (with-js
-   (ecase (car context)
-     (window (cdr context))
-     (browser (js< (cdr context)
-                   "contentWindow" "wrappedJSObject")))))
+   (pcase (car context)
+     (`window (cdr context))
+     (`browser (js< (cdr context)
+                    "contentWindow" "wrappedJSObject"))
+     (x (error "Unmatched case in js--js-content-window: %S" x)))))
 
 (defun js--make-nsilocalfile (path)
   (with-js
@@ -3180,7 +3187,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
           (path-uri (js! (io-service "newFileURI") path-file)))
      (js! (res-prot "setSubstitution") alias path-uri))))
 
-(defun* js-eval-defun ()
+(cl-defun js-eval-defun ()
   "Update a Mozilla tab using the JavaScript defun at point."
   (interactive)
 
@@ -3216,7 +3223,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
             (unless (y-or-n-p (format "Send %s to Mozilla? "
                                       (mapconcat #'identity defun-info ".")))
               (message "") ; question message lingers until next command
-              (return-from js-eval-defun))
+              (cl-return-from js-eval-defun))
           (delete-overlay overlay)))
 
       (setq defun-body (buffer-substring-no-properties begin end))
@@ -3330,7 +3337,7 @@ If one hasn't been set, or if it's stale, prompt for a new one."
         comment-start-skip "\\(//+\\|/\\*+\\)\\s *")
 
   (set (make-local-variable 'electric-indent-chars)
-       (append "{}():;," electric-indent-chars))
+       (append "{}():;," electric-indent-chars)) ;FIXME: js2-mode adds "[]*".
   (set (make-local-variable 'electric-layout-rules)
        '((?\; . after) (?\{ . after) (?\} . before)))
 
index b1884bd105b8155369a5b7111b3bf0788a9d876e..20f91ce2d9e1493dca3e86eb61dc33b4d32fb1f3 100644 (file)
@@ -80,7 +80,7 @@
   "Default font-lock-keywords for `m4 mode'.")
 
 (defcustom m4-mode-hook nil
-  "*Hook called by `m4-mode'."
+  "Hook called by `m4-mode'."
   :type 'hook
   :group 'm4)
 
index b4ca1ba665f453a98977185fa99e71fe9efeb791..2f4419ba2ea71ef20cb96baff7efa7ef6e747fb7 100644 (file)
   :version "22.1")
 
 (defcustom makefile-browser-buffer-name "*Macros and Targets*"
-  "*Name of the macro- and target browser buffer."
+  "Name of the macro- and target browser buffer."
   :type 'string
   :group 'makefile)
 
 (defcustom makefile-target-colon ":"
-  "*String to append to all target names inserted by `makefile-insert-target'.
+  "String to append to all target names inserted by `makefile-insert-target'.
 \":\" or \"::\" are common values."
   :type 'string
   :group 'makefile)
 
 (defcustom makefile-macro-assign " = "
-  "*String to append to all macro names inserted by `makefile-insert-macro'.
+  "String to append to all macro names inserted by `makefile-insert-macro'.
 The normal value should be \" = \", since this is what
 standard make expects.  However, newer makes such as dmake
 allow a larger variety of different macro assignments, so you
@@ -149,69 +149,69 @@ might prefer to use \" += \" or \" := \" ."
   :group 'makefile)
 
 (defcustom makefile-electric-keys nil
-  "*If non-nil, Makefile mode should install electric keybindings.
+  "If non-nil, Makefile mode should install electric keybindings.
 Default is nil."
   :type 'boolean
   :group 'makefile)
 
 (defcustom makefile-use-curly-braces-for-macros-p nil
-  "*Controls the style of generated macro references.
+  "Controls the style of generated macro references.
 Non-nil means macro references should use curly braces, like `${this}'.
 nil means use parentheses, like `$(this)'."
   :type 'boolean
   :group 'makefile)
 
 (defcustom makefile-tab-after-target-colon t
-  "*If non-nil, insert a TAB after a target colon.
+  "If non-nil, insert a TAB after a target colon.
 Otherwise, a space is inserted.
 The default is t."
   :type 'boolean
   :group 'makefile)
 
 (defcustom makefile-browser-leftmost-column 10
-  "*Number of blanks to the left of the browser selection mark."
+  "Number of blanks to the left of the browser selection mark."
   :type 'integer
   :group 'makefile)
 
 (defcustom makefile-browser-cursor-column 10
-  "*Column the cursor goes to when it moves up or down in the Makefile browser."
+  "Column the cursor goes to when it moves up or down in the Makefile browser."
   :type 'integer
   :group 'makefile)
 
 (defcustom makefile-backslash-column 48
-  "*Column in which `makefile-backslash-region' inserts backslashes."
+  "Column in which `makefile-backslash-region' inserts backslashes."
   :type 'integer
   :group 'makefile)
 
 (defcustom makefile-backslash-align t
-  "*If non-nil, `makefile-backslash-region' will align backslashes."
+  "If non-nil, `makefile-backslash-region' will align backslashes."
   :type 'boolean
   :group 'makefile)
 
 (defcustom makefile-browser-selected-mark "+  "
-  "*String used to mark selected entries in the Makefile browser."
+  "String used to mark selected entries in the Makefile browser."
   :type 'string
   :group 'makefile)
 
 (defcustom makefile-browser-unselected-mark "   "
-  "*String used to mark unselected entries in the Makefile browser."
+  "String used to mark unselected entries in the Makefile browser."
   :type 'string
   :group 'makefile)
 
 (defcustom makefile-browser-auto-advance-after-selection-p t
-  "*If non-nil, cursor will move after item is selected in Makefile browser."
+  "If non-nil, cursor will move after item is selected in Makefile browser."
   :type 'boolean
   :group 'makefile)
 
 (defcustom makefile-pickup-everything-picks-up-filenames-p nil
-  "*If non-nil, `makefile-pickup-everything' picks up filenames as targets.
+  "If non-nil, `makefile-pickup-everything' picks up filenames as targets.
 This means it calls `makefile-pickup-filenames-as-targets'.
 Otherwise filenames are omitted."
   :type 'boolean
   :group 'makefile)
 
 (defcustom makefile-cleanup-continuations nil
-  "*If non-nil, automatically clean up continuation lines when saving.
+  "If non-nil, automatically clean up continuation lines when saving.
 A line is cleaned up by removing all whitespace following a trailing
 backslash.  This is done silently.
 IMPORTANT: Please note that enabling this option causes Makefile mode
@@ -220,7 +220,7 @@ to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \"it seems necessary\"."
   :group 'makefile)
 
 (defcustom makefile-mode-hook nil
-  "*Normal hook run by `makefile-mode'."
+  "Normal hook run by `makefile-mode'."
   :type 'hook
   :group 'makefile)
 
@@ -247,7 +247,7 @@ you enter a \".\" at the beginning of a line in `makefile-mode'."
 
 (defcustom makefile-runtime-macros-list
   '(("@") ("&") (">") ("<") ("*") ("^") ("+") ("?") ("%") ("$"))
-  "*List of macros that are resolved by make at runtime.
+  "List of macros that are resolved by make at runtime.
 If you insert a macro reference using `makefile-insert-macro-ref', the name
 of the macro is checked against this list.  If it can be found its name will
 not be enclosed in { } or ( )."
@@ -553,14 +553,14 @@ not be enclosed in { } or ( )."
 ;; ------------------------------------------------------------
 
 (defcustom makefile-brave-make "make"
-  "*How to invoke make, for `makefile-query-targets'.
+  "How to invoke make, for `makefile-query-targets'.
 This should identify a `make' command that can handle the `-q' option."
   :type 'string
   :group 'makefile)
 
 (defcustom makefile-query-one-target-method-function
   'makefile-query-by-make-minus-q
-  "*Function to call to determine whether a make target is up to date.
+  "Function to call to determine whether a make target is up to date.
 The function must satisfy this calling convention:
 
 * As its first argument, it must accept the name of the target to
@@ -579,7 +579,7 @@ The function must satisfy this calling convention:
   'makefile-query-one-target-method-function)
 
 (defcustom makefile-up-to-date-buffer-name "*Makefile Up-to-date overview*"
-  "*Name of the Up-to-date overview buffer."
+  "Name of the Up-to-date overview buffer."
   :type 'string
   :group 'makefile)
 
@@ -1493,7 +1493,6 @@ Insertion takes place at point."
   (setq buffer-read-only t))
 
 (defun makefile-browse (targets macros)
-  (interactive)
   (if (zerop (+ (length targets) (length macros)))
       (progn
        (beep)
index d0432f58d60345330bb069170ce6f266a97ac725..9978ee626873d9f0c4c610bcc704984bce0dad09 100644 (file)
@@ -829,6 +829,7 @@ The environment marked is the one that contains point or follows point."
     st)
   "Syntax table used in Metafont or MetaPost mode.")
 
+(define-obsolete-variable-alias 'meta-mode-map 'meta-common-mode-map "24.1")
 (defvar meta-common-mode-map
   (let ((map (make-sparse-keymap)))
     ;; Comment Paragraphs:
@@ -858,7 +859,6 @@ The environment marked is the one that contains point or follows point."
     ;; (define-key map "\C-c\C-l"  'meta-recenter-output)
     map)
   "Keymap used in Metafont or MetaPost mode.")
-(define-obsolete-variable-alias 'meta-mode-map 'meta-common-mode-map "24.1")
 
 (easy-menu-define
  meta-mode-menu meta-common-mode-map
index 0c43a3ed354ffa505121c22a3aa2cbe8603c3cf8..d634efebe5bc10751c03a14ca26c91c7b93ecef5 100644 (file)
@@ -65,7 +65,7 @@
   :group 'modula2)
 
 (defcustom m2-end-comment-column 75
-  "*Column for aligning the end of a comment, in Modula-2."
+  "Column for aligning the end of a comment, in Modula-2."
   :type 'integer
   :group 'modula2)
 
   "Keymap used in Modula-2 mode.")
 
 (defcustom m2-indent 5
-  "*This variable gives the indentation in Modula-2-Mode."
+  "This variable gives the indentation in Modula-2-Mode."
   :type 'integer
   :group 'modula2)
 (put 'm2-indent 'safe-local-variable
index 2cae41889bda7be23618ad6c046d2394ce0461df..f77e24e665a34ec29f62dec4fc6c09febd79ceac 100644 (file)
@@ -79,7 +79,7 @@ mode, set this to (\"-q\" \"--traditional\")."
   "Syntax table in use in inferior-octave-mode buffers.")
 
 (defcustom inferior-octave-mode-hook nil
-  "*Hook to be run when Inferior Octave mode is started."
+  "Hook to be run when Inferior Octave mode is started."
   :type 'hook
   :group 'octave-inferior)
 
index 7091a9468c5b565ed2750b2618352bb906dfc867..79b3fcee720ffd58a3ee9dae6116ce9a352dc3d2 100644 (file)
@@ -989,18 +989,13 @@ If Abbrev mode is turned on, typing ` (grave accent) followed by ? or
 executed normally.
 Note that all Octave mode abbrevs start with a grave accent."
   (interactive)
-  (if (not abbrev-mode)
-      (self-insert-command 1)
-    (let (c)
-      (insert last-command-event)
-      (if (if (featurep 'xemacs)
-             (or (eq (event-to-character (setq c (next-event))) ??)
-                 (eq (event-to-character c) help-char))
-           (or (eq (setq c (read-event)) ??)
-               (eq c help-char)))
-         (let ((abbrev-table-name-list '(octave-abbrev-table)))
-           (list-abbrevs))
-       (setq unread-command-events (list c))))))
+  (self-insert-command 1)
+  (when abbrev-mode
+    (set-temporary-overlay-map
+     (let ((map (make-sparse-keymap)))
+       (define-key map [??] 'list-abbrevs)
+       (define-key map (vector help-char) 'list-abbrevs)
+       map))))
 
 (define-skeleton octave-insert-defun
   "Insert an Octave function skeleton.
index 95f1adec40e87ceefb34f6598f239da4c66c28d7..b313fd4aee65de6341c4fc050d96822021b7b8d8 100644 (file)
@@ -57,7 +57,6 @@
 \f
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 
 (defgroup pascal nil
   "Major mode for editing Pascal source in Emacs."
 (put 'pascal-mode 'font-lock-defaults '(pascal-font-lock-keywords nil t))
 
 (defcustom pascal-indent-level 3
-  "*Indentation of Pascal statements with respect to containing block."
+  "Indentation of Pascal statements with respect to containing block."
   :type 'integer
   :group 'pascal)
 
 (defcustom pascal-case-indent 2
-  "*Indentation for case statements."
+  "Indentation for case statements."
   :type 'integer
   :group 'pascal)
 
 (defcustom pascal-auto-newline nil
-  "*Non-nil means automatically insert newlines in certain cases.
+  "Non-nil means automatically insert newlines in certain cases.
 These include after semicolons and after the punctuation mark after an `end'."
   :type 'boolean
   :group 'pascal)
 
 (defcustom pascal-indent-nested-functions t
-  "*Non-nil means nested functions are indented."
+  "Non-nil means nested functions are indented."
   :type 'boolean
   :group 'pascal)
 
 (defcustom pascal-tab-always-indent t
-  "*Non-nil means TAB in Pascal mode should always reindent the current line.
+  "Non-nil means TAB in Pascal mode should always reindent the current line.
 If this is nil, TAB inserts a tab if it is at the end of the line
 and follows non-whitespace text."
   :type 'boolean
   :group 'pascal)
 
 (defcustom pascal-auto-endcomments t
-  "*Non-nil means automatically insert comments after certain `end's.
+  "Non-nil means automatically insert comments after certain `end's.
 Specifically, this is done after the ends of cases statements and functions.
 The name of the function or case is included between the braces."
   :type 'boolean
   :group 'pascal)
 
 (defcustom pascal-auto-lineup '(all)
-  "*List of contexts where auto lineup of :'s or ='s should be done.
+  "List of contexts where auto lineup of :'s or ='s should be done.
 Elements can be of type: 'paramlist', 'declaration' or 'case', which will
 do auto lineup in parameterlist, declarations or case-statements
 respectively.  The word 'all' will do all lineups.  '(case paramlist) for
@@ -232,16 +231,16 @@ will do all lineups."
   :group 'pascal)
 
 (defvar pascal-toggle-completions nil
-  "*Non-nil meant \\<pascal-mode-map>\\[pascal-complete-word] would try all possible completions one by one.
-Repeated use of \\[pascal-complete-word] would show you all of them.
-Normally, when there is more than one possible completion,
-it displays a list of all possible completions.")
+  "If non-nil, `pascal-complete-word' tries all possible completions.
+Repeated use of \\[pascal-complete-word] then shows all
+completions in turn, instead of displaying a list of all possible
+completions.")
 (make-obsolete-variable 'pascal-toggle-completions
                         'completion-cycle-threshold "24.1")
 
 (defcustom pascal-type-keywords
   '("array" "file" "packed" "char" "integer" "real" "string" "record")
-  "*Keywords for types used when completing a word in a declaration or parmlist.
+  "Keywords for types used when completing a word in a declaration or parmlist.
 These include integer, real, char, etc.
 The types defined within the Pascal program
 are handled in another way, and should not be added to this list."
@@ -251,7 +250,7 @@ are handled in another way, and should not be added to this list."
 (defcustom pascal-start-keywords
   '("begin" "end" "function" "procedure" "repeat" "until" "while"
     "read" "readln" "reset" "rewrite" "write" "writeln")
-  "*Keywords to complete when standing at the first word of a statement.
+  "Keywords to complete when standing at the first word of a statement.
 These are keywords such as begin, repeat, until, readln.
 The procedures and variables defined within the Pascal program
 are handled in another way, and should not be added to this list."
@@ -260,7 +259,7 @@ are handled in another way, and should not be added to this list."
 
 (defcustom pascal-separator-keywords
   '("downto" "else" "mod" "div" "then")
-  "*Keywords to complete when NOT standing at the first word of a statement.
+  "Keywords to complete when NOT standing at the first word of a statement.
 These are keywords such as downto, else, mod, then.
 Variables and function names defined within the Pascal program
 are handled in another way, and should not be added to this list."
@@ -467,6 +466,8 @@ no args, if that value is non-nil."
 ;;;
 ;;; Interactive functions
 ;;;
+(defvar pascal--extra-indent 0)
+
 (defun pascal-insert-block ()
   "Insert Pascal begin ... end; block in the code with right indentation."
   (interactive)
@@ -757,14 +758,14 @@ on the line which ends a function or procedure named NAME."
 ;;; Indentation
 ;;;
 (defconst pascal-indent-alist
-  '((block . (+ ind pascal-indent-level))
-    (case . (+ ind pascal-case-indent))
-    (caseblock . ind) (cpp . 0)
-    (declaration . (+ ind pascal-indent-level))
+  '((block . (+ pascal--extra-indent pascal-indent-level))
+    (case . (+ pascal--extra-indent pascal-case-indent))
+    (caseblock . pascal--extra-indent) (cpp . 0)
+    (declaration . (+ pascal--extra-indent pascal-indent-level))
     (paramlist . (pascal-indent-paramlist t))
     (comment . (pascal-indent-comment))
-    (defun . ind) (contexp . ind)
-    (unknown . ind) (string . 0) (progbeg . 0)))
+    (defun . pascal--extra-indent) (contexp . pascal--extra-indent)
+    (unknown . pascal--extra-indent) (string . 0) (progbeg . 0)))
 
 (defun pascal-indent-command ()
   "Indent for special part of code."
@@ -786,12 +787,11 @@ on the line which ends a function or procedure named NAME."
     (if (looking-at "[ \t]+$")
        (skip-chars-forward " \t"))))
 
-(defvar ind)                          ;Used via `eval' in pascal-indent-alist.
 (defun pascal-indent-line ()
   "Indent current line as a Pascal statement."
   (let* ((indent-str (pascal-calculate-indent))
         (type (car indent-str))
-        (ind (car (cdr indent-str))))
+        (pascal--extra-indent (car (cdr indent-str))))
     ;; Labels should not be indented.
     (if (and (looking-at "^[0-9a-zA-Z]+[ \t]*:[^=]")
             (not (eq type 'declaration)))
@@ -803,13 +803,13 @@ on the line which ends a function or procedure named NAME."
           ())
          (; Other things should have no extra indent
           (looking-at pascal-noindent-re)
-          (indent-to ind))
+          (indent-to pascal--extra-indent))
          (; Nested functions should be indented
           (looking-at pascal-defun-re)
           (if (and pascal-indent-nested-functions
                    (eq type 'defun))
-              (indent-to (+ ind pascal-indent-level))
-            (indent-to ind)))
+              (indent-to (+ pascal--extra-indent pascal-indent-level))
+            (indent-to pascal--extra-indent)))
          (; But most lines are treated this way
           (indent-to (eval (cdr (assoc type pascal-indent-alist))))
           ))))
@@ -949,7 +949,7 @@ Do not count labels, case-statements or records."
                 (point-marker)
               (re-search-backward "\\<case\\>" nil t)))
        (beg (point))
-       (ind 0))
+       (pascal--extra-indent 0))
     ;; Get right indent
     (while (< (point) end)
       (if (re-search-forward
@@ -959,8 +959,8 @@ Do not count labels, case-statements or records."
       (if (< (point) end)
          (progn
            (delete-horizontal-space)
-           (if (> (current-column) ind)
-               (setq ind (current-column)))
+           (if (> (current-column) pascal--extra-indent)
+               (setq pascal--extra-indent (current-column)))
            (pascal-end-of-statement))))
     (goto-char beg)
     ;; Indent all case statements
@@ -969,7 +969,7 @@ Do not count labels, case-statements or records."
           "^[ \t]*[^][ \t,\\.:]+[ \t]*\\(,[ \t]*[^ \t,:]+[ \t]*\\)*:"
           (marker-position end) 'move)
          (forward-char -1))
-      (indent-to (1+ ind))
+      (indent-to (1+ pascal--extra-indent))
       (if (/= (following-char) ?:)
          ()
        (forward-char 1)
@@ -1017,7 +1017,7 @@ indent of the current line in parameterlist."
                                 (max (progn (pascal-declaration-end)
                                             (point))
                                      pos))))
-           ind)
+           pascal--extra-indent)
 
        (goto-char stpos)
        ;; Indent lines in record block
@@ -1031,13 +1031,13 @@ indent of the current line in parameterlist."
              (forward-line 1)))
 
        ;; Do lineup
-       (setq ind (pascal-get-lineup-indent stpos edpos lineup))
+       (setq pascal--extra-indent (pascal-get-lineup-indent stpos edpos lineup))
        (goto-char stpos)
        (while (and (<= (point) edpos) (not (eobp)))
          (if (search-forward lineup (point-at-eol) 'move)
              (forward-char -1))
          (delete-horizontal-space)
-         (indent-to ind)
+         (indent-to pascal--extra-indent)
          (if (not (looking-at lineup))
              (forward-line 1) ; No more indent if there is no : or =
            (forward-char 1)
@@ -1056,7 +1056,7 @@ indent of the current line in parameterlist."
 ;from b to e nicely. The lineup string is str."
 (defun pascal-get-lineup-indent (b e str)
   (save-excursion
-    (let ((ind 0)
+    (let ((pascal--extra-indent 0)
          (reg (concat str "\\|\\(\\<record\\>\\)\\|" pascal-defun-re)))
       (goto-char b)
       ;; Get rightmost position
@@ -1071,14 +1071,14 @@ indent of the current line in parameterlist."
                   (t
                    (goto-char (match-beginning 0))
                    (skip-chars-backward " \t")
-                   (if (> (current-column) ind)
-                       (setq ind (current-column)))
+                   (if (> (current-column) pascal--extra-indent)
+                       (setq pascal--extra-indent (current-column)))
                    (goto-char (match-end 0))
                    (end-of-line)
                    ))))
       ;; In case no lineup was found
-      (if (> ind 0)
-         (1+ ind)
+      (if (> pascal--extra-indent 0)
+         (1+ pascal--extra-indent)
        ;; No lineup-string found
        (goto-char b)
        (end-of-line)
@@ -1353,21 +1353,21 @@ The default is a name found in the buffer around point."
         (default (if (pascal-comp-defun default nil 'lambda)
                      default ""))
         (label
-          ;; Do completion with default
+          ;; Do completion with default.
           (completing-read (if (not (string= default ""))
                                (concat "Label (default " default "): ")
                              "Label: ")
                            ;; Complete with the defuns found in the
                            ;; current-buffer.
-                           (lexical-let ((buf (current-buffer)))
+                           (let ((buf (current-buffer)))
                              (lambda (s p a)
                                (with-current-buffer buf
                                  (pascal-comp-defun s p a))))
                            nil t "")))
-    ;; If there was no response on prompt, use default value
+    ;; If there was no response on prompt, use default value.
     (if (string= label "")
        (setq label default))
-    ;; Goto right place in buffer if label is not an empty string
+    ;; Goto right place in buffer if label is not an empty string.
     (or (string= label "")
        (progn
          (goto-char (point-min))
index 26c6e5a9f03cc49fb0d64731a170a751dfcb2e73..848b92868e730b61fff1631a1af17b6795e943eb 100644 (file)
@@ -1,6 +1,6 @@
 ;;; perl-mode.el --- Perl code editing commands for GNU Emacs
 
-;; Copyright (C) 1990, 1994, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1994, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author: William F. Mann
 ;; Maintainer: FSF
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 
 (defvar font-lock-comment-face)
 (defvar font-lock-doc-face)
     map)
   "Keymap used in Perl mode.")
 
-(autoload 'c-macro-expand "cmacexp"
-  "Display the result of expanding all C macros occurring in the region.
-The expansion is entirely correct because it uses the C preprocessor."
-  t)
-
 (defvar perl-mode-syntax-table
   (let ((st (make-syntax-table (standard-syntax-table))))
     (modify-syntax-entry ?\n ">" st)
@@ -468,7 +462,7 @@ The expansion is entirely correct because it uses the C preprocessor."
    (t (funcall (default-value 'font-lock-syntactic-face-function) state))))
 
 (defcustom perl-indent-level 4
-  "*Indentation of Perl statements with respect to containing block."
+  "Indentation of Perl statements with respect to containing block."
   :type 'integer
   :group 'perl)
 
@@ -485,32 +479,40 @@ The expansion is entirely correct because it uses the C preprocessor."
 ;;;###autoload(put 'perl-label-offset 'safe-local-variable 'integerp)
 
 (defcustom perl-continued-statement-offset 4
-  "*Extra indent for lines not starting new statements."
+  "Extra indent for lines not starting new statements."
   :type 'integer
   :group 'perl)
 (defcustom perl-continued-brace-offset -4
-  "*Extra indent for substatements that start with open-braces.
+  "Extra indent for substatements that start with open-braces.
 This is in addition to `perl-continued-statement-offset'."
   :type 'integer
   :group 'perl)
 (defcustom perl-brace-offset 0
-  "*Extra indentation for braces, compared with other text in same context."
+  "Extra indentation for braces, compared with other text in same context."
   :type 'integer
   :group 'perl)
 (defcustom perl-brace-imaginary-offset 0
-  "*Imagined indentation of an open brace that actually follows a statement."
+  "Imagined indentation of an open brace that actually follows a statement."
   :type 'integer
   :group 'perl)
 (defcustom perl-label-offset -2
-  "*Offset of Perl label lines relative to usual indentation."
+  "Offset of Perl label lines relative to usual indentation."
   :type 'integer
   :group 'perl)
 (defcustom perl-indent-continued-arguments nil
-  "*If non-nil offset of argument lines relative to usual indentation.
+  "If non-nil offset of argument lines relative to usual indentation.
 If nil, continued arguments are aligned with the first argument."
   :type '(choice integer (const nil))
   :group 'perl)
 
+(defcustom perl-indent-parens-as-block nil
+  "Non-nil means that non-block ()-, {}- and []-groups are indented as blocks.
+The closing bracket is aligned with the line of the opening bracket,
+not the contents of the brackets."
+  :version "24.2"
+  :type 'boolean
+  :group 'perl)
+
 (defcustom perl-tab-always-indent tab-always-indent
   "Non-nil means TAB in Perl mode always indents the current line.
 Otherwise it inserts a tab character if you type it past the first
@@ -521,7 +523,7 @@ nonwhite character on the line."
 ;; I changed the default to nil for consistency with general Emacs
 ;; conventions -- rms.
 (defcustom perl-tab-to-comment nil
-  "*Non-nil means TAB moves to eol or makes a comment in some cases.
+  "Non-nil means TAB moves to eol or makes a comment in some cases.
 For lines which don't need indenting, TAB either indents an
 existing comment, moves to end-of-line, or if at end-of-line already,
 create a new comment."
@@ -529,7 +531,7 @@ create a new comment."
   :group 'perl)
 
 (defcustom perl-nochange ";?#\\|\f\\|\\s(\\|\\(\\w\\|\\s_\\)+:[^:]"
-  "*Lines starting with this regular expression are not auto-indented."
+  "Lines starting with this regular expression are not auto-indented."
   :type 'regexp
   :group 'perl)
 
@@ -853,7 +855,8 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'."
       (cond ((nth 3 state) 'noindent)  ; In a quoted string?
            ((null containing-sexp)     ; Line is at top level.
             (skip-chars-forward " \t\f")
-            (if (= (following-char) ?{)
+            (if (memq (following-char)
+                      (if perl-indent-parens-as-block '(?\{ ?\( ?\[) '(?\{)))
                 0  ; move to beginning of line if it starts a function body
               ;; indent a little if this is a continuation line
               (perl-backward-to-noncomment)
@@ -897,7 +900,9 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'."
                          0 perl-continued-statement-offset)
                      (current-column)
                      (if (save-excursion (goto-char indent-point)
-                                         (looking-at "[ \t]*{"))
+                                         (looking-at
+                                          (if perl-indent-parens-as-block
+                                              "[ \t]*[{(\[]" "[ \t]*{")))
                          perl-continued-brace-offset 0)))
               ;; This line starts a new statement.
               ;; Position at last unclosed open.
index a8ee6f4bff4b5c741624370827014bcb94478a99..16d85cb2d7984c39183c01de412e7f7aa8e3ebc4 100644 (file)
 
 
 (defgroup prolog nil
-  "Major modes for editing and running Prolog and Mercury files."
+  "Editing and running Prolog and Mercury files."
   :group 'languages)
 
 (defgroup prolog-faces nil
@@ -833,18 +833,116 @@ This is really kludgy, and unneeded (i.e. obsolete) in Emacs>=24."
       )
     table))
 (defvar prolog-mode-abbrev-table nil)
-(defvar prolog-upper-case-string ""
-  "A string containing all upper case characters.
-Set by prolog-build-case-strings.")
-(defvar prolog-lower-case-string ""
-  "A string containing all lower case characters.
-Set by prolog-build-case-strings.")
-
-(defvar prolog-atom-char-regexp ""
-  "Set by prolog-set-atom-regexps.")
-;; "Regexp specifying characters which constitute atoms without quoting.")
-(defvar prolog-atom-regexp ""
-  "Set by prolog-set-atom-regexps.")
+
+(if (eval-when-compile
+      (and (string-match "[[:upper:]]" "A")
+           (with-temp-buffer
+             (insert "A") (skip-chars-backward "[:upper:]") (bolp))))
+    (progn
+      (defconst prolog-upper-case-string "[:upper:]"
+        "A string containing a char-range matching all upper case characters.")
+      (defconst prolog-lower-case-string "[:lower:]"
+        "A string containing a char-range matching all lower case characters."))
+
+  ;; GNU Emacs compatibility: GNU Emacs does not differentiate between
+  ;; ints and chars, or at least these two are interchangeable.
+  (defalias 'prolog-int-to-char
+    (if (fboundp 'int-to-char) #'int-to-char #'identity))
+
+  (defalias 'prolog-char-to-int
+    (if (fboundp 'char-to-int) #'char-to-int #'identity))
+
+  (defun prolog-ints-intervals (ints)
+    "Return a list of intervals (from . to) covering INTS."
+    (when ints
+      (setq ints (sort ints '<))
+      (let ((prev (car ints))
+            (interval-start (car ints))
+            intervals)
+        (while ints
+          (let ((next (car ints)))
+            (when (> next (1+ prev))   ; start of new interval
+             (setq intervals (cons (cons interval-start prev) intervals))
+             (setq interval-start next))
+            (setq prev next)
+            (setq ints (cdr ints))))
+        (setq intervals (cons (cons interval-start prev) intervals))
+        (reverse intervals))))
+
+  (defun prolog-dash-letters (string)
+    "Return a condensed regexp covering all letters in STRING."
+    (let ((intervals (prolog-ints-intervals (mapcar #'prolog-char-to-int
+                                                    (string-to-list string))))
+          codes)
+      (while intervals
+        (let* ((i (car intervals))
+               (from (car i))
+               (to (cdr i))
+               (c (cond ((= from to) `(,from))
+                        ((= (1+ from) to) `(,from ,to))
+                        (t `(,from ?- ,to)))))
+          (setq codes (cons c codes)))
+        (setq intervals (cdr intervals)))
+      (apply 'concat (reverse codes))))
+
+  (let ((up_string "")
+        (low_string ""))
+    ;; Use `map-char-table' if it is defined. Otherwise enumerate all
+    ;; numbers between 0 and 255. `map-char-table' is probably safer.
+    ;;
+    ;; `map-char-table' causes problems under Emacs 23.0.0.1, the
+    ;; while loop seems to do its job well (Ryszard Szopa)
+    ;;
+    ;;(if (and (not (featurep 'xemacs))
+    ;;          (fboundp 'map-char-table))
+    ;;    (map-char-table
+    ;;     (lambda (key value)
+    ;;       (cond
+    ;;        ((and
+    ;;          (eq (prolog-int-to-char key) (downcase key))
+    ;;          (eq (prolog-int-to-char key) (upcase key)))
+    ;;         ;; Do nothing if upper and lower case are the same
+    ;;         )
+    ;;        ((eq (prolog-int-to-char key) (downcase key))
+    ;;         ;; The char is lower case
+    ;;         (setq low_string (format "%s%c" low_string key)))
+    ;;        ((eq (prolog-int-to-char key) (upcase key))
+    ;;         ;; The char is upper case
+    ;;         (setq up_string (format "%s%c" up_string key)))
+    ;;        ))
+    ;;     (current-case-table))
+    ;; `map-char-table' was undefined.
+    (let ((key 0))
+      (while (< key 256)
+        (cond
+         ((and
+           (eq (prolog-int-to-char key) (downcase key))
+           (eq (prolog-int-to-char key) (upcase key)))
+          ;; Do nothing if upper and lower case are the same
+          )
+         ((eq (prolog-int-to-char key) (downcase key))
+          ;; The char is lower case
+          (setq low_string (format "%s%c" low_string key)))
+         ((eq (prolog-int-to-char key) (upcase key))
+          ;; The char is upper case
+          (setq up_string (format "%s%c" up_string key)))
+         )
+        (setq key (1+ key))))
+    ;; )
+    ;; The strings are single-byte strings.
+    (defconst prolog-upper-case-string (prolog-dash-letters up_string)
+      "A string containing a char-range matching all upper case characters.")
+    (defconst prolog-lower-case-string (prolog-dash-letters low_string)
+      "A string containing a char-range matching all lower case characters.")
+    ))
+
+(defconst prolog-atom-char-regexp
+  (if (string-match "[[:alnum:]]" "0")
+      "[[:alnum:]_$]"
+    (format "[%s%s0-9_$]" prolog-lower-case-string prolog-upper-case-string))
+  "Regexp specifying characters which constitute atoms without quoting.")
+(defconst prolog-atom-regexp
+  (format "[%s$]%s*" prolog-lower-case-string prolog-atom-char-regexp))
 
 (defconst prolog-left-paren "[[({]"     ;FIXME: Why not \\s(?
   "The characters used as left parentheses for the indentation code.")
@@ -887,6 +985,96 @@ Set by prolog-build-case-strings.")
      '(("dcg" . "-->") ("rule" . ":-") ("simplification" . "<=>")
        ("propagation" . "==>")))))
 
+;; SMIE support
+
+(require 'smie)
+
+(defvar prolog-use-smie t)
+
+(defun prolog-smie-forward-token ()
+  ;; FIXME: Add support for 0'<char>, if needed after adding it to
+  ;; syntax-propertize-functions.
+  (forward-comment (point-max))
+  (buffer-substring-no-properties
+   (point)
+   (progn (cond
+           ((looking-at "[!;]") (forward-char 1))
+           ((not (zerop (skip-chars-forward "#&*+-./:<=>?@\\^`~"))))
+           ((not (zerop (skip-syntax-forward "w_'"))))
+           ;; In case of non-ASCII punctuation.
+           ((not (zerop (skip-syntax-forward ".")))))
+          (point))))
+
+(defun prolog-smie-backward-token ()
+  ;; FIXME: Add support for 0'<char>, if needed after adding it to
+  ;; syntax-propertize-functions.
+  (forward-comment (- (point-max)))
+  (buffer-substring-no-properties
+   (point)
+   (progn (cond
+           ((memq (char-before) '(?! ?\;)) (forward-char -1))
+           ((not (zerop (skip-chars-backward "#&*+-./:<=>?@\\^`~"))))
+           ((not (zerop (skip-syntax-backward "w_'"))))
+           ;; In case of non-ASCII punctuation.
+           ((not (zerop (skip-syntax-backward ".")))))
+          (point))))
+
+(defconst prolog-smie-grammar
+  ;; Rather than construct the operator levels table from the BNF,
+  ;; we directly provide the operator precedences from GNU Prolog's
+  ;; manual (7.14.10 op/3).  The only problem is that GNU Prolog's
+  ;; manual uses precedence levels in the opposite sense (higher
+  ;; numbers bind less tightly) than SMIE, so we use negative numbers.
+  '(("." -10000 -10000)
+    (":-" -1200 -1200)
+    ("-->" -1200 -1200)
+    (";" -1100 -1100)
+    ("->" -1050 -1050)
+    ("," -1000 -1000)
+    ("\\+" -900 -900)
+    ("=" -700 -700)
+    ("\\=" -700 -700)
+    ("=.." -700 -700)
+    ("==" -700 -700)
+    ("\\==" -700 -700)
+    ("@<" -700 -700)
+    ("@=<" -700 -700)
+    ("@>" -700 -700)
+    ("@>=" -700 -700)
+    ("is" -700 -700)
+    ("=:=" -700 -700)
+    ("=\\=" -700 -700)
+    ("<" -700 -700)
+    ("=<" -700 -700)
+    (">" -700 -700)
+    (">=" -700 -700)
+    (":" -600 -600)
+    ("+" -500 -500)
+    ("-" -500 -500)
+    ("/\\" -500 -500)
+    ("\\/" -500 -500)
+    ("*" -400 -400)
+    ("/" -400 -400)
+    ("//" -400 -400)
+    ("rem" -400 -400)
+    ("mod" -400 -400)
+    ("<<" -400 -400)
+    (">>" -400 -400)
+    ("**" -200 -200)
+    ("^" -200 -200)
+    ;; Prefix
+    ;; ("+" 200 200)
+    ;; ("-" 200 200)
+    ;; ("\\" 200 200)
+    (:smie-closer-alist (t . "."))
+    )
+  "Precedence levels of infix operators.")
+
+(defun prolog-smie-rules (kind token)
+  (pcase (cons kind token)
+    (`(:elem . basic) prolog-indent-width)
+    (`(:after . ".") '(column . 0)) ;; To work around smie-closer-alist.
+    (`(:after . ,(or `":-" `"->" `"-->")) prolog-indent-width)))
 
 \f
 ;;-------------------------------------------------------------------
@@ -959,7 +1147,6 @@ VERSION is of the format (Major . Minor)"
   (set (make-local-variable 'paragraph-separate) paragraph-start)
   (set (make-local-variable 'paragraph-ignore-fill-prefix) t)
   (set (make-local-variable 'normal-auto-fill-function) 'prolog-do-auto-fill)
-  (set (make-local-variable 'indent-line-function) 'prolog-indent-line)
   (set (make-local-variable 'comment-start) "%")
   (set (make-local-variable 'comment-end) "")
   (set (make-local-variable 'comment-add) 1)
@@ -968,7 +1155,6 @@ VERSION is of the format (Major . Minor)"
        ;; inside quoted atoms or strings
        (format "^\\(\\(%s\\|%s\\|[^\n\'\"%%]\\)*\\)\\(/\\*+ *\\|%%+ *\\)"
                prolog-quoted-atom-regexp prolog-string-regexp))
-  (set (make-local-variable 'comment-indent-function) 'prolog-comment-indent)
   (set (make-local-variable 'parens-require-spaces) nil)
   ;; Initialize Prolog system specific variables
   (dolist (var '(prolog-keywords prolog-types prolog-mode-specificators
@@ -984,6 +1170,13 @@ VERSION is of the format (Major . Minor)"
        '(prolog-font-lock-keywords nil nil ((?_ . "w"))))
   (set (make-local-variable 'syntax-propertize-function)
       prolog-syntax-propertize-function)
+
+  (if prolog-use-smie
+      ;; Setup SMIE.
+      (smie-setup prolog-smie-grammar #'prolog-smie-rules
+                  :forward-token #'prolog-smie-forward-token
+                  :backward-token #'prolog-smie-backward-token)
+    (set (make-local-variable 'indent-line-function) 'prolog-indent-line))
   )
 
 (defun prolog-mode-keybindings-common (map)
@@ -1096,11 +1289,9 @@ if that value is non-nil."
                            ((eq prolog-system 'gnu) "[GNU]")
                            (t ""))))
   (prolog-mode-variables)
-  (prolog-build-case-strings)
-  (prolog-set-atom-regexps)
   (dolist (ar prolog-align-rules) (add-to-list 'align-rules-list ar))
 
-  ;; imenu entry moved to the appropriate hook for consistency
+  ;; `imenu' entry moved to the appropriate hook for consistency.
 
   ;; Load SICStus debugger if suitable
   (if (and (eq prolog-system 'sicstus)
@@ -1614,7 +1805,8 @@ For use with the `compilation-parse-errors-function' variable."
          limit t)
         (setq filepath (match-string 2)))
 
-      ;; ###### Does this work with SICStus under Windows (i.e. backslashes and stuff?)
+      ;; ###### Does this work with SICStus under Windows
+      ;; (i.e. backslashes and stuff?)
       (if (string-match "\\(.*/\\)\\([^/]*\\)$" filepath)
           (progn
             (setq dir (match-string 1 filepath))
@@ -1838,7 +2030,8 @@ Argument BOUND is a buffer position limiting searching."
     (defface prolog-builtin-face
       '((((class color) (background light)) (:foreground "Purple"))
         (((class color) (background dark)) (:foreground "Cyan"))
-        (((class grayscale) (background light)) (:foreground "LightGray" :bold t))
+        (((class grayscale) (background light))
+         :foreground "LightGray" :bold t)
         (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
         (t (:bold t)))
       "Face name to use for compiler warnings."
@@ -2093,20 +2286,6 @@ rigidly along with this one (not yet)."
         (prolog-insert-spaces-after-paren))
     ))
 
-(defun prolog-comment-indent ()
-  "Compute prolog comment indentation."
-  ;; FIXME: Only difference with default behavior is that %%% is not
-  ;; flushed to column 0 but just left where the user put it.
-  (cond ((looking-at "%%%") (prolog-indentation-level-of-line))
-        ((looking-at "%%") (prolog-indent-level))
-        (t
-         (save-excursion
-           (skip-chars-backward " \t")
-           ;; Insert one space at least, except at left margin.
-           (max (+ (current-column) (if (bolp) 0 1))
-                comment-column)))
-        ))
-
 (defun prolog-indent-level ()
   "Compute prolog indentation level."
   (save-excursion
@@ -3200,7 +3379,8 @@ When called with prefix argument ARG, disable zipping instead."
   (save-excursion
     (let ((state (prolog-clause-info))
           (object (prolog-in-object)))
-      (if (or (equal (nth 0 state) "") (equal (prolog-in-string-or-comment) 'cmt))
+      (if (or (equal (nth 0 state) "")
+              (equal (prolog-in-string-or-comment) 'cmt))
           nil
         (if (and (eq prolog-system 'sicstus)
                  object)
@@ -3229,6 +3409,7 @@ STRING should be given if the last search was by `string-match' on STRING."
 
 (defun prolog-pred-start ()
   "Return the starting point of the first clause of the current predicate."
+  ;; FIXME: Use SMIE.
   (save-excursion
     (goto-char (prolog-clause-start))
     ;; Find first clause, unless it was a directive
@@ -3261,8 +3442,9 @@ STRING should be given if the last search was by `string-match' on STRING."
 
 (defun prolog-pred-end ()
   "Return the position at the end of the last clause of the current predicate."
+  ;; FIXME: Use SMIE.
   (save-excursion
-    (goto-char (prolog-clause-end))        ; if we are before the first predicate
+    (goto-char (prolog-clause-end))     ; If we are before the first predicate.
     (goto-char (prolog-clause-start))
     (let* ((pinfo (prolog-clause-info))
           (predname (nth 0 pinfo))
@@ -3517,6 +3699,7 @@ If already at the end of clause, move to next clause."
 (defun prolog-beginning-of-predicate ()
   "Go to the nearest beginning of predicate before current point.
 Return the final point or nil if no such a beginning was found."
+  ;; FIXME: Hook into beginning-of-defun.
   (interactive)
   (let ((op (point))
         (pos (prolog-pred-start)))
@@ -3536,6 +3719,7 @@ Return the final point or nil if no such a beginning was found."
 
 (defun prolog-end-of-predicate ()
   "Go to the end of the current predicate."
+  ;; FIXME: Hook into end-of-defun.
   (interactive)
   (let ((op (point)))
     (goto-char (prolog-pred-end))
@@ -3621,12 +3805,12 @@ a new comment is created."
       (indent-for-comment)))
 
 (defun prolog-indent-predicate ()
-  "*Indent the current predicate."
+  "Indent the current predicate."
   (interactive)
   (indent-region (prolog-pred-start) (prolog-pred-end) nil))
 
 (defun prolog-indent-buffer ()
-  "*Indent the entire buffer."
+  "Indent the entire buffer."
   (interactive)
   (indent-region (point-min) (point-max) nil))
 
@@ -3657,7 +3841,7 @@ a new comment is created."
   "Delete preceding character or whitespace.
 If `prolog-hungry-delete-key-flag' is non-nil, then all preceding whitespace is
 consumed.  If however an ARG is supplied, or `prolog-hungry-delete-key-flag' is
-nil, or point is inside a literal then the function in the variable
+nil, or point is inside a literal then the function
 `backward-delete-char' is called."
   (interactive "P")
   (if (or (not prolog-hungry-delete-key-flag)
@@ -3677,6 +3861,7 @@ nil, or point is inside a literal then the function in the variable
 (defun prolog-electric-if-then-else (arg)
   "If `prolog-electric-if-then-else-flag' is non-nil, indent if-then-else constructs.
 Bound to the >, ; and ( keys."
+  ;; FIXME: Use post-self-insert-hook or electric-indent-mode.
   (interactive "P")
   (self-insert-command (prefix-numeric-value arg))
   (if prolog-electric-if-then-else-flag (prolog-insert-spaces-after-paren)))
@@ -3686,6 +3871,7 @@ Bound to the >, ; and ( keys."
 That is, insert space (if appropriate), `:-' and newline if colon is pressed
 at the end of a line that starts in the first column (i.e., clause
 heads)."
+  ;; FIXME: Use post-self-insert-hook.
   (interactive "P")
   (if (and prolog-electric-colon-flag
           (null arg)
@@ -3696,7 +3882,7 @@ heads)."
         (unless (save-excursion (backward-char 1) (looking-at "\\s "))
           (insert " "))
        (insert ":-\n")
-       (prolog-indent-line))
+        (indent-according-to-mode))
     (self-insert-command (prefix-numeric-value arg))))
 
 (defun prolog-electric-dash (arg)
@@ -3704,6 +3890,7 @@ heads)."
 that is, insert space (if appropriate), `-->' and newline if dash is pressed
 at the end of a line that starts in the first column (i.e., DCG
 heads)."
+  ;; FIXME: Use post-self-insert-hook.
   (interactive "P")
   (if (and prolog-electric-dash-flag
           (null arg)
@@ -3714,7 +3901,7 @@ heads)."
         (unless (save-excursion (backward-char 1) (looking-at "\\s "))
           (insert " "))
        (insert "-->\n")
-       (prolog-indent-line))
+       (indent-according-to-mode))
     (self-insert-command (prefix-numeric-value arg))))
 
 (defun prolog-electric-dot (arg)
@@ -3729,6 +3916,7 @@ When invoked at the beginning of line, insert a head of a new clause
 of the current predicate.
 
 When called with prefix argument ARG, insert just dot."
+  ;; FIXME: Use post-self-insert-hook.
   (interactive "P")
   ;; Check for situations when the electricity should not be active
   (if (or (not prolog-electric-dot-flag)
@@ -3788,6 +3976,7 @@ If `prolog-electric-underscore-flag' is non-nil and the point is
 on a variable then replace the variable with underscore and skip
 the following comma and whitespace, if any.
 If the point is not on a variable then insert underscore."
+  ;; FIXME: Use post-self-insert-hook.
   (interactive)
   (if prolog-electric-underscore-flag
       (let (;start
@@ -3862,144 +4051,36 @@ PREFIX is the prefix of the search regexp."
           (backward-char)))
       )))
 
+;;(defun prolog-regexp-dash-continuous-chars (chars)
+;;  (let ((ints (mapcar #'prolog-char-to-int (string-to-list chars)))
+;;        (beg 0)
+;;        (end 0))
+;;    (if (null ints)
+;;        chars
+;;      (while (and (< (+ beg 1) (length chars))
+;;                  (not (or (= (+ (nth beg ints) 1) (nth (+ beg 1) ints))
+;;                           (= (nth beg ints) (nth (+ beg 1) ints)))))
+;;        (setq beg (+ beg 1)))
+;;      (setq beg (+ beg 1)
+;;            end beg)
+;;      (while (and (< (+ end 1) (length chars))
+;;                  (or (= (+ (nth end ints) 1) (nth (+ end 1) ints))
+;;                      (= (nth end ints) (nth (+ end 1) ints))))
+;;        (setq end (+ end 1)))
+;;      (if (equal (substring chars end) "")
+;;          (substring chars 0 beg)
+;;        (concat (substring chars 0 beg) "-"
+;;                (prolog-regexp-dash-continuous-chars (substring chars end))))
+;;    )))
+
+;;(defun prolog-condense-character-sets (regexp)
+;;  "Condense adjacent characters in character sets of REGEXP."
+;;  (let ((next -1))
+;;    (while (setq next (string-match "\\[\\(.*?\\)\\]" regexp (1+ next)))
+;;      (setq regexp (replace-match (prolog-dash-letters (match-string 1 regexp))
+;;                               t t regexp 1))))
+;;  regexp)
 
-(defun prolog-set-atom-regexps ()
-  "Set the `prolog-atom-char-regexp' and `prolog-atom-regexp' variables.
-Must be called after `prolog-build-case-strings'."
-  (setq prolog-atom-char-regexp
-        (format "[%s%s0-9_$]"
-                ;; FIXME: why not a-zA-Z?
-                prolog-lower-case-string
-                prolog-upper-case-string))
-  (setq prolog-atom-regexp
-        (format "[%s$]%s*"
-                prolog-lower-case-string
-                prolog-atom-char-regexp))
-  )
-
-(defun prolog-build-case-strings ()
-  "Set `prolog-upper-case-string' and `prolog-lower-case-string'.
-Uses the current case-table for extracting the relevant information."
-  (let ((up_string "")
-        (low_string ""))
-    ;; Use `map-char-table' if it is defined. Otherwise enumerate all
-    ;; numbers between 0 and 255. `map-char-table' is probably safer.
-    ;;
-    ;; `map-char-table' causes problems under Emacs 23.0.0.1, the
-    ;; while loop seems to do its job well (Ryszard Szopa)
-    ;;
-    ;;(if (and (not (featurep 'xemacs))
-    ;;          (fboundp 'map-char-table))
-    ;;    (map-char-table
-    ;;     (lambda (key value)
-    ;;       (cond
-    ;;        ((and
-    ;;          (eq (prolog-int-to-char key) (downcase key))
-    ;;          (eq (prolog-int-to-char key) (upcase key)))
-    ;;         ;; Do nothing if upper and lower case are the same
-    ;;         )
-    ;;        ((eq (prolog-int-to-char key) (downcase key))
-    ;;         ;; The char is lower case
-    ;;         (setq low_string (format "%s%c" low_string key)))
-    ;;        ((eq (prolog-int-to-char key) (upcase key))
-    ;;         ;; The char is upper case
-    ;;         (setq up_string (format "%s%c" up_string key)))
-    ;;        ))
-    ;;     (current-case-table))
-      ;; `map-char-table' was undefined.
-      (let ((key 0))
-        (while (< key 256)
-          (cond
-           ((and
-             (eq (prolog-int-to-char key) (downcase key))
-             (eq (prolog-int-to-char key) (upcase key)))
-            ;; Do nothing if upper and lower case are the same
-            )
-           ((eq (prolog-int-to-char key) (downcase key))
-            ;; The char is lower case
-            (setq low_string (format "%s%c" low_string key)))
-           ((eq (prolog-int-to-char key) (upcase key))
-            ;; The char is upper case
-            (setq up_string (format "%s%c" up_string key)))
-           )
-          (setq key (1+ key))))
-      ;; )
-      ;; The strings are single-byte strings
-      (setq prolog-upper-case-string (prolog-dash-letters up_string))
-      (setq prolog-lower-case-string (prolog-dash-letters low_string))
-      ))
-
-;(defun prolog-regexp-dash-continuous-chars (chars)
-;  (let ((ints (mapcar #'prolog-char-to-int (string-to-list chars)))
-;        (beg 0)
-;        (end 0))
-;    (if (null ints)
-;        chars
-;      (while (and (< (+ beg 1) (length chars))
-;                  (not (or (= (+ (nth beg ints) 1) (nth (+ beg 1) ints))
-;                           (= (nth beg ints) (nth (+ beg 1) ints)))))
-;        (setq beg (+ beg 1)))
-;      (setq beg (+ beg 1)
-;            end beg)
-;      (while (and (< (+ end 1) (length chars))
-;                  (or (= (+ (nth end ints) 1) (nth (+ end 1) ints))
-;                      (= (nth end ints) (nth (+ end 1) ints))))
-;        (setq end (+ end 1)))
-;      (if (equal (substring chars end) "")
-;          (substring chars 0 beg)
-;        (concat (substring chars 0 beg) "-"
-;                (prolog-regexp-dash-continuous-chars (substring chars end))))
-;    )))
-
-(defun prolog-ints-intervals (ints)
-  "Return a list of intervals (from . to) covering INTS."
-  (when ints
-    (setq ints (sort ints '<))
-    (let ((prev (car ints))
-         (interval-start (car ints))
-         intervals)
-      (while ints
-       (let ((next (car ints)))
-         (when (> next (1+ prev))      ; start of new interval
-             (setq intervals (cons (cons interval-start prev) intervals))
-             (setq interval-start next))
-         (setq prev next)
-         (setq ints (cdr ints))))
-      (setq intervals (cons (cons interval-start prev) intervals))
-      (reverse intervals))))
-
-(defun prolog-dash-letters (string)
-  "Return a condensed regexp covering all letters in STRING."
-  (let ((intervals (prolog-ints-intervals (mapcar #'prolog-char-to-int
-                                                (string-to-list string))))
-       codes)
-    (while intervals
-      (let* ((i (car intervals))
-            (from (car i))
-            (to (cdr i))
-            (c (cond ((= from to) `(,from))
-                     ((= (1+ from) to) `(,from ,to))
-                     (t `(,from ?- ,to)))))
-       (setq codes (cons c codes)))
-      (setq intervals (cdr intervals)))
-    (apply 'concat (reverse codes))))
-
-;(defun prolog-condense-character-sets (regexp)
-;  "Condense adjacent characters in character sets of REGEXP."
-;  (let ((next -1))
-;    (while (setq next (string-match "\\[\\(.*?\\)\\]" regexp (1+ next)))
-;      (setq regexp (replace-match (prolog-dash-letters (match-string 1 regexp))
-;                                t t regexp 1))))
-;  regexp)
-
-;; GNU Emacs compatibility: GNU Emacs does not differentiate between
-;; ints and chars, or at least these two are interchangeable.
-(defalias 'prolog-int-to-char
-  (if (fboundp 'int-to-char) #'int-to-char #'identity))
-
-(defalias 'prolog-char-to-int
-  (if (fboundp 'char-to-int) #'char-to-int #'identity))
-\f
 ;;-------------------------------------------------------------------
 ;; Menu stuff (both for the editing buffer and for the inferior
 ;; prolog buffer)
@@ -4110,7 +4191,7 @@ Uses the current case-table for extracting the relevant information."
     ["Beginning of predicate" prolog-beginning-of-predicate t]
     ["End of predicate" prolog-end-of-predicate t]
     "---"
-    ["Indent line" prolog-indent-line t]
+    ["Indent line" indent-according-to-mode t]
     ["Indent region" indent-region (region-exists-p)]
     ["Indent predicate" prolog-indent-predicate t]
     ["Indent buffer" prolog-indent-buffer t]
index e85fa0476b08de5e3b5ebf09ebc27e96b85fd2ed..bf52eff8f9a17b0ccde113d107e0a2af903a03f6 100644 (file)
 ;; User variables.
 
 (defcustom ps-mode-auto-indent t
-  "*Should we use autoindent?"
+  "Should we use autoindent?"
   :group 'PostScript-edit
   :type 'boolean)
 
 (defcustom ps-mode-tab 4
-  "*Number of spaces to use when indenting."
+  "Number of spaces to use when indenting."
   :group 'PostScript-edit
   :type 'integer)
 
 (defcustom ps-mode-paper-size '(595 842)
-  "*Default paper size.
+  "Default paper size.
 
 When inserting an EPSF template these values are used
 to set the boundingbox to include the whole page.
@@ -117,12 +117,12 @@ When the figure is finished these values should be replaced."
           (lpr-command (if (memq system-type '(usg-unix-v hpux irix))
                            "lp" "lpr")))
        (lpr-buffer)))
-  "*Lisp function to print current buffer as PostScript."
+  "Lisp function to print current buffer as PostScript."
   :group 'PostScript-edit
   :type 'function)
 
 (defcustom ps-run-prompt "\\(GS\\(<[0-9]+\\)?>\\)+"
-  "*Regexp to match prompt in interactive PostScript."
+  "Regexp to match prompt in interactive PostScript."
   :group 'PostScript-interaction
   :type 'regexp)
 
@@ -139,7 +139,7 @@ When the figure is finished these values should be replaced."
            ("^\\(Current file position is\\) \\([0-9]+\\)"
             (1 font-lock-comment-face nil nil)
             (2 font-lock-warning-face nil nil))))
-  "*Medium level highlighting of messages from the PostScript interpreter.
+  "Medium level highlighting of messages from the PostScript interpreter.
 
 See documentation on font-lock for details."
   :group 'PostScript-interaction
@@ -155,17 +155,17 @@ See documentation on font-lock for details."
                                     (boolean :tag "Laxmatch" :value t))))))
 
 (defcustom ps-run-x '("gs" "-r72" "-sPAPERSIZE=a4")
-  "*Command as list to run PostScript with graphic display."
+  "Command as list to run PostScript with graphic display."
   :group 'PostScript-interaction
   :type '(repeat string))
 
 (defcustom ps-run-dumb '("gs" "-dNODISPLAY")
-  "*Command as list to run PostScript without graphic display."
+  "Command as list to run PostScript without graphic display."
   :group 'PostScript-interaction
   :type '(repeat string))
 
 (defcustom ps-run-init nil
-  "*String of commands to send to PostScript to start interactive.
+  "String of commands to send to PostScript to start interactive.
 
 Example: \"executive\"
 
@@ -174,13 +174,13 @@ You won't need to set this option for Ghostscript."
   :type '(choice (const nil) string))
 
 (defcustom ps-run-error-line-numbers nil
-  "*What values are used by the PostScript interpreter in error messages?"
+  "What values are used by the PostScript interpreter in error messages?"
   :group 'PostScript-interaction
   :type '(choice (const :tag "line numbers" t)
                  (const :tag "byte counts" nil)))
 
 (defcustom ps-run-tmp-dir nil
-  "*Name of directory to place temporary file.
+  "Name of directory to place temporary file.
 If nil, use `temporary-file-directory'."
   :group 'PostScript-interaction
   :type '(choice (const nil) directory))
index 3ef872d26ebdbf01e70cfe0eaa963d1fa7b83c66..e0a58d1523e2fb6dff6ac41d6e06f2fa282bcc1e 100644 (file)
-;;; python.el --- silly walks for Python  -*- coding: iso-8859-1 -*-
+;;; python.el --- Python's flying circus support for Emacs -*- coding: utf-8 -*-
 
 ;; Copyright (C) 2003-2012  Free Software Foundation, Inc.
 
-;; Author: Dave Love <fx@gnu.org>
+;; Author: Fabián E. Gallina <fabian@anue.biz>
+;; URL: https://github.com/fgallina/python.el
+;; Version: 0.24.2
 ;; Maintainer: FSF
-;; Created: Nov 2003
+;; Created: Jul 2010
 ;; Keywords: languages
 
 ;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
+;; it under the terms of the GNU General Public License as published
+;; by the Free Software Foundation, either version 3 of the License,
+;; or (at your option) any later version.
 
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
+;; GNU Emacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
-;; Major mode for editing Python, with support for inferior processes.
-
-;; There is another Python mode, python-mode.el:
-;; http://launchpad.net/python-mode
-;; used by XEmacs, and originally maintained with Python.
-;; That isn't covered by an FSF copyright assignment (?), unlike this
-;; code, and seems not to be well-maintained for Emacs (though I've
-;; submitted fixes).  This mode is rather simpler and is better in
-;; other ways.  In particular, using the syntax functions with text
-;; properties maintained by font-lock makes it more correct with
-;; arbitrary string and comment contents.
-
-;; This doesn't implement all the facilities of python-mode.el.  Some
-;; just need doing, e.g. catching exceptions in the inferior Python
-;; buffer (but see M-x pdb for debugging).  [Actually, the use of
-;; `compilation-shell-minor-mode' now is probably enough for that.]
-;; Others don't seem appropriate.  For instance,
-;; `forward-into-nomenclature' should be done separately, since it's
-;; not specific to Python, and I've installed a minor mode to do the
-;; job properly in Emacs 23.  [CC mode 5.31 contains an incompatible
-;; feature, `subword-mode' which is intended to have a similar
-;; effect, but actually only affects word-oriented keybindings.]
-
-;; Other things seem more natural or canonical here, e.g. the
-;; {beginning,end}-of-defun implementation dealing with nested
-;; definitions, and the inferior mode following `cmuscheme'.  (The
-;; inferior mode can find the source of errors from
-;; `python-send-region' & al via `compilation-shell-minor-mode'.)
-;; There is (limited) symbol completion using lookup in Python and
-;; Eldoc support also using the inferior process.  Successive TABs
-;; cycle between possible indentations for the line.
-
-;; Even where it has similar facilities, this mode is incompatible
-;; with python-mode.el in some respects.  For instance, various key
-;; bindings are changed to obey Emacs conventions.
-
-;; TODO: See various Fixmes below.
-
-;; Fixme: This doesn't support (the nascent) Python 3 .
+;; Major mode for editing Python files with some fontification and
+;; indentation bits extracted from original Dave Love's python.el
+;; found in GNU/Emacs.
+
+;; Implements Syntax highlighting, Indentation, Movement, Shell
+;; interaction, Shell completion, Shell virtualenv support, Pdb
+;; tracking, Symbol completion, Skeletons, FFAP, Code Check, Eldoc,
+;; imenu.
+
+;; Syntax highlighting: Fontification of code is provided and supports
+;; python's triple quoted strings properly.
+
+;; Indentation: Automatic indentation with indentation cycling is
+;; provided, it allows you to navigate different available levels of
+;; indentation by hitting <tab> several times.  Also when inserting a
+;; colon the `python-indent-electric-colon' command is invoked and
+;; causes the current line to be dedented automatically if needed.
+
+;; Movement: `beginning-of-defun' and `end-of-defun' functions are
+;; properly implemented.  There are also specialized
+;; `forward-sentence' and `backward-sentence' replacements called
+;; `python-nav-forward-block', `python-nav-backward-block'
+;; respectively which navigate between beginning of blocks of code.
+;; Extra functions `python-nav-forward-statement',
+;; `python-nav-backward-statement', `python-nav-statement-start',
+;; `python-nav-statement-end', `python-nav-block-start' and
+;; `python-nav-block-end' are included but no bound to any key.
+
+;; Shell interaction: is provided and allows you to execute easily any
+;; block of code of your current buffer in an inferior Python process.
+
+;; Shell completion: hitting tab will try to complete the current
+;; word.  Shell completion is implemented in a manner that if you
+;; change the `python-shell-interpreter' to any other (for example
+;; IPython) it should be easy to integrate another way to calculate
+;; completions.  You just need to specify your custom
+;; `python-shell-completion-setup-code' and
+;; `python-shell-completion-string-code'.
+
+;; Here is a complete example of the settings you would use for
+;; iPython 0.11:
+
+;; (setq
+;;  python-shell-interpreter "ipython"
+;;  python-shell-interpreter-args ""
+;;  python-shell-prompt-regexp "In \\[[0-9]+\\]: "
+;;  python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
+;;  python-shell-completion-setup-code
+;;    "from IPython.core.completerlib import module_completion"
+;;  python-shell-completion-module-string-code
+;;    "';'.join(module_completion('''%s'''))\n"
+;;  python-shell-completion-string-code
+;;    "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
+
+;; For iPython 0.10 everything would be the same except for
+;; `python-shell-completion-string-code' and
+;; `python-shell-completion-module-string-code':
+
+;; (setq python-shell-completion-string-code
+;;       "';'.join(__IP.complete('''%s'''))\n"
+;;       python-shell-completion-module-string-code "")
+
+;; Unfortunately running iPython on Windows needs some more tweaking.
+;; The way you must set `python-shell-interpreter' and
+;; `python-shell-interpreter-args' is as follows:
+
+;; (setq
+;;  python-shell-interpreter "C:\\Python27\\python.exe"
+;;  python-shell-interpreter-args
+;;  "-i C:\\Python27\\Scripts\\ipython-script.py")
+
+;; That will spawn the iPython process correctly (Of course you need
+;; to modify the paths according to your system).
+
+;; Please note that the default completion system depends on the
+;; readline module, so if you are using some Operating System that
+;; bundles Python without it (like Windows) just install the
+;; pyreadline from http://ipython.scipy.org/moin/PyReadline/Intro and
+;; you should be good to go.
+
+;; Shell virtualenv support: The shell also contains support for
+;; virtualenvs and other special environment modifications thanks to
+;; `python-shell-process-environment' and `python-shell-exec-path'.
+;; These two variables allows you to modify execution paths and
+;; environment variables to make easy for you to setup virtualenv rules
+;; or behavior modifications when running shells.  Here is an example
+;; of how to make shell processes to be run using the /path/to/env/
+;; virtualenv:
+
+;; (setq python-shell-process-environment
+;;       (list
+;;        (format "PATH=%s" (mapconcat
+;;                           'identity
+;;                           (reverse
+;;                            (cons (getenv "PATH")
+;;                                  '("/path/to/env/bin/")))
+;;                           ":"))
+;;        "VIRTUAL_ENV=/path/to/env/"))
+;; (python-shell-exec-path . ("/path/to/env/bin/"))
+
+;; Since the above is cumbersome and can be programmatically
+;; calculated, the variable `python-shell-virtualenv-path' is
+;; provided.  When this variable is set with the path of the
+;; virtualenv to use, `process-environment' and `exec-path' get proper
+;; values in order to run shells inside the specified virtualenv.  So
+;; the following will achieve the same as the previous example:
+
+;; (setq python-shell-virtualenv-path "/path/to/env/")
+
+;; Also the `python-shell-extra-pythonpaths' variable have been
+;; introduced as simple way of adding paths to the PYTHONPATH without
+;; affecting existing values.
+
+;; Pdb tracking: when you execute a block of code that contains some
+;; call to pdb (or ipdb) it will prompt the block of code and will
+;; follow the execution of pdb marking the current line with an arrow.
+
+;; Symbol completion: you can complete the symbol at point.  It uses
+;; the shell completion in background so you should run
+;; `python-shell-send-buffer' from time to time to get better results.
+
+;; Skeletons: 6 skeletons are provided for simple inserting of class,
+;; def, for, if, try and while.  These skeletons are integrated with
+;; dabbrev.  If you have `dabbrev-mode' activated and
+;; `python-skeleton-autoinsert' is set to t, then whenever you type
+;; the name of any of those defined and hit SPC, they will be
+;; automatically expanded.
+
+;; FFAP: You can find the filename for a given module when using ffap
+;; out of the box.  This feature needs an inferior python shell
+;; running.
+
+;; Code check: Check the current file for errors with `python-check'
+;; using the program defined in `python-check-command'.
+
+;; Eldoc: returns documentation for object at point by using the
+;; inferior python subprocess to inspect its documentation.  As you
+;; might guessed you should run `python-shell-send-buffer' from time
+;; to time to get better results too.
+
+;; imenu: This mode supports imenu in its most basic form, letting it
+;; build the necessary alist via `imenu-default-create-index-function'
+;; by having set `imenu-extract-index-name-function' to
+;; `python-info-current-defun'.
+
+;; If you used python-mode.el you probably will miss auto-indentation
+;; when inserting newlines.  To achieve the same behavior you have
+;; two options:
+
+;; 1) Use GNU/Emacs' standard binding for `newline-and-indent': C-j.
+
+;; 2) Add the following hook in your .emacs:
+
+;; (add-hook 'python-mode-hook
+;;   #'(lambda ()
+;;       (define-key python-mode-map "\C-m" 'newline-and-indent)))
+
+;; I'd recommend the first one since you'll get the same behavior for
+;; all modes out-of-the-box.
+
+;;; Installation:
+
+;; Add this to your .emacs:
+
+;; (add-to-list 'load-path "/folder/containing/file")
+;; (require 'python)
+
+;;; TODO:
 
 ;;; Code:
 
-(require 'comint)
 (require 'ansi-color)
+(require 'comint)
 
 (eval-when-compile
-  (require 'compile)
-  (require 'hippie-exp))
+  (require 'cl)
+  ;; Avoid compiler warnings
+  (defvar view-return-to-alist)
+  (defvar compilation-error-regexp-alist)
+  (defvar outline-heading-end-regexp))
 
 (autoload 'comint-mode "comint")
 
+;;;###autoload
+(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'")  'python-mode))
+;;;###autoload
+(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode))
+
 (defgroup python nil
-  "Silly walks in the Python language."
+  "Python Language's flying circus support for Emacs."
   :group 'languages
-  :version "22.1"
+  :version "23.2"
   :link '(emacs-commentary-link "python"))
+
 \f
-;;;###autoload
-(add-to-list 'interpreter-mode-alist (cons (purecopy "jython") 'jython-mode))
-;;;###autoload
-(add-to-list 'interpreter-mode-alist (cons (purecopy "python") 'python-mode))
-;;;###autoload
-(add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'")  'python-mode))
+;;; Bindings
+
+(defvar python-mode-map
+  (let ((map (make-sparse-keymap)))
+    ;; Movement
+    (substitute-key-definition 'backward-sentence
+                               'python-nav-backward-block
+                               map global-map)
+    (substitute-key-definition 'forward-sentence
+                               'python-nav-forward-block
+                               map global-map)
+    (define-key map "\C-c\C-j" 'imenu)
+    ;; Indent specific
+    (define-key map "\177" 'python-indent-dedent-line-backspace)
+    (define-key map (kbd "<backtab>") 'python-indent-dedent-line)
+    (define-key map "\C-c<" 'python-indent-shift-left)
+    (define-key map "\C-c>" 'python-indent-shift-right)
+    (define-key map ":" 'python-indent-electric-colon)
+    ;; Skeletons
+    (define-key map "\C-c\C-tc" 'python-skeleton-class)
+    (define-key map "\C-c\C-td" 'python-skeleton-def)
+    (define-key map "\C-c\C-tf" 'python-skeleton-for)
+    (define-key map "\C-c\C-ti" 'python-skeleton-if)
+    (define-key map "\C-c\C-tt" 'python-skeleton-try)
+    (define-key map "\C-c\C-tw" 'python-skeleton-while)
+    ;; Shell interaction
+    (define-key map "\C-c\C-s" 'python-shell-send-string)
+    (define-key map "\C-c\C-r" 'python-shell-send-region)
+    (define-key map "\C-\M-x" 'python-shell-send-defun)
+    (define-key map "\C-c\C-c" 'python-shell-send-buffer)
+    (define-key map "\C-c\C-l" 'python-shell-send-file)
+    (define-key map "\C-c\C-z" 'python-shell-switch-to-shell)
+    ;; Some util commands
+    (define-key map "\C-c\C-v" 'python-check)
+    (define-key map "\C-c\C-f" 'python-eldoc-at-point)
+    ;; Utilities
+    (substitute-key-definition 'complete-symbol 'completion-at-point
+                               map global-map)
+    (easy-menu-define python-menu map "Python Mode menu"
+      `("Python"
+        :help "Python-specific Features"
+        ["Shift region left" python-indent-shift-left :active mark-active
+         :help "Shift region left by a single indentation step"]
+        ["Shift region right" python-indent-shift-right :active mark-active
+         :help "Shift region right by a single indentation step"]
+        "-"
+        ["Start of def/class" beginning-of-defun
+         :help "Go to start of outermost definition around point"]
+        ["End of def/class" end-of-defun
+         :help "Go to end of definition around point"]
+        ["Mark def/class" mark-defun
+         :help "Mark outermost definition around point"]
+        ["Jump to def/class" imenu
+         :help "Jump to a class or function definition"]
+        "--"
+        ("Skeletons")
+        "---"
+        ["Start interpreter" run-python
+         :help "Run inferior Python process in a separate buffer"]
+        ["Switch to shell" python-shell-switch-to-shell
+         :help "Switch to running inferior Python process"]
+        ["Eval string" python-shell-send-string
+         :help "Eval string in inferior Python session"]
+        ["Eval buffer" python-shell-send-buffer
+         :help "Eval buffer in inferior Python session"]
+        ["Eval region" python-shell-send-region
+         :help "Eval region in inferior Python session"]
+        ["Eval defun" python-shell-send-defun
+         :help "Eval defun in inferior Python session"]
+        ["Eval file" python-shell-send-file
+         :help "Eval file in inferior Python session"]
+        ["Debugger" pdb :help "Run pdb under GUD"]
+        "----"
+        ["Check file" python-check
+         :help "Check file for errors"]
+        ["Help on symbol" python-eldoc-at-point
+         :help "Get help on symbol at point"]
+        ["Complete symbol" completion-at-point
+         :help "Complete symbol before point"]))
+    map)
+  "Keymap for `python-mode'.")
+
 \f
-;;;; Font lock
+;;; Python specialized rx
+
+(eval-when-compile
+  (defconst python-rx-constituents
+    `((block-start          . ,(rx symbol-start
+                                   (or "def" "class" "if" "elif" "else" "try"
+                                       "except" "finally" "for" "while" "with")
+                                   symbol-end))
+      (decorator            . ,(rx line-start (* space) ?@ (any letter ?_)
+                                   (* (any word ?_))))
+      (defun                . ,(rx symbol-start (or "def" "class") symbol-end))
+      (if-name-main         . ,(rx line-start "if" (+ space) "__name__"
+                                   (+ space) "==" (+ space)
+                                   (any ?' ?\") "__main__" (any ?' ?\")
+                                   (* space) ?:))
+      (symbol-name          . ,(rx (any letter ?_) (* (any word ?_))))
+      (open-paren           . ,(rx (or "{" "[" "(")))
+      (close-paren          . ,(rx (or "}" "]" ")")))
+      (simple-operator      . ,(rx (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%)))
+      ;; FIXME: rx should support (not simple-operator).
+      (not-simple-operator  . ,(rx
+                                (not
+                                 (any ?+ ?- ?/ ?& ?^ ?~ ?| ?* ?< ?> ?= ?%))))
+      ;; FIXME: Use regexp-opt.
+      (operator             . ,(rx (or "+" "-" "/" "&" "^" "~" "|" "*" "<" ">"
+                                       "=" "%" "**" "//" "<<" ">>" "<=" "!="
+                                       "==" ">=" "is" "not")))
+      ;; FIXME: Use regexp-opt.
+      (assignment-operator  . ,(rx (or "=" "+=" "-=" "*=" "/=" "//=" "%=" "**="
+                                       ">>=" "<<=" "&=" "^=" "|="))))
+    "Additional Python specific sexps for `python-rx'"))
+
+(defmacro python-rx (&rest regexps)
+  "Python mode specialized rx macro.
+This variant of `rx' supports common python named REGEXPS."
+  (let ((rx-constituents (append python-rx-constituents rx-constituents)))
+    (cond ((null regexps)
+           (error "No regexp"))
+          ((cdr regexps)
+           (rx-to-string `(and ,@regexps) t))
+          (t
+           (rx-to-string (car regexps) t)))))
 
+\f
+;;; Font-lock and syntax
 (defvar python-font-lock-keywords
+  ;; Keywords
   `(,(rx symbol-start
-        ;; From v 2.7 reference, § keywords.
-        ;; def and class dealt with separately below
-        (or "and" "as" "assert" "break" "continue" "del" "elif" "else"
-            "except" "exec" "finally" "for" "from" "global" "if"
-            "import" "in" "is" "lambda" "not" "or" "pass" "print"
-            "raise" "return" "try" "while" "with" "yield"
-             ;; Not real keywords, but close enough to be fontified as such
-             "self" "True" "False"
-             ;; Python 3
-             "nonlocal")
-        symbol-end)
-    (,(rx symbol-start "None" symbol-end)      ; see § Keywords in 2.7 manual
-     . font-lock-constant-face)
-    ;; Definitions
-    (,(rx symbol-start (group "class") (1+ space) (group (1+ (or word ?_))))
-     (1 font-lock-keyword-face) (2 font-lock-type-face))
-    (,(rx symbol-start (group "def") (1+ space) (group (1+ (or word ?_))))
-     (1 font-lock-keyword-face) (2 font-lock-function-name-face))
-    ;; Top-level assignments are worth highlighting.
-    (,(rx line-start (group (1+ (or word ?_))) (0+ space)
-         (opt (or "+" "-" "*" "**" "/" "//" "&" "%" "|" "^" "<<" ">>")) "=")
-     (1 font-lock-variable-name-face))
+         (or
+          "and" "del" "from" "not" "while" "as" "elif" "global" "or" "with"
+          "assert" "else" "if" "pass" "yield" "break" "except" "import" "class"
+          "in" "raise" "continue" "finally" "is" "return" "def" "for" "lambda"
+          "try"
+          ;; Python 2:
+          "print" "exec"
+          ;; Python 3:
+          ;; False, None, and True are listed as keywords on the Python 3
+          ;; documentation, but since they also qualify as constants they are
+          ;; fontified like that in order to keep font-lock consistent between
+          ;; Python versions.
+          "nonlocal"
+          ;; Extra:
+          "self")
+         symbol-end)
+    ;; functions
+    (,(rx symbol-start "def" (1+ space) (group (1+ (or word ?_))))
+     (1 font-lock-function-name-face))
+    ;; classes
+    (,(rx symbol-start "class" (1+ space) (group (1+ (or word ?_))))
+     (1 font-lock-type-face))
+    ;; Constants
+    (,(rx symbol-start
+          (or
+           "Ellipsis" "False" "None" "NotImplemented" "True" "__debug__"
+           ;; copyright, license, credits, quit and exit are added by the site
+           ;; module and they are not intended to be used in programs
+           "copyright" "credits" "exit" "license" "quit")
+          symbol-end) . font-lock-constant-face)
     ;; Decorators.
     (,(rx line-start (* (any " \t")) (group "@" (1+ (or word ?_))
-                                           (0+ "." (1+ (or word ?_)))))
+                                            (0+ "." (1+ (or word ?_)))))
      (1 font-lock-type-face))
-    ;; Built-ins.  (The next three blocks are from
-    ;; `__builtin__.__dict__.keys()' in Python 2.7)  These patterns
-    ;; are debatable, but they at least help to spot possible
-    ;; shadowing of builtins.
-    (,(rx symbol-start (or
-         ;; exceptions
-         "ArithmeticError" "AssertionError" "AttributeError"
-         "BaseException" "DeprecationWarning" "EOFError"
-         "EnvironmentError" "Exception" "FloatingPointError"
-         "FutureWarning" "GeneratorExit" "IOError" "ImportError"
-         "ImportWarning" "IndentationError" "IndexError" "KeyError"
-         "KeyboardInterrupt" "LookupError" "MemoryError" "NameError"
-         "NotImplemented" "NotImplementedError" "OSError"
-         "OverflowError" "PendingDeprecationWarning" "ReferenceError"
-         "RuntimeError" "RuntimeWarning" "StandardError"
-         "StopIteration" "SyntaxError" "SyntaxWarning" "SystemError"
-         "SystemExit" "TabError" "TypeError" "UnboundLocalError"
-         "UnicodeDecodeError" "UnicodeEncodeError" "UnicodeError"
-         "UnicodeTranslateError" "UnicodeWarning" "UserWarning"
-         "ValueError" "Warning" "ZeroDivisionError"
-         ;; Python 2.7
-         "BufferError" "BytesWarning" "WindowsError") symbol-end)
-     . font-lock-type-face)
-    (,(rx (or line-start (not (any ". \t"))) (* (any " \t")) symbol-start
-         (group (or
-         ;; callable built-ins, fontified when not appearing as
-         ;; object attributes
-         "abs" "all" "any" "apply" "basestring" "bool" "buffer" "callable"
-         "chr" "classmethod" "cmp" "coerce" "compile" "complex"
-         "copyright" "credits" "delattr" "dict" "dir" "divmod"
-         "enumerate" "eval" "execfile" "exit" "file" "filter" "float"
-         "frozenset" "getattr" "globals" "hasattr" "hash" "help"
-         "hex" "id" "input" "int" "intern" "isinstance" "issubclass"
-         "iter" "len" "license" "list" "locals" "long" "map" "max"
-         "min" "object" "oct" "open" "ord" "pow" "property" "quit"
-         "range" "raw_input" "reduce" "reload" "repr" "reversed"
-         "round" "set" "setattr" "slice" "sorted" "staticmethod"
-         "str" "sum" "super" "tuple" "type" "unichr" "unicode" "vars"
-         "xrange" "zip"
-         ;; Python 2.7.
-         "bin" "bytearray" "bytes" "format" "memoryview" "next" "print"
-         )) symbol-end)
-     (1 font-lock-builtin-face))
-    (,(rx symbol-start (or
-         ;; other built-ins
-         "True" "False" "None" "Ellipsis"
-         "_" "__debug__" "__doc__" "__import__" "__name__" "__package__")
-          symbol-end)
-     . font-lock-builtin-face)))
+    ;; Builtin Exceptions
+    (,(rx symbol-start
+          (or
+           "ArithmeticError" "AssertionError" "AttributeError" "BaseException"
+           "DeprecationWarning" "EOFError" "EnvironmentError" "Exception"
+           "FloatingPointError" "FutureWarning" "GeneratorExit" "IOError"
+           "ImportError" "ImportWarning" "IndexError" "KeyError"
+           "KeyboardInterrupt" "LookupError" "MemoryError" "NameError"
+           "NotImplementedError" "OSError" "OverflowError"
+           "PendingDeprecationWarning" "ReferenceError" "RuntimeError"
+           "RuntimeWarning" "StopIteration" "SyntaxError" "SyntaxWarning"
+           "SystemError" "SystemExit" "TypeError" "UnboundLocalError"
+           "UnicodeDecodeError" "UnicodeEncodeError" "UnicodeError"
+           "UnicodeTranslateError" "UnicodeWarning" "UserWarning" "VMSError"
+           "ValueError" "Warning" "WindowsError" "ZeroDivisionError"
+           ;; Python 2:
+           "StandardError"
+           ;; Python 3:
+           "BufferError" "BytesWarning" "IndentationError" "ResourceWarning"
+           "TabError")
+          symbol-end) . font-lock-type-face)
+    ;; Builtins
+    (,(rx symbol-start
+          (or
+           "abs" "all" "any" "bin" "bool" "callable" "chr" "classmethod"
+           "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate"
+           "eval" "filter" "float" "format" "frozenset" "getattr" "globals"
+           "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance"
+           "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
+           "min" "next" "object" "oct" "open" "ord" "pow" "print" "property"
+           "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted"
+           "staticmethod" "str" "sum" "super" "tuple" "type" "vars" "zip"
+           "__import__"
+           ;; Python 2:
+           "basestring" "cmp" "execfile" "file" "long" "raw_input" "reduce"
+           "reload" "unichr" "unicode" "xrange" "apply" "buffer" "coerce"
+           "intern"
+           ;; Python 3:
+           "ascii" "bytearray" "bytes" "exec"
+           ;; Extra:
+           "__all__" "__doc__" "__name__" "__package__")
+          symbol-end) . font-lock-builtin-face)
+    ;; assignments
+    ;; support for a = b = c = 5
+    (,(lambda (limit)
+        (let ((re (python-rx (group (+ (any word ?. ?_)))
+                             (? ?\[ (+ (not (any  ?\]))) ?\]) (* space)
+                             assignment-operator)))
+          (when (re-search-forward re limit t)
+            (while (and (python-info-ppss-context 'paren)
+                        (re-search-forward re limit t)))
+            (if (and (not (python-info-ppss-context 'paren))
+                     (not (equal (char-after (point-marker)) ?=)))
+                t
+              (set-match-data nil)))))
+     (1 font-lock-variable-name-face nil nil))
+    ;; support for a, b, c = (1, 2, 3)
+    (,(lambda (limit)
+        (let ((re (python-rx (group (+ (any word ?. ?_))) (* space)
+                             (* ?, (* space) (+ (any word ?. ?_)) (* space))
+                             ?, (* space) (+ (any word ?. ?_)) (* space)
+                             assignment-operator)))
+          (when (and (re-search-forward re limit t)
+                     (goto-char (nth 3 (match-data))))
+            (while (and (python-info-ppss-context 'paren)
+                        (re-search-forward re limit t))
+              (goto-char (nth 3 (match-data))))
+            (if (not (python-info-ppss-context 'paren))
+                t
+              (set-match-data nil)))))
+     (1 font-lock-variable-name-face nil nil))))
 
 (defconst python-syntax-propertize-function
   ;; Make outer chars of matching triple-quote sequences into generic
   ;; string delimiters.  Fixme: Is there a better way?
   ;; First avoid a sequence preceded by an odd number of backslashes.
   (syntax-propertize-rules
-   (;; ¡Backrefs don't work in syntax-propertize-rules!
+   (;; Â¡Backrefs don't work in syntax-propertize-rules!
     (concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix.
-              "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)")
-    (3 (ignore (python-quote-syntax))))
-   ;; This doesn't really help.
-   ;;((rx (and ?\\ (group ?\n))) (1 " "))
-   ))
+            "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)")
+    (3 (ignore (python-quote-syntax))))))
 
 (defun python-quote-syntax ()
   "Put `syntax-table' property correctly on triple quote.
@@ -203,8 +490,8 @@ Used for syntactic keywords.  N is the match number (1, 2 or 3)."
       (cond
        ((eq t (nth 3 syntax))           ; after unclosed fence
         ;; Consider property for the last char if in a fenced string.
-        (goto-char (nth 8 syntax))     ; fence position
-        (skip-chars-forward "uUrR")    ; skip any prefix
+        (goto-char (nth 8 syntax))  ; fence position
+        (skip-chars-forward "uUrR") ; skip any prefix
         ;; Is it a matching sequence?
         (if (eq (char-after) (char-after (match-beginning 2)))
             (put-text-property (match-beginning 3) (match-end 3)
@@ -219,125 +506,16 @@ Used for syntactic keywords.  N is the match number (1, 2 or 3)."
                            'syntax-table (string-to-syntax "|"))))
       )))
 
-;; This isn't currently in `font-lock-defaults' as probably not worth
-;; it -- we basically only mess with a few normally-symbol characters.
-
-;; (defun python-font-lock-syntactic-face-function (state)
-;;   "`font-lock-syntactic-face-function' for Python mode.
-;; Returns the string or comment face as usual, with side effect of putting
-;; a `syntax-table' property on the inside of the string or comment which is
-;; the standard syntax table."
-;;   (if (nth 3 state)
-;;       (save-excursion
-;;     (goto-char (nth 8 state))
-;;     (condition-case nil
-;;         (forward-sexp)
-;;       (error nil))
-;;     (put-text-property (1+ (nth 8 state)) (1- (point))
-;;                        'syntax-table (standard-syntax-table))
-;;     'font-lock-string-face)
-;;     (put-text-property (1+ (nth 8 state)) (line-end-position)
-;;                        'syntax-table (standard-syntax-table))
-;;     'font-lock-comment-face))
-\f
-;;;; Keymap and syntax
-
-(defvar python-mode-map
-  (let ((map (make-sparse-keymap)))
-    ;; Mostly taken from python-mode.el.
-    (define-key map ":" 'python-electric-colon)
-    (define-key map "\177" 'python-backspace)
-    (define-key map "\C-c<" 'python-shift-left)
-    (define-key map "\C-c>" 'python-shift-right)
-    (define-key map "\C-c\C-k" 'python-mark-block)
-    (define-key map "\C-c\C-d" 'python-pdbtrack-toggle-stack-tracking)
-    (define-key map "\C-c\C-n" 'python-next-statement)
-    (define-key map "\C-c\C-p" 'python-previous-statement)
-    (define-key map "\C-c\C-u" 'python-beginning-of-block)
-    (define-key map "\C-c\C-f" 'python-describe-symbol)
-    (define-key map "\C-c\C-w" 'python-check)
-    (define-key map "\C-c\C-v" 'python-check) ; a la sgml-mode
-    (define-key map "\C-c\C-s" 'python-send-string)
-    (define-key map [?\C-\M-x] 'python-send-defun)
-    (define-key map "\C-c\C-r" 'python-send-region)
-    (define-key map "\C-c\M-r" 'python-send-region-and-go)
-    (define-key map "\C-c\C-c" 'python-send-buffer)
-    (define-key map "\C-c\C-z" 'python-switch-to-python)
-    (define-key map "\C-c\C-m" 'python-load-file)
-    (define-key map "\C-c\C-l" 'python-load-file) ; a la cmuscheme
-    (substitute-key-definition 'complete-symbol 'completion-at-point
-                              map global-map)
-    (define-key map "\C-c\C-i" 'python-find-imports)
-    (define-key map "\C-c\C-t" 'python-expand-template)
-    (easy-menu-define python-menu map "Python Mode menu"
-      `("Python"
-       :help "Python-specific Features"
-       ["Shift region left" python-shift-left :active mark-active
-        :help "Shift by a single indentation step"]
-       ["Shift region right" python-shift-right :active mark-active
-        :help "Shift by a single indentation step"]
-       "-"
-       ["Mark block" python-mark-block
-        :help "Mark innermost block around point"]
-       ["Mark def/class" mark-defun
-        :help "Mark innermost definition around point"]
-       "-"
-       ["Start of block" python-beginning-of-block
-        :help "Go to start of innermost definition around point"]
-       ["End of block" python-end-of-block
-        :help "Go to end of innermost definition around point"]
-       ["Start of def/class" beginning-of-defun
-        :help "Go to start of innermost definition around point"]
-       ["End of def/class" end-of-defun
-        :help "Go to end of innermost definition around point"]
-       "-"
-       ("Templates..."
-        :help "Expand templates for compound statements"
-        :filter (lambda (&rest junk)
-                   (abbrev-table-menu python-mode-abbrev-table)))
-       "-"
-       ["Start interpreter" run-python
-        :help "Run `inferior' Python in separate buffer"]
-       ["Import/reload file" python-load-file
-        :help "Load into inferior Python session"]
-       ["Eval buffer" python-send-buffer
-        :help "Evaluate buffer en bloc in inferior Python session"]
-       ["Eval region" python-send-region :active mark-active
-        :help "Evaluate region en bloc in inferior Python session"]
-       ["Eval def/class" python-send-defun
-        :help "Evaluate current definition in inferior Python session"]
-       ["Switch to interpreter" python-switch-to-python
-        :help "Switch to inferior Python buffer"]
-       ["Set default process" python-set-proc
-        :help "Make buffer's inferior process the default"
-        :active (buffer-live-p python-buffer)]
-       ["Check file" python-check :help "Run pychecker"]
-       ["Debugger" pdb :help "Run pdb under GUD"]
-       "-"
-       ["Help on symbol" python-describe-symbol
-        :help "Use pydoc on symbol at point"]
-       ["Complete symbol" completion-at-point
-        :help "Complete (qualified) symbol before point"]
-       ["Find function" python-find-function
-        :help "Try to find source definition of function at point"]
-       ["Update imports" python-find-imports
-        :help "Update list of top-level imports for completion"]))
-    map))
-;; Fixme: add toolbar stuff for useful things like symbol help, send
-;; region, at least.  (Shouldn't be specific to Python, obviously.)
-;; eric has items including: (un)indent, (un)comment, restart script,
-;; run script, debug script; also things for profiling, unit testing.
-
 (defvar python-mode-syntax-table
   (let ((table (make-syntax-table)))
     ;; Give punctuation syntax to ASCII that normally has symbol
     ;; syntax or has word syntax and isn't a letter.
     (let ((symbol (string-to-syntax "_"))
-         (sst (standard-syntax-table)))
+          (sst (standard-syntax-table)))
       (dotimes (i 128)
-       (unless (= i ?_)
-         (if (equal symbol (aref sst i))
-             (modify-syntax-entry i "." table)))))
+        (unless (= i ?_)
+          (if (equal symbol (aref sst i))
+              (modify-syntax-entry i "." table)))))
     (modify-syntax-entry ?$ "." table)
     (modify-syntax-entry ?% "." table)
     ;; exceptions
@@ -345,1879 +523,1715 @@ Used for syntactic keywords.  N is the match number (1, 2 or 3)."
     (modify-syntax-entry ?\n ">" table)
     (modify-syntax-entry ?' "\"" table)
     (modify-syntax-entry ?` "$" table)
-    table))
-\f
-;;;; Utility stuff
-
-(defsubst python-in-string/comment ()
-  "Return non-nil if point is in a Python literal (a comment or string)."
-  ;; We don't need to save the match data.
-  (nth 8 (syntax-ppss)))
-
-(defconst python-space-backslash-table
-  (let ((table (copy-syntax-table python-mode-syntax-table)))
-    (modify-syntax-entry ?\\ " " table)
     table)
-  "`python-mode-syntax-table' with backslash given whitespace syntax.")
-
-(defun python-skip-comments/blanks (&optional backward)
-  "Skip comments and blank lines.
-BACKWARD non-nil means go backwards, otherwise go forwards.
-Backslash is treated as whitespace so that continued blank lines
-are skipped.  Doesn't move out of comments -- should be outside
-or at end of line."
-  (let ((arg (if backward
-                ;; If we're in a comment (including on the trailing
-                ;; newline), forward-comment doesn't move backwards out
-                ;; of it.  Don't set the syntax table round this bit!
-                (let ((syntax (syntax-ppss)))
-                  (if (nth 4 syntax)
-                      (goto-char (nth 8 syntax)))
-                  (- (point-max)))
-              (point-max))))
-    (with-syntax-table python-space-backslash-table
-      (forward-comment arg))))
-
-(defun python-backslash-continuation-line-p ()
-  "Non-nil if preceding line ends with backslash that is not in a comment."
-  (and (eq ?\\ (char-before (line-end-position 0)))
-       (not (syntax-ppss-context (syntax-ppss)))))
-
-(defun python-continuation-line-p ()
-  "Return non-nil if current line continues a previous one.
-The criteria are that the previous line ends in a backslash outside
-comments and strings, or that point is within brackets/parens."
-  (or (python-backslash-continuation-line-p)
-      (let ((depth (syntax-ppss-depth
-                   (save-excursion ; syntax-ppss with arg changes point
-                     (syntax-ppss (line-beginning-position))))))
-       (or (> depth 0)
-           (if (< depth 0)       ; Unbalanced brackets -- act locally
-               (save-excursion
-                 (condition-case ()
-                     (progn (backward-up-list) t) ; actually within brackets
-                   (error nil))))))))
-
-(defun python-comment-line-p ()
-  "Return non-nil if and only if current line has only a comment."
-  (save-excursion
-    (end-of-line)
-    (when (eq 'comment (syntax-ppss-context (syntax-ppss)))
-      (back-to-indentation)
-      (looking-at (rx (or (syntax comment-start) line-end))))))
+  "Syntax table for Python files.")
 
-(defun python-blank-line-p ()
-  "Return non-nil if and only if current line is blank."
-  (save-excursion
-    (beginning-of-line)
-    (looking-at "\\s-*$")))
-
-(defun python-beginning-of-string ()
-  "Go to beginning of string around point.
-Do nothing if not in string."
-  (let ((state (syntax-ppss)))
-    (when (eq 'string (syntax-ppss-context state))
-      (goto-char (nth 8 state)))))
-
-(defun python-open-block-statement-p (&optional bos)
-  "Return non-nil if statement at point opens a block.
-BOS non-nil means point is known to be at beginning of statement."
-  (save-excursion
-    (unless bos (python-beginning-of-statement))
-    (looking-at (rx (and (or "if" "else" "elif" "while" "for" "def"
-                            "class" "try" "except" "finally" "with")
-                        symbol-end)))))
-
-(defun python-close-block-statement-p (&optional bos)
-  "Return non-nil if current line is a statement closing a block.
-BOS non-nil means point is at beginning of statement.
-The criteria are that the line isn't a comment or in string and
- starts with keyword `raise', `break', `continue' or `pass'."
-  (save-excursion
-    (unless bos (python-beginning-of-statement))
-    (back-to-indentation)
-    (looking-at (rx (or "return" "raise" "break" "continue" "pass")
-                   symbol-end))))
+(defvar python-dotty-syntax-table
+  (let ((table (make-syntax-table python-mode-syntax-table)))
+    (modify-syntax-entry ?. "w" table)
+    (modify-syntax-entry ?_ "w" table)
+    table)
+  "Dotty syntax table for Python files.
+It makes underscores and dots word constituent chars.")
 
-(defun python-outdent-p ()
-  "Return non-nil if current line should outdent a level."
-  (save-excursion
-    (back-to-indentation)
-    (and (looking-at (rx (and (or "else" "finally" "except" "elif")
-                             symbol-end)))
-        (not (python-in-string/comment))
-        ;; Ensure there's a previous statement and move to it.
-        (zerop (python-previous-statement))
-        (not (python-close-block-statement-p t))
-        ;; Fixme: check this
-        (not (python-open-block-statement-p)))))
 \f
-;;;; Indentation.
+;;; Indentation
 
-(defcustom python-indent 4
-  "Number of columns for a unit of indentation in Python mode.
-See also `\\[python-guess-indent]'"
+(defcustom python-indent-offset 4
+  "Default indentation offset for Python."
   :group 'python
-  :type 'integer)
-(put 'python-indent 'safe-local-variable 'integerp)
+  :type 'integer
+  :safe 'integerp)
 
-(defcustom python-guess-indent t
-  "Non-nil means Python mode guesses `python-indent' for the buffer."
+(defcustom python-indent-guess-indent-offset t
+  "Non-nil tells Python mode to guess `python-indent-offset' value."
   :type 'boolean
-  :group 'python)
-
-(defcustom python-indent-string-contents t
-  "Non-nil means indent contents of multi-line strings together.
-This means indent them the same as the preceding non-blank line.
-Otherwise preserve their indentation.
-
-This only applies to `doc' strings, i.e. those that form statements;
-the indentation is preserved in others."
-  :type '(choice (const :tag "Align with preceding" t)
-                (const :tag "Preserve indentation" nil))
-  :group 'python)
-
-(defcustom python-honour-comment-indentation nil
-  "Non-nil means indent relative to preceding comment line.
-Only do this for comments where the leading comment character is
-followed by space.  This doesn't apply to comment lines, which
-are always indented in lines with preceding comments."
-  :type 'boolean
-  :group 'python)
-
-(defcustom python-continuation-offset 4
-  "Number of columns of additional indentation for continuation lines.
-Continuation lines follow a backslash-terminated line starting a
-statement."
   :group 'python
-  :type 'integer)
-
-
-(defcustom python-pdbtrack-do-tracking-p t
-  "*Controls whether the pdbtrack feature is enabled or not.
-
-When non-nil, pdbtrack is enabled in all comint-based buffers,
-e.g. shell interaction buffers and the *Python* buffer.
-
-When using pdb to debug a Python program, pdbtrack notices the
-pdb prompt and presents the line in the source file where the
-program is stopped in a pop-up buffer.  It's similar to what
-gud-mode does for debugging C programs with gdb, but without
-having to restart the program."
-  :type 'boolean
-  :group 'python)
-(make-variable-buffer-local 'python-pdbtrack-do-tracking-p)
-
-(defcustom python-pdbtrack-minor-mode-string " PDB"
-  "*Minor-mode sign to be displayed when pdbtrack is active."
-  :type 'string
-  :group 'python)
+  :safe 'booleanp)
 
-;; Add a designator to the minor mode strings
-(or (assq 'python-pdbtrack-is-tracking-p minor-mode-alist)
-    (push '(python-pdbtrack-is-tracking-p python-pdbtrack-minor-mode-string)
-         minor-mode-alist))
-
-(defcustom python-shell-prompt-alist
-  '(("ipython" . "^In \\[[0-9]+\\]: *")
-    (t . "^>>> "))
-  "Alist of Python input prompts.
-Each element has the form (PROGRAM . REGEXP), where PROGRAM is
-the value of `python-python-command' for the python process and
-REGEXP is a regular expression matching the Python prompt.
-PROGRAM can also be t, which specifies the default when no other
-element matches `python-python-command'."
-  :type 'string
-  :group 'python
-  :version "24.1")
-
-(defcustom python-shell-continuation-prompt-alist
-  '(("ipython" . "^   [.][.][.]+: *")
-    (t . "^[.][.][.] "))
-  "Alist of Python continued-line prompts.
-Each element has the form (PROGRAM . REGEXP), where PROGRAM is
-the value of `python-python-command' for the python process and
-REGEXP is a regular expression matching the Python prompt for
-continued lines.
-PROGRAM can also be t, which specifies the default when no other
-element matches `python-python-command'."
-  :type 'string
-  :group 'python
-  :version "24.1")
+(define-obsolete-variable-alias
+  'python-indent 'python-indent-offset "24.2")
 
-(defvar python-pdbtrack-is-tracking-p nil)
+(define-obsolete-variable-alias
+  'python-guess-indent 'python-indent-guess-indent-offset "24.2")
 
-(defconst python-pdbtrack-stack-entry-regexp
-  "^> \\(.*\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()"
-  "Regular expression pdbtrack uses to find a stack trace entry.")
+(defvar python-indent-current-level 0
+  "Current indentation level `python-indent-line-function' is using.")
 
-(defconst python-pdbtrack-input-prompt "\n[(<]*[Ii]?[Pp]db[>)]+ "
-  "Regular expression pdbtrack uses to recognize a pdb prompt.")
+(defvar python-indent-levels '(0)
+  "Levels of indentation available for `python-indent-line-function'.")
 
-(defconst python-pdbtrack-track-range 10000
-  "Max number of characters from end of buffer to search for stack entry.")
+(defvar python-indent-dedenters '("else" "elif" "except" "finally")
+  "List of words that should be dedented.
+These make `python-indent-calculate-indentation' subtract the value of
+`python-indent-offset'.")
 
-(defun python-guess-indent ()
-  "Guess step for indentation of current buffer.
-Set `python-indent' locally to the value guessed."
+(defun python-indent-guess-indent-offset ()
+  "Guess and set `python-indent-offset' for the current buffer."
   (interactive)
   (save-excursion
     (save-restriction
       (widen)
       (goto-char (point-min))
-      (let (done indent)
-       (while (and (not done) (not (eobp)))
-         (when (and (re-search-forward (rx ?: (0+ space)
-                                           (or (syntax comment-start)
-                                               line-end))
-                                       nil 'move)
-                    (python-open-block-statement-p))
-           (save-excursion
-             (python-beginning-of-statement)
-             (let ((initial (current-indentation)))
-               (if (zerop (python-next-statement))
-                   (setq indent (- (current-indentation) initial)))
-               (if (and indent (>= indent 2) (<= indent 8)) ; sanity check
-                   (setq done t))))))
-       (when done
-         (when (/= indent (default-value 'python-indent))
-           (set (make-local-variable 'python-indent) indent)
-           (unless (= tab-width python-indent)
-             (setq indent-tabs-mode nil)))
-         indent)))))
-
-;; Alist of possible indentations and start of statement they would
-;; close.  Used in indentation cycling (below).
-(defvar python-indent-list nil
-  "Internal use.")
-;; Length of the above
-(defvar python-indent-list-length nil
-  "Internal use.")
-;; Current index into the alist.
-(defvar python-indent-index nil
-  "Internal use.")
-
-(defun python-calculate-indentation ()
-  "Calculate Python indentation for line at point."
-  (setq python-indent-list nil
-       python-indent-list-length 1)
-  (save-excursion
-    (beginning-of-line)
-    (let ((syntax (syntax-ppss))
-         start)
-      (cond
-       ((eq 'string (syntax-ppss-context syntax)) ; multi-line string
-       (if (not python-indent-string-contents)
-           (current-indentation)
-         ;; Only respect `python-indent-string-contents' in doc
-         ;; strings (defined as those which form statements).
-         (if (not (save-excursion
-                    (python-beginning-of-statement)
-                    (looking-at (rx (or (syntax string-delimiter)
-                                        (syntax string-quote))))))
-             (current-indentation)
-           ;; Find indentation of preceding non-blank line within string.
-           (setq start (nth 8 syntax))
-           (forward-line -1)
-           (while (and (< start (point)) (looking-at "\\s-*$"))
-             (forward-line -1))
-           (current-indentation))))
-       ((python-continuation-line-p)   ; after backslash, or bracketed
-       (let ((point (point))
-             (open-start (cadr syntax))
-             (backslash (python-backslash-continuation-line-p))
-             (colon (eq ?: (char-before (1- (line-beginning-position))))))
-         (if open-start
-             ;; Inside bracketed expression.
-             (progn
-               (goto-char (1+ open-start))
-               ;; Look for first item in list (preceding point) and
-               ;; align with it, if found.
-               (if (with-syntax-table python-space-backslash-table
-                     (let ((parse-sexp-ignore-comments t))
-                       (condition-case ()
-                           (progn (forward-sexp)
-                                  (backward-sexp)
-                                  (< (point) point))
-                         (error nil))))
-                   ;; Extra level if we're backslash-continued or
-                   ;; following a key.
-                   (if (or backslash colon)
-                       (+ python-indent (current-column))
-                       (current-column))
-                 ;; Otherwise indent relative to statement start, one
-                 ;; level per bracketing level.
-                 (goto-char (1+ open-start))
-                 (python-beginning-of-statement)
-                 (+ (current-indentation) (* (car syntax) python-indent))))
-           ;; Otherwise backslash-continued.
-           (forward-line -1)
-           (if (python-continuation-line-p)
-               ;; We're past first continuation line.  Align with
-               ;; previous line.
-               (current-indentation)
-             ;; First continuation line.  Indent one step, with an
-             ;; extra one if statement opens a block.
-             (python-beginning-of-statement)
-             (+ (current-indentation) python-continuation-offset
-                (if (python-open-block-statement-p t)
-                    python-indent
-                  0))))))
-       ((bobp) 0)
-       ;; Fixme: Like python-mode.el; not convinced by this.
-       ((looking-at (rx (0+ space) (syntax comment-start)
-                       (not (any " \t\n")))) ; non-indentable comment
-       (current-indentation))
-       ((and python-honour-comment-indentation
-            ;; Back over whitespace, newlines, non-indentable comments.
-            (catch 'done
-              (while (cond ((bobp) nil)
-                           ((not (forward-comment -1))
-                            nil)       ; not at comment start
-                           ;; Now at start of comment -- trailing one?
-                           ((/= (current-column) (current-indentation))
-                            nil)
-                           ;; Indentable comment, like python-mode.el?
-                           ((and (looking-at (rx (syntax comment-start)
-                                                 (or space line-end)))
-                                 (/= 0 (current-column)))
-                            (throw 'done (current-column)))
-                           ;; Else skip it (loop).
-                           (t))))))
-       (t
-       (python-indentation-levels)
-       ;; Prefer to indent comments with an immediately-following
-       ;; statement, e.g.
-       ;;       ...
-       ;;   # ...
-       ;;   def ...
-       (when (and (> python-indent-list-length 1)
-                  (python-comment-line-p))
-         (forward-line)
-         (unless (python-comment-line-p)
-           (let ((elt (assq (current-indentation) python-indent-list)))
-             (setq python-indent-list
-                   (nconc (delete elt python-indent-list)
-                          (list elt))))))
-       (caar (last python-indent-list)))))))
-
-;;;; Cycling through the possible indentations with successive TABs.
-
-;; These don't need to be buffer-local since they're only relevant
-;; during a cycle.
-
-(defun python-initial-text ()
-  "Text of line following indentation and ignoring any trailing comment."
-  (save-excursion
-    (buffer-substring (progn
-                       (back-to-indentation)
-                       (point))
-                     (progn
-                       (end-of-line)
-                       (forward-comment -1)
-                       (point)))))
-
-(defconst python-block-pairs
-  '(("else" "if" "elif" "while" "for" "try" "except")
-    ("elif" "if" "elif")
-    ("except" "try" "except")
-    ("finally" "else" "try" "except"))
-  "Alist of keyword matches.
-The car of an element is a keyword introducing a statement which
-can close a block opened by a keyword in the cdr.")
-
-(defun python-first-word ()
-  "Return first word (actually symbol) on the line."
-  (save-excursion
-    (back-to-indentation)
-    (current-word t)))
-
-(defun python-indentation-levels ()
-  "Return a list of possible indentations for this line.
-It is assumed not to be a continuation line or in a multi-line string.
-Includes the default indentation and those which would close all
-enclosing blocks.  Elements of the list are actually pairs:
-\(INDENTATION . TEXT), where TEXT is the initial text of the
-corresponding block opening (or nil)."
-  (save-excursion
-    (let ((initial "")
-         levels indent)
-      ;; Only one possibility immediately following a block open
-      ;; statement, assuming it doesn't have a `suite' on the same line.
-      (cond
-       ((save-excursion (and (python-previous-statement)
-                            (python-open-block-statement-p t)
-                            (setq indent (current-indentation))
-                            ;; Check we don't have something like:
-                            ;;   if ...: ...
-                            (if (progn (python-end-of-statement)
-                                       (python-skip-comments/blanks t)
-                                       (eq ?: (char-before)))
-                                (setq indent (+ python-indent indent)))))
-       (push (cons indent initial) levels))
-       ;; Only one possibility for comment line immediately following
-       ;; another.
-       ((save-excursion
-         (when (python-comment-line-p)
-           (forward-line -1)
-           (if (python-comment-line-p)
-               (push (cons (current-indentation) initial) levels)))))
-       ;; Fixme: Maybe have a case here which indents (only) first
-       ;; line after a lambda.
-       (t
-       (let ((start (car (assoc (python-first-word) python-block-pairs))))
-         (python-previous-statement)
-         ;; Is this a valid indentation for the line of interest?
-         (unless (or (if start         ; potentially only outdentable
-                         ;; Check for things like:
-                         ;;   if ...: ...
-                         ;;   else ...:
-                         ;; where the second line need not be outdented.
-                         (not (member (python-first-word)
-                                      (cdr (assoc start
-                                                  python-block-pairs)))))
-                     ;; Not sensible to indent to the same level as
-                     ;; previous `return' &c.
-                     (python-close-block-statement-p))
-           (push (cons (current-indentation) (python-initial-text))
-                 levels))
-         (while (python-beginning-of-block)
-           (when (or (not start)
-                     (member (python-first-word)
-                             (cdr (assoc start python-block-pairs))))
-             (push (cons (current-indentation) (python-initial-text))
-                   levels))))))
-      (prog1 (or levels (setq levels '((0 . ""))))
-       (setq python-indent-list levels
-             python-indent-list-length (length python-indent-list))))))
-
-;; This is basically what `python-indent-line' would be if we didn't
-;; do the cycling.
-(defun python-indent-line-1 (&optional leave)
-  "Subroutine of `python-indent-line'.
-Does non-repeated indentation.  LEAVE non-nil means leave
-indentation if it is valid, i.e. one of the positions returned by
-`python-calculate-indentation'."
-  (let ((target (python-calculate-indentation))
-       (pos (- (point-max) (point))))
-    (if (or (= target (current-indentation))
-           ;; Maybe keep a valid indentation.
-           (and leave python-indent-list
-                (assq (current-indentation) python-indent-list)))
-       (if (< (current-column) (current-indentation))
-           (back-to-indentation))
-      (beginning-of-line)
-      (delete-horizontal-space)
-      (indent-to target)
-      (if (> (- (point-max) pos) (point))
-         (goto-char (- (point-max) pos))))))
-
-(defun python-indent-line ()
-  "Indent current line as Python code.
-When invoked via `indent-for-tab-command', cycle through possible
-indentations for current line.  The cycle is broken by a command
-different from `indent-for-tab-command', i.e. successive TABs do
-the cycling."
-  (interactive)
-  (if (and (eq this-command 'indent-for-tab-command)
-          (eq last-command this-command))
-      (if (= 1 python-indent-list-length)
-         (message "Sole indentation")
-       (progn (setq python-indent-index
-                    (% (1+ python-indent-index) python-indent-list-length))
-              (beginning-of-line)
-              (delete-horizontal-space)
-              (indent-to (car (nth python-indent-index python-indent-list)))
-              (if (python-block-end-p)
-                  (let ((text (cdr (nth python-indent-index
-                                        python-indent-list))))
-                    (if text
-                        (message "Closes: %s" text))))))
-    (python-indent-line-1)
-    (setq python-indent-index (1- python-indent-list-length))))
+      (let ((block-end))
+        (while (and (not block-end)
+                    (re-search-forward
+                     (python-rx line-start block-start) nil t))
+          (when (and
+                 (not (python-info-ppss-context-type))
+                 (progn
+                   (goto-char (line-end-position))
+                   (python-util-forward-comment -1)
+                   (if (equal (char-before) ?:)
+                       t
+                     (forward-line 1)
+                     (when (python-info-block-continuation-line-p)
+                       (while (and (python-info-continuation-line-p)
+                                   (not (eobp)))
+                         (forward-line 1))
+                       (python-util-forward-comment -1)
+                       (when (equal (char-before) ?:)
+                         t)))))
+            (setq block-end (point-marker))))
+        (let ((indentation
+               (when block-end
+                 (goto-char block-end)
+                 (python-util-forward-comment)
+                 (current-indentation))))
+          (if indentation
+              (setq python-indent-offset indentation)
+            (message "Can't guess python-indent-offset, using defaults: %s"
+                     python-indent-offset)))))))
+
+(defun python-indent-context ()
+  "Get information on indentation context.
+Context information is returned with a cons with the form:
+    \(STATUS . START)
+
+Where status can be any of the following symbols:
+ * inside-paren: If point in between (), {} or []
+ * inside-string: If point is inside a string
+ * after-backslash: Previous line ends in a backslash
+ * after-beginning-of-block: Point is after beginning of block
+ * after-line: Point is after normal line
+ * no-indent: Point is at beginning of buffer or other special case
+START is the buffer position where the sexp starts."
+  (save-restriction
+    (widen)
+    (let ((ppss (save-excursion (beginning-of-line) (syntax-ppss)))
+          (start))
+      (cons
+       (cond
+        ;; Beginning of buffer
+        ((save-excursion
+           (goto-char (line-beginning-position))
+           (bobp))
+         'no-indent)
+        ;; Inside a paren
+        ((setq start (python-info-ppss-context 'paren ppss))
+         'inside-paren)
+        ;; Inside string
+        ((setq start (python-info-ppss-context 'string ppss))
+         'inside-string)
+        ;; After backslash
+        ((setq start (when (not (or (python-info-ppss-context 'string ppss)
+                                    (python-info-ppss-context 'comment ppss)))
+                       (let ((line-beg-pos (line-beginning-position)))
+                         (when (python-info-line-ends-backslash-p
+                                (1- line-beg-pos))
+                           (- line-beg-pos 2)))))
+         'after-backslash)
+        ;; After beginning of block
+        ((setq start (save-excursion
+                       (when (progn
+                               (back-to-indentation)
+                               (python-util-forward-comment -1)
+                               (equal (char-before) ?:))
+                         ;; Move to the first block start that's not in within
+                         ;; a string, comment or paren and that's not a
+                         ;; continuation line.
+                         (while (and (re-search-backward
+                                      (python-rx block-start) nil t)
+                                     (or
+                                      (python-info-ppss-context 'string)
+                                      (python-info-ppss-context 'comment)
+                                      (python-info-ppss-context 'paren)
+                                      (python-info-continuation-line-p))))
+                         (when (looking-at (python-rx block-start))
+                           (point-marker)))))
+         'after-beginning-of-block)
+        ;; After normal line
+        ((setq start (save-excursion
+                       (back-to-indentation)
+                       (python-util-forward-comment -1)
+                       (python-nav-statement-start)
+                       (point-marker)))
+         'after-line)
+        ;; Do not indent
+        (t 'no-indent))
+       start))))
+
+(defun python-indent-calculate-indentation ()
+  "Calculate correct indentation offset for the current line."
+  (let* ((indentation-context (python-indent-context))
+         (context-status (car indentation-context))
+         (context-start (cdr indentation-context)))
+    (save-restriction
+      (widen)
+      (save-excursion
+        (case context-status
+          ('no-indent 0)
+          ;; When point is after beginning of block just add one level
+          ;; of indentation relative to the context-start
+          ('after-beginning-of-block
+           (goto-char context-start)
+           (+ (current-indentation) python-indent-offset))
+          ;; When after a simple line just use previous line
+          ;; indentation, in the case current line starts with a
+          ;; `python-indent-dedenters' de-indent one level.
+          ('after-line
+           (-
+            (save-excursion
+              (goto-char context-start)
+              (current-indentation))
+            (if (progn
+                  (back-to-indentation)
+                  (looking-at (regexp-opt python-indent-dedenters)))
+                python-indent-offset
+              0)))
+          ;; When inside of a string, do nothing. just use the current
+          ;; indentation.  XXX: perhaps it would be a good idea to
+          ;; invoke standard text indentation here
+          ('inside-string
+           (goto-char context-start)
+           (current-indentation))
+          ;; After backslash we have several possibilities.
+          ('after-backslash
+           (cond
+            ;; Check if current line is a dot continuation.  For this
+            ;; the current line must start with a dot and previous
+            ;; line must contain a dot too.
+            ((save-excursion
+               (back-to-indentation)
+               (when (looking-at "\\.")
+                 ;; If after moving one line back point is inside a paren it
+                 ;; needs to move back until it's not anymore
+                 (while (prog2
+                            (forward-line -1)
+                            (and (not (bobp))
+                                 (python-info-ppss-context 'paren))))
+                 (goto-char (line-end-position))
+                 (while (and (re-search-backward
+                              "\\." (line-beginning-position) t)
+                             (or (python-info-ppss-context 'comment)
+                                 (python-info-ppss-context 'string)
+                                 (python-info-ppss-context 'paren))))
+                 (if (and (looking-at "\\.")
+                          (not (or (python-info-ppss-context 'comment)
+                                   (python-info-ppss-context 'string)
+                                   (python-info-ppss-context 'paren))))
+                     ;; The indentation is the same column of the
+                     ;; first matching dot that's not inside a
+                     ;; comment, a string or a paren
+                     (current-column)
+                   ;; No dot found on previous line, just add another
+                   ;; indentation level.
+                   (+ (current-indentation) python-indent-offset)))))
+            ;; Check if prev line is a block continuation
+            ((let ((block-continuation-start
+                    (python-info-block-continuation-line-p)))
+               (when block-continuation-start
+                 ;; If block-continuation-start is set jump to that
+                 ;; marker and use first column after the block start
+                 ;; as indentation value.
+                 (goto-char block-continuation-start)
+                 (re-search-forward
+                  (python-rx block-start (* space))
+                  (line-end-position) t)
+                 (current-column))))
+            ;; Check if current line is an assignment continuation
+            ((let ((assignment-continuation-start
+                    (python-info-assignment-continuation-line-p)))
+               (when assignment-continuation-start
+                 ;; If assignment-continuation is set jump to that
+                 ;; marker and use first column after the assignment
+                 ;; operator as indentation value.
+                 (goto-char assignment-continuation-start)
+                 (current-column))))
+            (t
+             (forward-line -1)
+             (goto-char (python-info-beginning-of-backslash))
+             (if (save-excursion
+                   (and
+                    (forward-line -1)
+                    (goto-char
+                     (or (python-info-beginning-of-backslash) (point)))
+                    (python-info-line-ends-backslash-p)))
+                 ;; The two previous lines ended in a backslash so we must
+                 ;; respect previous line indentation.
+                 (current-indentation)
+               ;; What happens here is that we are dealing with the second
+               ;; line of a backslash continuation, in that case we just going
+               ;; to add one indentation level.
+               (+ (current-indentation) python-indent-offset)))))
+          ;; When inside a paren there's a need to handle nesting
+          ;; correctly
+          ('inside-paren
+           (cond
+            ;; If current line closes the outermost open paren use the
+            ;; current indentation of the context-start line.
+            ((save-excursion
+               (skip-syntax-forward "\s" (line-end-position))
+               (when (and (looking-at (regexp-opt '(")" "]" "}")))
+                          (progn
+                            (forward-char 1)
+                            (not (python-info-ppss-context 'paren))))
+                 (goto-char context-start)
+                 (current-indentation))))
+            ;; If open paren is contained on a line by itself add another
+            ;; indentation level, else look for the first word after the
+            ;; opening paren and use it's column position as indentation
+            ;; level.
+            ((let* ((content-starts-in-newline)
+                    (indent
+                     (save-excursion
+                       (if (setq content-starts-in-newline
+                                 (progn
+                                   (goto-char context-start)
+                                   (forward-char)
+                                   (save-restriction
+                                     (narrow-to-region
+                                      (line-beginning-position)
+                                      (line-end-position))
+                                     (python-util-forward-comment))
+                                   (looking-at "$")))
+                           (+ (current-indentation) python-indent-offset)
+                         (current-column)))))
+               ;; Adjustments
+               (cond
+                ;; If current line closes a nested open paren de-indent one
+                ;; level.
+                ((progn
+                   (back-to-indentation)
+                   (looking-at (regexp-opt '(")" "]" "}"))))
+                 (- indent python-indent-offset))
+                ;; If the line of the opening paren that wraps the current
+                ;; line starts a block add another level of indentation to
+                ;; follow new pep8 recommendation. See: http://ur1.ca/5rojx
+                ((save-excursion
+                   (when (and content-starts-in-newline
+                              (progn
+                                (goto-char context-start)
+                                (back-to-indentation)
+                                (looking-at (python-rx block-start))))
+                     (+ indent python-indent-offset))))
+                (t indent)))))))))))
+
+(defun python-indent-calculate-levels ()
+  "Calculate `python-indent-levels' and reset `python-indent-current-level'."
+  (let* ((indentation (python-indent-calculate-indentation))
+         (remainder (% indentation python-indent-offset))
+         (steps (/ (- indentation remainder) python-indent-offset)))
+    (setq python-indent-levels (list 0))
+    (dotimes (step steps)
+      (push (* python-indent-offset (1+ step)) python-indent-levels))
+    (when (not (eq 0 remainder))
+      (push (+ (* python-indent-offset steps) remainder) python-indent-levels))
+    (setq python-indent-levels (nreverse python-indent-levels))
+    (setq python-indent-current-level (1- (length python-indent-levels)))))
+
+(defun python-indent-toggle-levels ()
+  "Toggle `python-indent-current-level' over `python-indent-levels'."
+  (setq python-indent-current-level (1- python-indent-current-level))
+  (when (< python-indent-current-level 0)
+    (setq python-indent-current-level (1- (length python-indent-levels)))))
+
+(defun python-indent-line (&optional force-toggle)
+  "Internal implementation of `python-indent-line-function'.
+Uses the offset calculated in
+`python-indent-calculate-indentation' and available levels
+indicated by the variable `python-indent-levels' to set the
+current indentation.
+
+When the variable `last-command' is equal to
+`indent-for-tab-command' or FORCE-TOGGLE is non-nil it cycles
+levels indicated in the variable `python-indent-levels' by
+setting the current level in the variable
+`python-indent-current-level'.
+
+When the variable `last-command' is not equal to
+`indent-for-tab-command' and FORCE-TOGGLE is nil it calculates
+possible indentation levels and saves it in the variable
+`python-indent-levels'.  Afterwards it sets the variable
+`python-indent-current-level' correctly so offset is equal
+to (`nth' `python-indent-current-level' `python-indent-levels')"
+  (if (or (and (eq this-command 'indent-for-tab-command)
+               (eq last-command this-command))
+          force-toggle)
+      (if (not (equal python-indent-levels '(0)))
+          (python-indent-toggle-levels)
+        (python-indent-calculate-levels))
+    (python-indent-calculate-levels))
+  (beginning-of-line)
+  (delete-horizontal-space)
+  (indent-to (nth python-indent-current-level python-indent-levels))
+  (python-info-closing-block-message))
+
+(defun python-indent-line-function ()
+  "`indent-line-function' for Python mode.
+See `python-indent-line' for details."
+  (python-indent-line))
+
+(defun python-indent-dedent-line ()
+  "De-indent current line."
+  (interactive "*")
+  (when (and (not (or (python-info-ppss-context 'string)
+                      (python-info-ppss-context 'comment)))
+             (<= (point-marker) (save-excursion
+                                  (back-to-indentation)
+                                  (point-marker)))
+             (> (current-column) 0))
+    (python-indent-line t)
+    t))
+
+(defun python-indent-dedent-line-backspace (arg)
+  "De-indent current line.
+Argument ARG is passed to `backward-delete-char-untabify' when
+point is  not in between the indentation."
+  (interactive "*p")
+  (when (not (python-indent-dedent-line))
+    (backward-delete-char-untabify arg)))
+(put 'python-indent-dedent-line-backspace 'delete-selection 'supersede)
 
 (defun python-indent-region (start end)
-  "`indent-region-function' for Python.
-Leaves validly-indented lines alone, i.e. doesn't indent to
-another valid position."
-  (save-excursion
-    (goto-char end)
-    (setq end (point-marker))
-    (goto-char start)
-    (or (bolp) (forward-line 1))
-    (while (< (point) end)
-      (or (and (bolp) (eolp))
-         (python-indent-line-1 t))
-      (forward-line 1))
-    (move-marker end nil)))
-
-(defun python-block-end-p ()
-  "Non-nil if this is a line in a statement closing a block,
-or a blank line indented to where it would close a block."
-  (and (not (python-comment-line-p))
-       (or (python-close-block-statement-p t)
-          (< (current-indentation)
-             (save-excursion
-               (python-previous-statement)
-               (current-indentation))))))
+  "Indent a python region automagically.
+
+Called from a program, START and END specify the region to indent."
+  (let ((deactivate-mark nil))
+    (save-excursion
+      (goto-char end)
+      (setq end (point-marker))
+      (goto-char start)
+      (or (bolp) (forward-line 1))
+      (while (< (point) end)
+        (or (and (bolp) (eolp))
+            (let (word)
+              (forward-line -1)
+              (back-to-indentation)
+              (setq word (current-word))
+              (forward-line 1)
+              (when word
+                (beginning-of-line)
+                (delete-horizontal-space)
+                (indent-to (python-indent-calculate-indentation)))))
+        (forward-line 1))
+      (move-marker end nil))))
+
+(defun python-indent-shift-left (start end &optional count)
+  "Shift lines contained in region START END by COUNT columns to the left.
+COUNT defaults to `python-indent-offset'.  If region isn't
+active, the current line is shifted.  The shifted region includes
+the lines in which START and END lie.  An error is signaled if
+any lines in the region are indented less than COUNT columns."
+  (interactive
+   (if mark-active
+       (list (region-beginning) (region-end) current-prefix-arg)
+     (list (line-beginning-position) (line-end-position) current-prefix-arg)))
+  (if count
+      (setq count (prefix-numeric-value count))
+    (setq count python-indent-offset))
+  (when (> count 0)
+    (let ((deactivate-mark nil))
+      (save-excursion
+        (goto-char start)
+        (while (< (point) end)
+          (if (and (< (current-indentation) count)
+                   (not (looking-at "[ \t]*$")))
+              (error "Can't shift all lines enough"))
+          (forward-line))
+        (indent-rigidly start end (- count))))))
+
+(add-to-list 'debug-ignored-errors "^Can't shift all lines enough")
+
+(defun python-indent-shift-right (start end &optional count)
+  "Shift lines contained in region START END by COUNT columns to the left.
+COUNT defaults to `python-indent-offset'.  If region isn't
+active, the current line is shifted.  The shifted region includes
+the lines in which START and END lie."
+  (interactive
+   (if mark-active
+       (list (region-beginning) (region-end) current-prefix-arg)
+     (list (line-beginning-position) (line-end-position) current-prefix-arg)))
+  (let ((deactivate-mark nil))
+    (if count
+        (setq count (prefix-numeric-value count))
+      (setq count python-indent-offset))
+    (indent-rigidly start end count)))
+
+(defun python-indent-electric-colon (arg)
+  "Insert a colon and maybe de-indent the current line.
+With numeric ARG, just insert that many colons.  With
+\\[universal-argument], just insert a single colon."
+  (interactive "*P")
+  (self-insert-command (if (not (integerp arg)) 1 arg))
+  (when (and (not arg)
+             (eolp)
+             (not (equal ?: (char-after (- (point-marker) 2))))
+             (not (or (python-info-ppss-context 'string)
+                      (python-info-ppss-context 'comment))))
+    (let ((indentation (current-indentation))
+          (calculated-indentation (python-indent-calculate-indentation)))
+      (python-info-closing-block-message)
+      (when (> indentation calculated-indentation)
+        (save-excursion
+          (indent-line-to calculated-indentation)
+          (when (not (python-info-closing-block-message))
+            (indent-line-to indentation)))))))
+(put 'python-indent-electric-colon 'delete-selection t)
+
+(defun python-indent-post-self-insert-function ()
+  "Adjust closing paren line indentation after a char is added.
+This function is intended to be added to the
+`post-self-insert-hook.'  If a line renders a paren alone, after
+adding a char before it, the line will be re-indented
+automatically if needed."
+  (when (and (eq (char-before) last-command-event)
+             (not (bolp))
+             (memq (char-after) '(?\) ?\] ?\})))
+    (save-excursion
+      (goto-char (line-beginning-position))
+      ;; If after going to the beginning of line the point
+      ;; is still inside a paren it's ok to do the trick
+      (when (python-info-ppss-context 'paren)
+        (let ((indentation (python-indent-calculate-indentation)))
+          (when (< (current-indentation) indentation)
+            (indent-line-to indentation)))))))
+
 \f
-;;;; Movement.
-
-;; Fixme:  Define {for,back}ward-sexp-function?  Maybe skip units like
-;; block, statement, depending on context.
-
-(defun python-beginning-of-defun ()
-  "`beginning-of-defun-function' for Python.
-Finds beginning of innermost nested class or method definition.
-Returns the name of the definition found at the end, or nil if
-reached start of buffer."
-  (let ((ci (current-indentation))
-       (def-re (rx line-start (0+ space) (or "def" "class") (1+ space)
-                   (group (1+ (or word (syntax symbol))))))
-       found lep) ;; def-line
-    (if (python-comment-line-p)
-       (setq ci most-positive-fixnum))
-    (while (and (not (bobp)) (not found))
-      ;; Treat bol at beginning of function as outside function so
-      ;; that successive C-M-a makes progress backwards.
-      ;;(setq def-line (looking-at def-re))
-      (unless (bolp) (end-of-line))
-      (setq lep (line-end-position))
-      (if (and (re-search-backward def-re nil 'move)
-              ;; Must be less indented or matching top level, or
-              ;; equally indented if we started on a definition line.
-              (let ((in (current-indentation)))
-                (or (and (zerop ci) (zerop in))
-                    (= lep (line-end-position)) ; on initial line
-                    ;; Not sure why it was like this -- fails in case of
-                    ;; last internal function followed by first
-                    ;; non-def statement of the main body.
-;;                  (and def-line (= in ci))
-                    (= in ci)
-                    (< in ci)))
-              (not (python-in-string/comment)))
-         (setq found t)))
+;;; Navigation
+
+(defvar python-nav-beginning-of-defun-regexp
+  (python-rx line-start (* space) defun (+ space) (group symbol-name))
+  "Regexp matching class or function definition.
+The name of the defun should be grouped so it can be retrieved
+via `match-string'.")
+
+(defun python-nav-beginning-of-defun (&optional arg)
+  "Move point to `beginning-of-defun'.
+With positive ARG move search backwards.  With negative do the
+same but forward.  When ARG is nil or 0 defaults to 1.  This is
+the main part of `python-beginning-of-defun-function'.  Return
+non-nil if point is moved to `beginning-of-defun'."
+  (when (or (null arg) (= arg 0)) (setq arg 1))
+  (let* ((re-search-fn (if (> arg 0)
+                           #'re-search-backward
+                         #'re-search-forward))
+         (line-beg-pos (line-beginning-position))
+         (line-content-start (+ line-beg-pos (current-indentation)))
+         (pos (point-marker))
+         (found
+          (progn
+            (when (and (< arg 0)
+                       (python-info-looking-at-beginning-of-defun))
+              (end-of-line 1))
+            (while (and (funcall re-search-fn
+                                 python-nav-beginning-of-defun-regexp nil t)
+                        (python-info-ppss-context-type)))
+            (and (python-info-looking-at-beginning-of-defun)
+                 (or (not (= (line-number-at-pos pos)
+                             (line-number-at-pos)))
+                     (and (>= (point) line-beg-pos)
+                          (<= (point) line-content-start)
+                          (> pos line-content-start)))))))
+    (if found
+        (or (beginning-of-line 1) t)
+      (and (goto-char pos) nil))))
+
+(defun python-beginning-of-defun-function (&optional arg)
+  "Move point to the beginning of def or class.
+With positive ARG move that number of functions backwards.  With
+negative do the same but forward.  When ARG is nil or 0 defaults
+to 1.  Return non-nil if point is moved to `beginning-of-defun'."
+  (when (or (null arg) (= arg 0)) (setq arg 1))
+  (let ((found))
+    (cond ((and (eq this-command 'mark-defun)
+                (python-info-looking-at-beginning-of-defun)))
+          (t
+           (dotimes (i (if (> arg 0) arg (- arg)))
+             (when (and (python-nav-beginning-of-defun arg)
+                        (not found))
+               (setq found t)))))
     found))
 
-(defun python-end-of-defun ()
-  "`end-of-defun-function' for Python.
-Finds end of innermost nested class or method definition."
-  (let ((orig (point))
-       (pattern (rx line-start (0+ space) (or "def" "class") space)))
-    ;; Go to start of current block and check whether it's at top
-    ;; level.  If it is, and not a block start, look forward for
-    ;; definition statement.
-    (when (python-comment-line-p)
-      (end-of-line)
-      (forward-comment most-positive-fixnum))
-    (if (not (python-open-block-statement-p))
-       (python-beginning-of-block))
-    (if (zerop (current-indentation))
-       (unless (python-open-block-statement-p)
-         (while (and (re-search-forward pattern nil 'move)
-                     (python-in-string/comment))) ; just loop
-         (unless (eobp)
-           (beginning-of-line)))
-      ;; Don't move before top-level statement that would end defun.
-      (end-of-line)
-      (python-beginning-of-defun))
-    ;; If we got to the start of buffer, look forward for
-    ;; definition statement.
-    (if (and (bobp) (not (looking-at "def\\|class")))
-       (while (and (not (eobp))
-                   (re-search-forward pattern nil 'move)
-                   (python-in-string/comment)))) ; just loop
-    ;; We're at a definition statement (or end-of-buffer).
-    (unless (eobp)
-      (python-end-of-block)
-      ;; Count trailing space in defun (but not trailing comments).
-      (skip-syntax-forward " >")
-      (unless (eobp)                   ; e.g. missing final newline
-       (beginning-of-line)))
-    ;; Catch pathological cases like this, where the beginning-of-defun
-    ;; skips to a definition we're not in:
-    ;; if ...:
-    ;;     ...
-    ;; else:
-    ;;     ...  # point here
-    ;;     ...
-    ;;     def ...
-    (if (< (point) orig)
-       (goto-char (point-max)))))
-
-(defun python-beginning-of-statement ()
-  "Go to start of current statement.
-Accounts for continuation lines, multi-line strings, and
-multi-line bracketed expressions."
-  (while
-      (if (python-backslash-continuation-line-p)
-          (progn (forward-line -1) t)
-        (beginning-of-line)
-        (or (python-beginning-of-string)
-            (python-skip-out))))
-  (back-to-indentation))
-
-(defun python-skip-out (&optional forward syntax)
-  "Skip out of any nested brackets.
-Skip forward if FORWARD is non-nil, else backward.
-If SYNTAX is non-nil it is the state returned by `syntax-ppss' at point.
-Return non-nil if and only if skipping was done."
-  ;; FIXME: Use syntax-ppss-toplevel-pos.
-  (let ((depth (syntax-ppss-depth (or syntax (syntax-ppss))))
-       (forward (if forward -1 1)))
-    (unless (zerop depth)
-      (if (> depth 0)
-         ;; Skip forward out of nested brackets.
-         (condition-case ()            ; beware invalid syntax
-             (progn (backward-up-list (* forward depth)) t)
-           (error nil))
-       ;; Invalid syntax (too many closed brackets).
-       ;; Skip out of as many as possible.
-       (let (done)
-         (while (condition-case ()
-                    (progn (backward-up-list forward)
-                           (setq done t))
-                  (error nil)))
-         done)))))
-
-(defun python-end-of-statement ()
-  "Go to the end of the current statement and return point.
-Usually this is the start of the next line, but if this is a
-multi-line statement we need to skip over the continuation lines.
-On a comment line, go to end of line."
-  (end-of-line)
-  (while (let (comment)
-          ;; Move past any enclosing strings and sexps, or stop if
-          ;; we're in a comment.
-          (while (let ((s (syntax-ppss)))
-                   (cond ((eq 'comment (syntax-ppss-context s))
-                          (setq comment t)
-                          nil)
-                         ((eq 'string (syntax-ppss-context s))
-                          ;; Go to start of string and skip it.
-                           (let ((pos (point)))
-                             (goto-char (nth 8 s))
-                             (condition-case () ; beware invalid syntax
-                                 (progn (forward-sexp) t)
-                               ;; If there's a mismatched string, make sure
-                               ;; we still overall move *forward*.
-                               (error (goto-char pos) (end-of-line)))))
-                         ((python-skip-out t s))))
-            (end-of-line))
-          (and (not comment)
-               (not (eobp))
-               (eq ?\\ (char-before)))) ; Line continued?
-    (end-of-line 2))                     ; Try next line.
-  (point))
-
-(defun python-previous-statement (&optional count)
-  "Go to start of previous statement.
-With argument COUNT, do it COUNT times.  Stop at beginning of buffer.
-Return count of statements left to move."
-  (interactive "p")
-  (unless count (setq count 1))
-  (if (< count 0)
-      (python-next-statement (- count))
-    (python-beginning-of-statement)
-    (while (and (> count 0) (not (bobp)))
-      (python-skip-comments/blanks t)
-      (python-beginning-of-statement)
-      (unless (bobp) (setq count (1- count))))
-    count))
-
-(defun python-next-statement (&optional count)
-  "Go to start of next statement.
-With argument COUNT, do it COUNT times.  Stop at end of buffer.
-Return count of statements left to move."
-  (interactive "p")
-  (unless count (setq count 1))
-  (if (< count 0)
-      (python-previous-statement (- count))
-    (beginning-of-line)
-    (let (bogus)
-      (while (and (> count 0) (not (eobp)) (not bogus))
-       (python-end-of-statement)
-       (python-skip-comments/blanks)
-       (if (eq 'string (syntax-ppss-context (syntax-ppss)))
-           (setq bogus t)
-         (unless (eobp)
-           (setq count (1- count))))))
-    count))
-
-(defun python-beginning-of-block (&optional arg)
-  "Go to start of current block.
-With numeric arg, do it that many times.  If ARG is negative, call
-`python-end-of-block' instead.
-If point is on the first line of a block, use its outer block.
-If current statement is in column zero, don't move and return nil.
-Otherwise return non-nil."
-  (interactive "p")
-  (unless arg (setq arg 1))
-  (cond
-   ((zerop arg))
-   ((< arg 0) (python-end-of-block (- arg)))
-   (t
-    (let ((point (point)))
-      (if (or (python-comment-line-p)
-             (python-blank-line-p))
-         (python-skip-comments/blanks t))
-      (python-beginning-of-statement)
-      (let ((ci (current-indentation)))
-       (if (zerop ci)
-           (not (goto-char point))     ; return nil
-         ;; Look upwards for less indented statement.
-         (if (catch 'done
-;;; This is slower than the below.
-;;;      (while (zerop (python-previous-statement))
-;;;        (when (and (< (current-indentation) ci)
-;;;                   (python-open-block-statement-p t))
-;;;          (beginning-of-line)
-;;;          (throw 'done t)))
-               (while (and (zerop (forward-line -1)))
-                 (when (and (< (current-indentation) ci)
-                            (not (python-comment-line-p))
-                            ;; Move to beginning to save effort in case
-                            ;; this is in string.
-                            (progn (python-beginning-of-statement) t)
-                            (python-open-block-statement-p t))
-                   (beginning-of-line)
-                   (throw 'done t)))
-               (not (goto-char point))) ; Failed -- return nil
-             (python-beginning-of-block (1- arg)))))))))
-
-(defun python-end-of-block (&optional arg)
-  "Go to end of current block.
-With numeric arg, do it that many times.  If ARG is negative,
-call `python-beginning-of-block' instead.
-If current statement is in column zero and doesn't open a block,
-don't move and return nil.  Otherwise return t."
-  (interactive "p")
-  (unless arg (setq arg 1))
-  (if (< arg 0)
-      (python-beginning-of-block (- arg))
-    (while (and (> arg 0)
-               (let* ((point (point))
-                      (_ (if (python-comment-line-p)
-                             (python-skip-comments/blanks t)))
-                      (ci (current-indentation))
-                      (open (python-open-block-statement-p)))
-                 (if (and (zerop ci) (not open))
-                     (not (goto-char point))
-                   (catch 'done
-                     (while (zerop (python-next-statement))
-                       (when (or (and open (<= (current-indentation) ci))
-                                 (< (current-indentation) ci))
-                         (python-skip-comments/blanks t)
-                         (beginning-of-line 2)
-                         (throw 'done t)))))))
+(defun python-end-of-defun-function ()
+  "Move point to the end of def or class.
+Returns nil if point is not in a def or class."
+  (interactive)
+  (let ((beg-defun-indent))
+    (when (or (python-info-looking-at-beginning-of-defun)
+              (python-beginning-of-defun-function 1)
+              (python-beginning-of-defun-function -1))
+      (setq beg-defun-indent (current-indentation))
+      (forward-line 1)
+      ;; Go as forward as possible
+      (while (and (or
+                   (python-nav-beginning-of-defun -1)
+                   (and (goto-char (point-max)) nil))
+                  (> (current-indentation) beg-defun-indent)))
+      (beginning-of-line 1)
+      ;; Go as backwards as possible
+      (while (and (forward-line -1)
+                  (not (bobp))
+                  (or (not (current-word))
+                      (equal (char-after (+ (point) (current-indentation))) ?#)
+                      (<= (current-indentation) beg-defun-indent)
+                      (looking-at (python-rx decorator))
+                      (python-info-ppss-context-type))))
+      (forward-line 1)
+      ;; If point falls inside a paren or string context the point is
+      ;; forwarded at the end of it (or end of buffer if its not closed)
+      (let ((context-type (python-info-ppss-context-type)))
+        (when (memq context-type '(paren string))
+          ;; Slow but safe.
+          (while (and (not (eobp))
+                      (python-info-ppss-context-type))
+            (forward-line 1)))))))
+
+(defun python-nav-statement-start ()
+  "Move to start of current statement."
+  (interactive "^")
+  (while (and (or (back-to-indentation) t)
+              (not (bobp))
+              (when (or
+                     (save-excursion
+                       (forward-line -1)
+                       (python-info-line-ends-backslash-p))
+                     (python-info-ppss-context 'string)
+                     (python-info-ppss-context 'paren))
+                (forward-line -1)))))
+
+(defun python-nav-statement-end ()
+  "Move to end of current statement."
+  (interactive "^")
+  (while (and (goto-char (line-end-position))
+              (not (eobp))
+              (when (or
+                     (python-info-line-ends-backslash-p)
+                     (python-info-ppss-context 'string)
+                     (python-info-ppss-context 'paren))
+                (forward-line 1)))))
+
+(defun python-nav-backward-statement (&optional arg)
+  "Move backward to previous statement.
+With ARG, repeat.  See `python-nav-forward-statement'."
+  (interactive "^p")
+  (or arg (setq arg 1))
+  (python-nav-forward-statement (- arg)))
+
+(defun python-nav-forward-statement (&optional arg)
+  "Move forward to next statement.
+With ARG, repeat.  With negative argument, move ARG times
+backward to previous statement."
+  (interactive "^p")
+  (or arg (setq arg 1))
+  (while (> arg 0)
+    (python-nav-statement-end)
+    (python-util-forward-comment)
+    (python-nav-statement-start)
+    (setq arg (1- arg)))
+  (while (< arg 0)
+    (python-nav-statement-start)
+    (python-util-forward-comment -1)
+    (python-nav-statement-start)
+    (setq arg (1+ arg))))
+
+(defun python-nav-block-start ()
+  "Move to start of current block."
+  (interactive "^")
+  (let ((starting-pos (point))
+        (block-regexp (python-rx
+                       line-start (* whitespace) block-start)))
+    (if (progn
+          (python-nav-statement-start)
+          (looking-at (python-rx block-start)))
+        (point-marker)
+      ;; Go to first line beginning a statement
+      (while (and (not (bobp))
+                  (or (and (python-nav-statement-start) nil)
+                      (python-info-current-line-comment-p)
+                      (python-info-current-line-empty-p)))
+        (forward-line -1))
+      (let ((block-matching-indent
+             (- (current-indentation) python-indent-offset)))
+        (while
+            (and (python-nav-backward-block)
+                 (> (current-indentation) block-matching-indent)))
+        (if (and (looking-at (python-rx block-start))
+                 (= (current-indentation) block-matching-indent))
+            (point-marker)
+          (and (goto-char starting-pos) nil))))))
+
+(defun python-nav-block-end ()
+  "Move to end of current block."
+  (interactive "^")
+  (when (python-nav-block-start)
+    (let ((block-indentation (current-indentation)))
+      (python-nav-statement-end)
+      (while (and (forward-line 1)
+                  (not (eobp))
+                  (or (and (> (current-indentation) block-indentation)
+                           (or (python-nav-statement-end) t))
+                      (python-info-current-line-comment-p)
+                      (python-info-current-line-empty-p))))
+      (python-util-forward-comment -1)
+      (point-marker))))
+
+(defun python-nav-backward-block (&optional arg)
+  "Move backward to previous block of code.
+With ARG, repeat.  See `python-nav-forward-block'."
+  (interactive "^p")
+  (or arg (setq arg 1))
+  (python-nav-forward-block (- arg)))
+
+(defun python-nav-forward-block (&optional arg)
+  "Move forward to next block of code.
+With ARG, repeat.  With negative argument, move ARG times
+backward to previous block."
+  (interactive "^p")
+  (or arg (setq arg 1))
+  (let ((block-start-regexp
+         (python-rx line-start (* whitespace) block-start))
+        (starting-pos (point)))
+    (while (> arg 0)
+      (python-nav-statement-end)
+      (while (and
+              (re-search-forward block-start-regexp nil t)
+              (or (python-info-ppss-context 'string)
+                  (python-info-ppss-context 'comment)
+                  (python-info-ppss-context 'paren))))
+      (setq arg (1- arg)))
+    (while (< arg 0)
+      (python-nav-statement-start)
+      (while (and
+              (re-search-backward block-start-regexp nil t)
+              (or (python-info-ppss-context 'string)
+                  (python-info-ppss-context 'comment)
+                  (python-info-ppss-context 'paren))))
+      (setq arg (1+ arg)))
+    (python-nav-statement-start)
+    (if (not (looking-at (python-rx block-start)))
+        (and (goto-char starting-pos) nil)
+      (and (not (= (point) starting-pos)) (point-marker)))))
+
+(defun python-nav-forward-sexp-function (&optional arg)
+  "Move forward across one block of code.
+With ARG, do it that many times.  Negative arg -N means
+move backward N times."
+  (interactive "^p")
+  (or arg (setq arg 1))
+  (while (> arg 0)
+    (let ((block-starting-pos
+           (save-excursion (python-nav-block-start)))
+          (block-ending-pos
+           (save-excursion (python-nav-block-end)))
+          (next-block-starting-pos
+           (save-excursion (python-nav-forward-block))))
+      (cond ((not block-starting-pos)
+             (python-nav-forward-block))
+            ((= (point) block-starting-pos)
+             (if (or (not next-block-starting-pos)
+                     (< block-ending-pos next-block-starting-pos))
+                 (python-nav-block-end)
+               (python-nav-forward-block)))
+            ((= block-ending-pos (point))
+             (let ((parent-block-end-pos
+                    (save-excursion
+                      (python-util-forward-comment)
+                      (python-nav-block-start)
+                      (python-nav-block-end))))
+               (if (and parent-block-end-pos
+                        (or (not next-block-starting-pos)
+                            (> next-block-starting-pos parent-block-end-pos)))
+                   (goto-char parent-block-end-pos)
+                 (python-nav-forward-block))))
+            (t (python-nav-block-end))))
       (setq arg (1- arg)))
-    (zerop arg)))
+  (while (< arg 0)
+    (let* ((block-starting-pos
+            (save-excursion (python-nav-block-start)))
+           (block-ending-pos
+            (save-excursion (python-nav-block-end)))
+           (prev-block-ending-pos
+            (save-excursion (when (python-nav-backward-block)
+                              (python-nav-block-end))))
+           (prev-block-parent-ending-pos
+            (save-excursion
+              (when prev-block-ending-pos
+                (goto-char prev-block-ending-pos)
+                (python-util-forward-comment)
+                (python-nav-block-start)
+                (python-nav-block-end)))))
+      (cond ((not block-ending-pos)
+             (and (python-nav-backward-block)
+                  (python-nav-block-end)))
+            ((= (point) block-ending-pos)
+             (let ((candidates))
+               (dolist (name
+                        '(prev-block-parent-ending-pos
+                          prev-block-ending-pos
+                          block-ending-pos
+                          block-starting-pos))
+                 (when (and (symbol-value name)
+                            (< (symbol-value name) (point)))
+                   (add-to-list 'candidates (symbol-value name))))
+               (goto-char (apply 'max candidates))))
+            ((> (point) block-ending-pos)
+             (python-nav-block-end))
+            ((= (point) block-starting-pos)
+             (if (not (> (point) (or prev-block-ending-pos (point))))
+                 (python-nav-backward-block)
+               (goto-char prev-block-ending-pos)
+               (let ((parent-block-ending-pos
+                      (save-excursion
+                        (python-nav-forward-sexp-function)
+                        (and (not (looking-at (python-rx block-start)))
+                             (point)))))
+                 (when (and parent-block-ending-pos
+                            (> parent-block-ending-pos prev-block-ending-pos))
+                   (goto-char parent-block-ending-pos)))))
+            (t (python-nav-block-start))))
+    (setq arg (1+ arg))))
 
-(defvar python-which-func-length-limit 40
-  "Non-strict length limit for `python-which-func' output.")
+\f
+;;; Shell integration
 
-(defun python-which-func ()
-  (let ((function-name (python-current-defun python-which-func-length-limit)))
-    (set-text-properties 0 (length function-name) nil function-name)
-    function-name))
+(defcustom python-shell-buffer-name "Python"
+  "Default buffer name for Python interpreter."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
 
-\f
-;;;; Imenu.
-
-;; For possibly speeding this up, here's the top of the ELP profile
-;; for rescanning pydoc.py (2.2k lines, 90kb):
-;; Function Name                         Call Count  Elapsed Time  Average Time
-;; ====================================  ==========  =============  ============
-;; python-imenu-create-index             156         2.430906      0.0155827307
-;; python-end-of-defun                   155         1.2718260000  0.0082053290
-;; python-end-of-block                   155         1.1898689999  0.0076765741
-;; python-next-statement                 2970        1.024717      0.0003450225
-;; python-end-of-statement               2970        0.4332190000  0.0001458649
-;; python-beginning-of-defun             265         0.0918479999  0.0003465962
-;; python-skip-comments/blanks           3125        0.0753319999  2.410...e-05
-
-(defvar python-recursing)
-(defun python-imenu-create-index ()
-  "`imenu-create-index-function' for Python.
-
-Makes nested Imenu menus from nested `class' and `def' statements.
-The nested menus are headed by an item referencing the outer
-definition; it has a space prepended to the name so that it sorts
-first with `imenu--sort-by-name' (though, unfortunately, sub-menus
-precede it)."
-  (unless (boundp 'python-recursing)   ; dynamically bound below
-    ;; Normal call from Imenu.
-    (goto-char (point-min))
-    ;; Without this, we can get an infloop if the buffer isn't all
-    ;; fontified.  I guess this is really a bug in syntax.el.  OTOH,
-    ;; _with_ this, imenu doesn't immediately work; I can't figure out
-    ;; what's going on, but it must be something to do with timers in
-    ;; font-lock.
-    ;; This can't be right, especially not when jit-lock is not used.  --Stef
-    ;; (unless (get-text-property (1- (point-max)) 'fontified)
-    ;;   (font-lock-fontify-region (point-min) (point-max)))
-    )
-  (let (index-alist)                   ; accumulated value to return
-    (while (re-search-forward
-           (rx line-start (0+ space)   ; leading space
-               (or (group "def") (group "class"))         ; type
-               (1+ space) (group (1+ (or word ?_))))      ; name
-           nil t)
-      (unless (python-in-string/comment)
-       (let ((pos (match-beginning 0))
-             (name (match-string-no-properties 3)))
-         (if (match-beginning 2)       ; def or class?
-             (setq name (concat "class " name)))
-         (save-restriction
-           (narrow-to-defun)
-           (let* ((python-recursing t)
-                  (sublist (python-imenu-create-index)))
-             (if sublist
-                 (progn (push (cons (concat " " name) pos) sublist)
-                        (push (cons name sublist) index-alist))
-               (push (cons name pos) index-alist)))))))
-    (unless (boundp 'python-recursing)
-      ;; Look for module variables.
-      (let (vars)
-       (goto-char (point-min))
-       (while (re-search-forward
-               (rx line-start (group (1+ (or word ?_))) (0+ space) "=")
-               nil t)
-         (unless (python-in-string/comment)
-           (push (cons (match-string 1) (match-beginning 1))
-                 vars)))
-       (setq index-alist (nreverse index-alist))
-       (if vars
-           (push (cons "Module variables"
-                       (nreverse vars))
-                 index-alist))))
-    index-alist))
-\f
-;;;; `Electric' commands.
+(defcustom python-shell-interpreter "python"
+  "Default Python interpreter for shell."
+  :type 'string
+  :group 'python)
 
-(defun python-electric-colon (arg)
-  "Insert a colon and maybe outdent the line if it is a statement like `else'.
-With numeric ARG, just insert that many colons.  With \\[universal-argument],
-just insert a single colon."
-  (interactive "*P")
-  (self-insert-command (if (not (integerp arg)) 1 arg))
-  (and (not arg)
-       (eolp)
-       (python-outdent-p)
-       (not (python-in-string/comment))
-       (> (current-indentation) (python-calculate-indentation))
-       (python-indent-line)))          ; OK, do it
-(put 'python-electric-colon 'delete-selection t)
-
-(defun python-backspace (arg)
-  "Maybe delete a level of indentation on the current line.
-Do so if point is at the end of the line's indentation outside
-strings and comments.
-Otherwise just call `backward-delete-char-untabify'.
-Repeat ARG times."
-  (interactive "*p")
-  (if (or (/= (current-indentation) (current-column))
-         (bolp)
-         (python-continuation-line-p)
-         (python-in-string/comment))
-      (backward-delete-char-untabify arg)
-    ;; Look for the largest valid indentation which is smaller than
-    ;; the current indentation.
-    (let ((indent 0)
-         (ci (current-indentation))
-         (indents (python-indentation-levels))
-         initial)
-      (dolist (x indents)
-       (if (< (car x) ci)
-           (setq indent (max indent (car x)))))
-      (setq initial (cdr (assq indent indents)))
-      (if (> (length initial) 0)
-         (message "Closes %s" initial))
-      (delete-horizontal-space)
-      (indent-to indent))))
-(put 'python-backspace 'delete-selection 'supersede)
-\f
-;;;; pychecker
+(defcustom python-shell-internal-buffer-name "Python Internal"
+  "Default buffer name for the Internal Python interpreter."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
 
-(defcustom python-check-command "pychecker --stdlib"
-  "Command used to check a Python file."
+(defcustom python-shell-interpreter-args "-i"
+  "Default arguments for the Python interpreter."
   :type 'string
   :group 'python)
 
-(defvar python-saved-check-command nil
-  "Internal use.")
+(defcustom python-shell-prompt-regexp ">>> "
+  "Regular Expression matching top\-level input prompt of python shell.
+It should not contain a caret (^) at the beginning."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
 
-;; After `sgml-validate-command'.
-(defun python-check (command)
-  "Check a Python file (default current buffer's file).
-Runs COMMAND, a shell command, as if by `compile'.
-See `python-check-command' for the default."
-  (interactive
-   (list (read-string "Checker command: "
-                     (or python-saved-check-command
-                         (concat python-check-command " "
-                                 (let ((name (buffer-file-name)))
-                                   (if name
-                                       (file-name-nondirectory name))))))))
-  (set (make-local-variable 'python-saved-check-command) command)
-  (require 'compile)                    ;To define compilation-* variables.
-  (save-some-buffers (not compilation-ask-about-save) nil)
-  (let ((compilation-error-regexp-alist
-        (cons '("(\\([^,]+\\), line \\([0-9]+\\))" 1 2)
-              compilation-error-regexp-alist)))
-    (compilation-start command)))
-\f
-;;;; Inferior mode stuff (following cmuscheme).
+(defcustom python-shell-prompt-block-regexp "[.][.][.] "
+  "Regular Expression matching block input prompt of python shell.
+It should not contain a caret (^) at the beginning."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
 
-(defcustom python-python-command "python"
-  "Shell command to run Python interpreter.
-Any arguments can't contain whitespace."
+(defcustom python-shell-prompt-output-regexp ""
+  "Regular Expression matching output prompt of python shell.
+It should not contain a caret (^) at the beginning."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
+
+(defcustom python-shell-prompt-pdb-regexp "[(<]*[Ii]?[Pp]db[>)]+ "
+  "Regular Expression matching pdb input prompt of python shell.
+It should not contain a caret (^) at the beginning."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
+
+(defcustom python-shell-enable-font-lock t
+  "Should syntax highlighting be enabled in the python shell buffer?
+Restart the python shell after changing this variable for it to take effect."
+  :type 'boolean
+  :group 'python
+  :safe 'booleanp)
+
+(defcustom python-shell-send-setup-max-wait 5
+  "Seconds to wait for process output before code setup.
+If output is received before the specified time then control is
+returned in that moment and not after waiting."
+  :type 'integer
   :group 'python
-  :type 'string)
+  :safe 'integerp)
+
+(defcustom python-shell-process-environment nil
+  "List of environment variables for Python shell.
+This variable follows the same rules as `process-environment'
+since it merges with it before the process creation routines are
+called.  When this variable is nil, the Python shell is run with
+the default `process-environment'."
+  :type '(repeat string)
+  :group 'python
+  :safe 'listp)
 
-(defcustom python-jython-command "jython"
-  "Shell command to run Jython interpreter.
-Any arguments can't contain whitespace."
+(defcustom python-shell-extra-pythonpaths nil
+  "List of extra pythonpaths for Python shell.
+The values of this variable are added to the existing value of
+PYTHONPATH in the `process-environment' variable."
+  :type '(repeat string)
   :group 'python
-  :type 'string)
-
-(defvar python-command python-python-command
-  "Actual command used to run Python.
-May be `python-python-command' or `python-jython-command', possibly
-modified by the user.  Additional arguments are added when the command
-is used by `run-python' et al.")
-
-(defvar python-buffer nil
-  "*The current Python process buffer.
-
-Commands that send text from source buffers to Python processes have
-to choose a process to send to.  This is determined by buffer-local
-value of `python-buffer'.  If its value in the current buffer,
-i.e. both any local value and the default one, is nil, `run-python'
-and commands that send to the Python process will start a new process.
-
-Whenever \\[run-python] starts a new process, it resets the default
-value of `python-buffer' to be the new process's buffer and sets the
-buffer-local value similarly if the current buffer is in Python mode
-or Inferior Python mode, so that source buffer stays associated with a
-specific sub-process.
-
-Use \\[python-set-proc] to set the default value from a buffer with a
-local value.")
-(make-variable-buffer-local 'python-buffer)
-
-(defconst python-compilation-regexp-alist
-  ;; FIXME: maybe these should move to compilation-error-regexp-alist-alist.
-  ;;   The first already is (for CAML), but the second isn't.  Anyhow,
-  ;;   these are specific to the inferior buffer.  -- fx
+  :safe 'listp)
+
+(defcustom python-shell-exec-path nil
+  "List of path to search for binaries.
+This variable follows the same rules as `exec-path' since it
+merges with it before the process creation routines are called.
+When this variable is nil, the Python shell is run with the
+default `exec-path'."
+  :type '(repeat string)
+  :group 'python
+  :safe 'listp)
+
+(defcustom python-shell-virtualenv-path nil
+  "Path to virtualenv root.
+This variable, when set to a string, makes the values stored in
+`python-shell-process-environment' and `python-shell-exec-path'
+to be modified properly so shells are started with the specified
+virtualenv."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
+
+(defcustom python-shell-setup-codes '(python-shell-completion-setup-code
+                                      python-ffap-setup-code
+                                      python-eldoc-setup-code)
+  "List of code run by `python-shell-send-setup-codes'."
+  :type '(repeat symbol)
+  :group 'python
+  :safe 'listp)
+
+(defcustom python-shell-compilation-regexp-alist
   `((,(rx line-start (1+ (any " \t")) "File \""
-         (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
-         "\", line " (group (1+ digit)))
+          (group (1+ (not (any "\"<")))) ; avoid `<stdin>' &c
+          "\", line " (group (1+ digit)))
      1 2)
     (,(rx " in file " (group (1+ not-newline)) " on line "
-         (group (1+ digit)))
+          (group (1+ digit)))
      1 2)
-    ;; pdb stack trace
     (,(rx line-start "> " (group (1+ (not (any "(\"<"))))
-         "(" (group (1+ digit)) ")" (1+ (not (any "("))) "()")
+          "(" (group (1+ digit)) ")" (1+ (not (any "("))) "()")
      1 2))
-  "`compilation-error-regexp-alist' for inferior Python.")
+  "`compilation-error-regexp-alist' for inferior Python."
+  :type '(alist string)
+  :group 'python)
+
+(defun python-shell-get-process-name (dedicated)
+  "Calculate the appropriate process name for inferior Python process.
+If DEDICATED is t and the variable `buffer-file-name' is non-nil
+returns a string with the form
+`python-shell-buffer-name'[variable `buffer-file-name'] else
+returns the value of `python-shell-buffer-name'.  After
+calculating the process name adds the buffer name for the process
+in the `same-window-buffer-names' list."
+  (let ((process-name
+         (if (and dedicated
+                  buffer-file-name)
+             (format "%s[%s]" python-shell-buffer-name buffer-file-name)
+           (format "%s" python-shell-buffer-name))))
+    (add-to-list 'same-window-buffer-names (purecopy
+                                            (format "*%s*" process-name)))
+    process-name))
+
+(defun python-shell-internal-get-process-name ()
+  "Calculate the appropriate process name for Internal Python process.
+The name is calculated from `python-shell-global-buffer-name' and
+a hash of all relevant global shell settings in order to ensure
+uniqueness for different types of configurations."
+  (format "%s [%s]"
+          python-shell-internal-buffer-name
+          (md5
+           (concat
+            (python-shell-parse-command)
+            python-shell-prompt-regexp
+            python-shell-prompt-block-regexp
+            python-shell-prompt-output-regexp
+            (mapconcat #'symbol-value python-shell-setup-codes "")
+            (mapconcat #'identity python-shell-process-environment "")
+            (mapconcat #'identity python-shell-extra-pythonpaths "")
+            (mapconcat #'identity python-shell-exec-path "")
+            (or python-shell-virtualenv-path "")
+            (mapconcat #'identity python-shell-exec-path "")))))
+
+(defun python-shell-parse-command ()
+  "Calculate the string used to execute the inferior Python process."
+  (format "%s %s" python-shell-interpreter python-shell-interpreter-args))
+
+(defun python-shell-calculate-process-environment ()
+  "Calculate process environment given `python-shell-virtualenv-path'."
+  (let ((process-environment (append
+                              python-shell-process-environment
+                              process-environment nil))
+        (virtualenv (if python-shell-virtualenv-path
+                        (directory-file-name python-shell-virtualenv-path)
+                      nil)))
+    (when python-shell-extra-pythonpaths
+      (setenv "PYTHONPATH"
+              (format "%s%s%s"
+                      (mapconcat 'identity
+                                 python-shell-extra-pythonpaths
+                                 path-separator)
+                      path-separator
+                      (or (getenv "PYTHONPATH") ""))))
+    (if (not virtualenv)
+        process-environment
+      (setenv "PYTHONHOME" nil)
+      (setenv "PATH" (format "%s/bin%s%s"
+                             virtualenv path-separator
+                             (or (getenv "PATH") "")))
+      (setenv "VIRTUAL_ENV" virtualenv))
+    process-environment))
+
+(defun python-shell-calculate-exec-path ()
+  "Calculate exec path given `python-shell-virtualenv-path'."
+  (let ((path (append python-shell-exec-path
+                      exec-path nil)))
+    (if (not python-shell-virtualenv-path)
+        path
+      (cons (format "%s/bin"
+                    (directory-file-name python-shell-virtualenv-path))
+            path))))
+
+(defun python-comint-output-filter-function (output)
+  "Hook run after content is put into comint buffer.
+OUTPUT is a string with the contents of the buffer."
+  (ansi-color-filter-apply output))
 
-(defvar inferior-python-mode-map
-  (let ((map (make-sparse-keymap)))
-    ;; This will inherit from comint-mode-map.
-    (define-key map "\C-c\C-l" 'python-load-file)
-    (define-key map "\C-c\C-v" 'python-check)
-    ;; Note that we _can_ still use these commands which send to the
-    ;; Python process even at the prompt if we have a normal prompt,
-    ;; i.e. '>>> ' and not '... '.  See the comment before
-    ;; python-send-region.  Fixme: uncomment these if we address that.
-
-    ;; (define-key map [(meta ?\t)] 'python-complete-symbol)
-    ;; (define-key map "\C-c\C-f" 'python-describe-symbol)
-    map))
-
-(defvar inferior-python-mode-syntax-table
-  (let ((st (make-syntax-table python-mode-syntax-table)))
-    ;; Don't get confused by apostrophes in the process's output (e.g. if
-    ;; you execute "help(os)").
-    (modify-syntax-entry ?\' "." st)
-    ;; Maybe we should do the same for double quotes?
-    ;; (modify-syntax-entry ?\" "." st)
-    st))
-
-;; Autoloaded.
-(declare-function compilation-shell-minor-mode "compile" (&optional arg))
-
-(defvar python--prompt-regexp nil)
-
-(defun python--set-prompt-regexp ()
-  (let ((prompt  (cdr-safe (or (assoc python-python-command
-                                     python-shell-prompt-alist)
-                              (assq t python-shell-prompt-alist))))
-       (cprompt (cdr-safe (or (assoc python-python-command
-                                     python-shell-continuation-prompt-alist)
-                              (assq t python-shell-continuation-prompt-alist)))))
-    (set (make-local-variable 'comint-prompt-regexp)
-        (concat "\\("
-                (mapconcat 'identity
-                           (delq nil (list prompt cprompt "^([Pp]db) "))
-                           "\\|")
-                "\\)"))
-    (set (make-local-variable 'python--prompt-regexp) prompt)))
-
-;; Fixme: This should inherit some stuff from `python-mode', but I'm
-;; not sure how much: at least some keybindings, like C-c C-f;
-;; syntax?; font-locking, e.g. for triple-quoted strings?
 (define-derived-mode inferior-python-mode comint-mode "Inferior Python"
-  "Major mode for interacting with an inferior Python process.
-A Python process can be started with \\[run-python].
-
-Hooks `comint-mode-hook' and `inferior-python-mode-hook' are run in
-that order.
-
-You can send text to the inferior Python process from other buffers
-containing Python source.
- * \\[python-switch-to-python] switches the current buffer to the Python
-    process buffer.
- * \\[python-send-region] sends the current region to the Python process.
- * \\[python-send-region-and-go] switches to the Python process buffer
-    after sending the text.
-For running multiple processes in multiple buffers, see `run-python' and
-`python-buffer'.
-
-\\{inferior-python-mode-map}"
-  :group 'python
+  "Major mode for Python inferior process.
+Runs a Python interpreter as a subprocess of Emacs, with Python
+I/O through an Emacs buffer.  Variables
+`python-shell-interpreter' and `python-shell-interpreter-args'
+controls which Python interpreter is run.  Variables
+`python-shell-prompt-regexp',
+`python-shell-prompt-output-regexp',
+`python-shell-prompt-block-regexp',
+`python-shell-enable-font-lock',
+`python-shell-completion-setup-code',
+`python-shell-completion-string-code',
+`python-shell-completion-module-string-code',
+`python-eldoc-setup-code', `python-eldoc-string-code',
+`python-ffap-setup-code' and `python-ffap-string-code' can
+customize this mode for different Python interpreters.
+
+You can also add additional setup code to be run at
+initialization of the interpreter via `python-shell-setup-codes'
+variable.
+
+\(Type \\[describe-mode] in the process buffer for a list of commands.)"
+  (set-syntax-table python-mode-syntax-table)
   (setq mode-line-process '(":%s"))
-  (set (make-local-variable 'comint-input-filter) 'python-input-filter)
-  (add-hook 'comint-preoutput-filter-functions #'python-preoutput-filter
-           nil t)
-  (python--set-prompt-regexp)
+  (setq comint-prompt-regexp (format "^\\(?:%s\\|%s\\|%s\\)"
+                                     python-shell-prompt-regexp
+                                     python-shell-prompt-block-regexp
+                                     python-shell-prompt-pdb-regexp))
+  (make-local-variable 'comint-output-filter-functions)
+  (add-hook 'comint-output-filter-functions
+            'python-comint-output-filter-function)
+  (add-hook 'comint-output-filter-functions
+            'python-pdbtrack-comint-output-filter-function)
   (set (make-local-variable 'compilation-error-regexp-alist)
-       python-compilation-regexp-alist)
+       python-shell-compilation-regexp-alist)
+  (define-key inferior-python-mode-map [remap complete-symbol]
+    'completion-at-point)
+  (add-hook 'completion-at-point-functions
+            'python-shell-completion-complete-at-point nil 'local)
+  (add-to-list (make-local-variable 'comint-dynamic-complete-functions)
+               'python-shell-completion-complete-at-point)
+  (define-key inferior-python-mode-map (kbd "<tab>")
+    'python-shell-completion-complete-or-indent)
+  (when python-shell-enable-font-lock
+    (set (make-local-variable 'font-lock-defaults)
+         '(python-font-lock-keywords nil nil nil nil))
+    (set (make-local-variable 'syntax-propertize-function)
+         python-syntax-propertize-function))
   (compilation-shell-minor-mode 1))
 
-(defcustom inferior-python-filter-regexp "\\`\\s-*\\S-?\\S-?\\s-*\\'"
-  "Input matching this regexp is not saved on the history list.
-Default ignores all inputs of 0, 1, or 2 non-blank characters."
-  :type 'regexp
-  :group 'python)
-
-(defcustom python-remove-cwd-from-path t
-  "Whether to allow loading of Python modules from the current directory.
-If this is non-nil, Emacs removes '' from sys.path when starting
-an inferior Python process.  This is the default, for security
-reasons, as it is easy for the Python process to be started
-without the user's realization (e.g. to perform completion)."
-  :type 'boolean
-  :group 'python
-  :version "23.3")
-
-(defun python-input-filter (str)
-  "`comint-input-filter' function for inferior Python.
-Don't save anything for STR matching `inferior-python-filter-regexp'."
-  (not (string-match inferior-python-filter-regexp str)))
-
-;; Fixme: Loses with quoted whitespace.
-(defun python-args-to-list (string)
-  (let ((where (string-match "[ \t]" string)))
-    (cond ((null where) (list string))
-         ((not (= where 0))
-          (cons (substring string 0 where)
-                (python-args-to-list (substring string (+ 1 where)))))
-         (t (let ((pos (string-match "[^ \t]" string)))
-              (if pos (python-args-to-list (substring string pos))))))))
-
-(defvar python-preoutput-result nil
-  "Data from last `_emacs_out' line seen by the preoutput filter.")
-
-(defvar python-preoutput-continuation nil
-  "If non-nil, funcall this when `python-preoutput-filter' sees `_emacs_ok'.")
-
-(defvar python-preoutput-leftover nil)
-(defvar python-preoutput-skip-next-prompt nil)
-
-;; Using this stops us getting lines in the buffer like
-;; >>> ... ... >>>
-;; Also look for (and delete) an `_emacs_ok' string and call
-;; `python-preoutput-continuation' if we get it.
-(defun python-preoutput-filter (s)
-  "`comint-preoutput-filter-functions' function: ignore prompts not at bol."
-  (when python-preoutput-leftover
-    (setq s (concat python-preoutput-leftover s))
-    (setq python-preoutput-leftover nil))
-  (let ((start 0)
-        (res ""))
-    ;; First process whole lines.
-    (while (string-match "\n" s start)
-      (let ((line (substring s start (setq start (match-end 0)))))
-        ;; Skip prompt if needed.
-        (when (and python-preoutput-skip-next-prompt
-                   (string-match comint-prompt-regexp line))
-          (setq python-preoutput-skip-next-prompt nil)
-          (setq line (substring line (match-end 0))))
-        ;; Recognize special _emacs_out lines.
-        (if (and (string-match "\\`_emacs_out \\(.*\\)\n\\'" line)
-                 (local-variable-p 'python-preoutput-result))
-            (progn
-              (setq python-preoutput-result (match-string 1 line))
-              (set (make-local-variable 'python-preoutput-skip-next-prompt) t))
-          (setq res (concat res line)))))
-    ;; Then process the remaining partial line.
-    (unless (zerop start) (setq s (substring s start)))
-    (cond ((and (string-match comint-prompt-regexp s)
-                ;; Drop this prompt if it follows an _emacs_out...
-                (or python-preoutput-skip-next-prompt
-                    ;; ... or if it's not gonna be inserted at BOL.
-                    ;; Maybe we could be more selective here.
-                    (if (zerop (length res))
-                        (not (bolp))
-                      (string-match ".\\'" res))))
-           ;; The need for this seems to be system-dependent:
-           ;; What is this all about, exactly?  --Stef
-           ;; (if (and (eq ?. (aref s 0)))
-           ;;     (accept-process-output (get-buffer-process (current-buffer)) 1))
-           (setq python-preoutput-skip-next-prompt nil)
-           res)
-          ((let ((end (min (length "_emacs_out ") (length s))))
-             (eq t (compare-strings s nil end "_emacs_out " nil end)))
-           ;; The leftover string is a prefix of _emacs_out so we don't know
-           ;; yet whether it's an _emacs_out or something else: wait until we
-           ;; get more output so we can resolve this ambiguity.
-           (set (make-local-variable 'python-preoutput-leftover) s)
-           res)
-          (t (concat res s)))))
-
-(autoload 'comint-check-proc "comint")
-
-(defvar python-version-checked nil)
-(defun python-check-version (cmd)
-  "Check that CMD runs a suitable version of Python."
-  ;; Fixme:  Check on Jython.
-  (unless (or python-version-checked
-             (equal 0 (string-match (regexp-quote python-python-command)
-                                    cmd)))
-    (unless (shell-command-to-string cmd)
-      (error "Can't run Python command `%s'" cmd))
-    (let* ((res (shell-command-to-string
-                 (concat cmd
-                         " -c \"from sys import version_info;\
-print version_info >= (2, 2) and version_info < (3, 0)\""))))
-      (unless (string-match "True" res)
-       (error "Only Python versions >= 2.2 and < 3.0 are supported")))
-    (setq python-version-checked t)))
-
-;;;###autoload
-(defun run-python (&optional cmd noshow new)
-  "Run an inferior Python process, input and output via buffer *Python*.
-CMD is the Python command to run.  NOSHOW non-nil means don't
-show the buffer automatically.
-
-Interactively, a prefix arg means to prompt for the initial
-Python command line (default is `python-command').
-
-A new process is started if one isn't running attached to
-`python-buffer', or if called from Lisp with non-nil arg NEW.
-Otherwise, if a process is already running in `python-buffer',
-switch to that buffer.
-
-This command runs the hook `inferior-python-mode-hook' after
-running `comint-mode-hook'.  Type \\[describe-mode] in the
-process buffer for a list of commands.
-
-By default, Emacs inhibits the loading of Python modules from the
-current working directory, for security reasons.  To disable this
-behavior, change `python-remove-cwd-from-path' to nil."
-  (interactive (if current-prefix-arg
-                  (list (read-string "Run Python: " python-command) nil t)
-                (list python-command)))
-  (unless cmd (setq cmd python-command))
-  (python-check-version cmd)
-  (setq python-command cmd)
-  ;; Fixme: Consider making `python-buffer' buffer-local as a buffer
-  ;; (not a name) in Python buffers from which `run-python' &c is
-  ;; invoked.  Would support multiple processes better.
-  (when (or new (not (comint-check-proc python-buffer)))
-    (with-current-buffer
-       (let* ((cmdlist
-               (append (python-args-to-list cmd) '("-i")
-                       (if python-remove-cwd-from-path
-                           '("-c" "import sys; sys.path.remove('')"))))
-              (path (getenv "PYTHONPATH"))
-              (process-environment     ; to import emacs.py
-               (cons (concat "PYTHONPATH="
-                             (if path (concat path path-separator))
-                             data-directory)
-                     process-environment))
-               ;; If we use a pipe, Unicode characters are not printed
-               ;; correctly (Bug#5794) and IPython does not work at
-               ;; all (Bug#5390).
-              (process-connection-type t))
-         (apply 'make-comint-in-buffer "Python"
-                (generate-new-buffer "*Python*")
-                (car cmdlist) nil (cdr cmdlist)))
-      (setq-default python-buffer (current-buffer))
-      (setq python-buffer (current-buffer))
-      (accept-process-output (get-buffer-process python-buffer) 5)
-      (inferior-python-mode)
-      ;; Load function definitions we need.
-      ;; Before the preoutput function was used, this was done via -c in
-      ;; cmdlist, but that loses the banner and doesn't run the startup
-      ;; file.  The code might be inline here, but there's enough that it
-      ;; seems worth putting in a separate file, and it's probably cleaner
-      ;; to put it in a module.
-      ;; Ensure we're at a prompt before doing anything else.
-      (python-send-string "import emacs")
-      ;; The following line was meant to ensure that we're at a prompt
-      ;; before doing anything else.  However, this can cause Emacs to
-      ;; hang waiting for a response, if that Python function fails
-      ;; (i.e. raises an exception).
-      ;; (python-send-receive "print '_emacs_out ()'")
-      ))
-  (if (derived-mode-p 'python-mode)
-      (setq python-buffer (default-value 'python-buffer))) ; buffer-local
-  ;; Without this, help output goes into the inferior python buffer if
-  ;; the process isn't already running.
-  (sit-for 1 t)        ;Should we use accept-process-output instead?  --Stef
-  (unless noshow (pop-to-buffer python-buffer t)))
-
-(defun python-send-command (command)
-  "Like `python-send-string' but resets `compilation-shell-minor-mode'."
-  (when (python-check-comint-prompt)
-    (with-current-buffer (process-buffer (python-proc))
-      (goto-char (point-max))
-      (compilation-forget-errors)
-      (python-send-string command)
-      (setq compilation-last-buffer (current-buffer)))))
-
-(defun python-send-region (start end)
-  "Send the region to the inferior Python process."
-  ;; The region is evaluated from a temporary file.  This avoids
-  ;; problems with blank lines, which have different semantics
-  ;; interactively and in files.  It also saves the inferior process
-  ;; buffer filling up with interpreter prompts.  We need a Python
-  ;; function to remove the temporary file when it has been evaluated
-  ;; (though we could probably do it in Lisp with a Comint output
-  ;; filter).  This function also catches exceptions and truncates
-  ;; tracebacks not to mention the frame of the function itself.
-  ;;
-  ;; The `compilation-shell-minor-mode' parsing takes care of relating
-  ;; the reference to the temporary file to the source.
-  ;;
-  ;; Fixme: Write a `coding' header to the temp file if the region is
-  ;; non-ASCII.
-  (interactive "r")
-  (let* ((f (make-temp-file "py"))
-        (command
-          ;; IPython puts the FakeModule module into __main__ so
-          ;; emacs.eexecfile becomes useless.
-          (if (string-match "^ipython" python-command)
-              (format "execfile %S" f)
-            (format "emacs.eexecfile(%S)" f)))
-        (orig-start (copy-marker start)))
-    (when (save-excursion
-           (goto-char start)
-           (/= 0 (current-indentation))) ; need dummy block
-      (save-excursion
-       (goto-char orig-start)
-       ;; Wrong if we had indented code at buffer start.
-       (set-marker orig-start (line-beginning-position 0)))
-      (write-region "if True:\n" nil f nil 'nomsg))
-    (write-region start end f t 'nomsg)
-    (python-send-command command)
-    (with-current-buffer (process-buffer (python-proc))
-      ;; Tell compile.el to redirect error locations in file `f' to
-      ;; positions past marker `orig-start'.  It has to be done *after*
-      ;; `python-send-command''s call to `compilation-forget-errors'.
-      (compilation-fake-loc orig-start f))))
-
-(defun python-send-string (string)
-  "Evaluate STRING in inferior Python process."
-  (interactive "sPython command: ")
-  (comint-send-string (python-proc) string)
-  (unless (string-match "\n\\'" string)
-    ;; Make sure the text is properly LF-terminated.
-    (comint-send-string (python-proc) "\n"))
-  (when (string-match "\n[ \t].*\n?\\'" string)
-    ;; If the string contains a final indented line, add a second newline so
-    ;; as to make sure we terminate the multiline instruction.
-    (comint-send-string (python-proc) "\n")))
-
-(defun python-send-buffer ()
-  "Send the current buffer to the inferior Python process."
+(defun python-shell-make-comint (cmd proc-name &optional pop)
+  "Create a python shell comint buffer.
+CMD is the python command to be executed and PROC-NAME is the
+process name the comint buffer will get.  After the comint buffer
+is created the `inferior-python-mode' is activated.  If POP is
+non-nil the buffer is shown."
+  (save-excursion
+    (let* ((proc-buffer-name (format "*%s*" proc-name))
+           (process-environment (python-shell-calculate-process-environment))
+           (exec-path (python-shell-calculate-exec-path)))
+      (when (not (comint-check-proc proc-buffer-name))
+        (let* ((cmdlist (split-string-and-unquote cmd))
+               (buffer (apply 'make-comint proc-name (car cmdlist) nil
+                              (cdr cmdlist)))
+               (current-buffer (current-buffer)))
+          (with-current-buffer buffer
+            (inferior-python-mode)
+            (python-util-clone-local-variables current-buffer))))
+      (when pop
+        (pop-to-buffer proc-buffer-name))
+      proc-buffer-name)))
+
+(defun run-python (dedicated cmd)
+  "Run an inferior Python process.
+Input and output via buffer named after
+`python-shell-buffer-name'.  If there is a process already
+running in that buffer, just switch to it.
+With argument, allows you to define DEDICATED, so a dedicated
+process for the current buffer is open, and define CMD so you can
+edit the command used to call the interpreter (default is value
+of `python-shell-interpreter' and arguments defined in
+`python-shell-interpreter-args').  Runs the hook
+`inferior-python-mode-hook' (after the `comint-mode-hook' is
+run).
+\(Type \\[describe-mode] in the process buffer for a list of commands.)"
+  (interactive
+   (if current-prefix-arg
+       (list
+        (y-or-n-p "Make dedicated process? ")
+        (read-string "Run Python: " (python-shell-parse-command)))
+     (list nil (python-shell-parse-command))))
+  (python-shell-make-comint cmd (python-shell-get-process-name dedicated))
+  dedicated)
+
+(defun run-python-internal ()
+  "Run an inferior Internal Python process.
+Input and output via buffer named after
+`python-shell-internal-buffer-name' and what
+`python-shell-internal-get-process-name' returns.  This new kind
+of shell is intended to be used for generic communication related
+to defined configurations.  The main difference with global or
+dedicated shells is that these ones are attached to a
+configuration, not a buffer.  This means that can be used for
+example to retrieve the sys.path and other stuff, without messing
+with user shells.  Runs the hook
+`inferior-python-mode-hook' (after the `comint-mode-hook' is
+run).  \(Type \\[describe-mode] in the process buffer for a list
+of commands.)"
   (interactive)
-  (python-send-region (point-min) (point-max)))
+  (set-process-query-on-exit-flag
+   (get-buffer-process
+    (python-shell-make-comint
+     (python-shell-parse-command)
+     (python-shell-internal-get-process-name))) nil))
+
+(defun python-shell-get-process ()
+  "Get inferior Python process for current buffer and return it."
+  (let* ((dedicated-proc-name (python-shell-get-process-name t))
+         (dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name))
+         (global-proc-name  (python-shell-get-process-name nil))
+         (global-proc-buffer-name (format "*%s*" global-proc-name))
+         (dedicated-running (comint-check-proc dedicated-proc-buffer-name))
+         (global-running (comint-check-proc global-proc-buffer-name)))
+    ;; Always prefer dedicated
+    (get-buffer-process (or (and dedicated-running dedicated-proc-buffer-name)
+                            (and global-running global-proc-buffer-name)))))
+
+(defun python-shell-get-or-create-process ()
+  "Get or create an inferior Python process for current buffer and return it."
+  (let* ((dedicated-proc-name (python-shell-get-process-name t))
+         (dedicated-proc-buffer-name (format "*%s*" dedicated-proc-name))
+         (global-proc-name  (python-shell-get-process-name nil))
+         (global-proc-buffer-name (format "*%s*" global-proc-name))
+         (dedicated-running (comint-check-proc dedicated-proc-buffer-name))
+         (global-running (comint-check-proc global-proc-buffer-name))
+         (current-prefix-arg 4))
+    (when (and (not dedicated-running) (not global-running))
+      (if (call-interactively 'run-python)
+          (setq dedicated-running t)
+        (setq global-running t)))
+    ;; Always prefer dedicated
+    (get-buffer-process (if dedicated-running
+                            dedicated-proc-buffer-name
+                          global-proc-buffer-name))))
+
+(defvar python-shell-internal-buffer nil
+  "Current internal shell buffer for the current buffer.
+This is really not necessary at all for the code to work but it's
+there for compatibility with CEDET.")
+(make-variable-buffer-local 'python-shell-internal-buffer)
+
+(defun python-shell-internal-get-or-create-process ()
+  "Get or create an inferior Internal Python process."
+  (let* ((proc-name (python-shell-internal-get-process-name))
+         (proc-buffer-name (format "*%s*" proc-name)))
+    (run-python-internal)
+    (setq python-shell-internal-buffer proc-buffer-name)
+    (get-buffer-process proc-buffer-name)))
+
+(define-obsolete-function-alias
+  'python-proc 'python-shell-internal-get-or-create-process "24.2")
+
+(define-obsolete-variable-alias
+  'python-buffer 'python-shell-internal-buffer "24.2")
+
+(defun python-shell-send-string (string &optional process msg)
+  "Send STRING to inferior Python PROCESS.
+When MSG is non-nil messages the first line of STRING."
+  (interactive "sPython command: ")
+  (let ((process (or process (python-shell-get-or-create-process)))
+        (lines (split-string string "\n" t)))
+    (when msg
+      (message (format "Sent: %s..." (nth 0 lines))))
+    (if (> (length lines) 1)
+        (let* ((temp-file-name (make-temp-file "py"))
+               (file-name (or (buffer-file-name) temp-file-name)))
+          (with-temp-file temp-file-name
+            (insert string)
+            (delete-trailing-whitespace))
+          (python-shell-send-file file-name process temp-file-name))
+      (comint-send-string process string)
+      (when (or (not (string-match "\n$" string))
+                (string-match "\n[ \t].*\n?$" string))
+        (comint-send-string process "\n")))))
+
+(defun python-shell-send-string-no-output (string &optional process msg)
+  "Send STRING to PROCESS and inhibit output.
+When MSG is non-nil messages the first line of STRING.  Return
+the output."
+  (let* ((output-buffer)
+         (process (or process (python-shell-get-or-create-process)))
+         (comint-preoutput-filter-functions
+          (append comint-preoutput-filter-functions
+                  '(ansi-color-filter-apply
+                    (lambda (string)
+                      (setq output-buffer (concat output-buffer string))
+                      "")))))
+    (python-shell-send-string string process msg)
+    (accept-process-output process)
+    (replace-regexp-in-string
+     (if (> (length python-shell-prompt-output-regexp) 0)
+         (format "\n*%s$\\|^%s\\|\n$"
+                 python-shell-prompt-regexp
+                 (or python-shell-prompt-output-regexp ""))
+       (format "\n*$\\|^%s\\|\n$"
+               python-shell-prompt-regexp))
+     "" output-buffer)))
+
+(defun python-shell-internal-send-string (string)
+  "Send STRING to the Internal Python interpreter.
+Returns the output.  See `python-shell-send-string-no-output'."
+  (python-shell-send-string-no-output
+   ;; Makes this function compatible with the old
+   ;; python-send-receive. (At least for CEDET).
+   (replace-regexp-in-string "_emacs_out +" "" string)
+   (python-shell-internal-get-or-create-process) nil))
+
+(define-obsolete-function-alias
+  'python-send-receive 'python-shell-internal-send-string "24.2")
+
+(define-obsolete-function-alias
+  'python-send-string 'python-shell-internal-send-string "24.2")
+
+(defun python-shell-send-region (start end)
+  "Send the region delimited by START and END to inferior Python process."
+  (interactive "r")
+  (python-shell-send-string (buffer-substring start end) nil t))
 
-;; Fixme: Try to define the function or class within the relevant
-;; module, not just at top level.
-(defun python-send-defun ()
-  "Send the current defun (class or method) to the inferior Python process."
-  (interactive)
-  (save-excursion (python-send-region (progn (beginning-of-defun) (point))
-                                     (progn (end-of-defun) (point)))))
+(defun python-shell-send-buffer (&optional arg)
+  "Send the entire buffer to inferior Python process.
 
-(defun python-switch-to-python (eob-p)
-  "Switch to the Python process buffer, maybe starting new process.
-With prefix arg, position cursor at end of buffer."
+With prefix ARG include lines surrounded by \"if __name__ == '__main__':\""
   (interactive "P")
-  (pop-to-buffer (process-buffer (python-proc)) t) ;Runs python if needed.
-  (when eob-p
-    (push-mark)
-    (goto-char (point-max))))
-
-(defun python-send-region-and-go (start end)
-  "Send the region to the inferior Python process.
-Then switch to the process buffer."
-  (interactive "r")
-  (python-send-region start end)
-  (python-switch-to-python t))
-
-(defcustom python-source-modes '(python-mode jython-mode)
-  "Used to determine if a buffer contains Python source code.
-If a file is loaded into a buffer that is in one of these major modes,
-it is considered Python source by `python-load-file', which uses the
-value to determine defaults."
-  :type '(repeat function)
-  :group 'python)
-
-(defvar python-prev-dir/file nil
-  "Caches (directory . file) pair used in the last `python-load-file' command.
-Used for determining the default in the next one.")
-
-(autoload 'comint-get-source "comint")
-
-(defun python-load-file (file-name)
-  "Load a Python file FILE-NAME into the inferior Python process.
-If the file has extension `.py' import or reload it as a module.
-Treating it as a module keeps the global namespace clean, provides
-function location information for debugging, and supports users of
-module-qualified names."
-  (interactive (comint-get-source "Load Python file: " python-prev-dir/file
-                                 python-source-modes
-                                 t))   ; because execfile needs exact name
-  (comint-check-source file-name)     ; Check to see if buffer needs saving.
-  (setq python-prev-dir/file (cons (file-name-directory file-name)
-                                  (file-name-nondirectory file-name)))
-  (with-current-buffer (process-buffer (python-proc)) ;Runs python if needed.
-    ;; Fixme: I'm not convinced by this logic from python-mode.el.
-    (python-send-command
-     (if (string-match "\\.py\\'" file-name)
-        (let ((module (file-name-sans-extension
-                       (file-name-nondirectory file-name))))
-          (format "emacs.eimport(%S,%S)"
-                  module (file-name-directory file-name)))
-       (format "execfile(%S)" file-name)))
-    (message "%s loaded" file-name)))
-
-(defun python-proc ()
-  "Return the current Python process.
-See variable `python-buffer'.  Starts a new process if necessary."
-  ;; Fixme: Maybe should look for another active process if there
-  ;; isn't one for `python-buffer'.
-  (unless (comint-check-proc python-buffer)
-    (run-python nil t))
-  (get-buffer-process (if (derived-mode-p 'inferior-python-mode)
-                         (current-buffer)
-                       python-buffer)))
-
-(defun python-set-proc ()
-  "Set the default value of `python-buffer' to correspond to this buffer.
-If the current buffer has a local value of `python-buffer', set the
-default (global) value to that.  The associated Python process is
-the one that gets input from \\[python-send-region] et al when used
-in a buffer that doesn't have a local value of `python-buffer'."
+  (save-restriction
+    (widen)
+    (python-shell-send-region
+     (point-min)
+     (or (and
+          (not arg)
+          (save-excursion
+            (re-search-forward (python-rx if-name-main) nil t))
+          (match-beginning 0))
+         (point-max)))))
+
+(defun python-shell-send-defun (arg)
+  "Send the current defun to inferior Python process.
+When argument ARG is non-nil do not include decorators."
+  (interactive "P")
+  (save-excursion
+    (python-shell-send-region
+     (progn
+       (end-of-line 1)
+       (while (and (or (python-beginning-of-defun-function)
+                       (beginning-of-line 1))
+                   (> (current-indentation) 0)))
+       (when (not arg)
+         (while (and (forward-line -1)
+                     (looking-at (python-rx decorator))))
+         (forward-line 1))
+       (point-marker))
+     (progn
+       (or (python-end-of-defun-function)
+           (end-of-line 1))
+       (point-marker)))))
+
+(defun python-shell-send-file (file-name &optional process temp-file-name)
+  "Send FILE-NAME to inferior Python PROCESS.
+If TEMP-FILE-NAME is passed then that file is used for processing
+instead, while internally the shell will continue to use
+FILE-NAME."
+  (interactive "fFile to send: ")
+  (let* ((process (or process (python-shell-get-or-create-process)))
+         (temp-file-name (when temp-file-name
+                           (expand-file-name temp-file-name)))
+         (file-name (or (expand-file-name file-name) temp-file-name)))
+    (when (not file-name)
+      (error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil"))
+    (python-shell-send-string
+     (format
+      (concat "__pyfile = open('''%s''');"
+              "exec(compile(__pyfile.read(), '''%s''', 'exec'));"
+              "__pyfile.close()")
+      (or temp-file-name file-name) file-name)
+     process)))
+
+(defun python-shell-switch-to-shell ()
+  "Switch to inferior Python process buffer."
   (interactive)
-  (if (local-variable-p 'python-buffer)
-      (setq-default python-buffer python-buffer)
-    (error "No local value of `python-buffer'")))
+  (pop-to-buffer (process-buffer (python-shell-get-or-create-process)) t))
+
+(defun python-shell-send-setup-code ()
+  "Send all setup code for shell.
+This function takes the list of setup code to send from the
+`python-shell-setup-codes' list."
+  (let ((msg "Sent %s")
+        (process (get-buffer-process (current-buffer))))
+    (accept-process-output process python-shell-send-setup-max-wait)
+    (dolist (code python-shell-setup-codes)
+      (when code
+        (message (format msg code))
+        (python-shell-send-string
+         (symbol-value code) process)))))
+
+(add-hook 'inferior-python-mode-hook
+          #'python-shell-send-setup-code)
+
 \f
-;;;; Context-sensitive help.
+;;; Shell completion
+
+(defcustom python-shell-completion-setup-code
+  "try:
+    import readline
+except ImportError:
+    def __COMPLETER_all_completions(text): []
+else:
+    import rlcompleter
+    readline.set_completer(rlcompleter.Completer().complete)
+    def __COMPLETER_all_completions(text):
+        import sys
+        completions = []
+        try:
+            i = 0
+            while True:
+                res = readline.get_completer()(text, i)
+                if not res: break
+                i += 1
+                completions.append(res)
+        except NameError:
+            pass
+        return completions"
+  "Code used to setup completion in inferior Python processes."
+  :type 'string
+  :group 'python)
 
-(defconst python-dotty-syntax-table
-  (let ((table (make-syntax-table)))
-    (set-char-table-parent table python-mode-syntax-table)
-    (modify-syntax-entry ?. "_" table)
-    table)
-  "Syntax table giving `.' symbol syntax.
-Otherwise inherits from `python-mode-syntax-table'.")
+(defcustom python-shell-completion-string-code
+  "';'.join(__COMPLETER_all_completions('''%s'''))\n"
+  "Python code used to get a string of completions separated by semicolons."
+  :type 'string
+  :group 'python)
 
-(defvar view-return-to-alist)
-(eval-when-compile (autoload 'help-buffer "help-fns"))
+(defcustom python-shell-completion-module-string-code ""
+  "Python code used to get completions separated by semicolons for imports.
 
-(defvar python-imports)                        ; forward declaration
+For IPython v0.11, add the following line to
+`python-shell-completion-setup-code':
 
-;; Fixme: Should this actually be used instead of info-look, i.e. be
-;; bound to C-h S?  [Probably not, since info-look may work in cases
-;; where this doesn't.]
-(defun python-describe-symbol (symbol)
-  "Get help on SYMBOL using `help'.
-Interactively, prompt for symbol.
+from IPython.core.completerlib import module_completion
 
-Symbol may be anything recognized by the interpreter's `help'
-command -- e.g. `CALLS' -- not just variables in scope in the
-interpreter.  This only works for Python version 2.2 or newer
-since earlier interpreters don't support `help'.
+and use the following as the value of this variable:
 
-In some cases where this doesn't find documentation, \\[info-lookup-symbol]
-will."
-  ;; Note that we do this in the inferior process, not a separate one, to
-  ;; ensure the environment is appropriate.
-  (interactive
-   (let ((symbol (with-syntax-table python-dotty-syntax-table
-                  (current-word)))
-        (enable-recursive-minibuffers t))
-     (list (read-string (if symbol
-                           (format "Describe symbol (default %s): " symbol)
-                         "Describe symbol: ")
-                       nil nil symbol))))
-  (if (equal symbol "") (error "No symbol"))
-  ;; Ensure we have a suitable help buffer.
-  ;; Fixme: Maybe process `Related help topics' a la help xrefs and
-  ;; allow C-c C-f in help buffer.
-  (let ((temp-buffer-show-hook         ; avoid xref stuff
-        (lambda ()
-          (toggle-read-only 1)
-          (setq view-return-to-alist
-                (list (cons (selected-window) help-return-method))))))
-    (with-output-to-temp-buffer (help-buffer)
-      (with-current-buffer standard-output
-       ;; Fixme: Is this actually useful?
-       (help-setup-xref (list 'python-describe-symbol symbol)
-                        (called-interactively-p 'interactive))
-       (set (make-local-variable 'comint-redirect-subvert-readonly) t)
-       (help-print-return-message))))
-  (comint-redirect-send-command-to-process (format "emacs.ehelp(%S, %s)"
-                                                  symbol python-imports)
-   "*Help*" (python-proc) nil nil))
-
-(add-to-list 'debug-ignored-errors "^No symbol")
-
-(defun python-send-receive (string)
-  "Send STRING to inferior Python (if any) and return result.
-The result is what follows `_emacs_out' in the output.
-This is a no-op if `python-check-comint-prompt' returns nil."
-  (python-send-string string)
-  (let ((proc (python-proc)))
-    (with-current-buffer (process-buffer proc)
-      (when (python-check-comint-prompt proc)
-       (set (make-local-variable 'python-preoutput-result) nil)
-       (while (progn
-                (accept-process-output proc 5)
-                (null python-preoutput-result)))
-       (prog1 python-preoutput-result
-         (kill-local-variable 'python-preoutput-result))))))
-
-(defun python-check-comint-prompt (&optional proc)
-  "Return non-nil if and only if there's a normal prompt in the inferior buffer.
-If there isn't, it's probably not appropriate to send input to return Eldoc
-information etc.  If PROC is non-nil, check the buffer for that process."
-  (with-current-buffer (process-buffer (or proc (python-proc)))
-    (save-excursion
-      (save-match-data
-       (re-search-backward (concat python--prompt-regexp " *\\=")
-                           nil t)))))
+';'.join(module_completion('''%s'''))\n"
+  :type 'string
+  :group 'python)
 
-;; Fixme:  Is there anything reasonable we can do with random methods?
-;; (Currently only works with functions.)
-(defun python-eldoc-function ()
-  "`eldoc-documentation-function' for Python.
-Only works when point is in a function name, not its arg list, for
-instance.  Assumes an inferior Python is running."
-  (let ((symbol (with-syntax-table python-dotty-syntax-table
-                 (current-word))))
-    ;; This is run from timers, so inhibit-quit tends to be set.
-    (with-local-quit
-      ;; First try the symbol we're on.
-      (or (and symbol
-              (python-send-receive (format "emacs.eargs(%S, %s)"
-                                           symbol python-imports)))
-         ;; Try moving to symbol before enclosing parens.
-         (let ((s (syntax-ppss)))
-           (unless (zerop (car s))
-             (when (eq ?\( (char-after (nth 1 s)))
-               (save-excursion
-                 (goto-char (nth 1 s))
-                 (skip-syntax-backward "-")
-                 (let ((point (point)))
-                   (skip-chars-backward "a-zA-Z._")
-                   (if (< (point) point)
-                       (python-send-receive
-                        (format "emacs.eargs(%S, %s)"
-                                (buffer-substring-no-properties (point) point)
-                                python-imports))))))))))))
-\f
-;;;; Info-look functionality.
+(defcustom python-shell-completion-pdb-string-code
+  "';'.join(globals().keys() + locals().keys())"
+  "Python code used to get completions separated by semicolons for [i]pdb."
+  :type 'string
+  :group 'python)
 
-(declare-function info-lookup-maybe-add-help "info-look" (&rest arg))
+(defun python-shell-completion--get-completions (input process completion-code)
+  "Retrieve available completions for INPUT using PROCESS.
+Argument COMPLETION-CODE is the python code used to get
+completions on the current context."
+  (with-current-buffer (process-buffer process)
+    (let ((completions (python-shell-send-string-no-output
+                        (format completion-code input) process)))
+      (when (> (length completions) 2)
+        (split-string completions "^'\\|^\"\\|;\\|'$\\|\"$" t)))))
+
+(defun python-shell-completion--do-completion-at-point (process)
+  "Do completion at point for PROCESS."
+  (with-syntax-table python-dotty-syntax-table
+    (let* ((beg
+            (save-excursion
+              (let* ((paren-depth (car (syntax-ppss)))
+                     (syntax-string "w_")
+                     (syntax-list (string-to-syntax syntax-string)))
+                ;; Stop scanning for the beginning of the completion subject
+                ;; after the char before point matches a delimiter
+                (while (member (car (syntax-after (1- (point)))) syntax-list)
+                  (skip-syntax-backward syntax-string)
+                  (when (or (equal (char-before) ?\))
+                            (equal (char-before) ?\"))
+                    (forward-char -1))
+                  (while (or
+                          ;; honor initial paren depth
+                          (> (car (syntax-ppss)) paren-depth)
+                          (python-info-ppss-context 'string))
+                    (forward-char -1))))
+              (point)))
+           (end (point))
+           (line (buffer-substring-no-properties (point-at-bol) end))
+           (input (buffer-substring-no-properties beg end))
+           ;; Get the last prompt for the inferior process buffer. This is
+           ;; used for the completion code selection heuristic.
+           (prompt
+            (with-current-buffer (process-buffer process)
+              (buffer-substring-no-properties
+               (overlay-start comint-last-prompt-overlay)
+               (overlay-end comint-last-prompt-overlay))))
+           (completion-context
+            ;; Check whether a prompt matches a pdb string, an import statement
+            ;; or just the standard prompt and use the correct
+            ;; python-shell-completion-*-code string
+            (cond ((and (> (length python-shell-completion-pdb-string-code) 0)
+                        (string-match
+                         (concat "^" python-shell-prompt-pdb-regexp) prompt))
+                   'pdb)
+                  ((and (>
+                         (length python-shell-completion-module-string-code) 0)
+                        (string-match
+                         (concat "^" python-shell-prompt-regexp) prompt)
+                        (string-match "^[ \t]*\\(from\\|import\\)[ \t]" line))
+                   'import)
+                  ((string-match
+                    (concat "^" python-shell-prompt-regexp) prompt)
+                   'default)
+                  (t nil)))
+           (completion-code
+            (case completion-context
+              ('pdb python-shell-completion-pdb-string-code)
+              ('import python-shell-completion-module-string-code)
+              ('default python-shell-completion-string-code)
+              (t nil)))
+           (input
+            (if (eq completion-context 'import)
+                (replace-regexp-in-string "^[ \t]+" "" line)
+              input))
+           (completions
+            (and completion-code (> (length input) 0)
+                 (python-shell-completion--get-completions
+                  input process completion-code))))
+      (list beg end completions))))
+
+(defun python-shell-completion-complete-at-point ()
+  "Perform completion at point in inferior Python process."
+  (interactive)
+  (and comint-last-prompt-overlay
+       (> (point-marker) (overlay-end comint-last-prompt-overlay))
+       (python-shell-completion--do-completion-at-point
+        (get-buffer-process (current-buffer)))))
+
+(defun python-shell-completion-complete-or-indent ()
+  "Complete or indent depending on the context.
+If content before pointer is all whitespace indent.  If not try
+to complete."
+  (interactive)
+  (if (string-match "^[[:space:]]*$"
+                    (buffer-substring (comint-line-beginning-position)
+                                      (point-marker)))
+      (indent-for-tab-command)
+    (completion-at-point)))
 
-;;;###autoload
-(defun python-after-info-look ()
-  "Set up info-look for Python.
-Used with `eval-after-load'."
-  (let* ((version (let ((s (shell-command-to-string (concat python-command
-                                                           " -V"))))
-                   (string-match "^Python \\([0-9]+\\.[0-9]+\\>\\)" s)
-                   (match-string 1 s)))
-        ;; Whether info files have a Python version suffix, e.g. in Debian.
-        (versioned
-         (with-temp-buffer
-           (with-no-warnings (Info-mode))
-           (condition-case ()
-               ;; Don't use `info' because it would pop-up a *info* buffer.
-               (with-no-warnings
-                 (Info-goto-node (format "(python%s-lib)Miscellaneous Index"
-                                         version))
-                 t)
-             (error nil)))))
-    (info-lookup-maybe-add-help
-     :mode 'python-mode
-     :regexp "[[:alnum:]_]+"
-     :doc-spec
-     ;; Fixme: Can this reasonably be made specific to indices with
-     ;; different rules?  Is the order of indices optimal?
-     ;; (Miscellaneous in -ref first prefers lookup of keywords, for
-     ;; instance.)
-     (if versioned
-        ;; The empty prefix just gets us highlighted terms.
-        `((,(concat "(python" version "-ref)Miscellaneous Index") nil "")
-          (,(concat "(python" version "-ref)Module Index" nil ""))
-          (,(concat "(python" version "-ref)Function-Method-Variable Index"
-                    nil ""))
-          (,(concat "(python" version "-ref)Class-Exception-Object Index"
-                    nil ""))
-          (,(concat "(python" version "-lib)Module Index" nil ""))
-          (,(concat "(python" version "-lib)Class-Exception-Object Index"
-                    nil ""))
-          (,(concat "(python" version "-lib)Function-Method-Variable Index"
-                    nil ""))
-          (,(concat "(python" version "-lib)Miscellaneous Index" nil "")))
-       '(("(python-ref)Miscellaneous Index" nil "")
-        ("(python-ref)Module Index" nil "")
-        ("(python-ref)Function-Method-Variable Index" nil "")
-        ("(python-ref)Class-Exception-Object Index" nil "")
-        ("(python-lib)Module Index" nil "")
-        ("(python-lib)Class-Exception-Object Index" nil "")
-        ("(python-lib)Function-Method-Variable Index" nil "")
-        ("(python-lib)Miscellaneous Index" nil ""))))))
-(eval-after-load "info-look" '(python-after-info-look))
 \f
-;;;; Miscellany.
+;;; PDB Track integration
 
-(defcustom python-jython-packages '("java" "javax" "org" "com")
-  "Packages implying `jython-mode'.
-If these are imported near the beginning of the buffer, `python-mode'
-actually punts to `jython-mode'."
-  :type '(repeat string)
-  :group 'python)
-
-;; Called from `python-mode', this causes a recursive call of the
-;; mode.  See logic there to break out of the recursion.
-(defun python-maybe-jython ()
-  "Invoke `jython-mode' if the buffer appears to contain Jython code.
-The criterion is either a match for `jython-mode' via
-`interpreter-mode-alist' or an import of a module from the list
-`python-jython-packages'."
-  ;; The logic is taken from python-mode.el.
-  (save-excursion
-    (save-restriction
-      (widen)
-      (goto-char (point-min))
-      (let ((interpreter (if (looking-at auto-mode-interpreter-regexp)
-                            (match-string 2))))
-       (if (and interpreter (eq 'jython-mode
-                                (cdr (assoc (file-name-nondirectory
-                                             interpreter)
-                                            interpreter-mode-alist))))
-           (jython-mode)
-         (if (catch 'done
-               (while (re-search-forward
-                       (rx line-start (or "import" "from") (1+ space)
-                           (group (1+ (not (any " \t\n.")))))
-                       (+ (point-min) 10000) ; Probably not worth customizing.
-                       t)
-                 (if (member (match-string 1) python-jython-packages)
-                     (throw 'done t))))
-             (jython-mode)))))))
-
-(defun python-fill-paragraph (&optional justify)
-  "`fill-paragraph-function' handling multi-line strings and possibly comments.
-If any of the current line is in or at the end of a multi-line string,
-fill the string or the paragraph of it that point is in, preserving
-the string's indentation."
-  (interactive "P")
-  (or (fill-comment-paragraph justify)
-      (save-excursion
-       (end-of-line)
-       (let* ((syntax (syntax-ppss))
-              (orig (point))
-              start end)
-         (cond ((nth 4 syntax) ; comment.   fixme: loses with trailing one
-                (let (fill-paragraph-function)
-                  (fill-paragraph justify)))
-               ;; The `paragraph-start' and `paragraph-separate'
-               ;; variables don't allow us to delimit the last
-               ;; paragraph in a multi-line string properly, so narrow
-               ;; to the string and then fill around (the end of) the
-               ;; current line.
-               ((eq t (nth 3 syntax))  ; in fenced string
-                (goto-char (nth 8 syntax)) ; string start
-                (setq start (line-beginning-position))
-                (setq end (condition-case () ; for unbalanced quotes
-                               (progn (forward-sexp)
-                                      (- (point) 3))
-                             (error (point-max)))))
-               ((re-search-backward "\\s|\\s-*\\=" nil t) ; end of fenced string
-                (forward-char)
-                (setq end (point))
-                (condition-case ()
-                    (progn (backward-sexp)
-                           (setq start (line-beginning-position)))
-                  (error nil))))
-         (when end
-           (save-restriction
-             (narrow-to-region start end)
-             (goto-char orig)
-             ;; Avoid losing leading and trailing newlines in doc
-             ;; strings written like:
-             ;;   """
-             ;;   ...
-             ;;   """
-             (let ((paragraph-separate
-                    ;; Note that the string could be part of an
-                    ;; expression, so it can have preceding and
-                    ;; trailing non-whitespace.
-                    (concat
-                     (rx (or
-                          ;; Opening triple quote without following text.
-                          (and (* nonl)
-                               (group (syntax string-delimiter))
-                               (repeat 2 (backref 1))
-                               ;; Fixme:  Not sure about including
-                               ;; trailing whitespace.
-                               (* (any " \t"))
-                               eol)
-                          ;; Closing trailing quote without preceding text.
-                          (and (group (any ?\" ?')) (backref 2)
-                               (syntax string-delimiter))))
-                     "\\(?:" paragraph-separate "\\)"))
-                   fill-paragraph-function)
-               (fill-paragraph justify))))))) t)
-
-(defun python-shift-left (start end &optional count)
-  "Shift lines in region COUNT (the prefix arg) columns to the left.
-COUNT defaults to `python-indent'.  If region isn't active, just shift
-current line.  The region shifted includes the lines in which START and
-END lie.  It is an error if any lines in the region are indented less than
-COUNT columns."
-  (interactive
-   (if mark-active
-       (list (region-beginning) (region-end) current-prefix-arg)
-     (list (line-beginning-position) (line-end-position) current-prefix-arg)))
-  (if count
-      (setq count (prefix-numeric-value count))
-    (setq count python-indent))
-  (when (> count 0)
-    (save-excursion
-      (goto-char start)
-      (while (< (point) end)
-       (if (and (< (current-indentation) count)
-                (not (looking-at "[ \t]*$")))
-           (error "Can't shift all lines enough"))
-       (forward-line))
-      (indent-rigidly start end (- count)))))
+(defcustom python-pdbtrack-activate t
+  "Non-nil makes python shell enable pdbtracking."
+  :type 'boolean
+  :group 'python
+  :safe 'booleanp)
 
-(add-to-list 'debug-ignored-errors "^Can't shift all lines enough")
+(defcustom python-pdbtrack-stacktrace-info-regexp
+  "^> \\([^\"(<]+\\)(\\([0-9]+\\))\\([?a-zA-Z0-9_<>]+\\)()"
+  "Regular Expression matching stacktrace information.
+Used to extract the current line and module being inspected."
+  :type 'string
+  :group 'python
+  :safe 'stringp)
+
+(defvar python-pdbtrack-tracked-buffer nil
+  "Variable containing the value of the current tracked buffer.
+Never set this variable directly, use
+`python-pdbtrack-set-tracked-buffer' instead.")
+(make-variable-buffer-local 'python-pdbtrack-tracked-buffer)
+
+(defvar python-pdbtrack-buffers-to-kill nil
+  "List of buffers to be deleted after tracking finishes.")
+(make-variable-buffer-local 'python-pdbtrack-buffers-to-kill)
+
+(defun python-pdbtrack-set-tracked-buffer (file-name)
+  "Set the buffer for FILE-NAME as the tracked buffer.
+Internally it uses the `python-pdbtrack-tracked-buffer' variable.
+Returns the tracked buffer."
+  (let ((file-buffer (get-file-buffer file-name)))
+    (if file-buffer
+        (setq python-pdbtrack-tracked-buffer file-buffer)
+      (setq file-buffer (find-file-noselect file-name))
+      (when (not (member file-buffer python-pdbtrack-buffers-to-kill))
+        (add-to-list 'python-pdbtrack-buffers-to-kill file-buffer)))
+    file-buffer))
+
+(defun python-pdbtrack-comint-output-filter-function (output)
+  "Move overlay arrow to current pdb line in tracked buffer.
+Argument OUTPUT is a string with the output from the comint process."
+  (when (and python-pdbtrack-activate (not (string= output "")))
+    (let* ((full-output (ansi-color-filter-apply
+                         (buffer-substring comint-last-input-end (point-max))))
+           (line-number)
+           (file-name
+            (with-temp-buffer
+              (insert full-output)
+              (goto-char (point-min))
+              ;; OK, this sucked but now it became a cool hack. The
+              ;; stacktrace information normally is on the first line
+              ;; but in some cases (like when doing a step-in) it is
+              ;; on the second.
+              (when (or (looking-at python-pdbtrack-stacktrace-info-regexp)
+                        (and
+                         (forward-line)
+                         (looking-at python-pdbtrack-stacktrace-info-regexp)))
+                (setq line-number (string-to-number
+                                   (match-string-no-properties 2)))
+                (match-string-no-properties 1)))))
+      (if (and file-name line-number)
+          (let* ((tracked-buffer
+                  (python-pdbtrack-set-tracked-buffer file-name))
+                 (shell-buffer (current-buffer))
+                 (tracked-buffer-window (get-buffer-window tracked-buffer))
+                 (tracked-buffer-line-pos))
+            (with-current-buffer tracked-buffer
+              (set (make-local-variable 'overlay-arrow-string) "=>")
+              (set (make-local-variable 'overlay-arrow-position) (make-marker))
+              (setq tracked-buffer-line-pos (progn
+                                              (goto-char (point-min))
+                                              (forward-line (1- line-number))
+                                              (point-marker)))
+              (when tracked-buffer-window
+                (set-window-point
+                 tracked-buffer-window tracked-buffer-line-pos))
+              (set-marker overlay-arrow-position tracked-buffer-line-pos))
+            (pop-to-buffer tracked-buffer)
+            (switch-to-buffer-other-window shell-buffer))
+        (when python-pdbtrack-tracked-buffer
+          (with-current-buffer python-pdbtrack-tracked-buffer
+            (set-marker overlay-arrow-position nil))
+          (mapc #'(lambda (buffer)
+                    (ignore-errors (kill-buffer buffer)))
+                python-pdbtrack-buffers-to-kill)
+          (setq python-pdbtrack-tracked-buffer nil
+                python-pdbtrack-buffers-to-kill nil)))))
+  output)
 
-(defun python-shift-right (start end &optional count)
-  "Shift lines in region COUNT (the prefix arg) columns to the right.
-COUNT defaults to `python-indent'.  If region isn't active, just shift
-current line.  The region shifted includes the lines in which START and
-END lie."
-  (interactive
-   (if mark-active
-       (list (region-beginning) (region-end) current-prefix-arg)
-     (list (line-beginning-position) (line-end-position) current-prefix-arg)))
-  (if count
-      (setq count (prefix-numeric-value count))
-    (setq count python-indent))
-  (indent-rigidly start end count))
-
-(defun python-outline-level ()
-  "`outline-level' function for Python mode.
-The level is the number of `python-indent' steps of indentation
-of current line."
-  (1+ (/ (current-indentation) python-indent)))
-
-;; Fixme: Consider top-level assignments, imports, &c.
-(defun python-current-defun (&optional length-limit)
-  "`add-log-current-defun-function' for Python."
-  (save-excursion
-    ;; Move up the tree of nested `class' and `def' blocks until we
-    ;; get to zero indentation, accumulating the defined names.
-    (let ((accum)
-         (length -1))
-      (catch 'done
-       (while (or (null length-limit)
-                  (null (cdr accum))
-                  (< length length-limit))
-         (let ((started-from (point)))
-           (python-beginning-of-block)
-           (end-of-line)
-           (beginning-of-defun)
-           (when (= (point) started-from)
-             (throw 'done nil)))
-         (when (looking-at (rx (0+ space) (or "def" "class") (1+ space)
-                               (group (1+ (or word (syntax symbol))))))
-           (push (match-string 1) accum)
-           (setq length (+ length 1 (length (car accum)))))
-         (when (= (current-indentation) 0)
-           (throw 'done nil))))
-      (when accum
-       (when (and length-limit (> length length-limit))
-         (setcar accum ".."))
-       (mapconcat 'identity accum ".")))))
-
-(defun python-mark-block ()
-  "Mark the block around point.
-Uses `python-beginning-of-block', `python-end-of-block'."
-  (interactive)
-  (push-mark)
-  (python-beginning-of-block)
-  (push-mark (point) nil t)
-  (python-end-of-block)
-  (exchange-point-and-mark))
-
-;; Fixme:  Provide a find-function-like command to find source of a
-;; definition (separate from BicycleRepairMan).  Complicated by
-;; finding the right qualified name.
 \f
-;;;; Completion.
-
-;; http://lists.gnu.org/archive/html/bug-gnu-emacs/2008-01/msg00076.html
-(defvar python-imports "None"
-  "String of top-level import statements updated by `python-find-imports'.")
-(make-variable-buffer-local 'python-imports)
-
-;; Fixme: Should font-lock try to run this when it deals with an import?
-;; Maybe not a good idea if it gets run multiple times when the
-;; statement is being edited, and is more likely to end up with
-;; something syntactically incorrect.
-;; However, what we should do is to trundle up the block tree from point
-;; to extract imports that appear to be in scope, and add those.
-(defun python-find-imports ()
-  "Find top-level imports, updating `python-imports'."
+;;; Symbol completion
+
+(defun python-completion-complete-at-point ()
+  "Complete current symbol at point.
+For this to work the best as possible you should call
+`python-shell-send-buffer' from time to time so context in
+inferior python process is updated properly."
   (interactive)
-  (save-excursion
-      (let (lines)
-       (goto-char (point-min))
-       (while (re-search-forward "^import\\>\\|^from\\>" nil t)
-         (unless (syntax-ppss-context (syntax-ppss))
-           (let ((start (line-beginning-position)))
-             ;; Skip over continued lines.
-             (while (and (eq ?\\ (char-before (line-end-position)))
-                         (= 0 (forward-line 1)))
-               t)
-             (push (buffer-substring start (line-beginning-position 2))
-                   lines))))
-       (setq python-imports
-             (if lines
-                 (apply #'concat
-;; This is probably best left out since you're unlikely to need the
-;; doc for a function in the buffer and the import will lose if the
-;; Python sub-process' working directory isn't the same as the
-;; buffer's.
-;;                      (if buffer-file-name
-;;                          (concat
-;;                           "import "
-;;                           (file-name-sans-extension
-;;                            (file-name-nondirectory buffer-file-name))))
-                        (nreverse lines))
-               "None"))
-       (when lines
-         (set-text-properties 0 (length python-imports) nil python-imports)
-         ;; The output ends up in the wrong place if the string we
-         ;; send contains newlines (from the imports).
-         (setq python-imports
-               (replace-regexp-in-string "\n" "\\n"
-                                         (format "%S" python-imports) t t))))))
-
-;; Fixme: This fails the first time if the sub-process isn't already
-;; running.  Presumably a timing issue with i/o to the process.
-(defun python-symbol-completions (symbol)
-  "Return a list of completions of the string SYMBOL from Python process.
-The list is sorted.
-Uses `python-imports' to load modules against which to complete."
-  (when (stringp symbol)
-    (let ((completions
-          (condition-case ()
-              (car (read-from-string
-                    (python-send-receive
-                     (format "emacs.complete(%S,%s)"
-                             (substring-no-properties symbol)
-                             python-imports))))
-            (error nil))))
-      (sort
-       ;; We can get duplicates from the above -- don't know why.
-       (delete-dups completions)
-       #'string<))))
-
-(defun python-completion-at-point ()
-  (let ((end (point))
-       (start (save-excursion
-                (and (re-search-backward
-                      (rx (or buffer-start (regexp "[^[:alnum:]._]"))
-                          (group (1+ (regexp "[[:alnum:]._]"))) point)
-                      nil t)
-                     (match-beginning 1)))))
-    (when start
-      (list start end
-            (completion-table-dynamic 'python-symbol-completions)))))
-\f
-;;;; FFAP support
+  (let ((process (python-shell-get-process)))
+    (if (not process)
+        (error "Completion needs an inferior Python process running")
+      (python-shell-completion--do-completion-at-point process))))
 
-(defun python-module-path (module)
-  "Function for `ffap-alist' to return path to MODULE."
-  (python-send-receive (format "emacs.modpath (%S)" module)))
+(add-to-list 'debug-ignored-errors
+             "^Completion needs an inferior Python process running.")
 
-(eval-after-load "ffap"
-  '(push '(python-mode . python-module-path) ffap-alist))
 \f
-;;;; Find-function support
+;;; Fill paragraph
 
-;; Fixme: key binding?
+(defcustom python-fill-comment-function 'python-fill-comment
+  "Function to fill comments.
+This is the function used by `python-fill-paragraph-function' to
+fill comments."
+  :type 'symbol
+  :group 'python
+  :safe 'symbolp)
 
-(defun python-find-function (name)
-  "Find source of definition of function NAME.
-Interactively, prompt for name."
-  (interactive
-   (let ((symbol (with-syntax-table python-dotty-syntax-table
-                  (current-word)))
-        (enable-recursive-minibuffers t))
-     (list (read-string (if symbol
-                           (format "Find location of (default %s): " symbol)
-                         "Find location of: ")
-                       nil nil symbol))))
-  (unless python-imports
-    (error "Not called from buffer visiting Python file"))
-  (let* ((loc (python-send-receive (format "emacs.location_of (%S, %s)"
-                                          name python-imports)))
-        (loc (car (read-from-string loc)))
-        (file (car loc))
-        (line (cdr loc)))
-    (unless file (error "Don't know where `%s' is defined" name))
-    (pop-to-buffer (find-file-noselect file))
-    (when (integerp line)
+(defcustom python-fill-string-function 'python-fill-string
+  "Function to fill strings.
+This is the function used by `python-fill-paragraph-function' to
+fill strings."
+  :type 'symbol
+  :group 'python
+  :safe 'symbolp)
+
+(defcustom python-fill-decorator-function 'python-fill-decorator
+  "Function to fill decorators.
+This is the function used by `python-fill-paragraph-function' to
+fill decorators."
+  :type 'symbol
+  :group 'python
+  :safe 'symbolp)
+
+(defcustom python-fill-paren-function 'python-fill-paren
+  "Function to fill parens.
+This is the function used by `python-fill-paragraph-function' to
+fill parens."
+  :type 'symbol
+  :group 'python
+  :safe 'symbolp)
+
+(defun python-fill-paragraph-function (&optional justify)
+  "`fill-paragraph-function' handling multi-line strings and possibly comments.
+If any of the current line is in or at the end of a multi-line string,
+fill the string or the paragraph of it that point is in, preserving
+the string's indentation.
+Optional argument JUSTIFY defines if the paragraph should be justified."
+  (interactive "P")
+  (save-excursion
+    (back-to-indentation)
+    (cond
+     ;; Comments
+     ((funcall python-fill-comment-function justify))
+     ;; Strings/Docstrings
+     ((save-excursion (skip-chars-forward "\"'uUrR")
+                      (python-info-ppss-context 'string))
+      (funcall python-fill-string-function justify))
+     ;; Decorators
+     ((equal (char-after (save-excursion
+                           (back-to-indentation)
+                           (point-marker))) ?@)
+      (funcall python-fill-decorator-function justify))
+     ;; Parens
+     ((or (python-info-ppss-context 'paren)
+          (looking-at (python-rx open-paren))
+          (save-excursion
+            (skip-syntax-forward "^(" (line-end-position))
+            (looking-at (python-rx open-paren))))
+      (funcall python-fill-paren-function justify))
+     (t t))))
+
+(defun python-fill-comment (&optional justify)
+  "Comment fill function for `python-fill-paragraph-function'.
+JUSTIFY should be used (if applicable) as in `fill-paragraph'."
+  (fill-comment-paragraph justify))
+
+(defun python-fill-string (&optional justify)
+  "String fill function for `python-fill-paragraph-function'.
+JUSTIFY should be used (if applicable) as in `fill-paragraph'."
+  (let ((marker (point-marker))
+        (string-start-marker
+         (progn
+           (skip-chars-forward "\"'uUrR")
+           (goto-char (python-info-ppss-context 'string))
+           (skip-chars-forward "\"'uUrR")
+           (point-marker)))
+        (reg-start (line-beginning-position))
+        (string-end-marker
+         (progn
+           (while (python-info-ppss-context 'string)
+             (goto-char (1+ (point-marker))))
+           (skip-chars-backward "\"'")
+           (point-marker)))
+        (reg-end (line-end-position))
+        (fill-paragraph-function))
+    (save-restriction
+      (narrow-to-region reg-start reg-end)
+      (save-excursion
+        (goto-char string-start-marker)
+        (delete-region (point-marker) (progn
+                                        (skip-syntax-forward "> ")
+                                        (point-marker)))
+        (goto-char string-end-marker)
+        (delete-region (point-marker) (progn
+                                        (skip-syntax-backward "> ")
+                                        (point-marker)))
+        (save-excursion
+          (goto-char marker)
+          (fill-paragraph justify))
+        ;; If there is a newline in the docstring lets put triple
+        ;; quote in it's own line to follow pep 8
+        (when (save-excursion
+                (re-search-backward "\n" string-start-marker t))
+          (newline)
+          (newline-and-indent))
+        (fill-paragraph justify)))) t)
+
+(defun python-fill-decorator (&optional justify)
+  "Decorator fill function for `python-fill-paragraph-function'.
+JUSTIFY should be used (if applicable) as in `fill-paragraph'."
+  t)
+
+(defun python-fill-paren (&optional justify)
+  "Paren fill function for `python-fill-paragraph-function'.
+JUSTIFY should be used (if applicable) as in `fill-paragraph'."
+  (save-restriction
+    (narrow-to-region (progn
+                        (while (python-info-ppss-context 'paren)
+                          (goto-char (1- (point-marker))))
+                        (point-marker)
+                        (line-beginning-position))
+                      (progn
+                        (when (not (python-info-ppss-context 'paren))
+                          (end-of-line)
+                          (when (not (python-info-ppss-context 'paren))
+                            (skip-syntax-backward "^)")))
+                        (while (python-info-ppss-context 'paren)
+                          (goto-char (1+ (point-marker))))
+                        (point-marker)))
+    (let ((paragraph-start "\f\\|[ \t]*$")
+          (paragraph-separate ",")
+          (fill-paragraph-function))
       (goto-char (point-min))
-      (forward-line (1- line)))))
+      (fill-paragraph justify))
+    (while (not (eobp))
+      (forward-line 1)
+      (python-indent-line)
+      (goto-char (line-end-position)))) t)
+
 \f
-;;;; Skeletons
+;;; Skeletons
 
-(defcustom python-use-skeletons nil
+(defcustom python-skeleton-autoinsert nil
   "Non-nil means template skeletons will be automagically inserted.
 This happens when pressing \"if<SPACE>\", for example, to prompt for
 the if condition."
   :type 'boolean
-  :group 'python)
+  :group 'python
+  :safe 'booleanp)
+
+(define-obsolete-variable-alias
+  'python-use-skeletons 'python-skeleton-autoinsert "24.2")
+
+(defvar python-skeleton-available '()
+  "Internal list of available skeletons.")
 
 (define-abbrev-table 'python-mode-abbrev-table ()
   "Abbrev table for Python mode."
@@ -2225,507 +2239,652 @@ the if condition."
   ;; Allow / inside abbrevs.
   :regexp "\\(?:^\\|[^/]\\)\\<\\([[:word:]/]+\\)\\W*"
   ;; Only expand in code.
-  :enable-function (lambda () (not (python-in-string/comment))))
-
-(eval-when-compile
-  ;; Define a user-level skeleton and add it to the abbrev table.
-(defmacro def-python-skeleton (name &rest elements)
+  :enable-function (lambda ()
+                     (and
+                      (not (or (python-info-ppss-context 'string)
+                               (python-info-ppss-context 'comment)))
+                      python-skeleton-autoinsert)))
+
+(defmacro python-skeleton-define (name doc &rest skel)
+  "Define a `python-mode' skeleton using NAME DOC and SKEL.
+The skeleton will be bound to python-skeleton-NAME and will
+be added to `python-mode-abbrev-table'."
   (declare (indent 2))
   (let* ((name (symbol-name name))
-        (function (intern (concat "python-insert-" name))))
+         (function-name (intern (concat "python-skeleton-" name))))
     `(progn
-       ;; Usual technique for inserting a skeleton, but expand
-       ;; to the original abbrev instead if in a comment or string.
-       (when python-use-skeletons
-         (define-abbrev python-mode-abbrev-table ,name ""
-           ',function
-           nil t))                      ; system abbrev
-       (define-skeleton ,function
-        ,(format "Insert Python \"%s\" template." name)
-        ,@elements)))))
-
-;; From `skeleton-further-elements' set below:
-;;  `<': outdent a level;
-;;  `^': delete indentation on current line and also previous newline.
-;;       Not quite like `delete-indentation'.  Assumes point is at
-;;       beginning of indentation.
-
-(def-python-skeleton if
+       (define-abbrev python-mode-abbrev-table ,name "" ',function-name
+        :system t)
+       (setq python-skeleton-available
+             (cons ',function-name python-skeleton-available))
+       (define-skeleton ,function-name
+         ,(or doc
+              (format "Insert %s statement." name))
+         ,@skel))))
+
+(defmacro python-define-auxiliary-skeleton (name doc &optional &rest skel)
+  "Define a `python-mode' auxiliary skeleton using NAME DOC and SKEL.
+The skeleton will be bound to python-skeleton-NAME."
+  (declare (indent 2))
+  (let* ((name (symbol-name name))
+         (function-name (intern (concat "python-skeleton--" name)))
+         (msg (format
+               "Add '%s' clause? " name)))
+    (when (not skel)
+      (setq skel
+            `(< ,(format "%s:" name) \n \n
+                > _ \n)))
+    `(define-skeleton ,function-name
+       ,(or doc
+            (format "Auxiliary skeleton for %s statement." name))
+       nil
+       (unless (y-or-n-p ,msg)
+         (signal 'quit t))
+       ,@skel)))
+
+(python-define-auxiliary-skeleton else nil)
+
+(python-define-auxiliary-skeleton except nil)
+
+(python-define-auxiliary-skeleton finally nil)
+
+(python-skeleton-define if nil
   "Condition: "
   "if " str ":" \n
-  > -1    ; Fixme: I don't understand the spurious space this removes.
   _ \n
   ("other condition, %s: "
-   <                   ; Avoid wrong indentation after block opening.
+   <
    "elif " str ":" \n
    > _ \n nil)
-  '(python-else) | ^)
-
-(define-skeleton python-else
-  "Auxiliary skeleton."
-  nil
-  (unless (eq ?y (read-char "Add `else' clause? (y for yes or RET for no) "))
-    (signal 'quit t))
-  < "else:" \n
-  > _ \n)
+  '(python-skeleton--else) | ^)
 
-(def-python-skeleton while
+(python-skeleton-define while nil
   "Condition: "
   "while " str ":" \n
-  > -1 _ \n
-  '(python-else) | ^)
+  > _ \n
+  '(python-skeleton--else) | ^)
 
-(def-python-skeleton for
-  "Target, %s: "
-  "for " str " in " (skeleton-read "Expression, %s: ") ":" \n
-  > -1 _ \n
-  '(python-else) | ^)
+(python-skeleton-define for nil
+  "Iteration spec: "
+  "for " str ":" \n
+  > _ \n
+  '(python-skeleton--else) | ^)
 
-(def-python-skeleton try/except
+(python-skeleton-define try nil
   nil
   "try:" \n
-  > -1 _ \n
+  > _ \n
   ("Exception, %s: "
-   < "except " str '(python-target) ":" \n
+   <
+   "except " str ":" \n
    > _ \n nil)
-  < "except:" \n
-  > _ \n
-  '(python-else) | ^)
-
-(define-skeleton python-target
-  "Auxiliary skeleton."
-  "Target, %s: " ", " str | -2)
-
-(def-python-skeleton try/finally
-  nil
-  "try:" \n
-  > -1 _ \n
-  < "finally:" \n
-  > _ \n)
-
-(def-python-skeleton def
-  "Name: "
-  "def " str " (" ("Parameter, %s: " (unless (equal ?\( (char-before)) ", ")
-                    str) "):" \n
-  "\"\"\"" - "\"\"\"" \n     ; Fixme:  extra space inserted -- why?).
-  > _ \n)
-
-(def-python-skeleton class
-  "Name: "
+  resume:
+  '(python-skeleton--except)
+  '(python-skeleton--else)
+  '(python-skeleton--finally) | ^)
+
+(python-skeleton-define def nil
+  "Function name: "
+  "def " str " ("  ("Parameter, %s: "
+                    (unless (equal ?\( (char-before)) ", ")
+                    str) "):" \n
+                    "\"\"\"" - "\"\"\"" \n
+                    > _ \n)
+
+(python-skeleton-define class nil
+  "Class name: "
   "class " str " (" ("Inheritance, %s: "
-                    (unless (equal ?\( (char-before)) ", ")
-                    str)
-  & ")" | -2                           ; close list or remove opening
+                     (unless (equal ?\( (char-before)) ", ")
+                     str)
+  & ")" | -2
   ":" \n
   "\"\"\"" - "\"\"\"" \n
   > _ \n)
 
-(defvar python-default-template "if"
-  "Default template to expand by `python-expand-template'.
-Updated on each expansion.")
+(defun python-skeleton-add-menu-items ()
+  "Add menu items to Python->Skeletons menu."
+  (let ((skeletons (sort python-skeleton-available 'string<))
+        (items))
+    (dolist (skeleton skeletons)
+      (easy-menu-add-item
+       nil '("Python" "Skeletons")
+       `[,(format
+           "Insert %s" (caddr (split-string (symbol-name skeleton) "-")))
+         ,skeleton t]))))
+\f
+;;; FFAP
+
+(defcustom python-ffap-setup-code
+  "def __FFAP_get_module_path(module):
+    try:
+        import os
+        path = __import__(module).__file__
+        if path[-4:] == '.pyc' and os.path.exists(path[0:-1]):
+            path = path[:-1]
+        return path
+    except:
+        return ''"
+  "Python code to get a module path."
+  :type 'string
+  :group 'python)
+
+(defcustom python-ffap-string-code
+  "__FFAP_get_module_path('''%s''')\n"
+  "Python code used to get a string with the path of a module."
+  :type 'string
+  :group 'python)
+
+(defun python-ffap-module-path (module)
+  "Function for `ffap-alist' to return path for MODULE."
+  (let ((process (or
+                  (and (eq major-mode 'inferior-python-mode)
+                       (get-buffer-process (current-buffer)))
+                  (python-shell-get-process))))
+    (if (not process)
+        nil
+      (let ((module-file
+             (python-shell-send-string-no-output
+              (format python-ffap-string-code module) process)))
+        (when module-file
+          (substring-no-properties module-file 1 -1))))))
+
+(eval-after-load "ffap"
+  '(progn
+     (push '(python-mode . python-ffap-module-path) ffap-alist)
+     (push '(inferior-python-mode . python-ffap-module-path) ffap-alist)))
 
-(defun python-expand-template (name)
-  "Expand template named NAME.
-Interactively, prompt for the name with completion."
-  (interactive
-   (list (completing-read (format "Template to expand (default %s): "
-                                 python-default-template)
-                         python-mode-abbrev-table nil t nil nil
-                          python-default-template)))
-  (if (equal "" name)
-      (setq name python-default-template)
-    (setq python-default-template name))
-  (let ((sym (abbrev-symbol name python-mode-abbrev-table)))
-    (if sym
-        (abbrev-insert sym)
-      (error "Undefined template: %s" name))))
 \f
-;;;; Bicycle Repair Man support
-
-(autoload 'pymacs-load "pymacs" nil t)
-(autoload 'brm-init "bikeemacs")
-(defvar brm-menu)
-
-;; I'm not sure how useful BRM really is, and it's certainly dangerous
-;; the way it modifies files outside Emacs...  Also note that the
-;; current BRM loses with tabs used for indentation -- I submitted a
-;; fix <URL:http://www.loveshack.ukfsn.org/emacs/bikeemacs.py.diff>.
-(defun python-setup-brm ()
-  "Set up Bicycle Repair Man refactoring tool (if available).
-
-Note that the `refactoring' features change files independently of
-Emacs and may modify and save the contents of the current buffer
-without confirmation."
-  (interactive)
-  (condition-case data
-      (unless (fboundp 'brm-rename)
-       (pymacs-load "bikeemacs" "brm-") ; first line of normal recipe
-       (let ((py-mode-map (make-sparse-keymap)) ; it assumes this
-             (features (cons 'python-mode features))) ; and requires this
-         (brm-init)                    ; second line of normal recipe
-         (remove-hook 'python-mode-hook ; undo this from `brm-init'
-                      (lambda () (easy-menu-add brm-menu)))
-         (easy-menu-define
-           python-brm-menu python-mode-map
-           "Bicycle Repair Man"
-           '("BicycleRepairMan"
-             :help "Interface to navigation and refactoring tool"
-             "Queries"
-             ["Find References" brm-find-references
-              :help "Find references to name at point in compilation buffer"]
-             ["Find Definition" brm-find-definition
-              :help "Find definition of name at point"]
-             "-"
-             "Refactoring"
-             ["Rename" brm-rename
-              :help "Replace name at point with a new name everywhere"]
-             ["Extract Method" brm-extract-method
-              :active (and mark-active (not buffer-read-only))
-              :help "Replace statements in region with a method"]
-             ["Extract Local Variable" brm-extract-local-variable
-              :active (and mark-active (not buffer-read-only))
-              :help "Replace expression in region with an assignment"]
-             ["Inline Local Variable" brm-inline-local-variable
-              :help
-              "Substitute uses of variable at point with its definition"]
-             ;; Fixme:  Should check for anything to revert.
-             ["Undo Last Refactoring" brm-undo :help ""]))))
-    (error (error "BicycleRepairMan setup failed: %s" data))))
+;;; Code check
+
+(defcustom python-check-command
+  "pyflakes"
+  "Command used to check a Python file."
+  :type 'string
+  :group 'python)
+
+(defcustom python-check-buffer-name
+  "*Python check: %s*"
+  "Buffer name used for check commands."
+  :type 'string
+  :group 'python)
+
+(defvar python-check-custom-command nil
+  "Internal use.")
+
+(defun python-check (command)
+  "Check a Python file (default current buffer's file).
+Runs COMMAND, a shell command, as if by `compile'.  See
+`python-check-command' for the default."
+  (interactive
+   (list (read-string "Check command: "
+                      (or python-check-custom-command
+                          (concat python-check-command " "
+                                  (shell-quote-argument
+                                   (or
+                                    (let ((name (buffer-file-name)))
+                                      (and name
+                                           (file-name-nondirectory name)))
+                                    "")))))))
+  (setq python-check-custom-command command)
+  (save-some-buffers (not compilation-ask-about-save) nil)
+  (let ((process-environment (python-shell-calculate-process-environment))
+        (exec-path (python-shell-calculate-exec-path)))
+    (compilation-start command nil
+                       (lambda (mode-name)
+                         (format python-check-buffer-name command)))))
+
 \f
-;;;; Modes.
+;;; Eldoc
+
+(defcustom python-eldoc-setup-code
+  "def __PYDOC_get_help(obj):
+    try:
+        import inspect
+        if hasattr(obj, 'startswith'):
+            obj = eval(obj, globals())
+        doc = inspect.getdoc(obj)
+        if not doc and callable(obj):
+            target = None
+            if inspect.isclass(obj) and hasattr(obj, '__init__'):
+                target = obj.__init__
+                objtype = 'class'
+            else:
+                target = obj
+                objtype = 'def'
+            if target:
+                args = inspect.formatargspec(
+                    *inspect.getargspec(target)
+                )
+                name = obj.__name__
+                doc = '{objtype} {name}{args}'.format(
+                    objtype=objtype, name=name, args=args
+                )
+        else:
+            doc = doc.splitlines()[0]
+    except:
+        doc = ''
+    try:
+        exec('print doc')
+    except SyntaxError:
+        print(doc)"
+  "Python code to setup documentation retrieval."
+  :type 'string
+  :group 'python)
+
+(defcustom python-eldoc-string-code
+  "__PYDOC_get_help('''%s''')\n"
+  "Python code used to get a string with the documentation of an object."
+  :type 'string
+  :group 'python)
+
+(defun python-eldoc--get-doc-at-point (&optional force-input force-process)
+  "Internal implementation to get documentation at point.
+If not FORCE-INPUT is passed then what `current-word' returns
+will be used.  If not FORCE-PROCESS is passed what
+`python-shell-get-process' returns is used."
+  (let ((process (or force-process (python-shell-get-process))))
+    (if (not process)
+        "Eldoc needs an inferior Python process running."
+      (let* ((current-defun (python-info-current-defun))
+             (input (or force-input
+                        (with-syntax-table python-dotty-syntax-table
+                          (if (not current-defun)
+                              (current-word)
+                            (concat current-defun "." (current-word))))))
+             (ppss (syntax-ppss))
+             (help (when (and
+                          input
+                          (not (string= input (concat current-defun ".")))
+                          (not (or (python-info-ppss-context 'string ppss)
+                                   (python-info-ppss-context 'comment ppss))))
+                     (when (string-match
+                            (concat
+                             (regexp-quote (concat current-defun "."))
+                             "self\\.") input)
+                       (with-temp-buffer
+                         (insert input)
+                         (goto-char (point-min))
+                         (forward-word)
+                         (forward-char)
+                         (delete-region
+                          (point-marker) (search-forward "self."))
+                         (setq input (buffer-substring
+                                      (point-min) (point-max)))))
+                     (python-shell-send-string-no-output
+                      (format python-eldoc-string-code input) process))))
+        (with-current-buffer (process-buffer process)
+          (when comint-last-prompt-overlay
+            (delete-region comint-last-input-end
+                           (overlay-start comint-last-prompt-overlay))))
+        (when (and help
+                   (not (string= help "\n")))
+          help)))))
+
+(defun python-eldoc-function ()
+  "`eldoc-documentation-function' for Python.
+For this to work the best as possible you should call
+`python-shell-send-buffer' from time to time so context in
+inferior python process is updated properly."
+  (python-eldoc--get-doc-at-point))
+
+(defun python-eldoc-at-point (symbol)
+  "Get help on SYMBOL using `help'.
+Interactively, prompt for symbol."
+  (interactive
+   (let ((symbol (with-syntax-table python-dotty-syntax-table
+                   (current-word)))
+         (enable-recursive-minibuffers t))
+     (list (read-string (if symbol
+                            (format "Describe symbol (default %s): " symbol)
+                          "Describe symbol: ")
+                        nil nil symbol))))
+  (let ((process (python-shell-get-process)))
+    (if (not process)
+        (message "Eldoc needs an inferior Python process running.")
+      (message (python-eldoc--get-doc-at-point symbol process)))))
 
-;; pdb tracking is alert once this file is loaded, but takes no action if
-;; `python-pdbtrack-do-tracking-p' is nil.
-(add-hook 'comint-output-filter-functions 'python-pdbtrack-track-stack-file)
+\f
+;;; Misc helpers
+
+(defun python-info-current-defun (&optional include-type)
+  "Return name of surrounding function with Python compatible dotty syntax.
+Optional argument INCLUDE-TYPE indicates to include the type of the defun.
+This function is compatible to be used as
+`add-log-current-defun-function' since it returns nil if point is
+not inside a defun."
+  (let ((names '())
+        (min-indent)
+        (first-run t))
+    (save-restriction
+      (widen)
+      (save-excursion
+        (end-of-line 1)
+        (setq min-indent (current-indentation))
+        (while (python-beginning-of-defun-function 1)
+          (when (or (< (current-indentation) min-indent)
+                    first-run)
+            (setq first-run nil)
+            (setq min-indent (current-indentation))
+            (looking-at python-nav-beginning-of-defun-regexp)
+            (setq names (cons
+                         (if (not include-type)
+                             (match-string-no-properties 1)
+                           (mapconcat 'identity
+                                      (split-string
+                                       (match-string-no-properties 0)) " "))
+                         names))))))
+    (when names
+      (mapconcat (lambda (string) string) names "."))))
+
+(defun python-info-closing-block ()
+  "Return the point of the block the current line closes."
+  (let ((closing-word (save-excursion
+                        (back-to-indentation)
+                        (current-word)))
+        (indentation (current-indentation)))
+    (when (member closing-word python-indent-dedenters)
+      (save-excursion
+        (forward-line -1)
+        (while (and (> (current-indentation) indentation)
+                    (not (bobp))
+                    (not (back-to-indentation))
+                    (forward-line -1)))
+        (back-to-indentation)
+        (cond
+         ((not (equal indentation (current-indentation))) nil)
+         ((string= closing-word "elif")
+          (when (member (current-word) '("if" "elif"))
+            (point-marker)))
+         ((string= closing-word "else")
+          (when (member (current-word) '("if" "elif" "except" "for" "while"))
+            (point-marker)))
+         ((string= closing-word "except")
+          (when (member (current-word) '("try"))
+            (point-marker)))
+         ((string= closing-word "finally")
+          (when (member (current-word) '("except" "else"))
+            (point-marker))))))))
+
+(defun python-info-closing-block-message (&optional closing-block-point)
+  "Message the contents of the block the current line closes.
+With optional argument CLOSING-BLOCK-POINT use that instead of
+recalculating it calling `python-info-closing-block'."
+  (let ((point (or closing-block-point (python-info-closing-block))))
+    (when point
+      (save-restriction
+        (widen)
+        (message "Closes %s" (save-excursion
+                               (goto-char point)
+                               (back-to-indentation)
+                               (buffer-substring
+                                (point) (line-end-position))))))))
+
+(defun python-info-line-ends-backslash-p (&optional line-number)
+  "Return non-nil if current line ends with backslash.
+With optional argument LINE-NUMBER, check that line instead."
+  (save-excursion
+    (save-restriction
+      (widen)
+      (when line-number
+        (goto-char line-number))
+      (while (and (not (eobp))
+                  (goto-char (line-end-position))
+                  (python-info-ppss-context 'paren)
+                  (not (equal (char-before (point)) ?\\)))
+        (forward-line 1))
+      (when (equal (char-before) ?\\)
+        (point-marker)))))
+
+(defun python-info-beginning-of-backslash (&optional line-number)
+  "Return the point where the backslashed line start.
+Optional argument LINE-NUMBER forces the line number to check against."
+  (save-excursion
+    (save-restriction
+      (widen)
+      (when line-number
+        (goto-char line-number))
+      (when (python-info-line-ends-backslash-p)
+        (while (save-excursion
+                 (goto-char (line-beginning-position))
+                 (python-info-ppss-context 'paren))
+          (forward-line -1))
+        (back-to-indentation)
+        (point-marker)))))
+
+(defun python-info-continuation-line-p ()
+  "Check if current line is continuation of another.
+When current line is continuation of another return the point
+where the continued line ends."
+  (save-excursion
+    (save-restriction
+      (widen)
+      (let* ((context-type (progn
+                             (back-to-indentation)
+                             (python-info-ppss-context-type)))
+             (line-start (line-number-at-pos))
+             (context-start (when context-type
+                              (python-info-ppss-context context-type))))
+        (cond ((equal context-type 'paren)
+               ;; Lines inside a paren are always a continuation line
+               ;; (except the first one).
+               (when (equal (python-info-ppss-context-type) 'paren)
+                 (python-util-forward-comment -1)
+                 (python-util-forward-comment -1)
+                 (point-marker)))
+              ((or (equal context-type 'comment)
+                   (equal context-type 'string))
+               ;; move forward an roll again
+               (goto-char context-start)
+               (python-util-forward-comment)
+               (python-info-continuation-line-p))
+              (t
+               ;; Not within a paren, string or comment, the only way we are
+               ;; dealing with a continuation line is that previous line
+               ;; contains a backslash, and this can only be the previous line
+               ;; from current
+               (back-to-indentation)
+               (python-util-forward-comment -1)
+               (python-util-forward-comment -1)
+               (when (and (equal (1- line-start) (line-number-at-pos))
+                          (python-info-line-ends-backslash-p))
+                 (point-marker))))))))
+
+(defun python-info-block-continuation-line-p ()
+  "Return non-nil if current line is a continuation of a block."
+  (save-excursion
+    (when (python-info-continuation-line-p)
+      (forward-line -1)
+      (back-to-indentation)
+      (when (looking-at (python-rx block-start))
+        (point-marker)))))
+
+(defun python-info-assignment-continuation-line-p ()
+  "Check if current line is a continuation of an assignment.
+When current line is continuation of another with an assignment
+return the point of the first non-blank character after the
+operator."
+  (save-excursion
+    (when (python-info-continuation-line-p)
+      (forward-line -1)
+      (back-to-indentation)
+      (when (and (not (looking-at (python-rx block-start)))
+                 (and (re-search-forward (python-rx not-simple-operator
+                                                    assignment-operator
+                                                    not-simple-operator)
+                                         (line-end-position) t)
+                      (not (or (python-info-ppss-context 'string)
+                               (python-info-ppss-context 'paren)
+                               (python-info-ppss-context 'comment)))))
+        (skip-syntax-forward "\s")
+        (point-marker)))))
+
+(defun python-info-ppss-context (type &optional syntax-ppss)
+  "Return non-nil if point is on TYPE using SYNTAX-PPSS.
+TYPE can be 'comment, 'string or 'paren.  It returns the start
+character address of the specified TYPE."
+  (let ((ppss (or syntax-ppss (syntax-ppss))))
+    (case type
+      ('comment
+       (and (nth 4 ppss)
+            (nth 8 ppss)))
+      ('string
+       (nth 8 ppss))
+      ('paren
+       (nth 1 ppss))
+      (t nil))))
+
+(defun python-info-ppss-context-type (&optional syntax-ppss)
+  "Return the context type using SYNTAX-PPSS.
+The type returned can be 'comment, 'string or 'paren."
+  (let ((ppss (or syntax-ppss (syntax-ppss))))
+    (cond
+     ((and (nth 4 ppss)
+           (nth 8 ppss))
+      'comment)
+     ((nth 8 ppss)
+      'string)
+     ((nth 1 ppss)
+      'paren)
+     (t nil))))
+
+(defun python-info-looking-at-beginning-of-defun (&optional syntax-ppss)
+  "Check if point is at `beginning-of-defun' using SYNTAX-PPSS."
+  (and (not (python-info-ppss-context-type (or syntax-ppss (syntax-ppss))))
+       (save-excursion
+         (beginning-of-line 1)
+         (looking-at python-nav-beginning-of-defun-regexp))))
+
+(defun python-info-current-line-comment-p ()
+  "Check if current line is a comment line."
+  (char-equal (or (char-after (+ (point) (current-indentation))) ?_) ?#))
+
+(defun python-info-current-line-empty-p ()
+  "Check if current line is empty, ignoring whitespace."
+  (save-excursion
+    (beginning-of-line 1)
+    (looking-at
+     (python-rx line-start (* whitespace)
+                (group (* not-newline))
+                (* whitespace) line-end))
+    (string-equal "" (match-string-no-properties 1))))
 
-(defvar outline-heading-end-regexp)
-(defvar eldoc-documentation-function)
-(defvar python-mode-running)            ;Dynamically scoped var.
+\f
+;;; Utility functions
+
+(defun python-util-position (item seq)
+  "Find the first occurrence of ITEM in SEQ.
+Return the index of the matching item, or nil if not found."
+  (let ((member-result (member item seq)))
+    (when member-result
+      (- (length seq) (length member-result)))))
+
+;; Stolen from org-mode
+(defun python-util-clone-local-variables (from-buffer &optional regexp)
+  "Clone local variables from FROM-BUFFER.
+Optional argument REGEXP selects variables to clone and defaults
+to \"^python-\"."
+  (mapc
+   (lambda (pair)
+     (and (symbolp (car pair))
+          (string-match (or regexp "^python-")
+                        (symbol-name (car pair)))
+          (set (make-local-variable (car pair))
+               (cdr pair))))
+   (buffer-local-variables from-buffer)))
+
+(defun python-util-forward-comment (&optional direction)
+  "Python mode specific version of `forward-comment'.
+Optional argument DIRECTION defines the direction to move to."
+  (let ((comment-start (python-info-ppss-context 'comment))
+        (factor (if (< (or direction 0) 0)
+                    -99999
+                  99999)))
+    (when comment-start
+      (goto-char comment-start))
+    (forward-comment factor)))
 
+\f
 ;;;###autoload
 (define-derived-mode python-mode prog-mode "Python"
   "Major mode for editing Python files.
-Turns on Font Lock mode unconditionally since it is currently required
-for correct parsing of the source.
-See also `jython-mode', which is actually invoked if the buffer appears to
-contain Jython code.  See also `run-python' and associated Python mode
-commands for running Python under Emacs.
-
-The Emacs commands which work with `defun's, e.g. \\[beginning-of-defun], deal
-with nested `def' and `class' blocks.  They take the innermost one as
-current without distinguishing method and class definitions.  Used multiple
-times, they move over others at the same indentation level until they reach
-the end of definitions at that level, when they move up a level.
-\\<python-mode-map>
-Colon is electric: it outdents the line if appropriate, e.g. for
-an else statement.  \\[python-backspace] at the beginning of an indented statement
-deletes a level of indentation to close the current block; otherwise it
-deletes a character backward.  TAB indents the current line relative to
-the preceding code.  Successive TABs, with no intervening command, cycle
-through the possibilities for indentation on the basis of enclosing blocks.
-
-\\[fill-paragraph] fills comments and multi-line strings appropriately, but has no
-effect outside them.
-
-Supports Eldoc mode (only for functions, using a Python process),
-Info-Look and Imenu.  In Outline minor mode, `class' and `def'
-lines count as headers.  Symbol completion is available in the
-same way as in the Python shell using the `rlcompleter' module
-and this is added to the Hippie Expand functions locally if
-Hippie Expand mode is turned on.  Completion of symbols of the
-form x.y only works if the components are literal
-module/attribute names, not variables.  An abbrev table is set up
-with skeleton expansions for compound statement templates.
-
-\\{python-mode-map}"
-  :group 'python
+
+\\{python-mode-map}
+Entry to this mode calls the value of `python-mode-hook'
+if that value is non-nil."
+  (set (make-local-variable 'tab-width) 8)
+  (set (make-local-variable 'indent-tabs-mode) nil)
+
+  (set (make-local-variable 'comment-start) "# ")
+  (set (make-local-variable 'comment-start-skip) "#+\\s-*")
+
+  (set (make-local-variable 'parse-sexp-lookup-properties) t)
+  (set (make-local-variable 'parse-sexp-ignore-comments) t)
+
+  (set (make-local-variable 'forward-sexp-function)
+       'python-nav-forward-sexp-function)
+
   (set (make-local-variable 'font-lock-defaults)
-       '(python-font-lock-keywords nil nil nil nil
-         ;; This probably isn't worth it.
-         ;; (font-lock-syntactic-face-function
-         ;;  . python-font-lock-syntactic-face-function)
-         ))
+       '(python-font-lock-keywords nil nil nil nil))
+
   (set (make-local-variable 'syntax-propertize-function)
        python-syntax-propertize-function)
-  (set (make-local-variable 'parse-sexp-lookup-properties) t)
-  (set (make-local-variable 'parse-sexp-ignore-comments) t)
-  (set (make-local-variable 'comment-start) "# ")
-  (set (make-local-variable 'indent-line-function) #'python-indent-line)
+
+  (set (make-local-variable 'indent-line-function)
+       #'python-indent-line-function)
   (set (make-local-variable 'indent-region-function) #'python-indent-region)
+
   (set (make-local-variable 'paragraph-start) "\\s-*$")
-  (set (make-local-variable 'fill-paragraph-function) 'python-fill-paragraph)
-  (set (make-local-variable 'require-final-newline) mode-require-final-newline)
-  (set (make-local-variable 'add-log-current-defun-function)
-       #'python-current-defun)
-  (set (make-local-variable 'outline-regexp)
-       (rx (* space) (or "class" "def" "elif" "else" "except" "finally"
-                        "for" "if" "try" "while" "with")
-          symbol-end))
-  (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n")
-  (set (make-local-variable 'outline-level) #'python-outline-level)
-  (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil)
+  (set (make-local-variable 'fill-paragraph-function)
+       'python-fill-paragraph-function)
+
   (set (make-local-variable 'beginning-of-defun-function)
-       'python-beginning-of-defun)
-  (set (make-local-variable 'end-of-defun-function) 'python-end-of-defun)
-  (add-hook 'which-func-functions 'python-which-func nil t)
-  (setq imenu-create-index-function #'python-imenu-create-index)
-  (set (make-local-variable 'eldoc-documentation-function)
-       #'python-eldoc-function)
-  (add-hook 'eldoc-mode-hook
-           (lambda () (run-python nil t)) ; need it running
-           nil t)
+       #'python-beginning-of-defun-function)
+  (set (make-local-variable 'end-of-defun-function)
+       #'python-end-of-defun-function)
+
   (add-hook 'completion-at-point-functions
-            'python-completion-at-point nil 'local)
-  ;; Fixme: should be in hideshow.  This seems to be of limited use
-  ;; since it isn't (can't be) indentation-based.  Also hide-level
-  ;; doesn't seem to work properly.
-  (add-to-list 'hs-special-modes-alist
-              `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
-                ,(lambda (_arg)
-                   (python-end-of-defun)
-                   (skip-chars-backward " \t\n"))
-                nil))
+            'python-completion-complete-at-point nil 'local)
+
+  (add-hook 'post-self-insert-hook
+            'python-indent-post-self-insert-function nil 'local)
+
+  (set (make-local-variable 'imenu-extract-index-name-function)
+       #'python-info-current-defun)
+
+  (set (make-local-variable 'add-log-current-defun-function)
+       #'python-info-current-defun)
+
+  (add-hook 'which-func-functions #'python-info-current-defun nil t)
+
   (set (make-local-variable 'skeleton-further-elements)
-       '((< '(backward-delete-char-untabify (min python-indent
-                                                (current-column))))
-        (^ '(- (1+ (current-indentation))))))
-  ;; Python defines TABs as being 8-char wide.
-  (set (make-local-variable 'tab-width) 8)
-  (when python-guess-indent (python-guess-indent))
-  ;; Let's make it harder for the user to shoot himself in the foot.
-  (unless (= tab-width python-indent)
-    (setq indent-tabs-mode nil))
-  (set (make-local-variable 'python-command) python-python-command)
-  (python-find-imports)
-  (unless (boundp 'python-mode-running)        ; kill the recursion from jython-mode
-    (let ((python-mode-running t))
-      (python-maybe-jython))))
-
-;; Not done automatically in Emacs 21 or 22.
-(defcustom python-mode-hook nil
-  "Hook run when entering Python mode."
-  :group 'python
-  :type 'hook)
-(custom-add-option 'python-mode-hook 'imenu-add-menubar-index)
-(custom-add-option 'python-mode-hook
-                  (lambda ()
-                    "Turn off Indent Tabs mode."
-                    (setq indent-tabs-mode nil)))
-(custom-add-option 'python-mode-hook 'turn-on-eldoc-mode)
-(custom-add-option 'python-mode-hook 'abbrev-mode)
-(custom-add-option 'python-mode-hook 'python-setup-brm)
+       '((abbrev-mode nil)
+         (< '(backward-delete-char-untabify (min python-indent-offset
+                                                 (current-column))))
+         (^ '(- (1+ (current-indentation))))))
 
-;;;###autoload
-(define-derived-mode jython-mode python-mode  "Jython"
-  "Major mode for editing Jython files.
-Like `python-mode', but sets up parameters for Jython subprocesses.
-Runs `jython-mode-hook' after `python-mode-hook'."
-  :group 'python
-  (set (make-local-variable 'python-command) python-jython-command))
+  (set (make-local-variable 'eldoc-documentation-function)
+       #'python-eldoc-function)
 
-\f
+  (add-to-list 'hs-special-modes-alist
+               `(python-mode "^\\s-*\\(?:def\\|class\\)\\>" nil "#"
+                             ,(lambda (arg)
+                                (python-end-of-defun-function)) nil))
 
-;; pdbtrack features
-
-(defun python-pdbtrack-overlay-arrow (activation)
-  "Activate or deactivate arrow at beginning-of-line in current buffer."
-  (if activation
-      (progn
-        (setq overlay-arrow-position (make-marker)
-              overlay-arrow-string "=>"
-              python-pdbtrack-is-tracking-p t)
-        (set-marker overlay-arrow-position
-                    (line-beginning-position)
-                    (current-buffer)))
-    (setq overlay-arrow-position nil
-          python-pdbtrack-is-tracking-p nil)))
-
-(defun python-pdbtrack-track-stack-file (_text)
-  "Show the file indicated by the pdb stack entry line, in a separate window.
-
-Activity is disabled if the buffer-local variable
-`python-pdbtrack-do-tracking-p' is nil.
-
-We depend on the pdb input prompt being a match for
-`python-pdbtrack-input-prompt'.
-
-If the traceback target file path is invalid, we look for the
-most recently visited python-mode buffer which either has the
-name of the current function or class, or which defines the
-function or class.  This is to provide for scripts not in the
-local file system (e.g., Zope's 'Script \(Python)', but it's not
-Zope specific).  If you put a copy of the script in a buffer
-named for the script and activate python-mode, then pdbtrack will
-find it."
-  ;; Instead of trying to piece things together from partial text
-  ;; (which can be almost useless depending on Emacs version), we
-  ;; monitor to the point where we have the next pdb prompt, and then
-  ;; check all text from comint-last-input-end to process-mark.
-  ;;
-  ;; Also, we're very conservative about clearing the overlay arrow,
-  ;; to minimize residue.  This means, for instance, that executing
-  ;; other pdb commands wipe out the highlight.  You can always do a
-  ;; 'where' (aka 'w') PDB command to reveal the overlay arrow.
-
-  (let* ((origbuf (current-buffer))
-        (currproc (get-buffer-process origbuf)))
-
-    (if (not (and currproc python-pdbtrack-do-tracking-p))
-        (python-pdbtrack-overlay-arrow nil)
-
-      (let* ((procmark (process-mark currproc))
-             (block (buffer-substring (max comint-last-input-end
-                                           (- procmark
-                                              python-pdbtrack-track-range))
-                                      procmark))
-             target target_fname target_lineno target_buffer)
-
-        (if (not (string-match (concat python-pdbtrack-input-prompt "$") block))
-            (python-pdbtrack-overlay-arrow nil)
-
-          (setq block (ansi-color-filter-apply block))
-          (setq target (python-pdbtrack-get-source-buffer block))
-
-          (if (stringp target)
-              (progn
-                (python-pdbtrack-overlay-arrow nil)
-                (message "pdbtrack: %s" target))
-
-            (setq target_lineno (car target)
-                  target_buffer (cadr target)
-                  target_fname (buffer-file-name target_buffer))
-            (switch-to-buffer-other-window target_buffer)
-            (goto-char (point-min))
-            (forward-line (1- target_lineno))
-            (message "pdbtrack: line %s, file %s" target_lineno target_fname)
-            (python-pdbtrack-overlay-arrow t)
-            (pop-to-buffer origbuf t)
-            ;; in large shell buffers, above stuff may cause point to lag output
-            (goto-char procmark)
-            )))))
-  )
-
-(defun python-pdbtrack-get-source-buffer (block)
-  "Return line number and buffer of code indicated by block's traceback text.
-
-We look first to visit the file indicated in the trace.
-
-Failing that, we look for the most recently visited python-mode buffer
-with the same name or having the named function.
-
-If we're unable find the source code we return a string describing the
-problem."
-
-  (if (not (string-match python-pdbtrack-stack-entry-regexp block))
-
-      "Traceback cue not found"
-
-    (let* ((filename (match-string 1 block))
-           (lineno (string-to-number (match-string 2 block)))
-           (funcname (match-string 3 block))
-           funcbuffer)
-
-      (cond ((file-exists-p filename)
-             (list lineno (find-file-noselect filename)))
-
-            ((setq funcbuffer (python-pdbtrack-grub-for-buffer funcname lineno))
-             (if (string-match "/Script (Python)$" filename)
-                 ;; Add in number of lines for leading '##' comments:
-                 (setq lineno
-                       (+ lineno
-                          (with-current-buffer funcbuffer
-                            (if (equal (point-min)(point-max))
-                                0
-                              (count-lines
-                               (point-min)
-                               (max (point-min)
-                                    (string-match "^\\([^#]\\|#[^#]\\|#$\\)"
-                                                  (buffer-substring
-                                                   (point-min) (point-max)))
-                                    )))))))
-               (list lineno funcbuffer))
-
-            ((= (elt filename 0) ?\<)
-             (format "(Non-file source: '%s')" filename))
-
-            (t (format "Not found: %s(), %s" funcname filename)))
-      )
-    )
-  )
-
-(defun python-pdbtrack-grub-for-buffer (funcname _lineno)
-  "Find recent Python mode buffer named, or having function named FUNCNAME."
-  (let ((buffers (buffer-list))
-        buf
-        got)
-    (while (and buffers (not got))
-      (setq buf (car buffers)
-            buffers (cdr buffers))
-      (if (and (with-current-buffer buf
-                 (string= major-mode "python-mode"))
-               (or (string-match funcname (buffer-name buf))
-                   (string-match (concat "^\\s-*\\(def\\|class\\)\\s-+"
-                                         funcname "\\s-*(")
-                                 (with-current-buffer buf
-                                   (buffer-substring (point-min)
-                                                     (point-max))))))
-          (setq got buf)))
-    got))
-
-;; Python subprocess utilities and filters
-(defun python-execute-file (proc filename)
-  "Send to Python interpreter process PROC \"execfile('FILENAME')\".
-Make that process's buffer visible and force display.  Also make
-comint believe the user typed this string so that
-`kill-output-from-shell' does The Right Thing."
-  (let ((curbuf (current-buffer))
-       (procbuf (process-buffer proc))
-;      (comint-scroll-to-bottom-on-output t)
-       (msg (format "## working on region in file %s...\n" filename))
-        ;; add some comment, so that we can filter it out of history
-       (cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename)))
-    (unwind-protect
-       (with-current-buffer procbuf
-         (goto-char (point-max))
-         (move-marker (process-mark proc) (point))
-         (funcall (process-filter proc) proc msg))
-      (set-buffer curbuf))
-    (process-send-string proc cmd)))
-
-(defun python-pdbtrack-toggle-stack-tracking (arg)
-  (interactive "P")
-  (if (not (get-buffer-process (current-buffer)))
-      (error "No process associated with buffer '%s'" (current-buffer)))
-  ;; missing or 0 is toggle, >0 turn on, <0 turn off
-  (if (or (not arg)
-         (zerop (setq arg (prefix-numeric-value arg))))
-      (setq python-pdbtrack-do-tracking-p (not python-pdbtrack-do-tracking-p))
-    (setq python-pdbtrack-do-tracking-p (> arg 0)))
-  (message "%sabled Python's pdbtrack"
-           (if python-pdbtrack-do-tracking-p "En" "Dis")))
-
-(defun turn-on-pdbtrack ()
-  (interactive)
-  (python-pdbtrack-toggle-stack-tracking 1))
+  (set (make-local-variable 'mode-require-final-newline) t)
 
-(defun turn-off-pdbtrack ()
-  (interactive)
-  (python-pdbtrack-toggle-stack-tracking 0))
+  (set (make-local-variable 'outline-regexp)
+       (python-rx (* space) block-start))
+  (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n")
+  (set (make-local-variable 'outline-level)
+       #'(lambda ()
+           "`outline-level' function for Python mode."
+           (1+ (/ (current-indentation) python-indent-offset))))
 
-(defun python-sentinel (_proc _msg)
-  (setq overlay-arrow-position nil))
+  (python-skeleton-add-menu-items)
 
-(defun python-unload-function ()
-  "Unload the Python library."
-  (remove-hook 'comint-output-filter-functions 'python-pdbtrack-track-stack-file)
-  (setq minor-mode-alist (assq-delete-all 'python-pdbtrack-is-tracking-p
-                                          minor-mode-alist))
-  (dolist (error '("^No symbol" "^Can't shift all lines enough"))
-    (setq debug-ignored-errors (delete error debug-ignored-errors)))
-  ;; continue standard unloading
-  nil)
+  (when python-indent-guess-indent-offset
+    (python-indent-guess-indent-offset)))
 
-(provide 'python)
-(provide 'python-21)
 
+(provide 'python)
 ;;; python.el ends here
index 66aa256f9479d7095d707f99114ebcbfe9cfe34a..5d79437c3c2ba8dc27a06659790b6281c98ac1cf 100644 (file)
@@ -784,7 +784,7 @@ and `\\' when preceded by `?'."
                       (not (looking-at "[a-z_]"))))
                (and (looking-at ruby-operator-re)
                     (not (ruby-special-char-p))
-                    ;; operator at the end of line
+                    ;; Operator at the end of line.
                     (let ((c (char-after (point))))
                       (and
 ;;                     (or (null begin)
@@ -794,8 +794,9 @@ and `\\' when preceded by `?'."
 ;;                           (not (or (eolp) (looking-at "#")
 ;;                                    (and (eq (car (nth 1 state)) ?{)
 ;;                                         (looking-at "|"))))))
-                       (or (not (eq ?/ c))
-                           (null (nth 0 (ruby-parse-region (or begin parse-start) (point)))))
+                       ;; Not a regexp or general delimited literal.
+                       (null (nth 0 (ruby-parse-region (or begin parse-start)
+                                                       (point))))
                        (or (not (eq ?| (char-after (point))))
                            (save-excursion
                              (or (eolp) (forward-char -1))
@@ -1110,6 +1111,8 @@ See `add-log-current-defun-function'."
             mlist)))))
 
 (declare-function ruby-syntax-propertize-heredoc "ruby-mode" (limit))
+(declare-function ruby-syntax-general-delimiters-goto-beg "ruby-mode" ())
+(declare-function ruby-syntax-propertize-general-delimiters "ruby-mode" (limit))
 
 (if (eval-when-compile (fboundp #'syntax-propertize-rules))
     ;; New code that works independently from font-lock.
@@ -1118,26 +1121,48 @@ See `add-log-current-defun-function'."
         "Syntactic keywords for Ruby mode.  See `syntax-propertize-function'."
         (goto-char start)
         (ruby-syntax-propertize-heredoc end)
+        (ruby-syntax-general-delimiters-goto-beg)
         (funcall
          (syntax-propertize-rules
-          ;; #{ }, #$hoge, #@foo are not comments
+          ;; #{ }, #$hoge, #@foo are not comments.
           ("\\(#\\)[{$@]" (1 "."))
-          ;; $' $" $` .... are variables
-          ;; ?' ?" ?` are ascii codes
+          ;; $' $" $` .... are variables.
+          ;; ?' ?" ?` are ascii codes.
           ("\\([?$]\\)[#\"'`]"
            (1 (unless (save-excursion
                         ;; Not within a string.
                         (nth 3 (syntax-ppss (match-beginning 0))))
                 (string-to-syntax "\\"))))
-          ;; regexps
-          ("\\(^\\|[[=(,~?:;<>]\\|\\(^\\|\\s \\)\\(if\\|elsif\\|unless\\|while\\|until\\|when\\|and\\|or\\|&&\\|||\\)\\|g?sub!?\\|scan\\|split!?\\)\\s *\\(/\\)[^/\n\\\\]*\\(\\\\.[^/\n\\\\]*\\)*\\(/\\)"
-           (4 "\"/")
-           (6 "\"/"))
+          ;; Regexps: regexps are distinguished from division either because
+          ;; of the keyword/symbol before them, or because of the code
+          ;; following them.
+          ((concat
+            ;; Special tokens that can't be followed by a division operator.
+            "\\(?:\\(^\\|[[=(,~?:;<>]\\|\\(?:^\\|\\s \\)"
+            (regexp-opt '("if" "elsif" "unless" "while" "until" "when" "and"
+                          "or" "&&" "||"
+                          "gsub" "gsub!" "sub" "sub!" "scan" "split" "split!"))
+            "\\)\\s *\\)?"
+            ;; The regular expression itself.
+            "\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)"
+            ;; Special code that cannot follow a division operator.
+            ;; FIXME: Just because the second slash of "/foo/ do bar" can't
+            ;; be a division, doesn't mean it can't *start* a regexp, as in
+            ;; "x = toto/foo; if /do bar/".
+            "\\([imxo]*\\s *\\(?:,\\|\\_<do\\_>\\)\\)?")
+           (2 (when (or (match-beginning 1) (match-beginning 4))
+                (string-to-syntax "\"/")))
+           (3 (if (or (match-beginning 1) (match-beginning 4))
+                  (string-to-syntax "\"/")
+                (goto-char (match-end 2)))))
           ("^=en\\(d\\)\\_>" (1 "!"))
           ("^\\(=\\)begin\\_>" (1 "!"))
           ;; Handle here documents.
           ((concat ruby-here-doc-beg-re ".*\\(\n\\)")
-           (7 (prog1 "\"" (ruby-syntax-propertize-heredoc end)))))
+           (7 (prog1 "\"" (ruby-syntax-propertize-heredoc end))))
+          ;; Handle percent literals: %w(), %q{}, etc.
+          ("\\(?:^\\|[[ \t\n<+(,=]\\)\\(%\\)[qQrswWx]?\\([[:punct:]]\\)"
+           (1 (prog1 "|" (ruby-syntax-propertize-general-delimiters end)))))
          (point) end))
 
       (defun ruby-syntax-propertize-heredoc (limit)
@@ -1163,6 +1188,41 @@ See `add-log-current-defun-function'."
               ;; Make extra sure we don't move back, lest we could fall into an
               ;; inf-loop.
               (if (< (point) start) (goto-char start))))))
+
+      (defun ruby-syntax-general-delimiters-goto-beg ()
+        (let ((state (syntax-ppss)))
+          ;; Move to the start of the literal, in case it's multiline.
+          ;; TODO: determine the literal type more reliably here?
+          (when (eq t (nth 3 state))
+            (goto-char (nth 8 state))
+            (beginning-of-line))))
+
+      (defun ruby-syntax-propertize-general-delimiters (limit)
+        (goto-char (match-beginning 2))
+        (let* ((op (char-after))
+               (ops (char-to-string op))
+               (cl (or (cdr (aref (syntax-table) op))
+                       (cdr (assoc op '((?< . ?>))))))
+               parse-sexp-lookup-properties)
+          (ignore-errors
+            (if cl
+                (progn  ; Paired delimiters.
+                  ;; Delimiter pairs of the same kind can be nested
+                  ;; inside the literal, as long as they are balanced.
+                  ;; Create syntax table that ignores other characters.
+                  (with-syntax-table (make-char-table 'syntax-table nil)
+                    (modify-syntax-entry op (concat "(" (char-to-string cl)))
+                    (modify-syntax-entry cl (concat ")" ops))
+                    (modify-syntax-entry ?\\ "\\")
+                    (save-restriction
+                      (narrow-to-region (point) limit)
+                      (forward-list))))  ; skip to the paired character
+              ;; Single character delimiter.
+              (re-search-forward (concat "[^\\]\\(?:\\\\\\\\\\)*"
+                                         (regexp-quote ops)) limit nil))
+            ;; If we reached here, the closing delimiter was found.
+            (put-text-property (1- (point)) (point)
+                               'syntax-table (string-to-syntax "|")))))
       )
 
   ;; For Emacsen where syntax-propertize-rules is not (yet) available,
@@ -1207,6 +1267,10 @@ This should only be called after matching against `ruby-here-doc-end-re'."
      (4 (7 . ?/))
      (6 (7 . ?/)))
     ("^=en\\(d\\)\\_>" 1 "!")
+    ;; General delimited string.
+    ("\\(^\\|[[ \t\n<+(,=]\\)\\(%[xrqQwW]?\\([^<[{(a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\3\\)\\)"
+     (3 "\"")
+     (5 "\""))
     ("^\\(=\\)begin\\_>" 1 (ruby-comment-beg-syntax))
     ;; Currently, the following case is highlighted incorrectly:
     ;;
@@ -1415,9 +1479,6 @@ See `font-lock-syntax-table'.")
      1 font-lock-variable-name-face)
    '("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+"
      0 font-lock-variable-name-face)
-   ;; general delimited string
-   '("\\(^\\|[[ \t\n<+(,=]\\)\\(%[xrqQwW]?\\([^<[{(a-zA-Z0-9 \n]\\)[^\n\\\\]*\\(\\\\.[^\n\\\\]*\\)*\\(\\3\\)\\)"
-     (2 font-lock-string-face))
    ;; constants
    '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)"
      2 font-lock-type-face)
index 82a4985015f26104d6b894c8f000cc7f34556220..7cab07fe38751435387cb93dea406b2ae9c119d3 100644 (file)
@@ -201,7 +201,7 @@ Editing commands are similar to those of `lisp-mode'.
 In addition, if an inferior Scheme process is running, some additional
 commands will be defined, for evaluating expressions and controlling
 the interpreter, and the state of the process will be displayed in the
-modeline of all Scheme buffers.  The names of commands that interact
+mode line of all Scheme buffers.  The names of commands that interact
 with the Scheme process start with \"xscheme-\" if you use the MIT
 Scheme-specific `xscheme' package; for more information see the
 documentation for `xscheme-interaction-mode'.  Use \\[run-scheme] to
@@ -229,7 +229,7 @@ Set this to nil if you normally use another dialect."
 (defcustom dsssl-sgml-declaration
   "<!DOCTYPE style-sheet PUBLIC \"-//James Clark//DTD DSSSL Style Sheet//EN\">
 "
-  "*An SGML declaration for the DSSSL file.
+  "An SGML declaration for the DSSSL file.
 If it is defined as a string this will be inserted into an empty buffer
 which is in `dsssl-mode'.  It is typically James Clark's style-sheet
 doctype, as required for Jade."
@@ -251,7 +251,7 @@ See `run-hooks'."
 
 ;; This is shared by cmuscheme and xscheme.
 (defcustom scheme-program-name "scheme"
-  "*Program invoked by the `run-scheme' command."
+  "Program invoked by the `run-scheme' command."
   :type 'string
   :group 'scheme)
 
index 7d38df6aff6445b8e78675e334ad19871d8ebfd5..be664c6fc6e4b94b93c18a63183ebae2653b2204 100644 (file)
 
 (eval-when-compile
   (require 'skeleton)
-  (require 'cl)
+  (require 'cl-lib)
   (require 'comint))
 (require 'executable)
 
@@ -326,7 +326,9 @@ shell it really is."
 
 (defcustom sh-imenu-generic-expression
   `((sh
-     . ((nil "^\\s-*\\(function\\s-+\\)?\\([[:alpha:]_][[:alnum:]_]+\\)\\s-*()" 2))))
+     . ((nil
+         "^\\s-*\\(function\\s-+\\)?\\([[:alpha:]_][[:alnum:]_]+\\)\\s-*()"
+         2))))
   "Alist of regular expressions for recognizing shell function definitions.
 See `sh-feature' and `imenu-generic-expression'."
   :type '(alist :key-type (symbol :tag "Shell")
@@ -460,14 +462,6 @@ This is buffer-local in every such buffer.")
     (define-key map "\C-c+" 'sh-add)
     (define-key map "\C-\M-x" 'sh-execute-region)
     (define-key map "\C-c\C-x" 'executable-interpret)
-    ;; FIXME: Use post-self-insert-hook.
-    (define-key map "<" 'sh-maybe-here-document)
-    (define-key map "(" 'skeleton-pair-insert-maybe)
-    (define-key map "{" 'skeleton-pair-insert-maybe)
-    (define-key map "[" 'skeleton-pair-insert-maybe)
-    (define-key map "'" 'skeleton-pair-insert-maybe)
-    (define-key map "`" 'skeleton-pair-insert-maybe)
-    (define-key map "\"" 'skeleton-pair-insert-maybe)
 
     (define-key map [remap complete-tag] 'comint-dynamic-complete)
     (define-key map [remap delete-backward-char]
@@ -478,10 +472,10 @@ This is buffer-local in every such buffer.")
     (define-key map [menu-bar sh-script] (cons "Sh-Script" menu-map))
     (define-key menu-map [sh-learn-buffer-indent]
       '(menu-item "Learn buffer indentation" sh-learn-buffer-indent
-                 :help "Learn how to indent the buffer the way it currently is."))
+        :help "Learn how to indent the buffer the way it currently is."))
     (define-key menu-map [sh-learn-line-indent]
       '(menu-item "Learn line indentation" sh-learn-line-indent
-                 :help "Learn how to indent a line as it currently is indented"))
+        :help "Learn how to indent a line as it currently is indented"))
     (define-key menu-map [sh-show-indent]
       '(menu-item "Show indentation" sh-show-indent
                  :help "Show the how the current line would be indented"))
@@ -491,13 +485,9 @@ This is buffer-local in every such buffer.")
 
     (define-key menu-map [sh-pair]
       '(menu-item "Insert braces and quotes in pairs"
-                 (lambda ()
-                   (interactive)
-                   (require 'skeleton)
-                   (setq skeleton-pair (not skeleton-pair)))
-                 :button (:toggle . (and (boundp 'skeleton-pair)
-                                         skeleton-pair))
-                 :help "Inserting a brace or quote automatically inserts the matching pair"))
+        electric-pair-mode
+        :button (:toggle . (bound-and-true-p electric-pair-mode))
+        :help "Inserting a brace or quote automatically inserts the matching pair"))
 
     (define-key menu-map [sh-s0] '("--"))
     ;; Insert
@@ -506,7 +496,7 @@ This is buffer-local in every such buffer.")
                  :help "Insert a function definition"))
     (define-key menu-map [sh-add]
       '(menu-item "Addition..." sh-add
-                 :help "Insert an addition of VAR and prefix DELTA for Bourne (type) shell"))
+        :help "Insert an addition of VAR and prefix DELTA for Bourne (type) shell"))
     (define-key menu-map [sh-until]
       '(menu-item "Until Loop" sh-until
                  :help "Insert an until loop"))
@@ -537,16 +527,16 @@ This is buffer-local in every such buffer.")
     (define-key menu-map [sh-s1] '("--"))
     (define-key menu-map [sh-exec]
       '(menu-item "Execute region" sh-execute-region
-                 :help "Pass optional header and region to a subshell for noninteractive execution"))
+        :help "Pass optional header and region to a subshell for noninteractive execution"))
     (define-key menu-map [sh-exec-interpret]
       '(menu-item "Execute script..." executable-interpret
-                 :help "Run script with user-specified args, and collect output in a buffer"))
+        :help "Run script with user-specified args, and collect output in a buffer"))
     (define-key menu-map [sh-set-shell]
       '(menu-item "Set shell type..." sh-set-shell
                  :help "Set this buffer's shell to SHELL (a string)"))
     (define-key menu-map [sh-backslash-region]
       '(menu-item "Backslash region" sh-backslash-region
-                 :help "Insert, align, or delete end-of-line backslashes on the lines in the region."))
+        :help "Insert, align, or delete end-of-line backslashes on the lines in the region."))
     map)
   "Keymap used in Shell-Script mode.")
 
@@ -564,9 +554,10 @@ This is buffer-local in every such buffer.")
   :group 'sh-script)
 
 (defcustom sh-assignment-regexp
-  '((csh . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=")
+  `((csh . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*[-+*/%^]?=")
     ;; actually spaces are only supported in let/(( ... ))
-    (ksh88 . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?[ \t]*\\([-+*/%&|~^]\\|<<\\|>>\\)?=")
+    (ksh88 . ,(concat "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?"
+                      "[ \t]*\\(?:[-+*/%&|~^]\\|<<\\|>>\\)?="))
     (bash . "\\<\\([[:alnum:]_]+\\)\\(\\[.+\\]\\)?\\+?=")
     (rc . "\\<\\([[:alnum:]_*]+\\)[ \t]*=")
     (sh . "\\<\\([[:alnum:]_]+\\)="))
@@ -996,31 +987,31 @@ subshells can nest."
       (while (and state (progn (skip-chars-forward "^'\\\\\"`$()" limit)
                                (< (point) limit)))
         ;; unescape " inside a $( ... ) construct.
-        (case (char-after)
-          (?\' (case state
-                 (double-quote nil)
-                 (t (forward-char 1) (skip-chars-forward "^'" limit))))
+        (pcase (char-after)
+          (?\' (pcase state
+                 (`double-quote nil)
+                 (_ (forward-char 1) (skip-chars-forward "^'" limit))))
           (?\\ (forward-char 1))
-          (?\" (case state
-                 (double-quote (setq state (pop states)))
-                 (t (push state states) (setq state 'double-quote)))
+          (?\" (pcase state
+                 (`double-quote (setq state (pop states)))
+                 (_ (push state states) (setq state 'double-quote)))
                (if state (put-text-property (point) (1+ (point))
                                             'syntax-table '(1))))
-          (?\` (case state
-                 (backquote (setq state (pop states)))
-                 (t (push state states) (setq state 'backquote))))
+          (?\` (pcase state
+                 (`backquote (setq state (pop states)))
+                 (_ (push state states) (setq state 'backquote))))
           (?\$ (if (not (eq (char-after (1+ (point))) ?\())
                    nil
                  (forward-char 1)
-                 (case state
-                   (t (push state states) (setq state 'code)))))
-          (?\( (case state
-                 (double-quote nil)
-                 (t (push state states) (setq state 'code))))
-          (?\) (case state
-                 (double-quote nil)
-                 (t (setq state (pop states)))))
-          (t (error "Internal error in sh-font-lock-quoted-subshell")))
+                 (pcase state
+                   (_ (push state states) (setq state 'code)))))
+          (?\( (pcase state
+                 (`double-quote nil)
+                 (_ (push state states) (setq state 'code))))
+          (?\) (pcase state
+                 (`double-quote nil)
+                 (_ (setq state (pop states)))))
+          (_ (error "Internal error in sh-font-lock-quoted-subshell")))
         (forward-char 1)))))
 
 
@@ -1096,7 +1087,7 @@ subshells can nest."
     ;; metacharacters.  The list of special chars is taken from
     ;; the single-unix spec of the shell command language (under
     ;; `quoting') but with `$' removed.
-    ("[^|&;<>()`\\\"' \t\n]\\(#+\\)" (1 "_"))
+    ("\\(?:[^|&;<>()`\\\"' \t\n]\\|\\${\\)\\(#+\\)" (1 "_"))
     ;; In a '...' the backslash is not escaping.
     ("\\(\\\\\\)'" (1 (sh-font-lock-backslash-quote)))
     ;; Make sure $@ and $? are correctly recognized as sexps.
@@ -1114,7 +1105,6 @@ subshells can nest."
            (save-excursion
              (sh-font-lock-quoted-subshell end)))))))
    (point) end))
-
 (defun sh-font-lock-syntactic-face-function (state)
   (let ((q (nth 3 state)))
     (if q
@@ -1379,10 +1369,10 @@ punctuation characters like '-'."
 
 
 (defconst sh-indent-supported
-  '((sh . t)
+  '((sh . sh)
     (csh . nil)
-    (rc . t))
-  "Shell types that shell indenting can do something with.")
+    (rc . rc))
+  "Indentation rule set to use for each shell type.")
 
 (defvar sh-indent-supported-here nil
   "Non-nil if we support indentation for the current buffer's shell type.")
@@ -1410,7 +1400,7 @@ This list is used when switching between buffer-local and global
 values of variables, and for the commands using indentation styles.")
 
 (defvar sh-make-vars-local t
-  "*Controls whether indentation variables are local to the buffer.
+  "Controls whether indentation variables are local to the buffer.
 If non-nil, indentation variables are made local initially.
 If nil, you can later make the variables local by invoking
 command `sh-make-vars-local'.
@@ -1464,9 +1454,8 @@ buffer indents as it currently is indented.
 \\[sh-set-shell]        Set this buffer's shell, and maybe its magic number.
 \\[sh-execute-region]   Have optional header and region be executed in a subshell.
 
-\\[sh-maybe-here-document]      Without prefix, following an unquoted < inserts here document.
-\{, (, [, ', \", `
-       Unless quoted with \\, insert the pairs {}, (), [], or '', \"\", ``.
+`sh-electric-here-document-mode' controls whether insertion of two
+unquoted < insert a here document.
 
 If you generally program a shell different from your login shell you can
 set `sh-shell-file' accordingly.  If your shell's file name doesn't correctly
@@ -1503,13 +1492,13 @@ with your script for an edit-interpret-debug cycle."
        #'sh-syntax-propertize-function)
   (add-hook 'syntax-propertize-extend-region-functions
             #'syntax-propertize-multiline 'append 'local)
+  (sh-electric-here-document-mode 1)
   (set (make-local-variable 'skeleton-pair-alist) '((?` _ ?`)))
   (set (make-local-variable 'skeleton-pair-filter-function) 'sh-quoted-p)
   (set (make-local-variable 'skeleton-further-elements)
        '((< '(- (min sh-indentation (current-column))))))
   (set (make-local-variable 'skeleton-filter-function) 'sh-feature)
   (set (make-local-variable 'skeleton-newline-indent-rigidly) t)
-  (set (make-local-variable 'sh-indent-supported-here) nil)
   (set (make-local-variable 'defun-prompt-regexp)
        (concat "^\\(function[ \t]\\|[[:alnum:]]+[ \t]+()[ \t]+\\)"))
   ;; Parse or insert magic number for exec, and set all variables depending
@@ -1519,23 +1508,15 @@ with your script for an edit-interpret-debug cycle."
             (goto-char (point-min))
             (looking-at "#![ \t]?\\([^ \t\n]*/bin/env[ \t]\\)?\\([^ \t\n]+\\)"))
           (match-string 2))
-         ((not buffer-file-name)
-          sh-shell-file)
+         ((not buffer-file-name) sh-shell-file)
          ;; Checks that use `buffer-file-name' follow.
-         ((string-match "\\.m?spec\\'" buffer-file-name)
-          "rpm")
-         ((string-match "[.]sh\\>" buffer-file-name)
-          "sh")
-         ((string-match "[.]bash\\>" buffer-file-name)
-          "bash")
-         ((string-match "[.]ksh\\>" buffer-file-name)
-          "ksh")
-         ((string-match "[.]csh\\>" buffer-file-name)
-          "csh")
-        ((equal (file-name-nondirectory buffer-file-name) ".profile")
-          "sh")
-         (t
-          sh-shell-file))
+         ((string-match "\\.m?spec\\'" buffer-file-name) "rpm")
+         ((string-match "[.]sh\\>"     buffer-file-name) "sh")
+         ((string-match "[.]bash\\>"   buffer-file-name) "bash")
+         ((string-match "[.]ksh\\>"    buffer-file-name) "ksh")
+         ((string-match "[.]csh\\>"    buffer-file-name) "csh")
+        ((equal (file-name-nondirectory buffer-file-name) ".profile") "sh")
+         (t sh-shell-file))
    nil nil))
 
 ;;;###autoload
@@ -1578,6 +1559,426 @@ This adds rules for comments and assignments."
   "Function to get better fontification including keywords and builtins."
   (sh-font-lock-keywords-1 t))
 
+;;; Indentation and navigation with SMIE.
+
+(require 'smie)
+
+;; The SMIE code should generally be preferred, but it currently does not obey
+;; the various indentation custom-vars, and it misses some important features
+;; of the old code, mostly: sh-learn-line/buffer-indent, sh-show-indent,
+;; sh-name/save/load-style.
+(defvar sh-use-smie nil
+  "Whether to use the SMIE code for navigation and indentation.")
+
+(defun sh-smie--keyword-p (tok)
+  "Non-nil if TOK (at which we're looking) really is a keyword."
+  (let ((prev (funcall smie-backward-token-function)))
+    (if (zerop (length prev))
+        (looking-back "\\s(" (1- (point)))
+      (assoc prev smie-grammar))))
+
+(defun sh-smie--newline-semi-p (&optional tok)
+  "Return non-nil if a newline should be treated as a semi-colon.
+Here we assume that a newline should be treated as a semi-colon unless it
+comes right after a special keyword.
+This function does not pay attention to line-continuations.
+If TOK is nil, point should be before the newline; otherwise, TOK is the token
+before the newline and in that case point should be just before the token."
+  (save-excursion
+    (unless tok
+      (setq tok (funcall smie-backward-token-function)))
+    (if (and (zerop (length tok))
+             (looking-back "\\s(" (1- (point))))
+        nil
+      (not (numberp (nth 2 (assoc tok smie-grammar)))))))
+
+;;;; SMIE support for `sh'.
+
+(defconst sh-smie-sh-grammar
+  (smie-prec2->grammar
+   (smie-bnf->prec2
+    '((exp)                    ;A constant, or a $var, or a sequence of them...
+      (cmd ("case" exp "in" branches "esac")
+           ("if" cmd "then" cmd "fi")
+           ("if" cmd "then" cmd "else" cmd "fi")
+           ("if" cmd "then" cmd "elif" cmd "then" cmd "fi")
+           ("if" cmd "then" cmd "elif" cmd "then" cmd "else" cmd "fi")
+           ("if" cmd "then" cmd "elif" cmd "then" cmd
+                                "elif" cmd "then" cmd "else" cmd "fi")
+           ("while" cmd "do" cmd "done")
+           ("until" cmd "do" cmd "done")
+           ("for" exp "in" cmd "do" cmd "done")
+           ("for" exp "do" cmd "done")
+           ("select" exp "in" cmd "do" cmd "done")   ;bash&zsh&ksh88.
+           ("repeat" exp "do" cmd "done")            ;zsh.
+           (exp "always" exp)                        ;zsh.
+           (cmd "|" cmd) (cmd "|&" cmd)
+           (cmd "&&" cmd) (cmd "||" cmd)
+           (cmd ";" cmd) (cmd "&" cmd))
+      (pattern (pattern "|" pattern))
+      (branches (branches ";;" branches)
+                (branches ";&" branches) (branches ";;&" branches) ;bash.
+                (pattern "case-)" cmd)))
+    '((assoc ";;" ";&" ";;&"))
+    '((assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&")))))
+
+(defconst sh-smie--sh-operators
+  (delq nil (mapcar (lambda (x)
+                      (setq x (car x))
+                      (and (stringp x)
+                           (not (string-match "\\`[a-z]" x))
+                           x))
+                    sh-smie-sh-grammar)))
+
+(defconst sh-smie--sh-operators-re (regexp-opt sh-smie--sh-operators))
+(defconst sh-smie--sh-operators-back-re
+  (concat "\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*"
+          "\\(" sh-smie--sh-operators-re "\\)"))
+
+(defun sh-smie--sh-keyword-in-p ()
+  "Assuming we're looking at \"in\", return non-nil if it's a keyword.
+Does not preserve point."
+  (let ((forward-sexp-function nil)
+        (words nil)                     ;We've seen words.
+        (newline nil)                   ;We've seen newlines after the words.
+        (res nil)
+        prev)
+    (while (not res)
+      (setq prev (funcall smie-backward-token-function))
+      (cond
+       ((zerop (length prev))
+        (if newline
+            (progn (cl-assert words) (setq res 'word))
+          (setq words t)
+          (condition-case nil
+              (forward-sexp -1)
+            (scan-error (setq res 'unknown)))))
+       ((equal prev ";")
+        (if words (setq newline t)
+          (setq res 'keyword)))
+       ((member prev '("case" "for" "select")) (setq res 'keyword))
+       ((assoc prev smie-grammar) (setq res 'word))
+       (t
+        (if newline
+            (progn (cl-assert words) (setq res 'word))
+          (setq words t)))))
+    (eq res 'keyword)))
+
+(defun sh-smie--sh-keyword-p (tok)
+  "Non-nil if TOK (at which we're looking) really is a keyword."
+  (if (equal tok "in")
+      (sh-smie--sh-keyword-in-p)
+    (sh-smie--keyword-p tok)))
+
+(defun sh-smie-sh-forward-token ()
+  (if (and (looking-at "[ \t]*\\(?:#\\|\\(\\s|\\)\\|$\\)")
+           (save-excursion
+             (skip-chars-backward " \t")
+             (not (bolp))))
+      (if (and (match-end 1) (not (nth 3 (syntax-ppss))))
+          ;; Right before a here-doc.
+          (let ((forward-sexp-function nil))
+            (forward-sexp 1)
+            ;; Pretend the here-document is a "newline representing a
+            ;; semi-colon", since the here-doc otherwise covers the newline(s).
+            ";")
+        (let ((semi (sh-smie--newline-semi-p)))
+          (forward-line 1)
+          (if semi ";"
+            (sh-smie-sh-forward-token))))
+    (forward-comment (point-max))
+    (cond
+     ((looking-at "\\\\\n") (forward-line 1) (sh-smie-sh-forward-token))
+     ((looking-at sh-smie--sh-operators-re)
+      (goto-char (match-end 0))
+      (let ((tok (match-string-no-properties 0)))
+        (if (and (memq (aref tok (1- (length tok))) '(?\; ?\& ?\|))
+                 (looking-at "[ \t]*\\(?:#\\|$\\)"))
+            (forward-line 1))
+        tok))
+     (t
+      (let* ((pos (point))
+             (tok (smie-default-forward-token)))
+        (cond
+         ((equal tok ")") "case-)")
+         ((and tok (string-match "\\`[a-z]" tok)
+               (assoc tok smie-grammar)
+               (not
+                (save-excursion
+                  (goto-char pos)
+                  (sh-smie--sh-keyword-p tok))))
+          " word ")
+         (t tok)))))))
+
+(defun sh-smie--looking-back-at-continuation-p ()
+  (save-excursion
+    (and (if (eq (char-before) ?\n) (progn (forward-char -1) t) (eolp))
+         (looking-back "\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\\\"
+                       (line-beginning-position)))))
+
+(defun sh-smie-sh-backward-token ()
+  (let ((bol (line-beginning-position))
+        pos tok)
+    (forward-comment (- (point)))
+    (cond
+     ((and (bolp) (not (bobp))
+           (equal (syntax-after (1- (point))) (string-to-syntax "|"))
+           (not (nth 3 (syntax-ppss))))
+      ;; Right after a here-document.
+      (let ((forward-sexp-function nil))
+        (forward-sexp -1)
+        ;; Pretend the here-document is a "newline representing a
+        ;; semi-colon", since the here-doc otherwise covers the newline(s).
+        ";"))
+     ((< (point) bol)
+      (cond
+       ((sh-smie--looking-back-at-continuation-p)
+        (forward-char -1)
+        (funcall smie-backward-token-function))
+       ((sh-smie--newline-semi-p) ";")
+       (t (funcall smie-backward-token-function))))
+     ((looking-back sh-smie--sh-operators-back-re
+                    (line-beginning-position) 'greedy)
+      (goto-char (match-beginning 1))
+      (match-string-no-properties 1))
+     (t
+      (let ((tok (smie-default-backward-token)))
+        (cond
+         ((equal tok ")") "case-)")
+         ((and tok (string-match "\\`[a-z]" tok)
+               (assoc tok smie-grammar)
+               (not (save-excursion (sh-smie--sh-keyword-p tok))))
+          " word ")
+         (t tok)))))))
+
+(defcustom sh-indent-after-continuation t
+  "If non-nil, try to make sure text is indented after a line continuation."
+  :type 'boolean)
+
+(defun sh-smie--continuation-start-indent ()
+  "Return the initial indentation of a continued line.
+May return nil if the line should not be treated as continued."
+  (save-excursion
+    (forward-line -1)
+    (unless (sh-smie--looking-back-at-continuation-p)
+      (current-indentation))))
+
+(defun sh-smie-sh-rules (kind token)
+  (pcase (cons kind token)
+    (`(:elem . basic) sh-indentation)
+    (`(:after . "case-)") (or sh-indentation smie-indent-basic))
+    ((and `(:before . ,_)
+          (guard (when sh-indent-after-continuation
+                   (save-excursion
+                     (ignore-errors
+                       (skip-chars-backward " \t")
+                       (sh-smie--looking-back-at-continuation-p))))))
+     ;; After a line-continuation, make sure the rest is indented.
+     (let* ((sh-indent-after-continuation nil)
+            (indent (smie-indent-calculate))
+            (initial (sh-smie--continuation-start-indent)))
+       (when (and (numberp indent) (numberp initial)
+                  (<= indent initial))
+         `(column . ,(+ initial sh-indentation)))))
+    (`(:before . ,(or `"(" `"{" `"["))
+     (if (smie-rule-hanging-p) (smie-rule-parent)))
+    ;; FIXME: Maybe this handling of ;; should be made into
+    ;; a smie-rule-terminator function that takes the substitute ";" as arg.
+    (`(:before . ,(or `";;" `";&" `";;&"))
+     (if (and (smie-rule-bolp) (looking-at ";;?&?[ \t]*\\(#\\|$\\)"))
+         (cons 'column (smie-indent-keyword ";"))
+       (smie-rule-separator kind)))
+    (`(:after . ,(or `";;" `";&" `";;&"))
+     (with-demoted-errors
+       (smie-backward-sexp token)
+       (cons 'column
+             (if (or (smie-rule-bolp)
+                     (save-excursion
+                       (and (member (funcall smie-backward-token-function)
+                                    '("in" ";;"))
+                            (smie-rule-bolp))))
+                 (current-column)
+               (smie-indent-calculate)))))
+    (`(:after . "|") (if (smie-rule-parent-p "|") nil 4))
+    ))
+
+;; (defconst sh-smie-csh-grammar
+;;   (smie-prec2->grammar
+;;    (smie-bnf->prec2
+;;     '((exp)                   ;A constant, or a $var, or a sequence of them…
+;;       (elseifcmd (cmd)
+;;                  (cmd "else" "else-if" exp "then" elseifcmd))
+;;       (cmd ("switch" branches "endsw")
+;;            ("if" exp)
+;;            ("if" exp "then" cmd "endif")
+;;            ("if" exp "then" cmd "else" cmd "endif")
+;;            ("if" exp "then" elseifcmd "endif")
+;;            ;; ("if" exp "then" cmd "else" cmd "endif")
+;;            ;; ("if" exp "then" cmd "else" "if" exp "then" cmd "endif")
+;;            ;; ("if" exp "then" cmd "else" "if" exp "then" cmd
+;;            ;;                      "else" cmd "endif")
+;;            ;; ("if" exp "then" cmd "else" "if" exp "then" cmd
+;;            ;;                      "else" "if" exp "then" cmd "endif")
+;;            ("while" cmd "end")
+;;            ("foreach" cmd "end")
+;;            (cmd "|" cmd) (cmd "|&" cmd)
+;;            (cmd "&&" cmd) (cmd "||" cmd)
+;;            (cmd ";" cmd) (cmd "&" cmd))
+;;       ;; This is a lie, but (combined with the corresponding disambiguation
+;;       ;; rule) it makes it more clear that `case' and `default' are the key
+;;       ;; separators and the `:' is a secondary tokens.
+;;       (branches (branches "case" branches)
+;;                 (branches "default" branches)
+;;                 (exp ":" branches)))
+;;     '((assoc "else" "then" "endif"))
+;;     '((assoc "case" "default") (nonassoc ":"))
+;;     '((assoc ";;" ";&" ";;&"))
+;;     '((assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&")))))
+
+;;;; SMIE support for `rc'.
+
+(defconst sh-smie-rc-grammar
+  (smie-prec2->grammar
+   (smie-bnf->prec2
+    '((exp)                    ;A constant, or a $var, or a sequence of them...
+      (cmd (cmd "case" cmd)
+           ("if" exp)
+           ("switch" exp)
+           ("for" exp) ("while" exp)
+           (cmd "|" cmd) (cmd "|&" cmd)
+           (cmd "&&" cmd) (cmd "||" cmd)
+           (cmd ";" cmd) (cmd "&" cmd))
+      (pattern (pattern "|" pattern))
+      (branches (branches ";;" branches)
+                (branches ";&" branches) (branches ";;&" branches) ;bash.
+                (pattern "case-)" cmd)))
+    '((assoc ";;" ";&" ";;&"))
+    '((assoc "case") (assoc ";" "&") (assoc "&&" "||") (assoc "|" "|&")))))
+
+(defun sh-smie--rc-after-special-arg-p ()
+  "Check if we're after the first arg of an if/while/for/... construct.
+Returns the construct's token and moves point before it, if so."
+  (forward-comment (- (point)))
+  (when (looking-back ")\\|\\_<not" (- (point) 3))
+    (ignore-errors
+      (let ((forward-sexp-function nil))
+        (forward-sexp -1)
+        (car (member (funcall smie-backward-token-function)
+                     '("if" "for" "switch" "while")))))))
+
+(defun sh-smie--rc-newline-semi-p ()
+  "Return non-nil if a newline should be treated as a semi-colon.
+Point should be before the newline."
+  (save-excursion
+    (let ((tok (funcall smie-backward-token-function)))
+      (if (or (when (equal tok "not") (forward-word 1) t)
+              (and (zerop (length tok)) (eq (char-before) ?\))))
+          (not (sh-smie--rc-after-special-arg-p))
+        (sh-smie--newline-semi-p tok)))))
+
+(defun sh-smie-rc-forward-token ()
+  ;; FIXME: Code duplication with sh-smie-sh-forward-token.
+  (if (and (looking-at "[ \t]*\\(?:#\\|\\(\\s|\\)\\|$\\)")
+           (save-excursion
+             (skip-chars-backward " \t")
+             (not (bolp))))
+      (if (and (match-end 1) (not (nth 3 (syntax-ppss))))
+          ;; Right before a here-doc.
+          (let ((forward-sexp-function nil))
+            (forward-sexp 1)
+            ;; Pretend the here-document is a "newline representing a
+            ;; semi-colon", since the here-doc otherwise covers the newline(s).
+            ";")
+        (let ((semi (sh-smie--rc-newline-semi-p)))
+          (forward-line 1)
+          (if semi ";"
+            (sh-smie-rc-forward-token))))
+    (forward-comment (point-max))
+    (cond
+     ((looking-at "\\\\\n") (forward-line 1) (sh-smie-rc-forward-token))
+     ;; ((looking-at sh-smie--rc-operators-re)
+     ;;  (goto-char (match-end 0))
+     ;;  (let ((tok (match-string-no-properties 0)))
+     ;;    (if (and (memq (aref tok (1- (length tok))) '(?\; ?\& ?\|))
+     ;;             (looking-at "[ \t]*\\(?:#\\|$\\)"))
+     ;;        (forward-line 1))
+     ;;    tok))
+     (t
+      (let* ((pos (point))
+             (tok (smie-default-forward-token)))
+        (cond
+         ;; ((equal tok ")") "case-)")
+         ((and tok (string-match "\\`[a-z]" tok)
+               (assoc tok smie-grammar)
+               (not
+                (save-excursion
+                  (goto-char pos)
+                  (sh-smie--keyword-p tok))))
+          " word ")
+         (t tok)))))))
+
+(defun sh-smie-rc-backward-token ()
+  ;; FIXME: Code duplication with sh-smie-sh-backward-token.
+  (let ((bol (line-beginning-position))
+        pos tok)
+    (forward-comment (- (point)))
+    (cond
+     ((and (bolp) (not (bobp))
+           (equal (syntax-after (1- (point))) (string-to-syntax "|"))
+           (not (nth 3 (syntax-ppss))))
+      ;; Right after a here-document.
+      (let ((forward-sexp-function nil))
+        (forward-sexp -1)
+        ;; Pretend the here-document is a "newline representing a
+        ;; semi-colon", since the here-doc otherwise covers the newline(s).
+        ";"))
+     ((< (point) bol)                   ;We skipped over a newline.
+      (cond
+       ;; A continued line.
+       ((and (eolp)
+             (looking-back "\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\\\"
+                           (line-beginning-position)))
+        (forward-char -1)
+        (funcall smie-backward-token-function))
+       ((sh-smie--rc-newline-semi-p) ";")
+       (t (funcall smie-backward-token-function))))
+     ;; ((looking-back sh-smie--sh-operators-back-re
+     ;;                (line-beginning-position) 'greedy)
+     ;;  (goto-char (match-beginning 1))
+     ;;  (match-string-no-properties 1))
+     (t
+      (let ((tok (smie-default-backward-token)))
+        (cond
+         ;; ((equal tok ")") "case-)")
+         ((and tok (string-match "\\`[a-z]" tok)
+               (assoc tok smie-grammar)
+               (not (save-excursion (sh-smie--keyword-p tok))))
+          " word ")
+         (t tok)))))))
+
+(defun sh-smie-rc-rules (kind token)
+  (pcase (cons kind token)
+    (`(:elem . basic) sh-indentation)
+    ;; (`(:after . "case") (or sh-indentation smie-indent-basic))
+    (`(:after . ";") (if (smie-rule-parent-p "case")
+                         (smie-rule-parent sh-indentation)))
+    (`(:before . "{")
+     (save-excursion
+       (when (sh-smie--rc-after-special-arg-p)
+         `(column . ,(current-column)))))
+    (`(:before . ,(or `"(" `"{" `"["))
+     (if (smie-rule-hanging-p) (smie-rule-parent)))
+    ;; FIXME: SMIE parses "if (exp) cmd" as "(if ((exp) cmd))" so "cmd" is
+    ;; treated as an arg to (exp) by default, which indents it all wrong.
+    ;; To handle it right, we should extend smie-indent-exps so that the
+    ;; preceding keyword can give special rules.  Currently the only special
+    ;; rule we have is the :list-intro hack, which we use here to align "cmd"
+    ;; with "(exp)", which is rarely the right thing to do, but is better
+    ;; than nothing.
+    (`(:list-intro . ,(or `"for" `"if" `"while")) t)
+    ))
+
+;;; End of SMIE code.
 
 (defvar sh-regexp-for-done nil
   "A buffer-local regexp to match opening keyword for done.")
@@ -1677,19 +2078,28 @@ Calls the value of `sh-set-shell-hook' if set."
       (set-syntax-table sh-mode-syntax-table)))
   (dolist (var (sh-feature sh-variables))
     (sh-remember-variable var))
-  (if (setq sh-indent-supported-here (sh-feature sh-indent-supported))
+  (if (set (make-local-variable 'sh-indent-supported-here)
+           (sh-feature sh-indent-supported))
       (progn
        (message "Setting up indent for shell type %s" sh-shell)
-       (set (make-local-variable 'parse-sexp-lookup-properties) t)
-       (set (make-local-variable 'sh-kw-alist) (sh-feature sh-kw))
-       (let ((regexp (sh-feature sh-kws-for-done)))
-         (if regexp
-             (set (make-local-variable 'sh-regexp-for-done)
-                  (sh-mkword-regexpr (regexp-opt regexp t)))))
-       (message "setting up indent stuff")
-       ;; sh-mode has already made indent-line-function local
-       ;; but do it in case this is called before that.
-       (set (make-local-variable 'indent-line-function) 'sh-indent-line)
+        (if sh-use-smie
+            (let ((mksym (lambda (name)
+                           (intern (format "sh-smie-%s-%s"
+                                           sh-indent-supported-here name)))))
+              (smie-setup (symbol-value (funcall mksym "grammar"))
+                          (funcall mksym "rules")
+                          :forward-token  (funcall mksym "forward-token")
+                          :backward-token (funcall mksym "backward-token")))
+          (set (make-local-variable 'parse-sexp-lookup-properties) t)
+          (set (make-local-variable 'sh-kw-alist) (sh-feature sh-kw))
+          (let ((regexp (sh-feature sh-kws-for-done)))
+            (if regexp
+                (set (make-local-variable 'sh-regexp-for-done)
+                     (sh-mkword-regexpr (regexp-opt regexp t)))))
+          (message "setting up indent stuff")
+          ;; sh-mode has already made indent-line-function local
+          ;; but do it in case this is called before that.
+          (set (make-local-variable 'indent-line-function) 'sh-indent-line))
        (if sh-make-vars-local
            (sh-make-vars-local))
        (message "Indentation setup for shell type %s" sh-shell))
@@ -1876,7 +2286,7 @@ region, clear header."
 \f
 ;; Indentation stuff.
 (defun sh-must-support-indent ()
-  "*Signal an error if the shell type for this buffer is not supported.
+  "Signal an error if the shell type for this buffer is not supported.
 Also, the buffer must be in Shell-script mode."
   (unless sh-indent-supported-here
     (error "This buffer's shell does not support indentation through Emacs")))
@@ -2885,7 +3295,7 @@ so that `occur-next' and `occur-prev' will work."
 
 ;; Is this really worth having?
 (defvar sh-learned-buffer-hook nil
-  "*An abnormal hook, called with an alist of learned variables.")
+  "An abnormal hook, called with an alist of learned variables.")
 ;; Example of how to use sh-learned-buffer-hook
 ;;
 ;; (defun what-i-learned (list)
@@ -3237,8 +3647,9 @@ overwritten if
 (defun sh-save-styles-to-buffer (buff)
   "Save all current styles in elisp to buffer BUFF.
 This is always added to the end of the buffer."
-  (interactive (list
-               (read-from-minibuffer "Buffer to save styles in? " "*scratch*")))
+  (interactive
+   (list
+    (read-from-minibuffer "Buffer to save styles in? " "*scratch*")))
   (with-current-buffer (get-buffer-create buff)
     (goto-char (point-max))
     (insert "\n")
@@ -3656,8 +4067,12 @@ option followed by a colon `:' if the option accepts an argument."
 The document is bounded by `sh-here-document-word'."
   (interactive "*P")
   (self-insert-command (prefix-numeric-value arg))
-  (or arg
-      (not (looking-back "[^<]<<"))
+  (or arg (sh--maybe-here-document)))
+(make-obsolete 'sh--maybe-here-document
+               'sh-electric-here-document-mode "24.2")
+
+(defun sh--maybe-here-document ()
+  (or (not (looking-back "[^<]<<"))
       (save-excursion
        (backward-char 2)
        (sh-quoted-p))
@@ -3678,6 +4093,12 @@ The document is bounded by `sh-here-document-word'."
           (insert ?\n tabs (replace-regexp-in-string
                             "\\`-?[ \t]*" "" delim))))))
 
+(define-minor-mode sh-electric-here-document-mode
+  "Make << insert a here document skeleton."
+  nil nil nil
+  (if sh-electric-here-document-mode
+      (add-hook 'post-self-insert-hook #'sh--maybe-here-document nil t)
+    (remove-hook 'post-self-insert-hook #'sh--maybe-here-document t)))
 \f
 ;; various other commands
 
@@ -3696,12 +4117,14 @@ The document is bounded by `sh-here-document-word'."
 
 
 (defun sh-beginning-of-command ()
+  ;; FIXME: Redefine using SMIE.
   "Move point to successive beginnings of commands."
   (interactive)
   (if (re-search-backward sh-beginning-of-command nil t)
       (goto-char (match-beginning 2))))
 
 (defun sh-end-of-command ()
+  ;; FIXME: Redefine using SMIE.
   "Move point to successive ends of commands."
   (interactive)
   (if (re-search-forward sh-end-of-command nil t)
index 7536126e8f1153e7109fc0248dfcde4cc7552db9..2adb34c782463d65e04ce4087120f500c9e2f1fa 100644 (file)
@@ -48,7 +48,7 @@ Otherwise TAB indents only when point is within
 the run of whitespace at the beginning of the line.")
 
 (defcustom simula-tab-always-indent simula-tab-always-indent-default
-  "*Non-nil means TAB in SIMULA mode should always reindent the current line.
+  "Non-nil means TAB in SIMULA mode should always reindent the current line.
 Otherwise TAB indents only when point is within
 the run of whitespace at the beginning of the line."
   :type 'boolean
@@ -58,7 +58,7 @@ the run of whitespace at the beginning of the line."
   "Indentation of SIMULA statements with respect to containing block.")
 
 (defcustom simula-indent-level simula-indent-level-default
-  "*Indentation of SIMULA statements with respect to containing block."
+  "Indentation of SIMULA statements with respect to containing block."
   :type 'integer
   :group 'simula)
 
@@ -67,7 +67,7 @@ the run of whitespace at the beginning of the line."
   "Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE.")
 
 (defcustom simula-substatement-offset simula-substatement-offset-default
-  "*Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE."
+  "Extra indentation after DO, THEN, ELSE, WHEN and OTHERWISE."
   :type 'integer
   :group 'simula)
 
@@ -79,7 +79,7 @@ the previous line of the statement.")
 
 (defcustom simula-continued-statement-offset
   simula-continued-statement-offset-default
-  "*Extra indentation for lines not starting a statement or substatement.
+  "Extra indentation for lines not starting a statement or substatement.
 If value is a list, each line in a multipleline continued statement
 will have the car of the list extra indentation with respect to
 the previous line of the statement."
@@ -90,7 +90,7 @@ the previous line of the statement."
   "Offset of SIMULA label lines relative to usual indentation.")
 
 (defcustom simula-label-offset simula-label-offset-default
-  "*Offset of SIMULA label lines relative to usual indentation."
+  "Offset of SIMULA label lines relative to usual indentation."
   :type 'integer
   :group 'simula)
 
@@ -100,7 +100,7 @@ Value is a cons cell, the car is extra THEN indentation and the cdr
 extra ELSE indentation.  IF after ELSE is indented as the starting IF.")
 
 (defcustom simula-if-indent simula-if-indent-default
-  "*Extra indentation of THEN and ELSE with respect to the starting IF.
+  "Extra indentation of THEN and ELSE with respect to the starting IF.
 Value is a cons cell, the car is extra THEN indentation and the cdr
 extra ELSE indentation.  IF after ELSE is indented as the starting IF."
   :type '(cons integer integer)
@@ -112,7 +112,7 @@ Value is a cons cell, the car is extra WHEN indentation
 and the cdr extra OTHERWISE indentation.")
 
 (defcustom simula-inspect-indent simula-inspect-indent-default
-  "*Extra indentation of WHEN and OTHERWISE with respect to the INSPECT.
+  "Extra indentation of WHEN and OTHERWISE with respect to the INSPECT.
 Value is a cons cell, the car is extra WHEN indentation
 and the cdr extra OTHERWISE indentation."
   :type '(cons integer integer)
@@ -122,7 +122,7 @@ and the cdr extra OTHERWISE indentation."
   "Non-nil means `simula-indent-line' function may reindent previous line.")
 
 (defcustom simula-electric-indent simula-electric-indent-default
-  "*Non-nil means `simula-indent-line' function may reindent previous line."
+  "Non-nil means `simula-indent-line' function may reindent previous line."
   :type 'boolean
   :group 'simula)
 
@@ -132,7 +132,7 @@ Value is one of the symbols `upcase', `downcase', `capitalize',
 \(as in) `abbrev-table' or nil if they should not be changed.")
 
 (defcustom simula-abbrev-keyword simula-abbrev-keyword-default
-  "*Specify how to convert case for SIMULA keywords.
+  "Specify how to convert case for SIMULA keywords.
 Value is one of the symbols `upcase', `downcase', `capitalize',
 \(as in) `abbrev-table' or nil if they should not be changed."
   :type '(choice (const upcase) (const downcase) (const capitalize)(const nil))
@@ -144,7 +144,7 @@ Value is one of the symbols `upcase', `downcase', `capitalize',
 \(as in) `abbrev-table', or nil if they should not be changed.")
 
 (defcustom simula-abbrev-stdproc simula-abbrev-stdproc-default
-  "*Specify how to convert case for standard SIMULA procedure and class names.
+  "Specify how to convert case for standard SIMULA procedure and class names.
 Value is one of the symbols `upcase', `downcase', `capitalize',
 \(as in) `abbrev-table', or nil if they should not be changed."
   :type '(choice (const upcase) (const downcase) (const capitalize)
@@ -152,7 +152,7 @@ Value is one of the symbols `upcase', `downcase', `capitalize',
   :group 'simula)
 
 (defcustom simula-abbrev-file nil
-  "*File with extra abbrev definitions for use in SIMULA mode.
+  "File with extra abbrev definitions for use in SIMULA mode.
 These are used together with the standard abbrev definitions for SIMULA.
 Please note that the standard definitions are required
 for SIMULA mode to function correctly."
index 56f42e31cf108f111eaa4319277627eb5dbbe747..030cc02f3f4752de898ca82fc7477ca1f08e7f08 100644 (file)
@@ -2856,7 +2856,7 @@ appended to the SQLi buffer without disturbing your SQL buffer."
 (defun sql-get-login-ext (symbol prompt history-var plist)
   "Prompt user with extended login parameters.
 
-The global value of SYMBOL is the last value and the global value 
+The global value of SYMBOL is the last value and the global value
 of the SYMBOL is set based on the user's input.
 
 If PLIST is nil, then the user is simply prompted for a string
@@ -2871,7 +2871,7 @@ regexp pattern specified in its value.
 The `:completion' property prompts for a string specified by its
 value.  (The property value is used as the PREDICATE argument to
 `completing-read'.)"
-  (set-default 
+  (set-default
    symbol
    (let* ((default (plist-get plist :default))
           (last-value (default-value symbol))
@@ -4146,10 +4146,12 @@ PRODUCT is the SQL product.  PARAMS is a list of strings which are
 passed as command line arguments."
   (let ((program (sql-get-product-feature product :sqli-program))
         (buf-name "SQL"))
-    ;; make sure we can find the program
-    (unless (executable-find program)
+    ;; Make sure we can find the program.  `executable-find' does not
+    ;; work for remote hosts; we suppress the check there.
+    (unless (or (file-remote-p default-directory)
+               (executable-find program))
       (error "Unable to locate SQL program \'%s\'" program))
-    ;; Make sure buffer name is unique
+    ;; Make sure buffer name is unique.
     (when (sql-buffer-live-p (format "*%s*" buf-name))
       (setq buf-name (format "SQL-%s" product))
       (when (sql-buffer-live-p (format "*%s*" buf-name))
index 0198b32ec9fe0e2254defffa49b6f6f825c5e455..f1ab01fd07f27961d631ff6792f3762f60dad503 100644 (file)
   :group 'languages)
 
 (defcustom tcl-indent-level 4
-  "*Indentation of Tcl statements with respect to containing block."
+  "Indentation of Tcl statements with respect to containing block."
   :type 'integer
   :group 'tcl)
 (put 'tcl-indent-level 'safe-local-variable 'integerp)
 
 (defcustom tcl-continued-indent-level 4
-  "*Indentation of continuation line relative to first line of command."
+  "Indentation of continuation line relative to first line of command."
   :type 'integer
   :group 'tcl)
 (put 'tcl-continued-indent-level 'safe-local-variable 'integerp)
 
 (defcustom tcl-auto-newline nil
-  "*Non-nil means automatically newline before and after braces you insert."
+  "Non-nil means automatically newline before and after braces you insert."
   :type 'boolean
   :group 'tcl)
 
 (defcustom tcl-tab-always-indent tab-always-indent
-  "*Control effect of TAB key.
+  "Control effect of TAB key.
 If t (the default), always indent current line.
 If nil and point is not in the indentation area at the beginning of
 the line, a TAB is inserted.
@@ -157,7 +157,7 @@ to take place:
 
 
 (defcustom tcl-electric-hash-style nil ;; 'smart
-  "*Style of electric hash insertion to use.
+  "Style of electric hash insertion to use.
 Possible values are `backslash', meaning that `\\' quoting should be
 done; `quote', meaning that `\"' quoting should be done; `smart',
 meaning that the choice between `backslash' and `quote' should be
@@ -168,27 +168,27 @@ taken to mean `smart'.  The default is nil."
   :group 'tcl)
 
 (defcustom tcl-help-directory-list nil
-  "*List of topmost directories containing TclX help files."
+  "List of topmost directories containing TclX help files."
   :type '(repeat directory)
   :group 'tcl)
 
 (defcustom tcl-use-smart-word-finder t
-  "*If not nil, use smart way to find current word, for Tcl help feature."
+  "If not nil, use smart way to find current word, for Tcl help feature."
   :type 'boolean
   :group 'tcl)
 
 (defcustom tcl-application "wish"
-  "*Name of Tcl program to run in inferior Tcl mode."
+  "Name of Tcl program to run in inferior Tcl mode."
   :type 'string
   :group 'tcl)
 
 (defcustom tcl-command-switches nil
-  "*List of switches to supply to the `tcl-application' program."
+  "List of switches to supply to the `tcl-application' program."
   :type '(repeat string)
   :group 'tcl)
 
 (defcustom tcl-prompt-regexp "^\\(% \\|\\)"
-  "*If not nil, a regexp that will match the prompt in the inferior process.
+  "If not nil, a regexp that will match the prompt in the inferior process.
 If nil, the prompt is the name of the application with \">\" appended.
 
 The default is \"^\\(% \\|\\)\", which will match the default primary
@@ -197,7 +197,7 @@ and secondary prompts for tclsh and wish."
   :group 'tcl)
 
 (defcustom inferior-tcl-source-command "source %s\n"
-  "*Format-string for building a Tcl command to load a file.
+  "Format-string for building a Tcl command to load a file.
 This format string should use `%s' to substitute a file name
 and should result in a Tcl expression that will command the
 inferior Tcl to load that file.  The filename will be appropriately
@@ -301,7 +301,7 @@ quoted for Tcl."
     ["Tcl help" tcl-help-on-word tcl-help-directory-list]))
 
 (defvar inferior-tcl-buffer nil
-  "*The current inferior-tcl process buffer.
+  "The current inferior-tcl process buffer.
 
 MULTIPLE PROCESS SUPPORT
 ===========================================================================
index 7f3f99f5cfbb739781de04b389ac0fff1cf8ce95..31f2fc1fe319926510572a84cadfb0d52e3d2164 100644 (file)
   :group 'languages)
 
 (defcustom vera-basic-offset 2
-  "*Amount of basic offset used for indentation."
+  "Amount of basic offset used for indentation."
   :type 'integer
   :group 'vera)
 
 (defcustom vera-underscore-is-part-of-word nil
-  "*Non-nil means consider the underscore character `_' as part of word.
+  "Non-nil means consider the underscore character `_' as part of word.
 An identifier containing underscores is then treated as a single word in
 select and move operations.  All parts of an identifier separated by underscore
 are treated as single words otherwise."
@@ -103,7 +103,7 @@ are treated as single words otherwise."
   :group 'vera)
 
 (defcustom vera-intelligent-tab t
-  "*Non-nil means `TAB' does indentation, word completion and tab insertion.
+  "Non-nil means `TAB' does indentation, word completion and tab insertion.
 That is, if preceding character is part of a word then complete word,
 else if not at beginning of line then insert tab,
 else if last command was a `TAB' or `RET' then dedent one step,
@@ -670,23 +670,23 @@ Adapted from `font-lock-match-c-style-declaration-item-and-skip-to-next'."
   "Face name to use for interface names.")
 
 (defface vera-font-lock-number
-  '((((class color) (background light)) (:foreground "Gold4"))
-    (((class color) (background dark)) (:foreground "BurlyWood1"))
-    (t (:italic t :bold t)))
+  '((((class color) (background light)) :foreground "Gold4")
+    (((class color) (background dark))  :foreground "BurlyWood1")
+    (t :slant italic :weight bold))
   "Font lock mode face used to highlight @ definitions."
   :group 'font-lock-highlighting-faces)
 
 (defface vera-font-lock-function
-  '((((class color) (background light)) (:foreground "DarkCyan"))
-    (((class color) (background dark)) (:foreground "Orchid1"))
-    (t (:italic t :bold t)))
+  '((((class color) (background light)) :foreground "DarkCyan")
+    (((class color) (background dark))  :foreground "Orchid1")
+    (t :slant italic :weight bold))
   "Font lock mode face used to highlight predefined functions and tasks."
   :group 'font-lock-highlighting-faces)
 
 (defface vera-font-lock-interface
-  '((((class color) (background light)) (:foreground "Grey40"))
-    (((class color) (background dark)) (:foreground "Grey80"))
-    (t (:italic t :bold t)))
+  '((((class color) (background light)) :foreground "Grey40")
+    (((class color) (background dark))  :foreground "Grey80")
+    (t :slant italic :weight bold))
   "Font lock mode face used to highlight interface names."
   :group 'font-lock-highlighting-faces)
 
index 73e3cd9980f036d929545111a5103297eaf027c0..c072754e66d35275c1fd84a6c206d426eee94794 100644 (file)
 ;;; Code:
 
 ;; This variable will always hold the version number of the mode
-(defconst verilog-mode-version "725"
+(defconst verilog-mode-version "800"
   "Version of this Verilog mode.")
-(defconst verilog-mode-release-date "2011-11-27-GNU"
+(defconst verilog-mode-release-date "2012-04-23-GNU"
   "Release date of this Verilog mode.")
 (defconst verilog-mode-release-emacs t
   "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -393,7 +393,7 @@ Set `verilog-in-hooks' during this time, to assist AUTO caches."
     (parse-partial-sexp (point-min) (or pos (point)))))
 
 (defgroup verilog-mode nil
-  "Facilitates easy editing of Verilog source text."
+  "Major mode for Verilog source code."
   :version "22.2"
   :group 'languages)
 
@@ -415,11 +415,14 @@ Set `verilog-in-hooks' during this time, to assist AUTO caches."
   :group 'verilog-mode)
 
 (defvar verilog-debug nil
-  "If set, enable debug messages for `verilog-mode' internals.")
+  "Non-nil means enable debug messages for `verilog-mode' internals.")
+
+(defvar verilog-warn-fatal nil
+  "Non-nil means `verilog-warn-error' warnings are fatal `error's.")
 
 (defcustom verilog-linter
   "echo 'No verilog-linter set, see \"M-x describe-variable verilog-linter\"'"
-  "*Unix program and arguments to call to run a lint checker on Verilog source.
+  "Unix program and arguments to call to run a lint checker on Verilog source.
 Depending on the `verilog-set-compile-command', this may be invoked when
 you type \\[compile].  When the compile completes, \\[next-error] will take
 you to the next lint error."
@@ -429,7 +432,7 @@ you to the next lint error."
 
 (defcustom verilog-coverage
   "echo 'No verilog-coverage set, see \"M-x describe-variable verilog-coverage\"'"
-  "*Program and arguments to use to annotate for coverage Verilog source.
+  "Program and arguments to use to annotate for coverage Verilog source.
 Depending on the `verilog-set-compile-command', this may be invoked when
 you type \\[compile].  When the compile completes, \\[next-error] will take
 you to the next lint error."
@@ -439,7 +442,7 @@ you to the next lint error."
 
 (defcustom verilog-simulator
   "echo 'No verilog-simulator set, see \"M-x describe-variable verilog-simulator\"'"
-  "*Program and arguments to use to interpret Verilog source.
+  "Program and arguments to use to interpret Verilog source.
 Depending on the `verilog-set-compile-command', this may be invoked when
 you type \\[compile].  When the compile completes, \\[next-error] will take
 you to the next lint error."
@@ -449,7 +452,7 @@ you to the next lint error."
 
 (defcustom verilog-compiler
   "echo 'No verilog-compiler set, see \"M-x describe-variable verilog-compiler\"'"
-  "*Program and arguments to use to compile Verilog source.
+  "Program and arguments to use to compile Verilog source.
 Depending on the `verilog-set-compile-command', this may be invoked when
 you type \\[compile].  When the compile completes, \\[next-error] will take
 you to the next lint error."
@@ -460,7 +463,7 @@ you to the next lint error."
 (defcustom verilog-preprocessor
   ;; Very few tools give preprocessed output, so we'll default to Verilog-Perl
   "vppreproc __FLAGS__ __FILE__"
-  "*Program and arguments to use to preprocess Verilog source.
+  "Program and arguments to use to preprocess Verilog source.
 This is invoked with `verilog-preprocess', and depending on the
 `verilog-set-compile-command', may also be invoked when you type
 \\[compile].  When the compile completes, \\[next-error] will
@@ -480,7 +483,7 @@ Alternatively use the \"Choose Compilation Action\" menu.  See
 `verilog-set-compile-command' for more information.")
 
 (defcustom verilog-highlight-translate-off nil
-  "*Non-nil means background-highlight code excluded from translation.
+  "Non-nil means background-highlight code excluded from translation.
 That is, all code between \"// synopsys translate_off\" and
 \"// synopsys translate_on\" is highlighted using a different background color
 \(face `verilog-font-lock-translate-off-face').
@@ -495,7 +498,7 @@ entry \"Fontify Buffer\").  XEmacs: turn off and on font locking."
 (put 'verilog-highlight-translate-off 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-lineup 'declarations
-  "*Type of statements to lineup across multiple lines.
+  "Type of statements to lineup across multiple lines.
 If 'all' is selected, then all line ups described below are done.
 
 If 'declaration', then just declarations are lined up with any
@@ -524,15 +527,17 @@ are lineup only when \\[verilog-pretty-declarations] is typed."
                (const :tag "Line up Declarations" declarations)
                (function :tag "Other"))
   :group 'verilog-mode-indent )
+(put 'verilog-auto-lineup 'safe-local-variable
+     '(lambda (x) (memq x '(nil all assignments declarations))))
 
 (defcustom verilog-indent-level 3
-  "*Indentation of Verilog statements with respect to containing block."
+  "Indentation of Verilog statements with respect to containing block."
   :group 'verilog-mode-indent
   :type 'integer)
 (put 'verilog-indent-level 'safe-local-variable 'integerp)
 
 (defcustom verilog-indent-level-module 3
-  "*Indentation of Module level Verilog statements (eg always, initial).
+  "Indentation of Module level Verilog statements (eg always, initial).
 Set to 0 to get initial and always statements lined up on the left side of
 your screen."
   :group 'verilog-mode-indent
@@ -540,14 +545,14 @@ your screen."
 (put 'verilog-indent-level-module 'safe-local-variable 'integerp)
 
 (defcustom verilog-indent-level-declaration 3
-  "*Indentation of declarations with respect to containing block.
+  "Indentation of declarations with respect to containing block.
 Set to 0 to get them list right under containing block."
   :group 'verilog-mode-indent
   :type 'integer)
 (put 'verilog-indent-level-declaration 'safe-local-variable 'integerp)
 
 (defcustom verilog-indent-declaration-macros nil
-  "*How to treat macro expansions in a declaration.
+  "How to treat macro expansions in a declaration.
 If nil, indent as:
        input [31:0] a;
        input        `CP;
@@ -561,7 +566,7 @@ If non nil, treat as:
 (put 'verilog-indent-declaration-macros 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-indent-lists t
-  "*How to treat indenting items in a list.
+  "How to treat indenting items in a list.
 If t (the default), indent as:
        always @( posedge a or
                  reset ) begin
@@ -574,73 +579,72 @@ If nil, treat as:
 (put 'verilog-indent-lists 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-indent-level-behavioral 3
-  "*Absolute indentation of first begin in a task or function block.
+  "Absolute indentation of first begin in a task or function block.
 Set to 0 to get such code to start at the left side of the screen."
   :group 'verilog-mode-indent
   :type 'integer)
 (put 'verilog-indent-level-behavioral 'safe-local-variable 'integerp)
 
 (defcustom verilog-indent-level-directive 1
-  "*Indentation to add to each level of `ifdef declarations.
+  "Indentation to add to each level of `ifdef declarations.
 Set to 0 to have all directives start at the left side of the screen."
   :group 'verilog-mode-indent
   :type 'integer)
 (put 'verilog-indent-level-directive 'safe-local-variable 'integerp)
 
 (defcustom verilog-cexp-indent 2
-  "*Indentation of Verilog statements split across lines."
+  "Indentation of Verilog statements split across lines."
   :group 'verilog-mode-indent
   :type 'integer)
 (put 'verilog-cexp-indent 'safe-local-variable 'integerp)
 
 (defcustom verilog-case-indent 2
-  "*Indentation for case statements."
+  "Indentation for case statements."
   :group 'verilog-mode-indent
   :type 'integer)
 (put 'verilog-case-indent 'safe-local-variable 'integerp)
 
 (defcustom verilog-auto-newline t
-  "*True means automatically newline after semicolons."
+  "Non-nil means automatically newline after semicolons."
   :group 'verilog-mode-indent
   :type 'boolean)
 (put 'verilog-auto-newline 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-indent-on-newline t
-  "*True means automatically indent line after newline."
+  "Non-nil means automatically indent line after newline."
   :group 'verilog-mode-indent
   :type 'boolean)
 (put 'verilog-auto-indent-on-newline 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-tab-always-indent t
-  "*True means TAB should always re-indent the current line.
+  "Non-nil means TAB should always re-indent the current line.
 A nil value means TAB will only reindent when at the beginning of the line."
   :group 'verilog-mode-indent
   :type 'boolean)
 (put 'verilog-tab-always-indent 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-tab-to-comment nil
-  "*True means TAB moves to the right hand column in preparation for a comment."
+  "Non-nil means TAB moves to the right hand column in preparation for a comment."
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-tab-to-comment 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-indent-begin-after-if t
-  "*If true, indent begin statements following if, else, while, for and repeat.
+  "Non-nil means indent begin statements following if, else, while, etc.
 Otherwise, line them up."
   :group 'verilog-mode-indent
   :type 'boolean)
 (put 'verilog-indent-begin-after-if 'safe-local-variable 'verilog-booleanp)
 
-
 (defcustom verilog-align-ifelse nil
-  "*If true, align `else' under matching `if'.
+  "Non-nil means align `else' under matching `if'.
 Otherwise else is lined up with first character on line holding matching if."
   :group 'verilog-mode-indent
   :type 'boolean)
 (put 'verilog-align-ifelse 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-minimum-comment-distance 10
-  "*Minimum distance (in lines) between begin and end required before a comment.
+  "Minimum distance (in lines) between begin and end required before a comment.
 Setting this variable to zero results in every end acquiring a comment; the
 default avoids too many redundant comments in tight quarters."
   :group 'verilog-mode-indent
@@ -648,7 +652,7 @@ default avoids too many redundant comments in tight quarters."
 (put 'verilog-minimum-comment-distance 'safe-local-variable 'integerp)
 
 (defcustom verilog-highlight-p1800-keywords nil
-  "*True means highlight words newly reserved by IEEE-1800.
+  "Non-nil means highlight words newly reserved by IEEE-1800.
 These will appear in `verilog-font-lock-p1800-face' in order to gently
 suggest changing where these words are used as variables to something else.
 A nil value means highlight these words as appropriate for the SystemVerilog
@@ -659,7 +663,7 @@ to see the effect as font color choices are cached by Emacs."
 (put 'verilog-highlight-p1800-keywords 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-highlight-grouping-keywords nil
-  "*True means highlight grouping keywords 'begin' and 'end' more dramatically.
+  "Non-nil means highlight grouping keywords 'begin' and 'end' more dramatically.
 If false, these words are in the `font-lock-type-face'; if True then they are in
 `verilog-font-lock-ams-face'.  Some find that special highlighting on these
 grouping constructs allow the structure of the code to be understood at a glance."
@@ -668,7 +672,7 @@ grouping constructs allow the structure of the code to be understood at a glance
 (put 'verilog-highlight-grouping-keywords 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-highlight-modules nil
-  "*True means highlight module statements for `verilog-load-file-at-point'.
+  "Non-nil means highlight module statements for `verilog-load-file-at-point'.
 When true, mousing over module names will allow jumping to the
 module definition.  If false, this is not supported.  Setting
 this is experimental, and may lead to bad performance."
@@ -677,7 +681,7 @@ this is experimental, and may lead to bad performance."
 (put 'verilog-highlight-modules 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-highlight-includes t
-  "*True means highlight module statements for `verilog-load-file-at-point'.
+  "Non-nil means highlight module statements for `verilog-load-file-at-point'.
 When true, mousing over include file names will allow jumping to the
 file referenced.  If false, this is not supported."
   :group 'verilog-mode-indent
@@ -685,39 +689,39 @@ file referenced.  If false, this is not supported."
 (put 'verilog-highlight-includes 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-declare-nettype nil
-  "*Non-nil specifies the data type to use with `verilog-auto-input' etc.
+  "Non-nil specifies the data type to use with `verilog-auto-input' etc.
 Set this to \"wire\" if the Verilog code uses \"`default_nettype
 none\".  Note using `default_nettype none isn't recommended practice; this
 mode is experimental."
-  :version "24.1"
+  :version "24.1"  ;; rev670
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-declare-nettype 'safe-local-variable `stringp)
 
 (defcustom verilog-auto-wire-type nil
-  "*Non-nil specifies the data type to use with `verilog-auto-wire' etc.
+  "Non-nil specifies the data type to use with `verilog-auto-wire' etc.
 Set this to \"logic\" for SystemVerilog code, or use `verilog-auto-logic'."
-  :version "24.1"
+  :version "24.1"  ;; rev673
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-wire-type 'safe-local-variable `stringp)
 
 (defcustom verilog-auto-endcomments t
-  "*True means insert a comment /* ... */ after 'end's.
+  "Non-nil means insert a comment /* ... */ after 'end's.
 The name of the function or case will be set between the braces."
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-endcomments 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-delete-trailing-whitespace nil
-  "*True means to `delete-trailing-whitespace' in `verilog-auto'."
-  :version "24.1"
+  "Non-nil means to `delete-trailing-whitespace' in `verilog-auto'."
+  :version "24.1"  ;; rev703
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-delete-trailing-whitespace 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-ignore-concat nil
-  "*True means ignore signals in {...} concatenations for AUTOWIRE etc.
+  "Non-nil means ignore signals in {...} concatenations for AUTOWIRE etc.
 This will exclude signals referenced as pin connections in {...}
 from AUTOWIRE, AUTOOUTPUT and friends.  This flag should be set
 for backward compatibility only and not set in new designs; it
@@ -727,7 +731,7 @@ may be removed in future versions."
 (put 'verilog-auto-ignore-concat 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-read-includes nil
-  "*True means to automatically read includes before AUTOs.
+  "Non-nil means to automatically read includes before AUTOs.
 This will do a `verilog-read-defines' and `verilog-read-includes' before
 each AUTO expansion.  This makes it easier to embed defines and includes,
 but can result in very slow reading times if there are many or large
@@ -737,7 +741,7 @@ include files."
 (put 'verilog-auto-read-includes 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-save-policy nil
-  "*Non-nil indicates action to take when saving a Verilog buffer with AUTOs.
+  "Non-nil indicates action to take when saving a Verilog buffer with AUTOs.
 A value of `force' will always do a \\[verilog-auto] automatically if
 needed on every save.  A value of `detect' will do \\[verilog-auto]
 automatically when it thinks necessary.  A value of `ask' will query the
@@ -750,15 +754,15 @@ sub-module's port list has changed."
   :type '(choice (const nil) (const ask) (const detect) (const force)))
 
 (defcustom verilog-auto-star-expand t
-  "*Non-nil indicates to expand a SystemVerilog .* instance ports.
-They will be expanded in the same way as if there was a AUTOINST in the
+  "Non-nil means to expand SystemVerilog .* instance ports.
+They will be expanded in the same way as if there was an AUTOINST in the
 instantiation.  See also `verilog-auto-star' and `verilog-auto-star-save'."
   :group 'verilog-mode-actions
   :type 'boolean)
 (put 'verilog-auto-star-expand 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-star-save nil
-  "*Non-nil indicates to save to disk SystemVerilog .* instance expansions.
+  "Non-nil means save to disk SystemVerilog .* instance expansions.
 A nil value indicates direct connections will be removed before saving.
 Only meaningful to those created due to `verilog-auto-star-expand' being set.
 
@@ -775,7 +779,7 @@ always be saved."
   "Text from file-local-variables during last evaluation.")
 
 (defvar verilog-diff-function 'verilog-diff-report
-  "*Function to run when `verilog-diff-auto' detects differences.
+  "Function to run when `verilog-diff-auto' detects differences.
 Function takes three arguments, the original buffer, the
 difference buffer, and the point in original buffer with the
 first difference.")
@@ -869,11 +873,11 @@ See `compilation-error-regexp-alist-alist' for the formatting.  For XEmacs.")
     ("^In file \\([^ \t]+\\)[ \t]+line[ \t]+\\([0-9]+\\):\n[^\n]*\n[^\n]*\n\\(Warning\\|Error\\|Failure\\)[^\n]*" 1 bold t)
     ("^In file \\([^ \t]+\\)[ \t]+line[ \t]+\\([0-9]+\\):\n[^\n]*\n[^\n]*\n\\(Warning\\|Error\\|Failure\\)[^\n]*" 2 bold t)
     )
-  "*Keywords to also highlight in Verilog *compilation* buffers.
+  "Keywords to also highlight in Verilog *compilation* buffers.
 Only used in XEmacs; GNU Emacs uses `verilog-error-regexp-emacs-alist'.")
 
 (defcustom verilog-library-flags '("")
-  "*List of standard Verilog arguments to use for /*AUTOINST*/.
+  "List of standard Verilog arguments to use for /*AUTOINST*/.
 These arguments are used to find files for `verilog-auto', and match
 the flags accepted by a standard Verilog-XL simulator.
 
@@ -904,7 +908,7 @@ See also the variables mentioned above."
 (put 'verilog-library-flags 'safe-local-variable 'listp)
 
 (defcustom verilog-library-directories '(".")
-  "*List of directories when looking for files for /*AUTOINST*/.
+  "List of directories when looking for files for /*AUTOINST*/.
 The directory may be relative to the current file, or absolute.
 Environment variables are also expanded in the directory names.
 Having at least the current directory is a good idea.
@@ -927,7 +931,7 @@ and `verilog-library-extensions'."
 (put 'verilog-library-directories 'safe-local-variable 'listp)
 
 (defcustom verilog-library-files '()
-  "*List of files to search for modules.
+  "List of files to search for modules.
 AUTOINST will use this when it needs to resolve a module name.
 This is a complete path, usually to a technology file with many standard
 cells defined in it.
@@ -949,14 +953,14 @@ See also `verilog-library-flags', `verilog-library-directories'."
 (put 'verilog-library-files 'safe-local-variable 'listp)
 
 (defcustom verilog-library-extensions '(".v" ".sv")
-  "*List of extensions to use when looking for files for /*AUTOINST*/.
+  "List of extensions to use when looking for files for /*AUTOINST*/.
 See also `verilog-library-flags', `verilog-library-directories'."
   :type '(repeat string)
   :group 'verilog-mode-auto)
 (put 'verilog-library-extensions 'safe-local-variable 'listp)
 
 (defcustom verilog-active-low-regexp nil
-  "*If set, treat signals matching this regexp as active low.
+  "If set, treat signals matching this regexp as active low.
 This is used for AUTORESET and AUTOTIEOFF.  For proper behavior,
 you will probably also need `verilog-auto-reset-widths' set."
   :group 'verilog-mode-auto
@@ -964,7 +968,7 @@ you will probably also need `verilog-auto-reset-widths' set."
 (put 'verilog-active-low-regexp 'safe-local-variable 'stringp)
 
 (defcustom verilog-auto-sense-include-inputs nil
-  "*If true, AUTOSENSE should include all inputs.
+  "Non-nil means AUTOSENSE should include all inputs.
 If nil, only inputs that are NOT output signals in the same block are
 included."
   :group 'verilog-mode-auto
@@ -972,7 +976,7 @@ included."
 (put 'verilog-auto-sense-include-inputs 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-sense-defines-constant nil
-  "*If true, AUTOSENSE should assume all defines represent constants.
+  "Non-nil means AUTOSENSE should assume all defines represent constants.
 When true, the defines will not be included in sensitivity lists.  To
 maintain compatibility with other sites, this should be set at the bottom
 of each Verilog file that requires it, rather than being set globally."
@@ -981,37 +985,45 @@ of each Verilog file that requires it, rather than being set globally."
 (put 'verilog-auto-sense-defines-constant 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-reset-blocking-in-non t
-  "*If true, AUTORESET will reset those signals which were
-assigned with blocking assignments (=) even in a block with
-non-blocking assignments (<=).
+  "Non-nil means AUTORESET will reset blocking statements.
+When true, AUTORESET will reset in blocking statements those
+signals which were assigned with blocking assignments (=) even in
+a block with non-blocking assignments (<=).
 
 If nil, all blocking assigned signals are ignored when any
 non-blocking assignment is in the AUTORESET block.  This allows
 blocking assignments to be used for temporary values and not have
 those temporaries reset.  See example in `verilog-auto-reset'."
-  :version "24.1"
+  :version "24.1"  ;; rev718
   :type 'boolean
   :group 'verilog-mode-auto)
 (put 'verilog-auto-reset-blocking-in-non 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-reset-widths t
-  "*If true, AUTORESET should determine the width of signals.
+  "True means AUTORESET should determine the width of signals.
 This is then used to set the width of the zero (32'h0 for example).  This
 is required by some lint tools that aren't smart enough to ignore widths of
-the constant zero.  This may result in ugly code when parameters determine
-the MSB or LSB of a signal inside an AUTORESET."
+the constant zero. This may result in ugly code when parameters determine
+the MSB or LSB of a signal inside an AUTORESET.
+
+If nil, AUTORESET uses \"0\" as the constant.
+
+If 'unbased', AUTORESET used the unbased unsized literal \"'0\"
+as the constant. This setting is strongly recommended for
+SystemVerilog designs."
   :type 'boolean
   :group 'verilog-mode-auto)
-(put 'verilog-auto-reset-widths 'safe-local-variable 'verilog-booleanp)
+(put 'verilog-auto-reset-widths 'safe-local-variable
+     '(lambda (x) (memq x '(nil t unbased))))
 
 (defcustom verilog-assignment-delay ""
-  "*Text used for delays in delayed assignments.  Add a trailing space if set."
+  "Text used for delays in delayed assignments.  Add a trailing space if set."
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-assignment-delay 'safe-local-variable 'stringp)
 
 (defcustom verilog-auto-arg-sort nil
-  "*If set, AUTOARG signal names will be sorted, not in declaration order.
+  "Non-nil means AUTOARG signal names will be sorted, not in declaration order.
 Declaration order is advantageous with order based instantiations
 and is the default for backward compatibility.  Sorted order
 reduces changes when declarations are moved around in a file, and
@@ -1023,7 +1035,7 @@ See also `verilog-auto-inst-sort'."
 (put 'verilog-auto-arg-sort 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-inst-dot-name nil
-  "*If true, when creating ports with AUTOINST, use .name syntax.
+  "Non-nil means when creating ports with AUTOINST, use .name syntax.
 This will use \".port\" instead of \".port(port)\" when possible.
 This is only legal in SystemVerilog files, and will confuse older
 simulators.  Setting `verilog-auto-inst-vector' to nil may also
@@ -1033,7 +1045,7 @@ be desirable to increase how often .name will be used."
 (put 'verilog-auto-inst-dot-name 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-inst-param-value nil
-  "*If set, AUTOINST will replace parameters with the parameter value.
+  "Non-nil means AUTOINST will replace parameters with the parameter value.
 If nil, leave parameters as symbolic names.
 
 Parameters must be in Verilog 2001 format #(...), and if a parameter is not
@@ -1041,7 +1053,7 @@ listed as such there (as when the default value is acceptable), it will not
 be replaced, and will remain symbolic.
 
 For example, imagine a submodule uses parameters to declare the size of its
-inputs.  This is then used by a upper module:
+inputs.  This is then used by an upper module:
 
        module InstModule (o,i);
           parameter WIDTH;
@@ -1070,20 +1082,20 @@ instead expand to:
 (put 'verilog-auto-inst-param-value 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-inst-sort nil
-  "*If set, AUTOINST signal names will be sorted, not in declaration order.
+  "Non-nil means AUTOINST signals will be sorted, not in declaration order.
 Also affects AUTOINSTPARAM.  Declaration order is the default for
 backward compatibility, and as some teams prefer signals that are
 declared together to remain together.  Sorted order reduces
 changes when declarations are moved around in a file.
 
 See also `verilog-auto-arg-sort'."
-  :version "24.1"
+  :version "24.1"  ;; rev688
   :group 'verilog-mode-auto
   :type 'boolean)
 (put 'verilog-auto-inst-sort 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-inst-vector t
-  "*If true, when creating default ports with AUTOINST, use bus subscripts.
+  "Non-nil means when creating default ports with AUTOINST, use bus subscripts.
 If nil, skip the subscript when it matches the entire bus as declared in
 the module (AUTOWIRE signals always are subscripted, you must manually
 declare the wire to have the subscripts removed.)  Setting this to nil may
@@ -1093,7 +1105,7 @@ speed up some simulators, but is less general and harder to read, so avoid."
 (put 'verilog-auto-inst-vector 'safe-local-variable 'verilog-booleanp)
 
 (defcustom verilog-auto-inst-template-numbers nil
-  "*If true, when creating templated ports with AUTOINST, add a comment.
+  "If true, when creating templated ports with AUTOINST, add a comment.
 
 If t, the comment will add the line number of the template that
 was used for that port declaration.  This setting is suggested
@@ -1110,94 +1122,117 @@ won't merge conflict."
      '(lambda (x) (memq x '(nil t lhs))))
 
 (defcustom verilog-auto-inst-column 40
-  "*Indent-to column number for net name part of AUTOINST created pin."
+  "Indent-to column number for net name part of AUTOINST created pin."
   :group 'verilog-mode-indent
   :type 'integer)
 (put 'verilog-auto-inst-column 'safe-local-variable 'integerp)
 
+(defcustom verilog-auto-inst-interfaced-ports t
+  "Non-nil means include interfaced ports in AUTOINST expansions."
+  :group 'verilog-mode-auto
+  :type 'boolean)
+(put 'verilog-auto-inst-interfaced-ports 'safe-local-variable 'verilog-booleanp)
+
 (defcustom verilog-auto-input-ignore-regexp nil
-  "*If set, when creating AUTOINPUT list, ignore signals matching this regexp.
+  "If set, when creating AUTOINPUT list, ignore signals matching this regexp.
 See the \\[verilog-faq] for examples on using this."
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-auto-input-ignore-regexp 'safe-local-variable 'stringp)
 
 (defcustom verilog-auto-inout-ignore-regexp nil
-  "*If set, when creating AUTOINOUT list, ignore signals matching this regexp.
+  "If set, when creating AUTOINOUT list, ignore signals matching this regexp.
 See the \\[verilog-faq] for examples on using this."
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-auto-inout-ignore-regexp 'safe-local-variable 'stringp)
 
 (defcustom verilog-auto-output-ignore-regexp nil
-  "*If set, when creating AUTOOUTPUT list, ignore signals matching this regexp.
+  "If set, when creating AUTOOUTPUT list, ignore signals matching this regexp.
 See the \\[verilog-faq] for examples on using this."
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-auto-output-ignore-regexp 'safe-local-variable 'stringp)
 
+(defcustom verilog-auto-template-warn-unused nil
+  "Non-nil means report warning if an AUTO_TEMPLATE line is not used.
+This feature is not supported before Emacs 21.1 or XEmacs 21.4."
+  :group 'verilog-mode-auto
+  :type 'boolean)
+(put 'verilog-auto-template-warn-unused 'safe-local-variable 'verilog-booleanp)
+
 (defcustom verilog-auto-tieoff-declaration "wire"
-  "*Data type used for the declaration for AUTOTIEOFF.  If \"wire\" then
-create a wire, if \"assign\" create an assignment, else the data type for
-variable creation."
-  :version "24.1"
+  "Data type used for the declaration for AUTOTIEOFF.
+If \"wire\" then create a wire, if \"assign\" create an
+assignment, else the data type for variable creation."
+  :version "24.1"  ;; rev713
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-auto-tieoff-declaration 'safe-local-variable 'stringp)
 
 (defcustom verilog-auto-tieoff-ignore-regexp nil
-  "*If set, when creating AUTOTIEOFF list, ignore signals matching this regexp.
+  "If set, when creating AUTOTIEOFF list, ignore signals matching this regexp.
 See the \\[verilog-faq] for examples on using this."
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-auto-tieoff-ignore-regexp 'safe-local-variable 'stringp)
 
 (defcustom verilog-auto-unused-ignore-regexp nil
-  "*If set, when creating AUTOUNUSED list, ignore signals matching this regexp.
+  "If set, when creating AUTOUNUSED list, ignore signals matching this regexp.
 See the \\[verilog-faq] for examples on using this."
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-auto-unused-ignore-regexp 'safe-local-variable 'stringp)
 
 (defcustom verilog-typedef-regexp nil
-  "*If non-nil, regular expression that matches Verilog-2001 typedef names.
+  "If non-nil, regular expression that matches Verilog-2001 typedef names.
 For example, \"_t$\" matches typedefs named with _t, as in the C language."
   :group 'verilog-mode-auto
   :type 'string)
 (put 'verilog-typedef-regexp 'safe-local-variable 'stringp)
 
 (defcustom verilog-mode-hook   'verilog-set-compile-command
-  "*Hook run after Verilog mode is loaded."
+  "Hook run after Verilog mode is loaded."
   :type 'hook
   :group 'verilog-mode)
 
 (defcustom verilog-auto-hook nil
-  "*Hook run after `verilog-mode' updates AUTOs."
+  "Hook run after `verilog-mode' updates AUTOs."
   :group 'verilog-mode-auto
   :type 'hook)
 
 (defcustom verilog-before-auto-hook nil
-  "*Hook run before `verilog-mode' updates AUTOs."
+  "Hook run before `verilog-mode' updates AUTOs."
   :group 'verilog-mode-auto
   :type 'hook)
 
 (defcustom verilog-delete-auto-hook nil
-  "*Hook run after `verilog-mode' deletes AUTOs."
+  "Hook run after `verilog-mode' deletes AUTOs."
   :group 'verilog-mode-auto
   :type 'hook)
 
 (defcustom verilog-before-delete-auto-hook nil
-  "*Hook run before `verilog-mode' deletes AUTOs."
+  "Hook run before `verilog-mode' deletes AUTOs."
   :group 'verilog-mode-auto
   :type 'hook)
 
 (defcustom verilog-getopt-flags-hook nil
-  "*Hook run after `verilog-getopt-flags' determines the Verilog option lists."
+  "Hook run after `verilog-getopt-flags' determines the Verilog option lists."
   :group 'verilog-mode-auto
   :type 'hook)
 
 (defcustom verilog-before-getopt-flags-hook nil
-  "*Hook run before `verilog-getopt-flags' determines the Verilog option lists."
+  "Hook run before `verilog-getopt-flags' determines the Verilog option lists."
+  :group 'verilog-mode-auto
+  :type 'hook)
+
+(defcustom verilog-before-save-font-hook nil
+  "Hook run before `verilog-save-font-mods' removes highlighting."
+  :group 'verilog-mode-auto
+  :type 'hook)
+
+(defcustom verilog-after-save-font-hook nil
+  "Hook run after `verilog-save-font-mods' restores highlighting."
   :group 'verilog-mode-auto
   :type 'hook)
 
@@ -1211,17 +1246,17 @@ For example, \"_t$\" matches typedefs named with _t, as in the C language."
 ;; Customization variables:
 ;;
 (defvar verilog-date-scientific-format nil
-  "*If non-nil, dates are written in scientific format (e.g.  1997/09/17).
+  "If non-nil, dates are written in scientific format (e.g.  1997/09/17).
 If nil, in European format (e.g.  17.09.1997).  The brain-dead American
 format (e.g.  09/17/1997) is not supported.")
 
 (defvar verilog-company nil
-  "*Default name of Company for Verilog header.
+  "Default name of Company for Verilog header.
 If set will become buffer local.")
 (make-variable-buffer-local 'verilog-company)
 
 (defvar verilog-project nil
-  "*Default name of Project for Verilog header.
+  "Default name of Project for Verilog header.
 If set will become buffer local.")
 (make-variable-buffer-local 'verilog-project)
 
@@ -1430,6 +1465,8 @@ If set will become buffer local.")
        :help           "Help on AUTOSENSE - sensitivity lists for always blocks"]
       ["AUTOTIEOFF"                    (describe-function 'verilog-auto-tieoff)
        :help           "Help on AUTOTIEOFF - tying off unused outputs"]
+      ["AUTOUNDEF"                     (describe-function 'verilog-auto-undef)
+       :help           "Help on AUTOUNDEF - undefine all local defines"]
       ["AUTOUNUSED"                    (describe-function 'verilog-auto-unused)
        :help           "Help on AUTOUNUSED - terminating unused inputs"]
       ["AUTOWIRE"                      (describe-function 'verilog-auto-wire)
@@ -1552,7 +1589,7 @@ If set will become buffer local.")
 FIXEDCASE and LITERAL as in `replace-match`.  STRING is what to replace.
 The case (verilog-string-replace-matches \"o\" \"oo\" nil nil \"foobar\")
 will break, as the o's continuously replace.  xa -> x works ok though."
-  ;; Hopefully soon to a emacs built-in
+  ;; Hopefully soon to an Emacs built-in
   ;; Also note \ in the replacement prevent multiple replacements; IE
   ;;   (verilog-string-replace-matches "@" "\\\\([0-9]+\\\\)" nil nil "wire@_@")
   ;;   Gives "wire\([0-9]+\)_@" not "wire\([0-9]+\)_\([0-9]+\)"
@@ -2401,7 +2438,6 @@ find the errors."
           "\\|\\(\\<`[ou]vm_[a-z_]+_begin\\>\\)" ;28
            "\\|\\(\\<`vmm_[a-z_]+_member_begin\\>\\)"
           ;;
-
           ))
 
 (defconst verilog-end-block-ordered-rry
@@ -2629,11 +2665,11 @@ find the errors."
        "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass"
        ))))
 (defconst verilog-disable-fork-re "\\(disable\\|wait\\)\\s-+fork\\>")
-(defconst verilog-extended-case-re "\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?")
+(defconst verilog-extended-case-re "\\(\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?\\)")
 (defconst verilog-extended-complete-re
-  (concat "\\(\\<extern\\s-+\\|\\<\\(\\<pure\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)"
-         "\\|\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)"
-         "\\|\\(\\<import\\>\\s-+\\)?\"DPI-C\"\\s-+\\(function\\>\\|task\\>\\)"
+  (concat "\\(\\(\\<extern\\s-+\\|\\<\\(\\<pure\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)"
+         "\\|\\(\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)\\)"
+         "\\|\\(\\(\\<import\\>\\s-+\\)?\\(\"DPI-C\"\\s-+\\)?\\(\\<pure\\>\\s-+\\)?\\(function\\>\\|task\\>\\)\\)"
          "\\|" verilog-extended-case-re ))
 (defconst verilog-basic-complete-re
   (eval-when-compile
@@ -2645,9 +2681,7 @@ find the errors."
        ))))
 (defconst verilog-complete-reg
   (concat
-   verilog-extended-complete-re
-   "\\|"
-   verilog-basic-complete-re))
+   verilog-extended-complete-re "\\|\\(" verilog-basic-complete-re "\\)"))
 
 (defconst verilog-end-statement-re
   (concat "\\(" verilog-beg-block-re "\\)\\|\\("
@@ -2764,7 +2798,8 @@ See also `verilog-font-lock-extra-types'.")
 (defvar verilog-font-lock-keywords-3 nil
   "Gaudy level highlighting for Verilog mode.
 See also `verilog-font-lock-extra-types'.")
-(defvar  verilog-font-lock-translate-off-face
+
+(defvar verilog-font-lock-translate-off-face
   'verilog-font-lock-translate-off-face
   "Font to use for translated off regions.")
 (defface verilog-font-lock-translate-off-face
@@ -2842,8 +2877,8 @@ See also `verilog-font-lock-extra-types'.")
        (verilog-pragma-keywords
        (eval-when-compile
          (verilog-regexp-opt
-          '("surefire" "synopsys" "rtl_synthesis" "verilint" "leda" "0in") nil
-           )))
+          '("surefire" "auto" "synopsys" "rtl_synthesis" "verilint" "leda" "0in"
+            ) nil  )))
 
        (verilog-1800-2005-keywords
        (eval-when-compile
@@ -2968,7 +3003,7 @@ See also `verilog-font-lock-extra-types'.")
        (append verilog-font-lock-keywords-1
                (list
                 ;; Fontify pragmas
-                (concat "\\(//\\s-*" verilog-pragma-keywords "\\s-.*\\)")
+                (concat "\\(//\\s-*\\(" verilog-pragma-keywords "\\)\\s-.*\\)")
                 ;; Fontify escaped names
                 '("\\(\\\\\\S-*\\s-\\)"  0 font-lock-function-name-face)
                 ;; Fontify macro definitions/ uses
@@ -3030,6 +3065,31 @@ For insignificant changes, see instead `verilog-save-buffer-state'."
          after-change-functions)
      (progn ,@body)))
 
+(defvar verilog-save-font-mod-hooked nil
+  "Local variable when inside a `verilog-save-font-mods' block.")
+(make-variable-buffer-local 'verilog-save-font-mod-hooked)
+
+(defmacro verilog-save-font-mods (&rest body)
+  "Execute BODY forms, disabling text modifications to allow performing BODY.
+Includes temporary disabling of `font-lock' to restore the buffer
+to full text form for parsing.  Additional actions may be specified with
+`verilog-before-save-font-hook' and `verilog-after-save-font-hook'."
+  ;; Before version 20, match-string with font-lock returns a
+  ;; vector that is not equal to the string.  IE if on "input"
+  ;; nil==(equal "input" (progn (looking-at "input") (match-string 0)))
+  `(let* ((hooked (unless verilog-save-font-mod-hooked
+                   (verilog-run-hooks 'verilog-before-save-font-hook)
+                   t))
+         (verilog-save-font-mod-hooked t)
+         (fontlocked (when (and (boundp 'font-lock-mode) font-lock-mode)
+                       (font-lock-mode 0)
+                       t)))
+     (unwind-protect
+          (progn ,@body)
+        ;; Unwind forms
+        (when fontlocked (font-lock-mode t))
+        (when hooked (verilog-run-hooks 'verilog-after-save-font-hook)))))
+
 ;;
 ;; Comment detection and caching
 
@@ -3161,7 +3221,7 @@ to establish comment properties on all text."
 
 (defun verilog-insert (&rest stuff)
   "Insert STUFF arguments, tracking for `verilog-inside-comment-or-string-p'.
-Any insert that includes a comment must have the entire commente
+Any insert that includes a comment must have the entire comment
 inserted using a single call to `verilog-insert'."
   (let ((pt (point)))
     (while stuff
@@ -3565,9 +3625,10 @@ Key bindings specific to `verilog-mode-map' are:
 
   ;; Stuff for GNU Emacs
   (set (make-local-variable 'font-lock-defaults)
-       `((verilog-font-lock-keywords verilog-font-lock-keywords-1
-                                     verilog-font-lock-keywords-2
-                                     verilog-font-lock-keywords-3)
+       `((verilog-font-lock-keywords
+         verilog-font-lock-keywords-1
+         verilog-font-lock-keywords-2
+         verilog-font-lock-keywords-3)
          nil nil nil
         ,(if (functionp 'syntax-ppss)
              ;; verilog-beg-of-defun uses syntax-ppss, and syntax-ppss uses
@@ -3592,7 +3653,7 @@ Key bindings specific to `verilog-mode-map' are:
   (set (make-local-variable 'imenu-generic-expression)
        verilog-imenu-generic-expression)
   ;; Tell which-func-modes that imenu knows about verilog
-  (when (boundp 'which-func-modes)
+  (when (and (boundp 'which-func-modes) (listp which-func-modes))
     (add-to-list 'which-func-modes 'verilog-mode))
   ;; hideshow support
   (when (boundp 'hs-special-modes-alist)
@@ -4049,7 +4110,7 @@ With ARG, first kill any existing labels."
                (if (looking-at verilog-label-re)
                    (setq h (point))))
              (goto-char h)))
-          ;; stop if we see a complete reg, perhaps an extended one
+          ;; stop if we see an extended complete reg, perhaps a complete one
              (and
            (looking-at verilog-complete-reg)
            (let* ((p (point)))
@@ -4186,32 +4247,20 @@ More specifically, point @ in the line foo : @ begin"
       nil)))
 
 (defun verilog-backward-up-list (arg)
-  "Like `backward-up-list', but deal with comments."
+  "Call `backward-up-list' ARG, ignoring comments."
   (let ((parse-sexp-ignore-comments t))
     (backward-up-list arg)))
 
 (defun verilog-forward-sexp-cmt (arg)
-  "Call `forward-sexp', inside comments."
+  "Call `forward-sexp' ARG, inside comments."
   (let ((parse-sexp-ignore-comments nil))
     (forward-sexp arg)))
 
 (defun verilog-forward-sexp-ign-cmt (arg)
-  "Call `forward-sexp', ignoring comments."
+  "Call `forward-sexp' ARG, ignoring comments."
   (let ((parse-sexp-ignore-comments t))
     (forward-sexp arg)))
 
-(defun verilog-in-struct-region-p ()
-  "Return true if in a struct region.
-More specifically, in a list after a struct|union keyword."
-  (interactive)
-  (save-excursion
-    (let* ((state (verilog-syntax-ppss))
-          (depth (nth 0 state)))
-      (if depth
-         (progn (verilog-backward-up-list depth)
-                (verilog-beg-of-statement)
-                (looking-at "\\<typedef\\>?\\s-*\\<struct\\|union\\>"))))))
-
 (defun verilog-in-generate-region-p ()
   "Return true if in a generate region.
 More specifically, after a generate and before an endgenerate."
@@ -4658,10 +4707,10 @@ primitive or interface named NAME."
                  (cond
                   ((match-end 5) ;; of verilog-end-block-ordered-re
                    (setq reg "\\(\\<function\\>\\)\\|\\(\\<\\(endfunction\\|task\\|\\(macro\\)?module\\|primitive\\)\\>\\)")
-                   (setq name-re "\\w+\\s-*(")
-                   )
+                   (setq name-re "\\w+\\s-*("))
                   ((match-end 6) ;; of verilog-end-block-ordered-re
-                   (setq reg "\\(\\<task\\>\\)\\|\\(\\<\\(endtask\\|function\\|\\(macro\\)?module\\|primitive\\)\\>\\)"))
+                   (setq reg "\\(\\<task\\>\\)\\|\\(\\<\\(endtask\\|function\\|\\(macro\\)?module\\|primitive\\)\\>\\)")
+                   (setq name-re "\\w+\\s-*("))
                   ((match-end 7) ;; of verilog-end-block-ordered-re
                    (setq reg "\\(\\<\\(macro\\)?module\\>\\)\\|\\<endmodule\\>"))
                   ((match-end 8) ;; of verilog-end-block-ordered-re
@@ -4977,25 +5026,24 @@ becomes:
   (compile compile-command))
 
 (defun verilog-preprocess (&optional command filename)
-  "Preprocess the buffer, similar to `compile', but leave output in Verilog-Mode.
+  "Preprocess the buffer, similar to `compile', but put output in Verilog-Mode.
 Takes optional COMMAND or defaults to `verilog-preprocessor', and
-FILENAME or defaults to `buffer-file-name`."
+FILENAME to find directory to run in, or defaults to `buffer-file-name`."
   (interactive
    (list
     (let ((default (verilog-expand-command verilog-preprocessor)))
       (set (make-local-variable `verilog-preprocessor)
-          (read-from-minibuffer "Run Preprocessor (like this): "
-                                default nil nil
-                                'verilog-preprocess-history default)))))
+             (read-from-minibuffer "Run Preprocessor (like this): "
+                                    default nil nil
+                                     'verilog-preprocess-history default)))))
   (unless command (setq command (verilog-expand-command verilog-preprocessor)))
   (let* ((fontlocked (and (boundp 'font-lock-mode) font-lock-mode))
-        (dir (file-name-directory (or filename buffer-file-name)))
-        (file (file-name-nondirectory (or filename buffer-file-name)))
-        (cmd (concat "cd " dir "; " command " " file)))
+         (dir (file-name-directory (or filename buffer-file-name)))
+          (cmd (concat "cd " dir "; " command)))
     (with-output-to-temp-buffer "*Verilog-Preprocessed*"
       (with-current-buffer (get-buffer "*Verilog-Preprocessed*")
        (insert (concat "// " cmd "\n"))
-       (shell-command cmd "*Verilog-Preprocessed*")
+       (call-process shell-file-name nil t nil shell-command-switch cmd)
        (verilog-mode)
        ;; Without this force, it takes a few idle seconds
        ;; to get the color, which is very jarring
@@ -5006,17 +5054,30 @@ FILENAME or defaults to `buffer-file-name`."
 ;; Batch
 ;;
 
+(defun verilog-warn (string &rest args)
+  "Print a warning with `format' using STRING and optional ARGS."
+  (apply 'message (concat "%%Warning: " string) args))
+
+(defun verilog-warn-error (string &rest args)
+  "Call `error' using STRING and optional ARGS.
+If `verilog-warn-fatal' is non-nil, call `verilog-warn' instead."
+  (if verilog-warn-fatal
+      (apply 'error string args)
+    (apply 'verilog-warn string args)))
+
 (defmacro verilog-batch-error-wrapper (&rest body)
   "Execute BODY and add error prefix to any errors found.
 This lets programs calling batch mode to easily extract error messages."
-  `(condition-case err
-       (progn ,@body)
-     (error
-      (error "%%Error: %s%s" (error-message-string err)
-            (if (featurep 'xemacs) "\n" "")))))  ;; XEmacs forgets to add a newline
+  `(let ((verilog-warn-fatal nil))
+     (condition-case err
+        (progn ,@body)
+       (error
+       (error "%%Error: %s%s" (error-message-string err)
+              (if (featurep 'xemacs) "\n" ""))))))  ;; XEmacs forgets to add a newline
 
 (defun verilog-batch-execute-func (funref &optional no-save)
-  "Internal processing of a batch command, running FUNREF on all command arguments.
+  "Internal processing of a batch command.
+Runs FUNREF on all command arguments.
 Save the result unless optional NO-SAVE is t."
   (verilog-batch-error-wrapper
    ;; Setting global variables like that is *VERY NASTY* !!!  --Stef
@@ -5088,7 +5149,7 @@ line in bottom-up order."
   (verilog-batch-execute-func `verilog-inject-auto))
 
 (defun verilog-batch-indent ()
-  "For use with --batch, reindent an entire file as a stand-alone tool.
+  "For use with --batch, reindent an entire file as a stand-alone tool.
 This sets up the appropriate Verilog mode environment, calls
 \\[verilog-indent-buffer] on all command-line files, and saves the buffers."
   (unless noninteractive
@@ -5219,7 +5280,7 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
                       (verilog-beg-of-statement) ;; doesn't get to beginning
                       (if (looking-at verilog-property-re)
                           (throw 'nesting 'statement) ; We don't need an endproperty for these
-                        (throw 'nesting 'block)        ;We still need a endproperty
+                        (throw 'nesting 'block)        ;We still need an endproperty
                         ))
                      (t ; endblock
                                        ; try to leap back to matching outward block by striding across
@@ -5312,7 +5373,6 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
          (t
           (setq depth (verilog-current-indent-level)))))
       (message "You are at nesting %s depth %d" type depth))))
-
 (defun verilog-calc-1 ()
   (catch 'nesting
     (let ((re (concat "\\({\\|}\\|" verilog-indent-re "\\)")))
@@ -5370,9 +5430,10 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
                                        ; endfunction
              (verilog-beg-of-statement)
              (if (looking-at verilog-beg-block-re-ordered)
-                 (throw 'nesting 'block)
-               (throw 'nesting 'defun)))
+              (throw 'nesting 'block)
+            (throw 'nesting 'defun)))
 
+         ;;
             ((looking-at "\\<property\\>")
                                        ; *sigh*
                                        ;    {assert|assume|cover} property (); are complete
@@ -5382,7 +5443,7 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
              (verilog-beg-of-statement)
              (if (looking-at verilog-property-re)
                  (throw 'continue 'statement) ; We don't need an endproperty for these
-               (throw 'nesting 'block) ;We still need a endproperty
+               (throw 'nesting 'block) ;We still need an endproperty
                ))
 
             (t              (throw 'nesting 'block))))
@@ -5715,7 +5776,7 @@ Set point to where line starts."
   (forward-comment (- (buffer-size))))
 
 (defun verilog-backward-syntactic-ws-quick ()
-  "As with `verilog-backward-syntactic-ws' but uses `verilog-scan' cache."
+  "As with `verilog-backward-syntactic-ws' but use `verilog-scan' cache."
   (while (cond ((bobp)
                nil) ; Done
               ((> (skip-syntax-backward " ") 0)
@@ -5864,7 +5925,7 @@ May cache result using `verilog-syntax-ppss'."
 
 (defun verilog-in-paren-quick ()
  "Return true if in a parenthetical expression.
-Always starts from point-min, to allow inserts with hooks disabled."
+Always starts from `point-min', to allow inserts with hooks disabled."
  ;; The -quick refers to its use alongside the other -quick functions,
  ;; not that it's likely to be faster than verilog-in-paren.
  (let ((state (save-excursion (parse-partial-sexp (point-min) (point)))))
@@ -6118,7 +6179,7 @@ Only look at a few lines to determine indent level."
            (indent-line-to val)
            (if (and (not verilog-indent-lists)
                     (verilog-in-paren))
-               (verilog-pretty-declarations))
+               (verilog-pretty-declarations-auto))
            ))
         ((= (preceding-char) ?\) )
          (goto-char here)
@@ -6154,7 +6215,7 @@ Only look at a few lines to determine indent level."
                      (looking-at verilog-declaration-re))))
         (indent-line-to val)
         (if decl
-            (verilog-pretty-declarations))))
+            (verilog-pretty-declarations-auto))))
 
      (;-- Handle the ends
       (or
@@ -6285,6 +6346,12 @@ ARG is ignored, for `comment-indent-function' compatibility."
 
 ;;
 
+(defun verilog-pretty-declarations-auto (&optional quiet)
+  "Call `verilog-pretty-declarations' QUIET based on `verilog-auto-lineup'."
+  (when (or (eq 'all verilog-auto-lineup)
+           (eq 'declarations verilog-auto-lineup))
+    (verilog-pretty-declarations quiet)))
+
 (defun verilog-pretty-declarations (&optional quiet)
   "Line up declarations around point.
 Be verbose about progress unless optional QUIET set."
@@ -6431,100 +6498,101 @@ Be verbose about progress unless optional QUIET set."
   (interactive)
   (if (not (verilog-in-comment-or-string-p))
       (save-excursion
-       (let ((rexp (concat "^\\s-*" verilog-complete-reg)))
-         (beginning-of-line)
-         (if (and (not (looking-at rexp ))
-                  (looking-at verilog-assignment-operation-re)
-                  (save-excursion
-                    (goto-char (match-end 2))
-                    (and (not (verilog-in-attribute-p))
-                         (not (verilog-in-parameter-p))
-                         (not (verilog-in-comment-or-string-p)))))
-             (let* ((here (point))
-                    (e) (r)
-                    (start
-                     (progn
-                       (beginning-of-line)
-                       (setq e (point))
-                       (verilog-backward-syntactic-ws)
-                       (beginning-of-line)
-                       (while (and (not (looking-at rexp ))
-                                   (looking-at verilog-assignment-operation-re)
-                                   (not (bobp))
-                                   )
-                         (setq e (point))
-                         (verilog-backward-syntactic-ws)
-                         (beginning-of-line)
-                         ) ;Ack, need to grok `define
-                       e))
-                    (end
-                     (progn
-                       (goto-char here)
-                       (end-of-line)
-                       (setq e (point))        ;Might be on last line
-                       (verilog-forward-syntactic-ws)
-                       (beginning-of-line)
-                       (while (and
-                               (not (looking-at rexp ))
-                               (looking-at verilog-assignment-operation-re)
-                               (progn
-                                 (end-of-line)
-                                 (not (eq e (point)))))
-                         (setq e (point))
-                         (verilog-forward-syntactic-ws)
-                         (beginning-of-line)
-                         )
-                       e))
-                    (endpos (set-marker (make-marker) end))
-                    (ind)
-                    )
-               (goto-char start)
-               (verilog-do-indent (verilog-calculate-indent))
-               (if (and (not quiet)
-                        (> (- end start) 100))
-                   (message "Lining up expressions..(please stand by)"))
-
-               ;; Set indent to minimum throughout region
-               (while (< (point) (marker-position endpos))
-                 (beginning-of-line)
-                 (verilog-just-one-space verilog-assignment-operation-re)
-                 (beginning-of-line)
-                 (verilog-do-indent (verilog-calculate-indent))
-                 (end-of-line)
-                 (verilog-forward-syntactic-ws)
-                 )
-
-               ;; Now find biggest prefix
-               (setq ind (verilog-get-lineup-indent-2 verilog-assignment-operation-re start endpos))
-
-               ;; Now indent each line.
-               (goto-char start)
-               (while (progn (setq e (marker-position endpos))
-                             (setq r (- e (point)))
-                             (> r 0))
-                 (setq e (point))
-                 (if (not quiet) (message "%d" r))
-                 (cond
-                  ((looking-at verilog-assignment-operation-re)
-                   (goto-char (match-beginning 2))
-                   (if (not (or (verilog-in-parenthesis-p) ;; leave attributes and comparisons alone
-                                (verilog-in-coverage-p)))
-                       (if (eq (char-after) ?=)
-                           (indent-to (1+ ind))        ; line up the = of the <= with surrounding =
-                         (indent-to ind)
-                         ))
-                   )
-                  ((verilog-continued-line-1 start)
-                   (goto-char e)
-                   (indent-line-to ind))
-                  (t           ; Must be comment or white space
-                   (goto-char e)
-                   (verilog-forward-ws&directives)
-                   (forward-line -1))
-                  )
-                 (forward-line 1))
-               (unless quiet (message ""))
-            ))))))
+        (let ( (rexp (concat "^\\s-*" verilog-complete-reg))
+               (rexp1 (concat "^\\s-*" verilog-basic-complete-re)))
+          (beginning-of-line)
+          (if (and (not (looking-at rexp ))
+                   (looking-at verilog-assignment-operation-re)
+                   (save-excursion
+                     (goto-char (match-end 2))
+                     (and (not (verilog-in-attribute-p))
+                          (not (verilog-in-parameter-p))
+                          (not (verilog-in-comment-or-string-p)))))
+              (let* ((here (point))
+                     (e) (r)
+                     (start
+                      (progn
+                        (beginning-of-line)
+                        (setq e (point))
+                        (verilog-backward-syntactic-ws)
+                        (beginning-of-line)
+                        (while (and (not (looking-at rexp1))
+                                    (looking-at verilog-assignment-operation-re)
+                                    (not (bobp))
+                                    )
+                          (setq e (point))
+                          (verilog-backward-syntactic-ws)
+                          (beginning-of-line)
+                          ) ;Ack, need to grok `define
+                        e))
+                     (end
+                      (progn
+                        (goto-char here)
+                        (end-of-line)
+                        (setq e (point))       ;Might be on last line
+                        (verilog-forward-syntactic-ws)
+                        (beginning-of-line)
+                        (while (and
+                                (not (looking-at rexp1 ))
+                                (looking-at verilog-assignment-operation-re)
+                                (progn
+                                  (end-of-line)
+                                  (not (eq e (point)))))
+                          (setq e (point))
+                          (verilog-forward-syntactic-ws)
+                          (beginning-of-line)
+                          )
+                        e))
+                     (endpos (set-marker (make-marker) end))
+                     (ind)
+                     )
+                (goto-char start)
+                (verilog-do-indent (verilog-calculate-indent))
+                (if (and (not quiet)
+                         (> (- end start) 100))
+                    (message "Lining up expressions..(please stand by)"))
+
+                ;; Set indent to minimum throughout region
+                (while (< (point) (marker-position endpos))
+                  (beginning-of-line)
+                  (verilog-just-one-space verilog-assignment-operation-re)
+                  (beginning-of-line)
+                  (verilog-do-indent (verilog-calculate-indent))
+                  (end-of-line)
+                  (verilog-forward-syntactic-ws)
+                  )
+
+                ;; Now find biggest prefix
+                (setq ind (verilog-get-lineup-indent-2 verilog-assignment-operation-re start endpos))
+
+                ;; Now indent each line.
+                (goto-char start)
+                (while (progn (setq e (marker-position endpos))
+                              (setq r (- e (point)))
+                              (> r 0))
+                  (setq e (point))
+                  (if (not quiet) (message "%d" r))
+                  (cond
+                   ((looking-at verilog-assignment-operation-re)
+                    (goto-char (match-beginning 2))
+                    (if (not (or (verilog-in-parenthesis-p) ;; leave attributes and comparisons alone
+                                 (verilog-in-coverage-p)))
+                        (if (eq (char-after) ?=)
+                            (indent-to (1+ ind))       ; line up the = of the <= with surrounding =
+                          (indent-to ind)
+                          ))
+                    )
+                   ((verilog-continued-line-1 start)
+                    (goto-char e)
+                    (indent-line-to ind))
+                   (t          ; Must be comment or white space
+                    (goto-char e)
+                    (verilog-forward-ws&directives)
+                    (forward-line -1))
+                   )
+                  (forward-line 1))
+                (unless quiet (message ""))
+                ))))))
 
 (defun verilog-just-one-space (myre)
   "Remove extra spaces around regular expression MYRE."
@@ -6686,7 +6754,7 @@ Region is defined by B and EDPOS."
 (defvar verilog-buffer-to-use nil)
 (defvar verilog-flag nil)
 (defvar verilog-toggle-completions nil
-  "*True means \\<verilog-mode-map>\\[verilog-complete-word] should try all possible completions one by one.
+  "True means \\<verilog-mode-map>\\[verilog-complete-word] should try all possible completions one by one.
 Repeated use of \\[verilog-complete-word] will show you all of them.
 Normally, when there is more than one possible completion,
 it displays a list of all possible completions.")
@@ -6701,13 +6769,13 @@ it displays a list of all possible completions.")
     "rtranif1" "semaphore" "time" "tran" "tranif0" "tranif1" "tri" "tri0" "tri1"
     "triand" "trior" "trireg" "wand" "wire" "wor" "xnor" "xor"
     )
-  "*Keywords for types used when completing a word in a declaration or parmlist.
+  "Keywords for types used when completing a word in a declaration or parmlist.
 \(integer, real, reg...)")
 
 (defvar verilog-cpp-keywords
   '("module" "macromodule" "primitive" "timescale" "define" "ifdef" "ifndef" "else"
     "endif")
-  "*Keywords to complete when at first word of a line in declarative scope.
+  "Keywords to complete when at first word of a line in declarative scope.
 \(initial, always, begin, assign...)
 The procedures and variables defined within the Verilog program
 will be completed at runtime and should not be added to this list.")
@@ -6721,7 +6789,7 @@ will be completed at runtime and should not be added to this list.")
      "task" "endtask" "primitive" "endprimitive"
      )
    verilog-type-keywords)
-  "*Keywords to complete when at first word of a line in declarative scope.
+  "Keywords to complete when at first word of a line in declarative scope.
 \(initial, always, begin, assign...)
 The procedures and variables defined within the Verilog program
 will be completed at runtime and should not be added to this list.")
@@ -6732,28 +6800,28 @@ will be completed at runtime and should not be added to this list.")
     "endgenerate" "endinterface" "endpackage" "endspecify" "endtask"
     "for" "fork" "if" "join" "join_any" "join_none" "repeat" "return"
     "while")
-  "*Keywords to complete when at first word of a line in behavioral scope.
+  "Keywords to complete when at first word of a line in behavioral scope.
 \(begin, if, then, else, for, fork...)
 The procedures and variables defined within the Verilog program
 will be completed at runtime and should not be added to this list.")
 
 (defvar verilog-tf-keywords
   '("begin" "break" "fork" "join" "join_any" "join_none" "case" "end" "endtask" "endfunction" "if" "else" "for" "while" "repeat")
-  "*Keywords to complete when at first word of a line in a task or function.
+  "Keywords to complete when at first word of a line in a task or function.
 \(begin, if, then, else, for, fork.)
 The procedures and variables defined within the Verilog program
 will be completed at runtime and should not be added to this list.")
 
 (defvar verilog-case-keywords
   '("begin" "fork" "join" "join_any" "join_none" "case" "end" "endcase" "if" "else" "for" "repeat")
-  "*Keywords to complete when at first word of a line in case scope.
+  "Keywords to complete when at first word of a line in case scope.
 \(begin, if, then, else, for, fork...)
 The procedures and variables defined within the Verilog program
 will be completed at runtime and should not be added to this list.")
 
 (defvar verilog-separator-keywords
   '("else" "then" "begin")
-  "*Keywords to complete when NOT standing at the first word of a statement.
+  "Keywords to complete when NOT standing at the first word of a statement.
 \(else, then, begin...)
 Variables and function names defined within the Verilog program
 will be completed at runtime and should not be added to this list.")
@@ -6786,10 +6854,10 @@ will be completed at runtime and should not be added to this list.")
     ("tranif1" "inout" "inout")
     ("xnor"    "output")
     ("xor"     "output"))
-  "*Map of direction for each positional argument to each gate primitive.")
+  "Map of direction for each positional argument to each gate primitive.")
 
 (defvar verilog-gate-keywords (mapcar `car verilog-gate-ios)
-  "*Keywords for gate primitives.")
+  "Keywords for gate primitives.")
 
 (defun verilog-string-diff (str1 str2)
   "Return index of first letter where STR1 and STR2 differs."
@@ -7365,6 +7433,7 @@ See also `verilog-sk-header' for an alternative format."
 ;;
 
 ;; Elements of a signal list
+;; Unfortunately we use 'assoc' on this, so can't be a vector
 (defsubst verilog-sig-new (name bits comment mem enum signed type multidim modport)
   (list name bits comment mem enum signed type multidim modport))
 (defsubst verilog-sig-name (sig)
@@ -7381,6 +7450,8 @@ See also `verilog-sk-header' for an alternative format."
   (nth 5 sig))
 (defsubst verilog-sig-type (sig)
   (nth 6 sig))
+(defsubst verilog-sig-type-set (sig type)
+  (setcar (nthcdr 6 sig) type))
 (defsubst verilog-sig-multidim (sig)
   (nth 7 sig))
 (defsubst verilog-sig-multidim-string (sig)
@@ -7396,17 +7467,17 @@ See also `verilog-sk-header' for an alternative format."
   (verilog-make-width-expression (verilog-sig-bits sig)))
 
 (defsubst verilog-alw-new (outputs-del outputs-imm temps inputs)
-  (list outputs-del outputs-imm temps inputs))
+  (vector outputs-del outputs-imm temps inputs))
 (defsubst verilog-alw-get-outputs-delayed (sigs)
-  (nth 0 sigs))
+  (aref sigs 0))
 (defsubst verilog-alw-get-outputs-immediate (sigs)
-  (nth 1 sigs))
+  (aref sigs 1))
 (defsubst verilog-alw-get-temps (sigs)
-  (nth 2 sigs))
+  (aref sigs 2))
 (defsubst verilog-alw-get-inputs (sigs)
-  (nth 3 sigs))
+  (aref sigs 3))
 (defsubst verilog-alw-get-uses-delayed (sigs)
-  (nth 0 sigs))
+  (aref sigs 0))
 
 (defsubst verilog-modi-new (name fob pt type)
   (vector name fob pt type))
@@ -7459,6 +7530,11 @@ See also `verilog-sk-header' for an alternative format."
 (defsubst verilog-subdecls-get-interfaced (subdecls)
   (aref subdecls 4))
 
+(defun verilog-signals-from-signame (signame-list)
+  "Return signals in standard form from SIGNAME-LIST, a simple list of names."
+  (mapcar (lambda (name) (verilog-sig-new name nil nil nil nil nil nil nil nil))
+         signame-list))
+
 (defun verilog-signals-not-in (in-list not-list)
   "Return list of signals in IN-LIST that aren't also in NOT-LIST.
 Also remove any duplicates in IN-LIST.
@@ -7471,17 +7547,17 @@ Signals must be in standard (base vector) form."
             (puthash (car (car not-list)) t ht)
             (setq not-list (cdr not-list)))
           (while in-list
-            (when (not (gethash (car (car in-list)) ht))
+            (when (not (gethash (verilog-sig-name (car in-list)) ht))
               (setq out-list (cons (car in-list) out-list))
-              (puthash (car (car in-list)) t ht))
+              (puthash (verilog-sig-name (car in-list)) t ht))
             (setq in-list (cdr in-list)))
           (nreverse out-list)))
        ;; Slower Fallback if no hash tables (pre Emacs 21.1/XEmacs 21.4)
        (t
         (let (out-list)
           (while in-list
-            (if (not (or (assoc (car (car in-list)) not-list)
-                         (assoc (car (car in-list)) out-list)))
+            (if (not (or (assoc (verilog-sig-name (car in-list)) not-list)
+                         (assoc (verilog-sig-name (car in-list)) out-list)))
                 (setq out-list (cons (car in-list) out-list)))
             (setq in-list (cdr in-list)))
           (nreverse out-list)))))
@@ -7499,13 +7575,22 @@ Signals must be in standard (base vector) form."
 
 (defun verilog-signals-sort-compare (a b)
   "Compare signal A and B for sorting."
-  (string< (car a) (car b)))
+  (string< (verilog-sig-name a) (verilog-sig-name b)))
 
 (defun verilog-signals-not-params (in-list)
   "Return list of signals in IN-LIST that aren't parameters or numeric constants."
   (let (out-list)
     (while in-list
-      (unless (boundp (intern (concat "vh-" (car (car in-list)))))
+      (unless (boundp (intern (concat "vh-" (verilog-sig-name (car in-list)))))
+       (setq out-list (cons (car in-list) out-list)))
+      (setq in-list (cdr in-list)))
+    (nreverse out-list)))
+
+(defun verilog-signals-with (func in-list)
+  "Return IN-LIST with only signals where FUNC passed each signal is true."
+  (let (out-list)
+    (while in-list
+      (when (funcall func (car in-list))
        (setq out-list (cons (car in-list) out-list)))
       (setq in-list (cdr in-list)))
     (nreverse out-list)))
@@ -7594,20 +7679,67 @@ Duplicate signals are also removed.  For example A[2] and A[1] become A[2:1]."
     ;;
     out-list))
 
-(defun verilog-sig-tieoff (sig &optional no-width)
+(defun verilog-sig-tieoff (sig)
   "Return tieoff expression for given SIG, with appropriate width.
-Ignore width if optional NO-WIDTH is set."
-  (let* ((width (if no-width nil (verilog-sig-width sig))))
-    (concat
-     (if (and verilog-active-low-regexp
-             (string-match verilog-active-low-regexp (verilog-sig-name sig)))
-        "~" "")
-     (cond ((not width)
-           "0")
-          ((string-match "^[0-9]+$" width)
-           (concat width (if (verilog-sig-signed sig) "'sh0" "'h0")))
-          (t
-           (concat "{" width "{1'b0}}"))))))
+Tieoff value uses `verilog-active-low-regexp' and
+`verilog-auto-reset-widths'."
+  (concat
+   (if (and verilog-active-low-regexp
+           (string-match verilog-active-low-regexp (verilog-sig-name sig)))
+       "~" "")
+   (cond ((not verilog-auto-reset-widths)
+         "0")
+        ((equal verilog-auto-reset-widths 'unbased)
+         "'0")
+        ;; Else presume verilog-auto-reset-widths is true
+        (t
+         (let* ((width (verilog-sig-width sig)))
+           (if (string-match "^[0-9]+$" width)
+               (concat width (if (verilog-sig-signed sig) "'sh0" "'h0"))
+             (concat "{" width "{1'b0}}")))))))
+
+;;
+;; Dumping
+;;
+
+(defun verilog-decls-princ (decls)
+  "For debug, dump the `verilog-read-decls' structure DECLS."
+  (verilog-signals-princ (verilog-decls-get-outputs decls)
+                        "Outputs:\n" "  ")
+  (verilog-signals-princ (verilog-decls-get-inouts decls)
+                        "Inout:\n" "  ")
+  (verilog-signals-princ (verilog-decls-get-inputs decls)
+                        "Inputs:\n" "  ")
+  (verilog-signals-princ (verilog-decls-get-vars decls)
+                        "Vars:\n" "  ")
+  (verilog-signals-princ (verilog-decls-get-assigns decls)
+                        "Assigns:\n" "  ")
+  (verilog-signals-princ (verilog-decls-get-consts decls)
+                        "Consts:\n" "  ")
+  (verilog-signals-princ (verilog-decls-get-gparams decls)
+                        "Gparams:\n" "  ")
+  (verilog-signals-princ (verilog-decls-get-interfaces decls)
+                        "Interfaces:\n" "  ")
+  (princ "\n"))
+
+(defun verilog-signals-princ (signals &optional header prefix)
+  "For debug, dump internal SIGNALS structures, with HEADER and PREFIX."
+  (when signals
+    (princ header)
+    (while signals
+      (let ((sig (car signals)))
+       (setq signals (cdr signals))
+       (princ prefix)
+       (princ "\"") (princ (verilog-sig-name sig)) (princ "\"")
+       (princ "  bits=") (princ (verilog-sig-bits sig))
+       (princ "  cmt=") (princ (verilog-sig-comment sig))
+       (princ "  mem=") (princ (verilog-sig-memory sig))
+       (princ "  enum=") (princ (verilog-sig-enum sig))
+       (princ "  sign=") (princ (verilog-sig-signed sig))
+       (princ "  type=") (princ (verilog-sig-type sig))
+       (princ "  dim=") (princ (verilog-sig-multidim sig))
+       (princ "  modp=") (princ (verilog-sig-modport sig))
+       (princ "\n")))))
 
 ;;
 ;; Port/Wire/Etc Reading
@@ -7701,7 +7833,7 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
   (let ((olist))
     (save-excursion
       ;; /*AUTOPUNT("parameter", "parameter")*/
-      (search-backward "(")
+      (backward-sexp 1)
       (while (looking-at "(?\\s *\"\\([^\"]*\\)\"\\s *,?")
        (setq olist (cons (match-string 1) olist))
        (goto-char (match-end 0))))
@@ -7716,10 +7848,10 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
 
 (defun verilog-read-decls ()
   "Compute signal declaration information for the current module at point.
-Return a array of [outputs inouts inputs wire reg assign const]."
+Return an array of [outputs inouts inputs wire reg assign const]."
   (let ((end-mod-point (or (verilog-get-end-of-defun t) (point-max)))
        (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t)
-       in-modport ign-prop
+       in-modport ptype ign-prop
        sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const
        sigs-gparam sigs-intf
        vec expect-signal keywd newsig rvalue enum io signed typedefed multidim
@@ -7731,13 +7863,13 @@ Return a array of [outputs inouts inputs wire reg assign const]."
        ;;(if dbg (setq dbg (concat dbg (format "Pt %s  Vec %s   C%c Kwd'%s'\n" (point) vec (following-char) keywd))))
        (cond
         ((looking-at "//")
-         (if (looking-at "[^\n]*synopsys\\s +enum\\s +\\([a-zA-Z0-9_]+\\)")
-             (setq enum (match-string 1)))
+         (if (looking-at "[^\n]*\\(auto\\|synopsys\\)\\s +enum\\s +\\([a-zA-Z0-9_]+\\)")
+             (setq enum (match-string 2)))
          (search-forward "\n"))
         ((looking-at "/\\*")
          (forward-char 2)
-         (if (looking-at "[^\n]*synopsys\\s +enum\\s +\\([a-zA-Z0-9_]+\\)")
-             (setq enum (match-string 1)))
+         (if (looking-at "[^\n]*\\(auto\\|synopsys\\)\\s +enum\\s +\\([a-zA-Z0-9_]+\\)")
+             (setq enum (match-string 2)))
          (or (search-forward "*/")
              (error "%s: Unmatched /* */, at char %d" (verilog-point-text) (point))))
         ((looking-at "(\\*")
@@ -7795,33 +7927,49 @@ Return a array of [outputs inouts inputs wire reg assign const]."
            (when (string-match "^\\\\" (match-string 1))
              (setq keywd (concat keywd " "))))  ;; Escaped ID needs space at end
          (cond ((equal keywd "input")
-                (setq vec nil enum nil  rvalue nil  newsig nil  signed nil  typedefed nil  multidim nil  sig-paren paren
-                      expect-signal 'sigs-in  io t  modport nil))
+                (setq vec nil        enum nil      rvalue nil  newsig nil  signed nil
+                      typedefed nil  multidim nil  ptype nil   modport nil
+                      expect-signal 'sigs-in       io t        sig-paren paren))
                ((equal keywd "output")
-                (setq vec nil enum nil  rvalue nil  newsig nil  signed nil  typedefed nil  multidim nil  sig-paren paren
-                      expect-signal 'sigs-out  io t  modport nil))
+                (setq vec nil        enum nil      rvalue nil  newsig nil  signed nil
+                      typedefed nil  multidim nil  ptype nil   modport nil
+                      expect-signal 'sigs-out      io t        sig-paren paren))
                ((equal keywd "inout")
-                (setq vec nil enum nil  rvalue nil  newsig nil  signed nil  typedefed nil  multidim nil  sig-paren paren
-                      expect-signal 'sigs-inout  io t  modport nil))
+                (setq vec nil        enum nil      rvalue nil  newsig nil  signed nil
+                      typedefed nil  multidim nil  ptype nil   modport nil
+                      expect-signal 'sigs-inout    io t        sig-paren paren))
                ((equal keywd "parameter")
-                (setq vec nil  enum nil  rvalue nil  signed nil  typedefed nil  multidim nil  sig-paren paren
-                      expect-signal 'sigs-gparam  io t  modport nil))
-               ((member keywd '("wire"
-                                "tri" "tri0" "tri1" "triand" "trior" "wand" "wor"
-                                "reg" "trireg"
+                (setq vec nil        enum nil      rvalue nil  signed nil
+                      typedefed nil  multidim nil  ptype nil   modport nil
+                      expect-signal 'sigs-gparam   io t        sig-paren paren))
+               ((member keywd '("wire" "reg"  ; Fast
+                                ;; net_type
+                                "tri" "tri0" "tri1" "triand" "trior" "trireg"
+                                "uwire" "wand" "wor"
+                                ;; integer_atom_type
                                 "byte" "shortint" "int" "longint" "integer" "time"
+                                "supply0" "supply1"
+                                ;; integer_vector_type - "reg" above
                                 "bit" "logic"
+                                ;; non_integer_type
                                 "shortreal" "real" "realtime"
+                                ;; data_type
                                 "string" "event" "chandle"))
-                (unless io (setq vec nil  enum nil  rvalue nil  signed nil  typedefed nil  multidim nil  sig-paren paren
-                                 expect-signal 'sigs-var  modport nil)))
+                (cond (io
+                       (setq typedefed
+                             (if typedefed (concat typedefed " " keywd) keywd)))
+                      (t (setq vec nil  enum nil  rvalue nil  signed nil
+                               typedefed nil  multidim nil  sig-paren paren
+                               expect-signal 'sigs-var  modport nil))))
                ((equal keywd "assign")
-                (setq vec nil  enum nil  rvalue nil  signed nil  typedefed nil  multidim nil  sig-paren paren
-                      expect-signal 'sigs-assign  modport nil))
-               ((member keywd '("supply0" "supply1" "supply"
-                                "localparam" "genvar"))
-                (unless io (setq vec nil  enum nil  rvalue nil  signed nil  typedefed nil  multidim nil  sig-paren paren
-                                 expect-signal 'sigs-const  modport nil)))
+                (setq vec nil        enum nil        rvalue nil  signed nil
+                      typedefed nil  multidim nil    ptype nil   modport nil
+                      expect-signal 'sigs-assign     sig-paren paren))
+               ((member keywd '("localparam" "genvar"))
+                (unless io
+                  (setq vec nil        enum nil      rvalue nil  signed nil
+                        typedefed nil  multidim nil  ptype nil   modport nil
+                        expect-signal 'sigs-const    sig-paren paren)))
                ((member keywd '("signed" "unsigned"))
                 (setq signed keywd))
                ((member keywd '("assert" "assume" "cover" "expect" "restrict"))
@@ -7835,11 +7983,14 @@ Return a array of [outputs inouts inputs wire reg assign const]."
                 (setq functask (1- functask)))
                ((equal keywd "modport")
                 (setq in-modport t))
+               ((equal keywd "type")
+                (setq ptype t))
                ;; Ifdef?  Ignore name of define
                ((member keywd '("`ifdef" "`ifndef" "`elsif"))
                 (setq rvalue t))
                ;; Type?
-               ((verilog-typedef-name-p keywd)
+               ((unless ptype
+                  (verilog-typedef-name-p keywd))
                 (setq typedefed keywd))
                ;; Interface with optional modport in v2k arglist?
                ;; Skip over parsing modport, and take the interface name as the type
@@ -7848,8 +7999,10 @@ Return a array of [outputs inouts inputs wire reg assign const]."
                      (not rvalue)
                      (looking-at "\\s-*\\(\\.\\(\\s-*[a-zA-Z`_$][a-zA-Z0-9`_$]*\\)\\|\\)\\s-*[a-zA-Z`_$][a-zA-Z0-9`_$]*"))
                 (when (match-end 2) (goto-char (match-end 2)))
-                (setq vec nil enum nil  rvalue nil  newsig nil  signed nil  typedefed keywd  multidim nil  sig-paren paren
-                      expect-signal 'sigs-intf  io t  modport (match-string 2)))
+                (setq vec nil          enum nil       rvalue nil  signed nil
+                      typedefed keywd  multidim nil   ptype nil   modport (match-string 2)
+                      newsig nil    sig-paren paren
+                      expect-signal 'sigs-intf  io t  ))
                ;; Ignore dotted LHS assignments: "assign foo.bar = z;"
                ((looking-at "\\s-*\\.")
                 (goto-char (match-end 0))
@@ -7888,7 +8041,7 @@ Return a array of [outputs inouts inputs wire reg assign const]."
 (eval-when-compile
   ;; Prevent compile warnings; these are let's, not globals
   ;; Do not remove the eval-when-compile
-  ;; - we want a error when we are debugging this code if they are refed.
+  ;; - we want an error when we are debugging this code if they are refed.
   (defvar sigs-in)
   (defvar sigs-inout)
   (defvar sigs-out)
@@ -7918,7 +8071,8 @@ Return a array of [outputs inouts inputs wire reg assign const]."
                            (verilog-sig-memory portdata)
                            nil
                            (verilog-sig-signed portdata)
-                           (verilog-sig-type portdata)
+                           (unless (member (verilog-sig-type portdata) '("wire" "reg"))
+                             (verilog-sig-type portdata))
                            multidim nil)
                           sigs-inout)))
              ((or (setq portdata (assoc port (verilog-decls-get-outputs submoddecls)))
@@ -7931,7 +8085,13 @@ Return a array of [outputs inouts inputs wire reg assign const]."
                            (verilog-sig-memory portdata)
                            nil
                            (verilog-sig-signed portdata)
-                           (verilog-sig-type portdata)
+                           ;; Though ok in SV, in V2K code, propagating the
+                           ;;  "reg" in "output reg" upwards isn't legal.
+                           ;; Also for backwards compatibility we don't propagate
+                           ;;  "input wire" upwards.
+                           ;; See also `verilog-signals-edit-wire-reg'.
+                           (unless (member (verilog-sig-type portdata) '("wire" "reg"))
+                             (verilog-sig-type portdata))
                            multidim nil)
                           sigs-out)))
              ((or (setq portdata (assoc port (verilog-decls-get-inputs submoddecls)))
@@ -7944,7 +8104,8 @@ Return a array of [outputs inouts inputs wire reg assign const]."
                            (verilog-sig-memory portdata)
                            nil
                            (verilog-sig-signed portdata)
-                           (verilog-sig-type portdata)
+                           (unless (member (verilog-sig-type portdata) '("wire" "reg"))
+                             (verilog-sig-type portdata))
                            multidim nil)
                           sigs-in)))
              ((setq portdata (assoc port (verilog-decls-get-interfaces submoddecls)))
@@ -8110,9 +8271,9 @@ Inserts the list of signals found."
 
 (defun verilog-read-sub-decls ()
   "Internally parse signals going to modules under this module.
-Return a array of [ outputs inouts inputs ] signals for modules that are
+Return an array of [ outputs inouts inputs ] signals for modules that are
 instantiated in this module.  For example if declare A A (.B(SIG)) and SIG
-is a output, then SIG will be included in the list.
+is an output, then SIG will be included in the list.
 
 This only works on instantiations created with /*AUTOINST*/ converted by
 \\[verilog-auto-inst].  Otherwise, it would have to read in the whole
@@ -8245,7 +8406,7 @@ For example if declare A A (.B(SIG)) then B will be included in the list."
     (setq verilog-cache-has-lisp (re-search-forward "\\<AUTO_LISP(" nil t))))
 
 (defun verilog-read-auto-lisp (start end)
-  "Look for and evaluate a AUTO_LISP between START and END.
+  "Look for and evaluate an AUTO_LISP between START and END.
 Must call `verilog-read-auto-lisp-present' before this function."
   ;; This function is expensive for large buffers, so we cache if any AUTO_LISP exists
   (when verilog-cache-has-lisp
@@ -8255,13 +8416,14 @@ Must call `verilog-read-auto-lisp-present' before this function."
        (backward-char)
        (let* ((beg-pt (prog1 (point)
                         (verilog-forward-sexp-cmt 1))) ;; Closing paren
-              (end-pt (point)))
+              (end-pt (point))
+              (verilog-in-hooks t))
          (eval-region beg-pt end-pt nil))))))
 
 (eval-when-compile
   ;; Prevent compile warnings; these are let's, not globals
   ;; Do not remove the eval-when-compile
-  ;; - we want a error when we are debugging this code if they are refed.
+  ;; - we want an error when we are debugging this code if they are refed.
   (defvar sigs-in)
   (defvar sigs-out-d)
   (defvar sigs-out-i)
@@ -8455,17 +8617,89 @@ IGNORE-NEXT is true to ignore next token, fake from inside case statement."
     instants-list))
 
 
-(defun verilog-read-auto-template (module)
-  "Look for a auto_template for the instantiation of the given MODULE.
-If found returns the signal name connections.  Return REGEXP and
-list of ( (signal_name connection_name)... )."
+(defun verilog-read-auto-template-middle ()
+  "With point in middle of an AUTO_TEMPLATE, parse it.
+Returns REGEXP and list of ( (signal_name connection_name)... )."
   (save-excursion
     ;; Find beginning
     (let ((tpl-regexp "\\([0-9]+\\)")
          (lineno -1)  ; -1 to offset for the AUTO_TEMPLATE's newline
          (templateno 0)
-         (pt (point))
          tpl-sig-list tpl-wild-list tpl-end-pt rep)
+      ;; Parse "REGEXP"
+      ;; We reserve @"..." for future lisp expressions that evaluate
+      ;; once-per-AUTOINST
+      (when (looking-at "\\s-*\"\\([^\"]*\\)\"")
+       (setq tpl-regexp (match-string 1))
+       (goto-char (match-end 0)))
+      (search-forward "(")
+      ;; Parse lines in the template
+      (when (or verilog-auto-inst-template-numbers
+               verilog-auto-template-warn-unused)
+       (save-excursion
+         (let ((pre-pt (point)))
+           (goto-char (point-min))
+           (while (search-forward "AUTO_TEMPLATE" pre-pt t)
+             (setq templateno (1+ templateno)))
+           (while (< (point) pre-pt)
+             (forward-line 1)
+             (setq lineno (1+ lineno))))))
+      (setq tpl-end-pt (save-excursion
+                        (backward-char 1)
+                        (verilog-forward-sexp-cmt 1)   ;; Moves to paren that closes argdecl's
+                        (backward-char 1)
+                        (point)))
+      ;;
+      (while (< (point) tpl-end-pt)
+       (cond ((looking-at "\\s-*\\.\\([a-zA-Z0-9`_$]+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
+              (setq tpl-sig-list
+                    (cons (list
+                           (match-string-no-properties 1)
+                           (match-string-no-properties 2)
+                           templateno lineno)
+                          tpl-sig-list))
+              (goto-char (match-end 0)))
+             ;; Regexp form??
+             ((looking-at
+               ;; Regexp bug in XEmacs disallows ][ inside [], and wants + last
+               "\\s-*\\.\\(\\([a-zA-Z0-9`_$+@^.*?|---]+\\|[][]\\|\\\\[()|]\\)+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
+              (setq rep (match-string-no-properties 3))
+              (goto-char (match-end 0))
+              (setq tpl-wild-list
+                    (cons (list
+                           (concat "^"
+                                   (verilog-string-replace-matches "@" "\\\\([0-9]+\\\\)" nil nil
+                                                                   (match-string 1))
+                                   "$")
+                           rep
+                           templateno lineno)
+                          tpl-wild-list)))
+             ((looking-at "[ \t\f]+")
+              (goto-char (match-end 0)))
+             ((looking-at "\n")
+              (setq lineno (1+ lineno))
+              (goto-char (match-end 0)))
+             ((looking-at "//")
+              (search-forward "\n")
+              (setq lineno (1+ lineno)))
+             ((looking-at "/\\*")
+              (forward-char 2)
+              (or (search-forward "*/")
+                  (error "%s: Unmatched /* */, at char %d" (verilog-point-text) (point))))
+             (t
+              (error "%s: AUTO_TEMPLATE parsing error: %s"
+                     (verilog-point-text)
+                     (progn (looking-at ".*$") (match-string 0))))))
+      ;; Return
+      (vector tpl-regexp
+             (list tpl-sig-list tpl-wild-list)))))
+
+(defun verilog-read-auto-template (module)
+  "Look for an auto_template for the instantiation of the given MODULE.
+If found returns `verilog-read-auto-template-inside' structure."
+  (save-excursion
+    ;; Find beginning
+    (let ((pt (point)))
       ;; Note this search is expensive, as we hunt from mod-begin to point
       ;; for every instantiation.  Likewise in verilog-read-auto-lisp.
       ;; So, we look first for an exact string rather than a slow regexp.
@@ -8473,6 +8707,7 @@ list of ( (signal_name connection_name)... )."
       ;; need to record the relative position of each AUTOINST, as multiple
       ;; templates exist for each module, and we're inserting lines.
       (cond ((or
+             ;; See also regexp in `verilog-auto-template-lint'
              (verilog-re-search-backward-substr
               "AUTO_TEMPLATE"
               (concat "^\\s-*/?\\*?\\s-*" module "\\s-+AUTO_TEMPLATE") nil t)
@@ -8484,76 +8719,24 @@ list of ( (signal_name connection_name)... )."
                 "AUTO_TEMPLATE"
                 (concat "^\\s-*/?\\*?\\s-*" module "\\s-+AUTO_TEMPLATE") nil t)))
             (goto-char (match-end 0))
-            ;; Parse "REGEXP"
-            ;; We reserve @"..." for future lisp expressions that evaluate
-            ;; once-per-AUTOINST
-            (when (looking-at "\\s-*\"\\([^\"]*\\)\"")
-              (setq tpl-regexp (match-string 1))
-              (goto-char (match-end 0)))
-            (search-forward "(")
-            ;; Parse lines in the template
-            (when verilog-auto-inst-template-numbers
-              (save-excursion
-                (let ((pre-pt (point)))
-                  (goto-char (point-min))
-                  (while (search-forward "AUTO_TEMPLATE" pre-pt t)
-                    (setq templateno (1+ templateno)))
-                  (while (< (point) pre-pt)
-                    (forward-line 1)
-                    (setq lineno (1+ lineno))))))
-            (setq tpl-end-pt (save-excursion
-                               (backward-char 1)
-                               (verilog-forward-sexp-cmt 1)   ;; Moves to paren that closes argdecl's
-                               (backward-char 1)
-                               (point)))
-            ;;
-            (while (< (point) tpl-end-pt)
-              (cond ((looking-at "\\s-*\\.\\([a-zA-Z0-9`_$]+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
-                     (setq tpl-sig-list
-                           (cons (list
-                                  (match-string-no-properties 1)
-                                  (match-string-no-properties 2)
-                                  templateno lineno)
-                                 tpl-sig-list))
-                     (goto-char (match-end 0)))
-                    ;; Regexp form??
-                    ((looking-at
-                      ;; Regexp bug in XEmacs disallows ][ inside [], and wants + last
-                      "\\s-*\\.\\(\\([a-zA-Z0-9`_$+@^.*?|---]+\\|[][]\\|\\\\[()|]\\)+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
-                     (setq rep (match-string-no-properties 3))
-                     (goto-char (match-end 0))
-                     (setq tpl-wild-list
-                           (cons (list
-                                  (concat "^"
-                                          (verilog-string-replace-matches "@" "\\\\([0-9]+\\\\)" nil nil
-                                                                          (match-string 1))
-                                          "$")
-                                  rep
-                                  templateno lineno)
-                                 tpl-wild-list)))
-                    ((looking-at "[ \t\f]+")
-                     (goto-char (match-end 0)))
-                    ((looking-at "\n")
-                     (setq lineno (1+ lineno))
-                     (goto-char (match-end 0)))
-                    ((looking-at "//")
-                     (search-forward "\n")
-                     (setq lineno (1+ lineno)))
-                    ((looking-at "/\\*")
-                     (forward-char 2)
-                     (or (search-forward "*/")
-                         (error "%s: Unmatched /* */, at char %d" (verilog-point-text) (point))))
-                    (t
-                     (error "%s: AUTO_TEMPLATE parsing error: %s"
-                            (verilog-point-text)
-                            (progn (looking-at ".*$") (match-string 0))))))
-            ;; Return
-            (vector tpl-regexp
-                    (list tpl-sig-list tpl-wild-list)))
+            (verilog-read-auto-template-middle))
            ;; If no template found
-           (t (vector tpl-regexp nil))))))
+           (t (vector "" nil))))))
 ;;(progn (find-file "auto-template.v") (verilog-read-auto-template "ptl_entry"))
 
+(defvar verilog-auto-template-hits nil "Successful lookups with `verilog-read-auto-template-hit'.")
+(make-variable-buffer-local 'verilog-auto-template-hits)
+
+(defun verilog-read-auto-template-hit (tpl-ass)
+  "Record that TPL-ASS template from `verilog-read-auto-template' was used."
+  (when (eval-when-compile (fboundp 'make-hash-table)) ;; else feature not allowed
+    (when verilog-auto-template-warn-unused
+      (unless verilog-auto-template-hits
+       (setq verilog-auto-template-hits
+             (make-hash-table :test 'equal :rehash-size 4.0)))
+      (puthash (vector (nth 2 tpl-ass) (nth 3 tpl-ass)) t
+              verilog-auto-template-hits))))
+
 (defun verilog-set-define (defname defvalue &optional buffer enumname)
   "Set the definition DEFNAME to the DEFVALUE in the given BUFFER.
 Optionally associate it with the specified enumeration ENUMNAME."
@@ -8642,15 +8825,15 @@ warning message, you need to add to your .emacs file:
        (let (enumname)
          ;; The primary way of getting defines is verilog-read-decls
          ;; However, that isn't called yet for included files, so we'll add another scheme
-         (if (looking-at "[^\n]*synopsys\\s +enum\\s +\\([a-zA-Z0-9_]+\\)")
-             (setq enumname (match-string-no-properties 1)))
-         (forward-comment 999)
+         (if (looking-at "[^\n]*\\(auto\\|synopsys\\)\\s +enum\\s +\\([a-zA-Z0-9_]+\\)")
+             (setq enumname (match-string-no-properties 2)))
+         (forward-comment 99999)
          (while (looking-at (concat "\\s-*,?\\s-*\\(?:/[/*].*?$\\)?\\s-*\\([a-zA-Z0-9_$]+\\)"
                                     "\\s-*=\\s-*\\([^;,]*\\),?\\s-*\\(/[/*].*?$\\)?\\s-*"))
            (verilog-set-define (match-string-no-properties 1)
                                (match-string-no-properties 2) origbuf enumname)
            (goto-char (match-end 0))
-           (forward-comment 999)))))))
+           (forward-comment 99999)))))))
 
 (defun verilog-read-includes ()
   "Read `includes for the current file.
@@ -8675,7 +8858,7 @@ this process, Verilint, and readability.  To prevent defining the same
 variable over and over when many modules are compiled together, put a test
 around the inside each include file:
 
-foo.v (a include):
+foo.v (an include file):
        `ifdef _FOO_V   // include if not already included
        `else
        `define _FOO_V
@@ -9038,7 +9221,7 @@ Or, just the existing dirnames themselves if there are no wildcards."
 
 (defun verilog-library-filenames (filename &optional current check-ext)
   "Return a search path to find the given FILENAME or module name.
-Uses the optional CURRENT filename or buffer-file-name, plus
+Uses the optional CURRENT filename or variable `buffer-file-name', plus
 `verilog-library-directories' and `verilog-library-extensions'
 variables to build the path.  With optional CHECK-EXT also check
 `verilog-library-extensions'."
@@ -9091,7 +9274,7 @@ variables to build the path."
 ;; A modi is:  [module-name-string file-name begin-point]
 
 (defvar verilog-cache-enabled t
-  "If true, enable caching of signals, etc.  Set to nil for debugging to make things SLOW!")
+  "Non-nil enables caching of signals, etc.  Set to nil for debugging to make things SLOW!")
 
 (defvar verilog-modi-cache-list nil
   "Cache of ((Module Function) Buf-Tick Buf-Modtime Func-Returns)...
@@ -9106,7 +9289,7 @@ Use `verilog-preserve-modi-cache' to set it.")
   "Modification tick after which the cache is still considered valid.
 Use `verilog-preserve-modi-cache' to set it.")
 (defvar verilog-modi-cache-current-enable nil
-  "If true, allow caching `verilog-modi-current', set by let().")
+  "Non-nil means allow caching `verilog-modi-current', set by let().")
 (defvar verilog-modi-cache-current nil
   "Currently active `verilog-modi-current', if any, set by let().")
 (defvar verilog-modi-cache-current-max nil
@@ -9245,13 +9428,9 @@ Cache the output of function so next call may have faster access."
            (t
             ;; Read from file
             ;; Clear then restore any highlighting to make emacs19 happy
-            (let ((fontlocked (when (and (boundp 'font-lock-mode)
-                                         font-lock-mode)
-                                (font-lock-mode 0)
-                                t))
-                  func-returns)
-              (setq func-returns (funcall function))
-              (when fontlocked (font-lock-mode t))
+            (let (func-returns)
+              (verilog-save-font-mods
+               (setq func-returns (funcall function)))
               ;; Cache for next time
               (setq verilog-modi-cache-list
                     (cons (list (list modi function)
@@ -9341,9 +9520,16 @@ if non-nil."
        (setq in-list (cdr in-list)))
       (nreverse out-list))))
 
+(defun verilog-signals-edit-wire-reg (in-list)
+  "Return all signals in IN-LIST with wire/reg data types made blank."
+  (mapcar (lambda (sig)
+           (when (member (verilog-sig-type sig) '("wire" "reg"))
+             (verilog-sig-type-set sig nil))
+           sig) in-list))
+
 ;; Combined
 (defun verilog-decls-get-signals (decls)
-  "Return all declared signals, excluding 'assign' statements."
+  "Return all declared signals in DECLS, excluding 'assign' statements."
   (append
    (verilog-decls-get-outputs decls)
    (verilog-decls-get-inouts decls)
@@ -9367,10 +9553,6 @@ if non-nil."
 (defsubst verilog-modi-cache-add-vars (modi sig-list)
   (verilog-modi-cache-add modi 'verilog-read-decls 3 sig-list))
 
-(defun verilog-signals-from-signame (signame-list)
-  "Return signals in standard form from SIGNAME-LIST, a simple list of signal names."
-  (mapcar (function (lambda (name) (list name nil nil)))
-         signame-list))
 \f
 ;;
 ;; Auto creation utilities
@@ -9473,7 +9655,7 @@ Presumes that any newlines end a list element."
 ;;(let ((indent-pt 10)) (verilog-insert-indent "hello\n" "addon" "there\n"))
 
 (defun verilog-repair-open-comma ()
-  "Insert comma if previous argument is other than a open parenthesis or endif."
+  "Insert comma if previous argument is other than an open parenthesis or endif."
   ;; We can't just search backward for ) as it might be inside another expression.
   ;; Also want "`ifdef X   input foo   `endif" to just leave things to the human to deal with
   (save-excursion
@@ -9489,7 +9671,7 @@ Presumes that any newlines end a list element."
 
 (defun verilog-repair-close-comma ()
   "If point is at a comma followed by a close parenthesis, fix it.
-This repairs those mis-inserted by a AUTOARG."
+This repairs those mis-inserted by an AUTOARG."
   ;; It would be much nicer if Verilog allowed extra commas like Perl does!
   (save-excursion
     (verilog-forward-close-paren)
@@ -9974,15 +10156,16 @@ Ignores WHITESPACE if t, and writes output to stdout if SHOW."
 Differences are between buffers B1 and B2, starting at point
 DIFFPT.  This function is called via `verilog-diff-function'."
   (let ((name1 (with-current-buffer b1 (buffer-file-name))))
-    (message "%%Warning: %s:%d: Difference in AUTO expansion found"
-            name1 (with-current-buffer b1 (1+ (count-lines (point-min) (point)))))
+    (verilog-warn "%s:%d: Difference in AUTO expansion found"
+                 name1 (with-current-buffer b1
+                         (1+ (count-lines (point-min) (point)))))
     (cond (noninteractive
           (verilog-diff-file-with-buffer name1 b2 t t))
          (t
           (ediff-buffers b1 b2)))))
 
 (defun verilog-diff-auto ()
-  "Expand AUTOs in a temporary buffer and indicate any changes.
+  "Expand AUTOs in a temporary buffer and indicate any change.
 Whitespace differences are ignored to determine identicalness, but
 once a difference is detected, whitespace differences may be shown.
 
@@ -10076,7 +10259,7 @@ If FORCE, always reread it."
 ;;
 
 (defun verilog-auto-arg-ports (sigs message indent-pt)
-  "Print a list of ports for a AUTOINST.
+  "Print a list of ports for an AUTOINST.
 Takes SIGS list, adds MESSAGE to front and inserts each at INDENT-PT."
   (when sigs
     (when verilog-auto-arg-sort
@@ -10178,7 +10361,7 @@ Avoid declaring ports manually, as it makes code harder to maintain."
 (defvar vl-mbits nil "See `verilog-auto-inst'.") ; Prevent compile warning
 
 (defun verilog-auto-inst-port (port-st indent-pt tpl-list tpl-num for-star par-values)
-  "Print out a instantiation connection for this PORT-ST.
+  "Print out an instantiation connection for this PORT-ST.
 Insert to INDENT-PT, use template TPL-LIST.
 @ are instantiation numbers, replaced with TPL-NUM.
 @\"(expression @)\" are evaluated, with @ as a variable.
@@ -10266,6 +10449,7 @@ If PAR-VALUES replace final strings with these parameter values."
       (insert "(" tpl-net ")"))
     (insert ",")
     (cond (tpl-ass
+          (verilog-read-auto-template-hit tpl-ass)
           (indent-to (+ (if (< verilog-auto-inst-column 48) 24 16)
                         verilog-auto-inst-column))
           ;; verilog-insert requires the complete comment in one call - including the newline
@@ -10302,7 +10486,7 @@ If PAR-VALUES replace final strings with these parameter values."
 (defun verilog-auto-inst-first ()
   "Insert , etc before first ever port in this instant, as part of \\[verilog-auto-inst]."
   ;; Do we need a trailing comma?
-  ;; There maybe a ifdef or something similar before us.  What a mess.  Thus
+  ;; There maybe an ifdef or something similar before us.  What a mess.  Thus
   ;; to avoid trouble we only insert on preceding ) or *.
   ;; Insert first port on new line
   (insert "\n")  ;; Must insert before search, so point will move forward if insert comma
@@ -10375,7 +10559,7 @@ For example, first take the submodule InstModule.v:
           wire [31:0] o = {32{i}};
        endmodule
 
-This is then used in a upper level module:
+This is then used in an upper level module:
 
        module ExampInst (o,i);
           output o;
@@ -10438,6 +10622,8 @@ Templates:
   expanded `verilog-mode' simply searches up for the closest template.
   Thus you can have multiple templates for the same module, just alternate
   between the template for an instantiation and the instantiation itself.
+  (For backward compatibility if no template is found above, it
+  will also look below, but do not use this behavior in new designs.)
 
   The module name must be the same as the name of the module in the
   instantiation name, and the code \"AUTO_TEMPLATE\" must be in these exact
@@ -10456,6 +10642,9 @@ Templates:
   debugging is completed though, it will result in lots of extra differences
   and merge conflicts.
 
+  Setting `verilog-auto-template-warn-unused' will report errors
+  if any template lines are unused.
+
   For example:
 
        /* InstModule AUTO_TEMPLATE (
@@ -10656,7 +10845,7 @@ For more information see the \\[verilog-faq] and forums at URL
       (when (and (not (member submod verilog-gate-keywords))
                 (setq submodi (verilog-modi-lookup submod t)))
        (setq submoddecls (verilog-modi-get-decls submodi))
-       ;; If there's a number in the instantiation, it may be a argument to the
+       ;; If there's a number in the instantiation, it may be an argument to the
        ;; automatic variable instantiation program.
        (let* ((tpl-info (verilog-read-auto-template submod))
               (tpl-regexp (aref tpl-info 0)))
@@ -10670,7 +10859,8 @@ For more information see the \\[verilog-faq] and forums at URL
                              (verilog-decls-get-vars submoddecls)
                              skip-pins)))
              (vl-dir "interfaced"))
-         (when sig-list
+         (when (and sig-list
+                    verilog-auto-inst-interfaced-ports)
            (when (not did-first) (verilog-auto-inst-first) (setq did-first t))
             ;; Note these are searched for in verilog-read-sub-decls.
            (verilog-insert-indent "// Interfaced\n")
@@ -10740,7 +10930,7 @@ For example, first take the submodule InstModule.v:
           parameter PAR;
        endmodule
 
-This is then used in a upper level module:
+This is then used in an upper level module:
 
        module ExampInst (o,i);
           parameter PAR;
@@ -10798,7 +10988,7 @@ Templates:
       ;; Note this may raise an error
       (when (setq submodi (verilog-modi-lookup submod t))
        (setq submoddecls (verilog-modi-get-decls submodi))
-       ;; If there's a number in the instantiation, it may be a argument to the
+       ;; If there's a number in the instantiation, it may be an argument to the
        ;; automatic variable instantiation program.
        (let* ((tpl-info (verilog-read-auto-template submod))
               (tpl-regexp (aref tpl-info 0)))
@@ -10867,7 +11057,10 @@ Typing \\[verilog-auto] will make this into:
           (modsubdecls (verilog-modi-get-sub-decls modi))
           (sig-list (verilog-signals-not-in
                      (verilog-decls-get-outputs moddecls)
-                     (append (verilog-decls-get-vars moddecls)
+                     (append (verilog-signals-with ;; ignore typed signals
+                              'verilog-sig-type
+                              (verilog-decls-get-outputs moddecls))
+                             (verilog-decls-get-vars moddecls)
                              (verilog-decls-get-assigns moddecls)
                              (verilog-decls-get-consts moddecls)
                              (verilog-decls-get-gparams moddecls)
@@ -10935,6 +11128,12 @@ Typing \\[verilog-auto] will make this into:
        (verilog-insert-definition modi sig-list "reg" indent-pt nil)
        (verilog-insert-indent "// End of automatics\n")))))
 
+(defun verilog-auto-logic-setup ()
+  "Prepare variables due to AUTOLOGIC."
+  (unless verilog-auto-wire-type
+    (set (make-local-variable 'verilog-auto-wire-type)
+        "logic")))
+
 (defun verilog-auto-logic ()
   "Expand AUTOLOGIC statements, as part of \\[verilog-auto].
 Make wire statements using the SystemVerilog logic keyword.
@@ -10951,15 +11150,13 @@ with the below at the bottom of the file
 In the future AUTOLOGIC may declare additional identifiers,
 while AUTOWIRE will not."
   (save-excursion
-    (unless verilog-auto-wire-type
-      (set (make-local-variable 'verilog-auto-wire-type)
-          "logic"))
+    (verilog-auto-logic-setup)
     (verilog-auto-wire)))
 
 (defun verilog-auto-wire ()
   "Expand AUTOWIRE statements, as part of \\[verilog-auto].
 Make wire statements for instantiations outputs that aren't
-already declared. `verilog-auto-wire-type' may be used to change
+already declared.  `verilog-auto-wire-type' may be used to change
 the datatype of the declarations.
 
 Limitations:
@@ -11027,7 +11224,7 @@ Typing \\[verilog-auto] will make this into:
 (defun verilog-auto-output (&optional with-params)
   "Expand AUTOOUTPUT statements, as part of \\[verilog-auto].
 Make output statements for any output signal from an /*AUTOINST*/ that
-isn't a input to another AUTOINST.  This is useful for modules which
+isn't an input to another AUTOINST.  This is useful for modules which
 only instantiate other modules.
 
 Limitations:
@@ -11037,7 +11234,7 @@ Limitations:
   Verilog 2001 style, else uses Verilog 1995 style.
 
   If any concatenation, or bit-subscripts are missing in the AUTOINSTant's
-  instantiation, all bets are off.  (For example due to a AUTO_TEMPLATE).
+  instantiation, all bets are off.  (For example due to an AUTO_TEMPLATE).
 
   Typedefs must match `verilog-typedef-regexp', which is disabled by default.
 
@@ -11104,7 +11301,7 @@ same expansion will result from only extracting outputs starting with ov:
 (defun verilog-auto-output-every ()
   "Expand AUTOOUTPUTEVERY statements, as part of \\[verilog-auto].
 Make output statements for any signals that aren't primary inputs or
-outputs already.  This makes every signal in the design a output.  This is
+outputs already.  This makes every signal in the design an output.  This is
 useful to get Synopsys to preserve every signal in the design, since it
 won't optimize away the outputs.
 
@@ -11164,7 +11361,7 @@ Limitations:
   Verilog 2001 style, else uses Verilog 1995 style.
 
   If any concatenation, or bit-subscripts are missing in the AUTOINSTant's
-  instantiation, all bets are off.  (For example due to a AUTO_TEMPLATE).
+  instantiation, all bets are off.  (For example due to an AUTO_TEMPLATE).
 
   Typedefs must match `verilog-typedef-regexp', which is disabled by default.
 
@@ -11243,7 +11440,7 @@ Limitations:
   Verilog 2001 style, else uses Verilog 1995 style.
 
   If any concatenation, or bit-subscripts are missing in the AUTOINSTant's
-  instantiation, all bets are off.  (For example due to a AUTO_TEMPLATE).
+  instantiation, all bets are off.  (For example due to an AUTO_TEMPLATE).
 
   Typedefs must match `verilog-typedef-regexp', which is disabled by default.
 
@@ -11326,9 +11523,14 @@ Limitations:
   Module names must be resolvable to filenames.  See `verilog-auto-inst'.
 
   Signals are not inserted in the same order as in the original module,
-  though they will appear to be in the same order to a AUTOINST
+  though they will appear to be in the same order to an AUTOINST
   instantiating either module.
 
+  Signals declared as \"output reg\" or \"output wire\" etc will
+  lose the wire/reg declaration so that shell modules may
+  generate those outputs differently.  However, \"output logic\"
+  is propagated.
+
 An example:
 
        module ExampShell (/*AUTOARG*/);
@@ -11408,22 +11610,25 @@ against the previous example's module:
                             (verilog-decls-get-interfaces submoddecls)
                             (append (verilog-decls-get-interfaces moddecls)))))
          (forward-line 1)
-         (setq sig-list-i  (verilog-signals-matching-dir-re
-                            (verilog-signals-matching-regexp sig-list-i regexp)
-                            "input" direction-re)
-               sig-list-o  (verilog-signals-matching-dir-re
-                            (verilog-signals-matching-regexp sig-list-o regexp)
-                            "output" direction-re)
-               sig-list-io (verilog-signals-matching-dir-re
-                            (verilog-signals-matching-regexp sig-list-io regexp)
-                            "inout" direction-re)
+         (setq sig-list-i  (verilog-signals-edit-wire-reg
+                            (verilog-signals-matching-dir-re
+                             (verilog-signals-matching-regexp sig-list-i regexp)
+                             "input" direction-re))
+               sig-list-o  (verilog-signals-edit-wire-reg
+                            (verilog-signals-matching-dir-re
+                             (verilog-signals-matching-regexp sig-list-o regexp)
+                             "output" direction-re))
+               sig-list-io (verilog-signals-edit-wire-reg
+                            (verilog-signals-matching-dir-re
+                             (verilog-signals-matching-regexp sig-list-io regexp)
+                             "inout" direction-re))
                sig-list-if (verilog-signals-matching-dir-re
                             (verilog-signals-matching-regexp sig-list-if regexp)
                             "interface" direction-re))
          (when v2k (verilog-repair-open-comma))
          (when (or sig-list-i sig-list-o sig-list-io)
            (verilog-insert-indent "// Beginning of automatic in/out/inouts (from specific module)\n")
-           ;; Don't sort them so a upper AUTOINST will match the main module
+           ;; Don't sort them so an upper AUTOINST will match the main module
            (verilog-insert-definition modi sig-list-o  "output" indent-pt v2k t)
            (verilog-insert-definition modi sig-list-io "inout" indent-pt v2k t)
            (verilog-insert-definition modi sig-list-i  "input" indent-pt v2k t)
@@ -11450,7 +11655,7 @@ Limitations:
   Module names must be resolvable to filenames.  See `verilog-auto-inst'.
 
   Signals are not inserted in the same order as in the original module,
-  though they will appear to be in the same order to a AUTOINST
+  though they will appear to be in the same order to an AUTOINST
   instantiating either module.
 
 An example:
@@ -11501,7 +11706,7 @@ Limitations:
   Module names must be resolvable to filenames.  See `verilog-auto-inst'.
 
   Signals are not inserted in the same order as in the original module,
-  though they will appear to be in the same order to a AUTOINST
+  though they will appear to be in the same order to an AUTOINST
   instantiating either module.
 
 An example:
@@ -11624,7 +11829,7 @@ Limitations:
 
 Constant signals:
   AUTOSENSE cannot always determine if a `define is a constant or a signal
-  (it could be in a include file for example).  If a `define or other signal
+  (it could be in an include file for example).  If a `define or other signal
   is put into the AUTOSENSE list and is not desired, use the AUTO_CONSTANT
   declaration anywhere in the module (parenthesis are required):
 
@@ -11726,9 +11931,9 @@ begin/case/if statement and the AUTORESET comment are being reset manually
 and should not be automatically reset.  This includes omitting any signals
 used on the right hand side of assignments.
 
-By default, AUTORESET will include the width of the signal in the autos,
-this is a recent change.  To control this behavior, see
-`verilog-auto-reset-widths'.
+By default, AUTORESET will include the width of the signal in the
+autos, SystemVerilog designs may want to change this.  To control
+this behavior, see `verilog-auto-reset-widths'.
 
 AUTORESET ties signals to deasserted, which is presumed to be zero.
 Signals that match `verilog-active-low-regexp' will be deasserted by tying
@@ -11806,7 +12011,7 @@ Typing \\[verilog-auto] will make this into:
                    (if (assoc (verilog-sig-name sig) dly-list)
                        (concat " <= " verilog-assignment-delay)
                      " = ")
-                   (verilog-sig-tieoff sig (not verilog-auto-reset-widths))
+                   (verilog-sig-tieoff sig)
                    ";\n")
            (setq sig-list (cdr sig-list))))
        (verilog-insert-indent "// End of automatics")))))
@@ -11831,6 +12036,9 @@ You can add signals you do not want included in AUTOTIEOFF with
 `verilog-auto-wire-type' may be used to change the datatype of
 the declarations.
 
+`verilog-auto-reset-widths' may be used to change how the tieoff
+value's width is generated.
+
 An example of making a stub for another module:
 
     module ExampStub (/*AUTOINST*/);
@@ -11893,6 +12101,73 @@ Typing \\[verilog-auto] will make this into:
            (setq sig-list (cdr sig-list))))
        (verilog-insert-indent "// End of automatics\n")))))
 
+(defun verilog-auto-undef ()
+  "Expand AUTOUNDEF statements, as part of \\[verilog-auto].
+Take any `defines since the last AUTOUNDEF in the current file
+and create `undefs for them.  This is used to insure that
+file-local defines do not pollute the global `define name space.
+
+Limitations:
+  AUTOUNDEF presumes any identifier following `define is the
+  name of a define.  Any `ifdefs are ignored.
+
+  AUTOUNDEF suppresses creating an `undef for any define that was
+  `undefed before the AUTOUNDEF.  This may be used to work around
+  the ignoring of `ifdefs as shown below.
+
+An example:
+
+       `define XX_FOO
+       `define M_BAR(x)
+       `define M_BAZ
+       ...
+       `ifdef NEVER
+         `undef M_BAZ  // Emacs will see this and not `undef M_BAZ
+       `endif
+       ...
+       /*AUTOUNDEF*/
+
+Typing \\[verilog-auto] will make this into:
+
+       ...
+       /*AUTOUNDEF*/
+       // Beginning of automatic undefs
+       `undef XX_FOO
+       `undef M_BAR
+       // End of automatics
+
+You may also provide an optional regular expression, in which case only
+defines the regular expression will be undefed."
+  (save-excursion
+    (let* ((params (verilog-read-auto-params 0 1))
+          (regexp (nth 0 params))
+          (indent-pt (current-indentation))
+          (end-pt (point))
+          defs def)
+      (save-excursion
+       ;; Scan from start of file, or last AUTOUNDEF
+       (or (verilog-re-search-backward-quick "/\\*AUTOUNDEF\\>" end-pt t)
+           (goto-char (point-min)))
+       (while (verilog-re-search-forward-quick
+               "`\\(define\\|undef\\)\\s-*\\([a-zA-Z_][a-zA-Z_0-9]*\\)" end-pt t)
+         (cond ((equal (match-string-no-properties 1) "define")
+                (setq def (match-string-no-properties 2))
+                (when (and (or (not regexp)
+                               (string-match regexp def))
+                           (not (member def defs))) ;; delete-dups not in 21.1
+                  (setq defs (cons def defs))))
+               (t
+                (setq defs (delete (match-string-no-properties 2) defs))))))
+      ;; Insert
+      (setq defs (sort defs 'string<))
+      (when defs
+       (forward-line 1)
+       (verilog-insert-indent "// Beginning of automatic undefs\n")
+       (while defs
+         (verilog-insert-indent "`undef " (car defs) "\n")
+         (setq defs (cdr defs)))
+       (verilog-insert-indent "// End of automatics\n")))))
+
 (defun verilog-auto-unused ()
   "Expand AUTOUNUSED statements, as part of \\[verilog-auto].
 Replace the /*AUTOUNUSED*/ comment with a comma separated list of all unused
@@ -11981,17 +12256,17 @@ Remove user provided prefix ELIM-REGEXP."
 
 (defun verilog-auto-ascii-enum ()
   "Expand AUTOASCIIENUM statements, as part of \\[verilog-auto].
-Create a register to contain the ASCII decode of a enumerated signal type.
+Create a register to contain the ASCII decode of an enumerated signal type.
 This will allow trace viewers to show the ASCII name of states.
 
-First, parameters are built into a enumeration using the synopsys enum
+First, parameters are built into an enumeration using the synopsys enum
 comment.  The comment must be between the keyword and the symbol.
 \(Annoying, but that's what Synopsys's dc_shell FSM reader requires.)
 
 Next, registers which that enum applies to are also tagged with the same
 enum.
 
-Finally, a AUTOASCIIENUM command is used.
+Finally, an AUTOASCIIENUM command is used.
 
   The first parameter is the name of the signal to be decoded.
 
@@ -12001,17 +12276,19 @@ Finally, a AUTOASCIIENUM command is used.
   tell viewers like Dinotrace to display in ASCII format.
 
   The third optional parameter is a string which will be removed
-  from the state names. It defaults to "" which removes nothing.
+  from the state names.  It defaults to \"\" which removes nothing.
 
   The fourth optional parameter is \"onehot\" to force one-hot
-  decoding. If unspecified, if and only if the first parameter
+  decoding.  If unspecified, if and only if the first parameter
   width is 2^(number of states in enum) and does NOT match the
-  width of the enum, the signal is assumed to be a one hot
+  width of the enum, the signal is assumed to be a one-hot
   decode.  Otherwise, it's a normal encoded state vector.
 
   `verilog-auto-wire-type' may be used to change the datatype of
   the declarations.
 
+  \"auto enum\" may be used in place of \"synopsys enum\".
+
 An example:
 
        //== State enumeration
@@ -12066,7 +12343,7 @@ Typing \\[verilog-auto] will make this into:
           (undecode-sig (or (assoc undecode-name sig-list-all)
                             (error "%s: Signal %s not found in design" (verilog-point-text) undecode-name)))
           (undecode-enum (or (verilog-sig-enum undecode-sig)
-                             (error "%s: Signal %s does not have a enum tag" (verilog-point-text) undecode-name)))
+                             (error "%s: Signal %s does not have an enum tag" (verilog-point-text) undecode-name)))
           ;;
           (enum-sigs (verilog-signals-not-in
                       (or (verilog-signals-matching-enum sig-list-consts undecode-enum)
@@ -12159,12 +12436,39 @@ being different from the final output's line numbering."
                                 (string-to-number (match-string 2)))))
        t t))))
 
+(defun verilog-auto-template-lint ()
+  "Check AUTO_TEMPLATEs for unused lines.
+Enable with `verilog-auto-template-warn-unused'."
+  (let ((name1 (or (buffer-file-name) (buffer-name))))
+    (save-excursion
+      (goto-char (point-min))
+      (while (re-search-forward
+             "^\\s-*/?\\*?\\s-*[a-zA-Z0-9`_$]+\\s-+AUTO_TEMPLATE" nil t)
+       (let* ((tpl-info (verilog-read-auto-template-middle))
+              (tpl-list (aref tpl-info 1))
+              (tlines (append (nth 0 tpl-list) (nth 1 tpl-list)))
+              tpl-ass)
+         (while tlines
+           (setq tpl-ass (car tlines)
+                 tlines (cdr tlines))
+           ;;;
+           (unless (or (not (eval-when-compile (fboundp 'make-hash-table))) ;; Not supported, no warning
+                       (not verilog-auto-template-hits)
+                       (gethash (vector (nth 2 tpl-ass) (nth 3 tpl-ass))
+                                verilog-auto-template-hits))
+             (verilog-warn-error "%s:%d: AUTO_TEMPLATE line unused: \".%s (%s)\""
+                                 name1
+                                 (+ (elt tpl-ass 3)  ;; Template line number
+                                    (count-lines (point-min) (point)))
+                                 (elt tpl-ass 0) (elt tpl-ass 1))
+             )))))))
+
 \f
 ;;
 ;; Auto top level
 ;;
 
-(defun verilog-auto (&optional inject)  ; Use verilog-inject-auto instead of passing a arg
+(defun verilog-auto (&optional inject)  ; Use verilog-inject-auto instead of passing an arg
   "Expand AUTO statements.
 Look for any /*AUTO...*/ commands in the code, as used in
 instantiations or argument headers.  Update the list of signals
@@ -12219,6 +12523,7 @@ Using \\[describe-function], see also:
     `verilog-auto-reset'        for AUTORESET flop resets
     `verilog-auto-sense'        for AUTOSENSE always sensitivity lists
     `verilog-auto-tieoff'       for AUTOTIEOFF output tieoffs
+    `verilog-auto-undef'        for AUTOUNDEF `undef of local `defines
     `verilog-auto-unused'       for AUTOUNUSED unused inputs/inouts
     `verilog-auto-wire'         for AUTOWIRE instantiation wires
 
@@ -12232,21 +12537,15 @@ Wilson Snyder (wsnyder@wsnyder.org)."
   (unless noninteractive (message "Updating AUTOs..."))
   (if (fboundp 'dinotrace-unannotate-all)
       (dinotrace-unannotate-all))
-  (let ((oldbuf (if (not (buffer-modified-p))
-                   (buffer-string)))
-       ;; Before version 20, match-string with font-lock returns a
-       ;; vector that is not equal to the string.  IE if on "input"
-       ;; nil==(equal "input" (progn (looking-at "input") (match-string 0)))
-       (fontlocked (when (and (boundp 'font-lock-mode)
-                              font-lock-mode)
-                     (font-lock-mode 0)
-                     t))
-       ;; Cache directories; we don't write new files, so can't change
-       (verilog-dir-cache-preserving t)
-       ;; Cache current module
-       (verilog-modi-cache-current-enable t)
-       (verilog-modi-cache-current-max (point-min)) ; IE it's invalid
-       verilog-modi-cache-current)
+  (verilog-save-font-mods
+   (let ((oldbuf (if (not (buffer-modified-p))
+                    (buffer-string)))
+        ;; Cache directories; we don't write new files, so can't change
+        (verilog-dir-cache-preserving t)
+        ;; Cache current module
+        (verilog-modi-cache-current-enable t)
+        (verilog-modi-cache-current-max (point-min)) ; IE it's invalid
+        verilog-modi-cache-current)
      (unwind-protect
         ;; Disable change hooks for speed
         ;; This let can't be part of above let; must restore
@@ -12257,6 +12556,8 @@ Wilson Snyder (wsnyder@wsnyder.org)."
             ;; Wipe cache; otherwise if we AUTOed a block above this one,
             ;; we'll misremember we have generated IOs, confusing AUTOOUTPUT
             (setq verilog-modi-cache-list nil)
+            ;; Local state
+            (setq verilog-auto-template-hits nil)
             ;; If we're not in verilog-mode, change syntax table so parsing works right
             (unless (eq major-mode `verilog-mode) (verilog-mode))
             ;; Allow user to customize
@@ -12272,6 +12573,8 @@ Wilson Snyder (wsnyder@wsnyder.org)."
              (when verilog-auto-read-includes
                (verilog-read-includes)
                (verilog-read-defines nil nil t))
+             ;; Setup variables due to SystemVerilog expansion
+             (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic-setup)
              ;; This particular ordering is important
              ;; INST: Lower modules correct, no internal dependencies, FIRST
              (verilog-preserve-modi-cache
@@ -12284,7 +12587,7 @@ Wilson Snyder (wsnyder@wsnyder.org)."
                 (verilog-inject-arg))
               ;;
               ;; Do user inserts first, so their code can insert AUTOs
-              ;; We may provide a AUTOINSERTLISPLAST if another cleanup pass is needed
+              ;; We may provide an AUTOINSERTLISPLAST if another cleanup pass is needed
               (verilog-auto-re-search-do "/\\*AUTOINSERTLISP(.*?)\\*/"
                                          'verilog-auto-insert-lisp)
               ;; Expand instances before need the signals the instances input/output
@@ -12313,6 +12616,8 @@ Wilson Snyder (wsnyder@wsnyder.org)."
               (verilog-auto-re-search-do "/\\*AUTOINOUT\\*/" 'verilog-auto-inout)
               ;; Then tie off those in/outs
               (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff)
+              ;; These can be anywhere after AUTOINSERTLISP
+              (verilog-auto-re-search-do "/\\*AUTOUNDEF\\((\"[^\"]*\")\\)?\\*/" 'verilog-auto-undef)
               ;; Wires/regs must be after inputs/outputs
               (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic)
               (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire)
@@ -12326,7 +12631,9 @@ Wilson Snyder (wsnyder@wsnyder.org)."
               (verilog-auto-re-search-do "/\\*AUTOARG\\*/" 'verilog-auto-arg)
               ;; Fix line numbers (comments only)
               (when verilog-auto-inst-template-numbers
-                (verilog-auto-templated-rel))))
+                (verilog-auto-templated-rel))
+              (when verilog-auto-template-warn-unused
+                (verilog-auto-template-lint))))
             ;;
             (verilog-run-hooks 'verilog-auto-hook)
             ;;
@@ -12343,9 +12650,8 @@ Wilson Snyder (wsnyder@wsnyder.org)."
             ;; End of after-change protection
             )))
        ;; Unwind forms
-       (progn
-        ;; Restore font-lock
-        (when fontlocked (font-lock-mode t))))))
+       ;; Currently handled in verilog-save-font-mods
+       ))))
 \f
 
 ;;
@@ -12650,7 +12956,7 @@ and the case items."
 (define-skeleton verilog-sk-def-reg
   "Insert a reg definition."
   ()
-  > "reg    [" '(verilog-sk-prompt-width) | -1 verilog-sk-signal ";" \n (verilog-pretty-declarations) )
+  > "reg    [" '(verilog-sk-prompt-width) | -1 verilog-sk-signal ";" \n (verilog-pretty-declarations-auto) )
 
 (defun verilog-sk-define-signal ()
   "Insert a definition of signal under point at top of module."
@@ -12914,9 +13220,12 @@ Files are checked based on `verilog-library-flags'."
      (concat "verilog-mode v" verilog-mode-version)
      '(
        verilog-active-low-regexp
+       verilog-after-save-font-hook
        verilog-align-ifelse
        verilog-assignment-delay
        verilog-auto-arg-sort
+       verilog-auto-declare-nettype
+       verilog-auto-delete-trailing-whitespace
        verilog-auto-endcomments
        verilog-auto-hook
        verilog-auto-ignore-concat
@@ -12925,23 +13234,32 @@ Files are checked based on `verilog-library-flags'."
        verilog-auto-input-ignore-regexp
        verilog-auto-inst-column
        verilog-auto-inst-dot-name
+       verilog-auto-inst-interfaced-ports
        verilog-auto-inst-param-value
+       verilog-auto-inst-sort
        verilog-auto-inst-template-numbers
        verilog-auto-inst-vector
        verilog-auto-lineup
        verilog-auto-newline
        verilog-auto-output-ignore-regexp
        verilog-auto-read-includes
+       verilog-auto-reset-blocking-in-non
        verilog-auto-reset-widths
        verilog-auto-save-policy
        verilog-auto-sense-defines-constant
        verilog-auto-sense-include-inputs
        verilog-auto-star-expand
        verilog-auto-star-save
+       verilog-auto-template-warn-unused
+       verilog-auto-tieoff-declaration
+       verilog-auto-tieoff-ignore-regexp
        verilog-auto-unused-ignore-regexp
+       verilog-auto-wire-type
        verilog-before-auto-hook
        verilog-before-delete-auto-hook
        verilog-before-getopt-flags-hook
+       verilog-before-save-font-hook
+       verilog-cache-enabled
        verilog-case-indent
        verilog-cexp-indent
        verilog-compiler
@@ -12949,6 +13267,8 @@ Files are checked based on `verilog-library-flags'."
        verilog-delete-auto-hook
        verilog-getopt-flags-hook
        verilog-highlight-grouping-keywords
+       verilog-highlight-includes
+       verilog-highlight-modules
        verilog-highlight-p1800-keywords
        verilog-highlight-translate-off
        verilog-indent-begin-after-if
@@ -12966,11 +13286,15 @@ Files are checked based on `verilog-library-flags'."
        verilog-linter
        verilog-minimum-comment-distance
        verilog-mode-hook
+       verilog-mode-release-date
+       verilog-mode-release-emacs
+       verilog-mode-version
        verilog-preprocessor
        verilog-simulator
        verilog-tab-always-indent
        verilog-tab-to-comment
        verilog-typedef-regexp
+       verilog-warn-fatal
        )
      nil nil
      (concat "Hi Mac,
index c9bf638bb599cb775809edf4041943a84cfcd58a..5177bc6d9f5a270e405d0d69df9f6c66edba1492 100644 (file)
 ;; filed in the Emacs bug reporting system against this file, a copy
 ;; of the bug report be sent to the maintainer's email address.
 
-(defconst vhdl-version "3.33.6"
+(defconst vhdl-version "3.33.28"
   "VHDL Mode version number.")
 
-(defconst vhdl-time-stamp "2005-08-30"
+(defconst vhdl-time-stamp "2010-09-22"
   "VHDL Mode time stamp for last update.")
 
 ;; This file is part of GNU Emacs.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Emacs Versions
 
-;; supported: GNU Emacs 20.X/21.X/22.X, XEmacs 20.X/21.X
-;; tested on: GNU Emacs 20.4, XEmacs 21.1 (marginally)
+;; supported: GNU Emacs 20.X/21.X/22.X,23.X, XEmacs 20.X/21.X
+;; tested on: GNU Emacs 20.4/21.3/22.1,23.X, XEmacs 21.1 (marginally)
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Installation
 
-;; Prerequisites:  GNU Emacs 20.X/21.X/22.X, XEmacs 20.X/21.X.
+;; Prerequisites:  GNU Emacs 20.X/21.X/22.X/23.X, XEmacs 20.X/21.X.
 
 ;; Put `vhdl-mode.el' into the `site-lisp' directory of your Emacs installation
 ;; or into an arbitrary directory that is added to the load path by the
@@ -93,7 +93,7 @@
 
 ;; Add the following lines to the `site-start.el' file in the `site-lisp'
 ;; directory of your Emacs installation or to your Emacs start-up file `.emacs'
-;; (not required in Emacs 20.X):
+;; (not required in Emacs 20 and higher):
 
 ;;   (autoload 'vhdl-mode "vhdl-mode" "VHDL Mode" t)
 ;;   (setq auto-mode-alist (cons '("\\.vhdl?\\'" . vhdl-mode) auto-mode-alist))
@@ -184,7 +184,7 @@ Examples:
   \".*\"           \"\"      inserts empty string")
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; User variables
+;; User variables (customization options)
 
 (defgroup vhdl nil
   "Customizations for VHDL Mode."
@@ -198,7 +198,7 @@ Examples:
   :group 'vhdl)
 
 (defcustom vhdl-indent-tabs-mode nil
-  "*Non-nil means indentation can insert tabs.
+  "Non-nil means indentation can insert tabs.
 Overrides local variable `indent-tabs-mode'."
   :type 'boolean
   :group 'vhdl-mode)
@@ -210,6 +210,17 @@ Overrides local variable `indent-tabs-mode'."
 
 (defcustom vhdl-compiler-alist
   '(
+    ("ADVance MS" "vacom" "-work \\1" "make" "-f \\1"
+     nil "valib \\1; vamap \\2 \\1" "./" "work/" "Makefile" "adms"
+     ("\\s-\\([0-9]+\\):" 0 1 0) ("Compiling file \\(.+\\)" 1)
+     ("ENTI/\\1.vif" "ARCH/\\1-\\2.vif" "CONF/\\1.vif"
+      "PACK/\\1.vif" "BODY/\\1.vif" upcase))
+    ;; Aldec
+    ;; COMP96 ERROR COMP96_0078: "Unknown identifier "Addr_Bits"." "<filename>" 40 30
+    ("Aldec" "vcom" "-93 -work \\1" "make" "-f \\1"
+     nil "vlib \\1; vmap \\2 \\1" "./" "work/" "Makefile" "aldec"
+     (".+?[ \t]+\\(?:ERROR\\)[^:]+:.+?\\(?:.+\"\\(.+?\\)\"[ \t]+\\([0-9]+\\)\\)" 1 2 0) ("" 0)
+     nil)
     ;; Cadence Leapfrog: cv -file test.vhd
     ;; duluth: *E,430 (test.vhd,13): identifier (POSITIV) is not declared
     ("Cadence Leapfrog" "cv" "-work \\1 -file" "make" "-f \\1"
@@ -225,6 +236,12 @@ Overrides local variable `indent-tabs-mode'."
      ("ncvhdl_p: \\*E,\\w+ (\\(.+\\),\\([0-9]+\\)|\\([0-9]+\\)):" 1 2 3) ("" 0)
      ("\\1/entity/pc.db" "\\2/\\1/pc.db" "\\1/configuration/pc.db"
       "\\1/package/pc.db" "\\1/body/pc.db" downcase))
+    ;; ghdl vhdl: ghdl test.vhd
+    ("GHDL" "ghdl" "-i --workdir=\\1 --ieee=synopsys -fexplicit " "make" "-f \\1"
+     nil "mkdir \\1" "./" "work/" "Makefile" "ghdl"
+     ("ghdl_p: \\*E,\\w+ (\\(.+\\),\\([0-9]+\\)|\\([0-9]+\\)):" 1 2 3) ("" 0)
+     ("\\1/entity" "\\2/\\1" "\\1/configuration"
+      "\\1/package" "\\1/body" downcase))
     ;; Ikos Voyager: analyze test.vhd
     ;; analyze test.vhd
     ;; E L4/C5:        this library unit is inaccessible
@@ -236,10 +253,11 @@ Overrides local variable `indent-tabs-mode'."
     ;; ModelSim, Model Technology: vcom test.vhd
     ;; ERROR: test.vhd(14): Unknown identifier: positiv
     ;; WARNING[2]: test.vhd(85): Possible infinite loop
+    ;; ** Warning: [4] ../src/emacsvsim.vhd(43): An abstract ...
     ;; ** Error: adder.vhd(190): Unknown identifier: ctl_numb
     ("ModelSim" "vcom" "-93 -work \\1" "make" "-f \\1"
      nil "vlib \\1; vmap \\2 \\1" "./" "work/" "Makefile" "modelsim"
-     ("\\(ERROR\\|WARNING\\|\\*\\* Error\\|\\*\\* Warning\\)[^:]*: \\(.+\\)(\\([0-9]+\\)):" 2 3 0) ("" 0)
+     ("\\(ERROR\\|WARNING\\|\\*\\* Error\\|\\*\\* Warning\\)[^:]*:\\( *\[[0-9]+\]\\)? \\(.+\\)(\\([0-9]+\\)):" 3 4 0) ("" 0)
      ("\\1/_primary.dat" "\\2/\\1.dat" "\\1/_primary.dat"
       "\\1/_primary.dat" "\\1/body.dat" downcase))
     ;; ProVHDL, Synopsys LEDA: provhdl -w work -f test.vhd
@@ -321,8 +339,14 @@ Overrides local variable `indent-tabs-mode'."
      ("\\*\\*Error: LINE \\([0-9]+\\) \\*\\*\\*" 0 1 0)
      ("^ *Compiling \"\\(.+\\)\" " 1)
      nil)
+    ;; Xilinx XST:
+    ;; ERROR:HDLParsers:164 - "test.vhd" Line 3. parse error
+    ("Xilinx XST" "xflow" "" "make" "-f \\1"
+     nil "mkdir \\1" "./" "work/" "Makefile" "xilinx"
+     ("^ERROR:HDLParsers:[0-9]+ - \"\\(.+\\)\" Line \\([0-9]+\\)\." 1 2 0) ("" 0)
+     nil)
     )
-  "*List of available VHDL compilers and their properties.
+  "List of available VHDL compilers and their properties.
 Each list entry specifies the following items for a compiler:
 Compiler:
   Compiler name    : name used in option `vhdl-compiler' to choose compiler
@@ -428,8 +452,8 @@ NOTE: Activate new error and file message regexps and reflect the new setting
         (vhdl-custom-set variable value 'vhdl-update-mode-menu))
   :group 'vhdl-compile)
 
-(defcustom vhdl-compiler "ModelSim"
-  "*Specifies the VHDL compiler to be used for syntax analysis.
+(defcustom vhdl-compiler "GHDL"
+  "Specifies the VHDL compiler to be used for syntax analysis.
 Select a compiler name from the ones defined in option `vhdl-compiler-alist'."
   :type (let ((alist vhdl-compiler-alist) list)
          (while alist
@@ -439,7 +463,7 @@ Select a compiler name from the ones defined in option `vhdl-compiler-alist'."
   :group 'vhdl-compile)
 
 (defcustom vhdl-compile-use-local-error-regexp t
-  "*Non-nil means use buffer-local `compilation-error-regexp-alist'.
+  "Non-nil means use buffer-local `compilation-error-regexp-alist'.
 In this case, only error message regexps for VHDL compilers are active if
 compilation is started from a VHDL buffer.  Otherwise, the error message
 regexps are appended to the predefined global regexps, and all regexps are
@@ -450,8 +474,19 @@ NOTE: Activate the new setting by restarting Emacs."
   :type 'boolean
   :group 'vhdl-compile)
 
+(defcustom vhdl-makefile-default-targets '("all" "clean" "library")
+  "List of default target names in Makefiles.
+Automatically generated Makefiles include three default targets to compile
+the entire design, clean the entire design and to create the design library.
+This option allows to change the names of these targets to avoid conflicts
+with other user Makefiles."
+  :type '(list (string :tag "Compile entire design")
+              (string :tag "Clean entire design  ")
+              (string :tag "Create design library"))
+  :group 'vhdl-compile)
+
 (defcustom vhdl-makefile-generation-hook nil
-  "*Functions to run at the end of Makefile generation.
+  "Functions to run at the end of Makefile generation.
 Allows to insert user specific parts into a Makefile.
 
 Example:
@@ -462,7 +497,7 @@ Example:
   :group 'vhdl-compile)
 
 (defcustom vhdl-default-library "work"
-  "*Name of default library.
+  "Name of default library.
 Is overwritten by project settings if a project is active."
   :type 'string
   :group 'vhdl-compile)
@@ -488,7 +523,7 @@ Is overwritten by project settings if a project is active."
 -- This is a multi-line project description
 -- that can be used as a project dependent part of the file header.
 "))
-  "*List of projects and their properties.
+  "List of projects and their properties.
   Name             : name used in option `vhdl-project' to choose project
   Title            : title of project (single-line string)
   Default directory: default project directory (absolute path)
@@ -594,7 +629,7 @@ NOTE: Reflect the new setting in the choice list of option `vhdl-project'
   :group 'vhdl-project)
 
 (defcustom vhdl-project nil
-  "*Specifies the default for the current project.
+  "Specifies the default for the current project.
 Select a project name from the ones defined in option `vhdl-project-alist'.
 Is used to determine the project title and description to be inserted in file
 headers and the source files/directories to be scanned in the hierarchy
@@ -608,7 +643,7 @@ browser.  The current project can also be changed temporarily in the menu."
   :group 'vhdl-project)
 
 (defcustom vhdl-project-file-name '("\\1.prj")
-  "*List of file names/paths for importing/exporting project setups.
+  "List of file names/paths for importing/exporting project setups.
 \"\\1\" is replaced by the project name (SPC is replaced by `_'), \"\\2\" is
 replaced by the user name (allows to have user-specific project setups).
 The first entry is used as file name to import/export individual project
@@ -624,7 +659,7 @@ in global directories)."
   :group 'vhdl-project)
 
 (defcustom vhdl-project-auto-load '(startup)
-  "*Automatically load project setups from files.
+  "Automatically load project setups from files.
 All project setup files that match the file names specified in option
 `vhdl-project-file-name' are automatically loaded.  The project of the
 \(alphabetically) last loaded setup of the first `vhdl-project-file-name'
@@ -635,7 +670,7 @@ A project setup file can be obtained by exporting a project (see menu).
   :group 'vhdl-project)
 
 (defcustom vhdl-project-sort t
-  "*Non-nil means projects are displayed in alphabetical order."
+  "Non-nil means projects are displayed in alphabetical order."
   :type 'boolean
   :group 'vhdl-project)
 
@@ -647,11 +682,11 @@ A project setup file can be obtained by exporting a project (see menu).
   :group 'vhdl-port
   :group 'vhdl-compose)
 
-(defcustom vhdl-standard '(87 nil)
-  "*VHDL standards used.
+(defcustom vhdl-standard '(93 nil)
+  "VHDL standards used.
 Basic standard:
   VHDL'87      : IEEE Std 1076-1987
-  VHDL'93      : IEEE Std 1076-1993
+  VHDL'93/02   : IEEE Std 1076-1993/2002
 Additional standards:
   VHDL-AMS     : IEEE Std 1076.1 (analog-mixed-signal)
   Math packages: IEEE Std 1076.2 (`math_real', `math_complex')
@@ -660,7 +695,7 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
       \"Activate Options\"."
   :type '(list (choice :tag "Basic standard"
                       (const :tag "VHDL'87" 87)
-                      (const :tag "VHDL'93" 93))
+                      (const :tag "VHDL'93/02" 93))
               (set :tag "Additional standards" :indent 2
                    (const :tag "VHDL-AMS" ams)
                    (const :tag "Math packages" math)))
@@ -675,13 +710,13 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   :group 'vhdl-style)
 
 (defcustom vhdl-basic-offset 2
-  "*Amount of basic offset used for indentation.
+  "Amount of basic offset used for indentation.
 This value is used by + and - symbols in `vhdl-offsets-alist'."
   :type 'integer
   :group 'vhdl-style)
 
 (defcustom vhdl-upper-case-keywords nil
-  "*Non-nil means convert keywords to upper case.
+  "Non-nil means convert keywords to upper case.
 This is done when typed or expanded or by the fix case functions."
   :type 'boolean
   :set (lambda (variable value)
@@ -689,7 +724,7 @@ This is done when typed or expanded or by the fix case functions."
   :group 'vhdl-style)
 
 (defcustom vhdl-upper-case-types nil
-  "*Non-nil means convert standardized types to upper case.
+  "Non-nil means convert standardized types to upper case.
 This is done when expanded or by the fix case functions."
   :type 'boolean
   :set (lambda (variable value)
@@ -697,7 +732,7 @@ This is done when expanded or by the fix case functions."
   :group 'vhdl-style)
 
 (defcustom vhdl-upper-case-attributes nil
-  "*Non-nil means convert standardized attributes to upper case.
+  "Non-nil means convert standardized attributes to upper case.
 This is done when expanded or by the fix case functions."
   :type 'boolean
   :set (lambda (variable value)
@@ -705,7 +740,7 @@ This is done when expanded or by the fix case functions."
   :group 'vhdl-style)
 
 (defcustom vhdl-upper-case-enum-values nil
-  "*Non-nil means convert standardized enumeration values to upper case.
+  "Non-nil means convert standardized enumeration values to upper case.
 This is done when expanded or by the fix case functions."
   :type 'boolean
   :set (lambda (variable value)
@@ -713,7 +748,7 @@ This is done when expanded or by the fix case functions."
   :group 'vhdl-style)
 
 (defcustom vhdl-upper-case-constants t
-  "*Non-nil means convert standardized constants to upper case.
+  "Non-nil means convert standardized constants to upper case.
 This is done when expanded."
   :type 'boolean
   :set (lambda (variable value)
@@ -721,7 +756,7 @@ This is done when expanded."
   :group 'vhdl-style)
 
 (defcustom vhdl-use-direct-instantiation 'standard
-  "*Non-nil means use VHDL'93 direct component instantiation.
+  "Non-nil means use VHDL'93 direct component instantiation.
   Never   : never
   Standard: only in VHDL standards that allow it (VHDL'93 and higher)
   Always  : always"
@@ -730,6 +765,14 @@ This is done when expanded."
                 (const :tag "Always" always))
   :group 'vhdl-style)
 
+(defcustom vhdl-array-index-record-field-in-sensitivity-list t
+  "Non-nil means include array indices / record fields in sensitivity list.
+If a signal read in a process is a record field or pointed to by an array
+index, the record field or array index is included with the record name in
+the sensitivity list (e.g. \"in1(0)\", \"in2.f0\").
+Otherwise, only the record name is included (e.g. \"in1\", \"in2\")."
+  :type 'boolean
+  :group 'vhdl-style)
 
 (defgroup vhdl-naming nil
   "Customizations for naming conventions."
@@ -737,7 +780,7 @@ This is done when expanded."
 
 (defcustom vhdl-entity-file-name '(".*" . "\\&")
   (concat
-   "*Specifies how the entity file name is obtained.
+   "Specifies how the entity file name is obtained.
 The entity file name can be obtained by modifying the entity name (e.g.
 attaching or stripping off a substring).  The file extension is automatically
 taken from the file name of the current buffer."
@@ -749,7 +792,7 @@ taken from the file name of the current buffer."
 
 (defcustom vhdl-architecture-file-name '("\\(.*\\) \\(.*\\)" . "\\1_\\2")
   (concat
-   "*Specifies how the architecture file name is obtained.
+   "Specifies how the architecture file name is obtained.
 The architecture file name can be obtained by modifying the entity
 and/or architecture name (e.g. attaching or stripping off a substring).  The
 file extension is automatically taken from the file name of the current
@@ -764,7 +807,7 @@ access to both names (see default setting as example)."
 
 (defcustom vhdl-configuration-file-name '(".*" . "\\&")
   (concat
-   "*Specifies how the configuration file name is obtained.
+   "Specifies how the configuration file name is obtained.
 The configuration file name can be obtained by modifying the configuration
 name (e.g. attaching or stripping off a substring).  The file extension is
 automatically taken from the file name of the current buffer."
@@ -776,7 +819,7 @@ automatically taken from the file name of the current buffer."
 
 (defcustom vhdl-package-file-name '(".*" . "\\&")
   (concat
-   "*Specifies how the package file name is obtained.
+   "Specifies how the package file name is obtained.
 The package file name can be obtained by modifying the package name (e.g.
 attaching or stripping off a substring).  The file extension is automatically
 taken from the file name of the current buffer.  Package files can be created
@@ -789,7 +832,7 @@ file name."
   :group 'vhdl-compose)
 
 (defcustom vhdl-file-name-case 'identity
-  "*Specifies how to change case for obtaining file names.
+  "Specifies how to change case for obtaining file names.
 When deriving a file name from a VHDL unit name, case can be changed as
 follows:
   As Is:      case is not changed (taken as is)
@@ -809,7 +852,7 @@ follows:
   :group 'vhdl)
 
 (defcustom vhdl-electric-keywords '(vhdl user)
-  "*Type of keywords for which electrification is enabled.
+  "Type of keywords for which electrification is enabled.
   VHDL keywords: invoke built-in templates
   User keywords: invoke user models (see option `vhdl-model-alist')"
   :type '(set (const :tag "VHDL keywords" vhdl)
@@ -819,7 +862,7 @@ follows:
   :group 'vhdl-template)
 
 (defcustom vhdl-optional-labels 'process
-  "*Constructs for which labels are to be queried.
+  "Constructs for which labels are to be queried.
 Template generators prompt for optional labels for:
   None          : no constructs
   Processes only: processes only (also procedurals in VHDL-AMS)
@@ -830,7 +873,7 @@ Template generators prompt for optional labels for:
   :group 'vhdl-template)
 
 (defcustom vhdl-insert-empty-lines 'unit
-  "*Specifies whether to insert empty lines in some templates.
+  "Specifies whether to insert empty lines in some templates.
 This improves readability of code.  Empty lines are inserted in:
   None             : no constructs
   Design units only: entities, architectures, configurations, packages only
@@ -845,7 +888,7 @@ Replaces option `vhdl-additional-empty-lines'."
   :group 'vhdl-compose)
 
 (defcustom vhdl-argument-list-indent nil
-  "*Non-nil means indent argument lists relative to opening parenthesis.
+  "Non-nil means indent argument lists relative to opening parenthesis.
 That is, argument, association, and port lists start on the same line as the
 opening parenthesis and subsequent lines are indented accordingly.
 Otherwise, lists start on a new line and are indented as normal code."
@@ -855,7 +898,7 @@ Otherwise, lists start on a new line and are indented as normal code."
   :group 'vhdl-compose)
 
 (defcustom vhdl-association-list-with-formals t
-  "*Non-nil means write association lists with formal parameters.
+  "Non-nil means write association lists with formal parameters.
 Templates prompt for formal and actual parameters (ports/generics).
 When pasting component instantiations, formals are included.
 If nil, only a list of actual parameters is entered."
@@ -865,17 +908,17 @@ If nil, only a list of actual parameters is entered."
   :group 'vhdl-compose)
 
 (defcustom vhdl-conditions-in-parenthesis nil
-  "*Non-nil means place parenthesis around condition expressions."
+  "Non-nil means place parenthesis around condition expressions."
   :type 'boolean
   :group 'vhdl-template)
 
 (defcustom vhdl-zero-string "'0'"
-  "*String to use for a logic zero."
+  "String to use for a logic zero."
   :type 'string
   :group 'vhdl-template)
 
 (defcustom vhdl-one-string "'1'"
-  "*String to use for a logic one."
+  "String to use for a logic one."
   :type 'string
   :group 'vhdl-template)
 
@@ -906,7 +949,7 @@ If nil, only a list of actual parameters is entered."
 -------------------------------------------------------------------------------
 
 "
-  "*String or file to insert as file header.
+  "String or file to insert as file header.
 If the string specifies an existing file name, the contents of the file is
 inserted, otherwise the string itself is inserted as file header.
 Type `C-j' for newlines.
@@ -916,7 +959,8 @@ if the header needs to be version controlled.
 The following keywords for template generation are supported:
   <filename>    : replaced by the name of the buffer
   <author>      : replaced by the user name and email address
-                  \(`user-full-name', `mail-host-address', `user-mail-address')
+                  \(`user-full-name',`mail-host-address', `user-mail-address')
+  <authorfull>  : replaced by the user full name (`user-full-name')
   <login>       : replaced by user login name (`user-login-name')
   <company>     : replaced by contents of option `vhdl-company-name'
   <date>        : replaced by the current date
@@ -936,7 +980,7 @@ dependent part of the file header and can also contain the above keywords."
   :group 'vhdl-header)
 
 (defcustom vhdl-file-footer ""
-  "*String or file to insert as file footer.
+  "String or file to insert as file footer.
 If the string specifies an existing file name, the contents of the file is
 inserted, otherwise the string itself is inserted as file footer (i.e. at
 the end of the file).
@@ -946,7 +990,7 @@ The same keywords as in option `vhdl-file-header' can be used."
   :group 'vhdl-header)
 
 (defcustom vhdl-company-name ""
-  "*Name of company to insert in file header.
+  "Name of company to insert in file header.
 See option `vhdl-file-header'."
   :type 'string
   :group 'vhdl-header)
@@ -955,14 +999,14 @@ See option `vhdl-file-header'."
 -------------------------------------------------------------------------------
 -- Copyright (c) <year> <company>
 "
-  "*Copyright string to insert in file header.
+  "Copyright string to insert in file header.
 Can be multi-line string (type `C-j' for newline) and contain other file
 header keywords (see option `vhdl-file-header')."
   :type 'string
   :group 'vhdl-header)
 
 (defcustom vhdl-platform-spec ""
-  "*Specification of VHDL platform to insert in file header.
+  "Specification of VHDL platform to insert in file header.
 The platform specification should contain names and versions of the
 simulation and synthesis tools used.
 See option `vhdl-file-header'."
@@ -970,7 +1014,7 @@ See option `vhdl-file-header'."
   :group 'vhdl-header)
 
 (defcustom vhdl-date-format "%Y-%m-%d"
-  "*Specifies the date format to use in the header.
+  "Specifies the date format to use in the header.
 This string is passed as argument to the command `format-time-string'.
 For more information on format strings, see the documentation for the
 `format-time-string' command (C-h f `format-time-string')."
@@ -978,7 +1022,7 @@ For more information on format strings, see the documentation for the
   :group 'vhdl-header)
 
 (defcustom vhdl-modify-date-prefix-string "-- Last update: "
-  "*Prefix string of modification date in VHDL file header.
+  "Prefix string of modification date in VHDL file header.
 If actualization of the modification date is called (menu,
 `\\[vhdl-template-modify]'), this string is searched and the rest
 of the line replaced by the current date."
@@ -986,7 +1030,7 @@ of the line replaced by the current date."
   :group 'vhdl-header)
 
 (defcustom vhdl-modify-date-on-saving t
-  "*Non-nil means update the modification date when the buffer is saved.
+  "Non-nil means update the modification date when the buffer is saved.
 Calls function `\\[vhdl-template-modify]').
 
 NOTE: Activate the new setting in a VHDL buffer by using the menu entry
@@ -999,27 +1043,28 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   "Customizations for sequential processes."
   :group 'vhdl-template)
 
-(defcustom vhdl-reset-kind 'async
-  "*Specifies which kind of reset to use in sequential processes."
+(defcustom  vhdl-reset-kind 'async
+  "Specifies which kind of reset to use in sequential processes."
   :type '(choice (const :tag "None" none)
                 (const :tag "Synchronous" sync)
-                (const :tag "Asynchronous" async))
+                (const :tag "Asynchronous" async)
+                (const :tag "Query" query))
   :group 'vhdl-sequential-process)
 
 (defcustom vhdl-reset-active-high nil
-  "*Non-nil means reset in sequential processes is active high.
+  "Non-nil means reset in sequential processes is active high.
 Otherwise, reset is active low."
   :type 'boolean
   :group 'vhdl-sequential-process)
 
 (defcustom vhdl-clock-rising-edge t
-  "*Non-nil means rising edge of clock triggers sequential processes.
+  "Non-nil means rising edge of clock triggers sequential processes.
 Otherwise, falling edge triggers."
   :type 'boolean
   :group 'vhdl-sequential-process)
 
 (defcustom vhdl-clock-edge-condition 'standard
-  "*Syntax of the clock edge condition.
+  "Syntax of the clock edge condition.
   Standard: \"clk'event and clk = '1'\"
   Function: \"rising_edge(clk)\""
   :type '(choice (const :tag "Standard" standard)
@@ -1027,12 +1072,12 @@ Otherwise, falling edge triggers."
   :group 'vhdl-sequential-process)
 
 (defcustom vhdl-clock-name ""
-  "*Name of clock signal to use in templates."
+  "Name of clock signal to use in templates."
   :type 'string
   :group 'vhdl-sequential-process)
 
 (defcustom vhdl-reset-name ""
-  "*Name of reset signal to use in templates."
+  "Name of reset signal to use in templates."
   :type 'string
   :group 'vhdl-sequential-process)
 
@@ -1054,7 +1099,7 @@ begin  -- process <label>
   end if;
 end process <label>;"
      "e" ""))
-  "*List of user models.
+  "List of user models.
 VHDL models (templates) can be specified by the user in this list.  They can be
 invoked from the menu, through key bindings (`C-c C-m ...'), or by keyword
 electrification (i.e. overriding existing or creating new keywords, see
@@ -1103,7 +1148,7 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
 
 (defcustom vhdl-compose-architecture-name '(".*" . "str")
   (concat
-   "*Specifies how the component architecture name is obtained.
+   "Specifies how the component architecture name is obtained.
 The component architecture name can be obtained by modifying the entity name
 \(e.g. attaching or stripping off a substring).
 If TO STRING is empty, the architecture name is queried."
@@ -1115,7 +1160,7 @@ If TO STRING is empty, the architecture name is queried."
 (defcustom vhdl-compose-configuration-name
   '("\\(.*\\) \\(.*\\)" . "\\1_\\2_cfg")
   (concat
-   "*Specifies how the configuration name is obtained.
+   "Specifies how the configuration name is obtained.
 The configuration name can be obtained by modifying the entity and/or
 architecture name (e.g. attaching or stripping off a substring).  The string
 that is matched against the regexp is the concatenation of the entity and the
@@ -1129,7 +1174,7 @@ default setting as example)."
 (defcustom vhdl-components-package-name
   '((".*" . "\\&_components") . "components")
   (concat
-   "*Specifies how the name for the components package is obtained.
+   "Specifies how the name for the components package is obtained.
 The components package is a package containing all component declarations for
 the current design.  Its name can be obtained by modifying the project name
 \(e.g. attaching or stripping off a substring).  If no project is defined, the
@@ -1142,19 +1187,19 @@ DIRECTORY entry is chosen."
   :group 'vhdl-compose)
 
 (defcustom vhdl-use-components-package nil
-  "*Non-nil means use a separate components package for component declarations.
+  "Non-nil means use a separate components package for component declarations.
 Otherwise, component declarations are inserted and searched for in the
 architecture declarative parts."
   :type 'boolean
   :group 'vhdl-compose)
 
 (defcustom vhdl-compose-include-header t
-  "*Non-nil means include a header in automatically generated files."
+  "Non-nil means include a header in automatically generated files."
   :type 'boolean
   :group 'vhdl-compose)
 
 (defcustom vhdl-compose-create-files 'single
-  "*Specifies whether new files should be created for the new component.
+  "Specifies whether new files should be created for the new component.
 The component's entity and architecture are inserted:
   None          : in current buffer
   Single file   : in new single file
@@ -1167,14 +1212,14 @@ The file names are obtained from variables `vhdl-entity-file-name' and
   :group 'vhdl-compose)
 
 (defcustom vhdl-compose-configuration-create-file nil
-  "*Specifies whether a new file should be created for the configuration.
+  "Specifies whether a new file should be created for the configuration.
 If non-nil, a new file is created for the configuration.
 The file name is obtained from variable `vhdl-configuration-file-name'."
   :type 'boolean
   :group 'vhdl-compose)
 
 (defcustom vhdl-compose-configuration-hierarchical t
-  "*Specifies whether hierarchical configurations should be created.
+  "Specifies whether hierarchical configurations should be created.
 If non-nil, automatically created configurations are hierarchical and include
 the whole hierarchy of subcomponents.  Otherwise the configuration only
 includes one level of subcomponents."
@@ -1182,7 +1227,7 @@ includes one level of subcomponents."
   :group 'vhdl-compose)
 
 (defcustom vhdl-compose-configuration-use-subconfiguration t
-  "*Specifies whether subconfigurations should be used inside configurations.
+  "Specifies whether subconfigurations should be used inside configurations.
 If non-nil, automatically created configurations use configurations in binding
 indications for subcomponents, if such configurations exist.  Otherwise,
 entities are used in binding indications for subcomponents."
@@ -1196,22 +1241,22 @@ entities are used in binding indications for subcomponents."
   :group 'vhdl-compose)
 
 (defcustom vhdl-include-port-comments nil
-  "*Non-nil means include port comments when a port is pasted."
+  "Non-nil means include port comments when a port is pasted."
   :type 'boolean
   :group 'vhdl-port)
 
 (defcustom vhdl-include-direction-comments nil
-  "*Non-nil means include port direction in instantiations as comments."
+  "Non-nil means include port direction in instantiations as comments."
   :type 'boolean
   :group 'vhdl-port)
 
 (defcustom vhdl-include-type-comments nil
-  "*Non-nil means include generic/port type in instantiations as comments."
+  "Non-nil means include generic/port type in instantiations as comments."
   :type 'boolean
   :group 'vhdl-port)
 
 (defcustom vhdl-include-group-comments 'never
-  "*Specifies whether to include group comments and spacings.
+  "Specifies whether to include group comments and spacings.
 The comments and empty lines between groups of ports are pasted:
   Never       : never
   Declarations: in entity/component/constant/signal declarations only
@@ -1223,7 +1268,7 @@ The comments and empty lines between groups of ports are pasted:
 
 (defcustom vhdl-actual-port-name '(".*" . "\\&")
   (concat
-   "*Specifies how actual port names are obtained from formal port names.
+   "Specifies how actual port names are obtained from formal port names.
 In a component instantiation, an actual port name can be obtained by
 modifying the formal port name (e.g. attaching or stripping off a substring)."
    vhdl-name-doc-string)
@@ -1233,7 +1278,7 @@ modifying the formal port name (e.g. attaching or stripping off a substring)."
 
 (defcustom vhdl-instance-name '(".*" . "\\&_%d")
   (concat
-   "*Specifies how an instance name is obtained.
+   "Specifies how an instance name is obtained.
 The instance name can be obtained by modifying the name of the component to be
 instantiated (e.g. attaching or stripping off a substring).  \"%d\" is replaced
 by a unique number (starting with 1).
@@ -1250,7 +1295,7 @@ If TO STRING is empty, the instance name is queried."
 
 (defcustom vhdl-testbench-entity-name '(".*" . "\\&_tb")
   (concat
-   "*Specifies how the testbench entity name is obtained.
+   "Specifies how the testbench entity name is obtained.
 The entity name of a testbench can be obtained by modifying the name of
 the component to be tested (e.g. attaching or stripping off a substring)."
    vhdl-name-doc-string)
@@ -1260,7 +1305,7 @@ the component to be tested (e.g. attaching or stripping off a substring)."
 
 (defcustom vhdl-testbench-architecture-name '(".*" . "")
   (concat
-   "*Specifies how the testbench architecture name is obtained.
+   "Specifies how the testbench architecture name is obtained.
 The testbench architecture name can be obtained by modifying the name of
 the component to be tested (e.g. attaching or stripping off a substring).
 If TO STRING is empty, the architecture name is queried."
@@ -1271,7 +1316,7 @@ If TO STRING is empty, the architecture name is queried."
 
 (defcustom vhdl-testbench-configuration-name vhdl-compose-configuration-name
   (concat
-   "*Specifies how the testbench configuration name is obtained.
+   "Specifies how the testbench configuration name is obtained.
 The configuration name of a testbench can be obtained by modifying the entity
 and/or architecture name (e.g. attaching or stripping off a substring).  The
 string that is matched against the regexp is the concatenation of the entity
@@ -1284,7 +1329,7 @@ names (see default setting as example)."
 
 (defcustom vhdl-testbench-dut-name '(".*" . "DUT")
   (concat
-   "*Specifies how a DUT instance name is obtained.
+   "Specifies how a DUT instance name is obtained.
 The design-under-test instance name (i.e. the component instantiated in the
 testbench) can be obtained by modifying the component name (e.g. attaching
 or stripping off a substring)."
@@ -1294,7 +1339,7 @@ or stripping off a substring)."
   :group 'vhdl-testbench)
 
 (defcustom vhdl-testbench-include-header t
-  "*Non-nil means include a header in automatically generated files."
+  "Non-nil means include a header in automatically generated files."
   :type 'boolean
   :group 'vhdl-testbench)
 
@@ -1302,7 +1347,7 @@ or stripping off a substring)."
   -- clock
   signal Clk : std_logic := '1';
 "
-  "*String or file to be inserted in the testbench declarative part.
+  "String or file to be inserted in the testbench declarative part.
 If the string specifies an existing file name, the contents of the file is
 inserted, otherwise the string itself is inserted in the testbench
 architecture before the BEGIN keyword.
@@ -1322,7 +1367,7 @@ Type `C-j' for newlines."
     wait until Clk = '1';
   end process WaveGen_Proc;
 "
-  "*String or file to be inserted in the testbench statement part.
+  "String or file to be inserted in the testbench statement part.
 If the string specifies an existing file name, the contents of the file is
 inserted, otherwise the string itself is inserted in the testbench
 architecture before the END keyword.
@@ -1331,22 +1376,22 @@ Type `C-j' for newlines."
   :group 'vhdl-testbench)
 
 (defcustom vhdl-testbench-initialize-signals nil
-  "*Non-nil means initialize signals with `0' when declared in testbench."
+  "Non-nil means initialize signals with `0' when declared in testbench."
   :type 'boolean
   :group 'vhdl-testbench)
 
 (defcustom vhdl-testbench-include-library t
-  "*Non-nil means a library/use clause for std_logic_1164 is included."
+  "Non-nil means a library/use clause for std_logic_1164 is included."
   :type 'boolean
   :group 'vhdl-testbench)
 
 (defcustom vhdl-testbench-include-configuration t
-  "*Non-nil means a testbench configuration is attached at the end."
+  "Non-nil means a testbench configuration is attached at the end."
   :type 'boolean
   :group 'vhdl-testbench)
 
 (defcustom vhdl-testbench-create-files 'single
-  "*Specifies whether new files should be created for the testbench.
+  "Specifies whether new files should be created for the testbench.
 testbench entity and architecture are inserted:
   None          : in current buffer
   Single file   : in new single file
@@ -1360,7 +1405,7 @@ and `vhdl-testbench-architecture-file-name'."
 
 (defcustom vhdl-testbench-entity-file-name vhdl-entity-file-name
   (concat
-   "*Specifies how the testbench entity file name is obtained.
+   "Specifies how the testbench entity file name is obtained.
 The entity file name can be obtained by modifying the testbench entity name
 \(e.g. attaching or stripping off a substring).  The file extension is
 automatically taken from the file name of the current buffer.  Testbench
@@ -1373,7 +1418,7 @@ absolute path to the file name."
 
 (defcustom vhdl-testbench-architecture-file-name vhdl-architecture-file-name
   (concat
-   "*Specifies how the testbench architecture file name is obtained.
+   "Specifies how the testbench architecture file name is obtained.
 The architecture file name can be obtained by modifying the testbench entity
 and/or architecture name (e.g. attaching or stripping off a substring).  The
 string that is matched against the regexp is the concatenation of the entity
@@ -1392,17 +1437,17 @@ name."
   :group 'vhdl)
 
 (defcustom vhdl-self-insert-comments t
-  "*Non-nil means various templates automatically insert help comments."
+  "Non-nil means various templates automatically insert help comments."
   :type 'boolean
   :group 'vhdl-comment)
 
 (defcustom vhdl-prompt-for-comments t
-  "*Non-nil means various templates prompt for user definable comments."
+  "Non-nil means various templates prompt for user definable comments."
   :type 'boolean
   :group 'vhdl-comment)
 
 (defcustom vhdl-inline-comment-column 40
-  "*Column to indent and align inline comments to.
+  "Column to indent and align inline comments to.
 Overrides local option `comment-column'.
 
 NOTE: Activate the new setting in a VHDL buffer by using the menu entry
@@ -1411,7 +1456,7 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   :group 'vhdl-comment)
 
 (defcustom vhdl-end-comment-column 79
-  "*End of comment column.
+  "End of comment column.
 Comments that exceed this column number are wrapped.
 
 NOTE: Activate the new setting in a VHDL buffer by using the menu entry
@@ -1427,19 +1472,19 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   :group 'vhdl)
 
 (defcustom vhdl-auto-align t
-  "*Non-nil means align some templates automatically after generation."
+  "Non-nil means align some templates automatically after generation."
   :type 'boolean
   :group 'vhdl-align)
 
 (defcustom vhdl-align-groups t
-  "*Non-nil means align groups of code lines separately.
+  "Non-nil means align groups of code lines separately.
 A group of code lines is a region of consecutive lines between two lines that
 match the regexp in option `vhdl-align-group-separate'."
   :type 'boolean
   :group 'vhdl-align)
 
 (defcustom vhdl-align-group-separate "^\\s-*$"
-  "*Regexp for matching a line that separates groups of lines for alignment.
+  "Regexp for matching a line that separates groups of lines for alignment.
 Examples:
   \"^\\s-*$\":          matches an empty line
   \"^\\s-*\\(--.*\\)?$\": matches an empty line or a comment-only line"
@@ -1447,7 +1492,7 @@ Examples:
   :group 'vhdl-align)
 
 (defcustom vhdl-align-same-indent t
-  "*Non-nil means align blocks with same indent separately.
+  "Non-nil means align blocks with same indent separately.
 When a region or the entire buffer is aligned, the code is divided into
 blocks of same indent which are aligned separately (except for argument/port
 lists).  This gives nicer alignment in most cases.
@@ -1461,7 +1506,7 @@ Option `vhdl-align-groups' still applies within these blocks."
   :group 'vhdl)
 
 (defcustom vhdl-highlight-keywords t
-  "*Non-nil means highlight VHDL keywords and other standardized words.
+  "Non-nil means highlight VHDL keywords and other standardized words.
 The following faces are used:
   `font-lock-keyword-face'       : keywords
   `font-lock-type-face'          : standardized types
@@ -1477,7 +1522,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-highlight-names t
-  "*Non-nil means highlight declaration names and construct labels.
+  "Non-nil means highlight declaration names and construct labels.
 The following faces are used:
   `font-lock-function-name-face' : names in declarations of units,
      subprograms, components, as well as labels of VHDL constructs
@@ -1494,7 +1539,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-highlight-special-words nil
-  "*Non-nil means highlight words with special syntax.
+  "Non-nil means highlight words with special syntax.
 The words with syntax and color specified in option `vhdl-special-syntax-alist'
 are highlighted accordingly.
 Can be used for visual support of naming conventions.
@@ -1507,7 +1552,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-highlight-forbidden-words nil
-  "*Non-nil means highlight forbidden words.
+  "Non-nil means highlight forbidden words.
 The reserved words specified in option `vhdl-forbidden-words' or having the
 syntax specified in option `vhdl-forbidden-syntax' are highlighted in a
 warning color (face `vhdl-font-lock-reserved-words-face') to indicate not to
@@ -1522,7 +1567,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-highlight-verilog-keywords nil
-  "*Non-nil means highlight Verilog keywords as reserved words.
+  "Non-nil means highlight Verilog keywords as reserved words.
 Verilog keywords are highlighted in a warning color (face
 `vhdl-font-lock-reserved-words-face') to indicate not to use them.
 
@@ -1535,7 +1580,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-highlight-translate-off nil
-  "*Non-nil means background-highlight code excluded from translation.
+  "Non-nil means background-highlight code excluded from translation.
 That is, all code between \"-- pragma translate_off\" and
 \"-- pragma translate_on\" is highlighted using a different background color
 \(face `vhdl-font-lock-translate-off-face').
@@ -1549,7 +1594,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-highlight-case-sensitive nil
-  "*Non-nil means consider case for highlighting.
+  "Non-nil means consider case for highlighting.
 Possible trade-off:
   non-nil  also upper-case VHDL words are highlighted, but case of words with
            special syntax is not considered
@@ -1563,22 +1608,25 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-special-syntax-alist
-  '(("generic/constant" "\\w+_[cg]" "Gold3" "BurlyWood1")
-    ("type" "\\w+_t" "ForestGreen" "PaleGreen")
-    ("variable" "\\w+_v" "Grey50" "Grey80"))
-  "*List of special syntax to be highlighted.
+  '(("generic/constant" "\\<\\w+_[cg]\\>" "Gold3" "BurlyWood1" nil)
+    ("type" "\\<\\w+_t\\>" "ForestGreen" "PaleGreen" nil)
+    ("variable" "\\<\\w+_v\\>" "Grey50" "Grey80" nil))
+  "List of special syntax to be highlighted.
 If option `vhdl-highlight-special-words' is non-nil, words with the specified
 syntax (as regular expression) are highlighted in the corresponding color.
 
   Name         : string of words and spaces
   Regexp       : regular expression describing word syntax
-                  (e.g. \"\\\w+_c\" matches word with suffix \"_c\")
+                 (e.g. \"\\\\=\<\\\w+_c\\\\=\>\" matches word with suffix \"_c\")
+                 expression must start with \"\\\\=\<\" and end with \"\\\\=\>\"
+                 if only whole words should be matched (no substrings)
   Color (light): foreground color for light background
                  (matching color examples: Gold3, Grey50, LimeGreen, Tomato,
                  LightSeaGreen, DodgerBlue, Gold, PaleVioletRed)
   Color (dark) : foreground color for dark background
                  (matching color examples: BurlyWood1, Grey80, Green, Coral,
                  AquaMarine2, LightSkyBlue1, Yellow, PaleVioletRed1)
+  In comments  : If non-nil, words are also highlighted inside comments
 
 Can be used for visual support of naming conventions, such as highlighting
 different kinds of signals (e.g. \"Clk50\", \"Rst_n\") or objects (e.g.
@@ -1593,13 +1641,14 @@ NOTE: Activate a changed regexp in a VHDL buffer by re-fontifying it (menu
                       (string :tag "Name         ")
                       (regexp :tag "Regexp       " "\\w+_")
                       (string :tag "Color (light)")
-                      (string :tag "Color (dark) ")))
+                      (string :tag "Color (dark) ")
+                      (boolean :tag "In comments  ")))
   :set (lambda (variable value)
         (vhdl-custom-set variable value 'vhdl-font-lock-init))
   :group 'vhdl-highlight)
 
 (defcustom vhdl-forbidden-words '()
-  "*List of forbidden words to be highlighted.
+  "List of forbidden words to be highlighted.
 If option `vhdl-highlight-forbidden-words' is non-nil, these reserved
 words are highlighted in a warning color to indicate not to use them.
 
@@ -1612,7 +1661,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-forbidden-syntax ""
-  "*Syntax of forbidden words to be highlighted.
+  "Syntax of forbidden words to be highlighted.
 If option `vhdl-highlight-forbidden-words' is non-nil, words with this
 syntax are highlighted in a warning color to indicate not to use them.
 Can be used to highlight too long identifiers (e.g. \"\\w\\w\\w\\w\\w\\w\\w\\w\\w\\w+\"
@@ -1627,7 +1676,7 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl-highlight)
 
 (defcustom vhdl-directive-keywords '("pragma" "synopsys")
-  "*List of compiler directive keywords recognized for highlighting.
+  "List of compiler directive keywords recognized for highlighting.
 
 NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
       entry \"Fontify Buffer\")."
@@ -1643,13 +1692,13 @@ NOTE: Activate the new setting in a VHDL buffer by re-fontifying it (menu
   :group 'vhdl)
 
 (defcustom vhdl-speedbar-auto-open nil
-  "*Non-nil means automatically open speedbar at startup.
+  "Non-nil means automatically open speedbar at startup.
 Alternatively, the speedbar can be opened from the VHDL menu."
   :type 'boolean
   :group 'vhdl-speedbar)
 
 (defcustom vhdl-speedbar-display-mode 'files
-  "*Specifies the default displaying mode when opening speedbar.
+  "Specifies the default displaying mode when opening speedbar.
 Alternatively, the displaying mode can be selected from the speedbar menu or
 by typing `f' (files), `h' (directory hierarchy) or `H' (project hierarchy)."
   :type '(choice (const :tag "Files" files)
@@ -1658,7 +1707,7 @@ by typing `f' (files), `h' (directory hierarchy) or `H' (project hierarchy)."
   :group 'vhdl-speedbar)
 
 (defcustom vhdl-speedbar-scan-limit '(10000000 (1000000 50))
-  "*Limits scanning of large files and netlists.
+  "Limits scanning of large files and netlists.
 Design units: maximum file size to scan for design units
 Hierarchy (instances of subcomponents):
   File size: maximum file size to scan for instances (in bytes)
@@ -1685,18 +1734,18 @@ prevent the scanning of large netlists."
   :group 'vhdl-speedbar)
 
 (defcustom vhdl-speedbar-jump-to-unit t
-  "*Non-nil means jump to the design unit code when opened in a buffer.
+  "Non-nil means jump to the design unit code when opened in a buffer.
 The buffer cursor position is left unchanged otherwise."
   :type 'boolean
   :group 'vhdl-speedbar)
 
 (defcustom vhdl-speedbar-update-on-saving t
-  "*Automatically update design hierarchy when buffer is saved."
+  "Automatically update design hierarchy when buffer is saved."
   :type 'boolean
   :group 'vhdl-speedbar)
 
 (defcustom vhdl-speedbar-save-cache '(hierarchy display)
-  "*Automatically save modified hierarchy caches when exiting Emacs.
+  "Automatically save modified hierarchy caches when exiting Emacs.
   Hierarchy: design hierarchy information
   Display:   displaying information (which design units to expand)"
   :type '(set (const :tag "Hierarchy" hierarchy)
@@ -1704,7 +1753,7 @@ The buffer cursor position is left unchanged otherwise."
   :group 'vhdl-speedbar)
 
 (defcustom vhdl-speedbar-cache-file-name ".emacs-vhdl-cache-\\1-\\2"
-  "*Name of file for saving hierarchy cache.
+  "Name of file for saving hierarchy cache.
 \"\\1\" is replaced by the project name if a project is specified,
 \"directory\" otherwise.  \"\\2\" is replaced by the user name (allows for
 different users to have cache files in the same directory). Can also have
@@ -1718,20 +1767,20 @@ an absolute path (i.e. all caches can be stored in one global directory)."
   :group 'vhdl)
 
 (defcustom vhdl-index-menu nil
-  "*Non-nil means add an index menu for a source file when loading.
+  "Non-nil means add an index menu for a source file when loading.
 Alternatively, the speedbar can be used.  Note that the index menu scans a file
 when it is opened, while speedbar only scans the file upon request."
   :type 'boolean
   :group 'vhdl-menu)
 
 (defcustom vhdl-source-file-menu nil
-  "*Non-nil means add a menu of all source files in current directory.
+  "Non-nil means add a menu of all source files in current directory.
 Alternatively, the speedbar can be used."
   :type 'boolean
   :group 'vhdl-menu)
 
 (defcustom vhdl-hideshow-menu nil
-  "*Non-nil means add hideshow menu and functionality at startup.
+  "Non-nil means add hideshow menu and functionality at startup.
 Hideshow can also be enabled from the VHDL Mode menu.
 Hideshow allows hiding code of various VHDL constructs.
 
@@ -1741,7 +1790,7 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   :group 'vhdl-menu)
 
 (defcustom vhdl-hide-all-init nil
-  "*Non-nil means hide all design units initially after a file is loaded."
+  "Non-nil means hide all design units initially after a file is loaded."
   :type 'boolean
   :group 'vhdl-menu)
 
@@ -1751,7 +1800,7 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   :group 'vhdl)
 
 (defcustom vhdl-print-two-column t
-  "*Non-nil means print code in two columns and landscape format.
+  "Non-nil means print code in two columns and landscape format.
 Adjusts settings in a way that PostScript printing (\"File\" menu, `ps-print')
 prints VHDL files in a nice two-column landscape style.
 
@@ -1761,7 +1810,7 @@ NOTE: Activate the new setting by restarting Emacs.
   :group 'vhdl-print)
 
 (defcustom vhdl-print-customize-faces t
-  "*Non-nil means use an optimized set of faces for PostScript printing.
+  "Non-nil means use an optimized set of faces for PostScript printing.
 
 NOTE: Activate the new setting by restarting Emacs.
       Overrides `ps-print' settings locally."
@@ -1774,7 +1823,7 @@ NOTE: Activate the new setting by restarting Emacs.
   :group 'vhdl)
 
 (defcustom vhdl-intelligent-tab t
-  "*Non-nil means `TAB' does indentation, word completion and tab insertion.
+  "Non-nil means `TAB' does indentation, word completion and tab insertion.
 That is, if preceding character is part of a word then complete word,
 else if not at beginning of line then insert tab,
 else if last command was a `TAB' or `RET' then dedent one step,
@@ -1788,28 +1837,36 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   :group 'vhdl-misc)
 
 (defcustom vhdl-indent-syntax-based t
-  "*Non-nil means indent lines of code based on their syntactic context.
+  "Non-nil means indent lines of code based on their syntactic context.
 Otherwise, a line is indented like the previous nonblank line.  This can be
 useful in large files where syntax-based indentation gets very slow."
   :type 'boolean
   :group 'vhdl-misc)
 
+(defcustom vhdl-indent-comment-like-next-code-line t
+  "*Non-nil means comment lines are indented like the following code line.
+Otherwise, comment lines are indented like the preceding code line.
+Indenting comment lines like the following code line gives nicer indentation
+when comments precede the code that they refer to."
+  :type 'boolean
+  :group 'vhdl-misc)
+
 (defcustom vhdl-word-completion-case-sensitive nil
-  "*Non-nil means word completion using `TAB' is case sensitive.
+  "Non-nil means word completion using `TAB' is case sensitive.
 That is, `TAB' completes words that start with the same letters and case.
 Otherwise, case is ignored."
   :type 'boolean
   :group 'vhdl-misc)
 
 (defcustom vhdl-word-completion-in-minibuffer t
-  "*Non-nil enables word completion in minibuffer (for template prompts).
+  "Non-nil enables word completion in minibuffer (for template prompts).
 
 NOTE: Activate the new setting by restarting Emacs."
   :type 'boolean
   :group 'vhdl-misc)
 
 (defcustom vhdl-underscore-is-part-of-word nil
-  "*Non-nil means consider the underscore character `_' as part of word.
+  "Non-nil means consider the underscore character `_' as part of word.
 An identifier containing underscores is then treated as a single word in
 select and move operations.  All parts of an identifier separated by underscore
 are treated as single words otherwise.
@@ -1833,6 +1890,7 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
   (custom-add-to-group 'vhdl-related 'paren-showing 'custom-group))
 (custom-add-to-group 'vhdl-related 'ps-print 'custom-group)
 (custom-add-to-group 'vhdl-related 'speedbar 'custom-group)
+(custom-add-to-group 'vhdl-related 'comment-style 'custom-variable)
 (custom-add-to-group 'vhdl-related 'line-number-mode 'custom-variable)
 (unless (featurep 'xemacs)
   (custom-add-to-group 'vhdl-related 'transient-mark-mode 'custom-variable))
@@ -1840,28 +1898,37 @@ NOTE: Activate the new setting in a VHDL buffer by using the menu entry
 (custom-add-to-group 'vhdl-related 'mail-host-address 'custom-variable)
 (custom-add-to-group 'vhdl-related 'user-mail-address 'custom-variable)
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Hidden user variables
+
+(defvar vhdl-compile-absolute-path nil
+  "If non-nil, use absolute instead of relative path for compiled files.")
+
+(defvar vhdl-comment-display-line-char ?-
+  "Character to use in comment display line.")
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Internal variables
 
 (defvar vhdl-menu-max-size 20
-  "*Specifies the maximum size of a menu before splitting it into submenus.")
+  "Specifies the maximum size of a menu before splitting it into submenus.")
 
 (defvar vhdl-progress-interval 1
-  "*Interval used to update progress status during long operations.
+  "Interval used to update progress status during long operations.
 If a number, percentage complete gets updated after each interval of
 that many seconds.  To inhibit all messages, set this option to nil.")
 
 (defvar vhdl-inhibit-startup-warnings-p nil
-  "*If non-nil, inhibits start up compatibility warnings.")
+  "If non-nil, inhibits start up compatibility warnings.")
 
 (defvar vhdl-strict-syntax-p nil
-  "*If non-nil, all syntactic symbols must be found in `vhdl-offsets-alist'.
+  "If non-nil, all syntactic symbols must be found in `vhdl-offsets-alist'.
 If the syntactic symbol for a particular line does not match a symbol
 in the offsets alist, an error is generated, otherwise no error is
 reported and the syntactic symbol is ignored.")
 
 (defvar vhdl-echo-syntactic-information-p nil
-  "*If non-nil, syntactic info is echoed when the line is indented.")
+  "If non-nil, syntactic info is echoed when the line is indented.")
 
 (defconst vhdl-offsets-alist-default
   '((string               . -1000)
@@ -1889,7 +1956,7 @@ Do not change this constant!  See the variable `vhdl-offsets-alist' for
 more information.")
 
 (defvar vhdl-offsets-alist (copy-alist vhdl-offsets-alist-default)
-  "*Association list of syntactic element symbols and indentation offsets.
+  "Association list of syntactic element symbols and indentation offsets.
 As described below, each cons cell in this list has the form:
 
     (SYNTACTIC-SYMBOL . OFFSET)
@@ -1950,7 +2017,7 @@ Here is the current list of valid syntactic element symbols:
  package-body           -- inside a package body")
 
 (defvar vhdl-comment-only-line-offset 0
-  "*Extra offset for line which contains only the start of a comment.
+  "Extra offset for line which contains only the start of a comment.
 Can contain an integer or a cons cell of the form:
 
  (NON-ANCHORED-OFFSET . ANCHORED-OFFSET)
@@ -1961,7 +2028,7 @@ the amount of offset to give column-zero anchored comment-only lines.
 Just an integer as value is equivalent to (<val> . 0)")
 
 (defvar vhdl-special-indent-hook nil
-  "*Hook for user defined special indentation adjustments.
+  "Hook for user defined special indentation adjustments.
 This hook gets called after a line is indented by the mode.")
 
 (defvar vhdl-style-alist
@@ -2003,7 +2070,7 @@ your style, only those that are different from the default.")
       (setq vhdl-style-alist (cons default vhdl-style-alist))))
 
 (defvar vhdl-mode-hook nil
-  "*Hook called by `vhdl-mode'.")
+  "Hook called by `vhdl-mode'.")
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -3270,9 +3337,6 @@ STRING are replaced by `-' and substrings are converted to lower case."
       (list
        (append
        '("Package")
-       (when (vhdl-standard-p 'math)
-         '(["math_complex"     vhdl-template-package-math-complex t]
-           ["math_real"        vhdl-template-package-math-real t]))
        '(["numeric_bit"        vhdl-template-package-numeric-bit t]
          ["numeric_std"        vhdl-template-package-numeric-std t]
          ["std_logic_1164"     vhdl-template-package-std-logic-1164 t]
@@ -3283,8 +3347,22 @@ STRING are replaced by `-' and substrings are converted to lower case."
          ["std_logic_unsigned" vhdl-template-package-std-logic-unsigned t]
          ["std_logic_misc"     vhdl-template-package-std-logic-misc t]
          ["std_logic_textio"   vhdl-template-package-std-logic-textio t]
-         "--"
-         ["Insert Package..."  vhdl-template-insert-package
+         "--")
+       (when (vhdl-standard-p 'ams)
+         '(["fundamental_constants" vhdl-template-package-fundamental-constants t]
+           ["material_constants" vhdl-template-package-material-constants t]
+           ["energy_systems"   vhdl-template-package-energy-systems t]
+           ["electrical_systems" vhdl-template-package-electrical-systems t]
+           ["mechanical_systems" vhdl-template-package-mechanical-systems t]
+           ["radiant_systems"  vhdl-template-package-radiant-systems t]
+           ["thermal_systems"  vhdl-template-package-thermal-systems t]
+           ["fluidic_systems"  vhdl-template-package-fluidic-systems t]
+           "--"))
+       (when (vhdl-standard-p 'math)
+         '(["math_complex"     vhdl-template-package-math-complex t]
+           ["math_real"        vhdl-template-package-math-real t]
+           "--"))
+       '(["Insert Package..."  vhdl-template-insert-package
                                :keys "C-c C-i C-p"])))
       '(("Directive"
         ["translate_on"        vhdl-template-directive-translate-on t]
@@ -3417,6 +3495,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
      ["Buffer"                 vhdl-beautify-buffer t])
     ("Fix"
      ["Generic/Port Clause"    vhdl-fix-clause t]
+     ["Generic/Port Clause Buffer" vhdl-fix-clause t]
      "--"
      ["Case Region"            vhdl-fix-case-region (mark)]
      ["Case Buffer"            vhdl-fix-case-buffer t]
@@ -3449,11 +3528,13 @@ STRING are replaced by `-' and substrings are converted to lower case."
      ("Mode"
       ["Electric Mode"
        (progn (customize-set-variable 'vhdl-electric-mode
-                                     (not vhdl-electric-mode)))
+                                     (not vhdl-electric-mode))
+             (vhdl-mode-line-update))
        :style toggle :selected vhdl-electric-mode :keys "C-c C-m C-e"]
       ["Stutter Mode"
        (progn (customize-set-variable 'vhdl-stutter-mode
-                                     (not vhdl-stutter-mode)))
+                                     (not vhdl-stutter-mode))
+             (vhdl-mode-line-update))
        :style toggle :selected vhdl-stutter-mode :keys "C-c C-m C-s"]
       ["Indent Tabs Mode"
        (progn (customize-set-variable 'vhdl-indent-tabs-mode
@@ -3515,6 +3596,8 @@ STRING are replaced by `-' and substrings are converted to lower case."
        (customize-set-variable 'vhdl-compile-use-local-error-regexp
                               (not vhdl-compile-use-local-error-regexp))
        :style toggle :selected vhdl-compile-use-local-error-regexp]
+      ["Makefile Default Targets..."
+       (customize-option 'vhdl-makefile-default-targets) t]
       ["Makefile Generation Hook..."
        (customize-option 'vhdl-makefile-generation-hook) t]
       ["Default Library Name" (customize-option 'vhdl-default-library) t]
@@ -3527,7 +3610,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
                                       (list '87 (cadr vhdl-standard)))
               (vhdl-activate-customizations))
        :style radio :selected (eq '87 (car vhdl-standard))]
-       ["VHDL'93"
+       ["VHDL'93/02"
        (progn (customize-set-variable 'vhdl-standard
                                       (list '93 (cadr vhdl-standard)))
               (vhdl-activate-customizations))
@@ -3580,6 +3663,10 @@ STRING are replaced by `-' and substrings are converted to lower case."
        ["Always"
        (customize-set-variable 'vhdl-use-direct-instantiation 'always)
        :style radio :selected (eq 'always vhdl-use-direct-instantiation)])
+      ["Include Array Index and Record Field in Sensitivity List"
+       (customize-set-variable 'vhdl-array-index-record-field-in-sensitivity-list
+                              (not vhdl-array-index-record-field-in-sensitivity-list))
+       :style toggle :selected vhdl-array-index-record-field-in-sensitivity-list]
       "--"
       ["Customize Group..." (customize-group 'vhdl-style) t])
      ("Naming"
@@ -3676,7 +3763,10 @@ STRING are replaced by `-' and substrings are converted to lower case."
         :style radio :selected (eq 'sync vhdl-reset-kind)]
        ["Asynchronous"
         (customize-set-variable 'vhdl-reset-kind 'async)
-        :style radio :selected (eq 'async vhdl-reset-kind)])
+        :style radio :selected (eq 'async vhdl-reset-kind)]
+       ["Query"
+        (customize-set-variable 'vhdl-reset-kind 'query)
+        :style radio :selected (eq 'query vhdl-reset-kind)])
        ["Reset is Active High"
        (customize-set-variable 'vhdl-reset-active-high
                                (not vhdl-reset-active-high))
@@ -3966,6 +4056,10 @@ STRING are replaced by `-' and substrings are converted to lower case."
        (customize-set-variable 'vhdl-indent-syntax-based
                               (not vhdl-indent-syntax-based))
        :style toggle :selected vhdl-indent-syntax-based]
+      ["Indent Comments Like Next Code Line"
+       (customize-set-variable 'vhdl-indent-comment-like-next-code-line
+                              (not vhdl-indent-comment-like-next-code-line))
+       :style toggle :selected vhdl-indent-comment-like-next-code-line]
       ["Word Completion is Case Sensitive"
        (customize-set-variable 'vhdl-word-completion-case-sensitive
                               (not vhdl-word-completion-case-sensitive))
@@ -4009,7 +4103,7 @@ STRING are replaced by `-' and substrings are converted to lower case."
      "^\\s-*\\(\\(\\(impure\\|pure\\)\\s-+\\|\\)function\\|procedure\\)\\s-+\\(\"?\\(\\w\\|\\s_\\)+\"?\\)"
      4)
     ("Instance"
-     "^\\s-*\\(\\(\\w\\|\\s_\\)+\\s-*:\\(\\s-\\|\n\\)*\\(\\w\\|\\s_\\)+\\)\\(\\s-\\|\n\\)+\\(generic\\|port\\)\\s-+map\\>"
+     "^\\s-*\\(\\(\\w\\|\\s_\\)+\\s-*:\\(\\s-\\|\n\\)*\\(entity\\s-+\\(\\w\\|\\s_\\)+\\.\\)?\\(\\w\\|\\s_\\)+\\)\\(\\s-\\|\n\\)+\\(generic\\|port\\)\\s-+map\\>"
      1)
     ("Component"
      "^\\s-*\\(component\\)\\s-+\\(\\(\\w\\|\\s_\\)+\\)"
@@ -4132,7 +4226,7 @@ Usage:
     brackets and removed if the queried string is left empty.  Prompts for
     mandatory arguments remain in the code if the queried string is left
     empty.  They can be queried again by `C-c C-t C-q'.  Enabled
-    electrification is indicated by `/e' in the modeline.
+    electrification is indicated by `/e' in the mode line.
 
       Typing `M-SPC' after a keyword inserts a space without calling the
     template generator.  Automatic template generation (i.e.
@@ -4159,7 +4253,7 @@ Usage:
     Double striking of some keys inserts cumbersome VHDL syntax elements.
     Stuttering can be disabled (enabled) by typing `C-c C-m C-s' or by
     option `vhdl-stutter-mode'.  Enabled stuttering is indicated by `/s' in
-    the modeline.  The stuttering keys and their effects are:
+    the mode line.  The stuttering keys and their effects are:
 
       ;;   -->  \" : \"       [   -->  (        --    -->  comment
       ;;;  -->  \" := \"      [[  -->  [        --CR  -->  comment-out code
@@ -4193,8 +4287,10 @@ Usage:
                    with a comment in between.
         `--CR'     comments out code on that line.  Re-hitting CR comments
                    out following lines.
-        `C-c c'    comments out a region if not commented out,
-                   uncomments a region if already commented out.
+        `C-c C-c'  comments out a region if not commented out,
+                   uncomments a region if already commented out.  Option
+                   `comment-style' defines where the comment characters
+                   should be placed (beginning of line, indent, etc.).
 
       You are prompted for comments after object definitions (i.e. signals,
     variables, constants, ports) and after subprogram and process
@@ -4215,7 +4311,8 @@ Usage:
     `TAB' indents a line if at the beginning of the line.  The amount of
     indentation is specified by option `vhdl-basic-offset'.  `C-c C-i C-l'
     always indents the current line (is bound to `TAB' if option
-    `vhdl-intelligent-tab' is nil).
+    `vhdl-intelligent-tab' is nil).  If a region is active, `TAB' indents
+    the entire region.
 
       Indentation can be done for a group of lines (`C-c C-i C-g'), a region
     \(`M-C-\\') or the entire buffer (menu).  Argument and port lists are
@@ -4229,6 +4326,10 @@ Usage:
       Syntax-based indentation can be very slow in large files.  Option
     `vhdl-indent-syntax-based' allows to use faster but simpler indentation.
 
+      Option `vhdl-indent-comment-like-next-code-line' controls whether
+    comment lines are indented like the preceding or like the following code
+    line.
+
 
   ALIGNMENT:
     The alignment functions align operators, keywords, and inline comments
@@ -4357,12 +4458,12 @@ Usage:
 
 
   STRUCTURAL COMPOSITION:
-    Enables simple structural composition.  `C-c C-c C-n' creates a skeleton
+    Enables simple structural composition.  `C-c C-m C-n' creates a skeleton
     for a new component.  Subcomponents (i.e. component declaration and
     instantiation) can be automatically placed from a previously read port
-    \(`C-c C-c C-p') or directly from the hierarchy browser (`P').  Finally,
+    \(`C-c C-m C-p') or directly from the hierarchy browser (`P').  Finally,
     all subcomponents can be automatically connected using internal signals
-    and ports (`C-c C-c C-w') following these rules:
+    and ports (`C-c C-m C-w') following these rules:
       - subcomponent actual ports with same name are considered to be
         connected by a signal (internal signal or port)
       - signals that are only inputs to subcomponents are considered as
@@ -4383,25 +4484,25 @@ Usage:
 
       Component declarations can be placed in a components package (option
     `vhdl-use-components-package') which can be automatically generated for
-    an entire directory or project (`C-c C-c M-p').  The VHDL'93 direct
+    an entire directory or project (`C-c C-m M-p').  The VHDL'93 direct
     component instantiation is also supported (option
     `vhdl-use-direct-instantiation').
 
-|     Configuration declarations can automatically be generated either from
-|   the menu (`C-c C-c C-f') (for the architecture the cursor is in) or from
-|   the speedbar menu (for the architecture under the cursor).  The
-|   configurations can optionally be hierarchical (i.e. include all
-|   component levels of a hierarchical design, option
-|   `vhdl-compose-configuration-hierarchical') or include subconfigurations
-|   (option `vhdl-compose-configuration-use-subconfiguration').  For
-|   subcomponents in hierarchical configurations, the most-recently-analyzed
-|   (mra) architecture is selected.  If another architecture is desired, it
-|   can be marked as most-recently-analyzed (speedbar menu) before
-|   generating the configuration.
-|
-|     Note: Configurations of subcomponents (i.e. hierarchical configuration
-|   declarations) are currently not considered when displaying
-|   configurations in speedbar.
+      Configuration declarations can automatically be generated either from
+    the menu (`C-c C-m C-f') (for the architecture the cursor is in) or from
+    the speedbar menu (for the architecture under the cursor).  The
+    configurations can optionally be hierarchical (i.e. include all
+    component levels of a hierarchical design, option
+    `vhdl-compose-configuration-hierarchical') or include subconfigurations
+    (option `vhdl-compose-configuration-use-subconfiguration').  For
+    subcomponents in hierarchical configurations, the most-recently-analyzed
+    (mra) architecture is selected.  If another architecture is desired, it
+    can be marked as most-recently-analyzed (speedbar menu) before
+    generating the configuration.
+      Note: Configurations of subcomponents (i.e. hierarchical configuration
+    declarations) are currently not considered when displaying
+    configurations in speedbar.
 
       See the options group `vhdl-compose' for all relevant user options.
 
@@ -4433,11 +4534,13 @@ Usage:
 
       The Makefile's default target \"all\" compiles the entire design, the
     target \"clean\" removes it and the target \"library\" creates the
-    library directory if not existent.  The Makefile also includes a target
-    for each primary library unit which allows selective compilation of this
-    unit, its secondary units and its subhierarchy (example: compilation of
-    a design specified by a configuration).  User specific parts can be
-    inserted into a Makefile with option `vhdl-makefile-generation-hook'.
+    library directory if not existent.  These target names can be customized
+    by option `vhdl-makefile-default-targets'.  The Makefile also includes a
+    target for each primary library unit which allows selective compilation
+    of this unit, its secondary units and its subhierarchy (example:
+    compilation of a design specified by a configuration).  User specific
+    parts can be inserted into a Makefile with option
+    `vhdl-makefile-generation-hook'.
 
     Limitations:
       - Only library units and dependencies within the current library are
@@ -4483,7 +4586,7 @@ Usage:
 
   VHDL STANDARDS:
     The VHDL standards to be used are specified in option `vhdl-standard'.
-    Available standards are: VHDL'87/'93, VHDL-AMS, and Math Packages.
+    Available standards are: VHDL'87/'93(02), VHDL-AMS, and Math Packages.
 
 
   KEYWORD CASE:
@@ -4559,6 +4662,9 @@ Usage:
         - Out parameters of procedures are considered to be read.
       Use option `vhdl-entity-file-name' to specify the entity file name
       \(used to obtain the port names).
+      Use option `vhdl-array-index-record-field-in-sensitivity-list' to
+      specify whether to include array indices and record fields in
+      sensitivity lists.
 
 
   CODE FIXING:
@@ -4632,16 +4738,17 @@ releases.  You are kindly invited to participate in beta testing.  Subscribe
 to above mailing lists by sending an email to <reto@gnu.org>.
 
 VHDL Mode is officially distributed at
-URL `http://opensource.ethz.ch/emacs/vhdl-mode.html'
+http://www.iis.ee.ethz.ch/~zimmi/emacs/vhdl-mode.html
 where the latest version can be found.
 
 
 Known problems:
 ---------------
 
-- Indentation bug in simultaneous if- and case-statements (VHDL-AMS).
 - XEmacs: Incorrect start-up when automatically opening speedbar.
 - XEmacs: Indentation in XEmacs 21.4 (and higher).
+- Indentation incorrect for new 'postponed' VHDL keyword.
+- Indentation incorrect for 'protected body' construct.
 
 
                                                 The VHDL Mode Authors
@@ -4764,7 +4871,7 @@ Key bindings:
 ;;; Keywords and standardized words
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defconst vhdl-93-keywords
+(defconst vhdl-02-keywords
   '(
     "abs" "access" "after" "alias" "all" "and" "architecture" "array"
     "assert" "attribute"
@@ -4779,7 +4886,7 @@ Key bindings:
     "map" "mod"
     "nand" "new" "next" "nor" "not" "null"
     "of" "on" "open" "or" "others" "out"
-    "package" "port" "postponed" "procedure" "process" "pure"
+    "package" "port" "postponed" "procedure" "process" "protected" "pure"
     "range" "record" "register" "reject" "rem" "report" "return"
     "rol" "ror"
     "select" "severity" "shared" "signal" "sla" "sll" "sra" "srl" "subtype"
@@ -4789,7 +4896,7 @@ Key bindings:
     "wait" "when" "while" "with"
     "xnor" "xor"
     )
-  "List of VHDL'93 keywords.")
+  "List of VHDL'02 keywords.")
 
 (defconst vhdl-ams-keywords
   '(
@@ -4822,7 +4929,7 @@ Key bindings:
     )
   "List of Verilog keywords as candidate for additional reserved words.")
 
-(defconst vhdl-93-types
+(defconst vhdl-02-types
   '(
     "boolean" "bit" "bit_vector" "character" "severity_level" "integer"
     "real" "time" "natural" "positive" "string" "line" "text" "side"
@@ -4830,25 +4937,72 @@ Key bindings:
     "std_logic" "std_logic_vector"
     "std_ulogic" "std_ulogic_vector"
     )
-  "List of VHDL'93 standardized types.")
+  "List of VHDL'02 standardized types.")
 
 (defconst vhdl-ams-types
+  ;; standards: IEEE Std 1076.1-2007, IEEE Std 1076.1.1-2004
   '(
+    ;; package `standard'
     "domain_type" "real_vector"
-    ;; from `nature_pkg' package
-    "voltage" "current" "electrical" "position" "velocity" "force"
-    "mechanical_vf" "mechanical_pf" "rotvel" "torque" "rotational"
-    "pressure" "flowrate" "fluid"
-  )
+    ;; package `energy_systems'
+    "energy" "power" "periodicity" "real_across" "real_through" "unspecified"
+    "unspecified_vector" "energy_vector" "power_vector" "periodicity_vector"
+    "real_across_vector" "real_through_vector"
+    ;; package `electrical_systems'
+    "voltage" "current" "charge" "resistance" "conductance" "capacitance"
+    "mmf" "electric_flux" "electric_flux_density" "electric_field_strength"
+    "magnetic_flux" "magnetic_flux_density" "magnetic_field_strength"
+    "inductance" "reluctance" "electrical" "electrical_vector" "magnetic"
+    "magnetic_vector" "voltage_vector" "current_vector" "mmf_vector"
+    "magnetic_flux_vector" "charge_vector" "resistance_vector"
+    "conductance_vector" "capacitance_vector" "electric_flux_vector"
+    "electric_flux_density_vector" "electric_field_strength_vector"
+    "magnetic_flux_density_vector" "magnetic_field_strength_vector"
+    "inductance_vector" "reluctance_vector" "ground"
+    ;; package `mechanical_systems'
+    "displacement" "force" "velocity" "acceleration" "mass" "stiffness"
+    "damping" "momentum" "angle" "torque" "angular_velocity"
+    "angular_acceleration" "moment_inertia" "angular_momentum"
+    "angular_stiffness" "angular_damping" "translational"
+    "translational_vector" "translational_velocity"
+    "translational_velocity_vector" "rotational" "rotational_vector"
+    "rotational_velocity" "rotational_velocity_vector" "displacement_vector"
+    "force_vector" "velocity_vector" "force_velocity_vector" "angle_vector"
+    "torque_vector" "angular_velocity_vector" "torque_velocity_vector"
+    "acceleration_vector" "mass_vector" "stiffness_vector" "damping_vector"
+    "momentum_vector" "angular_acceleration_vector" "moment_inertia_vector"
+    "angular_momentum_vector" "angular_stiffness_vector"
+    "angular_damping_vector" "anchor" "translational_v_ref"
+    "rotational_v_ref" "translational_v" "rotational_v"
+    ;; package `radiant_systems'
+    "illuminance" "luminous_flux" "luminous_intensity" "irradiance" "radiant"
+    "radiant_vector" "luminous_intensity_vector" "luminous_flux_vector"
+    "illuminance_vector" "irradiance_vector"
+    ;; package `thermal_systems'
+    "temperature" "heat_flow" "thermal_capacitance" "thermal_resistance"
+    "thermal_conductance" "thermal" "thermal_vector" "temperature_vector"
+    "heat_flow_vector" "thermal_capacitance_vector"
+    "thermal_resistance_vector" "thermal_conductance_vector"
+    ;; package `fluidic_systems'
+    "pressure" "vflow_rate" "mass_flow_rate" "volume" "density" "viscosity"
+    "fresistance" "fconductance" "fcapacitance" "inertance" "cfresistance"
+    "cfcapacitance" "cfinertance" "cfconductance" "fluidic" "fluidic_vector"
+    "compressible_fluidic" "compressible_fluidic_vector" "pressure_vector"
+    "vflow_rate_vector" "mass_flow_rate_vector" "volume_vector"
+    "density_vector" "viscosity_vector" "fresistance_vector"
+    "fconductance_vector" "fcapacitance_vector" "inertance_vector"
+    "cfresistance_vector" "cfconductance_vector" "cfcapacitance_vector"
+    "cfinertance_vector"
+    )
   "List of VHDL-AMS standardized types.")
 
 (defconst vhdl-math-types
   '(
-    "complex" "complex_polar"
+    "complex" "complex_polar" "positive_real" "principal_value"
     )
   "List of Math Packages standardized types.")
 
-(defconst vhdl-93-attributes
+(defconst vhdl-02-attributes
   '(
     "base" "left" "right" "high" "low" "pos" "val" "succ"
     "pred" "leftof" "rightof" "range" "reverse_range"
@@ -4858,7 +5012,7 @@ Key bindings:
     "simple_name" "instance_name" "path_name"
     "foreign"
     )
-  "List of VHDL'93 standardized attributes.")
+  "List of VHDL'02 standardized attributes.")
 
 (defconst vhdl-ams-attributes
   '(
@@ -4869,7 +5023,7 @@ Key bindings:
     )
   "List of VHDL-AMS standardized attributes.")
 
-(defconst vhdl-93-enum-values
+(defconst vhdl-02-enum-values
   '(
     "true" "false"
     "note" "warning" "error" "failure"
@@ -4878,7 +5032,7 @@ Key bindings:
     "fs" "ps" "ns" "us" "ms" "sec" "min" "hr"
     "right" "left"
     )
-  "List of VHDL'93 standardized enumeration values.")
+  "List of VHDL'02 standardized enumeration values.")
 
 (defconst vhdl-ams-enum-values
   '(
@@ -4888,22 +5042,38 @@ Key bindings:
     )
   "List of VHDL-AMS standardized enumeration values.")
 
+(defconst vhdl-ams-constants
+  ;; standard: IEEE Std 1076.1.1-2004
+  '(
+    ;; package `fundamental_constants'
+    "phys_q" "phys_eps0" "phys_mu0" "phys_k" "phys_gravity" "phys_ctok"
+    "phys_c" "phys_h" "phys_h_over_2_pi" "yocto" "zepto" "atto" "femto"
+    "pico" "nano" "micro" "milli" "centi" "deci" "deka" "hecto" "kilo" "mega"
+    "giga" "tera" "peta" "exa" "zetta" "yotta" "deca"
+    ;; package `material_constants'
+    "phys_eps_si" "phys_eps_sio2" "phys_e_si" "phys_e_sio2" "phys_e_poly"
+    "phys_nu_si" "phys_nu_poly" "phys_rho_poly" "phys_rho_sio2"
+    "ambient_temperature" "ambient_pressure" "ambient_illuminance"
+    )
+  "List of VHDL-AMS standardized constants.")
+
 (defconst vhdl-math-constants
+  ;; standard: IEEE Std 1076.2-1996
   '(
-    "math_e" "math_1_over_e"
-    "math_pi" "math_two_pi" "math_1_over_pi"
-    "math_half_pi" "math_q_pi" "math_3_half_pi"
-    "math_log_of_2" "math_log_of_10" "math_log2_of_e" "math_log10_of_e"
-    "math_sqrt2" "math_sqrt1_2" "math_sqrt_pi"
-    "math_deg_to_rad" "math_rad_to_deg"
-    "cbase_1" "cbase_j" "czero"
+    "math_1_over_e" "math_1_over_pi" "math_1_over_sqrt_2" "math_2_pi"
+    "math_3_pi_over_2" "math_cbase_1" "math_cbase_j" "math_czero"
+    "math_deg_to_rad" "math_e" "math_log10_of_e" "math_log2_of_e"
+    "math_log_of_10" "math_log_of_2" "math_pi" "math_pi_over_2"
+    "math_pi_over_3" "math_pi_over_4" "math_rad_to_deg" "math_sqrt_2"
+    "math_sqrt_pi"
     )
   "List of Math Packages standardized constants.")
 
-(defconst vhdl-93-functions
+(defconst vhdl-02-functions
   '(
     "now" "resolved" "rising_edge" "falling_edge"
-    "read" "readline" "write" "writeline" "endfile"
+    "read" "readline" "hread" "oread" "write" "writeline" "hwrite" "owrite"
+    "endfile"
     "resize" "is_X" "std_match"
     "shift_left" "shift_right" "rotate_left" "rotate_right"
     "to_unsigned" "to_signed" "to_integer"
@@ -4913,25 +5083,27 @@ Key bindings:
     "shl" "shr" "ext" "sxt"
     "deallocate"
     )
-  "List of VHDL'93 standardized functions.")
+  "List of VHDL'02 standardized functions.")
 
 (defconst vhdl-ams-functions
   '(
+    ;; package `standard'
     "frequency"
     )
   "List of VHDL-AMS standardized functions.")
 
 (defconst vhdl-math-functions
+  ;; standard: IEEE Std 1076.2-1996
   '(
-    "sign" "ceil" "floor" "round" "trunc" "fmax" "fmin" "uniform"
-    "sqrt" "cbrt" "exp" "log"
-    "sin" "cos" "tan" "arcsin" "arccos" "arctan"
-    "sinh" "cosh" "tanh" "arcsinh" "arccosh" "arctanh"
-    "cmplx" "complex_to_polar" "polar_to_complex" "arg" "conj"
+    "arccos" "arccosh" "arcsin" "arcsinh" "arctan" "arctanh" "arg"
+    "cbrt" "ceil" "cmplx" "complex_to_polar" "conj" "cos" "cosh" "exp"
+    "floor" "get_principal_value" "log" "log10" "log2" "polar_to_complex"
+    "realmax" "realmin" "round" "sign" "sin" "sinh" "sqrt"
+    "tan" "tanh" "trunc" "uniform"
     )
   "List of Math Packages standardized functions.")
 
-(defconst vhdl-93-packages
+(defconst vhdl-02-packages
   '(
     "std_logic_1164" "numeric_std" "numeric_bit"
     "standard" "textio"
@@ -4939,12 +5111,13 @@ Key bindings:
     "std_logic_misc" "std_logic_textio"
     "ieee" "std" "work"
     )
-  "List of VHDL'93 standardized packages and libraries.")
+  "List of VHDL'02 standardized packages and libraries.")
 
 (defconst vhdl-ams-packages
   '(
-    ;; from `nature_pkg' package
-    "nature_pkg"
+    "fundamental_constants" "material_constants" "energy_systems"
+    "electrical_systems" "mechanical_systems" "radiant_systems"
+    "thermal_systems" "fluidic_systems"
     )
   "List of VHDL-AMS standardized packages and libraries.")
 
@@ -4990,6 +5163,9 @@ Key bindings:
 (defvar vhdl-enum-values-regexp nil
   "Regexp for VHDL standardized enumeration values.")
 
+(defvar vhdl-constants-regexp nil
+  "Regexp for VHDL standardized constants.")
+
 (defvar vhdl-functions-regexp nil
   "Regexp for VHDL standardized functions.")
 
@@ -5002,29 +5178,50 @@ Key bindings:
 (defvar vhdl-directive-keywords-regexp nil
   "Regexp for compiler directive keywords.")
 
+(defun vhdl-upcase-list (condition list)
+  "Upcase all elements in LIST based on CONDITION."
+  (when condition
+    (let ((tmp-list list))
+      (while tmp-list
+       (setcar tmp-list (upcase (car tmp-list)))
+       (setq tmp-list (cdr tmp-list)))))
+  list)
+
 (defun vhdl-words-init ()
   "Initialize reserved words."
   (setq vhdl-keywords
-       (append vhdl-93-keywords
-               (when (vhdl-standard-p 'ams) vhdl-ams-keywords)))
+       (vhdl-upcase-list
+        (and vhdl-highlight-case-sensitive vhdl-upper-case-keywords)
+        (append vhdl-02-keywords
+                (when (vhdl-standard-p 'ams) vhdl-ams-keywords))))
   (setq vhdl-types
-       (append vhdl-93-types
-               (when (vhdl-standard-p 'ams) vhdl-ams-types)
-               (when (vhdl-standard-p 'math) vhdl-math-types)))
+       (vhdl-upcase-list
+        (and vhdl-highlight-case-sensitive vhdl-upper-case-types)
+        (append vhdl-02-types
+                (when (vhdl-standard-p 'ams) vhdl-ams-types)
+                (when (vhdl-standard-p 'math) vhdl-math-types))))
   (setq vhdl-attributes
-       (append vhdl-93-attributes
-               (when (vhdl-standard-p 'ams) vhdl-ams-attributes)))
+       (vhdl-upcase-list
+        (and vhdl-highlight-case-sensitive vhdl-upper-case-attributes)
+        (append vhdl-02-attributes
+                (when (vhdl-standard-p 'ams) vhdl-ams-attributes))))
   (setq vhdl-enum-values
-       (append vhdl-93-enum-values
-               (when (vhdl-standard-p 'ams) vhdl-ams-enum-values)))
+       (vhdl-upcase-list
+        (and vhdl-highlight-case-sensitive vhdl-upper-case-enum-values)
+        (append vhdl-02-enum-values
+                (when (vhdl-standard-p 'ams) vhdl-ams-enum-values))))
   (setq vhdl-constants
-       (append (when (vhdl-standard-p 'math) vhdl-math-constants)))
+       (vhdl-upcase-list
+        (and vhdl-highlight-case-sensitive vhdl-upper-case-constants)
+        (append (when (vhdl-standard-p 'ams) vhdl-ams-constants)
+                (when (vhdl-standard-p 'math) vhdl-math-constants)
+                '(""))))
   (setq vhdl-functions
-       (append vhdl-93-functions
+       (append vhdl-02-functions
                (when (vhdl-standard-p 'ams) vhdl-ams-functions)
                (when (vhdl-standard-p 'math) vhdl-math-functions)))
   (setq vhdl-packages
-       (append vhdl-93-packages
+       (append vhdl-02-packages
                (when (vhdl-standard-p 'ams) vhdl-ams-packages)
                (when (vhdl-standard-p 'math) vhdl-math-packages)))
   (setq vhdl-reserved-words
@@ -5039,6 +5236,8 @@ Key bindings:
        (concat "\\<\\(" (regexp-opt vhdl-attributes) "\\)\\>"))
   (setq vhdl-enum-values-regexp
        (concat "\\<\\(" (regexp-opt vhdl-enum-values) "\\)\\>"))
+  (setq vhdl-constants-regexp
+       (concat "\\<\\(" (regexp-opt vhdl-constants) "\\)\\>"))
   (setq vhdl-functions-regexp
        (concat "\\<\\(" (regexp-opt vhdl-functions) "\\)\\>"))
   (setq vhdl-packages-regexp
@@ -5090,7 +5289,7 @@ We cannot use just `word' syntax class since `_' cannot be in word
 class.  Putting underscore in word class breaks forward word movement
 behavior that users are familiar with.")
 
-(defconst vhdl-case-header-key "case[( \t\n][^;=>]+[) \t\n]is"
+(defconst vhdl-case-header-key "case[( \t\n\r\f][^;=>]+[) \t\n\r\f]is"
   "Regexp describing a case statement header key.")
 
 (defconst vhdl-label-key
@@ -5318,6 +5517,17 @@ the offset is simply returned."
   "Check if point is in a string."
   (eq (vhdl-in-literal) 'string))
 
+(defun vhdl-in-quote-p ()
+  "Check if point is in a quote ('x')."
+  (or (and (> (point) (point-min))
+          (< (1+ (point)) (point-max))
+          (= (char-before (point)) ?\')
+          (= (char-after (1+ (point))) ?\'))
+      (and (> (1- (point)) (point-min))
+          (< (point) (point-max))
+          (= (char-before (1- (point))) ?\')
+          (= (char-after (point)) ?\'))))
+
 (defun vhdl-in-literal ()
   "Determine if point is in a VHDL literal."
   (save-excursion
@@ -5328,6 +5538,12 @@ the offset is simply returned."
        ((vhdl-beginning-of-macro) 'pound)
        (t nil)))))
 
+(defun vhdl-in-extended-identifier-p ()
+  "Determine if point is inside extended identifier (delimited by '\')."
+  (save-match-data
+    (and (save-excursion (re-search-backward "\\\\" (vhdl-point 'bol) t))
+        (save-excursion (re-search-forward "\\\\" (vhdl-point 'eol) t)))))
+
 (defun vhdl-forward-comment (&optional direction)
   "Skip all comments (including whitespace).  Skip backwards if DIRECTION is
 negative, skip forward otherwise."
@@ -5335,20 +5551,30 @@ negative, skip forward otherwise."
   (if (and direction (< direction 0))
       ;; skip backwards
       (progn
-       (skip-chars-backward " \t\n")
+       (skip-chars-backward " \t\n\r\f")
        (while (re-search-backward "^[^\"-]*\\(\\(-?\"[^\"]*\"\\|-[^\"-]\\)[^\"-]*\\)*\\(--\\)" (vhdl-point 'bol) t)
          (goto-char (match-beginning 3))
-         (skip-chars-backward " \t\n")))
+         (skip-chars-backward " \t\n\r\f")))
     ;; skip forwards
-    (skip-chars-forward " \t\n")
+    (skip-chars-forward " \t\n\r\f")
     (while (looking-at "--.*")
       (goto-char (match-end 0))
-      (skip-chars-forward " \t\n"))))
+      (skip-chars-forward " \t\n\r\f"))))
 
 ;; XEmacs hack: work around buggy `forward-comment' in XEmacs 21.4+
 (unless (and (featurep 'xemacs) (string< "21.2" emacs-version))
   (defalias 'vhdl-forward-comment 'forward-comment))
 
+(defun vhdl-back-to-indentation ()
+  "Move point to the first non-whitespace character on this line."
+  (interactive)
+  (beginning-of-line 1)
+  (skip-syntax-forward " " (vhdl-point 'eol)))
+
+;; XEmacs hack: work around old `back-to-indentation' in XEmacs
+(when (featurep 'xemacs)
+  (defalias 'back-to-indentation 'vhdl-back-to-indentation))
+
 ;; This is the best we can do in Win-Emacs.
 (defun vhdl-win-il (&optional lim)
   "Determine if point is in a VHDL literal."
@@ -5513,7 +5739,7 @@ that point, else nil."
   (and
    (save-excursion
      (forward-sexp)
-     (skip-chars-forward " \t\n")
+     (skip-chars-forward " \t\n\r\f")
      (not (looking-at "is\\b[^_]")))
    (save-excursion
      (backward-sexp)
@@ -5553,12 +5779,12 @@ corresponding \"begin\" keyword, else return nil."
           "is"))))
 
 (defconst vhdl-begin-fwd-re
-  "\\b\\(is\\|begin\\|block\\|component\\|generate\\|then\\|else\\|loop\\|process\\|procedural\\|units\\|record\\|for\\)\\b\\([^_]\\|\\'\\)"
+  "\\b\\(is\\|begin\\|block\\|component\\|generate\\|then\\|else\\|loop\\|process\\|procedural\\(\\s-+body\\)?\\|units\\|use\\|record\\|protected\\(\\s-+body\\)?\\|for\\)\\b\\([^_]\\|\\'\\)"
   "A regular expression for searching forward that matches all known
 \"begin\" keywords.")
 
 (defconst vhdl-begin-bwd-re
-  "\\b\\(is\\|begin\\|block\\|component\\|generate\\|then\\|else\\|loop\\|process\\|procedural\\|units\\|record\\|for\\)\\b[^_]"
+  "\\b\\(is\\|begin\\|block\\|component\\|generate\\|then\\|else\\|loop\\|process\\|procedural\\(\\s-+body\\)?\\|units\\|use\\|record\\|protected\\(\\s-+body\\)?\\|for\\)\\b[^_]"
   "A regular expression for searching backward that matches all known
 \"begin\" keywords.")
 
@@ -5591,21 +5817,21 @@ keyword."
           (and (/= (following-char) ?\;)
                (not (looking-at "is\\|begin\\|process\\|procedural\\|block")))))
     t)
-   ;; "begin", "then":
-   ((looking-at "be\\|t")
+   ;; "begin", "then", "use":
+   ((looking-at "be\\|t\\|use")
     t)
    ;; "else":
    ((and (looking-at "e")
         ;; make sure that the "else" isn't inside a
         ;; conditional signal assignment.
         (save-excursion
-          (re-search-backward ";\\|\\bwhen\\b[^_]" lim 'move)
+          (vhdl-re-search-backward ";\\|\\bwhen\\b[^_]" lim 'move)
           (or (eq (following-char) ?\;)
               (eq (point) lim))))
     t)
    ;; "block", "generate", "loop", "process", "procedural",
-   ;; "units", "record":
-   ((and (looking-at "bl\\|[glpur]")
+   ;; "units", "record", "protected body":
+   ((and (looking-at "block\\|generate\\|loop\\|process\\|procedural\\|protected\\(\\s-+body\\)?\\|units\\|record")
         (save-excursion
           (backward-sexp)
           (not (looking-at "end\\s-+\\w"))))
@@ -5633,7 +5859,7 @@ keyword."
   (cond
    ((looking-at "is\\|block\\|generate\\|process\\|procedural")
     "begin")
-   ((looking-at "then")
+   ((looking-at "then\\|use")
     "<else>")
    (t
     "end")))
@@ -5648,6 +5874,9 @@ Assumes that the caller will make sure that we are not in the middle
 of an identifier that just happens to contain a \"begin\" keyword."
   (save-excursion
     (and (looking-at vhdl-begin-fwd-re)
+        (or (not (looking-at "\\<use\\>"))
+            (save-excursion (back-to-indentation)
+                            (looking-at "\\(\\w+\\s-*:\\s-*\\)?\\<\\(case\\|elsif\\|if\\)\\>")))
         (/= (preceding-char) ?_)
         (not (vhdl-in-literal))
         (vhdl-begin-p lim)
@@ -5670,8 +5899,8 @@ of an identifier that just happens to contain a \"begin\" keyword."
                              (vhdl-beginning-of-statement-1 lim)
                              (vhdl-backward-skip-label lim)
                              (vhdl-first-word (point)))))))
-         ;; "component", "units", "record":
-         ((looking-at "[cur]")
+         ;; "component", "units", "record", "protected body":
+         ((looking-at "component\\|units\\|protected\\(\\s-+body\\)?\\|record")
           ;; The first end found will close the block
           (vector "end" nil))
          ;; "block", "process", "procedural":
@@ -5683,8 +5912,8 @@ of an identifier that just happens to contain a \"begin\" keyword."
                         (vhdl-backward-skip-label lim)
                         (vhdl-first-word (point))))))
          ;; "then":
-         ((looking-at "t")
-          (vector "elsif\\|else\\|end\\s-+if"
+         ((looking-at "t\\|use")
+          (vector "elsif\\|else\\|end\\s-+\\(if\\|use\\)"
                   (and (vhdl-last-word (point))
                        (or (vhdl-first-word (point))
                            (save-excursion
@@ -5730,25 +5959,25 @@ of an identifier that just happens to contain an \"end\" keyword."
               (vhdl-end-p lim))
          (if (looking-at "el")
              ;; "else", "elsif":
-             (vector "if\\|elsif" (vhdl-first-word (point)) "then" nil)
+             (vector "if\\|elsif" (vhdl-first-word (point)) "then\\|use" nil)
            ;; "end ...":
            (setq pos (point))
            (forward-sexp)
-           (skip-chars-forward " \t\n")
+           (skip-chars-forward " \t\n\r\f")
            (cond
             ;; "end if":
             ((looking-at "if\\b[^_]")
              (vector "else\\|elsif\\|if"
                      (vhdl-first-word pos)
-                     "else\\|then" nil))
+                     "else\\|then\\|use" nil))
             ;; "end component":
             ((looking-at "component\\b[^_]")
              (vector (buffer-substring (match-beginning 1)
                                        (match-end 1))
                      (vhdl-first-word pos)
                      nil nil))
-            ;; "end units", "end record":
-            ((looking-at "\\(units\\|record\\)\\b[^_]")
+            ;; "end units", "end record", "end protected":
+            ((looking-at "\\(units\\|record\\|protected\\(\\s-+body\\)?\\)\\b[^_]")
              (vector (buffer-substring (match-beginning 1)
                                        (match-end 1))
                      (vhdl-first-word pos)
@@ -5805,38 +6034,38 @@ of an identifier that just happens to contain an \"end\" keyword."
     (cond ((looking-at "block\\|process\\|procedural")
           (if (save-excursion
                 (forward-sexp)
-                (skip-chars-forward " \t\n")
+                (skip-chars-forward " \t\n\r\f")
                 (= (following-char) ?\())
               (forward-sexp 2)
             (forward-sexp))
-          (when (looking-at "[ \t\n]*is")
+          (when (looking-at "[ \t\n\r\f]*is")
             (goto-char (match-end 0)))
           (point))
          ((looking-at "component")
           (forward-sexp 2)
-          (when (looking-at "[ \t\n]*is")
+          (when (looking-at "[ \t\n\r\f]*is")
             (goto-char (match-end 0)))
           (point))
          ((looking-at "for")
           (forward-sexp 2)
-          (skip-chars-forward " \t\n")
+          (skip-chars-forward " \t\n\r\f")
           (while (looking-at "[,:(]")
             (forward-sexp)
-            (skip-chars-forward " \t\n"))
+            (skip-chars-forward " \t\n\r\f"))
           (point))
          (t nil)
          )))
 
 (defconst vhdl-trailer-re
-  "\\b\\(is\\|then\\|generate\\|loop\\|record\\)\\b[^_]")
+  "\\b\\(is\\|then\\|generate\\|loop\\|record\\|protected\\(\\s-+body\\)?\\|use\\)\\b[^_]")
 
 (defconst vhdl-statement-fwd-re
-  "\\b\\(if\\|for\\|while\\)\\b\\([^_]\\|\\'\\)"
+  "\\b\\(if\\|for\\|while\\|loop\\)\\b\\([^_]\\|\\'\\)"
   "A regular expression for searching forward that matches all known
 \"statement\" keywords.")
 
 (defconst vhdl-statement-bwd-re
-  "\\b\\(if\\|for\\|while\\)\\b[^_]"
+  "\\b\\(if\\|for\\|while\\|loop\\)\\b[^_]"
   "A regular expression for searching backward that matches all known
 \"statement\" keywords.")
 
@@ -5852,7 +6081,7 @@ in the middle of an identifier that just happens to contain a
         ;; Make sure it's the start of a parameter specification.
         (save-excursion
           (forward-sexp 2)
-          (skip-chars-forward " \t\n")
+          (skip-chars-forward " \t\n\r\f")
           (looking-at "in\\b[^_]"))
         ;; Make sure it's not an "end for".
         (save-excursion
@@ -5871,7 +6100,7 @@ in the middle of an identifier that just happens to contain a
     t)
    ))
 
-(defconst vhdl-case-alternative-re "when[( \t\n][^;=>]+=>"
+(defconst vhdl-case-alternative-re "when[( \t\n\r\f][^;=>]+=>"
   "Regexp describing a case statement alternative key.")
 
 (defun vhdl-case-alternative-p (&optional lim)
@@ -5908,6 +6137,9 @@ contain a \"when\" keyword."
        (cond
         ;; "begin" keyword:
         ((and (looking-at vhdl-begin-fwd-re)
+              (or (not (looking-at "\\<use\\>"))
+                  (save-excursion (back-to-indentation)
+                                  (looking-at "\\(\\w+\\s-*:\\s-*\\)?\\<\\(case\\|elsif\\|if\\)\\>")))
               (/= (preceding-char) ?_)
               (vhdl-begin-p lim))
          (setq foundp 'begin))
@@ -5931,7 +6163,7 @@ With COUNT, do it that many times."
     (save-excursion
       (while (> count 0)
        ;; skip whitespace
-       (skip-chars-forward " \t\n")
+       (skip-chars-forward " \t\n\r\f")
        ;; Check for an unbalanced "end" keyword
        (if (and (looking-at vhdl-end-fwd-re)
                 (/= (preceding-char) ?_)
@@ -6007,6 +6239,10 @@ searches."
            nil
          (backward-sexp)
          (if (and (looking-at vhdl-begin-fwd-re)
+                  (or (not (looking-at "\\<use\\>"))
+                      (save-excursion
+                        (back-to-indentation)
+                        (looking-at "\\(\\w+\\s-*:\\s-*\\)?\\<\\(case\\|elsif\\|if\\)\\>")))
                   (/= (preceding-char) ?_)
                   (not (vhdl-in-literal))
                   (vhdl-begin-p lim))
@@ -6278,7 +6514,7 @@ search, and an argument indicating an interactive call."
   (re-search-forward vhdl-e-o-s-re))
 
 (defconst vhdl-b-o-s-re
-  (concat ";\\|\(\\|\)\\|\\bwhen\\b[^_]\\|"
+  (concat ";[^_]\\|\([^_]\\|\)[^_]\\|\\bwhen\\b[^_]\\|"
          vhdl-begin-bwd-re "\\|" vhdl-statement-bwd-re))
 
 (defun vhdl-beginning-of-statement-1 (&optional lim)
@@ -6299,7 +6535,7 @@ statement if already at the beginning of one."
     (while (and (not donep)
                (not (bobp))
                ;; look backwards for a statement boundary
-               (re-search-backward vhdl-b-o-s-re lim 'move))
+               (progn (forward-char) (re-search-backward vhdl-b-o-s-re lim 'move)))
       (if (or (= (preceding-char) ?_)
              (vhdl-in-literal))
          (backward-char)
@@ -6319,13 +6555,17 @@ statement if already at the beginning of one."
                     (vhdl-forward-syntactic-ws here)
                     (setq donep t))))
         ;; If we are looking at a semicolon, then stop
-        ((eq (following-char) ?\;)
+        ((and (eq (following-char) ?\;) (not (vhdl-in-quote-p)))
          (progn
            (forward-char)
            (vhdl-forward-syntactic-ws here)
            (setq donep t)))
         ;; If we are looking at a "begin", then stop
         ((and (looking-at vhdl-begin-fwd-re)
+              (or (not (looking-at "\\<use\\>"))
+                  (save-excursion
+                    (back-to-indentation)
+                    (looking-at "\\(\\w+\\s-*:\\s-*\\)?\\<\\(case\\|elsif\\|if\\)\\>")))
               (/= (preceding-char) ?_)
               (vhdl-begin-p nil))
          ;; If it's a leader "begin", then find the
@@ -6576,6 +6816,10 @@ is not moved."
        (setq begin-after-ip (and
                              (not literal)
                              (looking-at vhdl-begin-fwd-re)
+                             (or (not (looking-at "\\<use\\>"))
+                                 (save-excursion
+                                   (back-to-indentation)
+                                   (looking-at "\\(\\w+\\s-*:\\s-*\\)?\\<\\(case\\|elsif\\|if\\)\\>")))
                              (vhdl-begin-p)))
        (setq end-after-ip (and
                            (not literal)
@@ -6624,7 +6868,8 @@ is not moved."
           ((progn
              (vhdl-backward-syntactic-ws lim)
              (or (bobp)
-                 (= (preceding-char) ?\;)))
+                 (and (= (preceding-char) ?\;)
+                      (not (vhdl-in-quote-p)))))
            (vhdl-add-syntax 'statement placeholder))
           ;; CASE 2D: we are looking at a top-level statement-cont
           (t
@@ -6662,6 +6907,10 @@ is not moved."
                 (save-excursion
                   (vhdl-beginning-of-statement-1 containing-sexp)
                   (skip-chars-backward " \t(")
+                  (while (and (= (preceding-char) ?\;)
+                              (not (vhdl-in-quote-p)))
+                    (vhdl-beginning-of-statement-1 containing-sexp)
+                    (skip-chars-backward " \t("))
                   (<= (point) containing-sexp)))
            (goto-char containing-sexp)
            (vhdl-add-syntax 'arglist-cont-nonempty (vhdl-point 'boi)))
@@ -6730,7 +6979,7 @@ is not moved."
                     (save-excursion
                       (goto-char new)
                       (eq new (progn (back-to-indentation) (point)))))
-               (setq placeholder new)))
+               (setq placeholder new)))        
          (vhdl-add-syntax 'statement-cont placeholder)
          (if begin-after-ip
              (vhdl-add-syntax 'block-open)))
@@ -6891,7 +7140,7 @@ only-lines."
     (let* ((relpos (cdr langelem))
           (assignp (save-excursion
                     (goto-char (vhdl-point 'boi))
-                    (and (re-search-forward "\\(<\\|:\\)="
+                    (and (re-search-forward "\\(<\\|:\\|=\\)="
                                             (vhdl-point 'eol) t)
                          (- (point) (vhdl-point 'boi)))))
           (curcol (progn
@@ -6900,7 +7149,7 @@ only-lines."
           foundp)
       (while (and (not foundp)
                  (< (point) (vhdl-point 'eol)))
-       (re-search-forward "\\(<\\|:\\)=\\|(" (vhdl-point 'eol) 'move)
+       (re-search-forward "\\(<\\|:\\|=\\)=\\|(" (vhdl-point 'eol) 'move)
        (if (vhdl-in-literal)
            (forward-char)
          (if (= (preceding-char) ?\()
@@ -7001,7 +7250,8 @@ character is a space."
   (interactive)
   (if (and (= (preceding-char) ? ) (vhdl-in-comment-p))
       (indent-new-comment-line)
-    (when (and (>= (preceding-char) ?a) (<= (preceding-char) ?z))
+    (when (and (>= (preceding-char) ?a) (<= (preceding-char) ?z)
+              (not (vhdl-in-comment-p)))
       (vhdl-fix-case-word -1))
     (newline-and-indent)))
 
@@ -7011,6 +7261,7 @@ indentation change."
   (interactive)
   (let* ((syntax (and vhdl-indent-syntax-based (vhdl-get-syntactic-context)))
         (pos (- (point-max) (point)))
+        (is-comment nil)
         (indent
          (if syntax
              ;; indent syntax-based
@@ -7018,6 +7269,15 @@ indentation change."
                       (>= (vhdl-get-offset (car syntax)) comment-column))
                  ;; special case: comments at or right of comment-column
                  (vhdl-get-offset (car syntax))
+               ;; align comments like following code line
+               (when vhdl-indent-comment-like-next-code-line
+                 (save-excursion
+                   (while (eq (caar syntax) 'comment)
+                     (setq is-comment t)
+                     (beginning-of-line 2)
+                     (setq syntax (vhdl-get-syntactic-context)))))
+               (when is-comment
+                 (setq syntax (cons (cons 'comment nil) syntax)))
                (apply '+ (mapcar 'vhdl-get-offset syntax)))
            ;; indent like previous nonblank line
            (save-excursion (beginning-of-line)
@@ -7026,10 +7286,13 @@ indentation change."
         (shift-amt  (- indent (current-indentation))))
     (and vhdl-echo-syntactic-information-p
         (message "syntax: %s, indent= %d" syntax indent))
-    (unless (zerop shift-amt)
-      (delete-region (vhdl-point 'bol) (vhdl-point 'boi))
-      (beginning-of-line)
-      (indent-to indent))
+    (let ((has-formfeed
+          (save-excursion (beginning-of-line) (looking-at "\\s-*\f"))))
+      (when (or (not (zerop shift-amt)) has-formfeed)
+       (delete-region (vhdl-point 'bol) (vhdl-point 'boi))
+       (beginning-of-line)
+       (when has-formfeed (insert "\f"))
+       (indent-to indent)))
     (if (< (point) (vhdl-point 'boi))
        (back-to-indentation)
       ;; If initial point was within line's indentation, position after
@@ -7040,7 +7303,7 @@ indentation change."
     (vhdl-update-progress-info "Indenting" (vhdl-current-line))
     shift-amt))
 
-(defun vhdl-indent-region (beg end column)
+(defun vhdl-indent-region (beg end &optional column)
   "Indent region as VHDL code.
 Adds progress reporting to `indent-region'."
   (interactive "r\nP")
@@ -7055,7 +7318,7 @@ Adds progress reporting to `indent-region'."
   "Indent whole buffer as VHDL code.
 Calls `indent-region' for whole buffer and adds progress reporting."
   (interactive)
-  (vhdl-indent-region (point-min) (point-max) nil))
+  (vhdl-indent-region (point-min) (point-max)))
 
 (defun vhdl-indent-group ()
   "Indent group of lines between empty lines."
@@ -7068,7 +7331,7 @@ Calls `indent-region' for whole buffer and adds progress reporting."
               (if (re-search-forward vhdl-align-group-separate nil t)
                   (point-marker)
                 (point-max-marker)))))
-    (vhdl-indent-region beg end nil)))
+    (vhdl-indent-region beg end)))
 
 (defun vhdl-indent-sexp (&optional endpos)
   "Indent each line of the list starting just after point.
@@ -7131,21 +7394,23 @@ ENDPOS is encountered."
 (defconst vhdl-align-alist
   '(
     ;; after some keywords
-    (vhdl-mode "^\\s-*\\(constant\\|quantity\\|signal\\|subtype\\|terminal\\|type\\|variable\\)[ \t]"
-              "^\\s-*\\(constant\\|quantity\\|signal\\|subtype\\|terminal\\|type\\|variable\\)\\([ \t]+\\)" 2)
+    (vhdl-mode "^\\s-*\\(across\\|constant\\|quantity\\|signal\\|subtype\\|terminal\\|through\\|type\\|variable\\)[ \t]"
+              "^\\s-*\\(across\\|constant\\|quantity\\|signal\\|subtype\\|terminal\\|through\\|type\\|variable\\)\\([ \t]+\\)" 2)
     ;; before ':'
     (vhdl-mode ":[^=]" "\\([ \t]*\\):[^=]")
     ;; after direction specifications
     (vhdl-mode ":[ \t]*\\(in\\|out\\|inout\\|buffer\\|\\)\\>"
               ":[ \t]*\\(in\\|out\\|inout\\|buffer\\|\\)\\([ \t]+\\)" 2)
     ;; before "==", ":=", "=>", and "<="
-    (vhdl-mode "[<:=]=" "\\([ \t]*\\)[<:=]=" 1) ; since "<= ... =>" can occur
+    (vhdl-mode "[<:=]=" "\\([ \t]*\\)\\??[<:=]=" 1) ; since "<= ... =>" can occur
     (vhdl-mode "=>" "\\([ \t]*\\)=>" 1)
-    (vhdl-mode "[<:=]=" "\\([ \t]*\\)[<:=]=" 1) ; since "=> ... <=" can occur
+    (vhdl-mode "[<:=]=" "\\([ \t]*\\)\\??[<:=]=" 1) ; since "=> ... <=" can occur
     ;; before some keywords
     (vhdl-mode "[ \t]after\\>" "[^ \t]\\([ \t]+\\)after\\>" 1)
     (vhdl-mode "[ \t]when\\>" "[^ \t]\\([ \t]+\\)when\\>" 1)
     (vhdl-mode "[ \t]else\\>" "[^ \t]\\([ \t]+\\)else\\>" 1)
+    (vhdl-mode "[ \t]across\\>" "[^ \t]\\([ \t]+\\)across\\>" 1)
+    (vhdl-mode "[ \t]through\\>" "[^ \t]\\([ \t]+\\)through\\>" 1)
     ;; before "=>" since "when/else ... =>" can occur
     (vhdl-mode "=>" "\\([ \t]*\\)=>" 1)
     )
@@ -7195,7 +7460,7 @@ parentheses."
        (forward-list)
        (setq end (point))
        (goto-char (1+ beg))
-       (skip-chars-forward " \t\n")
+       (skip-chars-forward " \t\n\r\f")
        (setq beg (point))))
     ;; run FUNCTION
     (if beg
@@ -7280,8 +7545,14 @@ the token in MATCH."
            bol (setq begin (progn (beginning-of-line) (point))))
       (while (< bol end)
        (save-excursion
-         (when (and (re-search-forward match eol t)
-                    (not (vhdl-in-literal)))
+         (when (and (vhdl-re-search-forward match eol t)
+                    (save-excursion
+                      (goto-char (match-beginning 0))
+                      (forward-char)
+                      (and (not (vhdl-in-literal))
+                           (not (vhdl-in-quote-p))
+                           (not (vhdl-in-extended-identifier-p))))
+                    (not (looking-at "\\s-*$")))
            (setq distance (- (match-beginning substr) bol))
            (when (> distance max)
              (setq max distance))))
@@ -7295,8 +7566,16 @@ the token in MATCH."
       (goto-char (setq bol begin))
       (setq eol (point-at-eol))
       (while (> lines 0)
-       (when (and (re-search-forward match eol t)
-                  (not (vhdl-in-literal)))
+       (when (and (vhdl-re-search-forward match eol t)
+                  (save-excursion
+                    (goto-char (match-beginning 0))
+                    (forward-char)
+                    (and (not (vhdl-in-literal))
+                         (not (vhdl-in-quote-p))
+                         (not (vhdl-in-extended-identifier-p))))
+                  (not (looking-at "\\s-*$"))
+                  (> (match-beginning 0)  ; not if at boi
+                     (save-excursion (back-to-indentation) (point))))
          (setq width (- (match-end substr) (match-beginning substr)))
          (setq distance (- (match-beginning substr) bol))
          (goto-char (match-beginning substr))
@@ -7449,7 +7728,7 @@ the token in MATCH."
        ;; search for comment start positions and lengths
        (while (< (point) end)
         (when (and (not (looking-at "^\\s-*\\(begin\\|end\\)\\>"))
-                   (looking-at "^\\(.*[^ \t\n-]+\\)\\s-*\\(--.*\\)$")
+                   (looking-at "^\\(.*[^ \t\n\r\f-]+\\)\\s-*\\(--.*\\)$")
                    (not (save-excursion (goto-char (match-beginning 2))
                                         (vhdl-in-literal))))
           (setq start (+ (- (match-end 1) (match-beginning 1)) spacing))
@@ -7474,7 +7753,7 @@ the token in MATCH."
        (while (< (point) end)
         (setq cur-start nil)
         (when (and (not (looking-at "^\\s-*\\(begin\\|end\\)\\>"))
-                   (or (and (looking-at "^\\(.*[^ \t\n-]+\\)\\(\\s-*\\)\\(--.*\\)$")
+                   (or (and (looking-at "^\\(.*[^ \t\n\r\f-]+\\)\\(\\s-*\\)\\(--.*\\)$")
                             (not (save-excursion
                                    (goto-char (match-beginning 3))
                                    (vhdl-in-literal))))
@@ -7582,32 +7861,35 @@ end of line, do nothing in comments and strings."
     (setq end (point-marker))
     ;; have no space before and one space after `,' and ';'
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\)\\|\\(\\s-*\\([,;]\\)\\)" end t)
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\s-*\\([,;]\\)\\)" end t)
       (if (match-string 1)
          (goto-char (match-end 1))
-       (replace-match "\\3 " nil nil nil 3)))
+       (replace-match "\\3 " nil nil nil 2)))
     ;; have no space after `('
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\)\\|\\((\\)\\s-+" end t)
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\((\\)\\s-+" end t)
       (if (match-string 1)
          (goto-char (match-end 1))
        (replace-match "\\2")))
     ;; have no space before `)'
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|^\\s-+\\)\\|\\s-+\\()\\)" end t)
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\|^\\s-+\\)\\|\\s-+\\()\\)" end t)
       (if (match-string 1)
          (goto-char (match-end 1))
        (replace-match "\\2")))
     ;; surround operator symbols by one space
     (goto-char beg)
-    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\)\\|\\(\\([^/:<>=]\\)\\(:\\|=\\|<\\|>\\|:=\\|<=\\|>=\\|=>\\|/=\\)\\([^=>]\\|$\\)\\)" end t)
-      (if (match-string 1)
-         (goto-char (match-end 1))
+    (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\([^/:<>=]\\)\\(:\\|\\??=\\|\\??<<\\|\\??>>\\|\\??<\\|\\??>\\|:=\\|\\??<=\\|\\??>=\\|=>\\|\\??/=\\|\\?\\?\\)\\([^=>]\\|$\\)\\)" end t)
+      (if (or (match-string 1)
+             (<= (match-beginning 0)  ; not if at boi
+                (save-excursion (back-to-indentation) (point))))
+         (goto-char (match-end 0))
        (replace-match "\\3 \\4 \\5")
        (goto-char (match-end 2))))
     ;; eliminate multiple spaces and spaces at end of line
     (goto-char beg)
     (while (or (and (looking-at "--.*\n") (re-search-forward "--.*\n" end t))
+              (and (looking-at "--.*") (re-search-forward "--.*" end t))
               (and (looking-at "\"") (re-search-forward "\"[^\"\n]*[\"\n]" end t))
               (and (looking-at "\\s-+$") (re-search-forward "\\s-+$" end t)
                    (progn (replace-match "" nil nil) t))
@@ -7618,6 +7900,7 @@ end of line, do nothing in comments and strings."
                    (progn (replace-match "  " nil nil) t))
               (and (looking-at "\\s-+") (re-search-forward "\\s-+" end t)
                    (progn (replace-match " " nil nil) t))
+              (and (looking-at "-") (re-search-forward "-" end t))
 ;             (re-search-forward "[^ \t-]+" end t))))
               (re-search-forward "[^ \t\"-]+" end t))))
   (unless no-message (message "Fixing up whitespace...done")))
@@ -7639,7 +7922,7 @@ case fixing to a region.  Calls functions `vhdl-indent-buffer',
 `vhdl-fix-case-buffer'."
   (interactive "r")
   (setq end (save-excursion (goto-char end) (point-marker)))
-  (vhdl-indent-region beg end nil)
+  (vhdl-indent-region beg end)
   (let ((vhdl-align-groups t))
     (vhdl-align-region beg end))
   (vhdl-fix-case-region beg end))
@@ -7720,7 +8003,7 @@ buffer."
     (vhdl-prepare-search-2
      (end-of-line)
      ;; look whether in process
-     (if (not (and (re-search-backward "^\\s-*\\(\\w+[ \t\n]*:[ \t\n]*\\)?\\(process\\|end\\s-+process\\)\\>" nil t)
+     (if (not (and (re-search-backward "^\\s-*\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(process\\|end\\s-+process\\)\\>" nil t)
                   (equal (upcase (match-string 2)) "PROCESS")
                   (save-excursion (re-search-forward "^\\s-*end\\s-+process\\>" nil t))))
         (error "ERROR:  Not within a process")
@@ -7735,7 +8018,7 @@ buffer."
     (vhdl-prepare-search-2
      (goto-char (point-min))
      (message "Updating sensitivity lists...")
-     (while (re-search-forward "^\\s-*\\(\\w+[ \t\n]*:[ \t\n]*\\)?process\\>" nil t)
+     (while (re-search-forward "^\\s-*\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?process\\>" nil t)
        (goto-char (match-beginning 0))
        (condition-case nil (vhdl-update-sensitivity-list) (error "")))
      (message "Updating sensitivity lists...done"))))
@@ -7744,9 +8027,13 @@ buffer."
   "Update sensitivity list."
     (let ((proc-beg (point))
          (proc-end (re-search-forward "^\\s-*end\\s-+process\\>" nil t))
-         (proc-mid (re-search-backward "^\\s-*begin\\>" nil t))
+         (proc-mid (vhdl-re-search-backward
+                    "\\(\\(\\<begin\\>\\)\\|^\\s-*process\\>\\)" nil t))
          seq-region-list)
       (cond
+       ;; error if 'begin' keyword missing
+       ((not (match-string 2))
+       (error "ERROR:  No 'begin' keyword found"))
        ;; search for wait statement (no sensitivity list allowed)
        ((progn (goto-char proc-mid)
               (vhdl-re-search-forward "\\<wait\\>" proc-end t))
@@ -7780,19 +8067,19 @@ buffer."
                ;; case expression
                ((re-search-forward "^\\s-*case\\>" proc-end t)
                 (re-search-forward "\\<is\\>" proc-end t))
-               ;; parameter list of procedure call
-               ((and (re-search-forward "^\\s-*\\w+[ \t\n]*(" proc-end t)
+               ;; parameter list of procedure call, array index
+               ((and (re-search-forward "^\\s-*\\(\\w\\|\\.\\)+[ \t\n\r\f]*(" proc-end t)
                      (1- (point)))
                 (progn (backward-char) (forward-sexp)
                        (while (looking-at "(") (forward-sexp)) (point)))))
-            name read-list sens-list signal-list
+            name field read-list sens-list signal-list
             sens-beg sens-end beg end margin)
          ;; scan for signals in old sensitivity list
          (goto-char proc-beg)
          (re-search-forward "\\<process\\>" proc-mid t)
-         (if (not (looking-at "[ \t\n]*("))
+         (if (not (looking-at "[ \t\n\r\f]*("))
              (setq sens-beg (point))
-           (setq sens-beg (re-search-forward "\\([ \t\n]*\\)([ \t\n]*" nil t))
+           (setq sens-beg (re-search-forward "\\([ \t\n\r\f]*\\)([ \t\n\r\f]*" nil t))
            (goto-char (match-end 1))
            (forward-sexp)
            (setq sens-end (1- (point)))
@@ -7825,15 +8112,17 @@ buffer."
                                             (< (point) (caar tmp-list)))
                                   (setq tmp-list (cdr tmp-list)))
                                 (and tmp-list (< (point) (cdar tmp-list))))))
-               (while (vhdl-re-search-forward "[^'\"]\\<\\([a-zA-Z]\\w*\\)\\>[ \t\n]*\\('\\(\\w+\\)\\|\\(=>\\)\\)?" end t)
+               (while (vhdl-re-search-forward "[^'\".]\\<\\([a-zA-Z]\\w*\\)\\(\\(\\.\\w+\\|[ \t\n\r\f]*([^)]*)\\)*\\)[ \t\n\r\f]*\\('\\(\\w+\\)\\|\\(=>\\)\\)?" end t)
                  (setq name (match-string 1))
-                 (when (and (not (match-string 4)) ; not when formal parameter
-                            (not (and (match-string 3) ; not event attribute
-                                      (not (member (downcase (match-string 3))
+                 (when vhdl-array-index-record-field-in-sensitivity-list
+                   (setq field (match-string 2)))
+                 (when (and (not (match-string 6)) ; not when formal parameter
+                            (not (and (match-string 5) ; not event attribute
+                                      (not (member (downcase (match-string 5))
                                                    '("event" "last_event" "transaction")))))
                             (member (downcase name) signal-list))
-                   (unless (member-ignore-case name read-list)
-                     (setq read-list (cons name read-list))))
+                   (unless (member-ignore-case (concat name field) read-list)
+                     (setq read-list (cons (concat name field) read-list))))
                  (goto-char (match-end 1)))))
            (setq scan-regions-list (cdr scan-regions-list)))
          ;; update sensitivity list
@@ -7879,17 +8168,17 @@ buffer."
         (goto-char (point-min))
         (if (not (re-search-forward (concat "^entity\\s-+" entity-name "\\>") nil t))
             (error "ERROR:  Entity \"%s\" not found:\n  --> see option `vhdl-entity-file-name'" entity-name)
-          (when (setq beg (re-search-forward
-                           "^\\s-*port[ \t\n]*("
+          (when (setq beg (vhdl-re-search-forward
+                           "\\<port[ \t\n\r\f]*("
                            (save-excursion
                              (re-search-forward "^end\\>" nil t)) t))
             (setq end (save-excursion
                         (backward-char) (forward-sexp) (point)))
             (vhdl-forward-syntactic-ws)
             (while (< (point) end)
-              (when (looking-at "signal[ \t\n]+")
+              (when (looking-at "signal[ \t\n\r\f]+")
                 (goto-char (match-end 0)))
-              (while (looking-at "\\(\\w+\\)[ \t\n,]+")
+              (while (looking-at "\\(\\w+\\)[ \t\n\r\f,]+")
                 (setq signal-list
                       (cons (downcase (match-string 1)) signal-list))
                 (goto-char (match-end 0))
@@ -7908,12 +8197,12 @@ buffer."
           (when (= 0 (nth 0 (parse-partial-sexp beg (point))))
             (if (match-string 2)
                 ;; scan signal name
-                (while (looking-at "[ \t\n,]+\\(\\w+\\)")
+                (while (looking-at "[ \t\n\r\f,]+\\(\\w+\\)")
                   (setq signal-list
                         (cons (downcase (match-string 1)) signal-list))
                   (goto-char (match-end 0)))
               ;; scan alias name, check is alias of (declared) signal
-              (when (and (looking-at "[ \t\n]+\\(\\w+\\)[^;]*\\<is[ \t\n]+\\(\\w+\\)")
+              (when (and (looking-at "[ \t\n\r\f]+\\(\\w+\\)[^;]*\\<is[ \t\n\r\f]+\\(\\w+\\)")
                          (member (downcase (match-string 2)) signal-list))
                 (setq signal-list
                       (cons (downcase (match-string 1)) signal-list))
@@ -7950,6 +8239,18 @@ buffer."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Generic/port clause fixing
 
+(defun vhdl-fix-clause-buffer ()
+  "Fix all generic/port clauses in current buffer."
+  (interactive)
+  (save-excursion
+    (vhdl-prepare-search-2
+     (goto-char (point-min))
+     (message "Fixing generic/port clauses...")
+     (while (re-search-forward "^\\s-*\\(generic\\|port\\)[ \t\n\r\f]*(" nil t)
+       (goto-char (match-end 0))
+       (condition-case nil (vhdl-fix-clause) (error "")))
+     (message "Fixing generic/port clauses...done"))))
+
 (defun vhdl-fix-clause ()
   "Fix closing parenthesis within generic/port clause."
   (interactive)
@@ -7957,13 +8258,14 @@ buffer."
     (vhdl-prepare-search-2
      (let ((pos (point))
           beg end)
-       (if (not (re-search-backward "^\\s-*\\(generic\\|port\\)[ \t\n]*(" nil t))
+       (end-of-line)
+       (if (not (re-search-backward "^\\s-*\\(generic\\|port\\)[ \t\n\r\f]*(" nil t))
           (error "ERROR:  Not within a generic/port clause")
         ;; search for end of clause
         (goto-char (match-end 0))
         (setq beg (1- (point)))
         (vhdl-forward-syntactic-ws)
-        (while (looking-at "\\w+\\([ \t\n]*,[ \t\n]*\\w+\\)*[ \t\n]*:[ \t\n]*\\w+[^;]*;")
+        (while (looking-at "\\w+\\([ \t\n\r\f]*,[ \t\n\r\f]*\\w+\\)*[ \t\n\r\f]*:[ \t\n\r\f]*\\w+[^;]*;")
           (goto-char (1- (match-end 0)))
           (setq end (point-marker))
           (forward-char)
@@ -8317,7 +8619,8 @@ is omitted or nil."
   (let ((margin (current-indentation))
        (start (point))
        label)
-    (unless kind (setq kind (if (vhdl-sequential-statement-p) 'is 'use)))
+    (unless kind (setq kind (if (or (vhdl-sequential-statement-p)
+                                   (not (vhdl-standard-p 'ams))) 'is 'use)))
     (if (or (not (eq vhdl-optional-labels 'all)) (vhdl-standard-p '87))
        (vhdl-insert-keyword "CASE ")
       (vhdl-insert-keyword ": CASE ")
@@ -8905,7 +9208,7 @@ otherwise."
       (vhdl-insert-keyword
        (concat " " (if (eq kind 'then) "THEN" "USE") "\n\n"))
       (indent-to margin)
-      (vhdl-insert-keyword "END IF")
+      (vhdl-insert-keyword (concat "END " (if (eq kind 'then) "IF" "USE")))
       (when label (insert " " label))
       (insert ";")
       (forward-line -1)
@@ -9226,6 +9529,7 @@ otherwise."
   (interactive)
   (let ((margin (current-indentation))
        (start (point))
+       (reset-kind vhdl-reset-kind)
        label seq input-signals clock reset final-pos)
     (setq seq (if kind (eq kind 'seq)
                (eq (vhdl-decision-query
@@ -9248,7 +9552,13 @@ otherwise."
       (setq clock (or (and (not (equal "" vhdl-clock-name))
                           (progn (insert vhdl-clock-name) vhdl-clock-name))
                      (vhdl-template-field "clock name") "<clock>"))
-      (when (eq vhdl-reset-kind 'async)
+      (when (eq reset-kind 'query)
+       (setq reset-kind
+             (if (eq (vhdl-decision-query
+                      "" "(a)synchronous or (s)ynchronous reset?" t) ?a)
+                 'async
+               'sync)))
+      (when (eq reset-kind 'async)
        (insert ", ")
        (setq reset (or (and (not (equal "" vhdl-reset-name))
                             (progn (insert vhdl-reset-name) vhdl-reset-name))
@@ -9257,7 +9567,7 @@ otherwise."
     (unless (vhdl-standard-p '87) (vhdl-insert-keyword " IS"))
     (insert "\n")
     (vhdl-template-begin-end "PROCESS" label margin)
-    (when seq (setq reset (vhdl-template-seq-process clock reset)))
+    (when seq (setq reset (vhdl-template-seq-process clock reset reset-kind)))
     (when vhdl-prompt-for-comments
       (setq final-pos (point-marker))
       (vhdl-prepare-search-2
@@ -9589,13 +9899,13 @@ otherwise."
        (in-arglist (vhdl-in-argument-list-p)))
     (vhdl-prepare-search-2
      (if (or (save-excursion
-              (and (vhdl-re-search-backward
-                    "\\<function\\|procedure\\|process\\|procedural\\|end\\>"
-                    nil t)
-                   (not (progn (backward-word 1) (looking-at "\\<end\\>")))))
+              (progn (vhdl-beginning-of-block)
+                     (looking-at "\\s-*\\(\\w+\\s-*:\\s-*\\)?\\<\\(\\<function\\|procedure\\|process\\|procedural\\)\\>")))
             (save-excursion (backward-word 1) (looking-at "\\<shared\\>")))
         (vhdl-insert-keyword "VARIABLE ")
-       (vhdl-insert-keyword "SHARED VARIABLE ")))
+       (if (vhdl-standard-p '87)
+          (error "ERROR:  Not within sequential block")
+        (vhdl-insert-keyword "SHARED VARIABLE "))))
     (when (vhdl-template-field "names" nil t start (point))
       (insert " : ")
       (when in-arglist (vhdl-template-field "[IN | OUT | INOUT]" " " t))
@@ -9692,14 +10002,16 @@ otherwise."
        (concat (if vhdl-clock-rising-edge "rising" "falling")
               " clock edge")))))
 
-(defun vhdl-template-seq-process (clock reset)
+(defun vhdl-template-seq-process (clock reset reset-kind)
   "Insert a template for the body of a sequential process."
   (let ((margin (current-indentation))
        position)
     (vhdl-insert-keyword "IF ")
-    (when (eq vhdl-reset-kind 'async)
+    (when vhdl-conditions-in-parenthesis (insert "("))
+    (when (eq reset-kind 'async)
       (insert reset " = "
              (if vhdl-reset-active-high vhdl-one-string vhdl-zero-string))
+      (when vhdl-conditions-in-parenthesis (insert ")"))
       (vhdl-insert-keyword " THEN")
       (vhdl-comment-insert-inline
        (concat "asynchronous reset (active "
@@ -9707,7 +10019,8 @@ otherwise."
       (insert "\n") (indent-to (+ margin vhdl-basic-offset))
       (setq position (point))
       (insert "\n") (indent-to margin)
-      (vhdl-insert-keyword "ELSIF "))
+      (vhdl-insert-keyword "ELSIF ")
+      (when vhdl-conditions-in-parenthesis (insert "(")))
     (if (eq vhdl-clock-edge-condition 'function)
        (insert (if vhdl-clock-rising-edge "rising" "falling")
                "_edge(" clock ")")
@@ -9715,17 +10028,20 @@ otherwise."
       (vhdl-insert-keyword " AND ")
       (insert clock " = "
              (if vhdl-clock-rising-edge vhdl-one-string vhdl-zero-string)))
+    (when vhdl-conditions-in-parenthesis (insert ")"))
     (vhdl-insert-keyword " THEN")
     (vhdl-comment-insert-inline
      (concat (if vhdl-clock-rising-edge "rising" "falling") " clock edge"))
     (insert "\n") (indent-to (+ margin vhdl-basic-offset))
-    (when (eq vhdl-reset-kind 'sync)
+    (when (eq reset-kind 'sync)
       (vhdl-insert-keyword "IF ")
+      (when vhdl-conditions-in-parenthesis (insert "("))
       (setq reset (or (and (not (equal "" vhdl-reset-name))
                           (progn (insert vhdl-reset-name) vhdl-reset-name))
                      (vhdl-template-field "reset name") "<reset>"))
       (insert " = "
              (if vhdl-reset-active-high vhdl-one-string vhdl-zero-string))
+      (when vhdl-conditions-in-parenthesis (insert ")"))
       (vhdl-insert-keyword " THEN")
       (vhdl-comment-insert-inline
        (concat "synchronous reset (active "
@@ -9737,7 +10053,7 @@ otherwise."
       (insert "\n") (indent-to (+ margin (* 2 vhdl-basic-offset)))
       (insert "\n") (indent-to (+ margin vhdl-basic-offset))
       (vhdl-insert-keyword "END IF;"))
-    (when (eq vhdl-reset-kind 'none)
+    (when (eq reset-kind 'none)
       (setq position (point)))
     (insert "\n") (indent-to margin)
     (vhdl-insert-keyword "END IF;")
@@ -9761,21 +10077,11 @@ specification, if not already there."
        (insert library ";")
        (when package
          (insert "\n")
-         (indent-to margin)))
-      (when package
-       (vhdl-insert-keyword "USE ")
-       (insert library "." package)
-       (vhdl-insert-keyword ".ALL;")))))
-
-(defun vhdl-template-package-math-complex ()
-  "Insert specification of `math_complex' package."
-  (interactive)
-  (vhdl-template-standard-package "ieee" "math_complex"))
-
-(defun vhdl-template-package-math-real ()
-  "Insert specification of `math_real' package."
-  (interactive)
-  (vhdl-template-standard-package "ieee" "math_real"))
+         (indent-to margin))))
+    (when package
+      (vhdl-insert-keyword "USE ")
+      (insert library "." package)
+      (vhdl-insert-keyword ".ALL;"))))
 
 (defun vhdl-template-package-numeric-bit ()
   "Insert specification of `numeric_bit' package."
@@ -9822,6 +10128,56 @@ specification, if not already there."
   (interactive)
   (vhdl-template-standard-package "std" "textio"))
 
+(defun vhdl-template-package-fundamental-constants ()
+  "Insert specification of `fundamental_constants' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "fundamental_constants"))
+
+(defun vhdl-template-package-material-constants ()
+  "Insert specification of `material_constants' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "material_constants"))
+
+(defun vhdl-template-package-energy-systems ()
+  "Insert specification of `energy_systems' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "energy_systems"))
+
+(defun vhdl-template-package-electrical-systems ()
+  "Insert specification of `electrical_systems' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "electrical_systems"))
+
+(defun vhdl-template-package-mechanical-systems ()
+  "Insert specification of `mechanical_systems' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "mechanical_systems"))
+
+(defun vhdl-template-package-radiant-systems ()
+  "Insert specification of `radiant_systems' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "radiant_systems"))
+
+(defun vhdl-template-package-thermal-systems ()
+  "Insert specification of `thermal_systems' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "thermal_systems"))
+
+(defun vhdl-template-package-fluidic-systems ()
+  "Insert specification of `fluidic_systems' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "fluidic_systems"))
+
+(defun vhdl-template-package-math-complex ()
+  "Insert specification of `math_complex' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "math_complex"))
+
+(defun vhdl-template-package-math-real ()
+  "Insert specification of `math_real' package."
+  (interactive)
+  (vhdl-template-standard-package "ieee" "math_real"))
+
 (defun vhdl-template-directive (directive)
   "Insert directive."
   (unless (= (current-indentation) (current-column))
@@ -9900,6 +10256,9 @@ specification, if not already there."
         (insert (user-full-name))
         (when user-mail-address (insert "  <" user-mail-address ">")))
        (goto-char beg)
+       (while (search-forward "<authorfull>" end t)
+        (replace-match (user-full-name) t t))
+       (goto-char beg)
        (while (search-forward "<login>" end t)
         (replace-match (user-login-name) t t))
        (goto-char beg)
@@ -9915,7 +10274,7 @@ specification, if not already there."
        (while (search-forward "<standard>" end t)
         (replace-match
          (concat "VHDL" (cond ((vhdl-standard-p '87) "'87")
-                              ((vhdl-standard-p '93) "'93"))
+                              ((vhdl-standard-p '93) "'93/02"))
                  (when (vhdl-standard-p 'ams) ", VHDL-AMS")
                  (when (vhdl-standard-p 'math) ", Math Packages")) t t))
        (goto-char beg)
@@ -10021,9 +10380,10 @@ If starting after end-comment-column, start a new line."
   "Displays one line of dashes."
   (interactive)
   (while (= (preceding-char) ?-) (delete-char -2))
+  (insert "--")
   (let* ((col (current-column))
         (len (- end-comment-column col)))
-    (insert-char ?- len)))
+    (insert-char vhdl-comment-display-line-char len)))
 
 (defun vhdl-comment-append-inline ()
   "Append empty inline comment to current line."
@@ -10084,7 +10444,7 @@ If starting after end-comment-column, start a new line."
     (goto-char beg)
     (beginning-of-line)
     (setq beg (point))
-    (if (looking-at comment-start)
+    (if (looking-at (concat "\\s-*" comment-start))
        (comment-region beg end '(4))
       (comment-region beg end))))
 
@@ -10119,7 +10479,7 @@ If starting after end-comment-column, start a new line."
     (goto-char beg)
     (beginning-of-line)
     (while (< (point) end)
-      (when (looking-at "^.*[^ \t\n-]+\\(\\s-*--.*\\)$")
+      (when (looking-at "^.*[^ \t\n\r\f-]+\\(\\s-*--.*\\)$")
        (delete-region (match-beginning 1) (match-end 1)))
       (beginning-of-line 2))))
 
@@ -10323,9 +10683,9 @@ if in comment and past end-comment-column."
         (self-insert-command count)
         (cond ((>= (current-column) (+ 2 end-comment-column))
                (backward-char 1)
-               (skip-chars-backward "^ \t\n")
+               (skip-chars-backward "^ \t\n\r\f")
                (indent-new-comment-line)
-               (skip-chars-forward "^ \t\n")
+               (skip-chars-forward "^ \t\n\r\f")
                (forward-char 1))
               ((>= (current-column) end-comment-column)
                (indent-new-comment-line))
@@ -10369,7 +10729,9 @@ with double-quotes is to be inserted.  DEFAULT specifies a default string."
       (vhdl-fix-case-region-1 position (point) vhdl-upper-case-attributes
                              (concat "'" vhdl-attributes-regexp))
       (vhdl-fix-case-region-1 position (point) vhdl-upper-case-enum-values
-                             vhdl-enum-values-regexp))
+                             vhdl-enum-values-regexp)
+      (vhdl-fix-case-region-1 position (point) vhdl-upper-case-constants
+                             vhdl-constants-regexp))
     (when (or (not (equal string "")) (not optional))
       (insert (or follow-string "")))
     (if (equal string "") nil string)))
@@ -10455,55 +10817,57 @@ else insert tab (used for word completion in VHDL minibuffer)."
 (defun vhdl-beginning-of-block ()
   "Move cursor to the beginning of the enclosing block."
   (let (pos)
-    (save-excursion
-      (beginning-of-line)
-      ;; search backward for block beginning or end
-      (while (or (while (and (setq pos (re-search-backward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\|record\\|units\\)\\|\\(\\w+[ \t\n]*:[ \t\n]*\\)?\\(postponed[ \t\n]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\)\\)\\>" nil t))
-                            ;; not consider subprogram declarations
-                            (or (and (match-string 5)
-                                     (save-match-data
-                                       (save-excursion
-                                         (goto-char (match-end 5))
-                                         (forward-word 1)
-                                         (vhdl-forward-syntactic-ws)
-                                         (when (looking-at "(")
-                                           (forward-sexp))
-                                         (re-search-forward "\\<is\\>\\|\\(;\\)" nil t))
-                                       (match-string 1)))
-                                ;; not consider configuration specifications
-                                (and (match-string 6)
-                                     (save-match-data
-                                       (save-excursion
-                                         (vhdl-end-of-block)
-                                         (beginning-of-line)
-                                         (not (looking-at "^\\s-*end\\s-+\\(for\\|generate\\|loop\\)\\>"))))))))
-                (match-string 2))
-       ;; skip subblock if block end found
-       (vhdl-beginning-of-block)))
+    (vhdl-prepare-search-2
+     (save-excursion
+       (beginning-of-line)
+       ;; search backward for block beginning or end
+       (while (or (while (and (setq pos (re-search-backward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
+                             ;; not consider subprogram declarations
+                             (or (and (match-string 5)
+                                      (save-match-data
+                                        (save-excursion
+                                          (goto-char (match-end 5))
+                                          (forward-word 1)
+                                          (vhdl-forward-syntactic-ws)
+                                          (when (looking-at "(")
+                                            (forward-sexp))
+                                          (re-search-forward "\\<is\\>\\|\\(;\\)" nil t))
+                                        (match-string 1)))
+                                 ;; not consider configuration specifications
+                                 (and (match-string 6)
+                                      (save-match-data
+                                        (save-excursion
+                                          (vhdl-end-of-block)
+                                          (beginning-of-line)
+                                          (not (looking-at "^\\s-*end\\s-+\\(for\\|generate\\|loop\\)\\>"))))))))
+                 (match-string 2))
+        ;; skip subblock if block end found
+        (vhdl-beginning-of-block))))
     (when pos (goto-char pos))))
 
 (defun vhdl-end-of-block ()
   "Move cursor to the end of the enclosing block."
   (let (pos)
-    (save-excursion
-      (end-of-line)
-      ;; search forward for block beginning or end
-      (while (or (while (and (setq pos (re-search-forward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\|record\\|units\\)\\|\\(\\w+[ \t\n]*:[ \t\n]*\\)?\\(postponed[ \t\n]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\)\\)\\>" nil t))
-                            ;; not consider subprogram declarations
-                            (or (and (match-string 5)
-                                     (save-match-data
-                                       (save-excursion (re-search-forward "\\<is\\>\\|\\(;\\)" nil t))
-                                       (match-string 1)))
-                                ;; not consider configuration specifications
-                                (and (match-string 6)
-                                     (save-match-data
-                                       (save-excursion
-                                         (vhdl-end-of-block)
-                                         (beginning-of-line)
-                                         (not (looking-at "^\\s-*end\\s-+\\(for\\|generate\\|loop\\)\\>"))))))))
-                (not (match-string 2)))
-       ;; skip subblock if block beginning found
-       (vhdl-end-of-block)))
+    (vhdl-prepare-search-2
+     (save-excursion
+       (end-of-line)
+       ;; search forward for block beginning or end
+       (while (or (while (and (setq pos (re-search-forward "^\\s-*\\(\\(end\\)\\|\\(\\(impure\\|pure\\)[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(for\\)\\|\\(architecture\\|component\\|configuration\\|entity\\|package\\(\\s-+body\\)?\\|type[ \t\n\r\f]+\\w+[ \t\n\r\f]+is[ \t\n\r\f]+\\(record\\|protected\\(\\s-+body\\)?\\)\\|units\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(postponed[ \t\n\r\f]+\\)?\\(block\\|case\\|for\\|if\\|procedural\\|process\\|while\\|loop\\)\\)\\>" nil t))
+                             ;; not consider subprogram declarations
+                             (or (and (match-string 5)
+                                      (save-match-data
+                                        (save-excursion (re-search-forward "\\<is\\>\\|\\(;\\)" nil t))
+                                        (match-string 1)))
+                                 ;; not consider configuration specifications
+                                 (and (match-string 6)
+                                      (save-match-data
+                                        (save-excursion
+                                          (vhdl-end-of-block)
+                                          (beginning-of-line)
+                                          (not (looking-at "^\\s-*end\\s-+\\(for\\|generate\\|loop\\)\\>"))))))))
+                 (not (match-string 2)))
+        ;; skip subblock if block beginning found
+        (vhdl-end-of-block))))
     (when pos (goto-char pos))))
 
 (defun vhdl-sequential-statement-p ()
@@ -10518,7 +10882,7 @@ else insert tab (used for word completion in VHDL minibuffer)."
                   (< start (point)))
            ;; ... a sequential block
            (progn (vhdl-beginning-of-block)
-                  (looking-at "^\\s-*\\(\\(\\w+[ \t\n]+\\)?\\(function\\|procedure\\)\\|\\(\\w+[ \t\n]*:[ \t\n]*\\)?\\(\\w+[ \t\n]+\\)?\\(procedural\\|process\\)\\)\\>")))))))
+                  (looking-at "^\\s-*\\(\\(\\w+[ \t\n\r\f]+\\)?\\(function\\|procedure\\)\\|\\(\\w+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(\\w+[ \t\n\r\f]+\\)?\\(procedural\\|process\\)\\)\\>")))))))
 
 (defun vhdl-in-argument-list-p ()
   "Check if within an argument list."
@@ -10542,7 +10906,9 @@ but not if inside a comment or quote."
       (progn
        (insert " ")
        (unexpand-abbrev)
-       (delete-char -1))
+       (backward-word 1)
+       (vhdl-case-word 1)
+       (delete-char 1))
     (if (not vhdl-electric-mode)
        (progn
          (insert " ")
@@ -10821,7 +11187,10 @@ but not if inside a comment or quote."
 (defun vhdl-parse-string (string &optional optional)
   "Check that the text following point matches the regexp in STRING."
   (if (looking-at string)
-      (goto-char (match-end 0))
+      (progn (goto-char (match-end 0))
+            (when (vhdl-in-literal)
+              (end-of-line))
+            (point))
     (unless optional
       (throw 'parse (format "ERROR:  Syntax error near line %s, expecting \"%s\""
                            (vhdl-current-line) string)))
@@ -10919,7 +11288,9 @@ reflected in a subsequent paste operation."
              port-dir (car port-dir-car))
        (setcar port-dir-car
                (cond ((equal port-dir "in") "out")
+                     ((equal port-dir "IN") "OUT")
                      ((equal port-dir "out") "in")
+                     ((equal port-dir "OUT") "IN")
                      (t port-dir)))
        (setq port-list (cdr port-list)))
       (setq vhdl-port-reversed-direction (not vhdl-port-reversed-direction))
@@ -10949,20 +11320,23 @@ reflected in a subsequent paste operation."
          (message "Reading port of %s \"%s\"..." decl-type name)
          (vhdl-forward-syntactic-ws)
          ;; parse generic clause
-         (when (vhdl-parse-string "generic[ \t\n]*(" t)
+         (when (vhdl-parse-string "generic[ \t\n\r\f]*(" t)
            ;; parse group comment and spacing
            (setq group-comment (vhdl-parse-group-comment))
-           (setq end-of-list (vhdl-parse-string ")[ \t\n]*;[ \t\n]*" t))
+           (setq end-of-list (vhdl-parse-string ")[ \t\n\r\f]*;[ \t\n\r\f]*" t))
            (while (not end-of-list)
              ;; parse names (accept extended identifiers)
-             (vhdl-parse-string "\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*")
+             (vhdl-parse-string "\\(\\\\[^\\]+\\\\\\|\\w+\\)[ \t\n\r\f]*")
              (setq names (list (match-string-no-properties 1)))
-             (while (vhdl-parse-string ",[ \t\n]*\\(\\w+\\)[ \t\n]*" t)
+             (while (vhdl-parse-string ",[ \t\n\r\f]*\\(\\\\[^\\]+\\\\\\|\\w+\\)[ \t\n\r\f]*" t)
                (setq names
                      (append names (list (match-string-no-properties 1)))))
              ;; parse type
-             (vhdl-parse-string ":[ \t\n]*\\([^():;\n]+\\)")
+             (vhdl-parse-string ":[ \t\n\r\f]*\\([^():;\n]+\\)")
              (setq type (match-string-no-properties 1))
+             (when (vhdl-in-comment-p) ; if stuck in comment
+               (setq type (concat type (and (vhdl-parse-string ".*")
+                                            (match-string-no-properties 0)))))
              (setq comment nil)
              (while (looking-at "(")
                (setq type
@@ -10980,7 +11354,7 @@ reflected in a subsequent paste operation."
              (setq type (substring type 0 (match-end 1)))
              ;; parse initialization expression
              (setq init nil)
-             (when (vhdl-parse-string ":=[ \t\n]*" t)
+             (when (vhdl-parse-string ":=[ \t\n\r\f]*" t)
                (vhdl-parse-string "\\([^();\n]*\\)")
                (setq init (match-string-no-properties 1))
                (while (looking-at "(")
@@ -11014,28 +11388,31 @@ reflected in a subsequent paste operation."
              ;; parse group comment and spacing
              (setq group-comment (vhdl-parse-group-comment))))
          ;; parse port clause
-         (when (vhdl-parse-string "port[ \t\n]*(" t)
+         (when (vhdl-parse-string "port[ \t\n\r\f]*(" t)
            ;; parse group comment and spacing
            (setq group-comment (vhdl-parse-group-comment))
-           (setq end-of-list (vhdl-parse-string ")[ \t\n]*;[ \t\n]*" t))
+           (setq end-of-list (vhdl-parse-string ")[ \t\n\r\f]*;[ \t\n\r\f]*" t))
            (while (not end-of-list)
              ;; parse object
              (setq object
-                   (and (vhdl-parse-string "\\<\\(signal\\|quantity\\|terminal\\)\\>[ \t\n]*" t)
+                   (and (vhdl-parse-string "\\<\\(signal\\|quantity\\|terminal\\)\\>[ \t\n\r\f]*" t)
                         (match-string-no-properties 1)))
              ;; parse names (accept extended identifiers)
-             (vhdl-parse-string "\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*")
+             (vhdl-parse-string "\\(\\\\[^\\]+\\\\\\|\\w+\\)[ \t\n\r\f]*")
              (setq names (list (match-string-no-properties 1)))
-             (while (vhdl-parse-string ",[ \t\n]*\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*" t)
+             (while (vhdl-parse-string ",[ \t\n\r\f]*\\(\\\\[^\\]+\\\\\\|\\w+\\)[ \t\n\r\f]*" t)
                (setq names (append names (list (match-string-no-properties 1)))))
              ;; parse direction
-             (vhdl-parse-string ":[ \t\n]*")
+             (vhdl-parse-string ":[ \t\n\r\f]*")
              (setq direct
-                   (and (vhdl-parse-string "\\<\\(in\\|out\\|inout\\|buffer\\|linkage\\)\\>[ \t\n]+" t)
+                   (and (vhdl-parse-string "\\<\\(in\\|out\\|inout\\|buffer\\|linkage\\)\\>[ \t\n\r\f]+" t)
                         (match-string-no-properties 1)))
              ;; parse type
              (vhdl-parse-string "\\([^();\n]+\\)")
              (setq type (match-string-no-properties 1))
+             (when (vhdl-in-comment-p) ; if stuck in comment
+               (setq type (concat type (and (vhdl-parse-string ".*")
+                                            (match-string-no-properties 0)))))
              (setq comment nil)
              (while (looking-at "(")
                (setq type (concat type
@@ -11313,7 +11690,7 @@ reflected in a subsequent paste operation."
          (setq port-list (cdr port-list))
          (insert (if port-list "," ");"))
          ;; paste comment
-         (when (or vhdl-include-direction-comments
+         (when (or (and vhdl-include-direction-comments (nth 2 port))
                    vhdl-include-type-comments
                    (and vhdl-include-port-comments (nth 4 port)))
            (vhdl-comment-insert-inline
@@ -11454,12 +11831,17 @@ reflected in a subsequent paste operation."
          ;; paste type
          (insert " : " (nth 3 port))
          ;; paste initialization (inputs only)
-         (when (and initialize (equal "IN" (upcase (nth 2 port))))
-           (insert " := " (if (string-match "(.+)" (nth 3 port))
-                              "(others => '0')" "'0'")))
+         (when (and initialize (nth 2 port) (equal "IN" (upcase (nth 2 port))))
+           (insert " := "
+                   (cond ((string-match "integer" (nth 3 port)) "0")
+                         ((string-match "natural" (nth 3 port)) "0")
+                         ((string-match "positive" (nth 3 port)) "0")
+                         ((string-match "real" (nth 3 port)) "0.0")
+                         ((string-match "(.+)" (nth 3 port)) "(others => '0')")
+                         (t "'0'"))))
          (insert ";")
          ;; paste comment
-         (when (or vhdl-include-direction-comments
+         (when (or (and vhdl-include-direction-comments (nth 2 port))
                    (and vhdl-include-port-comments (nth 4 port)))
            (vhdl-comment-insert-inline
             (concat
@@ -11495,8 +11877,14 @@ reflected in a subsequent paste operation."
              (setq name (car (nth 0 port)))
              (insert (vhdl-replace-string vhdl-actual-port-name name))
              ;; paste initialization
-             (insert " <= " (if (string-match "(.+)" (nth 3 port))
-                                "(others => '0')" "'0'") ";"))
+             (insert " <= "
+                     (cond ((string-match "integer" (nth 3 port)) "0")
+                           ((string-match "natural" (nth 3 port)) "0")
+                           ((string-match "positive" (nth 3 port)) "0")
+                           ((string-match "real" (nth 3 port)) "0.0")
+                           ((string-match "(.+)" (nth 3 port)) "(others => '0')")
+                           (t "'0'"))
+                     ";"))
            (setq port-list (cdr port-list))
            (when (and port-list
                       (equal "IN" (upcase (nth 2 (car port-list)))))
@@ -11609,7 +11997,9 @@ reflected in a subsequent paste operation."
       ;; paste custom declarations
       (unless (equal "" vhdl-testbench-declarations)
        (insert "\n")
-       (vhdl-insert-string-or-file vhdl-testbench-declarations))
+       (setq position (point))
+       (vhdl-insert-string-or-file vhdl-testbench-declarations)
+       (vhdl-indent-region position (point)))
       (setq position (point))
       (insert "\n\n")
       (vhdl-comment-display-line) (insert "\n")
@@ -11638,7 +12028,9 @@ reflected in a subsequent paste operation."
       ;; paste custom statements
       (unless (equal "" vhdl-testbench-statements)
        (insert "\n")
-       (vhdl-insert-string-or-file vhdl-testbench-statements))
+       (setq position (point))
+       (vhdl-insert-string-or-file vhdl-testbench-statements)
+       (vhdl-indent-region position (point)))
       (insert "\n")
       (indent-to vhdl-basic-offset)
       (unless (eq vhdl-testbench-create-files 'none)
@@ -11707,8 +12099,8 @@ reflected in a subsequent paste operation."
          ;; check if within function declaration
          (setq pos (point))
          (end-of-line)
-         (when (looking-at "[ \t\n]*\\((\\|;\\|is\\>\\)") (goto-char (match-end 0)))
-         (unless (and (re-search-backward "^\\s-*\\(\\(procedure\\)\\|\\(\\(pure\\|impure\\)\\s-+\\)?function\\)\\s-+\\(\"?\\w+\"?\\)[ \t\n]*\\(\\((\\)\\|;\\|is\\>\\)" nil t)
+         (when (looking-at "[ \t\n\r\f]*\\((\\|;\\|is\\>\\)") (goto-char (match-end 0)))
+         (unless (and (re-search-backward "^\\s-*\\(\\(procedure\\)\\|\\(\\(pure\\|impure\\)\\s-+\\)?function\\)\\s-+\\(\"?\\w+\"?\\)[ \t\n\r\f]*\\(\\((\\)\\|;\\|is\\>\\)" nil t)
                       (goto-char (match-end 0))
                       (save-excursion (backward-char)
                                    (forward-sexp)
@@ -11721,21 +12113,21 @@ reflected in a subsequent paste operation."
          ;; parse parameter list
          (setq group-comment (vhdl-parse-group-comment))
          (setq end-of-list (or end-of-list
-                               (vhdl-parse-string ")[ \t\n]*\\(;\\|\\(is\\|return\\)\\>\\)" t)))
+                               (vhdl-parse-string ")[ \t\n\r\f]*\\(;\\|\\(is\\|return\\)\\>\\)" t)))
          (while (not end-of-list)
            ;; parse object
            (setq object
-                 (and (vhdl-parse-string "\\(constant\\|signal\\|variable\\|file\\|quantity\\|terminal\\)[ \t\n]*" t)
+                 (and (vhdl-parse-string "\\(constant\\|signal\\|variable\\|file\\|quantity\\|terminal\\)[ \t\n\r\f]*" t)
                         (match-string-no-properties 1)))
            ;; parse names (accept extended identifiers)
-           (vhdl-parse-string "\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*")
+           (vhdl-parse-string "\\(\\\\[^\\]+\\\\\\|\\w+\\)[ \t\n\r\f]*")
            (setq names (list (match-string-no-properties 1)))
-           (while (vhdl-parse-string ",[ \t\n]*\\(\\w+\\|\\\\[^\\]+\\\\\\)[ \t\n]*" t)
+           (while (vhdl-parse-string ",[ \t\n\r\f]*\\(\\\\[^\\]+\\\\\\|\\w+\\)[ \t\n\r\f]*" t)
              (setq names (append names (list (match-string-no-properties 1)))))
            ;; parse direction
-           (vhdl-parse-string ":[ \t\n]*")
+           (vhdl-parse-string ":[ \t\n\r\f]*")
            (setq direct
-                 (and (vhdl-parse-string "\\(in\\|out\\|inout\\|buffer\\|linkage\\)[ \t\n]+" t)
+                 (and (vhdl-parse-string "\\(in\\|out\\|inout\\|buffer\\|linkage\\)[ \t\n\r\f]+" t)
                       (match-string-no-properties 1)))
            ;; parse type
            (vhdl-parse-string "\\([^():;\n]+\\)")
@@ -11757,7 +12149,7 @@ reflected in a subsequent paste operation."
            (setq type (substring type 0 (match-end 1)))
            ;; parse initialization expression
            (setq init nil)
-           (when (vhdl-parse-string ":=[ \t\n]*" t)
+           (when (vhdl-parse-string ":=[ \t\n\r\f]*" t)
              (vhdl-parse-string "\\([^();\n]*\\)")
              (setq init (match-string-no-properties 1))
              (while (looking-at "(")
@@ -11787,7 +12179,7 @@ reflected in a subsequent paste operation."
            (vhdl-parse-string "\\(;\\|\\(is\\|\\(return\\)\\)\\>\\)\\s-*")
            ;; parse return type
            (when (match-string 3)
-             (vhdl-parse-string "[ \t\n]*\\(.+\\)[ \t\n]*\\(;\\|is\\>\\)\\s-*")
+             (vhdl-parse-string "[ \t\n\r\f]*\\(.+\\)[ \t\n\r\f]*\\(;\\|is\\>\\)\\s-*")
              (setq return-type (match-string-no-properties 1))
              (when (and return-type
                         (string-match "\\(\\s-*--\\s-*\\)\\(.*\\)" return-type))
@@ -12015,17 +12407,15 @@ expressions (e.g. for index ranges of types and signals)."
  (defalias 'he-list-beg 'vhdl-he-list-beg))
 
 ;; function for expanding abbrevs and dabbrevs
-(defun vhdl-expand-abbrev (arg))
-(fset 'vhdl-expand-abbrev (make-hippie-expand-function
-                          '(try-expand-dabbrev
-                            try-expand-dabbrev-all-buffers
-                            vhdl-try-expand-abbrev)))
+(defalias 'vhdl-expand-abbrev (make-hippie-expand-function
+                              '(try-expand-dabbrev
+                                try-expand-dabbrev-all-buffers
+                                vhdl-try-expand-abbrev)))
 
 ;; function for expanding parenthesis
-(defun vhdl-expand-paren (arg))
-(fset 'vhdl-expand-paren (make-hippie-expand-function
-                         '(try-expand-list
-                           try-expand-list-all-buffers)))
+(defalias 'vhdl-expand-paren (make-hippie-expand-function
+                             '(try-expand-list
+                               try-expand-list-all-buffers)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;  Case fixing
@@ -12049,7 +12439,7 @@ depending on parameter UPPER-CASE."
                    (< vhdl-progress-interval
                       (- (nth 1 (current-time)) last-update)))
           (message "Fixing case... (%2d%s)"
-                   (+ (* count 25) (/ (* 25 (- (point) beg)) (- end beg)))
+                   (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg)))
                    "%")
           (setq last-update (nth 1 (current-time)))))
        (goto-char end)))))
@@ -12066,6 +12456,8 @@ options vhdl-upper-case-{keywords,types,attributes,enum-values}."
    beg end vhdl-upper-case-attributes (concat "'" vhdl-attributes-regexp) 2)
   (vhdl-fix-case-region-1
    beg end vhdl-upper-case-enum-values vhdl-enum-values-regexp 3)
+  (vhdl-fix-case-region-1
+   beg end vhdl-upper-case-constants vhdl-constants-regexp 4)
   (when vhdl-progress-interval (message "Fixing case...done")))
 
 (defun vhdl-fix-case-buffer ()
@@ -12091,6 +12483,9 @@ options vhdl-upper-case-{keywords,types,attributes,enum-values}."
        (upcase-word 1))
      (when (and vhdl-upper-case-enum-values
                (looking-at vhdl-enum-values-regexp))
+       (upcase-word 1))
+     (when (and vhdl-upper-case-constants
+               (looking-at vhdl-constants-regexp))
        (upcase-word 1)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -12205,6 +12600,9 @@ it works within comments too."
   (interactive)
   (let ((no-stats 0)
        (no-code-lines 0)
+       (no-empty-lines 0)
+       (no-comm-lines 0)
+       (no-comments 0)
        (no-lines (count-lines (point-min) (point-max))))
     (save-excursion
       ;; count statements
@@ -12218,15 +12616,40 @@ it works within comments too."
       (while (not (eobp))
        (unless (looking-at "^\\s-*\\(--.*\\)?$")
          (setq no-code-lines (1+ no-code-lines)))
-       (beginning-of-line 2)))
+       (beginning-of-line 2))
+      ;; count empty lines
+      (goto-char (point-min))
+      (while (and (re-search-forward "^\\s-*$" nil t)
+                 (not (eq (point) (point-max))))
+       (if (match-string 1)
+           (goto-char (match-end 1))
+         (setq no-empty-lines (1+ no-empty-lines))
+         (unless (eq (point) (point-max))
+           (forward-char))))
+      ;; count comment-only lines
+      (goto-char (point-min))
+      (while (re-search-forward "^\\s-*--.*" nil t)
+       (if (match-string 1)
+           (goto-char (match-end 1))
+         (setq no-comm-lines (1+ no-comm-lines))))
+      ;; count comments
+      (goto-char (point-min))
+      (while (re-search-forward "--.*" nil t)
+       (if (match-string 1)
+           (goto-char (match-end 1))
+         (setq no-comments (1+ no-comments)))))
     ;; print results
     (message "\n\
 File statistics: \"%s\"\n\
 ---------------------\n\
-# statements  : %5d\n\
-# code lines  : %5d\n\
-# total lines : %5d\n\ "
-            (buffer-file-name) no-stats no-code-lines no-lines)
+# statements    : %5d\n\
+# code lines    : %5d\n\
+# empty lines   : %5d\n\
+# comment lines : %5d\n\
+# comments      : %5d\n\
+# total lines   : %5d\n\ "
+            (buffer-file-name) no-stats no-code-lines no-empty-lines
+            no-comm-lines no-comments no-lines)
     (unless vhdl-emacs-21 (vhdl-show-messages))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -12390,18 +12813,18 @@ File statistics: \"%s\"\n\
   (concat
    "\\(^\\)\\s-*\\("
    ;; generic/port clause
-   "\\(generic\\|port\\)[ \t\n]*(\\|"
+   "\\(generic\\|port\\)[ \t\n\r\f]*(\\|"
    ;; component
    "component\\>\\|"
    ;; component instantiation
-   "\\(\\w\\|\\s_\\)+[ \t\n]*:[ \t\n]*"
-   "\\(\\(component\\|configuration\\|entity\\)[ \t\n]+\\)?"
-   "\\(\\w\\|\\s_\\)+\\([ \t\n]*(\\(\\w\\|\\s_\\)+)\\)?[ \t\n]*"
-   "\\(generic\\|port\\)[ \t\n]+map[ \t\n]*(\\|"
+   "\\(\\w\\|\\s_\\)+[ \t\n\r\f]*:[ \t\n\r\f]*"
+   "\\(\\(component\\|configuration\\|entity\\)[ \t\n\r\f]+\\)?"
+   "\\(\\w\\|\\s_\\)+\\([ \t\n\r\f]*(\\(\\w\\|\\s_\\)+)\\)?[ \t\n\r\f]*"
+   "\\(generic\\|port\\)[ \t\n\r\f]+map[ \t\n\r\f]*(\\|"
    ;; subprogram
    "\\(function\\|procedure\\)\\>\\|"
    ;; process, block
-   "\\(\\(\\w\\|\\s_\\)+[ \t\n]*:[ \t\n]*\\)?\\(process\\|block\\)\\>\\|"
+   "\\(\\(\\w\\|\\s_\\)+[ \t\n\r\f]*:[ \t\n\r\f]*\\)?\\(process\\|block\\)\\>\\|"
    ;; configuration declaration
    "configuration\\>"
    "\\)")
@@ -12414,7 +12837,7 @@ File statistics: \"%s\"\n\
      (beginning-of-line)
      (cond
       ;; generic/port clause
-      ((looking-at "^\\s-*\\(generic\\|port\\)[ \t\n]*(")
+      ((looking-at "^\\s-*\\(generic\\|port\\)[ \t\n\r\f]*(")
        (goto-char (match-end 0))
        (backward-char)
        (forward-sexp))
@@ -12424,16 +12847,16 @@ File statistics: \"%s\"\n\
       ;; component instantiation
       ((looking-at
        (concat
-        "^\\s-*\\w+\\s-*:[ \t\n]*"
-        "\\(\\(component\\|configuration\\|entity\\)[ \t\n]+\\)?"
-        "\\w+\\(\\s-*(\\w+)\\)?[ \t\n]*"
-        "\\(generic\\|port\\)\\s-+map[ \t\n]*("))
+        "^\\s-*\\w+\\s-*:[ \t\n\r\f]*"
+        "\\(\\(component\\|configuration\\|entity\\)[ \t\n\r\f]+\\)?"
+        "\\w+\\(\\s-*(\\w+)\\)?[ \t\n\r\f]*"
+        "\\(generic\\|port\\)\\s-+map[ \t\n\r\f]*("))
        (goto-char (match-end 0))
        (backward-char)
        (forward-sexp)
        (setq pos (point))
        (vhdl-forward-syntactic-ws)
-       (when (looking-at "port\\s-+map[ \t\n]*(")
+       (when (looking-at "port\\s-+map[ \t\n\r\f]*(")
         (goto-char (match-end 0))
         (backward-char)
         (forward-sexp)
@@ -12585,7 +13008,7 @@ This does highlighting of keywords and standard identifiers.")
    ;; highlight labels of common constructs
    (list
     (concat
-     "^\\s-*\\(\\w+\\)\\s-*:[ \t\n]*\\(\\("
+     "^\\s-*\\(\\w+\\)\\s-*:[ \t\n\r\f]*\\(\\("
      "assert\\|block\\|case\\|exit\\|for\\|if\\|loop\\|next\\|null\\|"
      "postponed\\|process\\|"
      (when (vhdl-standard-p 'ams) "procedural\\|")
@@ -12596,14 +13019,14 @@ This does highlighting of keywords and standard identifiers.")
    ;; highlight label and component name of component instantiations
    (list
     (concat
-     "^\\s-*\\(\\w+\\)\\s-*:[ \t\n]*\\(\\w+\\)"
-     "\\(\\s-*\\(--[^\n]*\\)?$\\|\\s-+\\(generic\\|port\\)\\s-+map\\>\\)")
+     "^\\s-*\\(\\w+\\)\\s-*:[ \t\n\r\f]*\\(\\w+\\)[ \t\n\r\f]*"
+     "\\(--[^\n]*[ \t\n\r\f]+\\)*\\(generic\\|port\\)\\s-+map\\>")
     '(1 font-lock-function-name-face) '(2 font-lock-function-name-face))
 
    ;; highlight label and instantiated unit of component instantiations
    (list
     (concat
-     "^\\s-*\\(\\w+\\)\\s-*:[ \t\n]*"
+     "^\\s-*\\(\\w+\\)\\s-*:[ \t\n\r\f]*"
      "\\(component\\|configuration\\|entity\\)\\s-+"
      "\\(\\w+\\)\\(\\.\\(\\w+\\)\\)?\\(\\s-*(\\(\\w+\\))\\)?")
     '(1 font-lock-function-name-face) '(3 font-lock-function-name-face)
@@ -12638,7 +13061,7 @@ This does highlighting of keywords and standard identifiers.")
    (list
     (concat
      "^\\s-*for\\s-+\\(\\w+\\(,\\s-*\\w+\\)*\\)\\>\\s-*"
-     "\\(:[ \t\n]*\\(\\w+\\)\\|[^i \t]\\)")
+     "\\(:[ \t\n\r\f]*\\(\\w+\\)\\|[^i \t]\\)")
     '(1 font-lock-function-name-face) '(4 font-lock-function-name-face nil t))
 
    ;; highlight names in library clauses
@@ -12662,8 +13085,8 @@ This does highlighting of keywords and standard identifiers.")
    ;; highlight type/nature name in (sub)type/(sub)nature declarations
    (list
     (concat
-     "^\\s-*\\(sub\\)?\\(nature\\|type\\)\\s-+\\(\\w+\\)")
-    3 'font-lock-type-face)
+     "^\\s-*\\(\\(sub\\)?\\(nature\\|type\\)\\|end\\s-+\\(record\\|protected\\)\\)\\s-+\\(\\w+\\)")
+    5 'font-lock-type-face)
 
    ;; highlight signal/variable/constant declaration names
    (list "\\(:[^=]\\)"
@@ -12867,6 +13290,7 @@ This does background highlighting of translate-off regions.")
         (list vhdl-functions-regexp   1 'vhdl-font-lock-function-face)
         (list vhdl-packages-regexp    1 'vhdl-font-lock-function-face)
         (list vhdl-enum-values-regexp 1 'vhdl-font-lock-enumvalue-face)
+        (list vhdl-constants-regexp   1 'font-lock-constant-face)
         (list vhdl-keywords-regexp    1 'font-lock-keyword-face)))
   ;; highlight words with special syntax.
   (setq vhdl-font-lock-keywords-3
@@ -12875,9 +13299,10 @@ This does background highlighting of translate-off regions.")
          (while syntax-alist
            (setq keywords
                  (cons
-                  (cons (concat "\\<\\(" (nth 1 (car syntax-alist)) "\\)\\>")
+                  (list (concat "\\(" (nth 1 (car syntax-alist)) "\\)") 1
                         (vhdl-function-name
-                         "vhdl-font-lock" (nth 0 (car syntax-alist)) "face"))
+                         "vhdl-font-lock" (nth 0 (car syntax-alist)) "face")
+                        (nth 4 (car syntax-alist)))
                   keywords))
            (setq syntax-alist (cdr syntax-alist)))
          keywords))
@@ -13066,7 +13491,7 @@ hierarchy otherwise.")
       (when (re-search-backward "^[ \t]*\\(architecture\\|configuration\\|entity\\|package\\)\\>" nil t)
        (while (and (re-search-backward "^[ \t]*\\(end\\|use\\)\\>" nil t)
                    (equal "USE" (upcase (match-string 1))))
-         (when (looking-at "^[ \t]*use[ \t\n]*\\(\\w+\\)\\.\\(\\w+\\)\\.\\w+")
+         (when (looking-at "^[ \t]*use[ \t\n\r\f]*\\(\\w+\\)\\.\\(\\w+\\)\\.\\w+")
            (setq lib-alist (cons (cons (match-string-no-properties 1)
                                        (vhdl-match-string-downcase 2))
                                  lib-alist))))))
@@ -13140,7 +13565,7 @@ hierarchy otherwise.")
                         (setq big-files t))
                ;; scan for entities
                (goto-char (point-min))
-               (while (re-search-forward "^[ \t]*entity[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)
+               (while (re-search-forward "^[ \t]*entity[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t)
                  (let* ((ent-name (match-string-no-properties 1))
                         (ent-key (downcase ent-name))
                         (ent-entry (aget ent-alist ent-key t))
@@ -13157,7 +13582,7 @@ hierarchy otherwise.")
                                  lib-alist)))))
                ;; scan for architectures
                (goto-char (point-min))
-               (while (re-search-forward "^[ \t]*architecture[ \t\n]+\\(\\w+\\)[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)
+               (while (re-search-forward "^[ \t]*architecture[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+of[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t)
                  (let* ((arch-name (match-string-no-properties 1))
                         (arch-key (downcase arch-name))
                         (ent-name (match-string-no-properties 2))
@@ -13183,7 +13608,7 @@ hierarchy otherwise.")
                                  arch-key (nth 5 ent-entry))))))
                ;; scan for configurations
                (goto-char (point-min))
-               (while (re-search-forward "^[ \t]*configuration[ \t\n]+\\(\\w+\\)[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)
+               (while (re-search-forward "^[ \t]*configuration[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+of[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t)
                  (let* ((conf-name (match-string-no-properties 1))
                         (conf-key (downcase conf-name))
                         (conf-entry (aget conf-alist conf-key t))
@@ -13195,7 +13620,7 @@ hierarchy otherwise.")
                         arch-key comp-conf-list inst-key-list
                         inst-comp-key inst-ent-key inst-arch-key
                         inst-conf-key inst-lib-key)
-                   (when (vhdl-re-search-forward "\\<for[ \t\n]+\\(\\w+\\)")
+                   (when (vhdl-re-search-forward "\\<for[ \t\n\r\f]+\\(\\w+\\)")
                      (setq arch-key (vhdl-match-string-downcase 1)))
                    (if conf-entry
                        (vhdl-warning-when-idle
@@ -13204,13 +13629,13 @@ hierarchy otherwise.")
                         (nth 2 conf-entry) file-name conf-line)
                      (setq conf-list (cons conf-key conf-list))
                      ;; scan for subconfigurations and subentities
-                     (while (re-search-forward "^[ \t]*for[ \t\n]+\\(\\w+\\([ \t\n]*,[ \t\n]*\\w+\\)*\\)[ \t\n]*:[ \t\n]*\\(\\w+\\)[ \t\n]+" end-of-unit t)
+                     (while (re-search-forward "^[ \t]*for[ \t\n\r\f]+\\(\\w+\\([ \t\n\r\f]*,[ \t\n\r\f]*\\w+\\)*\\)[ \t\n\r\f]*:[ \t\n\r\f]*\\(\\w+\\)[ \t\n\r\f]+" end-of-unit t)
                        (setq inst-comp-key (vhdl-match-string-downcase 3)
                              inst-key-list (split-string
                                             (vhdl-match-string-downcase 1)
-                                            "[ \t\n]*,[ \t\n]*"))
+                                            "[ \t\n\r\f]*,[ \t\n\r\f]*"))
                        (vhdl-forward-syntactic-ws)
-                       (when (looking-at "use[ \t\n]+\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\w+\\)\\.\\(\\w+\\)[ \t\n]*\\((\\(\\w+\\))\\)?")
+                       (when (looking-at "use[ \t\n\r\f]+\\(\\(entity\\)\\|configuration\\)[ \t\n\r\f]+\\(\\w+\\)\\.\\(\\w+\\)[ \t\n\r\f]*\\((\\(\\w+\\))\\)?")
                          (setq
                           inst-lib-key (vhdl-match-string-downcase 3)
                           inst-ent-key (and (match-string 2)
@@ -13232,7 +13657,7 @@ hierarchy otherwise.")
                                  arch-key comp-conf-list lib-alist)))))
                ;; scan for packages
                (goto-char (point-min))
-               (while (re-search-forward "^[ \t]*package[ \t\n]+\\(body[ \t\n]+\\)?\\(\\w+\\)[ \t\n]+is\\>" nil t)
+               (while (re-search-forward "^[ \t]*package[ \t\n\r\f]+\\(body[ \t\n\r\f]+\\)?\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t)
                  (let* ((pack-name (match-string-no-properties 2))
                         (pack-key (downcase pack-name))
                         (is-body (match-string-no-properties 1))
@@ -13250,7 +13675,7 @@ hierarchy otherwise.")
                      ;; scan for context clauses
                      (setq lib-alist (vhdl-scan-context-clause))
                      ;; scan for component and subprogram declarations/bodies
-                     (while (re-search-forward "^[ \t]*\\(component\\|function\\|procedure\\)[ \t\n]+\\(\\w+\\|\".*\"\\)" end-of-unit t)
+                     (while (re-search-forward "^[ \t]*\\(component\\|function\\|procedure\\)[ \t\n\r\f]+\\(\\w+\\|\".*\"\\)" end-of-unit t)
                        (if (equal (upcase (match-string 1)) "COMPONENT")
                            (setq comp-name (match-string-no-properties 2)
                                  comp-alist
@@ -13286,7 +13711,7 @@ hierarchy otherwise.")
                         (setq big-files t))
                ;; scan for architectures
                (goto-char (point-min))
-               (while (re-search-forward "^[ \t]*architecture[ \t\n]+\\(\\w+\\)[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)
+               (while (re-search-forward "^[ \t]*architecture[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+of[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t)
                  (let* ((ent-name (match-string-no-properties 2))
                         (ent-key (downcase ent-name))
                         (arch-name (match-string-no-properties 1))
@@ -13300,12 +13725,12 @@ hierarchy otherwise.")
                         inst-alist inst-path)
                    ;; scan for contained instantiations
                    (while (and (re-search-forward
-                                (concat "^[ \t]*\\(\\w+\\)[ \t\n]*:[ \t\n]*\\("
-                                        "\\(\\w+\\)[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*\\(generic\\|port\\)[ \t\n]+map\\>\\|"
-                                        "component[ \t\n]+\\(\\w+\\)\\|"
-                                        "\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n]*(\\(\\w+\\))\\)?\\|"
+                                (concat "^[ \t]*\\(\\w+\\)[ \t\n\r\f]*:[ \t\n\r\f]*\\("
+                                        "\\(\\w+\\)[ \t\n\r\f]+\\(--[^\n]*\n[ \t\n\r\f]*\\)*\\(generic\\|port\\)[ \t\n\r\f]+map\\>\\|"
+                                        "component[ \t\n\r\f]+\\(\\w+\\)\\|"
+                                        "\\(\\(entity\\)\\|configuration\\)[ \t\n\r\f]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n\r\f]*(\\(\\w+\\))\\)?\\|"
                                         "\\(\\(for\\|if\\)\\>[^;:]+\\<generate\\>\\|block\\>\\)\\)\\|"
-                                        "\\(^[ \t]*end[ \t\n]+\\(generate\\|block\\)\\>\\)") end-of-unit t)
+                                        "\\(^[ \t]*end[ \t\n\r\f]+\\(generate\\|block\\)\\>\\)") end-of-unit t)
                                (or (not limit-hier-inst-no)
                                    (<= (setq inst-no (1+ inst-no))
                                        limit-hier-inst-no)))
@@ -13349,8 +13774,8 @@ hierarchy otherwise.")
                    ;; scan for contained configuration specifications
                    (goto-char beg-of-unit)
                    (while (re-search-forward
-                           (concat "^[ \t]*for[ \t\n]+\\(\\w+\\([ \t\n]*,[ \t\n]*\\w+\\)*\\)[ \t\n]*:[ \t\n]*\\(\\w+\\)[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*"
-                                   "use[ \t\n]+\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n]*(\\(\\w+\\))\\)?") end-of-unit t)
+                           (concat "^[ \t]*for[ \t\n\r\f]+\\(\\w+\\([ \t\n\r\f]*,[ \t\n\r\f]*\\w+\\)*\\)[ \t\n\r\f]*:[ \t\n\r\f]*\\(\\w+\\)[ \t\n\r\f]+\\(--[^\n]*\n[ \t\n\r\f]*\\)*"
+                                   "use[ \t\n\r\f]+\\(\\(entity\\)\\|configuration\\)[ \t\n\r\f]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n\r\f]*(\\(\\w+\\))\\)?") end-of-unit t)
                      (let* ((inst-comp-name (match-string-no-properties 3))
                             (inst-ent-key
                              (and (match-string 6)
@@ -13362,7 +13787,7 @@ hierarchy otherwise.")
                             (inst-lib-key (vhdl-match-string-downcase 8))
                             (inst-key-list
                              (split-string (vhdl-match-string-downcase 1)
-                                           "[ \t\n]*,[ \t\n]*"))
+                                           "[ \t\n\r\f]*,[ \t\n\r\f]*"))
                             (tmp-inst-alist inst-alist)
                             inst-entry)
                        (while tmp-inst-alist
@@ -15347,7 +15772,7 @@ expansion function)."
              (read-from-minibuffer "architecture name: "
                                    nil vhdl-minibuffer-local-map)
            (vhdl-replace-string vhdl-compose-architecture-name ent-name)))
-        ent-file-name arch-file-name ent-buffer arch-buffer project)
+        ent-file-name arch-file-name ent-buffer arch-buffer project end-pos)
     (message "Creating component \"%s(%s)\"..." ent-name arch-name)
     ;; open entity file
     (unless (eq vhdl-compose-create-files 'none)
@@ -15364,6 +15789,7 @@ expansion function)."
     ;; insert header
     (if vhdl-compose-include-header
        (progn (vhdl-template-header)
+              (setq end-pos (point))
               (goto-char (point-max)))
       (vhdl-comment-display-line) (insert "\n\n"))
     ;; insert library clause
@@ -15390,6 +15816,7 @@ expansion function)."
     ;; open architecture file
     (if (not (eq vhdl-compose-create-files 'separate))
        (insert "\n")
+      (goto-char (or end-pos (point-min)))
       (setq ent-buffer (current-buffer))
       (setq arch-file-name
            (concat (vhdl-replace-string vhdl-architecture-file-name
@@ -15434,7 +15861,7 @@ expansion function)."
     (if (and vhdl-compose-include-header (not (equal vhdl-file-footer "")))
        (vhdl-template-footer)
       (vhdl-comment-display-line) (insert "\n"))
-    (goto-char (point-min))
+    (goto-char (or end-pos (point-min)))
     (setq arch-buffer (current-buffer))
     (when ent-buffer (set-buffer ent-buffer) (save-buffer))
     (set-buffer arch-buffer) (save-buffer)
@@ -15453,8 +15880,8 @@ component instantiation."
       (error "ERROR:  No port has been read")
     (save-excursion
       (vhdl-prepare-search-2
-       (unless (or (re-search-backward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)
-                  (re-search-forward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t))
+       (unless (or (re-search-backward "^architecture[ \t\n\r\f]+\\w+[ \t\n\r\f]+of[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t)
+                  (re-search-forward "^architecture[ \t\n\r\f]+\\w+[ \t\n\r\f]+of[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t))
         (error "ERROR:  No architecture found"))
        (let* ((ent-name (match-string 1))
              (ent-file-name
@@ -15471,13 +15898,13 @@ component instantiation."
                                (car vhdl-port-list) "\\>") nil t)))
           (re-search-forward "^begin\\>" nil)
           (beginning-of-line)
-          (skip-chars-backward " \t\n")
+          (skip-chars-backward " \t\n\r\f")
           (insert "\n\n") (indent-to vhdl-basic-offset)
           (vhdl-port-paste-component t))
         ;; place component instantiation
         (re-search-forward "^end\\>" nil)
         (beginning-of-line)
-        (skip-chars-backward " \t\n")
+        (skip-chars-backward " \t\n\r\f")
         (insert "\n\n") (indent-to vhdl-basic-offset)
         (vhdl-port-paste-instance nil t t)
         ;; place use clause for used packages
@@ -15486,7 +15913,7 @@ component instantiation."
           (when (file-exists-p ent-file-name)
             (find-file ent-file-name))
           (goto-char (point-min))
-          (unless (re-search-forward (concat "^entity[ \t\n]+" ent-name "[ \t\n]+is\\>") nil t)
+          (unless (re-search-forward (concat "^entity[ \t\n\r\f]+" ent-name "[ \t\n\r\f]+is\\>") nil t)
             (error "ERROR:  Entity not found: \"%s\"" ent-name))
           (goto-char (match-beginning 0))
           (if (and (save-excursion
@@ -15505,8 +15932,8 @@ component instantiation."
   (interactive)
   (save-excursion
     (vhdl-prepare-search-2
-     (unless (or (re-search-backward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t)
-                (re-search-forward "^architecture[ \t\n]+\\w+[ \t\n]+of[ \t\n]+\\(\\w+\\)[ \t\n]+is\\>" nil t))
+     (unless (or (re-search-backward "^architecture[ \t\n\r\f]+\\w+[ \t\n\r\f]+of[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t)
+                (re-search-forward "^architecture[ \t\n\r\f]+\\w+[ \t\n\r\f]+of[ \t\n\r\f]+\\(\\w+\\)[ \t\n\r\f]+is\\>" nil t))
        (error "ERROR:  No architecture found"))
      (let* ((ent-name (match-string 1))
            (ent-file-name
@@ -15532,11 +15959,11 @@ component instantiation."
        ;; process all instances
        (goto-char arch-stat-pos)
        (while (re-search-forward
-              (concat "^[ \t]*\\(\\w+\\)[ \t\n]*:[ \t\n]*\\("
-                      "\\(component[ \t\n]+\\)?\\(\\w+\\)"
-                      "[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*\\(\\(generic\\)\\|port\\)[ \t\n]+map\\|"
-                      "\\(\\(entity\\)\\|configuration\\)[ \t\n]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n]*(\\(\\w+\\))\\)?"
-                      "[ \t\n]+\\(--[^\n]*\n[ \t\n]*\\)*\\(\\(generic\\)\\|port\\)[ \t\n]+map\\)[ \t\n]*(") arch-end-pos t)
+              (concat "^[ \t]*\\(\\w+\\)[ \t\n\r\f]*:[ \t\n\r\f]*\\("
+                      "\\(component[ \t\n\r\f]+\\)?\\(\\w+\\)"
+                      "[ \t\n\r\f]+\\(--[^\n]*\n[ \t\n\r\f]*\\)*\\(\\(generic\\)\\|port\\)[ \t\n\r\f]+map\\|"
+                      "\\(\\(entity\\)\\|configuration\\)[ \t\n\r\f]+\\(\\(\\w+\\)\\.\\)?\\(\\w+\\)\\([ \t\n\r\f]*(\\(\\w+\\))\\)?"
+                      "[ \t\n\r\f]+\\(--[^\n]*\n[ \t\n\r\f]*\\)*\\(\\(generic\\)\\|port\\)[ \t\n\r\f]+map\\)[ \t\n\r\f]*(") arch-end-pos t)
         (setq inst-name (match-string-no-properties 1)
               comp-name (match-string-no-properties 4)
               comp-ent-name (match-string-no-properties 12)
@@ -15548,7 +15975,7 @@ component instantiation."
              (when vhdl-use-components-package pack-file-name) t
              (save-excursion
                (goto-char (point-min))
-               (unless (re-search-forward (concat "^\\s-*component[ \t\n]+" comp-name "\\>") nil t)
+               (unless (re-search-forward (concat "^\\s-*component[ \t\n\r\f]+" comp-name "\\>") nil t)
                  (error "ERROR:  Component declaration not found: \"%s\"" comp-name))
                (vhdl-port-copy)))
           ;; ... from entity declaration (direct instantiation)
@@ -15559,7 +15986,7 @@ component instantiation."
            comp-ent-file-name t
            (save-excursion
              (goto-char (point-min))
-             (unless (re-search-forward (concat "^\\s-*entity[ \t\n]+" comp-ent-name "\\>") nil t)
+             (unless (re-search-forward (concat "^\\s-*entity[ \t\n\r\f]+" comp-ent-name "\\>") nil t)
                (error "ERROR:  Entity declaration not found: \"%s\"" comp-ent-name))
              (vhdl-port-copy))))
         (vhdl-port-flatten t)
@@ -15571,7 +15998,7 @@ component instantiation."
         (when has-generic
           ;; process all constants in generic map
           (vhdl-forward-syntactic-ws)
-          (while (vhdl-parse-string "\\(\\(\\w+\\)[ \t\n]*=>[ \t\n]*\\)?\\(\\w+\\),?" t)
+          (while (vhdl-parse-string "\\(\\(\\w+\\)[ \t\n\r\f]*=>[ \t\n\r\f]*\\)?\\(\\w+\\),?" t)
             (setq constant-name (match-string-no-properties 3))
             (setq constant-entry
                   (cons constant-name
@@ -15589,10 +16016,10 @@ component instantiation."
             (unless (match-string 1)
               (setq generic-alist (cdr generic-alist)))
             (vhdl-forward-syntactic-ws))
-          (vhdl-re-search-forward "\\<port\\s-+map[ \t\n]*(" nil t))
+          (vhdl-re-search-forward "\\<port\\s-+map[ \t\n\r\f]*(" nil t))
         ;; process all signals in port map
         (vhdl-forward-syntactic-ws)
-        (while (vhdl-parse-string "\\(\\(\\w+\\)[ \t\n]*=>[ \t\n]*\\)?\\(\\w+\\),?" t)
+        (while (vhdl-parse-string "\\(\\(\\w+\\)[ \t\n\r\f]*=>[ \t\n\r\f]*\\)?\\(\\w+\\),?" t)
           (setq signal-name (match-string-no-properties 3))
           (setq signal-entry (cons signal-name
                                    (if (match-string 1)
@@ -15638,7 +16065,7 @@ component instantiation."
        ;; prepare signal insertion
        (vhdl-goto-marker arch-decl-pos)
        (forward-line 1)
-       (re-search-forward "^\\s-*-- Internal signal declarations[ \t\n]*-*\n" arch-stat-pos t)
+       (re-search-forward "^\\s-*-- Internal signal declarations[ \t\n\r\f]*-*\n" arch-stat-pos t)
        (setq signal-pos (point-marker))
        (while (progn (vhdl-forward-syntactic-ws)
                     (looking-at "signal\\>"))
@@ -15649,10 +16076,10 @@ component instantiation."
        (when (file-exists-p ent-file-name)
         (find-file ent-file-name))
        (goto-char (point-min))
-       (unless (re-search-forward (concat "^entity[ \t\n]+" ent-name "[ \t\n]+is\\>") nil t)
+       (unless (re-search-forward (concat "^entity[ \t\n\r\f]+" ent-name "[ \t\n\r\f]+is\\>") nil t)
         (error "ERROR:  Entity not found: \"%s\"" ent-name))
        ;; prepare generic clause insertion
-       (unless (and (re-search-forward "\\(^\\s-*generic[ \t\n]*(\\)\\|^end\\>" nil t)
+       (unless (and (re-search-forward "\\(^\\s-*generic[ \t\n\r\f]*(\\)\\|^end\\>" nil t)
                    (match-string 1))
         (goto-char (match-beginning 0))
         (indent-to vhdl-basic-offset)
@@ -15670,7 +16097,7 @@ component instantiation."
        (setq generic-beg-pos (point-marker) generic-pos (point-marker)
             generic-inst-pos (point-marker) generic-end-pos (point-marker))
        ;; prepare port clause insertion
-       (unless (and (re-search-forward "\\(^\\s-*port[ \t\n]*(\\)\\|^end\\>" nil t)
+       (unless (and (re-search-forward "\\(^\\s-*port[ \t\n\r\f]*(\\)\\|^end\\>" nil t)
                    (match-string 1))
         (goto-char (match-beginning 0))
         (indent-to vhdl-basic-offset)
@@ -15894,7 +16321,8 @@ current project/directory."
     (message "Generating components package \"%s\"...done\n  File created: \"%s\""
             pack-name pack-file-name)))
 
-(defun vhdl-compose-configuration-architecture (ent-name arch-name inst-alist
+(defun vhdl-compose-configuration-architecture (ent-name arch-name ent-alist
+                                                        conf-alist inst-alist
                                                         &optional insert-conf)
   "Generate block configuration for architecture."
   (let ((margin (current-indentation))
@@ -15970,7 +16398,7 @@ current project/directory."
                       (nth 3 ent-entry))
              (indent-to (+ margin vhdl-basic-offset))
              (vhdl-compose-configuration-architecture
-              (nth 0 ent-entry) arch-name
+              (nth 0 ent-entry) arch-name ent-alist conf-alist
               (nth 3 (aget (nth 3 ent-entry) (downcase arch-name) t))))))
        ;; insert component configuration end
        (indent-to margin)
@@ -16052,7 +16480,8 @@ current project/directory."
      (vhdl-insert-keyword " IS\n")
      (indent-to vhdl-basic-offset)
      ;; insert block configuration (for architecture)
-     (vhdl-compose-configuration-architecture ent-name arch-name inst-alist t)
+     (vhdl-compose-configuration-architecture
+      ent-name arch-name ent-alist conf-alist inst-alist t)
      (vhdl-insert-keyword "END ") (insert conf-name ";")
      (when conf-file-name
        ;; insert footer and save
@@ -16072,6 +16501,9 @@ current project/directory."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; (using `compile.el')
 
+(defvar vhdl-compile-post-command ""
+  "String appended to compile command after file name.")
+
 (defun vhdl-makefile-name ()
   "Return the Makefile name of the current project or the current compiler if
 no project is defined."
@@ -16226,9 +16658,11 @@ do not print any file names."
         (compiler (or (aget vhdl-compiler-alist vhdl-compiler nil)
                       (error "ERROR:  No such compiler: \"%s\"" vhdl-compiler)))
         (command (nth 0 compiler))
-        (file-name (buffer-file-name))
-        (options (vhdl-get-compile-options project compiler file-name))
         (default-directory (vhdl-compile-directory))
+        (file-name (if vhdl-compile-absolute-path
+                       (buffer-file-name)
+                     (file-relative-name (buffer-file-name))))
+        (options (vhdl-get-compile-options project compiler file-name))
         compilation-process-setup-function)
     (unless (file-directory-p default-directory)
       (error "ERROR:  Compile directory does not exist: \"%s\"" default-directory))
@@ -16236,14 +16670,18 @@ do not print any file names."
     (when (string-match " " file-name)
       (setq file-name (concat "\"" file-name "\"")))
     ;; print out file name if compiler does not
-    (setq vhdl-compile-file-name (buffer-file-name))
+    (setq vhdl-compile-file-name (if vhdl-compile-absolute-path
+                                    (buffer-file-name)
+                                  (file-relative-name (buffer-file-name))))
     (when (and (= 0 (nth 1 (nth 10 compiler)))
               (= 0 (nth 1 (nth 11 compiler))))
       (setq compilation-process-setup-function 'vhdl-compile-print-file-name))
     ;; run compilation
     (if options
        (when command
-         (compile (concat command " " options " " file-name)))
+         (compile (concat command " " options " " file-name
+                          (unless (equal vhdl-compile-post-command "")
+                            (concat " " vhdl-compile-post-command)))))
       (vhdl-warning "Your project settings tell me not to compile this file"))))
 
 (defvar vhdl-make-target "all"
@@ -16551,6 +16989,8 @@ specified by a target."
       (insert "\n\n# Define compilation command and options\n"
              "\nCOMPILE = " (nth 0 compiler)
              "\nOPTIONS = " (vhdl-get-compile-options project compiler nil)
+             (if (equal vhdl-compile-post-command "") ""
+               (concat "\nPOST-COMPILE = " vhdl-compile-post-command))
              "\n")
       ;; insert library paths
       (setq library-directory
@@ -16580,16 +17020,16 @@ specified by a target."
       (setq unit-list tmp-list)
       ;; insert `make all' rule
       (insert "\n\n\n# Rule for compiling entire design\n"
-             "\nall :"
-             " \\\n\t\tlibrary"
+             "\n" (nth 0 vhdl-makefile-default-targets) " :"
+             " \\\n\t\t" (nth 2 vhdl-makefile-default-targets)
              " \\\n\t\t$(ALL_UNITS)\n")
       ;; insert `make clean' rule
       (insert "\n\n# Rule for cleaning entire design\n"
-             "\nclean : "
+             "\n" (nth 1 vhdl-makefile-default-targets) " : "
              "\n\t-rm -f $(ALL_UNITS)\n")
       ;; insert `make library' rule
       (insert "\n\n# Rule for creating library directory\n"
-             "\nlibrary :"
+             "\n" (nth 2 vhdl-makefile-default-targets) " :"
              " \\\n\t\t$(LIBRARY-" work-library ")\n"
              "\n$(LIBRARY-" work-library ") :"
              "\n\t"
@@ -16597,6 +17037,11 @@ specified by a target."
               (cons "\\(.*\\)\n\\(.*\\)" (nth 5 compiler))
               (concat "$(LIBRARY-" work-library ")\n" (vhdl-work-library)))
              "\n")
+      ;; insert '.PHONY' declaration
+      (insert "\n\n.PHONY : "
+             (nth 0 vhdl-makefile-default-targets) " "
+             (nth 1 vhdl-makefile-default-targets) " "
+             (nth 2 vhdl-makefile-default-targets) "\n")
       ;; insert rule for each library unit
       (insert "\n\n# Rules for compiling single library units and their subhierarchy\n")
       (while prim-list
@@ -16611,7 +17056,7 @@ specified by a target."
        (unless (equal unit-key unit-name)
          (insert " \\\n" unit-name))
        (insert " :"
-               " \\\n\t\tlibrary"
+               " \\\n\t\t" (nth 2 vhdl-makefile-default-targets)
                " \\\n\t\t$(UNIT-" work-library "-" unit-key ")")
        (while second-list
          (insert " \\\n\t\t$(UNIT-" work-library "-" (car second-list) ")")
@@ -16653,7 +17098,9 @@ specified by a target."
        (if options
            (insert "\n\t$(COMPILE) "
                    (if (eq options 'default) "$(OPTIONS)" options) " "
-                   (nth 0 rule) "\n")
+                   (nth 0 rule)
+                   (if (equal vhdl-compile-post-command "") ""
+                     " $(POST-COMPILE)") "\n")
          (setq tmp-list target-list)
          (while target-list
            (insert "\n\t@touch $(UNIT-" work-library "-" (car target-list) ")"
@@ -16712,6 +17159,7 @@ specified by a target."
        'vhdl-compiler-alist
        'vhdl-compiler
        'vhdl-compile-use-local-error-regexp
+       'vhdl-makefile-default-targets
        'vhdl-makefile-generation-hook
        'vhdl-default-library
        'vhdl-standard
@@ -16722,6 +17170,7 @@ specified by a target."
        'vhdl-upper-case-enum-values
        'vhdl-upper-case-constants
        'vhdl-use-direct-instantiation
+       'vhdl-array-index-record-field-in-sensitivity-list
        'vhdl-compose-configuration-name
        'vhdl-entity-file-name
        'vhdl-architecture-file-name
@@ -16812,6 +17261,7 @@ specified by a target."
        'vhdl-print-customize-faces
        'vhdl-intelligent-tab
        'vhdl-indent-syntax-based
+       'vhdl-indent-comment-like-next-code-line
        'vhdl-word-completion-case-sensitive
        'vhdl-word-completion-in-minibuffer
        'vhdl-underscore-is-part-of-word
@@ -16851,6 +17301,17 @@ CONFIGURATION DECLARATION GENERATION:
     (See documentation (`C-c C-h') in section on STRUCTURAL COMPOSITION.)
 
 
+Key Bindings
+------------
+
+For Emacs compliance the following key bindings have been changed:
+
+- `C-c c'        ->  `C-c C-c'      `vhdl-comment-uncomment-region'
+- `C-c f'        ->  `C-c C-i C-f'  `vhdl-fontify-buffer'
+- `C-c s'        ->  `C-c C-i C-s'  `vhdl-statistics-buffer'
+- `C-c C-c ...'  ->  `C-c C-m ...'  `vhdl-compose-...'
+
+
 User Options
 ------------
 
@@ -16864,6 +17325,12 @@ User Options
   Specify whether hierarchical configurations should be created.
 `vhdl-compose-configuration-use-subconfiguration': (new)
   Specify whether subconfigurations should be used inside configurations.
+`vhdl-makefile-default-targets': (new)
+  Customize names of Makefile default targets.
+`vhdl-indent-comment-like-next-code-line': (new)
+  Specify whether comment lines are indented like following code line.
+`vhdl-array-index-record-field-in-sensitivity-list': (new)
+  Specify whether to include array indices / record fields in sensitivity list.
 ")
 
 
@@ -16872,19 +17339,20 @@ User Options
 Reserved words in VHDL
 ----------------------
 
-VHDL'93 (IEEE Std 1076-1993):
-  `vhdl-93-keywords'      : keywords
-  `vhdl-93-types'         : standardized types
-  `vhdl-93-attributes'    : standardized attributes
-  `vhdl-93-enum-values'   : standardized enumeration values
-  `vhdl-93-functions'     : standardized functions
-  `vhdl-93-packages'      : standardized packages and libraries
+VHDL'93/02 (IEEE Std 1076-1993/2002):
+  `vhdl-02-keywords'      : keywords
+  `vhdl-02-types'         : standardized types
+  `vhdl-02-attributes'    : standardized attributes
+  `vhdl-02-enum-values'   : standardized enumeration values
+  `vhdl-02-functions'     : standardized functions
+  `vhdl-02-packages'      : standardized packages and libraries
 
-VHDL-AMS (IEEE Std 1076.1):
+VHDL-AMS (IEEE Std 1076.1 / 1076.1.1):
   `vhdl-ams-keywords'     : keywords
   `vhdl-ams-types'        : standardized types
   `vhdl-ams-attributes'   : standardized attributes
   `vhdl-ams-enum-values'  : standardized enumeration values
+  `vhdl-ams-constants'    : standardized constants
   `vhdl-ams-functions'    : standardized functions
 
 Math Packages (IEEE Std 1076.2):
index 330e672ce428944ff17f41b2465f4f80cac47387..02948b35fe0e84ca4d21bfbffdd9fc44c7cae8e7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; which-func.el --- print current function in mode line
 
-;; Copyright (C) 1994, 1997-1998, 2001-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1997-1998, 2001-2012 Free Software Foundation, Inc.
 
 ;; Author:   Alex Rezinsky <alexr@msil.sps.mot.com>
 ;;           (doesn't seem to be responsive any more)
   "String to display in the mode line when current function is unknown.")
 
 (defgroup which-func nil
-  "Mode to display the current function name in the modeline."
+  "Display the current function name in the mode line."
   :group 'tools
   :version "20.3")
 
-(defcustom which-func-modes
-  '(emacs-lisp-mode c-mode c++-mode perl-mode cperl-mode python-mode
-                   makefile-mode sh-mode fortran-mode f90-mode ada-mode
-                   diff-mode)
+(defcustom which-func-modes t
+  ;; '(emacs-lisp-mode c-mode c++-mode objc-mode perl-mode cperl-mode python-mode
+  ;;               makefile-mode sh-mode fortran-mode f90-mode ada-mode
+  ;;               diff-mode)
   "List of major modes for which Which Function mode should be used.
 For other modes it is disabled.  If this is equal to t,
 then Which Function mode is enabled in any major mode that supports it."
   :group 'which-func
+  :version "24.2"                       ; explicit list -> t
   :type '(choice (const :tag "All modes" t)
                 (repeat (symbol :tag "Major mode"))))
 
@@ -163,7 +164,7 @@ single string, the new name of the item.")
 (defvar which-func-cleanup-function nil
   "Function to transform a string before displaying it in the mode line.
 The function is called with one argument, the string to display.
-Its return value is displayed in the modeline.
+Its return value is displayed in the mode line.
 If nil, no function is called.  The default value is nil.
 
 This feature can be useful if Imenu is set up to make more
@@ -209,7 +210,8 @@ It creates the Imenu index for the buffer, if necessary."
          (setq imenu--index-alist
                (save-excursion (funcall imenu-create-index-function))))
     (error
-     (unless (equal err '(error "This buffer cannot use `imenu-default-create-index-function'"))
+     (unless (equal err
+                    '(user-error "This buffer cannot use `imenu-default-create-index-function'"))
        (message "which-func-ff-hook error: %S" err))
      (setq which-func-mode nil))))
 
@@ -336,6 +338,22 @@ If no function name is found, return nil."
          (funcall which-func-cleanup-function name)
        name))))
 
+\f
+;;; Integration with other packages
+
+(defun which-func-update-ediff-windows ()
+  "Update Which-Function mode display for Ediff windows.
+This function is meant to be called from `ediff-select-hook'."
+  (when (eq major-mode 'ediff-mode)
+    (when ediff-window-A
+      (which-func-update-1 ediff-window-A))
+    (when ediff-window-B
+      (which-func-update-1 ediff-window-B))
+    (when ediff-window-C
+      (which-func-update-1 ediff-window-C))))
+
+(add-hook 'ediff-select-hook 'which-func-update-ediff-windows)
+
 (provide 'which-func)
 
 ;;; which-func.el ends here
index 1f50910330cc87e4559eb08d4d25adda62b2e28a..52ebdfbdcdf4d4630863bee482ec21783c785ac3 100644 (file)
@@ -48,7 +48,7 @@
   "Name of xscheme buffer that we're currently interacting with.")
 
 (defvar xscheme-expressions-ring-max 30
-  "*Maximum length of Scheme expressions ring.")
+  "Maximum length of Scheme expressions ring.")
 
 (defvar xscheme-expressions-ring nil
   "List of expressions recently transmitted to the Scheme process.")
@@ -74,7 +74,7 @@ by the scheme process, so additional control-g's are to be ignored.")
 
 (defconst default-xscheme-runlight
   '(": " xscheme-runlight-string)
-  "Default global (shared) xscheme-runlight modeline format.")
+  "Default global (shared) xscheme-runlight mode line format.")
 
 (defvar xscheme-runlight "")
 (defvar xscheme-runlight-string nil)
@@ -116,12 +116,12 @@ from being inserted into the process-buffer.")
   :group 'lisp)
 
 (defcustom scheme-band-name nil
-  "*Band loaded by the `run-scheme' command."
+  "Band loaded by the `run-scheme' command."
   :type '(choice (const nil) string)
   :group 'xscheme)
 
 (defcustom scheme-program-arguments nil
-  "*Arguments passed to the Scheme program by the `run-scheme' command."
+  "Arguments passed to the Scheme program by the `run-scheme' command."
   :type '(choice (const nil) string)
   :group 'xscheme)
 
@@ -326,7 +326,7 @@ buffer is not visible at that time, the value will also be displayed
 in the minibuffer.  If an error occurs, the process buffer will
 automatically pop up to show you the error message.
 
-While the Scheme process is running, the modelines of all buffers in
+While the Scheme process is running, the mode lines of all buffers in
 scheme-mode are modified to show the state of the process.  The
 possible states and their meanings are:
 
@@ -334,7 +334,7 @@ input               waiting for input
 run            evaluating
 gc             garbage collecting
 
-The process buffer's modeline contains additional information where
+The process buffer's mode line contains additional information where
 the buffer's name is normally displayed: the command interpreter level
 and type.
 
@@ -404,7 +404,7 @@ with no args, if that value is non-nil.
                         (cons (process-filter process)
                               (process-sentinel process)))
                  (xscheme-process-filter-initialize t)
-                 (xscheme-modeline-initialize xscheme-buffer-name)
+                 (xscheme-mode-line-initialize xscheme-buffer-name)
                  (set-process-sentinel process 'xscheme-process-sentinel)
                  (set-process-filter process 'xscheme-process-filter))
                 (setq xscheme-previous-process-state (cons nil nil)))))))
@@ -817,7 +817,7 @@ Control returns to the top level rep loop."
                            xscheme-buffer-name)
                   (set-marker (process-mark process) (point-max))
                   (xscheme-process-filter-initialize t)
-                  (xscheme-modeline-initialize xscheme-buffer-name)
+                  (xscheme-mode-line-initialize xscheme-buffer-name)
                   (set-process-sentinel process 'xscheme-process-sentinel)
                   (set-process-filter process 'xscheme-process-filter)
                   (run-hooks 'xscheme-start-hook)))))
@@ -951,7 +951,7 @@ the remaining input.")
   (if running-p
       (let ((name (buffer-name (current-buffer))))
        (setq scheme-mode-line-process '(": " xscheme-runlight-string))
-       (xscheme-modeline-initialize name)
+       (xscheme-mode-line-initialize name)
        (if (equal name (default-value 'xscheme-buffer-name))
            (setq-default xscheme-runlight default-xscheme-runlight))))
   (if (or (eq xscheme-runlight default-xscheme-runlight)
@@ -1059,7 +1059,7 @@ the remaining input.")
     (set-buffer (process-buffer process))
     (goto-char (process-mark process))))
 
-(defun xscheme-modeline-initialize (name)
+(defun xscheme-mode-line-initialize (name)
   (setq xscheme-runlight-string "")
   (if (equal name (default-value 'xscheme-buffer-name))
       (setq-default xscheme-runlight-string ""))
index f719b087277a08b2a5c47f0484f20f2fe8a0376a..5e7fbb2ca9a68fd183cc2f1064fa11ca722196ff 100644 (file)
 ;; * CUPS has enabled the option "Share published printers connected
 ;;   to this system" (see <http://localhost:631/admin>).
 
-(eval-when-compile
-  (require 'cl))
 
 (require 'printing)
 (require 'zeroconf)
index 8b0b36cdddc9bd9a8f23946f02acd83332ddc8e2..636110f41de0f3deed3f32fb9700f755c899f334 100644 (file)
@@ -1061,6 +1061,8 @@ Go to the beginning of buffer if not found."
   (let ((km (copy-keymap recentf--shortcuts-keymap)))
     (set-keymap-parent km widget-keymap)
     (define-key km "q" 'recentf-cancel-dialog)
+    (define-key km "n" 'next-line)
+    (define-key km "p" 'previous-line)
     (define-key km [follow-link] "\C-m")
     km)
   "Keymap used in recentf dialogs.")
index 574d96a8c102b9883a9a6700d382d7c28cc3b127..1bf7364e20d4159d4f6f4e01ab60cc135fd6622c 100644 (file)
 ;; ### NOTE: this file was almost completely rewritten by Didier Verna
 ;; <didier@xemacs.org> in July 1999.
 
-;;; Global key bindings
-
-;;;###autoload (define-key ctl-x-r-map "c" 'clear-rectangle)
-;;;###autoload (define-key ctl-x-r-map "k" 'kill-rectangle)
-;;;###autoload (define-key ctl-x-r-map "d" 'delete-rectangle)
-;;;###autoload (define-key ctl-x-r-map "y" 'yank-rectangle)
-;;;###autoload (define-key ctl-x-r-map "o" 'open-rectangle)
-;;;###autoload (define-key ctl-x-r-map "t" 'string-rectangle)
-;;;###autoload (define-key ctl-x-r-map "N" 'rectangle-number-lines)
-
 ;;; Code:
 
 ;; FIXME: this function should be replaced by `apply-on-rectangle'
@@ -235,6 +225,13 @@ even beep.)"
        (barf-if-buffer-read-only)
        (signal 'text-read-only (list (current-buffer)))))))
 
+;;;###autoload
+(defun copy-rectangle-as-kill (start end)
+  "Copy the region-rectangle and save it as the last killed one."
+  (interactive "r")
+  (setq killed-rectangle (extract-rectangle start end))
+  (setq deactivate-mark t))
+
 ;;;###autoload
 (defun yank-rectangle ()
   "Yank the last killed rectangle with upper left corner at point."
index 44f15e4a69c0cdbd35b285ab6b6f9425f8147ec3..52c236e49be96da1c1ea86b2c77c376619060112 100644 (file)
 ;; pieces of buffer state to named variables.  The entry points are
 ;; documented in the Emacs user's manual.
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (declare-function semantic-insert-foreign-tag "semantic/tag" (foreign-tag))
 (declare-function semantic-tag-buffer "semantic/tag" (tag))
 (declare-function semantic-tag-start "semantic/tag" (tag))
 
-;;; Global key bindings
-
-(define-key ctl-x-r-map "\C-@" 'point-to-register)
-(define-key ctl-x-r-map [?\C-\ ] 'point-to-register)
-(define-key ctl-x-r-map " " 'point-to-register)
-(define-key ctl-x-r-map "j" 'jump-to-register)
-(define-key ctl-x-r-map "s" 'copy-to-register)
-(define-key ctl-x-r-map "x" 'copy-to-register)
-(define-key ctl-x-r-map "i" 'insert-register)
-(define-key ctl-x-r-map "g" 'insert-register)
-(define-key ctl-x-r-map "r" 'copy-rectangle-to-register)
-(define-key ctl-x-r-map "n" 'number-to-register)
-(define-key ctl-x-r-map "+" 'increment-register)
-(define-key ctl-x-r-map "w" 'window-configuration-to-register)
-(define-key ctl-x-r-map "f" 'frame-configuration-to-register)
-
 ;;; Code:
 
-(defstruct
+(cl-defstruct
   (registerv (:constructor nil)
             (:constructor registerv--make (&optional data print-func
                                                      jump-func insert-func))
@@ -64,7 +48,7 @@
   (jump-func   nil :read-only t)
   (insert-func nil :read-only t))
 
-(defun* registerv-make (data &key print-func jump-func insert-func)
+(cl-defun registerv-make (data &key print-func jump-func insert-func)
   "Create a register value object.
 
 DATA can be any value.
@@ -150,7 +134,7 @@ delete any existing frames that the frame configuration doesn't mention.
   (let ((val (get-register register)))
     (cond
      ((registerv-p val)
-      (assert (registerv-jump-func val) nil
+      (cl-assert (registerv-jump-func val) nil
               "Don't know how to jump to register %s"
               (single-key-description register))
       (funcall (registerv-jump-func val) (registerv-data val)))
@@ -325,7 +309,7 @@ Interactively, second arg is non-nil if prefix arg is supplied."
   (let ((val (get-register register)))
     (cond
      ((registerv-p val)
-      (assert (registerv-insert-func val) nil
+      (cl-assert (registerv-insert-func val) nil
               "Don't know how to insert register %s"
               (single-key-description register))
       (funcall (registerv-insert-func val) (registerv-data val)))
index 94efc717be5fbeb49c41a4e93becb10dccfe9997..e577c461bc50f4ec8cad01bf9d4e73108da7bda8 100644 (file)
@@ -1,4 +1,4 @@
-;;; repeat.el --- convenient way to repeat the previous command
+;;; repeat.el --- convenient way to repeat the previous command  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1998, 2001-2012 Free Software Foundation, Inc.
 
@@ -156,15 +156,6 @@ member of that sequence.  If this variable is nil, no re-execution occurs."
 ;; `repeat' now repeats that command instead of `real-last-command' to
 ;; avoid a "... must be bound to an event with parameters" error.
 
-(defvar repeat-last-self-insert nil
-  "If last repeated command was `self-insert-command', it inserted this.")
-
-;; That'll require another keystroke count so we know we're in a string of
-;; repetitions of self-insert commands:
-
-(defvar repeat-num-input-keys-at-self-insert -1
-  "# key sequences read in Emacs session when `self-insert-command' repeated.")
-
 ;;;;; *************** ANALOGOUS HACKS TO `repeat' ITSELF **************** ;;;;;
 
 ;; That mechanism of checking num-input-keys to figure out what's really
@@ -199,14 +190,6 @@ this function is always whether the value of `this-command' would've been
 (defvar repeat-previous-repeated-command nil
   "The previous repeated command.")
 
-;; The following variable counts repeated self-insertions.  The idea is
-;; that repeating a self-insertion command and subsequently undoing it
-;; should have almost the same effect as if the characters were inserted
-;; manually.  The basic difference is that we leave in one undo-boundary
-;; between the original insertion and its first repetition.
-(defvar repeat-undo-count nil
-  "Number of self-insertions since last `undo-boundary'.")
-
 ;;;###autoload
 (defun repeat (repeat-arg)
   "Repeat most recently executed command.
@@ -254,7 +237,7 @@ recently executed command not bound to an input event\"."
   (let ((repeat-repeat-char
          (if (eq repeat-on-final-keystroke t)
             last-command-event
-           ;; allow only specified final keystrokes
+           ;; Allow only specified final keystrokes.
            (car (memq last-command-event
                       (listify-key-sequence
                        repeat-on-final-keystroke))))))
@@ -269,90 +252,45 @@ recently executed command not bound to an input event\"."
         (setq current-prefix-arg repeat-arg)
         (repeat-message
         "Repeating command %S %S" repeat-arg last-repeatable-command))
-      (if (eq last-repeatable-command 'self-insert-command)
-          (let ((insertion
-                 (if (<= (- num-input-keys
-                            repeat-num-input-keys-at-self-insert)
-                         1)
-                     repeat-last-self-insert
-                   (let ((range (nth 1 buffer-undo-list)))
-                     (condition-case nil
-                         (setq repeat-last-self-insert
-                               (buffer-substring (car range)
-                                                 (cdr range)))
-                       (error (error "%s %s %s" ;Danger, Will Robinson!
-                                     "repeat can't intuit what you"
-                                     "inserted before auto-fill"
-                                     "clobbered it, sorry")))))))
-            (setq repeat-num-input-keys-at-self-insert num-input-keys)
-           ;; If the self-insert had a repeat count, INSERTION
-           ;; includes that many copies of the same character.
-           ;; So use just the first character
-           ;; and repeat it the right number of times.
-           (setq insertion (substring insertion -1))
-           (let ((count (prefix-numeric-value repeat-arg))
-                 (i 0))
-             ;; Run pre- and post-command hooks for self-insertion too.
-             (run-hooks 'pre-command-hook)
-             (cond
-              ((not repeat-undo-count))
-              ((< repeat-undo-count 20)
-               ;; Don't make an undo-boundary here.
-               (setq repeat-undo-count (1+ repeat-undo-count)))
-              (t
-               ;; Make an undo-boundary after 20 repetitions only.
-               (undo-boundary)
-               (setq repeat-undo-count 1)))
-             (while (< i count)
-               (repeat-self-insert insertion)
-               (setq i (1+ i)))
-             (run-hooks 'post-command-hook)))
-       (let ((indirect (indirect-function last-repeatable-command)))
-         ;; Make each repetition undo separately.
-         (undo-boundary)
-         (if (or (stringp indirect)
-                 (vectorp indirect))
-             ;; Bind real-last-command so that executing the macro does
-             ;; not alter it.  Do the same for last-repeatable-command.
-             (let ((real-last-command real-last-command)
-                   (last-repeatable-command last-repeatable-command))
-               (execute-kbd-macro last-repeatable-command))
-            (run-hooks 'pre-command-hook)
-           (call-interactively last-repeatable-command)
-            (run-hooks 'post-command-hook)))))
+      (when (eq last-repeatable-command 'self-insert-command)
+        ;; We used to use a much more complex code to try and figure out
+        ;; what key was used to run that self-insert-command:
+        ;; (if (<= (- num-input-keys
+        ;;            repeat-num-input-keys-at-self-insert)
+        ;;         1)
+        ;;     repeat-last-self-insert
+        ;;   (let ((range (nth 1 buffer-undo-list)))
+        ;;     (condition-case nil
+        ;;         (setq repeat-last-self-insert
+        ;;               (buffer-substring (car range)
+        ;;                                 (cdr range)))
+        ;;       (error (error "%s %s %s"  ;Danger, Will Robinson!
+        ;;                     "repeat can't intuit what you"
+        ;;                     "inserted before auto-fill"
+        ;;                     "clobbered it, sorry")))))
+        (setq last-command-event (char-before)))
+      (let ((indirect (indirect-function last-repeatable-command)))
+        (if (or (stringp indirect)
+                (vectorp indirect))
+            ;; Bind last-repeatable-command so that executing the macro does
+            ;; not alter it.
+            (let ((last-repeatable-command last-repeatable-command))
+              (execute-kbd-macro last-repeatable-command))
+          (call-interactively last-repeatable-command))))
     (when repeat-repeat-char
-      ;; A simple recursion here gets into trouble with max-lisp-eval-depth
-      ;; on long sequences of repetitions of a command like `forward-word'
-      ;; (only 32 repetitions are possible given the default value of 200 for
-      ;; max-lisp-eval-depth), but if I now locally disable the repeat char I
-      ;; can iterate indefinitely here around a single level of recursion.
-      (let (repeat-on-final-keystroke
-           ;; Bind `undo-inhibit-record-point' to t in order to avoid
-           ;; recording point in `buffer-undo-list' here.  We have to
-           ;; do this since the command loop does not set the last
-           ;; position of point thus confusing the point recording
-           ;; mechanism when inserting or deleting text.
-           (undo-inhibit-record-point t))
-       (setq real-last-command 'repeat)
-       (setq repeat-undo-count 1)
-       (unwind-protect
-           (while (let ((evt (read-key)))
-                     ;; For clicks, we need to strip the meta-data to
-                     ;; check the underlying event name.
-                     (eq (or (car-safe evt) evt)
-                         (or (car-safe repeat-repeat-char)
-                             repeat-repeat-char)))
-             (repeat repeat-arg))
-         ;; Make sure `repeat-undo-count' is reset.
-         (setq repeat-undo-count nil))
-        (setq unread-command-events (list last-input-event))))))
-
-(defun repeat-self-insert (string)
-  (let ((i 0))
-    (while (< i (length string))
-      (let ((last-command-event (aref string i)))
-       (self-insert-command 1))
-      (setq i (1+ i)))))
+      (set-temporary-overlay-map
+       (let ((map (make-sparse-keymap)))
+         (define-key map (vector repeat-repeat-char)
+           (if (null repeat-message-function) 'repeat
+             ;; If repeat-message-function is let-bound, preserve it for the
+             ;; next "iterations of the loop".
+             (let ((fun repeat-message-function))
+               (lambda ()
+                 (interactive)
+                 (let ((repeat-message-function fun))
+                   (setq this-command 'repeat)
+                   (call-interactively 'repeat))))))
+         map)))))
 
 (defun repeat-message (format &rest args)
   "Like `message' but displays with `repeat-message-function' if non-nil."
index ad87d474b8b46ce3874d60d46eb01ffb42a791d0..5baf68224c4037079f674aa5250650a94f3a15fb 100644 (file)
@@ -763,48 +763,47 @@ a previously found match."
 \f
 (defvar occur-menu-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [next-error-follow-minor-mode]
-      `(menu-item ,(purecopy "Auto Occurrence Display")
+    (bindings--define-key map [next-error-follow-minor-mode]
+      '(menu-item "Auto Occurrence Display"
                  next-error-follow-minor-mode
-                 :help ,(purecopy
-                         "Display another occurrence when moving the cursor")
+                 :help "Display another occurrence when moving the cursor"
                  :button (:toggle . (and (boundp 'next-error-follow-minor-mode)
                                          next-error-follow-minor-mode))))
-    (define-key map [separator-1] menu-bar-separator)
-    (define-key map [kill-this-buffer]
-      `(menu-item ,(purecopy "Kill Occur Buffer") kill-this-buffer
-                 :help ,(purecopy "Kill the current *Occur* buffer")))
-    (define-key map [quit-window]
-      `(menu-item ,(purecopy "Quit Occur Window") quit-window
-                 :help ,(purecopy "Quit the current *Occur* buffer.  Bury it, and maybe delete the selected frame")))
-    (define-key map [revert-buffer]
-      `(menu-item ,(purecopy "Revert Occur Buffer") revert-buffer
-                 :help ,(purecopy "Replace the text in the *Occur* buffer with the results of rerunning occur")))
-    (define-key map [clone-buffer]
-      `(menu-item ,(purecopy "Clone Occur Buffer") clone-buffer
-                 :help ,(purecopy "Create and return a twin copy of the current *Occur* buffer")))
-    (define-key map [occur-rename-buffer]
-      `(menu-item ,(purecopy "Rename Occur Buffer") occur-rename-buffer
-                 :help ,(purecopy "Rename the current *Occur* buffer to *Occur: original-buffer-name*.")))
-    (define-key map [occur-edit-buffer]
-      `(menu-item ,(purecopy "Edit Occur Buffer") occur-edit-mode
-                 :help ,(purecopy "Edit the *Occur* buffer and apply changes to the original buffers.")))
-    (define-key map [separator-2] menu-bar-separator)
-    (define-key map [occur-mode-goto-occurrence-other-window]
-      `(menu-item ,(purecopy "Go To Occurrence Other Window") occur-mode-goto-occurrence-other-window
-                 :help ,(purecopy "Go to the occurrence the current line describes, in another window")))
-    (define-key map [occur-mode-goto-occurrence]
-      `(menu-item ,(purecopy "Go To Occurrence") occur-mode-goto-occurrence
-                 :help ,(purecopy "Go to the occurrence the current line describes")))
-    (define-key map [occur-mode-display-occurrence]
-      `(menu-item ,(purecopy "Display Occurrence") occur-mode-display-occurrence
-                 :help ,(purecopy "Display in another window the occurrence the current line describes")))
-    (define-key map [occur-next]
-      `(menu-item ,(purecopy "Move to Next Match") occur-next
-                 :help ,(purecopy "Move to the Nth (default 1) next match in an Occur mode buffer")))
-    (define-key map [occur-prev]
-      `(menu-item ,(purecopy "Move to Previous Match") occur-prev
-                 :help ,(purecopy "Move to the Nth (default 1) previous match in an Occur mode buffer")))
+    (bindings--define-key map [separator-1] menu-bar-separator)
+    (bindings--define-key map [kill-this-buffer]
+      '(menu-item "Kill Occur Buffer" kill-this-buffer
+                 :help "Kill the current *Occur* buffer"))
+    (bindings--define-key map [quit-window]
+      '(menu-item "Quit Occur Window" quit-window
+                 :help "Quit the current *Occur* buffer.  Bury it, and maybe delete the selected frame"))
+    (bindings--define-key map [revert-buffer]
+      '(menu-item "Revert Occur Buffer" revert-buffer
+                 :help "Replace the text in the *Occur* buffer with the results of rerunning occur"))
+    (bindings--define-key map [clone-buffer]
+      '(menu-item "Clone Occur Buffer" clone-buffer
+                 :help "Create and return a twin copy of the current *Occur* buffer"))
+    (bindings--define-key map [occur-rename-buffer]
+      '(menu-item "Rename Occur Buffer" occur-rename-buffer
+                 :help "Rename the current *Occur* buffer to *Occur: original-buffer-name*."))
+    (bindings--define-key map [occur-edit-buffer]
+      '(menu-item "Edit Occur Buffer" occur-edit-mode
+                 :help "Edit the *Occur* buffer and apply changes to the original buffers."))
+    (bindings--define-key map [separator-2] menu-bar-separator)
+    (bindings--define-key map [occur-mode-goto-occurrence-other-window]
+      '(menu-item "Go To Occurrence Other Window" occur-mode-goto-occurrence-other-window
+                 :help "Go to the occurrence the current line describes, in another window"))
+    (bindings--define-key map [occur-mode-goto-occurrence]
+      '(menu-item "Go To Occurrence" occur-mode-goto-occurrence
+                 :help "Go to the occurrence the current line describes"))
+    (bindings--define-key map [occur-mode-display-occurrence]
+      '(menu-item "Display Occurrence" occur-mode-display-occurrence
+                 :help "Display in another window the occurrence the current line describes"))
+    (bindings--define-key map [occur-next]
+      '(menu-item "Move to Next Match" occur-next
+                 :help "Move to the Nth (default 1) next match in an Occur mode buffer"))
+    (bindings--define-key map [occur-prev]
+      '(menu-item "Move to Previous Match" occur-prev
+                 :help "Move to the Nth (default 1) previous match in an Occur mode buffer"))
     map)
   "Menu keymap for `occur-mode'.")
 
@@ -822,7 +821,7 @@ a previously found match."
     (define-key map "r" 'occur-rename-buffer)
     (define-key map "c" 'clone-buffer)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
-    (define-key map [menu-bar occur] (cons (purecopy "Occur") occur-menu-map))
+    (bindings--define-key map [menu-bar occur] (cons "Occur" occur-menu-map))
     map)
   "Keymap for `occur-mode'.")
 
@@ -870,7 +869,7 @@ Alternatively, click \\[occur-mode-mouse-goto] on an item to go to it.
     (define-key map "\C-c\C-c" 'occur-cease-edit)
     (define-key map "\C-o" 'occur-mode-display-occurrence)
     (define-key map "\C-c\C-f" 'next-error-follow-minor-mode)
-    (define-key map [menu-bar occur] (cons (purecopy "Occur") occur-menu-map))
+    (bindings--define-key map [menu-bar occur] (cons "Occur" occur-menu-map))
     map)
   "Keymap for `occur-edit-mode'.")
 
index a65906a16765bf811886caaaf4b4bd13e6f79425..6310190b4fe8bb834a4331c90d4dcf8d5b1c3233 100644 (file)
@@ -278,6 +278,13 @@ If AUTO-SAVE is non-nil, compare the saved contents to the one last saved,
          (print-level nil)
          (print-readably t)
          (print-quoted t))
+      ;; During the 24.2 development, read-passwd had a bug which resulted in
+      ;; the passwords being saved by savehist.  Trim them, retroactively.
+      ;; This code can be removed after the 24.2 release.
+      (dolist (sym savehist-minibuffer-history-variables)
+        (if (and (symbolp sym) (equal (symbol-name sym) "forget-history"))
+            (setq savehist-minibuffer-history-variables
+                  (delq sym savehist-minibuffer-history-variables))))
       ;; Save the minibuffer histories, along with the value of
       ;; savehist-minibuffer-history-variables itself.
       (when savehist-save-minibuffer-history
index 9ff0a61db2f6c32c5aca1aa88e43d084a4794a32..fed886c2b559e39264752134b1851a86be566d12 100644 (file)
@@ -111,7 +111,6 @@ one window apply to all visible windows in the same frame."
   nil " *SL*" nil
   :global t
   :group 'windows
-  :group 'scrolling
   (if scroll-all-mode
       (add-hook 'post-command-hook 'scroll-all-check-to-scroll)
     (remove-hook 'post-command-hook 'scroll-all-check-to-scroll)))
index 058d83a97bcc3bfad89336af7db2c4fb13a3cd3a..0d693c52c8165ab1510781a083680b9dbf65662c 100644 (file)
@@ -29,7 +29,7 @@
 ;;; Code:
 
 (require 'mouse)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 \f
 ;;;; Utilities.
@@ -112,8 +112,9 @@ Setting the variable with a customization buffer also takes effect."
 ;; If it is set again, that is for real.
 (setq scroll-bar-mode-explicit t)
 
-(defun get-scroll-bar-mode () scroll-bar-mode)
-(defsetf get-scroll-bar-mode set-scroll-bar-mode)
+(defun get-scroll-bar-mode ()
+  (declare (gv-setter set-scroll-bar-mode))
+  scroll-bar-mode)
 
 (define-minor-mode scroll-bar-mode
   "Toggle vertical scroll bars on all frames (Scroll Bar mode).
@@ -123,9 +124,10 @@ the mode if ARG is omitted or nil.
 
 This command applies to all frames that exist and frames to be
 created in the future."
-  :variable (eq (get-scroll-bar-mode)
-                (or previous-scroll-bar-mode
-                    default-frame-scroll-bars)))
+  :variable ((get-scroll-bar-mode)
+             . (lambda (v) (set-scroll-bar-mode
+                       (if v (or previous-scroll-bar-mode
+                                 default-frame-scroll-bars))))))
 
 (defun toggle-scroll-bar (arg)
   "Toggle whether or not the selected frame has vertical scroll bars.
index ced07714dcf2945d964b554ed90d467dda4b2768..a25da406571ad478aeab2aafb59aaae0802d2991 100644 (file)
@@ -81,7 +81,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup server nil
   "Emacs running as a server process."
@@ -139,6 +139,32 @@ directory residing in a NTFS partition instead."
 ;;;###autoload
 (put 'server-auth-dir 'risky-local-variable t)
 
+(defcustom server-auth-key nil
+  "Server authentication key.
+
+Normally, the authentication key is randomly generated when the
+server starts, which guarantees some level of security.  It is
+recommended to leave it that way.  Using a long-lived shared key
+will decrease security (especially since the key is transmitted as
+plain text).
+
+In some situations however, it can be difficult to share randomly
+generated passwords with remote hosts (eg. no shared directory),
+so you can set the key with this variable and then copy the
+server file to the remote host (with possible changes to IP
+address and/or port if that applies).
+
+The key must consist of 64 ASCII printable characters except for
+space (this means characters from ! to ~; or from code 33 to 126).
+
+You can use \\[server-generate-key] to get a random authentication
+key."
+  :group 'server
+  :type '(choice
+         (const :tag "Random" nil)
+         (string :tag "Password"))
+  :version "24.2")
+
 (defcustom server-raise-frame t
   "If non-nil, raise frame when switching to a buffer."
   :group 'server
@@ -452,11 +478,11 @@ If CLIENT is non-nil, add a description of it to the logged message."
 See `server-quote-arg' and `server-process-filter'."
   (replace-regexp-in-string
    "&." (lambda (s)
-         (case (aref s 1)
+         (pcase (aref s 1)
            (?& "&")
            (?- "-")
            (?n "\n")
-           (t " ")))
+           (_ " ")))
    arg t t))
 
 (defun server-quote-arg (arg)
@@ -467,7 +493,7 @@ contains a space.
 See `server-unquote-arg' and `server-process-filter'."
   (replace-regexp-in-string
    "[-&\n ]" (lambda (s)
-              (case (aref s 0)
+              (pcase (aref s 0)
                 (?& "&&")
                 (?- "&-")
                 (?\n "&n")
@@ -488,47 +514,68 @@ Creates the directory if necessary and makes sure:
   (setq dir (directory-file-name dir))
   (let ((attrs (file-attributes dir 'integer)))
     (unless attrs
-      (letf (((default-file-modes) ?\700)) (make-directory dir t))
+      (cl-letf (((default-file-modes) ?\700)) (make-directory dir t))
       (setq attrs (file-attributes dir 'integer)))
 
     ;; Check that it's safe for use.
     (let* ((uid (nth 2 attrs))
           (w32 (eq system-type 'windows-nt))
-          (safe (catch :safe
-                  (unless (eq t (car attrs))   ; is a dir?
-                    (throw :safe nil))
-                  (when (and w32 (zerop uid))  ; on FAT32?
-                    (display-warning
-                     'server
-                     (format "Using `%s' to store Emacs-server authentication files.
+          (safe (cond
+                 ((not (eq t (car attrs))) nil)  ; is a dir?
+                 ((and w32 (zerop uid))          ; on FAT32?
+                  (display-warning
+                   'server
+                   (format "Using `%s' to store Emacs-server authentication files.
 Directories on FAT32 filesystems are NOT secure against tampering.
 See variable `server-auth-dir' for details."
-                             (file-name-as-directory dir))
-                     :warning)
-                    (throw :safe t))
-                  (unless (or (= uid (user-uid)) ; is the dir ours?
-                              (and w32
-                                   ;; Files created on Windows by
-                                   ;; Administrator (RID=500) have
-                                   ;; the Administrators (RID=544)
-                                   ;; group recorded as the owner.
-                                   (= uid 544) (= (user-uid) 500)))
-                    (throw :safe nil))
-                  (when w32                    ; on NTFS?
-                    (throw :safe t))
-                  (unless (zerop (logand ?\077 (file-modes dir)))
-                    (throw :safe nil))
-                  t)))
+                           (file-name-as-directory dir))
+                   :warning)
+                  t)
+                 ((and (/= uid (user-uid))       ; is the dir ours?
+                       (or (not w32)
+                           ;; Files created on Windows by Administrator
+                           ;; (RID=500) have the Administrators (RID=544)
+                           ;; group recorded as the owner.
+                           (/= uid 544) (/= (user-uid) 500)))
+                  nil)
+                 (w32 t)                         ; on NTFS?
+                 (t                              ; else, check permissions
+                  (zerop (logand ?\077 (file-modes dir)))))))
       (unless safe
        (error "The directory `%s' is unsafe" dir)))))
 
+(defun server-generate-key ()
+  "Generate and return a random authentication key.
+The key is a 64-byte string of random chars in the range `!'..`~'.
+If called interactively, also inserts it into current buffer."
+  (interactive)
+  (let ((auth-key
+        (cl-loop repeat 64
+                  collect (+ 33 (random 94)) into auth
+                  finally return (concat auth))))
+    (if (called-interactively-p 'interactive)
+       (insert auth-key))
+    auth-key))
+
+(defun server-get-auth-key ()
+  "Return server's authentication key.
+
+If `server-auth-key' is nil, just call `server-generate-key'.
+Otherwise, if `server-auth-key' is a valid key, return it.
+If the key is not valid, signal an error."
+  (if server-auth-key
+    (if (string-match-p "^[!-~]\\{64\\}$" server-auth-key)
+        server-auth-key
+      (error "The key '%s' is invalid" server-auth-key))
+    (server-generate-key)))
+
 ;;;###autoload
 (defun server-start (&optional leave-dead inhibit-prompt)
   "Allow this Emacs process to be a server for client processes.
-This starts a server communications subprocess through which
-client \"editors\" can send your editing commands to this Emacs
-job.  To use the server, set up the program `emacsclient' in the
-Emacs distribution as your standard \"editor\".
+This starts a server communications subprocess through which client
+\"editors\" can send your editing commands to this Emacs job.
+To use the server, set up the program `emacsclient' in the Emacs
+distribution as your standard \"editor\".
 
 Optional argument LEAVE-DEAD (interactively, a prefix arg) means just
 kill any existing server communications subprocess.
@@ -585,11 +632,13 @@ server or call `M-x server-force-delete' to forcibly disconnect it.")
        (server-ensure-safe-dir server-dir)
        (when server-process
          (server-log (message "Restarting server")))
-       (letf (((default-file-modes) ?\700))
+       (cl-letf (((default-file-modes) ?\700))
          (add-hook 'suspend-tty-functions 'server-handle-suspend-tty)
          (add-hook 'delete-frame-functions 'server-handle-delete-frame)
-         (add-hook 'kill-buffer-query-functions 'server-kill-buffer-query-function)
-         (add-hook 'kill-emacs-query-functions 'server-kill-emacs-query-function)
+         (add-hook 'kill-buffer-query-functions
+                    'server-kill-buffer-query-function)
+         (add-hook 'kill-emacs-query-functions
+                    'server-kill-emacs-query-function)
          (add-hook 'kill-emacs-hook 'server-force-stop) ;Cleanup upon exit.
          (setq server-process
                (apply #'make-network-process
@@ -615,13 +664,7 @@ server or call `M-x server-force-delete' to forcibly disconnect it.")
          (unless server-process (error "Could not start server process"))
          (process-put server-process :server-file server-file)
          (when server-use-tcp
-           (let ((auth-key
-                  (loop
-                   ;; The auth key is a 64-byte string of random chars in the
-                   ;; range `!'..`~'.
-                   repeat 64
-                   collect (+ 33 (random 94)) into auth
-                   finally return (concat auth))))
+           (let ((auth-key (server-get-auth-key)))
              (process-put server-process :auth-key auth-key)
              (with-temp-file server-file
                (set-buffer-multibyte nil)
@@ -780,10 +823,6 @@ This handles splitting the command if it would be bigger than
     (select-frame frame)
     (process-put proc 'frame frame)
     (process-put proc 'terminal (frame-terminal frame))
-
-    ;; Display *scratch* by default.
-    (switch-to-buffer (get-buffer-create "*scratch*") 'norecord)
-
     frame))
 
 (defun server-create-window-system-frame (display nowait proc parent-id
@@ -816,9 +855,6 @@ This handles splitting the command if it would be bigger than
       (select-frame frame)
       (process-put proc 'frame frame)
       (process-put proc 'terminal (frame-terminal frame))
-
-      ;; Display *scratch* by default.
-      (switch-to-buffer (get-buffer-create "*scratch*") 'norecord)
       frame)))
 
 (defun server-goto-toplevel (proc)
@@ -852,7 +888,7 @@ This handles splitting the command if it would be bigger than
     (process-put proc 'continuation nil)
     (if continuation (ignore-errors (funcall continuation)))))
 
-(defun* server-process-filter (proc string)
+(cl-defun server-process-filter (proc string)
   "Process a request from the server to edit some files.
 PROC is the server process.  STRING consists of a sequence of
 commands prefixed by a dash.  Some commands have arguments;
@@ -967,8 +1003,8 @@ The following commands are accepted by the client:
       ;; receive the error string and shut down on its own.
       (sit-for 1)
       (delete-process proc)
-      ;; We return immediately
-      (return-from server-process-filter)))
+      ;; We return immediately.
+      (cl-return-from server-process-filter)))
   (let ((prev (process-get proc 'previous-string)))
     (when prev
       (setq string (concat prev string))
@@ -987,7 +1023,7 @@ The following commands are accepted by the client:
           ;; In earlier versions of server.el (where we used an `emacsserver'
           ;; process), there could be multiple lines.  Nowadays this is not
           ;; supported any more.
-          (assert (eq (match-end 0) (length string)))
+          (cl-assert (eq (match-end 0) (length string)))
          (let ((request (substring string 0 (match-beginning 0)))
                (coding-system (and (default-value 'enable-multibyte-characters)
                                    (or file-name-coding-system
@@ -1042,8 +1078,9 @@ The following commands are accepted by the client:
 
                 ;; -window-system:  Open a new X frame.
                 (`"-window-system"
-                 (setq dontkill t)
-                 (setq tty-name 'window-system))
+                (if (fboundp 'x-create-frame)
+                    (setq dontkill t
+                          tty-name 'window-system)))
 
                 ;; -resume:  Resume a suspended tty frame.
                 (`"-resume"
@@ -1071,7 +1108,8 @@ The following commands are accepted by the client:
                  (setq dontkill t)
                  (pop args-left))
 
-                ;; -tty DEVICE-NAME TYPE:  Open a new tty frame at the client.
+               ;; -tty DEVICE-NAME TYPE:  Open a new tty frame.
+               ;; (But if we see -window-system later, use that.)
                 (`"-tty"
                  (setq tty-name (pop args-left)
                        tty-type (pop args-left)
@@ -1128,7 +1166,8 @@ The following commands are accepted by the client:
                  (setq dir (pop args-left))
                  (if coding-system
                      (setq dir (decode-coding-string dir coding-system)))
-                 (setq dir (command-line-normalize-file-name dir)))
+                 (setq dir (command-line-normalize-file-name dir))
+                 (process-put proc 'server-client-directory dir))
 
                 ;; Unknown command.
                 (arg (error "Unknown command: %s" arg))))
@@ -1189,12 +1228,17 @@ The following commands are accepted by the client:
   ;; including code that needs to wait.
   (with-local-quit
     (condition-case err
-        (let* ((buffers
-                (when files
-                  (server-visit-files files proc nowait))))
-
+        (let ((buffers (server-visit-files files proc nowait)))
           (mapc 'funcall (nreverse commands))
 
+         ;; If we were told only to open a new client, obey
+         ;; `initial-buffer-choice' if it specifies a file.
+         (unless (or files commands)
+           (if (stringp initial-buffer-choice)
+               (find-file initial-buffer-choice)
+             (switch-to-buffer (get-buffer-create "*scratch*")
+                               'norecord)))
+
           ;; Delete the client if necessary.
           (cond
            (nowait
index 0638fc344c7534cc336df459f497cb0174c3bcf7..201d9cbf10b6026de8d7f32090bc694128bb6caa 100644 (file)
@@ -56,7 +56,7 @@
 ;;; Code:
 
 (require 'unsafep)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 
 ;;----------------------------------------------------------------------------
@@ -65,6 +65,7 @@
 
 (defgroup ses nil
   "Simple Emacs Spreadsheet."
+  :tag "SES"
   :group  'applications
   :prefix "ses-"
   :version "21.1")
@@ -282,6 +283,9 @@ default printer and then modify its output.")
       ses--numcols ses--numrows ses--symbolic-formulas
       ses--data-marker ses--params-marker (ses--Dijkstra-attempt-nb . 0)
       ses--Dijkstra-weight-bound
+      ;; This list is useful to speed-up clean-up of symbols when
+      ;; an area containing renamed cell is deleted.
+      ses--renamed-cell-symb-list
       ;; Global variables that we override
       mode-line-process next-line-add-newlines transient-mark-mode)
     "Buffer-local variables used by SES.")
@@ -674,6 +678,17 @@ for this spreadsheet."
        (put sym 'ses-cell (cons xrow xcol))
        (make-local-variable sym)))))
 
+(defun ses-create-cell-variable (sym row col)
+  "Create a buffer-local variable `SYM' for cell at position (ROW, COL).
+
+SYM is the symbol for that variable, ROW and COL are integers for
+row and column of the cell, with numbering starting from 0.
+
+Return nil in case of failure."
+  (unless (local-variable-p sym)
+    (make-local-variable  sym)
+    (put sym 'ses-cell (cons row col))))
+
 ;; We do not delete the ses-cell properties for the cell-variables, in
 ;; case a formula that refers to this cell is in the kill-ring and is
 ;; later pasted back in.
@@ -682,7 +697,10 @@ for this spreadsheet."
   (let (sym)
     (dotimes (row (1+ (- maxrow minrow)))
       (dotimes (col (1+ (- maxcol mincol)))
-       (setq sym (ses-create-cell-symbol (+ row minrow) (+ col mincol)))
+       (let ((xrow  (+ row minrow)) (xcol (+ col mincol)))
+         (setq sym (if (and (< xrow ses--numrows) (< xcol ses--numcols))
+                       (ses-cell-symbol xrow xcol)
+                       (ses-create-cell-symbol xrow xcol))))
        (if (boundp sym)
            (push `(apply ses-set-with-undo ,sym ,(symbol-value sym))
                  buffer-undo-list))
@@ -1400,7 +1418,8 @@ removed.  Example:
 Sets `ses-relocate-return' to 'delete if cell-references were removed."
   (let (rowcol result)
     (if (or (atom formula) (eq (car formula) 'quote))
-       (if (setq rowcol (ses-sym-rowcol formula))
+       (if (and (setq rowcol (ses-sym-rowcol formula))
+                (string-match "\\`[A-Z]+[0-9]+\\'" (symbol-name formula)))
            (ses-relocate-symbol formula rowcol
                                 startrow startcol rowincr colincr)
          formula) ; Pass through as-is.
@@ -1501,21 +1520,22 @@ if the range was altered."
                 (funcall field (ses-sym-rowcol min))))
          ;; This range has changed size.
          (setq ses-relocate-return 'range))
-      `(ses-range ,min ,max ,@(cdddr range)))))
+      `(ses-range ,min ,max ,@(cl-cdddr range)))))
 
 (defun ses-relocate-all (minrow mincol rowincr colincr)
   "Alter all cell values, symbols, formulas, and reference-lists to relocate
 the rectangle (MINROW,MINCOL)..(NUMROWS,NUMCOLS) by adding ROWINCR and COLINCR
 to each symbol."
   (let (reform)
-    (let (mycell newval)
+    (let (mycell newval xrow)
       (dotimes-with-progress-reporter
          (row ses--numrows) "Relocating formulas..."
        (dotimes (col ses--numcols)
          (setq ses-relocate-return nil
                mycell (ses-get-cell row col)
                newval (ses-relocate-formula (ses-cell-formula mycell)
-                                            minrow mincol rowincr colincr))
+                                            minrow mincol rowincr colincr)
+               xrow  (- row rowincr))
          (ses-set-cell row col 'formula newval)
          (if (eq ses-relocate-return 'range)
              ;; This cell contains a (ses-range X Y) where a cell has been
@@ -1531,8 +1551,22 @@ to each symbol."
                                             minrow mincol rowincr colincr))
          (ses-set-cell row col 'references newval)
          (and (>= row minrow) (>= col mincol)
-              (ses-set-cell row col 'symbol
-                            (ses-create-cell-symbol row col))))))
+              (let ((sym (ses-cell-symbol row col))
+                    (xcol (- col colincr)))
+                (if (and
+                     sym
+                     (>= xrow 0)
+                     (>= xcol 0)
+                     (null (eq sym
+                               (ses-create-cell-symbol xrow xcol))))
+                    ;; This is a renamed cell, do not update the cell
+                    ;; name, but just update the coordinate property.
+                    (put sym 'ses-cell (cons row col))
+                  (ses-set-cell row col 'symbol
+                                (setq sym (ses-create-cell-symbol row col)))
+                  (unless (and (boundp sym) (local-variable-p sym))
+                    (set (make-local-variable sym) nil)
+                    (put sym 'ses-cell (cons row col)))))) )))
     ;; Relocate the cell values.
     (let (oldval myrow mycol xrow xcol)
       (cond
@@ -1545,11 +1579,17 @@ to each symbol."
            (setq mycol  (+ col mincol)
                  xrow   (- myrow rowincr)
                  xcol   (- mycol colincr))
-           (if (and (< xrow ses--numrows) (< xcol ses--numcols))
-               (setq oldval (ses-cell-value xrow xcol))
-             ;; Cell is off the end of the array.
-             (setq oldval (symbol-value (ses-create-cell-symbol xrow xcol))))
-           (ses-set-cell myrow mycol 'value oldval))))
+           (let ((sym (ses-cell-symbol myrow mycol))
+                 (xsym (ses-create-cell-symbol xrow xcol)))
+             ;; Make the value relocation only when if the cell is not
+             ;; a renamed cell.  Otherwise this is not needed.
+             (and (eq sym xsym)
+                 (ses-set-cell myrow mycol 'value
+                   (if (and (< xrow ses--numrows) (< xcol ses--numcols))
+                       (ses-cell-value xrow xcol)
+                     ;;Cell is off the end of the array
+                     (symbol-value xsym))))))))
+
        ((and (wholenump rowincr) (wholenump colincr))
        ;; Insertion of rows and/or columns.  Run the loop backwards.
        (let ((disty (1- ses--numrows))
@@ -1659,7 +1699,6 @@ Does not execute cell formulas or print functions."
        (message "Upgrading from SES-1 file format")))
     (or (= ses--file-format 2)
        (error "This file needs a newer version of the SES library code"))
-    (ses-create-cell-variable-range 0 (1- ses--numrows) 0 (1- ses--numcols))
     ;; Initialize cell array.
     (setq ses--cells (make-vector ses--numrows nil))
     (dotimes (row ses--numrows)
@@ -1679,11 +1718,10 @@ Does not execute cell formulas or print functions."
   (dotimes (row ses--numrows)
     (dotimes (col ses--numcols)
       (let* ((x      (read (current-buffer)))
-            (rowcol (ses-sym-rowcol (car-safe (cdr-safe x)))))
+            (sym  (car-safe (cdr-safe x))))
        (or (and (looking-at "\n")
                 (eq (car-safe x) 'ses-cell)
-                (eq row (car rowcol))
-                (eq col (cdr rowcol)))
+                (ses-create-cell-variable sym row col))
            (error "Cell-def error"))
        (eval x)))
     (or (looking-at "\n\n")
@@ -1895,7 +1933,7 @@ narrows the buffer now."
          ;; do the narrowing.
          (narrow-to-region (point-min) ses--data-marker)
          (setq ses--deferred-narrow nil))
-       ;; Update the modeline.
+       ;; Update the mode line.
        (let ((oldcell ses--curcell))
          (ses-set-curcell)
          (unless (eq ses--curcell oldcell)
@@ -3140,6 +3178,63 @@ highlighted range in the spreadsheet."
   (mouse-set-point event)
   (ses-insert-ses-range))
 
+(defun ses-replace-name-in-formula (formula old-name new-name)
+  (let ((new-formula formula))
+    (unless (and (consp formula)
+                (eq (car-safe formula) 'quote))
+      (while formula
+       (let ((elt (car-safe formula)))
+         (cond
+          ((consp elt)
+           (setcar formula (ses-replace-name-in-formula elt old-name new-name)))
+          ((and (symbolp elt)
+                (eq (car-safe formula) old-name))
+           (setcar formula new-name))))
+       (setq formula (cdr formula))))
+    new-formula))
+
+(defun ses-rename-cell (new-name)
+  "Rename current cell."
+  (interactive "*SEnter new name: ")
+  (ses-check-curcell)
+  (or
+   (and  (local-variable-p new-name)
+        (ses-sym-rowcol new-name)
+        ;; this test is needed because ses-cell property of deleted cells
+        ;; is not deleted in case of subsequent undo
+        (memq new-name ses--renamed-cell-symb-list)
+        (error "Already a cell name"))
+   (and (boundp new-name)
+       (null (yes-or-no-p (format "`%S' is already bound outside this buffer, continue? "
+                                  new-name)))
+       (error "Already a bound cell name")))
+  (let* ((rowcol (ses-sym-rowcol ses--curcell))
+        (cell (ses-get-cell (car rowcol) (cdr rowcol))))
+    (put new-name 'ses-cell rowcol)
+    (dolist (reference (ses-cell-references (car rowcol) (cdr rowcol)))
+      (let* ((rowcol (ses-sym-rowcol reference))
+            (cell  (ses-get-cell (car rowcol) (cdr rowcol))))
+       (ses-cell-set-formula (car rowcol)
+                             (cdr rowcol)
+                             (ses-replace-name-in-formula
+                              (ses-cell-formula cell)
+                              ses--curcell
+                              new-name))))
+    (push new-name ses--renamed-cell-symb-list)
+    (set new-name (symbol-value ses--curcell))
+    (aset cell 0 new-name)
+    (put ses--curcell 'ses-cell nil)
+    (makunbound ses--curcell)
+    (setq ses--curcell new-name)
+    (let* ((pos (point))
+          (inhibit-read-only t)
+          (col (current-column))
+          (end (save-excursion
+                 (move-to-column (1+ col))
+                 (if (eolp)
+                     (+ pos (ses-col-width col) 1)
+                   (point)))))
+      (put-text-property pos end 'intangible new-name))) )
 
 ;;----------------------------------------------------------------------------
 ;; Checking formulas for safety
@@ -3250,19 +3345,20 @@ Use `math-format-value' as a printer for Calc objects."
     (push result-row result)
     (while rest
       (let ((x (pop rest)))
-       (case x
-         ((>v) (setq transpose nil reorient-x nil reorient-y nil))
-         ((>^)(setq transpose nil reorient-x nil reorient-y t))
-         ((<^)(setq transpose nil reorient-x t reorient-y t))
-         ((<v)(setq transpose nil reorient-x t reorient-y nil))
-         ((v>)(setq transpose t reorient-x nil reorient-y t))
-         ((^>)(setq transpose t reorient-x nil reorient-y nil))
-         ((^<)(setq transpose t reorient-x t reorient-y nil))
-         ((v<)(setq transpose t reorient-x t reorient-y t))
-         ((* *2 *1) (setq vectorize x))
-         ((!) (setq clean 'ses--clean-!))
-         ((_) (setq clean `(lambda (&rest x) (ses--clean-_  x ,(if rest (pop rest) 0)))))
-         (t
+       (pcase x
+         (`>v (setq transpose nil reorient-x nil reorient-y nil))
+         (`>^ (setq transpose nil reorient-x nil reorient-y t))
+         (`<^ (setq transpose nil reorient-x t reorient-y t))
+         (`<v (setq transpose nil reorient-x t reorient-y nil))
+         (`v> (setq transpose t reorient-x nil reorient-y t))
+         (`^> (setq transpose t reorient-x nil reorient-y nil))
+         (`^< (setq transpose t reorient-x t reorient-y nil))
+         (`v< (setq transpose t reorient-x t reorient-y t))
+         ((or `* `*2 `*1) (setq vectorize x))
+         (`! (setq clean 'ses--clean-!))
+         (`_ (setq clean `(lambda (&rest x)
+                             (ses--clean-_  x ,(if rest (pop rest) 0)))))
+         (_
           (cond
                                        ; shorthands one row
            ((and (null (cddr result)) (memq x '(> <)))
@@ -3285,21 +3381,23 @@ Use `math-format-value' as a printer for Calc objects."
            (setq iter (cdr iter))))
        (setq result ret)))
 
-    (flet ((vectorize-*1
-           (clean result)
-           (cons clean (cons (quote 'vec) (apply 'append result))))
-          (vectorize-*2
-           (clean result)
-           (cons clean (cons (quote 'vec) (mapcar (lambda (x)
-                                                    (cons  clean (cons (quote 'vec) x)))
-                                                  result)))))
-      (case vectorize
-       ((nil) (cons clean (apply 'append result)))
-       ((*1) (vectorize-*1 clean result))
-       ((*2) (vectorize-*2 clean result))
-       ((*) (if (cdr result)
-              (vectorize-*2 clean result)
-            (vectorize-*1 clean result)))))))
+    (cl-flet ((vectorize-*1
+               (clean result)
+               (cons clean (cons (quote 'vec) (apply 'append result))))
+              (vectorize-*2
+               (clean result)
+               (cons clean (cons (quote 'vec)
+                                 (mapcar (lambda (x)
+                                           (cons  clean (cons (quote 'vec) x)))
+                                         result)))))
+      (pcase vectorize
+       (`nil (cons clean (apply 'append result)))
+       (`*1 (vectorize-*1 clean result))
+       (`*2 (vectorize-*2 clean result))
+       (`* (funcall (if (cdr result)
+                         #'vectorize-*2
+                       #'vectorize-*1)
+                     clean result))))))
 
 (defun ses-delete-blanks (&rest args)
   "Return ARGS reversed, with the blank elements (nil and *skip*) removed."
index 1784188f6adb19c03bdc2f96e6c7f35d9c72eb83..b98efceefbf978a74a248f854e2bff5d782885cf 100644 (file)
@@ -96,7 +96,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'comint)
 (require 'pcomplete)
 
@@ -372,8 +371,57 @@ Thus, this does not include the shell's current directory.")
 
 ;;; Basic Procedures
 
-(defun shell-parse-pcomplete-arguments ()
+(defun shell--unquote&requote-argument (qstr &optional upos)
+  (unless upos (setq upos 0))
+  (let* ((qpos 0)
+         (dquotes nil)
+         (ustrs '())
+         (re (concat
+              "[\"']"
+              "\\|\\$\\(?:\\([[:alpha:]][[:alnum:]]*\\)"
+              "\\|{\\(?1:[^{}]+\\)}\\)"
+              (when (memq system-type '(ms-dos windows-nt))
+                "\\|%\\(?1:[^\\\\/]*\\)%")
+              (when comint-file-name-quote-list
+                "\\|\\\\\\(.\\)")))
+         (qupos nil)
+         (push (lambda (str end)
+                 (push str ustrs)
+                 (setq upos (- upos (length str)))
+                 (unless (or qupos (> upos 0))
+                   (setq qupos (if (< end 0) (- end) (+ upos end))))))
+         match)
+    (while (setq match (string-match re qstr qpos))
+      (funcall push (substring qstr qpos match) match)
+      (cond
+       ((match-beginning 2) (funcall push (match-string 2 qstr) (match-end 0)))
+       ((match-beginning 1) (funcall push (getenv (match-string 1 qstr))
+                                     (- (match-end 0))))
+       ((eq (aref qstr match) ?\") (setq dquotes (not dquotes)))
+       ((eq (aref qstr match) ?\')
+        (cond
+         (dquotes (funcall push "'" (match-end 0)))
+         ((< match (1+ (length qstr)))
+          (let ((end (string-match "'" qstr (1+ match))))
+            (funcall push (substring qstr (1+ match) end)
+                     (or end (length qstr)))))
+         (t nil)))
+       (t (error "Unexpected case in shell--unquote&requote-argument!")))
+      (setq qpos (match-end 0)))
+    (funcall push (substring qstr qpos) (length qstr))
+    (list (mapconcat #'identity (nreverse ustrs) "")
+          qupos #'comint-quote-filename)))
+
+(defun shell--unquote-argument (str)
+  (car (shell--unquote&requote-argument str)))
+(defun shell--requote-argument (upos qstr)
+  ;; See `completion-table-with-quoting'.
+  (let ((res (shell--unquote&requote-argument qstr upos)))
+    (cons (nth 1 res) (nth 2 res))))
+
+(defun shell--parse-pcomplete-arguments ()
   "Parse whitespace separated arguments in the current region."
+  ;; FIXME: share code with shell--unquote&requote-argument.
   (let ((begin (save-excursion (shell-backward-command 1) (point)))
        (end (point))
        begins args)
@@ -394,13 +442,13 @@ Thus, this does not include the shell's current directory.")
             (cond
              ((match-beginning 3)       ;Backslash escape.
               (push (cond
-                     ((null pcomplete-arg-quote-list)
+                     ((null comint-file-name-quote-list)
                       (goto-char (match-beginning 3)) "\\")
                      ((= (match-beginning 3) (match-end 3)) "\\")
                      (t (match-string 3)))
                     arg))
              ((match-beginning 2)       ;Double quote.
-              (push (if (null pcomplete-arg-quote-list) (match-string 2)
+              (push (if (null comint-file-name-quote-list) (match-string 2)
                       (replace-regexp-in-string
                        "\\\\\\(.\\)" "\\1" (match-string 2)))
                     arg))
@@ -430,10 +478,10 @@ Shell buffers.  It implements `shell-completion-execonly' for
        shell-file-name-quote-list)
   (set (make-local-variable 'comint-dynamic-complete-functions)
        shell-dynamic-complete-functions)
+  (setq-local comint-unquote-function #'shell--unquote-argument)
+  (setq-local comint-requote-function #'shell--requote-argument)
   (set (make-local-variable 'pcomplete-parse-arguments-function)
-       #'shell-parse-pcomplete-arguments)
-  (set (make-local-variable 'pcomplete-arg-quote-list)
-       comint-file-name-quote-list)
+       #'shell--parse-pcomplete-arguments)
   (set (make-local-variable 'pcomplete-termination-string)
        (cond ((not comint-completion-addsuffix) "")
              ((stringp comint-completion-addsuffix)
@@ -1194,7 +1242,7 @@ Returns non-nil if successful."
              (variables (mapcar (lambda (x)
                                   (substring x 0 (string-match "=" x)))
                                 process-environment))
-             (suffix (case (char-before start) (?\{ "}") (?\( ")") (t ""))))
+             (suffix (pcase (char-before start) (?\{ "}") (?\( ")") (_ ""))))
         (list start end variables
               :exit-function
               (lambda (s finished)
index c83fe18c9c9692ab1f8a14c2af931778659fc433..37e0b48d31de71e3527dcfb09a1ff57297826aa4 100644 (file)
@@ -28,8 +28,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))       ;For define-minor-mode.
-
 (declare-function widget-convert "wid-edit" (type &rest args))
 (declare-function shell-mode "shell" ())
 
@@ -1354,6 +1352,60 @@ to get different commands to edit and resubmit."
             "M-x ")
      obarray 'commandp t nil 'extended-command-history)))
 
+(defcustom suggest-key-bindings t
+  "Non-nil means show the equivalent key-binding when M-x command has one.
+The value can be a length of time to show the message for.
+If the value is non-nil and not a number, we wait 2 seconds."
+  :group 'keyboard
+  :type '(choice (const :tag "off" nil)
+                 (integer :tag "time" 2)
+                 (other :tag "on")))
+
+(defun execute-extended-command (prefixarg &optional command-name)
+  ;; Based on Fexecute_extended_command in keyboard.c of Emacs.
+  ;; Aaron S. Hawley <aaron.s.hawley(at)gmail.com> 2009-08-24
+  "Read function name, then read its arguments and call it.
+
+To pass a numeric argument to the command you are invoking with, specify
+the numeric argument to this command.
+
+Noninteractively, the argument PREFIXARG is the prefix argument to
+give to the command you invoke, if it asks for an argument."
+  (interactive (list current-prefix-arg (read-extended-command)))
+  ;; Emacs<24 calling-convention was with a single `prefixarg' argument.
+  (if (null command-name) (setq command-name (read-extended-command)))
+  (let* ((function (and (stringp command-name) (intern-soft command-name)))
+         (binding (and suggest-key-bindings
+                      (not executing-kbd-macro)
+                      (where-is-internal function overriding-local-map t))))
+    (unless (commandp function)
+      (error "`%s' is not a valid command name" command-name))
+    (setq this-command function)
+    ;; Normally `real-this-command' should never be changed, but here we really
+    ;; want to pretend that M-x <cmd> RET is nothing more than a "key
+    ;; binding" for <cmd>, so the command the user really wanted to run is
+    ;; `function' and not `execute-extended-command'.  The difference is
+    ;; visible in cases such as M-x <cmd> RET and then C-x z (bug#11506).
+    (setq real-this-command function)
+    (let ((prefix-arg prefixarg))
+      (command-execute function 'record))
+    ;; If enabled, show which key runs this command.
+    (when binding
+      ;; But first wait, and skip the message if there is input.
+      (let* ((waited
+              ;; If this command displayed something in the echo area;
+              ;; wait a few seconds, then display our suggestion message.
+              (sit-for (cond
+                        ((zerop (length (current-message))) 0)
+                        ((numberp suggest-key-bindings) suggest-key-bindings)
+                        (t 2)))))
+        (when (and waited (not (consp unread-command-events)))
+          (with-temp-message
+              (format "You can run the command `%s' with %s"
+                      function (key-description binding))
+            (sit-for (if (numberp suggest-key-bindings)
+                         suggest-key-bindings
+                       2))))))))
 \f
 (defvar minibuffer-history nil
   "Default minibuffer history list.
@@ -1415,7 +1467,7 @@ See also `minibuffer-history-case-insensitive-variables'."
      (list (if (string= regexp "")
               (if minibuffer-history-search-history
                   (car minibuffer-history-search-history)
-                (error "No previous history search regexp"))
+                (user-error "No previous history search regexp"))
             regexp)
           (prefix-numeric-value current-prefix-arg))))
   (unless (zerop n)
@@ -1441,9 +1493,9 @@ See also `minibuffer-history-case-insensitive-variables'."
        (setq prevpos pos)
        (setq pos (min (max 1 (+ pos (if (< n 0) -1 1))) (length history)))
        (when (= pos prevpos)
-         (error (if (= pos 1)
-                    "No later matching history item"
-                  "No earlier matching history item")))
+         (user-error (if (= pos 1)
+                          "No later matching history item"
+                        "No earlier matching history item")))
        (setq match-string
              (if (eq minibuffer-history-sexp-flag (minibuffer-depth))
                  (let ((print-level nil))
@@ -1486,7 +1538,7 @@ makes the search case-sensitive."
      (list (if (string= regexp "")
               (if minibuffer-history-search-history
                   (car minibuffer-history-search-history)
-                (error "No previous history search regexp"))
+                (user-error "No previous history search regexp"))
             regexp)
           (prefix-numeric-value current-prefix-arg))))
   (previous-matching-history-element regexp (- n)))
@@ -1545,11 +1597,11 @@ The argument NABS specifies the absolute history position."
        (setq minibuffer-text-before-history
              (minibuffer-contents-no-properties)))
     (if (< nabs minimum)
-       (if minibuffer-default
-           (error "End of defaults; no next item")
-         (error "End of history; no default available")))
+       (user-error (if minibuffer-default
+                        "End of defaults; no next item"
+                      "End of history; no default available")))
     (if (> nabs (length (symbol-value minibuffer-history-variable)))
-       (error "Beginning of history; no preceding item"))
+       (user-error "Beginning of history; no preceding item"))
     (unless (memq last-command '(next-history-element
                                 previous-history-element))
       (let ((prompt-end (minibuffer-prompt-end)))
@@ -1649,58 +1701,50 @@ Intended to be added to `minibuffer-setup-hook'."
 
 (defun minibuffer-history-isearch-search ()
   "Return the proper search function, for isearch in minibuffer history."
-  (cond
-   (isearch-word
-    (if isearch-forward 'word-search-forward 'word-search-backward))
-   (t
-    (lambda (string bound noerror)
-      (let ((search-fun
-            ;; Use standard functions to search within minibuffer text
-             (cond
-              (isearch-regexp
-               (if isearch-forward 're-search-forward 're-search-backward))
-              (t
-               (if isearch-forward 'search-forward 'search-backward))))
-           found)
-       ;; Avoid lazy-highlighting matches in the minibuffer prompt when
-       ;; searching forward.  Lazy-highlight calls this lambda with the
-       ;; bound arg, so skip the minibuffer prompt.
-       (if (and bound isearch-forward (< (point) (minibuffer-prompt-end)))
-           (goto-char (minibuffer-prompt-end)))
-        (or
-        ;; 1. First try searching in the initial minibuffer text
-        (funcall search-fun string
-                 (if isearch-forward bound (minibuffer-prompt-end))
-                 noerror)
-        ;; 2. If the above search fails, start putting next/prev history
-        ;; elements in the minibuffer successively, and search the string
-        ;; in them.  Do this only when bound is nil (i.e. not while
-        ;; lazy-highlighting search strings in the current minibuffer text).
-        (unless bound
-          (condition-case nil
-              (progn
-                (while (not found)
-                  (cond (isearch-forward
-                         (next-history-element 1)
-                         (goto-char (minibuffer-prompt-end)))
-                        (t
-                         (previous-history-element 1)
-                         (goto-char (point-max))))
-                  (setq isearch-barrier (point) isearch-opoint (point))
-                  ;; After putting the next/prev history element, search
-                  ;; the string in them again, until next-history-element
-                  ;; or previous-history-element raises an error at the
-                  ;; beginning/end of history.
-                  (setq found (funcall search-fun string
-                                       (unless isearch-forward
-                                         ;; For backward search, don't search
-                                         ;; in the minibuffer prompt
-                                         (minibuffer-prompt-end))
-                                       noerror)))
-                ;; Return point of the new search result
-                (point))
-            ;; Return nil when next(prev)-history-element fails
-            (error nil)))))))))
+  (lambda (string bound noerror)
+    (let ((search-fun
+          ;; Use standard functions to search within minibuffer text
+          (isearch-search-fun-default))
+         found)
+      ;; Avoid lazy-highlighting matches in the minibuffer prompt when
+      ;; searching forward.  Lazy-highlight calls this lambda with the
+      ;; bound arg, so skip the minibuffer prompt.
+      (if (and bound isearch-forward (< (point) (minibuffer-prompt-end)))
+         (goto-char (minibuffer-prompt-end)))
+      (or
+       ;; 1. First try searching in the initial minibuffer text
+       (funcall search-fun string
+               (if isearch-forward bound (minibuffer-prompt-end))
+               noerror)
+       ;; 2. If the above search fails, start putting next/prev history
+       ;; elements in the minibuffer successively, and search the string
+       ;; in them.  Do this only when bound is nil (i.e. not while
+       ;; lazy-highlighting search strings in the current minibuffer text).
+       (unless bound
+        (condition-case nil
+            (progn
+              (while (not found)
+                (cond (isearch-forward
+                       (next-history-element 1)
+                       (goto-char (minibuffer-prompt-end)))
+                      (t
+                       (previous-history-element 1)
+                       (goto-char (point-max))))
+                (setq isearch-barrier (point) isearch-opoint (point))
+                ;; After putting the next/prev history element, search
+                ;; the string in them again, until next-history-element
+                ;; or previous-history-element raises an error at the
+                ;; beginning/end of history.
+                (setq found (funcall search-fun string
+                                     (unless isearch-forward
+                                       ;; For backward search, don't search
+                                       ;; in the minibuffer prompt
+                                       (minibuffer-prompt-end))
+                                     noerror)))
+              ;; Return point of the new search result
+              (point))
+          ;; Return nil when next(prev)-history-element fails
+          (error nil)))))))
 
 (defun minibuffer-history-isearch-message (&optional c-q-hack ellipsis)
   "Display the minibuffer history search prompt.
@@ -1731,14 +1775,13 @@ Otherwise, it displays the standard isearch message returned from
   "Wrap the minibuffer history search when search fails.
 Move point to the first history element for a forward search,
 or to the last history element for a backward search."
-  (unless isearch-word
-    ;; When `minibuffer-history-isearch-search' fails on reaching the
-    ;; beginning/end of the history, wrap the search to the first/last
-    ;; minibuffer history element.
-    (if isearch-forward
-       (goto-history-element (length (symbol-value minibuffer-history-variable)))
-      (goto-history-element 0))
-    (setq isearch-success t))
+  ;; When `minibuffer-history-isearch-search' fails on reaching the
+  ;; beginning/end of the history, wrap the search to the first/last
+  ;; minibuffer history element.
+  (if isearch-forward
+      (goto-history-element (length (symbol-value minibuffer-history-variable)))
+    (goto-history-element 0))
+  (setq isearch-success t)
   (goto-char (if isearch-forward (minibuffer-prompt-end) (point-max))))
 
 (defun minibuffer-history-isearch-push-state ()
@@ -1895,8 +1938,8 @@ Some change-hooks test this variable to do something different.")
 Call `undo-start' to get ready to undo recent changes,
 then call `undo-more' one or more times to undo them."
   (or (listp pending-undo-list)
-      (error (concat "No further undo information"
-                    (and undo-in-region " for region"))))
+      (user-error (concat "No further undo information"
+                          (and undo-in-region " for region"))))
   (let ((undo-in-progress t))
     ;; Note: The following, while pulling elements off
     ;; `pending-undo-list' will call primitive change functions which
@@ -1922,7 +1965,7 @@ If BEG and END are specified, then only undo elements
 that apply to text between BEG and END are used; other undo elements
 are ignored.  If BEG and END are nil, all undo elements are used."
   (if (eq buffer-undo-list t)
-      (error "No undo information in this buffer"))
+      (user-error "No undo information in this buffer"))
   (setq pending-undo-list
        (if (and beg end (not (= beg end)))
            (undo-make-selective-list (min beg end) (max beg end))
@@ -2150,7 +2193,7 @@ of `history-length', which see.")
   "Switch used to have the shell execute its command line argument.")
 
 (defvar shell-command-default-error-buffer nil
-  "*Buffer name for `shell-command' and `shell-command-on-region' error output.
+  "Buffer name for `shell-command' and `shell-command-on-region' error output.
 This buffer is used when `shell-command' or `shell-command-on-region'
 is run interactively.  A value of nil means that output to stderr and
 stdout will be intermixed in the output stream.")
@@ -2999,41 +3042,43 @@ be copied into other buffers."
 
 (defvar interprogram-cut-function nil
   "Function to call to make a killed region available to other programs.
+Most window systems provide a facility for cutting and pasting
+text between different programs, such as the clipboard on X and
+MS-Windows, or the pasteboard on Nextstep/Mac OS.
 
-Most window systems provide some sort of facility for cutting and
-pasting text between the windows of different programs.
-This variable holds a function that Emacs calls whenever text
-is put in the kill ring, to make the new kill available to other
-programs.
-
-The function takes one argument, TEXT, which is a string containing
-the text which should be made available.")
+This variable holds a function that Emacs calls whenever text is
+put in the kill ring, to make the new kill available to other
+programs.  The function takes one argument, TEXT, which is a
+string containing the text which should be made available.")
 
 (defvar interprogram-paste-function nil
   "Function to call to get text cut from other programs.
-
-Most window systems provide some sort of facility for cutting and
-pasting text between the windows of different programs.
-This variable holds a function that Emacs calls to obtain
-text that other programs have provided for pasting.
-
-The function should be called with no arguments.  If the function
-returns nil, then no other program has provided such text, and the top
-of the Emacs kill ring should be used.  If the function returns a
-string, then the caller of the function \(usually `current-kill')
-should put this string in the kill ring as the latest kill.
-
-This function may also return a list of strings if the window
+Most window systems provide a facility for cutting and pasting
+text between different programs, such as the clipboard on X and
+MS-Windows, or the pasteboard on Nextstep/Mac OS.
+
+This variable holds a function that Emacs calls to obtain text
+that other programs have provided for pasting.  The function is
+called with no arguments.  If no other program has provided text
+to paste, the function should return nil (in which case the
+caller, usually `current-kill', should use the top of the Emacs
+kill ring).  If another program has provided text to paste, the
+function should return that text as a string (in which case the
+caller should put this string in the kill ring as the latest
+kill).
+
+The function may also return a list of strings if the window
 system supports multiple selections.  The first string will be
-used as the pasted text, but the other will be placed in the
-kill ring for easy access via `yank-pop'.
-
-Note that the function should return a string only if a program other
-than Emacs has provided a string for pasting; if Emacs provided the
-most recent string, the function should return nil.  If it is
-difficult to tell whether Emacs or some other program provided the
-current string, it is probably good enough to return nil if the string
-is equal (according to `string=') to the last text Emacs provided.")
+used as the pasted text, but the other will be placed in the kill
+ring for easy access via `yank-pop'.
+
+Note that the function should return a string only if a program
+other than Emacs has provided a string for pasting; if Emacs
+provided the most recent string, the function should return nil.
+If it is difficult to tell whether Emacs or some other program
+provided the current string, it is probably good enough to return
+nil if the string is equal (according to `string=') to the last
+text Emacs provided.")
 \f
 
 
@@ -3139,7 +3184,10 @@ If `interprogram-cut-function' is set, pass the resulting kill to it."
 (set-advertised-calling-convention 'kill-append '(string before-p) "23.3")
 
 (defcustom yank-pop-change-selection nil
-  "If non-nil, rotating the kill ring changes the window system selection."
+  "Whether rotating the kill ring changes the window system selection.
+If non-nil, whenever the kill ring is rotated (usually via the
+`yank-pop' command), Emacs also calls `interprogram-cut-function'
+to copy the new kill to the window system selection."
   :type 'boolean
   :group 'killing
   :version "23.1")
@@ -3194,10 +3242,6 @@ move the yanking point; just return the Nth kill forward."
   :type 'boolean
   :group 'killing)
 
-(put 'text-read-only 'error-conditions
-     '(text-read-only buffer-read-only error))
-(put 'text-read-only 'error-message (purecopy "Text is read-only"))
-
 (defun kill-region (beg end &optional yank-handler)
   "Kill (\"cut\") text between point and mark.
 This deletes the text from the buffer and saves it in the kill ring.
@@ -3487,14 +3531,14 @@ and KILLP is t if a prefix arg was specified."
   "Kill up to and including ARGth occurrence of CHAR.
 Case is ignored if `case-fold-search' is non-nil in the current buffer.
 Goes backward if ARG is negative; error if CHAR not found."
-  (interactive "p\ncZap to char: ")
+  (interactive (list (prefix-numeric-value current-prefix-arg)
+                    (read-char "Zap to char: " t)))
   ;; Avoid "obsolete" warnings for translation-table-for-input.
   (with-no-warnings
     (if (char-table-p translation-table-for-input)
        (setq char (or (aref translation-table-for-input char) char))))
   (kill-region (point) (progn
                         (search-forward (char-to-string char) nil nil arg)
-;                       (goto-char (if (> arg 0) (1- (point)) (1+ (point))))
                         (point))))
 
 ;; kill-line and its subroutines.
@@ -3817,7 +3861,11 @@ run `deactivate-mark-hook'."
       (cond (saved-region-selection
             (x-set-selection 'PRIMARY saved-region-selection)
             (setq saved-region-selection nil))
-           ((/= (region-beginning) (region-end))
+           ;; If another program has acquired the selection, region
+           ;; deactivation should not clobber it (Bug#11772).
+           ((and (/= (region-beginning) (region-end))
+                 (or (x-selection-owner-p 'PRIMARY)
+                     (null (x-selection-exists-p 'PRIMARY))))
             (x-set-selection 'PRIMARY
                              (buffer-substring-no-properties
                               (region-beginning)
@@ -4405,23 +4453,25 @@ lines."
 ;; a cleaner solution to the problem of making C-n do something
 ;; useful given a tall image.
 (defun line-move (arg &optional noerror to-end try-vscroll)
-  (unless (and auto-window-vscroll try-vscroll
-              ;; Only vscroll for single line moves
-              (= (abs arg) 1)
-              ;; But don't vscroll in a keyboard macro.
-              (not defining-kbd-macro)
-              (not executing-kbd-macro)
-              (line-move-partial arg noerror to-end))
-    (set-window-vscroll nil 0 t)
-    (if (and line-move-visual
-            ;; Display-based column are incompatible with goal-column.
-            (not goal-column)
-            ;; When the text in the window is scrolled to the left,
-            ;; display-based motion doesn't make sense (because each
-            ;; logical line occupies exactly one screen line).
-            (not (> (window-hscroll) 0)))
-       (line-move-visual arg noerror)
-      (line-move-1 arg noerror to-end))))
+  (if noninteractive
+      (forward-line arg)
+    (unless (and auto-window-vscroll try-vscroll
+                ;; Only vscroll for single line moves
+                (= (abs arg) 1)
+                ;; But don't vscroll in a keyboard macro.
+                (not defining-kbd-macro)
+                (not executing-kbd-macro)
+                (line-move-partial arg noerror to-end))
+      (set-window-vscroll nil 0 t)
+      (if (and line-move-visual
+              ;; Display-based column are incompatible with goal-column.
+              (not goal-column)
+              ;; When the text in the window is scrolled to the left,
+              ;; display-based motion doesn't make sense (because each
+              ;; logical line occupies exactly one screen line).
+              (not (> (window-hscroll) 0)))
+         (line-move-visual arg noerror)
+       (line-move-1 arg noerror to-end)))))
 
 ;; Display-based alternative to line-move-1.
 ;; Arg says how many lines to move.  The value is t if we can move the
@@ -5321,7 +5371,7 @@ Returns t if it really did any work."
       t)))
 
 (defvar comment-line-break-function 'comment-indent-new-line
-  "*Mode-specific function which line breaks and continues a comment.
+  "Mode-specific function which line breaks and continues a comment.
 This function is called during auto-filling when a comment syntax
 is defined.
 The function should take a single optional argument, which is a flag
@@ -5382,7 +5432,9 @@ non-`nil'.
 
 The value of `normal-auto-fill-function' specifies the function to use
 for `auto-fill-function' when turning Auto Fill mode on."
-  :variable (eq auto-fill-function normal-auto-fill-function))
+  :variable (auto-fill-function
+             . (lambda (v) (setq auto-fill-function
+                            (if v normal-auto-fill-function)))))
 
 ;; This holds a document string used to document auto-fill-mode.
 (defun auto-fill-function ()
@@ -5495,7 +5547,8 @@ the line.  Before a tab, such characters insert until the tab is
 filled in.  \\[quoted-insert] still inserts characters in
 overwrite mode; this is supposed to make it easier to insert
 characters when necessary."
-  :variable (eq overwrite-mode 'overwrite-mode-textual))
+  :variable (overwrite-mode
+             . (lambda (v) (setq overwrite-mode (if v 'overwrite-mode-textual)))))
 
 (define-minor-mode binary-overwrite-mode
   "Toggle Binary Overwrite mode.
@@ -5514,7 +5567,8 @@ ordinary typing characters do.
 Note that Binary Overwrite mode is not its own minor mode; it is
 a specialization of overwrite mode, entered by setting the
 `overwrite-mode' variable to `overwrite-mode-binary'."
-  :variable (eq overwrite-mode 'overwrite-mode-binary))
+  :variable (overwrite-mode
+             . (lambda (v) (setq overwrite-mode (if v 'overwrite-mode-binary)))))
 
 (define-minor-mode line-number-mode
   "Toggle line number display in the mode line (Line Number mode).
@@ -5983,7 +6037,7 @@ in the definition is used to check that VALUE is valid.
 With a prefix argument, set VARIABLE to VALUE buffer-locally."
   (interactive
    (let* ((default-var (variable-at-point))
-          (var (if (user-variable-p default-var)
+          (var (if (custom-variable-p default-var)
                   (read-variable (format "Set variable (default %s): " default-var)
                                  default-var)
                 (read-variable "Set variable: ")))
@@ -6159,21 +6213,11 @@ With prefix argument N, move N items (negative N means move backward)."
                (setq beg (previous-single-property-change beg 'mouse-face))
                (setq end (or (next-single-property-change end 'mouse-face)
                              (point-max)))
-               (buffer-substring-no-properties beg end))))
-          (owindow (selected-window)))
+               (buffer-substring-no-properties beg end)))))
 
       (unless (buffer-live-p buffer)
         (error "Destination buffer is dead"))
-      (select-window (posn-window (event-start event)))
-      (if (and (one-window-p t 'selected-frame)
-              (window-dedicated-p (selected-window)))
-         ;; This is a special buffer's frame
-         (iconify-frame (selected-frame))
-       (or (window-dedicated-p (selected-window))
-           (bury-buffer)))
-      (select-window
-       (or (get-buffer-window buffer 0)
-           owindow))
+      (quit-window nil (posn-window (event-start event)))
 
       (with-current-buffer buffer
         (choose-completion-string
@@ -6310,7 +6354,7 @@ Use \\<completion-list-mode-map>\\[mouse-choose-completion] to select one\
   "Finish setup of the completions buffer.
 Called from `temp-buffer-show-hook'."
   (when (eq major-mode 'completion-list-mode)
-    (toggle-read-only 1)))
+    (setq buffer-read-only t)))
 
 (add-hook 'temp-buffer-show-hook 'completion-list-mode-finish)
 
@@ -6747,8 +6791,10 @@ probably not turn on this mode on a text-only terminal if you don't
 have both Backspace, Delete and F1 keys.
 
 See also `normal-erase-is-backspace'."
-  :variable (eq (terminal-parameter
-                 nil 'normal-erase-is-backspace) 1)
+  :variable ((eq (terminal-parameter nil 'normal-erase-is-backspace) 1)
+             . (lambda (v)
+                 (setf (terminal-parameter nil 'normal-erase-is-backspace)
+                       (if v 1 0))))
   (let ((enabled (eq 1 (terminal-parameter
                         nil 'normal-erase-is-backspace))))
 
index 0f28d32293b55460a16dc204bba78c1ec6699937..34d69a74369ef6ebe4c574108774983d56339a26 100644 (file)
@@ -37,7 +37,7 @@
 
 
 (defvar skeleton-transformation-function 'identity
-  "*If non-nil, function applied to literal strings before they are inserted.
+  "If non-nil, function applied to literal strings before they are inserted.
 It should take strings and characters and return them transformed, or nil
 which means no transformation.
 Typical examples might be `upcase' or `capitalize'.")
@@ -95,11 +95,11 @@ skeleton elements.")
 (defvar skeleton-subprompt
   (substitute-command-keys
    "RET, \\<minibuffer-local-map>\\[abort-recursive-edit] or \\[help-command]")
-  "*Replacement for %s in prompts of recursive subskeletons.")
+  "Replacement for %s in prompts of recursive subskeletons.")
 
 
 (defvar skeleton-debug nil
-  "*If non-nil `define-skeleton' will override previous definition.")
+  "If non-nil `define-skeleton' will override previous definition.")
 
 (defvar skeleton-positions nil
   "List of positions marked with @, after skeleton insertion.
@@ -121,7 +121,7 @@ are integer buffer positions in the reverse order of the insertion order.")
   "Define a user-configurable COMMAND that enters a statement skeleton.
 DOCUMENTATION is that of the command.
 SKELETON is as defined under `skeleton-insert'."
-  (declare (debug (&define name stringp skeleton-edebug-spec)))
+  (declare (doc-string 2) (debug (&define name stringp skeleton-edebug-spec)))
   (if skeleton-debug
       (set command skeleton))
   `(progn
@@ -456,7 +456,7 @@ automatically, and you are prompted to fill in the variable parts.")))
 ;;                  obarray
 ;;                  (lambda (symbol)
 ;;                    (or (eq symbol 'eval)
-;;                        (user-variable-p symbol)))
+;;                        (custom-variable-p symbol)))
 ;;                  t)
 ;;    comment-start str ": "
 ;;    (read-from-minibuffer "Expression: " nil read-expression-map nil
@@ -468,13 +468,13 @@ automatically, and you are prompted to fill in the variable parts.")))
 ;; Variables and command for automatically inserting pairs like () or "".
 
 (defvar skeleton-pair nil
-  "*If this is nil pairing is turned off, no matter what else is set.
+  "If this is nil pairing is turned off, no matter what else is set.
 Otherwise modes with `skeleton-pair-insert-maybe' on some keys
 will attempt to insert pairs of matching characters.")
 
 
 (defvar skeleton-pair-on-word nil
-  "*If this is nil, paired insertion is inhibited before or inside a word.")
+  "If this is nil, paired insertion is inhibited before or inside a word.")
 
 
 (defvar skeleton-pair-filter-function (lambda () nil)
index bb1debb45528b8847a27e546c857ea238428593b..d8c8c4a56bec7f111302adb6f65a610d9ebbdd03 100644 (file)
@@ -1,6 +1,6 @@
 ;;; speedbar --- quick access to files and tags in a frame
 
-;; Copyright (C) 1996-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1996-2012 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: file, tags, tools
@@ -125,7 +125,6 @@ this version is not backward compatible to 0.14 or earlier.")
 ;;; TODO:
 ;; - Timeout directories we haven't visited in a while.
 
-(require 'assoc)
 (require 'easymenu)
 (require 'dframe)
 (require 'sb-image)
@@ -775,6 +774,8 @@ If you want to change this while speedbar is active, either use
 (defvar speedbar-update-flag-disable nil
   "Permanently disable changing of the update flag.")
 
+(define-obsolete-variable-alias
+  'speedbar-syntax-table 'speedbar-mode-syntax-table "24.1")
 (defvar speedbar-mode-syntax-table
   (let ((st (make-syntax-table)))
     ;; Turn off paren matching around here.
@@ -788,10 +789,9 @@ If you want to change this while speedbar is active, either use
     (modify-syntax-entry ?\]  " " st)
     st)
   "Syntax-table used on the speedbar.")
-(define-obsolete-variable-alias
-  'speedbar-syntax-table 'speedbar-mode-syntax-table "24.1")
 
 
+(define-obsolete-variable-alias 'speedbar-key-map 'speedbar-mode-map "24.1")
 (defvar speedbar-mode-map
   (let ((map (make-keymap)))
     (suppress-keymap map t)
@@ -826,7 +826,6 @@ If you want to change this while speedbar is active, either use
     (dframe-update-keymap map)
     map)
   "Keymap used in speedbar buffer.")
-(define-obsolete-variable-alias 'speedbar-key-map 'speedbar-mode-map "24.1")
 
 (defun speedbar-make-specialized-keymap ()
   "Create a keymap for use with a speedbar major or minor display mode.
@@ -1022,7 +1021,7 @@ supported at a time.
   (set (make-local-variable 'dframe-delete-frame-function)
        'speedbar-handle-delete-frame)
   ;; hscroll
-  (set (make-local-variable 'automatic-hscrolling) nil) ; Emacs 21
+  (set (make-local-variable 'auto-hscroll-mode) nil)
   ;; reset the selection variable
   (setq speedbar-last-selected-file nil))
 
@@ -1413,9 +1412,10 @@ Argument ARG represents to force a refresh past any caches that may exist."
        (dframe-power-click arg)
        deactivate-mark)
     ;; We need to hack something so this works in detached frames.
-    (while dl
-      (adelete 'speedbar-directory-contents-alist (car dl))
-      (setq dl (cdr dl)))
+    (dolist (d dl)
+      (setq speedbar-directory-contents-alist
+            (delq (assoc d speedbar-directory-contents-alist)
+                  speedbar-directory-contents-alist)))
     (if (<= 1 speedbar-verbosity-level)
        (speedbar-message "Refreshing speedbar..."))
     (speedbar-update-contents)
@@ -1898,12 +1898,9 @@ matching ignored headers.  Cache any directory files found in
 `speedbar-directory-contents-alist' and use that cache before scanning
 the file-system."
   (setq directory (expand-file-name directory))
-  ;; If in powerclick mode, then the directory we are getting
-  ;; should be rescanned.
-  (if dframe-power-click
-      (adelete 'speedbar-directory-contents-alist directory))
   ;; find the directory, either in the cache, or build it.
-  (or (cdr-safe (assoc directory speedbar-directory-contents-alist))
+  (or (and (not dframe-power-click) ;; In powerclick mode, always rescan.
+           (cdr-safe (assoc directory speedbar-directory-contents-alist)))
       (let ((default-directory directory)
            (dir (directory-files directory nil))
            (dirs nil)
@@ -1917,8 +1914,11 @@ the file-system."
                  (setq dirs (cons (car dir) dirs))
                (setq files (cons (car dir) files))))
          (setq dir (cdr dir)))
-       (let ((nl (cons (nreverse dirs) (list (nreverse files)))))
-         (aput 'speedbar-directory-contents-alist directory nl)
+       (let ((nl (cons (nreverse dirs) (list (nreverse files))))
+              (ae (assoc directory speedbar-directory-contents-alist)))
+          (if ae (setcdr ae nl)
+            (push (cons directory nl)
+                  speedbar-directory-contents-alist))
          nl))
       ))
 
@@ -4005,73 +4005,68 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
 ;;; Color loading section.
 ;;
 (defface speedbar-button-face '((((class color) (background light))
-                                (:foreground "green4"))
+                                :foreground "green4")
                                (((class color) (background dark))
-                                (:foreground "green3")))
-  "Face used for +/- buttons."
+                                :foreground "green3"))
+  "Speedbar face for +/- buttons."
   :group 'speedbar-faces)
 
 (defface speedbar-file-face '((((class color) (background light))
-                              (:foreground "cyan4"))
+                              :foreground "cyan4")
                              (((class color) (background dark))
-                              (:foreground "cyan"))
-                             (t (:bold t)))
-  "Face used for file names."
+                              :foreground "cyan")
+                             (t :weight bold))
+  "Speedbar face for file names."
   :group 'speedbar-faces)
 
 (defface speedbar-directory-face '((((class color) (background light))
-                                   (:foreground "blue4"))
+                                   :foreground "blue4")
                                   (((class color) (background dark))
-                                   (:foreground "light blue")))
-  "Face used for directory names."
+                                   :foreground "light blue"))
+  "Speedbar face for directory names."
   :group 'speedbar-faces)
+
 (defface speedbar-tag-face '((((class color) (background light))
-                             (:foreground "brown"))
+                             :foreground "brown")
                             (((class color) (background dark))
-                             (:foreground "yellow")))
-  "Face used for displaying tags."
+                             :foreground "yellow"))
+  "Speedbar face for tags."
   :group 'speedbar-faces)
 
 (defface speedbar-selected-face '((((class color) (background light))
-                                   (:foreground "red" :underline t))
+                                  :foreground "red" :underline t)
                                  (((class color) (background dark))
-                                  (:foreground "red" :underline t))
-                                 (t (:underline t)))
-  "Face used to underline the file in the active window."
+                                  :foreground "red" :underline t)
+                                 (t :underline t))
+  "Speedbar face for the file in the active window."
   :group 'speedbar-faces)
 
 (defface speedbar-highlight-face '((((class color) (background light))
-                                   (:background "green"))
+                                   :background "green")
                                   (((class color) (background dark))
-                                   (:background "sea green"))
-                                  (((class grayscale monochrome)
-                                    (background light))
-                                   (:background "black"))
-                                  (((class grayscale monochrome)
-                                    (background dark))
-                                   (:background "white")))
-  "Face used for highlighting buttons with the mouse."
+                                   :background "sea green"))
+  "Speedbar face for highlighting buttons with the mouse."
   :group 'speedbar-faces)
 
 (defface speedbar-separator-face '((((class color) (background light))
-                                   (:background "blue"
-                                    :foreground "white"
-                                    :overline "gray"))
+                                   :background "blue"
+                                   :foreground "white"
+                                   :overline "gray")
                                   (((class color) (background dark))
-                                   (:background "blue"
-                                    :foreground "white"
-                                    :overline "gray"))
+                                   :background "blue"
+                                   :foreground "white"
+                                   :overline "gray")
                                   (((class grayscale monochrome)
                                     (background light))
-                                   (:background "black"
-                                    :foreground "white"
-                                    :overline "white"))
+                                   :background "black"
+                                   :foreground "white"
+                                   :overline "white")
                                   (((class grayscale monochrome)
                                     (background dark))
-                                   (:background "white"
-                                    :foreground "black"
-                                    :overline "black")))
-  "Face used for separator labels in a display."
+                                   :background "white"
+                                   :foreground "black"
+                                   :overline "black"))
+  "Speedbar face for separator labels in a display."
   :group 'speedbar-faces)
 
 ;; some edebug hooks
index 5c905954c862bfaaad98a6fd2fbae68df55f558e..3adc2caa04a70f0d3b071a4fe11b6198901623d7 100644 (file)
@@ -101,16 +101,15 @@ the remaining command-line args are in the variable `command-line-args-left'.")
   "List of command-line args not yet processed.")
 
 (defvaralias 'argv 'command-line-args-left
-  ;; FIXME: Bad name for a dynamically bound variable.
   "List of command-line args not yet processed.
 This is a convenience alias, so that one can write \(pop argv\)
 inside of --eval command line arguments in order to access
 following arguments.")
+(internal-make-var-non-special 'argv)
 
-(with-no-warnings
-  ;; FIXME: Bad name for a dynamically bound variable
-  (defvar argi nil
-    "Current command-line argument."))
+(defvar argi nil
+  "Current command-line argument.")
+(internal-make-var-non-special 'argi)
 
 (defvar command-line-functions nil    ;; lrs 7/31/89
   "List of functions to process unrecognized command-line arguments.
@@ -124,8 +123,8 @@ altering `command-line-args-left' to remove them.")
   "Default directory to use for command line arguments.
 This is normally copied from `default-directory' when Emacs starts.")
 
-;;; This is here, rather than in x-win.el, so that we can ignore these
-;;; options when we are not using X.
+;; This is here, rather than in x-win.el, so that we can ignore these
+;; options when we are not using X.
 (defconst command-line-x-option-alist
   '(("-bw" 1 x-handle-numeric-switch border-width)
     ("-d" 1 x-handle-display)
@@ -490,13 +489,20 @@ It is the default value of the variable `top-level'."
     ;; of that dir into load-path,
     ;; Look for a leim-list.el file too.  Loading it will register
     ;; available input methods.
-    (let ((tail load-path) dir)
+    (let ((tail load-path)
+          (lispdir (expand-file-name "../lisp" data-directory))
+         ;; For out-of-tree builds, leim-list is generated in the build dir.
+;;;          (leimdir (expand-file-name "../leim" doc-directory))
+          dir)
       (while tail
         (setq dir (car tail))
         (let ((default-directory dir))
           (load (expand-file-name "subdirs.el") t t t))
-        (let ((default-directory dir))
-          (load (expand-file-name "leim-list.el") t t t))
+       ;; Do not scan standard directories that won't contain a leim-list.el.
+       ;; http://lists.gnu.org/archive/html/emacs-devel/2009-10/msg00502.html
+       (or (string-match (concat "\\`" lispdir) dir)
+           (let ((default-directory dir))
+             (load (expand-file-name "leim-list.el") t t t)))
         ;; We don't use a dolist loop and we put this "setq-cdr" command at
         ;; the end, because the subdirs.el files may add elements to the end
         ;; of load-path and we want to take it into account.
@@ -898,33 +904,12 @@ Amongst another things, it parses the command-line arguments."
 
   (run-hooks 'before-init-hook)
 
-  ;; Under X, this creates the X frame and deletes the terminal frame.
+  ;; Under X, create the X frame and delete the terminal frame.
   (unless (daemonp)
-
-    ;; If X resources are available, use them to initialize the values
-    ;; of `tool-bar-mode' and `menu-bar-mode', as well as the value of
-    ;; `no-blinking-cursor' and the `cursor' face.
-    (cond
-     ((or noninteractive emacs-basic-display)
-      (setq menu-bar-mode nil
-           tool-bar-mode nil
-           no-blinking-cursor t))
-     ((memq initial-window-system '(x w32 ns))
-      (let ((no-vals  '("no" "off" "false" "0")))
-       (if (member (x-get-resource "menuBar" "MenuBar") no-vals)
-           (setq menu-bar-mode nil))
-       (if (member (x-get-resource "toolBar" "ToolBar") no-vals)
-           (setq tool-bar-mode nil))
-       (if (member (x-get-resource "cursorBlink" "CursorBlink")
-                   no-vals)
-           (setq no-blinking-cursor t)))
-      ;; If the cursorColor X resource exists, alter the `cursor' face
-      ;; spec, but mark it as changed outside of Customize.
-      (let ((color (x-get-resource "cursorColor" "Foreground")))
-       (when color
-         (put 'cursor 'theme-face
-              `((changed ((t :background ,color)))))
-         (put 'cursor 'face-modified t)))))
+    (if (or noninteractive emacs-basic-display)
+       (setq menu-bar-mode nil
+             tool-bar-mode nil
+             no-blinking-cursor t))
     (frame-initialize))
 
   (when (fboundp 'x-create-frame)
@@ -1162,38 +1147,6 @@ the `--debug-init' option to view a complete error backtrace."
                                            (or mail-host-address
                                                (system-name))))))
 
-    ;; Originally face attributes were specified via
-    ;; `font-lock-face-attributes'.  Users then changed the default
-    ;; face attributes by setting that variable.  However, we try and
-    ;; be back-compatible and respect its value if set except for
-    ;; faces where M-x customize has been used to save changes for the
-    ;; face.
-    (when (boundp 'font-lock-face-attributes)
-      (let ((face-attributes font-lock-face-attributes))
-       (while face-attributes
-         (let* ((face-attribute (pop face-attributes))
-                (face (car face-attribute)))
-           ;; Rustle up a `defface' SPEC from a
-           ;; `font-lock-face-attributes' entry.
-           (unless (get face 'saved-face)
-             (let ((foreground (nth 1 face-attribute))
-                   (background (nth 2 face-attribute))
-                   (bold-p (nth 3 face-attribute))
-                   (italic-p (nth 4 face-attribute))
-                   (underline-p (nth 5 face-attribute))
-                   face-spec)
-               (when foreground
-                 (setq face-spec (cons ':foreground (cons foreground face-spec))))
-               (when background
-                 (setq face-spec (cons ':background (cons background face-spec))))
-               (when bold-p
-                 (setq face-spec (append '(:weight bold) face-spec)))
-               (when italic-p
-                 (setq face-spec (append '(:slant italic) face-spec)))
-               (when underline-p
-                 (setq face-spec (append '(:underline t) face-spec)))
-               (face-spec-set face (list (list t face-spec)) nil)))))))
-
     ;; If parameter have been changed in the init file which influence
     ;; face realization, clear the face cache so that new faces will
     ;; be realized.
@@ -1291,6 +1244,29 @@ the `--debug-init' option to view a complete error backtrace."
       (with-no-warnings
        (emacs-session-restore x-session-previous-id))))
 
+(defun x-apply-session-resources ()
+  "Apply X resources which specify initial values for Emacs variables.
+This is called from a window-system initialization function, such
+as `x-initialize-window-system' for X, either at startup (prior
+to reading the init file), or afterwards when the user first
+opens a graphical frame.
+
+This can set the values of `menu-bar-mode', `tool-bar-mode', and
+`no-blinking-cursor', as well as the `cursor' face.  Changed
+settings will be marked as \"CHANGED outside of Customize\"."
+  (let ((no-vals  '("no" "off" "false" "0"))
+       (settings '(("menuBar" "MenuBar" menu-bar-mode nil)
+                   ("toolBar" "ToolBar" tool-bar-mode nil)
+                   ("cursorBlink" "CursorBlink" no-blinking-cursor t))))
+    (dolist (x settings)
+      (if (member (x-get-resource (nth 0 x) (nth 1 x)) no-vals)
+         (set (nth 2 x) (nth 3 x)))))
+  (let ((color (x-get-resource "cursorColor" "Foreground")))
+    (when color
+      (put 'cursor 'theme-face
+          `((changed ((t :background ,color)))))
+      (put 'cursor 'face-modified t))))
+
 (defcustom initial-scratch-message (purecopy "\
 ;; This buffer is for notes you don't want to save, and for Lisp evaluation.
 ;; If you want to create a file, visit that file with C-x C-f,
@@ -1515,7 +1491,8 @@ a face or button specification."
                                   (if (image-type-available-p 'xpm)
                                       "splash.xpm"
                                     "splash.pbm"))
-                                 ((image-type-available-p 'svg)
+                                 ((or (image-type-available-p 'svg)
+                                      (image-type-available-p 'imagemagick))
                                   "splash.svg")
                                  ((image-type-available-p 'png)
                                   "splash.png")
index 8b5aa7a76d8c18483b6961041630a45720c27a72..302e441d282bad0c356d709b8439f1d914f7c5c9 100644 (file)
 ;;; Requirements and provisions...
 
 (autoload 'mail-position-on-field "sendmail")
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;; Constants...
 
@@ -212,11 +212,13 @@ static char * stroke_xpm[] = {
   :link '(emacs-commentary-link "strokes")
   :group 'mouse)
 
-(defcustom strokes-modeline-string " Strokes"
-  "Modeline identification when Strokes mode is on \(default is \" Strokes\"\)."
+(defcustom strokes-lighter " Strokes"
+  "Mode line identifier for Strokes mode."
   :type 'string
   :group 'strokes)
 
+(define-obsolete-variable-alias 'strokes-modeline-string 'strokes-lighter "24.2")
+
 (defcustom strokes-character ?@
   "Character used when drawing strokes in the strokes buffer.
 \(The default is `@', which works well.\)"
@@ -540,10 +542,10 @@ The return value is a list ((XMIN . YMIN) (XMAX . YMAX))."
 (defun strokes-eliminate-consecutive-redundancies (entries)
   "Return a list with no consecutive redundant entries."
   ;; defun a grande vitesse grace a Dave G.
-  (loop for element on entries
-        if (not (equal (car element) (cadr element)))
-        collect (car element)))
-;;  (loop for element on entries
+  (cl-loop for element on entries
+           if (not (equal (car element) (cadr element)))
+           collect (car element)))
+;;  (cl-loop for element on entries
 ;;        nconc (if (not (equal (car el) (cadr el)))
 ;;                  (list (car el)))))
 ;; yet another (orig) way of doing it...
@@ -582,68 +584,70 @@ NOTE: This is where the global variable `strokes-last-stroke' is set."
        (if (and (strokes-click-p unfilled-stroke)
                 (not force))
            unfilled-stroke
-         (loop for grid-locs on unfilled-stroke
-               nconc (let* ((current (car grid-locs))
-                            (current-is-a-point-p (consp current))
-                            (next (cadr grid-locs))
-                            (next-is-a-point-p (consp next))
-                            (both-are-points-p (and current-is-a-point-p
-                                                    next-is-a-point-p))
-                            (x1 (and current-is-a-point-p
-                                     (car current)))
-                            (y1 (and current-is-a-point-p
-                                     (cdr current)))
-                            (x2 (and next-is-a-point-p
-                                     (car next)))
-                            (y2 (and next-is-a-point-p
-                                     (cdr next)))
-                            (delta-x (and both-are-points-p
-                                          (- x2 x1)))
-                            (delta-y (and both-are-points-p
-                                          (- y2 y1)))
-                            (slope (and both-are-points-p
-                                        (if (zerop delta-x)
-                                            nil ; undefined vertical slope
-                                          (/ (float delta-y)
-                                             delta-x)))))
-                       (cond ((not both-are-points-p)
-                              (list current))
-                             ((null slope) ; undefined vertical slope
-                              (if (>= delta-y 0)
-                                  (loop for y from y1 below y2
-                                        collect (cons x1 y))
-                                (loop for y from y1 above y2
-                                      collect (cons x1 y))))
-                             ((zerop slope) ; (= y1 y2)
-                              (if (>= delta-x 0)
-                                  (loop for x from x1 below x2
-                                        collect (cons x y1))
-                                (loop for x from x1 above x2
-                                      collect (cons x y1))))
-                             ((>= (abs delta-x) (abs delta-y))
-                              (if (> delta-x 0)
-                                  (loop for x from x1 below x2
-                                        collect (cons x
-                                                      (+ y1
-                                                         (round (* slope
-                                                                   (- x x1))))))
-                                (loop for x from x1 above x2
-                                      collect (cons x
-                                                    (+ y1
-                                                       (round (* slope
-                                                                 (- x x1))))))))
-                             (t        ; (< (abs delta-x) (abs delta-y))
-                              (if (> delta-y 0)
-                                  (loop for y from y1 below y2
-                                        collect (cons (+ x1
-                                                         (round (/ (- y y1)
-                                                                   slope)))
-                                                      y))
-                                (loop for y from y1 above y2
-                                      collect (cons (+ x1
-                                                       (round (/ (- y y1)
-                                                                 slope)))
-                                                    y))))))))))
+         (cl-loop
+           for grid-locs on unfilled-stroke
+           nconc (let* ((current (car grid-locs))
+                        (current-is-a-point-p (consp current))
+                        (next (cadr grid-locs))
+                        (next-is-a-point-p (consp next))
+                        (both-are-points-p (and current-is-a-point-p
+                                                next-is-a-point-p))
+                        (x1 (and current-is-a-point-p
+                                 (car current)))
+                        (y1 (and current-is-a-point-p
+                                 (cdr current)))
+                        (x2 (and next-is-a-point-p
+                                 (car next)))
+                        (y2 (and next-is-a-point-p
+                                 (cdr next)))
+                        (delta-x (and both-are-points-p
+                                      (- x2 x1)))
+                        (delta-y (and both-are-points-p
+                                      (- y2 y1)))
+                        (slope (and both-are-points-p
+                                    (if (zerop delta-x)
+                                        nil ; undefined vertical slope
+                                      (/ (float delta-y)
+                                         delta-x)))))
+                   (cond ((not both-are-points-p)
+                          (list current))
+                         ((null slope)  ; undefined vertical slope
+                          (if (>= delta-y 0)
+                              (cl-loop for y from y1 below y2
+                                       collect (cons x1 y))
+                            (cl-loop for y from y1 above y2
+                                     collect (cons x1 y))))
+                         ((zerop slope) ; (= y1 y2)
+                          (if (>= delta-x 0)
+                              (cl-loop for x from x1 below x2
+                                       collect (cons x y1))
+                            (cl-loop for x from x1 above x2
+                                     collect (cons x y1))))
+                         ((>= (abs delta-x) (abs delta-y))
+                          (if (> delta-x 0)
+                              (cl-loop for x from x1 below x2
+                                       collect (cons x
+                                                     (+ y1
+                                                        (round (* slope
+                                                                  (- x x1))))))
+                            (cl-loop for x from x1 above x2
+                                     collect (cons x
+                                                   (+ y1
+                                                      (round (* slope
+                                                                (- x x1))))))))
+                         (t             ; (< (abs delta-x) (abs delta-y))
+                          (if (> delta-y 0)
+                              ;; FIXME: Reduce redundancy between branches.
+                              (cl-loop for y from y1 below y2
+                                       collect (cons (+ x1
+                                                        (round (/ (- y y1)
+                                                                  slope)))
+                                                     y))
+                            (cl-loop for y from y1 above y2
+                                     collect (cons (+ x1
+                                                      (round (/ (- y y1)
+                                                                slope)))
+                                                   y))))))))))
 
 (defun strokes-rate-stroke (stroke1 stroke2)
   "Rates STROKE1 with STROKE2 and return a score based on a distance metric.
@@ -721,9 +725,9 @@ Returns the corresponding match as (COMMAND . SCORE)."
 (defsubst strokes-fill-current-buffer-with-whitespace ()
   "Erase the contents of the current buffer and fill it with whitespace."
   (erase-buffer)
-  (loop repeat (frame-height) do
-       (insert-char ?\s (1- (frame-width)))
-       (newline))
+  (cl-loop repeat (frame-height) do
+           (insert-char ?\s (1- (frame-width)))
+           (newline))
   (goto-char (point-min)))
 
 ;;;###autoload
@@ -1171,40 +1175,40 @@ the stroke as a character in some language."
       (set-buffer buf)
       (erase-buffer)
       (insert strokes-xpm-header)
-      (loop repeat 33 do
-           (insert ?\")
-           (insert-char ?\s 33)
-           (insert "\",")
-           (newline)
-           finally
-           (forward-line -1)
-           (end-of-line)
-           (insert "}\n"))
-      (loop for point in stroke
-           for x = (car-safe point)
-           for y = (cdr-safe point) do
-           (cond ((consp point)
-                  ;; draw a point, and possibly a starting-point
-                  (if (and lift-flag (not b/w-only))
-                      ;; mark starting point with the appropriate color
-                      (let ((char (or (car rainbow-chars) ?\.)))
-                        (loop for i from 0 to 2 do
-                              (loop for j from 0 to 2 do
-                                    (goto-char (point-min))
-                                    (forward-line (+ 15 i y))
-                                    (forward-char (+ 1 j x))
-                                    (delete-char 1)
-                                    (insert char)))
-                        (setq rainbow-chars (cdr rainbow-chars)
-                              lift-flag nil))
-                    ;; Otherwise, just plot the point...
-                    (goto-char (point-min))
-                    (forward-line (+ 16 y))
-                    (forward-char (+ 2 x))
-                    (subst-char-in-region (point) (1+ (point)) ?\s ?\*)))
-                 ((strokes-lift-p point)
-                  ;; a lift--tell the loop to X out the next point...
-                  (setq lift-flag t))))
+      (cl-loop repeat 33 do
+               (insert ?\")
+               (insert-char ?\s 33)
+               (insert "\",")
+               (newline)
+               finally
+               (forward-line -1)
+               (end-of-line)
+               (insert "}\n"))
+      (cl-loop for point in stroke
+               for x = (car-safe point)
+               for y = (cdr-safe point) do
+               (cond ((consp point)
+                      ;; draw a point, and possibly a starting-point
+                      (if (and lift-flag (not b/w-only))
+                          ;; mark starting point with the appropriate color
+                          (let ((char (or (car rainbow-chars) ?\.)))
+                            (cl-loop for i from 0 to 2 do
+                                     (cl-loop for j from 0 to 2 do
+                                              (goto-char (point-min))
+                                              (forward-line (+ 15 i y))
+                                              (forward-char (+ 1 j x))
+                                              (delete-char 1)
+                                              (insert char)))
+                            (setq rainbow-chars (cdr rainbow-chars)
+                                  lift-flag nil))
+                        ;; Otherwise, just plot the point...
+                        (goto-char (point-min))
+                        (forward-line (+ 16 y))
+                        (forward-char (+ 2 x))
+                        (subst-char-in-region (point) (1+ (point)) ?\s ?\*)))
+                     ((strokes-lift-p point)
+                      ;; a lift--tell the loop to X out the next point...
+                      (setq lift-flag t))))
       (when (called-interactively-p 'interactive)
        (pop-to-buffer " *strokes-xpm*")
        ;;      (xpm-mode 1)
@@ -1286,7 +1290,7 @@ the stroke as a character in some language."
 ;;  (insert
 ;;   "Command                                     Stroke\n"
 ;;   "-------                                     ------")
-;;  (loop for def in strokes-map
+;;  (cl-loop for def in strokes-map
 ;;     for i from 0 to (1- (length strokes-map)) do
 ;;     (let ((stroke (car def))
 ;;           (command-name (symbol-name (cdr def))))
@@ -1341,27 +1345,28 @@ If STROKES-MAP is not given, `strokes-global-map' will be used instead."
     (insert
      "Command                                     Stroke\n"
      "-------                                     ------")
-    (loop for def in strokes-map do
-         (let ((stroke (car def))
-               (command-name (if (symbolp (cdr def))
-                                 (symbol-name (cdr def))
-                               (prin1-to-string (cdr def)))))
-           (strokes-xpm-for-stroke stroke " *strokes-xpm*")
-           (newline 2)
-           (insert-char ?\s 45)
-           (beginning-of-line)
-           (insert command-name)
-           (beginning-of-line)
-           (forward-char 45)
-           (insert-image
-            (create-image (with-current-buffer " *strokes-xpm*"
-                            (buffer-string))
-                          'xpm t
-                          :color-symbols
-                          `(("foreground"
-                             . ,(frame-parameter nil 'foreground-color))))))
-         finally do (unless (eobp)
-                      (kill-region (1+ (point)) (point-max))))
+    (cl-loop
+     for def in strokes-map do
+     (let ((stroke (car def))
+           (command-name (if (symbolp (cdr def))
+                             (symbol-name (cdr def))
+                           (prin1-to-string (cdr def)))))
+       (strokes-xpm-for-stroke stroke " *strokes-xpm*")
+       (newline 2)
+       (insert-char ?\s 45)
+       (beginning-of-line)
+       (insert command-name)
+       (beginning-of-line)
+       (forward-char 45)
+       (insert-image
+        (create-image (with-current-buffer " *strokes-xpm*"
+                        (buffer-string))
+                      'xpm t
+                      :color-symbols
+                      `(("foreground"
+                         . ,(frame-parameter nil 'foreground-color))))))
+     finally do (unless (eobp)
+                  (kill-region (1+ (point)) (point-max))))
     (view-buffer "*Strokes List*" nil)
     (set (make-local-variable 'view-mode-map)
         (let ((map (copy-keymap view-mode-map)))
@@ -1403,7 +1408,7 @@ Encode/decode your strokes with \\[strokes-encode-buffer],
 \\[strokes-decode-buffer].
 
 \\{strokes-mode-map}"
-  nil strokes-modeline-string strokes-mode-map
+  nil strokes-lighter strokes-mode-map
   :group 'strokes :global t
   (cond ((not (display-mouse-p))
         (error "Can't use Strokes without a mouse"))
@@ -1586,7 +1591,7 @@ XPM-BUFFER defaults to ` *strokes-xpm*'."
                   ;; yet another of the same bit-type, so we continue
                   ;; counting...
                   (progn
-                    (incf count)
+                    (cl-incf count)
                     (forward-char 1))
                 ;; otherwise, it's the opposite bit-type, so we do a
                 ;; write and then restart count ### NOTE (for myself
@@ -1725,10 +1730,10 @@ Store XPM in buffer BUFNAME if supplied \(default is ` *strokes-xpm*'\)"
        (delete-char 1)
        (setq current-char-is-on-p (not current-char-is-on-p)))
       (goto-char (point-min))
-      (loop repeat 33 do
-           (insert ?\")
-           (forward-char 33)
-           (insert "\",\n"))
+      (cl-loop repeat 33 do
+               (insert ?\")
+               (forward-char 33)
+               (insert "\",\n"))
       (goto-char (point-min))
       (insert strokes-xpm-header))))
 
index 9b293bb21ac6da3e0cb876c584e25fc6111a2bce..93273b1d41dd2b8f2fc7eb2f5051ff8a9d2060b3 100644 (file)
@@ -26,6 +26,9 @@
 
 ;;; Code:
 
+;; Beware: while this file has tag `utf-8', before it's compiled, it gets
+;; loaded as "raw-text", so non-ASCII chars won't work right during bootstrap.
+
 (defvar custom-declare-variable-list nil
   "Record `defcustom' calls made before `custom.el' is loaded to handle them.
 Each element of this list holds the arguments to one call to `defcustom'.")
@@ -112,10 +115,29 @@ It may also be omitted.
 BODY should be a list of Lisp expressions.
 
 \(fn ARGS [DOCSTRING] [INTERACTIVE] BODY)"
+  (declare (doc-string 2) (indent defun)
+           (debug (&define lambda-list
+                           [&optional stringp]
+                           [&optional ("interactive" interactive)]
+                           def-body)))
   ;; Note that this definition should not use backquotes; subr.el should not
   ;; depend on backquote.el.
   (list 'function (cons 'lambda cdr)))
 
+(defmacro setq-local (var val)
+  "Set variable VAR to value VAL in current buffer."
+  ;; Can't use backquote here, it's too early in the bootstrap.
+  (list 'set (list 'make-local-variable (list 'quote var)) val))
+
+(defmacro defvar-local (var val &optional docstring)
+  "Define VAR as a buffer-local variable with default value VAL.
+Like `defvar' but additionally marks the variable as being automatically
+buffer-local wherever it is set."
+  (declare (debug defvar) (doc-string 3))
+  ;; Can't use backquote here, it's too early in the bootstrap.
+  (list 'progn (list 'defvar var val docstring)
+        (list 'make-variable-buffer-local (list 'quote var))))
+
 (defun apply-partially (fun &rest args)
   "Return a function that is a partial application of FUN to ARGS.
 ARGS is a list of the first N arguments to pass to FUN.
@@ -125,29 +147,33 @@ was called."
   `(closure (t) (&rest args)
             (apply ',fun ,@(mapcar (lambda (arg) `',arg) args) args)))
 
-(if (null (featurep 'cl))
-    (progn
-  ;; If we reload subr.el after having loaded CL, be careful not to
-  ;; overwrite CL's extended definition of `dolist', `dotimes',
-  ;; `declare', `push' and `pop'.
-(defmacro push (newelt listname)
-  "Add NEWELT to the list stored in the symbol LISTNAME.
-This is equivalent to (setq LISTNAME (cons NEWELT LISTNAME)).
-LISTNAME must be a symbol."
-  (declare (debug (form sexp)))
-  (list 'setq listname
-        (list 'cons newelt listname)))
-
-(defmacro pop (listname)
-  "Return the first element of LISTNAME's value, and remove it from the list.
-LISTNAME must be a symbol whose value is a list.
+(defmacro push (newelt place)
+  "Add NEWELT to the list stored in the generalized variable PLACE.
+This is morally equivalent to (setf PLACE (cons NEWELT PLACE)),
+except that PLACE is only evaluated once (after NEWELT)."
+  (declare (debug (form gv-place)))
+  (if (symbolp place)
+      ;; Important special case, to avoid triggering GV too early in
+      ;; the bootstrap.
+      (list 'setq place
+            (list 'cons newelt place))
+    (require 'macroexp)
+    (macroexp-let2 macroexp-copyable-p v newelt
+      (gv-letplace (getter setter) place
+        (funcall setter `(cons ,v ,getter))))))
+
+(defmacro pop (place)
+  "Return the first element of PLACE's value, and remove it from the list.
+PLACE must be a generalized variable whose value is a list.
 If the value is nil, `pop' returns nil but does not actually
 change the list."
-  (declare (debug (sexp)))
+  (declare (debug (gv-place)))
   (list 'car
-        (list 'prog1 listname
-              (list 'setq listname (list 'cdr listname)))))
-))
+        (if (symbolp place)
+            ;; So we can use `pop' in the bootstrap before `gv' can be used.
+            (list 'prog1 place (list 'setq place (list 'cdr place)))
+          (gv-letplace (getter setter) place
+            `(prog1 ,getter ,(funcall setter `(cdr ,getter)))))))
 
 (defmacro when (cond &rest body)
   "If COND yields non-nil, do BODY, else return nil.
@@ -170,8 +196,7 @@ value of last one, or nil if there are none.
 (if (null (featurep 'cl))
     (progn
   ;; If we reload subr.el after having loaded CL, be careful not to
-  ;; overwrite CL's extended definition of `dolist', `dotimes',
-  ;; `declare', `push' and `pop'.
+  ;; overwrite CL's extended definition of `dolist', `dotimes', `declare'.
 
 (defmacro dolist (spec &rest body)
   "Loop over a list.
@@ -247,6 +272,7 @@ the return value (nil if RESULT is omitted).
   "Do not evaluate any arguments and return nil.
 Treated as a declaration when used at the right place in a
 `defmacro' form.  \(See Info anchor `(elisp)Definition of declare'.)"
+  ;; FIXME: edebug spec should pay attention to defun-declarations-alist.
   nil)
 ))
 
@@ -274,6 +300,17 @@ for the sake of consistency."
     (signal 'error (list (apply 'format args)))))
 (set-advertised-calling-convention 'error '(string &rest args) "23.1")
 
+(defun user-error (format &rest args)
+  "Signal a pilot error, making error message by passing all args to `format'.
+In Emacs, the convention is that error messages start with a capital
+letter but *do not* end with a period.  Please follow this convention
+for the sake of consistency.
+This is just like `error' except that `user-error's are expected to be the
+result of an incorrect manipulation on the part of the user, rather than the
+result of an actual problem."
+  (while t
+    (signal 'user-error (list (apply #'format format args)))))
+
 ;; We put this here instead of in frame.el so that it's defined even on
 ;; systems where frame.el isn't loaded.
 (defun frame-configuration-p (object)
@@ -495,11 +532,14 @@ side-effects, and the argument LIST is not modified."
 \f
 ;;;; Keymap support.
 
-(defmacro kbd (keys)
+(defun kbd (keys)
   "Convert KEYS to the internal Emacs key representation.
 KEYS should be a string constant in the format used for
 saving keyboard macros (see `edmacro-mode')."
+  ;; Don't use a defalias, since the `pure' property is only true for
+  ;; the calling convention of `kbd'.
   (read-kbd-macro keys))
+(put 'kbd 'pure t)
 
 (defun undefined ()
   "Beep to tell the user this binding is undefined."
@@ -678,7 +718,6 @@ Subkeymaps may be modified but are not canonicalized."
     ;; Process the bindings starting from the end.
     (dolist (binding (prog1 bindings (setq bindings ())))
       (let* ((key (car binding))
-             (item (cdr binding))
              (oldbind (assq key bindings)))
         (push (if (not oldbind)
                   ;; The normal case: no duplicate bindings.
@@ -871,6 +910,7 @@ The normal global definition of the character C-x indirects to this keymap.")
 (defsubst eventp (obj)
   "True if the argument is an event object."
   (or (and (integerp obj)
+           ;; FIXME: Why bother?
           ;; Filter out integers too large to be events.
           ;; M is the biggest modifier.
           (zerop (logand obj (lognot (1- (lsh ?\M-\^@ 1)))))
@@ -1127,6 +1167,7 @@ be a list of the form returned by `event-start' and `event-end'."
 (define-obsolete-function-alias 'string-to-int 'string-to-number "22.1")
 
 (make-obsolete 'forward-point "use (+ (point) N) instead." "23.1")
+(make-obsolete 'buffer-has-markers-at nil "24.2")
 
 (defun insert-string (&rest args)
   "Mocklisp-compatibility insert function.
@@ -1967,7 +2008,7 @@ It can be retrieved with `(process-get PROCESS PROPNAME)'."
 ;;;; Input and display facilities.
 
 (defvar read-quoted-char-radix 8
-  "*Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
+  "Radix for \\[quoted-insert] and other uses of `read-quoted-char'.
 Legitimate radix values are 8, 10 and 16.")
 
 (custom-declare-variable-early
@@ -1988,6 +2029,10 @@ obey the input decoding and translations usually done by `read-key-sequence'.
 So escape sequences and keyboard encoding are taken into account.
 When there's an ambiguity because the key looks like the prefix of
 some sort of escape sequence, the ambiguity is resolved via `read-key-delay'."
+  ;; This overriding-terminal-local-map binding also happens to
+  ;; disable quail's input methods, so although read-key-sequence
+  ;; always inherits the input method, in practice read-key does not
+  ;; inherit the input method (at least not if it's based on quail).
   (let ((overriding-terminal-local-map read-key-empty-map)
        (overriding-local-map nil)
         (echo-keystrokes 0)
@@ -2095,77 +2140,48 @@ Optional DEFAULT is a default password to use instead of empty input.
 
 This function echoes `.' for each character that the user types.
 
-The user ends with RET, LFD, or ESC.  DEL or C-h rubs out.
-C-y yanks the current kill.  C-u kills line.
-C-g quits; if `inhibit-quit' was non-nil around this function,
-then it returns nil if the user types C-g, but `quit-flag' remains set.
-
 Once the caller uses the password, it can erase the password
 by doing (clear-string STRING)."
-  (with-local-quit
-    (if confirm
-       (let (success)
-         (while (not success)
-           (let ((first (read-passwd prompt nil default))
-                 (second (read-passwd "Confirm password: " nil default)))
-             (if (equal first second)
-                 (progn
-                   (and (arrayp second) (clear-string second))
-                   (setq success first))
-               (and (arrayp first) (clear-string first))
-               (and (arrayp second) (clear-string second))
-               (message "Password not repeated accurately; please start over")
-               (sit-for 1))))
-         success)
-      (let ((pass nil)
-           ;; Copy it so that add-text-properties won't modify
-           ;; the object that was passed in by the caller.
-           (prompt (copy-sequence prompt))
-           (c 0)
-           (echo-keystrokes 0)
-           (cursor-in-echo-area t)
-           (message-log-max nil)
-           (stop-keys (list 'return ?\r ?\n ?\e))
-           (rubout-keys (list 'backspace ?\b ?\177)))
-       (add-text-properties 0 (length prompt)
-                            minibuffer-prompt-properties prompt)
-       (while (progn (message "%s%s"
-                              prompt
-                              (make-string (length pass) ?.))
-                     (setq c (read-key))
-                     (not (memq c stop-keys)))
-         (clear-this-command-keys)
-         (cond ((memq c rubout-keys) ; rubout
-                (when (> (length pass) 0)
-                  (let ((new-pass (substring pass 0 -1)))
-                    (and (arrayp pass) (clear-string pass))
-                    (setq pass new-pass))))
-                ((eq c ?\C-g) (keyboard-quit))
-               ((not (numberp c)))
-               ((= c ?\C-u) ; kill line
-                (and (arrayp pass) (clear-string pass))
-                (setq pass ""))
-               ((= c ?\C-y) ; yank
-                (let* ((str (condition-case nil
-                                (current-kill 0)
-                              (error nil)))
-                       new-pass)
-                  (when str
-                    (setq new-pass
-                          (concat pass
-                                  (substring-no-properties str)))
-                    (and (arrayp pass) (clear-string pass))
-                    (setq c ?\0)
-                    (setq pass new-pass))))
-               ((characterp c) ; insert char
-                (let* ((new-char (char-to-string c))
-                       (new-pass (concat pass new-char)))
-                  (and (arrayp pass) (clear-string pass))
-                  (clear-string new-char)
-                  (setq c ?\0)
-                  (setq pass new-pass)))))
-       (message nil)
-       (or pass default "")))))
+  (if confirm
+      (let (success)
+        (while (not success)
+          (let ((first (read-passwd prompt nil default))
+                (second (read-passwd "Confirm password: " nil default)))
+            (if (equal first second)
+                (progn
+                  (and (arrayp second) (clear-string second))
+                  (setq success first))
+              (and (arrayp first) (clear-string first))
+              (and (arrayp second) (clear-string second))
+              (message "Password not repeated accurately; please start over")
+              (sit-for 1))))
+        success)
+    (let ((hide-chars-fun
+           (lambda (beg end _len)
+             (clear-this-command-keys)
+             (setq beg (min end (max (minibuffer-prompt-end)
+                                     beg)))
+             (dotimes (i (- end beg))
+               (put-text-property (+ i beg) (+ 1 i beg)
+                                  'display (string ?.)))))
+          minibuf)
+      (minibuffer-with-setup-hook
+          (lambda ()
+            (setq minibuf (current-buffer))
+            ;; Turn off electricity.
+            (set (make-local-variable 'post-self-insert-hook) nil)
+            (add-hook 'after-change-functions hide-chars-fun nil 'local))
+        (unwind-protect
+            (read-string prompt nil t default) ; t = "no history"
+          (when (buffer-live-p minibuf)
+            (with-current-buffer minibuf
+              ;; Not sure why but it seems that there might be cases where the
+              ;; minibuffer is not always properly reset later on, so undo
+              ;; whatever we've done here (bug#11392).
+              (remove-hook 'after-change-functions hide-chars-fun 'local)
+              (kill-local-variable 'post-self-insert-hook)
+              ;; And of course, don't keep the sensitive data around.
+              (erase-buffer))))))))
 
 ;; This should be used by `call-interactively' for `n' specs.
 (defun read-number (prompt &optional default)
@@ -2422,7 +2438,7 @@ to `accept-change-group' or `cancel-change-group'."
 This finishes the change group by accepting its changes as final."
   (dolist (elt handle)
     (with-current-buffer (car elt)
-      (if (eq elt t)
+      (if (eq (cdr elt) t)
          (setq buffer-undo-list t)))))
 
 (defun cancel-change-group (handle)
@@ -2459,7 +2475,8 @@ This finishes the change group by reverting all of its changes."
 ;;;; Display-related functions.
 
 ;; For compatibility.
-(defalias 'redraw-modeline 'force-mode-line-update)
+(define-obsolete-function-alias 'redraw-modeline
+  'force-mode-line-update "24.2")
 
 (defun force-mode-line-update (&optional all)
   "Force redisplay of the current buffer's mode line and header line.
@@ -2996,21 +3013,31 @@ potentially make a different buffer current.  It does not alter
 the buffer list ordering."
   (declare (indent 1) (debug t))
   ;; Most of this code is a copy of save-selected-window.
-  `(let ((save-selected-window-window (selected-window))
-        ;; It is necessary to save all of these, because calling
-        ;; select-window changes frame-selected-window for whatever
-        ;; frame that window is in.
-        (save-selected-window-alist
-         (mapcar (lambda (frame) (list frame (frame-selected-window frame)))
-                 (frame-list))))
+  `(let* ((save-selected-window-destination ,window)
+         (save-selected-window-frame
+          (window-frame save-selected-window-destination))
+          (save-selected-window-window (selected-window))
+          ;; Selecting a window on another frame also changes that
+          ;; frame's frame-selected-window.  We must save&restore it.
+          (save-selected-window-other-frame
+           (unless (eq (selected-frame) save-selected-window-frame)
+             (frame-selected-window save-selected-window-frame)))
+         (save-selected-window-top-frame
+           (unless (eq (selected-frame) save-selected-window-frame)
+            (tty-top-frame save-selected-window-frame))))
      (save-current-buffer
        (unwind-protect
-          (progn (select-window ,window 'norecord)
+           (progn (select-window save-selected-window-destination 'norecord)
                  ,@body)
-        (dolist (elt save-selected-window-alist)
-          (and (frame-live-p (car elt))
-               (window-live-p (cadr elt))
-               (set-frame-selected-window (car elt) (cadr elt) 'norecord)))
+         ;; First reset frame-selected-window.
+         (when (window-live-p save-selected-window-other-frame)
+          ;; We don't use set-frame-selected-window because it does not
+          ;; pass the `norecord' argument to Fselect_window.
+          (select-window save-selected-window-other-frame 'norecord)
+          (and (frame-live-p save-selected-window-top-frame)
+               (not (eq (tty-top-frame) save-selected-window-top-frame))
+               (select-frame save-selected-window-top-frame 'norecord)))
+         ;; Then reset the actual selected-window.
         (when (window-live-p save-selected-window-window)
           (select-window save-selected-window-window 'norecord))))))
 
@@ -3561,8 +3588,7 @@ of STRING.
 To replace only the first match (if any), make REGEXP match up to \\'
 and replace a sub-expression, e.g.
   (replace-regexp-in-string \"\\\\(foo\\\\).*\\\\'\" \"bar\" \" foo foo\" nil nil 1)
-    => \" bar foo\"
-"
+    => \" bar foo\""
 
   ;; To avoid excessive consing from multiple matches in long strings,
   ;; don't just call `replace-match' continually.  Walk down the
@@ -3819,6 +3845,29 @@ The properties used on SYMBOL are `composefunc', `sendfunc',
   (put symbol 'abortfunc (or abortfunc 'kill-buffer))
   (put symbol 'hookvar (or hookvar 'mail-send-hook)))
 \f
+(defun set-temporary-overlay-map (map &optional keep-pred)
+  (let* ((clearfunsym (make-symbol "clear-temporary-overlay-map"))
+         (overlaysym (make-symbol "t"))
+         (alist (list (cons overlaysym map)))
+         (clearfun
+          ;; FIXME: Use lexical-binding.
+          `(lambda ()
+             (unless ,(cond ((null keep-pred) nil)
+                            ((eq t keep-pred)
+                             `(eq this-command
+                                  (lookup-key ',map
+                                              (this-command-keys-vector))))
+                            (t `(funcall ',keep-pred)))
+               (remove-hook 'pre-command-hook ',clearfunsym)
+               (setq emulation-mode-map-alists
+                     (delq ',alist emulation-mode-map-alists))))))
+    (set overlaysym overlaysym)
+    (fset clearfunsym clearfun)
+    (add-hook 'pre-command-hook clearfunsym)
+    ;; FIXME: That's the keymaps with highest precedence, except for
+    ;; the `keymap' text-property ;-(
+    (push alist emulation-mode-map-alists)))
+
 ;;;; Progress reporters.
 
 ;; Progress reporter has the following structure:
index 3eb2be156980014f63270c40dccba7f9429b9126..0e818e0be14a181e492a582d35b876fc124295c3 100644 (file)
@@ -97,7 +97,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defgroup tar nil
   "Simple editing of tar files."
@@ -168,7 +168,7 @@ This information is useful, but it takes screen space away from file names."
        ;; state correctly: the raw data is expected to be always larger than
        ;; the summary.
        (progn
-        (assert (or (= (buffer-size tar-data-buffer) (buffer-size))
+        (cl-assert (or (= (buffer-size tar-data-buffer) (buffer-size))
                      (eq tar-data-swapped
                          (> (buffer-size tar-data-buffer) (buffer-size)))))
         tar-data-swapped)))
@@ -186,7 +186,7 @@ Preserve the modified states of the buffers and set `buffer-swapped-with'."
 \f
 ;;; down to business.
 
-(defstruct (tar-header
+(cl-defstruct (tar-header
             (:constructor nil)
             (:type vector)
             :named
@@ -226,8 +226,8 @@ Preserve the modified states of the buffers and set `buffer-swapped-with'."
 This is a list of name, mode, uid, gid, size,
 write-date, checksum, link-type, and link-name."
   (if (> (+ pos 512) (point-max)) (error "Malformed Tar header"))
-  (assert (zerop (mod (- pos (point-min)) 512)))
-  (assert (not enable-multibyte-characters))
+  (cl-assert (zerop (mod (- pos (point-min)) 512)))
+  (cl-assert (not enable-multibyte-characters))
   (let ((string (buffer-substring pos (setq pos (+ pos 512)))))
     (when      ;(some 'plusp string)            ; <-- oops, massive cycle hog!
         (or (not (= 0 (aref string 0))) ; This will do.
@@ -373,7 +373,7 @@ write-date, checksum, link-type, and link-name."
 
 (defun tar-header-block-checksum (string)
   "Compute and return a tar-acceptable checksum for this block."
-  (assert (not (multibyte-string-p string)))
+  (cl-assert (not (multibyte-string-p string)))
   (let* ((chk-field-start tar-chk-offset)
         (chk-field-end (+ chk-field-start 8))
         (sum 0)
@@ -396,7 +396,7 @@ write-date, checksum, link-type, and link-name."
 
 (defun tar-clip-time-string (time)
   (let ((str (current-time-string time)))
-    (concat " " (substring str 4 16) (substring str 19 24))))
+    (concat " " (substring str 4 16) (format-time-string " %Y" time))))
 
 (defun tar-grind-file-mode (mode)
   "Construct a `-rw--r--r--' string indicating MODE.
@@ -486,7 +486,7 @@ MODE should be an integer which is a file mode value."
 
 (defun tar-summarize-buffer ()
   "Parse the contents of the tar file in the current buffer."
-  (assert (tar-data-swapped-p))
+  (cl-assert (tar-data-swapped-p))
   (let* ((modified (buffer-modified-p))
          (result '())
          (pos (point-min))
@@ -549,6 +549,7 @@ MODE should be an integer which is a file mode value."
     (define-key map "R" 'tar-rename-entry)
     (define-key map "u" 'tar-unflag)
     (define-key map "v" 'tar-view)
+    (define-key map "w" 'woman-tar-extract-file)
     (define-key map "x" 'tar-expunge)
     (define-key map "\177" 'tar-unflag-backwards)
     (define-key map "E" 'tar-extract-other-window)
@@ -566,6 +567,8 @@ MODE should be an integer which is a file mode value."
     (define-key map [menu-bar immediate]
       (cons "Immediate" (make-sparse-keymap "Immediate")))
 
+    (define-key map [menu-bar immediate woman]
+      '("Read Man Page (WoMan)" . woman-tar-extract-file))
     (define-key map [menu-bar immediate view]
       '("View This File" . tar-view))
     (define-key map [menu-bar immediate display]
@@ -651,7 +654,7 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
   (widen)
   ;; Now move the Tar data into an auxiliary buffer, so we can use the main
   ;; buffer for the summary.
-  (assert (not (tar-data-swapped-p)))
+  (cl-assert (not (tar-data-swapped-p)))
   (set (make-local-variable 'revert-buffer-function) 'tar-mode-revert)
   ;; We started using write-contents-functions, but this hook is not
   ;; used during auto-save, so we now use
@@ -677,6 +680,8 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
      (fundamental-mode)
      (signal (car err) (cdr err)))))
 
+(autoload 'woman-tar-extract-file "woman"
+  "In tar mode, run the WoMan man-page browser on this file." t)
 
 (define-minor-mode tar-subfile-mode
   "Minor mode for editing an element of a tar-file.
@@ -1114,15 +1119,15 @@ for this to be permanent."
                      (insert (tar-header-block-summarize descriptor) "\n")))
     (forward-line -1) (move-to-column col))
 
-  (assert (tar-data-swapped-p))
+  (cl-assert (tar-data-swapped-p))
   (with-current-buffer tar-data-buffer
     (let* ((start (- (tar-header-data-start descriptor) 512)))
         ;;
         ;; delete the old field and insert a new one.
         (goto-char (+ start data-position))
         (delete-region (point) (+ (point) (length new-data-string))) ; <--
-        (assert (not (or enable-multibyte-characters
-                         (multibyte-string-p new-data-string))))
+        (cl-assert (not (or enable-multibyte-characters
+                            (multibyte-string-p new-data-string))))
         (insert new-data-string)
         ;;
         ;; compute a new checksum and insert it.
index f44f34226f2e6015da779cfb8f161cf7ee46522a..014adb610b47c09b407f34fc736d737451ae164f 100644 (file)
 ;;
 ;;  Blink, is not supported.  Currently it's mapped as bold.
 ;;
-;; Important caveat:
-;; -----------------
-;;   if you want custom colors in term.el redefine term-default-fg-color
-;;  and term-default-bg-color BEFORE loading it.
-;;
 ;;             ----------------------------------------
 ;;
 ;;  If you'd like to check out my complete configuration, you can download
 ;; so it is important to increase it if there are protocol-relevant changes.
 (defconst term-protocol-version "0.96")
 
-(eval-when-compile
-  (require 'ange-ftp)
-  (require 'cl))
+(eval-when-compile (require 'ange-ftp))
 (require 'ring)
 (require 'ehelp)
 
@@ -459,7 +452,7 @@ state 4: term-terminal-parameter contains pending output.")
   "A queue of strings whose echo we want suppressed.")
 (defvar term-terminal-parameter)
 (defvar term-terminal-previous-parameter)
-(defvar term-current-face 'default)
+(defvar term-current-face 'term-face)
 (defvar term-scroll-start 0 "Top-most line (inclusive) of scrolling region.")
 (defvar term-scroll-end) ; Number of line (zero-based) after scrolling region.
 (defvar term-pager-count nil
@@ -622,6 +615,28 @@ executed once when the buffer is created."
   :type 'hook
   :group 'term)
 
+(defvar term-signals-menu
+  (let ((map (make-sparse-keymap "Signals")))
+    (define-key map [eof]
+      '(menu-item "EOF" term-send-eof
+        :help "Send an EOF to the current buffer's process"))
+    (define-key map [kill]
+      '(menu-item "KILL" term-kill-subjob
+        :help "Send kill signal to the current subjob"))
+    (define-key map [quit]
+      '(menu-item "QUIT" term-quit-subjob
+        :help "Send quit signal to the current subjob."))
+    (define-key map [cont]
+      '(menu-item "CONT" term-continue-subjob
+        :help "Send CONT signal to process buffer's process group"))
+    (define-key map [stop]
+      '(menu-item "STOP" term-stop-subjob
+        :help "Stop the current subjob"))
+    (define-key map [brk]
+      '(menu-item "BREAK" term-interrupt-subjob
+        :help "Interrupt the current subjob"))
+    (cons "Signals" map)))
+
 (defvar term-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\ep" 'term-previous-input)
@@ -653,28 +668,66 @@ executed once when the buffer is created."
     (define-key map "\C-c\C-j" 'term-line-mode)
     (define-key map "\C-c\C-q" 'term-pager-toggle)
 
-    ;;  ;; completion:
-    ;;  (define-key map [menu-bar completion]
-    ;;    (cons "Complete" (make-sparse-keymap "Complete")))
-    ;;  (define-key map [menu-bar completion complete-expand]
-    ;;    '("Expand File Name" . term-replace-by-expanded-filename))
-    ;;  (define-key map [menu-bar completion complete-listing]
-    ;;    '("File Completion Listing" . term-dynamic-list-filename-completions))
-    ;;  (define-key map [menu-bar completion complete-file]
-    ;;    '("Complete File Name" . term-dynamic-complete-filename))
-    ;;  (define-key map [menu-bar completion complete]
-    ;;    '("Complete Before Point" . term-dynamic-complete))
-    ;;  ;; Put them in the menu bar:
-    ;;  (setq menu-bar-final-items (append '(terminal completion inout signals)
-    ;;                              menu-bar-final-items))
+    ;; completion:  (line mode only)
+    (let ((completion-menu (make-sparse-keymap "Complete")))
+      (define-key map [menu-bar completion]
+        (cons "Complete" completion-menu))
+      (define-key completion-menu [complete-expand]
+        '("Expand File Name" . term-replace-by-expanded-filename))
+      (define-key completion-menu [complete-listing]
+        '("File Completion Listing" . term-dynamic-list-filename-completions))
+      (define-key completion-menu [complete-file]
+        '("Complete File Name" . term-dynamic-complete-filename))
+      (define-key completion-menu [complete]
+        '("Complete Before Point" . term-dynamic-complete)))
+
+    ;; Input history: (line mode only)
+    (let ((inout-menu (make-sparse-keymap "In/Out")))
+      (define-key map [menu-bar inout]
+        (cons "In/Out" inout-menu))
+      (define-key inout-menu [kill-output]
+        '("Kill Current Output Group" . term-kill-output))
+      (define-key inout-menu [next-prompt]
+        '("Forward Output Group" . term-next-prompt))
+      (define-key inout-menu [previous-prompt]
+        '("Backward Output Group" . term-previous-prompt))
+      (define-key inout-menu [show-maximum-output]
+        '("Show Maximum Output" . term-show-maximum-output))
+      (define-key inout-menu [show-output]
+        '("Show Current Output Group" . term-show-output))
+      (define-key inout-menu [kill-input]
+        '("Kill Current Input" . term-kill-input))
+      (define-key inout-menu [copy-input]
+        '("Copy Old Input" . term-copy-old-input))
+      (define-key inout-menu [forward-matching-history]
+        '("Forward Matching Input..." . term-forward-matching-input))
+      (define-key inout-menu [backward-matching-history]
+        '("Backward Matching Input..." . term-backward-matching-input))
+      (define-key inout-menu [next-matching-history]
+        '("Next Matching Input..." . term-next-matching-input))
+      (define-key inout-menu [previous-matching-history]
+        '("Previous Matching Input..." . term-previous-matching-input))
+      (define-key inout-menu [next-matching-history-from-input]
+        '("Next Matching Current Input" . term-next-matching-input-from-input))
+      (define-key inout-menu [previous-matching-history-from-input]
+        '("Previous Matching Current Input" .
+          term-previous-matching-input-from-input))
+      (define-key inout-menu [next-history]
+        '("Next Input" . term-next-input))
+      (define-key inout-menu [previous-history]
+        '("Previous Input" . term-previous-input))
+      (define-key inout-menu [list-history]
+        '("List Input History" . term-dynamic-list-input-ring))
+      (define-key inout-menu [expand-history]
+        '("Expand History Before Point" . term-replace-by-expanded-history)))
+
+    (define-key map [menu-bar signals] term-signals-menu)
+
     map))
 
-(defvar term-raw-map nil
-  "Keyboard map for sending characters directly to the inferior process.")
 (defvar term-escape-char nil
   "Escape character for char sub-mode of term mode.
 Do not change it directly; use `term-set-escape-char' instead.")
-(defvar term-raw-escape-map nil)
 
 (defvar term-pager-break-map nil)
 
@@ -713,9 +766,6 @@ Buffer local variable.")
 (defmacro term-handling-pager () 'term-pager-old-local-map)
 (defmacro term-using-alternate-sub-buffer () 'term-saved-home-marker)
 
-(defvar term-signals-menu)
-(defvar term-terminal-menu)
-
 ;; Let's silence the byte-compiler -mm
 (defvar term-ansi-at-host nil)
 (defvar term-ansi-at-dir nil)
@@ -738,28 +788,87 @@ Buffer local variable.")
 (defvar term-terminal-previous-parameter-3 -1)
 (defvar term-terminal-previous-parameter-4 -1)
 
-;;; faces -mm
-
-(defcustom term-default-fg-color
-  ;; FIXME: This depends on the current frame, so depending on when
-  ;; it's loaded, the result may be different.
-  (face-foreground term-current-face)
-  "Default color for foreground in `term'."
+;;; Faces
+(defvar ansi-term-color-vector
+  [term-face
+   term-color-black
+   term-color-red
+   term-color-green
+   term-color-yellow
+   term-color-blue
+   term-color-magenta
+   term-color-cyan
+   term-color-white])
+
+(defcustom term-default-fg-color nil
+  "If non-nil, default color for foreground in Term mode.
+This is deprecated in favor of customizing the `term-face' face."
   :group 'term
   :type 'string)
 
-(defcustom term-default-bg-color
-  ;; FIXME: This depends on the current frame, so depending on when
-  ;; it's loaded, the result may be different.
-  (face-background term-current-face)
-  "Default color for background in `term'."
+(defcustom term-default-bg-color nil
+  "If non-nil, default color for foreground in Term mode.
+This is deprecated in favor of customizing the `term-face' face."
   :group 'term
   :type 'string)
 
-;; Use the same colors that xterm uses, see `xterm-standard-colors'.
-(defvar ansi-term-color-vector
-  [unspecified "black" "red3" "green3" "yellow3" "blue2"
-   "magenta3" "cyan3" "white"])
+(defface term-face
+  `((t
+     :foreground ,term-default-fg-color
+     :background ,term-default-bg-color
+     :inherit default))
+  "Default face to use in Term mode."
+  :group 'term)
+
+(defface term-bold
+  '((t :bold t))
+  "Default face to use for bold text."
+  :group 'term)
+
+(defface term-underline
+  '((t :underline t))
+  "Default face to use for underlined text."
+  :group 'term)
+
+(defface term-color-black
+  '((t :foreground "black" :background "black"))
+  "Face used to render black color code."
+  :group 'term)
+
+(defface term-color-red
+  '((t :foreground "red3" :background "red3"))
+  "Face used to render red color code."
+  :group 'term)
+
+(defface term-color-green
+  '((t :foreground "green3" :background "green3"))
+  "Face used to render green color code."
+  :group 'term)
+
+(defface term-color-yellow
+  '((t :foreground "yellow3" :background "yellow3"))
+  "Face used to render yellow color code."
+  :group 'term)
+
+(defface term-color-blue
+  '((t :foreground "blue2" :background "blue2"))
+  "Face used to render blue color code."
+  :group 'term)
+
+(defface term-color-magenta
+  '((t :foreground "magenta3" :background "magenta3"))
+  "Face used to render magenta color code."
+  :group 'term)
+
+(defface term-color-cyan
+  '((t :foreground "cyan3" :background "cyan3"))
+  "Face used to render cyan color code."
+  :group 'term)
+
+(defface term-color-white
+  '((t :foreground "white" :background "white"))
+  "Face used to render white color code."
+  :group 'term)
 
 ;; Inspiration came from comint.el -mm
 (defcustom term-buffer-maximum-size 2048
@@ -770,178 +879,104 @@ is buffer-local."
   :group 'term
   :type 'integer)
 \f
-(when (featurep 'xemacs)
-  (defvar term-terminal-menu
-    '("Terminal"
-      [ "Character mode" term-char-mode (term-in-line-mode)]
-      [ "Line mode" term-line-mode (term-in-char-mode)]
-      [ "Enable paging" term-pager-toggle (not term-pager-count)]
-      [ "Disable paging" term-pager-toggle term-pager-count])))
-
-;; Menu bars:
-(unless (featurep 'xemacs)
-  ;; terminal:
-  (let (newmap)
-    (setq newmap (make-sparse-keymap "Terminal"))
-    (define-key newmap [terminal-pager-enable]
-      '(menu-item "Enable paging" term-fake-pager-enable
-                 :help "Enable paging feature"))
-    (define-key newmap [terminal-pager-disable]
-      '(menu-item "Disable paging" term-fake-pager-disable
-                 :help "Disable paging feature"))
-    (define-key newmap [terminal-char-mode]
-      '(menu-item "Character mode" term-char-mode
-                 :help "Switch to char (raw) sub-mode of term mode"))
-    (define-key newmap [terminal-line-mode]
-      '(menu-item "Line mode" term-line-mode
-                 :help "Switch to line (cooked) sub-mode of term mode"))
-    (setq term-terminal-menu (cons "Terminal" newmap))
-
-    ;; completion:  (line mode only)
-    (defvar term-completion-menu (make-sparse-keymap "Complete"))
-    (define-key term-mode-map [menu-bar completion]
-      (cons "Complete" term-completion-menu))
-    (define-key term-completion-menu [complete-expand]
-      '("Expand File Name" . term-replace-by-expanded-filename))
-    (define-key term-completion-menu [complete-listing]
-      '("File Completion Listing" . term-dynamic-list-filename-completions))
-    (define-key term-completion-menu [menu-bar completion complete-file]
-      '("Complete File Name" . term-dynamic-complete-filename))
-    (define-key term-completion-menu [menu-bar completion complete]
-      '("Complete Before Point" . term-dynamic-complete))
-
-    ;; Input history: (line mode only)
-    (defvar term-inout-menu (make-sparse-keymap "In/Out"))
-    (define-key term-mode-map [menu-bar inout]
-      (cons "In/Out" term-inout-menu))
-    (define-key term-inout-menu [kill-output]
-      '("Kill Current Output Group" . term-kill-output))
-    (define-key term-inout-menu [next-prompt]
-      '("Forward Output Group" . term-next-prompt))
-    (define-key term-inout-menu [previous-prompt]
-      '("Backward Output Group" . term-previous-prompt))
-    (define-key term-inout-menu [show-maximum-output]
-      '("Show Maximum Output" . term-show-maximum-output))
-    (define-key term-inout-menu [show-output]
-      '("Show Current Output Group" . term-show-output))
-    (define-key term-inout-menu [kill-input]
-      '("Kill Current Input" . term-kill-input))
-    (define-key term-inout-menu [copy-input]
-      '("Copy Old Input" . term-copy-old-input))
-    (define-key term-inout-menu [forward-matching-history]
-      '("Forward Matching Input..." . term-forward-matching-input))
-    (define-key term-inout-menu [backward-matching-history]
-      '("Backward Matching Input..." . term-backward-matching-input))
-    (define-key term-inout-menu [next-matching-history]
-      '("Next Matching Input..." . term-next-matching-input))
-    (define-key term-inout-menu [previous-matching-history]
-      '("Previous Matching Input..." . term-previous-matching-input))
-    (define-key term-inout-menu [next-matching-history-from-input]
-      '("Next Matching Current Input" . term-next-matching-input-from-input))
-    (define-key term-inout-menu [previous-matching-history-from-input]
-      '("Previous Matching Current Input" .
-               term-previous-matching-input-from-input))
-    (define-key term-inout-menu [next-history]
-      '("Next Input" . term-next-input))
-    (define-key term-inout-menu [previous-history]
-      '("Previous Input" . term-previous-input))
-    (define-key term-inout-menu [list-history]
-      '("List Input History" . term-dynamic-list-input-ring))
-    (define-key term-inout-menu [expand-history]
-      '("Expand History Before Point" . term-replace-by-expanded-history))
-
-    ;; Signals
-    (setq newmap (make-sparse-keymap "Signals"))
-    (define-key term-mode-map [menu-bar signals]
-      (setq term-signals-menu (cons "Signals" newmap)))
-    (define-key newmap [eof]
-      '(menu-item "EOF" term-send-eof
-                 :help "Send an EOF to the current buffer's process"))
-    (define-key newmap [kill]
-      '(menu-item "KILL" term-kill-subjob
-                 :help "Send kill signal to the current subjob"))
-    (define-key newmap [quit]
-      '(menu-item "QUIT" term-quit-subjob
-                 :help "Send quit signal to the current subjob."))
-    (define-key newmap [cont]
-      '(menu-item "CONT" term-continue-subjob
-                 :help "Send CONT signal to process buffer's process group"))
-    (define-key newmap [stop]
-      '(menu-item "STOP" term-stop-subjob
-                 :help "Stop the current subjob"))
-    (define-key newmap [brk]
-      '(menu-item "BREAK" term-interrupt-subjob
-                 :help "Interrupt the current subjob"))
-    ))
+(defvar term-terminal-menu
+  (if (featurep 'xemacs)
+      '("Terminal"
+        [ "Character mode" term-char-mode (term-in-line-mode)]
+        [ "Line mode" term-line-mode (term-in-char-mode)]
+        [ "Enable paging" term-pager-toggle (not term-pager-count)]
+        [ "Disable paging" term-pager-toggle term-pager-count])
+    (let ((map (make-sparse-keymap "Terminal")))
+      (define-key map [terminal-pager-enable]
+        '(menu-item "Enable paging" term-fake-pager-enable
+          :help "Enable paging feature"))
+      (define-key map [terminal-pager-disable]
+        '(menu-item "Disable paging" term-fake-pager-disable
+          :help "Disable paging feature"))
+      (define-key map [terminal-char-mode]
+        '(menu-item "Character mode" term-char-mode
+          :help "Switch to char (raw) sub-mode of term mode"))
+      (define-key map [terminal-line-mode]
+        '(menu-item "Line mode" term-line-mode
+          :help "Switch to line (cooked) sub-mode of term mode"))
+      (cons "Terminal" map))))
 \f
 ;; Set up term-raw-map, etc.
 
-(defun term-set-escape-char (c)
+(defvar term-raw-map
+  (let* ((map (make-keymap))
+         (esc-map (make-keymap))
+         (i 0))
+    (while (< i 128)
+      (define-key map (make-string 1 i) 'term-send-raw)
+      ;; Avoid O and [. They are used in escape sequences for various keys.
+      (unless (or (eq i ?O) (eq i 91))
+        (define-key esc-map (make-string 1 i) 'term-send-raw-meta))
+      (setq i (1+ i)))
+    (define-key map [remap self-insert-command] 'term-send-raw)
+    (define-key map "\e" esc-map)
+
+    ;; Added nearly all the 'gray keys' -mm
+
+    (if (featurep 'xemacs)
+        (define-key map [button2] 'term-mouse-paste)
+      (define-key map [mouse-2] 'term-mouse-paste)
+      (define-key map [menu-bar terminal] term-terminal-menu)
+      (define-key map [menu-bar signals] term-signals-menu))
+    (define-key map [up] 'term-send-up)
+    (define-key map [down] 'term-send-down)
+    (define-key map [right] 'term-send-right)
+    (define-key map [left] 'term-send-left)
+    (define-key map [delete] 'term-send-del)
+    (define-key map [deletechar] 'term-send-del)
+    (define-key map [backspace] 'term-send-backspace)
+    (define-key map [home] 'term-send-home)
+    (define-key map [end] 'term-send-end)
+    (define-key map [insert] 'term-send-insert)
+    (define-key map [S-prior] 'scroll-down)
+    (define-key map [S-next] 'scroll-up)
+    (define-key map [S-insert] 'term-paste)
+    (define-key map [prior] 'term-send-prior)
+    (define-key map [next] 'term-send-next)
+    map)
+  "Keyboard map for sending characters directly to the inferior process.")
+
+(defvar term-raw-escape-map
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map 'Control-X-prefix)
+    ;; Define standard bindings in term-raw-escape-map.
+    (define-key map "\C-v" (lookup-key (current-global-map) "\C-v"))
+    (define-key map "\C-u" (lookup-key (current-global-map) "\C-u"))
+    (define-key map "\C-q" 'term-pager-toggle)
+    ;; The keybinding for term-char-mode is needed by the menubar code.
+    (define-key map "\C-k" 'term-char-mode)
+    (define-key map "\C-j" 'term-line-mode)
+    ;; It's convenient to have execute-extended-command here.
+    (define-key map [?\M-x] 'execute-extended-command)
+    map))
+
+(defun term-set-escape-char (key)
   "Change `term-escape-char' and keymaps that depend on it."
   (when term-escape-char
+    ;; Undo previous term-set-escape-char.
     (define-key term-raw-map term-escape-char 'term-send-raw))
-  (setq c (make-string 1 c))
-  (define-key term-raw-map c term-raw-escape-map)
-  ;; Define standard bindings in term-raw-escape-map
-  (define-key term-raw-escape-map "\C-v"
-    (lookup-key (current-global-map) "\C-v"))
-  (define-key term-raw-escape-map "\C-u"
-    (lookup-key (current-global-map) "\C-u"))
-  (define-key term-raw-escape-map c 'term-send-raw)
-  (define-key term-raw-escape-map "\C-q" 'term-pager-toggle)
-  ;; The keybinding for term-char-mode is needed by the menubar code.
-  (define-key term-raw-escape-map "\C-k" 'term-char-mode)
-  (define-key term-raw-escape-map "\C-j" 'term-line-mode)
-  ;; It's convenient to have execute-extended-command here.
-  (define-key term-raw-escape-map [?\M-x] 'execute-extended-command))
-
-(let* ((map (make-keymap))
-       (esc-map (make-keymap))
-       (i 0))
-  (while (< i 128)
-    (define-key map (make-string 1 i) 'term-send-raw)
-    ;; Avoid O and [. They are used in escape sequences for various keys.
-    (unless (or (eq i ?O) (eq i 91))
-               (define-key esc-map (make-string 1 i) 'term-send-raw-meta))
-    (setq i (1+ i)))
-  (define-key map [remap self-insert-command] 'term-send-raw)
-  (define-key map "\e" esc-map)
-  (setq term-raw-map map)
-  (setq term-raw-escape-map (copy-keymap 'Control-X-prefix))
-
-  ;; Added nearly all the 'gray keys' -mm
+  (setq term-escape-char (vector key))
+  (define-key term-raw-map term-escape-char term-raw-escape-map)
+  ;; FIXME: If we later call term-set-escape-char again with another key,
+  ;; we should undo this binding.
+  (define-key term-raw-escape-map term-escape-char 'term-send-raw))
 
-  (if (featurep 'xemacs)
-      (define-key term-raw-map [button2] 'term-mouse-paste)
-    (define-key term-raw-map [mouse-2] 'term-mouse-paste)
-    (define-key term-raw-map [menu-bar terminal] term-terminal-menu)
-    (define-key term-raw-map [menu-bar signals] term-signals-menu))
-  (define-key term-raw-map [up] 'term-send-up)
-  (define-key term-raw-map [down] 'term-send-down)
-  (define-key term-raw-map [right] 'term-send-right)
-  (define-key term-raw-map [left] 'term-send-left)
-  (define-key term-raw-map [delete] 'term-send-del)
-  (define-key term-raw-map [deletechar] 'term-send-del)
-  (define-key term-raw-map [backspace] 'term-send-backspace)
-  (define-key term-raw-map [home] 'term-send-home)
-  (define-key term-raw-map [end] 'term-send-end)
-  (define-key term-raw-map [insert] 'term-send-insert)
-  (define-key term-raw-map [S-prior] 'scroll-down)
-  (define-key term-raw-map [S-next] 'scroll-up)
-  (define-key term-raw-map [S-insert] 'term-paste)
-  (define-key term-raw-map [prior] 'term-send-prior)
-  (define-key term-raw-map [next] 'term-send-next))
-
-(term-set-escape-char ?\C-c)
+(term-set-escape-char (or term-escape-char ?\C-c))
 
 (defvar overflow-newline-into-fringe)
 
 (defun term-window-width ()
-  (if (featurep 'xemacs)
-      (1- (window-width))
-    (if (and window-system overflow-newline-into-fringe)
-       (window-width)
-      (1- (window-width)))))
+  (if (and (not (featurep 'xemacs))
+          (display-graphic-p)
+          overflow-newline-into-fringe
+          (/= (frame-parameter nil 'right-fringe) 0))
+      (window-width)
+    (1- (window-width))))
 
 \f
 (put 'term-mode 'mode-class 'special)
@@ -968,11 +1003,7 @@ is buffer-local."
     dt))
 
 (defun term-ansi-reset ()
-  (setq term-current-face (nconc
-                           (if term-default-bg-color
-                               (list :background term-default-bg-color))
-                           (if term-default-fg-color
-                               (list :foreground term-default-fg-color))))
+  (setq term-current-face 'term-face)
   (setq term-ansi-current-underline nil)
   (setq term-ansi-current-bold nil)
   (setq term-ansi-current-reverse nil)
@@ -981,7 +1012,7 @@ is buffer-local."
   (setq term-ansi-face-already-done t)
   (setq term-ansi-current-bg-color 0))
 
-(defun term-mode ()
+(define-derived-mode term-mode fundamental-mode "Term"
   "Major mode for interacting with an inferior interpreter.
 The interpreter name is same as buffer name, sans the asterisks.
 
@@ -1025,56 +1056,38 @@ Commands in line mode:
 \\{term-mode-map}
 
 Entry to this mode runs the hooks on `term-mode-hook'."
-  (interactive)
-  ;; Do not remove this.  All major modes must do this.
-  (kill-all-local-variables)
-  (setq major-mode 'term-mode)
-  (setq mode-name "Term")
-  (use-local-map term-mode-map)
   ;; we do not want indent to sneak in any tabs
   (setq indent-tabs-mode nil)
   (setq buffer-display-table term-display-table)
-  (make-local-variable 'term-home-marker)
-  (setq term-home-marker (copy-marker 0))
+  (set (make-local-variable 'term-home-marker) (copy-marker 0))
+  (set (make-local-variable 'term-height) (1- (window-height)))
+  (set (make-local-variable 'term-width) (term-window-width))
+  (set (make-local-variable 'term-last-input-start) (make-marker))
+  (set (make-local-variable 'term-last-input-end) (make-marker))
+  (set (make-local-variable 'term-last-input-match) "")
+  (set (make-local-variable 'term-command-hook)
+       (symbol-function 'term-command-hook))
+
+  ;; These local variables are set to their local values:
   (make-local-variable 'term-saved-home-marker)
-  (make-local-variable 'term-height)
-  (make-local-variable 'term-width)
-  (setq term-width (term-window-width))
-  (setq term-height (1- (window-height)))
   (make-local-variable 'term-terminal-parameter)
   (make-local-variable 'term-saved-cursor)
-  (make-local-variable 'term-last-input-start)
-  (setq term-last-input-start (make-marker))
-  (make-local-variable 'term-last-input-end)
-  (setq term-last-input-end (make-marker))
-  (make-local-variable 'term-last-input-match)
-  (setq term-last-input-match "")
-  (make-local-variable 'term-prompt-regexp) ; Don't set; default
-  (make-local-variable 'term-input-ring-size) ; ...to global val.
+  (make-local-variable 'term-prompt-regexp)
+  (make-local-variable 'term-input-ring-size)
   (make-local-variable 'term-input-ring)
   (make-local-variable 'term-input-ring-file-name)
-  (or (and (boundp 'term-input-ring) term-input-ring)
-      (setq term-input-ring (make-ring term-input-ring-size)))
   (make-local-variable 'term-input-ring-index)
-  (or (and (boundp 'term-input-ring-index) term-input-ring-index)
-      (setq term-input-ring-index nil))
-
-  (make-local-variable 'term-command-hook)
-  (setq term-command-hook (symbol-function 'term-command-hook))
+  (unless term-input-ring
+    (setq term-input-ring (make-ring term-input-ring-size)))
 
   ;; I'm not sure these saves are necessary but, since I
   ;; haven't tested the whole thing on a net connected machine with
   ;; a properly configured ange-ftp, I've decided to be conservative
   ;; and put them in. -mm
 
-  (make-local-variable 'term-ansi-at-host)
-  (setq term-ansi-at-host (system-name))
-
-  (make-local-variable 'term-ansi-at-dir)
-  (setq term-ansi-at-dir default-directory)
-
-  (make-local-variable 'term-ansi-at-message)
-  (setq term-ansi-at-message nil)
+  (set (make-local-variable 'term-ansi-at-host) (system-name))
+  (set (make-local-variable 'term-ansi-at-dir) default-directory)
+  (set (make-local-variable 'term-ansi-at-message) nil)
 
   ;; For user tracking purposes -mm
   (make-local-variable 'ange-ftp-default-user)
@@ -1107,8 +1120,7 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (make-local-variable 'term-current-row)
   (make-local-variable 'term-log-buffer)
   (make-local-variable 'term-scroll-start)
-  (make-local-variable 'term-scroll-end)
-  (setq term-scroll-end term-height)
+  (set (make-local-variable 'term-scroll-end) term-height)
   (make-local-variable 'term-scroll-with-delete)
   (make-local-variable 'term-pager-count)
   (make-local-variable 'term-pager-old-local-map)
@@ -1130,15 +1142,15 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (make-local-variable 'term-ptyp)
   (make-local-variable 'term-exec-hook)
   (make-local-variable 'term-vertical-motion)
-  (make-local-variable 'term-pending-delete-marker)
-  (setq term-pending-delete-marker (make-marker))
+  (set (make-local-variable 'term-pending-delete-marker) (make-marker))
   (make-local-variable 'term-current-face)
   (term-ansi-reset)
-  (make-local-variable 'term-pending-frame)
-  (setq term-pending-frame nil)
+  (set (make-local-variable 'term-pending-frame) nil)
   ;; Cua-mode's keybindings interfere with the term keybindings, disable it.
   (set (make-local-variable 'cua-mode) nil)
-  (run-mode-hooks 'term-mode-hook)
+
+  (set (make-local-variable 'font-lock-defaults) '(nil t))
+
   (when (featurep 'xemacs)
     (set-buffer-menubar
      (append current-menubar (list term-terminal-menu))))
@@ -1183,9 +1195,9 @@ Entry to this mode runs the hooks on `term-mode-hook'."
     found))
 
 (defun term-check-size (process)
-  (when (or (/= term-height (1- (window-height)))
+  (when (or (/= term-height (window-text-height))
            (/= term-width (term-window-width)))
-    (term-reset-size (1- (window-height)) (term-window-width))
+    (term-reset-size (window-text-height) (term-window-width))
     (set-process-window-size process term-height term-width)))
 
 (defun term-send-raw-string (chars)
@@ -1210,21 +1222,21 @@ without any interpretation."
 (defun term-send-raw-meta ()
   (interactive)
   (let ((char last-input-event))
-    (when (symbolp last-input-event)
+    (when (symbolp char)
       ;; Convert `return' to C-m, etc.
       (let ((tmp (get char 'event-symbol-elements)))
-       (when tmp
-         (setq char (car tmp)))
-       (when (symbolp char)
-         (setq tmp (get char 'ascii-character))
-         (when tmp
-           (setq char tmp)))))
-    (setq char (event-basic-type char))
-    (term-send-raw-string (if (and (numberp char)
-                                  (> char 127)
-                                  (< char 256))
-                             (make-string 1 char)
-                           (format "\e%c" char)))))
+       (if tmp (setq char (car tmp)))
+       (and (symbolp char)
+            (setq tmp (get char 'ascii-character))
+            (setq char tmp))))
+    (when (numberp char)
+      (let ((base (event-basic-type char))
+           (mods (delq 'meta (event-modifiers char))))
+       (if (memq 'control mods)
+           (setq mods (delq 'shift mods)))
+       (term-send-raw-string
+        (format "\e%c"
+                (event-convert-list (append mods (list base)))))))))
 
 (defun term-mouse-paste (click)
   "Insert the primary selection at the position clicked on."
@@ -2621,13 +2633,13 @@ See `term-prompt-regexp'."
     ;; from the last character on the line, set the face for the chars
     ;; to default.
     (when (> (point) point-at-eol)
-      (put-text-property point-at-eol (point) 'face 'default))))
+      (put-text-property point-at-eol (point) 'font-lock-face 'default))))
 
 ;; Insert COUNT copies of CHAR in the default face.
 (defun term-insert-char (char count)
   (let ((old-point (point)))
     (insert-char char count)
-    (put-text-property old-point (point) 'face 'default)))
+    (put-text-property old-point (point) 'font-lock-face 'default)))
 
 (defun term-current-row ()
   (cond (term-current-row)
@@ -2728,10 +2740,8 @@ See `term-prompt-regexp'."
           (str-length (length str)))
       (save-selected-window
 
-       ;; Let's handle the messages. -mm
-
-        (let* ((newstr (term-handle-ansi-terminal-messages str)))
-          (when (not (eq str newstr))
+        (let ((newstr (term-handle-ansi-terminal-messages str)))
+          (unless (eq str newstr)
            (setq handled-ansi-message t
                  str newstr)))
         (setq str-length (length str))
@@ -2741,18 +2751,19 @@ See `term-prompt-regexp'."
          (delete-region term-pending-delete-marker (process-mark proc))
          (set-marker term-pending-delete-marker nil))
 
+       (when (/= (point) (process-mark proc))
+         (setq save-point (point-marker)))
+
+       ;; Note if the window size has changed.  We used to reset
+       ;; point too, but that gives incorrect results (Bug#4635).
        (if (eq (window-buffer) (current-buffer))
            (progn
              (setq term-vertical-motion (symbol-function 'vertical-motion))
              (term-check-size proc))
          (setq term-vertical-motion
                (symbol-function 'term-buffer-vertical-motion)))
-
        (setq save-marker (copy-marker (process-mark proc)))
-
-       (when (/= (point) (process-mark proc))
-         (setq save-point (point-marker))
-         (goto-char (process-mark proc)))
+       (goto-char (process-mark proc))
 
        (save-restriction
          ;; If the buffer is in line mode, and there is a partial
@@ -2852,7 +2863,7 @@ See `term-prompt-regexp'."
                          (setq term-current-column nil)
 
                          (put-text-property old-point (point)
-                                            'face term-current-face)
+                                            'font-lock-face term-current-face)
                          ;; If the last char was written in last column,
                          ;; back up one column, but remember we did so.
                          ;; Thus we emulate xterm/vt100-style line-wrapping.
@@ -3125,10 +3136,6 @@ See `term-prompt-regexp'."
 ;; New function to deal with ansi colorized output, as you can see you can
 ;; have any bold/underline/fg/bg/reverse combination. -mm
 
-(defvar term-bold-attribute '(:weight bold)
-  "Attribute to use for the bold terminal attribute.
-Set it to nil to disable bold.")
-
 (defun term-handle-colors-array (parameter)
   (cond
 
@@ -3190,46 +3197,32 @@ Set it to nil to disable bold.")
   ;;          term-ansi-current-color
   ;;          term-ansi-current-bg-color)
 
-
   (unless term-ansi-face-already-done
     (if term-ansi-current-invisible
         (let ((color
                (if term-ansi-current-reverse
-                   (if (= term-ansi-current-color 0)
-                       term-default-fg-color
-                     (elt ansi-term-color-vector term-ansi-current-color))
-                 (if (= term-ansi-current-bg-color 0)
-                     term-default-bg-color
-                   (elt ansi-term-color-vector term-ansi-current-bg-color)))))
+                   (face-foreground
+                    (elt ansi-term-color-vector term-ansi-current-color))
+                 (face-background
+                  (elt ansi-term-color-vector term-ansi-current-bg-color)))))
           (setq term-current-face
                 (list :background color
                       :foreground color))
           ) ;; No need to bother with anything else if it's invisible.
-
       (setq term-current-face
-            (if term-ansi-current-reverse
-                (if (= term-ansi-current-color 0)
-                    (list :background term-default-fg-color
-                          :foreground term-default-bg-color)
-                  (list :background
-                        (elt ansi-term-color-vector term-ansi-current-color)
-                        :foreground
-                        (elt ansi-term-color-vector term-ansi-current-bg-color)))
-
-              (if (= term-ansi-current-color 0)
-                  (list :foreground term-default-fg-color
-                        :background term-default-bg-color)
-                (list :foreground
-                      (elt ansi-term-color-vector term-ansi-current-color)
-                      :background
-                      (elt ansi-term-color-vector term-ansi-current-bg-color)))))
+            (list :foreground
+                  (face-foreground (elt ansi-term-color-vector term-ansi-current-color))
+                  :background
+                  (face-background (elt ansi-term-color-vector term-ansi-current-bg-color))
+                  :inverse-video term-ansi-current-reverse))
 
       (when term-ansi-current-bold
         (setq term-current-face
-              (append term-bold-attribute term-current-face)))
+              `(,term-current-face :inherit term-bold)))
+
       (when term-ansi-current-underline
         (setq term-current-face
-              (list* :underline t term-current-face)))))
+              `(,term-current-face :inherit term-underline)))))
 
   ;;   (message "Debug %S" term-current-face)
   ;; FIXME: shouldn't we set term-ansi-face-already-done to t here?  --Stef
@@ -3752,7 +3745,7 @@ all pending output has been dealt with."))
       (when wrapped
        (insert ? ))
       (insert ?\n)
-      (put-text-property saved-point (point) 'face 'default)
+      (put-text-property saved-point (point) 'font-lock-face 'default)
       (goto-char saved-point))))
 
 (defun term-erase-in-display (kind)
@@ -3800,7 +3793,7 @@ if KIND is 1, erase from home to point; else erase from home to point-max."
     ;; from the last character on the line, set the face for the chars
     ;; to default.
     (when (>= (point) pnt-at-eol)
-      (put-text-property pnt-at-eol (point) 'face 'default))
+      (put-text-property pnt-at-eol (point) 'font-lock-face 'default))
     (when (> save-eol (point))
       (delete-region (point) save-eol))
     (goto-char save-point)
index bbd408e8fbce229212a4f778b02919ab13f5dc0f..12707c12ba27a086f508d0d2755ea5427aaa89c0 100644 (file)
@@ -1,4 +1,4 @@
-;;; AT386.el --- terminal support package for IBM AT keyboards -*- no-byte-compile: t -*-
+;;; AT386.el --- terminal support package for IBM AT keyboards
 
 ;; Copyright (C) 1992, 2001-2012 Free Software Foundation, Inc.
 
index c570a20112b1bd5b8427141bfc3690553dd8a5e2..e4cabac3bf112298b6104f1402b39830ed61318a 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 (defun terminal-init-apollo ()
   "Terminal initialization function for apollo."
   (tty-run-terminal-initialization (selected-frame) "vt100"))
index d9ab1a5fb166ad9555e2182a7221de208200284f..f26dc6b919875c2ce745e617c5f035ca289d38c2 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 
 (defun terminal-init-bobcat ()
   "Terminal initialization function for bobcat."
index cfce07035cf2424be4fdc348260f6d8ff0a0e727..d69433a77c2b8c267cf0ca80dcf13fd11e1ee746 100644 (file)
@@ -1,4 +1,4 @@
-;;; cygwin.el --- support for the Cygwin terminal -*- no-byte-compile: t -*-
+;;; cygwin.el --- support for the Cygwin terminal
 
 ;;; The Cygwin terminal can't really display underlines.
 
index 945fe1f5a69da5f223dd764cd6574327cef4097b..9a9a31f4253af0c62afcd4451ff44a31ba842eb8 100644 (file)
@@ -1,4 +1,4 @@
-;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps -*- no-byte-compile: t -*-
+;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps
 
 ;; Copyright (C) 1997, 2001-2012 Free Software Foundation, Inc.
 
index 76115e7d58a79a4d15ed768abcfd1acffcc7594d..00bcdfdf5427d91550cc633561512ddc7544a88d 100644 (file)
@@ -1,6 +1,7 @@
-;; -*- no-byte-compile: t -*-
 ;; The Linux console handles Latin-1 by default.
 
+(declare-function gpm-mouse-enable "t-mouse" ())
+
 (defun terminal-init-linux ()
   "Terminal initialization function for linux."
   (unless (terminal-coding-system)
index e1da0f6f1db8dcb357a990db0ed8a0aa4db62f0d..76a3a31cedcf4ba78af79f588acc53671cb0ce73 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 ;; Define function key sequences for DEC terminals.
 
 (defvar lk201-function-map
index 19d0ff3f7e6b334bb7a8e587ada9a2cb6036a349..70a1be8497e885cbab2d0b1302bf35808f26deb1 100644 (file)
@@ -1,4 +1,4 @@
-;;; news.el --- keypad and function key bindings for the Sony NEWS keyboard -*- no-byte-compile: t -*-
+;;; news.el --- keypad and function key bindings for the Sony NEWS keyboard
 
 ;; Copyright (C) 1989, 1993, 2001-2012 Free Software Foundation, Inc.
 
index b681ec3440f80c82a06e93fe3c3302011ef9e959..06b67475c1d1bff02d8b0869f515a90a5759a836 100644 (file)
@@ -1,4 +1,4 @@
-;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system
+;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/MacOS X window system  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1993-1994, 2005-2012  Free Software Foundation, Inc.
 
@@ -44,8 +44,6 @@
     (error "%s: Loading ns-win.el but not compiled for GNUstep/MacOS"
            (invocation-name)))
 
-(eval-when-compile (require 'cl))       ; lexical-let
-
 ;; Documentation-purposes only: actually loaded in loadup.el.
 (require 'frame)
 (require 'mouse)
@@ -65,7 +63,7 @@
 ;; nsterm.m.
 (defvar ns-input-file)
 
-(defun ns-handle-nxopen (switch &optional temp)
+(defun ns-handle-nxopen (_switch &optional temp)
   (setq unread-command-events (append unread-command-events
                                       (if temp '(ns-open-temp-file)
                                         '(ns-open-file)))
@@ -74,7 +72,7 @@
 (defun ns-handle-nxopentemp (switch)
   (ns-handle-nxopen switch t))
 
-(defun ns-ignore-1-arg (switch)
+(defun ns-ignore-1-arg (_switch)
   (setq x-invocation-args (cdr x-invocation-args)))
 
 (defun ns-parse-geometry (geom)
@@ -201,21 +199,20 @@ The properties returned may include `top', `left', `height', and `width'."
                 (mapconcat 'identity (cons "ns-service" path) "-")))))
     ;; This defines the function.
     (defalias name
-      (lexical-let ((service service))
-        (lambda (arg)
-          (interactive "p")
-          (let* ((in-string
-                  (cond ((stringp arg) arg)
-                        (mark-active
-                         (buffer-substring (region-beginning) (region-end)))))
-                 (out-string (ns-perform-service service in-string)))
-            (cond
-             ((stringp arg) out-string)
-             ((and out-string (or (not in-string)
-                                  (not (string= in-string out-string))))
-              (if mark-active (delete-region (region-beginning) (region-end)))
-              (insert out-string)
-              (setq deactivate-mark nil)))))))
+      (lambda (arg)
+        (interactive "p")
+        (let* ((in-string
+                (cond ((stringp arg) arg)
+                      (mark-active
+                       (buffer-substring (region-beginning) (region-end)))))
+               (out-string (ns-perform-service service in-string)))
+          (cond
+           ((stringp arg) out-string)
+           ((and out-string (or (not in-string)
+                                (not (string= in-string out-string))))
+            (if mark-active (delete-region (region-beginning) (region-end)))
+            (insert out-string)
+            (setq deactivate-mark nil))))))
     (cond
      ((lookup-key global-map mapping)
       (while (cdr path)
@@ -566,7 +563,7 @@ unless the current buffer is a scratch buffer."
                                              parameters))))))))
 
 ;; frame will be focused anyway, so select it
-;; (if this is not done, modeline is dimmed until first interaction)
+;; (if this is not done, mode line is dimmed until first interaction)
 (add-hook 'after-make-frame-functions 'select-frame)
 
 (defvar tool-bar-mode)
@@ -826,7 +823,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
      ((not window-pos)
       nil)
      ((eq window-pos 'mode-line)
-      'modeline)
+      'mode-line)
      ((eq window-pos 'vertical-line)
       'default)
      ((consp window-pos)
@@ -924,6 +921,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
   ;; http://lists.gnu.org/archive/html/emacs-devel/2011-06/msg00505.html
   (ns-set-resource nil "ApplePressAndHoldEnabled" "NO")
 
+  (x-apply-session-resources)
   (setq ns-initialized t))
 
 (add-to-list 'handle-args-function-alist '(ns . x-handle-args))
index 4931a422e0971e5f3aaf9c5d0804402067355c35..d37a695086ad1d717d2b3112dfb119a689abde34 100644 (file)
@@ -1,7 +1,8 @@
-;; -*- no-byte-compile: t -*-
 ;; Treat a screen terminal similar to an xterm.
 (load "term/xterm")
 
+(declare-function xterm-register-default-colors "xterm" ())
+
 (defun terminal-init-screen ()
   "Terminal initialization function for screen."
   ;; Use the xterm color initialization code.
index 71a4e06afe8c6d8d4ba01a27f53bcce2eb71f973..c70080c90621f096b2d0399d4d5f760cf1fa3a96 100644 (file)
@@ -63,7 +63,7 @@ executes the mouse commands.
 2R delete region         |
 3R copy region           |
 
-on modeline                on \"scroll bar\"   in minibuffer
+on mode line               on \"scroll bar\"   in minibuffer
  L scroll-up               line to top         execute-extended-command
  C proportional goto-char   line to middle     mouse-help
  R scroll-down             line to bottom      eval-expression"
@@ -79,14 +79,14 @@ on modeline             on \"scroll bar\"   in minibuffer
        (old-window (selected-window))
        (in-minibuf-p (eq y (1- (frame-height))))
        (same-window-p (and (not in-minibuf-p) (eq window old-window)))
-       (in-modeline-p (eq y (1- (nth 3 edges))))
+       (in-mode-line-p (eq y (1- (nth 3 edges))))
        (in-scrollbar-p (>= x (1- (nth 2 edges)))))
     (setq x (- x (nth 0 edges)))
     (setq y (- y (nth 1 edges)))
 
 ;    (error "mouse-hit %d %d %d" buttons x y) ;;;; debug
 
-    (cond (in-modeline-p
+    (cond (in-mode-line-p
           (select-window window)
           (cond ((= buttons mouse-left)
                  (scroll-up))
index 161e6222df26f1cb2133ce997a3eb5694788d3a7..b02d39c1e0f4140b104349d5b2c91952cbf0ee08 100644 (file)
@@ -27,8 +27,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defvar tvi970-terminal-map
   (let ((map (make-sparse-keymap)))
 
index 0f2e3805f581a1aaf58171f6446d8717c09b0eaa..261b0bb5fd6626ba4afe3175047a97f9fe42fabc 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 
 (defun terminal-init-vt102 ()
   "Terminal initialization function for vt102."
index 029f762ef3f3f4ca1e057d8e2fbfa32a81bf1444..2b2098d483d2c1f5db1c8d8118ee37ccf2eb32dd 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 
 (defun terminal-init-vt125 ()
   "Terminal initialization function for vt125."
index 09ad64d01f628005c0703bded7892e477890eaa2..550266816e04dd70c778706c5258485294624344 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 ;; For our purposes we can treat the vt200 and vt100 almost alike.
 ;; Most differences are handled by the termcap entry.
 (defun terminal-init-vt200 ()
index cbeba00b65147e826ee16fb389e447e35473a6ff..a65b47377315954d9b4ea34bdcf81c1e49f564de 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 ;; For our purposes we can treat the vt200 and vt100 almost alike.
 ;; Most differences are handled by the termcap entry.
 (defun terminal-init-vt201 ()
index 647b79ea3576861ccd9ccfb79819109c6822a113..0dd43353c558ac9b0c551e2749464b6a51417fea 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 ;; For our purposes we can treat the vt200 and vt100 almost alike.
 ;; Most differences are handled by the termcap entry.
 (defun terminal-init-vt220 ()
index 2da4e7ed3c713ecadaac57e0e6815a146b5e5627..b58d4211ce7e7b1fb14d41d9d78b78b23a4b513f 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 ;; For our purposes we can treat the vt200 and vt100 almost alike.
 ;; Most differences are handled by the termcap entry.
 (defun terminal-init-vt240 ()
index 52198d840ae198801aa9170e1e11472f4258b3b9..a2664552a64bad43b9aa29964ca2d839d17b65e7 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 (defun terminal-init-vt300 ()
   "Terminal initialization function for vt300."
   (tty-run-terminal-initialization (selected-frame) "vt100")
index 9b04a5d6ee4ec4d94caab4cf29c15a7b33d075b0..08ed9a8ffb98ede008b2e295f303fa3b408c3f83 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 (defun terminal-init-vt320 ()
   "Terminal initialization function for vt320."
   (tty-run-terminal-initialization (selected-frame) "vt100")
index 4c5870c5ad88eb9ddb6f70eba29c40e96ee62296..ad4a5fdbb4f7aec23d5929fd013137f6236bed3d 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 (defun terminal-init-vt400 ()
   "Terminal initialization function for vt400."
   (tty-run-terminal-initialization (selected-frame) "vt100")
index 0476b639c238577839f748c48bc6103f02baec43..f6745a3953a9768c7df4ed5e32f3dd603d4f4362 100644 (file)
@@ -1,4 +1,3 @@
-;; -*- no-byte-compile: t -*-
 (defun terminal-init-vt420 ()
   "Terminal initialization function for vt420."
   (tty-run-terminal-initialization (selected-frame) "vt100")
index abfaafd97400ee909fe050e12d6992bece389de8..a4fac3441db0e4cac5d28e896ffff7f43e45e5c0 100644 (file)
@@ -210,7 +210,8 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
        '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
        '(glib "libglib-2.0-0.dll")
        '(gobject "libgobject-2.0-0.dll")
-       '(gnutls "libgnutls-28.dll" "libgnutls-26.dll")))
+       '(gnutls "libgnutls-28.dll" "libgnutls-26.dll")
+       '(libxml2 "libxml2-2.dll" "libxml2.dll")))
 
 ;;; multi-tty support
 (defvar w32-initialized nil
@@ -308,6 +309,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 
   ;; Set to a system sound if you want a fancy bell.
   (set-message-beep 'ok)
+  (x-apply-session-resources)
   (setq w32-initialized t))
 
 (add-to-list 'handle-args-function-alist '(w32 . x-handle-args))
index f08ababe0dfc9d13e0d11022d7c11cb4a9fa8975..d037962af1948c602ef1c8d36505f4af09dbad5f 100644 (file)
@@ -1,4 +1,4 @@
-;;; wyse50.el --- terminal support code for Wyse 50 -*- no-byte-compile: t -*-
+;;; wyse50.el --- terminal support code for Wyse 50
 
 ;; Copyright (C) 1989, 1993-1994, 2001-2012 Free Software Foundation, Inc.
 
@@ -141,7 +141,7 @@ C-l Scrn CLR
 M-r    M-x move-to-window-line, Funct up-arrow or down-arrow are similar"
   (interactive)
   ;; Not needed any more now that we use input-decode-map.
-  ;; (dolist (key-definition 
+  ;; (dolist (key-definition
   ;;         ;; By unsetting C-a and then binding it to a prefix, we
   ;;         ;; allow the rest of the function keys which start with C-a
   ;;         ;; to be recognized.
index 21d49267b21a54dac54e3b0d0b57bde7a425d48c..498cc01fe226ae4dea0184d6af3aedb309083e5e 100644 (file)
@@ -1445,6 +1445,7 @@ Request data types in the order specified by `x-select-request-type'."
   ;;                   :help "Paste (yank) text most recently cut/copied")
   ;;       nil))
 
+  (x-apply-session-resources)
   (setq x-initialized t))
 
 (add-to-list 'handle-args-function-alist '(x . x-handle-args))
index 7e56cd9fa1da1e6f3be965a7a431b32378337cbc..28fb9da0b9dbfd8e20e49aff60fa3710347b8c6e 100644 (file)
@@ -27,7 +27,7 @@
 (defgroup xterm nil
   "XTerm support."
   :version "24.1"
-  :group 'emacs)
+  :group 'environment)
 
 (defcustom xterm-extra-capabilities 'check
   "Whether Xterm supports some additional, more modern, features.
@@ -539,6 +539,7 @@ The relevant features are:
                 (and (memq 'reportBackground tocheck-capabilities)
                      version
                      (>= version 242)))
+       (discard-input)
         (send-string-to-terminal "\e]11;?\e\\")
         (when (and (equal (read-event nil nil 2) ?\e)
                    (equal (read-event nil nil 2) ?\]))
index 72ae44bb60d889f799a035c8e238cfdb5033db73..76d03dd164fc8ae98f3eb10b3c2351157be65bb3 100644 (file)
@@ -349,7 +349,7 @@ Example:
 
 
 (defvar artist-pointer-shape (if (eq window-system 'x) x-pointer-crosshair nil)
-  "*If in X Windows, use this pointer shape while drawing with the mouse.")
+  "If in X Windows, use this pointer shape while drawing with the mouse.")
 
 
 (defcustom artist-text-renderer-function 'artist-figlet
@@ -397,13 +397,13 @@ Example:
   ;; This is a defvar, not a defcustom, since the custom
   ;; package shows lists of characters as a lists of integers,
   ;; which is confusing
-  "*Characters (``color'') to use when spraying.
+  "Characters (``color'') to use when spraying.
 They should be ordered from the ``lightest'' to the ``heaviest''
 since spraying replaces a light character with the next heavier one.")
 
 
 (defvar artist-spray-new-char ?.
-  "*Initial character to use when spraying.
+  "Initial character to use when spraying.
 This character is used if spraying upon a character that is not in
 `artist-spray-chars'.  The character defined by this variable should
 be in `artist-spray-chars', or spraying will behave strangely.")
@@ -1197,9 +1197,9 @@ PREV-OP-ARG are used when invoked recursively during the build-up."
 ;;; ---------------------------------
 
 ;;;###autoload
-(defun artist-mode (&optional state)
+(define-minor-mode artist-mode
   "Toggle Artist mode.
-With argument STATE, turn Artist mode on if STATE is positive.
+With argument ARG, turn Artist mode on if ARG is positive.
 Artist lets you draw lines, squares, rectangles and poly-lines,
 ellipses and circles with your mouse and/or keyboard.
 
@@ -1388,36 +1388,24 @@ Variables
 
 Hooks
 
- When entering artist-mode, the hook `artist-mode-init-hook' is called.
- When quitting artist-mode, the hook `artist-mode-exit-hook' is called.
+ Turning the mode on or off runs `artist-mode-hook'.
 
 
 Keymap summary
 
 \\{artist-mode-map}"
-  (interactive)
-  (if (setq artist-mode
-           (if (null state) (not artist-mode)
-             (> (prefix-numeric-value state) 0)))
-      (artist-mode-init)
-    (artist-mode-exit)))
-
-;; insert our minor mode string
-(or (assq 'artist-mode minor-mode-alist)
-    (setq minor-mode-alist
-         (cons '(artist-mode artist-mode-name)
-               minor-mode-alist)))
-
-;; insert our minor mode keymap
-(or (assq 'artist-mode minor-mode-map-alist)
-    (setq minor-mode-map-alist
-         (cons (cons 'artist-mode artist-mode-map)
-               minor-mode-map-alist)))
-
+  :init-value nil :group 'artist :lighter artist-mode-name
+  :keymap artist-mode-map
+  (cond ((null artist-mode)
+        ;; Turn mode off
+        (artist-mode-exit))
+       (t
+        ;; Turn mode on
+        (artist-mode-init))))
 
 ;; Init and exit
 (defun artist-mode-init ()
-  "Init Artist mode.  This will call the hook `artist-mode-init-hook'."
+  "Init Artist mode.  This will call the hook `artist-mode-hook'."
   ;; Set up a conversion table for mapping tabs and new-lines to spaces.
   ;; the last case, 0, is for the last position in buffer/region, where
   ;; the `following-char' function returns 0.
@@ -1459,15 +1447,13 @@ Keymap summary
       (progn
        (picture-mode)
        (message "")))
-  (run-hooks 'artist-mode-init-hook)
   (artist-mode-line-show-curr-operation artist-key-is-drawing))
 
 (defun artist-mode-exit ()
-  "Exit Artist mode.  This will call the hook `artist-mode-exit-hook'."
+  "Exit Artist mode.  This will call the hook `artist-mode-hook'."
   (if (and artist-picture-compatibility (eq major-mode 'picture-mode))
       (picture-mode-exit))
-  (kill-local-variable 'next-line-add-newlines)
-  (run-hooks 'artist-mode-exit-hook))
+  (kill-local-variable 'next-line-add-newlines))
 
 (defun artist-mode-off ()
   "Turn Artist mode off."
index 01733f97042101e3e09a0bd420ff7da7c8bb6736..c8881fa5f9d6c76da828f6c9231459e2d96ab4aa 100644 (file)
@@ -137,7 +137,7 @@ with the cdr.")
 
 
 (defcustom bib-auto-capitalize t
-  "*True to automatically capitalize appropriate fields in Bib mode."
+  "True to automatically capitalize appropriate fields in Bib mode."
   :type 'boolean
   :group 'bib)
 
index a873680a8c8a2545e97a50c2de37bfc97ad6b976..31656918fad413643566bf3d363790c3a978fbcb 100644 (file)
@@ -916,8 +916,10 @@ to the directories specified in `bibtex-string-file-path'."
   :group 'bibtex
   :type '(repeat file))
 
-(defvar bibtex-string-file-path (getenv "BIBINPUTS")
-  "*Colon separated list of paths to search for `bibtex-string-files'.")
+(defcustom bibtex-string-file-path (getenv "BIBINPUTS")
+  "Colon-separated list of paths to search for `bibtex-string-files'."
+  :group 'bibtex
+  :type 'string)
 
 (defcustom bibtex-files nil
   "List of BibTeX files that are searched for entry keys.
@@ -930,8 +932,10 @@ See also `bibtex-search-entry-globally'."
   :type '(repeat (choice (const :tag "bibtex-file-path" bibtex-file-path)
                          directory file)))
 
-(defvar bibtex-file-path (getenv "BIBINPUTS")
-  "*Colon separated list of paths to search for `bibtex-files'.")
+(defcustom bibtex-file-path (getenv "BIBINPUTS")
+  "Colon separated list of paths to search for `bibtex-files'."
+  :group 'bibtex
+  :type 'string)
 
 (defcustom bibtex-search-entry-globally nil
   "If non-nil, interactive calls of `bibtex-search-entry' search globally.
@@ -1614,7 +1618,7 @@ Initialized by `bibtex-set-dialect'.")
     ,@(mapcar (lambda (matcher)
                 `((lambda (bound) (bibtex-font-lock-cite ',matcher bound))))
               bibtex-cite-matcher-alist))
-  "*Default expressions to highlight in BibTeX mode.")
+  "Default expressions to highlight in BibTeX mode.")
 
 (defvar bibtex-font-lock-url-regexp
   ;; Assume that field names begin at the beginning of a line.
index b9e4da59e18d3ff5eda405228cb707653fda11a4..d50aadef25b1805dab34a286cbcf2dcc5c1413ad 100644 (file)
@@ -37,7 +37,6 @@
   "Cascading Style Sheets (CSS) editing mode."
   :group 'languages)
 
-(eval-when-compile (require 'cl))
 
 (defun css-extract-keyword-list (res)
   (with-temp-buffer
index 08254c6f5f73630287e2ae69ee748723ac597ee7..d0e90c99516806bcccc7accc88151471b668f17d 100644 (file)
@@ -1011,7 +1011,8 @@ space does not end a sentence, so don't break a line there."
                       (if current-prefix-arg 'full))))
   (unless (memq justify '(t nil none full center left right))
     (setq justify 'full))
-  (let (max beg fill-pfx)
+  (let ((start-point (point-marker))
+       max beg fill-pfx)
     (goto-char (max from to))
     (when to-eop
       (skip-chars-backward "\n")
@@ -1042,6 +1043,8 @@ space does not end a sentence, so don't break a line there."
            (setq fill-pfx
                  (fill-region-as-paragraph (point) end justify nosqueeze))
          (goto-char end))))
+    (goto-char start-point)
+    (set-marker start-point nil)
     fill-pfx))
 
 \f
index 930fda0626b150ffa959c01930e6bc39bf864c28..a9320d945ef2f98e99d4a1f23bc6d6364cfd5cd5 100644 (file)
@@ -143,10 +143,9 @@ whose length is specified by `flyspell-delay'."
   :type '(repeat (symbol)))
 
 (defcustom flyspell-default-deplacement-commands
-  '(next-line
-    previous-line
-    scroll-up
-    scroll-down)
+  '(next-line previous-line
+    handle-switch-frame handle-select-window
+    scroll-up scroll-down)
   "The standard list of deplacement commands for Flyspell.
 See `flyspell-deplacement-commands'."
   :group 'flyspell
@@ -233,8 +232,8 @@ URL `http://www.gnu.org/software/auctex/'"
   :type 'boolean)
 
 (defcustom flyspell-mode-line-string " Fly"
-  "String displayed on the modeline when flyspell is active.
-Set this to nil if you don't want a modeline indicator."
+  "String displayed on the mode line when flyspell is active.
+Set this to nil if you don't want a mode line indicator."
   :group 'flyspell
   :type '(choice string (const :tag "None" nil)))
 
@@ -436,7 +435,7 @@ like <img alt=\"Some thing.\">."
 
 ;; dash character machinery
 (defvar flyspell-consider-dash-as-word-delimiter-flag nil
-   "*Non-nil means that the `-' char is considered as a word delimiter.")
+  "Non-nil means that the `-' char is considered as a word delimiter.")
 (make-variable-buffer-local 'flyspell-consider-dash-as-word-delimiter-flag)
 (defvar flyspell-dash-dictionary nil)
 (make-variable-buffer-local 'flyspell-dash-dictionary)
@@ -446,20 +445,14 @@ like <img alt=\"Some thing.\">."
 ;;*---------------------------------------------------------------------*/
 ;;*    Highlighting                                                     */
 ;;*---------------------------------------------------------------------*/
-(defface flyspell-incorrect
-  '((((class color)) (:foreground "OrangeRed" :bold t :underline t))
-    (t (:bold t)))
-  "Face used for marking a misspelled word in Flyspell."
+(defface flyspell-incorrect '((t :underline t :inherit error))
+  "Flyspell face for misspelled words."
   :group 'flyspell)
-(define-obsolete-face-alias 'flyspell-incorrect-face 'flyspell-incorrect "22.1")
 
-(defface flyspell-duplicate
-  '((((class color)) (:foreground "Gold3" :bold t :underline t))
-    (t (:bold t)))
-  "Face used for marking a misspelled word that appears twice in the buffer.
+(defface flyspell-duplicate '((t :underline t :inherit warning))
+  "Flyspell face for words that appear twice in a row.
 See also `flyspell-duplicate-distance'."
   :group 'flyspell)
-(define-obsolete-face-alias 'flyspell-duplicate-face 'flyspell-duplicate "22.1")
 
 (defvar flyspell-overlay nil)
 
@@ -616,7 +609,9 @@ in your .emacs file.
   ;; the welcome message
   (if (and flyspell-issue-message-flag
           flyspell-issue-welcome-flag
-          (called-interactively-p 'interactive))
+          (if (featurep 'xemacs)
+              (interactive-p) ;; XEmacs does not have (called-interactively-p)
+            (called-interactively-p 'interactive)))
       (let ((binding (where-is-internal 'flyspell-auto-correct-word
                                        nil 'non-ascii)))
        (message "%s"
@@ -631,7 +626,7 @@ in your .emacs file.
 (defun flyspell-delay-commands ()
   "Install the standard set of Flyspell delayed commands."
   (mapc 'flyspell-delay-command flyspell-default-delayed-commands)
-  (mapcar 'flyspell-delay-command flyspell-delayed-commands))
+  (mapc 'flyspell-delay-command flyspell-delayed-commands))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-delay-command ...                                       */
@@ -639,7 +634,7 @@ in your .emacs file.
 (defun flyspell-delay-command (command)
   "Set COMMAND to be delayed, for Flyspell.
 When flyspell `post-command-hook' is invoked because a delayed command
-as been used the current word is not immediately checked.
+has been used, the current word is not immediately checked.
 It will be checked only after `flyspell-delay' seconds."
   (interactive "SDelay Flyspell after Command: ")
   (put command 'flyspell-delayed t))
@@ -650,16 +645,15 @@ It will be checked only after `flyspell-delay' seconds."
 (defun flyspell-deplacement-commands ()
   "Install the standard set of Flyspell deplacement commands."
   (mapc 'flyspell-deplacement-command flyspell-default-deplacement-commands)
-  (mapcar 'flyspell-deplacement-command flyspell-deplacement-commands))
+  (mapc 'flyspell-deplacement-command flyspell-deplacement-commands))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-deplacement-command ...                                 */
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-deplacement-command (command)
   "Set COMMAND that implement cursor movements, for Flyspell.
-When flyspell `post-command-hook' is invoked because of a deplacement command
-as been used the current word is checked only if the previous command was
-not the very same deplacement command."
+When flyspell `post-command-hook' is invoked because a deplacement command
+has been used, the current word is not checked."
   (interactive "SDeplacement Flyspell after Command: ")
   (put command 'flyspell-deplacement t))
 
@@ -680,12 +674,12 @@ not the very same deplacement command."
 ;;*    post command hook, we will check, if the word at this position   */
 ;;*    has to be spell checked.                                         */
 ;;*---------------------------------------------------------------------*/
-(defvar flyspell-pre-buffer     nil)
-(defvar flyspell-pre-point      nil)
-(defvar flyspell-pre-column     nil)
+(defvar flyspell-pre-buffer     nil "Buffer current before `this-command'.")
+(defvar flyspell-pre-point      nil "Point before running `this-command'")
+(defvar flyspell-pre-column     nil "Column before running `this-command'")
 (defvar flyspell-pre-pre-buffer nil)
 (defvar flyspell-pre-pre-point  nil)
-(make-variable-buffer-local 'flyspell-pre-point)
+(make-variable-buffer-local 'flyspell-pre-point) ;Why??  --Stef
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-previous-command ...                                    */
@@ -709,18 +703,18 @@ not the very same deplacement command."
 ;;;###autoload
 (defun flyspell-mode-off ()
   "Turn Flyspell mode off."
-  ;; we remove the hooks
+  ;; We remove the hooks.
   (remove-hook 'post-command-hook (function flyspell-post-command-hook) t)
   (remove-hook 'pre-command-hook (function flyspell-pre-command-hook) t)
   (remove-hook 'after-change-functions 'flyspell-after-change-function t)
   (remove-hook 'hack-local-variables-hook
               (function flyspell-hack-local-variables-hook) t)
-  ;; we remove all the flyspell highlightings
+  ;; We remove all the flyspell highlightings.
   (flyspell-delete-all-overlays)
-  ;; we have to erase pre cache variables
+  ;; We have to erase pre cache variables.
   (setq flyspell-pre-buffer nil)
   (setq flyspell-pre-point  nil)
-  ;; we mark the mode as killed
+  ;; We mark the mode as killed.
   (setq flyspell-mode nil))
 
 ;;*---------------------------------------------------------------------*/
@@ -730,39 +724,49 @@ not the very same deplacement command."
   "Return non-nil if we should check the word before point.
 More precisely, it applies to the word that was before point
 before the current command."
-  (cond
-   ((or (not (numberp flyspell-pre-point))
-       (not (bufferp flyspell-pre-buffer))
-       (not (buffer-live-p flyspell-pre-buffer)))
-    nil)
-   ((and (eq flyspell-pre-pre-point flyspell-pre-point)
-        (eq flyspell-pre-pre-buffer flyspell-pre-buffer))
-    nil)
-   ((or (and (= flyspell-pre-point (- (point) 1))
-            (eq (char-syntax (char-after flyspell-pre-point)) ?w))
-       (= flyspell-pre-point (point))
-       (= flyspell-pre-point (+ (point) 1)))
-    nil)
-   ((and (symbolp this-command)
-        (not executing-kbd-macro)
-        (or (get this-command 'flyspell-delayed)
-            (and (get this-command 'flyspell-deplacement)
-                 (eq flyspell-previous-command this-command)))
-        (or (= (current-column) 0)
-            (= (current-column) flyspell-pre-column)
-            ;; If other post-command-hooks change the buffer,
-            ;; flyspell-pre-point can lie past eob (bug#468).
-            (null (char-after flyspell-pre-point))
-            (eq (char-syntax (char-after flyspell-pre-point)) ?w)))
-    nil)
-   ((not (eq (current-buffer) flyspell-pre-buffer))
-    t)
-   ((not (and (numberp flyspell-word-cache-start)
-             (numberp flyspell-word-cache-end)))
-    t)
-   (t
-    (or (< flyspell-pre-point flyspell-word-cache-start)
-       (> flyspell-pre-point flyspell-word-cache-end)))))
+  (let ((ispell-otherchars (ispell-get-otherchars)))
+    (cond
+   ((not (and (numberp flyspell-pre-point)
+              (buffer-live-p flyspell-pre-buffer)))
+      nil)
+     ((and (eq flyspell-pre-pre-point flyspell-pre-point)
+          (eq flyspell-pre-pre-buffer flyspell-pre-buffer))
+      nil)
+     ((or (and (= flyspell-pre-point (- (point) 1))
+              (or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
+                  (and (not (string= "" ispell-otherchars))
+                       (string-match
+                        ispell-otherchars
+                        (buffer-substring-no-properties
+                         flyspell-pre-point (1+ flyspell-pre-point))))))
+         (= flyspell-pre-point (point))
+         (= flyspell-pre-point (+ (point) 1)))
+      nil)
+     ((and (symbolp this-command)
+          (not executing-kbd-macro)
+          (or (get this-command 'flyspell-delayed)
+              (and (get this-command 'flyspell-deplacement)
+                   (eq flyspell-previous-command this-command)))
+          (or (= (current-column) 0)
+              (= (current-column) flyspell-pre-column)
+              ;; If other post-command-hooks change the buffer,
+              ;; flyspell-pre-point can lie past eob (bug#468).
+              (null (char-after flyspell-pre-point))
+              (or (eq (char-syntax (char-after flyspell-pre-point)) ?w)
+                  (and (not (string= "" ispell-otherchars))
+                       (string-match
+                        ispell-otherchars
+                        (buffer-substring-no-properties
+                         flyspell-pre-point (1+ flyspell-pre-point)))))))
+      nil)
+     ((not (eq (current-buffer) flyspell-pre-buffer))
+      t)
+     ((not (and (numberp flyspell-word-cache-start)
+               (numberp flyspell-word-cache-end)))
+      t)
+     (t
+      (or (< flyspell-pre-point flyspell-word-cache-start)
+         (> flyspell-pre-point flyspell-word-cache-end))))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    The flyspell after-change-hook, store the change position. In    */
@@ -783,21 +787,15 @@ before the current command."
 ;;*    flyspell-check-changed-word-p ...                                */
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-check-changed-word-p (start stop)
-  "Return t when the changed word has to be checked.
+  "Return non-nil when the changed word has to be checked.
 The answer depends of several criteria.
 Mostly we check word delimiters."
-  (cond
-   ((and (memq (char-after start) '(?\n ? )) (> stop start))
-    t)
-   ((not (numberp flyspell-pre-point))
-    t)
-   ((and (>= flyspell-pre-point start) (<= flyspell-pre-point stop))
-    nil)
-   ((let ((pos (point)))
-      (or (>= pos start) (<= pos stop) (= pos (1+ stop))))
-    nil)
-   (t
-    t)))
+  (not (and (not (and (memq (char-after start) '(?\n ? )) (> stop start)))
+            (numberp flyspell-pre-point)
+            (or
+             (and (>= flyspell-pre-point start) (<= flyspell-pre-point stop))
+             (let ((pos (point)))
+               (or (>= pos start) (<= pos stop) (= pos (1+ stop))))))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-check-word-p ...                                        */
@@ -806,30 +804,33 @@ Mostly we check word delimiters."
   "Return t when the word at `point' has to be checked.
 The answer depends of several criteria.
 Mostly we check word delimiters."
-  (cond
-   ((<= (- (point-max) 1) (point-min))
-    ;; the buffer is not filled enough
-    nil)
-   ((and (and (> (current-column) 0)
-             (not (eq (current-column) flyspell-pre-column)))
-        (save-excursion
-          (backward-char 1)
-          (and (looking-at (flyspell-get-not-casechars))
-               (or flyspell-consider-dash-as-word-delimiter-flag
-                   (not (looking-at "-"))))))
-    ;; yes because we have reached or typed a word delimiter.
-    t)
-   ((symbolp this-command)
+  (let ((ispell-otherchars (ispell-get-otherchars)))
     (cond
-     ((get this-command 'flyspell-deplacement)
-      (not (eq flyspell-previous-command this-command)))
-     ((get this-command 'flyspell-delayed)
-      ;; the current command is not delayed, that
-      ;; is that we must check the word now
-      (and (not unread-command-events)
-          (sit-for flyspell-delay)))
-     (t t)))
-   (t t)))
+     ((<= (- (point-max) 1) (point-min))
+      ;; The buffer is not filled enough.
+      nil)
+     ((and (and (> (current-column) 0)
+               (not (eq (current-column) flyspell-pre-column)))
+          (save-excursion
+            (backward-char 1)
+            (and (looking-at (flyspell-get-not-casechars))
+                 (or (string= "" ispell-otherchars)
+                     (not (looking-at ispell-otherchars)))
+                 (or flyspell-consider-dash-as-word-delimiter-flag
+                     (not (looking-at "-"))))))
+      ;; Yes because we have reached or typed a word delimiter.
+      t)
+     ((symbolp this-command)
+      (cond
+       ((get this-command 'flyspell-deplacement)
+       (not (eq flyspell-previous-command this-command)))
+       ((get this-command 'flyspell-delayed)
+       ;; The current command is not delayed, that
+       ;; is that we must check the word now.
+       (and (not unread-command-events)
+            (sit-for flyspell-delay)))
+       (t t)))
+     (t t))))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-debug-signal-no-check ...                               */
@@ -859,52 +860,55 @@ Mostly we check word delimiters."
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-debug-signal-word-checked ()
   (setq debug-on-error t)
-  (let ((oldbuf (current-buffer))
+  (let ((ispell-otherchars (ispell-get-otherchars))
+       (oldbuf (current-buffer))
         (point  (point)))
     (with-current-buffer (get-buffer-create "*flyspell-debug*")
-      (insert "WORD:\n")
-      (insert (format "  this-cmd   : %S\n" this-command))
-      (insert (format "  delayed    : %S\n" (and (symbolp this-command)
-                                                (get this-command 'flyspell-delayed))))
-      (insert (format "  point      : %S\n" point))
-      (insert (format "  prev-char  : [%c] %S\n"
-                     (with-current-buffer oldbuf
-                       (let ((c (if (> (point) (point-min))
-                                    (save-excursion
-                                      (backward-char 1)
-                                      (char-after (point)))
-                                  ? )))
-                         c))
-                     (with-current-buffer oldbuf
-                       (let ((c (if (> (point) (point-min))
-                                    (save-excursion
-                                      (backward-char 1)
-                                      (and (and (looking-at (flyspell-get-not-casechars)) 1)
-                                           (and (or flyspell-consider-dash-as-word-delimiter-flag
-                                                    (not (looking-at "\\-"))) 2))))))
-                         c))))
-      (insert (format "  because    : %S\n"
-                     (cond
-                      ((not (and (symbolp this-command)
-                                 (get this-command 'flyspell-delayed)))
-                       ;; the current command is not delayed, that
-                       ;; is that we must check the word now
-                       'not-delayed)
-                      ((with-current-buffer oldbuf
-                         (let ((c (if (> (point) (point-min))
-                                      (save-excursion
-                                        (backward-char 1)
-                                        (and (looking-at (flyspell-get-not-casechars))
-                                             (or flyspell-consider-dash-as-word-delimiter-flag
-                                                 (not (looking-at "\\-"))))))))
-                           c))
-                       ;; yes because we have reached or typed a word delimiter.
-                       'separator)
-                      ((not (integerp flyspell-delay))
-                       ;; yes because the user had set up a no-delay configuration.
-                       'no-delay)
-                      (t
-                       'sit-for))))
+      (insert
+       "WORD:\n"
+       (format "  this-cmd   : %S\n" this-command)
+       (format "  delayed    : %S\n" (and (symbolp this-command)
+                                          (get this-command
+                                               'flyspell-delayed)))
+       (format "  point      : %S\n" point)
+       (format "  prev-char  : [%c] %S\n"
+               (with-current-buffer oldbuf
+                 (if (bobp) ?\  (char-before)))
+               (with-current-buffer oldbuf
+                 (if (bobp)
+                     nil
+                   (save-excursion
+                     (backward-char 1)
+                     (and (looking-at (flyspell-get-not-casechars))
+                          (or (string= "" ispell-otherchars)
+                              (not (looking-at ispell-otherchars)))
+                          (or flyspell-consider-dash-as-word-delimiter-flag
+                              (not (looking-at "\\-")))
+                          2)))))
+       (format "  because    : %S\n"
+               (cond
+                ((not (and (symbolp this-command)
+                           (get this-command 'flyspell-delayed)))
+                 ;; The current command is not delayed, that
+                 ;; is that we must check the word now.
+                 'not-delayed)
+                ((with-current-buffer oldbuf
+                   (if (bobp)
+                       nil
+                     (save-excursion
+                       (backward-char 1)
+                       (and (looking-at (flyspell-get-not-casechars))
+                            (or (string= "" ispell-otherchars)
+                                (not (looking-at ispell-otherchars)))
+                            (or flyspell-consider-dash-as-word-delimiter-flag
+                                (not (looking-at "\\-")))))))
+                 ;; Yes because we have reached or typed a word delimiter.
+                 'separator)
+                ((not (integerp flyspell-delay))
+                 ;; Yes because the user set up a no-delay configuration.
+                 'no-delay)
+                (t
+                 'sit-for))))
       (goto-char (point-max)))))
 
 ;;*---------------------------------------------------------------------*/
@@ -927,7 +931,7 @@ Mostly we check word delimiters."
 ;;*    2- the word that used to be the current word before the          */
 ;;*       THIS-COMMAND is checked if:                                   */
 ;;*        a- the previous word is different from the current word      */
-;;*        b- the previous word as not just been checked by the         */
+;;*        b- the previous word has not just been checked by the        */
 ;;*           previous FLYSPELL-POST-COMMAND-HOOK                       */
 ;;*    3- the words changed by the THIS-COMMAND that are neither the    */
 ;;*       previous word nor the current word                            */
@@ -954,7 +958,7 @@ Mostly we check word delimiters."
               ;; we remember which word we have just checked.
               ;; this will be used next time we will check a word
               ;; to compare the next current word with the word
-              ;; that as been registered in the pre-command-hook
+              ;; that has been registered in the pre-command-hook
               ;; that is these variables are used within the predicate
               ;; FLYSPELL-CHECK-PRE-WORD-P
               (setq flyspell-pre-pre-buffer (current-buffer))
@@ -1104,7 +1108,9 @@ misspelling and skips redundant spell-checking step."
                   (ispell-send-string (concat "^" word "\n"))
                   ;; we mark the ispell process so it can be killed
                   ;; when emacs is exited without query
-                  (set-process-query-on-exit-flag ispell-process nil)
+                 (if (featurep 'xemacs)
+                     (process-kill-without-query ispell-process)
+                   (set-process-query-on-exit-flag ispell-process nil))
                   ;; Wait until ispell has processed word.
                   (while (progn
                            (accept-process-output ispell-process)
@@ -1221,63 +1227,8 @@ misspelling and skips redundant spell-checking step."
                        (>= (match-end 0) b))))))
       (flyspell-math-tex-command-p)))
 
-;;*---------------------------------------------------------------------*/
-;;*    flyspell-casechars-cache ...                                     */
-;;*---------------------------------------------------------------------*/
-(defvar flyspell-casechars-cache nil)
-(defvar flyspell-ispell-casechars-cache nil)
-(make-variable-buffer-local 'flyspell-casechars-cache)
-(make-variable-buffer-local 'flyspell-ispell-casechars-cache)
-
-;;*---------------------------------------------------------------------*/
-;;*    flyspell-get-casechars ...                                       */
-;;*---------------------------------------------------------------------*/
-(defun flyspell-get-casechars ()
-  "This function builds a string that is the regexp of word chars.
-In order to avoid one useless string construction,
-this function changes the last char of the `ispell-casechars' string."
-  (let ((ispell-casechars (ispell-get-casechars)))
-    (cond
-     ((eq ispell-parser 'tex)
-      (setq flyspell-ispell-casechars-cache ispell-casechars)
-      (setq flyspell-casechars-cache
-           (concat (substring ispell-casechars
-                              0
-                              (- (length ispell-casechars) 1))
-                   "]"))
-      flyspell-casechars-cache)
-     (t
-      (setq flyspell-ispell-casechars-cache ispell-casechars)
-      (setq flyspell-casechars-cache ispell-casechars)
-      flyspell-casechars-cache))))
-
-;;*---------------------------------------------------------------------*/
-;;*    flyspell-get-not-casechars-cache ...                             */
-;;*---------------------------------------------------------------------*/
-(defvar flyspell-not-casechars-cache nil)
-(defvar flyspell-ispell-not-casechars-cache nil)
-(make-variable-buffer-local 'flyspell-not-casechars-cache)
-(make-variable-buffer-local 'flyspell-ispell-not-casechars-cache)
-
-;;*---------------------------------------------------------------------*/
-;;*    flyspell-get-not-casechars ...                                   */
-;;*---------------------------------------------------------------------*/
-(defun flyspell-get-not-casechars ()
-  "This function builds a string that is the regexp of non-word chars."
-  (let ((ispell-not-casechars (ispell-get-not-casechars)))
-    (cond
-     ((eq ispell-parser 'tex)
-      (setq flyspell-ispell-not-casechars-cache ispell-not-casechars)
-      (setq flyspell-not-casechars-cache
-           (concat (substring ispell-not-casechars
-                              0
-                              (- (length ispell-not-casechars) 1))
-                   "]"))
-      flyspell-not-casechars-cache)
-     (t
-      (setq flyspell-ispell-not-casechars-cache ispell-not-casechars)
-      (setq flyspell-not-casechars-cache ispell-not-casechars)
-      flyspell-not-casechars-cache))))
+(defalias 'flyspell-get-casechars 'ispell-get-casechars)
+(defalias 'flyspell-get-not-casechars 'ispell-get-not-casechars)
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-get-word ...                                            */
@@ -1414,7 +1365,7 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
            (goto-char buffer-scan-pos)
            (let ((keep t))
              ;; Iterate on string search until string is found as word,
-             ;; not as substring
+             ;; not as substring.
              (while keep
                (if (search-forward word
                                    flyspell-large-region-end t)
@@ -1430,13 +1381,14 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
                      (when (or
                             ;; Size matches, we really found it.
                             (= found-length misspell-length)
-                            ;; Matches as part of a boundary-char separated word
+                            ;; Matches as part of a boundary-char separated
+                            ;; word.
                             (member word
                                     (split-string found ispell-otherchars))
                             ;; Misspelling has higher length than
-                            ;; what flyspell considers the
-                            ;; word.  Caused by boundary-chars
-                            ;; mismatch.  Validating seems safe.
+                            ;; what flyspell considers the word.
+                             ;; Caused by boundary-chars mismatch.
+                             ;; Validating seems safe.
                             (< found-length misspell-length)
                             ;; ispell treats beginning of some TeX
                             ;; commands as nroff control sequences
@@ -1479,7 +1431,8 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
 ;;*    declared correct.                                                */
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-process-localwords (misspellings-buffer)
-  (let (localwords case-fold-search
+  (let ((localwords ispell-buffer-session-localwords)
+       case-fold-search
        (ispell-casechars (ispell-get-casechars)))
     ;; Get localwords from the original buffer
     (save-excursion
@@ -1576,10 +1529,11 @@ The buffer to mark them in is `flyspell-large-region-buffer'."
       (if ispell-encoding8-command
          (setq args
                (append args
-                       (list
-                        (concat ispell-encoding8-command
-                                (symbol-name
-                                 encoding))))))
+                       (if ispell-really-hunspell
+                           (list ispell-encoding8-command
+                                 (upcase (symbol-name encoding)))
+                         (list (concat ispell-encoding8-command
+                                       (symbol-name encoding)))))))
 
       (let ((process-coding-system-alist (list (cons "\\.*" encoding))))
        (setq c (apply 'ispell-call-process-region beg
@@ -1690,12 +1644,19 @@ FLYSPELL-BUFFER."
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-delete-region-overlays (beg end)
   "Delete overlays used by flyspell in a given region."
-  (remove-overlays beg end 'flyspell-overlay t))
-
+  (if (featurep 'emacs)
+      (remove-overlays beg end 'flyspell-overlay t)
+    ;; XEmacs does not have `remove-overlays'
+    (let ((l (overlays-in beg end)))
+      (while (consp l)
+       (progn
+         (if (flyspell-overlay-p (car l))
+             (delete-overlay (car l)))
+         (setq l (cdr l)))))))
 
 (defun flyspell-delete-all-overlays ()
   "Delete all the overlays used by flyspell."
-  (remove-overlays (point-min) (point-max) 'flyspell-overlay t))
+  (flyspell-delete-region-overlays (point-min) (point-max)))
 
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-unhighlight-at ...                                      */
@@ -1899,11 +1860,11 @@ This command proposes various successive corrections for the current word."
   (interactive)
   (let ((pos     (point))
        (old-max (point-max)))
-    ;; use the correct dictionary
+    ;; Use the correct dictionary.
     (flyspell-accept-buffer-local-defs)
     (if (and (eq flyspell-auto-correct-pos pos)
             (consp flyspell-auto-correct-region))
-       ;; we have already been using the function at the same location
+       ;; We have already been using the function at the same location.
        (let* ((start (car flyspell-auto-correct-region))
               (len   (cdr flyspell-auto-correct-region)))
          (flyspell-unhighlight-at start)
@@ -1925,7 +1886,7 @@ This command proposes various successive corrections for the current word."
            (flyspell-display-next-corrections flyspell-auto-correct-ring))
          (flyspell-ajust-cursor-point pos (point) old-max)
          (setq flyspell-auto-correct-pos (point)))
-      ;; fetch the word to be checked
+      ;; Fetch the word to be checked.
       (let ((word (flyspell-get-word)))
        (if (consp word)
            (let ((start (car (cdr word)))
@@ -1933,30 +1894,30 @@ This command proposes various successive corrections for the current word."
                  (word (car word))
                  poss ispell-filter)
              (setq flyspell-auto-correct-word word)
-             ;; now check spelling of word.
-             (ispell-send-string "%\n") ;put in verbose mode
+             ;; Now check spelling of word..
+             (ispell-send-string "%\n") ;Put in verbose mode.
              (ispell-send-string (concat "^" word "\n"))
-              ;; wait until ispell has processed word.
+              ;; Wait until ispell has processed word.
               (while (progn
                        (accept-process-output ispell-process)
                        (not (string= "" (car ispell-filter)))))
-             ;; Remove leading empty element
+             ;; Remove leading empty element.
              (setq ispell-filter (cdr ispell-filter))
-             ;; ispell process should return something after word is sent.
-             ;; Tag word as valid (i.e., skip) otherwise
+             ;; Ispell process should return something after word is sent.
+             ;; Tag word as valid (i.e., skip) otherwise.
              (or ispell-filter
                  (setq ispell-filter '(*)))
              (if (consp ispell-filter)
                  (setq poss (ispell-parse-output (car ispell-filter))))
              (cond
               ((or (eq poss t) (stringp poss))
-               ;; don't correct word
+               ;; Don't correct word.
                t)
               ((null poss)
-               ;; ispell error
+               ;; Ispell error.
                (error "Ispell: error in Ispell process"))
               (t
-               ;; the word is incorrect, we have to propose a replacement
+               ;; The word is incorrect, we have to propose a replacement.
                (let ((replacements (if flyspell-sort-corrections
                                        (sort (car (cdr (cdr poss))) 'string<)
                                      (car (cdr (cdr poss))))))
@@ -2146,6 +2107,9 @@ If OPOINT is non-nil, restore point there after adjusting it for replacement."
         (setq ispell-pdict-modified-p '(t)))
        ((or (eq replace 'buffer) (eq replace 'session))
         (ispell-send-string (concat "@" word "\n"))
+        (add-to-list 'ispell-buffer-session-localwords word)
+        (or ispell-buffer-local-name ; session localwords might conflict
+            (setq ispell-buffer-local-name (buffer-name)))
         (flyspell-unhighlight-at cursor-location)
         (if (null ispell-pdict-modified-p)
             (setq ispell-pdict-modified-p
index 4d061fed32bf91a8bb5dbb801de351629357e294..0c7966f22d3f10aa04d78ca729a62720b21d7e37 100644 (file)
@@ -254,6 +254,10 @@ full featured `looking-back' function is missing."
     (save-excursion
       (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t))))
 
+;;; XEmacs21 does not have `with-no-warnings'. Taken from org mode.
+(defmacro ispell-with-no-warnings (&rest body)
+  (cons (if (fboundp 'with-no-warnings) 'with-no-warnings 'progn) body))
+
 ;;; Code:
 
 (defvar mail-yank-prefix)
@@ -277,13 +281,13 @@ full featured `looking-back' function is missing."
 ;;;  ******* THIS FILE IS WRITTEN FOR ISPELL VERSION 3.1+
 
 (defcustom ispell-highlight-p 'block
-  "*Highlight spelling errors when non-nil.
+  "Highlight spelling errors when non-nil.
 When set to `block', assumes a block cursor with TTY displays."
   :type '(choice (const block) (const :tag "off" nil) (const :tag "on" t))
   :group 'ispell)
 
 (defcustom ispell-lazy-highlight (boundp 'lazy-highlight-cleanup)
-  "*Controls the lazy-highlighting of spelling errors.
+  "Controls the lazy-highlighting of spelling errors.
 When non-nil, all text in the buffer matching the current spelling
 error is highlighted lazily using isearch lazy highlighting (see
 `lazy-highlight-initial-delay' and `lazy-highlight-interval')."
@@ -293,9 +297,7 @@ error is highlighted lazily using isearch lazy highlighting (see
   :version "22.1")
 
 (defcustom ispell-highlight-face (if ispell-lazy-highlight 'isearch 'highlight)
-  "*The face used for Ispell highlighting.  For Emacsen with overlays.
-Possible values are `highlight', `modeline', `secondary-selection',
-`region', and `underline'.
+  "Face used for Ispell highlighting.
 This variable can be set by the user to whatever face they desire.
 It's most convenient if the cursor color and highlight color are
 slightly different."
@@ -303,7 +305,7 @@ slightly different."
   :group 'ispell)
 
 (defcustom ispell-check-comments t
-  "*Spelling of comments checked when non-nil.
+  "Spelling of comments checked when non-nil.
 When set to `exclusive', ONLY comments are checked.  (For code comments).
 Warning!  Not checking comments, when a comment start is embedded in strings,
 may produce undesired results."
@@ -314,13 +316,13 @@ may produce undesired results."
      (lambda (a) (memq a '(nil t exclusive))))
 
 (defcustom ispell-query-replace-choices nil
-  "*Corrections made throughout region when non-nil.
+  "Corrections made throughout region when non-nil.
 Uses `query-replace' (\\[query-replace]) for corrections."
   :type 'boolean
   :group 'ispell)
 
 (defcustom ispell-skip-tib nil
-  "*Does not spell check `tib' bibliography references when non-nil.
+  "Does not spell check `tib' bibliography references when non-nil.
 Skips any text between strings matching regular expressions
 `ispell-tib-ref-beginning' and `ispell-tib-ref-end'.
 
@@ -337,21 +339,21 @@ That includes the [.5mm] type of number..."
   "Regexp matching the end of a Tib reference.")
 
 (defcustom ispell-keep-choices-win t
-  "*If non-nil, keep the `*Choices*' window for the entire spelling session.
+  "If non-nil, keep the `*Choices*' window for the entire spelling session.
 This minimizes redisplay thrashing."
   :type 'boolean
   :group 'ispell)
 
 (defcustom ispell-choices-win-default-height 2
-  "*The default size of the `*Choices*' window, including the mode line.
+  "The default size of the `*Choices*' window, including the mode line.
 Must be greater than 1."
   :type 'integer
   :group 'ispell)
 
 (defcustom ispell-program-name
-  (or (locate-file "aspell"   exec-path exec-suffixes 'file-executable-p)
-      (locate-file "ispell"   exec-path exec-suffixes 'file-executable-p)
-      (locate-file "hunspell" exec-path exec-suffixes 'file-executable-p)
+  (or (executable-find "aspell")
+      (executable-find "ispell")
+      (executable-find "hunspell")
       "ispell")
   "Program invoked by \\[ispell-word] and \\[ispell-region] commands."
   :type 'string
@@ -366,18 +368,18 @@ Must be greater than 1."
        ((file-readable-p "/usr/share/lib/dict/words")
         "/usr/share/lib/dict/words")
        ((file-readable-p "/sys/dict") "/sys/dict"))
-  "*Alternate plain word-list dictionary for spelling help."
+  "Alternate plain word-list dictionary for spelling help."
   :type '(choice file (const :tag "None" nil))
   :group 'ispell)
 
 (defcustom ispell-complete-word-dict nil
-  "*Plain word-list dictionary used for word completion if
+  "Plain word-list dictionary used for word completion if
 different from `ispell-alternate-dictionary'."
   :type '(choice file (const :tag "None" nil))
   :group 'ispell)
 
 (defcustom ispell-message-dictionary-alist nil
-  "*List used by `ispell-message' to select a new dictionary.
+  "List used by `ispell-message' to select a new dictionary.
 It consists of pairs (REGEXP . DICTIONARY).  If REGEXP is found
 in the message headers, `ispell-local-dictionary' will be set to
 DICTIONARY if `ispell-local-dictionary' is not buffer-local.
@@ -389,7 +391,7 @@ E.g. you may use the following value:
 
 
 (defcustom ispell-message-fcc-skip 50000
-  "*Query before saving Fcc message copy if attachment larger than this value.
+  "Query before saving Fcc message copy if attachment larger than this value.
 Always stores Fcc copy of message when nil."
   :type '(choice integer (const :tag "off" nil))
   :group 'ispell)
@@ -423,13 +425,13 @@ This must be an absolute file name."
   :group 'ispell)
 
 (defcustom ispell-look-p (file-exists-p ispell-look-command)
-  "*Non-nil means use `look' rather than `grep'.
+  "Non-nil means use `look' rather than `grep'.
 Default is based on whether `look' seems to be available."
   :type 'boolean
   :group 'ispell)
 
 (defcustom ispell-have-new-look nil
-  "*Non-nil means use the `-r' option (regexp) when running `look'."
+  "Non-nil means use the `-r' option (regexp) when running `look'."
   :type 'boolean
   :group 'ispell)
 
@@ -445,13 +447,13 @@ When nil, Emacs uses pipes."
   :group 'ispell)
 
 (defcustom ispell-following-word nil
-  "*Non-nil means `ispell-word' checks the word around or after point.
+  "Non-nil means `ispell-word' checks the word around or after point.
 Otherwise `ispell-word' checks the preceding word."
   :type 'boolean
   :group 'ispell)
 
 (defcustom ispell-help-in-bufferp nil
-  "*Non-nil means display interactive keymap help in a buffer.
+  "Non-nil means display interactive keymap help in a buffer.
 The following values are supported:
   nil        Expand the minibuffer and display a short help message
              there for a couple of seconds.
@@ -463,12 +465,12 @@ The following values are supported:
   :group 'ispell)
 
 (defcustom ispell-quietly nil
-  "*Non-nil means suppress messages in `ispell-word'."
+  "Non-nil means suppress messages in `ispell-word'."
   :type 'boolean
   :group 'ispell)
 
 (defcustom ispell-format-word-function (function upcase)
-  "*Formatting function for displaying word being spell checked.
+  "Formatting function for displaying word being spell checked.
 The function must take one string argument and return a string."
   :type 'function
   :group 'ispell)
@@ -484,7 +486,7 @@ window system by evaluating the following on startup to set this variable:
 
 ;;;###autoload
 (defcustom ispell-personal-dictionary nil
-  "*File name of your personal spelling dictionary, or nil.
+  "File name of your personal spelling dictionary, or nil.
 If nil, the default personal dictionary, (\"~/.ispell_DICTNAME\" for ispell or
 \"~/.aspell.LANG.pws\" for aspell) is used, where DICTNAME is the name of your
 default dictionary and LANG the two letter language code."
@@ -493,7 +495,7 @@ default dictionary and LANG the two letter language code."
   :group 'ispell)
 
 (defcustom ispell-silently-savep nil
-  "*When non-nil, save personal dictionary without asking for confirmation."
+  "When non-nil, save personal dictionary without asking for confirmation."
   :type 'boolean
   :group 'ispell)
 
@@ -527,7 +529,7 @@ is automatically set when defined in the file with either
   :group 'ispell)
 
 (defcustom ispell-extra-args nil
-  "*If non-nil, a list of extra switches to pass to the Ispell program.
+  "If non-nil, a list of extra switches to pass to the Ispell program.
 For example, (\"-W\" \"3\") to cause it to accept all 1-3 character
 words as correct.  See also `ispell-dictionary-alist', which may be used
 for language-specific arguments."
@@ -537,7 +539,7 @@ for language-specific arguments."
 
 
 (defcustom ispell-skip-html 'use-mode-name
-  "*Indicates whether ispell should skip spell checking of SGML markup.
+  "Indicates whether ispell should skip spell checking of SGML markup.
 If t, always skip SGML markup; if nil, never skip; if non-t and non-nil,
 guess whether SGML markup should be skipped according to the name of the
 buffer's major mode."
@@ -549,7 +551,7 @@ buffer's major mode."
 
 
 (defcustom ispell-local-dictionary-alist nil
-  "*List of local or customized dictionary definitions.
+  "List of local or customized dictionary definitions.
 These can override the values in `ispell-dictionary-alist'.
 
 To make permanent changes to your dictionary definitions, you
@@ -574,12 +576,12 @@ re-start Emacs."
 
 
 (defvar ispell-dictionary-base-alist
-  '((nil
+  '((nil                                ; default
      ;; The default dictionary.  It may be English.aff, or any other
      ;; dictionary depending on locale and such things.  We should probably
      ;; ask ispell what dictionary it's using, but until we do that, let's
-     ;; just use an approximate regexp.
-     "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil iso-8859-1)
+     ;; just use a minimal regexp. [:alpha:] will later be set if possible.
+     "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
     ("american"                                ; Yankee English
      "[A-Za-z]" "[^A-Za-z]" "[']" nil ("-B") nil iso-8859-1)
     ("brasileiro"                      ; Brazilian mode
@@ -767,6 +769,12 @@ here just for backwards compatibility.")
 (make-obsolete-variable 'ispell-aspell-supports-utf8
                         'ispell-encoding8-command "23.1")
 
+(defvar ispell-emacs-alpha-regexp
+  (if (string-match "^[[:alpha:]]+$" "abcde")
+      "[[:alpha:]]"
+    nil)
+  "[[:alpha:]] if Emacs supports [:alpha:] regexp, nil
+otherwise (current XEmacs does not support it).")
 
 ;;; **********************************************************************
 ;;; The following are used by ispell, and should not be changed.
@@ -875,7 +883,7 @@ Otherwise returns the library directory name, if that is defined."
            (setq ispell-really-aspell nil)))
         (ispell-really-hunspell
          (if (ispell-check-minver hunspell8-minver ispell-really-hunspell)
-             (setq ispell-encoding8-command "-i ")
+             (setq ispell-encoding8-command "-i")
            (setq ispell-really-hunspell nil))))))
     result))
 
@@ -903,7 +911,7 @@ Otherwise returns the library directory name, if that is defined."
 
 ;;;###autoload
 (defvar ispell-menu-map nil "Key map for ispell menu.")
-;;; redo menu when loading ispell to get dictionary modifications
+;; Redo menu when loading ispell to get dictionary modifications
 (setq ispell-menu-map nil)
 
 ;;;###autoload
@@ -962,9 +970,9 @@ Internal use.")
     ;; Ensure aspell's alias dictionary will override standard
     ;; definitions.
     (setq found (ispell-aspell-add-aliases found))
-    ;; Merge into FOUND any elements from the standard ispell-dictionary-alist
+    ;; Merge into FOUND any elements from the standard ispell-dictionary-base-alist
     ;; which have no element in FOUND at all.
-    (dolist (dict ispell-dictionary-alist)
+    (dolist (dict ispell-dictionary-base-alist)
       (unless (assoc (car dict) found)
        (setq found (nconc found (list dict)))))
     (setq ispell-aspell-dictionary-alist found)
@@ -1056,8 +1064,7 @@ Return the new dictionary alist."
        (insert-file-contents alias-file)
        ;; Look for a line "add FOO.multi", extract FOO
        (when (search-forward-regexp "^add \\([^.]+\\)\\.multi" nil t)
-         (let* ((aliasname (file-name-sans-extension
-                            (file-name-nondirectory alias-file)))
+         (let* ((aliasname (file-name-base alias-file))
                 (already-exists-p (assoc aliasname alist))
                 (realname (match-string 1))
                 (realdict (assoc realname alist)))
@@ -1092,8 +1099,7 @@ aspell is used along with Emacs).")
               (error nil))
             ispell-really-aspell
             ispell-encoding8-command
-            ;; XEmacs does not like [:alpha:] regexps.
-            (string-match "^[[:alpha:]]+$" "abcde"))
+            ispell-emacs-alpha-regexp)
        (unless ispell-aspell-dictionary-alist
          (ispell-find-aspell-dictionaries)))
 
@@ -1117,8 +1123,27 @@ aspell is used along with Emacs).")
                            ispell-dictionary-base-alist))
        (unless (assoc (car dict) all-dicts-alist)
          (add-to-list 'all-dicts-alist dict)))
-      (setq ispell-dictionary-alist all-dicts-alist))))
-
+      (setq ispell-dictionary-alist all-dicts-alist))
+
+    ;; If Emacs flavor supports [:alpha:] use it for global dicts.  If
+    ;; spellchecker also supports UTF-8 via command-line option use it
+    ;; in communication.  This does not affect definitions in ~/.emacs.
+    (if ispell-emacs-alpha-regexp
+       (let (tmp-dicts-alist)
+         (dolist (adict ispell-dictionary-alist)
+           (add-to-list 'tmp-dicts-alist
+                        (list
+                         (nth 0 adict)  ; dict name
+                         "[[:alpha:]]"  ; casechars
+                         "[^[:alpha:]]" ; not-casechars
+                         (nth 3 adict)  ; otherchars
+                         (nth 4 adict)  ; many-otherchars-p
+                         (nth 5 adict)  ; ispell-args
+                         (nth 6 adict)  ; extended-character-mode
+                         (if ispell-encoding8-command
+                             'utf-8
+                           (nth 7 adict)))))
+         (setq ispell-dictionary-alist tmp-dicts-alist)))))
 
 (defun ispell-valid-dictionary-list ()
   "Return a list of valid dictionaries.
@@ -1151,7 +1176,7 @@ The variable `ispell-library-directory' defines their location."
          (push name dict-list)))
     dict-list))
 
-;;; define commands in menu in opposite order you want them to appear.
+;; Define commands in menu in opposite order you want them to appear.
 ;;;###autoload
 (if ispell-menu-map-needed
     (progn
@@ -1160,7 +1185,8 @@ The variable `ispell-library-directory' defines their location."
        `(menu-item ,(purecopy "Change Dictionary...") ispell-change-dictionary
                    :help ,(purecopy "Supply explicit dictionary file name")))
       (define-key ispell-menu-map [ispell-kill-ispell]
-       `(menu-item ,(purecopy "Kill Process") ispell-kill-ispell
+       `(menu-item ,(purecopy "Kill Process")
+                   (lambda () (interactive) (ispell-kill-ispell nil 'clear))
                    :enable (and (boundp 'ispell-process) ispell-process
                                 (eq (ispell-process-status) 'run))
                    :help ,(purecopy "Terminate Ispell subprocess")))
@@ -1244,7 +1270,7 @@ The variable `ispell-library-directory' defines their location."
             ["Continue Check"  ispell-continue                 t]
             ["Complete Word Frag"ispell-complete-word-interior-frag t]
             ["Complete Word"   ispell-complete-word            t]
-            ["Kill Process"    ispell-kill-ispell              t]
+            ["Kill Process"    (ispell-kill-ispell nil 'clear) t]
             ["Customize..."    (customize-group 'ispell)       t]
             ;; flyspell-mode may not be bound...
             ;;["flyspell"      flyspell-mode
@@ -1347,9 +1373,9 @@ Protects against bogus binding of `enable-multibyte-characters' in XEmacs."
 (defvar ispell-pdict-modified-p nil
   "Non-nil means personal dictionary has modifications to be saved.")
 
-;;; If you want to save the dictionary when quitting, must do so explicitly.
-;;; When non-nil, the spell session is terminated.
-;;; When numeric, contains cursor location in buffer, and cursor remains there.
+;; If you want to save the dictionary when quitting, must do so explicitly.
+;; When non-nil, the spell session is terminated.
+;; When numeric, contains cursor location in buffer, and cursor remains there.
 (defvar ispell-quit nil)
 
 (defvar ispell-process-directory nil
@@ -1471,7 +1497,7 @@ Valid forms include:
      ("list"                            ispell-tex-arg-end 2)
      ("program"                . "\\\\end[ \t\n]*{[ \t\n]*program[ \t\n]*}")
      ("verbatim\\*?"   . "\\\\end[ \t\n]*{[ \t\n]*verbatim\\*?[ \t\n]*}"))))
-  "*Lists of regions to be skipped in TeX mode.
+  "Lists of regions to be skipped in TeX mode.
 First list is used raw.
 Second list has key placed inside \\begin{}.
 
@@ -1490,7 +1516,7 @@ for skipping in latex mode.")
     ("<[tT][tT]/"                        "/")
     ("<[^ \t\n>]"                        ">")
     ("&[^ \t\n;]"                        "[; \t\n]"))
-  "*Lists of start and end keys to skip in HTML buffers.
+  "Lists of start and end keys to skip in HTML buffers.
 Same format as `ispell-skip-region-alist'.
 Note - substrings of other matches must come last
  (e.g. \"<[tT][tT]/\" and \"<[^ \\t\\n>]\").")
@@ -1513,8 +1539,13 @@ local variable syntax.")
   "Contains the buffer name if local word definitions were used.
 Ispell is then restarted because the local words could conflict.")
 
+(defvar ispell-buffer-session-localwords nil
+  "List of words accepted for session in this buffer.")
+
+(make-variable-buffer-local 'ispell-buffer-session-localwords)
+
 (defvar ispell-parser 'use-mode-name
-   "*Indicates whether ispell should parse the current buffer as TeX Code.
+  "Indicates whether ispell should parse the current buffer as TeX Code.
 Special value `use-mode-name' tries to guess using the name of `major-mode'.
 Default parser is `nroff'.
 Currently the only other valid parser is `tex'.
@@ -1641,16 +1672,6 @@ This allows it to improve the suggestion list based on actual misspellings."
                          (setq more-lines (= 0 (forward-line))))))))))))))
 
 
-;; Insert WORD while possibly translating characters by
-;; translation-table-for-input.
-(defun ispell-insert-word (word)
-  (let ((pos (point)))
-    (insert word)
-    ;; Avoid "obsolete" warnings for translation-table-for-input.
-    (with-no-warnings
-      (if (char-table-p translation-table-for-input)
-         (translate-region pos (point) translation-table-for-input)))))
-
 ;;;###autoload
 (defun ispell-word (&optional following quietly continue region)
   "Check spelling of word under or before the cursor.
@@ -1683,7 +1704,12 @@ nil           word is correct or spelling is accepted.
 quit          spell session exited."
   (interactive (list ispell-following-word ispell-quietly current-prefix-arg t))
   (cond
-   ((and region (use-region-p))
+   ((and region
+        (if (featurep 'emacs)
+            (use-region-p)
+          (and (boundp 'transient-mark-mode) transient-mark-mode
+               (boundp 'mark-active) mark-active
+               (not (eq (region-beginning) (region-end))))))
     (ispell-region (region-beginning) (region-end)))
    (continue (ispell-continue))
    (t
@@ -1763,7 +1789,7 @@ quit          spell session exited."
                          ;; Insert first and then delete,
                          ;; to avoid collapsing markers before and after
                          ;; into a single place.
-                         (ispell-insert-word new-word)
+                         (insert new-word)
                          (delete-region (point) end)
                          ;; It is meaningless to preserve the cursor position
                          ;; inside a word that has changed.
@@ -1854,10 +1880,10 @@ which is in `ispell-local-dictionary-alist' or `ispell-dictionary-alist'."
       (list word start end))))
 
 
-;;; Global ispell-pdict-modified-p is set by ispell-command-loop and
-;;; tracks changes in the dictionary.  The global may either be
-;;; a value or a list, whose value is the state of whether the
-;;; dictionary needs to be saved.
+;; Global ispell-pdict-modified-p is set by ispell-command-loop and
+;; tracks changes in the dictionary.  The global may either be
+;; a value or a list, whose value is the state of whether the
+;; dictionary needs to be saved.
 
 ;;;###autoload
 (defun ispell-pdict-save (&optional no-query force-save)
@@ -1909,7 +1935,7 @@ Global `ispell-quit' set to start location to continue spell session."
              "  --  dict: " (or ispell-current-dictionary "default")
              "  --  prog: " (file-name-nondirectory ispell-program-name)))
       ;; XEmacs: no need for horizontal scrollbar in choices window
-      (with-no-warnings
+      (ispell-with-no-warnings
        (and (fboundp 'set-specifier)
            (boundp 'horizontal-scrollbar-visible-p)
            (set-specifier horizontal-scrollbar-visible-p nil
@@ -2011,6 +2037,9 @@ Global `ispell-quit' set to start location to continue spell session."
                    nil)
                   ((or (= char ?a) (= char ?A)) ; accept word without insert
                    (ispell-send-string (concat "@" word "\n"))
+                   (add-to-list 'ispell-buffer-session-localwords word)
+                   (or ispell-buffer-local-name ; session localwords might conflict
+                       (setq ispell-buffer-local-name (buffer-name)))
                    (if (null ispell-pdict-modified-p)
                        (setq ispell-pdict-modified-p
                              (list ispell-pdict-modified-p)))
@@ -2393,8 +2422,8 @@ if defined."
          (setq start end))))))         ; else move start to next line of input
 
 
-;;; This function destroys the mark location if it is in the word being
-;;; highlighted.
+;; This function destroys the mark location if it is in the word being
+;; highlighted.
 (defun ispell-highlight-spelling-error-generic (start end &optional highlight
                                                      refresh)
   "Highlight the word from START to END with a kludge using `inverse-video'.
@@ -2526,7 +2555,7 @@ scrolling the current window.  Leave the new window selected."
       (set-window-start (next-window) top))))
 
 
-;;; Should we add a compound word match return value?
+;; Should we add a compound word match return value?
 (defun ispell-parse-output (output &optional accept-list shift)
   "Parse the OUTPUT string from Ispell process and return:
 1: t for an exact match.
@@ -2592,8 +2621,8 @@ When asynchronous processes are not supported, `run' is always returned."
 
 
 (defun ispell-start-process ()
-  "Start the ispell process, with support for no asynchronous processes.
-Keeps argument list for future ispell invocations for no async support."
+  "Start the Ispell process, with support for no asynchronous processes.
+Keeps argument list for future Ispell invocations for no async support."
   ;; Local dictionary becomes the global dictionary in use.
   (setq ispell-current-dictionary
         (or ispell-local-dictionary ispell-dictionary))
@@ -2619,9 +2648,12 @@ Keeps argument list for future ispell invocations for no async support."
            ;; right encoding for communication. ispell or older aspell/hunspell
            ;; does not support this.
            (if ispell-encoding8-command
-               (list
-                (concat ispell-encoding8-command
-                        (symbol-name (ispell-get-coding-system)))))
+              (if ispell-really-hunspell
+                  (list ispell-encoding8-command
+                        (upcase (symbol-name (ispell-get-coding-system))))
+                (list
+                 (concat ispell-encoding8-command
+                         (symbol-name (ispell-get-coding-system))))))
            ispell-extra-args)))
 
     ;; Initially we don't know any buffer's local words.
@@ -2681,7 +2713,8 @@ Keeps argument list for future ispell invocations for no async support."
        (setq ispell-filter nil ispell-filter-continue nil)
       ;; may need to restart to select new personal dictionary.
       (ispell-kill-ispell t)
-      (message "Starting new Ispell process [%s] ..."
+      (message "Starting new Ispell process [%s::%s] ..."
+              ispell-program-name
               (or ispell-local-dictionary ispell-dictionary "default"))
       (sit-for 0)
       (setq ispell-library-directory (ispell-check-version)
@@ -2753,21 +2786,27 @@ Keeps argument list for future ispell invocations for no async support."
              (process-kill-without-query ispell-process)))))))
 
 ;;;###autoload
-(defun ispell-kill-ispell (&optional no-error)
+(defun ispell-kill-ispell (&optional no-error clear)
   "Kill current Ispell process (so that you may start a fresh one).
-With NO-ERROR, just return non-nil if there was no Ispell running."
+With NO-ERROR, just return non-nil if there was no Ispell running.
+With CLEAR, buffer session localwords are cleaned."
   (interactive)
   ;; This hook is typically used by flyspell to flush some variables used
   ;; to optimize the common cases.
   (run-hooks 'ispell-kill-ispell-hook)
+  (if (or clear
+         (if (featurep 'xemacs)
+             (interactive-p)
+           (called-interactively-p 'interactive)))
+      (setq ispell-buffer-session-localwords nil))
   (if (not (and ispell-process
                (eq (ispell-process-status) 'run)))
       (or no-error
-         (error "There is no ispell process running!"))
+         (error "There is no Ispell process running!"))
     (if ispell-async-processp
        (delete-process ispell-process)
-      ;; synchronous processes
-      (ispell-send-string "\n")                ; make sure side effects occurred.
+      ;; Synchronous processes.
+      (ispell-send-string "\n")                ; Make sure side effects occurred.
       (kill-buffer ispell-output-buffer)
       (kill-buffer ispell-session-buffer)
       (setq ispell-output-buffer nil
@@ -2776,8 +2815,8 @@ With NO-ERROR, just return non-nil if there was no Ispell running."
     (message "Ispell process killed")
     nil))
 
-;;; ispell-change-dictionary is set in some people's hooks.  Maybe this should
-;;;  call ispell-init-process rather than wait for a spell checking command?
+;; ispell-change-dictionary is set in some people's hooks.  Maybe this should
+;;  call ispell-init-process rather than wait for a spell checking command?
 
 ;;;###autoload
 (defun ispell-change-dictionary (dict &optional arg)
@@ -2807,7 +2846,9 @@ By just answering RET you can find out what the current dictionary is."
         ;; Specified dictionary is the default already. Could reload
         ;; the dictionaries if needed.
         (ispell-internal-change-dictionary)
-        (and (interactive-p)
+        (and (if (featurep 'xemacs)
+                 (interactive-p)
+               (called-interactively-p 'interactive))
              (message "No change, using %s dictionary" dict)))
        (t                              ; reset dictionary!
         (if (or (assoc dict ispell-local-dictionary-alist)
@@ -2820,6 +2861,7 @@ By just answering RET you can find out what the current dictionary is."
               (setq ispell-local-dictionary-overridden t))
           (error "Undefined dictionary: %s" dict))
         (ispell-internal-change-dictionary)
+        (setq ispell-buffer-session-localwords nil)
         (message "%s Ispell dictionary set to %s"
                  (if arg "Global" "Local")
                  dict))))
@@ -3250,7 +3292,7 @@ Returns the sum SHIFT due to changes in word replacements."
              (delete-region (point) (+ word-len (point)))
              (if (not (listp replace))
                  (progn
-                   (ispell-insert-word replace) ; insert dictionary word
+                   (insert replace) ; insert dictionary word
                    (ispell-send-replacement (car poss) replace)
                    (setq accept-list (cons replace accept-list)))
                (let ((replace-word (car replace)))
@@ -3381,6 +3423,7 @@ If optional INTERIOR-FRAG is non-nil then the word may be a character
 sequence inside of a word.
 
 Standard ispell choices are then available."
+  ;; FIXME: completion-at-point-function.
   (interactive "P")
   (let ((cursor-location (point))
        (case-fold-search-val case-fold-search)
@@ -3424,7 +3467,7 @@ Standard ispell choices are then available."
             (setq word (if (atom replacement) replacement (car replacement))
                   cursor-location (+ (- (length word) (- end start))
                                      cursor-location))
-            (ispell-insert-word word)
+            (insert word)
             (if (not (atom replacement)) ; recheck spelling of replacement.
                 (progn
                   (goto-char cursor-location)
@@ -3528,7 +3571,7 @@ Don't read buffer-local settings or word lists."
               ;; Matches commonly used "cut" boundaries
               "^\\(- \\)?[-=_]+\\s ?\\(cut here\\|Environment Follows\\)")
             "\\|")
-  "*Text beyond which `ispell-message' will not spell-check.
+  "Text beyond which `ispell-message' will not spell-check.
 If it is a string, limit is the first occurrence of that regular expression.
 Otherwise, it must be a function which is called to get the limit.")
 (put 'ispell-message-text-end 'risky-local-variable t)
@@ -3676,23 +3719,23 @@ You can bind this to the key C-c i in GNUS or mail by adding to
           (cite-regexp                 ;Prefix of quoted text
            (cond
             ((functionp 'sc-cite-regexp)       ; sc 3.0
-             (with-no-warnings
-               (concat "\\(" (sc-cite-regexp) "\\)" "\\|"
-                       (ispell-non-empty-string sc-reference-tag-string))))
+             (ispell-with-no-warnings
+              (concat "\\(" (sc-cite-regexp) "\\)" "\\|"
+                      (ispell-non-empty-string sc-reference-tag-string))))
             ((boundp 'sc-cite-regexp)          ; sc 2.3
              (concat "\\(" sc-cite-regexp "\\)" "\\|"
-                     (with-no-warnings
+                     (ispell-with-no-warnings
                       (ispell-non-empty-string sc-reference-tag-string))))
             ((or (equal major-mode 'news-reply-mode) ;GNUS 4 & below
                  (equal major-mode 'message-mode))   ;GNUS 5
              (concat "In article <" "\\|"
                      "[^,;&+=\n]+ <[^,;&+=]+> writes:" "\\|"
-                     (with-no-warnings message-cite-prefix-regexp)
+                     (ispell-with-no-warnings message-cite-prefix-regexp)
                      "\\|"
                      default-prefix))
             ((equal major-mode 'mh-letter-mode) ; mh mail message
              (concat "[^,;&+=\n]+ writes:" "\\|"
-                     (with-no-warnings
+                     (ispell-with-no-warnings
                       (ispell-non-empty-string mh-ins-buf-prefix))))
             ((not internal-messagep)   ; Assume nn sent us this message.
              (concat "In [a-zA-Z.]+ you write:" "\\|"
@@ -3889,6 +3932,11 @@ Both should not be used to define a buffer-local dictionary."
   ;; Actually start a new ispell process, because we need
   ;; to send commands now to specify the local words to it.
   (ispell-init-process)
+  (dolist (session-localword ispell-buffer-session-localwords)
+    (ispell-send-string (concat "@" session-localword "\n")))
+  (or ispell-buffer-local-name
+      (if ispell-buffer-session-localwords
+         (setq ispell-buffer-local-name (buffer-name))))
   (save-excursion
     (goto-char (point-min))
     (while (search-forward ispell-words-keyword nil t)
@@ -3908,7 +3956,7 @@ Both should not be used to define a buffer-local dictionary."
              (ispell-send-string (concat "@" string "\n"))))))))
 
 
-;;; returns optionally adjusted region-end-point.
+;; Returns optionally adjusted region-end-point.
 
 ;; If comment-padright is defined, newcomment must be loaded.
 (declare-function comment-add "newcomment" (arg))
@@ -3986,7 +4034,7 @@ Both should not be used to define a buffer-local dictionary."
 ; LocalWords:  alists minibuffer bufferp autoload loaddefs aff Dansk KOI SPC op
 ; LocalWords:  Francais Nederlands charset autoloaded popup nonmenu regexp num
 ; LocalWords:  AMStex hspace includeonly nocite epsfig displaymath eqnarray reg
-; LocalWords:  minipage modeline pers dict unhighlight buf grep sync prev inc
+; LocalWords:  minipage pers dict unhighlight buf grep sync prev inc
 ; LocalWords:  fn oldot NB AIX msg init read's bufs pt cmd Quinlan eg
 ; LocalWords:  uuencoded unidiff sc nn VM SGML eval IspellPersDict
 ; LocalWords:  lns XEmacs HTML casechars Multibyte
index 9e8cbb216d11e865bdc11825ecdf33fdd8c4338b..24a4ac1b033c3a8333da151791de9c225cdb406f 100644 (file)
@@ -31,7 +31,7 @@
 ;;; Code:
 
 (defgroup picture nil
-  "Picture mode --- editing using quarter-plane screen model."
+  "Editing text-based pictures (\"ASCII art\")."
   :prefix "picture-"
   :group 'wp)
 
 
 ;; Picture Movement Commands
 
-;; When a cursor is on a wide-column character (e.g. Chinese,
-;; Japanese, Korean), this variable tells the desired current column
-;; which may be different from (current-column).
-(defvar picture-desired-column 0)
+(defvar picture-desired-column 0
+  "Desired current column for Picture mode.
+When a cursor is on a wide-column character (e.g. Chinese,
+Japanese, Korean), this may may be different from `current-column'.")
+
 
-;; If the value of picture-desired-column is far from the current
-;; column, or if the arg ADJUST-TO-CURRENT is non-nil, set it to the
-;; current column.   Return the current column.
 (defun picture-update-desired-column (adjust-to-current)
+  "Maybe update `picture-desired-column'.
+If the value of `picture-desired-column' is more than one column
+from `current-column', or if the argument ADJUST-TO-CURRENT is
+non-nil, set it to the current column.  Return `current-column'."
   (let ((current-column (current-column)))
     (if (or adjust-to-current
            (< picture-desired-column (1- current-column))
@@ -240,8 +242,7 @@ Use \"\\[command-apropos] picture-movement\" to see commands which control motio
             (spacing (when (display-graphic-p frame)
                        (or (with-current-buffer (window-buffer window)
                              line-spacing)
-                           (frame-parameter frame 'line-spacing))))
-            rows cols)
+                           (frame-parameter frame 'line-spacing)))))
        (cond ((floatp spacing)
               (setq spacing (truncate (* spacing char-ht))))
              ((null spacing)
@@ -606,64 +607,61 @@ Leaves the region surrounding the rectangle."
 
 (defalias 'picture-delete-char 'delete-char)
 
-(defvar picture-mode-map nil)
-
-(defun picture-substitute (oldfun newfun)
-  (define-key picture-mode-map (vector 'remap oldfun) newfun))
-
-(if (not picture-mode-map)
-    (progn
-      (setq picture-mode-map (make-keymap))
-      (picture-substitute 'self-insert-command 'picture-self-insert)
-      (picture-substitute 'completion-separator-self-insert-command
-                         'picture-self-insert)
-      (picture-substitute 'completion-separator-self-insert-autofilling
-                         'picture-self-insert)
-      (picture-substitute 'forward-char 'picture-forward-column)
-      (picture-substitute 'backward-char 'picture-backward-column)
-      (picture-substitute 'delete-char 'picture-clear-column)
-      ;; There are two possibilities for what is normally on DEL.
-      (picture-substitute 'backward-delete-char-untabify 'picture-backward-clear-column)
-      (picture-substitute 'delete-backward-char 'picture-backward-clear-column)
-      (picture-substitute 'kill-line 'picture-clear-line)
-      (picture-substitute 'open-line 'picture-open-line)
-      (picture-substitute 'newline 'picture-newline)
-      (picture-substitute 'newline-and-indent 'picture-duplicate-line)
-      (picture-substitute 'next-line 'picture-move-down)
-      (picture-substitute 'previous-line 'picture-move-up)
-      (picture-substitute 'move-beginning-of-line 'picture-beginning-of-line)
-      (picture-substitute 'move-end-of-line 'picture-end-of-line)
-      (picture-substitute 'mouse-set-point 'picture-mouse-set-point)
-
-      (define-key picture-mode-map "\C-c\C-d" 'picture-delete-char)
-      (define-key picture-mode-map "\e\t" 'picture-toggle-tab-state)
-      (define-key picture-mode-map "\t" 'picture-tab)
-      (define-key picture-mode-map "\e\t" 'picture-tab-search)
-      (define-key picture-mode-map "\C-c\t" 'picture-set-tab-stops)
-      (define-key picture-mode-map "\C-c\C-k" 'picture-clear-rectangle)
-      (define-key picture-mode-map "\C-c\C-w" 'picture-clear-rectangle-to-register)
-      (define-key picture-mode-map "\C-c\C-y" 'picture-yank-rectangle)
-      (define-key picture-mode-map "\C-c\C-x" 'picture-yank-rectangle-from-register)
-      (define-key picture-mode-map "\C-c\C-r" 'picture-draw-rectangle)
-      (define-key picture-mode-map "\C-c\C-c" 'picture-mode-exit)
-      (define-key picture-mode-map "\C-c\C-f" 'picture-motion)
-      (define-key picture-mode-map "\C-c\C-b" 'picture-motion-reverse)
-      (define-key picture-mode-map "\C-c<" 'picture-movement-left)
-      (define-key picture-mode-map "\C-c>" 'picture-movement-right)
-      (define-key picture-mode-map "\C-c^" 'picture-movement-up)
-      (define-key picture-mode-map "\C-c." 'picture-movement-down)
-      (define-key picture-mode-map "\C-c`" 'picture-movement-nw)
-      (define-key picture-mode-map "\C-c'" 'picture-movement-ne)
-      (define-key picture-mode-map "\C-c/" 'picture-movement-sw)
-      (define-key picture-mode-map "\C-c\\" 'picture-movement-se)
-      (define-key picture-mode-map [(control ?c) left]  'picture-movement-left)
-      (define-key picture-mode-map [(control ?c) right] 'picture-movement-right)
-      (define-key picture-mode-map [(control ?c) up]    'picture-movement-up)
-      (define-key picture-mode-map [(control ?c) down]  'picture-movement-down)
-      (define-key picture-mode-map [(control ?c) home]  'picture-movement-nw)
-      (define-key picture-mode-map [(control ?c) prior] 'picture-movement-ne)
-      (define-key picture-mode-map [(control ?c) end]   'picture-movement-sw)
-      (define-key picture-mode-map [(control ?c) next]  'picture-movement-se)))
+(defvar picture-mode-map
+  (let ((map (make-keymap)))
+    (define-key map [remap self-insert-command] 'picture-self-insert)
+    (define-key map [remap self-insert-command] 'picture-self-insert)
+    (define-key map [remap completion-separator-self-insert-command]
+      'picture-self-insert)
+    (define-key map [remap completion-separator-self-insert-autofilling]
+      'picture-self-insert)
+    (define-key map [remap forward-char] 'picture-forward-column)
+    (define-key map [remap backward-char] 'picture-backward-column)
+    (define-key map [remap delete-char] 'picture-clear-column)
+    ;; There are two possibilities for what is normally on DEL.
+    (define-key map [remap backward-delete-char-untabify]
+      'picture-backward-clear-column)
+    (define-key map [remap delete-backward-char] 'picture-backward-clear-column)
+    (define-key map [remap kill-line] 'picture-clear-line)
+    (define-key map [remap open-line] 'picture-open-line)
+    (define-key map [remap newline] 'picture-newline)
+    (define-key map [remap newline-and-indent] 'picture-duplicate-line)
+    (define-key map [remap next-line] 'picture-move-down)
+    (define-key map [remap previous-line] 'picture-move-up)
+    (define-key map [remap move-beginning-of-line] 'picture-beginning-of-line)
+    (define-key map [remap move-end-of-line] 'picture-end-of-line)
+    (define-key map [remap mouse-set-point] 'picture-mouse-set-point)
+    (define-key map "\C-c\C-d" 'picture-delete-char)
+    (define-key map "\e\t" 'picture-toggle-tab-state)
+    (define-key map "\t" 'picture-tab)
+    (define-key map "\e\t" 'picture-tab-search)
+    (define-key map "\C-c\t" 'picture-set-tab-stops)
+    (define-key map "\C-c\C-k" 'picture-clear-rectangle)
+    (define-key map "\C-c\C-w" 'picture-clear-rectangle-to-register)
+    (define-key map "\C-c\C-y" 'picture-yank-rectangle)
+    (define-key map "\C-c\C-x" 'picture-yank-rectangle-from-register)
+    (define-key map "\C-c\C-r" 'picture-draw-rectangle)
+    (define-key map "\C-c\C-c" 'picture-mode-exit)
+    (define-key map "\C-c\C-f" 'picture-motion)
+    (define-key map "\C-c\C-b" 'picture-motion-reverse)
+    (define-key map "\C-c<" 'picture-movement-left)
+    (define-key map "\C-c>" 'picture-movement-right)
+    (define-key map "\C-c^" 'picture-movement-up)
+    (define-key map "\C-c." 'picture-movement-down)
+    (define-key map "\C-c`" 'picture-movement-nw)
+    (define-key map "\C-c'" 'picture-movement-ne)
+    (define-key map "\C-c/" 'picture-movement-sw)
+    (define-key map "\C-c\\" 'picture-movement-se)
+    (define-key map [(control ?c) left]  'picture-movement-left)
+    (define-key map [(control ?c) right] 'picture-movement-right)
+    (define-key map [(control ?c) up]    'picture-movement-up)
+    (define-key map [(control ?c) down]  'picture-movement-down)
+    (define-key map [(control ?c) home]  'picture-movement-nw)
+    (define-key map [(control ?c) prior] 'picture-movement-ne)
+    (define-key map [(control ?c) end]   'picture-movement-sw)
+    (define-key map [(control ?c) next]  'picture-movement-se)
+    map)
+  "Keymap used in `picture-mode'.")
 
 (defcustom picture-mode-hook nil
   "If non-nil, its value is called on entry to Picture mode.
index b473019643ac4496df1a3cb01af9cdffe8dd3c7d..62fa68ca793c4d07faf19cf6be25bbc13f0ef1a6 100644 (file)
@@ -64,7 +64,7 @@
   :group 'wp)
 
 (defcustom r2b-trace-on nil
-  "*Non-nil means trace conversion."
+  "Non-nil means trace conversion."
   :type 'boolean
   :group 'refbib)
 
@@ -128,7 +128,7 @@ in `r2b-proceedings-list' (although it wouldn't cause an error)."
 This is in addition to the `r2b-capitalize-title-stop-words'.")
 
 (defcustom r2b-delimit-with-quote t
-  "*If true, then use \" to delimit fields, otherwise use braces."
+  "If true, then use \" to delimit fields, otherwise use braces."
   :type 'boolean
   :group 'refbib)
 
@@ -204,12 +204,12 @@ This is in addition to the `r2b-capitalize-title-stop-words'.")
    (buffer-substring (match-beginning exp) (match-end exp)))
 
 (defcustom r2b-out-buf-name "*Out*"
-  "*Name of buffer for output from refer-to-bibtex."
+  "Name of buffer for output from refer-to-bibtex."
   :type 'string
   :group 'refbib)
 
 (defcustom r2b-log-name "*Log*"
-  "*Name of buffer for logs errors from refer-to-bibtex."
+  "Name of buffer for logs errors from refer-to-bibtex."
   :type 'string
   :group 'refbib)
 
index cb7e9ff0b88b3efa6f55c329bda9951f6c6daa03..d6b355bdd0daece388ddc9690b406a45328b092c 100644 (file)
@@ -83,8 +83,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defgroup refill nil
   "Refilling paragraphs on changes."
   :group 'fill)
@@ -169,8 +167,8 @@ complex processing.")
   "Post-command function to do refilling (conditionally)."
   (when refill-doit ; there was a change
     ;; There's probably scope for more special cases here...
-    (case this-command
-      (self-insert-command
+    (pcase this-command
+      (`self-insert-command
        ;; Treat self-insertion commands specially, since they don't
        ;; always reset `refill-doit' -- for self-insertion commands that
        ;; *don't* cause a refill, we want to leave it turned on so that
@@ -180,9 +178,9 @@ complex processing.")
         ;; newline, covered below).
         (refill-fill-paragraph-at refill-doit)
         (setq refill-doit nil)))
-      ((quoted-insert fill-paragraph fill-region) nil)
-      ((newline newline-and-indent open-line indent-new-comment-line
-       reindent-then-newline-and-indent)
+      ((or `quoted-insert `fill-paragraph `fill-region) nil)
+      ((or `newline `newline-and-indent `open-line `indent-new-comment-line
+           `reindent-then-newline-and-indent)
        ;; Don't zap what was just inserted.
        (save-excursion
         (beginning-of-line)            ; for newline-and-indent
@@ -196,7 +194,7 @@ complex processing.")
         (save-restriction
           (narrow-to-region (line-beginning-position) (point-max))
           (refill-fill-paragraph-at refill-doit))))
-      (t
+      (_
        (refill-fill-paragraph-at refill-doit)))
     (setq refill-doit nil)))
 
index ebda25ea9323d71360ca63990ad664f7e5eda0a9..b1e426c55663847075d513efbd6ae8ecfb50e84e 100644 (file)
@@ -316,7 +316,7 @@ With argument, actually select the window showing the cross reference."
         (run-hooks 'reftex-display-copied-context-hook)))))
 
 (defvar reftex-use-itimer-in-xemacs nil
-  "*Non-nil means use the idle timers in XEmacs for crossref display.
+  "Non-nil means use the idle timers in XEmacs for crossref display.
 Currently, idle timer restart is broken and we use the post-command-hook.")
 
 (defun reftex-toggle-auto-view-crossref ()
index 681e36b524ad6ddf75376d3759b327f5fd42386e..d836bbb6cb824ef2ddf2f72b0eda0890ac43a3c6 100644 (file)
@@ -350,9 +350,8 @@ Also checks if buffers visiting the files are in read-only mode."
 ;; variable `multi-isearch-next-buffer-function'.
 
 (defun reftex-isearch-wrap-function ()
-  (if (not isearch-word)
-      (switch-to-buffer
-       (funcall isearch-next-buffer-function (current-buffer) t)))
+  (switch-to-buffer
+   (funcall isearch-next-buffer-function (current-buffer) t))
   (goto-char (if isearch-forward (point-min) (point-max))))
 
 (defun reftex-isearch-push-state-function ()
@@ -364,14 +363,7 @@ Also checks if buffers visiting the files are in read-only mode."
 
 (defun reftex-isearch-isearch-search (string bound noerror)
   (let ((nxt-buff nil)
-       (search-fun
-        (cond
-         (isearch-word
-          (if isearch-forward 'word-search-forward 'word-search-backward))
-         (isearch-regexp
-          (if isearch-forward 're-search-forward 're-search-backward))
-         (t
-          (if isearch-forward 'search-forward 'search-backward)))))
+       (search-fun (isearch-search-fun-default)))
     (or
      (funcall search-fun string bound noerror)
      (unless bound
@@ -468,7 +460,7 @@ With no argument, this command toggles
                (kill-local-variable 'isearch-next-buffer-function))
              (setq reftex-isearch-minor-mode nil))))
        (remove-hook 'reftex-mode-hook 'reftex-isearch-minor-mode)))
-    ;; Force modeline redisplay.
+    ;; Force mode line redisplay.
     (set-buffer-modified-p (buffer-modified-p))))
 
 (add-minor-mode 'reftex-isearch-minor-mode "/I" nil nil
index fdcbf8b0b43712944732a5cbef7d50ae4aafae81..2d395fe3df2fc20608cb8838625d53db3b20c153 100644 (file)
@@ -274,6 +274,8 @@ will prompt for other arguments."
     (and newtag (cdr cell) (not (member newtag (cdr cell)))
          (push newtag (cdr cell)))))
 
+(define-obsolete-variable-alias
+  'reftex-index-map 'reftex-index-mode-map "24.1")
 (defvar reftex-index-mode-map
   (let ((map (make-sparse-keymap)))
     ;; Index map
@@ -377,8 +379,6 @@ will prompt for other arguments."
 
     map)
   "Keymap used for *Index* buffers.")
-(define-obsolete-variable-alias
-  'reftex-index-map 'reftex-index-mode-map "24.1")
 
 (defvar reftex-index-menu)
 
@@ -1179,6 +1179,8 @@ This gets refreshed in every phrases command.")
   "Font lock keywords for reftex-index-phrases-mode.")
 (defvar reftex-index-phrases-font-lock-defaults nil
   "Font lock defaults for reftex-index-phrases-mode.")
+(define-obsolete-variable-alias
+  'reftex-index-phrases-map 'reftex-index-phrases-mode-map "24.1")
 (defvar reftex-index-phrases-mode-map
   (let ((map (make-sparse-keymap)))
     ;; Keybindings and Menu for phrases buffer
@@ -1244,8 +1246,6 @@ This gets refreshed in every phrases command.")
 
     map)
   "Keymap used for *toc* buffer.")
-(define-obsolete-variable-alias
-  'reftex-index-phrases-map 'reftex-index-phrases-mode-map "24.1")
 
 
 (defun reftex-index-phrase-selection-or-word (arg)
index 03690f65281b2fa1ab607acfd1507f8574f28bd6..1882e7dde5636282ad4e42b85b29bc2de6d25bd7 100644 (file)
@@ -313,8 +313,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
               (save-match-data
                 (cond
                  ((equal letter "f")
-                  (file-name-sans-extension
-                   (file-name-nondirectory (buffer-file-name))))
+                  (file-name-base))
                  ((equal letter "F")
                   (let ((masterdir (file-name-directory (reftex-TeX-master-file)))
                         (file (file-name-sans-extension (buffer-file-name))))
@@ -323,8 +322,7 @@ also applies `reftex-translate-to-ascii-function' to the string."
                         (substring file (length masterdir))
                       file)))
                  ((equal letter "m")
-                  (file-name-sans-extension
-                   (file-name-nondirectory (reftex-TeX-master-file))))
+                  (file-name-base (reftex-TeX-master-file)))
                  ((equal letter "M")
                   (file-name-nondirectory
                    (substring (file-name-directory (reftex-TeX-master-file))
index c583b67f13a1238d2c522eb9bacf214e28842db6..627dfba0071bd7edbf8afe23ef65e0a9f87a6d89 100644 (file)
@@ -71,6 +71,8 @@
     (define-key map "-" 'negative-argument)
     map))
 
+(define-obsolete-variable-alias
+  'reftex-select-label-map 'reftex-select-label-mode-map "24.1")
 (defvar reftex-select-label-mode-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map reftex-select-shared-map)
   "Keymap used for *RefTeX Select* buffer, when selecting a label.
 This keymap can be used to configure the label selection process which is
 started with the command \\[reftex-reference].")
-(define-obsolete-variable-alias
-  'reftex-select-label-map 'reftex-select-label-mode-map "24.1")
 
 (define-derived-mode reftex-select-label-mode fundamental-mode "LSelect"
   "Major mode for selecting a label in a LaTeX document.
@@ -126,6 +126,8 @@ During a selection process, these are the local bindings.
   ;; We do not set a local map - reftex-select-item does this.
   )
 
+(define-obsolete-variable-alias
+  'reftex-select-bib-map 'reftex-select-bib-mode-map "24.1")
 (defvar reftex-select-bib-mode-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map reftex-select-shared-map)
@@ -147,8 +149,6 @@ During a selection process, these are the local bindings.
   "Keymap used for *RefTeX Select* buffer, when selecting a BibTeX entry.
 This keymap can be used to configure the BibTeX selection process which is
 started with the command \\[reftex-citation].")
-(define-obsolete-variable-alias
-  'reftex-select-bib-map 'reftex-select-bib-mode-map "24.1")
 
 (define-derived-mode reftex-select-bib-mode fundamental-mode "BSelect"
   "Major mode for selecting a citation key in a LaTeX document.
index 5d293d404e6e61a455e3b5cb98c2c3cd68ce7234..519236a362128d1f2076b49d06625595e2678f35 100644 (file)
@@ -31,6 +31,7 @@
 (require 'reftex)
 ;;;
 
+(define-obsolete-variable-alias 'reftex-toc-map 'reftex-toc-mode-map "24.1")
 (defvar reftex-toc-mode-map
   (let ((map (make-sparse-keymap)))
 
 
     map)
   "Keymap used for *toc* buffer.")
-(define-obsolete-variable-alias 'reftex-toc-map 'reftex-toc-mode-map "24.1")
 
 (defvar reftex-toc-menu)
 (defvar reftex-last-window-height nil)
index 98135b7ce24fa1fb287d6146cbdbad1d58966f14..4c875a35b3e88db6f6cbca341e1c0997fbd2755e 100644 (file)
@@ -294,7 +294,7 @@ select the nearest entry with the correct new level."
                  (symbol :tag "function        " my-level-func)))))
 
 (defcustom reftex-toc-max-level 100
-  "*The maximum level of toc entries which will be included in the TOC.
+  "The maximum level of toc entries which will be included in the TOC.
 Section headings with a bigger level will be ignored.  In RefTeX, chapters
 are level 1, sections are level 2 etc.
 This variable can be changed from within the *toc* buffer with the `t' key."
@@ -302,7 +302,7 @@ This variable can be changed from within the *toc* buffer with the `t' key."
   :type 'integer)
 
 (defcustom reftex-part-resets-chapter nil
-  "*Non-nil means, \\part is like any other sectioning command.
+  "Non-nil means, \\part is like any other sectioning command.
 This means, part numbers will be included in the numbering of chapters, and
 chapter counters will be reset for each part.
 When nil (the default), parts are special, do not reset the chapter counter
@@ -312,7 +312,7 @@ and also do not show up in chapter numbers."
 
 
 (defcustom reftex-auto-recenter-toc 'frame
-  "*Non-nil means, turn automatic recentering of *TOC* window on.
+  "Non-nil means, turn automatic recentering of *TOC* window on.
 When active, the *TOC* window will always show the section you
 are currently working in.  Recentering happens whenever Emacs is idle for
 more than `reftex-idle-time' seconds.
@@ -335,12 +335,12 @@ This feature can be turned on and off from the menu
           (const :tag "in dedicated frame only" frame)))
 
 (defcustom reftex-toc-split-windows-horizontally nil
-  "*Non-nil means, create TOC window by splitting window horizontally."
+  "Non-nil means, create TOC window by splitting window horizontally."
   :group 'reftex-table-of-contents-browser
   :type 'boolean)
 
 (defcustom reftex-toc-split-windows-fraction .3
-  "*Fraction of the width or height of the frame to be used for TOC window.
+  "Fraction of the width or height of the frame to be used for TOC window.
 See also `reftex-toc-split-windows-horizontally'."
   :group 'reftex-table-of-contents-browser
   :type 'number)
@@ -349,7 +349,7 @@ See also `reftex-toc-split-windows-horizontally'."
   "This variable is obsolete, use `reftex-toc-split-windows-fraction' instead.")
 
 (defcustom reftex-toc-keep-other-windows t
-  "*Non-nil means, split the selected window to display the *toc* buffer.
+  "Non-nil means, split the selected window to display the *toc* buffer.
 This helps to keep the window configuration, but makes the *toc* small.
 When nil, all other windows except the selected one will be deleted, so
 that the *toc* window fills half the frame."
@@ -357,25 +357,25 @@ that the *toc* window fills half the frame."
   :type 'boolean)
 
 (defcustom reftex-toc-include-file-boundaries nil
-  "*Non-nil means, include file boundaries in *toc* buffer.
+  "Non-nil means, include file boundaries in *toc* buffer.
 This flag can be toggled from within the *toc* buffer with the `F' key."
   :group 'reftex-table-of-contents-browser
   :type 'boolean)
 
 (defcustom reftex-toc-include-labels nil
-  "*Non-nil means, include labels in *toc* buffer.
+  "Non-nil means, include labels in *toc* buffer.
 This flag can be toggled from within the *toc* buffer with the `l' key."
   :group 'reftex-table-of-contents-browser
   :type 'boolean)
 
 (defcustom reftex-toc-include-index-entries nil
-  "*Non-nil means, include index entries in *toc* buffer.
+  "Non-nil means, include index entries in *toc* buffer.
 This flag can be toggled from within the *toc* buffer with the `i' key."
   :group 'reftex-table-of-contents-browser
   :type 'boolean)
 
 (defcustom reftex-toc-confirm-promotion 2
-  "*Non-nil means, promotion/demotion commands first prompt for confirmation.
+  "Non-nil means, promotion/demotion commands first prompt for confirmation.
 When nil, the command is executed immediately.  When this is an integer
 N, ask for confirmation only if N or more section commands are going to be
 changed."
@@ -386,21 +386,21 @@ changed."
           (number :tag "When more than N sections" :value 2)))
 
 (defcustom reftex-toc-include-context nil
-  "*Non-nil means, include context with labels in the *toc* buffer.
+  "Non-nil means, include context with labels in the *toc* buffer.
 Context will only be shown when labels are visible as well.
 This flag can be toggled from within the *toc* buffer with the `c' key."
   :group 'reftex-table-of-contents-browser
   :type 'boolean)
 
 (defcustom reftex-toc-follow-mode nil
-  "*Non-nil means, point in *toc* buffer will cause other window to follow.
+  "Non-nil means, point in *toc* buffer will cause other window to follow.
 The other window will show the corresponding part of the document.
 This flag can be toggled from within the *toc* buffer with the `f' key."
   :group 'reftex-table-of-contents-browser
   :type 'boolean)
 
 (defcustom reftex-revisit-to-follow nil
-  "*Non-nil means, follow-mode will revisit files if necessary.
+  "Non-nil means, follow-mode will revisit files if necessary.
 When nil, follow-mode will be suspended for stuff in unvisited files."
   :group 'reftex-table-of-contents-browser
   :group 'reftex-referencing-labels
@@ -940,7 +940,7 @@ This is used to string together whole reference sets, like
   :type '(repeat (cons (character) (string))))
 
 (defcustom reftex-vref-is-default nil
-  "*Non-nil means, the varioref macro \\vref is used as default.
+  "Non-nil means, the varioref macro \\vref is used as default.
 In the selection buffer, the `v' key toggles the reference macro between
 `\\ref' and `\\vref'.  The value of this variable determines the default
 which is active when entering the selection process.
@@ -951,7 +951,7 @@ the label types for which it should be true."
 ;;;###autoload(put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
 
 (defcustom reftex-fref-is-default nil
-  "*Non-nil means, the fancyref macro \\fref is used as default.
+  "Non-nil means, the fancyref macro \\fref is used as default.
 In the selection buffer, the `V' key toggles the reference macro between
 `\\ref', `\\fref' and `\\Fref'.  The value of this variable determines
 the default which is active when entering the selection process.
@@ -962,13 +962,13 @@ the label types for which it should be true."
 ;;;###autoload(put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
 
 (defcustom reftex-level-indent 2
-  "*Number of spaces to be used for indentation per section level."
+  "Number of spaces to be used for indentation per section level."
   :group 'reftex-referencing-labels
   :type 'integer)
 ;;;###autoload(put 'reftex-level-indent 'safe-local-variable 'integerp)
 
 (defcustom reftex-guess-label-type t
-  "*Non-nil means, `reftex-reference' will try to guess the label type.
+  "Non-nil means, `reftex-reference' will try to guess the label type.
 To do that, RefTeX will look at the word before the cursor and compare it with
 the words given in `reftex-label-alist'.  When it finds a match, RefTeX will
 immediately offer the correct label menu - otherwise it will prompt you for
@@ -1009,7 +1009,7 @@ string to insert into the buffer."
 
 (defvar reftex-bibfile-ignore-list nil) ; compatibility
 (defcustom reftex-bibfile-ignore-regexps nil
-  "*List of regular expressions to exclude files in \\bibliography{..}.
+  "List of regular expressions to exclude files in \\bibliography{..}.
 File names matched by these regexps will not be parsed by RefTeX.
 Intended for files which contain only `@string' macro definitions and the
 like, which are ignored by RefTeX anyway."
@@ -1018,7 +1018,7 @@ like, which are ignored by RefTeX anyway."
   :type '(repeat (regexp)))
 
 (defcustom reftex-default-bibliography nil
-  "*List of BibTeX database files which should be used if none are specified.
+  "List of BibTeX database files which should be used if none are specified.
 When `reftex-citation' is called from a document which has neither a
 `\\bibliography{..}' statement nor a `thebibliography' environment,
 RefTeX will scan these files instead.  Intended for using `reftex-citation'
@@ -1028,7 +1028,7 @@ path."
   :type '(repeat (file)))
 
 (defcustom reftex-sort-bibtex-matches 'reverse-year
-  "*Sorting of the entries found in BibTeX databases by reftex-citation.
+  "Sorting of the entries found in BibTeX databases by reftex-citation.
 Possible values:
 nil            Do not sort entries.
 'author        Sort entries by author name.
@@ -1041,7 +1041,7 @@ nil            Do not sort entries.
                  (const :tag "by year, reversed" reverse-year)))
 
 (defcustom reftex-cite-format 'default
-  "*The format of citations to be inserted into the buffer.
+  "The format of citations to be inserted into the buffer.
 It can be a string or an alist or a symbol.  In the simplest case this
 is just the string \"\\cite{%l}\", which is also the default.  See the
 definition of `reftex-cite-format-builtin' for more complex examples.
@@ -1105,7 +1105,7 @@ E.g.: (setq reftex-cite-format 'natbib)"
                   (string    :tag "Format string" "")))))
 
 (defcustom reftex-cite-prompt-optional-args 'maybe
-  "*Non-nil means, prompt for empty optional arguments in cite macros.
+  "Non-nil means, prompt for empty optional arguments in cite macros.
 When an entry in `reftex-cite-format' ist given with square brackets to
 indicate optional arguments (for example \\cite[][]{%l}), RefTeX can
 prompt for values.  Possible values are:
@@ -1123,7 +1123,7 @@ the buffer.  See `reftex-cite-cleanup-optional-args'."
           (const :tag "Never" nil)))
 
 (defcustom reftex-cite-cleanup-optional-args t
-  "*Non-nil means, remove unnecessary empty optional arguments in cite macros.
+  "Non-nil means, remove unnecessary empty optional arguments in cite macros.
 The cite macros provided by some packages (for example
 natbib) allow specifying two optional arguments, one for a prefix to
 the citation, and a second for a postfix.  When only one optional
@@ -1141,7 +1141,7 @@ can be turned off."
   :type 'boolean)
 
 (defcustom reftex-comment-citations nil
-  "*Non-nil means add a comment for each citation describing the full entry.
+  "Non-nil means add a comment for each citation describing the full entry.
 The comment is formatted according to `reftex-cite-comment-format'."
   :group 'reftex-citation-support
   :type 'boolean)
@@ -1195,7 +1195,7 @@ should return the string to insert into the buffer."
   :group 'reftex)
 
 (defcustom reftex-support-index t
-  "*Non-nil means, index entries are parsed as well.
+  "Non-nil means, index entries are parsed as well.
 Index support is resource intensive and the internal structure holding the
 parsed information can become quite big.  Therefore it can be turned off.
 When this is nil and you execute a command which requires index support,
@@ -1354,7 +1354,7 @@ has higher priority than this logical `or'."
   :type 'regexp)
 
 (defcustom reftex-index-phrases-search-whole-words t
-  "*Non-nil means phrases search will look for whole words, not subwords.
+  "Non-nil means phrases search will look for whole words, not subwords.
 This works by requiring word boundaries at the beginning and end of
 the search string.  When the search phrase already has a non-word-char
 at one of these points, no word boundary is required there."
@@ -1362,7 +1362,7 @@ at one of these points, no word boundary is required there."
   :type 'boolean)
 
 (defcustom reftex-index-phrases-case-fold-search t
-  "*Non-nil means, searching for index phrases will ignore case."
+  "Non-nil means, searching for index phrases will ignore case."
   :group 'reftex-index-support
   :type 'boolean)
 
@@ -1375,7 +1375,7 @@ If the function returns nil, the current match is skipped."
           (function)))
 
 (defcustom reftex-index-phrases-skip-indexed-matches nil
-  "*Non-nil means, skip matches which appear to be indexed already.
+  "Non-nil means, skip matches which appear to be indexed already.
 When doing global indexing from the phrases buffer, searches for some
 phrases may match at places where that phrase was already indexed.  In
 particular when indexing an already processed document again, this
@@ -1387,7 +1387,7 @@ be ignored."
   :type 'boolean)
 
 (defcustom reftex-index-phrases-wrap-long-lines nil
-  "*Non-nil means, when indexing from the phrases buffer, wrap lines.
+  "Non-nil means, when indexing from the phrases buffer, wrap lines.
 Inserting indexing commands in a line makes the line longer - often
 so long that it does not fit onto the screen.  When this variable is
 non-nil, newlines will be added as necessary before and/or after the
@@ -1397,7 +1397,7 @@ phrase and its index command will always end up on a single line."
   :type 'boolean)
 
 (defcustom reftex-index-phrases-sort-prefers-entry nil
-  "*Non-nil means when sorting phrase lines, the explicit index entry is used.
+  "Non-nil means when sorting phrase lines, the explicit index entry is used.
 Phrase lines in the phrases buffer contain a search phrase, and
 sorting is normally based on these.  Some phrase lines also have
 an explicit index argument specified.  When this variable is non-nil,
@@ -1406,7 +1406,7 @@ the index argument will be used for sorting."
   :type 'boolean)
 
 (defcustom reftex-index-phrases-sort-in-blocks t
-  "*Non-nil means, empty and comment lines separate phrase buffer into blocks.
+  "Non-nil means, empty and comment lines separate phrase buffer into blocks.
 Sorting will then preserve blocks, so that lines are re-arranged only
 within blocks."
   :group 'reftex-index-support
@@ -1425,13 +1425,13 @@ to that section."
   :type '(string :tag "Capital letters"))
 
 (defcustom reftex-index-include-context nil
-  "*Non-nil means, display the index definition context in the index buffer.
+  "Non-nil means, display the index definition context in the index buffer.
 This flag may also be toggled from the index buffer with the `c' key."
   :group 'reftex-index-support
   :type 'boolean)
 
 (defcustom reftex-index-follow-mode nil
-  "*Non-nil means, point in *Index* buffer will cause other window to follow.
+  "Non-nil means, point in *Index* buffer will cause other window to follow.
 The other window will show the corresponding part of the document.
 This flag can be toggled from within the *Index* buffer with the `f' key."
   :group 'reftex-table-of-contents-browser
@@ -1463,7 +1463,7 @@ which subgroup of the match should be highlighted."
                         (integer :tag "Highlight Group"))))
 
 (defcustom reftex-auto-view-crossref t
-  "*Non-nil means, initially turn automatic viewing of crossref info on.
+  "Non-nil means, initially turn automatic viewing of crossref info on.
 Automatic viewing of crossref info normally uses the echo area.
 Whenever point is idle for more than `reftex-idle-time' seconds on the
 argument of a \\ref or \\cite macro, and no other message is being
@@ -1478,20 +1478,20 @@ This feature can be turned on and off from the menu
                  (const :tag "in Other Window" window)))
 
 (defcustom reftex-idle-time 1.2
-  "*Time (secs) Emacs has to be idle before automatic crossref display is done.
+  "Time (secs) Emacs has to be idle before automatic crossref display is done.
 Applies also to toc recentering."
   :group 'reftex-viewing-cross-references
   :type 'number)
 
 (defcustom reftex-revisit-to-echo nil
-  "*Non-nil means, automatic citation display will revisit files if necessary.
+  "Non-nil means, automatic citation display will revisit files if necessary.
 When nil, citation display in echo area will only be active for cached
 entries and for BibTeX database files with live associated buffers."
   :group 'reftex-viewing-cross-references
   :type 'boolean)
 
 (defcustom reftex-cache-cite-echo t
-  "*Non-nil means, the information displayed in the echo area for cite macros
+  "Non-nil means, the information displayed in the echo area for cite macros
 is cached and even saved along with the parsing information.  The cache
 survives document scans.  In order to clear it, use M-x reftex-reset-mode."
   :group 'reftex-viewing-cross-references
@@ -1511,7 +1511,7 @@ for X-Symbol, but may have other uses as well."
   :group 'reftex)
 
 (defcustom reftex-texpath-environment-variables '("TEXINPUTS")
-  "*List of specifications how to retrieve the search path for TeX files.
+  "List of specifications how to retrieve the search path for TeX files.
 Several entries are possible.
 - If an element is the name of an environment variable, its content is used.
 - If an element starts with an exclamation mark, it is used as a command
@@ -1526,7 +1526,7 @@ See also `reftex-use-external-file-finders'."
   :type '(repeat (string :tag "Specification")))
 
 (defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB")
-  "*List of specifications how to retrieve search path for .bib database files.
+  "List of specifications how to retrieve search path for .bib database files.
 Several entries are possible.
 - If an element is the name of an environment variable, its content is used.
 - If an element starts with an exclamation mark, it is used as a command
@@ -1543,7 +1543,7 @@ See also `reftex-use-external-file-finders'."
 
 (defcustom reftex-file-extensions '(("tex" . (".tex" ".ltx"))
                                     ("bib" . (".bib")))
-  "*Association list with file extensions for different file types.
+  "Association list with file extensions for different file types.
 This is a list of items, each item is like: (TYPE . (DEF-EXT OTHER-EXT ...))
 
 TYPE:       File type like \"bib\" or \"tex\".
@@ -1572,7 +1572,7 @@ Note that if you are using external file finders, this option has no effect."
   :type 'boolean)
 
 (defcustom reftex-search-unrecursed-path-first t
-  "*Non-nil means, search all specified directories before trying recursion.
+  "Non-nil means, search all specified directories before trying recursion.
 Thus, in a path \".//:/tex/\", search first \"./\", then \"/tex/\" and then
 all subdirectories of \"./\".  If this option is nil, the subdirectories of
 \"./\" are searched before \"/tex/\".  This is mainly for speed - most of the
@@ -1583,7 +1583,7 @@ in wrong sequence."
   :type 'boolean)
 
 (defcustom reftex-use-external-file-finders nil
-  "*Non-nil means, use external programs to find files.
+  "Non-nil means, use external programs to find files.
 Normally, RefTeX searches the paths given in the environment variables
 TEXINPUTS and BIBINPUTS to find TeX files and BibTeX database files.
 With this option turned on, it calls an external program specified in the
@@ -1595,7 +1595,7 @@ the variables `reftex-texpath-environment-variables' and
 
 (defcustom reftex-external-file-finders '(("tex" . "kpsewhich -format=.tex %f")
                                           ("bib" . "kpsewhich -format=.bib %f"))
-  "*Association list with external programs to call for finding files.
+  "Association list with external programs to call for finding files.
 Each entry is a cons cell (TYPE . PROGRAM).
 TYPE is either \"tex\" or \"bib\".  PROGRAM is the external program to use with
 any arguments.  %f will be replaced by the name of the file to be found.
@@ -1612,7 +1612,7 @@ Only relevant when `reftex-use-external-file-finders' is non-nil."
   :group 'reftex)
 
 (defcustom reftex-keep-temporary-buffers 1
-  "*Non-nil means, keep buffers created for parsing and lookup.
+  "Non-nil means, keep buffers created for parsing and lookup.
 RefTeX sometimes needs to visit files related to the current document.
 We distinguish files visited for
 PARSING: Parts of a multifile document loaded when (re)-parsing the document.
@@ -1637,7 +1637,7 @@ upon the variable `reftex-initialize-temporary-buffers'."
           (const :tag "Keep lookup buffers only" 1)))
 
 (defcustom reftex-initialize-temporary-buffers nil
-  "*Non-nil means do initializations even when visiting file temporarily.
+  "Non-nil means do initializations even when visiting file temporarily.
 When nil, RefTeX may turn off find-file hooks and other stuff to briefly
 visit a file.
 When t, the full default initializations are done (find-file-hook etc.).
@@ -1651,14 +1651,14 @@ do a minimal initialization."
            (function-item))))
 
 (defcustom reftex-no-include-regexps '("\\.pstex_t\\'")
-  "*List of regular expressions to exclude certain input files from parsing.
+  "List of regular expressions to exclude certain input files from parsing.
 If the name of a file included via \\include or \\input is matched by any
 of the regular expressions in this list, that file is not parsed by RefTeX."
   :group 'reftex-optimizations-for-large-documents
   :type '(repeat (regexp)))
 
 (defcustom reftex-enable-partial-scans nil
-  "*Non-nil means, re-parse only 1 file when asked to re-parse.
+  "Non-nil means, re-parse only 1 file when asked to re-parse.
 Re-parsing is normally requested with a `C-u' prefix to many RefTeX commands,
 or with the `r' key in menus.  When this option is t in a multifile document,
 we will only parse the current buffer, or the file associated with the label
@@ -1669,7 +1669,7 @@ in menus."
   :type 'boolean)
 
 (defcustom reftex-allow-automatic-rescan t
-  "*Non-nil means, RefTeX may rescan the document when this seems necessary.
+  "Non-nil means, RefTeX may rescan the document when this seems necessary.
 Currently this applies only to rescanning after label insertion, when
 the new label cannot be inserted correctly into the internal label
 list."
@@ -1677,7 +1677,7 @@ list."
   :type 'boolean)
 
 (defcustom reftex-save-parse-info nil
-  "*Non-nil means, save information gathered with parsing in a file.
+  "Non-nil means, save information gathered with parsing in a file.
 The file MASTER.rel in the same directory as MASTER.tex is used to save the
 information.  When this variable is t,
 - accessing the parsing information for the first time in an editing session
@@ -1688,13 +1688,13 @@ information.  When this variable is t,
   :type 'boolean)
 
 (defcustom reftex-parse-file-extension ".rel"
-  "*File extension for the file in which parser information is stored.
+  "File extension for the file in which parser information is stored.
 This extension is added to the base name of the master file."
   :group 'reftex-optimizations-for-large-documents
   :type 'string)
 
 (defcustom reftex-use-multiple-selection-buffers nil
-  "*Non-nil means use a separate selection buffer for each label type.
+  "Non-nil means use a separate selection buffer for each label type.
 These buffers are kept from one selection to the next and need not to be
 created for each use - so the menu generally comes up faster.  The
 selection buffers will be erased (and therefore updated) automatically
@@ -1705,7 +1705,7 @@ when new labels in its category are added.  See the variable
   :type 'boolean)
 
 (defcustom reftex-auto-update-selection-buffers t
-  "*Non-nil means, selection buffers will be updated automatically.
+  "Non-nil means, selection buffers will be updated automatically.
 When a new label is defined with `reftex-label', all selection buffers
 associated with that label category are emptied, in order to force an
 update upon next use.  When nil, the buffers are left alone and have to be
@@ -1724,14 +1724,14 @@ The value of this variable will only have any effect when
   :group 'reftex)
 
 (defcustom reftex-use-fonts t
-  "*Non-nil means, use fonts in *toc* and selection buffers.
+  "Non-nil means, use fonts in *toc* and selection buffers.
 Font-lock must be loaded as well to actually get fontified display.
 When changing this option, a rescan may be necessary to activate the change."
   :group 'reftex-fontification-configurations
   :type 'boolean)
 
 (defcustom reftex-refontify-context 1
-  "*Non-nil means, re-fontify the context in the label menu with font-lock.
+  "Non-nil means, re-fontify the context in the label menu with font-lock.
 This slightly slows down the creation of the label menu.  It is only necessary
 when you definitely want the context fontified.
 
@@ -1748,7 +1748,7 @@ The option is ignored when `reftex-use-fonts' is nil."
           (const :tag "When necessary" 1)))
 
 (defcustom reftex-highlight-selection 'cursor
-  "*Non-nil mean, highlight selected text in selection and *toc* buffers.
+  "Non-nil mean, highlight selected text in selection and *toc* buffers.
 Normally, the text near the cursor is the selected text, and it is
 highlighted.  This is the entry most keys in the selection and *toc*
 buffers act on.  However, if you mainly use the mouse to select an
@@ -1861,7 +1861,7 @@ bindings with this prefix bound to `reftex-extra-bindings-map'."
   :type 'boolean)
 
 (defcustom reftex-plug-into-AUCTeX nil
-  "*Plug-in flags for AUCTeX interface.
+  "Plug-in flags for AUCTeX interface.
 This variable is a list of 4 boolean flags.  When a flag is non-nil,
 RefTeX will
 
@@ -1896,7 +1896,7 @@ may require a restart of Emacs in order to become effective."
            )))
 
 (defcustom reftex-allow-detached-macro-args nil
-  "*Non-nil means, allow arguments of macros to be detached by whitespace.
+  "Non-nil means, allow arguments of macros to be detached by whitespace.
 When this is t, `aaa' will be considered as argument of \\bb in the following
 construct:  \\bbb [xxx] {aaa}."
   :group 'reftex-miscellaneous-configurations
index 1b1860c833db509815c0327f7afd1ae376fbcdb8..6e0562f4a4bf5fb0fe948d2e51dbf75ab45009ba 100644 (file)
@@ -2,9 +2,11 @@
 
 ;; Copyright (C) 2003-2012  Free Software Foundation, Inc.
 
-;; Authors: Martin Blais <blais@furius.ca>,
-;;          Stefan Merten <smerten@oekonux.de>,
-;;          David Goodger <goodger@python.org>
+;; Maintainer: Stefan Merten <smerten@oekonux.de>
+;; Author: Stefan Merten <smerten@oekonux.de>,
+;;         Martin Blais <blais@furius.ca>,
+;;         David Goodger <goodger@python.org>,
+;;         Wei-Wei Guo <wwguocn@gmail.com>
 
 ;; This file is part of GNU Emacs.
 
 
 ;;; Commentary:
 
-;; This package provides major mode rst-mode, which supports documents marked up
-;; using the reStructuredText format.  Support includes font locking as well as
-;; some convenience functions for editing.  It does this by defining a Emacs
-;; major mode: rst-mode (ReST).  This mode is derived from text-mode (and
-;; inherits much of it).  This package also contains:
+;; This package provides major mode rst-mode, which supports documents marked
+;; up using the reStructuredText format.  Support includes font locking as well
+;; as a lot of convenience functions for editing.  It does this by defining a
+;; Emacs major mode: rst-mode (ReST).  This mode is derived from text-mode.
+;; This package also contains:
 ;;
 ;; - Functions to automatically adjust and cycle the section underline
-;;   decorations;
+;;   adornments;
 ;; - A mode that displays the table of contents and allows you to jump anywhere
 ;;   from it;
 ;; - Functions to insert and automatically update a TOC in your source
 ;;   document;
-;; - Font-lock highlighting of notable reStructuredText structures;
+;; - Function to insert list, processing item bullets and enumerations
+;;   automatically;
+;; - Font-lock highlighting of most reStructuredText structures;
+;; - Indentation and filling according to reStructuredText syntax;
+;; - Cursor movement according to reStructuredText syntax;
 ;; - Some other convenience functions.
 ;;
 ;; See the accompanying document in the docutils documentation about
 ;; http://docutils.sourceforge.net/docs/user/emacs.html
 ;;
 ;;
-;; There are a number of convenient keybindings provided by rst-mode.
-;; The main one is
-;;
-;;    C-c C-a (also C-=): rst-adjust
-;;
-;; Updates or rotates the section title around point or promotes/demotes the
-;; decorations within the region (see full details below).  Note that C-= is a
-;; good binding, since it allows you to specify a negative arg easily with C--
-;; C-= (easy to type), as well as ordinary prefix arg with C-u C-=.
-;;
+;; There are a number of convenient key bindings provided by rst-mode.
 ;; For more on bindings, see rst-mode-map below.  There are also many variables
-;; that can be customized, look for defcustom and defvar in this file.
+;; that can be customized, look for defcustom in this file.
 ;;
 ;; If you use the table-of-contents feature, you may want to add a hook to
-;; update the TOC automatically everytime you adjust a section title::
+;; update the TOC automatically every time you adjust a section title::
 ;;
 ;;   (add-hook 'rst-adjust-hook 'rst-toc-update)
 ;;
 ;;
 ;;   (setq font-lock-global-modes '(not rst-mode ...))
 ;;
-
-
-;; CUSTOMIZATION
-;;
-;; rst
-;; ---
-;; This group contains some general customizable features.
-;;
-;; The group is contained in the wp group.
-;;
-;; rst-faces
-;; ---------
-;; This group contains all necessary for customizing fonts.  The default
-;; settings use standard font-lock-*-face's so if you set these to your
-;; liking they are probably good in rst-mode also.
-;;
-;; The group is contained in the faces group as well as in the rst group.
-;;
-;; rst-faces-defaults
-;; ------------------
-;; This group contains all necessary for customizing the default fonts used for
-;; section title faces.
 ;;
-;; The general idea for section title faces is to have a non-default background
-;; but do not change the background.  The section level is shown by the
-;; lightness of the background color.  If you like this general idea of
-;; generating faces for section titles but do not like the details this group
-;; is the point where you can customize the details.  If you do not like the
-;; general idea, however, you should customize the faces used in
-;; rst-adornment-faces-alist.
 ;;
-;; Note: If you are using a dark background please make sure the variable
-;; frame-background-mode is set to the symbol dark.  This triggers
-;; some default values which are probably right for you.
+;; Customization is done by customizable variables contained in customization
+;; group "rst" and subgroups.  Group "rst" is contained in the "wp" group.
 ;;
-;; The group is contained in the rst-faces group.
-;;
-;; All customizable features have a comment explaining their meaning.
-;; Refer to the customization of your Emacs (try ``M-x customize``).
-
 
 ;;; DOWNLOAD
 
-;; The latest version of this file lies in the docutils source code repository:
-;;   http://svn.berlios.de/svnroot/repos/docutils/trunk/docutils/tools/editors/emacs/rst.el
-
+;; The latest release of this file lies in the docutils source code repository:
+;;   http://docutils.svn.sourceforge.net/svnroot/docutils/trunk/docutils/tools/editors/emacs/rst.el
 
 ;;; INSTALLATION
 
 ;; want automatically enter rst-mode from any file with compatible extensions:
 ;;
 ;; (setq auto-mode-alist
-;;       (append '(("\\.txt$" . rst-mode)
-;;                 ("\\.rst$" . rst-mode)
-;;                 ("\\.rest$" . rst-mode)) auto-mode-alist))
+;;       (append '(("\\.txt\\'" . rst-mode)
+;;                 ("\\.rst\\'" . rst-mode)
+;;                 ("\\.rest\\'" . rst-mode)) auto-mode-alist))
 ;;
 
-;;; BUGS
-
-;; - rst-enumeration-region: Select a single paragraph, with the top at one
-;;   blank line before the beginning, and it will fail.
-;; - The active region goes away when we shift it left or right, and this
-;;   prevents us from refilling it automatically when shifting many times.
-;; - The suggested decorations when adjusting should not have to cycle
-;;   below one below the last section decoration level preceding the
-;;   cursor.  We need to fix that.
-
-;;; TODO LIST
-
-;; rst-toc-insert features
-;; ------------------------
-;; - rst-toc-insert: We should parse the contents:: options to figure out how
-;;   deep to render the inserted TOC.
-;; - On load, detect any existing TOCs and set the properties for links.
-;; - TOC insertion should have an option to add empty lines.
-;; - TOC insertion should deal with multiple lines.
-;; - There is a bug on redo after undo of adjust when rst-adjust-hook uses the
-;;   automatic toc update.  The cursor ends up in the TOC and this is
-;;   annoying.  Gotta fix that.
-;; - numbering: automatically detect if we have a section-numbering directive in
-;;   the corresponding section, to render the toc.
-;;
-;; bulleted and enumerated list items
-;; ----------------------------------
-;; - We need to provide way to rebullet bulleted lists, and that would include
-;;   automatic enumeration as well.
-;;
-;; Other
-;; -----
-;; - It would be nice to differentiate between text files using
-;;   reStructuredText_ and other general text files.  If we had a
-;;   function to automatically guess whether a .txt file is following the
-;;   reStructuredText_ conventions, we could trigger rst-mode without
-;;   having to hard-code this in every text file, nor forcing the user to
-;;   add a local mode variable at the top of the file.
-;;   We could perform this guessing by searching for a valid decoration
-;;   at the top of the document or searching for reStructuredText_
-;;   directives further on.
-;;
-;; - We should support imenu in our major mode, with the menu filled with the
-;;   section titles (this should be really easy).
-;;
-;; - We should rename "adornment" to "decoration" or vice-versa in this
-;;   document (Stefan's code ("adornment") vs Martin ("decoration")), maybe some
-;;   functions even overlap.
-;;
-;; - We need to automatically recenter on rst-forward-section movement commands.
+;;; Code:
 
+;; FIXME: When 24.1 is common place remove use of `lexical-let' and put "-*-
+;;        lexical-binding: t -*-" in the first line.
 
-;;; HISTORY
-;;
+;; Only use of macros is allowed - may be replaced by `cl-lib' some time.
+(eval-when-compile
+  (require 'cl))
 
-;;; Code:
+;; Redefine some functions from `cl.el' in a proper namespace until they may be
+;; used from there.
+
+(defun rst-signum (x)
+  "Return 1 if X is positive, -1 if negative, 0 if zero."
+  (cond
+   ((> x 0) 1)
+   ((< x 0) -1)
+   (t 0)))
+
+(defun rst-some (seq &optional pred)
+  "Return non-nil if any element of SEQ yields non-nil when PRED is applied.
+Apply PRED to each element of list SEQ until the first non-nil
+result is yielded and return this result. PRED defaults to
+`identity'."
+  (unless pred
+    (setq pred 'identity))
+  (catch 'rst-some
+    (dolist (elem seq)
+      (let ((r (funcall pred elem)))
+       (when r
+         (throw 'rst-some r))))))
+
+(defun rst-position-if (pred seq)
+  "Return position of first element satisfying PRED in list SEQ or nil."
+  (catch 'rst-position-if
+    (let ((i 0))
+      (dolist (elem seq)
+       (when (funcall pred elem)
+         (throw 'rst-position-if i))
+       (incf i)))))
+
+(defun rst-position (elem seq)
+  "Return position of ELEM in list SEQ or nil.
+Comparison done with `equal'."
+  ;; Create a closure containing `elem' so the `lambda' always sees our
+  ;; parameter instead of an `elem' which may be in dynamic scope at the time
+  ;; of execution of the `lambda'.
+  (lexical-let ((elem elem))
+    (rst-position-if (function (lambda (e)
+                                (equal elem e)))
+                    seq)))
+
+;; FIXME: Embed complicated `defconst's in `eval-when-compile'.
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Versions
+
+(defun rst-extract-version (delim-re head-re re tail-re var &optional default)
+  "Extract the version from a variable according to the given regexes.
+Return the version after regex DELIM-RE and HEAD-RE matching RE
+and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no match."
+  (if (string-match
+       (concat delim-re head-re "\\(" re "\\)" tail-re delim-re)
+       var)
+      (match-string 1 var)
+    default))
+
+;; Use CVSHeader to really get information from CVS and not other version
+;; control systems.
+(defconst rst-cvs-header
+  "$CVSHeader: sm/rst_el/rst.el,v 1.287 2012-06-16 09:41:47 stefan Exp $")
+(defconst rst-cvs-rev
+  (rst-extract-version "\\$" "CVSHeader: \\S + " "[0-9]+\\(?:\\.[0-9]+\\)+"
+                      " .*" rst-cvs-header "0.0")
+  "The CVS revision of this file.  CVS revision is the development revision.")
+(defconst rst-cvs-timestamp
+  (rst-extract-version "\\$" "CVSHeader: \\S + \\S + "
+                      "[0-9]+-[0-9]+-[0-9]+ [0-9]+:[0-9]+:[0-9]+" " .*"
+                      rst-cvs-header "1970-01-01 00:00:00")
+  "The CVS time stamp of this file.")
+
+;; Use LastChanged... to really get information from SVN.
+(defconst rst-svn-rev
+  (rst-extract-version "\\$" "LastChangedRevision: " "[0-9]+" " "
+                      "$LastChangedRevision: 7444 $")
+  "The SVN revision of this file.
+SVN revision is the upstream (docutils) revision.")
+(defconst rst-svn-timestamp
+  (rst-extract-version "\\$" "LastChangedDate: " ".+?+" " "
+                      "$LastChangedDate: 2012-06-16 11:41:40 +0200 (Sat, 16 Jun 2012) $")
+  "The SVN time stamp of this file.")
+
+;; Maintained by the release process.
+(defconst rst-official-version
+  (rst-extract-version "%" "OfficialVersion: " "[0-9]+\\(?:\\.[0-9]+\\)+" " "
+                      "%OfficialVersion: 1.3.0 %")
+  "Official version of the package.")
+(defconst rst-official-cvs-rev
+  (rst-extract-version "[%$]" "Revision: " "[0-9]+\\(?:\\.[0-9]+\\)+" " "
+                      "%Revision: 1.287 %")
+  "CVS revision of this file in the official version.")
+
+(defconst rst-version
+  (if (equal rst-official-cvs-rev rst-cvs-rev)
+      rst-official-version
+    (format "%s (development %s [%s])" rst-official-version
+           rst-cvs-rev rst-cvs-timestamp))
+  "The version string.
+Starts with the current official version.  For developer versions
+in parentheses follows the development revision and the time stamp.")
+
+(defconst rst-package-emacs-version-alist
+  '(("1.0.0" . "24.2")
+    ("1.1.0" . "24.2")
+    ("1.2.0" . "24.2")
+    ("1.2.1" . "24.2")
+    ("1.3.0" . "24.2")))
+
+(unless (assoc rst-official-version rst-package-emacs-version-alist)
+  (error "Version %s not listed in `rst-package-emacs-version-alist'"
+        rst-version))
+
+(add-to-list 'customize-package-emacs-version-alist
+            (cons 'ReST rst-package-emacs-version-alist))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Initialize customization
 
 \f
 (defgroup rst nil "Support for reStructuredText documents."
   :version "23.1"
   :link '(url-link "http://docutils.sourceforge.net/rst.html"))
 
-
-
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Define some generic support functions.
-
-(eval-when-compile (require 'cl)) ;; We need this for destructuring-bind below.
-
-
-;; From Emacs-22
-(unless (fboundp 'line-number-at-pos)
-  (defun line-number-at-pos (&optional pos)
-    "Return (narrowed) buffer line number at position POS.
-    If POS is nil, use current buffer location."
-    (let ((opoint (or pos (point))) start)
-      (save-excursion
-       (goto-char (point-min))
-       (setq start (point))
-       (goto-char opoint)
-       (forward-line 0)
-       (1+ (count-lines start (point)))))) )
-
+;; Facilities for regular expressions used everywhere
+
+;; The trailing numbers in the names give the number of referenceable regex
+;; groups contained in the regex.
+
+;; Used to be customizable but really is not customizable but fixed by the reST
+;; syntax.
+(defconst rst-bullets
+  ;; Sorted so they can form a character class when concatenated.
+  '(?- ?* ?+ ?\u2022 ?\u2023 ?\u2043)
+  "List of all possible bullet characters for bulleted lists.")
+
+(defconst rst-uri-schemes
+  '("acap" "cid" "data" "dav" "fax" "file" "ftp" "gopher" "http" "https" "imap"
+    "ldap" "mailto" "mid" "modem" "news" "nfs" "nntp" "pop" "prospero" "rtsp"
+    "service" "sip" "tel" "telnet" "tip" "urn" "vemmi" "wais")
+  "Supported URI schemes.")
+
+(defconst rst-adornment-chars
+  ;; Sorted so they can form a character class when concatenated.
+  '(?\]
+    ?! ?\" ?# ?$ ?% ?& ?' ?\( ?\) ?* ?+ ?, ?. ?/ ?: ?\; ?< ?= ?> ?? ?@ ?\[ ?\\
+    ?^ ?_ ?` ?{ ?| ?} ?~
+    ?-)
+  "Characters which may be used in adornments for sections and transitions.")
+
+(defconst rst-max-inline-length
+  1000
+  "Maximum length of inline markup to recognize.")
+
+(defconst rst-re-alist-def
+  ;; `*-beg' matches * at the beginning of a line.
+  ;; `*-end' matches * at the end of a line.
+  ;; `*-prt' matches a part of *.
+  ;; `*-tag' matches *.
+  ;; `*-sta' matches the start of * which may be followed by respective content.
+  ;; `*-pfx' matches the delimiter left of *.
+  ;; `*-sfx' matches the delimiter right of *.
+  ;; `*-hlp' helper for *.
+  ;;
+  ;; A trailing number says how many referenceable groups are contained.
+  `(
+
+    ;; Horizontal white space (`hws')
+    (hws-prt "[\t ]")
+    (hws-tag hws-prt "*") ; Optional sequence of horizontal white space.
+    (hws-sta hws-prt "+") ; Mandatory sequence of horizontal white space.
+
+    ;; Lines (`lin')
+    (lin-beg "^" hws-tag) ; Beginning of a possibly indented line.
+    (lin-end hws-tag "$") ; End of a line with optional trailing white space.
+    (linemp-tag "^" hws-tag "$") ; Empty line with optional white space.
+
+    ;; Various tags and parts
+    (ell-tag "\\.\\.\\.") ; Ellipsis
+    (bul-tag ,(concat "[" rst-bullets "]")) ; A bullet.
+    (ltr-tag "[a-zA-Z]") ; A letter enumerator tag.
+    (num-prt "[0-9]") ; A number enumerator part.
+    (num-tag num-prt "+") ; A number enumerator tag.
+    (rom-prt "[IVXLCDMivxlcdm]") ; A roman enumerator part.
+    (rom-tag rom-prt "+") ; A roman enumerator tag.
+    (aut-tag "#") ; An automatic enumerator tag.
+    (dcl-tag "::") ; Double colon.
+
+    ;; Block lead in (`bli')
+    (bli-sfx (:alt hws-sta "$")) ; Suffix of a block lead-in with *optional*
+                                ; immediate content.
+
+    ;; Various starts
+    (bul-sta bul-tag bli-sfx) ; Start of a bulleted item.
+
+    ;; Explicit markup tag (`exm')
+    (exm-tag "\\.\\.")
+    (exm-sta exm-tag hws-sta)
+    (exm-beg lin-beg exm-sta)
+
+    ;; Counters in enumerations (`cnt')
+    (cntany-tag (:alt ltr-tag num-tag rom-tag aut-tag)) ; An arbitrary counter.
+    (cntexp-tag (:alt ltr-tag num-tag rom-tag)) ; An arbitrary explicit counter.
+
+    ;; Enumerator (`enm')
+    (enmany-tag (:alt
+                (:seq cntany-tag "\\.")
+                (:seq "(?" cntany-tag ")"))) ; An arbitrary enumerator.
+    (enmexp-tag (:alt
+                (:seq cntexp-tag "\\.")
+                (:seq "(?" cntexp-tag ")"))) ; An arbitrary explicit
+                                             ; enumerator.
+    (enmaut-tag (:alt
+                (:seq aut-tag "\\.")
+                (:seq "(?" aut-tag ")"))) ; An automatic enumerator.
+    (enmany-sta enmany-tag bli-sfx) ; An arbitrary enumerator start.
+    (enmexp-sta enmexp-tag bli-sfx) ; An arbitrary explicit enumerator start.
+    (enmexp-beg lin-beg enmexp-sta) ; An arbitrary explicit enumerator start
+                                   ; at the beginning of a line.
+
+    ;; Items may be enumerated or bulleted (`itm')
+    (itmany-tag (:alt enmany-tag bul-tag)) ; An arbitrary item tag.
+    (itmany-sta-1 (:grp itmany-tag) bli-sfx) ; An arbitrary item start, group
+                                            ; is the item tag.
+    (itmany-beg-1 lin-beg itmany-sta-1) ; An arbitrary item start at the
+                                       ; beginning of a line, group is the
+                                       ; item tag.
+
+    ;; Inline markup (`ilm')
+    (ilm-pfx (:alt "^" hws-prt "[-'\"([{<\u2018\u201c\u00ab\u2019/:]"))
+    (ilm-sfx (:alt "$" hws-prt "[]-'\")}>\u2019\u201d\u00bb/:.,;!?\\]"))
+
+    ;; Inline markup content (`ilc')
+    (ilcsgl-tag "\\S ") ; A single non-white character.
+    (ilcast-prt (:alt "[^*\\]" "\\\\.")) ; Part of non-asterisk content.
+    (ilcbkq-prt (:alt "[^`\\]" "\\\\.")) ; Part of non-backquote content.
+    (ilcbkqdef-prt (:alt "[^`\\\n]" "\\\\.")) ; Part of non-backquote
+                                             ; definition.
+    (ilcbar-prt (:alt "[^|\\]" "\\\\.")) ; Part of non-vertical-bar content.
+    (ilcbardef-prt (:alt "[^|\\\n]" "\\\\.")) ; Part of non-vertical-bar
+                                             ; definition.
+    (ilcast-sfx "[^\t *\\]") ; Suffix of non-asterisk content.
+    (ilcbkq-sfx "[^\t `\\]") ; Suffix of non-backquote content.
+    (ilcbar-sfx "[^\t |\\]") ; Suffix of non-vertical-bar content.
+    (ilcrep-hlp ,(format "\\{0,%d\\}" rst-max-inline-length)) ; Repeat count.
+    (ilcast-tag (:alt ilcsgl-tag
+                     (:seq ilcsgl-tag
+                           ilcast-prt ilcrep-hlp
+                           ilcast-sfx))) ; Non-asterisk content.
+    (ilcbkq-tag (:alt ilcsgl-tag
+                     (:seq ilcsgl-tag
+                           ilcbkq-prt ilcrep-hlp
+                           ilcbkq-sfx))) ; Non-backquote content.
+    (ilcbkqdef-tag (:alt ilcsgl-tag
+                        (:seq ilcsgl-tag
+                              ilcbkqdef-prt ilcrep-hlp
+                              ilcbkq-sfx))) ; Non-backquote definition.
+    (ilcbar-tag (:alt ilcsgl-tag
+                     (:seq ilcsgl-tag
+                           ilcbar-prt ilcrep-hlp
+                           ilcbar-sfx))) ; Non-vertical-bar content.
+    (ilcbardef-tag (:alt ilcsgl-tag
+                        (:seq ilcsgl-tag
+                              ilcbardef-prt ilcrep-hlp
+                              ilcbar-sfx))) ; Non-vertical-bar definition.
+
+    ;; Fields (`fld')
+    (fldnam-prt (:alt "[^:\n]" "\\\\:")) ; Part of a field name.
+    (fldnam-tag fldnam-prt "+") ; A field name.
+    (fld-tag ":" fldnam-tag ":") ; A field marker.
+
+    ;; Options (`opt')
+    (optsta-tag (:alt "[-+/]" "--")) ; Start of an option.
+    (optnam-tag "\\sw" (:alt "-" "\\sw") "*") ; Name of an option.
+    (optarg-tag (:shy "[ =]\\S +")) ; Option argument.
+    (optsep-tag (:shy "," hws-prt)) ; Separator between options.
+    (opt-tag (:shy optsta-tag optnam-tag optarg-tag "?")) ; A complete option.
+
+    ;; Footnotes and citations (`fnc')
+    (fncnam-prt "[^\]\n]") ; Part of a footnote or citation name.
+    (fncnam-tag fncnam-prt "+") ; A footnote or citation name.
+    (fnc-tag "\\[" fncnam-tag "]") ; A complete footnote or citation tag.
+    (fncdef-tag-2 (:grp exm-sta)
+                 (:grp fnc-tag)) ; A complete footnote or citation definition
+                                 ; tag.  First group is the explicit markup
+                                 ; start, second group is the footnote /
+                                 ; citation tag.
+    (fnc-sta-2 fncdef-tag-2 bli-sfx) ; Start of a footnote or citation
+                                    ; definition.  First group is the explicit
+                                    ; markup start, second group is the
+                                    ; footnote / citation tag.
+
+    ;; Substitutions (`sub')
+    (sub-tag "|" ilcbar-tag "|") ; A complete substitution tag.
+    (subdef-tag "|" ilcbardef-tag "|") ; A complete substitution definition
+                                      ; tag.
+
+    ;; Symbol (`sym')
+    (sym-prt "[-+.:_]") ; Non-word part of a symbol.
+    (sym-tag (:shy "\\sw+" (:shy sym-prt "\\sw+") "*"))
+
+    ;; URIs (`uri')
+    (uri-tag (:alt ,@rst-uri-schemes))
+
+    ;; Adornment (`ado')
+    (ado-prt "[" ,(concat rst-adornment-chars) "]")
+    (adorep3-hlp "\\{3,\\}") ; There must be at least 3 characters because
+                            ; otherwise explicit markup start would be
+                            ; recognized.
+    (adorep2-hlp "\\{2,\\}") ; As `adorep3-hlp' but when the first of three
+                            ; characters is matched differently.
+    (ado-tag-1-1 (:grp ado-prt)
+                "\\1" adorep2-hlp) ; A complete adornment, group is the first
+                                   ; adornment character and MUST be the FIRST
+                                   ; group in the whole expression.
+    (ado-tag-1-2 (:grp ado-prt)
+                "\\2" adorep2-hlp) ; A complete adornment, group is the first
+                                   ; adornment character and MUST be the
+                                   ; SECOND group in the whole expression.
+    (ado-beg-2-1 "^" (:grp ado-tag-1-2)
+                lin-end) ; A complete adornment line; first group is the whole
+                         ; adornment and MUST be the FIRST group in the whole
+                         ; expression; second group is the first adornment
+                         ; character.
+
+    ;; Titles (`ttl')
+    (ttl-tag "\\S *\\w\\S *") ; A title text.
+    (ttl-beg lin-beg ttl-tag) ; A title text at the beginning of a line.
+
+    ;; Directives and substitution definitions (`dir')
+    (dir-tag-3 (:grp exm-sta)
+              (:grp (:shy subdef-tag hws-sta) "?")
+              (:grp sym-tag dcl-tag)) ; A directive or substitution definition
+                                      ; tag.  First group is explicit markup
+                                      ; start, second group is a possibly
+                                      ; empty substitution tag, third group is
+                                      ; the directive tag including the double
+                                      ; colon.
+    (dir-sta-3 dir-tag-3 bli-sfx) ; Start of a directive or substitution
+                                 ; definition.  Groups are as in dir-tag-3.
+
+    ;; Literal block (`lit')
+    (lit-sta-2 (:grp (:alt "[^.\n]" "\\.[^.\n]") ".*") "?"
+              (:grp dcl-tag) "$") ; Start of a literal block.  First group is
+                                  ; any text before the double colon tag which
+                                  ; may not exist, second group is the double
+                                  ; colon tag.
+
+    ;; Comments (`cmt')
+    (cmt-sta-1 (:grp exm-sta) "[^\[|_\n]"
+              (:alt "[^:\n]" (:seq ":" (:alt "[^:\n]" "$")))
+              "*$") ; Start of a comment block; first group is explicit markup
+                    ; start.
+
+    ;; Paragraphs (`par')
+    (par-tag- (:alt itmany-tag fld-tag opt-tag fncdef-tag-2 dir-tag-3 exm-tag)
+             ) ; Tag at the beginning of a paragraph; there may be groups in
+               ; certain cases.
+    )
+  "Definition alist of relevant regexes.
+Each entry consists of the symbol naming the regex and an
+argument list for `rst-re'.")
+
+(defvar rst-re-alist) ; Forward declare to use it in `rst-re'.
+
+;; FIXME: Use `sregex` or `rx` instead of re-inventing the wheel.
+(defun rst-re (&rest args)
+  "Interpret ARGS as regular expressions and return a regex string.
+Each element of ARGS may be one of the following:
+
+A string which is inserted unchanged.
+
+A character which is resolved to a quoted regex.
+
+A symbol which is resolved to a string using `rst-re-alist-def'.
+
+A list with a keyword in the car.  Each element of the cdr of such
+a list is recursively interpreted as ARGS.  The results of this
+interpretation are concatenated according to the keyword.
+
+For the keyword `:seq' the results are simply concatenated.
+
+For the keyword `:shy' the results are concatenated and
+surrounded by a shy-group (\"\\(?:...\\)\").
+
+For the keyword `:alt' the results form an alternative (\"\\|\")
+which is shy-grouped (\"\\(?:...\\)\").
+
+For the keyword `:grp' the results are concatenated and form a
+referenceable group (\"\\(...\\)\").
+
+After interpretation of ARGS the results are concatenated as for
+`:seq'."
+  (apply 'concat
+        (mapcar
+         (lambda (re)
+           (cond
+            ((stringp re)
+             re)
+            ((symbolp re)
+             (cadr (assoc re rst-re-alist)))
+            ((characterp re)
+             (regexp-quote (char-to-string re)))
+            ((listp re)
+             (let ((nested
+                    (mapcar (lambda (elt)
+                              (rst-re elt))
+                            (cdr re))))
+               (cond
+                ((eq (car re) :seq)
+                 (mapconcat 'identity nested ""))
+                ((eq (car re) :shy)
+                 (concat "\\(?:" (mapconcat 'identity nested "") "\\)"))
+                ((eq (car re) :grp)
+                 (concat "\\(" (mapconcat 'identity nested "") "\\)"))
+                ((eq (car re) :alt)
+                 (concat "\\(?:" (mapconcat 'identity nested "\\|") "\\)"))
+                (t
+                 (error "Unknown list car: %s" (car re))))))
+            (t
+             (error "Unknown object type for building regex: %s" re))))
+         args)))
+
+;; FIXME: Remove circular dependency between `rst-re' and `rst-re-alist'.
+(with-no-warnings ; Silence byte-compiler about this construction.
+  (defconst rst-re-alist
+    ;; Shadow global value we are just defining so we can construct it step by
+    ;; step.
+    (let (rst-re-alist)
+      (dolist (re rst-re-alist-def rst-re-alist)
+       (setq rst-re-alist
+             (nconc rst-re-alist
+                    (list (list (car re) (apply 'rst-re (cdr re))))))))
+    "Alist mapping symbols from `rst-re-alist-def' to regex strings."))
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Mode definition.
+;; Mode definition
+
+(defun rst-define-key (keymap key def &rest deprecated)
+  "Bind like `define-key' but add deprecated key definitions.
+KEYMAP, KEY, and DEF are as in `define-key'.  DEPRECATED key
+definitions should be in vector notation.  These are defined as
+well but give an additional message."
+  (define-key keymap key def)
+  (dolist (dep-key deprecated)
+    (define-key keymap dep-key
+      `(lambda ()
+         ,(format "Deprecated binding for %s, use \\[%s] instead." def def)
+        (interactive)
+        (call-interactively ',def)
+        (message "[Deprecated use of key %s; use key %s instead]"
+                 (key-description (this-command-keys))
+                 (key-description ,key))))))
 
 ;; Key bindings.
 (defvar rst-mode-map
   (let ((map (make-sparse-keymap)))
 
+    ;; \C-c is the general keymap.
+    (rst-define-key map [?\C-c ?\C-h] 'describe-prefix-bindings)
+
     ;;
-    ;; Section Decorations.
+    ;; Section Adornments
     ;;
-    ;; The adjustment function that decorates or rotates a section title.
-    (define-key map [(control c) (control a)] 'rst-adjust)
-    (define-key map [(control c) (control ?=)] 'rst-adjust)
-    (define-key map [(control ?=)] 'rst-adjust) ;; (Does not work on the Mac OSX.)
-    ;; Display the hierarchy of decorations implied by the current document contents.
-    (define-key map [(control c) (control h)] 'rst-display-decorations-hierarchy)
-    ;; Homogenize the decorations in the document.
-    (define-key map [(control c) (control s)] 'rst-straighten-decorations)
-;;    (define-key map [(control c) (control s)] 'rst-straighten-deco-spacing)
+    ;; The adjustment function that adorns or rotates a section title.
+    (rst-define-key map [?\C-c ?\C-=] 'rst-adjust [?\C-c ?\C-a t])
+    (rst-define-key map [?\C-=] 'rst-adjust) ; (Does not work on the Mac OSX.)
+
+    ;; \C-c \C-a is the keymap for adornments.
+    (rst-define-key map [?\C-c ?\C-a ?\C-h] 'describe-prefix-bindings)
+    ;; Display the hierarchy of adornments implied by the current document
+    ;; contents.
+    (rst-define-key map [?\C-c ?\C-a ?\C-d] 'rst-display-adornments-hierarchy)
+    ;; Homogenize the adornments in the document.
+    (rst-define-key map [?\C-c ?\C-a ?\C-s] 'rst-straighten-adornments
+                   [?\C-c ?\C-s])
 
     ;;
-    ;; Section Movement and Selection.
+    ;; Section Movement and Selection
     ;;
     ;; Mark the subsection where the cursor is.
-    (define-key map [(control c) (control m)] 'rst-mark-section)
-    ;; Move forward/backward between section titles.
-    (define-key map [(control c) (control n)] 'rst-forward-section)
-    (define-key map [(control c) (control p)] 'rst-backward-section)
+    (rst-define-key map [?\C-\M-h] 'rst-mark-section
+                   ;; Same as mark-defun sgml-mark-current-element.
+                   [?\C-c ?\C-m])
+    ;; Move backward/forward between section titles.
+    ;; FIXME: Also bind similar to outline mode.
+    (rst-define-key map [?\C-\M-a] 'rst-backward-section
+                   ;; Same as beginning-of-defun.
+                   [?\C-c ?\C-n])
+    (rst-define-key map [?\C-\M-e] 'rst-forward-section
+                   ;; Same as end-of-defun.
+                   [?\C-c ?\C-p])
+
+    ;;
+    ;; Operating on regions
+    ;;
+    ;; \C-c \C-r is the keymap for regions.
+    (rst-define-key map [?\C-c ?\C-r ?\C-h] 'describe-prefix-bindings)
+    ;; Makes region a line-block.
+    (rst-define-key map [?\C-c ?\C-r ?\C-l] 'rst-line-block-region
+                   [?\C-c ?\C-d])
+    ;; Shift region left or right according to tabs.
+    (rst-define-key map [?\C-c ?\C-r tab] 'rst-shift-region
+                   [?\C-c ?\C-r t] [?\C-c ?\C-l t])
 
     ;;
-    ;; Operating on Blocks of Text.
+    ;; Operating on lists
     ;;
+    ;; \C-c \C-l is the keymap for lists.
+    (rst-define-key map [?\C-c ?\C-l ?\C-h] 'describe-prefix-bindings)
     ;; Makes paragraphs in region as a bullet list.
-    (define-key map [(control c) (control b)] 'rst-bullet-list-region)
+    (rst-define-key map [?\C-c ?\C-l ?\C-b] 'rst-bullet-list-region
+                   [?\C-c ?\C-b])
     ;; Makes paragraphs in region as a enumeration.
-    (define-key map [(control c) (control e)] 'rst-enumerate-region)
+    (rst-define-key map [?\C-c ?\C-l ?\C-e] 'rst-enumerate-region
+                   [?\C-c ?\C-e])
     ;; Converts bullets to an enumeration.
-    (define-key map [(control c) (control v)] 'rst-convert-bullets-to-enumeration)
-    ;; Makes region a line-block.
-    (define-key map [(control c) (control d)] 'rst-line-block-region)
+    (rst-define-key map [?\C-c ?\C-l ?\C-c] 'rst-convert-bullets-to-enumeration
+                   [?\C-c ?\C-v])
     ;; Make sure that all the bullets in the region are consistent.
-    (define-key map [(control c) (control w)] 'rst-straighten-bullets-region)
-    ;; Shift region left or right (taking into account of enumerations/bullets, etc.).
-    (define-key map [(control c) (control l)] 'rst-shift-region-left)
-    (define-key map [(control c) (control r)] 'rst-shift-region-right)
-    ;; Comment/uncomment the active region.
-    (define-key map [(control c) (control c)] 'comment-region)
+    (rst-define-key map [?\C-c ?\C-l ?\C-s] 'rst-straighten-bullets-region
+                   [?\C-c ?\C-w])
+    ;; Insert a list item.
+    (rst-define-key map [?\C-c ?\C-l ?\C-i] 'rst-insert-list)
 
     ;;
-    ;; Table-of-Contents Features.
+    ;; Table-of-Contents Features
     ;;
+    ;; \C-c \C-t is the keymap for table of contents.
+    (rst-define-key map [?\C-c ?\C-t ?\C-h] 'describe-prefix-bindings)
     ;; Enter a TOC buffer to view and move to a specific section.
-    (define-key map [(control c) (control t)] 'rst-toc)
+    (rst-define-key map [?\C-c ?\C-t ?\C-t] 'rst-toc)
     ;; Insert a TOC here.
-    (define-key map [(control c) (control i)] 'rst-toc-insert)
+    (rst-define-key map [?\C-c ?\C-t ?\C-i] 'rst-toc-insert
+                   [?\C-c ?\C-i])
     ;; Update the document's TOC (without changing the cursor position).
-    (define-key map [(control c) (control u)] 'rst-toc-update)
-    ;; Got to the section under the cursor (cursor must be in TOC).
-    (define-key map [(control c) (control f)] 'rst-goto-section)
+    (rst-define-key map [?\C-c ?\C-t ?\C-u] 'rst-toc-update
+                   [?\C-c ?\C-u])
+    ;; Go to the section under the cursor (cursor must be in TOC).
+    (rst-define-key map [?\C-c ?\C-t ?\C-j] 'rst-goto-section
+                   [?\C-c ?\C-f])
 
     ;;
-    ;; Converting Documents from Emacs.
+    ;; Converting Documents from Emacs
     ;;
+    ;; \C-c \C-c is the keymap for compilation.
+    (rst-define-key map [?\C-c ?\C-c ?\C-h] 'describe-prefix-bindings)
     ;; Run one of two pre-configured toolset commands on the document.
-    (define-key map [(control c) (?1)] 'rst-compile)
-    (define-key map [(control c) (?2)] 'rst-compile-alt-toolset)
+    (rst-define-key map [?\C-c ?\C-c ?\C-c] 'rst-compile
+                   [?\C-c ?1])
+    (rst-define-key map [?\C-c ?\C-c ?\C-a] 'rst-compile-alt-toolset
+                   [?\C-c ?2])
     ;; Convert the active region to pseudo-xml using the docutils tools.
-    (define-key map [(control c) (?3)] 'rst-compile-pseudo-region)
+    (rst-define-key map [?\C-c ?\C-c ?\C-x] 'rst-compile-pseudo-region
+                   [?\C-c ?3])
     ;; Convert the current document to PDF and launch a viewer on the results.
-    (define-key map [(control c) (?4)] 'rst-compile-pdf-preview)
+    (rst-define-key map [?\C-c ?\C-c ?\C-p] 'rst-compile-pdf-preview
+                   [?\C-c ?4])
     ;; Convert the current document to S5 slides and view in a web browser.
-    (define-key map [(control c) (?5)] 'rst-compile-slides-preview)
+    (rst-define-key map [?\C-c ?\C-c ?\C-s] 'rst-compile-slides-preview
+                   [?\C-c ?5])
 
     map)
   "Keymap for reStructuredText mode commands.
@@ -306,8 +682,6 @@ This inherits from Text mode.")
 
 
 ;; Abbrevs.
-(defvar rst-mode-abbrev-table nil
-  "Abbrev table used while in Rst mode.")
 (define-abbrev-table 'rst-mode-abbrev-table
   (mapcar (lambda (x) (append x '(nil 0 system)))
           '(("contents" ".. contents::\n..\n   ")
@@ -316,49 +690,46 @@ This inherits from Text mode.")
             ("skip" "\n\n[...]\n\n  ")
             ("seq" "\n\n[...]\n\n  ")
             ;; FIXME: Add footnotes, links, and more.
-            )))
+            ))
+  "Abbrev table used while in `rst-mode'.")
 
 
 ;; Syntax table.
 (defvar rst-mode-syntax-table
   (let ((st (copy-syntax-table text-mode-syntax-table)))
-
     (modify-syntax-entry ?$ "." st)
     (modify-syntax-entry ?% "." st)
     (modify-syntax-entry ?& "." st)
     (modify-syntax-entry ?' "." st)
     (modify-syntax-entry ?* "." st)
     (modify-syntax-entry ?+ "." st)
-    (modify-syntax-entry ?. "_" st)
+    (modify-syntax-entry ?- "." st)
     (modify-syntax-entry ?/ "." st)
     (modify-syntax-entry ?< "." st)
     (modify-syntax-entry ?= "." st)
     (modify-syntax-entry ?> "." st)
     (modify-syntax-entry ?\\ "\\" st)
-    (modify-syntax-entry ?| "." st)
     (modify-syntax-entry ?_ "." st)
+    (modify-syntax-entry ?| "." st)
+    (modify-syntax-entry ?\u00ab "." st)
+    (modify-syntax-entry ?\u00bb "." st)
+    (modify-syntax-entry ?\u2018 "." st)
+    (modify-syntax-entry ?\u2019 "." st)
+    (modify-syntax-entry ?\u201c "." st)
+    (modify-syntax-entry ?\u201d "." st)
 
     st)
   "Syntax table used while in `rst-mode'.")
 
 
 (defcustom rst-mode-hook nil
-  "Hook run when Rst mode is turned on.
-The hook for Text mode is run before this one."
+  "Hook run when `rst-mode' is turned on.
+The hook for `text-mode' is run before this one."
   :group 'rst
   :type '(hook))
 
-
-(defcustom rst-mode-lazy t
-  "If non-nil Rst mode tries to font-lock multi-line elements correctly.
-Because this is really slow it should be set to nil if neither `jit-lock-mode'
-not `lazy-lock-mode' and activated.
-
-If nil, comments and literal blocks are font-locked only on the line they start.
-
-The value of this variable is used when Rst mode is turned on."
-  :group 'rst
-  :type '(boolean))
+;; Pull in variable definitions silencing byte-compiler.
+(require 'newcomment)
 
 ;; Use rst-mode for *.rst and *.rest files.  Many ReStructured-Text files
 ;; use *.txt, but this is too generic to be set as a default.
@@ -367,78 +738,70 @@ The value of this variable is used when Rst mode is turned on."
 (define-derived-mode rst-mode text-mode "ReST"
   "Major mode for editing reStructuredText documents.
 \\<rst-mode-map>
-There are a number of convenient keybindings provided by
-Rst mode.  The main one is \\[rst-adjust], it updates or rotates
-the section title around point or promotes/demotes the
-decorations within the region (see full details below).
-Use negative prefix arg to rotate in the other direction.
 
 Turning on `rst-mode' calls the normal hooks `text-mode-hook'
 and `rst-mode-hook'.  This mode also supports font-lock
-highlighting.  You may customize `rst-mode-lazy' to toggle
-font-locking of blocks.
+highlighting.
 
 \\{rst-mode-map}"
   :abbrev-table rst-mode-abbrev-table
   :syntax-table rst-mode-syntax-table
   :group 'rst
 
-  (set (make-local-variable 'paragraph-separate) paragraph-start)
-  (set (make-local-variable 'indent-line-function) 'indent-relative-maybe)
+  ;; Paragraph recognition.
+  (set (make-local-variable 'paragraph-separate)
+       (rst-re '(:alt
+                "\f"
+                lin-end)))
   (set (make-local-variable 'paragraph-start)
-       "\f\\|>*[ \t]*$\\|>*[ \t]*[-+*] \\|>*[ \t]*[0-9#]+\\. ")
-  (set (make-local-variable 'adaptive-fill-mode) t)
+       (rst-re '(:alt
+                "\f"
+                lin-end
+                (:seq hws-tag par-tag- bli-sfx))))
 
-  ;; FIXME: No need to reset this.
-  ;; (set (make-local-variable 'indent-line-function) 'indent-relative)
+  ;; Indenting and filling.
+  (set (make-local-variable 'indent-line-function) 'rst-indent-line)
+  (set (make-local-variable 'adaptive-fill-mode) t)
+  (set (make-local-variable 'adaptive-fill-regexp)
+       (rst-re 'hws-tag 'par-tag- "?" 'hws-tag))
+  (set (make-local-variable 'adaptive-fill-function) 'rst-adaptive-fill)
+  (set (make-local-variable 'fill-paragraph-handle-comment) nil)
 
-  ;; The details of the following comment setup is important because it affects
-  ;; auto-fill, and it is pretty common in running text to have an ellipsis
-  ;; ("...") which trips because of the rest comment syntax (".. ").
+  ;; Comments.
   (set (make-local-variable 'comment-start) ".. ")
-  (set (make-local-variable 'comment-start-skip) "^\\.\\. ")
-  (set (make-local-variable 'comment-multi-line) nil)
-
-  ;; Special variables
-  (make-local-variable 'rst-adornment-level-alist)
-
-  ;; Font lock
+  (set (make-local-variable 'comment-start-skip)
+       (rst-re 'lin-beg 'exm-tag 'bli-sfx))
+  (set (make-local-variable 'comment-continue) "   ")
+  (set (make-local-variable 'comment-multi-line) t)
+  (set (make-local-variable 'comment-use-syntax) nil)
+  ;; reStructuredText has not really a comment ender but nil is not really a
+  ;; permissible value.
+  (set (make-local-variable 'comment-end) "")
+  (set (make-local-variable 'comment-end-skip) nil)
+
+  ;; Commenting in reStructuredText is very special so use our own set of
+  ;; functions.
+  (set (make-local-variable 'comment-line-break-function)
+       'rst-comment-line-break)
+  (set (make-local-variable 'comment-indent-function)
+       'rst-comment-indent)
+  (set (make-local-variable 'comment-insert-comment-function)
+       'rst-comment-insert-comment)
+  (set (make-local-variable 'comment-region-function)
+       'rst-comment-region)
+  (set (make-local-variable 'uncomment-region-function)
+       'rst-uncomment-region)
+
+  ;; Font lock.
   (set (make-local-variable 'font-lock-defaults)
-       '(rst-font-lock-keywords-function
+       '(rst-font-lock-keywords
         t nil nil nil
+        (font-lock-multiline . t)
         (font-lock-mark-block-function . mark-paragraph)))
-  ;; `jit-lock-mode' has been the default since Emacs-21.1, so there's no
-  ;; point messing around with font-lock-support-mode any more.
-  ;; (when (boundp 'font-lock-support-mode)
-  ;;   ;; rst-mode has its own mind about font-lock-support-mode
-  ;;   (make-local-variable 'font-lock-support-mode)
-  ;;   ;; jit-lock-mode replaced lazy-lock-mode in GNU Emacs 21.
-  ;;   (let ((jit-or-lazy-lock-mode
-  ;;          (cond
-  ;;           ((fboundp 'lazy-lock-mode) 'lazy-lock-mode)
-  ;;           ((fboundp 'jit-lock-mode) 'jit-lock-mode)
-  ;;           ;; if neither lazy-lock nor jit-lock is supported,
-  ;;           ;; tell user and disable rst-mode-lazy
-  ;;           (t (when rst-mode-lazy
-  ;;                (message "Disabled lazy fontification, because no known support mode found.")
-  ;;                (setq rst-mode-lazy nil))))))
-  ;;     (cond
-  ;;      ((and (not rst-mode-lazy) (not font-lock-support-mode)))
-  ;;      ;; No support mode set and none required - leave it alone
-  ;;      ((or (not font-lock-support-mode) ;; No support mode set (but required)
-  ;;           (symbolp font-lock-support-mode)) ;; or a fixed mode for all
-  ;;       (setq font-lock-support-mode
-  ;;             (list (cons 'rst-mode (and rst-mode-lazy jit-or-lazy-lock-mode))
-  ;;               (cons t font-lock-support-mode))))
-  ;;      ((and (listp font-lock-support-mode)
-  ;;            (not (assoc 'rst-mode font-lock-support-mode)))
-  ;;       ;; A list of modes missing rst-mode
-  ;;       (setq font-lock-support-mode
-  ;;             (cons (cons 'rst-mode (and rst-mode-lazy jit-or-lazy-lock-mode))
-  ;;               font-lock-support-mode))))))
-
-  )
+  (add-hook 'font-lock-extend-region-functions 'rst-font-lock-extend-region t)
 
+  ;; Text after a changed line may need new fontification.
+  (set (make-local-variable 'jit-lock-contextually) t))
 
 ;;;###autoload
 (define-minor-mode rst-minor-mode
@@ -459,34 +822,22 @@ for modes derived from Text mode, like Mail mode."
  :group 'rst)
 
 ;; FIXME: can I somehow install these too?
-;;  :abbrev-table rst-mode-abbrev-table
-;;  :syntax-table rst-mode-syntax-table
-
-
-
-
-\f
-;; Bulleted item lists.
-(defcustom rst-bullets
-  '(?- ?* ?+)
-  "List of all possible bullet characters for bulleted lists."
-  :group 'rst)
-
-
+;;        :abbrev-table rst-mode-abbrev-table
+;;        :syntax-table rst-mode-syntax-table
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Section Decoration Adjustment
-;; =============================
+;; Section Adornment Adjustment
+;; ============================
 ;;
 ;; The following functions implement a smart automatic title sectioning feature.
 ;; The idea is that with the cursor sitting on a section title, we try to get as
 ;; much information from context and try to do the best thing automatically.
 ;; This function can be invoked many times and/or with prefix argument to rotate
-;; between the various sectioning decorations.
+;; between the various sectioning adornments.
 ;;
 ;; Definitions: the two forms of sectioning define semantically separate section
-;; levels.  A sectioning DECORATION consists in:
+;; levels.  A sectioning ADORNMENT consists in:
 ;;
 ;;   - a CHARACTER
 ;;
@@ -496,10 +847,7 @@ for modes derived from Text mode, like Mail mode."
 ;;     how many characters and over-and-under style is hanging outside of the
 ;;     title at the beginning and ending.
 ;;
-;; Important note: an existing decoration must be formed by at least two
-;; characters to be recognized.
-;;
-;; Here are two examples of decorations (| represents the window border, column
+;; Here are two examples of adornments (| represents the window border, column
 ;; 0):
 ;;
 ;;                                  |
@@ -516,17 +864,15 @@ for modes derived from Text mode, like Mail mode."
 ;; - The underlining character that is used depends on context. The file is
 ;;   scanned to find other sections and an appropriate character is selected.
 ;;   If the function is invoked on a section that is complete, the character is
-;;   rotated among the existing section decorations.
+;;   rotated among the existing section adornments.
 ;;
 ;;   Note that when rotating the characters, if we come to the end of the
-;;   hierarchy of decorations, the variable rst-preferred-decorations is
-;;   consulted to propose a new underline decoration, and if continued, we cycle
-;;   the decorations all over again.  Set this variable to nil if you want to
-;;   limit the underlining character propositions to the existing decorations in
+;;   hierarchy of adornments, the variable rst-preferred-adornments is
+;;   consulted to propose a new underline adornment, and if continued, we cycle
+;;   the adornments all over again.  Set this variable to nil if you want to
+;;   limit the underlining character propositions to the existing adornments in
 ;;   the file.
 ;;
-;; - A prefix argument can be used to alternate the style.
-;;
 ;; - An underline/overline that is not extended to the column at which it should
 ;;   be hanging is dubbed INCOMPLETE.  For example::
 ;;
@@ -547,128 +893,108 @@ for modes derived from Text mode, like Mail mode."
 ;;
 ;; In over-and-under style, when alternating the style, a variable is
 ;; available to select how much default indent to use (it can be zero).  Note
-;; that if the current section decoration already has an indent, we don't
+;; that if the current section adornment already has an indent, we don't
 ;; adjust it to the default, we rather use the current indent that is already
 ;; there for adjustment (unless we cycle, in which case we use the indent
 ;; that has been found previously).
 
 (defgroup rst-adjust nil
-  "Settings for adjustment and cycling of section title decorations."
+  "Settings for adjustment and cycling of section title adornments."
   :group 'rst
   :version "21.1")
 
-(defcustom rst-preferred-decorations '( (?= over-and-under 1)
-                                         (?= simple 0)
-                                         (?- simple 0)
-                                         (?~ simple 0)
-                                         (?+ simple 0)
-                                         (?` simple 0)
-                                         (?# simple 0)
-                                         (?@ simple 0) )
-  "Preferred ordering of section title decorations.
-
-This sequence is consulted to offer a new decoration suggestion
+(define-obsolete-variable-alias
+  'rst-preferred-decorations 'rst-preferred-adornments "1.0.0")
+(defcustom rst-preferred-adornments '((?= over-and-under 1)
+                                     (?= simple 0)
+                                     (?- simple 0)
+                                     (?~ simple 0)
+                                     (?+ simple 0)
+                                     (?` simple 0)
+                                     (?# simple 0)
+                                     (?@ simple 0))
+  "Preferred hierarchy of section title adornments.
+
+A list consisting of lists of the form (CHARACTER STYLE INDENT).
+CHARACTER is the character used.  STYLE is one of the symbols
+OVER-AND-UNDER or SIMPLE.  INDENT is an integer giving the wanted
+indentation for STYLE OVER-AND-UNDER.  CHARACTER and STYLE are
+always used when a section adornment is described.  In other
+places t instead of a list stands for a transition.
+
+This sequence is consulted to offer a new adornment suggestion
 when we rotate the underlines at the end of the existing
 hierarchy of characters, or when there is no existing section
-title in the file."
-  :group 'rst-adjust)
-
+title in the file.
+
+Set this to an empty list to use only the adornment found in the
+file."
+  :group 'rst-adjust
+  :type `(repeat
+         (group :tag "Adornment specification"
+                (choice :tag "Adornment character"
+                        ,@(mapcar (lambda (char)
+                                    (list 'const
+                                          :tag (char-to-string char) char))
+                                  rst-adornment-chars))
+                (radio :tag "Adornment type"
+                       (const :tag "Overline and underline" over-and-under)
+                       (const :tag "Underline only" simple))
+                (integer :tag "Indentation for overline and underline type"
+                         :value 0))))
 
 (defcustom rst-default-indent 1
   "Number of characters to indent the section title.
 
-This is used for when toggling decoration styles, when switching
-from a simple decoration style to a over-and-under decoration
+This is used for when toggling adornment styles, when switching
+from a simple adornment style to a over-and-under adornment
 style."
-  :group 'rst-adjust)
+  :group 'rst-adjust
+  :type '(integer))
 
 
-(defvar rst-section-text-regexp "^[ \t]*\\S-*\\w\\S-*"
-  "Regular expression for valid section title text.")
-
-
-(defun rst-line-homogeneous-p (&optional accept-special)
-  "Return true if the line is homogeneous.
-
-Predicate that returns the unique char if the current line is
-composed only of a single repeated non-whitespace character.
-This returns the char even if there is whitespace at the
-beginning of the line.
-
-If ACCEPT-SPECIAL is specified we do not ignore special sequences
-which normally we would ignore when doing a search on many lines.
-For example, normally we have cases to ignore commonly occurring
-patterns, such as :: or ...; with the flag do not ignore them."
-  (save-excursion
-    (back-to-indentation)
-    (unless (looking-at "\n")
-      (let ((c (thing-at-point 'char)))
-       (if (and (looking-at (format "[%s]+[ \t]*$" c))
-                (or accept-special
-                    (and
-                     ;; Common patterns.
-                     (not (looking-at "::[ \t]*$"))
-                     (not (looking-at "\\.\\.\\.[ \t]*$"))
-                     ;; Discard one char line
-                     (not (looking-at ".[ \t]*$"))
-                     )))
-           (string-to-char c))
-       ))
-    ))
-
-(defun rst-line-homogeneous-nodent-p (&optional accept-special)
-  "Return true if the line is homogeneous with no indent.
-See `rst-line-homogeneous-p' about ACCEPT-SPECIAL."
-  (save-excursion
-    (beginning-of-line)
-    (if (looking-at "^[ \t]+")
-        nil
-      (rst-line-homogeneous-p accept-special)
-      )))
-
-
-(defun rst-compare-decorations (deco1 deco2)
-  "Compare decorations.
-Return true if both DECO1 and DECO2 decorations are equal,
+(defun rst-compare-adornments (ado1 ado2)
+  "Compare adornments.
+Return true if both ADO1 and ADO2 adornments are equal,
 according to restructured text semantics (only the character and
 the style are compared, the indentation does not matter)."
-  (and (eq (car deco1) (car deco2))
-       (eq (cadr deco1) (cadr deco2))))
+  (and (eq (car ado1) (car ado2))
+       (eq (cadr ado1) (cadr ado2))))
 
 
-(defun rst-get-decoration-match (hier deco)
-  "Return the index (level) in hierarchy HIER of decoration DECO.
+(defun rst-get-adornment-match (hier ado)
+  "Return the index (level) in hierarchy HIER of adornment ADO.
 This basically just searches for the item using the appropriate
 comparison and returns the index.  Return nil if the item is
 not found."
   (let ((cur hier))
-    (while (and cur (not (rst-compare-decorations (car cur) deco)))
+    (while (and cur (not (rst-compare-adornments (car cur) ado)))
       (setq cur (cdr cur)))
     cur))
 
 
-(defun rst-suggest-new-decoration (alldecos &optional prev)
-  "Suggest a new, different decoration from all that have been seen.
+(defun rst-suggest-new-adornment (allados &optional prev)
+  "Suggest a new, different adornment from all that have been seen.
 
-ALLDECOS is the set of all decorations, including the line numbers.
-PREV is the optional previous decoration, in order to suggest a
+ALLADOS is the set of all adornments, including the line numbers.
+PREV is the optional previous adornment, in order to suggest a
 better match."
 
-  ;; For all the preferred decorations...
+  ;; For all the preferred adornments...
   (let* (
          ;; If 'prev' is given, reorder the list to start searching after the
          ;; match.
          (fplist
-          (cdr (rst-get-decoration-match rst-preferred-decorations prev)))
+          (cdr (rst-get-adornment-match rst-preferred-adornments prev)))
 
          ;; List of candidates to search.
-         (curpotential (append fplist rst-preferred-decorations)))
+         (curpotential (append fplist rst-preferred-adornments)))
     (while
-        ;; For all the decorations...
-        (let ((cur alldecos)
+        ;; For all the adornments...
+        (let ((cur allados)
               found)
           (while (and cur (not found))
-            (if (rst-compare-decorations (car cur) (car curpotential))
+            (if (rst-compare-adornments (car cur) (car curpotential))
                 ;; Found it!
                 (setq found (car curpotential))
               (setq cur (cdr cur))))
@@ -684,7 +1010,7 @@ better match."
                  (line-beginning-position 2)))
 
 (defun rst-update-section (char style &optional indent)
-  "Unconditionally update the style of a section decoration.
+  "Unconditionally update the style of a section adornment.
 
 Do this using the given character CHAR, with STYLE 'simple
 or 'over-and-under, and with indent INDENT.  If the STYLE
@@ -692,15 +1018,13 @@ is 'simple, whitespace before the title is removed (indent
 is always assumed to be 0).
 
 If there are existing overline and/or underline from the
-existing decoration, they are removed before adding the
-requested decoration."
-
-  (interactive)
-      (end-of-line)
+existing adornment, they are removed before adding the
+requested adornment."
+  (end-of-line)
   (let ((marker (point-marker))
         len)
 
-      ;; Fixup whitespace at the beginning and end of the line
+      ;; Fixup whitespace at the beginning and end of the line.
       (if (or (null indent) (eq style 'simple))
           (setq indent 0))
       (beginning-of-line)
@@ -710,37 +1034,36 @@ requested decoration."
       (end-of-line)
       (delete-horizontal-space)
 
-      ;; Set the current column, we're at the end of the title line
+      ;; Set the current column, we're at the end of the title line.
       (setq len (+ (current-column) indent))
 
-      ;; Remove previous line if it consists only of a single repeated character
+      ;; Remove previous line if it is an adornment.
       (save-excursion
         (forward-line -1)
-        (and (rst-line-homogeneous-p 1)
-             ;; Avoid removing the underline of a title right above us.
-             (save-excursion (forward-line -1)
-                             (not (looking-at rst-section-text-regexp)))
-             (rst-delete-entire-line)))
-
-      ;; Remove following line if it consists only of a single repeated
-      ;; character
+       (if (and (looking-at (rst-re 'ado-beg-2-1))
+                ;; Avoid removing the underline of a title right above us.
+                (save-excursion (forward-line -1)
+                                (not (looking-at (rst-re 'ttl-beg)))))
+           (rst-delete-entire-line)))
+
+      ;; Remove following line if it is an adornment.
       (save-excursion
         (forward-line +1)
-        (and (rst-line-homogeneous-p 1)
-             (rst-delete-entire-line))
+        (if (looking-at (rst-re 'ado-beg-2-1))
+           (rst-delete-entire-line))
         ;; Add a newline if we're at the end of the buffer, for the subsequence
-        ;; inserting of the underline
+        ;; inserting of the underline.
         (if (= (point) (buffer-end 1))
             (newline 1)))
 
-      ;; Insert overline
+      ;; Insert overline.
       (if (eq style 'over-and-under)
           (save-excursion
             (beginning-of-line)
             (open-line 1)
             (insert (make-string len char))))
 
-      ;; Insert underline
+      ;; Insert underline.
       (forward-line +1)
       (open-line 1)
       (insert (make-string len char))
@@ -749,186 +1072,277 @@ requested decoration."
       (goto-char marker)
       ))
 
+(defun rst-classify-adornment (adornment end)
+  "Classify adornment for section titles and transitions.
+ADORNMENT is the complete adornment string as found in the buffer
+with optional trailing whitespace.  END is the point after the
+last character of ADORNMENT.
 
-(defun rst-normalize-cursor-position ()
-  "Normalize the cursor position.
-If the cursor is on a decoration line or an empty line , place it
-on the section title line (at the end).  Returns the line offset
-by which the cursor was moved.  This works both over or under a
-line."
-  (if (save-excursion (beginning-of-line)
-                      (or (rst-line-homogeneous-p 1)
-                          (looking-at "^[ \t]*$")))
-      (progn
-        (beginning-of-line)
-        (cond
-         ((save-excursion (forward-line -1)
-                          (beginning-of-line)
-                          (and (looking-at rst-section-text-regexp)
-                               (not (rst-line-homogeneous-p 1))))
-          (progn (forward-line -1) -1))
-         ((save-excursion (forward-line +1)
-                          (beginning-of-line)
-                          (and (looking-at rst-section-text-regexp)
-                               (not (rst-line-homogeneous-p 1))))
-          (progn (forward-line +1) +1))
-         (t 0)))
-    0 ))
-
-
-(defun rst-find-all-decorations ()
-  "Find all the decorations in the file.
-Return a list of (line, decoration) pairs.  Each decoration
-consists in a (char, style, indent) triple.
-
-This function does not detect the hierarchy of decorations, it
-just finds all of them in a file.  You can then invoke another
-function to remove redundancies and inconsistencies."
-
-  (let ((positions ())
-        (curline 1))
-    ;; Iterate over all the section titles/decorations in the file.
-    (save-excursion
-      (goto-char (point-min))
-      (while (< (point) (buffer-end 1))
-        (if (rst-line-homogeneous-nodent-p)
-            (progn
-              (setq curline (+ curline (rst-normalize-cursor-position)))
-
-              ;; Here we have found a potential site for a decoration,
-              ;; characterize it.
-              (let ((deco (rst-get-decoration)))
-                (if (cadr deco) ;; Style is existing.
-                    ;; Found a real decoration site.
-                    (progn
-                      (push (cons curline deco) positions)
-                      ;; Push beyond the underline.
-                      (forward-line 1)
-                      (setq curline (+ curline 1))
-                      )))
-              ))
-        (forward-line 1)
-        (setq curline (+ curline 1))
-        ))
-    (reverse positions)))
+Return a list.  The first entry is t for a transition or a
+cons (CHARACTER . STYLE).  Check `rst-preferred-adornments' for
+the meaning of CHARACTER and STYLE.
 
+The remaining list forms four match groups as returned by
+`match-data'.  Match group 0 matches the whole construct.  Match
+group 1 matches the overline adornment if present.  Match group 2
+matches the section title text or the transition.  Match group 3
+matches the underline adornment.
 
-(defun rst-infer-hierarchy (decorations)
-  "Build a hierarchy of decorations using the list of given DECORATIONS.
-
-This function expects a list of (char, style, indent) decoration
+Return nil if no syntactically valid adornment is found."
+  (save-excursion
+    (save-match-data
+      (when (string-match (rst-re 'ado-beg-2-1) adornment)
+       (goto-char end)
+       (let* ((ado-ch (string-to-char (match-string 2 adornment)))
+              (ado-re (rst-re ado-ch 'adorep3-hlp))
+              (end-pnt (point))
+              (beg-pnt (progn
+                         (forward-line 0)
+                         (point)))
+              (nxt-emp ; Next line nonexistent or empty
+               (save-excursion
+                 (or (not (zerop (forward-line 1)))
+                     (looking-at (rst-re 'lin-end)))))
+              (prv-emp ; Previous line nonexistent or empty
+               (save-excursion
+                 (or (not (zerop (forward-line -1)))
+                     (looking-at (rst-re 'lin-end)))))
+              (ttl-blw ; Title found below starting here.
+               (save-excursion
+                 (and
+                  (zerop (forward-line 1))
+                  (looking-at (rst-re 'ttl-beg))
+                  (point))))
+              (ttl-abv ; Title found above starting here.
+               (save-excursion
+                 (and
+                  (zerop (forward-line -1))
+                  (looking-at (rst-re 'ttl-beg))
+                  (point))))
+              (und-fnd ; Matching underline found starting here.
+               (save-excursion
+                 (and ttl-blw
+                  (zerop (forward-line 2))
+                  (looking-at (rst-re ado-re 'lin-end))
+                  (point))))
+              (ovr-fnd ; Matching overline found starting here.
+               (save-excursion
+                 (and ttl-abv
+                  (zerop (forward-line -2))
+                  (looking-at (rst-re ado-re 'lin-end))
+                  (point))))
+              key beg-ovr end-ovr beg-txt end-txt beg-und end-und)
+         (cond
+          ((and nxt-emp prv-emp)
+           ;; A transition.
+           (setq key t
+                 beg-txt beg-pnt
+                 end-txt end-pnt))
+          ((or und-fnd ovr-fnd)
+           ;; An overline with an underline.
+           (setq key (cons ado-ch 'over-and-under))
+           (let (;; Prefer overline match over underline match.
+                 (und-pnt (if ovr-fnd beg-pnt und-fnd))
+                 (ovr-pnt (if ovr-fnd ovr-fnd beg-pnt))
+                 (txt-pnt (if ovr-fnd ttl-abv ttl-blw)))
+             (goto-char ovr-pnt)
+             (setq beg-ovr (point)
+                   end-ovr (line-end-position))
+             (goto-char txt-pnt)
+             (setq beg-txt (point)
+                   end-txt (line-end-position))
+             (goto-char und-pnt)
+             (setq beg-und (point)
+                   end-und (line-end-position))))
+          (ttl-abv
+           ;; An underline.
+           (setq key (cons ado-ch 'simple)
+                 beg-und beg-pnt
+                 end-und end-pnt)
+           (goto-char ttl-abv)
+           (setq beg-txt (point)
+                 end-txt (line-end-position)))
+          (t
+           ;; Invalid adornment.
+           (setq key nil)))
+         (if key
+             (list key
+                   (or beg-ovr beg-txt beg-und)
+                   (or end-und end-txt end-ovr)
+                   beg-ovr end-ovr beg-txt end-txt beg-und end-und)))))))
+
+(defun rst-find-title-line ()
+  "Find a section title line around point and return its characteristics.
+If the point is on an adornment line find the respective title
+line.  If the point is on an empty line check previous or next
+line whether it is a suitable title line and use it if so.  If
+point is on a suitable title line use it.
+
+If no title line is found return nil.
+
+Otherwise return as `rst-classify-adornment' does.  However, if
+the title line has no syntactically valid adornment STYLE is nil
+in the first element.  If there is no adornment around the title
+CHARACTER is also nil and match groups for overline and underline
+are nil."
+  (save-excursion
+    (forward-line 0)
+    (let ((orig-pnt (point))
+         (orig-end (line-end-position)))
+      (cond
+       ((looking-at (rst-re 'ado-beg-2-1))
+       (let ((char (string-to-char (match-string-no-properties 2)))
+             (r (rst-classify-adornment (match-string-no-properties 0)
+                                        (match-end 0))))
+         (cond
+          ((not r)
+           ;; Invalid adornment - check whether this is an incomplete overline.
+           (if (and
+                (zerop (forward-line 1))
+                (looking-at (rst-re 'ttl-beg)))
+               (list (cons char nil) orig-pnt (line-end-position)
+                     orig-pnt orig-end (point) (line-end-position) nil nil)))
+          ((consp (car r))
+           ;; A section title - not a transition.
+           r))))
+       ((looking-at (rst-re 'lin-end))
+       (or
+        (save-excursion
+          (if (and (zerop (forward-line -1))
+                   (looking-at (rst-re 'ttl-beg)))
+              (list (cons nil nil) (point) (line-end-position)
+                    nil nil (point) (line-end-position) nil nil)))
+        (save-excursion
+          (if (and (zerop (forward-line 1))
+                   (looking-at (rst-re 'ttl-beg)))
+              (list (cons nil nil) (point) (line-end-position)
+                    nil nil (point) (line-end-position) nil nil)))))
+       ((looking-at (rst-re 'ttl-beg))
+       ;; Try to use the underline.
+       (let ((r (rst-classify-adornment
+                 (buffer-substring-no-properties
+                  (line-beginning-position 2) (line-end-position 2))
+                 (line-end-position 2))))
+         (if r
+             r
+           ;; No valid adornment found.
+           (list (cons nil nil) (point) (line-end-position)
+                 nil nil (point) (line-end-position) nil nil))))))))
+
+;; The following function and variables are used to maintain information about
+;; current section adornment in a buffer local cache. Thus they can be used for
+;; font-locking and manipulation commands.
+
+(defvar rst-all-sections nil
+  "All section adornments in the buffer as found by `rst-find-all-adornments'.
+t when no section adornments were found.")
+(make-variable-buffer-local 'rst-all-sections)
+
+;; FIXME: If this variable is set to a different value font-locking of section
+;;        headers is wrong.
+(defvar rst-section-hierarchy nil
+  "Section hierarchy in the buffer as determined by `rst-get-hierarchy'.
+t when no section adornments were found.  Value depends on
+`rst-all-sections'.")
+(make-variable-buffer-local 'rst-section-hierarchy)
+
+(defun rst-reset-section-caches ()
+  "Reset all section cache variables.
+Should be called by interactive functions which deal with sections."
+  (setq rst-all-sections nil
+       rst-section-hierarchy nil))
+
+(defun rst-find-all-adornments ()
+  "Return all the section adornments in the current buffer.
+Return a list of (LINE . ADORNMENT) with ascending LINE where
+LINE is the line containing the section title.  ADORNMENT consists
+of a (CHARACTER STYLE INDENT) triple as described for
+`rst-preferred-adornments'.
+
+Uses and sets `rst-all-sections'."
+  (unless rst-all-sections
+    (let (positions)
+      ;; Iterate over all the section titles/adornments in the file.
+      (save-excursion
+       (goto-char (point-min))
+       (while (re-search-forward (rst-re 'ado-beg-2-1) nil t)
+         (let ((ado-data (rst-classify-adornment
+                          (match-string-no-properties 0) (point))))
+           (when (and ado-data
+                      (consp (car ado-data))) ; Ignore transitions.
+             (set-match-data (cdr ado-data))
+             (goto-char (match-beginning 2)) ; Goto the title start.
+             (push (cons (1+ (count-lines (point-min) (point)))
+                         (list (caar ado-data)
+                               (cdar ado-data)
+                               (current-indentation)))
+                   positions)
+             (goto-char (match-end 0))))) ; Go beyond the whole thing.
+       (setq positions (nreverse positions))
+       (setq rst-all-sections (or positions t)))))
+  (if (eq rst-all-sections t)
+      nil
+    rst-all-sections))
+
+(defun rst-infer-hierarchy (adornments)
+  "Build a hierarchy of adornments using the list of given ADORNMENTS.
+
+ADORNMENTS is a list of (CHARACTER STYLE INDENT) adornment
 specifications, in order that they appear in a file, and will
-infer a hierarchy of section levels by removing decorations that
-have already been seen in a forward traversal of the decorations,
-comparing just the character and style.
+infer a hierarchy of section levels by removing adornments that
+have already been seen in a forward traversal of the adornments,
+comparing just CHARACTER and STYLE.
 
-Similarly returns a list of (char, style, indent), where each
+Similarly returns a list of (CHARACTER STYLE INDENT), where each
 list element should be unique."
-
-  (let ((hierarchy-alist (list)))
-    (dolist (x decorations)
+  (let (hierarchy-alist)
+    (dolist (x adornments)
       (let ((char (car x))
             (style (cadr x)))
         (unless (assoc (cons char style) hierarchy-alist)
-         (push (cons (cons char style) x) hierarchy-alist))
-        ))
+         (push (cons (cons char style) x) hierarchy-alist))))
+    (mapcar 'cdr (nreverse hierarchy-alist))))
 
-    (mapcar 'cdr (nreverse hierarchy-alist))
-    ))
-
-
-(defun rst-get-hierarchy (&optional alldecos ignore)
+(defun rst-get-hierarchy (&optional ignore)
   "Return the hierarchy of section titles in the file.
 
-Return a list of decorations that represents the hierarchy of
-section titles in the file.  Reuse the list of decorations
-already computed in ALLDECOS if present.  If the line number in
-IGNORE is specified, the decoration found on that line (if there
-is one) is not taken into account when building the hierarchy."
-  (let ((all (or alldecos (rst-find-all-decorations))))
-    (setq all (assq-delete-all ignore all))
-    (rst-infer-hierarchy (mapcar 'cdr all))))
-
-
-(defun rst-get-decoration (&optional point)
-  "Get the decoration at POINT.
-
-Looks around point and finds the characteristics of the
-decoration that is found there.  Assumes that the cursor is
-already placed on the title line (and not on the overline or
-underline).
-
-This function returns a (char, style, indent) triple.  If the
-characters of overline and underline are different, return
-the underline character.  The indent is always calculated.
-A decoration can be said to exist if the style is not nil.
-
-A point can be specified to go to the given location before
-extracting the decoration."
-
-  (let (char style)
-    (save-excursion
-      (if point (goto-char point))
-      (beginning-of-line)
-      (if (looking-at rst-section-text-regexp)
-          (let* ((over (save-excursion
-                         (forward-line -1)
-                         (rst-line-homogeneous-nodent-p)))
-
-                 (under (save-excursion
-                          (forward-line +1)
-                          (rst-line-homogeneous-nodent-p)))
-                 )
-
-            ;; Check that the line above the overline is not part of a title
-            ;; above it.
-            (if (and over
-                     (save-excursion
-                       (and (equal (forward-line -2) 0)
-                            (looking-at rst-section-text-regexp))))
-                (setq over nil))
-
-            (cond
-             ;; No decoration found, leave all return values nil.
-             ((and (eq over nil) (eq under nil)))
-
-             ;; Overline only, leave all return values nil.
-             ;;
-             ;; Note: we don't return the overline character, but it could
-             ;; perhaps in some cases be used to do something.
-             ((and over (eq under nil)))
-
-             ;; Underline only.
-             ((and under (eq over nil))
-              (setq char under
-                    style 'simple))
-
-             ;; Both overline and underline.
-             (t
-              (setq char under
-                    style 'over-and-under)))))
-      ;; Return values.
-      (list char style
-            ;; Find indentation.
-            (save-excursion (back-to-indentation) (current-column))))))
-
-
-(defun rst-get-decorations-around (&optional alldecos)
-  "Return the decorations around point.
-
-Given the list of all decorations ALLDECOS (with positions),
-find the decorations before and after the given point.
-A list of the previous and next decorations is returned."
-  (let* ((all (or alldecos (rst-find-all-decorations)))
+Return a list of adornments that represents the hierarchy of
+section titles in the file.  Each element consists of (CHARACTER
+STYLE INDENT) as described for `rst-find-all-adornments'.  If the
+line number in IGNORE is specified, a possibly adornment found on
+that line is not taken into account when building the hierarchy.
+
+Uses and sets `rst-section-hierarchy' unless IGNORE is given."
+  (if (and (not ignore) rst-section-hierarchy)
+      (if (eq rst-section-hierarchy t)
+         nil
+       rst-section-hierarchy)
+    (let ((r (rst-infer-hierarchy
+             (mapcar 'cdr
+                     (assq-delete-all
+                      ignore
+                      (rst-find-all-adornments))))))
+      (setq rst-section-hierarchy
+           (if ignore
+               ;; Clear cache reflecting that a possible update is not
+               ;; reflected.
+               nil
+             (or r t)))
+      r)))
+
+(defun rst-get-adornments-around ()
+  "Return the adornments around point.
+Return a list of the previous and next adornments."
+  (let* ((all (rst-find-all-adornments))
          (curline (line-number-at-pos))
          prev next
          (cur all))
 
-    ;; Search for the decorations around the current line.
+    ;; Search for the adornments around the current line.
     (while (and cur (< (caar cur) curline))
       (setq prev cur
             cur (cdr cur)))
-    ;; 'cur' is the following decoration.
+    ;; 'cur' is the following adornment.
 
     (if (and cur (caar cur))
         (setq next (if (= curline (caar cur)) (cdr cur) cur)))
@@ -937,23 +1351,21 @@ A list of the previous and next decorations is returned."
     ))
 
 
-(defun rst-decoration-complete-p (deco)
-  "Return true if the decoration DECO around point is complete."
+(defun rst-adornment-complete-p (ado)
+  "Return true if the adornment ADO around point is complete."
   ;; Note: we assume that the detection of the overline as being the underline
   ;; of a preceding title has already been detected, and has been eliminated
-  ;; from the decoration that is given to us.
+  ;; from the adornment that is given to us.
 
   ;; There is some sectioning already present, so check if the current
   ;; sectioning is complete and correct.
-  (let* ((char (car deco))
-         (style (cadr deco))
-         (indent (caddr deco))
+  (let* ((char (car ado))
+         (style (cadr ado))
+         (indent (caddr ado))
          (endcol (save-excursion (end-of-line) (current-column)))
          )
     (if char
-        (let ((exps (concat "^"
-                            (regexp-quote (make-string (+ endcol indent) char))
-                            "$")))
+        (let ((exps (rst-re "^" char (format "\\{%d\\}" (+ endcol indent)) "$")))
           (and
            (save-excursion (forward-line +1)
                            (beginning-of-line)
@@ -966,57 +1378,56 @@ A list of the previous and next decorations is returned."
     ))
 
 
-(defun rst-get-next-decoration
-  (curdeco hier &optional suggestion reverse-direction)
-  "Get the next decoration for CURDECO, in given hierarchy HIER.
-If suggesting, suggest for new decoration SUGGESTION.
+(defun rst-get-next-adornment
+  (curado hier &optional suggestion reverse-direction)
+  "Get the next adornment for CURADO, in given hierarchy HIER.
+If suggesting, suggest for new adornment SUGGESTION.
 REVERSE-DIRECTION is used to reverse the cycling order."
 
   (let* (
-         (char (car curdeco))
-         (style (cadr curdeco))
+         (char (car curado))
+         (style (cadr curado))
 
-         ;; Build a new list of decorations for the rotation.
-         (rotdecos
+         ;; Build a new list of adornments for the rotation.
+         (rotados
           (append hier
-                  ;; Suggest a new decoration.
+                  ;; Suggest a new adornment.
                   (list suggestion
-                        ;; If nothing to suggest, use first decoration.
+                        ;; If nothing to suggest, use first adornment.
                         (car hier)))) )
     (or
-     ;; Search for next decoration.
+     ;; Search for next adornment.
      (cadr
-      (let ((cur (if reverse-direction rotdecos
-                   (reverse rotdecos))))
+      (let ((cur (if reverse-direction rotados
+                   (reverse rotados))))
         (while (and cur
                     (not (and (eq char (caar cur))
                               (eq style (cadar cur)))))
           (setq cur (cdr cur)))
         cur))
 
-     ;; If not found, take the first of all decorations.
+     ;; If not found, take the first of all adornments.
      suggestion
      )))
 
 
-(defun rst-adjust ()
-  "Auto-adjust the decoration around point.
+;; FIXME: A line "``/`` full" is not accepted as a section title.
+(defun rst-adjust (pfxarg)
+  "Auto-adjust the adornment around point.
 
-Adjust/rotate the section decoration for the section title
-around point or promote/demote the decorations inside the region,
+Adjust/rotate the section adornment for the section title around
+point or promote/demote the adornments inside the region,
 depending on if the region is active.  This function is meant to
 be invoked possibly multiple times, and can vary its behavior
-with a positive prefix argument (toggle style), or with a
-negative prefix argument (alternate behavior).
+with a positive PFXARG (toggle style), or with a negative
+PFXARG (alternate behavior).
 
-This function is the main focus of this module and is a bit of a
-swiss knife.  It is meant as the single most essential function
-to be bound to invoke to adjust the decorations of a section
-title in restructuredtext.  It tries to deal with all the
-possible cases gracefully and to do `the right thing' in all
-cases.
+This function is a bit of a swiss knife.  It is meant to adjust
+the adornments of a section title in reStructuredText.  It tries
+to deal with all the possible cases gracefully and to do `the
+right thing' in all cases.
 
-See the documentations of `rst-adjust-decoration' and
+See the documentations of `rst-adjust-adornment-work' and
 `rst-promote-region' for full details.
 
 Prefix Arguments
@@ -1025,28 +1436,24 @@ Prefix Arguments
 The method can take either (but not both) of
 
 a. a (non-negative) prefix argument, which means to toggle the
-   decoration style.  Invoke with a prefix arg for example;
+   adornment style.  Invoke with a prefix argument for example;
 
 b. a negative numerical argument, which generally inverts the
    direction of search in the file or hierarchy.  Invoke with C--
    prefix for example."
-  (interactive)
+  (interactive "P")
 
   (let* (;; Save our original position on the current line.
         (origpt (point-marker))
 
-        ;; Parse the positive and negative prefix arguments.
-         (reverse-direction
-          (and current-prefix-arg
-               (< (prefix-numeric-value current-prefix-arg) 0)))
-         (toggle-style
-          (and current-prefix-arg (not reverse-direction))))
+         (reverse-direction (and pfxarg (< (prefix-numeric-value pfxarg) 0)))
+         (toggle-style (and pfxarg (not reverse-direction))))
 
     (if (rst-portable-mark-active-p)
-        ;; Adjust decorations within region.
-        (rst-promote-region current-prefix-arg)
-      ;; Adjust decoration around point.
-      (rst-adjust-decoration toggle-style reverse-direction))
+        ;; Adjust adornments within region.
+        (rst-promote-region (and pfxarg t))
+      ;; Adjust adornment around point.
+      (rst-adjust-adornment-work toggle-style reverse-direction))
 
     ;; Run the hooks to run after adjusting.
     (run-hooks 'rst-adjust-hook)
@@ -1056,18 +1463,33 @@ b. a negative numerical argument, which generally inverts the
 
     ))
 
-(defvar rst-adjust-hook nil
-  "Hooks to be run after running `rst-adjust'.")
+(defcustom rst-adjust-hook nil
+  "Hooks to be run after running `rst-adjust'."
+  :group 'rst-adjust
+  :type '(hook)
+  :package-version '(rst . "1.1.0"))
+
+(defcustom rst-new-adornment-down nil
+  "Controls level of new adornment for section headers."
+  :group 'rst-adjust
+  :type '(choice
+         (const :tag "Same level as previous one" nil)
+         (const :tag "One level down relative to the previous one" t))
+  :package-version '(rst . "1.1.0"))
+
+(defun rst-adjust-adornment (pfxarg)
+  "Call `rst-adjust-adornment-work' interactively.
+
+Keep this for compatibility for older bindings (are there any?).
+Argument PFXARG has the same meaning as for `rst-adjust'."
+  (interactive "P")
 
-(defvar rst-new-decoration-down nil
-  "Non-nil if new decoration is added deeper.
-If non-nil, a new decoration being added will be initialized to
-be one level down from the previous decoration.  If nil, a new
-decoration will be equal to the level of the previous
-decoration.")
+  (let* ((reverse-direction (and pfxarg (< (prefix-numeric-value pfxarg) 0)))
+         (toggle-style (and pfxarg (not reverse-direction))))
+    (rst-adjust-adornment-work toggle-style reverse-direction)))
 
-(defun rst-adjust-decoration (&optional toggle-style reverse-direction)
-"Adjust/rotate the section decoration for the section title around point.
+(defun rst-adjust-adornment-work (toggle-style reverse-direction)
+"Adjust/rotate the section adornment for the section title around point.
 
 This function is meant to be invoked possibly multiple times, and
 can vary its behavior with a true TOGGLE-STYLE argument, or with
@@ -1080,13 +1502,13 @@ The next action it takes depends on context around the point, and
 it is meant to be invoked possibly more than once to rotate among
 the various possibilities.  Basically, this function deals with:
 
-- adding a decoration if the title does not have one;
+- adding a adornment if the title does not have one;
 
 - adjusting the length of the underline characters to fit a
   modified title;
 
-- rotating the decoration in the set of already existing
-  sectioning decorations used in the file;
+- rotating the adornment in the set of already existing
+  sectioning adornments used in the file;
 
 - switching between simple and over-and-under styles.
 
@@ -1095,10 +1517,10 @@ invoke the method and it will do the most obvious thing that you
 would expect.
 
 
-Decoration Definitions
-======================
+Adornment Definitions
+=====================
 
-The decorations consist in
+The adornments consist in
 
 1. a CHARACTER
 
@@ -1119,71 +1541,69 @@ Here are the gory details of the algorithm (it seems quite
 complicated, but really, it does the most obvious thing in all
 the particular cases):
 
-Before applying the decoration change, the cursor is placed on
+Before applying the adornment change, the cursor is placed on
 the closest line that could contain a section title.
 
-Case 1: No Decoration
----------------------
+Case 1: No Adornment
+--------------------
 
-If the current line has no decoration around it,
+If the current line has no adornment around it,
 
-- search backwards for the last previous decoration, and apply
-  the decoration one level lower to the current line.  If there
-  is no defined level below this previous decoration, we suggest
-  the most appropriate of the `rst-preferred-decorations'.
+- search backwards for the last previous adornment, and apply
+  the adornment one level lower to the current line.  If there
+  is no defined level below this previous adornment, we suggest
+  the most appropriate of the `rst-preferred-adornments'.
 
   If REVERSE-DIRECTION is true, we simply use the previous
-  decoration found directly.
+  adornment found directly.
 
-- if there is no decoration found in the given direction, we use
-  the first of `rst-preferred-decorations'.
+- if there is no adornment found in the given direction, we use
+  the first of `rst-preferred-adornments'.
 
-The prefix argument forces a toggle of the prescribed decoration
-style.
+TOGGLE-STYLE forces a toggle of the prescribed adornment style.
 
-Case 2: Incomplete Decoration
------------------------------
+Case 2: Incomplete Adornment
+----------------------------
 
-If the current line does have an existing decoration, but the
-decoration is incomplete, that is, the underline/overline does
+If the current line does have an existing adornment, but the
+adornment is incomplete, that is, the underline/overline does
 not extend to exactly the end of the title line (it is either too
 short or too long), we simply extend the length of the
 underlines/overlines to fit exactly the section title.
 
-If the prefix argument is given, we toggle the style of the
-decoration as well.
+If TOGGLE-STYLE we toggle the style of the adornment as well.
 
 REVERSE-DIRECTION has no effect in this case.
 
-Case 3: Complete Existing Decoration
-------------------------------------
+Case 3: Complete Existing Adornment
+-----------------------------------
 
-If the decoration is complete (i.e. the underline (overline)
+If the adornment is complete (i.e. the underline (overline)
 length is already adjusted to the end of the title line), we
 search/parse the file to establish the hierarchy of all the
-decorations (making sure not to include the decoration around
-point), and we rotate the current title's decoration from within
+adornments (making sure not to include the adornment around
+point), and we rotate the current title's adornment from within
 that list (by default, going *down* the hierarchy that is present
 in the file, i.e. to a lower section level).  This is meant to be
-used potentially multiple times, until the desired decoration is
+used potentially multiple times, until the desired adornment is
 found around the title.
 
 If we hit the boundary of the hierarchy, exactly one choice from
-the list of preferred decorations is suggested/chosen, the first
-of those decoration that has not been seen in the file yet (and
-not including the decoration around point), and the next
+the list of preferred adornments is suggested/chosen, the first
+of those adornment that has not been seen in the file yet (and
+not including the adornment around point), and the next
 invocation rolls over to the other end of the hierarchy (i.e. it
 cycles).  This allows you to avoid having to set which character
 to use.
 
 If REVERSE-DIRECTION is true, the effect is to change the
-direction of rotation in the hierarchy of decorations, thus
+direction of rotation in the hierarchy of adornments, thus
 instead going *up* the hierarchy.
 
-However, if there is a non-negative prefix argument, we do not
-rotate the decoration, but instead simply toggle the style of the
-current decoration (this should be the most common way to toggle
-the style of an existing complete decoration).
+However, if TOGGLE-STYLE, we do not rotate the adornment, but
+instead simply toggle the style of the current adornment (this
+should be the most common way to toggle the style of an existing
+complete adornment).
 
 
 Point Location
@@ -1203,7 +1623,7 @@ Indented section titles such as ::
    My Title
    --------
 
-are invalid in restructuredtext and thus not recognized by the
+are invalid in reStructuredText and thus not recognized by the
 parser.  This code will thus not work in a way that would support
 indented sections (it would be ambiguous anyway).
 
@@ -1213,166 +1633,103 @@ Joint Sections
 
 Section titles that are right next to each other may not be
 treated well.  More work might be needed to support those, and
-special conditions on the completeness of existing decorations
+special conditions on the completeness of existing adornments
 might be required to make it non-ambiguous.
 
-For now we assume that the decorations are disjoint, that is,
-there is at least a single line between the titles/decoration
-lines.
-
-
-Suggested Binding
-=================
-
-We suggest that you bind this function on C-=.  It is close to
-C-- so a negative argument can be easily specified with a flick
-of the right hand fingers and the binding is unused in `text-mode'."
-  (interactive)
-
-  ;; If we were invoked directly, parse the prefix arguments into the
-  ;; arguments of the function.
-  (if current-prefix-arg
-      (setq reverse-direction
-            (and current-prefix-arg
-                 (< (prefix-numeric-value current-prefix-arg) 0))
-
-            toggle-style
-            (and current-prefix-arg (not reverse-direction))))
-
-  (let* (;; Check if we're on an underline around a section title, and move the
-         ;; cursor to the title if this is the case.
-         (moved (rst-normalize-cursor-position))
-
-         ;; Find the decoration and completeness around point.
-         (curdeco (rst-get-decoration))
-         (char (car curdeco))
-         (style (cadr curdeco))
-         (indent (caddr curdeco))
-
-         ;; New values to be computed.
-         char-new style-new indent-new
-         )
-
-    ;; We've moved the cursor... if we're not looking at some text, we have
-    ;; nothing to do.
-    (if (save-excursion (beginning-of-line)
-                        (looking-at rst-section-text-regexp))
-        (progn
-          (cond
-           ;;-------------------------------------------------------------------
-           ;; Case 1: No Decoration
-           ((and (eq char nil) (eq style nil))
-
-            (let* ((alldecos (rst-find-all-decorations))
-
-                   (around (rst-get-decorations-around alldecos))
-                   (prev (car around))
-                   cur
-
-                   (hier (rst-get-hierarchy alldecos))
-                   )
-
-              ;; Advance one level down.
-              (setq cur
-                    (if prev
-                        (if (not reverse-direction)
-                            (or (funcall (if rst-new-decoration-down 'cadr 'car)
-                                        (rst-get-decoration-match hier prev))
-                                (rst-suggest-new-decoration hier prev))
-                          prev)
-                      (copy-sequence (car rst-preferred-decorations))))
-
-              ;; Invert the style if requested.
-              (if toggle-style
-                  (setcar (cdr cur) (if (eq (cadr cur) 'simple)
-                                        'over-and-under 'simple)) )
-
-              (setq char-new (car cur)
-                    style-new (cadr cur)
-                    indent-new (caddr cur))
-              ))
-
-           ;;-------------------------------------------------------------------
-           ;; Case 2: Incomplete Decoration
-           ((not (rst-decoration-complete-p curdeco))
-
-            ;; Invert the style if requested.
-            (if toggle-style
-                (setq style (if (eq style 'simple) 'over-and-under 'simple)))
-
-            (setq char-new char
-                  style-new style
-                  indent-new indent))
-
-           ;;-------------------------------------------------------------------
-           ;; Case 3: Complete Existing Decoration
-           (t
-            (if toggle-style
-
-                ;; Simply switch the style of the current decoration.
-                (setq char-new char
-                      style-new (if (eq style 'simple) 'over-and-under 'simple)
-                      indent-new rst-default-indent)
-
-              ;; Else, we rotate, ignoring the decoration around the current
-              ;; line...
-              (let* ((alldecos (rst-find-all-decorations))
-
-                     (hier (rst-get-hierarchy alldecos (line-number-at-pos)))
-
-                     ;; Suggestion, in case we need to come up with something
-                     ;; new
-                     (suggestion (rst-suggest-new-decoration
-                                  hier
-                                  (car (rst-get-decorations-around alldecos))))
-
-                     (nextdeco (rst-get-next-decoration
-                                curdeco hier suggestion reverse-direction))
-
-                     )
-
-                ;; Indent, if present, always overrides the prescribed indent.
-                (setq char-new (car nextdeco)
-                      style-new (cadr nextdeco)
-                      indent-new (caddr nextdeco))
-
-                )))
-           )
-
-          ;; Override indent with present indent!
-          (setq indent-new (if (> indent 0) indent indent-new))
-
-          (if (and char-new style-new)
-              (rst-update-section char-new style-new indent-new))
-          ))
-
-
-    ;; Correct the position of the cursor to more accurately reflect where it
-    ;; was located when the function was invoked.
-    (unless (= moved 0)
-      (forward-line (- moved))
-      (end-of-line))
-
-    ))
+For now we assume that the adornments are disjoint, that is,
+there is at least a single line between the titles/adornment
+lines."
+  (rst-reset-section-caches)
+  (let ((ttl-fnd (rst-find-title-line))
+       (orig-pnt (point)))
+    (when ttl-fnd
+      (set-match-data (cdr ttl-fnd))
+      (goto-char (match-beginning 2))
+      (let* ((moved (- (line-number-at-pos) (line-number-at-pos orig-pnt)))
+            (char (caar ttl-fnd))
+            (style (cdar ttl-fnd))
+            (indent (current-indentation))
+            (curado (list char style indent))
+            char-new style-new indent-new)
+       (cond
+        ;;-------------------------------------------------------------------
+        ;; Case 1: No valid adornment
+        ((not style)
+         (let ((prev (car (rst-get-adornments-around)))
+               cur
+               (hier (rst-get-hierarchy)))
+           ;; Advance one level down.
+           (setq cur
+                 (if prev
+                     (if (or (and rst-new-adornment-down reverse-direction)
+                             (and (not rst-new-adornment-down)
+                                  (not reverse-direction)))
+                         prev
+                       (or (cadr (rst-get-adornment-match hier prev))
+                           (rst-suggest-new-adornment hier prev)))
+                   (copy-sequence (car rst-preferred-adornments))))
+           ;; Invert the style if requested.
+           (if toggle-style
+               (setcar (cdr cur) (if (eq (cadr cur) 'simple)
+                                     'over-and-under 'simple)) )
+           (setq char-new (car cur)
+                 style-new (cadr cur)
+                 indent-new (caddr cur))))
+        ;;-------------------------------------------------------------------
+        ;; Case 2: Incomplete Adornment
+        ((not (rst-adornment-complete-p curado))
+         ;; Invert the style if requested.
+         (if toggle-style
+             (setq style (if (eq style 'simple) 'over-and-under 'simple)))
+         (setq char-new char
+               style-new style
+               indent-new indent))
+        ;;-------------------------------------------------------------------
+        ;; Case 3: Complete Existing Adornment
+        (t
+         (if toggle-style
+             ;; Simply switch the style of the current adornment.
+             (setq char-new char
+                   style-new (if (eq style 'simple) 'over-and-under 'simple)
+                   indent-new rst-default-indent)
+           ;; Else, we rotate, ignoring the adornment around the current
+           ;; line...
+           (let* ((hier (rst-get-hierarchy (line-number-at-pos)))
+                  ;; Suggestion, in case we need to come up with something new.
+                  (suggestion (rst-suggest-new-adornment
+                               hier
+                               (car (rst-get-adornments-around))))
+                  (nextado (rst-get-next-adornment
+                            curado hier suggestion reverse-direction)))
+             ;; Indent, if present, always overrides the prescribed indent.
+             (setq char-new (car nextado)
+                   style-new (cadr nextado)
+                   indent-new (caddr nextado))))))
+       ;; Override indent with present indent!
+       (setq indent-new (if (> indent 0) indent indent-new))
+       (if (and char-new style-new)
+           (rst-update-section char-new style-new indent-new))
+       ;; Correct the position of the cursor to more accurately reflect where
+       ;; it was located when the function was invoked.
+       (unless (zerop moved)
+         (forward-line (- moved))
+         (end-of-line))))))
 
 ;; Maintain an alias for compatibility.
 (defalias 'rst-adjust-section-title 'rst-adjust)
 
 
-(defun rst-promote-region (&optional demote)
+(defun rst-promote-region (demote)
   "Promote the section titles within the region.
 
 With argument DEMOTE or a prefix argument, demote the section
 titles instead.  The algorithm used at the boundaries of the
-hierarchy is similar to that used by `rst-adjust-decoration'."
-  (interactive)
-
-  (let* ((demote (or current-prefix-arg demote))
-         (alldecos (rst-find-all-decorations))
-         (cur alldecos)
-
-         (hier (rst-get-hierarchy alldecos))
-         (suggestion (rst-suggest-new-decoration hier))
+hierarchy is similar to that used by `rst-adjust-adornment-work'."
+  (interactive "P")
+  (rst-reset-section-caches)
+  (let* ((cur (rst-find-all-adornments))
+         (hier (rst-get-hierarchy))
+         (suggestion (rst-suggest-new-adornment hier))
 
          (region-begin-line (line-number-at-pos (region-beginning)))
          (region-end-line (line-number-at-pos (region-end)))
@@ -1380,11 +1737,11 @@ hierarchy is similar to that used by `rst-adjust-decoration'."
          marker-list
          )
 
-    ;; Skip the markers that come before the region beginning
+    ;; Skip the markers that come before the region beginning.
     (while (and cur (< (caar cur) region-begin-line))
       (setq cur (cdr cur)))
 
-    ;; Create a list of markers for all the decorations which are found within
+    ;; Create a list of markers for all the adornments which are found within
     ;; the region.
     (save-excursion
       (let (line)
@@ -1396,34 +1753,34 @@ hierarchy is similar to that used by `rst-adjust-decoration'."
 
       ;; Apply modifications.
       (dolist (p marker-list)
-        ;; Go to the decoration to promote.
-        (goto-char (car p))
+       ;; Go to the adornment to promote.
+       (goto-char (car p))
 
-        ;; Update the decoration.
-        (apply 'rst-update-section
-               ;; Rotate the next decoration.
-               (rst-get-next-decoration
-                (cadr p) hier suggestion demote))
+       ;; Update the adornment.
+       (apply 'rst-update-section
+              ;; Rotate the next adornment.
+              (rst-get-next-adornment
+               (cadr p) hier suggestion demote))
 
-        ;; Clear marker to avoid slowing down the editing after we're done.
-        (set-marker (car p) nil))
+       ;; Clear marker to avoid slowing down the editing after we're done.
+       (set-marker (car p) nil))
       (setq deactivate-mark nil)
       )))
 
 
 
-(defun rst-display-decorations-hierarchy (&optional decorations)
-  "Display the current file's section title decorations hierarchy.
-This function expects a list of (char, style, indent) triples in
-DECORATIONS."
+(defun rst-display-adornments-hierarchy (&optional adornments)
+  "Display the current file's section title adornments hierarchy.
+This function expects a list of (CHARACTER STYLE INDENT) triples
+in ADORNMENTS."
   (interactive)
-
-  (if (not decorations)
-      (setq decorations (rst-get-hierarchy)))
+  (rst-reset-section-caches)
+  (if (not adornments)
+      (setq adornments (rst-get-hierarchy)))
   (with-output-to-temp-buffer "*rest section hierarchy*"
     (let ((level 1))
       (with-current-buffer standard-output
-        (dolist (x decorations)
+        (dolist (x adornments)
           (insert (format "\nSection Level %d" level))
           (apply 'rst-update-section x)
           (goto-char (point-max))
@@ -1432,109 +1789,291 @@ DECORATIONS."
           ))
     )))
 
-(defun rst-position (elem list)
-  "Return position of ELEM in LIST or nil."
-  (let ((tail (member elem list)))
-    (if tail (- (length list) (length tail)))))
-
-(defun rst-straighten-decorations ()
-  "Redo all the decorations in the current buffer.
-This is done using our preferred set of decorations.  This can be
+(defun rst-straighten-adornments ()
+  "Redo all the adornments in the current buffer.
+This is done using our preferred set of adornments.  This can be
 used, for example, when using somebody else's copy of a document,
 in order to adapt it to our preferred style."
   (interactive)
+  (rst-reset-section-caches)
   (save-excursion
-    (let* ((alldecos (rst-find-all-decorations))
-          (hier (rst-get-hierarchy alldecos))
-
-          ;; Get a list of pairs of (level . marker)
-          (levels-and-markers (mapcar
-                               (lambda (deco)
-                                 (cons (rst-position (cdr deco) hier)
-                                       (progn
-                                         (goto-char (point-min))
-                                         (forward-line (1- (car deco)))
-                                          (point-marker))))
-                               alldecos))
-          )
+    (let (;; Get a list of pairs of (level . marker).
+         (levels-and-markers (mapcar
+                              (lambda (ado)
+                                (cons (rst-position (cdr ado)
+                                                    (rst-get-hierarchy))
+                                      (progn
+                                        (goto-char (point-min))
+                                        (forward-line (1- (car ado)))
+                                        (point-marker))))
+                              (rst-find-all-adornments))))
       (dolist (lm levels-and-markers)
-       ;; Go to the appropriate position
+       ;; Go to the appropriate position.
        (goto-char (cdr lm))
 
-       ;; Apply the new styule
-       (apply 'rst-update-section (nth (car lm) rst-preferred-decorations))
+       ;; Apply the new style.
+       (apply 'rst-update-section (nth (car lm) rst-preferred-adornments))
 
-       ;; Reset the market to avoid slowing down editing until it gets GC'ed
+       ;; Reset the marker to avoid slowing down editing until it gets GC'ed.
        (set-marker (cdr lm) nil)
        )
     )))
 
 
-
-
-(defun rst-straighten-deco-spacing ()
-  "Adjust the spacing before and after decorations in the entire document.
-The spacing will be set to two blank lines before the first two
-section levels, and one blank line before any of the other
-section levels."
-;; FIXME: we need to take care of subtitle at some point.
-  (interactive)
-  (save-excursion
-    (let* ((alldecos (rst-find-all-decorations)))
-
-      ;; Work the list from the end, so that we don't have to use markers to
-      ;; adjust for the changes in the document.
-      (dolist (deco (nreverse alldecos))
-       ;; Go to the appropriate position.
-       (goto-char (point-min))
-       (forward-line (1- (car deco)))
-       (insert "@\n")
-;; FIXME: todo, we
-       )
-    )))
-
+\f
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Insert list items
+;; =================
+
+
+;=================================================
+; Borrowed from a2r.el (version 1.3), by Lawrence Mitchell <wence@gmx.li>.
+; I needed to make some tiny changes to the functions, so I put it here.
+; -- Wei-Wei Guo
+
+(defconst rst-arabic-to-roman
+  '((1000 .   "M") (900  .  "CM") (500  .   "D") (400  .  "CD")
+    (100  .   "C") (90   .  "XC") (50   .   "L") (40   .  "XL")
+    (10   .   "X") (9    .  "IX") (5    .   "V") (4    .  "IV")
+    (1    .   "I"))
+  "List of maps between Arabic numbers and their Roman numeral equivalents.")
+
+(defun rst-arabic-to-roman (num &optional arg)
+  "Convert Arabic number NUM to its Roman numeral representation.
+
+Obviously, NUM must be greater than zero.  Don't blame me, blame the
+Romans, I mean \"what have the Romans ever _done_ for /us/?\" (with
+apologies to Monty Python).
+If optional prefix ARG is non-nil, insert in current buffer."
+  (let ((map rst-arabic-to-roman)
+        res)
+    (while (and map (> num 0))
+      (if (or (= num (caar map))
+              (> num (caar map)))
+          (setq res (concat res (cdar map))
+                num (- num (caar map)))
+        (setq map (cdr map))))
+    res))
+
+(defun rst-roman-to-arabic (string &optional arg)
+  "Convert STRING of Roman numerals to an Arabic number.
+
+If STRING contains a letter which isn't a valid Roman numeral, the rest
+of the string from that point onwards is ignored.
+
+Hence:
+MMD == 2500
+and
+MMDFLXXVI == 2500.
+If optional ARG is non-nil, insert in current buffer."
+  (let ((res 0)
+        (map rst-arabic-to-roman))
+    (while map
+      (if (string-match (concat "^" (cdar map)) string)
+          (setq res (+ res (caar map))
+                string (replace-match "" nil t string))
+        (setq map (cdr map))))
+    res))
+;=================================================
 
 (defun rst-find-pfx-in-region (beg end pfx-re)
   "Find all the positions of prefixes in region between BEG and END.
-This is used to find bullets and enumerated list items.  PFX-RE
-is a regular expression for matching the lines with items."
+This is used to find bullets and enumerated list items.  PFX-RE is
+a regular expression for matching the lines after indentation
+with items.  Returns a list of cons cells consisting of the point
+and the column of the point."
   (let ((pfx ()))
     (save-excursion
       (goto-char beg)
       (while (< (point) end)
        (back-to-indentation)
        (when (and
-              (looking-at pfx-re)
+              (looking-at pfx-re) ; pfx found and...
               (let ((pfx-col (current-column)))
                 (save-excursion
-                  (forward-line -1)
+                  (forward-line -1) ; ...previous line is...
                   (back-to-indentation)
-                  (or (looking-at "^[ \t]*$")
-                      (> (current-column) pfx-col)
+                  (or (looking-at (rst-re 'lin-end)) ; ...empty,
+                      (> (current-column) pfx-col) ; ...deeper level, or
                       (and (= (current-column) pfx-col)
-                           (looking-at pfx-re))))))
+                           (looking-at pfx-re)))))) ; ...pfx at same level.
          (push (cons (point) (current-column))
                 pfx))
        (forward-line 1)) )
     (nreverse pfx)))
 
-(defvar rst-re-bullets
-  (format "\\([%s][ \t]\\)[^ \t]" (regexp-quote (concat rst-bullets)))
-  "Regexp for finding bullets.")
+(defun rst-insert-list-pos (newitem)
+  "Arrange relative position of a newly inserted list item of style NEWITEM.
+
+Adding a new list might consider three situations:
+
+ (a) Current line is a blank line.
+ (b) Previous line is a blank line.
+ (c) Following line is a blank line.
 
-;; (defvar rst-re-enumerations
-;;   "\\(\\(#\\|[0-9]+\\)\\.[ \t]\\)[^ \t]"
-;;   "Regexp for finding bullets.")
+When (a) and (b), just add the new list at current line.
 
-(defvar rst-re-items
-  (format "\\(%s\\|%s\\)[^ \t]"
-         (format "[%s][ \t]" (regexp-quote (concat rst-bullets)))
-         "\\(#\\|[0-9]+\\)\\.[ \t]")
-  "Regexp for finding bullets.")
+when (a) and not (b), a blank line is added before adding the new list.
 
-(defvar rst-preferred-bullets
-  '(?- ?* ?+)
-  "List of favorite bullets to set for straightening bullets.")
+When not (a), first forward point to the end of the line, and add two
+blank lines, then add the new list.
+
+Other situations are just ignored and left to users themselves."
+  (if (save-excursion
+        (beginning-of-line)
+        (looking-at (rst-re 'lin-end)))
+      (if (save-excursion
+            (forward-line -1)
+            (looking-at (rst-re 'lin-end)))
+          (insert newitem " ")
+        (insert "\n" newitem " "))
+    (end-of-line)
+    (insert "\n\n" newitem " ")))
+
+;; FIXME: Isn't this a `defconst'?
+(defvar rst-initial-enums
+  (let (vals)
+    (dolist (fmt '("%s." "(%s)" "%s)"))
+      (dolist (c '("1" "a" "A" "I" "i"))
+        (push (format fmt c) vals)))
+    (cons "#." (nreverse vals)))
+  "List of initial enumerations.")
+
+;; FIXME: Isn't this a `defconst'?
+(defvar rst-initial-items
+  (append (mapcar 'char-to-string rst-bullets) rst-initial-enums)
+  "List of initial items.  It's collection of bullets and enumerations.")
+
+(defun rst-insert-list-new-item ()
+  "Insert a new list item.
+
+User is asked to select the item style first, for example (a), i), +.  Use TAB
+for completion and choices.
+
+If user selects bullets or #, it's just added with position arranged by
+`rst-insert-list-pos'.
+
+If user selects enumerations, a further prompt is given.  User need to input a
+starting item, for example 'e' for 'A)' style.  The position is also arranged by
+`rst-insert-list-pos'."
+  (interactive)
+  ;; FIXME: Make this comply to `interactive' standards.
+  (let* ((itemstyle (completing-read
+                    "Select preferred item style [#.]: "
+                    rst-initial-items nil t nil nil "#."))
+        (cnt (if (string-match (rst-re 'cntexp-tag) itemstyle)
+                 (match-string 0 itemstyle)))
+        (no
+         (save-match-data
+           ;; FIXME: Make this comply to `interactive' standards.
+           (cond
+            ((equal cnt "a")
+             (let ((itemno (read-string "Give starting value [a]: "
+                                        nil nil "a")))
+               (downcase (substring itemno 0 1))))
+            ((equal cnt "A")
+             (let ((itemno (read-string "Give starting value [A]: "
+                                        nil nil "A")))
+               (upcase (substring itemno 0 1))))
+            ((equal cnt "I")
+             (let ((itemno (read-number "Give starting value [1]: " 1)))
+               (rst-arabic-to-roman itemno)))
+            ((equal cnt "i")
+             (let ((itemno (read-number "Give starting value [1]: " 1)))
+               (downcase (rst-arabic-to-roman itemno))))
+            ((equal cnt "1")
+             (let ((itemno (read-number "Give starting value [1]: " 1)))
+               (number-to-string itemno)))))))
+    (if no
+       (setq itemstyle (replace-match no t t itemstyle)))
+    (rst-insert-list-pos itemstyle)))
+
+(defcustom rst-preferred-bullets
+  '(?* ?- ?+)
+  "List of favorite bullets."
+  :group 'rst
+  :type `(repeat
+         (choice ,@(mapcar (lambda (char)
+                             (list 'const
+                                   :tag (char-to-string char) char))
+                           rst-bullets)))
+  :package-version '(rst . "1.1.0"))
+
+(defun rst-insert-list-continue (curitem prefer-roman)
+  "Insert a list item with list start CURITEM including its indentation level.
+If PREFER-ROMAN roman numbering is preferred over using letters."
+  (end-of-line)
+  (insert
+   "\n" ; FIXME: Separating lines must be possible.
+   (cond
+    ((string-match (rst-re '(:alt enmaut-tag
+                                 bul-tag)) curitem)
+     curitem)
+    ((string-match (rst-re 'num-tag) curitem)
+     (replace-match (number-to-string
+                    (1+ (string-to-number (match-string 0 curitem))))
+                   nil nil curitem))
+    ((and (string-match (rst-re 'rom-tag) curitem)
+         (save-match-data
+           (if (string-match (rst-re 'ltr-tag) curitem) ; Also a letter tag.
+               (save-excursion
+                 ;; FIXME: Assumes one line list items without separating
+                 ;;        empty lines.
+                 (if (and (zerop (forward-line -1))
+                          (looking-at (rst-re 'enmexp-beg)))
+                     (string-match
+                      (rst-re 'rom-tag)
+                      (match-string 0)) ; Previous was a roman tag.
+                   prefer-roman)) ; Don't know - use flag.
+             t))) ; Not a letter tag.
+     (replace-match
+      (let* ((old (match-string 0 curitem))
+            (new (save-match-data
+                   (rst-arabic-to-roman
+                    (1+ (rst-roman-to-arabic
+                         (upcase old)))))))
+       (if (equal old (upcase old))
+           (upcase new)
+         (downcase new)))
+      t nil curitem))
+    ((string-match (rst-re 'ltr-tag) curitem)
+     (replace-match (char-to-string
+                    (1+ (string-to-char (match-string 0 curitem))))
+                   nil nil curitem)))))
+
+
+(defun rst-insert-list (&optional prefer-roman)
+  "Insert a list item at the current point.
+
+The command can insert a new list or a continuing list.  When it is called at a
+non-list line, it will promote to insert new list.  When it is called at a list
+line, it will insert a list with the same list style.
+
+1. When inserting a new list:
+
+User is asked to select the item style first, for example (a), i), +.  Use TAB
+for completion and choices.
+
+ (a) If user selects bullets or #, it's just added.
+ (b) If user selects enumerations, a further prompt is given.  User needs to
+     input a starting item, for example 'e' for 'A)' style.
+
+The position of the new list is arranged according to whether or not the
+current line and the previous line are blank lines.
+
+2. When continuing a list, one thing need to be noticed:
+
+List style alphabetical list, such as 'a.', and roman numerical list, such as
+'i.', have some overlapping items, for example 'v.' The function can deal with
+the problem elegantly in most situations.  But when those overlapped list are
+preceded by a blank line, it is hard to determine which type to use
+automatically.  The function uses alphabetical list by default.  If you want
+roman numerical list, just use a prefix to set PREFER-ROMAN."
+  (interactive "P")
+  (beginning-of-line)
+  (if (looking-at (rst-re 'itmany-beg-1))
+      (rst-insert-list-continue (match-string 0) prefer-roman)
+    (rst-insert-list-new-item)))
 
 (defun rst-straighten-bullets-region (beg end)
   "Make all the bulleted list items in the region consistent.
@@ -1547,8 +2086,7 @@ adjust.  If bullets are found on levels beyond the
 `rst-preferred-bullets' list, they are not modified."
   (interactive "r")
 
-  (let ((bullets (rst-find-pfx-in-region beg end
-                                        rst-re-bullets))
+  (let ((bullets (rst-find-pfx-in-region beg end (rst-re 'bul-sta)))
        (levtable (make-hash-table :size 4)))
 
     ;; Create a map of levels to list of positions.
@@ -1573,25 +2111,25 @@ adjust.  If bullets are found on levels beyond the
               (insert (string (car bullets))))
             (setq bullets (cdr bullets))))))))
 
-(defun rst-rstrip (str)
-  "Strips the whitespace at the end of string STR."
-  (string-match "[ \t\n]*\\'" str)
-  (substring str 0 (match-beginning 0)))
+\f
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Table of contents
+;; =================
 
 (defun rst-get-stripped-line ()
   "Return the line at cursor, stripped from whitespace."
-  (re-search-forward "\\S-.*\\S-" (line-end-position))
+  (re-search-forward (rst-re "\\S .*\\S ") (line-end-position))
   (buffer-substring-no-properties (match-beginning 0)
                                   (match-end 0)) )
 
-(defun rst-section-tree (alldecos)
+(defun rst-section-tree ()
   "Get the hierarchical tree of section titles.
 
 Returns a hierarchical tree of the sections titles in the
-document, for decorations ALLDECOS.  This can be used to generate
-a table of contents for the document.  The top node will always
-be a nil node, with the top level titles as children (there may
-potentially be more than one).
+document.  This can be used to generate a table of contents for
+the document.  The top node will always be a nil node, with the
+top level titles as children (there may potentially be more than
+one).
 
 Each section title consists in a cons of the stripped title
 string and a marker to the section in the original text document.
@@ -1599,61 +2137,60 @@ string and a marker to the section in the original text document.
 If there are missing section levels, the section titles are
 inserted automatically, and the title string is set to nil, and
 the marker set to the first non-nil child of itself.
-Conceptually, the nil nodes--i.e. those which have no title--are
+Conceptually, the nil nodes--i.e.\ those which have no title--are
 to be considered as being the same line as their first non-nil
 child.  This has advantages later in processing the graph."
 
-  (let* ((hier (rst-get-hierarchy alldecos))
-         (levels (make-hash-table :test 'equal :size 10))
-         lines)
+  (let ((hier (rst-get-hierarchy))
+       (levels (make-hash-table :test 'equal :size 10))
+       lines)
 
     (let ((lev 0))
-      (dolist (deco hier)
+      (dolist (ado hier)
        ;; Compare just the character and indent in the hash table.
-        (puthash (cons (car deco) (cadr deco)) lev levels)
+        (puthash (cons (car ado) (cadr ado)) lev levels)
         (incf lev)))
 
     ;; Create a list of lines that contains (text, level, marker) for each
-    ;; decoration.
+    ;; adornment.
     (save-excursion
       (setq lines
-            (mapcar (lambda (deco)
+            (mapcar (lambda (ado)
                       (goto-char (point-min))
-                      (forward-line (1- (car deco)))
-                      (list (gethash (cons (cadr deco) (caddr deco)) levels)
+                      (forward-line (1- (car ado)))
+                      (list (gethash (cons (cadr ado) (caddr ado)) levels)
                             (rst-get-stripped-line)
                             (progn
                               (beginning-of-line 1)
                               (point-marker))))
-                    alldecos)))
-
+                    (rst-find-all-adornments))))
     (let ((lcontnr (cons nil lines)))
       (rst-section-tree-rec lcontnr -1))))
 
 
-(defun rst-section-tree-rec (decos lev)
+(defun rst-section-tree-rec (ados lev)
   "Recursive guts of the section tree construction.
-DECOS is a cons cell whose cdr is the remaining list of
-decorations, and we change it as we consume them.  LEV is
+ADOS is a cons cell whose cdr is the remaining list of
+adornments, and we change it as we consume them.  LEV is
 the current level of that node.  This function returns a
-pair of the subtree that was built.  This treats the DECOS
+pair of the subtree that was built.  This treats the ADOS
 list destructively."
 
-  (let ((ndeco (cadr decos))
+  (let ((nado (cadr ados))
         node
         children)
 
-    ;; If the next decoration matches our level
-    (when (and ndeco (= (car ndeco) lev))
-      ;; Pop the next decoration and create the current node with it
-      (setcdr decos (cddr decos))
-      (setq node (cdr ndeco)) )
+    ;; If the next adornment matches our level.
+    (when (and nado (= (car nado) lev))
+      ;; Pop the next adornment and create the current node with it.
+      (setcdr ados (cddr ados))
+      (setq node (cdr nado)) )
     ;; Else we let the node title/marker be unset.
 
-    ;; Build the child nodes
-    (while (and (cdr decos) (> (caadr decos) lev))
+    ;; Build the child nodes.
+    (while (and (cdr ados) (> (caadr ados) lev))
       (setq children
-            (cons (rst-section-tree-rec decos (1+ lev))
+            (cons (rst-section-tree-rec ados (1+ lev))
                   children)))
     (setq children (reverse children))
 
@@ -1670,7 +2207,7 @@ list destructively."
   "Find tree node at point.
 Given a computed and valid section tree in NODE and a point
 POINT (default being the current point in the current buffer),
-find and return the node within the sectree where the cursor
+find and return the node within the section tree where the cursor
 lives.
 
 Return values: a pair of (parent path, container subtree).
@@ -1749,10 +2286,9 @@ If a numeric prefix argument PFXARG is given, insert the TOC up
 to the specified level.
 
 The TOC is inserted indented at the current column."
-
   (interactive "P")
-
-  (let* (;; Check maximum level override
+  (rst-reset-section-caches)
+  (let* (;; Check maximum level override.
          (rst-toc-insert-max-level
           (if (and (integerp pfxarg) (> (prefix-numeric-value pfxarg) 0))
               (prefix-numeric-value pfxarg) rst-toc-insert-max-level))
@@ -1760,7 +2296,7 @@ The TOC is inserted indented at the current column."
          ;; Get the section tree for the current cursor point.
          (sectree-pair
          (rst-section-tree-point
-          (rst-section-tree (rst-find-all-decorations))))
+          (rst-section-tree)))
 
          ;; Figure out initial indent.
          (initial-indent (make-string (current-column) ? ))
@@ -1829,9 +2365,10 @@ level to align."
               fmt)
           (if do-child-numbering
               (progn
-                ;; Add a separating dot if there is already a prefix
-                (if (> (length pfx) 0)
-                    (setq pfx (concat (rst-rstrip pfx) ".")))
+                ;; Add a separating dot if there is already a prefix.
+                (when (> (length pfx) 0)
+                 (string-match (rst-re "[ \t\n]*\\'") pfx)
+                 (setq pfx (concat (replace-match "" t t pfx) ".")))
 
                 ;; Calculate the amount of space that the prefix will require
                 ;; for the numbers.
@@ -1852,59 +2389,48 @@ level to align."
       )))
 
 
-(defun rst-toc-insert-find-delete-contents ()
-  "Find and delete an existing comment after the first contents directive.
-Delete that region.  Return t if found and the cursor is left after the comment."
-  (goto-char (point-min))
-  ;; We look for the following and the following only (in other words, if your
-  ;; syntax differs, this won't work.  If you would like a more flexible thing,
-  ;; contact the author, I just can't imagine that this requirement is
-  ;; unreasonable for now).
-  ;;
-  ;;   .. contents:: [...anything here...]
-  ;;   ..
-  ;;      XXXXXXXX
-  ;;      XXXXXXXX
-  ;;      [more lines]
-  ;;
-  (let ((beg
-         (re-search-forward "^\\.\\. contents[ \t]*::\\(.*\\)\n\\.\\."
-                            nil t))
-        last-real)
-    (when beg
-      ;; Look for the first line that starts at the first column.
-      (forward-line 1)
-      (beginning-of-line)
-      (while (and
-             (< (point) (point-max))
-             (or (and (looking-at "[ \t]+[^ \t]") (setq last-real (point)) t)
-                 (looking-at "[ \t]*$")))
-       (forward-line 1)
-        )
-      (if last-real
-          (progn
-            (goto-char last-real)
-            (end-of-line)
-            (delete-region beg (point)))
-        (goto-char beg))
-      t
-      )))
-
 (defun rst-toc-update ()
   "Automatically find the contents section of a document and update.
 Updates the inserted TOC if present.  You can use this in your
 file-write hook to always make it up-to-date automatically."
   (interactive)
-  (let ((p (point)))
-    (save-excursion
-      (when (rst-toc-insert-find-delete-contents)
-        (insert "\n    ")
-       (rst-toc-insert)
-       ))
-    ;; Somehow save-excursion does not really work well.
-    (goto-char p))
+  (save-excursion
+    ;; Find and delete an existing comment after the first contents directive.
+    ;; Delete that region.
+    (goto-char (point-min))
+    ;; We look for the following and the following only (in other words, if your
+    ;; syntax differs, this won't work.).
+    ;;
+    ;;   .. contents:: [...anything here...]
+    ;;      [:field: value]...
+    ;;   ..
+    ;;      XXXXXXXX
+    ;;      XXXXXXXX
+    ;;      [more lines]
+    (let ((beg (re-search-forward
+               (rst-re "^" 'exm-sta "contents" 'dcl-tag ".*\n"
+                       "\\(?:" 'hws-sta 'fld-tag ".*\n\\)*" 'exm-tag) nil t))
+         last-real)
+      (when beg
+       ;; Look for the first line that starts at the first column.
+       (forward-line 1)
+       (while (and
+               (< (point) (point-max))
+               (or (if (looking-at
+                        (rst-re 'hws-sta "\\S ")) ; indented content.
+                       (setq last-real (point)))
+                   (looking-at (rst-re 'lin-end)))) ; empty line.
+         (forward-line 1))
+       (if last-real
+           (progn
+             (goto-char last-real)
+             (end-of-line)
+             (delete-region beg (point)))
+         (goto-char beg))
+       (insert "\n    ")
+       (rst-toc-insert))))
   ;; Note: always return nil, because this may be used as a hook.
-  )
+  nil)
 
 ;; Note: we cannot bind the TOC update on file write because it messes with
 ;; undo.  If we disable undo, since it adds and removes characters, the
@@ -1916,7 +2442,7 @@ file-write hook to always make it up-to-date automatically."
 ;;   ;; Disable undo for the write file hook.
 ;;   (let ((buffer-undo-list t)) (rst-toc-update) ))
 
-(defalias 'rst-toc-insert-update 'rst-toc-update) ;; backwards compat.
+(defalias 'rst-toc-insert-update 'rst-toc-update) ; backwards compat.
 
 ;;------------------------------------------------------------------------------
 
@@ -1962,13 +2488,13 @@ children, and t if the node has been found."
 (defvar rst-toc-buffer-name "*Table of Contents*"
   "Name of the Table of Contents buffer.")
 
-(defvar rst-toc-return-buffer nil
-  "Buffer to which to return when leaving the TOC.")
+(defvar rst-toc-return-wincfg nil
+  "Window configuration to which to return when leaving the TOC.")
 
 
 (defun rst-toc ()
   "Display a table-of-contents.
-Finds all the section titles and their decorations in the
+Finds all the section titles and their adornments in the
 file, and displays a hierarchically-organized list of the
 titles, which is essentially a table-of-contents of the
 document.
@@ -1976,11 +2502,9 @@ document.
 The Emacs buffer can be navigated, and selecting a section
 brings the cursor in that section."
   (interactive)
-  (let* ((curbuf (current-buffer))
-
-         ;; Get the section tree
-         (alldecos (rst-find-all-decorations))
-         (sectree (rst-section-tree alldecos))
+  (rst-reset-section-caches)
+  (let* ((curbuf (list (current-window-configuration) (point-marker)))
+         (sectree (rst-section-tree))
 
         (our-node (cdr (rst-section-tree-point sectree)))
         line
@@ -2006,7 +2530,7 @@ brings the cursor in that section."
     (pop-to-buffer buf)
 
     ;; Save the buffer to return to.
-    (set (make-local-variable 'rst-toc-return-buffer) curbuf)
+    (set (make-local-variable 'rst-toc-return-wincfg) curbuf)
 
     ;; Move the cursor near the right section in the TOC.
     (goto-char (point-min))
@@ -2023,11 +2547,17 @@ brings the cursor in that section."
       (error "Buffer for this section was killed"))
     pos))
 
+;; FIXME: Cursor before or behind the list must be handled properly; before the
+;;        list should jump to the top and behind the list to the last normal
+;;        paragraph.
 (defun rst-goto-section (&optional kill)
-  "Go to the section the current line describes."
+  "Go to the section the current line describes.
+If KILL a toc buffer is destroyed."
   (interactive)
   (let ((pos (rst-toc-mode-find-section)))
     (when kill
+      ;; FIXME: This should rather go to `rst-toc-mode-goto-section'.
+      (set-window-configuration (car rst-toc-return-wincfg))
       (kill-buffer (get-buffer rst-toc-buffer-name)))
     (pop-to-buffer (marker-buffer pos))
     (goto-char pos)
@@ -2044,16 +2574,17 @@ brings the cursor in that section."
 EVENT is the input event."
   (interactive "e")
   (let ((pos
-    (with-current-buffer (window-buffer (posn-window (event-end event)))
-      (save-excursion
-        (goto-char (posn-point (event-end event)))
+        (with-current-buffer (window-buffer (posn-window (event-end event)))
+          (save-excursion
+            (goto-char (posn-point (event-end event)))
              (rst-toc-mode-find-section)))))
     (pop-to-buffer (marker-buffer pos))
     (goto-char pos)
     (recenter 5)))
 
 (defun rst-toc-mode-mouse-goto-kill (event)
-  "Same as `rst-toc-mode-mouse-goto', but kill TOC buffer as well."
+  "Same as `rst-toc-mode-mouse-goto', but kill TOC buffer as well.
+EVENT is the input event."
   (interactive "e")
   (call-interactively 'rst-toc-mode-mouse-goto event)
   (kill-buffer (get-buffer rst-toc-buffer-name)))
@@ -2061,8 +2592,9 @@ EVENT is the input event."
 (defun rst-toc-quit-window ()
   "Leave the current TOC buffer."
   (interactive)
-  (quit-window)
-  (pop-to-buffer rst-toc-return-buffer))
+  (let ((retbuf rst-toc-return-wincfg))
+    (set-window-configuration (car retbuf))
+    (goto-char (cadr retbuf))))
 
 (defvar rst-toc-mode-map
   (let ((map (make-sparse-keymap)))
@@ -2085,42 +2617,41 @@ EVENT is the input event."
 ;; Note: use occur-mode (replace.el) as a good example to complete missing
 ;; features.
 
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; Section movement commands.
-;;
+;; Section movement commands
+;; =========================
 
 (defun rst-forward-section (&optional offset)
-  "Skip to the next restructured text section title.
+  "Skip to the next reStructuredText section title.
 OFFSET specifies how many titles to skip.  Use a negative OFFSET to move
 backwards in the file (default is to use 1)."
   (interactive)
+  (rst-reset-section-caches)
   (let* (;; Default value for offset.
          (offset (or offset 1))
 
-         ;; Get all the decorations in the file, with their line numbers.
-         (alldecos (rst-find-all-decorations))
+         ;; Get all the adornments in the file, with their line numbers.
+         (allados (rst-find-all-adornments))
 
          ;; Get the current line.
          (curline (line-number-at-pos))
 
-         (cur alldecos)
+         (cur allados)
          (idx 0)
          )
 
-    ;; Find the index of the "next" decoration w.r.t. to the current line.
+    ;; Find the index of the "next" adornment w.r.t. to the current line.
     (while (and cur (< (caar cur) curline))
       (setq cur (cdr cur))
       (incf idx))
-    ;; 'cur' is the decoration on or following the current line.
+    ;; 'cur' is the adornment on or following the current line.
 
     (if (and (> offset 0) cur (= (caar cur) curline))
         (incf idx))
 
     ;; Find the final index.
     (setq idx (+ idx (if (> offset 0) (- offset 1) offset)))
-    (setq cur (nth idx alldecos))
+    (setq cur (nth idx allados))
 
     ;; If the index is positive, goto the line, otherwise go to the buffer
     ;; boundaries.
@@ -2136,12 +2667,15 @@ backwards in the file (default is to use 1)."
   (interactive)
   (rst-forward-section -1))
 
-(defun rst-mark-section (&optional arg allow-extend)
-  "Select the section that point is currently in."
+;; FIXME: What is `allow-extend' for?
+(defun rst-mark-section (&optional count allow-extend)
+  "Select COUNT sections around point.
+Mark following sections for positive COUNT or preceding sections
+for negative COUNT."
   ;; Cloned from mark-paragraph.
   (interactive "p\np")
-  (unless arg (setq arg 1))
-  (when (zerop arg)
+  (unless count (setq count 1))
+  (when (zerop count)
     (error "Cannot mark zero sections"))
   (cond ((and allow-extend
              (or (and (eq last-command this-command) (mark t))
@@ -2149,258 +2683,38 @@ backwards in the file (default is to use 1)."
         (set-mark
          (save-excursion
            (goto-char (mark))
-           (rst-forward-section arg)
+           (rst-forward-section count)
            (point))))
        (t
-        (rst-forward-section arg)
+        (rst-forward-section count)
         (push-mark nil t t)
-        (rst-forward-section (- arg)))))
-
-
-
-
+        (rst-forward-section (- count)))))
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Functions to work on item lists (e.g. indent/dedent, enumerate), which are
 ;; always 2 or 3 characters apart horizontally with rest.
 
-;; (FIXME: there is currently a bug that makes the region go away when we do that.)
-(defvar rst-shift-fill-region nil
-  "If non-nil, automatically re-fill the region that is being shifted.")
-
 (defun rst-find-leftmost-column (beg end)
-  "Find the leftmost column in the region."
-  (let ((mincol 1000))
+  "Return the leftmost column in region BEG to END."
+  (let (mincol)
     (save-excursion
       (goto-char beg)
       (while (< (point) end)
         (back-to-indentation)
-        (unless (looking-at "[ \t]*$")
-         (setq mincol (min mincol (current-column))))
-        (forward-line 1)
-        ))
+        (unless (looking-at (rst-re 'lin-end))
+         (setq mincol (if mincol
+                          (min mincol (current-column))
+                        (current-column))))
+        (forward-line 1)))
     mincol))
 
-
-;; What we really need to do is compute all the possible alignment possibilities
-;; and then select one.
-;;
-;; .. line-block::
-;;
-;;    a) sdjsds
-;;
-;;       - sdjsd jsjds
-;;
-;;           sdsdsjdsj
-;;
-;;               11. sjdss jddjs
-;;
-;; *  *  * * *   *   *
-;;
-;; Move backwards, accumulate the beginning positions, and also the second
-;; positions, in case the line matches the bullet pattern, and then sort.
-
-(defun rst-compute-bullet-tabs (&optional pt)
-  "Build the list of possible horizontal alignment points.
-Search backwards from point (or point PT if specified) to
-build the list of possible horizontal alignment points that
-includes the beginning and contents of a restructuredtext
-bulleted or enumerated list item.  Return a sorted list
-of (COLUMN-NUMBER . LINE) pairs."
-  (save-excursion
-    (when pt (goto-char pt))
-
-    ;; We work our way backwards and towards the left.
-    (let ((leftcol 100000) ;; Current column.
-         (tablist nil) ;; List of tab positions.
-         )
-
-      ;; Start by skipping the current line.
-      (beginning-of-line 0)
-
-      ;; Search backwards for each line.
-      (while (and (> (point) (point-min))
-                 (> leftcol 0))
-
-       ;; Skip empty lines.
-       (unless (looking-at "^[ \t]*$")
-         ;; Inspect the current non-empty line
-         (back-to-indentation)
-
-         ;; Skip lines that are beyond the current column (we want to move
-         ;; towards the left).
-         (let ((col (current-column)))
-           (when (< col leftcol)
-
-             ;; Add the beginning of the line as a tabbing point.
-             (unless (memq col (mapcar 'car tablist))
-               (push (cons col (point)) tablist))
-
-             ;; Look at the line to figure out if it is a bulleted or enumerate
-             ;; list item.
-             (when (looking-at
-                     (concat
-                      "\\(?:"
-                      "\\(\\(?:[0-9a-zA-Z#]\\{1,3\\}[.):-]\\|[*+-]\\)[ \t]+\\)[^ \t\n]"
-                      "\\|"
-                      (format "\\(%s%s+[ \t]+\\)[^ \t\n]"
-                              (regexp-quote (thing-at-point 'char))
-                              (regexp-quote (thing-at-point 'char)))
-                      "\\)"
-                      ))
-               ;; Add the column of the contained item.
-               (let* ((matchlen (length (or (match-string 1) (match-string 2))))
-                      (newcol (+ col matchlen)))
-                 (unless (or (>= newcol leftcol)
-                             (memq (+ col matchlen) (mapcar 'car tablist)))
-                   (push (cons (+ col matchlen) (+ (point) matchlen))
-                          tablist)))
-               )
-
-             (setq leftcol col)
-             )))
-
-       ;; Move backwards one line.
-       (beginning-of-line 0))
-
-      (sort tablist (lambda (x y) (<= (car x) (car y))))
-      )))
-
-(defun rst-debug-print-tabs (tablist)
-  "Insert a line and place special characters at the tab points in TABLIST."
-  (beginning-of-line)
-  (insert (concat "\n" (make-string 1000 ? ) "\n"))
-  (beginning-of-line 0)
-  (dolist (col tablist)
-    (beginning-of-line)
-    (forward-char (car col))
-    (delete-char 1)
-    (insert "@")
-    ))
-
-(defun rst-debug-mark-found (tablist)
-  "Insert a line and place special characters at the tab points in TABLIST."
-  (dolist (col tablist)
-    (when (cdr col)
-      (goto-char (cdr col))
-      (insert "@"))))
-
-
-(defvar rst-shift-basic-offset 2
-  "Basic horizontal shift distance when there is no preceding alignment tabs.")
-
-(defun rst-shift-region-guts (find-next-fun offset-fun)
-  "(See `rst-shift-region-right' for a description)."
-  (let* ((mbeg (copy-marker (region-beginning)))
-        (mend (copy-marker (region-end)))
-        (tabs (rst-compute-bullet-tabs mbeg))
-        (leftmostcol (rst-find-leftmost-column (region-beginning) (region-end)))
-        )
-    ;; Add basic offset tabs at the end of the list.  This is a better
-    ;; implementation technique than hysteresis and a basic offset because it
-    ;; insures that movement in both directions is consistently using the same
-    ;; column positions.  This makes it more predictable.
-    (setq tabs
-         (append tabs
-                 (mapcar (lambda (x) (cons x nil))
-                         (let ((maxcol 120)
-                               (max-lisp-eval-depth 2000))
-                           (flet ((addnum (x)
-                                          (if (> x maxcol)
-                                              nil
-                                            (cons x (addnum
-                                                     (+ x rst-shift-basic-offset))))))
-                             (addnum (or (caar (last tabs)) 0))))
-                         )))
-
-    ;; (For debugging.)
-    ;;; (save-excursion (goto-char mbeg) (forward-char -1) (rst-debug-print-tabs tabs))))
-    ;;; (print tabs)
-    ;;; (save-excursion (rst-debug-mark-found tabs))
-
-    ;; Apply the indent.
-    (indent-rigidly
-     mbeg mend
-
-     ;; Find the next tab after the leftmost column.
-     (let ((tab (funcall find-next-fun tabs leftmostcol)))
-
-       (if tab
-          (progn
-            (when (cdar tab)
-              (message "Aligned on '%s'"
-                       (save-excursion
-                         (goto-char (cdar tab))
-                         (buffer-substring-no-properties
-                          (line-beginning-position)
-                          (line-end-position))))
-              )
-            (- (caar tab) leftmostcol)) ;; Num chars.
-
-        ;; Otherwise use the basic offset
-        (funcall offset-fun rst-shift-basic-offset)
-        )))
-
-    ;; Optionally reindent.
-    (when rst-shift-fill-region
-      (fill-region mbeg mend))
-    ))
-
-(defun rst-shift-region-right (pfxarg)
-  "Indent region rigidly, by a few characters to the right.
-This function first computes all possible alignment columns by
-inspecting the lines preceding the region for bulleted or
-enumerated list items.  If the leftmost column is beyond the
-preceding lines, the region is moved to the right by
-`rst-shift-basic-offset'.  With a prefix argument, do not
-automatically fill the region."
-  (interactive "P")
-  (let ((rst-shift-fill-region
-        (if (not pfxarg) rst-shift-fill-region)))
-    (rst-shift-region-guts (lambda (tabs leftmostcol)
-                            (let ((cur tabs))
-                              (while (and cur (<= (caar cur) leftmostcol))
-                                (setq cur (cdr cur)))
-                              cur))
-                          'identity
-                          )))
-
-(defun rst-shift-region-left (pfxarg)
-  "Like `rst-shift-region-right', except we move to the left.
-Also, if invoked with a negative prefix arg, the entire
-indentation is removed, up to the leftmost character in the
-region, and automatic filling is disabled."
-  (interactive "P")
-  (let ((mbeg (copy-marker (region-beginning)))
-       (mend (copy-marker (region-end)))
-       (leftmostcol (rst-find-leftmost-column
-                     (region-beginning) (region-end)))
-       (rst-shift-fill-region
-        (if (not pfxarg) rst-shift-fill-region)))
-
-    (when (> leftmostcol 0)
-      (if (and pfxarg (< (prefix-numeric-value pfxarg) 0))
-         (progn
-           (indent-rigidly (region-beginning) (region-end) (- leftmostcol))
-           (when rst-shift-fill-region
-             (fill-region mbeg mend))
-           )
-       (rst-shift-region-guts (lambda (tabs leftmostcol)
-                                (let ((cur (reverse tabs)))
-                                  (while (and cur (>= (caar cur) leftmostcol))
-                                    (setq cur (cdr cur)))
-                                  cur))
-                              '-
-                              ))
-      )))
-
+;; FIXME: This definition is old and deprecated.  We need to move to the newer
+;;        version below.
 (defmacro rst-iterate-leftmost-paragraphs
   (beg end first-only body-consequent body-alternative)
-  "FIXME This definition is old and deprecated / we need to move
-to the newer version below:
-
-Call FUN at the beginning of each line, with an argument that
+  ;; FIXME: The following comment is pretty useless.
+  "Call FUN at the beginning of each line, with an argument that
 specifies whether we are at the first line of a paragraph that
 starts at the leftmost column of the given region BEG and END.
 Set FIRST-ONLY to true if you want to callback on the first line
@@ -2409,7 +2723,7 @@ of each paragraph only."
     (let ((leftcol (rst-find-leftmost-column ,beg ,end))
          (endm (copy-marker ,end)))
 
-      (do* (;; Iterate lines
+      (do* (;; Iterate lines.
            (l (progn (goto-char ,beg) (back-to-indentation))
               (progn (forward-line 1) (back-to-indentation)))
 
@@ -2419,9 +2733,9 @@ of each paragraph only."
                    (current-column))
 
            (valid (and (= curcol leftcol)
-                       (not (looking-at "[ \t]*$")))
+                       (not (looking-at (rst-re 'lin-end))))
                   (and (= curcol leftcol)
-                       (not (looking-at "[ \t]*$"))))
+                       (not (looking-at (rst-re 'lin-end)))))
            )
          ((>= (point) endm))
 
@@ -2433,7 +2747,8 @@ of each paragraph only."
 
        ))))
 
-
+;; FIXME: This needs to be refactored. Probably this is simply a function
+;;        applying BODY rather than a macro.
 (defmacro rst-iterate-leftmost-paragraphs-2 (spec &rest body)
   "Evaluate BODY for each line in region defined by BEG END.
 LEFTMOST is set to true if the line is one of the leftmost of the
@@ -2447,14 +2762,14 @@ first of a paragraph."
      (let ((,leftmost (rst-find-leftmost-column ,beg ,end))
           (endm (copy-marker ,end)))
 
-      (do* (;; Iterate lines
+      (do* (;; Iterate lines.
            (l (progn (goto-char ,beg) (back-to-indentation))
               (progn (forward-line 1) (back-to-indentation)))
 
            (empty-line-previous nil ,isempty)
 
-           (,isempty (looking-at "[ \t]*$")
-                       (looking-at "[ \t]*$"))
+           (,isempty (looking-at (rst-re 'lin-end))
+                       (looking-at (rst-re 'lin-end)))
 
            (,parabegin (not ,isempty)
                        (and empty-line-previous
@@ -2471,67 +2786,363 @@ first of a paragraph."
 
        )))))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Indentation
+
+;; FIXME: At the moment only block comments with leading empty comment line are
+;;        supported.  Comment lines with leading comment markup should be also
+;;        supported.  May be a customizable option could control which style to
+;;        prefer.
+
+(defgroup rst-indent nil "Settings for indentation in reStructuredText.
+
+In reStructuredText indentation points are usually determined by
+preceding lines. Sometimes the syntax allows arbitrary
+indentation points such as where to start the first line
+following a directive. These indentation widths can be customized
+here."
+  :group 'rst
+  :package-version '(rst . "1.1.0"))
+
+(define-obsolete-variable-alias
+  'rst-shift-basic-offset 'rst-indent-width "1.0.0")
+(defcustom rst-indent-width 2
+  "Indentation when there is no more indentation point given."
+  :group 'rst-indent
+  :type '(integer))
+
+(defcustom rst-indent-field 3
+  "Indentation for first line after a field or 0 to always indent for content."
+  :group 'rst-indent
+  :type '(integer))
+
+(defcustom rst-indent-literal-normal 3
+  "Default indentation for literal block after a markup on an own line."
+  :group 'rst-indent
+  :type '(integer))
+
+(defcustom rst-indent-literal-minimized 2
+  "Default indentation for literal block after a minimized markup."
+  :group 'rst-indent
+  :type '(integer))
+
+(defcustom rst-indent-comment 3
+  "Default indentation for first line of a comment."
+  :group 'rst-indent
+  :type '(integer))
+
+;; FIXME: Must consider other tabs:
+;;        * Line blocks
+;;        * Definition lists
+;;        * Option lists
+(defun rst-line-tabs ()
+  "Return tabs of the current line or nil for no tab.
+The list is sorted so the tab where writing continues most likely
+is the first one.  Each tab is of the form (COLUMN . INNER).
+COLUMN is the column of the tab.  INNER is non-nil if this is an
+inner tab.  I.e. a tab which does come from the basic indentation
+and not from inner alignment points."
+  (save-excursion
+    (forward-line 0)
+    (save-match-data
+      (unless (looking-at (rst-re 'lin-end))
+       (back-to-indentation)
+       ;; Current indentation is always the least likely tab.
+       (let ((tabs (list (list (point) 0 nil)))) ; (POINT OFFSET INNER)
+         ;; Push inner tabs more likely to continue writing.
+         (cond
+          ;; Item.
+          ((looking-at (rst-re '(:grp itmany-tag hws-sta) '(:grp "\\S ") "?"))
+           (when (match-string 2)
+             (push (list (match-beginning 2) 0 t) tabs)))
+          ;; Field.
+          ((looking-at (rst-re '(:grp fld-tag) '(:grp hws-tag)
+                               '(:grp "\\S ") "?"))
+           (unless (zerop rst-indent-field)
+             (push (list (match-beginning 1) rst-indent-field t) tabs))
+           (if (match-string 3)
+               (push (list (match-beginning 3) 0 t) tabs)
+             (if (zerop rst-indent-field)
+                 (push (list (match-end 2)
+                             (if (string= (match-string 2) "") 1 0)
+                             t) tabs))))
+          ;; Directive.
+          ((looking-at (rst-re 'dir-sta-3 '(:grp "\\S ") "?"))
+           (push (list (match-end 1) 0 t) tabs)
+           (unless (string= (match-string 2) "")
+             (push (list (match-end 2) 0 t) tabs))
+           (when (match-string 4)
+             (push (list (match-beginning 4) 0 t) tabs)))
+          ;; Footnote or citation definition.
+          ((looking-at (rst-re 'fnc-sta-2 '(:grp "\\S ") "?"))
+           (push (list (match-end 1) 0 t) tabs)
+           (when (match-string 3)
+             (push (list (match-beginning 3) 0 t) tabs)))
+          ;; Comment.
+          ((looking-at (rst-re 'cmt-sta-1))
+           (push (list (point) rst-indent-comment t) tabs)))
+         ;; Start of literal block.
+         (when (looking-at (rst-re 'lit-sta-2))
+           (let ((tab0 (first tabs)))
+             (push (list (first tab0)
+                         (+ (second tab0)
+                            (if (match-string 1)
+                                rst-indent-literal-minimized
+                              rst-indent-literal-normal))
+                         t) tabs)))
+         (mapcar (lambda (tab)
+                   (goto-char (first tab))
+                   (cons (+ (current-column) (second tab)) (third tab)))
+                 tabs))))))
+
+(defun rst-compute-tabs (pt)
+  "Build the list of possible tabs for all lines above.
+Search backwards from point PT to build the list of possible
+tabs.  Return a list of tabs sorted by likeliness to continue
+writing like `rst-line-tabs'.  Nearer lines have generally a
+higher likeliness than farther lines.  Return nil if no tab is found
+in the text above."
+  (save-excursion
+    (goto-char pt)
+    (let (leftmost ; Leftmost column found so far.
+         innermost ; Leftmost column for inner tab.
+         tablist)
+      (while (and (zerop (forward-line -1))
+                 (or (not leftmost)
+                     (> leftmost 0)))
+       (let* ((tabs (rst-line-tabs))
+              (leftcol (if tabs (apply 'min (mapcar 'car tabs)))))
+         (when tabs
+           ;; Consider only lines indented less or same if not INNERMOST.
+           (when (or (not leftmost)
+                     (< leftcol leftmost)
+                     (and (not innermost) (= leftcol leftmost)))
+             (dolist (tab tabs)
+               (let ((inner (cdr tab))
+                     (newcol (car tab)))
+                 (when (and
+                        (or
+                         (and (not inner)
+                              (or (not leftmost)
+                                  (< newcol leftmost)))
+                         (and inner
+                              (or (not innermost)
+                                  (< newcol innermost))))
+                        (not (memq newcol tablist)))
+                   (push newcol tablist))))
+             (setq innermost (if (rst-some (mapcar 'cdr tabs)) ; Has inner.
+                                 leftcol
+                               innermost))
+             (setq leftmost leftcol)))))
+      (nreverse tablist))))
+
+(defun rst-indent-line (&optional dflt)
+  "Indent current line to next best reStructuredText tab.
+The next best tab is taken from the tab list returned by
+`rst-compute-tabs' which is used in a cyclic manner.  If the
+current indentation does not end on a tab use the first one.  If
+the current indentation is on a tab use the next tab.  This allows
+a repeated use of \\[indent-for-tab-command] to cycle through all
+possible tabs.  If no indentation is possible return `noindent' or
+use DFLT.  Return the indentation indented to.  When point is in
+indentation it ends up at its end.  Otherwise the point is kept
+relative to the content."
+  (let* ((pt (point-marker))
+        (cur (current-indentation))
+        (clm (current-column))
+        (tabs (rst-compute-tabs (point)))
+        (fnd (rst-position cur tabs))
+        ind)
+    (if (and (not tabs) (not dflt))
+       'noindent
+      (if (not tabs)
+         (setq ind dflt)
+       (if (not fnd)
+           (setq fnd 0)
+         (setq fnd (1+ fnd))
+         (if (>= fnd (length tabs))
+             (setq fnd 0)))
+       (setq ind (nth fnd tabs)))
+      (indent-line-to ind)
+      (if (> clm cur)
+         (goto-char pt))
+      (set-marker pt nil)
+      ind)))
+
+(defun rst-shift-region (beg end cnt)
+  "Shift region BEG to END by CNT tabs.
+Shift by one tab to the right (CNT > 0) or left (CNT < 0) or
+remove all indentation (CNT = 0).  A tab is taken from the text
+above.  If no suitable tab is found `rst-indent-width' is used."
+  (interactive "r\np")
+  (let ((tabs (sort (rst-compute-tabs beg) (lambda (x y) (<= x y))))
+       (leftmostcol (rst-find-leftmost-column beg end)))
+    (when (or (> leftmostcol 0) (> cnt 0))
+      ;; Apply the indent.
+      (indent-rigidly
+       beg end
+       (if (zerop cnt)
+          (- leftmostcol)
+        ;; Find the next tab after the leftmost column.
+        (let* ((cmp (if (> cnt 0) '> '<))
+               (tabs (if (> cnt 0) tabs (reverse tabs)))
+               (len (length tabs))
+               (dir (rst-signum cnt)) ; Direction to take.
+               (abs (abs cnt)) ; Absolute number of steps to take.
+               ;; Get the position of the first tab beyond leftmostcol.
+               (fnd (lexical-let ((cmp cmp)
+                                  (leftmostcol leftmostcol)) ; Create closure.
+                      (rst-position-if (lambda (elt)
+                                         (funcall cmp elt leftmostcol))
+                                       tabs)))
+               ;; Virtual position of tab.
+               (pos (+ (or fnd len) (1- abs)))
+               (tab (if (< pos len)
+                        ;; Tab exists - use it.
+                        (nth pos tabs)
+                      ;; Column needs to be computed.
+                      (let ((col (+ (or (car (last tabs)) leftmostcol)
+                                    ;; Base on last known column.
+                                    (* (- pos (1- len)) ; Distance left.
+                                       dir ; Direction to take.
+                                       rst-indent-width))))
+                        (if (< col 0) 0 col)))))
+          (- tab leftmostcol)))))))
+
+;; FIXME: A paragraph with an (incorrectly) indented second line is not filled
+;;        correctly::
+;;
+;;          Some start
+;;            continued wrong
+(defun rst-adaptive-fill ()
+  "Return fill prefix found at point.
+Value for `adaptive-fill-function'."
+  (let ((fnd (if (looking-at adaptive-fill-regexp)
+                (match-string-no-properties 0))))
+    (if (save-match-data
+         (not (string-match comment-start-skip fnd)))
+       ;; An non-comment prefix is fine.
+       fnd
+      ;; Matches a comment - return whitespace instead.
+      (make-string (-
+                   (save-excursion
+                     (goto-char (match-end 0))
+                     (current-column))
+                   (save-excursion
+                     (goto-char (match-beginning 0))
+                     (current-column))) ? ))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Comments
+
+(defun rst-comment-line-break (&optional soft)
+  "Break line and indent, continuing reStructuredText comment if within one.
+Value for `comment-line-break-function'.  If SOFT use soft
+newlines as mandated by `comment-line-break-function'."
+  (if soft
+      (insert-and-inherit ?\n)
+    (newline 1))
+  (save-excursion
+    (forward-char -1)
+    (delete-horizontal-space))
+  (delete-horizontal-space)
+  (let ((tabs (rst-compute-tabs (point))))
+    (when tabs
+      (indent-line-to (car tabs)))))
+
+(defun rst-comment-indent ()
+  "Return indentation for current comment line."
+  (car (rst-compute-tabs (point))))
+
+(defun rst-comment-insert-comment ()
+  "Insert a comment in the current line."
+  (rst-indent-line 0)
+  (insert comment-start))
+
+(defun rst-comment-region (beg end &optional arg)
+  "Comment or uncomment the current region.
+Region is from from BEG to END.  Uncomment if ARG."
+  (save-excursion
+    (if (consp arg)
+       (rst-uncomment-region beg end arg)
+      (goto-char beg)
+      (let ((ind (current-indentation))
+           bol)
+       (forward-line 0)
+       (setq bol (point))
+       (indent-rigidly bol end rst-indent-comment)
+       (goto-char bol)
+       (open-line 1)
+       (indent-line-to ind)
+       (insert (comment-string-strip comment-start t t))))))
+
+(defun rst-uncomment-region (beg end &optional arg)
+  "Uncomment the current region.
+Region is from BEG to END.  ARG is ignored"
+  (save-excursion
+    (let (bol eol)
+      (goto-char beg)
+      (forward-line 0)
+      (setq bol (point))
+      (forward-line 1)
+      (setq eol (point))
+      (indent-rigidly eol end (- rst-indent-comment))
+      (delete-region bol eol))))
 
 ;;------------------------------------------------------------------------------
 
-;; FIXME: these next functions should become part of a larger effort to redo the
-;; bullets in bulleted lists.  The enumerate would just be one of the possible
-;; outputs.
+;; FIXME: These next functions should become part of a larger effort to redo
+;;        the bullets in bulleted lists.  The enumerate would just be one of
+;;        the possible outputs.
 ;;
-;; FIXME: TODO we need to do the enumeration removal as well.
+;; FIXME: We need to do the enumeration removal as well.
 
-(defun rst-enumerate-region (beg end)
+(defun rst-enumerate-region (beg end all)
   "Add enumeration to all the leftmost paragraphs in the given region.
-The region is specified between BEG and END.  With prefix argument,
+The region is specified between BEG and END.  With ALL,
 do all lines instead of just paragraphs."
-  (interactive "r")
+  (interactive "r\nP")
   (let ((count 0)
        (last-insert-len nil))
     (rst-iterate-leftmost-paragraphs
-     beg end (not current-prefix-arg)
+     beg end (not all)
      (let ((ins-string (format "%d. " (incf count))))
        (setq last-insert-len (length ins-string))
        (insert ins-string))
      (insert (make-string last-insert-len ?\ ))
      )))
 
-(defun rst-bullet-list-region (beg end)
+(defun rst-bullet-list-region (beg end all)
   "Add bullets to all the leftmost paragraphs in the given region.
-The region is specified between BEG and END.  With prefix argument,
+The region is specified between BEG and END.  With ALL,
 do all lines instead of just paragraphs."
-  (interactive "r")
+  (interactive "r\nP")
   (rst-iterate-leftmost-paragraphs
-   beg end (not current-prefix-arg)
-   (insert "- ")
+   beg end (not all)
+   (insert (car rst-preferred-bullets) " ")
    (insert "  ")
    ))
 
-
-;; FIXME: there are some problems left with the following function
-;; implementation:
-;;
-;; * It does not deal with a varying number of digits appropriately
-;; * It does not deal with multiple levels independently, and it should.
-;;
-;; I suppose it does 90% of the job for now.
-
+;; FIXME: Does not deal with a varying number of digits appropriately.
+;; FIXME: Does not deal with multiple levels independently.
+;; FIXME: Does not indent a multiline item correctly.
 (defun rst-convert-bullets-to-enumeration (beg end)
-  "Convert all the bulleted items and enumerated items in the
-region to enumerated lists, renumbering as necessary."
+  "Convert the bulleted and enumerated items in the region to enumerated lists.
+Renumber as necessary.  Region is from BEG to END."
   (interactive "r")
   (let* (;; Find items and convert the positions to markers.
         (items (mapcar
                 (lambda (x)
                   (cons (copy-marker (car x))
                         (cdr x)))
-                (rst-find-pfx-in-region beg end rst-re-items)))
+                (rst-find-pfx-in-region beg end (rst-re 'itmany-sta-1))))
         (count 1)
         )
     (save-excursion
       (dolist (x items)
        (goto-char (car x))
-       (looking-at rst-re-items)
-       (replace-match (format "%d. " count) nil nil nil 1)
+       (looking-at (rst-re 'itmany-beg-1))
+       (replace-match (format "%d." count) nil nil nil 1)
        (incf count)
        ))
     ))
@@ -2542,7 +3153,7 @@ region to enumerated lists, renumbering as necessary."
 
 (defun rst-line-block-region (rbeg rend &optional pfxarg)
   "Toggle line block prefixes for a region.
-With prefix argument set the empty lines too."
+Region is from RBEG to REND.  With PFXARG set the empty lines too."
   (interactive "r\nP")
   (let ((comment-start "| ")
        (comment-end "")
@@ -2559,9 +3170,16 @@ With prefix argument set the empty lines too."
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Font lock
+;; =========
 
 (require 'font-lock)
 
+;; FIXME: The obsolete variables need to disappear.
+
+;; The following versions have been done inside Emacs and should not be
+;; replaced by `:package-version' attributes until a change.
+
 (defgroup rst-faces nil "Faces used in Rst Mode."
   :group 'rst
   :group 'faces
@@ -2694,8 +3312,27 @@ With prefix argument set the empty lines too."
                         "customize the face `rst-reference' instead."
                         "24.1")
 
+(defface rst-transition '((t :inherit font-lock-keyword-face))
+  "Face used for a transition."
+  :package-version '(rst . "1.3.0")
+  :group 'rst-faces)
+
+(defface rst-adornment '((t :inherit font-lock-keyword-face))
+  "Face used for the adornment of a section header."
+  :package-version '(rst . "1.3.0")
+  :group 'rst-faces)
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+;; FIXME LEVEL-FACE: May be this complicated mechanism should be replaced
+;;                   simply by a number of customizable faces `rst-header-%d'
+;;                   which by default are set properly for dark and light
+;;                   background.  Initialization should come from the old
+;;                   variables if they exist.  A maximum level of 6 should
+;;                   suffice - after that the last level should be repeated.
+;;                   Only `rst-adornment-faces-alist' is needed outside this
+;;                   block.  Would also fix docutils-Bugs-3479594.
+
 (defgroup rst-faces-defaults nil
   "Values used to generate default faces for section titles on all levels.
 Tweak these if you are content with how section title faces are built in
@@ -2704,9 +3341,10 @@ general but you do not like the details."
   :version "21.1")
 
 (defun rst-set-level-default (sym val)
-  "Set custom var SYM affecting section title text face and recompute the faces."
+  "Set custom variable SYM affecting section title text face.
+Recompute the faces.  VAL is the value to set."
   (custom-set-default sym val)
-  ;; Also defines the faces initially when all values are available
+  ;; Also defines the faces initially when all values are available.
   (and (boundp 'rst-level-face-max)
        (boundp 'rst-level-face-format-light)
        (boundp 'rst-level-face-base-color)
@@ -2715,20 +3353,27 @@ general but you do not like the details."
        (fboundp 'rst-define-level-faces)
        (rst-define-level-faces)))
 
-;; Faces for displaying items on several levels; these definitions define
-;; different shades of gray where the lightest one (i.e. least contrasting) is
-;; used for level 1
+;; Faces for displaying items on several levels.  These definitions define
+;; different shades of gray where the lightest one (i.e. least contrasting on a
+;; light background) is used for level 1.
 (defcustom rst-level-face-max 6
   "Maximum depth of levels for which section title faces are defined."
   :group 'rst-faces-defaults
   :type '(integer)
   :set 'rst-set-level-default)
+;; FIXME: It should be possible to give "#RRGGBB" type of color values.
+;;        Together with a `rst-level-face-end-light' this could be used for
+;;        computing steps.
+;; FIXME: This variable should be combined with `rst-level-face-format-light'
+;;        to a single string.
 (defcustom rst-level-face-base-color "grey"
-  "The base name of the color to be used for creating background colors in
-section title faces for all levels."
+  "Base name of the color for creating background colors in section title faces."
   :group 'rst-faces-defaults
   :type '(string)
   :set 'rst-set-level-default)
+;; FIXME LEVEL-FACE: This needs to be done differently: The faces must specify
+;;                   how they behave for dark and light background using the
+;;                   relevant options explained in `defface'.
 (defcustom rst-level-face-base-light
   (if (eq frame-background-mode 'dark)
       15
@@ -2745,6 +3390,12 @@ This value is expanded by `format' with an integer."
   :group 'rst-faces-defaults
   :type '(string)
   :set 'rst-set-level-default)
+;; FIXME LEVEL-FACE: This needs to be done differently: The faces must specify
+;;                   how they behave for dark and light background using the
+;;                   relevant options explained in `defface'.
+;; FIXME: Alternatively there could be a customizable variable
+;;        `rst-level-face-end-light' which defines the end value and steps are
+;;        computed
 (defcustom rst-level-face-step-light
   (if (eq frame-background-mode 'dark)
       7
@@ -2764,254 +3415,336 @@ This color is used as background for section title text on level
   :set 'rst-set-level-default)
 
 (defcustom rst-adornment-faces-alist
-  (let ((alist '((t . font-lock-keyword-face)
-                (nil . font-lock-keyword-face)))
+  ;; FIXME LEVEL-FACE: Must be redone if `rst-level-face-max' is changed
+  (let ((alist (copy-sequence '((t . rst-transition)
+                                (nil . rst-adornment))))
        (i 1))
     (while (<= i rst-level-face-max)
+      ;; FIXME: why not `push'?
       (nconc alist (list (cons i (intern (format "rst-level-%d-face" i)))))
       (setq i (1+ i)))
     alist)
   "Faces for the various adornment types.
-Key is a number (for the section title text of that level),
-t (for transitions) or nil (for section title adornment).
-If you generally do not like how section title text faces are
-set up tweak here.  If the general idea is ok for you but you do not like the
-details check the Rst Faces Defaults group."
+Key is a number (for the section title text of that level
+starting with 1), t (for transitions) or nil (for section title
+adornment).  If you generally do not like how section title text
+faces are set up tweak here.  If the general idea is ok for you
+but you do not like the details check the Rst Faces Defaults
+group."
   :group 'rst-faces
   :type '(alist
          :key-type
          (choice
-          (integer
-           :tag
-           "Section level (may not be bigger than `rst-level-face-max')")
-          (boolean :tag "transitions (on) / section title adornment (off)"))
+          (integer :tag "Section level")
+          (const :tag "transitions" t)
+          (const :tag "section title adornment" nil))
          :value-type (face))
   :set-after '(rst-level-face-max))
 
 (defun rst-define-level-faces ()
   "Define the faces for the section title text faces from the values."
-  ;; All variables used here must be checked in `rst-set-level-default'
+  ;; All variables used here must be checked in `rst-set-level-default'.
   (let ((i 1))
     (while (<= i rst-level-face-max)
       (let ((sym (intern (format "rst-level-%d-face" i)))
-           (doc (format "Face for showing section title text at level %d" i))
+           (doc (format "Default face for showing section title text at level %d.
+This symbol is *not* meant for customization but modified if a
+variable of the `rst-faces-defaults' group is customized. Use
+`rst-adornment-faces-alist' for customization instead." i))
            (col (format (concat "%s" rst-level-face-format-light)
                         rst-level-face-base-color
                         (+ (* (1- i) rst-level-face-step-light)
                            rst-level-face-base-light))))
-        (unless (facep sym)
-          (make-empty-face sym)
-          (set-face-doc-string sym doc)
-          (set-face-background sym col)
-          (set sym sym))
-        (setq i (1+ i))))))
-
+       (make-empty-face sym)
+       (set-face-doc-string sym doc)
+       (set-face-background sym col)
+       (set sym sym)
+       (setq i (1+ i))))))
+
+;; FIXME LEVEL-FACE: This is probably superfluous since it is done by the
+;;                   customization / `rst-set-level-default'.
 (rst-define-level-faces)
 
-\f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Font lock
-
-(defvar rst-use-char-classes
-  (string-match "[[:alpha:]]" "b")
-  "Non-nil if we can use the character classes in our regexps.")
 
-(defun rst-font-lock-keywords-function ()
-  "Return keywords to highlight in Rst mode according to current settings."
+(defvar rst-font-lock-keywords
   ;; The reST-links in the comments below all relate to sections in
-  ;; http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html
-  (let* ( ;; This gets big - so let's define some abbreviations
-        ;; horizontal white space
-        (re-hws "[\t ]")
-        ;; beginning of line with possible indentation
-        (re-bol (concat "^" re-hws "*"))
-        ;; Separates block lead-ins from their content
-        (re-blksep1 (concat "\\(" re-hws "+\\|$\\)"))
-        ;; explicit markup tag
-        (re-emt "\\.\\.")
-        ;; explicit markup start
-        (re-ems (concat re-emt re-hws "+"))
-        ;; inline markup prefix
-        (re-imp1 (concat "\\(^\\|" re-hws "\\|[-'\"([{</:]\\)"))
-        ;; inline markup suffix
-        (re-ims1 (concat "\\(" re-hws "\\|[]-'\")}>/:.,;!?\\]\\|$\\)"))
-        ;; symbol character
-        (re-sym1 "\\(\\sw\\|\\s_\\)")
-        ;; inline markup content begin
-        (re-imbeg2 "\\(\\S \\|\\S \\([^")
-
-        ;; There seems to be a bug leading to error "Stack overflow in regexp
-        ;; matcher" when "|" or "\\*" are the characters searched for
-        (re-imendbeg "\\]\\|\\\\.")
-        ;; inline markup content end
-        (re-imend (concat re-imendbeg "\\)*[^\t \\\\]\\)"))
-        ;; inline markup content without asterisk
-        (re-ima2 (concat re-imbeg2 "*" re-imend))
-        ;; inline markup content without backquote
-        (re-imb2 (concat re-imbeg2 "`" re-imend))
-        ;; inline markup content without vertical bar
-        (re-imv2 (concat re-imbeg2 "|" re-imend))
-        ;; Supported URI schemes
-        (re-uris1 "\\(acap\\|cid\\|data\\|dav\\|fax\\|file\\|ftp\\|gopher\\|http\\|https\\|imap\\|ldap\\|mailto\\|mid\\|modem\\|news\\|nfs\\|nntp\\|pop\\|prospero\\|rtsp\\|service\\|sip\\|tel\\|telnet\\|tip\\|urn\\|vemmi\\|wais\\)")
-        ;; Line starting with adornment and optional whitespace; complete
-        ;; adornment is in (match-string 1); there must be at least 3
-        ;; characters because otherwise explicit markup start would be
-        ;; recognized
-        (re-ado2 (concat "^\\(\\(["
-                         (if rst-use-char-classes
-                             "^[:word:][:space:][:cntrl:]" "^\\w \t\x00-\x1F")
-                         "]\\)\\2\\2+\\)" re-hws "*$"))
-        )
-    (list
-     ;; FIXME: Block markup is not recognized in blocks after explicit markup
-     ;; start
-
-     ;; Simple `Body Elements`_
-     ;; `Bullet Lists`_
-     `(,(concat re-bol "\\([-*+]" re-blksep1 "\\)")
-       1 rst-block-face)
-     ;; `Enumerated Lists`_
-     `(,(concat re-bol "\\((?\\(#\\|[0-9]+\\|[A-Za-z]\\|[IVXLCMivxlcm]+\\)[.)]"
-                re-blksep1 "\\)")
-       1 rst-block-face)
-     ;; `Definition Lists`_ FIXME: missing
-     ;; `Field Lists`_
-     `(,(concat re-bol "\\(:[^:\n]+:\\)" re-blksep1)
-       1 rst-external-face)
-     ;; `Option Lists`_
-     `(,(concat re-bol "\\(\\(\\(\\([-+/]\\|--\\)\\sw\\(-\\|\\sw\\)*"
-               "\\([ =]\\S +\\)?\\)\\(,[\t ]\\)?\\)+\\)\\($\\|[\t ]\\{2\\}\\)")
-       1 rst-block-face)
-
-     ;; `Tables`_ FIXME: missing
-
-     ;; All the `Explicit Markup Blocks`_
-     ;; `Footnotes`_ / `Citations`_
-     `(,(concat re-bol "\\(" re-ems "\\[[^[\n]+\\]\\)" re-blksep1)
-      1 rst-definition-face)
-     ;; `Directives`_ / `Substitution Definitions`_
-     `(,(concat re-bol "\\(" re-ems "\\)\\(\\(|[^|\n]+|[\t ]+\\)?\\)\\("
-                re-sym1 "+::\\)" re-blksep1)
-       (1 rst-directive-face)
-       (2 rst-definition-face)
-       (4 rst-directive-face))
-     ;; `Hyperlink Targets`_
-     `(,(concat re-bol "\\(" re-ems "_\\([^:\\`\n]\\|\\\\.\\|`[^`\n]+`\\)+:\\)"
-                re-blksep1)
-       1 rst-definition-face)
-     `(,(concat re-bol "\\(__\\)" re-blksep1)
-       1 rst-definition-face)
-
-     ;; All `Inline Markup`_
-     ;; FIXME: Condition 5 preventing fontification of e.g. "*" not implemented
-     ;; `Strong Emphasis`_
-     `(,(concat re-imp1 "\\(\\*\\*" re-ima2 "\\*\\*\\)" re-ims1)
-       2 rst-emphasis2-face)
-     ;; `Emphasis`_
-     `(,(concat re-imp1 "\\(\\*" re-ima2 "\\*\\)" re-ims1)
-       2 rst-emphasis1-face)
-     ;; `Inline Literals`_
-     `(,(concat re-imp1 "\\(``" re-imb2 "``\\)" re-ims1)
-       2 rst-literal-face)
-     ;; `Inline Internal Targets`_
-     `(,(concat re-imp1 "\\(_`" re-imb2 "`\\)" re-ims1)
-       2 rst-definition-face)
-     ;; `Hyperlink References`_
-     ;; FIXME: `Embedded URIs`_ not considered
-     `(,(concat re-imp1 "\\(\\(`" re-imb2 "`\\|\\(\\sw\\(\\sw\\|-\\)+\\sw\\)\\)__?\\)" re-ims1)
-      2 rst-reference-face)
-     ;; `Interpreted Text`_
-     `(,(concat re-imp1 "\\(\\(:" re-sym1 "+:\\)?\\)\\(`" re-imb2 "`\\)\\(\\(:"
-                re-sym1 "+:\\)?\\)" re-ims1)
-       (2 rst-directive-face)
-       (5 rst-external-face)
-       (8 rst-directive-face))
-     ;; `Footnote References`_ / `Citation References`_
-     `(,(concat re-imp1 "\\(\\[[^]]+\\]_\\)" re-ims1)
-       2 rst-reference-face)
-     ;; `Substitution References`_
-     `(,(concat re-imp1 "\\(|" re-imv2 "|\\)" re-ims1)
-       2 rst-reference-face)
-     ;; `Standalone Hyperlinks`_
-     `(;; FIXME: This takes it easy by using a whitespace as delimiter
-       ,(concat re-imp1 "\\(" re-uris1 ":\\S +\\)" re-ims1)
-       2 rst-definition-face)
-     `(,(concat re-imp1 "\\(" re-sym1 "+@" re-sym1 "+\\)" re-ims1)
-       2 rst-definition-face)
-
-     ;; Do all block fontification as late as possible so 'append works
-
-     ;; Sections_ / Transitions_
-     (append
-      (list
-       re-ado2)
-      (if (not rst-mode-lazy)
-         '(1 rst-block-face)
-       (list
-        (list 'rst-font-lock-handle-adornment
-              '(progn
-                 (setq rst-font-lock-adornment-point (match-end 1))
-                 (point-max))
-              nil
-              (list 1 '(cdr (assoc nil rst-adornment-faces-alist))
-                    'append t)
-              (list 2 '(cdr (assoc rst-font-lock-level
-                                   rst-adornment-faces-alist))
-                    'append t)
-              (list 3 '(cdr (assoc nil rst-adornment-faces-alist))
-                    'append t)))))
-
-     ;; `Comments`_
-     (append
-      (list
-       (concat re-bol "\\(" re-ems "\\)\[^[|_]\\([^:\n]\\|:\\([^:\n]\\|$\\)\\)*$")
-
-       '(1 rst-comment-face))
-      (if rst-mode-lazy
-         (list
-          (list 'rst-font-lock-find-unindented-line
-                '(progn
-                   (setq rst-font-lock-indentation-point (match-end 1))
-                   (point-max))
-                nil
-                '(0 rst-comment-face append)))))
-     (append
-      (list
-       (concat re-bol "\\(" re-emt "\\)\\(\\s *\\)$")
-       '(1 rst-comment-face)
-       '(2 rst-comment-face))
-      (if rst-mode-lazy
-         (list
-          (list 'rst-font-lock-find-unindented-line
-                '(progn
-                   (setq rst-font-lock-indentation-point 'next)
-                   (point-max))
-                nil
-                '(0 rst-comment-face append)))))
-
-     ;; `Literal Blocks`_
-     (append
-      (list
-       (concat re-bol "\\(\\([^.\n]\\|\\.[^.\n]\\).*\\)?\\(::\\)$")
-       '(3 rst-block-face))
-      (if rst-mode-lazy
-         (list
-          (list 'rst-font-lock-find-unindented-line
-                '(progn
-                   (setq rst-font-lock-indentation-point t)
-                   (point-max))
-                nil
-                '(0 rst-literal-face append)))))
+  ;; http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html.
+  `(;; FIXME: Block markup is not recognized in blocks after explicit markup
+    ;;        start.
+
+    ;; Simple `Body Elements`_
+    ;; `Bullet Lists`_
+    ;; FIXME: A bullet directly after a field name is not recognized.
+    (,(rst-re 'lin-beg '(:grp bul-sta))
+     1 rst-block-face)
+    ;; `Enumerated Lists`_
+    (,(rst-re 'lin-beg '(:grp enmany-sta))
+     1 rst-block-face)
+    ;; `Definition Lists`_
+    ;; FIXME: missing.
+    ;; `Field Lists`_
+    (,(rst-re 'lin-beg '(:grp fld-tag) 'bli-sfx)
+     1 rst-external-face)
+    ;; `Option Lists`_
+    (,(rst-re 'lin-beg '(:grp opt-tag (:shy optsep-tag opt-tag) "*")
+             '(:alt "$" (:seq hws-prt "\\{2\\}")))
+     1 rst-block-face)
+    ;; `Line Blocks`_
+    ;; Only for lines containing no more bar - to distinguish from tables.
+    (,(rst-re 'lin-beg '(:grp "|" bli-sfx) "[^|\n]*$")
+     1 rst-block-face)
+
+    ;; `Tables`_
+    ;; FIXME: missing
+
+    ;; All the `Explicit Markup Blocks`_
+    ;; `Footnotes`_ / `Citations`_
+    (,(rst-re 'lin-beg 'fnc-sta-2)
+     (1 rst-definition-face)
+     (2 rst-definition-face))
+    ;; `Directives`_ / `Substitution Definitions`_
+    (,(rst-re 'lin-beg 'dir-sta-3)
+     (1 rst-directive-face)
+     (2 rst-definition-face)
+     (3 rst-directive-face))
+    ;; `Hyperlink Targets`_
+    (,(rst-re 'lin-beg
+             '(:grp exm-sta "_" (:alt
+                                 (:seq "`" ilcbkqdef-tag "`")
+                                 (:seq (:alt "[^:\\\n]" "\\\\.") "+")) ":")
+             'bli-sfx)
+     1 rst-definition-face)
+    (,(rst-re 'lin-beg '(:grp "__") 'bli-sfx)
+     1 rst-definition-face)
+
+    ;; All `Inline Markup`_
+    ;; Most of them may be multiline though this is uninteresting.
+
+    ;; FIXME: Condition 5 preventing fontification of e.g. "*" not implemented
+    ;;        `Strong Emphasis`_.
+    (,(rst-re 'ilm-pfx '(:grp "\\*\\*" ilcast-tag "\\*\\*") 'ilm-sfx)
+     1 rst-emphasis2-face)
+    ;; `Emphasis`_
+    (,(rst-re 'ilm-pfx '(:grp "\\*" ilcast-tag "\\*") 'ilm-sfx)
+     1 rst-emphasis1-face)
+    ;; `Inline Literals`_
+    (,(rst-re 'ilm-pfx '(:grp "``" ilcbkq-tag "``") 'ilm-sfx)
+     1 rst-literal-face)
+    ;; `Inline Internal Targets`_
+    (,(rst-re 'ilm-pfx '(:grp "_`" ilcbkq-tag "`") 'ilm-sfx)
+     1 rst-definition-face)
+    ;; `Hyperlink References`_
+    ;; FIXME: `Embedded URIs`_ not considered.
+    ;; FIXME: Directly adjacent marked up words are not fontified correctly
+    ;;        unless they are not separated by two spaces: foo_ bar_.
+    (,(rst-re 'ilm-pfx '(:grp (:alt (:seq "`" ilcbkq-tag "`")
+                                   (:seq "\\sw" (:alt "\\sw" "-") "+\\sw"))
+                             "__?") 'ilm-sfx)
+     1 rst-reference-face)
+    ;; `Interpreted Text`_
+    (,(rst-re 'ilm-pfx '(:grp (:shy ":" sym-tag ":") "?")
+             '(:grp "`" ilcbkq-tag "`")
+             '(:grp (:shy ":" sym-tag ":") "?") 'ilm-sfx)
+     (1 rst-directive-face)
+     (2 rst-external-face)
+     (3 rst-directive-face))
+    ;; `Footnote References`_ / `Citation References`_
+    (,(rst-re 'ilm-pfx '(:grp fnc-tag "_") 'ilm-sfx)
+     1 rst-reference-face)
+    ;; `Substitution References`_
+    ;; FIXME: References substitutions like |this|_ or |this|__ are not
+    ;;        fontified correctly.
+    (,(rst-re 'ilm-pfx '(:grp sub-tag) 'ilm-sfx)
+     1 rst-reference-face)
+    ;; `Standalone Hyperlinks`_
+    ;; FIXME: This takes it easy by using a whitespace as delimiter.
+    (,(rst-re 'ilm-pfx '(:grp uri-tag ":\\S +") 'ilm-sfx)
+     1 rst-definition-face)
+    (,(rst-re 'ilm-pfx '(:grp sym-tag "@" sym-tag ) 'ilm-sfx)
+     1 rst-definition-face)
+
+    ;; Do all block fontification as late as possible so 'append works.
+
+    ;; Sections_ / Transitions_
+    ;; For sections this is multiline.
+    (,(rst-re 'ado-beg-2-1)
+     (rst-font-lock-handle-adornment-matcher
+      (rst-font-lock-handle-adornment-pre-match-form
+       (match-string-no-properties 1) (match-end 1))
+      nil
+      (1 (cdr (assoc nil rst-adornment-faces-alist)) append t)
+      (2 (cdr (assoc rst-font-lock-adornment-level
+                    rst-adornment-faces-alist)) append t)
+      (3 (cdr (assoc nil rst-adornment-faces-alist)) append t)))
+
+    ;; FIXME: FACESPEC could be used instead of ordinary faces to set
+    ;;        properties on comments and literal blocks so they are *not*
+    ;;        inline fontified.  See (elisp)Search-based Fontification.
+
+    ;; FIXME: And / or use `syntax-propertize` functions as in `octave-mod.el`
+    ;;        and other V24 modes.  May make `font-lock-extend-region`
+    ;;        superfluous.
+
+    ;; `Comments`_
+    ;; This is multiline.
+    (,(rst-re 'lin-beg 'cmt-sta-1)
+     (1 rst-comment-face)
+     (rst-font-lock-find-unindented-line-match
+      (rst-font-lock-find-unindented-line-limit (match-end 1))
+      nil
+      (0 rst-comment-face append)))
+    (,(rst-re 'lin-beg '(:grp exm-tag) '(:grp hws-tag) "$")
+     (1 rst-comment-face)
+     (2 rst-comment-face)
+     (rst-font-lock-find-unindented-line-match
+      (rst-font-lock-find-unindented-line-limit 'next)
+      nil
+      (0 rst-comment-face append)))
+
+    ;; FIXME: This is not rendered as comment::
+    ;;        .. .. list-table::
+    ;;              :stub-columns: 1
+    ;;              :header-rows: 1
+
+    ;; FIXME: This is rendered wrong::
+    ;;
+    ;;          xxx yyy::
+    ;;
+    ;;                                 ----|> KKKKK <|----
+    ;;                                /                    \
+    ;;             -|> AAAAAAAAAAPPPPPP <|-             -|> AAAAAAAAAABBBBBBB <|-
+    ;;             |                      |             |                       |
+    ;;             |                      |             |                       |
+    ;;             PPPPPP     PPPPPPDDDDDDD             BBBBBBB     PPPPPPBBBBBBB
+    ;;
+    ;; Indentation needs to be taken from the line with the ``::`` and not from
+    ;; the first content line.
 
-    ;; `Doctest Blocks`_
-    (append
-     (list
-      (concat re-bol "\\(>>>\\|\\.\\.\\.\\)\\(.+\\)")
-      '(1 rst-block-face)
-      '(2 rst-literal-face)))
-    )))
+    ;; `Indented Literal Blocks`_
+    ;; This is multiline.
+    (,(rst-re 'lin-beg 'lit-sta-2)
+     (2 rst-block-face)
+     (rst-font-lock-find-unindented-line-match
+      (rst-font-lock-find-unindented-line-limit t)
+      nil
+      (0 rst-literal-face append)))
 
+    ;; FIXME: `Quoted Literal Blocks`_ missing.
+    ;; This is multiline.
 
+    ;; `Doctest Blocks`_
+    ;; FIXME: This is wrong according to the specification:
+    ;;
+    ;;   Doctest blocks are text blocks which begin with ">>> ", the Python
+    ;;   interactive interpreter main prompt, and end with a blank line.
+    ;;   Doctest blocks are treated as a special case of literal blocks,
+    ;;   without requiring the literal block syntax. If both are present, the
+    ;;   literal block syntax takes priority over Doctest block syntax:
+    ;;
+    ;;   This is an ordinary paragraph.
+    ;;
+    ;;   >>> print 'this is a Doctest block'
+    ;;   this is a Doctest block
+    ;;
+    ;;   The following is a literal block::
+    ;;
+    ;;       >>> This is not recognized as a doctest block by
+    ;;       reStructuredText.  It *will* be recognized by the doctest
+    ;;       module, though!
+    ;;
+    ;;   Indentation is not required for doctest blocks.
+    (,(rst-re 'lin-beg '(:grp (:alt ">>>" ell-tag)) '(:grp ".+"))
+     (1 rst-block-face)
+     (2 rst-literal-face))
+    )
+  "Keywords to highlight in rst mode.")
+
+(defvar font-lock-beg)
+(defvar font-lock-end)
+
+(defun rst-font-lock-extend-region ()
+  "Extend the font-lock region if it might be in a multi-line construct.
+Return non-nil if so.  Font-lock region is from `font-lock-beg'
+to `font-lock-end'."
+  (let ((r (rst-font-lock-extend-region-internal font-lock-beg font-lock-end)))
+    (when r
+      (setq font-lock-beg (car r))
+      (setq font-lock-end (cdr r))
+      t)))
+
+(defun rst-font-lock-extend-region-internal (beg end)
+  "Check the region BEG / END for being in the middle of a multi-line construct.
+Return nil if not or a cons with new values for BEG / END"
+  (let ((nbeg (rst-font-lock-extend-region-extend beg -1))
+       (nend (rst-font-lock-extend-region-extend end 1)))
+    (if (or nbeg nend)
+       (cons (or nbeg beg) (or nend end)))))
+
+(defun rst-forward-line (&optional n)
+  "Like `forward-line' but always end up in column 0 and return accordingly.
+Move N lines forward just as `forward-line'."
+  (let ((moved (forward-line n)))
+    (if (bolp)
+       moved
+      (forward-line 0)
+      (- moved (rst-signum n)))))
+
+;; FIXME: If a single line is made a section header by `rst-adjust' the header
+;;        is not always fontified immediately.
+(defun rst-font-lock-extend-region-extend (pt dir)
+  "Extend the region starting at point PT and extending in direction DIR.
+Return extended point or nil if not moved."
+  ;; There are many potential multiline constructs but there are two groups
+  ;; which are really relevant. The first group consists of
+  ;;
+  ;; * comment lines without leading explicit markup tag and
+  ;;
+  ;; * literal blocks following "::"
+  ;;
+  ;; which are both indented. Thus indentation is the first thing recognized
+  ;; here. The second criteria is an explicit markup tag which may be a comment
+  ;; or a double colon at the end of a line.
+  ;;
+  ;; The second group consists of the adornment cases.
+  (if (not (get-text-property pt 'font-lock-multiline))
+      ;; Move only if we don't start inside a multiline construct already.
+      (save-excursion
+       (let (;; Non-empty non-indented line, explicit markup tag or literal
+             ;; block tag.
+             (stop-re (rst-re '(:alt "[^ \t\n]"
+                                     (:seq hws-tag exm-tag)
+                                     (:seq ".*" dcl-tag lin-end)))))
+         ;; The comments below are for dir == -1 / dir == 1.
+         (goto-char pt)
+         (forward-line 0)
+         (setq pt (point))
+         (while (and (not (looking-at stop-re))
+                     (zerop (rst-forward-line dir)))) ; try previous / next
+                                                      ; line if it exists.
+         (if (looking-at (rst-re 'ado-beg-2-1)) ; may be an underline /
+                                                ; overline.
+             (if (zerop (rst-forward-line dir))
+                 (if (looking-at (rst-re 'ttl-beg)) ; title found, i.e.
+                                                    ; underline / overline
+                                                    ; found.
+                     (if (zerop (rst-forward-line dir))
+                         (if (not
+                              (looking-at (rst-re 'ado-beg-2-1))) ; no
+                                                                  ; overline /
+                                                                  ; underline.
+                             (rst-forward-line (- dir)))) ; step back to title
+                                                          ; / adornment.
+                   (if (< dir 0) ; keep downward adornment.
+                       (rst-forward-line (- dir))))) ; step back to adornment.
+           (if (looking-at (rst-re 'ttl-beg)) ; may be a title.
+               (if (zerop (rst-forward-line dir))
+                   (if (not
+                        (looking-at (rst-re 'ado-beg-2-1))) ; no overline /
+                                                            ; underline.
+                       (rst-forward-line (- dir)))))) ; step back to line.
+         (if (not (= (point) pt))
+             (point))))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Indented blocks
@@ -3034,198 +3767,164 @@ point is not moved."
        (forward-line 1)
        (when (< (point) limit)
          (setq beg (point))
-         (if (looking-at "\\s *$")
-             (setq cand (or cand beg)) ; An empty line is a candidate
+         (if (looking-at (rst-re 'lin-end))
+             (setq cand (or cand beg)) ; An empty line is a candidate.
            (move-to-column clm)
            ;; FIXME: No indentation [(zerop clm)] must be handled in some
-           ;; useful way - though it is not clear what this should mean at all
+           ;;        useful way - though it is not clear what this should mean
+           ;;        at all.
            (if (string-match
-                "^\\s *$" (buffer-substring-no-properties beg (point)))
-               (setq cand nil) ; An indented line resets a candidate
+                (rst-re 'linemp-tag)
+                (buffer-substring-no-properties beg (point)))
+               (setq cand nil) ; An indented line resets a candidate.
              (setq fnd (or cand beg)))))))
     (goto-char (or fnd start))
     fnd))
 
-;; Stores the point where the current indentation ends if a number. If `next'
-;; indicates `rst-font-lock-find-unindented-line' shall take the indentation
-;; from the next line if this is not empty. If non-nil indicates
-;; `rst-font-lock-find-unindented-line' shall take the indentation from the
-;; next non-empty line. Also used as a trigger for
-;; `rst-font-lock-find-unindented-line'.
-(defvar rst-font-lock-indentation-point nil)
-
-(defun rst-font-lock-find-unindented-line (limit)
-  (let* ((ind-pnt rst-font-lock-indentation-point)
-        (beg-pnt ind-pnt))
-    ;; May run only once - enforce this
-    (setq rst-font-lock-indentation-point nil)
-    (when (and ind-pnt (not (numberp ind-pnt)))
-      ;; Find indentation point in next line if any
-      (setq ind-pnt
-           (save-excursion
-             (save-match-data
-               (if (eq ind-pnt 'next)
-                   (when (and (zerop (forward-line 1)) (< (point) limit))
-                     (setq beg-pnt (point))
-                     (when (not (looking-at "\\s *$"))
-                       (looking-at "\\s *")
-                       (match-end 0)))
-                 (while (and (zerop (forward-line 1)) (< (point) limit)
-                             (looking-at "\\s *$")))
-                 (when (< (point) limit)
-                   (setq beg-pnt (point))
-                   (looking-at "\\s *")
-                   (match-end 0)))))))
-    (when ind-pnt
-      (goto-char ind-pnt)
-      ;; Always succeeds because the limit set by PRE-MATCH-FORM is the
-      ;; ultimate point to find
-      (goto-char (or (rst-forward-indented-block nil limit) limit))
-      (save-excursion
-        ;; Include subsequent empty lines in the font-lock block,
-        ;; in case the user subsequently changes the indentation of the next
-        ;; non-empty line to move it into the indented element.
-        (skip-chars-forward " \t\n")
-        (put-text-property beg-pnt (point) 'font-lock-multiline t))
-      (set-match-data (list beg-pnt (point)))
-      t)))
+(defvar rst-font-lock-find-unindented-line-begin nil
+  "Beginning of the match if `rst-font-lock-find-unindented-line-end'.")
+
+(defvar rst-font-lock-find-unindented-line-end nil
+  "End of the match as determined by `rst-font-lock-find-unindented-line-limit'.
+Also used as a trigger for
+`rst-font-lock-find-unindented-line-match'.")
+
+(defun rst-font-lock-find-unindented-line-limit (ind-pnt)
+  "Find the next unindented line relative to indentation at IND-PNT.
+Return this point, the end of the buffer or nil if nothing found.
+If IND-PNT is `next' take the indentation from the next line if
+this is not empty and indented more than the current one.  If
+IND-PNT is non-nil but not a number take the indentation from the
+next non-empty line if this is indented more than the current
+one."
+  (setq rst-font-lock-find-unindented-line-begin ind-pnt)
+  (setq rst-font-lock-find-unindented-line-end
+       (save-excursion
+         (when (not (numberp ind-pnt))
+           ;; Find indentation point in next line if any.
+           (setq ind-pnt
+                 ;; FIXME: Should be refactored to two different functions
+                 ;;        giving their result to this function, may be
+                 ;;        integrated in caller.
+                 (save-match-data
+                   (let ((cur-ind (current-indentation)))
+                     (if (eq ind-pnt 'next)
+                         (when (and (zerop (forward-line 1))
+                                    (< (point) (point-max)))
+                           ;; Not at EOF.
+                           (setq rst-font-lock-find-unindented-line-begin
+                                 (point))
+                           (when (and (not (looking-at (rst-re 'lin-end)))
+                                      (> (current-indentation) cur-ind))
+                               ;; Use end of indentation if non-empty line.
+                               (looking-at (rst-re 'hws-tag))
+                               (match-end 0)))
+                       ;; Skip until non-empty line or EOF.
+                       (while (and (zerop (forward-line 1))
+                                   (< (point) (point-max))
+                                   (looking-at (rst-re 'lin-end))))
+                       (when (< (point) (point-max))
+                         ;; Not at EOF.
+                         (setq rst-font-lock-find-unindented-line-begin
+                               (point))
+                         (when (> (current-indentation) cur-ind)
+                           ;; Indentation bigger than line of departure.
+                           (looking-at (rst-re 'hws-tag))
+                           (match-end 0))))))))
+         (when ind-pnt
+           (goto-char ind-pnt)
+           (or (rst-forward-indented-block nil (point-max))
+               (point-max))))))
+
+(defun rst-font-lock-find-unindented-line-match (limit)
+  "Set the match found earlier if match were found.
+Match has been found by
+`rst-font-lock-find-unindented-line-limit' the first time called
+or no match is found.  Return non-nil if match was found.  LIMIT
+is not used but mandated by the caller."
+  (when rst-font-lock-find-unindented-line-end
+    (set-match-data
+     (list rst-font-lock-find-unindented-line-begin
+          rst-font-lock-find-unindented-line-end))
+    (put-text-property rst-font-lock-find-unindented-line-begin
+                      rst-font-lock-find-unindented-line-end
+                      'font-lock-multiline t)
+    ;; Make sure this is called only once.
+    (setq rst-font-lock-find-unindented-line-end nil)
+    t))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Adornments
 
-(defvar rst-font-lock-adornment-point nil
-  "Stores the point where the current adornment ends.
-Also used as a trigger for `rst-font-lock-handle-adornment'.")
-
-;; Here `rst-font-lock-handle-adornment' stores the section level of the
-;; current adornment or t for a transition.
-(defvar rst-font-lock-level nil)
-
-;; FIXME: It would be good if this could be used to markup section titles of
-;; given level with a special key; it would be even better to be able to
-;; customize this so it can be used for a generally available personal style
-;;
-;; FIXME: There should be some way to reset and reload this variable - probably
-;; a special key
-;;
-;; FIXME: Some support for `outline-mode' would be nice which should be based
-;; on this information
-(defvar rst-adornment-level-alist nil
-  "Associates adornments with section levels.
-The key is a two character string.  The first character is the adornment
-character.  The second character distinguishes underline section titles (`u')
-from overline/underline section titles (`o').  The value is the section level.
-
-This is made buffer local on start and adornments found during font lock are
-entered.")
-
-;; Returns section level for adornment key KEY. Adds new section level if KEY
-;; is not found and ADD. If KEY is not a string it is simply returned.
-(defun rst-adornment-level (key &optional add)
-  (let ((fnd (assoc key rst-adornment-level-alist))
-       (new 1))
-    (cond
-     ((not (stringp key))
-      key)
-     (fnd
-      (cdr fnd))
-     (add
-      (while (rassoc new rst-adornment-level-alist)
-       (setq new (1+ new)))
-      (setq rst-adornment-level-alist
-           (append rst-adornment-level-alist (list (cons key new))))
-      new))))
-
-;; Classifies adornment for section titles and transitions. ADORNMENT is the
-;; complete adornment string as found in the buffer. END is the point after the
-;; last character of ADORNMENT. For overline section adornment LIMIT limits the
-;; search for the matching underline. Returns a list. The first entry is t for
-;; a transition, or a key string for `rst-adornment-level' for a section title.
-;; The following eight values forming four match groups as can be used for
-;; `set-match-data'. First match group contains the maximum points of the whole
-;; construct. Second and last match group matched pure section title adornment
-;; while third match group matched the section title text or the transition.
-;; Each group but the first may or may not exist.
-(defun rst-classify-adornment (adornment end limit)
-  (save-excursion
-    (save-match-data
-      (goto-char end)
-      (let ((ado-ch (aref adornment 0))
-           (ado-re (regexp-quote adornment))
-           (end-pnt (point))
-           (beg-pnt (progn
-                      (forward-line 0)
-                      (point)))
-           (nxt-emp
-            (save-excursion
-              (or (not (zerop (forward-line 1)))
-                  (looking-at "\\s *$"))))
-           (prv-emp
-            (save-excursion
-              (or (not (zerop (forward-line -1)))
-                  (looking-at "\\s *$"))))
-           key beg-ovr end-ovr beg-txt end-txt beg-und end-und)
-       (cond
-        ((and nxt-emp prv-emp)
-         ;; A transition
-         (setq key t)
-         (setq beg-txt beg-pnt)
-         (setq end-txt end-pnt))
-        (prv-emp
-         ;; An overline
-         (setq key (concat (list ado-ch) "o"))
-         (setq beg-ovr beg-pnt)
-         (setq end-ovr end-pnt)
-         (forward-line 1)
-         (setq beg-txt (point))
-         (while (and (< (point) limit) (not end-txt))
-           (if (looking-at "\\s *$")
-               ;; No underline found
-               (setq end-txt (1- (point)))
-             (when (looking-at (concat "\\(" ado-re "\\)\\s *$"))
-               (setq end-und (match-end 1))
-               (setq beg-und (point))
-               (setq end-txt (1- beg-und))))
-           (forward-line 1)))
-        (t
-         ;; An underline
-         (setq key (concat (list ado-ch) "u"))
-         (setq beg-und beg-pnt)
-         (setq end-und end-pnt)
-         (setq end-txt (1- beg-und))
-         (setq beg-txt (progn
-                         (if (re-search-backward "^\\s *$" 1 'move)
-                             (forward-line 1))
-                         (point)))))
-       (list key
-             (or beg-ovr beg-txt beg-und)
-             (or end-und end-txt end-und)
-             beg-ovr end-ovr beg-txt end-txt beg-und end-und)))))
-
-;; Handles adornments for font-locking section titles and transitions. Returns
-;; three match groups. First and last match group matched pure overline /
-;; underline adornment while second group matched section title text. Each
-;; group may not exist.
-(defun rst-font-lock-handle-adornment (limit)
-  (let ((ado-pnt rst-font-lock-adornment-point))
-    ;; May run only once - enforce this
-    (setq rst-font-lock-adornment-point nil)
-    (if ado-pnt
-      (let* ((ado (rst-classify-adornment (match-string-no-properties 1)
-                                         ado-pnt limit))
-            (key (car ado))
-            (mtc (cdr ado)))
-       (setq rst-font-lock-level (rst-adornment-level key t))
-       (goto-char (nth 1 mtc))
-        (put-text-property (nth 0 mtc) (nth 1 mtc) 'font-lock-multiline t)
-       (set-match-data mtc)
-       t))))
-
-
+(defvar rst-font-lock-adornment-level nil
+  "Storage for `rst-font-lock-handle-adornment-matcher'.
+Either section level of the current adornment or t for a transition.")
+
+(defun rst-adornment-level (key)
+  "Return section level for adornment KEY.
+KEY is the first element of the return list of
+`rst-classify-adornment'.  If KEY is not a cons return it.  If KEY is found
+in the hierarchy return its level.  Otherwise return a level one
+beyond the existing hierarchy."
+  (if (not (consp key))
+      key
+    (let* ((hier (rst-get-hierarchy))
+          (char (car key))
+          (style (cdr key)))
+      (1+ (or (lexical-let ((char char)
+                           (style style)
+                           (hier hier)) ; Create closure.
+               (rst-position-if (lambda (elt)
+                                  (and (equal (car elt) char)
+                                       (equal (cadr elt) style))) hier))
+             (length hier))))))
+
+(defvar rst-font-lock-adornment-match nil
+  "Storage for match for current adornment.
+Set by `rst-font-lock-handle-adornment-pre-match-form'.  Also used
+as a trigger for `rst-font-lock-handle-adornment-matcher'.")
+
+(defun rst-font-lock-handle-adornment-pre-match-form (ado ado-end)
+  "Determine limit for adornments.
+Determine all things necessary for font-locking section titles
+and transitions and put the result to
+`rst-font-lock-adornment-match' and
+`rst-font-lock-adornment-level'.  ADO is the complete adornment
+matched.  ADO-END is the point where ADO ends.  Return the point
+where the whole adorned construct ends.
+
+Called as a PRE-MATCH-FORM in the sense of `font-lock-keywords'."
+  (let ((ado-data (rst-classify-adornment ado ado-end)))
+    (if (not ado-data)
+       (setq rst-font-lock-adornment-level nil
+             rst-font-lock-adornment-match nil)
+      (setq rst-font-lock-adornment-level
+           (rst-adornment-level (car ado-data)))
+      (setq rst-font-lock-adornment-match (cdr ado-data))
+      (goto-char (nth 1 ado-data)) ; Beginning of construct.
+      (nth 2 ado-data)))) ; End of construct.
+
+(defun rst-font-lock-handle-adornment-matcher (limit)
+  "Set the match found earlier if match were found.
+Match has been found by
+`rst-font-lock-handle-adornment-pre-match-form' the first time
+called or no match is found.  Return non-nil if match was found.
+
+Called as a MATCHER in the sense of `font-lock-keywords'.
+LIMIT is not used but mandated by the caller."
+  (let ((match rst-font-lock-adornment-match))
+    ;; May run only once - enforce this.
+    (setq rst-font-lock-adornment-match nil)
+    (when match
+      (set-match-data match)
+      (goto-char (match-end 0))
+      (put-text-property (match-beginning 0) (match-end 0)
+                        'font-lock-multiline t)
+      t)))
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Support for conversion from within Emacs
+;; Compilation
 
 (defgroup rst-compile nil
   "Settings for support of conversion of reStructuredText
@@ -3250,10 +3949,12 @@ document with \\[rst-compile]."
          ".pdf" nil)
     (s5 ,(if (executable-find "rst2s5.py") "rst2s5.py" "rst2s5")
         ".html" nil))
-  "Table describing the command to use for each toolset.
-An association list of the toolset to a list of the (command to use,
+  "Table describing the command to use for each tool-set.
+An association list of the tool-set to a list of the (command to use,
 extension of produced filename, options to the tool (nil or a
 string)) to be used for converting the document."
+  ;; FIXME: These are not options but symbols which may be referenced by
+  ;;        `rst-compile-*-toolset` below.
   :type '(alist :options (html latex newlatex pseudoxml xml pdf s5)
                 :key-type symbol
                 :value-type (list :tag "Specification"
@@ -3263,19 +3964,15 @@ string)) to be used for converting the document."
                                      (const :tag "No options" nil)
                                      (string :tag "Options"))))
   :group 'rst
-  :version "24.1")
-
-;; Note for Python programmers not familiar with association lists: you can set
-;; values in an alists like this, e.g. :
-;; (setcdr (assq 'html rst-compile-toolsets)
-;;      '("rst2html.py" ".htm" "--stylesheet=/docutils.css"))
-
+  :package-version "1.2.0")
 
+;; FIXME: Must be `defcustom`.
 (defvar rst-compile-primary-toolset 'html
-  "The default toolset for `rst-compile'.")
+  "The default tool-set for `rst-compile'.")
 
+;; FIXME: Must be `defcustom`.
 (defvar rst-compile-secondary-toolset 'latex
-  "The default toolset for `rst-compile' with a prefix argument.")
+  "The default tool-set for `rst-compile' with a prefix argument.")
 
 (defun rst-compile-find-conf ()
   "Look for the configuration file in the parents of the current path."
@@ -3301,15 +3998,15 @@ string)) to be used for converting the document."
 
 (require 'compile)
 
-(defun rst-compile (&optional pfxarg)
+(defun rst-compile (&optional use-alt)
   "Compile command to convert reST document into some output file.
 Attempts to find configuration file, if it can, overrides the
-options.  There are two commands to choose from, with a prefix
-argument, select the alternative toolset."
+options.  There are two commands to choose from, with USE-ALT,
+select the alternative tool-set."
   (interactive "P")
   ;; Note: maybe we want to check if there is a Makefile too and not do anything
   ;; if that is the case.  I dunno.
-  (let* ((toolset (cdr (assq (if pfxarg
+  (let* ((toolset (cdr (assq (if use-alt
                                 rst-compile-secondary-toolset
                               rst-compile-primary-toolset)
                        rst-compile-toolsets)))
@@ -3326,26 +4023,28 @@ argument, select the alternative toolset."
                     (list command
                           (or options "")
                           (if conffile
-                              (concat "--config=\"" conffile "\"")
+                              (concat "--config=" (shell-quote-argument conffile))
                             "")
-                          bufname
-                          (concat outname extension))
+                          (shell-quote-argument bufname)
+                          (shell-quote-argument (concat outname extension)))
                     " "))
 
     ;; Invoke the compile command.
-    (if (or compilation-read-command current-prefix-arg)
+    (if (or compilation-read-command use-alt)
         (call-interactively 'compile)
       (compile compile-command))
     ))
 
 (defun rst-compile-alt-toolset ()
-  "Compile command with the alternative toolset."
+  "Compile command with the alternative tool-set."
   (interactive)
-  (rst-compile 't))
+  (rst-compile t))
 
 (defun rst-compile-pseudo-region ()
-  "Show the pseudo-XML rendering of the current active region,
-or of the entire buffer, if the region is not selected."
+  "Show pseudo-XML rendering.
+Rendering is done of the current active region, or of the entire
+buffer, if the region is not selected."
+  ;; FIXME: The region should be given interactively.
   (interactive)
   (with-output-to-temp-buffer "*pseudoxml*"
     (shell-command-on-region
@@ -3354,53 +4053,52 @@ or of the entire buffer, if the region is not selected."
      (cadr (assq 'pseudoxml rst-compile-toolsets))
      standard-output)))
 
+;; FIXME: Should be `defcustom`.
 (defvar rst-pdf-program "xpdf"
   "Program used to preview PDF files.")
 
 (defun rst-compile-pdf-preview ()
   "Convert the document to a PDF file and launch a preview program."
   (interactive)
-  (let* ((tmp-filename (make-temp-file "rst-out" nil ".pdf"))
-        (command (format "%s %s %s && %s %s"
+  (let* ((tmp-filename (make-temp-file "rst_el" nil ".pdf"))
+        (command (format "%s %s %s && %s %s ; rm %s"
                          (cadr (assq 'pdf rst-compile-toolsets))
                          buffer-file-name tmp-filename
-                         rst-pdf-program tmp-filename)))
+                         rst-pdf-program tmp-filename tmp-filename)))
     (start-process-shell-command "rst-pdf-preview" nil command)
     ;; Note: you could also use (compile command) to view the compilation
     ;; output.
     ))
 
+;; FIXME: Should be `defcustom` or use something like `browse-url`.
 (defvar rst-slides-program "firefox"
   "Program used to preview S5 slides.")
 
 (defun rst-compile-slides-preview ()
   "Convert the document to an S5 slide presentation and launch a preview program."
   (interactive)
-  (let* ((tmp-filename (make-temp-file "rst-slides" nil ".html"))
-        (command (format "%s %s %s && %s %s"
+  (let* ((tmp-filename (make-temp-file "rst_el" nil ".html"))
+        (command (format "%s %s %s && %s %s ; rm %s"
                          (cadr (assq 's5 rst-compile-toolsets))
                          buffer-file-name tmp-filename
-                         rst-slides-program tmp-filename)))
+                         rst-slides-program tmp-filename tmp-filename)))
     (start-process-shell-command "rst-slides-preview" nil command)
     ;; Note: you could also use (compile command) to view the compilation
     ;; output.
     ))
 
-
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
 ;; Generic text functions that are more convenient than the defaults.
-;;
 
+;; FIXME: Unbound command - should be bound or removed.
 (defun rst-replace-lines (fromchar tochar)
-  "Replace flush-left lines, consisting of multiple FROMCHAR characters,
-with equal-length lines of TOCHAR."
+  "Replace flush-left lines of FROMCHAR with equal-length lines of TOCHAR."
   (interactive "\
 cSearch for flush-left lines of char:
 cand replace with char: ")
   (save-excursion
-    (let ((searchre (concat "^" (regexp-quote (string fromchar)) "+\\( *\\)$"))
+    (let ((searchre (rst-re "^" fromchar "+\\( *\\)$"))
           (found 0))
       (while (search-forward-regexp searchre nil t)
         (setq found (1+ found))
@@ -3410,12 +4108,14 @@ cand replace with char: ")
           (insert-char tochar width)))
       (message (format "%d lines replaced." found)))))
 
+;; FIXME: Unbound command - should be bound or removed.
 (defun rst-join-paragraph ()
   "Join lines in current paragraph into one line, removing end-of-lines."
   (interactive)
-  (let ((fill-column 65000)) ; some big number
+  (let ((fill-column 65000)) ; Some big number.
     (call-interactively 'fill-paragraph)))
 
+;; FIXME: Unbound command - should be bound or removed.
 (defun rst-force-fill-paragraph ()
   "Fill paragraph at point, first joining the paragraph's lines into one.
 This is useful for filling list item paragraphs."
@@ -3424,62 +4124,71 @@ This is useful for filling list item paragraphs."
   (fill-paragraph nil))
 
 
+;; FIXME: Unbound command - should be bound or removed.
 ;; Generic character repeater function.
 ;; For sections, better to use the specialized function above, but this can
 ;; be useful for creating separators.
-(defun rst-repeat-last-character (&optional tofill)
-  "Fill the current line up to the length of the preceding line (if not
-empty), using the last character on the current line.  If the preceding line is
-empty, we use the `fill-column'.
+(defun rst-repeat-last-character (use-next)
+  "Fill the current line using the last character on the current line.
+Fill up to the length of the preceding line or up to
+`fill-column' if preceding line is empty.
 
-If a prefix argument is provided, use the next line rather than the preceding
-line.
+If USE-NEXT, use the next line rather than the preceding line.
 
 If the current line is longer than the desired length, shave the characters off
 the current line to fit the desired length.
 
 As an added convenience, if the command is repeated immediately, the alternative
 column is used (fill-column vs. end of previous/next line)."
-  (interactive)
+  (interactive "P")
   (let* ((curcol (current-column))
          (curline (+ (count-lines (point-min) (point))
-                     (if (eq curcol 0) 1 0)))
+                     (if (zerop curcol) 1 0)))
          (lbp (line-beginning-position 0))
-         (prevcol (if (and (= curline 1) (not current-prefix-arg))
+         (prevcol (if (and (= curline 1) (not use-next))
                       fill-column
                     (save-excursion
-                      (forward-line (if current-prefix-arg 1 -1))
+                      (forward-line (if use-next 1 -1))
                       (end-of-line)
                       (skip-chars-backward " \t" lbp)
                       (let ((cc (current-column)))
-                        (if (= cc 0) fill-column cc)))))
+                        (if (zerop cc) fill-column cc)))))
          (rightmost-column
-          (cond (tofill fill-column)
-                ((equal last-command 'rst-repeat-last-character)
+          (cond ((equal last-command 'rst-repeat-last-character)
                  (if (= curcol fill-column) prevcol fill-column))
                 (t (save-excursion
-                     (if (= prevcol 0) fill-column prevcol)))
+                     (if (zerop prevcol) fill-column prevcol)))
                 )) )
     (end-of-line)
     (if (> (current-column) rightmost-column)
-        ;; shave characters off the end
+        ;; Shave characters off the end.
         (delete-region (- (point)
                           (- (current-column) rightmost-column))
                        (point))
-      ;; fill with last characters
+      ;; Fill with last characters.
       (insert-char (preceding-char)
                    (- rightmost-column (current-column))))
     ))
 
 
 (defun rst-portable-mark-active-p ()
-  "A portable function that returns non-nil if the mark is active."
+  "Return non-nil if the mark is active.
+This is a portable function."
   (cond
    ((fboundp 'region-active-p) (region-active-p))
    ((boundp 'transient-mark-mode) (and transient-mark-mode mark-active))
    (t mark-active)))
 
 \f
+
+;; LocalWords:  docutils http sourceforge rst html wp svn svnroot txt reST regex
+;; LocalWords:  regexes alist seq alt grp keymap abbrev overline overlines toc
+;; LocalWords:  XML PNT propertized
+
+;; Local Variables:
+;;   sentence-end-double-space: t
+;; End:
+
 (provide 'rst)
 
 ;;; rst.el ends here
index 09f6b6b7cf2971311fb9ae70e432495a1f334145..5bcd87ede68152db8dd783d7f99f8d0151051f88 100644 (file)
@@ -35,7 +35,7 @@
 (eval-when-compile
   (require 'skeleton)
   (require 'outline)
-  (require 'cl))
+  (require 'cl-lib))
 
 (defgroup sgml nil
   "SGML editing mode."
@@ -292,7 +292,7 @@ Any terminating `>' or `/' is not matched.")
 ;; for font-lock, but must be defvar'ed after
 ;; sgml-font-lock-keywords-1 and sgml-font-lock-keywords-2 above
 (defvar sgml-font-lock-keywords sgml-font-lock-keywords-1
-  "*Rules for highlighting SGML code.  See also `sgml-tag-face-alist'.")
+  "Rules for highlighting SGML code.  See also `sgml-tag-face-alist'.")
 
 (defconst sgml-syntax-propertize-function
   (syntax-propertize-rules
@@ -1192,7 +1192,7 @@ You might want to turn on `auto-fill-mode' to get better results."
 \f
 ;; Parsing
 
-(defstruct (sgml-tag
+(cl-defstruct (sgml-tag
             (:constructor sgml-make-tag (type start end name)))
   type start end name)
 
@@ -1272,7 +1272,7 @@ Leave point at the beginning of the tag."
                      (throw 'found (sgml-parse-tag-backward limit))))
                   (point))))
        (goto-char (1+ tag-start))
-       (case (char-after)
+       (pcase (char-after)
          (?! (setq tag-type 'decl))    ; declaration
          (?? (setq tag-type 'pi))      ; processing-instruction
          (?% (setq tag-type 'jsp))     ; JSP tags
@@ -1280,7 +1280,7 @@ Leave point at the beginning of the tag."
           (forward-char 1)
           (setq tag-type 'close
                 name (sgml-parse-tag-name)))
-         (t                            ; open or empty tag
+         (_                            ; open or empty tag
           (setq tag-type 'open
                 name (sgml-parse-tag-name))
           (if (or (eq ?/ (char-before (- tag-end 1)))
@@ -1405,19 +1405,19 @@ If FULL is non-nil, parse back to the beginning of the buffer."
 Depending on context, inserts a matching close-tag, or closes
 the current start-tag or the current comment or the current cdata, ..."
   (interactive)
-  (case (car (sgml-lexical-context))
-    (comment   (insert " -->"))
-    (cdata     (insert "]]>"))
-    (pi        (insert " ?>"))
-    (jsp       (insert " %>"))
-    (tag       (insert " />"))
-    (text
+  (pcase (car (sgml-lexical-context))
+    (`comment  (insert " -->"))
+    (`cdata    (insert "]]>"))
+    (`pi       (insert " ?>"))
+    (`jsp      (insert " %>"))
+    (`tag      (insert " />"))
+    (`text
      (let ((context (save-excursion (sgml-get-context))))
        (if context
            (progn
              (insert "</" (sgml-tag-name (car (last context))) ">")
              (indent-according-to-mode)))))
-    (otherwise
+    (_
      (error "Nothing to close"))))
 
 (defun sgml-empty-tag-p (tag-name)
@@ -1442,9 +1442,9 @@ LCON is the lexical context, if any."
           (save-excursion (goto-char (cdr lcon)) (looking-at "<!--")))
       (setq lcon (cons 'comment (+ (cdr lcon) 2))))
 
-  (case (car lcon)
+  (pcase (car lcon)
 
-    (string
+    (`string
      ;; Go back to previous non-empty line.
      (while (and (> (point) (cdr lcon))
                 (zerop (forward-line -1))
@@ -1455,7 +1455,7 @@ LCON is the lexical context, if any."
        (goto-char (cdr lcon))
        (1+ (current-column))))
 
-    (comment
+    (`comment
      (let ((mark (looking-at "--")))
        ;; Go back to previous non-empty line.
        (while (and (> (point) (cdr lcon))
@@ -1474,11 +1474,11 @@ LCON is the lexical context, if any."
        (current-column)))
 
     ;; We don't know how to indent it.  Let's be honest about it.
-    (cdata nil)
+    (`cdata nil)
     ;; We don't know how to indent it.  Let's be honest about it.
-    (pi nil)
+    (`pi nil)
 
-    (tag
+    (`tag
      (goto-char (1+ (cdr lcon)))
      (skip-chars-forward "^ \t\n")     ;Skip tag name.
      (skip-chars-forward " \t")
@@ -1488,7 +1488,7 @@ LCON is the lexical context, if any."
        (goto-char (1+ (cdr lcon)))
        (+ (current-column) sgml-basic-offset)))
 
-    (text
+    (`text
      (while (looking-at "</")
        (forward-sexp 1)
        (skip-chars-forward " \t"))
@@ -1536,7 +1536,7 @@ LCON is the lexical context, if any."
         (+ (current-column)
            (* sgml-basic-offset (length context)))))))
 
-    (otherwise
+    (_
      (error "Unrecognized context %s" (car lcon)))
 
     ))
@@ -1664,7 +1664,7 @@ This takes effect when first loading the library.")
   '((bold . "b")
     (italic . "i")
     (underline . "u")
-    (modeline . "rev"))
+    (mode-line . "rev"))
   "Value of `sgml-face-tag-alist' for HTML mode.")
 
 (defvar html-tag-face-alist
@@ -1680,7 +1680,7 @@ This takes effect when first loading the library.")
     ("h5" . underline)
     ("h6" . underline)
     ("i" . italic)
-    ("rev"  . modeline)
+    ("rev"  . mode-line)
     ("s" . underline)
     ("small" . default)
     ("strong" . bold)
@@ -1843,7 +1843,7 @@ This takes effect when first loading the library.")
       ("u")
       ("var")
       ("wbr" t)))
-  "*Value of `sgml-tag-alist' for HTML mode.")
+  "Value of `sgml-tag-alist' for HTML mode.")
 
 (defvar html-tag-help
   `(,@sgml-tag-help
@@ -1936,7 +1936,7 @@ This takes effect when first loading the library.")
     ("ul" . "Unordered list")
     ("var" . "Math variable face")
     ("wbr" . "Enable <br> within <nobr>"))
-  "*Value of `sgml-tag-help' for HTML mode.")
+  "Value of `sgml-tag-help' for HTML mode.")
 
 \f
 ;;;###autoload
@@ -2010,7 +2010,7 @@ To work around that, do:
 
 (defvar html-imenu-regexp
   "\\s-*<h\\([1-9]\\)[^\n<>]*>\\(<[^\n<>]*>\\)*\\s-*\\([^\n<>]*\\)"
-  "*A regular expression matching a head line to be added to the menu.
+  "A regular expression matching a head line to be added to the menu.
 The first `match-string' should be a number from 1-9.
 The second `match-string' matches extra tags and is ignored.
 The third `match-string' will be the used in the menu.")
index e98d78ad439004d3b7e91b06326c22483372def2..2664a89855fa2653d78c49ef1b0cb7b11cbc027a 100644 (file)
@@ -678,11 +678,9 @@ height."
   :group 'table)
 
 (defface table-cell
-  '((((min-colors 88) (class color))
-     (:foreground "gray90" :background "blue1"))
-    (((class color))
-     (:foreground "gray90" :background "blue"))
-    (t (:bold t)))
+  '((((min-colors 88) (class color)) :foreground "gray90" :background "blue1")
+    (((class color)) :foreground "gray90" :background "blue")
+    (t :weight bold))
   "Face used for table cell contents."
   :tag "Cell Face"
   :group 'table)
@@ -844,7 +842,7 @@ simply by any key input."
 (defvar table-disable-menu (null (and (locate-library "easymenu")
                                      (require 'easymenu)
                                      (fboundp 'easy-menu-add-item)))
-  "*When non-nil, use of menu by table package is disabled.
+  "When non-nil, use of menu by table package is disabled.
 It must be set before loading this package `table.el' for the first
 time.")
 
index c5cad045c3f3b549f3803f1bf7e8a1491609d6aa..5571af1ad9bc320545df8856534b2d60688e9bc4 100644 (file)
@@ -31,7 +31,7 @@
 ;; Pacify the byte-compiler
 (eval-when-compile
   (require 'compare-w)
-  (require 'cl)
+  (require 'cl-lib)
   (require 'skeleton))
 
 (defvar font-lock-comment-face)
@@ -265,7 +265,7 @@ Deleted when the \\[tex-region] or \\[tex-buffer] is next run, or when the
 tex shell terminates.")
 
 (defvar tex-command "tex"
-  "*Command to run TeX.
+  "Command to run TeX.
 If this string contains an asterisk \(`*'\), that is replaced by the file name;
 otherwise the value of `tex-start-options', the \(shell-quoted\)
 value of `tex-start-commands', and the file name are added at the end
@@ -476,46 +476,51 @@ An alternative value is \" . \", if you use a font with a narrow period."
                      '("input" "include" "includeonly" "bibliography"
                        "epsfig" "psfig" "epsf" "nofiles" "usepackage"
                        "documentstyle" "documentclass" "verbatiminput"
-                       "includegraphics" "includegraphics*"
-                       "url" "nolinkurl")
+                       "includegraphics" "includegraphics*")
                      t))
+           (verbish (regexp-opt '("url" "nolinkurl" "path") t))
           ;; Miscellany.
           (slash "\\\\")
           (opt " *\\(\\[[^]]*\\] *\\)*")
           ;; This would allow highlighting \newcommand\CMD but requires
           ;; adapting subgroup numbers below.
           ;; (arg "\\(?:{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)\\|\\\\[a-z*]+\\)"))
-          (arg "{\\(\\(?:[^{}\\]+\\|\\\\.\\|{[^}]*}\\)+\\)"))
-      (list
-       ;; display $$ math $$
-       ;; We only mark the match between $$ and $$ because the $$ delimiters
-       ;; themselves have already been marked (along with $..$) by syntactic
-       ;; fontification.  Also this is done at the very beginning so as to
-       ;; interact with the other keywords in the same way as $...$ does.
-       (list "\\$\\$\\([^$]+\\)\\$\\$" 1 'tex-math-face)
-       ;; Heading args.
-       (list (concat slash headings "\\*?" opt arg)
-            ;; If ARG ends up matching too much (if the {} don't match, e.g.)
-            ;; jit-lock will do funny things: when updating the buffer
-            ;; the re-highlighting is only done locally so it will just
-            ;; match the local line, but defer-contextually will
-            ;; match more lines at a time, so ARG will end up matching
-            ;; a lot more, which might suddenly include a comment
-            ;; so you get things highlighted bold when you type them
-            ;; but they get turned back to normal a little while later
-            ;; because "there's already a face there".
-            ;; Using `keep' works around this un-intuitive behavior as well
-            ;; as improves the behavior in the very rare case where you do
-            ;; have a comment in ARG.
-            3 'font-lock-function-name-face 'keep)
-       (list (concat slash "\\(?:provide\\|\\(?:re\\)?new\\)command\\** *\\(\\\\[A-Za-z@]+\\)")
-            1 'font-lock-function-name-face 'keep)
-       ;; Variable args.
-       (list (concat slash variables " *" arg) 2 'font-lock-variable-name-face)
-       ;; Include args.
-       (list (concat slash includes opt arg) 3 'font-lock-builtin-face)
-       ;; Definitions.  I think.
-       '("^[ \t]*\\\\def *\\\\\\(\\(\\w\\|@\\)+\\)"
+           (inbraces-re (lambda (re)
+                          (concat "\\(?:[^{}\\]\\|\\\\.\\|" re "\\)")))
+          (arg (concat "{\\(" (funcall inbraces-re "{[^}]*}") "+\\)")))
+      `( ;; Highlight $$math$$ and $math$.
+        ;; This is done at the very beginning so as to interact with the other
+        ;; keywords in the same way as comments and strings.
+        (,(concat "\\$\\$?\\(?:[^$\\{}]\\|\\\\.\\|{"
+                  (funcall inbraces-re
+                           (concat "{" (funcall inbraces-re "{[^}]*}") "*}"))
+                  "*}\\)+\\$?\\$")
+         (0 tex-math-face))
+        ;; Heading args.
+        (,(concat slash headings "\\*?" opt arg)
+         ;; If ARG ends up matching too much (if the {} don't match, e.g.)
+         ;; jit-lock will do funny things: when updating the buffer
+         ;; the re-highlighting is only done locally so it will just
+         ;; match the local line, but defer-contextually will
+         ;; match more lines at a time, so ARG will end up matching
+         ;; a lot more, which might suddenly include a comment
+         ;; so you get things highlighted bold when you type them
+         ;; but they get turned back to normal a little while later
+         ;; because "there's already a face there".
+         ;; Using `keep' works around this un-intuitive behavior as well
+         ;; as improves the behavior in the very rare case where you do
+         ;; have a comment in ARG.
+         3 font-lock-function-name-face keep)
+        (,(concat slash "\\(?:provide\\|\\(?:re\\)?new\\)command\\** *\\(\\\\[A-Za-z@]+\\)")
+         1 font-lock-function-name-face keep)
+        ;; Variable args.
+        (,(concat slash variables " *" arg) 2 font-lock-variable-name-face)
+        ;; Include args.
+        (,(concat slash includes opt arg) 3 font-lock-builtin-face)
+        ;; Verbatim-like args.
+        (,(concat slash verbish opt arg) 3 'tex-verbatim)
+        ;; Definitions.  I think.
+        ("^[ \t]*\\\\def *\\\\\\(\\(\\w\\|@\\)+\\)"
         1 font-lock-function-name-face))))
   "Subdued expressions to highlight in TeX modes.")
 
@@ -629,7 +634,7 @@ An alternative value is \" . \", if you use a font with a narrow period."
             (1 (tex-font-lock-suscript (match-beginning 0)) append))))
   "Experimental expressions to highlight in TeX modes.")
 
-(defvar tex-font-lock-keywords tex-font-lock-keywords-1
+(defconst tex-font-lock-keywords tex-font-lock-keywords-1
   "Default expressions to highlight in TeX modes.")
 
 (defvar tex-verbatim-environments
@@ -1219,7 +1224,7 @@ Entering SliTeX mode runs the hook `text-mode-hook', then the hook
   (set (make-local-variable 'font-lock-defaults)
        '((tex-font-lock-keywords tex-font-lock-keywords-1
          tex-font-lock-keywords-2 tex-font-lock-keywords-3)
-        nil nil ((?$ . "\"")) nil
+        nil nil nil nil
         ;; Who ever uses that anyway ???
         (font-lock-mark-block-function . mark-paragraph)
         (font-lock-syntactic-face-function
@@ -1492,8 +1497,8 @@ Puts point on a blank line between them."
 
 (defvar latex-complete-bibtex-cache nil)
 
-(defun latex-string-prefix-p (str1 str2)
-  (eq t (compare-strings str1 nil nil str2 0 (length str1))))
+(define-obsolete-function-alias 'latex-string-prefix-p
+  'string-prefix-p "24.2")
 
 (defvar bibtex-reference-key)
 (declare-function reftex-get-bibfile-list "reftex-cite.el" ())
@@ -1507,7 +1512,7 @@ Puts point on a blank line between them."
             keys)
         (if (and (eq (car latex-complete-bibtex-cache)
                      (reftex-get-bibfile-list))
-                 (latex-string-prefix-p (nth 1 latex-complete-bibtex-cache)
+                 (string-prefix-p (nth 1 latex-complete-bibtex-cache)
                                         key))
             ;; Use the cache.
             (setq keys (nth 2 latex-complete-bibtex-cache))
@@ -1543,8 +1548,8 @@ Puts point on a blank line between them."
   (save-excursion
     (let ((pt (point)))
       (skip-chars-backward "^ {}\n\t\\\\")
-      (case (char-before)
-        ((nil ?\s ?\n ?\t ?\}) nil)
+      (pcase (char-before)
+        ((or `nil ?\s ?\n ?\t ?\}) nil)
         (?\\
          ;; TODO: Complete commands.
          nil)
@@ -1793,7 +1798,7 @@ Mark is left at original location."
        (if (not (eq (char-syntax (preceding-char)) ?/))
            (progn
              ;; Don't count single-char words.
-             (unless (looking-at ".\\>") (incf count))
+             (unless (looking-at ".\\>") (cl-incf count))
              (forward-char 1))
          (let ((cmd
                 (buffer-substring-no-properties
@@ -1984,8 +1989,7 @@ If NOT-ALL is non-nil, save the `.dvi' file."
       (let* ((dir (file-name-directory tex-last-temp-file))
             (list (and (file-directory-p dir)
                        (file-name-all-completions
-                        (file-name-sans-extension
-                         (file-name-nondirectory tex-last-temp-file))
+                        (file-name-base tex-last-temp-file)
                         dir))))
        (while list
          (if not-all
@@ -2051,10 +2055,7 @@ IN can be either a string (with the same % escapes in it) indicating
 OUT describes the output file and is either a %-escaped string
   or nil to indicate that there is no output file.")
 
-;; defsubst* gives better byte-code than defsubst.
-(defsubst* tex-string-prefix-p (str1 str2)
-  "Return non-nil if STR1 is a prefix of STR2"
-  (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
+(define-obsolete-function-alias 'tex-string-prefix-p 'string-prefix-p "24.2")
 
 (defun tex-guess-main-file (&optional all)
   "Find a likely `tex-main-file'.
@@ -2069,7 +2070,7 @@ of the current buffer."
        (with-current-buffer buf
          (when (and (cond
                      ((null all) (equal dir default-directory))
-                     ((eq all 'sub) (tex-string-prefix-p default-directory dir))
+                     ((eq all 'sub) (string-prefix-p default-directory dir))
                      (t))
                     (stringp tex-main-file))
            (throw 'found (expand-file-name tex-main-file)))))
@@ -2078,7 +2079,7 @@ of the current buffer."
        (with-current-buffer buf
          (when (and (cond
                      ((null all) (equal dir default-directory))
-                     ((eq all 'sub) (tex-string-prefix-p default-directory dir))
+                     ((eq all 'sub) (string-prefix-p default-directory dir))
                      (t))
                     buffer-file-name
                     ;; (or (easy-mmode-derived-mode-p 'latex-mode)
@@ -2689,7 +2690,9 @@ Runs the shell command defined by `tex-show-queue-command'."
   "Syntax table used while computing indentation.")
 
 (defun latex-indent (&optional arg)
-  (if (and (eq (get-text-property (line-beginning-position) 'face)
+  (if (and (eq (get-text-property (if (and (eobp) (bolp))
+                                      (max (point-min) (1- (point)))
+                                    (line-beginning-position)) 'face)
               'tex-verbatim))
       'noindent
     (with-syntax-table tex-latex-indent-syntax-table
@@ -2863,10 +2866,10 @@ There might be text before point."
        (cons (append (car font-lock-defaults) '(doctex-font-lock-keywords))
              (mapcar
               (lambda (x)
-                (case (car-safe x)
-                  (font-lock-syntactic-face-function
+                (pcase (car-safe x)
+                  (`font-lock-syntactic-face-function
                    (cons (car x) 'doctex-font-lock-syntactic-face-function))
-                  (t x)))
+                  (_ x)))
               (cdr font-lock-defaults))))
   (set (make-local-variable 'syntax-propertize-function)
        (syntax-propertize-rules doctex-syntax-propertize-rules)))
index 3ec59ebcd3e79a35392522326242cc3a66e5c566..cb87c1198f973d2780e3dd8cd46ca869098ce946 100644 (file)
@@ -93,7 +93,7 @@ If optional argument HERE is non-nil, insert info at point."
     (@unnumberedsubsubsec . @unnumberedsubsec)
     (@subsubheading . @subheading)
     (@appendixsubsubsec . @appendixsubsec))
-  "*An alist of next higher levels for chapters, sections, etc...
+  "An alist of next higher levels for chapters, sections, etc...
 For example, section to chapter, subsection to section.
 Used by `texinfo-raise-lower-sections'.
 The keys specify types of section; the values correspond to the next
@@ -121,7 +121,7 @@ higher types.")
     (@unnumberedsubsubsec . @unnumberedsubsubsec)
     (@subsubheading . @subsubheading)
     (@appendixsubsubsec . @appendixsubsubsec))
-  "*An alist of next lower levels for chapters, sections, etc...
+  "An alist of next lower levels for chapters, sections, etc...
 For example, chapter to section, section to subsection.
 Used by `texinfo-raise-lower-sections'.
 The keys specify types of section; the values correspond to the next
@@ -174,7 +174,7 @@ and don't split the file if large.  You can use `Info-tagify' and
                         "done.  Now save it." "done.")))))
 
 (defvar texinfo-region-buffer-name "*Info Region*"
-  "*Name of the temporary buffer used by \\[texinfo-format-region].")
+  "Name of the temporary buffer used by \\[texinfo-format-region].")
 
 (defvar texinfo-pre-format-hook nil
   "Hook called before the conversion of the Texinfo file to Info format.
@@ -1918,7 +1918,7 @@ Used by @refill indenting command to avoid indenting within lists, etc.")
 ;; Texinfo commands.
 
 (defvar texinfo-extra-inter-column-width 0
-  "*Number of extra spaces between entries (columns) in @multitable.")
+  "Number of extra spaces between entries (columns) in @multitable.")
 
 (defvar texinfo-multitable-buffer-name "*multitable-temporary-buffer*")
 (defvar texinfo-multitable-rectangle-name "texinfo-multitable-temp-")
@@ -2957,6 +2957,28 @@ Default is to leave paragraph indentation as is."
     ("pg" . texinfo-format-pindex)
     ("ky" . texinfo-format-kindex)))
 
+\f
+;;; Sort and index
+
+;; Sort an index which is in the current buffer between START and END.
+(defun texinfo-sort-region (start end)
+  (require 'sort)
+  (save-restriction
+    (narrow-to-region start end)
+    (goto-char (point-min))
+    (sort-subr nil 'forward-line 'end-of-line 'texinfo-sort-startkeyfun)))
+
+;; Subroutine for sorting an index.
+;; At start of a line, return a string to sort the line under.
+(defun texinfo-sort-startkeyfun ()
+  (let ((line (buffer-substring-no-properties (point) (line-end-position))))
+    ;; Canonicalize whitespace and eliminate funny chars.
+    (while (string-match "[ \t][ \t]+\\|[^a-z0-9 ]+" line)
+      (setq line (concat (substring line 0 (match-beginning 0))
+                         " "
+                         (substring line (match-end 0)))))
+    line))
+
 \f
 ;;; @printindex
 
@@ -2974,7 +2996,7 @@ Default is to leave paragraph indentation as is."
     (insert "\n* Menu:\n\n")
     (setq opoint (point))
     (texinfo-print-index nil indexelts)
-    (shell-command-on-region opoint (point) "sort -fd" 1)))
+    (texinfo-sort-region opoint (point))))
 
 (defun texinfo-print-index (file indexelts)
   (while indexelts
index 31af2e72699b91510d7e345c5c4528f12dc70eb9..4e7715dcea9ac83ac6da541075890f13f41ddd60 100644 (file)
@@ -32,7 +32,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'tex-mode) (require 'cl))
+(eval-when-compile (require 'tex-mode))
 (defvar outline-heading-alist)
 
 (defgroup texinfo nil
index 83ef834257a2e8129dd564e882dc31a49101738d..70aa17cea6ba6eb9c6f5314380555eacd02019d5 100644 (file)
@@ -203,7 +203,7 @@ It comes after the chapter-level menu entries.")
     (3 . (concat "\\(^@\\)\\(" texinfo-section-level-regexp "\\)\\>[ \t]*"))
     (4 . (concat "\\(^@\\)\\(" texinfo-subsection-level-regexp "\\)\\>[ \t]+"))
     (5 . (concat "\\(^@\\)\\(" texinfo-subsubsection-level-regexp "\\)\\>[ \t]+")))
-  "*Regexps for searching for same level sections in a Texinfo file.
+  "Regexps for searching for same level sections in a Texinfo file.
 The keys are strings specifying the general hierarchical level in the
 document; the values are regular expressions.")
 
@@ -231,7 +231,7 @@ document; the values are regular expressions.")
       "\\|"
       texinfo-chapter-level-regexp
       "\\)\\>[ \t]*\\)")))
-  "*Regexps for searching for higher level sections in a Texinfo file.
+  "Regexps for searching for higher level sections in a Texinfo file.
 The keys are strings specifying the general hierarchical level in the
 document; the values are regular expressions.")
 
@@ -270,7 +270,7 @@ document; the values are regular expressions.")
       "\\)\\>[ \t]+\\)"))
     ;; There's nothing below 5, use a bogus regexp that can't match.
     (5 . "a\\(^\\)"))
-  "*Regexps for searching for lower level sections in a Texinfo file.
+  "Regexps for searching for lower level sections in a Texinfo file.
 The keys are strings specifying the general hierarchical level in the
 document; the values are regular expressions.")
 
@@ -682,7 +682,7 @@ node within the section."
 
 ;; try 32, but perhaps 24 is better
 (defvar texinfo-column-for-description 32
-  "*Column at which descriptions start in a Texinfo menu.")
+  "Column at which descriptions start in a Texinfo menu.")
 
 (defun texinfo-insert-menu (menu-list node-name)
   "Insert formatted menu at point.
index 5552eff71867950f50ca6f580091bcee18e0da20..583e4a4d35d89d4344d161dfa27e1f12832c178c 100644 (file)
@@ -51,7 +51,7 @@
 
 
 (defgroup tildify nil
-  "Adding missing hard spaces or other text fragments into texts."
+  "Add hard spaces or other text fragments to text buffers."
   :version "21.1"
   :group 'wp)
 
index 40cbbc59292a781b42e7f43a726d6424fbe12d03..8a4fe4f87fd525ef2df778a674d43cd7fb8d99cb 100644 (file)
 
 
 ;;; Code:
-\f
+(defgroup two-column nil
+  "Minor mode for editing of two-column text."
+  :prefix "2C-"
+  :group 'frames)
+
+(defcustom 2C-mode-line-format
+       '("-%*- %15b --"  (-3 . "%p")  "--%[("  mode-name
+         minor-mode-alist  "%n"  mode-line-process  ")%]%-")
+  "Value of `mode-line-format' for a buffer in two-column minor mode."
+  :type 'sexp
+  :group 'two-column)
+
+(defcustom 2C-other-buffer-hook 'text-mode
+  "Hook run in new buffer when it is associated with current one."
+  :type 'function
+  :group 'two-column)
 
-;; Lucid patch
-(or (fboundp 'frame-width)
-    (fset 'frame-width 'screen-width))
+(defcustom 2C-separator ""
+  "A string inserted between the two columns when merging.
+This gets set locally by \\[2C-split]."
+  :type 'string
+  :group 'two-column)
+(put '2C-separator 'permanent-local t)
+
+(defcustom 2C-window-width 40
+  "The width of the first column.  (Must be at least `window-min-width'.)
+This value is local for every buffer that sets it."
+  :type 'integer
+  :group 'two-column)
+(make-variable-buffer-local '2C-window-width)
+(put '2C-window-width 'permanent-local t)
 
+(defcustom 2C-beyond-fill-column 4
+  "Base for calculating `fill-column' for a buffer in two-column minor mode.
+The value of `fill-column' becomes `2C-window-width' for this buffer
+minus this value."
+  :type 'integer
+  :group 'two-column)
 
-;;;;; Set up keymap ;;;;;
+(defcustom 2C-autoscroll t
+  "If non-nil, Emacs attempts to keep the two column's buffers aligned."
+  :type 'boolean
+  :group 'two-column)
 
+\f
 (defvar 2C-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "2" '2C-two-columns)
     map)
   "Keymap for commands for setting up two-column mode.")
 
-
-
 ;;;###autoload (autoload '2C-command "two-column" () t 'keymap)
 (fset '2C-command 2C-mode-map)
 
 
 ;;;###autoload (global-set-key [f2] '2C-command)
 
-
 (defvar 2C-minor-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "1" '2C-merge)
     map)
   "Keymap for commands for use in two-column mode.")
 
-
 (setq minor-mode-map-alist
       (cons (cons '2C-mode
                  (let ((map (make-sparse-keymap)))
                                               map (current-global-map))
                    map))
            minor-mode-map-alist))
-\f
-;;;;; variable declarations ;;;;;
-
-(defgroup two-column nil
-  "Minor mode for editing of two-column text."
-  :prefix "2C-"
-  :group 'frames)
-
 
+\f
 ;; Markers seem to be the only buffer-id not affected by renaming a buffer.
 ;; This nevertheless loses when a buffer is killed.  The variable-name is
 ;; required by `describe-mode'.
 (make-variable-buffer-local '2C-mode)
 (put '2C-mode 'permanent-local t)
 
-
-
 (setq minor-mode-alist (cons '(2C-mode " 2C") minor-mode-alist))
 
-
-
-;; rearranged, so that the pertinent info will show in 40 columns
-(defcustom 2C-mode-line-format
-       '("-%*- %15b --"  (-3 . "%p")  "--%[("  mode-name
-         minor-mode-alist  "%n"  mode-line-process  ")%]%-")
-  "Value of `mode-line-format' for a buffer in two-column minor mode."
-  :type 'sexp
-  :group 'two-column)
-
-
-(defcustom 2C-other-buffer-hook 'text-mode
-  "Hook run in new buffer when it is associated with current one."
-  :type 'function
-  :group 'two-column)
-
-
-(defcustom 2C-separator ""
-  "A string inserted between the two columns when merging.
-This gets set locally by \\[2C-split]."
-  :type 'string
-  :group 'two-column)
-(put '2C-separator 'permanent-local t)
-
-
-
-(defcustom 2C-window-width 40
-  "The width of the first column.  (Must be at least `window-min-width')
-This value is local for every buffer that sets it."
-  :type 'integer
-  :group 'two-column)
-(make-variable-buffer-local '2C-window-width)
-(put '2C-window-width 'permanent-local t)
-
-
-
-(defcustom 2C-beyond-fill-column 4
-  "Base for calculating `fill-column' for a buffer in two-column minor mode.
-The value of `fill-column' becomes `2C-window-width' for this buffer
-minus this value."
-  :type 'integer
-  :group 'two-column)
-
-
-
-(defcustom 2C-autoscroll t
-  "If non-nil, Emacs attempts to keep the two column's buffers aligned."
-  :type 'boolean
-  :group 'two-column)
-
-
-
 (defvar 2C-autoscroll-start nil)
 (make-variable-buffer-local '2C-autoscroll-start)
 \f
@@ -276,7 +247,6 @@ minus this value."
       (if req (error "You must first set two-column minor mode"))))
 
 
-
 ;; function for setting up two-column minor mode in a buffer associated
 ;; with the buffer pointed to by the marker other.
 (defun 2C-mode (other)
@@ -320,7 +290,6 @@ The appearance of the screen can be customized by the variables
   (run-hooks '2C-mode-hook))
 
 
-
 ;;;###autoload
 (defun 2C-two-columns (&optional buffer)
   "Split current window vertically for two-column editing.
@@ -356,7 +325,6 @@ first and the associated buffer to its right."
               (other-window -1)))))
 
 
-
 ;;;###autoload
 (defun 2C-associate-buffer ()
   "Associate another buffer with this one in two-column minor mode.
@@ -368,9 +336,8 @@ accepting the proposed default buffer.
   (let ((b1 (current-buffer))
        (b2 (or (2C-other)
                (read-buffer "Associate buffer: " (other-buffer)))))
-    (save-excursion
-      (setq 2C-mode nil)
-      (set-buffer b2)
+    (setq 2C-mode nil)
+    (with-current-buffer b2
       (and (2C-other)
           (not (eq b1 (2C-other)))
           (error "Buffer already associated with buffer `%s'"
@@ -382,7 +349,6 @@ accepting the proposed default buffer.
     (2C-two-columns b2)))
 
 
-
 ;;;###autoload
 (defun 2C-split (arg)
   "Split a two-column text at point, into two buffers in two-column minor mode.
@@ -454,32 +420,28 @@ First column's text    sSs  Second column's text
        (move-to-column column)))))
 
 
-
-
 (defun 2C-dissociate ()
   "Turn off two-column minor mode in current and associated buffer.
 If the associated buffer is unmodified and empty, it is killed."
   (interactive)
-  (let ((buffer (current-buffer)))
-    (save-excursion
-      (and (2C-other)
-          (set-buffer (2C-other))
-          (or (not (2C-other))
-              (eq buffer (2C-other)))
-          (if (and (not (buffer-modified-p))
-                   (eobp) (bobp))
-              (kill-buffer nil)
-            (kill-local-variable '2C-mode)
-            (kill-local-variable '2C-window-width)
-            (kill-local-variable '2C-separator)
-            (kill-local-variable 'mode-line-format)
-            (kill-local-variable 'fill-column))))
-    (kill-local-variable '2C-mode)
-    (kill-local-variable '2C-window-width)
-    (kill-local-variable '2C-separator)
-    (kill-local-variable 'mode-line-format)
-    (kill-local-variable 'fill-column)))
-
+  (let ((buffer (current-buffer))
+       (other (2C-other)))
+    (if other
+       (with-current-buffer other
+         (when (or (not (2C-other)) (eq buffer (2C-other)))
+           (if (and (not (buffer-modified-p)) (zerop (buffer-size)))
+               (kill-buffer)
+             (kill-local-variable '2C-mode)
+             (kill-local-variable '2C-window-width)
+             (kill-local-variable '2C-separator)
+             (kill-local-variable 'mode-line-format)
+             (kill-local-variable 'fill-column))))))
+  (kill-local-variable '2C-mode)
+  (kill-local-variable '2C-window-width)
+  (kill-local-variable '2C-separator)
+  (kill-local-variable 'mode-line-format)
+  (kill-local-variable 'fill-column)
+  (force-mode-line-update))
 
 
 ;; this doesn't use yank-rectangle, so that the first column can
@@ -578,7 +540,6 @@ on, this also realigns the two buffers."
     (message "Autoscrolling is off.")))
 
 
-
 (defun 2C-autoscroll ()
   (if 2C-autoscroll
       ;; catch a mouse scroll on non-selected scrollbar
@@ -590,27 +551,25 @@ on, this also realigns the two buffers."
              (select-window (car (car (cdr last-command-event)))))
         ;; In some cases scrolling causes an error, but post-command-hook
         ;; shouldn't, and should always stay in the original window
-        (condition-case ()
-            (and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil)
-                 (/= (window-start) 2C-autoscroll-start)
-                 (2C-other)
-                 (get-buffer-window (2C-other))
-                 (let ((lines (count-lines (window-start)
-                                           2C-autoscroll-start)))
-                   (if (< (window-start) 2C-autoscroll-start)
-                       (setq lines (- lines)))
-                   (setq 2C-autoscroll-start (window-start))
-                   (select-window (get-buffer-window (2C-other)))
-                   ;; make sure that other buffer has enough lines
-                   (save-excursion
-                     (insert-char
-                      ?\n (- lines (count-lines (window-start)
-                                                (goto-char (point-max)))
-                             -1)))
-                   (scroll-up lines)
-                   (setq 2C-autoscroll-start (window-start))))
-          (error))))))
-
+        (ignore-errors
+          (and (or 2C-autoscroll-start (2C-toggle-autoscroll t) nil)
+               (/= (window-start) 2C-autoscroll-start)
+               (2C-other)
+               (get-buffer-window (2C-other))
+               (let ((lines (count-lines (window-start)
+                                         2C-autoscroll-start)))
+                 (if (< (window-start) 2C-autoscroll-start)
+                     (setq lines (- lines)))
+                 (setq 2C-autoscroll-start (window-start))
+                 (select-window (get-buffer-window (2C-other)))
+                 ;; make sure that other buffer has enough lines
+                 (save-excursion
+                   (insert-char
+                    ?\n (- lines (count-lines (window-start)
+                                              (goto-char (point-max)))
+                           -1)))
+                 (scroll-up lines)
+                 (setq 2C-autoscroll-start (window-start)))))))))
 
 
 (defun 2C-enlarge-window-horizontally (arg)
@@ -628,7 +587,6 @@ on, this also realigns the two buffers."
   (2C-enlarge-window-horizontally (- arg)))
 
 
-
 (provide 'two-column)
 
 ;;; two-column.el ends here
index 1600785c1173d8f3c691f117fc8268d66e6c68e6..57bbdf9d94ad83403c343d16ebdb4e1b48ace0c8 100644 (file)
@@ -457,6 +457,7 @@ backwards ARG times if negative."
 With prefix argument ARG, do it ARG times if positive, or move
 backwards ARG times if negative."
   (interactive "p")
+  (or arg (setq arg 1))
   (while (< arg 0)
     (skip-syntax-backward
      (char-to-string (char-syntax (char-before))))
index c7fa5927e48724fe3522f433c8831a07099c7f6b..8d43b565416e64391303a4e5785b685fb40145a0 100644 (file)
@@ -465,7 +465,7 @@ update which can wait for the next redisplay."
          (seconds (substring time 17 19))
          (time-zone (car (cdr (current-time-zone now))))
          (day (substring time 8 10))
-         (year (substring time 20 24))
+         (year (format-time-string "%Y" now))
          (monthname (substring time 4 7))
          (month
           (cdr
index 00e69aa39cc02fadf07545a4fedda8c6a38281d9..5762f0193152f736de7bf6272f9a85b5dfa4fc45 100644 (file)
@@ -51,7 +51,7 @@
     ("GMT-4"  .  -400) ("GMT-5"  .  -500) ("GMT-6"  .  -600)
     ("GMT-7"  .  -700) ("GMT-8"  .  -800) ("GMT-9"  .  -900)
     ("GMT-10" . -1000) ("GMT-11" . -1100) ("GMT-12" . -1200))
-  "*Time differentials of timezone from GMT in +-HHMM form.
+  "Time differentials of timezone from GMT in +-HHMM form.
 This list is obsolescent, and is present only for backwards compatibility,
 because time zone names are ambiguous in practice.
 Use `current-time-zone' instead.")
index 2a0d1d3d7de1e92290965a8a326937a80934258b..4bc1c9af99a072394713e43cdbc5763eabdf7d88 100644 (file)
@@ -165,14 +165,13 @@ Its value should be an event that has a binding in MENU."
     ;; tmm-km-list is an alist of (STRING . MEANING).
     ;; It has no other elements.
     ;; The order of elements in tmm-km-list is the order of the menu bar.
-    (mapc (lambda (elt)
-            (cond
-             ((stringp elt) (setq gl-str elt))
-             ((listp elt) (tmm-get-keymap elt not-menu))
-             ((vectorp elt)
-              (dotimes (i (length elt))
-                (tmm-get-keymap (cons i (aref elt i)) not-menu)))))
-          menu)
+    (dolist (elt menu)
+      (cond
+       ((stringp elt) (setq gl-str elt))
+       ((listp elt) (tmm-get-keymap elt not-menu))
+       ((vectorp elt)
+        (dotimes (i (length elt))
+          (tmm-get-keymap (cons i (aref elt i)) not-menu)))))
     ;; Choose an element of tmm-km-list; put it in choice.
     (if (and not-menu (= 1 (length tmm-km-list)))
        ;; If this is the top-level of an x-popup-menu menu,
@@ -230,8 +229,7 @@ Its value should be an event that has a binding in MENU."
                               (- (* 2 history-len) index-of-default))))))))
       (setq choice (cdr (assoc out tmm-km-list)))
       (and (null choice)
-          (> (length out) (length tmm-c-prompt))
-          (string= (substring out 0 (length tmm-c-prompt)) tmm-c-prompt)
+           (string-prefix-p tmm-c-prompt out)
           (setq out (substring out (length tmm-c-prompt))
                 choice (cdr (assoc out tmm-km-list))))
       (and (null choice) out
@@ -313,15 +311,13 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
 (defun tmm-define-keys (minibuffer)
   (let ((map (make-sparse-keymap)))
     (suppress-keymap map t)
-    (mapc
-     (lambda (c)
-       (if (listp tmm-shortcut-style)
-          (define-key map (char-to-string c) 'tmm-shortcut)
-        ;; only one kind of letters are shortcuts, so map both upcase and
-        ;; downcase input to the same
-        (define-key map (char-to-string (downcase c)) 'tmm-shortcut)
-        (define-key map (char-to-string (upcase c)) 'tmm-shortcut)))
-     tmm-short-cuts)
+    (dolist (c tmm-short-cuts)
+      (if (listp tmm-shortcut-style)
+          (define-key map (char-to-string c) 'tmm-shortcut)
+        ;; only one kind of letters are shortcuts, so map both upcase and
+        ;; downcase input to the same
+        (define-key map (char-to-string (downcase c)) 'tmm-shortcut)
+        (define-key map (char-to-string (upcase c)) 'tmm-shortcut)))
     (if minibuffer
        (progn
           (define-key map [pageup] 'tmm-goto-completions)
@@ -333,9 +329,9 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
       (use-local-map (append map (current-local-map))))))
 
 (defun tmm-completion-delete-prompt ()
-  (set-buffer standard-output)
+  (with-current-buffer standard-output
   (goto-char (point-min))
-  (delete-region (point) (search-forward "Possible completions are:\n")))
+    (delete-region (point) (search-forward "Possible completions are:\n"))))
 
 (defun tmm-remove-inactive-mouse-face ()
   "Remove the mouse-face property from inactive menu items."
@@ -354,38 +350,24 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
     (set-buffer-modified-p nil)))
 
 (defun tmm-add-prompt ()
-  (add-hook 'minibuffer-exit-hook 'tmm-delete-map nil t)
   (unless tmm-c-prompt
     (error "No active menu entries"))
   (setq tmm-old-mb-map (tmm-define-keys t))
   ;; Get window and hide it for electric mode to get correct size
-  (save-window-excursion
-    (let ((completions
-           (mapcar 'car minibuffer-completion-table)))
-      (or tmm-completion-prompt
-          (add-hook 'completion-setup-hook
-                    'tmm-completion-delete-prompt 'append))
-      (unwind-protect
-          (with-output-to-temp-buffer "*Completions*"
-            (display-completion-list completions))
-        (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt)))
-    (set-buffer "*Completions*")
+  (or tmm-completion-prompt
+      (add-hook 'completion-setup-hook
+                'tmm-completion-delete-prompt 'append))
+  (unwind-protect
+      (minibuffer-completion-help)
+    (remove-hook 'completion-setup-hook 'tmm-completion-delete-prompt))
+  (with-current-buffer "*Completions*"
     (tmm-remove-inactive-mouse-face)
     (when tmm-completion-prompt
-      (let ((buffer-read-only nil))
-        (goto-char (point-min))
-        (insert tmm-completion-prompt))))
-  (save-selected-window
-    (other-window 1)                   ; Electric-pop-up-window does
-                                       ; not work in minibuffer
-    (Electric-pop-up-window "*Completions*"))
+      (let ((inhibit-read-only t))
+       (goto-char (point-min))
+       (insert tmm-completion-prompt))))
   (insert tmm-c-prompt))
 
-(defun tmm-delete-map ()
-  (remove-hook 'minibuffer-exit-hook 'tmm-delete-map t)
-  (if tmm-old-mb-map
-      (use-local-map tmm-old-mb-map)))
-
 (defun tmm-shortcut ()
   "Choose the shortcut that the user typed."
   (interactive)
@@ -401,14 +383,13 @@ Stores a list of all the shortcuts in the free variable `tmm-short-cuts'."
              (choose-completion))
          ;; In minibuffer
          (delete-region (minibuffer-prompt-end) (point-max))
-         (mapc (lambda (elt)
-                 (if (string=
-                      (substring (car elt) 0
-                                 (min (1+ (length tmm-mid-prompt))
-                                      (length (car elt))))
-                      (concat (char-to-string c) tmm-mid-prompt))
-                     (setq s (car elt))))
-                 tmm-km-list)
+         (dolist (elt tmm-km-list)
+            (if (string=
+                 (substring (car elt) 0
+                            (min (1+ (length tmm-mid-prompt))
+                                 (length (car elt))))
+                 (concat (char-to-string c) tmm-mid-prompt))
+                (setq s (car elt))))
          (insert s)
          (exit-minibuffer)))))
 
@@ -524,6 +505,10 @@ of `menu-bar-final-items'."
        (progn
          ;; Otherwise, it is a prefix, so make a list of the subcommands.
          ;; Make a list of all the bindings in all the keymaps.
+          ;; FIXME: we'd really like to just use `key-binding' now that it
+          ;; returns a keymap that contains really all the bindings under that
+          ;; prefix, but `keyseq' is always [menu-bar], so the desired order of
+          ;; the bindings is difficult to recover.
          (setq minorbind (mapcar 'cdr (minor-mode-key-binding keyseq)))
          (setq localbind (local-key-binding keyseq))
          (setq globalbind (copy-sequence (cdr (global-key-binding keyseq))))
@@ -540,20 +525,16 @@ of `menu-bar-final-items'."
          (setq allbind (cons globalbind (cons localbind minorbind)))
 
          ;; Merge all the elements of ALLBIND into one keymap.
-         (mapc (lambda (in)
-                 (if (and (symbolp in) (keymapp in))
-                     (setq in (symbol-function in)))
-                 (and in (keymapp in)
-                      (if (keymapp bind)
-                          (setq bind (nconc bind (copy-sequence (cdr in))))
-                        (setq bind (copy-sequence in)))))
-                 allbind)
+         (dolist (in allbind)
+            (if (and (symbolp in) (keymapp in))
+                (setq in (symbol-function in)))
+            (and in (keymapp in)
+                 (setq bind (if (keymapp bind)
+                                (nconc bind (copy-sequence (cdr in)))
+                              (copy-sequence in)))))
          ;; Return that keymap.
          bind))))
 
-;; Huh?  What's that about?  --Stef
-(add-hook 'calendar-load-hook (lambda () (require 'cal-menu)))
-
 (provide 'tmm)
 
 ;;; tmm.el ends here
index 1fab25fe5cdb03eebfa5d3a80b6ce44c6afb7c4c..9d0fbaae9d84335e1b77b440dd047e95dab6faee 100644 (file)
@@ -154,6 +154,8 @@ This variable is obsolete; instead of setting it to t, disable
 \f
 ;;; Variables that are not customizable.
 
+(define-obsolete-variable-alias 'tooltip-hook 'tooltip-functions "23.1")
+
 (defvar tooltip-functions nil
   "Functions to call to display tooltips.
 Each function is called with one argument EVENT which is a copy
@@ -161,8 +163,6 @@ of the last mouse movement event that occurred.  If one of these
 functions displays the tooltip, it should return non-nil and the
 rest are not called.")
 
-(define-obsolete-variable-alias 'tooltip-hook 'tooltip-functions "23.1")
-
 (defvar tooltip-timeout-id nil
   "The id of the timeout started when Emacs becomes idle.")
 
index d1150d52f3f4396bba7aca062bced0d7ba160151..0dd0203e0984e9d6396b4d0ea671ded7d22cc2e2 100644 (file)
 ;;
 
 ;;; Code:
-(eval-when-compile (require 'cl))
 (require 'wid-edit)
 \f
 ;;; Customization
index b512700f5b93eb13b5a6b4c8f2f5ade5c4e04ee9..e0e2a82fab96aa81d00e164d842ba74ca04d1aa2 100644 (file)
@@ -585,7 +585,6 @@ with some explanatory links."
           (not (get-text-property (match-beginning 1) 'tutorial-remark))
           (let* ((desc    (car changed-key))
                  (ck      (cdr changed-key))
-                 (key     (nth 0 ck))
                  (def-fun (nth 1 ck))
                  (where   (nth 3 ck))
                  s1 s2 help-string)
@@ -724,7 +723,7 @@ See `tutorial--save-tutorial' for more information."
                            saved-file
                            (error-message-string err))))
             ;; An error is raised here?? Is this a bug?
-            (condition-case err
+            (condition-case nil
                 (undo-only)
               (error nil))
             ;; Restore point
index ee64fde1c67ab0c7dc43962b57f009a5e211dd4d..f0c81125f0c0fe7c222154784ac0e5a356130d50 100644 (file)
@@ -241,7 +241,7 @@ remove themselves after running.")
     (""
      type-break-mode-line-break-message
      type-break-mode-line-warning))
-  "*Format of messages in the mode line concerning typing breaks.")
+  "Format of messages in the mode line concerning typing breaks.")
 
 (defvar type-break-mode-line-break-message
   '(type-break-mode-line-break-message-p
index 520c4b847dda49435593de725e83ac24963fcb38..3619d499419fd413b3ab8e33bd84928d69aed4f8 100644 (file)
@@ -83,7 +83,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;; User-visible variables
 
@@ -174,7 +174,7 @@ contains the name of the directory which the buffer is visiting.")
 ;;; Utilities
 
 ;; uniquify-fix-list data structure
-(defstruct (uniquify-item
+(cl-defstruct (uniquify-item
            (:constructor nil) (:copier nil)
            (:constructor uniquify-make-item
             (base dirname buffer &optional proposed)))
@@ -340,7 +340,7 @@ in `uniquify-list-buffers-directory-modes', otherwise returns nil."
 
 (defun uniquify-get-proposed-name (base dirname &optional depth)
   (unless depth (setq depth uniquify-min-dir-content))
-  (assert (equal (directory-file-name dirname) dirname))  ;No trailing slash.
+  (cl-assert (equal (directory-file-name dirname) dirname)) ;No trailing slash.
 
   ;; Distinguish directories by adding extra separator.
   (if (and uniquify-trailing-separator-p
index 685f32505b1397b42c97161e08928c0936076fe8..0fc48907f40db4862cd146c50b99c12eaef38f1e 100644 (file)
-2012-06-23  Leo Liu  <sdl.web@gmail.com>
+2012-07-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * url.el, url-queue.el, url-parse.el, url-http.el, url-future.el:
+       * url-dav.el, url-cookie.el: Use cl-lib.
+       * url-util.el, url-privacy.el, url-nfs.el, url-misc.el, url-methods.el:
+       * url-gw.el, url-file.el, url-expand.el: Dont use CL.
+
+2012-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * url-vars.el (mm-mime-mule-charset-alist, mm-coding-system-p):
+       Declare.
+
+2012-06-21  Chong Yidong  <cyd@gnu.org>
+
+       * url.el (url-retrieve-internal): Fix last change (Bug#11627).
+
+2012-06-13  Juanma Barranquero  <lekktu@gmail.com>
+
+       * url-handlers.el (url-handler-regexp): Declare.
+
+2012-06-12  Chong Yidong  <cyd@gnu.org>
+
+       * url-handlers.el: Re-order file to avoid recursive load.
+
+2012-06-12  Chong Yidong  <cyd@gnu.org>
+
+       * url-handlers.el (url-handler-regexp):
+       * url-nfs.el (url-nfs-automounter-directory-spec):
+       * url-vars.el (url-load-hook): Convert to defcustom.
+
+2012-05-25  Leo Liu  <sdl.web@gmail.com>
 
        * url-http.el (url-http-codes): Fix mal-formed defconst.
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-05-15  Ian Eure  <ian@simplegeo.com>
+
+       * url-util.el (url-build-query-string): New function (Bug#8706).
+       (url-parse-query-string): Allow that '=' is not required and split
+       URL parameters on ';', not just '&'.
+
+2012-05-14  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * url-expand.el (url-default-expander): Copy over the fullness of
+       the new URL object based on the definition URL object.
+
+2012-05-10  Chong Yidong  <cyd@gnu.org>
+
+       * url-parse.el (url-path-and-query, url-port-if-non-default): New
+       functions.
+       (url-generic-parse-url): Don't set the portspec slot if it is not
+       specified; that is what `url-port' is for.
+       (url-port): Only require the scheme to be specified to call
+       url-scheme-get-property.
 
-       * Version 24.1 released.
+       * url-util.el (url-encode-url): Use url-path-and-query.
+
+       * url-vars.el (url-mime-charset-string): Load mm-util lazily.
+
+2012-05-09  Chong Yidong  <cyd@gnu.org>
+
+       * url-util.el (url-encode-url): New function for URL quoting.
+       (url-encoding-table, url-host-allowed-chars)
+       (url-path-allowed-chars): New constants.
+       (url--allowed-chars): New helper function.  Use upper-case.
+       (url-hexify-string): Use them.
+
+       * url-parse.el: Improve RFC 3986 conformance.
+       (url-generic-parse-url): Do not populate the ATTRIBUTES slot,
+       since this is not reliable for general RFC 3986 URIs.  Keep the
+       whole path and query inside the FILENAME slot.  Improve docstring.
+       (url-recreate-url-attributes): Mark as obsolete.
+       (url-recreate-url): Handle missing scheme and userinfo.
+       (url-path-and-query): New function.
+
+       * url-http.el (url-http-create-request): Ignore obsolete
+       attributes slot of url-object.
+
+       * url-vars.el (url-nonrelative-link): Make the regexp stricter.
+
+       * url.el (url-retrieve-internal): Use url-encode-url (Bug#7017).
+
+2012-04-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * url.el (url-retrieve-synchronously): Replace lexical-let by
+       lexical-binding.
+
+2012-04-10  William Xu  <william.xwl@gmail.com>  (tiny change)
+
+       * url.el (url-retrieve-internal): Hexify multibye URL string first
+       when necessary (bug#7017).
+
+2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * url.el (url-retrieve-internal): Mention utf-8 encoding.
+       (url-retrieve): Ditto.
+
+2012-04-10  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * url-domsurf.el: New file (bug#1401).
+
+       * url-cookie.el (url-cookie-two-dot-domains): Remove.
+       (url-cookie-host-can-set-p): Use `url-domsuf-cookie-allowed-p'
+       instead of the variable above.
 
 2012-03-25  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 
 2012-03-11  Chong Yidong  <cyd@gnu.org>
 
-       * url-http.el (url-http-end-of-document-sentinel): Handle
-       keepalive expiry by calling url-http again (Bug#10223).
+       * url-http.el (url-http-end-of-document-sentinel):
+       Handle keepalive expiry by calling url-http again (Bug#10223).
        (url-http): New arg, for the above.
 
 2012-03-11  Devon Sean McCullough  <emacs-hacker2012@jovi.net>
        * url-queue.el (url-queue-retrieve): Take an optional
        `inhibit-cookies' parameter.
 
-       * url.el (url-retrieve): Ditto
+       * url.el (url-retrieve): Ditto.
 
        * url-http.el (url-http-create-request): Don't send cookies unless
        requested.
 
 2011-07-03  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
-       * url-http.el (url-http-wait-for-headers-change-function): Remove
-       pointless "HTTP/0.9 How I hate thee!" message (bug#6735).
+       * url-http.el (url-http-wait-for-headers-change-function):
+       Remove pointless "HTTP/0.9 How I hate thee!" message (bug#6735).
 
 2011-06-04  Andreas Schwab  <schwab@linux-m68k.org>
 
index e6ff9bf7dea41c9bf154c8111e4b81578b9c3164..84200d1d41b93e4972862c295747f771b35ecdf9 100644 (file)
@@ -25,8 +25,9 @@
 
 (require 'url-util)
 (require 'url-parse)
+(require 'url-domsuf)
 
-(eval-when-compile (require 'cl))      ; defstruct
+(eval-when-compile (require 'cl-lib))
 
 (defgroup url-cookie nil
   "URL cookies."
@@ -37,7 +38,7 @@
 ;; A cookie is stored internally as a vector of 7 slots
 ;; [ url-cookie NAME VALUE EXPIRES LOCALPART DOMAIN SECURE ]
 
-(defstruct (url-cookie
+(cl-defstruct (url-cookie
             (:constructor url-cookie-create)
             (:copier nil)
             (:type vector)
@@ -211,14 +212,6 @@ telling Microsoft that."
        (concat retval "\r\n")
       "")))
 
-(defvar url-cookie-two-dot-domains
-  (concat "\\.\\("
-   (mapconcat 'identity (list "com" "edu" "net" "org" "gov" "mil" "int")
-             "\\|")
-   "\\)$")
-  "A regexp of top level domains that only require two matching
-'.'s in the domain name in order to set a cookie.")
-
 (defcustom url-cookie-trusted-urls nil
   "A list of regular expressions matching URLs to always accept cookies from."
   :type '(repeat regexp)
@@ -230,30 +223,18 @@ telling Microsoft that."
   :group 'url-cookie)
 
 (defun url-cookie-host-can-set-p (host domain)
-  (let ((numdots 0)
-       (last nil)
-       (case-fold-search t)
-       (mindots 3))
-    (while (setq last (string-match "\\." domain last))
-      (setq numdots (1+ numdots)
-           last (1+ last)))
-    (if (string-match url-cookie-two-dot-domains domain)
-       (setq mindots 2))
-    (cond
-     ((string= host domain)            ; Apparently netscape lets you do this
-      t)
-     ((>= numdots mindots)             ; We have enough dots in domain name
-      ;; Need to check and make sure the host is actually _in_ the
-      ;; domain it wants to set a cookie for though.
-      (string-match (concat (regexp-quote
-                             ;; Remove the dot from wildcard domains
-                             ;; before matching.
-                             (if (eq ?. (aref domain 0))
-                                 (substring domain 1)
-                               domain))
-                            "$") host))
-     (t
-      nil))))
+  (let ((last nil)
+       (case-fold-search t))
+    (if (string= host domain)  ; Apparently netscape lets you do this
+       t
+      ;; Remove the dot from wildcard domains before matching.
+      (when (eq ?. (aref domain 0))
+       (setq domain (substring domain 1)))
+      (and (url-domsuf-cookie-allowed-p domain)
+          ;; Need to check and make sure the host is actually _in_ the
+          ;; domain it wants to set a cookie for though.
+          (string-match (concat (regexp-quote domain)
+                                "$") host)))))
 
 (defun url-cookie-handle-set-cookie (str)
   (setq url-cookies-changed-since-last-save t)
index 03527bceee7a71c36b40a2c081563c2c63ec0cb5..77e48b0e47d59981e12094d0642cd59a5575054b 100644 (file)
@@ -27,8 +27,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (require 'xml)
 (require 'url-util)
 (defvar url-dav-supported-protocols '(1 2)
   "List of supported DAV versions.")
 
+(defvar url-http-content-type)
+(defvar url-http-response-status)
+(defvar url-http-end-of-headers)
+
 (defun url-intersection (l1 l2)
   "Return a list of the elements occurring in both of the lists L1 and L2."
   (if (null l2)
                        "unknown"))
            value nil)
 
-      (case node-type
-       ((dateTime.iso8601tz
-         dateTime.iso8601
-         dateTime.tz
-         dateTime.rfc1123
-         dateTime
-         date)                         ; date is our 'special' one...
+      (pcase node-type
+       ((or `dateTime.iso8601tz
+             `dateTime.iso8601
+             `dateTime.tz
+             `dateTime.rfc1123
+             `dateTime
+             `date)                     ; date is our 'special' one...
         ;; Some type of date/time string.
         (setq value (url-dav-process-date-property node)))
-       (int
+       (`int
         ;; Integer type...
         (setq value (url-dav-process-integer-property node)))
-       ((number float)
+       ((or `number `float)
         (setq value (url-dav-process-number-property node)))
-       (boolean
+       (`boolean
         (setq value (url-dav-process-boolean-property node)))
-       (uri
+       (`uri
         (setq value (url-dav-process-uri-property node)))
-       (otherwise
+       (_
         (if (not (eq node-type 'unknown))
             (url-debug 'dav "Unknown data type in url-dav-process-prop: %s"
                        node-type))
 
 The buffer must have been retrieved by HTTP or HTTPS and contain an
 XML document."
-  (declare (special url-http-content-type
-                   url-http-response-status
-                   url-http-end-of-headers))
   (let ((tree nil)
        (overall-status nil))
     (when buffer
@@ -478,7 +478,7 @@ names (ie: DAV:resourcetype)."
 \f
 ;;; Locking support
 (defvar url-dav-lock-identifier (concat "mailto:" user-mail-address)
-  "*URL used as contact information when creating locks in DAV.
+  "URL used as contact information when creating locks in DAV.
 This will be used as the contents of the DAV:owner/DAV:href tag to
 identify the owner of a LOCK when requesting it.  This will be shown
 to other users when the DAV:lockdiscovery property is requested, so
@@ -561,7 +561,6 @@ FAILURE-RESULTS is a list of (URL STATUS)."
 (defun url-dav-unlock-resource (url lock-token)
   "Release the lock on URL represented by LOCK-TOKEN.
 Returns t if the lock was successfully released."
-  (declare (special url-http-response-status))
   (let* ((url-request-extra-headers (list (cons "Lock-Token"
                                                (concat "<" lock-token ">"))))
         (url-request-method "UNLOCK")
@@ -603,16 +602,16 @@ Returns t if the lock was successfully released."
     (while supported-locks
       (setq lock (car supported-locks)
            supported-locks (cdr supported-locks))
-      (case (car lock)
-       (DAV:write
-        (case (cdr lock)
-          (DAV:shared                  ; group permissions (possibly world)
+      (pcase (car lock)
+       (`DAV:write
+        (pcase (cdr lock)
+          (`DAV:shared                 ; group permissions (possibly world)
            (aset modes 5 ?w))
-          (DAV:exclusive
+          (`DAV:exclusive
            (aset modes 2 ?w))          ; owner permissions?
-          (otherwise
+          (_
            (url-debug 'dav "Unrecognized DAV:lockscope (%S)" (cdr lock)))))
-       (otherwise
+       (_
         (url-debug 'dav "Unrecognized DAV:locktype (%S)" (car lock)))))
     modes))
 
@@ -674,7 +673,6 @@ Returns t if the lock was successfully released."
   "Save OBJ as URL using WebDAV.
 URL must be a fully qualified URL.
 OBJ may be a buffer or a string."
-  (declare (special url-http-response-status))
   (let ((buffer nil)
        (result nil)
        (url-request-extra-headers nil)
@@ -820,7 +818,6 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
 
 (defun url-dav-make-directory (url &optional parents)
   "Create the directory DIR and any nonexistent parent dirs."
-  (declare (special url-http-response-status))
   (let* ((url-request-extra-headers nil)
         (url-request-method "MKCOL")
         (url-request-data nil)
@@ -829,7 +826,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
     (when buffer
       (unwind-protect
          (with-current-buffer buffer
-           (case url-http-response-status
+           (pcase url-http-response-status
              (201                      ; Collection created in its entirety
               (setq result t))
              (403                      ; Forbidden
@@ -842,7 +839,7 @@ If NOSORT is non-nil, the list is not sorted--its order is unpredictable.
               nil)
              (507                      ; Insufficient storage
               nil)
-             (otherwise
+             (_
               nil)))
        (kill-buffer buffer)))
     result))
@@ -924,7 +921,7 @@ Returns nil if URL contains no name starting with FILE."
                (setq failed t)))
          (if failed
              (setq searching nil)
-           (incf n)))
+           (cl-incf n)))
        (substring (car matches) 0 n))))))
 
 (defun url-dav-register-handler (op)
diff --git a/lisp/url/url-domsuf.el b/lisp/url/url-domsuf.el
new file mode 100644 (file)
index 0000000..29fc166
--- /dev/null
@@ -0,0 +1,98 @@
+;;; url-domsuf.el --- Say what domain names can have cookies set.
+
+;; Copyright (C) 2012 Free Software Foundation, Inc.
+
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+;; Keywords: comm, data, processes, hypermedia
+
+;; This file is part of GNU Emacs.
+;;
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; The rules for what domains can have cookies set is defined here:
+;; http://publicsuffix.org/list/
+
+;;; Code:
+
+(defvar url-domsuf-domains nil)
+
+(defun url-domsuf-parse-file ()
+  (with-temp-buffer
+    (insert-file-contents
+     (expand-file-name "publicsuffix.txt" data-directory))
+    (let ((domains nil)
+         domain exception)
+      (while (not (eobp))
+       (when (not (looking-at "[/\n\t ]"))
+         ;; !pref.aichi.jp means that it's allowed.
+         (if (not (eq (following-char) ?!))
+             (setq exception nil)
+           (setq exception t)
+           (forward-char 1))
+         (setq domain (buffer-substring (point) (line-end-position)))
+         (cond
+          ((string-match "\\`\\*\\." domain)
+           (setq domain (substring domain 2))
+           (push (cons domain (1+ (length (split-string domain "[.]"))))
+                 domains))
+          (exception
+           (push (cons domain t) domains))
+          (t
+           (push (cons domain nil) domains))))
+       (forward-line 1))
+      (setq url-domsuf-domains (nreverse domains)))))
+
+(defun url-domsuf-cookie-allowed-p (domain)
+  (unless url-domsuf-domains
+    (url-domsuf-parse-file))
+  (let* ((allowedp t)
+        (domain-bits (split-string domain "[.]"))
+        (length (length domain-bits))
+        (upper-domain (mapconcat 'identity (cdr domain-bits) "."))
+        entry modifier)
+    (dolist (elem url-domsuf-domains)
+      (setq entry (car elem)
+           modifier (cdr elem))
+      (cond
+       ;; "com"
+       ((and (null modifier)
+            (string= domain entry))
+       (setq allowedp nil))
+       ;; "!pref.hokkaido.jp"
+       ((and (eq modifier t)
+            (string= domain entry))
+       (setq allowedp t))
+       ;; "*.ar"
+       ((and (numberp modifier)
+            (= length modifier)
+            (string= entry upper-domain))
+       (setq allowedp nil))))
+    allowedp))
+
+;; Tests:
+
+;; (url-domsuf-cookie-allowed-p "com") => nil
+;; (url-domsuf-cookie-allowed-p "foo.bar.ar") => t
+;; (url-domsuf-cookie-allowed-p "bar.ar") => nil
+;; (url-domsuf-cookie-allowed-p "co.uk") => nil
+;; (url-domsuf-cookie-allowed-p "foo.bar.hokkaido.jo") => t
+;; (url-domsuf-cookie-allowed-p "bar.hokkaido.jp") => nil
+;; (url-domsuf-cookie-allowed-p "pref.hokkaido.jp") => t
+
+(provide 'url-domsuf)
+
+;;; url-domsuf.el ends here
index 156b06c895bb589cfde2a9d2c995900cb729653b..4bf13f4abe3f2c945f6fc12e45fc79f27442981c 100644 (file)
@@ -24,7 +24,6 @@
 (require 'url-methods)
 (require 'url-util)
 (require 'url-parse)
-(eval-when-compile (require 'cl))
 
 (defun url-expander-remove-relative-links (name)
   ;; Strip . and .. from pathnames
@@ -116,13 +115,17 @@ path components followed by `..' are removed, along with the `..' itself."
     (setf (url-port urlobj) (or (url-port urlobj)
                                 (and (string= (url-type urlobj)
                                               (url-type defobj))
-                                     (url-port defobj))))
+                                    (url-port defobj))))
     (if (not (string= "file" (url-type urlobj)))
        (setf (url-host urlobj) (or (url-host urlobj) (url-host defobj))))
     (if (string= "ftp"  (url-type urlobj))
        (setf (url-user urlobj) (or (url-user urlobj) (url-user defobj))))
     (if (string= (url-filename urlobj) "")
        (setf (url-filename urlobj) "/"))
+    ;; If the object we're expanding from is full, then we are now
+    ;; full.
+    (unless (url-fullness urlobj)
+      (setf (url-fullness urlobj) (url-fullness defobj)))
     (if (string-match "^/" (url-filename urlobj))
        nil
       (let ((query nil)
index 62052fcaafb85a3de43a8d0447a826e919f63a2f..4bbbdcf200cfab2a2a90d9ee42e8e855473826cf 100644 (file)
@@ -23,7 +23,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'mailcap)
 (require 'url-vars)
 (require 'url-parse)
@@ -172,13 +171,13 @@ to them."
                                  filename))
     (setq content-type (mailcap-extension-to-mime
                        (url-file-extension uncompressed-filename))
-         content-encoding (case (intern (url-file-extension filename))
-                            ((\.z \.gz) "gzip")
-                            (\.Z "compress")
-                            (\.uue "x-uuencoded")
-                            (\.hqx "x-hqx")
-                            (\.bz2 "x-bzip2")
-                            (otherwise nil)))
+         content-encoding (pcase (url-file-extension filename)
+                            ((or ".z" ".gz") "gzip")
+                            (".Z" "compress")
+                            (".uue" "x-uuencoded")
+                            (".hqx" "x-hqx")
+                            (".bz2" "x-bzip2")
+                            (_ nil)))
 
     (if (file-directory-p filename)
        ;; A directory is done the same whether we are local or remote
index 8cdd6916a35aedaa9c51e8e042d9774efd956670..db074807e1bf5f4fbe2ef2d0d1ebf29e58d58faa 100644 (file)
@@ -40,9 +40,9 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
-(defstruct url-future callback errorback status value)
+(cl-defstruct url-future callback errorback status value)
 
 (defmacro url-future-done-p (url-future)
   `(url-future-status ,url-future))
index ec26ae053d85c2c701c67ba0ce0ba4e33dd8a95a..c475fb05c9c957aaca5cef286846f774eb7a5169 100644 (file)
@@ -22,7 +22,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'url-vars)
 
 ;; Fixme: support SSH explicitly or via a url-gateway-rlogin-program?
@@ -233,8 +232,8 @@ Might do a non-blocking connection; use `process-status' to check."
          ;; right coding systems in both Emacs and XEmacs.
          (let ((coding-system-for-read 'binary)
                (coding-system-for-write 'binary))
-           (setq conn (case gw-method
-                        ((tls ssl native)
+           (setq conn (pcase gw-method
+                        ((or `tls `ssl `native)
                          (if (eq gw-method 'native)
                              (setq gw-method 'plain))
                          (open-network-stream
@@ -243,13 +242,13 @@ Might do a non-blocking connection; use `process-status' to check."
                           ;; Use non-blocking socket if we can.
                           :nowait (featurep 'make-network-process
                                             '(:nowait t))))
-                        (socks
+                        (`socks
                          (socks-open-network-stream name buffer host service))
-                        (telnet
+                        (`telnet
                          (url-open-telnet name buffer host service))
-                        (rlogin
+                        (`rlogin
                          (url-open-rlogin name buffer host service))
-                        (otherwise
+                        (_
                          (error "Bad setting of url-gateway-method: %s"
                                 url-gateway-method))))))
       conn)))
index 4bc5bd47488c0cced44b1c68aed5fe0367da15a1..f731f614d1382483305d6a77c45a334c05e7dcb6 100644 (file)
 ;; verify-visited-file-modtime
 ;; write-region
 
-(defvar url-handler-regexp
-  "\\`\\(https?\\|ftp\\|file\\|nfs\\)://"
-  "*A regular expression for matching URLs handled by `file-name-handler-alist'.
-Some valid URL protocols just do not make sense to visit interactively
-\(about, data, info, irc, mailto, etc\).  This regular expression
-avoids conflicts with local files that look like URLs \(Gnus is
-particularly bad at this\).")
+(defvar url-handler-regexp) ; defined below to avoid recursive load (revno:108572)
 
 ;;;###autoload
 (define-minor-mode url-handler-mode
@@ -105,16 +99,31 @@ With a prefix argument ARG, enable URL Handler mode if ARG is
 positive, and disable it otherwise.  If called from Lisp, enable
 the mode if ARG is omitted or nil."
   :global t :group 'url
-  (if (not (boundp 'file-name-handler-alist))
-      ;; Can't be turned ON anyway.
-      (setq url-handler-mode nil)
-    ;; Remove old entry, if any.
-    (setq file-name-handler-alist
-         (delq (rassq 'url-file-handler file-name-handler-alist)
-               file-name-handler-alist))
-    (if url-handler-mode
-       (push (cons url-handler-regexp 'url-file-handler)
-             file-name-handler-alist))))
+  ;; Remove old entry, if any.
+  (setq file-name-handler-alist
+       (delq (rassq 'url-file-handler file-name-handler-alist)
+             file-name-handler-alist))
+  (if url-handler-mode
+      (push (cons url-handler-regexp 'url-file-handler)
+           file-name-handler-alist)))
+
+(defcustom url-handler-regexp "\\`\\(https?\\|ftp\\|file\\|nfs\\)://"
+  "Regular expression for URLs handled by `url-handler-mode'.
+When URL Handler mode is enabled, this regular expression is
+added to `file-name-handler-alist'.
+
+Some valid URL protocols just do not make sense to visit
+interactively \(about, data, info, irc, mailto, etc\).  This
+regular expression avoids conflicts with local files that look
+like URLs \(Gnus is particularly bad at this\)."
+  :group 'url
+  :type 'regexp
+  :set (lambda (symbol value)
+        (let ((enable url-handler-mode))
+          (url-handler-mode 0)
+          (set-default symbol value)
+          (if enable
+              (url-handler-mode)))))
 
 (defun url-run-real-handler (operation args)
   (let ((inhibit-file-name-handlers (cons 'url-file-handler
index 2bae194af1daaad4098291f06c3287f0d2f2cde4..0b5ecc7bf988e532eb5176466f75fe49b17e469d 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
+
+(defvar url-callback-arguments)
+(defvar url-callback-function)
+(defvar url-current-object)
+(defvar url-http-after-change-function)
+(defvar url-http-chunked-counter)
+(defvar url-http-chunked-length)
+(defvar url-http-chunked-start)
+(defvar url-http-connection-opened)
+(defvar url-http-content-length)
+(defvar url-http-content-type)
+(defvar url-http-data)
+(defvar url-http-end-of-headers)
 (defvar url-http-extra-headers)
-(defvar url-http-target-url)
+(defvar url-http-method)
 (defvar url-http-no-retry)
+(defvar url-http-process)
 (defvar url-http-proxy)
-(defvar url-http-connection-opened)
+(defvar url-http-response-status)
+(defvar url-http-response-version)
+(defvar url-http-target-url)
+(defvar url-http-transfer-encoding)
+(defvar url-http-end-of-headers)
+(defvar url-show-status)
+
 (require 'url-gw)
 (require 'url-util)
 (require 'url-parse)
@@ -209,9 +229,6 @@ request.")
 
 (defun url-http-create-request (&optional ref-url)
   "Create an HTTP request for `url-http-target-url', referred to by REF-URL."
-  (declare (special proxy-info
-                   url-http-method url-http-data
-                   url-http-extra-headers))
   (let* ((extra-headers)
         (request nil)
         (no-cache (cdr-safe (assoc "Pragma" url-http-extra-headers)))
@@ -223,8 +240,7 @@ request.")
                       (let ((url-basic-auth-storage
                              'url-http-proxy-basic-auth-storage))
                         (url-get-authentication url-http-target-url nil 'any nil))))
-        (real-fname (concat (url-filename url-http-target-url)
-                            (url-recreate-url-attributes url-http-target-url)))
+        (real-fname (url-filename url-http-target-url))
         (host (url-host url-http-target-url))
         (auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers))
                   nil
@@ -359,16 +375,16 @@ request.")
   "Remove trailing \r from header lines.
 This allows us to use `mail-fetch-field', etc.
 Return the number of characters removed."
-  (declare (special url-http-end-of-headers))
   (let ((end (marker-position url-http-end-of-headers)))
     (goto-char (point-min))
     (while (re-search-forward "\r$" url-http-end-of-headers t)
       (replace-match ""))
     (- end url-http-end-of-headers)))
 
+(defvar status)
+(defvar success)
+
 (defun url-http-handle-authentication (proxy)
-  (declare (special status success url-http-method url-http-data
-                   url-callback-function url-callback-arguments))
   (url-http-debug "Handling %s authentication" (if proxy "proxy" "normal"))
   (let ((auths (or (nreverse
                    (mail-fetch-field
@@ -428,8 +444,6 @@ Return the number of characters removed."
 
 (defun url-http-parse-response ()
   "Parse just the response code."
-  (declare (special url-http-end-of-headers url-http-response-status
-                   url-http-response-version))
   (if (not url-http-end-of-headers)
       (error "Trying to parse HTTP response code in odd buffer: %s" (buffer-name)))
   (url-http-debug "url-http-parse-response called in (%s)" (buffer-name))
@@ -464,11 +478,6 @@ Return t if and only if the current buffer is still active and
 should be shown to the user."
   ;; The comments after each status code handled are taken from RFC
   ;; 2616 (HTTP/1.1)
-  (declare (special url-http-end-of-headers url-http-response-status
-                   url-http-response-version
-                   url-http-method url-http-data url-http-process
-                   url-callback-function url-callback-arguments))
-
   (url-http-mark-connection-as-free (url-host url-current-object)
                                    (url-port url-current-object)
                                    url-http-process)
@@ -509,7 +518,7 @@ should be shown to the user."
     (when (url-use-cookies url-http-target-url)
       (url-http-handle-cookies))
 
-    (case class
+    (pcase class
       ;; Classes of response codes
       ;;
       ;; 5xx = Server Error
@@ -532,12 +541,12 @@ should be shown to the user."
        ;; 205 Reset content
        ;; 206 Partial content
        ;; 207 Multi-status (Added by DAV)
-       (case status-symbol
-        ((no-content reset-content)
+       (pcase status-symbol
+        ((or `no-content `reset-content)
          ;; No new data, just stay at the same document
          (url-mark-buffer-as-dead buffer)
          (setq success t))
-        (otherwise
+        (_
          ;; Generic success for all others.  Store in the cache, and
          ;; mark it as successful.
          (widen)
@@ -554,8 +563,8 @@ should be shown to the user."
        ;; 307 Temporary redirect
        (let ((redirect-uri (or (mail-fetch-field "Location")
                               (mail-fetch-field "URI"))))
-        (case status-symbol
-          (multiple-choices        ; 300
+        (pcase status-symbol
+          (`multiple-choices       ; 300
            ;; Quoth the spec (section 10.3.1)
            ;; -------------------------------
            ;; The requested resource corresponds to any one of a set of
@@ -572,7 +581,7 @@ should be shown to the user."
            ;; We do not support agent-driven negotiation, so we just
            ;; redirect to the preferred URI if one is provided.
            nil)
-          ((moved-permanently found temporary-redirect) ; 301 302 307
+          ((or `moved-permanently `found `temporary-redirect) ; 301 302 307
            ;; If the 301|302 status code is received in response to a
            ;; request other than GET or HEAD, the user agent MUST NOT
            ;; automatically redirect the request unless it can be
@@ -580,20 +589,20 @@ should be shown to the user."
            ;; conditions under which the request was issued.
            (unless (member url-http-method '("HEAD" "GET"))
              (setq redirect-uri nil)))
-          (see-other                   ; 303
+          (`see-other                  ; 303
            ;; The response to the request can be found under a different
            ;; URI and SHOULD be retrieved using a GET method on that
            ;; resource.
            (setq url-http-method "GET"
                  url-http-data nil))
-          (not-modified                ; 304
+          (`not-modified               ; 304
            ;; The 304 response MUST NOT contain a message-body.
            (url-http-debug "Extracting document from cache... (%s)"
                            (url-cache-create-filename (url-view-url t)))
            (url-cache-extract (url-cache-create-filename (url-view-url t)))
            (setq redirect-uri nil
                  success t))
-          (use-proxy                   ; 305
+          (`use-proxy                  ; 305
            ;; The requested resource MUST be accessed through the
            ;; proxy given by the Location field.  The Location field
            ;; gives the URI of the proxy.  The recipient is expected
@@ -601,7 +610,7 @@ should be shown to the user."
            ;; responses MUST only be generated by origin servers.
            (error "Redirection thru a proxy server not supported: %s"
                   redirect-uri))
-          (otherwise
+          (_
            ;; Treat everything like '300'
            nil))
         (when redirect-uri
@@ -683,51 +692,51 @@ should be shown to the user."
        ;; 422 Unprocessable Entity (Added by DAV)
        ;; 423 Locked
        ;; 424 Failed Dependency
-       (case status-symbol
-        (unauthorized                  ; 401
+       (pcase status-symbol
+        (`unauthorized                 ; 401
          ;; The request requires user authentication.  The response
          ;; MUST include a WWW-Authenticate header field containing a
          ;; challenge applicable to the requested resource.  The
          ;; client MAY repeat the request with a suitable
          ;; Authorization header field.
          (url-http-handle-authentication nil))
-        (payment-required              ; 402
+        (`payment-required              ; 402
          ;; This code is reserved for future use
          (url-mark-buffer-as-dead buffer)
          (error "Somebody wants you to give them money"))
-        (forbidden                     ; 403
+        (`forbidden                    ; 403
          ;; The server understood the request, but is refusing to
          ;; fulfill it.  Authorization will not help and the request
          ;; SHOULD NOT be repeated.
          (setq success t))
-        (not-found                     ; 404
+        (`not-found                    ; 404
          ;; Not found
          (setq success t))
-        (method-not-allowed            ; 405
+        (`method-not-allowed           ; 405
          ;; The method specified in the Request-Line is not allowed
          ;; for the resource identified by the Request-URI.  The
          ;; response MUST include an Allow header containing a list of
          ;; valid methods for the requested resource.
          (setq success t))
-        (not-acceptable                ; 406
+        (`not-acceptable               ; 406
          ;; The resource identified by the request is only capable of
          ;; generating response entities which have content
          ;; characteristics not acceptable according to the accept
          ;; headers sent in the request.
          (setq success t))
-        (proxy-authentication-required ; 407
+        (`proxy-authentication-required ; 407
          ;; This code is similar to 401 (Unauthorized), but indicates
          ;; that the client must first authenticate itself with the
          ;; proxy.  The proxy MUST return a Proxy-Authenticate header
          ;; field containing a challenge applicable to the proxy for
          ;; the requested resource.
          (url-http-handle-authentication t))
-        (request-timeout               ; 408
+        (`request-timeout              ; 408
          ;; The client did not produce a request within the time that
          ;; the server was prepared to wait.  The client MAY repeat
          ;; the request without modifications at any later time.
          (setq success t))
-        (conflict                      ; 409
+        (`conflict                     ; 409
          ;; The request could not be completed due to a conflict with
          ;; the current state of the resource.  This code is only
          ;; allowed in situations where it is expected that the user
@@ -736,11 +745,11 @@ should be shown to the user."
          ;; information for the user to recognize the source of the
          ;; conflict.
          (setq success t))
-        (gone                          ; 410
+        (`gone                          ; 410
          ;; The requested resource is no longer available at the
          ;; server and no forwarding address is known.
          (setq success t))
-        (length-required               ; 411
+        (`length-required              ; 411
          ;; The server refuses to accept the request without a defined
          ;; Content-Length.  The client MAY repeat the request if it
          ;; adds a valid Content-Length header field containing the
@@ -750,35 +759,35 @@ should be shown to the user."
          ;; `url-http-create-request' automatically calculates the
          ;; content-length.
          (setq success t))
-        (precondition-failed           ; 412
+        (`precondition-failed          ; 412
          ;; The precondition given in one or more of the
          ;; request-header fields evaluated to false when it was
          ;; tested on the server.
          (setq success t))
-        ((request-entity-too-large request-uri-too-large) ; 413 414
+        ((or `request-entity-too-large `request-uri-too-large) ; 413 414
          ;; The server is refusing to process a request because the
          ;; request entity|URI is larger than the server is willing or
          ;; able to process.
          (setq success t))
-        (unsupported-media-type        ; 415
+        (`unsupported-media-type       ; 415
          ;; The server is refusing to service the request because the
          ;; entity of the request is in a format not supported by the
          ;; requested resource for the requested method.
          (setq success t))
-        (requested-range-not-satisfiable ; 416
+        (`requested-range-not-satisfiable ; 416
          ;; A server SHOULD return a response with this status code if
          ;; a request included a Range request-header field, and none
          ;; of the range-specifier values in this field overlap the
          ;; current extent of the selected resource, and the request
          ;; did not include an If-Range request-header field.
          (setq success t))
-        (expectation-failed            ; 417
+        (`expectation-failed           ; 417
          ;; The expectation given in an Expect request-header field
          ;; could not be met by this server, or, if the server is a
          ;; proxy, the server has unambiguous evidence that the
          ;; request could not be met by the next-hop server.
          (setq success t))
-        (otherwise
+        (_
          ;; The request could not be understood by the server due to
          ;; malformed syntax.  The client SHOULD NOT repeat the
          ;; request without modifications.
@@ -798,17 +807,17 @@ should be shown to the user."
        ;; 505 HTTP version not supported
        ;; 507 Insufficient storage
        (setq success t)
-       (case url-http-response-status
-        (not-implemented               ; 501
+       (pcase url-http-response-status
+        (`not-implemented              ; 501
          ;; The server does not support the functionality required to
          ;; fulfill the request.
          nil)
-        (bad-gateway                   ; 502
+        (`bad-gateway                  ; 502
          ;; The server, while acting as a gateway or proxy, received
          ;; an invalid response from the upstream server it accessed
          ;; in attempting to fulfill the request.
          nil)
-        (service-unavailable           ; 503
+        (`service-unavailable          ; 503
          ;; The server is currently unable to handle the request due
          ;; to a temporary overloading or maintenance of the server.
          ;; The implication is that this is a temporary condition
@@ -817,19 +826,19 @@ should be shown to the user."
          ;; header.  If no Retry-After is given, the client SHOULD
          ;; handle the response as it would for a 500 response.
          nil)
-        (gateway-timeout               ; 504
+        (`gateway-timeout              ; 504
          ;; The server, while acting as a gateway or proxy, did not
          ;; receive a timely response from the upstream server
          ;; specified by the URI (e.g. HTTP, FTP, LDAP) or some other
          ;; auxiliary server (e.g. DNS) it needed to access in
          ;; attempting to complete the request.
          nil)
-        (http-version-not-supported    ; 505
+        (`http-version-not-supported   ; 505
          ;; The server does not support, or refuses to support, the
          ;; HTTP protocol version that was used in the request
          ;; message.
          nil)
-        (insufficient-storage          ; 507 (DAV)
+        (`insufficient-storage         ; 507 (DAV)
          ;; The method could not be performed on the resource
          ;; because the server is unable to store the representation
          ;; needed to successfully complete the request.  This
@@ -844,7 +853,7 @@ should be shown to the user."
         (setf (car url-callback-arguments)
               (nconc (list :error (list 'error 'http url-http-response-status))
                      (car url-callback-arguments)))))
-      (otherwise
+      (_
        (error "Unknown class of HTTP response code: %d (%d)"
              class url-http-response-status)))
     (if (not success)
@@ -856,9 +865,6 @@ should be shown to the user."
 ;; Miscellaneous
 (defun url-http-activate-callback ()
   "Activate callback specified when this buffer was created."
-  (declare (special url-http-process
-                   url-callback-function
-                   url-callback-arguments))
   (url-http-mark-connection-as-free (url-host url-current-object)
                                    (url-port url-current-object)
                                    url-http-process)
@@ -900,7 +906,6 @@ should be shown to the user."
 (defun url-http-simple-after-change-function (st nd length)
   ;; Function used when we do NOT know how long the document is going to be
   ;; Just _very_ simple 'downloaded %d' type of info.
-  (declare (special url-http-end-of-headers))
   (url-lazy-message "Reading %s..." (url-pretty-length nd)))
 
 (defun url-http-content-length-after-change-function (st nd length)
@@ -908,11 +913,6 @@ should be shown to the user."
 More sophisticated percentage downloaded, etc.
 Also does minimal parsing of HTTP headers and will actually cause
 the callback to be triggered."
-  (declare (special url-current-object
-                   url-http-end-of-headers
-                   url-http-content-length
-                   url-http-content-type
-                   url-http-process))
   (if url-http-content-type
       (url-display-percentage
        "Reading [%s]... %s of %s (%d%%)"
@@ -945,12 +945,6 @@ the callback to be triggered."
 Cannot give a sophisticated percentage, but we need a different
 function to look for the special 0-length chunk that signifies
 the end of the document."
-  (declare (special url-current-object
-                   url-http-end-of-headers
-                   url-http-content-type
-                   url-http-chunked-length
-                   url-http-chunked-counter
-                   url-http-process url-http-chunked-start))
   (save-excursion
     (goto-char st)
     (let ((read-next-chunk t)
@@ -1036,17 +1030,6 @@ the end of the document."
 (defun url-http-wait-for-headers-change-function (st nd length)
   ;; This will wait for the headers to arrive and then splice in the
   ;; next appropriate after-change-function, etc.
-  (declare (special url-current-object
-                   url-http-end-of-headers
-                   url-http-content-type
-                   url-http-content-length
-                   url-http-transfer-encoding
-                   url-callback-function
-                   url-callback-arguments
-                   url-http-process
-                   url-http-method
-                   url-http-after-change-function
-                   url-http-response-status))
   (url-http-debug "url-http-wait-for-headers-change-function (%s)"
                  (buffer-name))
   (let ((end-of-headers nil)
@@ -1181,28 +1164,13 @@ CBARGS as the arguments.
 
 Optional arg RETRY-BUFFER, if non-nil, specifies the buffer of a
 previous `url-http' call, which is being re-attempted."
-  (check-type url vector "Need a pre-parsed URL.")
-  (declare (special url-current-object
-                   url-http-end-of-headers
-                   url-http-content-type
-                   url-http-content-length
-                   url-http-transfer-encoding
-                   url-http-after-change-function
-                   url-callback-function
-                   url-callback-arguments
-                   url-show-status
-                   url-http-method
-                   url-http-extra-headers
-                   url-http-data
-                   url-http-chunked-length
-                   url-http-chunked-start
-                   url-http-chunked-counter
-                   url-http-process))
+  (cl-check-type url vector "Need a pre-parsed URL.")
   (let* ((host (url-host (or url-using-proxy url)))
         (port (url-port (or url-using-proxy url)))
         (connection (url-http-find-free-connection host port))
         (buffer (or retry-buffer
-                    (generate-new-buffer (format " *http %s:%d*" host port)))))
+                    (generate-new-buffer
+                      (format " *http %s:%d*" host port)))))
     (if (not connection)
        ;; Failed to open the connection for some reason
        (progn
@@ -1263,12 +1231,12 @@ previous `url-http' call, which is being re-attempted."
            ;; Asynchronous connection failed
            (error "Could not create connection to %s:%d" host port))
           (t
-           (set-process-sentinel connection 'url-http-end-of-document-sentinel)
+           (set-process-sentinel connection
+                                  'url-http-end-of-document-sentinel)
            (process-send-string connection (url-http-create-request)))))))
     buffer))
 
 (defun url-http-async-sentinel (proc why)
-  (declare (special url-callback-arguments))
   ;; We are performing an asynchronous connection, and a status change
   ;; has occurred.
   (when (buffer-name (process-buffer proc))
@@ -1303,7 +1271,6 @@ previous `url-http' call, which is being re-attempted."
   ;; Sometimes we get a zero-length data chunk after the process has
   ;; been changed to 'free', which means it has no buffer associated
   ;; with it.  Do nothing if there is no buffer, or 0 length data.
-  (declare (special url-http-after-change-function))
   (and (process-buffer proc)
        (/= (length data) 0)
        (with-current-buffer (process-buffer proc)
index 7c988f9b119cff77d305fba5286c8cdc4d2e05a4..0ea98cb06c9908e11201800c4c11d405a8893240 100644 (file)
@@ -64,7 +64,7 @@
     ("facsimiletelephonenumber" . "Fax")
     ("postaladdress"            . "Mailing Address")
     ("description"              . "Notes"))
-  "*An assoc list mapping LDAP attribute names to pretty descriptions of them.")
+  "An assoc list mapping LDAP attribute names to pretty descriptions of them.")
 
 (defvar url-ldap-attribute-formatters
   '(("mail"       . (lambda (x) (format "<a href='mailto:%s'>%s</a>" x x)))
@@ -76,7 +76,7 @@
     ("namingcontexts" . url-ldap-dn-formatter)
     ("defaultnamingcontext" . url-ldap-dn-formatter)
     ("member"     . url-ldap-dn-formatter))
-  "*An assoc list mapping LDAP attribute names to pretty formatters for them.")
+  "An assoc list mapping LDAP attribute names to pretty formatters for them.")
 
 (defsubst url-ldap-attribute-pretty-name (n)
   (or (cdr-safe (assoc (downcase n) url-ldap-pretty-names)) n))
index b61198393b51bab4af7bbc60b0d97e84746aa9db..bd7d8e33922ec7f23b4f83e67568f6a9ef99b13b 100644 (file)
@@ -23,9 +23,6 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
 ;; This loads up some of the small, silly URLs that I really don't
 ;; want to bother putting in their own separate files.
 (require 'url-parse)
@@ -134,17 +131,17 @@ it has not already been loaded."
                  (let ((symbol (intern-soft (format "%s-%s" stub (car cell))))
                        (type (cdr cell)))
                    (if symbol
-                       (case type
-                         (function
+                       (pcase type
+                         (`function
                           ;; Store the symbol name of a function
                           (if (fboundp symbol)
                               (setq desc (plist-put desc (car cell) symbol))))
-                         (variable
+                         (`variable
                           ;; Store the VALUE of a variable
                           (if (boundp symbol)
                               (setq desc (plist-put desc (car cell)
                                                     (symbol-value symbol)))))
-                         (otherwise
+                         (_
                           (error "Malformed url-scheme-methods entry: %S"
                                  cell))))))
                (puthash scheme desc url-scheme-registry)))))
index fa8176873a84d4cc174dd2f4a09e65242f3716f8..dd521ccd690954e31e9390bafea99eff6de21fab 100644 (file)
@@ -21,7 +21,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'url-vars)
 (require 'url-parse)
 (autoload 'Info-goto-node "info" "" t)
 (defun url-do-terminal-emulator (type server port user)
   (terminal-emulator
    (generate-new-buffer (format "%s%s" (if user (concat user "@") "") server))
-   (case type
-     (rlogin "rlogin")
-     (telnet "telnet")
-     (tn3270 "tn3270")
-     (otherwise
+   (pcase type
+     (`rlogin "rlogin")
+     (`telnet "telnet")
+     (`tn3270 "tn3270")
+     (_
       (error "Unknown terminal emulator required: %s" type)))
-   (case type
-     (rlogin
+   (pcase type
+     (`rlogin
       (if user
          (list server "-l" user)
        (list server)))
-     (telnet
+     (`telnet
       (if user (message "Please log in as user: %s" user))
       (if port
          (list server port)
        (list server)))
-     (tn3270
+     (`tn3270
       (if user (message "Please log in as user: %s" user))
       (list server)))))
 
index a22d105b1a1ecda4db68c9dfb51e8e7666b01c35..2eed16c3ad3d31aa9cec9fb119b6e50d0a4d9fd4 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'url-parse)
 (require 'url-file)
 
-(defvar url-nfs-automounter-directory-spec
-  "file:/net/%h%f"
-  "*How to invoke the NFS automounter.  Certain % sequences are recognized.
+(defcustom url-nfs-automounter-directory-spec "file:/net/%h%f"
+  "How to invoke the NFS automounter.  Certain % sequences are recognized.
 
 %h -- the hostname of the NFS server
 %n -- the port # of the NFS server
@@ -38,7 +36,9 @@
 %f -- the filename on the remote server
 %% -- a literal %
 
-Each can be used any number of times.")
+Each can be used any number of times."
+  :group 'url
+  :type 'string)
 
 (defun url-nfs-unescape (format host port user pass file)
   (with-current-buffer (get-buffer-create " *nfs-parse*")
@@ -48,7 +48,7 @@ Each can be used any number of times.")
     (while (re-search-forward "%\\(.\\)" nil t)
        (let ((escape (aref (match-string 1) 0)))
         (replace-match "" t t)
-        (case escape
+        (pcase escape
           (?% (insert "%"))
           (?h (insert host))
           (?n (insert (or port "")))
index b91c85c0c3d844cdc077cfff0523668833ea1be1..46ad1daef0111da8eff34d58936bb2b73d214ba3 100644 (file)
 
 (require 'url-vars)
 (require 'auth-source)
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (autoload 'url-scheme-get-property "url-methods")
 
-(defstruct (url
+(cl-defstruct (url
             (:constructor nil)
             (:constructor url-parse-make-urlobj
                           (&optional type user password host portspec filename
   silent (use-cookies t))
 
 (defsubst url-port (urlobj)
+  "Return the port number for the URL specified by URLOBJ."
+  (declare (gv-setter (lambda (port) `(setf (url-portspec ,urlobj) ,port))))
   (or (url-portspec urlobj)
-      (if (url-fullness urlobj)
+      (if (url-type urlobj)
           (url-scheme-get-property (url-type urlobj) 'default-port))))
 
-(defsetf url-port (urlobj) (port) `(setf (url-portspec ,urlobj) ,port))
+
+(defun url-path-and-query (urlobj)
+  "Return the path and query components of URLOBJ.
+These two components are store together in the FILENAME slot of
+the object.  The return value of this function is (PATH . QUERY),
+where each of PATH and QUERY are strings or nil."
+  (let ((name (url-filename urlobj))
+       path query)
+    (when name
+      (if (string-match "\\?" name)
+         (setq path  (substring name 0 (match-beginning 0))
+               query (substring name (match-end 0)))
+       (setq path name)))
+    (if (equal path "") (setq path nil))
+    (if (equal query "") (setq query nil))
+    (cons path query)))
+
+(defun url-port-if-non-default (urlobj)
+  "Return the port number specified by URLOBJ, if it is not the default.
+If the specified port number is the default, return nil."
+  (let ((port (url-portspec urlobj))
+       type)
+    (and port
+        (or (null (setq type (url-type urlobj)))
+            (not (equal port (url-scheme-get-property type 'default-port))))
+        port)))
 
 ;;;###autoload
 (defun url-recreate-url (urlobj)
   "Recreate a URL string from the parsed URLOBJ."
-  (concat (url-type urlobj) ":" (if (url-host urlobj) "//" "")
-         (if (url-user urlobj)
-             (concat (url-user urlobj)
-                     (if (url-password urlobj)
-                         (concat ":" (url-password urlobj)))
-                     "@"))
-         (url-host urlobj)
-         (if (and (url-port urlobj)
-                  (not (equal (url-port urlobj)
-                              (url-scheme-get-property (url-type urlobj) 'default-port))))
-             (format ":%d" (url-port urlobj)))
-         (or (url-filename urlobj) "/")          
-         (url-recreate-url-attributes urlobj)
-         (if (url-target urlobj)
-             (concat "#" (url-target urlobj)))))
+  (let* ((type (url-type urlobj))
+        (user (url-user urlobj))
+        (pass (url-password urlobj))
+        (host (url-host urlobj))
+        ;; RFC 3986: "omit the port component and its : delimiter if
+        ;; port is empty or if its value would be the same as that of
+        ;; the scheme's default."
+        (port (url-port-if-non-default urlobj))
+        (file (url-filename urlobj))
+        (frag (url-target urlobj)))
+    (concat (if type (concat type ":"))
+           (if (url-fullness urlobj) "//")
+           (if (or user pass)
+               (concat user
+                       (if pass (concat ":" pass))
+                       "@"))
+           host
+           (if port (format ":%d" (url-port urlobj)))
+           (or file "/")
+           (if frag (concat "#" frag)))))
 
 (defun url-recreate-url-attributes (urlobj)
   "Recreate the attributes of an URL string from the parsed URLOBJ."
                              (concat (car x) "=" (cdr x))
                            (car x)))
                        (url-attributes urlobj) ";"))))
+(make-obsolete 'url-recreate-url-attributes nil "24.2")
 
 ;;;###autoload
 (defun url-generic-parse-url (url)
   "Return an URL-struct of the parts of URL.
 The CL-style struct contains the following fields:
-TYPE USER PASSWORD HOST PORTSPEC FILENAME TARGET ATTRIBUTES FULLNESS."
-  ;; See RFC 3986.
-  (cond
-   ((null url)
-    (url-parse-make-urlobj))
-   ((or (not (string-match url-nonrelative-link url))
-       (= ?/ (string-to-char url)))
-    ;; This isn't correct, as a relative URL can be a fragment link
-    ;; (e.g. "#foo") and many other things (see section 4.2).
-    ;; However, let's not fix something that isn't broken, especially
-    ;; when close to a release.
-    (url-parse-make-urlobj nil nil nil nil nil url))
-   (t
+
+TYPE     is the URI scheme (string or nil).
+USER     is the user name (string or nil).
+PASSWORD is the password (string [deprecated] or nil).
+HOST     is the host (a registered name, IP literal in square
+         brackets, or IPv4 address in dotted-decimal form).
+PORTSPEC is the specified port (a number), or nil.
+FILENAME is the path AND the query component of the URI.
+TARGET   is the fragment identifier component (used to refer to a
+         subordinate resource, e.g. a part of a webpage).
+ATTRIBUTES is nil; this slot originally stored the attribute and
+         value alists for IMAP URIs, but this feature was removed
+         since it conflicts with RFC 3986.
+FULLNESS is non-nil iff the hierarchical sequence component of
+         the URL starts with two slashes, \"//\".
+
+The parser follows RFC 3986, except that it also tries to handle
+URIs that are not fully specified (e.g. lacking TYPE), and it
+does not check for or perform %-encoding.
+
+Here is an example.  The URL
+
+  foo://bob:pass@example.com:42/a/b/c.dtb?type=animal&name=narwhal#nose
+
+parses to
+
+  TYPE     = \"foo\"
+  USER     = \"bob\"
+  PASSWORD = \"pass\"
+  HOST     = \"example.com\"
+  PORTSPEC = 42
+  FILENAME = \"/a/b/c.dtb?type=animal&name=narwhal\"
+  TARGET   = \"nose\"
+  ATTRIBUTES = nil
+  FULLNESS = t"
+  (if (null url)
+      (url-parse-make-urlobj)
     (with-temp-buffer
       ;; Don't let those temp-buffer modifications accidentally
       ;; deactivate the mark of the current-buffer.
       (let ((deactivate-mark nil))
         (set-syntax-table url-parse-syntax-table)
-        (let ((save-pos nil)
-              (prot nil)
-              (user nil)
-              (pass nil)
-              (host nil)
-              (port nil)
-              (file nil)
-              (refs nil)
-              (attr nil)
-              (full nil)
+       (erase-buffer)
+       (insert url)
+       (goto-char (point-min))
+        (let ((save-pos (point))
+              scheme user pass host port file fragment full
               (inhibit-read-only t))
-          (erase-buffer)
-          (insert url)
-          (goto-char (point-min))
-          (setq save-pos (point))
 
           ;; 3.1. Scheme
-          (unless (looking-at "//")
-            (skip-chars-forward "a-zA-Z+.\\-")
-            (downcase-region save-pos (point))
-            (setq prot (buffer-substring save-pos (point)))
-            (skip-chars-forward ":")
-            (setq save-pos (point)))
+         ;; This is nil for a URI that is not fully specified.
+          (when (looking-at "\\([a-zA-Z][-a-zA-Z0-9+.]*\\):")
+           (goto-char (match-end 0))
+            (setq save-pos (point))
+           (setq scheme (downcase (match-string 1))))
 
           ;; 3.2. Authority
           (when (looking-at "//")
             (setq full t)
             (forward-char 2)
             (setq save-pos (point))
-            (skip-chars-forward "^/")
+            (skip-chars-forward "^/?#")
             (setq host (buffer-substring save-pos (point)))
+           ;; 3.2.1 User Information
             (if (string-match "^\\([^@]+\\)@" host)
                 (setq user (match-string 1 host)
-                      host (substring host (match-end 0) nil)))
-            (if (and user (string-match "\\([^:]+\\):\\(.*\\)" user))
+                      host (substring host (match-end 0))))
+            (if (and user (string-match "\\`\\([^:]*\\):\\(.*\\)" user))
                 (setq pass (match-string 2 user)
                       user (match-string 1 user)))
-            ;; This gives wrong results for IPv6 literal addresses.
-            (if (string-match ":\\([0-9+]+\\)" host)
-                (setq port (string-to-number (match-string 1 host))
-                      host (substring host 0 (match-beginning 0))))
-            (if (string-match ":$" host)
-                (setq host (substring host 0 (match-beginning 0))))
-            (setq host (downcase host)
-                  save-pos (point)))
-
-          (if (not port)
-              (setq port (url-scheme-get-property prot 'default-port)))
-
-          ;; 3.3. Path
-          ;; Gross hack to preserve ';' in data URLs
+            (cond
+            ;; IPv6 literal address.
+            ((string-match "^\\(\\[[^]]+\\]\\)\\(?::\\([0-9]*\\)\\)?$" host)
+             (setq port (match-string 2 host)
+                   host (match-string 1 host)))
+            ;; Registered name or IPv4 address.
+            ((string-match ":\\([0-9]*\\)$" host)
+             (setq port (match-string 1 host)
+                   host (substring host 0 (match-beginning 0)))))
+           (cond ((equal port "")
+                  (setq port nil))
+                 (port
+                  (setq port (string-to-number port))))
+            (setq host (downcase host)))
+
+         ;; Now point is on the / ? or # which terminates the
+         ;; authority, or at the end of the URI, or (if there is no
+         ;; authority) at the beginning of the absolute path.
+
           (setq save-pos (point))
+          (if (string= "data" scheme)
+             ;; For the "data" URI scheme, all the rest is the FILE.
+             (setq file (buffer-substring save-pos (point-max)))
+           ;; For hysterical raisins, our data structure returns the
+           ;; path and query components together in one slot.
+           ;; 3.3. Path
+           (skip-chars-forward "^?#")
+           ;; 3.4. Query
+           (when (looking-at "?")
+             (skip-chars-forward "^#"))
+           (setq file (buffer-substring save-pos (point)))
+           ;; 3.5 Fragment
+           (when (looking-at "#")
+             (let ((opoint (point)))
+               (forward-char 1)
+               (unless (eobp)
+                 (setq fragment (buffer-substring (point) (point-max))))
+               (delete-region opoint (point-max)))))
 
-          ;; 3.4. Query
-          (if (string= "data" prot)
-              (goto-char (point-max))
-            ;; Now check for references
-            (skip-chars-forward "^#")
-            (if (eobp)
-                nil
-              (delete-region
-               (point)
-               (progn
-                 (skip-chars-forward "#")
-                 (setq refs (buffer-substring (point) (point-max)))
-                 (point-max))))
-            (goto-char save-pos)
-            (skip-chars-forward "^;")
-            (unless (eobp)
-              (setq attr (url-parse-args (buffer-substring (point) (point-max))
-                                         t)
-                   attr (nreverse attr))))
-
-          (setq file (buffer-substring save-pos (point)))
           (if (and host (string-match "%[0-9][0-9]" host))
               (setq host (url-unhex-string host)))
-          (url-parse-make-urlobj
-           prot user pass host port file refs attr full)))))))
+          (url-parse-make-urlobj scheme user pass host port file
+                                fragment nil full))))))
 
 (defmacro url-bit-for-url (method lookfor url)
   `(let* ((urlobj (url-generic-parse-url url))
index 85247857bebd4a2042b304bbf6a7602d6db205b1..4524cb416bf0b808349bea22bc7d4123ac9eb54f 100644 (file)
@@ -21,7 +21,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'url-vars)
 
 (defun url-device-type (&optional device)
         ((memq (url-device-type) '(win32 w32)) "Windows; 32bit")
         ((eq (url-device-type) 'pm) "OS/2; 32bit")
         (t
-         (case (url-device-type)
-           (x "X11")
-           (ns "OpenStep")
-           (tty "TTY")
-           (otherwise nil)))))
+         (pcase (url-device-type)
+           (`x "X11")
+           (`ns "OpenStep")
+           (`tty "TTY")
+           (_ nil)))))
 
   (setq url-personal-mail-address (or url-personal-mail-address
                                      user-mail-address
index 917c787df292347b037f612e956890cd8f236d63..327ce977cfd9af19705c9eb3f7694c0b69bbaca0 100644 (file)
@@ -28,7 +28,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'browse-url)
 (require 'url-parse)
 
@@ -48,7 +48,7 @@
 
 (defvar url-queue nil)
 
-(defstruct url-queue
+(cl-defstruct url-queue
   url callback cbargs silentp
   buffer start-time pre-triggered
   inhibit-cookiesp)
@@ -84,7 +84,7 @@ The variable `url-queue-timeout' sets a timeout."
       (cond
        ((or (url-queue-start-time entry)
            (url-queue-pre-triggered entry))
-       (incf running))
+       (cl-incf running))
        ((not waiting)
        (setq waiting entry))))
     (when (and waiting
@@ -99,7 +99,7 @@ The variable `url-queue-timeout' sets a timeout."
     (dolist (entry url-queue)
       (cond
        ((url-queue-start-time entry)
-       (incf running))
+       (cl-incf running))
        ((not waiting)
        (setq waiting entry))))
     (when (and waiting
index 848eb66e54bc1351349aeaf8bf5d0ea5a5fc8535..2faca26f2dd22eb64f350ee058b7ee4b79a1431f 100644 (file)
@@ -26,7 +26,6 @@
 
 (require 'url-parse)
 (require 'url-vars)
-(eval-when-compile (require 'cl))
 (autoload 'timezone-parse-date "timezone")
 (autoload 'timezone-make-date-arpa-standard "timezone")
 (autoload 'mail-header-extract "mailheader")
@@ -263,24 +262,65 @@ Will not do anything if `url-show-status' is nil."
 ;;;###autoload
 (defun url-parse-query-string (query &optional downcase allow-newlines)
   (let (retval pairs cur key val)
-    (setq pairs (split-string query "&"))
+    (setq pairs (split-string query "[;&]"))
     (while pairs
       (setq cur (car pairs)
            pairs (cdr pairs))
-      (if (not (string-match "=" cur))
-         nil                           ; Grace
-       (setq key (url-unhex-string (substring cur 0 (match-beginning 0))
-                                   allow-newlines))
-       (setq val (url-unhex-string (substring cur (match-end 0) nil)
-                                   allow-newlines))
-       (if downcase
-           (setq key (downcase key)))
-       (setq cur (assoc key retval))
-       (if cur
-           (setcdr cur (cons val (cdr cur)))
-         (setq retval (cons (list key val) retval)))))
+      (unless (string-match "=" cur)
+        (setq cur (concat cur "=")))
+
+      (when (string-match "=" cur)
+        (setq key (url-unhex-string (substring cur 0 (match-beginning 0))
+                                    allow-newlines))
+        (setq val (url-unhex-string (substring cur (match-end 0) nil)
+                                    allow-newlines))
+        (if downcase
+            (setq key (downcase key)))
+        (setq cur (assoc key retval))
+        (if cur
+            (setcdr cur (cons val (cdr cur)))
+          (setq retval (cons (list key val) retval)))))
     retval))
 
+;;;###autoload
+(defun url-build-query-string (query &optional semicolons keep-empty)
+  "Build a query-string.
+
+Given a QUERY in the form:
+'((key1 val1)
+  (key2 val2)
+  (key3 val1 val2)
+  (key4)
+  (key5 ""))
+
+\(This is the same format as produced by `url-parse-query-string')
+
+This will return a string
+\"key1=val1&key2=val2&key3=val1&key3=val2&key4&key5\". Keys may
+be strings or symbols; if they are symbols, the symbol name will
+be used.
+
+When SEMICOLONS is given, the separator will be \";\".
+
+When KEEP-EMPTY is given, empty values will show as \"key=\"
+instead of just \"key\" as in the example above."
+  (mapconcat
+   (lambda (key-vals)
+     (let ((escaped
+            (mapcar (lambda (sym)
+                      (url-hexify-string (format "%s" sym))) key-vals)))
+       (mapconcat (lambda (val)
+                    (let ((vprint (format "%s" val))
+                          (eprint (format "%s" (car escaped))))
+                      (concat eprint
+                              (if (or keep-empty
+                                      (and val (not (zerop (length vprint)))))
+                                  "="
+                                "")
+                              vprint)))
+                  (or (cdr escaped) '("")) (if semicolons ";" "&"))))
+   query (if semicolons ";" "&")))
+
 (defun url-unhex (x)
   (if (> x ?9)
       (if (>= x ?a)
@@ -330,44 +370,118 @@ forbidden in URL encoding."
                     " ")
                    (t (byte-to-string code))))
              str (substring str (match-end 0)))))
-    (setq tmp (concat tmp str))
-    tmp))
+    (concat tmp str)))
 
 (defconst url-unreserved-chars
-  '(
-    ?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
+  '(?a ?b ?c ?d ?e ?f ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v ?w ?x ?y ?z
     ?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z
     ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9
-    ?- ?_ ?. ?! ?~ ?* ?' ?\( ?\))
-  "A list of characters that are _NOT_ reserved in the URL spec.
-This is taken from RFC 2396.")
+    ?- ?_ ?. ?~)
+  "List of characters that are unreserved in the URL spec.
+This is taken from RFC 3986 (section 2.3).")
+
+(defconst url-encoding-table
+  (let ((vec (make-vector 256 nil)))
+    (dotimes (byte 256)
+      ;; RFC 3986 (Section 2.1): For consistency, URI producers and
+      ;; normalizers should use uppercase hexadecimal digits for all
+      ;; percent-encodings.
+      (aset vec byte (format "%%%02X" byte)))
+    vec)
+  "Vector translating bytes to URI-encoded %-sequences.")
+
+(defun url--allowed-chars (char-list)
+  "Return an \"allowed character\" mask (a 256-slot vector).
+The Nth element is non-nil if character N is in CHAR-LIST.  The
+result can be passed as the second arg to `url-hexify-string'."
+  (let ((vec (make-vector 256 nil)))
+    (dolist (byte char-list)
+      (ignore-errors (aset vec byte t)))
+    vec))
 
 ;;;###autoload
-(defun url-hexify-string (string)
-  "Return a new string that is STRING URI-encoded.
-First, STRING is converted to utf-8, if necessary.  Then, for each
-character in the utf-8 string, those found in `url-unreserved-chars'
-are left as-is, all others are represented as a three-character
-string: \"%\" followed by two lowercase hex digits."
-  ;; To go faster and avoid a lot of consing, we could do:
-  ;;
-  ;; (defconst url-hexify-table
-  ;;   (let ((map (make-vector 256 nil)))
-  ;;     (dotimes (byte 256) (aset map byte
-  ;;                               (if (memq byte url-unreserved-chars)
-  ;;                                   (char-to-string byte)
-  ;;                                 (format "%%%02x" byte))))
-  ;;     map))
-  ;;
-  ;; (mapconcat (curry 'aref url-hexify-table) ...)
+(defun url-hexify-string (string &optional allowed-chars)
+  "URI-encode STRING and return the result.
+If STRING is multibyte, it is first converted to a utf-8 byte
+string.  Each byte corresponding to an allowed character is left
+as-is, while all other bytes are converted to a three-character
+string: \"%\" followed by two upper-case hex digits.
+
+The allowed characters are specified by ALLOWED-CHARS.  If this
+argument is nil, the list `url-unreserved-chars' determines the
+allowed characters.  Otherwise, ALLOWED-CHARS should be a vector
+whose Nth element is non-nil if character N is allowed."
+  (unless allowed-chars
+    (setq allowed-chars (url--allowed-chars url-unreserved-chars)))
   (mapconcat (lambda (byte)
-               (if (memq byte url-unreserved-chars)
-                   (char-to-string byte)
-                 (format "%%%02x" byte)))
-             (if (multibyte-string-p string)
-                 (encode-coding-string string 'utf-8)
-               string)
-             ""))
+              (if (aref allowed-chars byte)
+                  (char-to-string byte)
+                (aref url-encoding-table byte)))
+            (if (multibyte-string-p string)
+                (encode-coding-string string 'utf-8)
+              string)
+            ""))
+
+(defconst url-host-allowed-chars
+  ;; Allow % to avoid re-encoding %-encoded sequences.
+  (url--allowed-chars (append '(?% ?! ?$ ?& ?' ?\( ?\) ?* ?+ ?, ?\; ?=)
+                             url-unreserved-chars))
+  "Allowed-character byte mask for the host segment of a URI.
+These characters are specified in RFC 3986, Appendix A.")
+
+(defconst url-path-allowed-chars
+  (let ((vec (copy-sequence url-host-allowed-chars)))
+    (aset vec ?/ t)
+    (aset vec ?: t)
+    (aset vec ?@ t)
+    vec)
+  "Allowed-character byte mask for the path segment of a URI.
+These characters are specified in RFC 3986, Appendix A.")
+
+(defconst url-query-allowed-chars
+  (let ((vec (copy-sequence url-path-allowed-chars)))
+    (aset vec ?? t)
+    vec)
+  "Allowed-character byte mask for the query segment of a URI.
+These characters are specified in RFC 3986, Appendix A.")
+
+;;;###autoload
+(defun url-encode-url (url)
+  "Return a properly URI-encoded version of URL.
+This function also performs URI normalization, e.g. converting
+the scheme to lowercase if it is uppercase.  Apart from
+normalization, if URL is already URI-encoded, this function
+should return it unchanged."
+  (if (multibyte-string-p url)
+      (setq url (encode-coding-string url 'utf-8)))
+  (let* ((obj  (url-generic-parse-url url))
+        (user (url-user obj))
+        (pass (url-password obj))
+        (host (url-host obj))
+        (path-and-query (url-path-and-query obj))
+        (path  (car path-and-query))
+        (query (cdr path-and-query))
+        (frag (url-target obj)))
+    (if user
+       (setf (url-user obj) (url-hexify-string user)))
+    (if pass
+       (setf (url-password obj) (url-hexify-string pass)))
+    ;; No special encoding for IPv6 literals.
+    (and host
+        (not (string-match "\\`\\[.*\\]\\'" host))
+        (setf (url-host obj)
+              (url-hexify-string host url-host-allowed-chars)))
+
+    (if path
+       (setq path (url-hexify-string path url-path-allowed-chars)))
+    (if query
+       (setq query (url-hexify-string query url-query-allowed-chars)))
+    (setf (url-filename obj) (if query (concat path "?" query) path))
+
+    (if frag
+       (setf (url-target obj)
+             (url-hexify-string frag url-query-allowed-chars)))
+    (url-recreate-url obj)))
 
 ;;;###autoload
 (defun url-file-extension (fname &optional x)
index a56eb4cc81043e840529d7f77b931e7fc79accd4..29f1e2cde0cd61b51ec3b138611343332b3c6efb 100644 (file)
@@ -21,8 +21,6 @@
 
 ;;; Code:
 
-(require 'mm-util)
-
 (defconst url-version "Emacs"
   "Version number of URL package.")
 
@@ -212,7 +210,10 @@ Should be an assoc list of headers/contents.")
 
 ;; FIXME!!  (RFC 2616 gives examples like `compress, gzip'.)
 (defvar url-mime-encoding-string nil
-  "*String to send in the Accept-encoding: field in HTTP requests.")
+  "String to send in the Accept-encoding: field in HTTP requests.")
+
+(defvar mm-mime-mule-charset-alist)
+(declare-function mm-coding-system-p "mm-util" (cs))
 
 ;; Perhaps the first few should actually be given decreasing `q's and
 ;; the list should be trimmed significantly.
@@ -221,6 +222,7 @@ Should be an assoc list of headers/contents.")
 (defun url-mime-charset-string ()
   "Generate a list of preferred MIME charsets for HTTP requests.
 Generated according to current coding system priorities."
+  (require 'mm-util)
   (if (fboundp 'sort-coding-systems)
       (let ((ordered (sort-coding-systems
                      (let (accum)
@@ -233,7 +235,7 @@ Generated according to current coding system priorities."
                ";q=0.5"))))
 
 (defvar url-mime-charset-string nil
-  "*String to send in the Accept-charset: field in HTTP requests.
+  "String to send in the Accept-charset: field in HTTP requests.
 The MIME charset corresponding to the most preferred coding system is
 given priority 1 and the rest are given priority 0.5.")
 
@@ -304,8 +306,12 @@ undefined."
   :type '(choice (const :tag "None" :value nil) string)
   :group 'url)
 
+;; From RFC3986: Scheme names consist of a sequence of characters
+;; beginning with a letter and followed by any combination of letters,
+;; digits, plus ("+"), period ("."), or hyphen ("-").
+
 (defvar url-nonrelative-link
-  "\\`\\([-a-zA-Z0-9+.]+:\\)"
+  "\\`\\([a-zA-Z][-a-zA-Z0-9+.]*:\\)"
   "A regular expression that will match an absolute URL.")
 
 (defcustom url-max-redirections 30
@@ -364,7 +370,7 @@ Currently supported methods:
 
 (defvar url-parse-syntax-table
   (copy-syntax-table emacs-lisp-mode-syntax-table)
-  "*A syntax table for parsing URLs.")
+  "A syntax table for parsing URLs.")
 
 (modify-syntax-entry ?' "\"" url-parse-syntax-table)
 (modify-syntax-entry ?` "\"" url-parse-syntax-table)
@@ -372,8 +378,10 @@ Currently supported methods:
 (modify-syntax-entry ?> ")<" url-parse-syntax-table)
 (modify-syntax-entry ?/ " " url-parse-syntax-table)
 
-(defvar url-load-hook nil
-  "*Hooks to be run after initializing the URL library.")
+(defcustom url-load-hook nil
+  "Hook run after initializing the URL library."
+  :group 'url
+  :type 'hook)
 
 ;;; Make OS/2 happy - yeeks
 ;; (defvar     tcp-binary-process-input-services nil
index 5ced789e4e4450da03f7ec6d04a28308db849c24..87ae7a51aacf795b4b8a031cc8b71e92f503936e 100644 (file)
@@ -1,4 +1,4 @@
-;;; url.el --- Uniform Resource Locator retrieval tool
+;;; url.el --- Uniform Resource Locator retrieval tool  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1996-1999, 2001, 2004-2012  Free Software Foundation, Inc.
 
@@ -26,7 +26,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 
 (require 'mailcap)
 
@@ -125,7 +124,9 @@ variable in the original buffer as a forwarding pointer.")
 ;;;###autoload
 (defun url-retrieve (url callback &optional cbargs silent inhibit-cookies)
   "Retrieve URL asynchronously and call CALLBACK with CBARGS when finished.
-URL is either a string or a parsed URL.
+URL is either a string or a parsed URL.  If it is a string
+containing characters that are not valid in a URI, those
+characters are percent-encoded; see `url-encode-url'.
 
 CALLBACK is called when the object has been completely retrieved, with
 the current buffer containing the object, and any MIME headers associated
@@ -149,7 +150,9 @@ take effect.
 
 If SILENT, then don't message progress reports and the like.
 If INHIBIT-COOKIES, cookies will neither be stored nor sent to
-the server."
+the server.
+If URL is a multibyte string, it will be encoded as utf-8 and
+URL-encoded before it's used."
 ;;; XXX: There is code in Emacs that does dynamic binding
 ;;; of the following variables around url-retrieve:
 ;;; url-standalone-mode, url-gateway-unplugged, w3-honor-stylesheets,
@@ -171,11 +174,14 @@ the list of events, as described in the docstring of `url-retrieve'.
 
 If SILENT, don't message progress reports and the like.
 If INHIBIT-COOKIES, cookies will neither be stored nor sent to
-the server."
+the server.
+If URL is a multibyte string, it will be encoded as utf-8 and
+URL-encoded before it's used."
   (url-do-setup)
   (url-gc-dead-buffers)
-  (if (stringp url)
-       (set-text-properties 0 (length url) nil url))
+  (when (stringp url)
+    (set-text-properties 0 (length url) nil url)
+    (setq url (url-encode-url url)))
   (if (not (vectorp url))
       (setq url (url-generic-parse-url url)))
   (if (not (functionp callback))
@@ -218,8 +224,8 @@ associated with it (the case for dired, info, or mailto URLs that need
 no further processing).  URL is either a string or a parsed URL."
   (url-do-setup)
 
-  (lexical-let ((retrieval-done nil)
-               (asynch-buffer nil))
+  (let ((retrieval-done nil)
+        (asynch-buffer nil))
     (setq asynch-buffer
          (url-retrieve url (lambda (&rest ignored)
                              (url-debug 'retrieval "Synchronous fetching done (%S)" (current-buffer))
index be7bba54378edc4c02a17697cb2c4b5aa904aa92..b9c3d0d385a2a1f1d8149e5210e6294d9bdcc9a0 100644 (file)
@@ -1122,17 +1122,17 @@ parentheses."
 ;;;###autoload
 (defvar add-log-lisp-like-modes
   '(emacs-lisp-mode lisp-mode scheme-mode dsssl-mode lisp-interaction-mode)
-  "*Modes that look like Lisp to `add-log-current-defun'.")
+  "Modes that look like Lisp to `add-log-current-defun'.")
 
 ;;;###autoload
 (defvar add-log-c-like-modes
   '(c-mode c++-mode c++-c-mode objc-mode)
-  "*Modes that look like C to `add-log-current-defun'.")
+  "Modes that look like C to `add-log-current-defun'.")
 
 ;;;###autoload
 (defvar add-log-tex-like-modes
   '(TeX-mode plain-TeX-mode LaTeX-mode tex-mode)
-  "*Modes that look like TeX to `add-log-current-defun'.")
+  "Modes that look like TeX to `add-log-current-defun'.")
 
 (declare-function c-cpp-define-name "cc-cmds" ())
 (declare-function c-defun-name      "cc-cmds" ())
index a80197486a2f63fd263280d9842f925f7eaba4b8..6c6b18a605d78d8745983fd98bbc6159c5cf7393 100644 (file)
@@ -28,7 +28,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'pcvs-util)
 
 ;;;
 ;; Tagelt, tag element
 ;;
 
-(defstruct (cvs-tag
+(cl-defstruct (cvs-tag
            (:constructor nil)
            (:constructor cvs-tag-make
                          (vlist &optional name type))
@@ -235,9 +235,9 @@ The tree will be printed no closer than column COLUMN."
              (save-excursion
                (or (= (forward-line 1) 0) (insert "\n"))
                (cvs-tree-print rest printer column))))
-       (assert (>= prefix column))
+       (cl-assert (>= prefix column))
        (move-to-column prefix t)
-       (assert (eolp))
+       (cl-assert (eolp))
        (insert (cvs-car name))
        (dolist (br (cvs-cdr rev))
          (let* ((column (current-column))
@@ -258,7 +258,7 @@ The tree will be printed no closer than column COLUMN."
 (defun cvs-tree-merge (tree1 tree2)
   "Merge tags trees TREE1 and TREE2 into one.
 BEWARE:  because of stability issues, this is not a symmetric operation."
-  (assert (and (listp tree1) (listp tree2)))
+  (cl-assert (and (listp tree1) (listp tree2)))
   (cond
    ((null tree1) tree2)
    ((null tree2) tree1)
@@ -273,10 +273,10 @@ BEWARE:  because of stability issues, this is not a symmetric operation."
           (l2 (length vl2)))
     (cond
      ((= l1 l2)
-      (case (cvs-tag-compare tag1 tag2)
-       (more1 (list* rev2 (cvs-tree-merge tree1 (cdr tree2))))
-       (more2 (list* rev1 (cvs-tree-merge (cdr tree1) tree2)))
-       (equal
+      (pcase (cvs-tag-compare tag1 tag2)
+       (`more1 (cons rev2 (cvs-tree-merge tree1 (cdr tree2))))
+       (`more2 (cons rev1 (cvs-tree-merge (cdr tree1) tree2)))
+       (`equal
         (cons (cons (cvs-tag-merge tag1 tag2)
                     (cvs-tree-merge (cvs-cdr rev1) (cvs-cdr rev2)))
               (cvs-tree-merge (cdr tree1) (cdr tree2))))))
@@ -395,39 +395,39 @@ the list is a three-string list TAG, KIND, REV."
    (cvs-tree-use-jisx0208 'jisx0208)
    ((char-displayable-p ?━) 'unicode)
    ((char-displayable-p (make-char 'japanese-jisx0208 40 44)) 'jisx0208))
-  "*Non-nil if we should use the graphical glyphs from `japanese-jisx0208'.
+  "Non-nil if we should use the graphical glyphs from `japanese-jisx0208'.
 Otherwise, default to ASCII chars like +, - and |.")
 
 (defconst cvs-tree-char-space
-  (case cvs-tree-use-charset
-    (jisx0208 (make-char 'japanese-jisx0208 33 33))
-    (unicode " ")
-    (t "  ")))
+  (pcase cvs-tree-use-charset
+    (`jisx0208 (make-char 'japanese-jisx0208 33 33))
+    (`unicode " ")
+    (_ "  ")))
 (defconst cvs-tree-char-hbar
-  (case cvs-tree-use-charset
-    (jisx0208 (make-char 'japanese-jisx0208 40 44))
-    (unicode "━")
-    (t "--")))
+  (pcase cvs-tree-use-charset
+    (`jisx0208 (make-char 'japanese-jisx0208 40 44))
+    (`unicode "━")
+    (_ "--")))
 (defconst cvs-tree-char-vbar
-  (case cvs-tree-use-charset
-    (jisx0208 (make-char 'japanese-jisx0208 40 45))
-    (unicode "┃")
-    (t "| ")))
+  (pcase cvs-tree-use-charset
+    (`jisx0208 (make-char 'japanese-jisx0208 40 45))
+    (`unicode "┃")
+    (_ "| ")))
 (defconst cvs-tree-char-branch
-  (case cvs-tree-use-charset
-    (jisx0208 (make-char 'japanese-jisx0208 40 50))
-    (unicode "┣")
-    (t "+-")))
+  (pcase cvs-tree-use-charset
+    (`jisx0208 (make-char 'japanese-jisx0208 40 50))
+    (`unicode "┣")
+    (_ "+-")))
 (defconst cvs-tree-char-eob            ;end of branch
-  (case cvs-tree-use-charset
-    (jisx0208 (make-char 'japanese-jisx0208 40 49))
-    (unicode "┗")
-    (t "`-")))
+  (pcase cvs-tree-use-charset
+    (`jisx0208 (make-char 'japanese-jisx0208 40 49))
+    (`unicode "┗")
+    (_ "`-")))
 (defconst cvs-tree-char-bob            ;beginning of branch
-  (case cvs-tree-use-charset
-    (jisx0208 (make-char 'japanese-jisx0208 40 51))
-    (unicode "┳")
-    (t "+-")))
+  (pcase cvs-tree-use-charset
+    (`jisx0208 (make-char 'japanese-jisx0208 40 51))
+    (`unicode "┳")
+    (_ "+-")))
 
 (defun cvs-tag-lessp (tag1 tag2)
   (eq (cvs-tag-compare tag1 tag2) 'more2))
@@ -485,9 +485,9 @@ Optional prefix ARG chooses between two representations."
           (pe t)                       ;"prev equal"
           (nas nil))                   ;"next afters" to be returned
       (insert "   ")
-      (do* ((vs vlist (cdr vs))
-           (ps prev (cdr ps))
-           (as after (cdr as)))
+      (cl-do* ((vs vlist (cdr vs))
+               (ps prev (cdr ps))
+               (as after (cdr as)))
          ((and (null as) (null vs) (null ps))
           (let ((revname (cvs-status-vl-to-str vlist)))
             (if (cvs-every 'identity (cvs-map 'equal prev vlist))
index 8b6b85dd22ee0dd072581c7894c06c154b069326..a9d124700b89f78d89b7ee5f4ba933c0a9dc9692 100644 (file)
@@ -53,7 +53,7 @@
 ;; - Handle `diff -b' output in context->unified.
 
 ;;; Code:
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defvar add-log-buffer-file-name-function)
 
@@ -107,8 +107,7 @@ when editing big diffs)."
 ;;;;
 
 (easy-mmode-defmap diff-mode-shared-map
-  '(;; From Pavel Machek's patch-mode.
-    ("n" . diff-hunk-next)
+  '(("n" . diff-hunk-next)
     ("N" . diff-file-next)
     ("p" . diff-hunk-prev)
     ("P" . diff-file-prev)
@@ -116,27 +115,17 @@ when editing big diffs)."
     ([backtab] . diff-hunk-prev)
     ("k" . diff-hunk-kill)
     ("K" . diff-file-kill)
-    ;; From compilation-minor-mode.
-    ("}" . diff-file-next)
+    ("}" . diff-file-next)     ; From compilation-minor-mode.
     ("{" . diff-file-prev)
     ("\C-m" . diff-goto-source)
     ([mouse-2] . diff-goto-source)
-    ;; From XEmacs's diff-mode.
     ("W" . widen)
-    ;;("." . diff-goto-source)         ;display-buffer
-    ;;("f" . diff-goto-source)         ;find-file
-    ("o" . diff-goto-source)           ;other-window
-    ;;("w" . diff-goto-source)         ;other-frame
-    ;;("N" . diff-narrow)
-    ;;("h" . diff-show-header)
-    ;;("j" . diff-show-difference)     ;jump to Nth diff
-    ;;("q" . diff-quit)
-    ;; Not useful if you have to metafy them.
-    ;;(" " . scroll-up)
-    ;;("\177" . scroll-down)
+    ("o" . diff-goto-source)   ; other-window
     ("A" . diff-ediff-patch)
     ("r" . diff-restrict-view)
-    ("R" . diff-reverse-direction))
+    ("R" . diff-reverse-direction)
+    ("/" . diff-undo)
+    ([remap undo] . diff-undo))
   "Basic keymap for `diff-mode', bound to various prefix keys."
   :inherit special-mode-map)
 
@@ -248,10 +237,8 @@ well."
      :background "grey80")
     (((class color) (min-colors 88) (background dark))
      :background "grey45")
-    (((class color) (background light))
+    (((class color))
      :foreground "blue1" :weight bold)
-    (((class color) (background dark))
-     :foreground "green" :weight bold)
     (t :weight bold))
   "`diff-mode' face inherited by hunk and index header faces."
   :group 'diff-mode)
@@ -263,9 +250,7 @@ well."
      :background "grey70" :weight bold)
     (((class color) (min-colors 88) (background dark))
      :background "grey60" :weight bold)
-    (((class color) (background light))
-     :foreground "green" :weight bold)
-    (((class color) (background dark))
+    (((class color))
      :foreground "cyan" :weight bold)
     (t :weight bold))                  ; :height 1.3
   "`diff-mode' face used to highlight file header lines."
@@ -288,14 +273,28 @@ well."
 (defvar diff-hunk-header-face 'diff-hunk-header)
 
 (defface diff-removed
-  '((t :inherit diff-changed))
+  '((default
+     :inherit diff-changed)
+    (((class color) (min-colors 88) (background light))
+     :background "#ffdddd")
+    (((class color) (min-colors 88) (background dark))
+     :background "#553333")
+    (((class color))
+     :foreground "red"))
   "`diff-mode' face used to highlight removed lines."
   :group 'diff-mode)
 (define-obsolete-face-alias 'diff-removed-face 'diff-removed "22.1")
 (defvar diff-removed-face 'diff-removed)
 
 (defface diff-added
-  '((t :inherit diff-changed))
+  '((default
+     :inherit diff-changed)
+    (((class color) (min-colors 88) (background light))
+     :background "#ddffdd")
+    (((class color) (min-colors 88) (background dark))
+     :background "#335533")
+    (((class color))
+     :foreground "green"))
   "`diff-mode' face used to highlight added lines."
   :group 'diff-mode)
 (define-obsolete-face-alias 'diff-added-face 'diff-added "22.1")
@@ -307,10 +306,8 @@ well."
   '((((class color grayscale) (min-colors 88)))
     ;; If the terminal lacks sufficient colors for shadowing,
     ;; highlight changed lines explicitly.
-    (((class color) (background light))
-     :foreground "magenta" :weight bold :slant italic)
-    (((class color) (background dark))
-     :foreground "yellow" :weight bold :slant italic))
+    (((class color))
+     :foreground "yellow"))
   "`diff-mode' face used to highlight changed lines."
   :group 'diff-mode)
 (define-obsolete-face-alias 'diff-changed-face 'diff-changed "22.1")
@@ -385,6 +382,13 @@ well."
 (defconst diff-context-mid-hunk-header-re
   "--- \\([0-9]+\\)\\(?:,\\([0-9]+\\)\\)? ----$")
 
+(defvar diff-use-changed-face (and (face-differs-from-default-p diff-changed-face)
+                                  (not (face-equal diff-changed-face diff-added-face))
+                                  (not (face-equal diff-changed-face diff-removed-face)))
+  "If non-nil, use the face `diff-changed' for changed lines in context diffs.
+Otherwise, use the face `diff-removed' for removed lines,
+and the face `diff-added' for added lines.")
+
 (defvar diff-font-lock-keywords
   `((,(concat "\\(" diff-hunk-header-re-unified "\\)\\(.*\\)$")
      (1 diff-hunk-header-face) (6 diff-function-face))
@@ -404,8 +408,25 @@ well."
     ("^\\([+>]\\)\\(.*\n\\)"
      (1 diff-indicator-added-face) (2 diff-added-face))
     ("^\\(!\\)\\(.*\n\\)"
-     (1 diff-indicator-changed-face) (2 diff-changed-face))
-    ("^Index: \\(.+\\).*\n"
+     (1 (if diff-use-changed-face
+           diff-indicator-changed-face
+         ;; Otherwise, search for `diff-context-mid-hunk-header-re' and
+         ;; if the line of context diff is above, use `diff-removed-face';
+         ;; if below, use `diff-added-face'.
+         (save-match-data
+           (let ((limit (save-excursion (diff-beginning-of-hunk))))
+             (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t))
+                 diff-indicator-added-face
+               diff-indicator-removed-face)))))
+     (2 (if diff-use-changed-face
+           diff-changed-face
+         ;; Otherwise, use the same method as above.
+         (save-match-data
+           (let ((limit (save-excursion (diff-beginning-of-hunk))))
+             (if (save-excursion (re-search-backward diff-context-mid-hunk-header-re limit t))
+                 diff-added-face
+               diff-removed-face))))))
+    ("^\\(?:Index\\|revno\\): \\(.+\\).*\n"
      (0 diff-header-face) (1 diff-index-face prepend))
     ("^Only in .*\n" . diff-nonexistent-face)
     ("^\\(#\\)\\(.*\\)"
@@ -445,6 +466,7 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
   style)
 
 (defun diff-end-of-hunk (&optional style donttrustheader)
+  "Advance to the end of the current hunk, and return its position."
   (let (end)
     (when (looking-at diff-hunk-header-re)
       ;; Especially important for unified (because headers are ambiguous).
@@ -471,14 +493,15 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
     ;; We may have a first evaluation of `end' thanks to the hunk header.
     (unless end
       (setq end (and (re-search-forward
-                      (case style
-                        (unified (concat (if diff-valid-unified-empty-line
-                                             "^[^-+# \\\n]\\|" "^[^-+# \\]\\|")
-                                         ;; A `unified' header is ambiguous.
-                                         diff-file-header-re))
-                        (context "^[^-+#! \\]")
-                        (normal "^[^<>#\\]")
-                        (t "^[^-+#!<> \\]"))
+                      (pcase style
+                        (`unified
+                         (concat (if diff-valid-unified-empty-line
+                                     "^[^-+# \\\n]\\|" "^[^-+# \\]\\|")
+                                 ;; A `unified' header is ambiguous.
+                                 diff-file-header-re))
+                        (`context "^[^-+#! \\]")
+                        (`normal "^[^<>#\\]")
+                        (_ "^[^-+#!<> \\]"))
                       nil t)
                      (match-beginning 0)))
       (when diff-valid-unified-empty-line
@@ -492,19 +515,21 @@ See http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html")
     (goto-char (or end (point-max)))))
 
 (defun diff-beginning-of-hunk (&optional try-harder)
-  "Move back to beginning of hunk.
-If TRY-HARDER is non-nil, try to cater to the case where we're not in a hunk
-but in the file header instead, in which case move forward to the first hunk."
+  "Move back to the previous hunk beginning, and return its position.
+If point is in a file header rather than a hunk, advance to the
+next hunk if TRY-HARDER is non-nil; otherwise signal an error."
   (beginning-of-line)
-  (unless (looking-at diff-hunk-header-re)
+  (if (looking-at diff-hunk-header-re)
+      (point)
     (forward-line 1)
     (condition-case ()
        (re-search-backward diff-hunk-header-re)
       (error
-       (if (not try-harder)
-           (error "Can't find the beginning of the hunk")
-         (diff-beginning-of-file-and-junk)
-         (diff-hunk-next))))))
+       (unless try-harder
+        (error "Can't find the beginning of the hunk"))
+       (diff-beginning-of-file-and-junk)
+       (diff-hunk-next)
+       (point)))))
 
 (defun diff-unified-hunk-p ()
   (save-excursion
@@ -547,44 +572,72 @@ but in the file header instead, in which case move forward to the first hunk."
 (easy-mmode-define-navigation
  diff-file diff-file-header-re "file" diff-end-of-file)
 
+(defun diff-bounds-of-hunk ()
+  "Return the bounds of the diff hunk at point.
+The return value is a list (BEG END), which are the hunk's start
+and end positions.  Signal an error if no hunk is found.  If
+point is in a file header, return the bounds of the next hunk."
+  (save-excursion
+    (let ((pos (point))
+         (beg (diff-beginning-of-hunk t))
+         (end (diff-end-of-hunk)))
+      (cond ((>= end pos)
+            (list beg end))
+           ;; If this hunk ends above POS, consider the next hunk.
+           ((re-search-forward diff-hunk-header-re nil t)
+            (list (match-beginning 0) (diff-end-of-hunk)))
+           (t (error "No hunk found"))))))
+
+(defun diff-bounds-of-file ()
+  "Return the bounds of the file segment at point.
+The return value is a list (BEG END), which are the segment's
+start and end positions."
+  (save-excursion
+    (let ((pos (point))
+         (beg (progn (diff-beginning-of-file-and-junk)
+                     (point))))
+      (diff-end-of-file)
+      ;; bzr puts a newline after the last hunk.
+      (while (looking-at "^\n")
+       (forward-char 1))
+      (if (> pos (point))
+         (error "Not inside a file diff"))
+      (list beg (point)))))
+
 (defun diff-restrict-view (&optional arg)
   "Restrict the view to the current hunk.
 If the prefix ARG is given, restrict the view to the current file instead."
   (interactive "P")
-  (save-excursion
-    (if arg (diff-beginning-of-file) (diff-beginning-of-hunk 'try-harder))
-    (narrow-to-region (point)
-                     (progn (if arg (diff-end-of-file) (diff-end-of-hunk))
-                            (point)))
-    (set (make-local-variable 'diff-narrowed-to) (if arg 'file 'hunk))))
-
+  (apply 'narrow-to-region
+        (if arg (diff-bounds-of-file) (diff-bounds-of-hunk)))
+  (set (make-local-variable 'diff-narrowed-to) (if arg 'file 'hunk)))
 
 (defun diff-hunk-kill ()
-  "Kill current hunk."
+  "Kill the hunk at point."
   (interactive)
-  (diff-beginning-of-hunk)
-  (let* ((start (point))
-         ;; Search the second match, since we're looking at the first.
-        (nexthunk (when (re-search-forward diff-hunk-header-re nil t 2)
-                    (match-beginning 0)))
-        (firsthunk (ignore-errors
-                     (goto-char start)
-                     (diff-beginning-of-file) (diff-hunk-next) (point)))
-        (nextfile (ignore-errors (diff-file-next) (point)))
+  (let* ((hunk-bounds (diff-bounds-of-hunk))
+        (file-bounds (ignore-errors (diff-bounds-of-file)))
+        ;; If the current hunk is the only one for its file, kill the
+        ;; file header too.
+        (bounds (if (and file-bounds
+                         (progn (goto-char (car file-bounds))
+                                (= (progn (diff-hunk-next) (point))
+                                   (car hunk-bounds)))
+                         (progn (goto-char (cadr hunk-bounds))
+                                ;; bzr puts a newline after the last hunk.
+                                (while (looking-at "^\n")
+                                  (forward-char 1))
+                                (= (point) (cadr file-bounds))))
+                    file-bounds
+                  hunk-bounds))
         (inhibit-read-only t))
-    (goto-char start)
-    (if (and firsthunk (= firsthunk start)
-            (or (null nexthunk)
-                (and nextfile (> nexthunk nextfile))))
-       ;; It's the only hunk for this file, so kill the file.
-       (diff-file-kill)
-      (diff-end-of-hunk)
-      (kill-region start (point)))))
+    (apply 'kill-region bounds)
+    (goto-char (car bounds))))
 
 ;; "index ", "old mode", "new mode", "new file mode" and
 ;; "deleted file mode" are output by git-diff.
 (defconst diff-file-junk-re
-  "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode")
+  "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) mode\\|=== modified file")
 
 (defun diff-beginning-of-file-and-junk ()
   "Go to the beginning of file-related diff-info.
@@ -636,13 +689,8 @@ data such as \"Index: ...\" and such."
 (defun diff-file-kill ()
   "Kill current file's hunks."
   (interactive)
-  (let ((orig (point))
-        (start (progn (diff-beginning-of-file-and-junk) (point)))
-        (inhibit-read-only t))
-    (diff-end-of-file)
-    (if (looking-at "^\n") (forward-char 1)) ;`tla' generates such diffs.
-    (if (> orig (point)) (error "Not inside a file diff"))
-    (kill-region start (point))))
+  (let ((inhibit-read-only t))
+    (apply 'kill-region (diff-bounds-of-file))))
 
 (defun diff-kill-junk ()
   "Kill spurious empty diffs."
@@ -663,7 +711,7 @@ data such as \"Index: ...\" and such."
   (save-excursion
     (let ((n 0))
       (goto-char start)
-      (while (re-search-forward re end t) (incf n))
+      (while (re-search-forward re end t) (cl-incf n))
       n)))
 
 (defun diff-splittable-p ()
@@ -678,7 +726,7 @@ data such as \"Index: ...\" and such."
   (interactive)
   (beginning-of-line)
   (let ((pos (point))
-       (start (progn (diff-beginning-of-hunk) (point))))
+       (start (diff-beginning-of-hunk)))
     (unless (looking-at diff-hunk-header-re-unified)
       (error "diff-split-hunk only works on unified context diffs"))
     (forward-line 1)
@@ -787,16 +835,16 @@ PREFIX is only used internally: don't use it."
        ;; use any previously used preference
        (cdr (assoc fs diff-remembered-files-alist))
        ;; try to be clever and use previous choices as an inspiration
-       (dolist (rf diff-remembered-files-alist)
+       (cl-dolist (rf diff-remembered-files-alist)
         (let ((newfile (diff-merge-strings (caar rf) (car fs) (cdr rf))))
-          (if (and newfile (file-exists-p newfile)) (return newfile))))
+          (if (and newfile (file-exists-p newfile)) (cl-return newfile))))
        ;; look for each file in turn.  If none found, try again but
        ;; ignoring the first level of directory, ...
-       (do* ((files fs (delq nil (mapcar 'diff-filename-drop-dir files)))
-            (file nil nil))
+       (cl-do* ((files fs (delq nil (mapcar 'diff-filename-drop-dir files)))
+                (file nil nil))
           ((or (null files)
-               (setq file (do* ((files files (cdr files))
-                                (file (car files) (car files)))
+               (setq file (cl-do* ((files files (cdr files))
+                                    (file (car files) (car files)))
                               ;; Use file-regular-p to avoid
                               ;; /dev/null, directories, etc.
                               ((or (null file) (file-regular-p file))
@@ -815,7 +863,7 @@ PREFIX is only used internally: don't use it."
            (diff-find-file-name old noprompt (match-string 1)))
        ;; if all else fails, ask the user
        (unless noprompt
-         (let ((file (expand-file-name (or (first fs) ""))))
+         (let ((file (expand-file-name (or (car fs) ""))))
           (setq file
                 (read-file-name (format "Use file %s: " file)
                                 (file-name-directory file) file t
@@ -893,21 +941,23 @@ else cover the whole buffer."
                    (let ((modif nil) last-pt)
                      (while (progn (setq last-pt (point))
                                    (= (forward-line -1) 0))
-                       (case (char-after)
+                       (pcase (char-after)
                          (?\s (insert " ") (setq modif nil) (backward-char 1))
                          (?+ (delete-region (point) last-pt) (setq modif t))
                          (?- (if (not modif)
-                                 (progn (forward-char 1)
-                                        (insert " "))
-                               (delete-char 1)
-                               (insert "! "))
-                             (backward-char 2))
+                                  (progn (forward-char 1)
+                                         (insert " "))
+                                (delete-char 1)
+                                (insert "! "))
+                              (backward-char 2))
                          (?\\ (when (save-excursion (forward-line -1)
-                                                    (= (char-after) ?+))
-                                (delete-region (point) last-pt) (setq modif t)))
+                                                     (= (char-after) ?+))
+                                 (delete-region (point) last-pt)
+                                 (setq modif t)))
                           ;; diff-valid-unified-empty-line.
-                          (?\n (insert "  ") (setq modif nil) (backward-char 2))
-                         (t (setq modif nil))))))
+                          (?\n (insert "  ") (setq modif nil)
+                               (backward-char 2))
+                         (_ (setq modif nil))))))
                  (goto-char (point-max))
                  (save-excursion
                    (insert "--- " line2 ","
@@ -920,7 +970,8 @@ else cover the whole buffer."
                  (if (not (save-excursion (re-search-forward "^+" nil t)))
                      (delete-region (point) (point-max))
                    (let ((modif nil) (delete nil))
-                     (if (save-excursion (re-search-forward "^\\+.*\n-" nil t))
+                     (if (save-excursion (re-search-forward "^\\+.*\n-"
+                                                             nil t))
                           ;; Normally, lines in a substitution come with
                           ;; first the removals and then the additions, and
                           ;; the context->unified function follows this
@@ -929,22 +980,22 @@ else cover the whole buffer."
                           ;; context->unified as an undo command.
                          (setq reversible nil))
                      (while (not (eobp))
-                       (case (char-after)
+                       (pcase (char-after)
                          (?\s (insert " ") (setq modif nil) (backward-char 1))
                          (?- (setq delete t) (setq modif t))
                          (?+ (if (not modif)
-                                 (progn (forward-char 1)
-                                        (insert " "))
-                               (delete-char 1)
-                               (insert "! "))
-                             (backward-char 2))
+                                  (progn (forward-char 1)
+                                         (insert " "))
+                                (delete-char 1)
+                                (insert "! "))
+                              (backward-char 2))
                          (?\\ (when (save-excursion (forward-line 1)
-                                                    (not (eobp)))
-                                (setq delete t) (setq modif t)))
+                                                     (not (eobp)))
+                                 (setq delete t) (setq modif t)))
                           ;; diff-valid-unified-empty-line.
                           (?\n (insert "  ") (setq modif nil) (backward-char 2)
                                (setq reversible nil))
-                         (t (setq modif nil)))
+                         (_ (setq modif nil)))
                        (let ((last-pt (point)))
                          (forward-line 1)
                          (when delete
@@ -1004,17 +1055,18 @@ With a prefix argument, convert unified format to context format."
                   (goto-char pt1)
                   (forward-line 1)
                   (while (< (point) pt2)
-                    (case (char-after)
+                    (pcase (char-after)
                       (?! (delete-char 2) (insert "-") (forward-line 1))
                       (?- (forward-char 1) (delete-char 1) (forward-line 1))
-                      (?\s           ;merge with the other half of the chunk
+                      (?\s              ;merge with the other half of the chunk
                        (let* ((endline2
                                (save-excursion
                                  (goto-char pt2) (forward-line 1) (point))))
-                         (case (char-after pt2)
-                           ((?! ?+)
+                         (pcase (char-after pt2)
+                           ((or ?! ?+)
                             (insert "+"
-                                    (prog1 (buffer-substring (+ pt2 2) endline2)
+                                    (prog1
+                                        (buffer-substring (+ pt2 2) endline2)
                                       (delete-region pt2 endline2))))
                            (?\s
                             (unless (= (- endline2 pt2)
@@ -1028,9 +1080,9 @@ With a prefix argument, convert unified format to context format."
                             (delete-char 1)
                             (forward-line 1))
                            (?\\ (forward-line 1))
-                           (t (setq reversible nil)
+                           (_ (setq reversible nil)
                               (delete-char 1) (forward-line 1)))))
-                      (t (setq reversible nil) (forward-line 1))))
+                      (_ (setq reversible nil) (forward-line 1))))
                   (while (looking-at "[+! ] ")
                     (if (/= (char-after) ?!) (forward-char 1)
                       (delete-char 1) (insert "+"))
@@ -1108,13 +1160,13 @@ else cover the whole buffer."
            (replace-match "@@ -\\8 +\\7 @@" nil)
            (forward-line 1)
            (let ((c (char-after)) first last)
-             (while (case (setq c (char-after))
+             (while (pcase (setq c (char-after))
                       (?- (setq first (or first (point)))
-                          (delete-char 1) (insert "+") t)
+                           (delete-char 1) (insert "+") t)
                       (?+ (setq last (or last (point)))
-                          (delete-char 1) (insert "-") t)
-                      ((?\\ ?#) t)
-                      (t (when (and first last (< first last))
+                           (delete-char 1) (insert "-") t)
+                      ((or ?\\ ?#) t)
+                      (_ (when (and first last (< first last))
                            (insert (delete-and-extract-region first last)))
                          (setq first nil last nil)
                          (memq c (if diff-valid-unified-empty-line
@@ -1137,13 +1189,13 @@ else cover the whole buffer."
                    (concat diff-hunk-header-re-unified
                            "\\|[-*][-*][-*] [0-9,]+ [-*][-*][-*][-*]$"
                            "\\|--- .+\n\\+\\+\\+ ")))
-             (case (char-after)
-               (?\s (incf space))
-               (?+ (incf plus))
-               (?- (incf minus))
-               (?! (incf bang))
-               ((?\\ ?#) nil)
-               (t  (setq space 0 plus 0 minus 0 bang 0)))
+             (pcase (char-after)
+               (?\s (cl-incf space))
+               (?+ (cl-incf plus))
+               (?- (cl-incf minus))
+               (?! (cl-incf bang))
+               ((or ?\\ ?#) nil)
+               (_  (setq space 0 plus 0 minus 0 bang 0)))
            (cond
             ((looking-at diff-hunk-header-re-unified)
              (let* ((old1 (match-string 2))
@@ -1283,11 +1335,7 @@ a diff with \\[diff-reverse-direction].
   (set (make-local-variable 'end-of-defun-function)
        'diff-end-of-file)
 
-  ;; Set up `whitespace-mode' so that turning it on will show trailing
-  ;; whitespace problems on the modified lines of the diff.
-  (set (make-local-variable 'whitespace-style) '(face trailing))
-  (set (make-local-variable 'whitespace-trailing-regexp)
-       "^[-\+!<>].*?\\([\t ]+\\)$")
+  (diff-setup-whitespace)
 
   (setq buffer-read-only diff-default-read-only)
   ;; setup change hooks
@@ -1332,6 +1380,22 @@ the mode if ARG is omitted or nil.
 
 ;;; Handy hook functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(defun diff-setup-whitespace ()
+  "Set up Whitespace mode variables for the current Diff mode buffer.
+This sets `whitespace-style' and `whitespace-trailing-regexp' so
+that Whitespace mode shows trailing whitespace problems on the
+modified lines of the diff."
+  (set (make-local-variable 'whitespace-style) '(face trailing))
+  (let ((style (save-excursion
+                (goto-char (point-min))
+                (when (re-search-forward diff-hunk-header-re nil t)
+                  (goto-char (match-beginning 0))
+                  (diff-hunk-style)))))
+    (set (make-local-variable 'whitespace-trailing-regexp)
+        (if (eq style 'context)
+            "^[-\+!] .*?\\([\t ]+\\)$"
+          "^[-\+!<>].*?\\([\t ]+\\)$"))))
+
 (defun diff-delete-if-empty ()
   ;; An empty diff file means there's no more diffs to integrate, so we
   ;; can just remove the file altogether.  Very handy for .rej files if we
@@ -1373,7 +1437,7 @@ Only works for unified diffs."
         (cond
          ((and (memq (char-after) '(?\s ?! ?+ ?-))
                (memq (char-after (1+ (point))) '(?\s ?\t)))
-          (decf count) t)
+          (cl-decf count) t)
          ((or (zerop count) (= count lines)) nil)
          ((memq (char-after) '(?! ?+ ?-))
           (if (not (and (eq (char-after (1+ (point))) ?\n)
@@ -1424,8 +1488,8 @@ Only works for unified diffs."
                 (after (string-to-number (or (match-string 4) "1"))))
             (forward-line)
             (while
-                (case (char-after)
-                  (?\s (decf before) (decf after) t)
+                (pcase (char-after)
+                  (?\s (cl-decf before) (cl-decf after) t)
                   (?-
                    (if (and (looking-at diff-file-header-re)
                             (zerop before) (zerop after))
@@ -1435,15 +1499,15 @@ Only works for unified diffs."
                        ;; line so that our code which doesn't count lines
                        ;; will not get confused.
                        (progn (save-excursion (insert "\n")) nil)
-                     (decf before) t))
-                  (?+ (decf after) t)
-                  (t
+                     (cl-decf before) t))
+                  (?+ (cl-decf after) t)
+                  (_
                    (cond
                     ((and diff-valid-unified-empty-line
                           ;; Not just (eolp) so we don't infloop at eob.
                           (eq (char-after) ?\n)
                           (> before 0) (> after 0))
-                     (decf before) (decf after) t)
+                     (cl-decf before) (cl-decf after) t)
                     ((and (zerop before) (zerop after)) nil)
                     ((or (< before 0) (< after 0))
                      (error (if (or (zerop before) (zerop after))
@@ -1588,8 +1652,7 @@ SWITCHED is non-nil if the patch is already applied.
 NOPROMPT, if non-nil, means not to prompt the user."
   (save-excursion
     (let* ((other (diff-xor other-file diff-jump-to-old-file))
-          (char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder)
-                                          (point))))
+          (char-offset (- (point) (diff-beginning-of-hunk t)))
            ;; Check that the hunk is well-formed.  Otherwise diff-mode and
            ;; the user may disagree on what constitutes the hunk
            ;; (e.g. because an empty line truncates the hunk mid-course),
@@ -1661,16 +1724,17 @@ the value of this variable when given an appropriate prefix argument).
 
 With a prefix argument, REVERSE the hunk."
   (interactive "P")
-  (destructuring-bind (buf line-offset pos old new &optional switched)
-      ;; Sometimes we'd like to have the following behavior: if REVERSE go
-      ;; to the new file, otherwise go to the old.  But that means that by
-      ;; default we use the old file, which is the opposite of the default
-      ;; for diff-goto-source, and is thus confusing.  Also when you don't
-      ;; know about it it's pretty surprising.
-      ;; TODO: make it possible to ask explicitly for this behavior.
-      ;;
-      ;; This is duplicated in diff-test-hunk.
-      (diff-find-source-location nil reverse)
+  (pcase-let ((`(,buf ,line-offset ,pos ,old ,new ,switched)
+               ;; Sometimes we'd like to have the following behavior: if
+               ;; REVERSE go to the new file, otherwise go to the old.
+               ;; But that means that by default we use the old file, which is
+               ;; the opposite of the default for diff-goto-source, and is thus
+               ;; confusing.  Also when you don't know about it it's
+               ;; pretty surprising.
+               ;; TODO: make it possible to ask explicitly for this behavior.
+               ;;
+               ;; This is duplicated in diff-test-hunk.
+               (diff-find-source-location nil reverse)))
     (cond
      ((null line-offset)
       (error "Can't find the text to patch"))
@@ -1713,8 +1777,8 @@ With a prefix argument, REVERSE the hunk."
   "See whether it's possible to apply the current hunk.
 With a prefix argument, try to REVERSE the hunk."
   (interactive "P")
-  (destructuring-bind (buf line-offset pos src _dst &optional switched)
-      (diff-find-source-location nil reverse)
+  (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
+               (diff-find-source-location nil reverse)))
     (set-window-point (display-buffer buf) (+ (car pos) (cdr src)))
     (diff-hunk-status-msg line-offset (diff-xor reverse switched) t)))
 
@@ -1733,8 +1797,8 @@ then `diff-jump-to-old-file' is also set, for the next invocations."
   ;; This is a convenient detail when using smerge-diff.
   (if event (posn-set-point (event-end event)))
   (let ((rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
-    (destructuring-bind (buf line-offset pos src _dst &optional switched)
-       (diff-find-source-location other-file rev)
+    (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
+                 (diff-find-source-location other-file rev)))
       (pop-to-buffer buf)
       (goto-char (+ (car pos) (cdr src)))
       (diff-hunk-status-msg line-offset (diff-xor rev switched) t))))
@@ -1751,10 +1815,11 @@ For use in `add-log-current-defun-function'."
     (when (looking-at diff-hunk-header-re)
       (forward-line 1)
       (re-search-forward "^[^ ]" nil t))
-    (destructuring-bind (&optional buf _line-offset pos src dst switched)
-        ;; Use `noprompt' since this is used in which-func-mode and such.
-       (ignore-errors                ;Signals errors in place of prompting.
-          (diff-find-source-location nil nil 'noprompt))
+    (pcase-let ((`(,buf ,_line-offset ,pos ,src ,dst ,switched)
+                 (ignore-errors         ;Signals errors in place of prompting.
+                   ;; Use `noprompt' since this is used in which-func-mode
+                   ;; and such.
+                   (diff-find-source-location nil nil 'noprompt))))
       (when buf
         (beginning-of-line)
         (or (when (memq (char-after) '(?< ?-))
@@ -1776,9 +1841,8 @@ For use in `add-log-current-defun-function'."
 (defun diff-ignore-whitespace-hunk ()
   "Re-diff the current hunk, ignoring whitespace differences."
   (interactive)
-  (let* ((char-offset (- (point) (progn (diff-beginning-of-hunk 'try-harder)
-                                        (point))))
-        (opts (case (char-after) (?@ "-bu") (?* "-bc") (t "-b")))
+  (let* ((char-offset (- (point) (diff-beginning-of-hunk t)))
+        (opts (pcase (char-after) (?@ "-bu") (?* "-bc") (_ "-b")))
         (line-nb (and (or (looking-at "[^0-9]+\\([0-9]+\\)")
                           (error "Can't find line number"))
                       (string-to-number (match-string 1))))
@@ -1800,13 +1864,13 @@ For use in `add-log-current-defun-function'."
            (let ((status
                   (call-process diff-command nil t nil
                                 opts file1 file2)))
-             (case status
-               (0 nil)                 ;Nothing to reformat.
+             (pcase status
+               (0 nil)                 ;Nothing to reformat.
                (1 (goto-char (point-min))
-                  ;; Remove the file-header.
-                  (when (re-search-forward diff-hunk-header-re nil t)
-                    (delete-region (point-min) (match-beginning 0))))
-               (t (goto-char (point-max))
+                   ;; Remove the file-header.
+                   (when (re-search-forward diff-hunk-header-re nil t)
+                     (delete-region (point-min) (match-beginning 0))))
+               (_ (goto-char (point-max))
                   (unless (bolp) (insert "\n"))
                   (insert hunk)))
              (setq hunk (buffer-string))
@@ -1822,17 +1886,35 @@ For use in `add-log-current-defun-function'."
 
 (defface diff-refine-change
   '((((class color) (min-colors 88) (background light))
-     :background "grey85")
+     :background "#ffff55")
     (((class color) (min-colors 88) (background dark))
-     :background "grey60")
-    (((class color) (background light))
-     :background "yellow")
-    (((class color) (background dark))
-     :background "green")
-    (t :weight bold))
+     :background "#aaaa22")
+    (t :inverse-video t))
   "Face used for char-based changes shown by `diff-refine-hunk'."
   :group 'diff-mode)
 
+(defface diff-refine-removed
+  '((default
+     :inherit diff-refine-change)
+    (((class color) (min-colors 88) (background light))
+     :background "#ffaaaa")
+    (((class color) (min-colors 88) (background dark))
+     :background "#aa2222"))
+  "Face used for removed characters shown by `diff-refine-hunk'."
+  :group 'diff-mode
+  :version "24.2")
+
+(defface diff-refine-added
+  '((default
+     :inherit diff-refine-change)
+    (((class color) (min-colors 88) (background light))
+     :background "#aaffaa")
+    (((class color) (min-colors 88) (background dark))
+     :background "#22aa22"))
+  "Face used for added characters shown by `diff-refine-hunk'."
+  :group 'diff-mode
+  :version "24.2")
+
 (defun diff-refine-preproc ()
   (while (re-search-forward "^[+>]" nil t)
     ;; Remove spurious changes due to the fact that one side of the hunk is
@@ -1846,18 +1928,20 @@ For use in `add-log-current-defun-function'."
   )
 
 (declare-function smerge-refine-subst "smerge-mode"
-                  (beg1 end1 beg2 end2 props &optional preproc))
+                  (beg1 end1 beg2 end2 props-c &optional preproc props-r props-a))
 
 (defun diff-refine-hunk ()
   "Highlight changes of hunk at point at a finer granularity."
   (interactive)
   (require 'smerge-mode)
   (save-excursion
-    (diff-beginning-of-hunk 'try-harder)
+    (diff-beginning-of-hunk t)
     (let* ((start (point))
            (style (diff-hunk-style))    ;Skips the hunk header as well.
            (beg (point))
-           (props '((diff-mode . fine) (face diff-refine-change)))
+           (props-c '((diff-mode . fine) (face diff-refine-change)))
+           (props-r '((diff-mode . fine) (face diff-refine-removed)))
+           (props-a '((diff-mode . fine) (face diff-refine-added)))
            ;; Be careful to go back to `start' so diff-end-of-hunk gets
            ;; to read the hunk header's line info.
            (end (progn (goto-char start) (diff-end-of-hunk) (point))))
@@ -1865,14 +1949,14 @@ For use in `add-log-current-defun-function'."
       (remove-overlays beg end 'diff-mode 'fine)
 
       (goto-char beg)
-      (case style
-        (unified
+      (pcase style
+        (`unified
          (while (re-search-forward "^\\(?:-.*\n\\)+\\(\\)\\(?:\\+.*\n\\)+"
                                    end t)
            (smerge-refine-subst (match-beginning 0) (match-end 1)
                                 (match-end 1) (match-end 0)
-                                props 'diff-refine-preproc)))
-        (context
+                                nil 'diff-refine-preproc props-r props-a)))
+        (`context
          (let* ((middle (save-excursion (re-search-forward "^---")))
                 (other middle))
            (while (re-search-forward "^\\(?:!.*\n\\)+" middle t)
@@ -1883,15 +1967,23 @@ For use in `add-log-current-defun-function'."
                                     (setq other (match-end 0))
                                     (match-beginning 0))
                                   other
-                                  props 'diff-refine-preproc))))
-        (t ;; Normal diffs.
+                                  (if diff-use-changed-face props-c)
+                                  'diff-refine-preproc
+                                  (unless diff-use-changed-face props-r)
+                                  (unless diff-use-changed-face props-a)))))
+        (_ ;; Normal diffs.
          (let ((beg1 (1+ (point))))
            (when (re-search-forward "^---.*\n" end t)
              ;; It's a combined add&remove, so there's something to do.
              (smerge-refine-subst beg1 (match-beginning 0)
                                   (match-end 0) end
-                                  props 'diff-refine-preproc))))))))
+                                  nil 'diff-refine-preproc props-r props-a))))))))
 
+(defun diff-undo (&optional arg)
+  "Perform `undo', ignoring the buffer's read-only status."
+  (interactive "P")
+  (let ((inhibit-read-only t))
+    (undo arg)))
 
 (defun diff-add-change-log-entries-other-window ()
   "Iterate through the current diff and create ChangeLog entries.
index 05208894356fb971fa950c5f4a9244d1f561e449..b70b6cd919ce03ac1803e92c21b266b149022660 100644 (file)
@@ -1,4 +1,4 @@
-;;; diff.el --- run `diff'
+;;; diff.el --- run `diff'  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1992, 1994, 1996, 2001-2012 Free Software Foundation, Inc.
 
@@ -30,7 +30,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(declare-function diff-setup-whitespace "diff-mode" ())
 
 (defgroup diff nil
   "Comparing files with `diff'."
@@ -64,6 +64,8 @@ If optional args OLD-TEMP-FILE and/or NEW-TEMP-FILE are non-nil,
 delete the temporary files so named."
   (if old-temp-file (delete-file old-temp-file))
   (if new-temp-file (delete-file new-temp-file))
+  (diff-setup-whitespace)
+  (goto-char (point-min))
   (save-excursion
     (goto-char (point-max))
     (let ((inhibit-read-only t))
@@ -144,11 +146,8 @@ specified in `diff-switches' are passed to the diff command."
       (buffer-enable-undo (current-buffer))
       (diff-mode)
       (set (make-local-variable 'revert-buffer-function)
-           (lexical-let ((old old) (new new)
-                         (switches switches)
-                         (no-async no-async))
-             (lambda (ignore-auto noconfirm)
-               (diff-no-select old new switches no-async (current-buffer)))))
+           (lambda (_ignore-auto _noconfirm)
+             (diff-no-select old new switches no-async (current-buffer))))
       (setq default-directory thisdir)
       (let ((inhibit-read-only t))
        (insert command "\n"))
@@ -156,12 +155,11 @@ specified in `diff-switches' are passed to the diff command."
          (let ((proc (start-process "Diff" buf shell-file-name
                                      shell-command-switch command)))
            (set-process-filter proc 'diff-process-filter)
-            (lexical-let ((old-alt old-alt) (new-alt new-alt))
-              (set-process-sentinel
-               proc (lambda (proc msg)
-                      (with-current-buffer (process-buffer proc)
-                        (diff-sentinel (process-exit-status proc)
-                                       old-alt new-alt))))))
+            (set-process-sentinel
+             proc (lambda (proc _msg)
+                    (with-current-buffer (process-buffer proc)
+                      (diff-sentinel (process-exit-status proc)
+                                     old-alt new-alt)))))
        ;; Async processes aren't available.
        (let ((inhibit-read-only t))
          (diff-sentinel
index 37b7fce6f327e8b00bbbb7ba73342246190c0b00..5b31e625a009940bd322709afc606914f2a8c0b2 100644 (file)
@@ -101,7 +101,7 @@ the command \\[ediff-show-diff-output]. Use the variable
   :group 'ediff-diff)
 
 (ediff-defvar-local ediff-ignore-case nil
-  "*If t, skip over difference regions that differ only in letter case.
+  "If t, skip over difference regions that differ only in letter case.
 This variable can be set either in .emacs or toggled interactively.
 Use `setq-default' if setting it in .emacs")
 
@@ -165,12 +165,12 @@ This variable can be set either in .emacs or toggled interactively.
 Use `setq-default' if setting it in .emacs")
 
 (ediff-defvar-local ediff-ignore-similar-regions nil
-  "*If t, skip over difference regions that differ only in the white space and line breaks.
+  "If t, skip over difference regions that differ only in the white space and line breaks.
 This variable can be set either in .emacs or toggled interactively.
 Use `setq-default' if setting it in .emacs")
 
 (ediff-defvar-local ediff-auto-refine-limit 14000
-  "*Auto-refine only the regions of this size \(in bytes\) or less.")
+  "Auto-refine only the regions of this size \(in bytes\) or less.")
 
 ;;; General
 
@@ -1288,38 +1288,38 @@ delimiter regions"))
 ;;; Word functions used to refine the current diff
 
 (defvar ediff-forward-word-function 'ediff-forward-word
-  "*Function to call to move to the next word.
+  "Function to call to move to the next word.
 Used for splitting difference regions into individual words.")
 (make-variable-buffer-local 'ediff-forward-word-function)
 
 ;; \240 is Unicode symbol for nonbreakable whitespace
 (defvar ediff-whitespace " \n\t\f\r\240"
-  "*Characters constituting white space.
+  "Characters constituting white space.
 These characters are ignored when differing regions are split into words.")
 (make-variable-buffer-local 'ediff-whitespace)
 
 (defvar ediff-word-1
   (if (featurep 'xemacs) "a-zA-Z---_" "-[:word:]_")
-  "*Characters that constitute words of type 1.
+  "Characters that constitute words of type 1.
 More precisely, [ediff-word-1] is a regexp that matches type 1 words.
 See `ediff-forward-word' for more details.")
 (make-variable-buffer-local 'ediff-word-1)
 
 (defvar ediff-word-2 "0-9.,"
-  "*Characters that constitute words of type 2.
+  "Characters that constitute words of type 2.
 More precisely, [ediff-word-2] is a regexp that matches type 2 words.
 See `ediff-forward-word' for more details.")
 (make-variable-buffer-local 'ediff-word-2)
 
 (defvar ediff-word-3 "`'?!:;\"{}[]()"
-  "*Characters that constitute words of type 3.
+  "Characters that constitute words of type 3.
 More precisely, [ediff-word-3] is a regexp that matches type 3 words.
 See `ediff-forward-word' for more details.")
 (make-variable-buffer-local 'ediff-word-3)
 
 (defvar ediff-word-4
   (concat "^" ediff-word-1 ediff-word-2 ediff-word-3 ediff-whitespace)
-  "*Characters that constitute words of type 4.
+  "Characters that constitute words of type 4.
 More precisely, [ediff-word-4] is a regexp that matches type 4 words.
 See `ediff-forward-word' for more details.")
 (make-variable-buffer-local 'ediff-word-4)
@@ -1406,13 +1406,27 @@ arguments to `skip-chars-forward'."
   "Return t if files F1 and F2 have identical contents."
   (if (and (not (file-directory-p f1))
            (not (file-directory-p f2)))
-      (let ((res
-            (apply 'call-process ediff-cmp-program nil nil nil
-                   (append ediff-cmp-options (list (expand-file-name f1)
-                                                   (expand-file-name f2))))
-            ))
-       (and (numberp res) (eq res 0)))
-    ))
+      (if (equal (file-remote-p f1) (file-remote-p f2))
+         (let ((res
+                ;; In the remote case, this works only if F1 and F2 are
+                ;; located on the same remote host.
+                (apply 'process-file ediff-cmp-program nil nil nil
+                       (append ediff-cmp-options
+                               (list (or (file-remote-p f1 'localname)
+                                         (expand-file-name f1))
+                                     (or (file-remote-p f2 'localname)
+                                         (expand-file-name f2)))))
+                ))
+           (and (numberp res) (eq res 0)))
+
+       ;; F1 and F2 are not located on the same host.
+       (let ((t1 (file-local-copy f1))
+             (t2 (file-local-copy f2)))
+         (unwind-protect
+             (ediff-same-file-contents (or t1 f1) (or t2 f2))
+           (and t1 (delete-file t1))
+           (and t2 (delete-file t2))))
+    )))
 
 
 (defun ediff-same-contents (d1 d2 &optional filter-re)
index 2de5e4dbdaf5b760918c97162d55a23c6e82ff78..674688df1c24a58647fa27a729b2111e53806879 100644 (file)
@@ -594,7 +594,7 @@ highlighted using ASCII flags."
 (ediff-defvar-local ediff-start-narrowed t
   "Non-nil means start narrowed, if doing ediff-windows-* or ediff-regions-*")
 (ediff-defvar-local ediff-quit-widened t
-  "*Non-nil means: when finished, Ediff widens buffers A/B.
+  "Non-nil means: when finished, Ediff widens buffers A/B.
 Actually, Ediff restores the scope of visibility that existed at startup.")
 
 (defcustom ediff-keep-variants t
@@ -786,19 +786,12 @@ TYPE-OF-EMACS is either 'xemacs or 'emacs."
   "")
 
 
-(if (ediff-window-display-p)
-    (if (featurep 'xemacs)
-       (progn
-         (defalias 'ediff-display-pixel-width 'device-pixel-width)
-         (defalias 'ediff-display-pixel-height 'device-pixel-height))
-      (defalias 'ediff-display-pixel-width
-       (if (fboundp 'display-pixel-width)
-           'display-pixel-width
-         'x-display-pixel-width))
-      (defalias 'ediff-display-pixel-height
-       (if (fboundp 'display-pixel-height)
-           'display-pixel-height
-         'x-display-pixel-height))))
+(if (featurep 'xemacs)
+    (progn
+      (defalias 'ediff-display-pixel-width 'device-pixel-width)
+      (defalias 'ediff-display-pixel-height 'device-pixel-height))
+  (defalias 'ediff-display-pixel-width 'display-pixel-width)
+  (defalias 'ediff-display-pixel-height 'display-pixel-height))
 
 ;; A-list of current-diff-overlay symbols associated with buf types
 (defconst ediff-current-diff-overlay-alist
@@ -860,7 +853,11 @@ TYPE-OF-EMACS is either 'xemacs or 'emacs."
 
 (defface ediff-current-diff-A
   (if (featurep 'emacs)
-      '((((class color) (min-colors 16))
+      '((((class color) (min-colors 88) (background light))
+        :background "#ffdddd")
+       (((class color) (min-colors 88) (background dark))
+        :background "#553333")
+       (((class color) (min-colors 16))
         (:foreground "firebrick" :background "pale green"))
        (((class color))
         (:foreground "blue3" :background "yellow3"))
@@ -889,7 +886,11 @@ this variable represents.")
 
 (defface ediff-current-diff-B
   (if (featurep 'emacs)
-      '((((class color) (min-colors 16))
+      '((((class color) (min-colors 88) (background light))
+        :background "#ddffdd")
+       (((class color) (min-colors 88) (background dark))
+        :background "#335533")
+       (((class color) (min-colors 16))
         (:foreground "DarkOrchid" :background "Yellow"))
        (((class color))
         (:foreground "magenta3" :background "yellow3"
@@ -919,7 +920,11 @@ this variable represents.")
 
 (defface ediff-current-diff-C
   (if (featurep 'emacs)
-      '((((class color) (min-colors 16))
+      '((((class color) (min-colors 88) (background light))
+        :background "#ffffaa")
+       (((class color) (min-colors 88) (background dark))
+        :background "#888833")
+       (((class color) (min-colors 16))
         (:foreground "Navy" :background "Pink"))
        (((class color))
         (:foreground "cyan3" :background "yellow3" :weight bold))
@@ -975,7 +980,11 @@ this variable represents.")
 
 (defface ediff-fine-diff-A
   (if (featurep 'emacs)
-      '((((class color) (min-colors 16))
+      '((((class color) (min-colors 88) (background light))
+        :background "#ffaaaa")
+       (((class color) (min-colors 88) (background dark))
+        :background "#aa2222")
+       (((class color) (min-colors 16))
         (:foreground "Navy" :background "sky blue"))
        (((class color))
         (:foreground "white" :background "sky blue" :weight bold))
@@ -996,7 +1005,11 @@ this variable represents.")
 
 (defface ediff-fine-diff-B
   (if (featurep 'emacs)
-      '((((class color) (min-colors 16))
+      '((((class color) (min-colors 88) (background light))
+        :background "#aaffaa")
+       (((class color) (min-colors 88) (background dark))
+        :background "#22aa22")
+       (((class color) (min-colors 16))
         (:foreground "Black" :background "cyan"))
        (((class color))
         (:foreground "magenta3" :background "cyan3"))
@@ -1017,7 +1030,11 @@ this variable represents.")
 
 (defface ediff-fine-diff-C
   (if (featurep 'emacs)
-      '((((type pc))
+      '((((class color) (min-colors 88) (background light))
+        :background "#ffff55")
+       (((class color) (min-colors 88) (background dark))
+        :background "#aaaa22")
+       (((type pc))
         (:foreground "white" :background "Turquoise"))
        (((class color) (min-colors 16))
         (:foreground "Black" :background "Turquoise"))
index 83098fcb0c79e3e7f8a7f838f9658d909286e990..cc8ef4ad5c07f882ea0a7c5d56f936bd63021710 100644 (file)
       'ediff-setup-windows-multiframe
     'ediff-setup-windows-plain))
 
-(defcustom ediff-window-setup-function (ediff-choose-window-setup-function-automatically)
+(make-obsolete 'ediff-choose-window-setup-function-automatically
+              'ediff-setup-windows-default "24.2")
+
+(defcustom ediff-window-setup-function 'ediff-setup-windows-default
   "Function called to set up windows.
-Ediff provides a choice of two functions: `ediff-setup-windows-plain', for
-doing everything in one frame and `ediff-setup-windows-multiframe', which sets
-the control panel in a separate frame. By default, the appropriate function is
-chosen automatically depending on the current window system.
-However, `ediff-toggle-multiframe' can be used to toggle between the multiframe
-display and the single frame display.
-If the multiframe function detects that one of the buffers A/B is seen in some
-other frame, it will try to keep that buffer in that frame.
+Ediff provides a choice of three functions:
+ (1) `ediff-setup-windows-multiframe', which sets the control panel
+     in a separate frame.
+ (2) `ediff-setup-windows-plain', which does everything in one frame
+ (3) `ediff-setup-windows-default' (the default), which does (1)
+     on a graphical display and (2) on a text terminal.
+
+The command \\[ediff-toggle-multiframe] can be used to toggle
+between the multiframe display and the single frame display.  If
+the multiframe function detects that one of the buffers A/B is
+seen in some other frame, it will try to keep that buffer in that
+frame.
 
 If you don't like any of the two provided functions, write your own one.
 The basic guidelines:
@@ -90,10 +97,12 @@ The basic guidelines:
        Buffer C may not be used in jobs that compare only two buffers.
 If you plan to do something fancy, take a close look at how the two
 provided functions are written."
-  :type '(choice (const :tag "Multi Frame" ediff-setup-windows-multiframe)
+  :type '(choice (const :tag "Choose Automatically" ediff-setup-windows-default)
+                (const :tag "Multi Frame" ediff-setup-windows-multiframe)
                 (const :tag "Single Frame" ediff-setup-windows-plain)
                 (function :tag "Other function"))
-  :group 'ediff-window)
+  :group 'ediff-window
+  :version "24.2")
 
 ;; indicates if we are in a multiframe setup
 (ediff-defvar-local ediff-multiframe nil "")
@@ -333,6 +342,12 @@ into icons, regardless of the window manager."
        buffer-A buffer-B buffer-C control-buffer))
   (run-hooks 'ediff-after-setup-windows-hook))
 
+(defun ediff-setup-windows-default (buffer-A buffer-B buffer-C control-buffer)
+  (funcall (if (display-graphic-p)
+              'ediff-setup-windows-multiframe
+            'ediff-setup-windows-plain)
+          buffer-A buffer-B buffer-C control-buffer))
+
 ;; Just set up 3 windows.
 ;; Usually used without windowing systems
 ;; With windowing, we want to use dedicated frames.
@@ -942,7 +957,7 @@ into icons, regardless of the window manager."
          (and (eq this-command 'ediff-toggle-help)
               dont-iconify-ctl-frame))
 
-    ;; 1 more line for the modeline
+    ;; 1 more line for the mode line
     (setq lines (1+ (count-lines (point-min) (point-max)))
          fheight lines
          fwidth (max (+ (ediff-help-message-line-length) 2)
@@ -1126,7 +1141,7 @@ It assumes that it is called from within the control buffer."
 
 
 ;; Revise the mode line to display which difference we have selected
-;; Also resets modelines of buffers A/B, since they may be clobbered by
+;; Also resets mode lines of buffers A/B, since they may be clobbered by
 ;; other invocations of Ediff.
 (defun ediff-refresh-mode-lines ()
   (let (buf-A-state-diff buf-B-state-diff buf-C-state-diff buf-C-state-merge)
index 4d6afa96d64e7164abd8d840a41cdc45ad994006..9a20afd90cbddb47d900290c1b915e0fb47ecaf6 100644 (file)
 (require 'ediff-mult)  ; required because of the registry stuff
 
 (defgroup ediff nil
-  "A comprehensive visual interface to diff & patch."
+  "Comprehensive visual interface to `diff' and `patch'."
   :tag "Ediff"
   :group 'tools)
 
 ;; Used as a startup hook to set `_orig' patch file read-only.
 (defun ediff-set-read-only-in-buf-A ()
   (ediff-with-current-buffer ediff-buffer-A
-    (toggle-read-only 1)))
+    (setq buffer-read-only t)))
 
 ;; Return a plausible default for ediff's first file:
 ;; In dired, return the file number FILENO (or 0) in the list
@@ -491,12 +491,12 @@ If this file is a backup, `ediff' it with its original."
              (setq buf-B-file-name (file-name-nondirectory buf-B-file-name)))
          (if (stringp buf-C-file-name)
              (setq buf-C-file-name (file-name-nondirectory buf-C-file-name)))
-         
+
          (setq file-A (ediff-make-temp-file buf-A buf-A-file-name)
                file-B (ediff-make-temp-file buf-B buf-B-file-name))
          (if buf-C-is-alive
              (setq file-C (ediff-make-temp-file buf-C buf-C-file-name)))
-         
+
          (ediff-setup (get-buffer buf-A) file-A
                       (get-buffer buf-B) file-B
                       (if buf-C-is-alive (get-buffer buf-C))
@@ -542,8 +542,8 @@ expression; only file names that match the regexp are considered."
         (default-regexp (eval ediff-default-filtering-regexp))
         f)
      (list (setq f (read-directory-name
-                   "Directory A to compare:" dir-A nil 'must-match))
-          (read-directory-name "Directory B to compare:"
+                   "Directory A to compare: " dir-A nil 'must-match))
+          (read-directory-name "Directory B to compare: "
                           (if ediff-use-last-dir
                               ediff-last-dir-B
                             (ediff-strip-last-dir f))
@@ -1072,7 +1072,7 @@ lines.  For small regions, use `ediff-regions-wordwise'."
          (ediff-with-current-buffer buffer-B
            (setq beg-B (move-marker (make-marker) beg-B)
                  end-B (move-marker (make-marker) end-B)))
-         
+
          ;; make file-A
          (if word-mode
              (ediff-wordify beg-A end-A buffer-A tmp-buffer)
@@ -1084,7 +1084,7 @@ lines.  For small regions, use `ediff-regions-wordwise'."
              (ediff-wordify beg-B end-B buffer-B tmp-buffer)
            (ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer))
          (setq file-B (ediff-make-temp-file tmp-buffer "regB"))
-         
+
          (setq overl-A (ediff-make-bullet-proof-overlay beg-A end-A buffer-A))
          (setq overl-B (ediff-make-bullet-proof-overlay beg-B end-B buffer-B))
          (ediff-setup buffer-A file-A
index a48f2afecd59646c6aa3cc667c1ab8b2c9aa6b3a..f6942bc538df2024dd574f8fea3ce2b3d2d9f862 100644 (file)
@@ -524,10 +524,10 @@ replaced by emerge-fast-keymap.")
 (emerge-defvar-local emerge-old-keymap nil
   "The original local keymap for the merge buffer.")
 (emerge-defvar-local emerge-auto-advance nil
-  "*If non-nil, emerge-select-A and emerge-select-B automatically advance to
+                    "If non-nil, emerge-select-A and emerge-select-B automatically advance to
 the next difference.")
 (emerge-defvar-local emerge-skip-prefers nil
-  "*If non-nil, differences for which there is a preference are automatically
+                    "If non-nil, differences for which there is a preference are automatically
 skipped.")
 (emerge-defvar-local emerge-quit-hook nil
   "Hooks to run in the merge buffer after the merge has been finished.
index 54d548c09dafcb59518276afc1b5852a7ec0d9f1..7ee000a8aea9a178a04eb05dc0417d5d79f063a9 100644 (file)
@@ -29,7 +29,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'add-log)                     ; for all the ChangeLog goodies
 (require 'pcvs-util)
 (require 'ring)
@@ -161,7 +160,7 @@ can be obtained from `log-edit-files'."
                        "21.1")
 
 (defvar log-edit-changelog-full-paragraphs cvs-changelog-full-paragraphs
-  "*If non-nil, include full ChangeLog paragraphs in the log.
+  "If non-nil, include full ChangeLog paragraphs in the log.
 This may be set in the ``local variables'' section of a ChangeLog, to
 indicate the policy for that ChangeLog.
 
@@ -191,11 +190,17 @@ when this variable is set to nil.")
 
 (defvar log-edit-parent-buffer nil)
 
+(defvar log-edit-vc-backend nil
+  "VC fileset corresponding to the current log.")
+
 ;;; Originally taken from VC-Log mode
 
 (defconst log-edit-maximum-comment-ring-size 32
   "Maximum number of saved comments in the comment ring.")
+(define-obsolete-variable-alias 'vc-comment-ring 'log-edit-comment-ring "22.1")
 (defvar log-edit-comment-ring (make-ring log-edit-maximum-comment-ring-size))
+(define-obsolete-variable-alias 'vc-comment-ring-index
+  'log-edit-comment-ring-index "22.1")
 (defvar log-edit-comment-ring-index nil)
 (defvar log-edit-last-comment-match "")
 
@@ -301,8 +306,6 @@ automatically."
        (insert "\n"))))
 
 ;; Compatibility with old names.
-(define-obsolete-variable-alias 'vc-comment-ring 'log-edit-comment-ring "22.1")
-(define-obsolete-variable-alias 'vc-comment-ring-index 'log-edit-comment-ring-index "22.1")
 (define-obsolete-function-alias 'vc-previous-comment 'log-edit-previous-comment "22.1")
 (define-obsolete-function-alias 'vc-next-comment 'log-edit-next-comment "22.1")
 (define-obsolete-function-alias 'vc-comment-search-reverse 'log-edit-comment-search-backward "22.1")
@@ -349,7 +352,7 @@ automatically."
 (defvar log-edit-font-lock-keywords
   ;; Copied/inspired by message-font-lock-keywords.
   `((log-edit-match-to-eoh
-     (,(concat "^\\(\\([a-z]+\\):\\)" log-edit-header-contents-regexp)
+     (,(concat "^\\(\\([[:alpha:]]+\\):\\)" log-edit-header-contents-regexp)
       (progn (goto-char (match-beginning 0)) (match-end 0)) nil
       (1 (if (assoc (match-string 2) log-edit-headers-alist)
              'log-edit-header
@@ -360,26 +363,72 @@ automatically."
              'log-edit-header)
          nil lax)))))
 
+(defvar log-edit-font-lock-gnu-style nil
+  "If non-nil, highlight common failures to follow the GNU coding standards.")
+(put 'log-edit-font-lock-gnu-style 'safe-local-variable 'booleanp)
+
+(defconst log-edit-font-lock-gnu-keywords
+    ;; Use
+    ;;   * foo.el (bla, bli)
+    ;;   (blo, blu): Toto.
+    ;; Rather than
+    ;;   * foo.el (bla, bli,
+    ;;   blo, blu): Toto.
+  '(("^[ \t]*\\(?:\\* .*\\)?\\(([^\n)]*,\\s-*\\)$"
+     (1 '(face font-lock-warning-face
+          help-echo "Continue function lists with \")\\n(\".") t))
+    ;; Don't leave a lone word on a single line.
+    ;;("^\\s-*\\(\\S-*[^\n:)]\\)\\s-*$" (1 font-lock-warning-face t))
+    ;; Don't cut a sentence right after the first word (better to move
+    ;; the sentence on the next line, then).
+    ;;("[.:]\\s-+\\(\\sw+\\)\\s-*$" (1 font-lock-warning-face t))
+    ;; Change Log entries should use present tense.
+    ("):[ \t\n]*[[:alpha:]]+\\(ed\\)\\>"
+     (1 '(face font-lock-warning-face help-echo "Use present tense.") t))
+    ;; Change log entries start with a capital letter.
+    ("): [a-z]" (0 '(face font-lock-warning-face help-echo "Capitalize.") t))
+    ("[^[:upper:]]\\(\\. [[:upper:]]\\)"
+     (1 '(face font-lock-warning-face
+          help-echo "Use two spaces to end a sentence") t))
+    ("^("
+     (0 (let ((beg (max (point-min) (- (match-beginning 0) 2))))
+          (put-text-property beg (match-end 0) 'font-lock-multiline t)
+          (if (eq (char-syntax (char-after beg)) ?w)
+              '(face font-lock-warning-face
+                help-echo "Punctuate previous line.")))
+        t))
+    ))
+
+(defun log-edit-font-lock-keywords ()
+  (if log-edit-font-lock-gnu-style
+      (append log-edit-font-lock-keywords
+              log-edit-font-lock-gnu-keywords)
+    log-edit-font-lock-keywords))
+
 ;;;###autoload
 (defun log-edit (callback &optional setup params buffer mode &rest _ignore)
   "Setup a buffer to enter a log message.
-\\<log-edit-mode-map>The buffer will be put in mode MODE or `log-edit-mode'
-if MODE is nil.
-If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run.
-Mark and point will be set around the entire contents of the buffer so
-that it is easy to kill the contents of the buffer with \\[kill-region].
-Once you're done editing the message, pressing \\[log-edit-done] will call
-`log-edit-done' which will end up calling CALLBACK to do the actual commit.
-
-PARAMS if non-nil is an alist.  Possible keys and associated values:
+The buffer is put in mode MODE or `log-edit-mode' if MODE is nil.
+\\<log-edit-mode-map>
+If SETUP is non-nil, erase the buffer and run `log-edit-hook'.
+Set mark and point around the entire contents of the buffer, so
+that it is easy to kill the contents of the buffer with
+\\[kill-region].  Once the user is done editing the message,
+invoking the command \\[log-edit-done] (`log-edit-done') will
+call CALLBACK to do the actual commit.
+
+PARAMS if non-nil is an alist of variables and buffer-local
+values to give them in the Log Edit buffer.  Possible keys and
+associated values:
  `log-edit-listfun' -- function taking no arguments that returns the list of
  files that are concerned by the current operation (using relative names);
  `log-edit-diff-function' -- function taking no arguments that
  displays a diff of the files concerned by the current operation.
+ `vc-log-fileset' -- the VC fileset to be committed (if any).
 
-If BUFFER is non-nil `log-edit' will jump to that buffer, use it to edit the
-log message and go back to the current buffer when done.  Otherwise, it
-uses the current buffer."
+If BUFFER is non-nil `log-edit' will jump to that buffer, use it
+to edit the log message and go back to the current buffer when
+done.  Otherwise, it uses the current buffer."
   (let ((parent (current-buffer)))
     (if buffer (pop-to-buffer buffer))
     (when (and log-edit-setup-invert (not (eq setup 'force)))
@@ -416,7 +465,7 @@ commands (under C-x v for VC, for example).
 
 \\{log-edit-mode-map}"
   (set (make-local-variable 'font-lock-defaults)
-       '(log-edit-font-lock-keywords t t))
+       '(log-edit-font-lock-keywords t))
   (make-local-variable 'log-edit-comment-ring-index)
   (hack-dir-local-variables-non-file-buffer))
 
index d345a20a0f532047a450dd461766a3089dafc80b..6514fbd22d767700e4bde575cb5325a1339509cb 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'pcvs-util)
 (autoload 'vc-find-revision "vc")
 (autoload 'vc-diff-internal "vc")
@@ -246,10 +245,10 @@ The match group number 1 should match the revision number itself.")
   '(log-view-font-lock-keywords t nil nil nil))
 
 (defvar log-view-vc-fileset nil
-  "Set this to the fileset corresponding to the current log.")
+  "The VC fileset corresponding to the current log.")
 
 (defvar log-view-vc-backend nil
-  "Set this to the VC backend that created the current log.")
+  "The VC backend that created the current log.")
 
 ;;;;
 ;;;; Actual code
index 80a01f58531bd63e23b1221ba72ea3e81b11a33b..0f71b7b82e725fa296a2d5fdda90bd949ebce148 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
 (require 'pcvs-util)
 
 ;;;; -------------------------------------------------------
 ;;;;       START OF THINGS TO CHECK WHEN INSTALLING
 
 (defvar cvs-program "cvs"
-  "*Name or full path of the cvs executable.")
+  "Name or full path of the cvs executable.")
 
 (defvar cvs-version
   ;; With the divergence of the CVSNT codebase and version numbers, this is
                                nil t)
        (cons (string-to-number (match-string 1))
              (string-to-number (match-string 2))))))
-  "*Version of `cvs' installed on your system.
+  "Version of `cvs' installed on your system.
 It must be in the (MAJOR . MINOR) format.")
 
 ;; FIXME: this is only used by cvs-mode-diff-backup
 (defvar cvs-diff-program (or (and (boundp 'diff-command) diff-command) "diff")
-  "*Name or full path of the best diff program you've got.
+  "Name or full path of the best diff program you've got.
 NOTE:  there are some nasty bugs in the context diff variants of some vendor
 versions, such as the one in SunOS-4.")
 
@@ -89,7 +88,7 @@ will select a shared-flag.")
   "List of flags whose settings is shared among several commands.")
 
 (defvar cvs-cvsroot nil
-  "*Specifies where the (current) cvs master repository is.
+  "Specifies where the (current) cvs master repository is.
 Overrides the environment variable $CVSROOT by sending \" -d dir\" to
 all CVS commands. This switch is useful if you have multiple CVS
 repositories. It can be set interactively with \\[cvs-change-cvsroot.]
@@ -243,7 +242,7 @@ the directory name of the cvs buffer.")
   ;; Was '(expand-file-name " *cvs-tmp*" dir), but that causes them to
   ;; become non-hidden if uniquification is done `forward'.
   " *cvs-tmp*"
-  "*Name of the cvs temporary buffer.
+  "Name of the cvs temporary buffer.
 Output from cvs is placed here for asynchronous commands.")
 
 (defcustom cvs-idiff-imerge-handlers
index 4f8c114d72128464167c697714a4671e62fbecb5..36572640cfcac55b2645aec1a52301f4a0c84622 100644 (file)
@@ -31,7 +31,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'pcvs-util)
 ;;(require 'pcvs-defs)
 
@@ -146,7 +146,7 @@ to confuse some users sometimes."
 
 ;; Constructor:
 
-(defstruct (cvs-fileinfo
+(cl-defstruct (cvs-fileinfo
            (:constructor nil)
            (:copier nil)
            (:constructor -cvs-create-fileinfo (type dir file full-log
@@ -274,10 +274,10 @@ to confuse some users sometimes."
                  (string= file (file-name-nondirectory file)))
             (setq check 'type)         (symbolp type)
             (setq check 'consistency)
-            (case type
-              (DIRCHANGE (and (null subtype) (string= "." file)))
-              ((NEED-UPDATE ADDED MISSING DEAD MODIFIED MESSAGE UP-TO-DATE
-                            REMOVED NEED-MERGE CONFLICT UNKNOWN MESSAGE)
+            (pcase type
+              (`DIRCHANGE (and (null subtype) (string= "." file)))
+              ((or `NEED-UPDATE `ADDED `MISSING `DEAD `MODIFIED `MESSAGE
+                    `UP-TO-DATE `REMOVED `NEED-MERGE `CONFLICT `UNKNOWN)
                t)))
        fi
       (error "Invalid :%s in cvs-fileinfo %s" check fi))))
@@ -325,9 +325,9 @@ FI-OR-TYPE can either be a symbol (a fileinfo-type) or a fileinfo."
 (defun cvs-add-face (str face &optional keymap &rest props)
   (when keymap
     (when (keymapp keymap)
-      (setq props (list* 'keymap keymap props)))
-    (setq props (list* 'mouse-face 'highlight props)))
-  (add-text-properties 0 (length str) (list* 'font-lock-face face props) str)
+      (setq props `(keymap ,keymap ,@props)))
+    (setq props `(mouse-face highlight ,@props)))
+  (add-text-properties 0 (length str) `(font-lock-face ,face ,@props) str)
   str)
 
 (defun cvs-fileinfo-pp (fileinfo)
@@ -337,15 +337,15 @@ For use by the cookie package."
   (let ((type (cvs-fileinfo->type fileinfo))
        (subtype (cvs-fileinfo->subtype fileinfo)))
     (insert
-     (case type
-       (DIRCHANGE (concat "In directory "
-                         (cvs-add-face (cvs-fileinfo->full-name fileinfo)
-                                       'cvs-header t 'cvs-goal-column t)
-                         ":"))
-       (MESSAGE
+     (pcase type
+       (`DIRCHANGE (concat "In directory "
+                           (cvs-add-face (cvs-fileinfo->full-name fileinfo)
+                                         'cvs-header t 'cvs-goal-column t)
+                           ":"))
+       (`MESSAGE
        (cvs-add-face (format "Message: %s" (cvs-fileinfo->full-log fileinfo))
                      'cvs-msg))
-       (t
+       (_
        (let* ((status (if (cvs-fileinfo->marked fileinfo)
                           (cvs-add-face "*" 'cvs-marked)
                         " "))
@@ -354,10 +354,10 @@ For use by the cookie package."
               (base (or (cvs-fileinfo->base-rev fileinfo) ""))
               (head (cvs-fileinfo->head-rev fileinfo))
               (type
-               (let ((str (case type
+               (let ((str (pcase type
                             ;;(MOD-CONFLICT "Not Removed")
-                            (DEAD        "")
-                            (t (capitalize (symbol-name type)))))
+                            (`DEAD       "")
+                            (_ (capitalize (symbol-name type)))))
                      (face (let ((sym (intern
                                        (concat "cvs-fi-"
                                                (downcase (symbol-name type))
index a588c735ce7a60957b95c7dac5b07d6a488543de..dd448b9d480c13bfbd374ae6f6d938e789010e9f 100644 (file)
@@ -32,8 +32,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (require 'pcvs-util)
 (require 'pcvs-info)
 
@@ -117,7 +115,7 @@ If RE matches, advance the point until the line after the match and
 then assign the variables as specified in MATCHES (via `setq')."
   (cons 'cvs-do-match
        (cons re (mapcar (lambda (match)
-                          `(cons ',(first match) ,(second match)))
+                          `(cons ',(car match) ,(cadr match)))
                         matches))))
 
 (defun cvs-do-match (re &rest matches)
@@ -150,8 +148,8 @@ Match RE and if successful, execute MATCHES."
     (cvs-or
      (funcall parse-spec)
 
-     (dolist (re cvs-parse-ignored-messages)
-       (when (cvs-match re) (return t)))
+     (cl-dolist (re cvs-parse-ignored-messages)
+       (when (cvs-match re) (cl-return t)))
 
      ;; This is a parse error.  Create a message-type fileinfo.
      (and
@@ -221,7 +219,7 @@ The remaining KEYS are passed directly to `cvs-create-fileinfo'."
       ;; ?: Unknown file.
       (let ((code (aref c 0)))
        (cvs-parsed-fileinfo
-        (case code
+        (pcase code
           (?M 'MODIFIED)
           (?A 'ADDED)
           (?R 'REMOVED)
@@ -238,7 +236,7 @@ The remaining KEYS are passed directly to `cvs-create-fileinfo'."
                (if (re-search-forward "^<<<<<<< " nil t)
                    'CONFLICT 'NEED-MERGE))))
           (?J 'NEED-MERGE)             ;not supported by standard CVS
-          ((?U ?P)
+          ((or ?U ?P)
            (if dont-change-disc 'NEED-UPDATE
              (cons 'UP-TO-DATE (if (eq code ?U) 'UPDATED 'PATCHED)))))
         path 'trust)))
index b300247e552bf38622137438b2b550f1802c2383..3d54bbd12a33f33b025847c343319011aff09b7c 100644 (file)
@@ -26,7 +26,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;;;;
 ;;;; list processing
@@ -63,7 +63,7 @@
        (while (and l (> n 1))
          (setcdr nl (list (pop l)))
          (setq nl (cdr nl))
-         (decf n))
+         (cl-decf n))
        ret))))
 
 (defun cvs-partition (p l)
@@ -130,10 +130,10 @@ If NOREUSE is non-nil, always return a new buffer."
            (if noreuse (generate-new-buffer name)
              (get-buffer-create name)))
       (unless noreuse
-       (dolist (buf (buffer-list))
+       (cl-dolist (buf (buffer-list))
          (with-current-buffer buf
            (when (equal name list-buffers-directory)
-             (return buf)))))
+             (cl-return buf)))))
       (with-current-buffer (create-file-buffer name)
        (setq list-buffers-directory name)
        (current-buffer))))
@@ -182,9 +182,7 @@ arguments.  If ARGS is not a list, no argument will be passed."
                          (if oneline (line-end-position) (point-max))))
     (file-error nil)))
 
-(defun cvs-string-prefix-p (str1 str2)
-  "Tell whether STR1 is a prefix of STR2."
-  (eq t (compare-strings str2 nil (length str1) str1 nil nil)))
+(define-obsolete-function-alias 'cvs-string-prefix-p 'string-prefix-p "24.2")
 
 ;;;;
 ;;;; file names
@@ -197,10 +195,10 @@ arguments.  If ARGS is not a list, no argument will be passed."
 ;;;; (interactive <foo>) support function
 ;;;;
 
-(defstruct (cvs-qtypedesc
-           (:constructor nil) (:copier nil)
-           (:constructor cvs-qtypedesc-create
-                         (str2obj obj2str &optional complete hist-sym require)))
+(cl-defstruct (cvs-qtypedesc
+               (:constructor nil) (:copier nil)
+               (:constructor cvs-qtypedesc-create
+                (str2obj obj2str &optional complete hist-sym require)))
   str2obj
   obj2str
   hist-sym
@@ -233,10 +231,10 @@ arguments.  If ARGS is not a list, no argument will be passed."
 ;;;; Flags handling
 ;;;;
 
-(defstruct (cvs-flags
-           (:constructor nil)
-           (:constructor -cvs-flags-make
-                         (desc defaults &optional qtypedesc hist-sym)))
+(cl-defstruct (cvs-flags
+               (:constructor nil)
+               (:constructor -cvs-flags-make
+                (desc defaults &optional qtypedesc hist-sym)))
   defaults persist desc qtypedesc hist-sym)
 
 (defmacro cvs-flags-define (sym defaults
index 9ba65cda14394421a097308aaa9b24437ae6064c..659151a31e990a563a7a0a6791b291630674c126 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'ewoc)                                ;Ewoc was once cookie
 (require 'pcvs-defs)
 (require 'pcvs-util)
 (autoload 'cvs-status-get-tags "cvs-status")
 (defun cvs-tags-list ()
   "Return a list of acceptable tags, ready for completions."
-  (assert (cvs-buffer-p))
+  (cl-assert (cvs-buffer-p))
   (let ((marked (cvs-get-marked)))
-    (list* '("BASE") '("HEAD")
-          (when marked
-            (with-temp-buffer
-              (process-file cvs-program
-                            nil        ;no input
-                            t          ;output to current-buffer
-                            nil        ;don't update display while running
-                            "status"
-                            "-v"
-                            (cvs-fileinfo->full-name (car marked)))
-              (goto-char (point-min))
-              (let ((tags (cvs-status-get-tags)))
-                (when (listp tags) tags)))))))
+    `(("BASE") ("HEAD")
+      ,@(when marked
+          (with-temp-buffer
+            (process-file cvs-program
+                          nil           ;no input
+                          t            ;output to current-buffer
+                          nil           ;don't update display while running
+                          "status"
+                          "-v"
+                          (cvs-fileinfo->full-name (car marked)))
+            (goto-char (point-min))
+            (let ((tags (cvs-status-get-tags)))
+              (when (listp tags) tags)))))))
 
 (defvar cvs-tag-history nil)
 (defconst cvs-qtypedesc-tag
@@ -426,16 +426,16 @@ If non-nil, NEW means to create a new buffer no matter what."
              ;; look for another cvs buffer visiting the same directory
              (save-excursion
                (unless new
-                 (dolist (buffer (cons (current-buffer) (buffer-list)))
+                 (cl-dolist (buffer (cons (current-buffer) (buffer-list)))
                    (set-buffer buffer)
                    (and (cvs-buffer-p)
-                        (case cvs-reuse-cvs-buffer
-                          (always t)
-                          (subdir
-                           (or (cvs-string-prefix-p default-directory dir)
-                               (cvs-string-prefix-p dir default-directory)))
-                          (samedir (string= default-directory dir)))
-                        (return buffer)))))
+                        (pcase cvs-reuse-cvs-buffer
+                          (`always t)
+                          (`subdir
+                           (or (string-prefix-p default-directory dir)
+                               (string-prefix-p dir default-directory)))
+                          (`samedir (string= default-directory dir)))
+                        (cl-return buffer)))))
              ;; we really have to create a new buffer:
              ;; we temporarily bind cwd to "" to prevent
              ;; create-file-buffer from using directory info
@@ -478,7 +478,7 @@ If non-nil, NEW means to create a new buffer no matter what."
           ;;(set-buffer buf)
           buffer))))))
 
-(defun* cvs-cmd-do (cmd dir flags fis new
+(cl-defun cvs-cmd-do (cmd dir flags fis new
                        &key cvsargs noexist dont-change-disc noshow)
   (let* ((dir (file-name-as-directory
               (abbreviate-file-name (expand-file-name dir))))
@@ -501,7 +501,7 @@ If non-nil, NEW means to create a new buffer no matter what."
 ;;            cvsbuf))))
 
 (defun cvs-run-process (args fis postprocess &optional single-dir)
-  (assert (cvs-buffer-p cvs-buffer))
+  (cl-assert (cvs-buffer-p cvs-buffer))
   (save-current-buffer
     (let ((procbuf (current-buffer))
          (cvsbuf cvs-buffer)
@@ -521,9 +521,9 @@ If non-nil, NEW means to create a new buffer no matter what."
                  (let ((inhibit-read-only t))
                    (insert "pcl-cvs: descending directory " dir "\n"))
                  ;; loop to find the same-dir-elems
-                 (do* ((files () (cons (cvs-fileinfo->file fi) files))
-                       (fis fis (cdr fis))
-                       (fi (car fis) (car fis)))
+                 (cl-do* ((files () (cons (cvs-fileinfo->file fi) files))
+                           (fis fis (cdr fis))
+                           (fi (car fis) (car fis)))
                      ((not (and fis (string= dir (cvs-fileinfo->dir fi))))
                       (list dir files fis))))))
             (dir (nth 0 dir+files+rest))
@@ -813,7 +813,7 @@ TIN specifies an optional starting point."
   (while (and tin (cvs-fileinfo< fi (ewoc-data tin)))
     (setq tin (ewoc-prev c tin)))
   (if (null tin) (ewoc-enter-first c fi) ;empty collection
-    (assert (not (cvs-fileinfo< fi (ewoc-data tin))))
+    (cl-assert (not (cvs-fileinfo< fi (ewoc-data tin))))
     (let ((next-tin (ewoc-next c tin)))
       (while (not (or (null next-tin)
                      (cvs-fileinfo< fi (ewoc-data next-tin))))
@@ -871,15 +871,15 @@ RM-MSGS if non-nil means remove messages."
           (let* ((type (cvs-fileinfo->type fi))
                  (subtype (cvs-fileinfo->subtype fi))
                  (keep
-                  (case type
+                  (pcase type
                     ;; remove temp messages and keep the others
-                    (MESSAGE (not (or rm-msgs (eq subtype 'TEMP))))
+                    (`MESSAGE (not (or rm-msgs (eq subtype 'TEMP))))
                     ;; remove entries
-                    (DEAD nil)
+                    (`DEAD nil)
                     ;; handled also?
-                    (UP-TO-DATE (not rm-handled))
+                    (`UP-TO-DATE (not rm-handled))
                     ;; keep the rest
-                    (t (not (run-hook-with-args-until-success
+                    (_ (not (run-hook-with-args-until-success
                              'cvs-cleanup-functions fi))))))
 
             ;; mark dirs for removal
@@ -887,7 +887,7 @@ RM-MSGS if non-nil means remove messages."
                        (eq (cvs-fileinfo->type last-fi) 'DIRCHANGE)
                        (not (when first-dir (setq first-dir nil) t))
                        (or (eq rm-dirs 'all)
-                           (not (cvs-string-prefix-p
+                           (not (string-prefix-p
                                  (cvs-fileinfo->dir last-fi)
                                  (cvs-fileinfo->dir fi)))
                            (and (eq type 'DIRCHANGE) (eq rm-dirs 'empty))
@@ -1389,7 +1389,7 @@ an empty list if it doesn't point to a file at all."
                      fis))))
     (nreverse fis)))
 
-(defun* cvs-mode-marked (filter &optional cmd
+(cl-defun cvs-mode-marked (filter &optional cmd
                                &key read-only one file noquery)
   "Get the list of marked FIS.
 CMD is used to determine whether to use the marks or not.
@@ -1474,7 +1474,7 @@ The POSTPROC specified there (typically `log-edit') is then called,
   (let ((msg (buffer-substring-no-properties (point-min) (point-max))))
     (cvs-mode!)
     ;;(pop-to-buffer cvs-buffer)
-    (cvs-mode-do "commit" (list* "-m" msg flags) 'commit)))
+    (cvs-mode-do "commit" `("-m" ,msg ,@flags) 'commit)))
 
 
 ;;;; Editing existing commit log messages.
@@ -1604,7 +1604,7 @@ With prefix argument, prompt for cvs flags."
                         (or current-prefix-arg (not cvs-add-default-message)))
                    (read-from-minibuffer "Enter description: ")
                  (or cvs-add-default-message "")))
-          (flags (list* "-m" msg flags))
+          (flags `("-m" ,msg ,@flags))
           (postproc
            ;; setup postprocessing for the directory entries
            (when dirs
@@ -1758,7 +1758,7 @@ Signal an error if there is no backup file."
            (set-buffer-modified-p nil)
            (let ((buffer-file-name (expand-file-name file)))
              (after-find-file))
-           (toggle-read-only 1)
+           (setq buffer-read-only t)
            (message "Retrieving revision %s... Done" rev)
            (current-buffer))))))
 
@@ -1839,13 +1839,13 @@ Signal an error if there is no backup file."
     (setq buffer-file-name (expand-file-name buffer-file-name))
     (let (ret)
       (dolist (fi (or fis (list (cvs-create-fileinfo 'DIRCHANGE "" "." ""))))
-       (when (cvs-string-prefix-p
+       (when (string-prefix-p
               (expand-file-name (cvs-fileinfo->full-name fi) dir)
               buffer-file-name)
          (setq ret t)))
       ret)))
 
-(defun* cvs-mode-run (cmd flags fis
+(cl-defun cvs-mode-run (cmd flags fis
                      &key (buf (cvs-temp-buffer))
                           dont-change-disc cvsargs postproc)
   "Generic cvs-mode-<foo> function.
@@ -1887,7 +1887,7 @@ POSTPROC is a list of expressions to be evaluated at the very end (after
       (cvs-run-process args fis postproc single-dir))))
 
 
-(defun* cvs-mode-do (cmd flags filter
+(cl-defun cvs-mode-do (cmd flags filter
                     &key show dont-change-disc cvsargs postproc)
   "Generic cvs-mode-<foo> function.
 Executes `cvs CVSARGS CMD FLAGS' on the selected files.
@@ -2261,7 +2261,7 @@ With prefix argument, prompt for cvs flags."
 (defun cvs-dir-member-p (fileinfo dir)
   "Return true if FILEINFO represents a file in directory DIR."
   (and (not (eq (cvs-fileinfo->type fileinfo) 'DIRCHANGE))
-       (cvs-string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
+       (string-prefix-p dir (cvs-fileinfo->dir fileinfo))))
 
 (defun cvs-execute-single-file (fi extractor program constant-args)
   "Internal function for `cvs-execute-single-file-list'."
@@ -2392,7 +2392,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
          (set-buffer cvs-buf)
          ;; look for a corresponding pcl-cvs buffer
          (when (and (eq major-mode 'cvs-mode)
-                    (cvs-string-prefix-p default-directory dir))
+                    (string-prefix-p default-directory dir))
            (let ((subdir (substring dir (length default-directory))))
              (set-buffer buffer)
              (set (make-local-variable 'cvs-buffer) cvs-buf)
@@ -2423,7 +2423,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
          (set-buffer cvs-buf)
          ;; look for a corresponding pcl-cvs buffer
          (when (and (eq major-mode 'cvs-mode)
-                    (cvs-string-prefix-p default-directory file))
+                    (string-prefix-p default-directory file))
            (let* ((file (substring file (length default-directory)))
                   (fi (cvs-create-fileinfo
                        (if (string= "0" version)
index d2881b40ad084e7374933459ed6585459fe0b669..e6b63030fef73efc8122043273b993a77a011524 100644 (file)
@@ -43,7 +43,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'diff-mode)                    ;For diff-auto-refine-mode.
 (require 'newcomment)
 
@@ -78,36 +78,36 @@ Used in `smerge-diff-base-mine' and related functions."
   :type 'boolean)
 
 (defface smerge-mine
-  '((((min-colors 88) (background light))
-     (:foreground "blue1"))
-    (((background light))
-     (:foreground "blue"))
-    (((min-colors 88) (background dark))
-     (:foreground "cyan1"))
-    (((background dark))
-     (:foreground "cyan")))
+  '((((class color) (min-colors 88) (background light))
+     :background "#ffdddd")
+    (((class color) (min-colors 88) (background dark))
+     :background "#553333")
+    (((class color))
+     :foreground "red"))
   "Face for your code."
   :group 'smerge)
 (define-obsolete-face-alias 'smerge-mine-face 'smerge-mine "22.1")
 (defvar smerge-mine-face 'smerge-mine)
 
 (defface smerge-other
-  '((((background light))
-     (:foreground "darkgreen"))
-    (((background dark))
-     (:foreground "lightgreen")))
+  '((((class color) (min-colors 88) (background light))
+     :background "#ddffdd")
+    (((class color) (min-colors 88) (background dark))
+     :background "#335533")
+    (((class color))
+     :foreground "green"))
   "Face for the other code."
   :group 'smerge)
 (define-obsolete-face-alias 'smerge-other-face 'smerge-other "22.1")
 (defvar smerge-other-face 'smerge-other)
 
 (defface smerge-base
-  '((((min-colors 88) (background light))
-     (:foreground "red1"))
-    (((background light))
-     (:foreground "red"))
-    (((background dark))
-     (:foreground "orange")))
+  '((((class color) (min-colors 88) (background light))
+     :background "#ffffaa")
+    (((class color) (min-colors 88) (background dark))
+     :background "#888833")
+    (((class color))
+     :foreground "yellow"))
   "Face for the base code."
   :group 'smerge)
 (define-obsolete-face-alias 'smerge-base-face 'smerge-base "22.1")
@@ -124,10 +124,34 @@ Used in `smerge-diff-base-mine' and related functions."
 (defvar smerge-markers-face 'smerge-markers)
 
 (defface smerge-refined-change
-  '((t :background "yellow"))
+  '((t nil))
   "Face used for char-based changes shown by `smerge-refine'."
   :group 'smerge)
 
+(defface smerge-refined-removed
+  '((default
+     :inherit smerge-refined-change)
+    (((class color) (min-colors 88) (background light))
+     :background "#ffaaaa")
+    (((class color) (min-colors 88) (background dark))
+     :background "#aa2222")
+    (t :inverse-video t))
+  "Face used for removed characters shown by `smerge-refine'."
+  :group 'smerge
+  :version "24.2")
+
+(defface smerge-refined-added
+  '((default
+     :inherit smerge-refined-change)
+    (((class color) (min-colors 88) (background light))
+     :background "#aaffaa")
+    (((class color) (min-colors 88) (background dark))
+     :background "#22aa22")
+    (t :inverse-video t))
+  "Face used for added characters shown by `smerge-refine'."
+  :group 'smerge
+  :version "24.2")
+
 (easy-mmode-defmap smerge-basic-map
   `(("n" . smerge-next)
     ("p" . smerge-prev)
@@ -342,12 +366,11 @@ Can be nil if the style is undecided, or else:
         ))))
 
 (defvar smerge-resolve-function
-  (lambda () (error "Don't know how to resolve"))
+  (lambda () (user-error "Don't know how to resolve"))
   "Mode-specific merge function.
 The function is called with zero or one argument (non-nil if the resolution
 function should only apply safe heuristics) and with the match data set
 according to `smerge-match-conflict'.")
-(add-to-list 'debug-ignored-errors "Don't know how to resolve")
 
 (defvar smerge-text-properties
   `(help-echo "merge conflict: mouse-3 shows a menu"
@@ -626,7 +649,7 @@ major modes.  Uses `smerge-resolve-function' to do the actual work."
             (set-match-data md)
            (smerge-keep-n choice))
            (t
-            (error "Don't know how to resolve"))))
+            (user-error "Don't know how to resolve"))))
       (if (buffer-name buf) (kill-buffer buf))
       (if m (delete-file m))
       (if b (delete-file b))
@@ -693,7 +716,7 @@ major modes.  Uses `smerge-resolve-function' to do the actual work."
     (while (or (not (match-end i))
               (< (point) (match-beginning i))
               (>= (point) (match-end i)))
-      (decf i))
+      (cl-decf i))
     i))
 
 (defun smerge-keep-current ()
@@ -756,7 +779,7 @@ An error is raised if not inside a conflict."
               (filename (or (match-string 1) ""))
 
               (_ (re-search-forward smerge-end-re))
-              (_ (assert (< orig-point (match-end 0))))
+              (_ (cl-assert (< orig-point (match-end 0))))
 
               (other-end (match-beginning 0))
               (end (match-end 0))
@@ -810,9 +833,7 @@ An error is raised if not inside a conflict."
                                  (when base-start (1- base-start)) base-start
                                  (1- other-start) other-start))
          t)
-      (search-failed (error "Point not in conflict region")))))
-
-(add-to-list 'debug-ignored-errors "Point not in conflict region")
+      (search-failed (user-error "Point not in conflict region")))))
 
 (defun smerge-conflict-overlay (pos)
   "Return the conflict overlay at POS if any."
@@ -983,9 +1004,17 @@ chars to try and eliminate some spurious differences."
           (dolist (x props) (overlay-put ol (car x) (cdr x)))
           ol)))))
 
-(defun smerge-refine-subst (beg1 end1 beg2 end2 props &optional preproc)
+(defun smerge-refine-subst (beg1 end1 beg2 end2 props-c &optional preproc props-r props-a)
   "Show fine differences in the two regions BEG1..END1 and BEG2..END2.
-PROPS is an alist of properties to put (via overlays) on the changes.
+PROPS-C is an alist of properties to put (via overlays) on the changes.
+PROPS-R is an alist of properties to put on removed characters.
+PROPS-A is an alist of properties to put on added characters.
+If PROPS-R and PROPS-A are nil, put PROPS-C on all changes.
+If PROPS-C is nil, but PROPS-R and PROPS-A are non-nil,
+put PROPS-A on added characters, PROPS-R on removed characters.
+If PROPS-C, PROPS-R and PROPS-A are non-nil, put PROPS-C on changed characters,
+PROPS-A on added characters, and PROPS-R on removed characters.
+
 If non-nil, PREPROC is called with no argument in a buffer that contains
 a copy of a region, just before preparing it to for `diff'.  It can be
 used to replace chars to try and eliminate some spurious differences."
@@ -1029,19 +1058,27 @@ used to replace chars to try and eliminate some spurious differences."
                     (m5 (match-string 5)))
                 (when (memq op '(?d ?c))
                   (setq last1
-                        (smerge-refine-highlight-change buf beg1 m1 m2 props)))
+                        (smerge-refine-highlight-change
+                        buf beg1 m1 m2
+                        ;; Try to use props-c only for changed chars,
+                        ;; fallback to props-r for changed/removed chars,
+                        ;; but if props-r is nil then fallback to props-c.
+                        (or (and (eq op '?c) props-c) props-r props-c))))
                 (when (memq op '(?a ?c))
                   (setq last2
-                        (smerge-refine-highlight-change buf beg2 m4 m5 props))))
+                        (smerge-refine-highlight-change
+                        buf beg2 m4 m5
+                        ;; Same logic as for removed chars above.
+                        (or (and (eq op '?c) props-c) props-a props-c)))))
               (forward-line 1)                            ;Skip hunk header.
               (and (re-search-forward "^[0-9]" nil 'move) ;Skip hunk body.
                    (goto-char (match-beginning 0))))
-            ;; (assert (or (null last1) (< (overlay-start last1) end1)))
-            ;; (assert (or (null last2) (< (overlay-start last2) end2)))
+            ;; (cl-assert (or (null last1) (< (overlay-start last1) end1)))
+            ;; (cl-assert (or (null last2) (< (overlay-start last2) end2)))
             (if smerge-refine-weight-hack
                 (progn
-                  ;; (assert (or (null last1) (<= (overlay-end last1) end1)))
-                  ;; (assert (or (null last2) (<= (overlay-end last2) end2)))
+                  ;; (cl-assert (or (null last1) (<= (overlay-end last1) end1)))
+                  ;; (cl-assert (or (null last2) (<= (overlay-end last2) end2)))
                   )
               ;; smerge-refine-forward-function when calling in chopup may
               ;; have stopped because it bumped into EOB whereas in
@@ -1084,7 +1121,11 @@ repeating the command will highlight other two parts."
                    ((eq (match-end 3) (match-beginning 3)) 3)
                    (t 2)))
   (let ((n1 (if (eq part 1) 2 1))
-        (n2 (if (eq part 3) 2 3)))
+        (n2 (if (eq part 3) 2 3))
+       (smerge-use-changed-face
+        (and (face-differs-from-default-p 'smerge-refined-change)
+             (not (face-equal 'smerge-refined-change 'smerge-refined-added))
+             (not (face-equal 'smerge-refined-change 'smerge-refined-removed)))))
     (smerge-ensure-match n1)
     (smerge-ensure-match n2)
     (with-silent-modifications
@@ -1093,8 +1134,13 @@ repeating the command will highlight other two parts."
                          (cons (buffer-chars-modified-tick) part)))
     (smerge-refine-subst (match-beginning n1) (match-end n1)
                          (match-beginning n2)  (match-end n2)
-                         '((smerge . refine)
-                           (face . smerge-refined-change)))))
+                         (if smerge-use-changed-face
+                            '((smerge . refine) (face . smerge-refined-change)))
+                        nil
+                        (unless smerge-use-changed-face
+                          '((smerge . refine) (face . smerge-refined-removed)))
+                        (unless smerge-use-changed-face
+                          '((smerge . refine) (face . smerge-refined-added))))))
 
 (defun smerge-diff (n1 n2)
   (smerge-match-conflict)
@@ -1244,8 +1290,8 @@ with a \\[universal-argument] prefix, makes up a 3-way conflict."
          (progn (pop-mark) (mark))
          (when current-prefix-arg (pop-mark) (mark))))
   ;; Start from the end so as to avoid problems with pos-changes.
-  (destructuring-bind (pt1 pt2 pt3 &optional pt4)
-      (sort (list* pt1 pt2 pt3 (if pt4 (list pt4))) '>=)
+  (pcase-let ((`(,pt1 ,pt2 ,pt3 ,pt4)
+               (sort `(,pt1 ,pt2 ,pt3 ,@(if pt4 (list pt4))) '>=)))
     (goto-char pt1) (beginning-of-line)
     (insert ">>>>>>> OTHER\n")
     (goto-char pt2) (beginning-of-line)
index a1dd807d828ed4f89f302738b517ab71413d67e2..1b98194e74ae1c33a7ff4cad3b7cd325d73b6c1e 100644 (file)
@@ -29,8 +29,7 @@
 (require 'vc)
 
 ;;; Code:
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defcustom vc-annotate-display-mode 'fullscale
   "Which mode to color the output of \\[vc-annotate] with by default."
@@ -195,7 +194,7 @@ The current time is used as the offset."
   (let ((bol (point))
         (date (vc-call-backend vc-annotate-backend 'annotate-time))
         (inhibit-read-only t))
-    (assert (>= (point) bol))
+    (cl-assert (>= (point) bol))
     (put-text-property bol (point) 'invisible 'vc-annotate-annotation)
     date))
 
@@ -522,12 +521,12 @@ the file in question, search for the log entry required and move point."
             (car rev-at-line) t 1)))))))
 
 (defun vc-annotate-show-diff-revision-at-line-internal (filediff)
-  (if (not (equal major-mode 'vc-annotate-mode))
+  (if (not (derived-mode-p 'vc-annotate-mode))
       (message "Cannot be invoked outside of a vc annotate buffer")
     (let* ((rev-at-line (vc-annotate-extract-revision-at-line))
-         (prev-rev nil)
-         (rev (car rev-at-line))
-         (fname (cdr rev-at-line)))
+           (prev-rev nil)
+           (rev (car rev-at-line))
+           (fname (cdr rev-at-line)))
       (if (not rev-at-line)
          (message "Cannot extract revision number from the current line")
        (setq prev-rev
@@ -535,17 +534,15 @@ the file in question, search for the log entry required and move point."
                                (if filediff fname nil) rev))
        (if (not prev-rev)
            (message "Cannot diff from any revision prior to %s" rev)
-         (save-window-excursion
-           (vc-diff-internal
-            nil
-            ;; The value passed here should follow what
-            ;; `vc-deduce-fileset' returns.
-            (list vc-annotate-backend
-                  (if filediff
-                      (list fname)
-                    nil))
-            prev-rev rev))
-         (switch-to-buffer "*vc-diff*"))))))
+          (vc-diff-internal
+           t
+           ;; The value passed here should follow what
+           ;; `vc-deduce-fileset' returns.
+           (list vc-annotate-backend
+                 (if filediff
+                     (list fname)
+                   nil))
+           prev-rev rev))))))
 
 (defun vc-annotate-show-diff-revision-at-line ()
   "Visit the diff of the revision at line from its previous revision."
index 052e6784b0831f5ccf5f4835439256f1363ef558..2e20d97e21dbb72d9da39be01b6483547a4ed70c 100644 (file)
@@ -1,4 +1,4 @@
-;;; vc-arch.el --- VC backend for the Arch version-control system
+;;; vc-arch.el --- VC backend for the Arch version-control system  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2004-2012  Free Software Foundation, Inc.
 
 
 ;;; Code:
 
-(eval-when-compile (require 'vc) (require 'cl))
+(eval-when-compile (require 'vc))
 
 ;;; Properties of the backend
 
 (defun vc-arch-revision-granularity () 'repository)
-(defun vc-arch-checkout-model (files) 'implicit)
+(defun vc-arch-checkout-model (_files) 'implicit)
 
 ;;;
 ;;; Customization options
@@ -227,7 +227,7 @@ Only the value `maybe' can be trusted :-(."
          (vc-file-setprop
           file 'arch-root root)))))
 
-(defun vc-arch-register (files &optional rev comment)
+(defun vc-arch-register (files &optional rev _comment)
   (if rev (error "Explicit initial revision not supported for Arch"))
   (dolist (file files)
     (let ((tagmet (vc-arch-tagging-method file)))
@@ -258,7 +258,7 @@ Only the value `maybe' can be trusted :-(."
               ;; Strip the terminating newline.
               (buffer-substring (point-min) (1- (point-max)))))))))
 
-(defun vc-arch-workfile-unchanged-p (file)
+(defun vc-arch-workfile-unchanged-p (_file)
   "Stub: arch workfiles are always considered to be in a changed state,"
   nil)
 
@@ -385,15 +385,15 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
   :group 'vc-arch)
 
 (defun vc-arch-mode-line-string (file)
-  "Return string for placement in modeline by `vc-mode-line' for FILE."
+  "Return a string for `vc-mode-line' to put in the mode line for FILE."
   (let ((rev (vc-working-revision file)))
     (dolist (rule vc-arch-mode-line-rewrite)
       (if (string-match (car rule) rev)
          (setq rev (replace-match (cdr rule) t nil rev))))
     (format "Arch%c%s"
-           (case (vc-state file)
-             ((up-to-date needs-update) ?-)
-             (added ?@)
+           (pcase (vc-state file)
+             ((or `up-to-date `needs-update) ?-)
+             (`added ?@)
              (t ?:))
            rev)))
 
@@ -508,12 +508,11 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
                    "*"))))))
 
 (defun vc-arch-revision-completion-table (files)
-  (lexical-let ((files files))
-    (lambda (string pred action)
-      ;; FIXME: complete revision patches as well.
-      (let* ((root (expand-file-name "{arch}" (vc-arch-root (car files))))
-             (table (vc-arch--version-completion-table root string)))
-       (complete-with-action action table string pred)))))
+  (lambda (string pred action)
+    ;; FIXME: complete revision patches as well.
+    (let* ((root (expand-file-name "{arch}" (vc-arch-root (car files))))
+           (table (vc-arch--version-completion-table root string)))
+      (complete-with-action action table string pred))))
 
 ;;; Trimming revision libraries.
 
@@ -547,13 +546,12 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
     minrev))
 
 (defun vc-arch-trim-make-sentinel (revs)
-  (if (null revs) (lambda (proc msg) (message "VC-Arch trimming ... done"))
-    (lexical-let ((revs revs))
-      (lambda (proc msg)
-        (message "VC-Arch trimming %s..." (file-name-nondirectory (car revs)))
-        (rename-file (car revs) (concat (car revs) "*rm*"))
-       (setq proc (start-process "vc-arch-trim" nil
-                                  "rm" "-rf" (concat (car revs) "*rm*")))
+  (if (null revs) (lambda (_proc _msg) (message "VC-Arch trimming ... done"))
+    (lambda (_proc _msg)
+      (message "VC-Arch trimming %s..." (file-name-nondirectory (car revs)))
+      (rename-file (car revs) (concat (car revs) "*rm*"))
+      (let ((proc (start-process "vc-arch-trim" nil
+                                 "rm" "-rf" (concat (car revs) "*rm*"))))
         (set-process-sentinel proc (vc-arch-trim-make-sentinel (cdr revs)))))))
 
 (defun vc-arch-trim-one-revlib (dir)
@@ -572,7 +570,7 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
                'car-less-than-car))
         (subdirs nil))
     (when (cddr revs)
-      (dotimes (i (/ (length revs) 2))
+      (dotimes (_i (/ (length revs) 2))
         (let ((minrev (vc-arch-trim-find-least-useful-rev revs)))
           (setq revs (delq minrev revs))
           (push minrev subdirs)))
index 798131236d566e42cf1cf88b2b395ef2603bd90e..ce4d76dc5f2da599161bcffef1f44429efca0694 100644 (file)
@@ -1,4 +1,4 @@
-;;; vc-bzr.el --- VC backend for the bzr revision control system
+;;; vc-bzr.el --- VC backend for the bzr revision control system  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
 ;; are bzr-versioned, `vc-bzr` presently runs `bzr status` on the
 ;; symlink, thereby not detecting whether the actual contents
 ;; (that is, the target contents) are changed.
-;; See https://bugs.launchpad.net/vc-bzr/+bug/116607
 
 ;;; Properties of the backend
 
 (defun vc-bzr-revision-granularity () 'repository)
-(defun vc-bzr-checkout-model (files) 'implicit)
+(defun vc-bzr-checkout-model (_files) 'implicit)
 
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'vc)  ;; for vc-exec-after
   (require 'vc-dir))
 
   :group 'vc-bzr
   :type 'string)
 
-(defcustom vc-bzr-sha1-program '("sha1sum")
-  "Name of program to compute SHA1.
-It must be a string \(program name\) or list of strings \(name and its args\)."
-  :type '(repeat string)
-  :group 'vc-bzr)
-
-(define-obsolete-variable-alias 'sha1-program 'vc-bzr-sha1-program "24.1")
-
 (defcustom vc-bzr-diff-switches nil
   "String or list of strings specifying switches for bzr diff under VC.
 If nil, use the value of `vc-diff-switches'.  If t, use no switches."
@@ -111,9 +102,9 @@ Invoke the bzr command adding `BZR_PROGRESS_BAR=none' and
 `LC_MESSAGES=C' to the environment.  If BZR-COMMAND is \"status\",
 prepends `vc-bzr-status-switches' to ARGS."
   (let ((process-environment
-         (list* "BZR_PROGRESS_BAR=none" ; Suppress progress output (bzr >=0.9)
-                "LC_MESSAGES=C"         ; Force English output
-                process-environment)))
+         `("BZR_PROGRESS_BAR=none" ; Suppress progress output (bzr >=0.9)
+           "LC_MESSAGES=C"         ; Force English output
+           ,@process-environment)))
     (apply 'vc-do-command (or buffer "*vc*") okstatus vc-bzr-program
            file-or-list bzr-command
            (if (and (string-equal "status" bzr-command)
@@ -132,8 +123,8 @@ Use the current Bzr root directory as the ROOT argument to
 `vc-do-async-command', and specify an output buffer named
 \"*vc-bzr : ROOT*\".  Return this buffer."
   (let* ((process-environment
-         (list* "BZR_PROGRESS_BAR=none" "LC_MESSAGES=C"
-                process-environment))
+         `("BZR_PROGRESS_BAR=none" "LC_MESSAGES=C"
+            ,@process-environment))
         (root (vc-bzr-root default-directory))
         (buffer (format "*vc-bzr : %s*" (expand-file-name root))))
     (apply 'vc-do-async-command buffer root
@@ -190,20 +181,15 @@ in the repository root directory of FILE."
 (defun vc-bzr-sha1 (file)
   (with-temp-buffer
     (set-buffer-multibyte nil)
-    (let ((prog vc-bzr-sha1-program)
-          (args nil)
-         process-file-side-effects)
-      (when (consp prog)
-       (setq args (cdr prog))
-        (setq prog (car prog)))
-      (apply 'process-file prog (file-relative-name file) t nil args)
-      (buffer-substring (point-min) (+ (point-min) 40)))))
+    (insert-file-contents-literally file)
+    (sha1 (current-buffer))))
 
 (defun vc-bzr-state-heuristic (file)
   "Like `vc-bzr-state' but hopefully without running Bzr."
-  ;; `bzr status' was excruciatingly slow with large histories and
-  ;; pending merges, so try to avoid using it until they fix their
-  ;; performance problems.
+  ;; `bzr status' could be slow with large histories and pending merges,
+  ;; so this tries to avoid calling it if possible.  bzr status is
+  ;; faster now, so this is not as important as it was.
+  ;;
   ;; This function tries first to parse Bzr internal file
   ;; `checkout/dirstate', but it may fail if Bzr internal file format
   ;; has changed.  As a safeguard, the `checkout/dirstate' file is
@@ -222,88 +208,88 @@ in the repository root directory of FILE."
   ;;           + working ( = packed_stat )
   ;; parent = common ( as above ) + history ( = rev_id )
   ;; kinds = (r)elocated, (a)bsent, (d)irectory, (f)ile, (l)ink
-  (lexical-let ((root (vc-bzr-root file)))
-    (when root    ; Short cut.
-      (lexical-let ((dirstate (expand-file-name vc-bzr-admin-dirstate root)))
-        (condition-case nil
-            (with-temp-buffer
-              (insert-file-contents dirstate)
-              (goto-char (point-min))
-              (if (not (looking-at "#bazaar dirstate flat format 3"))
-                  (vc-bzr-state file)   ; Some other unknown format?
-                (let* ((relfile (file-relative-name file root))
-                       (reldir (file-name-directory relfile)))
-                  (if (re-search-forward
-                       (concat "^\0"
-                               (if reldir (regexp-quote
-                                           (directory-file-name reldir)))
-                               "\0"
-                               (regexp-quote (file-name-nondirectory relfile))
-                               "\0"
-                               "[^\0]*\0"     ;id?
-                               "\\([^\0]*\\)\0" ;"a/f/d", a=removed?
-                               "\\([^\0]*\\)\0" ;sha1 (empty if conflicted)?
-                               "\\([^\0]*\\)\0" ;size?p
-                               ;; y/n.  Whether or not the current copy
-                               ;; was executable the last time bzr checked?
-                               "[^\0]*\0"
-                               "[^\0]*\0"       ;?
-                               ;; Parent information.  Absent in a new repo.
-                               "\\(?:\\([^\0]*\\)\0" ;"a/f/d" a=added?
-                               "\\([^\0]*\\)\0" ;sha1 again?
-                               "\\([^\0]*\\)\0" ;size again?
-                               ;; y/n.  Whether or not the repo thinks
-                               ;; the file should be executable?
-                               "\\([^\0]*\\)\0"
-                               "[^\0]*\0\\)?" ;last revid?
-                               ;; There are more fields when merges are pending.
-                               )
-                       nil t)
-                      ;; Apparently the second sha1 is the one we want: when
-                      ;; there's a conflict, the first sha1 is absent (and the
-                      ;; first size seems to correspond to the file with
-                      ;; conflict markers).
-                      (cond
-                       ((eq (char-after (match-beginning 1)) ?a) 'removed)
-                       ;; If there is no parent, this must be a new repo.
-                       ;; If file is in dirstate, can only be added (b#8025).
-                       ((or (not (match-beginning 4))
-                            (eq (char-after (match-beginning 4)) ?a)) 'added)
-                       ((or (and (eq (string-to-number (match-string 3))
-                                 (nth 7 (file-attributes file)))
-                                 (equal (match-string 5)
-                                        (vc-bzr-sha1 file))
-                                 ;; For a file, does the executable state match?
-                                 ;; (Bug#7544)
-                                 (or (not
-                                      (eq (char-after (match-beginning 1)) ?f))
-                                     (let ((exe
-                                            (memq
-                                             ?x
-                                             (mapcar
-                                              'identity
-                                              (nth 8 (file-attributes file))))))
-                                       (if (eq (char-after (match-beginning 7))
-                                               ?y)
-                                           exe
-                                         (not exe)))))
-                           (and
-                            ;; It looks like for lightweight
-                            ;; checkouts \2 is empty and we need to
-                            ;; look for size in \6.
-                            (eq (match-beginning 2) (match-end 2))
-                            (eq (string-to-number (match-string 6))
-                                (nth 7 (file-attributes file)))
-                            (equal (match-string 5)
-                                   (vc-bzr-sha1 file))))
-                        'up-to-date)
-                       (t 'edited))
-                    'unregistered))))
-          ;; Either the dirstate file can't be read, or the sha1
-          ;; executable is missing, or ...
-          ;; In either case, recent versions of Bzr aren't that slow
-          ;; any more.
-          (error (vc-bzr-state file)))))))
+  (let* ((root (vc-bzr-root file))
+         (dirstate (expand-file-name vc-bzr-admin-dirstate root)))
+    (when root                          ; Short cut.
+      (condition-case err
+          (with-temp-buffer
+            (insert-file-contents dirstate)
+            (goto-char (point-min))
+            (if (not (looking-at "#bazaar dirstate flat format 3"))
+                (vc-bzr-state file)     ; Some other unknown format?
+              (let* ((relfile (file-relative-name file root))
+                     (reldir (file-name-directory relfile)))
+                (cond
+                 ((not
+                   (re-search-forward
+                    (concat "^\0"
+                            (if reldir (regexp-quote
+                                        (directory-file-name reldir)))
+                            "\0"
+                            (regexp-quote (file-name-nondirectory relfile))
+                            "\0"
+                            "[^\0]*\0"             ;id?
+                            "\\([^\0]*\\)\0"       ;"a/f/d", a=removed?
+                            "\\([^\0]*\\)\0"       ;sha1 (empty if conflicted)?
+                            "\\([^\0]*\\)\0"       ;size?p
+                            ;; y/n.  Whether or not the current copy
+                            ;; was executable the last time bzr checked?
+                            "[^\0]*\0"
+                            "[^\0]*\0"  ;?
+                            ;; Parent information.  Absent in a new repo.
+                            "\\(?:\\([^\0]*\\)\0"  ;"a/f/d" a=added?
+                            "\\([^\0]*\\)\0"       ;sha1 again?
+                            "\\([^\0]*\\)\0"       ;size again?
+                            ;; y/n.  Whether or not the repo thinks
+                            ;; the file should be executable?
+                            "\\([^\0]*\\)\0"
+                            "[^\0]*\0\\)?" ;last revid?
+                            ;; There are more fields when merges are pending.
+                            )
+                    nil t))
+                  'unregistered)
+                 ;; Apparently the second sha1 is the one we want: when
+                 ;; there's a conflict, the first sha1 is absent (and the
+                 ;; first size seems to correspond to the file with
+                 ;; conflict markers).
+                 ((eq (char-after (match-beginning 1)) ?a) 'removed)
+                 ;; If there is no parent, this must be a new repo.
+                 ;; If file is in dirstate, can only be added (b#8025).
+                 ((or (not (match-beginning 4))
+                      (eq (char-after (match-beginning 4)) ?a)) 'added)
+                 ((or (and (eq (string-to-number (match-string 3))
+                               (nth 7 (file-attributes file)))
+                           (equal (match-string 5)
+                                  (save-match-data (vc-bzr-sha1 file)))
+                           ;; For a file, does the executable state match?
+                           ;; (Bug#7544)
+                           (or (not
+                                (eq (char-after (match-beginning 1)) ?f))
+                               (let ((exe
+                                      (memq
+                                       ?x
+                                       (mapcar
+                                        'identity
+                                        (nth 8 (file-attributes file))))))
+                                 (if (eq (char-after (match-beginning 7))
+                                         ?y)
+                                     exe
+                                   (not exe)))))
+                      (and
+                       ;; It looks like for lightweight
+                       ;; checkouts \2 is empty and we need to
+                       ;; look for size in \6.
+                       (eq (match-beginning 2) (match-end 2))
+                       (eq (string-to-number (match-string 6))
+                           (nth 7 (file-attributes file)))
+                       (equal (match-string 5)
+                              (vc-bzr-sha1 file))))
+                  'up-to-date)
+                 (t 'edited)))))
+        ;; The dirstate file can't be read, or some other problem.
+        (error
+         (message "Falling back on \"slow\" status detection (%S)" err)
+         (vc-bzr-state file))))))
 
 
 (defun vc-bzr-registered (file)
@@ -320,9 +306,8 @@ in the repository root directory of FILE."
 
 (defun vc-bzr-file-name-relative (filename)
   "Return file name FILENAME stripped of the initial Bzr repository path."
-  (lexical-let*
-      ((filename* (expand-file-name filename))
-       (rootdir (vc-bzr-root filename*)))
+  (let* ((filename* (expand-file-name filename))
+         (rootdir (vc-bzr-root filename*)))
     (when rootdir
          (file-relative-name filename* rootdir))))
 
@@ -417,52 +402,58 @@ string or nil, and STATUS is one of the symbols: `added',
 `ignored', `kindchanged', `modified', `removed', `renamed', `unknown',
 which directly correspond to `bzr status' output, or 'unchanged
 for files whose copy in the working tree is identical to the one
-in the branch repository, or nil for files that are not
-registered with Bzr.
-
-If any error occurred in running `bzr status', then return nil."
+in the branch repository (or whose status not be determined)."
+;; Doc used to also say the following, but AFAICS, it has never been true.
+;;
+;;   ", or nil for files that are not registered with Bzr.
+;;   If any error occurred in running `bzr status', then return nil."
+;;
+;; Rather than returning nil in case of an error, it returns
+;; (unchanged . WARNING).  FIXME unchanged is not the best status to
+;; return in case of error.
   (with-temp-buffer
-    (let ((ret (condition-case nil
-                   (vc-bzr-command "status" t 0 file)
-                 (file-error nil)))     ; vc-bzr-program not found.
-          (status 'unchanged))
-          ;; the only secure status indication in `bzr status' output
-          ;; is a couple of lines following the pattern::
-          ;;   | <status>:
-          ;;   |   <file name>
-          ;; if the file is up-to-date, we get no status report from `bzr',
-          ;; so if the regexp search for the above pattern fails, we consider
-          ;; the file to be up-to-date.
-          (goto-char (point-min))
-          (when (re-search-forward
-                 ;; bzr prints paths relative to the repository root.
-                 (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+"
-                         (regexp-quote (vc-bzr-file-name-relative file))
-                         ;; Bzr appends a '/' to directory names and
-                         ;; '*' to executable files
-                         (if (file-directory-p file) "/?" "\\*?")
-                         "[ \t\n]*$")
-                 nil t)
-            (lexical-let ((statusword (match-string 1)))
-              ;; Erase the status text that matched.
-              (delete-region (match-beginning 0) (match-end 0))
-              (setq status
-                    (intern (replace-regexp-in-string " " "" statusword)))))
-          (when status
-            (goto-char (point-min))
-            (skip-chars-forward " \n\t") ;Throw away spaces.
-            (cons status
-                  ;; "bzr" will output warnings and informational messages to
-                  ;; stderr; due to Emacs's `vc-do-command' (and, it seems,
-                  ;; `start-process' itself) limitations, we cannot catch stderr
-                  ;; and stdout into different buffers.  So, if there's anything
-                  ;; left in the buffer after removing the above status
-                  ;; keywords, let us just presume that any other message from
-                  ;; "bzr" is a user warning, and display it.
-                  (unless (eobp) (buffer-substring (point) (point-max))))))))
+    ;; This is with-demoted-errors without the condition-case-unless-debug
+    ;; annoyance, which makes it fail during ert testing.
+    (condition-case err (vc-bzr-command "status" t 0 file)
+      (error (message "Error: %S" err) nil))
+    (let ((status 'unchanged))
+      ;; the only secure status indication in `bzr status' output
+      ;; is a couple of lines following the pattern::
+      ;;   | <status>:
+      ;;   |   <file name>
+      ;; if the file is up-to-date, we get no status report from `bzr',
+      ;; so if the regexp search for the above pattern fails, we consider
+      ;; the file to be up-to-date.
+      (goto-char (point-min))
+      (when (re-search-forward
+             ;; bzr prints paths relative to the repository root.
+             (concat "^\\(" vc-bzr-state-words "\\):[ \t\n]+"
+                     (regexp-quote (vc-bzr-file-name-relative file))
+                     ;; Bzr appends a '/' to directory names and
+                     ;; '*' to executable files
+                     (if (file-directory-p file) "/?" "\\*?")
+                     "[ \t\n]*$")
+             nil t)
+        (let ((statusword (match-string 1)))
+          ;; Erase the status text that matched.
+          (delete-region (match-beginning 0) (match-end 0))
+          (setq status
+                (intern (replace-regexp-in-string " " "" statusword)))))
+      (when status
+        (goto-char (point-min))
+        (skip-chars-forward " \n\t") ;Throw away spaces.
+        (cons status
+              ;; "bzr" will output warnings and informational messages to
+              ;; stderr; due to Emacs's `vc-do-command' (and, it seems,
+              ;; `start-process' itself) limitations, we cannot catch stderr
+              ;; and stdout into different buffers.  So, if there's anything
+              ;; left in the buffer after removing the above status
+              ;; keywords, let us just presume that any other message from
+              ;; "bzr" is a user warning, and display it.
+              (unless (eobp) (buffer-substring (point) (point-max))))))))
 
 (defun vc-bzr-state (file)
-  (lexical-let ((result (vc-bzr-status file)))
+  (let ((result (vc-bzr-status file)))
     (when (consp result)
       (let ((warnings (cdr result)))
         (when warnings
@@ -514,16 +505,15 @@ If any error occurred in running `bzr status', then return nil."
 (defun vc-bzr-working-revision (file)
   ;; Together with the code in vc-state-heuristic, this makes it possible
   ;; to get the initial VC state of a Bzr file even if Bzr is not installed.
-  (lexical-let*
-      ((rootdir (vc-bzr-root file))
-       (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file
-                                             rootdir))
-       (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir))
-       (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir)))
+  (let* ((rootdir (vc-bzr-root file))
+         (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file
+                                               rootdir))
+         (revhistory-file (expand-file-name vc-bzr-admin-revhistory rootdir))
+         (lastrev-file (expand-file-name vc-bzr-admin-lastrev rootdir)))
     ;; This looks at internal files to avoid forking a bzr process.
     ;; May break if they change their format.
     (if (and (file-exists-p branch-format-file)
-            ;; For lightweight checkouts (obtained with bzr checkout --lightweight)
+            ;; For lightweight checkouts (obtained with bzr co --lightweight)
             ;; the branch-format-file does not contain the revision
             ;; information, we need to look up the branch-format-file
             ;; in the place where the lightweight checkout comes
@@ -542,17 +532,21 @@ If any error occurred in running `bzr status', then return nil."
                     (when (re-search-forward "file://\\(.+\\)" nil t)
                       (let ((l-c-parent-dir (match-string 1)))
                         (when (and (memq system-type '(ms-dos windows-nt))
-                                   (string-match-p "^/[[:alpha:]]:" l-c-parent-dir))
-                          ;;; The non-Windows code takes a shortcut by using the host/path
-                          ;;; separator slash as the start of the absolute path.  That
-                          ;;; does not work on Windows, so we must remove it (bug#5345)
+                                   (string-match-p "^/[[:alpha:]]:"
+                                                    l-c-parent-dir))
+                          ;;; The non-Windows code takes a shortcut by using
+                          ;;; the host/path separator slash as the start of
+                          ;;; the absolute path.  That does not work on
+                          ;;; Windows, so we must remove it (bug#5345)
                           (setq l-c-parent-dir (substring l-c-parent-dir 1)))
                         (setq branch-format-file
                               (expand-file-name vc-bzr-admin-branch-format-file
                                                 l-c-parent-dir))
                         (setq lastrev-file
-                              (expand-file-name vc-bzr-admin-lastrev l-c-parent-dir))
-                        ;; FIXME: maybe it's overkill to check if both these files exist.
+                              (expand-file-name vc-bzr-admin-lastrev
+                                                 l-c-parent-dir))
+                        ;; FIXME: maybe it's overkill to check if both these
+                        ;; files exist.
                         (and (file-exists-p branch-format-file)
                              (file-exists-p lastrev-file)))))
                 t)))
@@ -574,11 +568,10 @@ If any error occurred in running `bzr status', then return nil."
             (when (re-search-forward "[0-9]+" nil t)
              (buffer-substring (match-beginning 0) (match-end 0))))))
       ;; fallback to calling "bzr revno"
-      (lexical-let*
-          ((result (vc-bzr-command-discarding-stderr
-                    vc-bzr-program "revno" (file-relative-name file)))
-           (exitcode (car result))
-           (output (cdr result)))
+      (let* ((result (vc-bzr-command-discarding-stderr
+                      vc-bzr-program "revno" (file-relative-name file)))
+             (exitcode (car result))
+             (output (cdr result)))
         (cond
          ((eq exitcode 0) (substring output 0 -1))
          (t nil))))))
@@ -587,21 +580,21 @@ If any error occurred in running `bzr status', then return nil."
   "Create a new Bzr repository."
   (vc-bzr-command "init" nil 0 nil))
 
-(defun vc-bzr-init-revision (&optional file)
+(defun vc-bzr-init-revision (&optional _file)
   "Always return nil, as Bzr cannot register explicit versions."
   nil)
 
-(defun vc-bzr-previous-revision (file rev)
+(defun vc-bzr-previous-revision (_file rev)
   (if (string-match "\\`[0-9]+\\'" rev)
       (number-to-string (1- (string-to-number rev)))
     (concat "before:" rev)))
 
-(defun vc-bzr-next-revision (file rev)
+(defun vc-bzr-next-revision (_file rev)
   (if (string-match "\\`[0-9]+\\'" rev)
       (number-to-string (1+ (string-to-number rev)))
     (error "Don't know how to compute the next revision of %s" rev)))
 
-(defun vc-bzr-register (files &optional rev comment)
+(defun vc-bzr-register (files &optional rev _comment)
   "Register FILES under bzr.
 Signal an error unless REV is nil.
 COMMENT is ignored."
@@ -650,7 +643,7 @@ REV non-nil gets an error."
           (vc-bzr-command "cat" t 0 file "-r" rev)
         (vc-bzr-command "cat" t 0 file))))
 
-(defun vc-bzr-checkout (file &optional editable rev)
+(defun vc-bzr-checkout (_file &optional _editable rev)
   (if rev (error "Operation not supported")
     ;; Else, there's nothing to do.
     nil))
@@ -801,7 +794,7 @@ Each line is tagged with the revision number, which has a `help-echo'
 property containing author and date information."
   (apply #'vc-bzr-command "annotate" buffer 'async file "--long" "--all"
          (if revision (list "-r" revision)))
-  (lexical-let ((table (make-hash-table :test 'equal)))
+  (let ((table (make-hash-table :test 'equal)))
     (set-process-filter
      (get-buffer-process buffer)
      (lambda (proc string)
@@ -868,7 +861,7 @@ stream.  Standard error output is discarded."
      (apply #'process-file command nil (list (current-buffer) nil) nil args)
      (buffer-substring (point-min) (point-max)))))
 
-(defstruct (vc-bzr-extra-fileinfo
+(cl-defstruct (vc-bzr-extra-fileinfo
             (:copier nil)
             (:constructor vc-bzr-create-extra-fileinfo (extra-name))
             (:conc-name vc-bzr-extra-fileinfo->))
@@ -966,7 +959,7 @@ stream.  Standard error output is discarded."
                             ;; frob the results accordingly.
                             (file-relative-name ,dir (vc-bzr-root ,dir)))))
 
-(defun vc-bzr-dir-status-files (dir files default-state update-function)
+(defun vc-bzr-dir-status-files (dir files _default-state update-function)
   "Return a list of conses (file . state) for DIR."
   (apply 'vc-bzr-command "status" (current-buffer) 'async dir "-v" "-S" files)
   (vc-exec-after
@@ -1203,74 +1196,73 @@ stream.  Standard error output is discarded."
       "revno" "submit" "tag")))
 
 (defun vc-bzr-revision-completion-table (files)
-  (lexical-let ((files files))
-    ;; What about using `files'?!?  --Stef
-    (lambda (string pred action)
-      (cond
-       ((string-match "\\`\\(ancestor\\|branch\\|\\(revno:\\)?[-0-9]+:\\):"
-                      string)
-        (completion-table-with-context (substring string 0 (match-end 0))
-                                       (apply-partially
-                                        'completion-table-with-predicate
-                                        'completion-file-name-table
-                                        'file-directory-p t)
-                                       (substring string (match-end 0))
-                                       pred
-                                       action))
-       ((string-match "\\`\\(before\\):" string)
-        (completion-table-with-context (substring string 0 (match-end 0))
-                                       (vc-bzr-revision-completion-table files)
-                                       (substring string (match-end 0))
-                                       pred
-                                       action))
-       ((string-match "\\`\\(tag\\):" string)
-        (let ((prefix (substring string 0 (match-end 0)))
-              (tag (substring string (match-end 0)))
-              (table nil)
-             process-file-side-effects)
-          (with-temp-buffer
-            ;; "bzr-1.2 tags" is much faster with --show-ids.
-            (process-file vc-bzr-program nil '(t) nil "tags" "--show-ids")
-            ;; The output is ambiguous, unless we assume that revids do not
-            ;; contain spaces.
-            (goto-char (point-min))
-            (while (re-search-forward "^\\(.*[^ \n]\\) +[^ \n]*$" nil t)
-              (push (match-string-no-properties 1) table)))
-          (completion-table-with-context prefix table tag pred action)))
-
-       ((string-match "\\`annotate:" string)
-        (completion-table-with-context
-         (substring string 0 (match-end 0))
-         (apply-partially #'completion-table-with-terminator '(":" . "\\`a\\`")
-                          #'completion-file-name-table)
-         (substring string (match-end 0)) pred action))
-
-       ((string-match "\\`date:" string)
-        (completion-table-with-context
-         (substring string 0 (match-end 0))
-         '("yesterday" "today" "tomorrow")
-         (substring string (match-end 0)) pred action))
-
-       ((string-match "\\`\\([a-z]+\\):" string)
-        ;; no actual completion for the remaining keywords.
-        (completion-table-with-context (substring string 0 (match-end 0))
-                                       (if (member (match-string 1 string)
-                                                   vc-bzr-revision-keywords)
-                                           ;; If it's a valid keyword,
-                                           ;; use a non-empty table to
-                                           ;; indicate it.
-                                           '("") nil)
-                                       (substring string (match-end 0))
-                                       pred
-                                       action))
-       (t
-        ;; Could use completion-table-with-terminator, except that it
-        ;; currently doesn't work right w.r.t pcm and doesn't give
-        ;; the *Completions* output we want.
-        (complete-with-action action (eval-when-compile
-                                       (mapcar (lambda (s) (concat s ":"))
-                                               vc-bzr-revision-keywords))
-                              string pred))))))
+  ;; What about using `files'?!?  --Stef
+  (lambda (string pred action)
+    (cond
+     ((string-match "\\`\\(ancestor\\|branch\\|\\(revno:\\)?[-0-9]+:\\):"
+                    string)
+      (completion-table-with-context (substring string 0 (match-end 0))
+                                     (apply-partially
+                                      'completion-table-with-predicate
+                                      'completion-file-name-table
+                                      'file-directory-p t)
+                                     (substring string (match-end 0))
+                                     pred
+                                     action))
+     ((string-match "\\`\\(before\\):" string)
+      (completion-table-with-context (substring string 0 (match-end 0))
+                                     (vc-bzr-revision-completion-table files)
+                                     (substring string (match-end 0))
+                                     pred
+                                     action))
+     ((string-match "\\`\\(tag\\):" string)
+      (let ((prefix (substring string 0 (match-end 0)))
+            (tag (substring string (match-end 0)))
+            (table nil)
+            process-file-side-effects)
+        (with-temp-buffer
+          ;; "bzr-1.2 tags" is much faster with --show-ids.
+          (process-file vc-bzr-program nil '(t) nil "tags" "--show-ids")
+          ;; The output is ambiguous, unless we assume that revids do not
+          ;; contain spaces.
+          (goto-char (point-min))
+          (while (re-search-forward "^\\(.*[^ \n]\\) +[^ \n]*$" nil t)
+            (push (match-string-no-properties 1) table)))
+        (completion-table-with-context prefix table tag pred action)))
+
+     ((string-match "\\`annotate:" string)
+      (completion-table-with-context
+       (substring string 0 (match-end 0))
+       (apply-partially #'completion-table-with-terminator '(":" . "\\`a\\`")
+                        #'completion-file-name-table)
+       (substring string (match-end 0)) pred action))
+
+     ((string-match "\\`date:" string)
+      (completion-table-with-context
+       (substring string 0 (match-end 0))
+       '("yesterday" "today" "tomorrow")
+       (substring string (match-end 0)) pred action))
+
+     ((string-match "\\`\\([a-z]+\\):" string)
+      ;; no actual completion for the remaining keywords.
+      (completion-table-with-context (substring string 0 (match-end 0))
+                                     (if (member (match-string 1 string)
+                                                 vc-bzr-revision-keywords)
+                                         ;; If it's a valid keyword,
+                                         ;; use a non-empty table to
+                                         ;; indicate it.
+                                         '("") nil)
+                                     (substring string (match-end 0))
+                                     pred
+                                     action))
+     (t
+      ;; Could use completion-table-with-terminator, except that it
+      ;; currently doesn't work right w.r.t pcm and doesn't give
+      ;; the *Completions* output we want.
+      (complete-with-action action (eval-when-compile
+                                     (mapcar (lambda (s) (concat s ":"))
+                                             vc-bzr-revision-keywords))
+                            string pred)))))
 
 (provide 'vc-bzr)
 
index 2d8d132a249c4a1b2758873acf49bfdbf0974fa5..2a672623c010666c2a05d905985979b074ed5382 100644 (file)
@@ -1,4 +1,4 @@
-;;; vc-cvs.el --- non-resident support for CVS version-control
+;;; vc-cvs.el --- non-resident support for CVS version-control  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 1995, 1998-2012 Free Software Foundation, Inc.
 
@@ -25,7 +25,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl) (require 'vc))
+(eval-when-compile (require 'vc))
 
 ;; Clear up the cache to force vc-call to check again and discover
 ;; new functions when we reload this file.
@@ -256,7 +256,7 @@ See also variable `vc-cvs-sticky-date-format-string'."
   (vc-file-getprop file 'vc-working-revision))
 
 (defun vc-cvs-mode-line-string (file)
-  "Return string for placement into the modeline for FILE.
+  "Return a string for `vc-mode-line' to put in the mode line for FILE.
 Compared to the default implementation, this function does two things:
 Handle the special case of a CVS file that is added but not yet
 committed and support display of sticky tags."
@@ -280,7 +280,7 @@ committed and support display of sticky tags."
 ;;; State-changing functions
 ;;;
 
-(defun vc-cvs-register (files &optional rev comment)
+(defun vc-cvs-register (files &optional _rev comment)
   "Register FILES into the CVS version-control system.
 COMMENT can be used to provide an initial description of FILES.
 Passes either `vc-cvs-register-switches' or `vc-register-switches'
@@ -502,7 +502,7 @@ Will fail unless you have administrative privileges on the repo."
 
 (declare-function vc-rcs-print-log-cleanup "vc-rcs" ())
 
-(defun vc-cvs-print-log (files buffer &optional shortlog start-revision-ignored limit)
+(defun vc-cvs-print-log (files buffer &optional _shortlog _start-revision limit)
   "Get change logs associated with FILES."
   (require 'vc-rcs)
   ;; It's just the catenation of the individual logs.
@@ -790,7 +790,7 @@ For an empty string, nil is returned (invalid CVS root)."
            ((= len 3)
             ;; :METHOD:PATH or :METHOD:USER@HOSTNAME/PATH
             (cons (cadr root-list)
-                  (vc-cvs-parse-uhp (caddr root-list))))
+                  (vc-cvs-parse-uhp (nth 2 root-list))))
            (t
             ;; :METHOD:[USER@]HOST:PATH
             (cdr root-list)))))
@@ -1006,7 +1006,7 @@ state."
       (vc-exec-after
        `(vc-cvs-after-dir-status (quote ,update-function))))))
 
-(defun vc-cvs-dir-status-files (dir files default-state update-function)
+(defun vc-cvs-dir-status-files (dir files _default-state update-function)
   "Create a list of conses (file . state) for DIR."
   (apply 'vc-cvs-command (current-buffer) 'async dir "-f" "status" files)
   (vc-exec-after
@@ -1021,7 +1021,7 @@ state."
        (buffer-substring (point) (point-max)))
     (file-error nil)))
 
-(defun vc-cvs-dir-extra-headers (dir)
+(defun vc-cvs-dir-extra-headers (_dir)
   "Extract and represent per-directory properties of a CVS working copy."
   (let ((repo
         (condition-case nil
@@ -1206,10 +1206,8 @@ is non-nil."
       res)))
 
 (defun vc-cvs-revision-completion-table (files)
-  (lexical-let ((files files)
-                table)
-    (setq table (lazy-completion-table
-                 table (lambda () (vc-cvs-revision-table (car files)))))
+  (letrec ((table (lazy-completion-table
+                   table (lambda () (vc-cvs-revision-table (car files))))))
     table))
 
 
index 33611b4eafdb10d3b274410fde65dd0f4c275981..7c840fd071bed5ed66130578afb51fc4728e920c 100644 (file)
@@ -1,6 +1,6 @@
-;;; vc-dir.el --- Directory status display under VC
+;;; vc-dir.el --- Directory status display under VC  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
 
 ;; Author:   Dan Nicolaescu <dann@ics.uci.edu>
 ;; Keywords: vc tools
@@ -43,8 +43,7 @@
 (require 'ewoc)
 
 ;;; Code:
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 (defcustom vc-dir-mode-hook nil
   "Normal hook run by `vc-dir-mode'.
@@ -54,7 +53,7 @@ See `run-hooks'."
 
 ;; Used to store information for the files displayed in the directory buffer.
 ;; Each item displayed corresponds to one of these defstructs.
-(defstruct (vc-dir-fileinfo
+(cl-defstruct (vc-dir-fileinfo
             (:copier nil)
             (:type list)            ;So we can use `member' on lists of FIs.
             (:constructor
@@ -92,13 +91,13 @@ See `run-hooks'."
   (let* ;; Look for another buffer name BNAME visiting the same directory.
       ((buf (save-excursion
               (unless create-new
-                (dolist (buffer vc-dir-buffers)
+                (cl-dolist (buffer vc-dir-buffers)
                   (when (buffer-live-p buffer)
                     (set-buffer buffer)
                     (when (and (derived-mode-p 'vc-dir-mode)
                                (eq vc-dir-backend backend)
                                (string= default-directory dir))
-                      (return buffer))))))))
+                      (cl-return buffer))))))))
     (or buf
         ;; Create a new buffer named BNAME.
        ;; We pass a filename to create-file-buffer because it is what
@@ -529,7 +528,7 @@ If a prefix argument is given, move by that many lines."
 
 (defun vc-dir-mark-unmark (mark-unmark-function)
   (if (use-region-p)
-      (let ((firstl (line-number-at-pos (region-beginning)))
+      (let (;; (firstl (line-number-at-pos (region-beginning)))
            (lastl (line-number-at-pos (region-end))))
        (save-excursion
          (goto-char (region-beginning))
@@ -546,7 +545,7 @@ If a prefix argument is given, move by that many lines."
   ;; Non-nil iff a parent directory of arg is marked.
   ;; Return value, if non-nil is the `ewoc-data' for the marked parent.
   (let* ((argdir (vc-dir-node-directory arg))
-        (arglen (length argdir))
+        ;; (arglen (length argdir))
         (crt arg)
         (found nil))
     ;; Go through the predecessors, checking if any directory that is
@@ -556,7 +555,7 @@ If a prefix argument is given, move by that many lines."
       (let ((data (ewoc-data crt))
            (dir (vc-dir-node-directory crt)))
        (and (vc-dir-fileinfo->directory data)
-            (vc-string-prefix-p dir argdir)
+            (string-prefix-p dir argdir)
             (vc-dir-fileinfo->marked data)
             (setq found data))))
     found))
@@ -814,11 +813,11 @@ child files."
            ;; FIXME: use vc-dir-child-files-and-states here instead of duplicating it.
            (if (vc-dir-fileinfo->directory crt-data)
                (let* ((dir (vc-dir-fileinfo->directory crt-data))
-                      (dirlen (length dir))
+                      ;; (dirlen (length dir))
                       data)
                  (while
                      (and (setq crt (ewoc-next vc-ewoc crt))
-                          (vc-string-prefix-p dir
+                          (string-prefix-p dir
                                                (progn
                                                  (setq data (ewoc-data crt))
                                                  (vc-dir-node-directory crt))))
@@ -842,11 +841,11 @@ If it is a file, return the corresponding cons for the file itself."
          result)
     (if (vc-dir-fileinfo->directory crt-data)
        (let* ((dir (vc-dir-fileinfo->directory crt-data))
-              (dirlen (length dir))
+              ;; (dirlen (length dir))
               data)
          (while
              (and (setq crt (ewoc-next vc-ewoc crt))
-                   (vc-string-prefix-p dir (progn
+                   (string-prefix-p dir (progn
                                              (setq data (ewoc-data crt))
                                              (vc-dir-node-directory crt))))
            (unless (vc-dir-fileinfo->directory data)
@@ -861,7 +860,7 @@ If it is a file, return the corresponding cons for the file itself."
 
 (defun vc-dir-recompute-file-state (fname def-dir)
   (let* ((file-short (file-relative-name fname def-dir))
-        (remove-me-when-CVS-works
+        (_remove-me-when-CVS-works
          (when (eq vc-dir-backend 'CVS)
            ;; FIXME: Warning: UGLY HACK.  The CVS backend caches the state
            ;; info, this forces the backend to update it.
@@ -875,15 +874,14 @@ If it is a file, return the corresponding cons for the file itself."
   ;; Give a DIRNAME string return the list of all child files shown in
   ;; the current *vc-dir* buffer.
   (let ((crt (ewoc-nth vc-ewoc 0))
-       children
-       dname)
+       children)
     ;; Find DIR
-    (while (and crt (not (vc-string-prefix-p
+    (while (and crt (not (string-prefix-p
                          dirname (vc-dir-node-directory crt))))
       (setq crt (ewoc-next vc-ewoc crt)))
-    (while (and crt (vc-string-prefix-p
+    (while (and crt (string-prefix-p
                     dirname
-                    (setq dname (vc-dir-node-directory crt))))
+                     (vc-dir-node-directory crt)))
       (let ((data (ewoc-data crt)))
        (unless (vc-dir-fileinfo->directory data)
          (push (expand-file-name (vc-dir-fileinfo->name data)) children)))
@@ -915,7 +913,7 @@ If it is a file, return the corresponding cons for the file itself."
           (if (not (derived-mode-p 'vc-dir-mode))
               (push status-buf drop)
             (let ((ddir default-directory))
-              (when (vc-string-prefix-p ddir file)
+              (when (string-prefix-p ddir file)
                 (if (file-directory-p file)
                    (progn
                      (vc-dir-resync-directory-files file)
@@ -1014,7 +1012,7 @@ specific headers."
     (unless (buffer-live-p vc-dir-process-buffer)
       (setq vc-dir-process-buffer
             (generate-new-buffer (format " *VC-%s* tmp status" backend))))
-    (lexical-let ((buffer (current-buffer)))
+    (let ((buffer (current-buffer)))
       (with-current-buffer vc-dir-process-buffer
         (setq default-directory def-dir)
         (erase-buffer)
@@ -1045,7 +1043,7 @@ specific headers."
 
                               (not (vc-dir-fileinfo->needs-update info))))))))))))
 
-(defun vc-dir-revert-buffer-function (&optional ignore-auto noconfirm)
+(defun vc-dir-revert-buffer-function (&optional _ignore-auto _noconfirm)
   (vc-dir-refresh))
 
 (defun vc-dir-refresh ()
@@ -1079,7 +1077,7 @@ Throw an error if another update process is in progress."
       ;; Bzr has serious locking problems, so setup the headers first (this is
       ;; synchronous) rather than doing it while dir-status is running.
       (ewoc-set-hf vc-ewoc (vc-dir-headers backend def-dir) "")
-      (lexical-let ((buffer (current-buffer)))
+      (let ((buffer (current-buffer)))
         (with-current-buffer vc-dir-process-buffer
           (setq default-directory def-dir)
           (erase-buffer)
@@ -1219,7 +1217,7 @@ These are the commands available for use in the file status buffer:
     (let ((use-vc-backend backend))
       (vc-dir-mode))))
 
-(defun vc-default-dir-extra-headers (backend dir)
+(defun vc-default-dir-extra-headers (_backend _dir)
   ;; Be loud by default to remind people to add code to display
   ;; backend specific headers.
   ;; XXX: change this to return nil before the release.
@@ -1234,7 +1232,7 @@ These are the commands available for use in the file status buffer:
     map)
   "Local keymap for visiting a file.")
 
-(defun vc-default-dir-printer (backend fileentry)
+(defun vc-default-dir-printer (_backend fileentry)
   "Pretty print FILEENTRY."
   ;; If you change the layout here, change vc-dir-move-to-goal-column.
   ;; VC backends can implement backend specific versions of this
@@ -1267,10 +1265,10 @@ These are the commands available for use in the file status buffer:
       'mouse-face 'highlight
       'keymap vc-dir-filename-mouse-map))))
 
-(defun vc-default-extra-status-menu (backend)
+(defun vc-default-extra-status-menu (_backend)
   nil)
 
-(defun vc-default-status-fileinfo-extra (backend file)
+(defun vc-default-status-fileinfo-extra (_backend _file)
   "Default absence of extra information returned for a file."
   nil)
 
index ec1b127dd19bbc73d8dbbc32c92d3954e298a364..b8ad4ff5217d9b4842e64de7d8d4980a97321152 100644 (file)
@@ -537,13 +537,12 @@ editing!"
         (kill-buffer (current-buffer)))))
 
 (declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
-(declare-function vc-string-prefix-p "vc" (prefix string))
 
 (defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info)
   "Resync all buffers that visit files in DIRECTORY."
   (dolist (buffer (buffer-list))
     (let ((fname (buffer-file-name buffer)))
-      (when (and fname (vc-string-prefix-p directory fname))
+      (when (and fname (string-prefix-p directory fname))
        (with-current-buffer buffer
          (vc-resynch-buffer fname keep noquery reset-vc-info))))))
 
@@ -576,10 +575,10 @@ NOT-URGENT means it is ok to continue if the user says not to save."
 
 ;; Set up key bindings for use while editing log messages
 
-(defun vc-log-edit (fileset mode)
+(defun vc-log-edit (fileset mode backend)
   "Set up `log-edit' for use on FILE."
   (setq default-directory
-       (with-current-buffer vc-parent-buffer default-directory))
+       (buffer-local-value 'default-directory vc-parent-buffer))
   (log-edit 'vc-finish-logentry
            nil
            `((log-edit-listfun . (lambda ()
@@ -587,14 +586,15 @@ NOT-URGENT means it is ok to continue if the user says not to save."
                                     ;; for directories.
                                     (mapcar 'file-relative-name
                                             ',fileset)))
-             (log-edit-diff-function . (lambda () (vc-diff nil))))
+             (log-edit-diff-function . vc-diff)
+             (log-edit-vc-backend . ,backend)
+             (vc-log-fileset . ,fileset))
            nil
            mode)
-  (set (make-local-variable 'vc-log-fileset) fileset)
   (set-buffer-modified-p nil)
   (setq buffer-file-name nil))
 
-(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook)
+(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend)
   "Accept a comment for an operation on FILES.
 If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
 action on close to ACTION.  If COMMENT is a string and
@@ -605,7 +605,8 @@ entered COMMENT.  If COMMENT is t, also do action immediately with an
 empty comment.  Remember the file's buffer in `vc-parent-buffer'
 \(current one if no file).  Puts the log-entry buffer in major-mode
 MODE, defaulting to `log-edit-mode' if MODE is nil.
-AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'."
+AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'.
+BACKEND, if non-nil, specifies a VC backend for the Log Edit buffer."
   (let ((parent
          (if (vc-dispatcher-browsing)
              ;; If we are called from a directory browser, the parent buffer is
@@ -620,7 +621,7 @@ AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'."
     (set (make-local-variable 'vc-parent-buffer) parent)
     (set (make-local-variable 'vc-parent-buffer-name)
         (concat " from " (buffer-name vc-parent-buffer)))
-    (vc-log-edit files mode)
+    (vc-log-edit files mode backend)
     (make-local-variable 'vc-log-after-operation-hook)
     (when after-hook
       (setq vc-log-after-operation-hook after-hook))
index 9aa2ee72b558fc01f9052063fad3f786a058c6f4..4dbc9eab27f7c05763973b7df23829a0f473b64d 100644 (file)
@@ -1,4 +1,4 @@
-;;; vc-git.el --- VC backend for the git version control system
+;;; vc-git.el --- VC backend for the git version control system -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
 ;; - find-file-hook ()                             NOT NEEDED
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'vc)
   (require 'vc-dir)
   (require 'grep))
@@ -160,7 +160,7 @@ matching the resulting Git log output, and KEYWORDS is a list of
 ;;; BACKEND PROPERTIES
 
 (defun vc-git-revision-granularity () 'repository)
-(defun vc-git-checkout-model (files) 'implicit)
+(defun vc-git-checkout-model (_files) 'implicit)
 
 ;;; STATE-QUERYING FUNCTIONS
 
@@ -173,32 +173,35 @@ matching the resulting Git log output, and KEYWORDS is a list of
 
 (defun vc-git-registered (file)
   "Check whether FILE is registered with git."
-  (let ((dir (vc-git-root file)))
-    (when dir
-      (with-temp-buffer
-       (let* (process-file-side-effects
-              ;; Do not use the `file-name-directory' here: git-ls-files
-              ;; sometimes fails to return the correct status for relative
-              ;; path specs.
-              ;; See also: http://marc.info/?l=git&m=125787684318129&w=2
-              (name (file-relative-name file dir))
-              (str (ignore-errors
-                    (cd dir)
-                    (vc-git--out-ok "ls-files" "-c" "-z" "--" name)
-                    ;; If result is empty, use ls-tree to check for deleted
-                     ;; file.
-                    (when (eq (point-min) (point-max))
-                      (vc-git--out-ok "ls-tree" "--name-only" "-z" "HEAD"
-                                       "--" name))
-                    (buffer-string))))
-         (and str
-              (> (length str) (length name))
-              (string= (substring str 0 (1+ (length name)))
-                       (concat name "\0"))))))))
+  (or (vc-file-getprop file 'git-registered)
+      (vc-file-setprop
+       file 'git-registered
+       (let ((dir (vc-git-root file)))
+        (when dir
+          (with-temp-buffer
+            (let* (process-file-side-effects
+                   ;; Do not use the `file-name-directory' here: git-ls-files
+                   ;; sometimes fails to return the correct status for relative
+                   ;; path specs.
+                   ;; See also: http://marc.info/?l=git&m=125787684318129&w=2
+                   (name (file-relative-name file dir))
+                   (str (ignore-errors
+                          (cd dir)
+                          (vc-git--out-ok "ls-files" "-c" "-z" "--" name)
+                          ;; If result is empty, use ls-tree to check for deleted
+                          ;; file.
+                          (when (eq (point-min) (point-max))
+                            (vc-git--out-ok "ls-tree" "--name-only" "-z" "HEAD"
+                                            "--" name))
+                          (buffer-string))))
+              (and str
+                   (> (length str) (length name))
+                   (string= (substring str 0 (1+ (length name)))
+                            (concat name "\0"))))))))))
 
 (defun vc-git--state-code (code)
   "Convert from a string to a added/deleted/modified state."
-  (case (string-to-char code)
+  (pcase (string-to-char code)
     (?M 'edited)
     (?A 'added)
     (?D 'removed)
@@ -233,7 +236,7 @@ matching the resulting Git log output, and KEYWORDS is a list of
               (vc-git--state-code diff-letter)))
        (if (vc-git--empty-db-p) 'added 'up-to-date)))))
 
-(defun vc-git-working-revision (file)
+(defun vc-git-working-revision (_file)
   "Git-specific version of `vc-working-revision'."
   (let* (process-file-side-effects
         (str (with-output-to-string
@@ -247,8 +250,8 @@ matching the resulting Git log output, and KEYWORDS is a list of
   (eq 'up-to-date (vc-git-state file)))
 
 (defun vc-git-mode-line-string (file)
-  "Return string for placement into the modeline for FILE."
-  (let* ((branch (vc-git-working-revision file))
+  "Return a string for `vc-mode-line' to put in the mode line for FILE."
+  (let* ((branch (vc-working-revision file))
          (def-ml (vc-default-mode-line-string 'Git file))
          (help-echo (get-text-property 0 'help-echo def-ml)))
     (if (zerop (length branch))
@@ -258,7 +261,7 @@ matching the resulting Git log output, and KEYWORDS is a list of
       (propertize def-ml
                   'help-echo (concat help-echo "\nCurrent branch: " branch)))))
 
-(defstruct (vc-git-extra-fileinfo
+(cl-defstruct (vc-git-extra-fileinfo
             (:copier nil)
             (:constructor vc-git-create-extra-fileinfo
                           (old-perm new-perm &optional rename-state orig-name))
@@ -272,12 +275,12 @@ matching the resulting Git log output, and KEYWORDS is a list of
   (if (string-match "[\n\t\"\\]" name)
       (concat "\""
               (mapconcat (lambda (c)
-                   (case c
+                   (pcase c
                      (?\n "\\n")
                      (?\t "\\t")
                      (?\\ "\\\\")
                      (?\" "\\\"")
-                     (t (char-to-string c))))
+                     (_ (char-to-string c))))
                  name "")
               "\"")
     name))
@@ -286,28 +289,28 @@ matching the resulting Git log output, and KEYWORDS is a list of
   "Return a string describing the file type based on its permissions."
   (let* ((old-type (lsh (or old-perm 0) -9))
         (new-type (lsh (or new-perm 0) -9))
-        (str (case new-type
+        (str (pcase new-type
                (?\100  ;; File.
-                (case old-type
+                (pcase old-type
                   (?\100 nil)
                   (?\120 "   (type change symlink -> file)")
                   (?\160 "   (type change subproject -> file)")))
                 (?\120  ;; Symlink.
-                 (case old-type
+                 (pcase old-type
                    (?\100 "   (type change file -> symlink)")
                    (?\160 "   (type change subproject -> symlink)")
                    (t "   (symlink)")))
                  (?\160  ;; Subproject.
-                  (case old-type
+                  (pcase old-type
                     (?\100 "   (type change file -> subproject)")
                     (?\120 "   (type change symlink -> subproject)")
                     (t "   (subproject)")))
                   (?\110 nil)  ;; Directory (internal, not a real git state).
                  (?\000  ;; Deleted or unknown.
-                  (case old-type
+                  (pcase old-type
                     (?\120 "   (symlink)")
                     (?\160 "   (subproject)")))
-                 (t (format "   (unknown type %o)" new-type)))))
+                 (_ (format "   (unknown type %o)" new-type)))))
     (cond (str (propertize str 'face 'font-lock-comment-face))
           ((eq new-type ?\110) "/")
           (t ""))))
@@ -375,18 +378,18 @@ or an empty string if none."
   "Process sentinel for the various dir-status stages."
   (let (next-stage result)
     (goto-char (point-min))
-    (case stage
-      (update-index
+    (pcase stage
+      (`update-index
        (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added
                           (if files 'ls-files-up-to-date 'diff-index))))
-      (ls-files-added
+      (`ls-files-added
        (setq next-stage 'ls-files-unknown)
        (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t)
          (let ((new-perm (string-to-number (match-string 1) 8))
                (name (match-string 2)))
            (push (list name 'added (vc-git-create-extra-fileinfo 0 new-perm))
                  result))))
-      (ls-files-up-to-date
+      (`ls-files-up-to-date
        (setq next-stage 'diff-index)
        (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 0\t\\([^\0]+\\)\0" nil t)
          (let ((perm (string-to-number (match-string 1) 8))
@@ -394,18 +397,18 @@ or an empty string if none."
            (push (list name 'up-to-date
                        (vc-git-create-extra-fileinfo perm perm))
                  result))))
-      (ls-files-unknown
+      (`ls-files-unknown
        (when files (setq next-stage 'ls-files-ignored))
        (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1)
          (push (list (match-string 1) 'unregistered
                      (vc-git-create-extra-fileinfo 0 0))
                result)))
-      (ls-files-ignored
+      (`ls-files-ignored
        (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1)
          (push (list (match-string 1) 'ignored
                      (vc-git-create-extra-fileinfo 0 0))
                result)))
-      (diff-index
+      (`diff-index
        (setq next-stage 'ls-files-unknown)
        (while (re-search-forward
                ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} [0-9a-f]\\{40\\} \\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0"
@@ -444,41 +447,41 @@ or an empty string if none."
 
 (defun vc-git-dir-status-goto-stage (stage files update-function)
   (erase-buffer)
-  (case stage
-    (update-index
+  (pcase stage
+    (`update-index
      (if files
          (vc-git-command (current-buffer) 'async files "add" "--refresh" "--")
        (vc-git-command (current-buffer) 'async nil
                        "update-index" "--refresh")))
-    (ls-files-added
+    (`ls-files-added
      (vc-git-command (current-buffer) 'async files
                      "ls-files" "-z" "-c" "-s" "--"))
-    (ls-files-up-to-date
+    (`ls-files-up-to-date
      (vc-git-command (current-buffer) 'async files
                      "ls-files" "-z" "-c" "-s" "--"))
-    (ls-files-unknown
+    (`ls-files-unknown
      (vc-git-command (current-buffer) 'async files
                      "ls-files" "-z" "-o" "--directory"
                      "--no-empty-directory" "--exclude-standard" "--"))
-    (ls-files-ignored
+    (`ls-files-ignored
      (vc-git-command (current-buffer) 'async files
                      "ls-files" "-z" "-o" "-i" "--directory"
                      "--no-empty-directory" "--exclude-standard" "--"))
     ;; --relative added in Git 1.5.5.
-    (diff-index
+    (`diff-index
      (vc-git-command (current-buffer) 'async files
                      "diff-index" "--relative" "-z" "-M" "HEAD" "--")))
   (vc-exec-after
    `(vc-git-after-dir-status-stage ',stage  ',files ',update-function)))
 
-(defun vc-git-dir-status (dir update-function)
+(defun vc-git-dir-status (_dir update-function)
   "Return a list of (FILE STATE EXTRA) entries for DIR."
   ;; Further things that would have to be fixed later:
   ;; - how to handle unregistered directories
   ;; - how to support vc-dir on a subdir of the project tree
   (vc-git-dir-status-goto-stage 'update-index nil update-function))
 
-(defun vc-git-dir-status-files (dir files default-state update-function)
+(defun vc-git-dir-status-files (_dir files _default-state update-function)
   "Return a list of (FILE STATE EXTRA) entries for FILES in DIR."
   (vc-git-dir-status-goto-stage 'update-index files update-function))
 
@@ -512,7 +515,7 @@ or an empty string if none."
                  :help "Show the contents of the current stash"))
     map))
 
-(defun vc-git-dir-extra-headers (dir)
+(defun vc-git-dir-extra-headers (_dir)
   (let ((str (with-output-to-string
                (with-current-buffer standard-output
                  (vc-git--out-ok "symbolic-ref" "HEAD"))))
@@ -590,7 +593,7 @@ The car of the list is the current branch."
   "Create a new Git repository."
   (vc-git-command nil 0 nil "init"))
 
-(defun vc-git-register (files &optional rev comment)
+(defun vc-git-register (files &optional _rev _comment)
   "Register FILES into the git version-control system."
   (let (flist dlist)
     (dolist (crt files)
@@ -609,7 +612,7 @@ The car of the list is the current branch."
 
 (declare-function log-edit-extract-headers "log-edit" (headers string))
 
-(defun vc-git-checkin (files rev comment)
+(defun vc-git-checkin (files _rev comment)
   (let ((coding-system-for-write vc-git-commits-coding-system))
     (apply 'vc-git-command nil 0 files
           (nconc (list "commit" "-m")
@@ -635,7 +638,7 @@ The car of the list is the current branch."
      nil
      "cat-file" "blob" (concat (if rev rev "HEAD") ":" fullname))))
 
-(defun vc-git-checkout (file &optional editable rev)
+(defun vc-git-checkout (file &optional _editable rev)
   (vc-git-command nil 0 file "checkout" (or rev "HEAD")))
 
 (defun vc-git-revert (file &optional contents-done)
@@ -821,7 +824,7 @@ or BRANCH^ (where \"^\" can be repeated)."
           (append (vc-switches 'git 'diff)
                   (list "-p" (or rev1 "HEAD") rev2 "--")))))
 
-(defun vc-git-revision-table (files)
+(defun vc-git-revision-table (_files)
   ;; What about `files'?!?  --Stef
   (let (process-file-side-effects
        (table (list "HEAD")))
@@ -834,10 +837,8 @@ or BRANCH^ (where \"^\" can be repeated)."
     table))
 
 (defun vc-git-revision-completion-table (files)
-  (lexical-let ((files files)
-                table)
-    (setq table (lazy-completion-table
-                 table (lambda () (vc-git-revision-table files))))
+  (letrec ((table (lazy-completion-table
+                   table (lambda () (vc-git-revision-table files)))))
     table))
 
 (defun vc-git-annotate-command (file buf &optional rev)
@@ -876,7 +877,7 @@ or BRANCH^ (where \"^\" can be repeated)."
              (vc-git-command nil 0 nil "checkout" "-b" name)
            (vc-git-command nil 0 nil "tag" name)))))
 
-(defun vc-git-retrieve-tag (dir name update)
+(defun vc-git-retrieve-tag (dir name _update)
   (let ((default-directory dir))
     (vc-git-command nil 0 nil "checkout" name)
     ;; FIXME: update buffers if `update' is true
@@ -961,7 +962,8 @@ or BRANCH^ (where \"^\" can be repeated)."
 (defun vc-git-extra-status-menu () vc-git-extra-menu-map)
 
 (defun vc-git-root (file)
-  (vc-find-root file ".git"))
+  (or (vc-file-getprop file 'git-root)
+      (vc-file-setprop file 'git-root (vc-find-root file ".git"))))
 
 ;; Derived from `lgrep'.
 (defun vc-git-grep (regexp &optional files dir)
index 52e8051342d7c2f4d218eb64057dd14b0ee71c58..6dbf6978372a3bd12b60e015cd87c2e11bd8ca97 100644 (file)
@@ -1,8 +1,9 @@
-;;; vc-hg.el --- VC backend for the mercurial version control system
+;;; vc-hg.el --- VC backend for the mercurial version control system  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2006-2012 Free Software Foundation, Inc.
 
 ;; Author: Ivan Kanis
+;; Maintainer: FSF
 ;; Keywords: vc tools
 ;; Package: vc
 
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'vc)
   (require 'vc-dir))
 
@@ -167,7 +168,7 @@ highlighting the Log View buffer."
 (defvar vc-hg-history nil)
 
 (defun vc-hg-revision-granularity () 'repository)
-(defun vc-hg-checkout-model (files) 'implicit)
+(defun vc-hg-checkout-model (_files) 'implicit)
 
 ;;; State querying functions
 
@@ -337,10 +338,8 @@ highlighting the Log View buffer."
 
 ;; Modeled after the similar function in vc-cvs.el
 (defun vc-hg-revision-completion-table (files)
-  (lexical-let ((files files)
-                table)
-    (setq table (lazy-completion-table
-                 table (lambda () (vc-hg-revision-table files))))
+  (letrec ((table (lazy-completion-table
+                   table (lambda () (vc-hg-revision-table files)))))
     table))
 
 (defun vc-hg-annotate-command (file buffer &optional revision)
@@ -376,12 +375,12 @@ Optional arg REVISION is a revision to annotate from."
              (expand-file-name (match-string-no-properties 4)
                                (vc-hg-root default-directory)))))))
 
-(defun vc-hg-previous-revision (file rev)
+(defun vc-hg-previous-revision (_file rev)
   (let ((newrev (1- (string-to-number rev))))
     (when (>= newrev 0)
       (number-to-string newrev))))
 
-(defun vc-hg-next-revision (file rev)
+(defun vc-hg-next-revision (_file rev)
   (let ((newrev (1+ (string-to-number rev)))
         (tip-revision
          (with-temp-buffer
@@ -407,7 +406,7 @@ Optional arg REVISION is a revision to annotate from."
   "Rename file from OLD to NEW using `hg mv'."
   (vc-hg-command nil 0 new "mv" old))
 
-(defun vc-hg-register (files &optional rev comment)
+(defun vc-hg-register (files &optional _rev _comment)
   "Register FILES under hg.
 REV is ignored.
 COMMENT is ignored."
@@ -437,7 +436,7 @@ COMMENT is ignored."
 
 (declare-function log-edit-extract-headers "log-edit" (headers string))
 
-(defun vc-hg-checkin (files rev comment)
+(defun vc-hg-checkin (files _rev comment)
   "Hg-specific version of `vc-backend-checkin'.
 REV is ignored."
   (apply 'vc-hg-command nil 0 files
@@ -454,7 +453,7 @@ REV is ignored."
       (vc-hg-command buffer 0 file "cat"))))
 
 ;; Modeled after the similar function in vc-bzr.el
-(defun vc-hg-checkout (file &optional editable rev)
+(defun vc-hg-checkout (file &optional _editable rev)
   "Retrieve a revision of FILE.
 EDITABLE is ignored.
 REV is the revision to check out into WORKFILE."
@@ -486,7 +485,7 @@ REV is the revision to check out into WORKFILE."
 
 (defvar log-view-vc-backend)
 
-(defstruct (vc-hg-extra-fileinfo
+(cl-defstruct (vc-hg-extra-fileinfo
             (:copier nil)
             (:constructor vc-hg-create-extra-fileinfo (rename-state extra-name))
             (:conc-name vc-hg-extra-fileinfo->))
@@ -502,16 +501,15 @@ REV is the revision to check out into WORKFILE."
     (when extra
       (insert (propertize
                (format "   (%s %s)"
-                       (case (vc-hg-extra-fileinfo->rename-state extra)
-                         (copied "copied from")
-                         (renamed-from "renamed from")
-                         (renamed-to "renamed to"))
+                       (pcase (vc-hg-extra-fileinfo->rename-state extra)
+                         (`copied "copied from")
+                         (`renamed-from "renamed from")
+                         (`renamed-to "renamed to"))
                        (vc-hg-extra-fileinfo->extra-name extra))
                'face 'font-lock-comment-face)))))
 
 (defun vc-hg-after-dir-status (update-function)
-  (let ((status-char nil)
-        (file nil)
+  (let ((file nil)
         (translation '((?= . up-to-date)
                        (?C . up-to-date)
                        (?A . added)
@@ -566,7 +564,7 @@ REV is the revision to check out into WORKFILE."
   (vc-exec-after
    `(vc-hg-after-dir-status (quote ,update-function))))
 
-(defun vc-hg-dir-status-files (dir files default-state update-function)
+(defun vc-hg-dir-status-files (dir files _default-state update-function)
   (apply 'vc-hg-command (current-buffer) 'async dir "status" "-C" files)
   (vc-exec-after
    `(vc-hg-after-dir-status (quote ,update-function))))
index b6f07ef1dc4dc453f56fedf75dced76463fa69fe..54c33769267ad167fd3efd960d7c9d670ed4faa5 100644 (file)
@@ -30,8 +30,7 @@
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
+(eval-when-compile (require 'cl-lib))
 
 ;; Customization Variables (the rest is in vc.el)
 
@@ -102,7 +101,7 @@ visited and a warning displayed."
   :group 'vc)
 
 (defcustom vc-display-status t
-  "If non-nil, display revision number and lock status in modeline.
+  "If non-nil, display revision number and lock status in mode line.
 Otherwise, not displayed."
   :type 'boolean
   :group 'vc)
@@ -311,7 +310,7 @@ non-nil if FILE exists and its contents were successfully inserted."
       (let ((filepos 0))
         (while
            (and (< 0 (cadr (insert-file-contents
-                            file nil filepos (incf filepos blocksize))))
+                            file nil filepos (cl-incf filepos blocksize))))
                 (progn (beginning-of-line)
                         (let ((pos (re-search-forward limit nil 'move)))
                           (when pos (delete-region (match-beginning 0)
@@ -561,7 +560,7 @@ Return non-nil if FILE is unchanged."
             (if (or (not (eq (cadr err)
                              (indirect-function
                               (vc-find-backend-function backend 'diff))))
-                    (not (eq (caddr err) 4)))
+                    (not (eq (cl-caddr err) 4)))
                 (signal (car err) (cdr err))
               (vc-call-backend backend 'diff (list file)))))))
 
@@ -704,6 +703,8 @@ Before doing that, check if there are any old backups and get rid of them."
   (let ((file buffer-file-name)
         backend)
     (ignore-errors               ;Be careful not to prevent saving the file.
+      (unless (file-exists-p file)
+        (vc-file-clearprops file))
       (and (setq backend (vc-backend file))
            (vc-up-to-date-p file)
            (eq (vc-checkout-model backend (list file)) 'implicit)
@@ -790,7 +791,7 @@ If BACKEND is passed use it as the VC backend when computing the result."
   backend)
 
 (defun vc-default-mode-line-string (backend file)
-  "Return string for placement in modeline by `vc-mode-line' for FILE.
+  "Return a string for `vc-mode-line' to put in the mode line for FILE.
 Format:
 
   \"BACKEND-REV\"        if the file is up-to-date
@@ -866,7 +867,7 @@ current, and kill the buffer that visits the link."
     (let (backend)
       (cond
        ((setq backend (with-demoted-errors (vc-backend buffer-file-name)))
-       ;; Compute the state and put it in the modeline.
+       ;; Compute the state and put it in the mode line.
        (vc-mode-line buffer-file-name backend)
        (unless vc-make-backup-files
          ;; Use this variable, not make-backup-files,
@@ -947,66 +948,66 @@ current, and kill the buffer that visits the link."
   (let ((map (make-sparse-keymap "Version Control")))
     ;;(define-key map [show-files]
     ;;  '("Show Files under VC" . (vc-directory t)))
-    (define-key map [vc-retrieve-tag]
-      `(menu-item ,(purecopy "Retrieve Tag") vc-retrieve-tag
-                 :help ,(purecopy "Retrieve tagged version or branch")))
-    (define-key map [vc-create-tag]
-      `(menu-item ,(purecopy "Create Tag") vc-create-tag
-                 :help ,(purecopy "Create version tag")))
-    (define-key map [separator1] menu-bar-separator)
-    (define-key map [vc-annotate]
-      `(menu-item ,(purecopy "Annotate") vc-annotate
-                 :help ,(purecopy "Display the edit history of the current file using colors")))
-    (define-key map [vc-rename-file]
-      `(menu-item ,(purecopy "Rename File") vc-rename-file
-                 :help ,(purecopy "Rename file")))
-    (define-key map [vc-revision-other-window]
-      `(menu-item ,(purecopy "Show Other Version") vc-revision-other-window
-                 :help ,(purecopy "Visit another version of the current file in another window")))
-    (define-key map [vc-diff]
-      `(menu-item ,(purecopy "Compare with Base Version") vc-diff
-                 :help ,(purecopy "Compare file set with the base version")))
-    (define-key map [vc-root-diff]
-      `(menu-item ,(purecopy "Compare Tree with Base Version") vc-root-diff
-                 :help ,(purecopy "Compare current tree with the base version")))
-    (define-key map [vc-update-change-log]
-      `(menu-item ,(purecopy "Update ChangeLog") vc-update-change-log
-                 :help ,(purecopy "Find change log file and add entries from recent version control logs")))
-    (define-key map [vc-log-out]
-      `(menu-item ,(purecopy "Show Outgoing Log") vc-log-outgoing
-                 :help ,(purecopy "Show a log of changes that will be sent with a push operation")))
-    (define-key map [vc-log-in]
-      `(menu-item ,(purecopy "Show Incoming Log") vc-log-incoming
-                 :help ,(purecopy "Show a log of changes that will be received with a pull operation")))
-    (define-key map [vc-print-log]
-      `(menu-item ,(purecopy "Show History") vc-print-log
-                 :help ,(purecopy "List the change log of the current file set in a window")))
-    (define-key map [vc-print-root-log]
-      `(menu-item ,(purecopy "Show Top of the Tree History ") vc-print-root-log
-                 :help ,(purecopy "List the change log for the current tree in a window")))
-    (define-key map [separator2] menu-bar-separator)
-    (define-key map [vc-insert-header]
-      `(menu-item ,(purecopy "Insert Header") vc-insert-headers
-                 :help ,(purecopy "Insert headers into a file for use with a version control system.
-")))
-    (define-key map [undo]
-      `(menu-item ,(purecopy "Undo Last Check-In") vc-rollback
-                 :help ,(purecopy "Remove the most recent changeset committed to the repository")))
-    (define-key map [vc-revert]
-      `(menu-item ,(purecopy "Revert to Base Version") vc-revert
-                 :help ,(purecopy "Revert working copies of the selected file set to their repository contents")))
-    (define-key map [vc-update]
-      `(menu-item ,(purecopy "Update to Latest Version") vc-update
-                 :help ,(purecopy "Update the current fileset's files to their tip revisions")))
-    (define-key map [vc-next-action]
-      `(menu-item ,(purecopy "Check In/Out")  vc-next-action
-                 :help ,(purecopy "Do the next logical version control operation on the current fileset")))
-    (define-key map [vc-register]
-      `(menu-item ,(purecopy "Register") vc-register
-                 :help ,(purecopy "Register file set into a version control system")))
-    (define-key map [vc-dir]
-      `(menu-item ,(purecopy "VC Dir")  vc-dir
-                 :help ,(purecopy "Show the VC status of files in a directory")))
+    (bindings--define-key map [vc-retrieve-tag]
+      '(menu-item "Retrieve Tag" vc-retrieve-tag
+                 :help "Retrieve tagged version or branch"))
+    (bindings--define-key map [vc-create-tag]
+      '(menu-item "Create Tag" vc-create-tag
+                 :help "Create version tag"))
+    (bindings--define-key map [separator1] menu-bar-separator)
+    (bindings--define-key map [vc-annotate]
+      '(menu-item "Annotate" vc-annotate
+                 :help "Display the edit history of the current file using colors"))
+    (bindings--define-key map [vc-rename-file]
+      '(menu-item "Rename File" vc-rename-file
+                 :help "Rename file"))
+    (bindings--define-key map [vc-revision-other-window]
+      '(menu-item "Show Other Version" vc-revision-other-window
+                 :help "Visit another version of the current file in another window"))
+    (bindings--define-key map [vc-diff]
+      '(menu-item "Compare with Base Version" vc-diff
+                 :help "Compare file set with the base version"))
+    (bindings--define-key map [vc-root-diff]
+      '(menu-item "Compare Tree with Base Version" vc-root-diff
+                 :help "Compare current tree with the base version"))
+    (bindings--define-key map [vc-update-change-log]
+      '(menu-item "Update ChangeLog" vc-update-change-log
+                 :help "Find change log file and add entries from recent version control logs"))
+    (bindings--define-key map [vc-log-out]
+      '(menu-item "Show Outgoing Log" vc-log-outgoing
+                 :help "Show a log of changes that will be sent with a push operation"))
+    (bindings--define-key map [vc-log-in]
+      '(menu-item "Show Incoming Log" vc-log-incoming
+                 :help "Show a log of changes that will be received with a pull operation"))
+    (bindings--define-key map [vc-print-log]
+      '(menu-item "Show History" vc-print-log
+                 :help "List the change log of the current file set in a window"))
+    (bindings--define-key map [vc-print-root-log]
+      '(menu-item "Show Top of the Tree History " vc-print-root-log
+                 :help "List the change log for the current tree in a window"))
+    (bindings--define-key map [separator2] menu-bar-separator)
+    (bindings--define-key map [vc-insert-header]
+      '(menu-item "Insert Header" vc-insert-headers
+                 :help "Insert headers into a file for use with a version control system.
+"))
+    (bindings--define-key map [undo]
+      '(menu-item "Undo Last Check-In" vc-rollback
+                 :help "Remove the most recent changeset committed to the repository"))
+    (bindings--define-key map [vc-revert]
+      '(menu-item "Revert to Base Version" vc-revert
+                 :help "Revert working copies of the selected file set to their repository contents"))
+    (bindings--define-key map [vc-update]
+      '(menu-item "Update to Latest Version" vc-update
+                 :help "Update the current fileset's files to their tip revisions"))
+    (bindings--define-key map [vc-next-action]
+      '(menu-item "Check In/Out" vc-next-action
+                 :help "Do the next logical version control operation on the current fileset"))
+    (bindings--define-key map [vc-register]
+      '(menu-item "Register" vc-register
+                 :help "Register file set into a version control system"))
+    (bindings--define-key map [vc-dir]
+      '(menu-item "VC Dir"  vc-dir
+                 :help "Show the VC status of files in a directory"))
     map))
 
 (defalias 'vc-menu-map vc-menu-map)
index 122743c3747ccba0db886d29c8d811ebd8013b62..67c0f985ae12e3c750ae883157dfe2530443a47b 100644 (file)
@@ -1,4 +1,4 @@
-;;; vc-mtn.el --- VC backend for Monotone
+;;; vc-mtn.el --- VC backend for Monotone  -*- lexical-binding: t -*-
 
 ;; Copyright (C) 2007-2012  Free Software Foundation, Inc.
 
@@ -32,7 +32,7 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl) (require 'vc))
+(eval-when-compile (require 'vc))
 
 (defgroup vc-mtn nil
   "VC Monotone (mtn) backend."
@@ -76,7 +76,7 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
 ;;;###autoload         (vc-mtn-registered file))))
 
 (defun vc-mtn-revision-granularity () 'repository)
-(defun vc-mtn-checkout-model (files) 'implicit)
+(defun vc-mtn-checkout-model (_files) 'implicit)
 
 (defun vc-mtn-root (file)
   (setq file (if (file-directory-p file)
@@ -161,19 +161,19 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
   :group 'vc-mtn)
 
 (defun vc-mtn-mode-line-string (file)
-  "Return string for placement in modeline by `vc-mode-line' for FILE."
+  "Return a string for `vc-mode-line' to put in the mode line for FILE."
   (let ((branch (vc-mtn-workfile-branch file)))
     (dolist (rule vc-mtn-mode-line-rewrite)
       (if (string-match (car rule) branch)
          (setq branch (replace-match (cdr rule) t nil branch))))
     (format "Mtn%c%s"
-           (case (vc-state file)
-             ((up-to-date needs-update) ?-)
-             (added ?@)
-             (t ?:))
+           (pcase (vc-state file)
+             ((or `up-to-date `needs-update) ?-)
+             (`added ?@)
+             (_ ?:))
            branch)))
 
-(defun vc-mtn-register (files &optional rev comment)
+(defun vc-mtn-register (files &optional _rev _comment)
   (vc-mtn-command nil 0 files "add"))
 
 (defun vc-mtn-responsible-p (file) (vc-mtn-root file))
@@ -181,7 +181,7 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
 
 (declare-function log-edit-extract-headers "log-edit" (headers string))
 
-(defun vc-mtn-checkin (files rev comment)
+(defun vc-mtn-checkin (files _rev comment)
   (apply 'vc-mtn-command nil 0 files
         (nconc (list "commit" "-m")
                (log-edit-extract-headers '(("Author" . "--author")
@@ -201,7 +201,7 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
 ;; (defun vc-mtn-rollback (files)
 ;;   )
 
-(defun vc-mtn-print-log (files buffer &optional shortlog start-revision limit)
+(defun vc-mtn-print-log (files buffer &optional _shortlog start-revision limit)
   (apply 'vc-mtn-command buffer 0 files "log"
         (append
          (when start-revision (list "--from" (format "%s" start-revision)))
@@ -304,44 +304,43 @@ If nil, use the value of `vc-diff-switches'.  If t, use no switches."
         (push (match-string 0) ids))
       ids)))
 
-(defun vc-mtn-revision-completion-table (files)
+(defun vc-mtn-revision-completion-table (_files)
   ;; TODO: Implement completion for selectors
   ;; TODO: Implement completion for composite selectors.
-  (lexical-let ((files files))
-    ;; What about using `files'?!?  --Stef
-    (lambda (string pred action)
-      (cond
-       ;; "Tag" selectors.
-       ((string-match "\\`t:" string)
-        (complete-with-action action
-                              (mapcar (lambda (tag) (concat "t:" tag))
-                                      (vc-mtn-list-tags))
-                              string pred))
-       ;; "Branch" selectors.
-       ((string-match "\\`b:" string)
-        (complete-with-action action
-                              (mapcar (lambda (tag) (concat "b:" tag))
-                                      (vc-mtn-list-branches))
-                              string pred))
-       ;; "Head" selectors.  Not sure how they differ from "branch" selectors.
-       ((string-match "\\`h:" string)
-        (complete-with-action action
-                              (mapcar (lambda (tag) (concat "h:" tag))
-                                      (vc-mtn-list-branches))
-                              string pred))
-       ;; "ID" selectors.
-       ((string-match "\\`i:" string)
-        (complete-with-action action
-                              (mapcar (lambda (tag) (concat "i:" tag))
-                                      (vc-mtn-list-revision-ids
-                                       (substring string (match-end 0))))
-                              string pred))
-       (t
-        (complete-with-action action
-                              '("t:" "b:" "h:" "i:"
-                                ;; Completion not implemented for these.
-                                "a:" "c:" "d:" "e:" "l:")
-                              string pred))))))
+  ;; What about using `files'?!?  --Stef
+  (lambda (string pred action)
+    (cond
+     ;; "Tag" selectors.
+     ((string-match "\\`t:" string)
+      (complete-with-action action
+                            (mapcar (lambda (tag) (concat "t:" tag))
+                                    (vc-mtn-list-tags))
+                            string pred))
+     ;; "Branch" selectors.
+     ((string-match "\\`b:" string)
+      (complete-with-action action
+                            (mapcar (lambda (tag) (concat "b:" tag))
+                                    (vc-mtn-list-branches))
+                            string pred))
+     ;; "Head" selectors.  Not sure how they differ from "branch" selectors.
+     ((string-match "\\`h:" string)
+      (complete-with-action action
+                            (mapcar (lambda (tag) (concat "h:" tag))
+                                    (vc-mtn-list-branches))
+                            string pred))
+     ;; "ID" selectors.
+     ((string-match "\\`i:" string)
+      (complete-with-action action
+                            (mapcar (lambda (tag) (concat "i:" tag))
+                                    (vc-mtn-list-revision-ids
+                                     (substring string (match-end 0))))
+                            string pred))
+     (t
+      (complete-with-action action
+                            '("t:" "b:" "h:" "i:"
+                              ;; Completion not implemented for these.
+                              "a:" "c:" "d:" "e:" "l:")
+                            string pred)))))
 
 
 
index 7e10372f362d5b0f78eade33e56f48bd7885e50a..ecd7b826437fbd5a34170bf9abdd55d63b0fc1e5 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-rcs.el --- support for RCS version-control
 
-;; Copyright (C) 1992-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1992-2012 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
@@ -38,7 +38,7 @@
 ;;;
 
 (eval-when-compile
-  (require 'cl)
+  (require 'cl-lib)
   (require 'vc))
 
 (defgroup vc-rcs nil
@@ -679,9 +679,9 @@ Optional arg REVISION is a revision to annotate from."
     ;; Apply reverse-chronological edits on the trunk, computing and
     ;; accumulating forward-chronological edits after some point, for
     ;; later.
-    (flet ((r/d/a () (vector pre
-                             (cdr (assq 'date meta))
-                             (cdr (assq 'author meta)))))
+    (cl-flet ((r/d/a () (vector pre
+                                (cdr (assq 'date meta))
+                                (cdr (assq 'author meta)))))
       (while (when (setq pre cur cur (cdr (assq 'next meta)))
                (not (string= "" cur)))
         (setq
@@ -705,17 +705,17 @@ Optional arg REVISION is a revision to annotate from."
           (goto-char (point-min))
           (forward-line (1- (pop insn)))
           (setq p (point))
-          (case (pop insn)
-            (k (setq s (buffer-substring-no-properties
-                        p (progn (forward-line (car insn))
-                                 (point))))
-               (when prda
-                 (push `(,p . ,(propertize s :vc-rcs-r/d/a prda)) path))
-               (delete-region p (point)))
-            (i (setq s (car insn))
-               (when prda
-                 (push `(,p . ,(length s)) path))
-               (insert s)))))
+          (pcase (pop insn)
+            (`k (setq s (buffer-substring-no-properties
+                         p (progn (forward-line (car insn))
+                                  (point))))
+                (when prda
+                  (push `(,p . ,(propertize s :vc-rcs-r/d/a prda)) path))
+                (delete-region p (point)))
+            (`i (setq s (car insn))
+                (when prda
+                  (push `(,p . ,(length s)) path))
+                (insert s)))))
       ;; For the initial revision, setting `:vc-rcs-r/d/a' directly is
       ;; equivalent to pushing an insert instruction (of the entire buffer
       ;; contents) onto `path' then erasing the buffer, but less wasteful.
@@ -737,14 +737,14 @@ Optional arg REVISION is a revision to annotate from."
                  (dolist (insn (cdr (assq :insn meta)))
                    (goto-char (point-min))
                    (forward-line (1- (pop insn)))
-                   (case (pop insn)
-                     (k (delete-region
-                         (point) (progn (forward-line (car insn))
-                                        (point))))
-                     (i (insert (propertize
-                                 (car insn)
-                                 :vc-rcs-r/d/a
-                                 (or prda (setq prda (r/d/a))))))))
+                   (pcase (pop insn)
+                     (`k (delete-region
+                          (point) (progn (forward-line (car insn))
+                                         (point))))
+                     (`i (insert (propertize
+                                  (car insn)
+                                  :vc-rcs-r/d/a
+                                  (or prda (setq prda (r/d/a))))))))
                  (prog1 (not (string= (if nbls (caar nbls) revision) pre))
                    (setq pre (cdr (assq 'next meta)))))))))
   ;; Lastly, for each line, insert at bol nicely-formatted history info.
@@ -769,16 +769,16 @@ Optional arg REVISION is a revision to annotate from."
                  ht)
         (setq maxw (max w maxw))))
     (let ((padding (make-string maxw 32)))
-      (flet ((pad (w) (substring-no-properties padding w))
-             (render (rda &rest ls)
-                     (propertize
-                      (apply 'concat
-                             (format-time-string "%Y-%m-%d" (aref rda 1))
-                             "  "
-                             (aref rda 0)
-                             ls)
-                      :vc-annotate-prefix t
-                      :vc-rcs-r/d/a rda)))
+      (cl-flet ((pad (w) (substring-no-properties padding w))
+                (render (rda &rest ls)
+                        (propertize
+                         (apply 'concat
+                                (format-time-string "%Y-%m-%d" (aref rda 1))
+                                "  "
+                                (aref rda 0)
+                                ls)
+                         :vc-annotate-prefix t
+                         :vc-rcs-r/d/a rda)))
         (maphash
          (if all-me
              (lambda (rda w)
@@ -868,6 +868,23 @@ and CVS."
          (minor-num (string-to-number (vc-rcs-minor-part rev))))
       (concat branch "." (number-to-string (1+ minor-num))))))
 
+;; Note that most GNU/Linux distributions seem to supply rcs2log in a
+;; standard bin directory.  Eg both Red Hat and Debian include it in
+;; their cvs packages.  It's not obvious why Emacs still needs to
+;; provide it as well...
+(defvar vc-rcs-rcs2log-program
+  (let (exe)
+    (cond ((file-executable-p
+            (setq exe (expand-file-name "rcs2log" exec-directory)))
+           exe)
+          ;; In the unlikely event that someone is running an
+          ;; uninstalled Emacs and wants to do something RCS-related.
+          ((file-executable-p
+            (setq exe (expand-file-name "lib-src/rcs2log" source-directory)))
+           exe)
+          (t "rcs2log")))
+  "Path to the `rcs2log' program (normally in `exec-directory').")
+
 (defun vc-rcs-update-changelog (files)
   "Default implementation of update-changelog.
 Uses `rcs2log' which only works for RCS and CVS."
@@ -898,9 +915,7 @@ Uses `rcs2log' which only works for RCS and CVS."
             (unwind-protect
                 (progn
                   (setq default-directory odefault)
-                  (if (eq 0 (apply 'call-process
-                                    (expand-file-name "rcs2log"
-                                                      exec-directory)
+                  (if (eq 0 (apply 'call-process vc-rcs-rcs2log-program
                                     nil (list t tempfile) nil
                                     "-c" changelog
                                     "-u" (concat login-name
@@ -1291,50 +1306,51 @@ The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
         ;; to "de-@@-format" the printed representation as the first step
         ;; to translating it into some value.  See internal func `gather'.
         @-holes)
-    (flet ((sw () (skip-chars-forward " \t\n")) ; i.e., `[:space:]'
-           (at (tag) (save-excursion (eq tag (read buffer))))
-           (to-eol () (buffer-substring-no-properties
-                       (point) (progn (forward-line 1)
-                                      (1- (point)))))
-           (to-semi () (setq b (point)
-                             e (progn (search-forward ";")
-                                      (1- (point)))))
-           (to-one@ () (setq @-holes nil
-                             b (progn (search-forward "@") (point))
-                             e (progn (while (and (search-forward "@")
-                                                  (= ?@ (char-after))
-                                                  (progn
-                                                    (push (point) @-holes)
-                                                    (forward-char 1)
-                                                    (push (point) @-holes))))
-                                      (1- (point)))))
-           (tok+val (set-b+e name &optional proc)
-                    (unless (eq name (setq tok (read buffer)))
-                      (error "Missing `%s' while parsing %s" name context))
-                    (sw)
-                    (funcall set-b+e)
-                    (cons tok (if proc
-                                  (funcall proc)
-                                (buffer-substring-no-properties b e))))
-           (k-semi (name &optional proc) (tok+val 'to-semi name proc))
-           (gather () (let ((pairs `(,e ,@@-holes ,b))
-                            acc)
-                        (while pairs
-                          (push (buffer-substring-no-properties
-                                 (cadr pairs) (car pairs))
-                                acc)
-                          (setq pairs (cddr pairs)))
-                        (apply 'concat acc)))
-           (k-one@ (name &optional later) (tok+val 'to-one@ name
-                                                   (if later
-                                                       (lambda () t)
-                                                     'gather))))
+    (cl-flet*
+        ((sw () (skip-chars-forward " \t\n")) ; i.e., `[:space:]'
+         (at (tag) (save-excursion (eq tag (read buffer))))
+         (to-eol () (buffer-substring-no-properties
+                     (point) (progn (forward-line 1)
+                                    (1- (point)))))
+         (to-semi () (setq b (point)
+                           e (progn (search-forward ";")
+                                    (1- (point)))))
+         (to-one@ () (setq @-holes nil
+                           b (progn (search-forward "@") (point))
+                           e (progn (while (and (search-forward "@")
+                                                (= ?@ (char-after))
+                                                (progn
+                                                  (push (point) @-holes)
+                                                  (forward-char 1)
+                                                  (push (point) @-holes))))
+                                    (1- (point)))))
+         (tok+val (set-b+e name &optional proc)
+                  (unless (eq name (setq tok (read buffer)))
+                    (error "Missing `%s' while parsing %s" name context))
+                  (sw)
+                  (funcall set-b+e)
+                  (cons tok (if proc
+                                (funcall proc)
+                              (buffer-substring-no-properties b e))))
+         (k-semi (name &optional proc) (tok+val #'to-semi name proc))
+         (gather () (let ((pairs `(,e ,@@-holes ,b))
+                          acc)
+                      (while pairs
+                        (push (buffer-substring-no-properties
+                               (cadr pairs) (car pairs))
+                              acc)
+                        (setq pairs (cddr pairs)))
+                      (apply 'concat acc)))
+         (k-one@ (name &optional later) (tok+val #'to-one@ name
+                                                 (if later
+                                                     (lambda () t)
+                                                   #'gather))))
       (save-excursion
         (goto-char (point-min))
         ;; headers
         (setq context 'headers)
-        (flet ((hpush (name &optional proc)
-                      (push (k-semi name proc) headers)))
+        (cl-flet ((hpush (name &optional proc)
+                         (push (k-semi name proc) headers)))
           (hpush 'head)
           (when (at 'branch)
             (hpush 'branch))
@@ -1376,7 +1392,7 @@ The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
                                (when (< (car ls) 100)
                                  (setcar ls (+ 1900 (car ls))))
                                (apply 'encode-time (nreverse ls)))))
-                  ,@(mapcar 'k-semi '(author state))
+                  ,@(mapcar #'k-semi '(author state))
                   ,(k-semi 'branches
                            (lambda ()
                              (split-string
@@ -1406,16 +1422,17 @@ The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
               ;; only the former since it behaves identically to the
               ;; latter in the absence of "@@".)
               sub)
-          (flet ((incg (beg end) (let ((b beg) (e end) @-holes)
-                                   (while (and asc (< (car asc) e))
-                                     (push (pop asc) @-holes))
-                                   ;; Self-deprecate when work is done.
-                                   ;; Folding many dimensions into one.
-                                   ;; Thanks B.Mandelbrot, for complex sum.
-                                   ;; O beauteous math! --the Unvexed Bum
-                                   (unless asc
-                                     (setq sub 'buffer-substring-no-properties))
-                                   (gather))))
+          (cl-flet ((incg (beg end)
+                          (let ((b beg) (e end) @-holes)
+                            (while (and asc (< (car asc) e))
+                              (push (pop asc) @-holes))
+                            ;; Self-deprecate when work is done.
+                            ;; Folding many dimensions into one.
+                            ;; Thanks B.Mandelbrot, for complex sum.
+                            ;; O beauteous math! --the Unvexed Bum
+                            (unless asc
+                              (setq sub #'buffer-substring-no-properties))
+                            (gather))))
             (while (and (sw)
                         (not (eobp))
                         (setq context (to-eol)
@@ -1434,8 +1451,8 @@ The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
                   (setcdr (cadr rev) (gather))
                 (if @-holes
                     (setq asc (nreverse @-holes)
-                          sub 'incg)
-                  (setq sub 'buffer-substring-no-properties))
+                          sub #'incg)
+                  (setq sub #'buffer-substring-no-properties))
                 (goto-char b)
                 (setq acc nil)
                 (while (< (point) e)
@@ -1444,7 +1461,7 @@ The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
                         start (read (current-buffer))
                         act (read (current-buffer)))
                   (forward-char 1)
-                  (push (case cmd
+                  (push (pcase cmd
                           (?d
                            ;; `d' means "delete lines".
                            ;; For Emacs spirit, we use `k' for "kill".
@@ -1458,7 +1475,7 @@ The `:insn' key is a keyword to distinguish it as a vc-rcs.el extension."
                            `(,(1+ start) i
                              ,(funcall sub (point) (progn (forward-line act)
                                                           (point)))))
-                          (t (error "Bad command `%c' in `text' for rev `%s'"
+                          (_ (error "Bad command `%c' in `text' for rev `%s'"
                                     cmd context)))
                         acc))
                 (goto-char (1+ e))
index 0df307eda85f6a9d5e056e47593ce02fce812898..a34222f72369239de626f4e9f25ba705757c6d88 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-sccs.el --- support for SCCS version-control
 
-;; Copyright (C) 1992-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1992-2012 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 
 ;;; Commentary:
 
-;; Proper function of the SCCS diff commands requires the shellscript vcdiff
-;; to be installed somewhere on Emacs's path for executables.
-;;
-
 ;;; Code:
 
 (eval-when-compile
 ;;;
 
 ;; ;; Maybe a better solution is to not use "get" but "sccs get".
-;; (defcustom vc-sccs-path
-;;   (let ((path ()))
-;;     (dolist (dir '("/usr/sccs" "/usr/lib/sccs" "/usr/libexec/sccs"))
-;;       (if (file-directory-p dir)
-;;           (push dir path)))
-;;     path)
-;;   "List of extra directories to search for SCCS commands."
-;;   :type '(repeat directory)
-;;   :group 'vc)
+;; ;; Note for GNU CSSC, you can parse sccs -V to get the libexec path.
+;;  (defcustom vc-sccs-path
+;;    (prune-directory-list '("/usr/ccs/bin" "/usr/sccs" "/usr/lib/sccs"
+;;                        "/usr/libexec/sccs"))
+;;    "List of extra directories to search for SCCS commands."
+;;    :type '(repeat directory)
+;;    :group 'vc)
 
 (defgroup vc-sccs nil
   "VC SCCS backend."
@@ -186,11 +180,24 @@ For a description of possible values, see `vc-check-master-templates'."
     (vc-insert-file (vc-name file) "^\001e\n\001[^s]")
     (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)))
 
+;; Cf vc-sccs-find-revision.
+(defun vc-sccs-write-revision (file outfile &optional rev)
+  "Write the SCCS version of input file FILE to output file OUTFILE.
+Optional string REV is a revision."
+  (with-temp-buffer
+    (apply 'vc-sccs-do-command t 0 "get" (vc-name file)
+          (append '("-s" "-p" "-k") ; -k: no keyword expansion
+                  (if rev (list (concat "-r" rev)))))
+    (write-region nil nil outfile nil 'silent)))
+
 (defun vc-sccs-workfile-unchanged-p (file)
   "SCCS-specific implementation of `vc-workfile-unchanged-p'."
-  (zerop (apply 'vc-do-command "*vc*" 1 "vcdiff" (vc-name file)
-                (list "--brief" "-q"
-                      (concat "-r" (vc-working-revision file))))))
+  (let ((tempfile (make-temp-file "vc-sccs")))
+    (unwind-protect
+       (progn
+         (vc-sccs-write-revision file tempfile (vc-working-revision file))
+         (zerop (vc-do-command "*vc*" 1 "cmp" file tempfile)))
+      (delete-file tempfile))))
 
 \f
 ;;;
@@ -346,17 +353,75 @@ revert all subfiles."
   (vc-sccs-do-command buffer 0 "prs" (mapcar 'vc-name files))
   (when limit 'limit-unsupported))
 
+;; FIXME use sccsdiff if present?
 (defun vc-sccs-diff (files &optional oldvers newvers buffer)
   "Get a difference report using SCCS between two filesets."
   (setq files (vc-expand-dirs files))
   (setq oldvers (vc-sccs-lookup-triple (car files) oldvers))
   (setq newvers (vc-sccs-lookup-triple (car files) newvers))
-  (apply 'vc-do-command (or buffer "*vc-diff*")
-        1 "vcdiff" (mapcar 'vc-name (vc-expand-dirs files))
-         (append (list "-q"
-                       (and oldvers (concat "-r" oldvers))
-                       (and newvers (concat "-r" newvers)))
-                 (vc-switches 'SCCS 'diff))))
+  (or buffer (setq buffer "*vc-diff*"))
+  ;; We have to reimplement pieces of vc-do-command, because
+  ;; we want to run multiple external commands, and only do the setup
+  ;; and exit pieces once.
+  (save-current-buffer
+    (unless (or (eq buffer t)
+               (and (stringp buffer) (string= (buffer-name) buffer))
+               (eq buffer (current-buffer)))
+      (vc-setup-buffer buffer))
+    (let* ((fake-flags (append (vc-switches 'SCCS 'diff)
+                              (if oldvers (list (concat " -r" oldvers)))
+                              (if newvers (list (concat " -r" newvers)))))
+          (fake-command
+           (format "diff%s %s"
+                   (if fake-flags
+                       (concat " " (mapconcat 'identity fake-flags " "))
+                     "")
+                   (vc-delistify files)))
+          (status 0)
+          (oldproc (get-buffer-process (current-buffer))))
+    (when vc-command-messages
+      (message "Running %s in foreground..." fake-command))
+    (if oldproc (delete-process oldproc))
+    (dolist (file files)
+      (let ((oldfile (make-temp-file "vc-sccs"))
+           newfile)
+       (unwind-protect
+           (progn
+             (vc-sccs-write-revision file oldfile oldvers)
+             (if newvers
+                 (vc-sccs-write-revision file (setq newfile
+                                                    (make-temp-file "vc-sccs"))
+                                         newvers))
+             (let* ((inhibit-read-only t)
+                    (buffer-undo-list t)
+                    (process-environment
+                     (cons "LC_MESSAGES=C" process-environment))
+                    (w32-quote-process-args t)
+                    (this-status
+                     (apply 'process-file "diff" nil t nil
+                            (append (vc-switches 'SCCS 'diff)
+                                    (list oldfile
+                                          (or newfile
+                                              (file-relative-name file)))))))
+               (or (integerp this-status) (setq status 'error))
+               (and (integerp status)
+                    (> this-status status)
+                    (setq status this-status))))
+         (delete-file oldfile)
+         (if newfile (delete-file newfile)))))
+    (when (or (not (integerp status)) (> status 1))
+      (unless (eq ?\s (aref (buffer-name (current-buffer)) 0))
+       (pop-to-buffer (current-buffer))
+       (goto-char (point-min))
+       (shrink-window-if-larger-than-buffer))
+      (error "Running %s...FAILED (%s)" fake-command
+            (if (integerp status) (format "status %d" status) status)))
+    (when vc-command-messages
+      (message "Running %s...OK = %d" fake-command status))
+    ;; Should we pretend we ran sccsdiff instead?
+    ;; This might not actually be a valid diff command.
+    (run-hook-with-args 'vc-post-command-functions "diff" files fake-flags)
+    status)))
 
 \f
 ;;;
index 4cbbf47c2d673258037772447427611c579e98e5..0f3298d2686b1251066ee37e93138b92e17044e4 100644 (file)
@@ -1,6 +1,6 @@
-;;; vc.el --- drive a version-control system from within Emacs
+;;; vc.el --- drive a version-control system from within Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-1998, 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 1992-1998, 2000-2012 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see below for full credits)
 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
 (require 'vc-dispatcher)
 (require 'ediff)
 
+(declare-function diff-setup-whitespace "diff-mode" ())
+
 (eval-when-compile
-  (require 'cl)
   (require 'dired))
 
 (unless (assoc 'vc-parent-buffer minor-mode-alist)
 ;; General customization
 
 (defgroup vc nil
-  "Version-control system in Emacs."
+  "Emacs interface to version control systems."
   :group 'tools)
 
 (defcustom vc-initial-comment nil
@@ -847,7 +848,7 @@ been updated to their corresponding values."
        (if (file-directory-p file)
           (dolist (buffer (buffer-list))
             (let ((fname (buffer-file-name buffer)))
-              (when (and fname (vc-string-prefix-p file fname))
+              (when (and fname (string-prefix-p file fname))
                 (push fname flist))))
         (push file flist)))
      ,form
@@ -900,7 +901,7 @@ use."
               (lambda (arg)
                 (message "arg %s" arg)
                 (and (file-directory-p arg)
-                     (vc-string-prefix-p (expand-file-name arg) def-dir)))))))
+                     (string-prefix-p (expand-file-name arg) def-dir)))))))
           (let ((default-directory repo-dir))
        (vc-call-backend bk 'create-repo))
       (throw 'found bk))))
@@ -934,11 +935,13 @@ Within directories, only files already under version control are noticed."
 
 (defvar vc-dir-backend)
 (defvar log-view-vc-backend)
+(defvar log-edit-vc-backend)
 (defvar diff-vc-backend)
 
 (defun vc-deduce-backend ()
   (cond ((derived-mode-p 'vc-dir-mode)   vc-dir-backend)
        ((derived-mode-p 'log-view-mode) log-view-vc-backend)
+       ((derived-mode-p 'log-edit-mode) log-edit-vc-backend)
        ((derived-mode-p 'diff-mode)     diff-vc-backend)
         ;; Maybe we could even use comint-mode rather than shell-mode?
        ((derived-mode-p 'dired-mode 'shell-mode 'compilation-mode)
@@ -1073,7 +1076,7 @@ For old-style locking-based version control systems, like RCS:
   (let* ((vc-fileset (vc-deduce-fileset nil t 'state-model-only-files))
          (backend (car vc-fileset))
         (files (nth 1 vc-fileset))
-         (fileset-only-files (nth 2 vc-fileset))
+         ;; (fileset-only-files (nth 2 vc-fileset))
          ;; FIXME: We used to call `vc-recompute-state' here.
          (state (nth 3 vc-fileset))
          ;; The backend should check that the checkout-model is consistent
@@ -1408,34 +1411,32 @@ that the version control system supports this mode of operation.
 Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
   (when vc-before-checkin-hook
     (run-hooks 'vc-before-checkin-hook))
-  (lexical-let
-   ((backend backend))
-   (vc-start-logentry
-    files comment initial-contents
-    "Enter a change comment."
-    "*vc-log*"
-    (lambda ()
-      (vc-call-backend backend 'log-edit-mode))
-    (lexical-let ((rev rev))
-      (lambda (files comment)
-        (message "Checking in %s..." (vc-delistify files))
-        ;; "This log message intentionally left almost blank".
-        ;; RCS 5.7 gripes about white-space-only comments too.
-        (or (and comment (string-match "[^\t\n ]" comment))
-            (setq comment "*** empty log message ***"))
-        (with-vc-properties
-            files
-          ;; We used to change buffers to get local value of
-          ;; vc-checkin-switches, but 'the' local buffer is
-          ;; not a well-defined concept for filesets.
-          (progn
-            (vc-call-backend backend 'checkin files rev comment)
-            (mapc 'vc-delete-automatic-version-backups files))
-          `((vc-state . up-to-date)
-            (vc-checkout-time . ,(nth 5 (file-attributes file)))
-            (vc-working-revision . nil)))
-        (message "Checking in %s...done" (vc-delistify files))))
-    'vc-checkin-hook)))
+  (vc-start-logentry
+   files comment initial-contents
+   "Enter a change comment."
+   "*vc-log*"
+   (lambda ()
+     (vc-call-backend backend 'log-edit-mode))
+   (lambda (files comment)
+     (message "Checking in %s..." (vc-delistify files))
+     ;; "This log message intentionally left almost blank".
+     ;; RCS 5.7 gripes about white-space-only comments too.
+     (or (and comment (string-match "[^\t\n ]" comment))
+         (setq comment "*** empty log message ***"))
+     (with-vc-properties
+         files
+       ;; We used to change buffers to get local value of
+       ;; vc-checkin-switches, but 'the' local buffer is
+       ;; not a well-defined concept for filesets.
+       (progn
+         (vc-call-backend backend 'checkin files rev comment)
+         (mapc 'vc-delete-automatic-version-backups files))
+       `((vc-state . up-to-date)
+         (vc-checkout-time . ,(nth 5 (file-attributes file)))
+         (vc-working-revision . nil)))
+     (message "Checking in %s...done" (vc-delistify files)))
+   'vc-checkin-hook
+   backend))
 
 ;;; Additional entry points for examining version histories
 
@@ -1524,17 +1525,18 @@ to override the value of `vc-diff-switches' and `diff-switches'."
   ;; possibility of an empty output is for an async process.
   (when (buffer-live-p buffer)
     (let ((window (get-buffer-window buffer t))
-          (emptyp (zerop (buffer-size buffer))))
+         (emptyp (zerop (buffer-size buffer))))
       (with-current-buffer buffer
-        (and messages emptyp
-             (let ((inhibit-read-only t))
-               (insert (cdr messages) ".\n")
-               (message "%s" (cdr messages))))
-        (goto-char (point-min))
-        (when window
-          (shrink-window-if-larger-than-buffer window)))
+       (and messages emptyp
+            (let ((inhibit-read-only t))
+              (insert (cdr messages) ".\n")
+              (message "%s" (cdr messages))))
+       (diff-setup-whitespace)
+       (goto-char (point-min))
+       (when window
+         (shrink-window-if-larger-than-buffer window)))
       (when (and messages (not emptyp))
-        (message "%sdone" (car messages))))))
+       (message "%sdone" (car messages))))))
 
 (defvar vc-diff-added-files nil
   "If non-nil, diff added files by comparing them to /dev/null.")
@@ -1668,7 +1670,7 @@ Return t if the buffer had changes, nil otherwise."
       (list files rev1 rev2))))
 
 ;;;###autoload
-(defun vc-version-diff (files rev1 rev2)
+(defun vc-version-diff (_files rev1 rev2)
   "Report diffs between revisions of the fileset in the repository history."
   (interactive (vc-diff-build-argument-list-internal))
   ;; All that was just so we could do argument completion!
@@ -1680,7 +1682,7 @@ Return t if the buffer had changes, nil otherwise."
                    (called-interactively-p 'interactive)))
 
 ;;;###autoload
-(defun vc-diff (historic &optional not-urgent)
+(defun vc-diff (&optional historic not-urgent)
   "Display diffs between file revisions.
 Normally this compares the currently selected fileset with their
 working revisions.  With a prefix argument HISTORIC, it reads two revision
@@ -1880,11 +1882,9 @@ The headers are reset to their non-expanded form."
      "Enter a replacement change comment."
      "*vc-log*"
      (lambda () (vc-call-backend backend 'log-edit-mode))
-     (lexical-let ((rev rev)
-                   (backend backend))
-       (lambda (files comment)
-         (vc-call-backend backend
-                          'modify-change-comment files rev comment))))))
+     (lambda (files comment)
+       (vc-call-backend backend
+                        'modify-change-comment files rev comment)))))
 
 ;;;###autoload
 (defun vc-merge ()
@@ -1949,7 +1949,7 @@ changes from the current branch."
       (error "Sorry, merging is not implemented for %s" backend)))))
 
 
-(defun vc-maybe-resolve-conflicts (file status &optional name-A name-B)
+(defun vc-maybe-resolve-conflicts (file status &optional _name-A _name-B)
   (vc-resynch-buffer file t (not (buffer-modified-p)))
   (if (zerop status) (message "Merge successful")
     (smerge-mode 1)
@@ -2074,22 +2074,20 @@ Not all VC backends support short logs!")
   (when (and limit (not (eq 'limit-unsupported pl-return))
             (not is-start-revision))
     (goto-char (point-max))
-    (lexical-let ((working-revision working-revision)
-                 (limit limit))
-      (insert "\n")
-      (insert-text-button "Show 2X entries"
-                         'action (lambda (&rest ignore)
-                                   (vc-print-log-internal
-                                    log-view-vc-backend log-view-vc-fileset
-                                    working-revision nil (* 2 limit)))
-                         'help-echo "Show the log again, and double the number of log entries shown")
-      (insert "    ")
-      (insert-text-button "Show unlimited entries"
-                         'action (lambda (&rest ignore)
-                                   (vc-print-log-internal
-                                    log-view-vc-backend log-view-vc-fileset
-                                    working-revision nil nil))
-                         'help-echo "Show the log again, including all entries"))))
+    (insert "\n")
+    (insert-text-button "Show 2X entries"
+                        'action (lambda (&rest _ignore)
+                                  (vc-print-log-internal
+                                   log-view-vc-backend log-view-vc-fileset
+                                   working-revision nil (* 2 limit)))
+                        'help-echo "Show the log again, and double the number of log entries shown")
+    (insert "    ")
+    (insert-text-button "Show unlimited entries"
+                        'action (lambda (&rest _ignore)
+                                  (vc-print-log-internal
+                                   log-view-vc-backend log-view-vc-fileset
+                                   working-revision nil nil))
+                        'help-echo "Show the log again, including all entries")))
 
 (defun vc-print-log-internal (backend files working-revision
                                       &optional is-start-revision limit)
@@ -2099,8 +2097,7 @@ Not all VC backends support short logs!")
   (let ((dir-present nil)
        (vc-short-log nil)
        (buffer-name "*vc-change-log*")
-       type
-       pl-return)
+       type)
     (dolist (file files)
       (when (file-directory-p file)
        (setq dir-present t)))
@@ -2109,25 +2106,20 @@ Not all VC backends support short logs!")
                         (memq 'directory vc-log-short-style)
                       (memq 'file vc-log-short-style)))))
     (setq type (if vc-short-log 'short 'long))
-    (lexical-let
-       ((working-revision working-revision)
-        (backend backend)
-        (limit limit)
-        (shortlog vc-short-log)
-        (files files)
-        (is-start-revision is-start-revision))
+    (let ((shortlog vc-short-log))
       (vc-log-internal-common
        backend buffer-name files type
-       (lambda (bk buf type-arg files-arg)
-        (vc-call-backend bk 'print-log files-arg buf
-                         shortlog (when is-start-revision working-revision) limit))
-       (lambda (bk files-arg ret)
+       (lambda (bk buf _type-arg files-arg)
+        (vc-call-backend bk 'print-log files-arg buf shortlog
+                          (when is-start-revision working-revision) limit))
+       (lambda (_bk _files-arg ret)
         (vc-print-log-setup-buttons working-revision
                                     is-start-revision limit ret))
        (lambda (bk)
         (vc-call-backend bk 'show-log-entry working-revision))
-       (lambda (ignore-auto noconfirm)
-        (vc-print-log-internal backend files working-revision is-start-revision limit))))))
+       (lambda (_ignore-auto _noconfirm)
+        (vc-print-log-internal backend files working-revision
+                                is-start-revision limit))))))
 
 (defvar vc-log-view-type nil
   "Set this to differentiate the different types of logs.")
@@ -2165,20 +2157,12 @@ Not all VC backends support short logs!")
 (defun vc-incoming-outgoing-internal (backend remote-location buffer-name type)
   (vc-log-internal-common
    backend buffer-name nil type
-   (lexical-let
-       ((remote-location remote-location))
-     (lambda (bk buf type-arg files)
-       (vc-call-backend bk type-arg buf remote-location)))
-   (lambda (bk files-arg ret))
-   (lambda (bk)
-     (goto-char (point-min)))
-   (lexical-let
-    ((backend backend)
-     (remote-location remote-location)
-     (buffer-name buffer-name)
-     (type type))
-    (lambda (ignore-auto noconfirm)
-      (vc-incoming-outgoing-internal backend remote-location buffer-name type)))))
+   (lambda (bk buf type-arg _files)
+     (vc-call-backend bk type-arg buf remote-location))
+   (lambda (_bk _files-arg _ret) nil)
+   (lambda (_bk) (goto-char (point-min)))
+   (lambda (_ignore-auto _noconfirm)
+     (vc-incoming-outgoing-internal backend remote-location buffer-name type))))
 
 ;;;###autoload
 (defun vc-print-log (&optional working-revision limit)
@@ -2243,11 +2227,11 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION.."
   (interactive
    (when current-prefix-arg
      (list (read-string "Remote location (empty for default): "))))
-  (let ((backend (vc-deduce-backend))
-       rootdir working-revision)
+  (let ((backend (vc-deduce-backend)))
     (unless backend
       (error "Buffer is not version controlled"))
-    (vc-incoming-outgoing-internal backend remote-location "*vc-incoming*" 'log-incoming)))
+    (vc-incoming-outgoing-internal backend remote-location "*vc-incoming*"
+                                   'log-incoming)))
 
 ;;;###autoload
 (defun vc-log-outgoing (&optional remote-location)
@@ -2256,11 +2240,11 @@ When called interactively with a prefix argument, prompt for REMOTE-LOCATION."
   (interactive
    (when current-prefix-arg
      (list (read-string "Remote location (empty for default): "))))
-  (let ((backend (vc-deduce-backend))
-       rootdir working-revision)
+  (let ((backend (vc-deduce-backend)))
     (unless backend
       (error "Buffer is not version controlled"))
-    (vc-incoming-outgoing-internal backend remote-location "*vc-outgoing*" 'log-outgoing)))
+    (vc-incoming-outgoing-internal backend remote-location "*vc-outgoing*"
+                                   'log-outgoing)))
 
 ;;;###autoload
 (defun vc-revert ()
@@ -2303,7 +2287,7 @@ to the working revision (except for keyword expansion)."
                                       (if (= nfiles 1) "" "s"))))))
            (error "Revert canceled")))
       (when diff-buffer
-       (quit-windows-on diff-buffer t)))
+       (quit-windows-on diff-buffer)))
     (dolist (file files)
       (message "Reverting %s..." (vc-delistify files))
       (vc-revert-file file)
@@ -2349,7 +2333,7 @@ depending on the underlying version-control system."
     ;; Display changes
     (unless (yes-or-no-p "Discard these revisions? ")
       (error "Rollback canceled"))
-    (quit-windows-on "*vc-diff*" t)
+    (quit-windows-on "*vc-diff*")
     ;; Do the actual reversions
     (message "Rolling back %s..." (vc-delistify files))
     (with-vc-properties
@@ -2685,23 +2669,23 @@ log entries should be gathered."
     (when index
       (substring rev 0 index))))
 
-(defun vc-default-responsible-p (backend file)
+(defun vc-default-responsible-p (_backend _file)
   "Indicate whether BACKEND is responsible for FILE.
 The default is to return nil always."
   nil)
 
-(defun vc-default-could-register (backend file)
+(defun vc-default-could-register (_backend _file)
   "Return non-nil if BACKEND could be used to register FILE.
 The default implementation returns t for all files."
   t)
 
-(defun vc-default-latest-on-branch-p (backend file)
+(defun vc-default-latest-on-branch-p (_backend _file)
   "Return non-nil if FILE is the latest on its branch.
 This default implementation always returns non-nil, which means that
 editing non-current revisions is not supported by default."
   t)
 
-(defun vc-default-init-revision (backend) vc-default-init-revision)
+(defun vc-default-init-revision (_backend) vc-default-init-revision)
 
 (defun vc-default-find-revision (backend file rev buffer)
   "Provide the new `find-revision' op based on the old `checkout' op.
@@ -2715,7 +2699,7 @@ to provide the `find-revision' operation instead."
            (insert-file-contents-literally tmpfile)))
       (delete-file tmpfile))))
 
-(defun vc-default-rename-file (backend old new)
+(defun vc-default-rename-file (_backend old new)
   (condition-case nil
       (add-name-to-file old new)
     (error (rename-file old new)))
@@ -2727,11 +2711,11 @@ to provide the `find-revision' operation instead."
 
 (declare-function log-edit-mode "log-edit" ())
 
-(defun vc-default-log-edit-mode (backend) (log-edit-mode))
+(defun vc-default-log-edit-mode (_backend) (log-edit-mode))
 
-(defun vc-default-log-view-mode (backend) (log-view-mode))
+(defun vc-default-log-view-mode (_backend) (log-view-mode))
 
-(defun vc-default-show-log-entry (backend rev)
+(defun vc-default-show-log-entry (_backend rev)
   (with-no-warnings
    (log-view-goto-rev rev)))
 
@@ -2797,7 +2781,7 @@ to provide the `find-revision' operation instead."
 (defalias 'vc-default-revision-completion-table 'ignore)
 (defalias 'vc-default-mark-resolved 'ignore)
 
-(defun vc-default-dir-status-files (backend dir files default-state update-function)
+(defun vc-default-dir-status-files (_backend _dir files default-state update-function)
   (funcall update-function
            (mapcar (lambda (file) (list file default-state)) files)))
 
@@ -2809,11 +2793,7 @@ to provide the `find-revision' operation instead."
 \f
 
 ;; These things should probably be generally available
-
-(defun vc-string-prefix-p (prefix string)
-  (let ((lpref (length prefix)))
-    (and (>= (length string) lpref)
-        (eq t (compare-strings prefix nil nil string nil lpref)))))
+(define-obsolete-function-alias 'vc-string-prefix-p 'string-prefix-p "24.2")
 
 (defun vc-file-tree-walk (dirname func &rest args)
   "Walk recursively through DIRNAME.
index 95928ebe87a1fdf6bec7fa4621a374eb9819065a..19cb7a9df8d43a447284c1f861bb130bd4e2b4be 100644 (file)
@@ -656,12 +656,13 @@ another window.  With LEAVE-W, use the current `vcursor-window'."
       (or window-system
          (display-color-p)
          (overlay-put vcursor-overlay 'before-string vcursor-string))
-      (overlay-put vcursor-overlay 'face 'vcursor))
+      (overlay-put vcursor-overlay 'face 'vcursor)
+      ;; 200 is purely an arbitrary "high" number.  See bug#9663.
+      (overlay-put vcursor-overlay 'priority 200))
     (or leave-w (vcursor-find-window nil t))
     ;; vcursor-window now contains the right buffer
     (or (pos-visible-in-window-p pt vcursor-window)
-       (set-window-point vcursor-window pt)))
-  )
+       (set-window-point vcursor-window pt))))
 
 (defun vcursor-insert (text)
   "Insert TEXT, respecting `vcursor-interpret-input'."
index bd30f0f81b8ca642e8772d16e0ebb089ff125b6f..e63c51d0d26a2dd52bcc8442e61cc94b2ea3d5ed 100644 (file)
 
 ;;; Commentary:
 
-;; This file is loaded uncompiled when dumping Emacs.
-;; Doc-strings should adhere to the conventions of make-docfile.
-
 ;;; Code:
 
-(defconst emacs-major-version (progn (string-match "^[0-9]+" emacs-version) (string-to-number (match-string 0 emacs-version))) "\
-Major version number of this version of Emacs.
+(defconst emacs-major-version
+  (progn (string-match "^[0-9]+" emacs-version)
+         (string-to-number (match-string 0 emacs-version)))
+  "Major version number of this version of Emacs.
 This variable first existed in version 19.23.")
 
-(defconst emacs-minor-version (progn (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version) (string-to-number (match-string 1 emacs-version))) "\
-Minor version number of this version of Emacs.
+(defconst emacs-minor-version
+  (progn (string-match "^[0-9]+\\.\\([0-9]+\\)" emacs-version)
+         (string-to-number (match-string 1 emacs-version)))
+  "Minor version number of this version of Emacs.
 This variable first existed in version 19.23.")
 
-(defconst emacs-build-time (current-time) "\
-Time at which Emacs was dumped out.")
+(defconst emacs-build-time (current-time)
+  "Time at which Emacs was dumped out.")
+
+(defconst emacs-build-system (system-name)
+  "Name of the system on which Emacs was built.")
 
-(defconst emacs-build-system (system-name) "\
-Name of the system on which Emacs was built.")
+(defvar motif-version-string)
+(defvar gtk-version-string)
+(defvar ns-version-string)
 
-(defun emacs-version (&optional here) "\
-Return string describing the version of Emacs that is running.
+(defun emacs-version (&optional here)
+  "Return string describing the version of Emacs that is running.
 If optional argument HERE is non-nil, insert string at point.
 Don't use this function in programs to choose actions according
 to the system configuration; look at `system-configuration' instead."
@@ -79,14 +84,46 @@ to the system configuration; look at `system-configuration' instead."
 ;; We hope that this alias is easier for people to find.
 (defalias 'version 'emacs-version)
 
+;; Set during dumping, this is a defvar so that it can be setq'd.
+(defvar emacs-bzr-version nil
+  "String giving the bzr revision from which this Emacs was built.
+Value is the bzr revision number and a revision ID separated by a blank.
+Value is nil if Emacs was not built from a bzr checkout, or if we could
+not determine the revision.")
+
+(defun emacs-bzr-get-version (&optional dir)
+  "Try to return as a string the bzr revision number of the Emacs sources.
+Value is the bzr revision number and a revision ID separated by a blank.
+Value is nil if the sources do not seem to be under bzr, or if we could
+not determine the revision.  Note that this reports on the current state
+of the sources, which may not correspond to the running Emacs.
+
+Optional argument DIR is a directory to use instead of `source-directory'."
+  (or dir (setq dir source-directory))
+  (when (file-directory-p (setq dir (expand-file-name ".bzr/branch" dir)))
+    (let (file loc)
+      (cond ((file-readable-p
+              (setq file (expand-file-name "last-revision" dir)))
+             (with-temp-buffer
+               (insert-file-contents file)
+               (goto-char (point-max))
+               (if (looking-back "\n")
+                   (delete-char -1))
+               (buffer-string)))
+            ;; OK, no last-revision.  Is it a lightweight checkout?
+            ((file-readable-p
+              (setq file (expand-file-name "location" dir)))
+             ;; If the parent branch is local, try looking there for the revid.
+             (if (setq loc (with-temp-buffer
+                             (insert-file-contents file)
+                             (if (looking-at "file://\\(.*\\)")
+                                 (match-string 1))))
+                 (emacs-bzr-get-version loc)))
+            ;; Could fall back to eg `bzr testament' at this point.
+            ))))
+
 ;; We put version info into the executable in the form that `ident' uses.
-(or (eq system-type 'windows-nt)
-    (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version))
-                     " $\n")))
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; End:
+(purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version))
+                 " $\n"))
 
 ;;; version.el ends here
index aff2df3dc77c64381e5ab017f9149618dd5e030a..1769ee73be576d5f01c9fa01ff975124be4373a5 100644 (file)
@@ -192,24 +192,6 @@ You should set this to t when using a non-system shell.\n\n"))))
                     (w32-get-locale-info locale)
                     (w32-get-locale-info locale t))))))
 
-;; Setup Info-default-directory-list to include the info directory
-;; near where Emacs executable was installed.  We used to set INFOPATH,
-;; but when this is set Info-default-directory-list is ignored.  We
-;; also cannot rely upon what is set in paths.el because they assume
-;; that configuration during build time is correct for runtime.
-(defun w32-init-info ()
-  (let* ((instdir (file-name-directory invocation-directory))
-        (dir1 (expand-file-name "../info/" instdir))
-        (dir2 (expand-file-name "../../../info/" instdir)))
-    (if (file-exists-p dir1)
-       (setq Info-default-directory-list
-             (append Info-default-directory-list (list dir1)))
-      (if (file-exists-p dir2)
-         (setq Info-default-directory-list
-               (append Info-default-directory-list (list dir2)))))))
-
-(add-hook 'before-init-hook 'w32-init-info)
-
 ;; The variable source-directory is used to initialize Info-directory-list.
 ;; However, the common case is that Emacs is being used from a binary
 ;; distribution, and the value of source-directory is meaningless in that
index fe5b4ef7b79d145cb4b8b7ed2d3ea22bc5ebd9da..d5ce0beccbb901a229a68ed40bc1c2ad95be7730 100644 (file)
@@ -75,7 +75,6 @@
 
 (defvar dired-backup-overwrite) ; Only in Emacs 20.x this is a custom var
 
-(eval-when-compile (require 'cl))
 (require 'dired)
 (autoload 'dired-do-create-files-regexp "dired-aux")
 
@@ -184,8 +183,8 @@ program `dired-chmod-program', which must exist."
 
 
 (defun wdired-mode ()
-  "\\<wdired-mode-map>File Names Editing mode.
-
+  "Writable Dired mode.
+\\<wdired-mode-map>
 Press \\[wdired-finish-edit] to make the changes to take effect
 and exit.  To abort the edit, use \\[wdired-abort-changes].
 
index e752dc56553c12add488afe5109cb6bcae6c70db..4e64d5e3681f4487cc2f3f888dd6f881d83f3c41 100644 (file)
 ;; There are also the following useful commands:
 ;;
 ;; `whitespace-newline-mode'
-;;    Toggle NEWLINE minor mode visualization ("nl" on modeline).
+;;    Toggle NEWLINE minor mode visualization ("nl" on mode line).
 ;;
 ;; `global-whitespace-newline-mode'
-;;    Toggle NEWLINE global minor mode visualization ("NL" on modeline).
+;;    Toggle NEWLINE global minor mode visualization ("NL" on mode line).
 ;;
 ;; `whitespace-report'
 ;;    Report some blank problems in buffer.
@@ -565,10 +565,10 @@ Used when `whitespace-style' includes the value `spaces'."
 
 (defface whitespace-space
   '((((class color) (background dark))
-     (:background "grey20"      :foreground "darkgray"))
+     :background "grey20"      :foreground "darkgray")
     (((class color) (background light))
-     (:background "LightYellow" :foreground "lightgray"))
-    (t (:inverse-video t)))
+     :background "LightYellow" :foreground "lightgray")
+    (t :inverse-video t))
   "Face used to visualize SPACE."
   :group 'whitespace)
 
@@ -583,10 +583,10 @@ Used when `whitespace-style' includes the value `spaces'."
 
 (defface whitespace-hspace             ; 'nobreak-space
   '((((class color) (background dark))
-     (:background "grey24"        :foreground "darkgray"))
+     :background "grey24"        :foreground "darkgray")
     (((class color) (background light))
-     (:background "LemonChiffon3" :foreground "lightgray"))
-    (t (:inverse-video t)))
+     :background "LemonChiffon3" :foreground "lightgray")
+    (t :inverse-video t))
   "Face used to visualize HARD SPACE."
   :group 'whitespace)
 
@@ -601,10 +601,10 @@ Used when `whitespace-style' includes the value `tabs'."
 
 (defface whitespace-tab
   '((((class color) (background dark))
-     (:background "grey22" :foreground "darkgray"))
+     :background "grey22" :foreground "darkgray")
     (((class color) (background light))
-     (:background "beige"  :foreground "lightgray"))
-    (t (:inverse-video t)))
+     :background "beige"  :foreground "lightgray")
+    (t :inverse-video t))
   "Face used to visualize TAB."
   :group 'whitespace)
 
@@ -621,15 +621,13 @@ and `newline'."
 
 
 (defface whitespace-newline
-  '((((class color) (background dark))
-     (:foreground "darkgray" :bold nil))
-    (((class color) (min-colors 88) (background light))
-     (:foreground "lightgray" :bold nil))
+  '((default :weight normal)
+    (((class color) (background dark)) :foreground "darkgray")
+    (((class color) (min-colors 88) (background light)) :foreground "lightgray")
     ;; Displays with 16 colors use lightgray as background, so using a
     ;; lightgray foreground makes the newline mark invisible.
-    (((class color) (background light))
-     (:foreground "brown" :bold nil))
-    (t (:underline t :bold nil)))
+    (((class color) (background light)) :foreground "brown")
+    (t :underline t))
   "Face used to visualize NEWLINE char mapping.
 
 See `whitespace-display-mappings'."
@@ -645,8 +643,9 @@ Used when `whitespace-style' includes the value `trailing'."
 
 
 (defface whitespace-trailing           ; 'trailing-whitespace
-  '((((class mono)) (:inverse-video t :bold t :underline t))
-    (t (:background "red1" :foreground "yellow" :bold t)))
+  '((default :weight bold)
+    (((class mono)) :inverse-video t :underline t)
+    (t :background "red1" :foreground "yellow"))
   "Face used to visualize trailing blanks."
   :group 'whitespace)
 
@@ -662,8 +661,8 @@ Used when `whitespace-style' includes the value `line'."
 
 
 (defface whitespace-line
-  '((((class mono)) (:inverse-video t :bold t :underline t))
-    (t (:background "gray20" :foreground "violet")))
+  '((((class mono)) :inverse-video t :weight bold :underline t)
+    (t :background "gray20" :foreground "violet"))
   "Face used to visualize \"long\" lines.
 
 See `whitespace-line-column'."
@@ -679,8 +678,8 @@ Used when `whitespace-style' includes the value `space-before-tab'."
 
 
 (defface whitespace-space-before-tab
-  '((((class mono)) (:inverse-video t :bold t :underline t))
-    (t (:background "DarkOrange" :foreground "firebrick")))
+  '((((class mono)) :inverse-video t :weight bold :underline t)
+    (t :background "DarkOrange" :foreground "firebrick"))
   "Face used to visualize SPACEs before TAB."
   :group 'whitespace)
 
@@ -694,8 +693,8 @@ Used when `whitespace-style' includes the value `indentation'."
 
 
 (defface whitespace-indentation
-  '((((class mono)) (:inverse-video t :bold t :underline t))
-    (t (:background "yellow" :foreground "firebrick")))
+  '((((class mono)) :inverse-video t :weight bold :underline t)
+    (t :background "yellow" :foreground "firebrick"))
   "Face used to visualize 8 or more SPACEs at beginning of line."
   :group 'whitespace)
 
@@ -709,8 +708,8 @@ Used when `whitespace-style' includes the value `empty'."
 
 
 (defface whitespace-empty
-  '((((class mono)) (:inverse-video t :bold t :underline t))
-    (t (:background "yellow" :foreground "firebrick")))
+  '((((class mono)) :inverse-video t :weight bold :underline t)
+    (t :background "yellow" :foreground "firebrick"))
   "Face used to visualize empty lines at beginning and/or end of buffer."
   :group 'whitespace)
 
@@ -724,8 +723,8 @@ Used when `whitespace-style' includes the value `space-after-tab'."
 
 
 (defface whitespace-space-after-tab
-  '((((class mono)) (:inverse-video t :bold t :underline t))
-    (t (:background "yellow" :foreground "firebrick")))
+  '((((class mono)) :inverse-video t :weight bold :underline t)
+    (t :background "yellow" :foreground "firebrick"))
   "Face used to visualize 8 or more SPACEs after TAB."
   :group 'whitespace)
 
@@ -1533,8 +1532,7 @@ documentation."
        (when (memq 'empty whitespace-style)
          (let (overwrite-mode)         ; enforce no overwrite
            (goto-char (point-min))
-           (when (re-search-forward
-                  (concat "\\`" whitespace-empty-at-bob-regexp) nil t)
+           (when (looking-at whitespace-empty-at-bob-regexp)
              (delete-region (match-beginning 1) (match-end 1)))
            (when (re-search-forward
                   (concat whitespace-empty-at-eob-regexp "\\'") nil t)
index 005e87a6dae2c818b37d8d03ca8082b8739be7b1..ab5122d6153b95e2b5610dc5be81266e832e4e9f 100644 (file)
@@ -30,7 +30,6 @@
 (require 'easymenu)
 (require 'custom)
 (require 'wid-edit)
-(eval-when-compile (require 'cl))
 
 (defgroup widget-browse nil
   "Customization support for browsing widgets."
index b6feecebde57d7def2e1b9909452dc17d5cbc27b..9c5c6462bcc2295cd6c95205722f181e5a51f962 100644 (file)
@@ -2907,15 +2907,7 @@ link for that string."
              (push (widget-convert-button widget-documentation-link-type
                                           begin end :value name)
                    buttons)))))
-      (widget-put widget :buttons buttons)))
-  (let ((indent (widget-get widget :indent)))
-    (when (and indent (not (zerop indent)))
-      (save-excursion
-       (save-restriction
-         (narrow-to-region from to)
-         (goto-char (point-min))
-         (while (search-forward "\n" nil t)
-           (insert-char ?\s indent)))))))
+      (widget-put widget :buttons buttons))))
 
 ;;; The `documentation-string' Widget.
 
@@ -2934,10 +2926,9 @@ link for that string."
        (start (point)))
     (if (string-match "\n" doc)
        (let ((before (substring doc 0 (match-beginning 0)))
-             (after (substring doc (match-beginning 0)))
-             button)
-         (when (and indent (not (zerop indent)))
-           (insert-char ?\s indent))
+             (after (substring doc (match-end 0)))
+             button end)
+         (widget-documentation-string-indent-to indent)
          (insert before ?\s)
          (widget-documentation-link-add widget start (point))
          (setq button
@@ -2950,18 +2941,35 @@ link for that string."
                 :action 'widget-parent-action
                 shown))
          (when shown
+           (insert ?\n)
            (setq start (point))
            (when (and indent (not (zerop indent)))
              (insert-char ?\s indent))
            (insert after)
-           (widget-documentation-link-add widget start (point)))
+           (setq end (point))
+           (widget-documentation-link-add widget start end)
+           ;; Indent the subsequent lines.
+           (when (and indent (> indent 0))
+             (save-excursion
+               (save-restriction
+                 (narrow-to-region start end)
+                 (goto-char (point-min))
+                 (while (search-forward "\n" nil t)
+                   (widget-documentation-string-indent-to indent))))))
          (widget-put widget :buttons (list button)))
-      (when (and indent (not (zerop indent)))
-       (insert-char ?\s indent))
+      (widget-documentation-string-indent-to indent)
       (insert doc)
       (widget-documentation-link-add widget start (point))))
   (insert ?\n))
 
+(defun widget-documentation-string-indent-to (col)
+  (when (and (numberp col)
+            (> col 0))
+    (let ((opoint (point)))
+      (indent-to col)
+      (put-text-property opoint (point)
+                        'display `(space :align-to ,col)))))
+
 (defun widget-documentation-string-action (widget &rest _ignore)
   ;; Toggle documentation.
   (let ((parent (widget-get widget :parent)))
index 49f84960078b52fd86fb32e6dc5f703710cf3a22..f9adf84fc58c36dbbee71c76ec6010f94aa7c979 100644 (file)
@@ -28,8 +28,6 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'cl))
-
 (defmacro save-selected-window (&rest body)
   "Execute BODY, then select the previously selected window.
 The value returned is the value of the last form in BODY.
@@ -47,12 +45,24 @@ order of recently selected windows and the buffer list ordering
 are not altered by this macro (unless they are altered in BODY)."
   (declare (indent 0) (debug t))
   `(let ((save-selected-window-window (selected-window))
-        ;; It is necessary to save all of these, because calling
-        ;; select-window changes frame-selected-window for whatever
-        ;; frame that window is in.
+        ;; We save and restore all frames' selected windows, because
+        ;; `select-window' can change the frame-selected-window of
+        ;; whatever frame that window is in.  Each text terminal's
+        ;; top-frame is preserved by putting it last in the list.
         (save-selected-window-alist
-         (mapcar (lambda (frame) (cons frame (frame-selected-window frame)))
-                 (frame-list))))
+         (apply 'append
+                (mapcar (lambda (terminal)
+                          (let ((frames (frames-on-display-list terminal))
+                                (top-frame (tty-top-frame terminal))
+                                alist)
+                            (if top-frame
+                                (setq frames
+                                      (cons top-frame
+                                            (delq top-frame frames))))
+                            (dolist (f frames)
+                              (push (cons f (frame-selected-window f))
+                                    alist))))
+                        (terminal-list)))))
      (save-current-buffer
        (unwind-protect
           (progn ,@body)
@@ -1256,12 +1266,14 @@ and no others."
 
 (defalias 'some-window 'get-window-with-predicate)
 
-(defun get-lru-window (&optional all-frames dedicated)
+(defun get-lru-window (&optional all-frames dedicated not-selected)
    "Return the least recently used window on frames specified by ALL-FRAMES.
 Return a full-width window if possible.  A minibuffer window is
 never a candidate.  A dedicated window is never a candidate
 unless DEDICATED is non-nil, so if all windows are dedicated, the
 value is nil.  Avoid returning the selected window if possible.
+Optional argument NOT-SELECTED non-nil means never return the
+selected window.
 
 The following non-nil values of the optional argument ALL-FRAMES
 have special meanings:
@@ -1280,7 +1292,8 @@ Any other value of ALL-FRAMES means consider all windows on the
 selected frame and no others."
    (let (best-window best-time second-best-window second-best-time time)
     (dolist (window (window-list-1 nil 'nomini all-frames))
-      (when (or dedicated (not (window-dedicated-p window)))
+      (when (and (or dedicated (not (window-dedicated-p window)))
+                (or (not not-selected) (not (eq window (selected-window)))))
        (setq time (window-use-time window))
        (if (or (eq window (selected-window))
                (not (window-full-width-p window)))
@@ -1292,9 +1305,12 @@ selected frame and no others."
            (setq best-window window)))))
     (or best-window second-best-window)))
 
-(defun get-mru-window (&optional all-frames)
+(defun get-mru-window (&optional all-frames dedicated not-selected)
    "Return the most recently used window on frames specified by ALL-FRAMES.
-Do not return a minibuffer window.
+A minibuffer window is never a candidate.  A dedicated window is
+never a candidate unless DEDICATED is non-nil, so if all windows
+are dedicated, the value is nil.  Optional argument NOT-SELECTED
+non-nil means never return the selected window.
 
 The following non-nil values of the optional argument ALL-FRAMES
 have special meanings:
@@ -1314,16 +1330,19 @@ selected frame and no others."
    (let (best-window best-time time)
     (dolist (window (window-list-1 nil 'nomini all-frames))
       (setq time (window-use-time window))
-      (when (or (not best-time) (> time best-time))
+      (when (and (or dedicated (not (window-dedicated-p window)))
+                (or (not not-selected) (not (eq window (selected-window))))
+                (or (not best-time) (> time best-time)))
        (setq best-time time)
        (setq best-window window)))
     best-window))
 
-(defun get-largest-window (&optional all-frames dedicated)
+(defun get-largest-window (&optional all-frames dedicated not-selected)
   "Return the largest window on frames specified by ALL-FRAMES.
 A minibuffer window is never a candidate.  A dedicated window is
 never a candidate unless DEDICATED is non-nil, so if all windows
-are dedicated, the value is nil.
+are dedicated, the value is nil.  Optional argument NOT-SELECTED
+non-nil means never return the selected window.
 
 The following non-nil values of the optional argument ALL-FRAMES
 have special meanings:
@@ -1343,7 +1362,8 @@ selected frame and no others."
   (let ((best-size 0)
        best-window size)
     (dolist (window (window-list-1 nil 'nomini all-frames))
-      (when (or dedicated (not (window-dedicated-p window)))
+      (when (and (or dedicated (not (window-dedicated-p window)))
+                (or (not not-selected) (not (eq window (selected-window)))))
        (setq size (* (window-total-size window)
                      (window-total-size window t)))
        (when (> size best-size)
@@ -1487,7 +1507,7 @@ instead."
     (cond
      ((eq window (frame-root-window frame))
       (error "Cannot resize the root window of a frame"))
-     ((window-minibuffer-p window) 
+     ((window-minibuffer-p window)
       (if horizontal
          (error "Cannot resize minibuffer window horizontally")
        (window--resize-mini-window window delta)))
@@ -2370,8 +2390,11 @@ frame."
     (cond
      ((frame-root-window-p window)
       ;; WINDOW's frame can be deleted only if there are other frames
-      ;; on the same terminal.
-      (unless (eq frame (next-frame frame 0))
+      ;; on the same terminal, and it does not contain the active
+      ;; minibuffer.
+      (unless (or (eq frame (next-frame frame 0))
+                 (let ((minibuf (active-minibuffer-window)))
+                   (and minibuf (eq frame (window-frame minibuf)))))
        'frame))
      ((or ignore-window-parameters
          (not (eq (window-parameter window 'window-side) 'none))
@@ -2532,7 +2555,7 @@ This may be a useful alternative binding for \\[delete-other-windows]
     (while (not (eq (setq w (next-window w 1)) window))
       (let ((e (window-edges w)))
         (when (and (= (car e) (car edges))
-                   (= (caddr e) (caddr edges)))
+                   (= (nth 2 e) (nth 2 edges)))
           (push w delenda))))
     (mapc 'delete-window delenda)))
 
@@ -3046,9 +3069,8 @@ one.  If non-nil, reset `quit-restore' parameter to nil."
           (buffer-live-p (car quad))
           (eq (nth 3 quit-restore) buffer))
       ;; Show another buffer stored in quit-restore parameter.
-      (setq resize (with-current-buffer buffer
-                    (and temp-buffer-resize-mode
-                         (/= (nth 3 quad) (window-total-size window)))))
+      (setq resize (and (integerp (nth 3 quad))
+                        (/= (nth 3 quad) (window-total-size window))))
       (set-window-dedicated-p window nil)
       (when resize
        ;; Try to resize WINDOW to its old height but don't signal an
@@ -3698,7 +3720,11 @@ specific buffers."
                     (scroll-bars . ,(window-scroll-bars window))
                     (vscroll . ,(window-vscroll window))
                     (dedicated . ,(window-dedicated-p window))
-                    (point . ,(if writable point (copy-marker point)))
+                    (point . ,(if writable point
+                                 (copy-marker point
+                                              (buffer-local-value
+                                               'window-point-insertion-type
+                                               buffer))))
                     (start . ,(if writable start (copy-marker start)))))))))
         (tail
          (when (memq type '(vc hc))
@@ -4175,7 +4201,6 @@ or matches BUFFER-NAME, the return value is the cdr of that
 entry."
   (let (tmp)
     (cond
-     ((not (stringp buffer-name)))
      ((member buffer-name special-display-buffer-names)
       t)
      ((setq tmp (assoc buffer-name special-display-buffer-names))
@@ -4251,10 +4276,6 @@ and (cdr ARGS) as second."
                 (make-frame (append args special-display-frame-alist))))
              (window (frame-selected-window frame)))
         (display-buffer-record-window 'frame window buffer)
-         ;; FIXME: Use window--display-buffer-2?
-        (set-window-buffer window buffer)
-        ;; Reset list of WINDOW's previous buffers to nil.
-        (set-window-prev-buffers window nil)
         (set-window-dedicated-p window t)
         window)))))
 
@@ -4446,7 +4467,7 @@ hold:
        ;; A window can be split vertically when its height is not
        ;; fixed, it is at least `split-height-threshold' lines high,
        ;; and it is at least twice as high as `window-min-height' and 2
-       ;; if it has a modeline or 1.
+       ;; if it has a mode line or 1.
        (and (memq window-size-fixed '(nil width))
             (numberp split-height-threshold)
             (>= (window-height window)
@@ -4567,30 +4588,34 @@ is higher than WINDOW."
          (enlarge-window (/ (- (window-height window) (window-height)) 2))
        (error nil)))))
 
-(defun window--display-buffer-1 (window)
-  "Raise the frame containing WINDOW.
-Do not raise the selected frame.  Return WINDOW."
-  (let* ((frame (window-frame window))
-        (visible (frame-visible-p frame)))
-    (unless (or (not visible)
-               ;; Assume the selected frame is already visible enough.
-               (eq frame (selected-frame))
-               ;; Assume the frame from which we invoked the minibuffer
-               ;; is visible.
-               (and (minibuffer-window-active-p (selected-window))
-                    (eq frame (window-frame (minibuffer-selected-window)))))
-      (raise-frame frame))
-    window))
-
-(defun window--display-buffer-2 (buffer window &optional dedicated)
+(defun window--display-buffer (buffer window type &optional dedicated)
   "Display BUFFER in WINDOW and make its frame visible.
-Set `window-dedicated-p' to DEDICATED if non-nil.
-Return WINDOW."
+TYPE must be one of the symbols `reuse', `window' or `frame' and
+is passed unaltered to `display-buffer-record-window'. Set
+`window-dedicated-p' to DEDICATED if non-nil.  Return WINDOW if
+BUFFER and WINDOW are live."
   (when (and (buffer-live-p buffer) (window-live-p window))
-    (set-window-buffer window buffer)
-    (when dedicated
-      (set-window-dedicated-p window dedicated))
-    (window--display-buffer-1 window)))
+    (let* ((frame (window-frame window))
+          (visible (frame-visible-p frame)))
+      (unless (eq buffer (window-buffer window))
+       (set-window-dedicated-p window nil)
+       (display-buffer-record-window type window buffer)
+       (set-window-buffer window buffer)
+       (when dedicated
+         (set-window-dedicated-p window dedicated))
+       (when (memq type '(window frame))
+         (set-window-prev-buffers window nil)))
+
+      (unless (or (not visible)
+                 ;; Assume the selected frame is already visible enough.
+                 (eq frame (selected-frame))
+                 ;; Assume the frame from which we invoked the minibuffer
+                 ;; is visible.
+                 (and (minibuffer-window-active-p (selected-window))
+                      (eq frame (window-frame (minibuffer-selected-window)))))
+       (raise-frame frame))
+
+      window)))
 
 ;; FIXME: Not implemented.
 ;; FIXME: By the way, there could be more levels of dedication:
@@ -4812,8 +4837,7 @@ selected window."
   (unless (or (cdr (assq 'inhibit-same-window alist))
              (window-minibuffer-p)
              (window-dedicated-p))
-    (display-buffer-record-window 'reuse (selected-window) buffer)
-    (window--display-buffer-2 buffer (selected-window))))
+    (window--display-buffer buffer (selected-window) 'reuse)))
 
 (defun display-buffer--maybe-same-window (buffer alist)
   "Conditionally display BUFFER in the selected window.
@@ -4857,8 +4881,7 @@ terminal if either of those variables is non-nil."
                              (get-buffer-window-list buffer 'nomini
                                                      frames))))))
     (when window
-      (display-buffer-record-window 'reuse window buffer)
-      (window--display-buffer-1 window))))
+      (window--display-buffer buffer window 'reuse))))
 
 (defun display-buffer--special-action (buffer)
   "Return special display action for BUFFER, if any.
@@ -4884,11 +4907,8 @@ return the window used; otherwise return nil."
     (when (and fun
               (setq frame (funcall fun))
               (setq window (frame-selected-window frame)))
-      (display-buffer-record-window 'frame window buffer)
-      (window--display-buffer-2 buffer window display-buffer-mark-dedicated)
-      ;; Reset list of WINDOW's previous buffers to nil.
-      (set-window-prev-buffers window nil)
-      window)))
+      (window--display-buffer
+       buffer window 'frame display-buffer-mark-dedicated))))
 
 (defun display-buffer-pop-up-window (buffer _alist)
   "Display BUFFER by popping up a new window.
@@ -4910,11 +4930,8 @@ If successful, return the new window; otherwise return nil."
                                 (get-largest-window frame t))
                                (window--try-to-split-window
                                 (get-lru-window frame t)))))
-      (display-buffer-record-window 'window window buffer)
-      (window--display-buffer-2 buffer window display-buffer-mark-dedicated)
-      ;; Reset list of WINDOW's previous buffers to nil.
-      (set-window-prev-buffers window nil)
-      window)))
+      (window--display-buffer
+       buffer window 'window display-buffer-mark-dedicated))))
 
 (defun display-buffer--maybe-pop-up-frame-or-window (buffer alist)
   "Try displaying BUFFER based on `pop-up-frames' or `pop-up-windows'.
@@ -4936,40 +4953,26 @@ again with `display-buffer-pop-up-window'."
 Search for a usable window, set that window to the buffer, and
 return the window.  If no suitable window is found, return nil."
   (let* ((not-this-window (cdr (assq 'inhibit-same-window alist)))
-        (window-to-undedicate
-         ;; When NOT-THIS-WINDOW is non-nil, temporarily dedicate the
-         ;; selected window to its buffer, to prevent any of the
-         ;; `get-' routines below from choosing it.  (Bug#1415)
-         (and not-this-window (not (window-dedicated-p))
-              (set-window-dedicated-p (selected-window) t)
-              (selected-window)))
         (frame (or (window--frame-usable-p (selected-frame))
                    (window--frame-usable-p (last-nonminibuffer-frame))))
-        window)
-    (unwind-protect
-       (setq window
-             ;; Reuse an existing window.
-             (or (get-lru-window frame)
-                 (let ((window (get-buffer-window buffer 'visible)))
-                   (unless (and not-this-window
-                                (eq window (selected-window)))
-                     window))
-                 (get-largest-window 'visible)
-                 (let ((window (get-buffer-window buffer 0)))
-                   (unless (and not-this-window
-                                (eq window (selected-window)))
-                     window))
-                 (get-largest-window 0)))
-      (when (window-live-p window-to-undedicate)
-       ;; Restore dedicated status of selected window.
-       (set-window-dedicated-p window-to-undedicate nil)))
+        (window
+         ;; Reuse an existing window.
+         (or (get-lru-window frame nil not-this-window)
+             (let ((window (get-buffer-window buffer 'visible)))
+               (unless (and not-this-window
+                            (eq window (selected-window)))
+                 window))
+             (get-largest-window 'visible nil not-this-window)
+             (let ((window (get-buffer-window buffer 0)))
+               (unless (and not-this-window
+                            (eq window (selected-window)))
+                 window))
+             (get-largest-window 0 not-this-window))))
     (when window
-      (display-buffer-record-window 'reuse window buffer)
       (window--even-window-heights window)
-      (window--display-buffer-2 buffer window))))
+      (window--display-buffer buffer window 'reuse))))
 
 ;;; Display + selection commands:
-
 (defun pop-to-buffer (buffer &optional action norecord)
   "Select buffer BUFFER in some window, preferably a different one.
 BUFFER may be a buffer, a string (a buffer name), or nil.  If it
@@ -5090,11 +5093,11 @@ Return the buffer switched to."
      ((eq buffer (window-buffer)))
      ((window-minibuffer-p)
       (if force-same-window
-          (error "Cannot switch buffers in minibuffer window")
+          (user-error "Cannot switch buffers in minibuffer window")
         (pop-to-buffer buffer norecord)))
      ((eq (window-dedicated-p) t)
       (if force-same-window
-          (error "Cannot switch buffers in a dedicated window")
+          (user-error "Cannot switch buffers in a dedicated window")
         (pop-to-buffer buffer norecord)))
      (t (set-window-buffer nil buffer)))
 
@@ -5164,9 +5167,9 @@ where some error may be present."
     (unless (zerop delta)
       ;; Setting window-min-height to a value like 1 can lead to very
       ;; bizarre displays because it also allows Emacs to make *other*
-      ;; windows 1-line tall, which means that there's no more space for
-      ;; the modeline.
-      (let ((window-min-height (min 2 height))) ; One text line plus a modeline.
+      ;; windows one line tall, which means that there's no more space
+      ;; for the mode line.
+      (let ((window-min-height (min 2 height)))
        (window-resize window delta)))))
 
 (defun enlarge-window-horizontally (delta)
@@ -5494,7 +5497,7 @@ A value of t means point moves to the beginning or the end of the buffer
 \(depending on scrolling direction) when no more scrolling possible.
 When point is already on that position, then signal an error."
   :type 'boolean
-  :group 'scrolling
+  :group 'windows
   :version "24.1")
 
 (defun scroll-up-command (&optional arg)
@@ -5767,6 +5770,8 @@ is active.  This function is run by `mouse-autoselect-window-timer'."
        (setq mouse-autoselect-window-state nil)
        ;; Run `mouse-leave-buffer-hook' when autoselecting window.
        (run-hooks 'mouse-leave-buffer-hook))
+      ;; Clear echo area.
+      (message nil)
       (select-window window))))
 
 (defun truncated-partial-width-window-p (&optional window)
index ef7b0c2a3ce93236b118c633c8a125617d33a3e6..d808a54a10e8ec2cf934d51abe84e8b10ea08fec 100644 (file)
 
 ;;; Code:
 
-(eval-when-compile
-  (require 'cl))
-
-
-(defmacro winner-active-region ()
+(eval-when-compile (require 'cl-lib))
+
+(defun winner-active-region ()
+  (declare (gv-setter (lambda (store)
+                        (if (featurep 'xemacs)
+                            `(if ,store (zmacs-activate-region)
+                               (zmacs-deactivate-region))
+                          `(setq mark-active ,store)))))
   (if (boundp 'mark-active)
-      'mark-active
-    '(region-active-p)))
-
-(defsetf winner-active-region () (store)
-  (if (featurep 'xemacs)
-      `(if ,store (zmacs-activate-region)
-        (zmacs-deactivate-region))
-    `(setq mark-active ,store)))
+      mark-active
+    (region-active-p)))
 
 (defalias 'winner-edges
   (if (featurep 'xemacs) 'window-pixel-edges 'window-edges))
@@ -107,15 +104,15 @@ You may want to include buffer names such as *Help*, *Apropos*,
 (defun winner-sorted-window-list ()
   (sort (winner-window-list)
         (lambda (x y)
-          (loop for a in (winner-edges x)
-                for b in (winner-edges y)
-                while (= a b)
-                finally return (< a b)))))
+          (cl-loop for a in (winner-edges x)
+                   for b in (winner-edges y)
+                   while (= a b)
+                   finally return (< a b)))))
 
 (defun winner-win-data ()
   ;; Essential properties of the windows in the selected frame.
-  (loop for win in (winner-sorted-window-list)
-        collect (cons (winner-edges win) (window-buffer win))))
+  (cl-loop for win in (winner-sorted-window-list)
+           collect (cons (winner-edges win) (window-buffer win))))
 
 ;; This variable is updated with the current window configuration
 ;; every time it changes.
@@ -138,7 +135,7 @@ You may want to include buffer names such as *Help*, *Apropos*,
 ;; Consult `winner-currents'.
 (defun winner-configuration (&optional frame)
   (or (cdr (assq (or frame (selected-frame)) winner-currents))
-      (letf (((selected-frame) frame))
+      (with-selected-frame frame
        (winner-conf))))
 
 
@@ -240,15 +237,15 @@ You may want to include buffer names such as *Help*, *Apropos*,
   (let* ((miniwin  (minibuffer-window))
          (chosen   (selected-window))
          (minisize (window-height miniwin)))
-    (letf (((window-buffer miniwin))
-           ((window-point  miniwin)))
+    (cl-letf (((window-buffer miniwin))
+              ((window-point  miniwin)))
       (set-window-configuration winconf))
     (cond
      ((window-live-p chosen) (select-window chosen))
      ((window-minibuffer-p (selected-window))
       (other-window 1)))
     (when (/= minisize (window-height miniwin))
-      (letf (((selected-window) miniwin) )
+      (with-selected-window miniwin
         (setf (window-height) minisize)))))
 
 
@@ -261,17 +258,17 @@ You may want to include buffer names such as *Help*, *Apropos*,
 ;; Format of entries: (buffer (mark . mark-active) (window . point) ..)
 
 (defun winner-make-point-alist ()
-  (letf (((current-buffer)))
-    (loop with alist
-         for win in (winner-window-list)
-         for entry =
-          (or (assq (window-buffer win) alist)
-              (car (push (list (set-buffer (window-buffer win))
-                               (cons (mark t) (winner-active-region)))
-                         alist)))
-         do (push (cons win (window-point win))
-                   (cddr entry))
-         finally return alist)))
+  (save-current-buffer
+    (cl-loop with alist
+             for win in (winner-window-list)
+             for entry =
+             (or (assq (window-buffer win) alist)
+                 (car (push (list (set-buffer (window-buffer win))
+                                  (cons (mark t) (winner-active-region)))
+                            alist)))
+             do (push (cons win (window-point win))
+                      (cddr entry))
+             finally return alist)))
 
 (defun winner-get-point (buf win)
   ;; Consult (and possibly extend) `winner-point-alist'.
@@ -282,10 +279,10 @@ You may want to include buffer names such as *Help*, *Apropos*,
        (entry
        (or (cdr (assq win (cddr entry)))
            (cdr (assq nil (cddr entry)))
-           (letf (((current-buffer) buf))
+           (with-current-buffer buf
              (push (cons nil (point)) (cddr entry))
              (point))))
-       (t (letf (((current-buffer) buf))
+       (t (with-current-buffer buf
            (push (list buf
                        (cons (mark t) (winner-active-region))
                        (cons nil (point)))
@@ -302,11 +299,11 @@ You may want to include buffer names such as *Help*, *Apropos*,
   (let* ((buffers nil)
         (alive
           ;; Possibly update `winner-point-alist'
-         (loop for buf in (mapcar 'cdr (cdr conf))
-               for pos = (winner-get-point buf nil)
-               if (and pos (not (memq buf buffers)))
-               do (push buf buffers)
-               collect pos)))
+         (cl-loop for buf in (mapcar 'cdr (cdr conf))
+                   for pos = (winner-get-point buf nil)
+                   if (and pos (not (memq buf buffers)))
+                   do (push buf buffers)
+                   collect pos)))
     (winner-set-conf (car conf))
     (let (xwins)                        ; to be deleted
 
@@ -320,12 +317,12 @@ You may want to include buffer names such as *Help*, *Apropos*,
           (push win xwins)))            ; delete this window
 
       ;; Restore marks
-      (letf (((current-buffer)))
-       (loop for buf in buffers
-             for entry = (cadr (assq buf winner-point-alist))
-             do (progn (set-buffer buf)
-                       (set-mark (car entry))
-                       (setf (winner-active-region) (cdr entry)))))
+      (save-current-buffer
+       (cl-loop for buf in buffers
+                 for entry = (cadr (assq buf winner-point-alist))
+                 do (progn (set-buffer buf)
+                           (set-mark (car entry))
+                           (setf (winner-active-region) (cdr entry)))))
       ;; Delete windows, whose buffers are dead or boring.
       ;; Return t if this is still a possible configuration.
       (or (null xwins)
@@ -422,7 +419,7 @@ In other words, \"undo\" changes in window configuration."
        (setq winner-pending-undo-ring (winner-ring (selected-frame)))
        (setq winner-undo-counter 0)
        (setq winner-undone-data (list (winner-win-data))))
-      (incf winner-undo-counter)       ; starting at 1
+      (cl-incf winner-undo-counter)    ; starting at 1
       (when (and (winner-undo-this)
                 (not (window-minibuffer-p (selected-window))))
        (message "Winner undo (%d / %d)"
@@ -433,11 +430,11 @@ In other words, \"undo\" changes in window configuration."
 
 \f
 (defun winner-undo-this ()             ; The heart of winner undo.
-  (loop
+  (cl-loop
    (cond
     ((>= winner-undo-counter (ring-length winner-pending-undo-ring))
      (message "No further window configuration undo information")
-     (return nil))
+     (cl-return nil))
 
     ((and                              ; If possible configuration
       (winner-set (ring-ref winner-pending-undo-ring
@@ -446,7 +443,7 @@ In other words, \"undo\" changes in window configuration."
       (let ((data (winner-win-data)))
        (and (not (member data winner-undone-data))
             (push data winner-undone-data))))
-     (return t))                       ; .. then everything is fine.
+     (cl-return t))                    ; .. then everything is fine.
     (t ;; Otherwise, discharge it (and try the next one).
      (ring-remove winner-pending-undo-ring winner-undo-counter)))))
 
index 4ecf7c8891d0428e6f2da9eed40067b405728a35..505ed4c00aa6637fd07e73d6babc761dde60327e 100644 (file)
@@ -1,6 +1,6 @@
 ;;; woman.el --- browse UN*X manual pages `wo (without) man'
 
-;; Copyright (C) 2000-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2000-2012 Free Software Foundation, Inc.
 
 ;; Author: Francis J. Wright <F.J.Wright@qmul.ac.uk>
 ;; Maintainer: FSF
 
 (eval-when-compile                     ; to avoid compiler warnings
   (require 'dired)
-  (require 'cl)
+  (require 'cl-lib)
   (require 'apropos))
 
 (defun woman-mapcan (fn x)
@@ -1595,14 +1595,6 @@ Also make each path-info component into a list.
       (woman-process-buffer)
       (goto-char (point-min)))))
 
-;; There is currently no `tar-mode-hook' so use ...
-(eval-after-load "tar-mode"
-  '(progn
-    (define-key tar-mode-map "w" 'woman-tar-extract-file)
-    (define-key-after (lookup-key tar-mode-map [menu-bar immediate])
-      [woman] '("Read Man Page (WoMan)" . woman-tar-extract-file) 'view)))
-
-
 (defvar woman-last-file-name nil
   "The full pathname of the last file formatted by WoMan.")
 
@@ -1987,7 +1979,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
                            (lambda (symbol)
                              (and
                               (or (commandp symbol)
-                                  (user-variable-p symbol))
+                                  (custom-variable-p symbol))
                               (not (get symbol 'apropos-inhibit))))))
     ;; Find documentation strings:
     (let ((p apropos-accumulator)
@@ -1999,7 +1991,7 @@ Optional argument REDRAW, if non-nil, forces mode line to be updated."
                       (if (setq doc (documentation symbol t))
                           (substring doc 0 (string-match "\n" doc))
                         "(not documented)"))
-                  (if (user-variable-p symbol) ; 3. variable doc
+                  (if (custom-variable-p symbol)       ; 3. variable doc
                       (if (setq doc (documentation-property
                                      symbol 'variable-documentation t))
                           (substring doc 0 (string-match "\n" doc))))))
@@ -2141,7 +2133,7 @@ European characters."
            (copy-sequence standard-display-table)
          (make-display-table)))
   ;; Display the following internal chars correctly:
-  (aset buffer-display-table woman-unpadded-space-char [?\ ])
+  (aset buffer-display-table woman-unpadded-space-char [?\s])
   (aset buffer-display-table woman-escaped-escape-char [?\\]))
 
 \f
@@ -2393,18 +2385,20 @@ Currently set only from '\" t in the first line of the source file.")
     (if woman-negative-vertical-space
        (woman-negative-vertical-space from))
 
-    (if woman-preserve-ascii
-       ;; Re-instate escaped escapes to just `\' and unpaddable
-       ;; spaces to just `space', without inheriting any text
-       ;; properties.  This is not necessary, UNLESS the buffer is to
-       ;; be saved as ASCII.
-       (progn
-         (goto-char from)
-         (while (search-forward woman-escaped-escape-string nil t)
-           (delete-char -1) (insert ?\\))
-         (goto-char from)
-         (while (search-forward woman-unpadded-space-string nil t)
-           (delete-char -1) (insert ?\ ))))
+    (when woman-preserve-ascii
+      ;; Re-instate escaped escapes to just `\' and unpaddable spaces
+      ;; to just `space'.  This is not necessary for display since
+      ;; there are display table entries for the escaped chars, but it
+      ;; is necessary if the buffer might be saved as ASCII.
+      ;;
+      ;; `subst-char-in-region' preserves text properties on the
+      ;; characters, which is necessary for bold, underline, etc on
+      ;; \e.  There's usually no face on spaces, but if there is then
+      ;; it's good to keep that too.
+      (subst-char-in-region from (point-max)
+                           woman-escaped-escape-char ?\\)
+      (subst-char-in-region from (point-max)
+                           woman-unpadded-space-char ?\s))
 
     ;; Must return the new end of file if used in format-alist.
     (point-max)))
@@ -2445,9 +2439,9 @@ Preserves location of `point'."
            ;; first backwards then forwards:
            (while (and
                    (<= (setq N (1+ N)) 0)
-                   (cond ((memq (preceding-char) '(?\  ?\t))
+                   (cond ((memq (preceding-char) '(?\s ?\t))
                           (delete-char -1) t)
-                         ((memq (following-char) '(?\  ?\t))
+                         ((memq (following-char) '(?\s ?\t))
                           (delete-char 1) t)
                          (t nil))))
            (if (<= N 0)
@@ -2685,8 +2679,7 @@ If DELETE is non-nil then delete from point."
        ;; then use the WoMan search mechanism to find the filename ...
        (setq filename
              (woman-file-name
-              (file-name-sans-extension
-               (file-name-nondirectory name))))
+              (file-name-base name)))
        ;; Cannot find the file, so ...
        (kill-buffer (current-buffer))
        (error "File `%s' not found" name))
@@ -2872,15 +2865,18 @@ interpolated by `\*x' and `\*(xx' escapes."
             (re-search-forward "[^ \t\n]+")
             (let ((string (match-string 0)))
               (skip-chars-forward " \t")
-;               (setq string
-;                     (cons string
-;                           ;; hack (?) for CGI.man!
-;                           (cond ((looking-at "\"\"") "\"")
-;                                 ((looking-at ".*") (match-string 0)))
-;                           ))
-              ;; Above hack causes trouble in arguments!
-              (looking-at ".*")
-              (setq string (cons string (match-string 0)))
+              (if (= ?\" (following-char))
+                  ;; Double-quote starts a string, eg.
+                  ;;   .ds foo "blah...
+                  ;; is value blah... through to newline.  There's no
+                  ;; closing " (per the groff manual), but rather any
+                  ;; further " is included literally in the string.  Eg.
+                  ;;   .ds foo ""
+                  ;; sets foo to a single " character.
+                  (forward-char))
+              (setq string (cons string
+                                 (buffer-substring (point)
+                                                   (line-end-position))))
               ;; This should be an update, but consing a new string
               ;; onto the front of the alist has the same effect:
               (setq woman-string-alist (cons string woman-string-alist))
@@ -3384,7 +3380,7 @@ Ignore the default face and underline only word characters."
 ;; this used to be globally bound to nil, to avoid an error.  Instead
 ;; we can use bound-and-true-p in woman-translate.
 (defvar woman-translations)
-;; A list of the form (\"[ace]\" (a . b) (c . d) (e . ?\ )) or nil.
+;; A list of the form (\"[ace]\" (a . b) (c . d) (e . ?\s)) or nil.
 
 (defun woman-get-next-char ()
   "Return and delete next char in buffer, including special chars."
@@ -3719,7 +3715,9 @@ expression in parentheses.  Leaves point after the value."
                              (setq fn 'woman2-format-paragraphs))))
                ()
              ;; Find next control line:
-             (set-marker to (woman-find-next-control-line))
+            (if (equal woman-request "TS")
+                (set-marker to (woman-find-next-control-line "TE"))
+              (set-marker to (woman-find-next-control-line)))
              ;; Call the appropriate function:
              (funcall fn to)))
       (if (not (eobp))                 ; This should not happen, but ...
@@ -3730,12 +3728,13 @@ expression in parentheses.  Leaves point after the value."
       (fset 'insert-and-inherit insert-and-inherit)
       (set-marker to nil))))
 
-(defun woman-find-next-control-line ()
-  "Find and return start of next control line."
-;  (let ((to (save-excursion
-;            (re-search-forward "^\\." nil t))))
-;    (if to (1- to) (point-max)))
-  (let (to)
+(defun woman-find-next-control-line (&optional pat)
+  "Find and return start of next control line.
+PAT, if non-nil, specifies an additional component of the control
+line regexp to search for, which is appended to the default
+regexp, \"\\(\\\\c\\)?\\n[.']\"."
+  (let ((pattern (concat "\\(\\\\c\\)?\n[.']" pat))
+        to)
     (save-excursion
       ;; Must handle
       ;; ...\c
@@ -3744,12 +3743,14 @@ expression in parentheses.  Leaves point after the value."
       ;; BEWARE THAT THIS CODE MAY BE UNRELIABLE!!!!!
       (while
          (and
-          (setq to (re-search-forward "\\(\\\\c\\)?\n[.']" nil t))
+          (setq to (re-search-forward pattern nil t))
           (match-beginning 1)
           (looking-at "br"))
        (goto-char (match-beginning 0))
        (woman-delete-line 2)))
-    (if to (1- to) (point-max))))
+    (if to
+       (- to (+ 1 (length pat)))
+      (point-max))))
 
 (defun woman2-PD (to)
   ".PD d -- Set the interparagraph distance to d.
@@ -3893,18 +3894,18 @@ Leave 1 blank line.  Format paragraphs upto TO."
                   (insert (substring overlap i eol))
                   (setq i (or eol imax)))
                 )
-               ((eq c ?\ )             ; skip
+               ((eq c ?\s)             ; skip
                 (forward-char))
                ((eq c ?\t)             ; skip
                 (if (eq (following-char) ?\t)
                     (forward-char)     ; both tabs, just skip
                   (dotimes (i woman-tab-width)
                      (if (eolp)
-                         (insert ?\ )  ; extend line
+                         (insert ?\s)  ; extend line
                        (forward-char)) ; skip
                     )))
                (t
-                (if (or (eq (following-char) ?\ ) ; overwrite OK
+                (if (or (eq (following-char) ?\s) ; overwrite OK
                         overwritten) ; warning only once per ".sp -"
                     ()
                   (setq overwritten t)
@@ -3923,7 +3924,7 @@ Leave 1 blank line.  Format paragraphs upto TO."
 (defun woman2-process-escapes (to &optional numeric)
   "Process remaining escape sequences up to marker TO, preserving point.
 Optional argument NUMERIC, if non-nil, means the argument is numeric."
-  (assert (and (markerp to) (marker-insertion-type to)))
+  (cl-assert (and (markerp to) (marker-insertion-type to)))
   ;; The first two cases below could be merged (maybe)!
   (let ((from (point)))
     ;; Discard zero width filler character used to hide leading dots
@@ -3931,7 +3932,9 @@ Optional argument NUMERIC, if non-nil, means the argument is numeric."
     (while (re-search-forward "\\\\[&|^]" to t)
       (woman-delete-match 0)
       ;; If on a line by itself, consume newline as well (Bug#3651).
-      (and (eq (char-before (match-beginning 0)) ?\n)
+      ;; But not in a .nf region, preserve all newlines in that case.
+      (and (not woman-nofill)
+          (eq (char-before (match-beginning 0)) ?\n)
           (eq (char-after (match-beginning 0)) ?\n)
           (delete-char 1)))
 
@@ -4408,7 +4411,7 @@ tab stop columns or pairs (COLUMN . TYPE) where TYPE is R or C."
                    tab (- tab (if (eq type ?C) (/ n 2) n))) )
          (setq n (- tab (current-column)))
          (insert-char ?\s n))
-      (insert ?\ ))))
+      (insert ?\s))))
 
 (defun woman2-DT (to)
   ".DT -- Restore default tabs.  Format paragraphs upto TO.
@@ -4426,7 +4429,7 @@ Needs doing properly!"
   (if (eolp)
       (woman-delete-whole-line)                ; ignore!
     (let ((delim (following-char))
-         (pad ?\ ) end)                ; pad defaults to space
+         (pad ?\s) end)                ; pad defaults to space
       (forward-char)
       (skip-chars-forward " \t")
       (or (eolp) (setq pad (following-char)))
@@ -4457,8 +4460,6 @@ Needs doing properly!"
 (defun woman2-TS (to)
   ".TS -- Start of table code for the tbl processor.
 Format paragraphs upto TO."
-  ;; This is a preliminary hack that seems to suffice for lilo.8.
-  (woman-delete-line 1)                        ; ignore any arguments
   (when woman-emulate-tbl
     ;; Assumes column separator is \t and intercolumn spacing is 3.
     ;; The first line may optionally be a list of options terminated by
@@ -4470,6 +4471,22 @@ Format paragraphs upto TO."
     (woman-delete-line 1)
     ;; For each column, find its width and align it:
     (let ((start (point)) (col 1))
+      (WoMan-log "%s" (buffer-substring start (+ start 40)))
+      ;; change T{ T} to tabs
+      (while (search-forward "T{\n" to t)
+       (replace-match "")
+       (catch 'end
+         (while (search-forward "\n" to t)
+           (replace-match " ")
+           (if (looking-at "T}")
+               (progn
+                 (delete-char 2)
+                 (throw 'end t))))))
+      (goto-char start)
+      ;; strip space and headers
+      (while (re-search-forward "^\\.TH\\|\\.sp" to t)
+       (woman-delete-whole-line))
+      (goto-char start)
       (while (prog1 (search-forward "\t" to t) (goto-char start))
        ;; Find current column width:
        (while (< (point) to)
@@ -4483,8 +4500,25 @@ Format paragraphs upto TO."
        (while (< (point) to)
          (when (search-forward "\t" to t)
            (delete-char -1)
-           (insert-char ?\  (- col (current-column))))
+           (insert-char ?\s (- col (current-column))))
          (forward-line))
+       (goto-char start))
+      ;; find maximum width
+      (let ((max-col 0))
+       (while (search-forward "\n" to t)
+         (backward-char)
+         (if (> (current-column) max-col)
+             (setq max-col (current-column)))
+         (forward-char))
+       (goto-char start)
+       ;; break lines if they are too long
+       (when (and (> max-col woman-fill-column)
+                  (> woman-fill-column col))
+         (setq max-col woman-fill-column)
+         (woman-break-table col to start)
+         (goto-char start))
+       (while (re-search-forward "^_$" to t)
+         (replace-match (make-string max-col ?_)))
        (goto-char start))))
   ;; Format table with no filling or adjusting (cf. woman2-nf):
   (setq woman-nofill t)
@@ -4494,6 +4528,17 @@ Format paragraphs upto TO."
   ;; ".TE -- End of table code for the tbl processor."
   ;; Turn filling and adjusting back on.
 
+(defun woman-break-table (start-column to start)
+  (while (< (point) to)
+    (move-to-column woman-fill-column)
+    (if (eolp)
+       (forward-line)
+      (if (and (search-backward " " start t)
+              (> (current-column) start-column))
+         (progn
+           (insert-char ?\n 1)
+           (insert-char ?\s (- start-column 5)))
+       (forward-line)))))
 \f
 ;;; WoMan message logging:
 
@@ -4531,7 +4576,7 @@ IGNORED is a string appended to the log message."
         (buffer-substring (point)
                           (line-end-position))))
     (if (and (> (length tail) 0)
-            (/= (string-to-char tail) ?\ ))
+            (/= (string-to-char tail) ?\s))
        (setq tail (concat " " tail)))
     (WoMan-log-1
      (concat "**  " request tail "  request " ignored))))
index cb56f023af060a3c43856e4ad35bbd1efca88ad1..e2788e5e756b3fce6264d89b6adef1404ca05ba9 100644 (file)
 ;; a worthwhile tradeoff especially since we're usually parsing files
 ;; instead of hand-crafted XML.
 
-;;*******************************************************************
-;;**
-;;**  Macros to parse the list
-;;**
-;;*******************************************************************
+;;;  Macros to parse the list
 
 (defconst xml-undefined-entity "?"
   "What to substitute for undefined entities")
 
+(defconst xml-default-ns '(("" . "")
+                          ("xml" . "http://www.w3.org/XML/1998/namespace")
+                          ("xmlns" . "http://www.w3.org/2000/xmlns/"))
+  "Alist mapping default XML namespaces to their URIs.")
+
 (defvar xml-entity-alist
-  '(("lt"   . "<")
+  '(("lt"   . "&#60;")
     ("gt"   . ">")
     ("apos" . "'")
     ("quot" . "\"")
-    ("amp"  . "&"))
-  "The defined entities.  Entities are added to this when the DTD is parsed.")
+    ("amp"  . "&#38;"))
+  "Alist mapping XML entities to their replacement text.")
+
+(defvar xml-entity-expansion-limit 20000
+  "The maximum size of entity reference expansions.
+If the size of the buffer increases by this many characters while
+expanding entity references in a segment of character data, the
+XML parser signals an error.  Setting this to nil removes the
+limit (making the parser vulnerable to XML bombs).")
+
+(defvar xml-parameter-entity-alist nil
+  "Alist of defined XML parametric entities.")
 
 (defvar xml-sub-parser nil
-  "Dynamically set this to a non-nil value if you want to parse an XML fragment.")
+  "Non-nil when the XML parser is parsing an XML fragment.")
 
 (defvar xml-validating-parser nil
   "Set to non-nil to get validity checking.")
@@ -153,192 +164,218 @@ An empty string is returned if the attribute was not found.
 See also `xml-get-attribute-or-nil'."
   (or (xml-get-attribute-or-nil node attribute) ""))
 
-;;*******************************************************************
-;;**
-;;**  Creating the list
-;;**
-;;*******************************************************************
+;;; Regular expressions for XML components
 
-;;;###autoload
-(defun xml-parse-file (file &optional parse-dtd parse-ns)
-  "Parse the well-formed XML file FILE.
-If FILE is already visited, use its buffer and don't kill it.
-Returns the top node with all its children.
-If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.
-If PARSE-NS is non-nil, then QNAMES are expanded."
-  (if (get-file-buffer file)
-      (with-current-buffer (get-file-buffer file)
-       (save-excursion
-         (xml-parse-region (point-min)
-                           (point-max)
-                           (current-buffer)
-                           parse-dtd parse-ns)))
-    (with-temp-buffer
-      (insert-file-contents file)
-      (xml-parse-region (point-min)
-                       (point-max)
-                       (current-buffer)
-                       parse-dtd parse-ns))))
-
-
-(defvar xml-name-re)
-(defvar xml-entity-value-re)
-(defvar xml-att-def-re)
-(let* ((start-chars (concat "[:alpha:]:_"))
-       (name-chars  (concat "-[:digit:]." start-chars))
-       ;;[3]           S          ::=          (#x20 | #x9 | #xD | #xA)+
-       (whitespace  "[ \t\n\r]"))
-  ;;[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6]
-  ;;                      | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF]
-  ;;                      | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF]
-  ;;                      | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]
-  (defvar xml-name-start-char-re (concat "[" start-chars "]"))
-  ;;[4a] NameChar      ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]
-  (defvar xml-name-char-re       (concat "[" name-chars  "]"))
-  ;;[5] Name     ::= NameStartChar (NameChar)*
-  (defvar xml-name-re            (concat xml-name-start-char-re xml-name-char-re "*"))
-  ;;[6] Names    ::= Name (#x20 Name)*
-  (defvar xml-names-re           (concat xml-name-re "\\(?: " xml-name-re "\\)*"))
-  ;;[7] Nmtoken ::= (NameChar)+
-  (defvar xml-nmtoken-re         (concat xml-name-char-re "+"))
-  ;;[8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*
-  (defvar xml-nmtokens-re        (concat xml-nmtoken-re "\\(?: " xml-name-re "\\)*"))
-  ;;[66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
-  (defvar xml-char-ref-re        "\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)")
-  ;;[68] EntityRef   ::= '&' Name ';'
-  (defvar xml-entity-ref         (concat "&" xml-name-re ";"))
-  ;;[69] PEReference ::= '%' Name ';'
-  (defvar xml-pe-reference-re    (concat "%" xml-name-re ";"))
-  ;;[67] Reference   ::= EntityRef | CharRef
-  (defvar xml-reference-re       (concat "\\(?:" xml-entity-ref "\\|" xml-char-ref-re "\\)"))
-  ;;[10]       AttValue           ::=          '"' ([^<&"] | Reference)* '"' |  "'" ([^<&'] | Reference)* "'"
-  (defvar xml-att-value-re    (concat "\\(?:\"\\(?:[^&\"]\\|" xml-reference-re "\\)*\"\\|"
-                                     "'\\(?:[^&']\\|" xml-reference-re "\\)*'\\)"))
-  ;;[56]       TokenizedType      ::=          'ID'       [VC: ID] [VC: One ID per Element Type] [VC: ID Attribute Default]
-  ;;                                            | 'IDREF'    [VC: IDREF]
-  ;;                                                 | 'IDREFS'   [VC: IDREF]
-  ;;                                            | 'ENTITY'   [VC: Entity Name]
-  ;;                                            | 'ENTITIES' [VC: Entity Name]
-  ;;                                            | 'NMTOKEN'  [VC: Name Token]
-  ;;                                            | 'NMTOKENS' [VC: Name Token]
-  (defvar xml-tokenized-type-re "\\(?:ID\\|IDREF\\|IDREFS\\|ENTITY\\|ENTITIES\\|NMTOKEN\\|NMTOKENS\\)")
-  ;;[58]       NotationType       ::=          'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
-  (defvar xml-notation-type-re (concat "\\(?:NOTATION" whitespace "(" whitespace "*" xml-name-re
-                                      "\\(?:" whitespace "*|" whitespace "*" xml-name-re "\\)*" whitespace "*)\\)"))
-  ;;[59]       Enumeration        ::=          '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'      [VC: Enumeration] [VC: No Duplicate Tokens]
-  (defvar xml-enumeration-re (concat "\\(?:(" whitespace "*" xml-nmtoken-re
-                                    "\\(?:" whitespace "*|" whitespace "*" xml-nmtoken-re "\\)*"
-                                    whitespace ")\\)"))
-  ;;[57]       EnumeratedType     ::=          NotationType | Enumeration
-  (defvar xml-enumerated-type-re (concat "\\(?:" xml-notation-type-re "\\|" xml-enumeration-re "\\)"))
-  ;;[54]       AttType    ::=          StringType | TokenizedType | EnumeratedType
-  ;;[55]       StringType         ::=          'CDATA'
-  (defvar xml-att-type-re (concat "\\(?:CDATA\\|" xml-tokenized-type-re "\\|" xml-notation-type-re"\\|" xml-enumerated-type-re "\\)"))
-  ;;[60]       DefaultDecl        ::=          '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
-  (defvar xml-default-decl-re (concat "\\(?:#REQUIRED\\|#IMPLIED\\|\\(?:#FIXED" whitespace "\\)*" xml-att-value-re "\\)"))
-  ;;[53]       AttDef     ::=          S Name S AttType S DefaultDecl
-  (defvar xml-att-def-re         (concat "\\(?:" whitespace "*" xml-name-re
-                                        whitespace "*" xml-att-type-re
-                                        whitespace "*" xml-default-decl-re "\\)"))
-  ;;[9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'
-  ;;              |  "'" ([^%&'] | PEReference | Reference)* "'"
-  (defvar xml-entity-value-re    (concat "\\(?:\"\\(?:[^%&\"]\\|" xml-pe-reference-re
-                                        "\\|" xml-reference-re "\\)*\"\\|'\\(?:[^%&']\\|"
-                                        xml-pe-reference-re "\\|" xml-reference-re "\\)*'\\)")))
-;;[75] ExternalID ::= 'SYSTEM' S SystemLiteral
-;;                 | 'PUBLIC' S PubidLiteral S SystemLiteral
-;;[76] NDataDecl ::=           S 'NDATA' S
-;;[73] EntityDef  ::= EntityValue| (ExternalID NDataDecl?)
-;;[71] GEDecl     ::= '<!ENTITY' S Name S EntityDef S? '>'
-;;[74] PEDef      ::= EntityValue | ExternalID
-;;[72] PEDecl     ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
-;;[70] EntityDecl ::= GEDecl | PEDecl
+;; The following regexps are used as subexpressions in regexps that
+;; are `eval-when-compile'd for efficiency, so they must be defined at
+;; compile time.
+(eval-and-compile
+
+;; [4] NameStartChar
+;; See the definition of word syntax in `xml-syntax-table'.
+(defconst xml-name-start-char-re (concat "[[:word:]:_]"))
+
+;; [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7
+;;                 | [#x0300-#x036F] | [#x203F-#x2040]
+(defconst xml-name-char-re (concat "[-0-9.[:word:]:_·̀-ͯ‿-⁀]"))
+
+;; [5] Name     ::= NameStartChar (NameChar)*
+(defconst xml-name-re (concat xml-name-start-char-re xml-name-char-re "*"))
+
+;; [6] Names    ::= Name (#x20 Name)*
+(defconst xml-names-re (concat xml-name-re "\\(?: " xml-name-re "\\)*"))
+
+;; [7] Nmtoken  ::= (NameChar)+
+(defconst xml-nmtoken-re (concat xml-name-char-re "+"))
+
+;; [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*
+(defconst xml-nmtokens-re (concat xml-nmtoken-re "\\(?: " xml-name-re "\\)*"))
+
+;; [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
+(defconst xml-char-ref-re  "\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)")
+
+;; [68] EntityRef   ::= '&' Name ';'
+(defconst xml-entity-ref (concat "&" xml-name-re ";"))
+
+(defconst xml-entity-or-char-ref-re (concat "&\\(?:#\\(x\\)?\\([0-9]+\\)\\|\\("
+                                           xml-name-re "\\)\\);"))
+
+;; [69] PEReference ::= '%' Name ';'
+(defconst xml-pe-reference-re (concat "%\\(" xml-name-re "\\);"))
+
+;; [67] Reference   ::= EntityRef | CharRef
+(defconst xml-reference-re (concat "\\(?:" xml-entity-ref "\\|" xml-char-ref-re "\\)"))
+
+;; [10] AttValue    ::= '"' ([^<&"] | Reference)* '"'
+;;                    | "'" ([^<&'] | Reference)* "'"
+(defconst xml-att-value-re (concat "\\(?:\"\\(?:[^&\"]\\|"
+                                  xml-reference-re "\\)*\"\\|"
+                                  "'\\(?:[^&']\\|" xml-reference-re
+                                  "\\)*'\\)"))
+
+;; [56] TokenizedType ::= 'ID'
+;;     [VC: ID] [VC: One ID / Element Type] [VC: ID Attribute Default]
+;;                      | 'IDREF'    [VC: IDREF]
+;;                      | 'IDREFS'   [VC: IDREF]
+;;                      | 'ENTITY'   [VC: Entity Name]
+;;                      | 'ENTITIES' [VC: Entity Name]
+;;                      | 'NMTOKEN'  [VC: Name Token]
+;;                      | 'NMTOKENS' [VC: Name Token]
+(defconst xml-tokenized-type-re (concat "\\(?:ID\\|IDREF\\|IDREFS\\|ENTITY\\|"
+                                       "ENTITIES\\|NMTOKEN\\|NMTOKENS\\)"))
+
+;; [58] NotationType ::= 'NOTATION' S '(' S? Name (S? '|' S? Name)* S? ')'
+(defconst xml-notation-type-re
+  (concat "\\(?:NOTATION\\s-+(\\s-*" xml-name-re
+         "\\(?:\\s-*|\\s-*" xml-name-re "\\)*\\s-*)\\)"))
+
+;; [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
+;;       [VC: Enumeration] [VC: No Duplicate Tokens]
+(defconst xml-enumeration-re (concat "\\(?:(\\s-*" xml-nmtoken-re
+                                    "\\(?:\\s-*|\\s-*" xml-nmtoken-re
+                                    "\\)*\\s-+)\\)"))
+
+;; [57] EnumeratedType ::= NotationType | Enumeration
+(defconst xml-enumerated-type-re (concat "\\(?:" xml-notation-type-re
+                                        "\\|" xml-enumeration-re "\\)"))
+
+;; [54] AttType    ::= StringType | TokenizedType | EnumeratedType
+;; [55] StringType ::= 'CDATA'
+(defconst xml-att-type-re (concat "\\(?:CDATA\\|" xml-tokenized-type-re
+                                 "\\|" xml-notation-type-re
+                                 "\\|" xml-enumerated-type-re "\\)"))
+
+;; [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' | (('#FIXED' S)? AttValue)
+(defconst xml-default-decl-re (concat "\\(?:#REQUIRED\\|#IMPLIED\\|"
+                                     "\\(?:#FIXED\\s-+\\)*"
+                                     xml-att-value-re "\\)"))
+
+;; [53] AttDef      ::= S Name S AttType S DefaultDecl
+(defconst xml-att-def-re (concat "\\(?:\\s-*" xml-name-re
+                                "\\s-*" xml-att-type-re
+                                "\\s-*" xml-default-decl-re "\\)"))
+
+;; [9] EntityValue ::= '"' ([^%&"] | PEReference | Reference)* '"'
+;;                   | "'" ([^%&'] | PEReference | Reference)* "'"
+(defconst xml-entity-value-re (concat "\\(?:\"\\(?:[^%&\"]\\|"
+                                     xml-pe-reference-re
+                                     "\\|" xml-reference-re
+                                     "\\)*\"\\|'\\(?:[^%&']\\|"
+                                     xml-pe-reference-re "\\|"
+                                     xml-reference-re "\\)*'\\)"))
+) ; End of `eval-when-compile'
+
+
+;; [75] ExternalID ::= 'SYSTEM' S SystemLiteral
+;;                   | 'PUBLIC' S PubidLiteral S SystemLiteral
+;; [76] NDataDecl ::=          S 'NDATA' S
+;; [73] EntityDef  ::= EntityValue| (ExternalID NDataDecl?)
+;; [71] GEDecl     ::= '<!ENTITY' S Name S EntityDef S? '>'
+;; [74] PEDef      ::= EntityValue | ExternalID
+;; [72] PEDecl     ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
+;; [70] EntityDecl ::= GEDecl | PEDecl
 
 ;; Note that this is setup so that we can do whitespace-skipping with
 ;; `(skip-syntax-forward " ")', inter alia.  Previously this was slow
-;; compared with `re-search-forward', but that has been fixed.  Also
-;; note that the standard syntax table contains other characters with
-;; whitespace syntax, like NBSP, but they are invalid in contexts in
-;; which we might skip whitespace -- specifically, they're not
-;; NameChars [XML 4].
+;; compared with `re-search-forward', but that has been fixed.
 
 (defvar xml-syntax-table
-  (let ((table (make-syntax-table)))
-    ;; Get space syntax correct per XML [3].
-    (dotimes (c 31)
-      (modify-syntax-entry c "." table)) ; all are space in standard table
-    (dolist (c '(?\t ?\n ?\r))          ; these should be space
+  ;; By default, characters have symbol syntax.
+  (let ((table (make-char-table 'syntax-table '(3))))
+    ;; The XML space chars [3], and nothing else, have space syntax.
+    (dolist (c '(?\s ?\t ?\r ?\n))
       (modify-syntax-entry c " " table))
-    ;; For skipping attributes.
-    (modify-syntax-entry ?\" "\"" table)
-    (modify-syntax-entry ?' "\"" table)
-    ;; Non-alnum name chars should be symbol constituents (`-' and `_'
-    ;; are OK by default).
-    (modify-syntax-entry ?. "_" table)
-    (modify-syntax-entry ?: "_" table)
-    ;; XML [89]
-    (unless (featurep 'xemacs)
-      (dolist (c '(#x00B7 #x02D0 #x02D1 #x0387 #x0640 #x0E46 #x0EC6 #x3005
-                         #x3031 #x3032 #x3033 #x3034 #x3035 #x309D #x309E #x30FC
-                         #x30FD #x30FE))
-       (modify-syntax-entry (decode-char 'ucs c) "w" table)))
-    ;; Fixme: rest of [4]
+    ;; The characters in NameStartChar [4], aside from ':' and '_',
+    ;; have word syntax.  This is used by `xml-name-start-char-re'.
+    (modify-syntax-entry '(?A . ?Z)         "w" table)
+    (modify-syntax-entry '(?a . ?z)         "w" table)
+    (modify-syntax-entry '(#xC0  . #xD6)    "w" table)
+    (modify-syntax-entry '(#xD8  . #XF6)    "w" table)
+    (modify-syntax-entry '(#xF8  . #X2FF)   "w" table)
+    (modify-syntax-entry '(#x370 . #X37D)   "w" table)
+    (modify-syntax-entry '(#x37F . #x1FFF)  "w" table)
+    (modify-syntax-entry '(#x200C . #x200D) "w" table)
+    (modify-syntax-entry '(#x2070 . #x218F) "w" table)
+    (modify-syntax-entry '(#x2C00 . #x2FEF) "w" table)
+    (modify-syntax-entry '(#x3001 . #xD7FF) "w" table)
+    (modify-syntax-entry '(#xF900 . #xFDCF) "w" table)
+    (modify-syntax-entry '(#xFDF0 . #xFFFD) "w" table)
+    (modify-syntax-entry '(#x10000 . #xEFFFF) "w" table)
     table)
-  "Syntax table used by `xml-parse-region'.")
+  "Syntax table used by the XML parser.
+In this syntax table, the XML space characters [ \\t\\r\\n], and
+only those characters, have whitespace syntax.")
 
-;; XML [5]
-;; Note that [:alpha:] matches all multibyte chars with word syntax.
-(eval-and-compile
-  (defconst xml-name-regexp "[[:alpha:]_:][[:alnum:]._:-]*"))
+;;; Entry points:
 
-;; Fixme:  This needs re-writing to deal with the XML grammar properly, i.e.
-;;   document    ::=    prolog element Misc*
-;;   prolog    ::=    XMLDecl? Misc* (doctypedecl Misc*)?
+;;;###autoload
+(defun xml-parse-file (file &optional parse-dtd parse-ns)
+  "Parse the well-formed XML file FILE.
+Return the top node with all its children.
+If PARSE-DTD is non-nil, the DTD is parsed rather than skipped.
+If PARSE-NS is non-nil, then QNAMES are expanded."
+  (with-temp-buffer
+    (insert-file-contents file)
+    (xml--parse-buffer parse-dtd parse-ns)))
 
 ;;;###autoload
-(defun xml-parse-region (beg end &optional buffer parse-dtd parse-ns)
+(defun xml-parse-region (&optional beg end buffer parse-dtd parse-ns)
   "Parse the region from BEG to END in BUFFER.
+Return the XML parse tree, or raise an error if the region does
+not contain well-formed XML.
+
+If BEG is nil, it defaults to `point-min'.
+If END is nil, it defaults to `point-max'.
 If BUFFER is nil, it defaults to the current buffer.
-Returns the XML list for the region, or raises an error if the region
-is not well-formed XML.
-If PARSE-DTD is non-nil, the DTD is parsed rather than skipped,
-and returned as the first element of the list.
-If PARSE-NS is non-nil, then QNAMES are expanded."
+If PARSE-DTD is non-nil, parse the DTD and return it as the first
+element of the list.
+If PARSE-NS is non-nil, expand QNAMES."
   ;; Use fixed syntax table to ensure regexp char classes and syntax
   ;; specs DTRT.
-  (with-syntax-table (standard-syntax-table)
+  (unless buffer
+    (setq buffer (current-buffer)))
+  (with-temp-buffer
+    (insert-buffer-substring-no-properties buffer beg end)
+    (xml--parse-buffer parse-dtd parse-ns)))
+
+;; XML [5]
+
+;; Fixme:  This needs re-writing to deal with the XML grammar properly, i.e.
+;;   document  ::=  prolog element Misc*
+;;   prolog    ::=  XMLDecl? Misc* (doctypedecl Misc*)?
+
+(defun xml--parse-buffer (parse-dtd parse-ns)
+  (with-syntax-table xml-syntax-table
     (let ((case-fold-search nil)       ; XML is case-sensitive.
+         ;; Prevent entity definitions from changing the defaults
+         (xml-entity-alist xml-entity-alist)
+         (xml-parameter-entity-alist xml-parameter-entity-alist)
          xml result dtd)
-      (save-excursion
-       (if buffer
-           (set-buffer buffer))
-       (save-restriction
-         (narrow-to-region beg end)
-         (goto-char (point-min))
-         (while (not (eobp))
-           (if (search-forward "<" nil t)
-               (progn
-                 (forward-char -1)
-                 (setq result (xml-parse-tag parse-dtd parse-ns))
-                 (cond
-                  ((null result)
-                   ;; Not looking at an xml start tag.
-                   (unless (eobp)
-                     (forward-char 1)))
-                  ((and xml (not xml-sub-parser))
-                   ;; Translation of rule [1] of XML specifications
-                   (error "XML: (Not Well-Formed) Only one root tag allowed"))
-                  ((and (listp (car result))
-                        parse-dtd)
-                   (setq dtd (car result))
-                   (if (cdr result)    ; possible leading comment
-                       (add-to-list 'xml (cdr result))))
-                  (t
-                   (add-to-list 'xml result))))
-             (goto-char (point-max))))
-         (if parse-dtd
-             (cons dtd (nreverse xml))
-           (nreverse xml)))))))
+      (goto-char (point-min))
+      (while (not (eobp))
+       (if (search-forward "<" nil t)
+           (progn
+             (forward-char -1)
+             (setq result (xml-parse-tag-1 parse-dtd parse-ns))
+             (cond
+              ((null result)
+               ;; Not looking at an xml start tag.
+               (unless (eobp)
+                 (forward-char 1)))
+              ((and xml (not xml-sub-parser))
+               ;; Translation of rule [1] of XML specifications
+               (error "XML: (Not Well-Formed) Only one root tag allowed"))
+              ((and (listp (car result))
+                    parse-dtd)
+               (setq dtd (car result))
+               (if (cdr result)        ; possible leading comment
+                   (add-to-list 'xml (cdr result))))
+              (t
+               (add-to-list 'xml result))))
+         (goto-char (point-max))))
+      (if parse-dtd
+         (cons dtd (nreverse xml))
+       (nreverse xml)))))
 
 (defun xml-maybe-do-ns (name default xml-ns)
   "Perform any namespace expansion.
@@ -363,48 +400,41 @@ specify that the name shouldn't be given a namespace."
         (cons ns (if special "" lname)))
     (intern name)))
 
-(defun xml-parse-fragment (&optional parse-dtd parse-ns)
-  "Parse xml-like fragments."
-  (let ((xml-sub-parser t)
-       children)
-    (while (not (eobp))
-      (let ((bit (xml-parse-tag
-                 parse-dtd parse-ns)))
-       (if children
-           (setq children (append (list bit) children))
-         (if (stringp bit)
-             (setq children (list bit))
-           (setq children bit)))))
-    (reverse children)))
-
 (defun xml-parse-tag (&optional parse-dtd parse-ns)
   "Parse the tag at point.
 If PARSE-DTD is non-nil, the DTD of the document, if any, is parsed and
 returned as the first element in the list.
-If PARSE-NS is non-nil, then QNAMES are expanded.
-Returns one of:
+If PARSE-NS is non-nil, expand QNAMES; if the value of PARSE-NS
+is a list, use it as an alist mapping namespaces to URIs.
+
+Return one of:
  - a list : the matching node
  - nil    : the point is not looking at a tag.
  - a pair : the first element is the DTD, the second is the node."
+  (let* ((case-fold-search nil)
+        ;; Prevent entity definitions from changing the defaults
+        (xml-entity-alist xml-entity-alist)
+        (xml-parameter-entity-alist xml-parameter-entity-alist)
+        (buf (current-buffer))
+        (pos (point)))
+    (with-temp-buffer
+      (with-syntax-table xml-syntax-table
+       (insert-buffer-substring-no-properties buf pos)
+       (goto-char (point-min))
+       (xml-parse-tag-1 parse-dtd parse-ns)))))
+
+(defun xml-parse-tag-1 (&optional parse-dtd parse-ns)
+  "Like `xml-parse-tag', but possibly modify the buffer while working."
   (let ((xml-validating-parser (or parse-dtd xml-validating-parser))
-       (xml-ns (if (consp parse-ns)
-                   parse-ns
-                 (if parse-ns
-                     (list
-                      ;; Default for empty prefix is no namespace
-                      (cons ""      "")
-                      ;; "xml" namespace
-                      (cons "xml"   "http://www.w3.org/XML/1998/namespace")
-                      ;; We need to seed the xmlns namespace
-                      (cons "xmlns" "http://www.w3.org/2000/xmlns/"))))))
+       (xml-ns (cond ((consp parse-ns) parse-ns)
+                     (parse-ns xml-default-ns))))
     (cond
-     ;; Processing instructions (like the <?xml version="1.0"?> tag at the
-     ;; beginning of a document).
+     ;; Processing instructions, like <?xml version="1.0"?>.
      ((looking-at "<\\?")
       (search-forward "?>")
       (skip-syntax-forward " ")
-      (xml-parse-tag parse-dtd xml-ns))
-     ;;  Character data (CDATA) sections, in which no tag should be interpreted
+      (xml-parse-tag-1 parse-dtd xml-ns))
+     ;; Character data (CDATA) sections, in which no tag should be interpreted
      ((looking-at "<!\\[CDATA\\[")
       (let ((pos (match-end 0)))
        (unless (search-forward "]]>" nil t)
@@ -412,32 +442,32 @@ Returns one of:
        (concat
         (buffer-substring-no-properties pos (match-beginning 0))
         (xml-parse-string))))
-     ;;  DTD for the document
-     ((looking-at "<!DOCTYPE")
+     ;; DTD for the document
+     ((looking-at "<!DOCTYPE[ \t\n\r]")
       (let ((dtd (xml-parse-dtd parse-ns)))
        (skip-syntax-forward " ")
        (if xml-validating-parser
-           (cons dtd (xml-parse-tag nil xml-ns))
-         (xml-parse-tag nil xml-ns))))
-     ;;  skip comments
+           (cons dtd (xml-parse-tag-1 nil xml-ns))
+         (xml-parse-tag-1 nil xml-ns))))
+     ;; skip comments
      ((looking-at "<!--")
       (search-forward "-->")
+      ;; FIXME: This loses the skipped-over spaces.
       (skip-syntax-forward " ")
       (unless (eobp)
-       (xml-parse-tag parse-dtd xml-ns)))
-     ;;  end tag
+       (let ((xml-sub-parser t))
+         (xml-parse-tag-1 parse-dtd xml-ns))))
+     ;; end tag
      ((looking-at "</")
       '())
-     ;;  opening tag
-     ((looking-at "<\\([^/>[:space:]]+\\)")
+     ;; opening tag
+     ((looking-at (eval-when-compile (concat "<\\(" xml-name-re "\\)")))
       (goto-char (match-end 1))
-
       ;; Parse this node
       (let* ((node-name (match-string-no-properties 1))
             ;; Parse the attribute list.
             (attrs (xml-parse-attlist xml-ns))
             children)
-
        ;; add the xmlns:* attrs to our cache
        (when (consp xml-ns)
          (dolist (attr attrs)
@@ -446,70 +476,114 @@ Returns one of:
                              (caar attr)))
              (push (cons (cdar attr) (cdr attr))
                    xml-ns))))
-
        (setq children (list attrs (xml-maybe-do-ns node-name "" xml-ns)))
+       (cond
+        ;; is this an empty element ?
+        ((looking-at "/>")
+         (forward-char 2)
+         (nreverse children))
+        ;; is this a valid start tag ?
+        ((eq (char-after) ?>)
+         (forward-char 1)
+         ;; Now check that we have the right end-tag.
+         (let ((end (concat "</" node-name "\\s-*>")))
+           (while (not (looking-at end))
+             (cond
+              ((eobp)
+               (error "XML: (Not Well-Formed) End of document while reading element `%s'"
+                      node-name))
+              ((looking-at "</")
+               (forward-char 2)
+               (error "XML: (Not Well-Formed) Invalid end tag `%s' (expecting `%s')"
+                      (let ((pos (point)))
+                        (buffer-substring pos (if (re-search-forward "\\s-*>" nil t)
+                                                  (match-beginning 0)
+                                                (point-max))))
+                      node-name))
+              ;; Read a sub-element and push it onto CHILDREN.
+              ((= (char-after) ?<)
+               (let ((tag (xml-parse-tag-1 nil xml-ns)))
+                 (when tag
+                   (push tag children))))
+              ;; Read some character data.
+              (t
+               (let ((expansion (xml-parse-string)))
+                 (push (if (stringp (car children))
+                           ;; If two strings were separated by a
+                           ;; comment, concat them.
+                           (concat (pop children) expansion)
+                         expansion)
+                       children)))))
+           ;; Move point past the end-tag.
+           (goto-char (match-end 0))
+           (nreverse children)))
+        ;; Otherwise this was an invalid start tag (expected ">" not found.)
+        (t
+         (error "XML: (Well-Formed) Couldn't parse tag: %s"
+                (buffer-substring-no-properties (- (point) 10) (+ (point) 1)))))))
 
-       ;; is this an empty element ?
-       (if (looking-at "/>")
-           (progn
-             (forward-char 2)
-             (nreverse children))
-
-         ;; is this a valid start tag ?
-         (if (eq (char-after) ?>)
-             (progn
-               (forward-char 1)
-               ;;  Now check that we have the right end-tag. Note that this
-               ;;  one might contain spaces after the tag name
-               (let ((end (concat "</" node-name "\\s-*>")))
-                 (while (not (looking-at end))
-                   (cond
-                    ((looking-at "</")
-                     (error "XML: (Not Well-Formed) Invalid end tag (expecting %s) at pos %d"
-                            node-name (point)))
-                    ((= (char-after) ?<)
-                     (let ((tag (xml-parse-tag nil xml-ns)))
-                       (when tag
-                         (push tag children))))
-                    (t
-                     (let ((expansion (xml-parse-string)))
-                       (setq children
-                             (if (stringp expansion)
-                                 (if (stringp (car children))
-                                     ;; The two strings were separated by a comment.
-                                     (setq children (append (list (concat (car children) expansion))
-                                                            (cdr children)))
-                                   (setq children (append (list expansion) children)))
-                               (setq children (append expansion children))))))))
-
-                 (goto-char (match-end 0))
-                 (nreverse children)))
-           ;;  This was an invalid start tag (Expected ">", but didn't see it.)
-           (error "XML: (Well-Formed) Couldn't parse tag: %s"
-                  (buffer-substring-no-properties (- (point) 10) (+ (point) 1)))))))
-     (t        ;; (Not one of PI, CDATA, Comment, End tag, or Start tag)
-      (unless xml-sub-parser           ; Usually, we error out.
+     ;; (Not one of PI, CDATA, Comment, End tag, or Start tag)
+     (t
+      (unless xml-sub-parser   ; Usually, we error out.
        (error "XML: (Well-Formed) Invalid character"))
-
       ;; However, if we're parsing incrementally, then we need to deal
       ;; with stray CDATA.
       (xml-parse-string)))))
 
 (defun xml-parse-string ()
-  "Parse the next whatever.  Could be a string, or an element."
-  (let* ((pos (point))
-        (string (progn (skip-chars-forward "^<")
-                       (buffer-substring-no-properties pos (point)))))
-    ;; Clean up the string.  As per XML specifications, the XML
-    ;; processor should always pass the whole string to the
-    ;; application.  But \r's should be replaced:
-    ;; http://www.w3.org/TR/2000/REC-xml-20001006#sec-line-ends
-    (setq pos 0)
-    (while (string-match "\r\n?" string pos)
-      (setq string (replace-match "\n" t t string))
-      (setq pos (1+ (match-beginning 0))))
-
-    (xml-substitute-special string)))
+  "Parse character data at point, and return it as a string.
+Leave point at the start of the next thing to parse.  This
+function can modify the buffer by expanding entity and character
+references."
+  (let ((start (point))
+       ;; Keep track of the size of the rest of the buffer:
+       (old-remaining-size (- (buffer-size) (point)))
+       ref val)
+    (while (and (not (eobp))
+               (not (looking-at "<")))
+      ;; Find the next < or & character.
+      (skip-chars-forward "^<&")
+      (when (eq (char-after) ?&)
+       ;; If we find an entity or character reference, expand it.
+       (unless (looking-at xml-entity-or-char-ref-re)
+         (error "XML: (Not Well-Formed) Invalid entity reference"))
+       ;; For a character reference, the next entity or character
+       ;; reference must be after the replacement.  [4.6] "Numerical
+       ;; character references are expanded immediately when
+       ;; recognized and MUST be treated as character data."
+       (if (setq ref (match-string 2))
+           (progn  ; Numeric char reference
+             (setq val (save-match-data
+                         (decode-char 'ucs (string-to-number
+                                            ref (if (match-string 1) 16)))))
+             (and (null val)
+                  xml-validating-parser
+                  (error "XML: (Validity) Invalid character reference `%s'"
+                         (match-string 0)))
+             (replace-match (or (string val) xml-undefined-entity) t t))
+         ;; For an entity reference, search again from the start of
+         ;; the replaced text, since the replacement can contain
+         ;; entity or character references, or markup.
+         (setq ref (match-string 3)
+               val (assoc ref xml-entity-alist))
+         (and (null val)
+              xml-validating-parser
+              (error "XML: (Validity) Undefined entity `%s'" ref))
+         (replace-match (cdr val) t t)
+         (goto-char (match-beginning 0)))
+       ;; Check for XML bombs.
+       (and xml-entity-expansion-limit
+            (> (- (buffer-size) (point))
+               (+ old-remaining-size xml-entity-expansion-limit))
+            (error "XML: Entity reference expansion \
+surpassed `xml-entity-expansion-limit'"))))
+    ;; [2.11] Clean up line breaks.
+    (let ((end-marker (point-marker)))
+      (goto-char start)
+      (while (re-search-forward "\r\n?" end-marker t)
+       (replace-match "\n" t t))
+      (goto-char end-marker)
+      (buffer-substring start (point)))))
 
 (defun xml-parse-attlist (&optional xml-ns)
   "Return the attribute-list after point.
@@ -518,7 +592,7 @@ Leave point at the first non-blank character after the tag."
        end-pos name)
     (skip-syntax-forward " ")
     (while (looking-at (eval-when-compile
-                        (concat "\\(" xml-name-regexp "\\)\\s-*=\\s-*")))
+                        (concat "\\(" xml-name-re "\\)\\s-*=\\s-*")))
       (setq end-pos (match-end 0))
       (setq name (xml-maybe-do-ns (match-string-no-properties 1) nil xml-ns))
       (goto-char end-pos)
@@ -543,8 +617,9 @@ Leave point at the first non-blank character after the tag."
        (replace-regexp-in-string "\\s-\\{2,\\}" " " string)
        (let ((expansion (xml-substitute-special string)))
          (unless (stringp expansion)
-                                       ; We say this is the constraint.  It is actually that neither
-                                       ; external entities nor "<" can be in an attribute value.
+           ;; We say this is the constraint.  It is actually that
+           ;; neither external entities nor "<" can be in an
+           ;; attribute value.
            (error "XML: (Not Well-Formed) Entities in attributes cannot expand into elements"))
          (push (cons name expansion) attlist)))
 
@@ -552,15 +627,11 @@ Leave point at the first non-blank character after the tag."
       (skip-syntax-forward " "))
     (nreverse attlist)))
 
-;;*******************************************************************
-;;**
-;;**  The DTD (document type declaration)
-;;**  The following functions know how to skip or parse the DTD of
-;;**  a document
-;;**
-;;*******************************************************************
+;;; DTD (document type declaration)
 
-;; Fixme: This fails at least if the DTD contains conditional sections.
+;; The following functions know how to skip or parse the DTD of a
+;; document.  FIXME: it fails at least if the DTD contains conditional
+;; sections.
 
 (defun xml-skip-dtd ()
   "Skip the DTD at point.
@@ -577,13 +648,14 @@ This follows the rule [28] in the XML specifications."
       (error "XML: (Validity) Invalid DTD (expecting name of the document)"))
 
   ;;  Get the name of the document
-  (looking-at xml-name-regexp)
+  (looking-at xml-name-re)
   (let ((dtd (list (match-string-no-properties 0) 'dtd))
-       type element end-pos)
+       (xml-parameter-entity-alist xml-parameter-entity-alist)
+       next-parameter-entity)
     (goto-char (match-end 0))
-
     (skip-syntax-forward " ")
-    ;; XML [75]
+
+    ;; External subset (XML [75])
     (cond ((looking-at "PUBLIC\\s-+")
           (goto-char (match-end 0))
           (unless (or (re-search-forward
@@ -606,119 +678,185 @@ This follows the rule [28] in the XML specifications."
             (error "XML: Missing System ID"))
           (push (list (match-string-no-properties 1) 'system) dtd)))
     (skip-syntax-forward " ")
-    (if (eq ?> (char-after))
-       (forward-char)
-      (if (not (eq (char-after) ?\[))
-         (error "XML: Bad DTD")
+
+    (if (eq (char-after) ?>)
+
+       ;; No internal subset
        (forward-char)
-       ;;  Parse the rest of the DTD
-       ;;  Fixme: Deal with NOTATION, PIs.
-       (while (not (looking-at "\\s-*\\]"))
-         (skip-syntax-forward " ")
-         (cond
-
-          ;;  Translation of rule [45] of XML specifications
-          ((looking-at
-            "<!ELEMENT\\s-+\\([[:alnum:].%;]+\\)\\s-+\\([^>]+\\)>")
-
-           (setq element (match-string-no-properties 1)
-                 type    (match-string-no-properties 2))
-           (setq end-pos (match-end 0))
 
-           ;;  Translation of rule [46] of XML specifications
+      ;; Internal subset (XML [28b])
+      (unless (eq (char-after) ?\[)
+       (error "XML: Bad DTD"))
+      (forward-char)
+
+      ;; [2.8]: "markup declarations may be made up in whole or in
+      ;; part of the replacement text of parameter entities."
+
+      ;; Since parameter entities are valid only within the DTD, we
+      ;; first search for the position of the next possible parameter
+      ;; entity.  Then, search for the next DTD element; if it ends
+      ;; before the next parameter entity, expand the parameter entity
+      ;; and try again.
+      (setq next-parameter-entity
+           (save-excursion
+             (if (re-search-forward xml-pe-reference-re nil t)
+                 (match-beginning 0))))
+
+      ;; Parse the rest of the DTD
+      ;; Fixme: Deal with NOTATION, PIs.
+      (while (not (looking-at "\\s-*\\]"))
+       (skip-syntax-forward " ")
+       (cond
+        ((eobp)
+         (error "XML: (Well-Formed) End of document while reading DTD"))
+        ;; Element declaration [45]:
+        ((and (looking-at (eval-when-compile
+                            (concat "<!ELEMENT\\s-+\\(" xml-name-re
+                                    "\\)\\s-+\\([^>]+\\)>")))
+              (or (null next-parameter-entity)
+                  (<= (match-end 0) next-parameter-entity)))
+         (let ((element (match-string-no-properties 1))
+               (type    (match-string-no-properties 2))
+               (end-pos (match-end 0)))
+           ;; Translation of rule [46] of XML specifications
            (cond
-            ((string-match "^EMPTY[ \t\n\r]*$" type) ;; empty declaration
+            ((string-match "\\`EMPTY\\s-*\\'" type)  ; empty declaration
              (setq type 'empty))
-            ((string-match "^ANY[ \t\n\r]*$" type) ;; any type of contents
+            ((string-match "\\`ANY\\s-*$" type)      ; any type of contents
              (setq type 'any))
-            ((string-match "^(\\(.*\\))[ \t\n\r]*$" type) ;; children ([47])
-             (setq type (xml-parse-elem-type (match-string-no-properties 1 type))))
-            ((string-match "^%[^;]+;[ \t\n\r]*$" type) ;; substitution
+            ((string-match "\\`(\\(.*\\))\\s-*\\'" type) ; children ([47])
+             (setq type (xml-parse-elem-type
+                         (match-string-no-properties 1 type))))
+            ((string-match "^%[^;]+;[ \t\n\r]*\\'" type) ; substitution
              nil)
-            (t
-             (if xml-validating-parser
-                 (error "XML: (Validity) Invalid element type in the DTD"))))
+            (xml-validating-parser
+             (error "XML: (Validity) Invalid element type in the DTD")))
 
-           ;;  rule [45]: the element declaration must be unique
-           (if (and (assoc element dtd)
-                    xml-validating-parser)
-               (error "XML: (Validity) Element declarations must be unique in a DTD (<%s>)"
-                      element))
+           ;; rule [45]: the element declaration must be unique
+           (and (assoc element dtd)
+                xml-validating-parser
+                (error "XML: (Validity) DTD element declarations must be unique (<%s>)"
+                       element))
 
            ;;  Store the element in the DTD
            (push (list element type) dtd)
-           (goto-char end-pos))
-
-          ;; Translation of rule [52] of XML specifications
-          ((looking-at (concat "<!ATTLIST[ \t\n\r]*\\(" xml-name-re
-                               "\\)[ \t\n\r]*\\(" xml-att-def-re
-                               "\\)*[ \t\n\r]*>"))
-
-           ;; We don't do anything with ATTLIST currently
-           (goto-char (match-end 0)))
-
-          ((looking-at "<!--")
-           (search-forward "-->"))
-          ((looking-at (concat "<!ENTITY[ \t\n\r]*\\(" xml-name-re
-                               "\\)[ \t\n\r]*\\(" xml-entity-value-re
-                               "\\)[ \t\n\r]*>"))
-           (let ((name  (match-string-no-properties 1))
-                 (value (substring (match-string-no-properties 2) 1
-                                   (- (length (match-string-no-properties 2)) 1))))
-             (goto-char (match-end 0))
-             (setq xml-entity-alist
-                   (append xml-entity-alist
-                           (list (cons name
-                                       (with-temp-buffer
-                                         (insert value)
-                                         (goto-char (point-min))
-                                         (xml-parse-fragment
-                                          xml-validating-parser
-                                          parse-ns))))))))
-          ((or (looking-at (concat "<!ENTITY[ \t\n\r]+\\(" xml-name-re
-                                   "\\)[ \t\n\r]+SYSTEM[ \t\n\r]+"
-                                   "\\(\"[^\"]*\"\\|'[^']*'\\)[ \t\n\r]*>"))
-               (looking-at (concat "<!ENTITY[ \t\n\r]+\\(" xml-name-re
-                                   "\\)[ \t\n\r]+PUBLIC[ \t\n\r]+"
-                                   "\"[- \r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*\""
-                                   "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'"
-                                   "[ \t\n\r]+\\(\"[^\"]*\"\\|'[^']*'\\)"
-                                   "[ \t\n\r]*>")))
-           (let ((name  (match-string-no-properties 1))
-                 (file  (substring (match-string-no-properties 2) 1
-                                   (- (length (match-string-no-properties 2)) 1))))
-             (goto-char (match-end 0))
-             (setq xml-entity-alist
-                   (append xml-entity-alist
-                           (list (cons name (with-temp-buffer
-                                              (insert-file-contents file)
-                                              (goto-char (point-min))
-                                              (xml-parse-fragment
-                                               xml-validating-parser
-                                               parse-ns))))))))
-          ;; skip parameter entity declarations
-          ((or (looking-at (concat "<!ENTITY[ \t\n\r]+%[ \t\n\r]+\\(" xml-name-re
-                                   "\\)[ \t\n\r]+SYSTEM[ \t\n\r]+"
-                                   "\\(\"[^\"]*\"\\|'[^']*'\\)[ \t\n\r]*>"))
-               (looking-at (concat "<!ENTITY[ \t\n\r]+"
-                                   "%[ \t\n\r]+"
-                                   "\\(" xml-name-re "\\)[ \t\n\r]+"
-                                   "PUBLIC[ \t\n\r]+"
-                                   "\\(\"[- \r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*\""
-                                   "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'\\)[ \t\n\r]+"
-                                   "\\(\"[^\"]+\"\\|'[^']+'\\)"
-                                   "[ \t\n\r]*>")))
-           (goto-char (match-end 0)))
-          ;; skip parameter entities
-          ((looking-at (concat "%" xml-name-re ";"))
-           (goto-char (match-end 0)))
-          (t
-           (when xml-validating-parser
-             (error "XML: (Validity) Invalid DTD item"))))))
+           (goto-char end-pos)))
+
+        ;; Attribute-list declaration [52] (currently unsupported):
+        ((and (looking-at (eval-when-compile
+                            (concat "<!ATTLIST[ \t\n\r]*\\(" xml-name-re
+                                    "\\)[ \t\n\r]*\\(" xml-att-def-re
+                                    "\\)*[ \t\n\r]*>")))
+              (or (null next-parameter-entity)
+                  (<= (match-end 0) next-parameter-entity)))
+         (goto-char (match-end 0)))
+
+        ;; Comments (skip to end, ignoring parameter entity):
+        ((looking-at "<!--")
+         (search-forward "-->")
+         (and next-parameter-entity
+              (> (point) next-parameter-entity)
+              (setq next-parameter-entity
+                    (save-excursion
+                      (if (re-search-forward xml-pe-reference-re nil t)
+                          (match-beginning 0))))))
+
+        ;; Internal entity declarations:
+        ((and (looking-at (eval-when-compile
+                            (concat "<!ENTITY[ \t\n\r]+\\(%[ \t\n\r]+\\)?\\("
+                                    xml-name-re "\\)[ \t\n\r]*\\("
+                                    xml-entity-value-re "\\)[ \t\n\r]*>")))
+              (or (null next-parameter-entity)
+                  (<= (match-end 0) next-parameter-entity)))
+         (let* ((name (prog1 (match-string-no-properties 2)
+                        (goto-char (match-end 0))))
+                (alist (if (match-string 1)
+                           'xml-parameter-entity-alist
+                         'xml-entity-alist))
+                ;; Retrieve the deplacement text:
+                (value (xml--entity-replacement-text
+                        ;; Entity value, sans quotation marks:
+                        (substring (match-string-no-properties 3) 1 -1))))
+           ;; If the same entity is declared more than once, the
+           ;; first declaration is binding.
+           (unless (assoc name (symbol-value alist))
+             (set alist (cons (cons name value) (symbol-value alist))))))
+
+        ;; External entity declarations (currently unsupported):
+        ((and (or (looking-at (eval-when-compile
+                                (concat "<!ENTITY[ \t\n\r]+\\(%[ \t\n\r]+\\)?\\("
+                                        xml-name-re "\\)[ \t\n\r]+SYSTEM[ \t\n\r]+"
+                                        "\\(\"[^\"]*\"\\|'[^']*'\\)[ \t\n\r]*>")))
+                  (looking-at (eval-when-compile
+                                (concat "<!ENTITY[ \t\n\r]+\\(%[ \t\n\r]+\\)?\\("
+                                        xml-name-re "\\)[ \t\n\r]+PUBLIC[ \t\n\r]+"
+                                        "\"[- \r\na-zA-Z0-9'()+,./:=?;!*#@$_%]*\""
+                                        "\\|'[- \r\na-zA-Z0-9()+,./:=?;!*#@$_%]*'"
+                                        "[ \t\n\r]+\\(\"[^\"]*\"\\|'[^']*'\\)"
+                                        "[ \t\n\r]*>"))))
+              (or (null next-parameter-entity)
+                  (<= (match-end 0) next-parameter-entity)))
+         (goto-char (match-end 0)))
+
+        ;; If a parameter entity is in the way, expand it.
+        (next-parameter-entity
+         (save-excursion
+           (goto-char next-parameter-entity)
+           (unless (looking-at xml-pe-reference-re)
+             (error "XML: Internal error"))
+           (let* ((entity (match-string 1))
+                  (beg    (point-marker))
+                  (elt    (assoc entity xml-parameter-entity-alist)))
+             (if elt
+                 (progn
+                   (replace-match (cdr elt) t t)
+                   ;; The replacement can itself be a parameter entity.
+                   (goto-char next-parameter-entity))
+               (goto-char (match-end 0))))
+           (setq next-parameter-entity
+                 (if (re-search-forward xml-pe-reference-re nil t)
+                     (match-beginning 0)))))
+
+        ;; Anything else is garbage (ignored if not validating).
+        (xml-validating-parser
+         (error "XML: (Validity) Invalid DTD item"))
+        (t
+         (skip-chars-forward "^]"))))
+
       (if (looking-at "\\s-*]>")
          (goto-char (match-end 0))))
     (nreverse dtd)))
 
+(defun xml--entity-replacement-text (string)
+  "Return the replacement text for the entity value STRING.
+The replacement text is obtained by replacing character
+references and parameter-entity references."
+  (let ((ref-re (eval-when-compile
+                 (concat "\\(?:&#\\([0-9]+\\)\\|&#x\\([0-9a-fA-F]+\\)\\|%\\("
+                         xml-name-re "\\)\\);")))
+       children)
+    (while (string-match ref-re string)
+      (push (substring string 0 (match-beginning 0)) children)
+      (let ((remainder (substring string (match-end 0)))
+           ref val)
+       (cond ((setq ref (match-string 1 string))
+              ;; Decimal character reference
+              (setq val (decode-char 'ucs (string-to-number ref)))
+              (if val (push (string val) children)))
+             ;; Hexadecimal character reference
+             ((setq ref (match-string 2 string))
+              (setq val (decode-char 'ucs (string-to-number ref 16)))
+              (if val (push (string val) children)))
+             ;; Parameter entity reference
+             ((setq ref (match-string 3 string))
+              (setq val (assoc ref xml-parameter-entity-alist))
+              (and (null val)
+                   xml-validating-parser
+                   (error "XML: (Validity) Undefined parameter entity `%s'" ref))
+              (push (or (cdr val) xml-undefined-entity) children)))
+       (setq string remainder)))
+    (mapconcat 'identity (nreverse (cons string children)) "")))
+
 (defun xml-parse-elem-type (string)
   "Convert element type STRING into a Lisp structure."
 
@@ -752,79 +890,43 @@ This follows the rule [28] in the XML specifications."
      (t
       elem))))
 
-;;*******************************************************************
-;;**
-;;**  Substituting special XML sequences
-;;**
-;;*******************************************************************
+;;; Substituting special XML sequences
 
 (defun xml-substitute-special (string)
-  "Return STRING, after substituting entity references."
-  ;; This originally made repeated passes through the string from the
-  ;; beginning, which isn't correct, since then either "&amp;amp;" or
-  ;; "&#38;amp;" won't DTRT.
-
-  (let ((point 0)
-       children end-point)
-    (while (string-match "&\\([^;]*\\);" string point)
-      (setq end-point (match-end 0))
-      (let* ((this-part (match-string-no-properties 1 string))
-            (prev-part (substring string point (match-beginning 0)))
-            (entity (assoc this-part xml-entity-alist))
-            (expansion
-             (cond ((string-match "#\\([0-9]+\\)" this-part)
-                    (let ((c (decode-char
-                              'ucs
-                              (string-to-number (match-string-no-properties 1 this-part)))))
-                      (if c (string c))))
-                   ((string-match "#x\\([[:xdigit:]]+\\)" this-part)
-                    (let ((c (decode-char
-                              'ucs
-                              (string-to-number (match-string-no-properties 1 this-part) 16))))
-                      (if c (string c))))
-                   (entity
-                    (cdr entity))
-                   ((eq (length this-part) 0)
-                    (error "XML: (Not Well-Formed) No entity given"))
-                   (t
-                    (if xml-validating-parser
-                        (error "XML: (Validity) Undefined entity `%s'"
-                               this-part)
-                      xml-undefined-entity)))))
-
-       (cond ((null children)
-              ;; FIXME: If we have an entity that expands into XML, this won't work.
-              (setq children
-                    (concat prev-part expansion)))
-             ((stringp children)
-              (if (stringp expansion)
-                  (setq children (concat children prev-part expansion))
-                (setq children (list expansion (concat prev-part children)))))
-             ((and (stringp expansion)
-                   (stringp (car children)))
-              (setcar children (concat prev-part expansion (car children))))
-             ((stringp expansion)
-              (setq children (append (concat prev-part expansion)
-                                     children)))
-             ((stringp (car children))
-              (setcar children (concat (car children) prev-part))
-              (setq children (append expansion children)))
-             (t
-              (setq children (list expansion
-                                   prev-part
-                                   children))))
-       (setq point end-point)))
-    (cond ((stringp children)
-          (concat children (substring string point)))
-         ((stringp (car (last children)))
-          (concat (car (last children)) (substring string point)))
-         ((null children)
-          string)
-         (t
-          (concat (mapconcat 'identity
-                             (nreverse children)
-                             "")
-                  (substring string point))))))
+  "Return STRING, after substituting entity and character references.
+STRING is assumed to occur in an XML attribute value."
+  (let ((strlen (length string))
+       children)
+    (while (string-match xml-entity-or-char-ref-re string)
+      (push (substring string 0 (match-beginning 0)) children)
+      (let* ((remainder (substring string (match-end 0)))
+            (is-hex (match-string 1 string)) ; Is it a hex numeric reference?
+            (ref (match-string 2 string)))   ; Numeric part of reference
+       (if ref
+           ;; [4.6] Character references are included as
+           ;; character data.
+           (let ((val (decode-char 'ucs (string-to-number ref (if is-hex 16)))))
+             (push (cond (val (string val))
+                         (xml-validating-parser
+                          (error "XML: (Validity) Undefined character `x%s'" ref))
+                         (t xml-undefined-entity))
+                   children)
+             (setq string remainder
+                   strlen (length string)))
+         ;; [4.4.5] Entity references are "included in literal".
+         ;; Note that we don't need do anything special to treat
+         ;; quotes as normal data characters.
+         (setq ref (match-string 3 string)) ; entity name
+         (let ((val (or (cdr (assoc ref xml-entity-alist))
+                        (if xml-validating-parser
+                            (error "XML: (Validity) Undefined entity `%s'" ref)
+                          xml-undefined-entity))))
+           (setq string (concat val remainder)))
+         (and xml-entity-expansion-limit
+              (> (length string) (+ strlen xml-entity-expansion-limit))
+              (error "XML: Passed `xml-entity-expansion-limit' while expanding `&%s;'"
+                     ref)))))
+    (mapconcat 'identity (nreverse (cons string children)) "")))
 
 (defun xml-substitute-numeric-entities (string)
   "Substitute SGML numeric entities by their respective utf characters.
@@ -845,12 +947,7 @@ by \"*\"."
         string)
     nil))
 
-;;*******************************************************************
-;;**
-;;**  Printing a tree.
-;;**  This function is intended mainly for debugging purposes.
-;;**
-;;*******************************************************************
+;;; Printing a parse tree (mainly for debugging).
 
 (defun xml-debug-print (xml &optional indent-string)
   "Outputs the XML in the current buffer.
@@ -863,15 +960,12 @@ The first line is indented with the optional INDENT-STRING."
 (defalias 'xml-print 'xml-debug-print)
 
 (defun xml-escape-string (string)
-  "Return the string with entity substitutions made from
-xml-entity-alist."
+  "Return STRING with entity substitutions made from `xml-entity-alist'."
   (mapconcat (lambda (byte)
                (let ((char (char-to-string byte)))
                  (if (rassoc char xml-entity-alist)
                      (concat "&" (car (rassoc char xml-entity-alist)) ";")
                    char)))
-             ;; This differs from the non-unicode branch.  Just
-             ;; grabbing the string works here.
              string ""))
 
 (defun xml-debug-print-internal (xml indent-string)
index 06d82870f8cac8a965ef2e983db6ed30875821fd..76c78b84b42c093549ae5d906a1aa92381fbfedf 100644 (file)
 ;; Mouse events symbols must have an 'event-kind property with
 ;; the value 'mouse-click.
 (dolist (event-type '(mouse-1 mouse-2 mouse-3
-                             M-down-mouse-1 M-down-mouse-2 M-down-mouse-3))
+                     M-down-mouse-1 M-down-mouse-2 M-down-mouse-3))
   (put event-type 'event-kind 'mouse-click))
 
 (defun xterm-mouse-translate (_event)
   "Read a click and release event from XTerm."
+  (xterm-mouse-translate-1))
+
+(defun xterm-mouse-translate-extended (_event)
+  "Read a click and release event from XTerm.
+Similar to `xterm-mouse-translate', but using the \"1006\"
+extension, which supports coordinates >= 231 (see
+http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
+  (xterm-mouse-translate-1 1006))
+
+(defun xterm-mouse-translate-1 (&optional extension)
   (save-excursion
     (save-window-excursion
       (deactivate-mark)
-      (let* ((xterm-mouse-last)
-            (down (xterm-mouse-event))
+      (let* ((xterm-mouse-last nil)
+            (down (xterm-mouse-event extension))
             (down-command (nth 0 down))
-            (down-data (nth 1 down))
-            (down-where (nth 1 down-data))
+            (down-data    (nth 1 down))
+            (down-where   (nth 1 down-data))
             (down-binding (key-binding (if (symbolp down-where)
                                            (vector down-where down-command)
                                          (vector down-command))))
             (is-click (string-match "^mouse" (symbol-name (car down)))))
 
+       ;; Retrieve the expected preface for the up-event.
        (unless is-click
-         (unless (and (eq (read-char) ?\e)
-                      (eq (read-char) ?\[)
-                      (eq (read-char) ?M))
+         (unless (cond ((null extension)
+                        (and (eq (read-event) ?\e)
+                             (eq (read-event) ?\[)
+                             (eq (read-event) ?M)))
+                       ((eq extension 1006)
+                        (and (eq (read-event) ?\e)
+                             (eq (read-event) ?\[)
+                             (eq (read-event) ?<))))
            (error "Unexpected escape sequence from XTerm")))
 
-       (let* ((click (if is-click down (xterm-mouse-event)))
-              ;; (click-command (nth 0 click))
-              (click-data (nth 1 click))
+       ;; Process the up-event.
+       (let* ((click (if is-click down (xterm-mouse-event extension)))
+              (click-data  (nth 1 click))
               (click-where (nth 1 click-data)))
          (if (memq down-binding '(nil ignore))
              (if (and (symbolp click-where)
                  (vector (list click-where click-data) click)
                (vector click))
            (setq unread-command-events
-                 (if (eq down-where click-where)
-                     (list click)
-                   (list
-                    ;; Cheat `mouse-drag-region' with move event.
-                    (list 'mouse-movement click-data)
-                    ;; Generate a drag event.
-                    (if (symbolp down-where)
-                        0
-                      (list (intern (format "drag-mouse-%d"
-                                            (+ 1 xterm-mouse-last)))
-                            down-data click-data)))))
+                 (append (if (eq down-where click-where)
+                             (list click)
+                           (list
+                            ;; Cheat `mouse-drag-region' with move event.
+                            (list 'mouse-movement click-data)
+                            ;; Generate a drag event.
+                            (if (symbolp down-where)
+                                0
+                              (list (intern (format "drag-mouse-%d"
+                                                    (1+ xterm-mouse-last)))
+                                    down-data click-data))))
+                         unread-command-events))
            (if xterm-mouse-debug-buffer
                (print unread-command-events xterm-mouse-debug-buffer))
            (if (and (symbolp down-where)
                      (terminal-parameter nil 'xterm-mouse-y))))
   pos)
 
-;; read xterm sequences above ascii 127 (#x7f)
+;; Read XTerm sequences above ASCII 127 (#x7f)
 (defun xterm-mouse-event-read ()
   ;; We get the characters decoded by the keyboard coding system.  Try
   ;; to recover the raw character.
-  (let ((c (read-char)))
+  (let ((c (read-event)))
     (cond ;; If meta-flag is t we get a meta character
          ((>= c ?\M-\^@)
           (- c (- ?\M-\^@ 128)))
             (fdiff (- f (* 1.0 maxwrap dbig))))
        (+ (truncate fdiff) (* maxwrap dbig))))))
 
-(defun xterm-mouse-event ()
-  "Convert XTerm mouse event to Emacs mouse event."
-  (let* ((type (- (xterm-mouse-event-read) #o40))
-        (x (- (xterm-mouse-event-read) #o40 1))
-        (y (- (xterm-mouse-event-read) #o40 1))
+;; Normal terminal mouse click reporting: expect three bytes, of the
+;; form <BUTTON+32> <X+32> <Y+32>.  Return a list (EVENT-TYPE X Y).
+(defun xterm-mouse--read-event-sequence-1000 ()
+  (list (let ((code (- (xterm-mouse-event-read) 32)))
+         (intern
+          ;; For buttons > 3, the release-event looks differently
+          ;; (see xc/programs/xterm/button.c, function EditorButton),
+          ;; and come in a release-event only, no down-event.
+          (cond ((>= code 64)
+                 (format "mouse-%d" (- code 60)))
+                ((memq code '(8 9 10))
+                 (setq xterm-mouse-last code)
+                 (format "M-down-mouse-%d" (- code 7)))
+                ((= code 11)
+                 (format "M-mouse-%d" (- xterm-mouse-last 7)))
+                ((= code 3)
+                 ;; For buttons > 5 xterm only reports a
+                 ;; button-release event.  Avoid error by mapping
+                 ;; them all to mouse-1.
+                 (format "mouse-%d" (+ 1 (or xterm-mouse-last 0))))
+                (t
+                 (setq xterm-mouse-last code)
+                 (format "down-mouse-%d" (+ 1 code))))))
+       ;; x and y coordinates
+       (- (xterm-mouse-event-read) 33)
+       (- (xterm-mouse-event-read) 33)))
+
+;; XTerm's 1006-mode terminal mouse click reporting has the form
+;; <BUTTON> ; <X> ; <Y> <M or m>, where the button and ordinates are
+;; in encoded (decimal) form.  Return a list (EVENT-TYPE X Y).
+(defun xterm-mouse--read-event-sequence-1006 ()
+  (let (button-bytes x-bytes y-bytes c)
+    (while (not (eq (setq c (xterm-mouse-event-read)) ?\;))
+      (push c button-bytes))
+    (while (not (eq (setq c (xterm-mouse-event-read)) ?\;))
+      (push c x-bytes))
+    (while (not (memq (setq c (xterm-mouse-event-read)) '(?m ?M)))
+      (push c y-bytes))
+    (list (let* ((code (string-to-number
+                       (apply 'string (nreverse button-bytes))))
+                (wheel (>= code 64))
+                (down (and (not wheel)
+                           (eq c ?M))))
+           (intern (format "%s%smouse-%d"
+                           (cond (wheel "")
+                                 ((< code 4)  "")
+                                 ((< code 8)  "S-")
+                                 ((< code 12) "M-")
+                                 ((< code 16) "M-S-")
+                                 ((< code 20) "C-")
+                                 ((< code 24) "C-S-")
+                                 ((< code 28) "C-M-")
+                                 ((< code 32) "C-M-S-")
+                                 (t
+                                  (error "Unexpected escape sequence from XTerm")))
+                           (if down "down-" "")
+                           (if wheel
+                               (- code 60)
+                             (1+ (setq xterm-mouse-last (mod code 4)))))))
+         (1- (string-to-number (apply 'string (nreverse x-bytes))))
+         (1- (string-to-number (apply 'string (nreverse y-bytes)))))))
+
+(defun xterm-mouse-event (&optional extension)
+  "Convert XTerm mouse event to Emacs mouse event.
+EXTENSION, if non-nil, means to use an extension to the usual
+terminal mouse protocol; we currently support the value 1006,
+which is the \"1006\" extension implemented in Xterm >= 277."
+  (let* ((click (cond ((null extension)
+                      (xterm-mouse--read-event-sequence-1000))
+                     ((eq extension 1006)
+                      (xterm-mouse--read-event-sequence-1006))
+                     (t
+                      (error "Unsupported XTerm mouse protocol"))))
+        (type (nth 0 click))
+        (x    (nth 1 click))
+        (y    (nth 2 click))
         ;; Emulate timestamp information.  This is accurate enough
         ;; for default value of mouse-1-click-follows-link (450msec).
         (timestamp (xterm-mouse-truncate-wrap
                         (- (float-time)
                            (or xt-mouse-epoch
                                (setq xt-mouse-epoch (float-time)))))))
-         (mouse (intern
-                ;; For buttons > 3, the release-event looks
-                ;; differently (see xc/programs/xterm/button.c,
-                ;; function EditorButton), and there seems to come in
-                ;; a release-event only, no down-event.
-                (cond ((>= type 64)
-                       (format "mouse-%d" (- type 60)))
-                      ((memq type '(8 9 10))
-                       (setq xterm-mouse-last type)
-                       (format "M-down-mouse-%d" (- type 7)))
-                      ((= type 11)
-                       (format "mouse-%d" (- xterm-mouse-last 7)))
-                      ((= type 3)
-                       ;; For buttons > 5 xterm only reports a
-                       ;; button-release event.  Avoid error by mapping
-                       ;; them all to mouse-1.
-                       (format "mouse-%d" (+ 1 (or xterm-mouse-last 0))))
-                      (t
-                       (setq xterm-mouse-last type)
-                       (format "down-mouse-%d" (+ 1 type))))))
         (w (window-at x y))
          (ltrb (window-edges w))
          (left (nth 0 ltrb))
          (top (nth 1 ltrb)))
-
     (set-terminal-parameter nil 'xterm-mouse-x x)
     (set-terminal-parameter nil 'xterm-mouse-y y)
     (setq
      last-input-event
-     (list mouse
+     (list type
           (let ((event (if w
                            (posn-at-x-y (- x left) (- y top) w t)
                          (append (list nil 'menu-bar)
@@ -248,11 +315,14 @@ down the SHIFT key while pressing the mouse button."
             ;; FIXME: is there more elegant way to detect the initial terminal?
             (not (string= (terminal-name terminal) "initial_terminal")))
     (unless (terminal-parameter terminal 'xterm-mouse-mode)
-      ;; Simulate selecting a terminal by selecting one of its frames ;-(
+      ;; Simulate selecting a terminal by selecting one of its frames
       (with-selected-frame (car (frames-on-display-list terminal))
-        (define-key input-decode-map "\e[M" 'xterm-mouse-translate))
+        (define-key input-decode-map "\e[M" 'xterm-mouse-translate)
+        (define-key input-decode-map "\e[<" 'xterm-mouse-translate-extended))
       (set-terminal-parameter terminal 'xterm-mouse-mode t))
-    (send-string-to-terminal "\e[?1000h" terminal)))
+    (send-string-to-terminal "\e[?1000h" terminal)
+    ;; Request extended mouse support, if available (xterm >= 277).
+    (send-string-to-terminal "\e[?1006h" terminal)))
 
 (defun turn-off-xterm-mouse-tracking-on-terminal (terminal)
   "Disable xterm mouse tracking on TERMINAL."
@@ -268,7 +338,8 @@ down the SHIFT key while pressing the mouse button."
     ;; command too many times (or to catch an unintended key sequence), than
     ;; to send it too few times (or to fail to let xterm-mouse events
     ;; pass by untranslated).
-    (send-string-to-terminal "\e[?1000l" terminal)))
+    (send-string-to-terminal "\e[?1000l" terminal)
+    (send-string-to-terminal "\e[?1006l" terminal)))
 
 (provide 'xt-mouse)
 
index 4b07b7927aed5bc505dd36948ce78aabaa1dde63..0c0a88a8408064dbe0d89150bc75eb3085334d54 100644 (file)
@@ -1,6 +1,46 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * Version 24.1 released.
+       Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786).
+       * lwlib.c: Include c-strcase.h.
+       (lwlib_strcasecmp): Remove.  All uses replaced with c_strcasecmp.
+
+2012-06-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Clean out last vestiges of the old HAVE_CONFIG_H stuff.
+       * Makefile.in (ALL_CFLAGS): Remove -DHAVE_CONFIG_H.
+       * lwlib-Xaw.c, lwlib-Xlw.c, lwlib-Xm.c, lwlib-utils.c, lwlib.c:
+       * xlwmenu.c: Include <config.h> unconditionally.
+
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * lwlib.c (my_strcasecmp): Rename to lwlib_strcasecmp, which
+       may be defined to library function strcasecmp if available.
+
+2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
+       * xlwmenu.c (abort_gracefully):
+       Use _Noreturn rather than NO_RETURN.
+       No need for separate decl merely because of _Noreturn.
+
+2012-05-31  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove obsolete '#define static' cruft.
+       * xlwmenu.c [emacs]: Include "bitmaps/gray.xbm".
+       (gray_bitmap_width, gray_bitmap_height, gray_bitmap_bits) [!emacs]:
+       Remove; all uses replaced with definiens.
+
+2012-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       configure: new option --enable-gcc-warnings (Bug#11207)
+       * Makefile.in (C_WARNINGS_SWITCH): Remove.
+       (WARN_CFLAGS, WERROR_CFLAGS): New macros.
+       (ALL_CFLAGS): Use new macros rather than old.
+
+2012-04-11  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (C_SWITCH_X_SYSTEM): Remove.
+       (ALL_CFLAGS): Remove C_SWITCH_X_SYSTEM.
 
 2011-10-13  Dmitry Antipov  <dmantipov@yandex.ru>
 
 
        * xlwmenuP.h (_XlwMenu_part): Add top_depth.
 
-       * xlwmenu.h: Removed declaration of pop_up_menu
+       * xlwmenu.h: Removed declaration of pop_up_menu.
 
        * xlwmenu.c (Start): Get correct time if time in event is CurrentTime.
        (find_first_selectable, find_next_selectable)
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1995-1999, 2001-2012  Free Software Foundation, Inc.
+  Copyright (C) 1995-1999, 2001-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index db108862d70a77d5b71ef061506a47ac1b8d3136..d49f69b58a4cef4c523b3421b0c3e88c01b15ea5 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (C) 1992, 1993 Lucid, Inc.
-# Copyright (C) 1994, 2001-2012  Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc.
 #
 # This file is part of the Lucid Widget Library.
 #
@@ -26,11 +26,11 @@ srcdir=@srcdir@
 VPATH=@srcdir@
 @SET_MAKE@
 C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
-C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
-C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
 PROFILING_CFLAGS = @PROFILING_CFLAGS@
+WARN_CFLAGS = `echo @WARN_CFLAGS@ | sed 's/ -Wwrite-strings//'`
+WERROR_CFLAGS = @WERROR_CFLAGS@
 
 CC=@CC@
 CFLAGS=@CFLAGS@
@@ -53,9 +53,9 @@ OBJS = lwlib.o $(TOOLKIT_OBJS) lwlib-utils.o
 ## $(srcdir) is where the lwlib sources are.
 ## There are no generated lwlib files, hence no need for -I.
 ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
-  $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) \
-  $(C_WARNINGS_SWITCH) $(PROFILING_CFLAGS) $(CFLAGS) \
-  -DHAVE_CONFIG_H -Demacs -I../src \
+  $(C_SWITCH_MACHINE) \
+  $(WARN_CFLAGS) $(WERROR_CFLAGS) $(PROFILING_CFLAGS) $(CFLAGS) \
+  -Demacs -I../src \
   -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib
 
 .c.o:
index 0a759e1a0a0711b5bd98e17ed5c48a30d8219150..7f834df1aad5af6f67e171bd64977e0b316ae85c 100644 (file)
@@ -20,9 +20,7 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <stdio.h>
 #include <setjmp.h>
@@ -148,7 +146,7 @@ get_text_width_and_height (Widget widget, char *text,
 {
   int w = 0, h = 0;
   char *bp = text;
-  
+
   while (bp && *bp != '\0')
     {
       XGlyphInfo gi;
@@ -227,16 +225,16 @@ find_xft_data (Widget widget)
   Widget parent = XtParent (widget);
   struct widget_xft_data *data = NULL;
   int nr;
-  while (parent && !inst) 
+  while (parent && !inst)
     {
       inst = lw_get_widget_instance (parent);
       parent = XtParent (parent);
     }
   if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0;
 
-  for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr) 
+  for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr)
     {
-      if (inst->xft_data[nr].widget == widget) 
+      if (inst->xft_data[nr].widget == widget)
         data = &inst->xft_data[nr];
     }
 
@@ -250,7 +248,7 @@ command_press (Widget widget,
                Cardinal *num_params)
 {
   struct widget_xft_data *data = find_xft_data (widget);
-  if (data) 
+  if (data)
     {
       char *lbl;
       /* Since this isn't used for rectangle buttons, use it to for armed.  */
@@ -268,11 +266,11 @@ command_reset (Widget widget,
                Cardinal *num_params)
 {
   struct widget_xft_data *data = find_xft_data (widget);
-  if (data) 
+  if (data)
     {
       Dimension cr;
       XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL);
-      if (cr == 1) 
+      if (cr == 1)
         {
           char *lbl;
           XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL);
@@ -366,14 +364,14 @@ void
 xaw_destroy_instance (widget_instance *instance)
 {
 #ifdef HAVE_XFT
-  if (instance->xft_data) 
+  if (instance->xft_data)
     {
       int i;
-      for (i = 0; i < instance->nr_xft_data; ++i) 
+      for (i = 0; i < instance->nr_xft_data; ++i)
         {
           if (instance->xft_data[i].xft_draw)
             XftDrawDestroy (instance->xft_data[i].xft_draw);
-          if (instance->xft_data[i].p != None) 
+          if (instance->xft_data[i].p != None)
             {
               XtVaSetValues (instance->xft_data[i].widget, XtNbitmap, None,
                              NULL);
@@ -483,7 +481,7 @@ static XtActionsRec xaw_actions [] = {
 static Boolean actions_initted = False;
 
 #ifdef HAVE_XFT
-static XtActionsRec button_actions[] = 
+static XtActionsRec button_actions[] =
   {
     { "my_reset", command_reset },
     { "my_press", command_press },
@@ -563,7 +561,7 @@ make_dialog (char* name,
     XtVaGetValues (dialog,
                    XtNnumChildren, &num,
                    XtNchildren, &ch, NULL);
-    for (i = 0; i < num; ++i) 
+    for (i = 0; i < num; ++i)
       {
         if (!XtIsSubclass (ch[i], commandWidgetClass)
             && XtIsSubclass (ch[i], labelWidgetClass))
@@ -574,9 +572,9 @@ make_dialog (char* name,
       }
     instance->xft_data = 0;
     instance->nr_xft_data = 0;
-    if (w) 
+    if (w)
       {
-        XtResource rec[] = 
+        XtResource rec[] =
           { { "font", "Font", XtRString, sizeof(String), 0, XtRString,
               (XtPointer)"Sans-10" }};
         char *fontName = NULL;
@@ -590,8 +588,8 @@ make_dialog (char* name,
             else
               XFreeFont (XtDisplay (dialog), xfn);
           }
-        
-        if (xft_font) 
+
+        if (xft_font)
           {
             instance->nr_xft_data = left_buttons + right_buttons + 1;
             instance->xft_data = calloc (instance->nr_xft_data,
@@ -639,7 +637,7 @@ make_dialog (char* name,
     {
       ac = 0;
       XtSetArg (av [ac], XtNfromHoriz, button); ac++;
-      if (i == 0) 
+      if (i == 0)
         {
           /* Separator to the other buttons. */
           XtSetArg (av [ac], XtNhorizDistance, 30); ac++;
index a4467900f8c694e03016039938f5d37c255e226c..e8c59905ab93a9586b34b8ec3ba12a8715a614d3 100644 (file)
@@ -20,9 +20,7 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <setjmp.h>
 #include <lisp.h>
index 4f6276850a323c91af8fd410545c60723359c763..acd11aec6b567290cf1cf6e67a30c55b2723cafe 100644 (file)
@@ -20,9 +20,7 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <unistd.h>
 #include <stdio.h>
index 9286691639f88e1652b5247450adf2ead3d1780f..65cda72fdd803cd2d292356e65f22314e4ef02a4 100644 (file)
@@ -20,9 +20,7 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <setjmp.h>
 #include <lisp.h>
index 49c1b8df2e6753b0ffb4ba3e9a7d4e79b653b4ec..5820be8d7a4dc3e9c923e6992682fd26bfbb0f12 100644 (file)
@@ -20,12 +20,11 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 Boston, MA 02110-1301, USA.  */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <setjmp.h>
 #include <lisp.h>
+#include <c-strcase.h>
 
 #include <sys/types.h>
 #include <stdio.h>
@@ -75,7 +74,6 @@ static widget_value *merge_widget_value (widget_value *,
                                          widget_value *,
                                          int, int *);
 static void instantiate_widget_instance (widget_instance *);
-static int my_strcasecmp (const char *, const char *);
 static void safe_free_str (char *);
 static void free_widget_value_tree (widget_value *);
 static widget_value *copy_widget_value_tree (widget_value *,
@@ -115,26 +113,6 @@ safe_strdup (const char *s)
   return result;
 }
 
-/* Like strcmp but ignore differences in case.  */
-
-static int
-my_strcasecmp (const char *s1, const char *s2)
-{
-  while (1)
-    {
-      int c1 = *s1++;
-      int c2 = *s2++;
-      if (isupper (c1))
-       c1 = tolower (c1);
-      if (isupper (c2))
-       c2 = tolower (c2);
-      if (c1 != c2)
-       return (c1 > c2 ? 1 : -1);
-      if (c1 == 0)
-       return 0;
-    }
-}
-
 static void
 safe_free_str (char *s)
 {
@@ -731,7 +709,7 @@ find_in_table (const char *type, const widget_creation_entry *table)
 {
   const widget_creation_entry* cur;
   for (cur = table; cur->type; cur++)
-    if (!my_strcasecmp (type, cur->type))
+    if (!c_strcasecmp (type, cur->type))
       return cur->function;
   return NULL;
 }
index 0a328f09f1ebfe79a919af1d0f8404516b4e0aa6..e8831c37f8fdbb3fb62fcc01167d8ba921c9d6fd 100644 (file)
@@ -22,9 +22,7 @@ Boston, MA 02110-1301, USA.  */
 
 /* Created by devin@lucid.com */
 
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #include <setjmp.h>
 #include <lisp.h>
@@ -49,22 +47,12 @@ Boston, MA 02110-1301, USA.  */
 
 #ifdef emacs
 
-/* Defined in xfns.c.  When config.h defines `static' as empty, we get
-   redefinition errors when gray_bitmap is included more than once, so
-   we're referring to the one include in xfns.c here.  */
-
-extern int gray_bitmap_width;
-extern int gray_bitmap_height;
-extern char *gray_bitmap_bits;
-
 #include <xterm.h>
+#include "bitmaps/gray.xbm"
 
 #else /* not emacs */
 
 #include <X11/bitmaps/gray>
-#define gray_bitmap_width      gray_width
-#define gray_bitmap_height     gray_height
-#define gray_bitmap_bits       gray_bits
 
 #endif /* not emacs */
 
@@ -200,7 +188,6 @@ static void Key(Widget w, XEvent *ev, String *params, Cardinal *num_params);
 static void Nothing(Widget w, XEvent *ev, String *params, Cardinal *num_params);
 static int separator_height (enum menu_separator);
 static void pop_up_menu (XlwMenuWidget, XButtonPressedEvent *);
-static void abort_gracefully (Widget w) NO_RETURN;
 
 static XtActionsRec
 xlwMenuActionsList [] =
@@ -283,7 +270,7 @@ ungrab_all (Widget w, Time ungrabtime)
 
 /* Like abort, but remove grabs from widget W before.  */
 
-static void
+static _Noreturn void
 abort_gracefully (Widget w)
 {
   if (XtIsShell (XtParent (w)))
@@ -1918,8 +1905,8 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
   mw->menu.cursor = mw->menu.cursor_shape;
 
   mw->menu.gray_pixmap
-    = XCreatePixmapFromBitmapData (display, window, gray_bitmap_bits,
-                                  gray_bitmap_width, gray_bitmap_height,
+    = XCreatePixmapFromBitmapData (display, window, gray_bits,
+                                  gray_width, gray_height,
                                   (unsigned long)1, (unsigned long)0, 1);
 
 #ifdef HAVE_XFT
index 7feed466940b70550aa3e9a8eb8fa57342b99964..d978cb898cf3ce2771d98747e32045c041342fcd 100644 (file)
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 2
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index a8744a844f39d85cc29fed813d6e6679c1649276..656924be889bb37955e32a86810dc6666d2fa637 100644 (file)
@@ -1,5 +1,5 @@
-# alloca.m4 serial 13
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2011 Free Software Foundation,
+# alloca.m4 serial 14
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2012 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -53,8 +53,8 @@ m4_version_prereq([2.69], [] ,[
 
 # _AC_LIBOBJ_ALLOCA
 # -----------------
-# Set up the LIBOBJ replacement of `alloca'.  Well, not exactly
-# AC_LIBOBJ since we actually set the output variable `ALLOCA'.
+# Set up the LIBOBJ replacement of 'alloca'.  Well, not exactly
+# AC_LIBOBJ since we actually set the output variable 'ALLOCA'.
 # Nevertheless, for Automake, AC_LIBSOURCES it.
 m4_define([_AC_LIBOBJ_ALLOCA],
 [# The SVR3 libPW and SVR4 libucb both contain incompatible functions
@@ -63,9 +63,9 @@ m4_define([_AC_LIBOBJ_ALLOCA],
 # use ar to extract alloca.o from them instead of compiling alloca.c.
 AC_LIBSOURCES(alloca.c)
 AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl
-AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using `alloca.c'.])
+AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.])
 
-AC_CACHE_CHECK(whether `alloca.c' needs Cray hooks, ac_cv_os_cray,
+AC_CACHE_CHECK(whether 'alloca.c' needs Cray hooks, ac_cv_os_cray,
 [AC_EGREP_CPP(webecray,
 [#if defined CRAY && ! defined CRAY2
 webecray
@@ -77,10 +77,10 @@ if test $ac_cv_os_cray = yes; then
   for ac_func in _getb67 GETB67 getb67; do
     AC_CHECK_FUNC($ac_func,
                   [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func,
-                                      [Define to one of `_getb67', `GETB67',
-                                       `getb67' for Cray-2 and Cray-YMP
+                                      [Define to one of '_getb67', 'GETB67',
+                                       'getb67' for Cray-2 and Cray-YMP
                                        systems. This function is required for
-                                       `alloca.c' support on those systems.])
+                                       'alloca.c' support on those systems.])
     break])
   done
 fi
index 20c65b8258458c4546b1519f922d018fb30b5460..c002e5fceadcd2de5394a491538506fb76c85ff6 100644 (file)
@@ -1,6 +1,6 @@
 # c-strtod.m4 serial 14
 
-# Copyright (C) 2004-2006, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2004-2006, 2009-2012 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/clock_time.m4 b/m4/clock_time.m4
new file mode 100644 (file)
index 0000000..0bec0ef
--- /dev/null
@@ -0,0 +1,31 @@
+# clock_time.m4 serial 10
+dnl Copyright (C) 2002-2006, 2009-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Check for clock_gettime and clock_settime, and set LIB_CLOCK_GETTIME.
+# For a program named, say foo, you should add a line like the following
+# in the corresponding Makefile.am file:
+# foo_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
+
+AC_DEFUN([gl_CLOCK_TIME],
+[
+  dnl Persuade glibc and Solaris <time.h> to declare these functions.
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+  # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
+  # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
+
+  # Save and restore LIBS so e.g., -lrt, isn't added to it.  Otherwise, *all*
+  # programs in the package would end up linked with that potentially-shared
+  # library, inducing unnecessary run-time overhead.
+  LIB_CLOCK_GETTIME=
+  AC_SUBST([LIB_CLOCK_GETTIME])
+  gl_saved_libs=$LIBS
+    AC_SEARCH_LIBS([clock_gettime], [rt posix4],
+                   [test "$ac_cv_search_clock_gettime" = "none required" ||
+                    LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime])
+    AC_CHECK_FUNCS([clock_gettime clock_settime])
+  LIBS=$gl_saved_libs
+])
index cd9d254b440740db278a1cf3cc903623d29b81ba..fc86e8085babcbd500bafb28599d77b80952a68e 100644 (file)
@@ -1,5 +1,5 @@
-#serial 16
-dnl Copyright (C) 2002, 2005, 2007, 2009-2011 Free Software Foundation, Inc.
+#serial 18
+dnl Copyright (C) 2002, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -45,29 +45,34 @@ AC_DEFUN([gl_FUNC_DUP2],
         [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no],
         [case "$host_os" in
            mingw*) # on this platform, dup2 always returns 0 for success
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            linux*) # On linux between 2008-07-27 and 2009-05-11, dup2 of a
                    # closed fd may yield -EBADF instead of -1 / errno=EBADF.
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            freebsd*) # on FreeBSD 6.1, dup2(1,1000000) gives EMFILE, not EBADF.
-             gl_cv_func_dup2_works=no;;
+             gl_cv_func_dup2_works="guessing no" ;;
            haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC.
-             gl_cv_func_dup2_works=no;;
-           *) gl_cv_func_dup2_works=yes;;
+             gl_cv_func_dup2_works="guessing no" ;;
+           *) gl_cv_func_dup2_works="guessing yes" ;;
          esac])
       ])
-    if test "$gl_cv_func_dup2_works" = no; then
-      REPLACE_DUP2=1
-    fi
+    case "$gl_cv_func_dup2_works" in
+      *yes) ;;
+      *)
+        REPLACE_DUP2=1
+        ;;
+    esac
   fi
   dnl Replace dup2() for supporting the gnulib-defined fchdir() function,
   dnl to keep fchdir's bookkeeping up-to-date.
   m4_ifdef([gl_FUNC_FCHDIR], [
     gl_TEST_FCHDIR
     if test $HAVE_FCHDIR = 0; then
-      REPLACE_DUP2=1
+      if test $HAVE_DUP2 = 1; then
+        REPLACE_DUP2=1
+      fi
     fi
   ])
 ])
index 22156e068c6679b75827589dbdd8f40da41fba08..6d17d8a748b9d60eca1b9a7f2146bf6a25913223 100644 (file)
@@ -1,7 +1,7 @@
-# serial 10  -*- Autoconf -*-
+# serial 12  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -43,7 +43,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
   AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=])
   if test "$MINIX" = yes; then
     AC_DEFINE([_POSIX_SOURCE], [1],
-      [Define to 1 if you need to in order for `stat' and other
+      [Define to 1 if you need to in order for 'stat' and other
        things to work.])
     AC_DEFINE([_POSIX_1_SOURCE], [2],
       [Define to 2 if the system does not provide POSIX.1 features
@@ -67,7 +67,7 @@ AC_BEFORE([$0], [AC_RUN_IFELSE])dnl
 #ifndef _ALL_SOURCE
 # undef _ALL_SOURCE
 #endif
-/* Enable general extensions on MacOS X.  */
+/* Enable general extensions on Mac OS X.  */
 #ifndef _DARWIN_C_SOURCE
 # undef _DARWIN_C_SOURCE
 #endif
index 8f6e8bc3bb0e0b219f6d6c52dcd5f9c34c7ef993..1aa6cdd57b2035684ccd32a1529f51191d88b5c4 100644 (file)
@@ -1,5 +1,5 @@
 # filemode.m4 serial 8
-dnl Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index b16f40de0aa47aa3a2333796e4e8cdeaeed4abea..7738d2f866966046760b1744e0f5aec26bef0ed6 100644 (file)
@@ -1,13 +1,13 @@
 # Check for getloadavg.
 
-# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2011 Free Software
+# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2012 Free Software
 # Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-#serial 5
+#serial 6
 
 # Autoconf defines AC_FUNC_GETLOADAVG, but that is obsolescent.
 # New applications should use gl_GETLOADAVG instead.
@@ -22,7 +22,7 @@ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
 
 gl_save_LIBS=$LIBS
 
-# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0,
+# getloadvg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0,
 # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7.
 HAVE_GETLOADAVG=1
 AC_CHECK_FUNC([getloadavg], [],
@@ -100,11 +100,13 @@ AC_CHECK_DECL([getloadavg], [], [HAVE_DECL_GETLOADAVG=0],
 
 # gl_PREREQ_GETLOADAVG
 # --------------------
-# Set up the AC_LIBOBJ replacement of `getloadavg'.
+# Set up the AC_LIBOBJ replacement of 'getloadavg'.
 AC_DEFUN([gl_PREREQ_GETLOADAVG],
 [
 # Figure out what our getloadavg.c needs.
 
+AC_CHECK_HEADERS_ONCE([sys/param.h])
+
 # On HPUX9, an unprivileged user can get load averages this way.
 if test $gl_func_getloadavg_done = no; then
   AC_CHECK_FUNCS([pstat_getdynamic], [gl_func_getloadavg_done=yes])
index 047a3db022141a001767069b7e3ba3e0d2239e2c..f6902b58591734cb2a67ae5cd408ee91805361cf 100644 (file)
@@ -1,5 +1,5 @@
-# getopt.m4 serial 38
-dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc.
+# getopt.m4 serial 44
+dnl Copyright (C) 2002-2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -9,24 +9,21 @@ AC_DEFUN([gl_FUNC_GETOPT_POSIX],
 [
   m4_divert_text([DEFAULTS], [gl_getopt_required=POSIX])
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
   dnl Other modules can request the gnulib implementation of the getopt
   dnl functions unconditionally, by defining gl_REPLACE_GETOPT_ALWAYS.
   dnl argp.m4 does this.
   m4_ifdef([gl_REPLACE_GETOPT_ALWAYS], [
-    gl_GETOPT_IFELSE([], [])
     REPLACE_GETOPT=1
   ], [
     REPLACE_GETOPT=0
-    gl_GETOPT_IFELSE([
+    if test -n "$gl_replace_getopt"; then
       REPLACE_GETOPT=1
-    ],
-    [])
+    fi
   ])
   if test $REPLACE_GETOPT = 1; then
     dnl Arrange for getopt.h to be created.
     gl_GETOPT_SUBSTITUTE_HEADER
-    dnl Arrange for unistd.h to include getopt.h.
-    GNULIB_UNISTD_H_GETOPT=1
   fi
 ])
 
@@ -40,13 +37,6 @@ AC_DEFUN([gl_FUNC_GETOPT_GNU],
   AC_REQUIRE([gl_FUNC_GETOPT_POSIX])
 ])
 
-# emacs' configure.in uses this.
-AC_DEFUN([gl_GETOPT_IFELSE],
-[
-  AC_REQUIRE([gl_GETOPT_CHECK_HEADERS])
-  AS_IF([test -n "$gl_replace_getopt"], [$1], [$2])
-])
-
 # Determine whether to replace the entire getopt facility.
 AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
 [
@@ -76,11 +66,6 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
     AC_CHECK_FUNCS([getopt_long_only], [], [gl_replace_getopt=yes])
   fi
 
-  dnl mingw's getopt (in libmingwex.a) does weird things when the options
-  dnl strings starts with '+' and it's not the first call.  Some internal state
-  dnl is left over from earlier calls, and neither setting optind = 0 nor
-  dnl setting optreset = 1 get rid of this internal state.
-  dnl POSIX is silent on optind vs. optreset, so we allow either behavior.
   dnl POSIX 2008 does not specify leading '+' behavior, but see
   dnl http://austingroupbugs.net/view.php?id=191 for a recommendation on
   dnl the next version of POSIX.  For now, we only guarantee leading '+'
@@ -89,30 +74,16 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
     AC_CACHE_CHECK([whether getopt is POSIX compatible],
       [gl_cv_func_getopt_posix],
       [
-        dnl BSD getopt_long uses an incompatible method to reset option
-        dnl processing.  Existence of the optreset variable, in and of
-        dnl itself, is not a reason to replace getopt, but knowledge
-        dnl of the variable is needed to determine how to reset and
-        dnl whether a reset reparses the environment.  Solaris
-        dnl supports neither optreset nor optind=0, but keeps no state
-        dnl that needs a reset beyond setting optind=1; detect Solaris
-        dnl by getopt_clip.
-        AC_LINK_IFELSE(
-          [AC_LANG_PROGRAM(
-             [[#include <unistd.h>]],
-             [[int *p = &optreset; return optreset;]])],
-          [gl_optind_min=1],
-          [AC_COMPILE_IFELSE(
-             [AC_LANG_PROGRAM(
-                [[#include <getopt.h>]],
-                [[return !getopt_clip;]])],
-             [gl_optind_min=1],
-             [gl_optind_min=0])])
-
-        dnl This test fails on mingw and succeeds on many other platforms.
-        gl_save_CPPFLAGS=$CPPFLAGS
-        CPPFLAGS="$CPPFLAGS -DOPTIND_MIN=$gl_optind_min"
-        AC_RUN_IFELSE([AC_LANG_SOURCE([[
+        dnl Merging these three different test programs into a single one
+        dnl would require a reset mechanism. On BSD systems, it can be done
+        dnl through 'optreset'; on some others (glibc), it can be done by
+        dnl setting 'optind' to 0; on others again (HP-UX, IRIX, OSF/1,
+        dnl Solaris 9, musl libc), there is no such mechanism.
+        if test $cross_compiling = no; then
+          dnl Sanity check. Succeeds everywhere (except on MSVC,
+          dnl which lacks <unistd.h> and getopt() entirely).
+          AC_RUN_IFELSE(
+            [AC_LANG_SOURCE([[
 #include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
@@ -120,89 +91,107 @@ AC_DEFUN([gl_GETOPT_CHECK_HEADERS],
 int
 main ()
 {
-  {
-    static char program[] = "program";
-    static char a[] = "-a";
-    static char foo[] = "foo";
-    static char bar[] = "bar";
-    char *argv[] = { program, a, foo, bar, NULL };
-    int c;
+  static char program[] = "program";
+  static char a[] = "-a";
+  static char foo[] = "foo";
+  static char bar[] = "bar";
+  char *argv[] = { program, a, foo, bar, NULL };
+  int c;
 
-    optind = OPTIND_MIN;
-    opterr = 0;
-
-    c = getopt (4, argv, "ab");
-    if (!(c == 'a'))
-      return 1;
-    c = getopt (4, argv, "ab");
-    if (!(c == -1))
-      return 2;
-    if (!(optind == 2))
-      return 3;
-  }
-  /* Some internal state exists at this point.  */
-  {
-    static char program[] = "program";
-    static char donald[] = "donald";
-    static char p[] = "-p";
-    static char billy[] = "billy";
-    static char duck[] = "duck";
-    static char a[] = "-a";
-    static char bar[] = "bar";
-    char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
-    int c;
+  c = getopt (4, argv, "ab");
+  if (!(c == 'a'))
+    return 1;
+  c = getopt (4, argv, "ab");
+  if (!(c == -1))
+    return 2;
+  if (!(optind == 2))
+    return 3;
+  return 0;
+}
+]])],
+            [gl_cv_func_getopt_posix=maybe],
+            [gl_cv_func_getopt_posix=no])
+          if test $gl_cv_func_getopt_posix = maybe; then
+            dnl Sanity check with '+'. Succeeds everywhere (except on MSVC,
+            dnl which lacks <unistd.h> and getopt() entirely).
+            AC_RUN_IFELSE(
+              [AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
 
-    optind = OPTIND_MIN;
-    opterr = 0;
+int
+main ()
+{
+  static char program[] = "program";
+  static char donald[] = "donald";
+  static char p[] = "-p";
+  static char billy[] = "billy";
+  static char duck[] = "duck";
+  static char a[] = "-a";
+  static char bar[] = "bar";
+  char *argv[] = { program, donald, p, billy, duck, a, bar, NULL };
+  int c;
 
-    c = getopt (7, argv, "+abp:q:");
-    if (!(c == -1))
-      return 4;
-    if (!(strcmp (argv[0], "program") == 0))
-      return 5;
-    if (!(strcmp (argv[1], "donald") == 0))
-      return 6;
-    if (!(strcmp (argv[2], "-p") == 0))
-      return 7;
-    if (!(strcmp (argv[3], "billy") == 0))
-      return 8;
-    if (!(strcmp (argv[4], "duck") == 0))
-      return 9;
-    if (!(strcmp (argv[5], "-a") == 0))
-      return 10;
-    if (!(strcmp (argv[6], "bar") == 0))
-      return 11;
-    if (!(optind == 1))
-      return 12;
-  }
-  /* Detect MacOS 10.5, AIX 7.1 bug.  */
-  {
-    static char program[] = "program";
-    static char ab[] = "-ab";
-    char *argv[3] = { program, ab, NULL };
-    optind = OPTIND_MIN;
-    opterr = 0;
-    if (getopt (2, argv, "ab:") != 'a')
-      return 13;
-    if (getopt (2, argv, "ab:") != '?')
-      return 14;
-    if (optopt != 'b')
-      return 15;
-    if (optind != 2)
-      return 16;
-  }
+  c = getopt (7, argv, "+abp:q:");
+  if (!(c == -1))
+    return 4;
+  if (!(strcmp (argv[0], "program") == 0))
+    return 5;
+  if (!(strcmp (argv[1], "donald") == 0))
+    return 6;
+  if (!(strcmp (argv[2], "-p") == 0))
+    return 7;
+  if (!(strcmp (argv[3], "billy") == 0))
+    return 8;
+  if (!(strcmp (argv[4], "duck") == 0))
+    return 9;
+  if (!(strcmp (argv[5], "-a") == 0))
+    return 10;
+  if (!(strcmp (argv[6], "bar") == 0))
+    return 11;
+  if (!(optind == 1))
+    return 12;
+  return 0;
+}
+]])],
+              [gl_cv_func_getopt_posix=maybe],
+              [gl_cv_func_getopt_posix=no])
+          fi
+          if test $gl_cv_func_getopt_posix = maybe; then
+            dnl Detect Mac OS X 10.5, AIX 7.1, mingw bug.
+            AC_RUN_IFELSE(
+              [AC_LANG_SOURCE([[
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
 
+int
+main ()
+{
+  static char program[] = "program";
+  static char ab[] = "-ab";
+  char *argv[3] = { program, ab, NULL };
+  if (getopt (2, argv, "ab:") != 'a')
+    return 13;
+  if (getopt (2, argv, "ab:") != '?')
+    return 14;
+  if (optopt != 'b')
+    return 15;
+  if (optind != 2)
+    return 16;
   return 0;
 }
 ]])],
-          [gl_cv_func_getopt_posix=yes], [gl_cv_func_getopt_posix=no],
-          [case "$host_os" in
-             mingw*)         gl_cv_func_getopt_posix="guessing no";;
-             darwin* | aix*) gl_cv_func_getopt_posix="guessing no";;
-             *)              gl_cv_func_getopt_posix="guessing yes";;
-           esac
-          ])
-        CPPFLAGS=$gl_save_CPPFLAGS
+              [gl_cv_func_getopt_posix=yes],
+              [gl_cv_func_getopt_posix=no])
+          fi
+        else
+          case "$host_os" in
+            darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";;
+            *)                       gl_cv_func_getopt_posix="guessing yes";;
+          esac
+        fi
       ])
     case "$gl_cv_func_getopt_posix" in
       *no) gl_replace_getopt=yes ;;
@@ -238,7 +227,7 @@ dnl is ambiguous with environment values that contain newlines.
              nocrash_init();
 
              /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw,
-                and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
+                and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5,
                 OSF/1 5.1, Solaris 10.  */
              {
                static char conftest[] = "conftest";
@@ -249,7 +238,7 @@ dnl is ambiguous with environment values that contain newlines.
                  result |= 1;
              }
              /* This code succeeds on glibc 2.8, mingw,
-                and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
+                and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11,
                 IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x.  */
              {
                static char program[] = "program";
@@ -278,7 +267,7 @@ dnl is ambiguous with environment values that contain newlines.
                if (getopt (3, argv, "-p") != 1)
                  result |= 16;
                else if (getopt (3, argv, "-p") != 'p')
-                 result |= 32;
+                 result |= 16;
              }
              /* This code fails on glibc 2.11.  */
              {
@@ -288,9 +277,9 @@ dnl is ambiguous with environment values that contain newlines.
                char *argv[] = { program, b, a, NULL };
                optind = opterr = 0;
                if (getopt (3, argv, "+:a:b") != 'b')
-                 result |= 64;
+                 result |= 32;
                else if (getopt (3, argv, "+:a:b") != ':')
-                 result |= 64;
+                 result |= 32;
              }
              /* This code dumps core on glibc 2.14.  */
              {
@@ -300,18 +289,14 @@ dnl is ambiguous with environment values that contain newlines.
                char *argv[] = { program, w, dummy, NULL };
                optind = opterr = 1;
                if (getopt (3, argv, "W;") != 'W')
-                 result |= 128;
+                 result |= 64;
              }
              return result;
            ]])],
         [gl_cv_func_getopt_gnu=yes],
         [gl_cv_func_getopt_gnu=no],
-        [dnl Cross compiling. Guess based on host and declarations.
-         case $host_os:$ac_cv_have_decl_optreset in
-           *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;;
-           *:yes)               gl_cv_func_getopt_gnu=no;;
-           *)                   gl_cv_func_getopt_gnu=yes;;
-         esac
+        [dnl Cross compiling. Assume the worst, even on glibc platforms.
+         gl_cv_func_getopt_gnu="guessing no"
         ])
        case $gl_had_POSIXLY_CORRECT in
          exported) ;;
@@ -319,13 +304,54 @@ dnl is ambiguous with environment values that contain newlines.
          *) AS_UNSET([POSIXLY_CORRECT]) ;;
        esac
       ])
-    if test "$gl_cv_func_getopt_gnu" = "no"; then
+    if test "$gl_cv_func_getopt_gnu" != yes; then
       gl_replace_getopt=yes
+    else
+      AC_CACHE_CHECK([for working GNU getopt_long function],
+        [gl_cv_func_getopt_long_gnu],
+        [AC_RUN_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <getopt.h>
+                #include <stddef.h>
+                #include <string.h>
+              ]],
+              [[static const struct option long_options[] =
+                  {
+                    { "xtremely-",no_argument,       NULL, 1003 },
+                    { "xtra",     no_argument,       NULL, 1001 },
+                    { "xtreme",   no_argument,       NULL, 1002 },
+                    { "xtremely", no_argument,       NULL, 1003 },
+                    { NULL,       0,                 NULL, 0 }
+                  };
+                /* This code fails on OpenBSD 5.0.  */
+                {
+                  static char program[] = "program";
+                  static char xtremel[] = "--xtremel";
+                  char *argv[] = { program, xtremel, NULL };
+                  int option_index;
+                  optind = 1; opterr = 0;
+                  if (getopt_long (2, argv, "", long_options, &option_index) != 1003)
+                    return 1;
+                }
+                return 0;
+              ]])],
+           [gl_cv_func_getopt_long_gnu=yes],
+           [gl_cv_func_getopt_long_gnu=no],
+           [dnl Cross compiling. Guess no on OpenBSD, yes otherwise.
+            case "$host_os" in
+              openbsd*) gl_cv_func_getopt_long_gnu="guessing no";;
+              *)        gl_cv_func_getopt_long_gnu="guessing yes";;
+            esac
+           ])
+        ])
+      case "$gl_cv_func_getopt_long_gnu" in
+        *yes) ;;
+        *) gl_replace_getopt=yes ;;
+      esac
     fi
   fi
 ])
 
-# emacs' configure.in uses this.
 AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
 [
   GETOPT_H=getopt.h
@@ -336,7 +362,6 @@ AC_DEFUN([gl_GETOPT_SUBSTITUTE_HEADER],
 ])
 
 # Prerequisites of lib/getopt*.
-# emacs' configure.in uses this.
 AC_DEFUN([gl_PREREQ_GETOPT],
 [
   AC_CHECK_DECLS_ONCE([getenv])
diff --git a/m4/gettime.m4 b/m4/gettime.m4
new file mode 100644 (file)
index 0000000..7d03d12
--- /dev/null
@@ -0,0 +1,13 @@
+# gettime.m4 serial 8
+dnl Copyright (C) 2002, 2004-2006, 2009-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_GETTIME],
+[
+  dnl Prerequisites of lib/gettime.c.
+  AC_REQUIRE([gl_CLOCK_TIME])
+  AC_REQUIRE([gl_TIMESPEC])
+  AC_CHECK_FUNCS_ONCE([gettimeofday nanotime])
+])
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4
new file mode 100644 (file)
index 0000000..eda9702
--- /dev/null
@@ -0,0 +1,140 @@
+# serial 20
+
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering.
+
+AC_DEFUN([gl_FUNC_GETTIMEOFDAY],
+[
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([gettimeofday])
+
+  gl_gettimeofday_timezone=void
+  if test $ac_cv_func_gettimeofday != yes; then
+    HAVE_GETTIMEOFDAY=0
+  else
+    gl_FUNC_GETTIMEOFDAY_CLOBBER
+    AC_CACHE_CHECK([for gettimeofday with POSIX signature],
+      [gl_cv_func_gettimeofday_posix_signature],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#include <sys/time.h>
+              struct timeval c;
+              int gettimeofday (struct timeval *restrict, void *restrict);
+            ]],
+            [[/* glibc uses struct timezone * rather than the POSIX void *
+                 if _GNU_SOURCE is defined.  However, since the only portable
+                 use of gettimeofday uses NULL as the second parameter, and
+                 since the glibc definition is actually more typesafe, it is
+                 not worth wrapping this to get a compliant signature.  */
+              int (*f) (struct timeval *restrict, void *restrict)
+                = gettimeofday;
+              int x = f (&c, 0);
+              return !(x | c.tv_sec | c.tv_usec);
+            ]])],
+          [gl_cv_func_gettimeofday_posix_signature=yes],
+          [AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM(
+              [[#include <sys/time.h>
+int gettimeofday (struct timeval *restrict, struct timezone *restrict);
+              ]])],
+            [gl_cv_func_gettimeofday_posix_signature=almost],
+            [gl_cv_func_gettimeofday_posix_signature=no])])])
+    if test $gl_cv_func_gettimeofday_posix_signature = almost; then
+      gl_gettimeofday_timezone='struct timezone'
+    elif test $gl_cv_func_gettimeofday_posix_signature != yes; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
+    dnl If we override 'struct timeval', we also have to override gettimeofday.
+    if test $REPLACE_STRUCT_TIMEVAL = 1; then
+      REPLACE_GETTIMEOFDAY=1
+    fi
+    m4_ifdef([gl_FUNC_TZSET_CLOBBER], [
+      gl_FUNC_TZSET_CLOBBER
+      case "$gl_cv_func_tzset_clobber" in
+        *yes)
+          REPLACE_GETTIMEOFDAY=1
+          gl_GETTIMEOFDAY_REPLACE_LOCALTIME
+          AC_DEFINE([tzset], [rpl_tzset],
+            [Define to rpl_tzset if the wrapper function should be used.])
+          AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
+            [Define if tzset clobbers localtime's static buffer.])
+          ;;
+      esac
+    ])
+  fi
+  AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
+    [Define this to 'void' or 'struct timezone' to match the system's
+     declaration of the second argument to gettimeofday.])
+])
+
+
+dnl See if gettimeofday clobbers the static buffer that localtime uses
+dnl for its return value.  The gettimeofday function from Mac OS X 10.0.4
+dnl (i.e., Darwin 1.3.7) has this problem.
+dnl
+dnl If it does, then arrange to use gettimeofday and localtime only via
+dnl the wrapper functions that work around the problem.
+
+AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
+[
+ AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+ AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
+  [gl_cv_func_gettimeofday_clobber],
+  [AC_RUN_IFELSE(
+     [AC_LANG_PROGRAM(
+        [[#include <string.h>
+          #include <sys/time.h>
+          #include <time.h>
+          #include <stdlib.h>
+        ]],
+        [[
+          time_t t = 0;
+          struct tm *lt;
+          struct tm saved_lt;
+          struct timeval tv;
+          lt = localtime (&t);
+          saved_lt = *lt;
+          gettimeofday (&tv, NULL);
+          return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0;
+        ]])],
+     [gl_cv_func_gettimeofday_clobber=no],
+     [gl_cv_func_gettimeofday_clobber=yes],
+     [# When cross-compiling:
+      case "$host_os" in
+                # Guess all is fine on glibc systems.
+        *-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+                # If we don't know, assume the worst.
+        *)      gl_cv_func_gettimeofday_clobber="guessing yes" ;;
+      esac
+     ])])
+
+ case "$gl_cv_func_gettimeofday_clobber" in
+   *yes)
+     REPLACE_GETTIMEOFDAY=1
+     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
+     AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1],
+       [Define if gettimeofday clobbers the localtime buffer.])
+     ;;
+ esac
+])
+
+AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
+  AC_DEFINE([gmtime], [rpl_gmtime],
+    [Define to rpl_gmtime if the replacement function should be used.])
+  AC_DEFINE([localtime], [rpl_localtime],
+    [Define to rpl_localtime if the replacement function should be used.])
+])
+
+# Prerequisites of lib/gettimeofday.c.
+AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [
+  AC_CHECK_HEADERS([sys/timeb.h])
+  AC_CHECK_FUNCS([_ftime])
+])
index 7d832999591032477cd2706b2a2d8e679dd67c98..15d2b2b3deaf702385c9a333af5f724768d36aa1 100644 (file)
@@ -1,5 +1,5 @@
-# gnulib-common.m4 serial 31
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 33
+dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -13,12 +13,13 @@ AC_DEFUN([gl_COMMON], [
 ])
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
-[/* The _Noreturn keyword of draft C1X.  */
-#ifndef _Noreturn
+[/* The _Noreturn keyword of C11.  */
+#if ! (defined _Noreturn \
+       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
 # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
       || 0x5110 <= __SUNPRO_C)
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif 1200 <= _MSC_VER
+# elif defined _MSC_VER && 1200 <= _MSC_VER
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
@@ -29,7 +30,7 @@ AC_DEFUN([gl_COMMON_BODY], [
 [/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
    the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
    earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
-   __APPLE__ && __MACH__ test for MacOS X.
+   __APPLE__ && __MACH__ test for Mac OS X.
    __APPLE_CC__ tests for the Apple compiler and its version.
    __STDC_VERSION__ tests for the C99 mode.  */
 #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
@@ -224,7 +225,7 @@ m4_ifndef([AS_VAR_IF],
 # - When AC_PROG_CC_STDC is invoked twice, it adds the C99 enabling options
 #   to CC twice
 #   <http://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00431.html>.
-# - AC_PROG_CC_STDC is likely to change when C1X is an ISO standard.
+# - AC_PROG_CC_STDC is likely to change now that C11 is an ISO standard.
 AC_DEFUN([gl_PROG_CC_C99],
 [
   dnl Change that version number to the minimum Autoconf version that supports
similarity index 87%
rename from m4/gl-comp.m4
rename to m4/gnulib-comp.m4
index 4894f84030324745e9f903b68082248c559c70d7..754086ec2e7575dee7250673f68526f9a41b2c39 100644 (file)
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2011 Free Software Foundation, Inc.
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
 # other built files.
 
 
-# This macro should be invoked from ./configure.in, in the section
+# This macro should be invoked from ./configure.ac, in the section
 # "Checks for programs", right after AC_PROG_CC, and certainly before
 # any checks for libraries, header files, types and library functions.
 AC_DEFUN([gl_EARLY],
@@ -40,13 +40,17 @@ AC_DEFUN([gl_EARLY],
   AC_REQUIRE([gl_PROG_AR_RANLIB])
   # Code from module alloca-opt:
   # Code from module allocator:
+  # Code from module c-ctype:
+  # Code from module c-strcase:
   # Code from module careadlinkat:
+  # Code from module clock-time:
   # Code from module crypto/md5:
   # Code from module crypto/sha1:
   # Code from module crypto/sha256:
   # Code from module crypto/sha512:
   # Code from module dosname:
   # Code from module dtoastr:
+  # Code from module dtotimespec:
   # Code from module dup2:
   # Code from module extensions:
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
@@ -55,6 +59,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module getopt-gnu:
   # Code from module getopt-posix:
   # Code from module gettext-h:
+  # Code from module gettime:
+  # Code from module gettimeofday:
   # Code from module ignore-value:
   # Code from module include_next:
   # Code from module intprops:
@@ -62,14 +68,15 @@ AC_DEFUN([gl_EARLY],
   # Code from module largefile:
   AC_REQUIRE([AC_SYS_LARGEFILE])
   # Code from module lstat:
+  # Code from module manywarnings:
   # Code from module mktime:
   # Code from module multiarch:
   # Code from module nocrash:
   # Code from module pathmax:
+  # Code from module pselect:
   # Code from module pthread_sigmask:
   # Code from module readlink:
   # Code from module signal-h:
-  # Code from module sigprocmask:
   # Code from module snippet/_Noreturn:
   # Code from module snippet/arg-nonnull:
   # Code from module snippet/c++defs:
@@ -77,6 +84,8 @@ AC_DEFUN([gl_EARLY],
   # Code from module socklen:
   # Code from module ssize_t:
   # Code from module stat:
+  # Code from module stat-time:
+  # Code from module stdalign:
   # Code from module stdarg:
   dnl Some compilers (e.g., AIX 5.3 cc) need to be in c99 mode
   dnl for the builtin va_copy to work.  With Autoconf 2.60 or later,
@@ -94,15 +103,22 @@ AC_DEFUN([gl_EARLY],
   # Code from module strtoull:
   # Code from module strtoumax:
   # Code from module symlink:
+  # Code from module sys_select:
   # Code from module sys_stat:
+  # Code from module sys_time:
   # Code from module time:
   # Code from module time_r:
+  # Code from module timespec:
+  # Code from module timespec-add:
+  # Code from module timespec-sub:
   # Code from module u64:
   # Code from module unistd:
+  # Code from module utimens:
   # Code from module verify:
+  # Code from module warnings:
 ])
 
-# This macro should be invoked from ./configure.in, in the section
+# This macro should be invoked from ./configure.ac, in the section
 # "Check for header files, types and library functions".
 AC_DEFUN([gl_INIT],
 [
@@ -120,6 +136,7 @@ AC_DEFUN([gl_INIT],
   gl_source_base='lib'
 gl_FUNC_ALLOCA
 AC_CHECK_FUNCS_ONCE([readlinkat])
+gl_CLOCK_TIME
 gl_MD5
 gl_SHA1
 gl_SHA256
@@ -143,16 +160,30 @@ if test $REPLACE_GETOPT = 1; then
   AC_LIBOBJ([getopt])
   AC_LIBOBJ([getopt1])
   gl_PREREQ_GETOPT
+  dnl Arrange for unistd.h to include getopt.h.
+  GNULIB_GL_UNISTD_H_GETOPT=1
 fi
+AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT])
 gl_MODULE_INDICATOR_FOR_TESTS([getopt-gnu])
 gl_FUNC_GETOPT_POSIX
 if test $REPLACE_GETOPT = 1; then
   AC_LIBOBJ([getopt])
   AC_LIBOBJ([getopt1])
   gl_PREREQ_GETOPT
+  dnl Arrange for unistd.h to include getopt.h.
+  GNULIB_GL_UNISTD_H_GETOPT=1
 fi
+AC_SUBST([GNULIB_GL_UNISTD_H_GETOPT])
+gl_GETTIME
+gl_FUNC_GETTIMEOFDAY
+if test $HAVE_GETTIMEOFDAY = 0 || test $REPLACE_GETTIMEOFDAY = 1; then
+  AC_LIBOBJ([gettimeofday])
+  gl_PREREQ_GETTIMEOFDAY
+fi
+gl_SYS_TIME_MODULE_INDICATOR([gettimeofday])
 AC_REQUIRE([AC_C_INLINE])
 gl_INTTYPES_INCOMPLETE
+AC_REQUIRE([gl_LARGEFILE])
 gl_FUNC_LSTAT
 if test $REPLACE_LSTAT = 1; then
   AC_LIBOBJ([lstat])
@@ -166,6 +197,11 @@ if test $REPLACE_MKTIME = 1; then
 fi
 gl_TIME_MODULE_INDICATOR([mktime])
 gl_MULTIARCH
+gl_FUNC_PSELECT
+if test $HAVE_PSELECT = 0 || test $REPLACE_PSELECT = 1; then
+  AC_LIBOBJ([pselect])
+fi
+gl_SYS_SELECT_MODULE_INDICATOR([pselect])
 gl_FUNC_PTHREAD_SIGMASK
 if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then
   AC_LIBOBJ([pthread_sigmask])
@@ -181,6 +217,9 @@ gl_UNISTD_MODULE_INDICATOR([readlink])
 gl_SIGNAL_H
 gl_TYPE_SOCKLEN_T
 gt_TYPE_SSIZE_T
+gl_STAT_TIME
+gl_STAT_BIRTHTIME
+gl_STDALIGN_H
 gl_STDARG_H
 AM_STDBOOL_H
 gl_STDDEF_H
@@ -189,7 +228,7 @@ gl_STDIO_H
 gl_STDLIB_H
 gl_FUNC_GNU_STRFTIME
 gl_FUNC_STRTOIMAX
-if test $ac_cv_func_strtoimax = no; then
+if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then
   AC_LIBOBJ([strtoimax])
   gl_PREREQ_STRTOIMAX
 fi
@@ -205,8 +244,12 @@ if test $HAVE_SYMLINK = 0 || test $REPLACE_SYMLINK = 1; then
   AC_LIBOBJ([symlink])
 fi
 gl_UNISTD_MODULE_INDICATOR([symlink])
+gl_HEADER_SYS_SELECT
+AC_PROG_MKDIR_P
 gl_HEADER_SYS_STAT_H
 AC_PROG_MKDIR_P
+gl_HEADER_SYS_TIME_H
+AC_PROG_MKDIR_P
 gl_HEADER_TIME_H
 gl_TIME_R
 if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
@@ -214,12 +257,13 @@ if test $HAVE_LOCALTIME_R = 0 || test $REPLACE_LOCALTIME_R = 1; then
   gl_PREREQ_TIME_R
 fi
 gl_TIME_MODULE_INDICATOR([time_r])
+gl_TIMESPEC
 AC_REQUIRE([AC_C_INLINE])
 gl_UNISTD_H
+gl_UTIMENS
   gl_gnulib_enabled_dosname=false
   gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false
   gl_gnulib_enabled_pathmax=false
-  gl_gnulib_enabled_sigprocmask=false
   gl_gnulib_enabled_stat=false
   gl_gnulib_enabled_strtoll=false
   gl_gnulib_enabled_strtoull=false
@@ -245,18 +289,6 @@ gl_PATHMAX
       gl_gnulib_enabled_pathmax=true
     fi
   }
-  func_gl_gnulib_m4code_sigprocmask ()
-  {
-    if ! $gl_gnulib_enabled_sigprocmask; then
-gl_SIGNALBLOCKING
-if test $HAVE_POSIX_SIGNALBLOCKING = 0; then
-  AC_LIBOBJ([sigprocmask])
-  gl_PREREQ_SIGPROCMASK
-fi
-gl_SIGNAL_MODULE_INDICATOR([sigprocmask])
-      gl_gnulib_enabled_sigprocmask=true
-    fi
-  }
   func_gl_gnulib_m4code_stat ()
   {
     if ! $gl_gnulib_enabled_stat; then
@@ -317,29 +349,25 @@ gl_STDLIB_MODULE_INDICATOR([strtoull])
   if test $REPLACE_LSTAT = 1; then
     func_gl_gnulib_m4code_stat
   fi
-  if test $HAVE_PTHREAD_SIGMASK = 0 || test $REPLACE_PTHREAD_SIGMASK = 1; then
-    func_gl_gnulib_m4code_sigprocmask
-  fi
   if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then
     func_gl_gnulib_m4code_stat
   fi
-  if test $ac_cv_func_strtoimax = no; then
-    func_gl_gnulib_m4code_verify
-  fi
-  if test $ac_cv_func_strtoimax = no && test $ac_cv_type_long_long_int = yes; then
+  if { test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes; then
     func_gl_gnulib_m4code_strtoll
   fi
-  if test $ac_cv_func_strtoumax = no; then
+  if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then
     func_gl_gnulib_m4code_verify
   fi
   if test $ac_cv_func_strtoumax = no && test $ac_cv_type_unsigned_long_long_int = yes; then
     func_gl_gnulib_m4code_strtoull
   fi
+  if test $ac_cv_func_strtoumax = no; then
+    func_gl_gnulib_m4code_verify
+  fi
   m4_pattern_allow([^gl_GNULIB_ENABLED_])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36], [$gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_pathmax], [$gl_gnulib_enabled_pathmax])
-  AM_CONDITIONAL([gl_GNULIB_ENABLED_sigprocmask], [$gl_gnulib_enabled_sigprocmask])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_stat], [$gl_gnulib_enabled_stat])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoll], [$gl_gnulib_enabled_strtoll])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_strtoull], [$gl_gnulib_enabled_strtoull])
@@ -492,10 +520,16 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/alloca.in.h
   lib/allocator.c
   lib/allocator.h
+  lib/c-ctype.c
+  lib/c-ctype.h
+  lib/c-strcase.h
+  lib/c-strcasecmp.c
+  lib/c-strncasecmp.c
   lib/careadlinkat.c
   lib/careadlinkat.h
   lib/dosname.h
   lib/dtoastr.c
+  lib/dtotimespec.c
   lib/dup2.c
   lib/filemode.c
   lib/filemode.h
@@ -507,6 +541,8 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/getopt1.c
   lib/getopt_int.h
   lib/gettext.h
+  lib/gettime.c
+  lib/gettimeofday.c
   lib/ignore-value.h
   lib/intprops.h
   lib/inttypes.in.h
@@ -516,6 +552,7 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/mktime-internal.h
   lib/mktime.c
   lib/pathmax.h
+  lib/pselect.c
   lib/pthread_sigmask.c
   lib/readlink.c
   lib/sha1.c
@@ -525,8 +562,9 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/sha512.c
   lib/sha512.h
   lib/signal.in.h
-  lib/sigprocmask.c
+  lib/stat-time.h
   lib/stat.c
+  lib/stdalign.in.h
   lib/stdarg.in.h
   lib/stdbool.in.h
   lib/stddef.in.h
@@ -542,42 +580,56 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/strtoull.c
   lib/strtoumax.c
   lib/symlink.c
+  lib/sys_select.in.h
   lib/sys_stat.in.h
+  lib/sys_time.in.h
   lib/time.in.h
   lib/time_r.c
+  lib/timespec-add.c
+  lib/timespec-sub.c
+  lib/timespec.h
   lib/u64.h
   lib/unistd.in.h
+  lib/utimens.c
+  lib/utimens.h
   lib/verify.h
   m4/00gnulib.m4
   m4/alloca.m4
   m4/c-strtod.m4
+  m4/clock_time.m4
   m4/dup2.m4
   m4/extensions.m4
   m4/filemode.m4
   m4/getloadavg.m4
   m4/getopt.m4
+  m4/gettime.m4
+  m4/gettimeofday.m4
   m4/gnulib-common.m4
   m4/include_next.m4
   m4/inttypes.m4
   m4/largefile.m4
   m4/longlong.m4
   m4/lstat.m4
+  m4/manywarnings.m4
   m4/md5.m4
   m4/mktime.m4
   m4/multiarch.m4
   m4/nocrash.m4
+  m4/off_t.m4
   m4/pathmax.m4
+  m4/pselect.m4
   m4/pthread_sigmask.m4
   m4/readlink.m4
   m4/sha1.m4
   m4/sha256.m4
   m4/sha512.m4
   m4/signal_h.m4
-  m4/signalblocking.m4
   m4/socklen.m4
   m4/ssize_t.m4
   m4/st_dm_mode.m4
+  m4/stat-time.m4
   m4/stat.m4
+  m4/stdalign.m4
   m4/stdarg.m4
   m4/stdbool.m4
   m4/stddef_h.m4
@@ -590,11 +642,19 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/strtoull.m4
   m4/strtoumax.m4
   m4/symlink.m4
+  m4/sys_select_h.m4
+  m4/sys_socket_h.m4
   m4/sys_stat_h.m4
+  m4/sys_time_h.m4
   m4/time_h.m4
   m4/time_r.m4
+  m4/timespec.m4
   m4/tm_gmtoff.m4
   m4/unistd_h.m4
+  m4/utimbuf.m4
+  m4/utimens.m4
+  m4/utimes.m4
   m4/warn-on-use.m4
+  m4/warnings.m4
   m4/wchar_t.m4
 ])
index ed41e9d41598b894374deb4566ac437d140165fe..a09ffc1d1a04304d46eaf0a5b110e541711ed99e 100644 (file)
@@ -1,5 +1,5 @@
 # gnulib-tool.m4 serial 2
-dnl Copyright (C) 2004-2005, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2005, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index d5230ced8deef1564264a7d122b45ca74d7e4c27..a60a2614dc841971ce82e960a5c9322dc0541efc 100644 (file)
@@ -1,5 +1,5 @@
-# include_next.m4 serial 22
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# include_next.m4 serial 23
+dnl Copyright (C) 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -143,7 +143,7 @@ choke me
 # even if the compiler does not support include_next.
 # The three "///" are to pacify Sun C 5.8, which otherwise would say
 # "warning: #include of /usr/include/... may be non-portable".
-# Use `""', not `<>', so that the /// cannot be confused with a C99 comment.
+# Use '""', not '<>', so that the /// cannot be confused with a C99 comment.
 # Note: This macro assumes that the header file is not empty after
 # preprocessing, i.e. it does not only define preprocessor macros but also
 # provides some type/enum definitions or function/variable declarations.
@@ -219,12 +219,17 @@ changequote(,)
                    gl_dirsep_regex='[/\\]'
                    ;;
                  *)
-                   gl_dirsep_regex='/'
+                   gl_dirsep_regex='\/'
                    ;;
                esac
+               dnl A sed expression that turns a string into a basic regular
+               dnl expression, for use within "/.../".
+               gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g'
 changequote([,])
-               gl_absolute_header_sed='\|'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[|{
-                   s|.*"\(.*'"${gl_dirsep_regex}"']m4_defn([gl_HEADER_NAME])[\)".*|\1|
+               gl_header_literal_regex=`echo ']m4_defn([gl_HEADER_NAME])[' \
+                                        | sed -e "$gl_make_literal_regex_sed"`
+               gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{
+                   s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/
 changequote(,)dnl
                    s|^/[^/]|//&|
 changequote([,])dnl
index cc027a417fa2cd46af1c57e0f3f42fd7b7839105..eec4f41d03232dd965294ad428e16e8e7a3fe091 100644 (file)
@@ -1,5 +1,5 @@
-# inttypes.m4 serial 24
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# inttypes.m4 serial 26
+dnl Copyright (C) 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -24,22 +24,6 @@ AC_DEFUN_ONCE([gl_INTTYPES_INCOMPLETE],
 
   AC_REQUIRE([gl_MULTIARCH])
 
-  dnl Ensure that <stdint.h> defines the limit macros, since gnulib's
-  dnl <inttypes.h> relies on them.  This macro is only needed when a
-  dnl C++ compiler is in use; it has no effect for a C compiler.
-  dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's
-  dnl <inttypes.h> is going to be created, and to avoid redefinition warnings
-  dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS.
-  AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], [1],
-    [Define to make the limit macros in <stdint.h> visible.])
-  AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ],
-[/* Ensure that <stdint.h> defines the limit macros, since gnulib's
-   <inttypes.h> relies on them.  */
-#if defined __cplusplus && !defined __STDC_LIMIT_MACROS && GL_TRIGGER_STDC_LIMIT_MACROS
-# define __STDC_LIMIT_MACROS 1
-#endif
-])
-
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[#include <inttypes.h>
@@ -163,6 +147,7 @@ AC_DEFUN([gl_INTTYPES_H_DEFAULTS],
   HAVE_DECL_IMAXDIV=1;   AC_SUBST([HAVE_DECL_IMAXDIV])
   HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX])
   HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX])
+  REPLACE_STRTOIMAX=0;   AC_SUBST([REPLACE_STRTOIMAX])
   INT32_MAX_LT_INTMAX_MAX=1;  AC_SUBST([INT32_MAX_LT_INTMAX_MAX])
   INT64_MAX_EQ_LONG_MAX='defined _LP64';  AC_SUBST([INT64_MAX_EQ_LONG_MAX])
   PRI_MACROS_BROKEN=0;   AC_SUBST([PRI_MACROS_BROKEN])
index d83fea1233d7a5b173fb5b1a34697f33895e4792..a88850afedc3ded66a70a514b77e2a44bb1e838a 100644 (file)
@@ -1,6 +1,6 @@
 # Enable large files on systems where this is not the default.
 
-# Copyright 1992-1996, 1998-2011 Free Software Foundation, Inc.
+# Copyright 1992-1996, 1998-2012 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -102,3 +102,48 @@ fi
 ])# AC_SYS_LARGEFILE
 
 ])# m4_version_prereq 2.69
+
+# Enable large files on systems where this is implemented by Gnulib, not by the
+# system headers.
+# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib
+# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively.
+AC_DEFUN([gl_LARGEFILE],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  case "$host_os" in
+    mingw*)
+      dnl Native Windows.
+      dnl mingw64 defines off_t to a 64-bit type already, if
+      dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE.
+      AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64],
+        [AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[#include <sys/types.h>
+                int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1];
+              ]],
+              [[]])],
+           [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no])
+        ])
+      if test $gl_cv_type_off_t_64 = no; then
+        WINDOWS_64_BIT_OFF_T=1
+      else
+        WINDOWS_64_BIT_OFF_T=0
+      fi
+      dnl But all native Windows platforms (including mingw64) have a 32-bit
+      dnl st_size member in 'struct stat'.
+      WINDOWS_64_BIT_ST_SIZE=1
+      ;;
+    *)
+      dnl Nothing to do on gnulib's side.
+      dnl A 64-bit off_t is
+      dnl   - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX,
+      dnl     OSF/1, Cygwin,
+      dnl   - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on
+      dnl     glibc, HP-UX, Solaris,
+      dnl   - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX,
+      dnl   - impossible to achieve on Minix 3.1.8.
+      WINDOWS_64_BIT_OFF_T=0
+      WINDOWS_64_BIT_ST_SIZE=0
+      ;;
+  esac
+])
index aed816cfa5e46efe628199bf956a0914cb0d883e..b9c65c756ee0665d1c45a35850d033eabf9bf753 100644 (file)
@@ -1,5 +1,5 @@
-# longlong.m4 serial 16
-dnl Copyright (C) 1999-2007, 2009-2011 Free Software Foundation, Inc.
+# longlong.m4 serial 17
+dnl Copyright (C) 1999-2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -51,7 +51,7 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
       fi])
   if test $ac_cv_type_long_long_int = yes; then
     AC_DEFINE([HAVE_LONG_LONG_INT], [1],
-      [Define to 1 if the system has the type `long long int'.])
+      [Define to 1 if the system has the type 'long long int'.])
   fi
 ])
 
@@ -77,7 +77,7 @@ AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT],
      fi])
   if test $ac_cv_type_unsigned_long_long_int = yes; then
     AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1],
-      [Define to 1 if the system has the type `unsigned long long int'.])
+      [Define to 1 if the system has the type 'unsigned long long int'.])
   fi
 ])
 
index fe161d40101dce4335e51d747acd00090d9cd215..b7335bda1b22919415a2da966002487e194443cb 100644 (file)
@@ -1,6 +1,6 @@
-# serial 23
+# serial 25
 
-# Copyright (C) 1997-2001, 2003-2011 Free Software Foundation, Inc.
+# Copyright (C) 1997-2001, 2003-2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -16,9 +16,11 @@ AC_DEFUN([gl_FUNC_LSTAT],
   AC_CHECK_FUNCS_ONCE([lstat])
   if test $ac_cv_func_lstat = yes; then
     AC_REQUIRE([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
-    if test $gl_cv_func_lstat_dereferences_slashed_symlink = no; then
-      REPLACE_LSTAT=1
-    fi
+    case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+      *no)
+        REPLACE_LSTAT=1
+        ;;
+    esac
   else
     HAVE_LSTAT=0
   fi
@@ -51,20 +53,25 @@ AC_DEFUN([gl_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK],
             ]])],
          [gl_cv_func_lstat_dereferences_slashed_symlink=yes],
          [gl_cv_func_lstat_dereferences_slashed_symlink=no],
-         [# When cross-compiling, be pessimistic so we will end up using the
-          # replacement version of lstat that checks for trailing slashes and
-          # calls lstat a second time when necessary.
-          gl_cv_func_lstat_dereferences_slashed_symlink=no
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_lstat_dereferences_slashed_symlink="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_lstat_dereferences_slashed_symlink="guessing no" ;;
+          esac
          ])
      else
        # If the 'ln -s' command failed, then we probably don't even
        # have an lstat function.
-       gl_cv_func_lstat_dereferences_slashed_symlink=no
+       gl_cv_func_lstat_dereferences_slashed_symlink="guessing no"
      fi
      rm -f conftest.sym conftest.file
     ])
-  test $gl_cv_func_lstat_dereferences_slashed_symlink = yes &&
-    AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
-      [Define to 1 if `lstat' dereferences a symlink specified
-       with a trailing slash.])
+  case "$gl_cv_func_lstat_dereferences_slashed_symlink" in
+    *yes)
+      AC_DEFINE_UNQUOTED([LSTAT_FOLLOWS_SLASHED_SYMLINK], [1],
+        [Define to 1 if 'lstat' dereferences a symlink specified
+         with a trailing slash.])
+      ;;
+  esac
 ])
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
new file mode 100644 (file)
index 0000000..864fc85
--- /dev/null
@@ -0,0 +1,183 @@
+# manywarnings.m4 serial 4
+dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
+# --------------------------------------------------
+# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
+# Elements separated by whitespace.  In set logic terms, the function
+# does OUTVAR = LISTVAR \ REMOVEVAR.
+AC_DEFUN([gl_MANYWARN_COMPLEMENT],
+[
+  gl_warn_set=
+  set x $2; shift
+  for gl_warn_item
+  do
+    case " $3 " in
+      *" $gl_warn_item "*)
+        ;;
+      *)
+        gl_warn_set="$gl_warn_set $gl_warn_item"
+        ;;
+    esac
+  done
+  $1=$gl_warn_set
+])
+
+# gl_MANYWARN_ALL_GCC(VARIABLE)
+# -----------------------------
+# Add all documented GCC warning parameters to variable VARIABLE.
+# Note that you need to test them using gl_WARN_ADD if you want to
+# make sure your gcc understands it.
+AC_DEFUN([gl_MANYWARN_ALL_GCC],
+[
+  dnl First, check if -Wno-missing-field-initializers is needed.
+  dnl -Wmissing-field-initializers is implied by -W, but that issues
+  dnl warnings with GCC version before 4.7, for the common idiom
+  dnl of initializing types on the stack to zero, using { 0, }
+  AC_REQUIRE([AC_PROG_CC])
+  if test -n "$GCC"; then
+
+    dnl First, check -W -Werror -Wno-missing-field-initializers is supported
+    dnl with the current $CC $CFLAGS $CPPFLAGS.
+    AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported])
+    AC_CACHE_VAL([gl_cv_cc_nomfi_supported], [
+      gl_save_CFLAGS="$CFLAGS"
+      CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM([[]], [[]])],
+        [gl_cv_cc_nomfi_supported=yes],
+        [gl_cv_cc_nomfi_supported=no])
+      CFLAGS="$gl_save_CFLAGS"])
+    AC_MSG_RESULT([$gl_cv_cc_nomfi_supported])
+
+    if test "$gl_cv_cc_nomfi_supported" = yes; then
+      dnl Now check whether -Wno-missing-field-initializers is needed
+      dnl for the { 0, } construct.
+      AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed])
+      AC_CACHE_VAL([gl_cv_cc_nomfi_needed], [
+        gl_save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS -W -Werror"
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[void f (void)
+               {
+                 typedef struct { int a; int b; } s_t;
+                 s_t s1 = { 0, };
+               }
+             ]],
+             [[]])],
+          [gl_cv_cc_nomfi_needed=no],
+          [gl_cv_cc_nomfi_needed=yes])
+        CFLAGS="$gl_save_CFLAGS"
+      ])
+      AC_MSG_RESULT([$gl_cv_cc_nomfi_needed])
+    fi
+  fi
+
+  gl_manywarn_set=
+  for gl_manywarn_item in \
+    -Wall \
+    -W \
+    -Wformat-y2k \
+    -Wformat-nonliteral \
+    -Wformat-security \
+    -Winit-self \
+    -Wmissing-include-dirs \
+    -Wswitch-default \
+    -Wswitch-enum \
+    -Wunused \
+    -Wunknown-pragmas \
+    -Wstrict-aliasing \
+    -Wstrict-overflow \
+    -Wsystem-headers \
+    -Wfloat-equal \
+    -Wtraditional \
+    -Wtraditional-conversion \
+    -Wdeclaration-after-statement \
+    -Wundef \
+    -Wshadow \
+    -Wunsafe-loop-optimizations \
+    -Wpointer-arith \
+    -Wbad-function-cast \
+    -Wc++-compat \
+    -Wcast-qual \
+    -Wcast-align \
+    -Wwrite-strings \
+    -Wconversion \
+    -Wsign-conversion \
+    -Wlogical-op \
+    -Waggregate-return \
+    -Wstrict-prototypes \
+    -Wold-style-definition \
+    -Wmissing-prototypes \
+    -Wmissing-declarations \
+    -Wmissing-noreturn \
+    -Wmissing-format-attribute \
+    -Wpacked \
+    -Wpadded \
+    -Wredundant-decls \
+    -Wnested-externs \
+    -Wunreachable-code \
+    -Winline \
+    -Winvalid-pch \
+    -Wlong-long \
+    -Wvla \
+    -Wvolatile-register-var \
+    -Wdisabled-optimization \
+    -Wstack-protector \
+    -Woverlength-strings \
+    -Wbuiltin-macro-redefined \
+    -Wmudflap \
+    -Wpacked-bitfield-compat \
+    -Wsync-nand \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+  # The following are not documented in the manual but are included in
+  # output from gcc --help=warnings.
+  for gl_manywarn_item in \
+    -Wattributes \
+    -Wcoverage-mismatch \
+    -Wunused-macros \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+  # More warnings from gcc 4.6.2 --help=warnings.
+  for gl_manywarn_item in \
+    -Wabi \
+    -Wcpp \
+    -Wdeprecated \
+    -Wdeprecated-declarations \
+    -Wdiv-by-zero \
+    -Wdouble-promotion \
+    -Wendif-labels \
+    -Wextra \
+    -Wformat-contains-nul \
+    -Wformat-extra-args \
+    -Wformat-zero-length \
+    -Wformat=2 \
+    -Wmultichar \
+    -Wnormalized=nfc \
+    -Woverflow \
+    -Wpointer-to-int-cast \
+    -Wpragmas \
+    -Wsuggest-attribute=const \
+    -Wsuggest-attribute=noreturn \
+    -Wsuggest-attribute=pure \
+    -Wtrampolines \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+
+  # Disable the missing-field-initializers warning if needed
+  if test "$gl_cv_cc_nomfi_needed" = yes; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
+  fi
+
+  $1=$gl_manywarn_set
+])
index 4b41a85b354c3b413ee1ade877448dbc0ceed535..e22f7bdb17ae5beab160e08e8b5747a0cffae513 100644 (file)
--- a/m4/md5.m4
+++ b/m4/md5.m4
@@ -1,5 +1,5 @@
 # md5.m4 serial 12
-dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 8ed6d5d2a307fe0f2c6540b50521cfb4b22809bc..00ee2dabea56f25f7e2752995601c455cd7b4dc7 100644 (file)
@@ -1,5 +1,5 @@
-# serial 21
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation,
+# serial 23
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2012 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -17,7 +17,7 @@ AC_DEFUN([gl_FUNC_MKTIME],
   AC_CHECK_FUNCS_ONCE([alarm])
   AC_REQUIRE([gl_MULTIARCH])
   if test $APPLE_UNIVERSAL_BUILD = 1; then
-    # A universal build on Apple MacOS X platforms.
+    # A universal build on Apple Mac OS X platforms.
     # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode.
     # But we need a configuration result that is valid in both modes.
     gl_cv_func_working_mktime=no
@@ -192,20 +192,23 @@ main ()
       if (tz_strings[i])
         putenv (tz_strings[i]);
 
-      for (t = 0; t <= time_t_max - delta; t += delta)
+      for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta)
         if (! mktime_test (t))
           result |= 1;
-      if (! (mktime_test ((time_t) 1)
-             && mktime_test ((time_t) (60 * 60))
-             && mktime_test ((time_t) (60 * 60 * 24))))
+      if ((result & 2) == 0
+          && ! (mktime_test ((time_t) 1)
+                && mktime_test ((time_t) (60 * 60))
+                && mktime_test ((time_t) (60 * 60 * 24))))
         result |= 2;
 
-      for (j = 1; ; j <<= 1)
-        if (! bigtime_test (j))
-          result |= 4;
-        else if (INT_MAX / 2 < j)
-          break;
-      if (! bigtime_test (INT_MAX))
+      for (j = 1; (result & 4) == 0; j <<= 1)
+        {
+          if (! bigtime_test (j))
+            result |= 4;
+          if (INT_MAX / 2 < j)
+            break;
+        }
+      if ((result & 8) == 0 && ! bigtime_test (INT_MAX))
         result |= 8;
     }
   if (! irix_6_4_bug ())
index 691d89270b69ea15a1e83a9584a959d008f386bc..0c288b8d2a9d75320a982b6215ba0ca440e8fdae 100644 (file)
@@ -1,12 +1,12 @@
-# multiarch.m4 serial 6
-dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+# multiarch.m4 serial 7
+dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 # Determine whether the compiler is or may be producing universal binaries.
 #
-# On MacOS X 10.5 and later systems, the user can create libraries and
+# On Mac OS X 10.5 and later systems, the user can create libraries and
 # executables that work on multiple system types--known as "fat" or
 # "universal" binaries--by specifying multiple '-arch' options to the
 # compiler but only a single '-arch' option to the preprocessor.  Like
index 60aad952956a8543599133a0865a6fab0f7ed16c..c2638df626c3ffd3f2de64cd3bd46db7c1c60c48 100644 (file)
@@ -1,5 +1,5 @@
-# nocrash.m4 serial 3
-dnl Copyright (C) 2005, 2009-2011 Free Software Foundation, Inc.
+# nocrash.m4 serial 4
+dnl Copyright (C) 2005, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -18,7 +18,7 @@ dnl          int main() { nocrash_init(); ... }
 AC_DEFUN([GL_NOCRASH],[[
 #include <stdlib.h>
 #if defined __MACH__ && defined __APPLE__
-/* Avoid a crash on MacOS X.  */
+/* Avoid a crash on Mac OS X.  */
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <mach/thread_status.h>
diff --git a/m4/off_t.m4 b/m4/off_t.m4
new file mode 100644 (file)
index 0000000..dfca2df
--- /dev/null
@@ -0,0 +1,18 @@
+# off_t.m4 serial 1
+dnl Copyright (C) 2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Check whether to override the 'off_t' type.
+dnl Set WINDOWS_64_BIT_OFF_T.
+
+AC_DEFUN([gl_TYPE_OFF_T],
+[
+  m4_ifdef([gl_LARGEFILE], [
+    AC_REQUIRE([gl_LARGEFILE])
+  ], [
+    WINDOWS_64_BIT_OFF_T=0
+  ])
+  AC_SUBST([WINDOWS_64_BIT_OFF_T])
+])
index 4913fa06cb850749c4f33bf5fcfdc01b5cf5c917..011786129e00d348c8774a310481c742ffc29ca2 100644 (file)
@@ -1,5 +1,5 @@
 # pathmax.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2006, 2009-2011 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2006, 2009-2012 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/pselect.m4 b/m4/pselect.m4
new file mode 100644 (file)
index 0000000..97bf12c
--- /dev/null
@@ -0,0 +1,31 @@
+# pselect.m4
+dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_FUNC_PSELECT],
+[
+  AC_REQUIRE([gl_HEADER_SYS_SELECT])
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_CHECK_FUNCS_ONCE([pselect])
+
+  if test $ac_cv_func_pselect = yes; then
+    AC_CACHE_CHECK([whether signature of pselect conforms to POSIX],
+      gl_cv_sig_pselect,
+      [AC_LINK_IFELSE(
+         [AC_LANG_PROGRAM(
+              [[#include <sys/select.h>
+                ]],
+              [[int (*p) (int, fd_set *, fd_set *, fd_set *restrict,
+                          struct timespec const *restrict,
+                          sigset_t const *restrict) = pselect;
+                return !p;]])],
+         [gl_cv_sig_pselect=yes],
+         [gl_cv_sig_pselect=no])])
+  fi
+
+  if test $ac_cv_func_pselect = no || test $gl_cv_sig_pselect = no; then
+    REPLACE_PSELECT=1
+  fi
+])
index f06bc119ff39beb1f1e2d61b43bae883b66c2f06..884edbdb5bb685e6ab7f2fe8192922076aaa4238 100644 (file)
@@ -1,11 +1,13 @@
-# pthread_sigmask.m4 serial 12
-dnl Copyright (C) 2011 Free Software Foundation, Inc.
+# pthread_sigmask.m4 serial 13
+dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
 [
+  AC_REQUIRE([gl_SIGNAL_H_DEFAULTS])
+
   AC_CHECK_FUNCS_ONCE([pthread_sigmask])
   LIB_PTHREAD_SIGMASK=
 
index 91d7df3c91cbdc8305eda185eac23797e1950e71..ccf5141d40b9780fc72ac9094eaeed1270d1c12f 100644 (file)
@@ -1,5 +1,5 @@
-# readlink.m4 serial 11
-dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc.
+# readlink.m4 serial 12
+dnl Copyright (C) 2003, 2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -7,6 +7,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_READLINK],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_FUNCS_ONCE([readlink])
   if test $ac_cv_func_readlink = no; then
     HAVE_READLINK=0
@@ -32,15 +33,26 @@ AC_DEFUN([gl_FUNC_READLINK],
 ]], [[char buf[20];
       return readlink ("conftest.lnk2/", buf, sizeof buf) != -1;]])],
          [gl_cv_func_readlink_works=yes], [gl_cv_func_readlink_works=no],
-         [gl_cv_func_readlink_works="guessing no"])
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_readlink_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_readlink_works="guessing no" ;;
+          esac
+         ])
       rm -f conftest.link conftest.lnk2])
-    if test "$gl_cv_func_readlink_works" != yes; then
-      AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
-        fails to recognize a trailing slash.])
-      REPLACE_READLINK=1
-    elif test "$gl_cv_decl_readlink_works" != yes; then
-      REPLACE_READLINK=1
-    fi
+    case "$gl_cv_func_readlink_works" in
+      *yes)
+        if test "$gl_cv_decl_readlink_works" != yes; then
+          REPLACE_READLINK=1
+        fi
+        ;;
+      *)
+        AC_DEFINE([READLINK_TRAILING_SLASH_BUG], [1], [Define to 1 if readlink
+          fails to recognize a trailing slash.])
+        REPLACE_READLINK=1
+        ;;
+    esac
   fi
 ])
 
index b8f5c1dcafec3bc3df5947833525e46b95c27f7e..76198258b92c2045b44b06e82b8385f5d688f427 100644 (file)
@@ -1,5 +1,5 @@
 # sha1.m4 serial 10
-dnl Copyright (C) 2002-2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index a3429ed34234d9995055c15a8ef4e8e1c6f89417..78cc95ed8b6b3f7c7a3af1706e723d64f0fdc0e2 100644 (file)
@@ -1,5 +1,5 @@
 # sha256.m4 serial 5
-dnl Copyright (C) 2005, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index cd6a0bf302a103825f091559857dae0dfe946bf5..937ea8d5e9dd1865bd5d9e7547bbb67d908ff0d7 100644 (file)
@@ -1,5 +1,5 @@
 # sha512.m4 serial 6
-dnl Copyright (C) 2005-2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 5cf54a062fc3832bb2a5519fa53158923c3bed97..ed4d7306eee717a366a8f1d4af1fcbfb9893bac3 100644 (file)
@@ -1,5 +1,5 @@
 # signal_h.m4 serial 18
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index eda856d04f9d5616843bc6092fd519066ac9e467..ab8035efb75c73757d52e471a4e598bd5c109dad 100644 (file)
@@ -1,5 +1,5 @@
 # signalblocking.m4 serial 13
-dnl Copyright (C) 2001-2002, 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2002, 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 447515444858c400e0be51ebe8313d27356b284f..a4ab43b3333d754c5c876d658b1ccd43e7a50c96 100644 (file)
@@ -1,5 +1,5 @@
 # socklen.m4 serial 10
-dnl Copyright (C) 2005-2007, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2007, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index d7127521ebe126afa0eaff14fe7167a7766bea95..209d64c82354ce8c322f45098010980cb7786a2d 100644 (file)
@@ -1,5 +1,5 @@
 # ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2003, 2006, 2010-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 84f74638f1207961c3e9bd0a8f4a88023bd5c612..b87cec00bee02a86f967acf6eee63ae73ae3a2ad 100644 (file)
@@ -1,6 +1,6 @@
 # serial 6
 
-# Copyright (C) 1998-1999, 2001, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 1998-1999, 2001, 2009-2012 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/stat-time.m4 b/m4/stat-time.m4
new file mode 100644 (file)
index 0000000..2dbb1f3
--- /dev/null
@@ -0,0 +1,85 @@
+# Checks for stat-related time functions.
+
+# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2012 Free Software
+# Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl From Paul Eggert.
+
+# st_atim.tv_nsec - Linux, Solaris, Cygwin
+# st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
+# st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
+# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
+
+# st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway)
+# st_birthtim - Cygwin 1.7.0+
+
+AC_DEFUN([gl_STAT_TIME],
+[
+  AC_REQUIRE([AC_C_INLINE])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
+
+  AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
+    [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
+       [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
+       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
+          [[
+            #include <sys/types.h>
+            #include <sys/stat.h>
+            #if HAVE_SYS_TIME_H
+            # include <sys/time.h>
+            #endif
+            #include <time.h>
+            struct timespec ts;
+            struct stat st;
+          ]],
+          [[
+            st.st_atim = ts;
+          ]])],
+          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
+          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
+     if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
+       AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
+         [Define to 1 if the type of the st_atim member of a struct stat is
+          struct timespec.])
+     fi],
+    [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
+       [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
+          [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
+             [#include <sys/types.h>
+              #include <sys/stat.h>])],
+          [#include <sys/types.h>
+           #include <sys/stat.h>])],
+       [#include <sys/types.h>
+        #include <sys/stat.h>])],
+    [#include <sys/types.h>
+     #include <sys/stat.h>])
+])
+
+# Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.)
+# and NTFS (Cygwin).
+# There was a time when this field was named st_createtime (21 June
+# 2002 to 16 July 2002) But that window is very small and applied only
+# to development code, so systems still using that configuration are
+# not supported.  See revisions 1.10 and 1.11 of FreeBSD's
+# src/sys/ufs/ufs/dinode.h.
+#
+AC_DEFUN([gl_STAT_BIRTHTIME],
+[
+  AC_REQUIRE([AC_C_INLINE])
+  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
+  AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [],
+    [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [],
+      [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [],
+         [#include <sys/types.h>
+          #include <sys/stat.h>])],
+       [#include <sys/types.h>
+        #include <sys/stat.h>])],
+    [#include <sys/types.h>
+     #include <sys/stat.h>])
+])
index c63f59fd5330e1e507c0e16b219581f5e63dd2ae..a8b79f5bcbaad568ac3e245fc0f10a8426fcbe9c 100644 (file)
@@ -1,6 +1,6 @@
-# serial 8
+# serial 10
 
-# Copyright (C) 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2009-2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -23,8 +23,9 @@ AC_DEFUN([gl_FUNC_STAT],
             mingw*) gl_cv_func_stat_dir_slash="guessing no";;
             *) gl_cv_func_stat_dir_slash="guessing yes";;
           esac])])
-  dnl AIX 7.1, Solaris 9 mistakenly succeed on stat("file/")
-  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/")
+  dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/").
+  dnl (For mingw, this is due to a broken stat() override in libmingwex.a.)
+  dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/").
   AC_CACHE_CHECK([whether stat handles trailing slashes on files],
       [gl_cv_func_stat_file_slash],
       [touch conftest.tmp
@@ -46,7 +47,13 @@ AC_DEFUN([gl_FUNC_STAT],
       return result;
            ]])],
          [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no],
-         [gl_cv_func_stat_file_slash="guessing no"])
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_stat_file_slash="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_stat_file_slash="guessing no" ;;
+          esac
+         ])
        rm -f conftest.tmp conftest.lnk])
   case $gl_cv_func_stat_dir_slash in
     *no) REPLACE_STAT=1
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
new file mode 100644 (file)
index 0000000..6659c9c
--- /dev/null
@@ -0,0 +1,51 @@
+# Check for stdalign.h that conforms to C11.
+
+dnl Copyright 2011-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# Prepare for substituting <stdalign.h> if it is not supported.
+
+AC_DEFUN([gl_STDALIGN_H],
+[
+  AC_CACHE_CHECK([for working stdalign.h],
+    [gl_cv_header_working_stdalign_h],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#include <stdalign.h>
+            #include <stddef.h>
+
+            /* Test that alignof yields a result consistent with offsetof.
+               This catches GCC bug 52023
+               <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.  */
+            #ifdef __cplusplus
+               template <class t> struct alignof_helper { char a; t b; };
+            # define ao(type) offsetof (alignof_helper<type>, b)
+            #else
+            # define ao(type) offsetof (struct { char a; type b; }, b)
+            #endif
+            char test_double[ao (double) % _Alignof (double) == 0 ? 1 : -1];
+            char test_long[ao (long int) % _Alignof (long int) == 0 ? 1 : -1];
+            char test_alignof[alignof (double) == _Alignof (double) ? 1 : -1];
+
+            /* Test _Alignas only on platforms where gnulib can help.  */
+            #if \
+                (__GNUC__ || __IBMC__ || __IBMCPP__ \
+                 || 0x5110 <= __SUNPRO_C || 1300 <= _MSC_VER)
+              int alignas (8) alignas_int = 1;
+              char test_alignas[_Alignof (alignas_int) == 8 ? 1 : -1];
+            #endif
+          ]])],
+       [gl_cv_header_working_stdalign_h=yes],
+       [gl_cv_header_working_stdalign_h=no])])
+
+  if test $gl_cv_header_working_stdalign_h = yes; then
+    STDALIGN_H=''
+  else
+    STDALIGN_H='stdalign.h'
+  fi
+
+  AC_SUBST([STDALIGN_H])
+  AM_CONDITIONAL([GL_GENERATE_STDALIGN_H], [test -n "$STDALIGN_H"])
+])
index 5705de9ecaa9624d31dde5993659c2bffc5d3a2f..5c313cb8c91034c4b1983dbcb6199f47520c583b 100644 (file)
@@ -1,5 +1,5 @@
 # stdarg.m4 serial 6
-dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 1ebf3e6808c51e09a7aeea687c1671bb091c9d91..eabfa64579c2d7007ec404a146131053ee2fd407 100644 (file)
@@ -1,6 +1,6 @@
 # Check for stdbool.h that conforms to C99.
 
-dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 1ae2344318e3f3db73ae4806ceb734a66b6d7e5c..cc116096093401ce22232c7ffe21c47051e33832 100644 (file)
@@ -1,6 +1,6 @@
 dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
 # stddef_h.m4 serial 4
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 092161c9968b23ef8151e97b7ac466ea540ca36d..28d342ea233527ce1676208f176137f4104a1407 100644 (file)
@@ -1,5 +1,5 @@
-# stdint.m4 serial 41
-dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
+# stdint.m4 serial 43
+dnl Copyright (C) 2001-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -69,8 +69,6 @@ AC_DEFUN_ONCE([gl_STDINT_H],
       [gl_cv_header_working_stdint_h=no
        AC_COMPILE_IFELSE([
          AC_LANG_PROGRAM([[
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 #include <stdint.h>
 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>.  */
@@ -219,8 +217,6 @@ struct s {
           dnl This detects a bug on HP-UX 11.23/ia64.
           AC_RUN_IFELSE([
             AC_LANG_PROGRAM([[
-#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
-#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
 #include <stdint.h>
 ]
index 39bf80e2ac9f16e4dcdcc9b57c7ef300be89cc6d..5298dd6d9d5e491e4fc40fff4f0bea509d69ff03 100644 (file)
@@ -1,5 +1,5 @@
-# stdio_h.m4 serial 40
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+# stdio_h.m4 serial 42
+dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -13,12 +13,13 @@ AC_DEFUN([gl_STDIO_H],
   dnl No need to create extra modules for these functions. Everyone who uses
   dnl <stdio.h> likely needs them.
   GNULIB_FSCANF=1
+  gl_MODULE_INDICATOR([fscanf])
   GNULIB_SCANF=1
+  gl_MODULE_INDICATOR([scanf])
   GNULIB_FGETC=1
   GNULIB_GETC=1
   GNULIB_GETCHAR=1
   GNULIB_FGETS=1
-  GNULIB_GETS=1
   GNULIB_FREAD=1
   dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
   dnl "expected source file, required through AC_LIBSOURCES, not found". It is
@@ -72,10 +73,10 @@ AC_DEFUN([gl_STDIO_H],
 
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use, and which is not
-  dnl guaranteed by C89.
+  dnl guaranteed by both C89 and C11.
   gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
-    ]], [dprintf fpurge fseeko ftello getdelim getline pclose popen renameat
-    snprintf tmpfile vdprintf vsnprintf])
+    ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
+    renameat snprintf tmpfile vdprintf vsnprintf])
 ])
 
 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
@@ -113,7 +114,6 @@ AC_DEFUN([gl_STDIO_H_DEFAULTS],
   GNULIB_GETCHAR=0;              AC_SUBST([GNULIB_GETCHAR])
   GNULIB_GETDELIM=0;             AC_SUBST([GNULIB_GETDELIM])
   GNULIB_GETLINE=0;              AC_SUBST([GNULIB_GETLINE])
-  GNULIB_GETS=0;                 AC_SUBST([GNULIB_GETS])
   GNULIB_OBSTACK_PRINTF=0;       AC_SUBST([GNULIB_OBSTACK_PRINTF])
   GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
   GNULIB_PCLOSE=0;               AC_SUBST([GNULIB_PCLOSE])
index 25fdada0de7b23477ffa8b158d52c4ef9be72712..ab43728ace41a4ce331571421396fbbe8ce867cb 100644 (file)
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 37
-dnl Copyright (C) 2007-2011 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 41
+dnl Copyright (C) 2007-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -19,10 +19,11 @@ AC_DEFUN([gl_STDLIB_H],
 #if HAVE_RANDOM_H
 # include <random.h>
 #endif
-    ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt mkdtemp
-    mkostemp mkostemps mkstemp mkstemps ptsname random_r initstat_r srandom_r
-    setstate_r realpath rpmatch setenv strtod strtoll strtoull unlockpt
-    unsetenv])
+    ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
+    initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
+    posix_openpt ptsname ptsname_r random random_r realpath rpmatch
+    setenv setstate setstate_r srandom srandom_r
+    strtod strtoll strtoull unlockpt unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -50,8 +51,11 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_MKOSTEMPS=0;     AC_SUBST([GNULIB_MKOSTEMPS])
   GNULIB_MKSTEMP=0;       AC_SUBST([GNULIB_MKSTEMP])
   GNULIB_MKSTEMPS=0;      AC_SUBST([GNULIB_MKSTEMPS])
+  GNULIB_POSIX_OPENPT=0;  AC_SUBST([GNULIB_POSIX_OPENPT])
   GNULIB_PTSNAME=0;       AC_SUBST([GNULIB_PTSNAME])
+  GNULIB_PTSNAME_R=0;     AC_SUBST([GNULIB_PTSNAME_R])
   GNULIB_PUTENV=0;        AC_SUBST([GNULIB_PUTENV])
+  GNULIB_RANDOM=0;        AC_SUBST([GNULIB_RANDOM])
   GNULIB_RANDOM_R=0;      AC_SUBST([GNULIB_RANDOM_R])
   GNULIB_REALLOC_POSIX=0; AC_SUBST([GNULIB_REALLOC_POSIX])
   GNULIB_REALPATH=0;      AC_SUBST([GNULIB_REALPATH])
@@ -76,7 +80,10 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
   HAVE_MKSTEMP=1;            AC_SUBST([HAVE_MKSTEMP])
   HAVE_MKSTEMPS=1;           AC_SUBST([HAVE_MKSTEMPS])
+  HAVE_POSIX_OPENPT=1;       AC_SUBST([HAVE_POSIX_OPENPT])
   HAVE_PTSNAME=1;            AC_SUBST([HAVE_PTSNAME])
+  HAVE_PTSNAME_R=1;          AC_SUBST([HAVE_PTSNAME_R])
+  HAVE_RANDOM=1;             AC_SUBST([HAVE_RANDOM])
   HAVE_RANDOM_H=1;           AC_SUBST([HAVE_RANDOM_H])
   HAVE_RANDOM_R=1;           AC_SUBST([HAVE_RANDOM_R])
   HAVE_REALPATH=1;           AC_SUBST([HAVE_REALPATH])
@@ -95,7 +102,9 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
   REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
+  REPLACE_PTSNAME_R=0;       AC_SUBST([REPLACE_PTSNAME_R])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
+  REPLACE_RANDOM_R=0;        AC_SUBST([REPLACE_RANDOM_R])
   REPLACE_REALLOC=0;         AC_SUBST([REPLACE_REALLOC])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
   REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
index dd30ccfc0540a28107f770daee710191ec107b76..42043019b4b7ccd3c94184c067d5ba744b4f86f2 100644 (file)
@@ -1,6 +1,6 @@
 # serial 33
 
-# Copyright (C) 1996-1997, 1999-2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2007, 2009-2012 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
index a8d0b69c205dde0ce95a27f58e45474ce45d3901..58a31899b8b49ee6fc9ea9b2da4a0a08ce2f2622 100644 (file)
@@ -1,5 +1,5 @@
-# strtoimax.m4 serial 11
-dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc.
+# strtoimax.m4 serial 13
+dnl Copyright (C) 2002-2004, 2006, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -14,6 +14,66 @@ AC_DEFUN([gl_FUNC_STRTOIMAX],
   if test "$ac_cv_have_decl_strtoimax" != yes; then
     HAVE_DECL_STRTOIMAX=0
   fi
+
+  if test $ac_cv_func_strtoimax = yes; then
+    HAVE_STRTOIMAX=1
+    dnl On AIX 5.1, strtoimax() fails for values outside the 'int' range.
+    AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+    AC_CACHE_CHECK([whether strtoimax works], [gl_cv_func_strtoimax],
+      [AC_RUN_IFELSE(
+         [AC_LANG_SOURCE([[
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
+int main ()
+{
+  if (sizeof (intmax_t) > sizeof (int))
+    {
+      const char *s = "4294967295";
+      char *p;
+      intmax_t res;
+      errno = 0;
+      res = strtoimax (s, &p, 10);
+      if (p != s + strlen (s))
+        return 1;
+      if (errno != 0)
+        return 2;
+      if (res != (intmax_t) 65535 * (intmax_t) 65537)
+        return 3;
+    }
+  else
+    {
+      const char *s = "2147483647";
+      char *p;
+      intmax_t res;
+      errno = 0;
+      res = strtoimax (s, &p, 10);
+      if (p != s + strlen (s))
+        return 1;
+      if (errno != 0)
+        return 2;
+      if (res != 2147483647)
+        return 3;
+    }
+  return 0;
+}
+]])],
+         [gl_cv_func_strtoimax=yes],
+         [gl_cv_func_strtoimax=no],
+         [case "$host_os" in
+                   # Guess no on AIX 5.
+            aix5*) gl_cv_func_strtoimax="guessing no" ;;
+                   # Guess yes otherwise.
+            *)     gl_cv_func_strtoimax="guessing yes" ;;
+          esac
+         ])
+      ])
+    case "$gl_cv_func_strtoimax" in
+      *no) REPLACE_STRTOIMAX=1 ;;
+    esac
+  else
+    HAVE_STRTOIMAX=0
+  fi
 ])
 
 # Prerequisites of lib/strtoimax.c.
index ed6a854b58c5c07ce7c3b69e553c1409fa51246f..5854bcb5827868500d36cf55af1c287b0633eab9 100644 (file)
@@ -1,5 +1,5 @@
 # strtoll.m4 serial 7
-dnl Copyright (C) 2002, 2004, 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 57ef75423df807bfc8fd115f845f63988f2c92fb..7c659f57d4e748840a41a62f338383e2cea01758 100644 (file)
@@ -1,5 +1,5 @@
 # strtoull.m4 serial 7
-dnl Copyright (C) 2002, 2004, 2006, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 1ddf6820e3fb7ca0a84a80dea807550ecebb03fb..5b2285c6b3528579b83d73d4cebc7213a97b611a 100644 (file)
@@ -1,5 +1,5 @@
 # strtoumax.m4 serial 11
-dnl Copyright (C) 2002-2004, 2006, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 680c14f6610f9e25223a0b3e3e27a9007a187b02..cfd90ec2b6e04cb5e2b884c2f574394facaa58b4 100644 (file)
@@ -1,7 +1,7 @@
-# serial 5
+# serial 6
 # See if we need to provide symlink replacement.
 
-dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -11,6 +11,7 @@ dnl with or without modifications, as long as this notice is preserved.
 AC_DEFUN([gl_FUNC_SYMLINK],
 [
   AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CHECK_FUNCS_ONCE([symlink])
   dnl The best we can do on mingw is provide a dummy that always fails, so
   dnl that compilation can proceed with fewer ifdefs.  On FreeBSD 7.2, AIX 7.1,
@@ -34,10 +35,19 @@ AC_DEFUN([gl_FUNC_SYMLINK],
              return result;
            ]])],
          [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no],
-         [gl_cv_func_symlink_works="guessing no"])
+         [case "$host_os" in
+                    # Guess yes on glibc systems.
+            *-gnu*) gl_cv_func_symlink_works="guessing yes" ;;
+                    # If we don't know, assume the worst.
+            *)      gl_cv_func_symlink_works="guessing no" ;;
+          esac
+         ])
       rm -f conftest.f conftest.link conftest.lnk2])
-    if test "$gl_cv_func_symlink_works" != yes; then
-      REPLACE_SYMLINK=1
-    fi
+    case "$gl_cv_func_symlink_works" in
+      *yes) ;;
+      *)
+        REPLACE_SYMLINK=1
+        ;;
+    esac
   fi
 ])
diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4
new file mode 100644 (file)
index 0000000..eaf056a
--- /dev/null
@@ -0,0 +1,95 @@
+# sys_select_h.m4 serial 20
+dnl Copyright (C) 2006-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_HEADER_SYS_SELECT],
+[
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+  AC_CACHE_CHECK([whether <sys/select.h> is self-contained],
+    [gl_cv_header_sys_select_h_selfcontained],
+    [
+      dnl Test against two bugs:
+      dnl 1. On many platforms, <sys/select.h> assumes prior inclusion of
+      dnl    <sys/types.h>.
+      dnl 2. On OSF/1 4.0, <sys/select.h> provides only a forward declaration
+      dnl    of 'struct timeval', and no definition of this type.
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/select.h>]],
+                                         [[struct timeval b;]])],
+        [gl_cv_header_sys_select_h_selfcontained=yes],
+        [gl_cv_header_sys_select_h_selfcontained=no])
+      dnl Test against another bug:
+      dnl 3. On Solaris 10, <sys/select.h> provides an FD_ZERO implementation
+      dnl    that relies on memset(), but without including <string.h>.
+      if test $gl_cv_header_sys_select_h_selfcontained = yes; then
+        AC_COMPILE_IFELSE(
+          [AC_LANG_PROGRAM([[#include <sys/select.h>]],
+                           [[int memset; int bzero;]])
+          ],
+          [AC_LINK_IFELSE(
+             [AC_LANG_PROGRAM([[#include <sys/select.h>]], [[
+                  #undef memset
+                  #define memset nonexistent_memset
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void *memset (void *, int, unsigned long);
+                  #undef bzero
+                  #define bzero nonexistent_bzero
+                  extern
+                  #ifdef __cplusplus
+                  "C"
+                  #endif
+                  void bzero (void *, unsigned long);
+                  fd_set fds;
+                  FD_ZERO (&fds);
+                ]])
+             ],
+             [],
+             [gl_cv_header_sys_select_h_selfcontained=no])
+          ])
+      fi
+    ])
+  dnl <sys/select.h> is always overridden, because of GNULIB_POSIXCHECK.
+  gl_CHECK_NEXT_HEADERS([sys/select.h])
+  if test $ac_cv_header_sys_select_h = yes; then
+    HAVE_SYS_SELECT_H=1
+  else
+    HAVE_SYS_SELECT_H=0
+  fi
+  AC_SUBST([HAVE_SYS_SELECT_H])
+  gl_PREREQ_SYS_H_WINSOCK2
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#if !(defined __GLIBC__ && !defined __UCLIBC__) && HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/select.h>
+    ]], [pselect select])
+])
+
+AC_DEFUN([gl_SYS_SELECT_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_SYS_SELECT_H_DEFAULTS])
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_SYS_SELECT_H_DEFAULTS],
+[
+  GNULIB_PSELECT=0; AC_SUBST([GNULIB_PSELECT])
+  GNULIB_SELECT=0; AC_SUBST([GNULIB_SELECT])
+  dnl Assume proper GNU behavior unless another module says otherwise.
+  HAVE_PSELECT=1; AC_SUBST([HAVE_PSELECT])
+  REPLACE_PSELECT=0; AC_SUBST([REPLACE_PSELECT])
+  REPLACE_SELECT=0; AC_SUBST([REPLACE_SELECT])
+])
diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4
new file mode 100644 (file)
index 0000000..8d4e7e1
--- /dev/null
@@ -0,0 +1,177 @@
+# sys_socket_h.m4 serial 22
+dnl Copyright (C) 2005-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson.
+
+AC_DEFUN([gl_HEADER_SYS_SOCKET],
+[
+  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_C_INLINE])
+
+  dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have
+  dnl old-style declarations (with return type 'int' instead of 'ssize_t')
+  dnl unless _POSIX_PII_SOCKET is defined.
+  case "$host_os" in
+    osf*)
+      AC_DEFINE([_POSIX_PII_SOCKET], [1],
+        [Define to 1 in order to get the POSIX compatible declarations
+         of socket functions.])
+      ;;
+  esac
+
+  AC_CACHE_CHECK([whether <sys/socket.h> is self-contained],
+    [gl_cv_header_sys_socket_h_selfcontained],
+    [
+      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/socket.h>]], [[]])],
+        [gl_cv_header_sys_socket_h_selfcontained=yes],
+        [gl_cv_header_sys_socket_h_selfcontained=no])
+    ])
+  if test $gl_cv_header_sys_socket_h_selfcontained = yes; then
+    dnl If the shutdown function exists, <sys/socket.h> should define
+    dnl SHUT_RD, SHUT_WR, SHUT_RDWR.
+    AC_CHECK_FUNCS([shutdown])
+    if test $ac_cv_func_shutdown = yes; then
+      AC_CACHE_CHECK([whether <sys/socket.h> defines the SHUT_* macros],
+        [gl_cv_header_sys_socket_h_shut],
+        [
+          AC_COMPILE_IFELSE(
+            [AC_LANG_PROGRAM([[#include <sys/socket.h>]],
+               [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])],
+            [gl_cv_header_sys_socket_h_shut=yes],
+            [gl_cv_header_sys_socket_h_shut=no])
+        ])
+      if test $gl_cv_header_sys_socket_h_shut = no; then
+        SYS_SOCKET_H='sys/socket.h'
+      fi
+    fi
+  fi
+  # We need to check for ws2tcpip.h now.
+  gl_PREREQ_SYS_H_SOCKET
+  AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[
+  /* sys/types.h is not needed according to POSIX, but the
+     sys/socket.h in i386-unknown-freebsd4.10 and
+     powerpc-apple-darwin5.5 required it. */
+#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_WS2TCPIP_H
+#include <ws2tcpip.h>
+#endif
+])
+  if test $ac_cv_type_struct_sockaddr_storage = no; then
+    HAVE_STRUCT_SOCKADDR_STORAGE=0
+  fi
+  if test $ac_cv_type_sa_family_t = no; then
+    HAVE_SA_FAMILY_T=0
+  fi
+  if test $ac_cv_type_struct_sockaddr_storage != no; then
+    AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],
+      [],
+      [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0],
+      [#include <sys/types.h>
+       #ifdef HAVE_SYS_SOCKET_H
+       #include <sys/socket.h>
+       #endif
+       #ifdef HAVE_WS2TCPIP_H
+       #include <ws2tcpip.h>
+       #endif
+      ])
+  fi
+  if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \
+     || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then
+    SYS_SOCKET_H='sys/socket.h'
+  fi
+  gl_PREREQ_SYS_H_WINSOCK2
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+/* Some systems require prerequisite headers.  */
+#include <sys/types.h>
+#include <sys/socket.h>
+    ]], [socket connect accept bind getpeername getsockname getsockopt
+    listen recv send recvfrom sendto setsockopt shutdown accept4])
+])
+
+AC_DEFUN([gl_PREREQ_SYS_H_SOCKET],
+[
+  dnl Check prerequisites of the <sys/socket.h> replacement.
+  AC_REQUIRE([gl_CHECK_SOCKET_HEADERS])
+  gl_CHECK_NEXT_HEADERS([sys/socket.h])
+  if test $ac_cv_header_sys_socket_h = yes; then
+    HAVE_SYS_SOCKET_H=1
+    HAVE_WS2TCPIP_H=0
+  else
+    HAVE_SYS_SOCKET_H=0
+    if test $ac_cv_header_ws2tcpip_h = yes; then
+      HAVE_WS2TCPIP_H=1
+    else
+      HAVE_WS2TCPIP_H=0
+    fi
+  fi
+  AC_SUBST([HAVE_SYS_SOCKET_H])
+  AC_SUBST([HAVE_WS2TCPIP_H])
+])
+
+# Common prerequisites of the <sys/socket.h> replacement and of the
+# <sys/select.h> replacement.
+# Sets and substitutes HAVE_WINSOCK2_H.
+AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2],
+[
+  m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])])
+  m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])])
+  AC_CHECK_HEADERS_ONCE([sys/socket.h])
+  if test $ac_cv_header_sys_socket_h != yes; then
+    dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make
+    dnl the check for those headers unconditional; yet cygwin reports
+    dnl that the headers are present but cannot be compiled (since on
+    dnl cygwin, all socket information should come from sys/socket.h).
+    AC_CHECK_HEADERS([winsock2.h])
+  fi
+  if test "$ac_cv_header_winsock2_h" = yes; then
+    HAVE_WINSOCK2_H=1
+    UNISTD_H_HAVE_WINSOCK2_H=1
+    SYS_IOCTL_H_HAVE_WINSOCK2_H=1
+  else
+    HAVE_WINSOCK2_H=0
+  fi
+  AC_SUBST([HAVE_WINSOCK2_H])
+])
+
+AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS])
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS],
+[
+  GNULIB_SOCKET=0;      AC_SUBST([GNULIB_SOCKET])
+  GNULIB_CONNECT=0;     AC_SUBST([GNULIB_CONNECT])
+  GNULIB_ACCEPT=0;      AC_SUBST([GNULIB_ACCEPT])
+  GNULIB_BIND=0;        AC_SUBST([GNULIB_BIND])
+  GNULIB_GETPEERNAME=0; AC_SUBST([GNULIB_GETPEERNAME])
+  GNULIB_GETSOCKNAME=0; AC_SUBST([GNULIB_GETSOCKNAME])
+  GNULIB_GETSOCKOPT=0;  AC_SUBST([GNULIB_GETSOCKOPT])
+  GNULIB_LISTEN=0;      AC_SUBST([GNULIB_LISTEN])
+  GNULIB_RECV=0;        AC_SUBST([GNULIB_RECV])
+  GNULIB_SEND=0;        AC_SUBST([GNULIB_SEND])
+  GNULIB_RECVFROM=0;    AC_SUBST([GNULIB_RECVFROM])
+  GNULIB_SENDTO=0;      AC_SUBST([GNULIB_SENDTO])
+  GNULIB_SETSOCKOPT=0;  AC_SUBST([GNULIB_SETSOCKOPT])
+  GNULIB_SHUTDOWN=0;    AC_SUBST([GNULIB_SHUTDOWN])
+  GNULIB_ACCEPT4=0;     AC_SUBST([GNULIB_ACCEPT4])
+  HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE])
+  HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1;
+                        AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY])
+  HAVE_SA_FAMILY_T=1;   AC_SUBST([HAVE_SA_FAMILY_T])
+  HAVE_ACCEPT4=1;       AC_SUBST([HAVE_ACCEPT4])
+])
index 83ebac613b74ed88d90168e4fb68258951f056f4..f45dee1dc4dc35c88c5fdc900244d4f8343ddee2 100644 (file)
@@ -1,5 +1,5 @@
-# sys_stat_h.m4 serial 26   -*- Autoconf -*-
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# sys_stat_h.m4 serial 27   -*- Autoconf -*-
+dnl Copyright (C) 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -22,6 +22,19 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H],
   dnl Ensure the type mode_t gets defined.
   AC_REQUIRE([AC_TYPE_MODE_T])
 
+  dnl Whether to override 'struct stat'.
+  m4_ifdef([gl_LARGEFILE], [
+    AC_REQUIRE([gl_LARGEFILE])
+  ], [
+    WINDOWS_64_BIT_ST_SIZE=0
+  ])
+  AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
+  if test $WINDOWS_64_BIT_ST_SIZE = 1; then
+    AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1],
+      [Define to 1 if Gnulib overrides 'struct stat' on Windows so that
+       struct stat.st_size becomes 64-bit.])
+  fi
+
   dnl Define types that are supposed to be defined in <sys/types.h> or
   dnl <sys/stat.h>.
   AC_CHECK_TYPE([nlink_t], [],
diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4
new file mode 100644 (file)
index 0000000..c4a30cd
--- /dev/null
@@ -0,0 +1,110 @@
+# Configure a replacement for <sys/time.h>.
+# serial 8
+
+# Copyright (C) 2007, 2009-2012 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert and Martin Lambers.
+
+AC_DEFUN([gl_HEADER_SYS_TIME_H],
+[
+  dnl Use AC_REQUIRE here, so that the REPLACE_GETTIMEOFDAY=0 statement
+  dnl below is expanded once only, before all REPLACE_GETTIMEOFDAY=1
+  dnl statements that occur in other macros.
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H_BODY])
+])
+
+AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY],
+[
+  AC_REQUIRE([AC_C_RESTRICT])
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
+  AC_CHECK_HEADERS_ONCE([sys/time.h])
+  gl_CHECK_NEXT_HEADERS([sys/time.h])
+
+  if test $ac_cv_header_sys_time_h != yes; then
+    HAVE_SYS_TIME_H=0
+  fi
+
+  dnl On native Windows with MSVC, 'struct timeval' is defined in <winsock2.h>
+  dnl only. So include that header in the list.
+  gl_PREREQ_SYS_H_WINSOCK2
+  AC_CACHE_CHECK([for struct timeval], [gl_cv_sys_struct_timeval],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+            #if HAVE_WINSOCK2_H
+            # include <winsock2.h>
+            #endif
+          ]],
+          [[static struct timeval x; x.tv_sec = x.tv_usec;]])],
+       [gl_cv_sys_struct_timeval=yes],
+       [gl_cv_sys_struct_timeval=no])
+    ])
+  if test $gl_cv_sys_struct_timeval != yes; then
+    HAVE_STRUCT_TIMEVAL=0
+  else
+    dnl On native Windows with a 64-bit 'time_t', 'struct timeval' is defined
+    dnl (in <sys/time.h> and <winsock2.h> for mingw64, in <winsock2.h> only
+    dnl for MSVC) with a tv_sec field of type 'long' (32-bit!), which is
+    dnl smaller than the 'time_t' type mandated by POSIX.
+    dnl On OpenBSD 5.1 amd64, tv_sec is 64 bits and time_t 32 bits, but
+    dnl that is good enough.
+    AC_CACHE_CHECK([for wide-enough struct timeval.tv_sec member],
+      [gl_cv_sys_struct_timeval_tv_sec],
+      [AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM(
+            [[#if HAVE_SYS_TIME_H
+               #include <sys/time.h>
+              #endif
+              #include <time.h>
+              #if HAVE_WINSOCK2_H
+              # include <winsock2.h>
+              #endif
+            ]],
+            [[static struct timeval x;
+              typedef int verify_tv_sec_type[
+                sizeof (time_t) <= sizeof x.tv_sec ? 1 : -1
+              ];
+            ]])],
+         [gl_cv_sys_struct_timeval_tv_sec=yes],
+         [gl_cv_sys_struct_timeval_tv_sec=no])
+      ])
+    if test $gl_cv_sys_struct_timeval_tv_sec != yes; then
+      REPLACE_STRUCT_TIMEVAL=1
+    fi
+  fi
+
+  dnl Check for declarations of anything we want to poison if the
+  dnl corresponding gnulib module is not in use.
+  gl_WARN_ON_USE_PREPARE([[
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <time.h>
+    ]], [gettimeofday])
+])
+
+AC_DEFUN([gl_SYS_TIME_MODULE_INDICATOR],
+[
+  dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
+  AC_REQUIRE([gl_HEADER_SYS_TIME_H_DEFAULTS])
+  gl_MODULE_INDICATOR_SET_VARIABLE([$1])
+  dnl Define it also as a C macro, for the benefit of the unit tests.
+  gl_MODULE_INDICATOR_FOR_TESTS([$1])
+])
+
+AC_DEFUN([gl_HEADER_SYS_TIME_H_DEFAULTS],
+[
+  GNULIB_GETTIMEOFDAY=0;     AC_SUBST([GNULIB_GETTIMEOFDAY])
+  dnl Assume POSIX behavior unless another module says otherwise.
+  HAVE_GETTIMEOFDAY=1;       AC_SUBST([HAVE_GETTIMEOFDAY])
+  HAVE_STRUCT_TIMEVAL=1;     AC_SUBST([HAVE_STRUCT_TIMEVAL])
+  HAVE_SYS_TIME_H=1;         AC_SUBST([HAVE_SYS_TIME_H])
+  REPLACE_GETTIMEOFDAY=0;    AC_SUBST([REPLACE_GETTIMEOFDAY])
+  REPLACE_STRUCT_TIMEVAL=0;  AC_SUBST([REPLACE_STRUCT_TIMEVAL])
+])
diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4
new file mode 100644 (file)
index 0000000..f11eef2
--- /dev/null
@@ -0,0 +1,24 @@
+# sys_types_h.m4 serial 4
+dnl Copyright (C) 2011-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SYS_TYPES_H],
+[
+  AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS])
+  gl_NEXT_HEADERS([sys/types.h])
+
+  dnl Ensure the type pid_t gets defined.
+  AC_REQUIRE([AC_TYPE_PID_T])
+
+  dnl Ensure the type mode_t gets defined.
+  AC_REQUIRE([AC_TYPE_MODE_T])
+
+  dnl Whether to override the 'off_t' type.
+  AC_REQUIRE([gl_TYPE_OFF_T])
+])
+
+AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS],
+[
+])
index 3454b23fa0c9db97ea91a3ecc7729a6c193ae695..6415bfbcb74d9a125b9d7f50c6159fb2770a81e2 100644 (file)
@@ -1,8 +1,8 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2011 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
 
-# serial 6
+# serial 7
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -25,7 +25,7 @@ AC_DEFUN([gl_HEADER_TIME_H_BODY],
   AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
 ])
 
-dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
+dnl Check whether 'struct timespec' is declared
 dnl in time.h, sys/time.h, or pthread.h.
 
 AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
index d646edc2d3c6f74f9ef5d342c39e1b7ec599b53d..9ddbd0199d52e5ce24b4eb67fd2a1ca3859a439b 100644 (file)
@@ -1,6 +1,6 @@
 dnl Reentrant time functions: localtime_r, gmtime_r.
 
-dnl Copyright (C) 2003, 2006-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -17,7 +17,7 @@ AC_DEFUN([gl_TIME_R],
 
   dnl Some systems don't declare localtime_r() and gmtime_r() if _REENTRANT is
   dnl not defined.
-  AC_CHECK_DECLS_ONCE([localtime_r])
+  AC_CHECK_DECLS([localtime_r], [], [], [[#include <time.h>]])
   if test $ac_cv_have_decl_localtime_r = no; then
     HAVE_DECL_LOCALTIME_R=0
   fi
diff --git a/m4/timespec.m4 b/m4/timespec.m4
new file mode 100644 (file)
index 0000000..597b9c2
--- /dev/null
@@ -0,0 +1,15 @@
+#serial 14
+
+# Copyright (C) 2000-2001, 2003-2007, 2009-2012 Free Software Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering
+
+AC_DEFUN([gl_TIMESPEC],
+[
+  dnl Prerequisites of lib/timespec.h.
+  AC_REQUIRE([AC_C_INLINE])
+])
index d65ddc013befc170f038a9428dc3124e04b6df18..c12e6cefde29daddf85849f505f42b91e95733ba 100644 (file)
@@ -1,5 +1,5 @@
 # tm_gmtoff.m4 serial 3
-dnl Copyright (C) 2002, 2009-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2009-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 57c8094e42c542e6082b078ea2d381df2f847a2d..7e7651b9d2e430b6303fe9e7be584361389c50a7 100644 (file)
@@ -1,5 +1,5 @@
-# unistd_h.m4 serial 61
-dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
+# unistd_h.m4 serial 65
+dnl Copyright (C) 2006-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -24,6 +24,9 @@ AC_DEFUN([gl_UNISTD_H],
   dnl Ensure the type pid_t gets defined.
   AC_REQUIRE([AC_TYPE_PID_T])
 
+  dnl Determine WINDOWS_64_BIT_OFF_T.
+  AC_REQUIRE([gl_TYPE_OFF_T])
+
   dnl Check for declarations of anything we want to poison if the
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[
@@ -41,10 +44,11 @@ AC_DEFUN([gl_UNISTD_H],
 #endif
     ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat
     fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups
-    gethostname getlogin getlogin_r getpagesize getusershell setusershell
-    endusershell group_member lchown link linkat lseek pipe pipe2 pread pwrite
-    readlink readlinkat rmdir sleep symlink symlinkat ttyname_r unlink unlinkat
-    usleep])
+    gethostname getlogin getlogin_r getpagesize
+    getusershell setusershell endusershell
+    group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
+    readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r
+    unlink unlinkat usleep])
 ])
 
 AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
@@ -82,6 +86,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_GETPAGESIZE=0;          AC_SUBST([GNULIB_GETPAGESIZE])
   GNULIB_GETUSERSHELL=0;         AC_SUBST([GNULIB_GETUSERSHELL])
   GNULIB_GROUP_MEMBER=0;         AC_SUBST([GNULIB_GROUP_MEMBER])
+  GNULIB_ISATTY=0;               AC_SUBST([GNULIB_ISATTY])
   GNULIB_LCHOWN=0;               AC_SUBST([GNULIB_LCHOWN])
   GNULIB_LINK=0;                 AC_SUBST([GNULIB_LINK])
   GNULIB_LINKAT=0;               AC_SUBST([GNULIB_LINKAT])
@@ -94,11 +99,11 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   GNULIB_READLINK=0;             AC_SUBST([GNULIB_READLINK])
   GNULIB_READLINKAT=0;           AC_SUBST([GNULIB_READLINKAT])
   GNULIB_RMDIR=0;                AC_SUBST([GNULIB_RMDIR])
+  GNULIB_SETHOSTNAME=0;          AC_SUBST([GNULIB_SETHOSTNAME])
   GNULIB_SLEEP=0;                AC_SUBST([GNULIB_SLEEP])
   GNULIB_SYMLINK=0;              AC_SUBST([GNULIB_SYMLINK])
   GNULIB_SYMLINKAT=0;            AC_SUBST([GNULIB_SYMLINKAT])
   GNULIB_TTYNAME_R=0;            AC_SUBST([GNULIB_TTYNAME_R])
-  GNULIB_UNISTD_H_GETOPT=0;      AC_SUBST([GNULIB_UNISTD_H_GETOPT])
   GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
   GNULIB_UNISTD_H_SIGPIPE=0;     AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
   GNULIB_UNLINK=0;               AC_SUBST([GNULIB_UNLINK])
@@ -131,6 +136,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_PWRITE=1;          AC_SUBST([HAVE_PWRITE])
   HAVE_READLINK=1;        AC_SUBST([HAVE_READLINK])
   HAVE_READLINKAT=1;      AC_SUBST([HAVE_READLINKAT])
+  HAVE_SETHOSTNAME=1;     AC_SUBST([HAVE_SETHOSTNAME])
   HAVE_SLEEP=1;           AC_SUBST([HAVE_SLEEP])
   HAVE_SYMLINK=1;         AC_SUBST([HAVE_SYMLINK])
   HAVE_SYMLINKAT=1;       AC_SUBST([HAVE_SYMLINKAT])
@@ -143,6 +149,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
   HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
   HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
+  HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
   HAVE_DECL_TTYNAME_R=1;  AC_SUBST([HAVE_DECL_TTYNAME_R])
   HAVE_OS_H=0;            AC_SUBST([HAVE_OS_H])
   HAVE_SYS_PARAM_H=0;     AC_SUBST([HAVE_SYS_PARAM_H])
@@ -151,11 +158,13 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
   REPLACE_DUP=0;          AC_SUBST([REPLACE_DUP])
   REPLACE_DUP2=0;         AC_SUBST([REPLACE_DUP2])
   REPLACE_FCHOWNAT=0;     AC_SUBST([REPLACE_FCHOWNAT])
+  REPLACE_FTRUNCATE=0;    AC_SUBST([REPLACE_FTRUNCATE])
   REPLACE_GETCWD=0;       AC_SUBST([REPLACE_GETCWD])
   REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
   REPLACE_GETLOGIN_R=0;   AC_SUBST([REPLACE_GETLOGIN_R])
   REPLACE_GETGROUPS=0;    AC_SUBST([REPLACE_GETGROUPS])
   REPLACE_GETPAGESIZE=0;  AC_SUBST([REPLACE_GETPAGESIZE])
+  REPLACE_ISATTY=0;       AC_SUBST([REPLACE_ISATTY])
   REPLACE_LCHOWN=0;       AC_SUBST([REPLACE_LCHOWN])
   REPLACE_LINK=0;         AC_SUBST([REPLACE_LINK])
   REPLACE_LINKAT=0;       AC_SUBST([REPLACE_LINKAT])
diff --git a/m4/utimbuf.m4 b/m4/utimbuf.m4
new file mode 100644 (file)
index 0000000..25eb85b
--- /dev/null
@@ -0,0 +1,39 @@
+# serial 9
+
+# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2012 Free Software Foundation,
+# Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl From Jim Meyering
+
+dnl Define HAVE_STRUCT_UTIMBUF if 'struct utimbuf' is declared --
+dnl usually in <utime.h>.
+dnl Some systems have utime.h but don't declare the struct anywhere.
+
+AC_DEFUN([gl_CHECK_TYPE_STRUCT_UTIMBUF],
+[
+  AC_CHECK_HEADERS_ONCE([sys/time.h utime.h])
+  AC_CACHE_CHECK([for struct utimbuf], [gl_cv_sys_struct_utimbuf],
+    [AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+          [[#if HAVE_SYS_TIME_H
+             #include <sys/time.h>
+            #endif
+            #include <time.h>
+            #ifdef HAVE_UTIME_H
+             #include <utime.h>
+            #endif
+          ]],
+          [[static struct utimbuf x; x.actime = x.modtime;]])],
+       [gl_cv_sys_struct_utimbuf=yes],
+       [gl_cv_sys_struct_utimbuf=no])])
+
+  if test $gl_cv_sys_struct_utimbuf = yes; then
+    AC_DEFINE([HAVE_STRUCT_UTIMBUF], [1],
+      [Define if struct utimbuf is declared -- usually in <utime.h>.
+       Some systems have utime.h but don't declare the struct anywhere. ])
+  fi
+])
diff --git a/m4/utimens.m4 b/m4/utimens.m4
new file mode 100644 (file)
index 0000000..6a8b6ab
--- /dev/null
@@ -0,0 +1,50 @@
+dnl Copyright (C) 2003-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl serial 7
+
+AC_DEFUN([gl_UTIMENS],
+[
+  dnl Prerequisites of lib/utimens.c.
+  AC_REQUIRE([gl_FUNC_UTIMES])
+  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
+  AC_REQUIRE([gl_CHECK_TYPE_STRUCT_UTIMBUF])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+  AC_CHECK_FUNCS_ONCE([futimes futimesat futimens utimensat lutimes])
+
+  if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then
+    dnl FreeBSD 8.0-rc2 mishandles futimesat(fd,NULL,time).  It is not
+    dnl standardized, but Solaris implemented it first and uses it as
+    dnl its only means to set fd time.
+    AC_CACHE_CHECK([whether futimesat handles NULL file],
+      [gl_cv_func_futimesat_works],
+      [touch conftest.file
+       AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stddef.h>
+#include <sys/times.h>
+#include <fcntl.h>
+]], [[    int fd = open ("conftest.file", O_RDWR);
+          if (fd < 0) return 1;
+          if (futimesat (fd, NULL, NULL)) return 2;
+        ]])],
+        [gl_cv_func_futimesat_works=yes],
+        [gl_cv_func_futimesat_works=no],
+        [case "$host_os" in
+                   # Guess yes on glibc systems.
+           *-gnu*) gl_cv_func_futimesat_works="guessing yes" ;;
+                   # If we don't know, assume the worst.
+           *)      gl_cv_func_futimesat_works="guessing no" ;;
+         esac
+        ])
+      rm -f conftest.file])
+    case "$gl_cv_func_futimesat_works" in
+      *yes) ;;
+      *)
+        AC_DEFINE([FUTIMESAT_NULL_BUG], [1],
+          [Define to 1 if futimesat mishandles a NULL file name.])
+        ;;
+    esac
+  fi
+])
diff --git a/m4/utimes.m4 b/m4/utimes.m4
new file mode 100644 (file)
index 0000000..417103a
--- /dev/null
@@ -0,0 +1,136 @@
+# Detect some bugs in glibc's implementation of utimes.
+# serial 3
+
+dnl Copyright (C) 2003-2005, 2009-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+# See if we need to work around bugs in glibc's implementation of
+# utimes from 2003-07-12 to 2003-09-17.
+# First, there was a bug that would make utimes set mtime
+# and atime to zero (1970-01-01) unconditionally.
+# Then, there was code to round rather than truncate.
+# Then, there was an implementation (sparc64, Linux-2.4.28, glibc-2.3.3)
+# that didn't honor the NULL-means-set-to-current-time semantics.
+# Finally, there was also a version of utimes that failed on read-only
+# files, while utime worked fine (linux-2.2.20, glibc-2.2.5).
+#
+# From Jim Meyering, with suggestions from Paul Eggert.
+
+AC_DEFUN([gl_FUNC_UTIMES],
+[
+  AC_CACHE_CHECK([whether the utimes function works],
+                 [gl_cv_func_working_utimes],
+  [
+  AC_RUN_IFELSE([AC_LANG_SOURCE([[
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <utime.h>
+
+static int
+inorder (time_t a, time_t b, time_t c)
+{
+  return a <= b && b <= c;
+}
+
+int
+main ()
+{
+  int result = 0;
+  char const *file = "conftest.utimes";
+  static struct timeval timeval[2] = {{9, 10}, {999999, 999999}};
+
+  /* Test whether utimes() essentially works.  */
+  {
+    struct stat sbuf;
+    FILE *f = fopen (file, "w");
+    if (f == NULL)
+      result |= 1;
+    else if (fclose (f) != 0)
+      result |= 1;
+    else if (utimes (file, timeval) != 0)
+      result |= 2;
+    else if (lstat (file, &sbuf) != 0)
+      result |= 1;
+    else if (!(sbuf.st_atime == timeval[0].tv_sec
+               && sbuf.st_mtime == timeval[1].tv_sec))
+      result |= 4;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument sets the file's timestamp
+     to the current time.  Use 'fstat' as well as 'time' to
+     determine the "current" time, to accommodate NFS file systems
+     if there is a time skew between the host and the NFS server.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0644);
+    if (fd < 0)
+      result |= 1;
+    else
+      {
+        time_t t0, t2;
+        struct stat st0, st1, st2;
+        if (time (&t0) == (time_t) -1)
+          result |= 1;
+        else if (fstat (fd, &st0) != 0)
+          result |= 1;
+        else if (utimes (file, timeval) != 0)
+          result |= 2;
+        else if (utimes (file, NULL) != 0)
+          result |= 8;
+        else if (fstat (fd, &st1) != 0)
+          result |= 1;
+        else if (write (fd, "\n", 1) != 1)
+          result |= 1;
+        else if (fstat (fd, &st2) != 0)
+          result |= 1;
+        else if (time (&t2) == (time_t) -1)
+          result |= 1;
+        else
+          {
+            int m_ok_POSIX = inorder (t0, st1.st_mtime, t2);
+            int m_ok_NFS = inorder (st0.st_mtime, st1.st_mtime, st2.st_mtime);
+            if (! (st1.st_atime == st1.st_mtime))
+              result |= 16;
+            if (! (m_ok_POSIX || m_ok_NFS))
+              result |= 32;
+          }
+        if (close (fd) != 0)
+          result |= 1;
+      }
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  /* Test whether utimes() with a NULL argument works on read-only files.  */
+  {
+    int fd = open (file, O_WRONLY|O_CREAT, 0444);
+    if (fd < 0)
+      result |= 1;
+    else if (close (fd) != 0)
+      result |= 1;
+    else if (utimes (file, NULL) != 0)
+      result |= 64;
+    if (unlink (file) != 0)
+      result |= 1;
+  }
+
+  return result;
+}
+  ]])],
+       [gl_cv_func_working_utimes=yes],
+       [gl_cv_func_working_utimes=no],
+       [gl_cv_func_working_utimes=no])])
+
+  if test $gl_cv_func_working_utimes = yes; then
+    AC_DEFINE([HAVE_WORKING_UTIMES], [1], [Define if utimes works properly. ])
+  fi
+])
diff --git a/m4/warnings.m4 b/m4/warnings.m4
new file mode 100644 (file)
index 0000000..28b8294
--- /dev/null
@@ -0,0 +1,61 @@
+# warnings.m4 serial 7
+dnl Copyright (C) 2008-2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Simon Josefsson
+
+# gl_AS_VAR_APPEND(VAR, VALUE)
+# ----------------------------
+# Provide the functionality of AS_VAR_APPEND if Autoconf does not have it.
+m4_ifdef([AS_VAR_APPEND],
+[m4_copy([AS_VAR_APPEND], [gl_AS_VAR_APPEND])],
+[m4_define([gl_AS_VAR_APPEND],
+[AS_VAR_SET([$1], [AS_VAR_GET([$1])$2])])])
+
+
+# gl_COMPILER_OPTION_IF(OPTION, [IF-SUPPORTED], [IF-NOT-SUPPORTED],
+#                       [PROGRAM = AC_LANG_PROGRAM()])
+# -----------------------------------------------------------------
+# Check if the compiler supports OPTION when compiling PROGRAM.
+#
+# FIXME: gl_Warn must be used unquoted until we can assume Autoconf
+# 2.64 or newer.
+AC_DEFUN([gl_COMPILER_OPTION_IF],
+[AS_VAR_PUSHDEF([gl_Warn], [gl_cv_warn_[]_AC_LANG_ABBREV[]_$1])dnl
+AS_VAR_PUSHDEF([gl_Flags], [_AC_LANG_PREFIX[]FLAGS])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler handles $1], m4_defn([gl_Warn]), [
+  gl_save_compiler_FLAGS="$gl_Flags"
+  gl_AS_VAR_APPEND(m4_defn([gl_Flags]), [" $1"])
+  AC_COMPILE_IFELSE([m4_default([$4], [AC_LANG_PROGRAM([])])],
+                    [AS_VAR_SET(gl_Warn, [yes])],
+                    [AS_VAR_SET(gl_Warn, [no])])
+  gl_Flags="$gl_save_compiler_FLAGS"
+])
+AS_VAR_IF(gl_Warn, [yes], [$2], [$3])
+AS_VAR_POPDEF([gl_Flags])dnl
+AS_VAR_POPDEF([gl_Warn])dnl
+])
+
+
+# gl_WARN_ADD(OPTION, [VARIABLE = WARN_CFLAGS],
+#             [PROGRAM = AC_LANG_PROGRAM()])
+# ---------------------------------------------
+# Adds parameter to WARN_CFLAGS if the compiler supports it when
+# compiling PROGRAM.  For example, gl_WARN_ADD([-Wparentheses]).
+#
+# If VARIABLE is a variable name, AC_SUBST it.
+AC_DEFUN([gl_WARN_ADD],
+[gl_COMPILER_OPTION_IF([$1],
+  [gl_AS_VAR_APPEND(m4_if([$2], [], [[WARN_CFLAGS]], [[$2]]), [" $1"])],
+  [],
+  [$3])
+m4_ifval([$2],
+         [AS_LITERAL_IF([$2], [AC_SUBST([$2])])],
+         [AC_SUBST([WARN_CFLAGS])])dnl
+])
+
+# Local Variables:
+# mode: autoconf
+# End:
index d2c03c42d2b4254d4881ecf9a3e974ecf0e05f61..534735d8c6313f6dde9ab17dd5e3a320ca30a741 100644 (file)
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2011 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2012 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
index 55dac98d713046293ba2fe0e5f8165668b93d110..cc14ff3987be36654edd616ecd157dde26f644bc 100755 (executable)
--- a/make-dist
+++ b/make-dist
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### make-dist: create an Emacs distribution tar file from current srcdir
 
-## Copyright (C) 1995, 1997-1998, 2000-2012  Free Software Foundation, Inc.
+## Copyright (C) 1995, 1997-1998, 2000-2012 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
@@ -147,7 +147,7 @@ fi
 
 ### Find out which version of Emacs this is.
 version=`
-  sed -n 's/^AC_INIT(emacs,[    ]*\([^  )]*\).*/\1/p' <configure.in
+  sed -n 's/^AC_INIT(emacs,[    ]*\([^  )]*\).*/\1/p' <configure.ac
 ` || version=
 if [ ! "${version}" ]; then
   echo "${progname}: can't find current Emacs version in \`./src/emacs.c'" >&2
@@ -230,35 +230,24 @@ fi
 
 if [ $update = yes ]; then
 
-  ## Make sure configure is newer than configure.in.
-  if [ "x`ls -t configure configure.in | sed q`" != "xconfigure" ]; then
-    echo "\`./configure.in' is newer than \`./configure'" >&2
-    echo "Running autoconf" >&2
-    autoconf || { x=$?; echo Autoconf FAILED! >&2; exit $x; }
-  fi
+  ## Make sure configure is newer than configure.ac, etc.
+  ## It is better to let autoreconf do what is needed than
+  ## for us to try and duplicate all its checks.
+  echo "Running autoreconf"
+  autoreconf -i -I m4 || { x=$?; echo Autoreconf FAILED! >&2; exit $x; }
 
-  ## Make sure src/stamp-h.in is newer than configure.in.
-  if [ "x`ls -t src/stamp-h.in configure.in | sed q`" != "xsrc/stamp-h.in" ]; then
-    echo "\`./configure.in' is newer than \`./src/stamp-h.in'" >&2
-    echo "Running autoheader" >&2
-    autoheader || { x=$?; echo Autoheader FAILED! >&2; exit $x; }
-    rm -f src/stamp-h.in
-    echo timestamp > src/stamp-h.in
-  fi
+  ## Make sure src/stamp-h.in is newer than configure.ac.
+  rm -f src/stamp-h.in
+  echo timestamp > src/stamp-h.in
 
   echo "Updating Info files"
-  (cd doc/emacs; make info)
-  (cd doc/misc; make info)
-  (cd doc/lispref; make info)
-  (cd doc/lispintro; make info)
+  make info-real
 
   echo "Updating finder, custom and autoload data"
-  (cd lisp; make updates EMACS="$EMACS")
+  (cd lisp && make updates EMACS="$EMACS")
 
-  if test -f leim/leim-list.el; then
-    echo "Updating leim-list.el"
-    (cd leim; make leim-list.el EMACS="$EMACS")
-  fi
+  echo "Updating leim-list.el"
+  (cd leim && make leim-list.el EMACS="$EMACS")
 
   echo "Recompiling Lisp files"
   $EMACS -batch -f batch-byte-recompile-directory lisp leim
@@ -284,8 +273,8 @@ mkdir ${tempdir}
 ### README while the rest of the tar file is still unpacking.  Whoopee.
 echo "Making links to top-level files"
 ln INSTALL README BUGS ${tempdir}
-ln ChangeLog Makefile.in configure configure.in ${tempdir}
-ln config.bat make-dist update-subdirs vpath.sed .dir-locals.el ${tempdir}
+ln ChangeLog Makefile.in configure configure.ac ${tempdir}
+ln config.bat make-dist .dir-locals.el ${tempdir}
 ln aclocal.m4 ${tempdir}
 
 echo "Creating subdirectories"
@@ -293,7 +282,7 @@ for subdir in site-lisp \
              leim leim/CXTERM-DIC leim/MISC-DIC \
              leim/SKK-DIC leim/ja-dic leim/quail \
              build-aux build-aux/snippet \
-             src src/m src/s src/bitmaps lib lib-src oldXMenu lwlib \
+             src src/s src/bitmaps lib lib-src oldXMenu lwlib \
              nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
              `find etc lisp admin -type d` \
              doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
@@ -346,7 +335,7 @@ echo "Making links to \`leim' and its subdirectories"
 echo "Making links to \`build-aux'"
 (cd build-aux
  ln compile config.guess config.sub depcomp ../${tempdir}/build-aux
- ln install-sh missing move-if-change ../${tempdir}/build-aux)
+ ln install-sh missing move-if-change update-subdirs ../${tempdir}/build-aux)
 
 echo "Making links to \`build-aux/snippet'"
 (cd build-aux/snippet
@@ -370,10 +359,6 @@ echo "Making links to \`src/bitmaps'"
 (cd src/bitmaps
  ln README *.xbm ../../${tempdir}/src/bitmaps)
 
-echo "Making links to \`src/m'"
-(cd src/m
- ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/m)
-
 echo "Making links to \`src/s'"
 (cd src/s
  ln README [a-zA-Z0-9]*.h ../../${tempdir}/src/s)
@@ -390,8 +375,8 @@ echo "Making links to \`lib'"
 echo "Making links to \`lib-src'"
 (cd lib-src
  ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src
- ln ChangeLog Makefile.in README testfile vcdiff ../${tempdir}/lib-src
- ln grep-changelog rcs2log rcs-checkin ../${tempdir}/lib-src
+ ln ChangeLog Makefile.in README testfile ../${tempdir}/lib-src
+ ln grep-changelog rcs2log ../${tempdir}/lib-src
  ln makefile.w32-in ../${tempdir}/lib-src)
 
 echo "Making links to \`m4'"
@@ -478,8 +463,8 @@ echo "Making links to \`doc/misc'"
 echo "Making links to \`doc/lispref'"
 (cd doc/lispref
  ln *.texi *.in makefile.w32-in README ChangeLog* ../../${tempdir}/doc/lispref
- ln *.txt *.el spellfile tindex.pl ../../${tempdir}/doc/lispref
- ln two-volume.make ../../${tempdir}/doc/lispref)
+ ln spellfile ../../${tempdir}/doc/lispref
+ ln two-volume.make two-volume-cross-refs.txt ../../${tempdir}/doc/lispref)
 
 echo "Making links to \`doc/lispintro'"
 (cd doc/lispintro
index de20128d88cae467231d8be0c19d2faacab2aeca..85251afef05e516a72af73fb817121c27a963bda 100644 (file)
@@ -1,6 +1,108 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-14  Eli Zaretskii  <eliz@gnu.org>
 
-       * Version 24.1 released.
+       * sed1v2.inp: In the recipe for $(leimdir)/leim-list.el, edit the
+       prerequisites to be "temacs$(EXEEXT) $(BOOTSTRAPEMACS)", to avoid
+       the need to rebuild $(bootstrap_exe), which requires a Unixy shell
+       via lisp/Makefile.in's "update-subdirs" command.
+
+       * sedlibmk.inp (am_libgnu_a_OBJECTS): Adjust the removal of
+       careadlinkat.$(OBJEXT) to the changes in lib/Makefile.in.
+
+       * sed2v2.inp (DATA_START, GC_SETJMP_WORKS, HAVE_MENUS)
+       (HAVE_MOUSE): Edit for DJGPP, according to what was previously
+       done on src/s/msdos.h.
+
+2012-06-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * mainmake.v2 (bootstrap-clean): Do a maintainer-clean in lib, not
+       bootstrap-clean (which doesn't exist).
+
+       * inttypes.h (PRIuMAX) [__DJGPP__ < 2.04]: Define to "llu".
+
+       * sedleim.inp (MKDIR_P): Edit to DOS "md" command.
+
+       * sed1v2.inp (LIB_CLOCK_GETTIME): Edit to empty.
+       Remove lines that invoke PAXCTL.
+       (clean): Fix recipe not to run Unixy shell commands.
+
+       * sed2v2.inp (GETTIMEOFDAY_TIMEZONE): Edit to 'struct timezone'.
+       (HAVE_STRNCASECMP): Edit to 1.
+
+       * sed3v2.inp (LIB_CLOCK_GETTIME): Edit to empty.
+       (C_SWITCH_SYSTEM): Add "-I../msdos".
+
+       * sedlibmk.inp (GNULIB_GETTIMEOFDAY, GNULIB_PSELECT)
+       (GNULIB_SELECT, HAVE_STRUCT_TIMEVAL, HAVE_SYS_SELECT_H)
+       (HAVE_SYS_TIME_H, NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H)
+       (NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H, NEXT_SYS_SELECT_H)
+       (NEXT_SYS_TIME_H, REPLACE_GETTIMEOFDAY, REPLACE_PSELECT)
+       (REPLACE_STRUCT_TIMEVAL): Edit to appropriate values.
+       (BUILT_SOURCES): Edit out sys/select.h and sys/time.h.
+       (mostlyclean-local, distclean-generic): Fix recipe not to run
+       Unixy shell commands.
+
+2012-06-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Clean out last vestiges of the old HAVE_CONFIG_H stuff.
+       * sedlibmk.inp (DEFS): Don't add -DHAVE_CONFIG_H.
+
+2012-06-11  Glenn Morris  <rgm@gnu.org>
+
+       * sed2v2.inp (SYSTEM_TYPE): Set it.
+
+2012-05-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * sedlibmk.inp (GNULIB_GL_UNISTD_H_GETOPT, GNULIB_POSIX_OPENPT)
+       (GNULIB_ISATTY, GNULIB_PTSNAME_R, GNULIB_RANDOM)
+       (GNULIB_SETHOSTNAME, HAVE_POSIX_OPENPT, HAVE_PTSNAME_R)
+       (HAVE_RANDOM, HAVE_SETHOSTNAME, NEXT_SYS_TYPES_H)
+       (NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H, REPLACE_FTRUNCATE)
+       (REPLACE_ISATTY, REPLACE_PTSNAME_R, REPLACE_RANDOM_R)
+       (REPLACE_STRTOIMAX, STDALIGN_H, WINDOWS_64_BIT_OFF_T)
+       (WINDOWS_64_BIT_ST_SIZE, GL_GENERATE_STDALIGN_H_TRUE)
+       (GL_GENERATE_STDALIGN_H_FALSE): Edit as appropriate for DJGPP.
+       (cat FOO): Edit into "sed -e '' FOO >>".
+
+2012-05-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * sed6.inp (INFO_EXT): Edit to .info.
+       (INFO_OPTS): Edit to --no-split.
+
+2012-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove src/m/*.
+       * mainmake.v2 (TAGS tags): Don't look at $(CURDIR)/src/m/intel386.h.
+
+2012-05-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sed2v2.inp (HAVE_MBLEN): Remove.
+       * sed2x.inp (HAVE_XSETWMPROTOCOLS): Remove.
+
+2012-04-21  Eli Zaretskii  <eliz@gnu.org>
+
+       * sedleim.inp (RUN_EMACS): Replace BUILT_EMACS with EMACS.
+       Remove stale editing of "else make quail".
+       (.PHONY, compile-targets): Remove targets.
+       (compile-main): Edit into something that can be done without
+       requiring a Unixy shell.
+       (bootstrap-clean): Likewise: edit to not require $(setwins).
+
+       * sed1v2.inp: Edit "cd $(leimdir) && $(MAKE) ..." into the
+       equivalent "$(MAKE) $(MFLAGS) -C $(leimdir) ..." command.
+
+2012-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       configure: new option --enable-gcc-warnings (Bug#11207)
+       * sed1v2.inp, sed3v2.inp, sedlibmk.inp: GNULIB_WARN_CFLAGS,
+       WARN_CFLAGS, and WERROR_CFLAGS replace C_WARNINGS_SWITCH.
+
+2012-04-11  Glenn Morris  <rgm@gnu.org>
+
+       * sedlibmk.inp, sed1v2.inp: GNUSTEP_CFLAGS replaces C_SWITCH_X_SYSTEM.
+
+2012-04-07  Glenn Morris  <rgm@gnu.org>
+
+       * sed2v2.inp: Bump version to 24.1.50.
 
 2012-02-04  Eli Zaretskii  <eliz@gnu.org>
 
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1994-1999, 2001-2012  Free Software Foundation, Inc.
+  Copyright (C) 1994-1999, 2001-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index 6128cbf31557145be4127c4e39475455d467f37a..dba56f837606624930abf8b9195596f97df3740b 100644 (file)
@@ -31,6 +31,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdlib.h>
 #define strtoumax strtoull
 #define strtoimax strtoll
+#define PRIuMAX   "llu"
 #endif /* __DJGPP__ < 2.04 */
 
 #endif
index 2113dc4a127bef108acf040bcc1d24e4c92fb4c3..e1e646a855cfd8f185977416ffeeae9eb523fde5 100644 (file)
@@ -162,7 +162,7 @@ TAGS tags:  lib-src FRC
        ../bin/etags --include=../lisp/TAGS \
         --regex='/[    ]*DEFVAR_[A-Z_  (]+"\([^"]+\)"/' \
         $(CURDIR)/src/*.c $(CURDIR)/src/*.h \
-         $(CURDIR)/src/s/msdos.h $(CURDIR)/src/m/intel386.h
+         $(CURDIR)/src/s/msdos.h
        cd ..
        ./bin/etags --include=src/TAGS
 
@@ -269,7 +269,7 @@ extraclean:
 
 bootstrap-clean: FRC
        cd lib
-       $(MAKE) $(MFLAGS) $@
+       -$(MAKE) $(MFLAGS) maintainer-clean
        cd ..
        cd src
        $(MAKE) $(MFLAGS) $@
@@ -299,4 +299,3 @@ bootstrap-clean: FRC
 bootstrap: bootstrap-clean FRC
        command.com /e:2048 /c config msdos
        $(MAKE) $(MFLAGS) info all
-
index c13fbe621f4cb5049eeae47ab22a5eadcb937a51..7a43697a06a9c76e860717c637e6a4d1752470f7 100644 (file)
@@ -2,7 +2,7 @@
 # Configuration script for src/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1996-1997, 1999-2012  Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2012 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -39,9 +39,10 @@ s/\.h\.in/.h-in/
 /^LIBOBJS *=/s/@[^@\n]*@//
 /^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@//
 /^C_SWITCH_SYSTEM *=/s/@C_SWITCH_SYSTEM@//
-/^C_SWITCH_X_SYSTEM *=/s/@C_SWITCH_X_SYSTEM@//
+/^GNUSTEP_CFLAGS *=/s/@GNUSTEP_CFLAGS@//
 /^C_SWITCH_X_SITE *=/s/@C_SWITCH_X_SITE@//
-/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@//
+/^WARN_CFLAGS *=/s/@WARN_CFLAGS@//
+/^WERROR_CFLAGS *=/s/@WERROR_CFLAGS@//
 /^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@//
 #/^LD_SWITCH_X_SITE *=/s/@LD_SWITCH_X_SITE@//
 /^LD_SWITCH_SYSTEM_TEMACS *=/s/@LD_SWITCH_SYSTEM_TEMACS@//
@@ -104,6 +105,7 @@ s/\.h\.in/.h-in/
 /^LIBRESOLV *=/s/@LIBRESOLV@//
 /^LIBSELINUX_LIBS *=/s/@LIBSELINUX_LIBS@//
 /^LIB_PTHREAD_SIGMASK *=/s/@[^@\n]*@//
+/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g
 /^LIBGNUTLS_LIBS *=/s/@[^@\n]*@//
 /^LIBGNUTLS_CFLAGS *=/s/@[^@\n]*@//
 /^GETLOADAVG_LIBS *=/s/@[^@\n]*@//
@@ -134,9 +136,13 @@ s/\.h\.in/.h-in/
 /^.\$(libsrc)\/make-doc/s!>.*$!!
 /^     [       ]*\$(libsrc)\/make-docfile /s!`[^`]*`!$(lisp); cd ../src!
 /^[\f   ]*$/d
+/^\$(leimdir)\/leim-list.el: /s/bootstrap-emacs\$(EXEEXT)/temacs$(EXEEXT) $(BOOTSTRAPEMACS)/
 /^     if test -f/,/^  fi$/c\
        command.com /c if exist .gdbinit rm -f _gdbinit
+/^      *test "X\$(PAXCTL)" = X/d
+/^      *test "\$(CANNOT_DUMP)" = "yes"/d
 /^     if test "\$(CANNOT_DUMP)" =/,/^ else /d
+/^     -\{0,1\} *ln -/s/bootstrap-emacs\$(EXEEXT).*$/bootstrap-emacs$(EXEEXT)/
 /^     fi/d
 /^      *LC_ALL=C \$(RUN_TEMACS)/i\
        stubedit temacs.exe minstack=1024k
@@ -151,6 +157,8 @@ s/^ [^      ]*move-if-change /      update /
 /^     echo[   ][      ]*timestamp/s/echo /djecho /
 /^     .*djecho timestamp/a\
        @rm -f gl-tmp
+/^     cd \$(leimdir) && \$(MAKE)/c\
+       $(MAKE) $(MFLAGS) -C $(leimdir) leim-list.el EMACS=$(bootstrap_exe)
 /^     cd \$(lib) && \$(MAKE)/c\
        $(MAKE) $(MFLAGS) -C $(lib) libgnu.a
 /^RUN_TEMACS *=/s|`/bin/pwd`|.|
@@ -186,7 +194,7 @@ s/echo.*buildobj.lst/dj&/
 /^      *THEFILE=/s|$|\; cd ../src|
 /^     echo.* buildobj.h/s|echo |djecho |
 # Make the GCC command line fit one screen line
-/^[    ][      ]*\$(C_SWITCH_X_SYSTEM)/d
+/^[    ][      ]*\$(GNUSTEP_CFLAGS)/d
 /^[    ][      ]*\$(GCONF_CFLAGS)/d
 /^[    ][      ]*\$(LIBGNUTLS_CFLAGS)/d
 s/\$(LIBOTF_CFLAGS) \$(M17N_FLT_CFLAGS) \$(DEPFLAGS) //
@@ -195,3 +203,4 @@ s/ \$(DBUS_CFLAGS)//
 s| -I\$(srcdir)/../lib||
 # Add our local inttypes.h to prerequisites where needed
 /^lread\.o:/s|lread\.c|& ../msdos/inttypes.h|
+/^      *test "X/d
index 2e215bfd4e4ea3f8a2f6b791e3c6fd992c2de064..759418f0f1536906ebddd58478d40b7348e8fc16 100644 (file)
 /^#undef HAVE_MEMMOVE *$/s/^.*$/#define HAVE_MEMMOVE 1/
 /^#undef HAVE_SETRLIMIT *$/s/^.*$/#define HAVE_SETRLIMIT 1/
 /^#undef HAVE_GETRUSAGE *$/s/^.*$/#define HAVE_GETRUSAGE 1/
+/^#undef GETTIMEOFDAY_TIMEZONE *$/s/^.*$/#define GETTIMEOFDAY_TIMEZONE struct timezone/
 /^#undef HAVE_TM_GMTOFF *$/s/^.*$/#define HAVE_TM_GMTOFF 1/
-/^#undef HAVE_MBLEN *$/s/^.*$/#define HAVE_MBLEN 1/
 /^#undef HAVE_STRUCT_TIMEZONE *$/s/^.*$/#define HAVE_STRUCT_TIMEZONE 1/
 /^#undef HAVE_SIZE_T *$/s/^.*$/#define HAVE_SIZE_T 1/
 /^#undef HAVE_MKSTEMP *$/s/^.*$/#define HAVE_MKSTEMP 1/
+/^#undef HAVE_STRNCASECMP *$/s/^.*$/#define HAVE_STRNCASECMP 1/
 /^#undef HAVE_STRUCT_TM_TM_ZONE *$/s/^.*$/#define HAVE_STRUCT_TM_TM_ZONE 1/
 /^#undef HAVE_SYNC *$/s/^.*$/#define HAVE_SYNC 1/
 /^#undef HAVE___BUILTIN_UNWIND_INIT *$/s/^.*$/#define HAVE___BUILTIN_UNWIND_INIT 1/
+/^#undef HAVE_MENUS *$/s/^.*$/#define HAVE_MENUS 1/
+/^#undef HAVE_MOUSE *$/s/^.*$/#define HAVE_MOUSE 1/
+/^#undef DATA_START/s/^.*$/#define DATA_START (\&etext + 1)/
+/^#undef GC_SETJMP_WORKS/s/^.*$/#define GC_SETJMP_WORKS 1/
 /^#undef ORDINARY_LINK/s/^.*$/#define ORDINARY_LINK 1/
 /^#undef PACKAGE_BUGREPORT/s/^.*$/#define PACKAGE_BUGREPORT ""/
 /^#undef PACKAGE_NAME/s/^.*$/#define PACKAGE_NAME ""/
 /^#undef PACKAGE_STRING/s/^.*$/#define PACKAGE_STRING ""/
 /^#undef PACKAGE_TARNAME/s/^.*$/#define PACKAGE_TARNAME ""/
 /^#undef PACKAGE_VERSION/s/^.*$/#define PACKAGE_VERSION ""/
-/^#undef VERSION/s/^.*$/#define VERSION "24.1"/
+/^#undef VERSION/s/^.*$/#define VERSION "24.1.50"/
+/^#undef SYSTEM_TYPE/s/^.*$/#define SYSTEM_TYPE "ms-dos"/
 /^#undef HAVE_DECL_GETENV/s/^.*$/#define HAVE_DECL_GETENV 1/
 /^#undef SYS_SIGLIST_DECLARED/s/^.*$/#define SYS_SIGLIST_DECLARED 1/
 /^#undef HAVE_DIRENT_H/s/^.*$/#define HAVE_DIRENT_H 1/
@@ -119,4 +125,3 @@ s/^#undef HAVE_STRTOULL *$/#define HAVE_STRTOULL 1/
 # might be defined in sys/config.h we include at the top of config.h.
 /^#undef BSTRING/s|#undef|# undef|
 /^#undef .*$/s|^.*$|/* & */|
-
index 159c35fd2510a2330767124248275b1c9a869e41..fa920246c96f7255c32050076a44f21dfe0acc4c 100644 (file)
@@ -20,6 +20,5 @@
 /^#undef HAVE_X11 *$/s/undef/define/
 /^#undef HAVE_X_MENU *$/s/undef/define/
 /^#undef HAVE_XSCREENNUMBEROFSCREEN *$/s/undef/define/
-/^#undef HAVE_XSETWMPROTOCOLS *$/s/undef/define/
 /^#undef HAVE_SELECT *$/s/undef/define/
 
index c147ad64cf91eaced4819a7c1be34b1935a2ddef..bfa008b3e81dc373945cdb831f5aefcc5065a3ad 100644 (file)
@@ -35,10 +35,12 @@ s/-DVERSION[^ ]* //
 /^LIBRESOLV *=/s/@[^@\n]*@//g
 /^LIBS_MAIL *=/s/@[^@\n]*@//g
 /^LIBS_SYSTEM *=/s/@[^@\n]*@//g
+/^LIB_CLOCK_GETTIME *=/s/@[^@\n]*@//g
 /^CFLAGS *=/s!=.*$!=-O2 -g!
-/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS!
+/^C_SWITCH_SYSTEM *=/s!=.*$!=-DMSDOS -I../msdos!
 /^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@//
-/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@//
+/^WARN_CFLAGS *=/s/@WARN_CFLAGS@//
+/^WERROR_CFLAGS *=/s/@WERROR_CFLAGS@//
 /^PROFILING_CFLAGS *=/s/@PROFILING_CFLAGS@//
 /^ALLOCA *=/s!@ALLOCA@!!
 /^EXEEXT *=/s!@EXEEXT@!!
@@ -51,4 +53,3 @@ s!^   \./!    !
 }
 /^insrcdir=/s/^.*$/\#&/
 /^      *\$(insrcdir) ||/s,\$(insrcdir) ||,command.com /c if not exist $(<F),
-
index 6d44f99530774f80a2cc8d802a7a3776e72a84f5..22052140b82fad1aa9e7d6c670686313c6b7fe8b 100644 (file)
@@ -19,6 +19,8 @@
 /^srcdir *=/s/@[^@\n]*@/./
 /^VPATH *=/s/@[^@\n]*@/./
 /^MAKEINFO *=/s/@[^@\n]*@/makeinfo/
+/^INFO_EXT *=/s/@[^@\n]*@/.info/
+/^INFO_OPTS *=/s/@[^@\n]*@/--no-split/
 /^ENVADD/,/^$/c\
 ENVADD =\
 export TEXINPUTS := $(srcdir)";"$(TEXINPUTS)\
index 773934e64aa8855d430996ef6515177453379fa7..461a2b7a9ec945dd8903ecdbabb2a5d341932c8f 100644 (file)
@@ -33,14 +33,13 @@ s|\([       ]\)echo|\1djecho|g
 
 /RUN_EMACS *=/,/^$/c\
 export EMACSLOADPATH=${buildlisppath}\
-RUN_EMACS = ${BUILT_EMACS} -batch --no-site-file
+RUN_EMACS = ${EMACS} -batch --no-site-file
+
+/^MKDIR_P *=/s,@MKDIR_P@,command.com /c md,
 
 /^     cd ../c\
        ${MAKE} -C ../src ${MFLAGS} emacs
 
-/else make quail/c\
-       if not exist quail\\nul make quail
-
 /if \[ -f $@ \]\; then true/d
 /fi$/s/; fi$//
 
@@ -51,9 +50,23 @@ RUN_EMACS = ${BUILT_EMACS} -batch --no-site-file
        /^      --eval/,/; \\$/s|\; \\||
 }
 
+/^setwins=/,/^$/d
+/^\.PHONY: compile-targets/d
+/^compile-targets:/d
+/^compile-main:/,/^$/c\
+compile-main: ${TIT_MISC}\
+       $(MAKE) $(MFLAGS) $(foreach f,$(wildcard ja-dic/*.el),$(basename $f).elc)\
+       $(MAKE) $(MFLAGS) $(foreach f,$(wildcard quail/*.el),$(basename $f).elc)\
+
+
 /^install:/,/^$/c\
 install: all\
 
+/^bootstrap-clean:/,/^$/c\
+bootstrap-clean: clean\
+       rm -f ja-dic/*.elc quail/*.elc\
+
+
 /^     if test -f/d
 /^distclean:/,/^$/ {
        s|\(rm -f Makefile\)|\1 stamp-subdir|
index e13464a9b8810c58cd96a01e684147ea7d87569e..432749af92a3897e9796d60c6f7836b18fa37360 100644 (file)
@@ -2,7 +2,7 @@
 # Configuration script for lib/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2011-2012  Free Software Foundation, Inc.
+# Copyright (C) 2011-2012 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -27,7 +27,7 @@
 #    otherwise edit them to zero:
 #
 #     /^REPLACE_CALLOC *=/s/@REPLACE_CALLOC@/0/
-# 
+#
 #  . If the module is a header or adds headers, edit the corresponding
 #    variable to either an empty value or to the name of the header.
 #    Examples:
 #       s/'\; \\ *$/' >> $@-t/
 #     }
 #
+#  . If the recipe for generating a header file uses 'cat', replace it with
+#
+#      sed -e ''
+#
+#    (if needed; there's already an edit command that should take care of
+#     this).
+#
 # The following Awk script is useful for editing portions of
 # autogen/Makefile.in into Sed commands that define the corresponding
 # variables to zero (which is what is required in the absolute
@@ -124,10 +131,12 @@ am__cd = cd
 /^CYGWIN_OBJ *=/s/@[^@\n]*@//
 /^C_SWITCH_MACHINE *=/s/@C_SWITCH_MACHINE@//
 /^C_SWITCH_SYSTEM *=/s/@C_SWITCH_SYSTEM@//
-/^C_SWITCH_X_SYSTEM *=/s/@C_SWITCH_X_SYSTEM@//
+/^GNUSTEP_CFLAGS *=/s/@GNUSTEP_CFLAGS@//
 /^C_SWITCH_X_SITE *=/s/@C_SWITCH_X_SITE@//
-/^C_WARNINGS_SWITCH *=/s/@C_WARNINGS_SWITCH@//
-/^DEFS *=/s/@[^@\n]*@/-DHAVE_CONFIG_H/
+/^GNULIB_WARN_CFLAGS *=/s/@GNULIB_WARN_CFLAGS@//
+/^WARN_CFLAGS *=/s/@WARN_CFLAGS@//
+/^WERROR_CFLAGS *=/s/@WERROR_CFLAGS@//
+/^DEFS *=/s/@[^@\n]*@//
 /^DEPDIR *=/s/@[^@\n]*@/deps/
 /^DEPFLAGS *=/s/@[^@\n]*@/-MMD -MF ${DEPDIR}\/$*.d/
 /^ECHO_N *=/s/@[^@\n]*@/-n/
@@ -200,11 +209,13 @@ am__cd = cd
 /^GNULIB_GETLOGIN *=/s/@GNULIB_GETLOGIN@/0/
 /^GNULIB_GETLOGIN_R *=/s/@GNULIB_GETLOGIN_R@/0/
 /^GNULIB_GETPAGESIZE *=/s/@GNULIB_GETPAGESIZE@/0/
-/^GNULIB_GETS *=/s/@GNULIB_GETS@/0/
+/^GNULIB_GL_UNISTD_H_GETOPT *=/s/@GNULIB_GL_UNISTD_H_GETOPT@/1/
 /^GNULIB_GETSUBOPT *=/s/@GNULIB_GETSUBOPT@/0/
+/^GNULIB_GETTIMEOFDAY *=/s/@GNULIB_GETTIMEOFDAY@/0/
 /^GNULIB_GETUSERSHELL *=/s/@GNULIB_GETUSERSHELL@/0/
 /^GNULIB_GRANTPT *=/s/@GNULIB_GRANTPT@/0/
 /^GNULIB_GROUP_MEMBER *=/s/@GNULIB_GROUP_MEMBER@/0/
+/^GNULIB_ISATTY *=/s/@GNULIB_ISATTY@/0/
 /^GNULIB_LCHMOD *=/s/@GNULIB_LCHMOD@/0/
 /^GNULIB_LCHOWN *=/s/@GNULIB_LCHOWN@/0/
 /^GNULIB_LINK *=/s/@GNULIB_LINK@/0/
@@ -232,17 +243,21 @@ am__cd = cd
 /^GNULIB_PIPE *=/s/@GNULIB_PIPE@/0/
 /^GNULIB_PIPE2 *=/s/@GNULIB_PIPE2@/0/
 /^GNULIB_POPEN *=/s/@GNULIB_POPEN@/0/
+/^GNULIB_POSIX_OPENPT *=/s/@GNULIB_POSIX_OPENPT@/0/
 /^GNULIB_PREAD *=/s/@GNULIB_PREAD@/0/
 /^GNULIB_PRINTF *=/s/@GNULIB_PRINTF@/0/
 /^GNULIB_PRINTF_POSIX *=/s/@GNULIB_PRINTF_POSIX@/0/
+/^GNULIB_PSELECT *=/s/@GNULIB_PSELECT@/0/
 /^GNULIB_PTHREAD_SIGMASK *=/s/@GNULIB_PTHREAD_SIGMASK@/0/
 /^GNULIB_PTSNAME *=/s/@GNULIB_PTSNAME@/0/
+/^GNULIB_PTSNAME_R *=/s/@GNULIB_PTSNAME_R@/0/
 /^GNULIB_PUTC *=/s/@GNULIB_PUTC@/0/
 /^GNULIB_PUTCHAR *=/s/@GNULIB_PUTCHAR@/0/
 /^GNULIB_PUTENV *=/s/@GNULIB_PUTENV@/0/
 /^GNULIB_PUTS *=/s/@GNULIB_PUTS@/0/
 /^GNULIB_PWRITE *=/s/@GNULIB_PWRITE@/0/
 /^GNULIB_RAISE *=/s/@GNULIB_RAISE@/0/
+/^GNULIB_RANDOM *=/s/@GNULIB_RANDOM@/0/
 /^GNULIB_RANDOM_R *=/s/@GNULIB_RANDOM_R@/0/
 /^GNULIB_READ *=/s/@GNULIB_READ@/0/
 /^GNULIB_READLINK *=/s/@GNULIB_READLINK@/0/
@@ -255,7 +270,9 @@ am__cd = cd
 /^GNULIB_RMDIR *=/s/@GNULIB_RMDIR@/0/
 /^GNULIB_RPMATCH *=/s/@GNULIB_RPMATCH@/0/
 /^GNULIB_SCANF *=/s/@GNULIB_SCANF@/0/
+/^GNULIB_SELECT *=/s/@GNULIB_SELECT@/0/
 /^GNULIB_SETENV *=/s/@GNULIB_SETENV@/0/
+/^GNULIB_SETHOSTNAME *=/s/@GNULIB_SETHOSTNAME@/0/
 /^GNULIB_SIGACTION *=/s/@GNULIB_SIGACTION@/0/
 /^GNULIB_SIGNAL_H_SIGPIPE *=/s/@GNULIB_SIGNAL_H_SIGPIPE@/0/
 /^GNULIB_SIGPROCMASK *=/s/@GNULIB_SIGPROCMASK@/0/
@@ -276,7 +293,6 @@ am__cd = cd
 /^GNULIB_TIME_R *=/s/@GNULIB_TIME_R@/1/
 /^GNULIB_TMPFILE *=/s/@GNULIB_TMPFILE@/0/
 /^GNULIB_TTYNAME_R *=/s/@GNULIB_TTYNAME_R@/0/
-/^GNULIB_UNISTD_H_GETOPT *=/s/@GNULIB_UNISTD_H_GETOPT@/1/
 /^GNULIB_UNISTD_H_NONBLOCKING *=/s/@GNULIB_UNISTD_H_NONBLOCKING@/0/
 /^GNULIB_UNISTD_H_SIGPIPE *=/s/@GNULIB_UNISTD_H_SIGPIPE@/0/
 /^GNULIB_UNLINK *=/s/@GNULIB_UNLINK@/0/
@@ -318,6 +334,7 @@ am__cd = cd
 /^HAVE_DECL_GETUSERSHELL *=/s/@HAVE_DECL_GETUSERSHELL@/0/
 /^HAVE_DECL_LOCALTIME_R *=/s/@HAVE_DECL_LOCALTIME_R@/0/
 /^HAVE_DECL_OBSTACK_PRINTF *=/s/@HAVE_DECL_OBSTACK_PRINTF@/0/
+/^HAVE_DECL_SETHOSTNAME *=/s/@HAVE_DECL_SETHOSTNAME@/0/
 /^HAVE_DECL_SETENV *=/s/@HAVE_DECL_SETENV@/1/
 /^HAVE_DECL_SNPRINTF *=/s/@HAVE_DECL_SNPRINTF@/0/
 /^HAVE_DECL_TTYNAME_R *=/s/@HAVE_DECL_TTYNAME_R@/0/
@@ -372,12 +389,15 @@ am__cd = cd
 /^HAVE_PIPE2 *=/s/@HAVE_PIPE2@/0/
 /^HAVE_POPEN *=/s/@HAVE_POPEN@/1/
 /^HAVE_POSIX_SIGNALBLOCKING *=/s/@HAVE_POSIX_SIGNALBLOCKING@/1/
+/^HAVE_POSIX_OPENPT *=/s/@HAVE_POSIX_OPENPT@/0/
 /^HAVE_PREAD *=/s/@HAVE_PREAD@/0/
 /^HAVE_PTSNAME *=/s/@HAVE_PTSNAME@/0/
+/^HAVE_PTSNAME_R *=/s/@HAVE_PTSNAME_R@/0/
 /^HAVE_PTHREAD_SIGMASK *=/s/@HAVE_PTHREAD_SIGMASK@/0/
 /^HAVE_PWRITE *=/s/@HAVE_PWRITE@/0/
 /^HAVE_RANDOM_H *=/s/@HAVE_RANDOM_H@/1/
 /^HAVE_RAISE *=/s/@HAVE_RAISE@/1/
+/^HAVE_RANDOM *=/s/@HAVE_RANDOM@/1/
 /^HAVE_RANDOM_R *=/s/@HAVE_RANDOM_R@/0/
 /^HAVE_READLINK *=/s/@HAVE_READLINK@/0/
 /^HAVE_READLINKAT *=/s/@HAVE_READLINKAT@/0/
@@ -385,6 +405,7 @@ am__cd = cd
 /^HAVE_RENAMEAT *=/s/@HAVE_RENAMEAT@/0/
 /^HAVE_RPMATCH *=/s/@HAVE_RPMATCH@/0/
 /^HAVE_SETENV *=/s/@HAVE_SETENV@/1/
+/^HAVE_SETHOSTNAME *=/s/@HAVE_SETHOSTNAME@/0/
 /^HAVE_SIGACTION *=/s/@HAVE_SIGACTION@/1/
 /^HAVE_SIGHANDLER_T *=/s/@HAVE_SIGHANDLER_T@/0/
 /^HAVE_SIGINFO_T *=/s/@HAVE_SIGINFO_T@/0/
@@ -400,12 +421,15 @@ am__cd = cd
 /^HAVE_STRTOULL *=/s/@HAVE_STRTOULL@/1/
 /^HAVE_STRUCT_SIGACTION_SA_SIGACTION *=/s/@HAVE_STRUCT_SIGACTION_SA_SIGACTION@/0/
 /^HAVE_STRUCT_RANDOM_DATA *=/s/@HAVE_STRUCT_RANDOM_DATA@/0/
+/^HAVE_STRUCT_TIMEVAL *=/s/@HAVE_STRUCT_TIMEVAL@/1/
 /^HAVE_SYMLINK *=/s/@HAVE_SYMLINK@/1/
 /^HAVE_SYMLINKAT *=/s/@HAVE_SYMLINKAT@/0/
 /^HAVE_SYS_BITYPES_H *=/s/@HAVE_SYS_BITYPES_H@/0/
 /^HAVE_SYS_INTTYPES_H *=/s/@HAVE_SYS_INTTYPES_H@/0/
 /^HAVE_SYS_LOADAVG_H *=/s/@HAVE_SYS_LOADAVG_H@/0/
 /^HAVE_SYS_PARAM_H *=/s/@HAVE_SYS_PARAM_H@/1/
+/^HAVE_SYS_SELECT_H *=/s/@HAVE_SYS_SELECT_H@/0/
+/^HAVE_SYS_TIME_H *=/s/@HAVE_SYS_TIME_H@/1/
 /^HAVE_SYS_TYPES_H *=/s/@HAVE_SYS_TYPES_H@/1/
 /^HAVE_TIMEGM *=/s/@HAVE_TIMEGM@/0/
 /^HAVE_TYPE_VOLATILE_SIG_ATOMIC_T *=/s/@HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@/1/
@@ -439,7 +463,10 @@ am__cd = cd
 /^NEXT_AS_FIRST_DIRECTIVE_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/
 /^NEXT_AS_FIRST_DIRECTIVE_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/
 /^NEXT_AS_FIRST_DIRECTIVE_STDLIB_H *=/s/@[^@\n]*@/<stdlib.h>/
+/^NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H *=/s/@[^@\n]*@//
 /^NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H *=/s!@[^@\n]*@!<sys/stat.h>!
+/^NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H *=/s/@[^@\n]*@//
+/^NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H *=/s!@[^@\n]*@!<sys/types.h>!
 /^NEXT_AS_FIRST_DIRECTIVE_TIME_H *=/s/@[^@\n]*@/<time.h>/
 /^NEXT_AS_FIRST_DIRECTIVE_UNISTD_H *=/s/@[^@\n]*@/<unistd.h>/
 /^NEXT_GETOPT_H *=/s/@[^@\n]*@/<getopt.h>/
@@ -449,7 +476,10 @@ am__cd = cd
 /^NEXT_STDIO_H *=/s/@[^@\n]*@/<stdio.h>/
 /^NEXT_STDINT_H *=/s/@[^@\n]*@/<stdint.h>/
 /^NEXT_STDLIB_H *=/s/@[^@\n]*@/<stdlib.h>/
+/^NEXT_SYS_SELECT_H *=/s/@[^@\n]*@//
 /^NEXT_SYS_STAT_H *=/s!@[^@\n]*@!<sys/stat.h>!
+/^NEXT_SYS_TIME_H *=/s/@[^@\n]*@//
+/^NEXT_SYS_TYPES_H *=/s!@[^@\n]*@!<sys/types.h>!
 /^NEXT_TIME_H *=/s/@[^@\n]*@/<time.h>/
 /^NEXT_UNISTD_H *=/s/@[^@\n]*@/<unistd.h>/
 /^OBJEXT *=/s/@[^@\n]*@/o/
@@ -479,6 +509,7 @@ am__cd = cd
 /^REPLACE_FSTATAT *=/s/@REPLACE_FSTATAT@/0/
 /^REPLACE_FTELL *=/s/@REPLACE_FTELL@/0/
 /^REPLACE_FTELLO *=/s/@REPLACE_FTELLO@/0/
+/^REPLACE_FTRUNCATE *=/s/@REPLACE_FTRUNCATE@/0/
 /^REPLACE_GETCWD *=/s/@REPLACE_GETCWD@/0/
 /^REPLACE_GETDELIM *=/s/@REPLACE_GETDELIM@/0/
 /^REPLACE_GETDOMAINNAME *=/s/@REPLACE_GETDOMAINNAME@/0/
@@ -486,6 +517,8 @@ am__cd = cd
 /^REPLACE_GETLINE *=/s/@REPLACE_GETLINE@/0/
 /^REPLACE_GETLOGIN_R *=/s/@REPLACE_GETLOGIN_R@/0/
 /^REPLACE_GETPAGESIZE *=/s/@REPLACE_GETPAGESIZE@/0/
+/^REPLACE_GETTIMEOFDAY *=/s/@REPLACE_GETTIMEOFDAY@/0/
+/^REPLACE_ISATTY *=/s/@REPLACE_ISATTY@/0/
 /^REPLACE_LCHOWN *=/s/@REPLACE_LCHOWN@/0/
 /^REPLACE_LINK *=/s/@REPLACE_LINK@/0/
 /^REPLACE_LINKAT *=/s/@REPLACE_LINKAT@/0/
@@ -507,8 +540,11 @@ am__cd = cd
 /^REPLACE_PREAD *=/s/@REPLACE_PREAD@/0/
 /^REPLACE_PRINTF *=/s/@REPLACE_PRINTF@/0/
 /^REPLACE_PTHREAD_SIGMASK *=/s/@REPLACE_PTHREAD_SIGMASK@/0/
+/^REPLACE_PSELECT *=/s/@REPLACE_PSELECT@/0/
+/^REPLACE_PTSNAME_R *=/s/@REPLACE_PTSNAME_R@/0/
 /^REPLACE_PUTENV *=/s/@REPLACE_PUTENV@/0/
 /^REPLACE_PWRITE *=/s/@REPLACE_PWRITE@/0/
+/^REPLACE_RANDOM_R *=/s/@REPLACE_RANDOM_R@/0/
 /^REPLACE_READ *=/s/@REPLACE_READ@/0/
 /^REPLACE_RAISE *=/s/@REPLACE_RAISE@/0/
 /^REPLACE_READLINK *=/s/@REPLACE_READLINK@/0/
@@ -526,6 +562,8 @@ am__cd = cd
 /^REPLACE_STDIO_READ_FUNCS *=/s/@REPLACE_STDIO_READ_FUNCS@/0/
 /^REPLACE_STDIO_WRITE_FUNCS *=/s/@REPLACE_STDIO_WRITE_FUNCS@/0/
 /^REPLACE_STRTOD *=/s/@REPLACE_STRTOD@/0/
+/^REPLACE_STRTOIMAX *=/s/@REPLACE_STRTOIMAX@/0/
+/^REPLACE_STRUCT_TIMEVAL *=/s/@REPLACE_STRUCT_TIMEVAL@/0/
 /^REPLACE_SYMLINK *=/s/@REPLACE_SYMLINK@/0/
 /^REPLACE_TIMEGM *=/s/@REPLACE_TIMEGM@/0/
 /^REPLACE_TMPFILE *=/s/@REPLACE_TMPFILE@/0/
@@ -547,6 +585,7 @@ am__cd = cd
 /^SIZE_T_SUFFIX *=/s/@SIZE_T_SUFFIX@/u/
 /^ALLOCA_H *=/s/@[^@\n]*@/alloca.h/
 /^STDBOOL_H *=/s/@[^@\n]*@//
+/^STDALIGN_H *=/s/@[^@\n]*@/stdalign.h/
 /^STDARG_H *=/s/@[^@\n]*@//
 /^STDDEF_H *=/s/@[^@\n]*@//
 /^STDINT_H *=/s/@[^@\n]*@/stdint.h/
@@ -556,11 +595,19 @@ am__cd = cd
 /^UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS *=/s/@[^@\n]*@/0/
 /^WCHAR_T_SUFFIX *=/s/@WCHAR_T_SUFFIX@/h/
 /^WINT_T_SUFFIX *=/s/@WINT_T_SUFFIX@//
+/^WINDOWS_64_BIT_OFF_T *=/s/@WINDOWS_64_BIT_OFF_T@/0/
+/^WINDOWS_64_BIT_ST_SIZE *=/s/@WINDOWS_64_BIT_ST_SIZE@/0/
 /am__append_1 *=.*gettext\.h/s/@[^@\n]*@/\#/
 /am__append_2 *=.*verify\.h/s/@[^@\n]*@//
 /^gl_LIBOBJS *=/s/@[^@\n]*@/getopt.o getopt1.o strftime.o time_r.o getloadavg.o pthread_sigmask.o/
 /^BUILT_SOURCES *=/s/ *inttypes\.h//
-/^am_libgnu_a_OBJECTS *=/s/careadlinkat\.\$(OBJEXT)//
+/^BUILT_SOURCES *=/,/^[^       ]/{
+  s| *sys/select\.h||
+  s| *sys/time\.h||
+}
+/^am_libgnu_a_OBJECTS *=/,/^[  ]/{
+  s/careadlinkat\.\$(OBJEXT) //
+}
 /^am_libgnu_a_OBJECTS *=/s/allocator\.\$(OBJEXT)//
 /^srcdir *=/s/@[^@\n]*@/./
 /^top_srcdir *=/s/@[^@\n]*@/../
@@ -606,6 +653,8 @@ s/^@GL_GENERATE_STDDEF_H_TRUE@/\#/
 s/^@GL_GENERATE_STDDEF_H_FALSE@/\#/
 s/^@GL_GENERATE_STDINT_H_TRUE@//
 s/^@GL_GENERATE_STDINT_H_FALSE@/\#/
+s/^@GL_GENERATE_STDALIGN_H_TRUE@//
+s/^@GL_GENERATE_STDALIGN_H_FALSE@/\#/
 /^arg-nonnull\.h:/,/^[         ][      ]*mv /c\
 arg-nonnull.h: $(top_srcdir)/build-aux/snippet/arg-nonnull.h\
        sed -n -e '/GL_ARG_NONNULL/,$$p' < $(top_srcdir)/build-aux/snippet/arg-nonnull.h > $@
@@ -617,6 +666,7 @@ warn-on-use.h: $(top_srcdir)/build-aux/snippet/warn-on-use.h\
        sed -n -e '/^.ifndef/,$$p' < $(top_srcdir)/build-aux/snippet/warn-on-use.h > $@
 s/^    [       ]*{ echo \(.*\); \\/     djecho \1 > $@-t/
 s/^    [       ]*{ echo \(.*\) && \\/   djecho \1 > $@-t/
+s/^    [       ]*cat \(.*\); \\/        sed -e '' \1 >> $@-t/
 s/ \&\& \\ *$//
 s/\.in-h\;  *\\$/.in-h >> $@-t/
 /^     [       ]*} /d
@@ -630,3 +680,6 @@ s/\.in-h\;  *\\$/.in-h >> $@-t/
   s/'\; \\ *$/' >> $@-t/
 }
 s!\$(MKDIR_P)[         ][      ]*sys!command.com /c "if not exist sys\\stat.h md sys"!
+/^     @for dir in/,/^[^        ]/c\
+       -rm -rf $(MOSTLYCLEANDIRS)
+/^      *-test . /d
index f5cbdc33847315bd45eaff104842eb205a68d504..6451f7a73226088df297482927a1f7af29d5bc5b 100644 (file)
@@ -1,6 +1,10 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-04-07  Glenn Morris  <rgm@gnu.org>
 
-       * Version 24.1 released.
+       * Cocoa/Emacs.base/Contents/Info.plist:
+       * Cocoa/Emacs.base/Contents/Resources/English.lproj/InfoPlist.strings:
+       * GNUstep/Emacs.base/Resources/Info-gnustep.plist:
+       * GNUstep/Emacs.base/Resources/Emacs.desktop:
+       Bump version to 24.1.50.
 
 2012-01-05  Glenn Morris  <rgm@gnu.org>
 
index 793e022f86827deae2f8f0a36826e5727c375205..31100020cc3df40312049ba763029b7affb85c1d 100644 (file)
@@ -553,7 +553,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
        <key>CFBundleExecutable</key>
        <string>Emacs</string>
        <key>CFBundleGetInfoString</key>
-       <string>Emacs 24.1 Copyright (C) 2012 Free Software Foundation, Inc.</string>
+       <string>Emacs 24.1.50 Copyright (C) 2012 Free Software Foundation, Inc.</string>
        <key>CFBundleIconFile</key>
        <string>Emacs.icns</string>
        <key>CFBundleIdentifier</key>
@@ -566,7 +566,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
        <string>APPL</string>
        <!-- This should be the emacs version number. -->
        <key>CFBundleShortVersionString</key>
-       <string>24.1</string>
+       <string>24.1.50</string>
        <key>CFBundleSignature</key>
        <string>EMAx</string>
        <!-- This SHOULD be a build number. -->
index 19cdba8a0dd66626b2766dbe1783cf9cab3b569b..cd1920317b045f94b9e17b816caf1cd37c1b28cd 100644 (file)
@@ -1,6 +1,6 @@
 /* Localized versions of Info.plist keys */
 
 CFBundleName = "Emacs";
-CFBundleShortVersionString = "Version 24.1";
-CFBundleGetInfoString = "Emacs version 24.1, NS Windowing";
+CFBundleShortVersionString = "Version 24.1.50";
+CFBundleGetInfoString = "Emacs version 24.1.50, NS Windowing";
 NSHumanReadableCopyright = "Copyright (C) 2012 Free Software Foundation, Inc.";
index da1a3be2f86533fa8f552fbfe711c09cadb3c560..4e79b4f380ede716ef194bc7cfa4692f9a5fde6c 100644 (file)
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Encoding=UTF-8
 Type=Application
-Version=24.1
+Version=24.1.50
 Categories=GNUstep
 Name=Emacs
 Comment=GNU Emacs for NeXT/Open/GNUstep and OS X
index 2c95656af5c9ddee80e431c1eb1c34e52c6056be..e22b9daa373713331abea9fde629da6f1f9ee74c 100644 (file)
@@ -2,7 +2,7 @@
     ApplicationDescription = "GNU Emacs for GNUstep / OS X";
     ApplicationIcon = emacs.tiff;
     ApplicationName = Emacs;
-    ApplicationRelease = "24.1";
+    ApplicationRelease = "24.1.50";
     Authors = (
        "Adrian Robert (GNUstep)",
        "Christophe de Dinechin (MacOS X)",
@@ -13,7 +13,7 @@
     );
     Copyright = "Copyright (C) 2012 Free Software Foundation, Inc.";
     CopyrightDescription = "Released under the GNU General Public License Version 3 or later";
-    FullVersionID = "Emacs 24.1, NS Windowing";
+    FullVersionID = "Emacs 24.1.50, NS Windowing";
     NSExecutable = Emacs;
     NSIcon = emacs.tiff;
     NSPrincipalClass = NSApplication;
index 1e7109a3910ff71582c7dba0244373bedc4c6545..634ff012782c2534784f1536548c2b64015ec28c 100644 (file)
@@ -16,7 +16,8 @@ In order to run Emacs.app, you must run:
 
   make install
 
-This will assemble the app in nextstep/Emacs.app.
+This will assemble the app in nextstep/Emacs.app (i.e., the --prefix
+argument has no effect in this case).
 
 If you pass the --disable-ns-self-contained option to configure, the lisp
 files will be installed under whatever 'prefix' is set to (defaults to
index f27b4867ebed253341349e127ade403c2dfebca7..16a6577cb6c7dd75ef39e330ae79b0406eccdcd2 100644 (file)
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-14  Juanma Barranquero  <lekktu@gmail.com>
 
-       * Version 24.1 released.
+       * config.nt: Sync with autogen/config.in.
+       (GC_MARK_SECONDARY_STACK, GC_MARK_STACK, GC_SETJMP_WORKS)
+       (SETUP_SLAVE_PTY): New macros.
 
-2012-05-29  Eli Zaretskii  <eliz@gnu.org>
+2012-07-13  Juanma Barranquero  <lekktu@gmail.com>
 
-       * nmake.defs (MWINDOWS): Define as
-       "-subsystem:windows -entry:mainCRTStartup".  Suggested by Fabrice
-       Popineau <fabrice.popineau@supelec.fr>.  (Bug#11405)
+       * config.nt: Sync with autogen/config.in.
+       (BROKEN_FIONREAD, BROKEN_GET_CURRENT_DIR_NAME)
+       (BROKEN_PTY_READ_AFTER_EAGAIN, BROKEN_SIGAIO, BROKEN_SIGPOLL)
+       (BROKEN_SIGPTY, BSD4_2, BSD_SYSTEM, BSD_SYSTEM_AHB, CYGWIN, DARWIN_OS)
+       (FIRST_PTY_LETTER, GNU_LINUX, G_SLICE_ALWAYS_MALLOC, HAVE_PTYS)
+       (HAVE_SOCKETS, HPUX, INTERRUPT_INPUT, IRIX6_5, NARROWPROTO, NO_ABORT)
+       (NO_EDITRES, NSIG_MINIMUM, PREFER_VSUSP, PTY_ITERATION)
+       (PTY_NAME_SPRINTF, PTY_OPEN, PTY_TTY_NAME_SPRINTF, RUN_TIME_REMAP)
+       (SETPGRP_RELEASES_CTTY, SOLARIS2, TAB3, TABDLY, ULIMIT_BREAK_VALUE)
+       (UNIX98_PTYS, USG, USG5, XOS_NEEDS_TIME_H, _AIX): New macros.
+       (HAVE_ATTRIBUTE_ALIGNED, HAVE_C99_STRTOLD, HAVE___BUILTIN_UNWIND_INIT):
+       Set in src/s/ms-w32.h, not here.
 
-       * gmake.defs (MWINDOWS): Define as "-mwindows".
+2012-07-11  Juanma Barranquero  <lekktu@gmail.com>
 
-2012-05-28  Eli Zaretskii  <eliz@gnu.org>
+       * config.nt: Sync with autogen/config.in.
+       (CLASH_DETECTION, DEFAULT_SOUND_DEVICE, DONT_REOPEN_PTY)
+       (GNU_LIBRARY_PENDING_OUTPUT_COUNT, SIGNALS_VIA_CHARACTERS): New macros.
+       (HAVE_MKDIR, HAVE_RENAME, HAVE_RMDIR, HAVE_STRERROR): Remove.
+
+2012-07-10  Juanma Barranquero  <lekktu@gmail.com>
+
+       * config.nt: Sync with autogen/config.in.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * config.nt (ATTRIBUTE_CONST): Add, to sync with configure.ac.
+
+2012-07-09  Juanma Barranquero  <lekktu@gmail.com>
+
+       * config.nt: Sync with autogen/config.in.
+
+2012-07-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * config.nt (HAVE_STRCASECMP, HAVE_STRNCASECMP): Remove.
+
+2012-07-06  Juanma Barranquero  <lekktu@gmail.com>
+           Eli Zaretskii  <eliz@gnu.org>
+
+       * config.nt: Complete rework to bring it in sync with autogen/config.in.
+       All Windows-specific code moved to src/s/ms-w32.h.
+
+2012-07-04  Juanma Barranquero  <lekktu@gmail.com>
+           Eli Zaretskii  <eliz@gnu.org>
+
+       * configure.bat (enablechecking): Enable checks through src/config.h,
+       not the compiler's command line.
+
+       * nmake.defs (CHECKING_CFLAGS): Remove.
+       (CFLAGS, ESC_CFLAGS): Do not include $(CHECKING_CFLAGS).
+
+       * gmake.defs (DEBUG_CFLAGS): Add -fno-crossjumping.
+       (CHECKING_CFLAGS): Remove.
+       (CFLAGS, ESC_CFLAGS): Do not include $(CHECKING_CFLAGS).
+
+2012-07-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * config.nt (LISP_FLOAT_TYPE, HAVE_XFREE386, USE_TEXT_PROPERTIES)
+       (GSSAPI, HAVE_LIBINTL, HAVE_LIBGSSAPI_KRB5, HAVE_LIBGSSAPI)
+       (HAVE_GSSAPI_H, HAVE_LIBXBD, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET)
+       (HAVE_MEMCMP): Remove, obsolete.
+
+2012-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * paths.h (PATH_SITELOADSEARCH): New.
+
+2012-06-28  Juanma Barranquero  <lekktu@gmail.com>
+
+       * nmake.defs (CHECKING_CFLAGS):
+       * gmake.defs (CHECKING_CFLAGS): Remove XASSERTS.
+
+2012-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * config.nt (_Noreturn): Don't reference __SUNPRO_C.
+
+2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
+       * config.nt (_Noreturn): New macro.
+       (NO_RETURN): Remove.  All uses replaced with _Noreturn.
+       (w32_abort) [HAVE_NTGUI]: Use _Noreturn rather than NO_RETURN.
+
+2012-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * inc/sys/time.h (struct timespec): Don't define it here, it is
+       now defined in src/s/ms-w32.h.
+
+2012-06-23  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu.
+       * inc/sys/time.h (struct timespec): Define.
+
+2012-06-16  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (install-addpm): New target.
+       (dist): Depend on it.
+       (install-shortcuts): Depend on install-addpm instead of copying
+       addpm.exe as part of the recipe.  See
+       http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00171.html
+       for the related problem and discussions.
+
+2012-06-11  Glenn Morris  <rgm@gnu.org>
+
+       * config.nt (SYSTEM_TYPE): Define it.
+
+2012-05-31  Eli Zaretskii  <eliz@gnu.org>
 
        * configure.bat (genmakefiles): Move the redirection away from the
        end of the command, to avoid excess whitespace at the end of Make
        descriptor and eaten up.  This fixes breakage introduced by the
        last change, without reintroducing the bug fixed by that change.
 
-2012-05-18  Eli Zaretskii  <eliz@gnu.org>
+2012-05-31  Eli Zaretskii  <eliz@gnu.org>
+
+       * nmake.defs (MWINDOWS): Define as
+       "-subsystem:windows -entry:mainCRTStartup".  Suggested by Fabrice
+       Popineau <fabrice.popineau@supelec.fr>.  (Bug#11405)
+
+       * gmake.defs (MWINDOWS): Define as "-mwindows".
+
+2012-05-28  Eli Zaretskii  <eliz@gnu.org>
+
+       * config.nt (HAVE_SYSINFO): Remove; unused.
+
+2012-05-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * inc/stdalign.h: New file.
 
        * configure.bat: Ensure a space between %var% expansion and
        redirection symbol '>', which breaks when %var% ends in a digit,
        such as 1.
 
-2012-04-11  Dani Moncayo  <dmoncayo@gmail.com>  (tiny change)
+2012-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove src/m/*.
+       * config.nt: Do not include "m/intel386.h"; file was removed.
+       (BITS_PER_CHAR, BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG):
+       Move to src/lisp.h.
+       (EMACS_INT_MAX): New macro.
+
+2012-05-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * config.nt (HAVE_GETDOMAINNAME, HAVE_XSETWMPROTOCOLS)
+       (HAVE_GETSOCKOPT, HAVE_SETSOCKOPT): Remove; not needed.
+
+       * config.nt (HAVE_FTIME): Remove undef; not needed.
+
+2012-05-01  Glenn Morris  <rgm@gnu.org>
+
+       * config.nt (HAVE_LIBNCURSES): Remove undef; not needed.
+
+2012-04-14  Dani Moncayo  <dmoncayo@gmail.com>  (tiny change)
 
        * makefile.w32-in: Fix typo (Bug#10261).
 
+2012-04-10  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (emacs, misc, lispref, lispintro): New targets,
+       each runs makeinfo in its own subdirectory of 'doc'.
+       (info-gmake): Depend on these new targets.
+
+2012-04-07  Glenn Morris  <rgm@gnu.org>
+
+       * config.nt, makefile.w32-in, emacs.rc, emacsclient.rc:
+       Bump version to 24.1.50.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * configure.bat: Support building with libxml2.
+
+       * INSTALL:
+       * README.W32: Add information about libxml2.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in: Convert to Unix EOL format.
+       (all): Don't depend on stamp_BLD and on maybe-bootstrap.
+       (all-other-dirs-$(MAKETYPE)): Depend on maybe-bootstrap.
+       (bootstrap-gmake): Invoke the "clean" and build targets in 2
+       separate commands, so they run in that order even under "make -j".
+
 2012-03-29  Eli Zaretskii  <eliz@gnu.org>
 
        * config.nt: Discourage from defining HAVE_GETCWD.
 2005-06-05  Eli Zaretskii  <eliz@gnu.org>
 
        * inc/sys/socket.h: Change arg 4 of sys_setsockopt to
-       `const void *', for consistency with Posix.
+       `const void *', for consistency with POSIX.
 
 2005-06-04  Eli Zaretskii  <eliz@gnu.org>
 
index c470ed4960f8a5ce3567d3c617812f6337fc16df..96ef52faf5e19c9c8ba292ae9f7598be159f5f0b 100644 (file)
   You can get pre-built binaries (including any required DLL and the
   header files) at http://sourceforge.net/projects/ezwinports/files/.
 
+* Optional libxml2 support
+
+  If configure.bat finds the libxml/HTMLparser.h file in the include path,
+  Emacs is built with libxml2 support by default; to avoid that you can
+  pass the argument --without-libxml2.
+
+  In order to support libxml2 at runtime, a libxml2-enabled Emacs must
+  be able to find the relevant DLLs during startup; failure to do so
+  is not an error, but libxml2 features won't be available to the
+  running session.
+
+  One place where you can get pre-built Windows binaries of libxml2
+  (including any required DLL and the header files) is here:
+
+     http://sourceforge.net/projects/ezwinports/files/
+
+  To compile Emacs with libxml2 from that site, you will need to pass
+  the "--cflags -I/path/to/include/libxml2" option to configure.bat,
+  because libxml2 header files are installed in the include/libxml2
+  subdirectory of the directory where you unzip the binary
+  distribution.  Other binary distributions might use other
+  directories, although include/libxml2 is the canonical place where
+  libxml2 headers are installed on Posix platforms.
+
+  You will also need to install the libiconv "development" tarball,
+  because the libiconv headers need to be available to the compiler
+  when you compile with libxml2 support.  A MinGW port of libiconv can
+  be found on the MinGW site:
+
+   http://sourceforge.net/projects/mingw/files/MinGW/Base/libiconv/
+
+  You need the libiconv-X.Y.Z-N-mingw32-dev.tar.lzma tarball from that
+  site.
+
 * Experimental SVG support
 
   SVG support is currently experimental, and not built by default.
index 05456fd1d6d74eb8b5dc8c62ccfb03556405b9c1..e2197ba5adf84b6e1c0f6658417814a32e5e6c4b 100644 (file)
@@ -172,6 +172,16 @@ See the end of the file for license conditions.
   You can get pre-built binaries (including any required DLL and the
   header files) at http://sourceforge.net/projects/ezwinports/files/.
 
+* libxml2 support
+
+  In order to support libxml2 at runtime, a libxml2-enabled Emacs must
+  be able to find the relevant DLLs during startup; failure to do so
+  is not an error, but libxml2 features won't be available to the
+  running session.
+
+  You can get pre-built binaries (including any required DLL and the
+  header files) at http://sourceforge.net/projects/ezwinports/files/.
+
 * Uninstalling Emacs
 
   If you should need to uninstall Emacs, simply delete all the files
index 94cb60726037ff2468b91107cb5487585f36f4b3..d727cd3fafd43b6f08456ff226ba4f9dad35e146 100644 (file)
@@ -1,6 +1,7 @@
-/* GNU Emacs site configuration template file.  -*- C -*-
+/* GNU Emacs site configuration template file.
 
-Copyright (C) 1988, 1993-1994, 2001-2012  Free Software Foundation, Inc.
+Copyright (C) 1988, 1993-1994, 2001-2012
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,356 +18,1539 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
+/* NOTE:
+   This file is intentionally kept in sync with autogen/config.in to
+   ease maintenance.  Please do not remove non-Windows related stuff
+   unless strictly necessary.  Also, before adding anything here
+   consider whether src/s/ms-w32.h would be a better place; this is
+   particularly true for gcc vs. MSVC conditional defines, MinGW or
+   MSVC specific code, and macros not already defined in config.in.  */
 
-/* No code in Emacs #includes config.h twice, but some of the code
+/* No code in Emacs #includes config.h twice, but some bits of code
    intended to work with other packages as well (like gmalloc.c)
    think they can include it as many times as they like.  */
 #ifndef EMACS_CONFIG_H
 #define EMACS_CONFIG_H
 
-/* These are all defined in the top-level Makefile by configure.
-   They're here only for reference.  */
 
-/* Define LISP_FLOAT_TYPE if you want emacs to support floating-point
-   numbers. */
-#undef LISP_FLOAT_TYPE
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
 
-/* Define GNU_MALLOC if you want to use the GNU memory allocator. */
-#define GNU_MALLOC
+/* Define to the number of bits in type 'ptrdiff_t'. */
+#undef BITSIZEOF_PTRDIFF_T
 
-/* Define if you are using the GNU C Library. */
+/* Define to the number of bits in type 'sig_atomic_t'. */
+#undef BITSIZEOF_SIG_ATOMIC_T
+
+/* Define to the number of bits in type 'size_t'. */
+#undef BITSIZEOF_SIZE_T
+
+/* Define to the number of bits in type 'wchar_t'. */
+#undef BITSIZEOF_WCHAR_T
+
+/* Define to the number of bits in type 'wint_t'. */
+#undef BITSIZEOF_WINT_T
+
+/* Define if FIONREAD should not be used. */
+#undef BROKEN_FIONREAD
+
+/* Define if get_current_dir_name should not be used. */
+#undef BROKEN_GET_CURRENT_DIR_NAME
+
+/* Define on FreeBSD to work around an issue when reading from a PTY. */
+#undef BROKEN_PTY_READ_AFTER_EAGAIN
+
+/* Define if SA_RESTART should only be used in batch mode. */
+#undef BROKEN_SA_RESTART
+
+/* Define if SIGAIO should not be used. */
+#undef BROKEN_SIGAIO
+
+/* Define if SIGIO should not be used. */
+#undef BROKEN_SIGIO
+
+/* Define if SIGPOLL should not be used. */
+#undef BROKEN_SIGPOLL
+
+/* Define if SIGPTY should not be used. */
+#undef BROKEN_SIGPTY
+
+/* Define if the system is compatible with BSD 4.2. */
+#undef BSD4_2
+
+/* Define if the system is compatible with BSD 4.2. */
+#undef BSD_SYSTEM
+
+/* Define if AH_BOTTOM should change BSD_SYSTEM. */
+#undef BSD_SYSTEM_AHB
+
+/* Define if Emacs cannot be dumped on your system. */
+#undef CANNOT_DUMP
+
+/* Define this to enable compile time checks for the Lisp_Object data type. */
+#undef CHECK_LISP_OBJECT_TYPE
+
+/* Define if you want lock files to be written, so that Emacs can tell
+   instantly when you try to modify a file that someone else has modified in
+   his/her Emacs. */
+#undef CLASH_DETECTION
+
+/* Define to one of '_getb67', 'GETB67', 'getb67' for Cray-2 and Cray-YMP
+   systems. This function is required for 'alloca.c' support on those systems.
+   */
+#undef CRAY_STACKSEG_END
+
+/* Define if the system is Cygwin. */
+#undef CYGWIN
+
+/* Define to 1 if using 'alloca.c'. */
+#undef C_ALLOCA
+
+/* Define if the system is Darwin. */
+#undef DARWIN_OS
+
+/* Extra bits to be or'd in with any pointers stored in a Lisp_Object. */
+#undef DATA_SEG_BITS
+
+/* Address of the start of the data segment. */
+#undef DATA_START
+
+/* Name of the default sound device. */
+#undef DEFAULT_SOUND_DEVICE
+
+/* Define to 1 for DGUX with <sys/dg_sys_info.h>. */
+#undef DGUX
+
+/* Define if process.c does not need to close a pty to make it a controlling
+   terminal (it is already a controlling terminal of the subprocess, because
+   we did ioctl TIOCSCTTY). */
+#undef DONT_REOPEN_PTY
+
+/* Define to 1 if you are using the GNU C Library. */
 #undef DOUG_LEA_MALLOC
 
-/* Define REL_ALLOC if you want to use the relocating allocator for
-   buffer space. */
-#define REL_ALLOC
+/* Define to the canonical Emacs configuration name. */
+#undef EMACS_CONFIGURATION
+
+/* Define to the options passed to configure. */
+#undef EMACS_CONFIG_OPTIONS
+
+/* Define to 1 if expensive run-time data type and consistency checks are
+   enabled. */
+#undef ENABLE_CHECKING
+
+/* Letter to use in finding device name of first PTY, if PTYs are supported.
+   */
+#define FIRST_PTY_LETTER 'a'
+
+/* Define to 1 if futimesat mishandles a NULL file name. */
+#undef FUTIMESAT_NULL_BUG
+
+/* Define this to check for errors in cons list. */
+#undef GC_CHECK_CONS_LIST
+
+/* Define this temporarily to hunt a bug. If defined, the size of strings is
+   redundantly recorded in sdata structures so that it can be compared to the
+   sizes recorded in Lisp strings. */
+#undef GC_CHECK_STRING_BYTES
+
+/* Define this to check the string free list. */
+#undef GC_CHECK_STRING_FREE_LIST
+
+/* Define this to check for short string overrun. */
+#undef GC_CHECK_STRING_OVERRUN
+
+/* Mark a secondary stack, like the register stack on the ia64. */
+#undef GC_MARK_SECONDARY_STACK
+
+/* Define to GC_USE_GCPROS_AS_BEFORE if conservative garbage collection is not
+   known to work. */
+#define GC_MARK_STACK 1
+
+/* Define if setjmp is known to save all registers relevant for conservative
+   garbage collection in the jmp_buf.
+   MSVC ignores the "register" keyword, so test fails even though
+   setjmp does work.  */
+#define GC_SETJMP_WORKS 1
+
+/* Define to 1 if the `getpgrp' function requires zero arguments. */
+#undef GETPGRP_VOID
+
+/* Define if gettimeofday clobbers the localtime buffer. */
+#undef GETTIMEOFDAY_CLOBBERS_LOCALTIME
+
+/* Define this to 'void' or 'struct timezone' to match the system's
+   declaration of the second argument to gettimeofday. */
+#undef GETTIMEOFDAY_TIMEZONE
+
+/* Define this to enable glyphs debugging code. */
+/* #undef GLYPH_DEBUG */
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module fscanf shall be considered present. */
+#undef GNULIB_FSCANF
+
+/* enable some gnulib portability checks */
+#undef GNULIB_PORTCHECK
+
+/* Define to a C preprocessor expression that evaluates to 1 or 0, depending
+   whether the gnulib module scanf shall be considered present. */
+#undef GNULIB_SCANF
+
+/* Value of PENDING_OUTPUT_COUNT if using the GNU C library. */
+#undef GNU_LIBRARY_PENDING_OUTPUT_COUNT
+
+/* Define if ths system is compatible with GNU/Linux. */
+#undef GNU_LINUX
+
+/* Define to 1 if you want to use the GNU memory allocator. */
+#define GNU_MALLOC 1
+
+/* Define to set the G_SLICE environment variable to "always-malloc" at
+   startup, if using GTK. */
+#undef G_SLICE_ALWAYS_MALLOC
+
+/* Define to 1 if the file /usr/lpp/X11/bin/smt.exp exists. */
+#undef HAVE_AIX_SMT_EXP
+
+/* Define to 1 if you have the `alarm' function. */
+#undef HAVE_ALARM
+
+/* Define to 1 if you have 'alloca' after including <alloca.h>, a header that
+   may be supplied by this distribution. */
+#undef HAVE_ALLOCA
+
+/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+   */
+#undef HAVE_ALLOCA_H
+
+/* Define to 1 if ALSA is available. */
+#undef HAVE_ALSA
+
+/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */
+#undef HAVE_ATTRIBUTE_ALIGNED
+
+/* Define to 1 if strtold conforms to C99. */
+#undef HAVE_C99_STRTOLD
+
+/* Define to 1 if you have the `cbrt' function. */
+#undef HAVE_CBRT
+
+/* Define to 1 if you have the `cfmakeraw' function. */
+#undef HAVE_CFMAKERAW
+
+/* Define to 1 if you have the `cfsetspeed' function. */
+#undef HAVE_CFSETSPEED
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#undef HAVE_CLOCK_GETTIME
+
+/* Define to 1 if you have the `clock_settime' function. */
+#undef HAVE_CLOCK_SETTIME
+
+/* Define to 1 if you have the `closedir' function. */
+#define HAVE_CLOSEDIR 1
+
+/* Define to 1 if you have the <coff.h> header file. */
+#undef HAVE_COFF_H
+
+/* Define to 1 if you have the <com_err.h> header file. */
+#undef HAVE_COM_ERR_H
+
+/* Define to 1 if you have the `copysign' function. */
+#undef HAVE_COPYSIGN
+
+/* Define to 1 if using D-Bus. */
+#undef HAVE_DBUS
+
+/* Define to 1 if you have the `dbus_type_is_valid' function. */
+#undef HAVE_DBUS_TYPE_IS_VALID
+
+/* Define to 1 if you have the `dbus_validate_bus_name' function. */
+#undef HAVE_DBUS_VALIDATE_BUS_NAME
+
+/* Define to 1 if you have the `dbus_validate_interface' function. */
+#undef HAVE_DBUS_VALIDATE_INTERFACE
+
+/* Define to 1 if you have the `dbus_validate_member' function. */
+#undef HAVE_DBUS_VALIDATE_MEMBER
+
+/* Define to 1 if you have the `dbus_validate_path' function. */
+#undef HAVE_DBUS_VALIDATE_PATH
+
+/* Define to 1 if you have the `dbus_watch_get_unix_fd' function. */
+#undef HAVE_DBUS_WATCH_GET_UNIX_FD
+
+/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
+   */
+#define HAVE_DECL_GETENV 1
+
+/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you
+   don't. */
+#undef HAVE_DECL_LOCALTIME_R
+
+/* Define to 1 if you have the declaration of `strmode', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRMODE
+
+/* Define to 1 if you have the declaration of `strtoimax', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRTOIMAX
+
+/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRTOLL 1
+
+/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRTOULL 1
+
+/* Define to 1 if you have the declaration of `strtoumax', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRTOUMAX 1
+
+/* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you
+   don't. */
+#undef HAVE_DECL_SYS_SIGLIST
+
+/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
+   */
+#define HAVE_DECL_TZNAME 1
+
+/* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you
+   don't. */
+#undef HAVE_DECL___SYS_SIGLIST
+
+/* Define to 1 if you have the <des.h> header file. */
+#undef HAVE_DES_H
+
+/* Define to 1 if dynamic ptys are supported. */
+#undef HAVE_DEV_PTMX
+
+/* Define to 1 if you have the `difftime' function. */
+#undef HAVE_DIFFTIME
+
+/* Define to 1 if you have the <dirent.h> header file. */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the 'dup2' function. */
+#define HAVE_DUP2 1
+
+/* Define to 1 if you have the `endgrent' function. */
+#undef HAVE_ENDGRENT
+
+/* Define to 1 if you have the `endpwent' function. */
+#undef HAVE_ENDPWENT
+
+/* Define to 1 if you have the `euidaccess' function. */
+#undef HAVE_EUIDACCESS
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fmod' function. */
+#define HAVE_FMOD 1
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `fpathconf' function. */
+#undef HAVE_FPATHCONF
+
+/* Define to 1 if you have the `freeifaddrs' function. */
+#undef HAVE_FREEIFADDRS
+
+/* Define to 1 if using the freetype and fontconfig libraries. */
+#undef HAVE_FREETYPE
+
+/* Define to 1 if you have the `frexp' function. */
+#define HAVE_FREXP 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#undef HAVE_FSEEKO
+
+/* Define to 1 if you have the `fsync' function. */
+#define HAVE_FSYNC 1
+
+/* Define to 1 if you have the `futimens' function. */
+#undef HAVE_FUTIMENS
+
+/* Define to 1 if you have the `futimes' function. */
+#undef HAVE_FUTIMES
+
+/* Define to 1 if you have the `futimesat' function. */
+#undef HAVE_FUTIMESAT
+
+/* Define to 1 if you have the `gai_strerror' function. */
+#undef HAVE_GAI_STRERROR
+
+/* Define to 1 if using GConf. */
+#undef HAVE_GCONF
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#undef HAVE_GETADDRINFO
+
+/* Define to 1 if you have the `getcwd' function.
+   If you think about defining HAVE_GETCWD, don't: the alternative
+   getwd is redefined on w32.c, and does not really return the current
+   directory, to get the desired results elsewhere in Emacs.  */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `getdelim' function. */
+#undef HAVE_GETDELIM
+
+/* Define to 1 if you have the `getgrent' function. */
+#undef HAVE_GETGRENT
+
+/* Define to 1 if you have the `gethostname' function. */
+#define HAVE_GETHOSTNAME 1
+
+/* Define to 1 if you have the `getifaddrs' function. */
+#undef HAVE_GETIFADDRS
+
+/* Define to 1 if you have the `getline' function. */
+#undef HAVE_GETLINE
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long_only' function. */
+#undef HAVE_GETOPT_LONG_ONLY
+
+/* Define to 1 if you have the `getpagesize' function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define to 1 if you have the `getpeername' function. */
+#define HAVE_GETPEERNAME 1
+
+/* Define to 1 if you have the `getpt' function. */
+#undef HAVE_GETPT
+
+/* Define to 1 if you have the `getpwent' function. */
+#undef HAVE_GETPWENT
+
+/* Define to 1 if you have the `getrlimit' function. */
+#undef HAVE_GETRLIMIT
+
+/* Define to 1 if you have the `getrusage' function. */
+#undef HAVE_GETRUSAGE
+
+/* Define to 1 if you have the `getsockname' function. */
+#define HAVE_GETSOCKNAME 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the `getwd' function. */
+#undef HAVE_GETWD
+
+/* Define to 1 if you have the `get_current_dir_name' function. */
+#undef HAVE_GET_CURRENT_DIR_NAME
+
+/* Define to 1 if you have a gif (or ungif) library. */
+#undef HAVE_GIF
+
+/* Define if using GnuTLS. */
+#undef HAVE_GNUTLS
+
+/* Define if using GnuTLS certificate verification callbacks. */
+#undef HAVE_GNUTLS_CALLBACK_CERTIFICATE_VERIFY
+
+/* Define to 1 if you have the `gnutls_certificate_set_verify_function'
+   function. */
+#undef HAVE_GNUTLS_CERTIFICATE_SET_VERIFY_FUNCTION
+
+/* Define to 1 if you have the gpm library (-lgpm). */
+#undef HAVE_GPM
+
+/* Define to 1 if you have the `grantpt' function. */
+#undef HAVE_GRANTPT
+
+/* Define to 1 if using GSettings. */
+#undef HAVE_GSETTINGS
+
+/* Define to 1 if using GTK 3 or later. */
+#undef HAVE_GTK3
+
+/* Define to 1 if you have the `gtk_adjustment_get_page_size' function. */
+#undef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
+
+/* Define to 1 if you have the `gtk_dialog_get_action_area' function. */
+#undef HAVE_GTK_DIALOG_GET_ACTION_AREA
+
+/* Define to 1 if you have the `gtk_file_selection_new' function. */
+#undef HAVE_GTK_FILE_SELECTION_NEW
+
+/* Define to 1 if you have the `gtk_main' function. */
+#undef HAVE_GTK_MAIN
+
+/* Define to 1 if you have the `gtk_orientable_set_orientation' function. */
+#undef HAVE_GTK_ORIENTABLE_SET_ORIENTATION
+
+/* Define to 1 if you have the `gtk_widget_get_mapped' function. */
+#undef HAVE_GTK_WIDGET_GET_MAPPED
+
+/* Define to 1 if you have the `gtk_widget_get_sensitive' function. */
+#undef HAVE_GTK_WIDGET_GET_SENSITIVE
+
+/* Define to 1 if you have the `gtk_widget_get_window' function. */
+#undef HAVE_GTK_WIDGET_GET_WINDOW
+
+/* Define to 1 if you have the `gtk_widget_set_has_window' function. */
+#undef HAVE_GTK_WIDGET_SET_HAS_WINDOW
+
+/* Define to 1 if you have the `gtk_window_set_has_resize_grip' function. */
+#undef HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP
+
+/* Define to 1 if you have the `g_type_init' function. */
+#undef HAVE_G_TYPE_INIT
+
+/* Define to 1 if netdb.h declares h_errno. */
+#define HAVE_H_ERRNO 1
+
+/* Define to 1 if you have the <ifaddrs.h> header file. */
+#undef HAVE_IFADDRS_H
+
+/* Define to 1 if using imagemagick. */
+#undef HAVE_IMAGEMAGICK
+
+/* Define to 1 if you have inet sockets. */
+#define HAVE_INET_SOCKETS 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the jpeg library (-ljpeg). */
+#undef HAVE_JPEG
+
+/* Define to 1 if you have the <kerberosIV/des.h> header file. */
+#undef HAVE_KERBEROSIV_DES_H
+
+/* Define to 1 if you have the <kerberosIV/krb.h> header file. */
+#undef HAVE_KERBEROSIV_KRB_H
+
+/* Define to 1 if you have the <kerberos/des.h> header file. */
+#undef HAVE_KERBEROS_DES_H
+
+/* Define to 1 if you have the <kerberos/krb.h> header file. */
+#undef HAVE_KERBEROS_KRB_H
+
+/* Define to 1 if `e_text' is a member of `krb5_error'. */
+#undef HAVE_KRB5_ERROR_E_TEXT
+
+/* Define to 1 if `text' is a member of `krb5_error'. */
+#undef HAVE_KRB5_ERROR_TEXT
+
+/* Define to 1 if you have the <krb5.h> header file. */
+#undef HAVE_KRB5_H
+
+/* Define to 1 if you have the <krb.h> header file. */
+#undef HAVE_KRB_H
+
+/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
+#define HAVE_LANGINFO_CODESET 1
+
+/* Define to 1 if you have the `com_err' library (-lcom_err). */
+#undef HAVE_LIBCOM_ERR
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+#undef HAVE_LIBCRYPTO
+
+/* Define to 1 if you have the `des' library (-ldes). */
+#undef HAVE_LIBDES
+
+/* Define to 1 if you have the `des425' library (-ldes425). */
+#undef HAVE_LIBDES425
+
+/* Define to 1 if you have the `dgc' library (-ldgc). */
+#undef HAVE_LIBDGC
+
+/* Define to 1 if you have the `dnet' library (-ldnet). */
+#undef HAVE_LIBDNET
+
+/* Define to 1 if you have the hesiod library (-lhesiod). */
+#undef HAVE_LIBHESIOD
+
+/* Define to 1 if you have the `k5crypto' library (-lk5crypto). */
+#undef HAVE_LIBK5CRYPTO
+
+/* Define to 1 if you have the `krb' library (-lkrb). */
+#undef HAVE_LIBKRB
+
+/* Define to 1 if you have the `krb4' library (-lkrb4). */
+#undef HAVE_LIBKRB4
+
+/* Define to 1 if you have the `krb5' library (-lkrb5). */
+#undef HAVE_LIBKRB5
+
+/* Define to 1 if you have the `kstat' library (-lkstat). */
+#undef HAVE_LIBKSTAT
+
+/* Define to 1 if you have the `lockfile' library (-llockfile). */
+#undef HAVE_LIBLOCKFILE
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `mail' library (-lmail). */
+#undef HAVE_LIBMAIL
+
+/* Define to 1 if using libotf. */
+#undef HAVE_LIBOTF
+
+/* Define to 1 if you have the `perfstat' library (-lperfstat). */
+#undef HAVE_LIBPERFSTAT
+
+/* Define to 1 if you have the <libpng/png.h> header file. */
+#undef HAVE_LIBPNG_PNG_H
+
+/* Define to 1 if you have the `pthreads' library (-lpthreads). */
+#undef HAVE_LIBPTHREADS
+
+/* Define to 1 if you have the resolv library (-lresolv). */
+#undef HAVE_LIBRESOLV
+
+/* Define to 1 if using SELinux. */
+#undef HAVE_LIBSELINUX
+
+/* Define to 1 if you have the `Xext' library (-lXext). */
+#undef HAVE_LIBXEXT
+
+/* Define to 1 if you have the libxml library (-lxml2). */
+#undef HAVE_LIBXML2
+
+/* Define to 1 if you have the `Xmu' library (-lXmu). */
+#undef HAVE_LIBXMU
+
+/* Define to 1 if you have the <linux/version.h> header file. */
+#undef HAVE_LINUX_VERSION_H
+
+/* Define to 1 if you have the `localtime_r' function. */
+#undef HAVE_LOCALTIME_R
+
+/* Define to 1 if you have the `logb' function. */
+#define HAVE_LOGB 1
+
+/* Define to 1 if you support file names longer than 14 characters. */
+#define HAVE_LONG_FILE_NAMES 1
+
+/* Define to 1 if the system has the type 'long long int'. */
+#undef HAVE_LONG_LONG_INT
+
+/* Define to 1 if you have the `lrand48' function. */
+#undef HAVE_LRAND48
+
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
+/* Define to 1 if you have the `lutimes' function. */
+#undef HAVE_LUTIMES
+
+/* Define to 1 if using libm17n-flt. */
+#undef HAVE_M17N_FLT
+
+/* Define to 1 if you have the <machine/soundcard.h> header file. */
+#undef HAVE_MACHINE_SOUNDCARD_H
+
+/* Define to 1 if you have the <mach/mach.h> header file. */
+#undef HAVE_MACH_MACH_H
+
+/* Define to 1 if you have the `MagickExportImagePixels' function. */
+#undef HAVE_MAGICKEXPORTIMAGEPIXELS
+
+/* Define to 1 if you have the `MagickMergeImageLayers' function. */
+#undef HAVE_MAGICKMERGEIMAGELAYERS
+
+/* Define to 1 if you have the <maillock.h> header file. */
+#undef HAVE_MAILLOCK_H
+
+/* Define to 1 if you have the <malloc/malloc.h> header file. */
+#undef HAVE_MALLOC_MALLOC_H
+
+/* Define to 1 if <wchar.h> declares mbstate_t. */
+#undef HAVE_MBSTATE_T
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have mouse menus. (This is automatic if you use X, but
+   the option to specify it remains.) It is also defined with other window
+   systems that support xmenu.c. */
+#undef HAVE_MENUS
+
+/* Define to 1 if you have the `mkstemp' function. */
+#undef HAVE_MKSTEMP
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define if you have mouse support. */
+#define HAVE_MOUSE 1
+
+/* Define to 1 if you have the `nanotime' function. */
+#undef HAVE_NANOTIME
+
+/* Define to 1 if you have the <net/if_dl.h> header file. */
+#undef HAVE_NET_IF_DL_H
+
+/* Define to 1 if you have the <net/if.h> header file. */
+#undef HAVE_NET_IF_H
+
+/* Define to 1 if you have the <nlist.h> header file. */
+#undef HAVE_NLIST_H
+
+/* Define to 1 if you are using the NeXTstep API, either GNUstep or Cocoa on
+   Mac OS X. */
+#undef HAVE_NS
+
+/* Define to 1 if libotf has OTF_get_variation_glyphs. */
+#undef HAVE_OTF_GET_VARIATION_GLYPHS
+
+/* Define to 1 if personality LINUX32 can be set. */
+#undef HAVE_PERSONALITY_LINUX32
+
+/* Define to 1 if you have the png library (-lpng). */
+#undef HAVE_PNG
+
+/* Define to 1 if you have the <png.h> header file. */
+#undef HAVE_PNG_H
+
+/* Define to 1 if you have the `posix_memalign' function. */
+#undef HAVE_POSIX_MEMALIGN
+
+/* Define if you have the /proc filesystem. */
+#undef HAVE_PROCFS
+
+/* Define to 1 if you have the `pselect' function. */
+#undef HAVE_PSELECT
+
+/* Define to 1 if you have the `pstat_getdynamic' function. */
+#undef HAVE_PSTAT_GETDYNAMIC
+
+/* Define to 1 if you have pthread (-lpthread). */
+#undef HAVE_PTHREAD
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#undef HAVE_PTHREAD_H
+
+/* Define to 1 if the pthread_sigmask function can be used (despite bugs). */
+#undef HAVE_PTHREAD_SIGMASK
+
+/* Define if the system supports pty devices. */
+#undef HAVE_PTYS
+
+/* Define to 1 if you have the <pty.h> header file. */
+#undef HAVE_PTY_H
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* Define to 1 if you have the `random' function. */
+#define HAVE_RANDOM 1
+
+/* Define to 1 if you have the `readlink' function. */
+#undef HAVE_READLINK
+
+/* Define to 1 if you have the `readlinkat' function. */
+#undef HAVE_READLINKAT
+
+/* Define to 1 if you have the `recvfrom' function. */
+#define HAVE_RECVFROM 1
+
+/* Define to 1 if res_init is available. */
+#undef HAVE_RES_INIT
+
+/* Define to 1 if you have the `rint' function. */
+#undef HAVE_RINT
+
+/* Define to 1 if using librsvg. */
+#undef HAVE_RSVG
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `sendto' function. */
+#define HAVE_SENDTO 1
+
+/* Define to 1 if you have the `setitimer' function. */
+#undef HAVE_SETITIMER
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `setpgid' function. */
+#undef HAVE_SETPGID
+
+/* Define to 1 if you have the `setrlimit' function. */
+#undef HAVE_SETRLIMIT
+
+/* Define to 1 if you have the `setsid' function. */
+#undef HAVE_SETSID
+
+/* Define to 1 if you have the `shutdown' function. */
+#define HAVE_SHUTDOWN 1
+
+/* Define to 1 if 'sig_atomic_t' is a signed integer type. */
+#undef HAVE_SIGNED_SIG_ATOMIC_T
+
+/* Define to 1 if 'wchar_t' is a signed integer type. */
+#undef HAVE_SIGNED_WCHAR_T
+
+/* Define to 1 if 'wint_t' is a signed integer type. */
+#undef HAVE_SIGNED_WINT_T
+
+/* Define to 1 if the system has the type `sigset_t'. */
+#undef HAVE_SIGSET_T
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define if the system supports 4.2-compatible sockets.
+   NT supports Winsock which is close enough (with some hacks).  */
+#define HAVE_SOCKETS 1
+
+/* Define to 1 if you have sound support. */
+#define HAVE_SOUND 1
+
+/* Define to 1 if you have the <soundcard.h> header file. */
+#undef HAVE_SOUNDCARD_H
+
+/* Define to 1 if `speed_t' is declared by <termios.h>. */
+#undef HAVE_SPEED_T
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdio_ext.h> header file. */
+#undef HAVE_STDIO_EXT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strsignal' function. */
+#undef HAVE_STRSIGNAL
+
+/* Define to 1 if you have the `strtoimax' function. */
+#undef HAVE_STRTOIMAX
+
+/* Define to 1 if you have the `strtoll' function. */
+#undef HAVE_STRTOLL
+
+/* Define to 1 if you have the `strtoull' function. */
+#define HAVE_STRTOULL 1
+
+/* Define to 1 if you have the `strtoumax' function. */
+#define HAVE_STRTOUMAX 1
+
+/* Define to 1 if `ifr_addr' is a member of `struct ifreq'. */
+#undef HAVE_STRUCT_IFREQ_IFR_ADDR
+
+/* Define to 1 if `ifr_addr.sa_len' is a member of `struct ifreq'. */
+#undef HAVE_STRUCT_IFREQ_IFR_ADDR_SA_LEN
+
+/* Define to 1 if `ifr_broadaddr' is a member of `struct ifreq'. */
+#undef HAVE_STRUCT_IFREQ_IFR_BROADADDR
+
+/* Define to 1 if `ifr_flags' is a member of `struct ifreq'. */
+#undef HAVE_STRUCT_IFREQ_IFR_FLAGS
+
+/* Define to 1 if `ifr_hwaddr' is a member of `struct ifreq'. */
+#undef HAVE_STRUCT_IFREQ_IFR_HWADDR
+
+/* Define to 1 if `ifr_netmask' is a member of `struct ifreq'. */
+#undef HAVE_STRUCT_IFREQ_IFR_NETMASK
+
+/* Define to 1 if `n_un.n_name' is a member of `struct nlist'. */
+#undef HAVE_STRUCT_NLIST_N_UN_N_NAME
+
+/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
+
+/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
+
+/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC
+
+/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
+
+/* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC
+
+/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
+
+/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC
+
+/* Define to 1 if `tm_zone' is a member of `struct tm'. */
+#undef HAVE_STRUCT_TM_TM_ZONE
+
+/* Define if struct utimbuf is declared -- usually in <utime.h>. Some systems
+   have utime.h but don't declare the struct anywhere. */
+#undef HAVE_STRUCT_UTIMBUF
+
+/* Define if struct stat has an st_dm_mode member. */
+#undef HAVE_ST_DM_MODE
+
+/* Define to 1 if you have the `symlink' function. */
+#undef HAVE_SYMLINK
+
+/* Define to 1 if you have the `sync' function. */
+#undef HAVE_SYNC
+
+/* Define to 1 if you have the <sys/bitypes.h> header file. */
+#undef HAVE_SYS_BITYPES_H
+
+/* Define to 1 if you have the <sys/inttypes.h> header file. */
+#undef HAVE_SYS_INTTYPES_H
+
+/* Define to 1 if you have the <sys/loadavg.h> header file. */
+#undef HAVE_SYS_LOADAVG_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#undef HAVE_SYS_RESOURCE_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/soundcard.h> header file. */
+#undef HAVE_SYS_SOUNDCARD_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/systeminfo.h> header file. */
+#undef HAVE_SYS_SYSTEMINFO_H
+
+/* Define to 1 if you have the <sys/timeb.h> header file. */
+#define HAVE_SYS_TIMEB_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/un.h> header file. */
+#undef HAVE_SYS_UN_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <sys/vlimit.h> header file. */
+#undef HAVE_SYS_VLIMIT_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <term.h> header file. */
+#undef HAVE_TERM_H
+
+/* Define to 1 if you have the tiff library (-ltiff). */
+#undef HAVE_TIFF
+
+/* Define if struct tm has the tm_gmtoff member. */
+#undef HAVE_TM_GMTOFF
+
+/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
+   `HAVE_STRUCT_TM_TM_ZONE' instead. */
+#undef HAVE_TM_ZONE
+
+/* Define to 1 if you have the `touchlock' function. */
+#undef HAVE_TOUCHLOCK
+
+/* Define to 1 if you don't have `tm_zone' but do have the external array
+   `tzname'. */
+#define HAVE_TZNAME 1
+
+/* Define to 1 if you have the `tzset' function. */
+#define HAVE_TZSET 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if the system has the type 'unsigned long long int'. */
+#undef HAVE_UNSIGNED_LONG_LONG_INT
+
+/* Define to 1 if you have the <util.h> header file. */
+#undef HAVE_UTIL_H
+
+/* Define to 1 if you have the `utimensat' function. */
+#undef HAVE_UTIMENSAT
+
+/* Define to 1 if you have the `utimes' function. */
+#undef HAVE_UTIMES
+
+/* Define to 1 if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define to 1 if you have the <utmp.h> header file. */
+#undef HAVE_UTMP_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
+/* Define if you have the 'wchar_t' type. */
+#define HAVE_WCHAR_T 1
+
+/* Define if you have a window system. */
+#undef HAVE_WINDOW_SYSTEM
+
+/* Define to 1 if you have the <winsock2.h> header file. */
+#undef HAVE_WINSOCK2_H
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define if utimes works properly. */
+#undef HAVE_WORKING_UTIMES
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if you have the <ws2tcpip.h> header file. */
+#undef HAVE_WS2TCPIP_H
+
+/* Define to 1 if you want to use version 11 of X windows. Otherwise, Emacs
+   expects to use version 10. */
+#undef HAVE_X11
+
+/* Define to 1 if you have the X11R6 or newer version of Xlib. */
+#undef HAVE_X11R6
+
+/* Define if you have usable X11R6-style XIM support. */
+#undef HAVE_X11R6_XIM
+
+/* Define to 1 if you have the X11R6 or newer version of Xt. */
+#undef HAVE_X11XTR6
+
+/* Define to 1 if you have the Xaw3d library (-lXaw3d). */
+#undef HAVE_XAW3D
+
+/* Define to 1 if you have the Xft library. */
+#undef HAVE_XFT
+
+/* Define to 1 if XIM is available */
+#undef HAVE_XIM
+
+/* Define to 1 if you have the XkbGetKeyboard function. */
+#undef HAVE_XKBGETKEYBOARD
+
+/* Define to 1 if you have the Xpm library (-lXpm). */
+#undef HAVE_XPM
+
+/* Define to 1 if you have the `XrmSetDatabase' function. */
+#undef HAVE_XRMSETDATABASE
+
+/* Define to 1 if you have the `XScreenNumberOfScreen' function. */
+#undef HAVE_XSCREENNUMBEROFSCREEN
+
+/* Define to 1 if you have the `XScreenResourceString' function. */
+#undef HAVE_XSCREENRESOURCESTRING
+
+/* Define if you have usable i18n support. */
+#undef HAVE_X_I18N
+
+/* Define to 1 if you have the SM library (-lSM). */
+#undef HAVE_X_SM
+
+/* Define to 1 if you want to use the X window system. */
+#undef HAVE_X_WINDOWS
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Define to 1 if you have the `_ftime' function. */
+#undef HAVE__FTIME
+
+/* Define to 1 if you have the `__builtin_unwind_init' function. */
+#undef HAVE___BUILTIN_UNWIND_INIT
+
+/* Define to 1 if you have the `__executable_start' function. */
+#undef HAVE___EXECUTABLE_START
+
+/* Define to 1 if you have the `__fpending' function. */
+#undef HAVE___FPENDING
+
+/* Define to support using a Hesiod database to find the POP server. */
+#undef HESIOD
+
+/* Define if the system is HPUX. */
+#undef HPUX
+
+/* Define to read input using SIGIO. */
+#undef INTERRUPT_INPUT
+
+/* Define if the system is IRIX. */
+#undef IRIX6_5
+
+/* Define to support Kerberos-authenticated POP mail retrieval. */
+#undef KERBEROS
+
+/* Define to use Kerberos 5 instead of Kerberos 4. */
+#undef KERBEROS5
+
+/* Define to 1 if localtime caches TZ. */
+#define LOCALTIME_CACHE 1
+
+/* Define to 1 if 'lstat' dereferences a symlink specified with a trailing
+   slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* String giving fallback POP mail host. */
+#undef MAILHOST
+
+/* Define to unlink, rather than empty, mail spool after reading. */
+#undef MAIL_UNLINK_SPOOL
+
+/* Define if the mailer uses flock to interlock the mail spool. */
+#undef MAIL_USE_FLOCK
+
+/* Define if the mailer uses lockf to interlock the mail spool. */
+#undef MAIL_USE_LOCKF
+
+/* Define to support MMDF mailboxes in movemail. */
+#undef MAIL_USE_MMDF
+
+/* Define to support POP mail retrieval. */
+#define MAIL_USE_POP 1
+
+/* Define if system's imake configuration file defines `NeedWidePrototypes' as
+   `NO'. */
+#undef NARROWPROTO
+
+/* Do not define abort in emacs.c. */
+#undef NO_ABORT
+
+/* Define if XEditRes should not be used. */
+#undef NO_EDITRES
+
+/* Define to 1 if you don't have struct exception in math.h. */
+#define NO_MATHERR 1
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Define if termio.h should not be included. */
+#undef NO_TERMIO
+
+/* Minimum value of NSIG. */
+#undef NSIG_MINIMUM
+
+/* Define to 1 if `NSInteger' is defined. */
+#undef NS_HAVE_NSINTEGER
+
+/* Define to 1 if you are using NS windowing under MacOS X. */
+#undef NS_IMPL_COCOA
+
+/* Define to 1 if you are using NS windowing under GNUstep. */
+#undef NS_IMPL_GNUSTEP
+
+/* Define to 1 if the nlist n_name member is a pointer */
+#undef N_NAME_POINTER
+
+/* Define if the C compiler is the linker. */
+#define ORDINARY_LINK 1
+
+/* Name of package */
+#define PACKAGE "emacs"
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
 
-/* Enable conservative stack marking for GC.  */
-#define GC_MARK_STACK 1
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
 
-/* MSVC ignores the "register" keyword, so test fails even though
-   setjmp does work.  */
-#define GC_SETJMP_WORKS 1
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
 
-/* Define HAVE_X_WINDOWS if you want to use the X window system.  */
-#undef HAVE_X_WINDOWS
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
 
-/* Define HAVE_X11 if you want to use version 11 of X windows.
-   Otherwise, Emacs expects to use version 10.  */
-#undef HAVE_X11
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
 
-/* Define if using an X toolkit.  */
-#undef USE_X_TOOLKIT
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
 
-/* Define this if you're using XFree386.  */
-#undef HAVE_XFREE386
+/* Number of chars of output in the buffer of a stdio stream. */
+#undef PENDING_OUTPUT_COUNT
 
-/* Define this if you have Motif 2.1 or newer.  */
-#undef HAVE_MOTIF_2_1
+/* Define to empty to suppress deprecation warnings when building with
+   --enable-gcc-warnings and with libpng versions before 1.5, which lack
+   png_longjmp. */
+#undef PNG_DEPSTRUCT
 
-/* Define HAVE_MENUS if you have mouse menus.
-   (This is automatic if you use X, but the option to specify it remains.)
-   It is also defined with other window systems that support xmenu.c.  */
-#undef HAVE_MENUS
+/* Define if process_send_signal should use VSUSP instead of VSWTCH. */
+#undef PREFER_VSUSP
 
-/* Define if we have the X11R6 or newer version of Xt.  */
-#undef HAVE_X11XTR6
+/* Define to 1 if pthread_sigmask(), when it fails, returns -1 and sets errno.
+   */
+#undef PTHREAD_SIGMASK_FAILS_WITH_ERRNO
 
-/* Define if we have the X11R6 or newer version of Xlib.  */
-#undef HAVE_X11R6
+/* Define to 1 if pthread_sigmask() may returns 0 and have no effect. */
+#undef PTHREAD_SIGMASK_INEFFECTIVE
 
-/* Define if netdb.h declares h_errno.  */
-#undef HAVE_H_ERRNO
+/* Define to 1 if pthread_sigmask() unblocks signals incorrectly. */
+#undef PTHREAD_SIGMASK_UNBLOCK_BUG
 
-/* If we're using any sort of window system, define some consequences.  */
-#ifdef HAVE_X_WINDOWS
-#define HAVE_WINDOW_SYSTEM
-#define HAVE_MOUSE
-#endif
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+   'ptrdiff_t'. */
+#undef PTRDIFF_T_SUFFIX
 
-/* Define USE_TEXT_PROPERTIES to support visual and other properties
-   on text. */
-#define USE_TEXT_PROPERTIES
+/* How to iterate over PTYs. */
+#undef PTY_ITERATION
 
-/* Define USER_FULL_NAME to return a string
-   that is the user's full name.
-   It can assume that the variable `pw'
-   points to the password file entry for this user.
+/* How to get the device name of the control end of a PTY, if non-standard. */
+#undef PTY_NAME_SPRINTF
 
-   At some sites, the pw_gecos field contains
-   the user's full name.  If neither this nor any other
-   field contains the right thing, use pw_name,
-   giving the user's login name, since that is better than nothing.  */
-#define USER_FULL_NAME pw->pw_gecos
+/* How to open a PTY, if non-standard. */
+#undef PTY_OPEN
 
-/* Define AMPERSAND_FULL_NAME if you use the convention
-   that & in the full name stands for the login id.  */
-#undef AMPERSAND_FULL_NAME
+/* How to get device name of the tty end of a PTY, if non-standard. */
+#undef PTY_TTY_NAME_SPRINTF
 
-/* Things set by --with options in the configure script.  */
+/* Define to 1 if readlink fails to recognize a trailing slash. */
+#undef READLINK_TRAILING_SLASH_BUG
 
-/* Define to support POP mail retrieval.  */
-#undef MAIL_USE_POP
+/* Define REL_ALLOC if you want to use the relocating allocator for buffer
+   space. */
+#define REL_ALLOC 1
 
-/* Define to support Kerberos-authenticated POP mail retrieval.  */
-#undef KERBEROS
-/* Define to use Kerberos 5 instead of Kerberos 4 */
-#undef KERBEROS5
-/* Define to support GSS-API in addition to (or instead of) Kerberos */
-#undef GSSAPI
+/* Define to 1 if stat needs help when passed a directory name with a trailing
+   slash */
+#undef REPLACE_FUNC_STAT_DIR
 
-/* Define to support using a Hesiod database to find the POP server.  */
-#undef HESIOD
+/* Define to 1 if stat needs help when passed a file name with a trailing
+   slash */
+#undef REPLACE_FUNC_STAT_FILE
 
-/* Some things figured out by the configure script, grouped as they are in
-   configure.in.  */
-#ifndef _ALL_SOURCE  /* suppress warning if this is pre-defined */
-#undef _ALL_SOURCE
-#endif
-#undef HAVE_SYS_SELECT_H
-#undef HAVE_SYS_TIMEB_H
-#undef HAVE_SYS_TIME_H
-#undef HAVE_UNISTD_H
-#undef HAVE_UTIME_H
-#undef HAVE_LINUX_VERSION_H
-#undef HAVE_SYS_SYSTEMINFO_H
-#undef HAVE_TERMIOS_H
-#undef HAVE_STRINGS_H
-#undef HAVE_PWD_H
+/* Define if emacs.c needs to call run_time_remap; for HPUX. */
+#undef RUN_TIME_REMAP
 
-#undef HAVE_LIBDNET
-#undef HAVE_LIBPTHREADS
-#undef HAVE_LIBRESOLV
-#undef HAVE_LIBXMU
-#undef HAVE_LIBNCURSES
-#undef HAVE_LIBINTL
+/* Define if process.c:child_setup should not call setpgrp. */
+#undef SETPGRP_RELEASES_CTTY
 
-/* movemail Kerberos support */
-/* libraries */
-#undef HAVE_LIBKRB
-#undef HAVE_LIBKRB4
-#undef HAVE_LIBDES
-#undef HAVE_LIBDES425
-#undef HAVE_LIBKRB5
-#undef HAVE_LIBCRYPTO
-#undef HAVE_LIBCOM_ERR
-/* header files */
-#undef HAVE_KRB5_H
-#undef HAVE_DES_H
-#undef HAVE_KRB_H
-#undef HAVE_KERBEROSIV_DES_H
-#undef HAVE_KERBEROSIV_KRB_H
-#undef HAVE_KERBEROS_DES_H
-#undef HAVE_KERBEROS_KRB_H
-#undef HAVE_COM_ERR_H
+/* How to set up a slave PTY, if needed. */
+#undef SETUP_SLAVE_PTY
 
-/* GSS-API libraries and headers */
-#undef HAVE_LIBGSSAPI_KRB5
-#undef HAVE_LIBGSSAPI
-#undef HAVE_GSSAPI_H
+/* Make process_send_signal work by "typing" a signal character on the pty. */
+#undef SIGNALS_VIA_CHARACTERS
 
-/* Mail-file locking */
-#undef HAVE_LIBMAIL
-#undef HAVE_MAILLOCK_H
-#undef HAVE_TOUCHLOCK
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+   'sig_atomic_t'. */
+#undef SIG_ATOMIC_T_SUFFIX
 
-#undef HAVE_ALLOCA_H
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+   'size_t'. */
+#undef SIZE_T_SUFFIX
 
-#undef HAVE_GETTIMEOFDAY
-/* If we don't have gettimeofday,
-   the test for GETTIMEOFDAY_ONE_ARGUMENT may succeed,
-   but we should ignore it.  */
-#ifdef HAVE_GETTIMEOFDAY
-#undef GETTIMEOFDAY_ONE_ARGUMENT
-#endif
-#undef HAVE_GETHOSTNAME
-#undef HAVE_GETDOMAINNAME
-#undef HAVE_DUP2
-#undef HAVE_RENAME
-#undef HAVE_CLOSEDIR
+/* Define if the system is Solaris. */
+#undef SOLARIS2
+
+/* If using the C implementation of alloca, define if you know the
+   direction of stack growth for your system; otherwise it will be
+   automatically deduced at runtime.
+        STACK_DIRECTION > 0 => grows toward higher addresses
+        STACK_DIRECTION < 0 => grows toward lower addresses
+        STACK_DIRECTION = 0 => direction of growth unknown */
+#undef STACK_DIRECTION
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+#undef STAT_MACROS_BROKEN
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 on System V Release 4. */
+#undef SVR4
+
+/* Process async input synchronously. */
+#undef SYNC_INPUT
+
+/* Define to use system malloc. */
+#undef SYSTEM_MALLOC
 
+/* The type of system you are compiling for; sets `system-type'. */
+#define SYSTEM_TYPE "windows-nt"
+
+/* Undocumented. */
+#undef TAB3
+
+/* Undocumented. */
+#undef TABDLY
+
+/* Define to 1 if you use terminfo instead of termcap. */
+#undef TERMINFO
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Define to 1 if your <sys/time.h> declares `struct tm'. */
 #undef TM_IN_SYS_TIME
-#undef HAVE_TM_ZONE
 
-/* Define to 1 if you don't have `tm_zone' but do have the external array
-   `tzname'. */
-#define HAVE_TZNAME 1
+/* Define to 1 if the type of the st_atim member of a struct stat is struct
+   timespec. */
+#undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC
 
-/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
-   */
-#define HAVE_DECL_TZNAME 1
+/* Undocumented. */
+#undef ULIMIT_BREAK_VALUE
 
-#undef const
+/* Define to 1 for Encore UMAX. */
+#undef UMAX
 
-#undef HAVE_LONG_FILE_NAMES
+/* Define to 1 for Encore UMAX 4.3 that has <inq_status/cpustats.h> instead of
+   <sys/cpustats.h>. */
+#undef UMAX4_3
 
-#undef CRAY_STACKSEG_END
+/* Define if the system has Unix98 PTYs. */
+#undef UNIX98_PTYS
 
-#undef HAVE_LIBXBSD
-#undef HAVE_XRMSETDATABASE
-#undef HAVE_XSCREENRESOURCESTRING
-#undef HAVE_XSCREENNUMBEROFSCREEN
-#undef HAVE_XSETWMPROTOCOLS
+/* Define to 1 if using GTK. */
+#undef USE_GTK
 
-#undef HAVE_MKDIR
-#undef HAVE_RMDIR
-#undef HAVE_SYSINFO
-#undef HAVE_RANDOM
-#undef HAVE_LRAND48
-#undef HAVE_MEMCPY
-#undef HAVE_MEMMOVE
-#undef HAVE_MEMSET
-#undef HAVE_MEMCMP
-#undef HAVE_LOGB
-#undef HAVE_FREXP
-#undef HAVE_FMOD
-#undef HAVE_RINT
-#undef HAVE_CBRT
-#undef HAVE_FTIME
-#undef HAVE_RES_INIT /* For -lresolv on Suns.  */
-#undef HAVE_SETSID
-#undef HAVE_FPATHCONF
-#undef HAVE_SELECT
-#undef HAVE_EUIDACCESS
-#undef HAVE_GETPAGESIZE
-#undef HAVE_GET_CURRENT_DIR_NAME
-#undef HAVE_TZSET
-#undef HAVE_SETLOCALE
-#undef HAVE_UTIMES
-#undef HAVE_SETRLIMIT
-#undef HAVE_SETPGID
-/* If you think about defining HAVE_GETCWD, don't: the alternative
-   getwd is redefined on w32.c, and does not really return the current
-   directory, to get the desired results elsewhere in Emacs */
-#undef HAVE_GETCWD
-#undef HAVE_SHUTDOWN
-#undef HAVE_STRFTIME
-/* Standard Windows strftime does not support POSIX.2 extensions.  */
-#define STRFTIME_NO_POSIX2 1
+/* Define to 1 if using the Lucid X toolkit. */
+#undef USE_LUCID
 
-#define HAVE_SENDTO 1
-#define HAVE_RECVFROM 1
-#define HAVE_GETSOCKOPT 1
-#define HAVE_SETSOCKOPT 1
-#define HAVE_GETSOCKNAME 1
-#define HAVE_GETPEERNAME 1
-#define HAVE_SNPRINTF 1
-#define HAVE_LANGINFO_CODESET 1
-/* Local (unix) sockets are not supported.  */
-#undef HAVE_SYS_UN_H
+/* Define to use mmap to allocate buffer text. */
+#undef USE_MMAP_FOR_BUFFERS
 
-#define LOCALTIME_CACHE
-#undef HAVE_INET_SOCKETS
+/* Define to 1 if using the Motif X toolkit. */
+#undef USE_MOTIF
 
-#undef HAVE_AIX_SMT_EXP
+/* Define to 1 if we should use toolkit scroll bars. */
+#define USE_TOOLKIT_SCROLL_BARS 1
 
-/* Define if you have the ANSI `strerror' function.
-   Otherwise you must have the variable `char *sys_errlist[]'.  */
-#undef HAVE_STRERROR
+/* Define to 1 if we should use XIM, if it is available. */
+#undef USE_XIM
 
-/* Define if `sys_siglist' is declared by <signal.h>.  */
-#undef SYS_SIGLIST_DECLARED
+/* Define to 1 if using an X toolkit. */
+#undef USE_X_TOOLKIT
 
-/* Define if `struct utimbuf' is declared by <utime.h>.  */
-#undef HAVE_STRUCT_UTIMBUF
+/* Define if the system is compatible with System III. */
+#undef USG
 
-/* Define if `struct timeval' is declared by <sys/time.h>.  */
-#undef HAVE_TIMEVAL
+/* Define if the system is compatible with System V. */
+#undef USG5
 
-/* Define to 1 if you have the <getopt.h> header file. */
-#undef HAVE_GETOPT_H
+/* Define for USG systems where it works to open a pty's tty in the parent
+   process, then close and reopen it in the child. */
+#undef USG_SUBTTY_WORKS
 
-/* Define to 1 if you have the `getopt_long_only' function. */
-#undef HAVE_GETOPT_LONG_ONLY
+/* Version number of package */
+#define VERSION "24.1.50"
 
-/* Preprocessor macros needed for gnulib imports.  */
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+   'wchar_t'. */
+#undef WCHAR_T_SUFFIX
 
-/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */
-#ifdef __GNUC__
-#define HAVE_ATTRIBUTE_ALIGNED 1
+/* Use long long for EMACS_INT if available. */
+/* #undef WIDE_EMACS_INT */
+
+/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type
+   'wint_t'. */
+#undef WINT_T_SUFFIX
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
 #else
-#undef HAVE_ATTRIBUTE_ALIGNED
+# ifndef WORDS_BIGENDIAN
+#  undef WORDS_BIGENDIAN
+# endif
 #endif
 
-/* Define to 1 if strtold conforms to C99. */
-#ifdef __GNUC__
-#define HAVE_C99_STRTOLD 1
-#else
-#undef HAVE_C99_STRTOLD
+/* Define this to check for malloc buffer overrun. */
+#undef XMALLOC_OVERRUN_CHECK
+
+/* Compensate for a bug in Xos.h on some systems, where it requires time.h. */
+#undef XOS_NEEDS_TIME_H
+
+/* Define to the type of the 6th arg of XRegisterIMInstantiateCallback, either
+   XPointer or XPointer*. */
+#undef XRegisterIMInstantiateCallback_arg6
+
+/* Define if the system is AIX. */
+#undef _AIX
+
+/* Enable large inode numbers on Mac OS X.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
 #endif
 
-/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
-   */
-#define HAVE_DECL_GETENV 1
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
 
-/* Define to 1 if you have the declaration of `localtime_r', and to 0 if you
-   don't. */
-#undef HAVE_DECL_LOCALTIME_R
+/* enable compile-time and run-time bounds-checking, and some warnings */
+#undef _FORTIFY_SOURCE
 
-/* Define to 1 if you have the `localtime_r' function. */
-#undef HAVE_LOCALTIME_R
+/* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct
+   stat.st_size becomes 64-bit. */
+#undef _GL_WINDOWS_64_BIT_ST_SIZE
 
-/* Define to 1 if you have the declaration of `strtoll', and to 0 if you
-   don't. */
-#define HAVE_DECL_STRTOLL 1
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
 
-/* Define to 1 if you have the declaration of `strtoull', and to 0 if you
-   don't. */
-#define HAVE_DECL_STRTOULL 1
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
 
-/* Define to 1 if you have the declaration of `strtoumax', and to 0 if you
-   don't. */
-#define HAVE_DECL_STRTOUMAX 1
+/* Define to 1 if on MINIX. */
+#undef _MINIX
 
-/* Define to 1 if you have the `strtoull' function. */
-#define HAVE_STRTOULL 1
+/* Define if GNUstep uses ObjC exceptions. */
+#undef _NATIVE_OBJC_EXCEPTIONS
 
-/* Define to 1 if you have the `strtoumax' function. */
-#define HAVE_STRTOUMAX 1
+/* The _Noreturn keyword of C11.  */
+#if ! (defined _Noreturn \
+       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
+# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__))
+#  define _Noreturn __attribute__ ((__noreturn__))
+# elif defined _MSC_VER && 1200 <= _MSC_VER
+#  define _Noreturn __declspec (noreturn)
+# else
+#  define _Noreturn
+# endif
+#endif
 
-/* Define if you have the 'wchar_t' type. */
-#define HAVE_WCHAR_T 1
 
-/* Name of package */
-#define PACKAGE "emacs"
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
 
-/* Version number of package */
-#define VERSION "24.1"
+/* Define to 1 if you need to in order for 'stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Needed for system_process_attributes on Solaris. */
+#undef _STRUCTURED_PROC
+
+/* Define to 500 only on HP-UX. */
+#undef _XOPEN_SOURCE
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable general extensions on Mac OS X.  */
+#ifndef _DARWIN_C_SOURCE
+# undef _DARWIN_C_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define to rpl_ if the getopt replacement functions and variables should be
+   used. */
+#undef __GETOPT_PREFIX
+
+/* Define to compiler's equivalent of C99 restrict keyword in array
+   declarations. Define as empty for no equivalent. */
+#undef __restrict_arr
+
+/* Define to the used os dependent file. */
+#define config_opsysfile "s/ms-w32.h"
+
+/* A replacement for va_copy, if needed.  */
+#define gl_va_copy(a,b) ((a) = (b))
+
+/* Define to rpl_gmtime if the replacement function should be used. */
+#undef gmtime
 
 /* Define to `__inline__' or `__inline' if that's what the C compiler
    calls it, or to nothing if 'inline' is not supported under any name.  */
-#ifdef __GNUC__
 #ifndef __cplusplus
 #undef inline
 #endif
-#else  /* MSVC */
-#define inline __inline
+
+/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports
+   the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of
+   earlier versions), but does not display it by setting __GNUC_STDC_INLINE__.
+   __APPLE__ && __MACH__ test for Mac OS X.
+   __APPLE_CC__ tests for the Apple compiler and its version.
+   __STDC_VERSION__ tests for the C99 mode.  */
+#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__
+# define __GNUC_STDC_INLINE__ 1
 #endif
 
+/* Define to 1 if the compiler is checking for lint. */
+#undef lint
+
+/* Define to rpl_localtime if the replacement function should be used. */
+#undef localtime
+
+/* Define to a type if <wchar.h> does not define. */
+#undef mbstate_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to the name of the strftime replacement function. */
+#define my_strftime nstrftime
+
+/* Define to the type of st_nlink in struct stat, or a supertype. */
+#define nlink_t short
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
 /* Define to the equivalent of the C99 'restrict' keyword, or to
    nothing if this is not supported.  Do not define if restrict is
    supported directly.  */
-#ifdef __GNUC__
-# define restrict __restrict__
-#else
-# define restrict
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
 #endif
 
-/* `mode_t' is not defined for MSVC. Define. */
-#ifdef _MSC_VER
-typedef unsigned short mode_t;
-#endif
+/* type to use in place of socklen_t if not defined */
+#undef socklen_t
 
-/* A va_copy replacement for MSVC.  */
-#ifdef _MSC_VER
-# ifdef _WIN64
-#  ifndef va_copy               /* Need to be checked (?) */
-#   define va_copy(d,s) ((d) = (s))
-#  endif
-# else /* not _WIN64 */
-#  define va_copy(d,s) ((d) = (s))
-# endif         /* not _WIN64 */
-#endif  /* _MSC_VER */
+/* Define as a signed type of the same size as size_t. */
+#undef ssize_t
+
+/* Define to any substitute for sys_siglist. */
+#undef sys_siglist
 
 /* Define as a marker that can be attached to declarations that might not
     be used.  This helps to reduce warnings, such as from
@@ -380,175 +1564,130 @@ typedef unsigned short mode_t;
    is a misnomer outside of parameter lists.  */
 #define _UNUSED_PARAMETER_ _GL_UNUSED
 
-/* End of gnulib-related stuff.  */
-
-#if __GNUC__ >= 3  /* On GCC 3.0 we might get a warning.  */
-#define NO_INLINE __attribute__((noinline))
-#else
-#define NO_INLINE
-#endif
-
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
-#define EXTERNALLY_VISIBLE __attribute__((externally_visible))
-#else
-#define EXTERNALLY_VISIBLE
-#endif
-
-#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
-# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+/* The __pure__ attribute was added in gcc 2.96.  */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
+# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
 #else
-# define ATTRIBUTE_FORMAT(spec) /* empty */
+# define _GL_ATTRIBUTE_PURE /* empty */
 #endif
 
-#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
-# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
+/* The __const__ attribute was added in gcc 2.95.  */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
+# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
 #else
-# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
-   ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
-#endif
-
-#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
-#define HAVE___BUILTIN_UNWIND_INIT 1
+# define _GL_ATTRIBUTE_CONST /* empty */
 #endif
 
-#undef EMACS_CONFIGURATION
-
-#undef EMACS_CONFIG_OPTIONS
 
-/* The configuration script defines opsysfile to be the name of the
-   s/SYSTEM.h file that describes the system type you are using.  The file
-   is chosen based on the configuration name you give.
+/* Define as a macro for copying va_list variables. */
+#undef va_copy
 
-   See the file ../etc/MACHINES for a list of systems and the
-   configuration names to use for them.
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
 
-   See s/template.h for documentation on writing s/SYSTEM.h files.  */
-#undef config_opsysfile
-#include "s/ms-w32.h"
 
-/* The configuration script defines machfile to be the name of the
-   m/MACHINE.h file that describes the machine you are using.  The file is
-   chosen based on the configuration name you give.
+/* Not valid on Windows.  */
+#if 0
+/* On AIX 3 this must be included before any other include file.  */
+#include <alloca.h>
+#if ! HAVE_ALLOCA
+# error "alloca not available on this machine"
+#endif
+#endif
 
-   See the file ../etc/MACHINES for a list of machines and the
-   configuration names to use for them.
+/* This silences a few compilation warnings on FreeBSD.  */
+#ifdef BSD_SYSTEM_AHB
+#undef BSD_SYSTEM_AHB
+#undef BSD_SYSTEM
+#if __FreeBSD__ == 1
+#define BSD_SYSTEM 199103
+#elif __FreeBSD__ == 2
+#define BSD_SYSTEM 199306
+#elif __FreeBSD__ >= 3
+#define BSD_SYSTEM 199506
+#endif
+#endif
 
-   See m/template.h for documentation on writing m/MACHINE.h files.  */
-#undef config_machfile
-#include "m/intel386.h"
+/* Define AMPERSAND_FULL_NAME if you use the convention
+   that & in the full name stands for the login id.  */
+#undef AMPERSAND_FULL_NAME
 
-/* Define `subprocesses' should be defined if you want to
+/* `subprocesses' should be defined if you want to
    have code for asynchronous subprocesses
    (as used in M-x compile and M-x shell).
-   Only MSDOS does not support this.  */
+   Only MSDOS does not support this (it overrides
+   this in its config_opsysfile below).  */
 
 #define subprocesses
 
-/* Define STACK_DIRECTION here, but not if m/foo.h did.  */
-#ifndef STACK_DIRECTION
-#undef STACK_DIRECTION
+/* Include the os dependent file.  */
+#ifdef config_opsysfile
+# include config_opsysfile
+#endif
+
+/* Mac OS X / GNUstep need a bit more pure memory.  Of the existing knobs,
+   SYSTEM_PURESIZE_EXTRA seems like the least likely to cause problems.  */
+#ifdef HAVE_NS
+#if defined NS_IMPL_GNUSTEP
+#  define SYSTEM_PURESIZE_EXTRA 30000
+#elif defined DARWIN_OS
+#  define SYSTEM_PURESIZE_EXTRA 200000
+#endif
 #endif
 
 #ifdef emacs /* Don't do this for lib-src.  */
 /* Tell regex.c to use a type compatible with Emacs.  */
 #define RE_TRANSLATE_TYPE Lisp_Object
 #define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C)
-#define RE_TRANSLATE_P(TBL) (XFASTINT (TBL) != 0)
-#endif
-
-#define my_strftime nstrftime   /* for strftime.c */
-
-/* Define to the type of st_nlink in struct stat, or a supertype. */
-#define nlink_t short
-
-#ifndef WINDOWSNT
-/* Some of the files of Emacs which are intended for use with other
-   programs assume that if you have a config.h file, you must declare
-   the type of getenv.  */
-extern char *getenv ();
-#endif
-
-#endif /* EMACS_CONFIG_H */
-
-/* These default definitions are good for almost all machines.
-   The exceptions override them in m/MACHINE.h.  */
-
-#ifndef BITS_PER_CHAR
-#define BITS_PER_CHAR 8
-#endif
-
-#ifndef BITS_PER_SHORT
-#define BITS_PER_SHORT 16
-#endif
-
-/* Note that lisp.h uses this in a preprocessor conditional, so it
-   would not work to use sizeof.  That being so, we do all of them
-   without sizeof, for uniformity's sake.  */
-#ifndef BITS_PER_INT
-#define BITS_PER_INT 32
+#ifdef make_number
+/* If make_number is a macro, use it.  */
+#define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0)))
+#else
+/* If make_number is a function, avoid it.  */
+#define RE_TRANSLATE_P(TBL) (!(INTEGERP (TBL) && XINT (TBL) == 0))
 #endif
-
-#ifndef BITS_PER_LONG
-#define BITS_PER_LONG 32
 #endif
 
-#if defined (__MINGW32__) || _MSC_VER >= 1400
-
-/* Define to 1 if the system has the type `long long int'. */
-# define HAVE_LONG_LONG_INT 1
-
-/* Define to 1 if the system has the type `unsigned long long int'. */
-# define HAVE_UNSIGNED_LONG_LONG_INT 1
-
-#elif _MSC_VER >= 1200
-
-/* Temporarily disable wider-than-pointer integers until they're tested more.
-   Build with CFLAGS='-DWIDE_EMACS_INT' to try them out.  */
-/* #undef WIDE_EMACS_INT */
-
-# ifdef WIDE_EMACS_INT
-
-/* Use pre-C99-style 64-bit integers.  */
-# define EMACS_INT __int64
-# define BITS_PER_EMACS_INT 64
-# define pI "I64"
-
-# endif
-
-#endif
+#include <string.h>
+#include <stdlib.h>
 
-#ifndef POINTER_TYPE
-#define POINTER_TYPE void
+#if __GNUC__ >= 3  /* On GCC 3.0 we might get a warning.  */
+#define NO_INLINE __attribute__((noinline))
+#else
+#define NO_INLINE
 #endif
 
-#ifndef PROTOTYPES
-#define PROTOTYPES 1
+#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
+#define EXTERNALLY_VISIBLE __attribute__((externally_visible))
+#else
+#define EXTERNALLY_VISIBLE
 #endif
 
-#include "string.h"
-#ifdef HAVE_STRINGS_H
-#include "strings.h"
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
+# define ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec))
+#else
+# define ATTRIBUTE_FORMAT(spec) /* empty */
 #endif
-#include <stdlib.h>
 
-#ifndef NO_RETURN
-#if defined __GNUC__ && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR >= 5))
-#define NO_RETURN      __attribute__ ((__noreturn__))
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
+# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+   ATTRIBUTE_FORMAT ((__gnu_printf__, formatstring_parameter, first_argument))
 #else
-#define NO_RETURN      /* nothing */
-#endif
+# define ATTRIBUTE_FORMAT_PRINTF(formatstring_parameter, first_argument) \
+   ATTRIBUTE_FORMAT ((__printf__, formatstring_parameter, first_argument))
 #endif
 
-/* Redefine abort.  */
-#ifdef HAVE_NTGUI
-#define abort  w32_abort
-void w32_abort (void) NO_RETURN;
+#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST
+
+/* Some versions of GNU/Linux define noinline in their headers.  */
+#ifdef noinline
+#undef noinline
 #endif
 
-/* Prevent accidental use of features unavailable in
-   older Windows versions we still support.  */
-#define _WIN32_WINNT 0x0400
+#endif /* EMACS_CONFIG_H */
 
-/* Make a leaner executable.  */
-#define WIN32_LEAN_AND_MEAN 1
+/*
+Local Variables:
+mode: c
+End:
+*/
index 91c5c3fa0bbf15313a80ebec84c44b823d3e8eec..e91165de473304bc6de0b2e7b6da711f67ad4dd9 100755 (executable)
@@ -131,6 +131,7 @@ if "%1" == "--without-jpeg" goto withoutjpeg
 if "%1" == "--without-gif" goto withoutgif\r
 if "%1" == "--without-tiff" goto withouttiff\r
 if "%1" == "--without-gnutls" goto withoutgnutls\r
+if "%1" == "--without-libxml2" goto withoutlibxml2\r
 if "%1" == "--without-xpm" goto withoutxpm\r
 if "%1" == "--with-svg" goto withsvg\r
 if "%1" == "--distfiles" goto distfiles\r
@@ -144,7 +145,7 @@ echo.   --with-gcc              use GCC to compile Emacs
 echo.   --with-msvc             use MSVC to compile Emacs\r
 echo.   --no-debug              exclude debug info from executables\r
 echo.   --no-opt                disable optimization\r
-echo.   --enable-checking       enable checks and assertions\r
+echo.   --enable-checking       enable additional run-time checks\r
 echo.   --profile               enable profiling\r
 echo.   --no-cygwin             use -mno-cygwin option with GCC\r
 echo.   --cflags FLAG           pass FLAG to compiler\r
@@ -156,6 +157,7 @@ echo.   --without-gif           do not use GIF library even if it is installed
 echo.   --without-tiff          do not use TIFF library even if it is installed\r
 echo.   --without-xpm           do not use XPM library even if it is installed\r
 echo.   --without-gnutls        do not use GnuTLS library even if it is installed\r
+echo.   --without-libxml2       do not use libxml2 library even if it is installed\r
 echo.   --with-svg              use the RSVG library (experimental)\r
 echo.   --distfiles             path to files for make dist, e.g. libXpm.dll\r
 if "%use_extensions%" == "0" goto end\r
@@ -317,6 +319,14 @@ goto again
 \r
 rem ----------------------------------------------------------------------\r
 \r
+:withoutlibxml2\r
+set libxml2support=N\r
+set HAVE_LIBXML2=\r
+shift\r
+goto again\r
+\r
+rem ----------------------------------------------------------------------\r
+\r
 :withouttiff\r
 set tiffsupport=N\r
 set HAVE_TIFF=\r
@@ -569,6 +579,28 @@ set HAVE_GNUTLS=1
 :tlsDone\r
 rm -f junk.c junk.obj\r
 \r
+if (%libxml2support%) == (N) goto xml2Done\r
+\r
+echo Checking for libxml2....\r
+echo #include "libxml/HTMLparser.h" >junk.c\r
+echo main(){} >>junk.c\r
+echo %COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >>config.log\r
+%COMPILER% %usercflags% %mingwflag% -c junk.c -o junk.obj >junk.out 2>>config.log\r
+if exist junk.obj goto havelibxml2\r
+\r
+echo ...libxml/HTMLparser.h not found, building without libxml2 support\r
+echo The failed program was: >>config.log\r
+type junk.c >>config.log\r
+set HAVE_LIBXML2=\r
+goto xml2Done\r
+\r
+:havelibxml2\r
+echo ...libxml2 header available, building with libxml2 support\r
+set HAVE_LIBXML2=1\r
+\r
+:xml2Done\r
+rm -f junk.c junk.obj\r
+\r
 if (%jpegsupport%) == (N) goto jpegDone\r
 \r
 echo Checking for jpeg-6b...\r
@@ -737,7 +769,6 @@ if not "(%mf%)" == "()" >>config.settings echo MCPU_FLAG=%mf%
 if not "(%dbginfo%)" == "()" >>config.settings echo DEBUG_INFO=%dbginfo%\r
 if (%nodebug%) == (Y) >>config.settings echo NODEBUG=1\r
 if (%noopt%) == (Y) >>config.settings echo NOOPT=1\r
-if (%enablechecking%) == (Y) >>config.settings echo ENABLECHECKS=1\r
 if (%profile%) == (Y) >>config.settings echo PROFILE=1\r
 if (%nocygwin%) == (Y) >>config.settings echo NOCYGWIN=1\r
 if not "(%prefix%)" == "()" >>config.settings echo INSTALL_DIR=%prefix%\r
@@ -762,8 +793,10 @@ rem   processing of compiler options in w32.c:get_emacs_configuration_options
 if (%docflags%) == (Y) echo #define USER_CFLAGS " %escusercflags%" >>config.tmp\r
 if (%doldflags%) == (Y) echo #define USER_LDFLAGS " %escuserldflags%" >>config.tmp\r
 if (%profile%) == (Y) echo #define PROFILING 1 >>config.tmp\r
+if (%enablechecking%) == (Y) echo #define ENABLE_CHECKING 1 >>config.tmp\r
 if not "(%HAVE_PNG%)" == "()" echo #define HAVE_PNG 1 >>config.tmp\r
 if not "(%HAVE_GNUTLS%)" == "()" echo #define HAVE_GNUTLS 1 >>config.tmp\r
+if not "(%HAVE_LIBXML2%)" == "()" echo #define HAVE_LIBXML2 1 >>config.tmp\r
 if not "(%HAVE_JPEG%)" == "()" echo #define HAVE_JPEG 1 >>config.tmp\r
 if not "(%HAVE_GIF%)" == "()" echo #define HAVE_GIF 1 >>config.tmp\r
 if not "(%HAVE_TIFF%)" == "()" echo #define HAVE_TIFF 1 >>config.tmp\r
@@ -903,6 +936,7 @@ set HAVE_DISTFILES=
 set distFilesOk=\r
 set pngsupport=\r
 set tlssupport=\r
+set libxml2support=\r
 set jpegsupport=\r
 set gifsupport=\r
 set tiffsupport=\r
index e9d472de79f1a6e8c536c8d680a452fc24ab625a..7a6b00ef2a8f8c2195db1a9104b2d11f7a99ea55 100644 (file)
@@ -7,8 +7,8 @@ Emacs ICON   icons\emacs.ico
 #endif
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 24,1,0,0
- PRODUCTVERSION 24,1,0,0
+ FILEVERSION 24,1,50,0
+ PRODUCTVERSION 24,1,50,0
  FILEFLAGSMASK 0x3FL
 #ifdef EMACSDEBUG
  FILEFLAGS 0x1L
@@ -25,12 +25,12 @@ BEGIN
        BEGIN
            VALUE "CompanyName", "Free Software Foundation\0"
            VALUE "FileDescription", "GNU Emacs: The extensible self-documenting text editor\0"
-           VALUE "FileVersion", "24, 1, 0, 0\0"
+           VALUE "FileVersion", "24, 1, 50, 0\0"
            VALUE "InternalName", "Emacs\0"
            VALUE "LegalCopyright", "Copyright (C) 2001-2012\0"
            VALUE "OriginalFilename", "emacs.exe"
            VALUE "ProductName", "Emacs\0"
-           VALUE "ProductVersion", "24, 1, 0, 0\0"
+           VALUE "ProductVersion", "24, 1, 50, 0\0"
            VALUE "OLESelfRegister", "\0"
         END
      END
index 0af025c6c0fa5a9f54a14be59075797a76946cb6..d99b2fcd8faf36c1d7204c6dc1654956f9c64ad0 100644 (file)
@@ -5,8 +5,8 @@ Emacs ICON   icons\emacs.ico
 #endif
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 24,1,0,0
- PRODUCTVERSION 24,1,0,0
+ FILEVERSION 24,1,50,0
+ PRODUCTVERSION 24,1,50,0
  FILEFLAGSMASK 0x3FL
 #ifdef EMACSDEBUG
  FILEFLAGS 0x1L
@@ -23,12 +23,12 @@ BEGIN
        BEGIN
            VALUE "CompanyName", "Free Software Foundation\0"
            VALUE "FileDescription", "GNU EmacsClient: Client for the extensible self-documenting text editor\0"
-           VALUE "FileVersion", "24, 1, 0, 0\0"
+           VALUE "FileVersion", "24, 1, 50, 0\0"
            VALUE "InternalName", "EmacsClient\0"
            VALUE "LegalCopyright", "Copyright (C) 2001-2012\0"
            VALUE "OriginalFilename", "emacsclientw.exe"
            VALUE "ProductName", "EmacsClient\0"
-           VALUE "ProductVersion", "24, 1, 0, 0\0"
+           VALUE "ProductVersion", "24, 1, 50, 0\0"
            VALUE "OLESelfRegister", "\0"
         END
      END
index dd96b776363210b69eb5fcf4a2eb5bfb3d16ee45..0b29c73e741c37155be97db4abfcf3b3e3a9941a 100644 (file)
@@ -199,21 +199,15 @@ OBJ1_c            = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
 OBJ2_c         = $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2))
 
 ifdef NOOPT
-DEBUG_CFLAGS   = -DEMACSDEBUG
+DEBUG_CFLAGS   = -DEMACSDEBUG -fno-crossjumping
 else
 DEBUG_CFLAGS   =
 endif
 
-ifdef ENABLECHECKS
-CHECKING_CFLAGS        = -DENABLE_CHECKING -DXASSERTS -fno-crossjumping
-else
-CHECKING_CFLAGS        =
-endif
-
 MWINDOWS        = -mwindows
 
-CFLAGS          = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
-ESC_CFLAGS      = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(PROFILE_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
+CFLAGS          = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)
+ESC_CFLAGS      = -I. $(ARCH_CFLAGS) $(DEBUG_CFLAGS) $(PROFILE_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)
 EMACS_EXTRA_C_FLAGS = -DUSE_CRT_DLL=1
 
 ifdef PROFILE
diff --git a/nt/inc/stdalign.h b/nt/inc/stdalign.h
new file mode 100644 (file)
index 0000000..2ff7a43
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef _NT_STDALIGN_H_
+#define _NT_STDALIGN_H_
+
+/* This header has the necessary stuff from lib/stdalign.in.h, but
+   avoids the need to have Sed at build time.  */
+
+#include <stddef.h>
+#if defined __cplusplus
+   template <class __t> struct __alignof_helper { char __a; __t __b; };
+# define _Alignof(type) offsetof (__alignof_helper<type>, __b)
+#else
+# define _Alignof(type) offsetof (struct { char __a; type __b; }, __b)
+#endif
+#define alignof _Alignof
+
+#endif /* _NT_STDALIGN_H_ */
index c90d1fd62f542fe98e26b8a93f25f3ef93936a07..db54c90cf1f3bf7f5cc73adbe2e37dd02bbaa110 100644 (file)
@@ -6,15 +6,16 @@
  */
 
 struct timeval
-  {
-    long tv_sec;       /* seconds */
-    long tv_usec;      /* microseconds */
-  };
+{
+  long         tv_sec;         /* seconds */
+  long         tv_usec;        /* microseconds */
+};
+
 struct timezone
-  {
-    int        tz_minuteswest; /* minutes west of Greenwich */
-    int        tz_dsttime;     /* type of dst correction */
-  };
+{
+  int          tz_minuteswest; /* minutes west of Greenwich */
+  int          tz_dsttime;     /* type of dst correction */
+};
 
 void gettimeofday (struct timeval *, struct timezone *);
 
index cb151785888298f6fed1147f98d1404c051a13a2..274ce7e527199c6696b203a394af9ad5204a2e20 100644 (file)
-# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.\r
-# Copyright (C) 2000-2012 Free Software Foundation, Inc.\r
-#\r
-# Top level makefile for building GNU Emacs on Windows NT\r
-#\r
-# This file is part of GNU Emacs.\r
-\r
-# GNU Emacs is free software: you can redistribute it and/or modify\r
-# it under the terms of the GNU General Public License as published by\r
-# the Free Software Foundation, either version 3 of the License, or\r
-# (at your option) any later version.\r
-\r
-# GNU Emacs is distributed in the hope that it will be useful,\r
-# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-# GNU General Public License for more details.\r
-\r
-# You should have received a copy of the GNU General Public License\r
-# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.\r
-\r
-\r
-# FIXME: This file uses DOS EOLs.  Convert to Unix after 22.1 is out\r
-#        (and remove or replace this comment).\r
-\r
-VERSION                = 24.1\r
-\r
-TMP_DIST_DIR   = emacs-$(VERSION)\r
-\r
-TRES           = $(BLD)/emacs.res\r
-CLIENTRES      = $(BLD)/emacsclient.res\r
-\r
-XMFLAGS                =\r
-\r
-ALL            = addpm ddeclient runemacs cmdproxy addsection preprep\r
-\r
-.PHONY: $(ALL)\r
-\r
-\r
-addpm:           stamp_BLD $(BLD)/addpm.exe\r
-$(BLD)/addpm.exe: $(BLD)/addpm.$(O)\r
-                 $(LINK) $(LINK_OUT)$@ \\r
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \\r
-                 $(USER32) $(OLE32) $(UUID) $(SHELL32)\r
-\r
-ddeclient:       stamp_BLD $(BLD)/ddeclient.exe\r
-$(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)\r
-                 $(LINK) $(LINK_OUT)$@ \\r
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
-\r
-cmdproxy:        stamp_BLD $(BLD)/cmdproxy.exe\r
-$(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)\r
-                 $(LINK) $(LINK_OUT)$@ \\r
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)\r
-\r
-addsection:      stamp_BLD $(BLD)/addsection.exe\r
-$(BLD)/addsection.exe: $(BLD)/addsection.$(O)\r
-                 $(LINK) $(LINK_OUT)$@ \\r
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)\r
-\r
-preprep:         stamp_BLD $(BLD)/preprep.exe\r
-$(BLD)/preprep.exe: $(BLD)/preprep.$(O)\r
-                 $(LINK) $(LINK_OUT)$@ \\r
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)\r
-\r
-#\r
-# The resource file.  NT 3.10 requires the use of cvtres; even though\r
-# it is not necessary on later versions, it is still ok to use it.\r
-#\r
-$(TRES):       emacs.rc icons/emacs.ico emacs.manifest stamp_BLD\r
-               $(RC) $(RC_OUT)$(TRES) emacs.rc\r
-\r
-$(CLIENTRES):  emacsclient.rc stamp_BLD\r
-               $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc\r
-\r
-runemacs:        stamp_BLD $(BLD)/runemacs.exe\r
-$(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)\r
-                 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \\r
-                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)\r
-\r
-which-sh:\r
-       @echo Using $(THE_SHELL) as shell.\r
-\r
-# These depend on stamp_BLD to make sure the $(BLD) directory is created\r
-# before the compilation begins, even if Make runs several commands\r
-# in parallel under "make -j".\r
-#\r
-$(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD\r
-\r
-#\r
-# Build emacs\r
-#\r
-all:   which-sh stamp_BLD $(ALL) $(CLIENTRES) maybe-bootstrap all-other-dirs-$(MAKETYPE)\r
-\r
-all-other-dirs-nmake: addsection\r
-       cd ..\lib\r
-       $(MAKE) $(MFLAGS) all\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) all\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) all\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) all\r
-       cd ..\leim\r
-       $(MAKE) $(MFLAGS) all\r
-       cd ..\nt\r
-\r
-all-other-dirs-gmake: addsection\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all\r
-\r
-recompile:     recompile-$(MAKETYPE)\r
-\r
-recompile-nmake:\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) recompile\r
-       cd ..\nt\r
-\r
-recompile-gmake:\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile\r
-\r
-#### Bootstrapping.\r
-\r
-### This is meant for Emacs maintainers only.  It first cleans the\r
-### lisp subdirectory, removing all compiled Lisp files.  Then a\r
-### special emacs executable is built from Lisp sources, which is then\r
-### used to compile Lisp files.  The last step is a "normal" make.\r
-\r
-maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)\r
-\r
-# dummy target to force other targets to be evaluated.\r
-doit:\r
-\r
-maybe-bootstrap-CMD:   doit\r
-       @echo .\r
-       @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing.  You should either\r
-       @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow\r
-       @echo .\r
-       @if not EXIST ..\lisp\abbrev.elc exit -1\r
-\r
-maybe-bootstrap-SH: doit\r
-       @if [ ! -f ../lisp/abbrev.elc ] ; then \\r
-         echo; \\r
-         echo "Essential Lisp files seem to be missing.  You should either"; \\r
-         echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow.";  \\r
-         echo; \\r
-         exit -1; \\r
-       fi\r
-\r
-# Bootstrap depends on cmdproxy because some Lisp functions\r
-# loaded during bootstrap may need to run shell commands.\r
-bootstrap:     addsection cmdproxy bootstrap-$(MAKETYPE)\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) all\r
-\r
-bootstrap-nmake: addsection cmdproxy\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) bootstrap-clean\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) clean make-docfile\r
-       cd ..\lib\r
-       $(MAKE) $(MFLAGS) clean all\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) bootstrap\r
-       $(MAKE) $(MFLAGS) bootstrap-clean\r
-       cd ..\nt\r
-       $(CP) $(BLD)/cmdproxy.exe ../bin\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) DOC\r
-       cd ..\nt\r
-\r
-bootstrap-gmake: addsection cmdproxy\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean make-docfile\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean all\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
-       $(CP) $(BLD)/cmdproxy.exe ../bin\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC\r
-\r
-bootstrap-clean: bootstrap-clean-$(MAKETYPE)\r
-\r
-bootstrap-clean-nmake:\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) bootstrap-clean\r
-       cd ..\lib\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) bootstrap-clean\r
-\r
-bootstrap-clean-gmake:\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean\r
-\r
-$(INSTALL_DIR):\r
-       - mkdir "$(INSTALL_DIR)"\r
-\r
-$(INSTALL_DIR)/bin: $(INSTALL_DIR)\r
-       - mkdir "$(INSTALL_DIR)/bin"\r
-\r
-#\r
-# Build and install emacs in INSTALL_DIR\r
-#\r
-.PHONY: install-bin install-shortcuts\r
-\r
-install: install-bin install-shortcuts\r
-\r
-install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)\r
-       - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin\r
-       - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin\r
-       - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin\r
-       - $(CP) README.W32 $(INSTALL_DIR)\r
-       - $(DEL) ../$(DIRNAME)_same-dir.tst\r
-       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst\r
-       echo SameDirTest > "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"\r
-       - mkdir "$(INSTALL_DIR)/etc"\r
-       - mkdir "$(INSTALL_DIR)/info"\r
-       - mkdir "$(INSTALL_DIR)/lock"\r
-       - mkdir "$(INSTALL_DIR)/data"\r
-       - mkdir "$(INSTALL_DIR)/site-lisp"\r
-       - mkdir "$(INSTALL_DIR)/etc/icons"\r
-       $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)\r
-       $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)\r
-       - $(CP_DIR) icons $(INSTALL_DIR)/etc\r
-       $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)\r
-       $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)\r
-       - $(CP) ../COPYING $(INSTALL_DIR)/bin\r
-       - $(DEL) ../$(DIRNAME)_same-dir.tst\r
-       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst\r
-\r
-install-other-dirs-nmake: all\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) install\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) install\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) install\r
-       cd ..\leim\r
-       $(MAKE) $(MFLAGS) install\r
-       cd ..\nt\r
-\r
-install-other-dirs-gmake: all\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install\r
-\r
-install-shortcuts: $(INSTALL_DIR)/bin\r
-       - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin\r
-       "$(INSTALL_DIR)/bin/addpm" -q\r
-\r
-maybe-copy-distfiles: maybe-copy-distfiles-$(SHELLTYPE)\r
-\r
-maybe-copy-distfiles-CMD: create-tmp-dist-dir doit\r
-       @if not $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin\r
-\r
-maybe-copy-distfiles-SH: create-tmp-dist-dir doit\r
-       @if [ ! $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" ] ; then \\r
-         $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin ; \\r
-       fi\r
-\r
-create-tmp-dist-dir:\r
-       mkdir "$(TMP_DIST_DIR)"\r
-# Also create bin directory for dist files.\r
-       mkdir "$(TMP_DIST_DIR)/bin"\r
-\r
-dist: install-bin maybe-copy-distfiles\r
-       $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)\r
-       $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)\r
-       $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)\r
-       $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)\r
-       $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)\r
-       $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)\r
-       $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)\r
-       $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)\r
-       $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)\r
-       $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)\r
-       $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)\r
-       $(DEL_TREE) $(TMP_DIST_DIR)\r
-\r
-force-info:\r
-# Note that doc/emacs/makefile knows how to\r
-# put the info files in $(infodir),\r
-# so we can do ok running make in the build dir.\r
-info: force-info info-$(MAKETYPE)\r
-\r
-info-nmake:\r
-       cd ..\doc\emacs\r
-       $(MAKE) $(MFLAGS) info\r
-       cd ..\misc\r
-       $(MAKE) $(MFLAGS) info\r
-       cd ..\lispref\r
-       $(MAKE) $(MFLAGS) info\r
-       cd ..\lispintro\r
-       $(MAKE) $(MFLAGS) info\r
-       cd $(MAKEDIR)\r
-\r
-info-gmake:\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs info\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc info\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref info\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro info\r
-#\r
-# Maintenance\r
-#\r
-clean: clean-other-dirs-$(MAKETYPE)\r
-       - $(DEL) $(COMPILER_TEMP_FILES)\r
-       - $(DEL_TREE) $(OBJDIR)\r
-       - $(DEL) stamp_BLD\r
-       - $(DEL) ../etc/DOC ../etc/DOC-X\r
-\r
-clean-other-dirs-nmake:\r
-       cd ..\lib\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\doc\lispintro\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\lispref\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\..\leim\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\doc\emacs\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\misc\r
-       $(MAKE) $(MFLAGS) clean\r
-       cd ..\..\nt\r
-\r
-clean-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean\r
-\r
-cleanall-other-dirs-nmake:\r
-       cd ..\lib\r
-       $(MAKE) $(MFLAGS) cleanall\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) cleanall\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) cleanall\r
-       cd ..\nt\r
-\r
-cleanall-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib cleanall\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall\r
-\r
-# We used to delete *~ here, but that might inadvertently remove\r
-# precious files if it happens to match their short 8+3 aliases.\r
-cleanall: clean cleanall-other-dirs-$(MAKETYPE)\r
-        - $(DEL_TREE) obj\r
-        - $(DEL_TREE) obj-spd\r
-        - $(DEL_TREE) oo\r
-        - $(DEL_TREE) oo-spd\r
-\r
-top-distclean:\r
-       - $(DEL) $(COMPILER_TEMP_FILES)\r
-       - $(DEL_TREE) obj\r
-       - $(DEL_TREE) obj-spd\r
-       - $(DEL_TREE) oo\r
-       - $(DEL_TREE) oo-spd\r
-       - $(DEL) stamp_BLD\r
-       - $(DEL) ../etc/DOC ../etc/DOC-X\r
-       - $(DEL) config.log Makefile\r
-       - $(DEL) ../README.W32\r
-\r
-distclean: distclean-other-dirs-$(MAKETYPE) top-distclean\r
-\r
-distclean-other-dirs-nmake:\r
-       cd ..\lib\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\leim\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\doc\emacs\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\misc\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\lispintro\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\lispref\r
-       $(MAKE) $(MFLAGS) distclean\r
-       cd ..\..\nt\r
-\r
-distclean-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean\r
-\r
-maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean\r
-\r
-maintainer-clean-other-dirs-nmake:\r
-       cd ..\lib\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\lib-src\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\src\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\lisp\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\leim\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\doc\emacs\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\misc\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\lispintro\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\lispref\r
-       $(MAKE) $(MFLAGS) maintainer-clean\r
-       cd ..\..\nt\r
-\r
-maintainer-clean-other-dirs-gmake:\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean\r
-       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean\r
-\r
-realclean: cleanall\r
-       - $(DEL_TREE) ../bin\r
-\r
-TAGS: TAGS-$(MAKETYPE)\r
-\r
-frc:\r
-TAGS-gmake: frc\r
-       ../lib-src/$(BLD)/etags $(CURDIR)/*.c\r
-       $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP\r
-       $(MAKE) $(MFLAGS) -C ../lib-src TAGS\r
-       $(MAKE) $(MFLAGS) -C ../lib TAGS\r
-\r
-TAGS-nmake:\r
-       echo This target is not supported with NMake\r
-\r
-.PHONY: frc\r
+# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
+# Copyright (C) 2000-2012 Free Software Foundation, Inc.
+#
+# Top level makefile for building GNU Emacs on Windows NT
+#
+# This file is part of GNU Emacs.
+
+# GNU Emacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# FIXME: This file uses DOS EOLs.  Convert to Unix after 22.1 is out
+#        (and remove or replace this comment).
+
+VERSION                = 24.1.50
+
+TMP_DIST_DIR   = emacs-$(VERSION)
+
+TRES           = $(BLD)/emacs.res
+CLIENTRES      = $(BLD)/emacsclient.res
+
+XMFLAGS                =
+
+ALL            = addpm ddeclient runemacs cmdproxy addsection preprep
+
+.PHONY: $(ALL)
+
+
+addpm:           stamp_BLD $(BLD)/addpm.exe
+$(BLD)/addpm.exe: $(BLD)/addpm.$(O)
+                 $(LINK) $(LINK_OUT)$@ \
+                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) \
+                 $(USER32) $(OLE32) $(UUID) $(SHELL32)
+
+ddeclient:       stamp_BLD $(BLD)/ddeclient.exe
+$(BLD)/ddeclient.exe: $(BLD)/ddeclient.$(O)
+                 $(LINK) $(LINK_OUT)$@ \
+                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
+
+cmdproxy:        stamp_BLD $(BLD)/cmdproxy.exe
+$(BLD)/cmdproxy.exe: $(BLD)/cmdproxy.$(O)
+                 $(LINK) $(LINK_OUT)$@ \
+                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
+
+addsection:      stamp_BLD $(BLD)/addsection.exe
+$(BLD)/addsection.exe: $(BLD)/addsection.$(O)
+                 $(LINK) $(LINK_OUT)$@ \
+                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(USER32)
+
+preprep:         stamp_BLD $(BLD)/preprep.exe
+$(BLD)/preprep.exe: $(BLD)/preprep.$(O)
+                 $(LINK) $(LINK_OUT)$@ \
+                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS)
+
+#
+# The resource file.  NT 3.10 requires the use of cvtres; even though
+# it is not necessary on later versions, it is still ok to use it.
+#
+$(TRES):       emacs.rc icons/emacs.ico emacs.manifest stamp_BLD
+               $(RC) $(RC_OUT)$(TRES) emacs.rc
+
+$(CLIENTRES):  emacsclient.rc stamp_BLD
+               $(RC) $(RC_OUT)$(CLIENTRES) emacsclient.rc
+
+runemacs:        stamp_BLD $(BLD)/runemacs.exe
+$(BLD)/runemacs.exe: $(BLD)/runemacs.$(O) $(TRES)
+                 $(LINK) $(LINK_OUT)$@ $(SUBSYSTEM_WINDOWS) \
+                 $(LINK_FLAGS) $(ALL_DEPS) $(BASE_LIBS) $(ADVAPI32) $(USER32)
+
+which-sh:
+       @echo Using $(THE_SHELL) as shell.
+
+# These depend on stamp_BLD to make sure the $(BLD) directory is created
+# before the compilation begins, even if Make runs several commands
+# in parallel under "make -j".
+#
+$(BLD)/addpm.$(O) $(BLD)/ddeclient.$(O) $(BLD)/runemacs.$(O) $(BLD)/cmdproxy.$(O) $(BLD)/addsection.$(O) $(BLD)/preprep.$(O): stamp_BLD
+
+#
+# Build emacs
+#
+all:   which-sh $(ALL) $(CLIENTRES) all-other-dirs-$(MAKETYPE)
+
+all-other-dirs-$(MAKETYPE): maybe-bootstrap
+
+all-other-dirs-nmake: addsection
+       cd ..\lib
+       $(MAKE) $(MFLAGS) all
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) all
+       cd ..\src
+       $(MAKE) $(MFLAGS) all
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) all
+       cd ..\leim
+       $(MAKE) $(MFLAGS) all
+       cd ..\nt
+
+all-other-dirs-gmake: addsection
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src all
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src all
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp all
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim all
+
+recompile:     recompile-$(MAKETYPE)
+
+recompile-nmake:
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) recompile
+       cd ..\nt
+
+recompile-gmake:
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp recompile
+
+#### Bootstrapping.
+
+### This is meant for Emacs maintainers only.  It first cleans the
+### lisp subdirectory, removing all compiled Lisp files.  Then a
+### special emacs executable is built from Lisp sources, which is then
+### used to compile Lisp files.  The last step is a "normal" make.
+
+maybe-bootstrap: maybe-bootstrap-$(SHELLTYPE)
+
+# dummy target to force other targets to be evaluated.
+doit:
+
+maybe-bootstrap-CMD:   doit
+       @echo .
+       @if not EXIST ..\lisp\abbrev.elc echo Essential Lisp files seem to be missing.  You should either
+       @if not EXIST ..\lisp\abbrev.elc echo do 'make bootstrap' or create 'lisp/abbrev.elc' somehow
+       @echo .
+       @if not EXIST ..\lisp\abbrev.elc exit -1
+
+maybe-bootstrap-SH: doit
+       @if [ ! -f ../lisp/abbrev.elc ] ; then \
+         echo; \
+         echo "Essential Lisp files seem to be missing.  You should either"; \
+         echo "do \`make bootstrap' or create \`lisp/abbrev.elc' somehow.";  \
+         echo; \
+         exit -1; \
+       fi
+
+# Bootstrap depends on cmdproxy because some Lisp functions
+# loaded during bootstrap may need to run shell commands.
+bootstrap:     addsection cmdproxy bootstrap-$(MAKETYPE)
+       $(MAKE) $(MFLAGS) $(XMFLAGS) all
+
+bootstrap-nmake: addsection cmdproxy
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) bootstrap-clean
+       cd ..\src
+       $(MAKE) $(MFLAGS) clean
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) clean make-docfile
+       cd ..\lib
+       $(MAKE) $(MFLAGS) clean all
+       cd ..\src
+       $(MAKE) $(MFLAGS) bootstrap
+       $(MAKE) $(MFLAGS) bootstrap-clean
+       cd ..\nt
+       $(CP) $(BLD)/cmdproxy.exe ../bin
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) SHELL=$(SHELLTYPE) bootstrap
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) DOC
+       cd ..\nt
+
+bootstrap-gmake: addsection cmdproxy
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src make-docfile
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib all
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
+       $(CP) $(BLD)/cmdproxy.exe ../bin
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src DOC
+
+bootstrap-clean: bootstrap-clean-$(MAKETYPE)
+
+bootstrap-clean-nmake:
+       cd ..\src
+       $(MAKE) $(MFLAGS) bootstrap-clean
+       cd ..\lib
+       $(MAKE) $(MFLAGS) clean
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) bootstrap-clean
+
+bootstrap-clean-gmake:
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src bootstrap-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp bootstrap-clean
+
+$(INSTALL_DIR):
+       - mkdir "$(INSTALL_DIR)"
+
+$(INSTALL_DIR)/bin: $(INSTALL_DIR)
+       - mkdir "$(INSTALL_DIR)/bin"
+
+#
+# Build and install emacs in INSTALL_DIR
+#
+.PHONY: install-bin install-shortcuts
+
+install: install-bin install-shortcuts
+
+install-bin: all $(INSTALL_DIR)/bin install-other-dirs-$(MAKETYPE)
+       - $(CP) $(BLD)/ddeclient.exe $(INSTALL_DIR)/bin
+       - $(CP) $(BLD)/cmdproxy.exe $(INSTALL_DIR)/bin
+       - $(CP) $(BLD)/runemacs.exe $(INSTALL_DIR)/bin
+       - $(CP) README.W32 $(INSTALL_DIR)
+       - $(DEL) ../$(DIRNAME)_same-dir.tst
+       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
+       echo SameDirTest > "$(INSTALL_DIR)/$(DIRNAME)_same-dir.tst"
+       - mkdir "$(INSTALL_DIR)/etc"
+       - mkdir "$(INSTALL_DIR)/info"
+       - mkdir "$(INSTALL_DIR)/lock"
+       - mkdir "$(INSTALL_DIR)/data"
+       - mkdir "$(INSTALL_DIR)/site-lisp"
+       - mkdir "$(INSTALL_DIR)/etc/icons"
+       $(IFNOTSAMEDIR) $(CP) ../site-lisp/subdirs.el $(INSTALL_DIR)/site-lisp $(ENDIF)
+       $(IFNOTSAMEDIR) $(CP_DIR) ../etc $(INSTALL_DIR) $(ENDIF)
+       - $(CP_DIR) icons $(INSTALL_DIR)/etc
+       $(IFNOTSAMEDIR) $(CP_DIR) ../info $(INSTALL_DIR) $(ENDIF)
+       $(IFNOTSAMEDIR) $(CP) ../COPYING $(INSTALL_DIR) $(ENDIF)
+       - $(CP) ../COPYING $(INSTALL_DIR)/bin
+       - $(DEL) ../$(DIRNAME)_same-dir.tst
+       - $(DEL) $(INSTALL_DIR)/$(DIRNAME)_same-dir.tst
+
+install-other-dirs-nmake: all
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) install
+       cd ..\src
+       $(MAKE) $(MFLAGS) install
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) install
+       cd ..\leim
+       $(MAKE) $(MFLAGS) install
+       cd ..\nt
+
+install-other-dirs-gmake: all
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src install
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src install
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp install
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim install
+
+install-addpm: $(INSTALL_DIR)/bin addpm
+       - $(CP) $(BLD)/addpm.exe $(INSTALL_DIR)/bin
+
+install-shortcuts: install-addpm
+       "$(INSTALL_DIR)/bin/addpm" -q
+
+maybe-copy-distfiles: maybe-copy-distfiles-$(SHELLTYPE)
+
+maybe-copy-distfiles-CMD: create-tmp-dist-dir doit
+       @if not $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin
+
+maybe-copy-distfiles-SH: create-tmp-dist-dir doit
+       @if [ ! $(ARGQUOTE)$(DIST_FILES)$(ARGQUOTE) == "" ] ; then \
+         $(CP_DIR) $(DIST_FILES) $(TMP_DIST_DIR)/bin ; \
+       fi
+
+create-tmp-dist-dir:
+       mkdir "$(TMP_DIST_DIR)"
+# Also create bin directory for dist files.
+       mkdir "$(TMP_DIST_DIR)/bin"
+
+dist: install-bin install-addpm maybe-copy-distfiles
+       $(CP) "$(INSTALL_DIR)/BUGS" $(TMP_DIST_DIR)
+       $(CP) "$(INSTALL_DIR)/COPYING" $(TMP_DIST_DIR)
+       $(CP) "$(INSTALL_DIR)/README" $(TMP_DIST_DIR)
+       $(CP) "$(INSTALL_DIR)/README.W32" $(TMP_DIST_DIR)
+       $(CP_DIR) "$(INSTALL_DIR)/bin" $(TMP_DIST_DIR)
+       $(CP_DIR) "$(INSTALL_DIR)/etc" $(TMP_DIST_DIR)
+       $(CP_DIR) "$(INSTALL_DIR)/info" $(TMP_DIST_DIR)
+       $(CP_DIR) "$(INSTALL_DIR)/lisp" $(TMP_DIST_DIR)
+       $(CP_DIR) "$(INSTALL_DIR)/leim" $(TMP_DIST_DIR)
+       $(CP_DIR) "$(INSTALL_DIR)/site-lisp" $(TMP_DIST_DIR)
+       $(COMSPEC)$(ComSpec) /c $(ARGQUOTE)zipdist.bat $(VERSION)$(ARGQUOTE)
+       $(DEL_TREE) $(TMP_DIST_DIR)
+
+force-info:
+# Note that doc/emacs/makefile knows how to
+# put the info files in $(infodir),
+# so we can do ok running make in the build dir.
+info: force-info info-$(MAKETYPE)
+
+info-nmake:
+       cd ..\doc\emacs
+       $(MAKE) $(MFLAGS) info
+       cd ..\misc
+       $(MAKE) $(MFLAGS) info
+       cd ..\lispref
+       $(MAKE) $(MFLAGS) info
+       cd ..\lispintro
+       $(MAKE) $(MFLAGS) info
+       cd $(MAKEDIR)
+
+info-gmake: emacs misc lispref lispintro
+
+emacs misc lispref lispintro:
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/$@ info
+
+#
+# Maintenance
+#
+clean: clean-other-dirs-$(MAKETYPE)
+       - $(DEL) $(COMPILER_TEMP_FILES)
+       - $(DEL_TREE) $(OBJDIR)
+       - $(DEL) stamp_BLD
+       - $(DEL) ../etc/DOC ../etc/DOC-X
+
+clean-other-dirs-nmake:
+       cd ..\lib
+       $(MAKE) $(MFLAGS) clean
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) clean
+       cd ..\src
+       $(MAKE) $(MFLAGS) clean
+       cd ..\doc\lispintro
+       $(MAKE) $(MFLAGS) clean
+       cd ..\lispref
+       $(MAKE) $(MFLAGS) clean
+       cd ..\..\leim
+       $(MAKE) $(MFLAGS) clean
+       cd ..\doc\emacs
+       $(MAKE) $(MFLAGS) clean
+       cd ..\misc
+       $(MAKE) $(MFLAGS) clean
+       cd ..\..\nt
+
+clean-other-dirs-gmake:
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref clean
+
+cleanall-other-dirs-nmake:
+       cd ..\lib
+       $(MAKE) $(MFLAGS) cleanall
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) cleanall
+       cd ..\src
+       $(MAKE) $(MFLAGS) cleanall
+       cd ..\nt
+
+cleanall-other-dirs-gmake:
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib cleanall
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src cleanall
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src cleanall
+
+# We used to delete *~ here, but that might inadvertently remove
+# precious files if it happens to match their short 8+3 aliases.
+cleanall: clean cleanall-other-dirs-$(MAKETYPE)
+        - $(DEL_TREE) obj
+        - $(DEL_TREE) obj-spd
+        - $(DEL_TREE) oo
+        - $(DEL_TREE) oo-spd
+
+top-distclean:
+       - $(DEL) $(COMPILER_TEMP_FILES)
+       - $(DEL_TREE) obj
+       - $(DEL_TREE) obj-spd
+       - $(DEL_TREE) oo
+       - $(DEL_TREE) oo-spd
+       - $(DEL) stamp_BLD
+       - $(DEL) ../etc/DOC ../etc/DOC-X
+       - $(DEL) config.log Makefile
+       - $(DEL) ../README.W32
+
+distclean: distclean-other-dirs-$(MAKETYPE) top-distclean
+
+distclean-other-dirs-nmake:
+       cd ..\lib
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\src
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\leim
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\doc\emacs
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\misc
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\lispintro
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\lispref
+       $(MAKE) $(MFLAGS) distclean
+       cd ..\..\nt
+
+distclean-other-dirs-gmake:
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro distclean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref distclean
+
+maintainer-clean: maintainer-clean-other-dirs-$(MAKETYPE) top-distclean
+
+maintainer-clean-other-dirs-nmake:
+       cd ..\lib
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\lib-src
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\src
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\lisp
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\leim
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\doc\emacs
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\misc
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\lispintro
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\lispref
+       $(MAKE) $(MFLAGS) maintainer-clean
+       cd ..\..\nt
+
+maintainer-clean-other-dirs-gmake:
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lib-src maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../src maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../lisp maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../leim maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/emacs maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/misc maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispintro maintainer-clean
+       $(MAKE) $(MFLAGS) $(XMFLAGS) -C ../doc/lispref maintainer-clean
+
+realclean: cleanall
+       - $(DEL_TREE) ../bin
+
+TAGS: TAGS-$(MAKETYPE)
+
+frc:
+TAGS-gmake: frc
+       ../lib-src/$(BLD)/etags $(CURDIR)/*.c
+       $(MAKE) $(MFLAGS) -C ../src TAGS TAGS-LISP
+       $(MAKE) $(MFLAGS) -C ../lib-src TAGS
+       $(MAKE) $(MFLAGS) -C ../lib TAGS
+
+TAGS-nmake:
+       echo This target is not supported with NMake
+
+.PHONY: frc
index b01e341f2d3de983ee0be86e72fb66c8ab6f0925..ec6f5102f4c2fd50f422eef7f1b197c09ca4854a 100644 (file)
@@ -145,18 +145,12 @@ DEBUG_CFLAGS      = -DEMACSDEBUG
 DEBUG_CFLAGS   =\r
 !endif\r
 \r
-!ifdef ENABLECHECKS\r
-CHECKING_CFLAGS        = -DENABLE_CHECKING -DXASSERTS\r
-!else\r
-CHECKING_CFLAGS        =\r
-!endif\r
-\r
 MWINDOWS        = -subsystem:windows -entry:mainCRTStartup\r
 \r
 CFLAGS          = -I. $(ARCH_CFLAGS) \\r
-                 $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)\r
+                 $(DEBUG_CFLAGS) $(USER_CFLAGS) $(LOCAL_FLAGS)\r
 ESC_CFLAGS      = -I. $(ARCH_CFLAGS) \\r
-                 $(DEBUG_CFLAGS) $(CHECKING_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)\r
+                 $(DEBUG_CFLAGS) $(ESC_USER_CFLAGS) $(LOCAL_FLAGS)\r
 \r
 #SYS_LDFLAGS   = -nologo -release -incremental:no -version:3.10 -swaprun:cd -swaprun:net setargv.obj\r
 !ifdef NOOPT\r
index 5b8bcb4e26493e578a9f5c50c0734e780767cc6e..d3a41e3c541377b30b27d0077acef5a6d047a0ca 100644 (file)
@@ -20,10 +20,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 /* The default search path for Lisp function "load".
-   This sets load-path.  */
+   Together with PATH_SITELOADSEARCH, this sets load-path.  */
 /* #define PATH_LOADSEARCH "/usr/local/lib/emacs/lisp" */
 #define PATH_LOADSEARCH "C:/emacs/lisp"
 
+/* Like PATH_LOADSEARCH, but contains the non-standard pieces.  */
+#define PATH_SITELOADSEARCH "C:/emacs/site-lisp"
+
 /* Like PATH_LOADSEARCH, but used only when Emacs is dumping.  This
    path is usually identical to PATH_LOADSEARCH except that the entry
    for the directory containing the installed lisp files has been
index 2d42a65356f9328c30c807fc5626258962576b02..09859d0d630cf0683d593f2355aa237744517b25 100644 (file)
@@ -1,6 +1,21 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-26  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * Version 24.1 released.
+       * Makefile.in (ALL_CFLAGS): Add -I../lib -I${srcdir}/../lib.
+       This is needed for hosts that lack <alloca.h>, when Emacs is
+       configured --with-x-toolkit=no.  Problem reported by Herbert
+       J. Skuhra for FreeBSD.
+
+2012-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       configure: new option --enable-gcc-warnings (Bug#11207)
+       * Makefile.in (C_WARNINGS_SWITCH): Remove.
+       (WARN_CFLAGS, WERROR_CFLAGS): New macros.
+       (ALL_CFLAGS): Use new macros rather than old.
+
+2012-04-11  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (C_SWITCH_X_SYSTEM): Remove.
+       (ALL_CFLAGS): Remove C_SWITCH_X_SYSTEM.
 
 2011-04-16  Paul Eggert  <eggert@cs.ucla.edu>
 
 
        * copyright.h: New file (copied from X11R4 distribution)
        * All files: Replaced occurrences of #include <X11/copyright.h>
-       with #include "copyright.h"
+       with #include "copyright.h".
 
 1991-10-25  Richard Stallman  (rms@mole.gnu.ai.mit.edu)
 
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2012  Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index 94c49fb99662d2ca31da15bba1ca03aded8bdea3..00b3d8e3c690baa0b14c0932f8709b92e66030e5 100644 (file)
@@ -1,4 +1,4 @@
-## Makefile for oldXMenu 
+## Makefile for oldXMenu
 
 ## Copyright 1985, 1986, 1987 by the Massachusetts Institute of Technology
 
@@ -15,7 +15,7 @@
 ## without express or implied warranty.
 
 
-## Copyright (C) 2001-2012  Free Software Foundation, Inc.
+## Copyright (C) 2001-2012 Free Software Foundation, Inc.
 
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
 srcdir=@srcdir@
 VPATH=@srcdir@
 C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
-C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
-C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
 PROFILING_CFLAGS = @PROFILING_CFLAGS@
+WARN_CFLAGS = @WARN_CFLAGS@
+WERROR_CFLAGS = @WERROR_CFLAGS@
 
 EXTRA=insque.o
 CC=@CC@
@@ -88,10 +88,10 @@ OBJS =  Activate.o \
 all:: libXMenu11.a
 
 ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
-  $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) \
-  ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} \
+  $(C_SWITCH_X_SITE) \
+  $(WARN_CFLAGS) $(WERROR_CFLAGS) ${PROFILING_CFLAGS} \
   $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \
-  -I../src -I${srcdir} -I${srcdir}/../src
+  -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
 
 .c.o:
        $(CC) -c ${ALL_CFLAGS} $<
index 7cd828733b102a853acb038830289b6af8f35205..1db25324ea0968d5ad404dae26c4c78e3032988e 100644 (file)
@@ -49,17 +49,26 @@ handle SIGALRM ignore
 # Using a constant runs into GDB bugs sometimes.
 define xgetptr
   set $bugfix = $arg0
-  set $ptr = (gdb_use_union ? (gdb_use_lsb ? $bugfix.u.val << gdb_gctypebits : $bugfix.u.val) : $bugfix & $valmask) | gdb_data_seg_bits
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $ptr = $bugfix & $valmask | gdb_data_seg_bits
 end
 
 define xgetint
   set $bugfix = $arg0
-  set $int = gdb_use_union ? $bugfix.s.val : (gdb_use_lsb ? $bugfix : $bugfix << gdb_gctypebits) >> gdb_gctypebits
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $int = gdb_use_lsb ? $bugfix >> (gdb_gctypebits - 1) : $bugfix << (gdb_gctypebits - 1) >> (gdb_gctypebits - 1)
 end
 
 define xgettype
   set $bugfix = $arg0
-  set $type = gdb_use_union ? $bugfix.s.type : (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
+  if gdb_use_struct
+    set $bugfix = $bugfix.i
+  end
+  set $type = (enum Lisp_Type) (gdb_use_lsb ? $bugfix & $tagmask : $bugfix >> gdb_valbits)
 end
 
 # Set up something to print out s-expressions.
@@ -703,60 +712,6 @@ Print $ as a misc free-cell pointer.
 This command assumes that $ is an Emacs Lisp Misc value.
 end
 
-define xintfwd
-  xgetptr $
-  print (struct Lisp_Intfwd *) $ptr
-end
-document xintfwd
-Print $ as an integer forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xboolfwd
-  xgetptr $
-  print (struct Lisp_Boolfwd *) $ptr
-end
-document xboolfwd
-Print $ as a boolean forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xobjfwd
-  xgetptr $
-  print (struct Lisp_Objfwd *) $ptr
-end
-document xobjfwd
-Print $ as an object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xbufobjfwd
-  xgetptr $
-  print (struct Lisp_Buffer_Objfwd *) $ptr
-end
-document xbufobjfwd
-Print $ as a buffer-local object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xkbobjfwd
-  xgetptr $
-  print (struct Lisp_Kboard_Objfwd *) $ptr
-end
-document xkbobjfwd
-Print $ as a kboard-local object forwarding pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
-define xbuflocal
-  xgetptr $
-  print (struct Lisp_Buffer_Local_Value *) $ptr
-end
-document xbuflocal
-Print $ as a buffer-local-value pointer.
-This command assumes that $ is an Emacs Lisp Misc value.
-end
-
 define xsymbol
   set $sym = $
   xgetptr $sym
@@ -1003,7 +958,7 @@ end
 
 define xpr
   xtype
-  if $type == Lisp_Int
+  if $type == Lisp_Int0 || $type == Lisp_Int1
     xint
   end
   if $type == Lisp_Symbol
@@ -1023,36 +978,12 @@ define xpr
     if $misc == Lisp_Misc_Free
       xmiscfree
     end
-    if $misc == Lisp_Misc_Boolfwd
-      xboolfwd
-    end
     if $misc == Lisp_Misc_Marker
       xmarker
     end
-    if $misc == Lisp_Misc_Intfwd
-      xintfwd
-    end
-    if $misc == Lisp_Misc_Boolfwd
-      xboolfwd
-    end
-    if $misc == Lisp_Misc_Objfwd
-      xobjfwd
-    end
-    if $misc == Lisp_Misc_Buffer_Objfwd
-      xbufobjfwd
-    end
-    if $misc == Lisp_Misc_Buffer_Local_Value
-      xbuflocal
-    end
-#    if $misc == Lisp_Misc_Some_Buffer_Local_Value
-#      xvalue
-#    end
     if $misc == Lisp_Misc_Overlay
       xoverlay
     end
-    if $misc == Lisp_Misc_Kboard_Objfwd
-      xkbobjfwd
-    end
 #    if $misc == Lisp_Misc_Save_Value
 #      xsavevalue
 #    end
@@ -1258,7 +1189,7 @@ define hookpost-backtrace
 end
 
 define xreload
-  set $tagmask = (((long)1 << gdb_gctypebits) - 1)
+  set $tagmask = ((1 << gdb_gctypebits) - 1)
   # The consing_since_gc business widens the 1 to EMACS_INT,
   # a symbol not directly visible to GDB.
   set $valmask = gdb_use_lsb ? ~($tagmask) : ((consing_since_gc - consing_since_gc + 1) << gdb_valbits) - 1
index 716ebbadab6e7de7c95991eb67aa4f440a1b4b92..b78f261b49655efdba56ee37605e24360da31c2e 100644 (file)
+2012-07-17  Eli Zaretskii  <eliz@gnu.org>
+
+       Remove FILE_SYSTEM_CASE.
+       * s/msdos.h (FILE_SYSTEM_CASE): Don't define.
+
+       * fileio.c (FILE_SYSTEM_CASE): Don't define.
+       (Ffile_name_directory, Fexpand_file_name): Don't use FILE_SYSTEM_CASE.
+       Fixes problems on MS-DOS with Vtemp_file_name_pattern when
+       call-process-region passes it through expand-file-name.
+
+       * dired.c (file_name_completion): Don't use FILE_SYSTEM_CASE.
+
+2012-07-17  Andreas Schwab  <schwab@linux-m68k.org>
+
+       Fix crash when creating indirect buffer (Bug#11917)
+       * buffer.c (buffer_lisp_local_variables): Add argument CLONE.
+       Don't handle unbound variables specially if non-zero.
+       (Fbuffer_local_variables): Pass zero.
+       (clone_per_buffer_values): Pass non-zero.
+
+2012-07-17  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * gnutls.c (emacs_gnutls_handshake): Revert last change.  Add QUIT
+       to make the loop interruptible.
+
+2012-07-17  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * gnutls.c (emacs_gnutls_handshake): Only retry if
+       GNUTLS_E_INTERRUPTED.
+
+2012-07-17  Eli Zaretskii  <eliz@gnu.org>
+2012-07-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Cleanup and convert miscellaneous checks to eassert.
+       * alloc.c (mark_interval): Fix comment, partially rephrase
+       old comment from intervals.h (see below).
+       * intervals.c (find_interval, adjust_intervals_for_insertion)
+       (delete_interval, adjust_intervals_for_deletion)
+       (graft_intervals_into_buffer, temp_set_point_both, copy_intervals):
+       Convert to eassert.
+       (adjust_intervals_for_insertion, make_new_interval):
+       Remove obsolete and unused code.
+       * intervals.h (struct interval): Remove obsolete comment.
+       * textprotp.c (erase_properties): Remove unused code.
+       (Fadd_text_properties, set_text_properties_1, Fremove_text_properties)
+       (Fremove_list_of_text_properties): Convert to eassert.
+
+2012-07-17  Chong Yidong  <cyd@gnu.org>
+
+       * editfns.c (Finsert_char): Doc fix.
+
+2012-07-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Fix previous change to make Fmemory_free always accurate.
+       * alloc.c (make_interval): Update total_free_intervals.
+       (make_float): Likewise for total_free_floats.
+       (free_cons, Fcons): Likewise for total_free_conses.
+       (SETUP_ON_FREE_LIST, allocate_vector_from_block):
+       Likewise for total_free_vector_bytes.
+       (Fmake_symbol): Likewise for total_free_symbols.
+       (bytes_free): Remove.
+
+2012-07-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Simple free memory accounting feature.
+       * alloc.c (bytes_free, total_free_vector_bytes): New variable.
+       (sweep_vectors): Accumulate size of free vectors.
+       (Fgarbage_collect): Setup bytes_free.
+       (Fmemory_free): New function.
+       (syms_of_alloc): Register it.
+
+2012-07-17  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Cleanup overlays checking.
+       * buffer.h (OVERLAY_VALID): Remove as useless synonym of OVERLAYP.
+       * buffer.c (overlay_touches_p, recenter_overlay_lists): Change to
+       eassert and OVERLAYP.
+       (sort_overlays): Change to use OVERLAYP.
+
+2012-07-16  René Kyllingstad  <Rene@Kyllingstad.com>  (tiny change)
+
+       * editfns.c (Finsert_char): Make it interactive, and make the
+       second arg optional.  Copy interactive spec and docstring from
+       ucs-insert.
+
+2012-07-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * floatfns.c (Fabs): Do not wrap fabs inside IN_FLOAT (Bug#11913).
+       Unlike the other wrapped functions, fabs has an unspecified
+       effect on errno.
+
+2012-07-16  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (keyDown): Interpret flags without left/right bits
+       as the left key (Bug#11670).
+
+2012-07-16  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Remove empty and useless init functions.
+       * lisp.h (init_character_once, init_fns, init_image)
+       (init_filelock, init_sound): Remove prototype.
+       * character.c (init_character_once): Remove.
+       * filelock.c (init_filelock): Likewise.
+       * fns.c (init_fns): Likewise.
+       * image.c (init_image): Likewise.
+       * sound.c (init_sound): Likewise.
+       * emacs.c (main): Adjust accordingly.
+
+2012-07-16  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * gtkutil.h: Tiny cleanups.
+       (use_old_gtk_file_dialog): Remove useless declaration.
+       (xg_uses_old_file_dialog): Add suggested const attribute.
+
+2012-07-15  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (MAX_STRONG_CHAR_SEARCH): New macro.
+       (bidi_paragraph_init): Use it to limit search forward for a strong
+       directional character in abnormally large paragraphs full of
+       neutral or weak characters.  (Bug#11943)
+
+2012-07-15  Stefano Facchini  <stefano.facchini@gmail.com>  (tiny change)
+
+       * gtkutil.c (xg_create_tool_bar): Apply "primary-toolbar" style to
+       the toolbar (Bug#9451).
+       (xg_make_tool_item): Give the widget event box a transparent
+       background.
+
+2012-07-15  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Cleanup basic allocation variables and functions.
+       * alloc.c (ignore_warnings, init_intervals, init_float)
+       (init_cons, init_symbol, init_marker): Remove.
+       (interval_block_index): Initialize to INTERVAL_BLOCK_SIZE.
+       (float_block_index): Initialize to FLOAT_BLOCK_SIZE.
+       (cons_block_index): Initialize to CONS_BLOCK_SIZE.
+       (symbol_block_size): Initialize to SYMBOL_BLOCK_SIZE.
+       (marker_block_index): Initialize to MARKER_BLOCK_SIZE.
+       (staticidx, init_alloc_once, init_strings, free_ablock):
+       Remove redundant initialization.
+       * fns.c (init_weak_hash_tables): Remove.
+       * lisp.h (init_weak_hash_tables): Remove prototype.
+
+2012-07-15  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Use zero_vector where appropriate.
+       * alloc.c (zero_vector): Define as Lisp_Object.  Adjust users
+       accordingly.
+       * lisp.h (zero_vector): New declaration.
+       * font.c (null_vector): Remove.
+       (syms_of_font): Remove initialization and staticpro.
+       (font_list_entities, font_find_for_lface): Change to use zero_vector.
+       * keymap.c (Faccessible_keymaps): Likewise.
+
+2012-07-15  Leo Liu  <sdl.web@gmail.com>
+
+       * fringe.c: Fix typo in comments.
+
+2012-07-14  Leo Liu  <sdl.web@gmail.com>
+
+       * fringe.c: Add a new bitmap exclamation-mark.
+
 2012-07-14  Eli Zaretskii  <eliz@gnu.org>
 
-       Remove FILE_SYSTEM_CASE.
-       * s/msdos.h (FILE_SYSTEM_CASE): Don't define.
+       * gmalloc.c (GMALLOC_INHIBIT_VALLOC): Don't reference.
+
+       * s/msdos.h (BSD_SYSTEM, DATA_START, GC_SETJMP_WORKS, HAVE_MOUSE)
+       (HAVE_MENUS): Don't define, defined by editing config.in with
+       msdos/sed2v2.inp.
+       (GMALLOC_INHIBIT_VALLOC): Don't define.
+       (MODE_LINE_BINARY_TEXT): Remove, not used anymore.
+
+2012-07-14  Juanma Barranquero  <lekktu@gmail.com>
+
+       * s/ms-w32.h (GC_SETJMP_WORKS, GC_MARK_STACK): Set in nt/config.nt.
+
+2012-07-14  Glenn Morris  <rgm@gnu.org>
+
+       * s/aix4-2.h, s/freebsd.h, s/gnu-linux.h, s/hpux10-20.h:
+       * s/irix6-5.h, s/netbsd.h, s/sol2-6.h, s/unixware.h:
+       Let configure set GC_SETJMP_WORKS, GC_MARK_STACK.
+
+2012-07-13  Glenn Morris  <rgm@gnu.org>
+
+       * s/gnu-linux.h (GC_MARK_SECONDARY_STACK): Let configure set it.
+
+       * s/usg5-4-common.h (SETUP_SLAVE_PTY): Let configure set it.
+       * s/irix6-5.h (SETUP_SLAVE_PTY): No more need to unset it.
+
+2012-07-13  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (uRect): Only define if NS_IMPL_GNUSTEP.
+       (x_free_frame_resources): Pass x_free_frame_resources to NSTRACE.
+       (ns_lisp_to_color, ns_string_to_lispmod, ns_term_init)
+       (ns_term_shutdown, requestService, initFrameFromEmacs): Use SSDATA
+       where appropriate.
+       (ns_exec_path, ns_load_path, changeFont): Put () around assignment used
+       as boolean expression.
+       (x_set_window_size): Remove unused variable toolbar.
+       (ns_get_color_default, ns_mod_to_lisp): Remove.
+       (ns_mouse_position): Remove unused variables xchar and ychar.
+       (ns_compute_glyph_string_overhangs): Remove unused variable face.
+       (ns_set_vertical_scroll_bar): Remove unused variable count.
+       (ns_delete_terminal): Remove unused variable i.
+       (ns_term_init): Remove unused variables r, g and b.
+       (mouseDown): Remove unused variable window.
+       (windowDidResize): Move definition of theWindow inside NS_IMPL_GNUSTEP.
+       (initFrameFromEmacs): Remove unused variable vbextra.
+       (mouseEntered): Remove unused variables p and dpyinfo.
+       (mouseExited): Remove unused variables p and r.
+       (ns_define_frame_cursor, ns_clear_frame_area)
+       (ns_draw_window_cursor, ns_initialize_display_info): Make static.
+       (menuDown): Assign [sender tag] to variable and cast the variable.
+
+       * nsterm.h (menuDown): Add id as type to argument sender.
+       (ns_display_info_for_name): Add Lisp_Object argument.
+       (ns_term_init): Add Lisp_Object argument.
+       (ns_map_event_to_object): Add void argument.
+       (ns_string_from_pasteboard, ns_string_to_pasteboard): Add correct
+       prototype with arguments and only declare if __OBJC__.
+       (nxatoms_of_nsselect): Add void argument.
+       (ns_lisp_to_cursor_type): Add Lisp_Object argument.
+       (ns_alloc_autorelease_pool): Add void argument.
+       (ns_release_autorelease_pool): Add void* argument.
+       (ns_get_defaults_value): Add const char* argument.
+
+       * nsmenu.m (ns_update_menubar, ns_menu_show, process_dialog)
+       (initFromContents): Use SSDATA where appropriate.
+       (ns_update_menubar): Add braces to ambigous if-else.
+       (initWithTitle): Put () around assignment in if statement.
+       (ns_menu_show): Remove unused variables window and keymap.
+       (update_frame_tool_bar): Remove unused variable selected_p.
+       (initWithContentRect): Remove unused variable this_cmd_name.
+
+       * nsimage.m (ns_load_image, allocInitFromFile): Use SSDATA where
+       appropriate.
+       (setXBMColor): Remove unused variable len.
+       (setPixmapData): Put () around assignment in loop statement.
+
+       * nsfont.m (ns_get_family, ns_lang_to_script, ns_otf_to_script)
+       (ns_registry_to_script, ns_get_req_script, nsfont_open): Use SSDATA
+       where appropriate.
+       (ns_get_covering_families, ns_findfonts, nsfont_list_family): Put ()
+       around assignment in loop statement.
+       (nsfont_open): Remove unused variable i.
+       (nsfont_open): Remove unused variable len.
+       (nsfont_draw): Remove unused variable cs.
+
+       * nsfns.m (x_set_icon_name, ns_set_name_internal)
+       (ns_set_name_as_filename, ns_implicitly_set_icon_type)
+       (x_set_icon_type, ns_lisp_to_cursor_type, Fns_read_file_name)
+       (Fns_get_resource, Fns_set_resource, Fx_open_connection)
+       (Fns_font_name, Fns_perform_service)
+       (Fns_convert_utf8_nfd_to_nfc, ns_do_applescript)
+       (Fns_do_applescript, Fx_show_tip): Use SSDATA where appropriate.
+       (ns_set_name): Remove unused variable view.
+       (x_set_menu_bar_lines): Remove unused variable olines.
+       (x_set_tool_bar_lines): Remove unused variable root_window.
+       (Fns_list_colors): Put () around assignment in while statement.
+       (Fns_perform_service): Remove unused variable len.
+       (Fns_display_usable_bounds): Remove unused variable top.
+       (syms_of_nsfns): Remove unused variable i.
+
+       * nsmenu.m (ns_update_menubar): Exchange place of argument 2 and 3 to
+       memcpy (Bug#11907).
+
+2012-07-13  Kalle Kankare  <kalle.kankare@iki.fi>  (tiny change)
+
+       * image.c (Fimagemagick_types): Initialize ex with GetExceptionInfo
+       and free it with DestroyExceptionInfo (Bug#11558).
+
+2012-07-13  Juanma Barranquero  <lekktu@gmail.com>
+
+       * s/ms-w32.h (FIRST_PTY_LETTER, HAVE_SOCKETS): Move to nt/config.nt.
+       (HAVE_ATTRIBUTE_ALIGNED, HAVE_C99_STRTOLD, HAVE___BUILTIN_UNWIND_INIT):
+       Set here, not in nt/config.nt.
+
+2012-07-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (move_it_in_display_line_to): On GUI terminals, allow
+       cursor overflow into the last glyph on display line when the right
+       fringe is off.  (Bug#11832)
+
+2012-07-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * xdisp.c (produce_special_glyphs): Now static.
+       * dispextern.h (produce_special_glyphs): Remove decl.
+
+2012-07-13  Glenn Morris  <rgm@gnu.org>
+
+       * s/bsd-common, s/cygwin.h: Remove empty files.
+       * s/freebsd.h, s/netbsd.h: Do not include bsd-common.h.
+
+       * s/usg5-4-common.h (USG, USG5):
+       * s/template.h (USG5, USG, HPUX, BSD4_2, BSD_SYSTEM):
+       * s/sol2-6.h (SOLARIS2):
+       * s/irix6-5.h (IRIX6_5):
+       * s/hpux10-20.h (USG, USG5, HPUX):
+       * s/gnu-linux.h (USG, GNU_LINUX):
+       * s/freebsd.h (BSD_SYSTEM):
+       * s/darwin.h (BSD4_2, BSD_SYSTEM, DARWIN_OS):
+       * s/cygwin.h (CYGWIN):
+       * s/bsd-common.h (BSD_SYSTEM, BSD4_2):
+       * s/aix4-2.h (USG, USG5, _AIX): Move "system type" macros to configure.
+
+2012-07-13  BT Templeton  <bpt@hcoop.net>  (tiny change)
+
+       * nsfont.m (ns_charset_covers): Don't abort if no bitmap (Bug#11853).
+
+2012-07-13  Glenn Morris  <rgm@gnu.org>
+
+       * s/usg5-4-common.h (NSIG_MINIMUM): Let configure set it.
+
+       * s/gnu-linux.h, s/irix6-5.h: Let configure set ULIMIT_BREAK_VALUE.
+
+       * process.c (init_process_emacs): Replace MIN_PTY_KERNEL_VERSION.
+       * s/darwin.h (MIN_PTY_KERNEL_VERSION): Remove single-use macro.
+
+2012-07-12  Glenn Morris  <rgm@gnu.org>
+
+       * s/darwin.h (SYSTEM_PURESIZE_EXTRA): Move to configure.
+
+       * process.c (init_process_emacs): Rename from init_process.
+       The old name is also the name of a Mach system call.
+       * lisp.h, emacs.c: Update for this name change.
+       * nsgui.h, sysselect.h, s/darwin.h: Remove workaround that is no
+       longer needed.
+
+2012-07-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (insert_left_trunc_glyphs): Fix incorrect size in
+       memmove call that removes glyphs covered by the left truncation
+       glyph.  Improve commentary.
+       (display_line): Fix display of continuation glyphs on GUI frames
+       when the right fringe is turned off and variable-size fonts are
+       used in the window.  Move the code that appends a stretch glyph to
+       produce_special_glyphs, so that it could be used for truncation
+       and continuation glyphs alike.
+       (produce_special_glyphs) [HAVE_WINDOW_SYSTEM]: Produce a stretch
+       glyph of a suitably computed width, to align the special glyphs at
+       the window margin.  Code moved from display_line.  (Bug#11832)
+
+2012-07-12  Glenn Morris  <rgm@gnu.org>
+
+       * s/aix4-2.h, s/hpux10-20.h: Let configure set NO_EDITRES.
+
+       * s/gnu-linux.h, s/hpux10-20.h:
+       Do not unconditionally define HAVE_XRMSETDATABASE.
+
+       * s/gnu-linux.h (UNIX98_PTYS): Let configure set it.
+
+2012-07-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix typos that broke OS X build.
+       Reported by Randal L. Schwartz in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00225.html>.
+       * nsterm.m (ns_timeout): Add missing local decl.
+       (ns_get_color): snprintf -> sprintf, to fix typo.
+
+2012-07-12  Glenn Morris  <rgm@gnu.org>
+
+       * src/s/aix4-2.h, src/s/cygwin.h, src/s/darwin.h:
+       * src/s/gnu-linux.h, src/s/hpux10-20.h, src/s/irix6-5.h:
+       * src/s/sol2-6.h, src/s/unixware.h, src/s/usg5-4-common.h:
+       Move PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF to configure.
+
+       * s/cygwin.h, s/darwin.h, s/gnu-linux.h, s/irix6-5.h:
+       Move PTY_OPEN to configure.
+
+       * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h:
+       * s/gnu-linux.h, s/hpux10-20.h, s/irix6-5.h, s/template.h:
+       * s/usg5-4-common.h: Move FIRST_PTY_LETTER, PTY_ITERATION to configure.
+
+2012-07-12  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Use empty_unibyte_string where applicable.
+       * keyboard.c (parse_tool_bar_item): Use empty_unibyte_string.
+       * lread.c (read1): Likewise.
+       * xsettings.c (syms_of_xsettings): Likewise.
+
+2012-07-12  Glenn Morris  <rgm@gnu.org>
+
+       * s/cygwin.h (G_SLICE_ALWAYS_MALLOC):
+       * s/freebsd.h (BROKEN_PTY_READ_AFTER_EAGAIN):
+       * s/irix6-5.h (SETPGRP_RELEASES_CTTY, PREFER_VSUSP):
+       * s/hpux10-20.h (RUN_TIME_REMAP):
+       * s/bsd-common.h (TABDLY): Move to configure.
+
+       * s/hpux10-20.h, s/sol2-6.h: Move XOS_NEEDS_TIME_H to configure.
+
+       * s/bsd-common.h, s/darwin.h: Move TAB3 to configure.
+
+       * s/aix4-2.h (BROKEN_FIONREAD, BROKEN_SIGAIO, BROKEN_SIGPTY)
+       (BROKEN_SIGPOLL, BROKEN_GET_CURRENT_DIR_NAME): Let configure set them.
+
+       * s/darwin.h (NO_ABORT, NO_MATHERR): Let configure set them.
+
+       * s/bsd-common.h, s/cygwin.h, s/gnu-linux.h, s/irix6-5.h:
+       * s/template.h: Move NARROWPROTO to configure.
+
+2012-07-11  Glenn Morris  <rgm@gnu.org>
+
+       * s/gnu-linux.h, s/sol2-6.h: No longer define POSIX,
+       unused since 2011-01-17 change to systty.h.
+
+       * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h, s/gnu-linux.h:
+       * s/hpux10-20.h, s/template.h, s/usg5-4-common.h:
+       Move HAVE_PTYS and HAVE_SOCKETS to configure.
+
+2012-07-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * s/sol2-6.h (HAVE_LIBKSTAT): Remove.  (Bug#11914)
+
+2012-07-11  Glenn Morris  <rgm@gnu.org>
+
+       * s/darwin.h, s/gnu-linux.h, s/template.h:
+       Move INTERRUPT_INPUT to configure.
+
+2012-07-11  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Minor adjustments to interning code.
+       * lisp.h (intern, intern_c_string): Redefine as static inline
+       wrappers for intern_1 and intern_c_string_1, respectively.
+       (intern_1, intern_c_string_1): Rename prototypes.
+       * lread.c (intern_1, intern_c_string_1, oblookup): Simplify
+       Vobarray checking.
+       * font.c (font_intern_prop): Likewise.  Adjust comment.
+       * w32font.c (intern_font_name): Likewise.
+
+2012-07-11  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * gnutls.c (Fgnutls_boot): Properly parse :keylist argument.
+
+       * coding.c (Fdefine_coding_system_internal): Use XCAR/XCDR instead
+       of Fcar/Fcdr if possible.
+       * font.c (check_otf_features): Likewise.
+       * fontset.c (Fnew_fontset): Likewise.
+       * gnutls.c (Fgnutls_boot): Likewise.
+       * minibuf.c (read_minibuf): Likewise.
+       * msdos.c (IT_set_frame_parameters): Likewise.
+       * xmenu.c (Fx_popup_dialog): Likewise.
+       * w32menu.c (Fx_popup_dialog): Likewise.
+
+2012-07-11  Glenn Morris  <rgm@gnu.org>
+
+       * s/bsd-common.h, s/cygwin.h: No need to undefine INTERRUPT_INPUT,
+       since nothing has defined it on these platforms.
+
+       * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/gnu-linux.h:
+       * s/irix6-5.h: Move SIGNALS_VIA_CHARACTERS to configure.
+
+       * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h:
+       * s/gnu-linux.h, s/hpux10-20.h, s/template.h, s/usg5-4-common.h:
+       Move CLASH_DETECTION to configure.
+
+       * s/gnu.h: Remove file, which is now empty.
+
+       * s/gnu.h, s/gnu-linux.h:
+       Move GNU_LIBRARY_PENDING_OUTPUT_COUNT to configure.
+
+2012-07-11  John Wiegley  <johnw@newartisans.com>
+
+       * alloc.c (mark_memory): Guard the "no_address_safety_analysis"
+       function attribute, so we only use it if it exists in the
+       compiler.
+
+2012-07-11  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Avoid call to strlen in fast_c_string_match_ignore_case.
+       * search.c (fast_c_string_match_ignore_case): Change to use
+       length argument.  Adjust users accordingly.
+       * lisp.h (fast_c_string_match_ignore_case): Adjust prototype.
+
+2012-07-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Assume mkdir, rmdir.
+       * sysdep.c (mkdir) [!HAVE_MKDIR]: Remove.
+       * sysdep.c (rmdir) [!HAVE_RMDIR]: Remove.
+
+       Assume rename.
+       * sysdep.c (rename) [!HAVE_RENAME]: Remove.
+
+       Assume perror.
+       * s/hpux10-20.h (HAVE_PERROR): Remove.
+       * sysdep.c (perror) [HPUX && !HAVE_PERROR]:
+       Remove dummy definition, as this problem was obsolete long ago.
+
+       Assume strerror.
+       * sysdep.c (strerror) [!HAVE_STRERROR && !WINDOWSNT]: Remove.
+
+2012-07-11  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Avoid calls to strlen in font processing functions.
+       * font.c (font_parse_name, font_parse_xlfd, font_parse_fcname)
+       (font_open_by_name): Change to use length argument.  Adjust
+       users accordingly.
+       * font.h (font_open_by_name, font_parse_xlfd, font_unparse_xlfd):
+       Adjust prototypes.
+       * xfont.c (xfont_decode_coding_xlfd, font_unparse_xlfd):
+       Change to return ptrdiff_t.
+       (xfont_list_pattern, xfont_match): Use length returned by
+       xfont_decode_coding_xlfd.
+       * xfns.c (x_default_font_parameter): Omit useless xstrdup.
+
+2012-07-11  Glenn Morris  <rgm@gnu.org>
+
+       * s/darwin.h, s/freebsd.h, s/netbsd.h:
+       Move DONT_REOPEN_PTY to configure.
+
+       * sound.c (DEFAULT_SOUND_DEVICE) [!WINDOWSNT]:
+       * s/netbsd.h (DEFAULT_SOUND_DEVICE): Let configure set it.
+
+2012-07-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove "#define unix" that is no longer needed (Bug#11905).
+       * s/aix4-2.h (unix): Remove; no longer needed.
+
+       EMACS_TIME simplification (Bug#11875).
+       This replaces macros (which typically do not work in GDB)
+       with functions, typedefs and enums, making the code easier to debug.
+       The functional style also makes code easier to read and maintain.
+       * systime.h: Include <sys/time.h> on all hosts, not just if
+       WINDOWSNT, since 'struct timeval' is needed in general.
+       (EMACS_TIME): Now a typedef, not a macro.
+       (EMACS_TIME_RESOLUTION, LOG10_EMACS_TIME_RESOLUTION): Now constants,
+       not macros.
+       (EMACS_SECS, EMACS_NSECS, EMACS_TIME_SIGN, EMACS_TIME_VALID_P)
+       (EMACS_TIME_FROM_DOUBLE, EMACS_TIME_TO_DOUBLE, EMACS_TIME_EQ)
+       (EMACS_TIME_NE, EMACS_TIME_GT, EMACS_TIME_GE, EMACS_TIME_LT)
+       (EMACS_TIME_LE): Now functions, not macros.
+       (EMACS_SET_SECS, EMACS_SET_NSECS, EMACS_SET_SECS_NSECS)
+       (EMACS_SET_USECS, EMACS_SET_SECS_USECS): Remove these macros,
+       which are not functions.  All uses rewritten to use:
+       (make_emacs_time): New function.
+       (EMACS_SECS_ADDR, EMACS_SET_INVALID_TIME, EMACS_GET_TIME)
+       (EMACS_ADD_TIME, EMACS_SUB_TIME): Remove these macros, which are
+       not functions.  All uses rewritten to use the following, respectively:
+       (emacs_secs_addr, invalid_emacs_time, get_emacs_time)
+       (add_emacs_time, sub_emacs_time): New functions.
+       * atimer.c: Don't include <sys/time.h>, as "systime.h" does this.
+       * fileio.c (Fcopy_file):
+       * xterm.c (XTflash): Get the current time closer to when it's used.
+       * makefile.w32-in ($(BLD)/atimer.$(O)): Update dependencies.
+
+       * bytecode.c (targets): Suppress -Woverride-init warnings.
+
+       Simplify by avoiding confusing use of strncpy etc.
+       * doc.c (Fsnarf_documentation):
+       * fileio.c (Ffile_name_directory, Fsubstitute_in_file_name):
+       * frame.c (Fmake_terminal_frame):
+       * gtkutil.c (get_utf8_string):
+       * lread.c (openp):
+       * nsmenu.m (ns_update_menubar):
+       * regex.c (regerror):
+       Prefer memcpy to strncpy and strncat when either will do.
+       * fileio.c (Fsubstitute_in_file_name):
+       * keyboard.c (MULTI_LETTER_MOD, parse_modifiers_uncached)
+       (menu_separator_name_p):
+       * nsmenu.m (ns_update_menubar):
+       Prefer memcmp to strncmp when either will do.
+       * nsterm.m: Include <ftoastr.h>.
+       (ns_get_color):
+       * s/gnu-linux.h, s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF):
+       Prefer snprintf to strncpy.
+       * nsterm.m (ns_term_init):
+       * widget.c (set_frame_size) [0]: Prefer xstrdup to xmalloc + strncpy.
+       * nsterm.m (ns_term_init):
+       Avoid the need for strncpy, by using build_string or
+       make_unibyte_string directly.  Use dtoastr, not snprintf.
+       * process.c (Fmake_network_process): Diagnose service names that
+       are too long, rather than silently truncating them or creating
+       non-null-terminated names.
+       (Fnetwork_interface_info): Likewise, for interface names.
+       * sysdep.c (system_process_attributes) [GNU_LINUX]:
+       Prefer sprintf to strncat.
+       * xdisp.c (debug_method_add) [GLYPH_DEBUG]:
+       Prefer vsnprintf to vsprintf + strncpy.
+
+2012-07-10  Glenn Morris  <rgm@gnu.org>
+
+       * dispnew.c (PENDING_OUTPUT_COUNT) [!__GNU_LIBRARY__]:
+       Clarify fallback case.
+
+2012-07-10  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Use XCAR and XCDR instead of Fcar and Fcdr where possible.
+       * callint.c, coding.c, doc.c, editfns.c, eval.c, font.c, fontset.c,
+       * frame.c, gnutls.c, minibuf.c, msdos.c, textprop.c, w32fns.c,
+       * w32menu.c, window.c, xmenu.c: Change to use XCAR and XCDR
+       where argument type is known to be a Lisp_Cons.
+
+2012-07-10  Tom Tromey  <tromey@redhat.com>
+
+       * bytecode.c (BYTE_CODE_THREADED): New macro.
+       (BYTE_CODES): New macro.  Replaces all old byte-code defines.
+       (enum byte_code_op): New type.
+       (CASE, NEXT, FIRST, CASE_DEFAULT, CASE_ABORT): New macros.
+       (exec_byte_code): Use them.  Use token threading when applicable.
+
+2012-07-10  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Optimize pure C strings initialization.
+       * lisp.h (make_pure_string): Fix prototype.
+       (build_pure_c_string): New function, defined as static inline.  This
+       provides a better opportunity to optimize away calls to strlen when
+       the function is called with compile-time constant argument.
+       * alloc.c (make_pure_c_string): Fix comment.  Change to add nchars
+       argument, adjust users accordingly.  Use build_pure_c_string where
+       appropriate.
+       * buffer.c, coding.c, data.c, dbusbind.c, fileio.c, fontset.c, frame.c,
+       * keyboard.c, keymap.c, lread.c, search.c, syntax.c, w32fns.c, xdisp.c,
+       * xfaces.c, xfns.c, xterm.c: Use build_pure_c_string where appropriate.
+
+2012-07-10  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Avoid calls to strlen in miscellaneous functions.
+       * buffer.c (init_buffer): Use precalculated len, adjust if needed.
+       * font.c (Ffont_xlfd_name): Likewise.  Change to call make_string.
+       * lread.c (openp): Likewise.
+
+2012-07-10  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Avoid calls to strlen in path processing functions.
+       * fileio.c (file_name_as_directory): Add comment.  Change to add
+       srclen argument and return the length of result.  Adjust users
+       accordingly.
+       (directory_file_name): Fix comment.  Change to add srclen argument,
+       swap 1st and 2nd arguments to obey the common convention.  Adjust
+       users accordingly.
+       * filelock.c (fill_in_lock_file_name): Avoid calls to strlen.
+
+2012-07-10  Glenn Morris  <rgm@gnu.org>
+
+       * s/cygwin.h, s/darwin.h, s/freebsd.h, s/netbsd.h, s/unixware.h:
+       Move PENDING_OUTPUT_COUNT definition to configure.
+
+       * s/irix6-5.h (DATA_START, DATA_SEG_BITS):
+       * s/hpux10-20.h (DATA_SEG_BITS, DATA_START):
+       * s/gnu.h (DATA_START): Move definitions to configure.
+
+       * s/irix6-5.h (SETUP_SLAVE_PTY, PTY_NAME_SPRINTF): Drop ifdef guards.
+       We include usg5-4-common.h, which defines them both.
+
+       * s/gnu.h: Don't include fcntl.h (every file in Emacs that uses
+       O_RDONLY already includes it).
+
+       Stop ns builds setting the EMACSLOADPATH environment variable.
+       * nsterm.m (ns_load_path): Rename from ns_init_paths.
+       Now it does not set EMACSLOADPATH, just returns the load-path string.
+       * nsterm.h: Update accordingly.
+       * lread.c [HAVE_NS]: Include nsterm.h.
+       (init_lread) [HAVE_NS]: Use ns_load_path.
+       * emacs.c (main) [HAVE_NS]: No longer call ns_init_paths.
+
+2012-07-09  Glenn Morris  <rgm@gnu.org>
+
+       * s/gnu.h (SIGNALS_VIA_CHARACTERS): No need to define it here,
+       since the included bsd-common.h does so.
+
+       Stop ns builds setting the EMACSPATH environment variable.
+       * nsterm.m (ns_exec_path): New function, split from ns_init_paths.
+       (ns_init_paths): Do not set EMACSPATH.
+       * nsterm.h (ns_exec_path): Add it.
+       * callproc.c (init_callproc_1, init_callproc) [HAVE_NS]:
+       Use ns_exec_path.
+
+       * nsterm.m, nsterm.h (ns_etc_directory): Fix type, empty return.
+
+2012-07-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * process.c (wait_reading_process_output): 'waitchannels' was unset
+       when read_kbd || !NILP (wait_for_cell); fix this.
+
+       Add GCC-style 'const' attribute to functions that can use it.
+       * character.h (char_resolve_modifier_mask):
+       * keyboard.h (make_ctrl_char):
+       * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe)
+       (init_character_once, next_almost_prime, init_fns, init_image)
+       (flush_pending_output, init_sound):
+       * mem-limits.h (start_of_data):
+       * menu.h (finish_menu_items):
+       Add ATTRIBUTE_CONST.
+       * emacs.c (DEFINE_DUMMY_FUNCTION):
+       Declare the dummy function with ATTRIBUTE_CONST.
+       * lisp.h (Fbyteorder, Fmax_char, Fidentity):
+       Add decls with ATTRIBUTE_CONST.
+
+       Minor improvements to make_formatted_string.
+       * alloc.c (make_formatted_string): Prefer int to ptrdiff_t
+       where int is good enough, as vsprintf returns an int.
+       * lisp.h (make_formatted_string): Add ATTRIBUTE_FORMAT_PRINTF.
+
+2012-07-09  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Use make_formatted_string to avoid double length calculation.
+       * lisp.h (make_formatted_string): New prototype.
+       * alloc.c (make_formatted_string): New function.
+       * buffer.c (Fgenerate_new_buffer_name): Use it.
+       * dbus.c (syms_of_dbusbind): Likewise.
+       * editfns.c (Fcurrent_time_zone): Likewise.
+       * filelock.c (get_boot_time): Likewise.
+       * frame.c (make_terminal_frame, set_term_frame_name)
+       (x_report_frame_params): Likewise.
+       * image.c (gs_load): Likewise.
+       * minibuf.c (get_minibuffer): Likewise.
+       * msdos.c (dos_set_window_size): Likewise.
+       * process.c (make_process): Likewise.
+       * xdisp.c (ensure_echo_area_buffers): Likewise.
+       * xsettings.c (apply_xft_settings): Likewise.
+
+2012-07-09  Glenn Morris  <rgm@gnu.org>
+
+       Stop ns builds polluting the environment with EMACSDATA, EMACSDOC.
+       * nsterm.m (ns_etc_directory): New function, split from ns_init_paths.
+       (ns_init_paths): Do not set EMACSDATA, EMACSDOC.
+       * nsterm.h (ns_etc_directory): Add it.
+       * callproc.c [HAVE_NS]: Include nsterm.h.
+       (init_callproc_1, init_callproc) [HAVE_NS]: Use ns_etc_directory.
+
+2012-07-09  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Move marker debugging code under MARKER_DEBUG.
+       * marker.c (MARKER_DEBUG): Move marker debugging code under
+       #ifdef MARKER_DEBUG because byte_char_debug_check is too slow
+       for bootstrap with --enable-checking (~3x slowdown reported
+       by Juanma Barranquero <lekktu@gmail.com>).
+       (verify_bytepos): Move under #ifdef MARKER_DEBUG.
+
+2012-07-08  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * systime.h (EMACS_SUB_TIME): Clarify behavior with unsigned time_t.
+       See <http://bugs.gnu.org/11825#29>.
+
+2012-07-08  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (fill_glyphless_glyph_string): If the face of the glyph
+       has no font, use the frame's font.  (Bug#11813)
+       (display_line): Add commentary about displaying truncation glyphs
+       on GUI frames.
+       (produce_special_glyphs): Move here from term.c.
+
+       * term.c (produce_special_glyphs): Move to xdisp.c.
+
+       * dispextern.h (produce_special_glyphs): Move prototype to xdisp.c
+       section.
+
+2012-07-07  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * xdisp.c (display_line): Avoid warning about implicit declaration
+       of FRAME_FONT.
+
+       * frame.c (get_frame_param): Define only if HAVE_WINDOW_SYSTEM.
+
+       * lisp.h: Remove empty conditional.
+
+2012-07-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lread.c (load_path_check): Now static.
+
+       Fix some minor --with-ns problems found by static checking.
+       * frame.c (Ftool_bar_pixel_width) [!FRAME_TOOLBAR_WIDTH]:
+       (x_set_font) [!HAVE_X_WINDOWS]:
+       * image.c (xpm_load_image) [HAVE_NS]:
+       (x_to_xcolors) [!HAVE_X_WINDOWS && !HAVE_NTGUI]:
+       (x_disable_image) [!HAVE_NS && !HAVE_NTGUI]:
+       Remove unused local.
+       (Fx_parse_geometry) [HAVE_NS]: Don't return garbage.
+       (xpm_load_image) [HAVE_NS && !HAVE_XPM]: Remove unused label.
+       * image.c (x_create_bitmap_from_file) [HAVE_NS]:
+       (xpm_load_image, xpm_load) [HAVE_NS && !HAVE_XPM]:
+       * nsselect.m (symbol_to_nsstring, ns_string_to_pasteboard_internal):
+       * xfaces.c (Fx_load_color_file) [!HAVE_X_WINDOWS]:
+       Fix pointer signedness problem.
+       * xfaces.c (FRAME_X_FONT_TABLE):
+       * xterm.h (FRAME_X_FONT_TABLE): Remove unused, incompatible macros.
+
+2012-07-07  Glenn Morris  <rgm@gnu.org>
+
+       * lread.c (load_path_check): New function, split from init_lread.
+       (init_lread): Reorganize.  Motivation:
+       If EMACSLOADPATH is set, check/warn about that rather than the
+       defaults, which we are not going to use.  Hence we can remove
+       the turn_off_warning and WINDOWSNT || HAVE_NS tests.
+       Don't warn if site-lisp directories are missing.
+       If not installed, start from a blank load-path, since
+       PATH_LOADSEARCH refers to the eventual installation directories.
+
+2012-07-07  Eli Zaretskii  <eliz@gnu.org>
+
+       Support truncation and continuation glyphs on GUI frames, when
+       fringes are disabled.  (Bug#11832)
+       * xdisp.c (init_iterator): Get dimensions of truncation and
+       continuation glyphs even if on GUI frames.  Adjust
+       it->last_visible_x on GUI frames when the left or right fringes,
+       or both, are absent.
+       (start_display, move_it_in_display_line_to): Handle the case of a
+       GUI frame without a fringe to display continuation or truncation
+       glyphs.
+       (insert_left_trunc_glyphs): Support GUI frames: make sure
+       truncation glyphs overwrite enough glyphs from the current line to
+       have sufficient space in pixels.
+       (display_line): Support truncation and continuation glyphs on GUI
+       frames.  If some spare pixels are left on the line after inserting
+       the truncation glyphs, fill that space with a stretch glyph of a
+       suitably computed width.
+
+       * term.c (produce_special_glyphs): Call PRODUCE_GLYPHS, not
+       produce_glyphs, to support GUI sessions.
+
+2012-07-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sysdep.c (ULLONG_MAX): Define if not already defined (Bug#11781).
+
+       * sysdep.c (list_system_processes): Port to NetBSD-current (Bug#11797).
+
+       Do not require float-time's arg to fit in time_t (Bug#11825).
+       This works better on hosts where time_t is unsigned, and where
+       float-time is applied to the (negative) difference between two times.
+       * editfns.c (decode_time_components): Last arg is now double *,
+       not int *, and means to store all the result as a double, without
+       worrying about whether the seconds part fits in time_t.
+       All callers changed.
+       (lisp_time_argument): Remove last int * arg, as it's no longer needed.
+       All callers changed.
+       (Ffloat_time): Do not fail merely because the specified time falls
+       outside of time_t range.
+
+2012-07-07  Glenn Morris  <rgm@gnu.org>
+
+       * s/darwin.h (HAVE_RES_INIT, HAVE_LIBRESOLV):
+       * s/hpux10-20.h (HAVE_RINT, HAVE_RANDOM):
+       * s/unixware.h (HAVE_GETWD): Move undefs to configure (effectively).
+
+2012-07-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in (DISPEXTERN_H, $(BLD)/regex.$(O)):
+       Update dependencies.
+
+       * s/ms-w32.h [_MSC_VER]: Remove strcasecmp, strncasecmp.
+
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786).
+       * dispextern.h, nsfns.m, nsterm.m: Include <c-strcase.h>.
+       * dispextern.h (xstrcasecmp): Rewrite using c_strcasecmp.
+       * nsfns.m (x_get_string_resource): Use c_strncasecmp, not strncasecmp.
+       * nsterm.m (ns_default): Use c_strcasecmp, not strcasecmp.
+       * xfaces.c (xstrcasecmp) [!HAVE_STRCASECMP]: Remove.
+
+       * xfont.c (compare_font_names): Redo to omit the need for casts.
+
+2012-07-06  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * xfns.c (Fx_change_window_property): Doc fix.
+       * w32fns.c (Fx_change_window_property): Doc fix.
+
+       * w32fns.c (Fx_window_property): Accept the same arguments as the
+       X Windows version.  Doc fix.
+       * xfns.c (Fx_window_property): Doc fix.  (Bug#11870)
+
+2012-07-06  Juanma Barranquero  <lekktu@gmail.com>
+           Eli Zaretskii  <eliz@gnu.org>
+
+       * s/ms-w32.h: Settings not specific to Windows moved to nt/config.nt.
+       Windows-specific code from nt/config.nt moved here.
+       Obsolete settings removed.
+
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * process.c: Avoid unnecessary calls to gettime.
+       (wait_reading_process_output): Don't get the time of day
+       when gobbling data immediately and not waiting, as there's no need
+       for it in that case.  This removes a FIXME.
+
+2012-07-06  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * gtkutil.c (xg_event_is_for_scrollbar): Assign gwin when HAVE_GTK3
+       is defined (Bug#11768).
+
+2012-07-06  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Fix marker debugging code.
+       * marker.c (byte_char_debug_check): Do not perform the check
+       if buffer is not multibyte.
+       (buf_charpos_to_bytepos, buf_bytepos_to_charpos):
+       Call byte_char_debug_check with correct arguments.
+
+2012-07-06  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Compile marker debugging code only if ENABLE_CHECKING is defined.
+       * marker.c (byte_char_debug_check, count_markers):
+       Use only if ENABLE_CHECKING is defined.
+       (byte_debug_flag): Remove.
+       (CONSIDER, buf_charpos_to_bytepos, buf_bytepos_to_charpos):
+       Always call byte_char_debug_check if ENABLE_CHECKING is defined.
+
+2012-07-06  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Avoid code repetition in marker-related functions.
+       * marker.c (attach_marker): New function.
+       (Fset_marker, set_marker_restricted, set_marker_both)
+       (set_marker_restricted_both): Use it.
+       (Fset_marker, set_marker_restricted, Fbuffer_has_markers_at):
+       Consistently rename charno to charpos.
+       (marker_position): Add eassert.
+       (marker_byte_position): Convert to eassert.
+
+2012-07-06  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Simplify list operations in unchain_overlay and unchain_marker.
+       * buffer.c (unchain_overlay): Simplify.  Add comment.
+       * marker.c (unchain_marker): Simplify.  Fix comments.
+
+2012-07-06  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Introduce fast path for the widely used marker operation.
+       * alloc.c (build_marker): New function.
+       * lisp.h (build_marker): New prototype.
+       * buffer.c (clone_per_buffer_values, Fmake_indirect_buffer): Use it.
+       * composite.c (autocmp_chars): Likewise.
+       * editfns.c (buildmark): Remove.
+       (Fpoint_marker, Fpoint_min_marker, Fpoint_max_marker)
+       (save_restriction_save): Use build_marker.
+       * marker.c (buf_charpos_to_bytepos, buf_bytepos_to_charpos): Likewise.
+       * window.c (save_window_save): Likewise.
+
+2012-07-06  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Do not use Fdelete_overlay in delete_all_overlays
+       to avoid redundant calls to unchain_overlay.
+       * buffer.c (drop_overlay): New function.
+       (delete_all_overlays, Fdelete_overlay): Use it.
+       * minibuf.c (get_minibuffer): Fix comment.
+
+2012-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port to OpenBSD 5.1 amd64.
+       * sysdep.c [BSD_SYSTEM]: Include <sys/param.h> before <sys/sysctl.h>.
+       This is needed for OpenBSD, and should be harmless on all BSD systems.
+       Also, include <sys/sysctl.h>, as it should be available on all
+       BSD_SYSTEM hosts given that we're already calling sysctl in that case.
+       (list_system_processes) [__OpenBSD__]: Use DARWIN_OS style mib, but
+       use p_pid member, not kp_proc.pid.
+
+2012-07-06  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (emacs$(EXEEXT)): Don't check for load-path shadows.
+
+2012-07-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       More xmalloc and related cleanup.
+       * alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c:
+       * callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c:
+       * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c:
+       * font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c:
+       * gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c:
+       * nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c:
+       * regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c:
+       * sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c:
+       * xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c:
+       * xterm.c:
+       Omit needless casts involving void * pointers and allocation.
+       Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))",
+       as the former is more robust if P's type is changed.
+       Prefer xzalloc to xmalloc + memset 0.
+       Simplify malloc-or-realloc to realloc.
+       Don't worry about xmalloc returning a null pointer.
+       Prefer xstrdup to xmalloc + strcpy.
+       * editfns.c (Fmessage_box): Grow message_text by at least 80 when
+       growing it.
+       * keyboard.c (apply_modifiers_uncached): Prefer local array to
+       alloca of a constant.
+
+2012-07-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (display_line): Fix horizontal pixel coordinates when
+       hscroll is larger than the line width.  Fixes long and futile
+       looping inside extend_face_to_end_of_line (on a TTY) producing
+       glyphs that are not needed and thrown away.
+
+2012-07-05  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * marker.c (set_marker_restricted_both): Simplify by using
+       clip_to_bounds.
+
+2012-07-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * editfns.c (region_limit): Simplify by using clip_to_bounds.
+
+2012-07-05  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * gtkutil.c (gtk_scrollbar_new, gtk_box_new): Define when HAVE_GTK3 is
+       not defined (Bug#11768).
+       (xg_create_frame_widgets): Use gtk_plug_new_for_display (Bug#11768).
+       (xg_create_frame_widgets, create_dialog, xg_get_file_with_chooser)
+       (make_widget_for_menu_item, xg_make_tool_item): Use gtk_box_new
+       followed by gtk_box_set_homogeneous (Bug#11768).
+       (xg_update_menu_item): Use GTK_IS_BOX (Bug#11768).
+       (update_theme_scrollbar_width, xg_create_scroll_bar):
+       Use gtk_scrollbar_new (Bug#11768).
+       (xg_event_is_for_scrollbar): Use Gdk Device functions for HAVE_GTK3.
+       (is_box_type): New function (Bug#11768).
+       (xg_tool_item_stale_p): Call is_box_type.
+       (xg_initialize): Get settings by calling gtk_settings_get_for_screen
+       with default display (Bug#11768).
+
+2012-07-05  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (window_hscroll_limited): New function.
+       (pos_visible_p, init_iterator): Use it to avoid overflow of pixel
+       coordinates when window's hscroll is set to insanely large
+       values.  (Bug#11857)
+
+2012-07-05  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/dired.$(O), $(BLD)/fileio.$(O)): Fix typo.
+       ($(BLD)/terminal.$(O), $(BLD)/syntax.$(O)): Update dependencies.
+
+2012-07-05  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Cleanup xmalloc.
+       * lisp.h (xzalloc): New prototype.  Omit needless casts.
+       * alloc.c (xzalloc): New function.  Omit needless casts.
+       * charset.c: Omit needless casts.  Convert all calls to
+       xmalloc with following memset to xzalloc.
+       * dispnew.c: Likewise.
+       * fringe.c: Likewise.
+       * image.c: Likewise.
+       * sound.c: Likewise.
+       * term.c: Likewise.
+       * w32fns.c: Likewise.
+       * w32font.c: Likewise.
+       * w32term.c: Likewise.
+       * xfaces.c: Likewise.
+       * xfns.c: Likewise.
+       * xterm.c: Likewise.
+       * atimer.c: Omit needless casts.
+       * buffer.c: Likewise.
+       * callproc.c: Likewise.
+       * ccl.c: Likewise.
+       * coding.c: Likewise.
+       * composite.c: Likewise.
+       * doc.c: Likewise.
+       * doprnt.c: Likewise.
+       * editfns.c: Likewise.
+       * emacs.c: Likewise.
+       * eval.c: Likewise.
+       * filelock.c: Likewise.
+       * fns.c: Likewise.
+       * gtkutil.c: Likewise.
+       * keyboard.c: Likewise.
+       * lisp.h: Likewise.
+       * lread.c: Likewise.
+       * minibuf.c: Likewise.
+       * msdos.c: Likewise.
+       * print.c: Likewise.
+       * process.c: Likewise.
+       * region-cache.c: Likewise.
+       * search.c: Likewise.
+       * sysdep.c: Likewise.
+       * termcap.c: Likewise.
+       * terminal.c: Likewise.
+       * tparam.c: Likewise.
+       * w16select.c: Likewise.
+       * w32.c: Likewise.
+       * w32reg.c: Likewise.
+       * w32select.c: Likewise.
+       * w32uniscribe.c: Likewise.
+       * widget.c: Likewise.
+       * xdisp.c: Likewise.
+       * xmenu.c: Likewise.
+       * xrdb.c: Likewise.
+       * xselect.c: Likewise.
+
+2012-07-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * fileio.c (time_error_value): Check the right error number.
+       Problem reported by Troels Nielsen in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00095.html>.
+
+2012-07-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * window.c (set_window_hscroll): Revert the 100000 hscroll limit.
+       This should be fixed in a better way; see Eli Zaretskii in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00088.html>.
+       (HSCROLL_MAX): Remove; this is now internal to set_window_hscroll.
+
+       * fileio.c (time_error_value): Rename from special_mtime.
+       The old name's problems were noted by Eli Zaretskii in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00087.html>.
+
+       * emacs.c (gdb_pvec_type): Change it back to enum pvec_type.
+       This variable's comment says Emacs needs at least one GDB-visible
+       symbol of type enum pvec_type, to work around GDB problems.
+       The symbol's value doesn't matter.
+
+       * alloc.c (PSEUDOVECTOR_NBYTES): Remove stray ';'
+       that causes compilation to fail on pre-C99 compilers.
+
+2012-07-04  Juanma Barranquero  <lekktu@gmail.com>
+
+       * s/ms-w32.h (LISP_FLOAT_TYPE, HAVE_MEMCMP, HAVE_MEMCPY)
+       (HAVE_MEMMOVE, HAVE_MEMSET): Don't set, obsolete.
+
+2012-07-04  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * buffer.c (init_buffer_once): Fix initialization of
+       headers for buffer_defaults and buffer_local_symbols.
+       Reported by Juanma Barranquero <lekktu@gmail.com>.
+
+2012-07-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       Turn VECTOR_FREE_LIST_FLAG into PVEC_FREE.
+       * lisp.h (enum pvec_type): Use fewer bits.
+       (PSEUDOVECTOR_SIZE_BITS): New constant.
+       (PSEUDOVECTOR_SIZE_MASK, PVEC_TYPE_MASK): Use it.
+       (XSETPVECTYPESIZE, XSETTYPED_PSEUDOVECTOR, DEFUN): Adapt code to
+       change in pvec_type.
+       (PSEUDOVECTOR_TYPEP): New macro.
+       (TYPED_PSEUDOVECTORP): Use it.
+       * fns.c (internal_equal): Adapt code to extract pvectype.
+       * emacs.c (gdb_pvec_type): Update type.
+       * alloc.c (PSEUDOVECTOR_NBYTES): New macro.
+       (VECTOR_FREE_LIST_SIZE_MASK): Remove (=> PSEUDOVECTOR_SIZE_MASK).
+       (VECTOR_FREE_LIST_FLAG): Remove (=> PVEC_FREE).
+       (SETUP_ON_FREE_LIST): Use XSETPVECTYPESIZE.
+       (sweep_vectors): Use it.  Use local var `total_bytes' instead of
+       abusing vector->header.next.nbytes.
+       (live_vector_p): Use PVEC_TYPE.
+       (mark_object): Adapt code to extract pvectype.  Use switch.
+
+2012-07-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * doprnt.c (doprnt): Don't assume string length fits in 'int'.
+       Tighten new eassert a bit.
+
+2012-07-04  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Fix compilation with --enable-gcc-warnings and -O1
+       optimization level.
+       * doprnt.c (doprnt): Change type of tem to int, initialize
+       to avoid compiler warning.  Add eassert.
+       * search.c (simple_search): Initialize match_byte to avoid
+       compiler warning.  Add eassert.
+
+2012-07-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Avoid weird behavior with large horizontal scrolls.
+       Without this change, for example, large hscroll values would
+       mess up Emacs's display on Fedora 15 x86, presumably due to
+       overflows in int calculations in the display code.
+       Also, if buffers had long lines, Emacs would freeze.
+       * window.c (HSCROLL_MAX): Reduce to 100000, and make it visible to GDB.
+       (set_window_hscroll): New function, containing the old guts of
+       Fset_window_hscroll.  Return the clipped value.
+       (Fset_window_hscroll, Fscroll_left, Fscroll_right): Use it.
+       This avoids the need to check against PTRDIFF_MAX.
+
+       * buffer.c (Fgenerate_new_buffer_name): Fix sprintf format mismatch.
+
+2012-07-04  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * buffer.c (Fgenerate_new_buffer_name): Fix type mismatch.
+
+2012-07-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * regex.c: Suppress GCC warning on RHEL 6.  (Bug#11207)
+       Conditionalize the pragmas on GCC 4.5 or later, not GCC 4.3 or later,
+       since GCC 4.4.6 issues a bogus warning for them.
+
+       Fix bugs in file timestamp newness comparisons.
+       * fileio.c (Ffile_newer_than_file_p):
+       * lread.c (Fload): Use full timestamp resolution of files,
+       not just the 1-second resolution, so that files that are only
+       slightly newer still count as newer.
+       * fileio.c (Ffile_newer_than_file_p): Don't assume file
+       timestamps fit in 'int'; this fixes a Y2038 bug on most hosts.
+
+2012-07-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * fileio.c: Improve handling of file time marker.  (Bug#11852)
+       (special_mtime): New function.
+       (Finsert_file_contents, Fverify_visited_file_modtime):
+       Use it to set special mtime values consistently.
+
+2012-07-03  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * fileio.c (Finsert_file_contents): Properly handle st_mtime
+       marker for non-existing file.  (Bug#11852)
+
+2012-07-03  Glenn Morris  <rgm@gnu.org>
+
+       * lisp.h (Fread_file_name): Restore EXFUN (it's not a normal DEFUN
+       and did not make it into globals.h).
+
+2012-07-03  Tom Tromey  <tromey@redhat.com>
+
+       * window.c (Fset_window_margins, Fset_window_fringes)
+       (Fset_window_scroll_bars, Fset_window_vscroll): No longer static.
+       * textprop.c (Fprevious_property_change): No longer static.
+       * syntax.c (Fsyntax_table_p): No longer static.
+       * process.c (Fget_process, Fprocess_datagram_address): No longer
+       static.
+       * keymap.c (Flookup_key, Fcopy_keymap): No longer static.
+       * keyboard.c (Fcommand_execute): No longer static.
+       Remove EXFUN.
+       * insdel.c (Fcombine_after_change_execute): No longer static.
+       * image.c (Finit_image_library): No longer static.
+       * fileio.c (Fmake_symbolic_link): No longer static.
+       * eval.c (Ffetch_bytecode): No longer static.
+       * editfns.c (Fuser_full_name): No longer static.
+       * doc.c (Fdocumentation_property, Fsnarf_documentation):
+       No longer static.
+       * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): No longer
+       static.
+       * dired.c (Ffile_attributes): No longer static.
+       * composite.c (Fcomposition_get_gstring): No longer static.
+       * callproc.c (Fgetenv_internal): No longer static.
+
+       * ccl.h: Remove EXFUNs.
+       * buffer.h: Remove EXFUNs.
+       * dispextern.h: Remove EXFUNs.
+       * intervals.h: Remove EXFUNs.
+       * fontset.h: Remove EXFUN.
+       * font.h: Remove EXFUNs.
+       * dosfns.c (system_process_attributes): Remove EXFUN.
+       * keymap.h: Remove EXFUNs.
+       * lisp.h: Remove EXFUNs.
+       * w32term.h: Remove EXFUNs.
+       * window.h: Remove EXFUNs.
+       * xsettings.h: Remove EXFUN.
+       * xterm.h: Remove EXFUN.
+
+2012-07-03  Glenn Morris  <rgm@gnu.org>
+
+       * lisp.h (Frandom): Make it visible to C.
+       * buffer.c (Fgenerate_new_buffer_name): Speed up finding a new
+       buffer for invisible buffers.  (Bug#1229)
+
+2012-07-03  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Fix block vector allocation code to allow VECTOR_BLOCK_SIZE
+       values which aren't power of 2.
+       * alloc.c (VECTOR_FREE_LIST_SIZE_MASK): New macro.  Verify
+       it's value and the value of VECTOR_BLOCK_SIZE.  Adjust users
+       accordingly.
+
+2012-07-03  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * lisp.h (Lisp_Misc, Lisp_Fwd): Move around to group better.
+
+       * alloc.c (mark_object): Revert part of last patch to use `switch'.
+
+2012-07-03  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (allocate_vector_block): Remove redundant
+       calls to mallopt if DOUG_LEA_MALLOC is defined.
+       (allocate_vectorlike): If DOUG_LEA_MALLOC is defined,
+       avoid calls to mallopt if zero_vector is returned.
+
+2012-07-03  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (check_string_bytes): If GC_CHECK_STRING_BYTES
+       is enabled, avoid dereferencing NULL current_sblock if
+       running undumped.
+
+2012-07-03  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Cleanup basic buffer management.
+       * buffer.h (struct buffer): Change layout to use generic vector
+       marking code.  Fix some comments.  Change type of 'clip_changed'
+       to bitfield.  Remove unused #ifndef old.
+       (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER): Remove.
+       (GET_OVERLAYS_AT): Fix indentation.
+       (for_each_per_buffer_object_at): New macro.
+       * buffer.c (clone_per_buffer_values, reset_buffer_local_variables)
+       (Fbuffer_local_variables): Use it.
+       (init_buffer_once, syms_of_buffer): Remove unused #ifndef old.
+       * alloc.c (allocate_buffer): Adjust to match new layout of
+       struct buffer.  Fix comment.
+       (mark_overlay): New function.
+       (mark_buffer): Use it.  Use mark_vectorlike to mark normal
+       Lisp area of struct buffer.
+       (mark_object): Use it.  Adjust marking of misc objects
+       and related comments.
+
+2012-07-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * alloc.c (mark_object): Remove "#ifdef GC_CHECK_MARKED_OBJECTS"
+       wrapper that is not needed because the wrapped code is a no-op (zero
+       machine instructions) when GC_CHECK_MARKED_OBJECTS is not defined.
+       This avoids a -Wunused-macros diagnostic with GCC 4.7.1 x86-64.
+
+2012-07-02  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (mark_buffer): Simplify.  Remove prototype.
+       (mark_object): Add comment.  Reorganize marking of vector-like
+       objects.  Use CHECK_LIVE for all vector-like objects except buffers
+       and subroutines when GC_CHECK_MARKED_OBJECTS is defined.  Avoid
+       redundant calls to mark_vectorlike for bool vectors.
+
+2012-06-30  Glenn Morris  <rgm@gnu.org>
+
+       * nsterm.m (ns_init_paths): Ignore site-lisp if --no-site-lisp.
+
+       * epaths.in (PATH_SITELOADSEARCH): New.
+       * lread.c (init_lread): Use PATH_SITELOADSEARCH.
+       This is rather than relying on --enable-locallisppath elements
+       having "site-lisp" in their names.  (Bug#10208#25, 11658)
+
+2012-06-30  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32proc.c (sys_select): Accept and ignore one more argument.
+
+       * w32.c (emacs_gnutls_pull): Call select with one more argument.
+
+       * sysselect.h [DOS_NT]: Don't include sys/select.h.
+       (pselect) [!MS_DOS]: Redirect to sys_select.
+
+       * sysdep.c: Don't include dos.h and dosfns.h.
+
+       * process.c (sys_select):
+       * msdos.c (sys_select): Accept one more argument and ignore it.
+
+       * msdos.c (event_timestamp, sys_select): Use gnulib's gettime;
+       adapt data types and code to that.
+
+       * dosfns.c:
+       * msdos.c (gettime, settime): Define away the prototypes in dos.h,
+       which clashes with the gnulib function of the same name.
+
+2012-06-30  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * font.c (font_style_to_value, font_style_symbolic)
+       (font_prop_validate_style): Add type checks for values in
+       font_style_table.
+
+       * lisp.h (CHECK_RANGED_INTEGER): Make value to check the first
+       argument.
+       * character.c, charset.c, menu.c, process.c, window.c: Adjust all
+       uses.
+
+2012-06-29  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (try_window_id): Undo last change.
+
+       * w32.c (getwd): Adjust commentary about startup_dir.
+       (init_environment): Always call sys_access, even in non-MSVC
+       builds.  Don't chdir to the directory of the Emacs executable.
+       This undoes code from 1997 which was justified by the need to
+       "avoid conflicts when removing and renaming directories".  But its
+       downside was that every relative file name was being interpreted
+       relative to the directory of the Emacs executable, which can never
+       be TRT.  In particular, it broke sys_access when called with
+       relative file names.
+       (sys_access): Map GetLastError to errno.
+
+2012-06-29  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * window.h (struct window): Change type of 'fringes_outside_margins'
+       to bitfield.  Fix comment.  Adjust users accordingly.
+       (struct window): Change type of 'window_end_bytepos' to ptrdiff_t.
+       Adjust comment.
+       * xdisp.c (try_window_id): Change type of 'first_vpos' and 'vpos'
+       to ptrdiff_t.
+
+2012-06-29  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * gnutls.c (emacs_gnutls_handshake):
+       Add QUIT to make the loop interruptible.
+
+2012-06-29  Glenn Morris  <rgm@gnu.org>
+
+       * charset.c (init_charset): Make lack of etc/charsets fatal.
+
+2012-06-29  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * editfns.c (region_limit): Fix type mismatch.
+
+2012-06-29  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * nsfns.m: Fix GLYPH_DEBUG usage assuming that it may be
+       undefined.  Convert from xassert to eassert.
+       * nsmenu.m: Convert from xassert to eassert.
+       * nsterm.m: Likewise.
+
+2012-06-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * editfns.c (region_limit): Clip to narrowing (bug#11770).
+
+2012-06-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Avoid integer overflow on scroll-left and scroll-right.
+       * window.c (HSCROLL_MAX): New macro.
+       (Fscroll_left, Fscroll_right): Avoid undefined behavior on integer
+       overflow when requested scroll falls outside ptrdiff_t range.
+
+2012-06-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * window.h (struct window): Change type of 'hscroll',
+       'min_hscroll' and 'last_point' from Lisp_Object to ptrdiff_t,
+       'last_modified' and 'last_overlay_modified' to EMACS_INT.
+       Adjust users accordingly.
+       * xdisp.c (try_cursor_movement): Replace type check with eassert.
+       * window.c (Fscroll_left, Fscroll_right): Change type of 'hscroll'
+       from EMACS_INT to ptrdiff_t.
+       (make_window): Omit redundant initialization.
+
+2012-06-28  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/regex.$(O)): Update dependencies.
+
+2012-06-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * window.h (struct window): Change type of 'use_time' and
+       'sequence_number' from Lisp_Object to int.
+       * frame.c (make_frame): Adjust users accordingly.
+       * print.c (print_object): Likewise.
+       * window.c (select_window, Fwindow_use_time, make_parent_window)
+       (make_window): Likewise.
+
+2012-06-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * dispextern.h (GLYPH_DEBUG): Now defined in config.h if
+       enabled with --enable-checking=[all,glyphs] configure option.
+       Fix GLYPH_DEBUG usage assuming that it may be undefined,
+       adjust comments accordingly.
+       * dispnew.c: Fix GLYPH_DEBUG usage assuming that it may be
+       undefined, adjust comments accordingly.
+       * image.c: Likewise.
+       * scroll.c: Likewise.
+       * w32fns.c: Likewise.
+       * w32term.c: Likewise.
+       * xdisp.c: Likewise.
+       * xfaces.c: Likewise.
+       * xfns.c: Likewise.
+       * xterm.c: Likewise.
+
+2012-06-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Generalize run-time debugging checks.
+       * dispextern.h (XASSERTS): Remove.
+       * fontset.c (xassert): Remove.
+       Convert from xassert to eassert.
+       * alloc.c: Convert from xassert to eassert.
+       * bidi.c: Likewise.
+       * dispnew.c: Likewise.
+       * fns.c: Likewise.
+       * fringe.c: Likewise.
+       * ftfont.c: Likewise.
+       * gtkutil.c: Likewise.
+       * image.c: Likewise.
+       * keyboard.c: Likewise.
+       * menu.c: Likewise.
+       * process.c: Likewise.
+       * scroll.c: Likewise.
+       * sound.c: Likewise.
+       * term.c: Likewise.
+       * w32console.c: Likewise.
+       * w32fns.c: Likewise.
+       * w32term.c: Likewise.
+       * window.c: Likewise.
+       * xdisp.c: Likewise.
+       * xfaces.c: Likewise.
+       * xfns.c: Likewise.
+       * xselect.c: Likewise.
+       * xterm.c: Likewise.
+
+2012-06-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * fns.c (maybe_resize_hash_table): Output message when growing the
+       purify-hashtable.
+
+2012-06-27  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (allocate_string_data): Remove dead code.
+       * xsettings.c (XSETTINGS_FONT_NAME): Move under HAVE_XFT to
+       avoid GCC warning about unused macro.
+
+2012-06-27  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (allocate_string): Omit intervals initialization.
+       * alloc.c (make_uninit_multibyte_string): Initialize intervals
+       as in make_pure_string and make_pure_c_string.
+
+2012-06-27  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (allocate_string): Fix last change.
+
+2012-06-27  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (allocate_string): Remove two redundant calls
+       to memset, add explicit initialization where appropriate.
+
+2012-06-27  Glenn Morris  <rgm@gnu.org>
+
+       * lisp.mk (lisp): Remove paths.elc.
+
+2012-06-27  Chong Yidong  <cyd@gnu.org>
+
+       * doc.c (Fsubstitute_command_keys): Fix punctuation.
+
+2012-06-26  John Wiegley  <johnw@newartisans.com>
+
+       * unexmacosx.c (copy_data_segment): Add two section names used
+       on Mac OS X Lion: __mod_init_func and __mod_term_func.
+
+       * alloc.c (mark_memory): Do not check with -faddress-sanitizer
+       when building with Clang.
+
+2012-06-26  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (Fapply): Allow calling it with a single argument.
+
+2012-06-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * s/ms-w32.h (strcasecmp, strncasecmp) [_MSC_VER]: Redirect to
+       _stricmp and _strnicmp.
+       (HAVE_STRCASECMP, HAVE_STRNCASECMP): Define to 1.
+
+2012-06-26  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c (allocate_window): Zero out non-Lisp part of newly
+       allocated window.
+       (allocate_process): Likewise for new process.
+       (allocate_terminal): Change to use offsetof.
+       (allocate_frame): Likewise.
+       * frame.c (make_frame): Omit redundant initialization.
+       * window.c (make_parent_window): Use memset.
+       (make_window): Omit redundant initialization.
+       * process.c (make_process): Omit redundant initialization.
+       * terminal.c (create_terminal): Likewise.
+
+2012-06-26  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * term.c (delete_tty): Remove redundant call to memset.
+
+2012-06-26  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c: Remove build_string.
+       * lisp.h: Define build_string as static inline.  This provides
+       a better opportunity to optimize away calls to strlen when the
+       function is called with compile-time constant argument.
+       * image.c (imagemagick_error): Convert to build_string.
+       * w32proc.c (sys_spawnve): Likewise.
+       * xterm.c (x_term_init): Likewise.
+
+2012-06-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Use sprintf return value instead of invoking strlen on result.
+       In the old days this wasn't portable, since some sprintf
+       implementations returned char *.  But they died out years ago and
+       Emacs already assumes sprintf returns int.
+       Similarly for float_to_string.
+       This patch speeds up (number-to-string 1000) by 3% on Fedora 15 x86-64.
+       * ccl.c (ccl_driver):
+       * character.c (string_escape_byte8):
+       * data.c (Fnumber_to_string):
+       * doprnt.c (doprnt):
+       * print.c (print_object):
+       * xdisp.c (message_dolog):
+       * xfns.c (syms_of_xfns):
+       Use sprintf or float_to_string result to avoid need to call strlen.
+       * data.c (Fnumber_to_string):
+       Use make_unibyte_string, since the string must be ASCII.
+       * lisp.h, print.c (float_to_string): Now returns int length.
+       * term.c (produce_glyphless_glyph):
+       Use sprintf result rather than recomputing it.
+
+       Clean out last vestiges of the old HAVE_CONFIG_H stuff.
+       * Makefile.in (ALL_CFLAGS):
+       * makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H.
+       * gmalloc.c, regex.c: Include <config.h> unconditionally.
+
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * dispextern.h (xstrcasecmp): Define to library function
+       strcasecmp if available.
+       * xfaces.c: Do not use xstrcasecmp if strcasecmp is available.
+
+2012-06-25  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * keyboard.c (menu_bar_items, menu_bar_item, read_key_sequence):
+       Avoid comma operator.
+       * menu.c (push_submenu_start, push_submenu_end)
+       (push_left_right_boundary, push_menu_pane): Likewise.
+       * msdos.c (dos_rawgetc): Likewise.
+
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * xfns.c (xic_create_fontsetname): Remove redundant calls
+       to memset.
+
+2012-06-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * gtkutil.c (get_utf8_string): Remove redundant assignment.
+       sprintf already null-terminates its output.
+
+       * xfns.c (x_window): Remove redundant cast.
+
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * xmenu.c (xmenu_show, xdialog_show): Explicit cast from
+       `const char *' to `char *' to avoid compiler warning.
+
+2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * xterm.c (x_term_init): Build proper-sized _XSETTINGS_Snnn string
+       instead of truncating it to 63 (admittedly a generous limit).
+
+       * process.c: Fix spelling and caps in comments.
+
+2012-06-24  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * emacs.c (setpgrp): Remove definition, unused.
+       * sysdep.c (setpgrp): Remove definition, not used in this file.
+
+2012-06-24  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in: Update dependencies.
+
+2012-06-24  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in (TIMESPEC_H): Remove nt/inc/sys/time.h.
+       (SYSTIME_H): Add nt/inc/sys/time.h.
+
+       * systime.h [WINDOWSNT]: Include sys/time.h.
+
+       * s/ms-w32.h (struct timespec): Definition moved from
+       nt/inc/sys/time.h.  Suggested by Paul Eggert <eggert@cs.ucla.edu>.
+
+2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
+       * buffer.h (buffer_slot_type_mismatch):
+       * data.c (arith_error) [!FORWARD_SIGNAL_TO_MAIN_THREAD]:
+       * eval.c (unwind_to_catch):
+       * image.c (my_png_error, my_error_exit):
+       * keyboard.c (quit_throw_to_read_char, user_error)
+       (Fexit_recursive_edit, Fabort_recursive_edit):
+       * lisp.h (die, args_out_of_range, args_out_of_range_3)
+       (wrong_type_argument, buffer_overflow, __executable_start)
+       (memory_full, buffer_memory_full, string_overflow, Fthrow)
+       (xsignal, xsignal0, xsignal1, xsignal2, xsignal3, signal_error)
+       (error, verror, nsberror, report_file_error, Ftop_level, Fkill_emacs)
+       (fatal):
+       (child_setup) [!DOS_NT]:
+       * lread.c (end_of_file_error, invalid_syntax):
+       * process.c (send_process_trap) [!FORWARD_SIGNAL_TO_MAIN_THREAD]:
+       * puresize.h (pure_write_error):
+       * search.c (matcher_overflow):
+       * sound.c (sound_perror, alsa_sound_perror):
+       * sysdep.c, syssignal.h (croak):
+       * term.c (maybe_fatal, vfatal):
+       * textprop.c (text_read_only):
+       * undo.c (user_error):
+       * unexmacosx.c (unexec_error):
+       * xterm.c (x_ins_del_lines, x_delete_glyphs):
+       Use _Noreturn rather than NO_RETURN.
+       No need for separate decl merely because of _Noreturn.
+       * sound.c (sound_warning, parse_sound):
+       Remove unnecessary forward decls.
+
+2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix bug when time_t is unsigned and as wide as intmax_t (Bug#9000).
+       * lisp.h (WAIT_READING_MAX): New macro.
+       * dispnew.c (Fsleep_for, sit_for):
+       * keyboard.c (kbd_buffer_get_event):
+       * process.c (Faccept_process_output):
+       Use it to avoid bogus compiler warnings with obsolescent GCC versions.
+       This improves on the previous patch, which introduced a bug
+       when time_t is unsigned and as wide as intmax_t.
+       See <http://bugs.gnu.org/9000#51>.
+
+2012-06-23  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (sit_for, Fsleep_for):
+       * keyboard.c (kbd_buffer_get_event):
+       * process.c (Faccept_process_output): Avoid compiler warnings when
+       comparing a 32-bit time_t with a 64-bit INTMAX_MAX.
+
+2012-06-23  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in: Update dependencies.
+
+       * w32.c (ltime): Add return type and declare static.
+       (w32_get_internal_run_time): Remove usused variable `time_100ns'.
+
+2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sysdep.c [__FreeBSD__]: Fix more recently-introduced typos.
+       Privately reported by Herbert J. Skuhra.
+       (make_lisp_timeval) [__FreeBSD__]: Rename from TIMELIST.
+       All uses changed.
+       (system_process_attributes) [__FreeBSD__]: Invoke make_lisp_time,
+       not make_lisp_timeval, when the argument is of type EMACS_TIME.
+
+2012-06-23  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32proc.c (Fw32_get_locale_info): Fix an off-by-one error in
+       last argument of make_unibyte_string.
+
+       * keyboard.c (kbd_buffer_get_event): Include the codepage and the
+       language ID in the event parameters.
+
+       * w32term.c (w32_read_socket): Put the new keyboard codepage into
+       event.code, not the obscure "character set ID".
+
+2012-06-23  Chong Yidong  <cyd@gnu.org>
+
+       * xmenu.c (x_menu_wait_for_event): Adapt GTK3 to new xg_select.
+
+2012-06-23  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix the MS-Windows build broken by 2012-06-22T21:17:42Z!eggert@cs.ucla.edu.
+       * w32.c (fdutimens): New function.
+
+       * w32proc.c (sys_select): Adapt to change in the EMACS_TIME type.
+
+       * s/ms-w32.h (pselect): Redirect to sys_select.
+
+       * sysselect.h [WINDOWSNT]: Don't include sys/select.h.
+
+       * ralloc.c (r_alloc_inhibit_buffer_relocation): Fix stupid thinko
+       in the logic of incrementing and decrementing the value of
+       use_relocatable_buffers.
+
+2012-06-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sysdep.c [__FreeBSD__]: Fix recently-introduced typos.
+       Privately reported by Herbert J. Skuhra.
+       [__FreeBSD__]: Remove "*/" typo after "#include".
+       (timeval_to_EMACS_TIME) [__FreeBSD__]: New static function.
+       (TIMEVAL) [__FreeBSD__]: Now a static function rather than a macro.
+       (TIMEVAL, system_process_attributes) [__FreeBSD__]:
+       Don't assume EMACS_TIME and struct timeval are the same type.
+
+2012-06-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Support higher-resolution time stamps (Bug#9000).
+       The time stamps are only nanosecond-resolution at the C level,
+       since that's the best that any real-world system supports now.
+       But they are picosecond-resolution at the Lisp level, as that's
+       easy, and leaves room for future OS improvements.
+
+       * Makefile.in (LIB_CLOCK_GETTIME): New macro.
+       (LIBES): Use it.
+
+       * alloc.c (Fgarbage_collect): Port to higher-res time stamps.
+       Don't get current time unless it's needed.
+
+       * atimer.c: Include <sys/time.h> unconditionally, since gnulib
+       now provides it if it's absent.
+       (start_atimer): Port to higher-res time stamps.
+       Check for time stamp overflow.  Don't get current time more
+       often than is needed.
+
+       * buffer.h (struct buffer): Buffer modtime now has high resolution.
+       Include systime.h, not time.h.
+       (NONEXISTENT_MODTIME_NSECS, UNKNOWN_MODTIME_NSECS): New macros.
+
+       * dired.c: Include stat-time.h.
+       (Ffile-attributes): File times now have higher resolution.
+
+       * dispextern.h [HAVE_WINDOW_SYSTEM]: Include systime.h.
+       (struct image): Timestamp now has higher resolution.
+
+       * dispnew.c (PERIODIC_PREEMPTION_CHECKING): Remove, as Emacs always
+       has at least microseconds now.  All uses removed.
+       (update_frame, update_single_window, update_window, update_frame_1)
+       (Fsleep_for, sit_for): Port to higher-resolution time stamps.
+
+       * editfns.c (time_overflow): Now extern.
+       (Fcurrent_time, Fget_internal_run_time, make_time, lisp_time_argument)
+       (float-time, Fformat_time_string, Fcurrent_time_string)
+       (Fcurrent_time_zone): Accept and generate higher-resolution
+       time stamps.
+       (make_time_tail, make_lisp_time, dissassemble_lisp_time)
+       (decode_time_components, lisp_seconds_argument): New functions.
+       (make_time): Now static.
+       (lisp_time_argument): Now returns EMACS_TIME.  New arg ppsec.
+       Report an error if the time is invalid, rather than having the caller
+       do that.
+
+       * fileio.c: Include <stat-time.h>
+       (Fcopy_file): Copy higher-resolution time stamps.
+       Prefer to set the time stamp via a file descriptor if that works.
+       (Fset_file_times, Finsert_file_contents, Fwrite_region)
+       (Fverify_visited_file_modtime, Fclear_visited_file_modtime)
+       (Fvisited_file_modtime, Fset_visited_file_modtime):
+       Support higher-resolution time stamps.
+
+       * fns.c (Frandom): Use nanoseconds, not microseconds, for seed.
+
+       * gtkutil.c (xg_maybe_add_timer): Port to higher-res time stamps.
+
+       * image.c (prepare_image_for_display, clear_image_cache)
+       (lookup_image): Port to higer-resolution time stamps.
+
+       * keyboard.c (start_polling, bind_polling_period):
+       Check for time stamp overflow.
+       (read_char, kbd_buffer_get_event, timer_start_idle)
+       (timer_stop_idle, timer_resume_idle, timer_check_2, timer_check)
+       (Fcurrent_idle_time, init_keyboard, set_waiting_for_input):
+       Port to higher-resolution time stamps.  Do not assume time_t is signed.
+       (decode_timer): New function.  Timers are now vectors of length 9,
+       not 8, to accommodate the picosecond component.
+       (timer_check_2): Use it.
+
+       * nsterm.m (select_timeout, timeval_subtract): Remove.
+       (ns_timeout): Use Emacs's facilities for time stamp arithmetic,
+       as they're a bit more accurate and handle overflow better.
+       (ns_select): Change prototype to be compatible with pselect.
+       (ns_select, ns_term_shutdown): Port to ns-resolution time stamps.
+       * nsterm.h (ns_select): Adjust prototype.
+
+       * msdos.c (EMACS_TIME_ZERO_OR_NEG_P): Remove, as it assumes
+       us-resolution time stamps.
+       (sys_select): Use the new EMACS_TIME_SIGN macro instead.
+
+       * lread.c (read_filtered_event): Port to ns-resolution time stamps.
+
+       * lisp.h (time_overflow): New decl.
+       (wait_reading_process_output): First arg is now intmax_t, not int,
+       to accommodate larger waits.
+
+       * process.h (struct Lisp_Process.read_output_delay):
+       Now counts nanoseconds, not microseconds.
+       * process.c (ADAPTIVE_READ_BUFFERING): Don't worry about
+       EMACS_HAS_USECS.
+       (READ_OUTPUT_DELAY_INCREMENT, Faccept_process_output)
+       (wait_reading_process_output):
+       Port to ns-resolution time stamps.
+       (Faccept_process_output, wait_reading_process_output):
+       Check for time stamp overflow.  Do not assume time_t is signed.
+       (select_wrapper): Remove; we now use pselect.
+       (Fprocess_attributes): Now generates ns-resolution time stamps.
+
+       * sysdep.c: Include utimens.h.  Don't include utime.h
+       or worry about struct utimbuf; gnulib does that for us now.
+       (gettimeofday): Remove; gnulib provides a substitute.
+       (make_timeval): New function.
+       (set_file_times): Now sets ns-resolution time stamps.
+       New arg FD; all uses changed.
+       (time_from_jiffies, ltime_from_jiffies, get_up_time)
+       (system_process_attributes):
+       Now returns ns-resolution time stamp.  All uses changed.
+       Check for time stamp overflow.
+
+       * sysselect.h: Don't depend on HAVE_SYS_SELECT_H; gnulib
+       provides a substitute now.
+
+       * systime.h: Include timespec.h rather than sys/time.h and time.h,
+       since it guarantees struct timespec.
+       (EMACS_TIME): Now struct timespec, so that we can support
+       ns-resolution time stamps.
+       (EMACS_TIME_RESOLUTION, LOG10_EMACS_TIME_RESOLUTION): New macros.
+       (EMACS_HAS_USECS): Remove; Emacs always has sub-second time stamps now.
+       (EMACS_USECS): Remove.
+       (EMACS_SET_USECS): The underlying time stamp now has ns resolution,
+       so multiply the arg by 1000 before storing it.
+       (EMACS_NSECS, EMACS_SECS_ADDR, EMACS_SET_NSECS, EMACS_SET_SECS_NSECS):
+       New macros.
+       (EMACS_GET_TIME, EMACS_ADD_TIME, EMACS_SUB_TIME):
+       Port to ns-resolution time stamps.
+       (EMACS_TIME_NEG_P): Remove; replaced by....
+       (EMACS_TIME_SIGN): New macro.
+       (EMACS_SET_INVALID_TIME, EMACS_TIME_VALID_P)
+       (EMACS_TIME_FROM_DOUBLE, EMACS_TIME_TO_DOUBLE): New macros.
+       (set_file_times, make_time, lisp_time_argument): Adjust signature.
+       (make_timeval, make_lisp_time, decode_time_components): New decls.
+       (EMACS_TIME_CMP): Remove; no longer used.  Plus, it was buggy, in
+       that it mishandled time_t overflow.  You can't compare by subtracting!
+       (EMACS_TIME_EQ, EMACS_TIME_NE, EMACS_TIME_GT, EMACS_TIME_GE)
+       (EMACS_TIME_LT, EMACS_TIME_LE): Rewrite in terms of timespec_cmp.
+
+       * term.c: Include <sys/time.h>.
+       (timeval_to_Time): New function, for proper overflow wraparound.
+       (term_mouse_position, term_mouse_click): Use it.
+
+       * undo.c (record_first_change): Support higher-resolution time stamps
+       in the undo buffer.
+       (Fprimitive_undo): Use them when restoring time stamps.
+
+       * w32.c (ltime, U64_TO_LISP_TIME, process_times, emacs_gnutls_pull)
+       (w32_get_internal_run_time):
+       Port to higher-resolution Emacs time stamps.
+       (ltime): Now accepts single 64-bit integer, as that's more convenient
+       for callers.
+
+       * xdisp.c (start_hourglass): Port to ns-resolution time stamps.
+
+       * xgselect.c, xgselect.h (xg_select): Add sigmask argument,
+       for compatibility with pselect.  Support ns-resolution time stamps.
+
+       * xmenu.c (x_menu_wait_for_event): Support ns-resolution time stamps.
+
+       * xselect.c (wait_for_property_change, x_get_foreign_selection):
+       Check for time stamp overflow, and support ns-resolution time stamps.
+
+       * xterm.c: Don't include sys/time.h; gnulib does that for us now.
+       Don't worry about whether HAVE_TIMEVAL and HAVE_SELECT are set.
+       (timeval_subtract): Remove; no longer needed.
+       (XTflash, XTring_bell, x_wait_for_event):
+       Port to ns-resolution time stamps.  Don't assume time_t is signed.
+
+2012-06-22  Chong Yidong  <cyd@gnu.org>
+
+       * xdisp.c (x_consider_frame_title): Revert last change.
+
+2012-06-22  Eli Zaretskii  <eliz@gnu.org>
+
+       * alloc.c (NSTATICS): Enlarge to 0x650.  Otherwise, Emacs compiled
+       with -DENABLE_CHECKING -DXASSERTS -DGLYPH_DEBUG=1 -DBYTE_CODE_METER
+       aborts in staticpro during startup.  (Without -DBYTE_CODE_METER,
+       staticidx goes up to 1597 out of 1600 = 0x640.)
+
+2012-06-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * fileio.c (Fdefault_file_modes): Block input while fiddling with umask.
+       Otherwise, the umask might be mistakenly 0 while handling input signals.
+
+2012-06-19  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * minibuf.c (Fread_string): Bind minibuffer-completion-table.
+
+2012-06-19  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * alloc.c, bytecode.c, ccl.c, coding.c, composite.c, data.c, dosfns.c:
+       * font.c, image.c, keyboard.c, lread.c, menu.c, minibuf.c, msdos.c:
+       * print.c, syntax.c, window.c, xmenu.c, xselect.c: Replace direct
+       access to `contents' member of Lisp_Vector objects with AREF and ASET
+       where appropriate.
+
+2012-06-19  Chong Yidong  <cyd@gnu.org>
+
+       * frame.c (delete_frame): When selecting a frame on a different
+       text terminal, do not alter the terminal's top-frame.
+
+       * xdisp.c (format_mode_line_unwind_data): Record the target
+       frame's selected window and its terminal's top-frame.
+       (unwind_format_mode_line): Restore them.
+       (x_consider_frame_title, display_mode_line, Fformat_mode_line):
+       Callers changed.
+       (x_consider_frame_title): Do not condition on HAVE_WINDOW_SYSTEM,
+       since tty frames can be explicitly named.
+       (prepare_menu_bars): Likewise.
+
+       * term.c (Ftty_top_frame): New function.
+
+2012-06-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port byte-code-meter to modern targets.
+       * bytecode.c (METER_CODE) [BYTE_CODE_METER]: Don't assume
+       !CHECK_LISP_OBJECT_TYPE && !USE_LSB_TAG.  Problem with
+       CHECK_LISP_OBJECT_TYPE reported by Dmitry Antipov in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00282.html>.
+       (METER_1, METER_2): Simplify.
+
+2012-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * data.c (Fdefalias): Return `symbol' (bug#11686).
+
+2012-06-18  Martin Rudalics  <rudalics@gmx.at>
+
+       * buffer.c (Fkill_buffer): Don't throw an error when the buffer
+       gets killed during executing of this function (Bug#11665).
+       Try to always return Qt when the buffer has been actually killed.
+       (Vkill_buffer_query_functions): In doc-string say that functions
+       run by this hook should not change the current buffer.
+
+2012-06-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix recently-introduced process.c problems found by static checking.
+       * process.c (write_queue_push, write_queue_pop, send_process):
+       Use ptrdiff_t, not int or EMACS_INT, for buffer lengths and offsets.
+       (write_queue_pop): Fix pointer signedness problem.
+       (send_process): Remove unused local.
+
+2012-06-17  Chong Yidong  <cyd@gnu.org>
+
+       * xdisp.c (redisplay_internal): No need to redisplay terminal
+       frames that are not on top.
+
+2012-06-17  Troels Nielsen  <bn.troels@gmail.com>
+
+       * process.c (make_process): Initialize write_queue.
+       (write_queue_push, write_queue_pop): New functions.
+       (send_process): Use them to maintain correct ordering of process
+       writes (Bug#10815).
+
+2012-06-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lisp.h (eassert): Assume C89 or later.
+       This removes the need for CHECK.
+       (CHECK): Remove.  Its comments about always evaluating its
+       argument were confusing, as 'eassert' typically does not evaluate
+       its argument.
+
+       * coding.c (produce_chars): Use ptrdiff_t, not int.
+
+       * xterm.c (x_draw_underwave): Check for integer overflow.
+       This pacifies gcc 4.7.0 -Wunsafe-loop-optimizations on x86-64.
+
+2012-06-17  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (x_free_frame_resources): Move xfree so freed memory isn't
+       referenced (Bug#11583).
+
+2012-06-16  Aurelien Aptel  <aurelien.aptel@gmail.com>
+
+       Implement wave-style variant of underlining.
+       * dispextern.h (face_underline_type): New enum.
+       (face): Add field for underline type.
+       * nsterm.m (ns_draw_underwave): New function.
+       (ns_draw_text_decoration): Use it.
+       * w32term.c (w32_restore_glyph_string_clip, w32_draw_underwave):
+       New functions.
+       (x_draw_glyph_string): Use them.
+       * xfaces.c (Qline, Qwave): New Lisp objects.
+       (check_lface_attrs, merge_face_ref)
+       (Finternal_set_lisp_face_attribute, realize_x_face):
+       Handle wave-style underline face attributes.
+       * xterm.c (x_draw_underwave): New function.
+       (x_draw_glyph_string): Use it.
+
+2012-06-16  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/emacs.$(O), $(BLD)/fringe.$(O))
+       ($(BLD)/xml.$(O), $(BLD)/intervals.$(O), $(BLD)/macros.$(O))
+       ($(BLD)/minibuf.$(O), $(BLD)/regex.$(O), $(BLD)/region-cache.$(O))
+       ($(BLD)/textprop.$(O), $(BLD)/undo.$(O), $(BLD)/window.$(O))
+       ($(BLD)/w32select.$(O)): Update dependencies.
+
+2012-06-16  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * buffer.h (FETCH_MULTIBYTE_CHAR): Define as inline.
+       (BUF_FETCH_MULTIBYTE_CHAR): Likewise.
+       * character.c (_fetch_multibyte_char_p): Remove.
+       * alloc.c: Include "character.h" before "buffer.h".
+       * bidi.c: Likewise.
+       * buffer.c: Likewise.
+       * bytecode.c: Likewise.
+       * callint.c: Likewise.
+       * callproc.c: Likewise.
+       * casefiddle.c: Likewise.
+       * casetab.c: Likewise.
+       * category.c: Likewise.
+       * cmds.c: Likewise.
+       * coding.c: Likewise.
+       * composite.c: Likewise.
+       * dired.c: Likewise.
+       * dispnew.c: Likewise.
+       * doc.c: Likewise.
+       * dosfns.c: Likewise.
+       * editfns.c: Likewise.
+       * emacs.c: Likewise.
+       * fileio.c: Likewise.
+       * filelock.c: Likewise.
+       * font.c: Likewise.
+       * fontset.c: Likewise.
+       * fringe.c: Likewise.
+       * indent.c: Likewise.
+       * insdel.c: Likewise.
+       * intervals.c: Likewise.
+       * keyboard.c: Likewise.
+       * keymap.c: Likewise.
+       * lread.c: Likewise.
+       * macros.c: Likewise.
+       * marker.c: Likewise.
+       * minibuf.c: Likewise.
+       * nsfns.m: Likewise.
+       * nsmenu.m: Likewise.
+       * print.c: Likewise.
+       * process.c: Likewise.
+       * regex.c: Likewise.
+       * region-cache.c: Likewise.
+       * search.c: Likewise.
+       * syntax.c: Likewise.
+       * term.c: Likewise.
+       * textprop.c: Likewise.
+       * undo.c: Likewise.
+       * unexsol.c: Likewise.
+       * w16select.c: Likewise.
+       * w32fns.c: Likewise.
+       * w32menu.c: Likewise.
+       * window.c: Likewise.
+       * xdisp.c: Likewise.
+       * xfns.c: Likewise.
+       * xmenu.c: Likewise.
+       * xml.c: Likewise.
+       * xselect.c: Likewise.
+
+2012-06-16  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (set_cursor_from_row): Don't dereference glyphs_end.
+       If all the glyphs of the glyph row came from strings, and we have no
+       cursor positioning clues, put the cursor on the first glyph of the
+       row.
+       (handle_face_prop): Use chunk-relative overlay string index when
+       indexing into it->string_overlays array.  (Bug#11653)
+       (set_cursor_from_row): Use the leftmost glyph as GLYPH_BEFORE, not
+       the rightmost.  (Bug#11720)
+
+2012-06-16  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * category.h (CHAR_HAS_CATEGORY): Define as inline.
+       (CATEGORY_MEMBER): Enforce 1/0 value.
+       * category.c (_temp_category_set): Remove.
+
+2012-06-16  Eli Zaretskii  <eliz@gnu.org>
+
+       * window.c (Fdelete_other_windows_internal)
+       (Fdelete_window_internal): Don't access frame's mouse highlight
+       info of the initial frame.  (Bug#11677)
+
+2012-06-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * .gdbinit (xgetint): Fix recently-introduced paren typo.
+       Assume USE_2_TAGS_FOR_INTS.
+       (xreload): Adjust $tagmask width to match recent lisp.h change.
+
+       Simplify lisp.h in minor ways that should not affect code.
+       * lisp.h (USE_2_TAGS_FOR_INTS): Remove, as it was always defined.
+       (LISP_INT_TAG, case_Lisp_Int, LISP_STRING_TAG, LISP_INT_TAG_P)
+       (LISP_INT1_TAG, enum Lisp_Type, XINT, XUINT, make_number):
+       Simplify under the assumption that USE_2_TAGS_FOR_INTS is defined.
+       (INTTYPEBITS): New macro, for clarity.
+       (INTMASK, MOST_POSITIVE_FIXNUM): Use it.
+       (LISP_INT1_TAG, LISP_STRING_TAG, LISP_INT_TAG_P):
+       Simplify now that USE_LSB_TAG is always defined.
+       (TYPEMASK, XINT) [USE_LSB_TAG]: Remove unnecessary cast.
+       (make_number) [!USE_LSB_TAG]: Use INTMASK; that's simpler.
+
+2012-06-13  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/data.$(O)): Update dependencies.
+
+2012-06-13  Glenn Morris  <rgm@gnu.org>
+
+       * s/bsd-common.h (BSD4_3):
+       * s/usg5-4-common.h (USG5_4): No longer define; unused.
+
+2012-06-13  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * lisp.h (Lisp_Object) [CHECK_LISP_OBJECT_TYPE]: Define as struct
+       instead of union.
+       (XLI, XIL): Define.
+       (XHASH, XTYPE, XINT, XUINT, make_number, XSET, XPNTR, XUNTAG):
+       Use them.
+       * emacs.c (gdb_use_struct): Rename from gdb_use_union.
+       * .gdbinit: Check gdb_use_struct instead of gdb_use_union.
+       * alloc.c (widen_to_Lisp_Object): Remove.
+       (mark_memory): Use XIL instead of widen_to_Lisp_Object.
+       * frame.c (delete_frame): Remove outdated comment.
+       * w32fns.c (Fw32_register_hot_key): Use XLI instead of checking
+       USE_LISP_UNION_TYPE.
+       (Fw32_unregister_hot_key): Likewise.
+       (Fw32_toggle_lock_key): Likewise.
+       * w32menu.c (add_menu_item): Likewise.
+       (w32_menu_display_help): Use XIL instead of checking
+       USE_LISP_UNION_TYPE.
+       * w32heap.c (allocate_heap): Don't check USE_LISP_UNION_TYPE.
+       (init_heap): Likewise.
+       * w32term.c (w32_read_socket): Update comment.
+
+2012-06-13  Glenn Morris  <rgm@gnu.org>
+
+       * s/usg5-4-common.h, src/s/unixware.h:
+       Remove define/undef of HAVE_SYSV_SIGPAUSE (not used since 2010-05-04).
+
+       * s/gnu.h (POSIX_SIGNALS): Remove (not used since 2010-05-04).
+
+2012-06-13  Paul Eggert  <eggert@cs.ucla.edu>
+
+       USE_LISP_UNION_TYPE + USE_LSB_TAG cleanup (Bug#11604)
+       * alloc.c (make_number) [!defined make_number]:
+       Remove, as lisp.h always defines this now.
+       (mark_maybe_pointer): Simplify since USE_LSB_TAG is always defined now.
+       (roundup_size): Verify that it is a power of 2.
+       * data.c (Fmake_variable_buffer_local, Fmake_local_variable):
+       * ftfont.c (ftfont_driver): Use LISP_INITIALLY_ZERO.
+       * lisp.h (USE_LSB_TAG): Allow the builder to compile with
+       -DUSE_LSB_TAG=0, to override the automatically-selected default.
+       USE_LSB_TAG now is always defined to be either 0 or 1.
+       All uses changed.
+       (union Lisp_Object): Don't worry about WORDS_BIGENDIAN; the
+       code works fine either way, and efficiency is not a concern here,
+       as the union type is for debugging, not for production.
+       (LISP_MAKE_RVALUE, make_number) [USE_LISP_UNION_TYPE]:
+       Use an inline function on all platforms when using the union type,
+       since this is simpler and 'static inline' can be used portably
+       within Emacs now.
+       (LISP_INITIALLY_ZERO): New macro.
+       (XFASTINT, XSETFASTINT) [USE_LISP_UNION_TYPE]: Remove.
+       (XSET) [USE_LISP_UNION_TYPE]: Don't overparenthesize.
+
+2012-06-12  Glenn Morris  <rgm@gnu.org>
+
+       * s/gnu-kfreebsd.h, s/hpux11.h, s/openbsd.h, s/sol2-10.h: Remove files.
+
+       * s/gnu-linux.h (HAVE_PROCFS): Move to configure.
+
+       * s/hpux10-20.h, s/openbsd.h, s/usg5-4-common.h:
+       Move BROKEN_SIGIO to configure.
+
+       * s/bsd-common.h, s/darwin.h, s/gnu-kfreebsd.h, s/hpux10-20.h:
+       Move NO_TERMIO to configure.
+
+2012-06-12  Chong Yidong  <cyd@gnu.org>
+
+       * image.c (imagemagick_load_image): Use MagickFlattenImage if
+       MagickMergeImageLayers is undefined.  Use pixel pusher loop if
+       MagickExportImagePixels is undefined.
+
+2012-06-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * image.c (imagemagick_load_image): Remove unused label.
+
+2012-06-11  Glenn Morris  <rgm@gnu.org>
+
+       * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h:
+       * s/gnu-kfreebsd.h, s/gnu-linux.h, s/gnu.h, s/hpux10-20.h:
+       * s/irix6-5.h, s/ms-w32.h, s/msdos.h, s/template.h:
+       * s/usg5-4-common.h: Move SYSTEM_TYPE to configure.
+
+2012-06-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * alloc.c (make_byte_code): New function.
+       (Fmake_byte_code): Use it.  Don't purify here.
+       * lread.c (read1): Use it as well to avoid extra allocation.
+
+2012-06-11  Chong Yidong  <cyd@gnu.org>
+
+       * image.c (imagemagick_load_image): Implement transparency.
+
+2012-06-10  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * regex.c (at_begline_loc_p): Also recognize `(?N:' and correctly
+       account for preceding backslashes.  (Bug#11663)
+
+2012-06-09  Chong Yidong  <cyd@gnu.org>
+
+       * term.c: Support italics in capable terminals (Bug#9652).
+       (no_color_bit): Replace unused NC_BLINK with NC_ITALIC.
+       (turn_on_face): Output using TS_enter_italic_mode if available.
+       Don't handle unused blinking and alt-charset cases.
+       (turn_off_face): Handle italic case; discard unused tty_blinking_p
+       and tty_alt_charset_p cases.
+       (tty_capable_p, init_tty): Support italics.
+
+       * termchar.h (struct tty_display_info): Add field for italics.
+       Remove unused blink field.
+
+       * xfaces.c (tty_supports_face_attributes_p, realize_tty_face):
+       Handle slant.
+
+       * dispextern.h: Replace unused TTY_CAP_BLINK with TTY_CAP_ITALIC.
+       (struct face): Remove unused fields tty_dim_p, tty_blinking_p, and
+       tty_alt_charset_p.  Add tty_italic_p.
+
+2012-06-09  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbusbind.c (XD_BASIC_DBUS_TYPE): Use dbus_type_is_valid and
+       dbus_type_is_basic if available.
+       (xd_extract_signed, xd_extract_unsigned): Rename from
+       extract_signed and extract_unsigned, respectively.  Adapt callers.
+
+2012-06-09  Chong Yidong  <cyd@gnu.org>
+
+       * xfaces.c (face_for_overlay_string): Handle face remapping (Bug#2066).
+
+       * fringe.c (Fset_fringe_bitmap_face): Handle the noninteractive
+       case (Bug#9752).
+
+2012-06-08  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * fileio.c (FILE_SYSTEM_CASE): Don't define.
-       (Ffile_name_directory, Fexpand_file_name): Don't use FILE_SYSTEM_CASE.
-       Fixes problems on MS-DOS with Vtemp_file_name_pattern when
-       call-process-region passes it through expand-file-name.
+       * xdisp.c (vmessage): Treat frame message as multibyte.
+       Without this change, (let ((§ 1)) (make-variable-buffer-local '§))
+       would generate the diagnostic "Making \302\247 buffer-local while
+       let-bound!".
 
-       * dired.c (file_name_completion): Don't use FILE_SYSTEM_CASE.
+2012-06-08  Eli Zaretskii  <eliz@gnu.org>
 
-2012-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+       * dispnew.c (showing_window_margins_p): Undo last change, which
+       was done due to an inadvertent commit.
+       (adjust_frame_glyphs_for_frame_redisplay): Do call
+       showing_window_margins_p.
 
-       Fix crash when creating indirect buffer (Bug#11917)
-       * buffer.c (buffer_lisp_local_variables): Add argument CLONE.
-       Don't handle unbound variables specially if non-zero.
-       (Fbuffer_local_variables): Pass zero.
-       (clone_per_buffer_values): Pass non-zero.
+2012-06-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2012-06-28  Andreas Schwab  <schwab@linux-m68k.org>
+       * eval.c (Fmake_var_non_special): New primitive.
+       (syms_of_eval): Defsubr it.
+       * lread.c (syms_of_lread): Mark `values' as lexically scoped.
 
-       * gnutls.c (emacs_gnutls_handshake): Revert last change.  Add QUIT
-       to make the loop interruptible.
+2012-06-08  Juanma Barranquero  <lekktu@gmail.com>
 
-2012-06-26  Andreas Schwab  <schwab@linux-m68k.org>
+       * dispnew.c (showing_window_margins_p): Wrap in #if 0 to prevent unused
+       function warning (the only call is inside #if 0 since 2012-06-08T08:44:45Z!eliz@gnu.org).
 
-       * gnutls.c (emacs_gnutls_handshake): Only retry if
-       GNUTLS_E_INTERRUPTED.
+2012-06-08  Eli Zaretskii  <eliz@gnu.org>
 
-2012-06-23  Eli Zaretskii  <eliz@gnu.org>
+       * alloc.c (allocate_vectorlike): Fix last change.
 
-       * ralloc.c (r_alloc_inhibit_buffer_relocation): Fix stupid thinko
-       in the logic of incrementing and decrementing the value of
-       use_relocatable_buffers.
+2012-06-08  Dmitry Antipov  <dmantipov@yandex.ru>
 
-2012-06-21  Glenn Morris  <rgm@gnu.org>
+       Block-based vector allocation of small vectors.
+       * lisp.h (struct vectorlike_header): New field `nbytes',
+       adjust comment accordingly.
+       * alloc.c (enum mem_type): New type `MEM_TYPE_VECTOR_BLOCK'
+       to denote vector blocks. Adjust users (live_vector_p,
+       mark_maybe_pointer, valid_lisp_object_p) accordingly.
+       (COMMON_MULTIPLE): Move outside #if USE_LSB_TAG.
+       (VECTOR_BLOCK_SIZE, vroundup, VECTOR_BLOCK_BYTES),
+       (VBLOCK_BYTES_MIN, VBLOCK_BYTES_MAX, VECTOR_MAX_FREE_LIST_INDEX),
+       (VECTOR_FREE_LIST_FLAG, ADVANCE, VINDEX, SETUP_ON_FREE_LIST),
+       (VECTOR_SIZE, VECTOR_IN_BLOCK): New macros.
+       (roundup_size): New constant.
+       (struct vector_block): New data type.
+       (vector_blocks, vector_free_lists, zero_vector): New variables.
+       (all_vectors): Rename to `large_vectors'.
+       (allocate_vector_from_block, init_vectors, allocate_vector_from_block)
+       (sweep_vectors): New functions.
+       (allocate_vectorlike): Return `zero_vector' as the only vector of
+       0 items. Allocate new vector from block if vector size is less than
+       or equal to VBLOCK_BYTES_MAX.
+       (Fgarbage_collect): Move all vector sweeping code to sweep_vectors.
+       (init_alloc_once): Add call to init_vectors.
 
-       * charset.c (init_charset): Make lack of etc/charsets fatal.
+2012-06-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-2012-06-11  Jan Djärv  <jan.h.d@swipnet.se>
+       * eval.c (Fmacroexpand): Stop if the macro returns the same form.
 
-       * nsterm.m (x_free_frame_resources): Move xfree so freed memory isn't
-       referenced (Bug#11583).
+2012-06-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * doprnt.c (doprnt): Truncate multibyte char correctly.
+       Without this change, doprnt (buf, 2, "%s", FORMAT_END, AP)
+       would mishandle a string argument "Xc" if X was a multibyte
+       character of length 2: it would truncate after X's first byte
+       rather than including all of X.
+
+2012-06-06  Chong Yidong  <cyd@gnu.org>
+
+       * buffer.c (word_wrap): Doc fix.
+
+2012-06-04  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * xdisp.c (note_mode_line_or_margin_highlight): Pacify gcc -Wall.
+
+2012-06-03  Glenn Morris  <rgm@gnu.org>
+
+       * xdisp.c (tool-bar-style): Doc fix.
+
+2012-06-03  Ulrich Müller  <ulm@gentoo.org>
+
+       * Makefile.in (PAXCTL): Define.
+       (temacs$(EXEEXT)): Disable memory randomization for the temacs
+       binary via PaX flags if the paxctl utility is available.
+       (emacs$(EXEEXT), bootstrap-emacs$(EXEEXT)):
+       Restore PaX flags to their default.  (Bug#11398)
 
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-06-03  Chong Yidong  <cyd@gnu.org>
 
-       * Version 24.1 released.
+       * xdisp.c (decode_mode_spec_coding): Display a space for a unibyte
+       buffer (Bug#11226).
 
-2012-05-30  Eli Zaretskii  <eliz@gnu.org>
+2012-06-03  Chong Yidong  <cyd@gnu.org>
+
+       * xdisp.c (calc_pixel_width_or_height): Use Fbuffer_local_value.
+       (note_mode_line_or_margin_highlight): If there is no help echo,
+       use mode-line-default-help-echo.  Handle the case where the mouse
+       position is past the end of the mode line string.
+
+       * buffer.c (buffer_local_value_1): New function, split from
+       Fbuffer_local_value; can return Qunbound.
+       (Fbuffer_local_value): Use it.
+       (Vmode_line_format): Docstring tweaks.
+
+2012-06-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sysdep.c (system_process_attributes): Improve comment.
+
+2012-06-02  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * keyboard.c: Export real-this-command to Elisp.
+       (syms_of_keyboard): Rename real_this_command to Vreal_this_command
+       and DEFVAR it.  Update all users.
+
+2012-06-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * minibuf.c (Fassoc_string): Remove duplicate declaration.
+
+       * sysdep.c (system_process_attributes) [SOLARIS2 && HAVE_PROCFS]:
+       Convert pctcpu and pctmem to Lisp float properly.
+       Let the compiler fold better, as 100.0/0x8000 is exact.
+
+2012-06-02  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * alloc.c (CONS_BLOCK_SIZE): Account for padding at the end of
+       cons_block.
+
+2012-06-01  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * xfns.c (x_set_tool_bar_lines) [USE_GTK]: Adjust to bitfield change.
+
+2012-06-01  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       For a 'struct window', replace some Lisp_Object fields to
+       bitfields where appropriate, remove unused fields.
+       * window.h (struct window): Remove unused 'last_mark_x' and
+       'last_mark_y' fields.  Rename 'mini_p' field to 'mini',
+       change it's type from Lisp_Object to bitfield.
+       Change type of 'force_start', 'optional_new_start',
+       'last_had_star', 'update_mode_line' and 'start_at_line_beg'
+       fields from Lisp_Object to bitfield. Adjust users accordingly.
+
+2012-05-31  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Pacify gcc -Wdouble-precision when using Xaw.
+       * xterm.c (xaw_jump_callback, x_set_toolkit_scroll_bar_thumb)
+       [HAVE_X_WINDOWS && USE_TOOLKIT_SCROLL_BARS && !USE_MOTIF && !USE_GTK]:
+       Use 'float' consistently, rather than 'float' in most places
+       and 'double' in a couple of places.
+
+2012-05-31  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (handle_stop): Detect whether we have overlay strings
        loaded by testing it->current.overlay_string_index to be
        non-negative, instead of checking whether n_overlay_strings is
        positive.  (Bug#11587)
 
-2012-05-30  Chong Yidong  <cyd@gnu.org>
+2012-05-31  Chong Yidong  <cyd@gnu.org>
 
        * keymap.c (describe_map_tree): Revert 2011-07-07 change (Bug#1169).
 
        * doc.c (Fsubstitute_command_keys): Doc fix.
 
-2012-05-29  Eli Zaretskii  <eliz@gnu.org>
+2012-05-31  Eli Zaretskii  <eliz@gnu.org>
 
        * search.c (search_buffer): Remove calls to
        r_alloc_inhibit_buffer_relocation, as it is now called by
        maybe_unify_char, which was the cause of relocation of buffer text
        in bug#11519.
 
-2012-05-23  Eli Zaretskii  <eliz@gnu.org>
+2012-05-31  Eli Zaretskii  <eliz@gnu.org>
 
        * charset.c (maybe_unify_char): Inhibit relocation of buffer text
        for the duration of call to load_charset, to avoid problems with
        decrement the inhibition flag, instead of just setting or
        resetting it.
 
-2012-05-24  Ken Brown  <kbrown@cornell.edu>
+2012-05-31  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove obsolete '#define static' cruft.
+       * s/hpux10-20.h (_FILE_OFFSET_BITS): Don't #undef.
+       This #undef was "temporary" in 2000; it is no longer needed
+       now that '#define static' has gone away.
+       * xfns.c, xterm.h (gray_bitmap_width, gray_bitmap_height)
+       (gray_bitmap_bits): Remove; no longer needed.
+       All uses replaced with definiens.
+       * xterm.c: Include "bitmaps/gray.xbm".
+
+2012-05-30  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Clean up __executable_start, monstartup when --enable-profiling.
+       The following changes affect the code only when profiling.
+       * dispnew.c (__executable_start): Rename from safe_bcopy.
+       Define only on platforms that need it.
+       * emacs.c: Include <sys/gmon.h> when profiling.
+       (_mcleanup): Remove decl, since <sys/gmon.h> does it now.
+       (__executable_start): Remove decl, since lisp.h does it now.
+       (safe_bcopy): Remove decl; no longer has that name.
+       (main): Coalesce #if into single bit of code, for simplicity.
+       Cast pointers to uintptr_t, since standard libraries want integers
+       and not pointers.
+       * lisp.h (__executable_start): New decl.
+
+2012-05-31  Glenn Morris  <rgm@gnu.org>
+
+       * image.c (Fimagemagick_types): Doc fix.
+
+2012-05-30  Jim Meyering  <meyering@redhat.com>
+
+       * callproc.c (Fcall_process_region): Include directory component
+       in mkstemp error message (Bug#11586).
+
+2012-05-30  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * alloc.c, lisp.h (make_pure_vector): Now static.
+
+2012-05-30  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eval.c (Fdefun, Fdefmacro, Vmacro_declaration_function):
+       Move to byte-run.el.
+       (Fautoload): Do the hash-doc more carefully.
+       * data.c (Fdefalias): Purify definition, except for keymaps.
+       (Qdefun): Move from eval.c.
+       * lisp.h (Qdefun): Remove.
+       * lread.c (read1): Tiny simplification.
+
+2012-05-29  Troels Nielsen  <bn.troels@gmail.com>
+
+       Do not create empty overlays with the evaporate property (Bug#9642).
+       * buffer.c (Fmove_overlay): Reinstate the earlier fix for
+       Bug#9642, but explicitly check that the buffer the overlay would
+       be moved to is live and rearrange lines to make sure that errors
+       will not put the overlay in an inconsistent state.
+       (Fdelete_overlay): Cosmetics.
+
+2012-05-28  Eli Zaretskii  <eliz@gnu.org>
+
+       * w32term.c (my_bring_window_to_top): New function.
+       (x_raise_frame): Use handle returned by DeferWindowPos, which
+       could be different from the original one.
+       Call my_bring_window_to_top instead of my_set_foreground_window.
+       (Bug#11513)
+
+       * w32fns.c (w32_wnd_proc): Accept and process WM_EMACS_BRINGTOTOP
+       by calling BringWindowToTop.
+
+       * w32term.h (WM_EMACS_BRINGTOTOP): New message.
+       (WM_EMACS_END): Increase by one.
+
+2012-05-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * bidi.c (bidi_mirror_char): Put eassert before conversion to int.
+       This avoids undefined behavior that might cause the eassert
+       to not catch an out-of-range value.
+
+2012-05-28  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/w32inevt.$(O), $(BLD)/w32console.$(O)):
+       Update dependencies.
+
+2012-05-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_mirror_char): Fix last change.
+
+2012-05-27  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * unexmacosx.c (copy_data_segment): Truncate after 16 characters
+       when referring to sectname field in printf format.
+
+2012-05-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lisp.h [REL_ALLOC]: Omit duplicate prototypes.
+       Only r_alloc_inhibit_buffer_relocation needed to be added;
+       the others were already declared.
+
+       * bidi.c (bidi_mirror_char): Don't possibly truncate the integer
+       before checking whether it's out of range.  Put the check inside
+       eassert.  See
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-05/msg00485.html>.
+
+2012-05-27  Ken Brown  <kbrown@cornell.edu>
 
        * callproc.c (Fcall_process): Restore a line that was accidentally
        commented out in the 2011-02-13 change (bug#11547).
 
-2012-05-23  Eli Zaretskii  <eliz@gnu.org>
+2012-05-27  Eli Zaretskii  <eliz@gnu.org>
 
        * lisp.h [REL_ALLOC]: Add prototypes for external functions
        defined on ralloc.c.
        text while re_search_2 is doing its job, because re_search_2 is
        passed C pointers to buffer text.  (Bug#11519)
 
-2012-05-21  Eli Zaretskii  <eliz@gnu.org>
-
        * msdos.c (internal_terminal_init) <Vwindow_system_version>:
        Update value to 24.
 
-2012-05-19  Eli Zaretskii  <eliz@gnu.org>
-
        * xdisp.c (move_it_to): Under MOVE_TO_Y, when restoring iterator
        state after an additional call to move_it_in_display_line_to, keep
        the values of it->max_ascent and it->max_descent found for the
        was in revid eliz@gnu.org-20120513182235-4p6386j761ld0nwb.
        (Bug#11464)
 
-2012-05-15  Eli Zaretskii  <eliz@gnu.org>
+2012-05-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix coding-related core dumps with gcc -ftrapv.
+       The code was computing A - B, where A and B are pointers, and B is
+       random garbage.  This can lead to core dumps on platforms that
+       have special pointer registers, and it also leads to core dumps on
+       x86-64 when compiled with gcc -ftrapv.  The fix is to compute
+       A - B only when B is initialized properly.
+       * coding.c (coding_set_source, coding_set_destination): Return void.
+       (coding_change_source, coding_change_destinations): New functions,
+       with the old behaviors of coding_set_source and coding_set_destination.
+       All callers that need an offset changed to use these new functions.
+
+2012-05-26  Glenn Morris  <rgm@gnu.org>
+
+       * nsterm.m (ns_init_paths): Don't mess with INFOPATH.  (Bug#2791)
+
+2012-05-26  Eli Zaretskii  <eliz@gnu.org>
+
+       Extend mouse support on W32 text-mode console.
+       * xdisp.c (draw_row_with_mouse_face):
+       Call tty_draw_row_with_mouse_face for WINDOWSNT as well.
+
+       * w32console.c: Include window.h.
+       (w32con_write_glyphs_with_face, tty_draw_row_with_mouse_face):
+       New functions.
+       (initialize_w32_display): Initialize mouse-highlight data.
+
+       * w32inevt.c: Include termchar.h and window.h.
+       (do_mouse_event): Support mouse-autoselect-window.  When the mouse
+       moves, call note_mouse_highlight.  If help_echo changed, call
+       gen_help_event to produce help-echo message in the echo area.
+       Call clear_mouse_face if mouse_face_hidden is set in the mouse
+       highlight info.
+
+2012-05-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lread.c (read1): Simplify slightly to avoid an overflow warning
+       with GCC 4.7.0 on x86-64.
+
+2012-05-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * bidi.c (bidi_mirror_char): Revert last change: an int is
+       definitely wide enough here.
+
+2012-05-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix integer width and related bugs (Bug#9874).
+       * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
+       (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE)
+       (string_bytes, check_sblock, allocate_string_data):
+       (compact_small_strings, Fmake_bool_vector, make_string)
+       (make_unibyte_string, make_multibyte_string)
+       (make_string_from_bytes, make_specified_string)
+       (allocate_vectorlike, Fmake_vector, find_string_data_in_pure)
+       (make_pure_string, make_pure_c_string, make_pure_vector, Fpurecopy)
+       (mark_vectorlike):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (allocate_pseudovector):
+       Use int, not EMACS_INT, where int is wide enough.
+       (inhibit_garbage_collection, Fgarbage_collect):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * bidi.c (bidi_mirror_char): Use EMACS_INT, not int, where
+       int might not be wide enough.
+       (bidi_cache_search, bidi_cache_find, bidi_init_it)
+       (bidi_count_bytes, bidi_char_at_pos, bidi_fetch_char)
+       (bidi_at_paragraph_end, bidi_find_paragraph_start)
+       (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak)
+       (bidi_level_of_next_char, bidi_move_to_visually_next):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * buffer.c (copy_overlays, Fgenerate_new_buffer_name)
+       (Fkill_buffer, Fset_buffer_major_mode)
+       (advance_to_char_boundary, Fbuffer_swap_text)
+       (Fset_buffer_multibyte, overlays_at, overlays_in)
+       (overlay_touches_p, struct sortvec, record_overlay_string)
+       (overlay_strings, recenter_overlay_lists)
+       (adjust_overlays_for_insert, adjust_overlays_for_delete)
+       (fix_start_end_in_overlays, fix_overlays_before, modify_overlay)
+       (Fmove_overlay, Fnext_overlay_change, Fprevious_overlay_change)
+       (Foverlay_recenter, last_overlay_modification_hooks_used)
+       (report_overlay_modification, evaporate_overlays, enlarge_buffer_text):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (validate_region): Omit unnecessary test for b <= e,
+       since that's guaranteed by the previous test.
+       (adjust_overlays_for_delete): Avoid pos + length overflow.
+       (Fmove_overlay, Fdelete_overlay, add_overlay_mod_hooklist)
+       (report_overlay_modification):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Foverlays_at, Fnext_overlay_change, Fprevious_overlay_change):
+       Omit pointer cast, which isn't needed anyway, and doesn't work
+       after the EMACS_INT -> ptrdiff_t change.
+       (Fmove_overlay): Clip BEG and END to ptrdiff_t to avoid overflow.
+       * buffer.h: Adjust decls to match defn changes elsewhere.
+       (struct buffer_text, struct buffer):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       Use EMACS_INT, not int, where int might not be wide enough.
+       * bytecode.c (unmark_byte_stack, exec_byte_code): Use ptrdiff_t,
+       not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (exec_byte_code): Use tighter memory-full test, one that checks
+       for alloca overflow.  Don't compute the address of the object just
+       before an array, as that's not portable.  Use EMACS_INT, not
+       ptrdiff_t or int, where ptrdiff_t or int might not be wide enough.
+       * callint.c (Fcall_interactively):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * callproc.c (call_process_kill, Fcall_process):
+       Don't assume pid_t fits into an Emacs fixnum.
+       (call_process_cleanup, Fcall_process, child_setup):
+       Don't assume pid_t fits into int.
+       (call_process_cleanup, Fcall_process, delete_temp_file)
+       (Fcall_process_region):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Fcall_process): Simplify handling of volatile integers.
+       Use int, not EMACS_INT, where int will do.
+       * casefiddle.c (casify_object, casify_region, operate_on_word)
+       (Fupcase_word, Fdowncase_word, Fcapitalize_word):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (casify_object): Avoid integer overflow when overallocating buffer.
+       * casetab.c (set_identity, shuffle): Prefer int to unsigned when
+       either works.  Use lint_assume to convince GCC 4.6.1 that it's OK.
+       * category.c (Fchar_category_set): Don't assume fixnum fits in int.
+       * category.h (CATEGORYP): Don't assume arg is nonnegative.
+       * ccl.c (GET_CCL_INT): Remove; no longer needed, since the
+       integers are now checked earlier.  All uses replaced with XINT.
+       (ccl_driver):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       For CCL_MapSingle, check that content and value are in int range.
+       (ccl_driver, Fregister_code_conversion_map):
+       Check that Vcode_version_map_vector is a vector.
+       (resolve_symbol_ccl_program): Check that vector header is in range.
+       Always copy the vector, so that we can check its contents reliably
+       now rather than having to recheck each instruction as it's being
+       executed.  Check that vector words fit in 'int'.
+       (ccl_get_compiled_code, Fregister_ccl_program)
+       (Fregister_code_conversion_map): Use ptrdiff_t, not int, for
+       program indexes, to avoid needless 32-bit limit on 64-bit hosts.
+       (Fccl_execute, Fccl_execute_on_string): Check that initial reg
+       contents are in range.
+       (Fccl_execute_on_string): Check that status is in range.
+       * ccl.h (struct ccl_program.idx): Now ptrdiff_t, not int.
+       * character.c (char_resolve_modifier_mask, Fchar_resolve_modifiers):
+       Accept and return EMACS_INT, not int, because callers can pass values
+       out of 'int' range.
+       (c_string_width, strwidth, lisp_string_width, chars_in_text)
+       (multibyte_chars_in_text, parse_str_as_multibyte)
+       (str_as_multibyte, count_size_as_multibyte, str_to_multibyte)
+       (str_as_unibyte, str_to_unibyte, string_count_byte8)
+       (string_escape_byte8, Fget_byte):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Funibyte_string): Use CHECK_RANGED_INTEGER, not CHECK_NATNUM, to
+       avoid mishandling large integers.
+       * character.h: Adjust decls to match defn changes elsewhere.
+       * charset.c (load_charset_map_from_file, find_charsets_in_text)
+       (Ffind_charset_region):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (load_charset_map_from_file): Redo idx calculation to avoid overflow.
+       (load_charset_map_from_vector, Fdefine_charset_internal):
+       Don't assume fixnum fits in int.
+       (load_charset_map_from_vector, Fmap_charset_chars):
+       Remove now-unnecessary CHECK_NATNUMs.
+       (Fdefine_charset_internal): Check ranges here, more carefully.
+       Don't rely on undefined behavior with signed left shift overflow.
+       Don't assume unsigned int fits into fixnum, or that fixnum fits
+       into unsigned int.  Don't require max_code to be a valid fixnum;
+       that's not true for gb10830 4-byte on a 32-bit host.  Allow
+       invalid_code to be a cons, for the same reason.  Require code_offset
+       to be a character.  Avoid int overflow if max_char is close
+       to INT_MAX.
+       (CODE_POINT_TO_INDEX): On 32-bit hosts, return int, not unsigned;
+       this is intended anyway and avoids some undefined behavior.
+       (load_charset_map): Pass unsigned, not int, as 2nd arg of
+       INDEX_TO_CODE_POINT, as that's what it expects.
+       (Funify_charset, encode_char): Don't stuff unsigned vals into int vars.
+       * charset.h (DECODE_CHAR): Return int, not unsigned;
+       this is what was intended anyway, and it avoids undefined behavior.
+       (CHARSET_OFFSET): Remove unused macro, instead of fixing its
+       integer-overflow issues.
+       (ENCODE_CHAR): Return unsigned on all hosts, not just on 32-bit hosts.
+       Formerly, it returned EMACS_INT on 64-bit hosts in the common case
+       where the argument is EMACS_INT, and this behavior is not intended.
+       * chartab.c (Fmake_char_table, Fset_char_table_range)
+       (uniprop_get_decoder, uniprop_get_encoder):
+       Don't assume fixnum fits in int.
+       * cmds.c (move_point): New function, that does the gist of
+       Fforward_char and Fbackward_char, but does so while checking
+       for integer overflow more accurately.
+       (Fforward_char, Fbackward_char): Use it.
+       (Fforward_line, Fend_of_line, internal_self_insert)
+       (internal_self_insert):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       Fix a FIXME, by checking for integer overflow when calculating
+       target_clm and actual_clm.
+       * coding.c (detect_coding_XXX, encode_coding_XXX, CODING_DECODE_CHAR)
+       (CODING_ENCODE_CHAR, CODING_CHAR_CHARSET, CODING_CHAR_CHARSET_P)
+       (ASSURE_DESTINATION, coding_alloc_by_realloc)
+       (coding_alloc_by_making_gap, alloc_destination)
+       (detect_coding_utf_8, encode_coding_utf_8, decode_coding_utf_16)
+       (encode_coding_utf_16, detect_coding_emacs_mule)
+       (decode_coding_emacs_mule, encode_coding_emacs_mule)
+       (detect_coding_iso_2022, decode_coding_iso_2022)
+       (encode_invocation_designation, encode_designation_at_bol)
+       (encode_coding_iso_2022, detect_coding_sjis, detect_coding_big5)
+       (decode_coding_sjis, decode_coding_big5, encode_coding_sjis)
+       (encode_coding_big5, detect_coding_ccl, decode_coding_ccl)
+       (encode_coding_ccl, encode_coding_raw_text)
+       (detect_coding_charset, decode_coding_charset)
+       (encode_coding_charset, detect_eol, decode_eol, produce_chars)
+       (produce_composition, produce_charset, produce_annotation)
+       (decode_coding, handle_composition_annotation)
+       (handle_charset_annotation, consume_chars, decode_coding_gap)
+       (decode_coding_object, encode_coding_object, detect_coding_system)
+       (Ffind_coding_systems_region_internal, Fcheck_coding_systems_region)
+       (code_convert_region, code_convert_string)
+       (Fdefine_coding_system_internal)
+       (coding_set_source, coding_set_destination):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (setup_iso_safe_charsets, consume_chars, Funencodable_char_position)
+       (Fdefine_coding_system_internal):
+       Don't assume fixnums fit in int.
+       (decode_coding_gap, decode_coding_object, encode_coding_object)
+       (Fread_coding_system, Fdetect_coding_region)
+       (Funencodable_char_position, Fcheck_coding_systems_region)
+       (get_translation, handle_composition_annotation, consume_chars):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (consume_chars): Rewrite to not calculate an address outside buffer.
+       (Ffind_operation_coding_system): NATNUMP can eval its arg twice.
+       Don't access memory outside of the args array.
+       (Fdefine_coding_system_internal): Check for charset-id overflow.
+       (ENCODE_ISO_CHARACTER): Use unsigned, not int, to store the unsigned
+       result of ENCODE_CHAR.
+       * coding.h: Adjust decls to match defn changes elsewhere.
+       (struct coding_system):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * composite.c (get_composition_id, find_composition)
+       (run_composition_function, update_compositions)
+       (compose_text, composition_gstring_put_cache)
+       (composition_gstring_p, composition_gstring_width)
+       (fill_gstring_header, fill_gstring_body, autocmp_chars)
+       (composition_compute_stop_pos, composition_reseat_it)
+       (composition_update_it, struct position_record)
+       (find_automatic_composition, composition_adjust_point)
+       (Fcomposition_get_gstring, Ffind_composition_internal):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (update_compositions):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * composite.h: Adjust decls to match defn changes elsewhere.
+       (struct composition):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p):
+       Do not attempt to compute the address of the object just before a
+       buffer; this is not portable.
+       (Faref, Faset):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Faset): Use int, not EMACS_INT, where int is wide enough.
+       (Fstring_to_number): Don't assume fixnums fit in int.
+       (Frem): Don't assume arg is nonnegative.
+       * dbusbind.c (xd_append_arg): Check for integers out of range.
+       (Fdbus_call_method): Don't overflow the timeout int.
+       (extract_signed, extract_unsigned): New functions.
+       (XD_CHECK_DBUS_SERIAL): Remove; superseded by extract_unsigned.
+       (xd_get_connection_references): Return ptrdiff_t, not int.
+       All uses changed.
+       (xd_signature, xd_append_arg, xd_retrieve_arg, Fdbus_message_internal)
+       (xd_read_message_1):
+       Use int, not unsigned, where the dbus API uses int.
+       (Fdbus_message_internal): Don't overflow mtype.
+       (syms_of_dbusbind): Allocate right-sized buffer for integers.
+       * dired.c (directory_files_internal, file_name_completion, scmp)
+       (file_name_completion_stat):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (file_name_completion): Don't overflow matchcount.
+       (file_name_completion_stat): Use SAFE_ALLOCA, not alloca.
+       * dispextern.h: Adjust decls to match defn changes elsewhere.
+       (struct text_pos, struct glyph, struct bidi_saved_info)
+       (struct bidi_string_data, struct bidi_it, struct composition_it)
+       (struct it):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (struct display_pos, struct composition_it, struct it):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * dispnew.c (increment_matrix_positions)
+       (increment_row_positions, mode_line_string)
+       (marginal_area_string):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (change_frame_size_1, Fredisplay, Fframe_or_buffer_changed_p):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (duration_to_sec_usec): New function, to check for overflow better.
+       (Fsleep_for, sit_for): Use it.
+       * doc.c (get_doc_string, store_function_docstring):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (get_doc_string, Fsnarf_documentation):
+       Use int, not EMACS_INT, where int is wide enough.
+       (get_doc_string):
+       Use SAFE_ALLOCA, not alloca.
+       Check for overflow when converting EMACS_INT to off_t.
+       * doprnt.c (doprnt):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * editfns.c (init_editfns, Fuser_uid, Fuser_real_uid):
+       Don't assume uid_t fits into fixnum.
+       (buildmark, Fgoto_char, overlays_around, find_field, Fdelete_field)
+       (Ffield_string, Ffield_string_no_properties, Ffield_beginning)
+       (Ffield_end, Fconstrain_to_field, Fline_beginning_position)
+       (Fline_end_position, Fprevious_char, Fchar_after, Fchar_before)
+       (general_insert_function)
+       (Finsert_char, make_buffer_string, make_buffer_string_both)
+       (update_buffer_properties, Fbuffer_substring)
+       (Fbuffer_substring_no_properties, Fcompare_buffer_substrings)
+       (Fsubst_char_in_region, check_translation)
+       (Ftranslate_region_internal, save_restriction_restore, Fformat)
+       (transpose_markers, Ftranspose_regions):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (clip_to_bounds): Move to lisp.h as an inline function).
+       (Fconstrain_to_field): Don't assume integers are nonnegative.
+       (Fline_beginning_position, Fsave_excursion, Fsave_current_buffer):
+       (Fsubst_char_in_region, Fsave_restriction):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Femacs_pid): Don't assume pid_t fits into fixnum.
+       (lo_time): Use int, not EMACS_INT, when int suffices.
+       (lisp_time_argument): Check for usec out of range.
+       (Fencode_time): Don't assume fixnum fits in int.
+       (Fuser_login_name, Fuser_full_name): Signal an error
+       if a uid argument is out of range, rather than relying on
+       undefined behavior.
+       (Fformat_time_string): Remove now-unnecessary check.
+       lisp_time_argument checks for out-of-range usec now.
+       Use ptrdiff_t, not size_t, where ptrdiff_t will do.
+       * emacs.c (gdb_valbits, gdb_gctypebits): Now int, not EMACS_INT.
+       (gdb_data_seg_bits): Now uintptr_t, not EMACS_INT.
+       (PVEC_FLAG, gdb_array_mark_flag): Now ptrdiff_t, not EMACS_INT.
+       (init_cmdargs, Fdump_emacs):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Fkill_emacs): Don't assume fixnum fits in int; instead, take just
+       the bottom (typically) 32 bits of the fixnum.
+       * eval.c (specpdl_size, call_debugger):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (when_entered_debugger, Fbacktrace_debug):
+       Don't assume fixnum can fit in int.
+       (Fdefvaralias, Fdefvar): Do not attempt to compute the address of
+       the object just before a buffer; this is not portable.
+       (FletX, Flet, Funwind_protect, do_autoload, Feval, funcall_lambda)
+       (grow_specpdl, unbind_to):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Fapply, apply_lambda): Don't assume ptrdiff_t can hold fixnum.
+       (grow_specpdl): Simplify allocation by using xpalloc.
+       (Fprog1, Fprog2): Don't assume list length fits in int.  Simplify.
+       * fileio.c (Ffind_file_name_handler, Fcopy_file, Frename_file)
+       (Finsert_file_contents, Fwrite_region, Fdo_auto_save):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Ffind_file_name_handler, non_regular_inserted, Finsert_file_contents)
+       (a_write, e_write):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fcopy_file, non_regular_nbytes, read_non_regular)
+       (Finsert_file_contents):
+       Use int, not EMACS_INT, where int is wide enough.
+       (READ_BUF_SIZE): Verify that it fits in int.
+       (Finsert_file_contents): Check that counts are in proper range,
+       rather than assuming fixnums fit into ptrdiff_t etc.
+       Don't assume fixnums fit into int.
+       * floatfns.c (Fexpt): Avoid undefined signed * signed overflow.
+       * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec, concat)
+       (string_char_byte_cache_charpos, string_char_byte_cache_bytepos)
+       (string_char_to_byte, string_byte_to_char)
+       (string_make_multibyte, string_to_multibyte)
+       (string_make_unibyte, Fstring_as_unibyte, Fstring_as_multibyte)
+       (Fstring_to_unibyte, Fsubstring, Fsubstring_no_properties)
+       (substring_both, Fdelete, internal_equal, Ffillarray)
+       (Fclear_string, mapcar1)
+       (Fbase64_encode_region, Fbase64_encode_string, base64_encode_1)
+       (Fbase64_decode_region, Fbase64_decode_string, base64_decode_1)
+       (larger_vector, make_hash_table, maybe_resize_hash_table)
+       (hash_lookup, hash_remove_from_table, hash_clear, sweep_weak_table)
+       (Fmaphash, secure_hash):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (concat): Check for string index and length overflow.
+       (Fmapconcat): Don't assume fixnums fit into ptrdiff_t.
+       (Frequire):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (larger_vector): New API (vec, incr_min, size_max) replaces old
+       one (vec, new_size, init).  This catches size overflow.
+       INIT was removed because it was always Qnil.
+       All callers changed.
+       (INDEX_SIZE_BOUND): New macro, which calculates more precisely
+       the upper bound on a hash table index size.
+       (make_hash_table, maybe_resize_hash_table): Use it.
+       (secure_hash): Computer start_byte and end_byte only after
+       they're known to be in ptrdiff_t range.
+       * font.c (font_intern_prop, font_at, font_range, Ffont_shape_gstring)
+       (Ffont_get_glyphs, Ffont_at):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (font_style_to_value, font_prop_validate_style, font_expand_wildcards)
+       (Flist_fonts, Fopen_font):
+       Don't assume fixnum can fit in int.
+       (check_gstring): Don't assume index can fit in int.
+       (font_match_p): Check that fixnum is a character, not a nonnegative
+       fixnum, since the later code needs to stuff it into an int.
+       (font_find_for_lface): Use SAFE_ALLOCA_LISP, not alloca.
+       (font_fill_lglyph_metrics): Use unsigned, not EMACS_INT, to avoid
+       conversion overflow issues.
+       (Fopen_font): Check for integer out of  range.
+       (Ffont_get_glyphs): Don't assume index can fit in int.
+       * font.h: Adjust decls to match defn changes elsewhere.
+       * fontset.c (reorder_font_vector): Redo score calculation to avoid
+       integer overflow.
+       (num_auto_fontsets, fontset_from_font): Use ptrdiff_t, not
+       printmax_t, where ptrdiff_t is wide enough.
+       (Finternal_char_font):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * frame.c (Fset_mouse_position, Fset_mouse_pixel_position)
+       (Fset_frame_height, Fset_frame_width, Fset_frame_size)
+       (Fset_frame_position, x_set_frame_parameters)
+       (x_set_line_spacing, x_set_border_width)
+       (x_set_internal_border_width, x_set_alpha, x_figure_window_size):
+       Check that fixnums are in proper range for system types.
+       (frame_name_fnn_p, Fframe_parameter, Fmodify_frame_parameters):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fmodify_frame_parameters): Don't assume fixnum fits in int.
+       Use SAFE_ALLOCA_LISP, not alloca.
+       * frame.h (struct frame): Use intptr_t, not EMACS_INT, where
+       intptr_t is wide enough.
+       * fringe.c (lookup_fringe_bitmap, get_logical_fringe_bitmap)
+       (Fdefine_fringe_bitmap): Don't assume fixnum fits in int.
+       (Ffringe_bitmaps_at_pos): Don't assume index fits in int.
+       Check for fixnum out of range.
+       * ftfont.c (ftfont_list): Don't assume index fits in int.
+       Check that fixnums are in proper range for system types.
+       (ftfont_shape_by_flt):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * gnutls.c (emacs_gnutls_write, emacs_gnutls_read):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fgnutls_error_fatalp, Fgnutls_error_string, Fgnutls_boot):
+       Check that fixnums are in proper range for system types.
+       * gnutls.h: Adjust decls to match defn changes elsewhere.
+       * gtkutil.c (xg_dialog_run):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (update_frame_tool_bar):
+       Check that fixnums are in proper range for system types.
+       * image.c (parse_image_spec): Redo count calculation to avoid overflow.
+       (lookup_image): Check that fixnums are in range for system types.
+       * indent.c (last_known_column, last_known_column_point):
+       (current_column_bol_cache):
+       (skip_invisible, current_column, check_display_width):
+       (check_display_width, scan_for_column, current_column_1)
+       (Findent_to, Fcurrent_indentation, position_indentation)
+       (indented_beyond_p, Fmove_to_column, compute_motion):
+       (Fcompute_motion, Fvertical_motion):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (last_known_column_modified): Use EMACS_INT, not int.
+       (check_display_width):
+       (Fcompute_motion):
+       Check that fixnums and floats are in proper range for system types.
+       (compute_motion): Don't assume index or fixnum fits in int.
+       (compute_motion, Fcompute_motion):
+       Use int, not EMACS_INT, when it is wide enough.
+       (vmotion): Omit local var start_hpos that is always 0; that way
+       we don't need to worry about overflow in expressions involving it.
+       * indent.h: Adjust decls to match defn changes elsewhere.
+       (struct position):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       Use int, not EMACS_INT, where int is wide enough.
+       Remove unused members ovstring_chars_done and tab_offset;
+       all uses removed.
+       * insdel.c (move_gap, move_gap_both, gap_left, gap_right)
+       (adjust_markers_for_delete, adjust_markers_for_insert, adjust_point)
+       (adjust_markers_for_replace, make_gap_larger, make_gap_smaller)
+       (make_gap, copy_text, insert, insert_and_inherit)
+       (insert_before_markers, insert_before_markers_and_inherit)
+       (insert_1, count_combining_before, count_combining_after)
+       (insert_1_both, insert_from_string)
+       (insert_from_string_before_markers, insert_from_string_1)
+       (insert_from_gap, insert_from_buffer, insert_from_buffer_1)
+       (adjust_after_replace, adjust_after_insert, replace_range)
+       (replace_range_2, del_range, del_range_1, del_range_byte)
+       (del_range_both, del_range_2, modify_region)
+       (prepare_to_modify_buffer, signal_before_change)
+       (signal_after_change, Fcombine_after_change_execute):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * intervals.c (traverse_intervals, rotate_right, rotate_left)
+       (balance_an_interval, split_interval_right, split_interval_left)
+       (find_interval, next_interval, update_interval)
+       (adjust_intervals_for_insertion, delete_node, delete_interval)
+       (interval_deletion_adjustment, adjust_intervals_for_deletion)
+       (static_offset_intervals, offset_intervals)
+       (merge_interval_right, merge_interval_left, make_new_interval)
+       (graft_intervals_into_buffer, temp_set_point_both)
+       (temp_set_point, set_point, adjust_for_invis_intang)
+       (set_point_both, move_if_not_intangible, get_property_and_range)
+       (get_local_map, copy_intervals, copy_intervals_to_string)
+       (compare_string_intervals, set_intervals_multibyte_1):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * intervals.h: Adjust decls to match defn changes elsewhere.
+       (struct interval):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * keyboard.c (this_command_key_count, this_single_command_key_start)
+       (before_command_key_count, before_command_echo_length, echo_now)
+       (echo_length, recursive_edit_1, Frecursive_edit, Ftrack_mouse)
+       (command_loop_1, safe_run_hooks, read_char, timer_check_2)
+       (menu_item_eval_property, read_key_sequence, Fread_key_sequence)
+       (Fread_key_sequence_vector, Fexecute_extended_command, Fsuspend_emacs):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (last_non_minibuf_size, last_point_position, echo_truncate)
+       (command_loop_1, adjust_point_for_property, read_char, gen_help_event)
+       (make_lispy_position, make_lispy_event, parse_modifiers_uncached)
+       (parse_modifiers, modify_event_symbol, Fexecute_extended_command)
+       (stuff_buffered_input):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (last_auto_save, command_loop_1, read_char):
+       Use EMACS_INT, not int, to avoid integer overflow.
+       (record_char): Avoid overflow in total_keys computation.
+       (parse_modifiers_uncached): Redo index calculation to avoid overflow.
+       * keyboard.h: Adjust decls to match defn changes elsewhere.
+       * keymap.c (Fdefine_key, Fcurrent_active_maps, accessible_keymaps_1)
+       (Fkey_description, Fdescribe_vector, Flookup_key):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (click_position): New function, to check that positions are in range.
+       (Fcurrent_active_maps):
+       (describe_command):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Faccessible_keymaps, Fkey_description):
+       (preferred_sequence_p):
+       Don't assume fixnum can fit into int.
+       (Fkey_description): Use SAFE_ALLOCA_LISP, not alloca.
+       Check for integer overflow in size calculations.
+       (Ftext_char_description): Use CHECK_CHARACTER, not CHECK_NUMBER, to
+       avoid mishandling large integers.
+       * lisp.h: Adjust decls to match defn changes elsewhere.
+       (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, struct Lisp_String)
+       (struct vectorlike_header, struct Lisp_Subr, struct Lisp_Hash_Table)
+       (struct Lisp_Marker):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (clip_to_bounds): Now an inline function, moved here from editfns.c.
+       (GLYPH_CODE_P): Check for overflow in system types, subsuming the
+       need for GLYPH_CODE_CHAR_VALID_P and doing proper checking ourselves.
+       All callers changed.
+       (GLYPH_CODE_CHAR, GLYPH_CODE_FACE):
+       Assume the arg has valid form, since it always does.
+       (TYPE_RANGED_INTEGERP): Avoid bug when checking against a wide
+       unsigned integer system type.
+       (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER): New macros.
+       (struct catchtag, specpdl_size, SPECPDL_INDEX, USE_SAFE_ALLOCA):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (struct catchtag): Use EMACS_INT, not int, since it may be a fixnum.
+       (duration_to_sec_usec): New decl.
+       * lread.c (read_from_string_index, read_from_string_index_byte)
+       (read_from_string_limit, readchar, unreadchar, openp)
+       (read_internal_start, read1, oblookup):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fload, readevalloop, Feval_buffer, Feval_region):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (openp): Check for out-of-range argument to 'access'.
+       (read1): Use int, not EMACS_INT, where int is wide enough.
+       Don't assume fixnum fits into int.
+       Fix off-by-one error that can read outside a buffer.
+       (read_filtered_event): Use duration_to_sec_usec
+       to do proper overflow checking on durations.
+       * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow
+       in size calculation.
+       (Fexecute_kbd_macro):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * marker.c (cached_charpos, cached_bytepos, CONSIDER)
+       (byte_char_debug_check, buf_charpos_to_bytepos, verify_bytepos)
+       (buf_bytepos_to_charpos, Fset_marker, set_marker_restricted)
+       (set_marker_both, set_marker_restricted_both, marker_position)
+       (marker_byte_position, Fbuffer_has_markers_at):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fset_marker, set_marker_restricted): Don't assume fixnum fits in int.
+       * menu.c (ensure_menu_items): Rename from grow_menu_items.
+       It now merely ensures that the menu is large enough, without
+       necessarily growing it, as this avoids some integer overflow issues.
+       All callers changed.
+       (keymap_panes, parse_single_submenu, Fx_popup_menu):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (parse_single_submenu, Fx_popup_menu): Don't assume fixnum fits in int.
+       Use SAFE_ALLOCA_LISP, not alloca.
+       (find_and_return_menu_selection): Avoid unnecessary casts of pointers
+       to EMACS_INT.  Check that fixnums are in proper range for system types.
+       * minibuf.c (minibuf_prompt_width, string_to_object)
+       (Fminibuffer_contents, Fminibuffer_contents_no_properties)
+       (Fminibuffer_completion_contents, Ftry_completion, Fall_completions):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (get_minibuffer, read_minibuf_unwind):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (read_minibuf): Omit unnecessary arg BACKUP_N, which is always nil;
+       this simplifies overflow checking.  All callers changed.
+       (read_minibuf, Fread_buffer, Ftry_completion, Fall_completions)
+       (Ftest_completion):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * nsfns.m (check_ns_display_info): Don't assume fixnum fits in long.
+       (x_set_menu_bar_lines, x_set_tool_bar_lines, Fx_create_frame):
+       Check that fixnums are in proper range for system types.
+       (Fx_create_frame, Fx_show_tip):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * nsfont.m (ns_findfonts, nsfont_list_family):
+       Don't assume fixnum fits in long.
+       * nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (ns_update_menubar): Use intptr_t, not EMACS_INT, when intptr_t is
+       wide enough.
+       * nsselect.m (ns_get_local_selection, clean_local_selection_data):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * print.c (print_buffer_size, print_buffer_pos, print_buffer_pos_byte)
+       (PRINTDECLARE, PRINTPREPARE):
+       (strout, print_string):
+       (print, print_preprocess, print_check_string_charset_prop)
+       (print_object):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (PRINTDECLARE):
+       (temp_output_buffer_setup, Fprin1_to_string, print_object):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (PRINTPREPARE): Use int, not ptrdiff_t, where int is wide enough.
+       (printchar, strout): Use xpalloc to catch size calculation overflow.
+       (Fexternal_debugging_output): Don't overflow EMACS_INT->int conversion.
+       (print_error_message): Use SAFE_ALLOCA, not alloca.
+       (print_object): Use int, not EMACS_INT, where int is wide enough.
+       (print_depth, new_backquote_output, print_number_index):
+       Use ptrdiff_t, not int, where int might not be wide enough.
+       * process.c (Fdelete_process): Don't assume pid fits into EMACS_INT.
+       (Fset_process_window_size, Fformat_network_address)
+       (get_lisp_to_sockaddr_size, set_socket_option, Fmake_network_process)
+       (sigchld_handler):
+       Check that fixnums are in proper range for system types.
+       (Fsignal_process): Simplify by avoiding a goto.
+       Check for process-ids out of pid_t range rather than relying on
+       undefined behavior.
+       (process_tick, update_tick): Use EMACS_INT, not int.
+       (Fformat_network_address, read_process_output, send_process)
+       (Fprocess_send_region, status_notify):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fformat_network_address, Fmake_serial_process, Fmake_network_process)
+       (wait_reading_process_output, read_process_output, exec_sentinel):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (conv_lisp_to_sockaddr): Don't assume fixnums fit into int.
+       (Faccept_process_output): Use duration_to_sec_usec to do proper
+       overflow checking on durations.
+       (emacs_get_tty_pgrp, Fprocess_running_child_p, process_send_signal):
+       Don't assume pid_t fits in int.
+       * process.h (struct Lisp_Process): Members tick and update_tick
+       are now of type EMACS_INT, not int.
+       * puresize.h (PURESIZE_RATIO): Shrink this to 8/6 on 32-bit hosts
+       configured --with-wide-int.
+       * scroll.c (calculate_scrolling, calculate_direct_scrolling)
+       (line_ins_del): Use int, not EMACS_INT, where int is wide enough.
+       * search.c (looking_at_1, string_match_1):
+       (fast_string_match, fast_c_string_match_ignore_case)
+       (fast_string_match_ignore_case, fast_looking_at, scan_buffer)
+       (scan_newline, find_before_next_newline, search_command)
+       (trivial_regexp_p, search_buffer, simple_search, boyer_moore)
+       (set_search_regs, wordify):
+       (Freplace_match):
+       (Fmatch_data):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (string_match_1, search_buffer, set_search_regs):
+       (Fmatch_data):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (wordify): Check for overflow in size calculation.
+       (Freplace_match): Avoid potential buffer overflow in search_regs.start.
+       (Fset_match_data): Don't assume fixnum fits in ptrdiff_t.
+       Check that fixnums are in proper range for system types.
+       * sound.c (struct sound_device)
+       (wav_play, au_play, vox_write, alsa_period_size, alsa_write):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fplay_sound_internal):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * syntax.c (struct lisp_parse_state, find_start_modiff)
+       (Finternal_describe_syntax_value, scan_lists, scan_sexps_forward):
+       (Fparse_partial_sexp):
+       Don't assume fixnums can fit in int.
+       (struct lisp_parse_state, find_start_pos, find_start_value)
+       (find_start_value_byte, find_start_begv)
+       (update_syntax_table, char_quoted, dec_bytepos)
+       (find_defun_start, prev_char_comend_first, back_comment):
+       (scan_words, skip_chars, skip_syntaxes, forw_comment, Fforward_comment)
+       (scan_lists, Fbackward_prefix_chars, scan_sexps_forward):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Finternal_describe_syntax_value): Check that match_lisp is a
+       character, not an integer, since the code stuffs it into int.
+       (scan_words, scan_sexps_forward):
+       Check that fixnums are in proper range for system types.
+       (Fforward_word):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (scan_sexps_forward):
+       Use CHARACTERP, not INTEGERP, since the value must fit into int.
+       (Fparse_partial_sexp): Fix doc; element 8 is not ignored.
+       * syntax.h: Adjust decls to match defn changes elsewhere.
+       (struct gl_state_s):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (SETUP_SYNTAX_TABLE_FOR_OBJECT): Use PTRDIFF_MAX, not
+       MOST_POSITIVE_FIXNUM.
+       * sysdep.c (wait_for_termination_1, wait_for_termination)
+       (interruptible_wait_for_termination, mkdir):
+       Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit.
+       (emacs_read, emacs_write):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (system_process_attributes): Don't assume uid_t, gid_t, EMACS_INT,
+       and double all fit in int.
+       * term.c (set_tty_color_mode):
+       Check that fixnums are in proper range for system types.
+       * termhooks.h (struct input_event):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * textprop.c (validate_interval_range, interval_of)
+       (Fadd_text_properties, set_text_properties_1)
+       (Fremove_text_properties, Fremove_list_of_text_properties)
+       (Ftext_property_any, Ftext_property_not_all)
+       (copy_text_properties, text_property_list, extend_property_ranges)
+       (verify_interval_modification):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fnext_single_char_property_change)
+       (Fprevious_single_char_property_change):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (copy_text_properties):
+       Check for integer overflow in index calculation.
+       * undo.c (last_boundary_position, record_point, record_insert)
+       (record_delete, record_marker_adjustment, record_change)
+       (record_property_change):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (truncate_undo_list, Fprimitive_undo): Don't assume fixnum fits in int.
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * w32fns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip)
+       (Fx_hide_tip, Fx_file_dialog):
+       * w32menu.c (set_frame_menubar):
+       Use ptrdiff_t, not int, for consistency with rest of code.
+       * window.c (window_scroll_preserve_hpos, window_scroll_preserve_vpos)
+       (select_window, Fdelete_other_windows_internal)
+       (window_scroll_pixel_based, window_scroll_line_based)
+       (Frecenter, Fset_window_configuration):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (Fset_window_hscroll, run_window_configuration_change_hook)
+       (set_window_buffer, temp_output_buffer_show, scroll_command)
+       (Fscroll_other_window, Frecenter):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Fwindow_line_height, window_scroll, Fscroll_left, Fscroll_right):
+       Don't assume fixnum fits in int.
+       (Fset_window_scroll_bars):
+       Check that fixnums are in proper range for system types.
+       * xdisp.c (help_echo_pos, pos_visible_p, string_pos_nchars_ahead)
+       (string_pos, c_string_pos, number_of_chars, init_iterator)
+       (in_ellipses_for_invisible_text_p, init_from_display_pos)
+       (compute_stop_pos, next_overlay_change, compute_display_string_pos)
+       (compute_display_string_end, handle_face_prop)
+       (face_before_or_after_it_pos, handle_invisible_prop)
+       (handle_display_prop, handle_display_spec, handle_single_display_spec)
+       (display_prop_intangible_p, string_buffer_position_lim)
+       (string_buffer_position, handle_composition_prop, load_overlay_strings)
+       (get_overlay_strings_1, get_overlay_strings)
+       (iterate_out_of_display_property, forward_to_next_line_start)
+       (back_to_previous_visible_line_start, reseat, reseat_to_string)
+       (get_next_display_element, set_iterator_to_next)
+       (get_visually_first_element, compute_stop_pos_backwards)
+       (handle_stop_backwards, next_element_from_buffer)
+       (move_it_in_display_line_to, move_it_in_display_line)
+       (move_it_to, move_it_vertically_backward, move_it_by_lines)
+       (add_to_log, message_dolog, message_log_check_duplicate)
+       (message2, message2_nolog, message3, message3_nolog
+       (with_echo_area_buffer, display_echo_area_1, resize_mini_window_1)
+       (current_message_1, truncate_echo_area, truncate_message_1)
+       (set_message, set_message_1, store_mode_line_noprop)
+       (hscroll_window_tree, debug_delta, debug_delta_bytes, debug_end_vpos)
+       (text_outside_line_unchanged_p, check_point_in_composition)
+       (reconsider_clip_changes)
+       (redisplay_internal, set_cursor_from_row, try_scrolling)
+       (try_cursor_movement, set_vertical_scroll_bar, redisplay_window)
+       (redisplay_window, find_last_unchanged_at_beg_row)
+       (find_first_unchanged_at_end_row, row_containing_pos, try_window_id)
+       (trailing_whitespace_p, find_row_edges, display_line)
+       (RECORD_MAX_MIN_POS, Fcurrent_bidi_paragraph_direction)
+       (display_mode_element, store_mode_line_string)
+       (pint2str, pint2hrstr, decode_mode_spec)
+       (display_count_lines, display_string, draw_glyphs)
+       (x_produce_glyphs, x_insert_glyphs)
+       (rows_from_pos_range, mouse_face_from_buffer_pos)
+       (fast_find_string_pos, mouse_face_from_string_pos)
+       (note_mode_line_or_margin_highlight, note_mouse_highlight):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (safe_call, init_from_display_pos, handle_fontified_prop)
+       (handle_single_display_spec, load_overlay_strings)
+       (with_echo_area_buffer, setup_echo_area_for_printing)
+       (display_echo_area, echo_area_display)
+       (x_consider_frame_title, prepare_menu_bars, update_menu_bar)
+       (update_tool_bar, hscroll_window_tree, redisplay_internal)
+       (redisplay_window, dump_glyph_row, display_mode_line)
+       (Fformat_mode_line, decode_mode_spec, on_hot_spot_p):
+       (handle_display_spec, display_prop_string_p):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (handle_single_display_spec, build_desired_tool_bar_string)
+       (redisplay_tool_bar, scroll_window_tree, Fdump_glyph_matrix)
+       (get_specified_cursor_type):
+       Check that fixnums are in proper range for system types.
+       (struct overlay_entry, resize_mini_window, Fdump_glyph_row)
+       (Flookup_image_map):
+       Don't assume fixnums fit in int.
+       (compare_overlay_entries):
+       Avoid mishandling comparisons due to subtraction overflow.
+       (load_overlay_strings): Use SAFE_NALLOCA, not alloca.
+       (last_escape_glyph_face_id, last_glyphless_glyph_face_id):
+       (handle_tool_bar_click):
+       Use int, not unsigned, since we prefer signed and the signedness
+       doesn't matter here.
+       (get_next_display_element, next_element_from_display_vector):
+       Use int, not EMACS_INT, when int is wide enough.
+       (start_hourglass): Use duration_to_sec_usec to do proper
+       overflow checking on durations.
+       * xfaces.c (Fbitmap_spec_p):
+       Check that fixnums are in proper range for system types.
+       (compare_fonts_by_sort_order):
+       Avoid mishandling comparisons due to subtraction overflow.
+       (Fx_family_fonts, realize_basic_faces):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Fx_family_fonts):
+       Don't assume fixnum fits in int.
+       Use SAFE_ALLOCA_LISP, not alloca.
+       (merge_face_heights): Remove unnecessary cast to EMACS_INT.
+       (Finternal_make_lisp_face): Don't allocate more than MAX_FACE_ID.
+       (face_at_buffer_position, face_for_overlay_string)
+       (face_at_string_position):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       (merge_faces): Use int, not EMACS_INT, where int is wide enough.
+       * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines, x_icon_verify)
+       (Fx_show_tip):
+       Check that fixnums are in proper range for system types.
+       (Fx_create_frame, x_create_tip_frame, Fx_show_tip)
+       (Fx_hide_tip, Fx_file_dialog, Fx_select_font):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (Fx_change_window_property): Don't assume fixnums fit in int.
+       * xfont.c (xfont_chars_supported):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * xmenu.c (Fx_popup_dialog, set_frame_menubar)
+       (create_and_show_popup_menu, create_and_show_dialog, xmenu_show):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * xml.c (parse_region):
+       * xrdb.c (magic_file_p):
+       Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
+       * xselect.c (TRACE1): Don't assume pid_t promotes to int.
+       (x_get_local_selection, x_reply_selection_request)
+       (x_handle_selection_request, wait_for_property_change):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       (selection_data_to_lisp_data): Use short, not EMACS_INT, where
+       short is wide enough.
+       (x_send_client_event): Don't assume fixnum fits in int.
+       * xterm.c (x_x_to_emacs_modifiers):
+       Don't assume EMACS_INT overflows nicely into int.
+       (x_emacs_to_x_modifiers): Use EMACS_INT, not int, because values
+       may come from Lisp.
+       (handle_one_xevent): NATNUMP can eval its arg twice.
+       (x_connection_closed):
+       Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
+       * xterm.h: Adjust decls to match defn changes elsewhere.
+       (struct scroll_bar): Use struct vectorlike_header
+       rather than rolling our own approximation.
+       (SCROLL_BAR_VEC_SIZE): Remove; not used.
+
+2012-05-25  Glenn Morris  <rgm@gnu.org>
+
+       * lisp.mk (lisp): Update for more files being compiled now.
+
+2012-05-25  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * lread.c: Remove `read_pure' which makes no difference.
+       (read_pure): Remove var.
+       (unreadpure): Remove function.
+       (readevalloop): Don't call read_list with -1 flag.
+       (read1, read_vector): Don't test read_pure any more.
+       (read_list): Simplify.
+
+       * fileio.c, character.h: Minor style tweaks.
+
+2012-05-24  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * window.h (clip_changed): Remove useless declaration.
+
+2012-05-22  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in: Follow-up to 2012-05-22T16:20:27Z!eggert@cs.ucla.edu.
+       (TAGS, TAGS-gmake, CONFIG_H): Remove further references to m/intel386.h.
+
+2012-05-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove src/m/*.
+       This directory predates autoconf and is no longer needed nowadays.
+       Move its few remaining bits of functionality to where they're needed.
+       * m/README, m/alpha.h, m/amdx86-64.h, m/ia64.h, m/ibmrs6000.h:
+       * m/ibms390x.h, m/intel386.h, m/m68k.h, m/macppc.h, m/sparc.h:
+       * m/template.h: Remove.
+       * Makefile.in (M_FILE): Remove.  All uses removed.
+       * alloc.c (POINTERS_MIGHT_HIDE_IN_OBJECTS):
+       * lisp.h (USE_LSB_TAG):
+       * mem-limits.h (EXCEEDS_LISP_PTR):
+       Use VAL_MAX, not VALBITS, in #if.
+       * lisp.h (EMACS_INT_MAX): New macro, useful in #if.
+       (EMACS_UINT): Define unconditionally now.
+       (BITS_PER_CHAR, BITS_PER_SHORT, BITS_PER_INT, BITS_PER_LONG)
+       (BITS_PER_EMACS_INT): New constants, replacing
+       what used to be in config.h, but not useful in #if.
+       (GCTYPEBITS, VALBITS): Define unconditionally, since m/* files don't
+       define them any more.
+       (VAL_MAX): New macro.
+       (VALMASK): Use it.
+       * puresize.h (PURESIZE_RATIO): Use EMACS_INT_MAX, not
+       BITS_PER_EMACS_INT, in #if.
+       * s/aix4-2.h (BROKEN_FIONREAD, BROKEN_SIGAIO, BROKEN_SIGPTY)
+       (BROKEN_SIGPOLL): Move here from m/ibmrs6000.h, which was removed.
+       * s/gnu-linux.h (ULIMIT_BREAK_VALUE) [__i386__]:
+       * s/ms-w32.h (DATA_START):
+       Move here from removed file m/intel386.h.
+       * s/gnu.h (NLIST_STRUCT): Remove undef; 'configure' does this.
+       * s/irix6-5.h (_LP64): Remove; lisp.h no longer needs this.
+
+2012-05-21  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Assume C89 or later.
+       * alloc.c, buffer.c, lisp.h: Replace POINTER_TYPE with void.
+       * alloc.c (overrun_check_malloc, overrun_check_realloc, xmalloc)
+       (xrealloc):
+       * buffer.c (mmap_free_1, mmap_enlarge): Omit needless casts.
+       * editfns.c, fns.c, gmalloc.c, insdel.c, sysdep.c, termcap.c (NULL):
+       * textprop.c, tparam.c (NULL): Remove.
+       * ralloc.c, vm-limit.c (POINTER): Assume void * works.
+       * regex.c (SIGN_EXTEND_CHAR): Assume signed char works.
+       * regex.h (_RE_ARGS): Remove.  All uses rewritten to use prototypes.
+       * unexelf.c (ElfBitsW): Assume c89 preprocessor or better.
+       * xterm.c (input_signal_count): Assume volatile works.
+
+2012-05-21  Ken Brown  <kbrown@cornell.edu>
+
+       * xgselect.c (xg_select): Fix first argument in call to 'select'
+       (bug#11508).
+
+2012-05-20  Ken Brown  <kbrown@cornell.edu>
+
+       * gmalloc.c (_free_internal_nolock, _realloc_internal_nolock)
+       [CYGWIN]: Cast ptr to (char *) before comparing to _heapbase.
+
+2012-05-19  Ken Brown  <kbrown@cornell.edu>
+
+       * xfns.c (x_in_use): Remove `static' qualifier.
+       * xterm.h (x_in_use): Declare.
+       * xgselect.c: Include xterm.h.
+       (xg_select): Test `x_in_use' instead of `inhibit_window_system'
+       and `display_arg' (bug#9754).
+
+2012-05-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * s/ms-w32.h (HAVE_GETDOMAINNAME): Remove; not needed.
+
+       * m/vax.h: Remove; no longer needed since HAVE_FTIME is being removed.
+       * s/ms-w32.h (HAVE_FTIME): Remove; not needed.
+
+2012-05-18  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix compilation with -DGLYPH_DEBUG=1 on MS-Windows.
+
+       * w32term.c [GLYPH_DEBUG]: Add prototype for x_check_font.
+       (x_check_font) [GLYPH_DEBUG]: New function, copied from xterm.c.
+
+       * w32fns.c (unwind_create_frame) [GLYPH_DEBUG]: Fix broken
+       reference to image_cache->refcount.
+       (x_create_tip_frame): Fix broken use of FRAME_IMAGE_CACHE.
+
+2012-05-17  Juri Linkov  <juri@jurta.org>
+
+       * search.c (Fword_search_regexp, Fword_search_backward)
+       (Fword_search_forward, Fword_search_backward_lax)
+       (Fword_search_forward_lax): Move functions to isearch.el
+       (bug#10145, bug#11381).
 
-       * xdisp.c (pos_visible_p): Fix last change.  (Bug#11464)
+2012-05-16  Paul Eggert  <eggert@cs.ucla.edu>
 
-2012-05-13  Eli Zaretskii  <eliz@gnu.org>
+       * xgselect.c (xg_select): Just invoke 'select' if -nw (Bug#9754).
+
+2012-05-15  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * lread.c (init_obarray): Declare Qt and Qnil as special.
+
+2012-05-14  Glenn Morris  <rgm@gnu.org>
+
+       * nsterm.m (ns_init_paths): Fix typo ("libexec" not "lib-exec").
+       Put "libexec" before "bin", for the sake of init_callproc_1.
+
+2012-05-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * keyboard.c (kbd_buffer_get_event) [!HAVE_DBUS]: Omit unused local.
+
+       * unexaix.c: Port to more-recent AIX compilers.
+       (report_error, report_error_1, make_hdr, copy_sym)
+       (mark_x, adjust_lnnoptrs, unrelocate_symbols):
+       Make arguments const char *, not char *, to avoid violations of C
+       standard and to fix some AIX warnings reported by Gilles Pion.
+
+2012-05-14  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (handle_stop): Don't call get_overlay_strings_1 if we
        already have overlays loaded.
        stopped at the last line of window, which happens to be scanned
        backwards by the bidi iteration.  (Bug#11464)
 
-2012-05-11  Eli Zaretskii  <eliz@gnu.org>
+2012-05-14  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (handle_single_display_spec): Return 1 for left-margin
        and right-margin display specs even if the spec is invalid or we
-       are on a TTY, and thus unable to display on the fringes.  That's
-       because the text with the property will not be displayed anyway,
+       are on a TTY, and thus unable to display on the fringes.
+       That's because the text with the property will not be displayed anyway,
        so we need to signal to the caller that this is a "replacing"
        display spec.  This fixes display when the spec is invalid or we
        are on a TTY.
 
-2012-05-09  Paul Eggert  <eggert@cs.ucla.edu>
+2012-05-14  Paul Eggert  <eggert@cs.ucla.edu>
 
        * unexaix.c (make_hdr): Fix typo in prototype.
        This bug broke the build on AIX.  Problem reported by Gilles Pion.
 
-2012-05-05  Eli Zaretskii  <eliz@gnu.org>
+2012-05-14  Michael Albinus  <michael.albinus@gmx.de>
+
+       * keyboard.c (kbd_buffer_get_event): Read special events also in
+       batch mode.  (Bug#11415)
+
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * ns.mk: Update for ns_appbindir no longer having trailing "/".
+
+2012-05-12  Eli Zaretskii  <eliz@gnu.org>
+
+       * lisp.mk (lisp): Add newcomment.elc.
+
+2012-05-12  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (MKDIR_P): New, set by configure.
+       * ns.mk (${ns_appdir}, ${ns_appbindir}Emacs): Use $MKDIR_P.
+
+2012-05-11  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Remove unused function hourglass_started.
+       * dispextern.h (hourglass_started):
+       * w32fns.c (hourglass_started):
+       * xdisp.c (hourglass_started): Remove.
+
+2012-05-10  Juanma Barranquero  <lekktu@gmail.com>
+
+       * makefile.w32-in ($(BLD)/gmalloc.$(O), $(BLD)/w32menu.$(O)):
+       Update dependencies.
+
+2012-05-10  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * xgselect.c (xg_select): Put maxfds+1 into a var.
+       This is slightly clearer, and pacifies Ubuntu 12.04 gcc.
+
+       * sound.c (DEFAULT_ALSA_SOUND_DEVICE): Define only if HAVE_ALSA.
+
+2012-05-10  Dave Abrahams  <dave@boostpro.com>
+
+       * filelock.c (syms_of_filelock): New boolean create-lockfiles.
+       (lock_file): If create_lockfiles is 0, do nothing.  (Bug#11227)
+
+2012-05-09  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbusbind.c (xd_registered_buses): New internal Lisp object.
+       Rename all occurences of Vdbus_registered_buses to xd_registered_buses.
+       (syms_of_dbusbind): Remove declaration of Vdbus_registered_buses.
+       Initialize xd_registered_buses.
+
+2012-05-09  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Untag more efficiently if USE_LSB_TAG.
+       This is based on a proposal by YAMAMOTO Mitsuharu in
+       <http://lists.gnu.org/archive/html/emacs-devel/2008-01/msg01876.html>.
+       For an admittedly artificial (nth 8000 longlist) benchmark on
+       Fedora 15 x86-64, this yields a 25% CPU speedup.  Also, it shrinks
+       Emacs's overall text size by 1%.
+       * lisp.h (XUNTAG): New macro.
+       (XCONS, XVECTOR, XSTRING, XSYMBOL, XFLOAT, XMISC, XPROCESS, XWINDOW)
+       (XTERMINAL, XSUBR, XBUFFER, XCHAR_TABLE, XSUB_CHAR_TABLE, XBOOL_VECTOR)
+       (XSETTYPED_PSEUDOVECTOR, XHASH_TABLE, TYPED_PSEUDOVECTORP): Use it.
+       * eval.c (Fautoload):
+       * font.h (XFONT_SPEC, XFONT_ENTITY, XFONT_OBJECT):
+       * frame.h (XFRAME): Use XUNTAG.
+
+       Port recent dbusbind.c changes to 32-bit --with-wide-int.
+       * dbusbind.c (xd_append_arg, xd_retrieve_arg, Fdbus_message_internal):
+       Remove unportable assumptions about print widths of types like
+       dbus_uint32_t.
+       (xd_get_connection_address, Fdbus_init_bus): Cast Emacs integer to
+       intptr_t when converting between pointer and integer, to avoid GCC
+       warnings about wrong width.
+
+2012-05-09  Eli Zaretskii  <eliz@gnu.org>
 
        * w32proc.c (new_child): Force Windows to reserve only 64KB of
        stack for each reader_thread, instead of defaulting to 8MB
        subprocesses on Windows 7, see the discussion in this thread:
        http://lists.gnu.org/archive/html/emacs-devel/2012-03/msg00119.html.
 
-2012-05-02  Jim Meyering  <meyering@redhat.com>
+2012-05-07  Jérémy Compostella  <jeremy.compostella@gmail.com>
+
+       Fix up display of the *Minibuf-0* buffer in the mini window.
+       * keyboard.c (read_char): Don't clear the echo area if there's no
+       message to clear.
+       * xdisp.c (redisplay_internal): Redisplay the mini window (with the
+       contents of *Minibuf-0*) if there's no message displayed in its stead.
+
+2012-05-07  Michael Albinus  <michael.albinus@gmx.de>
+
+       * dbusbind.c (XD_DEBUG_MESSAGE): Don't print message twice in
+       batch mode.
+
+2012-05-06  Chong Yidong  <cyd@gnu.org>
+
+       * lisp.mk (lisp): Update.
+
+2012-05-05  Jim Meyering  <meyering@redhat.com>
 
        * w32font.c (fill_in_logfont): NUL-terminate a string (Bug#11372).
 
-2012-04-29  Eli Zaretskii  <eliz@gnu.org>
+2012-05-04  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * data.c (PUT_ERROR): New macro.
+       (syms_of_data): Use it.  Add new error type `user-error'.
+       * undo.c (user_error): New function.
+       (Fprimitive_undo): Use it.
+       * print.c (print_error_message): Adjust print style for `user-error'.
+       * keyboard.c (user_error): New function.
+       (Fexit_recursive_edit, Fabort_recursive_edit): Use it.
+
+2012-05-03  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Do not limit current-time-string to years 1000..9999.
+       * editfns.c (TM_YEAR_IN_ASCTIME_RANGE): Remove.
+       (Fcurrent_time_string): Support any year that is supported by the
+       underlying localtime representation.  Don't use asctime, as it
+       has undefined behavior for years outside the range -999..9999.
+
+2012-05-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix race conditions involving setenv, gmtime, localtime, asctime.
+       Without this fix, interrupts could mess up code that uses these
+       nonreentrant functions, since setting TZ invalidates existing
+       tm_zone or tzname values, and since most of these functions return
+       pointers to static storage.
+       * editfns.c (format_time_string, Fdecode_time, Fencode_time)
+       (Fcurrent_time_string, Fcurrent_time_zone, Fset_time_zone_rule):
+       Grow the critical sections to include not just invoking
+       localtime/gmtime, but also accessing these functions' results
+       including their tm_zone values if any, and any related TZ setting.
+       (format_time_string): Last arg is now struct tm *, not struct tm **,
+       so that the struct tm is saved in the critical section.
+       All callers changed.  Simplify allocation of initial buffer, partly
+       motivated by the fact that memory allocation needs to be outside
+       the critical section.
+
+2012-05-02  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * intervals.c (adjust_intervals_for_insertion): Initialize `newi'
+       with RESET_INTERVAL.
+
+       * buffer.c (Fget_buffer_create, Fmake_indirect_buffer):
+       Remove duplicated buffer name initialization.
+
+2012-05-02  Jim Meyering  <jim@meyering.net>
+
+       * xterm.c (x_term_init): Use memcpy instead of strncpy (Bug#11373).
+
+       * xfns.c (x_window): Use xstrdup (Bug#11375).
+
+2012-05-02  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (pos_visible_p): If already at a newline from the
        display string before the 'while' loop, don't walk back the glyphs
        from it3.glyph_row.  Solves assertion violation when the display
        string begins with a newline (egg.el).  (Bug#11367)
 
-2012-04-24  Chong Yidong  <cyd@gnu.org>
+2012-05-01  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * keyboard.c (Fexecute_extended_command, Vsuggest_key_bindings):
+       Move to simple.el.
+
+2012-05-01  Glenn Morris  <rgm@gnu.org>
+
+       * syssignal.h: Remove reference to BROKEN_SIGINFO (last used in
+       s/ptx4.h), BROKEN_SIGTSTP (last used in m/ustation.h, m/dpx2.h),
+       and BROKEN_SIGURG (was in s/gnu-linux.h prior to 2008-02-10).
+       All were removed before 23.1.
+
+       * dispnew.c: Remove HAVE_LIBNCURSES test;
+       it is always true on relevant platforms.
+
+       * Makefile.in (LD_SWITCH_X_SITE_RPATH):
+       Rename from LD_SWITCH_X_SITE_AUX_RPATH.
+
+       * Makefile.in (LD_SWITCH_X_SITE_AUX): Remove; no longer used.
+
+2012-04-30  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * .gdbinit (xpr): Remove checks for no longer existing misc types.
+       (xintfwd, xboolfwd, xobjfwd, xbufobjfwd, xkbobjfwd, xbuflocal):
+       Remove.
+
+2012-04-28  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Do not avoid creating empty evaporating overlays (Bug#9642).
+       * buffer.c (Fmove_overlay): Revert the change of 2012-04-23.
+       That is, do not delete an evaporating overlay if it becomes
+       empty after its bounds are adjusted to fit within its buffer.
+       This fix caused other problems, and I'm reverting it until we get
+       to the bottom of them.
+
+2012-04-27  Chong Yidong  <cyd@gnu.org>
 
        * xselect.c (x_convert_selection): Initialize a pointer (Bug#11315).
 
-2012-04-23  Eli Zaretskii  <eliz@gnu.org>
+2012-04-27  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (pos_visible_p): If the window start position is beyond
        ZV, start the display from buffer beginning.  Prevents assertion
 
        * window.c (window_scroll_pixel_based): Likewise.
 
-2012-04-23  Chong Yidong  <cyd@gnu.org>
+2012-04-27  Chong Yidong  <cyd@gnu.org>
 
        * keymap.c (where_is_internal): Doc fix (Bug#10872).
 
-2012-04-20  Glenn Morris  <rgm@gnu.org>
+2012-04-27  Glenn Morris  <rgm@gnu.org>
 
        * fileio.c (Fcopy_file, Fset_file_selinux_context):
        Ignore ENOTSUP failures from setfilecon functions.  (Bug#11245)
 
-2012-04-20  Eli Zaretskii  <eliz@gnu.org>
+2012-04-27  Eli Zaretskii  <eliz@gnu.org>
+
+       * dispnew.c (swap_glyph_pointers, copy_row_except_pointers):
+       Don't overrun array limits of glyph row's used[] array.  (Bug#11288)
+
+2012-04-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (IT_DISPLAYING_WHITESPACE): In addition to the loaded
+       display element, check also the underlying string or buffer
+       character.  (Bug#11341)
+
+       * w32menu.c: Include w32heap.h.
+       (add_menu_item): If the call to AppendMenuW (via
+       unicode_append_menu) fails, disable Unicode menus only if we are
+       running on Windows 9X/Me.
+
+2012-04-24  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * .gdbinit (xpr): Handle USE_2_TAGS_FOR_INTS.
+       (xgetint): Add missing shift for LSB tags.
+
+2012-04-24  Martin Rudalics  <rudalics@gmx.at>
+
+       * keyboard.c (read_char): Don't wipe echo area for select window
+       events: These might get delayed via `mouse-autoselect-window'
+       (Bug#11304).
+
+2012-04-24  Juanma Barranquero  <lekktu@gmail.com>
+
+       * gnutls.c (init_gnutls_functions): Protect against (unlikely)
+       manipulation of :loaded-from data.
+
+2012-04-23  Juanma Barranquero  <lekktu@gmail.com>
+
+       * gnutls.c (init_gnutls_functions): The value of :loaded-from is
+       now a cons (bug#11311).
+
+2012-04-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Do not create empty overlays with the evaporate property (Bug#9642).
+       * buffer.c (Fmove_overlay): Delete an evaporating overlay
+       if it becomes empty after its bounds are adjusted to fit within
+       its buffer.  Without this fix, in a nonempty buffer (let ((o
+       (make-overlay 1 2))) (overlay-put o 'evaporate t) (move-overlay o 0 1))
+       yields an empty overlay that has the evaporate property, which is
+       not supposed to happen.
+
+       Fix minor GTK3 problems found by static checking.
+       * emacsgtkfixed.c (EMACS_TYPE_FIXED, EMACS_FIXED, EmacsFixed)
+       (EmacsFixedPrivate, EmacsFixedClass, struct _EmacsFixed)
+       (struct _EmacsFixedClass, emacs_fixed_get_type):
+       Move decls here from emacsgtkfixed.h, since they needn't be public.
+       (emacs_fixed_get_type): Now static.
+       (emacs_fixed_class_init): Omit unused local.
+       (emacs_fixed_child_type): Remove; unused.
+       * emacsgtkfixed.h (EMACS_TYPE_FIXED, EMACS_FIXED, EmacsFixed)
+       (EmacsFixedPrivate, EmacsFixedClass, struct _EmacsFixed)
+       (struct _EmacsFixedClass): Move to emacsgtkfixed.c.
+       (EMACS_FIXED_CLASS, EMACS_IS_FIXED, EMACS_IS_FIXED_CLASS)
+       (EMACS_FIXED_GET_CLASS): Remove; unused.
+       * gtkutil.c (xg_create_frame_widgets) [!HAVE_GTK3]: Omit unused local.
+
+       * keyboard.c (handle_async_input): Define only if SYNC_INPUT || SIGIO.
+       Problem reported by Juanma Barranquero for Windows -Wunused-function.
+
+2012-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Modernize and clean up gmalloc.c to assume C89 (Bug#9119).
+       * gmalloc.c (_MALLOC_INTERNAL, _MALLOC_H, _PP, __ptr_t)
+       (__malloc_size_t, __malloc_ptrdiff_t):
+       Remove.  All uses removed, replaced by the definiens if needed,
+       since we can assume C89 or better now.
+       Include <stdint.h>, for PTRDIFF_MAX, uintptr_t.
+       (protect_malloc_state, align, get_contiguous_space)
+       (malloc_atfork_handler_prepare, malloc_atfork_handler_parent)
+       (malloc_atfork_handler_child, malloc_enable_thread)
+       (malloc_initialize_1, __malloc_initialize, morecore_nolock)
+       (_malloc_internal_nolock, _malloc_internal, malloc, _malloc)
+       (_free, _realloc, _free_internal_nolock, _free_internal, free, cfree)
+       (special_realloc, _realloc_internal_nolock, _realloc_internal)
+       (realloc, calloc, __default_morecore, memalign, valloc, checkhdr)
+       (freehook, mallochook, reallochook, mabort, mcheck, mprobe):
+       Define using prototypes, not old style.
+       (align, _malloc_internal_nolock, _free_internal_nolock, memalign):
+       Don't assume ptrdiff_t and uintptr_t are no wider than unsigned long.
+       (align): Don't assume that signed integer overflow wraps around.
+       Omit unused local var.
+       (malloc_initialize_1, morecore_nolock, _malloc_internal_nolock)
+       (_free_internal_nolock, memalign, mallochook, reallochook):
+       Omit no-longer-needed casts.
+       (valloc): Use getpagesize, not __getpagesize.
+       (MAGICWORD, MAGICFREE): Now randomish size_t values, not 32-bit.
+       (struct hdr): The 'magic' member is now size_t, not unsigned long.
+
+       * dbusbind.c (XD_DBUS_VALIDATE_OBJECT): Define only if needed.
+
+2012-04-22  Michael Albinus  <michael.albinus@gmx.de>
+
+       Move functions from C to Lisp.  Make non-blocking method calls
+       the default.  Implement further D-Bus standard interfaces.
+
+       * dbusbind.c (DBUS_NUM_MESSAGE_TYPES): Declare.
+       (QCdbus_request_name_allow_replacement)
+       (QCdbus_request_name_replace_existing)
+       (QCdbus_request_name_do_not_queue)
+       (QCdbus_request_name_reply_primary_owner)
+       (QCdbus_request_name_reply_in_queue)
+       (QCdbus_request_name_reply_exists)
+       (QCdbus_request_name_reply_already_owner): Move to dbus.el.
+       (QCdbus_registered_serial, QCdbus_registered_method)
+       (QCdbus_registered_signal): New Lisp objects.
+       (XD_DEBUG_MESSAGE): Use sizeof.
+       (XD_MESSAGE_TYPE_TO_STRING, XD_OBJECT_TO_STRING)
+       (XD_DBUS_VALIDATE_BUS_ADDRESS, XD_DBUS_VALIDATE_OBJECT)
+       (XD_DBUS_VALIDATE_BUS_NAME, XD_DBUS_VALIDATE_PATH)
+       (XD_DBUS_VALIDATE_INTERFACE, XD_DBUS_VALIDATE_MEMBER): New macros.
+       (XD_CHECK_DBUS_SERIAL): Rename from CHECK_DBUS_SERIAL_GET_SERIAL.
+       (xd_signature, xd_append_arg): Allow float for integer types.
+       (xd_get_connection_references): New function.
+       (xd_get_connection_address): Rename from xd_initialize.
+       Return cached address.
+       (xd_remove_watch): Do not unset $DBUS_SESSION_BUS_ADDRESS.
+       (xd_close_bus): Rename from Fdbus_close_bus.  Not needed on Lisp
+       level.
+       (Fdbus_init_bus): New optional arg PRIVATE.  Cache address.
+       Return number of refcounts.
+       (Fdbus_get_unique_name): Make stronger parameter check.
+       (Fdbus_message_internal): New defun.
+       (Fdbus_call_method, Fdbus_call_method_asynchronously)
+       (Fdbus_method_return_internal, Fdbus_method_error_internal)
+       (Fdbus_send_signal, Fdbus_register_service)
+       (Fdbus_register_signal, Fdbus_register_method): Move to dbus.el.
+       (xd_read_message_1): Obey new structure of Vdbus_registered_objects.
+       (xd_read_queued_messages): Obey new structure of Vdbus_registered_buses.
+       (Vdbus_compiled_version, Vdbus_runtime_version)
+       (Vdbus_message_type_invalid, Vdbus_message_type_method_call)
+       (Vdbus_message_type_method_return, Vdbus_message_type_error)
+       (Vdbus_message_type_signal): New defvars.
+       (Vdbus_registered_buses, Vdbus_registered_objects_table):
+       Adapt docstring.
+
+2012-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix GC_MALLOC_CHECK debugging output on 64-bit hosts.
+       * alloc.c (emacs_blocked_malloc) [GC_MALLOC_CHECK]:
+       Do not assume ptrdiff_t is the same width as 'int'.
+
+       * alloc.c: Handle unusual debugging option combinations.
+       (GC_CHECK_MARKED_OBJECTS): Undef if ! GC_MARK_STACK,
+       since the two debugging options are incompatible.
+       (GC_MALLOC_CHECK): Similarly, undef if GC_CHECK_MARKED_OBJECTS
+       is defined.
+       (mem_init, mem_insert, mem_insert_fixup):
+       Define if GC_MARK_STACK || GC_MALLOC_CHECK.
+       (NEED_MEM_INSERT): Remove; no longer needed.
+
+2012-04-22  Leo Liu  <sdl.web@gmail.com>
+
+       * sysdep.c (list_system_processes): Support Darwin (Bug#5725).
+
+2012-04-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sysdep.c [__FreeBSD__]: Minor cleanups.
+       (list_system_processes, system_process_attributes) [__FreeBSD__]:
+       Use Emacs indenting style more consistently.  Avoid some casts.
+       Use 'double' consistently rather than mixing 'float' and 'double'.
+
+2012-04-21  Eduard Wiebe  <usenet@pusto.de>
 
-       * dispnew.c (swap_glyph_pointers, copy_row_except_pointers): Don't
-       overrun array limits of glyph row's used[] array.  (Bug#11288)
+       * sysdep.c (list_system_processes, system_process_attributes):
+       Add implementation for FreeBSD (Bug#5243).
+
+2012-04-21  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * lisp.mk (lisp): Update.
+
+2012-04-20  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * keyboard.c (process_pending_signals): Define only if SYNC_INPUT.
+       It is never used otherwise.
+
+2012-04-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * print.c (print_preprocess): Only check print_depth if print-circle
+       is nil.
+       (print_object): Check for cycles even when print-circle is nil and
+       print-gensym is t, but only check print_depth if print-circle is nil.
 
 2012-04-20  Chong Yidong  <cyd@gnu.org>
 
        * process.c (wait_reading_process_output): If EIO occurs on a pty,
        set the status to "failed" and ensure that sentinel is run.
 
-2012-04-18  Glenn Morris  <rgm@gnu.org>
+2012-04-20  Glenn Morris  <rgm@gnu.org>
 
        * process.c (Fset_process_inherit_coding_system_flag)
        (Fset_process_query_on_exit_flag): Doc fix (mention return value).
        (Fmake_network_process, Fmake_serial_process): Doc fix.
 
-2012-04-17  Eli Zaretskii  <eliz@gnu.org>
+2012-04-20  Eli Zaretskii  <eliz@gnu.org>
 
        * xdisp.c (string_buffer_position_lim): Limit starting position to
        BEGV.
        (set_cursor_from_row): If called for a mode-line or header-line
        row, return zero immediately.
        (try_cursor_movement): If inside continuation line, don't back up
-       farther than the first row after the header line, if any.  Don't
-       consider the header-line row as "partially visible", even if
+       farther than the first row after the header line, if any.
+       Don't consider the header-line row as "partially visible", even if
        MATRIX_ROW_PARTIALLY_VISIBLE_P returns non-zero.  (Bug#11261)
 
-2012-04-13  Atsuo Ohki  <ohki@gssm.otsuka.tsukuba.ac.jp>  (tiny change)
+2012-04-20  Atsuo Ohki  <ohki@gssm.otsuka.tsukuba.ac.jp>  (tiny change)
+
+       * lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n"
+       (bug#11238).
+
+2012-04-20  Teodor Zlatanov  <tzz@lifelogs.com>
+2012-04-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       configure: new option --enable-gcc-warnings (Bug#11207)
+       * Makefile.in (C_WARNINGS_SWITCH): Remove.
+       (WARN_CFLAGS, WERROR_CFLAGS): New macros.
+       (ALL_CFLAGS): Use new macros rather than old.
+       * process.c: Ignore -Wstrict-overflow to work around GCC bug 52904.
+       * regex.c: Ignore -Wstrict-overflow.  If !emacs, also ignore
+       -Wunused-but-set-variable, -Wunused-function, -Wunused-macros,
+       -Wunused-result, -Wunused-variable.  This should go away once
+       the Emacs and Gnulib regex code is merged.
+       (xmalloc, xrealloc): Now static.
+
+2012-04-17  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * dired.c (Fsystem_groups): Remove unused local.
+
+2012-04-17  Glenn Morris  <rgm@gnu.org>
+
+       * dired.c (Fsystem_users): Doc fix.
+
+2012-04-17  Dmitry Antipov  <dmantipov@yandex.ru>
 
-       * lread.c (lisp_file_lexically_bound_p): Fix hang at ";-*-\n" (bug#11238).
+       * dired.c (Fsystem_users, Fsystem_groups): New functions.  (Bug#7900)
+       (syms_of_dired): Add them.
 
-2012-04-10  Teodor Zlatanov  <tzz@lifelogs.com>
+2012-04-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix minor alloc.c problems found by static checking.
+       * alloc.c (_malloc_internal, _free_internal) [!DOUG_LEA_MALLOC]:
+       New extern decls, to avoid calling undeclared functions.
+       (dont_register_blocks): Define if ((!SYSTEM_MALLOC && !SYNC_INPUT)
+       && GC_MALLOC_CHECK), not if ((GC_MARK_STACK || defined
+       GC_MALLOC_CHECK) && GC_MALLOC_CHECK), to match when it's used.
+       (NEED_MEM_INSERT): New macro.
+       (mem_insert, mem_insert_fixup) [!NEED_MEM_INSERT]: Remove; unused.
+       Remove one incorrect comment and fix another.
+
+       Fix minor ralloc.c problems found by static checking.
+       See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
+       * ralloc.c (ALIGNED, ROUND_TO_PAGE, HEAP_PTR_SIZE)
+       (r_alloc_size_in_use, r_alloc_freeze, r_alloc_thaw): Remove; unused.
+       (r_alloc_sbrk): Now static.
+
+       Improve ralloc.c interface checking.
+       See http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html
+       * buffer.c (ralloc_reset_variable, r_alloc, r_re_alloc)
+       (r_alloc_free) [REL_ALLOC]: Move decls from here ...
+       * lisp.h (r_alloc, r_alloc_free, r_re_alloc, r_alloc_reset_variable)
+       [REL_ALLOC]: ... to here, to check interface.
+       * m/ia64.h (r_alloc, r_alloc_free) [REL_ALLOC && !_MALLOC_INTERNAL]:
+       Remove decls.  This fixes an "It stinks!".
+
+       * alloc.c (which_symbols): Fix alignment issue / type clash.
+
+2012-04-15  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * lisp.h (struct Lisp_Symbol): Remove explicit padding.
+       (struct Lisp_Misc_Any): Likewise.
+       (struct Lisp_Free): Likewise.
+       * alloc.c (union aligned_Lisp_Symbol): Define.
+       (SYMBOL_BLOCK_SIZE, struct symbol_block): Use union
+       aligned_Lisp_Symbol instead of struct Lisp_Symbol.
+       (union aligned_Lisp_Misc): Define.
+       (MARKER_BLOCK_SIZE, struct marker_block): Use union
+       aligned_Lisp_Misc instead of union Lisp_Misc.
+       (Fmake_symbol, allocate_misc, gc_sweep): Adjust.
+
+2012-04-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Make GC_MAKE_GCPROS_NOOPS the default (Bug#9926).
+       * lisp.h (GC_MARK_STACK): Default to GC_MAKE_GCPROS_NOOPS.
+       * s/cygwin.h, s/darwin.h, s/freebsd.h, s/gnu.h, s/irix6-5.h, s/msdos.h:
+       * s/netbsd.h, s/sol2-6.h:
+       Remove definition of GC_MARK_STACK, since the default now works.
+       * s/aix4-2.h, s/hpux10-20.h, s/unixware.h:
+       Define GC_MARK_STACK to GC_USE_GCPROS_AS_BEFORE, since that's
+       no longer the default.
+       * s/gnu-linux.h (GC_MARK_STACK): Adjust to change in default.
+
+2012-04-14  Atsuo Ohki  <ohki@gssm.otsuka.tsukuba.ac.jp>  (tiny change)
+
+       * lread.c (lisp_file_lexically_bound_p):
+       Fix hang at ";-*-\n" (bug#11238).
+
+2012-04-14  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (find_last_unchanged_at_beg_row): Don't consider a row
+       "unchanged" if its end.pos is beyond ZV.  (Bug#11199)
+
+2012-04-14  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (constrainFrameRect): Always constrain when there is only
+       one screen (Bug#10962).
+
+2012-04-13  Ken Brown  <kbrown@cornell.edu>
+
+       * s/cygwin.h (PTY_OPEN): Don't try to close a bogus file descriptor.
+
+2012-04-13  Reuben Thomas  <rrt@sc3d.org>
+
+       * indent.c (Fmove_to_column): Change interactive spec (Bug#739).
+
+2012-04-11  Daniel Colascione  <dancol@dancol.org>
+
+       * s/cygwin.h: The vfork the #define in cygwin.h was protecting
+       against is gone.  It's better to use vfork now so that when Cygwin
+       gains a new, working vfork, we use it automatically (bug#10398).
+
+2012-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * window.c (save_window_save): Obey window-point-insertion-type.
+
+2012-04-11  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in (GNUSTEP_CFLAGS): Rename from C_SWITCH_X_SYSTEM.
+
+2012-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * alloc.c (lisp_align_malloc): Remove unneeded prototype.
+
+2012-04-10  Jason S. Cornez  <jcornez@ravenpack.com>  (tiny change)
+
+       * keyboard.c: Override inhibit-quit after the third C-g (bug#6585).
+       (force_quit_count): New var.
+       (handle_interrupt): Use it.
+
+2012-04-10  Juanma Barranquero  <lekktu@gmail.com>
+
+       * w32.c (w32_delayed_load): Record the full path of the library
+       being loaded (bug#10424).
+
+2012-04-09  Glenn Morris  <rgm@gnu.org>
+
+       * doc.c (Fsnarf_documentation): Check variables, functions are bound,
+       not just in the obarray, before snarfing them.  (Bug#11036)
+
+       * Makefile.in ($(leimdir)/leim-list.el):
+       Pass EMACS rather than BUILT_EMACS.
+
+2012-04-09  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * process.c (make_process):
        * process.h: Add integer `gnutls_handshakes_tried' member to
        `GNUTLS_EMACS_HANDSHAKES_LIMIT' to limit the number of handshake
        attempts per process (connection).
 
+2012-04-09  Chong Yidong  <cyd@gnu.org>
+
+       * eval.c (Fuser_variable_p, user_variable_p_eh)
+       (lisp_indirect_variable): Functions deleted.
+       (Fdefvar): Caller changed.
+
+       * callint.c (Finteractive, Fcall_interactively):
+       * minibuf.c (Fread_variable): Callers changed.
+
 2012-04-09  Eli Zaretskii  <eliz@gnu.org>
 
-       * xdisp.c (find_last_unchanged_at_beg_row): Don't consider a row
-       "unchanged" if its end.pos is beyond ZV.  (Bug#11199)
+       * xdisp.c (set_cursor_from_row): If the display string appears in
+       the buffer at position that is closer to point than the position
+       after the display string, display the cursor on the first glyph of
+       the display string.  Fixes cursor display when a 'display' text
+       property immediately follows invisible text.  (Bug#11094)
 
-2012-04-09  Jan Djärv  <jan.h.d@swipnet.se>
+2012-04-09  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * nsterm.m (constrainFrameRect): Always constrain when there is only
-       one screen (Bug#10962).
+       composite.c: use 'double' consistently
+       * composite.c (get_composition_id): Use 'double' consistently
+       instead of converting 'float' to 'double' and vice versa; this is
+       easier to understand and avoids a GCC warning.
+
+2012-04-09  Glenn Morris  <rgm@gnu.org>
+
+       * Makefile.in: Generate leim-list with bootstrap-emacs, in
+       preparation for dumping it with emacs.  (Bug#4789)
+       (leimdir): New variable.
+       ($(leimdir)/leim-list.el): New rule.
+       (emacs$(EXEEXT)): Depend on leim-list.el.
+
+       * buffer.c (Qucs_set_table_for_input): Remove.  (Bug#9821)
+       (Fget_buffer_create): Don't call Qucs_set_table_for_input.
+       (init_buffer_once, syms_of_buffer): Remove Qucs_set_table_for_input.
+
+2012-04-08  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * lisp.h (struct Lisp_Symbol): Add explicit padding to ensure
+       proper alignment.
+
+2012-04-07  Juanma Barranquero  <lekktu@gmail.com>
+
+       * xml.c (init_libxml2_functions) [WINDOWSNT]:
+       Remove unused local variable.
+
+2012-04-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Avoid unnecessary pointer scanning in garbage collection (Bug#10780).
+       * alloc.c (POINTERS_MIGHT_HIDE_IN_OBJECTS): New macro.
+       (mark_memory): Mark Lisp_Objects only if pointers might hide in
+       objects, as mark_maybe_pointer will catch them otherwise.
+       (GC_LISP_OBJECT_ALIGNMENT): Remove; no longer needed.
+       * s/gnu-linux.h (GC_LISP_OBJECT_ALIGNMENT) [__mc68000__]: Likewise.
+
+2012-04-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix typo that broke non-Windows builds.
+       * xml.c (libxml2_loaded_p) [!!WINDOWSNT]: 'inine' -> 'inline'.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       Support building on MS-Windows with libxml2.
+
+       * makefile.w32-in (OBJ2): Add xml.$(O).
+       (GLOBAL_SOURCES): Add xml.c.
+       ($(BLD)/xml.$(O)): New dependency list.
+
+       * xml.c (DEF_XML2_FN, LOAD_XML2_FN) [WINDOWSNT]: New macros.
+       (fn_htmlReadMemory, fn_xmlReadMemory, fn_xmlDocGetRootElement)
+       (fn_xmlFreeDoc, fn_xmlCleanupParser, fn_xmlCheckVersion)
+       [!WINDOWSNT]: New macros.
+       (init_libxml2_functions, libxml2_loaded_p): New functions.
+       (parse_region): Call fn_xmlCheckVersion instead of using the macro
+       LIBXML_TEST_VERSION.  Call libxml2 functions via the fn_* macros.
+       (xml_cleanup_parser): New function, export for fn_xmlCleanupParser.
+       Calls xmlCleanupParser only if libxml2 was loaded (or statically
+       linked in).
+       (Flibxml_parse_html_region, Flibxml_parse_xml_region):
+       Call init_libxml2_functions before calling libxml2 functions.
+       (syms_of_xml) <Qlibxml2_dll>: DEFSYM it.
+
+       * emacs.c: Don't include libxml/parser.h.
+       (shut_down_emacs): Call xml_cleanup_parser, instead of calling
+       xmlCleanupParser directly.
+
+       * lisp.h [HAVE_LIBXML2]: Add prototype for xml_cleanup_parser.
+
+2012-04-07  Eli Zaretskii  <eliz@gnu.org>
+
+       * indent.c (Fvertical_motion): If there is a display string at
+       point, use it.vpos to compute how many lines to backtrack after
+       move_it_to point.  (Bug#11133)
 
 2012-04-06  Eli Zaretskii  <eliz@gnu.org>
 
        * xfns.c (unwind_create_frame): Fix comment.
        (Fx_create_frame, x_create_tip_frame):
        Move terminal->reference_count++ just before making the frame
-       official. Move initialization of image_cache_refcount and
+       official.  Move initialization of image_cache_refcount and
        dpyinfo_refcount before calling init_frame_faces (Bug#9943).
 
 2011-11-05  Eli Zaretskii  <eliz@gnu.org>
        (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6.
 
        * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods
-       cString and lossyCString on OSX >= 10.4
+       cString and lossyCString on OSX >= 10.4.
 
        * nsmenu.m (fillWithWidgetValue): Don't use deprecated method
        sizeToFit on OSX >= 10.2.
        * xfaces.c <Qunspecified>: Make extern again.
 
        * syntax.c: Include sys/types.h before including regex.h, as
-       required by Posix.
+       required by POSIX.
 
        * doc.c (get_doc_string): Improve the format passed to `error'.
 
@@ -9857,7 +13896,7 @@ See ChangeLog.11 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2012  Free Software Foundation, Inc.
+  Copyright (C) 2011-2012 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
index 10de7e53794f9684450ccdcdeca0a12eb8e7e64d..cf62ec29bbc97b029fcae45ca91b24b44ae7a794 100644 (file)
 
        * macterm.c (do_ae_open_documents) [MAC_OSX]: Call FSpMakeFSRef
        and FSRefMakePath to convert FSSpec returned with Apple Event to
-       Posix pathname.
+       POSIX pathname.
        (mac_initialize) [TARGET_API_MAC_CARBON]:
        Call init_required_apple_events and disable the `Quit' menu item
        provided automatically by the Carbon Toolbox.
index 97d5a65281ade49df05e1ecdcd462f7bd1688a3b..781027ee8aea477d73becd53a44830ae2e0380d4 100644 (file)
 
 2010-03-12  Eli Zaretskii  <eliz@gnu.org>
 
-       These changes remove termcap.c from the build on Posix platforms.
+       These changes remove termcap.c from the build on POSIX platforms.
        * Makefile.in (termcapobj): Move termcap.o from here...
        (MSDOS_OBJ): ...to here.
        (termcapobj) [!LIBS_TERMCAP]: Remove specialized value, as it is
index 91c20681157789f20d5fd13c9a0a38d2a2264a5b..3aa1a23818ea269be94c1770107c51ef1f6880f1 100644 (file)
 
 1995-12-12  Paul Eggert  <eggert@twinsun.com>
 
-       * process.c (create_process): Use Posix signal handling to
+       * process.c (create_process): Use POSIX signal handling to
        block signals, if available.  If HAVE_VFORK, save and restore
        signal handlers that the child might change, since in many
        systems (e.g. Solaris 2.4) if the child changes the signal
index 035ea277454f314f26e4c3c28c88ce851d9aa4ed..da458b4fb8a92d79eb5433761091efc866ef1b8f 100644 (file)
@@ -40,6 +40,7 @@ version = @version@
 # Substitute an assignment for the MAKE variable, because
 # BSD doesn't have it as a default.
 @SET_MAKE@
+MKDIR_P = @MKDIR_P@
 # Don't use LIBS.  configure puts stuff in it that either shouldn't be
 # linked with Emacs or is duplicated by the other stuff below.
 # LIBS = @LIBS@
@@ -49,14 +50,14 @@ lispsource = $(srcdir)/../lisp
 lib = ../lib
 libsrc = ../lib-src
 etc = ../etc
+leimdir = ../leim
 oldXMenudir = ../oldXMenu
 lwlibdir = ../lwlib
 lispdir = ../lisp
 
 # Configuration files for .o files to depend on.
-M_FILE = @M_FILE@
 S_FILE = @S_FILE@
-config_h = config.h $(M_FILE) $(S_FILE)
+config_h = config.h $(S_FILE)
 
 bootstrap_exe = $(abs_builddir)/bootstrap-emacs$(EXEEXT)
 
@@ -67,23 +68,21 @@ OTHER_FILES = @OTHER_FILES@
 PROFILING_CFLAGS = @PROFILING_CFLAGS@
 
 ## Flags to pass to the compiler to enable build warnings
-C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
+WARN_CFLAGS = @WARN_CFLAGS@
+WERROR_CFLAGS = @WERROR_CFLAGS@
 
 ## Machine-specific CFLAGS.
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
 ## System-specific CFLAGS.
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 
-## Currently only set if NS_IMPL_GNUSTEP.
-## C_SWITCH_X_SITE may override this.
-C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@
+GNUSTEP_CFLAGS=@GNUSTEP_CFLAGS@
 
 ## Define C_SWITCH_X_SITE to contain any special flags your compiler
 ## may need to deal with X Windows.  For instance, if you've defined
 ## HAVE_X_WINDOWS and your X include files aren't in a place that your
 ## compiler can find on its own, you might want to add "-I/..." or
 ## something similar.  This is normally set by configure.
-## This is used before C_SWITCH_X_SYSTEM and may override it.
 C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
 
 ## Define LD_SWITCH_X_SITE to contain any special flags your loader
@@ -95,11 +94,9 @@ C_SWITCH_X_SITE=@C_SWITCH_X_SITE@
 ## substituted in this or any other Makefile. Cf C_SWITCH_X_SITE.
 LD_SWITCH_X_SITE=
 
-## Next two must come before LD_SWITCH_SYSTEM.
-## If needed, a -R option that says where to find X windows at run time.
-LD_SWITCH_X_SITE_AUX=@LD_SWITCH_X_SITE_AUX@
-## As above, but using -rpath instead.
-LD_SWITCH_X_SITE_AUX_RPATH=@LD_SWITCH_X_SITE_AUX_RPATH@
+## This must come before LD_SWITCH_SYSTEM.
+## If needed, a -rpath option that says where to find X windows at run time.
+LD_SWITCH_X_SITE_RPATH=@LD_SWITCH_X_SITE_RPATH@
 
 ## System-specific LDFLAGS.
 LD_SWITCH_SYSTEM=@LD_SWITCH_SYSTEM@
@@ -116,6 +113,12 @@ TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS)
 ## $LDFLAGS or empty if NS_IMPL_GNUSTEP (for some reason).
 TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@
 
+## If available, the full path to the paxctl program.
+## On grsecurity/PaX systems, unexec will fail due to a gap between
+## the bss section and the heap.  This can be prevented by disabling
+## memory randomization in temacs with "paxctl -r".  See bug#11398.
+PAXCTL = @PAXCTL@
+
 ## Some systems define this to request special libraries.
 LIBS_SYSTEM=@LIBS_SYSTEM@
 
@@ -150,6 +153,8 @@ LIBOTF_LIBS = @LIBOTF_LIBS@
 M17N_FLT_CFLAGS = @M17N_FLT_CFLAGS@
 M17N_FLT_LIBS = @M17N_FLT_LIBS@
 
+LIB_CLOCK_GETTIME=@LIB_CLOCK_GETTIME@
+
 DBUS_CFLAGS = @DBUS_CFLAGS@
 DBUS_LIBS = @DBUS_LIBS@
 ## dbusbind.o if HAVE_DBUS, else empty.
@@ -287,7 +292,7 @@ CANNOT_DUMP=@CANNOT_DUMP@
 DEPDIR=deps
 ## -MMD -MF $(DEPDIR)/$*.d if AUTO_DEPEND; else empty.
 DEPFLAGS=@DEPFLAGS@
-## test -d $(DEPDIR) || mkdir $(DEPDIR) (if AUTO_DEPEND); else ':'.
+## ${MKDIR_P} ${DEPDIR} (if AUTO_DEPEND); else ':'.
 MKDEPDIR=@MKDEPDIR@
 
 ## DO NOT use -R.  There is a special hack described in lastfile.c
@@ -298,22 +303,16 @@ MKDEPDIR=@MKDEPDIR@
 ## -Demacs is needed to make some files produce the correct version
 ## for use in Emacs.
 ##
-## -DHAVE_CONFIG_H is needed for some other files to take advantage of
-## the information in `config.h'.
-##
-## C_SWITCH_X_SITE must come before C_SWITCH_X_SYSTEM
-## since it may have -I options that should override those.
-##
 ## FIXME? MYCPPFLAGS only referenced in etc/DEBUG.
-ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I$(srcdir) \
+ALL_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
   -I$(lib) -I$(srcdir)/../lib \
   $(C_SWITCH_MACHINE) $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
-  $(C_SWITCH_X_SYSTEM) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
+  $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
   $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
   $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
   $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) $(PROFILING_CFLAGS) \
   $(LIBGNUTLS_CFLAGS) \
-  $(C_WARNINGS_SWITCH) $(CFLAGS)
+  $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS)
 ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
 
 .SUFFIXES: .m
@@ -384,7 +383,7 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
 ## duplicated symbols.  If the standard libraries were compiled
 ## with GCC, we might need LIB_GCC again after them.
 LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
-   $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(DBUS_LIBS) \
+   $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) \
    $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
    $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
    $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
@@ -393,21 +392,21 @@ LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
 
 all: emacs$(EXEEXT) $(OTHER_FILES)
 
-## Does anyone ever pay attention to the load-path-shadows output here?
+$(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT)
+       cd $(leimdir) && $(MAKE) $(MFLAGS) leim-list.el EMACS=$(bootstrap_exe)
+
 ## The dumped Emacs is as functional and more efficient than
 ## bootstrap-emacs, so we replace the latter with the former.
 ## Strictly speaking, emacs does not depend directly on all of $lisp,
 ## since not all pieces are used on all platforms.  But DOC depends
 ## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here.
-emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp)
+emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el
        if test "$(CANNOT_DUMP)" = "yes"; then \
          ln -f temacs$(EXEEXT) emacs$(EXEEXT); \
-         EMACSLOADPATH=$(lispsource) ./emacs -batch \
-           -f list-load-path-shadows || true; \
        else \
          LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
+         test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
          ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
-         ./emacs -batch -f list-load-path-shadows || true; \
        fi
 
 ## We run make-docfile twice because the command line may get too long
@@ -453,6 +452,8 @@ $(lib)/libgnu.a: $(config_h)
 temacs$(EXEEXT): $(START_FILES) stamp-oldxmenu $(obj) $(otherobj) $(lib)/libgnu.a
        $(CC) $(LD_FIRSTFLAG) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(TEMACS_LDFLAGS2) \
          -o temacs $(START_FILES) $(obj) $(otherobj) $(lib)/libgnu.a $(LIBES)
+       test "$(CANNOT_DUMP)" = "yes" || \
+         test "X$(PAXCTL)" = X || $(PAXCTL) -r temacs$(EXEEXT)
 
 ## The following oldxmenu-related rules are only (possibly) used if
 ## HAVE_X11 && !USE_GTK, but there is no harm in always defining them
@@ -536,10 +537,10 @@ extraclean: distclean
 ctagsfiles1 = [xyzXYZ]*.[hcm]
 ctagsfiles2 = [a-wA-W]*.[hcm]
 
-TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(M_FILE) $(S_FILE)
+TAGS: $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE)
        ../lib-src/etags --include=TAGS-LISP --include=$(lwlibdir)/TAGS \
          --regex='/[   ]*DEFVAR_[A-Z_  (]+"\([^"]+\)"/' \
-         $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(M_FILE) $(S_FILE)
+         $(srcdir)/$(ctagsfiles1) $(srcdir)/$(ctagsfiles2) $(S_FILE)
 frc:
 TAGS-LISP: frc
        $(MAKE) -f $(lispdir)/Makefile TAGS-LISP ETAGS=../lib-src/etags
@@ -600,6 +601,7 @@ bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
          ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
        else \
          $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \
+         test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
          mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
        fi
        @: Compile some files earlier to speed up further compilation.
index f85661415cdd80bbd298afe0a958c5f4530a397c..67ff3459e719e6a65502e8e5b710f8dc0dae739c 100644 (file)
@@ -38,27 +38,35 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "process.h"
 #include "intervals.h"
 #include "puresize.h"
+#include "character.h"
 #include "buffer.h"
 #include "window.h"
 #include "keyboard.h"
 #include "frame.h"
 #include "blockinput.h"
-#include "character.h"
 #include "syssignal.h"
 #include "termhooks.h"         /* For struct terminal.  */
 #include <setjmp.h>
 #include <verify.h>
 
+/* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
+   Doable only if GC_MARK_STACK.  */
+#if ! GC_MARK_STACK
+# undef GC_CHECK_MARKED_OBJECTS
+#endif
+
 /* GC_MALLOC_CHECK defined means perform validity checks of malloc'd
-   memory.  Can do this only if using gmalloc.c.  */
+   memory.  Can do this only if using gmalloc.c and if not checking
+   marked objects.  */
 
-#if defined SYSTEM_MALLOC || defined DOUG_LEA_MALLOC
+#if (defined SYSTEM_MALLOC || defined DOUG_LEA_MALLOC \
+     || defined GC_CHECK_MARKED_OBJECTS)
 #undef GC_MALLOC_CHECK
 #endif
 
 #include <unistd.h>
 #ifndef HAVE_UNISTD_H
-extern POINTER_TYPE *sbrk ();
+extern void *sbrk ();
 #endif
 
 #include <fcntl.h>
@@ -82,6 +90,8 @@ extern POINTER_TYPE *sbrk ();
 
 extern size_t _bytes_used;
 extern size_t __malloc_extra_blocks;
+extern void *_malloc_internal (size_t);
+extern void _free_internal (void *);
 
 #endif /* not DOUG_LEA_MALLOC */
 
@@ -181,7 +191,7 @@ int abort_on_gc;
 
 static EMACS_INT total_conses, total_markers, total_symbols, total_vector_size;
 static EMACS_INT total_free_conses, total_free_markers, total_free_symbols;
-static EMACS_INT total_free_floats, total_floats;
+static EMACS_INT total_free_floats, total_floats, total_free_vector_bytes;
 
 /* Points to memory space allocated as "spare", to be freed if we run
    out of memory.  We keep one large block, four cons-blocks, and
@@ -224,11 +234,11 @@ static ptrdiff_t pure_bytes_used_before_overflow;
 
 /* Index in pure at which next pure Lisp object will be allocated.. */
 
-static EMACS_INT pure_bytes_used_lisp;
+static ptrdiff_t pure_bytes_used_lisp;
 
 /* Number of bytes allocated for non-Lisp objects in pure storage.  */
 
-static EMACS_INT pure_bytes_used_non_lisp;
+static ptrdiff_t pure_bytes_used_non_lisp;
 
 /* If nonzero, this is a warning delivered by malloc and not yet
    displayed.  */
@@ -248,11 +258,6 @@ static char *stack_copy;
 static ptrdiff_t stack_copy_size;
 #endif
 
-/* Non-zero means ignore malloc warnings.  Set during initialization.
-   Currently not used.  */
-
-static int ignore_warnings;
-
 static Lisp_Object Qgc_cons_threshold;
 Lisp_Object Qchar_table_extra_slots;
 
@@ -260,9 +265,9 @@ Lisp_Object Qchar_table_extra_slots;
 
 static Lisp_Object Qpost_gc_hook;
 
-static void mark_buffer (Lisp_Object);
 static void mark_terminals (void);
 static void gc_sweep (void);
+static Lisp_Object make_pure_vector (ptrdiff_t);
 static void mark_glyph_matrix (struct glyph_matrix *);
 static void mark_face_cache (struct face_cache *);
 
@@ -293,11 +298,12 @@ enum mem_type
      process, hash_table, frame, terminal, and window, but we never made
      use of the distinction, so it only caused source-code complexity
      and runtime slowdown.  Minor but pointless.  */
-  MEM_TYPE_VECTORLIKE
+  MEM_TYPE_VECTORLIKE,
+  /* Special type to denote vector blocks.  */
+  MEM_TYPE_VECTOR_BLOCK
 };
 
-static POINTER_TYPE *lisp_align_malloc (size_t, enum mem_type);
-static POINTER_TYPE *lisp_malloc (size_t, enum mem_type);
+static void *lisp_malloc (size_t, enum mem_type);
 
 
 #if GC_MARK_STACK || defined GC_MALLOC_CHECK
@@ -315,7 +321,6 @@ static Lisp_Object Vdead;
 #ifdef GC_MALLOC_CHECK
 
 enum mem_type allocated_mem_type;
-static int dont_register_blocks;
 
 #endif /* GC_MALLOC_CHECK */
 
@@ -379,8 +384,8 @@ static void *min_heap_address, *max_heap_address;
 static struct mem_node mem_z;
 #define MEM_NIL &mem_z
 
-static struct Lisp_Vector *allocate_vectorlike (EMACS_INT);
-static void lisp_free (POINTER_TYPE *);
+static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t);
+static void lisp_free (void *);
 static void mark_stack (void);
 static int live_vector_p (struct mem_node *, void *);
 static int live_buffer_p (struct mem_node *, void *);
@@ -391,9 +396,11 @@ static int live_float_p (struct mem_node *, void *);
 static int live_misc_p (struct mem_node *, void *);
 static void mark_maybe_object (Lisp_Object);
 static void mark_memory (void *, void *);
+#if GC_MARK_STACK || defined GC_MALLOC_CHECK
 static void mem_init (void);
 static struct mem_node *mem_insert (void *, void *, enum mem_type);
 static void mem_insert_fixup (struct mem_node *);
+#endif
 static void mem_rotate_left (struct mem_node *);
 static void mem_rotate_right (struct mem_node *);
 static void mem_delete (struct mem_node *);
@@ -418,22 +425,22 @@ struct gcpro *gcprolist;
 /* Addresses of staticpro'd variables.  Initialize it to a nonzero
    value; otherwise some compilers put it into BSS.  */
 
-#define NSTATICS 0x640
+#define NSTATICS 0x650
 static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag};
 
 /* Index of next unused slot in staticvec.  */
 
-static int staticidx = 0;
+static int staticidx;
 
-static POINTER_TYPE *pure_alloc (size_t, int);
+static void *pure_alloc (size_t, int);
 
 
 /* Value is SZ rounded up to the next multiple of ALIGNMENT.
    ALIGNMENT must be a power of 2.  */
 
 #define ALIGN(ptr, ALIGNMENT) \
-  ((POINTER_TYPE *) ((((uintptr_t) (ptr)) + (ALIGNMENT) - 1) \
-                    & ~((ALIGNMENT) - 1)))
+  ((void *) (((uintptr_t) (ptr) + (ALIGNMENT) - 1) \
+            & ~ ((ALIGNMENT) - 1)))
 
 
 \f
@@ -465,7 +472,7 @@ display_malloc_warning (void)
 /* Called if we can't allocate relocatable space for a buffer.  */
 
 void
-buffer_memory_full (EMACS_INT nbytes)
+buffer_memory_full (ptrdiff_t nbytes)
 {
   /* If buffers use the relocating allocator, no need to free
      spare_memory, because we may have plenty of malloc space left
@@ -483,6 +490,11 @@ buffer_memory_full (EMACS_INT nbytes)
   xsignal (Qnil, Vmemory_signal_data);
 }
 
+/* A common multiple of the positive integers A and B.  Ideally this
+   would be the least common multiple, but there's no way to do that
+   as a constant expression in C, so do the best that we can easily do.  */
+#define COMMON_MULTIPLE(a, b) \
+  ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
 
 #ifndef XMALLOC_OVERRUN_CHECK
 #define XMALLOC_OVERRUN_CHECK_OVERHEAD 0
@@ -514,12 +526,8 @@ buffer_memory_full (EMACS_INT nbytes)
       char c;                                          \
     },                                                 \
     c)
-#ifdef USE_LSB_TAG
-/* A common multiple of the positive integers A and B.  Ideally this
-   would be the least common multiple, but there's no way to do that
-   as a constant expression in C, so do the best that we can easily do.  */
-# define COMMON_MULTIPLE(a, b) \
-    ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
+
+#if USE_LSB_TAG
 # define XMALLOC_HEADER_ALIGNMENT \
     COMMON_MULTIPLE (1 << GCTYPEBITS, XMALLOC_BASE_ALIGNMENT)
 #else
@@ -594,7 +602,7 @@ static ptrdiff_t check_depth;
 
 /* Like malloc, but wraps allocated block with header and trailer.  */
 
-static POINTER_TYPE *
+static void *
 overrun_check_malloc (size_t size)
 {
   register unsigned char *val;
@@ -602,7 +610,7 @@ overrun_check_malloc (size_t size)
   if (SIZE_MAX - overhead < size)
     abort ();
 
-  val = (unsigned char *) malloc (size + overhead);
+  val = malloc (size + overhead);
   if (val && check_depth == 1)
     {
       memcpy (val, xmalloc_overrun_check_header, XMALLOC_OVERRUN_CHECK_SIZE);
@@ -612,15 +620,15 @@ overrun_check_malloc (size_t size)
              XMALLOC_OVERRUN_CHECK_SIZE);
     }
   --check_depth;
-  return (POINTER_TYPE *)val;
+  return val;
 }
 
 
 /* Like realloc, but checks old block for overrun, and wraps new block
    with header and trailer.  */
 
-static POINTER_TYPE *
-overrun_check_realloc (POINTER_TYPE *block, size_t size)
+static void *
+overrun_check_realloc (void *block, size_t size)
 {
   register unsigned char *val = (unsigned char *) block;
   int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0;
@@ -642,7 +650,7 @@ overrun_check_realloc (POINTER_TYPE *block, size_t size)
       memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE);
     }
 
-  val = (unsigned char *) realloc ((POINTER_TYPE *)val, size + overhead);
+  val = realloc (val, size + overhead);
 
   if (val && check_depth == 1)
     {
@@ -653,13 +661,13 @@ overrun_check_realloc (POINTER_TYPE *block, size_t size)
              XMALLOC_OVERRUN_CHECK_SIZE);
     }
   --check_depth;
-  return (POINTER_TYPE *)val;
+  return val;
 }
 
 /* Like free, but checks block for overrun.  */
 
 static void
-overrun_check_free (POINTER_TYPE *block)
+overrun_check_free (void *block)
 {
   unsigned char *val = (unsigned char *) block;
 
@@ -708,13 +716,13 @@ overrun_check_free (POINTER_TYPE *block)
 
 /* Like malloc but check for no memory and block interrupt input..  */
 
-POINTER_TYPE *
+void *
 xmalloc (size_t size)
 {
-  register POINTER_TYPE *val;
+  void *val;
 
   MALLOC_BLOCK_INPUT;
-  val = (POINTER_TYPE *) malloc (size);
+  val = malloc (size);
   MALLOC_UNBLOCK_INPUT;
 
   if (!val && size)
@@ -722,21 +730,37 @@ xmalloc (size_t size)
   return val;
 }
 
+/* Like the above, but zeroes out the memory just allocated.  */
+
+void *
+xzalloc (size_t size)
+{
+  void *val;
+
+  MALLOC_BLOCK_INPUT;
+  val = malloc (size);
+  MALLOC_UNBLOCK_INPUT;
+
+  if (!val && size)
+    memory_full (size);
+  memset (val, 0, size);
+  return val;
+}
 
 /* Like realloc but check for no memory and block interrupt input..  */
 
-POINTER_TYPE *
-xrealloc (POINTER_TYPE *block, size_t size)
+void *
+xrealloc (void *block, size_t size)
 {
-  register POINTER_TYPE *val;
+  void *val;
 
   MALLOC_BLOCK_INPUT;
   /* We must call malloc explicitly when BLOCK is 0, since some
      reallocs don't do this.  */
   if (! block)
-    val = (POINTER_TYPE *) malloc (size);
+    val = malloc (size);
   else
-    val = (POINTER_TYPE *) realloc (block, size);
+    val = realloc (block, size);
   MALLOC_UNBLOCK_INPUT;
 
   if (!val && size)
@@ -748,7 +772,7 @@ xrealloc (POINTER_TYPE *block, size_t size)
 /* Like free but block interrupt input.  */
 
 void
-xfree (POINTER_TYPE *block)
+xfree (void *block)
 {
   if (!block)
     return;
@@ -773,7 +797,7 @@ verify (INT_MAX <= PTRDIFF_MAX);
 void *
 xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size)
 {
-  xassert (0 <= nitems && 0 < item_size);
+  eassert (0 <= nitems && 0 < item_size);
   if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems)
     memory_full (SIZE_MAX);
   return xmalloc (nitems * item_size);
@@ -786,7 +810,7 @@ xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size)
 void *
 xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size)
 {
-  xassert (0 <= nitems && 0 < item_size);
+  eassert (0 <= nitems && 0 < item_size);
   if (min (PTRDIFF_MAX, SIZE_MAX) / item_size < nitems)
     memory_full (SIZE_MAX);
   return xrealloc (pa, nitems * item_size);
@@ -836,7 +860,7 @@ xpalloc (void *pa, ptrdiff_t *nitems, ptrdiff_t nitems_incr_min,
   ptrdiff_t nitems_incr_max = n_max - n;
   ptrdiff_t incr = max (nitems_incr_min, min (incr_estimate, nitems_incr_max));
 
-  xassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max);
+  eassert (0 < item_size && 0 < nitems_incr_min && 0 <= n && -1 <= nitems_max);
   if (! pa)
     *nitems = 0;
   if (nitems_incr_max < incr)
@@ -854,7 +878,7 @@ char *
 xstrdup (const char *s)
 {
   size_t len = strlen (s) + 1;
-  char *p = (char *) xmalloc (len);
+  char *p = xmalloc (len);
   memcpy (p, s, len);
   return p;
 }
@@ -879,11 +903,11 @@ safe_alloca_unwind (Lisp_Object arg)
    number of bytes to allocate, TYPE describes the intended use of the
    allocated memory block (for strings, for conses, ...).  */
 
-#ifndef USE_LSB_TAG
-static void *lisp_malloc_loser;
+#if ! USE_LSB_TAG
+void *lisp_malloc_loser EXTERNALLY_VISIBLE;
 #endif
 
-static POINTER_TYPE *
+static void *
 lisp_malloc (size_t nbytes, enum mem_type type)
 {
   register void *val;
@@ -894,9 +918,9 @@ lisp_malloc (size_t nbytes, enum mem_type type)
   allocated_mem_type = type;
 #endif
 
-  val = (void *) malloc (nbytes);
+  val = malloc (nbytes);
 
-#ifndef USE_LSB_TAG
+#if ! USE_LSB_TAG
   /* If the memory just allocated cannot be addressed thru a Lisp
      object's pointer, and it needs to be,
      that's equivalent to running out of memory.  */
@@ -928,7 +952,7 @@ lisp_malloc (size_t nbytes, enum mem_type type)
    call to lisp_malloc.  */
 
 static void
-lisp_free (POINTER_TYPE *block)
+lisp_free (void *block)
 {
   MALLOC_BLOCK_INPUT;
   free (block);
@@ -938,13 +962,11 @@ lisp_free (POINTER_TYPE *block)
   MALLOC_UNBLOCK_INPUT;
 }
 
-/* Allocation of aligned blocks of memory to store Lisp data.              */
-/* The entry point is lisp_align_malloc which returns blocks of at most    */
-/* BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary.  */
+/*****  Allocation of aligned blocks of memory to store Lisp data.  *****/
+
+/* The entry point is lisp_align_malloc which returns blocks of at most
+   BLOCK_BYTES and guarantees they are aligned on a BLOCK_ALIGN boundary.  */
 
-/* Use posix_memalloc if the system has it and we're using the system's
-   malloc (because our gmalloc.c routines don't have posix_memalign although
-   its memalloc could be used).  */
 #if defined (HAVE_POSIX_MEMALIGN) && defined (SYSTEM_MALLOC)
 #define USE_POSIX_MEMALIGN 1
 #endif
@@ -1001,7 +1023,7 @@ struct ablocks
   struct ablock blocks[ABLOCKS_SIZE];
 };
 
-/* Size of the block requested from malloc or memalign.  */
+/* Size of the block requested from malloc or posix_memalign.  */
 #define ABLOCKS_BYTES (sizeof (struct ablocks) - BLOCK_PADDING)
 
 #define ABLOCK_ABASE(block) \
@@ -1026,7 +1048,7 @@ static struct ablock *free_ablock;
 /* Allocate an aligned block of nbytes.
    Alignment is on a multiple of BLOCK_ALIGN and `nbytes' has to be
    smaller or equal to BLOCK_BYTES.  */
-static POINTER_TYPE *
+static void *
 lisp_align_malloc (size_t nbytes, enum mem_type type)
 {
   void *base, *val;
@@ -1079,7 +1101,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
       mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
 #endif
 
-#ifndef USE_LSB_TAG
+#if ! USE_LSB_TAG
       /* If the memory just allocated cannot be addressed thru a Lisp
         object's pointer, and it needs to be, that's equivalent to
         running out of memory.  */
@@ -1099,7 +1121,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
 #endif
 
       /* Initialize the blocks and put them on the free list.
-        Is `base' was not properly aligned, we can't use the last block.  */
+        If `base' was not properly aligned, we can't use the last block.  */
       for (i = 0; i < (aligned ? ABLOCKS_SIZE : ABLOCKS_SIZE - 1); i++)
        {
          abase->blocks[i].abase = abase;
@@ -1133,7 +1155,7 @@ lisp_align_malloc (size_t nbytes, enum mem_type type)
 }
 
 static void
-lisp_align_free (POINTER_TYPE *block)
+lisp_align_free (void *block)
 {
   struct ablock *ablock = block;
   struct ablocks *abase = ABLOCK_ABASE (ablock);
@@ -1146,8 +1168,8 @@ lisp_align_free (POINTER_TYPE *block)
   ablock->x.next_free = free_ablock;
   free_ablock = ablock;
   /* Update busy count.  */
-  ABLOCKS_BUSY (abase) =
-    (struct ablocks *) (-2 + (intptr_t) ABLOCKS_BUSY (abase));
+  ABLOCKS_BUSY (abase)
+    (struct ablocks *) (-2 + (intptr_t) ABLOCKS_BUSY (abase));
 
   if (2 > (intptr_t) ABLOCKS_BUSY (abase))
     { /* All the blocks are free.  */
@@ -1175,21 +1197,6 @@ lisp_align_free (POINTER_TYPE *block)
   MALLOC_UNBLOCK_INPUT;
 }
 
-/* Return a new buffer structure allocated from the heap with
-   a call to lisp_malloc.  */
-
-struct buffer *
-allocate_buffer (void)
-{
-  struct buffer *b
-    = (struct buffer *) lisp_malloc (sizeof (struct buffer),
-                                    MEM_TYPE_BUFFER);
-  XSETPVECTYPESIZE (b, PVEC_BUFFER,
-                   ((sizeof (struct buffer) + sizeof (EMACS_INT) - 1)
-                    / sizeof (EMACS_INT)));
-  return b;
-}
-
 \f
 #ifndef SYSTEM_MALLOC
 
@@ -1223,6 +1230,10 @@ static void (*old_free_hook) (void*, const void*);
 #  define BYTES_USED _bytes_used
 #endif
 
+#ifdef GC_MALLOC_CHECK
+static int dont_register_blocks;
+#endif
+
 static size_t bytes_used_when_reconsidered;
 
 /* Value of _bytes_used, when spare_memory was freed.  */
@@ -1293,7 +1304,7 @@ emacs_blocked_malloc (size_t size, const void *ptr)
     __malloc_extra_blocks = malloc_hysteresis;
 #endif
 
-  value = (void *) malloc (size);
+  value = malloc (size);
 
 #ifdef GC_MALLOC_CHECK
   {
@@ -1302,7 +1313,7 @@ emacs_blocked_malloc (size_t size, const void *ptr)
       {
        fprintf (stderr, "Malloc returned %p which is already in use\n",
                 value);
-       fprintf (stderr, "Region in use is %p...%p, %u bytes, type %d\n",
+       fprintf (stderr, "Region in use is %p...%p, %td bytes, type %d\n",
                 m->start, m->end, (char *) m->end - (char *) m->start,
                 m->type);
        abort ();
@@ -1355,7 +1366,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2)
   dont_register_blocks = 1;
 #endif /* GC_MALLOC_CHECK */
 
-  value = (void *) realloc (ptr, size);
+  value = realloc (ptr, size);
 
 #ifdef GC_MALLOC_CHECK
   dont_register_blocks = 0;
@@ -1465,7 +1476,7 @@ static struct interval_block *interval_block;
 /* Index in interval_block above of the next unused interval
    structure.  */
 
-static int interval_block_index;
+static int interval_block_index = INTERVAL_BLOCK_SIZE;
 
 /* Number of free and live intervals.  */
 
@@ -1475,18 +1486,6 @@ static EMACS_INT total_free_intervals, total_intervals;
 
 static INTERVAL interval_free_list;
 
-
-/* Initialize interval allocation.  */
-
-static void
-init_intervals (void)
-{
-  interval_block = NULL;
-  interval_block_index = INTERVAL_BLOCK_SIZE;
-  interval_free_list = 0;
-}
-
-
 /* Return a new interval.  */
 
 INTERVAL
@@ -1507,14 +1506,13 @@ make_interval (void)
     {
       if (interval_block_index == INTERVAL_BLOCK_SIZE)
        {
-         register struct interval_block *newi;
-
-         newi = (struct interval_block *) lisp_malloc (sizeof *newi,
-                                                       MEM_TYPE_NON_LISP);
+         struct interval_block *newi
+           = lisp_malloc (sizeof *newi, MEM_TYPE_NON_LISP);
 
          newi->next = interval_block;
          interval_block = newi;
          interval_block_index = 0;
+         total_free_intervals += INTERVAL_BLOCK_SIZE;
        }
       val = &interval_block->intervals[interval_block_index++];
     }
@@ -1523,18 +1521,21 @@ make_interval (void)
 
   consing_since_gc += sizeof (struct interval);
   intervals_consed++;
+  total_free_intervals--;
   RESET_INTERVAL (val);
   val->gcmarkbit = 0;
   return val;
 }
 
 
-/* Mark Lisp objects in interval I. */
+/* Mark Lisp objects in interval I.  */
 
 static void
 mark_interval (register INTERVAL i, Lisp_Object dummy)
 {
-  eassert (!i->gcmarkbit);             /* Intervals are never shared.  */
+  /* Intervals should never be shared.  So, if extra internal checking is
+     enabled, GC aborts if it seems to have visited an interval twice.  */
+  eassert (!i->gcmarkbit);
   i->gcmarkbit = 1;
   mark_object (i->plist);
 }
@@ -1568,35 +1569,6 @@ mark_interval_tree (register INTERVAL tree)
    if (! NULL_INTERVAL_P (i))                          \
      (i) = balance_intervals (i);                      \
   } while (0)
-
-\f
-/* Number support.  If USE_LISP_UNION_TYPE is in effect, we
-   can't create number objects in macros.  */
-#ifndef make_number
-Lisp_Object
-make_number (EMACS_INT n)
-{
-  Lisp_Object obj;
-  obj.s.val = n;
-  obj.s.type = Lisp_Int;
-  return obj;
-}
-#endif
-\f
-/* Convert the pointer-sized word P to EMACS_INT while preserving its
-   type and ptr fields.  */
-static Lisp_Object
-widen_to_Lisp_Object (void *p)
-{
-  intptr_t i = (intptr_t) p;
-#ifdef USE_LISP_UNION_TYPE
-  Lisp_Object obj;
-  obj.i = i;
-  return obj;
-#else
-  return i;
-#endif
-}
 \f
 /***********************************************************************
                          String Allocation
@@ -1650,7 +1622,7 @@ struct sdata
 
 #ifdef GC_CHECK_STRING_BYTES
 
-  EMACS_INT nbytes;
+  ptrdiff_t nbytes;
   unsigned char data[1];
 
 #define SDATA_NBYTES(S)        (S)->nbytes
@@ -1665,7 +1637,7 @@ struct sdata
     unsigned char data[1];
 
     /* When STRING is null.  */
-    EMACS_INT nbytes;
+    ptrdiff_t nbytes;
   } u;
 
 #define SDATA_NBYTES(S)        (S)->u.nbytes
@@ -1775,24 +1747,24 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
 #define SDATA_SIZE(NBYTES)                     \
      ((SDATA_DATA_OFFSET                       \
        + (NBYTES) + 1                          \
-       + sizeof (EMACS_INT) - 1)               \
-      & ~(sizeof (EMACS_INT) - 1))
+       + sizeof (ptrdiff_t) - 1)               \
+      & ~(sizeof (ptrdiff_t) - 1))
 
 #else /* not GC_CHECK_STRING_BYTES */
 
 /* The 'max' reserves space for the nbytes union member even when NBYTES + 1 is
    less than the size of that member.  The 'max' is not needed when
-   SDATA_DATA_OFFSET is a multiple of sizeof (EMACS_INT), because then the
+   SDATA_DATA_OFFSET is a multiple of sizeof (ptrdiff_t), because then the
    alignment code reserves enough space.  */
 
 #define SDATA_SIZE(NBYTES)                                   \
      ((SDATA_DATA_OFFSET                                     \
-       + (SDATA_DATA_OFFSET % sizeof (EMACS_INT) == 0        \
+       + (SDATA_DATA_OFFSET % sizeof (ptrdiff_t) == 0        \
          ? NBYTES                                            \
-         : max (NBYTES, sizeof (EMACS_INT) - 1))             \
+         : max (NBYTES, sizeof (ptrdiff_t) - 1))             \
        + 1                                                   \
-       + sizeof (EMACS_INT) - 1)                             \
-      & ~(sizeof (EMACS_INT) - 1))
+       + sizeof (ptrdiff_t) - 1)                             \
+      & ~(sizeof (ptrdiff_t) - 1))
 
 #endif /* not GC_CHECK_STRING_BYTES */
 
@@ -1818,10 +1790,6 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
 static void
 init_strings (void)
 {
-  total_strings = total_free_strings = total_string_size = 0;
-  oldest_sblock = current_sblock = large_sblocks = NULL;
-  string_blocks = NULL;
-  string_free_list = NULL;
   empty_unibyte_string = make_pure_string ("", 0, 0, 0);
   empty_multibyte_string = make_pure_string ("", 0, 0, 1);
 }
@@ -1836,10 +1804,10 @@ static int check_string_bytes_count;
 
 /* Like GC_STRING_BYTES, but with debugging check.  */
 
-EMACS_INT
+ptrdiff_t
 string_bytes (struct Lisp_String *s)
 {
-  EMACS_INT nbytes =
+  ptrdiff_t nbytes =
     (s->size_byte < 0 ? s->size & ~ARRAY_MARK_FLAG : s->size_byte);
 
   if (!PURE_POINTER_P (s)
@@ -1862,10 +1830,10 @@ check_sblock (struct sblock *b)
     {
       /* Compute the next FROM here because copying below may
         overwrite data we need to compute it.  */
-      EMACS_INT nbytes;
+      ptrdiff_t nbytes;
 
       /* Check that the string size recorded in the string is the
-        same as the one recorded in the sdata structure. */
+        same as the one recorded in the sdata structure.  */
       if (from->string)
        CHECK_STRING_BYTES (from->string);
 
@@ -1901,7 +1869,7 @@ check_string_bytes (int all_p)
       for (b = oldest_sblock; b; b = b->next)
        check_sblock (b);
     }
-  else
+  else if (current_sblock)
     check_sblock (current_sblock);
 }
 
@@ -1945,17 +1913,17 @@ allocate_string (void)
      add all the Lisp_Strings in it to the free-list.  */
   if (string_free_list == NULL)
     {
-      struct string_block *b;
+      struct string_block *b = lisp_malloc (sizeof *b, MEM_TYPE_STRING);
       int i;
 
-      b = (struct string_block *) lisp_malloc (sizeof *b, MEM_TYPE_STRING);
-      memset (b, 0, sizeof *b);
       b->next = string_blocks;
       string_blocks = b;
 
       for (i = STRING_BLOCK_SIZE - 1; i >= 0; --i)
        {
          s = b->strings + i;
+         /* Every string on a free list should have NULL data pointer.  */
+         s->data = NULL;
          NEXT_FREE_LISP_STRING (s) = string_free_list;
          string_free_list = s;
        }
@@ -1971,9 +1939,6 @@ allocate_string (void)
 
   MALLOC_UNBLOCK_INPUT;
 
-  /* Probably not strictly necessary, but play it safe.  */
-  memset (s, 0, sizeof *s);
-
   --total_free_strings;
   ++total_strings;
   ++strings_consed;
@@ -2006,9 +1971,9 @@ void
 allocate_string_data (struct Lisp_String *s,
                      EMACS_INT nchars, EMACS_INT nbytes)
 {
-  struct sdata *data, *old_data;
+  struct sdata *data;
   struct sblock *b;
-  EMACS_INT needed, old_nbytes;
+  ptrdiff_t needed;
 
   if (STRING_BYTES_MAX < nbytes)
     string_overflow ();
@@ -2016,8 +1981,6 @@ allocate_string_data (struct Lisp_String *s,
   /* Determine the number of bytes needed to store NBYTES bytes
      of string data.  */
   needed = SDATA_SIZE (nbytes);
-  old_data = s->data ? SDATA_OF_STRING (s) : NULL;
-  old_nbytes = GC_STRING_BYTES (s);
 
   MALLOC_BLOCK_INPUT;
 
@@ -2038,7 +2001,7 @@ allocate_string_data (struct Lisp_String *s,
       mallopt (M_MMAP_MAX, 0);
 #endif
 
-      b = (struct sblock *) lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP);
+      b = lisp_malloc (size + GC_STRING_EXTRA, MEM_TYPE_NON_LISP);
 
 #ifdef DOUG_LEA_MALLOC
       /* Back to a reasonable maximum of mmap'ed areas. */
@@ -2056,7 +2019,7 @@ allocate_string_data (struct Lisp_String *s,
               < (needed + GC_STRING_EXTRA)))
     {
       /* Not enough room in the current sblock.  */
-      b = (struct sblock *) lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP);
+      b = lisp_malloc (SBLOCK_SIZE, MEM_TYPE_NON_LISP);
       b->next_free = &b->first_data;
       b->first_data.string = NULL;
       b->next = NULL;
@@ -2087,16 +2050,6 @@ allocate_string_data (struct Lisp_String *s,
   memcpy ((char *) data + needed, string_overrun_cookie,
          GC_STRING_OVERRUN_COOKIE_SIZE);
 #endif
-
-  /* If S had already data assigned, mark that as free by setting its
-     string back-pointer to null, and recording the size of the data
-     in it.  */
-  if (old_data)
-    {
-      SDATA_NBYTES (old_data) = old_nbytes;
-      old_data->string = NULL;
-    }
-
   consing_since_gc += needed;
 }
 
@@ -2247,13 +2200,13 @@ compact_small_strings (void)
   for (b = oldest_sblock; b; b = b->next)
     {
       end = b->next_free;
-      xassert ((char *) end <= (char *) b + SBLOCK_SIZE);
+      eassert ((char *) end <= (char *) b + SBLOCK_SIZE);
 
       for (from = &b->first_data; from < end; from = from_end)
        {
          /* Compute the next FROM here because copying below may
             overwrite data we need to compute it.  */
-         EMACS_INT nbytes;
+         ptrdiff_t nbytes;
 
 #ifdef GC_CHECK_STRING_BYTES
          /* Check that the string size recorded in the string is the
@@ -2298,7 +2251,7 @@ compact_small_strings (void)
              /* Copy, and update the string's `data' pointer.  */
              if (from != to)
                {
-                 xassert (tb != b || to < from);
+                 eassert (tb != b || to < from);
                  memmove (to, from, nbytes + GC_STRING_EXTRA);
                  to->string->data = SDATA_DATA (to);
                }
@@ -2383,7 +2336,8 @@ LENGTH must be a number.  INIT matters only in whether it is t or nil.  */)
 {
   register Lisp_Object val;
   struct Lisp_Bool_Vector *p;
-  EMACS_INT length_in_chars, length_in_elts;
+  ptrdiff_t length_in_chars;
+  EMACS_INT length_in_elts;
   int bits_per_value;
 
   CHECK_NATNUM (length);
@@ -2391,8 +2345,6 @@ LENGTH must be a number.  INIT matters only in whether it is t or nil.  */)
   bits_per_value = sizeof (EMACS_INT) * BOOL_VECTOR_BITS_PER_CHAR;
 
   length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value;
-  length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1)
-                    / BOOL_VECTOR_BITS_PER_CHAR);
 
   /* We must allocate one more elements than LENGTH_IN_ELTS for the
      slot `size' of the struct Lisp_Bool_Vector.  */
@@ -2404,6 +2356,8 @@ LENGTH must be a number.  INIT matters only in whether it is t or nil.  */)
   p = XBOOL_VECTOR (val);
   p->size = XFASTINT (length);
 
+  length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1)
+                    / BOOL_VECTOR_BITS_PER_CHAR);
   if (length_in_chars)
     {
       memset (p->data, ! NILP (init) ? -1 : 0, length_in_chars);
@@ -2422,10 +2376,10 @@ LENGTH must be a number.  INIT matters only in whether it is t or nil.  */)
    multibyte, depending on the contents.  */
 
 Lisp_Object
-make_string (const char *contents, EMACS_INT nbytes)
+make_string (const char *contents, ptrdiff_t nbytes)
 {
   register Lisp_Object val;
-  EMACS_INT nchars, multibyte_nbytes;
+  ptrdiff_t nchars, multibyte_nbytes;
 
   parse_str_as_multibyte ((const unsigned char *) contents, nbytes,
                          &nchars, &multibyte_nbytes);
@@ -2442,7 +2396,7 @@ make_string (const char *contents, EMACS_INT nbytes)
 /* Make an unibyte string from LENGTH bytes at CONTENTS.  */
 
 Lisp_Object
-make_unibyte_string (const char *contents, EMACS_INT length)
+make_unibyte_string (const char *contents, ptrdiff_t length)
 {
   register Lisp_Object val;
   val = make_uninit_string (length);
@@ -2456,7 +2410,7 @@ make_unibyte_string (const char *contents, EMACS_INT length)
 
 Lisp_Object
 make_multibyte_string (const char *contents,
-                      EMACS_INT nchars, EMACS_INT nbytes)
+                      ptrdiff_t nchars, ptrdiff_t nbytes)
 {
   register Lisp_Object val;
   val = make_uninit_multibyte_string (nchars, nbytes);
@@ -2470,7 +2424,7 @@ make_multibyte_string (const char *contents,
 
 Lisp_Object
 make_string_from_bytes (const char *contents,
-                       EMACS_INT nchars, EMACS_INT nbytes)
+                       ptrdiff_t nchars, ptrdiff_t nbytes)
 {
   register Lisp_Object val;
   val = make_uninit_multibyte_string (nchars, nbytes);
@@ -2488,7 +2442,7 @@ make_string_from_bytes (const char *contents,
 
 Lisp_Object
 make_specified_string (const char *contents,
-                      EMACS_INT nchars, EMACS_INT nbytes, int multibyte)
+                      ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte)
 {
   register Lisp_Object val;
 
@@ -2508,16 +2462,6 @@ make_specified_string (const char *contents,
 }
 
 
-/* Make a string from the data at STR, treating it as multibyte if the
-   data warrants.  */
-
-Lisp_Object
-build_string (const char *str)
-{
-  return make_string (str, strlen (str));
-}
-
-
 /* Return an unibyte Lisp_String set up to hold LENGTH characters
    occupying LENGTH bytes.  */
 
@@ -2549,12 +2493,27 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes)
     return empty_multibyte_string;
 
   s = allocate_string ();
+  s->intervals = NULL_INTERVAL;
   allocate_string_data (s, nchars, nbytes);
   XSETSTRING (string, s);
   string_chars_consed += nbytes;
   return string;
 }
 
+/* Print arguments to BUF according to a FORMAT, then return
+   a Lisp_String initialized with the data from BUF.  */
+
+Lisp_Object
+make_formatted_string (char *buf, const char *format, ...)
+{
+  va_list ap;
+  int length;
+
+  va_start (ap, format);
+  length = vsprintf (buf, format, ap);
+  va_end (ap);
+  return make_string (buf, length);
+}
 
 \f
 /***********************************************************************
@@ -2614,24 +2573,12 @@ static struct float_block *float_block;
 
 /* Index of first unused Lisp_Float in the current float_block.  */
 
-static int float_block_index;
+static int float_block_index = FLOAT_BLOCK_SIZE;
 
 /* Free-list of Lisp_Floats.  */
 
 static struct Lisp_Float *float_free_list;
 
-
-/* Initialize float allocation.  */
-
-static void
-init_float (void)
-{
-  float_block = NULL;
-  float_block_index = FLOAT_BLOCK_SIZE; /* Force alloc of new float_block.   */
-  float_free_list = 0;
-}
-
-
 /* Return a new float object with value FLOAT_VALUE.  */
 
 Lisp_Object
@@ -2654,14 +2601,13 @@ make_float (double float_value)
     {
       if (float_block_index == FLOAT_BLOCK_SIZE)
        {
-         register struct float_block *new;
-
-         new = (struct float_block *) lisp_align_malloc (sizeof *new,
-                                                         MEM_TYPE_FLOAT);
+         struct float_block *new
+           = lisp_align_malloc (sizeof *new, MEM_TYPE_FLOAT);
          new->next = float_block;
          memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
          float_block = new;
          float_block_index = 0;
+         total_free_floats += FLOAT_BLOCK_SIZE;
        }
       XSETFLOAT (val, &float_block->floats[float_block_index]);
       float_block_index++;
@@ -2673,6 +2619,7 @@ make_float (double float_value)
   eassert (!FLOAT_MARKED_P (XFLOAT (val)));
   consing_since_gc += sizeof (struct Lisp_Float);
   floats_consed++;
+  total_free_floats--;
   return val;
 }
 
@@ -2687,8 +2634,10 @@ make_float (double float_value)
    GC are put on a free list to be reallocated before allocating
    any new cons cells from the latest cons_block.  */
 
-#define CONS_BLOCK_SIZE \
-  (((BLOCK_BYTES - sizeof (struct cons_block *)) * CHAR_BIT) \
+#define CONS_BLOCK_SIZE                                                \
+  (((BLOCK_BYTES - sizeof (struct cons_block *)                        \
+     /* The compiler might add padding at the end.  */         \
+     - (sizeof (struct Lisp_Cons) - sizeof (int))) * CHAR_BIT) \
    / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1))
 
 #define CONS_BLOCK(fptr) \
@@ -2720,24 +2669,12 @@ static struct cons_block *cons_block;
 
 /* Index of first unused Lisp_Cons in the current block.  */
 
-static int cons_block_index;
+static int cons_block_index = CONS_BLOCK_SIZE;
 
 /* Free-list of Lisp_Cons structures.  */
 
 static struct Lisp_Cons *cons_free_list;
 
-
-/* Initialize cons allocation.  */
-
-static void
-init_cons (void)
-{
-  cons_block = NULL;
-  cons_block_index = CONS_BLOCK_SIZE; /* Force alloc of new cons_block.  */
-  cons_free_list = 0;
-}
-
-
 /* Explicitly free a cons cell by putting it on the free-list.  */
 
 void
@@ -2748,6 +2685,7 @@ free_cons (struct Lisp_Cons *ptr)
   ptr->car = Vdead;
 #endif
   cons_free_list = ptr;
+  total_free_conses++;
 }
 
 DEFUN ("cons", Fcons, Scons, 2, 2, 0,
@@ -2771,13 +2709,13 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
     {
       if (cons_block_index == CONS_BLOCK_SIZE)
        {
-         register struct cons_block *new;
-         new = (struct cons_block *) lisp_align_malloc (sizeof *new,
-                                                        MEM_TYPE_CONS);
+         struct cons_block *new
+           = lisp_align_malloc (sizeof *new, MEM_TYPE_CONS);
          memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
          new->next = cons_block;
          cons_block = new;
          cons_block_index = 0;
+         total_free_conses += CONS_BLOCK_SIZE;
        }
       XSETCONS (val, &cons_block->conses[cons_block_index]);
       cons_block_index++;
@@ -2789,6 +2727,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
   XSETCDR (val, cdr);
   eassert (!CONS_MARKED_P (XCONS (val)));
   consing_since_gc += sizeof (struct Lisp_Cons);
+  total_free_conses--;
   cons_cells_consed++;
   return val;
 }
@@ -2912,51 +2851,340 @@ DEFUN ("make-list", Fmake_list, Smake_list, 2, 2, 0,
                           Vector Allocation
  ***********************************************************************/
 
-/* Singly-linked list of all vectors.  */
+/* This value is balanced well enough to avoid too much internal overhead
+   for the most common cases; it's not required to be a power of two, but
+   it's expected to be a mult-of-ROUNDUP_SIZE (see below).  */
 
-static struct Lisp_Vector *all_vectors;
+#define VECTOR_BLOCK_SIZE 4096
 
 /* Handy constants for vectorlike objects.  */
 enum
   {
     header_size = offsetof (struct Lisp_Vector, contents),
-    word_size = sizeof (Lisp_Object)
+    word_size = sizeof (Lisp_Object),
+    roundup_size = COMMON_MULTIPLE (sizeof (Lisp_Object),
+                                   USE_LSB_TAG ? 1 << GCTYPEBITS : 1)
   };
 
+/* ROUNDUP_SIZE must be a power of 2.  */
+verify ((roundup_size & (roundup_size - 1)) == 0);
+
+/* Verify assumptions described above.  */
+verify ((VECTOR_BLOCK_SIZE % roundup_size) == 0);
+verify (VECTOR_BLOCK_SIZE <= (1 << PSEUDOVECTOR_SIZE_BITS));
+
+/* Round up X to nearest mult-of-ROUNDUP_SIZE.  */
+
+#define vroundup(x) (((x) + (roundup_size - 1)) & ~(roundup_size - 1))
+
+/* Rounding helps to maintain alignment constraints if USE_LSB_TAG.  */
+
+#define VECTOR_BLOCK_BYTES (VECTOR_BLOCK_SIZE - vroundup (sizeof (void *)))
+
+/* Size of the minimal vector allocated from block.  */
+
+#define VBLOCK_BYTES_MIN vroundup (sizeof (struct Lisp_Vector))
+
+/* Size of the largest vector allocated from block.  */
+
+#define VBLOCK_BYTES_MAX                                       \
+  vroundup ((VECTOR_BLOCK_BYTES / 2) - sizeof (Lisp_Object))
+
+/* We maintain one free list for each possible block-allocated
+   vector size, and this is the number of free lists we have.  */
+
+#define VECTOR_MAX_FREE_LIST_INDEX                             \
+  ((VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN) / roundup_size + 1)
+
+/* Common shortcut to advance vector pointer over a block data.  */
+
+#define ADVANCE(v, nbytes) ((struct Lisp_Vector *) ((char *) (v) + (nbytes)))
+
+/* Common shortcut to calculate NBYTES-vector index in VECTOR_FREE_LISTS.  */
+
+#define VINDEX(nbytes) (((nbytes) - VBLOCK_BYTES_MIN) / roundup_size)
+
+/* Common shortcut to setup vector on a free list.  */
+
+#define SETUP_ON_FREE_LIST(v, nbytes, index)                   \
+  do {                                                         \
+    XSETPVECTYPESIZE (v, PVEC_FREE, nbytes);                   \
+    eassert ((nbytes) % roundup_size == 0);                    \
+    (index) = VINDEX (nbytes);                                 \
+    eassert ((index) < VECTOR_MAX_FREE_LIST_INDEX);            \
+    (v)->header.next.vector = vector_free_lists[index];                \
+    vector_free_lists[index] = (v);                            \
+    total_free_vector_bytes += (nbytes);                       \
+  } while (0)
+
+struct vector_block
+{
+  char data[VECTOR_BLOCK_BYTES];
+  struct vector_block *next;
+};
+
+/* Chain of vector blocks.  */
+
+static struct vector_block *vector_blocks;
+
+/* Vector free lists, where NTH item points to a chain of free
+   vectors of the same NBYTES size, so NTH == VINDEX (NBYTES).  */
+
+static struct Lisp_Vector *vector_free_lists[VECTOR_MAX_FREE_LIST_INDEX];
+
+/* Singly-linked list of large vectors.  */
+
+static struct Lisp_Vector *large_vectors;
+
+/* The only vector with 0 slots, allocated from pure space.  */
+
+Lisp_Object zero_vector;
+
+/* Get a new vector block.  */
+
+static struct vector_block *
+allocate_vector_block (void)
+{
+  struct vector_block *block = xmalloc (sizeof *block);
+
+#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+  mem_insert (block->data, block->data + VECTOR_BLOCK_BYTES,
+             MEM_TYPE_VECTOR_BLOCK);
+#endif
+
+  block->next = vector_blocks;
+  vector_blocks = block;
+  return block;
+}
+
+/* Called once to initialize vector allocation.  */
+
+static void
+init_vectors (void)
+{
+  zero_vector = make_pure_vector (0);
+}
+
+/* Allocate vector from a vector block.  */
+
+static struct Lisp_Vector *
+allocate_vector_from_block (size_t nbytes)
+{
+  struct Lisp_Vector *vector, *rest;
+  struct vector_block *block;
+  size_t index, restbytes;
+
+  eassert (VBLOCK_BYTES_MIN <= nbytes && nbytes <= VBLOCK_BYTES_MAX);
+  eassert (nbytes % roundup_size == 0);
+
+  /* First, try to allocate from a free list
+     containing vectors of the requested size.  */
+  index = VINDEX (nbytes);
+  if (vector_free_lists[index])
+    {
+      vector = vector_free_lists[index];
+      vector_free_lists[index] = vector->header.next.vector;
+      vector->header.next.nbytes = nbytes;
+      total_free_vector_bytes -= nbytes;
+      return vector;
+    }
+
+  /* Next, check free lists containing larger vectors.  Since
+     we will split the result, we should have remaining space
+     large enough to use for one-slot vector at least.  */
+  for (index = VINDEX (nbytes + VBLOCK_BYTES_MIN);
+       index < VECTOR_MAX_FREE_LIST_INDEX; index++)
+    if (vector_free_lists[index])
+      {
+       /* This vector is larger than requested.  */
+       vector = vector_free_lists[index];
+       vector_free_lists[index] = vector->header.next.vector;
+       vector->header.next.nbytes = nbytes;
+       total_free_vector_bytes -= nbytes;
+
+       /* Excess bytes are used for the smaller vector,
+          which should be set on an appropriate free list.  */
+       restbytes = index * roundup_size + VBLOCK_BYTES_MIN - nbytes;
+       eassert (restbytes % roundup_size == 0);
+       rest = ADVANCE (vector, nbytes);
+       SETUP_ON_FREE_LIST (rest, restbytes, index);
+       return vector;
+      }
+
+  /* Finally, need a new vector block.  */
+  block = allocate_vector_block ();
+
+  /* New vector will be at the beginning of this block.  */
+  vector = (struct Lisp_Vector *) block->data;
+  vector->header.next.nbytes = nbytes;
+
+  /* If the rest of space from this block is large enough
+     for one-slot vector at least, set up it on a free list.  */
+  restbytes = VECTOR_BLOCK_BYTES - nbytes;
+  if (restbytes >= VBLOCK_BYTES_MIN)
+    {
+      eassert (restbytes % roundup_size == 0);
+      rest = ADVANCE (vector, nbytes);
+      SETUP_ON_FREE_LIST (rest, restbytes, index);
+    }
+  return vector;
+ }
+
+/* Return how many Lisp_Objects can be stored in V.  */
+
+#define VECTOR_SIZE(v) ((v)->header.size & PSEUDOVECTOR_FLAG ?         \
+                       (PSEUDOVECTOR_SIZE_MASK & (v)->header.size) :   \
+                       (v)->header.size)
+
+/* Nonzero if VECTOR pointer is valid pointer inside BLOCK.  */
+
+#define VECTOR_IN_BLOCK(vector, block)         \
+  ((char *) (vector) <= (block)->data          \
+   + VECTOR_BLOCK_BYTES - VBLOCK_BYTES_MIN)
+
+/* Number of bytes used by vector-block-allocated object.  This is the only
+   place where we actually use the `nbytes' field of the vector-header.
+   I.e. we could get rid of the `nbytes' field by computing it based on the
+   vector-type.  */
+
+#define PSEUDOVECTOR_NBYTES(vector) \
+  (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FREE)     \
+   ? vector->header.size & PSEUDOVECTOR_SIZE_MASK      \
+   : vector->header.next.nbytes)
+
+/* Reclaim space used by unmarked vectors.  */
+
+static void
+sweep_vectors (void)
+{
+  struct vector_block *block = vector_blocks, **bprev = &vector_blocks;
+  struct Lisp_Vector *vector, *next, **vprev = &large_vectors;
+
+  total_free_vector_bytes = total_vector_size = 0;
+  memset (vector_free_lists, 0, sizeof (vector_free_lists));
+
+  /* Looking through vector blocks.  */
+
+  for (block = vector_blocks; block; block = *bprev)
+    {
+      int free_this_block = 0;
+
+      for (vector = (struct Lisp_Vector *) block->data;
+          VECTOR_IN_BLOCK (vector, block); vector = next)
+       {
+         if (VECTOR_MARKED_P (vector))
+           {
+             VECTOR_UNMARK (vector);
+             total_vector_size += VECTOR_SIZE (vector);
+             next = ADVANCE (vector, vector->header.next.nbytes);
+           }
+         else
+           {
+             ptrdiff_t nbytes = PSEUDOVECTOR_NBYTES (vector);
+             ptrdiff_t total_bytes = nbytes;
+
+             next = ADVANCE (vector, nbytes);
+
+             /* While NEXT is not marked, try to coalesce with VECTOR,
+                thus making VECTOR of the largest possible size.  */
+
+             while (VECTOR_IN_BLOCK (next, block))
+               {
+                 if (VECTOR_MARKED_P (next))
+                   break;
+                 nbytes = PSEUDOVECTOR_NBYTES (next);
+                 total_bytes += nbytes;
+                 next = ADVANCE (next, nbytes);
+               }
+
+             eassert (total_bytes % roundup_size == 0);
+
+             if (vector == (struct Lisp_Vector *) block->data
+                 && !VECTOR_IN_BLOCK (next, block))
+               /* This block should be freed because all of it's
+                  space was coalesced into the only free vector.  */
+               free_this_block = 1;
+             else
+               {
+                 int tmp;
+                 SETUP_ON_FREE_LIST (vector, total_bytes, tmp);
+               }
+           }
+       }
+
+      if (free_this_block)
+       {
+         *bprev = block->next;
+#if GC_MARK_STACK && !defined GC_MALLOC_CHECK
+         mem_delete (mem_find (block->data));
+#endif
+         xfree (block);
+       }
+      else
+       bprev = &block->next;
+    }
+
+  /* Sweep large vectors.  */
+
+  for (vector = large_vectors; vector; vector = *vprev)
+    {
+      if (VECTOR_MARKED_P (vector))
+       {
+         VECTOR_UNMARK (vector);
+         total_vector_size += VECTOR_SIZE (vector);
+         vprev = &vector->header.next.vector;
+       }
+      else
+       {
+         *vprev = vector->header.next.vector;
+         lisp_free (vector);
+       }
+    }
+}
+
 /* Value is a pointer to a newly allocated Lisp_Vector structure
    with room for LEN Lisp_Objects.  */
 
 static struct Lisp_Vector *
-allocate_vectorlike (EMACS_INT len)
+allocate_vectorlike (ptrdiff_t len)
 {
   struct Lisp_Vector *p;
-  size_t nbytes;
 
   MALLOC_BLOCK_INPUT;
 
-#ifdef DOUG_LEA_MALLOC
-  /* Prevent mmap'ing the chunk.  Lisp data may not be mmap'ed
-     because mapped region contents are not preserved in
-     a dumped Emacs.  */
-  mallopt (M_MMAP_MAX, 0);
-#endif
-
   /* This gets triggered by code which I haven't bothered to fix.  --Stef  */
   /* eassert (!handling_signal); */
 
-  nbytes = header_size + len * word_size;
-  p = (struct Lisp_Vector *) lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE);
+  if (len == 0)
+    p = XVECTOR (zero_vector);
+  else
+    {
+      size_t nbytes = header_size + len * word_size;
 
 #ifdef DOUG_LEA_MALLOC
-  /* Back to a reasonable maximum of mmap'ed areas.  */
-  mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
+      /* Prevent mmap'ing the chunk.  Lisp data may not be mmap'ed
+        because mapped region contents are not preserved in
+        a dumped Emacs.  */
+      mallopt (M_MMAP_MAX, 0);
 #endif
 
-  consing_since_gc += nbytes;
-  vector_cells_consed += len;
+      if (nbytes <= VBLOCK_BYTES_MAX)
+       p = allocate_vector_from_block (vroundup (nbytes));
+      else
+       {
+         p = lisp_malloc (nbytes, MEM_TYPE_VECTORLIKE);
+         p->header.next.vector = large_vectors;
+         large_vectors = p;
+       }
+
+#ifdef DOUG_LEA_MALLOC
+      /* Back to a reasonable maximum of mmap'ed areas.  */
+      mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
+#endif
 
-  p->header.next.vector = all_vectors;
-  all_vectors = p;
+      consing_since_gc += nbytes;
+      vector_cells_consed += len;
+    }
 
   MALLOC_UNBLOCK_INPUT;
 
@@ -2983,7 +3211,7 @@ allocate_vector (EMACS_INT len)
 /* Allocate other vector-like structures.  */
 
 struct Lisp_Vector *
-allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag)
+allocate_pseudovector (int memlen, int lisplen, int tag)
 {
   struct Lisp_Vector *v = allocate_vectorlike (memlen);
   int i;
@@ -2996,50 +3224,70 @@ allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag)
   return v;
 }
 
+struct buffer *
+allocate_buffer (void)
+{
+  struct buffer *b = lisp_malloc (sizeof *b, MEM_TYPE_BUFFER);
+
+  XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text)
+                                    - header_size) / word_size);
+  /* Note that the fields of B are not initialized.  */
+  return b;
+}
+
 struct Lisp_Hash_Table *
 allocate_hash_table (void)
 {
   return ALLOCATE_PSEUDOVECTOR (struct Lisp_Hash_Table, count, PVEC_HASH_TABLE);
 }
 
-
 struct window *
 allocate_window (void)
 {
-  return ALLOCATE_PSEUDOVECTOR (struct window, current_matrix, PVEC_WINDOW);
-}
+  struct window *w;
 
+  w = ALLOCATE_PSEUDOVECTOR (struct window, current_matrix, PVEC_WINDOW);
+  /* Users assumes that non-Lisp data is zeroed.  */
+  memset (&w->current_matrix, 0,
+         sizeof (*w) - offsetof (struct window, current_matrix));
+  return w;
+}
 
 struct terminal *
 allocate_terminal (void)
 {
-  struct terminal *t = ALLOCATE_PSEUDOVECTOR (struct terminal,
-                                             next_terminal, PVEC_TERMINAL);
-  /* Zero out the non-GC'd fields.  FIXME: This should be made unnecessary.  */
-  memset (&t->next_terminal, 0,
-         (char*) (t + 1) - (char*) &t->next_terminal);
+  struct terminal *t;
 
+  t = ALLOCATE_PSEUDOVECTOR (struct terminal, next_terminal, PVEC_TERMINAL);
+  /* Users assumes that non-Lisp data is zeroed.  */
+  memset (&t->next_terminal, 0,
+         sizeof (*t) - offsetof (struct terminal, next_terminal));
   return t;
 }
 
 struct frame *
 allocate_frame (void)
 {
-  struct frame *f = ALLOCATE_PSEUDOVECTOR (struct frame,
-                                          face_cache, PVEC_FRAME);
-  /* Zero out the non-GC'd fields.  FIXME: This should be made unnecessary.  */
+  struct frame *f;
+
+  f = ALLOCATE_PSEUDOVECTOR (struct frame, face_cache, PVEC_FRAME);
+  /* Users assumes that non-Lisp data is zeroed.  */
   memset (&f->face_cache, 0,
-         (char *) (f + 1) - (char *) &f->face_cache);
+         sizeof (*f) - offsetof (struct frame, face_cache));
   return f;
 }
 
-
 struct Lisp_Process *
 allocate_process (void)
 {
-  return ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS);
-}
+  struct Lisp_Process *p;
 
+  p = ALLOCATE_PSEUDOVECTOR (struct Lisp_Process, pid, PVEC_PROCESS);
+  /* Users assumes that non-Lisp data is zeroed.  */
+  memset (&p->pid, 0,
+         sizeof (*p) - offsetof (struct Lisp_Process, pid));
+  return p;
+}
 
 DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 0,
        doc: /* Return a newly created vector of length LENGTH, with each element being INIT.
@@ -3047,14 +3295,14 @@ See also the function `vector'.  */)
   (register Lisp_Object length, Lisp_Object init)
 {
   Lisp_Object vector;
-  register EMACS_INT sizei;
-  register EMACS_INT i;
+  register ptrdiff_t sizei;
+  register ptrdiff_t i;
   register struct Lisp_Vector *p;
 
   CHECK_NATNUM (length);
-  sizei = XFASTINT (length);
 
-  p = allocate_vector (sizei);
+  p = allocate_vector (XFASTINT (length));
+  sizei = XFASTINT (length);
   for (i = 0; i < sizei; i++)
     p->contents[i] = init;
 
@@ -3081,6 +3329,19 @@ usage: (vector &rest OBJECTS)  */)
   return val;
 }
 
+void
+make_byte_code (struct Lisp_Vector *v)
+{
+  if (v->header.size > 1 && STRINGP (v->contents[1])
+      && STRING_MULTIBYTE (v->contents[1]))
+    /* BYTECODE-STRING must have been produced by Emacs 20.2 or the
+       earlier because they produced a raw 8-bit string for byte-code
+       and now such a byte-code string is loaded as multibyte while
+       raw 8-bit characters converted to multibyte form.  Thus, now we
+       must convert them back to the original unibyte form.  */
+    v->contents[1] = Fstring_as_unibyte (v->contents[1]);
+  XSETPVECTYPE (v, PVEC_COMPILED);
+}
 
 DEFUN ("make-byte-code", Fmake_byte_code, Smake_byte_code, 4, MANY, 0,
        doc: /* Create a byte-code object with specified arguments as elements.
@@ -3104,28 +3365,21 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
   ptrdiff_t i;
   register struct Lisp_Vector *p;
 
-  XSETFASTINT (len, nargs);
-  if (!NILP (Vpurify_flag))
-    val = make_pure_vector (nargs);
-  else
-    val = Fmake_vector (len, Qnil);
+  /* We used to purecopy everything here, if purify-flga was set.  This worked
+     OK for Emacs-23, but with Emacs-24's lexical binding code, it can be
+     dangerous, since make-byte-code is used during execution to build
+     closures, so any closure built during the preload phase would end up
+     copied into pure space, including its free variables, which is sometimes
+     just wasteful and other times plainly wrong (e.g. those free vars may want
+     to be setcar'd).  */
 
-  if (nargs > 1 && STRINGP (args[1]) && STRING_MULTIBYTE (args[1]))
-    /* BYTECODE-STRING must have been produced by Emacs 20.2 or the
-       earlier because they produced a raw 8-bit string for byte-code
-       and now such a byte-code string is loaded as multibyte while
-       raw 8-bit characters converted to multibyte form.  Thus, now we
-       must convert them back to the original unibyte form.  */
-    args[1] = Fstring_as_unibyte (args[1]);
+  XSETFASTINT (len, nargs);
+  val = Fmake_vector (len, Qnil);
 
   p = XVECTOR (val);
   for (i = 0; i < nargs; i++)
-    {
-      if (!NILP (Vpurify_flag))
-       args[i] = Fpurecopy (args[i]);
-      p->contents[i] = args[i];
-    }
-  XSETPVECTYPE (p, PVEC_COMPILED);
+    p->contents[i] = args[i];
+  make_byte_code (p);
   XSETCOMPILED (val, p);
   return val;
 }
@@ -3136,17 +3390,29 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INT
                           Symbol Allocation
  ***********************************************************************/
 
+/* Like struct Lisp_Symbol, but padded so that the size is a multiple
+   of the required alignment if LSB tags are used.  */
+
+union aligned_Lisp_Symbol
+{
+  struct Lisp_Symbol s;
+#if USE_LSB_TAG
+  unsigned char c[(sizeof (struct Lisp_Symbol) + (1 << GCTYPEBITS) - 1)
+                 & -(1 << GCTYPEBITS)];
+#endif
+};
+
 /* Each symbol_block is just under 1020 bytes long, since malloc
    really allocates in units of powers of two and uses 4 bytes for its
-   own overhead. */
+   own overhead.  */
 
 #define SYMBOL_BLOCK_SIZE \
-  ((1020 - sizeof (struct symbol_block *)) / sizeof (struct Lisp_Symbol))
+  ((1020 - sizeof (struct symbol_block *)) / sizeof (union aligned_Lisp_Symbol))
 
 struct symbol_block
 {
   /* Place `symbols' first, to preserve alignment.  */
-  struct Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
+  union aligned_Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
   struct symbol_block *next;
 };
 
@@ -3154,24 +3420,12 @@ struct symbol_block
    structure in it.  */
 
 static struct symbol_block *symbol_block;
-static int symbol_block_index;
+static int symbol_block_index = SYMBOL_BLOCK_SIZE;
 
 /* List of free symbols.  */
 
 static struct Lisp_Symbol *symbol_free_list;
 
-
-/* Initialize symbol allocation.  */
-
-static void
-init_symbol (void)
-{
-  symbol_block = NULL;
-  symbol_block_index = SYMBOL_BLOCK_SIZE;
-  symbol_free_list = 0;
-}
-
-
 DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
        doc: /* Return a newly allocated uninterned symbol whose name is NAME.
 Its value and function definition are void, and its property list is nil.  */)
@@ -3195,14 +3449,14 @@ Its value and function definition are void, and its property list is nil.  */)
     {
       if (symbol_block_index == SYMBOL_BLOCK_SIZE)
        {
-         struct symbol_block *new;
-         new = (struct symbol_block *) lisp_malloc (sizeof *new,
-                                                    MEM_TYPE_SYMBOL);
+         struct symbol_block *new
+           = lisp_malloc (sizeof *new, MEM_TYPE_SYMBOL);
          new->next = symbol_block;
          symbol_block = new;
          symbol_block_index = 0;
+         total_free_symbols += SYMBOL_BLOCK_SIZE;
        }
-      XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index]);
+      XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index].s);
       symbol_block_index++;
     }
 
@@ -3221,6 +3475,7 @@ Its value and function definition are void, and its property list is nil.  */)
   p->declared_special = 0;
   consing_since_gc += sizeof (struct Lisp_Symbol);
   symbols_consed++;
+  total_free_symbols--;
   return val;
 }
 
@@ -3230,32 +3485,36 @@ Its value and function definition are void, and its property list is nil.  */)
                       Marker (Misc) Allocation
  ***********************************************************************/
 
+/* Like union Lisp_Misc, but padded so that its size is a multiple of
+   the required alignment when LSB tags are used.  */
+
+union aligned_Lisp_Misc
+{
+  union Lisp_Misc m;
+#if USE_LSB_TAG
+  unsigned char c[(sizeof (union Lisp_Misc) + (1 << GCTYPEBITS) - 1)
+                 & -(1 << GCTYPEBITS)];
+#endif
+};
+
 /* Allocation of markers and other objects that share that structure.
    Works like allocation of conses. */
 
 #define MARKER_BLOCK_SIZE \
-  ((1020 - sizeof (struct marker_block *)) / sizeof (union Lisp_Misc))
+  ((1020 - sizeof (struct marker_block *)) / sizeof (union aligned_Lisp_Misc))
 
 struct marker_block
 {
   /* Place `markers' first, to preserve alignment.  */
-  union Lisp_Misc markers[MARKER_BLOCK_SIZE];
+  union aligned_Lisp_Misc markers[MARKER_BLOCK_SIZE];
   struct marker_block *next;
 };
 
 static struct marker_block *marker_block;
-static int marker_block_index;
+static int marker_block_index = MARKER_BLOCK_SIZE;
 
 static union Lisp_Misc *marker_free_list;
 
-static void
-init_marker (void)
-{
-  marker_block = NULL;
-  marker_block_index = MARKER_BLOCK_SIZE;
-  marker_free_list = 0;
-}
-
 /* Return a newly allocated Lisp_Misc object, with no substructure.  */
 
 Lisp_Object
@@ -3276,15 +3535,13 @@ allocate_misc (void)
     {
       if (marker_block_index == MARKER_BLOCK_SIZE)
        {
-         struct marker_block *new;
-         new = (struct marker_block *) lisp_malloc (sizeof *new,
-                                                    MEM_TYPE_MISC);
+         struct marker_block *new = lisp_malloc (sizeof *new, MEM_TYPE_MISC);
          new->next = marker_block;
          marker_block = new;
          marker_block_index = 0;
          total_free_markers += MARKER_BLOCK_SIZE;
        }
-      XSETMISC (val, &marker_block->markers[marker_block_index]);
+      XSETMISC (val, &marker_block->markers[marker_block_index].m);
       marker_block_index++;
     }
 
@@ -3346,6 +3603,33 @@ DEFUN ("make-marker", Fmake_marker, Smake_marker, 0, 0, 0,
   return val;
 }
 
+/* Return a newly allocated marker which points into BUF
+   at character position CHARPOS and byte position BYTEPOS.  */
+
+Lisp_Object
+build_marker (struct buffer *buf, ptrdiff_t charpos, ptrdiff_t bytepos)
+{
+  Lisp_Object obj;
+  struct Lisp_Marker *m;
+
+  /* No dead buffers here.  */
+  eassert (!NILP (BVAR (buf, name)));
+
+  /* Every character is at least one byte.  */
+  eassert (charpos <= bytepos);
+
+  obj = allocate_misc ();
+  XMISCTYPE (obj) = Lisp_Misc_Marker;
+  m = XMARKER (obj);
+  m->buffer = buf;
+  m->charpos = charpos;
+  m->bytepos = bytepos;
+  m->insertion_type = 0;
+  m->next = BUF_MARKERS (buf);
+  BUF_MARKERS (buf) = m;
+  return obj;
+}
+
 /* Put MARKER back on the free list after using it temporarily.  */
 
 void
@@ -3471,25 +3755,25 @@ refill_memory_reserve (void)
 {
 #ifndef SYSTEM_MALLOC
   if (spare_memory[0] == 0)
-    spare_memory[0] = (char *) malloc (SPARE_MEMORY);
+    spare_memory[0] = malloc (SPARE_MEMORY);
   if (spare_memory[1] == 0)
-    spare_memory[1] = (char *) lisp_align_malloc (sizeof (struct cons_block),
+    spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block),
                                                  MEM_TYPE_CONS);
   if (spare_memory[2] == 0)
-    spare_memory[2] = (char *) lisp_align_malloc (sizeof (struct cons_block),
-                                                 MEM_TYPE_CONS);
+    spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block),
+                                        MEM_TYPE_CONS);
   if (spare_memory[3] == 0)
-    spare_memory[3] = (char *) lisp_align_malloc (sizeof (struct cons_block),
-                                                 MEM_TYPE_CONS);
+    spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block),
+                                        MEM_TYPE_CONS);
   if (spare_memory[4] == 0)
-    spare_memory[4] = (char *) lisp_align_malloc (sizeof (struct cons_block),
-                                                 MEM_TYPE_CONS);
+    spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block),
+                                        MEM_TYPE_CONS);
   if (spare_memory[5] == 0)
-    spare_memory[5] = (char *) lisp_malloc (sizeof (struct string_block),
-                                           MEM_TYPE_STRING);
+    spare_memory[5] = lisp_malloc (sizeof (struct string_block),
+                                  MEM_TYPE_STRING);
   if (spare_memory[6] == 0)
-    spare_memory[6] = (char *) lisp_malloc (sizeof (struct string_block),
-                                           MEM_TYPE_STRING);
+    spare_memory[6] = lisp_malloc (sizeof (struct string_block),
+                                  MEM_TYPE_STRING);
   if (spare_memory[0] && spare_memory[1] && spare_memory[5])
     Vmemory_full = Qnil;
 #endif
@@ -3589,11 +3873,11 @@ mem_insert (void *start, void *end, enum mem_type type)
 
   /* Create a new node.  */
 #ifdef GC_MALLOC_CHECK
-  x = (struct mem_node *) _malloc_internal (sizeof *x);
+  x = _malloc_internal (sizeof *x);
   if (x == NULL)
     abort ();
 #else
-  x = (struct mem_node *) xmalloc (sizeof *x);
+  x = xmalloc (sizeof *x);
 #endif
   x->start = start;
   x->end = end;
@@ -4032,7 +4316,33 @@ live_misc_p (struct mem_node *m, void *p)
 static inline int
 live_vector_p (struct mem_node *m, void *p)
 {
-  return (p == m->start && m->type == MEM_TYPE_VECTORLIKE);
+  if (m->type == MEM_TYPE_VECTOR_BLOCK)
+    {
+      /* This memory node corresponds to a vector block.  */
+      struct vector_block *block = (struct vector_block *) m->start;
+      struct Lisp_Vector *vector = (struct Lisp_Vector *) block->data;
+
+      /* P is in the block's allocation range.  Scan the block
+        up to P and see whether P points to the start of some
+        vector which is not on a free list.  FIXME: check whether
+        some allocation patterns (probably a lot of short vectors)
+        may cause a substantial overhead of this loop.  */
+      while (VECTOR_IN_BLOCK (vector, block)
+            && vector <= (struct Lisp_Vector *) p)
+       {
+         if (PSEUDOVECTOR_TYPEP (&vector->header, PVEC_FREE))
+           vector = ADVANCE (vector, (vector->header.size
+                                      & PSEUDOVECTOR_SIZE_MASK));
+         else if (vector == p)
+           return 1;
+         else
+           vector = ADVANCE (vector, vector->header.next.nbytes);
+       }
+    }
+  else if (m->type == MEM_TYPE_VECTORLIKE && p == m->start)
+    /* This memory node corresponds to a large vector.  */
+    return 1;
+  return 0;
 }
 
 
@@ -4179,14 +4489,10 @@ mark_maybe_pointer (void *p)
 {
   struct mem_node *m;
 
-  /* Quickly rule out some values which can't point to Lisp data.  */
-  if ((intptr_t) p %
-#ifdef USE_LSB_TAG
-      8 /* USE_LSB_TAG needs Lisp data to be aligned on multiples of 8.  */
-#else
-      2 /* We assume that Lisp data is aligned on even addresses.  */
-#endif
-      )
+  /* Quickly rule out some values which can't point to Lisp data.
+     USE_LSB_TAG needs Lisp data to be aligned on multiples of 1 << GCTYPEBITS.
+     Otherwise, assume that Lisp data is aligned on even addresses.  */
+  if ((intptr_t) p % (USE_LSB_TAG ? 1 << GCTYPEBITS : 2))
     return;
 
   m = mem_find (p);
@@ -4232,6 +4538,7 @@ mark_maybe_pointer (void *p)
          break;
 
        case MEM_TYPE_VECTORLIKE:
+       case MEM_TYPE_VECTOR_BLOCK:
          if (live_vector_p (m, p))
            {
              Lisp_Object tem;
@@ -4251,23 +4558,46 @@ mark_maybe_pointer (void *p)
 }
 
 
-/* Alignment of Lisp_Object and pointer values.  Use offsetof, as it
-   sometimes returns a smaller alignment than GCC's __alignof__ and
-   mark_memory might miss objects if __alignof__ were used.  For
-   example, on x86 with WIDE_EMACS_INT, __alignof__ (Lisp_Object) is 8
-   but GC_LISP_OBJECT_ALIGNMENT should be 4.  */
-#ifndef GC_LISP_OBJECT_ALIGNMENT
-# define GC_LISP_OBJECT_ALIGNMENT offsetof (struct {char a; Lisp_Object b;}, b)
-#endif
+/* Alignment of pointer values.  Use offsetof, as it sometimes returns
+   a smaller alignment than GCC's __alignof__ and mark_memory might
+   miss objects if __alignof__ were used.  */
 #define GC_POINTER_ALIGNMENT offsetof (struct {char a; void *b;}, b)
 
+/* Define POINTERS_MIGHT_HIDE_IN_OBJECTS to 1 if marking via C pointers does
+   not suffice, which is the typical case.  A host where a Lisp_Object is
+   wider than a pointer might allocate a Lisp_Object in non-adjacent halves.
+   If USE_LSB_TAG, the bottom half is not a valid pointer, but it should
+   suffice to widen it to to a Lisp_Object and check it that way.  */
+#if USE_LSB_TAG || VAL_MAX < UINTPTR_MAX
+# if !USE_LSB_TAG && VAL_MAX < UINTPTR_MAX >> GCTYPEBITS
+  /* If tag bits straddle pointer-word boundaries, neither mark_maybe_pointer
+     nor mark_maybe_object can follow the pointers.  This should not occur on
+     any practical porting target.  */
+#  error "MSB type bits straddle pointer-word boundaries"
+# endif
+  /* Marking via C pointers does not suffice, because Lisp_Objects contain
+     pointer words that hold pointers ORed with type bits.  */
+# define POINTERS_MIGHT_HIDE_IN_OBJECTS 1
+#else
+  /* Marking via C pointers suffices, because Lisp_Objects contain pointer
+     words that hold unmodified pointers.  */
+# define POINTERS_MIGHT_HIDE_IN_OBJECTS 0
+#endif
+
 /* Mark Lisp objects referenced from the address range START+OFFSET..END
    or END+OFFSET..START. */
 
 static void
 mark_memory (void *start, void *end)
+#if defined (__clang__) && defined (__has_feature)
+#if __has_feature(address_sanitizer)
+  /* Do not allow -faddress-sanitizer to check this function, since it
+     crosses the function stack boundary, and thus would yield many
+     false positives. */
+  __attribute__((no_address_safety_analysis))
+#endif
+#endif
 {
-  Lisp_Object *p;
   void **pp;
   int i;
 
@@ -4284,11 +4614,6 @@ mark_memory (void *start, void *end)
       end = tem;
     }
 
-  /* Mark Lisp_Objects.  */
-  for (p = start; (void *) p < end; p++)
-    for (i = 0; i < sizeof *p; i += GC_LISP_OBJECT_ALIGNMENT)
-      mark_maybe_object (*(Lisp_Object *) ((char *) p + i));
-
   /* Mark Lisp data pointed to.  This is necessary because, in some
      situations, the C compiler optimizes Lisp objects away, so that
      only a pointer to them remains.  Example:
@@ -4310,17 +4635,10 @@ mark_memory (void *start, void *end)
   for (pp = start; (void *) pp < end; pp++)
     for (i = 0; i < sizeof *pp; i += GC_POINTER_ALIGNMENT)
       {
-       void *w = *(void **) ((char *) pp + i);
-       mark_maybe_pointer (w);
-
-#ifdef USE_LSB_TAG
-       /* A host where a Lisp_Object is wider than a pointer might
-          allocate a Lisp_Object in non-adjacent halves.  If
-          USE_LSB_TAG, the bottom half is not a valid pointer, so
-          widen it to to a Lisp_Object and check it that way.  */
-       if (sizeof w < sizeof (Lisp_Object))
-         mark_maybe_object (widen_to_Lisp_Object (w));
-#endif
+       void *p = *(void **) ((char *) pp + i);
+       mark_maybe_pointer (p);
+       if (POINTERS_MIGHT_HIDE_IN_OBJECTS)
+         mark_maybe_object (XIL ((intptr_t) p));
       }
 }
 
@@ -4662,6 +4980,7 @@ valid_lisp_object_p (Lisp_Object obj)
       return live_float_p (m, p);
 
     case MEM_TYPE_VECTORLIKE:
+    case MEM_TYPE_VECTOR_BLOCK:
       return live_vector_p (m, p);
 
     default:
@@ -4683,11 +5002,11 @@ valid_lisp_object_p (Lisp_Object obj)
    pointer to it.  TYPE is the Lisp type for which the memory is
    allocated.  TYPE < 0 means it's not used for a Lisp object.  */
 
-static POINTER_TYPE *
+static void *
 pure_alloc (size_t size, int type)
 {
-  POINTER_TYPE *result;
-#ifdef USE_LSB_TAG
+  void *result;
+#if USE_LSB_TAG
   size_t alignment = (1 << GCTYPEBITS);
 #else
   size_t alignment = sizeof (EMACS_INT);
@@ -4726,7 +5045,7 @@ pure_alloc (size_t size, int type)
   /* Don't allocate a large amount here,
      because it might get mmap'd and then its address
      might not be usable.  */
-  purebeg = (char *) xmalloc (10000);
+  purebeg = xmalloc (10000);
   pure_size = 10000;
   pure_bytes_used_before_overflow += pure_bytes_used - size;
   pure_bytes_used = 0;
@@ -4752,14 +5071,14 @@ check_pure_size (void)
    address.  Return NULL if not found.  */
 
 static char *
-find_string_data_in_pure (const char *data, EMACS_INT nbytes)
+find_string_data_in_pure (const char *data, ptrdiff_t nbytes)
 {
   int i;
-  EMACS_INT skip, bm_skip[256], last_char_skip, infinity, start, start_max;
+  ptrdiff_t skip, bm_skip[256], last_char_skip, infinity, start, start_max;
   const unsigned char *p;
   char *non_lisp_beg;
 
-  if (pure_bytes_used_non_lisp < nbytes + 1)
+  if (pure_bytes_used_non_lisp <= nbytes)
     return NULL;
 
   /* Set up the Boyer-Moore table.  */
@@ -4823,7 +5142,7 @@ find_string_data_in_pure (const char *data, EMACS_INT nbytes)
 
 Lisp_Object
 make_pure_string (const char *data,
-                 EMACS_INT nchars, EMACS_INT nbytes, int multibyte)
+                 ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte)
 {
   Lisp_Object string;
   struct Lisp_String *s;
@@ -4843,15 +5162,14 @@ make_pure_string (const char *data,
   return string;
 }
 
-/* Return a string a string allocated in pure space.  Do not allocate
-   the string data, just point to DATA.  */
+/* Return a string allocated in pure space.  Do not
+   allocate the string data, just point to DATA.  */
 
 Lisp_Object
-make_pure_c_string (const char *data)
+make_pure_c_string (const char *data, ptrdiff_t nchars)
 {
   Lisp_Object string;
   struct Lisp_String *s;
-  EMACS_INT nchars = strlen (data);
 
   s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String);
   s->size = nchars;
@@ -4897,8 +5215,8 @@ make_pure_float (double num)
 /* Return a vector with room for LEN Lisp_Objects allocated from
    pure space.  */
 
-Lisp_Object
-make_pure_vector (EMACS_INT len)
+static Lisp_Object
+make_pure_vector (ptrdiff_t len)
 {
   Lisp_Object new;
   struct Lisp_Vector *p;
@@ -4942,15 +5260,15 @@ Does not copy symbols.  Copies strings without text properties.  */)
   else if (COMPILEDP (obj) || VECTORP (obj))
     {
       register struct Lisp_Vector *vec;
-      register EMACS_INT i;
-      EMACS_INT size;
+      register ptrdiff_t i;
+      ptrdiff_t size;
 
       size = ASIZE (obj);
       if (size & PSEUDOVECTOR_FLAG)
        size &= PSEUDOVECTOR_SIZE_MASK;
       vec = XVECTOR (make_pure_vector (size));
       for (i = 0; i < size; i++)
-       vec->contents[i] = Fpurecopy (XVECTOR (obj)->contents[i]);
+       vec->contents[i] = Fpurecopy (AREF (obj, i));
       if (COMPILEDP (obj))
        {
          XSETPVECTYPE (vec, PVEC_COMPILED);
@@ -4995,10 +5313,10 @@ staticpro (Lisp_Object *varaddress)
 
 /* Temporarily prevent garbage collection.  */
 
-int
+ptrdiff_t
 inhibit_garbage_collection (void)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   specbind (Qgc_cons_threshold, make_number (MOST_POSITIVE_FIXNUM));
   return count;
@@ -5024,8 +5342,8 @@ See Info node `(elisp)Garbage Collection'.  */)
   ptrdiff_t i;
   int message_p;
   Lisp_Object total[8];
-  int count = SPECPDL_INDEX ();
-  EMACS_TIME t1, t2, t3;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  EMACS_TIME t1;
 
   if (abort_on_gc)
     abort ();
@@ -5048,7 +5366,8 @@ See Info node `(elisp)Garbage Collection'.  */)
           turned off in that buffer.  Calling truncate_undo_list on
           Qt tends to return NULL, which effectively turns undo back on.
           So don't call truncate_undo_list if undo_list is Qt.  */
-       if (! NILP (nextb->BUFFER_INTERNAL_FIELD (name)) && ! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
+       if (! NILP (nextb->BUFFER_INTERNAL_FIELD (name))
+           && ! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt))
          truncate_undo_list (nextb);
 
        /* Shrink buffer gaps, but skip indirect and dead buffers.  */
@@ -5073,7 +5392,7 @@ See Info node `(elisp)Garbage Collection'.  */)
       }
   }
 
-  EMACS_GET_TIME (t1);
+  t1 = current_emacs_time ();
 
   /* In case user calls debug_print during GC,
      don't let that cause a recursive GC.  */
@@ -5103,7 +5422,7 @@ See Info node `(elisp)Garbage Collection'.  */)
        {
          if (stack_copy_size < stack_size)
            {
-             stack_copy = (char *) xrealloc (stack_copy, stack_size);
+             stack_copy = xrealloc (stack_copy, stack_size);
              stack_copy_size = stack_size;
            }
          memcpy (stack_copy, stack, stack_size);
@@ -5319,18 +5638,20 @@ See Info node `(elisp)Garbage Collection'.  */)
 
   if (!NILP (Vpost_gc_hook))
     {
-      int gc_count = inhibit_garbage_collection ();
+      ptrdiff_t gc_count = inhibit_garbage_collection ();
       safe_run_hooks (Qpost_gc_hook);
       unbind_to (gc_count, Qnil);
     }
 
   /* Accumulate statistics.  */
-  EMACS_GET_TIME (t2);
-  EMACS_SUB_TIME (t3, t2, t1);
   if (FLOATP (Vgc_elapsed))
-    Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed) +
-                             EMACS_SECS (t3) +
-                             EMACS_USECS (t3) * 1.0e-6);
+    {
+      EMACS_TIME t2 = current_emacs_time ();
+      EMACS_TIME t3 = sub_emacs_time (t2, t1);
+      Vgc_elapsed = make_float (XFLOAT_DATA (Vgc_elapsed)
+                               + EMACS_TIME_TO_DOUBLE (t3));
+    }
+
   gcs_done++;
 
   return Flist (sizeof total / sizeof *total, total);
@@ -5404,19 +5725,19 @@ ptrdiff_t mark_object_loop_halt EXTERNALLY_VISIBLE;
 static void
 mark_vectorlike (struct Lisp_Vector *ptr)
 {
-  EMACS_INT size = ptr->header.size;
-  EMACS_INT i;
+  ptrdiff_t size = ptr->header.size;
+  ptrdiff_t i;
 
   eassert (!VECTOR_MARKED_P (ptr));
-  VECTOR_MARK (ptr);           /* Else mark it */
+  VECTOR_MARK (ptr);           /* Else mark it */
   if (size & PSEUDOVECTOR_FLAG)
     size &= PSEUDOVECTOR_SIZE_MASK;
 
   /* Note that this size is not the memory-footprint size, but only
      the number of Lisp_Object fields that we should trace.
      The distinction is used e.g. by Lisp_Process which places extra
-     non-Lisp_Object fields at the end of the structure.  */
-  for (i = 0; i < size; i++) /* and then mark its elements */
+     non-Lisp_Object fields at the end of the structure...  */
+  for (i = 0; i < size; i++) /* ...and then mark its elements.  */
     mark_object (ptr->contents[i]);
 }
 
@@ -5448,6 +5769,46 @@ mark_char_table (struct Lisp_Vector *ptr)
     }
 }
 
+/* Mark the chain of overlays starting at PTR.  */
+
+static void
+mark_overlay (struct Lisp_Overlay *ptr)
+{
+  for (; ptr && !ptr->gcmarkbit; ptr = ptr->next)
+    {
+      ptr->gcmarkbit = 1;
+      mark_object (ptr->start);
+      mark_object (ptr->end);
+      mark_object (ptr->plist);
+    }
+}
+
+/* Mark Lisp_Objects and special pointers in BUFFER.  */
+
+static void
+mark_buffer (struct buffer *buffer)
+{
+  /* This is handled much like other pseudovectors...  */
+  mark_vectorlike ((struct Lisp_Vector *) buffer);
+
+  /* ...but there are some buffer-specific things.  */
+
+  MARK_INTERVAL_TREE (BUF_INTERVALS (buffer));
+
+  /* For now, we just don't mark the undo_list.  It's done later in
+     a special way just before the sweep phase, and after stripping
+     some of its elements that are not needed any more.  */
+
+  mark_overlay (buffer->overlays_before);
+  mark_overlay (buffer->overlays_after);
+
+  /* If this is an indirect buffer, mark its base buffer.  */
+  if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer))
+    mark_buffer (buffer->base_buffer);
+}
+
+/* Determine type of generic Lisp_Object and mark it accordingly.  */
+
 void
 mark_object (Lisp_Object arg)
 {
@@ -5513,99 +5874,132 @@ mark_object (Lisp_Object arg)
        if (STRING_MARKED_P (ptr))
          break;
        CHECK_ALLOCATED_AND_LIVE (live_string_p);
-       MARK_INTERVAL_TREE (ptr->intervals);
        MARK_STRING (ptr);
+       MARK_INTERVAL_TREE (ptr->intervals);
 #ifdef GC_CHECK_STRING_BYTES
        /* Check that the string size recorded in the string is the
-          same as the one recorded in the sdata structure. */
+          same as the one recorded in the sdata structure.  */
        CHECK_STRING_BYTES (ptr);
 #endif /* GC_CHECK_STRING_BYTES */
       }
       break;
 
     case Lisp_Vectorlike:
-      if (VECTOR_MARKED_P (XVECTOR (obj)))
-       break;
+      {
+       register struct Lisp_Vector *ptr = XVECTOR (obj);
+       register ptrdiff_t pvectype;
+
+       if (VECTOR_MARKED_P (ptr))
+         break;
+
 #ifdef GC_CHECK_MARKED_OBJECTS
-      m = mem_find (po);
-      if (m == MEM_NIL && !SUBRP (obj)
-         && po != &buffer_defaults
-         && po != &buffer_local_symbols)
-       abort ();
+       m = mem_find (po);
+       if (m == MEM_NIL && !SUBRP (obj)
+           && po != &buffer_defaults
+           && po != &buffer_local_symbols)
+         abort ();
 #endif /* GC_CHECK_MARKED_OBJECTS */
 
-      if (BUFFERP (obj))
-       {
+       if (ptr->header.size & PSEUDOVECTOR_FLAG)
+         pvectype = ((ptr->header.size & PVEC_TYPE_MASK)
+                     >> PSEUDOVECTOR_SIZE_BITS);
+       else
+         pvectype = 0;
+
+       if (pvectype != PVEC_SUBR && pvectype != PVEC_BUFFER)
+         CHECK_LIVE (live_vector_p);
+
+       switch (pvectype)
+         {
+         case PVEC_BUFFER:
 #ifdef GC_CHECK_MARKED_OBJECTS
-         if (po != &buffer_defaults && po != &buffer_local_symbols)
+           if (po != &buffer_defaults && po != &buffer_local_symbols)
+             {
+               struct buffer *b = all_buffers;
+               for (; b && b != po; b = b->header.next.buffer)
+                 ;
+               if (b == NULL)
+                 abort ();
+             }
+#endif /* GC_CHECK_MARKED_OBJECTS */
+           mark_buffer ((struct buffer *) ptr);
+           break;
+
+         case PVEC_COMPILED:
+           { /* We could treat this just like a vector, but it is better
+                to save the COMPILED_CONSTANTS element for last and avoid
+                recursion there.  */
+             int size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
+             int i;
+
+             VECTOR_MARK (ptr);
+             for (i = 0; i < size; i++)
+               if (i != COMPILED_CONSTANTS)
+                 mark_object (ptr->contents[i]);
+             if (size > COMPILED_CONSTANTS)
+               {
+                 obj = ptr->contents[COMPILED_CONSTANTS];
+                 goto loop;
+               }
+           }
+           break;
+
+         case PVEC_FRAME:
            {
-             struct buffer *b;
-             for (b = all_buffers; b && b != po; b = b->header.next.buffer)
-               ;
-             if (b == NULL)
-               abort ();
+             mark_vectorlike (ptr);
+             mark_face_cache (((struct frame *) ptr)->face_cache);
            }
-#endif /* GC_CHECK_MARKED_OBJECTS */
-         mark_buffer (obj);
-       }
-      else if (SUBRP (obj))
-       break;
-      else if (COMPILEDP (obj))
-       /* We could treat this just like a vector, but it is better to
-          save the COMPILED_CONSTANTS element for last and avoid
-          recursion there.  */
-       {
-         register struct Lisp_Vector *ptr = XVECTOR (obj);
-         int size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
-         int i;
+           break;
 
-         CHECK_LIVE (live_vector_p);
-         VECTOR_MARK (ptr);    /* Else mark it */
-         for (i = 0; i < size; i++) /* and then mark its elements */
+         case PVEC_WINDOW:
            {
-             if (i != COMPILED_CONSTANTS)
-               mark_object (ptr->contents[i]);
+             struct window *w = (struct window *) ptr;
+
+             mark_vectorlike (ptr);
+             /* Mark glyphs for leaf windows.  Marking window
+                matrices is sufficient because frame matrices
+                use the same glyph memory.  */
+             if (NILP (w->hchild) && NILP (w->vchild) && w->current_matrix)
+               {
+                 mark_glyph_matrix (w->current_matrix);
+                 mark_glyph_matrix (w->desired_matrix);
+               }
            }
-         obj = ptr->contents[COMPILED_CONSTANTS];
-         goto loop;
-       }
-      else if (FRAMEP (obj))
-       {
-         register struct frame *ptr = XFRAME (obj);
-         mark_vectorlike (XVECTOR (obj));
-         mark_face_cache (ptr->face_cache);
-       }
-      else if (WINDOWP (obj))
-       {
-         register struct Lisp_Vector *ptr = XVECTOR (obj);
-         struct window *w = XWINDOW (obj);
-         mark_vectorlike (ptr);
-         /* Mark glyphs for leaf windows.  Marking window matrices is
-            sufficient because frame matrices use the same glyph
-            memory.  */
-         if (NILP (w->hchild)
-             && NILP (w->vchild)
-             && w->current_matrix)
+           break;
+
+         case PVEC_HASH_TABLE:
            {
-             mark_glyph_matrix (w->current_matrix);
-             mark_glyph_matrix (w->desired_matrix);
+             struct Lisp_Hash_Table *h = (struct Lisp_Hash_Table *) ptr;
+
+             mark_vectorlike (ptr);
+             /* If hash table is not weak, mark all keys and values.
+                For weak tables, mark only the vector.  */
+             if (NILP (h->weak))
+               mark_object (h->key_and_value);
+             else
+               VECTOR_MARK (XVECTOR (h->key_and_value));
            }
-       }
-      else if (HASH_TABLE_P (obj))
-       {
-         struct Lisp_Hash_Table *h = XHASH_TABLE (obj);
-         mark_vectorlike ((struct Lisp_Vector *)h);
-         /* If hash table is not weak, mark all keys and values.
-            For weak tables, mark only the vector.  */
-         if (NILP (h->weak))
-           mark_object (h->key_and_value);
-         else
-           VECTOR_MARK (XVECTOR (h->key_and_value));
-       }
-      else if (CHAR_TABLE_P (obj))
-       mark_char_table (XVECTOR (obj));
-      else
-       mark_vectorlike (XVECTOR (obj));
+           break;
+
+         case PVEC_CHAR_TABLE:
+           mark_char_table (ptr);
+           break;
+
+         case PVEC_BOOL_VECTOR:
+           /* No Lisp_Objects to mark in a bool vector.  */
+           VECTOR_MARK (ptr);
+           break;
+
+         case PVEC_SUBR:
+           break;
+
+         case PVEC_FREE:
+           abort ();
+
+         default:
+           mark_vectorlike (ptr);
+         }
+      }
       break;
 
     case Lisp_Symbol:
@@ -5656,7 +6050,7 @@ mark_object (Lisp_Object arg)
        ptr = ptr->next;
        if (ptr)
          {
-           ptrx = ptr;         /* Use of ptrx avoids compiler bug on Sun */
+           ptrx = ptr;         /* Use of ptrx avoids compiler bug on Sun */
            XSETSYMBOL (obj, ptrx);
            goto loop;
          }
@@ -5665,20 +6059,21 @@ mark_object (Lisp_Object arg)
 
     case Lisp_Misc:
       CHECK_ALLOCATED_AND_LIVE (live_misc_p);
+
       if (XMISCANY (obj)->gcmarkbit)
        break;
-      XMISCANY (obj)->gcmarkbit = 1;
 
       switch (XMISCTYPE (obj))
        {
-
        case Lisp_Misc_Marker:
          /* DO NOT mark thru the marker's chain.
             The buffer's markers chain does not preserve markers from gc;
             instead, markers are removed from the chain when freed by gc.  */
+         XMISCANY (obj)->gcmarkbit = 1;
          break;
 
        case Lisp_Misc_Save_Value:
+         XMISCANY (obj)->gcmarkbit = 1;
 #if GC_MARK_STACK
          {
            register struct Lisp_Save_Value *ptr = XSAVE_VALUE (obj);
@@ -5696,17 +6091,7 @@ mark_object (Lisp_Object arg)
          break;
 
        case Lisp_Misc_Overlay:
-         {
-           struct Lisp_Overlay *ptr = XOVERLAY (obj);
-           mark_object (ptr->start);
-           mark_object (ptr->end);
-           mark_object (ptr->plist);
-           if (ptr->next)
-             {
-               XSETMISC (obj, ptr->next);
-               goto loop;
-             }
-         }
+         mark_overlay (XOVERLAY (obj));
          break;
 
        default:
@@ -5752,54 +6137,8 @@ mark_object (Lisp_Object arg)
 #undef CHECK_ALLOCATED
 #undef CHECK_ALLOCATED_AND_LIVE
 }
-
-/* Mark the pointers in a buffer structure.  */
-
-static void
-mark_buffer (Lisp_Object buf)
-{
-  register struct buffer *buffer = XBUFFER (buf);
-  register Lisp_Object *ptr, tmp;
-  Lisp_Object base_buffer;
-
-  eassert (!VECTOR_MARKED_P (buffer));
-  VECTOR_MARK (buffer);
-
-  MARK_INTERVAL_TREE (BUF_INTERVALS (buffer));
-
-  /* For now, we just don't mark the undo_list.  It's done later in
-     a special way just before the sweep phase, and after stripping
-     some of its elements that are not needed any more.  */
-
-  if (buffer->overlays_before)
-    {
-      XSETMISC (tmp, buffer->overlays_before);
-      mark_object (tmp);
-    }
-  if (buffer->overlays_after)
-    {
-      XSETMISC (tmp, buffer->overlays_after);
-      mark_object (tmp);
-    }
-
-  /* buffer-local Lisp variables start at `undo_list',
-     tho only the ones from `name' on are GC'd normally.  */
-  for (ptr = &buffer->BUFFER_INTERNAL_FIELD (name);
-       ptr <= &PER_BUFFER_VALUE (buffer,
-                                PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER));
-       ptr++)
-    mark_object (*ptr);
-
-  /* If this is an indirect buffer, mark its base buffer.  */
-  if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer))
-    {
-      XSETBUFFER (base_buffer, buffer->base_buffer);
-      mark_buffer (base_buffer);
-    }
-}
-
 /* Mark the Lisp pointers in the terminal objects.
-   Called by the Fgarbage_collector.  */
+   Called by Fgarbage_collect.  */
 
 static void
 mark_terminals (void)
@@ -6067,22 +6406,22 @@ gc_sweep (void)
     for (sblk = symbol_block; sblk; sblk = *sprev)
       {
        int this_free = 0;
-       struct Lisp_Symbol *sym = sblk->symbols;
-       struct Lisp_Symbol *end = sym + lim;
+       union aligned_Lisp_Symbol *sym = sblk->symbols;
+       union aligned_Lisp_Symbol *end = sym + lim;
 
        for (; sym < end; ++sym)
          {
            /* Check if the symbol was created during loadup.  In such a case
               it might be pointed to by pure bytecode which we don't trace,
               so we conservatively assume that it is live.  */
-           int pure_p = PURE_POINTER_P (XSTRING (sym->xname));
+           int pure_p = PURE_POINTER_P (XSTRING (sym->s.xname));
 
-           if (!sym->gcmarkbit && !pure_p)
+           if (!sym->s.gcmarkbit && !pure_p)
              {
-               if (sym->redirect == SYMBOL_LOCALIZED)
-                 xfree (SYMBOL_BLV (sym));
-               sym->next = symbol_free_list;
-               symbol_free_list = sym;
+               if (sym->s.redirect == SYMBOL_LOCALIZED)
+                 xfree (SYMBOL_BLV (&sym->s));
+               sym->s.next = symbol_free_list;
+               symbol_free_list = &sym->s;
 #if GC_MARK_STACK
                symbol_free_list->function = Vdead;
 #endif
@@ -6092,8 +6431,8 @@ gc_sweep (void)
              {
                ++num_used;
                if (!pure_p)
-                 UNMARK_STRING (XSTRING (sym->xname));
-               sym->gcmarkbit = 0;
+                 UNMARK_STRING (XSTRING (sym->s.xname));
+               sym->s.gcmarkbit = 0;
              }
          }
 
@@ -6105,7 +6444,7 @@ gc_sweep (void)
          {
            *sprev = sblk->next;
            /* Unhook from the free list.  */
-           symbol_free_list = sblk->symbols[0].next;
+           symbol_free_list = sblk->symbols[0].s.next;
            lisp_free (sblk);
          }
        else
@@ -6135,22 +6474,22 @@ gc_sweep (void)
 
        for (i = 0; i < lim; i++)
          {
-           if (!mblk->markers[i].u_any.gcmarkbit)
+           if (!mblk->markers[i].m.u_any.gcmarkbit)
              {
-               if (mblk->markers[i].u_any.type == Lisp_Misc_Marker)
-                 unchain_marker (&mblk->markers[i].u_marker);
+               if (mblk->markers[i].m.u_any.type == Lisp_Misc_Marker)
+                 unchain_marker (&mblk->markers[i].m.u_marker);
                /* Set the type of the freed object to Lisp_Misc_Free.
                   We could leave the type alone, since nobody checks it,
                   but this might catch bugs faster.  */
-               mblk->markers[i].u_marker.type = Lisp_Misc_Free;
-               mblk->markers[i].u_free.chain = marker_free_list;
-               marker_free_list = &mblk->markers[i];
+               mblk->markers[i].m.u_marker.type = Lisp_Misc_Free;
+               mblk->markers[i].m.u_free.chain = marker_free_list;
+               marker_free_list = &mblk->markers[i].m;
                this_free++;
              }
            else
              {
                num_used++;
-               mblk->markers[i].u_any.gcmarkbit = 0;
+               mblk->markers[i].m.u_any.gcmarkbit = 0;
              }
          }
        lim = MARKER_BLOCK_SIZE;
@@ -6161,7 +6500,7 @@ gc_sweep (void)
          {
            *mprev = mblk->next;
            /* Unhook from the free list.  */
-           marker_free_list = mblk->markers[0].u_free.chain;
+           marker_free_list = mblk->markers[0].m.u_free.chain;
            lisp_free (mblk);
          }
        else
@@ -6198,33 +6537,7 @@ gc_sweep (void)
        }
   }
 
-  /* Free all unmarked vectors */
-  {
-    register struct Lisp_Vector *vector = all_vectors, *prev = 0, *next;
-    total_vector_size = 0;
-
-    while (vector)
-      if (!VECTOR_MARKED_P (vector))
-       {
-         if (prev)
-           prev->header.next = vector->header.next;
-         else
-           all_vectors = vector->header.next.vector;
-         next = vector->header.next.vector;
-         lisp_free (vector);
-         vector = next;
-
-       }
-      else
-       {
-         VECTOR_UNMARK (vector);
-         if (vector->header.size & PSEUDOVECTOR_FLAG)
-           total_vector_size += PSEUDOVECTOR_SIZE_MASK & vector->header.size;
-         else
-           total_vector_size += vector->header.size;
-         prev = vector, vector = vector->header.next.vector;
-       }
-  }
+  sweep_vectors ();
 
 #ifdef GC_CHECK_STRING_BYTES
   if (!noninteractive)
@@ -6250,6 +6563,36 @@ We divide the value by 1024 to make sure it fits in a Lisp integer.  */)
   return end;
 }
 
+DEFUN ("memory-free", Fmemory_free, Smemory_free, 0, 0, 0,
+       doc: /* Return a list of two counters that measure how much free memory
+is hold by the Emacs process.  Both counters are in KBytes.  First
+counter shows how much memory holds in a free lists maintained by
+the Emacs itself.  Second counter shows how much free memory is in
+the heap (freed by Emacs but not released back to the operating
+system).  If the second counter is zero, heap statistics is not
+available.  */)
+     (void)
+{
+  Lisp_Object data[2];
+  
+  data[0] = make_number
+    (min (MOST_POSITIVE_FIXNUM,
+         (total_free_conses * sizeof (struct Lisp_Cons)
+          + total_free_markers * sizeof (union Lisp_Misc)
+          + total_free_symbols * sizeof (struct Lisp_Symbol)
+          + total_free_floats * sizeof (struct Lisp_Float)
+          + total_free_intervals * sizeof (struct interval)
+          + total_free_strings * sizeof (struct Lisp_String)
+          + total_free_vector_bytes) / 1024));
+#ifdef DOUG_LEA_MALLOC
+  data[1] = make_number
+    (min (MOST_POSITIVE_FIXNUM, mallinfo ().fordblks / 1024));
+#else
+  data[1] = make_number (0);
+#endif
+  return Flist (2, data);
+}
+
 DEFUN ("memory-use-counts", Fmemory_use_counts, Smemory_use_counts, 0, 0, 0,
        doc: /* Return a list of counters that measure how much consing there has been.
 Each of these counters increments for a certain kind of object.
@@ -6286,18 +6629,19 @@ Lisp_Object
 which_symbols (Lisp_Object obj, EMACS_INT find_max)
 {
    struct symbol_block *sblk;
-   int gc_count = inhibit_garbage_collection ();
+   ptrdiff_t gc_count = inhibit_garbage_collection ();
    Lisp_Object found = Qnil;
 
    if (! DEADP (obj))
      {
        for (sblk = symbol_block; sblk; sblk = sblk->next)
         {
-          struct Lisp_Symbol *sym = sblk->symbols;
+          union aligned_Lisp_Symbol *aligned_sym = sblk->symbols;
           int bn;
 
-          for (bn = 0; bn < SYMBOL_BLOCK_SIZE; bn++, sym++)
+          for (bn = 0; bn < SYMBOL_BLOCK_SIZE; bn++, aligned_sym++)
             {
+              struct Lisp_Symbol *sym = &aligned_sym->s;
               Lisp_Object val;
               Lisp_Object tem;
 
@@ -6348,32 +6692,19 @@ init_alloc_once (void)
   /* Used to do Vpurify_flag = Qt here, but Qt isn't set up yet!  */
   purebeg = PUREBEG;
   pure_size = PURESIZE;
-  pure_bytes_used = 0;
-  pure_bytes_used_lisp = pure_bytes_used_non_lisp = 0;
-  pure_bytes_used_before_overflow = 0;
-
-  /* Initialize the list of free aligned blocks.  */
-  free_ablock = NULL;
 
 #if GC_MARK_STACK || defined GC_MALLOC_CHECK
   mem_init ();
   Vdead = make_pure_string ("DEAD", 4, 4, 0);
 #endif
 
-  all_vectors = 0;
-  ignore_warnings = 1;
 #ifdef DOUG_LEA_MALLOC
   mallopt (M_TRIM_THRESHOLD, 128*1024); /* trim threshold */
   mallopt (M_MMAP_THRESHOLD, 64*1024); /* mmap threshold */
   mallopt (M_MMAP_MAX, MMAP_MAX_AREAS); /* max. number of mmap'ed areas */
 #endif
   init_strings ();
-  init_cons ();
-  init_symbol ();
-  init_marker ();
-  init_float ();
-  init_intervals ();
-  init_weak_hash_tables ();
+  init_vectors ();
 
 #ifdef REL_ALLOC
   malloc_hysteresis = 32;
@@ -6382,14 +6713,7 @@ init_alloc_once (void)
 #endif
 
   refill_memory_reserve ();
-
-  ignore_warnings = 0;
-  gcprolist = 0;
-  byte_stack_list = 0;
-  staticidx = 0;
-  consing_since_gc = 0;
   gc_cons_threshold = 100000 * sizeof (Lisp_Object);
-  gc_relative_threshold = 0;
 }
 
 void
@@ -6410,7 +6734,7 @@ void
 syms_of_alloc (void)
 {
   DEFVAR_INT ("gc-cons-threshold", gc_cons_threshold,
-             doc: /* *Number of bytes of consing between garbage collections.
+             doc: /* Number of bytes of consing between garbage collections.
 Garbage collection can happen automatically once this many bytes have been
 allocated since the last garbage collection.  All data types count.
 
@@ -6421,7 +6745,7 @@ prevent garbage collection during a part of the program.
 See also `gc-cons-percentage'.  */);
 
   DEFVAR_LISP ("gc-cons-percentage", Vgc_cons_percentage,
-              doc: /* *Portion of the heap used for allocation.
+              doc: /* Portion of the heap used for allocation.
 Garbage collection can happen automatically once this portion of the heap
 has been allocated since the last garbage collection.
 If this portion is smaller than `gc-cons-threshold', this is ignored.  */);
@@ -6477,7 +6801,7 @@ do hash-consing of the objects allocated to pure space.  */);
      not be able to allocate the memory to hold it.  */
   Vmemory_signal_data
     = pure_cons (Qerror,
-                pure_cons (make_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"), Qnil));
+                pure_cons (build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"), Qnil));
 
   DEFVAR_LISP ("memory-full", Vmemory_full,
               doc: /* Non-nil means Emacs cannot get much more Lisp memory.  */);
@@ -6505,6 +6829,7 @@ The time is in seconds as a floating point value.  */);
   defsubr (&Spurecopy);
   defsubr (&Sgarbage_collect);
   defsubr (&Smemory_limit);
+  defsubr (&Smemory_free);
   defsubr (&Smemory_use_counts);
 
 #if GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES
index 48f22fe0e3e4ca82c3d71d6e0680c2959184d364..d67e1375f9a742a972ea4c2f7b60527576983c82 100644 (file)
@@ -27,10 +27,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "atimer.h"
 #include <unistd.h>
 
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
 /* Free-list of atimer structures.  */
 
 static struct atimer *free_atimers;
@@ -94,11 +90,9 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
   /* Round TIME up to the next full second if we don't have
      itimers.  */
 #ifndef HAVE_SETITIMER
-  if (EMACS_USECS (timestamp) != 0)
-    {
-      EMACS_SET_USECS (timestamp, 0);
-      EMACS_SET_SECS (timestamp, EMACS_SECS (timestamp) + 1);
-    }
+  if (EMACS_NSECS (timestamp) != 0
+      && EMACS_SECS (timestamp) < TYPE_MAXIMUM (time_t))
+    timestamp = make_emacs_time (EMACS_SECS (timestamp) + 1, 0);
 #endif /* not HAVE_SETITIMER */
 
   /* Get an atimer structure from the free-list, or allocate
@@ -109,7 +103,7 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
       free_atimers = t->next;
     }
   else
-    t = (struct atimer *) xmalloc (sizeof *t);
+    t = xmalloc (sizeof *t);
 
   /* Fill the atimer structure.  */
   memset (t, 0, sizeof *t);
@@ -127,13 +121,11 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
       break;
 
     case ATIMER_RELATIVE:
-      EMACS_GET_TIME (t->expiration);
-      EMACS_ADD_TIME (t->expiration, t->expiration, timestamp);
+      t->expiration = add_emacs_time (current_emacs_time (), timestamp);
       break;
 
     case ATIMER_CONTINUOUS:
-      EMACS_GET_TIME (t->expiration);
-      EMACS_ADD_TIME (t->expiration, t->expiration, timestamp);
+      t->expiration = add_emacs_time (current_emacs_time (), timestamp);
       t->interval = timestamp;
       break;
     }
@@ -287,28 +279,25 @@ set_alarm (void)
 {
   if (atimers)
     {
-      EMACS_TIME now, timestamp;
 #ifdef HAVE_SETITIMER
       struct itimerval it;
 #endif
 
       /* Determine s/us till the next timer is ripe.  */
-      EMACS_GET_TIME (now);
-      EMACS_SUB_TIME (timestamp, atimers->expiration, now);
+      EMACS_TIME now = current_emacs_time ();
 
-#ifdef HAVE_SETITIMER
       /* Don't set the interval to 0; this disables the timer.  */
-      if (EMACS_TIME_LE (atimers->expiration, now))
-       {
-         EMACS_SET_SECS (timestamp, 0);
-         EMACS_SET_USECS (timestamp, 1000);
-       }
+      EMACS_TIME interval = (EMACS_TIME_LE (atimers->expiration, now)
+                            ? make_emacs_time (0, 1000 * 1000)
+                            : sub_emacs_time (atimers->expiration, now));
+
+#ifdef HAVE_SETITIMER
 
       memset (&it, 0, sizeof it);
-      it.it_value = timestamp;
+      it.it_value = make_timeval (interval);
       setitimer (ITIMER_REAL, &it, 0);
 #else /* not HAVE_SETITIMER */
-      alarm (max (EMACS_SECS (timestamp), 1));
+      alarm (max (EMACS_SECS (interval), 1));
 #endif /* not HAVE_SETITIMER */
     }
 }
@@ -341,11 +330,10 @@ run_timers (void)
 {
   EMACS_TIME now;
 
-  EMACS_GET_TIME (now);
-
   while (atimers
         && (pending_atimers = interrupt_input_blocked) == 0
-        && EMACS_TIME_LE (atimers->expiration, now))
+        && (now = current_emacs_time (),
+            EMACS_TIME_LE (atimers->expiration, now)))
     {
       struct atimer *t;
 
@@ -355,7 +343,7 @@ run_timers (void)
 
       if (t->type == ATIMER_CONTINUOUS)
        {
-         EMACS_ADD_TIME (t->expiration, now, t->interval);
+         t->expiration = add_emacs_time (now, t->interval);
          schedule_atimer (t);
        }
       else
@@ -363,8 +351,6 @@ run_timers (void)
          t->next = free_atimers;
          free_atimers = t;
        }
-
-      EMACS_GET_TIME (now);
     }
 
   if (! atimers)
index b3479b17b168a3177f599d77b7c15cab7bcfab48..4df585d4f48db5327109d7de5af3d149b7e00bfd 100644 (file)
@@ -59,8 +59,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "dispextern.h"
 
 static int bidi_initialized = 0;
@@ -149,7 +149,7 @@ bidi_get_type (int ch, bidi_dir_t override)
 static inline void
 bidi_check_type (bidi_type_t type)
 {
-  xassert (UNKNOWN_BT <= type && type <= NEUTRAL_ON);
+  eassert (UNKNOWN_BT <= type && type <= NEUTRAL_ON);
 }
 
 /* Given a bidi TYPE of a character, return its category.  */
@@ -204,8 +204,16 @@ bidi_mirror_char (int c)
   val = CHAR_TABLE_REF (bidi_mirror_table, c);
   if (INTEGERP (val))
     {
-      int v = XINT (val);
+      int v;
+
+      /* When debugging, check before assigning to V, so that the check
+        isn't broken by undefined behavior due to int overflow.  */
+      eassert (CHAR_VALID_P (XINT (val)));
 
+      v = XINT (val);
+
+      /* Minimal test we must do in optimized builds, to prevent weird
+        crashes further down the road.  */
       if (v < 0 || v > MAX_CHAR)
        abort ();
 
@@ -255,7 +263,7 @@ bidi_push_embedding_level (struct bidi_it *bidi_it,
                           int level, bidi_dir_t override)
 {
   bidi_it->stack_idx++;
-  xassert (bidi_it->stack_idx < BIDI_MAXLEVEL);
+  eassert (bidi_it->stack_idx < BIDI_MAXLEVEL);
   bidi_it->level_stack[bidi_it->stack_idx].level = level;
   bidi_it->level_stack[bidi_it->stack_idx].override = override;
 }
@@ -353,8 +361,7 @@ bidi_cache_shrink (void)
 {
   if (bidi_cache_size > BIDI_CACHE_CHUNK)
     {
-      bidi_cache
-       = (struct bidi_it *) xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz);
+      bidi_cache = xrealloc (bidi_cache, BIDI_CACHE_CHUNK * elsz);
       bidi_cache_size = BIDI_CACHE_CHUNK;
     }
   bidi_cache_reset ();
@@ -378,7 +385,7 @@ bidi_cache_fetch_state (ptrdiff_t idx, struct bidi_it *bidi_it)
    resolved levels in cached states.  DIR, if non-zero, means search
    in that direction from the last cache hit.  */
 static inline ptrdiff_t
-bidi_cache_search (EMACS_INT charpos, int level, int dir)
+bidi_cache_search (ptrdiff_t charpos, int level, int dir)
 {
   ptrdiff_t i, i_start;
 
@@ -450,7 +457,7 @@ bidi_cache_find_level_change (int level, int dir, int before)
       ptrdiff_t i = dir ? bidi_cache_last_idx : bidi_cache_idx - 1;
       int incr = before ? 1 : 0;
 
-      xassert (!dir || bidi_cache_last_idx >= 0);
+      eassert (!dir || bidi_cache_last_idx >= 0);
 
       if (!dir)
        dir = -1;
@@ -562,7 +569,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
 }
 
 static inline bidi_type_t
-bidi_cache_find (EMACS_INT charpos, int level, struct bidi_it *bidi_it)
+bidi_cache_find (ptrdiff_t charpos, int level, struct bidi_it *bidi_it)
 {
   ptrdiff_t i = bidi_cache_search (charpos, level, bidi_it->scan_dir);
 
@@ -608,7 +615,7 @@ bidi_push_it (struct bidi_it *bidi_it)
   memcpy (&bidi_cache[bidi_cache_idx++], bidi_it, sizeof (struct bidi_it));
 
   /* Push the current cache start onto the stack.  */
-  xassert (bidi_cache_sp < IT_STACK_SIZE);
+  eassert (bidi_cache_sp < IT_STACK_SIZE);
   bidi_cache_start_stack[bidi_cache_sp++] = bidi_cache_start;
 
   /* Start a new level of cache, and make it empty.  */
@@ -795,7 +802,7 @@ bidi_set_paragraph_end (struct bidi_it *bidi_it)
 
 /* Initialize the bidi iterator from buffer/string position CHARPOS.  */
 void
-bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, int frame_window_p,
+bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, int frame_window_p,
              struct bidi_it *bidi_it)
 {
   if (! bidi_initialized)
@@ -867,11 +874,11 @@ bidi_line_init (struct bidi_it *bidi_it)
    are zero-based character positions in S, BEGBYTE is byte position
    corresponding to BEG.  UNIBYTE, if non-zero, means S is a unibyte
    string.  */
-static inline EMACS_INT
-bidi_count_bytes (const unsigned char *s, const EMACS_INT beg,
-                 const EMACS_INT begbyte, const EMACS_INT end, int unibyte)
+static inline ptrdiff_t
+bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
+                 const ptrdiff_t begbyte, const ptrdiff_t end, int unibyte)
 {
-  EMACS_INT pos = beg;
+  ptrdiff_t pos = beg;
   const unsigned char *p = s + begbyte, *start = p;
 
   if (unibyte)
@@ -896,7 +903,7 @@ bidi_count_bytes (const unsigned char *s, const EMACS_INT beg,
    character from the current buffer.  UNIBYTE non-zero means S is a
    unibyte string.  */
 static inline int
-bidi_char_at_pos (EMACS_INT bytepos, const unsigned char *s, int unibyte)
+bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte)
 {
   if (s)
     {
@@ -924,12 +931,12 @@ bidi_char_at_pos (EMACS_INT bytepos, const unsigned char *s, int unibyte)
    string to iterate, or NULL if iterating over a buffer or a Lisp
    string; in the latter case, STRING->lstring is the Lisp string.  */
 static inline int
-bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
+bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
                 int *disp_prop, struct bidi_string_data *string,
-                int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars)
+                int frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
 {
   int ch;
-  EMACS_INT endpos
+  ptrdiff_t endpos
     = (string->s || STRINGP (string->lstring)) ? string->schars : ZV;
   struct text_pos pos;
   int len;
@@ -954,7 +961,7 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
     }
   else if (charpos >= *disp_pos && *disp_prop)
     {
-      EMACS_INT disp_end_pos;
+      ptrdiff_t disp_end_pos;
 
       /* We don't expect to find ourselves in the middle of a display
         property.  Hopefully, it will never be needed.  */
@@ -1061,12 +1068,12 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos,
    following the buffer position, -1 if position is at the beginning
    of a new paragraph, or -2 if position is neither at beginning nor
    at end of a paragraph.  */
-static EMACS_INT
-bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos)
+static ptrdiff_t
+bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   Lisp_Object sep_re;
   Lisp_Object start_re;
-  EMACS_INT val;
+  ptrdiff_t val;
 
   sep_re = paragraph_separate_re;
   start_re = paragraph_start_re;
@@ -1093,12 +1100,12 @@ bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos)
    Value is the byte position of the paragraph's beginning, or
    BEGV_BYTE if paragraph_start_re is still not found after looking
    back MAX_PARAGRAPH_SEARCH lines in the buffer.  */
-static EMACS_INT
-bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
+static ptrdiff_t
+bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
 {
   Lisp_Object re = paragraph_start_re;
-  EMACS_INT limit = ZV, limit_byte = ZV_BYTE;
-  EMACS_INT n = 0;
+  ptrdiff_t limit = ZV, limit_byte = ZV_BYTE;
+  ptrdiff_t n = 0;
 
   while (pos_byte > BEGV_BYTE
         && n++ < MAX_PARAGRAPH_SEARCH
@@ -1116,6 +1123,12 @@ bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
   return pos_byte;
 }
 
+/* On a 3.4 GHz machine, searching forward for a strong directional
+   character in a long paragraph full of weaks or neutrals takes about
+   1 ms for each 20K characters.  The number below limits each call to
+   bidi_paragraph_init to less than 10 ms even on slow machines.  */
+#define MAX_STRONG_CHAR_SEARCH 100000
+
 /* Determine the base direction, a.k.a. base embedding level, of the
    paragraph we are about to iterate through.  If DIR is either L2R or
    R2L, just use that.  Otherwise, determine the paragraph direction
@@ -1134,14 +1147,14 @@ bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte)
 void
 bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
 {
-  EMACS_INT bytepos = bidi_it->bytepos;
+  ptrdiff_t bytepos = bidi_it->bytepos;
   int string_p = bidi_it->string.s != NULL || STRINGP (bidi_it->string.lstring);
-  EMACS_INT pstartbyte;
+  ptrdiff_t pstartbyte;
   /* Note that begbyte is a byte position, while end is a character
      position.  Yes, this is ugly, but we are trying to avoid costly
      calls to BYTE_TO_CHAR and its ilk.  */
-  EMACS_INT begbyte = string_p ? 0 : BEGV_BYTE;
-  EMACS_INT end = string_p ? bidi_it->string.schars : ZV;
+  ptrdiff_t begbyte = string_p ? 0 : BEGV_BYTE;
+  ptrdiff_t end = string_p ? bidi_it->string.schars : ZV;
 
   /* Special case for an empty buffer. */
   if (bytepos == begbyte && bidi_it->charpos == end)
@@ -1163,8 +1176,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
   else if (dir == NEUTRAL_DIR) /* P2 */
     {
       int ch;
-      EMACS_INT ch_len, nchars;
-      EMACS_INT pos, disp_pos = -1;
+      ptrdiff_t ch_len, nchars;
+      ptrdiff_t pos, disp_pos = -1;
       int disp_prop = 0;
       bidi_type_t type;
       const unsigned char *s;
@@ -1211,6 +1224,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
       /* The following loop is run more than once only if NO_DEFAULT_P
         is non-zero, and only if we are iterating on a buffer.  */
       do {
+       ptrdiff_t pos1;
+
        bytepos = pstartbyte;
        if (!string_p)
          pos = BYTE_TO_CHAR (bytepos);
@@ -1219,11 +1234,15 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
                              bidi_it->frame_window_p, &ch_len, &nchars);
        type = bidi_get_type (ch, NEUTRAL_DIR);
 
+       pos1 = pos;
        for (pos += nchars, bytepos += ch_len;
-            (bidi_get_category (type) != STRONG)
-              || (bidi_ignore_explicit_marks_for_paragraph_level
-                  && (type == RLE || type == RLO
-                      || type == LRE || type == LRO));
+            ((bidi_get_category (type) != STRONG)
+             || (bidi_ignore_explicit_marks_for_paragraph_level
+                 && (type == RLE || type == RLO
+                     || type == LRE || type == LRO)))
+              /* Stop when searched too far into an abnormally large
+                 paragraph full of weak or neutral characters.  */
+              && pos - pos1 < MAX_STRONG_CHAR_SEARCH;
             type = bidi_get_type (ch, NEUTRAL_DIR))
          {
            if (pos >= end)
@@ -1260,8 +1279,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
              bidi_it->paragraph_dir = L2R; /* P3 and HL1 */
            else
              {
-               EMACS_INT prevpbyte = pstartbyte;
-               EMACS_INT p = BYTE_TO_CHAR (pstartbyte), pbyte = pstartbyte;
+               ptrdiff_t prevpbyte = pstartbyte;
+               ptrdiff_t p = BYTE_TO_CHAR (pstartbyte), pbyte = pstartbyte;
 
                /* Find the beginning of the previous paragraph, if any.  */
                while (pbyte > BEGV_BYTE && prevpbyte >= pstartbyte)
@@ -1525,7 +1544,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it)
 {
   int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level;
   int new_level  = bidi_resolve_explicit_1 (bidi_it);
-  EMACS_INT eob = bidi_it->string.s ? bidi_it->string.schars : ZV;
+  ptrdiff_t eob = bidi_it->string.s ? bidi_it->string.schars : ZV;
   const unsigned char *s
     = (STRINGP (bidi_it->string.lstring)
        ? SDATA (bidi_it->string.lstring)
@@ -1613,7 +1632,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
   int next_char;
   bidi_type_t type_of_next;
   struct bidi_it saved_it;
-  EMACS_INT eob
+  ptrdiff_t eob
     = ((STRINGP (bidi_it->string.lstring) || bidi_it->string.s)
        ? bidi_it->string.schars : ZV);
 
@@ -1743,7 +1762,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
            }
          else if (bidi_it->next_en_pos >=0)
            {
-             EMACS_INT en_pos = bidi_it->charpos + bidi_it->nchars;
+             ptrdiff_t en_pos = bidi_it->charpos + bidi_it->nchars;
              const unsigned char *s = (STRINGP (bidi_it->string.lstring)
                                        ? SDATA (bidi_it->string.lstring)
                                        : bidi_it->string.s);
@@ -1950,7 +1969,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
              case STRONG_AL:
                /* Actually, STRONG_AL cannot happen here, because
                   bidi_resolve_weak converts it to STRONG_R, per W3.  */
-               xassert (type != STRONG_AL);
+               eassert (type != STRONG_AL);
                next_type = type;
                break;
              case WEAK_EN:
@@ -2030,11 +2049,11 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
   bidi_type_t type;
   int level, prev_level = -1;
   struct bidi_saved_info next_for_neutral;
-  EMACS_INT next_char_pos = -2;
+  ptrdiff_t next_char_pos = -2;
 
   if (bidi_it->scan_dir == 1)
     {
-      EMACS_INT eob
+      ptrdiff_t eob
        = ((bidi_it->string.s || STRINGP (bidi_it->string.lstring))
           ? bidi_it->string.schars : ZV);
 
@@ -2163,11 +2182,11 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
       && bidi_it->next_for_ws.type == UNKNOWN_BT)
     {
       int ch;
-      EMACS_INT clen = bidi_it->ch_len;
-      EMACS_INT bpos = bidi_it->bytepos;
-      EMACS_INT cpos = bidi_it->charpos;
-      EMACS_INT disp_pos = bidi_it->disp_pos;
-      EMACS_INT nc = bidi_it->nchars;
+      ptrdiff_t clen = bidi_it->ch_len;
+      ptrdiff_t bpos = bidi_it->bytepos;
+      ptrdiff_t cpos = bidi_it->charpos;
+      ptrdiff_t disp_pos = bidi_it->disp_pos;
+      ptrdiff_t nc = bidi_it->nchars;
       struct bidi_string_data bs = bidi_it->string;
       bidi_type_t chtype;
       int fwp = bidi_it->frame_window_p;
@@ -2409,7 +2428,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
        bidi_it->separator_limit = bidi_it->string.schars;
       else if (bidi_it->bytepos < ZV_BYTE)
        {
-         EMACS_INT sep_len
+         ptrdiff_t sep_len
            = bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars,
                                     bidi_it->bytepos + bidi_it->ch_len);
          if (bidi_it->nchars <= 0)
@@ -2475,6 +2494,6 @@ bidi_dump_cached_states (void)
   fputs ("\n", stderr);
   fputs ("pos ", stderr);
   for (i = 0; i < bidi_cache_idx; i++)
-    fprintf (stderr, "%*"pI"d", ndigits, bidi_cache[i].charpos);
+    fprintf (stderr, "%*"pD"d", ndigits, bidi_cache[i].charpos);
   fputs ("\n", stderr);
 }
index 88ef34070ea659628e0a8ec2fd1aadb3ef0b1be7..1e1bd933f9302293a780c0047bc700bd8b09a5ed 100644 (file)
@@ -33,8 +33,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "intervals.h"
 #include "window.h"
 #include "commands.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "region-cache.h"
 #include "indent.h"
 #include "blockinput.h"
@@ -107,8 +107,6 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
 
 int last_per_buffer_idx;
 
-static Lisp_Object Fset_buffer_major_mode (Lisp_Object);
-static Lisp_Object Fdelete_overlay (Lisp_Object);
 static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
                                     int after, Lisp_Object arg1,
                                     Lisp_Object arg2, Lisp_Object arg3);
@@ -128,7 +126,6 @@ static Lisp_Object Qchange_major_mode_hook;
 Lisp_Object Qfirst_change_hook;
 Lisp_Object Qbefore_change_functions;
 Lisp_Object Qafter_change_functions;
-static Lisp_Object Qucs_set_table_for_input;
 
 static Lisp_Object Qfundamental_mode, Qmode_class, Qpermanent_local;
 static Lisp_Object Qpermanent_local_hook;
@@ -155,7 +152,7 @@ Lisp_Object Qinsert_behind_hooks;
 static void alloc_buffer_text (struct buffer *, ptrdiff_t);
 static void free_buffer_text (struct buffer *b);
 static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *);
-static void modify_overlay (struct buffer *, EMACS_INT, EMACS_INT);
+static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
 static Lisp_Object buffer_lisp_local_variables (struct buffer *, int);
 
 /* For debugging; temporary.  See set_buffer_internal.  */
@@ -393,7 +390,6 @@ even if it is dead.  The return value is never nil.  */)
 
   BVAR (b, mark) = Fmake_marker ();
   BUF_MARKERS (b) = NULL;
-  BVAR (b, name) = name;
 
   /* Put this in the alist of all live buffers.  */
   XSETBUFFER (buffer, b);
@@ -402,13 +398,6 @@ even if it is dead.  The return value is never nil.  */)
   if (!NILP (Vrun_hooks))
     call1 (Vrun_hooks, Qbuffer_list_update_hook);
 
-  /* An error in calling the function here (should someone redefine it)
-     can lead to infinite regress until you run out of stack.  rms
-     says that's not worth protecting against.  */
-  if (!NILP (Ffboundp (Qucs_set_table_for_input)))
-    /* buffer is on buffer-alist, so no gcpro.  */
-    call1 (Qucs_set_table_for_input, buffer);
-
   return buffer;
 }
 
@@ -427,7 +416,7 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
   for (; list; list = list->next)
     {
       Lisp_Object overlay, start, end, old_overlay;
-      EMACS_INT charpos;
+      ptrdiff_t charpos;
 
       XSETMISC (old_overlay, list);
       charpos = marker_position (OVERLAY_START (old_overlay));
@@ -469,16 +458,9 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list)
 static void
 clone_per_buffer_values (struct buffer *from, struct buffer *to)
 {
-  Lisp_Object to_buffer;
   int offset;
 
-  XSETBUFFER (to_buffer, to);
-
-  /* buffer-local Lisp variables start at `undo_list',
-     tho only the ones from `name' on are GC'd normally.  */
-  for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
-       offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
-       offset += sizeof (Lisp_Object))
+  for_each_per_buffer_object_at (offset)
     {
       Lisp_Object obj;
 
@@ -490,9 +472,9 @@ clone_per_buffer_values (struct buffer *from, struct buffer *to)
       if (MARKERP (obj) && XMARKER (obj)->buffer == from)
        {
          struct Lisp_Marker *m = XMARKER (obj);
-         obj = Fmake_marker ();
+
+         obj = build_marker (to, m->charpos, m->bytepos);
          XMARKER (obj)->insertion_type = m->insertion_type;
-         set_marker_both (obj, to_buffer, m->charpos, m->bytepos);
        }
 
       PER_BUFFER_VALUE (to, offset) = obj;
@@ -620,7 +602,6 @@ CLONE nil means the indirect buffer's state is reset to default values.  */)
   Vbuffer_alist = nconc2 (Vbuffer_alist, Fcons (Fcons (name, buf), Qnil));
 
   BVAR (b, mark) = Fmake_marker ();
-  BVAR (b, name) = name;
 
   /* The multibyte status belongs to the base buffer.  */
   BVAR (b, enable_multibyte_characters) = BVAR (b->base_buffer, enable_multibyte_characters);
@@ -631,32 +612,24 @@ CLONE nil means the indirect buffer's state is reset to default values.  */)
       eassert (NILP (BVAR (b->base_buffer, begv_marker)));
       eassert (NILP (BVAR (b->base_buffer, zv_marker)));
 
-      BVAR (b->base_buffer, pt_marker) = Fmake_marker ();
-      set_marker_both (BVAR (b->base_buffer, pt_marker), base_buffer,
-                      b->base_buffer->pt,
-                      b->base_buffer->pt_byte);
+      BVAR (b->base_buffer, pt_marker) 
+       = build_marker (b->base_buffer, b->base_buffer->pt, b->base_buffer->pt_byte);
 
-      BVAR (b->base_buffer, begv_marker) = Fmake_marker ();
-      set_marker_both (BVAR (b->base_buffer, begv_marker), base_buffer,
-                      b->base_buffer->begv,
-                      b->base_buffer->begv_byte);
+      BVAR (b->base_buffer, begv_marker)
+       = build_marker (b->base_buffer, b->base_buffer->begv, b->base_buffer->begv_byte);
+
+      BVAR (b->base_buffer, zv_marker)
+       = build_marker (b->base_buffer, b->base_buffer->zv, b->base_buffer->zv_byte);
 
-      BVAR (b->base_buffer, zv_marker) = Fmake_marker ();
-      set_marker_both (BVAR (b->base_buffer, zv_marker), base_buffer,
-                      b->base_buffer->zv,
-                      b->base_buffer->zv_byte);
       XMARKER (BVAR (b->base_buffer, zv_marker))->insertion_type = 1;
     }
 
   if (NILP (clone))
     {
       /* Give the indirect buffer markers for its narrowing.  */
-      BVAR (b, pt_marker) = Fmake_marker ();
-      set_marker_both (BVAR (b, pt_marker), buf, b->pt, b->pt_byte);
-      BVAR (b, begv_marker) = Fmake_marker ();
-      set_marker_both (BVAR (b, begv_marker), buf, b->begv, b->begv_byte);
-      BVAR (b, zv_marker) = Fmake_marker ();
-      set_marker_both (BVAR (b, zv_marker), buf, b->zv, b->zv_byte);
+      BVAR (b, pt_marker) = build_marker (b, b->pt, b->pt_byte);
+      BVAR (b, begv_marker) = build_marker (b, b->begv, b->begv_byte);
+      BVAR (b, zv_marker) = build_marker (b, b->zv, b->zv_byte);
       XMARKER (BVAR (b, zv_marker))->insertion_type = 1;
     }
   else
@@ -683,27 +656,40 @@ CLONE nil means the indirect buffer's state is reset to default values.  */)
   return buf;
 }
 
+/* Mark OV as no longer associated with B.  */
+
+static void
+drop_overlay (struct buffer *b, struct Lisp_Overlay *ov)
+{
+  eassert (b == XBUFFER (Fmarker_buffer (ov->start)));
+  modify_overlay (b, marker_position (ov->start), marker_position (ov->end));
+  Fset_marker (ov->start, Qnil, Qnil);
+  Fset_marker (ov->end, Qnil, Qnil);
+
+}
+
+/* Delete all overlays of B and reset it's overlay lists.  */
+
 void
 delete_all_overlays (struct buffer *b)
 {
-  Lisp_Object overlay;
+  struct Lisp_Overlay *ov, *next;
 
-  /* `reset_buffer' blindly sets the list of overlays to NULL, so we
-     have to empty the list, otherwise we end up with overlays that
-     think they belong to this buffer while the buffer doesn't know about
-     them any more.  */
-  while (b->overlays_before)
+  for (ov = b->overlays_before; ov; ov = next)
     {
-      XSETMISC (overlay, b->overlays_before);
-      Fdelete_overlay (overlay);
+      drop_overlay (b, ov);
+      next = ov->next;
+      ov->next = NULL;
     }
-  while (b->overlays_after)
+
+  for (ov = b->overlays_after; ov; ov = next)
     {
-      XSETMISC (overlay, b->overlays_after);
-      Fdelete_overlay (overlay);
+      drop_overlay (b, ov);
+      next = ov->next;
+      ov->next = NULL;
     }
-  eassert (b->overlays_before == NULL);
-  eassert (b->overlays_after == NULL);
+
+  b->overlays_before = b->overlays_after = NULL;
 }
 
 /* Reinitialize everything about a buffer except its name and contents
@@ -719,7 +705,7 @@ reset_buffer (register struct buffer *b)
   BVAR (b, filename) = Qnil;
   BVAR (b, file_truename) = Qnil;
   BVAR (b, directory) = (current_buffer) ? BVAR (current_buffer, directory) : Qnil;
-  b->modtime = 0;
+  b->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS);
   b->modtime_size = -1;
   XSETFASTINT (BVAR (b, save_length), 0);
   b->last_window_start = 1;
@@ -830,14 +816,8 @@ reset_buffer_local_variables (register struct buffer *b, int permanent_too)
     if (permanent_too || buffer_permanent_local_flags[i] == 0)
       SET_PER_BUFFER_VALUE_P (b, i, 0);
 
-  /* For each slot that has a default value,
-     copy that into the slot.  */
-
-  /* buffer-local Lisp variables start at `undo_list',
-     tho only the ones from `name' on are GC'd normally.  */
-  for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
-       offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
-       offset += sizeof (Lisp_Object))
+  /* For each slot that has a default value, copy that into the slot.  */
+  for_each_per_buffer_object_at (offset)
     {
       int idx = PER_BUFFER_IDX (offset);
       if ((idx > 0
@@ -858,12 +838,16 @@ If there is no live buffer named NAME, then return NAME.
 Otherwise modify name by appending `<NUMBER>', incrementing NUMBER
 \(starting at 2) until an unused name is found, and then return that name.
 Optional second argument IGNORE specifies a name that is okay to use (if
-it is in the sequence to be tried) even if a buffer with that name exists.  */)
+it is in the sequence to be tried) even if a buffer with that name exists.
+
+If NAME begins with a space (i.e., a buffer that is not normally
+visible to users), then if buffer NAME already exists a random number
+is first appended to NAME, to speed up finding a non-existent buffer.  */)
   (register Lisp_Object name, Lisp_Object ignore)
 {
-  register Lisp_Object gentemp, tem;
-  EMACS_INT count;
-  char number[INT_BUFSIZE_BOUND (EMACS_INT) + sizeof "<>"];
+  register Lisp_Object gentemp, tem, tem2;
+  ptrdiff_t count;
+  char number[INT_BUFSIZE_BOUND (ptrdiff_t) + sizeof "<>"];
 
   CHECK_STRING (name);
 
@@ -874,11 +858,24 @@ it is in the sequence to be tried) even if a buffer with that name exists.  */)
   if (NILP (tem))
     return name;
 
+  if (!strncmp (SSDATA (name), " ", 1)) /* see bug#1229 */
+    {
+      /* Note fileio.c:make_temp_name does random differently.  */
+      tem2 = concat2 (name, make_formatted_string
+                     (number, "-%"pI"d", 
+                      XFASTINT (Frandom (make_number (999999)))));
+      tem = Fget_buffer (tem2);
+      if (NILP (tem))
+       return tem2;
+    }
+  else
+    tem2 = name;
+
   count = 1;
   while (1)
     {
-      sprintf (number, "<%"pI"d>", ++count);
-      gentemp = concat2 (name, build_string (number));
+      gentemp = concat2 (tem2, make_formatted_string
+                        (number, "<%"pD"d>", ++count));
       tem = Fstring_equal (gentemp, ignore);
       if (!NILP (tem))
        return gentemp;
@@ -942,6 +939,21 @@ DEFUN ("buffer-local-value", Fbuffer_local_value,
 If VARIABLE does not have a buffer-local binding in BUFFER, the value
 is the default binding of the variable. */)
   (register Lisp_Object variable, register Lisp_Object buffer)
+{
+  register Lisp_Object result = buffer_local_value_1 (variable, buffer);
+
+  if (EQ (result, Qunbound))
+    xsignal1 (Qvoid_variable, variable);
+
+  return result;
+}
+
+
+/* Like Fbuffer_local_value, but return Qunbound if the variable is
+   locally unbound.  */
+
+Lisp_Object
+buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
 {
   register struct buffer *buf;
   register Lisp_Object result;
@@ -995,10 +1007,7 @@ is the default binding of the variable. */)
     default: abort ();
     }
 
-  if (!EQ (result, Qunbound))
-    return result;
-
-  xsignal1 (Qvoid_variable, variable);
+  return result;
 }
 
 /* Return an alist of the Lisp-level buffer-local bindings of
@@ -1063,12 +1072,7 @@ No argument or nil as argument means use current buffer as BUFFER.  */)
   {
     int offset, idx;
 
-    /* buffer-local Lisp variables start at `undo_list',
-       tho only the ones from `name' on are GC'd normally.  */
-    for (offset = PER_BUFFER_VAR_OFFSET (FIRST_FIELD_PER_BUFFER);
-        offset <= PER_BUFFER_VAR_OFFSET (LAST_FIELD_PER_BUFFER);
-        /* sizeof EMACS_INT == sizeof Lisp_Object */
-        offset += (sizeof (EMACS_INT)))
+    for_each_per_buffer_object_at (offset)
       {
        idx = PER_BUFFER_IDX (offset);
        if ((idx == -1 || PER_BUFFER_VALUE_P (buf, idx))
@@ -1434,24 +1438,26 @@ No argument or nil as argument means do this for the current buffer.  */)
   DEFVAR_LISP ("kill-buffer-hook", ..., "\
 Hook to be run (by `run-hooks', which see) when a buffer is killed.\n\
 The buffer being killed will be current while the hook is running.\n\
-See `kill-buffer'."
- */
+
+Functions run by this hook are supposed to not change the current
+buffer.  See `kill-buffer'."
+*/
 DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
-       doc: /* Kill buffer BUFFER-OR-NAME.
+       doc: /* Kill the buffer specified by BUFFER-OR-NAME.
 The argument may be a buffer or the name of an existing buffer.
 Argument nil or omitted means kill the current buffer.  Return t if the
 buffer is actually killed, nil otherwise.
 
-This function calls `replace-buffer-in-windows' for cleaning up all
-windows currently displaying the buffer to be killed.  The functions in
-`kill-buffer-query-functions' are called with the buffer to be killed as
-the current buffer.  If any of them returns nil, the buffer is not
-killed.  The hook `kill-buffer-hook' is run before the buffer is
-actually killed.  The buffer being killed will be current while the hook
-is running.
+The functions in `kill-buffer-query-functions' are called with the
+buffer to be killed as the current buffer.  If any of them returns nil,
+the buffer is not killed.  The hook `kill-buffer-hook' is run before the
+buffer is actually killed.  The buffer being killed will be current
+while the hook is running.  Functions called by any of these hooks are
+supposed to not change the current buffer.
 
 Any processes that have this buffer as the `process-buffer' are killed
-with SIGHUP.  */)
+with SIGHUP.  This function calls `replace-buffer-in-windows' for
+cleaning up all windows currently displaying the buffer to be killed. */)
   (Lisp_Object buffer_or_name)
 {
   Lisp_Object buffer;
@@ -1487,7 +1493,7 @@ with SIGHUP.  */)
 
   /* Run hooks with the buffer to be killed the current buffer.  */
   {
-    int count = SPECPDL_INDEX ();
+    ptrdiff_t count = SPECPDL_INDEX ();
     Lisp_Object arglist[1];
 
     record_unwind_protect (save_excursion_restore, save_excursion_save ());
@@ -1505,6 +1511,10 @@ with SIGHUP.  */)
     unbind_to (count, Qnil);
   }
 
+  /* If the hooks have killed the buffer, exit now.  */
+  if (NILP (BVAR (b, name)))
+    return Qt;
+
   /* We have no more questions to ask.  Verify that it is valid
      to kill the buffer.  This must be done after the questions
      since anything can happen within do_yes_or_no_p.  */
@@ -1513,9 +1523,6 @@ with SIGHUP.  */)
   if (EQ (buffer, XWINDOW (minibuf_window)->buffer))
     return Qnil;
 
-  if (NILP (BVAR (b, name)))
-    return Qnil;
-
   /* When we kill a base buffer, kill all its indirect buffers.
      We do it at this stage so nothing terrible happens if they
      ask questions or their hooks get errors.  */
@@ -1536,6 +1543,10 @@ with SIGHUP.  */)
          }
 
       UNGCPRO;
+
+      /* Exit if we now have killed the base buffer (Bug#11665).  */
+      if (NILP (BVAR (b, name)))
+       return Qt;
     }
 
   /* Run replace_buffer_in_windows before making another buffer current
@@ -1544,9 +1555,12 @@ with SIGHUP.  */)
      buffer.  (Bug#10114) */
   replace_buffer_in_windows (buffer);
 
-     /* Make this buffer not be current.
-     In the process, notice if this is the sole visible buffer
-     and give up if so.  */
+  /* Exit if replacing the buffer in windows has killed our buffer.  */
+  if (NILP (BVAR (b, name)))
+    return Qt;
+
+  /* Make this buffer not be current.  Exit if it is the sole visible
+     buffer.  */
   if (b == current_buffer)
     {
       tem = Fother_buffer (buffer, Qnil, Qnil);
@@ -1555,15 +1569,12 @@ with SIGHUP.  */)
        return Qnil;
     }
 
-  /* Notice if the buffer to kill is the sole visible buffer
-     when we're currently in the mini-buffer, and give up if so.  */
+  /* If the buffer now current is shown in the minibuffer and our buffer
+     is the sole other buffer give up.  */
   XSETBUFFER (tem, current_buffer);
-  if (EQ (tem, XWINDOW (minibuf_window)->buffer))
-    {
-      tem = Fother_buffer (buffer, Qnil, Qnil);
-      if (EQ (buffer, tem))
-       return Qnil;
-    }
+  if (EQ (tem, XWINDOW (minibuf_window)->buffer)
+      && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil)))
+    return Qnil;
 
   /* Now there is no question: we can kill the buffer.  */
 
@@ -1576,11 +1587,10 @@ with SIGHUP.  */)
   kill_buffer_processes (buffer);
   UNGCPRO;
 
-  /* Killing buffer processes may run sentinels which may
-     have called kill-buffer.  */
-
+  /* Killing buffer processes may run sentinels which may have killed
+     our buffer.  */
   if (NILP (BVAR (b, name)))
-    return Qnil;
+    return Qt;
 
   /* These may run Lisp code and into infinite loops (if someone
      insisted on circular lists) so allow quitting here.  */
@@ -1592,8 +1602,7 @@ with SIGHUP.  */)
   Vinhibit_quit = Qt;
   /* Remove the buffer from the list of all buffers.  */
   Vbuffer_alist = Fdelq (Frassq (buffer, Vbuffer_alist), Vbuffer_alist);
-  /* If replace_buffer_in_windows didn't do its job correctly fix that
-     now.  */
+  /* If replace_buffer_in_windows didn't do its job fix that now.  */
   replace_buffer_in_windows_safely (buffer);
   Vinhibit_quit = tem;
 
@@ -1611,6 +1620,10 @@ with SIGHUP.  */)
        internal_delete_file (BVAR (b, auto_save_file_name));
     }
 
+  /* Deleting an auto-save file could have killed our buffer.  */
+  if (NILP (BVAR (b, name)))
+    return Qt;
+
   if (b->base_buffer)
     {
       /* Unchain all markers that belong to this indirect buffer.
@@ -1763,7 +1776,7 @@ Use this function before selecting the buffer, since it may need to inspect
 the current buffer's major mode.  */)
   (Lisp_Object buffer)
 {
-  int count;
+  ptrdiff_t count;
   Lisp_Object function;
 
   CHECK_BUFFER (buffer);
@@ -1975,16 +1988,15 @@ validate_region (register Lisp_Object *b, register Lisp_Object *e)
       tem = *b;  *b = *e;  *e = tem;
     }
 
-  if (!(BEGV <= XINT (*b) && XINT (*b) <= XINT (*e)
-        && XINT (*e) <= ZV))
+  if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV))
     args_out_of_range (*b, *e);
 }
 \f
 /* Advance BYTE_POS up to a character boundary
    and return the adjusted position.  */
 
-static EMACS_INT
-advance_to_char_boundary (EMACS_INT byte_pos)
+static ptrdiff_t
+advance_to_char_boundary (ptrdiff_t byte_pos)
 {
   int c;
 
@@ -1997,7 +2009,7 @@ advance_to_char_boundary (EMACS_INT byte_pos)
     {
       /* We should advance BYTE_POS only when C is a constituent of a
          multibyte sequence.  */
-      EMACS_INT orig_byte_pos = byte_pos;
+      ptrdiff_t orig_byte_pos = byte_pos;
 
       do
        {
@@ -2063,18 +2075,18 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
   eassert (current_buffer->text == &current_buffer->own_text);
   eassert (other_buffer->text == &other_buffer->own_text);
 #ifdef REL_ALLOC
-  r_alloc_reset_variable ((POINTER_TYPE **) &current_buffer->own_text.beg,
-                         (POINTER_TYPE **) &other_buffer->own_text.beg);
-  r_alloc_reset_variable ((POINTER_TYPE **) &other_buffer->own_text.beg,
-                         (POINTER_TYPE **) &current_buffer->own_text.beg);
+  r_alloc_reset_variable ((void **) &current_buffer->own_text.beg,
+                         (void **) &other_buffer->own_text.beg);
+  r_alloc_reset_variable ((void **) &other_buffer->own_text.beg,
+                         (void **) &current_buffer->own_text.beg);
 #endif /* REL_ALLOC */
 
-  swapfield (pt, EMACS_INT);
-  swapfield (pt_byte, EMACS_INT);
-  swapfield (begv, EMACS_INT);
-  swapfield (begv_byte, EMACS_INT);
-  swapfield (zv, EMACS_INT);
-  swapfield (zv_byte, EMACS_INT);
+  swapfield (pt, ptrdiff_t);
+  swapfield (pt_byte, ptrdiff_t);
+  swapfield (begv, ptrdiff_t);
+  swapfield (begv_byte, ptrdiff_t);
+  swapfield (zv, ptrdiff_t);
+  swapfield (zv_byte, ptrdiff_t);
   eassert (!current_buffer->base_buffer);
   eassert (!other_buffer->base_buffer);
   current_buffer->clip_changed = 1;    other_buffer->clip_changed = 1;
@@ -2084,7 +2096,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
   other_buffer->prevent_redisplay_optimizations_p = 1;
   swapfield (overlays_before, struct Lisp_Overlay *);
   swapfield (overlays_after, struct Lisp_Overlay *);
-  swapfield (overlay_center, EMACS_INT);
+  swapfield (overlay_center, ptrdiff_t);
   swapfield_ (undo_list, Lisp_Object);
   swapfield_ (mark, Lisp_Object);
   swapfield_ (enable_multibyte_characters, Lisp_Object);
@@ -2167,7 +2179,7 @@ current buffer is cleared.  */)
 {
   struct Lisp_Marker *tail, *markers;
   struct buffer *other;
-  EMACS_INT begv, zv;
+  ptrdiff_t begv, zv;
   int narrowed = (BEG != BEGV || Z != ZV);
   int modified_p = !NILP (Fbuffer_modified_p (Qnil));
   Lisp_Object old_undo = BVAR (current_buffer, undo_list);
@@ -2199,7 +2211,7 @@ current buffer is cleared.  */)
 
   if (NILP (flag))
     {
-      EMACS_INT pos, stop;
+      ptrdiff_t pos, stop;
       unsigned char *p;
 
       /* Do this first, so it can use CHAR_TO_BYTE
@@ -2263,8 +2275,8 @@ current buffer is cleared.  */)
     }
   else
     {
-      EMACS_INT pt = PT;
-      EMACS_INT pos, stop;
+      ptrdiff_t pt = PT;
+      ptrdiff_t pos, stop;
       unsigned char *p, *pend;
 
       /* Be sure not to have a multibyte sequence striding over the GAP.
@@ -2280,7 +2292,7 @@ current buffer is cleared.  */)
          while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--;
          if (LEADING_CODE_P (*q))
            {
-             EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q);
+             ptrdiff_t new_gpt = GPT_BYTE - (GPT_ADDR - q);
 
              move_gap_both (new_gpt, new_gpt);
            }
@@ -2364,8 +2376,8 @@ current buffer is cleared.  */)
        ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG;
 
       {
-       EMACS_INT byte = advance_to_char_boundary (PT_BYTE);
-       EMACS_INT position;
+       ptrdiff_t byte = advance_to_char_boundary (PT_BYTE);
+       ptrdiff_t position;
 
        if (byte > GPT_BYTE)
          position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT;
@@ -2529,20 +2541,20 @@ swap_out_buffer_local_variables (struct buffer *b)
 ptrdiff_t
 overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
             ptrdiff_t *len_ptr,
-            EMACS_INT *next_ptr, EMACS_INT *prev_ptr, int change_req)
+            ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, int change_req)
 {
   Lisp_Object overlay, start, end;
   struct Lisp_Overlay *tail;
   ptrdiff_t idx = 0;
   ptrdiff_t len = *len_ptr;
   Lisp_Object *vec = *vec_ptr;
-  EMACS_INT next = ZV;
-  EMACS_INT prev = BEGV;
+  ptrdiff_t next = ZV;
+  ptrdiff_t prev = BEGV;
   int inhibit_storing = 0;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
-      EMACS_INT startpos, endpos;
+      ptrdiff_t startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2590,7 +2602,7 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
 
   for (tail = current_buffer->overlays_after; tail; tail = tail->next)
     {
-      EMACS_INT startpos, endpos;
+      ptrdiff_t startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2663,21 +2675,21 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
 static ptrdiff_t
 overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
             Lisp_Object **vec_ptr, ptrdiff_t *len_ptr,
-            EMACS_INT *next_ptr, EMACS_INT *prev_ptr)
+            ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr)
 {
   Lisp_Object overlay, ostart, oend;
   struct Lisp_Overlay *tail;
   ptrdiff_t idx = 0;
   ptrdiff_t len = *len_ptr;
   Lisp_Object *vec = *vec_ptr;
-  EMACS_INT next = ZV;
-  EMACS_INT prev = BEGV;
+  ptrdiff_t next = ZV;
+  ptrdiff_t prev = BEGV;
   int inhibit_storing = 0;
   int end_is_Z = end == Z;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
-      EMACS_INT startpos, endpos;
+      ptrdiff_t startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2724,7 +2736,7 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
 
   for (tail = current_buffer->overlays_after; tail; tail = tail->next)
     {
-      EMACS_INT startpos, endpos;
+      ptrdiff_t startpos, endpos;
 
       XSETMISC (overlay, tail);
 
@@ -2780,17 +2792,17 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
 int
 mouse_face_overlay_overlaps (Lisp_Object overlay)
 {
-  EMACS_INT start = OVERLAY_POSITION (OVERLAY_START (overlay));
-  EMACS_INT end = OVERLAY_POSITION (OVERLAY_END (overlay));
+  ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay));
+  ptrdiff_t end = OVERLAY_POSITION (OVERLAY_END (overlay));
   ptrdiff_t n, i, size;
   Lisp_Object *v, tem;
 
   size = 10;
-  v = (Lisp_Object *) alloca (size * sizeof *v);
+  v = alloca (size * sizeof *v);
   n = overlays_in (start, end, 0, &v, &size, NULL, NULL);
   if (n > size)
     {
-      v = (Lisp_Object *) alloca (n * sizeof *v);
+      v = alloca (n * sizeof *v);
       overlays_in (start, end, 0, &v, &n, NULL, NULL);
     }
 
@@ -2807,18 +2819,17 @@ mouse_face_overlay_overlaps (Lisp_Object overlay)
 \f
 /* Fast function to just test if we're at an overlay boundary.  */
 int
-overlay_touches_p (EMACS_INT pos)
+overlay_touches_p (ptrdiff_t pos)
 {
   Lisp_Object overlay;
   struct Lisp_Overlay *tail;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
-      EMACS_INT endpos;
+      ptrdiff_t endpos;
 
       XSETMISC (overlay ,tail);
-      if (!OVERLAYP (overlay))
-       abort ();
+      eassert (OVERLAYP (overlay));
 
       endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
       if (endpos < pos)
@@ -2829,11 +2840,10 @@ overlay_touches_p (EMACS_INT pos)
 
   for (tail = current_buffer->overlays_after; tail; tail = tail->next)
     {
-      EMACS_INT startpos;
+      ptrdiff_t startpos;
 
       XSETMISC (overlay, tail);
-      if (!OVERLAYP (overlay))
-       abort ();
+      eassert (OVERLAYP (overlay));
 
       startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
       if (pos < startpos)
@@ -2847,7 +2857,7 @@ overlay_touches_p (EMACS_INT pos)
 struct sortvec
 {
   Lisp_Object overlay;
-  EMACS_INT beg, end;
+  ptrdiff_t beg, end;
   EMACS_INT priority;
 };
 
@@ -2878,8 +2888,7 @@ ptrdiff_t
 sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w)
 {
   ptrdiff_t i, j;
-  struct sortvec *sortvec;
-  sortvec = (struct sortvec *) alloca (noverlays * sizeof (struct sortvec));
+  struct sortvec *sortvec = alloca (noverlays * sizeof *sortvec);
 
   /* Put the valid and relevant overlays into sortvec.  */
 
@@ -2889,7 +2898,7 @@ sort_overlays (Lisp_Object *overlay_vec, ptrdiff_t noverlays, struct window *w)
       Lisp_Object overlay;
 
       overlay = overlay_vec[i];
-      if (OVERLAY_VALID (overlay)
+      if (OVERLAYP (overlay)
          && OVERLAY_POSITION (OVERLAY_START (overlay)) > 0
          && OVERLAY_POSITION (OVERLAY_END (overlay)) > 0)
        {
@@ -2970,7 +2979,7 @@ static void
 record_overlay_string (struct sortstrlist *ssl, Lisp_Object str,
                       Lisp_Object str2, Lisp_Object pri, ptrdiff_t size)
 {
-  EMACS_INT nbytes;
+  ptrdiff_t nbytes;
 
   if (ssl->used == ssl->size)
     ssl->buf = xpalloc (ssl->buf, &ssl->size, 5, -1, sizeof *ssl->buf);
@@ -3020,12 +3029,12 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str,
    PSTR, if that variable is non-null.  The string may be overwritten by
    subsequent calls.  */
 
-EMACS_INT
-overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
+ptrdiff_t
+overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr)
 {
   Lisp_Object overlay, window, str;
   struct Lisp_Overlay *ov;
-  EMACS_INT startpos, endpos;
+  ptrdiff_t startpos, endpos;
   int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
 
   overlay_heads.used = overlay_heads.bytes = 0;
@@ -3095,7 +3104,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
   if (overlay_heads.bytes || overlay_tails.bytes)
     {
       Lisp_Object tem;
-      EMACS_INT i;
+      ptrdiff_t i;
       unsigned char *p;
       ptrdiff_t total;
 
@@ -3109,7 +3118,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
       p = overlay_str_buf;
       for (i = overlay_tails.used; --i >= 0;)
        {
-         EMACS_INT nbytes;
+         ptrdiff_t nbytes;
          tem = overlay_tails.buf[i].string;
          nbytes = copy_text (SDATA (tem), p,
                              SBYTES (tem),
@@ -3118,7 +3127,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
        }
       for (i = 0; i < overlay_heads.used; ++i)
        {
-         EMACS_INT nbytes;
+         ptrdiff_t nbytes;
          tem = overlay_heads.buf[i].string;
          nbytes = copy_text (SDATA (tem), p,
                              SBYTES (tem),
@@ -3145,7 +3154,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr)
 /* Shift overlays in BUF's overlay lists, to center the lists at POS.  */
 
 void
-recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
+recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos)
 {
   Lisp_Object overlay, beg, end;
   struct Lisp_Overlay *prev, *tail, *next;
@@ -3160,22 +3169,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
     {
       next = tail->next;
       XSETMISC (overlay, tail);
-
-      /* If the overlay is not valid, get rid of it.  */
-      if (!OVERLAY_VALID (overlay))
-#if 1
-       abort ();
-#else
-       {
-         /* Splice the cons cell TAIL out of overlays_before.  */
-         if (!NILP (prev))
-           XCDR (prev) = next;
-         else
-           buf->overlays_before = next;
-         tail = prev;
-         continue;
-       }
-#endif
+      eassert (OVERLAYP (overlay));
 
       beg = OVERLAY_START (overlay);
       end = OVERLAY_END (overlay);
@@ -3183,7 +3177,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
       if (OVERLAY_POSITION (end) > pos)
        {
          /* OVERLAY needs to be moved.  */
-         EMACS_INT where = OVERLAY_POSITION (beg);
+         ptrdiff_t where = OVERLAY_POSITION (beg);
          struct Lisp_Overlay *other, *other_prev;
 
          /* Splice the cons cell TAIL out of overlays_before.  */
@@ -3200,7 +3194,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
              Lisp_Object otherbeg, otheroverlay;
 
              XSETMISC (otheroverlay, other);
-             eassert (OVERLAY_VALID (otheroverlay));
+             eassert (OVERLAYP (otheroverlay));
 
              otherbeg = OVERLAY_START (otheroverlay);
              if (OVERLAY_POSITION (otherbeg) >= where)
@@ -3228,22 +3222,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
     {
       next = tail->next;
       XSETMISC (overlay, tail);
-
-      /* If the overlay is not valid, get rid of it.  */
-      if (!OVERLAY_VALID (overlay))
-#if 1
-       abort ();
-#else
-       {
-         /* Splice the cons cell TAIL out of overlays_after.  */
-         if (!NILP (prev))
-           XCDR (prev) = next;
-         else
-           buf->overlays_after = next;
-         tail = prev;
-         continue;
-       }
-#endif
+      eassert (OVERLAYP (overlay));
 
       beg = OVERLAY_START (overlay);
       end = OVERLAY_END (overlay);
@@ -3256,7 +3235,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
       if (OVERLAY_POSITION (end) <= pos)
        {
          /* OVERLAY needs to be moved.  */
-         EMACS_INT where = OVERLAY_POSITION (end);
+         ptrdiff_t where = OVERLAY_POSITION (end);
          struct Lisp_Overlay *other, *other_prev;
 
          /* Splice the cons cell TAIL out of overlays_after.  */
@@ -3273,7 +3252,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
              Lisp_Object otherend, otheroverlay;
 
              XSETMISC (otheroverlay, other);
-             eassert (OVERLAY_VALID (otheroverlay));
+             eassert (OVERLAYP (otheroverlay));
 
              otherend = OVERLAY_END (otheroverlay);
              if (OVERLAY_POSITION (otherend) <= where)
@@ -3294,7 +3273,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos)
 }
 
 void
-adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length)
+adjust_overlays_for_insert (ptrdiff_t pos, ptrdiff_t length)
 {
   /* After an insertion, the lists are still sorted properly,
      but we may need to update the value of the overlay center.  */
@@ -3303,13 +3282,13 @@ adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length)
 }
 
 void
-adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length)
+adjust_overlays_for_delete (ptrdiff_t pos, ptrdiff_t length)
 {
   if (current_buffer->overlay_center < pos)
     /* The deletion was to our right.  No change needed; the before- and
        after-lists are still consistent.  */
     ;
-  else if (current_buffer->overlay_center > pos + length)
+  else if (current_buffer->overlay_center - pos > length)
     /* The deletion was to our left.  We need to adjust the center value
        to account for the change in position, but the lists are consistent
        given the new value.  */
@@ -3328,7 +3307,7 @@ adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length)
    Such an overlay might even have negative size at this point.
    If so, we'll make the overlay empty. */
 void
-fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end)
+fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
 {
   Lisp_Object overlay;
   struct Lisp_Overlay *before_list IF_LINT (= NULL);
@@ -3341,7 +3320,7 @@ fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end)
      current_buffer->overlays_before or overlays_after, depending
      which loop we're in.  */
   struct Lisp_Overlay *tail, *parent;
-  EMACS_INT startpos, endpos;
+  ptrdiff_t startpos, endpos;
 
   /* This algorithm shifts links around instead of consing and GCing.
      The loop invariant is that before_list (resp. after_list) is a
@@ -3475,12 +3454,12 @@ fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end)
    was at PREV, and now is at POS.  */
 
 void
-fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos)
+fix_overlays_before (struct buffer *bp, ptrdiff_t prev, ptrdiff_t pos)
 {
   /* If parent is nil, replace overlays_before; otherwise, parent->next.  */
   struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair;
   Lisp_Object tem;
-  EMACS_INT end IF_LINT (= 0);
+  ptrdiff_t end IF_LINT (= 0);
 
   /* After the insertion, the several overlays may be in incorrect
      order.  The possibility is that, in the list `overlays_before',
@@ -3638,11 +3617,11 @@ for the rear of the overlay advance when text is inserted there
 /* Mark a section of BUF as needing redisplay because of overlays changes.  */
 
 static void
-modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end)
+modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end)
 {
   if (start > end)
     {
-      EMACS_INT temp = start;
+      ptrdiff_t temp = start;
       start = end;
       end = temp;
     }
@@ -3664,18 +3643,17 @@ modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end)
   ++BUF_OVERLAY_MODIFF (buf);
 }
 
-\f
+/* Remove OVERLAY from LIST.  */
+
 static struct Lisp_Overlay *
 unchain_overlay (struct Lisp_Overlay *list, struct Lisp_Overlay *overlay)
 {
-  struct Lisp_Overlay *tmp, *prev;
-  for (tmp = list, prev = NULL; tmp; prev = tmp, tmp = tmp->next)
-    if (tmp == overlay)
+  register struct Lisp_Overlay *tail, **prev = &list;
+
+  for (tail = list; tail; prev = &tail->next, tail = *prev)
+    if (tail == overlay)
       {
-       if (prev)
-         prev->next = tmp->next;
-       else
-         list = tmp->next;
+       *prev = overlay->next;
        overlay->next = NULL;
        break;
       }
@@ -3689,9 +3667,10 @@ If BUFFER is omitted, and OVERLAY is in no buffer, put it in the current
 buffer.  */)
   (Lisp_Object overlay, Lisp_Object beg, Lisp_Object end, Lisp_Object buffer)
 {
-  struct buffer *b, *ob;
+  struct buffer *b, *ob = 0;
   Lisp_Object obuffer;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
+  ptrdiff_t n_beg, n_end, o_beg IF_LINT (= 0), o_end IF_LINT (= 0);
 
   CHECK_OVERLAY (overlay);
   if (NILP (buffer))
@@ -3700,6 +3679,9 @@ buffer.  */)
     XSETBUFFER (buffer, current_buffer);
   CHECK_BUFFER (buffer);
 
+  if (NILP (Fbuffer_live_p (buffer)))
+    error ("Attempt to move overlay to a dead buffer");
+
   if (MARKERP (beg)
       && ! EQ (Fmarker_buffer (beg), buffer))
     error ("Marker points into wrong buffer");
@@ -3710,9 +3692,6 @@ buffer.  */)
   CHECK_NUMBER_COERCE_MARKER (beg);
   CHECK_NUMBER_COERCE_MARKER (end);
 
-  if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate)))
-    return Fdelete_overlay (overlay);
-
   if (XINT (beg) > XINT (end))
     {
       Lisp_Object temp;
@@ -3723,61 +3702,57 @@ buffer.  */)
 
   obuffer = Fmarker_buffer (OVERLAY_START (overlay));
   b = XBUFFER (buffer);
-  ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0;
+
+  if (!NILP (obuffer))
+    {
+      ob = XBUFFER (obuffer);
+
+      o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
+      o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
+
+      ob->overlays_before =
+        unchain_overlay (ob->overlays_before, XOVERLAY (overlay));
+      ob->overlays_after =
+        unchain_overlay (ob->overlays_after, XOVERLAY (overlay));
+      eassert (XOVERLAY (overlay)->next == NULL);
+    }
+
+  /* Set the overlay boundaries, which may clip them.  */
+  Fset_marker (OVERLAY_START (overlay), beg, buffer);
+  Fset_marker (OVERLAY_END (overlay), end, buffer);
+
+  n_beg = marker_position (OVERLAY_START (overlay));
+  n_end = marker_position (OVERLAY_END (overlay));
 
   /* If the overlay has changed buffers, do a thorough redisplay.  */
   if (!EQ (buffer, obuffer))
     {
       /* Redisplay where the overlay was.  */
-      if (!NILP (obuffer))
-       {
-         EMACS_INT o_beg;
-         EMACS_INT o_end;
-
-         o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
-         o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
-
-         modify_overlay (ob, o_beg, o_end);
-       }
+      if (ob)
+        modify_overlay (ob, o_beg, o_end);
 
       /* Redisplay where the overlay is going to be.  */
-      modify_overlay (b, XINT (beg), XINT (end));
+      modify_overlay (b, n_beg, n_end);
     }
   else
     /* Redisplay the area the overlay has just left, or just enclosed.  */
     {
-      EMACS_INT o_beg, o_end;
-
-      o_beg = OVERLAY_POSITION (OVERLAY_START (overlay));
-      o_end = OVERLAY_POSITION (OVERLAY_END (overlay));
-
-      if (o_beg == XINT (beg))
-       modify_overlay (b, o_end, XINT (end));
-      else if (o_end == XINT (end))
-       modify_overlay (b, o_beg, XINT (beg));
+      if (o_beg == n_beg)
+       modify_overlay (b, o_end, n_end);
+      else if (o_end == n_end)
+       modify_overlay (b, o_beg, n_beg);
       else
-       {
-         if (XINT (beg) < o_beg) o_beg = XINT (beg);
-         if (XINT (end) > o_end) o_end = XINT (end);
-         modify_overlay (b, o_beg, o_end);
-       }
+       modify_overlay (b, min (o_beg, n_beg), max (o_end, n_end));
     }
 
-  if (!NILP (obuffer))
-    {
-      ob->overlays_before
-       = unchain_overlay (ob->overlays_before, XOVERLAY (overlay));
-      ob->overlays_after
-       = unchain_overlay (ob->overlays_after, XOVERLAY (overlay));
-      eassert (XOVERLAY (overlay)->next == NULL);
-    }
-
-  Fset_marker (OVERLAY_START (overlay), beg, buffer);
-  Fset_marker (OVERLAY_END   (overlay), end, buffer);
+  /* Delete the overlay if it is empty after clipping and has the
+     evaporate property.  */
+  if (n_beg == n_end && !NILP (Foverlay_get (overlay, Qevaporate)))
+    return unbind_to (count, Fdelete_overlay (overlay));
 
-  /* Put the overlay on the wrong list.  */
-  end = OVERLAY_END (overlay);
-  if (OVERLAY_POSITION (end) < b->overlay_center)
+  /* Put the overlay into the new buffer's overlay lists, first on the
+     wrong list.  */
+  if (n_end < b->overlay_center)
     {
       XOVERLAY (overlay)->next = b->overlays_after;
       b->overlays_after = XOVERLAY (overlay);
@@ -3800,7 +3775,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
 {
   Lisp_Object buffer;
   struct buffer *b;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   CHECK_OVERLAY (overlay);
 
@@ -3811,14 +3786,13 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0,
   b = XBUFFER (buffer);
   specbind (Qinhibit_quit, Qt);
 
-  b->overlays_before = unchain_overlay (b->overlays_before,XOVERLAY (overlay));
-  b->overlays_after  = unchain_overlay (b->overlays_after, XOVERLAY (overlay));
+  b->overlays_before
+    = unchain_overlay (b->overlays_before, XOVERLAY (overlay));
+  b->overlays_after
+    = unchain_overlay (b->overlays_after, XOVERLAY (overlay));
   eassert (XOVERLAY (overlay)->next == NULL);
-  modify_overlay (b,
-                 marker_position (OVERLAY_START (overlay)),
-                 marker_position (OVERLAY_END   (overlay)));
-  Fset_marker (OVERLAY_START (overlay), Qnil, Qnil);
-  Fset_marker (OVERLAY_END   (overlay), Qnil, Qnil);
+
+  drop_overlay (b, XOVERLAY (overlay));
 
   /* When deleting an overlay with before or after strings, turn off
      display optimizations for the affected buffer, on the basis that
@@ -3886,12 +3860,12 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
 
   len = 10;
   /* We can't use alloca here because overlays_at can call xrealloc.  */
-  overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
+  overlay_vec = xmalloc (len * sizeof *overlay_vec);
 
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.  */
   noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
-                          (EMACS_INT *) 0, (EMACS_INT *) 0, 0);
+                          0, 0, 0);
 
   /* Make a list of them all.  */
   result = Flist (noverlays, overlay_vec);
@@ -3917,7 +3891,7 @@ end of the buffer.  */)
   CHECK_NUMBER_COERCE_MARKER (end);
 
   len = 10;
-  overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
+  overlay_vec = xmalloc (len * sizeof *overlay_vec);
 
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.  */
@@ -3939,26 +3913,26 @@ the value is (point-max).  */)
   (Lisp_Object pos)
 {
   ptrdiff_t i, len, noverlays;
-  EMACS_INT endpos;
+  ptrdiff_t endpos;
   Lisp_Object *overlay_vec;
 
   CHECK_NUMBER_COERCE_MARKER (pos);
 
   len = 10;
-  overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
+  overlay_vec = xmalloc (len * sizeof *overlay_vec);
 
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.
      endpos gets the position where the next overlay starts.  */
   noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
-                          &endpos, (EMACS_INT *) 0, 1);
+                          &endpos, 0, 1);
 
   /* If any of these overlays ends before endpos,
      use its ending point instead.  */
   for (i = 0; i < noverlays; i++)
     {
       Lisp_Object oend;
-      EMACS_INT oendpos;
+      ptrdiff_t oendpos;
 
       oend = OVERLAY_END (overlay_vec[i]);
       oendpos = OVERLAY_POSITION (oend);
@@ -3977,7 +3951,7 @@ If there are no overlay boundaries from (point-min) to POS,
 the value is (point-min).  */)
   (Lisp_Object pos)
 {
-  EMACS_INT prevpos;
+  ptrdiff_t prevpos;
   Lisp_Object *overlay_vec;
   ptrdiff_t len;
 
@@ -3989,13 +3963,13 @@ the value is (point-min).  */)
     return pos;
 
   len = 10;
-  overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
+  overlay_vec = xmalloc (len * sizeof *overlay_vec);
 
   /* Put all the overlays we want in a vector in overlay_vec.
      Store the length in len.
      prevpos gets the position of the previous change.  */
   overlays_at (XINT (pos), 1, &overlay_vec, &len,
-              (EMACS_INT *) 0, &prevpos, 1);
+              0, &prevpos, 1);
 
   xfree (overlay_vec);
   return make_number (prevpos);
@@ -4033,9 +4007,11 @@ That makes overlay lookup faster for positions near POS (but perhaps slower
 for positions far away from POS).  */)
   (Lisp_Object pos)
 {
+  ptrdiff_t p;
   CHECK_NUMBER_COERCE_MARKER (pos);
 
-  recenter_overlay_lists (current_buffer, XINT (pos));
+  p = clip_to_bounds (PTRDIFF_MIN, XINT (pos), PTRDIFF_MAX);
+  recenter_overlay_lists (current_buffer, p);
   return Qnil;
 }
 \f
@@ -4102,7 +4078,7 @@ VALUE will be returned.*/)
 static Lisp_Object last_overlay_modification_hooks;
 
 /* Number of elements actually used in last_overlay_modification_hooks.  */
-static int last_overlay_modification_hooks_used;
+static ptrdiff_t last_overlay_modification_hooks_used;
 
 /* Add one functionlist/overlay pair
    to the end of last_overlay_modification_hooks.  */
@@ -4110,11 +4086,11 @@ static int last_overlay_modification_hooks_used;
 static void
 add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
 {
-  int oldsize = ASIZE (last_overlay_modification_hooks);
+  ptrdiff_t oldsize = ASIZE (last_overlay_modification_hooks);
 
-  if (last_overlay_modification_hooks_used == oldsize)
-    last_overlay_modification_hooks = larger_vector
-      (last_overlay_modification_hooks, oldsize * 2, Qnil);
+  if (oldsize - 1 <= last_overlay_modification_hooks_used)
+    last_overlay_modification_hooks =
+      larger_vector (last_overlay_modification_hooks, 2, -1);
   ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used,
        functionlist); last_overlay_modification_hooks_used++;
   ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used,
@@ -4163,7 +4139,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
       last_overlay_modification_hooks_used = 0;
       for (tail = current_buffer->overlays_before; tail; tail = tail->next)
        {
-         EMACS_INT startpos, endpos;
+         ptrdiff_t startpos, endpos;
          Lisp_Object ostart, oend;
 
          XSETMISC (overlay, tail);
@@ -4200,7 +4176,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
 
       for (tail = current_buffer->overlays_after; tail; tail = tail->next)
        {
-         EMACS_INT startpos, endpos;
+         ptrdiff_t startpos, endpos;
          Lisp_Object ostart, oend;
 
          XSETMISC (overlay, tail);
@@ -4241,9 +4217,9 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
     /* Call the functions recorded in last_overlay_modification_hooks.
        First copy the vector contents, in case some of these hooks
        do subsequent modification of the buffer.  */
-    int size = last_overlay_modification_hooks_used;
-    Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object));
-    int i;
+    ptrdiff_t size = last_overlay_modification_hooks_used;
+    Lisp_Object *copy = alloca (size * sizeof *copy);
+    ptrdiff_t i;
 
     memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents,
            size * sizeof (Lisp_Object));
@@ -4283,7 +4259,7 @@ call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after,
 /* Delete any zero-sized overlays at position POS, if the `evaporate'
    property is set.  */
 void
-evaporate_overlays (EMACS_INT pos)
+evaporate_overlays (ptrdiff_t pos)
 {
   Lisp_Object overlay, hit_list;
   struct Lisp_Overlay *tail;
@@ -4292,7 +4268,7 @@ evaporate_overlays (EMACS_INT pos)
   if (pos <= current_buffer->overlay_center)
     for (tail = current_buffer->overlays_before; tail; tail = tail->next)
       {
-       EMACS_INT endpos;
+       ptrdiff_t endpos;
        XSETMISC (overlay, tail);
        endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
        if (endpos < pos)
@@ -4304,7 +4280,7 @@ evaporate_overlays (EMACS_INT pos)
   else
     for (tail = current_buffer->overlays_after; tail; tail = tail->next)
       {
-       EMACS_INT startpos;
+       ptrdiff_t startpos;
        XSETMISC (overlay, tail);
        startpos = OVERLAY_POSITION (OVERLAY_START (overlay));
        if (startpos > pos)
@@ -4395,7 +4371,7 @@ struct mmap_region
   /* Pointer to the location holding the address of the memory
      allocated with the mmap'd block.  The variable actually points
      after this structure.  */
-  POINTER_TYPE **var;
+  void **var;
 
   /* Next and previous in list of all mmap'd regions.  */
   struct mmap_region *next, *prev;
@@ -4442,7 +4418,7 @@ static int mmap_initialized_p;
    to the start of the user-visible part of the region.  */
 
 #define MMAP_USER_AREA(P) \
-     ((POINTER_TYPE *) ((char *) (P) + MMAP_REGION_STRUCT_SIZE))
+     ((void *) ((char *) (P) + MMAP_REGION_STRUCT_SIZE))
 
 #define MEM_ALIGN      sizeof (double)
 
@@ -4491,7 +4467,7 @@ mmap_init (void)
    is at END - 1.  */
 
 static struct mmap_region *
-mmap_find (POINTER_TYPE *start, POINTER_TYPE *end)
+mmap_find (void *start, void *end)
 {
   struct mmap_region *r;
   char *s = (char *) start, *e = (char *) end;
@@ -4529,7 +4505,7 @@ mmap_free_1 (struct mmap_region *r)
   else
     mmap_regions = r->next;
 
-  if (munmap ((POINTER_TYPE *) r, r->nbytes_mapped) == -1)
+  if (munmap (r, r->nbytes_mapped) == -1)
     {
       fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
       return 0;
@@ -4571,13 +4547,13 @@ mmap_enlarge (struct mmap_region *r, int npages)
         I'm not sure this is worth doing, let's see.  */
       if (!MMAP_ALLOCATED_P (region_end, region_end + nbytes))
        {
-         POINTER_TYPE *p;
+         void *p;
 
          p = mmap (region_end, nbytes, PROT_READ | PROT_WRITE,
                    MAP_ANON | MAP_PRIVATE | MAP_FIXED, mmap_fd, 0);
          if (p == MAP_FAILED)
            ; /* fprintf (stderr, "mmap: %s\n", emacs_strerror (errno)); */
-         else if (p != (POINTER_TYPE *) region_end)
+         else if (p != region_end)
            {
              /* Kernels are free to choose a different address.  In
                 that case, unmap what we've mapped above; we have
@@ -4639,8 +4615,8 @@ mmap_set_vars (int restore_p)
    If we can't allocate the necessary memory, set *VAR to null, and
    return null.  */
 
-static POINTER_TYPE *
-mmap_alloc (POINTER_TYPE **var, size_t nbytes)
+static void *
+mmap_alloc (void **var, size_t nbytes)
 {
   void *p;
   size_t map;
@@ -4681,7 +4657,7 @@ mmap_alloc (POINTER_TYPE **var, size_t nbytes)
    PTR.  Store 0 in *PTR to show there's no block allocated.  */
 
 static void
-mmap_free (POINTER_TYPE **var)
+mmap_free (void **var)
 {
   mmap_init ();
 
@@ -4698,10 +4674,10 @@ mmap_free (POINTER_TYPE **var)
    and return this value.  If more memory cannot be allocated, then
    leave *VAR unchanged, and return null.  */
 
-static POINTER_TYPE *
-mmap_realloc (POINTER_TYPE **var, size_t nbytes)
+static void *
+mmap_realloc (void **var, size_t nbytes)
 {
-  POINTER_TYPE *result;
+  void *result;
 
   mmap_init ();
 
@@ -4720,7 +4696,7 @@ mmap_realloc (POINTER_TYPE **var, size_t nbytes)
       if (room < nbytes)
        {
          /* Must enlarge.  */
-         POINTER_TYPE *old_ptr = *var;
+         void *old_ptr = *var;
 
          /* Try to map additional pages at the end of the region.
             If that fails, allocate a new region,  copy data
@@ -4782,13 +4758,13 @@ mmap_realloc (POINTER_TYPE **var, size_t nbytes)
 static void
 alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
 {
-  POINTER_TYPE *p;
+  void *p;
 
   BLOCK_INPUT;
 #if defined USE_MMAP_FOR_BUFFERS
-  p = mmap_alloc ((POINTER_TYPE **) &b->text->beg, nbytes);
+  p = mmap_alloc ((void **) &b->text->beg, nbytes);
 #elif defined REL_ALLOC
-  p = r_alloc ((POINTER_TYPE **) &b->text->beg, nbytes);
+  p = r_alloc ((void **) &b->text->beg, nbytes);
 #else
   p = xmalloc (nbytes);
 #endif
@@ -4807,16 +4783,16 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
    shrink it.  */
 
 void
-enlarge_buffer_text (struct buffer *b, EMACS_INT delta)
+enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
 {
-  POINTER_TYPE *p;
+  void *p;
   ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1
                      + delta);
   BLOCK_INPUT;
 #if defined USE_MMAP_FOR_BUFFERS
-  p = mmap_realloc ((POINTER_TYPE **) &b->text->beg, nbytes);
+  p = mmap_realloc ((void **) &b->text->beg, nbytes);
 #elif defined REL_ALLOC
-  p = r_re_alloc ((POINTER_TYPE **) &b->text->beg, nbytes);
+  p = r_re_alloc ((void **) &b->text->beg, nbytes);
 #else
   p = xrealloc (b->text->beg, nbytes);
 #endif
@@ -4840,9 +4816,9 @@ free_buffer_text (struct buffer *b)
   BLOCK_INPUT;
 
 #if defined USE_MMAP_FOR_BUFFERS
-  mmap_free ((POINTER_TYPE **) &b->text->beg);
+  mmap_free ((void **) &b->text->beg);
 #elif defined REL_ALLOC
-  r_alloc_free ((POINTER_TYPE **) &b->text->beg);
+  r_alloc_free ((void **) &b->text->beg);
 #else
   xfree (b->text->beg);
 #endif
@@ -4861,6 +4837,12 @@ void
 init_buffer_once (void)
 {
   int idx;
+  /* If you add, remove, or reorder Lisp_Objects in a struct buffer, make
+     sure that this is still correct.  Otherwise, mark_vectorlike may not
+     trace all Lisp_Objects in buffer_defaults and buffer_local_symbols.  */
+  const int pvecsize
+    = (offsetof (struct buffer, own_text) - sizeof (struct vectorlike_header))
+    / sizeof (Lisp_Object);
 
   memset (buffer_permanent_local_flags, 0, sizeof buffer_permanent_local_flags);
 
@@ -4877,25 +4859,23 @@ init_buffer_once (void)
   buffer_local_symbols.text = &buffer_local_symbols.own_text;
   BUF_INTERVALS (&buffer_defaults) = 0;
   BUF_INTERVALS (&buffer_local_symbols) = 0;
-  XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, 0);
+  XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize);
   XSETBUFFER (Vbuffer_defaults, &buffer_defaults);
-  XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, 0);
+  XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize);
   XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols);
 
   /* Set up the default values of various buffer slots.  */
   /* Must do these before making the first buffer! */
 
   /* real setup is done in bindings.el */
-  BVAR (&buffer_defaults, mode_line_format) = make_pure_c_string ("%-");
+  BVAR (&buffer_defaults, mode_line_format) = build_pure_c_string ("%-");
   BVAR (&buffer_defaults, header_line_format) = Qnil;
   BVAR (&buffer_defaults, abbrev_mode) = Qnil;
   BVAR (&buffer_defaults, overwrite_mode) = Qnil;
   BVAR (&buffer_defaults, case_fold_search) = Qt;
   BVAR (&buffer_defaults, auto_fill_function) = Qnil;
   BVAR (&buffer_defaults, selective_display) = Qnil;
-#ifndef old
   BVAR (&buffer_defaults, selective_display_ellipses) = Qt;
-#endif
   BVAR (&buffer_defaults, abbrev_table) = Qnil;
   BVAR (&buffer_defaults, display_table) = Qnil;
   BVAR (&buffer_defaults, undo_list) = Qnil;
@@ -4974,9 +4954,7 @@ init_buffer_once (void)
   XSETFASTINT (BVAR (&buffer_local_flags, case_fold_search), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, auto_fill_function), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, selective_display), idx); ++idx;
-#ifndef old
   XSETFASTINT (BVAR (&buffer_local_flags, selective_display_ellipses), idx); ++idx;
-#endif
   XSETFASTINT (BVAR (&buffer_local_flags, tab_width), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, truncate_lines), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, word_wrap), idx); ++idx;
@@ -5020,7 +4998,7 @@ init_buffer_once (void)
   current_buffer = 0;
   all_buffers = 0;
 
-  QSFundamental = make_pure_c_string ("Fundamental");
+  QSFundamental = build_pure_c_string ("Fundamental");
 
   Qfundamental_mode = intern_c_string ("fundamental-mode");
   BVAR (&buffer_defaults, major_mode) = Qfundamental_mode;
@@ -5034,13 +5012,11 @@ init_buffer_once (void)
   Qkill_buffer_hook = intern_c_string ("kill-buffer-hook");
   Fput (Qkill_buffer_hook, Qpermanent_local, Qt);
 
-  Qucs_set_table_for_input = intern_c_string ("ucs-set-table-for-input");
-
   /* super-magic invisible buffer */
-  Vprin1_to_string_buffer = Fget_buffer_create (make_pure_c_string (" prin1"));
+  Vprin1_to_string_buffer = Fget_buffer_create (build_pure_c_string (" prin1"));
   Vbuffer_alist = Qnil;
 
-  Fset_buffer (Fget_buffer_create (make_pure_c_string ("*scratch*")));
+  Fset_buffer (Fget_buffer_create (build_pure_c_string ("*scratch*")));
 
   inhibit_modification_hooks = 0;
 }
@@ -5080,14 +5056,15 @@ init_buffer (void)
   if (!(IS_DIRECTORY_SEP (pwd[len - 1])))
     {
       /* Grow buffer to add directory separator and '\0'.  */
-      pwd = (char *) realloc (pwd, len + 2);
+      pwd = realloc (pwd, len + 2);
       if (!pwd)
        fatal ("`get_current_dir_name' failed: %s\n", strerror (errno));
       pwd[len] = DIRECTORY_SEP;
       pwd[len + 1] = '\0';
+      len++;
     }
 
-  BVAR (current_buffer, directory) = make_unibyte_string (pwd, strlen (pwd));
+  BVAR (current_buffer, directory) = make_unibyte_string (pwd, len);
   if (! NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
     /* At this moment, we still don't know how to decode the
        directory name.  So, we keep the bytes in multibyte form so
@@ -5191,13 +5168,10 @@ syms_of_buffer (void)
   DEFSYM (Qafter_change_functions, "after-change-functions");
   DEFSYM (Qkill_buffer_query_functions, "kill-buffer-query-functions");
 
-  /* The next one is initialized in init_buffer_once.  */
-  staticpro (&Qucs_set_table_for_input);
-
   Fput (Qprotected_field, Qerror_conditions,
        pure_cons (Qprotected_field, pure_cons (Qerror, Qnil)));
   Fput (Qprotected_field, Qerror_message,
-       make_pure_c_string ("Attempt to modify a protected field"));
+       build_pure_c_string ("Attempt to modify a protected field"));
 
   DEFVAR_BUFFER_DEFAULTS ("default-mode-line-format",
                          mode_line_format,
@@ -5235,7 +5209,7 @@ This is the same as (default-value 'ctl-arrow).  */);
 
   DEFVAR_BUFFER_DEFAULTS ("default-enable-multibyte-characters",
                          enable_multibyte_characters,
-                         doc: /* *Default value of `enable-multibyte-characters' for buffers not overriding it.
+                         doc: /* Default value of `enable-multibyte-characters' for buffers not overriding it.
 This is the same as (default-value 'enable-multibyte-characters).  */);
 
   DEFVAR_BUFFER_DEFAULTS ("default-buffer-file-coding-system",
@@ -5345,31 +5319,40 @@ the mode line appears at the bottom.  */);
   DEFVAR_PER_BUFFER ("mode-line-format", &BVAR (current_buffer, mode_line_format),
                     Qnil,
                     doc: /* Template for displaying mode line for current buffer.
-Each buffer has its own value of this variable.
-Value may be nil, a string, a symbol or a list or cons cell.
+
+The value may be nil, a string, a symbol or a list.
+
 A value of nil means don't display a mode line.
-For a symbol, its value is used (but it is ignored if t or nil).
- A string appearing directly as the value of a symbol is processed verbatim
- in that the %-constructs below are not recognized.
- Note that unless the symbol is marked as a `risky-local-variable', all
- properties in any strings, as well as all :eval and :propertize forms
- in the value of that symbol will be ignored.
-For a list of the form `(:eval FORM)', FORM is evaluated and the result
- is used as a mode line element.  Be careful--FORM should not load any files,
- because that can cause an infinite recursion.
-For a list of the form `(:propertize ELT PROPS...)', ELT is displayed
- with the specified properties PROPS applied.
-For a list whose car is a symbol, the symbol's value is taken,
- and if that is non-nil, the cadr of the list is processed recursively.
- Otherwise, the caddr of the list (if there is one) is processed.
-For a list whose car is a string or list, each element is processed
- recursively and the results are effectively concatenated.
-For a list whose car is an integer, the cdr of the list is processed
-  and padded (if the number is positive) or truncated (if negative)
-  to the width specified by that number.
+
+For any symbol other than t or nil, the symbol's value is processed as
+ a mode line construct.  As a special exception, if that value is a
+ string, the string is processed verbatim, without handling any
+ %-constructs (see below).  Also, unless the symbol has a non-nil
+ `risky-local-variable' property, all properties in any strings, as
+ well as all :eval and :propertize forms in the value, are ignored.
+
+A list whose car is a string or list is processed by processing each
+ of the list elements recursively, as separate mode line constructs,
+ and concatenating the results.
+
+A list of the form `(:eval FORM)' is processed by evaluating FORM and
+ using the result as a mode line construct.  Be careful--FORM should
+ not load any files, because that can cause an infinite recursion.
+
+A list of the form `(:propertize ELT PROPS...)' is processed by
+ processing ELT as the mode line construct, and adding the text
+ properties PROPS to the result.
+
+A list whose car is a symbol is processed by examining the symbol's
+ value, and, if that value is non-nil, processing the cadr of the list
+ recursively; and if that value is nil, processing the caddr of the
+ list recursively.
+
+A list whose car is an integer is processed by processing the cadr of
+ the list, and padding (if the number is positive) or truncating (if
+ negative) to the width specified by that number.
+
 A string is printed verbatim in the mode line except for %-constructs:
-  (%-constructs are allowed when the string is the entire mode-line-format
-   or when it is found in a cons-cell or a list)
   %b -- print buffer name.      %f -- print visited file name.
   %F -- print frame name.
   %* -- print %, * or hyphen.   %+ -- print *, % or hyphen.
@@ -5397,7 +5380,7 @@ A string is printed verbatim in the mode line except for %-constructs:
 Decimal digits after the % specify field width to which to pad.  */);
 
   DEFVAR_BUFFER_DEFAULTS ("default-major-mode", major_mode,
-                         doc: /* *Value of `major-mode' for new buffers.  */);
+                         doc: /* Value of `major-mode' for new buffers.  */);
 
   DEFVAR_PER_BUFFER ("major-mode", &BVAR (current_buffer, major_mode),
                     make_number (Lisp_Symbol),
@@ -5428,25 +5411,25 @@ Use the command `abbrev-mode' to change this variable.  */);
 
   DEFVAR_PER_BUFFER ("case-fold-search", &BVAR (current_buffer, case_fold_search),
                     Qnil,
-                    doc: /* *Non-nil if searches and matches should ignore case.  */);
+                    doc: /* Non-nil if searches and matches should ignore case.  */);
 
   DEFVAR_PER_BUFFER ("fill-column", &BVAR (current_buffer, fill_column),
                     make_number (LISP_INT_TAG),
-                    doc: /* *Column beyond which automatic line-wrapping should happen.
+                    doc: /* Column beyond which automatic line-wrapping should happen.
 Interactively, you can set the buffer local value using \\[set-fill-column].  */);
 
   DEFVAR_PER_BUFFER ("left-margin", &BVAR (current_buffer, left_margin),
                     make_number (LISP_INT_TAG),
-                    doc: /* *Column for the default `indent-line-function' to indent to.
+                    doc: /* Column for the default `indent-line-function' to indent to.
 Linefeed indents to this column in Fundamental mode.  */);
 
   DEFVAR_PER_BUFFER ("tab-width", &BVAR (current_buffer, tab_width),
                     make_number (LISP_INT_TAG),
-                    doc: /* *Distance between tab stops (for display of tab characters), in columns.
+                    doc: /* Distance between tab stops (for display of tab characters), in columns.
 This should be an integer greater than zero.  */);
 
   DEFVAR_PER_BUFFER ("ctl-arrow", &BVAR (current_buffer, ctl_arrow), Qnil,
-                    doc: /* *Non-nil means display control chars with uparrow.
+                    doc: /* Non-nil means display control chars with uparrow.
 A value of nil means use backslash and octal digits.
 This variable does not apply to characters whose display is specified
 in the current display table (if there is one).  */);
@@ -5487,7 +5470,7 @@ This variable is never applied to a way of decoding a file while reading it.  */
 
   DEFVAR_PER_BUFFER ("bidi-paragraph-direction",
                     &BVAR (current_buffer, bidi_paragraph_direction), Qnil,
-                    doc: /* *If non-nil, forces directionality of text paragraphs in the buffer.
+                    doc: /* If non-nil, forces directionality of text paragraphs in the buffer.
 
 If this is nil (the default), the direction of each paragraph is
 determined by the first strong directional character of its text.
@@ -5498,7 +5481,7 @@ This variable has no effect unless the buffer's value of
 \`bidi-display-reordering' is non-nil.  */);
 
  DEFVAR_PER_BUFFER ("truncate-lines", &BVAR (current_buffer, truncate_lines), Qnil,
-                    doc: /* *Non-nil means do not display continuation lines.
+                    doc: /* Non-nil means do not display continuation lines.
 Instead, give each line of text just one screen line.
 
 Note that this is overridden by the variable
@@ -5508,7 +5491,7 @@ and this buffer is not full-frame width.
 Minibuffers set this variable to nil.  */);
 
   DEFVAR_PER_BUFFER ("word-wrap", &BVAR (current_buffer, word_wrap), Qnil,
-                    doc: /* *Non-nil means to use word-wrapping for continuation lines.
+                    doc: /* Non-nil means to use word-wrapping for continuation lines.
 When word-wrapping is on, continuation lines are wrapped at the space
 or tab character nearest to the right window edge.
 If nil, continuation lines are wrapped at the right screen edge.
@@ -5517,7 +5500,13 @@ This variable has no effect if long lines are truncated (see
 `truncate-lines' and `truncate-partial-width-windows').  If you use
 word-wrapping, you might want to reduce the value of
 `truncate-partial-width-windows', since wrapping can make text readable
-in narrower windows.  */);
+in narrower windows.
+
+Instead of setting this variable directly, most users should use
+Visual Line mode .  Visual Line mode, when enabled, sets `word-wrap'
+to t, and additionally redefines simple editing commands to act on
+visual lines rather than logical lines.  See the documentation of
+`visual-line-mode'.  */);
 
   DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
                     make_number (Lisp_String),
@@ -5574,12 +5563,10 @@ A value of t means that the character ^M makes itself and
 all the rest of the line invisible; also, when saving the buffer
 in a file, save the ^M as a newline.  */);
 
-#ifndef old
   DEFVAR_PER_BUFFER ("selective-display-ellipses",
                     &BVAR (current_buffer, selective_display_ellipses),
                     Qnil,
                     doc: /* Non-nil means display ... on previous line when a line is invisible.  */);
-#endif
 
   DEFVAR_PER_BUFFER ("overwrite-mode", &BVAR (current_buffer, overwrite_mode), Qnil,
                     doc: /* Non-nil if self-insertion should replace existing text.
@@ -5629,39 +5616,39 @@ See also the functions `display-table-slot' and `set-display-table-slot'.  */);
 
   DEFVAR_PER_BUFFER ("left-margin-width", &BVAR (current_buffer, left_margin_cols),
                     Qnil,
-                    doc: /* *Width of left marginal area for display of a buffer.
+                    doc: /* Width of left marginal area for display of a buffer.
 A value of nil means no marginal area.  */);
 
   DEFVAR_PER_BUFFER ("right-margin-width", &BVAR (current_buffer, right_margin_cols),
                     Qnil,
-                    doc: /* *Width of right marginal area for display of a buffer.
+                    doc: /* Width of right marginal area for display of a buffer.
 A value of nil means no marginal area.  */);
 
   DEFVAR_PER_BUFFER ("left-fringe-width", &BVAR (current_buffer, left_fringe_width),
                     Qnil,
-                    doc: /* *Width of this buffer's left fringe (in pixels).
+                    doc: /* Width of this buffer's left fringe (in pixels).
 A value of 0 means no left fringe is shown in this buffer's window.
 A value of nil means to use the left fringe width from the window's frame.  */);
 
   DEFVAR_PER_BUFFER ("right-fringe-width", &BVAR (current_buffer, right_fringe_width),
                     Qnil,
-                    doc: /* *Width of this buffer's right fringe (in pixels).
+                    doc: /* Width of this buffer's right fringe (in pixels).
 A value of 0 means no right fringe is shown in this buffer's window.
 A value of nil means to use the right fringe width from the window's frame.  */);
 
   DEFVAR_PER_BUFFER ("fringes-outside-margins", &BVAR (current_buffer, fringes_outside_margins),
                     Qnil,
-                    doc: /* *Non-nil means to display fringes outside display margins.
+                    doc: /* Non-nil means to display fringes outside display margins.
 A value of nil means to display fringes between margins and buffer text.  */);
 
   DEFVAR_PER_BUFFER ("scroll-bar-width", &BVAR (current_buffer, scroll_bar_width),
                     Qnil,
-                    doc: /* *Width of this buffer's scroll bars in pixels.
+                    doc: /* Width of this buffer's scroll bars in pixels.
 A value of nil means to use the scroll bar width from the window's frame.  */);
 
   DEFVAR_PER_BUFFER ("vertical-scroll-bar", &BVAR (current_buffer, vertical_scroll_bar_type),
                     Qnil,
-                    doc: /* *Position of this buffer's vertical scroll bar.
+                    doc: /* Position of this buffer's vertical scroll bar.
 The value takes effect whenever you tell a window to display this buffer;
 for instance, with `set-window-buffer' or when `display-buffer' displays it.
 
@@ -5671,13 +5658,13 @@ A value of t (the default) means do whatever the window's frame specifies.  */);
 
   DEFVAR_PER_BUFFER ("indicate-empty-lines",
                     &BVAR (current_buffer, indicate_empty_lines), Qnil,
-                    doc: /* *Visually indicate empty lines after the buffer end.
+                    doc: /* Visually indicate empty lines after the buffer end.
 If non-nil, a bitmap is displayed in the left fringe of a window on
 window-systems.  */);
 
   DEFVAR_PER_BUFFER ("indicate-buffer-boundaries",
                     &BVAR (current_buffer, indicate_buffer_boundaries), Qnil,
-                    doc: /* *Visually indicate buffer boundaries and scrolling.
+                    doc: /* Visually indicate buffer boundaries and scrolling.
 If non-nil, the first and last line of the buffer are marked in the fringe
 of a window on window-systems with angle bitmaps, or if the window can be
 scrolled, the top and bottom line of the window are marked with up and down
@@ -5702,7 +5689,7 @@ fringe, but no arrow bitmaps, use ((top .  left) (bottom . left)).  */);
 
   DEFVAR_PER_BUFFER ("fringe-indicator-alist",
                     &BVAR (current_buffer, fringe_indicator_alist), Qnil,
-                    doc: /* *Mapping from logical to physical fringe indicator bitmaps.
+                    doc: /* Mapping from logical to physical fringe indicator bitmaps.
 The value is an alist where each element (INDICATOR . BITMAPS)
 specifies the fringe bitmaps used to display a specific logical
 fringe indicator.
@@ -5721,7 +5708,7 @@ symbol which is used in both left and right fringes.  */);
 
   DEFVAR_PER_BUFFER ("fringe-cursor-alist",
                     &BVAR (current_buffer, fringe_cursor_alist), Qnil,
-                    doc: /* *Mapping from logical to physical fringe cursor bitmaps.
+                    doc: /* Mapping from logical to physical fringe cursor bitmaps.
 The value is an alist where each element (CURSOR . BITMAP)
 specifies the fringe bitmaps used to display a specific logical
 cursor type in the fringe.
@@ -5814,9 +5801,9 @@ An entry (TEXT . POSITION) represents the deletion of the string TEXT
 from (abs POSITION).  If POSITION is positive, point was at the front
 of the text being deleted; if negative, point was at the end.
 
-An entry (t HIGH . LOW) indicates that the buffer previously had
-\"unmodified\" status.  HIGH and LOW are the high and low 16-bit portions
-of the visited file's modification time, as of that time.  If the
+An entry (t HIGH LOW USEC PSEC) indicates that the buffer was previously
+unmodified; (HIGH LOW USEC PSEC) is in the same style as (current-time)
+and is the visited file's modification time, as of that time.  If the
 modification time of the most recent save is different, this entry is
 obsolete.
 
@@ -5885,7 +5872,7 @@ set when a file is visited.  */);
 
   DEFVAR_PER_BUFFER ("buffer-auto-save-file-format",
                     &BVAR (current_buffer, auto_save_file_format), Qnil,
-                    doc: /* *Format in which to write auto-save files.
+                    doc: /* Format in which to write auto-save files.
 Should be a list of symbols naming formats that are defined in `format-alist'.
 If it is t, which is the default, auto-save files are written in the
 same format as a regular save would use.  */);
@@ -5935,7 +5922,7 @@ Lisp programs may give this variable certain special values:
   Vtransient_mark_mode = Qnil;
 
   DEFVAR_LISP ("inhibit-read-only", Vinhibit_read_only,
-              doc: /* *Non-nil means disregard read-only status of buffers or characters.
+              doc: /* Non-nil means disregard read-only status of buffers or characters.
 If the value is t, disregard `buffer-read-only' and all `read-only'
 text properties.  If the value is a list, disregard `buffer-read-only'
 and disregard a `read-only' text property if the property value
@@ -5970,7 +5957,7 @@ to the default frame line height.  A value of nil means add no extra space.  */)
 
   DEFVAR_PER_BUFFER ("cursor-in-non-selected-windows",
                     &BVAR (current_buffer, cursor_in_non_selected_windows), Qnil,
-                    doc: /* *Non-nil means show a cursor in non-selected windows.
+                    doc: /* Non-nil means show a cursor in non-selected windows.
 If nil, only shows a cursor in the selected window.
 If t, displays a cursor related to the usual cursor type
 \(a solid box becomes hollow, a bar becomes a narrower bar).
@@ -5980,7 +5967,9 @@ Use Custom to set this variable and update the display."  */);
   DEFVAR_LISP ("kill-buffer-query-functions", Vkill_buffer_query_functions,
               doc: /* List of functions called with no args to query before killing a buffer.
 The buffer being killed will be current while the functions are running.
-If any of them returns nil, the buffer is not killed.  */);
+
+If any of them returns nil, the buffer is not killed.  Functions run by
+this hook are supposed to not change the current buffer.  */);
   Vkill_buffer_query_functions = Qnil;
 
   DEFVAR_LISP ("change-major-mode-hook", Vchange_major_mode_hook,
index 1635a847839b7c3d3e4254f2c59da7c53d41d449..4003be5c8c4be21137b0615ce4a1b15938373f38 100644 (file)
@@ -19,6 +19,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <sys/types.h> /* for off_t, time_t */
+#include "systime.h" /* for EMACS_TIME */
 
 /* Accessing the parameters of the current buffer.  */
 
@@ -245,12 +246,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define BUF_TEMP_SET_PT(buffer, position) \
   (temp_set_point ((buffer), (position)))
 
-extern void set_point (EMACS_INT);
-extern void temp_set_point (struct buffer *, EMACS_INT);
-extern void set_point_both (EMACS_INT, EMACS_INT);
+extern void set_point (ptrdiff_t);
+extern void temp_set_point (struct buffer *, ptrdiff_t);
+extern void set_point_both (ptrdiff_t, ptrdiff_t);
 extern void temp_set_point_both (struct buffer *,
-                                EMACS_INT, EMACS_INT);
-extern void enlarge_buffer_text (struct buffer *, EMACS_INT);
+                                ptrdiff_t, ptrdiff_t);
+extern void enlarge_buffer_text (struct buffer *, ptrdiff_t);
 
 \f
 /* Macros for setting the BEGV, ZV or PT of a given buffer.
@@ -355,28 +356,6 @@ while (0)
 
 #define FETCH_BYTE(n) *(BYTE_POS_ADDR ((n)))
 
-/* Variables used locally in FETCH_MULTIBYTE_CHAR.  */
-extern unsigned char *_fetch_multibyte_char_p;
-
-/* Return character code of multi-byte form at byte position POS.  If POS
-   doesn't point the head of valid multi-byte form, only the byte at
-   POS is returned.  No range checking.
-
-   WARNING: The character returned by this macro could be "unified"
-   inside STRING_CHAR, if the original character in the buffer belongs
-   to one of the Private Use Areas (PUAs) of codepoints that Emacs
-   uses to support non-unified CJK characters.  If that happens,
-   CHAR_BYTES will return a value that is different from the length of
-   the original multibyte sequence stored in the buffer.  Therefore,
-   do _not_ use FETCH_MULTIBYTE_CHAR if you need to advance through
-   the buffer to the next character after fetching this one.  Instead,
-   use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH.  */
-
-#define FETCH_MULTIBYTE_CHAR(pos)                                      \
-  (_fetch_multibyte_char_p = (((pos) >= GPT_BYTE ? GAP_SIZE : 0)       \
-                              + (pos) + BEG_ADDR - BEG_BYTE),          \
-   STRING_CHAR (_fetch_multibyte_char_p))
-
 /* Return character at byte position POS.  If the current buffer is unibyte
    and the character is not ASCII, make the returning character
    multibyte.  */
@@ -425,16 +404,6 @@ extern unsigned char *_fetch_multibyte_char_p;
 
 #define BUF_FETCH_BYTE(buf, n) \
   *(BUF_BYTE_ADDRESS ((buf), (n)))
-
-/* Return character code of multi-byte form at byte position POS in BUF.
-   If POS doesn't point the head of valid multi-byte form, only the byte at
-   POS is returned.  No range checking.  */
-
-#define BUF_FETCH_MULTIBYTE_CHAR(buf, pos)                             \
-  (_fetch_multibyte_char_p                                             \
-     = (((pos) >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0)         \
-        + (pos) + BUF_BEG_ADDR (buf) - BEG_BYTE),                      \
-   STRING_CHAR (_fetch_multibyte_char_p))
 \f
 /* Define the actual buffer data structures.  */
 
@@ -449,38 +418,38 @@ struct buffer_text
        into a buffer's text to functions that malloc.  */
     unsigned char *beg;
 
-    EMACS_INT gpt;             /* Char pos of gap in buffer.  */
-    EMACS_INT z;               /* Char pos of end of buffer.  */
-    EMACS_INT gpt_byte;                /* Byte pos of gap in buffer.  */
-    EMACS_INT z_byte;          /* Byte pos of end of buffer.  */
-    EMACS_INT gap_size;                /* Size of buffer's gap.  */
-    int modiff;                        /* This counts buffer-modification events
+    ptrdiff_t gpt;             /* Char pos of gap in buffer.  */
+    ptrdiff_t z;               /* Char pos of end of buffer.  */
+    ptrdiff_t gpt_byte;                /* Byte pos of gap in buffer.  */
+    ptrdiff_t z_byte;          /* Byte pos of end of buffer.  */
+    ptrdiff_t gap_size;                /* Size of buffer's gap.  */
+    EMACS_INT modiff;          /* This counts buffer-modification events
                                   for this buffer.  It is incremented for
                                   each such event, and never otherwise
                                   changed.  */
-    int chars_modiff;           /* This is modified with character change
+    EMACS_INT chars_modiff;    /* This is modified with character change
                                   events for this buffer.  It is set to
                                   modiff for each such event, and never
                                   otherwise changed.  */
-    int save_modiff;           /* Previous value of modiff, as of last
+    EMACS_INT save_modiff;     /* Previous value of modiff, as of last
                                   time buffer visited or saved a file.  */
 
-    int overlay_modiff;                /* Counts modifications to overlays.  */
+    EMACS_INT overlay_modiff;  /* Counts modifications to overlays.  */
 
     /* Minimum value of GPT - BEG since last redisplay that finished.  */
-    EMACS_INT beg_unchanged;
+    ptrdiff_t beg_unchanged;
 
     /* Minimum value of Z - GPT since last redisplay that finished.  */
-    EMACS_INT end_unchanged;
+    ptrdiff_t end_unchanged;
 
     /* MODIFF as of last redisplay that finished; if it matches MODIFF,
        beg_unchanged and end_unchanged contain no useful information.  */
-    int unchanged_modified;
+    EMACS_INT unchanged_modified;
 
     /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that
        finished; if it matches BUF_OVERLAY_MODIFF, beg_unchanged and
        end_unchanged contain no useful information.  */
-    int overlay_unchanged_modified;
+    EMACS_INT overlay_unchanged_modified;
 
     /* Properties of this buffer's text.  */
     INTERVAL intervals;
@@ -513,139 +482,26 @@ struct buffer_text
 
 struct buffer
 {
-  /* Everything before the `name' slot must be of a non-Lisp_Object type,
-     and every slot after `name' must be a Lisp_Object.
-
-     Check out mark_buffer (alloc.c) to see why.  */
-
-  /* HEADER.NEXT is the next buffer, in chain of all buffers,
-     including killed buffers.
-     This chain is used only for garbage collection, in order to
-     collect killed buffers properly.
-     Note that vectors and most pseudovectors are all on one chain,
-     but buffers are on a separate chain of their own.  */
+  /* HEADER.NEXT is the next buffer, in chain of all buffers, including killed
+     buffers.  This chain, starting from all_buffers, is used only for garbage
+     collection, in order to collect killed buffers properly.  Note that large
+     vectors and large pseudo-vector objects are all on another chain starting
+     from large_vectors.  */
   struct vectorlike_header header;
 
-  /* This structure holds the coordinates of the buffer contents
-     in ordinary buffers.  In indirect buffers, this is not used.  */
-  struct buffer_text own_text;
-
-  /* This points to the `struct buffer_text' that used for this buffer.
-     In an ordinary buffer, this is the own_text field above.
-     In an indirect buffer, this is the own_text field of another buffer.  */
-  struct buffer_text *text;
-
-  /* Char position of point in buffer.  */
-  EMACS_INT pt;
-  /* Byte position of point in buffer.  */
-  EMACS_INT pt_byte;
-  /* Char position of beginning of accessible range.  */
-  EMACS_INT begv;
-  /* Byte position of beginning of accessible range.  */
-  EMACS_INT begv_byte;
-  /* Char position of end of accessible range.  */
-  EMACS_INT zv;
-  /* Byte position of end of accessible range.  */
-  EMACS_INT zv_byte;
-
-  /* In an indirect buffer, this points to the base buffer.
-     In an ordinary buffer, it is 0.  */
-  struct buffer *base_buffer;
-
-  /* A non-zero value in slot IDX means that per-buffer variable
-     with index IDX has a local value in this buffer.  The index IDX
-     for a buffer-local variable is stored in that variable's slot
-     in buffer_local_flags as a Lisp integer.  If the index is -1,
-     this means the variable is always local in all buffers.  */
-#define MAX_PER_BUFFER_VARS 50
-  char local_flags[MAX_PER_BUFFER_VARS];
-
-  /* Set to the modtime of the visited file when read or written.
-     -1 means visited file was nonexistent.
-     0 means visited file modtime unknown; in no case complain
-     about any mismatch on next save attempt.  */
-  time_t modtime;
-  /* Size of the file when modtime was set.  This is used to detect the
-     case where the file grew while we were reading it, so the modtime
-     is still the same (since it's rounded up to seconds) but we're actually
-     not up-to-date.  -1 means the size is unknown.  Only meaningful if
-     modtime is actually set.  */
-  off_t modtime_size;
-  /* The value of text->modiff at the last auto-save.  */
-  int auto_save_modified;
-  /* The value of text->modiff at the last display error.
-     Redisplay of this buffer is inhibited until it changes again.  */
-  int display_error_modiff;
-  /* The time at which we detected a failure to auto-save,
-     Or 0 if we didn't have a failure.  */
-  time_t auto_save_failure_time;
-  /* Position in buffer at which display started
-     the last time this buffer was displayed.  */
-  EMACS_INT last_window_start;
-
-  /* Set nonzero whenever the narrowing is changed in this buffer.  */
-  int clip_changed;
-
-  /* If the long line scan cache is enabled (i.e. the buffer-local
-     variable cache-long-line-scans is non-nil), newline_cache
-     points to the newline cache, and width_run_cache points to the
-     width run cache.
-
-     The newline cache records which stretches of the buffer are
-     known *not* to contain newlines, so that they can be skipped
-     quickly when we search for newlines.
-
-     The width run cache records which stretches of the buffer are
-     known to contain characters whose widths are all the same.  If
-     the width run cache maps a character to a value > 0, that value is
-     the character's width; if it maps a character to zero, we don't
-     know what its width is.  This allows compute_motion to process
-     such regions very quickly, using algebra instead of inspecting
-     each character.   See also width_table, below.  */
-  struct region_cache *newline_cache;
-  struct region_cache *width_run_cache;
-
-  /* Non-zero means don't use redisplay optimizations for
-     displaying this buffer.  */
-  unsigned prevent_redisplay_optimizations_p : 1;
-
-  /* List of overlays that end at or before the current center,
-     in order of end-position.  */
-  struct Lisp_Overlay *overlays_before;
-
-  /* List of overlays that end after  the current center,
-     in order of start-position.  */
-  struct Lisp_Overlay *overlays_after;
-
-  /* Position where the overlay lists are centered.  */
-  EMACS_INT overlay_center;
-
-  /* Everything from here down must be a Lisp_Object.  */
-  /* buffer-local Lisp variables start at `undo_list',
-     tho only the ones from `name' on are GC'd normally.  */
-  #define FIRST_FIELD_PER_BUFFER undo_list
-
-  /* Changes in the buffer are recorded here for undo.
-     t means don't record anything.
-     This information belongs to the base buffer of an indirect buffer,
-     But we can't store it in the  struct buffer_text
-     because local variables have to be right in the  struct buffer.
-     So we copy it around in set_buffer_internal.
-     This comes before `name' because it is marked in a special way.  */
-  Lisp_Object BUFFER_INTERNAL_FIELD (undo_list);
-
   /* The name of this buffer.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (name);
 
   /* The name of the file visited in this buffer, or nil.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (filename);
-  /* Dir for expanding relative file names.  */
+
+  /* Directory for expanding relative file names.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (directory);
-  /* True if this buffer has been backed up (if you write to the
-     visited file and it hasn't been backed up, then a backup will
-     be made).  */
-  /* This isn't really used by the C code, so could be deleted.  */
+
+  /* True if this buffer has been backed up (if you write to the visited
+     file and it hasn't been backed up, then a backup will be made).  */
   Lisp_Object BUFFER_INTERNAL_FIELD (backed_up);
+
   /* Length of file when last read or saved.
      -1 means auto saving turned off because buffer shrank a lot.
      -2 means don't turn off auto saving if buffer shrinks.
@@ -653,6 +509,7 @@ struct buffer
      This is not in the  struct buffer_text
      because it's not used in indirect buffers at all.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (save_length);
+
   /* File name used for auto-saving this buffer.
      This is not in the  struct buffer_text
      because it's not used in indirect buffers at all.  */
@@ -660,6 +517,7 @@ struct buffer
 
   /* Non-nil if buffer read-only.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (read_only);
+
   /* "The mark".  This is a marker which may
      point into this buffer or may point nowhere.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (mark);
@@ -669,10 +527,12 @@ struct buffer
      symbols, just the symbol appears as the element.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (local_var_alist);
 
-  /* Symbol naming major mode (eg, lisp-mode).  */
+  /* Symbol naming major mode (e.g., lisp-mode).  */
   Lisp_Object BUFFER_INTERNAL_FIELD (major_mode);
-  /* Pretty name of major mode (eg, "Lisp"). */
+
+  /* Pretty name of major mode (e.g., "Lisp"). */
   Lisp_Object BUFFER_INTERNAL_FIELD (mode_name);
+
   /* Mode line element that controls format of mode line.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (mode_line_format);
 
@@ -682,10 +542,13 @@ struct buffer
 
   /* Keys that are bound local to this buffer.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (keymap);
+
   /* This buffer's local abbrev table.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_table);
+
   /* This buffer's syntax table.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (syntax_table);
+
   /* This buffer's category table.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (category_table);
 
@@ -696,48 +559,61 @@ struct buffer
   Lisp_Object BUFFER_INTERNAL_FIELD (tab_width);
   Lisp_Object BUFFER_INTERNAL_FIELD (fill_column);
   Lisp_Object BUFFER_INTERNAL_FIELD (left_margin);
+
   /* Function to call when insert space past fill column.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (auto_fill_function);
 
   /* Case table for case-conversion in this buffer.
      This char-table maps each char into its lower-case version.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (downcase_table);
+
   /* Char-table mapping each char to its upper-case version.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (upcase_table);
+
   /* Char-table for conversion for case-folding search.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (case_canon_table);
+
   /* Char-table of equivalences for case-folding search.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (case_eqv_table);
 
   /* Non-nil means do not display continuation lines.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (truncate_lines);
+
   /* Non-nil means to use word wrapping when displaying continuation lines.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (word_wrap);
+
   /* Non-nil means display ctl chars with uparrow.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (ctl_arrow);
+
   /* Non-nil means reorder bidirectional text for display in the
      visual order.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (bidi_display_reordering);
+
   /* If non-nil, specifies which direction of text to force in all the
      paragraphs of the buffer.  Nil means determine paragraph
      direction dynamically for each paragraph.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (bidi_paragraph_direction);
+
   /* Non-nil means do selective display;
      see doc string in syms_of_buffer (buffer.c) for details.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (selective_display);
-#ifndef old
+
   /* Non-nil means show ... at end of line followed by invisible lines.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (selective_display_ellipses);
-#endif
+
   /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (minor_modes);
+
   /* t if "self-insertion" should overwrite; `binary' if it should also
      overwrite newlines and tabs - for editing executables and the like.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (overwrite_mode);
-  /* non-nil means abbrev mode is on.  Expand abbrevs automatically.  */
+
+  /* Non-nil means abbrev mode is on.  Expand abbrevs automatically.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_mode);
+
   /* Display table to use for text in this buffer.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (display_table);
+
   /* t means the mark and region are currently active.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (mark_active);
 
@@ -804,11 +680,13 @@ struct buffer
 
   /* Widths of left and right marginal areas for windows displaying
      this buffer.  */
-  Lisp_Object BUFFER_INTERNAL_FIELD (left_margin_cols), BUFFER_INTERNAL_FIELD (right_margin_cols);
+  Lisp_Object BUFFER_INTERNAL_FIELD (left_margin_cols);
+  Lisp_Object BUFFER_INTERNAL_FIELD (right_margin_cols);
 
   /* Widths of left and right fringe areas for windows displaying
      this buffer.  */
-  Lisp_Object BUFFER_INTERNAL_FIELD (left_fringe_width), BUFFER_INTERNAL_FIELD (right_fringe_width);
+  Lisp_Object BUFFER_INTERNAL_FIELD (left_fringe_width);
+  Lisp_Object BUFFER_INTERNAL_FIELD (right_fringe_width);
 
   /* Non-nil means fringes are drawn outside display margins;
      othersize draw them between margin areas and text.  */
@@ -816,7 +694,8 @@ struct buffer
 
   /* Width and type of scroll bar areas for windows displaying
      this buffer.  */
-  Lisp_Object BUFFER_INTERNAL_FIELD (scroll_bar_width), BUFFER_INTERNAL_FIELD (vertical_scroll_bar_type);
+  Lisp_Object BUFFER_INTERNAL_FIELD (scroll_bar_width);
+  Lisp_Object BUFFER_INTERNAL_FIELD (vertical_scroll_bar_type);
 
   /* Non-nil means indicate lines not displaying text (in a style
      like vi).  */
@@ -854,13 +733,127 @@ struct buffer
      in the display of this buffer.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (extra_line_spacing);
 
-  /* *Cursor type to display in non-selected windows.
+  /* Cursor type to display in non-selected windows.
      t means to use hollow box cursor.
      See `cursor-type' for other values.  */
   Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows);
 
-  /* This must be the last field in the above list.  */
-  #define LAST_FIELD_PER_BUFFER cursor_in_non_selected_windows
+  /* No more Lisp_Object beyond this point.  Except undo_list,
+     which is handled specially in Fgarbage_collect .  */
+
+  /* This structure holds the coordinates of the buffer contents
+     in ordinary buffers.  In indirect buffers, this is not used.  */
+  struct buffer_text own_text;
+
+  /* This points to the `struct buffer_text' that used for this buffer.
+     In an ordinary buffer, this is the own_text field above.
+     In an indirect buffer, this is the own_text field of another buffer.  */
+  struct buffer_text *text;
+
+  /* Char position of point in buffer.  */
+  ptrdiff_t pt;
+
+  /* Byte position of point in buffer.  */
+  ptrdiff_t pt_byte;
+
+  /* Char position of beginning of accessible range.  */
+  ptrdiff_t begv;
+
+  /* Byte position of beginning of accessible range.  */
+  ptrdiff_t begv_byte;
+
+  /* Char position of end of accessible range.  */
+  ptrdiff_t zv;
+
+  /* Byte position of end of accessible range.  */
+  ptrdiff_t zv_byte;
+
+  /* In an indirect buffer, this points to the base buffer.
+     In an ordinary buffer, it is 0.  */
+  struct buffer *base_buffer;
+
+  /* A non-zero value in slot IDX means that per-buffer variable
+     with index IDX has a local value in this buffer.  The index IDX
+     for a buffer-local variable is stored in that variable's slot
+     in buffer_local_flags as a Lisp integer.  If the index is -1,
+     this means the variable is always local in all buffers.  */
+#define MAX_PER_BUFFER_VARS 50
+  char local_flags[MAX_PER_BUFFER_VARS];
+
+  /* Set to the modtime of the visited file when read or written.
+     EMACS_NSECS (modtime) == NONEXISTENT_MODTIME_NSECS means
+     visited file was nonexistent.  EMACS_NSECS (modtime) ==
+     UNKNOWN_MODTIME_NSECS means visited file modtime unknown;
+     in no case complain about any mismatch on next save attempt.  */
+#define NONEXISTENT_MODTIME_NSECS (-1)
+#define UNKNOWN_MODTIME_NSECS (-2)
+  EMACS_TIME modtime;
+
+  /* Size of the file when modtime was set.  This is used to detect the
+     case where the file grew while we were reading it, so the modtime
+     is still the same (since it's rounded up to seconds) but we're actually
+     not up-to-date.  -1 means the size is unknown.  Only meaningful if
+     modtime is actually set.  */
+  off_t modtime_size;
+
+  /* The value of text->modiff at the last auto-save.  */
+  EMACS_INT auto_save_modified;
+
+  /* The value of text->modiff at the last display error.
+     Redisplay of this buffer is inhibited until it changes again.  */
+  EMACS_INT display_error_modiff;
+
+  /* The time at which we detected a failure to auto-save,
+     Or 0 if we didn't have a failure.  */
+  time_t auto_save_failure_time;
+
+  /* Position in buffer at which display started
+     the last time this buffer was displayed.  */
+  ptrdiff_t last_window_start;
+
+  /* If the long line scan cache is enabled (i.e. the buffer-local
+     variable cache-long-line-scans is non-nil), newline_cache
+     points to the newline cache, and width_run_cache points to the
+     width run cache.
+
+     The newline cache records which stretches of the buffer are
+     known *not* to contain newlines, so that they can be skipped
+     quickly when we search for newlines.
+
+     The width run cache records which stretches of the buffer are
+     known to contain characters whose widths are all the same.  If
+     the width run cache maps a character to a value > 0, that value is
+     the character's width; if it maps a character to zero, we don't
+     know what its width is.  This allows compute_motion to process
+     such regions very quickly, using algebra instead of inspecting
+     each character.   See also width_table, below.  */
+  struct region_cache *newline_cache;
+  struct region_cache *width_run_cache;
+
+  /* Non-zero means don't use redisplay optimizations for
+     displaying this buffer.  */
+  unsigned prevent_redisplay_optimizations_p : 1;
+
+  /* Non-zero whenever the narrowing is changed in this buffer.  */
+  unsigned clip_changed : 1;
+
+  /* List of overlays that end at or before the current center,
+     in order of end-position.  */
+  struct Lisp_Overlay *overlays_before;
+
+  /* List of overlays that end after  the current center,
+     in order of start-position.  */
+  struct Lisp_Overlay *overlays_after;
+
+  /* Position where the overlay lists are centered.  */
+  ptrdiff_t overlay_center;
+
+  /* Changes in the buffer are recorded here for undo, and t means
+     don't record anything.  This information belongs to the base
+     buffer of an indirect buffer.  But we can't store it in the
+     struct buffer_text because local variables have to be right in
+     the struct buffer. So we copy it around in set_buffer_internal.  */
+  Lisp_Object BUFFER_INTERNAL_FIELD (undo_list);
 };
 
 \f
@@ -901,20 +894,21 @@ extern struct buffer buffer_local_symbols;
 \f
 extern void delete_all_overlays (struct buffer *);
 extern void reset_buffer (struct buffer *);
-extern void evaporate_overlays (EMACS_INT);
+extern void evaporate_overlays (ptrdiff_t);
 extern ptrdiff_t overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
-                             ptrdiff_t *len_ptr, EMACS_INT *next_ptr,
-                             EMACS_INT *prev_ptr, int change_req);
+                             ptrdiff_t *len_ptr, ptrdiff_t *next_ptr,
+                             ptrdiff_t *prev_ptr, int change_req);
 extern ptrdiff_t sort_overlays (Lisp_Object *, ptrdiff_t, struct window *);
-extern void recenter_overlay_lists (struct buffer *, EMACS_INT);
-extern EMACS_INT overlay_strings (EMACS_INT, struct window *, unsigned char **);
+extern void recenter_overlay_lists (struct buffer *, ptrdiff_t);
+extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **);
 extern void validate_region (Lisp_Object *, Lisp_Object *);
 extern void set_buffer_internal (struct buffer *);
 extern void set_buffer_internal_1 (struct buffer *);
 extern void set_buffer_temp (struct buffer *);
+extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object);
 extern void record_buffer (Lisp_Object);
-extern void buffer_slot_type_mismatch (Lisp_Object, int) NO_RETURN;
-extern void fix_overlays_before (struct buffer *, EMACS_INT, EMACS_INT);
+extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int);
+extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t);
 extern void mmap_set_vars (int);
 
 /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
@@ -923,34 +917,59 @@ extern void mmap_set_vars (int);
 
 #define GET_OVERLAYS_AT(posn, overlays, noverlays, nextp, chrq)                \
   do {                                                                 \
-    ptrdiff_t maxlen = 40;                                                     \
-    overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
+    ptrdiff_t maxlen = 40;                                             \
+    overlays = alloca (maxlen * sizeof *overlays);                     \
     noverlays = overlays_at (posn, 0, &overlays, &maxlen,              \
-                            nextp, NULL, chrq);                                \
+                            nextp, NULL, chrq);                        \
     if (noverlays > maxlen)                                            \
       {                                                                        \
        maxlen = noverlays;                                             \
-       overlays = (Lisp_Object *) alloca (maxlen * sizeof (Lisp_Object)); \
+       overlays = alloca (maxlen * sizeof *overlays);                  \
        noverlays = overlays_at (posn, 0, &overlays, &maxlen,           \
                                 nextp, NULL, chrq);                    \
       }                                                                        \
   } while (0)
 
-EXFUN (Fbuffer_live_p, 1);
-EXFUN (Fbuffer_name, 1);
-EXFUN (Fnext_overlay_change, 1);
-EXFUN (Fbuffer_local_value, 2);
-
 extern Lisp_Object Qbefore_change_functions;
 extern Lisp_Object Qafter_change_functions;
 extern Lisp_Object Qfirst_change_hook;
-
 \f
-/* Overlays */
+/* Return character code of multi-byte form at byte position POS.  If POS
+   doesn't point the head of valid multi-byte form, only the byte at
+   POS is returned.  No range checking.
+
+   WARNING: The character returned by this macro could be "unified"
+   inside STRING_CHAR, if the original character in the buffer belongs
+   to one of the Private Use Areas (PUAs) of codepoints that Emacs
+   uses to support non-unified CJK characters.  If that happens,
+   CHAR_BYTES will return a value that is different from the length of
+   the original multibyte sequence stored in the buffer.  Therefore,
+   do _not_ use FETCH_MULTIBYTE_CHAR if you need to advance through
+   the buffer to the next character after fetching this one.  Instead,
+   use either FETCH_CHAR_ADVANCE or STRING_CHAR_AND_LENGTH.  */
 
-/* 1 if the OV is an overlay object.  */
+static inline int
+FETCH_MULTIBYTE_CHAR (ptrdiff_t pos)
+{
+  unsigned char *p = ((pos >= GPT_BYTE ? GAP_SIZE : 0)
+                     + pos + BEG_ADDR - BEG_BYTE);
+  return STRING_CHAR (p);
+}
 
-#define OVERLAY_VALID(OV) (OVERLAYP (OV))
+/* Return character code of multi-byte form at byte position POS in BUF.
+   If POS doesn't point the head of valid multi-byte form, only the byte at
+   POS is returned.  No range checking.  */
+
+static inline int
+BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos)
+{
+  unsigned char *p
+    = ((pos >= BUF_GPT_BYTE (buf) ? BUF_GAP_SIZE (buf) : 0)
+       + pos + BUF_BEG_ADDR (buf) - BEG_BYTE);
+  return STRING_CHAR (p);
+}
+\f
+/* Overlays */
 
 /* Return the marker that stands for where OV starts in the buffer.  */
 
@@ -985,6 +1004,15 @@ extern int last_per_buffer_idx;
 #define PER_BUFFER_VAR_OFFSET(VAR) \
   offsetof (struct buffer, BUFFER_INTERNAL_FIELD (VAR))
 
+/* Used to iterate over normal Lisp_Object fields of struct buffer (all
+   Lisp_Objects except undo_list).  If you add, remove, or reorder
+   Lisp_Objects in a struct buffer, make sure that this is still correct.  */
+
+#define for_each_per_buffer_object_at(offset)                           \
+  for (offset = PER_BUFFER_VAR_OFFSET (name);                           \
+       offset <= PER_BUFFER_VAR_OFFSET (cursor_in_non_selected_windows); \
+       offset += sizeof (Lisp_Object))
+
 /* Return the index of buffer-local variable VAR.  Each per-buffer
    variable has an index > 0 associated with it, except when it always
    has buffer-local values, in which case the index is -1.  If this is
index 6f945723d386301ee0fe9051bc25b77ca6a659b2..acdf809971f0f7f8ec09b9462c00b8589a9080ba 100644 (file)
@@ -35,8 +35,8 @@ by Hallvard:
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "syntax.h"
 #include "window.h"
 
@@ -54,25 +54,33 @@ by Hallvard:
 /* #define BYTE_CODE_SAFE */
 /* #define BYTE_CODE_METER */
 
+/* If BYTE_CODE_THREADED is defined, then the interpreter will be
+   indirect threaded, using GCC's computed goto extension.  This code,
+   as currently implemented, is incompatible with BYTE_CODE_SAFE and
+   BYTE_CODE_METER.  */
+#if defined (__GNUC__) && !defined (BYTE_CODE_SAFE) && !defined (BYTE_CODE_METER)
+#define BYTE_CODE_THREADED
+#endif
+
 \f
 #ifdef BYTE_CODE_METER
 
 Lisp_Object Qbyte_code_meter;
-#define METER_2(code1, code2) \
-  XFASTINT (XVECTOR (XVECTOR (Vbyte_code_meter)->contents[(code1)]) \
-           ->contents[(code2)])
-
-#define METER_1(code) METER_2 (0, (code))
+#define METER_2(code1, code2) AREF (AREF (Vbyte_code_meter, code1), code2)
+#define METER_1(code) METER_2 (0, code)
 
 #define METER_CODE(last_code, this_code)                               \
 {                                                                      \
   if (byte_metering_on)                                                        \
     {                                                                  \
-      if (METER_1 (this_code) < MOST_POSITIVE_FIXNUM)                  \
-        METER_1 (this_code)++;                                         \
+      if (XFASTINT (METER_1 (this_code)) < MOST_POSITIVE_FIXNUM)       \
+        XSETFASTINT (METER_1 (this_code),                              \
+                    XFASTINT (METER_1 (this_code)) + 1);               \
       if (last_code                                                    \
-         && METER_2 (last_code, this_code) < MOST_POSITIVE_FIXNUM)     \
-        METER_2 (last_code, this_code)++;                              \
+         && (XFASTINT (METER_2 (last_code, this_code))                 \
+             < MOST_POSITIVE_FIXNUM))                                  \
+        XSETFASTINT (METER_2 (last_code, this_code),                   \
+                    XFASTINT (METER_2 (last_code, this_code)) + 1);    \
     }                                                                  \
 }
 
@@ -83,158 +91,204 @@ Lisp_Object Qbytecode;
 
 /*  Byte codes: */
 
-#define Bstack_ref 0 /* Actually, Bstack_ref+0 is not implemented: use dup.  */
-#define Bvarref 010
-#define Bvarset 020
-#define Bvarbind 030
-#define Bcall 040
-#define Bunbind 050
-
-#define Bnth 070
-#define Bsymbolp 071
-#define Bconsp 072
-#define Bstringp 073
-#define Blistp 074
-#define Beq 075
-#define Bmemq 076
-#define Bnot 077
-#define Bcar 0100
-#define Bcdr 0101
-#define Bcons 0102
-#define Blist1 0103
-#define Blist2 0104
-#define Blist3 0105
-#define Blist4 0106
-#define Blength 0107
-#define Baref 0110
-#define Baset 0111
-#define Bsymbol_value 0112
-#define Bsymbol_function 0113
-#define Bset 0114
-#define Bfset 0115
-#define Bget 0116
-#define Bsubstring 0117
-#define Bconcat2 0120
-#define Bconcat3 0121
-#define Bconcat4 0122
-#define Bsub1 0123
-#define Badd1 0124
-#define Beqlsign 0125
-#define Bgtr 0126
-#define Blss 0127
-#define Bleq 0130
-#define Bgeq 0131
-#define Bdiff 0132
-#define Bnegate 0133
-#define Bplus 0134
-#define Bmax 0135
-#define Bmin 0136
-#define Bmult 0137
-
-#define Bpoint 0140
-/* Was Bmark in v17.  */
-#define Bsave_current_buffer 0141 /* Obsolete.  */
-#define Bgoto_char 0142
-#define Binsert 0143
-#define Bpoint_max 0144
-#define Bpoint_min 0145
-#define Bchar_after 0146
-#define Bfollowing_char 0147
-#define Bpreceding_char 0150
-#define Bcurrent_column 0151
-#define Bindent_to 0152
-#ifdef BYTE_CODE_SAFE
-#define Bscan_buffer 0153 /* No longer generated as of v18.  */
-#endif
-#define Beolp 0154
-#define Beobp 0155
-#define Bbolp 0156
-#define Bbobp 0157
-#define Bcurrent_buffer 0160
-#define Bset_buffer 0161
-#define Bsave_current_buffer_1 0162 /* Replacing Bsave_current_buffer.  */
-#if 0
-#define Bread_char 0162 /* No longer generated as of v19 */
-#endif
+#define BYTE_CODES                                                     \
+DEFINE (Bstack_ref, 0) /* Actually, Bstack_ref+0 is not implemented: use dup.  */ \
+DEFINE (Bstack_ref1, 1)                                                        \
+DEFINE (Bstack_ref2, 2)                                                        \
+DEFINE (Bstack_ref3, 3)                                                        \
+DEFINE (Bstack_ref4, 4)                                                        \
+DEFINE (Bstack_ref5, 5)                                                        \
+DEFINE (Bstack_ref6, 6)                                                        \
+DEFINE (Bstack_ref7, 7)                                                        \
+DEFINE (Bvarref, 010)                                                  \
+DEFINE (Bvarref1, 011)                                                 \
+DEFINE (Bvarref2, 012)                                                 \
+DEFINE (Bvarref3, 013)                                                 \
+DEFINE (Bvarref4, 014)                                                 \
+DEFINE (Bvarref5, 015)                                                 \
+DEFINE (Bvarref6, 016)                                                 \
+DEFINE (Bvarref7, 017)                                                 \
+DEFINE (Bvarset, 020)                                                  \
+DEFINE (Bvarset1, 021)                                                 \
+DEFINE (Bvarset2, 022)                                                 \
+DEFINE (Bvarset3, 023)                                                 \
+DEFINE (Bvarset4, 024)                                                 \
+DEFINE (Bvarset5, 025)                                                 \
+DEFINE (Bvarset6, 026)                                                 \
+DEFINE (Bvarset7, 027)                                                 \
+DEFINE (Bvarbind, 030)                                                 \
+DEFINE (Bvarbind1, 031)                                                        \
+DEFINE (Bvarbind2, 032)                                                        \
+DEFINE (Bvarbind3, 033)                                                        \
+DEFINE (Bvarbind4, 034)                                                        \
+DEFINE (Bvarbind5, 035)                                                        \
+DEFINE (Bvarbind6, 036)                                                        \
+DEFINE (Bvarbind7, 037)                                                        \
+DEFINE (Bcall, 040)                                                    \
+DEFINE (Bcall1, 041)                                                   \
+DEFINE (Bcall2, 042)                                                   \
+DEFINE (Bcall3, 043)                                                   \
+DEFINE (Bcall4, 044)                                                   \
+DEFINE (Bcall5, 045)                                                   \
+DEFINE (Bcall6, 046)                                                   \
+DEFINE (Bcall7, 047)                                                   \
+DEFINE (Bunbind, 050)                                                  \
+DEFINE (Bunbind1, 051)                                                 \
+DEFINE (Bunbind2, 052)                                                 \
+DEFINE (Bunbind3, 053)                                                 \
+DEFINE (Bunbind4, 054)                                                 \
+DEFINE (Bunbind5, 055)                                                 \
+DEFINE (Bunbind6, 056)                                                 \
+DEFINE (Bunbind7, 057)                                                 \
+                                                                       \
+DEFINE (Bnth, 070)                                                     \
+DEFINE (Bsymbolp, 071)                                                 \
+DEFINE (Bconsp, 072)                                                   \
+DEFINE (Bstringp, 073)                                                 \
+DEFINE (Blistp, 074)                                                   \
+DEFINE (Beq, 075)                                                      \
+DEFINE (Bmemq, 076)                                                    \
+DEFINE (Bnot, 077)                                                     \
+DEFINE (Bcar, 0100)                                                    \
+DEFINE (Bcdr, 0101)                                                    \
+DEFINE (Bcons, 0102)                                                   \
+DEFINE (Blist1, 0103)                                                  \
+DEFINE (Blist2, 0104)                                                  \
+DEFINE (Blist3, 0105)                                                  \
+DEFINE (Blist4, 0106)                                                  \
+DEFINE (Blength, 0107)                                                 \
+DEFINE (Baref, 0110)                                                   \
+DEFINE (Baset, 0111)                                                   \
+DEFINE (Bsymbol_value, 0112)                                           \
+DEFINE (Bsymbol_function, 0113)                                                \
+DEFINE (Bset, 0114)                                                    \
+DEFINE (Bfset, 0115)                                                   \
+DEFINE (Bget, 0116)                                                    \
+DEFINE (Bsubstring, 0117)                                              \
+DEFINE (Bconcat2, 0120)                                                        \
+DEFINE (Bconcat3, 0121)                                                        \
+DEFINE (Bconcat4, 0122)                                                        \
+DEFINE (Bsub1, 0123)                                                   \
+DEFINE (Badd1, 0124)                                                   \
+DEFINE (Beqlsign, 0125)                                                        \
+DEFINE (Bgtr, 0126)                                                    \
+DEFINE (Blss, 0127)                                                    \
+DEFINE (Bleq, 0130)                                                    \
+DEFINE (Bgeq, 0131)                                                    \
+DEFINE (Bdiff, 0132)                                                   \
+DEFINE (Bnegate, 0133)                                                 \
+DEFINE (Bplus, 0134)                                                   \
+DEFINE (Bmax, 0135)                                                    \
+DEFINE (Bmin, 0136)                                                    \
+DEFINE (Bmult, 0137)                                                   \
+                                                                       \
+DEFINE (Bpoint, 0140)                                                  \
+/* Was Bmark in v17.  */                                               \
+DEFINE (Bsave_current_buffer, 0141) /* Obsolete.  */                   \
+DEFINE (Bgoto_char, 0142)                                              \
+DEFINE (Binsert, 0143)                                                 \
+DEFINE (Bpoint_max, 0144)                                              \
+DEFINE (Bpoint_min, 0145)                                              \
+DEFINE (Bchar_after, 0146)                                             \
+DEFINE (Bfollowing_char, 0147)                                         \
+DEFINE (Bpreceding_char, 0150)                                         \
+DEFINE (Bcurrent_column, 0151)                                         \
+DEFINE (Bindent_to, 0152)                                              \
+DEFINE (Beolp, 0154)                                                   \
+DEFINE (Beobp, 0155)                                                   \
+DEFINE (Bbolp, 0156)                                                   \
+DEFINE (Bbobp, 0157)                                                   \
+DEFINE (Bcurrent_buffer, 0160)                                         \
+DEFINE (Bset_buffer, 0161)                                             \
+DEFINE (Bsave_current_buffer_1, 0162) /* Replacing Bsave_current_buffer.  */ \
+DEFINE (Binteractive_p, 0164) /* Obsolete since Emacs-24.1.  */                \
+                                                                       \
+DEFINE (Bforward_char, 0165)                                           \
+DEFINE (Bforward_word, 0166)                                           \
+DEFINE (Bskip_chars_forward, 0167)                                     \
+DEFINE (Bskip_chars_backward, 0170)                                    \
+DEFINE (Bforward_line, 0171)                                           \
+DEFINE (Bchar_syntax, 0172)                                            \
+DEFINE (Bbuffer_substring, 0173)                                       \
+DEFINE (Bdelete_region, 0174)                                          \
+DEFINE (Bnarrow_to_region, 0175)                                       \
+DEFINE (Bwiden, 0176)                                                  \
+DEFINE (Bend_of_line, 0177)                                            \
+                                                                       \
+DEFINE (Bconstant2, 0201)                                              \
+DEFINE (Bgoto, 0202)                                                   \
+DEFINE (Bgotoifnil, 0203)                                              \
+DEFINE (Bgotoifnonnil, 0204)                                           \
+DEFINE (Bgotoifnilelsepop, 0205)                                       \
+DEFINE (Bgotoifnonnilelsepop, 0206)                                    \
+DEFINE (Breturn, 0207)                                                 \
+DEFINE (Bdiscard, 0210)                                                        \
+DEFINE (Bdup, 0211)                                                    \
+                                                                       \
+DEFINE (Bsave_excursion, 0212)                                         \
+DEFINE (Bsave_window_excursion, 0213) /* Obsolete since Emacs-24.1.  */        \
+DEFINE (Bsave_restriction, 0214)                                       \
+DEFINE (Bcatch, 0215)                                                  \
+                                                                       \
+DEFINE (Bunwind_protect, 0216)                                         \
+DEFINE (Bcondition_case, 0217)                                         \
+DEFINE (Btemp_output_buffer_setup, 0220) /* Obsolete since Emacs-24.1.  */ \
+DEFINE (Btemp_output_buffer_show, 0221)  /* Obsolete since Emacs-24.1.  */ \
+                                                                       \
+DEFINE (Bunbind_all, 0222)     /* Obsolete.  Never used.  */           \
+                                                                       \
+DEFINE (Bset_marker, 0223)                                             \
+DEFINE (Bmatch_beginning, 0224)                                                \
+DEFINE (Bmatch_end, 0225)                                              \
+DEFINE (Bupcase, 0226)                                                 \
+DEFINE (Bdowncase, 0227)                                               \
+                                                                       \
+DEFINE (Bstringeqlsign, 0230)                                          \
+DEFINE (Bstringlss, 0231)                                              \
+DEFINE (Bequal, 0232)                                                  \
+DEFINE (Bnthcdr, 0233)                                                 \
+DEFINE (Belt, 0234)                                                    \
+DEFINE (Bmember, 0235)                                                 \
+DEFINE (Bassq, 0236)                                                   \
+DEFINE (Bnreverse, 0237)                                               \
+DEFINE (Bsetcar, 0240)                                                 \
+DEFINE (Bsetcdr, 0241)                                                 \
+DEFINE (Bcar_safe, 0242)                                               \
+DEFINE (Bcdr_safe, 0243)                                               \
+DEFINE (Bnconc, 0244)                                                  \
+DEFINE (Bquo, 0245)                                                    \
+DEFINE (Brem, 0246)                                                    \
+DEFINE (Bnumberp, 0247)                                                        \
+DEFINE (Bintegerp, 0250)                                               \
+                                                                       \
+DEFINE (BRgoto, 0252)                                                  \
+DEFINE (BRgotoifnil, 0253)                                             \
+DEFINE (BRgotoifnonnil, 0254)                                          \
+DEFINE (BRgotoifnilelsepop, 0255)                                      \
+DEFINE (BRgotoifnonnilelsepop, 0256)                                   \
+                                                                       \
+DEFINE (BlistN, 0257)                                                  \
+DEFINE (BconcatN, 0260)                                                        \
+DEFINE (BinsertN, 0261)                                                        \
+                                                                       \
+/* Bstack_ref is code 0.  */                                           \
+DEFINE (Bstack_set,  0262)                                             \
+DEFINE (Bstack_set2, 0263)                                             \
+DEFINE (BdiscardN,   0266)                                             \
+                                                                       \
+DEFINE (Bconstant, 0300)
+
+enum byte_code_op
+{
+#define DEFINE(name, value) name = value,
+    BYTE_CODES
+#undef DEFINE
+
 #ifdef BYTE_CODE_SAFE
-#define Bset_mark 0163 /* this loser is no longer generated as of v18 */
+    Bscan_buffer = 0153, /* No longer generated as of v18.  */
+    Bset_mark = 0163 /* this loser is no longer generated as of v18 */
 #endif
-#define Binteractive_p 0164 /* Obsolete since Emacs-24.1.  */
-
-#define Bforward_char 0165
-#define Bforward_word 0166
-#define Bskip_chars_forward 0167
-#define Bskip_chars_backward 0170
-#define Bforward_line 0171
-#define Bchar_syntax 0172
-#define Bbuffer_substring 0173
-#define Bdelete_region 0174
-#define Bnarrow_to_region 0175
-#define Bwiden 0176
-#define Bend_of_line 0177
-
-#define Bconstant2 0201
-#define Bgoto 0202
-#define Bgotoifnil 0203
-#define Bgotoifnonnil 0204
-#define Bgotoifnilelsepop 0205
-#define Bgotoifnonnilelsepop 0206
-#define Breturn 0207
-#define Bdiscard 0210
-#define Bdup 0211
-
-#define Bsave_excursion 0212
-#define Bsave_window_excursion 0213 /* Obsolete since Emacs-24.1.  */
-#define Bsave_restriction 0214
-#define Bcatch 0215
-
-#define Bunwind_protect 0216
-#define Bcondition_case 0217
-#define Btemp_output_buffer_setup 0220 /* Obsolete since Emacs-24.1.  */
-#define Btemp_output_buffer_show 0221  /* Obsolete since Emacs-24.1.  */
-
-#define Bunbind_all 0222       /* Obsolete.  Never used.  */
-
-#define Bset_marker 0223
-#define Bmatch_beginning 0224
-#define Bmatch_end 0225
-#define Bupcase 0226
-#define Bdowncase 0227
-
-#define Bstringeqlsign 0230
-#define Bstringlss 0231
-#define Bequal 0232
-#define Bnthcdr 0233
-#define Belt 0234
-#define Bmember 0235
-#define Bassq 0236
-#define Bnreverse 0237
-#define Bsetcar 0240
-#define Bsetcdr 0241
-#define Bcar_safe 0242
-#define Bcdr_safe 0243
-#define Bnconc 0244
-#define Bquo 0245
-#define Brem 0246
-#define Bnumberp 0247
-#define Bintegerp 0250
-
-#define BRgoto 0252
-#define BRgotoifnil 0253
-#define BRgotoifnonnil 0254
-#define BRgotoifnilelsepop 0255
-#define BRgotoifnonnilelsepop 0256
-
-#define BlistN 0257
-#define BconcatN 0260
-#define BinsertN 0261
-
-/* Bstack_ref is code 0.  */
-#define Bstack_set  0262
-#define Bstack_set2 0263
-#define BdiscardN   0266
-
-#define Bconstant 0300
+};
 
 /* Whether to maintain a `top' and `bottom' field in the stack frame.  */
 #define BYTE_MAINTAIN_TOP (BYTE_CODE_SAFE || BYTE_MARK_STACK)
@@ -318,7 +372,7 @@ unmark_byte_stack (void)
     {
       if (stack->byte_string_start != SDATA (stack->byte_string))
        {
-         int offset = stack->pc - stack->byte_string_start;
+         ptrdiff_t offset = stack->pc - stack->byte_string_start;
          stack->byte_string_start = SDATA (stack->byte_string);
          stack->pc = stack->byte_string_start + offset;
        }
@@ -435,7 +489,7 @@ Lisp_Object
 exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 #ifdef BYTE_CODE_METER
   int this_op = 0;
   int prev_op;
@@ -446,7 +500,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
 #ifdef BYTE_CODE_SAFE
   ptrdiff_t const_length;
   Lisp_Object *stacke;
-  int bytestr_length;
+  ptrdiff_t bytestr_length;
 #endif
   struct byte_stack stack;
   Lisp_Object *top;
@@ -486,15 +540,13 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
   stack.byte_string = bytestr;
   stack.pc = stack.byte_string_start = SDATA (bytestr);
   stack.constants = vector;
-  if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) < XFASTINT (maxdepth))
+  if (MAX_ALLOCA / sizeof (Lisp_Object) <= XFASTINT (maxdepth))
     memory_full (SIZE_MAX);
-  top = (Lisp_Object *) alloca (XFASTINT (maxdepth)
-                                         * sizeof (Lisp_Object));
+  top = alloca ((XFASTINT (maxdepth) + 1) * sizeof *top);
 #if BYTE_MAINTAIN_TOP
-  stack.bottom = top;
+  stack.bottom = top + 1;
   stack.top = NULL;
 #endif
-  top -= 1;
   stack.next = byte_stack_list;
   byte_stack_list = &stack;
 
@@ -562,27 +614,93 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
       this_op = op = FETCH;
       METER_CODE (prev_op, op);
 #else
+#ifndef BYTE_CODE_THREADED
       op = FETCH;
+#endif
 #endif
 
-      switch (op)
+      /* The interpreter can be compiled one of two ways: as an
+        ordinary switch-based interpreter, or as a threaded
+        interpreter.  The threaded interpreter relies on GCC's
+        computed goto extension, so it is not available everywhere.
+        Threading provides a performance boost.  These macros are how
+        we allow the code to be compiled both ways.  */
+#ifdef BYTE_CODE_THREADED
+      /* The CASE macro introduces an instruction's body.  It is
+        either a label or a case label.  */
+#define CASE(OP) insn_ ## OP
+      /* NEXT is invoked at the end of an instruction to go to the
+        next instruction.  It is either a computed goto, or a
+        plain break.  */
+#define NEXT goto *(targets[op = FETCH])
+      /* FIRST is like NEXT, but is only used at the start of the
+        interpreter body.  In the switch-based interpreter it is the
+        switch, so the threaded definition must include a semicolon.  */
+#define FIRST NEXT;
+      /* Most cases are labeled with the CASE macro, above.
+        CASE_DEFAULT is one exception; it is used if the interpreter
+        being built requires a default case.  The threaded
+        interpreter does not, because the dispatch table is
+        completely filled.  */
+#define CASE_DEFAULT
+      /* This introduces an instruction that is known to call abort.  */
+#define CASE_ABORT CASE (Bstack_ref): CASE (default)
+#else
+      /* See above for the meaning of the various defines.  */
+#define CASE(OP) case OP
+#define NEXT break
+#define FIRST switch (op)
+#define CASE_DEFAULT case 255: default:
+#define CASE_ABORT case 0
+#endif
+
+#ifdef BYTE_CODE_THREADED
+
+      /* A convenience define that saves us a lot of typing and makes
+        the table clearer.  */
+#define LABEL(OP) [OP] = &&insn_ ## OP
+
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Woverride-init"
+#endif
+
+      /* This is the dispatch table for the threaded interpreter.  */
+      static const void *const targets[256] =
        {
-       case Bvarref + 7:
+         [0 ... (Bconstant - 1)] = &&insn_default,
+         [Bconstant ... 255] = &&insn_Bconstant,
+
+#define DEFINE(name, value) LABEL (name) ,
+         BYTE_CODES
+#undef DEFINE
+       };
+
+#if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic pop
+#endif
+
+#endif
+
+
+      FIRST
+       {
+       CASE (Bvarref7):
          op = FETCH2;
          goto varref;
 
-       case Bvarref:
-       case Bvarref + 1:
-       case Bvarref + 2:
-       case Bvarref + 3:
-       case Bvarref + 4:
-       case Bvarref + 5:
+       CASE (Bvarref):
+       CASE (Bvarref1):
+       CASE (Bvarref2):
+       CASE (Bvarref3):
+       CASE (Bvarref4):
+       CASE (Bvarref5):
          op = op - Bvarref;
          goto varref;
 
        /* This seems to be the most frequently executed byte-code
           among the Bvarref's, so avoid a goto here.  */
-       case Bvarref+6:
+       CASE (Bvarref6):
          op = FETCH;
        varref:
          {
@@ -607,10 +725,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                AFTER_POTENTIAL_GC ();
              }
            PUSH (v2);
-           break;
+           NEXT;
          }
 
-       case Bgotoifnil:
+       CASE (Bgotoifnil):
          {
            Lisp_Object v1;
            MAYBE_GC ();
@@ -622,10 +740,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                CHECK_RANGE (op);
                stack.pc = stack.byte_string_start + op;
              }
-           break;
+           NEXT;
          }
 
-       case Bcar:
+       CASE (Bcar):
          {
            Lisp_Object v1;
            v1 = TOP;
@@ -639,28 +757,28 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                wrong_type_argument (Qlistp, v1);
                AFTER_POTENTIAL_GC ();
              }
-           break;
+           NEXT;
          }
 
-       case Beq:
+       CASE (Beq):
          {
            Lisp_Object v1;
            v1 = POP;
            TOP = EQ (v1, TOP) ? Qt : Qnil;
-           break;
+           NEXT;
          }
 
-       case Bmemq:
+       CASE (Bmemq):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fmemq (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bcdr:
+       CASE (Bcdr):
          {
            Lisp_Object v1;
            v1 = TOP;
@@ -674,24 +792,23 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                wrong_type_argument (Qlistp, v1);
                AFTER_POTENTIAL_GC ();
              }
-           break;
-           break;
+           NEXT;
          }
 
-       case Bvarset:
-       case Bvarset+1:
-       case Bvarset+2:
-       case Bvarset+3:
-       case Bvarset+4:
-       case Bvarset+5:
+       CASE (Bvarset):
+       CASE (Bvarset1):
+       CASE (Bvarset2):
+       CASE (Bvarset3):
+       CASE (Bvarset4):
+       CASE (Bvarset5):
          op -= Bvarset;
          goto varset;
 
-       case Bvarset+7:
+       CASE (Bvarset7):
          op = FETCH2;
          goto varset;
 
-       case Bvarset+6:
+       CASE (Bvarset6):
          op = FETCH;
        varset:
          {
@@ -714,54 +831,54 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              }
          }
          (void) POP;
-         break;
+         NEXT;
 
-       case Bdup:
+       CASE (Bdup):
          {
            Lisp_Object v1;
            v1 = TOP;
            PUSH (v1);
-           break;
+           NEXT;
          }
 
        /* ------------------ */
 
-       case Bvarbind+6:
+       CASE (Bvarbind6):
          op = FETCH;
          goto varbind;
 
-       case Bvarbind+7:
+       CASE (Bvarbind7):
          op = FETCH2;
          goto varbind;
 
-       case Bvarbind:
-       case Bvarbind+1:
-       case Bvarbind+2:
-       case Bvarbind+3:
-       case Bvarbind+4:
-       case Bvarbind+5:
+       CASE (Bvarbind):
+       CASE (Bvarbind1):
+       CASE (Bvarbind2):
+       CASE (Bvarbind3):
+       CASE (Bvarbind4):
+       CASE (Bvarbind5):
          op -= Bvarbind;
        varbind:
          /* Specbind can signal and thus GC.  */
          BEFORE_POTENTIAL_GC ();
          specbind (vectorp[op], POP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bcall+6:
+       CASE (Bcall6):
          op = FETCH;
          goto docall;
 
-       case Bcall+7:
+       CASE (Bcall7):
          op = FETCH2;
          goto docall;
 
-       case Bcall:
-       case Bcall+1:
-       case Bcall+2:
-       case Bcall+3:
-       case Bcall+4:
-       case Bcall+5:
+       CASE (Bcall):
+       CASE (Bcall1):
+       CASE (Bcall2):
+       CASE (Bcall3):
+       CASE (Bcall4):
+       CASE (Bcall5):
          op -= Bcall;
        docall:
          {
@@ -784,47 +901,47 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
 #endif
            TOP = Ffuncall (op + 1, &TOP);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bunbind+6:
+       CASE (Bunbind6):
          op = FETCH;
          goto dounbind;
 
-       case Bunbind+7:
+       CASE (Bunbind7):
          op = FETCH2;
          goto dounbind;
 
-       case Bunbind:
-       case Bunbind+1:
-       case Bunbind+2:
-       case Bunbind+3:
-       case Bunbind+4:
-       case Bunbind+5:
+       CASE (Bunbind):
+       CASE (Bunbind1):
+       CASE (Bunbind2):
+       CASE (Bunbind3):
+       CASE (Bunbind4):
+       CASE (Bunbind5):
          op -= Bunbind;
        dounbind:
          BEFORE_POTENTIAL_GC ();
          unbind_to (SPECPDL_INDEX () - op, Qnil);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bunbind_all:       /* Obsolete.  Never used.  */
+       CASE (Bunbind_all):     /* Obsolete.  Never used.  */
          /* To unbind back to the beginning of this frame.  Not used yet,
             but will be needed for tail-recursion elimination.  */
          BEFORE_POTENTIAL_GC ();
          unbind_to (count, Qnil);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bgoto:
+       CASE (Bgoto):
          MAYBE_GC ();
          BYTE_CODE_QUIT;
          op = FETCH2;    /* pc = FETCH2 loses since FETCH2 contains pc++ */
          CHECK_RANGE (op);
          stack.pc = stack.byte_string_start + op;
-         break;
+         NEXT;
 
-       case Bgotoifnonnil:
+       CASE (Bgotoifnonnil):
          {
            Lisp_Object v1;
            MAYBE_GC ();
@@ -836,10 +953,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                CHECK_RANGE (op);
                stack.pc = stack.byte_string_start + op;
              }
-           break;
+           NEXT;
          }
 
-       case Bgotoifnilelsepop:
+       CASE (Bgotoifnilelsepop):
          MAYBE_GC ();
          op = FETCH2;
          if (NILP (TOP))
@@ -849,9 +966,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              stack.pc = stack.byte_string_start + op;
            }
          else DISCARD (1);
-         break;
+         NEXT;
 
-       case Bgotoifnonnilelsepop:
+       CASE (Bgotoifnonnilelsepop):
          MAYBE_GC ();
          op = FETCH2;
          if (!NILP (TOP))
@@ -861,15 +978,15 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              stack.pc = stack.byte_string_start + op;
            }
          else DISCARD (1);
-         break;
+         NEXT;
 
-       case BRgoto:
+       CASE (BRgoto):
          MAYBE_GC ();
          BYTE_CODE_QUIT;
          stack.pc += (int) *stack.pc - 127;
-         break;
+         NEXT;
 
-       case BRgotoifnil:
+       CASE (BRgotoifnil):
          {
            Lisp_Object v1;
            MAYBE_GC ();
@@ -880,10 +997,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                stack.pc += (int) *stack.pc - 128;
              }
            stack.pc++;
-           break;
+           NEXT;
          }
 
-       case BRgotoifnonnil:
+       CASE (BRgotoifnonnil):
          {
            Lisp_Object v1;
            MAYBE_GC ();
@@ -894,10 +1011,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                stack.pc += (int) *stack.pc - 128;
              }
            stack.pc++;
-           break;
+           NEXT;
          }
 
-       case BRgotoifnilelsepop:
+       CASE (BRgotoifnilelsepop):
          MAYBE_GC ();
          op = *stack.pc++;
          if (NILP (TOP))
@@ -906,9 +1023,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              stack.pc += op - 128;
            }
          else DISCARD (1);
-         break;
+         NEXT;
 
-       case BRgotoifnonnilelsepop:
+       CASE (BRgotoifnonnilelsepop):
          MAYBE_GC ();
          op = *stack.pc++;
          if (!NILP (TOP))
@@ -917,62 +1034,62 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              stack.pc += op - 128;
            }
          else DISCARD (1);
-         break;
+         NEXT;
 
-       case Breturn:
+       CASE (Breturn):
          result = POP;
          goto exit;
 
-       case Bdiscard:
+       CASE (Bdiscard):
          DISCARD (1);
-         break;
+         NEXT;
 
-       case Bconstant2:
+       CASE (Bconstant2):
          PUSH (vectorp[FETCH2]);
-         break;
+         NEXT;
 
-       case Bsave_excursion:
+       CASE (Bsave_excursion):
          record_unwind_protect (save_excursion_restore,
                                 save_excursion_save ());
-         break;
+         NEXT;
 
-       case Bsave_current_buffer: /* Obsolete since ??.  */
-       case Bsave_current_buffer_1:
+       CASE (Bsave_current_buffer): /* Obsolete since ??.  */
+       CASE (Bsave_current_buffer_1):
          record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
-         break;
+         NEXT;
 
-       case Bsave_window_excursion: /* Obsolete since 24.1.  */
+       CASE (Bsave_window_excursion): /* Obsolete since 24.1.  */
          {
-           register int count1 = SPECPDL_INDEX ();
+           register ptrdiff_t count1 = SPECPDL_INDEX ();
            record_unwind_protect (Fset_window_configuration,
                                   Fcurrent_window_configuration (Qnil));
            BEFORE_POTENTIAL_GC ();
            TOP = Fprogn (TOP);
            unbind_to (count1, TOP);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bsave_restriction:
+       CASE (Bsave_restriction):
          record_unwind_protect (save_restriction_restore,
                                 save_restriction_save ());
-         break;
+         NEXT;
 
-       case Bcatch:            /* FIXME: ill-suited for lexbind.  */
+       CASE (Bcatch):          /* FIXME: ill-suited for lexbind.  */
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = internal_catch (TOP, eval_sub, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bunwind_protect:   /* FIXME: avoid closure for lexbind.  */
+       CASE (Bunwind_protect): /* FIXME: avoid closure for lexbind.  */
          record_unwind_protect (Fprogn, POP);
-         break;
+         NEXT;
 
-       case Bcondition_case:   /* FIXME: ill-suited for lexbind.  */
+       CASE (Bcondition_case): /* FIXME: ill-suited for lexbind.  */
          {
            Lisp_Object handlers, body;
            handlers = POP;
@@ -980,18 +1097,18 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
            BEFORE_POTENTIAL_GC ();
            TOP = internal_lisp_condition_case (TOP, body, handlers);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Btemp_output_buffer_setup: /* Obsolete since 24.1.  */
+       CASE (Btemp_output_buffer_setup): /* Obsolete since 24.1.  */
          BEFORE_POTENTIAL_GC ();
          CHECK_STRING (TOP);
          temp_output_buffer_setup (SSDATA (TOP));
          AFTER_POTENTIAL_GC ();
          TOP = Vstandard_output;
-         break;
+         NEXT;
 
-       case Btemp_output_buffer_show: /* Obsolete since 24.1.  */
+       CASE (Btemp_output_buffer_show): /* Obsolete since 24.1.  */
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
@@ -1001,190 +1118,191 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
            /* pop binding of standard-output */
            unbind_to (SPECPDL_INDEX () - 1, Qnil);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bnth:
+       CASE (Bnth):
          {
            Lisp_Object v1, v2;
+           EMACS_INT n;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            v2 = TOP;
            CHECK_NUMBER (v2);
-           op = XINT (v2);
+           n = XINT (v2);
            immediate_quit = 1;
-           while (--op >= 0 && CONSP (v1))
+           while (--n >= 0 && CONSP (v1))
              v1 = XCDR (v1);
            immediate_quit = 0;
            TOP = CAR (v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bsymbolp:
+       CASE (Bsymbolp):
          TOP = SYMBOLP (TOP) ? Qt : Qnil;
-         break;
+         NEXT;
 
-       case Bconsp:
+       CASE (Bconsp):
          TOP = CONSP (TOP) ? Qt : Qnil;
-         break;
+         NEXT;
 
-       case Bstringp:
+       CASE (Bstringp):
          TOP = STRINGP (TOP) ? Qt : Qnil;
-         break;
+         NEXT;
 
-       case Blistp:
+       CASE (Blistp):
          TOP = CONSP (TOP) || NILP (TOP) ? Qt : Qnil;
-         break;
+         NEXT;
 
-       case Bnot:
+       CASE (Bnot):
          TOP = NILP (TOP) ? Qt : Qnil;
-         break;
+         NEXT;
 
-       case Bcons:
+       CASE (Bcons):
          {
            Lisp_Object v1;
            v1 = POP;
            TOP = Fcons (TOP, v1);
-           break;
+           NEXT;
          }
 
-       case Blist1:
+       CASE (Blist1):
          TOP = Fcons (TOP, Qnil);
-         break;
+         NEXT;
 
-       case Blist2:
+       CASE (Blist2):
          {
            Lisp_Object v1;
            v1 = POP;
            TOP = Fcons (TOP, Fcons (v1, Qnil));
-           break;
+           NEXT;
          }
 
-       case Blist3:
+       CASE (Blist3):
          DISCARD (2);
          TOP = Flist (3, &TOP);
-         break;
+         NEXT;
 
-       case Blist4:
+       CASE (Blist4):
          DISCARD (3);
          TOP = Flist (4, &TOP);
-         break;
+         NEXT;
 
-       case BlistN:
+       CASE (BlistN):
          op = FETCH;
          DISCARD (op - 1);
          TOP = Flist (op, &TOP);
-         break;
+         NEXT;
 
-       case Blength:
+       CASE (Blength):
          BEFORE_POTENTIAL_GC ();
          TOP = Flength (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Baref:
+       CASE (Baref):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Faref (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Baset:
+       CASE (Baset):
          {
            Lisp_Object v1, v2;
            BEFORE_POTENTIAL_GC ();
            v2 = POP; v1 = POP;
            TOP = Faset (TOP, v1, v2);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bsymbol_value:
+       CASE (Bsymbol_value):
          BEFORE_POTENTIAL_GC ();
          TOP = Fsymbol_value (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bsymbol_function:
+       CASE (Bsymbol_function):
          BEFORE_POTENTIAL_GC ();
          TOP = Fsymbol_function (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bset:
+       CASE (Bset):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fset (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bfset:
+       CASE (Bfset):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Ffset (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bget:
+       CASE (Bget):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fget (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bsubstring:
+       CASE (Bsubstring):
          {
            Lisp_Object v1, v2;
            BEFORE_POTENTIAL_GC ();
            v2 = POP; v1 = POP;
            TOP = Fsubstring (TOP, v1, v2);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bconcat2:
+       CASE (Bconcat2):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Fconcat (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bconcat3:
+       CASE (Bconcat3):
          BEFORE_POTENTIAL_GC ();
          DISCARD (2);
          TOP = Fconcat (3, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bconcat4:
+       CASE (Bconcat4):
          BEFORE_POTENTIAL_GC ();
          DISCARD (3);
          TOP = Fconcat (4, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case BconcatN:
+       CASE (BconcatN):
          op = FETCH;
          BEFORE_POTENTIAL_GC ();
          DISCARD (op - 1);
          TOP = Fconcat (op, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bsub1:
+       CASE (Bsub1):
          {
            Lisp_Object v1;
            v1 = TOP;
@@ -1199,10 +1317,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                TOP = Fsub1 (v1);
                AFTER_POTENTIAL_GC ();
              }
-           break;
+           NEXT;
          }
 
-       case Badd1:
+       CASE (Badd1):
          {
            Lisp_Object v1;
            v1 = TOP;
@@ -1217,10 +1335,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                TOP = Fadd1 (v1);
                AFTER_POTENTIAL_GC ();
              }
-           break;
+           NEXT;
          }
 
-       case Beqlsign:
+       CASE (Beqlsign):
          {
            Lisp_Object v1, v2;
            BEFORE_POTENTIAL_GC ();
@@ -1238,57 +1356,57 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              }
            else
              TOP = (XINT (v1) == XINT (v2) ? Qt : Qnil);
-           break;
+           NEXT;
          }
 
-       case Bgtr:
+       CASE (Bgtr):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fgtr (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Blss:
+       CASE (Blss):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Flss (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bleq:
+       CASE (Bleq):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fleq (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bgeq:
+       CASE (Bgeq):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fgeq (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bdiff:
+       CASE (Bdiff):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Fminus (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bnegate:
+       CASE (Bnegate):
          {
            Lisp_Object v1;
            v1 = TOP;
@@ -1303,209 +1421,209 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                TOP = Fminus (1, &TOP);
                AFTER_POTENTIAL_GC ();
              }
-           break;
+           NEXT;
          }
 
-       case Bplus:
+       CASE (Bplus):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Fplus (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bmax:
+       CASE (Bmax):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Fmax (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bmin:
+       CASE (Bmin):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Fmin (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bmult:
+       CASE (Bmult):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Ftimes (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bquo:
+       CASE (Bquo):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Fquo (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Brem:
+       CASE (Brem):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Frem (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bpoint:
+       CASE (Bpoint):
          {
            Lisp_Object v1;
            XSETFASTINT (v1, PT);
            PUSH (v1);
-           break;
+           NEXT;
          }
 
-       case Bgoto_char:
+       CASE (Bgoto_char):
          BEFORE_POTENTIAL_GC ();
          TOP = Fgoto_char (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Binsert:
+       CASE (Binsert):
          BEFORE_POTENTIAL_GC ();
          TOP = Finsert (1, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case BinsertN:
+       CASE (BinsertN):
          op = FETCH;
          BEFORE_POTENTIAL_GC ();
          DISCARD (op - 1);
          TOP = Finsert (op, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bpoint_max:
+       CASE (Bpoint_max):
          {
            Lisp_Object v1;
            XSETFASTINT (v1, ZV);
            PUSH (v1);
-           break;
+           NEXT;
          }
 
-       case Bpoint_min:
+       CASE (Bpoint_min):
          {
            Lisp_Object v1;
            XSETFASTINT (v1, BEGV);
            PUSH (v1);
-           break;
+           NEXT;
          }
 
-       case Bchar_after:
+       CASE (Bchar_after):
          BEFORE_POTENTIAL_GC ();
          TOP = Fchar_after (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bfollowing_char:
+       CASE (Bfollowing_char):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = Ffollowing_char ();
            AFTER_POTENTIAL_GC ();
            PUSH (v1);
-           break;
+           NEXT;
          }
 
-       case Bpreceding_char:
+       CASE (Bpreceding_char):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = Fprevious_char ();
            AFTER_POTENTIAL_GC ();
            PUSH (v1);
-           break;
+           NEXT;
          }
 
-       case Bcurrent_column:
+       CASE (Bcurrent_column):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            XSETFASTINT (v1, current_column ());
            AFTER_POTENTIAL_GC ();
            PUSH (v1);
-           break;
+           NEXT;
          }
 
-       case Bindent_to:
+       CASE (Bindent_to):
          BEFORE_POTENTIAL_GC ();
          TOP = Findent_to (TOP, Qnil);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Beolp:
+       CASE (Beolp):
          PUSH (Feolp ());
-         break;
+         NEXT;
 
-       case Beobp:
+       CASE (Beobp):
          PUSH (Feobp ());
-         break;
+         NEXT;
 
-       case Bbolp:
+       CASE (Bbolp):
          PUSH (Fbolp ());
-         break;
+         NEXT;
 
-       case Bbobp:
+       CASE (Bbobp):
          PUSH (Fbobp ());
-         break;
+         NEXT;
 
-       case Bcurrent_buffer:
+       CASE (Bcurrent_buffer):
          PUSH (Fcurrent_buffer ());
-         break;
+         NEXT;
 
-       case Bset_buffer:
+       CASE (Bset_buffer):
          BEFORE_POTENTIAL_GC ();
          TOP = Fset_buffer (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Binteractive_p:    /* Obsolete since 24.1.  */
+       CASE (Binteractive_p):  /* Obsolete since 24.1.  */
          PUSH (Finteractive_p ());
-         break;
+         NEXT;
 
-       case Bforward_char:
+       CASE (Bforward_char):
          BEFORE_POTENTIAL_GC ();
          TOP = Fforward_char (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bforward_word:
+       CASE (Bforward_word):
          BEFORE_POTENTIAL_GC ();
          TOP = Fforward_word (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bskip_chars_forward:
+       CASE (Bskip_chars_forward):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fskip_chars_forward (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bskip_chars_backward:
+       CASE (Bskip_chars_backward):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fskip_chars_backward (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bforward_line:
+       CASE (Bforward_line):
          BEFORE_POTENTIAL_GC ();
          TOP = Fforward_line (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bchar_syntax:
+       CASE (Bchar_syntax):
          {
            int c;
 
@@ -1517,51 +1635,51 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              MAKE_CHAR_MULTIBYTE (c);
            XSETFASTINT (TOP, syntax_code_spec[(int) SYNTAX (c)]);
          }
-         break;
+         NEXT;
 
-       case Bbuffer_substring:
+       CASE (Bbuffer_substring):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fbuffer_substring (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bdelete_region:
+       CASE (Bdelete_region):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fdelete_region (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bnarrow_to_region:
+       CASE (Bnarrow_to_region):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fnarrow_to_region (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bwiden:
+       CASE (Bwiden):
          BEFORE_POTENTIAL_GC ();
          PUSH (Fwiden ());
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bend_of_line:
+       CASE (Bend_of_line):
          BEFORE_POTENTIAL_GC ();
          TOP = Fend_of_line (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bset_marker:
+       CASE (Bset_marker):
          {
            Lisp_Object v1, v2;
            BEFORE_POTENTIAL_GC ();
@@ -1569,85 +1687,86 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
            v2 = POP;
            TOP = Fset_marker (TOP, v2, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bmatch_beginning:
+       CASE (Bmatch_beginning):
          BEFORE_POTENTIAL_GC ();
          TOP = Fmatch_beginning (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bmatch_end:
+       CASE (Bmatch_end):
          BEFORE_POTENTIAL_GC ();
          TOP = Fmatch_end (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bupcase:
+       CASE (Bupcase):
          BEFORE_POTENTIAL_GC ();
          TOP = Fupcase (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bdowncase:
+       CASE (Bdowncase):
          BEFORE_POTENTIAL_GC ();
          TOP = Fdowncase (TOP);
          AFTER_POTENTIAL_GC ();
-       break;
+       NEXT;
 
-       case Bstringeqlsign:
+      CASE (Bstringeqlsign):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fstring_equal (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bstringlss:
+       CASE (Bstringlss):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fstring_lessp (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bequal:
+       CASE (Bequal):
          {
            Lisp_Object v1;
            v1 = POP;
            TOP = Fequal (TOP, v1);
-           break;
+           NEXT;
          }
 
-       case Bnthcdr:
+       CASE (Bnthcdr):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fnthcdr (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Belt:
+       CASE (Belt):
          {
            Lisp_Object v1, v2;
            if (CONSP (TOP))
              {
                /* Exchange args and then do nth.  */
+               EMACS_INT n;
                BEFORE_POTENTIAL_GC ();
                v2 = POP;
                v1 = TOP;
                CHECK_NUMBER (v2);
                AFTER_POTENTIAL_GC ();
-               op = XINT (v2);
+               n = XINT (v2);
                immediate_quit = 1;
-               while (--op >= 0 && CONSP (v1))
+               while (--n >= 0 && CONSP (v1))
                  v1 = XCDR (v1);
                immediate_quit = 0;
                TOP = CAR (v1);
@@ -1659,87 +1778,91 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
                TOP = Felt (TOP, v1);
                AFTER_POTENTIAL_GC ();
              }
-           break;
+           NEXT;
          }
 
-       case Bmember:
+       CASE (Bmember):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fmember (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bassq:
+       CASE (Bassq):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fassq (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bnreverse:
+       CASE (Bnreverse):
          BEFORE_POTENTIAL_GC ();
          TOP = Fnreverse (TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bsetcar:
+       CASE (Bsetcar):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fsetcar (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bsetcdr:
+       CASE (Bsetcdr):
          {
            Lisp_Object v1;
            BEFORE_POTENTIAL_GC ();
            v1 = POP;
            TOP = Fsetcdr (TOP, v1);
            AFTER_POTENTIAL_GC ();
-           break;
+           NEXT;
          }
 
-       case Bcar_safe:
+       CASE (Bcar_safe):
          {
            Lisp_Object v1;
            v1 = TOP;
            TOP = CAR_SAFE (v1);
-           break;
+           NEXT;
          }
 
-       case Bcdr_safe:
+       CASE (Bcdr_safe):
          {
            Lisp_Object v1;
            v1 = TOP;
            TOP = CDR_SAFE (v1);
-           break;
+           NEXT;
          }
 
-       case Bnconc:
+       CASE (Bnconc):
          BEFORE_POTENTIAL_GC ();
          DISCARD (1);
          TOP = Fnconc (2, &TOP);
          AFTER_POTENTIAL_GC ();
-         break;
+         NEXT;
 
-       case Bnumberp:
+       CASE (Bnumberp):
          TOP = (NUMBERP (TOP) ? Qt : Qnil);
-         break;
+         NEXT;
 
-       case Bintegerp:
+       CASE (Bintegerp):
          TOP = INTEGERP (TOP) ? Qt : Qnil;
-         break;
+         NEXT;
 
 #ifdef BYTE_CODE_SAFE
+         /* These are intentionally written using 'case' syntax,
+            because they are incompatible with the threaded
+            interpreter.  */
+
        case Bset_mark:
          BEFORE_POTENTIAL_GC ();
          error ("set-mark is an obsolete bytecode");
@@ -1752,49 +1875,49 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
          break;
 #endif
 
-       case 0:
+       CASE_ABORT:
          /* Actually this is Bstack_ref with offset 0, but we use Bdup
             for that instead.  */
-         /* case Bstack_ref: */
+         /* CASE (Bstack_ref): */
          abort ();
 
          /* Handy byte-codes for lexical binding.  */
-       case Bstack_ref+1:
-       case Bstack_ref+2:
-       case Bstack_ref+3:
-       case Bstack_ref+4:
-       case Bstack_ref+5:
+       CASE (Bstack_ref1):
+       CASE (Bstack_ref2):
+       CASE (Bstack_ref3):
+       CASE (Bstack_ref4):
+       CASE (Bstack_ref5):
          {
            Lisp_Object *ptr = top - (op - Bstack_ref);
            PUSH (*ptr);
-           break;
+           NEXT;
          }
-       case Bstack_ref+6:
+       CASE (Bstack_ref6):
          {
            Lisp_Object *ptr = top - (FETCH);
            PUSH (*ptr);
-           break;
+           NEXT;
          }
-       case Bstack_ref+7:
+       CASE (Bstack_ref7):
          {
            Lisp_Object *ptr = top - (FETCH2);
            PUSH (*ptr);
-           break;
+           NEXT;
          }
-       case Bstack_set:
+       CASE (Bstack_set):
          /* stack-set-0 = discard; stack-set-1 = discard-1-preserve-tos.  */
          {
            Lisp_Object *ptr = top - (FETCH);
            *ptr = POP;
-           break;
+           NEXT;
          }
-       case Bstack_set2:
+       CASE (Bstack_set2):
          {
            Lisp_Object *ptr = top - (FETCH2);
            *ptr = POP;
-           break;
+           NEXT;
          }
-       case BdiscardN:
+       CASE (BdiscardN):
          op = FETCH;
          if (op & 0x80)
            {
@@ -1802,10 +1925,10 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
              top[-op] = TOP;
            }
          DISCARD (op);
-         break;
+         NEXT;
 
-       case 255:
-       default:
+       CASE_DEFAULT
+       CASE (Bconstant):
 #ifdef BYTE_CODE_SAFE
          if (op < Bconstant)
            {
@@ -1819,6 +1942,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
 #else
          PUSH (vectorp[op - Bconstant]);
 #endif
+         NEXT;
        }
     }
 
@@ -1866,8 +1990,8 @@ integer, it is incremented each time that symbol's function is called.  */);
   {
     int i = 256;
     while (i--)
-      XVECTOR (Vbyte_code_meter)->contents[i] =
-       Fmake_vector (make_number (256), make_number (0));
+      ASET (Vbyte_code_meter, i,
+           Fmake_vector (make_number (256), make_number (0)));
   }
 #endif
 }
index e09210f1bb6f48e21e1ca4e9309acce4a198cd7e..58e1a5be2f4da41eef4c392dd657eee87c554625 100644 (file)
@@ -22,12 +22,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "commands.h"
 #include "keyboard.h"
 #include "window.h"
 #include "keymap.h"
-#include "character.h"
 
 Lisp_Object Qminus, Qplus;
 Lisp_Object Qcall_interactively;
@@ -97,7 +97,7 @@ r -- Region: point and mark as 2 numeric args, smallest first.  Does no I/O.
 s -- Any string.  Does not inherit the current input method.
 S -- Any symbol.
 U -- Mouse up event discarded by a previous k or K argument.
-v -- Variable name: symbol that is user-variable-p.
+v -- Variable name: symbol that is `custom-variable-p'.
 x -- Lisp expression read but not evaluated.
 X -- Lisp expression read and evaluated.
 z -- Coding system.
@@ -205,7 +205,7 @@ fix_command (Lisp_Object input, Lisp_Object values)
              if (CONSP (elt))
                {
                  Lisp_Object presflag, carelt;
-                 carelt = Fcar (elt);
+                 carelt = XCAR (elt);
                  /* If it is (if X Y), look at Y.  */
                  if (EQ (carelt, Qif)
                      && EQ (Fnthcdr (make_number (3), elt), Qnil))
@@ -257,11 +257,11 @@ invoke it.  If KEYS is omitted or nil, the return value of
   Lisp_Object teml;
   Lisp_Object up_event;
   Lisp_Object enable;
-  int speccount = SPECPDL_INDEX ();
+  ptrdiff_t speccount = SPECPDL_INDEX ();
 
   /* The index of the next element of this_command_keys to examine for
      the 'e' interactive code.  */
-  int next_event;
+  ptrdiff_t next_event;
 
   Lisp_Object prefix_arg;
   char *string;
@@ -276,7 +276,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
   int foo;
   int arg_from_tty = 0;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
-  int key_count;
+  ptrdiff_t key_count;
   int record_then_fail = 0;
 
   Lisp_Object save_this_command, save_last_command;
@@ -284,7 +284,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
   save_this_command = Vthis_command;
   save_this_original_command = Vthis_original_command;
-  save_real_this_command = real_this_command;
+  save_real_this_command = Vreal_this_command;
   save_last_command = KVAR (current_kboard, Vlast_command);
 
   if (NILP (keys))
@@ -295,7 +295,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
       key_count = ASIZE (keys);
     }
 
-  /* Save this now, since use of minibuffer will clobber it. */
+  /* Save this now, since use of minibuffer will clobber it.  */
   prefix_arg = Vcurrent_prefix_arg;
 
   if (SYMBOLP (function))
@@ -310,7 +310,8 @@ invoke it.  If KEYS is omitted or nil, the return value of
      The feature is not fully implemented.  */
   filter_specs = Qnil;
 
-  /* If k or K discard an up-event, save it here so it can be retrieved with U */
+  /* If k or K discard an up-event, save it here so it can be retrieved with
+     U.  */
   up_event = Qnil;
 
   /* Set SPECS to the interactive form, or barf if not interactive.  */
@@ -330,7 +331,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
     {
       /* Make a copy of string so that if a GC relocates specs,
         `string' will still be valid.  */
-      string = (char *) alloca (SBYTES (specs) + 1);
+      string = alloca (SBYTES (specs) + 1);
       memcpy (string, SSDATA (specs), SBYTES (specs) + 1);
     }
   else
@@ -370,14 +371,14 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
       Vthis_command = save_this_command;
       Vthis_original_command = save_this_original_command;
-      real_this_command= save_real_this_command;
+      Vreal_this_command = save_real_this_command;
       KVAR (current_kboard, Vlast_command) = save_last_command;
 
       temporarily_switch_to_single_kboard (NULL);
       return unbind_to (speccount, apply1 (function, specs));
     }
 
-  /* Here if function specifies a string to control parsing the defaults */
+  /* Here if function specifies a string to control parsing the defaults */
 
   /* Set next_event to point to the first event with parameters.  */
   for (next_event = 0; next_event < key_count; next_event++)
@@ -468,9 +469,9 @@ invoke it.  If KEYS is omitted or nil, the return value of
       < nargs)
     memory_full (SIZE_MAX);
 
-  args = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object));
-  visargs = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object));
-  varies = (signed char *) alloca (nargs);
+  args = alloca (nargs * sizeof *args);
+  visargs = alloca (nargs * sizeof *visargs);
+  varies = alloca (nargs * sizeof *varies);
 
   for (i = 0; i < nargs; i++)
     {
@@ -577,7 +578,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
        case 'k':               /* Key sequence. */
          {
-           int speccount1 = SPECPDL_INDEX ();
+           ptrdiff_t speccount1 = SPECPDL_INDEX ();
            specbind (Qcursor_in_echo_area, Qt);
            /* Prompt in `minibuffer-prompt' face.  */
            Fput_text_property (make_number (0),
@@ -609,7 +610,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
        case 'K':               /* Key sequence to be defined. */
          {
-           int speccount1 = SPECPDL_INDEX ();
+           ptrdiff_t speccount1 = SPECPDL_INDEX ();
            specbind (Qcursor_in_echo_area, Qt);
            /* Prompt in `minibuffer-prompt' face.  */
            Fput_text_property (make_number (0),
@@ -748,7 +749,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
          break;
 
        case 'v':               /* Variable name: symbol that is
-                                  user-variable-p. */
+                                  custom-variable-p. */
          args[i] = Fread_variable (callint_message, Qnil);
          visargs[i] = last_minibuf_string;
          break;
@@ -841,7 +842,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
 
   Vthis_command = save_this_command;
   Vthis_original_command = save_this_original_command;
-  real_this_command= save_real_this_command;
+  Vreal_this_command = save_real_this_command;
   KVAR (current_kboard, Vlast_command) = save_last_command;
 
   {
@@ -945,7 +946,7 @@ may be set by the debugger as a reminder for itself.  */);
   Vcommand_debug_status = Qnil;
 
   DEFVAR_LISP ("mark-even-if-inactive", Vmark_even_if_inactive,
-              doc: /* *Non-nil means you can use the mark even when inactive.
+              doc: /* Non-nil means you can use the mark even when inactive.
 This option makes a difference in Transient Mark mode.
 When the option is non-nil, deactivation of the mark
 turns off region highlighting, but commands that use the mark
index d3ca7ebac957562757f9220b89bc5d7d8aa6f506..facca8877727e7fbdc0f2fc21b2042423f8d114e 100644 (file)
@@ -44,8 +44,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif /* MSDOS */
 
 #include "commands.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "ccl.h"
 #include "coding.h"
 #include "composite.h"
@@ -61,6 +61,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "msdos.h"
 #endif
 
+#ifdef HAVE_NS
+#include "nsterm.h"
+#endif
+
 #ifndef USE_CRT_DLL
 extern char **environ;
 #endif
@@ -97,13 +101,15 @@ int synch_process_retcode;
 /* Nonzero if this is termination due to exit.  */
 static int call_process_exited;
 
-static Lisp_Object Fgetenv_internal (Lisp_Object, Lisp_Object);
-
 static Lisp_Object
 call_process_kill (Lisp_Object fdpid)
 {
-  emacs_close (XFASTINT (Fcar (fdpid)));
-  EMACS_KILLPG (XFASTINT (Fcdr (fdpid)), SIGKILL);
+  int fd;
+  pid_t pid;
+  CONS_TO_INTEGER (Fcar (fdpid), int, fd);
+  CONS_TO_INTEGER (Fcdr (fdpid), pid_t, pid);
+  emacs_close (fd);
+  EMACS_KILLPG (pid, SIGKILL);
   synch_process_alive = 0;
   return Qnil;
 }
@@ -112,18 +118,18 @@ static Lisp_Object
 call_process_cleanup (Lisp_Object arg)
 {
   Lisp_Object fdpid = Fcdr (arg);
+  int fd;
 #if defined (MSDOS)
   Lisp_Object file;
-  int fd;
 #else
-  int pid;
+  pid_t pid;
 #endif
 
   Fset_buffer (Fcar (arg));
+  CONS_TO_INTEGER (Fcar (fdpid), int, fd);
 
 #if defined (MSDOS)
   /* for MSDOS fdpid is really (fd . tempfile)  */
-  fd = XFASTINT (Fcar (fdpid));
   file = Fcdr (fdpid);
   /* FD is -1 and FILE is "" when we didn't actually create a
      temporary file in call-process.  */
@@ -132,17 +138,17 @@ call_process_cleanup (Lisp_Object arg)
   if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0'))
     unlink (SDATA (file));
 #else /* not MSDOS */
-  pid = XFASTINT (Fcdr (fdpid));
+  CONS_TO_INTEGER (Fcdr (fdpid), pid_t, pid);
 
   if (call_process_exited)
     {
-      emacs_close (XFASTINT (Fcar (fdpid)));
+      emacs_close (fd);
       return Qnil;
     }
 
   if (EMACS_KILLPG (pid, SIGINT) == 0)
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       record_unwind_protect (call_process_kill, fdpid);
       message1 ("Waiting for process to die...(type C-g again to kill it instantly)");
       immediate_quit = 1;
@@ -153,7 +159,7 @@ call_process_cleanup (Lisp_Object arg)
       message1 ("Waiting for process to die...done");
     }
   synch_process_alive = 0;
-  emacs_close (XFASTINT (Fcar (fdpid)));
+  emacs_close (fd);
 #endif /* not MSDOS */
   return Qnil;
 }
@@ -187,17 +193,16 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
 usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  Lisp_Object infile, buffer, current_dir, path;
-  volatile int display_p_volatile;
+  Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail;
+  int display_p;
   int fd[2];
   int filefd;
-  register int pid;
 #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
 #define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN)
   char buf[CALLPROC_BUFFER_SIZE_MAX];
   int bufsize = CALLPROC_BUFFER_SIZE_MIN;
-  int count = SPECPDL_INDEX ();
-  volatile USE_SAFE_ALLOCA;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  USE_SAFE_ALLOCA;
 
   register const unsigned char **new_argv;
   /* File to use for stderr in the child.
@@ -207,6 +212,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 #ifdef MSDOS   /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
   char *outf, *tempfile = NULL;
   int outfilefd;
+  int pid;
+#else
+  pid_t pid;
 #endif
   int fd_output = -1;
   struct coding_system process_coding; /* coding-system of process output */
@@ -371,7 +379,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
     UNGCPRO;
   }
 
-  display_p_volatile = INTERACTIVE && nargs >= 4 && !NILP (args[3]);
+  display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]);
 
   filefd = emacs_open (SSDATA (infile), O_RDONLY, 0);
   if (filefd < 0)
@@ -607,10 +615,13 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
       Lisp_Object volatile buffer_volatile = buffer;
       Lisp_Object volatile coding_systems_volatile = coding_systems;
       Lisp_Object volatile current_dir_volatile = current_dir;
+      int volatile display_p_volatile = display_p;
       int volatile fd1_volatile = fd1;
       int volatile fd_error_volatile = fd_error;
       int volatile fd_output_volatile = fd_output;
       int volatile output_to_buffer_volatile = output_to_buffer;
+      int volatile sa_must_free_volatile = sa_must_free;
+      ptrdiff_t volatile sa_count_volatile = sa_count;
       unsigned char const **volatile new_argv_volatile = new_argv;
 
       pid = vfork ();
@@ -618,10 +629,13 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
       buffer = buffer_volatile;
       coding_systems = coding_systems_volatile;
       current_dir = current_dir_volatile;
+      display_p = display_p_volatile;
       fd1 = fd1_volatile;
       fd_error = fd_error_volatile;
       fd_output = fd_output_volatile;
       output_to_buffer = output_to_buffer_volatile;
+      sa_must_free = sa_must_free_volatile;
+      sa_count = sa_count_volatile;
       new_argv = new_argv_volatile;
     }
 
@@ -694,16 +708,14 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 
 #if defined (MSDOS)
   /* MSDOS needs different cleanup information.  */
-  record_unwind_protect (call_process_cleanup,
-                        Fcons (Fcurrent_buffer (),
-                               Fcons (make_number (fd[0]),
-                                      build_string (tempfile ? tempfile : ""))));
+  cleanup_info_tail = build_string (tempfile ? tempfile : "");
 #else
+  cleanup_info_tail = INTEGER_TO_CONS (pid);
+#endif /* not MSDOS */
   record_unwind_protect (call_process_cleanup,
                         Fcons (Fcurrent_buffer (),
-                               Fcons (make_number (fd[0]), make_number (pid))));
-#endif /* not MSDOS */
-
+                               Fcons (INTEGER_TO_CONS (fd[0]),
+                                      cleanup_info_tail)));
 
   if (BUFFERP (buffer))
     Fset_buffer (buffer);
@@ -759,11 +771,10 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 
   if (output_to_buffer)
     {
-      register EMACS_INT nread;
+      register int nread;
       int first = 1;
       EMACS_INT total_read = 0;
       int carryover = 0;
-      int display_p = display_p_volatile;
       int display_on_the_fly = display_p;
       struct coding_system saved_coding;
 
@@ -806,7 +817,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
              else
                {                       /* We have to decode the input.  */
                  Lisp_Object curbuf;
-                 int count1 = SPECPDL_INDEX ();
+                 ptrdiff_t count1 = SPECPDL_INDEX ();
 
                  XSETBUFFER (curbuf, current_buffer);
                  /* We cannot allow after-change-functions be run
@@ -925,7 +936,7 @@ static Lisp_Object
 delete_temp_file (Lisp_Object name)
 {
   /* Suppress jka-compr handling, etc.  */
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   specbind (intern ("file-name-handler-alist"), Qnil);
   internal_delete_file (name);
   unbind_to (count, Qnil);
@@ -962,7 +973,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
   struct gcpro gcpro1;
   Lisp_Object filename_string;
   register Lisp_Object start, end;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
   Lisp_Object coding_systems;
   Lisp_Object val, *args2;
@@ -1006,7 +1017,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
       UNBLOCK_INPUT;
       if (fd == -1)
        report_file_error ("Failed to open temporary file",
-                          Fcons (Vtemp_file_name_pattern, Qnil));
+                          Fcons (build_string (tempfile), Qnil));
       else
        close (fd);
     }
@@ -1039,7 +1050,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
   val = complement_process_encoding_system (val);
 
   {
-    int count1 = SPECPDL_INDEX ();
+    ptrdiff_t count1 = SPECPDL_INDEX ();
 
     specbind (intern ("coding-system-for-write"), val);
     /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we
@@ -1139,7 +1150,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
   HANDLE handles[3];
 #endif /* WINDOWSNT */
 
-  int pid = getpid ();
+  pid_t pid = getpid ();
 
   /* Close Emacs's descriptors that this process should not have.  */
   close_process_descs ();
@@ -1165,9 +1176,9 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
     /* MSDOS must have all environment variables malloc'ed, because
        low-level libc functions that launch subsidiary processes rely
        on that.  */
-    pwd_var = (char *) xmalloc (i + 6);
+    pwd_var = xmalloc (i + 6);
 #else
-    pwd_var = (char *) alloca (i + 6);
+    pwd_var = alloca (i + 6);
 #endif
     temp = pwd_var + 4;
     memcpy (pwd_var, "PWD=", 4);
@@ -1235,7 +1246,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
       }
 
     /* new_length + 2 to include PWD and terminating 0.  */
-    env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *));
+    env = new_env = alloca ((new_length + 2) * sizeof *env);
     /* If we have a PWD envvar, pass one down,
        but with corrected value.  */
     if (egetenv ("PWD"))
@@ -1243,7 +1254,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
 
     if (STRINGP (display))
       {
-       char *vdata = (char *) alloca (sizeof "DISPLAY=" + SBYTES (display));
+       char *vdata = alloca (sizeof "DISPLAY=" + SBYTES (display));
        strcpy (vdata, "DISPLAY=");
        strcat (vdata, SSDATA (display));
        new_env = add_env (env, new_env, vdata);
@@ -1506,18 +1517,37 @@ init_callproc_1 (void)
 {
   char *data_dir = egetenv ("EMACSDATA");
   char *doc_dir = egetenv ("EMACSDOC");
+#ifdef HAVE_NS
+  const char *etc_dir = ns_etc_directory ();
+  const char *path_exec = ns_exec_path ();
+#endif
 
   Vdata_directory
     = Ffile_name_as_directory (build_string (data_dir ? data_dir
-                                            : PATH_DATA));
+#ifdef HAVE_NS
+                                             : (etc_dir ? etc_dir : PATH_DATA)
+#else
+                                             : PATH_DATA
+#endif
+                                             ));
   Vdoc_directory
     = Ffile_name_as_directory (build_string (doc_dir ? doc_dir
-                                            : PATH_DOC));
+#ifdef HAVE_NS
+                                             : (etc_dir ? etc_dir : PATH_DOC)
+#else
+                                             : PATH_DOC
+#endif
+                                             ));
 
   /* Check the EMACSPATH environment variable, defaulting to the
      PATH_EXEC path from epaths.h.  */
-  Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
+  Vexec_path = decode_env_path ("EMACSPATH",
+#ifdef HAVE_NS
+                                path_exec ? path_exec :
+#endif
+                                PATH_EXEC);
   Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
+  /* FIXME?  For ns, path_exec should go at the front?  */
   Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
 }
 
@@ -1530,6 +1560,17 @@ init_callproc (void)
 
   register char * sh;
   Lisp_Object tempdir;
+#ifdef HAVE_NS
+  if (data_dir == 0)
+    {
+      const char *etc_dir = ns_etc_directory ();
+      if (etc_dir)
+        {
+          data_dir = alloca (strlen (etc_dir) + 1);
+          strcpy (data_dir, etc_dir);
+        }
+    }
+#endif
 
   if (!NILP (Vinstallation_directory))
     {
@@ -1541,7 +1582,14 @@ init_callproc (void)
          /* MSDOS uses wrapped binaries, so don't do this.  */
       if (NILP (Fmember (tem, Vexec_path)))
        {
-         Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
+#ifdef HAVE_NS
+         const char *path_exec = ns_exec_path ();
+#endif
+         Vexec_path = decode_env_path ("EMACSPATH",
+#ifdef HAVE_NS
+                                       path_exec ? path_exec :
+#endif
+                                       PATH_EXEC);
          Vexec_path = Fcons (tem, Vexec_path);
          Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
        }
@@ -1637,16 +1685,16 @@ syms_of_callproc (void)
   staticpro (&Vtemp_file_name_pattern);
 
   DEFVAR_LISP ("shell-file-name", Vshell_file_name,
-              doc: /* *File name to load inferior shells from.
+              doc: /* File name to load inferior shells from.
 Initialized from the SHELL environment variable, or to a system-dependent
 default if SHELL is not set.  */);
 
   DEFVAR_LISP ("exec-path", Vexec_path,
-              doc: /* *List of directories to search programs to run in subprocesses.
+              doc: /* List of directories to search programs to run in subprocesses.
 Each element is a string (directory name) or nil (try default directory).  */);
 
   DEFVAR_LISP ("exec-suffixes", Vexec_suffixes,
-              doc: /* *List of suffixes to try to find executable file names.
+              doc: /* List of suffixes to try to find executable file names.
 Each element is a string.  */);
   Vexec_suffixes = Qnil;
 
index 80c05aabc7d2b4b32e1cc9ff0a123bcb08c9087b..19fbc832288a103d486693f81b09f78467d68c91 100644 (file)
@@ -21,8 +21,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "commands.h"
 #include "syntax.h"
 #include "composite.h"
@@ -82,8 +82,8 @@ casify_object (enum case_action flag, Lisp_Object obj)
     wrong_type_argument (Qchar_or_string_p, obj);
   else if (!STRING_MULTIBYTE (obj))
     {
-      EMACS_INT i;
-      EMACS_INT size = SCHARS (obj);
+      ptrdiff_t i;
+      ptrdiff_t size = SCHARS (obj);
 
       obj = Fcopy_sequence (obj);
       for (i = 0; i < size; i++)
@@ -111,26 +111,20 @@ casify_object (enum case_action flag, Lisp_Object obj)
     }
   else
     {
-      EMACS_INT i, i_byte, size = SCHARS (obj);
+      ptrdiff_t i, i_byte, size = SCHARS (obj);
       int len;
       USE_SAFE_ALLOCA;
       unsigned char *dst, *o;
-      /* Over-allocate by 12%: this is a minor overhead, but should be
-        sufficient in 99.999% of the cases to avoid a reallocation.  */
-      EMACS_INT o_size = SBYTES (obj) + SBYTES (obj) / 8 + MAX_MULTIBYTE_LENGTH;
+      ptrdiff_t o_size = (size < STRING_BYTES_BOUND / MAX_MULTIBYTE_LENGTH
+                         ? size * MAX_MULTIBYTE_LENGTH
+                         : STRING_BYTES_BOUND);
       SAFE_ALLOCA (dst, void *, o_size);
       o = dst;
 
       for (i = i_byte = 0; i < size; i++, i_byte += len)
        {
-         if ((o - dst) + MAX_MULTIBYTE_LENGTH > o_size)
-           { /* Not enough space for the next char: grow the destination.  */
-             unsigned char *old_dst = dst;
-             o_size += o_size; /* Probably overkill, but extremely rare.  */
-             SAFE_ALLOCA (dst, void *, o_size);
-             memcpy (dst, old_dst, o - old_dst);
-             o = dst + (o - old_dst);
-           }
+         if (o_size - (o - dst) < MAX_MULTIBYTE_LENGTH)
+           string_overflow ();
          c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len);
          if (inword && flag != CASE_CAPITALIZE_UP)
            c = downcase (c);
@@ -199,14 +193,14 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
   register int c;
   register int inword = flag == CASE_DOWN;
   register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
-  EMACS_INT start, end;
-  EMACS_INT start_byte;
+  ptrdiff_t start, end;
+  ptrdiff_t start_byte;
 
   /* Position of first and last changes.  */
-  EMACS_INT first = -1, last IF_LINT (= 0);
+  ptrdiff_t first = -1, last IF_LINT (= 0);
 
-  EMACS_INT opoint = PT;
-  EMACS_INT opoint_byte = PT_BYTE;
+  ptrdiff_t opoint = PT;
+  ptrdiff_t opoint_byte = PT_BYTE;
 
   if (EQ (b, e))
     /* Not modifying because nothing marked */
@@ -351,10 +345,10 @@ character positions to operate on.  */)
 }
 \f
 static Lisp_Object
-operate_on_word (Lisp_Object arg, EMACS_INT *newpoint)
+operate_on_word (Lisp_Object arg, ptrdiff_t *newpoint)
 {
   Lisp_Object val;
-  EMACS_INT farend;
+  ptrdiff_t farend;
   EMACS_INT iarg;
 
   CHECK_NUMBER (arg);
@@ -376,7 +370,7 @@ See also `capitalize-word'.  */)
   (Lisp_Object arg)
 {
   Lisp_Object beg, end;
-  EMACS_INT newpoint;
+  ptrdiff_t newpoint;
   XSETFASTINT (beg, PT);
   end = operate_on_word (arg, &newpoint);
   casify_region (CASE_UP, beg, end);
@@ -390,7 +384,7 @@ With negative argument, convert previous words but do not move.  */)
   (Lisp_Object arg)
 {
   Lisp_Object beg, end;
-  EMACS_INT newpoint;
+  ptrdiff_t newpoint;
   XSETFASTINT (beg, PT);
   end = operate_on_word (arg, &newpoint);
   casify_region (CASE_DOWN, beg, end);
@@ -406,7 +400,7 @@ With negative argument, capitalize previous words but do not move.  */)
   (Lisp_Object arg)
 {
   Lisp_Object beg, end;
-  EMACS_INT newpoint;
+  ptrdiff_t newpoint;
   XSETFASTINT (beg, PT);
   end = operate_on_word (arg, &newpoint);
   casify_region (CASE_CAPITALIZE, beg, end);
index dbc72f485f73cb2f34178f25132e9e5e31c7b383..86dbca4d026471e029106600de17029a4242794d 100644 (file)
@@ -21,8 +21,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 
 static Lisp_Object Qcase_table_p, Qcase_table;
 Lisp_Object Vascii_downcase_table;
@@ -194,8 +194,7 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
 {
   if (NATNUMP (elt))
     {
-      int from;
-      unsigned to;
+      int from, to;
 
       if (CONSP (c))
        {
@@ -204,7 +203,10 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
        }
       else
        from = to = XINT (c);
-      for (to++; from < to; from++)
+
+      to++;
+      lint_assume (to <= MAX_CHAR + 1);
+      for (; from < to; from++)
        CHAR_TABLE_SET (table, from, make_number (from));
     }
 }
@@ -219,8 +221,7 @@ shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
 {
   if (NATNUMP (elt))
     {
-      int from;
-      unsigned to;
+      int from, to;
 
       if (CONSP (c))
        {
@@ -230,7 +231,9 @@ shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt)
       else
        from = to = XINT (c);
 
-      for (to++; from < to; from++)
+      to++;
+      lint_assume (to <= MAX_CHAR + 1);
+      for (; from < to; from++)
        {
          Lisp_Object tem = Faref (table, elt);
          Faset (table, elt, make_number (from));
index 819e7cba364e6824381f775b5b10a76e4d955b25..7d0f72d284ddf012f6cd3f64832d6edcbcec8243 100644 (file)
@@ -32,8 +32,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <ctype.h>
 #include <setjmp.h>
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "category.h"
 #include "keymap.h"
@@ -50,9 +50,6 @@ static int category_table_version;
 
 static Lisp_Object Qcategory_table, Qcategoryp, Qcategorysetp, Qcategory_table_p;
 
-/* Temporary internal variable used in macro CHAR_HAS_CATEGORY.  */
-Lisp_Object _temp_category_set;
-
 /* Make CATEGORY_SET includes (if VAL is t) or excludes (if VAL is
    nil) CATEGORY.  */
 #define SET_CATEGORY_SET(category_set, category, val) \
@@ -304,7 +301,7 @@ DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0,
 usage: (char-category-set CHAR)  */)
   (Lisp_Object ch)
 {
-  CHECK_NUMBER (ch);
+  CHECK_CHARACTER (ch);
   return CATEGORY_SET (XFASTINT (ch));
 }
 
index 737198cc9649682161ca1894107c2c04a5b25363..580e516afd9d03db7d895aa98fba9916cb4d4885 100644 (file)
@@ -1,6 +1,6 @@
 /* Declarations having to do with Emacs category tables.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-     2005, 2006, 2007, 2008, 2009, 2010, 2011
+     2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
    Copyright (C) 2003
@@ -53,8 +53,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    The second extra slot is a version number of the category table.
    But, for the moment, we are not using this slot.  */
 
-#define CATEGORYP(x) \
-  (INTEGERP ((x)) && XFASTINT ((x)) >= 0x20 && XFASTINT ((x)) <= 0x7E)
+#define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E)
 
 #define CHECK_CATEGORY(x) \
   CHECK_TYPE (CATEGORYP (x), Qcategoryp, x)
@@ -70,27 +69,27 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define CHECK_CATEGORY_SET(x) \
   CHECK_TYPE (CATEGORY_SET_P (x), Qcategorysetp, x)
 
+/* Return the category set of character C in the current category table.  */
+#define CATEGORY_SET(c) char_category_set (c)
+
 /* Return 1 if CATEGORY_SET contains CATEGORY, else return 0.
    The faster version of `!NILP (Faref (category_set, category))'.  */
 #define CATEGORY_MEMBER(category, category_set)                                \
-  (XCATEGORY_SET (category_set)->data[(category) / 8]                  \
-   & (1 << ((category) % 8)))
-
-/* Temporary internal variable used in macro CHAR_HAS_CATEGORY.  */
-extern Lisp_Object _temp_category_set;
+  ((XCATEGORY_SET (category_set)->data[(category) / 8]                 \
+    >> ((category) % 8)) & 1)
 
-/* Return 1 if category set of CH contains CATEGORY, elt return 0.  */
-#define CHAR_HAS_CATEGORY(ch, category)        \
-  (_temp_category_set = CATEGORY_SET (ch),     \
-   CATEGORY_MEMBER (category, _temp_category_set))
+/* Return 1 if category set of CH contains CATEGORY, else return 0.  */
+static inline int
+CHAR_HAS_CATEGORY (int ch, int category)
+{
+  Lisp_Object category_set = CATEGORY_SET (ch);
+  return CATEGORY_MEMBER (category, category_set);
+}
 
 /* The standard category table is stored where it will automatically
    be used in all new buffers.  */
 #define Vstandard_category_table BVAR (&buffer_defaults, category_table)
 
-/* Return the category set of character C in the current category table.  */
-#define CATEGORY_SET(c) char_category_set (c)
-
 /* Return the doc string of CATEGORY in category table TABLE.  */
 #define CATEGORY_DOCSTRING(table, category) \
   XVECTOR (Fchar_table_extra_slot (table, make_number (0)))->contents[(category) - ' ']
index bc6322c35b992d2720be64c15a6be2e6782ce5f9..dd37934451d2469f3da938a2963081043c0c4bd9 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -61,7 +61,7 @@ static Lisp_Object Vccl_program_table;
 
 /* Return a hash table of id number ID.  */
 #define GET_HASH_TABLE(id) \
-  (XHASH_TABLE (XCDR (XVECTOR (Vtranslation_hash_table_vector)->contents[(id)])))
+  (XHASH_TABLE (XCDR (AREF (Vtranslation_hash_table_vector, (id)))))
 
 /* CCL (Code Conversion Language) is a simple language which has
    operations on one input buffer, one output buffer, and 7 registers.
@@ -762,9 +762,6 @@ while (0)
 #define GET_CCL_CODE(code, ccl_prog, ic)                       \
   GET_CCL_RANGE (code, ccl_prog, ic, CCL_CODE_MIN, CCL_CODE_MAX)
 
-#define GET_CCL_INT(var, ccl_prog, ic)                         \
-  GET_CCL_RANGE (var, ccl_prog, ic, INT_MIN, INT_MAX)
-
 #define IN_INT_RANGE(val) ASCENDING_ORDER (INT_MIN, val, INT_MAX)
 
 /* Encode one character CH to multibyte form and write to the current
@@ -945,14 +942,14 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
          break;
 
        case CCL_SetConst:      /* 00000000000000000000rrrXXXXX */
-         GET_CCL_INT (reg[rrr], ccl_prog, ic++);
+         reg[rrr] = XINT (ccl_prog[ic++]);
          break;
 
        case CCL_SetArray:      /* CCCCCCCCCCCCCCCCCCCCRRRrrrXXXXX */
          i = reg[RRR];
          j = field1 >> 3;
          if (0 <= i && i < j)
-           GET_CCL_INT (reg[rrr], ccl_prog, ic + i);
+           reg[rrr] = XINT (ccl_prog[ic + i]);
          ic += j;
          break;
 
@@ -980,13 +977,13 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
          break;
 
        case CCL_WriteConstJump: /* A--D--D--R--E--S--S-000XXXXX */
-         GET_CCL_INT (i, ccl_prog, ic);
+         i = XINT (ccl_prog[ic]);
          CCL_WRITE_CHAR (i);
          ic += ADDR;
          break;
 
        case CCL_WriteConstReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
-         GET_CCL_INT (i, ccl_prog, ic);
+         i = XINT (ccl_prog[ic]);
          CCL_WRITE_CHAR (i);
          ic++;
          CCL_READ_CHAR (reg[rrr]);
@@ -994,17 +991,17 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
          break;
 
        case CCL_WriteStringJump: /* A--D--D--R--E--S--S-000XXXXX */
-         GET_CCL_INT (j, ccl_prog, ic++);
+         j = XINT (ccl_prog[ic++]);
          CCL_WRITE_STRING (j);
          ic += ADDR - 1;
          break;
 
        case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
          i = reg[rrr];
-         GET_CCL_INT (j, ccl_prog, ic);
+         j = XINT (ccl_prog[ic]);
          if (0 <= i && i < j)
            {
-             GET_CCL_INT (i, ccl_prog, ic + 1 + i);
+             i = XINT (ccl_prog[ic + 1 + i]);
              CCL_WRITE_CHAR (i);
            }
          ic += j + 2;
@@ -1022,11 +1019,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
          /* fall through ... */
        case CCL_Branch:        /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
        {
-         int incr;
-         GET_CCL_INT (incr, ccl_prog,
-                      ic + (0 <= reg[rrr] && reg[rrr] < field1
-                            ? reg[rrr]
-                            : field1));
+         int ioff = 0 <= reg[rrr] && reg[rrr] < field1 ? reg[rrr] : field1;
+         int incr = XINT (ccl_prog[ic + ioff]);
          ic += incr;
        }
          break;
@@ -1045,7 +1039,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
        case CCL_WriteExprConst:  /* 1:00000OPERATION000RRR000XXXXX */
          rrr = 7;
          i = reg[RRR];
-         GET_CCL_INT (j, ccl_prog, ic);
+         j = XINT (ccl_prog[ic]);
          op = field1 >> 6;
          jump_address = ic + 1;
          goto ccl_set_expr;
@@ -1078,7 +1072,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
            /* If FFF is nonzero, the CCL program ID is in the
                following code.  */
            if (rrr)
-             GET_CCL_INT (prog_id, ccl_prog, ic++);
+             prog_id = XINT (ccl_prog[ic++]);
            else
              prog_id = field1;
 
@@ -1121,7 +1115,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
          i = reg[rrr];
          if (0 <= i && i < field1)
            {
-             GET_CCL_INT (j, ccl_prog, ic + i);
+             j = XINT (ccl_prog[ic + i]);
              CCL_WRITE_CHAR (j);
            }
          ic += field1;
@@ -1146,7 +1140,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
          CCL_SUCCESS;
 
        case CCL_ExprSelfConst: /* 00000OPERATION000000rrrXXXXX */
-         GET_CCL_INT (i, ccl_prog, ic++);
+         i = XINT (ccl_prog[ic++]);
          op = field1 >> 6;
          goto ccl_expr_self;
 
@@ -1182,7 +1176,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
 
        case CCL_SetExprConst:  /* 00000OPERATION000RRRrrrXXXXX */
          i = reg[RRR];
-         GET_CCL_INT (j, ccl_prog, ic++);
+         j = XINT (ccl_prog[ic++]);
          op = field1 >> 6;
          jump_address = ic;
          goto ccl_set_expr;
@@ -1199,8 +1193,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
        case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */
          i = reg[rrr];
          jump_address = ic + ADDR;
-         GET_CCL_INT (op, ccl_prog, ic++);
-         GET_CCL_INT (j, ccl_prog, ic++);
+         op = XINT (ccl_prog[ic++]);
+         j = XINT (ccl_prog[ic++]);
          rrr = 7;
          goto ccl_set_expr;
 
@@ -1209,7 +1203,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
        case CCL_JumpCondExprReg:
          i = reg[rrr];
          jump_address = ic + ADDR;
-         GET_CCL_INT (op, ccl_prog, ic++);
+         op = XINT (ccl_prog[ic++]);
          GET_CCL_RANGE (j, ccl_prog, ic++, 0, 7);
          j = reg[j];
          rrr = 7;
@@ -1290,7 +1284,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
 
            case CCL_TranslateCharacterConstTbl:
              {
-               EMACS_INT eop;
+               ptrdiff_t eop;
                GET_CCL_RANGE (eop, ccl_prog, ic++, 0,
                               (VECTORP (Vtranslation_table_vector)
                                ? ASIZE (Vtranslation_table_vector)
@@ -1356,10 +1350,11 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
            case CCL_IterateMultipleMap:
              {
                Lisp_Object map, content, attrib, value;
-               EMACS_INT point, size;
+               EMACS_INT point;
+               ptrdiff_t size;
                int fin_ic;
 
-               GET_CCL_INT (j, ccl_prog, ic++); /* number of maps. */
+               j = XINT (ccl_prog[ic++]); /* number of maps. */
                fin_ic = ic + j;
                op = reg[rrr];
                if ((j > reg[RRR]) && (j >= 0))
@@ -1376,7 +1371,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
 
                for (;i < j;i++)
                  {
-
+                   if (!VECTORP (Vcode_conversion_map_vector)) continue;
                    size = ASIZE (Vcode_conversion_map_vector);
                    point = XINT (ccl_prog[ic++]);
                    if (! (0 <= point && point < size)) continue;
@@ -1452,7 +1447,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
            case CCL_MapMultiple:
              {
                Lisp_Object map, content, attrib, value;
-               int point, size, map_vector_size;
+               EMACS_INT point;
+               ptrdiff_t size, map_vector_size;
                int map_set_rest_length, fin_ic;
                int current_ic = this_ic;
 
@@ -1471,7 +1467,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
                stack_idx_of_map_multiple = 0;
 
                /* Get number of maps and separators.  */
-               GET_CCL_INT (map_set_rest_length, ccl_prog, ic++);
+               map_set_rest_length = XINT (ccl_prog[ic++]);
 
                fin_ic = ic + map_set_rest_length;
                op = reg[rrr];
@@ -1535,12 +1531,14 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
                        break;
                      }
                  }
+               if (!VECTORP (Vcode_conversion_map_vector))
+                 CCL_INVALID_CMD;
                map_vector_size = ASIZE (Vcode_conversion_map_vector);
 
                do {
                  for (;map_set_rest_length > 0;i++, ic++, map_set_rest_length--)
                    {
-                     GET_CCL_INT (point, ccl_prog, ic);
+                     point = XINT (ccl_prog[ic]);
                      if (point < 0)
                        {
                          /* +1 is for including separator. */
@@ -1657,7 +1655,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
                int point;
                j = XINT (ccl_prog[ic++]); /* map_id */
                op = reg[rrr];
-               if (j >= ASIZE (Vcode_conversion_map_vector))
+               if (! (VECTORP (Vcode_conversion_map_vector)
+                      && j < ASIZE (Vcode_conversion_map_vector)))
                  {
                    reg[RRR] = -1;
                    break;
@@ -1670,6 +1669,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
                  }
                map = XCDR (map);
                if (! (VECTORP (map)
+                      && 0 < ASIZE (map)
                       && INTEGERP (AREF (map, 0))
                       && XINT (AREF (map, 0)) <= op
                       && op - XINT (AREF (map, 0)) + 1 < ASIZE (map)))
@@ -1677,20 +1677,20 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
                    reg[RRR] = -1;
                    break;
                  }
-               point = XINT (AREF (map, 0));
-               point = op - point + 1;
+               point = op - XINT (AREF (map, 0)) + 1;
                reg[RRR] = 0;
                content = AREF (map, point);
                if (NILP (content))
                  reg[RRR] = -1;
-               else if (INTEGERP (content))
+               else if (TYPE_RANGED_INTEGERP (int, content))
                  reg[rrr] = XINT (content);
                else if (EQ (content, Qt));
                else if (CONSP (content))
                  {
                    attrib = XCAR (content);
                    value = XCDR (content);
-                   if (!INTEGERP (attrib) || !INTEGERP (value))
+                   if (!INTEGERP (attrib)
+                       || !TYPE_RANGED_INTEGERP (int, value))
                      continue;
                    reg[rrr] = XINT (value);
                    break;
@@ -1729,14 +1729,14 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
       switch (ccl->status)
        {
        case CCL_STAT_INVALID_CMD:
-         sprintf (msg, "\nCCL: Invalid command %x (ccl_code = %x) at %d.",
-                   code & 0x1F, code, this_ic);
+         msglen = sprintf (msg,
+                           "\nCCL: Invalid command %x (ccl_code = %x) at %d.",
+                           code & 0x1F, code, this_ic);
 #ifdef CCL_DEBUG
          {
            int i = ccl_backtrace_idx - 1;
            int j;
 
-           msglen = strlen (msg);
            if (dst + msglen <= (dst_bytes ? dst_end : src))
              {
                memcpy (dst, msg, msglen);
@@ -1748,8 +1748,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
                if (i < 0) i = CCL_DEBUG_BACKTRACE_LEN - 1;
                if (ccl_backtrace_table[i] == 0)
                  break;
-               sprintf (msg, " %d", ccl_backtrace_table[i]);
-               msglen = strlen (msg);
+               msglen = sprintf (msg, " %d", ccl_backtrace_table[i]);
                if (dst + msglen > (dst_bytes ? dst_end : src))
                  break;
                memcpy (dst, msg, msglen);
@@ -1761,15 +1760,13 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
          break;
 
        case CCL_STAT_QUIT:
-         if (! ccl->quit_silently)
-           sprintf (msg, "\nCCL: Quitted.");
+         msglen = ccl->quit_silently ? 0 : sprintf (msg, "\nCCL: Quitted.");
          break;
 
        default:
-         sprintf (msg, "\nCCL: Unknown error type (%d)", ccl->status);
+         msglen = sprintf (msg, "\nCCL: Unknown error type (%d)", ccl->status);
        }
 
-      msglen = strlen (msg);
       if (msglen <= dst_end - dst)
        {
          for (i = 0; i < msglen; i++)
@@ -1810,8 +1807,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
    function converts symbols of code conversion maps and character
    translation tables embedded in the CCL code into their ID numbers.
 
-   The return value is a vector (CCL itself or a new vector in which
-   all symbols are resolved), Qt if resolving of some symbol failed,
+   The return value is a new vector in which all symbols are resolved,
+   Qt if resolving of some symbol failed,
    or nil if CCL contains invalid data.  */
 
 static Lisp_Object
@@ -1820,13 +1817,15 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
   int i, veclen, unresolved = 0;
   Lisp_Object result, contents, val;
 
-  result = ccl;
+  if (! (CCL_HEADER_MAIN < ASIZE (ccl) && ASIZE (ccl) <= INT_MAX))
+    return Qnil;
+  result = Fcopy_sequence (ccl);
   veclen = ASIZE (result);
 
   for (i = 0; i < veclen; i++)
     {
       contents = AREF (result, i);
-      if (INTEGERP (contents))
+      if (TYPE_RANGED_INTEGERP (int, contents))
        continue;
       else if (CONSP (contents)
               && SYMBOLP (XCAR (contents))
@@ -1835,12 +1834,8 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
          /* This is the new style for embedding symbols.  The form is
             (SYMBOL . PROPERTY).  (get SYMBOL PROPERTY) should give
             an index number.  */
-
-         if (EQ (result, ccl))
-           result =  Fcopy_sequence (ccl);
-
          val = Fget (XCAR (contents), XCDR (contents));
-         if (NATNUMP (val))
+         if (RANGED_INTEGERP (0, val, INT_MAX))
            ASET (result, i, val);
          else
            unresolved = 1;
@@ -1851,21 +1846,18 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
          /* This is the old style for embedding symbols.  This style
              may lead to a bug if, for instance, a translation table
              and a code conversion map have the same name.  */
-         if (EQ (result, ccl))
-           result = Fcopy_sequence (ccl);
-
          val = Fget (contents, Qtranslation_table_id);
-         if (NATNUMP (val))
+         if (RANGED_INTEGERP (0, val, INT_MAX))
            ASET (result, i, val);
          else
            {
              val = Fget (contents, Qcode_conversion_map_id);
-             if (NATNUMP (val))
+             if (RANGED_INTEGERP (0, val, INT_MAX))
                ASET (result, i, val);
              else
                {
                  val = Fget (contents, Qccl_program_idx);
-                 if (NATNUMP (val))
+                 if (RANGED_INTEGERP (0, val, INT_MAX))
                    ASET (result, i, val);
                  else
                    unresolved = 1;
@@ -1876,6 +1868,11 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
       return Qnil;
     }
 
+  if (! (0 <= XINT (AREF (result, CCL_HEADER_BUF_MAG))
+        && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)),
+                            ASIZE (ccl))))
+    return Qnil;
+
   return (unresolved ? Qt : result);
 }
 
@@ -1886,7 +1883,7 @@ resolve_symbol_ccl_program (Lisp_Object ccl)
    symbols, return Qnil.  */
 
 static Lisp_Object
-ccl_get_compiled_code (Lisp_Object ccl_prog, int *idx)
+ccl_get_compiled_code (Lisp_Object ccl_prog, ptrdiff_t *idx)
 {
   Lisp_Object val, slot;
 
@@ -2015,7 +2012,7 @@ programs.  */)
     error ("Length of vector REGISTERS is not 8");
 
   for (i = 0; i < 8; i++)
-    ccl.reg[i] = (INTEGERP (AREF (reg, i))
+    ccl.reg[i] = (TYPE_RANGED_INTEGERP (int, AREF (reg, i))
                  ? XINT (AREF (reg, i))
                  : 0);
 
@@ -2084,7 +2081,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
     {
       if (NILP (AREF (status, i)))
        ASET (status, i, make_number (0));
-      if (INTEGERP (AREF (status, i)))
+      if (TYPE_RANGED_INTEGERP (int, AREF (status, i)))
        ccl.reg[i] = XINT (AREF (status, i));
     }
   if (INTEGERP (AREF (status, i)))
@@ -2101,7 +2098,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
   outbufsize = (ccl.buf_magnification
                ? str_bytes * ccl.buf_magnification + 256
                : str_bytes + 256);
-  outp = outbuf = (unsigned char *) xmalloc (outbufsize);
+  outp = outbuf = xmalloc (outbufsize);
 
   consumed_chars = consumed_bytes = 0;
   produced_chars = 0;
@@ -2187,8 +2184,8 @@ If it is nil, just reserve NAME as a CCL program name.
 Return index number of the registered CCL program.  */)
      (Lisp_Object name, Lisp_Object ccl_prog)
 {
-  int len = ASIZE (Vccl_program_table);
-  int idx;
+  ptrdiff_t len = ASIZE (Vccl_program_table);
+  ptrdiff_t idx;
   Lisp_Object resolved;
 
   CHECK_SYMBOL (name);
@@ -2229,7 +2226,7 @@ Return index number of the registered CCL program.  */)
 
   if (idx == len)
     /* Extend the table.  */
-    Vccl_program_table = larger_vector (Vccl_program_table, len * 2, Qnil);
+    Vccl_program_table = larger_vector (Vccl_program_table, 1, -1);
 
   {
     Lisp_Object elt;
@@ -2262,12 +2259,16 @@ DEFUN ("register-code-conversion-map", Fregister_code_conversion_map,
 Return index number of the registered map.  */)
   (Lisp_Object symbol, Lisp_Object map)
 {
-  int len = ASIZE (Vcode_conversion_map_vector);
-  int i;
+  ptrdiff_t len;
+  ptrdiff_t i;
   Lisp_Object idx;
 
   CHECK_SYMBOL (symbol);
   CHECK_VECTOR (map);
+  if (! VECTORP (Vcode_conversion_map_vector))
+    error ("Invalid code-conversion-map-vector");
+
+  len = ASIZE (Vcode_conversion_map_vector);
 
   for (i = 0; i < len; i++)
     {
@@ -2288,7 +2289,7 @@ Return index number of the registered map.  */)
 
   if (i == len)
     Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector,
-                                                len * 2, Qnil);
+                                                1, -1);
 
   idx = make_number (i);
   Fput (symbol, Qcode_conversion_map, map);
index e86154352a31c58d07ce6522c7e2b03a2a8c3e86..71139175be5e8b0071b1be8c1267a5c795b2f494 100644 (file)
--- a/src/ccl.h
+++ b/src/ccl.h
@@ -1,6 +1,6 @@
 /* Header for CCL (Code Conversion Language) interpreter.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-     2005, 2006, 2007, 2008, 2009, 2010, 2011
+     2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
    Copyright (C) 2003
@@ -37,7 +37,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Structure to hold information about running CCL code.  Read
    comments in the file ccl.c for the detail of each field.  */
 struct ccl_program {
-  int idx;                     /* Index number of the CCL program.
+  ptrdiff_t idx;               /* Index number of the CCL program.
                                   -1 means that the program was given
                                   by a vector, not by a program
                                   name.  */
@@ -101,8 +101,6 @@ extern void ccl_driver (struct ccl_program *, int *, int *, int, int,
 
 extern Lisp_Object Qccl, Qcclp;
 
-EXFUN (Fccl_program_p, 1);
-
 #define CHECK_CCL_PROGRAM(x)                   \
   do {                                         \
     if (NILP (Fccl_program_p (x)))             \
index 82bc2bfef4ebc501e4f2008e593e1eb91eea0c4d..f4c74a93d390810e9e3b5104b7801f92921cb56b 100644 (file)
@@ -57,9 +57,6 @@ static Lisp_Object Qauto_fill_chars;
    Unicode character.  Mainly used by the macro MAYBE_UNIFY_CHAR.  */
 Lisp_Object Vchar_unify_table;
 
-/* Variable used locally in the macro FETCH_MULTIBYTE_CHAR.  */
-unsigned char *_fetch_multibyte_char_p;
-
 static Lisp_Object Qchar_script_table;
 
 \f
@@ -67,8 +64,8 @@ static Lisp_Object Qchar_script_table;
 /* If character code C has modifier masks, reflect them to the
    character code if possible.  Return the resulting code.  */
 
-int
-char_resolve_modifier_mask (int c)
+EMACS_INT
+char_resolve_modifier_mask (EMACS_INT c)
 {
   /* A non-ASCII character can't reflect modifier bits to the code.  */
   if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK)))
@@ -311,10 +308,10 @@ If the multibyte character does not represent a byte, return -1.  */)
 
 /* Return width (columns) of C considering the buffer display table DP. */
 
-static EMACS_INT
+static ptrdiff_t
 char_width (int c, struct Lisp_Char_Table *dp)
 {
-  EMACS_INT width = CHAR_WIDTH (c);
+  ptrdiff_t width = CHAR_WIDTH (c);
 
   if (dp)
     {
@@ -346,7 +343,7 @@ usage: (char-width CHAR)  */)
   (Lisp_Object ch)
 {
   int c;
-  EMACS_INT width;
+  ptrdiff_t width;
 
   CHECK_CHARACTER (ch);
   c = XINT (ch);
@@ -361,19 +358,19 @@ usage: (char-width CHAR)  */)
    characters and bytes of the substring in *NCHARS and *NBYTES
    respectively.  */
 
-EMACS_INT
-c_string_width (const unsigned char *str, EMACS_INT len, int precision,
-               EMACS_INT *nchars, EMACS_INT *nbytes)
+ptrdiff_t
+c_string_width (const unsigned char *str, ptrdiff_t len, int precision,
+               ptrdiff_t *nchars, ptrdiff_t *nbytes)
 {
-  EMACS_INT i = 0, i_byte = 0;
-  EMACS_INT width = 0;
+  ptrdiff_t i = 0, i_byte = 0;
+  ptrdiff_t width = 0;
   struct Lisp_Char_Table *dp = buffer_display_table ();
 
   while (i_byte < len)
     {
       int bytes;
       int c = STRING_CHAR_AND_LENGTH (str + i_byte, bytes);
-      EMACS_INT thiswidth = char_width (c, dp);
+      ptrdiff_t thiswidth = char_width (c, dp);
 
       if (precision <= 0)
        {
@@ -404,8 +401,8 @@ c_string_width (const unsigned char *str, EMACS_INT len, int precision,
    current buffer.  The width is measured by how many columns it
    occupies on the screen.  */
 
-EMACS_INT
-strwidth (const char *str, EMACS_INT len)
+ptrdiff_t
+strwidth (const char *str, ptrdiff_t len)
 {
   return c_string_width ((const unsigned char *) str, len, -1, NULL, NULL);
 }
@@ -417,26 +414,26 @@ strwidth (const char *str, EMACS_INT len)
    PRECISION, and set number of characters and bytes of the substring
    in *NCHARS and *NBYTES respectively.  */
 
-EMACS_INT
-lisp_string_width (Lisp_Object string, EMACS_INT precision,
-                  EMACS_INT *nchars, EMACS_INT *nbytes)
+ptrdiff_t
+lisp_string_width (Lisp_Object string, ptrdiff_t precision,
+                  ptrdiff_t *nchars, ptrdiff_t *nbytes)
 {
-  EMACS_INT len = SCHARS (string);
+  ptrdiff_t len = SCHARS (string);
   /* This set multibyte to 0 even if STRING is multibyte when it
      contains only ascii and eight-bit-graphic, but that's
      intentional.  */
   int multibyte = len < SBYTES (string);
   unsigned char *str = SDATA (string);
-  EMACS_INT i = 0, i_byte = 0;
-  EMACS_INT width = 0;
+  ptrdiff_t i = 0, i_byte = 0;
+  ptrdiff_t width = 0;
   struct Lisp_Char_Table *dp = buffer_display_table ();
 
   while (i < len)
     {
-      EMACS_INT chars, bytes, thiswidth;
+      ptrdiff_t chars, bytes, thiswidth;
       Lisp_Object val;
       ptrdiff_t cmp_id;
-      EMACS_INT ignore, end;
+      ptrdiff_t ignore, end;
 
       if (find_composition (i, -1, &ignore, &end, &val, string)
          && ((cmp_id = get_composition_id (i, i_byte, end - i, val, string))
@@ -512,8 +509,8 @@ usage: (string-width STRING)  */)
    However, if the current buffer has enable-multibyte-characters =
    nil, we treat each byte as a character.  */
 
-EMACS_INT
-chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
+ptrdiff_t
+chars_in_text (const unsigned char *ptr, ptrdiff_t nbytes)
 {
   /* current_buffer is null at early stages of Emacs initialization.  */
   if (current_buffer == 0
@@ -528,15 +525,15 @@ chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
    sequences while assuming that there's no invalid sequence.  It
    ignores enable-multibyte-characters.  */
 
-EMACS_INT
-multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
+ptrdiff_t
+multibyte_chars_in_text (const unsigned char *ptr, ptrdiff_t nbytes)
 {
   const unsigned char *endp = ptr + nbytes;
-  EMACS_INT chars = 0;
+  ptrdiff_t chars = 0;
 
   while (ptr < endp)
     {
-      EMACS_INT len = MULTIBYTE_LENGTH (ptr, endp);
+      int len = MULTIBYTE_LENGTH (ptr, endp);
 
       if (len == 0)
        abort ();
@@ -554,11 +551,12 @@ multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes)
    represented by 2-byte in a multibyte text.  */
 
 void
-parse_str_as_multibyte (const unsigned char *str, EMACS_INT len,
-                       EMACS_INT *nchars, EMACS_INT *nbytes)
+parse_str_as_multibyte (const unsigned char *str, ptrdiff_t len,
+                       ptrdiff_t *nchars, ptrdiff_t *nbytes)
 {
   const unsigned char *endp = str + len;
-  EMACS_INT n, chars = 0, bytes = 0;
+  int n;
+  ptrdiff_t chars = 0, bytes = 0;
 
   if (len >= MAX_MULTIBYTE_LENGTH)
     {
@@ -596,13 +594,13 @@ parse_str_as_multibyte (const unsigned char *str, EMACS_INT len,
    area and that is enough.  Return the number of bytes of the
    resulting text.  */
 
-EMACS_INT
-str_as_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT nbytes,
-                 EMACS_INT *nchars)
+ptrdiff_t
+str_as_multibyte (unsigned char *str, ptrdiff_t len, ptrdiff_t nbytes,
+                 ptrdiff_t *nchars)
 {
   unsigned char *p = str, *endp = str + nbytes;
   unsigned char *to;
-  EMACS_INT chars = 0;
+  ptrdiff_t chars = 0;
   int n;
 
   if (nbytes >= MAX_MULTIBYTE_LENGTH)
@@ -673,11 +671,11 @@ str_as_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT nbytes,
    bytes it may occupy when converted to multibyte string by
    `str_to_multibyte'.  */
 
-EMACS_INT
-count_size_as_multibyte (const unsigned char *str, EMACS_INT len)
+ptrdiff_t
+count_size_as_multibyte (const unsigned char *str, ptrdiff_t len)
 {
   const unsigned char *endp = str + len;
-  EMACS_INT bytes;
+  ptrdiff_t bytes;
 
   for (bytes = 0; str < endp; str++)
     {
@@ -696,8 +694,8 @@ count_size_as_multibyte (const unsigned char *str, EMACS_INT len)
    that we can use LEN bytes at STR as a work area and that is
    enough.  */
 
-EMACS_INT
-str_to_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT bytes)
+ptrdiff_t
+str_to_multibyte (unsigned char *str, ptrdiff_t len, ptrdiff_t bytes)
 {
   unsigned char *p = str, *endp = str + bytes;
   unsigned char *to;
@@ -725,8 +723,8 @@ str_to_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT bytes)
    actually converts characters in the range 0x80..0xFF to
    unibyte.  */
 
-EMACS_INT
-str_as_unibyte (unsigned char *str, EMACS_INT bytes)
+ptrdiff_t
+str_as_unibyte (unsigned char *str, ptrdiff_t bytes)
 {
   const unsigned char *p = str, *endp = str + bytes;
   unsigned char *to;
@@ -767,10 +765,10 @@ str_as_unibyte (unsigned char *str, EMACS_INT bytes)
    of that character code.
    Note: Currently the arg ACCEPT_LATIN_1 is not used.  */
 
-EMACS_INT
-str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, int accept_latin_1)
+ptrdiff_t
+str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, int accept_latin_1)
 {
-  EMACS_INT i;
+  ptrdiff_t i;
 
   for (i = 0; i < chars; i++)
     {
@@ -787,14 +785,14 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, i
 }
 
 
-static EMACS_INT
+static ptrdiff_t
 string_count_byte8 (Lisp_Object string)
 {
   int multibyte = STRING_MULTIBYTE (string);
-  EMACS_INT nbytes = SBYTES (string);
+  ptrdiff_t nbytes = SBYTES (string);
   unsigned char *p = SDATA (string);
   unsigned char *pend = p + nbytes;
-  EMACS_INT count = 0;
+  ptrdiff_t count = 0;
   int c, len;
 
   if (multibyte)
@@ -820,10 +818,10 @@ string_count_byte8 (Lisp_Object string)
 Lisp_Object
 string_escape_byte8 (Lisp_Object string)
 {
-  EMACS_INT nchars = SCHARS (string);
-  EMACS_INT nbytes = SBYTES (string);
+  ptrdiff_t nchars = SCHARS (string);
+  ptrdiff_t nbytes = SBYTES (string);
   int multibyte = STRING_MULTIBYTE (string);
-  EMACS_INT byte8_count;
+  ptrdiff_t byte8_count;
   const unsigned char *src, *src_end;
   unsigned char *dst;
   Lisp_Object val;
@@ -869,8 +867,7 @@ string_escape_byte8 (Lisp_Object string)
          {
            c = STRING_CHAR_ADVANCE (src);
            c = CHAR_TO_BYTE8 (c);
-           sprintf ((char *) dst, "\\%03o", c);
-           dst += 4;
+           dst += sprintf ((char *) dst, "\\%03o", c);
          }
        else
          while (len--) *dst++ = *src++;
@@ -880,10 +877,7 @@ string_escape_byte8 (Lisp_Object string)
       {
        c = *src++;
        if (c >= 0x80)
-         {
-           sprintf ((char *) dst, "\\%03o", c);
-           dst += 4;
-         }
+         dst += sprintf ((char *) dst, "\\%03o", c);
        else
          *dst++ = c;
       }
@@ -924,7 +918,6 @@ usage: (unibyte-string &rest BYTES)  */)
   (ptrdiff_t n, Lisp_Object *args)
 {
   ptrdiff_t i;
-  int c;
   unsigned char *buf, *p;
   Lisp_Object str;
   USE_SAFE_ALLOCA;
@@ -934,11 +927,8 @@ usage: (unibyte-string &rest BYTES)  */)
 
   for (i = 0; i < n; i++)
     {
-      CHECK_NATNUM (args[i]);
-      c = XFASTINT (args[i]);
-      if (c >= 256)
-       args_out_of_range_3 (args[i], make_number (0), make_number (255));
-      *p++ = c;
+      CHECK_RANGED_INTEGER (args[i], 0, 255);
+      *p++ = XINT (args[i]);
     }
 
   str = make_string_from_bytes ((char *) buf, n, p - buf);
@@ -954,7 +944,7 @@ code.  Unresolved modifiers are kept in the value.
 usage: (char-resolve-modifiers CHAR)  */)
   (Lisp_Object character)
 {
-  int c;
+  EMACS_INT c;
 
   CHECK_NUMBER (character);
   c = XINT (character);
@@ -974,7 +964,7 @@ character is not ASCII nor 8-bit character, an error is signaled.  */)
   (Lisp_Object position, Lisp_Object string)
 {
   int c;
-  EMACS_INT pos;
+  ptrdiff_t pos;
   unsigned char *p;
 
   if (NILP (string))
@@ -1020,12 +1010,6 @@ character is not ASCII nor 8-bit character, an error is signaled.  */)
   return make_number (c);
 }
 
-
-void
-init_character_once (void)
-{
-}
-
 #ifdef emacs
 
 void
index a829def428dcb0514f9a5057d2c535fc0fc2b154..2cfeff85feeead1a2c23bd56df24ad68c62cc753 100644 (file)
@@ -316,7 +316,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    Note: This macro returns the actual length of the character's
    multibyte sequence as it is stored in a buffer or string.  The
    character it returns might have a different codepoint that has a
-   different multibyte sequence of a different legth, due to possible
+   different multibyte sequence of a different length, due to possible
    unification of CJK characters inside string_char.  Therefore do NOT
    assume that the length returned by this macro is identical to the
    length of the multibyte sequence of the character it returns.  */
@@ -434,7 +434,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
          unsigned char *chp = BYTE_POS_ADDR (BYTEIDX);         \
          int chlen;                                            \
                                                                \
-         OUTPUT= STRING_CHAR_AND_LENGTH (chp, chlen);          \
+         OUTPUT = STRING_CHAR_AND_LENGTH (chp, chlen);         \
          BYTEIDX += chlen;                                     \
        }                                                       \
       else                                                     \
@@ -665,7 +665,7 @@ typedef enum {
   UNICODE_CATEGORY_Cn
 } unicode_category_t;
 
-extern int char_resolve_modifier_mask (int);
+extern EMACS_INT char_resolve_modifier_mask (EMACS_INT) ATTRIBUTE_CONST;
 extern int char_string (unsigned, unsigned char *);
 extern int string_char (const unsigned char *,
                         const unsigned char **, int *);
@@ -673,19 +673,19 @@ extern int string_char (const unsigned char *,
 extern int translate_char (Lisp_Object, int c);
 extern int char_printable_p (int c);
 extern void parse_str_as_multibyte (const unsigned char *,
-                                   EMACS_INT, EMACS_INT *, EMACS_INT *);
-extern EMACS_INT count_size_as_multibyte (const unsigned char *, EMACS_INT);
-extern EMACS_INT str_as_multibyte (unsigned char *, EMACS_INT, EMACS_INT,
-                            EMACS_INT *);
-extern EMACS_INT str_to_multibyte (unsigned char *, EMACS_INT, EMACS_INT);
-extern EMACS_INT str_as_unibyte (unsigned char *, EMACS_INT);
-extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *,
-                                 EMACS_INT, int);
-extern EMACS_INT strwidth (const char *, EMACS_INT);
-extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int,
-                                EMACS_INT *, EMACS_INT *);
-extern EMACS_INT lisp_string_width (Lisp_Object, EMACS_INT,
-                                   EMACS_INT *, EMACS_INT *);
+                                   ptrdiff_t, ptrdiff_t *, ptrdiff_t *);
+extern ptrdiff_t count_size_as_multibyte (const unsigned char *, ptrdiff_t);
+extern ptrdiff_t str_as_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t,
+                                  ptrdiff_t *);
+extern ptrdiff_t str_to_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t);
+extern ptrdiff_t str_as_unibyte (unsigned char *, ptrdiff_t);
+extern ptrdiff_t str_to_unibyte (const unsigned char *, unsigned char *,
+                                 ptrdiff_t, int);
+extern ptrdiff_t strwidth (const char *, ptrdiff_t);
+extern ptrdiff_t c_string_width (const unsigned char *, ptrdiff_t, int,
+                                ptrdiff_t *, ptrdiff_t *);
+extern ptrdiff_t lisp_string_width (Lisp_Object, ptrdiff_t,
+                                   ptrdiff_t *, ptrdiff_t *);
 
 extern Lisp_Object Qcharacterp;
 extern Lisp_Object Vchar_unify_table;
index 70cc4d1cdd95db5e27ecc251a07b9972f5ffb26c..4c47ba45fb63327936550f373d889b5ba2994cb7 100644 (file)
@@ -118,24 +118,25 @@ int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
 
 #define CODE_POINT_TO_INDEX(charset, code)                             \
   ((charset)->code_linear_p                                            \
-   ? (code) - (charset)->min_code                                      \
+   ? (int) ((code) - (charset)->min_code)                              \
    : (((charset)->code_space_mask[(code) >> 24] & 0x8)                 \
       && ((charset)->code_space_mask[((code) >> 16) & 0xFF] & 0x4)     \
       && ((charset)->code_space_mask[((code) >> 8) & 0xFF] & 0x2)      \
       && ((charset)->code_space_mask[(code) & 0xFF] & 0x1))            \
-   ? (((((code) >> 24) - (charset)->code_space[12])                    \
-       * (charset)->code_space[11])                                    \
-      + (((((code) >> 16) & 0xFF) - (charset)->code_space[8])          \
-        * (charset)->code_space[7])                                    \
-      + (((((code) >> 8) & 0xFF) - (charset)->code_space[4])           \
-        * (charset)->code_space[3])                                    \
-      + (((code) & 0xFF) - (charset)->code_space[0])                   \
-      - ((charset)->char_index_offset))                                        \
+   ? (int) (((((code) >> 24) - (charset)->code_space[12])              \
+            * (charset)->code_space[11])                               \
+           + (((((code) >> 16) & 0xFF) - (charset)->code_space[8])     \
+              * (charset)->code_space[7])                              \
+           + (((((code) >> 8) & 0xFF) - (charset)->code_space[4])      \
+              * (charset)->code_space[3])                              \
+           + (((code) & 0xFF) - (charset)->code_space[0])              \
+           - ((charset)->char_index_offset))                           \
    : -1)
 
 
-/* Convert the character index IDX to code-point CODE for CHARSET.
-   It is assumed that IDX is in a valid range.  */
+/* Return the code-point for the character index IDX in CHARSET.
+   IDX should be an unsigned int variable in a valid range (which is
+   always in nonnegative int range too).  IDX contains garbage afterwards.  */
 
 #define INDEX_TO_CODE_POINT(charset, idx)                                   \
   ((charset)->code_linear_p                                                 \
@@ -293,7 +294,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
       else
        {
          if (! temp_charset_work)
-           temp_charset_work = xmalloc (sizeof (*temp_charset_work));
+           temp_charset_work = xmalloc (sizeof *temp_charset_work);
          if (control_flag == 1)
            {
              memset (temp_charset_work->table.decoder, -1,
@@ -363,7 +364,8 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
              && CHARSET_COMPACT_CODES_P (charset))
            for (; from_index < lim_index; from_index++, from_c++)
              {
-               unsigned code = INDEX_TO_CODE_POINT (charset, from_index);
+               unsigned code = from_index;
+               code = INDEX_TO_CODE_POINT (charset, code);
 
                if (NILP (CHAR_TABLE_REF (table, from_c)))
                  CHAR_TABLE_SET (table, from_c, make_number (code));
@@ -482,7 +484,8 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
   FILE *fp;
   Lisp_Object suffixes;
   struct charset_map_entries *head, *entries;
-  int n_entries, count;
+  int n_entries;
+  ptrdiff_t count;
   USE_SAFE_ALLOCA;
 
   suffixes = Fcons (build_string (".map"),
@@ -534,8 +537,9 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
                       sizeof (struct charset_map_entries));
          entries = entries->next;
          memset (entries, 0, sizeof (struct charset_map_entries));
+         n_entries = 0;
        }
-      idx = n_entries % 0x10000;
+      idx = n_entries;
       entries->entry[idx].from = from;
       entries->entry[idx].to = to;
       entries->entry[idx].c = c;
@@ -576,7 +580,7 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont
     {
       Lisp_Object val, val2;
       unsigned from, to;
-      int c;
+      EMACS_INT c;
       int idx;
 
       val = AREF (vec, i);
@@ -584,16 +588,11 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont
        {
          val2 = XCDR (val);
          val = XCAR (val);
-         CHECK_NATNUM (val);
-         CHECK_NATNUM (val2);
          from = XFASTINT (val);
          to = XFASTINT (val2);
        }
       else
-       {
-         CHECK_NATNUM (val);
-         from = to = XFASTINT (val);
-       }
+       from = to = XFASTINT (val);
       val = AREF (vec, i + 1);
       CHECK_NATNUM (val);
       c = XFASTINT (val);
@@ -821,7 +820,6 @@ range of code points (in CHARSET) of target characters.  */)
     from = CHARSET_MIN_CODE (cs);
   else
     {
-      CHECK_NATNUM (from_code);
       from = XINT (from_code);
       if (from < CHARSET_MIN_CODE (cs))
        from = CHARSET_MIN_CODE (cs);
@@ -830,7 +828,6 @@ range of code points (in CHARSET) of target characters.  */)
     to = CHARSET_MAX_CODE (cs);
   else
     {
-      CHECK_NATNUM (to_code);
       to = XINT (to_code);
       if (to > CHARSET_MAX_CODE (cs))
        to = CHARSET_MAX_CODE (cs);
@@ -876,12 +873,15 @@ usage: (define-charset-internal ...)  */)
   val = args[charset_arg_code_space];
   for (i = 0, dimension = 0, nchars = 1; ; i++)
     {
+      Lisp_Object min_byte_obj, max_byte_obj;
       int min_byte, max_byte;
 
-      min_byte = XINT (Faref (val, make_number (i * 2)));
-      max_byte = XINT (Faref (val, make_number (i * 2 + 1)));
-      if (min_byte < 0 || min_byte > max_byte || max_byte >= 256)
-       error ("Invalid :code-space value");
+      min_byte_obj = Faref (val, make_number (i * 2));
+      max_byte_obj = Faref (val, make_number (i * 2 + 1));
+      CHECK_RANGED_INTEGER (min_byte_obj, 0, 255);
+      min_byte = XINT (min_byte_obj);
+      CHECK_RANGED_INTEGER (max_byte_obj, min_byte, 255);
+      max_byte = XINT (max_byte_obj);
       charset.code_space[i * 4] = min_byte;
       charset.code_space[i * 4 + 1] = max_byte;
       charset.code_space[i * 4 + 2] = max_byte - min_byte + 1;
@@ -898,10 +898,8 @@ usage: (define-charset-internal ...)  */)
     charset.dimension = dimension;
   else
     {
-      CHECK_NATNUM (val);
+      CHECK_RANGED_INTEGER (val, 1, 4);
       charset.dimension = XINT (val);
-      if (charset.dimension < 1 || charset.dimension > 4)
-       args_out_of_range_3 (val, make_number (1), make_number (4));
     }
 
   charset.code_linear_p
@@ -914,8 +912,7 @@ usage: (define-charset-internal ...)  */)
 
   if (! charset.code_linear_p)
     {
-      charset.code_space_mask = (unsigned char *) xmalloc (256);
-      memset (charset.code_space_mask, 0, 256);
+      charset.code_space_mask = xzalloc (256);
       for (i = 0; i < 4; i++)
        for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
             j++)
@@ -927,11 +924,11 @@ usage: (define-charset-internal ...)  */)
   charset.min_code = (charset.code_space[0]
                      | (charset.code_space[4] << 8)
                      | (charset.code_space[8] << 16)
-                     | (charset.code_space[12] << 24));
+                     | ((unsigned) charset.code_space[12] << 24));
   charset.max_code = (charset.code_space[1]
                      | (charset.code_space[5] << 8)
                      | (charset.code_space[9] << 16)
-                     | (charset.code_space[13] << 24));
+                     | ((unsigned) charset.code_space[13] << 24));
   charset.char_index_offset = 0;
 
   val = args[charset_arg_min_code];
@@ -941,8 +938,8 @@ usage: (define-charset-internal ...)  */)
 
       if (code < charset.min_code
          || code > charset.max_code)
-       args_out_of_range_3 (make_number (charset.min_code),
-                            make_number (charset.max_code), val);
+       args_out_of_range_3 (make_fixnum_or_float (charset.min_code),
+                            make_fixnum_or_float (charset.max_code), val);
       charset.char_index_offset = CODE_POINT_TO_INDEX (&charset, code);
       charset.min_code = code;
     }
@@ -954,8 +951,8 @@ usage: (define-charset-internal ...)  */)
 
       if (code < charset.min_code
          || code > charset.max_code)
-       args_out_of_range_3 (make_number (charset.min_code),
-                            make_number (charset.max_code), val);
+       args_out_of_range_3 (make_fixnum_or_float (charset.min_code),
+                            make_fixnum_or_float (charset.max_code), val);
       charset.max_code = code;
     }
 
@@ -968,18 +965,14 @@ usage: (define-charset-internal ...)  */)
        charset.invalid_code = 0;
       else
        {
-         XSETINT (val, charset.max_code + 1);
-         if (XINT (val) == charset.max_code + 1)
+         if (charset.max_code < UINT_MAX)
            charset.invalid_code = charset.max_code + 1;
          else
            error ("Attribute :invalid-code must be specified");
        }
     }
   else
-    {
-      CHECK_NATNUM (val);
-      charset.invalid_code = XFASTINT (val);
-    }
+    charset.invalid_code = cons_to_unsigned (val, UINT_MAX);
 
   val = args[charset_arg_iso_final];
   if (NILP (val))
@@ -997,9 +990,7 @@ usage: (define-charset-internal ...)  */)
     charset.iso_revision = -1;
   else
     {
-      CHECK_NUMBER (val);
-      if (XINT (val) > 63)
-       args_out_of_range (make_number (63), val);
+      CHECK_RANGED_INTEGER (val, -1, 63);
       charset.iso_revision = XINT (val);
     }
 
@@ -1025,17 +1016,17 @@ usage: (define-charset-internal ...)  */)
   if (! NILP (args[charset_arg_code_offset]))
     {
       val = args[charset_arg_code_offset];
-      CHECK_NUMBER (val);
+      CHECK_CHARACTER (val);
 
       charset.method = CHARSET_METHOD_OFFSET;
       charset.code_offset = XINT (val);
 
-      i = CODE_POINT_TO_INDEX (&charset, charset.min_code);
-      charset.min_char = i + charset.code_offset;
       i = CODE_POINT_TO_INDEX (&charset, charset.max_code);
-      charset.max_char = i + charset.code_offset;
-      if (charset.max_char > MAX_CHAR)
+      if (MAX_CHAR - charset.code_offset < i)
        error ("Unsupported max char: %d", charset.max_char);
+      charset.max_char = i + charset.code_offset;
+      i = CODE_POINT_TO_INDEX (&charset, charset.min_code);
+      charset.min_char = i + charset.code_offset;
 
       i = (charset.min_char >> 7) << 7;
       for (; i < 0x10000 && i <= charset.max_char; i += 128)
@@ -1106,7 +1097,7 @@ usage: (define-charset-internal ...)  */)
              car_part = XCAR (elt);
              cdr_part = XCDR (elt);
              CHECK_CHARSET_GET_ID (car_part, this_id);
-             CHECK_NUMBER (cdr_part);
+             CHECK_TYPE_RANGED_INTEGER (int, cdr_part);
              offset = XINT (cdr_part);
            }
          else
@@ -1395,8 +1386,8 @@ Optional third argument DEUNIFY, if non-nil, means to de-unify CHARSET.  */)
     }
   else if (CHAR_TABLE_P (Vchar_unify_table))
     {
-      int min_code = CHARSET_MIN_CODE (cs);
-      int max_code = CHARSET_MAX_CODE (cs);
+      unsigned min_code = CHARSET_MIN_CODE (cs);
+      unsigned max_code = CHARSET_MAX_CODE (cs);
       int min_char = DECODE_CHAR (cs, min_code);
       int max_char = DECODE_CHAR (cs, max_code);
 
@@ -1511,7 +1502,7 @@ string_xstring_p (Lisp_Object string)
    It may lookup a translation table TABLE if supplied.  */
 
 static void
-find_charsets_in_text (const unsigned char *ptr, EMACS_INT nchars, EMACS_INT nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte)
+find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte)
 {
   const unsigned char *pend = ptr + nbytes;
 
@@ -1558,7 +1549,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'.  */)
   (Lisp_Object beg, Lisp_Object end, Lisp_Object table)
 {
   Lisp_Object charsets;
-  EMACS_INT from, from_byte, to, stop, stop_byte;
+  ptrdiff_t from, from_byte, to, stop, stop_byte;
   int i;
   Lisp_Object val;
   int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
@@ -1642,7 +1633,7 @@ maybe_unify_char (int c, Lisp_Object val)
 
   CHECK_CHARSET_GET_CHARSET (val, charset);
 #ifdef REL_ALLOC
-  /* The call to load_charset below can allocate memory, whcih screws
+  /* The call to load_charset below can allocate memory, which screws
      callers of this function through STRING_CHAR_* macros that hold C
      pointers to buffer text, if REL_ALLOC is used.  */
   r_alloc_inhibit_buffer_relocation (1);
@@ -1849,7 +1840,7 @@ encode_char (struct charset *charset, int c)
     }
   else                         /* method == CHARSET_METHOD_OFFSET */
     {
-      int code_index = c - CHARSET_CODE_OFFSET (charset);
+      unsigned code_index = c - CHARSET_CODE_OFFSET (charset);
 
       code = INDEX_TO_CODE_POINT (charset, code_index);
     }
@@ -2416,7 +2407,7 @@ syms_of_charset (void)
   defsubr (&Ssort_charsets);
 
   DEFVAR_LISP ("charset-map-path", Vcharset_map_path,
-              doc: /* *List of directories to search for charset map files.  */);
+              doc: /* List of directories to search for charset map files.  */);
   Vcharset_map_path = Qnil;
 
   DEFVAR_BOOL ("inhibit-load-charset-map", inhibit_load_charset_map,
index 98bf35f644a74b65db8b3a4bbf70f86a270c541f..516582a3f3d600f489834d9ef711efde0fd9a83a 100644 (file)
@@ -401,7 +401,7 @@ extern Lisp_Object Vchar_charset_set;
    ? decode_char ((charset), (code))                                   \
    : (charset)->method == CHARSET_METHOD_OFFSET                                \
    ? ((charset)->code_linear_p                                         \
-      ? (code) - (charset)->min_code + (charset)->code_offset          \
+      ? (int) ((code) - (charset)->min_code) + (charset)->code_offset  \
       : decode_char ((charset), (code)))                               \
    : (charset)->method == CHARSET_METHOD_MAP                           \
    ? (((charset)->code_linear_p                                                \
@@ -411,16 +411,6 @@ extern Lisp_Object Vchar_charset_set;
       : decode_char ((charset), (code)))                               \
    : decode_char ((charset), (code)))
 
-
-/* If CHARSET is a simple offset base charset, return it's offset,
-   otherwise return -1.  */
-#define CHARSET_OFFSET(charset)                                \
-  (((charset)->method == CHARSET_METHOD_OFFSET         \
-    && (charset)->code_linear_p                                \
-    && ! (charset)->unified_p)                         \
-   ? (charset)->code_offset - (charset)->min_code      \
-   : -1)
-
 extern Lisp_Object charset_work;
 
 /* Return a code point of CHAR in CHARSET.
@@ -430,7 +420,7 @@ extern Lisp_Object charset_work;
   (verify_expr                                                         \
    (sizeof (c) <= sizeof (int),                                                \
     (ASCII_CHAR_P (c) && (charset)->ascii_compatible_p                 \
-     ? (c)                                                             \
+     ? (unsigned) (c)                                                  \
      : ((charset)->unified_p                                           \
        || (charset)->method == CHARSET_METHOD_SUBSET                   \
        || (charset)->method == CHARSET_METHOD_SUPERSET)                \
@@ -439,7 +429,7 @@ extern Lisp_Object charset_work;
      ? (charset)->invalid_code                                         \
      : (charset)->method == CHARSET_METHOD_OFFSET                      \
      ? ((charset)->code_linear_p                                       \
-       ? (c) - (charset)->code_offset + (charset)->min_code            \
+       ? (unsigned) ((c) - (charset)->code_offset) + (charset)->min_code \
        : encode_char (charset, c))                                     \
      : (charset)->method == CHARSET_METHOD_MAP                         \
      ? (((charset)->compact_codes_p                                    \
@@ -447,7 +437,7 @@ extern Lisp_Object charset_work;
        ? (charset_work = CHAR_TABLE_REF (CHARSET_ENCODER (charset), c), \
           (NILP (charset_work)                                         \
            ? (charset)->invalid_code                                   \
-           : XFASTINT (charset_work)))                                 \
+           : (unsigned) XFASTINT (charset_work)))                      \
        : encode_char (charset, c))                                     \
      : encode_char (charset, c))))
 
index 8d903749284e538d23ba29fd131d52f3771aea78..e125296261241546c1b82eb04b0581776bfe1c0d 100644 (file)
@@ -107,9 +107,9 @@ the char-table has no extra slot.  */)
   else
     {
       CHECK_NATNUM (n);
-      n_extras = XINT (n);
-      if (n_extras > 10)
+      if (XINT (n) > 10)
        args_out_of_range (n, Qnil);
+      n_extras = XINT (n);
     }
 
   size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras;
@@ -646,7 +646,7 @@ or a character code.  Return VALUE.  */)
     }
   else if (EQ (range, Qnil))
     XCHAR_TABLE (char_table)->defalt = value;
-  else if (INTEGERP (range))
+  else if (CHARACTERP (range))
     char_table_set (char_table, XINT (range), value);
   else if (CONSP (range))
     {
@@ -1223,7 +1223,7 @@ static int uniprop_decoder_count
 static uniprop_decoder_t
 uniprop_get_decoder (Lisp_Object table)
 {
-  int i;
+  EMACS_INT i;
 
   if (! INTEGERP (XCHAR_TABLE (table)->extras[1]))
     return NULL;
@@ -1303,7 +1303,7 @@ static int uniprop_encoder_count
 static uniprop_decoder_t
 uniprop_get_encoder (Lisp_Object table)
 {
-  int i;
+  EMACS_INT i;
 
   if (! INTEGERP (XCHAR_TABLE (table)->extras[2]))
     return NULL;
index a020a447eb147c842796d4168d50b305d7c3b6d0..d617c7f81d9b7eeff9a8bc2f2bb3c71d7e4a09af 100644 (file)
@@ -22,8 +22,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 #include "lisp.h"
 #include "commands.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "syntax.h"
 #include "window.h"
 #include "keyboard.h"
@@ -47,6 +47,41 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
   return make_number (PT + XINT (n));
 }
 
+/* Add N to point; or subtract N if FORWARD is zero.  N defaults to 1.
+   Validate the new location.  Return nil.  */
+static Lisp_Object
+move_point (Lisp_Object n, int forward)
+{
+  /* This used to just set point to point + XINT (n), and then check
+     to see if it was within boundaries.  But now that SET_PT can
+     potentially do a lot of stuff (calling entering and exiting
+     hooks, etcetera), that's not a good approach.  So we validate the
+     proposed position, then set point.  */
+
+  EMACS_INT new_point;
+
+  if (NILP (n))
+    XSETFASTINT (n, 1);
+  else
+    CHECK_NUMBER (n);
+
+  new_point = PT + (forward ? XINT (n) : - XINT (n));
+
+  if (new_point < BEGV)
+    {
+      SET_PT (BEGV);
+      xsignal0 (Qbeginning_of_buffer);
+    }
+  if (new_point > ZV)
+    {
+      SET_PT (ZV);
+      xsignal0 (Qend_of_buffer);
+    }
+
+  SET_PT (new_point);
+  return Qnil;
+}
+
 DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p",
        doc: /* Move point N characters forward (backward if N is negative).
 On reaching end or beginning of buffer, stop and signal error.
@@ -56,34 +91,7 @@ right or to the left on the screen.  This is in contrast with
 \\[right-char], which see.  */)
   (Lisp_Object n)
 {
-  if (NILP (n))
-    XSETFASTINT (n, 1);
-  else
-    CHECK_NUMBER (n);
-
-  /* This used to just set point to point + XINT (n), and then check
-     to see if it was within boundaries.  But now that SET_PT can
-     potentially do a lot of stuff (calling entering and exiting
-     hooks, etcetera), that's not a good approach.  So we validate the
-     proposed position, then set point.  */
-  {
-    EMACS_INT new_point = PT + XINT (n);
-
-    if (new_point < BEGV)
-      {
-       SET_PT (BEGV);
-       xsignal0 (Qbeginning_of_buffer);
-      }
-    if (new_point > ZV)
-      {
-       SET_PT (ZV);
-       xsignal0 (Qend_of_buffer);
-      }
-
-    SET_PT (new_point);
-  }
-
-  return Qnil;
+  return move_point (n, 1);
 }
 
 DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p",
@@ -95,13 +103,7 @@ right or to the left on the screen.  This is in contrast with
 \\[left-char], which see.  */)
   (Lisp_Object n)
 {
-  if (NILP (n))
-    XSETFASTINT (n, 1);
-  else
-    CHECK_NUMBER (n);
-
-  XSETINT (n, - XINT (n));
-  return Fforward_char (n);
+  return move_point (n, 0);
 }
 
 DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p",
@@ -115,8 +117,8 @@ With positive N, a non-empty line at the end counts as one line
 successfully moved (for the return value).  */)
   (Lisp_Object n)
 {
-  EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
-  EMACS_INT pos, pos_byte;
+  ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;
+  ptrdiff_t pos, pos_byte;
   EMACS_INT count, shortage;
 
   if (NILP (n))
@@ -187,7 +189,7 @@ not move.  To ignore field boundaries bind `inhibit-field-text-motion'
 to t.  */)
   (Lisp_Object n)
 {
-  EMACS_INT newpos;
+  ptrdiff_t newpos;
 
   if (NILP (n))
     XSETFASTINT (n, 1);
@@ -303,7 +305,7 @@ At the end, it runs `post-self-insert-hook'.  */)
     bitch_at_user ();
   {
     int character = translate_char (Vtranslation_table_for_input,
-                                   (int) XINT (last_command_event));
+                                   XINT (last_command_event));
     int val = internal_self_insert (character, XFASTINT (n));
     if (val == 2)
       nonundocount = 0;
@@ -333,8 +335,8 @@ internal_self_insert (int c, EMACS_INT n)
   int len;
   /* Working buffer and pointer for multi-byte form of C.  */
   unsigned char str[MAX_MULTIBYTE_LENGTH];
-  EMACS_INT chars_to_delete = 0;
-  EMACS_INT spaces_to_insert = 0;
+  ptrdiff_t chars_to_delete = 0;
+  ptrdiff_t spaces_to_insert = 0;
 
   overwrite = BVAR (current_buffer, overwrite_mode);
   if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions))
@@ -371,50 +373,53 @@ internal_self_insert (int c, EMACS_INT n)
       /* This is the character after point.  */
       int c2 = FETCH_CHAR (PT_BYTE);
 
+      int cwidth;
+
       /* Overwriting in binary-mode always replaces C2 by C.
         Overwriting in textual-mode doesn't always do that.
         It inserts newlines in the usual way,
         and inserts any character at end of line
         or before a tab if it doesn't use the whole width of the tab.  */
       if (EQ (overwrite, Qoverwrite_mode_binary))
-       chars_to_delete = n;
-      else if (c != '\n' && c2 != '\n')
+       chars_to_delete = min (n, PTRDIFF_MAX);
+      else if (c != '\n' && c2 != '\n'
+              && (cwidth = XFASTINT (Fchar_width (make_number (c)))) != 0)
        {
-         EMACS_INT pos = PT;
-         EMACS_INT pos_byte = PT_BYTE;
-
-         /* FIXME: Check for integer overflow when calculating
-            target_clm and actual_clm.  */
-
-         /* Column the cursor should be placed at after this insertion.
-            The correct value should be calculated only when necessary.  */
-         EMACS_INT target_clm = (current_column ()
-                                 + n * XINT (Fchar_width (make_number (c))));
+         ptrdiff_t pos = PT;
+         ptrdiff_t pos_byte = PT_BYTE;
+         ptrdiff_t curcol = current_column ();
 
-         /* The actual cursor position after the trial of moving
-            to column TARGET_CLM.  It is greater than TARGET_CLM
-            if the TARGET_CLM is middle of multi-column
-            character.  In that case, the new point is set after
-            that character.  */
-         EMACS_INT actual_clm
-           = XFASTINT (Fmove_to_column (make_number (target_clm), Qnil));
-
-         chars_to_delete = PT - pos;
-
-         if (actual_clm > target_clm)
+         if (n <= (min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX) - curcol) / cwidth)
            {
-             /* We will delete too many columns.  Let's fill columns
-                by spaces so that the remaining text won't move.  */
-             EMACS_INT actual = PT_BYTE;
-             DEC_POS (actual);
-             if (FETCH_CHAR (actual) == '\t')
-               /* Rather than add spaces, let's just keep the tab. */
-               chars_to_delete--;
-             else
-               spaces_to_insert = actual_clm - target_clm;
+             /* Column the cursor should be placed at after this insertion.
+                The value should be calculated only when necessary.  */
+             ptrdiff_t target_clm = curcol + n * cwidth;
+
+             /* The actual cursor position after the trial of moving
+                to column TARGET_CLM.  It is greater than TARGET_CLM
+                if the TARGET_CLM is middle of multi-column
+                character.  In that case, the new point is set after
+                that character.  */
+             ptrdiff_t actual_clm
+               = XFASTINT (Fmove_to_column (make_number (target_clm), Qnil));
+
+             chars_to_delete = PT - pos;
+
+             if (actual_clm > target_clm)
+               {
+                 /* We will delete too many columns.  Let's fill columns
+                    by spaces so that the remaining text won't move.  */
+                 ptrdiff_t actual = PT_BYTE;
+                 DEC_POS (actual);
+                 if (FETCH_CHAR (actual) == '\t')
+                   /* Rather than add spaces, let's just keep the tab. */
+                   chars_to_delete--;
+                 else
+                   spaces_to_insert = actual_clm - target_clm;
+               }
+
+             SET_PT_BOTH (pos, pos_byte);
            }
-
-         SET_PT_BOTH (pos, pos_byte);
        }
       hairy = 2;
     }
index eb89563eef4cbce2250aa22973545e7566f93428..d9fcc634b77eac667462a301cfded8606630dbe5 100644 (file)
@@ -159,7 +159,7 @@ detect_coding_XXX (struct coding_system *coding,
   const unsigned char *src = coding->source;
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int multibytep = coding->src_multibyte;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int found = 0;
   ...;
 
@@ -266,7 +266,7 @@ encode_coding_XXX (struct coding_system *coding)
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   unsigned char *adjusted_dst_end = dst_end - _MAX_BYTES_PRODUCED_IN_LOOP_;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
 
   for (; charbuf < charbuf_end && dst < adjusted_dst_end; charbuf++)
     {
@@ -288,8 +288,8 @@ encode_coding_XXX (struct coding_system *coding)
 #include <setjmp.h>
 
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "ccl.h"
 #include "composite.h"
@@ -847,33 +847,35 @@ static int encode_coding_ccl (struct coding_system *);
 static void decode_coding_raw_text (struct coding_system *);
 static int encode_coding_raw_text (struct coding_system *);
 
-static EMACS_INT coding_set_source (struct coding_system *);
-static EMACS_INT coding_set_destination (struct coding_system *);
-static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT);
+static void coding_set_source (struct coding_system *);
+static ptrdiff_t coding_change_source (struct coding_system *);
+static void coding_set_destination (struct coding_system *);
+static ptrdiff_t coding_change_destination (struct coding_system *);
+static void coding_alloc_by_realloc (struct coding_system *, ptrdiff_t);
 static void coding_alloc_by_making_gap (struct coding_system *,
-                                        EMACS_INT, EMACS_INT);
+                                        ptrdiff_t, ptrdiff_t);
 static unsigned char *alloc_destination (struct coding_system *,
-                                         EMACS_INT, unsigned char *);
+                                         ptrdiff_t, unsigned char *);
 static void setup_iso_safe_charsets (Lisp_Object);
-static EMACS_INT encode_designation_at_bol (struct coding_system *,
+static ptrdiff_t encode_designation_at_bol (struct coding_system *,
                                      int *, int *, unsigned char *);
 static int detect_eol (const unsigned char *,
-                       EMACS_INT, enum coding_category);
+                       ptrdiff_t, enum coding_category);
 static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
 static void decode_eol (struct coding_system *);
 static Lisp_Object get_translation_table (Lisp_Object, int, int *);
 static Lisp_Object get_translation (Lisp_Object, int *, int *);
 static int produce_chars (struct coding_system *, Lisp_Object, int);
 static inline void produce_charset (struct coding_system *, int *,
-                                    EMACS_INT);
-static void produce_annotation (struct coding_system *, EMACS_INT);
+                                    ptrdiff_t);
+static void produce_annotation (struct coding_system *, ptrdiff_t);
 static int decode_coding (struct coding_system *);
-static inline int *handle_composition_annotation (EMACS_INT, EMACS_INT,
+static inline int *handle_composition_annotation (ptrdiff_t, ptrdiff_t,
                                                   struct coding_system *,
-                                                  int *, EMACS_INT *);
-static inline int *handle_charset_annotation (EMACS_INT, EMACS_INT,
+                                                  int *, ptrdiff_t *);
+static inline int *handle_charset_annotation (ptrdiff_t, ptrdiff_t,
                                               struct coding_system *,
-                                              int *, EMACS_INT *);
+                                              int *, ptrdiff_t *);
 static void consume_chars (struct coding_system *, Lisp_Object, int);
 static int encode_coding (struct coding_system *);
 static Lisp_Object make_conversion_work_buffer (int);
@@ -922,12 +924,12 @@ record_conversion_result (struct coding_system *coding,
 
 #define CODING_DECODE_CHAR(coding, src, src_base, src_end, charset, code, c) \
   do {                                                                      \
-    EMACS_INT offset;                                                       \
+    ptrdiff_t offset;                                                       \
                                                                             \
     charset_map_loaded = 0;                                                 \
     c = DECODE_CHAR (charset, code);                                        \
     if (charset_map_loaded                                                  \
-       && (offset = coding_set_source (coding)))                            \
+       && (offset = coding_change_source (coding)))                         \
       {                                                                             \
        src += offset;                                                       \
        src_base += offset;                                                  \
@@ -937,12 +939,12 @@ record_conversion_result (struct coding_system *coding,
 
 #define CODING_ENCODE_CHAR(coding, dst, dst_end, charset, c, code)     \
   do {                                                                 \
-    EMACS_INT offset;                                                  \
+    ptrdiff_t offset;                                                  \
                                                                        \
     charset_map_loaded = 0;                                            \
     code = ENCODE_CHAR (charset, c);                                   \
     if (charset_map_loaded                                             \
-       && (offset = coding_set_destination (coding)))                  \
+       && (offset = coding_change_destination (coding)))               \
       {                                                                        \
        dst += offset;                                                  \
        dst_end += offset;                                              \
@@ -951,12 +953,12 @@ record_conversion_result (struct coding_system *coding,
 
 #define CODING_CHAR_CHARSET(coding, dst, dst_end, c, charset_list, code_return, charset) \
   do {                                                                 \
-    EMACS_INT offset;                                                  \
+    ptrdiff_t offset;                                                  \
                                                                        \
     charset_map_loaded = 0;                                            \
     charset = char_charset (c, charset_list, code_return);             \
     if (charset_map_loaded                                             \
-       && (offset = coding_set_destination (coding)))                  \
+       && (offset = coding_change_destination (coding)))               \
       {                                                                        \
        dst += offset;                                                  \
        dst_end += offset;                                              \
@@ -965,12 +967,12 @@ record_conversion_result (struct coding_system *coding,
 
 #define CODING_CHAR_CHARSET_P(coding, dst, dst_end, c, charset, result)        \
   do {                                                                 \
-    EMACS_INT offset;                                                  \
+    ptrdiff_t offset;                                                  \
                                                                        \
     charset_map_loaded = 0;                                            \
     result = CHAR_CHARSET_P (c, charset);                              \
     if (charset_map_loaded                                             \
-       && (offset = coding_set_destination (coding)))                  \
+       && (offset = coding_change_destination (coding)))               \
       {                                                                        \
        dst += offset;                                                  \
        dst_end += offset;                                              \
@@ -987,7 +989,7 @@ record_conversion_result (struct coding_system *coding,
   do {                                                         \
     if (dst + (bytes) >= dst_end)                              \
       {                                                                \
-       EMACS_INT more_bytes = charbuf_end - charbuf + (bytes); \
+       ptrdiff_t more_bytes = charbuf_end - charbuf + (bytes); \
                                                                \
        dst = alloc_destination (coding, more_bytes, dst);      \
        dst_end = coding->destination + coding->dst_bytes;      \
@@ -1056,14 +1058,11 @@ record_conversion_result (struct coding_system *coding,
        | ((p)[-1] & 0x3F))))
 
 
-/* Update coding->source from coding->src_object, and return how many
-   bytes coding->source was changed.  */
+/* Set coding->source from coding->src_object.  */
 
-static EMACS_INT
+static void
 coding_set_source (struct coding_system *coding)
 {
-  const unsigned char *orig = coding->source;
-
   if (BUFFERP (coding->src_object))
     {
       struct buffer *buf = XBUFFER (coding->src_object);
@@ -1082,18 +1081,26 @@ coding_set_source (struct coding_system *coding)
       /* Otherwise, the source is C string and is never relocated
         automatically.  Thus we don't have to update anything.  */
     }
+}
+
+
+/* Set coding->source from coding->src_object, and return how many
+   bytes coding->source was changed.  */
+
+static ptrdiff_t
+coding_change_source (struct coding_system *coding)
+{
+  const unsigned char *orig = coding->source;
+  coding_set_source (coding);
   return coding->source - orig;
 }
 
 
-/* Update coding->destination from coding->dst_object, and return how
-   many bytes coding->destination was changed.  */
+/* Set coding->destination from coding->dst_object.  */
 
-static EMACS_INT
+static void
 coding_set_destination (struct coding_system *coding)
 {
-  const unsigned char *orig = coding->destination;
-
   if (BUFFERP (coding->dst_object))
     {
       if (BUFFERP (coding->src_object) && coding->src_pos < 0)
@@ -1118,23 +1125,34 @@ coding_set_destination (struct coding_system *coding)
       /* Otherwise, the destination is C string and is never relocated
         automatically.  Thus we don't have to update anything.  */
     }
+}
+
+
+/* Set coding->destination from coding->dst_object, and return how
+   many bytes coding->destination was changed.  */
+
+static ptrdiff_t
+coding_change_destination (struct coding_system *coding)
+{
+  const unsigned char *orig = coding->destination;
+  coding_set_destination (coding);
   return coding->destination - orig;
 }
 
 
 static void
-coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes)
+coding_alloc_by_realloc (struct coding_system *coding, ptrdiff_t bytes)
 {
   if (STRING_BYTES_BOUND - coding->dst_bytes < bytes)
     string_overflow ();
-  coding->destination = (unsigned char *) xrealloc (coding->destination,
-                                                   coding->dst_bytes + bytes);
+  coding->destination = xrealloc (coding->destination,
+                                 coding->dst_bytes + bytes);
   coding->dst_bytes += bytes;
 }
 
 static void
 coding_alloc_by_making_gap (struct coding_system *coding,
-                           EMACS_INT gap_head_used, EMACS_INT bytes)
+                           ptrdiff_t gap_head_used, ptrdiff_t bytes)
 {
   if (EQ (coding->src_object, coding->dst_object))
     {
@@ -1142,7 +1160,7 @@ coding_alloc_by_making_gap (struct coding_system *coding,
         consumed data at the tail.  To preserve those data, we at
         first make the gap size to zero, then increase the gap
         size.  */
-      EMACS_INT add = GAP_SIZE;
+      ptrdiff_t add = GAP_SIZE;
 
       GPT += gap_head_used, GPT_BYTE += gap_head_used;
       GAP_SIZE = 0; ZV += add; Z += add; ZV_BYTE += add; Z_BYTE += add;
@@ -1163,10 +1181,10 @@ coding_alloc_by_making_gap (struct coding_system *coding,
 
 
 static unsigned char *
-alloc_destination (struct coding_system *coding, EMACS_INT nbytes,
+alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
                   unsigned char *dst)
 {
-  EMACS_INT offset = dst - coding->destination;
+  ptrdiff_t offset = dst - coding->destination;
 
   if (BUFFERP (coding->dst_object))
     {
@@ -1267,7 +1285,7 @@ detect_coding_utf_8 (struct coding_system *coding,
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int multibytep = coding->src_multibyte;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int bom_found = 0;
   int found = 0;
 
@@ -1352,7 +1370,7 @@ decode_coding_utf_8 (struct coding_system *coding)
   const unsigned char *src_base;
   int *charbuf = coding->charbuf + coding->charbuf_used;
   int *charbuf_end = coding->charbuf + coding->charbuf_size;
-  EMACS_INT consumed_chars = 0, consumed_chars_base = 0;
+  ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
   int multibytep = coding->src_multibyte;
   enum utf_bom_type bom = CODING_UTF_8_BOM (coding);
   int eol_dos =
@@ -1503,7 +1521,7 @@ encode_coding_utf_8 (struct coding_system *coding)
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   int c;
 
   if (CODING_UTF_8_BOM (coding) == utf_with_bom)
@@ -1661,7 +1679,7 @@ decode_coding_utf_16 (struct coding_system *coding)
   int *charbuf = coding->charbuf + coding->charbuf_used;
   /* We may produces at most 3 chars in one loop.  */
   int *charbuf_end = coding->charbuf + coding->charbuf_size - 2;
-  EMACS_INT consumed_chars = 0, consumed_chars_base = 0;
+  ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
   int multibytep = coding->src_multibyte;
   enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
   enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding);
@@ -1788,7 +1806,7 @@ encode_coding_utf_16 (struct coding_system *coding)
   int safe_room = 8;
   enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
   int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   int c;
 
   if (bom != utf_without_bom)
@@ -1922,7 +1940,7 @@ detect_coding_emacs_mule (struct coding_system *coding,
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int multibytep = coding->src_multibyte;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int c;
   int found = 0;
 
@@ -2392,10 +2410,10 @@ decode_coding_emacs_mule (struct coding_system *coding)
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3)
       /* We can produce up to 2 characters in a loop.  */
       - 1;
-  EMACS_INT consumed_chars = 0, consumed_chars_base;
+  ptrdiff_t consumed_chars = 0, consumed_chars_base;
   int multibytep = coding->src_multibyte;
-  EMACS_INT char_offset = coding->produced_char;
-  EMACS_INT last_offset = char_offset;
+  ptrdiff_t char_offset = coding->produced_char;
+  ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
   int eol_dos =
     !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
@@ -2467,7 +2485,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
             original pointer to buffer text, and fix up all related
             pointers after the call.  */
          const unsigned char *orig = coding->source;
-         EMACS_INT offset;
+         ptrdiff_t offset;
 
          c = emacs_mule_char (coding, src_base, &nbytes, &nchars, &id,
                               cmp_status);
@@ -2648,7 +2666,7 @@ encode_coding_emacs_mule (struct coding_system *coding)
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   int safe_room = 8;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, charset_list;
   int c;
   int preferred_charset_id = -1;
@@ -2941,7 +2959,7 @@ setup_iso_safe_charsets (Lisp_Object attrs)
   Lisp_Object request;
   Lisp_Object reg_usage;
   Lisp_Object tail;
-  int reg94, reg96;
+  EMACS_INT reg94, reg96;
   int flags = XINT (AREF (attrs, coding_attr_iso_flags));
   int max_charset_id;
 
@@ -3012,7 +3030,7 @@ detect_coding_iso_2022 (struct coding_system *coding,
   int single_shifting = 0;
   int id;
   int c, c1;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int i;
   int rejected = 0;
   int found = 0;
@@ -3171,7 +3189,7 @@ detect_coding_iso_2022 (struct coding_system *coding,
            break;
        check_extra_latin:
          if (! VECTORP (Vlatin_extra_code_table)
-             || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c]))
+             || NILP (AREF (Vlatin_extra_code_table, c)))
            {
              rejected = CATEGORY_MASK_ISO;
              break;
@@ -3522,7 +3540,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
      loop and one more charset annotation at the end.  */
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
-  EMACS_INT consumed_chars = 0, consumed_chars_base;
+  ptrdiff_t consumed_chars = 0, consumed_chars_base;
   int multibytep = coding->src_multibyte;
   /* Charsets invoked to graphic plane 0 and 1 respectively.  */
   int charset_id_0 = CODING_ISO_INVOKED_CHARSET (coding, 0);
@@ -3532,8 +3550,8 @@ decode_coding_iso_2022 (struct coding_system *coding)
   int c;
   struct composition_status *cmp_status = CODING_ISO_CMP_STATUS (coding);
   Lisp_Object attrs = CODING_ID_ATTRS (coding->id);
-  EMACS_INT char_offset = coding->produced_char;
-  EMACS_INT last_offset = char_offset;
+  ptrdiff_t char_offset = coding->produced_char;
+  ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
   int eol_dos =
     !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
@@ -4245,7 +4263,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
 
 #define ENCODE_ISO_CHARACTER(charset, c)                                  \
   do {                                                                    \
-    int code;                                                             \
+    unsigned code;                                                        \
     CODING_ENCODE_CHAR (coding, dst, dst_end, (charset), (c), code);      \
                                                                           \
     if (CHARSET_DIMENSION (charset) == 1)                                 \
@@ -4262,10 +4280,10 @@ decode_coding_iso_2022 (struct coding_system *coding)
 static unsigned char *
 encode_invocation_designation (struct charset *charset,
                               struct coding_system *coding,
-                              unsigned char *dst, EMACS_INT *p_nchars)
+                              unsigned char *dst, ptrdiff_t *p_nchars)
 {
   int multibytep = coding->dst_multibyte;
-  EMACS_INT produced_chars = *p_nchars;
+  ptrdiff_t produced_chars = *p_nchars;
   int reg;                     /* graphic register number */
   int id = CHARSET_ID (charset);
 
@@ -4351,7 +4369,7 @@ encode_invocation_designation (struct charset *charset,
    If the current block ends before any end-of-line, we may fail to
    find all the necessary designations.  */
 
-static EMACS_INT
+static ptrdiff_t
 encode_designation_at_bol (struct coding_system *coding,
                           int *charbuf, int *charbuf_end,
                           unsigned char *dst)
@@ -4361,7 +4379,7 @@ encode_designation_at_bol (struct coding_system *coding,
   /* Table of charsets to be designated to each graphic register.  */
   int r[4];
   int c, found = 0, reg;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   int multibytep = coding->dst_multibyte;
   Lisp_Object attrs;
   Lisp_Object charset_list;
@@ -4416,7 +4434,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
   int bol_designation
     = (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL
        && CODING_ISO_BOL (coding));
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, eol_type, charset_list;
   int ascii_compatible;
   int c;
@@ -4446,13 +4464,13 @@ encode_coding_iso_2022 (struct coding_system *coding)
          /* We have to produce designation sequences if any now.  */
          unsigned char desig_buf[16];
          int nbytes;
-         EMACS_INT offset;
+         ptrdiff_t offset;
 
          charset_map_loaded = 0;
          nbytes = encode_designation_at_bol (coding, charbuf, charbuf_end,
                                              desig_buf);
          if (charset_map_loaded
-             && (offset = coding_set_destination (coding)))
+             && (offset = coding_change_destination (coding)))
            {
              dst += offset;
              dst_end += offset;
@@ -4623,7 +4641,7 @@ detect_coding_sjis (struct coding_system *coding,
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int multibytep = coding->src_multibyte;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int found = 0;
   int c;
   Lisp_Object attrs, charset_list;
@@ -4680,7 +4698,7 @@ detect_coding_big5 (struct coding_system *coding,
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int multibytep = coding->src_multibyte;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int found = 0;
   int c;
 
@@ -4731,13 +4749,13 @@ decode_coding_sjis (struct coding_system *coding)
      the end.  */
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
-  EMACS_INT consumed_chars = 0, consumed_chars_base;
+  ptrdiff_t consumed_chars = 0, consumed_chars_base;
   int multibytep = coding->src_multibyte;
   struct charset *charset_roman, *charset_kanji, *charset_kana;
   struct charset *charset_kanji2;
   Lisp_Object attrs, charset_list, val;
-  EMACS_INT char_offset = coding->produced_char;
-  EMACS_INT last_offset = char_offset;
+  ptrdiff_t char_offset = coding->produced_char;
+  ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
   int eol_dos =
     !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
@@ -4849,12 +4867,12 @@ decode_coding_big5 (struct coding_system *coding)
      the end.  */
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
-  EMACS_INT consumed_chars = 0, consumed_chars_base;
+  ptrdiff_t consumed_chars = 0, consumed_chars_base;
   int multibytep = coding->src_multibyte;
   struct charset *charset_roman, *charset_big5;
   Lisp_Object attrs, charset_list, val;
-  EMACS_INT char_offset = coding->produced_char;
-  EMACS_INT last_offset = char_offset;
+  ptrdiff_t char_offset = coding->produced_char;
+  ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
   int eol_dos =
     !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
@@ -4951,7 +4969,7 @@ encode_coding_sjis (struct coding_system *coding)
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   int safe_room = 4;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, charset_list, val;
   int ascii_compatible;
   struct charset *charset_kanji, *charset_kana;
@@ -5045,7 +5063,7 @@ encode_coding_big5 (struct coding_system *coding)
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   int safe_room = 4;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, charset_list, val;
   int ascii_compatible;
   struct charset *charset_big5;
@@ -5123,10 +5141,10 @@ detect_coding_ccl (struct coding_system *coding,
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int multibytep = coding->src_multibyte;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int found = 0;
   unsigned char *valids;
-  EMACS_INT head_ascii = coding->head_ascii;
+  ptrdiff_t head_ascii = coding->head_ascii;
   Lisp_Object attrs;
 
   detect_info->checked |= CATEGORY_MASK_CCL;
@@ -5163,7 +5181,7 @@ decode_coding_ccl (struct coding_system *coding)
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int *charbuf = coding->charbuf + coding->charbuf_used;
   int *charbuf_end = coding->charbuf + coding->charbuf_size;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   int multibytep = coding->src_multibyte;
   struct ccl_program *ccl = &coding->spec.ccl->ccl;
   int source_charbuf[1024];
@@ -5235,7 +5253,7 @@ encode_coding_ccl (struct coding_system *coding)
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   int destination_charbuf[1024];
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   int i;
   Lisp_Object attrs, charset_list;
 
@@ -5323,7 +5341,7 @@ encode_coding_raw_text (struct coding_system *coding)
   int *charbuf_end = coding->charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   int c;
 
   if (multibytep)
@@ -5406,10 +5424,10 @@ detect_coding_charset (struct coding_system *coding,
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
   int multibytep = coding->src_multibyte;
-  EMACS_INT consumed_chars = 0;
+  ptrdiff_t consumed_chars = 0;
   Lisp_Object attrs, valids, name;
   int found = 0;
-  EMACS_INT head_ascii = coding->head_ascii;
+  ptrdiff_t head_ascii = coding->head_ascii;
   int check_latin_extra = 0;
 
   detect_info->checked |= CATEGORY_MASK_CHARSET;
@@ -5446,7 +5464,7 @@ detect_coding_charset (struct coding_system *coding,
          if (c < 0xA0
              && check_latin_extra
              && (!VECTORP (Vlatin_extra_code_table)
-                 || NILP (XVECTOR (Vlatin_extra_code_table)->contents[c])))
+                 || NILP (AREF (Vlatin_extra_code_table, c))))
            break;
          found = CATEGORY_MASK_CHARSET;
        }
@@ -5513,12 +5531,12 @@ decode_coding_charset (struct coding_system *coding)
      the end.  */
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
-  EMACS_INT consumed_chars = 0, consumed_chars_base;
+  ptrdiff_t consumed_chars = 0, consumed_chars_base;
   int multibytep = coding->src_multibyte;
   Lisp_Object attrs = CODING_ID_ATTRS (coding->id);
   Lisp_Object valids;
-  EMACS_INT char_offset = coding->produced_char;
-  EMACS_INT last_offset = char_offset;
+  ptrdiff_t char_offset = coding->produced_char;
+  ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
   int eol_dos =
     !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
@@ -5639,7 +5657,7 @@ encode_coding_charset (struct coding_system *coding)
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   int safe_room = MAX_MULTIBYTE_LENGTH;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, charset_list;
   int ascii_compatible;
   int c;
@@ -6188,7 +6206,7 @@ complement_process_encoding_system (Lisp_Object coding_system)
 #define MAX_EOL_CHECK_COUNT 3
 
 static int
-detect_eol (const unsigned char *source, EMACS_INT src_bytes,
+detect_eol (const unsigned char *source, ptrdiff_t src_bytes,
            enum coding_category category)
 {
   const unsigned char *src = source, *src_end = src + src_bytes;
@@ -6549,7 +6567,7 @@ decode_eol (struct coding_system *coding)
     }
   else if (EQ (eol_type, Qdos))
     {
-      EMACS_INT n = 0;
+      ptrdiff_t n = 0;
 
       if (NILP (coding->dst_object))
        {
@@ -6564,9 +6582,9 @@ decode_eol (struct coding_system *coding)
        }
       else
        {
-         EMACS_INT pos_byte = coding->dst_pos_byte;
-         EMACS_INT pos = coding->dst_pos;
-         EMACS_INT pos_end = pos + coding->produced_char - 1;
+         ptrdiff_t pos_byte = coding->dst_pos_byte;
+         ptrdiff_t pos = coding->dst_pos;
+         ptrdiff_t pos_end = pos + coding->produced_char - 1;
 
          while (pos < pos_end)
            {
@@ -6706,8 +6724,8 @@ get_translation (Lisp_Object trans, int *buf, int *buf_end)
     {
       Lisp_Object val = XCAR (trans);
       Lisp_Object from = XCAR (val);
-      int len = ASIZE (from);
-      int i;
+      ptrdiff_t len = ASIZE (from);
+      ptrdiff_t i;
 
       for (i = 0; i < len; i++)
        {
@@ -6729,8 +6747,8 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
 {
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
-  EMACS_INT produced;
-  EMACS_INT produced_chars = 0;
+  ptrdiff_t produced;
+  ptrdiff_t produced_chars = 0;
   int carryover = 0;
 
   if (! coding->chars_at_source)
@@ -6747,11 +6765,12 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
 
       while (buf < buf_end)
        {
-         int c = *buf, i;
+         int c = *buf;
+         ptrdiff_t i;
 
          if (c >= 0)
            {
-             EMACS_INT from_nchars = 1, to_nchars = 1;
+             ptrdiff_t from_nchars = 1, to_nchars = 1;
              Lisp_Object trans = Qnil;
 
              LOOKUP_TRANSLATION_TABLE (translation_table, c, trans);
@@ -6828,7 +6847,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
          if (coding->src_multibyte)
            {
              int multibytep = 1;
-             EMACS_INT consumed_chars = 0;
+             ptrdiff_t consumed_chars = 0;
 
              while (1)
                {
@@ -6842,7 +6861,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
                        dst_end = (unsigned char *) src;
                      if (dst == dst_end)
                        {
-                         EMACS_INT offset = src - coding->source;
+                         ptrdiff_t offset = src - coding->source;
 
                          dst = alloc_destination (coding, src_end - src + 1,
                                                   dst);
@@ -6872,8 +6891,8 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
                      dst_end = (unsigned char *) src;
                    if (dst >= dst_end - 1)
                      {
-                       EMACS_INT offset = src - coding->source;
-                       EMACS_INT more_bytes;
+                       ptrdiff_t offset = src - coding->source;
+                       ptrdiff_t more_bytes;
 
                        if (EQ (coding->src_object, coding->dst_object))
                          more_bytes = ((src_end - src) / 2) + 2;
@@ -6895,11 +6914,11 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
        {
          if (!EQ (coding->src_object, coding->dst_object))
            {
-             EMACS_INT require = coding->src_bytes - coding->dst_bytes;
+             ptrdiff_t require = coding->src_bytes - coding->dst_bytes;
 
              if (require > 0)
                {
-                 EMACS_INT offset = src - coding->source;
+                 ptrdiff_t offset = src - coding->source;
 
                  dst = alloc_destination (coding, require, dst);
                  coding_set_source (coding);
@@ -6927,10 +6946,10 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
  */
 
 static inline void
-produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos)
+produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
 {
   int len;
-  EMACS_INT to;
+  ptrdiff_t to;
   enum composition_method method;
   Lisp_Object components;
 
@@ -6971,9 +6990,9 @@ produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos)
  */
 
 static inline void
-produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos)
+produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
 {
-  EMACS_INT from = pos - charbuf[2];
+  ptrdiff_t from = pos - charbuf[2];
   struct charset *charset = CHARSET_FROM_ID (charbuf[3]);
 
   Fput_text_property (make_number (from), make_number (pos),
@@ -6991,7 +7010,7 @@ produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos)
     coding->charbuf = NULL;                                            \
     while (size > 1024)                                                        \
       {                                                                        \
-       coding->charbuf = (int *) alloca (sizeof (int) * size);         \
+       coding->charbuf = alloca (sizeof (int) * size);                 \
        if (coding->charbuf)                                            \
          break;                                                        \
        size >>= 1;                                                     \
@@ -7006,7 +7025,7 @@ produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos)
 
 
 static void
-produce_annotation (struct coding_system *coding, EMACS_INT pos)
+produce_annotation (struct coding_system *coding, ptrdiff_t pos)
 {
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
@@ -7106,7 +7125,7 @@ decode_coding (struct coding_system *coding)
     }
   do
     {
-      EMACS_INT pos = coding->dst_pos + coding->produced_char;
+      ptrdiff_t pos = coding->dst_pos + coding->produced_char;
 
       coding_set_source (coding);
       coding->annotated = 0;
@@ -7199,11 +7218,11 @@ decode_coding (struct coding_system *coding)
    return BUF.  */
 
 static inline int *
-handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
+handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit,
                               struct coding_system *coding, int *buf,
-                              EMACS_INT *stop)
+                              ptrdiff_t *stop)
 {
-  EMACS_INT start, end;
+  ptrdiff_t start, end;
   Lisp_Object prop;
 
   if (! find_composition (pos, limit, &start, &end, &prop, coding->src_object)
@@ -7225,7 +7244,7 @@ handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
          if (method != COMPOSITION_RELATIVE)
            {
              Lisp_Object components;
-             int len, i, i_byte;
+             ptrdiff_t i, len, i_byte;
 
              components = COMPOSITION_COMPONENTS (prop);
              if (VECTORP (components))
@@ -7282,9 +7301,9 @@ handle_composition_annotation (EMACS_INT pos, EMACS_INT limit,
    property value is non-nil (limiting by LIMIT), and return BUF.  */
 
 static inline int *
-handle_charset_annotation (EMACS_INT pos, EMACS_INT limit,
+handle_charset_annotation (ptrdiff_t pos, ptrdiff_t limit,
                           struct coding_system *coding, int *buf,
-                          EMACS_INT *stop)
+                          ptrdiff_t *stop)
 {
   Lisp_Object val, next;
   int id;
@@ -7311,12 +7330,12 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
   int *buf_end = coding->charbuf + coding->charbuf_size;
   const unsigned char *src = coding->source + coding->consumed;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  EMACS_INT pos = coding->src_pos + coding->consumed_char;
-  EMACS_INT end_pos = coding->src_pos + coding->src_chars;
+  ptrdiff_t pos = coding->src_pos + coding->consumed_char;
+  ptrdiff_t end_pos = coding->src_pos + coding->src_chars;
   int multibytep = coding->src_multibyte;
   Lisp_Object eol_type;
   int c;
-  EMACS_INT stop, stop_composition, stop_charset;
+  ptrdiff_t stop, stop_composition, stop_charset;
   int *lookup_buf = NULL;
 
   if (! NILP (translation_table))
@@ -7365,7 +7384,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
 
       if (! multibytep)
        {
-         EMACS_INT bytes;
+         int bytes;
 
          if (coding->encoder == encode_coding_raw_text
              || coding->encoder == encode_coding_ccl)
@@ -7396,7 +7415,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
        *buf++ = c;
       else
        {
-         int from_nchars = 1, to_nchars = 1;
+         ptrdiff_t from_nchars = 1, to_nchars = 1;
          int *lookup_buf_end;
          const unsigned char *p = src;
          int i;
@@ -7417,7 +7436,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
              else
                {
                  to_nchars = ASIZE (trans);
-                 if (buf + to_nchars > buf_end)
+                 if (buf_end - buf < to_nchars)
                    break;
                  c = XINT (AREF (trans, 0));
                }
@@ -7591,9 +7610,9 @@ code_conversion_save (int with_work_buf, int multibyte)
 
 int
 decode_coding_gap (struct coding_system *coding,
-                  EMACS_INT chars, EMACS_INT bytes)
+                  ptrdiff_t chars, ptrdiff_t bytes)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object attrs;
 
   code_conversion_save (0, 0);
@@ -7620,7 +7639,7 @@ decode_coding_gap (struct coding_system *coding,
   attrs = CODING_ID_ATTRS (coding->id);
   if (! NILP (CODING_ATTR_POST_READ (attrs)))
     {
-      EMACS_INT prev_Z = Z, prev_Z_BYTE = Z_BYTE;
+      ptrdiff_t prev_Z = Z, prev_Z_BYTE = Z_BYTE;
       Lisp_Object val;
 
       TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte);
@@ -7668,15 +7687,15 @@ decode_coding_gap (struct coding_system *coding,
 void
 decode_coding_object (struct coding_system *coding,
                      Lisp_Object src_object,
-                     EMACS_INT from, EMACS_INT from_byte,
-                     EMACS_INT to, EMACS_INT to_byte,
+                     ptrdiff_t from, ptrdiff_t from_byte,
+                     ptrdiff_t to, ptrdiff_t to_byte,
                      Lisp_Object dst_object)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   unsigned char *destination IF_LINT (= NULL);
-  EMACS_INT dst_bytes IF_LINT (= 0);
-  EMACS_INT chars = to - from;
-  EMACS_INT bytes = to_byte - from_byte;
+  ptrdiff_t dst_bytes IF_LINT (= 0);
+  ptrdiff_t chars = to - from;
+  ptrdiff_t bytes = to_byte - from_byte;
   Lisp_Object attrs;
   int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
   int need_marker_adjustment = 0;
@@ -7769,7 +7788,7 @@ decode_coding_object (struct coding_system *coding,
   if (! NILP (CODING_ATTR_POST_READ (attrs)))
     {
       struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
-      EMACS_INT prev_Z = Z, prev_Z_BYTE = Z_BYTE;
+      ptrdiff_t prev_Z = Z, prev_Z_BYTE = Z_BYTE;
       Lisp_Object val;
 
       TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte);
@@ -7858,13 +7877,13 @@ decode_coding_object (struct coding_system *coding,
 void
 encode_coding_object (struct coding_system *coding,
                      Lisp_Object src_object,
-                     EMACS_INT from, EMACS_INT from_byte,
-                     EMACS_INT to, EMACS_INT to_byte,
+                     ptrdiff_t from, ptrdiff_t from_byte,
+                     ptrdiff_t to, ptrdiff_t to_byte,
                      Lisp_Object dst_object)
 {
-  int count = SPECPDL_INDEX ();
-  EMACS_INT chars = to - from;
-  EMACS_INT bytes = to_byte - from_byte;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  ptrdiff_t chars = to - from;
+  ptrdiff_t bytes = to_byte - from_byte;
   Lisp_Object attrs;
   int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
   int need_marker_adjustment = 0;
@@ -7987,7 +8006,7 @@ encode_coding_object (struct coding_system *coding,
     {
       ptrdiff_t dst_bytes = max (1, coding->src_chars);
       coding->dst_object = Qnil;
-      coding->destination = (unsigned char *) xmalloc (dst_bytes);
+      coding->destination = xmalloc (dst_bytes);
       coding->dst_bytes = dst_bytes;
       coding->dst_multibyte = 0;
     }
@@ -8112,7 +8131,7 @@ are lower-case).  */)
   (Lisp_Object prompt, Lisp_Object default_coding_system)
 {
   Lisp_Object val;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   if (SYMBOLP (default_coding_system))
     default_coding_system = SYMBOL_NAME (default_coding_system);
@@ -8164,7 +8183,7 @@ function `define-coding-system'.  */)
 
 Lisp_Object
 detect_coding_system (const unsigned char *src,
-                     EMACS_INT src_chars, EMACS_INT src_bytes,
+                     ptrdiff_t src_chars, ptrdiff_t src_bytes,
                      int highest, int multibytep,
                      Lisp_Object coding_system)
 {
@@ -8484,8 +8503,8 @@ If optional argument HIGHEST is non-nil, return the coding system of
 highest priority.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object highest)
 {
-  int from, to;
-  int from_byte, to_byte;
+  ptrdiff_t from, to;
+  ptrdiff_t from_byte, to_byte;
 
   CHECK_NUMBER_COERCE_MARKER (start);
   CHECK_NUMBER_COERCE_MARKER (end);
@@ -8565,7 +8584,7 @@ DEFUN ("find-coding-systems-region-internal",
   (Lisp_Object start, Lisp_Object end, Lisp_Object exclude)
 {
   Lisp_Object coding_attrs_list, safe_codings;
-  EMACS_INT start_byte, end_byte;
+  ptrdiff_t start_byte, end_byte;
   const unsigned char *p, *pbeg, *pend;
   int c;
   Lisp_Object tail, elt, work_table;
@@ -8659,7 +8678,7 @@ DEFUN ("find-coding-systems-region-internal",
            }
          if (charset_map_loaded)
            {
-             EMACS_INT p_offset = p - pbeg, pend_offset = pend - pbeg;
+             ptrdiff_t p_offset = p - pbeg, pend_offset = pend - pbeg;
 
              if (STRINGP (start))
                pbeg = SDATA (start);
@@ -8697,11 +8716,11 @@ for un-encodable characters.  In that case, START and END are indexes
 to the string.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string)
 {
-  int n;
+  EMACS_INT n;
   struct coding_system coding;
   Lisp_Object attrs, charset_list, translation_table;
   Lisp_Object positions;
-  int from, to;
+  ptrdiff_t from, to;
   const unsigned char *p, *stop, *pend;
   int ascii_compatible;
 
@@ -8734,11 +8753,10 @@ to the string.  */)
       CHECK_STRING (string);
       CHECK_NATNUM (start);
       CHECK_NATNUM (end);
+      if (! (XINT (start) <= XINT (end) && XINT (end) <= SCHARS (string)))
+       args_out_of_range_3 (string, start, end);
       from = XINT (start);
       to = XINT (end);
-      if (from > to
-         || to > SCHARS (string))
-       args_out_of_range_3 (string, start, end);
       if (! STRING_MULTIBYTE (string))
        return Qnil;
       p = SDATA (string) + string_char_to_byte (string, from);
@@ -8824,8 +8842,8 @@ is nil.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system_list)
 {
   Lisp_Object list;
-  EMACS_INT start_byte, end_byte;
-  int pos;
+  ptrdiff_t start_byte, end_byte;
+  ptrdiff_t pos;
   const unsigned char *p, *pbeg, *pend;
   int c;
   Lisp_Object tail, elt, attrs;
@@ -8898,7 +8916,7 @@ is nil.  */)
            }
          if (charset_map_loaded)
            {
-             EMACS_INT p_offset = p - pbeg, pend_offset = pend - pbeg;
+             ptrdiff_t p_offset = p - pbeg, pend_offset = pend - pbeg;
 
              if (STRINGP (start))
                pbeg = SDATA (start);
@@ -8931,7 +8949,7 @@ code_convert_region (Lisp_Object start, Lisp_Object end,
                     int encodep, int norecord)
 {
   struct coding_system coding;
-  EMACS_INT from, from_byte, to, to_byte;
+  ptrdiff_t from, from_byte, to, to_byte;
   Lisp_Object src_object;
 
   CHECK_NUMBER_COERCE_MARKER (start);
@@ -9019,7 +9037,7 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system,
                     Lisp_Object dst_object, int encodep, int nocopy, int norecord)
 {
   struct coding_system coding;
-  EMACS_INT chars, bytes;
+  ptrdiff_t chars, bytes;
 
   CHECK_STRING (string);
   if (NILP (coding_system))
@@ -9394,9 +9412,9 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...)  */)
     error ("Too few arguments");
   operation = args[0];
   if (!SYMBOLP (operation)
-      || !NATNUMP (target_idx = Fget (operation, Qtarget_idx)))
+      || (target_idx = Fget (operation, Qtarget_idx), !NATNUMP (target_idx)))
     error ("Invalid first argument");
-  if (nargs < 1 + XFASTINT (target_idx))
+  if (nargs <= 1 + XFASTINT (target_idx))
     error ("Too few arguments for operation `%s'",
           SDATA (SYMBOL_NAME (operation)));
   target = args[XFASTINT (target_idx) + 1];
@@ -9550,7 +9568,7 @@ make_subsidiaries (Lisp_Object base)
 {
   Lisp_Object subsidiaries;
   ptrdiff_t base_name_len = SBYTES (SYMBOL_NAME (base));
-  char *buf = (char *) alloca (base_name_len + 6);
+  char *buf = alloca (base_name_len + 6);
   int i;
 
   memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
@@ -9615,8 +9633,12 @@ usage: (define-coding-system-internal ...)  */)
          charset_list = Vemacs_mule_charset_list;
        }
       for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
-       if (max_charset_id < XFASTINT (XCAR (tail)))
-         max_charset_id = XFASTINT (XCAR (tail));
+       {
+         if (! RANGED_INTEGERP (0, XCAR (tail), INT_MAX - 1))
+           error ("Invalid charset-list");
+         if (max_charset_id < XFASTINT (XCAR (tail)))
+           max_charset_id = XFASTINT (XCAR (tail));
+       }
     }
   else
     {
@@ -9769,30 +9791,30 @@ usage: (define-coding-system-internal ...)  */)
 
       val = args[coding_arg_ccl_valids];
       valids = Fmake_string (make_number (256), make_number (0));
-      for (tail = val; !NILP (tail); tail = Fcdr (tail))
+      for (tail = val; CONSP (tail); tail = XCDR (tail))
        {
          int from, to;
 
-         val = Fcar (tail);
+         val = XCAR (tail);
          if (INTEGERP (val))
            {
-             from = to = XINT (val);
-             if (from < 0 || from > 255)
+             if (! (0 <= XINT (val) && XINT (val) <= 255))
                args_out_of_range_3 (val, make_number (0), make_number (255));
+             from = to = XINT (val);
            }
          else
            {
              CHECK_CONS (val);
              CHECK_NATNUM_CAR (val);
-             CHECK_NATNUM_CDR (val);
-             from = XINT (XCAR (val));
-             if (from > 255)
+             CHECK_NUMBER_CDR (val);
+             if (XINT (XCAR (val)) > 255)
                args_out_of_range_3 (XCAR (val),
                                     make_number (0), make_number (255));
-             to = XINT (XCDR (val));
-             if (to < from || to > 255)
+             from = XINT (XCAR (val));
+             if (! (from <= XINT (XCDR (val)) && XINT (XCDR (val)) <= 255))
                args_out_of_range_3 (XCDR (val),
                                     XCAR (val), make_number (255));
+             to = XINT (XCDR (val));
            }
          for (i = from; i <= to; i++)
            SSET (valids, i, 1);
@@ -9870,12 +9892,12 @@ usage: (define-coding-system-internal ...)  */)
       CHECK_NUMBER_CDR (reg_usage);
 
       request = Fcopy_sequence (args[coding_arg_iso2022_request]);
-      for (tail = request; ! NILP (tail); tail = Fcdr (tail))
+      for (tail = request; CONSP (tail); tail = XCDR (tail))
        {
          int id;
          Lisp_Object tmp1;
 
-         val = Fcar (tail);
+         val = XCAR (tail);
          CHECK_CONS (val);
          tmp1 = XCAR (val);
          CHECK_CHARSET_GET_ID (tmp1, id);
@@ -9887,9 +9909,10 @@ usage: (define-coding-system-internal ...)  */)
 
       flags = args[coding_arg_iso2022_flags];
       CHECK_NATNUM (flags);
-      i = XINT (flags);
+      i = XINT (flags) & INT_MAX;
       if (EQ (args[coding_arg_charset_list], Qiso_2022))
-       flags = make_number (i | CODING_ISO_FLAG_FULL_SUPPORT);
+       i |= CODING_ISO_FLAG_FULL_SUPPORT;
+      flags = make_number (i);
 
       ASET (attrs, coding_attr_iso_initial, initial);
       ASET (attrs, coding_attr_iso_usage, reg_usage);
@@ -10327,7 +10350,7 @@ syms_of_coding (void)
   Vcode_conversion_reused_workbuf = Qnil;
 
   staticpro (&Vcode_conversion_workbuf_name);
-  Vcode_conversion_workbuf_name = make_pure_c_string (" *code-conversion-work*");
+  Vcode_conversion_workbuf_name = build_pure_c_string (" *code-conversion-work*");
 
   reused_workbuf_in_use = 0;
 
@@ -10390,7 +10413,7 @@ syms_of_coding (void)
   Fput (Qcoding_system_error, Qerror_conditions,
        pure_cons (Qcoding_system_error, pure_cons (Qerror, Qnil)));
   Fput (Qcoding_system_error, Qerror_message,
-       make_pure_c_string ("Invalid coding system"));
+       build_pure_c_string ("Invalid coding system"));
 
   /* Intern this now in case it isn't already done.
      Setting this variable twice is harmless.
@@ -10537,7 +10560,7 @@ Don't modify this variable directly, but use `set-coding-system-priority'.  */);
     Vcoding_category_list = Qnil;
     for (i = coding_category_max - 1; i >= 0; i--)
       Vcoding_category_list
-       = Fcons (XVECTOR (Vcoding_category_table)->contents[i],
+       = Fcons (AREF (Vcoding_category_table, i),
                 Vcoding_category_list);
   }
 
@@ -10663,22 +10686,22 @@ Also used for decoding keyboard input on X Window system.  */);
   DEFVAR_LISP ("eol-mnemonic-unix", eol_mnemonic_unix,
               doc: /*
 *String displayed in mode line for UNIX-like (LF) end-of-line format.  */);
-  eol_mnemonic_unix = make_pure_c_string (":");
+  eol_mnemonic_unix = build_pure_c_string (":");
 
   DEFVAR_LISP ("eol-mnemonic-dos", eol_mnemonic_dos,
               doc: /*
 *String displayed in mode line for DOS-like (CRLF) end-of-line format.  */);
-  eol_mnemonic_dos = make_pure_c_string ("\\");
+  eol_mnemonic_dos = build_pure_c_string ("\\");
 
   DEFVAR_LISP ("eol-mnemonic-mac", eol_mnemonic_mac,
               doc: /*
 *String displayed in mode line for MAC-like (CR) end-of-line format.  */);
-  eol_mnemonic_mac = make_pure_c_string ("/");
+  eol_mnemonic_mac = build_pure_c_string ("/");
 
   DEFVAR_LISP ("eol-mnemonic-undecided", eol_mnemonic_undecided,
               doc: /*
 *String displayed in mode line when end-of-line format is not yet determined.  */);
-  eol_mnemonic_undecided = make_pure_c_string (":");
+  eol_mnemonic_undecided = build_pure_c_string (":");
 
   DEFVAR_LISP ("enable-character-translation", Venable_character_translation,
               doc: /*
@@ -10816,7 +10839,7 @@ internal character representation.  */);
     plist[10] = intern_c_string (":for-unibyte");
     plist[11] = args[coding_arg_for_unibyte] = Qt;
     plist[12] = intern_c_string (":docstring");
-    plist[13] = make_pure_c_string ("Do no conversion.\n\
+    plist[13] = build_pure_c_string ("Do no conversion.\n\
 \n\
 When you visit a file with this coding, the file is read into a\n\
 unibyte buffer as is, thus each byte of a file is treated as a\n\
@@ -10834,7 +10857,7 @@ character.");
     plist[8] = intern_c_string (":charset-list");
     plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil);
     plist[11] = args[coding_arg_for_unibyte] = Qnil;
-    plist[13] = make_pure_c_string ("No conversion on encoding, automatic conversion on decoding.");
+    plist[13] = build_pure_c_string ("No conversion on encoding, automatic conversion on decoding.");
     plist[15] = args[coding_arg_eol_type] = Qnil;
     args[coding_arg_plist] = Flist (16, plist);
     Fdefine_coding_system_internal (coding_arg_max, args);
index 908e222cc685f24bc59ecbe9a2ba4c8546b1d15c..50435282229faf7557fcd4fd933a9cce84655802 100644 (file)
@@ -449,25 +449,25 @@ struct coding_system
      -1 in setup_coding_system, and updated by detect_coding.  So,
      when this is equal to the byte length of the text being
      converted, we can skip the actual conversion process.  */
-  EMACS_INT head_ascii;
+  ptrdiff_t head_ascii;
 
   /* The following members are set by encoding/decoding routine.  */
-  EMACS_INT produced, produced_char, consumed, consumed_char;
+  ptrdiff_t produced, produced_char, consumed, consumed_char;
 
   /* Number of error source data found in a decoding routine.  */
   int errors;
 
   /* Store the positions of error source data.  */
-  EMACS_INT *error_positions;
+  ptrdiff_t *error_positions;
 
   /* Finish status of code conversion.  */
   enum coding_result_code result;
 
-  EMACS_INT src_pos, src_pos_byte, src_chars, src_bytes;
+  ptrdiff_t src_pos, src_pos_byte, src_chars, src_bytes;
   Lisp_Object src_object;
   const unsigned char *source;
 
-  EMACS_INT dst_pos, dst_pos_byte, dst_bytes;
+  ptrdiff_t dst_pos, dst_pos_byte, dst_bytes;
   Lisp_Object dst_object;
   unsigned char *destination;
 
@@ -704,13 +704,13 @@ extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
 extern Lisp_Object complement_process_encoding_system (Lisp_Object);
 
 extern int decode_coding_gap (struct coding_system *,
-                              EMACS_INT, EMACS_INT);
+                              ptrdiff_t, ptrdiff_t);
 extern void decode_coding_object (struct coding_system *,
-                                  Lisp_Object, EMACS_INT, EMACS_INT,
-                                  EMACS_INT, EMACS_INT, Lisp_Object);
+                                  Lisp_Object, ptrdiff_t, ptrdiff_t,
+                                  ptrdiff_t, ptrdiff_t, Lisp_Object);
 extern void encode_coding_object (struct coding_system *,
-                                  Lisp_Object, EMACS_INT, EMACS_INT,
-                                  EMACS_INT, EMACS_INT, Lisp_Object);
+                                  Lisp_Object, ptrdiff_t, ptrdiff_t,
+                                  ptrdiff_t, ptrdiff_t, Lisp_Object);
 
 /* Macros for backward compatibility.  */
 
index c44c8e565d00ddcf27137745d721197340d1a7dc..bfc8093a87fd5629771d6050c785ada7323e982f 100644 (file)
@@ -25,8 +25,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "coding.h"
 #include "intervals.h"
 #include "window.h"
@@ -158,9 +158,6 @@ static Lisp_Object Qauto_composition_function;
    auto-compositions.  */
 #define MAX_AUTO_COMPOSITION_LOOKBACK 3
 
-static Lisp_Object Fcomposition_get_gstring (Lisp_Object, Lisp_Object,
-                                            Lisp_Object, Lisp_Object);
-
 /* Temporary variable used in macros COMPOSITION_XXX.  */
 Lisp_Object composition_temp;
 
@@ -173,7 +170,7 @@ Lisp_Object composition_temp;
    If the composition is invalid, return -1.  */
 
 ptrdiff_t
-get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
+get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
                    Lisp_Object prop, Lisp_Object string)
 {
   Lisp_Object id, length, components, key, *key_contents;
@@ -183,7 +180,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
   EMACS_UINT hash_code;
   enum composition_method method;
   struct composition *cmp;
-  EMACS_INT i;
+  ptrdiff_t i;
   int ch;
 
   /* Maximum length of a string of glyphs.  XftGlyphExtents limits
@@ -240,13 +237,13 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
        for (i = 0; i < nchars; i++)
          {
            FETCH_STRING_CHAR_ADVANCE (ch, string, charpos, bytepos);
-           XVECTOR (key)->contents[i] = make_number (ch);
+           ASET (key, i, make_number (ch));
          }
       else
        for (i = 0; i < nchars; i++)
          {
            FETCH_CHAR_ADVANCE (ch, charpos, bytepos);
-           XVECTOR (key)->contents[i] = make_number (ch);
+           ASET (key, i, make_number (ch));
          }
     }
   else
@@ -284,7 +281,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
       && VECTORP (AREF (components, 0)))
     {
       /* COMPONENTS is a glyph-string.  */
-      EMACS_INT len = ASIZE (key);
+      ptrdiff_t len = ASIZE (key);
 
       for (i = 1; i < len; i++)
        if (! VECTORP (AREF (key, i)))
@@ -292,7 +289,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
     }
   else if (VECTORP (components) || CONSP (components))
     {
-      EMACS_INT len = ASIZE (key);
+      ptrdiff_t len = ASIZE (key);
 
       /* The number of elements should be odd.  */
       if ((len % 2) == 0)
@@ -329,7 +326,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
     memory_full (SIZE_MAX);
 
   /* Register the composition in composition_table.  */
-  cmp = (struct composition *) xmalloc (sizeof (struct composition));
+  cmp = xmalloc (sizeof *cmp);
 
   cmp->method = method;
   cmp->hash_index = hash_index;
@@ -355,7 +352,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
   else
     {
       /* Rule-base composition.  */
-      float leftmost = 0.0, rightmost;
+      double leftmost = 0.0, rightmost;
 
       ch = XINT (key_contents[0]);
       rightmost = ch != '\t' ? CHAR_WIDTH (ch) : 1;
@@ -364,7 +361,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
        {
          int rule, gref, nref;
          int this_width;
-         float this_left;
+         double this_left;
 
          rule = XINT (key_contents[i]);
          ch = XINT (key_contents[i + 1]);
@@ -429,8 +426,8 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars,
    This doesn't check the validity of composition.  */
 
 int
-find_composition (EMACS_INT pos, EMACS_INT limit,
-                 EMACS_INT *start, EMACS_INT *end,
+find_composition (ptrdiff_t pos, ptrdiff_t limit,
+                 ptrdiff_t *start, ptrdiff_t *end,
                  Lisp_Object *prop, Lisp_Object object)
 {
   Lisp_Object val;
@@ -469,10 +466,10 @@ find_composition (EMACS_INT pos, EMACS_INT limit,
    FROM and TO with property PROP.  */
 
 static void
-run_composition_function (EMACS_INT from, EMACS_INT to, Lisp_Object prop)
+run_composition_function (ptrdiff_t from, ptrdiff_t to, Lisp_Object prop)
 {
   Lisp_Object func;
-  EMACS_INT start, end;
+  ptrdiff_t start, end;
 
   func = COMPOSITION_MODIFICATION_FUNC (prop);
   /* If an invalid composition precedes or follows, try to make them
@@ -501,13 +498,13 @@ run_composition_function (EMACS_INT from, EMACS_INT to, Lisp_Object prop)
    change is deletion, FROM == TO.  Otherwise, FROM < TO.  */
 
 void
-update_compositions (EMACS_INT from, EMACS_INT to, int check_mask)
+update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask)
 {
   Lisp_Object prop;
-  EMACS_INT start, end;
+  ptrdiff_t start, end;
   /* The beginning and end of the region to set the property
      `auto-composed' to nil.  */
-  EMACS_INT min_pos = from, max_pos = to;
+  ptrdiff_t min_pos = from, max_pos = to;
 
   if (inhibit_modification_hooks)
     return;
@@ -589,7 +586,7 @@ update_compositions (EMACS_INT from, EMACS_INT to, int check_mask)
     }
   if (min_pos < max_pos)
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
 
       specbind (Qinhibit_read_only, Qt);
       specbind (Qinhibit_modification_hooks, Qt);
@@ -632,7 +629,7 @@ make_composition_value_copy (Lisp_Object list)
    indices START and END in STRING.  */
 
 void
-compose_text (EMACS_INT start, EMACS_INT end, Lisp_Object components,
+compose_text (ptrdiff_t start, ptrdiff_t end, Lisp_Object components,
              Lisp_Object modification_func, Lisp_Object string)
 {
   Lisp_Object prop;
@@ -644,8 +641,8 @@ compose_text (EMACS_INT start, EMACS_INT end, Lisp_Object components,
 }
 
 
-static Lisp_Object autocmp_chars (Lisp_Object, EMACS_INT, EMACS_INT,
-                                  EMACS_INT, struct window *,
+static Lisp_Object autocmp_chars (Lisp_Object, ptrdiff_t, ptrdiff_t,
+                                  ptrdiff_t, struct window *,
                                   struct face *, Lisp_Object);
 
 \f
@@ -669,25 +666,25 @@ gstring_lookup_cache (Lisp_Object header)
 }
 
 Lisp_Object
-composition_gstring_put_cache (Lisp_Object gstring, EMACS_INT len)
+composition_gstring_put_cache (Lisp_Object gstring, ptrdiff_t len)
 {
   struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table);
   EMACS_UINT hash;
   Lisp_Object header, copy;
-  EMACS_INT i;
+  ptrdiff_t i;
 
   header = LGSTRING_HEADER (gstring);
   hash = h->hashfn (h, header);
   if (len < 0)
     {
-      EMACS_INT j, glyph_len = LGSTRING_GLYPH_LEN (gstring);
+      ptrdiff_t j, glyph_len = LGSTRING_GLYPH_LEN (gstring);
       for (j = 0; j < glyph_len; j++)
        if (NILP (LGSTRING_GLYPH (gstring, j)))
          break;
       len = j;
     }
 
-  lint_assume (len <= TYPE_MAXIMUM (EMACS_INT) - 2);
+  lint_assume (len <= TYPE_MAXIMUM (ptrdiff_t) - 2);
   copy = Fmake_vector (make_number (len + 2), Qnil);
   LGSTRING_SET_HEADER (copy, Fcopy_sequence (header));
   for (i = 0; i < len; i++)
@@ -713,7 +710,7 @@ int
 composition_gstring_p (Lisp_Object gstring)
 {
   Lisp_Object header;
-  EMACS_INT i;
+  ptrdiff_t i;
 
   if (! VECTORP (gstring) || ASIZE (gstring) < 2)
     return 0;
@@ -741,7 +738,7 @@ composition_gstring_p (Lisp_Object gstring)
 }
 
 int
-composition_gstring_width (Lisp_Object gstring, EMACS_INT from, EMACS_INT to,
+composition_gstring_width (Lisp_Object gstring, ptrdiff_t from, ptrdiff_t to,
                           struct font_metrics *metrics)
 {
   Lisp_Object *glyph;
@@ -800,8 +797,8 @@ static Lisp_Object gstring_work_headers;
 static Lisp_Object
 fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lisp_Object font_object, Lisp_Object string)
 {
-  EMACS_INT from, to, from_byte;
-  EMACS_INT len, i;
+  ptrdiff_t from, to, from_byte;
+  ptrdiff_t len, i;
 
   if (NILP (string))
     {
@@ -817,11 +814,11 @@ fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lis
       CHECK_STRING (string);
       if (! STRING_MULTIBYTE (string))
        error ("Attempt to shape unibyte text");
-      /* FROM and TO are checked by the caller.  */
+      /* The caller checks that START and END are nonnegative integers.  */
+      if (! (XINT (start) <= XINT (end) && XINT (end) <= SCHARS (string)))
+       args_out_of_range_3 (string, start, end);
       from = XINT (start);
       to = XINT (end);
-      if (from < 0 || from > to || to > SCHARS (string))
-       args_out_of_range_3 (string, start, end);
       from_byte = string_char_to_byte (string, from);
     }
 
@@ -860,8 +857,8 @@ fill_gstring_body (Lisp_Object gstring)
 {
   Lisp_Object font_object = LGSTRING_FONT (gstring);
   Lisp_Object header = AREF (gstring, 0);
-  EMACS_INT len = LGSTRING_CHAR_LEN (gstring);
-  EMACS_INT i;
+  ptrdiff_t len = LGSTRING_CHAR_LEN (gstring);
+  ptrdiff_t i;
 
   for (i = 0; i < len; i++)
     {
@@ -906,15 +903,15 @@ fill_gstring_body (Lisp_Object gstring)
    object.  Otherwise return nil.  */
 
 static Lisp_Object
-autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT limit, struct window *win, struct face *face, Lisp_Object string)
+autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   FRAME_PTR f = XFRAME (win->frame);
   Lisp_Object pos = make_number (charpos);
-  EMACS_INT to;
-  EMACS_INT pt = PT, pt_byte = PT_BYTE;
+  ptrdiff_t to;
+  ptrdiff_t pt = PT, pt_byte = PT_BYTE;
   Lisp_Object re, font_object, lgstring;
-  EMACS_INT len;
+  ptrdiff_t len;
 
   record_unwind_save_match_data ();
   re = AREF (rule, 0);
@@ -954,11 +951,8 @@ autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT
 
       /* Save point as marker before calling out to lisp.  */
       if (NILP (string))
-       {
-         Lisp_Object m = Fmake_marker ();
-         set_marker_both (m, Qnil, pt, pt_byte);
-         record_unwind_protect (restore_point_unwind, m);
-       }
+       record_unwind_protect (restore_point_unwind,
+                              build_marker (current_buffer, pt, pt_byte));
 
       args[0] = Vauto_composition_function;
       args[1] = AREF (rule, 2);
@@ -997,9 +991,9 @@ static Lisp_Object _work_val;
    composition.  */
 
 void
-composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, Lisp_Object string)
+composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, Lisp_Object string)
 {
-  EMACS_INT start, end;
+  ptrdiff_t start, end;
   int c;
   Lisp_Object prop, val;
   /* This is from forward_to_next_line_start in xdisp.c.  */
@@ -1109,7 +1103,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
       int len;
       /* Limit byte position used in fast_looking_at.  This is the
         byte position of the character after START. */
-      EMACS_INT limit;
+      ptrdiff_t limit;
 
       if (NILP (string))
        p = BYTE_POS_ADDR (bytepos);
@@ -1123,16 +1117,17 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
          if (! NILP (val))
            {
              Lisp_Object elt;
-             int ridx, back, blen;
+             int ridx, blen;
 
              for (ridx = 0; CONSP (val); val = XCDR (val), ridx++)
                {
                  elt = XCAR (val);
                  if (VECTORP (elt) && ASIZE (elt) == 3
                      && NATNUMP (AREF (elt, 1))
-                     && charpos - (back = XFASTINT (AREF (elt, 1))) > endpos)
+                     && charpos - XFASTINT (AREF (elt, 1)) > endpos)
                    {
-                     EMACS_INT cpos = charpos - back, bpos;
+                     ptrdiff_t back = XFASTINT (AREF (elt, 1));
+                     ptrdiff_t cpos = charpos - back, bpos;
 
                      if (back == 0)
                        bpos = bytepos;
@@ -1226,7 +1221,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos,
    CMP_IT->stop_pos, and return 0.  */
 
 int
-composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string)
+composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, struct face *face, Lisp_Object string)
 {
   if (endpos < 0)
     endpos = NILP (string) ? BEGV : 0;
@@ -1242,7 +1237,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
   if (cmp_it->ch < 0)
     {
       /* We are looking at a static composition.  */
-      EMACS_INT start, end;
+      ptrdiff_t start, end;
       Lisp_Object prop;
 
       find_composition (charpos, -1, &start, &end, &prop, string);
@@ -1257,7 +1252,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
     {
       Lisp_Object lgstring = Qnil;
       Lisp_Object val, elt;
-      EMACS_INT i;
+      ptrdiff_t i;
 
       val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch);
       for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val));
@@ -1284,7 +1279,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
        }
       else
        {
-         EMACS_INT cpos = charpos, bpos = bytepos;
+         ptrdiff_t cpos = charpos, bpos = bytepos;
 
          while (1)
            {
@@ -1370,7 +1365,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
    the cluster, or -1 if the composition is somehow broken.  */
 
 int
-composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string)
+composition_update_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, Lisp_Object string)
 {
   int i, c IF_LINT (= 0);
 
@@ -1405,7 +1400,7 @@ composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
       /* automatic composition */
       Lisp_Object gstring = composition_gstring_from_id (cmp_it->id);
       Lisp_Object glyph;
-      EMACS_INT from;
+      ptrdiff_t from;
 
       if (cmp_it->nglyphs == 0)
        {
@@ -1457,7 +1452,7 @@ composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I
 
 struct position_record
 {
-  EMACS_INT pos, pos_byte;
+  ptrdiff_t pos, pos_byte;
   unsigned char *p;
 };
 
@@ -1496,14 +1491,14 @@ struct position_record
    Qnil, and return 0.  */
 
 static int
-find_automatic_composition (EMACS_INT pos, EMACS_INT limit,
-                           EMACS_INT *start, EMACS_INT *end,
+find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
+                           ptrdiff_t *start, ptrdiff_t *end,
                            Lisp_Object *gstring, Lisp_Object string)
 {
-  EMACS_INT head, tail, stop;
+  ptrdiff_t head, tail, stop;
   /* Forward limit position of checking a composition taking a
      looking-back count into account.  */
-  EMACS_INT fore_check_limit;
+  ptrdiff_t fore_check_limit;
   struct position_record cur, prev;
   int c;
   Lisp_Object window;
@@ -1688,10 +1683,10 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit,
 /* Return the adjusted point provided that point is moved from LAST_PT
    to NEW_PT.  */
 
-EMACS_INT
-composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt)
+ptrdiff_t
+composition_adjust_point (ptrdiff_t last_pt, ptrdiff_t new_pt)
 {
-  EMACS_INT i, beg, end;
+  ptrdiff_t i, beg, end;
   Lisp_Object val;
 
   if (new_pt == BEGV || new_pt == ZV)
@@ -1712,7 +1707,7 @@ composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt)
     return new_pt;
 
   /* Next check the automatic composition.  */
-  if (! find_automatic_composition (new_pt, (EMACS_INT) -1, &beg, &end, &val,
+  if (! find_automatic_composition (new_pt, (ptrdiff_t) -1, &beg, &end, &val,
                                    Qnil)
       || beg == new_pt)
     return new_pt;
@@ -1773,7 +1768,7 @@ should be ignored.  */)
   (Lisp_Object from, Lisp_Object to, Lisp_Object font_object, Lisp_Object string)
 {
   Lisp_Object gstring, header;
-  EMACS_INT frompos, topos;
+  ptrdiff_t frompos, topos;
 
   CHECK_NATNUM (from);
   CHECK_NATNUM (to);
@@ -1857,15 +1852,14 @@ See `find-composition' for more details.  */)
   (Lisp_Object pos, Lisp_Object limit, Lisp_Object string, Lisp_Object detail_p)
 {
   Lisp_Object prop, tail, gstring;
-  EMACS_INT start, end, from, to;
+  ptrdiff_t start, end, from, to;
   int id;
 
   CHECK_NUMBER_COERCE_MARKER (pos);
-  from = XINT (pos);
   if (!NILP (limit))
     {
       CHECK_NUMBER_COERCE_MARKER (limit);
-      to = XINT (limit);
+      to = min (XINT (limit), ZV);
     }
   else
     to = -1;
@@ -1881,6 +1875,7 @@ See `find-composition' for more details.  */)
       if (XINT (pos) < BEGV || XINT (pos) > ZV)
        args_out_of_range (Fcurrent_buffer (), pos);
     }
+  from = XINT (pos);
 
   if (!find_composition (from, to, &start, &end, &prop, string))
     {
@@ -1893,7 +1888,7 @@ See `find-composition' for more details.  */)
     }
   if ((end <= XINT (pos) || start > XINT (pos)))
     {
-      EMACS_INT s, e;
+      ptrdiff_t s, e;
 
       if (find_automatic_composition (from, to, &s, &e, &gstring, string)
          && (e <= XINT (pos) ? e > end : s < start))
@@ -1910,7 +1905,7 @@ See `find-composition' for more details.  */)
     id = COMPOSITION_ID (prop);
   else
     {
-      EMACS_INT start_byte = (NILP (string)
+      ptrdiff_t start_byte = (NILP (string)
                              ? CHAR_TO_BYTE (start)
                              : string_char_to_byte (string, start));
       id = get_composition_id (start, start_byte, end - start, prop, string);
index 56647503982cfdb47954b017f12de84d83a27276..845411f5cde249ae197b6cb04d9e3dabb386e77a 100644 (file)
@@ -186,7 +186,7 @@ struct composition {
   enum composition_method method;
 
   /* Index to the composition hash table.  */
-  EMACS_INT hash_index;
+  ptrdiff_t hash_index;
 
   /* For which font we have calculated the remaining members.  The
      actual type is device dependent.  */
@@ -216,16 +216,16 @@ extern ptrdiff_t n_compositions;
 
 extern Lisp_Object Qcomposition;
 extern Lisp_Object composition_hash_table;
-extern ptrdiff_t get_composition_id (EMACS_INT, EMACS_INT, EMACS_INT,
+extern ptrdiff_t get_composition_id (ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                     Lisp_Object, Lisp_Object);
-extern int find_composition (EMACS_INT, EMACS_INT, EMACS_INT *, EMACS_INT *,
+extern int find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
                             Lisp_Object *, Lisp_Object);
-extern void update_compositions (EMACS_INT, EMACS_INT, int);
+extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
 extern void make_composition_value_copy (Lisp_Object);
 extern void compose_region (int, int, Lisp_Object, Lisp_Object,
                             Lisp_Object);
 extern void syms_of_composite (void);
-extern void compose_text (EMACS_INT, EMACS_INT, Lisp_Object, Lisp_Object,
+extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object,
                           Lisp_Object);
 
 /* Macros for lispy glyph-string.  This is completely different from
@@ -298,22 +298,22 @@ struct composition_it;
 struct face;
 struct font_metrics;
 
-extern Lisp_Object composition_gstring_put_cache (Lisp_Object, EMACS_INT);
+extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t);
 extern Lisp_Object composition_gstring_from_id (ptrdiff_t);
 extern int composition_gstring_p (Lisp_Object);
-extern int composition_gstring_width (Lisp_Object, EMACS_INT, EMACS_INT,
+extern int composition_gstring_width (Lisp_Object, ptrdiff_t, ptrdiff_t,
                                       struct font_metrics *);
 
 extern void composition_compute_stop_pos (struct composition_it *,
-                                          EMACS_INT, EMACS_INT, EMACS_INT,
+                                          ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                           Lisp_Object);
 extern int composition_reseat_it (struct composition_it *,
-                                  EMACS_INT, EMACS_INT, EMACS_INT,
+                                  ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                   struct window *, struct face *,
                                   Lisp_Object);
 extern int composition_update_it (struct composition_it *,
-                                  EMACS_INT, EMACS_INT, Lisp_Object);
+                                  ptrdiff_t, ptrdiff_t, Lisp_Object);
 
-extern EMACS_INT composition_adjust_point (EMACS_INT, EMACS_INT);
+extern ptrdiff_t composition_adjust_point (ptrdiff_t, ptrdiff_t);
 
 #endif /* not EMACS_COMPOSITE_H */
index bd1d89992cb3cc9a902d857facc772c6b2275847..4b342c0f521505550300cab0e68d6d1a4cffeaf5 100644 (file)
@@ -34,6 +34,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "syssignal.h"
 #include "termhooks.h"  /* For FRAME_KBOARD reference in y-or-n-p.  */
 #include "font.h"
+#include "keymap.h"
 
 #include <float.h>
 /* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*.  */
@@ -51,7 +52,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
 static Lisp_Object Qsubr;
 Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
-Lisp_Object Qerror, Qquit, Qargs_out_of_range;
+Lisp_Object Qerror, Quser_error, Qquit, Qargs_out_of_range;
 static Lisp_Object Qwrong_type_argument;
 Lisp_Object Qvoid_variable, Qvoid_function;
 static Lisp_Object Qcyclic_function_indirection;
@@ -92,6 +93,7 @@ Lisp_Object Qbuffer;
 static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
 static Lisp_Object Qsubrp, Qmany, Qunevalled;
 Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
+static Lisp_Object Qdefun;
 
 Lisp_Object Qinteractive_form;
 
@@ -130,7 +132,7 @@ args_out_of_range_3 (Lisp_Object a1, Lisp_Object a2, Lisp_Object a3)
 }
 
 \f
-/* Data type predicates */
+/* Data type predicates */
 
 DEFUN ("eq", Feq, Seq, 2, 2, 0,
        doc: /* Return t if the two args are the same Lisp object.  */)
@@ -515,7 +517,7 @@ DEFUN ("setcdr", Fsetcdr, Ssetcdr, 2, 2, 0,
   return newcdr;
 }
 \f
-/* Extract and set components of symbols */
+/* Extract and set components of symbols */
 
 DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
        doc: /* Return t if SYMBOL's value is not void.  */)
@@ -635,8 +637,9 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
     Fput (symbol, Qautoload, XCDR (function));
 
   XSYMBOL (symbol)->function = definition;
-  /* Handle automatic advice activation */
-  if (CONSP (XSYMBOL (symbol)->plist) && !NILP (Fget (symbol, Qad_advice_info)))
+  /* Handle automatic advice activation.  */
+  if (CONSP (XSYMBOL (symbol)->plist)
+      && !NILP (Fget (symbol, Qad_advice_info)))
     {
       call2 (Qad_activate_internal, symbol, Qnil);
       definition = XSYMBOL (symbol)->function;
@@ -645,22 +648,30 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
 }
 
 DEFUN ("defalias", Fdefalias, Sdefalias, 2, 3, 0,
-       doc: /* Set SYMBOL's function definition to DEFINITION, and return DEFINITION.
+       doc: /* Set SYMBOL's function definition to DEFINITION.
 Associates the function with the current load file, if any.
 The optional third argument DOCSTRING specifies the documentation string
 for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string
-determined by DEFINITION.  */)
+determined by DEFINITION.
+The return value is undefined.  */)
   (register Lisp_Object symbol, Lisp_Object definition, Lisp_Object docstring)
 {
   CHECK_SYMBOL (symbol);
   if (CONSP (XSYMBOL (symbol)->function)
       && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload))
     LOADHIST_ATTACH (Fcons (Qt, symbol));
+  if (!NILP (Vpurify_flag)
+      /* If `definition' is a keymap, immutable (and copying) is wrong.  */
+      && !KEYMAPP (definition))
+    definition = Fpurecopy (definition);
   definition = Ffset (symbol, definition);
   LOADHIST_ATTACH (Fcons (Qdefun, symbol));
   if (!NILP (docstring))
     Fput (symbol, Qfunction_documentation, docstring);
-  return definition;
+  /* We used to return `definition', but now that `defun' and `defmacro' expand
+     to a call to `defalias', we return `symbol' for backward compatibility
+     (bug#11686).  */
+  return symbol;
 }
 
 DEFUN ("setplist", Fsetplist, Ssetplist, 2, 2, 0,
@@ -1075,18 +1086,18 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
 {
   struct specbinding *p;
 
-  for (p = specpdl_ptr - 1; p >= specpdl; p--)
-    if (p->func == NULL
+  for (p = specpdl_ptr; p > specpdl; )
+    if ((--p)->func == NULL
        && CONSP (p->symbol))
       {
        struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol));
        eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS);
        if (symbol == let_bound_symbol
            && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer)
-         break;
+         return 1;
       }
 
-  return p >= specpdl;
+  return 0;
 }
 
 static int
@@ -1094,11 +1105,11 @@ let_shadows_global_binding_p (Lisp_Object symbol)
 {
   struct specbinding *p;
 
-  for (p = specpdl_ptr - 1; p >= specpdl; p--)
-    if (p->func == NULL && EQ (p->symbol, symbol))
-      break;
+  for (p = specpdl_ptr; p > specpdl; )
+    if ((--p)->func == NULL && EQ (p->symbol, symbol))
+      return 1;
 
-  return p >= specpdl;
+  return 0;
 }
 
 /* Store the value NEWVAL into SYMBOL.
@@ -1452,8 +1463,7 @@ union Lisp_Val_Fwd
 static struct Lisp_Buffer_Local_Value *
 make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents)
 {
-  struct Lisp_Buffer_Local_Value *blv
-    = xmalloc (sizeof (struct Lisp_Buffer_Local_Value));
+  struct Lisp_Buffer_Local_Value *blv = xmalloc (sizeof *blv);
   Lisp_Object symbol;
   Lisp_Object tem;
 
@@ -1494,7 +1504,7 @@ The function `default-value' gets the default value and `set-default' sets it.
 {
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
-  union Lisp_Val_Fwd valcontents IF_LINT (= {0});
+  union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
   int forwarded IF_LINT (= 0);
 
   CHECK_SYMBOL (variable);
@@ -1571,7 +1581,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument.  */)
 {
   register Lisp_Object tem;
   int forwarded IF_LINT (= 0);
-  union Lisp_Val_Fwd valcontents IF_LINT (= {0});
+  union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
 
@@ -2064,7 +2074,7 @@ or a byte-code object.  IDX starts at 0.  */)
   if (STRINGP (array))
     {
       int c;
-      EMACS_INT idxval_byte;
+      ptrdiff_t idxval_byte;
 
       if (idxval < 0 || idxval >= SCHARS (array))
        args_out_of_range (array, idx);
@@ -2092,7 +2102,7 @@ or a byte-code object.  IDX starts at 0.  */)
     }
   else
     {
-      int size = 0;
+      ptrdiff_t size = 0;
       if (VECTORP (array))
        size = ASIZE (array);
       else if (COMPILEDP (array))
@@ -2123,7 +2133,7 @@ bool-vector.  IDX starts at 0.  */)
     {
       if (idxval < 0 || idxval >= ASIZE (array))
        args_out_of_range (array, idx);
-      XVECTOR (array)->contents[idxval] = newelt;
+      ASET (array, idxval, newelt);
     }
   else if (BOOL_VECTOR_P (array))
     {
@@ -2156,7 +2166,8 @@ bool-vector.  IDX starts at 0.  */)
 
       if (STRING_MULTIBYTE (array))
        {
-         EMACS_INT idxval_byte, prev_bytes, new_bytes, nbytes;
+         ptrdiff_t idxval_byte, nbytes;
+         int prev_bytes, new_bytes;
          unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1;
 
          nbytes = SBYTES (array);
@@ -2167,7 +2178,7 @@ bool-vector.  IDX starts at 0.  */)
          if (prev_bytes != new_bytes)
            {
              /* We must relocate the string data.  */
-             EMACS_INT nchars = SCHARS (array);
+             ptrdiff_t nchars = SCHARS (array);
              unsigned char *str;
              USE_SAFE_ALLOCA;
 
@@ -2437,20 +2448,17 @@ Uses a minus sign if negative.
 NUMBER may be an integer or a floating point number.  */)
   (Lisp_Object number)
 {
-  char buffer[VALBITS];
+  char buffer[max (FLOAT_TO_STRING_BUFSIZE, INT_BUFSIZE_BOUND (EMACS_INT))];
+  int len;
 
   CHECK_NUMBER_OR_FLOAT (number);
 
   if (FLOATP (number))
-    {
-      char pigbuf[FLOAT_TO_STRING_BUFSIZE];
-
-      float_to_string (pigbuf, XFLOAT_DATA (number));
-      return build_string (pigbuf);
-    }
+    len = float_to_string (buffer, XFLOAT_DATA (number));
+  else
+    len = sprintf (buffer, "%"pI"d", XINT (number));
 
-  sprintf (buffer, "%"pI"d", XINT (number));
-  return build_string (buffer);
+  return make_unibyte_string (buffer, len);
 }
 
 DEFUN ("string-to-number", Fstring_to_number, Sstring_to_number, 1, 2, 0,
@@ -2474,9 +2482,9 @@ If the base used is not 10, STRING is always parsed as integer.  */)
   else
     {
       CHECK_NUMBER (base);
-      b = XINT (base);
-      if (b < 2 || b > 16)
+      if (! (2 <= XINT (base) && XINT (base) <= 16))
        xsignal1 (Qargs_out_of_range, base);
+      b = XINT (base);
     }
 
   p = SSDATA (string);
@@ -2724,7 +2732,7 @@ Both must be integers or markers.  */)
   CHECK_NUMBER_COERCE_MARKER (x);
   CHECK_NUMBER_COERCE_MARKER (y);
 
-  if (XFASTINT (y) == 0)
+  if (XINT (y) == 0)
     xsignal0 (Qarith_error);
 
   XSETINT (val, XINT (x) % XINT (y));
@@ -2937,6 +2945,7 @@ syms_of_data (void)
   DEFSYM (Qtop_level, "top-level");
 
   DEFSYM (Qerror, "error");
+  DEFSYM (Quser_error, "user-error");
   DEFSYM (Qquit, "quit");
   DEFSYM (Qwrong_type_argument, "wrong-type-argument");
   DEFSYM (Qargs_out_of_range, "args-out-of-range");
@@ -3002,104 +3011,44 @@ syms_of_data (void)
   Fput (Qerror, Qerror_conditions,
        error_tail);
   Fput (Qerror, Qerror_message,
-       make_pure_c_string ("error"));
-
-  Fput (Qquit, Qerror_conditions,
-       pure_cons (Qquit, Qnil));
-  Fput (Qquit, Qerror_message,
-       make_pure_c_string ("Quit"));
-
-  Fput (Qwrong_type_argument, Qerror_conditions,
-       pure_cons (Qwrong_type_argument, error_tail));
-  Fput (Qwrong_type_argument, Qerror_message,
-       make_pure_c_string ("Wrong type argument"));
-
-  Fput (Qargs_out_of_range, Qerror_conditions,
-       pure_cons (Qargs_out_of_range, error_tail));
-  Fput (Qargs_out_of_range, Qerror_message,
-       make_pure_c_string ("Args out of range"));
-
-  Fput (Qvoid_function, Qerror_conditions,
-       pure_cons (Qvoid_function, error_tail));
-  Fput (Qvoid_function, Qerror_message,
-       make_pure_c_string ("Symbol's function definition is void"));
-
-  Fput (Qcyclic_function_indirection, Qerror_conditions,
-       pure_cons (Qcyclic_function_indirection, error_tail));
-  Fput (Qcyclic_function_indirection, Qerror_message,
-       make_pure_c_string ("Symbol's chain of function indirections contains a loop"));
-
-  Fput (Qcyclic_variable_indirection, Qerror_conditions,
-       pure_cons (Qcyclic_variable_indirection, error_tail));
-  Fput (Qcyclic_variable_indirection, Qerror_message,
-       make_pure_c_string ("Symbol's chain of variable indirections contains a loop"));
-
+       build_pure_c_string ("error"));
+
+#define PUT_ERROR(sym, tail, msg)                      \
+  Fput (sym, Qerror_conditions, pure_cons (sym, tail)); \
+  Fput (sym, Qerror_message, build_pure_c_string (msg))
+
+  PUT_ERROR (Qquit, Qnil, "Quit");
+
+  PUT_ERROR (Quser_error, error_tail, "");
+  PUT_ERROR (Qwrong_type_argument, error_tail, "Wrong type argument");
+  PUT_ERROR (Qargs_out_of_range, error_tail, "Args out of range");
+  PUT_ERROR (Qvoid_function, error_tail,
+            "Symbol's function definition is void");
+  PUT_ERROR (Qcyclic_function_indirection, error_tail,
+            "Symbol's chain of function indirections contains a loop");
+  PUT_ERROR (Qcyclic_variable_indirection, error_tail,
+            "Symbol's chain of variable indirections contains a loop");
   DEFSYM (Qcircular_list, "circular-list");
-  Fput (Qcircular_list, Qerror_conditions,
-       pure_cons (Qcircular_list, error_tail));
-  Fput (Qcircular_list, Qerror_message,
-       make_pure_c_string ("List contains a loop"));
-
-  Fput (Qvoid_variable, Qerror_conditions,
-       pure_cons (Qvoid_variable, error_tail));
-  Fput (Qvoid_variable, Qerror_message,
-       make_pure_c_string ("Symbol's value as variable is void"));
-
-  Fput (Qsetting_constant, Qerror_conditions,
-       pure_cons (Qsetting_constant, error_tail));
-  Fput (Qsetting_constant, Qerror_message,
-       make_pure_c_string ("Attempt to set a constant symbol"));
-
-  Fput (Qinvalid_read_syntax, Qerror_conditions,
-       pure_cons (Qinvalid_read_syntax, error_tail));
-  Fput (Qinvalid_read_syntax, Qerror_message,
-       make_pure_c_string ("Invalid read syntax"));
-
-  Fput (Qinvalid_function, Qerror_conditions,
-       pure_cons (Qinvalid_function, error_tail));
-  Fput (Qinvalid_function, Qerror_message,
-       make_pure_c_string ("Invalid function"));
-
-  Fput (Qwrong_number_of_arguments, Qerror_conditions,
-       pure_cons (Qwrong_number_of_arguments, error_tail));
-  Fput (Qwrong_number_of_arguments, Qerror_message,
-       make_pure_c_string ("Wrong number of arguments"));
-
-  Fput (Qno_catch, Qerror_conditions,
-       pure_cons (Qno_catch, error_tail));
-  Fput (Qno_catch, Qerror_message,
-       make_pure_c_string ("No catch for tag"));
-
-  Fput (Qend_of_file, Qerror_conditions,
-       pure_cons (Qend_of_file, error_tail));
-  Fput (Qend_of_file, Qerror_message,
-       make_pure_c_string ("End of file during parsing"));
+  PUT_ERROR (Qcircular_list, error_tail, "List contains a loop");
+  PUT_ERROR (Qvoid_variable, error_tail, "Symbol's value as variable is void");
+  PUT_ERROR (Qsetting_constant, error_tail,
+            "Attempt to set a constant symbol");
+  PUT_ERROR (Qinvalid_read_syntax, error_tail, "Invalid read syntax");
+  PUT_ERROR (Qinvalid_function, error_tail, "Invalid function");
+  PUT_ERROR (Qwrong_number_of_arguments, error_tail,
+            "Wrong number of arguments");
+  PUT_ERROR (Qno_catch, error_tail, "No catch for tag");
+  PUT_ERROR (Qend_of_file, error_tail, "End of file during parsing");
 
   arith_tail = pure_cons (Qarith_error, error_tail);
-  Fput (Qarith_error, Qerror_conditions,
-       arith_tail);
-  Fput (Qarith_error, Qerror_message,
-       make_pure_c_string ("Arithmetic error"));
-
-  Fput (Qbeginning_of_buffer, Qerror_conditions,
-       pure_cons (Qbeginning_of_buffer, error_tail));
-  Fput (Qbeginning_of_buffer, Qerror_message,
-       make_pure_c_string ("Beginning of buffer"));
-
-  Fput (Qend_of_buffer, Qerror_conditions,
-       pure_cons (Qend_of_buffer, error_tail));
-  Fput (Qend_of_buffer, Qerror_message,
-       make_pure_c_string ("End of buffer"));
-
-  Fput (Qbuffer_read_only, Qerror_conditions,
-       pure_cons (Qbuffer_read_only, error_tail));
-  Fput (Qbuffer_read_only, Qerror_message,
-       make_pure_c_string ("Buffer is read-only"));
-
-  Fput (Qtext_read_only, Qerror_conditions,
-       pure_cons (Qtext_read_only, error_tail));
-  Fput (Qtext_read_only, Qerror_message,
-       make_pure_c_string ("Text is read-only"));
+  Fput (Qarith_error, Qerror_conditions, arith_tail);
+  Fput (Qarith_error, Qerror_message, build_pure_c_string ("Arithmetic error"));
+
+  PUT_ERROR (Qbeginning_of_buffer, error_tail, "Beginning of buffer");
+  PUT_ERROR (Qend_of_buffer, error_tail, "End of buffer");
+  PUT_ERROR (Qbuffer_read_only, error_tail, "Buffer is read-only");
+  PUT_ERROR (Qtext_read_only, pure_cons (Qbuffer_read_only, error_tail),
+            "Text is read-only");
 
   DEFSYM (Qrange_error, "range-error");
   DEFSYM (Qdomain_error, "domain-error");
@@ -3107,30 +3056,17 @@ syms_of_data (void)
   DEFSYM (Qoverflow_error, "overflow-error");
   DEFSYM (Qunderflow_error, "underflow-error");
 
-  Fput (Qdomain_error, Qerror_conditions,
-       pure_cons (Qdomain_error, arith_tail));
-  Fput (Qdomain_error, Qerror_message,
-       make_pure_c_string ("Arithmetic domain error"));
-
-  Fput (Qrange_error, Qerror_conditions,
-       pure_cons (Qrange_error, arith_tail));
-  Fput (Qrange_error, Qerror_message,
-       make_pure_c_string ("Arithmetic range error"));
+  PUT_ERROR (Qdomain_error, arith_tail, "Arithmetic domain error");
 
-  Fput (Qsingularity_error, Qerror_conditions,
-       pure_cons (Qsingularity_error, Fcons (Qdomain_error, arith_tail)));
-  Fput (Qsingularity_error, Qerror_message,
-       make_pure_c_string ("Arithmetic singularity error"));
+  PUT_ERROR (Qrange_error, arith_tail, "Arithmetic range error");
 
-  Fput (Qoverflow_error, Qerror_conditions,
-       pure_cons (Qoverflow_error, Fcons (Qdomain_error, arith_tail)));
-  Fput (Qoverflow_error, Qerror_message,
-       make_pure_c_string ("Arithmetic overflow error"));
+  PUT_ERROR (Qsingularity_error, Fcons (Qdomain_error, arith_tail),
+            "Arithmetic singularity error");
 
-  Fput (Qunderflow_error, Qerror_conditions,
-       pure_cons (Qunderflow_error, Fcons (Qdomain_error, arith_tail)));
-  Fput (Qunderflow_error, Qerror_message,
-       make_pure_c_string ("Arithmetic underflow error"));
+  PUT_ERROR (Qoverflow_error, Fcons (Qdomain_error, arith_tail),
+            "Arithmetic overflow error");
+  PUT_ERROR (Qunderflow_error, Fcons (Qdomain_error, arith_tail),
+            "Arithmetic underflow error");
 
   staticpro (&Qnil);
   staticpro (&Qt);
@@ -3156,6 +3092,8 @@ syms_of_data (void)
   DEFSYM (Qbool_vector, "bool-vector");
   DEFSYM (Qhash_table, "hash-table");
 
+  DEFSYM (Qdefun, "defun");
+
   DEFSYM (Qfont_spec, "font-spec");
   DEFSYM (Qfont_entity, "font-entity");
   DEFSYM (Qfont_object, "font-object");
@@ -3271,9 +3209,8 @@ syms_of_data (void)
 }
 
 #ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
-static void arith_error (int) NO_RETURN;
+_Noreturn
 #endif
-
 static void
 arith_error (int signo)
 {
index ad1a3f3cbe856f1157ea6ad960cae759748f71ea..86013d92c071cad9951efa320411d44fdc823916 100644 (file)
@@ -28,19 +28,15 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "process.h"
 
+#ifndef DBUS_NUM_MESSAGE_TYPES
+#define DBUS_NUM_MESSAGE_TYPES 5
+#endif
+
 \f
 /* Subroutines.  */
 static Lisp_Object Qdbus_init_bus;
-static Lisp_Object Qdbus_close_bus;
 static Lisp_Object Qdbus_get_unique_name;
-static Lisp_Object Qdbus_call_method;
-static Lisp_Object Qdbus_call_method_asynchronously;
-static Lisp_Object Qdbus_method_return_internal;
-static Lisp_Object Qdbus_method_error_internal;
-static Lisp_Object Qdbus_send_signal;
-static Lisp_Object Qdbus_register_service;
-static Lisp_Object Qdbus_register_signal;
-static Lisp_Object Qdbus_register_method;
+static Lisp_Object Qdbus_message_internal;
 
 /* D-Bus error symbol.  */
 static Lisp_Object Qdbus_error;
@@ -51,17 +47,6 @@ static Lisp_Object QCdbus_system_bus, QCdbus_session_bus;
 /* Lisp symbol for method call timeout.  */
 static Lisp_Object QCdbus_timeout;
 
-/* Lisp symbols for name request flags.  */
-static Lisp_Object QCdbus_request_name_allow_replacement;
-static Lisp_Object QCdbus_request_name_replace_existing;
-static Lisp_Object QCdbus_request_name_do_not_queue;
-
-/* Lisp symbols for name request replies.  */
-static Lisp_Object QCdbus_request_name_reply_primary_owner;
-static Lisp_Object QCdbus_request_name_reply_in_queue;
-static Lisp_Object QCdbus_request_name_reply_exists;
-static Lisp_Object QCdbus_request_name_reply_already_owner;
-
 /* Lisp symbols of D-Bus types.  */
 static Lisp_Object QCdbus_type_byte, QCdbus_type_boolean;
 static Lisp_Object QCdbus_type_int16, QCdbus_type_uint16;
@@ -75,6 +60,15 @@ static Lisp_Object QCdbus_type_unix_fd;
 static Lisp_Object QCdbus_type_array, QCdbus_type_variant;
 static Lisp_Object QCdbus_type_struct, QCdbus_type_dict_entry;
 
+/* Lisp symbols of objects in `dbus-registered-objects-table'.  */
+static Lisp_Object QCdbus_registered_serial, QCdbus_registered_method;
+static Lisp_Object QCdbus_registered_signal;
+
+/* Alist of D-Bus buses we are polling for messages.
+   The key is the symbol or string of the bus, and the value is the
+   connection address.  */
+static Lisp_Object xd_registered_buses;
+
 /* Whether we are reading a D-Bus event.  */
 static int xd_in_read_queued_messages = 0;
 
@@ -120,14 +114,15 @@ static int xd_in_read_queued_messages = 0;
   } while (0)
 
 /* Macros for debugging.  In order to enable them, build with
-   "MYCPPFLAGS='-DDBUS_DEBUG -Wall' make".  */
+   "env MYCPPFLAGS='-DDBUS_DEBUG -Wall' make".  */
 #ifdef DBUS_DEBUG
-#define XD_DEBUG_MESSAGE(...)          \
-  do {                                 \
-    char s[1024];                      \
-    snprintf (s, sizeof s, __VA_ARGS__); \
-    printf ("%s: %s\n", __func__, s);  \
-    message ("%s: %s", __func__, s);   \
+#define XD_DEBUG_MESSAGE(...)                                          \
+  do {                                                                 \
+    char s[1024];                                                      \
+    snprintf (s, sizeof s, __VA_ARGS__);                               \
+    if (!noninteractive)                                               \
+      printf ("%s: %s\n", __func__, s);                                        \
+    message ("%s: %s", __func__, s);                                   \
   } while (0)
 #define XD_DEBUG_VALID_LISP_OBJECT_P(object)                           \
   do {                                                                 \
@@ -144,7 +139,7 @@ static int xd_in_read_queued_messages = 0;
     if (!NILP (Vdbus_debug))                                           \
       {                                                                        \
        char s[1024];                                                   \
-       snprintf (s, 1023, __VA_ARGS__);                                \
+       snprintf (s, sizeof s, __VA_ARGS__);                            \
        message ("%s: %s", __func__, s);                                \
       }                                                                        \
   } while (0)
@@ -152,6 +147,10 @@ static int xd_in_read_queued_messages = 0;
 #endif
 
 /* Check whether TYPE is a basic DBusType.  */
+#ifdef HAVE_DBUS_TYPE_IS_VALID
+#define XD_BASIC_DBUS_TYPE(type)                                       \
+  (dbus_type_is_valid (type) && dbus_type_is_basic (type))
+#else
 #ifdef DBUS_TYPE_UNIX_FD
 #define XD_BASIC_DBUS_TYPE(type)                                       \
   ((type ==  DBUS_TYPE_BYTE)                                           \
@@ -182,6 +181,7 @@ static int xd_in_read_queued_messages = 0;
    || (type ==  DBUS_TYPE_OBJECT_PATH)                                 \
    || (type ==  DBUS_TYPE_SIGNATURE))
 #endif
+#endif
 
 /* This was a macro.  On Solaris 2.11 it was said to compile for
    hours, when optimization is enabled.  So we have transferred it into
@@ -241,23 +241,99 @@ xd_symbol_to_dbus_type (Lisp_Object object)
 #define XD_NEXT_VALUE(object)                                          \
   ((XD_DBUS_TYPE_P (CAR_SAFE (object))) ? CDR_SAFE (object) : object)
 
-/* Check whether X is a valid dbus serial number.  If valid, set
-   SERIAL to its value.  Otherwise, signal an error. */
-#define CHECK_DBUS_SERIAL_GET_SERIAL(x, serial)                                \
-  do                                                                   \
-    {                                                                  \
-      dbus_uint32_t DBUS_SERIAL_MAX = -1;                              \
-      if (NATNUMP (x) && XINT (x) <= DBUS_SERIAL_MAX)                  \
-       serial = XINT (x);                                              \
-      else if (MOST_POSITIVE_FIXNUM < DBUS_SERIAL_MAX                  \
-              && FLOATP (x)                                            \
-              && 0 <= XFLOAT_DATA (x)                                  \
-              && XFLOAT_DATA (x) <= DBUS_SERIAL_MAX)                   \
-       serial = XFLOAT_DATA (x);                                       \
-      else                                                             \
-       XD_SIGNAL2 (build_string ("Invalid dbus serial"), x);           \
-    }                                                                  \
-  while (0)
+/* Transform the message type to its string representation for debug
+   messages.  */
+#define XD_MESSAGE_TYPE_TO_STRING(mtype)                               \
+  ((mtype == DBUS_MESSAGE_TYPE_INVALID)                                        \
+  ? "DBUS_MESSAGE_TYPE_INVALID"                                                \
+  : (mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)                           \
+  ? "DBUS_MESSAGE_TYPE_METHOD_CALL"                                    \
+  : (mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)                         \
+  ? "DBUS_MESSAGE_TYPE_METHOD_RETURN"                                  \
+  : (mtype == DBUS_MESSAGE_TYPE_ERROR)                                 \
+   ? "DBUS_MESSAGE_TYPE_ERROR"                                         \
+   : "DBUS_MESSAGE_TYPE_SIGNAL")
+
+/* Transform the object to its string representation for debug
+   messages.  */
+#define XD_OBJECT_TO_STRING(object)                                    \
+  SDATA (format2 ("%s", object, Qnil))
+
+#define XD_DBUS_VALIDATE_BUS_ADDRESS(bus)                              \
+  do {                                                                 \
+    if (STRINGP (bus))                                                 \
+      {                                                                        \
+       DBusAddressEntry **entries;                                     \
+       int len;                                                        \
+       DBusError derror;                                               \
+       dbus_error_init (&derror);                                      \
+       if (!dbus_parse_address (SSDATA (bus), &entries, &len, &derror)) \
+         XD_ERROR (derror);                                            \
+       /* Cleanup.  */                                                 \
+       dbus_error_free (&derror);                                      \
+       dbus_address_entries_free (entries);                            \
+      }                                                                        \
+                                                                       \
+    else                                                               \
+      {                                                                        \
+       CHECK_SYMBOL (bus);                                             \
+       if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus))) \
+         XD_SIGNAL2 (build_string ("Wrong bus name"), bus);            \
+       /* We do not want to have an autolaunch for the session bus.  */ \
+       if (EQ (bus, QCdbus_session_bus)                                \
+           && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)             \
+         XD_SIGNAL2 (build_string ("No connection to bus"), bus);      \
+      }                                                                        \
+  } while (0)
+
+#if (HAVE_DBUS_VALIDATE_BUS_NAME || HAVE_DBUS_VALIDATE_PATH \
+     || XD_DBUS_VALIDATE_OBJECT || HAVE_DBUS_VALIDATE_MEMBER)
+#define XD_DBUS_VALIDATE_OBJECT(object, func)                          \
+  do {                                                                 \
+    if (!NILP (object))                                                        \
+      {                                                                        \
+       DBusError derror;                                               \
+       CHECK_STRING (object);                                          \
+       dbus_error_init (&derror);                                      \
+       if (!func (SSDATA (object), &derror))                           \
+         XD_ERROR (derror);                                            \
+       /* Cleanup.  */                                                 \
+       dbus_error_free (&derror);                                      \
+      }                                                                        \
+  } while (0)
+#endif
+
+#if HAVE_DBUS_VALIDATE_BUS_NAME
+#define XD_DBUS_VALIDATE_BUS_NAME(bus_name)                            \
+  XD_DBUS_VALIDATE_OBJECT(bus_name, dbus_validate_bus_name);
+#else
+#define XD_DBUS_VALIDATE_BUS_NAME(bus_name)                            \
+  if (!NILP (bus_name)) CHECK_STRING (bus_name);
+#endif
+
+#if HAVE_DBUS_VALIDATE_PATH
+#define XD_DBUS_VALIDATE_PATH(path)                                    \
+  XD_DBUS_VALIDATE_OBJECT(path, dbus_validate_path);
+#else
+#define XD_DBUS_VALIDATE_PATH(path)                                    \
+  if (!NILP (path)) CHECK_STRING (path);
+#endif
+
+#if HAVE_DBUS_VALIDATE_INTERFACE
+#define XD_DBUS_VALIDATE_INTERFACE(interface)                          \
+  XD_DBUS_VALIDATE_OBJECT(interface, dbus_validate_interface);
+#else
+#define XD_DBUS_VALIDATE_INTERFACE(interface)                          \
+  if (!NILP (interface)) CHECK_STRING (interface);
+#endif
+
+#if HAVE_DBUS_VALIDATE_MEMBER
+#define XD_DBUS_VALIDATE_MEMBER(member)                                        \
+  XD_DBUS_VALIDATE_OBJECT(member, dbus_validate_member);
+#else
+#define XD_DBUS_VALIDATE_MEMBER(member)                                        \
+  if (!NILP (member)) CHECK_STRING (member);
+#endif
 
 /* Append to SIGNATURE a copy of X, making sure SIGNATURE does
    not become too long.  */
@@ -279,9 +355,9 @@ xd_signature_cat (char *signature, char const *x)
    signature is embedded, or DBUS_TYPE_INVALID.  It is needed for the
    check that DBUS_TYPE_DICT_ENTRY occurs only as array element.  */
 static void
-xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lisp_Object object)
+xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
 {
-  unsigned int subtype;
+  int subtype;
   Lisp_Object elt;
   char const *subsig;
   int subsiglen;
@@ -293,11 +369,6 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
     {
     case DBUS_TYPE_BYTE:
     case DBUS_TYPE_UINT16:
-    case DBUS_TYPE_UINT32:
-    case DBUS_TYPE_UINT64:
-#ifdef DBUS_TYPE_UNIX_FD
-    case DBUS_TYPE_UNIX_FD:
-#endif
       CHECK_NATNUM (object);
       sprintf (signature, "%c", dtype);
       break;
@@ -309,14 +380,19 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
       break;
 
     case DBUS_TYPE_INT16:
-    case DBUS_TYPE_INT32:
-    case DBUS_TYPE_INT64:
       CHECK_NUMBER (object);
       sprintf (signature, "%c", dtype);
       break;
 
+    case DBUS_TYPE_UINT32:
+    case DBUS_TYPE_UINT64:
+#ifdef DBUS_TYPE_UNIX_FD
+    case DBUS_TYPE_UNIX_FD:
+#endif
+    case DBUS_TYPE_INT32:
+    case DBUS_TYPE_INT64:
     case DBUS_TYPE_DOUBLE:
-      CHECK_FLOAT (object);
+      CHECK_NUMBER_OR_FLOAT (object);
       sprintf (signature, "%c", dtype);
       break;
 
@@ -352,8 +428,8 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
        }
 
       /* If the element type is DBUS_TYPE_SIGNATURE, and this is the
-        only element, the value of this element is used as he array's
-        element signature.  */
+        only element, the value of this element is used as the
+        array's element signature.  */
       if ((subtype == DBUS_TYPE_SIGNATURE)
          && STRINGP (CAR_SAFE (XD_NEXT_VALUE (elt)))
          && NILP (CDR_SAFE (XD_NEXT_VALUE (elt))))
@@ -451,13 +527,67 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
   XD_DEBUG_MESSAGE ("%s", signature);
 }
 
+/* Convert X to a signed integer with bounds LO and HI.  */
+static intmax_t
+xd_extract_signed (Lisp_Object x, intmax_t lo, intmax_t hi)
+{
+  CHECK_NUMBER_OR_FLOAT (x);
+  if (INTEGERP (x))
+    {
+      if (lo <= XINT (x) && XINT (x) <= hi)
+       return XINT (x);
+    }
+  else
+    {
+      double d = XFLOAT_DATA (x);
+      if (lo <= d && d <= hi)
+       {
+         intmax_t n = d;
+         if (n == d)
+           return n;
+       }
+    }
+  if (xd_in_read_queued_messages)
+    Fthrow (Qdbus_error, Qnil);
+  else
+    args_out_of_range_3 (x,
+                        make_fixnum_or_float (lo),
+                        make_fixnum_or_float (hi));
+}
+
+/* Convert X to an unsigned integer with bounds 0 and HI.  */
+static uintmax_t
+xd_extract_unsigned (Lisp_Object x, uintmax_t hi)
+{
+  CHECK_NUMBER_OR_FLOAT (x);
+  if (INTEGERP (x))
+    {
+      if (0 <= XINT (x) && XINT (x) <= hi)
+       return XINT (x);
+    }
+  else
+    {
+      double d = XFLOAT_DATA (x);
+      if (0 <= d && d <= hi)
+       {
+         uintmax_t n = d;
+         if (n == d)
+           return n;
+       }
+    }
+  if (xd_in_read_queued_messages)
+    Fthrow (Qdbus_error, Qnil);
+  else
+    args_out_of_range_3 (x, make_number (0), make_fixnum_or_float (hi));
+}
+
 /* Append C value, extracted from Lisp OBJECT, to iteration ITER.
    DTYPE must be a valid DBusType.  It is used to convert Lisp
    objects, being arguments of `dbus-call-method' or
    `dbus-send-signal', into corresponding C values appended as
    arguments to a D-Bus message.  */
 static void
-xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
+xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
 {
   char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
   DBusMessageIter subiter;
@@ -469,7 +599,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
        CHECK_NATNUM (object);
        {
          unsigned char val = XFASTINT (object) & 0xFF;
-         XD_DEBUG_MESSAGE ("%c %d", dtype, val);
+         XD_DEBUG_MESSAGE ("%c %u", dtype, val);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
          return;
@@ -485,30 +615,38 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
        }
 
       case DBUS_TYPE_INT16:
-       CHECK_NUMBER (object);
        {
-         dbus_int16_t val = XINT (object);
-         XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
+         dbus_int16_t val =
+           xd_extract_signed (object,
+                              TYPE_MINIMUM (dbus_int16_t),
+                              TYPE_MAXIMUM (dbus_int16_t));
+         int pval = val;
+         XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
          return;
        }
 
       case DBUS_TYPE_UINT16:
-       CHECK_NATNUM (object);
        {
-         dbus_uint16_t val = XFASTINT (object);
-         XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val);
+         dbus_uint16_t val =
+           xd_extract_unsigned (object,
+                                TYPE_MAXIMUM (dbus_uint16_t));
+         unsigned int pval = val;
+         XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
          return;
        }
 
       case DBUS_TYPE_INT32:
-       CHECK_NUMBER (object);
        {
-         dbus_int32_t val = XINT (object);
-         XD_DEBUG_MESSAGE ("%c %d", dtype, val);
+         dbus_int32_t val =
+           xd_extract_signed (object,
+                              TYPE_MINIMUM (dbus_int32_t),
+                              TYPE_MAXIMUM (dbus_int32_t));
+         int pval = val;
+         XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
          return;
@@ -518,39 +656,45 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
 #ifdef DBUS_TYPE_UNIX_FD
       case DBUS_TYPE_UNIX_FD:
 #endif
-       CHECK_NATNUM (object);
        {
-         dbus_uint32_t val = XFASTINT (object);
-         XD_DEBUG_MESSAGE ("%c %u", dtype, val);
+         dbus_uint32_t val =
+           xd_extract_unsigned (object,
+                                TYPE_MAXIMUM (dbus_uint32_t));
+         unsigned int pval = val;
+         XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
          return;
        }
 
       case DBUS_TYPE_INT64:
-       CHECK_NUMBER (object);
        {
-         dbus_int64_t val = XINT (object);
-         XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
+         dbus_int64_t val =
+           xd_extract_signed (object,
+                              TYPE_MINIMUM (dbus_int64_t),
+                              TYPE_MAXIMUM (dbus_int64_t));
+         printmax_t pval = val;
+         XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
          return;
        }
 
       case DBUS_TYPE_UINT64:
-       CHECK_NATNUM (object);
        {
-         dbus_uint64_t val = XFASTINT (object);
-         XD_DEBUG_MESSAGE ("%c %"pI"d", dtype, XFASTINT (object));
+         dbus_uint64_t val =
+           xd_extract_unsigned (object,
+                                TYPE_MAXIMUM (dbus_uint64_t));
+         uprintmax_t pval = val;
+         XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
          return;
        }
 
       case DBUS_TYPE_DOUBLE:
-       CHECK_FLOAT (object);
        {
-         double val = XFLOAT_DATA (object);
+         double val = extract_float (object);
          XD_DEBUG_MESSAGE ("%c %f", dtype, val);
          if (!dbus_message_iter_append_basic (iter, dtype, &val))
            XD_SIGNAL2 (build_string ("Unable to append argument"), object);
@@ -614,7 +758,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
                            dtype, CAR_SAFE (XD_NEXT_VALUE (object)));
 
          XD_DEBUG_MESSAGE ("%c %s %s", dtype, signature,
-                           SDATA (format2 ("%s", object, Qnil)));
+                           XD_OBJECT_TO_STRING (object));
          if (!dbus_message_iter_open_container (iter, dtype,
                                                 signature, &subiter))
            XD_SIGNAL3 (build_string ("Cannot open container"),
@@ -627,7 +771,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
                        dtype, CAR_SAFE (XD_NEXT_VALUE (object)));
 
          XD_DEBUG_MESSAGE ("%c %s %s", dtype, signature,
-                           SDATA (format2 ("%s", object, Qnil)));
+                           XD_OBJECT_TO_STRING (object));
          if (!dbus_message_iter_open_container (iter, dtype,
                                                 signature, &subiter))
            XD_SIGNAL3 (build_string ("Cannot open container"),
@@ -637,8 +781,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
        case DBUS_TYPE_STRUCT:
        case DBUS_TYPE_DICT_ENTRY:
          /* These containers do not require a signature.  */
-         XD_DEBUG_MESSAGE ("%c %s", dtype,
-                           SDATA (format2 ("%s", object, Qnil)));
+         XD_DEBUG_MESSAGE ("%c %s", dtype, XD_OBJECT_TO_STRING (object));
          if (!dbus_message_iter_open_container (iter, dtype, NULL, &subiter))
            XD_SIGNAL2 (build_string ("Cannot open container"),
                        make_number (dtype));
@@ -668,7 +811,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter)
    D-Bus message must be a valid DBusType.  Compound D-Bus types
    result always in a Lisp list.  */
 static Lisp_Object
-xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
+xd_retrieve_arg (int dtype, DBusMessageIter *iter)
 {
 
   switch (dtype)
@@ -678,7 +821,7 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
        unsigned int val;
        dbus_message_iter_get_basic (iter, &val);
        val = val & 0xFF;
-       XD_DEBUG_MESSAGE ("%c %d", dtype, val);
+       XD_DEBUG_MESSAGE ("%c %u", dtype, val);
        return make_number (val);
       }
 
@@ -693,24 +836,30 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
     case DBUS_TYPE_INT16:
       {
        dbus_int16_t val;
+       int pval;
        dbus_message_iter_get_basic (iter, &val);
-       XD_DEBUG_MESSAGE ("%c %d", dtype, val);
+       pval = val;
+       XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
        return make_number (val);
       }
 
     case DBUS_TYPE_UINT16:
       {
        dbus_uint16_t val;
+       int pval;
        dbus_message_iter_get_basic (iter, &val);
-       XD_DEBUG_MESSAGE ("%c %d", dtype, val);
+       pval = val;
+       XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
        return make_number (val);
       }
 
     case DBUS_TYPE_INT32:
       {
        dbus_int32_t val;
+       int pval;
        dbus_message_iter_get_basic (iter, &val);
-       XD_DEBUG_MESSAGE ("%c %d", dtype, val);
+       pval = val;
+       XD_DEBUG_MESSAGE ("%c %d", dtype, pval);
        return make_fixnum_or_float (val);
       }
 
@@ -720,24 +869,30 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
 #endif
       {
        dbus_uint32_t val;
+       unsigned int pval = val;
        dbus_message_iter_get_basic (iter, &val);
-       XD_DEBUG_MESSAGE ("%c %d", dtype, val);
+       pval = val;
+       XD_DEBUG_MESSAGE ("%c %u", dtype, pval);
        return make_fixnum_or_float (val);
       }
 
     case DBUS_TYPE_INT64:
       {
        dbus_int64_t val;
+       printmax_t pval;
        dbus_message_iter_get_basic (iter, &val);
-       XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
+       pval = val;
+       XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
        return make_fixnum_or_float (val);
       }
 
     case DBUS_TYPE_UINT64:
       {
        dbus_uint64_t val;
+       uprintmax_t pval;
        dbus_message_iter_get_basic (iter, &val);
-       XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val);
+       pval = val;
+       XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval);
        return make_fixnum_or_float (val);
       }
 
@@ -777,7 +932,7 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
            result = Fcons (xd_retrieve_arg (subtype, &subiter), result);
            dbus_message_iter_next (&subiter);
          }
-       XD_DEBUG_MESSAGE ("%c %s", dtype, SDATA (format2 ("%s", result, Qnil)));
+       XD_DEBUG_MESSAGE ("%c %s", dtype, XD_OBJECT_TO_STRING (result));
        RETURN_UNGCPRO (Fnreverse (result));
       }
 
@@ -787,85 +942,37 @@ xd_retrieve_arg (unsigned int dtype, DBusMessageIter *iter)
     }
 }
 
-/* Initialize D-Bus connection.  BUS is either a Lisp symbol, :system
-   or :session, or a string denoting the bus address.  It tells which
-   D-Bus to initialize.  If RAISE_ERROR is non-zero, signal an error
-   when the connection cannot be initialized.  */
+/* Return the number of references of the shared CONNECTION.  */
+static ptrdiff_t
+xd_get_connection_references (DBusConnection *connection)
+{
+  ptrdiff_t *refcount;
+
+  /* We cannot access the DBusConnection structure, it is not public.
+     But we know, that the reference counter is the first field in
+     that structure.  */
+  refcount = (void *) &connection;
+  refcount =  (void *) *refcount;
+  return *refcount;
+}
+
+/* Return D-Bus connection address.  BUS is either a Lisp symbol,
+   :system or :session, or a string denoting the bus address.  */
 static DBusConnection *
-xd_initialize (Lisp_Object bus, int raise_error)
+xd_get_connection_address (Lisp_Object bus)
 {
   DBusConnection *connection;
-  DBusError derror;
-
-  /* Parameter check.  */
-  if (!STRINGP (bus))
-    {
-      CHECK_SYMBOL (bus);
-      if (!(EQ (bus, QCdbus_system_bus) || EQ (bus, QCdbus_session_bus)))
-       {
-         if (raise_error)
-           XD_SIGNAL2 (build_string ("Wrong bus name"), bus);
-         else
-           return NULL;
-       }
-
-      /* We do not want to have an autolaunch for the session bus.  */
-      if (EQ (bus, QCdbus_session_bus)
-         && getenv ("DBUS_SESSION_BUS_ADDRESS") == NULL)
-       {
-         if (raise_error)
-           XD_SIGNAL2 (build_string ("No connection to bus"), bus);
-         else
-           return NULL;
-       }
-    }
+  Lisp_Object val;
 
-  /* Open a connection to the bus.  */
-  dbus_error_init (&derror);
-
-  if (STRINGP (bus))
-      connection = dbus_connection_open (SSDATA (bus), &derror);
+  val = CDR_SAFE (Fassoc (bus, xd_registered_buses));
+  if (NILP (val))
+    XD_SIGNAL2 (build_string ("No connection to bus"), bus);
   else
-    if (EQ (bus, QCdbus_system_bus))
-      connection = dbus_bus_get (DBUS_BUS_SYSTEM, &derror);
-    else
-      connection = dbus_bus_get (DBUS_BUS_SESSION, &derror);
-
-  if (dbus_error_is_set (&derror))
-    {
-      if (raise_error)
-       XD_ERROR (derror);
-      else
-       connection = NULL;
-    }
-
-  /* If it is not the system or session bus, we must register
-     ourselves.  Otherwise, we have called dbus_bus_get, which has
-     configured us to exit if the connection closes - we undo this
-     setting.  */
-  if (connection != NULL)
-    {
-      if (STRINGP (bus))
-       dbus_bus_register (connection, &derror);
-      else
-       dbus_connection_set_exit_on_disconnect (connection, FALSE);
-    }
-
-  if (dbus_error_is_set (&derror))
-    {
-      if (raise_error)
-       XD_ERROR (derror);
-      else
-       connection = NULL;
-    }
+    connection = (DBusConnection *) (intptr_t) XFASTINT (val);
 
-  if (connection == NULL && raise_error)
+  if (!dbus_connection_get_is_connected (connection))
     XD_SIGNAL2 (build_string ("No connection to bus"), bus);
 
-  /* Cleanup.  */
-  dbus_error_free (&derror);
-
-  /* Return the result.  */
   return connection;
 }
 
@@ -896,8 +1003,8 @@ xd_add_watch (DBusWatch *watch, void *data)
   int fd = xd_find_watch_fd (watch);
 
   XD_DEBUG_MESSAGE ("fd %d, write %d, enabled %d",
-                    fd, flags & DBUS_WATCH_WRITABLE,
-                    dbus_watch_get_enabled (watch));
+                   fd, flags & DBUS_WATCH_WRITABLE,
+                   dbus_watch_get_enabled (watch));
 
   if (fd == -1)
     return FALSE;
@@ -929,8 +1036,8 @@ xd_remove_watch (DBusWatch *watch, void *data)
   /* Unset session environment.  */
   if (XSYMBOL (QCdbus_session_bus) == data)
     {
-      XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
-      unsetenv ("DBUS_SESSION_BUS_ADDRESS");
+      //      XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
+      //      unsetenv ("DBUS_SESSION_BUS_ADDRESS");
     }
 
   if (flags & DBUS_WATCH_WRITABLE)
@@ -949,23 +1056,111 @@ xd_toggle_watch (DBusWatch *watch, void *data)
     xd_remove_watch (watch, data);
 }
 
-DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
-       doc: /* Initialize connection to D-Bus BUS.  */)
-  (Lisp_Object bus)
+/* Close connection to D-Bus BUS.  */
+static void
+xd_close_bus (Lisp_Object bus)
+{
+  DBusConnection *connection;
+  Lisp_Object val;
+
+  /* Check whether we are connected.  */
+  val = Fassoc (bus, xd_registered_buses);
+  if (NILP (val))
+    return;
+
+  /* Retrieve bus address.  */
+  connection = xd_get_connection_address (bus);
+
+  /* Close connection, if there isn't another shared application.  */
+  if (xd_get_connection_references (connection) == 1)
+    {
+      XD_DEBUG_MESSAGE ("Close connection to bus %s",
+                       XD_OBJECT_TO_STRING (bus));
+      dbus_connection_close (connection);
+    }
+
+  /* Decrement reference count.  */
+  dbus_connection_unref (connection);
+
+  /* Remove bus from list of registered buses.  */
+  xd_registered_buses = Fdelete (val, xd_registered_buses);
+
+  /* Return.  */
+  return;
+}
+
+DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 2, 0,
+       doc: /* Establish the connection to D-Bus BUS.
+
+BUS can be either the symbol `:system' or the symbol `:session', or it
+can be a string denoting the address of the corresponding bus.  For
+the system and session buses, this function is called when loading
+`dbus.el', there is no need to call it again.
+
+The function returns a number, which counts the connections this Emacs
+session has established to the BUS under the same unique name (see
+`dbus-get-unique-name').  It depends on the libraries Emacs is linked
+with, and on the environment Emacs is running.  For example, if Emacs
+is linked with the gtk toolkit, and it runs in a GTK-aware environment
+like Gnome, another connection might already be established.
+
+When PRIVATE is non-nil, a new connection is established instead of
+reusing an existing one.  It results in a new unique name at the bus.
+This can be used, if it is necessary to distinguish from another
+connection used in the same Emacs process, like the one established by
+GTK+.  It should be used with care for at least the `:system' and
+`:session' buses, because other Emacs Lisp packages might already use
+this connection to those buses.  */)
+  (Lisp_Object bus, Lisp_Object private)
 {
   DBusConnection *connection;
-  void *busp;
+  DBusError derror;
+  Lisp_Object val;
+  ptrdiff_t refcount;
 
   /* Check parameter.  */
-  if (SYMBOLP (bus))
-    busp = XSYMBOL (bus);
-  else if (STRINGP (bus))
-    busp = XSTRING (bus);
+  XD_DBUS_VALIDATE_BUS_ADDRESS (bus);
+
+  /* Close bus if it is already open.  */
+  xd_close_bus (bus);
+
+  /* Initialize.  */
+  dbus_error_init (&derror);
+
+  /* Open the connection.  */
+  if (STRINGP (bus))
+    if (NILP (private))
+      connection = dbus_connection_open (SSDATA (bus), &derror);
+    else
+      connection = dbus_connection_open_private (SSDATA (bus), &derror);
+
+  else
+    if (NILP (private))
+      connection = dbus_bus_get (EQ (bus, QCdbus_system_bus)
+                                ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION,
+                                &derror);
+    else
+      connection = dbus_bus_get_private (EQ (bus, QCdbus_system_bus)
+                                        ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION,
+                                        &derror);
+
+  if (dbus_error_is_set (&derror))
+    XD_ERROR (derror);
+
+  if (connection == NULL)
+    XD_SIGNAL2 (build_string ("No connection to bus"), bus);
+
+  /* If it is not the system or session bus, we must register
+     ourselves.  Otherwise, we have called dbus_bus_get, which has
+     configured us to exit if the connection closes - we undo this
+     setting.  */
+  if (STRINGP (bus))
+    dbus_bus_register (connection, &derror);
   else
-    wrong_type_argument (intern ("D-Bus"), bus);
+    dbus_connection_set_exit_on_disconnect (connection, FALSE);
 
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
+  if (dbus_error_is_set (&derror))
+    XD_ERROR (derror);
 
   /* Add the watch functions.  We pass also the bus as data, in order
      to distinguish between the buses in xd_remove_watch.  */
@@ -973,36 +1168,27 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0,
                                            xd_add_watch,
                                            xd_remove_watch,
                                             xd_toggle_watch,
-                                           busp, NULL))
+                                           SYMBOLP (bus)
+                                           ? (void *) XSYMBOL (bus)
+                                           : (void *) XSTRING (bus),
+                                           NULL))
     XD_SIGNAL1 (build_string ("Cannot add watch functions"));
 
   /* Add bus to list of registered buses.  */
-  Vdbus_registered_buses =  Fcons (bus, Vdbus_registered_buses);
+  XSETFASTINT (val, (intptr_t) connection);
+  xd_registered_buses = Fcons (Fcons (bus, val), xd_registered_buses);
 
   /* We do not want to abort.  */
   putenv ((char *) "DBUS_FATAL_WARNINGS=0");
 
-  /* Return.  */
-  return Qnil;
-}
-
-DEFUN ("dbus-close-bus", Fdbus_close_bus, Sdbus_close_bus, 1, 1, 0,
-       doc: /* Close connection to D-Bus BUS.  */)
-  (Lisp_Object bus)
-{
-  DBusConnection *connection;
-
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
-
-  /* Decrement reference count to the bus.  */
-  dbus_connection_unref (connection);
-
-  /* Remove bus from list of registered buses.  */
-  Vdbus_registered_buses = Fdelete (bus, Vdbus_registered_buses);
+  /* Cleanup.  */
+  dbus_error_free (&derror);
 
-  /* Return.  */
-  return Qnil;
+  /* Return reference counter.  */
+  refcount = xd_get_connection_references (connection);
+  XD_DEBUG_MESSAGE ("Bus %s, Reference counter %"pD"d",
+                   XD_OBJECT_TO_STRING (bus), refcount);
+  return make_number (refcount);
 }
 
 DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
@@ -1013,8 +1199,11 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
   DBusConnection *connection;
   const char *name;
 
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
+  /* Check parameter.  */
+  XD_DBUS_VALIDATE_BUS_ADDRESS (bus);
+
+  /* Retrieve bus address.  */
+  connection = xd_get_connection_address (bus);
 
   /* Request the name.  */
   name = dbus_bus_get_unique_name (connection);
@@ -1025,341 +1214,244 @@ DEFUN ("dbus-get-unique-name", Fdbus_get_unique_name, Sdbus_get_unique_name,
   return build_string (name);
 }
 
-DEFUN ("dbus-call-method", Fdbus_call_method, Sdbus_call_method, 5, MANY, 0,
-       doc: /* Call METHOD on the D-Bus BUS.
-
-BUS is either a Lisp symbol, `:system' or `:session', or a string
-denoting the bus address.
-
-SERVICE is the D-Bus service name to be used.  PATH is the D-Bus
-object path SERVICE is registered at.  INTERFACE is an interface
-offered by SERVICE.  It must provide METHOD.
-
-If the parameter `:timeout' is given, the following integer TIMEOUT
-specifies the maximum number of milliseconds the method call must
-return.  The default value is 25,000.  If the method call doesn't
-return in time, a D-Bus error is raised.
-
-All other arguments ARGS are passed to METHOD as arguments.  They are
-converted into D-Bus types via the following rules:
-
-  t and nil => DBUS_TYPE_BOOLEAN
-  number    => DBUS_TYPE_UINT32
-  integer   => DBUS_TYPE_INT32
-  float     => DBUS_TYPE_DOUBLE
-  string    => DBUS_TYPE_STRING
-  list      => DBUS_TYPE_ARRAY
-
-All arguments can be preceded by a type symbol.  For details about
-type symbols, see Info node `(dbus)Type Conversion'.
-
-`dbus-call-method' returns the resulting values of METHOD as a list of
-Lisp objects.  The type conversion happens the other direction as for
-input arguments.  It follows the mapping rules:
-
-  DBUS_TYPE_BOOLEAN     => t or nil
-  DBUS_TYPE_BYTE        => number
-  DBUS_TYPE_UINT16      => number
-  DBUS_TYPE_INT16       => integer
-  DBUS_TYPE_UINT32      => number or float
-  DBUS_TYPE_UNIX_FD     => number or float
-  DBUS_TYPE_INT32       => integer or float
-  DBUS_TYPE_UINT64      => number or float
-  DBUS_TYPE_INT64       => integer or float
-  DBUS_TYPE_DOUBLE      => float
-  DBUS_TYPE_STRING      => string
-  DBUS_TYPE_OBJECT_PATH => string
-  DBUS_TYPE_SIGNATURE   => string
-  DBUS_TYPE_ARRAY       => list
-  DBUS_TYPE_VARIANT     => list
-  DBUS_TYPE_STRUCT      => list
-  DBUS_TYPE_DICT_ENTRY  => list
-
-Example:
-
-\(dbus-call-method
-  :session "org.gnome.seahorse" "/org/gnome/seahorse/keys/openpgp"
-  "org.gnome.seahorse.Keys" "GetKeyField"
-  "openpgp:657984B8C7A966DD" "simple-name")
-
-  => (t ("Philip R. Zimmermann"))
-
-If the result of the METHOD call is just one value, the converted Lisp
-object is returned instead of a list containing this single Lisp object.
-
-\(dbus-call-method
-  :system "org.freedesktop.Hal" "/org/freedesktop/Hal/devices/computer"
-  "org.freedesktop.Hal.Device" "GetPropertyString"
-  "system.kernel.machine")
-
-  => "i686"
-
-usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS)  */)
+DEFUN ("dbus-message-internal", Fdbus_message_internal, Sdbus_message_internal,
+       4, MANY, 0,
+       doc: /* Send a D-Bus message.
+This is an internal function, it shall not be used outside dbus.el.
+
+The following usages are expected:
+
+`dbus-call-method', `dbus-call-method-asynchronously':
+  \(dbus-message-internal
+    dbus-message-type-method-call BUS SERVICE PATH INTERFACE METHOD HANDLER
+    &optional :timeout TIMEOUT &rest ARGS)
+
+`dbus-send-signal':
+  \(dbus-message-internal
+    dbus-message-type-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS)
+
+`dbus-method-return-internal':
+  \(dbus-message-internal
+    dbus-message-type-method-return BUS SERVICE SERIAL &rest ARGS)
+
+`dbus-method-error-internal':
+  \(dbus-message-internal
+    dbus-message-type-error BUS SERVICE SERIAL &rest ARGS)
+
+usage: (dbus-message-internal &rest REST)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  Lisp_Object bus, service, path, interface, method;
+  Lisp_Object message_type, bus, service, handler;
+  Lisp_Object path = Qnil;
+  Lisp_Object interface = Qnil;
+  Lisp_Object member = Qnil;
   Lisp_Object result;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
+  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   DBusConnection *connection;
   DBusMessage *dmessage;
-  DBusMessage *reply;
   DBusMessageIter iter;
-  DBusError derror;
-  unsigned int dtype;
+  int dtype;
+  int mtype;
+  dbus_uint32_t serial = 0;
+  unsigned int ui_serial;
   int timeout = -1;
-  ptrdiff_t i = 5;
+  ptrdiff_t count;
   char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
 
+  /* Initialize parameters.  */
+  message_type = args[0];
+  bus = args[1];
+  service = args[2];
+  handler = Qnil;
+
+  CHECK_NATNUM (message_type);
+  if (! (DBUS_MESSAGE_TYPE_INVALID < XFASTINT (message_type)
+        && XFASTINT (message_type) < DBUS_NUM_MESSAGE_TYPES))
+    XD_SIGNAL2 (build_string ("Invalid message type"), message_type);
+  mtype = XFASTINT (message_type);
+
+  if ((mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
+      || (mtype == DBUS_MESSAGE_TYPE_SIGNAL))
+    {
+      path = args[3];
+      interface = args[4];
+      member = args[5];
+      if (mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
+       handler = args[6];
+      count = (mtype == DBUS_MESSAGE_TYPE_METHOD_CALL) ? 7 : 6;
+    }
+  else /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR  */
+    {
+      serial = xd_extract_unsigned (args[3], TYPE_MAXIMUM (dbus_uint32_t));
+      count = 4;
+    }
+
   /* Check parameters.  */
-  bus = args[0];
-  service = args[1];
-  path = args[2];
-  interface = args[3];
-  method = args[4];
-
-  CHECK_STRING (service);
-  CHECK_STRING (path);
-  CHECK_STRING (interface);
-  CHECK_STRING (method);
-  GCPRO5 (bus, service, path, interface, method);
-
-  XD_DEBUG_MESSAGE ("%s %s %s %s",
-                   SDATA (service),
-                   SDATA (path),
-                   SDATA (interface),
-                   SDATA (method));
-
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
-
-  /* Create the message.  */
-  dmessage = dbus_message_new_method_call (SSDATA (service),
-                                          SSDATA (path),
-                                          SSDATA (interface),
-                                          SSDATA (method));
-  UNGCPRO;
-  if (dmessage == NULL)
-    XD_SIGNAL1 (build_string ("Unable to create a new message"));
+  XD_DBUS_VALIDATE_BUS_ADDRESS (bus);
+  XD_DBUS_VALIDATE_BUS_NAME (service);
+  if (nargs < count)
+    xsignal2 (Qwrong_number_of_arguments,
+             Qdbus_message_internal,
+             make_number (nargs));
+
+  if ((mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
+      || (mtype == DBUS_MESSAGE_TYPE_SIGNAL))
+    {
+      XD_DBUS_VALIDATE_PATH (path);
+      XD_DBUS_VALIDATE_INTERFACE (interface);
+      XD_DBUS_VALIDATE_MEMBER (member);
+      if (!NILP (handler) && (!FUNCTIONP (handler)))
+       wrong_type_argument (Qinvalid_function, handler);
+    }
 
-  /* Check for timeout parameter.  */
-  if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout)))
+  /* Protect Lisp variables.  */
+  GCPRO6 (bus, service, path, interface, member, handler);
+
+  /* Trace parameters.  */
+  switch (mtype)
     {
-      CHECK_NATNUM (args[i+1]);
-      timeout = XFASTINT (args[i+1]);
-      i = i+2;
+    case DBUS_MESSAGE_TYPE_METHOD_CALL:
+      XD_DEBUG_MESSAGE ("%s %s %s %s %s %s %s",
+                       XD_MESSAGE_TYPE_TO_STRING (mtype),
+                       XD_OBJECT_TO_STRING (bus),
+                       XD_OBJECT_TO_STRING (service),
+                       XD_OBJECT_TO_STRING (path),
+                       XD_OBJECT_TO_STRING (interface),
+                       XD_OBJECT_TO_STRING (member),
+                       XD_OBJECT_TO_STRING (handler));
+      break;
+    case DBUS_MESSAGE_TYPE_SIGNAL:
+      XD_DEBUG_MESSAGE ("%s %s %s %s %s %s",
+                       XD_MESSAGE_TYPE_TO_STRING (mtype),
+                       XD_OBJECT_TO_STRING (bus),
+                       XD_OBJECT_TO_STRING (service),
+                       XD_OBJECT_TO_STRING (path),
+                       XD_OBJECT_TO_STRING (interface),
+                       XD_OBJECT_TO_STRING (member));
+      break;
+    default: /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR  */
+      ui_serial = serial;
+      XD_DEBUG_MESSAGE ("%s %s %s %u",
+                       XD_MESSAGE_TYPE_TO_STRING (mtype),
+                       XD_OBJECT_TO_STRING (bus),
+                       XD_OBJECT_TO_STRING (service),
+                       ui_serial);
     }
 
-  /* Initialize parameter list of message.  */
-  dbus_message_iter_init_append (dmessage, &iter);
+  /* Retrieve bus address.  */
+  connection = xd_get_connection_address (bus);
 
-  /* Append parameters to the message.  */
-  for (; i < nargs; ++i)
+  /* Create the D-Bus message.  */
+  dmessage = dbus_message_new (mtype);
+  if (dmessage == NULL)
+    {
+      UNGCPRO;
+      XD_SIGNAL1 (build_string ("Unable to create a new message"));
+    }
+
+  if (STRINGP (service))
     {
-      dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]);
-      if (XD_DBUS_TYPE_P (args[i]))
+      if (mtype != DBUS_MESSAGE_TYPE_SIGNAL)
+       /* Set destination.  */
        {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4,
-                           SDATA (format2 ("%s", args[i], Qnil)),
-                           SDATA (format2 ("%s", args[i+1], Qnil)));
-         ++i;
+         if (!dbus_message_set_destination (dmessage, SSDATA (service)))
+           {
+             UNGCPRO;
+             XD_SIGNAL2 (build_string ("Unable to set the destination"),
+                         service);
+           }
        }
+
       else
+       /* Set destination for unicast signals.  */
        {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4,
-                           SDATA (format2 ("%s", args[i], Qnil)));
-       }
+         Lisp_Object uname;
 
-      /* Check for valid signature.  We use DBUS_TYPE_INVALID as
-        indication that there is no parent type.  */
-      xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]);
+         /* If it is the same unique name as we are registered at the
+            bus or an unknown name, we regard it as broadcast message
+            due to backward compatibility.  */
+         if (dbus_bus_name_has_owner (connection, SSDATA (service), NULL))
+           uname = call2 (intern ("dbus-get-name-owner"), bus, service);
+         else
+           uname = Qnil;
 
-      xd_append_arg (dtype, args[i], &iter);
+         if (STRINGP (uname)
+             && (strcmp (dbus_bus_get_unique_name (connection), SSDATA (uname))
+                 != 0)
+             && (!dbus_message_set_destination (dmessage, SSDATA (service))))
+           {
+             UNGCPRO;
+             XD_SIGNAL2 (build_string ("Unable to set signal destination"),
+                         service);
+           }
+       }
     }
 
-  /* Send the message.  */
-  dbus_error_init (&derror);
-  reply = dbus_connection_send_with_reply_and_block (connection,
-                                                    dmessage,
-                                                    timeout,
-                                                    &derror);
-
-  if (dbus_error_is_set (&derror))
-    XD_ERROR (derror);
-
-  if (reply == NULL)
-    XD_SIGNAL1 (build_string ("No reply"));
-
-  XD_DEBUG_MESSAGE ("Message sent");
-
-  /* Collect the results.  */
-  result = Qnil;
-  GCPRO1 (result);
-
-  if (dbus_message_iter_init (reply, &iter))
+  /* Set message parameters.  */
+  if ((mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
+      || (mtype == DBUS_MESSAGE_TYPE_SIGNAL))
     {
-      /* Loop over the parameters of the D-Bus reply message.  Construct a
-        Lisp list, which is returned by `dbus-call-method'.  */
-      while ((dtype = dbus_message_iter_get_arg_type (&iter))
-            != DBUS_TYPE_INVALID)
+      if ((!dbus_message_set_path (dmessage, SSDATA (path)))
+         || (!dbus_message_set_interface (dmessage, SSDATA (interface)))
+         || (!dbus_message_set_member (dmessage, SSDATA (member))))
        {
-         result = Fcons (xd_retrieve_arg (dtype, &iter), result);
-         dbus_message_iter_next (&iter);
+         UNGCPRO;
+         XD_SIGNAL1 (build_string ("Unable to set the message parameter"));
        }
     }
-  else
+
+  else /* DBUS_MESSAGE_TYPE_METHOD_RETURN, DBUS_MESSAGE_TYPE_ERROR  */
     {
-      /* No arguments: just return nil.  */
+      if (!dbus_message_set_reply_serial (dmessage, serial))
+       {
+         UNGCPRO;
+         XD_SIGNAL1 (build_string ("Unable to create a return message"));
+       }
+
+      if ((mtype == DBUS_MESSAGE_TYPE_ERROR)
+         && (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)))
+       {
+         UNGCPRO;
+         XD_SIGNAL1 (build_string ("Unable to create a error message"));
+       }
     }
 
-  /* Cleanup.  */
-  dbus_error_free (&derror);
-  dbus_message_unref (dmessage);
-  dbus_message_unref (reply);
+  /* Check for timeout parameter.  */
+  if ((count+2 <= nargs) && (EQ ((args[count]), QCdbus_timeout)))
+    {
+      CHECK_NATNUM (args[count+1]);
+      timeout = min (XFASTINT (args[count+1]), INT_MAX);
+      count = count+2;
+    }
 
-  /* Return the result.  If there is only one single Lisp object,
-     return it as-it-is, otherwise return the reversed list.  */
-  if (XFASTINT (Flength (result)) == 1)
-    RETURN_UNGCPRO (CAR_SAFE (result));
-  else
-    RETURN_UNGCPRO (Fnreverse (result));
-}
-
-DEFUN ("dbus-call-method-asynchronously", Fdbus_call_method_asynchronously,
-       Sdbus_call_method_asynchronously, 6, MANY, 0,
-       doc: /* Call METHOD on the D-Bus BUS asynchronously.
-
-BUS is either a Lisp symbol, `:system' or `:session', or a string
-denoting the bus address.
-
-SERVICE is the D-Bus service name to be used.  PATH is the D-Bus
-object path SERVICE is registered at.  INTERFACE is an interface
-offered by SERVICE.  It must provide METHOD.
-
-HANDLER is a Lisp function, which is called when the corresponding
-return message has arrived.  If HANDLER is nil, no return message will
-be expected.
-
-If the parameter `:timeout' is given, the following integer TIMEOUT
-specifies the maximum number of milliseconds the method call must
-return.  The default value is 25,000.  If the method call doesn't
-return in time, a D-Bus error is raised.
-
-All other arguments ARGS are passed to METHOD as arguments.  They are
-converted into D-Bus types via the following rules:
-
-  t and nil => DBUS_TYPE_BOOLEAN
-  number    => DBUS_TYPE_UINT32
-  integer   => DBUS_TYPE_INT32
-  float     => DBUS_TYPE_DOUBLE
-  string    => DBUS_TYPE_STRING
-  list      => DBUS_TYPE_ARRAY
-
-All arguments can be preceded by a type symbol.  For details about
-type symbols, see Info node `(dbus)Type Conversion'.
-
-Unless HANDLER is nil, the function returns a key into the hash table
-`dbus-registered-objects-table'.  The corresponding entry in the hash
-table is removed, when the return message has been arrived, and
-HANDLER is called.
-
-Example:
-
-\(dbus-call-method-asynchronously
-  :system "org.freedesktop.Hal" "/org/freedesktop/Hal/devices/computer"
-  "org.freedesktop.Hal.Device" "GetPropertyString" 'message
-  "system.kernel.machine")
-
-  => (:system 2)
-
-  -| i686
-
-usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS)  */)
-  (ptrdiff_t nargs, Lisp_Object *args)
-{
-  Lisp_Object bus, service, path, interface, method, handler;
-  Lisp_Object result;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
-  DBusConnection *connection;
-  DBusMessage *dmessage;
-  DBusMessageIter iter;
-  unsigned int dtype;
-  dbus_uint32_t serial;
-  int timeout = -1;
-  ptrdiff_t i = 6;
-  char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
-
-  /* Check parameters.  */
-  bus = args[0];
-  service = args[1];
-  path = args[2];
-  interface = args[3];
-  method = args[4];
-  handler = args[5];
-
-  CHECK_STRING (service);
-  CHECK_STRING (path);
-  CHECK_STRING (interface);
-  CHECK_STRING (method);
-  if (!NILP (handler) && !FUNCTIONP (handler))
-    wrong_type_argument (Qinvalid_function, handler);
-  GCPRO6 (bus, service, path, interface, method, handler);
-
-  XD_DEBUG_MESSAGE ("%s %s %s %s",
-                   SDATA (service),
-                   SDATA (path),
-                   SDATA (interface),
-                   SDATA (method));
-
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
-
-  /* Create the message.  */
-  dmessage = dbus_message_new_method_call (SSDATA (service),
-                                          SSDATA (path),
-                                          SSDATA (interface),
-                                          SSDATA (method));
-  if (dmessage == NULL)
-    XD_SIGNAL1 (build_string ("Unable to create a new message"));
-
-  /* Check for timeout parameter.  */
-  if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout)))
-    {
-      CHECK_NATNUM (args[i+1]);
-      timeout = XFASTINT (args[i+1]);
-      i = i+2;
-    }
-
-  /* Initialize parameter list of message.  */
-  dbus_message_iter_init_append (dmessage, &iter);
+  /* Initialize parameter list of message.  */
+  dbus_message_iter_init_append (dmessage, &iter);
 
   /* Append parameters to the message.  */
-  for (; i < nargs; ++i)
+  for (; count < nargs; ++count)
     {
-      dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]);
-      if (XD_DBUS_TYPE_P (args[i]))
+      dtype = XD_OBJECT_TO_DBUS_TYPE (args[count]);
+      if (XD_DBUS_TYPE_P (args[count]))
        {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4,
-                           SDATA (format2 ("%s", args[i], Qnil)),
-                           SDATA (format2 ("%s", args[i+1], Qnil)));
-         ++i;
+         XD_DEBUG_VALID_LISP_OBJECT_P (args[count]);
+         XD_DEBUG_VALID_LISP_OBJECT_P (args[count+1]);
+         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", count - 4,
+                           XD_OBJECT_TO_STRING (args[count]),
+                           XD_OBJECT_TO_STRING (args[count+1]));
+         ++count;
        }
       else
        {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4,
-                           SDATA (format2 ("%s", args[i], Qnil)));
+         XD_DEBUG_VALID_LISP_OBJECT_P (args[count]);
+         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", count - 4,
+                           XD_OBJECT_TO_STRING (args[count]));
        }
 
       /* Check for valid signature.  We use DBUS_TYPE_INVALID as
         indication that there is no parent type.  */
-      xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]);
+      xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[count]);
 
-      xd_append_arg (dtype, args[i], &iter);
+      xd_append_arg (dtype, args[count], &iter);
     }
 
   if (!NILP (handler))
@@ -1368,11 +1460,15 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
         message queue.  */
       if (!dbus_connection_send_with_reply (connection, dmessage,
                                            NULL, timeout))
-       XD_SIGNAL1 (build_string ("Cannot send message"));
+       {
+         UNGCPRO;
+         XD_SIGNAL1 (build_string ("Cannot send message"));
+       }
 
       /* The result is the key in Vdbus_registered_objects_table.  */
       serial = dbus_message_get_serial (dmessage);
-      result = list2 (bus, make_fixnum_or_float (serial));
+      result = list3 (QCdbus_registered_serial,
+                     bus, make_fixnum_or_float (serial));
 
       /* Create a hash table entry.  */
       Fputhash (result, handler, Vdbus_registered_objects_table);
@@ -1382,12 +1478,15 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
       /* Send the message.  The message is just added to the outgoing
         message queue.  */
       if (!dbus_connection_send (connection, dmessage, NULL))
-       XD_SIGNAL1 (build_string ("Cannot send message"));
+       {
+         UNGCPRO;
+         XD_SIGNAL1 (build_string ("Cannot send message"));
+       }
 
       result = Qnil;
     }
 
-  XD_DEBUG_MESSAGE ("Message sent");
+  XD_DEBUG_MESSAGE ("Message sent: %s", XD_OBJECT_TO_STRING (result));
 
   /* Cleanup.  */
   dbus_message_unref (dmessage);
@@ -1396,300 +1495,6 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
   RETURN_UNGCPRO (result);
 }
 
-DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal,
-       Sdbus_method_return_internal,
-       3, MANY, 0,
-       doc: /* Return for message SERIAL on the D-Bus BUS.
-This is an internal function, it shall not be used outside dbus.el.
-
-usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS)  */)
-  (ptrdiff_t nargs, Lisp_Object *args)
-{
-  Lisp_Object bus, service;
-  struct gcpro gcpro1, gcpro2;
-  DBusConnection *connection;
-  DBusMessage *dmessage;
-  DBusMessageIter iter;
-  dbus_uint32_t serial;
-  unsigned int ui_serial, dtype;
-  ptrdiff_t i;
-  char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
-
-  /* Check parameters.  */
-  bus = args[0];
-  service = args[2];
-
-  CHECK_DBUS_SERIAL_GET_SERIAL (args[1], serial);
-  CHECK_STRING (service);
-  GCPRO2 (bus, service);
-
-  ui_serial = serial;
-  XD_DEBUG_MESSAGE ("%u %s ", ui_serial, SSDATA (service));
-
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
-
-  /* Create the message.  */
-  dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN);
-  if ((dmessage == NULL)
-      || (!dbus_message_set_reply_serial (dmessage, serial))
-      || (!dbus_message_set_destination (dmessage, SSDATA (service))))
-    {
-      UNGCPRO;
-      XD_SIGNAL1 (build_string ("Unable to create a return message"));
-    }
-
-  UNGCPRO;
-
-  /* Initialize parameter list of message.  */
-  dbus_message_iter_init_append (dmessage, &iter);
-
-  /* Append parameters to the message.  */
-  for (i = 3; i < nargs; ++i)
-    {
-      dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]);
-      if (XD_DBUS_TYPE_P (args[i]))
-       {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2,
-                           SDATA (format2 ("%s", args[i], Qnil)),
-                           SDATA (format2 ("%s", args[i+1], Qnil)));
-         ++i;
-       }
-      else
-       {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2,
-                           SDATA (format2 ("%s", args[i], Qnil)));
-       }
-
-      /* Check for valid signature.  We use DBUS_TYPE_INVALID as
-        indication that there is no parent type.  */
-      xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]);
-
-      xd_append_arg (dtype, args[i], &iter);
-    }
-
-  /* Send the message.  The message is just added to the outgoing
-     message queue.  */
-  if (!dbus_connection_send (connection, dmessage, NULL))
-    XD_SIGNAL1 (build_string ("Cannot send message"));
-
-  XD_DEBUG_MESSAGE ("Message sent");
-
-  /* Cleanup.  */
-  dbus_message_unref (dmessage);
-
-  /* Return.  */
-  return Qt;
-}
-
-DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal,
-       Sdbus_method_error_internal,
-       3, MANY, 0,
-       doc: /* Return error message for message SERIAL on the D-Bus BUS.
-This is an internal function, it shall not be used outside dbus.el.
-
-usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS)  */)
-  (ptrdiff_t nargs, Lisp_Object *args)
-{
-  Lisp_Object bus, service;
-  struct gcpro gcpro1, gcpro2;
-  DBusConnection *connection;
-  DBusMessage *dmessage;
-  DBusMessageIter iter;
-  dbus_uint32_t serial;
-  unsigned int ui_serial, dtype;
-  ptrdiff_t i;
-  char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
-
-  /* Check parameters.  */
-  bus = args[0];
-  service = args[2];
-
-  CHECK_DBUS_SERIAL_GET_SERIAL (args[1], serial);
-  CHECK_STRING (service);
-  GCPRO2 (bus, service);
-
-  ui_serial = serial;
-  XD_DEBUG_MESSAGE ("%u %s ", ui_serial, SSDATA (service));
-
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
-
-  /* Create the message.  */
-  dmessage = dbus_message_new (DBUS_MESSAGE_TYPE_ERROR);
-  if ((dmessage == NULL)
-      || (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED))
-      || (!dbus_message_set_reply_serial (dmessage, serial))
-      || (!dbus_message_set_destination (dmessage, SSDATA (service))))
-    {
-      UNGCPRO;
-      XD_SIGNAL1 (build_string ("Unable to create a error message"));
-    }
-
-  UNGCPRO;
-
-  /* Initialize parameter list of message.  */
-  dbus_message_iter_init_append (dmessage, &iter);
-
-  /* Append parameters to the message.  */
-  for (i = 3; i < nargs; ++i)
-    {
-      dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]);
-      if (XD_DBUS_TYPE_P (args[i]))
-       {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2,
-                           SDATA (format2 ("%s", args[i], Qnil)),
-                           SDATA (format2 ("%s", args[i+1], Qnil)));
-         ++i;
-       }
-      else
-       {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2,
-                           SDATA (format2 ("%s", args[i], Qnil)));
-       }
-
-      /* Check for valid signature.  We use DBUS_TYPE_INVALID as
-        indication that there is no parent type.  */
-      xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]);
-
-      xd_append_arg (dtype, args[i], &iter);
-    }
-
-  /* Send the message.  The message is just added to the outgoing
-     message queue.  */
-  if (!dbus_connection_send (connection, dmessage, NULL))
-    XD_SIGNAL1 (build_string ("Cannot send message"));
-
-  XD_DEBUG_MESSAGE ("Message sent");
-
-  /* Cleanup.  */
-  dbus_message_unref (dmessage);
-
-  /* Return.  */
-  return Qt;
-}
-
-DEFUN ("dbus-send-signal", Fdbus_send_signal, Sdbus_send_signal, 5, MANY, 0,
-       doc: /* Send signal SIGNAL on the D-Bus BUS.
-
-BUS is either a Lisp symbol, `:system' or `:session', or a string
-denoting the bus address.
-
-SERVICE is the D-Bus service name SIGNAL is sent from.  PATH is the
-D-Bus object path SERVICE is registered at.  INTERFACE is an interface
-offered by SERVICE.  It must provide signal SIGNAL.
-
-All other arguments ARGS are passed to SIGNAL as arguments.  They are
-converted into D-Bus types via the following rules:
-
-  t and nil => DBUS_TYPE_BOOLEAN
-  number    => DBUS_TYPE_UINT32
-  integer   => DBUS_TYPE_INT32
-  float     => DBUS_TYPE_DOUBLE
-  string    => DBUS_TYPE_STRING
-  list      => DBUS_TYPE_ARRAY
-
-All arguments can be preceded by a type symbol.  For details about
-type symbols, see Info node `(dbus)Type Conversion'.
-
-Example:
-
-\(dbus-send-signal
-  :session "org.gnu.Emacs" "/org/gnu/Emacs"
-  "org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs")
-
-usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS)  */)
-  (ptrdiff_t nargs, Lisp_Object *args)
-{
-  Lisp_Object bus, service, path, interface, signal;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
-  DBusConnection *connection;
-  DBusMessage *dmessage;
-  DBusMessageIter iter;
-  unsigned int dtype;
-  ptrdiff_t i;
-  char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
-
-  /* Check parameters.  */
-  bus = args[0];
-  service = args[1];
-  path = args[2];
-  interface = args[3];
-  signal = args[4];
-
-  CHECK_STRING (service);
-  CHECK_STRING (path);
-  CHECK_STRING (interface);
-  CHECK_STRING (signal);
-  GCPRO5 (bus, service, path, interface, signal);
-
-  XD_DEBUG_MESSAGE ("%s %s %s %s",
-                   SDATA (service),
-                   SDATA (path),
-                   SDATA (interface),
-                   SDATA (signal));
-
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
-
-  /* Create the message.  */
-  dmessage = dbus_message_new_signal (SSDATA (path),
-                                     SSDATA (interface),
-                                     SSDATA (signal));
-  UNGCPRO;
-  if (dmessage == NULL)
-    XD_SIGNAL1 (build_string ("Unable to create a new message"));
-
-  /* Initialize parameter list of message.  */
-  dbus_message_iter_init_append (dmessage, &iter);
-
-  /* Append parameters to the message.  */
-  for (i = 5; i < nargs; ++i)
-    {
-      dtype = XD_OBJECT_TO_DBUS_TYPE (args[i]);
-      if (XD_DBUS_TYPE_P (args[i]))
-       {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4,
-                           SDATA (format2 ("%s", args[i], Qnil)),
-                           SDATA (format2 ("%s", args[i+1], Qnil)));
-         ++i;
-       }
-      else
-       {
-         XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
-         XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4,
-                           SDATA (format2 ("%s", args[i], Qnil)));
-       }
-
-      /* Check for valid signature.  We use DBUS_TYPE_INVALID as
-        indication that there is no parent type.  */
-      xd_signature (signature, dtype, DBUS_TYPE_INVALID, args[i]);
-
-      xd_append_arg (dtype, args[i], &iter);
-    }
-
-  /* Send the message.  The message is just added to the outgoing
-     message queue.  */
-  if (!dbus_connection_send (connection, dmessage, NULL))
-    XD_SIGNAL1 (build_string ("Cannot send message"));
-
-  XD_DEBUG_MESSAGE ("Signal sent");
-
-  /* Cleanup.  */
-  dbus_message_unref (dmessage);
-
-  /* Return.  */
-  return Qt;
-}
-
 /* Read one queued incoming message of the D-Bus BUS.
    BUS is either a Lisp symbol, :system or :session, or a string denoting
    the bus address.  */
@@ -1701,7 +1506,7 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
   struct input_event event;
   DBusMessage *dmessage;
   DBusMessageIter iter;
-  unsigned int dtype;
+  int dtype;
   int mtype;
   dbus_uint32_t serial;
   unsigned int ui_serial;
@@ -1744,23 +1549,19 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
   member = dbus_message_get_member (dmessage);
 
   XD_DEBUG_MESSAGE ("Event received: %s %u %s %s %s %s %s",
-                   (mtype == DBUS_MESSAGE_TYPE_INVALID)
-                   ? "DBUS_MESSAGE_TYPE_INVALID"
-                   : (mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
-                   ? "DBUS_MESSAGE_TYPE_METHOD_CALL"
-                   : (mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)
-                   ? "DBUS_MESSAGE_TYPE_METHOD_RETURN"
-                   : (mtype == DBUS_MESSAGE_TYPE_ERROR)
-                   ? "DBUS_MESSAGE_TYPE_ERROR"
-                   : "DBUS_MESSAGE_TYPE_SIGNAL",
+                   XD_MESSAGE_TYPE_TO_STRING (mtype),
                    ui_serial, uname, path, interface, member,
-                   SDATA (format2 ("%s", args, Qnil)));
+                   XD_OBJECT_TO_STRING (args));
+
+  if (mtype == DBUS_MESSAGE_TYPE_INVALID)
+    goto cleanup;
 
-  if ((mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)
-      || (mtype == DBUS_MESSAGE_TYPE_ERROR))
+  else if ((mtype == DBUS_MESSAGE_TYPE_METHOD_RETURN)
+          || (mtype == DBUS_MESSAGE_TYPE_ERROR))
     {
       /* Search for a registered function of the message.  */
-      key = list2 (bus, make_fixnum_or_float (serial));
+      key = list3 (QCdbus_registered_serial, bus,
+                  make_fixnum_or_float (serial));
       value = Fgethash (key, Vdbus_registered_objects_table, Qnil);
 
       /* There shall be exactly one entry.  Construct an event.  */
@@ -1777,7 +1578,7 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
       event.arg = Fcons (value, args);
     }
 
-  else /* (mtype != DBUS_MESSAGE_TYPE_METHOD_RETURN)  */
+  else /* DBUS_MESSAGE_TYPE_METHOD_CALL, DBUS_MESSAGE_TYPE_SIGNAL.  */
     {
       /* Vdbus_registered_objects_table requires non-nil interface and
         member.  */
@@ -1785,7 +1586,10 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
        goto cleanup;
 
       /* Search for a registered function of the message.  */
-      key = list3 (bus, build_string (interface), build_string (member));
+      key = list4 ((mtype == DBUS_MESSAGE_TYPE_METHOD_CALL)
+                  ? QCdbus_registered_method
+                  : QCdbus_registered_signal,
+                  bus, build_string (interface), build_string (member));
       value = Fgethash (key, Vdbus_registered_objects_table, Qnil);
 
       /* Loop over the registered functions.  Construct an event.  */
@@ -1835,8 +1639,7 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
   /* Store it into the input event queue.  */
   kbd_buffer_store_event (&event);
 
-  XD_DEBUG_MESSAGE ("Event stored: %s",
-                   SDATA (format2 ("%s", event.arg, Qnil)));
+  XD_DEBUG_MESSAGE ("Event stored: %s", XD_OBJECT_TO_STRING (event.arg));
 
   /* Cleanup.  */
  cleanup:
@@ -1851,8 +1654,8 @@ xd_read_message_1 (DBusConnection *connection, Lisp_Object bus)
 static Lisp_Object
 xd_read_message (Lisp_Object bus)
 {
-  /* Open a connection to the bus.  */
-  DBusConnection *connection = xd_initialize (bus, TRUE);
+  /* Retrieve bus address.  */
+  DBusConnection *connection = xd_get_connection_address (bus);
 
   /* Non blocking read of the next available message.  */
   dbus_connection_read_write (connection, 0);
@@ -1867,16 +1670,18 @@ xd_read_message (Lisp_Object bus)
 static void
 xd_read_queued_messages (int fd, void *data, int for_read)
 {
-  Lisp_Object busp = Vdbus_registered_buses;
+  Lisp_Object busp = xd_registered_buses;
   Lisp_Object bus = Qnil;
+  Lisp_Object key;
 
   /* Find bus related to fd.  */
   if (data != NULL)
     while (!NILP (busp))
       {
-       if ((SYMBOLP (CAR_SAFE (busp)) && XSYMBOL (CAR_SAFE (busp)) == data)
-           || (STRINGP (CAR_SAFE (busp)) && XSTRING (CAR_SAFE (busp)) == data))
-         bus = CAR_SAFE (busp);
+       key = CAR_SAFE (CAR_SAFE (busp));
+       if ((SYMBOLP (key) && XSYMBOL (key) == data)
+           || (STRINGP (key) && XSTRING (key) == data))
+         bus = key;
        busp = CDR_SAFE (busp);
       }
 
@@ -1889,327 +1694,6 @@ xd_read_queued_messages (int fd, void *data, int for_read)
   xd_in_read_queued_messages = 0;
 }
 
-DEFUN ("dbus-register-service", Fdbus_register_service, Sdbus_register_service,
-       2, MANY, 0,
-       doc: /* Register known name SERVICE on the D-Bus BUS.
-
-BUS is either a Lisp symbol, `:system' or `:session', or a string
-denoting the bus address.
-
-SERVICE is the D-Bus service name that should be registered.  It must
-be a known name.
-
-FLAGS are keywords, which control how the service name is registered.
-The following keywords are recognized:
-
-`:allow-replacement': Allow another service to become the primary
-owner if requested.
-
-`:replace-existing': Request to replace the current primary owner.
-
-`:do-not-queue': If we can not become the primary owner do not place
-us in the queue.
-
-The function returns a keyword, indicating the result of the
-operation.  One of the following keywords is returned:
-
-`:primary-owner': Service has become the primary owner of the
-requested name.
-
-`:in-queue': Service could not become the primary owner and has been
-placed in the queue.
-
-`:exists': Service is already in the queue.
-
-`:already-owner': Service is already the primary owner.
-
-Example:
-
-\(dbus-register-service :session dbus-service-emacs)
-
-  => :primary-owner.
-
-\(dbus-register-service
-  :session "org.freedesktop.TextEditor"
-  dbus-service-allow-replacement dbus-service-replace-existing)
-
-  => :already-owner.
-
-usage: (dbus-register-service BUS SERVICE &rest FLAGS)  */)
-  (ptrdiff_t nargs, Lisp_Object *args)
-{
-  Lisp_Object bus, service;
-  DBusConnection *connection;
-  ptrdiff_t i;
-  unsigned int value;
-  unsigned int flags = 0;
-  int result;
-  DBusError derror;
-
-  bus = args[0];
-  service = args[1];
-
-  /* Check parameters.  */
-  CHECK_STRING (service);
-
-  /* Process flags.  */
-  for (i = 2; i < nargs; ++i) {
-    value = ((EQ (args[i], QCdbus_request_name_replace_existing))
-            ? DBUS_NAME_FLAG_REPLACE_EXISTING
-            : (EQ (args[i], QCdbus_request_name_allow_replacement))
-            ? DBUS_NAME_FLAG_ALLOW_REPLACEMENT
-            : (EQ (args[i], QCdbus_request_name_do_not_queue))
-            ? DBUS_NAME_FLAG_DO_NOT_QUEUE
-            : -1);
-    if (value == -1)
-      XD_SIGNAL2 (build_string ("Unrecognized name request flag"), args[i]);
-    flags |= value;
-  }
-
-  /* Open a connection to the bus.  */
-  connection = xd_initialize (bus, TRUE);
-
-  /* Request the known name from the bus.  */
-  dbus_error_init (&derror);
-  result = dbus_bus_request_name (connection, SSDATA (service), flags,
-                                 &derror);
-  if (dbus_error_is_set (&derror))
-    XD_ERROR (derror);
-
-  /* Cleanup.  */
-  dbus_error_free (&derror);
-
-  /* Return object.  */
-  switch (result)
-    {
-    case DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER:
-      return QCdbus_request_name_reply_primary_owner;
-    case DBUS_REQUEST_NAME_REPLY_IN_QUEUE:
-      return QCdbus_request_name_reply_in_queue;
-    case DBUS_REQUEST_NAME_REPLY_EXISTS:
-      return QCdbus_request_name_reply_exists;
-    case DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER:
-      return QCdbus_request_name_reply_already_owner;
-    default:
-      /* This should not happen.  */
-      XD_SIGNAL2 (build_string ("Could not register service"), service);
-    }
-}
-
-DEFUN ("dbus-register-signal", Fdbus_register_signal, Sdbus_register_signal,
-       6, MANY, 0,
-       doc: /* Register for signal SIGNAL on the D-Bus BUS.
-
-BUS is either a Lisp symbol, `:system' or `:session', or a string
-denoting the bus address.
-
-SERVICE is the D-Bus service name used by the sending D-Bus object.
-It can be either a known name or the unique name of the D-Bus object
-sending the signal.  When SERVICE is nil, related signals from all
-D-Bus objects shall be accepted.
-
-PATH is the D-Bus object path SERVICE is registered.  It can also be
-nil if the path name of incoming signals shall not be checked.
-
-INTERFACE is an interface offered by SERVICE.  It must provide SIGNAL.
-HANDLER is a Lisp function to be called when the signal is received.
-It must accept as arguments the values SIGNAL is sending.
-
-All other arguments ARGS, if specified, must be strings.  They stand
-for the respective arguments of the signal in their order, and are
-used for filtering as well.  A nil argument might be used to preserve
-the order.
-
-INTERFACE, SIGNAL and HANDLER must not be nil.  Example:
-
-\(defun my-signal-handler (device)
-  (message "Device %s added" device))
-
-\(dbus-register-signal
-  :system "org.freedesktop.Hal" "/org/freedesktop/Hal/Manager"
-  "org.freedesktop.Hal.Manager" "DeviceAdded" 'my-signal-handler)
-
-  => ((:system "org.freedesktop.Hal.Manager" "DeviceAdded")
-      ("org.freedesktop.Hal" "/org/freedesktop/Hal/Manager" my-signal-handler))
-
-`dbus-register-signal' returns an object, which can be used in
-`dbus-unregister-object' for removing the registration.
-
-usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */)
-  (ptrdiff_t nargs, Lisp_Object *args)
-{
-  Lisp_Object bus, service, path, interface, signal, handler;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
-  Lisp_Object uname, key, key1, value;
-  DBusConnection *connection;
-  ptrdiff_t i;
-  char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
-  int rulelen;
-  DBusError derror;
-
-  /* Check parameters.  */
-  bus = args[0];
-  service = args[1];
-  path = args[2];
-  interface = args[3];
-  signal = args[4];
-  handler = args[5];
-
-  if (!NILP (service)) CHECK_STRING (service);
-  if (!NILP (path)) CHECK_STRING (path);
-  CHECK_STRING (interface);
-  CHECK_STRING (signal);
-  if (!FUNCTIONP (handler))
-    wrong_type_argument (Qinvalid_function, handler);
-  GCPRO6 (bus, service, path, interface, signal, handler);
-
-  /* Retrieve unique name of service.  If service is a known name, we
-     will register for the corresponding unique name, if any.  Signals
-     are sent always with the unique name as sender.  Note: the unique
-     name of "org.freedesktop.DBus" is that string itself.  */
-  if ((STRINGP (service))
-      && (SBYTES (service) > 0)
-      && (strcmp (SSDATA (service), DBUS_SERVICE_DBUS) != 0)
-      && (strncmp (SSDATA (service), ":", 1) != 0))
-    uname = call2 (intern ("dbus-get-name-owner"), bus, service);
-  else
-    uname = service;
-
-  /* Create a matching rule if the unique name exists (when no
-     wildcard).  */
-  if (NILP (uname) || (SBYTES (uname) > 0))
-    {
-      /* Open a connection to the bus.  */
-      connection = xd_initialize (bus, TRUE);
-
-      /* Create a rule to receive related signals.  */
-      rulelen = snprintf (rule, sizeof rule,
-                         "type='signal',interface='%s',member='%s'",
-                         SDATA (interface),
-                         SDATA (signal));
-      if (! (0 <= rulelen && rulelen < sizeof rule))
-       string_overflow ();
-
-      /* Add unique name and path to the rule if they are non-nil.  */
-      if (!NILP (uname))
-       {
-         int len = snprintf (rule + rulelen, sizeof rule - rulelen,
-                             ",sender='%s'", SDATA (uname));
-         if (! (0 <= len && len < sizeof rule - rulelen))
-           string_overflow ();
-         rulelen += len;
-       }
-
-      if (!NILP (path))
-       {
-         int len = snprintf (rule + rulelen, sizeof rule - rulelen,
-                             ",path='%s'", SDATA (path));
-         if (! (0 <= len && len < sizeof rule - rulelen))
-           string_overflow ();
-         rulelen += len;
-       }
-
-      /* Add arguments to the rule if they are non-nil.  */
-      for (i = 6; i < nargs; ++i)
-       if (!NILP (args[i]))
-         {
-           int len;
-           CHECK_STRING (args[i]);
-           len = snprintf (rule + rulelen, sizeof rule - rulelen,
-                           ",arg%"pD"d='%s'", i - 6, SDATA (args[i]));
-           if (! (0 <= len && len < sizeof rule - rulelen))
-             string_overflow ();
-           rulelen += len;
-         }
-
-      /* Add the rule to the bus.  */
-      dbus_error_init (&derror);
-      dbus_bus_add_match (connection, rule, &derror);
-      if (dbus_error_is_set (&derror))
-       {
-         UNGCPRO;
-         XD_ERROR (derror);
-       }
-
-      /* Cleanup.  */
-      dbus_error_free (&derror);
-
-      XD_DEBUG_MESSAGE ("Matching rule \"%s\" created", rule);
-    }
-
-  /* Create a hash table entry.  */
-  key = list3 (bus, interface, signal);
-  key1 = list5 (uname, service, path, handler, build_string (rule));
-  value = Fgethash (key, Vdbus_registered_objects_table, Qnil);
-
-  if (NILP (Fmember (key1, value)))
-    Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table);
-
-  /* Return object.  */
-  RETURN_UNGCPRO (list2 (key, list3 (service, path, handler)));
-}
-
-DEFUN ("dbus-register-method", Fdbus_register_method, Sdbus_register_method,
-       6, 7, 0,
-       doc: /* Register for method METHOD on the D-Bus BUS.
-
-BUS is either a Lisp symbol, `:system' or `:session', or a string
-denoting the bus address.
-
-SERVICE is the D-Bus service name of the D-Bus object METHOD is
-registered for.  It must be a known name (See discussion of
-DONT-REGISTER-SERVICE below).
-
-PATH is the D-Bus object path SERVICE is registered (See discussion of
-DONT-REGISTER-SERVICE below).  INTERFACE is the interface offered by
-SERVICE.  It must provide METHOD.
-
-HANDLER is a Lisp function to be called when a method call is
-received.  It must accept the input arguments of METHOD.  The return
-value of HANDLER is used for composing the returning D-Bus message.
-In case HANDLER shall return a reply message with an empty argument
-list, HANDLER must return the symbol `:ignore'.
-
-When DONT-REGISTER-SERVICE is non-nil, the known name SERVICE is not
-registered.  This means that other D-Bus clients have no way of
-noticing the newly registered method.  When interfaces are constructed
-incrementally by adding single methods or properties at a time,
-DONT-REGISTER-SERVICE can be used to prevent other clients from
-discovering the still incomplete interface.*/)
-  (Lisp_Object bus, Lisp_Object service, Lisp_Object path,
-   Lisp_Object interface, Lisp_Object method, Lisp_Object handler,
-   Lisp_Object dont_register_service)
-{
-  Lisp_Object key, key1, value;
-  Lisp_Object args[2] = { bus, service };
-
-  /* Check parameters.  */
-  CHECK_STRING (service);
-  CHECK_STRING (path);
-  CHECK_STRING (interface);
-  CHECK_STRING (method);
-  if (!FUNCTIONP (handler))
-    wrong_type_argument (Qinvalid_function, handler);
-  /* TODO: We must check for a valid service name, otherwise there is
-     a segmentation fault.  */
-
-  /* Request the name.  */
-  if (NILP (dont_register_service))
-    Fdbus_register_service (2, args);
-
-  /* Create a hash table entry.  We use nil for the unique name,
-     because the method might be called from anybody.  */
-  key = list3 (bus, interface, method);
-  key1 = list4 (Qnil, service, path, handler);
-  value = Fgethash (key, Vdbus_registered_objects_table, Qnil);
-
-  if (NILP (Fmember (key1, value)))
-    Fputhash (key, Fcons (key1, value), Vdbus_registered_objects_table);
-
-  /* Return object.  */
-  return list2 (key, list3 (service, path, handler));
-}
-
 \f
 void
 syms_of_dbusbind (void)
@@ -2218,51 +1702,20 @@ syms_of_dbusbind (void)
   DEFSYM (Qdbus_init_bus, "dbus-init-bus");
   defsubr (&Sdbus_init_bus);
 
-  DEFSYM (Qdbus_close_bus, "dbus-close-bus");
-  defsubr (&Sdbus_close_bus);
-
   DEFSYM (Qdbus_get_unique_name, "dbus-get-unique-name");
   defsubr (&Sdbus_get_unique_name);
 
-  DEFSYM (Qdbus_call_method, "dbus-call-method");
-  defsubr (&Sdbus_call_method);
-
-  DEFSYM (Qdbus_call_method_asynchronously, "dbus-call-method-asynchronously");
-  defsubr (&Sdbus_call_method_asynchronously);
-
-  DEFSYM (Qdbus_method_return_internal, "dbus-method-return-internal");
-  defsubr (&Sdbus_method_return_internal);
-
-  DEFSYM (Qdbus_method_error_internal, "dbus-method-error-internal");
-  defsubr (&Sdbus_method_error_internal);
-
-  DEFSYM (Qdbus_send_signal, "dbus-send-signal");
-  defsubr (&Sdbus_send_signal);
-
-  DEFSYM (Qdbus_register_service, "dbus-register-service");
-  defsubr (&Sdbus_register_service);
-
-  DEFSYM (Qdbus_register_signal, "dbus-register-signal");
-  defsubr (&Sdbus_register_signal);
-
-  DEFSYM (Qdbus_register_method, "dbus-register-method");
-  defsubr (&Sdbus_register_method);
+  DEFSYM (Qdbus_message_internal, "dbus-message-internal");
+  defsubr (&Sdbus_message_internal);
 
   DEFSYM (Qdbus_error, "dbus-error");
   Fput (Qdbus_error, Qerror_conditions,
        list2 (Qdbus_error, Qerror));
   Fput (Qdbus_error, Qerror_message,
-       make_pure_c_string ("D-Bus error"));
+       build_pure_c_string ("D-Bus error"));
 
   DEFSYM (QCdbus_system_bus, ":system");
   DEFSYM (QCdbus_session_bus, ":session");
-  DEFSYM (QCdbus_request_name_allow_replacement, ":allow-replacement");
-  DEFSYM (QCdbus_request_name_replace_existing, ":replace-existing");
-  DEFSYM (QCdbus_request_name_do_not_queue, ":do-not-queue");
-  DEFSYM (QCdbus_request_name_reply_primary_owner, ":primary-owner");
-  DEFSYM (QCdbus_request_name_reply_exists, ":exists");
-  DEFSYM (QCdbus_request_name_reply_in_queue, ":in-queue");
-  DEFSYM (QCdbus_request_name_reply_already_owner, ":already-owner");
   DEFSYM (QCdbus_timeout, ":timeout");
   DEFSYM (QCdbus_type_byte, ":byte");
   DEFSYM (QCdbus_type_boolean, ":boolean");
@@ -2276,20 +1729,66 @@ syms_of_dbusbind (void)
   DEFSYM (QCdbus_type_string, ":string");
   DEFSYM (QCdbus_type_object_path, ":object-path");
   DEFSYM (QCdbus_type_signature, ":signature");
-
 #ifdef DBUS_TYPE_UNIX_FD
   DEFSYM (QCdbus_type_unix_fd, ":unix-fd");
 #endif
-
   DEFSYM (QCdbus_type_array, ":array");
   DEFSYM (QCdbus_type_variant, ":variant");
   DEFSYM (QCdbus_type_struct, ":struct");
   DEFSYM (QCdbus_type_dict_entry, ":dict-entry");
+  DEFSYM (QCdbus_registered_serial, ":serial");
+  DEFSYM (QCdbus_registered_method, ":method");
+  DEFSYM (QCdbus_registered_signal, ":signal");
+
+  DEFVAR_LISP ("dbus-compiled-version",
+              Vdbus_compiled_version,
+    doc: /* The version of D-Bus Emacs is compiled against.  */);
+#ifdef DBUS_VERSION_STRING
+  Vdbus_compiled_version = build_pure_c_string (DBUS_VERSION_STRING);
+#else
+  Vdbus_compiled_version = Qnil;
+#endif
+
+  DEFVAR_LISP ("dbus-runtime-version",
+              Vdbus_runtime_version,
+    doc: /* The version of D-Bus Emacs runs with.  */);
+  {
+#ifdef DBUS_VERSION
+    int major, minor, micro;
+    char s[sizeof ".." + 3 * INT_STRLEN_BOUND (int)];
+    dbus_get_version (&major, &minor, &micro);
+    Vdbus_runtime_version
+      = make_formatted_string (s, "%d.%d.%d", major, minor, micro);
+#else
+    Vdbus_runtime_version = Qnil;
+#endif
+  }
+
+  DEFVAR_LISP ("dbus-message-type-invalid",
+              Vdbus_message_type_invalid,
+    doc: /* This value is never a valid message type.  */);
+  Vdbus_message_type_invalid = make_number (DBUS_MESSAGE_TYPE_INVALID);
 
-  DEFVAR_LISP ("dbus-registered-buses",
-              Vdbus_registered_buses,
-    doc: /* List of D-Bus buses we are polling for messages.  */);
-  Vdbus_registered_buses = Qnil;
+  DEFVAR_LISP ("dbus-message-type-method-call",
+              Vdbus_message_type_method_call,
+    doc: /* Message type of a method call message.  */);
+  Vdbus_message_type_method_call = make_number (DBUS_MESSAGE_TYPE_METHOD_CALL);
+
+  DEFVAR_LISP ("dbus-message-type-method-return",
+              Vdbus_message_type_method_return,
+    doc: /* Message type of a method return message.  */);
+  Vdbus_message_type_method_return
+    = make_number (DBUS_MESSAGE_TYPE_METHOD_RETURN);
+
+  DEFVAR_LISP ("dbus-message-type-error",
+              Vdbus_message_type_error,
+    doc: /* Message type of an error reply message.  */);
+  Vdbus_message_type_error = make_number (DBUS_MESSAGE_TYPE_ERROR);
+
+  DEFVAR_LISP ("dbus-message-type-signal",
+              Vdbus_message_type_signal,
+    doc: /* Message type of a signal message.  */);
+  Vdbus_message_type_signal = make_number (DBUS_MESSAGE_TYPE_SIGNAL);
 
   DEFVAR_LISP ("dbus-registered-objects-table",
               Vdbus_registered_objects_table,
@@ -2299,27 +1798,28 @@ There are two different uses of the hash table: for accessing
 registered interfaces properties, targeted by signals or method calls,
 and for calling handlers in case of non-blocking method call returns.
 
-In the first case, the key in the hash table is the list (BUS
-INTERFACE MEMBER).  BUS is either a Lisp symbol, `:system' or
+In the first case, the key in the hash table is the list (TYPE BUS
+INTERFACE MEMBER).  TYPE is one of the Lisp symbols `:method',
+`:signal' or `:property'.  BUS is either a Lisp symbol, `:system' or
 `:session', or a string denoting the bus address.  INTERFACE is a
 string which denotes a D-Bus interface, and MEMBER, also a string, is
 either a method, a signal or a property INTERFACE is offering.  All
 arguments but BUS must not be nil.
 
-The value in the hash table is a list of quadruple lists
-\((UNAME SERVICE PATH OBJECT) (UNAME SERVICE PATH OBJECT) ...).
-SERVICE is the service name as registered, UNAME is the corresponding
-unique name.  In case of registered methods and properties, UNAME is
-nil.  PATH is the object path of the sending object.  All of them can
-be nil, which means a wildcard then.  OBJECT is either the handler to
-be called when a D-Bus message, which matches the key criteria,
-arrives (methods and signals), or a cons cell containing the value of
-the property.
+The value in the hash table is a list of quadruple lists \((UNAME
+SERVICE PATH OBJECT [RULE]) ...).  SERVICE is the service name as
+registered, UNAME is the corresponding unique name.  In case of
+registered methods and properties, UNAME is nil.  PATH is the object
+path of the sending object.  All of them can be nil, which means a
+wildcard then.  OBJECT is either the handler to be called when a D-Bus
+message, which matches the key criteria, arrives (TYPE `:method' and
+`:signal'), or a cons cell containing the value of the property (TYPE
+`:property').
 
-For signals, there is also a fifth element RULE, which keeps the match
-string the signal is registered with.
+For entries of type `:signal', there is also a fifth element RULE,
+which keeps the match string the signal is registered with.
 
-In the second case, the key in the hash table is the list (BUS
+In the second case, the key in the hash table is the list (:serial BUS
 SERIAL).  BUS is either a Lisp symbol, `:system' or `:session', or a
 string denoting the bus address.  SERIAL is the serial number of the
 non-blocking method call, a reply is expected.  Both arguments must
@@ -2343,6 +1843,10 @@ be called when the D-Bus reply message arrives.  */);
   Vdbus_debug = Qnil;
 #endif
 
+  /* Initialize internal objects.  */
+  xd_registered_buses = Qnil;
+  staticpro (&xd_registered_buses);
+
   Fprovide (intern_c_string ("dbusbind"), Qnil);
 
 }
index 8665fd0dc6d4c85288fca8dadfd9a7af07160ddc..7c047f97e6f9fe70020ccdab6aa459bd4aeafc7c 100644 (file)
@@ -62,6 +62,7 @@ extern struct direct *readdir (DIR *);
 #endif /* HAVE_DIRENT_H */
 
 #include <filemode.h>
+#include <stat-time.h>
 
 #ifdef MSDOS
 #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
@@ -71,9 +72,9 @@ extern struct direct *readdir (DIR *);
 
 #include "lisp.h"
 #include "systime.h"
+#include "character.h"
 #include "buffer.h"
 #include "commands.h"
-#include "character.h"
 #include "charset.h"
 #include "coding.h"
 #include "regex.h"
@@ -86,8 +87,7 @@ static Lisp_Object Qfile_name_all_completions;
 static Lisp_Object Qfile_attributes;
 static Lisp_Object Qfile_attributes_lessp;
 
-static int scmp (const char *, const char *, int);
-static Lisp_Object Ffile_attributes (Lisp_Object, Lisp_Object);
+static ptrdiff_t scmp (const char *, const char *, ptrdiff_t);
 \f
 #ifdef WINDOWSNT
 Lisp_Object
@@ -117,11 +117,11 @@ Lisp_Object
 directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format)
 {
   DIR *d;
-  int directory_nbytes;
+  ptrdiff_t directory_nbytes;
   Lisp_Object list, dirfilename, encoded_directory;
   struct re_pattern_buffer *bufp = NULL;
   int needsep = 0;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   DIRENTRY *dp;
 #ifdef WINDOWSNT
@@ -226,7 +226,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
 
       if (DIRENTRY_NONEMPTY (dp))
        {
-         int len;
+         ptrdiff_t len;
          int wanted = 0;
          Lisp_Object name, finalname;
          struct gcpro gcpro1, gcpro2;
@@ -256,8 +256,8 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
              if (!NILP (full))
                {
                  Lisp_Object fullname;
-                 int nbytes = len + directory_nbytes + needsep;
-                 int nchars;
+                 ptrdiff_t nbytes = len + directory_nbytes + needsep;
+                 ptrdiff_t nchars;
 
                  fullname = make_uninit_multibyte_string (nbytes, nbytes);
                  memcpy (SDATA (fullname), SDATA (directory),
@@ -449,7 +449,7 @@ static Lisp_Object
 file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate)
 {
   DIR *d;
-  int bestmatchsize = 0;
+  ptrdiff_t bestmatchsize = 0;
   int matchcount = 0;
   /* If ALL_FLAG is 1, BESTMATCH is the list of all matches, decoded.
      If ALL_FLAG is 0, BESTMATCH is either nil
@@ -463,7 +463,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
      well as "." and "..".  Until shown otherwise, assume we can't exclude
      anything.  */
   int includeall = 1;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
 
   elt = Qnil;
@@ -499,7 +499,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
   while (1)
     {
       DIRENTRY *dp;
-      int len;
+      ptrdiff_t len;
       int canexclude = 0;
 
       errno = 0;
@@ -535,7 +535,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
         completions when making a list of them.  */
       if (!all_flag)
        {
-         int skip;
+         ptrdiff_t skip;
 
 #if 0 /* FIXME: The `scmp' call compares an encoded and a decoded string. */
          /* If this entry matches the current bestmatch, the only
@@ -565,7 +565,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
                for (tem = Vcompletion_ignored_extensions;
                     CONSP (tem); tem = XCDR (tem))
                  {
-                   int elt_len;
+                   ptrdiff_t elt_len;
                    char *p1;
 
                    elt = XCAR (tem);
@@ -682,7 +682,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
 
       /* Suitably record this match.  */
 
-      matchcount++;
+      matchcount += matchcount <= 1;
 
       if (all_flag)
        bestmatch = Fcons (name, bestmatch);
@@ -695,14 +695,14 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
        {
          Lisp_Object zero = make_number (0);
          /* FIXME: This is a copy of the code in Ftry_completion.  */
-         int compare = min (bestmatchsize, SCHARS (name));
+         ptrdiff_t compare = min (bestmatchsize, SCHARS (name));
          Lisp_Object cmp
            = Fcompare_strings (bestmatch, zero,
                                make_number (compare),
                                name, zero,
                                make_number (compare),
                                completion_ignore_case ? Qt : Qnil);
-         int matchsize
+         ptrdiff_t matchsize
            = (EQ (cmp, Qt)     ? compare
               : XINT (cmp) < 0 ? - XINT (cmp) - 1
               :                  XINT (cmp) - 1);
@@ -781,10 +781,10 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
    Return -1 if strings match,
    else number of chars that match at the beginning.  */
 
-static int
-scmp (const char *s1, const char *s2, int len)
+static ptrdiff_t
+scmp (const char *s1, const char *s2, ptrdiff_t len)
 {
-  register int l = len;
+  register ptrdiff_t l = len;
 
   if (completion_ignore_case)
     {
@@ -807,10 +807,12 @@ scmp (const char *s1, const char *s2, int len)
 static int
 file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr)
 {
-  int len = NAMLEN (dp);
-  int pos = SCHARS (dirname);
+  ptrdiff_t len = NAMLEN (dp);
+  ptrdiff_t pos = SCHARS (dirname);
   int value;
-  char *fullname = (char *) alloca (len + pos + 2);
+  char *fullname;
+  USE_SAFE_ALLOCA;
+  SAFE_ALLOCA (fullname, char *, len + pos + 2);
 
 #ifdef MSDOS
   /* Some fields of struct stat are *very* expensive to compute on MS-DOS,
@@ -839,6 +841,7 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad
 #ifdef MSDOS
   _djstat_flags = save_djstat_flags;
 #endif /* MSDOS */
+  SAFE_FREE ();
   return value;
 }
 \f
@@ -887,8 +890,8 @@ Elements of the attribute list are:
  2. File uid as a string or a number.  If a string value cannot be
   looked up, a numeric value, either an integer or a float, is returned.
  3. File gid, likewise.
- 4. Last access time, as a list of two integers.
-  First integer has high-order 16 bits of time, second has low 16 bits.
+ 4. Last access time, as a list of integers (HIGH LOW USEC PSEC) in the
+  same style as (current-time).
   (See a note below about access time on FAT-based filesystems.)
  5. Last modification time, likewise.  This is the time of the last
   change to the file's contents.
@@ -973,9 +976,9 @@ so last access time will always be midnight of that day.  */)
   else
     values[3] = make_fixnum_or_float (s.st_gid);
 
-  values[4] = make_time (s.st_atime);
-  values[5] = make_time (s.st_mtime);
-  values[6] = make_time (s.st_ctime);
+  values[4] = make_lisp_time (get_stat_atime (&s));
+  values[5] = make_lisp_time (get_stat_mtime (&s));
+  values[6] = make_lisp_time (get_stat_ctime (&s));
 
   /* If the file size is a 4-byte type, assume that files of sizes in
      the 2-4 GiB range wrap around to negative values, as this is a
@@ -1012,6 +1015,45 @@ Comparison is in lexicographic order and case is significant.  */)
   return Fstring_lessp (Fcar (f1), Fcar (f2));
 }
 \f
+
+DEFUN ("system-users", Fsystem_users, Ssystem_users, 0, 0, 0,
+       doc: /* Return a list of user names currently registered in the system.
+If we don't know how to determine that on this platform, just
+return a list with one element, taken from `user-real-login-name'.  */)
+     (void)
+{
+  Lisp_Object users = Qnil;
+#if defined HAVE_GETPWENT && defined HAVE_ENDPWENT
+  struct passwd *pw;
+
+  while ((pw = getpwent ()))
+    users = Fcons (DECODE_SYSTEM (build_string (pw->pw_name)), users);
+
+  endpwent ();
+#endif
+  if (EQ (users, Qnil))
+    /* At least current user is always known. */
+    users = Fcons (Vuser_real_login_name, Qnil);
+  return users;
+}
+
+DEFUN ("system-groups", Fsystem_groups, Ssystem_groups, 0, 0, 0,
+       doc: /* Return a list of user group names currently registered in the system.
+The value may be nil if not supported on this platform.  */)
+     (void)
+{
+  Lisp_Object groups = Qnil;
+#if defined HAVE_GETGRENT && defined HAVE_ENDGRENT
+  struct group *gr;
+
+  while ((gr = getgrent ()))
+    groups = Fcons (DECODE_SYSTEM (build_string (gr->gr_name)), groups);
+
+  endgrent ();
+#endif
+  return groups;
+}
+
 void
 syms_of_dired (void)
 {
@@ -1029,6 +1071,8 @@ syms_of_dired (void)
   defsubr (&Sfile_name_all_completions);
   defsubr (&Sfile_attributes);
   defsubr (&Sfile_attributes_lessp);
+  defsubr (&Ssystem_users);
+  defsubr (&Ssystem_groups);
 
   DEFVAR_LISP ("completion-ignored-extensions", Vcompletion_ignored_extensions,
               doc: /* Completion ignores file names ending in any string in this list.
index f3266313df3f1a6c9dcfa9f0d44d9b74f4c73a0e..5bdf943466b87c206f86f15c471872724fa37e84 100644 (file)
@@ -46,6 +46,13 @@ typedef struct {
 #include "msdos.h"
 #endif
 
+#include <c-strcase.h>
+static inline int
+xstrcasecmp (char const *a, char const *b)
+{
+  return c_strcasecmp (a, b);
+}
+
 #ifdef HAVE_X_WINDOWS
 typedef struct x_display_info Display_Info;
 typedef XImage * XImagePtr;
@@ -68,6 +75,10 @@ typedef Pixmap XImagePtr;
 typedef XImagePtr XImagePtr_or_DC;
 #endif
 
+#ifdef HAVE_WINDOW_SYSTEM
+# include "systime.h"
+#endif
+
 #ifndef HAVE_WINDOW_SYSTEM
 typedef int Cursor;
 #define No_Cursor (0)
@@ -117,39 +128,21 @@ enum window_part
                              Debugging
  ***********************************************************************/
 
-/* If GLYPH_DEBUG is non-zero, additional checks are activated.  Turn
-   it off by defining the macro GLYPH_DEBUG to zero.  */
-
-#ifndef GLYPH_DEBUG
-#define GLYPH_DEBUG 0
-#endif
-
-/* If XASSERTS is non-zero, additional consistency checks are activated.
-   Turn it off by defining the macro XASSERTS to zero.  */
-
-#ifndef XASSERTS
-#define XASSERTS 0
-#endif
+/* If GLYPH_DEBUG is defined, additional checks are activated.  */
 
-/* Macros to include code only if GLYPH_DEBUG != 0.  */
+/* Macros to include code only if GLYPH_DEBUG is defined.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 #define IF_DEBUG(X)    X
 #else
 #define IF_DEBUG(X)    (void) 0
 #endif
 
-#if XASSERTS
-#define xassert(X)     do {if (!(X)) abort ();} while (0)
-#else
-#define xassert(X)     (void) 0
-#endif
-
 /* Macro for displaying traces of redisplay.  If Emacs was compiled
-   with GLYPH_DEBUG != 0, the variable trace_redisplay_p can be set to
+   with GLYPH_DEBUG defined, the variable trace_redisplay_p can be set to
    a non-zero value in debugging sessions to activate traces.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 extern int trace_redisplay_p EXTERNALLY_VISIBLE;
 #include <stdio.h>
@@ -160,11 +153,11 @@ extern int trace_redisplay_p EXTERNALLY_VISIBLE;
      else                                      \
        (void) 0
 
-#else /* GLYPH_DEBUG == 0 */
+#else /* not GLYPH_DEBUG */
 
 #define TRACE(X)       (void) 0
 
-#endif /* GLYPH_DEBUG == 0 */
+#endif /* GLYPH_DEBUG */
 
 
 \f
@@ -179,10 +172,10 @@ extern int trace_redisplay_p EXTERNALLY_VISIBLE;
 struct text_pos
 {
   /* Character position.  */
-  EMACS_INT charpos;
+  ptrdiff_t charpos;
 
   /* Corresponding byte position.  */
-  EMACS_INT bytepos;
+  ptrdiff_t bytepos;
 };
 
 /* Access character and byte position of POS in a functional form.  */
@@ -253,7 +246,7 @@ struct display_pos
      is the index of that overlay string in the sequence of overlay
      strings at `pos' in the order redisplay processes them.  A value
      < 0 means that this is not a position in an overlay string.  */
-  int overlay_string_index;
+  ptrdiff_t overlay_string_index;
 
   /* If this is a position in an overlay string, string_pos is the
      position within that string.  */
@@ -320,7 +313,7 @@ struct glyph
      buffer, this is a position in that buffer.  A value of -1
      together with a null object means glyph is a truncation glyph at
      the start of a row.  */
-  EMACS_INT charpos;
+  ptrdiff_t charpos;
 
   /* Lisp object source of this glyph.  Currently either a buffer or
      a string, if the glyph was produced from characters which came from
@@ -662,7 +655,7 @@ struct glyph_matrix
      line.  */
   unsigned header_line_p : 1;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   /* A string identifying the method used to display the matrix.  */
   char method[512];
 #endif
@@ -680,7 +673,7 @@ struct glyph_matrix
 /* Check that glyph pointers stored in glyph rows of MATRIX are okay.
    This aborts if any pointer is found twice.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 void check_matrix_pointer_lossage (struct glyph_matrix *);
 #define CHECK_MATRIX(MATRIX) check_matrix_pointer_lossage ((MATRIX))
 #else
@@ -959,10 +952,10 @@ struct glyph_row
 
 
 /* Get a pointer to row number ROW in matrix MATRIX.  If GLYPH_DEBUG
-   is defined to a non-zero value, the function matrix_row checks that
-   we don't try to access rows that are out of bounds.  */
+   is defined, the function matrix_row checks that we don't try to
+   access rows that are out of bounds.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 struct glyph_row *matrix_row (struct glyph_matrix *, int);
 #define MATRIX_ROW(MATRIX, ROW)   matrix_row ((MATRIX), (ROW))
 #else
@@ -1510,6 +1503,13 @@ enum face_box_type
   FACE_SUNKEN_BOX
 };
 
+/* Underline type. */
+
+enum face_underline_type
+{
+  FACE_UNDER_LINE,
+  FACE_UNDER_WAVE
+};
 
 /* Structure describing a realized face.
 
@@ -1585,6 +1585,9 @@ struct face
      drawing shadows.  */
   unsigned use_box_color_for_shadows_p : 1;
 
+  /* Style of underlining. */
+  enum face_underline_type underline_type;
+
   /* Non-zero if text in this face should be underlined, overlined,
      strike-through or have a box drawn around it.  */
   unsigned underline_p : 1;
@@ -1609,15 +1612,12 @@ struct face
   unsigned strike_through_color_defaulted_p : 1;
   unsigned box_color_defaulted_p : 1;
 
-  /* TTY appearances.  Blinking is not yet implemented.  Colors are
-     found in `lface' with empty color string meaning the default
-     color of the TTY.  */
+  /* TTY appearances.  Colors are found in `lface' with empty color
+     string meaning the default color of the TTY.  */
   unsigned tty_bold_p : 1;
-  unsigned tty_dim_p : 1;
+  unsigned tty_italic_p : 1;
   unsigned tty_underline_p : 1;
-  unsigned tty_alt_charset_p : 1;
   unsigned tty_reverse_p : 1;
-  unsigned tty_blinking_p : 1;
 
   /* 1 means that colors of this face may not be freed because they
      have been copied bitwise from a base face (see
@@ -1808,7 +1808,7 @@ typedef enum { NEUTRAL_DIR, L2R, R2L } bidi_dir_t;
 /* Data type for storing information about characters we need to
    remember.  */
 struct bidi_saved_info {
-  EMACS_INT bytepos, charpos;  /* character's buffer position */
+  ptrdiff_t bytepos, charpos;  /* character's buffer position */
   bidi_type_t type;            /* character's resolved bidi type */
   bidi_type_t type_after_w1;   /* original type of the character, after W1 */
   bidi_type_t orig_type;       /* type as we found it in the buffer */
@@ -1825,9 +1825,9 @@ struct bidi_stack {
 struct bidi_string_data {
   Lisp_Object lstring;         /* Lisp string to reorder, or nil */
   const unsigned char *s;      /* string data, or NULL if reordering buffer */
-  EMACS_INT schars;            /* the number of characters in the string,
+  ptrdiff_t schars;            /* the number of characters in the string,
                                   excluding the terminating null */
-  EMACS_INT bufpos;            /* buffer position of lstring, or 0 if N/A */
+  ptrdiff_t bufpos;            /* buffer position of lstring, or 0 if N/A */
   unsigned from_disp_str : 1;  /* 1 means the string comes from a
                                   display property */
   unsigned unibyte : 1;                /* 1 means the string is unibyte */
@@ -1835,14 +1835,14 @@ struct bidi_string_data {
 
 /* Data type for reordering bidirectional text.  */
 struct bidi_it {
-  EMACS_INT bytepos;           /* iterator's position in buffer/string */
-  EMACS_INT charpos;
+  ptrdiff_t bytepos;           /* iterator's position in buffer/string */
+  ptrdiff_t charpos;
   int ch;                      /* character at that position, or u+FFFC
                                   ("object replacement character") for a run
                                   of characters covered by a display string */
-  EMACS_INT nchars;            /* its "length", usually 1; it's > 1 for a run
+  ptrdiff_t nchars;            /* its "length", usually 1; it's > 1 for a run
                                   of characters covered by a display string */
-  EMACS_INT ch_len;            /* its length in bytes */
+  ptrdiff_t ch_len;            /* its length in bytes */
   bidi_type_t type;            /* bidi type of this character, after
                                   resolving weak and neutral types */
   bidi_type_t type_after_w1;   /* original type, after overrides and W1 */
@@ -1856,12 +1856,12 @@ struct bidi_it {
   struct bidi_saved_info next_for_neutral; /* surrounding characters for... */
   struct bidi_saved_info prev_for_neutral; /* ...resolving neutrals */
   struct bidi_saved_info next_for_ws; /* character after sequence of ws */
-  EMACS_INT next_en_pos;       /* pos. of next char for determining ET type */
+  ptrdiff_t next_en_pos;       /* pos. of next char for determining ET type */
   bidi_type_t next_en_type;    /* type of char at next_en_pos */
-  EMACS_INT ignore_bn_limit;   /* position until which to ignore BNs */
+  ptrdiff_t ignore_bn_limit;   /* position until which to ignore BNs */
   bidi_dir_t sor;              /* direction of start-of-run in effect */
   int scan_dir;                        /* direction of text scan, 1: forw, -1: back */
-  EMACS_INT disp_pos;          /* position of display string after ch */
+  ptrdiff_t disp_pos;          /* position of display string after ch */
   int disp_prop;               /* if non-zero, there really is a
                                   `display' property/string at disp_pos;
                                   if 2, the property is a `space' spec */
@@ -1872,7 +1872,7 @@ struct bidi_it {
   struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */
   struct bidi_string_data string;      /* string to reorder */
   bidi_dir_t paragraph_dir;    /* current paragraph direction */
-  EMACS_INT separator_limit;   /* where paragraph separator should end */
+  ptrdiff_t separator_limit;   /* where paragraph separator should end */
   unsigned first_elt : 1;      /* if non-zero, examine current char first */
   unsigned new_paragraph : 1;  /* if non-zero, we expect a new paragraph */
   unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */
@@ -2058,7 +2058,7 @@ enum it_method {
 struct composition_it
 {
   /* Next position at which to check the composition.  */
-  EMACS_INT stop_pos;
+  ptrdiff_t stop_pos;
   /* ID number of the composition or glyph-string.  If negative, we
      are not iterating over a composition now.  */
   ptrdiff_t id;
@@ -2076,7 +2076,7 @@ struct composition_it
   /* If this is an automatic composition, how many characters to look
      back from the position where a character triggering the
      composition exists.  */
-  int lookback;
+  ptrdiff_t lookback;
   /* If non-negative, number of glyphs of the glyph-string.  */
   int nglyphs;
   /* Nonzero iff the composition is created while buffer is scanned in
@@ -2087,7 +2087,7 @@ struct composition_it
   /** The following members contain information about the current
       grapheme cluster.  */
   /* Position of the first character of the current grapheme cluster.  */
-  EMACS_INT charpos;
+  ptrdiff_t charpos;
   /* Number of characters and bytes of the current grapheme cluster.  */
   int nchars, nbytes;
   /* Indices of the glyphs for the current grapheme cluster.  */
@@ -2112,19 +2112,19 @@ struct it
 
   /* The next position at which to check for face changes, invisible
      text, overlay strings, end of text etc., which see.  */
-  EMACS_INT stop_charpos;
+  ptrdiff_t stop_charpos;
 
   /* Previous stop position, i.e. the last one before the current
      iterator position in `current'.  */
-  EMACS_INT prev_stop;
+  ptrdiff_t prev_stop;
 
   /* Last stop position iterated across whose bidi embedding level is
      equal to the current paragraph's base embedding level.  */
-  EMACS_INT base_level_stop;
+  ptrdiff_t base_level_stop;
 
   /* Maximum string or buffer position + 1.  ZV when iterating over
      current_buffer.  */
-  EMACS_INT end_charpos;
+  ptrdiff_t end_charpos;
 
   /* C string to iterate over.  Non-null means get characters from
      this string, otherwise characters are read from current_buffer
@@ -2133,14 +2133,14 @@ struct it
 
   /* Number of characters in the string (s, or it->string) we iterate
      over.  */
-  EMACS_INT string_nchars;
+  ptrdiff_t string_nchars;
 
   /* Start and end of a visible region; -1 if the region is not
      visible in the window.  */
-  EMACS_INT region_beg_charpos, region_end_charpos;
+  ptrdiff_t region_beg_charpos, region_end_charpos;
 
   /* Position at which redisplay end trigger functions should be run.  */
-  EMACS_INT redisplay_end_trigger_charpos;
+  ptrdiff_t redisplay_end_trigger_charpos;
 
   /* 1 means multibyte characters are enabled.  */
   unsigned multibyte_p : 1;
@@ -2213,13 +2213,13 @@ struct it
      whether an overlay string is being iterated over, because
      n_overlay_strings can be positive even when we are not rendering
      an overlay string.  */
-  int n_overlay_strings;
+  ptrdiff_t n_overlay_strings;
 
   /* The charpos where n_overlay_strings was calculated.  This should
      be set at the same time as n_overlay_strings.  It is needed
      because we show before-strings at the start of invisible text;
      see handle_invisible_prop in xdisp.c.  */
-  EMACS_INT overlay_strings_charpos;
+  ptrdiff_t overlay_strings_charpos;
 
   /* Vector of overlays to process.  Overlay strings are processed
      OVERLAY_STRING_CHUNK_SIZE at a time.  */
@@ -2231,8 +2231,8 @@ struct it
 
   /* If non-nil, a Lisp string being processed.  If
      current.overlay_string_index >= 0, this is an overlay string from
-     pos.  Use STRINGP(it.string) as a test for whether we are
-     rendering a string or something else; do NOT use BUFFERP(it.object).  */
+     pos.  Use STRINGP (it.string) to test whether we are rendering a
+     string or something else; do NOT use BUFFERP (it.object).  */
   Lisp_Object string;
 
   /* If non-nil, we are processing a string that came
@@ -2247,10 +2247,10 @@ struct it
   {
     Lisp_Object string;
     int string_nchars;
-    EMACS_INT end_charpos;
-    EMACS_INT stop_charpos;
-    EMACS_INT prev_stop;
-    EMACS_INT base_level_stop;
+    ptrdiff_t end_charpos;
+    ptrdiff_t stop_charpos;
+    ptrdiff_t prev_stop;
+    ptrdiff_t base_level_stop;
     struct composition_it cmp_it;
     int face_id;
 
@@ -2300,7 +2300,7 @@ struct it
 
   /* -1 means selective display hides everything between a \r and the
      next newline; > 0 means hide lines indented more than that value.  */
-  EMACS_INT selective;
+  ptrdiff_t selective;
 
   /* An enumeration describing what the next display element is
      after a call to get_next_display_element.  */
@@ -2773,7 +2773,7 @@ struct image
 {
   /* The time in seconds at which the image was last displayed.  Set
      in prepare_image_for_display.  */
-  time_t timestamp;
+  EMACS_TIME timestamp;
 
   /* Pixmaps of the image.  */
   Pixmap pixmap, mask;
@@ -2987,8 +2987,7 @@ enum tool_bar_item_image
 #define TTY_CAP_UNDERLINE      0x02
 #define TTY_CAP_BOLD           0x04
 #define TTY_CAP_DIM            0x08
-#define TTY_CAP_BLINK          0x10
-#define TTY_CAP_ALT_CHARSET    0x20
+#define TTY_CAP_ITALIC         0x10
 
 \f
 /***********************************************************************
@@ -2997,7 +2996,7 @@ enum tool_bar_item_image
 
 /* Defined in bidi.c */
 
-extern void bidi_init_it (EMACS_INT, EMACS_INT, int, struct bidi_it *);
+extern void bidi_init_it (ptrdiff_t, ptrdiff_t, int, struct bidi_it *);
 extern void bidi_move_to_visually_next (struct bidi_it *);
 extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int);
 extern int  bidi_mirror_char (int);
@@ -3008,11 +3007,11 @@ extern void bidi_unshelve_cache (void *, int);
 
 /* Defined in xdisp.c */
 
-struct glyph_row *row_containing_pos (struct window *, EMACS_INT,
+struct glyph_row *row_containing_pos (struct window *, ptrdiff_t,
                                       struct glyph_row *,
                                       struct glyph_row *, int);
 int line_bottom_y (struct it *);
-int display_prop_intangible_p (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT);
+int display_prop_intangible_p (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t);
 void resize_echo_area_exactly (void);
 int resize_mini_window (struct window *, int);
 #if defined USE_TOOLKIT_SCROLL_BARS && !defined USE_GTK
@@ -3034,18 +3033,18 @@ void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *);
 
 void mark_window_display_accurate (Lisp_Object, int);
 void redisplay_preserve_echo_area (int);
-void init_iterator (struct it *, struct window *, EMACS_INT,
-                    EMACS_INT, struct glyph_row *, enum face_id);
+void init_iterator (struct it *, struct window *, ptrdiff_t,
+                    ptrdiff_t, struct glyph_row *, enum face_id);
 void init_iterator_to_row_start (struct it *, struct window *,
                                  struct glyph_row *);
 void start_display (struct it *, struct window *, struct text_pos);
-void move_it_to (struct it *, EMACS_INT, int, int, int, int);
+void move_it_to (struct it *, ptrdiff_t, int, int, int, int);
 void move_it_vertically (struct it *, int);
 void move_it_vertically_backward (struct it *, int);
-void move_it_by_lines (struct it *, int);
+void move_it_by_lines (struct it *, ptrdiff_t);
 void move_it_past_eol (struct it *);
 void move_it_in_display_line (struct it *it,
-                             EMACS_INT to_charpos, int to_x,
+                             ptrdiff_t to_charpos, int to_x,
                              enum move_operation_enum op);
 int in_display_vector_p (struct it *);
 int frame_mode_line_height (struct frame *);
@@ -3055,22 +3054,21 @@ extern int help_echo_showing_p;
 extern int current_mode_line_height, current_header_line_height;
 extern Lisp_Object help_echo_string, help_echo_window;
 extern Lisp_Object help_echo_object, previous_help_echo_string;
-extern EMACS_INT help_echo_pos;
+extern ptrdiff_t help_echo_pos;
 extern struct frame *last_mouse_frame;
 extern int last_tool_bar_item;
 extern void reseat_at_previous_visible_line_start (struct it *);
 extern Lisp_Object lookup_glyphless_char_display (int, struct it *);
-extern EMACS_INT compute_display_string_pos (struct text_pos *,
+extern ptrdiff_t compute_display_string_pos (struct text_pos *,
                                             struct bidi_string_data *,
                                             int, int *);
-extern EMACS_INT compute_display_string_end (EMACS_INT,
+extern ptrdiff_t compute_display_string_end (ptrdiff_t,
                                             struct bidi_string_data *);
 extern void produce_stretch_glyph (struct it *);
 
-
 #ifdef HAVE_WINDOW_SYSTEM
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 extern void dump_glyph_string (struct glyph_string *) EXTERNALLY_VISIBLE;
 #endif
 
@@ -3109,7 +3107,7 @@ extern void get_glyph_string_clip_rect (struct glyph_string *,
 extern Lisp_Object find_hot_spot (Lisp_Object, int, int);
 
 extern void handle_tool_bar_click (struct frame *,
-                                   int, int, int, unsigned int);
+                                   int, int, int, int);
 
 extern void expose_frame (struct frame *, int, int, int, int);
 extern int x_intersect_rectangles (XRectangle *, XRectangle *,
@@ -3206,7 +3204,6 @@ void unload_color (struct frame *, unsigned long);
 char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
                         int *);
 void prepare_face_for_display (struct frame *, struct face *);
-int xstrcasecmp (const char *, const char *);
 int lookup_named_face (struct frame *, Lisp_Object, int);
 int lookup_basic_face (struct frame *, int);
 int smaller_face (struct frame *, int, int);
@@ -3215,19 +3212,19 @@ int lookup_derived_face (struct frame *, Lisp_Object, int, int);
 void init_frame_faces (struct frame *);
 void free_frame_faces (struct frame *);
 void recompute_basic_faces (struct frame *);
-int face_at_buffer_position (struct window *w, EMACS_INT pos,
-                             EMACS_INT region_beg, EMACS_INT region_end,
-                             EMACS_INT *endptr, EMACS_INT limit,
+int face_at_buffer_position (struct window *w, ptrdiff_t pos,
+                             ptrdiff_t region_beg, ptrdiff_t region_end,
+                             ptrdiff_t *endptr, ptrdiff_t limit,
                              int mouse, int base_face_id);
-int face_for_overlay_string (struct window *w, EMACS_INT pos,
-                             EMACS_INT region_beg, EMACS_INT region_end,
-                             EMACS_INT *endptr, EMACS_INT limit,
+int face_for_overlay_string (struct window *w, ptrdiff_t pos,
+                             ptrdiff_t region_beg, ptrdiff_t region_end,
+                             ptrdiff_t *endptr, ptrdiff_t limit,
                              int mouse, Lisp_Object overlay);
 int face_at_string_position (struct window *w, Lisp_Object string,
-                             EMACS_INT pos, EMACS_INT bufpos,
-                             EMACS_INT region_beg, EMACS_INT region_end,
-                             EMACS_INT *endptr, enum face_id, int mouse);
-int merge_faces (struct frame *, Lisp_Object, EMACS_INT, int);
+                             ptrdiff_t pos, ptrdiff_t bufpos,
+                             ptrdiff_t region_beg, ptrdiff_t region_end,
+                             ptrdiff_t *endptr, enum face_id, int mouse);
+int merge_faces (struct frame *, Lisp_Object, int, int);
 int compute_char_face (struct frame *, int, Lisp_Object);
 void free_all_realized_faces (Lisp_Object);
 extern Lisp_Object Qforeground_color, Qbackground_color;
@@ -3248,10 +3245,8 @@ void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
 
 extern Lisp_Object tip_frame;
 extern Window tip_window;
-EXFUN (Fx_hide_tip, 0);
 extern void start_hourglass (void);
 extern void cancel_hourglass (void);
-extern int hourglass_started (void);
 extern int hourglass_shown_p;
 struct atimer;                 /* Defined in atimer.h.  */
 /* If non-null, an asynchronous timer that, when it expires, displays
@@ -3293,11 +3288,11 @@ extern Lisp_Object buffer_posn_from_coords (struct window *,
                                             Lisp_Object *,
                                             int *, int *, int *, int *);
 extern Lisp_Object mode_line_string (struct window *, enum window_part,
-                                     int *, int *, EMACS_INT *,
+                                     int *, int *, ptrdiff_t *,
                                      Lisp_Object *,
                                      int *, int *, int *, int *);
 extern Lisp_Object marginal_area_string (struct window *, enum window_part,
-                                         int *, int *, EMACS_INT *,
+                                         int *, int *, ptrdiff_t *,
                                          Lisp_Object *,
                                          int *, int *, int *, int *);
 extern void redraw_frame (struct frame *);
@@ -3317,7 +3312,7 @@ void shift_glyph_matrix (struct window *, struct glyph_matrix *,
                          int, int, int);
 void rotate_matrix (struct glyph_matrix *, int, int, int);
 void increment_matrix_positions (struct glyph_matrix *,
-                                 int, int, EMACS_INT, EMACS_INT);
+                                 int, int, ptrdiff_t, ptrdiff_t);
 void blank_row (struct window *, struct glyph_row *, int);
 void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int);
 void clear_glyph_row (struct glyph_row *);
@@ -3357,12 +3352,9 @@ extern int string_cost (const char *);
 extern int per_line_cost (const char *);
 extern void calculate_costs (struct frame *);
 extern void produce_glyphs (struct it *);
-extern void produce_special_glyphs (struct it *, enum display_element_type);
 extern int tty_capable_p (struct tty_display_info *, unsigned, unsigned long, unsigned long);
 extern void set_tty_color_mode (struct tty_display_info *, struct frame *);
 extern struct terminal *get_named_tty (const char *);
-EXFUN (Ftty_type, 1);
-EXFUN (Fcontrolling_tty_p, 1);
 extern void create_tty_output (struct frame *);
 extern struct terminal *init_tty (const char *, const char *, int);
 extern void tty_append_glyph (struct it *);
index b313852efe286967f6ae8946bbb41945a60b423d..c149baec5071cc918bd34ac119b9e57e07a27ab6 100644 (file)
@@ -1,5 +1,6 @@
 /* Updating of data structures for redisplay.
-   Copyright (C) 1985-1988, 1993-1995, 1997-2012 Free Software Foundation, Inc.
+
+Copyright (C) 1985-1988, 1993-1995, 1997-2012 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -29,8 +30,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* cm.h must come after dispextern.h on Windows.  */
 #include "dispextern.h"
 #include "cm.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "keyboard.h"
 #include "frame.h"
 #include "termhooks.h"
@@ -64,30 +65,31 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Get number of chars of output now in the buffer of a stdio stream.
    This ought to be built in stdio, but it isn't.  Some s- files
    override this because their stdio internals differ.  */
-
 #ifdef __GNU_LIBRARY__
 
 /* The s- file might have overridden the definition with one that
    works for the system's C library.  But we are using the GNU C
    library, so this is the right definition for every system.  */
-
 #ifdef GNU_LIBRARY_PENDING_OUTPUT_COUNT
 #define PENDING_OUTPUT_COUNT GNU_LIBRARY_PENDING_OUTPUT_COUNT
 #else
 #undef PENDING_OUTPUT_COUNT
 #define        PENDING_OUTPUT_COUNT(FILE) ((FILE)->__bufp - (FILE)->__buffer)
 #endif
-#else /* not __GNU_LIBRARY__ */
-#if !defined (PENDING_OUTPUT_COUNT) && HAVE_STDIO_EXT_H && HAVE___FPENDING
+
+/* not __GNU_LIBRARY__ and no PENDING_OUTPUT_COUNT defined  */
+#elif !defined (PENDING_OUTPUT_COUNT)
+
+#if HAVE_STDIO_EXT_H && HAVE___FPENDING
 #include <stdio_ext.h>
 #define PENDING_OUTPUT_COUNT(FILE) __fpending (FILE)
-#endif
-#ifndef PENDING_OUTPUT_COUNT
+#else
 #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base)
 #endif
-#endif /* not __GNU_LIBRARY__ */
 
-#if defined (HAVE_TERM_H) && defined (GNU_LINUX) && defined (HAVE_LIBNCURSES)
+#endif /* not __GNU_LIBRARY__ and no PENDING_OUTPUT_COUNT defined */
+
+#if defined (HAVE_TERM_H) && defined (GNU_LINUX)
 #include <term.h>              /* for tgetent */
 #endif
 \f
@@ -108,7 +110,7 @@ static int required_matrix_height (struct window *);
 static int required_matrix_width (struct window *);
 static void adjust_frame_glyphs (struct frame *);
 static void change_frame_size_1 (struct frame *, int, int, int, int, int);
-static void increment_row_positions (struct glyph_row *, EMACS_INT, EMACS_INT);
+static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t);
 static void fill_up_frame_row_with_spaces (struct glyph_row *, int);
 static void build_frame_matrix_from_window_tree (struct glyph_matrix *,
                                                  struct window *);
@@ -122,7 +124,7 @@ static void fill_up_glyph_row_area_with_spaces (struct glyph_row *, int);
 static int scrolling_window (struct window *, int);
 static int update_window_line (struct window *, int, int *);
 static void mirror_make_current (struct window *, int);
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 static void check_matrix_pointers (struct glyph_matrix *,
                                    struct glyph_matrix *);
 #endif
@@ -136,24 +138,11 @@ static void adjust_frame_glyphs_for_window_redisplay (struct frame *);
 static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
 
 \f
-/* Define PERIODIC_PREEMPTION_CHECKING to 1, if micro-second timers
-   are supported, so we can check for input during redisplay at
-   regular intervals.  */
-#ifdef EMACS_HAS_USECS
-#define PERIODIC_PREEMPTION_CHECKING 1
-#else
-#define PERIODIC_PREEMPTION_CHECKING 0
-#endif
-
-#if PERIODIC_PREEMPTION_CHECKING
-
 /* Redisplay preemption timers.  */
 
 static EMACS_TIME preemption_period;
 static EMACS_TIME preemption_next_check;
 
-#endif
-
 /* Nonzero upon entry to redisplay means do not assume anything about
    current contents of actual terminal frame; clear and redraw it.  */
 
@@ -223,7 +212,7 @@ int fonts_changed_p;
 /* Convert vpos and hpos from frame to window and vice versa.
    This may only be used for terminal frames.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 static int window_to_frame_vpos (struct window *, int);
 static int window_to_frame_hpos (struct window *, int);
@@ -323,19 +312,21 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history,
 }
 
 
-#else /* GLYPH_DEBUG == 0 */
+#else /* not GLYPH_DEBUG */
 
 #define WINDOW_TO_FRAME_VPOS(W, VPOS) ((VPOS) + WINDOW_TOP_EDGE_LINE (W))
 #define WINDOW_TO_FRAME_HPOS(W, HPOS) ((HPOS) + WINDOW_LEFT_EDGE_COL (W))
 
-#endif /* GLYPH_DEBUG == 0 */
-
+#endif /* GLYPH_DEBUG */
 
-#if defined PROFILING && !HAVE___EXECUTABLE_START
-/* FIXME: only used to find text start for profiling.  */
 
+#if (defined PROFILING \
+     && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__) \
+     && !HAVE___EXECUTABLE_START)
+/* This function comes first in the Emacs executable and is used only
+   to estimate the text start for profiling.  */
 void
-safe_bcopy (const char *from, char *to, int size)
+__executable_start (void)
 {
   abort ();
 }
@@ -354,11 +345,7 @@ safe_bcopy (const char *from, char *to, int size)
 static struct glyph_matrix *
 new_glyph_matrix (struct glyph_pool *pool)
 {
-  struct glyph_matrix *result;
-
-  /* Allocate and clear.  */
-  result = (struct glyph_matrix *) xmalloc (sizeof *result);
-  memset (result, 0, sizeof *result);
+  struct glyph_matrix *result = xzalloc (sizeof *result);
 
   /* Increment number of allocated matrices.  This count is used
      to detect memory leaks.  */
@@ -429,14 +416,14 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin
   return n;
 }
 
-#if XASSERTS
-/* Return non-zero if ROW's hash value is correct, zero if not.  */
-int
+/* Return non-zero if ROW's hash value is correct, zero if not.
+   Optimized away if ENABLE_CHECKING is not defined.  */
+
+static int
 verify_row_hash (struct glyph_row *row)
 {
   return row->hash == row_hash (row);
 }
-#endif
 
 /* Adjust glyph matrix MATRIX on window W or on a frame to changed
    window sizes.
@@ -490,7 +477,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
     {
       left = margin_glyphs_to_reserve (w, dim.width, w->left_margin_cols);
       right = margin_glyphs_to_reserve (w, dim.width, w->right_margin_cols);
-      xassert (left >= 0 && right >= 0);
+      eassert (left >= 0 && right >= 0);
       marginal_areas_changed_p = (left != matrix->left_margin_glyphs
                                  || right != matrix->right_margin_glyphs);
 
@@ -523,7 +510,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
      each row into the glyph pool.  */
   if (matrix->pool)
     {
-      xassert (matrix->pool->glyphs);
+      eassert (matrix->pool->glyphs);
 
       if (w)
        {
@@ -612,14 +599,14 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
            }
        }
 
-      xassert (left >= 0 && right >= 0);
+      eassert (left >= 0 && right >= 0);
       matrix->left_margin_glyphs = left;
       matrix->right_margin_glyphs = right;
     }
 
   /* Number of rows to be used by MATRIX.  */
   matrix->nrows = dim.height;
-  xassert (matrix->nrows >= 0);
+  eassert (matrix->nrows >= 0);
 
   if (w)
     {
@@ -758,12 +745,12 @@ rotate_matrix (struct glyph_matrix *matrix, int first, int last, int by)
 
 void
 increment_matrix_positions (struct glyph_matrix *matrix, int start, int end,
-                           EMACS_INT delta, EMACS_INT delta_bytes)
+                           ptrdiff_t delta, ptrdiff_t delta_bytes)
 {
   /* Check that START and END are reasonable values.  */
-  xassert (start >= 0 && start <= matrix->nrows);
-  xassert (end >= 0 && end <= matrix->nrows);
-  xassert (start <= end);
+  eassert (start >= 0 && start <= matrix->nrows);
+  eassert (end >= 0 && end <= matrix->nrows);
+  eassert (start <= end);
 
   for (; start < end; ++start)
     increment_row_positions (matrix->rows + start, delta, delta_bytes);
@@ -777,9 +764,9 @@ increment_matrix_positions (struct glyph_matrix *matrix, int start, int end,
 void
 enable_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end, int enabled_p)
 {
-  xassert (start <= end);
-  xassert (start >= 0 && start < matrix->nrows);
-  xassert (end >= 0 && end <= matrix->nrows);
+  eassert (start <= end);
+  eassert (start >= 0 && start < matrix->nrows);
+  eassert (end >= 0 && end <= matrix->nrows);
 
   for (; start < end; ++start)
     matrix->rows[start].enabled_p = enabled_p != 0;
@@ -816,9 +803,9 @@ shift_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int start, in
 {
   int min_y, max_y;
 
-  xassert (start <= end);
-  xassert (start >= 0 && start < matrix->nrows);
-  xassert (end >= 0 && end <= matrix->nrows);
+  eassert (start <= end);
+  eassert (start >= 0 && start < matrix->nrows);
+  eassert (end >= 0 && end <= matrix->nrows);
 
   min_y = WINDOW_HEADER_LINE_HEIGHT (w);
   max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (w);
@@ -862,7 +849,7 @@ clear_current_matrices (register struct frame *f)
     clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
 
   /* Clear current window matrices.  */
-  xassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
+  eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
   clear_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (f)), 0);
 }
 
@@ -882,7 +869,7 @@ clear_desired_matrices (register struct frame *f)
     clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix);
 
   /* Do it for window matrices.  */
-  xassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
+  eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
   clear_window_matrices (XWINDOW (FRAME_ROOT_WINDOW (f)), 1);
 }
 
@@ -897,12 +884,12 @@ clear_window_matrices (struct window *w, int desired_p)
     {
       if (!NILP (w->hchild))
        {
-         xassert (WINDOWP (w->hchild));
+         eassert (WINDOWP (w->hchild));
          clear_window_matrices (XWINDOW (w->hchild), desired_p);
        }
       else if (!NILP (w->vchild))
        {
-         xassert (WINDOWP (w->vchild));
+         eassert (WINDOWP (w->vchild));
          clear_window_matrices (XWINDOW (w->vchild), desired_p);
        }
       else
@@ -1000,7 +987,7 @@ blank_row (struct window *w, struct glyph_row *row, int y)
 
 static void
 increment_row_positions (struct glyph_row *row,
-                        EMACS_INT delta, EMACS_INT delta_bytes)
+                        ptrdiff_t delta, ptrdiff_t delta_bytes)
 {
   int area, i;
 
@@ -1146,7 +1133,7 @@ assign_row (struct glyph_row *to, struct glyph_row *from)
    is non-zero if the glyph memory of WINDOW_ROW is part of the glyph
    memory of FRAME_ROW.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 static int
 glyph_row_slice_p (struct glyph_row *window_row, struct glyph_row *frame_row)
@@ -1173,7 +1160,7 @@ find_glyph_row_slice (struct glyph_matrix *window_matrix,
 {
   int i;
 
-  xassert (row >= 0 && row < frame_matrix->nrows);
+  eassert (row >= 0 && row < frame_matrix->nrows);
 
   for (i = 0; i < window_matrix->nrows; ++i)
     if (glyph_row_slice_p (window_matrix->rows + i,
@@ -1301,8 +1288,8 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
 static inline int
 row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
 {
-  xassert (verify_row_hash (a));
-  xassert (verify_row_hash (b));
+  eassert (verify_row_hash (a));
+  eassert (verify_row_hash (b));
 
   if (a == b)
     return 1;
@@ -1377,11 +1364,7 @@ row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
 static struct glyph_pool *
 new_glyph_pool (void)
 {
-  struct glyph_pool *result;
-
-  /* Allocate a new glyph_pool and clear it.  */
-  result = (struct glyph_pool *) xmalloc (sizeof *result);
-  memset (result, 0, sizeof *result);
+  struct glyph_pool *result = xzalloc (sizeof *result);
 
   /* For memory leak and double deletion checking.  */
   ++glyph_pool_count;
@@ -1404,7 +1387,7 @@ free_glyph_pool (struct glyph_pool *pool)
     {
       /* More freed than allocated?  */
       --glyph_pool_count;
-      xassert (glyph_pool_count >= 0);
+      eassert (glyph_pool_count >= 0);
 
       xfree (pool->glyphs);
       xfree (pool);
@@ -1461,7 +1444,7 @@ realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
                              Debug Code
  ***********************************************************************/
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 
 /* Flush standard output.  This is sometimes useful to call from the debugger.
@@ -1490,7 +1473,7 @@ check_matrix_pointer_lossage (struct glyph_matrix *matrix)
 
   for (i = 0; i < matrix->nrows; ++i)
     for (j = 0; j < matrix->nrows; ++j)
-      xassert (i == j
+      eassert (i == j
               || (matrix->rows[i].glyphs[TEXT_AREA]
                   != matrix->rows[j].glyphs[TEXT_AREA]));
 }
@@ -1501,8 +1484,8 @@ check_matrix_pointer_lossage (struct glyph_matrix *matrix)
 struct glyph_row *
 matrix_row (struct glyph_matrix *matrix, int row)
 {
-  xassert (matrix && matrix->rows);
-  xassert (row >= 0 && row < matrix->nrows);
+  eassert (matrix && matrix->rows);
+  eassert (row >= 0 && row < matrix->nrows);
 
   /* That's really too slow for normal testing because this function
      is called almost everywhere.  Although---it's still astonishingly
@@ -1549,9 +1532,9 @@ check_matrix_invariants (struct window *w)
        last_text_row = row;
 
       /* Check that character and byte positions are in sync.  */
-      xassert (MATRIX_ROW_START_BYTEPOS (row)
+      eassert (MATRIX_ROW_START_BYTEPOS (row)
               == CHAR_TO_BYTE (MATRIX_ROW_START_CHARPOS (row)));
-      xassert (BYTEPOS (row->start.pos)
+      eassert (BYTEPOS (row->start.pos)
               == CHAR_TO_BYTE (CHARPOS (row->start.pos)));
 
       /* CHAR_TO_BYTE aborts when invoked for a position > Z.  We can
@@ -1559,9 +1542,9 @@ check_matrix_invariants (struct window *w)
         displaying something like `[Sole completion]' at its end.  */
       if (MATRIX_ROW_END_CHARPOS (row) < BUF_ZV (current_buffer))
        {
-         xassert (MATRIX_ROW_END_BYTEPOS (row)
+         eassert (MATRIX_ROW_END_BYTEPOS (row)
                   == CHAR_TO_BYTE (MATRIX_ROW_END_CHARPOS (row)));
-         xassert (BYTEPOS (row->end.pos)
+         eassert (BYTEPOS (row->end.pos)
                   == CHAR_TO_BYTE (CHARPOS (row->end.pos)));
        }
 
@@ -1569,24 +1552,24 @@ check_matrix_invariants (struct window *w)
         of next row.  */
       if (next->enabled_p && MATRIX_ROW_DISPLAYS_TEXT_P (next))
        {
-         xassert (MATRIX_ROW_END_CHARPOS (row)
+         eassert (MATRIX_ROW_END_CHARPOS (row)
                   == MATRIX_ROW_START_CHARPOS (next));
-         xassert (MATRIX_ROW_END_BYTEPOS (row)
+         eassert (MATRIX_ROW_END_BYTEPOS (row)
                   == MATRIX_ROW_START_BYTEPOS (next));
-         xassert (CHARPOS (row->end.pos) == CHARPOS (next->start.pos));
-         xassert (BYTEPOS (row->end.pos) == BYTEPOS (next->start.pos));
+         eassert (CHARPOS (row->end.pos) == CHARPOS (next->start.pos));
+         eassert (BYTEPOS (row->end.pos) == BYTEPOS (next->start.pos));
        }
       row = next;
     }
 
-  xassert (w->current_matrix->nrows == w->desired_matrix->nrows);
-  xassert (w->desired_matrix->rows != NULL);
+  eassert (w->current_matrix->nrows == w->desired_matrix->nrows);
+  eassert (w->desired_matrix->rows != NULL);
   set_buffer_temp (saved);
 }
 
 #endif /* 0  */
 
-#endif /* GLYPH_DEBUG != 0 */
+#endif /* GLYPH_DEBUG */
 
 
 \f
@@ -2007,15 +1990,15 @@ fake_current_matrices (Lisp_Object window)
          struct glyph_matrix *m = w->current_matrix;
          struct glyph_matrix *fm = f->current_matrix;
 
-         xassert (m->matrix_h == WINDOW_TOTAL_LINES (w));
-         xassert (m->matrix_w == WINDOW_TOTAL_COLS (w));
+         eassert (m->matrix_h == WINDOW_TOTAL_LINES (w));
+         eassert (m->matrix_w == WINDOW_TOTAL_COLS (w));
 
          for (i = 0; i < m->matrix_h; ++i)
            {
              struct glyph_row *r = m->rows + i;
              struct glyph_row *fr = fm->rows + i + WINDOW_TOP_EDGE_LINE (w);
 
-             xassert (r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA]
+             eassert (r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA]
                       && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]);
 
              r->enabled_p = fr->enabled_p;
@@ -2041,21 +2024,16 @@ static struct glyph_matrix *
 save_current_matrix (struct frame *f)
 {
   int i;
-  struct glyph_matrix *saved;
-
-  saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
-  memset (saved, 0, sizeof *saved);
+  struct glyph_matrix *saved = xzalloc (sizeof *saved);
   saved->nrows = f->current_matrix->nrows;
-  saved->rows = (struct glyph_row *) xmalloc (saved->nrows
-                                             * sizeof *saved->rows);
-  memset (saved->rows, 0, saved->nrows * sizeof *saved->rows);
+  saved->rows = xzalloc (saved->nrows * sizeof *saved->rows);
 
   for (i = 0; i < saved->nrows; ++i)
     {
       struct glyph_row *from = f->current_matrix->rows + i;
       struct glyph_row *to = saved->rows + i;
       ptrdiff_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
-      to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
+      to->glyphs[TEXT_AREA] = xmalloc (nbytes);
       memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
       to->used[TEXT_AREA] = from->used[TEXT_AREA];
     }
@@ -2150,7 +2128,7 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
       /* Size of frame matrices must equal size of frame.  Note
         that we are called for X frames with window widths NOT equal
         to the frame width (from CHANGE_FRAME_SIZE_1).  */
-      xassert (matrix_dim.width == FRAME_COLS (f)
+      eassert (matrix_dim.width == FRAME_COLS (f)
               && matrix_dim.height == FRAME_LINES (f));
 
       /* Pointers to glyph memory in glyph rows are exchanged during
@@ -2194,7 +2172,7 @@ adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
 static void
 adjust_frame_glyphs_for_window_redisplay (struct frame *f)
 {
-  xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));
+  eassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));
 
   /* Allocate/reallocate window matrices.  */
   allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f)));
@@ -2264,16 +2242,8 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
 static void
 adjust_frame_message_buffer (struct frame *f)
 {
-  ptrdiff_t size = FRAME_MESSAGE_BUF_SIZE (f) + 1;
-
-  if (FRAME_MESSAGE_BUF (f))
-    {
-      char *buffer = FRAME_MESSAGE_BUF (f);
-      char *new_buffer = (char *) xrealloc (buffer, size);
-      FRAME_MESSAGE_BUF (f) = new_buffer;
-    }
-  else
-    FRAME_MESSAGE_BUF (f) = (char *) xmalloc (size);
+  FRAME_MESSAGE_BUF (f) = xrealloc (FRAME_MESSAGE_BUF (f),
+                                   FRAME_MESSAGE_BUF_SIZE (f) + 1);
 }
 
 
@@ -2282,9 +2252,8 @@ adjust_frame_message_buffer (struct frame *f)
 static void
 adjust_decode_mode_spec_buffer (struct frame *f)
 {
-  f->decode_mode_spec_buffer
-    = (char *) xrealloc (f->decode_mode_spec_buffer,
-                        FRAME_MESSAGE_BUF_SIZE (f) + 1);
+  f->decode_mode_spec_buffer = xrealloc (f->decode_mode_spec_buffer,
+                                        FRAME_MESSAGE_BUF_SIZE (f) + 1);
 }
 
 
@@ -2479,7 +2448,7 @@ build_frame_matrix (struct frame *f)
   int i;
 
   /* F must have a frame matrix when this function is called.  */
-  xassert (!FRAME_WINDOW_P (f));
+  eassert (!FRAME_WINDOW_P (f));
 
   /* Clear all rows in the frame matrix covered by window matrices.
      Menu bar lines are not covered by windows.  */
@@ -2546,8 +2515,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
 
          SET_GLYPH_FROM_CHAR (right_border_glyph, '|');
          if (dp
-             && (gc = DISP_BORDER_GLYPH (dp), GLYPH_CODE_P (gc))
-             && GLYPH_CODE_CHAR_VALID_P (gc))
+             && (gc = DISP_BORDER_GLYPH (dp), GLYPH_CODE_P (gc)))
            {
              SET_GLYPH_FROM_GLYPH_CODE (right_border_glyph, gc);
              spec_glyph_lookup_face (w, &right_border_glyph);
@@ -2596,7 +2564,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
        }
       else
        {
-         xassert (window_row->enabled_p);
+         eassert (window_row->enabled_p);
 
          /* Only when a desired row has been displayed, we want
             the corresponding frame row to be updated.  */
@@ -2610,10 +2578,10 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
              SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph);
            }
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
          /* Window row window_y must be a slice of frame row
             frame_y.  */
-         xassert (glyph_row_slice_p (window_row, frame_row));
+         eassert (glyph_row_slice_p (window_row, frame_row));
 
          /* If rows are in sync, we don't have to copy glyphs because
             frame and window share glyphs.  */
@@ -2832,7 +2800,7 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
   int i;
 
   /* Make a copy of the original rows.  */
-  old_rows = (struct glyph_row *) alloca (nlines * sizeof *old_rows);
+  old_rows = alloca (nlines * sizeof *old_rows);
   memcpy (old_rows, new_rows, nlines * sizeof *old_rows);
 
   /* Assign new rows, maybe clear lines.  */
@@ -2840,8 +2808,8 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
     {
       int enabled_before_p = new_rows[i].enabled_p;
 
-      xassert (i + unchanged_at_top < matrix->nrows);
-      xassert (unchanged_at_top + copy_from[i] < matrix->nrows);
+      eassert (i + unchanged_at_top < matrix->nrows);
+      eassert (unchanged_at_top + copy_from[i] < matrix->nrows);
       new_rows[i] = old_rows[copy_from[i]];
       new_rows[i].enabled_p = enabled_before_p;
 
@@ -2868,8 +2836,8 @@ sync_window_with_frame_matrix_rows (struct window *w)
   int left, right, x, width;
 
   /* Preconditions: W must be a leaf window on a tty frame.  */
-  xassert (NILP (w->hchild) && NILP (w->vchild));
-  xassert (!FRAME_WINDOW_P (f));
+  eassert (NILP (w->hchild) && NILP (w->vchild));
+  eassert (!FRAME_WINDOW_P (f));
 
   left = margin_glyphs_to_reserve (w, 1, w->left_margin_cols);
   right = margin_glyphs_to_reserve (w, 1, w->right_margin_cols);
@@ -2950,7 +2918,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
          struct glyph_row *old_rows;
 
          /* Make a copy of the original rows of matrix m.  */
-         old_rows = (struct glyph_row *) alloca (m->nrows * sizeof *old_rows);
+         old_rows = alloca (m->nrows * sizeof *old_rows);
          memcpy (old_rows, m->rows, m->nrows * sizeof *old_rows);
 
          for (i = 0; i < nlines; ++i)
@@ -3037,7 +3005,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
 }
 
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 /* Check that window and frame matrices agree about their
    understanding where glyphs of the rows are to find.  For each
@@ -3093,7 +3061,7 @@ check_matrix_pointers (struct glyph_matrix *window_matrix,
     }
 }
 
-#endif /* GLYPH_DEBUG != 0 */
+#endif /* GLYPH_DEBUG */
 
 
 \f
@@ -3101,7 +3069,7 @@ check_matrix_pointers (struct glyph_matrix *window_matrix,
                      VPOS and HPOS translations
  **********************************************************************/
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 /* Translate vertical position VPOS which is relative to window W to a
    vertical position relative to W's frame.  */
@@ -3109,10 +3077,10 @@ check_matrix_pointers (struct glyph_matrix *window_matrix,
 static int
 window_to_frame_vpos (struct window *w, int vpos)
 {
-  xassert (!FRAME_WINDOW_P (XFRAME (w->frame)));
-  xassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
+  eassert (!FRAME_WINDOW_P (XFRAME (w->frame)));
+  eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
   vpos += WINDOW_TOP_EDGE_LINE (w);
-  xassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (w->frame)));
+  eassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (w->frame)));
   return vpos;
 }
 
@@ -3123,7 +3091,7 @@ window_to_frame_vpos (struct window *w, int vpos)
 static int
 window_to_frame_hpos (struct window *w, int hpos)
 {
-  xassert (!FRAME_WINDOW_P (XFRAME (w->frame)));
+  eassert (!FRAME_WINDOW_P (XFRAME (w->frame)));
   hpos += WINDOW_LEFT_EDGE_COL (w);
   return hpos;
 }
@@ -3219,14 +3187,11 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
 
   if (redisplay_dont_pause)
     force_p = 1;
-#if PERIODIC_PREEMPTION_CHECKING
   else if (NILP (Vredisplay_preemption_period))
     force_p = 1;
   else if (!force_p && NUMBERP (Vredisplay_preemption_period))
     {
-      EMACS_TIME tm;
       double p = XFLOATINT (Vredisplay_preemption_period);
-      int sec, usec;
 
       if (detect_input_pending_ignore_squeezables ())
        {
@@ -3234,14 +3199,10 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
          goto do_pause;
        }
 
-      sec = (int) p;
-      usec = (p - sec) * 1000000;
-
-      EMACS_GET_TIME (tm);
-      EMACS_SET_SECS_USECS (preemption_period, sec, usec);
-      EMACS_ADD_TIME (preemption_next_check, tm, preemption_period);
+      preemption_period = EMACS_TIME_FROM_DOUBLE (p);
+      preemption_next_check = add_emacs_time (current_emacs_time (),
+                                             preemption_period);
     }
-#endif
 
   if (FRAME_WINDOW_P (f))
     {
@@ -3319,15 +3280,13 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
         }
 
       /* Check window matrices for lost pointers.  */
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       check_window_matrix_pointers (root_window);
       add_frame_display_history (f, paused_p);
 #endif
     }
 
-#if PERIODIC_PREEMPTION_CHECKING
  do_pause:
-#endif
   /* Reset flags indicating that a window should be updated.  */
   set_window_update_flags (root_window, 0);
 
@@ -3380,23 +3339,15 @@ update_single_window (struct window *w, int force_p)
 
       if (redisplay_dont_pause)
        force_p = 1;
-#if PERIODIC_PREEMPTION_CHECKING
       else if (NILP (Vredisplay_preemption_period))
        force_p = 1;
       else if (!force_p && NUMBERP (Vredisplay_preemption_period))
        {
-         EMACS_TIME tm;
          double p = XFLOATINT (Vredisplay_preemption_period);
-         int sec, usec;
-
-         sec = (int) p;
-         usec = (p - sec) * 1000000;
-
-         EMACS_GET_TIME (tm);
-         EMACS_SET_SECS_USECS (preemption_period, sec, usec);
-         EMACS_ADD_TIME (preemption_next_check, tm, preemption_period);
+         preemption_period = EMACS_TIME_FROM_DOUBLE (p);
+         preemption_next_check = add_emacs_time (current_emacs_time (),
+                                                 preemption_period);
        }
-#endif
 
       /* Update W.  */
       update_begin (f);
@@ -3554,9 +3505,9 @@ update_window (struct window *w, int force_p)
   int preempt_count = baud_rate / 2400 + 1;
 #endif
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   /* Check that W's frame doesn't have glyph matrices.  */
-  xassert (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w))));
+  eassert (FRAME_WINDOW_P (XFRAME (WINDOW_FRAME (w))));
 #endif
 
   /* Check pending input the first time so that we can quickly return.  */
@@ -3642,12 +3593,11 @@ update_window (struct window *w, int force_p)
 #if PERIODIC_PREEMPTION_CHECKING
            if (!force_p)
              {
-               EMACS_TIME tm, dif;
-               EMACS_GET_TIME (tm);
-               EMACS_SUB_TIME (dif, preemption_next_check, tm);
-               if (EMACS_TIME_NEG_P (dif))
+               EMACS_TIME tm = current_emacs_time ();
+               if (EMACS_TIME_LT (preemption_next_check, tm))
                  {
-                   EMACS_ADD_TIME (preemption_next_check, tm, preemption_period);
+                   preemption_next_check = add_emacs_time (tm,
+                                                           preemption_period);
                    if (detect_input_pending_ignore_squeezables ())
                      break;
                  }
@@ -3707,7 +3657,7 @@ update_window (struct window *w, int force_p)
 #endif
        }
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       /* Remember the redisplay method used to display the matrix.  */
       strcpy (w->current_matrix->method, w->desired_matrix->method);
 #endif
@@ -3725,7 +3675,7 @@ update_window (struct window *w, int force_p)
   else
     paused_p = 1;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   /* check_current_matrix_flags (w); */
   add_window_display_history (w, w->current_matrix->method, paused_p);
 #endif
@@ -3956,7 +3906,7 @@ update_text_area (struct window *w, int vpos)
             has to be cleared, if and only if we did a write_glyphs
             above.  This is made sure by setting desired_stop_pos
             appropriately above.  */
-         xassert (i < desired_row->used[TEXT_AREA]
+         eassert (i < desired_row->used[TEXT_AREA]
                   || ((desired_row->used[TEXT_AREA]
                        == current_row->used[TEXT_AREA])
                       && MATRIX_ROW_EXTENDS_FACE_P (current_row)));
@@ -4026,7 +3976,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
   if (desired_row->mode_line_p
       || desired_row->visible_height > 0)
     {
-      xassert (desired_row->enabled_p);
+      eassert (desired_row->enabled_p);
 
       /* Update display of the left margin area, if there is one.  */
       if (!desired_row->full_width_p
@@ -4084,7 +4034,7 @@ set_window_cursor_after_update (struct window *w)
   int cx, cy, vpos, hpos;
 
   /* Not intended for frame matrix updates.  */
-  xassert (FRAME_WINDOW_P (f));
+  eassert (FRAME_WINDOW_P (f));
 
   if (cursor_in_echo_area
       && !NILP (echo_area_buffer[0])
@@ -4244,7 +4194,7 @@ add_row_entry (struct glyph_row *row)
   ptrdiff_t i = row->hash % row_table_size;
 
   entry = row_table[i];
-  xassert (entry || verify_row_hash (row));
+  eassert (entry || verify_row_hash (row));
   while (entry && !row_equal_p (entry->row, row, 1))
     entry = entry->next;
 
@@ -4458,7 +4408,7 @@ scrolling_window (struct window *w, int header_line_p)
 
   for (i = first_new; i < last_new; ++i)
     {
-      xassert (MATRIX_ROW_ENABLED_P (desired_matrix, i));
+      eassert (MATRIX_ROW_ENABLED_P (desired_matrix, i));
       entry = add_row_entry (MATRIX_ROW (desired_matrix, i));
       ++entry->new_uses;
       entry->new_line_number = i;
@@ -4638,7 +4588,7 @@ scrolling_window (struct window *w, int header_line_p)
               row.  But thanks to the truncation code in the
               preceding for-loop, we no longer have such an overlap,
               and thus the assigned row should always be enabled.  */
-           xassert (to->enabled_p);
+           eassert (to->enabled_p);
            from->enabled_p = 0;
            to->overlapped_p = to_overlapped_p;
          }
@@ -4676,7 +4626,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
   int pause_p;
   int preempt_count = baud_rate / 2400 + 1;
 
-  xassert (current_matrix && desired_matrix);
+  eassert (current_matrix && desired_matrix);
 
   if (baud_rate != FRAME_COST_BAUD_RATE (f))
     calculate_costs (f);
@@ -4748,12 +4698,10 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
 #if PERIODIC_PREEMPTION_CHECKING
          if (!force_p)
            {
-             EMACS_TIME tm, dif;
-             EMACS_GET_TIME (tm);
-             EMACS_SUB_TIME (dif, preemption_next_check, tm);
-             if (EMACS_TIME_NEG_P (dif))
+             EMACS_TIME tm = current_emacs_time ();
+             if (EMACS_TIME_LT (preemption_next_check, tm))
                {
-                 EMACS_ADD_TIME (preemption_next_check, tm, preemption_period);
+                 preemption_next_check = add_emacs_time (tm, preemption_period);
                  if (detect_input_pending_ignore_squeezables ())
                    break;
                }
@@ -4883,10 +4831,10 @@ scrolling (struct frame *frame)
   int unchanged_at_top, unchanged_at_bottom;
   int window_size;
   int changed_lines;
-  int *old_hash = (int *) alloca (FRAME_LINES (frame) * sizeof (int));
-  int *new_hash = (int *) alloca (FRAME_LINES (frame) * sizeof (int));
-  int *draw_cost = (int *) alloca (FRAME_LINES (frame) * sizeof (int));
-  int *old_draw_cost = (int *) alloca (FRAME_LINES (frame) * sizeof (int));
+  int *old_hash = alloca (FRAME_LINES (frame) * sizeof (int));
+  int *new_hash = alloca (FRAME_LINES (frame) * sizeof (int));
+  int *draw_cost = alloca (FRAME_LINES (frame) * sizeof (int));
+  int *old_draw_cost = alloca (FRAME_LINES (frame) * sizeof (int));
   register int i;
   int free_at_end_vpos = FRAME_LINES (frame);
   struct glyph_matrix *current_matrix = frame->current_matrix;
@@ -5478,7 +5426,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
 
 Lisp_Object
 mode_line_string (struct window *w, enum window_part part,
-                 int *x, int *y, EMACS_INT *charpos, Lisp_Object *object,
+                 int *x, int *y, ptrdiff_t *charpos, Lisp_Object *object,
                  int *dx, int *dy, int *width, int *height)
 {
   struct glyph_row *row;
@@ -5547,7 +5495,7 @@ mode_line_string (struct window *w, enum window_part part,
 
 Lisp_Object
 marginal_area_string (struct window *w, enum window_part part,
-                     int *x, int *y, EMACS_INT *charpos, Lisp_Object *object,
+                     int *x, int *y, ptrdiff_t *charpos, Lisp_Object *object,
                      int *dx, int *dy, int *width, int *height)
 {
   struct glyph_row *row = w->current_matrix->rows;
@@ -5744,7 +5692,7 @@ static void
 change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
 {
   int new_frame_total_cols;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   /* If we can't deal with the change now, queue it for later.  */
   if (delay || (redisplaying_p && !safe))
@@ -5969,46 +5917,24 @@ DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0,
        doc: /* Pause, without updating display, for SECONDS seconds.
 SECONDS may be a floating-point value, meaning that you can wait for a
 fraction of a second.  Optional second arg MILLISECONDS specifies an
-additional wait period, in milliseconds; this may be useful if your
-Emacs was built without floating point support.
+additional wait period, in milliseconds; this is for backwards compatibility.
 \(Not all operating systems support waiting for a fraction of a second.)  */)
   (Lisp_Object seconds, Lisp_Object milliseconds)
 {
-  int sec, usec;
+  double duration = extract_float (seconds);
 
-  if (NILP (milliseconds))
-    XSETINT (milliseconds, 0);
-  else
-    CHECK_NUMBER (milliseconds);
-  usec = XINT (milliseconds) * 1000;
-
-  {
-    double duration = extract_float (seconds);
-    sec = (int) duration;
-    usec += (duration - sec) * 1000000;
-  }
-
-#ifndef EMACS_HAS_USECS
-  if (sec == 0 && usec != 0)
-    error ("Millisecond `sleep-for' not supported on %s", SYSTEM_TYPE);
-#endif
-
-  /* Assure that 0 <= usec < 1000000.  */
-  if (usec < 0)
+  if (!NILP (milliseconds))
     {
-      /* We can't rely on the rounding being correct if usec is negative.  */
-      if (-1000000 < usec)
-       sec--, usec += 1000000;
-      else
-       sec -= -usec / 1000000, usec = 1000000 - (-usec % 1000000);
+      CHECK_NUMBER (milliseconds);
+      duration += XINT (milliseconds) / 1000.0;
     }
-  else
-    sec += usec / 1000000, usec %= 1000000;
-
-  if (sec < 0 || (sec == 0 && usec == 0))
-    return Qnil;
 
-  wait_reading_process_output (sec, usec, 0, 0, Qnil, NULL, 0);
+  if (0 < duration)
+    {
+      EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (duration);
+      wait_reading_process_output (min (EMACS_SECS (t), WAIT_READING_MAX),
+                                  EMACS_NSECS (t), 0, 0, Qnil, NULL, 0);
+    }
 
   return Qnil;
 }
@@ -6027,7 +5953,8 @@ Emacs was built without floating point support.
 Lisp_Object
 sit_for (Lisp_Object timeout, int reading, int do_display)
 {
-  int sec, usec;
+  intmax_t sec;
+  int nsec;
 
   swallow_events (do_display);
 
@@ -6041,30 +5968,36 @@ sit_for (Lisp_Object timeout, int reading, int do_display)
   if (INTEGERP (timeout))
     {
       sec = XINT (timeout);
-      usec = 0;
+      if (! (0 < sec))
+       return Qt;
+      nsec = 0;
     }
   else if (FLOATP (timeout))
     {
       double seconds = XFLOAT_DATA (timeout);
-      sec = (int) seconds;
-      usec = (int) ((seconds - sec) * 1000000);
+      if (! (0 < seconds))
+       return Qt;
+      else
+       {
+         EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (seconds);
+         sec = min (EMACS_SECS (t), WAIT_READING_MAX);
+         nsec = EMACS_NSECS (t);
+       }
     }
   else if (EQ (timeout, Qt))
     {
       sec = 0;
-      usec = 0;
+      nsec = 0;
     }
   else
     wrong_type_argument (Qnumberp, timeout);
 
-  if (sec == 0 && usec == 0 && !EQ (timeout, Qt))
-    return Qt;
 
 #ifdef SIGIO
   gobble_input (0);
 #endif
 
-  wait_reading_process_output (sec, usec, reading ? -1 : 1, do_display,
+  wait_reading_process_output (sec, nsec, reading ? -1 : 1, do_display,
                               Qnil, NULL, 0);
 
   return detect_input_pending () ? Qnil : Qt;
@@ -6082,7 +6015,7 @@ Return t if redisplay was performed, nil if redisplay was preempted
 immediately by pending input.  */)
   (Lisp_Object force)
 {
-  int count;
+  ptrdiff_t count;
 
   swallow_events (1);
   if ((detect_input_pending_run_timers (1)
@@ -6128,7 +6061,7 @@ pass nil for VARIABLE.  */)
 {
   Lisp_Object state, tail, frame, buf;
   Lisp_Object *vecp, *end;
-  int n;
+  ptrdiff_t n;
 
   if (! NILP (variable))
     {
@@ -6303,7 +6236,7 @@ init_display (void)
 #ifdef HAVE_X11
       Vwindow_system_version = make_number (11);
 #endif
-#if defined (GNU_LINUX) && defined (HAVE_LIBNCURSES)
+#ifdef GNU_LINUX
       /* In some versions of ncurses,
         tputs crashes if we have not called tgetent.
         So call tgetent.  */
@@ -6518,7 +6451,7 @@ syms_of_display (void)
   defsubr (&Sinternal_show_cursor_p);
   defsubr (&Slast_nonminibuf_frame);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   defsubr (&Sdump_redisplay_history);
 #endif
 
index a1e9b40c92a2ccf48e31b4cdb773a5f937ea7f04..44363e30e820a0b8485448352da764b5bccf59a3 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -1,6 +1,6 @@
 /* Record indices of function doc strings stored in a file.
-   Copyright (C) 1985-1986, 1993-1995, 1997-2012
-                 Free Software Foundation, Inc.
+
+Copyright (C) 1985-1986, 1993-1995, 1997-2012 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -28,9 +28,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <unistd.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "keyboard.h"
-#include "character.h"
 #include "keymap.h"
 #include "buildobj.h"
 
@@ -42,9 +42,6 @@ static char *get_doc_string_buffer;
 static ptrdiff_t get_doc_string_buffer_size;
 
 static unsigned char *read_bytecode_pointer;
-static Lisp_Object Fdocumentation_property (Lisp_Object, Lisp_Object,
-                                           Lisp_Object);
-static Lisp_Object Fsnarf_documentation (Lisp_Object);
 
 /* readchar in lread.c calls back here to fetch the next byte.
    If UNREADFLAG is 1, we unread a byte.  */
@@ -86,9 +83,11 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
   register int fd;
   register char *name;
   register char *p, *p1;
-  EMACS_INT minsize;
-  EMACS_INT offset, position;
+  ptrdiff_t minsize;
+  int offset;
+  EMACS_INT position;
   Lisp_Object file, tem;
+  USE_SAFE_ALLOCA;
 
   if (INTEGERP (filepos))
     {
@@ -124,7 +123,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
       /* sizeof ("../etc/") == 8 */
       if (minsize < 8)
        minsize = 8;
-      name = (char *) alloca (minsize + SCHARS (file) + 8);
+      SAFE_ALLOCA (name, char *, minsize + SCHARS (file) + 8);
       strcpy (name, SSDATA (docdir));
       strcat (name, SSDATA (file));
     }
@@ -155,13 +154,16 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition)
   /* Make sure we read at least 1024 bytes before `position'
      so we can check the leading text for consistency.  */
   offset = min (position, max (1024, position % (8 * 1024)));
-  if (0 > lseek (fd, position - offset, 0))
+  if (TYPE_MAXIMUM (off_t) < position
+      || lseek (fd, position - offset, 0) < 0)
     {
       emacs_close (fd);
       error ("Position %"pI"d out of range in doc string file \"%s\"",
             position, name);
     }
 
+  SAFE_FREE ();
+
   /* Read the doc string into get_doc_string_buffer.
      P points beyond the data just read.  */
 
@@ -279,7 +281,7 @@ Invalid data in documentation file -- %c followed by code %03o",
   else
     {
       /* The data determines whether the string is multibyte.  */
-      EMACS_INT nchars =
+      ptrdiff_t nchars =
        multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer
                                  + offset),
                                 to - (get_doc_string_buffer + offset));
@@ -379,7 +381,7 @@ string is passed through `substitute-command-keys'.  */)
     }
   else if (CONSP (fun))
     {
-      funcar = Fcar (fun);
+      funcar = XCAR (fun);
       if (!SYMBOLP (funcar))
        xsignal1 (Qinvalid_function, fun);
       else if (EQ (funcar, Qkeymap))
@@ -502,8 +504,7 @@ aren't strings.  */)
 /* Scanning the DOC files and placing docstring offsets into functions.  */
 
 static void
-store_function_docstring (Lisp_Object obj, EMACS_INT offset)
-/* Use EMACS_INT because we get offset from pointer subtraction.  */
+store_function_docstring (Lisp_Object obj, ptrdiff_t offset)
 {
   /* Don't use indirect_function here, or defaliases will apply their
      docstrings to the base functions (Bug#2603).  */
@@ -560,7 +561,7 @@ the same file name is found in the `doc-directory'.  */)
 {
   int fd;
   char buf[1024 + 1];
-  register EMACS_INT filled;
+  register int filled;
   register EMACS_INT pos;
   register char *p;
   Lisp_Object sym;
@@ -576,14 +577,13 @@ the same file name is found in the `doc-directory'.  */)
       (0)
 #endif /* CANNOT_DUMP */
     {
-      name = (char *) alloca (SCHARS (filename) + 14);
+      name = alloca (SCHARS (filename) + 14);
       strcpy (name, "../etc/");
     }
   else
     {
       CHECK_STRING (Vdoc_directory);
-      name = (char *) alloca (SCHARS (filename)
-                         + SCHARS (Vdoc_directory) + 1);
+      name = alloca (SCHARS (filename) + SCHARS (Vdoc_directory) + 1);
       strcpy (name, SSDATA (Vdoc_directory));
     }
   strcat (name, SSDATA (filename));    /*** Add this line ***/
@@ -595,7 +595,7 @@ the same file name is found in the `doc-directory'.  */)
 
     for (beg = buildobj; *beg; beg = end)
       {
-        EMACS_INT len;
+        ptrdiff_t len;
 
         while (*beg && isspace (*beg)) ++beg;
 
@@ -643,9 +643,9 @@ the same file name is found in the `doc-directory'.  */)
               if (end - p > 4 && end[-2] == '.'
                   && (end[-1] == 'o' || end[-1] == 'c'))
                 {
-                  EMACS_INT len = end - p - 2;
+                  ptrdiff_t len = end - p - 2;
                   char *fromfile = alloca (len + 1);
-                  strncpy (fromfile, &p[2], len);
+                  memcpy (fromfile, &p[2], len);
                   fromfile[len] = 0;
                   if (fromfile[len-1] == 'c')
                     fromfile[len-1] = 'o';
@@ -671,15 +671,18 @@ the same file name is found in the `doc-directory'.  */)
                  /* Install file-position as variable-documentation property
                     and make it negative for a user-variable
                     (doc starts with a `*').  */
-                 Fput (sym, Qvariable_documentation,
-                       make_number ((pos + end + 1 - buf)
-                                    * (end[1] == '*' ? -1 : 1)));
+                  if (!NILP (Fboundp (sym)))
+                    Fput (sym, Qvariable_documentation,
+                          make_number ((pos + end + 1 - buf)
+                                       * (end[1] == '*' ? -1 : 1)));
                }
 
              /* Attach a docstring to a function?  */
              else if (p[1] == 'F')
-               store_function_docstring (sym, pos + end + 1 - buf);
-
+                {
+                  if (!NILP (Ffboundp (sym)))
+                    store_function_docstring (sym, pos + end + 1 - buf);
+                }
              else if (p[1] == 'S')
                ; /* Just a source file name boundary marker.  Ignore it.  */
 
@@ -753,7 +756,7 @@ Otherwise, return a new string, without any text properties.  */)
     keymap = Voverriding_local_map;
 
   bsize = SBYTES (string);
-  bufp = buf = (char *) xmalloc (bsize);
+  bufp = buf = xmalloc (bsize);
 
   strp = SDATA (string);
   while (strp < SDATA (string) + SBYTES (string))
@@ -824,7 +827,7 @@ Otherwise, return a new string, without any text properties.  */)
              ptrdiff_t offset = bufp - buf;
              if (STRING_BYTES_BOUND - 4 < bsize)
                string_overflow ();
-             buf = (char *) xrealloc (buf, bsize += 4);
+             buf = xrealloc (buf, bsize += 4);
              bufp = buf + offset;
              memcpy (bufp, "M-x ", 4);
              bufp += 4;
@@ -890,11 +893,11 @@ Otherwise, return a new string, without any text properties.  */)
          if (NILP (tem))
            {
              name = Fsymbol_name (name);
-             insert_string ("\nUses keymap \"");
+             insert_string ("\nUses keymap `");
              insert_from_string (name, 0, 0,
                                  SCHARS (name),
                                  SBYTES (name), 1);
-             insert_string ("\", which is not currently defined.\n");
+             insert_string ("', which is not currently defined.\n");
              if (start[-1] == '<') keymap = Qnil;
            }
          else if (start[-1] == '<')
@@ -920,7 +923,7 @@ Otherwise, return a new string, without any text properties.  */)
            ptrdiff_t offset = bufp - buf;
            if (STRING_BYTES_BOUND - length_byte < bsize)
              string_overflow ();
-           buf = (char *) xrealloc (buf, bsize += length_byte);
+           buf = xrealloc (buf, bsize += length_byte);
            bufp = buf + offset;
            memcpy (bufp, start, length_byte);
            bufp += length_byte;
index b8eb0f071991f42d000fecff54d5aea7d36c8459..44dc641d5dde0daf384e0f611d749ec60c465b92 100644 (file)
@@ -135,8 +135,8 @@ ptrdiff_t
 doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
        const char *format_end, va_list ap)
 {
-  const char *fmt = format;    /* Pointer into format string */
-  register char *bufptr = buffer; /* Pointer into output buffer.. */
+  const char *fmt = format;    /* Pointer into format string */
+  char *bufptr = buffer;       /* Pointer into output buffer.  */
 
   /* Use this for sprintf unless we need something really big.  */
   char tembuf[DBL_MAX_10_EXP + 100];
@@ -150,7 +150,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
   /* Buffer we have got with malloc.  */
   char *big_buffer = NULL;
 
-  register size_t tem;
+  ptrdiff_t tem = -1;
   char *string;
   char fixed_buffer[20];       /* Default buffer for small formatting. */
   char *fmtcpy;
@@ -174,7 +174,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
       if (*fmt == '%') /* Check for a '%' character */
        {
          ptrdiff_t size_bound = 0;
-         EMACS_INT width;  /* Columns occupied by STRING on display.  */
+         ptrdiff_t width;  /* Columns occupied by STRING on display.  */
          enum {
            pDlen = sizeof pD - 1,
            pIlen = sizeof pI - 1,
@@ -257,7 +257,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
            {
              if (big_buffer)
                xfree (big_buffer);
-             big_buffer = (char *) xmalloc (size_bound);
+             big_buffer = xmalloc (size_bound);
              sprintf_buffer = big_buffer;
              size_allocated = size_bound;
            }
@@ -275,32 +275,32 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
                case no_modifier:
                  {
                    int v = va_arg (ap, int);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                case long_modifier:
                  {
                    long v = va_arg (ap, long);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                case pD_modifier:
                signed_pD_modifier:
                  {
                    ptrdiff_t v = va_arg (ap, ptrdiff_t);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                case pI_modifier:
                  {
                    EMACS_INT v = va_arg (ap, EMACS_INT);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                case pM_modifier:
                  {
                    intmax_t v = va_arg (ap, intmax_t);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                }
@@ -315,13 +315,13 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
                case no_modifier:
                  {
                    unsigned v = va_arg (ap, unsigned);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                case long_modifier:
                  {
                    unsigned long v = va_arg (ap, unsigned long);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                case pD_modifier:
@@ -329,13 +329,13 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
                case pI_modifier:
                  {
                    EMACS_UINT v = va_arg (ap, EMACS_UINT);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                case pM_modifier:
                  {
                    uintmax_t v = va_arg (ap, uintmax_t);
-                   sprintf (sprintf_buffer, fmtcpy, v);
+                   tem = sprintf (sprintf_buffer, fmtcpy, v);
                  }
                  break;
                }
@@ -348,7 +348,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
            case 'g':
              {
                double d = va_arg (ap, double);
-               sprintf (sprintf_buffer, fmtcpy, d);
+               tem = sprintf (sprintf_buffer, fmtcpy, d);
                /* Now copy into final output, truncating as necessary.  */
                string = sprintf_buffer;
                goto doit;
@@ -368,8 +368,8 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
 
              /* Copy string into final output, truncating if no room.  */
            doit:
+             eassert (0 <= tem);
              /* Coming here means STRING contains ASCII only.  */
-             tem = strlen (string);
              if (STRING_BYTES_BOUND < tem)
                error ("Format width or precision too large");
              width = tem;
@@ -392,15 +392,19 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
                {
                  /* Truncate the string at character boundary.  */
                  tem = bufsize;
-                 while (!CHAR_HEAD_P (string[tem - 1])) tem--;
-                 /* If the multibyte sequence of this character is
-                    too long for the space we have left in the
-                    buffer, truncate before it.  */
-                 if (tem > 0
-                     && BYTES_BY_CHAR_HEAD (string[tem - 1]) > bufsize)
-                   tem--;
-                 if (tem > 0)
-                   memcpy (bufptr, string, tem);
+                 do
+                   {
+                     tem--;
+                     if (CHAR_HEAD_P (string[tem]))
+                       {
+                         if (BYTES_BY_CHAR_HEAD (string[tem]) <= bufsize - tem)
+                           tem = bufsize;
+                         break;
+                       }
+                   }
+                 while (tem != 0);
+
+                 memcpy (bufptr, string, tem);
                  bufptr[tem] = 0;
                  /* Trigger exit from the loop, but make sure we
                     return to the caller a value which will indicate
@@ -409,8 +413,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
                  bufsize = 0;
                  continue;
                }
-             else
-               memcpy (bufptr, string, tem);
+             memcpy (bufptr, string, tem);
              bufptr += tem;
              bufsize -= tem;
              if (minlen < 0)
index 8ef672fb8bb390fd2a3d7c32ef092aea90378e96..ee28801e841c4595d5c9a51d4cf57ee5a6cbfcc1 100644 (file)
@@ -23,9 +23,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* The entire file is within this conditional */
 
 #include <stdio.h>
+/* gettime and settime in dos.h clash with their namesakes from
+   gnulib, so we move out of our way the prototypes in dos.h.  */
+#define gettime dos_h_gettime_
+#define settime dos_h_settime_
 #include <dos.h>
+#undef gettime
+#undef settime
 #include <setjmp.h>
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "termchar.h"
 #include "frame.h"
@@ -35,7 +42,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dosfns.h"
 #include "msdos.h"
 #include "dispextern.h"
-#include "character.h"
 #include "coding.h"
 #include "process.h"
 #include <dpmi.h>
@@ -65,27 +71,27 @@ REGISTERS should be a vector produced by `make-register' and
   if (no < 0 || no > 0xff || ASIZE (registers) != 8)
     return Qnil;
   for (i = 0; i < 8; i++)
-    CHECK_NUMBER (XVECTOR (registers)->contents[i]);
+    CHECK_NUMBER (AREF (registers, i));
 
-  inregs.x.ax    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[0]);
-  inregs.x.bx    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[1]);
-  inregs.x.cx    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[2]);
-  inregs.x.dx    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[3]);
-  inregs.x.si    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[4]);
-  inregs.x.di    = (unsigned long) XFASTINT (XVECTOR (registers)->contents[5]);
-  inregs.x.cflag = (unsigned long) XFASTINT (XVECTOR (registers)->contents[6]);
-  inregs.x.flags = (unsigned long) XFASTINT (XVECTOR (registers)->contents[7]);
+  inregs.x.ax    = (unsigned long) XFASTINT (AREF (registers, 0));
+  inregs.x.bx    = (unsigned long) XFASTINT (AREF (registers, 1));
+  inregs.x.cx    = (unsigned long) XFASTINT (AREF (registers, 2));
+  inregs.x.dx    = (unsigned long) XFASTINT (AREF (registers, 3));
+  inregs.x.si    = (unsigned long) XFASTINT (AREF (registers, 4));
+  inregs.x.di    = (unsigned long) XFASTINT (AREF (registers, 5));
+  inregs.x.cflag = (unsigned long) XFASTINT (AREF (registers, 6));
+  inregs.x.flags = (unsigned long) XFASTINT (AREF (registers, 7));
 
   int86 (no, &inregs, &outregs);
 
-  XVECTOR (registers)->contents[0] = make_number (outregs.x.ax);
-  XVECTOR (registers)->contents[1] = make_number (outregs.x.bx);
-  XVECTOR (registers)->contents[2] = make_number (outregs.x.cx);
-  XVECTOR (registers)->contents[3] = make_number (outregs.x.dx);
-  XVECTOR (registers)->contents[4] = make_number (outregs.x.si);
-  XVECTOR (registers)->contents[5] = make_number (outregs.x.di);
-  XVECTOR (registers)->contents[6] = make_number (outregs.x.cflag);
-  XVECTOR (registers)->contents[7] = make_number (outregs.x.flags);
+  ASET (registers, 0, make_number (outregs.x.ax));
+  ASET (registers, 1, make_number (outregs.x.bx));
+  ASET (registers, 2, make_number (outregs.x.cx));
+  ASET (registers, 3, make_number (outregs.x.dx));
+  ASET (registers, 4, make_number (outregs.x.si));
+  ASET (registers, 5, make_number (outregs.x.di));
+  ASET (registers, 6, make_number (outregs.x.cflag));
+  ASET (registers, 7, make_number (outregs.x.flags));
 
   return registers;
 }
@@ -109,7 +115,7 @@ Return the updated VECTOR.  */)
   dosmemget (offs, len, buf);
 
   for (i = 0; i < len; i++)
-    XVECTOR (vector)->contents[i] = make_number (buf[i]);
+    ASET (vector, i, make_number (buf[i]));
 
   return vector;
 }
@@ -132,8 +138,8 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0,
 
   for (i = 0; i < len; i++)
     {
-      CHECK_NUMBER (XVECTOR (vector)->contents[i]);
-      buf[i] = (unsigned char) XFASTINT (XVECTOR (vector)->contents[i]) & 0xFF;
+      CHECK_NUMBER (AREF (vector, i));
+      buf[i] = (unsigned char) XFASTINT (AREF (vector, i)) & 0xFF;
     }
 
   dosmemput (buf, len, offs);
@@ -540,7 +546,6 @@ system_process_attributes (Lisp_Object pid)
       int i;
       Lisp_Object cmd_str, decoded_cmd, tem;
       double pmem;
-      EXFUN (Fget_internal_run_time, 0);
 #ifndef SYSTEM_MALLOC
       extern unsigned long ret_lim_data ();
 #endif
@@ -710,7 +715,7 @@ Implicitly modified when the TZ variable is changed.  */);
 #endif
 
   DEFVAR_LISP ("dos-display-scancodes", Vdos_display_scancodes,
-              doc: /* *Controls whether DOS raw keyboard events are displayed as you type.
+              doc: /* Whether DOS raw keyboard events are displayed as you type.
 When non-nil, the keyboard scan-codes are displayed at the bottom right
 corner of the display (typically at the end of the mode line).
 The output format is: scan code:char code*modifiers.  */);
@@ -718,17 +723,17 @@ The output format is: scan code:char code*modifiers.  */);
   Vdos_display_scancodes = Qnil;
 
   DEFVAR_INT ("dos-hyper-key", dos_hyper_key,
-             doc: /* *If set to 1, use right ALT key as hyper key.
+             doc: /* If set to 1, use right ALT key as hyper key.
 If set to 2, use right CTRL key as hyper key.  */);
   dos_hyper_key = 0;
 
   DEFVAR_INT ("dos-super-key", dos_super_key,
-             doc: /* *If set to 1, use right ALT key as super key.
+             doc: /* If set to 1, use right ALT key as super key.
 If set to 2, use right CTRL key as super key.  */);
   dos_super_key = 0;
 
   DEFVAR_INT ("dos-keypad-mode", dos_keypad_mode,
-             doc: /* *Controls what key code is returned by a key in the numeric keypad.
+             doc: /* Controls what key code is returned by a key in the numeric keypad.
 The `numlock ON' action is only taken if no modifier keys are pressed.
 The value is an integer constructed by adding the following bits together:
 
@@ -764,4 +769,3 @@ If zero, the decimal point key returns the country code specific value.  */);
   dos_decimal_point = 0;
 }
 #endif /* MSDOS */
-
index a41565d858832d0ff558a01fa3813dcde3b76284..9cfd0449daa40f9251ce19b03ff810683cfcd0f9 100644 (file)
@@ -52,17 +52,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <verify.h>
 
 #include "intervals.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "coding.h"
 #include "frame.h"
 #include "window.h"
 #include "blockinput.h"
 
-#ifndef NULL
-#define NULL 0
-#endif
-
 #ifndef USER_FULL_NAME
 #define USER_FULL_NAME pw->pw_gecos
 #endif
@@ -73,25 +69,16 @@ extern char **environ;
 
 #define TM_YEAR_BASE 1900
 
-/* Nonzero if TM_YEAR is a struct tm's tm_year value that causes
-   asctime to have well-defined behavior.  */
-#ifndef TM_YEAR_IN_ASCTIME_RANGE
-# define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \
-    (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE)
-#endif
-
 #ifdef WINDOWSNT
 extern Lisp_Object w32_get_internal_run_time (void);
 #endif
 
-static void time_overflow (void) NO_RETURN;
-static Lisp_Object format_time_string (char const *, ptrdiff_t, Lisp_Object,
-                                      int, time_t *, struct tm **);
+static Lisp_Object format_time_string (char const *, ptrdiff_t, EMACS_TIME,
+                                      int, struct tm *);
 static int tm_diff (struct tm *, struct tm *);
-static void update_buffer_properties (EMACS_INT, EMACS_INT);
+static void update_buffer_properties (ptrdiff_t, ptrdiff_t);
 
 static Lisp_Object Qbuffer_access_fontify_functions;
-static Lisp_Object Fuser_full_name (Lisp_Object);
 
 /* Symbol for the text property used to mark fields.  */
 
@@ -148,8 +135,14 @@ init_editfns (void)
   /* If the user name claimed in the environment vars differs from
      the real uid, use the claimed name to find the full name.  */
   tem = Fstring_equal (Vuser_login_name, Vuser_real_login_name);
-  Vuser_full_name = Fuser_full_name (NILP (tem)? make_number (geteuid ())
-                                    : Vuser_login_name);
+  if (! NILP (tem))
+    tem = Vuser_login_name;
+  else
+    {
+      uid_t euid = geteuid ();
+      tem = make_fixnum_or_float (euid);
+    }
+  Vuser_full_name = Fuser_full_name (tem);
 
   p = getenv ("NAME");
   if (p)
@@ -212,15 +205,6 @@ DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0,
     XSETFASTINT (val, 0);
   return val;
 }
-\f
-static Lisp_Object
-buildmark (EMACS_INT charpos, EMACS_INT bytepos)
-{
-  register Lisp_Object mark;
-  mark = Fmake_marker ();
-  set_marker_both (mark, Qnil, charpos, bytepos);
-  return mark;
-}
 
 DEFUN ("point", Fpoint, Spoint, 0, 0, 0,
        doc: /* Return value of point, as an integer.
@@ -236,18 +220,7 @@ DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0,
        doc: /* Return value of point, as a marker object.  */)
   (void)
 {
-  return buildmark (PT, PT_BYTE);
-}
-
-EMACS_INT
-clip_to_bounds (EMACS_INT lower, EMACS_INT num, EMACS_INT upper)
-{
-  if (num < lower)
-    return lower;
-  else if (num > upper)
-    return upper;
-  else
-    return num;
+  return build_marker (current_buffer, PT, PT_BYTE);
 }
 
 DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
@@ -257,7 +230,7 @@ Beginning of buffer is position (point-min), end is (point-max).
 The return value is POSITION.  */)
   (register Lisp_Object position)
 {
-  EMACS_INT pos;
+  ptrdiff_t pos;
 
   if (MARKERP (position)
       && current_buffer == XMARKER (position)->buffer)
@@ -299,9 +272,10 @@ region_limit (int beginningp)
   if (NILP (m))
     error ("The mark is not set now, so there is no region");
 
-  if ((PT < XFASTINT (m)) == (beginningp != 0))
-    m = make_number (PT);
-  return m;
+  /* Clip to the current narrowing (bug#11770).  */
+  return make_number ((PT < XFASTINT (m)) == (beginningp != 0)
+                     ? PT
+                     : clip_to_bounds (BEGV, XFASTINT (m), ZV));
 }
 
 DEFUN ("region-beginning", Fregion_beginning, Sregion_beginning, 0, 0, 0,
@@ -337,7 +311,7 @@ overlays_around (EMACS_INT pos, Lisp_Object *vec, ptrdiff_t len)
 {
   Lisp_Object overlay, start, end;
   struct Lisp_Overlay *tail;
-  EMACS_INT startpos, endpos;
+  ptrdiff_t startpos, endpos;
   ptrdiff_t idx = 0;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
@@ -414,14 +388,14 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o
 
       /* First try with room for 40 overlays.  */
       noverlays = 40;
-      overlay_vec = (Lisp_Object *) alloca (noverlays * sizeof (Lisp_Object));
+      overlay_vec = alloca (noverlays * sizeof *overlay_vec);
       noverlays = overlays_around (posn, overlay_vec, noverlays);
 
       /* If there are more than 40,
         make enough space for all, and try again.  */
       if (noverlays > 40)
        {
-         overlay_vec = (Lisp_Object *) alloca (noverlays * sizeof (Lisp_Object));
+         overlay_vec = alloca (noverlays * sizeof *overlay_vec);
          noverlays = overlays_around (posn, overlay_vec, noverlays);
        }
       noverlays = sort_overlays (overlay_vec, noverlays, NULL);
@@ -486,7 +460,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o
 static void
 find_field (Lisp_Object pos, Lisp_Object merge_at_boundary,
            Lisp_Object beg_limit,
-           EMACS_INT *beg, Lisp_Object end_limit, EMACS_INT *end)
+           ptrdiff_t *beg, Lisp_Object end_limit, ptrdiff_t *end)
 {
   /* Fields right before and after the point.  */
   Lisp_Object before_field, after_field;
@@ -602,7 +576,7 @@ A field is a region of text with the same `field' property.
 If POS is nil, the value of point is used for POS.  */)
   (Lisp_Object pos)
 {
-  EMACS_INT beg, end;
+  ptrdiff_t beg, end;
   find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
   if (beg != end)
     del_range (beg, end);
@@ -615,7 +589,7 @@ A field is a region of text with the same `field' property.
 If POS is nil, the value of point is used for POS.  */)
   (Lisp_Object pos)
 {
-  EMACS_INT beg, end;
+  ptrdiff_t beg, end;
   find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
   return make_buffer_string (beg, end, 1);
 }
@@ -626,7 +600,7 @@ A field is a region of text with the same `field' property.
 If POS is nil, the value of point is used for POS.  */)
   (Lisp_Object pos)
 {
-  EMACS_INT beg, end;
+  ptrdiff_t beg, end;
   find_field (pos, Qnil, Qnil, &beg, Qnil, &end);
   return make_buffer_string (beg, end, 0);
 }
@@ -641,7 +615,7 @@ If LIMIT is non-nil, it is a buffer position; if the beginning of the field
 is before LIMIT, then LIMIT will be returned instead.  */)
   (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
 {
-  EMACS_INT beg;
+  ptrdiff_t beg;
   find_field (pos, escape_from_edge, limit, &beg, Qnil, 0);
   return make_number (beg);
 }
@@ -656,7 +630,7 @@ If LIMIT is non-nil, it is a buffer position; if the end of the field
 is after LIMIT, then LIMIT will be returned instead.  */)
   (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit)
 {
-  EMACS_INT end;
+  ptrdiff_t end;
   find_field (pos, escape_from_edge, Qnil, 0, limit, &end);
   return make_number (end);
 }
@@ -692,7 +666,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.  */)
   (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property)
 {
   /* If non-zero, then the original point, before re-positioning.  */
-  EMACS_INT orig_point = 0;
+  ptrdiff_t orig_point = 0;
   int fwd;
   Lisp_Object prev_old, prev_new;
 
@@ -706,10 +680,10 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.  */)
   CHECK_NUMBER_COERCE_MARKER (new_pos);
   CHECK_NUMBER_COERCE_MARKER (old_pos);
 
-  fwd = (XFASTINT (new_pos) > XFASTINT (old_pos));
+  fwd = (XINT (new_pos) > XINT (old_pos));
 
-  prev_old = make_number (XFASTINT (old_pos) - 1);
-  prev_new = make_number (XFASTINT (new_pos) - 1);
+  prev_old = make_number (XINT (old_pos) - 1);
+  prev_new = make_number (XINT (new_pos) - 1);
 
   if (NILP (Vinhibit_field_text_motion)
       && !EQ (new_pos, old_pos)
@@ -734,7 +708,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil.  */)
     /* It is possible that NEW_POS is not within the same field as
        OLD_POS; try to move NEW_POS so that it is.  */
     {
-      EMACS_INT shortage;
+      ptrdiff_t shortage;
       Lisp_Object field_bound;
 
       if (fwd)
@@ -789,8 +763,8 @@ boundaries bind `inhibit-field-text-motion' to t.
 This function does not move point.  */)
   (Lisp_Object n)
 {
-  EMACS_INT orig, orig_byte, end;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t orig, orig_byte, end;
+  ptrdiff_t count = SPECPDL_INDEX ();
   specbind (Qinhibit_point_motion_hooks, Qt);
 
   if (NILP (n))
@@ -830,15 +804,17 @@ boundaries bind `inhibit-field-text-motion' to t.
 This function does not move point.  */)
   (Lisp_Object n)
 {
-  EMACS_INT end_pos;
-  EMACS_INT orig = PT;
+  ptrdiff_t clipped_n;
+  ptrdiff_t end_pos;
+  ptrdiff_t orig = PT;
 
   if (NILP (n))
     XSETFASTINT (n, 1);
   else
     CHECK_NUMBER (n);
 
-  end_pos = find_before_next_newline (orig, 0, XINT (n) - (XINT (n) <= 0));
+  clipped_n = clip_to_bounds (PTRDIFF_MIN + 1, XINT (n), PTRDIFF_MAX);
+  end_pos = find_before_next_newline (orig, 0, clipped_n - (clipped_n <= 0));
 
   /* Return END_POS constrained to the current input field.  */
   return Fconstrain_to_field (make_number (end_pos), make_number (orig),
@@ -965,7 +941,7 @@ usage: (save-excursion &rest BODY)  */)
   (Lisp_Object args)
 {
   register Lisp_Object val;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   record_unwind_protect (save_excursion_restore, save_excursion_save ());
 
@@ -980,7 +956,7 @@ usage: (save-current-buffer &rest BODY)  */)
   (Lisp_Object args)
 {
   Lisp_Object val;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
 
@@ -1018,7 +994,7 @@ DEFUN ("point-min-marker", Fpoint_min_marker, Spoint_min_marker, 0, 0, 0,
 This is the beginning, unless narrowing (a buffer restriction) is in effect.  */)
   (void)
 {
-  return buildmark (BEGV, BEGV_BYTE);
+  return build_marker (current_buffer, BEGV, BEGV_BYTE);
 }
 
 DEFUN ("point-max", Fpoint_max, Spoint_max, 0, 0, 0,
@@ -1038,7 +1014,7 @@ This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
 is in effect, in which case it is less.  */)
   (void)
 {
-  return buildmark (ZV, ZV_BYTE);
+  return build_marker (current_buffer, ZV, ZV_BYTE);
 }
 
 DEFUN ("gap-position", Fgap_position, Sgap_position, 0, 0, 0,
@@ -1106,7 +1082,7 @@ At the beginning of the buffer or accessible region, return 0.  */)
     XSETFASTINT (temp, 0);
   else if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
     {
-      EMACS_INT pos = PT_BYTE;
+      ptrdiff_t pos = PT_BYTE;
       DEC_POS (pos);
       XSETFASTINT (temp, FETCH_CHAR (pos));
     }
@@ -1160,7 +1136,7 @@ POS is an integer or a marker and defaults to point.
 If POS is out of range, the value is nil.  */)
   (Lisp_Object pos)
 {
-  register EMACS_INT pos_byte;
+  register ptrdiff_t pos_byte;
 
   if (NILP (pos))
     {
@@ -1193,7 +1169,7 @@ If POS is out of range, the value is nil.  */)
   (Lisp_Object pos)
 {
   register Lisp_Object val;
-  register EMACS_INT pos_byte;
+  register ptrdiff_t pos_byte;
 
   if (NILP (pos))
     {
@@ -1253,7 +1229,7 @@ of the user with that uid, or nil if there is no such user.  */)
   if (NILP (uid))
     return Vuser_login_name;
 
-  id = XFLOATINT (uid);
+  CONS_TO_INTEGER (uid, uid_t, id);
   BLOCK_INPUT;
   pw = getpwuid (id);
   UNBLOCK_INPUT;
@@ -1280,14 +1256,7 @@ DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0,
 Value is an integer or a float, depending on the value.  */)
   (void)
 {
-  /* Assignment to EMACS_INT stops GCC whining about limited range of
-     data type.  */
-  EMACS_INT euid = geteuid ();
-
-  /* Make sure we don't produce a negative UID due to signed integer
-     overflow.  */
-  if (euid < 0)
-    return make_float (geteuid ());
+  uid_t euid = geteuid ();
   return make_fixnum_or_float (euid);
 }
 
@@ -1296,14 +1265,7 @@ DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0,
 Value is an integer or a float, depending on the value.  */)
   (void)
 {
-  /* Assignment to EMACS_INT stops GCC whining about limited range of
-     data type.  */
-  EMACS_INT uid = getuid ();
-
-  /* Make sure we don't produce a negative UID due to signed integer
-     overflow.  */
-  if (uid < 0)
-    return make_float (getuid ());
+  uid_t uid = getuid ();
   return make_fixnum_or_float (uid);
 }
 
@@ -1326,7 +1288,8 @@ name, or nil if there is no such user.  */)
     return Vuser_full_name;
   else if (NUMBERP (uid))
     {
-      uid_t u = XFLOATINT (uid);
+      uid_t u;
+      CONS_TO_INTEGER (uid, uid_t, u);
       BLOCK_INPUT;
       pw = getpwuid (u);
       UNBLOCK_INPUT;
@@ -1358,7 +1321,7 @@ name, or nil if there is no such user.  */)
       Lisp_Object login;
 
       login = Fuser_login_name (make_number (pw->pw_uid));
-      r = (char *) alloca (strlen (p) + SCHARS (login) + 1);
+      r = alloca (strlen (p) + SCHARS (login) + 1);
       memcpy (r, p, q - p);
       r[q - p] = 0;
       strcat (r, SSDATA (login));
@@ -1388,10 +1351,11 @@ get_system_name (void)
 }
 
 DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
-       doc: /* Return the process ID of Emacs, as an integer.  */)
+       doc: /* Return the process ID of Emacs, as a number.  */)
   (void)
 {
-  return make_number (getpid ());
+  pid_t pid = getpid ();
+  return make_fixnum_or_float (pid);
 }
 
 \f
@@ -1404,14 +1368,13 @@ DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0,
 #endif
 
 /* Report that a time value is out of range for Emacs.  */
-static void
+void
 time_overflow (void)
 {
   error ("Specified time is not representable");
 }
 
-/* Return the upper part of the time T (everything but the bottom 16 bits),
-   making sure that it is representable.  */
+/* Return the upper part of the time T (everything but the bottom 16 bits).  */
 static EMACS_INT
 hi_time (time_t t)
 {
@@ -1431,7 +1394,7 @@ hi_time (time_t t)
 }
 
 /* Return the bottom 16 bits of the time T.  */
-static EMACS_INT
+static int
 lo_time (time_t t)
 {
   return t & ((1 << 16) - 1);
@@ -1439,34 +1402,23 @@ lo_time (time_t t)
 
 DEFUN ("current-time", Fcurrent_time, Scurrent_time, 0, 0, 0,
        doc: /* Return the current time, as the number of seconds since 1970-01-01 00:00:00.
-The time is returned as a list of three integers.  The first has the
-most significant 16 bits of the seconds, while the second has the
-least significant 16 bits.  The third integer gives the microsecond
-count.
-
-The microsecond count is zero on systems that do not provide
-resolution finer than a second.  */)
+The time is returned as a list of integers (HIGH LOW USEC PSEC).
+HIGH has the most significant bits of the seconds, while LOW has the
+least significant 16 bits.  USEC and PSEC are the microsecond and
+picosecond counts.  */)
   (void)
 {
-  EMACS_TIME t;
-
-  EMACS_GET_TIME (t);
-  return list3 (make_number (hi_time (EMACS_SECS (t))),
-               make_number (lo_time (EMACS_SECS (t))),
-               make_number (EMACS_USECS (t)));
+  return make_lisp_time (current_emacs_time ());
 }
 
 DEFUN ("get-internal-run-time", Fget_internal_run_time, Sget_internal_run_time,
        0, 0, 0,
        doc: /* Return the current run time used by Emacs.
-The time is returned as a list of three integers.  The first has the
-most significant 16 bits of the seconds, while the second has the
-least significant 16 bits.  The third integer gives the microsecond
-count.
+The time is returned as a list (HIGH LOW USEC PSEC), using the same
+style as (current-time).
 
 On systems that can't determine the run time, `get-internal-run-time'
-does the same thing as `current-time'.  The microsecond count is zero
-on systems that do not provide resolution finer than a second.  */)
+does the same thing as `current-time'.  */)
   (void)
 {
 #ifdef HAVE_GETRUSAGE
@@ -1486,10 +1438,7 @@ on systems that do not provide resolution finer than a second.  */)
       usecs -= 1000000;
       secs++;
     }
-
-  return list3 (make_number (hi_time (secs)),
-               make_number (lo_time (secs)),
-               make_number (usecs));
+  return make_lisp_time (make_emacs_time (secs, usecs * 1000));
 #else /* ! HAVE_GETRUSAGE  */
 #ifdef WINDOWSNT
   return w32_get_internal_run_time ();
@@ -1500,78 +1449,166 @@ on systems that do not provide resolution finer than a second.  */)
 }
 \f
 
-/* Make a Lisp list that represents the time T.  */
-Lisp_Object
+/* Make a Lisp list that represents the time T with fraction TAIL.  */
+static Lisp_Object
+make_time_tail (time_t t, Lisp_Object tail)
+{
+  return Fcons (make_number (hi_time (t)),
+               Fcons (make_number (lo_time (t)), tail));
+}
+
+/* Make a Lisp list that represents the system time T.  */
+static Lisp_Object
 make_time (time_t t)
 {
-  return list2 (make_number (hi_time (t)),
-               make_number (lo_time (t)));
+  return make_time_tail (t, Qnil);
+}
+
+/* Make a Lisp list that represents the Emacs time T.  T may be an
+   invalid time, with a slightly negative tv_nsec value such as
+   UNKNOWN_MODTIME_NSECS; in that case, the Lisp list contains a
+   correspondingly negative picosecond count.  */
+Lisp_Object
+make_lisp_time (EMACS_TIME t)
+{
+  int ns = EMACS_NSECS (t);
+  return make_time_tail (EMACS_SECS (t),
+                        list2 (make_number (ns / 1000),
+                               make_number (ns % 1000 * 1000)));
 }
 
 /* Decode a Lisp list SPECIFIED_TIME that represents a time.
-   If SPECIFIED_TIME is nil, use the current time.
-   Set *RESULT to seconds since the Epoch.
-   If USEC is not null, set *USEC to the microseconds component.
+   Set *PHIGH, *PLOW, *PUSEC, *PPSEC to its parts; do not check their values.
    Return nonzero if successful.  */
-int
-lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec)
+static int
+disassemble_lisp_time (Lisp_Object specified_time, Lisp_Object *phigh,
+                      Lisp_Object *plow, Lisp_Object *pusec,
+                      Lisp_Object *ppsec)
 {
-  if (NILP (specified_time))
+  if (CONSP (specified_time))
     {
-      if (usec)
-        {
-          EMACS_TIME t;
+      Lisp_Object low = XCDR (specified_time);
+      Lisp_Object usec = make_number (0);
+      Lisp_Object psec = make_number (0);
+      if (CONSP (low))
+       {
+         Lisp_Object low_tail = XCDR (low);
+         low = XCAR (low);
+         if (CONSP (low_tail))
+           {
+             usec = XCAR (low_tail);
+             low_tail = XCDR (low_tail);
+             if (CONSP (low_tail))
+               psec = XCAR (low_tail);
+           }
+         else if (!NILP (low_tail))
+           usec = low_tail;
+       }
 
-          EMACS_GET_TIME (t);
-          *usec = EMACS_USECS (t);
-          *result = EMACS_SECS (t);
-          return 1;
-        }
+      *phigh = XCAR (specified_time);
+      *plow = low;
+      *pusec = usec;
+      *ppsec = psec;
+      return 1;
+    }
+
+  return 0;
+}
+
+/* From the time components HIGH, LOW, USEC and PSEC taken from a Lisp
+   list, generate the corresponding time value.
+
+   If RESULT is not null, store into *RESULT the converted time;
+   this can fail if the converted time does not fit into EMACS_TIME.
+   If *DRESULT is not null, store into *DRESULT the number of
+   seconds since the start of the POSIX Epoch.
+
+   Return nonzero if successful.  */
+int
+decode_time_components (Lisp_Object high, Lisp_Object low, Lisp_Object usec,
+                       Lisp_Object psec,
+                       EMACS_TIME *result, double *dresult)
+{
+  EMACS_INT hi, lo, us, ps;
+  if (! (INTEGERP (high) && INTEGERP (low)
+        && INTEGERP (usec) && INTEGERP (psec)))
+    return 0;
+  hi = XINT (high);
+  lo = XINT (low);
+  us = XINT (usec);
+  ps = XINT (psec);
+
+  /* Normalize out-of-range lower-order components by carrying
+     each overflow into the next higher-order component.  */
+  us += ps / 1000000 - (ps % 1000000 < 0);
+  lo += us / 1000000 - (us % 1000000 < 0);
+  hi += lo >> 16;
+  ps = ps % 1000000 + 1000000 * (ps % 1000000 < 0);
+  us = us % 1000000 + 1000000 * (us % 1000000 < 0);
+  lo &= (1 << 16) - 1;
+
+  if (result)
+    {
+      if ((TYPE_SIGNED (time_t) ? TIME_T_MIN >> 16 <= hi : 0 <= hi)
+         && hi <= TIME_T_MAX >> 16)
+       {
+         /* Return the greatest representable time that is not greater
+            than the requested time.  */
+         time_t sec = hi;
+         *result = make_emacs_time ((sec << 16) + lo, us * 1000 + ps / 1000);
+       }
       else
-        return time (result) != -1;
+       {
+         /* Overflow in the highest-order component.  */
+         return 0;
+       }
     }
+
+  if (dresult)
+    *dresult = (us * 1e6 + ps) / 1e12 + lo + hi * 65536.0;
+
+  return 1;
+}
+
+/* Decode a Lisp list SPECIFIED_TIME that represents a time.
+   If SPECIFIED_TIME is nil, use the current time.
+
+   Round the time down to the nearest EMACS_TIME value.
+   Return seconds since the Epoch.
+   Signal an error if unsuccessful.  */
+EMACS_TIME
+lisp_time_argument (Lisp_Object specified_time)
+{
+  EMACS_TIME t;
+  if (NILP (specified_time))
+    t = current_emacs_time ();
   else
     {
-      Lisp_Object high, low;
-      EMACS_INT hi;
-      high = Fcar (specified_time);
-      CHECK_NUMBER (high);
-      low = Fcdr (specified_time);
-      if (CONSP (low))
-        {
-          if (usec)
-            {
-              Lisp_Object usec_l = Fcdr (low);
-              if (CONSP (usec_l))
-                usec_l = Fcar (usec_l);
-              if (NILP (usec_l))
-                *usec = 0;
-              else
-                {
-                  CHECK_NUMBER (usec_l);
-                  *usec = XINT (usec_l);
-                }
-            }
-          low = Fcar (low);
-        }
-      else if (usec)
-        *usec = 0;
-      CHECK_NUMBER (low);
-      hi = XINT (high);
-
-      /* Check for overflow, helping the compiler for common cases
-        where no runtime check is needed, and taking care not to
-        convert negative numbers to unsigned before comparing them.  */
-      if (! ((TYPE_SIGNED (time_t)
-             ? (TIME_T_MIN >> 16 <= MOST_NEGATIVE_FIXNUM
-                || TIME_T_MIN >> 16 <= hi)
-             : 0 <= hi)
-            && (MOST_POSITIVE_FIXNUM <= TIME_T_MAX >> 16
-                || hi <= TIME_T_MAX >> 16)))
-       return 0;
-
-      *result = (hi << 16) + (XINT (low) & 0xffff);
-      return 1;
+      Lisp_Object high, low, usec, psec;
+      if (! (disassemble_lisp_time (specified_time, &high, &low, &usec, &psec)
+            && decode_time_components (high, low, usec, psec, &t, 0)))
+       error ("Invalid time specification");
+    }
+  return t;
+}
+
+/* Like lisp_time_argument, except decode only the seconds part,
+   do not allow out-of-range time stamps, do not check the subseconds part,
+   and always round down.  */
+static time_t
+lisp_seconds_argument (Lisp_Object specified_time)
+{
+  if (NILP (specified_time))
+    return time (NULL);
+  else
+    {
+      Lisp_Object high, low, usec, psec;
+      EMACS_TIME t;
+      if (! (disassemble_lisp_time (specified_time, &high, &low, &usec, &psec)
+            && decode_time_components (high, low, make_number (0),
+                                       make_number (0), &t, 0)))
+       error ("Invalid time specification");
+      return EMACS_SECS (t);
     }
 }
 
@@ -1579,22 +1616,30 @@ DEFUN ("float-time", Ffloat_time, Sfloat_time, 0, 1, 0,
        doc: /* Return the current time, as a float number of seconds since the epoch.
 If SPECIFIED-TIME is given, it is the time to convert to float
 instead of the current time.  The argument should have the form
-(HIGH LOW) or (HIGH LOW USEC). Thus, you can use times obtained from
-`current-time' and from `file-attributes'.  SPECIFIED-TIME can also
-have the form (HIGH . LOW), but this is considered obsolete.
+(HIGH LOW) or (HIGH LOW USEC) or (HIGH LOW USEC PSEC).  Thus,
+you can use times from `current-time' and from `file-attributes'.
+SPECIFIED-TIME can also have the form (HIGH . LOW), but this is
+considered obsolete.
 
 WARNING: Since the result is floating point, it may not be exact.
 If precise time stamps are required, use either `current-time',
 or (if you need time as a string) `format-time-string'.  */)
   (Lisp_Object specified_time)
 {
-  time_t sec;
-  int usec;
-
-  if (! lisp_time_argument (specified_time, &sec, &usec))
-    error ("Invalid time specification");
-
-  return make_float ((sec * 1e6 + usec) / 1e6);
+  double t;
+  if (NILP (specified_time))
+    {
+      EMACS_TIME now = current_emacs_time ();
+      t = EMACS_SECS (now) + EMACS_NSECS (now) / 1e9;
+    }
+  else
+    {
+      Lisp_Object high, low, usec, psec;
+      if (! (disassemble_lisp_time (specified_time, &high, &low, &usec, &psec)
+            && decode_time_components (high, low, usec, psec, 0, &t)))
+       error ("Invalid time specification");
+    }
+  return make_float (t);
 }
 
 /* Write information into buffer S of size MAXSIZE, according to the
@@ -1649,7 +1694,7 @@ emacs_nmemftime (char *s, size_t maxsize, const char *format,
 
 DEFUN ("format-time-string", Fformat_time_string, Sformat_time_string, 1, 3, 0,
        doc: /* Use FORMAT-STRING to format the time TIME, or now if omitted.
-TIME is specified as (HIGH LOW . IGNORED), as returned by
+TIME is specified as (HIGH LOW USEC PSEC), as returned by
 `current-time' or `file-attributes'.  The obsolete form (HIGH . LOW)
 is also still accepted.
 The third, optional, argument UNIVERSAL, if non-nil, means describe TIME
@@ -1703,66 +1748,62 @@ For example, to produce full ISO 8601 format, use "%Y-%m-%dT%T%z".
 usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL)  */)
   (Lisp_Object format_string, Lisp_Object timeval, Lisp_Object universal)
 {
-  time_t t;
-  struct tm *tm;
+  EMACS_TIME t = lisp_time_argument (timeval);
+  struct tm tm;
 
   CHECK_STRING (format_string);
   format_string = code_convert_string_norecord (format_string,
                                                Vlocale_coding_system, 1);
   return format_time_string (SSDATA (format_string), SBYTES (format_string),
-                            timeval, ! NILP (universal), &t, &tm);
+                            t, ! NILP (universal), &tm);
 }
 
 static Lisp_Object
 format_time_string (char const *format, ptrdiff_t formatlen,
-                   Lisp_Object timeval, int ut, time_t *tval, struct tm **tmp)
+                   EMACS_TIME t, int ut, struct tm *tmp)
 {
-  ptrdiff_t size;
-  int usec;
-  int ns;
+  char buffer[4000];
+  char *buf = buffer;
+  ptrdiff_t size = sizeof buffer;
+  size_t len;
+  Lisp_Object bufstring;
+  int ns = EMACS_NSECS (t);
   struct tm *tm;
-
-  if (! (lisp_time_argument (timeval, tval, &usec)
-        && 0 <= usec && usec < 1000000))
-    error ("Invalid time specification");
-  ns = usec * 1000;
-
-  /* This is probably enough.  */
-  size = formatlen;
-  if (size <= (STRING_BYTES_BOUND - 50) / 6)
-    size = size * 6 + 50;
-
-  BLOCK_INPUT;
-  tm = ut ? gmtime (tval) : localtime (tval);
-  UNBLOCK_INPUT;
-  if (! tm)
-    time_overflow ();
-  *tmp = tm;
-
-  synchronize_system_time_locale ();
+  USE_SAFE_ALLOCA;
 
   while (1)
     {
-      char *buf = (char *) alloca (size + 1);
-      size_t result;
+      time_t *taddr = emacs_secs_addr (&t);
+      BLOCK_INPUT;
+
+      synchronize_system_time_locale ();
+
+      tm = ut ? gmtime (taddr) : localtime (taddr);
+      if (! tm)
+       {
+         UNBLOCK_INPUT;
+         time_overflow ();
+       }
+      *tmp = *tm;
 
       buf[0] = '\1';
-      BLOCK_INPUT;
-      result = emacs_nmemftime (buf, size, format, formatlen, tm, ut, ns);
-      UNBLOCK_INPUT;
-      if ((result > 0 && result < size) || (result == 0 && buf[0] == '\0'))
-       return code_convert_string_norecord (make_unibyte_string (buf, result),
-                                            Vlocale_coding_system, 0);
+      len = emacs_nmemftime (buf, size, format, formatlen, tm, ut, ns);
+      if ((0 < len && len < size) || (len == 0 && buf[0] == '\0'))
+       break;
 
-      /* If buffer was too small, make it bigger and try again.  */
-      BLOCK_INPUT;
-      result = emacs_nmemftime (NULL, (size_t) -1, format, formatlen,
-                               tm, ut, ns);
+      /* Buffer was too small, so make it bigger and try again.  */
+      len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns);
       UNBLOCK_INPUT;
-      if (STRING_BYTES_BOUND <= result)
+      if (STRING_BYTES_BOUND <= len)
        string_overflow ();
-      size = result + 1;
+      size = len + 1;
+      SAFE_ALLOCA (buf, char *, size);
     }
+
+  UNBLOCK_INPUT;
+  bufstring = make_unibyte_string (buf, len);
+  SAFE_FREE ();
+  return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0);
 }
 
 DEFUN ("decode-time", Fdecode_time, Sdecode_time, 0, 1, 0,
@@ -1782,41 +1823,38 @@ east of Greenwich.  (Note that Common Lisp has different meanings for
 DOW and ZONE.)  */)
   (Lisp_Object specified_time)
 {
-  time_t time_spec;
+  time_t time_spec = lisp_seconds_argument (specified_time);
   struct tm save_tm;
   struct tm *decoded_time;
   Lisp_Object list_args[9];
 
-  if (! lisp_time_argument (specified_time, &time_spec, NULL))
-    error ("Invalid time specification");
-
   BLOCK_INPUT;
   decoded_time = localtime (&time_spec);
+  if (decoded_time)
+    save_tm = *decoded_time;
   UNBLOCK_INPUT;
   if (! (decoded_time
-        && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= decoded_time->tm_year
-        && decoded_time->tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE))
+        && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year
+        && save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE))
     time_overflow ();
-  XSETFASTINT (list_args[0], decoded_time->tm_sec);
-  XSETFASTINT (list_args[1], decoded_time->tm_min);
-  XSETFASTINT (list_args[2], decoded_time->tm_hour);
-  XSETFASTINT (list_args[3], decoded_time->tm_mday);
-  XSETFASTINT (list_args[4], decoded_time->tm_mon + 1);
+  XSETFASTINT (list_args[0], save_tm.tm_sec);
+  XSETFASTINT (list_args[1], save_tm.tm_min);
+  XSETFASTINT (list_args[2], save_tm.tm_hour);
+  XSETFASTINT (list_args[3], save_tm.tm_mday);
+  XSETFASTINT (list_args[4], save_tm.tm_mon + 1);
   /* On 64-bit machines an int is narrower than EMACS_INT, thus the
      cast below avoids overflow in int arithmetics.  */
-  XSETINT (list_args[5], TM_YEAR_BASE + (EMACS_INT) decoded_time->tm_year);
-  XSETFASTINT (list_args[6], decoded_time->tm_wday);
-  list_args[7] = (decoded_time->tm_isdst)? Qt : Qnil;
+  XSETINT (list_args[5], TM_YEAR_BASE + (EMACS_INT) save_tm.tm_year);
+  XSETFASTINT (list_args[6], save_tm.tm_wday);
+  list_args[7] = save_tm.tm_isdst ? Qt : Qnil;
 
-  /* Make a copy, in case gmtime modifies the struct.  */
-  save_tm = *decoded_time;
   BLOCK_INPUT;
   decoded_time = gmtime (&time_spec);
-  UNBLOCK_INPUT;
   if (decoded_time == 0)
     list_args[8] = Qnil;
   else
     XSETINT (list_args[8], tm_diff (&save_tm, decoded_time));
+  UNBLOCK_INPUT;
   return Flist (9, list_args);
 }
 
@@ -1871,7 +1909,7 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)  */)
   tm.tm_isdst = -1;
 
   if (CONSP (zone))
-    zone = Fcar (zone);
+    zone = XCAR (zone);
   if (NILP (zone))
     {
       BLOCK_INPUT;
@@ -1890,29 +1928,34 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE)  */)
        tzstring = SSDATA (zone);
       else if (INTEGERP (zone))
        {
-         int abszone = eabs (XINT (zone));
-         sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0),
-                  abszone / (60*60), (abszone/60) % 60, abszone % 60);
+         EMACS_INT abszone = eabs (XINT (zone));
+         EMACS_INT zone_hr = abszone / (60*60);
+         int zone_min = (abszone/60) % 60;
+         int zone_sec = abszone % 60;
+         sprintf (tzbuf, "XXX%s%"pI"d:%02d:%02d", "-" + (XINT (zone) < 0),
+                  zone_hr, zone_min, zone_sec);
          tzstring = tzbuf;
        }
       else
        error ("Invalid time zone specification");
 
+      BLOCK_INPUT;
+
       /* Set TZ before calling mktime; merely adjusting mktime's returned
         value doesn't suffice, since that would mishandle leap seconds.  */
       set_time_zone_rule (tzstring);
 
-      BLOCK_INPUT;
       value = mktime (&tm);
-      UNBLOCK_INPUT;
 
       /* Restore TZ to previous value.  */
       newenv = environ;
       environ = oldenv;
-      xfree (newenv);
 #ifdef LOCALTIME_CACHE
       tzset ();
 #endif
+      UNBLOCK_INPUT;
+
+      xfree (newenv);
     }
 
   if (value == (time_t) -1)
@@ -1937,26 +1980,36 @@ Thus, you can use times obtained from `current-time' and from
 but this is considered obsolete.  */)
   (Lisp_Object specified_time)
 {
-  time_t value;
+  time_t value = lisp_seconds_argument (specified_time);
   struct tm *tm;
-  register char *tem;
+  char buf[sizeof "Mon Apr 30 12:49:17 " + INT_STRLEN_BOUND (int) + 1];
+  int len IF_LINT (= 0);
 
-  if (! lisp_time_argument (specified_time, &value, NULL))
-    error ("Invalid time specification");
-
-  /* Convert to a string, checking for out-of-range time stamps.
-     Don't use 'ctime', as that might dump core if VALUE is out of
-     range.  */
+  /* Convert to a string in ctime format, except without the trailing
+     newline, and without the 4-digit year limit.  Don't use asctime
+     or ctime, as they might dump core if the year is outside the
+     range -999 .. 9999.  */
   BLOCK_INPUT;
   tm = localtime (&value);
+  if (tm)
+    {
+      static char const wday_name[][4] =
+       { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+      static char const mon_name[][4] =
+       { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+         "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+      printmax_t year_base = TM_YEAR_BASE;
+
+      len = sprintf (buf, "%s %s%3d %02d:%02d:%02d %"pMd,
+                    wday_name[tm->tm_wday], mon_name[tm->tm_mon], tm->tm_mday,
+                    tm->tm_hour, tm->tm_min, tm->tm_sec,
+                    tm->tm_year + year_base);
+    }
   UNBLOCK_INPUT;
-  if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year) && (tem = asctime (tm))))
+  if (! tm)
     time_overflow ();
 
-  /* Remove the trailing newline.  */
-  tem[strlen (tem) - 1] = '\0';
-
-  return build_string (tem);
+  return make_unibyte_string (buf, len);
 }
 
 /* Yield A - B, measured in seconds.
@@ -1999,23 +2052,23 @@ in this case, `current-time-zone' returns a list containing nil for
 the data it can't find.  */)
   (Lisp_Object specified_time)
 {
-  time_t value;
+  EMACS_TIME value;
+  int offset;
   struct tm *t;
   struct tm localtm;
-  struct tm *localt;
   Lisp_Object zone_offset, zone_name;
 
   zone_offset = Qnil;
-  zone_name = format_time_string ("%Z", sizeof "%Z" - 1, specified_time,
-                                 0, &value, &localt);
-  localtm = *localt;
+  value = make_emacs_time (lisp_seconds_argument (specified_time), 0);
+  zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, 0, &localtm);
   BLOCK_INPUT;
-  t = gmtime (&value);
+  t = gmtime (emacs_secs_addr (&value));
+  if (t)
+    offset = tm_diff (&localtm, t);
   UNBLOCK_INPUT;
 
   if (t)
     {
-      int offset = tm_diff (&localtm, t);
       zone_offset = make_number (offset);
       if (SCHARS (zone_name) == 0)
        {
@@ -2023,8 +2076,9 @@ the data it can't find.  */)
          int m = offset / 60;
          int am = offset < 0 ? - m : m;
          char buf[sizeof "+00" + INT_STRLEN_BOUND (int)];
-         sprintf (buf, "%c%02d%02d", (offset < 0 ? '-' : '+'), am/60, am%60);
-         zone_name = build_string (buf);
+         zone_name = make_formatted_string (buf, "%c%02d%02d", 
+                                            (offset < 0 ? '-' : '+'),
+                                            am / 60, am % 60);
        }
     }
 
@@ -2053,9 +2107,16 @@ only the former.  */)
   (Lisp_Object tz)
 {
   const char *tzstring;
+  char **old_environbuf;
+
+  if (! (NILP (tz) || EQ (tz, Qt)))
+    CHECK_STRING (tz);
+
+  BLOCK_INPUT;
 
   /* When called for the first time, save the original TZ.  */
-  if (!environbuf)
+  old_environbuf = environbuf;
+  if (!old_environbuf)
     initial_tz = (char *) getenv ("TZ");
 
   if (NILP (tz))
@@ -2063,15 +2124,14 @@ only the former.  */)
   else if (EQ (tz, Qt))
     tzstring = "UTC0";
   else
-    {
-      CHECK_STRING (tz);
-      tzstring = SSDATA (tz);
-    }
+    tzstring = SSDATA (tz);
 
   set_time_zone_rule (tzstring);
-  xfree (environbuf);
   environbuf = environ;
 
+  UNBLOCK_INPUT;
+
+  xfree (old_environbuf);
   return Qnil;
 }
 
@@ -2105,8 +2165,8 @@ set_time_zone_rule (const char *tzstring)
   for (from = environ; *from; from++)
     continue;
   envptrs = from - environ + 2;
-  newenv = to = (char **) xmalloc (envptrs * sizeof (char *)
-                                  + (tzstring ? strlen (tzstring) + 4 : 0));
+  newenv = to = xmalloc (envptrs * sizeof *newenv
+                        + (tzstring ? strlen (tzstring) + 4 : 0));
 
   /* Add TZSTRING to the end of environ, as a value for TZ.  */
   if (tzstring)
@@ -2177,10 +2237,10 @@ set_time_zone_rule (const char *tzstring)
 
 static void
 general_insert_function (void (*insert_func)
-                             (const char *, EMACS_INT),
+                             (const char *, ptrdiff_t),
                         void (*insert_from_string_func)
-                             (Lisp_Object, EMACS_INT, EMACS_INT,
-                              EMACS_INT, EMACS_INT, int),
+                             (Lisp_Object, ptrdiff_t, ptrdiff_t,
+                              ptrdiff_t, ptrdiff_t, int),
                         int inherit, ptrdiff_t nargs, Lisp_Object *args)
 {
   ptrdiff_t argnum;
@@ -2308,20 +2368,46 @@ usage: (insert-before-markers-and-inherit &rest ARGS)  */)
   return Qnil;
 }
 \f
-DEFUN ("insert-char", Finsert_char, Sinsert_char, 2, 3, 0,
+DEFUN ("insert-char", Finsert_char, Sinsert_char, 1, 3,
+       "(list (read-char-by-name \"Insert character (Unicode name or hex): \")\
+        (prefix-numeric-value current-prefix-arg)\
+        t))",
        doc: /* Insert COUNT copies of CHARACTER.
-Point, and before-insertion markers, are relocated as in the function `insert'.
-The optional third arg INHERIT, if non-nil, says to inherit text properties
-from adjoining text, if those properties are sticky.  */)
+Interactively, prompt for CHARACTER.  You can specify CHARACTER in one
+of these ways:
+
+ - As its Unicode character name, e.g. \"LATIN SMALL LETTER A\".
+   Completion is available; if you type a substring of the name
+   preceded by an asterisk `*', Emacs shows all names which include
+   that substring, not necessarily at the beginning of the name.
+
+ - As a hexadecimal code point, e.g. 263A.  Note that code points in
+   Emacs are equivalent to Unicode up to 10FFFF (which is the limit of
+   the Unicode code space).
+
+ - As a code point with a radix specified with #, e.g. #o21430
+   (octal), #x2318 (hex), or #10r8984 (decimal).
+
+If called interactively, COUNT is given by the prefix argument.  If
+omitted or nil, it defaults to 1.
+
+Inserting the character(s) relocates point and before-insertion
+markers in the same ways as the function `insert'.
+
+The optional third argument INHERIT, if non-nil, says to inherit text
+properties from adjoining text, if those properties are sticky.  If
+called interactively, INHERIT is t.  */)
   (Lisp_Object character, Lisp_Object count, Lisp_Object inherit)
 {
   int i, stringlen;
-  register EMACS_INT n;
+  register ptrdiff_t n;
   int c, len;
   unsigned char str[MAX_MULTIBYTE_LENGTH];
   char string[4000];
 
   CHECK_CHARACTER (character);
+  if (NILP (count))
+    XSETFASTINT (count, 1);
   CHECK_NUMBER (count);
   c = XFASTINT (character);
 
@@ -2392,10 +2478,10 @@ from adjoining text, if those properties are sticky.  */)
    buffer substrings.  */
 
 Lisp_Object
-make_buffer_string (EMACS_INT start, EMACS_INT end, int props)
+make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props)
 {
-  EMACS_INT start_byte = CHAR_TO_BYTE (start);
-  EMACS_INT end_byte = CHAR_TO_BYTE (end);
+  ptrdiff_t start_byte = CHAR_TO_BYTE (start);
+  ptrdiff_t end_byte = CHAR_TO_BYTE (end);
 
   return make_buffer_string_both (start, start_byte, end, end_byte, props);
 }
@@ -2416,8 +2502,8 @@ make_buffer_string (EMACS_INT start, EMACS_INT end, int props)
    buffer substrings.  */
 
 Lisp_Object
-make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte,
-                        EMACS_INT end, EMACS_INT end_byte, int props)
+make_buffer_string_both (ptrdiff_t start, ptrdiff_t start_byte,
+                        ptrdiff_t end, ptrdiff_t end_byte, int props)
 {
   Lisp_Object result, tem, tem1;
 
@@ -2450,7 +2536,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte,
    in the current buffer, if necessary.  */
 
 static void
-update_buffer_properties (EMACS_INT start, EMACS_INT end)
+update_buffer_properties (ptrdiff_t start, ptrdiff_t end)
 {
   /* If this buffer has some access functions,
      call them, specifying the range of the buffer being accessed.  */
@@ -2489,7 +2575,7 @@ into the result string; if you don't want the text properties,
 use `buffer-substring-no-properties' instead.  */)
   (Lisp_Object start, Lisp_Object end)
 {
-  register EMACS_INT b, e;
+  register ptrdiff_t b, e;
 
   validate_region (&start, &end);
   b = XINT (start);
@@ -2505,7 +2591,7 @@ The two arguments START and END are character positions;
 they can be in either order.  */)
   (Lisp_Object start, Lisp_Object end)
 {
-  register EMACS_INT b, e;
+  register ptrdiff_t b, e;
 
   validate_region (&start, &end);
   b = XINT (start);
@@ -2589,8 +2675,8 @@ determines whether case is significant or ignored.  */)
   register Lisp_Object trt
     = (!NILP (BVAR (current_buffer, case_fold_search))
        ? BVAR (current_buffer, case_canon_table) : Qnil);
-  EMACS_INT chars = 0;
-  EMACS_INT i1, i2, i1_byte, i2_byte;
+  ptrdiff_t chars = 0;
+  ptrdiff_t i1, i2, i1_byte, i2_byte;
 
   /* Find the first buffer and its substring.  */
 
@@ -2751,21 +2837,21 @@ and don't mark the buffer as really changed.
 Both characters must have the same length of multi-byte form.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo)
 {
-  register EMACS_INT pos, pos_byte, stop, i, len, end_byte;
+  register ptrdiff_t pos, pos_byte, stop, i, len, end_byte;
   /* Keep track of the first change in the buffer:
      if 0 we haven't found it yet.
      if < 0 we've found it and we've run the before-change-function.
      if > 0 we've actually performed it and the value is its position.  */
-  EMACS_INT changed = 0;
+  ptrdiff_t changed = 0;
   unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH];
   unsigned char *p;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 #define COMBINING_NO    0
 #define COMBINING_BEFORE 1
 #define COMBINING_AFTER  2
 #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
   int maybe_byte_combining = COMBINING_NO;
-  EMACS_INT last_changed = 0;
+  ptrdiff_t last_changed = 0;
   int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   int fromc, toc;
 
@@ -2825,7 +2911,7 @@ Both characters must have the same length of multi-byte form.  */)
     stop = min (stop, GPT_BYTE);
   while (1)
     {
-      EMACS_INT pos_byte_next = pos_byte;
+      ptrdiff_t pos_byte_next = pos_byte;
 
       if (pos_byte >= stop)
        {
@@ -2928,7 +3014,7 @@ Both characters must have the same length of multi-byte form.  */)
 }
 
 
-static Lisp_Object check_translation (EMACS_INT, EMACS_INT, EMACS_INT,
+static Lisp_Object check_translation (ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                      Lisp_Object);
 
 /* Helper function for Ftranslate_region_internal.
@@ -2938,7 +3024,7 @@ static Lisp_Object check_translation (EMACS_INT, EMACS_INT, EMACS_INT,
    element is found, return it.  Otherwise return Qnil.  */
 
 static Lisp_Object
-check_translation (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT end,
+check_translation (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t end,
                   Lisp_Object val)
 {
   int buf_size = 16, buf_used = 0;
@@ -2947,7 +3033,7 @@ check_translation (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT end,
   for (; CONSP (val); val = XCDR (val))
     {
       Lisp_Object elt;
-      EMACS_INT len, i;
+      ptrdiff_t len, i;
 
       elt = XCAR (val);
       if (! CONSP (elt))
@@ -3000,8 +3086,8 @@ It returns the number of characters changed.  */)
   register unsigned char *tt;  /* Trans table. */
   register int nc;             /* New character. */
   int cnt;                     /* Number of changes made. */
-  EMACS_INT size;              /* Size of translate table. */
-  EMACS_INT pos, pos_byte, end_pos;
+  ptrdiff_t size;              /* Size of translate table. */
+  ptrdiff_t pos, pos_byte, end_pos;
   int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   int string_multibyte IF_LINT (= 0);
 
@@ -3240,8 +3326,8 @@ save_restriction_save (void)
     {
       Lisp_Object beg, end;
 
-      beg = buildmark (BEGV, BEGV_BYTE);
-      end = buildmark (ZV, ZV_BYTE);
+      beg = build_marker (current_buffer, BEGV, BEGV_BYTE);
+      end = build_marker (current_buffer, ZV, ZV_BYTE);
 
       /* END must move forward if text is inserted at its exact location.  */
       XMARKER (end)->insertion_type = 1;
@@ -3279,7 +3365,7 @@ save_restriction_restore (Lisp_Object data)
        /* The restriction has changed from the saved one, so restore
           the saved restriction.  */
        {
-         EMACS_INT pt = BUF_PT (buf);
+         ptrdiff_t pt = BUF_PT (buf);
 
          SET_BUF_BEGV_BOTH (buf, beg->charpos, beg->bytepos);
          SET_BUF_ZV_BOTH (buf, end->charpos, end->bytepos);
@@ -3337,7 +3423,7 @@ usage: (save-restriction &rest BODY)  */)
   (Lisp_Object body)
 {
   register Lisp_Object val;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   record_unwind_protect (save_restriction_restore, save_restriction_save ());
   val = Fprogn (body);
@@ -3423,15 +3509,11 @@ usage: (message-box FORMAT-STRING &rest ARGS)  */)
       }
 #endif /* HAVE_MENUS */
       /* Copy the data so that it won't move when we GC.  */
-      if (! message_text)
-       {
-         message_text = (char *)xmalloc (80);
-         message_length = 80;
-       }
       if (SBYTES (val) > message_length)
        {
-         message_text = (char *) xrealloc (message_text, SBYTES (val));
-         message_length = SBYTES (val);
+         ptrdiff_t new_length = SBYTES (val) + 80;
+         message_text = xrealloc (message_text, new_length);
+         message_length = new_length;
        }
       memcpy (message_text, SDATA (val), SBYTES (val));
       message2 (message_text, SBYTES (val),
@@ -3555,12 +3637,12 @@ usage: (format STRING &rest OBJECTS)  */)
   ptrdiff_t n;         /* The number of the next arg to substitute */
   char initial_buffer[4000];
   char *buf = initial_buffer;
-  EMACS_INT bufsize = sizeof initial_buffer;
-  EMACS_INT max_bufsize = STRING_BYTES_BOUND + 1;
+  ptrdiff_t bufsize = sizeof initial_buffer;
+  ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1;
   char *p;
   Lisp_Object buf_save_value IF_LINT (= {0});
   register char *format, *end, *format_start;
-  EMACS_INT formatlen, nchars;
+  ptrdiff_t formatlen, nchars;
   /* Nonzero if the format is multibyte.  */
   int multibyte_format = 0;
   /* Nonzero if the output should be a multibyte string,
@@ -3587,7 +3669,7 @@ usage: (format STRING &rest OBJECTS)  */)
      info[0] is unused.  Unused elements have -1 for start.  */
   struct info
   {
-    EMACS_INT start, end;
+    ptrdiff_t start, end;
     int converted_to_string;
     int intervals;
   } *info = 0;
@@ -3644,7 +3726,7 @@ usage: (format STRING &rest OBJECTS)  */)
       char *format0 = format;
 
       /* Bytes needed to represent the output of this conversion.  */
-      EMACS_INT convbytes;
+      ptrdiff_t convbytes;
 
       if (*format == '%')
        {
@@ -3671,7 +3753,7 @@ usage: (format STRING &rest OBJECTS)  */)
          int space_flag = 0;
          int sharp_flag = 0;
          int  zero_flag = 0;
-         EMACS_INT field_width;
+         ptrdiff_t field_width;
          int precision_given;
          uintmax_t precision = UINTMAX_MAX;
          char *num_end;
@@ -3778,11 +3860,11 @@ usage: (format STRING &rest OBJECTS)  */)
            {
              /* handle case (precision[n] >= 0) */
 
-             EMACS_INT width, padding, nbytes;
-             EMACS_INT nchars_string;
+             ptrdiff_t width, padding, nbytes;
+             ptrdiff_t nchars_string;
 
-             EMACS_INT prec = -1;
-             if (precision_given && precision <= TYPE_MAXIMUM (EMACS_INT))
+             ptrdiff_t prec = -1;
+             if (precision_given && precision <= TYPE_MAXIMUM (ptrdiff_t))
                prec = precision;
 
              /* lisp_string_width ignores a precision of 0, but GNU
@@ -3795,7 +3877,7 @@ usage: (format STRING &rest OBJECTS)  */)
                width = nchars_string = nbytes = 0;
              else
                {
-                 EMACS_INT nch, nby;
+                 ptrdiff_t nch, nby;
                  width = lisp_string_width (args[n], prec, &nch, &nby);
                  if (prec < 0)
                    {
@@ -3892,7 +3974,7 @@ usage: (format STRING &rest OBJECTS)  */)
              verify (0 < USEFUL_PRECISION_MAX);
 
              int prec;
-             EMACS_INT padding, sprintf_bytes;
+             ptrdiff_t padding, sprintf_bytes;
              uintmax_t excess_precision, numwidth;
              uintmax_t leading_zeros = 0, trailing_zeros = 0;
 
@@ -4207,8 +4289,8 @@ usage: (format STRING &rest OBJECTS)  */)
 
       if (CONSP (props))
        {
-         EMACS_INT bytepos = 0, position = 0, translated = 0;
-         EMACS_INT argn = 1;
+         ptrdiff_t bytepos = 0, position = 0, translated = 0;
+         ptrdiff_t argn = 1;
          Lisp_Object list;
 
          /* Adjust the bounds of each text property
@@ -4226,7 +4308,7 @@ usage: (format STRING &rest OBJECTS)  */)
          for (list = props; CONSP (list); list = XCDR (list))
            {
              Lisp_Object item;
-             EMACS_INT pos;
+             ptrdiff_t pos;
 
              item = XCAR (list);
 
@@ -4357,12 +4439,12 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer.  */)
    It's the caller's job to ensure that START1 <= END1 <= START2 <= END2.  */
 
 static void
-transpose_markers (EMACS_INT start1, EMACS_INT end1,
-                  EMACS_INT start2, EMACS_INT end2,
-                  EMACS_INT start1_byte, EMACS_INT end1_byte,
-                  EMACS_INT start2_byte, EMACS_INT end2_byte)
+transpose_markers (ptrdiff_t start1, ptrdiff_t end1,
+                  ptrdiff_t start2, ptrdiff_t end2,
+                  ptrdiff_t start1_byte, ptrdiff_t end1_byte,
+                  ptrdiff_t start2_byte, ptrdiff_t end2_byte)
 {
-  register EMACS_INT amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos;
+  register ptrdiff_t amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos;
   register struct Lisp_Marker *marker;
 
   /* Update point as if it were a marker.  */
@@ -4436,9 +4518,9 @@ any markers that happen to be located in the regions.
 Transposing beyond buffer boundaries is an error.  */)
   (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers)
 {
-  register EMACS_INT start1, end1, start2, end2;
-  EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte;
-  EMACS_INT gap, len1, len_mid, len2;
+  register ptrdiff_t start1, end1, start2, end2;
+  ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte;
+  ptrdiff_t gap, len1, len_mid, len2;
   unsigned char *start1_addr, *start2_addr, *temp;
 
   INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3;
@@ -4459,7 +4541,7 @@ Transposing beyond buffer boundaries is an error.  */)
   /* Swap the regions if they're reversed.  */
   if (start2 < end1)
     {
-      register EMACS_INT glumph = start1;
+      register ptrdiff_t glumph = start1;
       start1 = start2;
       start2 = glumph;
       glumph = end1;
index 0e77223ee00510d8fa3bd2a6ad8279425c096661..2893b5f205cea518db0b3ac835f9b58af0d49846 100644 (file)
@@ -45,6 +45,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "commands.h"
 #include "intervals.h"
+#include "character.h"
 #include "buffer.h"
 #include "window.h"
 
@@ -65,6 +66,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "nsterm.h"
 #endif
 
+#if (defined PROFILING \
+     && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
+# include <sys/gmon.h>
+extern void moncontrol (int mode);
+#endif
+
 #ifdef HAVE_X_WINDOWS
 #include "xterm.h"
 #endif
@@ -82,48 +89,37 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/personality.h>
 #endif
 
-#ifdef HAVE_LIBXML2
-#include <libxml/parser.h>
-#endif
-
 #ifndef O_RDWR
 #define O_RDWR 2
 #endif
 
-#ifdef HAVE_SETPGID
-#if !defined (USG)
-#undef setpgrp
-#define setpgrp setpgid
-#endif
-#endif
-
 static const char emacs_version[] = VERSION;
 static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
 
 /* Make these values available in GDB, which doesn't see macros.  */
 
-#ifdef USE_LSB_TAG
+#if USE_LSB_TAG
 int gdb_use_lsb EXTERNALLY_VISIBLE = 1;
 #else
 int gdb_use_lsb EXTERNALLY_VISIBLE = 0;
 #endif
-#ifndef USE_LISP_UNION_TYPE
-int gdb_use_union EXTERNALLY_VISIBLE  = 0;
+#ifndef CHECK_LISP_OBJECT_TYPE
+int gdb_use_struct EXTERNALLY_VISIBLE = 0;
 #else
-int gdb_use_union EXTERNALLY_VISIBLE = 1;
+int gdb_use_struct EXTERNALLY_VISIBLE = 1;
 #endif
-EMACS_INT gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
-EMACS_INT gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
-#if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG)
-EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
+int gdb_valbits EXTERNALLY_VISIBLE = VALBITS;
+int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS;
+#if defined DATA_SEG_BITS && !USE_LSB_TAG
+uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS;
 #else
-EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
+uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0;
 #endif
-EMACS_INT PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG;
-EMACS_INT gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG;
+ptrdiff_t PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG;
+ptrdiff_t gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG;
 /* GDB might say "No enum type named pvec_type" if we don't have at
    least one symbol with that type, and then xbacktrace could fail.  */
-enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK;
+enum pvec_type const gdb_pvec_type EXTERNALLY_VISIBLE = 0;
 
 /* Empty lisp strings.  To avoid having to build any others.  */
 Lisp_Object empty_unibyte_string, empty_multibyte_string;
@@ -324,9 +320,9 @@ pthread_t main_thread;
 #ifdef HAVE_NS
 /* NS autrelease pool, for memory management.  */
 static void *ns_pool;
-#endif  
+#endif
+
 
 
 /* Handle bus errors, invalid instruction, etc.  */
 #ifndef FLOAT_CATCH_SIGILL
@@ -405,7 +401,7 @@ init_cmdargs (int argc, char **argv, int skip_args)
 {
   register int i;
   Lisp_Object name, dir, handler;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object raw_name;
 
   initial_argv = argv;
@@ -573,7 +569,7 @@ static char dump_tz[] = "UtC0";
 /* Define a dummy function F.  Declare F too, to pacify gcc
    -Wmissing-prototypes.  */
 #define DEFINE_DUMMY_FUNCTION(f) \
-  void f (void) EXTERNALLY_VISIBLE; void f (void) {}
+  void f (void) ATTRIBUTE_CONST EXTERNALLY_VISIBLE; void f (void) {}
 
 #ifndef GCC_CTORS_IN_LIBC
 DEFINE_DUMMY_FUNCTION (__do_global_ctors)
@@ -1258,7 +1254,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
       init_alloc_once ();
       init_obarray ();
       init_eval_once ();
-      init_character_once ();
       init_charset_once ();
       init_coding_once ();
       init_syntax_once ();     /* Create standard syntax table.  */
@@ -1311,9 +1306,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 
   init_eval ();
   init_data ();
-#ifdef CLASH_DETECTION
-  init_filelock ();
-#endif
   init_atimer ();
   running_asynch_code = 0;
 
@@ -1430,13 +1422,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
   init_ntproc ();      /* must precede init_editfns.  */
 #endif
 
-#ifdef HAVE_NS
-#ifndef CANNOT_DUMP
-  if (initialized)
-#endif
-    ns_init_paths ();
-#endif
-
   /* Initialize and GC-protect Vinitial_environment and
      Vprocess_environment before set_initial_environment fills them
      in.  */
@@ -1608,22 +1593,17 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 
   init_charset ();
 
-  init_editfns (); /* init_process uses Voperating_system_release. */
-  init_process (); /* init_display uses add_keyboard_wait_descriptor. */
+  init_editfns (); /* init_process_emacs uses Voperating_system_release. */
+  init_process_emacs (); /* init_display uses add_keyboard_wait_descriptor. */
   init_keyboard ();    /* This too must precede init_sys_modes.  */
   if (!noninteractive)
     init_display ();   /* Determine terminal type.  Calls init_sys_modes.  */
-  init_fns ();
   init_xdisp ();
 #ifdef HAVE_WINDOW_SYSTEM
   init_fringe ();
-  init_image ();
 #endif /* HAVE_WINDOW_SYSTEM */
   init_macros ();
   init_floatfns ();
-#ifdef HAVE_SOUND
-  init_sound ();
-#endif
   init_window ();
   init_font ();
 
@@ -1668,32 +1648,14 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
 #ifdef PROFILING
   if (initialized)
     {
-      extern void _mcleanup ();
 #ifdef __MINGW32__
       extern unsigned char etext asm ("etext");
 #else
       extern char etext;
 #endif
-#ifdef HAVE___EXECUTABLE_START
-      /* This symbol is defined by GNU ld to the start of the text
-        segment.  */
-      extern char __executable_start[];
-#else
-      extern void safe_bcopy ();
-#endif
 
       atexit (_mcleanup);
-#ifdef HAVE___EXECUTABLE_START
-      monstartup (__executable_start, &etext);
-#else
-      /* This uses safe_bcopy because that function comes first in the
-        Emacs executable.  It might be better to use something that
-        gives the start of the text segment, but start_of_text is not
-        defined on all systems now.  */
-      /* FIXME: Does not work on architectures with function
-        descriptors.  */
-      monstartup (safe_bcopy, &etext);
-#endif
+      monstartup ((uintptr_t) __executable_start, (uintptr_t) &etext);
     }
   else
     moncontrol (0);
@@ -1842,7 +1804,7 @@ static const struct standard_args standard_args[] =
 static void
 sort_args (int argc, char **argv)
 {
-  char **new = (char **) xmalloc (sizeof (char *) * argc);
+  char **new = xmalloc (argc * sizeof *new);
   /* For each element of argv,
      the corresponding element of options is:
      0 for an option that takes no arguments,
@@ -2031,10 +1993,15 @@ all of which are called before Emacs is actually killed.  */)
   if (STRINGP (Vauto_save_list_file_name))
     unlink (SSDATA (Vauto_save_list_file_name));
 
-  exit_code = EXIT_SUCCESS;
-  if (noninteractive && (fflush (stdout) || ferror (stdout)))
+  if (INTEGERP (arg))
+    exit_code = (XINT (arg) < 0
+                ? XINT (arg) | INT_MIN
+                : XINT (arg) & INT_MAX);
+  else if (noninteractive && (fflush (stdout) || ferror (stdout)))
     exit_code = EXIT_FAILURE;
-  exit (INTEGERP (arg) ? XINT (arg) : exit_code);
+  else
+    exit_code = EXIT_SUCCESS;
+  exit (exit_code);
 }
 
 
@@ -2124,7 +2091,7 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff)
 #endif
 
 #ifdef HAVE_LIBXML2
-  xmlCleanupParser ();
+  xml_cleanup_parser ();
 #endif
 }
 
@@ -2144,7 +2111,7 @@ You must run Emacs in batch mode in order to dump it.  */)
 {
   Lisp_Object tem;
   Lisp_Object symbol;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   check_pure_size ();
 
index fba672ff74d651da1dca89ab40f1aef3eddf8be5..1a62b59b7afb7c8d69fea7ee117c5b9d5f284d04 100644 (file)
@@ -28,6 +28,27 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "frame.h"
 #include "xterm.h"
 
+#define EMACS_TYPE_FIXED emacs_fixed_get_type ()
+#define EMACS_FIXED(obj) \
+  G_TYPE_CHECK_INSTANCE_CAST (obj, EMACS_TYPE_FIXED, EmacsFixed)
+
+typedef struct _EmacsFixed EmacsFixed;
+typedef struct _EmacsFixedPrivate EmacsFixedPrivate;
+typedef struct _EmacsFixedClass EmacsFixedClass;
+
+struct _EmacsFixed
+{
+  GtkFixed container;
+
+  /*< private >*/
+  EmacsFixedPrivate *priv;
+};
+
+struct _EmacsFixedClass
+{
+  GtkFixedClass parent_class;
+};
+
 struct _EmacsFixedPrivate
 {
   struct frame *f;
@@ -40,28 +61,21 @@ static void emacs_fixed_get_preferred_width  (GtkWidget *widget,
 static void emacs_fixed_get_preferred_height (GtkWidget *widget,
                                               gint      *minimum,
                                               gint      *natural);
+static GType emacs_fixed_get_type (void);
 G_DEFINE_TYPE (EmacsFixed, emacs_fixed, GTK_TYPE_FIXED)
 
 static void
 emacs_fixed_class_init (EmacsFixedClass *klass)
 {
   GtkWidgetClass *widget_class;
-  GtkFixedClass *fixed_class;
 
   widget_class = (GtkWidgetClass*) klass;
-  fixed_class = (GtkFixedClass*) klass;
 
   widget_class->get_preferred_width = emacs_fixed_get_preferred_width;
   widget_class->get_preferred_height = emacs_fixed_get_preferred_height;
   g_type_class_add_private (klass, sizeof (EmacsFixedPrivate));
 }
 
-static GType
-emacs_fixed_child_type (GtkFixed *container)
-{
-  return GTK_TYPE_WIDGET;
-}
-
 static void
 emacs_fixed_init (EmacsFixed *fixed)
 {
index 90fb37e521bc04ae3334ab976cfb579a24e37061..3fa294aa41eab95af5603605681986ac873f93fe 100644 (file)
@@ -27,33 +27,7 @@ G_BEGIN_DECLS
 
 struct frame;
 
-#define EMACS_TYPE_FIXED                  (emacs_fixed_get_type ())
-#define EMACS_FIXED(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMACS_TYPE_FIXED, EmacsFixed))
-#define EMACS_FIXED_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), EMACS_TYPE_FIXED, EmacsFixedClass))
-#define EMACS_IS_FIXED(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMACS_TYPE_FIXED))
-#define EMACS_IS_FIXED_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), EMACS_TYPE_FIXED))
-#define EMACS_FIXED_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), EMACS_TYPE_FIXED, EmacsFixedClass))
-
-typedef struct _EmacsFixed              EmacsFixed;
-typedef struct _EmacsFixedPrivate       EmacsFixedPrivate;
-typedef struct _EmacsFixedClass         EmacsFixedClass;
-
-struct _EmacsFixed
-{
-  GtkFixed container;
-
-  /*< private >*/
-  EmacsFixedPrivate *priv;
-};
-
-
-struct _EmacsFixedClass
-{
-  GtkFixedClass parent_class;
-};
-
 extern GtkWidget *emacs_fixed_new (struct frame *f);
-extern GType emacs_fixed_get_type (void);
 
 G_END_DECLS
 
index 17cb65a32340841513e23ac675dada914b6c8351..705fe3aab1b16eb33bad558596b65f6e6f3e4cf5 100644 (file)
@@ -19,16 +19,26 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-/* The default value of load-path, which is the search path for
-   the Lisp function "load".  Configure (using "make epaths-force")
-   sets this to $lisppath, which typically has a value like:
-   <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp:
+/* Together with PATH_SITELOADSEARCH, this gives the default value of
+   load-path, which is the search path for the Lisp function "load".
+   Configure (using "make epaths-force") sets this to
+   ${standardlisppath}, which typically has a value like:
    <datadir>/emacs/VERSION/lisp:<datadir>/emacs/VERSION/leim
    where datadir is eg /usr/local/share.
+*/
+#define PATH_LOADSEARCH "/usr/local/share/emacs/lisp"
+
+
+/* Like PATH_LOADSEARCH, but contains the non-standard pieces.
+   These are the site-lisp directories, typically something like
+   <datadir>/emacs/VERSION/site-lisp:<datadir>/emacs/site-lisp
    Configure prepends any $locallisppath, as set by the
    --enable-locallisppath argument.
+   This is combined with PATH_LOADSEARCH to make the default load-path.
+   If the --no-site-lisp option is used, this piece is excluded.
 */
-#define PATH_LOADSEARCH "/usr/local/share/emacs/lisp"
+#define PATH_SITELOADSEARCH "/usr/local/share/emacs/site-lisp"
+
 
 /* Like PATH_LOADSEARCH, but used only during the build process
    when Emacs is dumping.  Configure (using "make epaths-force") sets
index 4a3f5083b3b88a0f66cd5d3e556b98a5d4b1f07e..f16fdc6dd4c94b27a10584ab64616978d3f4c319 100644 (file)
@@ -65,7 +65,7 @@ struct handler *handlerlist;
 int gcpro_level;
 #endif
 
-Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp, Qdefun;
+Lisp_Object Qautoload, Qmacro, Qexit, Qinteractive, Qcommandp;
 Lisp_Object Qinhibit_quit;
 Lisp_Object Qand_rest;
 static Lisp_Object Qand_optional;
@@ -90,7 +90,7 @@ Lisp_Object Vautoload_queue;
 
 /* Current number of specbindings allocated in specpdl.  */
 
-EMACS_INT specpdl_size;
+ptrdiff_t specpdl_size;
 
 /* Pointer to beginning of specpdl.  */
 
@@ -111,7 +111,7 @@ static EMACS_INT lisp_eval_depth;
    signal the error instead of entering an infinite loop of debugger
    invocations.  */
 
-static int when_entered_debugger;
+static EMACS_INT when_entered_debugger;
 
 /* The function from which the last `signal' was called.  Set in
    Fsignal.  */
@@ -131,16 +131,14 @@ int handling_signal;
 Lisp_Object inhibit_lisp_code;
 
 static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
-static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
 static int interactive_p (int);
 static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
-static Lisp_Object Ffetch_bytecode (Lisp_Object);
 \f
 void
 init_eval_once (void)
 {
   enum { size = 50 };
-  specpdl = (struct specbinding *) xmalloc (size * sizeof (struct specbinding));
+  specpdl = xmalloc (size * sizeof *specpdl);
   specpdl_size = size;
   specpdl_ptr = specpdl;
   /* Don't forget to update docs (lispref node "Local Variables").  */
@@ -183,7 +181,7 @@ static Lisp_Object
 call_debugger (Lisp_Object arg)
 {
   int debug_while_redisplaying;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object val;
   EMACS_INT old_max = max_specpdl_size;
 
@@ -379,23 +377,14 @@ usage: (prog1 FIRST BODY...)  */)
   Lisp_Object val;
   register Lisp_Object args_left;
   struct gcpro gcpro1, gcpro2;
-  register int argnum = 0;
-
-  if (NILP (args))
-    return Qnil;
 
   args_left = args;
   val = Qnil;
   GCPRO2 (args, val);
 
-  do
-    {
-      Lisp_Object tem = eval_sub (XCAR (args_left));
-      if (!(argnum++))
-       val = tem;
-      args_left = XCDR (args_left);
-    }
-  while (CONSP (args_left));
+  val = eval_sub (XCAR (args_left));
+  while (CONSP (args_left = XCDR (args_left)))
+    eval_sub (XCAR (args_left));
 
   UNGCPRO;
   return val;
@@ -408,31 +397,12 @@ remaining args, whose values are discarded.
 usage: (prog2 FORM1 FORM2 BODY...)  */)
   (Lisp_Object args)
 {
-  Lisp_Object val;
-  register Lisp_Object args_left;
-  struct gcpro gcpro1, gcpro2;
-  register int argnum = -1;
-
-  val = Qnil;
-
-  if (NILP (args))
-    return Qnil;
-
-  args_left = args;
-  val = Qnil;
-  GCPRO2 (args, val);
-
-  do
-    {
-      Lisp_Object tem = eval_sub (XCAR (args_left));
-      if (!(argnum++))
-       val = tem;
-      args_left = XCDR (args_left);
-    }
-  while (CONSP (args_left));
+  struct gcpro gcpro1;
 
+  GCPRO1 (args);
+  eval_sub (XCAR (args));
   UNGCPRO;
-  return val;
+  return Fprog1 (XCDR (args));
 }
 
 DEFUN ("setq", Fsetq, Ssetq, 0, UNEVALLED, 0,
@@ -621,109 +591,6 @@ interactive_p (int exclude_subrs_p)
 }
 
 
-DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0,
-       doc: /* Define NAME as a function.
-The definition is (lambda ARGLIST [DOCSTRING] BODY...).
-See also the function `interactive'.
-usage: (defun NAME ARGLIST [DOCSTRING] BODY...)  */)
-  (Lisp_Object args)
-{
-  register Lisp_Object fn_name;
-  register Lisp_Object defn;
-
-  fn_name = Fcar (args);
-  CHECK_SYMBOL (fn_name);
-  defn = Fcons (Qlambda, Fcdr (args));
-  if (!NILP (Vinternal_interpreter_environment)) /* Mere optimization!  */
-    defn = Ffunction (Fcons (defn, Qnil));
-  if (!NILP (Vpurify_flag))
-    defn = Fpurecopy (defn);
-  if (CONSP (XSYMBOL (fn_name)->function)
-      && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload))
-    LOADHIST_ATTACH (Fcons (Qt, fn_name));
-  Ffset (fn_name, defn);
-  LOADHIST_ATTACH (Fcons (Qdefun, fn_name));
-  return fn_name;
-}
-
-DEFUN ("defmacro", Fdefmacro, Sdefmacro, 2, UNEVALLED, 0,
-       doc: /* Define NAME as a macro.
-The actual definition looks like
- (macro lambda ARGLIST [DOCSTRING] [DECL] BODY...).
-When the macro is called, as in (NAME ARGS...),
-the function (lambda ARGLIST BODY...) is applied to
-the list ARGS... as it appears in the expression,
-and the result should be a form to be evaluated instead of the original.
-
-DECL is a declaration, optional, which can specify how to indent
-calls to this macro, how Edebug should handle it, and which argument
-should be treated as documentation.  It looks like this:
-  (declare SPECS...)
-The elements can look like this:
-  (indent INDENT)
-       Set NAME's `lisp-indent-function' property to INDENT.
-
-  (debug DEBUG)
-       Set NAME's `edebug-form-spec' property to DEBUG.  (This is
-       equivalent to writing a `def-edebug-spec' for the macro.)
-
-  (doc-string ELT)
-       Set NAME's `doc-string-elt' property to ELT.
-
-usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...)  */)
-  (Lisp_Object args)
-{
-  register Lisp_Object fn_name;
-  register Lisp_Object defn;
-  Lisp_Object lambda_list, doc, tail;
-
-  fn_name = Fcar (args);
-  CHECK_SYMBOL (fn_name);
-  lambda_list = Fcar (Fcdr (args));
-  tail = Fcdr (Fcdr (args));
-
-  doc = Qnil;
-  if (STRINGP (Fcar (tail)))
-    {
-      doc = XCAR (tail);
-      tail = XCDR (tail);
-    }
-
-  if (CONSP (Fcar (tail))
-      && EQ (Fcar (Fcar (tail)), Qdeclare))
-    {
-      if (!NILP (Vmacro_declaration_function))
-       {
-         struct gcpro gcpro1;
-         GCPRO1 (args);
-         call2 (Vmacro_declaration_function, fn_name, Fcar (tail));
-         UNGCPRO;
-       }
-
-      tail = Fcdr (tail);
-    }
-
-  if (NILP (doc))
-    tail = Fcons (lambda_list, tail);
-  else
-    tail = Fcons (lambda_list, Fcons (doc, tail));
-
-  defn = Fcons (Qlambda, tail);
-  if (!NILP (Vinternal_interpreter_environment)) /* Mere optimization!  */
-    defn = Ffunction (Fcons (defn, Qnil));
-  defn = Fcons (Qmacro, defn);
-
-  if (!NILP (Vpurify_flag))
-    defn = Fpurecopy (defn);
-  if (CONSP (XSYMBOL (fn_name)->function)
-      && EQ (XCAR (XSYMBOL (fn_name)->function), Qautoload))
-    LOADHIST_ATTACH (Fcons (Qt, fn_name));
-  Ffset (fn_name, defn);
-  LOADHIST_ATTACH (Fcons (Qdefun, fn_name));
-  return fn_name;
-}
-
-
 DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0,
        doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE.
 Aliased variables always have the same value; setting one sets the other.
@@ -764,8 +631,8 @@ The return value is BASE-VARIABLE.  */)
   {
     struct specbinding *p;
 
-    for (p = specpdl_ptr - 1; p >= specpdl; p--)
-      if (p->func == NULL
+    for (p = specpdl_ptr; p > specpdl; )
+      if ((--p)->func == NULL
          && (EQ (new_alias,
                  CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol)))
        error ("Don't know how to make a let-bound variable an alias");
@@ -808,8 +675,6 @@ The optional argument DOCSTRING is a documentation string for the
 variable.
 
 To define a user option, use `defcustom' instead of `defvar'.
-The function `user-variable-p' also identifies a variable as a user
-option if its DOCSTRING starts with *, but this behavior is obsolete.
 usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
   (Lisp_Object args)
 {
@@ -844,9 +709,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING)  */)
        { /* Check if there is really a global binding rather than just a let
             binding that shadows the global unboundness of the var.  */
          volatile struct specbinding *pdl = specpdl_ptr;
-         while (--pdl >= specpdl)
+         while (pdl > specpdl)
            {
-             if (EQ (pdl->symbol, sym) && !pdl->func
+             if (EQ ((--pdl)->symbol, sym) && !pdl->func
                  && EQ (pdl->old_value, Qunbound))
                {
                  message_with_string ("Warning: defvar ignored because %s is let-bound",
@@ -923,71 +788,17 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING])  */)
   return sym;
 }
 
-/* Error handler used in Fuser_variable_p.  */
-static Lisp_Object
-user_variable_p_eh (Lisp_Object ignore)
+/* Make SYMBOL lexically scoped.  */
+DEFUN ("internal-make-var-non-special", Fmake_var_non_special,
+       Smake_var_non_special, 1, 1, 0,
+       doc: /* Internal function.  */)
+     (Lisp_Object symbol)
 {
+  CHECK_SYMBOL (symbol);
+  XSYMBOL (symbol)->declared_special = 0;
   return Qnil;
 }
 
-static Lisp_Object
-lisp_indirect_variable (Lisp_Object sym)
-{
-  struct Lisp_Symbol *s = indirect_variable (XSYMBOL (sym));
-  XSETSYMBOL (sym, s);
-  return sym;
-}
-
-DEFUN ("user-variable-p", Fuser_variable_p, Suser_variable_p, 1, 1, 0,
-       doc: /* Return t if VARIABLE is intended to be set and modified by users.
-\(The alternative is a variable used internally in a Lisp program.)
-
-This function returns t if (i) the first character of its
-documentation is `*', or (ii) it is customizable (its property list
-contains a non-nil value of `standard-value' or `custom-autoload'), or
-\(iii) it is an alias for a user variable.
-
-But condition (i) is considered obsolete, so for most purposes this is
-equivalent to `custom-variable-p'.  */)
-  (Lisp_Object variable)
-{
-  Lisp_Object documentation;
-
-  if (!SYMBOLP (variable))
-      return Qnil;
-
-  /* If indirect and there's an alias loop, don't check anything else.  */
-  if (XSYMBOL (variable)->redirect == SYMBOL_VARALIAS
-      && NILP (internal_condition_case_1 (lisp_indirect_variable, variable,
-                                         Qt, user_variable_p_eh)))
-    return Qnil;
-
-  while (1)
-    {
-      documentation = Fget (variable, Qvariable_documentation);
-      if (INTEGERP (documentation) && XINT (documentation) < 0)
-       return Qt;
-      if (STRINGP (documentation)
-         && ((unsigned char) SREF (documentation, 0) == '*'))
-       return Qt;
-      /* If it is (STRING . INTEGER), a negative integer means a user variable.  */
-      if (CONSP (documentation)
-         && STRINGP (XCAR (documentation))
-         && INTEGERP (XCDR (documentation))
-         && XINT (XCDR (documentation)) < 0)
-       return Qt;
-      /* Customizable?  See `custom-variable-p'.  */
-      if ((!NILP (Fget (variable, intern ("standard-value"))))
-         || (!NILP (Fget (variable, intern ("custom-autoload")))))
-       return Qt;
-
-      if (!(XSYMBOL (variable)->redirect == SYMBOL_VARALIAS))
-       return Qnil;
-
-      /* An indirect variable?  Let's follow the chain.  */
-      XSETSYMBOL (variable, SYMBOL_ALIAS (XSYMBOL (variable)));
-    }
-}
 \f
 DEFUN ("let*", FletX, SletX, 1, UNEVALLED, 0,
        doc: /* Bind variables according to VARLIST then eval BODY.
@@ -999,7 +810,7 @@ usage: (let* VARLIST BODY...)  */)
   (Lisp_Object args)
 {
   Lisp_Object varlist, var, val, elt, lexenv;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3;
 
   GCPRO3 (args, elt, varlist);
@@ -1062,7 +873,7 @@ usage: (let VARLIST BODY...)  */)
 {
   Lisp_Object *temps, tem, lexenv;
   register Lisp_Object elt, varlist;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t argnum;
   struct gcpro gcpro1, gcpro2;
   USE_SAFE_ALLOCA;
@@ -1218,7 +1029,13 @@ definitions to shadow the loaded ones for use in file byte-compilation.  */)
          if (NILP (expander))
            break;
        }
-      form = apply1 (expander, XCDR (form));
+      {
+       Lisp_Object newform = apply1 (expander, XCDR (form));
+       if (EQ (form, newform))
+         break;
+       else
+         form = newform;
+      }
     }
   return form;
 }
@@ -1292,10 +1109,10 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object
 
    This is used for correct unwinding in Fthrow and Fsignal.  */
 
-static void
+static _Noreturn void
 unwind_to_catch (struct catchtag *catch, Lisp_Object value)
 {
-  register int last_time;
+  int last_time;
 
   /* Save the value in the tag.  */
   catch->val = value;
@@ -1365,7 +1182,7 @@ usage: (unwind-protect BODYFORM UNWINDFORMS...)  */)
   (Lisp_Object args)
 {
   Lisp_Object val;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   record_unwind_protect (Fprogn, Fcdr (args));
   val = eval_sub (Fcar (args));
@@ -2109,13 +1926,12 @@ this does nothing and returns nil.  */)
     /* Only add entries after dumping, because the ones before are
        not useful and else we get loads of them from the loaddefs.el.  */
     LOADHIST_ATTACH (Fcons (Qautoload, function));
-  else
-    /* We don't want the docstring in purespace (instead,
-       Snarf-documentation should (hopefully) overwrite it).
-       We used to use 0 here, but that leads to accidental sharing in
-       purecopy's hash-consing, so we use a (hopefully) unique integer
-       instead.  */
-    docstring = make_number (XPNTR (function));
+  else if (EQ (docstring, make_number (0)))
+    /* `read1' in lread.c has found the docstring starting with "\
+       and assumed the docstring will be provided by Snarf-documentation, so it
+       passed us 0 instead.  But that leads to accidental sharing in purecopy's
+       hash-consing, so we use a (hopefully) unique integer instead.  */
+    docstring = make_number (XUNTAG (function, Lisp_Symbol));
   return Ffset (function,
                Fpurecopy (list5 (Qautoload, file, docstring,
                                  interactive, type)));
@@ -2151,7 +1967,7 @@ un_autoload (Lisp_Object oldqueue)
 void
 do_autoload (Lisp_Object fundef, Lisp_Object funname)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object fun;
   struct gcpro gcpro1, gcpro2, gcpro3;
 
@@ -2198,7 +2014,7 @@ DEFUN ("eval", Feval, Seval, 1, 2, 0,
 If LEXICAL is t, evaluate using lexical scoping.  */)
   (Lisp_Object form, Lisp_Object lexical)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   specbind (Qinternal_interpreter_environment,
            NILP (lexical) ? Qnil : Fcons (Qt, Qnil));
   return unbind_to (count, eval_sub (form));
@@ -2254,8 +2070,8 @@ eval_sub (Lisp_Object form)
        error ("Lisp nesting exceeds `max-lisp-eval-depth'");
     }
 
-  original_fun = Fcar (form);
-  original_args = Fcdr (form);
+  original_fun = XCAR (form);
+  original_args = XCDR (form);
 
   backtrace.next = backtrace_list;
   backtrace_list = &backtrace;
@@ -2425,14 +2241,15 @@ eval_sub (Lisp_Object form)
   return val;
 }
 \f
-DEFUN ("apply", Fapply, Sapply, 2, MANY, 0,
+DEFUN ("apply", Fapply, Sapply, 1, MANY, 0,
        doc: /* Call FUNCTION with our remaining args, using our last arg as list of args.
 Then return the value FUNCTION returns.
 Thus, (apply '+ 1 2 '(3 4)) returns 10.
 usage: (apply FUNCTION &rest ARGUMENTS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  ptrdiff_t i, numargs;
+  ptrdiff_t i;
+  EMACS_INT numargs;
   register Lisp_Object spread_arg;
   register Lisp_Object *funcall_args;
   Lisp_Object fun, retval;
@@ -2986,7 +2803,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS)  */)
        {
          if (XSUBR (fun)->max_args > numargs)
            {
-             internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object));
+             internal_args = alloca (XSUBR (fun)->max_args
+                                     * sizeof *internal_args);
              memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object));
              for (i = numargs; i < XSUBR (fun)->max_args; i++)
                internal_args[i] = Qnil;
@@ -3082,7 +2900,8 @@ static Lisp_Object
 apply_lambda (Lisp_Object fun, Lisp_Object args)
 {
   Lisp_Object args_left;
-  ptrdiff_t i, numargs;
+  ptrdiff_t i;
+  EMACS_INT numargs;
   register Lisp_Object *arg_vector;
   struct gcpro gcpro1, gcpro2, gcpro3;
   register Lisp_Object tem;
@@ -3127,7 +2946,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
                register Lisp_Object *arg_vector)
 {
   Lisp_Object val, syms_left, next, lexenv;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t i;
   int optional, rest;
 
@@ -3266,12 +3085,8 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
 static void
 grow_specpdl (void)
 {
-  register int count = SPECPDL_INDEX ();
-  int max_size =
-    min (max_specpdl_size,
-        min (max (PTRDIFF_MAX, SIZE_MAX) / sizeof (struct specbinding),
-             INT_MAX));
-  int size;
+  register ptrdiff_t count = SPECPDL_INDEX ();
+  ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX);
   if (max_size <= specpdl_size)
     {
       if (max_specpdl_size < 400)
@@ -3279,9 +3094,7 @@ grow_specpdl (void)
       if (max_size <= specpdl_size)
        signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil);
     }
-  size = specpdl_size < max_size / 2 ? 2 * specpdl_size : max_size;
-  specpdl = xnrealloc (specpdl, size, sizeof *specpdl);
-  specpdl_size = size;
+  specpdl = xpalloc (specpdl, &specpdl_size, 1, max_size, sizeof *specpdl);
   specpdl_ptr = specpdl + count;
 }
 
@@ -3411,7 +3224,7 @@ record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg)
 }
 
 Lisp_Object
-unbind_to (int count, Lisp_Object value)
+unbind_to (ptrdiff_t count, Lisp_Object value)
 {
   Lisp_Object quitf = Vquit_flag;
   struct gcpro gcpro1, gcpro2;
@@ -3491,7 +3304,7 @@ The debugger is entered when that frame exits, if the flag is non-nil.  */)
   (Lisp_Object level, Lisp_Object flag)
 {
   register struct backtrace *backlist = backtrace_list;
-  register int i;
+  register EMACS_INT i;
 
   CHECK_NUMBER (level);
 
@@ -3630,7 +3443,7 @@ void
 syms_of_eval (void)
 {
   DEFVAR_INT ("max-specpdl-size", max_specpdl_size,
-             doc: /* *Limit on number of Lisp variable bindings and `unwind-protect's.
+             doc: /* Limit on number of Lisp variable bindings and `unwind-protect's.
 If Lisp code tries to increase the total number past this amount,
 an error is signaled.
 You can safely use a value considerably larger than the default value,
@@ -3638,7 +3451,7 @@ if that proves inconveniently small.  However, if you increase it too far,
 Emacs could run out of memory trying to make the stack bigger.  */);
 
   DEFVAR_INT ("max-lisp-eval-depth", max_lisp_eval_depth,
-             doc: /* *Limit on depth in `eval', `apply' and `funcall' before error.
+             doc: /* Limit on depth in `eval', `apply' and `funcall' before error.
 
 This limit serves to catch infinite recursions for you before they cause
 actual stack overflow in C, which would be fatal for Emacs.
@@ -3675,14 +3488,13 @@ before making `inhibit-quit' nil.  */);
 
   DEFSYM (Qinteractive, "interactive");
   DEFSYM (Qcommandp, "commandp");
-  DEFSYM (Qdefun, "defun");
   DEFSYM (Qand_rest, "&rest");
   DEFSYM (Qand_optional, "&optional");
   DEFSYM (Qclosure, "closure");
   DEFSYM (Qdebug, "debug");
 
   DEFVAR_LISP ("debug-on-error", Vdebug_on_error,
-              doc: /* *Non-nil means enter debugger if an error is signaled.
+              doc: /* Non-nil means enter debugger if an error is signaled.
 Does not apply to errors handled by `condition-case' or those
 matched by `debug-ignored-errors'.
 If the value is a list, an error only means to enter the debugger
@@ -3694,7 +3506,7 @@ See also the variable `debug-on-quit'.  */);
   Vdebug_on_error = Qnil;
 
   DEFVAR_LISP ("debug-ignored-errors", Vdebug_ignored_errors,
-    doc: /* *List of errors for which the debugger should not be called.
+    doc: /* List of errors for which the debugger should not be called.
 Each element may be a condition-name or a regexp that matches error messages.
 If any element applies to a given error, that error skips the debugger
 and just returns to top level.
@@ -3703,7 +3515,7 @@ It does not apply to errors handled by `condition-case'.  */);
   Vdebug_ignored_errors = Qnil;
 
   DEFVAR_BOOL ("debug-on-quit", debug_on_quit,
-    doc: /* *Non-nil means enter debugger if quit is signaled (C-g, for example).
+    doc: /* Non-nil means enter debugger if quit is signaled (C-g, for example).
 Does not apply if quit is handled by a `condition-case'.  */);
   debug_on_quit = 0;
 
@@ -3732,28 +3544,21 @@ The Edebug package uses this to regain control.  */);
   Vsignal_hook_function = Qnil;
 
   DEFVAR_LISP ("debug-on-signal", Vdebug_on_signal,
-              doc: /* *Non-nil means call the debugger regardless of condition handlers.
+              doc: /* Non-nil means call the debugger regardless of condition handlers.
 Note that `debug-on-error', `debug-on-quit' and friends
 still determine whether to handle the particular condition.  */);
   Vdebug_on_signal = Qnil;
 
-  DEFVAR_LISP ("macro-declaration-function", Vmacro_declaration_function,
-              doc: /* Function to process declarations in a macro definition.
-The function will be called with two args MACRO and DECL.
-MACRO is the name of the macro being defined.
-DECL is a list `(declare ...)' containing the declarations.
-The value the function returns is not used.  */);
-  Vmacro_declaration_function = Qnil;
-
   /* When lexical binding is being used,
-   vinternal_interpreter_environment is non-nil, and contains an alist
+   Vinternal_interpreter_environment is non-nil, and contains an alist
    of lexically-bound variable, or (t), indicating an empty
    environment.  The lisp name of this variable would be
    `internal-interpreter-environment' if it weren't hidden.
    Every element of this list can be either a cons (VAR . VAL)
    specifying a lexical binding, or a single symbol VAR indicating
    that this variable should use dynamic scoping.  */
-  DEFSYM (Qinternal_interpreter_environment, "internal-interpreter-environment");
+  DEFSYM (Qinternal_interpreter_environment,
+         "internal-interpreter-environment");
   DEFVAR_LISP ("internal-interpreter-environment",
                Vinternal_interpreter_environment,
               doc: /* If non-nil, the current lexical environment of the lisp interpreter.
@@ -3784,12 +3589,10 @@ alist of active lexical bindings.  */);
   defsubr (&Ssetq);
   defsubr (&Squote);
   defsubr (&Sfunction);
-  defsubr (&Sdefun);
-  defsubr (&Sdefmacro);
   defsubr (&Sdefvar);
   defsubr (&Sdefvaralias);
   defsubr (&Sdefconst);
-  defsubr (&Suser_variable_p);
+  defsubr (&Smake_var_non_special);
   defsubr (&Slet);
   defsubr (&SletX);
   defsubr (&Swhile);
index 3b8ed1430057121897c51f94d133418ab57b7680..185dd650438d9ac2454af1fc32ab30ff49c2059e 100644 (file)
@@ -40,8 +40,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "intervals.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "coding.h"
 #include "window.h"
 #include "blockinput.h"
@@ -76,6 +76,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #include "systime.h"
+#include <stat-time.h>
 
 #ifdef HPUX
 #include <netio.h>
@@ -83,17 +84,17 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "commands.h"
 
-/* Nonzero during writing of auto-save files */
+/* Nonzero during writing of auto-save files */
 static int auto_saving;
 
-/* Nonzero umask during creation of auto-save directories */
+/* Nonzero umask during creation of auto-save directories */
 static int auto_saving_dir_umask;
 
 /* Set by auto_save_1 to mode of original file so Fwrite_region will create
-   a new file with the same mode as the original */
+   a new file with the same mode as the original */
 static int auto_save_mode_bits;
 
-/* Set by auto_save_1 if an error occurred during the last auto-save. */
+/* Set by auto_save_1 if an error occurred during the last auto-save.  */
 static int auto_save_error_occurred;
 
 /* The symbol bound to coding-system-for-read when
@@ -107,7 +108,7 @@ static Lisp_Object Qauto_save_coding;
    which gives a list of operations it handles..  */
 static Lisp_Object Qoperations;
 
-/* Lisp functions for translating file formats */
+/* Lisp functions for translating file formats */
 static Lisp_Object Qformat_decode, Qformat_annotate_function;
 
 /* Lisp function for setting buffer-file-coding-system and the
@@ -143,10 +144,9 @@ Lisp_Object Qfile_name_history;
 
 static Lisp_Object Qcar_less_than_car;
 
-static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object);
-static int a_write (int, Lisp_Object, EMACS_INT, EMACS_INT,
+static int a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
                     Lisp_Object *, struct coding_system *);
-static int e_write (int, Lisp_Object, EMACS_INT, EMACS_INT,
+static int e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
                    struct coding_system *);
 
 \f
@@ -256,7 +256,7 @@ use the standard functions without calling themselves recursively.  */)
 {
   /* This function must not munge the match data.  */
   Lisp_Object chain, inhibited_handlers, result;
-  int pos = -1;
+  ptrdiff_t pos = -1;
 
   result = Qnil;
   CHECK_STRING (filename);
@@ -274,7 +274,7 @@ use the standard functions without calling themselves recursively.  */)
       if (CONSP (elt))
        {
          Lisp_Object string = XCAR (elt);
-         EMACS_INT match_pos;
+         ptrdiff_t match_pos;
          Lisp_Object handler = XCDR (elt);
          Lisp_Object operations = Qnil;
 
@@ -331,7 +331,7 @@ Given a Unix syntax file name, returns a string ending in slash.  */)
     }
 
 #ifdef DOS_NT
-  beg = (char *) alloca (SBYTES (filename) + 1);
+  beg = alloca (SBYTES (filename) + 1);
   memcpy (beg, SSDATA (filename), SBYTES (filename) + 1);
 #else
   beg = SSDATA (filename);
@@ -360,7 +360,7 @@ Given a Unix syntax file name, returns a string ending in slash.  */)
 
       if (p == beg + 4 && IS_DIRECTORY_SEP (*beg) && beg[1] == ':')
        {
-         strncpy (res, beg, 2);
+         memcpy (res, beg, 2);
          beg += 2;
          r += 2;
        }
@@ -448,32 +448,33 @@ get a current directory to run processes in.  */)
   return Ffile_name_directory (filename);
 }
 
-\f
-static char *
-file_name_as_directory (char *out, const char *in)
-{
-  ptrdiff_t len = strlen (in);
+/* Convert from file name SRC of length SRCLEN to directory name
+   in DST.  On UNIX, just make sure there is a terminating /.
+   Return the length of DST.  */
 
-  if (len == 0)
+static ptrdiff_t
+file_name_as_directory (char *dst, const char *src, ptrdiff_t srclen)
+{
+  if (srclen == 0)
     {
-      out[0] = '.';
-      out[1] = '/';
-      out[2] = 0;
-      return out;
+      dst[0] = '.';
+      dst[1] = '/';
+      dst[2] = '\0';
+      return 2;
     }
 
-  strcpy (out, in);
+  strcpy (dst, src);
 
-  /* For Unix syntax, Append a slash if necessary */
-  if (!IS_DIRECTORY_SEP (out[len - 1]))
+  if (!IS_DIRECTORY_SEP (dst[srclen - 1]))
     {
-      out[len] = DIRECTORY_SEP;
-      out[len + 1] = '\0';
+      dst[srclen] = DIRECTORY_SEP;
+      dst[srclen + 1] = '\0';
+      srclen++;
     }
 #ifdef DOS_NT
-  dostounix_filename (out);
+  dostounix_filename (dst);
 #endif
-  return out;
+  return srclen;
 }
 
 DEFUN ("file-name-as-directory", Ffile_name_as_directory,
@@ -487,6 +488,7 @@ For a Unix-syntax file name, just appends a slash.  */)
   (Lisp_Object file)
 {
   char *buf;
+  ptrdiff_t length;
   Lisp_Object handler;
 
   CHECK_STRING (file);
@@ -505,40 +507,35 @@ For a Unix-syntax file name, just appends a slash.  */)
       error ("Invalid handler in `file-name-handler-alist'");
     }
 
-  buf = (char *) alloca (SBYTES (file) + 10);
-  file_name_as_directory (buf, SSDATA (file));
-  return make_specified_string (buf, -1, strlen (buf),
-                               STRING_MULTIBYTE (file));
+  buf = alloca (SBYTES (file) + 10);
+  length = file_name_as_directory (buf, SSDATA (file), SBYTES (file));
+  return make_specified_string (buf, -1, length, STRING_MULTIBYTE (file));
 }
 \f
-/*
- * Convert from directory name to filename.
- * On UNIX, it's simple: just make sure there isn't a terminating /
-
- * Value is nonzero if the string output is different from the input.
- */
+/* Convert from directory name SRC of length SRCLEN to
+   file name in DST.  On UNIX, just make sure there isn't
+   a terminating /.  Return the length of DST.  */
 
-static int
-directory_file_name (char *src, char *dst)
+static ptrdiff_t
+directory_file_name (char *dst, char *src, ptrdiff_t srclen)
 {
-  ptrdiff_t slen;
-
-  slen = strlen (src);
-
   /* Process as Unix format: just remove any final slash.
      But leave "/" unchanged; do not change it to "".  */
   strcpy (dst, src);
-  if (slen > 1
-      && IS_DIRECTORY_SEP (dst[slen - 1])
+  if (srclen > 1
+      && IS_DIRECTORY_SEP (dst[srclen - 1])
 #ifdef DOS_NT
-      && !IS_ANY_SEP (dst[slen - 2])
+      && !IS_ANY_SEP (dst[srclen - 2])
 #endif
       )
-    dst[slen - 1] = 0;
+    {
+      dst[srclen - 1] = 0;
+      srclen--;
+    }
 #ifdef DOS_NT
   dostounix_filename (dst);
 #endif
-  return 1;
+  return srclen;
 }
 
 DEFUN ("directory-file-name", Fdirectory_file_name, Sdirectory_file_name,
@@ -551,6 +548,7 @@ In Unix-syntax, this function just removes the final slash.  */)
   (Lisp_Object directory)
 {
   char *buf;
+  ptrdiff_t length;
   Lisp_Object handler;
 
   CHECK_STRING (directory);
@@ -570,10 +568,9 @@ In Unix-syntax, this function just removes the final slash.  */)
       error ("Invalid handler in `file-name-handler-alist'");
     }
 
-  buf = (char *) alloca (SBYTES (directory) + 20);
-  directory_file_name (SSDATA (directory), buf);
-  return make_specified_string (buf, -1, strlen (buf),
-                               STRING_MULTIBYTE (directory));
+  buf = alloca (SBYTES (directory) + 20);
+  length = directory_file_name (buf, SSDATA (directory), SBYTES (directory));
+  return make_specified_string (buf, -1, length, STRING_MULTIBYTE (directory));
 }
 
 static const char make_temp_name_tbl[64] =
@@ -871,8 +868,8 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
        }
     }
 
-  /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below. */
-  nm = (char *) alloca (SBYTES (name) + 1);
+  /* Make a local copy of nm[] to protect it from GC in DECODE_FILE below.  */
+  nm = alloca (SBYTES (name) + 1);
   memcpy (nm, SSDATA (name), SBYTES (name) + 1);
 
 #ifdef DOS_NT
@@ -899,7 +896,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
   if (drive && IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
     nm++;
 
-  /* Discard any previous drive specifier if nm is now in UNC format. */
+  /* Discard any previous drive specifier if nm is now in UNC format.  */
   if (IS_DIRECTORY_SEP (nm[0]) && IS_DIRECTORY_SEP (nm[1]))
     {
       drive = 0;
@@ -964,7 +961,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
            }
          else
 #endif
-         /* drive must be set, so this is okay */
+         /* Drive must be set, so this is okay.  */
          if (strcmp (nm - 2, SSDATA (name)) != 0)
            {
              char temp[] = " :";
@@ -1010,7 +1007,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
          if (!(newdir = egetenv ("HOME")))
            newdir = "";
          nm++;
-         /* egetenv may return a unibyte string, which will bite us since
+         /* `egetenv' may return a unibyte string, which will bite us since
             we expect the directory to be multibyte.  */
          tem = build_string (newdir);
          if (!STRING_MULTIBYTE (tem))
@@ -1052,7 +1049,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
      use the drive's current directory as the prefix if needed.  */
   if (!newdir && drive)
     {
-      /* Get default directory if needed to make nm absolute. */
+      /* Get default directory if needed to make nm absolute.  */
       char *adir = NULL;
       if (!IS_DIRECTORY_SEP (nm[0]))
        {
@@ -1062,7 +1059,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
        }
       if (!adir)
        {
-         /* Either nm starts with /, or drive isn't mounted. */
+         /* Either nm starts with /, or drive isn't mounted.  */
          adir = alloca (4);
          adir[0] = DRIVE_LETTER (drive);
          adir[1] = ':';
@@ -1074,11 +1071,11 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
 #endif /* DOS_NT */
 
   /* Finally, if no prefix has been specified and nm is not absolute,
-     then it must be expanded relative to default_directory. */
+     then it must be expanded relative to default_directory.  */
 
   if (1
 #ifndef DOS_NT
-      /* /... alone is not absolute on DOS and Windows. */
+      /* /... alone is not absolute on DOS and Windows.  */
       && !IS_DIRECTORY_SEP (nm[0])
 #endif
 #ifdef WINDOWSNT
@@ -1100,7 +1097,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
 #ifdef DOS_NT
   if (newdir)
     {
-      /* First ensure newdir is an absolute name. */
+      /* First ensure newdir is an absolute name.  */
       if (
          /* Detect MSDOS file names with drive specifiers.  */
          ! (IS_DRIVE (newdir[0])
@@ -1115,7 +1112,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
             Because of the admonition against calling expand-file-name
             when we have pointers into lisp strings, we accomplish this
             indirectly by prepending newdir to nm if necessary, and using
-            cwd (or the wd of newdir's drive) as the new newdir. */
+            cwd (or the wd of newdir's drive) as the new newdir.  */
          char *adir;
          if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1]))
            {
@@ -1124,8 +1121,9 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
            }
          if (!IS_DIRECTORY_SEP (nm[0]))
            {
-             char * tmp = alloca (strlen (newdir) + strlen (nm) + 2);
-             file_name_as_directory (tmp, newdir);
+             ptrdiff_t newlen = strlen (newdir);
+             char *tmp = alloca (newlen + strlen (nm) + 2);
+             file_name_as_directory (tmp, newdir, newlen);
              strcat (tmp, nm);
              nm = tmp;
            }
@@ -1140,7 +1138,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
          newdir = adir;
        }
 
-      /* Strip off drive name from prefix, if present. */
+      /* Strip off drive name from prefix, if present.  */
       if (IS_DRIVE (newdir[0]) && IS_DEVICE_SEP (newdir[1]))
        {
          drive = newdir[0];
@@ -1174,32 +1172,36 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
       /* Get rid of any slash at the end of newdir, unless newdir is
         just / or // (an incomplete UNC name).  */
       length = strlen (newdir);
+      tlen = length + 1;
       if (length > 1 && IS_DIRECTORY_SEP (newdir[length - 1])
 #ifdef WINDOWSNT
          && !(length == 2 && IS_DIRECTORY_SEP (newdir[0]))
 #endif
          )
        {
-         char *temp = (char *) alloca (length);
+         char *temp = alloca (length);
          memcpy (temp, newdir, length - 1);
          temp[length - 1] = 0;
+         length--;
          newdir = temp;
        }
-      tlen = length + 1;
     }
   else
-    tlen = 0;
+    {
+      length = 0;
+      tlen = 0;
+    }
 
-  /* Now concatenate the directory and name to new space in the stack frame */
+  /* Now concatenate the directory and name to new space in the stack frame */
   tlen += strlen (nm) + 1;
 #ifdef DOS_NT
   /* Reserve space for drive specifier and escape prefix, since either
      or both may need to be inserted.  (The Microsoft x86 compiler
      produces incorrect code if the following two lines are combined.)  */
-  target = (char *) alloca (tlen + 4);
+  target = alloca (tlen + 4);
   target += 4;
 #else  /* not DOS_NT */
-  target = (char *) alloca (tlen);
+  target = alloca (tlen);
 #endif /* not DOS_NT */
   *target = 0;
 
@@ -1219,7 +1221,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
            strcpy (target, newdir);
        }
       else
-       file_name_as_directory (target, newdir);
+       file_name_as_directory (target, newdir, length);
     }
 
   strcat (target, nm);
@@ -1286,7 +1288,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
       }
 
 #ifdef DOS_NT
-    /* At last, set drive name. */
+    /* At last, set drive name.  */
 #ifdef WINDOWSNT
     /* Except for network file name.  */
     if (!(IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1])))
@@ -1314,7 +1316,7 @@ filesystem tree, not (expand-file-name ".."  dirname).  */)
      and perhaps call the corresponding file handler.  This is needed
      for filenames such as "/foo/../user@host:/bar/../baz".  Expanding
      the ".." component gives us "/user@host:/bar/../baz" which needs
-     to be expanded again. */
+     to be expanded again.  */
   handler = Ffind_file_name_handler (result, Qexpand_file_name);
   if (!NILP (handler))
     {
@@ -1390,7 +1392,7 @@ See also the function `substitute-in-file-name'.")
        }
     }
 
-  /* Now determine directory to start with and put it in NEWDIR */
+  /* Now determine directory to start with and put it in NEWDIR */
 
   newdir = 0;
 
@@ -1403,17 +1405,17 @@ See also the function `substitute-in-file-name'.")
       }
     else  /* ~user/filename */
       {
-       /* Get past ~ to user */
+       /* Get past ~ to user */
        unsigned char *user = nm + 1;
-       /* Find end of name. */
+       /* Find end of name.  */
        unsigned char *ptr = (unsigned char *) strchr (user, '/');
        ptrdiff_t len = ptr ? ptr - user : strlen (user);
-       /* Copy the user name into temp storage. */
-       o = (unsigned char *) alloca (len + 1);
+       /* Copy the user name into temp storage.  */
+       o = alloca (len + 1);
        memcpy (o, user, len);
        o[len] = 0;
 
-       /* Look up the user name. */
+       /* Look up the user name.  */
        BLOCK_INPUT;
        pw = (struct passwd *) getpwnam (o + 1);
        UNBLOCK_INPUT;
@@ -1434,10 +1436,10 @@ See also the function `substitute-in-file-name'.")
       newdir = SDATA (defalt);
     }
 
-  /* Now concatenate the directory and name to new space in the stack frame */
+  /* Now concatenate the directory and name to new space in the stack frame */
 
   tlen = (newdir ? strlen (newdir) + 1 : 0) + strlen (nm) + 1;
-  target = (unsigned char *) alloca (tlen);
+  target = alloca (tlen);
   *target = 0;
 
   if (newdir)
@@ -1450,7 +1452,7 @@ See also the function `substitute-in-file-name'.")
 
   strcat (target, nm);
 
-  /* Now canonicalize by removing /. and /foo/.. if they appear */
+  /* Now canonicalize by removing /. and /foo/.. if they appear */
 
   p = target;
   o = target;
@@ -1522,7 +1524,7 @@ search_embedded_absfilename (char *nm, char *endp)
              )
        {
          for (s = p; *s && (!IS_DIRECTORY_SEP (*s)); s++);
-         if (p[0] == '~' && s > p + 1) /* we've got "/~something/" */
+         if (p[0] == '~' && s > p + 1) /* We've got "/~something/".  */
            {
              char *o = alloca (s - p + 1);
              struct passwd *pw;
@@ -1587,7 +1589,7 @@ those `/' is discarded.  */)
   /* Always work on a copy of the string, in case GC happens during
      decode of environment variables, causing the original Lisp_String
      data to be relocated.  */
-  nm = (char *) alloca (SBYTES (filename) + 1);
+  nm = alloca (SBYTES (filename) + 1);
   memcpy (nm, SDATA (filename), SBYTES (filename) + 1);
 
 #ifdef DOS_NT
@@ -1606,7 +1608,7 @@ those `/' is discarded.  */)
       (make_specified_string (p, -1, endp - p, multibyte));
 
   /* See if any variables are substituted into the string
-     and find the total length of their values in `total' */
+     and find the total length of their values in `total' */
 
   for (p = nm; p != endp;)
     if (*p != '$')
@@ -1618,7 +1620,7 @@ those `/' is discarded.  */)
          goto badsubst;
        else if (*p == '$')
          {
-           /* "$$" means a single "$" */
+           /* "$$" means a single "$" */
            p++;
            total -= 1;
            substituted = 1;
@@ -1638,15 +1640,15 @@ those `/' is discarded.  */)
            s = p;
          }
 
-       /* Copy out the variable name */
-       target = (char *) alloca (s - o + 1);
-       strncpy (target, o, s - o);
+       /* Copy out the variable name */
+       target = alloca (s - o + 1);
+       memcpy (target, o, s - o);
        target[s - o] = 0;
 #ifdef DOS_NT
        strupr (target); /* $home == $HOME etc.  */
 #endif /* DOS_NT */
 
-       /* Get variable value */
+       /* Get variable value */
        o = egetenv (target);
        if (o)
          {
@@ -1668,12 +1670,12 @@ those `/' is discarded.  */)
   if (!substituted)
     return filename;
 
-  /* If substitution required, recopy the string and do it */
-  /* Make space in stack frame for the new copy */
-  xnm = (char *) alloca (SBYTES (filename) + total + 1);
+  /* If substitution required, recopy the string and do it */
+  /* Make space in stack frame for the new copy */
+  xnm = alloca (SBYTES (filename) + total + 1);
   x = xnm;
 
-  /* Copy the rest of the name through, replacing $ constructs with values */
+  /* Copy the rest of the name through, replacing $ constructs with values */
   for (p = nm; *p;)
     if (*p != '$')
       *x++ = *p++;
@@ -1701,15 +1703,15 @@ those `/' is discarded.  */)
            s = p;
          }
 
-       /* Copy out the variable name */
-       target = (char *) alloca (s - o + 1);
-       strncpy (target, o, s - o);
+       /* Copy out the variable name */
+       target = alloca (s - o + 1);
+       memcpy (target, o, s - o);
        target[s - o] = 0;
 #ifdef DOS_NT
        strupr (target); /* $home == $HOME etc.  */
 #endif /* DOS_NT */
 
-       /* Get variable value */
+       /* Get variable value */
        o = egetenv (target);
        if (!o)
          {
@@ -1724,13 +1726,13 @@ those `/' is discarded.  */)
            orig = make_unibyte_string (o, orig_length);
            decoded = DECODE_FILE (orig);
            decoded_length = SBYTES (decoded);
-           strncpy (x, SSDATA (decoded), decoded_length);
+           memcpy (x, SDATA (decoded), decoded_length);
            x += decoded_length;
 
            /* If environment variable needed decoding, return value
               needs to be multibyte.  */
            if (decoded_length != orig_length
-               || strncmp (SSDATA (decoded), o, orig_length))
+               || memcmp (SDATA (decoded), o, orig_length))
              multibyte = 1;
          }
       }
@@ -1771,7 +1773,7 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
      stat behaves differently depending!  */
   if (SCHARS (absname) > 1
       && IS_DIRECTORY_SEP (SREF (absname, SBYTES (absname) - 1))
-      && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname)-2)))
+      && !IS_DEVICE_SEP (SREF (absname, SBYTES (absname) - 2)))
     /* We cannot take shortcuts; they might be wrong for magic file names.  */
     absname = Fdirectory_file_name (absname);
   return absname;
@@ -1799,7 +1801,7 @@ barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring,
 
   encoded_filename = ENCODE_FILE (absname);
 
-  /* stat is a good way to tell whether the file exists,
+  /* `stat' is a good way to tell whether the file exists,
      regardless of what access permissions it has.  */
   if (lstat (SSDATA (encoded_filename), &statbuf) >= 0)
     {
@@ -1861,12 +1863,12 @@ on the system, we copy the SELinux context of FILE to NEWNAME.  */)
   (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context)
 {
   int ifd, ofd;
-  EMACS_INT n;
+  int n;
   char buf[16 * 1024];
   struct stat st, out_st;
   Lisp_Object handler;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   int input_file_statable_p;
   Lisp_Object encoded_file, encoded_newname;
 #if HAVE_LIBSELINUX
@@ -1919,13 +1921,13 @@ on the system, we copy the SELinux context of FILE to NEWNAME.  */)
       DWORD attributes;
       char * filename;
 
-      EMACS_GET_TIME (now);
       filename = SDATA (encoded_newname);
 
       /* Ensure file is writable while its modified time is set.  */
       attributes = GetFileAttributes (filename);
       SetFileAttributes (filename, attributes & ~FILE_ATTRIBUTE_READONLY);
-      if (set_file_times (filename, now, now))
+      now = current_emacs_time ();
+      if (set_file_times (-1, filename, now, now))
        {
          /* Restore original attributes.  */
          SetFileAttributes (filename, attributes);
@@ -2048,24 +2050,21 @@ on the system, we copy the SELinux context of FILE to NEWNAME.  */)
     }
 #endif
 
-  /* Closing the output clobbers the file times on some systems.  */
-  if (emacs_close (ofd) < 0)
-    report_file_error ("I/O error", Fcons (newname, Qnil));
-
   if (input_file_statable_p)
     {
       if (!NILP (keep_time))
        {
-         EMACS_TIME atime, mtime;
-         EMACS_SET_SECS_USECS (atime, st.st_atime, 0);
-         EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
-         if (set_file_times (SSDATA (encoded_newname),
-                             atime, mtime))
+         EMACS_TIME atime = get_stat_atime (&st);
+         EMACS_TIME mtime = get_stat_mtime (&st);
+         if (set_file_times (ofd, SSDATA (encoded_newname), atime, mtime))
            xsignal2 (Qfile_date_error,
                      build_string ("Cannot set file date"), newname);
        }
     }
 
+  if (emacs_close (ofd) < 0)
+    report_file_error ("I/O error", Fcons (newname, Qnil));
+
   emacs_close (ifd);
 
 #ifdef MSDOS
@@ -2259,7 +2258,7 @@ This is what happens in interactive use with M-x.  */)
     {
       if (errno == EXDEV)
        {
-          int count;
+          ptrdiff_t count;
           symlink_target = Ffile_symlink_p (file);
           if (! NILP (symlink_target))
             Fmake_symbolic_link (symlink_target, newname,
@@ -3008,8 +3007,10 @@ The value is an integer.  */)
   int realmask;
   Lisp_Object value;
 
+  BLOCK_INPUT;
   realmask = umask (0);
   umask (realmask);
+  UNBLOCK_INPUT;
 
   XSETINT (value, (~ realmask) & 0777);
   return value;
@@ -3026,11 +3027,7 @@ Use the current time if TIMESTAMP is nil.  TIMESTAMP is in the format of
 {
   Lisp_Object absname, encoded_absname;
   Lisp_Object handler;
-  time_t sec;
-  int usec;
-
-  if (! lisp_time_argument (timestamp, &sec, &usec))
-    error ("Invalid time specification");
+  EMACS_TIME t = lisp_time_argument (timestamp);
 
   absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
 
@@ -3043,12 +3040,7 @@ Use the current time if TIMESTAMP is nil.  TIMESTAMP is in the format of
   encoded_absname = ENCODE_FILE (absname);
 
   {
-    EMACS_TIME t;
-
-    EMACS_SET_SECS (t, sec);
-    EMACS_SET_USECS (t, usec);
-
-    if (set_file_times (SSDATA (encoded_absname), t, t))
+    if (set_file_times (-1, SSDATA (encoded_absname), t, t))
       {
 #ifdef DOS_NT
         struct stat st;
@@ -3083,8 +3075,7 @@ otherwise, if FILE2 does not exist, the answer is t.  */)
   (Lisp_Object file1, Lisp_Object file2)
 {
   Lisp_Object absname1, absname2;
-  struct stat st;
-  int mtime1;
+  struct stat st1, st2;
   Lisp_Object handler;
   struct gcpro gcpro1, gcpro2;
 
@@ -3110,20 +3101,21 @@ otherwise, if FILE2 does not exist, the answer is t.  */)
   absname2 = ENCODE_FILE (absname2);
   UNGCPRO;
 
-  if (stat (SSDATA (absname1), &st) < 0)
+  if (stat (SSDATA (absname1), &st1) < 0)
     return Qnil;
 
-  mtime1 = st.st_mtime;
-
-  if (stat (SSDATA (absname2), &st) < 0)
+  if (stat (SSDATA (absname2), &st2) < 0)
     return Qt;
 
-  return (mtime1 > st.st_mtime) ? Qt : Qnil;
+  return (EMACS_TIME_GT (get_stat_mtime (&st1), get_stat_mtime (&st2))
+         ? Qt : Qnil);
 }
 \f
 #ifndef READ_BUF_SIZE
 #define READ_BUF_SIZE (64 << 10)
 #endif
+/* Some buffer offsets are stored in 'int' variables.  */
+verify (READ_BUF_SIZE <= INT_MAX);
 
 /* This function is called after Lisp functions to decide a coding
    system are called, or when they cause an error.  Before they are
@@ -3168,8 +3160,8 @@ decide_coding_unwind (Lisp_Object unwind_data)
 /* Used to pass values from insert-file-contents to read_non_regular.  */
 
 static int non_regular_fd;
-static EMACS_INT non_regular_inserted;
-static EMACS_INT non_regular_nbytes;
+static ptrdiff_t non_regular_inserted;
+static int non_regular_nbytes;
 
 
 /* Read from a non-regular file.
@@ -3180,7 +3172,7 @@ static EMACS_INT non_regular_nbytes;
 static Lisp_Object
 read_non_regular (Lisp_Object ignore)
 {
-  EMACS_INT nbytes;
+  int nbytes;
 
   immediate_quit = 1;
   QUIT;
@@ -3217,6 +3209,15 @@ emacs_lseek (int fd, EMACS_INT offset, int whence)
   return lseek (fd, offset, whence);
 }
 
+/* Return a special time value indicating the error number ERRNUM.  */
+static EMACS_TIME
+time_error_value (int errnum)
+{
+  int ns = (errnum == ENOENT || errnum == EACCES || errnum == ENOTDIR
+           ? NONEXISTENT_MODTIME_NSECS
+           : UNKNOWN_MODTIME_NSECS);
+  return make_emacs_time (0, ns);
+}
 
 DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents,
        1, 5, 0,
@@ -3244,17 +3245,19 @@ variable `last-coding-system-used' to the coding system actually used.  */)
   (Lisp_Object filename, Lisp_Object visit, Lisp_Object beg, Lisp_Object end, Lisp_Object replace)
 {
   struct stat st;
+  int file_status;
+  EMACS_TIME mtime;
   register int fd;
-  EMACS_INT inserted = 0;
+  ptrdiff_t inserted = 0;
   int nochange = 0;
-  register EMACS_INT how_much;
+  register ptrdiff_t how_much;
   off_t beg_offset, end_offset;
-  register EMACS_INT unprocessed;
-  int count = SPECPDL_INDEX ();
+  register int unprocessed;
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object handler, val, insval, orig_filename, old_undo;
   Lisp_Object p;
-  EMACS_INT total = 0;
+  ptrdiff_t total = 0;
   int not_regular = 0;
   int save_errno = 0;
   char read_buf[READ_BUF_SIZE];
@@ -3295,7 +3298,8 @@ variable `last-coding-system-used' to the coding system actually used.  */)
     {
       val = call6 (handler, Qinsert_file_contents, filename,
                   visit, beg, end, replace);
-      if (CONSP (val) && CONSP (XCDR (val)))
+      if (CONSP (val) && CONSP (XCDR (val))
+         && RANGED_INTEGERP (0, XCAR (XCDR (val)), ZV - PT))
        inserted = XINT (XCAR (XCDR (val)));
       goto handled;
     }
@@ -3311,19 +3315,22 @@ variable `last-coding-system-used' to the coding system actually used.  */)
 
     /* Tell stat to use expensive method to get accurate info.  */
     Vw32_get_true_file_attributes = Qt;
-    total = stat (SSDATA (filename), &st);
+    file_status = stat (SSDATA (filename), &st);
     Vw32_get_true_file_attributes = tem;
   }
-  if (total < 0)
 #else
-  if (stat (SSDATA (filename), &st) < 0)
+  file_status = stat (SSDATA (filename), &st);
 #endif /* WINDOWSNT */
+
+  if (file_status == 0)
+    mtime = get_stat_mtime (&st);
+  else
     {
     badopen:
       save_errno = errno;
       if (NILP (visit))
        report_file_error ("Opening input file", Fcons (orig_filename, Qnil));
-      st.st_mtime = -1;
+      mtime = time_error_value (save_errno);
       st.st_size = -1;
       how_much = 0;
       if (!NILP (Vcoding_system_for_read))
@@ -3449,7 +3456,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
                 We assume that the 1K-byte and 3K-byte for heading
                 and tailing respectively are sufficient for this
                 purpose.  */
-             EMACS_INT nread;
+             int nread;
 
              if (st.st_size <= (1024 * 4))
                nread = emacs_read (fd, read_buf, 1024 * 4);
@@ -3559,9 +3566,9 @@ variable `last-coding-system-used' to the coding system actually used.  */)
       /* same_at_start and same_at_end count bytes,
         because file access counts bytes
         and BEG and END count bytes.  */
-      EMACS_INT same_at_start = BEGV_BYTE;
-      EMACS_INT same_at_end = ZV_BYTE;
-      EMACS_INT overlap;
+      ptrdiff_t same_at_start = BEGV_BYTE;
+      ptrdiff_t same_at_end = ZV_BYTE;
+      ptrdiff_t overlap;
       /* There is still a possibility we will find the need to do code
         conversion.  If that happens, we set this variable to 1 to
         give up on handling REPLACE in the optimized way.  */
@@ -3580,7 +3587,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
         match the text at the beginning of the buffer.  */
       while (1)
        {
-         EMACS_INT nread, bufpos;
+         int nread, bufpos;
 
          nread = emacs_read (fd, buffer, sizeof buffer);
          if (nread < 0)
@@ -3689,7 +3696,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
 
       if (! giveup_match_end)
        {
-         EMACS_INT temp;
+         ptrdiff_t temp;
 
          /* We win!  We can handle REPLACE the optimized way.  */
 
@@ -3726,7 +3733,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
          /* If display currently starts at beginning of line,
             keep it that way.  */
          if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer)
-           XWINDOW (selected_window)->start_at_line_beg = Fbolp ();
+           XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
 
          replace_handled = 1;
        }
@@ -3743,16 +3750,16 @@ variable `last-coding-system-used' to the coding system actually used.  */)
      in a more optimized way.  */
   if (!NILP (replace) && ! replace_handled && BEGV < ZV)
     {
-      EMACS_INT same_at_start = BEGV_BYTE;
-      EMACS_INT same_at_end = ZV_BYTE;
-      EMACS_INT same_at_start_charpos;
-      EMACS_INT inserted_chars;
-      EMACS_INT overlap;
-      EMACS_INT bufpos;
+      ptrdiff_t same_at_start = BEGV_BYTE;
+      ptrdiff_t same_at_end = ZV_BYTE;
+      ptrdiff_t same_at_start_charpos;
+      ptrdiff_t inserted_chars;
+      ptrdiff_t overlap;
+      ptrdiff_t bufpos;
       unsigned char *decoded;
-      EMACS_INT temp;
-      EMACS_INT this = 0;
-      int this_count = SPECPDL_INDEX ();
+      ptrdiff_t temp;
+      ptrdiff_t this = 0;
+      ptrdiff_t this_count = SPECPDL_INDEX ();
       int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
       Lisp_Object conversion_buffer;
       struct gcpro gcpro1;
@@ -3777,8 +3784,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
          /* We read one bunch by one (READ_BUF_SIZE bytes) to allow
             quitting while reading a huge while.  */
          /* `try'' is reserved in some compilers (Microsoft C).  */
-         EMACS_INT trytry = min (total - how_much,
-                                 READ_BUF_SIZE - unprocessed);
+         int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed);
 
          /* Allow quitting out of the actual I/O.  */
          immediate_quit = 1;
@@ -3884,7 +3890,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
       /* If display currently starts at beginning of line,
         keep it that way.  */
       if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer)
-       XWINDOW (selected_window)->start_at_line_beg = Fbolp ();
+       XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ());
 
       /* Replace the chars that we need to replace,
         and update INSERTED to equal the number of bytes
@@ -3969,13 +3975,13 @@ variable `last-coding-system-used' to the coding system actually used.  */)
   /* Here, we don't do code conversion in the loop.  It is done by
      decode_coding_gap after all data are read into the buffer.  */
   {
-    EMACS_INT gap_size = GAP_SIZE;
+    ptrdiff_t gap_size = GAP_SIZE;
 
     while (how_much < total)
       {
        /* try is reserved in some compilers (Microsoft C) */
-       EMACS_INT trytry = min (total - how_much, READ_BUF_SIZE);
-       EMACS_INT this;
+       int trytry = min (total - how_much, READ_BUF_SIZE);
+       ptrdiff_t this;
 
        if (not_regular)
          {
@@ -4094,7 +4100,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
             care of marker adjustment.  By this way, we can run Lisp
             program safely before decoding the inserted text.  */
          Lisp_Object unwind_data;
-         int count1 = SPECPDL_INDEX ();
+         ptrdiff_t count1 = SPECPDL_INDEX ();
 
          unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters),
                               Fcons (BVAR (current_buffer, undo_list),
@@ -4195,7 +4201,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
 
       if (NILP (handler))
        {
-         current_buffer->modtime = st.st_mtime;
+         current_buffer->modtime = mtime;
          current_buffer->modtime_size = st.st_size;
          BVAR (current_buffer, filename) = orig_filename;
        }
@@ -4225,7 +4231,8 @@ variable `last-coding-system-used' to the coding system actually used.  */)
                      visit);
       if (! NILP (insval))
        {
-         CHECK_NUMBER (insval);
+         if (! RANGED_INTEGERP (0, insval, ZV - PT))
+           wrong_type_argument (intern ("inserted-chars"), insval);
          inserted = XFASTINT (insval);
        }
     }
@@ -4234,8 +4241,8 @@ variable `last-coding-system-used' to the coding system actually used.  */)
   if (inserted > 0)
     {
       /* Don't run point motion or modification hooks when decoding.  */
-      int count1 = SPECPDL_INDEX ();
-      EMACS_INT old_inserted = inserted;
+      ptrdiff_t count1 = SPECPDL_INDEX ();
+      ptrdiff_t old_inserted = inserted;
       specbind (Qinhibit_point_motion_hooks, Qt);
       specbind (Qinhibit_modification_hooks, Qt);
 
@@ -4247,7 +4254,8 @@ variable `last-coding-system-used' to the coding system actually used.  */)
        {
          insval = call3 (Qformat_decode,
                          Qnil, make_number (inserted), visit);
-         CHECK_NUMBER (insval);
+         if (! RANGED_INTEGERP (0, insval, ZV - PT))
+           wrong_type_argument (intern ("inserted-chars"), insval);
          inserted = XFASTINT (insval);
        }
       else
@@ -4261,15 +4269,16 @@ variable `last-coding-system-used' to the coding system actually used.  */)
             Hence we temporarily save `point' and `inserted' here and
             restore `point' iff format-decode did not insert or delete
             any text.  Otherwise we leave `point' at point-min.  */
-         EMACS_INT opoint = PT;
-         EMACS_INT opoint_byte = PT_BYTE;
-         EMACS_INT oinserted = ZV - BEGV;
-         int ochars_modiff = CHARS_MODIFF;
+         ptrdiff_t opoint = PT;
+         ptrdiff_t opoint_byte = PT_BYTE;
+         ptrdiff_t oinserted = ZV - BEGV;
+         EMACS_INT ochars_modiff = CHARS_MODIFF;
 
          TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
          insval = call3 (Qformat_decode,
                          Qnil, make_number (oinserted), visit);
-         CHECK_NUMBER (insval);
+         if (! RANGED_INTEGERP (0, insval, ZV - PT))
+           wrong_type_argument (intern ("inserted-chars"), insval);
          if (ochars_modiff == CHARS_MODIFF)
            /* format_decode didn't modify buffer's characters => move
               point back to position before inserted text and leave
@@ -4291,7 +4300,8 @@ variable `last-coding-system-used' to the coding system actually used.  */)
              insval = call1 (XCAR (p), make_number (inserted));
              if (!NILP (insval))
                {
-                 CHECK_NUMBER (insval);
+                 if (! RANGED_INTEGERP (0, insval, ZV - PT))
+                   wrong_type_argument (intern ("inserted-chars"), insval);
                  inserted = XFASTINT (insval);
                }
            }
@@ -4299,16 +4309,17 @@ variable `last-coding-system-used' to the coding system actually used.  */)
            {
              /* For the rationale of this see the comment on
                 format-decode above.  */
-             EMACS_INT opoint = PT;
-             EMACS_INT opoint_byte = PT_BYTE;
-             EMACS_INT oinserted = ZV - BEGV;
-             int ochars_modiff = CHARS_MODIFF;
+             ptrdiff_t opoint = PT;
+             ptrdiff_t opoint_byte = PT_BYTE;
+             ptrdiff_t oinserted = ZV - BEGV;
+             EMACS_INT ochars_modiff = CHARS_MODIFF;
 
              TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
              insval = call1 (XCAR (p), make_number (oinserted));
              if (!NILP (insval))
                {
-                 CHECK_NUMBER (insval);
+                 if (! RANGED_INTEGERP (0, insval, ZV - PT))
+                   wrong_type_argument (intern ("inserted-chars"), insval);
                  if (ochars_modiff == CHARS_MODIFF)
                    /* after_insert_file_functions didn't modify
                       buffer's characters => move point back to
@@ -4350,7 +4361,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
     }
 
   if (!NILP (visit)
-      && current_buffer->modtime == -1)
+      && EMACS_NSECS (current_buffer->modtime) == NONEXISTENT_MODTIME_NSECS)
     {
       /* If visiting nonexistent file, return nil.  */
       errno = save_errno;
@@ -4531,7 +4542,7 @@ This calls `write-region-annotate-functions' at the start, and
   int save_errno = 0;
   const char *fn;
   struct stat st;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   int count1;
   Lisp_Object handler;
   Lisp_Object visit_file;
@@ -4788,7 +4799,7 @@ This calls `write-region-annotate-functions' at the start, and
      next attempt to save.  */
   if (visiting)
     {
-      current_buffer->modtime = st.st_mtime;
+      current_buffer->modtime = get_stat_mtime (&st);
       current_buffer->modtime_size = st.st_size;
     }
 
@@ -4931,13 +4942,13 @@ build_annotations (Lisp_Object start, Lisp_Object end)
    The return value is negative in case of system call failure.  */
 
 static int
-a_write (int desc, Lisp_Object string, EMACS_INT pos,
-        register EMACS_INT nchars, Lisp_Object *annot,
+a_write (int desc, Lisp_Object string, ptrdiff_t pos,
+        register ptrdiff_t nchars, Lisp_Object *annot,
         struct coding_system *coding)
 {
   Lisp_Object tem;
-  EMACS_INT nextpos;
-  EMACS_INT lastpos = pos + nchars;
+  ptrdiff_t nextpos;
+  ptrdiff_t lastpos = pos + nchars;
 
   while (NILP (*annot) || CONSP (*annot))
     {
@@ -4977,7 +4988,7 @@ a_write (int desc, Lisp_Object string, EMACS_INT pos,
    are indexes to the string STRING.  */
 
 static int
-e_write (int desc, Lisp_Object string, EMACS_INT start, EMACS_INT end,
+e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end,
         struct coding_system *coding)
 {
   if (STRINGP (string))
@@ -5009,8 +5020,8 @@ e_write (int desc, Lisp_Object string, EMACS_INT start, EMACS_INT end,
        }
       else
        {
-         EMACS_INT start_byte = CHAR_TO_BYTE (start);
-         EMACS_INT end_byte = CHAR_TO_BYTE (end);
+         ptrdiff_t start_byte = CHAR_TO_BYTE (start);
+         ptrdiff_t end_byte = CHAR_TO_BYTE (end);
 
          coding->src_multibyte = (end - start) < (end_byte - start_byte);
          if (CODING_REQUIRE_ENCODING (coding))
@@ -5065,6 +5076,7 @@ See Info node `(elisp)Modification Time' for more details.  */)
   struct stat st;
   Lisp_Object handler;
   Lisp_Object filename;
+  EMACS_TIME mtime, diff;
 
   if (NILP (buf))
     b = current_buffer;
@@ -5075,7 +5087,7 @@ See Info node `(elisp)Modification Time' for more details.  */)
     }
 
   if (!STRINGP (BVAR (b, filename))) return Qt;
-  if (b->modtime == 0) return Qt;
+  if (EMACS_NSECS (b->modtime) == UNKNOWN_MODTIME_NSECS) return Qt;
 
   /* If the file name has special constructs in it,
      call the corresponding file handler.  */
@@ -5086,20 +5098,16 @@ See Info node `(elisp)Modification Time' for more details.  */)
 
   filename = ENCODE_FILE (BVAR (b, filename));
 
-  if (stat (SSDATA (filename), &st) < 0)
-    {
-      /* If the file doesn't exist now and didn't exist before,
-        we say that it isn't modified, provided the error is a tame one.  */
-      if (errno == ENOENT || errno == EACCES || errno == ENOTDIR)
-       st.st_mtime = -1;
-      else
-       st.st_mtime = 0;
-    }
-  if ((st.st_mtime == b->modtime
-       /* If both are positive, accept them if they are off by one second.  */
-       || (st.st_mtime > 0 && b->modtime > 0
-          && (st.st_mtime - 1 == b->modtime
-              || st.st_mtime == b->modtime - 1)))
+  mtime = (stat (SSDATA (filename), &st) == 0
+          ? get_stat_mtime (&st)
+          : time_error_value (errno));
+  if ((EMACS_TIME_EQ (mtime, b->modtime)
+       /* If both exist, accept them if they are off by one second.  */
+       || (EMACS_TIME_VALID_P (mtime) && EMACS_TIME_VALID_P (b->modtime)
+          && ((diff = (EMACS_TIME_LT (mtime, b->modtime)
+                       ? sub_emacs_time (b->modtime, mtime)
+                       : sub_emacs_time (mtime, b->modtime))),
+              EMACS_TIME_LE (diff, make_emacs_time (1, 0)))))
       && (st.st_size == b->modtime_size
           || b->modtime_size < 0))
     return Qt;
@@ -5112,7 +5120,7 @@ DEFUN ("clear-visited-file-modtime", Fclear_visited_file_modtime,
 Next attempt to save will certainly not complain of a discrepancy.  */)
   (void)
 {
-  current_buffer->modtime = 0;
+  current_buffer->modtime = make_emacs_time (0, UNKNOWN_MODTIME_NSECS);
   current_buffer->modtime_size = -1;
   return Qnil;
 }
@@ -5120,16 +5128,16 @@ Next attempt to save will certainly not complain of a discrepancy.  */)
 DEFUN ("visited-file-modtime", Fvisited_file_modtime,
        Svisited_file_modtime, 0, 0, 0,
        doc: /* Return the current buffer's recorded visited file modification time.
-The value is a list of the form (HIGH LOW), like the time values that
+The value is a list of the form (HIGH LOW USEC PSEC), like the time values that
 `file-attributes' returns.  If the current buffer has no recorded file
 modification time, this function returns 0.  If the visited file
 doesn't exist, HIGH will be -1.
 See Info node `(elisp)Modification Time' for more details.  */)
   (void)
 {
-  if (! current_buffer->modtime)
+  if (EMACS_NSECS (current_buffer->modtime) < 0)
     return make_number (0);
-  return make_time (current_buffer->modtime);
+  return make_lisp_time (current_buffer->modtime);
 }
 
 DEFUN ("set-visited-file-modtime", Fset_visited_file_modtime,
@@ -5139,12 +5147,12 @@ Useful if the buffer was not read from the file normally
 or if the file itself has been changed for some known benign reason.
 An argument specifies the modification time value to use
 \(instead of that of the visited file), in the form of a list
-\(HIGH . LOW) or (HIGH LOW).  */)
+\(HIGH LOW USEC PSEC) as returned by `current-time'.  */)
   (Lisp_Object time_list)
 {
   if (!NILP (time_list))
     {
-      CONS_TO_INTEGER (time_list, time_t, current_buffer->modtime);
+      current_buffer->modtime = lisp_time_argument (time_list);
       current_buffer->modtime_size = -1;
     }
   else
@@ -5166,7 +5174,7 @@ An argument specifies the modification time value to use
 
       if (stat (SSDATA (filename), &st) >= 0)
         {
-         current_buffer->modtime = st.st_mtime;
+         current_buffer->modtime = get_stat_mtime (&st);
           current_buffer->modtime_size = st.st_size;
         }
     }
@@ -5296,7 +5304,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer.  */)
   int do_handled_files;
   Lisp_Object oquit;
   FILE *stream = NULL;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   int orig_minibuffer_auto_raise = minibuffer_auto_raise;
   int old_message_p = 0;
   struct gcpro gcpro1, gcpro2;
@@ -5411,9 +5419,8 @@ A non-nil CURRENT-ONLY argument means save only current buffer.  */)
                || NILP (Ffind_file_name_handler (BVAR (b, auto_save_file_name),
                                                  Qwrite_region))))
          {
-           EMACS_TIME before_time, after_time;
-
-           EMACS_GET_TIME (before_time);
+           EMACS_TIME before_time = current_emacs_time ();
+           EMACS_TIME after_time;
 
            /* If we had a failure, don't try again for 20 minutes.  */
            if (b->auto_save_failure_time > 0
@@ -5450,7 +5457,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer.  */)
            XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
            set_buffer_internal (old);
 
-           EMACS_GET_TIME (after_time);
+           after_time = current_emacs_time ();
 
            /* If auto-save took more than 60 seconds,
               assume it was an NFS failure that got a timeout.  */
@@ -5607,7 +5614,7 @@ syms_of_fileio (void)
   DEFSYM (Qexcl, "excl");
 
   DEFVAR_LISP ("file-name-coding-system", Vfile_name_coding_system,
-              doc: /* *Coding system for encoding file names.
+              doc: /* Coding system for encoding file names.
 If it is nil, `default-file-name-coding-system' (which see) is used.  */);
   Vfile_name_coding_system = Qnil;
 
@@ -5630,17 +5637,17 @@ of file names regardless of the current language environment.  */);
   Fput (Qfile_error, Qerror_conditions,
        Fpurecopy (list2 (Qfile_error, Qerror)));
   Fput (Qfile_error, Qerror_message,
-       make_pure_c_string ("File error"));
+       build_pure_c_string ("File error"));
 
   Fput (Qfile_already_exists, Qerror_conditions,
        Fpurecopy (list3 (Qfile_already_exists, Qfile_error, Qerror)));
   Fput (Qfile_already_exists, Qerror_message,
-       make_pure_c_string ("File already exists"));
+       build_pure_c_string ("File already exists"));
 
   Fput (Qfile_date_error, Qerror_conditions,
        Fpurecopy (list3 (Qfile_date_error, Qfile_error, Qerror)));
   Fput (Qfile_date_error, Qerror_message,
-       make_pure_c_string ("Cannot set file date"));
+       build_pure_c_string ("Cannot set file date"));
 
   DEFVAR_LISP ("file-name-handler-alist", Vfile_name_handler_alist,
               doc: /* Alist of elements (REGEXP . HANDLER) for file names handled specially.
@@ -5761,7 +5768,7 @@ file is usually more useful if it contains the deleted text.  */);
 
 #ifdef HAVE_FSYNC
   DEFVAR_BOOL ("write-region-inhibit-fsync", write_region_inhibit_fsync,
-              doc: /* *Non-nil means don't call fsync in `write-region'.
+              doc: /* Non-nil means don't call fsync in `write-region'.
 This variable affects calls to `write-region' as well as save commands.
 A non-nil value may result in data loss!  */);
   write_region_inhibit_fsync = 0;
index 2613eec4aca44917c3abda08d57ffb0496680f4c..e840d3c5c3b4dc9c8b36a4305118a2a18c32fedb 100644 (file)
@@ -40,8 +40,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <errno.h>
 
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "coding.h"
 #include "systime.h"
 
@@ -174,14 +174,14 @@ get_boot_time (void)
 
       filename = Qnil;
 
-      sprintf (cmd_string, "%s.%d", WTMP_FILE, counter);
-      tempname = build_string (cmd_string);
+      tempname = make_formatted_string
+       (cmd_string, "%s.%d", WTMP_FILE, counter);
       if (! NILP (Ffile_exists_p (tempname)))
        filename = tempname;
       else
        {
-         sprintf (cmd_string, "%s.%d.gz", WTMP_FILE, counter);
-         tempname = build_string (cmd_string);
+         tempname = make_formatted_string (cmd_string, "%s.%d.gz",
+                                           WTMP_FILE, counter);
          if (! NILP (Ffile_exists_p (tempname)))
            {
              Lisp_Object args[6];
@@ -294,12 +294,13 @@ typedef struct
    trailing period plus one for the digit after it plus one for the
    null.  */
 #define MAKE_LOCK_NAME(lock, file) \
-  (lock = (char *) alloca (SBYTES (file) + 2 + 1 + 1 + 1), \
+  (lock = alloca (SBYTES (file) + 2 + 1 + 1 + 1), \
    fill_in_lock_file_name (lock, (file)))
 
 static void
 fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
 {
+  ptrdiff_t length = SBYTES (fn);
   register char *p;
   struct stat st;
   int count = 0;
@@ -309,14 +310,14 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
   /* Shift the nondirectory part of the file name (including the null)
      right two characters.  Here is one of the places where we'd have to
      do something to support 14-character-max file names.  */
-  for (p = lockfile + strlen (lockfile); p != lockfile && *p != '/'; p--)
+  for (p = lockfile + length; p != lockfile && *p != '/'; p--)
     p[2] = *p;
 
   /* Insert the `.#'.  */
   p[1] = '.';
   p[2] = '#';
 
-  p = p + strlen (p);
+  p = p + length + 2;
 
   while (lstat (lockfile, &st) == 0 && !S_ISLNK (st.st_mode))
     {
@@ -422,7 +423,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
       return -1;
     }
   len = at - lfinfo;
-  owner->user = (char *) xmalloc (len + 1);
+  owner->user = xmalloc (len + 1);
   memcpy (owner->user, lfinfo, len);
   owner->user[len] = 0;
 
@@ -449,7 +450,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
 
   /* The host is everything in between.  */
   len = dot - at - 1;
-  owner->host = (char *) xmalloc (len + 1);
+  owner->host = xmalloc (len + 1);
   memcpy (owner->host, at + 1, len);
   owner->host[len] = 0;
 
@@ -550,6 +551,10 @@ lock_file (Lisp_Object fn)
   struct gcpro gcpro1;
   USE_SAFE_ALLOCA;
 
+  /* Don't do locking if the user has opted out.  */
+  if (! create_lockfiles)
+    return;
+
   /* Don't do locking while dumping Emacs.
      Uncompressing wtmp files uses call-process, which does not work
      in an uninitialized Emacs.  */
@@ -703,15 +708,6 @@ t if it is locked by you, else a string saying which user has locked it.  */)
 
   return ret;
 }
-\f
-/* Initialization functions.  */
-
-void
-init_filelock (void)
-{
-  boot_time = 0;
-  boot_time_initialized = 0;
-}
 
 #endif /* CLASH_DETECTION */
 
@@ -722,6 +718,10 @@ syms_of_filelock (void)
               doc: /* The directory for writing temporary files.  */);
   Vtemporary_file_directory = Qnil;
 
+  DEFVAR_BOOL ("create-lockfiles", create_lockfiles,
+              doc: /* Non-nil means use lockfiles to avoid editing collisions.  */);
+  create_lockfiles = 1;
+
 #ifdef CLASH_DETECTION
   defsubr (&Sunlock_buffer);
   defsubr (&Slock_buffer);
index 305c78cae63b4bd7892d20604873698cc25a2cb8..cad071f1e15cd9f76b045c03a3f28387feda1130 100644 (file)
@@ -484,31 +484,19 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0,
       && INTEGERP (arg2)   /* don't promote, if both are ints, and */
       && 0 <= XINT (arg2)) /* we are sure the result is not fractional */
     {                          /* this can be improved by pre-calculating */
-      EMACS_INT acc, x, y;     /* some binary powers of x then accumulating */
+      EMACS_INT y;             /* some binary powers of x then accumulating */
+      EMACS_UINT acc, x;  /* Unsigned so that overflow is well defined.  */
       Lisp_Object val;
 
       x = XINT (arg1);
       y = XINT (arg2);
-      acc = 1;
+      acc = (y & 1 ? x : 1);
 
-      if (y < 0)
+      while ((y >>= 1) != 0)
        {
-         if (x == 1)
-           acc = 1;
-         else if (x == -1)
-           acc = (y & 1) ? -1 : 1;
-         else
-           acc = 0;
-       }
-      else
-       {
-         while (y > 0)
-           {
-             if (y & 1)
-               acc *= x;
-             x *= x;
-             y >>= 1;
-           }
+         x *= x;
+         if (y & 1)
+           acc *= x;
        }
       XSETINT (val, acc);
       return val;
@@ -676,7 +664,7 @@ DEFUN ("abs", Fabs, Sabs, 1, 1, 0,
   CHECK_NUMBER_OR_FLOAT (arg);
 
   if (FLOATP (arg))
-    IN_FLOAT (arg = make_float (fabs (XFLOAT_DATA (arg))), "abs", arg);
+    arg = make_float (fabs (XFLOAT_DATA (arg)));
   else if (XINT (arg) < 0)
     XSETINT (arg, - XINT (arg));
 
index 1edfe966098c5ef953ba864caf18f6bf9cfbd9d5..da8889e70a7bddd8040dfe3f6d4b636993da6245 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -42,10 +42,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 #endif /* HAVE_MENUS */
 
-#ifndef NULL
-#define NULL ((POINTER_TYPE *)0)
-#endif
-
 Lisp_Object Qstring_lessp;
 static Lisp_Object Qprovide, Qrequire;
 static Lisp_Object Qyes_or_no_p_history;
@@ -82,9 +78,8 @@ Other values of LIMIT are ignored.  */)
 
   if (EQ (limit, Qt))
     {
-      EMACS_TIME t;
-      EMACS_GET_TIME (t);
-      seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_USECS (t));
+      EMACS_TIME t = current_emacs_time ();
+      seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t));
     }
 
   if (NATNUMP (limit) && XFASTINT (limit) != 0)
@@ -250,8 +245,8 @@ If string STR1 is greater, the value is a positive number N;
   N - 1 is the number of characters that match at the beginning.  */)
   (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case)
 {
-  register EMACS_INT end1_char, end2_char;
-  register EMACS_INT i1, i1_byte, i2, i2_byte;
+  register ptrdiff_t end1_char, end2_char;
+  register ptrdiff_t i1, i1_byte, i2, i2_byte;
 
   CHECK_STRING (str1);
   CHECK_STRING (str2);
@@ -266,19 +261,23 @@ If string STR1 is greater, the value is a positive number N;
   if (! NILP (end2))
     CHECK_NATNUM (end2);
 
-  i1 = XINT (start1);
-  i2 = XINT (start2);
-
-  i1_byte = string_char_to_byte (str1, i1);
-  i2_byte = string_char_to_byte (str2, i2);
-
   end1_char = SCHARS (str1);
   if (! NILP (end1) && end1_char > XINT (end1))
     end1_char = XINT (end1);
+  if (end1_char < XINT (start1))
+    args_out_of_range (str1, start1);
 
   end2_char = SCHARS (str2);
   if (! NILP (end2) && end2_char > XINT (end2))
     end2_char = XINT (end2);
+  if (end2_char < XINT (start2))
+    args_out_of_range (str2, start2);
+
+  i1 = XINT (start1);
+  i2 = XINT (start2);
+
+  i1_byte = string_char_to_byte (str1, i1);
+  i2_byte = string_char_to_byte (str2, i2);
 
   while (i1 < end1_char && i2 < end2_char)
     {
@@ -341,8 +340,8 @@ Case is significant.
 Symbols are also allowed; their print names are used instead.  */)
   (register Lisp_Object s1, Lisp_Object s2)
 {
-  register EMACS_INT end;
-  register EMACS_INT i1, i1_byte, i2, i2_byte;
+  register ptrdiff_t end;
+  register ptrdiff_t i1, i1_byte, i2, i2_byte;
 
   if (SYMBOLP (s1))
     s1 = SYMBOL_NAME (s1);
@@ -465,8 +464,8 @@ with the original.  */)
 struct textprop_rec
 {
   ptrdiff_t argnum;            /* refer to ARGS (arguments of `concat') */
-  EMACS_INT from;              /* refer to ARGS[argnum] (argument string) */
-  EMACS_INT to;                        /* refer to VAL (the target string) */
+  ptrdiff_t from;              /* refer to ARGS[argnum] (argument string) */
+  ptrdiff_t to;                        /* refer to VAL (the target string) */
 };
 
 static Lisp_Object
@@ -476,8 +475,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
   Lisp_Object val;
   register Lisp_Object tail;
   register Lisp_Object this;
-  EMACS_INT toindex;
-  EMACS_INT toindex_byte = 0;
+  ptrdiff_t toindex;
+  ptrdiff_t toindex_byte = 0;
   register EMACS_INT result_len;
   register EMACS_INT result_len_byte;
   ptrdiff_t argnum;
@@ -530,10 +529,10 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
        {
          /* We must count the number of bytes needed in the string
             as well as the number of characters.  */
-         EMACS_INT i;
+         ptrdiff_t i;
          Lisp_Object ch;
          int c;
-         EMACS_INT this_len_byte;
+         ptrdiff_t this_len_byte;
 
          if (VECTORP (this) || COMPILEDP (this))
            for (i = 0; i < len; i++)
@@ -542,6 +541,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
                CHECK_CHARACTER (ch);
                c = XFASTINT (ch);
                this_len_byte = CHAR_BYTES (c);
+               if (STRING_BYTES_BOUND - result_len_byte < this_len_byte)
+                 string_overflow ();
                result_len_byte += this_len_byte;
                if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c))
                  some_multibyte = 1;
@@ -555,6 +556,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
                CHECK_CHARACTER (ch);
                c = XFASTINT (ch);
                this_len_byte = CHAR_BYTES (c);
+               if (STRING_BYTES_BOUND - result_len_byte < this_len_byte)
+                 string_overflow ();
                result_len_byte += this_len_byte;
                if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c))
                  some_multibyte = 1;
@@ -564,17 +567,20 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
              if (STRING_MULTIBYTE (this))
                {
                  some_multibyte = 1;
-                 result_len_byte += SBYTES (this);
+                 this_len_byte = SBYTES (this);
                }
              else
-               result_len_byte += count_size_as_multibyte (SDATA (this),
-                                                           SCHARS (this));
+               this_len_byte = count_size_as_multibyte (SDATA (this),
+                                                        SCHARS (this));
+             if (STRING_BYTES_BOUND - result_len_byte < this_len_byte)
+               string_overflow ();
+             result_len_byte += this_len_byte;
            }
        }
 
       result_len += len;
-      if (STRING_BYTES_BOUND < result_len)
-       string_overflow ();
+      if (MOST_POSITIVE_FIXNUM < result_len)
+       memory_full (SIZE_MAX);
     }
 
   if (! some_multibyte)
@@ -607,9 +613,9 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
   for (argnum = 0; argnum < nargs; argnum++)
     {
       Lisp_Object thislen;
-      EMACS_INT thisleni = 0;
-      register EMACS_INT thisindex = 0;
-      register EMACS_INT thisindex_byte = 0;
+      ptrdiff_t thisleni = 0;
+      register ptrdiff_t thisindex = 0;
+      register ptrdiff_t thisindex_byte = 0;
 
       this = args[argnum];
       if (!CONSP (this))
@@ -619,7 +625,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
       if (STRINGP (this) && STRINGP (val)
          && STRING_MULTIBYTE (this) == some_multibyte)
        {
-         EMACS_INT thislen_byte = SBYTES (this);
+         ptrdiff_t thislen_byte = SBYTES (this);
 
          memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
          if (! NULL_INTERVAL_P (STRING_INTERVALS (this)))
@@ -720,7 +726,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
   if (num_textprops > 0)
     {
       Lisp_Object props;
-      EMACS_INT last_to_end = -1;
+      ptrdiff_t last_to_end = -1;
 
       for (argnum = 0; argnum < num_textprops; argnum++)
        {
@@ -744,8 +750,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
 }
 \f
 static Lisp_Object string_char_byte_cache_string;
-static EMACS_INT string_char_byte_cache_charpos;
-static EMACS_INT string_char_byte_cache_bytepos;
+static ptrdiff_t string_char_byte_cache_charpos;
+static ptrdiff_t string_char_byte_cache_bytepos;
 
 void
 clear_string_char_byte_cache (void)
@@ -755,12 +761,12 @@ clear_string_char_byte_cache (void)
 
 /* Return the byte index corresponding to CHAR_INDEX in STRING.  */
 
-EMACS_INT
-string_char_to_byte (Lisp_Object string, EMACS_INT char_index)
+ptrdiff_t
+string_char_to_byte (Lisp_Object string, ptrdiff_t char_index)
 {
-  EMACS_INT i_byte;
-  EMACS_INT best_below, best_below_byte;
-  EMACS_INT best_above, best_above_byte;
+  ptrdiff_t i_byte;
+  ptrdiff_t best_below, best_below_byte;
+  ptrdiff_t best_above, best_above_byte;
 
   best_below = best_below_byte = 0;
   best_above = SCHARS (string);
@@ -815,12 +821,12 @@ string_char_to_byte (Lisp_Object string, EMACS_INT char_index)
 \f
 /* Return the character index corresponding to BYTE_INDEX in STRING.  */
 
-EMACS_INT
-string_byte_to_char (Lisp_Object string, EMACS_INT byte_index)
+ptrdiff_t
+string_byte_to_char (Lisp_Object string, ptrdiff_t byte_index)
 {
-  EMACS_INT i, i_byte;
-  EMACS_INT best_below, best_below_byte;
-  EMACS_INT best_above, best_above_byte;
+  ptrdiff_t i, i_byte;
+  ptrdiff_t best_below, best_below_byte;
+  ptrdiff_t best_above, best_above_byte;
 
   best_below = best_below_byte = 0;
   best_above = SCHARS (string);
@@ -883,7 +889,7 @@ static Lisp_Object
 string_make_multibyte (Lisp_Object string)
 {
   unsigned char *buf;
-  EMACS_INT nbytes;
+  ptrdiff_t nbytes;
   Lisp_Object ret;
   USE_SAFE_ALLOCA;
 
@@ -916,7 +922,7 @@ Lisp_Object
 string_to_multibyte (Lisp_Object string)
 {
   unsigned char *buf;
-  EMACS_INT nbytes;
+  ptrdiff_t nbytes;
   Lisp_Object ret;
   USE_SAFE_ALLOCA;
 
@@ -945,7 +951,7 @@ string_to_multibyte (Lisp_Object string)
 Lisp_Object
 string_make_unibyte (Lisp_Object string)
 {
-  EMACS_INT nchars;
+  ptrdiff_t nchars;
   unsigned char *buf;
   Lisp_Object ret;
   USE_SAFE_ALLOCA;
@@ -1010,8 +1016,8 @@ If STRING is multibyte and contains a character of charset
 
   if (STRING_MULTIBYTE (string))
     {
-      EMACS_INT bytes = SBYTES (string);
-      unsigned char *str = (unsigned char *) xmalloc (bytes);
+      ptrdiff_t bytes = SBYTES (string);
+      unsigned char *str = xmalloc (bytes);
 
       memcpy (str, SDATA (string), bytes);
       bytes = str_as_unibyte (str, bytes);
@@ -1043,7 +1049,7 @@ If you're not sure, whether to use `string-as-multibyte' or
   if (! STRING_MULTIBYTE (string))
     {
       Lisp_Object new_string;
-      EMACS_INT nchars, nbytes;
+      ptrdiff_t nchars, nbytes;
 
       parse_str_as_multibyte (SDATA (string),
                              SBYTES (string),
@@ -1092,12 +1098,12 @@ an error is signaled.  */)
 
   if (STRING_MULTIBYTE (string))
     {
-      EMACS_INT chars = SCHARS (string);
-      unsigned char *str = (unsigned char *) xmalloc (chars);
-      EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0);
+      ptrdiff_t chars = SCHARS (string);
+      unsigned char *str = xmalloc (chars);
+      ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars, 0);
 
       if (converted < chars)
-       error ("Can't convert the %"pI"dth character to unibyte", converted);
+       error ("Can't convert the %"pD"dth character to unibyte", converted);
       string = make_unibyte_string ((char *) str, chars);
       xfree (str);
     }
@@ -1145,27 +1151,19 @@ value is a new vector that contains the elements between index FROM
   (Lisp_Object string, register Lisp_Object from, Lisp_Object to)
 {
   Lisp_Object res;
-  EMACS_INT size;
-  EMACS_INT size_byte = 0;
+  ptrdiff_t size;
   EMACS_INT from_char, to_char;
-  EMACS_INT from_byte = 0, to_byte = 0;
 
   CHECK_VECTOR_OR_STRING (string);
   CHECK_NUMBER (from);
 
   if (STRINGP (string))
-    {
-      size = SCHARS (string);
-      size_byte = SBYTES (string);
-    }
+    size = SCHARS (string);
   else
     size = ASIZE (string);
 
   if (NILP (to))
-    {
-      to_char = size;
-      to_byte = size_byte;
-    }
+    to_char = size;
   else
     {
       CHECK_NUMBER (to);
@@ -1173,23 +1171,20 @@ value is a new vector that contains the elements between index FROM
       to_char = XINT (to);
       if (to_char < 0)
        to_char += size;
-
-      if (STRINGP (string))
-       to_byte = string_char_to_byte (string, to_char);
     }
 
   from_char = XINT (from);
   if (from_char < 0)
     from_char += size;
-  if (STRINGP (string))
-    from_byte = string_char_to_byte (string, from_char);
-
   if (!(0 <= from_char && from_char <= to_char && to_char <= size))
     args_out_of_range_3 (string, make_number (from_char),
                         make_number (to_char));
 
   if (STRINGP (string))
     {
+      ptrdiff_t to_byte =
+       (NILP (to) ? SBYTES (string) : string_char_to_byte (string, to_char));
+      ptrdiff_t from_byte = string_char_to_byte (string, from_char);
       res = make_specified_string (SSDATA (string) + from_byte,
                                   to_char - from_char, to_byte - from_byte,
                                   STRING_MULTIBYTE (string));
@@ -1213,47 +1208,41 @@ If FROM or TO is negative, it counts from the end.
 With one argument, just copy STRING without its properties.  */)
   (Lisp_Object string, register Lisp_Object from, Lisp_Object to)
 {
-  EMACS_INT size, size_byte;
+  ptrdiff_t size;
   EMACS_INT from_char, to_char;
-  EMACS_INT from_byte, to_byte;
+  ptrdiff_t from_byte, to_byte;
 
   CHECK_STRING (string);
 
   size = SCHARS (string);
-  size_byte = SBYTES (string);
 
   if (NILP (from))
-    from_char = from_byte = 0;
+    from_char = 0;
   else
     {
       CHECK_NUMBER (from);
       from_char = XINT (from);
       if (from_char < 0)
        from_char += size;
-
-      from_byte = string_char_to_byte (string, from_char);
     }
 
   if (NILP (to))
-    {
-      to_char = size;
-      to_byte = size_byte;
-    }
+    to_char = size;
   else
     {
       CHECK_NUMBER (to);
-
       to_char = XINT (to);
       if (to_char < 0)
        to_char += size;
-
-      to_byte = string_char_to_byte (string, to_char);
     }
 
   if (!(0 <= from_char && from_char <= to_char && to_char <= size))
     args_out_of_range_3 (string, make_number (from_char),
                         make_number (to_char));
 
+  from_byte = NILP (from) ? 0 : string_char_to_byte (string, from_char);
+  to_byte =
+    NILP (to) ? SBYTES (string) : string_char_to_byte (string, to_char);
   return make_specified_string (SSDATA (string) + from_byte,
                                to_char - from_char, to_byte - from_byte,
                                STRING_MULTIBYTE (string));
@@ -1263,11 +1252,11 @@ With one argument, just copy STRING without its properties.  */)
    both in characters and in bytes.  */
 
 Lisp_Object
-substring_both (Lisp_Object string, EMACS_INT from, EMACS_INT from_byte,
-               EMACS_INT to, EMACS_INT to_byte)
+substring_both (Lisp_Object string, ptrdiff_t from, ptrdiff_t from_byte,
+               ptrdiff_t to, ptrdiff_t to_byte)
 {
   Lisp_Object res;
-  EMACS_INT size;
+  ptrdiff_t size;
 
   CHECK_VECTOR_OR_STRING (string);
 
@@ -1601,7 +1590,7 @@ to be sure of changing the value of `foo'.  */)
 {
   if (VECTORP (seq))
     {
-      EMACS_INT i, n;
+      ptrdiff_t i, n;
 
       for (i = n = 0; i < ASIZE (seq); ++i)
        if (NILP (Fequal (AREF (seq, i), elt)))
@@ -1620,7 +1609,7 @@ to be sure of changing the value of `foo'.  */)
     }
   else if (STRINGP (seq))
     {
-      EMACS_INT i, ibyte, nchars, nbytes, cbytes;
+      ptrdiff_t i, ibyte, nchars, nbytes, cbytes;
       int c;
 
       for (i = nchars = nbytes = ibyte = 0;
@@ -1672,7 +1661,7 @@ to be sure of changing the value of `foo'.  */)
                {
                  unsigned char *from = SDATA (seq) + ibyte;
                  unsigned char *to   = SDATA (tem) + nbytes;
-                 EMACS_INT n;
+                 ptrdiff_t n;
 
                  ++nchars;
                  nbytes += cbytes;
@@ -2079,7 +2068,7 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
     case Lisp_Vectorlike:
       {
        register int i;
-       EMACS_INT size = ASIZE (o1);
+       ptrdiff_t size = ASIZE (o1);
        /* Pseudovectors have the type encoded in the size field, so this test
           actually checks that the objects have the same type as well as the
           same size.  */
@@ -2105,8 +2094,9 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int
           are sensible to compare, so eliminate the others now.  */
        if (size & PSEUDOVECTOR_FLAG)
          {
-           if (!(size & (PVEC_COMPILED
-                         | PVEC_CHAR_TABLE | PVEC_SUB_CHAR_TABLE | PVEC_FONT)))
+           if (!(size & ((PVEC_COMPILED | PVEC_CHAR_TABLE
+                          | PVEC_SUB_CHAR_TABLE | PVEC_FONT)
+                         << PSEUDOVECTOR_SIZE_BITS)))
              return 0;
            size &= PSEUDOVECTOR_SIZE_MASK;
          }
@@ -2146,7 +2136,7 @@ DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0,
 ARRAY is a vector, string, char-table, or bool-vector.  */)
   (Lisp_Object array, Lisp_Object item)
 {
-  register EMACS_INT size, idx;
+  register ptrdiff_t size, idx;
 
   if (VECTORP (array))
     {
@@ -2174,7 +2164,7 @@ ARRAY is a vector, string, char-table, or bool-vector.  */)
        {
          unsigned char str[MAX_MULTIBYTE_LENGTH];
          int len = CHAR_STRING (charval, str);
-         EMACS_INT size_byte = SBYTES (array);
+         ptrdiff_t size_byte = SBYTES (array);
 
          if (INT_MULTIPLY_OVERFLOW (SCHARS (array), len)
              || SCHARS (array) * len != size_byte)
@@ -2189,18 +2179,16 @@ ARRAY is a vector, string, char-table, or bool-vector.  */)
   else if (BOOL_VECTOR_P (array))
     {
       register unsigned char *p = XBOOL_VECTOR (array)->data;
-      EMACS_INT size_in_chars;
-      size = XBOOL_VECTOR (array)->size;
-      size_in_chars
-       = ((size + BOOL_VECTOR_BITS_PER_CHAR - 1)
-          / BOOL_VECTOR_BITS_PER_CHAR);
+      size =
+       ((XBOOL_VECTOR (array)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
+        / BOOL_VECTOR_BITS_PER_CHAR);
 
-      if (size_in_chars)
+      if (size)
        {
-         memset (p, ! NILP (item) ? -1 : 0, size_in_chars);
+         memset (p, ! NILP (item) ? -1 : 0, size);
 
          /* Clear any extraneous bits in the last byte.  */
-         p[size_in_chars - 1] &= (1 << (size % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
+         p[size - 1] &= (1 << (size % BOOL_VECTOR_BITS_PER_CHAR)) - 1;
        }
     }
   else
@@ -2214,7 +2202,7 @@ DEFUN ("clear-string", Fclear_string, Sclear_string,
 This makes STRING unibyte and may change its length.  */)
   (Lisp_Object string)
 {
-  EMACS_INT len;
+  ptrdiff_t len;
   CHECK_STRING (string);
   len = SBYTES (string);
   memset (SDATA (string), 0, len);
@@ -2324,12 +2312,12 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq)
     }
   else if (STRINGP (seq))
     {
-      EMACS_INT i_byte;
+      ptrdiff_t i_byte;
 
       for (i = 0, i_byte = 0; i < leni;)
        {
          int c;
-         EMACS_INT i_before = i;
+         ptrdiff_t i_before = i;
 
          FETCH_STRING_CHAR_ADVANCE (c, seq, i, i_byte);
          XSETFASTINT (dummy, c);
@@ -2362,7 +2350,8 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string.  */)
 {
   Lisp_Object len;
   register EMACS_INT leni;
-  ptrdiff_t i, nargs;
+  EMACS_INT nargs;
+  ptrdiff_t i;
   register Lisp_Object *args;
   struct gcpro gcpro1;
   Lisp_Object ret;
@@ -2649,7 +2638,7 @@ The normal messages at start and end of loading FILENAME are suppressed.  */)
 
   if (NILP (tem))
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       int nesting = 0;
 
       /* This is to make sure that loadup.el gives a clear picture
@@ -2952,9 +2941,9 @@ static const short base64_char_to_value[128] =
    base64 characters.  */
 
 
-static EMACS_INT base64_encode_1 (const char *, char *, EMACS_INT, int, int);
-static EMACS_INT base64_decode_1 (const char *, char *, EMACS_INT, int,
-                                 EMACS_INT *);
+static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, int, int);
+static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, int,
+                                 ptrdiff_t *);
 
 DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region,
        2, 3, "r",
@@ -2965,9 +2954,9 @@ into shorter lines.  */)
   (Lisp_Object beg, Lisp_Object end, Lisp_Object no_line_break)
 {
   char *encoded;
-  EMACS_INT allength, length;
-  EMACS_INT ibeg, iend, encoded_length;
-  EMACS_INT old_pos = PT;
+  ptrdiff_t allength, length;
+  ptrdiff_t ibeg, iend, encoded_length;
+  ptrdiff_t old_pos = PT;
   USE_SAFE_ALLOCA;
 
   validate_region (&beg, &end);
@@ -3023,7 +3012,7 @@ Optional second argument NO-LINE-BREAK means do not break long lines
 into shorter lines.  */)
   (Lisp_Object string, Lisp_Object no_line_break)
 {
-  EMACS_INT allength, length, encoded_length;
+  ptrdiff_t allength, length, encoded_length;
   char *encoded;
   Lisp_Object encoded_string;
   USE_SAFE_ALLOCA;
@@ -3059,12 +3048,12 @@ into shorter lines.  */)
   return encoded_string;
 }
 
-static EMACS_INT
-base64_encode_1 (const char *from, char *to, EMACS_INT length,
+static ptrdiff_t
+base64_encode_1 (const char *from, char *to, ptrdiff_t length,
                 int line_break, int multibyte)
 {
   int counter = 0;
-  EMACS_INT i = 0;
+  ptrdiff_t i = 0;
   char *e = to;
   int c;
   unsigned int value;
@@ -3163,11 +3152,11 @@ Return the length of the decoded text.
 If the region can't be decoded, signal an error and don't modify the buffer.  */)
   (Lisp_Object beg, Lisp_Object end)
 {
-  EMACS_INT ibeg, iend, length, allength;
+  ptrdiff_t ibeg, iend, length, allength;
   char *decoded;
-  EMACS_INT old_pos = PT;
-  EMACS_INT decoded_length;
-  EMACS_INT inserted_chars;
+  ptrdiff_t old_pos = PT;
+  ptrdiff_t decoded_length;
+  ptrdiff_t inserted_chars;
   int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   USE_SAFE_ALLOCA;
 
@@ -3225,7 +3214,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
   (Lisp_Object string)
 {
   char *decoded;
-  EMACS_INT length, decoded_length;
+  ptrdiff_t length, decoded_length;
   Lisp_Object decoded_string;
   USE_SAFE_ALLOCA;
 
@@ -3257,15 +3246,15 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
    form.  If NCHARS_RETURN is not NULL, store the number of produced
    characters in *NCHARS_RETURN.  */
 
-static EMACS_INT
-base64_decode_1 (const char *from, char *to, EMACS_INT length,
-                int multibyte, EMACS_INT *nchars_return)
+static ptrdiff_t
+base64_decode_1 (const char *from, char *to, ptrdiff_t length,
+                int multibyte, ptrdiff_t *nchars_return)
 {
-  EMACS_INT i = 0;             /* Used inside READ_QUADRUPLET_BYTE */
+  ptrdiff_t i = 0;             /* Used inside READ_QUADRUPLET_BYTE */
   char *e = to;
   unsigned char c;
   unsigned long value;
-  EMACS_INT nchars = 0;
+  ptrdiff_t nchars = 0;
 
   while (1)
     {
@@ -3432,23 +3421,31 @@ get_key_arg (Lisp_Object key, ptrdiff_t nargs, Lisp_Object *args, char *used)
 
 
 /* Return a Lisp vector which has the same contents as VEC but has
-   size NEW_SIZE, NEW_SIZE >= VEC->size.  Entries in the resulting
-   vector that are not copied from VEC are set to INIT.  */
+   at least INCR_MIN more entries, where INCR_MIN is positive.
+   If NITEMS_MAX is not -1, do not grow the vector to be any larger
+   than NITEMS_MAX.  Entries in the resulting
+   vector that are not copied from VEC are set to nil.  */
 
 Lisp_Object
-larger_vector (Lisp_Object vec, EMACS_INT new_size, Lisp_Object init)
+larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max)
 {
   struct Lisp_Vector *v;
-  EMACS_INT i, old_size;
-
-  xassert (VECTORP (vec));
+  ptrdiff_t i, incr, incr_max, old_size, new_size;
+  ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents;
+  ptrdiff_t n_max = (0 <= nitems_max && nitems_max < C_language_max
+                    ? nitems_max : C_language_max);
+  eassert (VECTORP (vec));
+  eassert (0 < incr_min && -1 <= nitems_max);
   old_size = ASIZE (vec);
-  xassert (new_size >= old_size);
-
+  incr_max = n_max - old_size;
+  incr = max (incr_min, min (old_size >> 1, incr_max));
+  if (incr_max < incr)
+    memory_full (SIZE_MAX);
+  new_size = old_size + incr;
   v = allocate_vector (new_size);
   memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents);
   for (i = old_size; i < new_size; ++i)
-    v->contents[i] = init;
+    v->contents[i] = Qnil;
   XSETVECTOR (vec, v);
   return vec;
 }
@@ -3517,7 +3514,7 @@ static EMACS_UINT
 hashfn_eq (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   EMACS_UINT hash = XUINT (key) ^ XTYPE (key);
-  xassert ((hash & ~INTMASK) == 0);
+  eassert ((hash & ~INTMASK) == 0);
   return hash;
 }
 
@@ -3534,7 +3531,7 @@ hashfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key)
     hash = sxhash (key, 0);
   else
     hash = XUINT (key) ^ XTYPE (key);
-  xassert ((hash & ~INTMASK) == 0);
+  eassert ((hash & ~INTMASK) == 0);
   return hash;
 }
 
@@ -3547,7 +3544,7 @@ static EMACS_UINT
 hashfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   EMACS_UINT hash = sxhash (key, 0);
-  xassert ((hash & ~INTMASK) == 0);
+  eassert ((hash & ~INTMASK) == 0);
   return hash;
 }
 
@@ -3569,6 +3566,10 @@ hashfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key)
   return XUINT (hash);
 }
 
+/* An upper bound on the size of a hash table index.  It must fit in
+   ptrdiff_t and be a valid Emacs fixnum.  */
+#define INDEX_SIZE_BOUND \
+  ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX / sizeof (Lisp_Object)))
 
 /* Create and initialize a new hash table.
 
@@ -3599,15 +3600,16 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size,
 {
   struct Lisp_Hash_Table *h;
   Lisp_Object table;
-  EMACS_INT index_size, i, sz;
+  EMACS_INT index_size, sz;
+  ptrdiff_t i;
   double index_float;
 
   /* Preconditions.  */
-  xassert (SYMBOLP (test));
-  xassert (INTEGERP (size) && XINT (size) >= 0);
-  xassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
+  eassert (SYMBOLP (test));
+  eassert (INTEGERP (size) && XINT (size) >= 0);
+  eassert ((INTEGERP (rehash_size) && XINT (rehash_size) > 0)
           || (FLOATP (rehash_size) && 1 < XFLOAT_DATA (rehash_size)));
-  xassert (FLOATP (rehash_threshold)
+  eassert (FLOATP (rehash_threshold)
           && 0 < XFLOAT_DATA (rehash_threshold)
           && XFLOAT_DATA (rehash_threshold) <= 1.0);
 
@@ -3616,10 +3618,10 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size,
 
   sz = XFASTINT (size);
   index_float = sz / XFLOAT_DATA (rehash_threshold);
-  index_size = (index_float < MOST_POSITIVE_FIXNUM + 1
+  index_size = (index_float < INDEX_SIZE_BOUND + 1
                ? next_almost_prime (index_float)
-               : MOST_POSITIVE_FIXNUM + 1);
-  if (MOST_POSITIVE_FIXNUM < max (index_size, 2 * sz))
+               : INDEX_SIZE_BOUND + 1);
+  if (INDEX_SIZE_BOUND < max (index_size, 2 * sz))
     error ("Hash table too large");
 
   /* Allocate a table and initialize it.  */
@@ -3665,8 +3667,8 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size,
   h->next_free = make_number (0);
 
   XSET_HASH_TABLE (table, h);
-  xassert (HASH_TABLE_P (table));
-  xassert (XHASH_TABLE (table) == h);
+  eassert (HASH_TABLE_P (table));
+  eassert (XHASH_TABLE (table) == h);
 
   /* Maybe add this hash table to the list of all weak hash tables.  */
   if (NILP (h->weak))
@@ -3720,9 +3722,9 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
 {
   if (NILP (h->next_free))
     {
-      EMACS_INT old_size = HASH_TABLE_SIZE (h);
-      EMACS_INT i, new_size, index_size;
-      EMACS_INT nsize;
+      ptrdiff_t old_size = HASH_TABLE_SIZE (h);
+      EMACS_INT new_size, index_size, nsize;
+      ptrdiff_t i;
       double index_float;
 
       if (INTEGERP (h->rehash_size))
@@ -3730,26 +3732,38 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
       else
        {
          double float_new_size = old_size * XFLOAT_DATA (h->rehash_size);
-         if (float_new_size < MOST_POSITIVE_FIXNUM + 1)
+         if (float_new_size < INDEX_SIZE_BOUND + 1)
            {
              new_size = float_new_size;
              if (new_size <= old_size)
                new_size = old_size + 1;
            }
          else
-           new_size = MOST_POSITIVE_FIXNUM + 1;
+           new_size = INDEX_SIZE_BOUND + 1;
        }
       index_float = new_size / XFLOAT_DATA (h->rehash_threshold);
-      index_size = (index_float < MOST_POSITIVE_FIXNUM + 1
+      index_size = (index_float < INDEX_SIZE_BOUND + 1
                    ? next_almost_prime (index_float)
-                   : MOST_POSITIVE_FIXNUM + 1);
+                   : INDEX_SIZE_BOUND + 1);
       nsize = max (index_size, 2 * new_size);
-      if (nsize > MOST_POSITIVE_FIXNUM)
+      if (INDEX_SIZE_BOUND < nsize)
        error ("Hash table too large to resize");
 
-      h->key_and_value = larger_vector (h->key_and_value, 2 * new_size, Qnil);
-      h->next = larger_vector (h->next, new_size, Qnil);
-      h->hash = larger_vector (h->hash, new_size, Qnil);
+#ifdef ENABLE_CHECKING
+      if (HASH_TABLE_P (Vpurify_flag)
+         && XHASH_TABLE (Vpurify_flag) == h)
+       {
+         Lisp_Object args[2];
+         args[0] = build_string ("Growing hash table to: %d");
+         args[1] = make_number (new_size);
+         Fmessage (2, args);
+       }
+#endif
+
+      h->key_and_value = larger_vector (h->key_and_value,
+                                       2 * (new_size - old_size), -1);
+      h->next = larger_vector (h->next, new_size - old_size, -1);
+      h->hash = larger_vector (h->hash, new_size - old_size, -1);
       h->index = Fmake_vector (make_number (index_size), Qnil);
 
       /* Update the free list.  Do it so that new entries are added at
@@ -3777,7 +3791,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
        if (!NILP (HASH_HASH (h, i)))
          {
            EMACS_UINT hash_code = XUINT (HASH_HASH (h, i));
-           EMACS_INT start_of_bucket = hash_code % ASIZE (h->index);
+           ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index);
            HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket);
            HASH_INDEX (h, start_of_bucket) = make_number (i);
          }
@@ -3806,7 +3820,7 @@ hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, EMACS_UINT *hash)
   /* We need not gcpro idx since it's either an integer or nil.  */
   while (!NILP (idx))
     {
-      EMACS_INT i = XFASTINT (idx);
+      ptrdiff_t i = XFASTINT (idx);
       if (EQ (key, HASH_KEY (h, i))
          || (h->cmpfn
              && h->cmpfn (h, key, hash_code,
@@ -3829,7 +3843,7 @@ hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, Lisp_Object value,
 {
   ptrdiff_t start_of_bucket, i;
 
-  xassert ((hash & ~INTMASK) == 0);
+  eassert ((hash & ~INTMASK) == 0);
 
   /* Increment count after resizing because resizing may fail.  */
   maybe_resize_hash_table (h);
@@ -3858,7 +3872,7 @@ static void
 hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key)
 {
   EMACS_UINT hash_code;
-  EMACS_INT start_of_bucket;
+  ptrdiff_t start_of_bucket;
   Lisp_Object idx, prev;
 
   hash_code = h->hashfn (h, key);
@@ -3869,7 +3883,7 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key)
   /* We need not gcpro idx, prev since they're either integers or nil.  */
   while (!NILP (idx))
     {
-      EMACS_INT i = XFASTINT (idx);
+      ptrdiff_t i = XFASTINT (idx);
 
       if (EQ (key, HASH_KEY (h, i))
          || (h->cmpfn
@@ -3888,7 +3902,7 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key)
          HASH_NEXT (h, i) = h->next_free;
          h->next_free = make_number (i);
          h->count--;
-         xassert (h->count >= 0);
+         eassert (h->count >= 0);
          break;
        }
       else
@@ -3907,7 +3921,7 @@ hash_clear (struct Lisp_Hash_Table *h)
 {
   if (h->count > 0)
     {
-      EMACS_INT i, size = HASH_TABLE_SIZE (h);
+      ptrdiff_t i, size = HASH_TABLE_SIZE (h);
 
       for (i = 0; i < size; ++i)
        {
@@ -3931,12 +3945,6 @@ hash_clear (struct Lisp_Hash_Table *h)
                           Weak Hash Tables
  ************************************************************************/
 
-void
-init_weak_hash_tables (void)
-{
-  weak_hash_tables = NULL;
-}
-
 /* Sweep weak hash table H.  REMOVE_ENTRIES_P non-zero means remove
    entries from the table that don't survive the current GC.
    REMOVE_ENTRIES_P zero means mark entries that are in use.  Value is
@@ -3945,7 +3953,7 @@ init_weak_hash_tables (void)
 static int
 sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
 {
-  EMACS_INT bucket, n;
+  ptrdiff_t bucket, n;
   int marked;
 
   n = ASIZE (h->index) & ~ARRAY_MARK_FLAG;
@@ -3960,7 +3968,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
       prev = Qnil;
       for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next)
        {
-         EMACS_INT i = XFASTINT (idx);
+         ptrdiff_t i = XFASTINT (idx);
          int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
          int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
          int remove_p;
@@ -4332,7 +4340,7 @@ usage: (make-hash-table &rest KEYWORD-ARGS)  */)
 
   /* The vector `used' is used to keep track of arguments that
      have been consumed.  */
-  used = (char *) alloca (nargs * sizeof *used);
+  used = alloca (nargs * sizeof *used);
   memset (used, 0, nargs * sizeof *used);
 
   /* See if there's a `:test TEST' among the arguments.  */
@@ -4526,7 +4534,7 @@ FUNCTION is called with two arguments, KEY and VALUE.  */)
 {
   struct Lisp_Hash_Table *h = check_hash_table (table);
   Lisp_Object args[3];
-  EMACS_INT i;
+  ptrdiff_t i;
 
   for (i = 0; i < HASH_TABLE_SIZE (h); ++i)
     if (!NILP (HASH_HASH (h, i)))
@@ -4575,10 +4583,9 @@ static Lisp_Object
 secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary)
 {
   int i;
-  EMACS_INT size;
-  EMACS_INT size_byte = 0;
+  ptrdiff_t size;
   EMACS_INT start_char = 0, end_char = 0;
-  EMACS_INT start_byte = 0, end_byte = 0;
+  ptrdiff_t start_byte, end_byte;
   register EMACS_INT b, e;
   register struct buffer *bp;
   EMACS_INT temp;
@@ -4615,7 +4622,6 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
        object = code_convert_string (object, coding_system, Qnil, 1, 0, 1);
 
       size = SCHARS (object);
-      size_byte = SBYTES (object);
 
       if (!NILP (start))
        {
@@ -4625,15 +4631,10 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
 
          if (start_char < 0)
            start_char += size;
-
-         start_byte = string_char_to_byte (object, start_char);
        }
 
       if (NILP (end))
-       {
-         end_char = size;
-         end_byte = size_byte;
-       }
+       end_char = size;
       else
        {
          CHECK_NUMBER (end);
@@ -4642,13 +4643,15 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
 
          if (end_char < 0)
            end_char += size;
-
-         end_byte = string_char_to_byte (object, end_char);
        }
 
       if (!(0 <= start_char && start_char <= end_char && end_char <= size))
        args_out_of_range_3 (object, make_number (start_char),
                             make_number (end_char));
+
+      start_byte = NILP (start) ? 0 : string_char_to_byte (object, start_char);
+      end_byte =
+       NILP (end) ? SBYTES (object) : string_char_to_byte (object, end_char);
     }
   else
     {
@@ -4755,6 +4758,8 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
 
       if (STRING_MULTIBYTE (object))
        object = code_convert_string (object, coding_system, Qnil, 1, 0, 0);
+      start_byte = 0;
+      end_byte = SBYTES (object);
     }
 
   if (EQ (algorithm, Qmd5))
@@ -4795,7 +4800,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
   digest = make_uninit_string (digest_size * 2);
 
   hash_func (SSDATA (object) + start_byte,
-            SBYTES (object) - (size_byte - end_byte),
+            end_byte - start_byte,
             SSDATA (digest));
 
   if (NILP (binary))
@@ -4933,7 +4938,7 @@ Used by `featurep' and `require', and altered by `provide'.  */);
 #endif /* HAVE_LANGINFO_CODESET */
 
   DEFVAR_BOOL ("use-dialog-box", use_dialog_box,
-    doc: /* *Non-nil means mouse commands use dialog boxes to ask questions.
+    doc: /* Non-nil means mouse commands use dialog boxes to ask questions.
 This applies to `y-or-n-p' and `yes-or-no-p' questions asked by commands
 invoked by mouse clicks and mouse menu items.
 
@@ -4942,7 +4947,7 @@ non-nil.  */);
   use_dialog_box = 1;
 
   DEFVAR_BOOL ("use-file-dialog", use_file_dialog,
-    doc: /* *Non-nil means mouse commands use a file dialog to ask for files.
+    doc: /* Non-nil means mouse commands use a file dialog to ask for files.
 This applies to commands from menus and tool bar buttons even when
 they are initiated from the keyboard.  If `use-dialog-box' is nil,
 that disables the use of a file dialog, regardless of the value of
@@ -5017,9 +5022,3 @@ this variable.  */);
   defsubr (&Ssecure_hash);
   defsubr (&Slocale_info);
 }
-
-
-void
-init_fns (void)
-{
-}
index 43b74b5b6f8d78c0a27ed7f355c27a4997ecf853..5b01a1f44d629e563d492e6dae1788e1875da8bc 100644 (file)
@@ -27,12 +27,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "frame.h"
 #include "window.h"
 #include "dispextern.h"
 #include "charset.h"
-#include "character.h"
 #include "composite.h"
 #include "fontset.h"
 #include "font.h"
@@ -59,10 +59,6 @@ Lisp_Object Qascii_0, Qiso8859_1, Qiso10646_1, Qunicode_bmp, Qunicode_sip;
 /* Unicode category `Cf'.  */
 static Lisp_Object QCf;
 
-/* Special vector of zero length.  This is repeatedly used by (struct
-   font_driver *)->list when a specified font is not found. */
-static Lisp_Object null_vector;
-
 /* Vector of Vfont_weight_table, Vfont_slant_table, and Vfont_width_table. */
 static Lisp_Object font_style_table;
 
@@ -238,7 +234,7 @@ font_intern_prop (const char *str, ptrdiff_t len, int force_symbol)
   ptrdiff_t i;
   Lisp_Object tem;
   Lisp_Object obarray;
-  EMACS_INT nbytes, nchars;
+  ptrdiff_t nbytes, nchars;
 
   if (len == 1 && *str == '*')
     return Qnil;
@@ -264,18 +260,12 @@ font_intern_prop (const char *str, ptrdiff_t len, int force_symbol)
        }
     }
 
-  /* The following code is copied from the function intern (in
-     lread.c), and modified to suit our purpose.  */
-  obarray = Vobarray;
-  if (!VECTORP (obarray) || ASIZE (obarray) == 0)
-    obarray = check_obarray (obarray);
+  /* This code is similar to intern function from lread.c.  */
+  obarray = check_obarray (Vobarray);
   parse_str_as_multibyte ((unsigned char *) str, len, &nchars, &nbytes);
-  if (len == nchars || len != nbytes)
-    /* CONTENTS contains no multibyte sequences or contains an invalid
-       multibyte sequence.  We'll make a unibyte string.  */
-    tem = oblookup (obarray, str, len, len);
-  else
-    tem = oblookup (obarray, str, nchars, len);
+  tem = oblookup (obarray, str,
+                 (len == nchars || len != nbytes) ? len : nchars, len);
+
   if (SYMBOLP (tem))
     return tem;
   if (len == nchars || len != nbytes)
@@ -326,7 +316,10 @@ int
 font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror)
 {
   Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
-  int len = ASIZE (table);
+  int len;
+
+  CHECK_VECTOR (table);
+  len = ASIZE (table);
 
   if (SYMBOLP (val))
     {
@@ -336,10 +329,16 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
 
       /* At first try exact match.  */
       for (i = 0; i < len; i++)
-       for (j = 1; j < ASIZE (AREF (table, i)); j++)
-         if (EQ (val, AREF (AREF (table, i), j)))
-           return ((XINT (AREF (AREF (table, i), 0)) << 8)
-                   | (i << 4) | (j - 1));
+       {
+         CHECK_VECTOR (AREF (table, i));
+         for (j = 1; j < ASIZE (AREF (table, i)); j++)
+           if (EQ (val, AREF (AREF (table, i), j)))
+             {
+               CHECK_NUMBER (AREF (AREF (table, i), 0));
+               return ((XINT (AREF (AREF (table, i), 0)) << 8)
+                       | (i << 4) | (j - 1));
+             }
+       }
       /* Try also with case-folding match.  */
       s = SSDATA (SYMBOL_NAME (val));
       for (i = 0; i < len; i++)
@@ -347,8 +346,11 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
          {
            elt = AREF (AREF (table, i), j);
            if (xstrcasecmp (s, SSDATA (SYMBOL_NAME (elt))) == 0)
-             return ((XINT (AREF (AREF (table, i), 0)) << 8)
-                     | (i << 4) | (j - 1));
+             {
+               CHECK_NUMBER (AREF (AREF (table, i), 0));
+               return ((XINT (AREF (AREF (table, i), 0)) << 8)
+                       | (i << 4) | (j - 1));
+             }
          }
       if (! noerror)
        return -1;
@@ -364,12 +366,15 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror
   else
     {
       int i, last_n;
-      int numeric = XINT (val);
+      EMACS_INT numeric = XINT (val);
 
       for (i = 0, last_n = -1; i < len; i++)
        {
-         int n = XINT (AREF (AREF (table, i), 0));
+         int n;
 
+         CHECK_VECTOR (AREF (table, i));
+         CHECK_NUMBER (AREF (AREF (table, i), 0));
+         n = XINT (AREF (AREF (table, i), 0));
          if (numeric == n)
            return (n << 8) | (i << 4);
          if (numeric < n)
@@ -397,11 +402,15 @@ font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_fa
   if (NILP (val))
     return Qnil;
   table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX);
+  CHECK_VECTOR (table);
   i = XINT (val) & 0xFF;
   font_assert (((i >> 4) & 0xF) < ASIZE (table));
   elt = AREF (table, ((i >> 4) & 0xF));
+  CHECK_VECTOR (elt);
   font_assert ((i & 0xF) + 1 < ASIZE (elt));
-  return (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1));
+  elt = (for_face ? AREF (elt, 1) : AREF (elt, (i & 0xF) + 1));
+  CHECK_SYMBOL (elt);
+  return elt;
 }
 
 /* Return ENCODING or a cons of ENCODING and REPERTORY of the font
@@ -518,7 +527,8 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object val)
                                   : FONT_WIDTH_INDEX);
   if (INTEGERP (val))
     {
-      int n = XINT (val);
+      EMACS_INT n = XINT (val);
+      CHECK_VECTOR (AREF (font_style_table, prop - FONT_WEIGHT_INDEX));
       if (((n >> 4) & 0xF)
          >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX)))
        val = Qerror;
@@ -526,10 +536,15 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object val)
        {
          Lisp_Object elt = AREF (AREF (font_style_table, prop - FONT_WEIGHT_INDEX), (n >> 4) & 0xF);
 
+         CHECK_VECTOR (elt);
          if ((n & 0xF) + 1 >= ASIZE (elt))
            val = Qerror;
-         else if (XINT (AREF (elt, 0)) != (n >> 8))
-           val = Qerror;
+         else
+           {
+             CHECK_NUMBER (AREF (elt, 0));
+             if (XINT (AREF (elt, 0)) != (n >> 8))
+               val = Qerror;
+           }
        }
     }
   else if (SYMBOLP (val))
@@ -714,7 +729,7 @@ font_put_extra (Lisp_Object font, Lisp_Object prop, Lisp_Object val)
 
 static int parse_matrix (const char *);
 static int font_expand_wildcards (Lisp_Object *, int);
-static int font_parse_name (char *, Lisp_Object);
+static int font_parse_name (char *, ptrdiff_t, Lisp_Object);
 
 /* An enumerator for each field of an XLFD font name.  */
 enum xlfd_field_index
@@ -848,7 +863,7 @@ font_expand_wildcards (Lisp_Object *field, int n)
 
          if (INTEGERP (val))
            {
-             int numeric = XINT (val);
+             EMACS_INT numeric = XINT (val);
 
              if (i + 1 == n)
                from = to = XLFD_ENCODING_INDEX,
@@ -994,9 +1009,8 @@ font_expand_wildcards (Lisp_Object *field, int n)
    a fully specified XLFD.  */
 
 int
-font_parse_xlfd (char *name, Lisp_Object font)
+font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font)
 {
-  ptrdiff_t len = strlen (name);
   int i, j, n;
   char *f[XLFD_LAST_INDEX + 1];
   Lisp_Object val;
@@ -1175,7 +1189,7 @@ font_parse_xlfd (char *name, Lisp_Object font)
    length), and return the name length.  If FONT_SIZE_INDEX of FONT is
    0, use PIXEL_SIZE instead.  */
 
-int
+ptrdiff_t
 font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
 {
   char *p;
@@ -1311,12 +1325,11 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
    This function tries to guess which format it is.  */
 
 static int
-font_parse_fcname (char *name, Lisp_Object font)
+font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font)
 {
   char *p, *q;
   char *size_beg = NULL, *size_end = NULL;
   char *props_beg = NULL, *family_end = NULL;
-  ptrdiff_t len = strlen (name);
 
   if (len == 0)
     return -1;
@@ -1669,11 +1682,11 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, char *name, int nbytes)
    0.  Otherwise return -1.  */
 
 static int
-font_parse_name (char *name, Lisp_Object font)
+font_parse_name (char *name, ptrdiff_t namelen, Lisp_Object font)
 {
   if (name[0] == '-' || strchr (name, '*') || strchr (name, '?'))
-    return font_parse_xlfd (name, font);
-  return font_parse_fcname (name, font);
+    return font_parse_xlfd (name, namelen, font);
+  return font_parse_fcname (name, namelen, font);
 }
 
 
@@ -1740,7 +1753,8 @@ static int
 check_gstring (Lisp_Object gstring)
 {
   Lisp_Object val;
-  int i, j;
+  ptrdiff_t i;
+  int j;
 
   CHECK_VECTOR (gstring);
   val = AREF (gstring, 0);
@@ -1801,17 +1815,17 @@ check_otf_features (Lisp_Object otf_features)
   CHECK_CONS (otf_features);
   CHECK_SYMBOL (XCAR (otf_features));
   otf_features = XCDR (otf_features);
-  for (val = Fcar (otf_features); ! NILP (val);  val = Fcdr (val))
+  for (val = Fcar (otf_features); CONSP (val); val = XCDR (val))
     {
-      CHECK_SYMBOL (Fcar (val));
+      CHECK_SYMBOL (XCAR (val));
       if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4)
        error ("Invalid OTF GSUB feature: %s",
               SDATA (SYMBOL_NAME (XCAR (val))));
     }
   otf_features = XCDR (otf_features);
-  for (val = Fcar (otf_features); ! NILP (val);  val = Fcdr (val))
+  for (val = Fcar (otf_features); CONSP (val); val = XCDR (val))
     {
-      CHECK_SYMBOL (Fcar (val));
+      CHECK_SYMBOL (XCAR (val));
       if (SBYTES (SYMBOL_NAME (XCAR (val))) > 4)
        error ("Invalid OTF GPOS feature: %s",
               SDATA (SYMBOL_NAME (XCAR (val))));
@@ -2433,7 +2447,7 @@ font_match_p (Lisp_Object spec, Lisp_Object font)
                  /* All characters in the list must be supported.  */
                  for (; CONSP (val2); val2 = XCDR (val2))
                    {
-                     if (! NATNUMP (XCAR (val2)))
+                     if (! CHARACTERP (XCAR (val2)))
                        continue;
                      if (font_encode_char (font, XFASTINT (XCAR (val2)))
                          == FONT_INVALID_CODE)
@@ -2445,7 +2459,7 @@ font_match_p (Lisp_Object spec, Lisp_Object font)
                  /* At most one character in the vector must be supported.  */
                  for (i = 0; i < ASIZE (val2); i++)
                    {
-                     if (! NATNUMP (AREF (val2, i)))
+                     if (! CHARACTERP (AREF (val2, i)))
                        continue;
                      if (font_encode_char (font, XFASTINT (AREF (val2, i)))
                          != FONT_INVALID_CODE)
@@ -2618,15 +2632,18 @@ font_delete_unmatched (Lisp_Object vec, Lisp_Object spec, int size)
       if (! NILP (Vface_ignored_fonts))
        {
          char name[256];
+         ptrdiff_t namelen;
          Lisp_Object tail, regexp;
 
-         if (font_unparse_xlfd (entity, 0, name, 256) >= 0)
+         namelen = font_unparse_xlfd (entity, 0, name, 256);
+         if (namelen >= 0)
            {
              for (tail = Vface_ignored_fonts; CONSP (tail); tail = XCDR (tail))
                {
                  regexp = XCAR (tail);
                  if (STRINGP (regexp)
-                     && fast_c_string_match_ignore_case (regexp, name) >= 0)
+                     && fast_c_string_match_ignore_case (regexp, name,
+                                                         namelen) >= 0)
                    break;
                }
              if (CONSP (tail))
@@ -2727,7 +2744,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec)
 
            val = driver_list->driver->list (frame, scratch_font_spec);
            if (NILP (val))
-             val = null_vector;
+             val = zero_vector;
            else
              val = Fvconcat (1, &val);
            copy = copy_font_spec (scratch_font_spec);
@@ -2961,7 +2978,7 @@ font_spec_from_name (Lisp_Object font_name)
   Lisp_Object spec = Ffont_spec (0, NULL);
 
   CHECK_STRING (font_name);
-  if (font_parse_name (SSDATA (font_name), spec) == -1)
+  if (font_parse_name (SSDATA (font_name), SBYTES (font_name), spec) == -1)
     return Qnil;
   font_put_extra (spec, QCname, font_name);
   font_put_extra (spec, QCuser_spec, font_name);
@@ -3076,16 +3093,17 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
   Lisp_Object foundry[3], *family, registry[3], adstyle[3];
   int pixel_size;
   int i, j, k, l;
+  USE_SAFE_ALLOCA;
 
   registry[0] = AREF (spec, FONT_REGISTRY_INDEX);
   if (NILP (registry[0]))
     {
       registry[0] = DEFAULT_ENCODING;
       registry[1] = Qascii_0;
-      registry[2] = null_vector;
+      registry[2] = zero_vector;
     }
   else
-    registry[1] = null_vector;
+    registry[1] = zero_vector;
 
   if (c >= 0 && ! NILP (AREF (spec, FONT_REGISTRY_INDEX)))
     {
@@ -3114,20 +3132,20 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
   ASET (work, FONT_SIZE_INDEX, Qnil);
   foundry[0] = AREF (work, FONT_FOUNDRY_INDEX);
   if (! NILP (foundry[0]))
-    foundry[1] = null_vector;
+    foundry[1] = zero_vector;
   else if (STRINGP (attrs[LFACE_FOUNDRY_INDEX]))
     {
       val = attrs[LFACE_FOUNDRY_INDEX];
       foundry[0] = font_intern_prop (SSDATA (val), SBYTES (val), 1);
       foundry[1] = Qnil;
-      foundry[2] = null_vector;
+      foundry[2] = zero_vector;
     }
   else
-    foundry[0] = Qnil, foundry[1] = null_vector;
+    foundry[0] = Qnil, foundry[1] = zero_vector;
 
   adstyle[0] = AREF (work, FONT_ADSTYLE_INDEX);
   if (! NILP (adstyle[0]))
-    adstyle[1] = null_vector;
+    adstyle[1] = zero_vector;
   else if (FONTP (attrs[LFACE_FONT_INDEX]))
     {
       Lisp_Object face_font = attrs[LFACE_FONT_INDEX];
@@ -3136,13 +3154,13 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
        {
          adstyle[0] = AREF (face_font, FONT_ADSTYLE_INDEX);
          adstyle[1] = Qnil;
-         adstyle[2] = null_vector;
+         adstyle[2] = zero_vector;
        }
       else
-       adstyle[0] = Qnil, adstyle[1] = null_vector;
+       adstyle[0] = Qnil, adstyle[1] = zero_vector;
     }
   else
-    adstyle[0] = Qnil, adstyle[1] = null_vector;
+    adstyle[0] = Qnil, adstyle[1] = zero_vector;
 
 
   val = AREF (work, FONT_FAMILY_INDEX);
@@ -3155,7 +3173,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
     {
       family = alloca ((sizeof family[0]) * 2);
       family[0] = Qnil;
-      family[1] = null_vector; /* terminator.  */
+      family[1] = zero_vector; /* terminator.  */
     }
   else
     {
@@ -3164,12 +3182,13 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
 
       if (! NILP (alters))
        {
-         family = alloca ((sizeof family[0]) * (XINT (Flength (alters)) + 2));
+         EMACS_INT alterslen = XFASTINT (Flength (alters));
+         SAFE_ALLOCA_LISP (family, alterslen + 2);
          for (i = 0; CONSP (alters); i++, alters = XCDR (alters))
            family[i] = XCAR (alters);
          if (NILP (AREF (spec, FONT_FAMILY_INDEX)))
            family[i++] = Qnil;
-         family[i] = null_vector;
+         family[i] = zero_vector;
        }
       else
        {
@@ -3178,7 +3197,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
          family[i++] = val;
          if (NILP (AREF (spec, FONT_FAMILY_INDEX)))
            family[i++] = Qnil;
-         family[i] = null_vector;
+         family[i] = zero_vector;
        }
     }
 
@@ -3206,6 +3225,8 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c)
            }
        }
     }
+
+  SAFE_FREE ();
   return Qnil;
 }
 
@@ -3329,13 +3350,13 @@ font_open_by_spec (FRAME_PTR f, Lisp_Object spec)
    found, return Qnil.  */
 
 Lisp_Object
-font_open_by_name (FRAME_PTR f, const char *name)
+font_open_by_name (FRAME_PTR f, const char *name, ptrdiff_t len)
 {
   Lisp_Object args[2];
   Lisp_Object spec, ret;
 
   args[0] = QCname;
-  args[1] = make_unibyte_string (name, strlen (name));
+  args[1] = make_unibyte_string (name, len);
   spec = Ffont_spec (2, args);
   ret = font_open_by_spec (f, spec);
   /* Do not lose name originally put in.  */
@@ -3372,7 +3393,7 @@ register_font_driver (struct font_driver *driver, FRAME_PTR f)
     if (EQ (list->driver->type, driver->type))
       error ("Duplicated font driver: %s", SDATA (SYMBOL_NAME (driver->type)));
 
-  list = xmalloc (sizeof (struct font_driver_list));
+  list = xmalloc (sizeof *list);
   list->on = 0;
   list->driver = driver;
   list->next = NULL;
@@ -3522,7 +3543,7 @@ font_put_frame_data (FRAME_PTR f, struct font_driver *driver, void *data)
 
   if (! list)
     {
-      list = xmalloc (sizeof (struct font_data_list));
+      list = xmalloc (sizeof *list);
       list->driver = driver;
       list->next = f->font_data_list;
       f->font_data_list = list;
@@ -3604,7 +3625,7 @@ font_filter_properties (Lisp_Object font,
    STRING.  */
 
 static Lisp_Object
-font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
+font_at (int c, ptrdiff_t pos, struct face *face, struct window *w,
         Lisp_Object string)
 {
   FRAME_PTR f;
@@ -3620,7 +3641,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
        {
          if (multibyte)
            {
-             EMACS_INT pos_byte = CHAR_TO_BYTE (pos);
+             ptrdiff_t pos_byte = CHAR_TO_BYTE (pos);
 
              c = FETCH_CHAR (pos_byte);
            }
@@ -3634,7 +3655,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
          multibyte = STRING_MULTIBYTE (string);
          if (multibyte)
            {
-             EMACS_INT pos_byte = string_char_to_byte (string, pos);
+             ptrdiff_t pos_byte = string_char_to_byte (string, pos);
 
              str = SDATA (string) + pos_byte;
              c = STRING_CHAR (str);
@@ -3650,7 +3671,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
   if (! face)
     {
       int face_id;
-      EMACS_INT endptr;
+      ptrdiff_t endptr;
 
       if (STRINGP (string))
        face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr,
@@ -3687,9 +3708,9 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w,
    It is assured that the current buffer (or STRING) is multibyte.  */
 
 Lisp_Object
-font_range (EMACS_INT pos, EMACS_INT *limit, struct window *w, struct face *face, Lisp_Object string)
+font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face, Lisp_Object string)
 {
-  EMACS_INT pos_byte, ignore;
+  ptrdiff_t pos_byte, ignore;
   int c;
   Lisp_Object font_object = Qnil;
 
@@ -3842,7 +3863,7 @@ usage: (font-spec ARGS...)  */)
       if (EQ (key, QCname))
        {
          CHECK_STRING (val);
-         font_parse_name (SSDATA (val), spec);
+         font_parse_name (SSDATA (val), SBYTES (val), spec);
          font_put_extra (spec, key, val);
        }
       else
@@ -4095,7 +4116,7 @@ how close they are to PREFER.  */)
   (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer)
 {
   Lisp_Object vec, list;
-  int n = 0;
+  EMACS_INT n = 0;
 
   if (NILP (frame))
     frame = selected_frame;
@@ -4188,7 +4209,7 @@ the consecutive wildcards are folded into one.  */)
   (Lisp_Object font, Lisp_Object fold_wildcards)
 {
   char name[256];
-  int pixel_size = 0;
+  int namelen, pixel_size = 0;
 
   CHECK_FONT (font);
 
@@ -4202,11 +4223,13 @@ the consecutive wildcards are folded into one.  */)
          if (NILP (fold_wildcards))
            return font_name;
          strcpy (name, SSDATA (font_name));
+         namelen = SBYTES (font_name);
          goto done;
        }
       pixel_size = XFONT_OBJECT (font)->pixel_size;
     }
-  if (font_unparse_xlfd (font, pixel_size, name, 256) < 0)
+  namelen = font_unparse_xlfd (font, pixel_size, name, 256);
+  if (namelen < 0)
     return Qnil;
  done:
   if (! NILP (fold_wildcards))
@@ -4216,11 +4239,12 @@ the consecutive wildcards are folded into one.  */)
       while ((p1 = strstr (p0, "-*-*")))
        {
          strcpy (p1, p1 + 2);
+         namelen -= 2;
          p0 = p1;
        }
     }
 
-  return build_string (name);
+  return make_string (name, namelen);
 }
 
 DEFUN ("clear-font-cache", Fclear_font_cache, Sclear_font_cache, 0, 0, 0,
@@ -4262,13 +4286,10 @@ void
 font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object)
 {
   struct font *font = XFONT_OBJECT (font_object);
-  unsigned code;
-  /* ecode used in LGLYPH_SET_CODE to avoid compiler warnings.  */
-  EMACS_INT ecode = font->driver->encode_char (font, LGLYPH_CHAR (glyph));
+  unsigned code = font->driver->encode_char (font, LGLYPH_CHAR (glyph));
   struct font_metrics metrics;
 
-  LGLYPH_SET_CODE (glyph, ecode);
-  code = ecode;
+  LGLYPH_SET_CODE (glyph, code);
   font->driver->text_extents (font, &code, 1, &metrics);
   LGLYPH_SET_LBEARING (glyph, metrics.lbearing);
   LGLYPH_SET_RBEARING (glyph, metrics.rbearing);
@@ -4290,7 +4311,7 @@ created glyph-string.  Otherwise, the value is nil.  */)
 {
   struct font *font;
   Lisp_Object font_object, n, glyph;
-  EMACS_INT i, j, from, to;
+  ptrdiff_t i, j, from, to;
 
   if (! composition_gstring_p (gstring))
     signal_error ("Invalid glyph-string: ", gstring);
@@ -4309,8 +4330,7 @@ created glyph-string.  Otherwise, the value is nil.  */)
       if (INTEGERP (n))
        break;
       gstring = larger_vector (gstring,
-                              ASIZE (gstring) + LGSTRING_GLYPH_LEN (gstring),
-                              Qnil);
+                              LGSTRING_GLYPH_LEN (gstring), -1);
     }
   if (i == 3 || XINT (n) == 0)
     return Qnil;
@@ -4518,7 +4538,7 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
        doc: /* Open FONT-ENTITY.  */)
   (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame)
 {
-  int isize;
+  EMACS_INT isize;
 
   CHECK_FONT_ENTITY (font_entity);
   if (NILP (frame))
@@ -4534,6 +4554,8 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0,
        isize = POINT_TO_PIXEL (XFLOAT_DATA (size), XFRAME (frame)->resy);
       else
        isize = XINT (size);
+      if (! (INT_MIN <= isize && isize <= INT_MAX))
+       args_out_of_range (font_entity, size);
       if (isize == 0)
        isize = 120;
     }
@@ -4637,14 +4659,14 @@ the corresponding element is nil.  */)
    Lisp_Object object)
 {
   struct font *font;
-  int i, len;
+  ptrdiff_t i, len;
   Lisp_Object *chars, vec;
   USE_SAFE_ALLOCA;
 
   CHECK_FONT_GET_OBJECT (font_object, font);
   if (NILP (object))
     {
-      EMACS_INT charpos, bytepos;
+      ptrdiff_t charpos, bytepos;
 
       validate_region (&from, &to);
       if (EQ (from, to))
@@ -4750,22 +4772,22 @@ the current buffer.  It defaults to the currently selected window.  */)
   (Lisp_Object position, Lisp_Object window, Lisp_Object string)
 {
   struct window *w;
-  EMACS_INT pos;
+  ptrdiff_t pos;
 
   if (NILP (string))
     {
       CHECK_NUMBER_COERCE_MARKER (position);
-      pos = XINT (position);
-      if (pos < BEGV || pos >= ZV)
+      if (! (BEGV <= XINT (position) && XINT (position) < ZV))
        args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
+      pos = XINT (position);
     }
   else
     {
       CHECK_NUMBER (position);
       CHECK_STRING (string);
-      pos = XINT (position);
-      if (pos < 0 || pos >= SCHARS (string))
+      if (! (0 < XINT (position) && XINT (position) < SCHARS (string)))
        args_out_of_range (string, position);
+      pos = XINT (position);
     }
   if (NILP (window))
     window = selected_window;
@@ -4856,7 +4878,7 @@ If the named font is not yet loaded, return nil.  */)
 
       if (fontset >= 0)
        name = fontset_ascii (fontset);
-      font_object = font_open_by_name (f, SSDATA (name));
+      font_object = font_open_by_name (f, SSDATA (name), SBYTES (name));
     }
   else if (FONT_OBJECT_P (name))
     font_object = name;
@@ -4874,13 +4896,13 @@ If the named font is not yet loaded, return nil.  */)
   font = XFONT_OBJECT (font_object);
 
   info = Fmake_vector (make_number (7), Qnil);
-  XVECTOR (info)->contents[0] = AREF (font_object, FONT_NAME_INDEX);
-  XVECTOR (info)->contents[1] = AREF (font_object, FONT_FULLNAME_INDEX);
-  XVECTOR (info)->contents[2] = make_number (font->pixel_size);
-  XVECTOR (info)->contents[3] = make_number (font->height);
-  XVECTOR (info)->contents[4] = make_number (font->baseline_offset);
-  XVECTOR (info)->contents[5] = make_number (font->relative_compose);
-  XVECTOR (info)->contents[6] = make_number (font->default_ascent);
+  ASET (info, 0, AREF (font_object, FONT_NAME_INDEX));
+  ASET (info, 1, AREF (font_object, FONT_FULLNAME_INDEX));
+  ASET (info, 2, make_number (font->pixel_size));
+  ASET (info, 3, make_number (font->height));
+  ASET (info, 4, make_number (font->baseline_offset));
+  ASET (info, 5, make_number (font->relative_compose));
+  ASET (info, 6, make_number (font->default_ascent));
 
 #if 0
   /* As font_object is still in FONT_OBJLIST of the entity, we can't
@@ -5069,9 +5091,6 @@ syms_of_font (void)
 
   DEFSYM (QCuser_spec, "user-spec");
 
-  staticpro (&null_vector);
-  null_vector = Fmake_vector (make_number (0), Qnil);
-
   staticpro (&scratch_font_spec);
   scratch_font_spec = Ffont_spec (0, NULL);
   staticpro (&scratch_font_prefer);
index 663cc675c057ae83ad32e458e436aacb65ad5017..b4e994397dea9006754703f5c7f38920eb437c23 100644 (file)
@@ -469,11 +469,12 @@ struct font_bitmap
   } while (0)
 
 #define XFONT_SPEC(p)  \
-  (eassert (FONT_SPEC_P(p)), (struct font_spec *) XPNTR (p))
+  (eassert (FONT_SPEC_P (p)), (struct font_spec *) XUNTAG (p, Lisp_Vectorlike))
 #define XFONT_ENTITY(p)        \
-  (eassert (FONT_ENTITY_P(p)), (struct font_entity *) XPNTR (p))
+  (eassert (FONT_ENTITY_P (p)), \
+   (struct font_entity *) XUNTAG (p, Lisp_Vectorlike))
 #define XFONT_OBJECT(p)        \
-  (eassert (FONT_OBJECT_P(p)), (struct font *) XPNTR (p))
+  (eassert (FONT_OBJECT_P (p)), (struct font *) XUNTAG (p, Lisp_Vectorlike))
 #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT))
 
 /* Number of pt per inch (from the TeXbook).  */
@@ -733,13 +734,8 @@ struct font_data_list
   struct font_data_list *next;
 };
 
-EXFUN (Ffont_spec, MANY);
 extern Lisp_Object copy_font_spec (Lisp_Object);
 extern Lisp_Object merge_font_spec (Lisp_Object, Lisp_Object);
-EXFUN (Ffont_get, 2);
-EXFUN (Ffont_put, 3);
-EXFUN (Flist_fonts, 4);
-EXFUN (Ffont_xlfd_name, 2);
 
 extern Lisp_Object font_make_entity (void);
 extern Lisp_Object font_make_object (int, Lisp_Object, int);
@@ -775,7 +771,7 @@ extern void font_prepare_for_face (FRAME_PTR f, struct face *face);
 extern void font_done_for_face (FRAME_PTR f, struct face *face);
 
 extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec);
-extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name);
+extern Lisp_Object font_open_by_name (FRAME_PTR f, const char *name, ptrdiff_t len);
 
 extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len,
                                     int force_symbol);
@@ -785,15 +781,15 @@ extern void font_parse_family_registry (Lisp_Object family,
                                         Lisp_Object registry,
                                         Lisp_Object spec);
 
-extern int font_parse_xlfd (char *name, Lisp_Object font);
-extern int font_unparse_xlfd (Lisp_Object font, int pixel_size,
-                              char *name, int bytes);
+extern int font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font);
+extern ptrdiff_t font_unparse_xlfd (Lisp_Object font, int pixel_size,
+                                   char *name, int bytes);
 extern int font_unparse_fcname (Lisp_Object font, int pixel_size,
                                 char *name, int bytes);
 extern void register_font_driver (struct font_driver *driver, FRAME_PTR f);
 extern void free_font_driver_list (FRAME_PTR f);
 extern Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object list);
-extern Lisp_Object font_range (EMACS_INT, EMACS_INT *,
+extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t *,
                               struct window *, struct face *,
                               Lisp_Object);
 extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object);
index d06491ddf255d6307d2edac59652e0fd4ea7a8e5..f3bf221f2494cce25ae16b7bba8307d7e7710336 100644 (file)
@@ -24,16 +24,14 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* #define FONTSET_DEBUG */
-
 #include <config.h>
 #include <stdio.h>
 #include <setjmp.h>
 
 #include "lisp.h"
 #include "blockinput.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "ccl.h"
 #include "keyboard.h"
@@ -55,13 +53,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "font.h"
 
-#undef xassert
-#ifdef FONTSET_DEBUG
-#define xassert(X)     do {if (!(X)) abort ();} while (0)
-#else   /* not FONTSET_DEBUG */
-#define xassert(X)     (void) 0
-#endif /* not FONTSET_DEBUG */
-
 /* FONTSET
 
    A fontset is a collection of font related information to give
@@ -206,9 +197,8 @@ static void accumulate_script_ranges (Lisp_Object, Lisp_Object,
                                       Lisp_Object);
 static void set_fontset_font (Lisp_Object, Lisp_Object);
 
-#ifdef FONTSET_DEBUG
-
-/* Return 1 if ID is a valid fontset id, else return 0.  */
+/* Return 1 if ID is a valid fontset id, else return 0.
+   Optimized away if ENABLE_CHECKING is not defined.  */
 
 static int
 fontset_id_valid_p (int id)
@@ -216,8 +206,6 @@ fontset_id_valid_p (int id)
   return (id >= 0 && id < ASIZE (Vfontset_table) - 1);
 }
 
-#endif
-
 
 \f
 /********** MACROS AND FUNCTIONS TO HANDLE FONTSET **********/
@@ -416,9 +404,11 @@ reorder_font_vector (Lisp_Object font_group, struct font *font)
 
              for (tail = Vcharset_ordered_list;
                   ! EQ (tail, Vcharset_non_preferred_head) && CONSP (tail);
-                  score += 0x100, tail = XCDR (tail))
+                  tail = XCDR (tail))
                if (EQ (encoding, XCAR (tail)))
                  break;
+               else if (score <= min (INT_MAX, MOST_POSITIVE_FIXNUM) - 0x100)
+                 score += 0x100;
            }
          else
            {
@@ -457,7 +447,7 @@ fontset_get_font_group (Lisp_Object fontset, int c)
   Lisp_Object base_fontset;
   int from = 0, to = MAX_CHAR, i;
 
-  xassert (! BASE_FONTSET_P (fontset));
+  eassert (! BASE_FONTSET_P (fontset));
   if (c >= 0)
     font_group = CHAR_TABLE_REF (fontset, c);
   else
@@ -787,7 +777,7 @@ make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base)
   while (!NILP (AREF (Vfontset_table, id))) id++;
 
   if (id + 1 == size)
-    Vfontset_table = larger_vector (Vfontset_table, size + 32, Qnil);
+    Vfontset_table = larger_vector (Vfontset_table, 1, -1);
 
   fontset = Fmake_char_table (Qfontset, Qnil);
 
@@ -846,7 +836,7 @@ free_realized_fontset (FRAME_PTR f, Lisp_Object fontset)
   if (0)
     for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
       {
-       xassert (FONT_OBJECT_P (XCAR (tail)));
+       eassert (FONT_OBJECT_P (XCAR (tail)));
        font_close_object (f, XCAR (tail));
       }
 #endif
@@ -863,8 +853,8 @@ free_face_fontset (FRAME_PTR f, struct face *face)
   fontset = FONTSET_FROM_ID (face->fontset);
   if (NILP (fontset))
     return;
-  xassert (! BASE_FONTSET_P (fontset));
-  xassert (f == XFRAME (FONTSET_FRAME (fontset)));
+  eassert (! BASE_FONTSET_P (fontset));
+  eassert (f == XFRAME (FONTSET_FRAME (fontset)));
   free_realized_fontset (f, fontset);
   ASET (Vfontset_table, face->fontset, Qnil);
   if (face->fontset < next_fontset_id)
@@ -874,8 +864,8 @@ free_face_fontset (FRAME_PTR f, struct face *face)
       int id = XINT (FONTSET_ID (FONTSET_DEFAULT (fontset)));
 
       fontset = AREF (Vfontset_table, id);
-      xassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
-      xassert (f == XFRAME (FONTSET_FRAME (fontset)));
+      eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
+      eassert (f == XFRAME (FONTSET_FRAME (fontset)));
       free_realized_fontset (f, fontset);
       ASET (Vfontset_table, id, Qnil);
       if (id < next_fontset_id)
@@ -922,9 +912,9 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
   if (ASCII_CHAR_P (c) || face->fontset < 0)
     return face->ascii_face->id;
 
-  xassert (fontset_id_valid_p (face->fontset));
+  eassert (fontset_id_valid_p (face->fontset));
   fontset = FONTSET_FROM_ID (face->fontset);
-  xassert (!BASE_FONTSET_P (fontset));
+  eassert (!BASE_FONTSET_P (fontset));
 
   if (pos < 0)
     {
@@ -971,7 +961,7 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec
          FONTSET_NOFONT_FACE (fontset) = make_number (face_id);
        }
     }
-  xassert (face_id >= 0);
+  eassert (face_id >= 0);
   return face_id;
 }
 
@@ -990,9 +980,9 @@ font_for_char (struct face *face, int c, int pos, Lisp_Object object)
       return font_object;
     }
 
-  xassert (fontset_id_valid_p (face->fontset));
+  eassert (fontset_id_valid_p (face->fontset));
   fontset = FONTSET_FROM_ID (face->fontset);
-  xassert (!BASE_FONTSET_P (fontset));
+  eassert (!BASE_FONTSET_P (fontset));
   if (pos < 0)
     {
       id = -1;
@@ -1092,9 +1082,9 @@ fontset_pattern_regexp (Lisp_Object pattern)
         we convert "*" to "[^-]*" which is much faster in regular
         expression matching.  */
       if (ndashes < 14)
-       p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1);
+       p1 = regex = alloca (SBYTES (pattern) + 2 * nstars + 2 * nescs + 1);
       else
-       p1 = regex = (unsigned char *) alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1);
+       p1 = regex = alloca (SBYTES (pattern) + 5 * nstars + 2 * nescs + 1);
 
       *p1++ = '^';
       for (p0 = SDATA (pattern); *p0; p0++)
@@ -1656,7 +1646,7 @@ FONT-SPEC is a vector, a cons, or a string.  See the documentation of
       char xlfd[256];
       int len;
 
-      if (font_parse_xlfd (SSDATA (name), font_spec) < 0)
+      if (font_parse_xlfd (SSDATA (name), SBYTES (name), font_spec) < 0)
        error ("Fontset name must be in XLFD format");
       short_name = AREF (font_spec, FONT_REGISTRY_INDEX);
       if (strncmp (SSDATA (SYMBOL_NAME (short_name)), "fontset-", 8)
@@ -1678,11 +1668,11 @@ FONT-SPEC is a vector, a cons, or a string.  See the documentation of
       Fset_char_table_range (fontset, Qt, Qnil);
     }
 
-  for (; ! NILP (fontlist); fontlist = Fcdr (fontlist))
+  for (; CONSP (fontlist); fontlist = XCDR (fontlist))
     {
       Lisp_Object elt, script;
 
-      elt = Fcar (fontlist);
+      elt = XCAR (fontlist);
       script = Fcar (elt);
       elt = Fcdr (elt);
       if (CONSP (elt) && (NILP (XCDR (elt)) || CONSP (XCDR (elt))))
@@ -1700,7 +1690,7 @@ FONT-SPEC is a vector, a cons, or a string.  See the documentation of
 static Lisp_Object auto_fontset_alist;
 
 /* Number of automatically created fontsets.  */
-static printmax_t num_auto_fontsets;
+static ptrdiff_t num_auto_fontsets;
 
 /* Return a fontset synthesized from FONT-OBJECT.  This is called from
    x_new_font when FONT-OBJECT is used for the default ASCII font of a
@@ -1727,9 +1717,9 @@ fontset_from_font (Lisp_Object font_object)
     alias = intern ("fontset-startup");
   else
     {
-      char temp[sizeof "fontset-auto" + INT_STRLEN_BOUND (printmax_t)];
+      char temp[sizeof "fontset-auto" + INT_STRLEN_BOUND (ptrdiff_t)];
 
-      sprintf (temp, "fontset-auto%"pMd, num_auto_fontsets - 1);
+      sprintf (temp, "fontset-auto%"pD"d", num_auto_fontsets - 1);
       alias = intern (temp);
     }
   fontset_spec = copy_font_spec (font_spec);
@@ -1816,7 +1806,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
        doc: /* For internal use only.  */)
   (Lisp_Object position, Lisp_Object ch)
 {
-  EMACS_INT pos, pos_byte, dummy;
+  ptrdiff_t pos, pos_byte, dummy;
   int face_id;
   int c;
   struct frame *f;
@@ -1836,9 +1826,9 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0,
       struct window *w;
 
       CHECK_NUMBER_COERCE_MARKER (position);
-      pos = XINT (position);
-      if (pos < BEGV || pos >= ZV)
+      if (! (BEGV <= XINT (position) && XINT (position) < ZV))
        args_out_of_range_3 (position, make_number (BEGV), make_number (ZV));
+      pos = XINT (position);
       pos_byte = CHAR_TO_BYTE (pos);
       if (NILP (ch))
        c = FETCH_CHAR (pos_byte);
@@ -1903,8 +1893,7 @@ format is the same as above.  */)
 
   /* Recode fontsets realized on FRAME from the base fontset FONTSET
      in the table `realized'.  */
-  realized[0] = (Lisp_Object *) alloca (sizeof (Lisp_Object)
-                                       * ASIZE (Vfontset_table));
+  realized[0] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table));
   for (i = j = 0; i < ASIZE (Vfontset_table); i++)
     {
       elt = FONTSET_FROM_ID (i);
@@ -1915,8 +1904,7 @@ format is the same as above.  */)
     }
   realized[0][j] = Qnil;
 
-  realized[1] = (Lisp_Object *) alloca (sizeof (Lisp_Object)
-                                       * ASIZE (Vfontset_table));
+  realized[1] = alloca (sizeof (Lisp_Object) * ASIZE (Vfontset_table));
   for (i = j = 0; ! NILP (realized[0][i]); i++)
     {
       elt = FONTSET_DEFAULT (realized[0][i]);
@@ -2102,7 +2090,7 @@ DEFUN ("fontset-list", Ffontset_list, Sfontset_list, 0, 0, 0,
 }
 
 
-#ifdef FONTSET_DEBUG
+#ifdef ENABLE_CHECKING
 
 Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE;
 
@@ -2152,7 +2140,7 @@ DEFUN ("fontset-list-all", Ffontset_list_all, Sfontset_list_all, 0, 0, 0,
       val = Fcons (dump_fontset (AREF (Vfontset_table, i)), val);
   return (Fnreverse (val));
 }
-#endif /* FONTSET_DEBUG */
+#endif /* ENABLE_CHECKING */
 
 void
 syms_of_fontset (void)
@@ -2176,7 +2164,7 @@ syms_of_fontset (void)
   staticpro (&Vdefault_fontset);
   FONTSET_ID (Vdefault_fontset) = make_number (0);
   FONTSET_NAME (Vdefault_fontset)
-    = make_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
+    = build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default");
   ASET (Vfontset_table, 0, Vdefault_fontset);
   next_fontset_id = 1;
 
@@ -2222,12 +2210,12 @@ alternate fontnames (if any) are tried instead.  */);
   DEFVAR_LISP ("fontset-alias-alist", Vfontset_alias_alist,
               doc: /* Alist of fontset names vs the aliases.  */);
   Vfontset_alias_alist = Fcons (Fcons (FONTSET_NAME (Vdefault_fontset),
-                                      make_pure_c_string ("fontset-default")),
+                                      build_pure_c_string ("fontset-default")),
                                Qnil);
 
   DEFVAR_LISP ("vertical-centering-font-regexp",
               Vvertical_centering_font_regexp,
-              doc: /* *Regexp matching font names that require vertical centering on display.
+              doc: /* Regexp matching font names that require vertical centering on display.
 When a character is displayed with such fonts, the character is displayed
 at the vertical center of lines.  */);
   Vvertical_centering_font_regexp = Qnil;
@@ -2243,7 +2231,7 @@ at the vertical center of lines.  */);
   defsubr (&Sfontset_info);
   defsubr (&Sfontset_font);
   defsubr (&Sfontset_list);
-#ifdef FONTSET_DEBUG
+#ifdef ENABLE_CHECKING
   defsubr (&Sfontset_list_all);
 #endif
 }
index 6d6ad5dbfc6be3163cbb994ed6d7f6c76112952a..3eb8d633b6cb276391df31c18f8f65f728c3be1b 100644 (file)
@@ -39,7 +39,6 @@ extern Lisp_Object font_for_char (struct face *, int, int, Lisp_Object);
 extern int make_fontset_for_ascii_face (FRAME_PTR, int, struct face *);
 extern int fontset_from_font (Lisp_Object);
 extern int fs_query_fontset (Lisp_Object, int);
-EXFUN (Fquery_fontset, 2);
 extern Lisp_Object list_fontsets (struct frame *, Lisp_Object, int);
 
 extern Lisp_Object Qlatin;
index 1db24cc80e73edec4c1ea1e5eb3eee2921d1fd3a..8f4bdc84a31cbaa716945c8075cdb1afecb76f32 100644 (file)
@@ -131,7 +131,7 @@ set_menu_bar_lines_1 (Lisp_Object window, int n)
 {
   struct window *w = XWINDOW (window);
 
-  XSETFASTINT (w->last_modified, 0);
+  w->last_modified = 0;
   XSETFASTINT (w->top_line, XFASTINT (w->top_line) + n);
   XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - n);
 
@@ -267,63 +267,23 @@ make_frame (int mini_p)
   f = allocate_frame ();
   XSETFRAME (frame, f);
 
-  f->desired_matrix = 0;
-  f->current_matrix = 0;
-  f->desired_pool = 0;
-  f->current_pool = 0;
-  f->glyphs_initialized_p = 0;
-  f->decode_mode_spec_buffer = 0;
-  f->visible = 0;
-  f->async_visible = 0;
-  f->output_data.nothing = 0;
-  f->iconified = 0;
-  f->async_iconified = 0;
+  /* Initialize Lisp data.  Note that allocate_frame initializes all
+     Lisp data to nil, so do it only for slots which should not be nil.  */
+  f->tool_bar_position = Qtop;
+
+  /* Initialize non-Lisp data.  Note that allocate_frame zeroes out all
+     non-Lisp data, so do it only for slots which should not be zero.
+     To avoid subtle bugs and for the sake of readability, it's better to
+     initialize enum members explicitly even if their values are zero.  */
   f->wants_modeline = 1;
-  f->auto_raise = 0;
-  f->auto_lower = 0;
-  f->no_split = 0;
   f->garbaged = 1;
   f->has_minibuffer = mini_p;
-  f->focus_frame = Qnil;
-  f->explicit_name = 0;
-  f->can_have_scroll_bars = 0;
   f->vertical_scroll_bar_type = vertical_scroll_bar_none;
-  f->param_alist = Qnil;
-  f->scroll_bars = Qnil;
-  f->condemned_scroll_bars = Qnil;
-  f->face_alist = Qnil;
-  f->face_cache = NULL;
-  f->menu_bar_items = Qnil;
-  f->menu_bar_vector = Qnil;
-  f->menu_bar_items_used = 0;
-  f->buffer_predicate = Qnil;
-  f->buffer_list = Qnil;
-  f->buried_buffer_list = Qnil;
-  f->namebuf = 0;
-  f->title = Qnil;
-  f->menu_bar_window = Qnil;
-  f->tool_bar_window = Qnil;
-  f->tool_bar_items = Qnil;
-  f->tool_bar_position = Qtop;
-  f->desired_tool_bar_string = f->current_tool_bar_string = Qnil;
-  f->n_tool_bar_items = 0;
-  f->left_fringe_width = f->right_fringe_width = 0;
-  f->fringe_cols = 0;
-  f->menu_bar_lines = 0;
-  f->tool_bar_lines = 0;
-  f->scroll_bar_actual_width = 0;
-  f->border_width = 0;
-  f->internal_border_width = 0;
   f->column_width = 1;  /* !FRAME_WINDOW_P value */
   f->line_height = 1;  /* !FRAME_WINDOW_P value */
-  f->x_pixels_diff = f->y_pixels_diff = 0;
 #ifdef HAVE_WINDOW_SYSTEM
   f->want_fullscreen = FULLSCREEN_NONE;
 #endif
-  f->size_hint_flags = 0;
-  f->win_gravity = 0;
-  f->font_driver_list = NULL;
-  f->font_data_list = NULL;
 
   root_window = make_window ();
   if (mini_p)
@@ -331,7 +291,7 @@ make_frame (int mini_p)
       mini_window = make_window ();
       XWINDOW (root_window)->next = mini_window;
       XWINDOW (mini_window)->prev = root_window;
-      XWINDOW (mini_window)->mini_p = Qt;
+      XWINDOW (mini_window)->mini = 1;
       XWINDOW (mini_window)->frame = frame;
       f->minibuffer_window = mini_window;
     }
@@ -396,10 +356,7 @@ make_frame (int mini_p)
   f->selected_window = root_window;
   /* Make sure this window seems more recently used than
      a newly-created, never-selected window.  */
-  ++window_select_count;
-  XSETFASTINT (XWINDOW (f->selected_window)->use_time, window_select_count);
-
-  f->default_face_done_p = 0;
+  XWINDOW (f->selected_window)->use_time = ++window_select_count;
 
   return f;
 }
@@ -480,7 +437,7 @@ make_minibuffer_frame (void)
      as nil. */
 
   mini_window = f->minibuffer_window = f->root_window;
-  XWINDOW (mini_window)->mini_p = Qt;
+  XWINDOW (mini_window)->mini = 1;
   XWINDOW (mini_window)->next = Qnil;
   XWINDOW (mini_window)->prev = Qnil;
   XWINDOW (mini_window)->frame = frame;
@@ -520,7 +477,7 @@ make_initial_frame (void)
   Vframe_list = Fcons (frame, Vframe_list);
 
   tty_frame_count = 1;
-  f->name = make_pure_c_string ("F1");
+  f->name = build_pure_c_string ("F1");
 
   f->visible = 1;
   f->async_visible = 1;
@@ -561,9 +518,7 @@ make_terminal_frame (struct terminal *terminal)
   XSETFRAME (frame, f);
   Vframe_list = Fcons (frame, Vframe_list);
 
-  tty_frame_count++;
-  sprintf (name, "F%"pMd, tty_frame_count);
-  f->name = build_string (name);
+  f->name = make_formatted_string (name, "F%"pMd, ++tty_frame_count);
 
   f->visible = 1;              /* FRAME_SET_VISIBLE wd set frame_garbaged. */
   f->async_visible = 1;                /* Don't let visible be cleared later. */
@@ -630,8 +585,8 @@ DEFUN ("make-terminal-frame", Fmake_terminal_frame, Smake_terminal_frame,
        doc: /* Create an additional terminal frame, possibly on another terminal.
 This function takes one argument, an alist specifying frame parameters.
 
-You can create multiple frames on a single text-only terminal, but
-only one of them (the selected terminal frame) is actually displayed.
+You can create multiple frames on a single text terminal, but only one
+of them (the selected terminal frame) is actually displayed.
 
 In practice, generally you don't need to specify any parameters,
 except when you want to create a new frame on another terminal.
@@ -690,8 +645,8 @@ affects all frames on the same terminal device.  */)
                        : NULL));
       if (!NILP (tty))
         {
-          name = (char *) alloca (SBYTES (tty) + 1);
-          strncpy (name, SSDATA (tty), SBYTES (tty));
+          name = alloca (SBYTES (tty) + 1);
+          memcpy (name, SSDATA (tty), SBYTES (tty));
           name[SBYTES (tty)] = 0;
         }
 
@@ -701,8 +656,8 @@ affects all frames on the same terminal device.  */)
                             : NULL));
       if (!NILP (tty_type))
         {
-          type = (char *) alloca (SBYTES (tty_type) + 1);
-          strncpy (type, SSDATA (tty_type), SBYTES (tty_type));
+          type = alloca (SBYTES (tty_type) + 1);
+          memcpy (type, SSDATA (tty_type), SBYTES (tty_type));
           type[SBYTES (tty_type)] = 0;
         }
 
@@ -865,8 +820,8 @@ something to select a different frame, or until the next time
 this function is called.  If you are using a window system, the
 previously selected frame may be restored as the selected frame
 when returning to the command loop, because it still may have
-the window system's input focus.  On a text-only terminal, the
-next redisplay will display FRAME.
+the window system's input focus.  On a text terminal, the next
+redisplay will display FRAME.
 
 This function returns FRAME, or nil if FRAME has been deleted.  */)
   (Lisp_Object frame, Lisp_Object norecord)
@@ -1152,10 +1107,6 @@ other_visible_frames (FRAME_PTR f)
   described for Fdelete_frame.  */
 Lisp_Object
 delete_frame (Lisp_Object frame, Lisp_Object force)
-     /* If we use `register' here, gcc-4.0.2 on amd64 using
-       -DUSE_LISP_UNION_TYPE complains further down that we're getting the
-       address of `force'.  Go figure.  */
-
 {
   struct frame *f;
   struct frame *sf = SELECTED_FRAME ();
@@ -1258,7 +1209,17 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
          FOR_EACH_FRAME (tail, frame1)
            {
              if (! EQ (frame, frame1) && FRAME_LIVE_P (XFRAME (frame1)))
-               break;
+               {
+                 /* Do not change a text terminal's top-frame.  */
+                 struct frame *f1 = XFRAME (frame1);
+                 if (FRAME_TERMCAP_P (f1) || FRAME_MSDOS_P (f1))
+                   {
+                     Lisp_Object top_frame = FRAME_TTY (f1)->top_frame;
+                     if (!EQ (top_frame, frame))
+                       frame1 = top_frame;
+                   }
+                 break;
+               }
            }
        }
 #ifdef NS_IMPL_COCOA
@@ -1603,8 +1564,8 @@ before calling this function on it, like this.
   (Lisp_Object frame, Lisp_Object x, Lisp_Object y)
 {
   CHECK_LIVE_FRAME (frame);
-  CHECK_NUMBER (x);
-  CHECK_NUMBER (y);
+  CHECK_TYPE_RANGED_INTEGER (int, x);
+  CHECK_TYPE_RANGED_INTEGER (int, y);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1644,8 +1605,8 @@ before calling this function on it, like this.
   (Lisp_Object frame, Lisp_Object x, Lisp_Object y)
 {
   CHECK_LIVE_FRAME (frame);
-  CHECK_NUMBER (x);
-  CHECK_NUMBER (y);
+  CHECK_TYPE_RANGED_INTEGER (int, x);
+  CHECK_TYPE_RANGED_INTEGER (int, y);
 
   /* I think this should be done with a hook.  */
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1734,8 +1695,8 @@ usually not displayed at all, even in a window system's \"taskbar\".
 Normally you may not make FRAME invisible if all other frames are invisible,
 but if the second optional argument FORCE is non-nil, you may do so.
 
-This function has no effect on text-only terminal frames.  Such frames
-are always considered visible, whether or not they are currently being
+This function has no effect on text terminal frames.  Such frames are
+always considered visible, whether or not they are currently being
 displayed in the terminal.  */)
   (Lisp_Object frame, Lisp_Object force)
 {
@@ -1747,12 +1708,6 @@ displayed in the terminal.  */)
   if (NILP (force) && !other_visible_frames (XFRAME (frame)))
     error ("Attempt to make invisible the sole visible or iconified frame");
 
-#if 0 /* This isn't logically necessary, and it can do GC.  */
-  /* Don't let the frame remain selected.  */
-  if (EQ (frame, selected_frame))
-    do_switch_frame (next_frame (frame, Qt), 0, 0, Qnil)
-#endif
-
   /* Don't allow minibuf_window to remain on a deleted frame.  */
   if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window))
     {
@@ -1820,7 +1775,7 @@ Return nil if FRAME was made invisible, via `make-frame-invisible'.
 On graphical displays, invisible frames are not updated and are
 usually not displayed at all, even in a window system's \"taskbar\".
 
-If FRAME is a text-only terminal frame, this always returns t.
+If FRAME is a text terminal frame, this always returns t.
 Such frames are always considered visible, whether or not they are
 currently being displayed on the terminal.  */)
   (Lisp_Object frame)
@@ -1876,7 +1831,7 @@ doesn't support multiple overlapping frames, this function selects FRAME.  */)
   f = XFRAME (frame);
 
   if (FRAME_TERMCAP_P (f))
-    /* On a text-only terminal select FRAME.  */
+    /* On a text terminal select FRAME.  */
     Fselect_frame (frame, Qnil);
   else
     /* Do like the documentation says. */
@@ -1975,6 +1930,7 @@ See `redirect-frame-focus'.  */)
 \f
 /* Return the value of frame parameter PROP in frame FRAME.  */
 
+#ifdef HAVE_WINDOW_SYSTEM
 #if !HAVE_NS
 static
 #endif
@@ -1988,6 +1944,7 @@ get_frame_param (register struct frame *frame, Lisp_Object prop)
     return tem;
   return Fcdr (tem);
 }
+#endif
 
 /* Return the buffer-predicate of the selected frame.  */
 
@@ -2037,7 +1994,7 @@ store_in_alist (Lisp_Object *alistptr, Lisp_Object prop, Lisp_Object val)
 }
 
 static int
-frame_name_fnn_p (char *str, EMACS_INT len)
+frame_name_fnn_p (char *str, ptrdiff_t len)
 {
   if (len > 1 && str[0] == 'F' && '0' <= str[1] && str[1] <= '9')
     {
@@ -2069,9 +2026,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
                            SBYTES (f->name)))
        return;
 
-      tty_frame_count++;
-      sprintf (namebuf, "F%"pMd, tty_frame_count);
-      name = build_string (namebuf);
+      name = make_formatted_string (namebuf, "F%"pMd, ++tty_frame_count);
     }
   else
     {
@@ -2321,7 +2276,7 @@ If FRAME is nil, describe the currently selected frame.  */)
              if (STRINGP (value) && !FRAME_WINDOW_P (f))
                {
                  const char *color_name;
-                 EMACS_INT csz;
+                 ptrdiff_t csz;
 
                  if (EQ (parameter, Qbackground_color))
                    {
@@ -2397,12 +2352,13 @@ use is not recommended.  Explicitly check for a frame-parameter instead.  */)
 #endif
 
     {
-      int length = XINT (Flength (alist));
-      int i;
-      Lisp_Object *parms
-       = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
-      Lisp_Object *values
-       = (Lisp_Object *) alloca (length * sizeof (Lisp_Object));
+      EMACS_INT length = XFASTINT (Flength (alist));
+      ptrdiff_t i;
+      Lisp_Object *parms;
+      Lisp_Object *values;
+      USE_SAFE_ALLOCA;
+      SAFE_ALLOCA_LISP (parms, 2 * length);
+      values = parms + length;
 
       /* Extract parm names and values into those vectors.  */
 
@@ -2428,6 +2384,8 @@ use is not recommended.  Explicitly check for a frame-parameter instead.  */)
              || EQ (prop, Qbackground_color))
            update_face_from_frame_parameter (f, prop, val);
        }
+
+      SAFE_FREE ();
     }
   return Qnil;
 }
@@ -2494,7 +2452,7 @@ not the menu bar).
 In a graphical version with no toolkit, it includes both the tool bar
 and menu bar.
 
-For a text-only terminal, it includes the menu bar.  In this case, the
+For a text terminal, it includes the menu bar.  In this case, the
 result is really in characters rather than pixels (i.e., is identical
 to `frame-height'). */)
   (Lisp_Object frame)
@@ -2544,16 +2502,13 @@ or right side of FRAME.  If FRAME is omitted, the selected frame is
 used.  */)
   (Lisp_Object frame)
 {
-  struct frame *f;
-
   if (NILP (frame))
     frame = selected_frame;
   CHECK_FRAME (frame);
-  f = XFRAME (frame);
 
 #ifdef FRAME_TOOLBAR_WIDTH
-  if (FRAME_WINDOW_P (f))
-    return make_number (FRAME_TOOLBAR_WIDTH (f));
+  if (FRAME_WINDOW_P (XFRAME (frame)))
+    return make_number (FRAME_TOOLBAR_WIDTH (XFRAME (frame)));
 #endif
   return make_number (0);
 }
@@ -2566,7 +2521,7 @@ but that the idea of the actual height of the frame should not be changed.  */)
 {
   register struct frame *f;
 
-  CHECK_NUMBER (lines);
+  CHECK_TYPE_RANGED_INTEGER (int, lines);
   if (NILP (frame))
     frame = selected_frame;
   CHECK_LIVE_FRAME (frame);
@@ -2593,7 +2548,7 @@ but that the idea of the actual width of the frame should not be changed.  */)
   (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend)
 {
   register struct frame *f;
-  CHECK_NUMBER (cols);
+  CHECK_TYPE_RANGED_INTEGER (int, cols);
   if (NILP (frame))
     frame = selected_frame;
   CHECK_LIVE_FRAME (frame);
@@ -2620,8 +2575,8 @@ DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0,
   register struct frame *f;
 
   CHECK_LIVE_FRAME (frame);
-  CHECK_NUMBER (cols);
-  CHECK_NUMBER (rows);
+  CHECK_TYPE_RANGED_INTEGER (int, cols);
+  CHECK_TYPE_RANGED_INTEGER (int, rows);
   f = XFRAME (frame);
 
   /* I think this should be done with a hook.  */
@@ -2652,8 +2607,8 @@ the rightmost or bottommost possible position (that stays within the screen).  *
   register struct frame *f;
 
   CHECK_LIVE_FRAME (frame);
-  CHECK_NUMBER (xoffset);
-  CHECK_NUMBER (yoffset);
+  CHECK_TYPE_RANGED_INTEGER (int, xoffset);
+  CHECK_TYPE_RANGED_INTEGER (int, yoffset);
   f = XFRAME (frame);
 
   /* I think this should be done with a hook.  */
@@ -2799,11 +2754,11 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
   struct gcpro gcpro1, gcpro2;
 
   i = 0;
-  for (tail = alist; CONSP (tail); tail = Fcdr (tail))
+  for (tail = alist; CONSP (tail); tail = XCDR (tail))
     i++;
 
-  parms = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
-  values = (Lisp_Object *) alloca (i * sizeof (Lisp_Object));
+  parms = alloca (i * sizeof *parms);
+  values = alloca (i * sizeof *values);
 
   /* Extract parm names and values into those vectors.  */
 
@@ -2872,12 +2827,12 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
       prop = parms[i];
       val = values[i];
 
-      if (EQ (prop, Qwidth) && NATNUMP (val))
+      if (EQ (prop, Qwidth) && RANGED_INTEGERP (0, val, INT_MAX))
         {
           size_changed = 1;
           width = XFASTINT (val);
         }
-      else if (EQ (prop, Qheight) && NATNUMP (val))
+      else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX))
         {
           size_changed = 1;
           height = XFASTINT (val);
@@ -2913,7 +2868,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
     }
 
   /* Don't die if just one of these was set.  */
-  if (EQ (left, Qunbound))
+  if (! TYPE_RANGED_INTEGERP (int, left))
     {
       left_no_change = 1;
       if (f->left_pos < 0)
@@ -2921,7 +2876,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
       else
        XSETINT (left, f->left_pos);
     }
-  if (EQ (top, Qunbound))
+  if (! TYPE_RANGED_INTEGERP (int, top))
     {
       top_no_change = 1;
       if (f->top_pos < 0)
@@ -2931,14 +2886,14 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
     }
 
   /* If one of the icon positions was not set, preserve or default it.  */
-  if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left))
+  if (! TYPE_RANGED_INTEGERP (int, icon_left))
     {
       icon_left_no_change = 1;
       icon_left = Fcdr (Fassq (Qicon_left, f->param_alist));
       if (NILP (icon_left))
        XSETINT (icon_left, 0);
     }
-  if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top))
+  if (! TYPE_RANGED_INTEGERP (int, icon_top))
     {
       icon_top_no_change = 1;
       icon_top = Fcdr (Fassq (Qicon_top, f->param_alist));
@@ -3090,20 +3045,16 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
      actually a pointer.  Explicit casting avoids compiler
      warnings.  */
   w = (unsigned long) FRAME_X_WINDOW (f);
-  sprintf (buf, "%lu", w);
   store_in_alist (alistptr, Qwindow_id,
-                 build_string (buf));
+                 make_formatted_string (buf, "%lu", w));
 #ifdef HAVE_X_WINDOWS
 #ifdef USE_X_TOOLKIT
   /* Tooltip frame may not have this widget.  */
   if (FRAME_X_OUTPUT (f)->widget)
 #endif
-    {
-      w = (unsigned long) FRAME_OUTER_WINDOW (f);
-      sprintf (buf, "%lu", w);
-    }
+    w = (unsigned long) FRAME_OUTER_WINDOW (f);
   store_in_alist (alistptr, Qouter_window_id,
-                 build_string (buf));
+                 make_formatted_string (buf, "%lu", w));
 #endif
   store_in_alist (alistptr, Qicon_name, f->icon_name);
   FRAME_SAMPLE_VISIBILITY (f);
@@ -3153,7 +3104,7 @@ x_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
 {
   if (NILP (new_value))
     f->extra_line_spacing = 0;
-  else if (NATNUMP (new_value))
+  else if (RANGED_INTEGERP (0, new_value, INT_MAX))
     f->extra_line_spacing = XFASTINT (new_value);
   else
     signal_error ("Invalid line-spacing", new_value);
@@ -3198,8 +3149,11 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
 void
 x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
-  Lisp_Object font_object, font_param = Qnil;
+  Lisp_Object font_object;
   int fontset = -1;
+#ifdef HAVE_X_WINDOWS
+  Lisp_Object font_param = arg;
+#endif
 
   /* Set the frame parameter back to the old value because we may
      fail to use ARG as the new parameter value.  */
@@ -3210,11 +3164,10 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
      never fail.  */
   if (STRINGP (arg))
     {
-      font_param = arg;
       fontset = fs_query_fontset (arg, 0);
       if (fontset < 0)
        {
-         font_object = font_open_by_name (f, SSDATA (arg));
+         font_object = font_open_by_name (f, SSDATA (arg), SBYTES (arg));
          if (NILP (font_object))
            error ("Font `%s' is not defined", SSDATA (arg));
          arg = AREF (font_object, FONT_NAME_INDEX);
@@ -3223,7 +3176,7 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
        {
          Lisp_Object ascii_font = fontset_ascii (fontset);
 
-         font_object = font_open_by_name (f, SSDATA (ascii_font));
+         font_object = font_open_by_name (f, SSDATA (ascii_font), SBYTES (ascii_font));
          if (NILP (font_object))
            error ("Font `%s' is not defined", SDATA (arg));
          arg = AREF (font_object, FONT_NAME_INDEX);
@@ -3241,12 +3194,16 @@ x_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
        error ("Unknown fontset: %s", SDATA (XCAR (arg)));
       font_object = XCDR (arg);
       arg = AREF (font_object, FONT_NAME_INDEX);
+#ifdef HAVE_X_WINDOWS
       font_param = Ffont_get (font_object, QCname);
+#endif
     }
   else if (FONT_OBJECT_P (arg))
     {
       font_object = arg;
+#ifdef HAVE_X_WINDOWS
       font_param = Ffont_get (font_object, QCname);
+#endif
       /* This is to store the XLFD font name in the frame parameter for
         backward compatibility.  We should store the font-object
         itself in the future.  */
@@ -3362,7 +3319,7 @@ x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
 void
 x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 {
-  CHECK_NUMBER (arg);
+  CHECK_TYPE_RANGED_INTEGER (int, arg);
 
   if (XINT (arg) == f->border_width)
     return;
@@ -3378,7 +3335,7 @@ x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldva
 {
   int old = FRAME_INTERNAL_BORDER_WIDTH (f);
 
-  CHECK_NUMBER (arg);
+  CHECK_TYPE_RANGED_INTEGER (int, arg);
   FRAME_INTERNAL_BORDER_WIDTH (f) = XINT (arg);
   if (FRAME_INTERNAL_BORDER_WIDTH (f) < 0)
     FRAME_INTERNAL_BORDER_WIDTH (f) = 0;
@@ -3664,17 +3621,17 @@ xrdb_get_resource (XrmDatabase rdb, Lisp_Object attribute, Lisp_Object class, Li
 
   /* Allocate space for the components, the dots which separate them,
      and the final '\0'.  Make them big enough for the worst case.  */
-  name_key = (char *) alloca (SBYTES (Vx_resource_name)
-                             + (STRINGP (component)
-                                ? SBYTES (component) : 0)
-                             + SBYTES (attribute)
-                             + 3);
-
-  class_key = (char *) alloca (SBYTES (Vx_resource_class)
-                              + SBYTES (class)
-                              + (STRINGP (subclass)
-                                 ? SBYTES (subclass) : 0)
-                              + 3);
+  name_key = alloca (SBYTES (Vx_resource_name)
+                    + (STRINGP (component)
+                       ? SBYTES (component) : 0)
+                    + SBYTES (attribute)
+                    + 3);
+
+  class_key = alloca (SBYTES (Vx_resource_class)
+                     + SBYTES (class)
+                     + (STRINGP (subclass)
+                        ? SBYTES (subclass) : 0)
+                     + 3);
 
   /* Start with emacs.FRAMENAME for the name (the specific one)
      and with `Emacs' for the class key (the general one).  */
@@ -3750,8 +3707,7 @@ x_get_resource_string (const char *attribute, const char *class)
   /* Allocate space for the components, the dots which separate them,
      and the final '\0'.  */
   SAFE_ALLOCA (name_key, char *, invocation_namelen + strlen (attribute) + 2);
-  class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
-                              + strlen (class) + 2);
+  class_key = alloca ((sizeof (EMACS_CLASS) - 1) + strlen (class) + 2);
 
   esprintf (name_key, "%s.%s", SSDATA (Vinvocation_name), attribute);
   sprintf (class_key, "%s.%s", EMACS_CLASS, class);
@@ -3943,7 +3899,7 @@ On Nextstep, this just calls `ns-parse-geometry'.  */)
   (Lisp_Object string)
 {
 #ifdef HAVE_NS
-  call1 (Qns_parse_geometry, string);
+  return call1 (Qns_parse_geometry, string);
 #else
   int geometry, x, y;
   unsigned int width, height;
@@ -4115,7 +4071,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p)
        f->top_pos = 0;
       else
        {
-         CHECK_NUMBER (tem0);
+         CHECK_TYPE_RANGED_INTEGER (int, tem0);
          f->top_pos = XINT (tem0);
          if (f->top_pos < 0)
            window_prompting |= YNegative;
@@ -4143,7 +4099,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p)
        f->left_pos = 0;
       else
        {
-         CHECK_NUMBER (tem1);
+         CHECK_TYPE_RANGED_INTEGER (int, tem1);
          f->left_pos = XINT (tem1);
          if (f->left_pos < 0)
            window_prompting |= XNegative;
index 5c89fc69628fc7c22254375b38ad99aad29d2c80..1a8bff7c3e7b7364e8ec40a74841887014b3daaf 100644 (file)
@@ -322,7 +322,7 @@ struct frame
     struct x_output *x;         /* xterm.h */
     struct w32_output *w32;     /* w32term.h */
     struct ns_output *ns;       /* nsterm.h */
-    EMACS_INT nothing;
+    intptr_t nothing;
   }
   output_data;
 
@@ -501,7 +501,8 @@ struct frame
 
 typedef struct frame *FRAME_PTR;
 
-#define XFRAME(p) (eassert (FRAMEP(p)),(struct frame *) XPNTR (p))
+#define XFRAME(p) \
+  (eassert (FRAMEP (p)), (struct frame *) XUNTAG (p, Lisp_Vectorlike))
 #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME))
 
 /* Given a window, return its frame as a Lisp_Object.  */
index 5285d09dfb0957f16f1722633f5bbc7c1df0084d..97d03a2bfae8a2d705b06a9076922d1df76b5419 100644 (file)
@@ -24,6 +24,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "frame.h"
 #include "window.h"
 #include "dispextern.h"
+#include "character.h"
 #include "buffer.h"
 #include "blockinput.h"
 #include "termhooks.h"
@@ -106,6 +107,22 @@ struct fringe_bitmap
 static unsigned short question_mark_bits[] = {
   0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18};
 
+/* An exclamation mark.  */
+/*
+  ...XX...
+  ...XX...
+  ...XX...
+  ...XX...
+  ...XX...
+  ...XX...
+  ...XX...
+  ........
+  ...XX...
+  ...XX...
+*/
+static unsigned short exclamation_mark_bits[] = {
+  0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x18};
+
 /* An arrow like this: `<-'.  */
 /*
   ...xx...
@@ -431,6 +448,7 @@ static struct fringe_bitmap standard_bitmaps[] =
 {
   { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */
   { FRBITS (question_mark_bits),      8, 0, ALIGN_BITMAP_CENTER, 0 },
+  { FRBITS (exclamation_mark_bits),   8, 0, ALIGN_BITMAP_CENTER, 0 },
   { FRBITS (left_arrow_bits),         8, 0, ALIGN_BITMAP_CENTER, 0 },
   { FRBITS (right_arrow_bits),        8, 0, ALIGN_BITMAP_CENTER, 0 },
   { FRBITS (up_arrow_bits),           8, 0, ALIGN_BITMAP_TOP,    0 },
@@ -474,7 +492,7 @@ int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
 int
 lookup_fringe_bitmap (Lisp_Object bitmap)
 {
-  int bn;
+  EMACS_INT bn;
 
   bitmap = Fget (bitmap, Qfringe);
   if (!INTEGERP (bitmap))
@@ -696,7 +714,7 @@ static int
 get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, int partial_p)
 {
   Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm;
-  int ln1 = 0, ln2 = 0;
+  EMACS_INT ln1 = 0, ln2 = 0;
   int ix1 = right_p;
   int ix2 = ix1 + (partial_p ? 2 : 0);
 
@@ -848,7 +866,7 @@ draw_fringe_bitmap (struct window *w, struct glyph_row *row, int left_p)
 void
 draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row)
 {
-  xassert (interrupt_input_blocked);
+  eassert (interrupt_input_blocked);
 
   /* If row is completely invisible, because of vscrolling, we
      don't have to draw anything.  */
@@ -1555,7 +1573,7 @@ If BITMAP already exists, the existing definition is replaced.  */)
   else
     {
       CHECK_NUMBER (height);
-      fb.height = min (XINT (height), 255);
+      fb.height = max (0, min (XINT (height), 255));
       if (fb.height > h)
        {
          fill1 = (fb.height - h) / 2;
@@ -1568,7 +1586,7 @@ If BITMAP already exists, the existing definition is replaced.  */)
   else
     {
       CHECK_NUMBER (width);
-      fb.width = min (XINT (width), 255);
+      fb.width = max (0, min (XINT (width), 255));
     }
 
   fb.period = 0;
@@ -1615,12 +1633,10 @@ If BITMAP already exists, the existing definition is replaced.  */)
                error ("No free fringe bitmap slots");
 
              i = max_fringe_bitmaps;
-             fringe_bitmaps
-               = ((struct fringe_bitmap **)
-                  xrealloc (fringe_bitmaps, bitmaps * sizeof *fringe_bitmaps));
-             fringe_faces
-               = (Lisp_Object *) xrealloc (fringe_faces,
-                                           bitmaps * sizeof *fringe_faces);
+             fringe_bitmaps = xrealloc (fringe_bitmaps,
+                                        bitmaps * sizeof *fringe_bitmaps);
+             fringe_faces = xrealloc (fringe_faces,
+                                      bitmaps * sizeof *fringe_faces);
 
              for (i = max_fringe_bitmaps; i < bitmaps; i++)
                {
@@ -1638,8 +1654,7 @@ If BITMAP already exists, the existing definition is replaced.  */)
 
   fb.dynamic = 1;
 
-  xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
-                                         + fb.height * BYTES_PER_BITMAP_ROW);
+  xfb = xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW);
   fb.bits = b = (unsigned short *) (xfb + 1);
   memset (b, 0, fb.height);
 
@@ -1671,23 +1686,27 @@ If FACE is nil, reset face to default fringe face.  */)
   (Lisp_Object bitmap, Lisp_Object face)
 {
   int n;
-  int face_id;
 
   CHECK_SYMBOL (bitmap);
   n = lookup_fringe_bitmap (bitmap);
   if (!n)
     error ("Undefined fringe bitmap");
 
+  /* The purpose of the following code is to signal an error if FACE
+     is not a face.  This is for the caller's convenience only; the
+     redisplay code should be able to fail gracefully.  Skip the check
+     if FRINGE_FACE_ID is unrealized (as in batch mode and during
+     daemon startup).  */
   if (!NILP (face))
     {
-      face_id = lookup_derived_face (SELECTED_FRAME (), face,
-                                    FRINGE_FACE_ID, 1);
-      if (face_id < 0)
+      struct frame *f = SELECTED_FRAME ();
+
+      if (FACE_FROM_ID (f, FRINGE_FACE_ID)
+         && lookup_derived_face (f, face, FRINGE_FACE_ID, 1) < 0)
        error ("No such face");
     }
 
   fringe_faces[n] = face;
-
   return Qnil;
 }
 
@@ -1704,7 +1723,7 @@ Return nil if POS is not visible in WINDOW.  */)
 {
   struct window *w;
   struct glyph_row *row;
-  int textpos;
+  ptrdiff_t textpos;
 
   if (NILP (window))
     window = selected_window;
@@ -1714,6 +1733,8 @@ Return nil if POS is not visible in WINDOW.  */)
   if (!NILP (pos))
     {
       CHECK_NUMBER_COERCE_MARKER (pos);
+      if (! (BEGV <= XINT (pos) && XINT (pos) <= ZV))
+       args_out_of_range (window, pos);
       textpos = XINT (pos);
     }
   else if (w == XWINDOW (selected_window))
@@ -1754,7 +1775,7 @@ syms_of_fringe (void)
   defsubr (&Sset_fringe_bitmap_face);
 
   DEFVAR_LISP ("overflow-newline-into-fringe", Voverflow_newline_into_fringe,
-    doc: /* *Non-nil means that newline may flow into the right fringe.
+    doc: /* Non-nil means that newline may flow into the right fringe.
 This means that display lines which are exactly as wide as the window
 (not counting the final newline) will only occupy one screen line, by
 showing (or hiding) the final newline in the right fringe; when point
@@ -1797,16 +1818,11 @@ init_fringe (void)
 
   max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
 
-  fringe_bitmaps
-    = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
-  fringe_faces
-    = (Lisp_Object *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object));
+  fringe_bitmaps = xzalloc (max_fringe_bitmaps * sizeof *fringe_bitmaps);
+  fringe_faces = xmalloc (max_fringe_bitmaps * sizeof *fringe_faces);
 
   for (i = 0; i < max_fringe_bitmaps; i++)
-    {
-      fringe_bitmaps[i] = NULL;
-      fringe_faces[i] = Qnil;
-    }
+    fringe_faces[i] = Qnil;
 }
 
 #ifdef HAVE_NTGUI
index 131465b4f85f21f69d21f4cdae6469e0b3e4c0ec..131a27f76e014a403ccda3f2615d975471268e2a 100644 (file)
@@ -372,7 +372,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
     {
       entity = key;
       val = assq_no_quit (QCfont_entity, AREF (entity, FONT_EXTRA_INDEX));
-      xassert (CONSP (val));
+      eassert (CONSP (val));
       key = XCDR (val);
     }
   else
@@ -392,7 +392,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
          args[1] = Qequal;
          ft_face_cache = Fmake_hash_table (2, args);
        }
-      cache_data = xmalloc (sizeof (struct ftfont_cache_data));
+      cache_data = xmalloc (sizeof *cache_data);
       cache_data->ft_face = NULL;
       cache_data->fc_charset = NULL;
       val = make_save_value (NULL, 0);
@@ -525,7 +525,7 @@ static int ftfont_variation_glyphs (struct font *, int c,
 
 struct font_driver ftfont_driver =
   {
-    0,                         /* Qfreetype */
+    LISP_INITIALLY_ZERO,       /* Qfreetype */
     0,                         /* case insensitive */
     ftfont_get_cache,
     ftfont_list,
@@ -598,7 +598,9 @@ ftfont_get_charset (Lisp_Object registry)
   re[j] = '\0';
   regexp = make_unibyte_string (re, j);
   for (i = 0; fc_charset_table[i].name; i++)
-    if (fast_c_string_match_ignore_case (regexp, fc_charset_table[i].name) >= 0)
+    if (fast_c_string_match_ignore_case
+       (regexp, fc_charset_table[i].name,
+        strlen (fc_charset_table[i].name)) >= 0)
       break;
   if (! fc_charset_table[i].name)
     return -1;
@@ -657,7 +659,7 @@ struct OpenTypeSpec
 static struct OpenTypeSpec *
 ftfont_get_open_type_spec (Lisp_Object otf_spec)
 {
-  struct OpenTypeSpec *spec = malloc (sizeof (struct OpenTypeSpec));
+  struct OpenTypeSpec *spec = malloc (sizeof *spec);
   Lisp_Object val;
   int i, j, negative;
 
@@ -696,7 +698,7 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
       spec->features[i] =
        (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XINT (len)
         ? 0
-        : malloc (sizeof (int) * XINT (len)));
+        : malloc (XINT (len) * sizeof *spec->features[i]));
       if (! spec->features[i])
        {
          if (i > 0 && spec->features[0])
@@ -1033,13 +1035,13 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec)
 #endif /* HAVE_LIBOTF */
       if (VECTORP (chars))
        {
-         int j;
+         ptrdiff_t j;
 
          if (FcPatternGetCharSet (fontset->fonts[i], FC_CHARSET, 0, &charset)
              != FcResultMatch)
            continue;
          for (j = 0; j < ASIZE (chars); j++)
-           if (NATNUMP (AREF (chars, j))
+           if (TYPE_RANGED_INTEGERP (FcChar32, AREF (chars, j))
                && FcCharSetHasChar (charset, XFASTINT (AREF (chars, j))))
              break;
          if (j == ASIZE (chars))
@@ -1325,7 +1327,7 @@ ftfont_close (FRAME_PTR f, struct font *font)
 
   val = Fcons (font->props[FONT_FILE_INDEX], make_number (ftfont_info->index));
   cache = ftfont_lookup_cache (val, FTFONT_CACHE_FOR_FACE);
-  xassert (CONSP (cache));
+  eassert (CONSP (cache));
   val = XCDR (cache);
   (XSAVE_VALUE (val)->integer)--;
   if (XSAVE_VALUE (val)->integer == 0)
@@ -2394,8 +2396,8 @@ static Lisp_Object
 ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
                     FT_Face ft_face, OTF *otf, FT_Matrix *matrix)
 {
-  EMACS_INT len = LGSTRING_GLYPH_LEN (lgstring);
-  EMACS_INT i;
+  ptrdiff_t len = LGSTRING_GLYPH_LEN (lgstring);
+  ptrdiff_t i;
   struct MFLTFontFT flt_font_ft;
   MFLT *flt = NULL;
   int with_variation_selector = 0;
@@ -2423,7 +2425,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
     }
 
   len = i;
-  lint_assume (len <= TYPE_MAXIMUM (EMACS_INT) - 2);
+  lint_assume (len <= STRING_BYTES_BOUND);
 
   if (with_variation_selector)
     {
@@ -2460,15 +2462,16 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font,
   if (gstring.allocated == 0)
     {
       gstring.glyph_size = sizeof (MFLTGlyph);
-      gstring.glyphs = xnmalloc (len * 2, sizeof (MFLTGlyph));
+      gstring.glyphs = xnmalloc (len * 2, sizeof *gstring.glyphs);
       gstring.allocated = len * 2;
     }
   else if (gstring.allocated < len * 2)
     {
-      gstring.glyphs = xnrealloc (gstring.glyphs, len * 2, sizeof (MFLTGlyph));
+      gstring.glyphs = xnrealloc (gstring.glyphs, len * 2,
+                                 sizeof *gstring.glyphs);
       gstring.allocated = len * 2;
     }
-  memset (gstring.glyphs, 0, sizeof (MFLTGlyph) * len);
+  memset (gstring.glyphs, 0, len * sizeof *gstring.glyphs);
   for (i = 0; i < len; i++)
     {
       Lisp_Object g = LGSTRING_GLYPH (lgstring, i);
index 9fe4d41dcc521ffb6b710cd1e62f4d86a4f5ef83..6ebe0798b4e3cace652c6b298707f33c422d8a9a 100644 (file)
@@ -90,7 +90,7 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba
        }
     }
 
-  new = malloc (sizeof (struct ftxfont_frame_data));
+  new = malloc (sizeof *new);
   if (! new)
     return NULL;
   new->next = this;
index 7b5e6df009ba15f6479af42b60fc18d48ab98e62..78d6934755bce37edb10be7c73b6f6bebd81e8f8 100644 (file)
@@ -1,9 +1,3 @@
-/* This file is no longer automatically generated from libc.  */
-
-#define _MALLOC_INTERNAL
-
-/* The malloc headers and source files from the C library follow here.  */
-
 /* Declarations for `malloc' and friends.
    Copyright (C) 1990, 1991, 1992, 1993, 1995, 1996, 1999, 2002, 2003, 2004,
                  2005, 2006, 2007 Free Software Foundation, Inc.
@@ -27,76 +21,50 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
-#ifndef _MALLOC_H
-
-#define _MALLOC_H      1
-
-#ifdef _MALLOC_INTERNAL
-
-#ifdef HAVE_CONFIG_H
 #include <config.h>
-#endif
 
 #ifdef HAVE_PTHREAD
 #define USE_PTHREAD
 #endif
 
-#undef PP
-#define        PP(args)        args
-#undef __ptr_t
-#define        __ptr_t         void *
-
 #include <string.h>
 #include <limits.h>
+#include <stdint.h>
 #include <unistd.h>
 
 #ifdef USE_PTHREAD
 #include <pthread.h>
 #endif
 
-#endif /* _MALLOC_INTERNAL.  */
-
-
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
 #include <stddef.h>
-#define        __malloc_size_t         size_t
-#define        __malloc_ptrdiff_t      ptrdiff_t
 
 
 /* Allocate SIZE bytes of memory.  */
-extern __ptr_t malloc PP ((__malloc_size_t __size));
+extern void *malloc (size_t size);
 /* Re-allocate the previously allocated block
-   in __ptr_t, making the new block SIZE bytes long.  */
-extern __ptr_t realloc PP ((__ptr_t __ptr, __malloc_size_t __size));
+   in ptr, making the new block SIZE bytes long.  */
+extern void *realloc (void *ptr, size_t size);
 /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
-extern __ptr_t calloc PP ((__malloc_size_t __nmemb, __malloc_size_t __size));
+extern void *calloc (size_t nmemb, size_t size);
 /* Free a block allocated by `malloc', `realloc' or `calloc'.  */
-extern void free PP ((__ptr_t __ptr));
+extern void free (void *ptr);
 
 /* Allocate SIZE bytes allocated to ALIGNMENT bytes.  */
-#if !defined (_MALLOC_INTERNAL) || defined (MSDOS) /* Avoid conflict.  */
-extern __ptr_t memalign PP ((__malloc_size_t __alignment,
-                            __malloc_size_t __size));
-extern int posix_memalign PP ((__ptr_t *, __malloc_size_t,
-                              __malloc_size_t size));
-#endif
-
-/* Allocate SIZE bytes on a page boundary.  */
-#if ! (defined (_MALLOC_INTERNAL) && defined (GMALLOC_INHIBIT_VALLOC))
-extern __ptr_t valloc PP ((__malloc_size_t __size));
+#ifdef MSDOS
+extern void *memalign (size_t, size_t);
+extern int posix_memalign (void **, size_t, size_t);
 #endif
 
 #ifdef USE_PTHREAD
 /* Set up mutexes and make malloc etc. thread-safe.  */
-extern void malloc_enable_thread PP ((void));
+extern void malloc_enable_thread (void);
 #endif
 
-#ifdef _MALLOC_INTERNAL
-
 /* The allocator divides the heap into blocks of fixed size; large
    requests receive one or more whole blocks, and small requests
    receive a fragment of a block.  Fragment sizes are powers of two,
@@ -128,22 +96,22 @@ typedef union
          {
            struct
              {
-               __malloc_size_t nfree; /* Free frags in a fragmented block.  */
-               __malloc_size_t first; /* First free fragment of the block.  */
+               size_t nfree; /* Free frags in a fragmented block.  */
+               size_t first; /* First free fragment of the block.  */
              } frag;
            /* For a large object, in its first block, this has the number
               of blocks in the object.  In the other blocks, this has a
               negative number which says how far back the first block is.  */
-           __malloc_ptrdiff_t size;
+           ptrdiff_t size;
          } info;
       } busy;
     /* Heap information for a free block
        (that may be the first of a free cluster).  */
     struct
       {
-       __malloc_size_t size;   /* Size (in blocks) of a free cluster.  */
-       __malloc_size_t next;   /* Index of next free cluster.  */
-       __malloc_size_t prev;   /* Index of previous free cluster.  */
+       size_t size;    /* Size (in blocks) of a free cluster.  */
+       size_t next;    /* Index of next free cluster.  */
+       size_t prev;    /* Index of previous free cluster.  */
       } free;
   } malloc_info;
 
@@ -155,13 +123,13 @@ extern malloc_info *_heapinfo;
 
 /* Address to block number and vice versa.  */
 #define BLOCK(A)       (((char *) (A) - _heapbase) / BLOCKSIZE + 1)
-#define ADDRESS(B)     ((__ptr_t) (((B) - 1) * BLOCKSIZE + _heapbase))
+#define ADDRESS(B)     ((void *) (((B) - 1) * BLOCKSIZE + _heapbase))
 
 /* Current search index for the heap table.  */
-extern __malloc_size_t _heapindex;
+extern size_t _heapindex;
 
 /* Limit of valid info table indices.  */
-extern __malloc_size_t _heaplimit;
+extern size_t _heaplimit;
 
 /* Doubly linked lists of free fragments.  */
 struct list
@@ -177,26 +145,26 @@ extern struct list _fraghead[];
 struct alignlist
   {
     struct alignlist *next;
-    __ptr_t aligned;           /* The address that memaligned returned.  */
-    __ptr_t exact;             /* The address that malloc returned.  */
+    void *aligned;             /* The address that memaligned returned.  */
+    void *exact;               /* The address that malloc returned.  */
   };
 extern struct alignlist *_aligned_blocks;
 
 /* Instrumentation.  */
-extern __malloc_size_t _chunks_used;
-extern __malloc_size_t _bytes_used;
-extern __malloc_size_t _chunks_free;
-extern __malloc_size_t _bytes_free;
+extern size_t _chunks_used;
+extern size_t _bytes_used;
+extern size_t _chunks_free;
+extern size_t _bytes_free;
 
 /* Internal versions of `malloc', `realloc', and `free'
    used when these functions need to call each other.
    They are the same but don't call the hooks.  */
-extern __ptr_t _malloc_internal PP ((__malloc_size_t __size));
-extern __ptr_t _realloc_internal PP ((__ptr_t __ptr, __malloc_size_t __size));
-extern void _free_internal PP ((__ptr_t __ptr));
-extern __ptr_t _malloc_internal_nolock PP ((__malloc_size_t __size));
-extern __ptr_t _realloc_internal_nolock PP ((__ptr_t __ptr, __malloc_size_t __size));
-extern void _free_internal_nolock PP ((__ptr_t __ptr));
+extern void *_malloc_internal (size_t);
+extern void *_realloc_internal (void *, size_t);
+extern void _free_internal (void *);
+extern void *_malloc_internal_nolock (size_t);
+extern void *_realloc_internal_nolock (void *, size_t);
+extern void _free_internal_nolock (void *);
 
 #ifdef USE_PTHREAD
 extern pthread_mutex_t _malloc_mutex, _aligned_blocks_mutex;
@@ -228,39 +196,36 @@ extern int _malloc_thread_enabled_p;
 #define UNLOCK_ALIGNED_BLOCKS()
 #endif
 
-#endif /* _MALLOC_INTERNAL.  */
-
 /* Given an address in the middle of a malloc'd object,
    return the address of the beginning of the object.  */
-extern __ptr_t malloc_find_object_address PP ((__ptr_t __ptr));
+extern void *malloc_find_object_address (void *ptr);
 
 /* Underlying allocation function; successive calls should
    return contiguous pieces of memory.  */
-extern __ptr_t (*__morecore) PP ((__malloc_ptrdiff_t __size));
+extern void *(*__morecore) (ptrdiff_t size);
 
 /* Default value of `__morecore'.  */
-extern __ptr_t __default_morecore PP ((__malloc_ptrdiff_t __size));
+extern void *__default_morecore (ptrdiff_t size);
 
 /* If not NULL, this function is called after each time
    `__morecore' is called to increase the data size.  */
-extern void (*__after_morecore_hook) PP ((void));
+extern void (*__after_morecore_hook) (void);
 
 /* Number of extra blocks to get each time we ask for more core.
    This reduces the frequency of calling `(*__morecore)'.  */
-extern __malloc_size_t __malloc_extra_blocks;
+extern size_t __malloc_extra_blocks;
 
 /* Nonzero if `malloc' has been called and done its initialization.  */
 extern int __malloc_initialized;
 /* Function called to initialize malloc data structures.  */
-extern int __malloc_initialize PP ((void));
+extern int __malloc_initialize (void);
 
 /* Hooks for debugging versions.  */
-extern void (*__malloc_initialize_hook) PP ((void));
-extern void (*__free_hook) PP ((__ptr_t __ptr));
-extern __ptr_t (*__malloc_hook) PP ((__malloc_size_t __size));
-extern __ptr_t (*__realloc_hook) PP ((__ptr_t __ptr, __malloc_size_t __size));
-extern __ptr_t (*__memalign_hook) PP ((__malloc_size_t __size,
-                                      __malloc_size_t __alignment));
+extern void (*__malloc_initialize_hook) (void);
+extern void (*__free_hook) (void *ptr);
+extern void *(*__malloc_hook) (size_t size);
+extern void *(*__realloc_hook) (void *ptr, size_t size);
+extern void *(*__memalign_hook) (size_t size, size_t alignment);
 
 /* Return values for `mprobe': these are the kinds of inconsistencies that
    `mcheck' enables detection of.  */
@@ -277,52 +242,37 @@ enum mcheck_status
    before `malloc' is ever called.  ABORTFUNC is called with an error code
    (see enum above) when an inconsistency is detected.  If ABORTFUNC is
    null, the standard function prints on stderr and then calls `abort'.  */
-extern int mcheck PP ((void (*__abortfunc) PP ((enum mcheck_status))));
+extern int mcheck (void (*abortfunc) (enum mcheck_status));
 
 /* Check for aberrations in a particular malloc'd block.  You must have
    called `mcheck' already.  These are the same checks that `mcheck' does
    when you free or reallocate a block.  */
-extern enum mcheck_status mprobe PP ((__ptr_t __ptr));
+extern enum mcheck_status mprobe (void *ptr);
 
 /* Activate a standard collection of tracing hooks.  */
-extern void mtrace PP ((void));
-extern void muntrace PP ((void));
+extern void mtrace (void);
+extern void muntrace (void);
 
 /* Statistics available to the user.  */
 struct mstats
   {
-    __malloc_size_t bytes_total; /* Total size of the heap. */
-    __malloc_size_t chunks_used; /* Chunks allocated by the user. */
-    __malloc_size_t bytes_used;        /* Byte total of user-allocated chunks. */
-    __malloc_size_t chunks_free; /* Chunks in the free list. */
-    __malloc_size_t bytes_free;        /* Byte total of chunks in the free list. */
+    size_t bytes_total;        /* Total size of the heap. */
+    size_t chunks_used;        /* Chunks allocated by the user. */
+    size_t bytes_used; /* Byte total of user-allocated chunks. */
+    size_t chunks_free;        /* Chunks in the free list. */
+    size_t bytes_free; /* Byte total of chunks in the free list. */
   };
 
 /* Pick up the current statistics. */
-extern struct mstats mstats PP ((void));
+extern struct mstats mstats (void);
 
 /* Call WARNFUN with a warning message when memory usage is high.  */
-extern void memory_warnings PP ((__ptr_t __start,
-                                void (*__warnfun) PP ((const char *))));
-
-
-/* Relocating allocator.  */
-
-/* Allocate SIZE bytes, and store the address in *HANDLEPTR.  */
-extern __ptr_t r_alloc PP ((__ptr_t *__handleptr, __malloc_size_t __size));
-
-/* Free the storage allocated in HANDLEPTR.  */
-extern void r_alloc_free PP ((__ptr_t *__handleptr));
-
-/* Adjust the block at HANDLEPTR to be SIZE bytes long.  */
-extern __ptr_t r_re_alloc PP ((__ptr_t *__handleptr, __malloc_size_t __size));
-
+extern void memory_warnings (void *start, void (*warnfun) (const char *));
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* malloc.h  */
 /* Memory allocator `malloc'.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
                  Written May 1989 by Mike Haertel.
@@ -345,10 +295,6 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
-#ifndef        _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
 #include <errno.h>
 
 /* On Cygwin there are two heaps.  temacs uses the static heap
@@ -362,15 +308,15 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    this is changed in the future, we'll have to similarly deal with
    reinitializing ralloc. */
 #ifdef CYGWIN
-extern __ptr_t bss_sbrk PP ((ptrdiff_t __size));
+extern void *bss_sbrk (ptrdiff_t size);
 extern int bss_sbrk_did_unexec;
 char *bss_sbrk_heapbase;       /* _heapbase for static heap */
 malloc_info *bss_sbrk_heapinfo;        /* _heapinfo for static heap */
 #endif
-__ptr_t (*__morecore) PP ((__malloc_ptrdiff_t __size)) = __default_morecore;
+void *(*__morecore) (ptrdiff_t size) = __default_morecore;
 
 /* Debugging hook for `malloc'.  */
-__ptr_t (*__malloc_hook) PP ((__malloc_size_t __size));
+void *(*__malloc_hook) (size_t size);
 
 /* Pointer to the base of the first block.  */
 char *_heapbase;
@@ -379,30 +325,30 @@ char *_heapbase;
 malloc_info *_heapinfo;
 
 /* Number of info entries.  */
-static __malloc_size_t heapsize;
+static size_t heapsize;
 
 /* Search index in the info table.  */
-__malloc_size_t _heapindex;
+size_t _heapindex;
 
 /* Limit of valid info table indices.  */
-__malloc_size_t _heaplimit;
+size_t _heaplimit;
 
 /* Free lists for each fragment size.  */
 struct list _fraghead[BLOCKLOG];
 
 /* Instrumentation.  */
-__malloc_size_t _chunks_used;
-__malloc_size_t _bytes_used;
-__malloc_size_t _chunks_free;
-__malloc_size_t _bytes_free;
+size_t _chunks_used;
+size_t _bytes_used;
+size_t _chunks_free;
+size_t _bytes_free;
 
 /* Are you experienced?  */
 int __malloc_initialized;
 
-__malloc_size_t __malloc_extra_blocks;
+size_t __malloc_extra_blocks;
 
-void (*__malloc_initialize_hook) PP ((void));
-void (*__after_morecore_hook) PP ((void));
+void (*__malloc_initialize_hook) (void);
+void (*__after_morecore_hook) (void);
 
 #if defined GC_MALLOC_CHECK && defined GC_PROTECT_MALLOC_STATE
 
@@ -419,12 +365,11 @@ void (*__after_morecore_hook) PP ((void));
 #include <sys/mman.h>
 
 static int state_protected_p;
-static __malloc_size_t last_state_size;
+static size_t last_state_size;
 static malloc_info *last_heapinfo;
 
 void
-protect_malloc_state (protect_p)
-     int protect_p;
+protect_malloc_state (int protect_p)
 {
   /* If _heapinfo has been relocated, make sure its old location
      isn't left read-only; it will be reused by malloc.  */
@@ -453,29 +398,25 @@ protect_malloc_state (protect_p)
 
 
 /* Aligned allocation.  */
-static __ptr_t align PP ((__malloc_size_t));
-static __ptr_t
-align (size)
-     __malloc_size_t size;
+static void *
+align (size_t size)
 {
-  __ptr_t result;
-  unsigned long int adj;
+  void *result;
+  ptrdiff_t adj;
 
   /* align accepts an unsigned argument, but __morecore accepts a
-     signed one.  This could lead to trouble if SIZE overflows a
-     signed int type accepted by __morecore.  We just punt in that
+     signed one.  This could lead to trouble if SIZE overflows the
+     ptrdiff_t type accepted by __morecore.  We just punt in that
      case, since they are requesting a ludicrous amount anyway.  */
-  if ((__malloc_ptrdiff_t)size < 0)
+  if (PTRDIFF_MAX < size)
     result = 0;
   else
     result = (*__morecore) (size);
-  adj = (unsigned long int) ((unsigned long int) ((char *) result -
-                                                 (char *) NULL)) % BLOCKSIZE;
+  adj = (uintptr_t) result % BLOCKSIZE;
   if (adj != 0)
     {
-      __ptr_t new;
       adj = BLOCKSIZE - adj;
-      new = (*__morecore) (adj);
+      (*__morecore) (adj);
       result = (char *) result + adj;
     }
 
@@ -488,14 +429,11 @@ align (size)
 /* Get SIZE bytes, if we can get them starting at END.
    Return the address of the space we got.
    If we cannot get space at END, fail and return 0.  */
-static __ptr_t get_contiguous_space PP ((__malloc_ptrdiff_t, __ptr_t));
-static __ptr_t
-get_contiguous_space (size, position)
-     __malloc_ptrdiff_t size;
-     __ptr_t position;
+static void *
+get_contiguous_space (ptrdiff_t size, void *position)
 {
-  __ptr_t before;
-  __ptr_t after;
+  void *before;
+  void *after;
 
   before = (*__morecore) (0);
   /* If we can tell in advance that the break is at the wrong place,
@@ -525,7 +463,7 @@ get_contiguous_space (size, position)
 static inline void
 register_heapinfo (void)
 {
-  __malloc_size_t block, blocks;
+  size_t block, blocks;
 
   block = BLOCK (_heapinfo);
   blocks = BLOCKIFY (heapsize * sizeof (malloc_info));
@@ -548,21 +486,21 @@ pthread_mutex_t _aligned_blocks_mutex = PTHREAD_MUTEX_INITIALIZER;
 int _malloc_thread_enabled_p;
 
 static void
-malloc_atfork_handler_prepare ()
+malloc_atfork_handler_prepare (void)
 {
   LOCK ();
   LOCK_ALIGNED_BLOCKS ();
 }
 
 static void
-malloc_atfork_handler_parent ()
+malloc_atfork_handler_parent (void)
 {
   UNLOCK_ALIGNED_BLOCKS ();
   UNLOCK ();
 }
 
 static void
-malloc_atfork_handler_child ()
+malloc_atfork_handler_child (void)
 {
   UNLOCK_ALIGNED_BLOCKS ();
   UNLOCK ();
@@ -570,7 +508,7 @@ malloc_atfork_handler_child ()
 
 /* Set up mutexes and make malloc etc. thread-safe.  */
 void
-malloc_enable_thread ()
+malloc_enable_thread (void)
 {
   if (_malloc_thread_enabled_p)
     return;
@@ -589,7 +527,7 @@ malloc_enable_thread ()
 #endif
 
 static void
-malloc_initialize_1 ()
+malloc_initialize_1 (void)
 {
 #ifdef GC_MCHECK
   mcheck (NULL);
@@ -609,7 +547,7 @@ malloc_initialize_1 ()
     (*__malloc_initialize_hook) ();
 
   heapsize = HEAP / BLOCKSIZE;
-  _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info));
+  _heapinfo = align (heapsize * sizeof (malloc_info));
   if (_heapinfo == NULL)
     return;
   memset (_heapinfo, 0, heapsize * sizeof (malloc_info));
@@ -630,7 +568,7 @@ malloc_initialize_1 ()
    main will call malloc which calls this function.  That is before any threads
    or signal handlers has been set up, so we don't need thread protection.  */
 int
-__malloc_initialize ()
+__malloc_initialize (void)
 {
   if (__malloc_initialized)
     return 0;
@@ -644,14 +582,12 @@ static int morecore_recursing;
 
 /* Get neatly aligned memory, initializing or
    growing the heap info table as necessary. */
-static __ptr_t morecore_nolock PP ((__malloc_size_t));
-static __ptr_t
-morecore_nolock (size)
-     __malloc_size_t size;
+static void *
+morecore_nolock (size_t size)
 {
-  __ptr_t result;
+  void *result;
   malloc_info *newinfo, *oldinfo;
-  __malloc_size_t newsize;
+  size_t newsize;
 
   if (morecore_recursing)
     /* Avoid recursion.  The caller will know how to handle a null return.  */
@@ -664,7 +600,7 @@ morecore_nolock (size)
   PROTECT_MALLOC_STATE (0);
 
   /* Check if we need to grow the info table.  */
-  if ((__malloc_size_t) BLOCK ((char *) result + size) > heapsize)
+  if ((size_t) BLOCK ((char *) result + size) > heapsize)
     {
       /* Calculate the new _heapinfo table size.  We do not account for the
         added blocks in the table itself, as we hope to place them in
@@ -673,7 +609,7 @@ morecore_nolock (size)
       newsize = heapsize;
       do
        newsize *= 2;
-      while ((__malloc_size_t) BLOCK ((char *) result + size) > newsize);
+      while ((size_t) BLOCK ((char *) result + size) > newsize);
 
       /* We must not reuse existing core for the new info table when called
         from realloc in the case of growing a large block, because the
@@ -689,8 +625,8 @@ morecore_nolock (size)
             `morecore_recursing' flag and return null.  */
          int save = errno;     /* Don't want to clobber errno with ENOMEM.  */
          morecore_recursing = 1;
-         newinfo = (malloc_info *) _realloc_internal_nolock
-           (_heapinfo, newsize * sizeof (malloc_info));
+         newinfo = _realloc_internal_nolock (_heapinfo,
+                                             newsize * sizeof (malloc_info));
          morecore_recursing = 0;
          if (newinfo == NULL)
            errno = save;
@@ -710,7 +646,7 @@ morecore_nolock (size)
       /* Allocate new space for the malloc info table.  */
       while (1)
        {
-         newinfo = (malloc_info *) align (newsize * sizeof (malloc_info));
+         newinfo = align (newsize * sizeof (malloc_info));
 
          /* Did it fail?  */
          if (newinfo == NULL)
@@ -721,8 +657,8 @@ morecore_nolock (size)
 
          /* Is it big enough to record status for its own space?
             If so, we win.  */
-         if ((__malloc_size_t) BLOCK ((char *) newinfo
-                                      + newsize * sizeof (malloc_info))
+         if ((size_t) BLOCK ((char *) newinfo
+                             + newsize * sizeof (malloc_info))
              < newsize)
            break;
 
@@ -759,13 +695,12 @@ morecore_nolock (size)
 }
 
 /* Allocate memory from the heap.  */
-__ptr_t
-_malloc_internal_nolock (size)
-     __malloc_size_t size;
+void *
+_malloc_internal_nolock (size_t size)
 {
-  __ptr_t result;
-  __malloc_size_t block, blocks, lastblocks, start;
-  register __malloc_size_t i;
+  void *result;
+  size_t block, blocks, lastblocks, start;
+  register size_t i;
   struct list *next;
 
   /* ANSI C allows `malloc (0)' to either return NULL, or to return a
@@ -790,7 +725,7 @@ _malloc_internal_nolock (size)
     {
       /* Small allocation to receive a fragment of a block.
         Determine the logarithm to base two of the fragment size. */
-      register __malloc_size_t log = 1;
+      register size_t log = 1;
       --size;
       while ((size /= 2) != 0)
        ++log;
@@ -803,15 +738,14 @@ _malloc_internal_nolock (size)
          /* There are free fragments of this size.
             Pop a fragment out of the fragment list and return it.
             Update the block's nfree and first counters. */
-         result = (__ptr_t) next;
+         result = next;
          next->prev->next = next->next;
          if (next->next != NULL)
            next->next->prev = next->prev;
          block = BLOCK (result);
          if (--_heapinfo[block].busy.info.frag.nfree != 0)
-           _heapinfo[block].busy.info.frag.first = (unsigned long int)
-             ((unsigned long int) ((char *) next->next - (char *) NULL)
-              % BLOCKSIZE) >> log;
+           _heapinfo[block].busy.info.frag.first =
+             (uintptr_t) next->next % BLOCKSIZE >> log;
 
          /* Update the statistics.  */
          ++_chunks_used;
@@ -843,7 +777,7 @@ _malloc_internal_nolock (size)
          next->prev = &_fraghead[log];
          _fraghead[log].next = next;
 
-         for (i = 2; i < (__malloc_size_t) (BLOCKSIZE >> log); ++i)
+         for (i = 2; i < (size_t) (BLOCKSIZE >> log); ++i)
            {
              next = (struct list *) ((char *) result + (i << log));
              next->next = _fraghead[log].next;
@@ -877,7 +811,7 @@ _malloc_internal_nolock (size)
          if (block == start)
            {
              /* Need to get more from the system.  Get a little extra.  */
-             __malloc_size_t wantblocks = blocks + __malloc_extra_blocks;
+             size_t wantblocks = blocks + __malloc_extra_blocks;
              block = _heapinfo[0].free.prev;
              lastblocks = _heapinfo[block].free.size;
              /* Check to see if the new core will be contiguous with the
@@ -959,11 +893,10 @@ _malloc_internal_nolock (size)
   return result;
 }
 
-__ptr_t
-_malloc_internal (size)
-     __malloc_size_t size;
+void *
+_malloc_internal (size_t size)
 {
-  __ptr_t result;
+  void *result;
 
   LOCK ();
   result = _malloc_internal_nolock (size);
@@ -972,11 +905,10 @@ _malloc_internal (size)
   return result;
 }
 
-__ptr_t
-malloc (size)
-     __malloc_size_t size;
+void *
+malloc (size_t size)
 {
-  __ptr_t (*hook) (__malloc_size_t);
+  void *(*hook) (size_t);
 
   if (!__malloc_initialized && !__malloc_initialize ())
     return NULL;
@@ -998,24 +930,24 @@ malloc (size)
 /* On some ANSI C systems, some libc functions call _malloc, _free
    and _realloc.  Make them use the GNU functions.  */
 
-__ptr_t
-_malloc (size)
-     __malloc_size_t size;
+extern void *_malloc (size_t);
+extern void _free (void *);
+extern void *_realloc (void *, size_t);
+
+void *
+_malloc (size_t size)
 {
   return malloc (size);
 }
 
 void
-_free (ptr)
-     __ptr_t ptr;
+_free (void *ptr)
 {
   free (ptr);
 }
 
-__ptr_t
-_realloc (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+void *
+_realloc (void *ptr, size_t size)
 {
   return realloc (ptr, size);
 }
@@ -1043,14 +975,9 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
-#ifndef        _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
 
 /* Debugging hook for free.  */
-void (*__free_hook) PP ((__ptr_t __ptr));
+void (*__free_hook) (void *__ptr);
 
 /* List of blocks allocated by memalign.  */
 struct alignlist *_aligned_blocks = NULL;
@@ -1058,15 +985,14 @@ struct alignlist *_aligned_blocks = NULL;
 /* Return memory to the heap.
    Like `_free_internal' but don't lock mutex.  */
 void
-_free_internal_nolock (ptr)
-     __ptr_t ptr;
+_free_internal_nolock (void *ptr)
 {
   int type;
-  __malloc_size_t block, blocks;
-  register __malloc_size_t i;
+  size_t block, blocks;
+  register size_t i;
   struct list *prev, *next;
-  __ptr_t curbrk;
-  const __malloc_size_t lesscore_threshold
+  void *curbrk;
+  const size_t lesscore_threshold
     /* Threshold of free space at which we will return some to the system.  */
     = FINAL_FREE_BLOCKS + 2 * __malloc_extra_blocks;
 
@@ -1076,7 +1002,7 @@ _free_internal_nolock (ptr)
     return;
 
 #ifdef CYGWIN
-  if (ptr < _heapbase)
+  if ((char *) ptr < _heapbase)
     /* We're being asked to free something in the static heap. */
     return;
 #endif
@@ -1162,12 +1088,12 @@ _free_internal_nolock (ptr)
             It's possible that moving _heapinfo will allow us to
             return some space to the system.  */
 
-         __malloc_size_t info_block = BLOCK (_heapinfo);
-         __malloc_size_t info_blocks = _heapinfo[info_block].busy.info.size;
-         __malloc_size_t prev_block = _heapinfo[block].free.prev;
-         __malloc_size_t prev_blocks = _heapinfo[prev_block].free.size;
-         __malloc_size_t next_block = _heapinfo[block].free.next;
-         __malloc_size_t next_blocks = _heapinfo[next_block].free.size;
+         size_t info_block = BLOCK (_heapinfo);
+         size_t info_blocks = _heapinfo[info_block].busy.info.size;
+         size_t prev_block = _heapinfo[block].free.prev;
+         size_t prev_blocks = _heapinfo[prev_block].free.size;
+         size_t next_block = _heapinfo[block].free.next;
+         size_t next_blocks = _heapinfo[next_block].free.size;
 
          if (/* Win if this block being freed is last in core, the info table
                 is just before it, the previous free block is just before the
@@ -1190,7 +1116,7 @@ _free_internal_nolock (ptr)
              )
            {
              malloc_info *newinfo;
-             __malloc_size_t oldlimit = _heaplimit;
+             size_t oldlimit = _heaplimit;
 
              /* Free the old info table, clearing _heaplimit to avoid
                 recursion into this code.  We don't want to return the
@@ -1205,8 +1131,7 @@ _free_internal_nolock (ptr)
              _heapindex = 0;
 
              /* Allocate new space for the info table and move its data.  */
-             newinfo = (malloc_info *) _malloc_internal_nolock (info_blocks
-                                                                * BLOCKSIZE);
+             newinfo = _malloc_internal_nolock (info_blocks * BLOCKSIZE);
              PROTECT_MALLOC_STATE (0);
              memmove (newinfo, _heapinfo, info_blocks * BLOCKSIZE);
              _heapinfo = newinfo;
@@ -1222,7 +1147,7 @@ _free_internal_nolock (ptr)
          /* Now see if we can return stuff to the system.  */
          if (block + blocks == _heaplimit && blocks >= lesscore_threshold)
            {
-             register __malloc_size_t bytes = blocks * BLOCKSIZE;
+             register size_t bytes = blocks * BLOCKSIZE;
              _heaplimit -= blocks;
              (*__morecore) (-bytes);
              _heapinfo[_heapinfo[block].free.prev].free.next
@@ -1255,7 +1180,7 @@ _free_internal_nolock (ptr)
          /* If all fragments of this block are free, remove them
             from the fragment list and free the whole block.  */
          next = prev;
-         for (i = 1; i < (__malloc_size_t) (BLOCKSIZE >> type); ++i)
+         for (i = 1; i < (size_t) (BLOCKSIZE >> type); ++i)
            next = next->next;
          prev->prev->next = next;
          if (next != NULL)
@@ -1280,7 +1205,7 @@ _free_internal_nolock (ptr)
          /* If some fragments of this block are free, link this
             fragment into the fragment list after the first free
             fragment of this block. */
-         next = (struct list *) ptr;
+         next = ptr;
          next->next = prev->next;
          next->prev = prev;
          prev->next = next;
@@ -1293,11 +1218,10 @@ _free_internal_nolock (ptr)
          /* No fragments of this block are free, so link this
             fragment into the fragment list and announce that
             it is the first free fragment of this block. */
-         prev = (struct list *) ptr;
+         prev = ptr;
          _heapinfo[block].busy.info.frag.nfree = 1;
-         _heapinfo[block].busy.info.frag.first = (unsigned long int)
-           ((unsigned long int) ((char *) ptr - (char *) NULL)
-            % BLOCKSIZE >> type);
+         _heapinfo[block].busy.info.frag.first =
+           (uintptr_t) ptr % BLOCKSIZE >> type;
          prev->next = _fraghead[type].next;
          prev->prev = &_fraghead[type];
          prev->prev->next = prev;
@@ -1313,8 +1237,7 @@ _free_internal_nolock (ptr)
 /* Return memory to the heap.
    Like `free' but don't call a __free_hook if there is one.  */
 void
-_free_internal (ptr)
-     __ptr_t ptr;
+_free_internal (void *ptr)
 {
   LOCK ();
   _free_internal_nolock (ptr);
@@ -1324,10 +1247,9 @@ _free_internal (ptr)
 /* Return memory to the heap.  */
 
 void
-free (ptr)
-     __ptr_t ptr;
+free (void *ptr)
 {
-  void (*hook) (__ptr_t) = __free_hook;
+  void (*hook) (void *) = __free_hook;
 
   if (hook != NULL)
     (*hook) (ptr);
@@ -1340,8 +1262,7 @@ free (ptr)
 weak_alias (free, cfree)
 #else
 void
-cfree (ptr)
-     __ptr_t ptr;
+cfree (void *ptr)
 {
   free (ptr);
 }
@@ -1368,32 +1289,24 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
-#ifndef        _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-
 #define min(A, B) ((A) < (B) ? (A) : (B))
 
 /* On Cygwin the dumped emacs may try to realloc storage allocated in
    the static heap.  We just malloc space in the new heap and copy the
    data.  */
 #ifdef CYGWIN
-__ptr_t
-special_realloc (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+void *
+special_realloc (void *ptr, size_t size)
 {
-  __ptr_t result;
+  void *result;
   int type;
-  __malloc_size_t block, oldsize;
+  size_t block, oldsize;
 
   block = ((char *) ptr - bss_sbrk_heapbase) / BLOCKSIZE + 1;
   type = bss_sbrk_heapinfo[block].busy.type;
   oldsize =
     type == 0 ? bss_sbrk_heapinfo[block].busy.info.size * BLOCKSIZE
-    : (__malloc_size_t) 1 << type;
+    : (size_t) 1 << type;
   result = _malloc_internal_nolock (size);
   if (result != NULL)
     memcpy (result, ptr, min (oldsize, size));
@@ -1402,7 +1315,7 @@ special_realloc (ptr, size)
 #endif
 
 /* Debugging hook for realloc.  */
-__ptr_t (*__realloc_hook) PP ((__ptr_t __ptr, __malloc_size_t __size));
+void *(*__realloc_hook) (void *ptr, size_t size);
 
 /* Resize the given region to the new size, returning a pointer
    to the (possibly moved) region.  This is optimized for speed;
@@ -1410,14 +1323,12 @@ __ptr_t (*__realloc_hook) PP ((__ptr_t __ptr, __malloc_size_t __size));
    achieved by unconditionally allocating and copying to a
    new region.  This module has incestuous knowledge of the
    internals of both free and malloc. */
-__ptr_t
-_realloc_internal_nolock (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+void *
+_realloc_internal_nolock (void *ptr, size_t size)
 {
-  __ptr_t result;
+  void *result;
   int type;
-  __malloc_size_t block, blocks, oldlimit;
+  size_t block, blocks, oldlimit;
 
   if (size == 0)
     {
@@ -1428,7 +1339,7 @@ _realloc_internal_nolock (ptr, size)
     return _malloc_internal_nolock (size);
 
 #ifdef CYGWIN
-  if (ptr < _heapbase)
+  if ((char *) ptr < _heapbase)
     /* ptr points into the static heap */
     return special_realloc (ptr, size);
 #endif
@@ -1497,7 +1408,7 @@ _realloc_internal_nolock (ptr, size)
                (void) _malloc_internal_nolock (blocks * BLOCKSIZE);
              else
                {
-                 __ptr_t previous
+                 void *previous
                    = _malloc_internal_nolock ((block - _heapindex) * BLOCKSIZE);
                  (void) _malloc_internal_nolock (blocks * BLOCKSIZE);
                  _free_internal_nolock (previous);
@@ -1512,8 +1423,8 @@ _realloc_internal_nolock (ptr, size)
     default:
       /* Old size is a fragment; type is logarithm
         to base two of the fragment size.  */
-      if (size > (__malloc_size_t) (1 << (type - 1)) &&
-         size <= (__malloc_size_t) (1 << type))
+      if (size > (size_t) (1 << (type - 1)) &&
+         size <= (size_t) (1 << type))
        /* The new size is the same kind of fragment.  */
        result = ptr;
       else
@@ -1523,7 +1434,7 @@ _realloc_internal_nolock (ptr, size)
          result = _malloc_internal_nolock (size);
          if (result == NULL)
            goto out;
-         memcpy (result, ptr, min (size, (__malloc_size_t) 1 << type));
+         memcpy (result, ptr, min (size, (size_t) 1 << type));
          _free_internal_nolock (ptr);
        }
       break;
@@ -1534,12 +1445,10 @@ _realloc_internal_nolock (ptr, size)
   return result;
 }
 
-__ptr_t
-_realloc_internal (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+void *
+_realloc_internal (void *ptr, size_t size)
 {
-  __ptr_t result;
+  void *result;
 
   LOCK ();
   result = _realloc_internal_nolock (ptr, size);
@@ -1548,12 +1457,10 @@ _realloc_internal (ptr, size)
   return result;
 }
 
-__ptr_t
-realloc (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+void *
+realloc (void *ptr, size_t size)
 {
-  __ptr_t (*hook) (__ptr_t, __malloc_size_t);
+  void *(*hook) (void *, size_t);
 
   if (!__malloc_initialized && !__malloc_initialize ())
     return NULL;
@@ -1581,19 +1488,12 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
-#ifndef        _MALLOC_INTERNAL
-#define        _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
 /* Allocate an array of NMEMB elements each SIZE bytes long.
    The entire array is initialized to zeros.  */
-__ptr_t
-calloc (nmemb, size)
-     register __malloc_size_t nmemb;
-     register __malloc_size_t size;
+void *
+calloc (register size_t nmemb, register size_t size)
 {
-  register __ptr_t result = malloc (nmemb * size);
+  register void *result = malloc (nmemb * size);
 
   if (result != NULL)
     (void) memset (result, 0, nmemb * size);
@@ -1618,11 +1518,6 @@ along with the GNU C Library; see the file COPYING.  If not, write to
 the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
 MA 02110-1301, USA.  */
 
-#ifndef        _MALLOC_INTERNAL
-#define        _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
 /* uClibc defines __GNU_LIBRARY__, but it is not completely
    compatible.  */
 #if !defined (__GNU_LIBRARY__) || defined (__UCLIBC__)
@@ -1631,30 +1526,24 @@ MA 02110-1301, USA.  */
 /* It is best not to declare this and cast its result on foreign operating
    systems with potentially hostile include files.  */
 
-#include <stddef.h>
-extern __ptr_t __sbrk PP ((ptrdiff_t increment));
+extern void *__sbrk (ptrdiff_t increment);
 #endif /* __GNU_LIBRARY__ && ! defined (__UCLIBC__) */
 
-#ifndef NULL
-#define NULL 0
-#endif
-
 /* Allocate INCREMENT more bytes of data space,
    and return the start of data space, or NULL on errors.
    If INCREMENT is negative, shrink data space.  */
-__ptr_t
-__default_morecore (increment)
-     __malloc_ptrdiff_t increment;
+void *
+__default_morecore (ptrdiff_t increment)
 {
-  __ptr_t result;
+  void *result;
 #if defined (CYGWIN)
   if (!bss_sbrk_did_unexec)
     {
       return bss_sbrk (increment);
     }
 #endif
-  result = (__ptr_t) __sbrk (increment);
-  if (result == (__ptr_t) -1)
+  result = (void *) __sbrk (increment);
+  if (result == (void *) -1)
     return NULL;
   return result;
 }
@@ -1675,22 +1564,14 @@ License along with this library; see the file COPYING.  If
 not, write to the Free Software Foundation, Inc., 51 Franklin Street,
 Fifth Floor, Boston, MA 02110-1301, USA.  */
 
-#ifndef        _MALLOC_INTERNAL
-#define _MALLOC_INTERNAL
-#include <malloc.h>
-#endif
-
-__ptr_t (*__memalign_hook) PP ((__malloc_size_t __size,
-                               __malloc_size_t __alignment));
+void *(*__memalign_hook) (size_t size, size_t alignment);
 
-__ptr_t
-memalign (alignment, size)
-     __malloc_size_t alignment;
-     __malloc_size_t size;
+void *
+memalign (size_t alignment, size_t size)
 {
-  __ptr_t result;
-  unsigned long int adj, lastadj;
-  __ptr_t (*hook) (__malloc_size_t, __malloc_size_t) = __memalign_hook;
+  void *result;
+  size_t adj, lastadj;
+  void *(*hook) (size_t, size_t) = __memalign_hook;
 
   if (hook)
     return (*hook) (alignment, size);
@@ -1703,7 +1584,7 @@ memalign (alignment, size)
 
   /* Figure out how much we will need to pad this particular block
      to achieve the required alignment.  */
-  adj = (unsigned long int) ((char *) result - (char *) NULL) % alignment;
+  adj = (uintptr_t) result % alignment;
 
   do
     {
@@ -1714,7 +1595,7 @@ memalign (alignment, size)
        return NULL;
 
       lastadj = adj;
-      adj = (unsigned long int) ((char *) result - (char *) NULL) % alignment;
+      adj = (uintptr_t) result % alignment;
       /* It's conceivable we might have been so unlucky as to get a
         different block with weaker alignment.  If so, this block is too
         short to contain SIZE after alignment correction.  So we must
@@ -1735,7 +1616,7 @@ memalign (alignment, size)
          break;
       if (l == NULL)
        {
-         l = (struct alignlist *) malloc (sizeof (struct alignlist));
+         l = malloc (sizeof *l);
          if (l != NULL)
            {
              l->next = _aligned_blocks;
@@ -1767,15 +1648,12 @@ memalign (alignment, size)
 #endif
 
 int
-posix_memalign (memptr, alignment, size)
-     __ptr_t *memptr;
-     __malloc_size_t alignment;
-     __malloc_size_t size;
+posix_memalign (void **memptr, size_t alignment, size_t size)
 {
-  __ptr_t mem;
+  void *mem;
 
   if (alignment == 0
-      || alignment % sizeof (__ptr_t) != 0
+      || alignment % sizeof (void *) != 0
       || (alignment & (alignment - 1)) != 0)
     return EINVAL;
 
@@ -1809,49 +1687,26 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
-#if defined (_MALLOC_INTERNAL) && defined (GMALLOC_INHIBIT_VALLOC)
-
-/* Emacs defines GMALLOC_INHIBIT_VALLOC to avoid this definition
-   on MSDOS, where it conflicts with a system header file.  */
-
-#define ELIDE_VALLOC
-
-#endif
-
-#ifndef        ELIDE_VALLOC
-
-#if defined (__GNU_LIBRARY__) || defined (_LIBC)
-#include <stddef.h>
-#include <sys/cdefs.h>
-#if defined (__GLIBC__) && __GLIBC__ >= 2
-/* __getpagesize is already declared in <unistd.h> with return type int */
-#else
-extern size_t __getpagesize PP ((void));
-#endif
-#else
-#include "getpagesize.h"
-#define         __getpagesize()        getpagesize ()
-#endif
+/* Allocate SIZE bytes on a page boundary.  */
+extern void *valloc (size_t);
 
-#ifndef        _MALLOC_INTERNAL
-#define        _MALLOC_INTERNAL
-#include <malloc.h>
+#if defined _SC_PAGESIZE || !defined HAVE_GETPAGESIZE
+# include "getpagesize.h"
+#elif !defined getpagesize
+extern int getpagesize (void);
 #endif
 
-static __malloc_size_t pagesize;
+static size_t pagesize;
 
-__ptr_t
-valloc (size)
-     __malloc_size_t size;
+void *
+valloc (size_t size)
 {
   if (pagesize == 0)
-    pagesize = __getpagesize ();
+    pagesize = getpagesize ();
 
   return memalign (pagesize, size);
 }
 
-#endif /* Not ELIDE_VALLOC.  */
-
 #ifdef GC_MCHECK
 
 /* Standard debugging hooks for `malloc'.
@@ -1876,41 +1731,31 @@ Fifth Floor, Boston, MA 02110-1301, USA.
    The author may be reached (Email) at the address mike@ai.mit.edu,
    or (US mail) as Mike Haertel c/o Free Software Foundation.  */
 
-#ifdef emacs
-#include <stdio.h>
-#else
-#ifndef        _MALLOC_INTERNAL
-#define        _MALLOC_INTERNAL
-#include <malloc.h>
 #include <stdio.h>
-#endif
-#endif
 
 /* Old hook values.  */
-static void (*old_free_hook) (__ptr_t ptr);
-static __ptr_t (*old_malloc_hook) (__malloc_size_t size);
-static __ptr_t (*old_realloc_hook) (__ptr_t ptr, __malloc_size_t size);
+static void (*old_free_hook) (void *ptr);
+static void *(*old_malloc_hook) (size_t size);
+static void *(*old_realloc_hook) (void *ptr, size_t size);
 
 /* Function to call when something awful happens.  */
 static void (*abortfunc) (enum mcheck_status);
 
 /* Arbitrary magical numbers.  */
-#define MAGICWORD      0xfedabeeb
-#define MAGICFREE      0xd8675309
+#define MAGICWORD      (SIZE_MAX / 11 ^ SIZE_MAX / 13 << 3)
+#define MAGICFREE      (SIZE_MAX / 17 ^ SIZE_MAX / 19 << 4)
 #define MAGICBYTE      ((char) 0xd7)
 #define MALLOCFLOOD    ((char) 0x93)
 #define FREEFLOOD      ((char) 0x95)
 
 struct hdr
   {
-    __malloc_size_t size;              /* Exact size requested by user.  */
-    unsigned long int magic;   /* Magic number to check header integrity.  */
+    size_t size;       /* Exact size requested by user.  */
+    size_t magic;      /* Magic number to check header integrity.  */
   };
 
-static enum mcheck_status checkhdr (const struct hdr *);
 static enum mcheck_status
-checkhdr (hdr)
-     const struct hdr *hdr;
+checkhdr (const struct hdr *hdr)
 {
   enum mcheck_status status;
   switch (hdr->magic)
@@ -1933,10 +1778,8 @@ checkhdr (hdr)
   return status;
 }
 
-static void freehook (__ptr_t);
 static void
-freehook (ptr)
-     __ptr_t ptr;
+freehook (void *ptr)
 {
   struct hdr *hdr;
 
@@ -1955,15 +1798,13 @@ freehook (ptr)
   __free_hook = freehook;
 }
 
-static __ptr_t mallochook (__malloc_size_t);
-static __ptr_t
-mallochook (size)
-     __malloc_size_t size;
+static void *
+mallochook (size_t size)
 {
   struct hdr *hdr;
 
   __malloc_hook = old_malloc_hook;
-  hdr = (struct hdr *) malloc (sizeof (struct hdr) + size + 1);
+  hdr = malloc (sizeof *hdr + size + 1);
   __malloc_hook = mallochook;
   if (hdr == NULL)
     return NULL;
@@ -1971,18 +1812,15 @@ mallochook (size)
   hdr->size = size;
   hdr->magic = MAGICWORD;
   ((char *) &hdr[1])[size] = MAGICBYTE;
-  memset ((__ptr_t) (hdr + 1), MALLOCFLOOD, size);
-  return (__ptr_t) (hdr + 1);
+  memset (hdr + 1, MALLOCFLOOD, size);
+  return hdr + 1;
 }
 
-static __ptr_t reallochook (__ptr_t, __malloc_size_t);
-static __ptr_t
-reallochook (ptr, size)
-     __ptr_t ptr;
-     __malloc_size_t size;
+static void *
+reallochook (void *ptr, size_t size)
 {
   struct hdr *hdr = NULL;
-  __malloc_size_t osize = 0;
+  size_t osize = 0;
 
   if (ptr)
     {
@@ -1997,7 +1835,7 @@ reallochook (ptr, size)
   __free_hook = old_free_hook;
   __malloc_hook = old_malloc_hook;
   __realloc_hook = old_realloc_hook;
-  hdr = (struct hdr *) realloc ((__ptr_t) hdr, sizeof (struct hdr) + size + 1);
+  hdr = realloc (hdr, sizeof *hdr + size + 1);
   __free_hook = freehook;
   __malloc_hook = mallochook;
   __realloc_hook = reallochook;
@@ -2009,12 +1847,11 @@ reallochook (ptr, size)
   ((char *) &hdr[1])[size] = MAGICBYTE;
   if (size > osize)
     memset ((char *) (hdr + 1) + osize, MALLOCFLOOD, size - osize);
-  return (__ptr_t) (hdr + 1);
+  return hdr + 1;
 }
 
 static void
-mabort (status)
-     enum mcheck_status status;
+mabort (enum mcheck_status status)
 {
   const char *msg;
   switch (status)
@@ -2047,8 +1884,7 @@ mabort (status)
 static int mcheck_used = 0;
 
 int
-mcheck (func)
-     void (*func) (enum mcheck_status);
+mcheck (void (*func) (enum mcheck_status))
 {
   abortfunc = (func != NULL) ? func : &mabort;
 
@@ -2068,7 +1904,7 @@ mcheck (func)
 }
 
 enum mcheck_status
-mprobe (__ptr_t ptr)
+mprobe (void *ptr)
 {
   return mcheck_used ? checkhdr (ptr) : MCHECK_DISABLED;
 }
index 97b667a1f4ee488fb99a2439ca2aefd01b954d41..9895936c246ac09bc869552c87666556bdad5928 100644 (file)
@@ -200,8 +200,12 @@ init_gnutls_functions (Lisp_Object libraries)
 
   max_log_level = global_gnutls_log_level;
 
-  GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:",
-              SDATA (Fget (Qgnutls_dll, QCloaded_from)));
+  {
+    Lisp_Object name = CAR_SAFE (Fget (Qgnutls_dll, QCloaded_from));
+    GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:",
+                 STRINGP (name) ? (const char *) SDATA (name) : "unknown");
+  }
+
   return 1;
 }
 
@@ -348,11 +352,11 @@ emacs_gnutls_transport_set_errno (gnutls_session_t state, int err)
   fn_gnutls_transport_set_errno (state, err);
 }
 
-EMACS_INT
-emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte)
+ptrdiff_t
+emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
 {
   ssize_t rtnval = 0;
-  EMACS_INT bytes_written;
+  ptrdiff_t bytes_written;
   gnutls_session_t state = proc->gnutls_state;
 
   if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
@@ -403,8 +407,8 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte)
   return (bytes_written);
 }
 
-EMACS_INT
-emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte)
+ptrdiff_t
+emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
 {
   ssize_t rtnval;
   gnutls_session_t state = proc->gnutls_state;
@@ -420,7 +424,7 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte)
         {
           proc->gnutls_handshakes_tried++;
           emacs_gnutls_handshake (proc);
-          GNUTLS_LOG2i (5, log_level, "Retried handshake", 
+          GNUTLS_LOG2i (5, log_level, "Retried handshake",
                         proc->gnutls_handshakes_tried);
           return -1;
         }
@@ -596,7 +600,7 @@ usage: (gnutls-error-fatalp ERROR)  */)
        }
     }
 
-  if (!NUMBERP (err))
+  if (! TYPE_RANGED_INTEGERP (int, err))
     error ("Not an error symbol or code");
 
   if (0 == fn_gnutls_error_is_fatal (XINT (err)))
@@ -628,7 +632,7 @@ usage: (gnutls-error-string ERROR)  */)
        }
     }
 
-  if (!NUMBERP (err))
+  if (! TYPE_RANGED_INTEGERP (int, err))
     return build_string ("Not an error symbol or code");
 
   return build_string (fn_gnutls_strerror (XINT (err)));
@@ -801,7 +805,10 @@ one trustfile (usually a CA bundle).  */)
     error ("gnutls-boot: invalid :hostname parameter");
   c_hostname = SSDATA (hostname);
 
-  if (NUMBERP (loglevel))
+  state = XPROCESS (proc)->gnutls_state;
+  XPROCESS (proc)->gnutls_p = 1;
+
+  if (TYPE_RANGED_INTEGERP (int, loglevel))
     {
       fn_gnutls_global_set_log_function (gnutls_log_function);
       fn_gnutls_global_set_log_level (XINT (loglevel));
@@ -864,9 +871,9 @@ one trustfile (usually a CA bundle).  */)
       int file_format = GNUTLS_X509_FMT_PEM;
       Lisp_Object tail;
 
-      for (tail = trustfiles; !NILP (tail); tail = Fcdr (tail))
+      for (tail = trustfiles; CONSP (tail); tail = XCDR (tail))
        {
-         Lisp_Object trustfile = Fcar (tail);
+         Lisp_Object trustfile = XCAR (tail);
          if (STRINGP (trustfile))
            {
              GNUTLS_LOG2 (1, max_log_level, "setting the trustfile: ",
@@ -886,9 +893,9 @@ one trustfile (usually a CA bundle).  */)
            }
        }
 
-      for (tail = crlfiles; !NILP (tail); tail = Fcdr (tail))
+      for (tail = crlfiles; CONSP (tail); tail = XCDR (tail))
        {
-         Lisp_Object crlfile = Fcar (tail);
+         Lisp_Object crlfile = XCAR (tail);
          if (STRINGP (crlfile))
            {
              GNUTLS_LOG2 (1, max_log_level, "setting the CRL file: ",
@@ -906,10 +913,10 @@ one trustfile (usually a CA bundle).  */)
            }
        }
 
-      for (tail = keylist; !NILP (tail); tail = Fcdr (tail))
+      for (tail = keylist; CONSP (tail); tail = XCDR (tail))
        {
-         Lisp_Object keyfile = Fcar (Fcar (tail));
-         Lisp_Object certfile = Fcar (Fcdr (tail));
+         Lisp_Object keyfile = Fcar (XCAR (tail));
+         Lisp_Object certfile = Fcar (Fcdr (XCAR (tail)));
          if (STRINGP (keyfile) && STRINGP (certfile))
            {
              GNUTLS_LOG2 (1, max_log_level, "setting the client key file: ",
index 37b9a2eb4df194e51eef061462f33ce7fe8d7fca..2b13908a7484deeb9ad3ef7a395bb318d018b951 100644 (file)
@@ -58,10 +58,10 @@ typedef enum
 
 #define GNUTLS_LOG2i(level, max, string, extra) do { if (level <= max) { gnutls_log_function2i (level, "(Emacs) " string, extra); } } while (0)
 
-extern EMACS_INT
-emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte);
-extern EMACS_INT
-emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte);
+extern ptrdiff_t
+emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte);
+extern ptrdiff_t
+emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte);
 
 extern int emacs_gnutls_record_check_pending (gnutls_session_t state);
 extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err);
index 4dbef65dedfa982514ba4b3bca5b3d8cb7c70473..d81f63a6808d4518157da26eee4cd9ca81cb1eaf 100644 (file)
@@ -83,10 +83,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
   gdk_window_get_geometry (w, a, b, c, d, 0)
 #define gdk_x11_window_lookup_for_display(d, w) \
   gdk_xid_table_lookup_for_display (d, w)
+#define gtk_box_new(ori, spacing)                                       \
+  ((ori) == GTK_ORIENTATION_HORIZONTAL                                  \
+   ? gtk_hbox_new (FALSE, (spacing)) : gtk_vbox_new (FALSE, (spacing)))
+#define gtk_scrollbar_new(ori, spacing)                                 \
+  ((ori) == GTK_ORIENTATION_HORIZONTAL                                  \
+   ? gtk_hscrollbar_new ((spacing)) : gtk_vscrollbar_new ((spacing)))
 #ifndef GDK_KEY_g
 #define GDK_KEY_g GDK_g
 #endif
-#endif
+#endif /* HAVE_GTK3 */
 
 #define XG_BIN_CHILD(x) gtk_bin_get_child (GTK_BIN (x))
 
@@ -209,7 +215,7 @@ malloc_widget_value (void)
     }
   else
     {
-      wv = (widget_value *) xmalloc (sizeof (widget_value));
+      wv = xmalloc (sizeof *wv);
       malloc_cpt++;
     }
   memset (wv, 0, sizeof (widget_value));
@@ -523,9 +529,8 @@ get_utf8_string (const char *str)
                                        &bytes_written, &err))
              && err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
         {
-          strncpy (up, (char *)p, bytes_written);
+          memcpy (up, p, bytes_written);
           sprintf (up + bytes_written, "\\%03o", p[bytes_written]);
-          up[bytes_written+4] = '\0';
           up += bytes_written+4;
           p += bytes_written+1;
           g_error_free (err);
@@ -1090,13 +1095,18 @@ xg_create_frame_widgets (FRAME_PTR f)
   GtkWidget *wtop;
   GtkWidget *wvbox, *whbox;
   GtkWidget *wfixed;
+#ifndef HAVE_GTK3
   GtkRcStyle *style;
+#endif
   char *title = 0;
 
   BLOCK_INPUT;
 
   if (FRAME_X_EMBEDDED_P (f))
-    wtop = gtk_plug_new (f->output_data.x->parent_desc);
+    {
+      GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
+      wtop = gtk_plug_new_for_display (gdpy, f->output_data.x->parent_desc);
+    }
   else
     wtop = gtk_window_new (GTK_WINDOW_TOPLEVEL);
 
@@ -1110,8 +1120,10 @@ xg_create_frame_widgets (FRAME_PTR f)
 
   xg_set_screen (wtop, f);
 
-  wvbox = gtk_vbox_new (FALSE, 0);
-  whbox = gtk_hbox_new (FALSE, 0);
+  wvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+  whbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_box_set_homogeneous (GTK_BOX (wvbox), FALSE);
+  gtk_box_set_homogeneous (GTK_BOX (whbox), FALSE);
 
 #ifdef HAVE_GTK3
   wfixed = emacs_fixed_new (f);
@@ -1486,9 +1498,12 @@ create_dialog (widget_value *wv,
 
   if (make_two_rows)
     {
-      GtkWidget *wvbox = gtk_vbox_new (TRUE, button_spacing);
-      GtkWidget *whbox_up = gtk_hbox_new (FALSE, 0);
-      whbox_down = gtk_hbox_new (FALSE, 0);
+      GtkWidget *wvbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, button_spacing);
+      GtkWidget *whbox_up = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+      gtk_box_set_homogeneous (GTK_BOX (wvbox), TRUE);
+      gtk_box_set_homogeneous (GTK_BOX (whbox_up), FALSE);
+      whbox_down = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+      gtk_box_set_homogeneous (GTK_BOX (whbox_down), FALSE);
 
       gtk_box_pack_start (cur_box, wvbox, FALSE, FALSE, 0);
       gtk_box_pack_start (GTK_BOX (wvbox), whbox_up, FALSE, FALSE, 0);
@@ -1610,16 +1625,16 @@ xg_maybe_add_timer (gpointer data)
 {
   struct xg_dialog_data *dd = (struct xg_dialog_data *) data;
   EMACS_TIME next_time = timer_check ();
-  long secs = EMACS_SECS (next_time);
-  long usecs = EMACS_USECS (next_time);
 
   dd->timerid = 0;
 
-  if (secs >= 0 && usecs >= 0 && secs < ((guint)-1)/1000)
+  if (EMACS_TIME_VALID_P (next_time))
     {
-      dd->timerid = g_timeout_add (secs * 1000 + usecs/1000,
-                                   xg_maybe_add_timer,
-                                   dd);
+      time_t s = EMACS_SECS (next_time);
+      int per_ms = EMACS_TIME_RESOLUTION / 1000;
+      int ms = (EMACS_NSECS (next_time) + per_ms - 1) / per_ms;
+      if (s <= ((guint) -1 - ms) / 1000)
+       dd->timerid = g_timeout_add (s * 1000 + ms, xg_maybe_add_timer, dd);
     }
   return FALSE;
 }
@@ -1632,7 +1647,7 @@ xg_maybe_add_timer (gpointer data)
 static int
 xg_dialog_run (FRAME_PTR f, GtkWidget *w)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct xg_dialog_data dd;
 
   xg_set_screen (w, f);
@@ -1776,7 +1791,8 @@ xg_get_file_with_chooser (FRAME_PTR f,
                                          NULL);
   gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (filewin), TRUE);
 
-  wbox = gtk_vbox_new (FALSE, 0);
+  wbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
+  gtk_box_set_homogeneous (GTK_BOX (wbox), FALSE);
   gtk_widget_show (wbox);
   wtoggle = gtk_check_button_new_with_label ("Show hidden files.");
 
@@ -2041,7 +2057,7 @@ make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
 {
   if (! cl_data)
     {
-      cl_data = (xg_menu_cb_data*) xmalloc (sizeof (*cl_data));
+      cl_data = xmalloc (sizeof *cl_data);
       cl_data->f = f;
       cl_data->menu_bar_vector = f->menu_bar_vector;
       cl_data->menu_bar_items_used = f->menu_bar_items_used;
@@ -2188,7 +2204,8 @@ make_widget_for_menu_item (const char *utf8_label, const char *utf8_key)
   GtkWidget *wkey;
   GtkWidget *wbox;
 
-  wbox = gtk_hbox_new (FALSE, 0);
+  wbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+  gtk_box_set_homogeneous (GTK_BOX (wbox), FALSE);
   wlbl = gtk_label_new (utf8_label);
   wkey = gtk_label_new (utf8_key);
 
@@ -2340,7 +2357,7 @@ xg_create_one_menuitem (widget_value *item,
   if (utf8_label) g_free (utf8_label);
   if (utf8_key) g_free (utf8_key);
 
-  cb_data = xmalloc (sizeof (xg_menu_item_cb_data));
+  cb_data = xmalloc (sizeof *cb_data);
 
   xg_list_insert (&xg_menu_item_cb_list, &cb_data->ptrs);
 
@@ -2845,7 +2862,7 @@ xg_update_menu_item (widget_value *val,
   utf8_key = get_utf8_string (val->key);
 
   /* See if W is a menu item with a key.  See make_menu_item above.  */
-  if (GTK_IS_HBOX (wchild))
+  if (GTK_IS_BOX (wchild))
     {
       GList *list = gtk_container_get_children (GTK_CONTAINER (wchild));
 
@@ -3399,7 +3416,7 @@ update_theme_scrollbar_width (void)
   int w = 0, b = 0;
 
   vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX, 0.1, 0.1, 0.1);
-  wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj));
+  wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj));
   g_object_ref_sink (G_OBJECT (wscroll));
   gtk_widget_style_get (wscroll, "slider-width", &w, "trough-border", &b, NULL);
   gtk_widget_destroy (wscroll);
@@ -3476,7 +3493,7 @@ xg_create_scroll_bar (FRAME_PTR f,
   vadj = gtk_adjustment_new (XG_SB_MIN, XG_SB_MIN, XG_SB_MAX,
                              0.1, 0.1, 0.1);
 
-  wscroll = gtk_vscrollbar_new (GTK_ADJUSTMENT (vadj));
+  wscroll = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (vadj));
   webox = gtk_event_box_new ();
   gtk_widget_set_name (wscroll, scroll_bar_name);
 #ifndef HAVE_GTK3
@@ -3709,8 +3726,15 @@ xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event)
     {
       /* Check if press occurred outside the edit widget.  */
       GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f));
-      retval = gdk_display_get_window_at_pointer (gdpy, NULL, NULL)
-        != gtk_widget_get_window (f->output_data.x->edit_widget);
+      GdkWindow *gwin;
+#ifdef HAVE_GTK3
+      GdkDevice *gdev = gdk_device_manager_get_client_pointer
+        (gdk_display_get_device_manager (gdpy));
+      gwin = gdk_device_get_window_at_position (gdev, NULL, NULL);
+#else
+      gwin = gdk_display_get_window_at_pointer (gdpy, NULL, NULL);
+#endif
+      retval = gwin != gtk_widget_get_window (f->output_data.x->edit_widget);
     }
   else if (f
            && ((event->type == ButtonRelease && event->xbutton.button < 4)
@@ -4179,6 +4203,9 @@ static void
 xg_create_tool_bar (FRAME_PTR f)
 {
   struct x_output *x = f->output_data.x;
+#if GTK_CHECK_VERSION (3, 3, 6)
+  GtkStyleContext *gsty;
+#endif
 
   x->toolbar_widget = gtk_toolbar_new ();
   x->toolbar_detached = 0;
@@ -4187,6 +4214,10 @@ xg_create_tool_bar (FRAME_PTR f)
 
   gtk_toolbar_set_style (GTK_TOOLBAR (x->toolbar_widget), GTK_TOOLBAR_ICONS);
   toolbar_set_orientation (x->toolbar_widget, GTK_ORIENTATION_HORIZONTAL);
+#if GTK_CHECK_VERSION (3, 3, 6)
+  gsty = gtk_widget_get_style_context (x->toolbar_widget);
+  gtk_style_context_add_class (gsty, "primary-toolbar");
+#endif
 }
 
 
@@ -4231,10 +4262,31 @@ xg_make_tool_item (FRAME_PTR f,
                    int i, int horiz, int text_image)
 {
   GtkToolItem *ti = gtk_tool_item_new ();
-  GtkWidget *vb = horiz ? gtk_hbox_new (FALSE, 0) : gtk_vbox_new (FALSE, 0);
+  GtkWidget *vb = gtk_box_new (horiz
+                               ? GTK_ORIENTATION_HORIZONTAL
+                               : GTK_ORIENTATION_VERTICAL,
+                               0);
   GtkWidget *wb = gtk_button_new ();
   /* The eventbox is here so we can have tooltips on disabled items.  */
   GtkWidget *weventbox = gtk_event_box_new ();
+#if GTK_CHECK_VERSION (3, 3, 6)
+  GtkCssProvider *css_prov = gtk_css_provider_new ();
+  GtkStyleContext *gsty;
+
+  gtk_css_provider_load_from_data (css_prov,
+                                  "GtkEventBox {"
+                                  "    background-color: transparent;"
+                                  "}",
+                                  -1, NULL);
+
+  gsty = gtk_widget_get_style_context (weventbox);
+  gtk_style_context_add_provider (gsty,
+                                 GTK_STYLE_PROVIDER (css_prov),
+                                 GTK_STYLE_PROVIDER_PRIORITY_USER);
+  g_object_unref (css_prov);
+#endif
+
+  gtk_box_set_homogeneous (GTK_BOX (vb), FALSE);
 
   if (wimage && !text_image)
     gtk_box_pack_start (GTK_BOX (vb), wimage, TRUE, TRUE, 0);
@@ -4287,7 +4339,6 @@ xg_make_tool_item (FRAME_PTR f,
          rather than the GtkButton specific signals "enter" and
          "leave", so we can have only one callback.  The event
          will tell us what kind of event it is.  */
-      /* The EMACS_INT cast avoids a warning. */
       g_signal_connect (G_OBJECT (weventbox),
                         "enter-notify-event",
                         G_CALLBACK (xg_tool_bar_help_callback),
@@ -4303,6 +4354,24 @@ xg_make_tool_item (FRAME_PTR f,
   return ti;
 }
 
+static int
+is_box_type (GtkWidget *vb, int is_horizontal)
+{
+#ifdef HAVE_GTK3
+  int ret = 0;
+  if (GTK_IS_BOX (vb))
+    {
+      GtkOrientation ori = gtk_orientable_get_orientation (GTK_ORIENTABLE (vb));
+      ret = (ori == GTK_ORIENTATION_HORIZONTAL && is_horizontal)
+        || (ori == GTK_ORIENTATION_VERTICAL && ! is_horizontal);
+    }
+  return ret;
+#else
+  return is_horizontal ? GTK_IS_VBOX (vb) : GTK_IS_HBOX (vb);
+#endif
+}
+
+
 static int
 xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
                      const char *icon_name, const struct image *img,
@@ -4331,14 +4400,14 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name,
   else if (wimage)
     {
       gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
-                                           XG_TOOL_BAR_IMAGE_DATA);
+                                             XG_TOOL_BAR_IMAGE_DATA);
       Pixmap old_img = (Pixmap) gold_img;
       if (old_img != img->pixmap)
        return 1;
     }
 
   /* Check button configuration and label.  */
-  if ((horiz ? GTK_IS_VBOX (vb) : GTK_IS_HBOX (vb))
+  if (is_box_type (vb, horiz)
       || (label ? (wlbl == NULL) : (wlbl != NULL)))
     return 1;
 
@@ -4413,20 +4482,17 @@ update_frame_tool_bar (FRAME_PTR f)
 
   BLOCK_INPUT;
 
-  if (INTEGERP (Vtool_bar_button_margin)
-      && XINT (Vtool_bar_button_margin) > 0)
+  if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX))
     {
       hmargin = XFASTINT (Vtool_bar_button_margin);
       vmargin = XFASTINT (Vtool_bar_button_margin);
     }
   else if (CONSP (Vtool_bar_button_margin))
     {
-      if (INTEGERP (XCAR (Vtool_bar_button_margin))
-          && XINT (XCAR (Vtool_bar_button_margin)) > 0)
+      if (RANGED_INTEGERP (1, XCAR (Vtool_bar_button_margin), INT_MAX))
         hmargin = XFASTINT (XCAR (Vtool_bar_button_margin));
 
-      if (INTEGERP (XCDR (Vtool_bar_button_margin))
-          && XINT (XCDR (Vtool_bar_button_margin)) > 0)
+      if (RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin), INT_MAX))
         vmargin = XFASTINT (XCDR (Vtool_bar_button_margin));
     }
 
@@ -4558,7 +4624,7 @@ update_frame_tool_bar (FRAME_PTR f)
                        ? TOOL_BAR_IMAGE_DISABLED_SELECTED
                        : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
 
-              xassert (ASIZE (image) >= idx);
+              eassert (ASIZE (image) >= idx);
               image = AREF (image, idx);
             }
           else
@@ -4718,6 +4784,7 @@ void
 xg_initialize (void)
 {
   GtkBindingSet *binding_set;
+  GtkSettings *settings;
 
 #if HAVE_XFT
   /* Work around a bug with corrupted data if libXft gets unloaded.  This way
@@ -4734,17 +4801,19 @@ xg_initialize (void)
   id_to_widget.max_size = id_to_widget.used = 0;
   id_to_widget.widgets = 0;
 
+  settings = gtk_settings_get_for_screen (gdk_display_get_default_screen
+                                          (gdk_display_get_default ()));
   /* Remove F10 as a menu accelerator, it does not mix well with Emacs key
      bindings.  It doesn't seem to be any way to remove properties,
      so we set it to VoidSymbol which in X means "no key".  */
-  gtk_settings_set_string_property (gtk_settings_get_default (),
+  gtk_settings_set_string_property (settings,
                                     "gtk-menu-bar-accel",
                                     "VoidSymbol",
                                     EMACS_CLASS);
 
   /* Make GTK text input widgets use Emacs style keybindings.  This is
      Emacs after all.  */
-  gtk_settings_set_string_property (gtk_settings_get_default (),
+  gtk_settings_set_string_property (settings,
                                     "gtk-key-theme-name",
                                     "Emacs",
                                     EMACS_CLASS);
index 2c6ca0667193020f46865ddb145e9f050fe64418..94c1a1d96ad1b476c570c1cb291d023f2e246230 100644 (file)
@@ -73,16 +73,12 @@ typedef struct xg_menu_item_cb_data_
 
 } xg_menu_item_cb_data;
 
-
-#ifdef HAVE_GTK_FILE_SELECTION_NEW
-extern int use_old_gtk_file_dialog;
-#endif
 struct _widget_value;
 
 extern struct _widget_value *malloc_widget_value (void);
 extern void free_widget_value (struct _widget_value *);
 
-extern int xg_uses_old_file_dialog (void);
+extern int xg_uses_old_file_dialog (void) ATTRIBUTE_CONST;
 
 extern char *xg_get_file_name (FRAME_PTR f,
                                char *prompt,
index 73490fe28659afbdd199e56dbbd6d206adbb400b..8a318c2f6ecd628f2a6179b75f749e4703d8206a 100644 (file)
@@ -1,5 +1,6 @@
 /* Functions for image support on window system.
-   Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc.
+
+Copyright (C) 1989, 1992-2012 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -137,7 +138,6 @@ static unsigned long lookup_rgb_color (struct frame *f, int r, int g, int b);
 static void free_color_table (void);
 static unsigned long *colors_in_color_table (int *n);
 #endif
-static Lisp_Object Finit_image_library (Lisp_Object, Lisp_Object);
 
 /* Code to deal with bitmaps.  Bitmaps are referenced by their bitmap
    id, which is just an int that this section returns.  Bitmaps are
@@ -319,11 +319,11 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
   id = x_allocate_bitmap_record (f);
   dpyinfo->bitmaps[id - 1].img = bitmap;
   dpyinfo->bitmaps[id - 1].refcount = 1;
-  dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1);
+  dpyinfo->bitmaps[id - 1].file = xmalloc (SBYTES (file) + 1);
   dpyinfo->bitmaps[id - 1].depth = 1;
   dpyinfo->bitmaps[id - 1].height = ns_image_width (bitmap);
   dpyinfo->bitmaps[id - 1].width = ns_image_height (bitmap);
-  strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file));
+  strcpy (dpyinfo->bitmaps[id - 1].file, SSDATA (file));
   return id;
 #endif
 
@@ -365,7 +365,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
   dpyinfo->bitmaps[id - 1].pixmap = bitmap;
   dpyinfo->bitmaps[id - 1].have_mask = 0;
   dpyinfo->bitmaps[id - 1].refcount = 1;
-  dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1);
+  dpyinfo->bitmaps[id - 1].file = xmalloc (SBYTES (file) + 1);
   dpyinfo->bitmaps[id - 1].depth = 1;
   dpyinfo->bitmaps[id - 1].height = height;
   dpyinfo->bitmaps[id - 1].width = width;
@@ -521,7 +521,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
        }
     }
 
-  xassert (interrupt_input_blocked);
+  eassert (interrupt_input_blocked);
   gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL);
   XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0,
             width, height);
@@ -599,7 +599,7 @@ define_image_type (struct image_type *type, int loaded)
     {
       /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
          The initialized data segment is read-only.  */
-      struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
+      struct image_type *p = xmalloc (sizeof *p);
       memcpy (p, type, sizeof *p);
       p->next = image_types;
       image_types = p;
@@ -771,10 +771,9 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
       /* Record that we recognized the keyword.  If a keywords
         was found more than once, it's an error.  */
       keywords[i].value = value;
-      ++keywords[i].count;
-
       if (keywords[i].count > 1)
        return 0;
+      ++keywords[i].count;
 
       /* Check type of value against allowed type.  */
       switch (keywords[i].type)
@@ -874,7 +873,7 @@ image_spec_value (Lisp_Object spec, Lisp_Object key, int *found)
 {
   Lisp_Object tail;
 
-  xassert (valid_image_p (spec));
+  eassert (valid_image_p (spec));
 
   for (tail = XCDR (spec);
        CONSP (tail) && CONSP (XCDR (tail));
@@ -983,14 +982,13 @@ static void free_image (struct frame *f, struct image *img);
 static struct image *
 make_image (Lisp_Object spec, EMACS_UINT hash)
 {
-  struct image *img = (struct image *) xmalloc (sizeof *img);
+  struct image *img = xzalloc (sizeof *img);
   Lisp_Object file = image_spec_value (spec, QCfile, NULL);
 
-  xassert (valid_image_p (spec));
-  memset (img, 0, sizeof *img);
+  eassert (valid_image_p (spec));
   img->dependencies = NILP (file) ? Qnil : list1 (file);
   img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
-  xassert (img->type != NULL);
+  eassert (img->type != NULL);
   img->spec = spec;
   img->lisp_data = Qnil;
   img->ascent = DEFAULT_IMAGE_ASCENT;
@@ -1062,11 +1060,8 @@ check_image_size (struct frame *f, int width, int height)
 void
 prepare_image_for_display (struct frame *f, struct image *img)
 {
-  EMACS_TIME t;
-
   /* We're about to display IMG, so set its timestamp to `now'.  */
-  EMACS_GET_TIME (t);
-  img->timestamp = EMACS_SECS (t);
+  img->timestamp = current_emacs_time ();
 
   /* If IMG doesn't have a pixmap yet, load it now, using the image
      type dependent loader function.  */
@@ -1352,7 +1347,7 @@ x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
   XColor color;
   unsigned long result;
 
-  xassert (STRINGP (color_name));
+  eassert (STRINGP (color_name));
 
   if (x_defined_color (f, SSDATA (color_name), &color, 1)
       && img->ncolors < min (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *img->colors,
@@ -1361,9 +1356,7 @@ x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
       /* This isn't called frequently so we get away with simply
         reallocating the color vector to the needed size, here.  */
       ptrdiff_t ncolors = img->ncolors + 1;
-      img->colors =
-       (unsigned long *) xrealloc (img->colors,
-                                   ncolors * sizeof *img->colors);
+      img->colors = xrealloc (img->colors, ncolors * sizeof *img->colors);
       img->colors[ncolors - 1] = color.pixel;
       img->ncolors = ncolors;
       result = color.pixel;
@@ -1389,16 +1382,14 @@ static void postprocess_image (struct frame *, struct image *);
 struct image_cache *
 make_image_cache (void)
 {
-  struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
+  struct image_cache *c = xzalloc (sizeof *c);
   int size;
 
-  memset (c, 0, sizeof *c);
   size = 50;
-  c->images = (struct image **) xmalloc (size * sizeof *c->images);
+  c->images = xmalloc (size * sizeof *c->images);
   c->size = size;
   size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
-  c->buckets = (struct image **) xmalloc (size);
-  memset (c->buckets, 0, size);
+  c->buckets = xzalloc (size);
   return c;
 }
 
@@ -1464,7 +1455,7 @@ free_image_cache (struct frame *f)
       ptrdiff_t i;
 
       /* Cache should not be referenced by any frame when freed.  */
-      xassert (c->refcount == 0);
+      eassert (c->refcount == 0);
 
       for (i = 0; i < c->used; ++i)
        free_image (f, c->images[i]);
@@ -1514,8 +1505,8 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
       else if (INTEGERP (Vimage_cache_eviction_delay))
        {
          /* Free cache based on timestamp.  */
-         EMACS_TIME t;
-         double old, delay;
+         EMACS_TIME old, t;
+         double delay;
          ptrdiff_t nimages = 0;
 
          for (i = 0; i < c->used; ++i)
@@ -1529,13 +1520,13 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
            delay = 1600 * delay / nimages / nimages;
          delay = max (delay, 1);
 
-         EMACS_GET_TIME (t);
-         old = EMACS_SECS (t) - delay;
+         t = current_emacs_time ();
+         old = sub_emacs_time (t, EMACS_TIME_FROM_DOUBLE (delay));
 
          for (i = 0; i < c->used; ++i)
            {
              struct image *img = c->images[i];
-             if (img && img->timestamp < old)
+             if (img && EMACS_TIME_LT (img->timestamp, old))
                {
                  free_image (f, img);
                  ++nfreed;
@@ -1708,12 +1699,11 @@ lookup_image (struct frame *f, Lisp_Object spec)
 {
   struct image *img;
   EMACS_UINT hash;
-  EMACS_TIME now;
 
   /* F must be a window-system frame, and SPEC must be a valid image
      specification.  */
-  xassert (FRAME_WINDOW_P (f));
-  xassert (valid_image_p (spec));
+  eassert (FRAME_WINDOW_P (f));
+  eassert (valid_image_p (spec));
 
   /* Look up SPEC in the hash table of the image cache.  */
   hash = sxhash (spec, 0);
@@ -1754,6 +1744,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
             `:ascent ASCENT', `:margin MARGIN', `:relief RELIEF',
             `:background COLOR'.  */
          Lisp_Object ascent, margin, relief, bg;
+         int relief_bound;
 
          ascent = image_spec_value (spec, QCascent, NULL);
          if (INTEGERP (ascent))
@@ -1771,7 +1762,8 @@ lookup_image (struct frame *f, Lisp_Object spec)
            }
 
          relief = image_spec_value (spec, QCrelief, NULL);
-         if (INTEGERP (relief))
+         relief_bound = INT_MAX - max (img->hmargin, img->vmargin);
+         if (RANGED_INTEGERP (- relief_bound, relief, relief_bound))
            {
              img->relief = XINT (relief);
              img->hmargin += eabs (img->relief);
@@ -1800,8 +1792,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
     }
 
   /* We're using IMG, so set its timestamp to `now'.  */
-  EMACS_GET_TIME (now);
-  img->timestamp = EMACS_SECS (now);
+  img->timestamp = current_emacs_time ();
 
   /* Value is the image id.  */
   return img->id;
@@ -1950,7 +1941,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
   Window window = FRAME_X_WINDOW (f);
   Screen *screen = FRAME_X_SCREEN (f);
 
-  xassert (interrupt_input_blocked);
+  eassert (interrupt_input_blocked);
 
   if (depth <= 0)
     depth = DefaultDepthOfScreen (screen);
@@ -1973,7 +1964,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
     }
 
   /* Allocate image raster.  */
-  (*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height);
+  (*ximg)->data = xmalloc ((*ximg)->bytes_per_line * height);
 
   /* Allocate a pixmap of the same size.  */
   *pixmap = XCreatePixmap (display, window, width, height, depth);
@@ -2088,7 +2079,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
 static void
 x_destroy_x_image (XImagePtr ximg)
 {
-  xassert (interrupt_input_blocked);
+  eassert (interrupt_input_blocked);
   if (ximg)
     {
 #ifdef HAVE_X_WINDOWS
@@ -2117,7 +2108,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he
 #ifdef HAVE_X_WINDOWS
   GC gc;
 
-  xassert (interrupt_input_blocked);
+  eassert (interrupt_input_blocked);
   gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
   XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height);
   XFreeGC (FRAME_X_DISPLAY (f), gc);
@@ -2132,7 +2123,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
-  xassert (ximg == pixmap);
+  eassert (ximg == pixmap);
   ns_retain_object (ximg);
 #endif
 }
@@ -2187,7 +2178,7 @@ slurp_file (char *file, ptrdiff_t *size)
   if (stat (file, &st) == 0
       && (fp = fopen (file, "rb")) != NULL
       && 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX)
-      && (buf = (unsigned char *) xmalloc (st.st_size),
+      && (buf = xmalloc (st.st_size),
          fread (buf, 1, st.st_size, fp) == st.st_size))
     {
       *size = st.st_size;
@@ -2322,7 +2313,7 @@ xbm_image_p (Lisp_Object object)
   if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
     return 0;
 
-  xassert (EQ (kw[XBM_TYPE].value, Qxbm));
+  eassert (EQ (kw[XBM_TYPE].value, Qxbm));
 
   if (kw[XBM_FILE].count)
     {
@@ -2364,7 +2355,7 @@ xbm_image_p (Lisp_Object object)
             for one line of the image.  */
          for (i = 0; i < height; ++i)
            {
-             Lisp_Object elt = XVECTOR (data)->contents[i];
+             Lisp_Object elt = AREF (data, i);
 
              if (STRINGP (elt))
                {
@@ -2507,7 +2498,7 @@ w32_create_pixmap_from_bitmap_data (int width, int height, char *data)
 
   w1 = (width + 7) / 8;         /* nb of 8bits elt in X bitmap */
   w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */
-  bits = (unsigned char *) alloca (height * w2);
+  bits = alloca (height * w2);
   memset (bits, 0, height * w2);
   for (i = 0; i < height; i++)
     {
@@ -2709,7 +2700,7 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
     }
   bytes_per_line = (*width + 7) / 8 + padding_p;
   nbytes = bytes_per_line * *height;
-  p = *data = (char *) xmalloc (nbytes);
+  p = *data = xmalloc (nbytes);
 
   if (v10)
     {
@@ -2783,7 +2774,7 @@ xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
       int non_default_colors = 0;
       Lisp_Object value;
 
-      xassert (img->width > 0 && img->height > 0);
+      eassert (img->width > 0 && img->height > 0);
 
       /* Get foreground and background colors, maybe allocate colors.  */
       value = image_spec_value (img->spec, QCforeground, NULL);
@@ -2843,7 +2834,7 @@ xbm_load (struct frame *f, struct image *img)
   int success_p = 0;
   Lisp_Object file_name;
 
-  xassert (xbm_image_p (img->spec));
+  eassert (xbm_image_p (img->spec));
 
   /* If IMG->spec specifies a file name, create a non-file spec from it.  */
   file_name = image_spec_value (img->spec, QCfile, NULL);
@@ -2889,14 +2880,14 @@ xbm_load (struct frame *f, struct image *img)
       memcpy (fmt, xbm_format, sizeof fmt);
       parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
       (void) parsed_p;
-      xassert (parsed_p);
+      eassert (parsed_p);
 
       /* Get specified width, and height.  */
       if (!in_memory_file_p)
        {
          img->width = XFASTINT (fmt[XBM_WIDTH].value);
          img->height = XFASTINT (fmt[XBM_HEIGHT].value);
-         xassert (img->width > 0 && img->height > 0);
+         eassert (img->width > 0 && img->height > 0);
          if (!check_image_size (f, img->width, img->height))
            {
              image_error ("Invalid image size (see `max-image-size')",
@@ -2934,10 +2925,10 @@ xbm_load (struct frame *f, struct image *img)
              char *p;
              int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
 
-             p = bits = (char *) alloca (nbytes * img->height);
+             p = bits = alloca (nbytes * img->height);
              for (i = 0; i < img->height; ++i, p += nbytes)
                {
-                 Lisp_Object line = XVECTOR (data)->contents[i];
+                 Lisp_Object line = AREF (data, i);
                  if (STRINGP (line))
                    memcpy (p, SDATA (line), nbytes);
                  else
@@ -2957,7 +2948,7 @@ xbm_load (struct frame *f, struct image *img)
             invertedBits = bits;
             nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR
               * img->height;
-            bits = (char *) alloca (nbytes);
+            bits = alloca (nbytes);
             for (i = 0; i < nbytes; i++)
               bits[i] = XBM_BIT_SHUFFLE (invertedBits[i]);
           }
@@ -3122,8 +3113,7 @@ static void
 xpm_init_color_cache (struct frame *f, XpmAttributes *attrs)
 {
   size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache;
-  xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes);
-  memset (xpm_color_cache, 0, nbytes);
+  xpm_color_cache = xzalloc (nbytes);
   init_color_table ();
 
   if (attrs->valuemask & XpmColorSymbols)
@@ -3187,7 +3177,7 @@ xpm_cache_color (struct frame *f, char *color_name, XColor *color, int bucket)
     bucket = xpm_color_bucket (color_name);
 
   nbytes = offsetof (struct xpm_cached_color, name) + strlen (color_name) + 1;
-  p = (struct xpm_cached_color *) xmalloc (nbytes);
+  p = xmalloc (nbytes);
   strcpy (p->name, color_name);
   p->color = *color;
   p->next = xpm_color_cache[bucket];
@@ -3430,7 +3420,7 @@ xpm_load (struct frame *f, struct image *img)
 
       /* Allocate an XpmColorSymbol array.  */
       size = attrs.numsymbols * sizeof *xpm_syms;
-      xpm_syms = (XpmColorSymbol *) alloca (size);
+      xpm_syms = alloca (size);
       memset (xpm_syms, 0, size);
       attrs.colorsymbols = xpm_syms;
 
@@ -3453,14 +3443,14 @@ xpm_load (struct frame *f, struct image *img)
          color = XCDR (XCAR (tail));
          if (STRINGP (name))
            {
-             xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1);
+             xpm_syms[i].name = alloca (SCHARS (name) + 1);
              strcpy (xpm_syms[i].name, SSDATA (name));
            }
          else
            xpm_syms[i].name = empty_string;
          if (STRINGP (color))
            {
-             xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1);
+             xpm_syms[i].value = alloca (SCHARS (color) + 1);
              strcpy (xpm_syms[i].value, SSDATA (color));
            }
          else
@@ -3583,7 +3573,7 @@ xpm_load (struct frame *f, struct image *img)
 
       img->width = attrs.width;
       img->height = attrs.height;
-      xassert (img->width > 0 && img->height > 0);
+      eassert (img->width > 0 && img->height > 0);
 
       /* The call to XpmFreeAttributes below frees attrs.alloc_pixels.  */
 #ifdef HAVE_NTGUI
@@ -3747,7 +3737,7 @@ xpm_put_color_table_v (Lisp_Object color_table,
                        int chars_len,
                        Lisp_Object color)
 {
-  XVECTOR (color_table)->contents[*chars_start] = color;
+  ASET (color_table, *chars_start, color);
 }
 
 static Lisp_Object
@@ -3755,7 +3745,7 @@ xpm_get_color_table_v (Lisp_Object color_table,
                        const unsigned char *chars_start,
                        int chars_len)
 {
-  return XVECTOR (color_table)->contents[*chars_start];
+  return AREF (color_table, *chars_start);
 }
 
 static Lisp_Object
@@ -3974,7 +3964,7 @@ xpm_load_image (struct frame *f,
            {
              if (xstrcasecmp (SSDATA (XCDR (specified_color)), "None") == 0)
                color_val = Qt;
-             else if (x_defined_color (f, SDATA (XCDR (specified_color)),
+             else if (x_defined_color (f, SSDATA (XCDR (specified_color)),
                                        &cdef, 0))
                color_val = make_number (cdef.pixel);
            }
@@ -4049,7 +4039,6 @@ xpm_load_image (struct frame *f,
 
  failure:
   image_error ("Invalid XPM file (%s)", img->spec, Qnil);
- error:
   x_destroy_x_image (ximg);
   x_destroy_x_image (mask_img);
   x_clear_image (f, img);
@@ -4082,7 +4071,7 @@ xpm_load (struct frame *f,
          return 0;
        }
 
-      contents = slurp_file (SDATA (file), &size);
+      contents = slurp_file (SSDATA (file), &size);
       if (contents == NULL)
        {
          image_error ("Error loading XPM image `%s'", img->spec, Qnil);
@@ -4158,8 +4147,7 @@ static void
 init_color_table (void)
 {
   int size = CT_SIZE * sizeof (*ct_table);
-  ct_table = (struct ct_color **) xmalloc (size);
-  memset (ct_table, 0, size);
+  ct_table = xzalloc (size);
   ct_colors_allocated = 0;
 }
 
@@ -4254,7 +4242,7 @@ lookup_rgb_color (struct frame *f, int r, int g, int b)
       if (rc)
        {
          ++ct_colors_allocated;
-         p = (struct ct_color *) xmalloc (sizeof *p);
+         p = xmalloc (sizeof *p);
          p->r = r;
          p->g = g;
          p->b = b;
@@ -4272,7 +4260,7 @@ lookup_rgb_color (struct frame *f, int r, int g, int b)
       color = RGB_TO_ULONG (r, g, b);
 #endif /* HAVE_NTGUI */
       ++ct_colors_allocated;
-      p = (struct ct_color *) xmalloc (sizeof *p);
+      p = xmalloc (sizeof *p);
       p->r = r;
       p->g = g;
       p->b = b;
@@ -4327,7 +4315,7 @@ lookup_pixel_color (struct frame *f, unsigned long pixel)
        {
          ++ct_colors_allocated;
 
-         p = (struct ct_color *) xmalloc (sizeof *p);
+         p = xmalloc (sizeof *p);
          p->r = color.red;
          p->g = color.green;
          p->b = color.blue;
@@ -4359,8 +4347,7 @@ colors_in_color_table (int *n)
     }
   else
     {
-      colors = (unsigned long *) xmalloc (ct_colors_allocated
-                                         * sizeof *colors);
+      colors = xmalloc (ct_colors_allocated * sizeof *colors);
       *n = ct_colors_allocated;
 
       for (i = j = 0; i < CT_SIZE; ++i)
@@ -4449,7 +4436,7 @@ x_to_xcolors (struct frame *f, struct image *img, int rgb_p)
 
   if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *colors / img->width < img->height)
     memory_full (SIZE_MAX);
-  colors = (XColor *) xmalloc (sizeof *colors * img->width * img->height);
+  colors = xmalloc (sizeof *colors * img->width * img->height);
 
 #ifndef HAVE_NTGUI
   /* Get the X image IMG->pixmap.  */
@@ -4468,9 +4455,8 @@ x_to_xcolors (struct frame *f, struct image *img, int rgb_p)
   p = colors;
   for (y = 0; y < img->height; ++y)
     {
-      XColor *row = p;
-
 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
+      XColor *row = p;
       for (x = 0; x < img->width; ++x, ++p)
        p->pixel = GET_PIXEL (ximg, x, y);
       if (rgb_p)
@@ -4603,7 +4589,7 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus
 
   if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *new / img->width < img->height)
     memory_full (SIZE_MAX);
-  new = (XColor *) xmalloc (sizeof *new * img->width * img->height);
+  new = xmalloc (sizeof *new * img->width * img->height);
 
   for (y = 0; y < img->height; ++y)
     {
@@ -4753,14 +4739,12 @@ x_disable_image (struct frame *f, struct image *img)
   if (n_planes < 2 || cross_disabled_images)
     {
 #ifndef HAVE_NTGUI
-      Display *dpy = FRAME_X_DISPLAY (f);
-      GC gc;
-
 #ifndef HAVE_NS  /* TODO: NS support, however this not needed for toolbars */
 
 #define MaskForeground(f)  WHITE_PIX_DEFAULT (f)
 
-      gc = XCreateGC (dpy, img->pixmap, 0, NULL);
+      Display *dpy = FRAME_X_DISPLAY (f);
+      GC gc = XCreateGC (dpy, img->pixmap, 0, NULL);
       XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f));
       XDrawLine (dpy, img->pixmap, gc, 0, 0,
                 img->width - 1, img->height - 1);
@@ -4856,8 +4840,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
 #else
   /* Create the bit array serving as mask.  */
   row_width = (img->width + 7) / 8;
-  mask_img = xmalloc (row_width * img->height);
-  memset (mask_img, 0, row_width * img->height);
+  mask_img = xzalloc (row_width * img->height);
 
   /* Create a memory device context for IMG->pixmap.  */
   frame_dc = get_frame_dc (f);
@@ -5073,7 +5056,7 @@ pbm_read_file (Lisp_Object file, int *size)
   if (stat (SDATA (file), &st) == 0
       && (fp = fopen (SDATA (file), "rb")) != NULL
       && 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX)
-      && (buf = (char *) xmalloc (st.st_size),
+      && (buf = xmalloc (st.st_size),
          fread (buf, 1, st.st_size, fp) == st.st_size))
     {
       *size = st.st_size;
@@ -5551,11 +5534,10 @@ init_png_functions (Lisp_Object libraries)
 /* Error and warning handlers installed when the PNG library
    is initialized.  */
 
-static void my_png_error (png_struct *, const char *) NO_RETURN;
-static void
+static _Noreturn void
 my_png_error (png_struct *png_ptr, const char *msg)
 {
-  xassert (png_ptr != NULL);
+  eassert (png_ptr != NULL);
   /* Avoid compiler warning about deprecated direct access to
      png_ptr's fields in libpng versions 1.4.x.  */
   image_error ("PNG error: %s", build_string (msg), Qnil);
@@ -5566,7 +5548,7 @@ my_png_error (png_struct *png_ptr, const char *msg)
 static void
 my_png_warning (png_struct *png_ptr, const char *msg)
 {
-  xassert (png_ptr != NULL);
+  eassert (png_ptr != NULL);
   image_error ("PNG warning: %s", build_string (msg), Qnil);
 }
 
@@ -5836,7 +5818,7 @@ png_load (struct frame *f, struct image *img)
      images with alpha channel, i.e. RGBA.  If conversions above were
      sufficient we should only have 3 or 4 channels here.  */
   channels = fn_png_get_channels (png_ptr, info_ptr);
-  xassert (channels == 3 || channels == 4);
+  eassert (channels == 3 || channels == 4);
 
   /* Number of bytes needed for one row of the image.  */
   row_bytes = fn_png_get_rowbytes (png_ptr, info_ptr);
@@ -5845,8 +5827,8 @@ png_load (struct frame *f, struct image *img)
   if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height
       || min (PTRDIFF_MAX, SIZE_MAX) / sizeof *pixels / height < row_bytes)
     memory_full (SIZE_MAX);
-  pixels = (png_byte *) xmalloc (sizeof *pixels * row_bytes * height);
-  rows = (png_byte **) xmalloc (height * sizeof *rows);
+  pixels = xmalloc (sizeof *pixels * row_bytes * height);
+  rows = xmalloc (height * sizeof *rows);
   for (i = 0; i < height; ++i)
     rows[i] = pixels + i * row_bytes;
 
@@ -6133,8 +6115,7 @@ struct my_jpeg_error_mgr
 };
 
 
-static void my_error_exit (j_common_ptr) NO_RETURN;
-static void
+static _Noreturn void
 my_error_exit (j_common_ptr cinfo)
 {
   struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
@@ -6462,8 +6443,7 @@ jpeg_load (struct frame *f, struct image *img)
        a default color, and we don't have to care about which colors
        can be freed safely, and which can't.  */
     init_color_table ();
-    colors = (unsigned long *) alloca (cinfo.actual_number_of_colors
-                                      * sizeof *colors);
+    colors = alloca (cinfo.actual_number_of_colors * sizeof *colors);
 
     for (i = 0; i < cinfo.actual_number_of_colors; ++i)
       {
@@ -6896,7 +6876,7 @@ tiff_load (struct frame *f, struct image *img)
       return 0;
     }
 
-  buf = (uint32 *) xmalloc (sizeof *buf * width * height);
+  buf = xmalloc (sizeof *buf * width * height);
 
   rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
 
@@ -7575,7 +7555,7 @@ imagemagick_error (MagickWand *wand)
 
   description = MagickGetException (wand, &severity);
   image_error ("ImageMagick error: %s",
-              make_string (description, strlen (description)),
+              build_string (description),
               Qnil);
   description = (char *) MagickRelinquishMemory (description);
 }
@@ -7597,19 +7577,14 @@ imagemagick_load_image (struct frame *f, struct image *img,
                        unsigned char *contents, unsigned int size,
                        char *filename)
 {
-  size_t width;
-  size_t height;
-
+  size_t width, height;
   MagickBooleanType status;
-
   XImagePtr ximg;
-  int x;
-  int y;
-
-  MagickWand  *image_wand;
-  MagickWand  *ping_wand;
+  int x, y;
+  MagickWand *image_wand;
+  MagickWand *ping_wand;
   PixelIterator *iterator;
-  PixelWand  **pixels;
+  PixelWand **pixels, *bg_wand = NULL;
   MagickPixelPacket  pixel;
   Lisp_Object image;
   Lisp_Object value;
@@ -7618,10 +7593,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
   int desired_width, desired_height;
   double rotation;
   int pixelwidth;
-  ImageInfo  *image_info;
-  ExceptionInfo *exception;
-  Image * im_image;
-
 
   /* Handle image index for image types who can contain more than one image.
      Interface :index is same as for GIF.  First we "ping" the image to see how
@@ -7635,14 +7606,9 @@ imagemagick_load_image (struct frame *f, struct image *img,
   ping_wand = NewMagickWand ();
   /* MagickSetResolution (ping_wand, 2, 2);   (Bug#10112)  */
 
-  if (filename != NULL)
-    {
-      status = MagickPingImage (ping_wand, filename);
-    }
-  else
-    {
-      status = MagickPingImageBlob (ping_wand, contents, size);
-    }
+  status = filename
+    ? MagickPingImage (ping_wand, filename)
+    : MagickPingImageBlob (ping_wand, contents, size);
 
   if (status == MagickFalse)
     {
@@ -7651,7 +7617,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
       return 0;
     }
 
-  if (! (0 <= ino && ino < MagickGetNumberImages (ping_wand)))
+  if (ino < 0 || ino >= MagickGetNumberImages (ping_wand))
     {
       image_error ("Invalid image number `%s' in image `%s'",
                   image, img->spec);
@@ -7668,39 +7634,46 @@ imagemagick_load_image (struct frame *f, struct image *img,
   DestroyMagickWand (ping_wand);
 
   /* Now we know how many images are inside the file.  If it's not a
-     bundle, the number is one.  */
+     bundle, the number is one.  Load the image data.  */
 
-  if (filename != NULL)
-    {
-      image_info = CloneImageInfo ((ImageInfo *) NULL);
-      (void) strcpy (image_info->filename, filename);
-      image_info->number_scenes = 1;
-      image_info->scene = ino;
-      exception = AcquireExceptionInfo ();
-
-      im_image = ReadImage (image_info, exception);
-      DestroyExceptionInfo (exception);
+  image_wand = NewMagickWand ();
 
-      if (im_image == NULL)
-       goto imagemagick_no_wand;
-      image_wand = NewMagickWandFromImage (im_image);
-      DestroyImage (im_image);
-    }
-  else
+  if ((filename
+       ? MagickReadImage (image_wand, filename)
+       : MagickReadImageBlob (image_wand, contents, size))
+      == MagickFalse)
     {
-      image_wand = NewMagickWand ();
-      if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse)
-       {
-         imagemagick_error (image_wand);
-         goto imagemagick_error;
-       }
+      imagemagick_error (image_wand);
+      goto imagemagick_error;
     }
 
+  /* Retrieve the frame's background color, for use later.  */
+  {
+    XColor bgcolor;
+    Lisp_Object specified_bg;
+
+    specified_bg = image_spec_value (img->spec, QCbackground, NULL);
+    if (!STRINGP (specified_bg)
+       || !x_defined_color (f, SSDATA (specified_bg), &bgcolor, 0))
+      {
+#ifndef HAVE_NS
+       bgcolor.pixel = FRAME_BACKGROUND_PIXEL (f);
+       x_query_color (f, &bgcolor);
+#else
+       ns_query_color (FRAME_BACKGROUND_COLOR (f), &bgcolor, 1);
+#endif
+      }
+
+    bg_wand = NewPixelWand ();
+    PixelSetRed   (bg_wand, (double) bgcolor.red   / 65535);
+    PixelSetGreen (bg_wand, (double) bgcolor.green / 65535);
+    PixelSetBlue  (bg_wand, (double) bgcolor.blue  / 65535);
+  }
+
   /* If width and/or height is set in the display spec assume we want
      to scale to those values.  If either h or w is unspecified, the
      unspecified should be calculated from the specified to preserve
      aspect ratio.  */
-
   value = image_spec_value (img->spec, QCwidth, NULL);
   desired_width = (INTEGERP (value)  ? XFASTINT (value) : -1);
   value = image_spec_value (img->spec, QCheight, NULL);
@@ -7766,13 +7739,8 @@ imagemagick_load_image (struct frame *f, struct image *img,
   value = image_spec_value (img->spec, QCrotation, NULL);
   if (FLOATP (value))
     {
-      PixelWand* background = NewPixelWand ();
-      PixelSetColor (background, "#ffffff");/*TODO remove hardcode*/
-
       rotation = extract_float (value);
-
-      status = MagickRotateImage (image_wand, background, rotation);
-      DestroyPixelWand (background);
+      status = MagickRotateImage (image_wand, bg_wand, rotation);
       if (status == MagickFalse)
         {
           image_error ("Imagemagick image rotate failed", Qnil, Qnil);
@@ -7786,6 +7754,22 @@ imagemagick_load_image (struct frame *f, struct image *img,
   height = MagickGetImageHeight (image_wand);
   width = MagickGetImageWidth (image_wand);
 
+  /* Set the canvas background color to the frame or specified
+     background, and flatten the image.  Note: as of ImageMagick
+     6.6.0, SVG image transparency is not handled properly
+     (e.g. etc/images/splash.svg shows a white background always).  */
+  {
+    MagickWand *new_wand;
+    MagickSetImageBackgroundColor (image_wand, bg_wand);
+#ifdef HAVE_MAGICKMERGEIMAGELAYERS
+    new_wand = MagickMergeImageLayers (image_wand, MergeLayer);
+#else
+    new_wand = MagickFlattenImages (image_wand);
+#endif
+    DestroyMagickWand (image_wand);
+    image_wand = new_wand;
+  }
+
   if (! (width <= INT_MAX && height <= INT_MAX
         && check_image_size (f, width, height)))
     {
@@ -7798,7 +7782,50 @@ imagemagick_load_image (struct frame *f, struct image *img,
 
   init_color_table ();
 
-  if (imagemagick_render_type == 0)
+#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS
+  if (imagemagick_render_type != 0)
+    {
+      /* Magicexportimage is normally faster than pixelpushing.  This
+         method is also well tested.  Some aspects of this method are
+         ad-hoc and needs to be more researched. */
+      int imagedepth = 24; /*MagickGetImageDepth(image_wand);*/
+      const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP"; /*"RGBP";*/
+      /* Try to create a x pixmap to hold the imagemagick pixmap.  */
+      if (!x_create_x_image_and_pixmap (f, width, height, imagedepth,
+                                        &ximg, &img->pixmap))
+       {
+#ifdef COLOR_TABLE_SUPPORT
+         free_color_table ();
+#endif
+         image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
+         goto imagemagick_error;
+       }
+
+      /* Oddly, the below code doesn't seem to work:*/
+      /* switch(ximg->bitmap_unit){ */
+      /* case 8: */
+      /*   pixelwidth=CharPixel; */
+      /*   break; */
+      /* case   16: */
+      /*   pixelwidth=ShortPixel; */
+      /*   break; */
+      /* case   32: */
+      /*   pixelwidth=LongPixel; */
+      /*   break; */
+      /* } */
+      /*
+        Here im just guessing the format of the bitmap.
+        happens to work fine for:
+        - bw djvu images
+        on rgb display.
+        seems about 3 times as fast as pixel pushing(not carefully measured)
+      */
+      pixelwidth = CharPixel; /*??? TODO figure out*/
+      MagickExportImagePixels (image_wand, 0, 0, width, height,
+                              exportdepth, pixelwidth, ximg->data);
+    }
+  else
+#endif /* HAVE_MAGICKEXPORTIMAGEPIXELS */
     {
       size_t image_height;
 
@@ -7848,59 +7875,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
         }
       DestroyPixelIterator (iterator);
     }
-  else                          /* imagemagick_render_type != 0 */
-    {
-      /* Magicexportimage is normally faster than pixelpushing.  This
-         method is also well tested. Some aspects of this method are
-         ad-hoc and needs to be more researched. */
-      int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/
-      const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/
-      /* Try to create a x pixmap to hold the imagemagick pixmap.  */
-      if (!x_create_x_image_and_pixmap (f, width, height, imagedepth,
-                                        &ximg, &img->pixmap))
-       {
-#ifdef COLOR_TABLE_SUPPORT
-         free_color_table ();
-#endif
-         image_error ("Imagemagick X bitmap allocation failure", Qnil, Qnil);
-         goto imagemagick_error;
-       }
-
-
-      /* Oddly, the below code doesn't seem to work:*/
-      /* switch(ximg->bitmap_unit){ */
-      /* case 8: */
-      /*   pixelwidth=CharPixel; */
-      /*   break; */
-      /* case   16: */
-      /*   pixelwidth=ShortPixel; */
-      /*   break; */
-      /* case   32: */
-      /*   pixelwidth=LongPixel; */
-      /*   break; */
-      /* } */
-      /*
-        Here im just guessing the format of the bitmap.
-        happens to work fine for:
-        - bw djvu images
-        on rgb display.
-        seems about 3 times as fast as pixel pushing(not carefully measured)
-      */
-      pixelwidth = CharPixel;/*??? TODO figure out*/
-#ifdef HAVE_MAGICKEXPORTIMAGEPIXELS
-      MagickExportImagePixels (image_wand,
-                              0, 0,
-                              width, height,
-                              exportdepth,
-                              pixelwidth,
-                              /*&(img->pixmap));*/
-                              ximg->data);
-#else
-      image_error ("You don't have MagickExportImagePixels, upgrade ImageMagick!",
-                  Qnil, Qnil);
-#endif
-    }
-
 
 #ifdef COLOR_TABLE_SUPPORT
   /* Remember colors allocated for this image.  */
@@ -7908,7 +7882,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
   free_color_table ();
 #endif /* COLOR_TABLE_SUPPORT */
 
-
   img->width  = width;
   img->height = height;
 
@@ -7917,9 +7890,10 @@ imagemagick_load_image (struct frame *f, struct image *img,
   x_put_x_image (f, ximg, img->pixmap, width, height);
   x_destroy_x_image (ximg);
 
-
   /* Final cleanup. image_wand should be the only resource left. */
   DestroyMagickWand (image_wand);
+  if (bg_wand) DestroyPixelWand (bg_wand);
+
   /* `MagickWandTerminus' terminates the imagemagick environment.  */
   MagickWandTerminus ();
 
@@ -7927,7 +7901,8 @@ imagemagick_load_image (struct frame *f, struct image *img,
 
  imagemagick_error:
   DestroyMagickWand (image_wand);
- imagemagick_no_wand:
+  if (bg_wand) DestroyPixelWand (bg_wand);
+
   MagickWandTerminus ();
   /* TODO more cleanup.  */
   image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
@@ -7986,15 +7961,21 @@ their descriptions (http://www.imagemagick.org/script/formats.php).
 You can also try the shell command: `identify -list format'.
 
 Note that ImageMagick recognizes many file-types that Emacs does not
-recognize as images, such as C.  See `imagemagick-types-inhibit'.  */)
+recognize as images, such as C.  See `imagemagick-types-enable'
+and `imagemagick-types-inhibit'.  */)
   (void)
 {
   Lisp_Object typelist = Qnil;
   size_t numf = 0;
   ExceptionInfo ex;
-  char **imtypes = GetMagickList ("*", &numf, &ex);
+  char **imtypes;
   size_t i;
   Lisp_Object Qimagemagicktype;
+
+  GetExceptionInfo(&ex);
+  imtypes = GetMagickList ("*", &numf, &ex);
+  DestroyExceptionInfo(&ex);
+
   for (i = 0; i < numf; i++)
     {
       Qimagemagicktype = intern (imtypes[i]);
@@ -8505,7 +8486,7 @@ gs_image_p (Lisp_Object object)
       if (ASIZE (tem) != 4)
        return 0;
       for (i = 0; i < 4; ++i)
-       if (!INTEGERP (XVECTOR (tem)->contents[i]))
+       if (!INTEGERP (AREF (tem, i)))
          return 0;
     }
   else
@@ -8549,7 +8530,7 @@ gs_load (struct frame *f, struct image *img)
   img->height = in_height;
 
   /* Create the pixmap.  */
-  xassert (img->pixmap == NO_PIXMAP);
+  eassert (img->pixmap == NO_PIXMAP);
 
   if (x_check_image_size (0, img->width, img->height))
     {
@@ -8573,13 +8554,13 @@ gs_load (struct frame *f, struct image *img)
      don't either.  Let the Lisp loader use `unwind-protect' instead.  */
   printnum1 = FRAME_X_WINDOW (f);
   printnum2 = img->pixmap;
-  sprintf (buffer, "%"pMu" %"pMu, printnum1, printnum2);
-  window_and_pixmap_id = build_string (buffer);
+  window_and_pixmap_id 
+    = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
 
   printnum1 = FRAME_FOREGROUND_PIXEL (f);
   printnum2 = FRAME_BACKGROUND_PIXEL (f);
-  sprintf (buffer, "%"pMu" %"pMu, printnum1, printnum2);
-  pixel_colors = build_string (buffer);
+  pixel_colors
+    = make_formatted_string (buffer, "%"pMu" %"pMu, printnum1, printnum2);
 
   XSETFRAME (frame, f);
   loader = image_spec_value (img->spec, QCloader, NULL);
@@ -8620,7 +8601,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
   /* Kill the GS process.  We should have found PIXMAP in the image
      cache and its image should contain a process object.  */
   img = c->images[i];
-  xassert (PROCESSP (img->lisp_data));
+  eassert (PROCESSP (img->lisp_data));
   Fkill_process (img->lisp_data, Qnil);
   img->lisp_data = Qnil;
 
@@ -8695,7 +8676,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
                                Tests
  ***********************************************************************/
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0,
        doc: /* Value is non-nil if SPEC is a valid image specification.  */)
@@ -8717,7 +8698,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "")
   return make_number (id);
 }
 
-#endif /* GLYPH_DEBUG != 0 */
+#endif /* GLYPH_DEBUG */
 
 
 /***********************************************************************
@@ -8931,7 +8912,7 @@ non-numeric, there is no explicit limit on the size of images.  */);
   defsubr (&Simage_mask_p);
   defsubr (&Simage_metadata);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   defsubr (&Simagep);
   defsubr (&Slookup_image);
 #endif
@@ -8970,8 +8951,3 @@ The options are:
 #endif
 
 }
-
-void
-init_image (void)
-{
-}
index a1fcd2b10181d402b54ca8682ee515a328fc5929..ec0977d5372320ec884461a86665328946b351fe 100644 (file)
@@ -22,8 +22,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "category.h"
 #include "composite.h"
 #include "indent.h"
@@ -45,23 +45,23 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    Some things in set last_known_column_point to -1
    to mark the memorized value as invalid.  */
 
-static EMACS_INT last_known_column;
+static ptrdiff_t last_known_column;
 
 /* Value of point when current_column was called.  */
 
-EMACS_INT last_known_column_point;
+ptrdiff_t last_known_column_point;
 
 /* Value of MODIFF when current_column was called.  */
 
-static int last_known_column_modified;
+static EMACS_INT last_known_column_modified;
 
-static EMACS_INT current_column_1 (void);
-static EMACS_INT position_indentation (ptrdiff_t);
+static ptrdiff_t current_column_1 (void);
+static ptrdiff_t position_indentation (ptrdiff_t);
 
 /* Cache of beginning of line found by the last call of
    current_column. */
 
-static EMACS_INT current_column_bol_cache;
+static ptrdiff_t current_column_bol_cache;
 
 /* Get the display table to use for the current buffer.  */
 
@@ -204,12 +204,12 @@ width_run_cache_on_off (void)
    characters immediately following, then *NEXT_BOUNDARY_P
    will equal the return value.  */
 
-EMACS_INT
-skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Object window)
+ptrdiff_t
+skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, ptrdiff_t to, Lisp_Object window)
 {
   Lisp_Object prop, position, overlay_limit, proplimit;
   Lisp_Object buffer, tmp;
-  EMACS_INT end;
+  ptrdiff_t end;
   int inv_p;
 
   XSETFASTINT (position, pos);
@@ -318,13 +318,13 @@ invalidate_current_column (void)
   last_known_column_point = 0;
 }
 
-EMACS_INT
+ptrdiff_t
 current_column (void)
 {
-  register EMACS_INT col;
+  register ptrdiff_t col;
   register unsigned char *ptr, *stop;
   register int tab_seen;
-  EMACS_INT post_tab;
+  ptrdiff_t post_tab;
   register int c;
   int tab_width = SANE_TAB_WIDTH (current_buffer);
   int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
@@ -360,7 +360,7 @@ current_column (void)
 
   while (1)
     {
-      EMACS_INT i, n;
+      ptrdiff_t i, n;
       Lisp_Object charvec;
 
       if (ptr == stop)
@@ -400,8 +400,7 @@ current_column (void)
                 next_element_from_display_vector does it.  */
              Lisp_Object entry = AREF (charvec, i);
 
-             if (GLYPH_CODE_P (entry)
-                 && GLYPH_CODE_CHAR_VALID_P (entry))
+             if (GLYPH_CODE_P (entry))
                c = GLYPH_CODE_CHAR (entry);
              else
                c = ' ';
@@ -464,7 +463,7 @@ current_column (void)
    in ENDPOS.
    Otherwise just return -1.  */
 static int
-check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
+check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos)
 {
   Lisp_Object val, overlay;
 
@@ -474,19 +473,27 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
     { /* FIXME: Use calc_pixel_width_or_height.  */
       Lisp_Object plist = XCDR (val), prop;
       int width = -1;
+      EMACS_INT align_to_max =
+       (col < MOST_POSITIVE_FIXNUM - INT_MAX
+        ? (EMACS_INT) INT_MAX + col
+        : MOST_POSITIVE_FIXNUM);
 
-      if ((prop = Fplist_get (plist, QCwidth), NATNUMP (prop)))
+      if ((prop = Fplist_get (plist, QCwidth),
+          RANGED_INTEGERP (0, prop, INT_MAX)))
        width = XINT (prop);
-      else if (FLOATP (prop))
+      else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop)
+              && XFLOAT_DATA (prop) <= INT_MAX)
        width = (int)(XFLOAT_DATA (prop) + 0.5);
-      else if ((prop = Fplist_get (plist, QCalign_to), NATNUMP (prop)))
+      else if ((prop = Fplist_get (plist, QCalign_to),
+               RANGED_INTEGERP (col, prop, align_to_max)))
        width = XINT (prop) - col;
-      else if (FLOATP (prop))
+      else if (FLOATP (prop) && col <= XFLOAT_DATA (prop)
+              && (XFLOAT_DATA (prop) <= align_to_max))
        width = (int)(XFLOAT_DATA (prop) + 0.5) - col;
 
       if (width >= 0)
        {
-         EMACS_INT start;
+         ptrdiff_t start;
          if (OVERLAYP (overlay))
            *endpos = OVERLAY_POSITION (OVERLAY_END (overlay));
          else
@@ -504,7 +511,7 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos)
    PREVCOL gets set to the column of the previous position (it's always
    strictly smaller than the goal column).  */
 static void
-scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
+scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol)
 {
   int tab_width = SANE_TAB_WIDTH (current_buffer);
   register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
@@ -515,13 +522,13 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
   struct window *w;
 
   /* Start the scan at the beginning of this line with column number 0.  */
-  register EMACS_INT col = 0, prev_col = 0;
+  register ptrdiff_t col = 0, prev_col = 0;
   EMACS_INT goal = goalcol ? *goalcol : MOST_POSITIVE_FIXNUM;
-  EMACS_INT end = endpos ? *endpos : PT;
-  EMACS_INT scan, scan_byte;
-  EMACS_INT next_boundary;
+  ptrdiff_t end = endpos ? *endpos : PT;
+  ptrdiff_t scan, scan_byte;
+  ptrdiff_t next_boundary;
   {
-  EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
+  ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;
   scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);
   current_column_bol_cache = PT;
   scan = PT, scan_byte = PT_BYTE;
@@ -544,7 +551,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
       /* Occasionally we may need to skip invisible text.  */
       while (scan == next_boundary)
        {
-         EMACS_INT old_scan = scan;
+         ptrdiff_t old_scan = scan;
          /* This updates NEXT_BOUNDARY to the next place
             where we might need to skip more invisible text.  */
          scan = skip_invisible (scan, &next_boundary, end, Qnil);
@@ -562,7 +569,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
       prev_col = col;
 
       { /* Check display property.  */
-       EMACS_INT endp;
+       ptrdiff_t endp;
        int width = check_display_width (scan, col, &endp);
        if (width >= 0)
          {
@@ -608,7 +615,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
          && VECTORP (DISP_CHAR_VECTOR (dp, c)))
        {
          Lisp_Object charvec;
-         EMACS_INT i, n;
+         ptrdiff_t i, n;
 
          /* This character is displayed using a vector of glyphs.
             Update the column/position based on those glyphs.  */
@@ -622,8 +629,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
                 next_element_from_display_vector does it.  */
              Lisp_Object entry = AREF (charvec, i);
 
-             if (GLYPH_CODE_P (entry)
-                 && GLYPH_CODE_CHAR_VALID_P (entry))
+             if (GLYPH_CODE_P (entry))
                c = GLYPH_CODE_CHAR (entry);
              else
                c = ' ';
@@ -698,11 +704,11 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol)
    This function handles characters that are invisible
    due to text properties or overlays.  */
 
-static EMACS_INT
+static ptrdiff_t
 current_column_1 (void)
 {
   EMACS_INT col = MOST_POSITIVE_FIXNUM;
-  EMACS_INT opoint = PT;
+  ptrdiff_t opoint = PT;
 
   scan_for_column (&opoint, &col, NULL);
   return col;
@@ -798,7 +804,7 @@ The return value is COLUMN.  */)
   (Lisp_Object column, Lisp_Object minimum)
 {
   EMACS_INT mincol;
-  register EMACS_INT fromcol;
+  register ptrdiff_t fromcol;
   int tab_width = SANE_TAB_WIDTH (current_buffer);
 
   CHECK_NUMBER (column);
@@ -845,7 +851,7 @@ following any initial whitespace.  */)
   (void)
 {
   Lisp_Object val;
-  EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
+  ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;
 
   scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1);
 
@@ -854,16 +860,16 @@ following any initial whitespace.  */)
   return val;
 }
 
-static EMACS_INT
+static ptrdiff_t
 position_indentation (ptrdiff_t pos_byte)
 {
-  register EMACS_INT column = 0;
+  register ptrdiff_t column = 0;
   int tab_width = SANE_TAB_WIDTH (current_buffer);
   register unsigned char *p;
   register unsigned char *stop;
   unsigned char *start;
-  EMACS_INT next_boundary_byte = pos_byte;
-  EMACS_INT ceiling = next_boundary_byte;
+  ptrdiff_t next_boundary_byte = pos_byte;
+  ptrdiff_t ceiling = next_boundary_byte;
 
   p = BYTE_POS_ADDR (pos_byte);
   /* STOP records the value of P at which we will need
@@ -876,7 +882,7 @@ position_indentation (ptrdiff_t pos_byte)
     {
       while (p == stop)
        {
-         EMACS_INT stop_pos_byte;
+         ptrdiff_t stop_pos_byte;
 
          /* If we have updated P, set POS_BYTE to match.
             The first time we enter the loop, POS_BYTE is already right.  */
@@ -887,8 +893,8 @@ position_indentation (ptrdiff_t pos_byte)
            return column;
          if (pos_byte == next_boundary_byte)
            {
-             EMACS_INT next_boundary;
-             EMACS_INT pos = BYTE_TO_CHAR (pos_byte);
+             ptrdiff_t next_boundary;
+             ptrdiff_t pos = BYTE_TO_CHAR (pos_byte);
              pos = skip_invisible (pos, &next_boundary, ZV, Qnil);
              pos_byte = CHAR_TO_BYTE (pos);
              next_boundary_byte = CHAR_TO_BYTE (next_boundary);
@@ -942,10 +948,10 @@ position_indentation (ptrdiff_t pos_byte)
    preceding line.  */
 
 int
-indented_beyond_p (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT column)
+indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column)
 {
-  EMACS_INT val;
-  EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
+  ptrdiff_t val;
+  ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;
 
   SET_PT_BOTH (pos, pos_byte);
   while (PT > BEGV && FETCH_BYTE (PT_BYTE) == '\n')
@@ -956,7 +962,8 @@ indented_beyond_p (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT column)
   return val >= column;
 }
 \f
-DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2, "p",
+DEFUN ("move-to-column", Fmove_to_column, Smove_to_column, 1, 2,
+       "NMove to column: ",
        doc: /* Move point to column COLUMN in the current line.
 Interactively, COLUMN is the value of prefix numeric argument.
 The column of a character is calculated by adding together the widths
@@ -976,8 +983,8 @@ COLUMN, add spaces/tabs to get there.
 The return value is the current column.  */)
   (Lisp_Object column, Lisp_Object force)
 {
-  EMACS_INT pos;
-  EMACS_INT col, prev_col;
+  ptrdiff_t pos, prev_col;
+  EMACS_INT col;
   EMACS_INT goal;
 
   CHECK_NATNUM (column);
@@ -994,13 +1001,13 @@ The return value is the current column.  */)
   if (!NILP (force) && col > goal)
     {
       int c;
-      EMACS_INT pos_byte = PT_BYTE;
+      ptrdiff_t pos_byte = PT_BYTE;
 
       DEC_POS (pos_byte);
       c = FETCH_CHAR (pos_byte);
       if (c == '\t' && prev_col < goal)
        {
-         EMACS_INT goal_pt, goal_pt_byte;
+         ptrdiff_t goal_pt, goal_pt_byte;
 
          /* Insert spaces in front of the tab to reach GOAL.  Do this
             first so that a marker at the end of the tab gets
@@ -1099,13 +1106,13 @@ static struct position val_compute_motion;
    the scroll bars if they are turned on.  */
 
 struct position *
-compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, EMACS_INT to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, EMACS_INT hscroll, EMACS_INT tab_offset, struct window *win)
+compute_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)
 {
   register EMACS_INT hpos = fromhpos;
   register EMACS_INT vpos = fromvpos;
 
-  register EMACS_INT pos;
-  EMACS_INT pos_byte;
+  register ptrdiff_t pos;
+  ptrdiff_t pos_byte;
   register int c = 0;
   int tab_width = SANE_TAB_WIDTH (current_buffer);
   register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow));
@@ -1114,38 +1121,38 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
     = (INTEGERP (BVAR (current_buffer, selective_display))
        ? XINT (BVAR (current_buffer, selective_display))
        : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
-  int selective_rlen
+  ptrdiff_t selective_rlen
     = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp))
        ? ASIZE (DISP_INVIS_VECTOR (dp)) : 0);
   /* The next location where the `invisible' property changes, or an
      overlay starts or ends.  */
-  EMACS_INT next_boundary = from;
+  ptrdiff_t next_boundary = from;
 
   /* For computing runs of characters with similar widths.
      Invariant: width_run_width is zero, or all the characters
      from width_run_start to width_run_end have a fixed width of
      width_run_width.  */
-  EMACS_INT width_run_start = from;
-  EMACS_INT width_run_end   = from;
-  EMACS_INT width_run_width = 0;
+  ptrdiff_t width_run_start = from;
+  ptrdiff_t width_run_end   = from;
+  ptrdiff_t width_run_width = 0;
   Lisp_Object *width_table;
   Lisp_Object buffer;
 
   /* The next buffer pos where we should consult the width run cache. */
-  EMACS_INT next_width_run = from;
+  ptrdiff_t next_width_run = from;
   Lisp_Object window;
 
   int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   /* If previous char scanned was a wide character,
      this is the column where it ended.  Otherwise, this is 0.  */
   EMACS_INT wide_column_end_hpos = 0;
-  EMACS_INT prev_pos;          /* Previous buffer position.  */
-  EMACS_INT prev_pos_byte;     /* Previous buffer position.  */
+  ptrdiff_t prev_pos;          /* Previous buffer position.  */
+  ptrdiff_t prev_pos_byte;     /* Previous buffer position.  */
   EMACS_INT prev_hpos = 0;
   EMACS_INT prev_vpos = 0;
   EMACS_INT contin_hpos;       /* HPOS of last column of continued line.  */
-  EMACS_INT prev_tab_offset;   /* Previous tab offset.  */
-  EMACS_INT continuation_glyph_width;
+  int prev_tab_offset;         /* Previous tab offset.  */
+  int continuation_glyph_width;
 
   struct composition_it cmp_it;
 
@@ -1194,8 +1201,8 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
     {
       while (pos == next_boundary)
        {
-         EMACS_INT pos_here = pos;
-         EMACS_INT newpos;
+         ptrdiff_t pos_here = pos;
+         ptrdiff_t newpos;
 
          /* Don't skip invisible if we are already at the margin.  */
          if (vpos > tovpos || (vpos == tovpos && hpos >= tohpos))
@@ -1229,7 +1236,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
               to be changed here.  */
            {
              unsigned char *ovstr;
-             EMACS_INT ovlen = overlay_strings (pos, win, &ovstr);
+             ptrdiff_t ovlen = overlay_strings (pos, win, &ovstr);
              hpos += ((multibyte && ovlen > 0)
                       ? strwidth ((char *) ovstr, ovlen) : ovlen);
            }
@@ -1304,7 +1311,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
 
       if (hpos > width)
        {
-         int total_width = width + continuation_glyph_width;
+         EMACS_INT total_width = width + continuation_glyph_width;
          int truncate = 0;
 
          if (!NILP (Vtruncate_partial_width_windows)
@@ -1434,7 +1441,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
              want to skip over it for some other reason.  */
           if (common_width != 0)
             {
-              EMACS_INT run_end_hpos;
+              ptrdiff_t run_end_hpos;
 
               /* Don't go past the final buffer posn the user
                  requested.  */
@@ -1474,7 +1481,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
       /* We have to scan the text character-by-character.  */
       else
        {
-         EMACS_INT i, n;
+         ptrdiff_t i, n;
          Lisp_Object charvec;
 
          /* Check composition sequence.  */
@@ -1551,8 +1558,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
                     next_element_from_display_vector does it.  */
                  Lisp_Object entry = AREF (charvec, i);
 
-                 if (GLYPH_CODE_P (entry)
-                     && GLYPH_CODE_CHAR_VALID_P (entry))
+                 if (GLYPH_CODE_P (entry))
                    c = GLYPH_CODE_CHAR (entry);
                  else
                    c = ' ';
@@ -1675,8 +1681,6 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_
     val_compute_motion.prevhpos = contin_hpos;
   else
     val_compute_motion.prevhpos = prev_hpos;
-  /* We always handle all of them here; none of them remain to do.  */
-  val_compute_motion.ovstring_chars_done = 0;
 
   /* Nonzero if have just continued a line */
   val_compute_motion.contin = (contin_hpos && prev_hpos == 0);
@@ -1733,7 +1737,8 @@ visible section of the buffer, and pass LINE and COL as TOPOS.  */)
   struct window *w;
   Lisp_Object bufpos, hpos, vpos, prevhpos;
   struct position *pos;
-  EMACS_INT hscroll, tab_offset;
+  ptrdiff_t hscroll;
+  int tab_offset;
 
   CHECK_NUMBER_COERCE_MARKER (from);
   CHECK_CONS (frompos);
@@ -1754,6 +1759,9 @@ visible section of the buffer, and pass LINE and COL as TOPOS.  */)
       CHECK_CONS (offsets);
       CHECK_NUMBER_CAR (offsets);
       CHECK_NUMBER_CDR (offsets);
+      if (! (0 <= XINT (XCAR (offsets)) && XINT (XCAR (offsets)) <= PTRDIFF_MAX
+            && 0 <= XINT (XCDR (offsets)) && XINT (XCDR (offsets)) <= INT_MAX))
+       args_out_of_range (XCAR (offsets), XCDR (offsets));
       hscroll = XINT (XCAR (offsets));
       tab_offset = XINT (XCDR (offsets));
     }
@@ -1807,22 +1815,22 @@ visible section of the buffer, and pass LINE and COL as TOPOS.  */)
 static struct position val_vmotion;
 
 struct position *
-vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
+vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w)
 {
-  EMACS_INT hscroll = XINT (w->hscroll);
+  ptrdiff_t hscroll = w->hscroll;
   struct position pos;
   /* vpos is cumulative vertical position, changed as from is changed */
-  register int vpos = 0;
-  EMACS_INT prevline;
-  register EMACS_INT first;
-  EMACS_INT from_byte;
-  EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0;
-  EMACS_INT selective
+  register EMACS_INT vpos = 0;
+  ptrdiff_t prevline;
+  register ptrdiff_t first;
+  ptrdiff_t from_byte;
+  ptrdiff_t lmargin = hscroll > 0 ? 1 - hscroll : 0;
+  ptrdiff_t selective
     = (INTEGERP (BVAR (current_buffer, selective_display))
-       ? XINT (BVAR (current_buffer, selective_display))
+       ? clip_to_bounds (-1, XINT (BVAR (current_buffer, selective_display)),
+                        PTRDIFF_MAX)
        : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0);
   Lisp_Object window;
-  EMACS_INT start_hpos = 0;
   int did_motion;
   /* This is the object we use for fetching character properties.  */
   Lisp_Object text_prop_object;
@@ -1861,7 +1869,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
                         TEXT_PROP_MEANS_INVISIBLE (propval))))
            prevline = find_next_newline_no_quit (prevline - 1, -1);
          pos = *compute_motion (prevline, 0,
-                                lmargin + (prevline == BEG ? start_hpos : 0),
+                                lmargin,
                                 0,
                                 from,
                                 /* Don't care for VPOS...  */
@@ -1869,10 +1877,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
                                 /* ... nor HPOS.  */
                                 1 << (BITS_PER_SHORT - 1),
                                 -1, hscroll,
-                                /* This compensates for start_hpos
-                                   so that a tab as first character
-                                   still occupies 8 columns.  */
-                                (prevline == BEG ? -start_hpos : 0),
+                                0,
                                 w);
          vpos -= pos.vpos;
          first = 0;
@@ -1890,8 +1895,6 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
          val_vmotion.hpos = lmargin;
          val_vmotion.contin = 0;
          val_vmotion.prevhpos = 0;
-         val_vmotion.ovstring_chars_done = 0;
-         val_vmotion.tab_offset = 0; /* For accumulating tab offset.  */
          return &val_vmotion;
        }
 
@@ -1918,8 +1921,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
                     TEXT_PROP_MEANS_INVISIBLE (propval))))
        prevline = find_next_newline_no_quit (prevline - 1, -1);
       pos = *compute_motion (prevline, 0,
-                            lmargin + (prevline == BEG
-                                       ? start_hpos : 0),
+                            lmargin,
                             0,
                             from,
                             /* Don't care for VPOS...  */
@@ -1927,21 +1929,20 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w)
                             /* ... nor HPOS.  */
                             1 << (BITS_PER_SHORT - 1),
                             -1, hscroll,
-                            (prevline == BEG ? -start_hpos : 0),
+                            0,
                             w);
       did_motion = 1;
     }
   else
     {
-      pos.hpos = lmargin + (from == BEG ? start_hpos : 0);
+      pos.hpos = lmargin;
       pos.vpos = 0;
-      pos.tab_offset = 0;
       did_motion = 0;
     }
   return compute_motion (from, vpos, pos.hpos, did_motion,
                         ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)),
                         -1, hscroll,
-                        pos.tab_offset - (from == BEG ? start_hpos : 0),
+                        0,
                         w);
 }
 
@@ -2018,9 +2019,10 @@ whether or not it is currently displayed in some window.  */)
     }
   else
     {
-      EMACS_INT it_start;
-      int first_x, it_overshoot_count = 0;
+      ptrdiff_t it_start, it_overshoot_count = 0;
+      int first_x;
       int overshoot_handled = 0;
+      int disp_string_at_start_p = 0;
 
       itdata = bidi_shelve_cache ();
       SET_TEXT_POS (pt, PT, PT_BYTE);
@@ -2035,6 +2037,8 @@ whether or not it is currently displayed in some window.  */)
        {
          const char *s = SSDATA (it.string);
          const char *e = s + SBYTES (it.string);
+
+         disp_string_at_start_p = it.string_from_display_prop_p;
          while (s < e)
            {
              if (*s++ == '\n')
@@ -2062,7 +2066,8 @@ whether or not it is currently displayed in some window.  */)
       /* IT may move too far if truncate-lines is on and PT lies
         beyond the right margin.  IT may also move too far if the
         starting point is on a Lisp string that has embedded
-        newlines.  In these cases, backtrack.  */
+        newlines, or spans several screen lines.  In these cases,
+        backtrack.  */
       if (IT_CHARPOS (it) > it_start)
        {
          /* We need to backtrack also if the Lisp string contains no
@@ -2073,6 +2078,14 @@ whether or not it is currently displayed in some window.  */)
              && it.method == GET_FROM_BUFFER
              && it.c == '\n')
            it_overshoot_count = 1;
+         else if (disp_string_at_start_p && it.vpos > 0)
+           {
+             /* This is the case of a display string that spans
+                several screen lines.  In that case, we end up at the
+                end of the string, and it.vpos tells us how many
+                screen lines we need to backtrack.  */
+             it_overshoot_count = it.vpos;
+           }
          if (it_overshoot_count > 0)
            move_it_by_lines (&it, -it_overshoot_count);
 
@@ -2084,12 +2097,12 @@ whether or not it is currently displayed in some window.  */)
          /* Do this even if LINES is 0, so that we move back to the
             beginning of the current line as we ought.  */
          if (XINT (lines) == 0 || IT_CHARPOS (it) > 0)
-           move_it_by_lines (&it, max (INT_MIN, XINT (lines)));
+           move_it_by_lines (&it, max (PTRDIFF_MIN, XINT (lines)));
        }
       else if (overshoot_handled)
        {
          it.vpos = 0;
-         move_it_by_lines (&it, min (INT_MAX, XINT (lines)));
+         move_it_by_lines (&it, min (PTRDIFF_MAX, XINT (lines)));
        }
       else
        {
@@ -2105,12 +2118,12 @@ whether or not it is currently displayed in some window.  */)
                  move_it_by_lines (&it, 1);
                }
              if (XINT (lines) > 1)
-               move_it_by_lines (&it, min (INT_MAX, XINT (lines) - 1));
+               move_it_by_lines (&it, min (PTRDIFF_MAX, XINT (lines) - 1));
            }
          else
            {
              it.vpos = 0;
-             move_it_by_lines (&it, min (INT_MAX, XINT (lines)));
+             move_it_by_lines (&it, min (PTRDIFF_MAX, XINT (lines)));
            }
        }
 
@@ -2151,7 +2164,7 @@ void
 syms_of_indent (void)
 {
   DEFVAR_BOOL ("indent-tabs-mode", indent_tabs_mode,
-              doc: /* *Indentation can insert tabs if this is non-nil.  */);
+              doc: /* Indentation can insert tabs if this is non-nil.  */);
   indent_tabs_mode = 1;
 
   defsubr (&Scurrent_indentation);
index c5114b812c8598a94ec963b64f72be6a8b10aaee..e198137a756cdad9490a30ffd4bf3dca4d34b75d 100644 (file)
@@ -16,51 +16,29 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* We introduce new member `tab_offset'.  We need it because of the
-   existence of wide-column characters.  There is a case that the
-   line-break occurs at a wide-column character and the number of
-   columns of the line gets less than width.
-
-   Example (where W_ stands for a wide-column character):
-            ----------
-            abcdefgh\\
-            W_
-            ----------
-
-   To handle this case, we should not calculate the tab offset by
-       tab_offset += width;
-
-   Instead, we must remember tab_offset of the line.
-
- */
-
 struct position
   {
-    EMACS_INT bufpos;
-    EMACS_INT bytepos;
+    ptrdiff_t bufpos;
+    ptrdiff_t bytepos;
     EMACS_INT hpos;
     EMACS_INT vpos;
     EMACS_INT prevhpos;
-    EMACS_INT contin;
-    /* Number of characters we have already handled
-       from the before and after strings at this position.  */
-    EMACS_INT ovstring_chars_done;
-    EMACS_INT tab_offset;
+    int contin;
   };
 
-struct position *compute_motion (EMACS_INT from, EMACS_INT fromvpos,
+struct position *compute_motion (ptrdiff_t from, EMACS_INT fromvpos,
                                  EMACS_INT fromhpos, int did_motion,
-                                 EMACS_INT to, EMACS_INT tovpos,
+                                 ptrdiff_t to, EMACS_INT tovpos,
                                  EMACS_INT tohpos,
-                                 EMACS_INT width, EMACS_INT hscroll,
-                                 EMACS_INT tab_offset, struct window *);
-struct position *vmotion (EMACS_INT from, EMACS_INT vtarget,
+                                 EMACS_INT width, ptrdiff_t hscroll,
+                                 int tab_offset, struct window *);
+struct position *vmotion (ptrdiff_t from, EMACS_INT vtarget,
                           struct window *);
-EMACS_INT skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p,
-                          EMACS_INT to, Lisp_Object window);
+ptrdiff_t skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p,
+                          ptrdiff_t to, Lisp_Object window);
 
 /* Value of point when current_column was called */
-extern EMACS_INT last_known_column_point;
+extern ptrdiff_t last_known_column_point;
 
 /* Functions for dealing with the column cache.  */
 
index 34d82fa017d8e61c86aa18c478fa881fbd20b3fa..2074916cfdeb7774128df90c28bbae1ed258a301 100644 (file)
@@ -25,27 +25,21 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "intervals.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "window.h"
 #include "blockinput.h"
 #include "region-cache.h"
 
-#ifndef NULL
-#define NULL 0
-#endif
-
 static void insert_from_string_1 (Lisp_Object string,
-                                 EMACS_INT pos, EMACS_INT pos_byte,
-                                 EMACS_INT nchars, EMACS_INT nbytes,
+                                 ptrdiff_t pos, ptrdiff_t pos_byte,
+                                 ptrdiff_t nchars, ptrdiff_t nbytes,
                                  int inherit, int before_markers);
 static void insert_from_buffer_1 (struct buffer *buf,
-                                 EMACS_INT from, EMACS_INT nchars,
+                                 ptrdiff_t from, ptrdiff_t nchars,
                                  int inherit);
-static void gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap);
-static void gap_right (EMACS_INT charpos, EMACS_INT bytepos);
-
-static Lisp_Object Fcombine_after_change_execute (void);
+static void gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap);
+static void gap_right (ptrdiff_t charpos, ptrdiff_t bytepos);
 
 /* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT)
    describing changes which happened while combine_after_change_calls
@@ -64,7 +58,7 @@ static Lisp_Object combine_after_change_buffer;
 
 Lisp_Object Qinhibit_modification_hooks;
 
-static void signal_before_change (EMACS_INT, EMACS_INT, EMACS_INT *);
+static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
 \f
 #define CHECK_MARKERS()                                \
   do                                           \
@@ -97,7 +91,7 @@ check_markers (void)
    Note that this can quit!  */
 
 void
-move_gap (EMACS_INT charpos)
+move_gap (ptrdiff_t charpos)
 {
   move_gap_both (charpos, charpos_to_bytepos (charpos));
 }
@@ -106,7 +100,7 @@ move_gap (EMACS_INT charpos)
    Note that this can quit!  */
 
 void
-move_gap_both (EMACS_INT charpos, EMACS_INT bytepos)
+move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   if (bytepos < GPT_BYTE)
     gap_left (charpos, bytepos, 0);
@@ -120,11 +114,11 @@ move_gap_both (EMACS_INT charpos, EMACS_INT bytepos)
    If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged.  */
 
 static void
-gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap)
+gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap)
 {
   register unsigned char *to, *from;
-  register EMACS_INT i;
-  EMACS_INT new_s1;
+  register ptrdiff_t i;
+  ptrdiff_t new_s1;
 
   if (!newgap)
     BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT);
@@ -175,11 +169,11 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap)
    and CHARPOS is the corresponding char position.  */
 
 static void
-gap_right (EMACS_INT charpos, EMACS_INT bytepos)
+gap_right (ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   register unsigned char *to, *from;
-  register EMACS_INT i;
-  EMACS_INT new_s1;
+  register ptrdiff_t i;
+  ptrdiff_t new_s1;
 
   BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT);
 
@@ -229,12 +223,12 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos)
    or inside of the range being deleted.  */
 
 void
-adjust_markers_for_delete (EMACS_INT from, EMACS_INT from_byte,
-                          EMACS_INT to, EMACS_INT to_byte)
+adjust_markers_for_delete (ptrdiff_t from, ptrdiff_t from_byte,
+                          ptrdiff_t to, ptrdiff_t to_byte)
 {
   Lisp_Object marker;
   register struct Lisp_Marker *m;
-  register EMACS_INT charpos;
+  register ptrdiff_t charpos;
 
   for (m = BUF_MARKERS (current_buffer); m; m = m->next)
     {
@@ -294,13 +288,13 @@ adjust_markers_for_delete (EMACS_INT from, EMACS_INT from_byte,
    or BEFORE_MARKERS is true.  */
 
 static void
-adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte,
-                          EMACS_INT to, EMACS_INT to_byte, int before_markers)
+adjust_markers_for_insert (ptrdiff_t from, ptrdiff_t from_byte,
+                          ptrdiff_t to, ptrdiff_t to_byte, int before_markers)
 {
   struct Lisp_Marker *m;
   int adjusted = 0;
-  EMACS_INT nchars = to - from;
-  EMACS_INT nbytes = to_byte - from_byte;
+  ptrdiff_t nchars = to - from;
+  ptrdiff_t nbytes = to_byte - from_byte;
 
   for (m = BUF_MARKERS (current_buffer); m; m = m->next)
     {
@@ -345,7 +339,7 @@ adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte,
    intervals.  */
 
 static void
-adjust_point (EMACS_INT nchars, EMACS_INT nbytes)
+adjust_point (ptrdiff_t nchars, ptrdiff_t nbytes)
 {
   SET_BUF_PT_BOTH (current_buffer, PT + nchars, PT_BYTE + nbytes);
   /* In a single-byte buffer, the two positions must be equal.  */
@@ -358,14 +352,14 @@ adjust_point (EMACS_INT nchars, EMACS_INT nbytes)
    an insertion.  */
 
 static void
-adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte,
-                           EMACS_INT old_chars, EMACS_INT old_bytes,
-                           EMACS_INT new_chars, EMACS_INT new_bytes)
+adjust_markers_for_replace (ptrdiff_t from, ptrdiff_t from_byte,
+                           ptrdiff_t old_chars, ptrdiff_t old_bytes,
+                           ptrdiff_t new_chars, ptrdiff_t new_bytes)
 {
   register struct Lisp_Marker *m;
-  EMACS_INT prev_to_byte = from_byte + old_bytes;
-  EMACS_INT diff_chars = new_chars - old_chars;
-  EMACS_INT diff_bytes = new_bytes - old_bytes;
+  ptrdiff_t prev_to_byte = from_byte + old_bytes;
+  ptrdiff_t diff_chars = new_chars - old_chars;
+  ptrdiff_t diff_bytes = new_bytes - old_bytes;
 
   for (m = BUF_MARKERS (current_buffer); m; m = m->next)
     {
@@ -394,13 +388,13 @@ buffer_overflow (void)
 /* Make the gap NBYTES_ADDED bytes longer.  */
 
 static void
-make_gap_larger (EMACS_INT nbytes_added)
+make_gap_larger (ptrdiff_t nbytes_added)
 {
   Lisp_Object tem;
-  EMACS_INT real_gap_loc;
-  EMACS_INT real_gap_loc_byte;
-  EMACS_INT old_gap_size;
-  EMACS_INT current_size = Z_BYTE - BEG_BYTE + GAP_SIZE;
+  ptrdiff_t real_gap_loc;
+  ptrdiff_t real_gap_loc_byte;
+  ptrdiff_t old_gap_size;
+  ptrdiff_t current_size = Z_BYTE - BEG_BYTE + GAP_SIZE;
   enum { enough_for_a_while = 2000 };
 
   if (BUF_BYTES_MAX - current_size < nbytes_added)
@@ -446,15 +440,15 @@ make_gap_larger (EMACS_INT nbytes_added)
 /* Make the gap NBYTES_REMOVED bytes shorter.  */
 
 static void
-make_gap_smaller (EMACS_INT nbytes_removed)
+make_gap_smaller (ptrdiff_t nbytes_removed)
 {
   Lisp_Object tem;
-  EMACS_INT real_gap_loc;
-  EMACS_INT real_gap_loc_byte;
-  EMACS_INT real_Z;
-  EMACS_INT real_Z_byte;
-  EMACS_INT real_beg_unchanged;
-  EMACS_INT new_gap_size;
+  ptrdiff_t real_gap_loc;
+  ptrdiff_t real_gap_loc_byte;
+  ptrdiff_t real_Z;
+  ptrdiff_t real_Z_byte;
+  ptrdiff_t real_beg_unchanged;
+  ptrdiff_t new_gap_size;
 
   /* Make sure the gap is at least 20 bytes.  */
   if (GAP_SIZE - nbytes_removed < 20)
@@ -504,7 +498,7 @@ make_gap_smaller (EMACS_INT nbytes_removed)
 #endif /* USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC */
 
 void
-make_gap (EMACS_INT nbytes_added)
+make_gap (ptrdiff_t nbytes_added)
 {
   if (nbytes_added >= 0)
     make_gap_larger (nbytes_added);
@@ -521,9 +515,9 @@ make_gap (EMACS_INT nbytes_added)
 
    Return the number of bytes stored at TO_ADDR.  */
 
-EMACS_INT
+ptrdiff_t
 copy_text (const unsigned char *from_addr, unsigned char *to_addr,
-          EMACS_INT nbytes, int from_multibyte, int to_multibyte)
+          ptrdiff_t nbytes, int from_multibyte, int to_multibyte)
 {
   if (from_multibyte == to_multibyte)
     {
@@ -532,8 +526,8 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
     }
   else if (from_multibyte)
     {
-      EMACS_INT nchars = 0;
-      EMACS_INT bytes_left = nbytes;
+      ptrdiff_t nchars = 0;
+      ptrdiff_t bytes_left = nbytes;
 
       while (bytes_left > 0)
        {
@@ -580,11 +574,11 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr,
    prepare_to_modify_buffer could relocate the text.  */
 
 void
-insert (const char *string, EMACS_INT nbytes)
+insert (const char *string, ptrdiff_t nbytes)
 {
   if (nbytes > 0)
     {
-      EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
+      ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint;
       insert_1_both (string, len, nbytes, 0, 1, 0);
       opoint = PT - len;
       signal_after_change (opoint, 0, len);
@@ -595,11 +589,11 @@ insert (const char *string, EMACS_INT nbytes)
 /* Likewise, but inherit text properties from neighboring characters.  */
 
 void
-insert_and_inherit (const char *string, EMACS_INT nbytes)
+insert_and_inherit (const char *string, ptrdiff_t nbytes)
 {
   if (nbytes > 0)
     {
-      EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
+      ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint;
       insert_1_both (string, len, nbytes, 1, 1, 0);
       opoint = PT - len;
       signal_after_change (opoint, 0, len);
@@ -640,11 +634,11 @@ insert_string (const char *s)
    since gc could happen and relocate it.  */
 
 void
-insert_before_markers (const char *string, EMACS_INT nbytes)
+insert_before_markers (const char *string, ptrdiff_t nbytes)
 {
   if (nbytes > 0)
     {
-      EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
+      ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint;
       insert_1_both (string, len, nbytes, 0, 1, 1);
       opoint = PT - len;
       signal_after_change (opoint, 0, len);
@@ -656,11 +650,11 @@ insert_before_markers (const char *string, EMACS_INT nbytes)
 
 void
 insert_before_markers_and_inherit (const char *string,
-                                  EMACS_INT nbytes)
+                                  ptrdiff_t nbytes)
 {
   if (nbytes > 0)
     {
-      EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint;
+      ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint;
       insert_1_both (string, len, nbytes, 1, 1, 1);
       opoint = PT - len;
       signal_after_change (opoint, 0, len);
@@ -671,7 +665,7 @@ insert_before_markers_and_inherit (const char *string,
 /* Subroutine used by the insert functions above.  */
 
 void
-insert_1 (const char *string, EMACS_INT nbytes,
+insert_1 (const char *string, ptrdiff_t nbytes,
          int inherit, int prepare, int before_markers)
 {
   insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes),
@@ -687,8 +681,8 @@ insert_1 (const char *string, EMACS_INT nbytes,
    which combine in this way.  Otherwise, return 0.  */
 
 int
-count_combining_before (const unsigned char *string, EMACS_INT length,
-                       EMACS_INT pos, EMACS_INT pos_byte)
+count_combining_before (const unsigned char *string, ptrdiff_t length,
+                       ptrdiff_t pos, ptrdiff_t pos_byte)
 {
   int len, combining_bytes;
   const unsigned char *p;
@@ -733,11 +727,11 @@ count_combining_before (const unsigned char *string, EMACS_INT length,
 
 int
 count_combining_after (const unsigned char *string,
-                      EMACS_INT length, EMACS_INT pos, EMACS_INT pos_byte)
+                      ptrdiff_t length, ptrdiff_t pos, ptrdiff_t pos_byte)
 {
-  EMACS_INT opos_byte = pos_byte;
-  EMACS_INT i;
-  EMACS_INT bytes;
+  ptrdiff_t opos_byte = pos_byte;
+  ptrdiff_t i;
+  ptrdiff_t bytes;
   unsigned char *bufp;
 
   if (NILP (current_buffer->enable_multibyte_characters))
@@ -797,7 +791,7 @@ count_combining_after (const unsigned char *string,
 
 void
 insert_1_both (const char *string,
-              EMACS_INT nchars, EMACS_INT nbytes,
+              ptrdiff_t nchars, ptrdiff_t nbytes,
               int inherit, int prepare, int before_markers)
 {
   if (nchars == 0)
@@ -875,10 +869,10 @@ insert_1_both (const char *string,
    without insert noticing.  */
 
 void
-insert_from_string (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
-                   EMACS_INT length, EMACS_INT length_byte, int inherit)
+insert_from_string (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
+                   ptrdiff_t length, ptrdiff_t length_byte, int inherit)
 {
-  EMACS_INT opoint = PT;
+  ptrdiff_t opoint = PT;
 
   if (SCHARS (string) == 0)
     return;
@@ -894,11 +888,11 @@ insert_from_string (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
 
 void
 insert_from_string_before_markers (Lisp_Object string,
-                                  EMACS_INT pos, EMACS_INT pos_byte,
-                                  EMACS_INT length, EMACS_INT length_byte,
+                                  ptrdiff_t pos, ptrdiff_t pos_byte,
+                                  ptrdiff_t length, ptrdiff_t length_byte,
                                   int inherit)
 {
-  EMACS_INT opoint = PT;
+  ptrdiff_t opoint = PT;
 
   if (SCHARS (string) == 0)
     return;
@@ -912,12 +906,12 @@ insert_from_string_before_markers (Lisp_Object string,
 /* Subroutine of the insertion functions above.  */
 
 static void
-insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
-                     EMACS_INT nchars, EMACS_INT nbytes,
+insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
+                     ptrdiff_t nchars, ptrdiff_t nbytes,
                      int inherit, int before_markers)
 {
   struct gcpro gcpro1;
-  EMACS_INT outgoing_nbytes = nbytes;
+  ptrdiff_t outgoing_nbytes = nbytes;
   INTERVAL intervals;
 
   /* Make OUTGOING_NBYTES describe the text
@@ -1004,7 +998,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
    starting at GPT_ADDR.  */
 
 void
-insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
+insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes)
 {
   if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
     nchars = nbytes;
@@ -1050,9 +1044,9 @@ insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes)
 
 void
 insert_from_buffer (struct buffer *buf,
-                   EMACS_INT charpos, EMACS_INT nchars, int inherit)
+                   ptrdiff_t charpos, ptrdiff_t nchars, int inherit)
 {
-  EMACS_INT opoint = PT;
+  ptrdiff_t opoint = PT;
 
   insert_from_buffer_1 (buf, charpos, nchars, inherit);
   signal_after_change (opoint, 0, PT - opoint);
@@ -1061,13 +1055,13 @@ insert_from_buffer (struct buffer *buf,
 
 static void
 insert_from_buffer_1 (struct buffer *buf,
-                     EMACS_INT from, EMACS_INT nchars, int inherit)
+                     ptrdiff_t from, ptrdiff_t nchars, int inherit)
 {
-  EMACS_INT chunk, chunk_expanded;
-  EMACS_INT from_byte = buf_charpos_to_bytepos (buf, from);
-  EMACS_INT to_byte = buf_charpos_to_bytepos (buf, from + nchars);
-  EMACS_INT incoming_nbytes = to_byte - from_byte;
-  EMACS_INT outgoing_nbytes = incoming_nbytes;
+  ptrdiff_t chunk, chunk_expanded;
+  ptrdiff_t from_byte = buf_charpos_to_bytepos (buf, from);
+  ptrdiff_t to_byte = buf_charpos_to_bytepos (buf, from + nchars);
+  ptrdiff_t incoming_nbytes = to_byte - from_byte;
+  ptrdiff_t outgoing_nbytes = incoming_nbytes;
   INTERVAL intervals;
 
   /* Make OUTGOING_NBYTES describe the text
@@ -1077,8 +1071,8 @@ insert_from_buffer_1 (struct buffer *buf,
     outgoing_nbytes = nchars;
   else if (NILP (BVAR (buf, enable_multibyte_characters)))
     {
-      EMACS_INT outgoing_before_gap = 0;
-      EMACS_INT outgoing_after_gap = 0;
+      ptrdiff_t outgoing_before_gap = 0;
+      ptrdiff_t outgoing_after_gap = 0;
 
       if (from < BUF_GPT (buf))
        {
@@ -1195,10 +1189,10 @@ insert_from_buffer_1 (struct buffer *buf,
    PREV_TEXT nil means the new text was just inserted.  */
 
 static void
-adjust_after_replace (EMACS_INT from, EMACS_INT from_byte,
-                     Lisp_Object prev_text, EMACS_INT len, EMACS_INT len_byte)
+adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
+                     Lisp_Object prev_text, ptrdiff_t len, ptrdiff_t len_byte)
 {
-  EMACS_INT nchars_del = 0, nbytes_del = 0;
+  ptrdiff_t nchars_del = 0, nbytes_del = 0;
 
 #ifdef BYTE_COMBINING_DEBUG
   if (count_combining_before (GPT_ADDR, len_byte, from, from_byte)
@@ -1263,10 +1257,10 @@ adjust_after_replace (EMACS_INT from, EMACS_INT from_byte,
    - FROM) may be incorrect, the correct length is NEWLEN.  */
 
 void
-adjust_after_insert (EMACS_INT from, EMACS_INT from_byte,
-                    EMACS_INT to, EMACS_INT to_byte, EMACS_INT newlen)
+adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte,
+                    ptrdiff_t to, ptrdiff_t to_byte, ptrdiff_t newlen)
 {
-  EMACS_INT len = to - from, len_byte = to_byte - from_byte;
+  ptrdiff_t len = to - from, len_byte = to_byte - from_byte;
 
   if (GPT != to)
     move_gap_both (to, to_byte);
@@ -1290,16 +1284,16 @@ adjust_after_insert (EMACS_INT from, EMACS_INT from_byte,
    But if MARKERS is 0, don't relocate markers.  */
 
 void
-replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
+replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new,
               int prepare, int inherit, int markers)
 {
-  EMACS_INT inschars = SCHARS (new);
-  EMACS_INT insbytes = SBYTES (new);
-  EMACS_INT from_byte, to_byte;
-  EMACS_INT nbytes_del, nchars_del;
+  ptrdiff_t inschars = SCHARS (new);
+  ptrdiff_t insbytes = SBYTES (new);
+  ptrdiff_t from_byte, to_byte;
+  ptrdiff_t nbytes_del, nchars_del;
   struct gcpro gcpro1;
   INTERVAL intervals;
-  EMACS_INT outgoing_insbytes = insbytes;
+  ptrdiff_t outgoing_insbytes = insbytes;
   Lisp_Object deletion;
 
   CHECK_MARKERS ();
@@ -1309,7 +1303,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
 
   if (prepare)
     {
-      EMACS_INT range_length = to - from;
+      ptrdiff_t range_length = to - from;
       prepare_to_modify_buffer (from, to, &from);
       to = from + range_length;
     }
@@ -1464,12 +1458,12 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new,
    prepare_to_modify_buffer and never call signal_after_change.  */
 
 void
-replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
-                EMACS_INT to, EMACS_INT to_byte,
-                const char *ins, EMACS_INT inschars, EMACS_INT insbytes,
+replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
+                ptrdiff_t to, ptrdiff_t to_byte,
+                const char *ins, ptrdiff_t inschars, ptrdiff_t insbytes,
                 int markers)
 {
-  EMACS_INT nbytes_del, nchars_del;
+  ptrdiff_t nbytes_del, nchars_del;
 
   CHECK_MARKERS ();
 
@@ -1571,7 +1565,7 @@ replace_range_2 (EMACS_INT from, EMACS_INT from_byte,
    If TO comes before FROM, we delete nothing.  */
 
 void
-del_range (EMACS_INT from, EMACS_INT to)
+del_range (ptrdiff_t from, ptrdiff_t to)
 {
   del_range_1 (from, to, 1, 0);
 }
@@ -1580,9 +1574,9 @@ del_range (EMACS_INT from, EMACS_INT to)
    RET_STRING says to return the deleted text. */
 
 Lisp_Object
-del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string)
+del_range_1 (ptrdiff_t from, ptrdiff_t to, int prepare, int ret_string)
 {
-  EMACS_INT from_byte, to_byte;
+  ptrdiff_t from_byte, to_byte;
   Lisp_Object deletion;
   struct gcpro gcpro1;
 
@@ -1597,7 +1591,7 @@ del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string)
 
   if (prepare)
     {
-      EMACS_INT range_length = to - from;
+      ptrdiff_t range_length = to - from;
       prepare_to_modify_buffer (from, to, &from);
       to = min (ZV, from + range_length);
     }
@@ -1616,9 +1610,9 @@ del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string)
 /* Like del_range_1 but args are byte positions, not char positions.  */
 
 void
-del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare)
+del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, int prepare)
 {
-  EMACS_INT from, to;
+  ptrdiff_t from, to;
 
   /* Make args be valid */
   if (from_byte < BEGV_BYTE)
@@ -1634,8 +1628,8 @@ del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare)
 
   if (prepare)
     {
-      EMACS_INT old_from = from, old_to = Z - to;
-      EMACS_INT range_length = to - from;
+      ptrdiff_t old_from = from, old_to = Z - to;
+      ptrdiff_t range_length = to - from;
       prepare_to_modify_buffer (from, to, &from);
       to = from + range_length;
 
@@ -1659,8 +1653,8 @@ del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare)
    and bytepos.  */
 
 void
-del_range_both (EMACS_INT from, EMACS_INT from_byte,
-               EMACS_INT to, EMACS_INT to_byte, int prepare)
+del_range_both (ptrdiff_t from, ptrdiff_t from_byte,
+               ptrdiff_t to, ptrdiff_t to_byte, int prepare)
 {
   /* Make args be valid */
   if (from_byte < BEGV_BYTE)
@@ -1678,8 +1672,8 @@ del_range_both (EMACS_INT from, EMACS_INT from_byte,
 
   if (prepare)
     {
-      EMACS_INT old_from = from, old_to = Z - to;
-      EMACS_INT range_length = to - from;
+      ptrdiff_t old_from = from, old_to = Z - to;
+      ptrdiff_t range_length = to - from;
       prepare_to_modify_buffer (from, to, &from);
       to = from + range_length;
 
@@ -1705,10 +1699,10 @@ del_range_both (EMACS_INT from, EMACS_INT from_byte,
    If RET_STRING is true, the deleted area is returned as a string. */
 
 Lisp_Object
-del_range_2 (EMACS_INT from, EMACS_INT from_byte,
-            EMACS_INT to, EMACS_INT to_byte, int ret_string)
+del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
+            ptrdiff_t to, ptrdiff_t to_byte, int ret_string)
 {
-  register EMACS_INT nbytes_del, nchars_del;
+  register ptrdiff_t nbytes_del, nchars_del;
   Lisp_Object deletion;
 
   CHECK_MARKERS ();
@@ -1792,7 +1786,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte,
    Otherwise set CHARS_MODIFF to the new value of MODIFF.  */
 
 void
-modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end,
+modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
               int preserve_chars_modiff)
 {
   struct buffer *old_buffer = current_buffer;
@@ -1827,8 +1821,8 @@ modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end,
    by holding its value temporarily in a marker.  */
 
 void
-prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
-                         EMACS_INT *preserve_ptr)
+prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end,
+                         ptrdiff_t *preserve_ptr)
 {
   struct buffer *base_buffer;
 
@@ -1889,8 +1883,8 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end,
          : (!NILP (Vselect_active_regions)
             && !NILP (Vtransient_mark_mode))))
     {
-      EMACS_INT b = XMARKER (BVAR (current_buffer, mark))->charpos;
-      EMACS_INT e = PT;
+      ptrdiff_t b = XMARKER (BVAR (current_buffer, mark))->charpos;
+      ptrdiff_t e = PT;
       if (b < e)
        Vsaved_region_selection = make_buffer_string (b, e, 0);
       else if (b > e)
@@ -1958,14 +1952,14 @@ reset_var_on_error (Lisp_Object val)
    by holding its value temporarily in a marker.  */
 
 static void
-signal_before_change (EMACS_INT start_int, EMACS_INT end_int,
-                     EMACS_INT *preserve_ptr)
+signal_before_change (ptrdiff_t start_int, ptrdiff_t end_int,
+                     ptrdiff_t *preserve_ptr)
 {
   Lisp_Object start, end;
   Lisp_Object start_marker, end_marker;
   Lisp_Object preserve_marker;
   struct gcpro gcpro1, gcpro2, gcpro3;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   if (inhibit_modification_hooks)
     return;
@@ -2036,9 +2030,9 @@ signal_before_change (EMACS_INT start_int, EMACS_INT end_int,
    after the change.  */
 
 void
-signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins)
+signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   if (inhibit_modification_hooks)
     return;
 
@@ -2119,9 +2113,9 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
        doc: /* This function is for use internally in `combine-after-change-calls'.  */)
   (void)
 {
-  int count = SPECPDL_INDEX ();
-  EMACS_INT beg, end, change;
-  EMACS_INT begpos, endpos;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  ptrdiff_t beg, end, change;
+  ptrdiff_t begpos, endpos;
   Lisp_Object tail;
 
   if (NILP (combine_after_change_list))
@@ -2155,7 +2149,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
        tail = XCDR (tail))
     {
       Lisp_Object elt;
-      EMACS_INT thisbeg, thisend, thischange;
+      ptrdiff_t thisbeg, thisend, thischange;
 
       /* Extract the info from the next element.  */
       elt = XCAR (tail);
index 88f47f58b5233cd8186addbba75c90fdc0ad84db..5b8d44e8ced8d2534d4974ca2ad214fb4fb2d3e7 100644 (file)
@@ -42,6 +42,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <intprops.h>
 #include "lisp.h"
 #include "intervals.h"
+#include "character.h"
 #include "buffer.h"
 #include "puresize.h"
 #include "keyboard.h"
@@ -223,7 +224,7 @@ traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Obje
    Pass FUNCTION two args: an interval, and ARG.  */
 
 void
-traverse_intervals (INTERVAL tree, EMACS_INT position,
+traverse_intervals (INTERVAL tree, ptrdiff_t position,
                    void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg)
 {
   while (!NULL_INTERVAL_P (tree))
@@ -313,7 +314,7 @@ rotate_right (INTERVAL interval)
 {
   INTERVAL i;
   INTERVAL B = interval->left;
-  EMACS_INT old_total = interval->total_length;
+  ptrdiff_t old_total = interval->total_length;
 
   /* Deal with any Parent of A;  make it point to B.  */
   if (! ROOT_INTERVAL_P (interval))
@@ -360,7 +361,7 @@ rotate_left (INTERVAL interval)
 {
   INTERVAL i;
   INTERVAL B = interval->right;
-  EMACS_INT old_total = interval->total_length;
+  ptrdiff_t old_total = interval->total_length;
 
   /* Deal with any parent of A;  make it point to B.  */
   if (! ROOT_INTERVAL_P (interval))
@@ -399,7 +400,7 @@ rotate_left (INTERVAL interval)
 static INTERVAL
 balance_an_interval (INTERVAL i)
 {
-  register EMACS_INT old_diff, new_diff;
+  register ptrdiff_t old_diff, new_diff;
 
   while (1)
     {
@@ -499,11 +500,11 @@ balance_intervals (INTERVAL tree)
    it is still a root after this operation.  */
 
 INTERVAL
-split_interval_right (INTERVAL interval, EMACS_INT offset)
+split_interval_right (INTERVAL interval, ptrdiff_t offset)
 {
   INTERVAL new = make_interval ();
-  EMACS_INT position = interval->position;
-  EMACS_INT new_length = LENGTH (interval) - offset;
+  ptrdiff_t position = interval->position;
+  ptrdiff_t new_length = LENGTH (interval) - offset;
 
   new->position = position + offset;
   SET_INTERVAL_PARENT (new, interval);
@@ -544,10 +545,10 @@ split_interval_right (INTERVAL interval, EMACS_INT offset)
    it is still a root after this operation.  */
 
 INTERVAL
-split_interval_left (INTERVAL interval, EMACS_INT offset)
+split_interval_left (INTERVAL interval, ptrdiff_t offset)
 {
   INTERVAL new = make_interval ();
-  EMACS_INT new_length = offset;
+  ptrdiff_t new_length = offset;
 
   new->position = interval->position;
   interval->position = interval->position + offset;
@@ -610,11 +611,11 @@ interval_start_pos (INTERVAL source)
    will update this cache based on the result of find_interval.  */
 
 INTERVAL
-find_interval (register INTERVAL tree, register EMACS_INT position)
+find_interval (register INTERVAL tree, register ptrdiff_t position)
 {
   /* The distance from the left edge of the subtree at TREE
                     to POSITION.  */
-  register EMACS_INT relative_position;
+  register ptrdiff_t relative_position;
 
   if (NULL_INTERVAL_P (tree))
     return NULL_INTERVAL;
@@ -628,8 +629,7 @@ find_interval (register INTERVAL tree, register EMACS_INT position)
        relative_position -= BUF_BEG (XBUFFER (parent));
     }
 
-  if (relative_position > TOTAL_LENGTH (tree))
-    abort ();                  /* Paranoia */
+  eassert (relative_position <= TOTAL_LENGTH (tree));
 
   if (!handling_signal)
     tree = balance_possible_root_interval (tree);
@@ -667,7 +667,7 @@ INTERVAL
 next_interval (register INTERVAL interval)
 {
   register INTERVAL i = interval;
-  register EMACS_INT next_position;
+  register ptrdiff_t next_position;
 
   if (NULL_INTERVAL_P (i))
     return NULL_INTERVAL;
@@ -742,7 +742,7 @@ previous_interval (register INTERVAL interval)
    To speed up the process, we assume that the ->position of
    I and all its parents is already uptodate.  */
 INTERVAL
-update_interval (register INTERVAL i, EMACS_INT pos)
+update_interval (register INTERVAL i, ptrdiff_t pos)
 {
   if (NULL_INTERVAL_P (i))
     return NULL_INTERVAL;
@@ -774,7 +774,7 @@ update_interval (register INTERVAL i, EMACS_INT pos)
              i = i->right;             /* Move to the right child */
            }
          else if (NULL_PARENT (i))
-           error ("Point %"pI"d after end of properties", pos);
+           error ("Point %"pD"d after end of properties", pos);
          else
             i = INTERVAL_PARENT (i);
          continue;
@@ -784,68 +784,6 @@ update_interval (register INTERVAL i, EMACS_INT pos)
     }
 }
 
-\f
-#if 0
-/* Traverse a path down the interval tree TREE to the interval
-   containing POSITION, adjusting all nodes on the path for
-   an addition of LENGTH characters.  Insertion between two intervals
-   (i.e., point == i->position, where i is second interval) means
-   text goes into second interval.
-
-   Modifications are needed to handle the hungry bits -- after simply
-   finding the interval at position (don't add length going down),
-   if it's the beginning of the interval, get the previous interval
-   and check the hungry bits of both.  Then add the length going back up
-   to the root.  */
-
-static INTERVAL
-adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
-                               EMACS_INT length)
-{
-  register EMACS_INT relative_position;
-  register INTERVAL this;
-
-  if (TOTAL_LENGTH (tree) == 0)        /* Paranoia */
-    abort ();
-
-  /* If inserting at point-max of a buffer, that position
-     will be out of range */
-  if (position > TOTAL_LENGTH (tree))
-    position = TOTAL_LENGTH (tree);
-  relative_position = position;
-  this = tree;
-
-  while (1)
-    {
-      if (relative_position <= LEFT_TOTAL_LENGTH (this))
-       {
-         this->total_length += length;
-         CHECK_TOTAL_LENGTH (this);
-         this = this->left;
-       }
-      else if (relative_position > (TOTAL_LENGTH (this)
-                                   - RIGHT_TOTAL_LENGTH (this)))
-       {
-         relative_position -= (TOTAL_LENGTH (this)
-                               - RIGHT_TOTAL_LENGTH (this));
-         this->total_length += length;
-         CHECK_TOTAL_LENGTH (this);
-         this = this->right;
-       }
-      else
-       {
-         /* If we are to use zero-length intervals as buffer pointers,
-            then this code will have to change.  */
-         this->total_length += length;
-         CHECK_TOTAL_LENGTH (this);
-         this->position = LEFT_TOTAL_LENGTH (this)
-                          + position - relative_position + 1;
-         return tree;
-       }
-    }
-}
-#endif
-
 /* Effect an adjustment corresponding to the addition of LENGTH characters
    of text.  Do this by finding the interval containing POSITION in the
    interval tree TREE, and then adjusting all of its ancestors by adding
@@ -861,16 +799,15 @@ adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position,
 
 static INTERVAL
 adjust_intervals_for_insertion (INTERVAL tree,
-                               EMACS_INT position, EMACS_INT length)
+                               ptrdiff_t position, ptrdiff_t length)
 {
   register INTERVAL i;
   register INTERVAL temp;
   int eobp = 0;
   Lisp_Object parent;
-  EMACS_INT offset;
+  ptrdiff_t offset;
 
-  if (TOTAL_LENGTH (tree) == 0)        /* Paranoia */
-    abort ();
+  eassert (TOTAL_LENGTH (tree) > 0);
 
   GET_INTERVAL_OBJECT (parent, tree);
   offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0);
@@ -1000,6 +937,7 @@ adjust_intervals_for_insertion (INTERVAL tree,
          Lisp_Object pleft, pright;
          struct interval newi;
 
+         RESET_INTERVAL (&newi);
          pleft = NULL_INTERVAL_P (prev) ? Qnil : prev->plist;
          pright = NULL_INTERVAL_P (i) ? Qnil : i->plist;
          newi.plist = merge_properties_sticky (pleft, pright);
@@ -1225,7 +1163,7 @@ static INTERVAL
 delete_node (register INTERVAL i)
 {
   register INTERVAL migrate, this;
-  register EMACS_INT migrate_amt;
+  register ptrdiff_t migrate_amt;
 
   if (NULL_INTERVAL_P (i->left))
     return i->right;
@@ -1258,10 +1196,9 @@ static void
 delete_interval (register INTERVAL i)
 {
   register INTERVAL parent;
-  EMACS_INT amt = LENGTH (i);
+  ptrdiff_t amt = LENGTH (i);
 
-  if (amt > 0)                 /* Only used on zero-length intervals now.  */
-    abort ();
+  eassert (amt == 0);          /* Only used on zero-length intervals now.  */
 
   if (ROOT_INTERVAL_P (i))
     {
@@ -1308,11 +1245,11 @@ delete_interval (register INTERVAL i)
    Do this by recursing down TREE to the interval in question, and
    deleting the appropriate amount of text.  */
 
-static EMACS_INT
-interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
-                             register EMACS_INT amount)
+static ptrdiff_t
+interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from,
+                             register ptrdiff_t amount)
 {
-  register EMACS_INT relative_position = from;
+  register ptrdiff_t relative_position = from;
 
   if (NULL_INTERVAL_P (tree))
     return 0;
@@ -1320,7 +1257,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
   /* Left branch.  */
   if (relative_position < LEFT_TOTAL_LENGTH (tree))
     {
-      EMACS_INT subtract = interval_deletion_adjustment (tree->left,
+      ptrdiff_t subtract = interval_deletion_adjustment (tree->left,
                                                         relative_position,
                                                         amount);
       tree->total_length -= subtract;
@@ -1331,7 +1268,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
   else if (relative_position >= (TOTAL_LENGTH (tree)
                                 - RIGHT_TOTAL_LENGTH (tree)))
     {
-      EMACS_INT subtract;
+      ptrdiff_t subtract;
 
       relative_position -= (tree->total_length
                            - RIGHT_TOTAL_LENGTH (tree));
@@ -1346,7 +1283,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
   else
     {
       /* How much can we delete from this interval?  */
-      EMACS_INT my_amount = ((tree->total_length
+      ptrdiff_t my_amount = ((tree->total_length
                               - RIGHT_TOTAL_LENGTH (tree))
                              - relative_position);
 
@@ -1371,12 +1308,12 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from,
 
 static void
 adjust_intervals_for_deletion (struct buffer *buffer,
-                              EMACS_INT start, EMACS_INT length)
+                              ptrdiff_t start, ptrdiff_t length)
 {
-  register EMACS_INT left_to_delete = length;
+  register ptrdiff_t left_to_delete = length;
   register INTERVAL tree = BUF_INTERVALS (buffer);
   Lisp_Object parent;
-  EMACS_INT offset;
+  ptrdiff_t offset;
 
   GET_INTERVAL_OBJECT (parent, tree);
   offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0);
@@ -1384,9 +1321,8 @@ adjust_intervals_for_deletion (struct buffer *buffer,
   if (NULL_INTERVAL_P (tree))
     return;
 
-  if (start > offset + TOTAL_LENGTH (tree)
-      || start + length > offset + TOTAL_LENGTH (tree))
-    abort ();
+  eassert (start <= offset + TOTAL_LENGTH (tree)
+          && start + length <= offset + TOTAL_LENGTH (tree));
 
   if (length == TOTAL_LENGTH (tree))
     {
@@ -1426,7 +1362,7 @@ adjust_intervals_for_deletion (struct buffer *buffer,
    adjust_intervals_for_deletion) from a non-static inline function.  */
 
 void
-offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
+offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length)
 {
   if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0)
     return;
@@ -1435,7 +1371,7 @@ offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
     adjust_intervals_for_insertion (BUF_INTERVALS (buffer), start, length);
   else
     {
-      IF_LINT (if (length < - TYPE_MAXIMUM (EMACS_INT)) abort ();)
+      IF_LINT (if (length < - TYPE_MAXIMUM (ptrdiff_t)) abort ();)
       adjust_intervals_for_deletion (buffer, start, -length);
     }
 }
@@ -1452,7 +1388,7 @@ offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length)
 static INTERVAL
 merge_interval_right (register INTERVAL i)
 {
-  register EMACS_INT absorb = LENGTH (i);
+  register ptrdiff_t absorb = LENGTH (i);
   register INTERVAL successor;
 
   /* Zero out this interval.  */
@@ -1508,7 +1444,7 @@ merge_interval_right (register INTERVAL i)
 INTERVAL
 merge_interval_left (register INTERVAL i)
 {
-  register EMACS_INT absorb = LENGTH (i);
+  register ptrdiff_t absorb = LENGTH (i);
   register INTERVAL predecessor;
 
   /* Zero out this interval.  */
@@ -1590,49 +1526,6 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent)
 
   return t;
 }
-
-#if 0
-/* Nobody calls this.  Perhaps it's a vestige of an earlier design.  */
-
-/* Make a new interval of length LENGTH starting at START in the
-   group of intervals INTERVALS, which is actually an interval tree.
-   Returns the new interval.
-
-   Generate an error if the new positions would overlap an existing
-   interval.  */
-
-static INTERVAL
-make_new_interval (INTERVAL intervals, EMACS_INT start, EMACS_INT length)
-{
-  INTERVAL slot;
-
-  slot = find_interval (intervals, start);
-  if (start + length > slot->position + LENGTH (slot))
-    error ("Interval would overlap");
-
-  if (start == slot->position && length == LENGTH (slot))
-    return slot;
-
-  if (slot->position == start)
-    {
-      /* New right node.  */
-      split_interval_right (slot, length);
-      return slot;
-    }
-
-  if (slot->position + LENGTH (slot) == start + length)
-    {
-      /* New left node.  */
-      split_interval_left (slot, LENGTH (slot) - length);
-      return slot;
-    }
-
-  /* Convert interval SLOT into three intervals.  */
-  split_interval_left (slot, start - slot->position);
-  split_interval_right (slot, length);
-  return slot;
-}
-#endif
 \f
 /* Insert the intervals of SOURCE into BUFFER at POSITION.
    LENGTH is the length of the text in SOURCE.
@@ -1674,13 +1567,13 @@ make_new_interval (INTERVAL intervals, EMACS_INT start, EMACS_INT length)
    text...  */
 
 void
-graft_intervals_into_buffer (INTERVAL source, EMACS_INT position,
-                            EMACS_INT length, struct buffer *buffer,
+graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position,
+                            ptrdiff_t length, struct buffer *buffer,
                             int inherit)
 {
   register INTERVAL under, over, this;
   register INTERVAL tree;
-  EMACS_INT over_used;
+  ptrdiff_t over_used;
 
   tree = BUF_INTERVALS (buffer);
 
@@ -1723,14 +1616,12 @@ graft_intervals_into_buffer (INTERVAL source, EMACS_INT position,
        XSETBUFFER (buf, buffer);
        tree = create_root_interval (buf);
       }
-  /* Paranoia -- the text has already been added, so this buffer
-     should be of non-zero length.  */
-  else if (TOTAL_LENGTH (tree) == 0)
-    abort ();
+  /* Paranoia -- the text has already been added, so
+     this buffer should be of non-zero length.  */
+  eassert (TOTAL_LENGTH (tree) > 0);
 
   this = under = find_interval (tree, position);
-  if (NULL_INTERVAL_P (under)) /* Paranoia.  */
-    abort ();
+  eassert (!NULL_INTERVAL_P (under));
   over = find_interval (source, interval_start_pos (source));
 
   /* Here for insertion in the middle of an interval.
@@ -1862,18 +1753,14 @@ lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop
 
 void
 temp_set_point_both (struct buffer *buffer,
-                    EMACS_INT charpos, EMACS_INT bytepos)
+                    ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   /* In a single-byte buffer, the two positions must be equal.  */
-  if (BUF_ZV (buffer) == BUF_ZV_BYTE (buffer)
-      && charpos != bytepos)
-    abort ();
-
-  if (charpos > bytepos)
-    abort ();
+  if (BUF_ZV (buffer) == BUF_ZV_BYTE (buffer))
+    eassert (charpos == bytepos);
 
-  if (charpos > BUF_ZV (buffer) || charpos < BUF_BEGV (buffer))
-    abort ();
+  eassert (charpos <= bytepos);
+  eassert (charpos <= BUF_ZV (buffer) || BUF_BEGV (buffer) <= charpos);
 
   SET_BUF_PT_BOTH (buffer, charpos, bytepos);
 }
@@ -1881,7 +1768,7 @@ temp_set_point_both (struct buffer *buffer,
 /* Set point "temporarily", without checking any text properties.  */
 
 void
-temp_set_point (struct buffer *buffer, EMACS_INT charpos)
+temp_set_point (struct buffer *buffer, ptrdiff_t charpos)
 {
   temp_set_point_both (buffer, charpos,
                       buf_charpos_to_bytepos (buffer, charpos));
@@ -1891,7 +1778,7 @@ temp_set_point (struct buffer *buffer, EMACS_INT charpos)
    before an intangible character, move to an ok place.  */
 
 void
-set_point (EMACS_INT charpos)
+set_point (ptrdiff_t charpos)
 {
   set_point_both (charpos, buf_charpos_to_bytepos (current_buffer, charpos));
 }
@@ -1907,8 +1794,8 @@ set_point (EMACS_INT charpos)
    Note that `stickiness' is determined by overlay marker insertion types,
    if the invisible property comes from an overlay.  */
 
-static EMACS_INT
-adjust_for_invis_intang (EMACS_INT pos, EMACS_INT test_offs, EMACS_INT adj,
+static ptrdiff_t
+adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t test_offs, ptrdiff_t adj,
                         int test_intang)
 {
   Lisp_Object invis_propval, invis_overlay;
@@ -1947,18 +1834,18 @@ adjust_for_invis_intang (EMACS_INT pos, EMACS_INT test_offs, EMACS_INT adj,
    before an intangible character, move to an ok place.  */
 
 void
-set_point_both (EMACS_INT charpos, EMACS_INT bytepos)
+set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   register INTERVAL to, from, toprev, fromprev;
-  EMACS_INT buffer_point;
-  EMACS_INT old_position = PT;
+  ptrdiff_t buffer_point;
+  ptrdiff_t old_position = PT;
   /* This ensures that we move forward past intangible text when the
      initial position is the same as the destination, in the rare
      instances where this is important, e.g. in line-move-finish
      (simple.el).  */
   int backwards = (charpos < old_position ? 1 : 0);
   int have_overlays;
-  EMACS_INT original_position;
+  ptrdiff_t original_position;
 
   BVAR (current_buffer, point_before_scroll) = Qnil;
 
@@ -2171,7 +2058,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos)
    segment that reaches all the way to point.  */
 
 void
-move_if_not_intangible (EMACS_INT position)
+move_if_not_intangible (ptrdiff_t position)
 {
   Lisp_Object pos;
   Lisp_Object intangible_propval;
@@ -2234,8 +2121,8 @@ move_if_not_intangible (EMACS_INT position)
    nil means the current buffer. */
 
 int
-get_property_and_range (EMACS_INT pos, Lisp_Object prop, Lisp_Object *val,
-                       EMACS_INT *start, EMACS_INT *end, Lisp_Object object)
+get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val,
+                       ptrdiff_t *start, ptrdiff_t *end, Lisp_Object object)
 {
   INTERVAL i, prev, next;
 
@@ -2278,11 +2165,11 @@ get_property_and_range (EMACS_INT pos, Lisp_Object prop, Lisp_Object *val,
    POSITION must be in the accessible part of BUFFER.  */
 
 Lisp_Object
-get_local_map (register EMACS_INT position, register struct buffer *buffer,
+get_local_map (register ptrdiff_t position, register struct buffer *buffer,
               Lisp_Object type)
 {
   Lisp_Object prop, lispy_position, lispy_buffer;
-  EMACS_INT old_begv, old_zv, old_begv_byte, old_zv_byte;
+  ptrdiff_t old_begv, old_zv, old_begv_byte, old_zv_byte;
 
   /* Perhaps we should just change `position' to the limit.  */
   if (position > BUF_ZV (buffer) || position < BUF_BEGV (buffer))
@@ -2329,17 +2216,16 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer,
    The new interval tree has no parent and has a starting-position of 0.  */
 
 INTERVAL
-copy_intervals (INTERVAL tree, EMACS_INT start, EMACS_INT length)
+copy_intervals (INTERVAL tree, ptrdiff_t start, ptrdiff_t length)
 {
   register INTERVAL i, new, t;
-  register EMACS_INT got, prevlen;
+  register ptrdiff_t got, prevlen;
 
   if (NULL_INTERVAL_P (tree) || length <= 0)
     return NULL_INTERVAL;
 
   i = find_interval (tree, start);
-  if (NULL_INTERVAL_P (i) || LENGTH (i) == 0)
-    abort ();
+  eassert (!NULL_INTERVAL_P (i) && LENGTH (i) > 0);
 
   /* If there is only one interval and it's the default, return nil.  */
   if ((start - i->position + 1 + length) < LENGTH (i)
@@ -2371,7 +2257,7 @@ copy_intervals (INTERVAL tree, EMACS_INT start, EMACS_INT length)
 
 void
 copy_intervals_to_string (Lisp_Object string, struct buffer *buffer,
-                         EMACS_INT position, EMACS_INT length)
+                         ptrdiff_t position, ptrdiff_t length)
 {
   INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer),
                                           position, length);
@@ -2389,8 +2275,8 @@ int
 compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
 {
   INTERVAL i1, i2;
-  EMACS_INT pos = 0;
-  EMACS_INT end = SCHARS (s1);
+  ptrdiff_t pos = 0;
+  ptrdiff_t end = SCHARS (s1);
 
   i1 = find_interval (STRING_INTERVALS (s1), 0);
   i2 = find_interval (STRING_INTERVALS (s2), 0);
@@ -2398,9 +2284,9 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
   while (pos < end)
     {
       /* Determine how far we can go before we reach the end of I1 or I2.  */
-      EMACS_INT len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos;
-      EMACS_INT len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos;
-      EMACS_INT distance = min (len1, len2);
+      ptrdiff_t len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos;
+      ptrdiff_t len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos;
+      ptrdiff_t distance = min (len1, len2);
 
       /* If we ever find a mismatch between the strings,
         they differ.  */
@@ -2425,8 +2311,8 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2)
 
 static void
 set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
-                          EMACS_INT start, EMACS_INT start_byte,
-                          EMACS_INT end, EMACS_INT end_byte)
+                          ptrdiff_t start, ptrdiff_t start_byte,
+                          ptrdiff_t end, ptrdiff_t end_byte)
 {
   /* Fix the length of this interval.  */
   if (multi_flag)
@@ -2444,11 +2330,11 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
   /* Recursively fix the length of the subintervals.  */
   if (i->left)
     {
-      EMACS_INT left_end, left_end_byte;
+      ptrdiff_t left_end, left_end_byte;
 
       if (multi_flag)
        {
-         EMACS_INT temp;
+         ptrdiff_t temp;
          left_end_byte = start_byte + LEFT_TOTAL_LENGTH (i);
          left_end = BYTE_TO_CHAR (left_end_byte);
 
@@ -2477,11 +2363,11 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag,
     }
   if (i->right)
     {
-      EMACS_INT right_start_byte, right_start;
+      ptrdiff_t right_start_byte, right_start;
 
       if (multi_flag)
        {
-         EMACS_INT temp;
+         ptrdiff_t temp;
 
          right_start_byte = end_byte - RIGHT_TOTAL_LENGTH (i);
          right_start = BYTE_TO_CHAR (right_start_byte);
index 7d23ce40f49d8a6b7a0d0a06cf3739d25d011d6e..d78289d897e0e72b77c11c1939bdf40b8a0f1051 100644 (file)
@@ -27,8 +27,8 @@ struct interval
 {
   /* The first group of entries deal with the tree structure.  */
 
-  EMACS_INT total_length;       /* Length of myself and both children.  */
-  EMACS_INT position;          /* Cache of interval's character position.  */
+  ptrdiff_t total_length;       /* Length of myself and both children.  */
+  ptrdiff_t position;          /* Cache of interval's character position.  */
                                /* This field is usually updated
                                   simultaneously with an interval
                                   traversal, there is no guarantee
@@ -56,12 +56,7 @@ struct interval
   unsigned int front_sticky : 1;    /* Non-zero means text inserted just
                                       before this interval goes into it.  */
   unsigned int rear_sticky : 1;            /* Likewise for just after it.  */
-
-  /* Properties of this interval.
-     The mark bit on this field says whether this particular interval
-     tree node has been visited.  Since intervals should never be
-     shared, GC aborts if it seems to have visited an interval twice.  */
-  Lisp_Object plist;
+  Lisp_Object plist;               /* Other properties.  */
 };
 
 /* These are macros for dealing with the interval tree.  */
@@ -254,39 +249,39 @@ extern INTERVAL make_interval (void);
 extern INTERVAL create_root_interval (Lisp_Object);
 extern void copy_properties (INTERVAL, INTERVAL);
 extern int intervals_equal (INTERVAL, INTERVAL);
-extern void traverse_intervals (INTERVAL, EMACS_INT,
+extern void traverse_intervals (INTERVAL, ptrdiff_t,
                                 void (*) (INTERVAL, Lisp_Object),
                                 Lisp_Object);
 extern void traverse_intervals_noorder (INTERVAL,
                                         void (*) (INTERVAL, Lisp_Object),
                                         Lisp_Object);
-extern INTERVAL split_interval_right (INTERVAL, EMACS_INT);
-extern INTERVAL split_interval_left (INTERVAL, EMACS_INT);
-extern INTERVAL find_interval (INTERVAL, EMACS_INT);
+extern INTERVAL split_interval_right (INTERVAL, ptrdiff_t);
+extern INTERVAL split_interval_left (INTERVAL, ptrdiff_t);
+extern INTERVAL find_interval (INTERVAL, ptrdiff_t);
 extern INTERVAL next_interval (INTERVAL);
 extern INTERVAL previous_interval (INTERVAL);
 extern INTERVAL merge_interval_left (INTERVAL);
-extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT);
-extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT,
+extern void offset_intervals (struct buffer *, ptrdiff_t, ptrdiff_t);
+extern void graft_intervals_into_buffer (INTERVAL, ptrdiff_t, ptrdiff_t,
                                          struct buffer *, int);
 extern void verify_interval_modification (struct buffer *,
-                                         EMACS_INT, EMACS_INT);
+                                         ptrdiff_t, ptrdiff_t);
 extern INTERVAL balance_intervals (INTERVAL);
 extern void copy_intervals_to_string (Lisp_Object, struct buffer *,
-                                             EMACS_INT, EMACS_INT);
-extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT);
+                                             ptrdiff_t, ptrdiff_t);
+extern INTERVAL copy_intervals (INTERVAL, ptrdiff_t, ptrdiff_t);
 extern int compare_string_intervals (Lisp_Object, Lisp_Object);
 extern Lisp_Object textget (Lisp_Object, Lisp_Object);
 extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int);
-extern void move_if_not_intangible (EMACS_INT);
-extern int get_property_and_range (EMACS_INT, Lisp_Object, Lisp_Object *,
-                                   EMACS_INT *, EMACS_INT *, Lisp_Object);
-extern Lisp_Object get_local_map (EMACS_INT, struct buffer *, Lisp_Object);
-extern INTERVAL update_interval (INTERVAL, EMACS_INT);
+extern void move_if_not_intangible (ptrdiff_t);
+extern int get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *,
+                                   ptrdiff_t *, ptrdiff_t *, Lisp_Object);
+extern Lisp_Object get_local_map (ptrdiff_t, struct buffer *, Lisp_Object);
+extern INTERVAL update_interval (INTERVAL, ptrdiff_t);
 extern void set_intervals_multibyte (int);
 extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *,
                                          Lisp_Object *, int);
-extern INTERVAL interval_of (EMACS_INT, Lisp_Object);
+extern INTERVAL interval_of (ptrdiff_t, Lisp_Object);
 
 /* Defined in xdisp.c.  */
 extern int invisible_p (Lisp_Object, Lisp_Object);
@@ -308,16 +303,6 @@ extern Lisp_Object Qinvisible, Qintangible;
 /* Sticky properties.  */
 extern Lisp_Object Qfront_sticky, Qrear_nonsticky;
 
-EXFUN (Fget_char_property, 3);
-EXFUN (Fget_text_property, 3);
-EXFUN (Ftext_properties_at, 2);
-EXFUN (Fnext_property_change, 3);
-EXFUN (Fadd_text_properties, 4);
-EXFUN (Fset_text_properties, 4);
-EXFUN (Fremove_text_properties, 4);
-EXFUN (Fremove_list_of_text_properties, 4);
-EXFUN (Ftext_property_any, 5);
-EXFUN (Fprevious_single_char_property_change, 4);
 extern Lisp_Object copy_text_properties (Lisp_Object, Lisp_Object,
                                          Lisp_Object, Lisp_Object,
                                          Lisp_Object, Lisp_Object);
index 50b2ade8ee477e17a8a32d6ec40326b9604f06cc..963f40a2e32a471ae7309d84bdcff7bf35ff5916 100644 (file)
@@ -30,8 +30,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "window.h"
 #include "commands.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "disptab.h"
 #include "dispextern.h"
 #include "syntax.h"
@@ -122,7 +122,7 @@ static Lisp_Object recent_keys;
    actually mean something.
    It's easier to staticpro a single Lisp_Object than an array.  */
 Lisp_Object this_command_keys;
-int this_command_key_count;
+ptrdiff_t this_command_key_count;
 
 /* 1 after calling Freset_this_command_lengths.
    Usually it is 0.  */
@@ -135,16 +135,16 @@ static int raw_keybuf_count;
 
 #define GROW_RAW_KEYBUF                                                        \
  if (raw_keybuf_count == ASIZE (raw_keybuf))                           \
-   raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil)  \
+   raw_keybuf = larger_vector (raw_keybuf, 1, -1)
 
 /* Number of elements of this_command_keys
    that precede this key sequence.  */
-static int this_single_command_key_start;
+static ptrdiff_t this_single_command_key_start;
 
 /* Record values of this_command_key_count and echo_length ()
    before this command was read.  */
-static int before_command_key_count;
-static int before_command_echo_length;
+static ptrdiff_t before_command_key_count;
+static ptrdiff_t before_command_echo_length;
 
 /* For longjmp to where kbd input is being done.  */
 
@@ -208,20 +208,17 @@ EMACS_INT command_loop_level;
 Lisp_Object unread_switch_frame;
 
 /* Last size recorded for a current buffer which is not a minibuffer.  */
-static EMACS_INT last_non_minibuf_size;
+static ptrdiff_t last_non_minibuf_size;
 
 /* Total number of times read_char has returned, modulo UINTMAX_MAX + 1.  */
 uintmax_t num_input_events;
 
 /* Value of num_nonmacro_input_events as of last auto save.  */
 
-static int last_auto_save;
-
-/* This is like Vthis_command, except that commands never set it.  */
-Lisp_Object real_this_command;
+static EMACS_INT last_auto_save;
 
 /* The value of point when the last command was started.  */
-static EMACS_INT last_point_position;
+static ptrdiff_t last_point_position;
 
 /* The buffer that was current when the last command was started.  */
 static Lisp_Object last_point_position_buffer;
@@ -377,7 +374,7 @@ EMACS_TIME timer_check (void);
 
 static void record_menu_key (Lisp_Object c);
 static void echo_now (void);
-static int echo_length (void);
+static ptrdiff_t echo_length (void);
 
 static Lisp_Object Qpolling_period;
 
@@ -448,9 +445,9 @@ static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object,
                                         Lisp_Object, Lisp_Object,
                                        Time);
 #endif
-static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object,
+static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object,
                                         Lisp_Object, const char *const *,
-                                        Lisp_Object *, EMACS_INT);
+                                        Lisp_Object *, ptrdiff_t);
 static Lisp_Object make_lispy_switch_frame (Lisp_Object);
 static int help_char_p (Lisp_Object);
 static void save_getcjmp (jmp_buf);
@@ -462,10 +459,8 @@ static void interrupt_signal (int signalnum);
 #ifdef SIGIO
 static void input_available_signal (int signo);
 #endif
-static Lisp_Object (Fcommand_execute) (Lisp_Object, Lisp_Object, Lisp_Object,
-                                      Lisp_Object);
 static void handle_interrupt (void);
-static void quit_throw_to_read_char (int) NO_RETURN;
+static _Noreturn void quit_throw_to_read_char (int);
 static void process_special_events (void);
 static void timer_start_idle (void);
 static void timer_stop_idle (void);
@@ -485,7 +480,7 @@ echo_char (Lisp_Object c)
   if (current_kboard->immediate_echo)
     {
       int size = KEY_DESCRIPTION_SIZE + 100;
-      char *buffer = (char *) alloca (size);
+      char *buffer = alloca (size);
       char *ptr = buffer;
       Lisp_Object echo_string;
 
@@ -507,7 +502,7 @@ echo_char (Lisp_Object c)
            {
              int offset = ptr - buffer;
              size = max (2 * size, size + nbytes);
-             buffer = (char *) alloca (size);
+             buffer = alloca (size);
              ptr = buffer + offset;
            }
 
@@ -525,7 +520,7 @@ echo_char (Lisp_Object c)
            {
              int offset = ptr - buffer;
              size += len;
-             buffer = (char *) alloca (size);
+             buffer = alloca (size);
              ptr = buffer + offset;
            }
 
@@ -615,7 +610,7 @@ echo_now (void)
 {
   if (!current_kboard->immediate_echo)
     {
-      int i;
+      ptrdiff_t i;
       current_kboard->immediate_echo = 1;
 
       for (i = 0; i < this_command_key_count; i++)
@@ -628,7 +623,7 @@ echo_now (void)
          if (i == this_single_command_key_start)
            before_command_echo_length = echo_length ();
 
-         c = XVECTOR (this_command_keys)->contents[i];
+         c = AREF (this_command_keys, i);
          if (! (EVENT_HAS_PARAMETERS (c)
                 && EQ (EVENT_HEAD_KIND (EVENT_HEAD (c)), Qmouse_movement)))
            echo_char (c);
@@ -673,7 +668,7 @@ cancel_echoing (void)
 
 /* Return the length of the current echo string.  */
 
-static int
+static ptrdiff_t
 echo_length (void)
 {
   return (STRINGP (KVAR (current_kboard, echo_string))
@@ -686,7 +681,7 @@ echo_length (void)
    switches frames while entering a key sequence.  */
 
 static void
-echo_truncate (EMACS_INT nchars)
+echo_truncate (ptrdiff_t nchars)
 {
   if (STRINGP (KVAR (current_kboard, echo_string)))
     KVAR (current_kboard, echo_string)
@@ -715,9 +710,7 @@ add_command_key (Lisp_Object key)
 #endif
 
   if (this_command_key_count >= ASIZE (this_command_keys))
-    this_command_keys = larger_vector (this_command_keys,
-                                      2 * ASIZE (this_command_keys),
-                                      Qnil);
+    this_command_keys = larger_vector (this_command_keys, 1, -1);
 
   ASET (this_command_keys, this_command_key_count, key);
   ++this_command_key_count;
@@ -727,7 +720,7 @@ add_command_key (Lisp_Object key)
 Lisp_Object
 recursive_edit_1 (void)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object val;
 
   if (command_loop_level > 0)
@@ -795,7 +788,7 @@ Alternatively, `(throw 'exit t)' makes this function signal an error.
 This function is called by the editor initialization to begin editing.  */)
   (void)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object buffer;
 
   /* If we enter while input is blocked, don't lock up here.
@@ -891,8 +884,7 @@ static struct kboard_stack *kboard_stack;
 void
 push_kboard (struct kboard *k)
 {
-  struct kboard_stack *p
-    = (struct kboard_stack *) xmalloc (sizeof (struct kboard_stack));
+  struct kboard_stack *p = xmalloc (sizeof *p);
 
   p->next = kboard_stack;
   p->kboard = current_kboard;
@@ -1200,7 +1192,13 @@ This also exits all active minibuffers.  */)
   Fthrow (Qtop_level, Qnil);
 }
 
-static Lisp_Object Fexit_recursive_edit (void) NO_RETURN;
+static _Noreturn void
+user_error (const char *msg)
+{
+  xsignal1 (Quser_error, build_string (msg));
+}
+
+_Noreturn
 DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "",
        doc: /* Exit from the innermost recursive edit or minibuffer.  */)
   (void)
@@ -1208,10 +1206,10 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0,
   if (command_loop_level > 0 || minibuf_level > 0)
     Fthrow (Qexit, Qnil);
 
-  error ("No recursive edit is in progress");
+  user_error ("No recursive edit is in progress");
 }
 
-static Lisp_Object Fabort_recursive_edit (void) NO_RETURN;
+_Noreturn
 DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "",
        doc: /* Abort the command that requested this recursive edit or minibuffer input.  */)
   (void)
@@ -1219,7 +1217,7 @@ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0,
   if (command_loop_level > 0 || minibuf_level > 0)
     Fthrow (Qexit, Qt);
 
-  error ("No recursive edit is in progress");
+  user_error ("No recursive edit is in progress");
 }
 \f
 #if defined (HAVE_MOUSE) || defined (HAVE_GPM)
@@ -1256,7 +1254,7 @@ Normally, mouse motion is ignored.
 usage: (track-mouse BODY...)  */)
   (Lisp_Object args)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object val;
 
   record_unwind_protect (tracking_off, do_mouse_tracking);
@@ -1307,7 +1305,7 @@ some_mouse_moved (void)
 static int read_key_sequence (Lisp_Object *, int, Lisp_Object,
                               int, int, int);
 void safe_run_hooks (Lisp_Object);
-static void adjust_point_for_property (EMACS_INT, int);
+static void adjust_point_for_property (ptrdiff_t, int);
 
 /* Cancel hourglass from protect_unwind.
    ARG is not used.  */
@@ -1323,7 +1321,6 @@ cancel_hourglass_unwind (Lisp_Object arg)
 /* FIXME: This is wrong rather than test window-system, we should call
    a new set-selection, which will then dispatch to x-set-selection, or
    tty-set-selection, or w32-set-selection, ...  */
-EXFUN (Fwindow_system, 1);
 
 Lisp_Object
 command_loop_1 (void)
@@ -1331,7 +1328,7 @@ command_loop_1 (void)
   Lisp_Object cmd;
   Lisp_Object keybuf[30];
   int i;
-  int prev_modiff = 0;
+  EMACS_INT prev_modiff = 0;
   struct buffer *prev_buffer = NULL;
 #if 0 /* This shouldn't be necessary anymore.  --lorentey  */
   int was_locked = single_kboard;
@@ -1372,9 +1369,9 @@ command_loop_1 (void)
 
   /* Do this after running Vpost_command_hook, for consistency.  */
   KVAR (current_kboard, Vlast_command) = Vthis_command;
-  KVAR (current_kboard, Vreal_last_command) = real_this_command;
+  KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
   if (!CONSP (last_command_event))
-    KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
+    KVAR (current_kboard, Vlast_repeatable_command) = Vreal_this_command;
 
   while (1)
     {
@@ -1403,7 +1400,7 @@ command_loop_1 (void)
        {
          /* Bind inhibit-quit to t so that C-g gets read in
             rather than quitting back to the minibuffer.  */
-         int count = SPECPDL_INDEX ();
+         ptrdiff_t count = SPECPDL_INDEX ();
          specbind (Qinhibit_quit, Qt);
 
          sit_for (Vminibuffer_message_timeout, 0, 2);
@@ -1441,7 +1438,7 @@ command_loop_1 (void)
       before_command_echo_length = echo_length ();
 
       Vthis_command = Qnil;
-      real_this_command = Qnil;
+      Vreal_this_command = Qnil;
       Vthis_original_command = Qnil;
       Vthis_command_keys_shift_translated = Qnil;
 
@@ -1480,10 +1477,10 @@ command_loop_1 (void)
         from that position.  But also throw away beg_unchanged and
         end_unchanged information in that case, so that redisplay will
         update the whole window properly.  */
-      if (!NILP (XWINDOW (selected_window)->force_start))
+      if (XWINDOW (selected_window)->force_start)
        {
          struct buffer *b;
-         XWINDOW (selected_window)->force_start = Qnil;
+         XWINDOW (selected_window)->force_start = 0;
          b = XBUFFER (XWINDOW (selected_window)->buffer);
          BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0;
        }
@@ -1525,7 +1522,7 @@ command_loop_1 (void)
       /* Execute the command.  */
 
       Vthis_command = cmd;
-      real_this_command = cmd;
+      Vreal_this_command = cmd;
       safe_run_hooks (Qpre_command_hook);
 
       already_adjusted = 0;
@@ -1557,7 +1554,7 @@ command_loop_1 (void)
          /* Here for a command that isn't executed directly.  */
 
 #ifdef HAVE_WINDOW_SYSTEM
-            int scount = SPECPDL_INDEX ();
+            ptrdiff_t scount = SPECPDL_INDEX ();
 
             if (display_hourglass_p
                 && NILP (Vexecuting_kbd_macro))
@@ -1609,12 +1606,14 @@ command_loop_1 (void)
         If the command didn't actually create a prefix arg,
         but is merely a frame event that is transparent to prefix args,
         then the above doesn't apply.  */
-      if (NILP (KVAR (current_kboard, Vprefix_arg)) || CONSP (last_command_event))
+      if (NILP (KVAR (current_kboard, Vprefix_arg))
+         || CONSP (last_command_event))
        {
          KVAR (current_kboard, Vlast_command) = Vthis_command;
-         KVAR (current_kboard, Vreal_last_command) = real_this_command;
+         KVAR (current_kboard, Vreal_last_command) = Vreal_this_command;
          if (!CONSP (last_command_event))
-           KVAR (current_kboard, Vlast_repeatable_command) = real_this_command;
+           KVAR (current_kboard, Vlast_repeatable_command)
+             = Vreal_this_command;
          cancel_echoing ();
          this_command_key_count = 0;
          this_command_key_count_reset = 0;
@@ -1651,9 +1650,9 @@ command_loop_1 (void)
                  && NILP (Fmemq (Vthis_command,
                                  Vselection_inhibit_update_commands)))
                {
-                 EMACS_INT beg =
+                 ptrdiff_t beg =
                    XINT (Fmarker_position (BVAR (current_buffer, mark)));
-                 EMACS_INT end = PT;
+                 ptrdiff_t end = PT;
                  if (beg < end)
                    call2 (Qx_set_selection, QPRIMARY,
                           make_buffer_string (beg, end, 0));
@@ -1713,16 +1712,16 @@ command_loop_1 (void)
    LAST_PT is the last position of point.  */
 
 static void
-adjust_point_for_property (EMACS_INT last_pt, int modified)
+adjust_point_for_property (ptrdiff_t last_pt, int modified)
 {
-  EMACS_INT beg, end;
+  ptrdiff_t beg, end;
   Lisp_Object val, overlay, tmp;
   /* When called after buffer modification, we should temporarily
      suppress the point adjustment for automatic composition so that a
      user can keep inserting another character at point or keep
      deleting characters around point.  */
   int check_composition = ! modified, check_display = 1, check_invisible = 1;
-  EMACS_INT orig_pt = PT;
+  ptrdiff_t orig_pt = PT;
 
   /* FIXME: cycling is probably not necessary because these properties
      can't be usefully combined anyway.  */
@@ -1749,7 +1748,7 @@ adjust_point_for_property (EMACS_INT last_pt, int modified)
          && (beg < PT /* && end > PT   <- It's always the case.  */
              || (beg <= PT && STRINGP (val) && SCHARS (val) == 0)))
        {
-         xassert (end > PT);
+         eassert (end > PT);
          SET_PT (PT < last_pt
                  ? (STRINGP (val) && SCHARS (val) == 0
                     ? max (beg - 1, BEGV)
@@ -1831,7 +1830,7 @@ adjust_point_for_property (EMACS_INT last_pt, int modified)
 #if 0 /* This assertion isn't correct, because SET_PT may end up setting
         the point to something other than its argument, due to
         point-motion hooks, intangibility, etc.  */
-         xassert (PT == beg || PT == end);
+         eassert (PT == beg || PT == end);
 #endif
 
          /* Pretend the area doesn't exist if the buffer is not
@@ -1937,7 +1936,7 @@ safe_run_hooks (Lisp_Object hook)
   /* FIXME: our `internal_condition_case' does not provide any way to pass data
      to its body or to its handlers other than via globals such as
      dynamically-bound variables ;-)  */
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   specbind (Qinhibit_quit, hook);
 
   run_hook_with_args (1, &hook, safe_run_hook_funcall);
@@ -2017,12 +2016,12 @@ start_polling (void)
       if (poll_timer == NULL
          || EMACS_SECS (poll_timer->interval) != polling_period)
        {
-         EMACS_TIME interval;
+         time_t period = max (1, min (polling_period, TYPE_MAXIMUM (time_t)));
+         EMACS_TIME interval = make_emacs_time (period, 0);
 
          if (poll_timer)
            cancel_atimer (poll_timer);
 
-         EMACS_SET_SECS_USECS (interval, polling_period, 0);
          poll_timer = start_atimer (ATIMER_CONTINUOUS, interval,
                                     poll_for_input, NULL);
        }
@@ -2090,7 +2089,7 @@ void
 bind_polling_period (int n)
 {
 #ifdef POLL_FOR_INPUT
-  int new = polling_period;
+  EMACS_INT new = polling_period;
 
   if (n > new)
     new = n;
@@ -2220,7 +2219,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
 /* Input of single characters from keyboard */
 
 static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, int *used_mouse_menu,
-                                        struct timeval *end_time);
+                                        EMACS_TIME *end_time);
 static void record_char (Lisp_Object c);
 
 static Lisp_Object help_form_saved_window_configs;
@@ -2272,10 +2271,10 @@ do { if (polling_stopped_here) start_polling ();        \
 Lisp_Object
 read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
           Lisp_Object prev_event,
-          int *used_mouse_menu, struct timeval *end_time)
+          int *used_mouse_menu, EMACS_TIME *end_time)
 {
   volatile Lisp_Object c;
-  int jmpcount;
+  ptrdiff_t jmpcount;
   jmp_buf local_getcjmp;
   jmp_buf save_jump;
   volatile int key_already_recorded = 0;
@@ -2664,7 +2663,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
   if (INTERACTIVE && NILP (c))
     {
       int delay_level;
-      EMACS_INT buffer_size;
+      ptrdiff_t buffer_size;
 
       /* Slow down auto saves logarithmically in size of current buffer,
         and garbage collect while we're at it.  */
@@ -2685,8 +2684,9 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
          && XINT (Vauto_save_timeout) > 0)
        {
          Lisp_Object tem0;
-         int timeout = delay_level * XFASTINT (Vauto_save_timeout) / 4;
-
+         EMACS_INT timeout = (delay_level
+                              * min (XFASTINT (Vauto_save_timeout) / 4,
+                                     MOST_POSITIVE_FIXNUM / delay_level));
          save_getcjmp (save_jump);
          restore_getcjmp (local_getcjmp);
          tem0 = sit_for (make_number (timeout), 1, 1);
@@ -2785,13 +2785,8 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
     {
       KBOARD *kb IF_LINT (= NULL);
 
-      if (end_time)
-       {
-         EMACS_TIME now;
-         EMACS_GET_TIME (now);
-         if (EMACS_TIME_GE (now, *end_time))
-           goto exit;
-       }
+      if (end_time && EMACS_TIME_LE (*end_time, current_emacs_time ()))
+       goto exit;
 
       /* Actually read a character, waiting if necessary.  */
       save_getcjmp (save_jump);
@@ -2880,7 +2875,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
       struct buffer *prev_buffer = current_buffer;
 #if 0 /* This shouldn't be necessary anymore. --lorentey  */
       int was_locked = single_kboard;
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       record_single_kboard_state ();
 #endif
 
@@ -2984,11 +2979,16 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
      own stuff with the echo area.  */
   if (!CONSP (c)
       || (!(EQ (Qhelp_echo, XCAR (c)))
-         && !(EQ (Qswitch_frame, XCAR (c)))))
+         && !(EQ (Qswitch_frame, XCAR (c)))
+         /* Don't wipe echo area for select window events: These might
+            get delayed via `mouse-autoselect-window' (Bug#11304).  */
+         && !(EQ (Qselect_window, XCAR (c)))))
     {
       if (!NILP (echo_area_buffer[0]))
-       safe_run_hooks (Qecho_area_clear_hook);
-      clear_message (1, 0);
+       {
+         safe_run_hooks (Qecho_area_clear_hook);
+         clear_message (1, 0);
+       }
     }
 
  reread_for_input_method:
@@ -3002,9 +3002,10 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
       && ' ' <= XINT (c) && XINT (c) < 256 && XINT (c) != 127)
     {
       Lisp_Object keys;
-      int key_count, key_count_reset;
+      ptrdiff_t key_count;
+      int key_count_reset;
       struct gcpro gcpro1;
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
 
       /* Save the echo status.  */
       int saved_immediate_echo = current_kboard->immediate_echo;
@@ -3141,7 +3142,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
   /* Process the help character specially if enabled */
   if (!NILP (Vhelp_form) && help_char_p (c))
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
 
       help_form_saved_window_configs
        = Fcons (Fcurrent_window_configuration (Qnil),
@@ -3301,7 +3302,7 @@ record_char (Lisp_Object c)
 
   if (!recorded)
     {
-      total_keys++;
+      total_keys += total_keys < NUM_RECENT_KEYS;
       ASET (recent_keys, recent_keys_index, c);
       if (++recent_keys_index >= NUM_RECENT_KEYS)
        recent_keys_index = 0;
@@ -3670,7 +3671,7 @@ kbd_buffer_unget_event (register struct input_event *event)
 
 void
 gen_help_event (Lisp_Object help, Lisp_Object frame, Lisp_Object window,
-               Lisp_Object object, EMACS_INT pos)
+               Lisp_Object object, ptrdiff_t pos)
 {
   struct input_event event;
 
@@ -3773,9 +3774,8 @@ clear_event (struct input_event *event)
 static Lisp_Object
 kbd_buffer_get_event (KBOARD **kbp,
                       int *used_mouse_menu,
-                      struct timeval *end_time)
+                      EMACS_TIME *end_time)
 {
-  register int c;
   Lisp_Object obj;
 
 #ifdef subprocesses
@@ -3792,16 +3792,18 @@ kbd_buffer_get_event (KBOARD **kbp,
     }
 #endif /* subprocesses */
 
+#ifndef HAVE_DBUS  /* We want to read D-Bus events in batch mode.  */
   if (noninteractive
       /* In case we are running as a daemon, only do this before
         detaching from the terminal.  */
       || (IS_DAEMON && daemon_pipe[1] >= 0))
     {
-      c = getchar ();
+      int c = getchar ();
       XSETINT (obj, c);
       *kbp = current_kboard;
       return obj;
     }
+#endif /* ! HAVE_DBUS  */
 
   /* Wait until there is input available.  */
   for (;;)
@@ -3839,15 +3841,15 @@ kbd_buffer_get_event (KBOARD **kbp,
 #endif
       if (end_time)
        {
-         EMACS_TIME duration;
-         EMACS_GET_TIME (duration);
-         if (EMACS_TIME_GE (duration, *end_time))
-           return Qnil;        /* finished waiting */
+         EMACS_TIME now = current_emacs_time ();
+         if (EMACS_TIME_LE (*end_time, now))
+           return Qnil;        /* Finished waiting.  */
          else
            {
-             EMACS_SUB_TIME (duration, *end_time, duration);
-             wait_reading_process_output (EMACS_SECS (duration),
-                                          EMACS_USECS (duration),
+             EMACS_TIME duration = sub_emacs_time (*end_time, now);
+             wait_reading_process_output (min (EMACS_SECS (duration),
+                                               WAIT_READING_MAX),
+                                          EMACS_NSECS (duration),
                                           -1, 1, Qnil, NULL, 0);
            }
        }
@@ -3969,9 +3971,11 @@ kbd_buffer_get_event (KBOARD **kbp,
 #if defined (WINDOWSNT)
       else if (event->kind == LANGUAGE_CHANGE_EVENT)
        {
-         /* Make an event (language-change (FRAME CHARSET LCID)).  */
-         obj = Fcons (event->frame_or_window, Qnil);
-         obj = Fcons (Qlanguage_change, Fcons (obj, Qnil));
+         /* Make an event (language-change (FRAME CODEPAGE LANGUAGE-ID)).  */
+         obj = Fcons (Qlanguage_change,
+                      list3 (event->frame_or_window,
+                             make_number (event->code),
+                             make_number (event->modifiers)));
          kbd_fetch_ptr = event + 1;
        }
 #endif
@@ -4242,11 +4246,10 @@ timer_start_idle (void)
   Lisp_Object timers;
 
   /* If we are already in the idle state, do nothing.  */
-  if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
+  if (EMACS_TIME_VALID_P (timer_idleness_start_time))
     return;
 
-  EMACS_GET_TIME (timer_idleness_start_time);
-
+  timer_idleness_start_time = current_emacs_time ();
   timer_last_idleness_start_time = timer_idleness_start_time;
 
   /* Mark all idle-time timers as once again candidates for running.  */
@@ -4256,9 +4259,9 @@ timer_start_idle (void)
 
       timer = XCAR (timers);
 
-      if (!VECTORP (timer) || ASIZE (timer) != 8)
+      if (!VECTORP (timer) || ASIZE (timer) != 9)
        continue;
-      XVECTOR (timer)->contents[0] = Qnil;
+      ASET (timer, 0, Qnil);
     }
 }
 
@@ -4267,7 +4270,7 @@ timer_start_idle (void)
 static void
 timer_stop_idle (void)
 {
-  EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1);
+  timer_idleness_start_time = invalid_emacs_time ();
 }
 
 /* Resume idle timer from last idle start time.  */
@@ -4275,7 +4278,7 @@ timer_stop_idle (void)
 static void
 timer_resume_idle (void)
 {
-  if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
+  if (EMACS_TIME_VALID_P (timer_idleness_start_time))
     return;
 
   timer_idleness_start_time = timer_last_idleness_start_time;
@@ -4289,6 +4292,24 @@ struct input_event last_timer_event EXTERNALLY_VISIBLE;
    ...).  Each element has the form (FUN . ARGS).  */
 Lisp_Object pending_funcalls;
 
+/* If TIMER is a valid timer, return nonzero and place its value into
+   *RESULT.  Otherwise return zero.  */
+static int
+decode_timer (Lisp_Object timer, EMACS_TIME *result)
+{
+  Lisp_Object *vector;
+
+  if (! (VECTORP (timer) && ASIZE (timer) == 9))
+    return 0;
+  vector = XVECTOR (timer)->contents;
+  if (! NILP (vector[0]))
+    return 0;
+
+  return decode_time_components (vector[1], vector[2], vector[3], vector[4],
+                                result, 0);
+}
+
+
 /* Check whether a timer has fired.  To prevent larger problems we simply
    disregard elements that are not proper timers.  Do not make a circular
    timer list for the time being.
@@ -4306,17 +4327,16 @@ timer_check_2 (void)
 {
   EMACS_TIME nexttime;
   EMACS_TIME now;
-  EMACS_TIME idleness_now IF_LINT (= {0});
+  EMACS_TIME idleness_now;
   Lisp_Object timers, idle_timers, chosen_timer;
   struct gcpro gcpro1, gcpro2, gcpro3;
 
-  EMACS_SET_SECS (nexttime, -1);
-  EMACS_SET_USECS (nexttime, -1);
+  nexttime = invalid_emacs_time ();
 
   /* Always consider the ordinary timers.  */
   timers = Vtimer_list;
   /* Consider the idle timers only if Emacs is idle.  */
-  if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
+  if (EMACS_TIME_VALID_P (timer_idleness_start_time))
     idle_timers = Vtimer_idle_list;
   else
     idle_timers = Qnil;
@@ -4333,9 +4353,10 @@ timer_check_2 (void)
 
   if (CONSP (timers) || CONSP (idle_timers))
     {
-      EMACS_GET_TIME (now);
-      if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
-       EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time);
+      now = current_emacs_time ();
+      idleness_now = (EMACS_TIME_VALID_P (timer_idleness_start_time)
+                     ? sub_emacs_time (now, timer_idleness_start_time)
+                     : make_emacs_time (0, 0));
     }
 
   while (CONSP (timers) || CONSP (idle_timers))
@@ -4344,116 +4365,82 @@ timer_check_2 (void)
       Lisp_Object timer = Qnil, idle_timer = Qnil;
       EMACS_TIME timer_time, idle_timer_time;
       EMACS_TIME difference;
-      EMACS_TIME timer_difference IF_LINT (= {0});
-      EMACS_TIME idle_timer_difference IF_LINT (= {0});
+      EMACS_TIME timer_difference = invalid_emacs_time ();
+      EMACS_TIME idle_timer_difference = invalid_emacs_time ();
+      int ripe, timer_ripe = 0, idle_timer_ripe = 0;
 
-      /* Skip past invalid timers and timers already handled.  */
+      /* Set TIMER and TIMER_DIFFERENCE
+        based on the next ordinary timer.
+        TIMER_DIFFERENCE is the distance in time from NOW to when
+        this timer becomes ripe (negative if it's already ripe).
+         Skip past invalid timers and timers already handled.  */
       if (CONSP (timers))
        {
          timer = XCAR (timers);
-         if (!VECTORP (timer) || ASIZE (timer) != 8)
+         if (! decode_timer (timer, &timer_time))
            {
              timers = XCDR (timers);
              continue;
            }
-         vector = XVECTOR (timer)->contents;
 
-         if (!INTEGERP (vector[1]) || !INTEGERP (vector[2])
-             || !INTEGERP (vector[3])
-             || ! NILP (vector[0]))
-           {
-             timers = XCDR (timers);
-             continue;
-           }
+         timer_ripe = EMACS_TIME_LE (timer_time, now);
+         timer_difference = (timer_ripe
+                             ? sub_emacs_time (now, timer_time)
+                             : sub_emacs_time (timer_time, now));
        }
+
+      /* Likewise for IDLE_TIMER and IDLE_TIMER_DIFFERENCE
+        based on the next idle timer.  */
       if (CONSP (idle_timers))
        {
-         timer = XCAR (idle_timers);
-         if (!VECTORP (timer) || ASIZE (timer) != 8)
-           {
-             idle_timers = XCDR (idle_timers);
-             continue;
-           }
-         vector = XVECTOR (timer)->contents;
-
-         if (!INTEGERP (vector[1]) || !INTEGERP (vector[2])
-             || !INTEGERP (vector[3])
-             || ! NILP (vector[0]))
+         idle_timer = XCAR (idle_timers);
+         if (! decode_timer (idle_timer, &idle_timer_time))
            {
              idle_timers = XCDR (idle_timers);
              continue;
            }
-       }
-
-      /* Set TIMER, TIMER_TIME and TIMER_DIFFERENCE
-        based on the next ordinary timer.
-        TIMER_DIFFERENCE is the distance in time from NOW to when
-        this timer becomes ripe (negative if it's already ripe).  */
-      if (CONSP (timers))
-       {
-         timer = XCAR (timers);
-         vector = XVECTOR (timer)->contents;
-         EMACS_SET_SECS (timer_time,
-                         (XINT (vector[1]) << 16) | (XINT (vector[2])));
-         EMACS_SET_USECS (timer_time, XINT (vector[3]));
-         EMACS_SUB_TIME (timer_difference, timer_time, now);
-       }
 
-      /* Set IDLE_TIMER, IDLE_TIMER_TIME and IDLE_TIMER_DIFFERENCE
-        based on the next idle timer.  */
-      if (CONSP (idle_timers))
-       {
-         idle_timer = XCAR (idle_timers);
-         vector = XVECTOR (idle_timer)->contents;
-         EMACS_SET_SECS (idle_timer_time,
-                         (XINT (vector[1]) << 16) | (XINT (vector[2])));
-         EMACS_SET_USECS (idle_timer_time, XINT (vector[3]));
-         EMACS_SUB_TIME (idle_timer_difference, idle_timer_time, idleness_now);
+         idle_timer_ripe = EMACS_TIME_LE (idle_timer_time, idleness_now);
+         idle_timer_difference =
+           (idle_timer_ripe
+            ? sub_emacs_time (idleness_now, idle_timer_time)
+            : sub_emacs_time (idle_timer_time, idleness_now));
        }
 
       /* Decide which timer is the next timer,
-        and set CHOSEN_TIMER, VECTOR and DIFFERENCE accordingly.
+        and set CHOSEN_TIMER, DIFFERENCE, and RIPE accordingly.
         Also step down the list where we found that timer.  */
 
-      if (CONSP (timers) && CONSP (idle_timers))
-       {
-         EMACS_TIME temp;
-         EMACS_SUB_TIME (temp, timer_difference, idle_timer_difference);
-         if (EMACS_TIME_NEG_P (temp))
-           {
-             chosen_timer = timer;
-             timers = XCDR (timers);
-             difference = timer_difference;
-           }
-         else
-           {
-             chosen_timer = idle_timer;
-             idle_timers = XCDR (idle_timers);
-             difference = idle_timer_difference;
-           }
-       }
-      else if (CONSP (timers))
+      if (EMACS_TIME_VALID_P (timer_difference)
+         && (! EMACS_TIME_VALID_P (idle_timer_difference)
+             || idle_timer_ripe < timer_ripe
+             || (idle_timer_ripe == timer_ripe
+                 && (timer_ripe
+                     ? EMACS_TIME_LT (idle_timer_difference,
+                                      timer_difference)
+                     : EMACS_TIME_LT (timer_difference,
+                                      idle_timer_difference)))))
        {
          chosen_timer = timer;
          timers = XCDR (timers);
          difference = timer_difference;
+         ripe = timer_ripe;
        }
       else
        {
          chosen_timer = idle_timer;
          idle_timers = XCDR (idle_timers);
          difference = idle_timer_difference;
+         ripe = idle_timer_ripe;
        }
-      vector = XVECTOR (chosen_timer)->contents;
 
       /* If timer is ripe, run it if it hasn't been run.  */
-      if (EMACS_TIME_NEG_P (difference)
-         || (EMACS_SECS (difference) == 0
-             && EMACS_USECS (difference) == 0))
+      if (ripe)
        {
+         vector = XVECTOR (chosen_timer)->contents;
          if (NILP (vector[0]))
            {
-             int count = SPECPDL_INDEX ();
+             ptrdiff_t count = SPECPDL_INDEX ();
              Lisp_Object old_deactivate_mark = Vdeactivate_mark;
 
              /* Mark the timer as triggered to prevent problems if the lisp
@@ -4473,8 +4460,7 @@ timer_check_2 (void)
                  return 0 to indicate that.  */
            }
 
-          EMACS_SET_SECS (nexttime, 0);
-          EMACS_SET_USECS (nexttime, 0);
+         nexttime = make_emacs_time (0, 0);
        }
       else
        /* When we encounter a timer that is still waiting,
@@ -4497,7 +4483,7 @@ timer_check_2 (void)
    timer list for the time being.
 
    Returns the time to wait until the next timer fires.
-   If no timer is active, return -1.
+   If no timer is active, return an invalid value.
 
    As long as any timer is ripe, we run it.  */
 
@@ -4510,34 +4496,24 @@ timer_check (void)
     {
       nexttime = timer_check_2 ();
     }
-  while (EMACS_SECS (nexttime) == 0 && EMACS_USECS (nexttime) == 0);
+  while (EMACS_SECS (nexttime) == 0 && EMACS_NSECS (nexttime) == 0);
 
   return nexttime;
 }
 
 DEFUN ("current-idle-time", Fcurrent_idle_time, Scurrent_idle_time, 0, 0, 0,
        doc: /* Return the current length of Emacs idleness, or nil.
-The value when Emacs is idle is a list of three integers.  The first has
-the most significant 16 bits of the seconds, while the second has the least
-significant 16 bits.  The third integer gives the microsecond count.
+The value when Emacs is idle is a list of four integers (HIGH LOW USEC PSEC)
+in the same style as (current-time).
 
 The value when Emacs is not idle is nil.
 
-The microsecond count is zero on systems that do not provide
-resolution finer than a second.  */)
+NSEC is a multiple of the system clock resolution.  */)
   (void)
 {
-  if (! EMACS_TIME_NEG_P (timer_idleness_start_time))
-    {
-      EMACS_TIME now, idleness_now;
-
-      EMACS_GET_TIME (now);
-      EMACS_SUB_TIME (idleness_now, now, timer_idleness_start_time);
-
-      return list3 (make_number ((EMACS_SECS (idleness_now) >> 16) & 0xffff),
-                   make_number ((EMACS_SECS (idleness_now) >> 0)  & 0xffff),
-                   make_number (EMACS_USECS (idleness_now)));
-    }
+  if (EMACS_TIME_VALID_P (timer_idleness_start_time))
+    return make_lisp_time (sub_emacs_time (current_emacs_time (),
+                                          timer_idleness_start_time));
 
   return Qnil;
 }
@@ -5164,7 +5140,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
       /* It's a click in window WINDOW at frame coordinates (X,Y)  */
       struct window *w = XWINDOW (window);
       Lisp_Object string_info = Qnil;
-      EMACS_INT textpos = -1;
+      ptrdiff_t textpos = -1;
       int col = -1, row = -1;
       int dx  = -1, dy  = -1;
       int width = -1, height = -1;
@@ -5188,7 +5164,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
       else if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
        {
          Lisp_Object string;
-         EMACS_INT charpos;
+         ptrdiff_t charpos;
 
          posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line;
          /* Note that mode_line_string takes COL, ROW as pixels and
@@ -5211,7 +5187,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y,
       else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
        {
          Lisp_Object string;
-         EMACS_INT charpos;
+         ptrdiff_t charpos;
 
          posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin;
          col = wx;
@@ -5439,7 +5415,7 @@ make_lispy_event (struct input_event *event)
                                      Qfunction_key,
                                      KVAR (current_kboard, Vsystem_key_alist),
                                      0, &KVAR (current_kboard, system_key_syms),
-                                     TYPE_MAXIMUM (EMACS_INT));
+                                     PTRDIFF_MAX);
        }
 
       return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET,
@@ -5571,9 +5547,10 @@ make_lispy_event (struct input_event *event)
 
        if (button >= ASIZE (button_down_location))
          {
+           ptrdiff_t incr = button - ASIZE (button_down_location) + 1;
            button_down_location = larger_vector (button_down_location,
-                                                 button + 1, Qnil);
-           mouse_syms = larger_vector (mouse_syms, button + 1, Qnil);
+                                                 incr, -1);
+           mouse_syms = larger_vector (mouse_syms, incr, -1);
          }
 
        start_pos_ptr = &AREF (button_down_location, button);
@@ -5873,7 +5850,9 @@ make_lispy_event (struct input_event *event)
        event->modifiers &= ~up_modifier;
 
        if (event->code >= ASIZE (mouse_syms))
-          mouse_syms = larger_vector (mouse_syms, event->code + 1, Qnil);
+          mouse_syms = larger_vector (mouse_syms,
+                                     event->code - ASIZE (mouse_syms) + 1,
+                                     -1);
 
        /* Get the symbol we should use for the mouse click.  */
        head = modify_event_symbol (event->code,
@@ -5976,9 +5955,10 @@ make_lispy_event (struct input_event *event)
 
        if (button >= ASIZE (button_down_location))
          {
+           ptrdiff_t incr = button - ASIZE (button_down_location) + 1;
            button_down_location = larger_vector (button_down_location,
-                                                 button + 1, Qnil);
-           mouse_syms = larger_vector (mouse_syms, button + 1, Qnil);
+                                                 incr, -1);
+           mouse_syms = larger_vector (mouse_syms, incr, -1);
          }
 
        start_pos_ptr = &AREF (button_down_location, button);
@@ -6080,10 +6060,10 @@ make_lispy_switch_frame (Lisp_Object frame)
    This doesn't use any caches.  */
 
 static int
-parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end)
+parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t *modifier_end)
 {
   Lisp_Object name;
-  EMACS_INT i;
+  ptrdiff_t i;
   int modifiers;
 
   CHECK_SYMBOL (symbol);
@@ -6091,9 +6071,9 @@ parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end)
   modifiers = 0;
   name = SYMBOL_NAME (symbol);
 
-  for (i = 0; i+2 <= SBYTES (name); )
+  for (i = 0; i < SBYTES (name) - 1; )
     {
-      EMACS_INT this_mod_end = 0;
+      ptrdiff_t this_mod_end = 0;
       int this_mod = 0;
 
       /* See if the name continues with a modifier word.
@@ -6133,7 +6113,7 @@ parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end)
 
 #define MULTI_LETTER_MOD(BIT, NAME, LEN)                       \
          if (i + LEN + 1 <= SBYTES (name)                      \
-             && ! strncmp (SSDATA (name) + i, NAME, LEN))      \
+             && ! memcmp (SDATA (name) + i, NAME, LEN))        \
            {                                                   \
              this_mod_end = i + LEN;                           \
              this_mod = BIT;                                   \
@@ -6171,13 +6151,13 @@ parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end)
   if (! (modifiers & (down_modifier | drag_modifier
                      | double_modifier | triple_modifier))
       && i + 7 == SBYTES (name)
-      && strncmp (SSDATA (name) + i, "mouse-", 6) == 0
+      && memcmp (SDATA (name) + i, "mouse-", 6) == 0
       && ('0' <= SREF (name, i + 6) && SREF (name, i + 6) <= '9'))
     modifiers |= click_modifier;
 
   if (! (modifiers & (double_modifier | triple_modifier))
       && i + 6 < SBYTES (name)
-      && strncmp (SSDATA (name) + i, "wheel-", 6) == 0)
+      && memcmp (SDATA (name) + i, "wheel-", 6) == 0)
     modifiers |= click_modifier;
 
   if (modifier_end)
@@ -6195,8 +6175,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_
   /* Since BASE could contain nulls, we can't use intern here; we have
      to use Fintern, which expects a genuine Lisp_String, and keeps a
      reference to it.  */
-  char *new_mods
-    = (char *) alloca (sizeof ("A-C-H-M-S-s-down-drag-double-triple-"));
+  char new_mods[sizeof "A-C-H-M-S-s-down-drag-double-triple-"];
   int mod_len;
 
   {
@@ -6257,7 +6236,7 @@ lispy_modifier_list (int modifiers)
   modifier_list = Qnil;
   for (i = 0; (1<<i) <= modifiers && i < NUM_MOD_NAMES; i++)
     if (modifiers & (1<<i))
-      modifier_list = Fcons (XVECTOR (modifier_symbols)->contents[i],
+      modifier_list = Fcons (AREF (modifier_symbols, i),
                             modifier_list);
 
   return modifier_list;
@@ -6290,7 +6269,7 @@ parse_modifiers (Lisp_Object symbol)
     return elements;
   else
     {
-      EMACS_INT end;
+      ptrdiff_t end;
       int modifiers = parse_modifiers_uncached (symbol, &end);
       Lisp_Object unmodified;
       Lisp_Object mask;
@@ -6456,9 +6435,9 @@ reorder_modifiers (Lisp_Object symbol)
    in the symbol's name.  */
 
 static Lisp_Object
-modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind,
+modify_event_symbol (ptrdiff_t symbol_num, int modifiers, Lisp_Object symbol_kind,
                     Lisp_Object name_alist_or_stem, const char *const *name_table,
-                    Lisp_Object *symbol_table, EMACS_INT table_size)
+                    Lisp_Object *symbol_table, ptrdiff_t table_size)
 {
   Lisp_Object value;
   Lisp_Object symbol_int;
@@ -6488,7 +6467,7 @@ modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object s
          *symbol_table = Fmake_vector (size, Qnil);
        }
 
-      value = XVECTOR (*symbol_table)->contents[symbol_num];
+      value = AREF (*symbol_table, symbol_num);
     }
 
   /* Have we already used this symbol before?  */
@@ -6524,14 +6503,14 @@ modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object s
       if (NILP (value))
        {
          char buf[sizeof "key-" + INT_STRLEN_BOUND (EMACS_INT)];
-         sprintf (buf, "key-%"pI"d", symbol_num);
+         sprintf (buf, "key-%"pD"d", symbol_num);
          value = intern (buf);
        }
 
       if (CONSP (*symbol_table))
         *symbol_table = Fcons (Fcons (symbol_int, value), *symbol_table);
       else
-       XVECTOR (*symbol_table)->contents[symbol_num] = value;
+       ASET (*symbol_table, symbol_num, value);
 
       /* Fill in the cache entries for this symbol; this also
         builds the Qevent_symbol_elements property, which the user
@@ -6630,7 +6609,7 @@ parse_solitary_modifier (Lisp_Object symbol)
 
 #define MULTI_LETTER_MOD(BIT, NAME, LEN)               \
       if (LEN == SBYTES (name)                         \
-         && ! strncmp (SSDATA (name), NAME, LEN))      \
+         && ! memcmp (SDATA (name), NAME, LEN))        \
        return BIT;
 
     case 'A':
@@ -7169,6 +7148,7 @@ tty_read_avail_input (struct terminal *terminal,
   return nread;
 }
 \f
+#if defined SYNC_INPUT || defined SIGIO
 static void
 handle_async_input (void)
 {
@@ -7195,7 +7175,9 @@ handle_async_input (void)
   --handling_signal;
 #endif
 }
+#endif /* SYNC_INPUT || SIGIO */
 
+#ifdef SYNC_INPUT
 void
 process_pending_signals (void)
 {
@@ -7203,6 +7185,7 @@ process_pending_signals (void)
     handle_async_input ();
   do_pending_atimers ();
 }
+#endif
 
 #ifdef SIGIO   /* for entire page */
 /* Note SIGIO has been undef'd if FIONREAD is missing.  */
@@ -7220,7 +7203,7 @@ input_available_signal (int signo)
 #endif
 
   if (input_available_clear_time)
-    EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
+    *input_available_clear_time = make_emacs_time (0, 0);
 
 #ifndef SYNC_INPUT
   handle_async_input ();
@@ -7275,7 +7258,7 @@ add_user_signal (int sig, const char *name)
       /* Already added.  */
       return;
 
-  p = xmalloc (sizeof (struct user_signal_info));
+  p = xmalloc (sizeof *p);
   p->sig = sig;
   p->name = xstrdup (name);
   p->npending = 0;
@@ -7300,8 +7283,8 @@ handle_user_signal (int sig)
   for (p = user_signals; p; p = p->next)
     if (p->sig == sig)
       {
-        if (special_event_name &&
-            strcmp (special_event_name, p->name) == 0)
+        if (special_event_name
+           && strcmp (special_event_name, p->name) == 0)
           {
             /* Enter the debugger in many ways.  */
             debug_on_next_call = 1;
@@ -7323,7 +7306,7 @@ handle_user_signal (int sig)
            /* Tell wait_reading_process_output that it needs to wake
               up and look around.  */
            if (input_available_clear_time)
-             EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
+             *input_available_clear_time = make_emacs_time (0, 0);
          }
        break;
       }
@@ -7414,7 +7397,7 @@ menu_separator_name_p (const char *label)
   if (!label)
     return 0;
   else if (strlen (label) > 3
-          && strncmp (label, "--", 2) == 0
+          && memcmp (label, "--", 2) == 0
           && label[2] != '-')
     {
       int i;
@@ -7501,7 +7484,7 @@ menu_bar_items (Lisp_Object old)
        Lisp_Object tem;
        ptrdiff_t nminor;
        nminor = current_minor_maps (NULL, &tmaps);
-       maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0]));
+       maps = alloca ((nminor + 3) * sizeof *maps);
        nmaps = 0;
        if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
          maps[nmaps++] = tem;
@@ -7534,23 +7517,23 @@ menu_bar_items (Lisp_Object old)
       int end = menu_bar_items_index;
 
       for (i = 0; i < end; i += 4)
-       if (EQ (XCAR (tail), XVECTOR (menu_bar_items_vector)->contents[i]))
+       if (EQ (XCAR (tail), AREF (menu_bar_items_vector, i)))
          {
            Lisp_Object tem0, tem1, tem2, tem3;
            /* Move the item at index I to the end,
               shifting all the others forward.  */
-           tem0 = XVECTOR (menu_bar_items_vector)->contents[i + 0];
-           tem1 = XVECTOR (menu_bar_items_vector)->contents[i + 1];
-           tem2 = XVECTOR (menu_bar_items_vector)->contents[i + 2];
-           tem3 = XVECTOR (menu_bar_items_vector)->contents[i + 3];
+           tem0 = AREF (menu_bar_items_vector, i + 0);
+           tem1 = AREF (menu_bar_items_vector, i + 1);
+           tem2 = AREF (menu_bar_items_vector, i + 2);
+           tem3 = AREF (menu_bar_items_vector, i + 3);
            if (end > i + 4)
-             memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
-                      &XVECTOR (menu_bar_items_vector)->contents[i + 4],
+             memmove (&AREF (menu_bar_items_vector, i),
+                      &AREF (menu_bar_items_vector, i + 4),
                       (end - i - 4) * sizeof (Lisp_Object));
-           XVECTOR (menu_bar_items_vector)->contents[end - 4] = tem0;
-           XVECTOR (menu_bar_items_vector)->contents[end - 3] = tem1;
-           XVECTOR (menu_bar_items_vector)->contents[end - 2] = tem2;
-           XVECTOR (menu_bar_items_vector)->contents[end - 1] = tem3;
+           ASET (menu_bar_items_vector, end - 4, tem0);
+           ASET (menu_bar_items_vector, end - 3, tem1);
+           ASET (menu_bar_items_vector, end - 2, tem2);
+           ASET (menu_bar_items_vector, end - 1, tem3);
            break;
          }
     }
@@ -7560,12 +7543,12 @@ menu_bar_items (Lisp_Object old)
     int i = menu_bar_items_index;
     if (i + 4 > ASIZE (menu_bar_items_vector))
       menu_bar_items_vector =
-       larger_vector (menu_bar_items_vector, 2 * i, Qnil);
+       larger_vector (menu_bar_items_vector, 4, -1);
     /* Add this item.  */
-    XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
-    XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
-    XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
-    XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil;
+    ASET (menu_bar_items_vector, i, Qnil); i++;
+    ASET (menu_bar_items_vector, i, Qnil); i++;
+    ASET (menu_bar_items_vector, i, Qnil); i++;
+    ASET (menu_bar_items_vector, i, Qnil); i++;
     menu_bar_items_index = i;
   }
 
@@ -7591,11 +7574,11 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
         discard any previously made menu bar item.  */
 
       for (i = 0; i < menu_bar_items_index; i += 4)
-       if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
+       if (EQ (key, AREF (menu_bar_items_vector, i)))
          {
            if (menu_bar_items_index > i + 4)
-             memmove (&XVECTOR (menu_bar_items_vector)->contents[i],
-                      &XVECTOR (menu_bar_items_vector)->contents[i + 4],
+             memmove (&AREF (menu_bar_items_vector, i),
+                      &AREF (menu_bar_items_vector, i + 4),
                       (menu_bar_items_index - i - 4) * sizeof (Lisp_Object));
            menu_bar_items_index -= 4;
          }
@@ -7619,11 +7602,11 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
   if (!i)
     return;
 
-  item = XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF];
+  item = AREF (item_properties, ITEM_PROPERTY_DEF);
 
   /* Find any existing item for this KEY.  */
   for (i = 0; i < menu_bar_items_index; i += 4)
-    if (EQ (key, XVECTOR (menu_bar_items_vector)->contents[i]))
+    if (EQ (key, AREF (menu_bar_items_vector, i)))
       break;
 
   /* If we did not find this KEY, add it at the end.  */
@@ -7631,24 +7614,24 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
     {
       /* If vector is too small, get a bigger one.  */
       if (i + 4 > ASIZE (menu_bar_items_vector))
-       menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil);
+       menu_bar_items_vector = larger_vector (menu_bar_items_vector, 4, -1);
       /* Add this item.  */
-      XVECTOR (menu_bar_items_vector)->contents[i++] = key;
-      XVECTOR (menu_bar_items_vector)->contents[i++]
-       = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
-      XVECTOR (menu_bar_items_vector)->contents[i++] = Fcons (item, Qnil);
-      XVECTOR (menu_bar_items_vector)->contents[i++] = make_number (0);
+      ASET (menu_bar_items_vector, i, key); i++;
+      ASET (menu_bar_items_vector, i,
+           AREF (item_properties, ITEM_PROPERTY_NAME)); i++;
+      ASET (menu_bar_items_vector, i, Fcons (item, Qnil)); i++;
+      ASET (menu_bar_items_vector, i, make_number (0)); i++;
       menu_bar_items_index = i;
     }
   /* We did find an item for this KEY.  Add ITEM to its list of maps.  */
   else
     {
       Lisp_Object old;
-      old = XVECTOR (menu_bar_items_vector)->contents[i + 2];
+      old = AREF (menu_bar_items_vector, i + 2);
       /* If the new and the old items are not both keymaps,
         the lookup will only find `item'.  */
       item = Fcons (item, KEYMAPP (item) && KEYMAPP (XCAR (old)) ? old : Qnil);
-      XVECTOR (menu_bar_items_vector)->contents[i + 2] = item;
+      ASET (menu_bar_items_vector, i + 2, item);
     }
 }
 \f
@@ -7675,7 +7658,7 @@ eval_dyn (Lisp_Object form)
 Lisp_Object
 menu_item_eval_property (Lisp_Object sexpr)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object val;
   specbind (Qinhibit_redisplay, Qt);
   val = internal_condition_case_1 (eval_dyn, sexpr, Qerror,
@@ -8028,7 +8011,7 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
   if (!NILP (Voverriding_local_map_menu_flag))
     {
       /* Yes, use them (if non-nil) as well as the global map.  */
-      maps = (Lisp_Object *) alloca (3 * sizeof (maps[0]));
+      maps = alloca (3 * sizeof *maps);
       nmaps = 0;
       if (!NILP (KVAR (current_kboard, Voverriding_terminal_local_map)))
        maps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
@@ -8045,7 +8028,7 @@ tool_bar_items (Lisp_Object reuse, int *nitems)
       Lisp_Object tem;
       ptrdiff_t nminor;
       nminor = current_minor_maps (NULL, &tmaps);
-      maps = (Lisp_Object *) alloca ((nminor + 3) * sizeof (maps[0]));
+      maps = alloca ((nminor + 3) * sizeof *maps);
       nmaps = 0;
       if (tem = get_local_map (PT, current_buffer, Qkeymap), !NILP (tem))
        maps[nmaps++] = tem;
@@ -8165,7 +8148,7 @@ static int
 parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
 {
   /* Access slot with index IDX of vector tool_bar_item_properties.  */
-#define PROP(IDX) XVECTOR (tool_bar_item_properties)->contents[IDX]
+#define PROP(IDX) AREF (tool_bar_item_properties, (IDX))
 
   Lisp_Object filter = Qnil;
   Lisp_Object caption;
@@ -8317,7 +8300,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
       const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : "";
       ptrdiff_t max_lbl =
        2 * max (0, min (tool_bar_max_label_size, STRING_BYTES_BOUND / 2));
-      char *buf = (char *) xmalloc (max_lbl + 1);
+      char *buf = xmalloc (max_lbl + 1);
       Lisp_Object new_lbl;
       ptrdiff_t caption_len = strlen (capt);
 
@@ -8348,7 +8331,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
       if (SCHARS (new_lbl) <= tool_bar_max_label_size)
         PROP (TOOL_BAR_ITEM_LABEL) = new_lbl;
       else
-        PROP (TOOL_BAR_ITEM_LABEL) = make_string ("", 0);
+        PROP (TOOL_BAR_ITEM_LABEL) = empty_unibyte_string;
       xfree (buf);
     }
 
@@ -8400,13 +8383,14 @@ static void
 append_tool_bar_item (void)
 {
   Lisp_Object *to, *from;
+  ptrdiff_t incr =
+    (ntool_bar_items
+     - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS));
 
   /* Enlarge tool_bar_items_vector if necessary.  */
-  if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS
-      >= ASIZE (tool_bar_items_vector))
+  if (0 < incr)
     tool_bar_items_vector
-      = larger_vector (tool_bar_items_vector,
-                      2 * ASIZE (tool_bar_items_vector), Qnil);
+      = larger_vector (tool_bar_items_vector, incr, -1);
 
   /* Append entries from tool_bar_item_properties to the end of
      tool_bar_items_vector.  */
@@ -8469,8 +8453,7 @@ read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps,
       && !EQ (XCAR (prev_event), Qtool_bar))
     {
       /* Display the menu and get the selection.  */
-      Lisp_Object *realmaps
-       = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object));
+      Lisp_Object *realmaps = alloca (nmaps * sizeof *realmaps);
       Lisp_Object value;
       ptrdiff_t nmaps1 = 0;
 
@@ -8564,7 +8547,7 @@ read_char_minibuf_menu_prompt (int commandflag,
   if (width + 4 > read_char_minibuf_menu_width)
     {
       read_char_minibuf_menu_text
-       = (char *) xrealloc (read_char_minibuf_menu_text, width + 4);
+       = xrealloc (read_char_minibuf_menu_text, width + 4);
       read_char_minibuf_menu_width = width + 4;
     }
   menu = read_char_minibuf_menu_text;
@@ -8609,7 +8592,7 @@ read_char_minibuf_menu_prompt (int commandflag,
 
          /* Look at the next element of the map.  */
          if (idx >= 0)
-           elt = XVECTOR (vector)->contents[idx];
+           elt = AREF (vector, idx);
          else
            elt = Fcar_safe (rest);
 
@@ -8644,7 +8627,7 @@ read_char_minibuf_menu_prompt (int commandflag,
                  Lisp_Object upcased_event, downcased_event;
                  Lisp_Object desc = Qnil;
                  Lisp_Object s
-                   = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
+                   = AREF (item_properties, ITEM_PROPERTY_NAME);
 
                  upcased_event = Fupcase (event);
                  downcased_event = Fdowncase (event);
@@ -8662,12 +8645,12 @@ read_char_minibuf_menu_prompt (int commandflag,
                    s = concat2 (s, tem);
 #endif
                  tem
-                   = XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE];
+                   = AREF (item_properties, ITEM_PROPERTY_TYPE);
                  if (EQ (tem, QCradio) || EQ (tem, QCtoggle))
                    {
                      /* Insert button prefix.  */
                      Lisp_Object selected
-                       = XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED];
+                       = AREF (item_properties, ITEM_PROPERTY_SELECTED);
                      if (EQ (tem, QCradio))
                        tem = build_string (NILP (selected) ? "(*) " : "( ) ");
                      else
@@ -8991,15 +8974,15 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
                   int fix_current_buffer)
 {
   Lisp_Object from_string;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   /* How many keys there are in the current key sequence.  */
   int t;
 
   /* The length of the echo buffer when we started reading, and
      the length of this_command_keys when we started reading.  */
-  int echo_start IF_LINT (= 0);
-  int keys_start;
+  ptrdiff_t echo_start IF_LINT (= 0);
+  ptrdiff_t keys_start;
 
   /* The number of keymaps we're scanning right now, and the number of
      keymaps we have allocated space for.  */
@@ -9171,8 +9154,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
     {
       if (2 > nmaps_allocated)
        {
-         submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
-         defs    = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
+         submaps = alloca (2 * sizeof *submaps);
+         defs    = alloca (2 * sizeof *defs);
          nmaps_allocated = 2;
        }
       submaps[nmaps++] = KVAR (current_kboard, Voverriding_terminal_local_map);
@@ -9181,8 +9164,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
     {
       if (2 > nmaps_allocated)
        {
-         submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0]));
-         defs    = (Lisp_Object *) alloca (2 * sizeof (defs[0]));
+         submaps = alloca (2 * sizeof *submaps);
+         defs    = alloca (2 * sizeof *defs);
          nmaps_allocated = 2;
        }
       submaps[nmaps++] = Voverriding_local_map;
@@ -9198,8 +9181,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
 
       if (total > nmaps_allocated)
        {
-         submaps = (Lisp_Object *) alloca (total * sizeof (submaps[0]));
-         defs    = (Lisp_Object *) alloca (total * sizeof (defs[0]));
+         submaps = alloca (total * sizeof *submaps);
+         defs    = alloca (total * sizeof *defs);
          nmaps_allocated = total;
        }
 
@@ -9255,7 +9238,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
         while those allow us to restart the entire key sequence,
         echo_local_start and keys_local_start allow us to throw away
         just one key.  */
-      int echo_local_start IF_LINT (= 0);
+      ptrdiff_t echo_local_start IF_LINT (= 0);
       int keys_local_start;
       ptrdiff_t local_first_binding;
 
@@ -9437,7 +9420,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
              && current_buffer != starting_buffer)
            {
              GROW_RAW_KEYBUF;
-             XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key;
+             ASET (raw_keybuf, raw_keybuf_count, key);
+             raw_keybuf_count++;
              keybuf[t++] = key;
              mock_input = t;
              Vquit_flag = Qnil;
@@ -9515,7 +9499,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
                      && BUFFERP (XWINDOW (window)->buffer)
                      && XBUFFER (XWINDOW (window)->buffer) != current_buffer)
                    {
-                     XVECTOR (raw_keybuf)->contents[raw_keybuf_count++] = key;
+                     ASET (raw_keybuf, raw_keybuf_count, key);
+                     raw_keybuf_count++;
                      keybuf[t] = key;
                      mock_input = t + 1;
 
@@ -10143,7 +10128,7 @@ will read just one key sequence.  */)
   Lisp_Object keybuf[30];
   register int i;
   struct gcpro gcpro1;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   if (!NILP (prompt))
     CHECK_STRING (prompt);
@@ -10200,7 +10185,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
   Lisp_Object keybuf[30];
   register int i;
   struct gcpro gcpro1;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   if (!NILP (prompt))
     CHECK_STRING (prompt);
@@ -10213,7 +10198,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
 
   memset (keybuf, 0, sizeof keybuf);
   GCPRO1 (keybuf[0]);
-  gcpro1.nvars = (sizeof keybuf/sizeof (keybuf[0]));
+  gcpro1.nvars = (sizeof keybuf / sizeof (keybuf[0]));
 
   if (NILP (continue_echo))
     {
@@ -10227,7 +10212,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector,
     cancel_hourglass ();
 #endif
 
-  i = read_key_sequence (keybuf, (sizeof keybuf/sizeof (keybuf[0])),
+  i = read_key_sequence (keybuf, (sizeof keybuf / sizeof (keybuf[0])),
                         prompt, ! NILP (dont_downcase_last),
                         ! NILP (can_return_switch_frame), 0);
 
@@ -10333,146 +10318,6 @@ a special event, so ignore the prefix argument and don't clear it.  */)
 }
 
 
-\f
-DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_command,
-       1, 1, "P",
-       doc: /* Read function name, then read its arguments and call it.
-
-To pass a numeric argument to the command you are invoking with, specify
-the numeric argument to this command.
-
-Noninteractively, the argument PREFIXARG is the prefix argument to
-give to the command you invoke, if it asks for an argument.  */)
-  (Lisp_Object prefixarg)
-{
-  Lisp_Object function;
-  EMACS_INT saved_last_point_position;
-  Lisp_Object saved_keys, saved_last_point_position_buffer;
-  Lisp_Object bindings, value;
-  struct gcpro gcpro1, gcpro2, gcpro3;
-#ifdef HAVE_WINDOW_SYSTEM
-  /* The call to Fcompleting_read will start and cancel the hourglass,
-     but if the hourglass was already scheduled, this means that no
-     hourglass will be shown for the actual M-x command itself.
-     So we restart it if it is already scheduled.  Note that checking
-     hourglass_shown_p is not enough,  normally the hourglass is not shown,
-     just scheduled to be shown.  */
-  int hstarted = hourglass_started ();
-#endif
-
-  saved_keys = Fvector (this_command_key_count,
-                       XVECTOR (this_command_keys)->contents);
-  saved_last_point_position_buffer = last_point_position_buffer;
-  saved_last_point_position = last_point_position;
-  GCPRO3 (saved_keys, prefixarg, saved_last_point_position_buffer);
-
-  function = call0 (intern ("read-extended-command"));
-
-#ifdef HAVE_WINDOW_SYSTEM
-  if (hstarted) start_hourglass ();
-#endif
-
-  if (STRINGP (function) && SCHARS (function) == 0)
-    error ("No command name given");
-
-  /* Set this_command_keys to the concatenation of saved_keys and
-     function, followed by a RET.  */
-  {
-    Lisp_Object *keys;
-    int i;
-
-    this_command_key_count = 0;
-    this_command_key_count_reset = 0;
-    this_single_command_key_start = 0;
-
-    keys = XVECTOR (saved_keys)->contents;
-    for (i = 0; i < ASIZE (saved_keys); i++)
-      add_command_key (keys[i]);
-
-    for (i = 0; i < SCHARS (function); i++)
-      add_command_key (Faref (function, make_number (i)));
-
-    add_command_key (make_number ('\015'));
-  }
-
-  last_point_position = saved_last_point_position;
-  last_point_position_buffer = saved_last_point_position_buffer;
-
-  UNGCPRO;
-
-  function = Fintern (function, Qnil);
-  KVAR (current_kboard, Vprefix_arg) = prefixarg;
-  Vthis_command = function;
-  real_this_command = function;
-
-  /* If enabled, show which key runs this command.  */
-  if (!NILP (Vsuggest_key_bindings)
-      && NILP (Vexecuting_kbd_macro)
-      && SYMBOLP (function))
-    bindings = Fwhere_is_internal (function, Voverriding_local_map,
-                                  Qt, Qnil, Qnil);
-  else
-    bindings = Qnil;
-
-  value = Qnil;
-  GCPRO3 (bindings, value, function);
-  value = Fcommand_execute (function, Qt, Qnil, Qnil);
-
-  /* If the command has a key binding, print it now.  */
-  if (!NILP (bindings)
-      && ! (VECTORP (bindings) && EQ (Faref (bindings, make_number (0)),
-                                     Qmouse_movement)))
-    {
-      /* But first wait, and skip the message if there is input.  */
-      Lisp_Object waited;
-
-      /* If this command displayed something in the echo area;
-        wait a few seconds, then display our suggestion message.  */
-      if (NILP (echo_area_buffer[0]))
-       waited = sit_for (make_number (0), 0, 2);
-      else if (NUMBERP (Vsuggest_key_bindings))
-       waited = sit_for (Vsuggest_key_bindings, 0, 2);
-      else
-       waited = sit_for (make_number (2), 0, 2);
-
-      if (!NILP (waited) && ! CONSP (Vunread_command_events))
-       {
-         Lisp_Object binding;
-         char *newmessage;
-         int message_p = push_message ();
-         int count = SPECPDL_INDEX ();
-         ptrdiff_t newmessage_len, newmessage_alloc;
-         USE_SAFE_ALLOCA;
-
-         record_unwind_protect (pop_message_unwind, Qnil);
-         binding = Fkey_description (bindings, Qnil);
-         newmessage_alloc =
-           (sizeof "You can run the command `' with "
-            + SBYTES (SYMBOL_NAME (function)) + SBYTES (binding));
-         SAFE_ALLOCA (newmessage, char *, newmessage_alloc);
-         newmessage_len =
-           esprintf (newmessage, "You can run the command `%s' with %s",
-                     SDATA (SYMBOL_NAME (function)),
-                     SDATA (binding));
-         message2 (newmessage,
-                   newmessage_len,
-                   STRING_MULTIBYTE (binding));
-         if (NUMBERP (Vsuggest_key_bindings))
-           waited = sit_for (Vsuggest_key_bindings, 0, 2);
-         else
-           waited = sit_for (make_number (2), 0, 2);
-
-         if (!NILP (waited) && message_p)
-           restore_message ();
-
-         SAFE_FREE ();
-         unbind_to (count, Qnil);
-       }
-    }
-
-  RETURN_UNGCPRO (value);
-}
-
 \f
 /* Return nonzero if input events are pending.  */
 
@@ -10686,7 +10531,7 @@ KEEP-RECORD is non-nil.  */)
   if (NILP (keep_record))
     {
       for (i = 0; i < ASIZE (recent_keys); ++i)
-       XVECTOR (recent_keys)->contents[i] = Qnil;
+       ASET (recent_keys, i, Qnil);
       total_keys = 0;
       recent_keys_index = 0;
     }
@@ -10768,7 +10613,7 @@ Some operating systems cannot stop the Emacs process and resume it later.
 On such systems, Emacs starts a subshell instead of suspending.  */)
   (Lisp_Object stuffstring)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   int old_height, old_width;
   int width, height;
   struct gcpro gcpro1;
@@ -10824,7 +10669,7 @@ stuff_buffered_input (Lisp_Object stuffstring)
 
   if (STRINGP (stuffstring))
     {
-      register EMACS_INT count;
+      register ptrdiff_t count;
 
       p = SDATA (stuffstring);
       count = SBYTES (stuffstring);
@@ -10855,7 +10700,7 @@ stuff_buffered_input (Lisp_Object stuffstring)
 }
 \f
 void
-set_waiting_for_input (struct timeval *time_to_clear)
+set_waiting_for_input (EMACS_TIME *time_to_clear)
 {
   input_available_clear_time = time_to_clear;
 
@@ -10918,6 +10763,11 @@ interrupt_signal (int signalnum)       /* If we don't have an argument, some */
   errno = old_errno;
 }
 
+/* If Emacs is stuck because `inhibit-quit' is true, then keep track
+   of the number of times C-g has been requested.  If C-g is pressed
+   enough times, then quit anyway.  See bug#6585.  */
+static int force_quit_count;
+
 /* This routine is called at interrupt level in response to C-g.
 
    It is called from the SIGINT handler or kbd_buffer_store_event.
@@ -11036,8 +10886,16 @@ handle_interrupt (void)
          UNGCPRO;
        }
       else
-       /* Else request quit when it's safe */
-       Vquit_flag = Qt;
+        { /* Else request quit when it's safe.  */
+          if (NILP (Vquit_flag))
+           force_quit_count = 0;
+         if (++force_quit_count == 3)
+            {
+              immediate_quit = 1;
+              Vinhibit_quit = Qnil;
+            }
+          Vquit_flag = Qt;
+        }
     }
 
 /* TODO: The longjmp in this call throws the NS event loop integration off,
@@ -11465,7 +11323,7 @@ init_keyboard (void)
   quit_char = Ctl ('g');
   Vunread_command_events = Qnil;
   unread_command_char = -1;
-  EMACS_SET_SECS_USECS (timer_idleness_start_time, -1, -1);
+  timer_idleness_start_time = invalid_emacs_time ();
   total_keys = 0;
   recent_keys_index = 0;
   kbd_fetch_ptr = kbd_buffer;
@@ -11562,7 +11420,7 @@ syms_of_keyboard (void)
   pending_funcalls = Qnil;
   staticpro (&pending_funcalls);
 
-  Vlispy_mouse_stem = make_pure_c_string ("mouse");
+  Vlispy_mouse_stem = build_pure_c_string ("mouse");
   staticpro (&Vlispy_mouse_stem);
 
   /* Tool-bars.  */
@@ -11578,9 +11436,6 @@ syms_of_keyboard (void)
   staticpro (&tool_bar_items_vector);
   tool_bar_items_vector = Qnil;
 
-  staticpro (&real_this_command);
-  real_this_command = Qnil;
-
   DEFSYM (Qtimer_event_handler, "timer-event-handler");
   DEFSYM (Qdisabled_command_function, "disabled-command-function");
   DEFSYM (Qself_insert_command, "self-insert-command");
@@ -11695,7 +11550,7 @@ syms_of_keyboard (void)
     modifier_symbols = Fmake_vector (make_number (len), Qnil);
     for (i = 0; i < len; i++)
       if (modifier_names[i])
-       XVECTOR (modifier_symbols)->contents[i] = intern_c_string (modifier_names[i]);
+       ASET (modifier_symbols, i, intern_c_string (modifier_names[i]));
     staticpro (&modifier_symbols);
   }
 
@@ -11771,7 +11626,6 @@ syms_of_keyboard (void)
   defsubr (&Sset_quit_char);
   defsubr (&Sset_input_mode);
   defsubr (&Scurrent_input_mode);
-  defsubr (&Sexecute_extended_command);
   defsubr (&Sposn_at_point);
   defsubr (&Sposn_at_x_y);
 
@@ -11835,12 +11689,14 @@ was a kill command.
 See Info node `(elisp)Multiple Terminals'.  */);
 
   DEFVAR_KBOARD ("real-last-command", Vreal_last_command,
-                doc: /* Same as `last-command', but never altered by Lisp code.  */);
+                doc: /* Same as `last-command', but never altered by Lisp code.
+Taken from the previous value of `real-this-command'.  */);
 
   DEFVAR_KBOARD ("last-repeatable-command", Vlast_repeatable_command,
                 doc: /* Last command that may be repeated.
 The last command executed that was not bound to an input event.
-This is the command `repeat' will try to repeat.  */);
+This is the command `repeat' will try to repeat.
+Taken from a previous value of `real-this-command'.  */);
 
   DEFVAR_LISP ("this-command", Vthis_command,
               doc: /* The command now being executed.
@@ -11848,6 +11704,10 @@ The command can set this variable; whatever is put here
 will be in `last-command' during the following command.  */);
   Vthis_command = Qnil;
 
+  DEFVAR_LISP ("real-this-command", Vreal_this_command,
+              doc: /* This is like `this-command', except that commands should never modify it.  */);
+  Vreal_this_command = Qnil;
+
   DEFVAR_LISP ("this-command-keys-shift-translated",
               Vthis_command_keys_shift_translated,
               doc: /* Non-nil if the key sequence activating this command was shift-translated.
@@ -12175,12 +12035,6 @@ If this variable is non-nil, `delayed-warnings-hook' will be run
 immediately after running `post-command-hook'.  */);
   Vdelayed_warnings_list = Qnil;
 
-  DEFVAR_LISP ("suggest-key-bindings", Vsuggest_key_bindings,
-              doc: /* Non-nil means show the equivalent key-binding when M-x command has one.
-The value can be a length of time to show the message for.
-If the value is non-nil and not a number, we wait 2 seconds.  */);
-  Vsuggest_key_bindings = Qt;
-
   DEFVAR_LISP ("timer-list", Vtimer_list,
               doc: /* List of active absolute time timers in order of increasing time.  */);
   Vtimer_list = Qnil;
@@ -12310,7 +12164,7 @@ variable are `sigusr1' and `sigusr2'.  */);
   Vdebug_on_event = intern_c_string ("sigusr2");
 
   /* Create the initial keyboard.  */
-  initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+  initial_kboard = xmalloc (sizeof *initial_kboard);
   init_kboard (initial_kboard);
   /* Vwindow_system is left at t for now.  */
   initial_kboard->next_kboard = all_kboards;
@@ -12376,7 +12230,7 @@ keys_of_keyboard (void)
 }
 
 /* Mark the pointers in the kboard objects.
-   Called by the Fgarbage_collector.  */
+   Called by Fgarbage_collect.  */
 void
 mark_kboards (void)
 {
index 19d91c84f79be7febb2cfcca2bacd467ed9a2d79..752064a612119e198d2ef96b2c691378d335a2ff 100644 (file)
@@ -202,7 +202,7 @@ extern int poll_suppress_count;
    sequence; this_command_key_count indicates how many elements
    actually mean something.  */
 extern Lisp_Object this_command_keys;
-extern int this_command_key_count;
+extern ptrdiff_t this_command_key_count;
 
 /* The frame in which the last input event occurred, or Qmacro if the
    last event came from a macro.  We use this to determine when to
@@ -487,7 +487,7 @@ extern int input_polling_used (void);
 extern void clear_input_pending (void);
 extern int requeued_events_pending_p (void);
 extern void bind_polling_period (int);
-extern int make_ctrl_char (int);
+extern int make_ctrl_char (int) ATTRIBUTE_CONST;
 extern void stuff_buffered_input (Lisp_Object);
 extern void clear_waiting_for_input (void);
 extern void swallow_events (int);
@@ -500,7 +500,7 @@ extern void poll_for_input_1 (void);
 extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object,
                             Lisp_Object);
 extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object,
-                            Lisp_Object, EMACS_INT);
+                            Lisp_Object, ptrdiff_t);
 extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object);
 extern Lisp_Object menu_item_eval_property (Lisp_Object);
 extern int  kbd_buffer_events_waiting (int);
index 73b62f9d4bb755b3eb1221f1e7be70162831625d..510c5ea7f3e2b378dbbd0dce324d3fcf493051c5 100644 (file)
@@ -43,8 +43,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 #include "lisp.h"
 #include "commands.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "keyboard.h"
 #include "frame.h"
@@ -92,7 +92,6 @@ static Lisp_Object where_is_cache;
 /* Which keymaps are reverse-stored in the cache.  */
 static Lisp_Object where_is_cache_keymaps;
 
-static Lisp_Object Flookup_key (Lisp_Object, Lisp_Object, Lisp_Object);
 static Lisp_Object store_in_keymap (Lisp_Object, Lisp_Object, Lisp_Object);
 
 static Lisp_Object define_as_prefix (Lisp_Object, Lisp_Object);
@@ -956,8 +955,6 @@ store_in_keymap (Lisp_Object keymap, register Lisp_Object idx, Lisp_Object def)
   return def;
 }
 
-static Lisp_Object Fcopy_keymap (Lisp_Object);
-
 static Lisp_Object
 copy_keymap_item (Lisp_Object elt)
 {
@@ -1117,12 +1114,12 @@ binding is altered.  If there is no binding for KEY, the new pair
 binding KEY to DEF is added at the front of KEYMAP.  */)
   (Lisp_Object keymap, Lisp_Object key, Lisp_Object def)
 {
-  register int idx;
+  register ptrdiff_t idx;
   register Lisp_Object c;
   register Lisp_Object cmd;
   int metized = 0;
   int meta_bit;
-  int length;
+  ptrdiff_t length;
   struct gcpro gcpro1, gcpro2, gcpro3;
 
   GCPRO3 (keymap, key, def);
@@ -1143,7 +1140,7 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
   if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
     { /* DEF is apparently an XEmacs-style keyboard macro.  */
       Lisp_Object tmp = Fmake_vector (make_number (ASIZE (def)), Qnil);
-      int i = ASIZE (def);
+      ptrdiff_t i = ASIZE (def);
       while (--i >= 0)
        {
          Lisp_Object defi = AREF (def, i);
@@ -1274,10 +1271,10 @@ third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will
 recognize the default bindings, just as `read-key-sequence' does.  */)
   (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default)
 {
-  register int idx;
+  register ptrdiff_t idx;
   register Lisp_Object cmd;
   register Lisp_Object c;
-  int length;
+  ptrdiff_t length;
   int t_ok = !NILP (accept_default);
   struct gcpro gcpro1, gcpro2;
 
@@ -1481,7 +1478,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
                /* Use malloc here.  See the comment above this function.
                   Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */
                BLOCK_INPUT;
-               newmodes = (Lisp_Object *) malloc (allocsize);
+               newmodes = malloc (allocsize);
                if (newmodes)
                  {
                    if (cmm_modes)
@@ -1493,7 +1490,7 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
                    cmm_modes = newmodes;
                  }
 
-               newmaps = (Lisp_Object *) malloc (allocsize);
+               newmaps = malloc (allocsize);
                if (newmaps)
                  {
                    if (cmm_maps)
@@ -1527,6 +1524,19 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr)
   return i;
 }
 
+/* Return the offset of POSITION, a click position, in the style of
+   the respective argument of Fkey_binding.  */
+static ptrdiff_t
+click_position (Lisp_Object position)
+{
+  EMACS_INT pos = (INTEGERP (position) ? XINT (position)
+                  : MARKERP (position) ? marker_position (position)
+                  : PT);
+  if (! (BEGV <= pos && pos <= ZV))
+    args_out_of_range (Fcurrent_buffer (), position);
+  return pos;
+}
+
 DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps,
        0, 2, 0,
        doc: /* Return a list of the currently active keymaps.
@@ -1535,7 +1545,7 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and
 like in the respective argument of `key-binding'. */)
   (Lisp_Object olp, Lisp_Object position)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   Lisp_Object keymaps = Fcons (current_global_map, Qnil);
 
@@ -1582,10 +1592,7 @@ like in the respective argument of `key-binding'. */)
     {
       Lisp_Object *maps;
       int nmaps, i;
-      EMACS_INT pt
-       = INTEGERP (position) ? XINT (position)
-       : MARKERP (position) ? marker_position (position)
-       : PT;
+      ptrdiff_t pt = click_position (position);
       /* This usually returns the buffer's local map,
         but that can be overridden by a `local-map' property.  */
       Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map);
@@ -1904,10 +1911,10 @@ accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void *
   while (!NILP (tem = Frassq (cmd, maps)))
     {
       Lisp_Object prefix = XCAR (tem);
-      int lim = XINT (Flength (XCAR (tem)));
+      ptrdiff_t lim = XINT (Flength (XCAR (tem)));
       if (lim <= XINT (Flength (thisseq)))
        { /* This keymap was already seen with a smaller prefix.  */
-         int i = 0;
+         ptrdiff_t i = 0;
          while (i < lim && EQ (Faref (prefix, make_number (i)),
                                Faref (thisseq, make_number (i))))
            i++;
@@ -1960,7 +1967,7 @@ then the value includes only maps for prefixes that start with PREFIX.  */)
   (Lisp_Object keymap, Lisp_Object prefix)
 {
   Lisp_Object maps, tail;
-  int prefixlen = XINT (Flength (prefix));
+  EMACS_INT prefixlen = XFASTINT (Flength (prefix));
 
   /* no need for gcpro because we don't autoload any keymaps.  */
 
@@ -2003,9 +2010,7 @@ then the value includes only maps for prefixes that start with PREFIX.  */)
        return Qnil;
     }
   else
-    maps = Fcons (Fcons (Fmake_vector (make_number (0), Qnil),
-                        get_keymap (keymap, 1, 0)),
-                 Qnil);
+    maps = Fcons (Fcons (zero_vector, get_keymap (keymap, 1, 0)), Qnil);
 
   /* For each map in the list maps,
      look at any other maps it points to,
@@ -2048,20 +2053,25 @@ For example, [?\C-x ?l] is converted into the string \"C-x l\".
 The `kbd' macro is an approximate inverse of this.  */)
   (Lisp_Object keys, Lisp_Object prefix)
 {
-  int len = 0;
-  int i, i_byte;
+  ptrdiff_t len = 0;
+  EMACS_INT i;
+  ptrdiff_t i_byte;
   Lisp_Object *args;
-  int size = XINT (Flength (keys));
+  EMACS_INT size = XINT (Flength (keys));
   Lisp_Object list;
   Lisp_Object sep = build_string (" ");
   Lisp_Object key;
+  Lisp_Object result;
   int add_meta = 0;
+  USE_SAFE_ALLOCA;
 
   if (!NILP (prefix))
     size += XINT (Flength (prefix));
 
   /* This has one extra element at the end that we don't pass to Fconcat.  */
-  args = (Lisp_Object *) alloca (size * 4 * sizeof (Lisp_Object));
+  if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) / 4 < size)
+    memory_full (SIZE_MAX);
+  SAFE_ALLOCA_LISP (args, size * 4);
 
   /* In effect, this computes
      (mapconcat 'single-key-description keys " ")
@@ -2077,11 +2087,14 @@ The `kbd' macro is an approximate inverse of this.  */)
       if (add_meta)
        {
          args[len] = Fsingle_key_description (meta_prefix_char, Qnil);
-         len += 2;
+         result = Fconcat (len + 1, args);
        }
       else if (len == 0)
-       return empty_unibyte_string;
-      return Fconcat (len - 1, args);
+       result = empty_unibyte_string;
+      else
+       result = Fconcat (len - 1, args);
+      SAFE_FREE ();
+      return result;
     }
 
   if (STRINGP (list))
@@ -2350,7 +2363,7 @@ See Info node `(elisp)Describing Characters' for examples.  */)
   char str[6];
   int c;
 
-  CHECK_NUMBER (character);
+  CHECK_CHARACTER (character);
 
   c = XINT (character);
   if (!ASCII_CHAR_P (c))
@@ -2373,8 +2386,8 @@ static int where_is_preferred_modifier;
 static int
 preferred_sequence_p (Lisp_Object seq)
 {
-  int i;
-  int len = XINT (Flength (seq));
+  EMACS_INT i;
+  EMACS_INT len = XFASTINT (Flength (seq));
   int result = 1;
 
   for (i = 0; i < len; i++)
@@ -2908,7 +2921,7 @@ You type        Translation\n\
          if (!SYMBOLP (modes[i]))
            abort ();
 
-         p = title = (char *) alloca (42 + SCHARS (SYMBOL_NAME (modes[i])));
+         p = title = alloca (42 + SCHARS (SYMBOL_NAME (modes[i])));
          *p++ = '\f';
          *p++ = '\n';
          *p++ = '`';
@@ -3102,7 +3115,7 @@ static void
 describe_command (Lisp_Object definition, Lisp_Object args)
 {
   register Lisp_Object tem1;
-  EMACS_INT column = current_column ();
+  ptrdiff_t column = current_column ();
   int description_column;
 
   /* If column 16 is no good, go to col 32;
@@ -3385,7 +3398,7 @@ This is text showing the elements of vector matched against indices.
 DESCRIBER is the output function used; nil means use `princ'.  */)
   (Lisp_Object vector, Lisp_Object describer)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   if (NILP (describer))
     describer = intern ("princ");
   specbind (Qstandard_output, Fcurrent_buffer ());
@@ -3690,11 +3703,11 @@ syms_of_keymap (void)
   Ffset (intern_c_string ("Control-X-prefix"), control_x_map);
 
   exclude_keys
-    = pure_cons (pure_cons (make_pure_c_string ("DEL"), make_pure_c_string ("\\d")),
-                pure_cons (pure_cons (make_pure_c_string ("TAB"), make_pure_c_string ("\\t")),
-                   pure_cons (pure_cons (make_pure_c_string ("RET"), make_pure_c_string ("\\r")),
-                          pure_cons (pure_cons (make_pure_c_string ("ESC"), make_pure_c_string ("\\e")),
-                                 pure_cons (pure_cons (make_pure_c_string ("SPC"), make_pure_c_string (" ")),
+    = pure_cons (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")),
+                pure_cons (pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")),
+                   pure_cons (pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")),
+                          pure_cons (pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")),
+                                 pure_cons (pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" ")),
                                         Qnil)))));
   staticpro (&exclude_keys);
 
index d9334cda0f4efea4c2e7aa015976a3a6a3c4d37c..5ed70c67b850dab0411a2efacd6cdc43fe4030fe 100644 (file)
@@ -34,19 +34,9 @@ extern Lisp_Object Qkeymap, Qmenu_bar;
 extern Lisp_Object Qremap;
 extern Lisp_Object Qmenu_item;
 extern Lisp_Object current_global_map;
-EXFUN (Fmake_sparse_keymap, 1);
-EXFUN (Fkeymap_prompt, 1);
-EXFUN (Fdefine_key, 3);
-EXFUN (Fcommand_remapping, 3);
-EXFUN (Fkey_binding, 4);
-EXFUN (Fkey_description, 2);
 extern char *push_key_description (EMACS_INT, char *, int);
-EXFUN (Fsingle_key_description, 2);
-EXFUN (Fwhere_is_internal, 5);
-EXFUN (Fcurrent_active_maps, 2);
 extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, int, int, int);
 extern Lisp_Object get_keymap (Lisp_Object, int, int);
-EXFUN (Fset_keymap_parent, 2);
 extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object,
                              const char *, int, int, int, int);
 extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **);
index aee5b0b1ec2f812194ed6ece72fe93664219d25b..09c504363fa829497593a0d2777db7cba5d2fbbe 100644 (file)
@@ -1,6 +1,6 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985-1987, 1993-1995, 1997-2012
-                 Free Software Foundation, Inc.
+
+Copyright (C) 1985-1987, 1993-1995, 1997-2012 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -41,25 +41,36 @@ extern void check_cons_list (void);
    Build with CFLAGS='-DWIDE_EMACS_INT' to try them out.  */
 /* #undef WIDE_EMACS_INT */
 
-/* These are default choices for the types to use.  */
+/* EMACS_INT - signed integer wide enough to hold an Emacs value
+   EMACS_INT_MAX - maximum value of EMACS_INT; can be used in #if
+   pI - printf length modifier for EMACS_INT
+   EMACS_UINT - unsigned variant of EMACS_INT */
 #ifndef EMACS_INT
-# if BITS_PER_LONG < BITS_PER_LONG_LONG && defined WIDE_EMACS_INT
+# if LONG_MAX < LLONG_MAX && defined WIDE_EMACS_INT
 #  define EMACS_INT long long
-#  define BITS_PER_EMACS_INT BITS_PER_LONG_LONG
+#  define EMACS_INT_MAX LLONG_MAX
 #  define pI "ll"
-# elif BITS_PER_INT < BITS_PER_LONG
+# elif INT_MAX < LONG_MAX
 #  define EMACS_INT long
-#  define BITS_PER_EMACS_INT BITS_PER_LONG
+#  define EMACS_INT_MAX LONG_MAX
 #  define pI "l"
 # else
 #  define EMACS_INT int
-#  define BITS_PER_EMACS_INT BITS_PER_INT
+#  define EMACS_INT_MAX INT_MAX
 #  define pI ""
 # endif
 #endif
-#ifndef EMACS_UINT
-# define EMACS_UINT unsigned EMACS_INT
-#endif
+#define EMACS_UINT unsigned EMACS_INT
+
+/* Number of bits in some machine integer types.  */
+enum
+  {
+    BITS_PER_CHAR      = CHAR_BIT,
+    BITS_PER_SHORT     = CHAR_BIT * sizeof (short),
+    BITS_PER_INT       = CHAR_BIT * sizeof (int),
+    BITS_PER_LONG      = CHAR_BIT * sizeof (long int),
+    BITS_PER_EMACS_INT = CHAR_BIT * sizeof (EMACS_INT)
+  };
 
 /* printmax_t and uprintmax_t are types for printing large integers.
    These are the widest integers that are supported for printing.
@@ -95,65 +106,43 @@ typedef EMACS_UINT uprintmax_t;
 
 /* Extra internal type checking?  */
 
-#ifdef ENABLE_CHECKING
+/* Define an Emacs version of 'assert (COND)', since some
+   system-defined 'assert's are flaky.  COND should be free of side
+   effects; it may or may not be evaluated.  */
+#ifndef ENABLE_CHECKING
+# define eassert(X) ((void) (0 && (X))) /* Check that X compiles.  */
+#else /* ENABLE_CHECKING */
 
-extern void die (const char *, const char *, int) NO_RETURN;
+extern _Noreturn void die (const char *, const char *, int);
 
 /* The suppress_checking variable is initialized to 0 in alloc.c.  Set
    it to 1 using a debugger to temporarily disable aborting on
    detected internal inconsistencies or error conditions.
 
-   Testing suppress_checking after the supplied condition ensures that
-   the side effects produced by CHECK will be consistent, independent
-   of whether ENABLE_CHECKING is defined, or whether the checks are
-   suppressed at run time.
-
    In some cases, a good compiler may be able to optimize away the
-   CHECK macro altogether, e.g., if XSTRING (x) uses CHECK to test
+   eassert macro altogether, e.g., if XSTRING (x) uses eassert to test
    STRINGP (x), but a particular use of XSTRING is invoked only after
    testing that STRINGP (x) is true, making the test redundant.  */
-
 extern int suppress_checking EXTERNALLY_VISIBLE;
 
-#define CHECK(check,msg) (((check) || suppress_checking                \
-                          ? (void) 0                           \
-                          : die ((msg), __FILE__, __LINE__)),  \
-                         0)
-#else
-
-/* Produce same side effects and result, but don't complain.  */
-#define CHECK(check,msg) ((check),0)
-
-#endif
-
-/* Define an Emacs version of "assert", since some system ones are
-   flaky.  */
-#ifndef ENABLE_CHECKING
-#define eassert(X) ((void) (0 && (X))) /* Check that X compiles.  */
-#else /* ENABLE_CHECKING */
-#if defined (__GNUC__) && __GNUC__ >= 2 && defined (__STDC__)
-#define eassert(cond) CHECK (cond, "assertion failed: " #cond)
-#else
-#define eassert(cond) CHECK (cond, "assertion failed")
-#endif
+# define eassert(cond)                                         \
+   ((cond) || suppress_checking                                        \
+    ? (void) 0                                                 \
+    : die ("assertion failed: " # cond, __FILE__, __LINE__))
 #endif /* ENABLE_CHECKING */
 \f
-/* Use the configure flag --enable-use-lisp-union-type to make
-   Lisp_Object use a union type instead of the default int.  The flag
-   causes USE_LISP_UNION_TYPE to be defined.  */
+/* Use the configure flag --enable-check-lisp-object-type to make
+   Lisp_Object use a struct type instead of the default int.  The flag
+   causes CHECK_LISP_OBJECT_TYPE to be defined.  */
 
 /***** Select the tagging scheme.  *****/
-/* There are basically two options that control the tagging scheme:
-   - USE_LISP_UNION_TYPE says that Lisp_Object should be a union instead
-     of an integer.
+/* The following option controls the tagging scheme:
    - USE_LSB_TAG means that we can assume the least 3 bits of pointers are
      always 0, and we can thus use them to hold tag bits, without
      restricting our addressing space.
 
-   If USE_LSB_TAG is not set, then we use the top 3 bits for tagging, thus
-   restricting our possible address range.  Currently USE_LSB_TAG is not
-   allowed together with a union.  This is not due to any fundamental
-   technical (or political ;-) problem: nobody wrote the code to do it yet.
+   If ! USE_LSB_TAG, then use the top 3 bits for tagging, thus
+   restricting our possible address range.
 
    USE_LSB_TAG not only requires the least 3 bits of pointers returned by
    malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
@@ -164,13 +153,13 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
    variable VAR of type TYPE with the added requirement that it be
    TYPEBITS-aligned.  */
 
-#ifndef GCTYPEBITS
 #define GCTYPEBITS 3
-#endif
-
-#ifndef VALBITS
 #define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
-#endif
+
+/* The maximum value that can be stored in a EMACS_INT, assuming all
+   bits other than the type bits contribute to a nonnegative signed value.
+   This can be used in #if, e.g., '#if VAL_MAX < UINTPTR_MAX' below.  */
+#define VAL_MAX (EMACS_INT_MAX >> (GCTYPEBITS - 1))
 
 #ifndef NO_DECL_ALIGN
 # ifndef DECL_ALIGN
@@ -190,25 +179,31 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
 # endif
 #endif
 
-/* Let's USE_LSB_TAG on systems where we know malloc returns mult-of-8.  */
-#if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
-     || defined DARWIN_OS || defined __sun)
-/* We also need to be able to specify mult-of-8 alignment on static vars.  */
-# if defined DECL_ALIGN
-/* On hosts where VALBITS is greater than the pointer width in bits,
-   USE_LSB_TAG is:
+/* Unless otherwise specified, use USE_LSB_TAG on systems where:  */
+#ifndef USE_LSB_TAG
+/* 1.  We know malloc returns a multiple of 8.  */
+# if (defined GNU_MALLOC || defined DOUG_LEA_MALLOC || defined __GLIBC__ \
+      || defined DARWIN_OS || defined __sun)
+/* 2.  We can specify multiple-of-8 alignment on static variables.  */
+#  ifdef DECL_ALIGN
+/* 3.  Pointers-as-ints exceed VAL_MAX.
+   On hosts where pointers-as-ints do not exceed VAL_MAX, USE_LSB_TAG is:
     a. unnecessary, because the top bits of an EMACS_INT are unused, and
     b. slower, because it typically requires extra masking.
-   So, define USE_LSB_TAG only on hosts where it might be useful.  */
-#  if UINTPTR_MAX >> VALBITS != 0
-#   define USE_LSB_TAG
+   So, default USE_LSB_TAG to 1 only on hosts where it might be useful.  */
+#   if VAL_MAX < UINTPTR_MAX
+#    define USE_LSB_TAG 1
+#   endif
 #  endif
 # endif
 #endif
+#ifndef USE_LSB_TAG
+# define USE_LSB_TAG 0
+#endif
 
 /* If we cannot use 8-byte alignment, make DECL_ALIGN a no-op.  */
 #ifndef DECL_ALIGN
-# ifdef USE_LSB_TAG
+# if USE_LSB_TAG
 #  error "USE_LSB_TAG used without defining DECL_ALIGN"
 # endif
 # define DECL_ALIGN(type, var) type var
@@ -217,36 +212,18 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
 
 /* Define the fundamental Lisp data structures.  */
 
-/* If USE_2_TAGBITS_FOR_INTS is defined, then Lisp integers use
-   2 tags, to give them one extra bit, thus extending their range from
-   e.g -2^28..2^28-1 to -2^29..2^29-1.  */
-#define USE_2_TAGS_FOR_INTS
-
-/* Making it work for the union case is too much trouble.  */
-#ifdef USE_LISP_UNION_TYPE
-# undef USE_2_TAGS_FOR_INTS
-#endif
-
 /* This is the set of Lisp data types.  */
 
-#if !defined USE_2_TAGS_FOR_INTS
-# define LISP_INT_TAG Lisp_Int
-# define case_Lisp_Int case Lisp_Int
-# define LISP_STRING_TAG 4
-# define LISP_INT_TAG_P(x) ((x) == Lisp_Int)
-#else
-# define LISP_INT_TAG Lisp_Int0
-# define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
-# ifdef USE_LSB_TAG
-#  define LISP_INT1_TAG 4
-#  define LISP_STRING_TAG 1
-#  define LISP_INT_TAG_P(x) (((x) & 3) == 0)
-# else
-#  define LISP_INT1_TAG 1
-#  define LISP_STRING_TAG 4
-#  define LISP_INT_TAG_P(x) (((x) & 6) == 0)
-# endif
-#endif
+/* Lisp integers use 2 tags, to give them one extra bit, thus
+   extending their range from, e.g., -2^28..2^28-1 to -2^29..2^29-1.  */
+#define INTTYPEBITS (GCTYPEBITS - 1)
+#define FIXNUM_BITS (VALBITS + 1)
+#define INTMASK (EMACS_INT_MAX >> (INTTYPEBITS - 1))
+#define LISP_INT_TAG Lisp_Int0
+#define case_Lisp_Int case Lisp_Int0: case Lisp_Int1
+#define LISP_INT1_TAG (USE_LSB_TAG ? 1 << INTTYPEBITS : 1)
+#define LISP_STRING_TAG (5 - LISP_INT1_TAG)
+#define LISP_INT_TAG_P(x) (((x) & ~LISP_INT1_TAG) == 0)
 
 /* Stolen from GDB.  The only known compiler that doesn't support
    enums in bitfields is MSVC.  */
@@ -260,12 +237,8 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
 enum Lisp_Type
   {
     /* Integer.  XINT (obj) is the integer value.  */
-#ifdef USE_2_TAGS_FOR_INTS
     Lisp_Int0 = 0,
     Lisp_Int1 = LISP_INT1_TAG,
-#else
-    Lisp_Int = 0,
-#endif
 
     /* Symbol.  XSYMBOL (object) points to a struct Lisp_Symbol.  */
     Lisp_Symbol = 2,
@@ -320,89 +293,44 @@ enum Lisp_Fwd_Type
     Lisp_Fwd_Kboard_Obj,       /* Fwd to a Lisp_Object field of kboards.  */
   };
 
-#ifdef USE_LISP_UNION_TYPE
-
-#ifndef WORDS_BIGENDIAN
+#ifdef CHECK_LISP_OBJECT_TYPE
 
-/* Definition of Lisp_Object for little-endian machines.  */
+typedef struct { EMACS_INT i; } Lisp_Object;
 
-typedef
-union Lisp_Object
-  {
-    /* Used for comparing two Lisp_Objects;
-       also, positive integers can be accessed fast this way.  */
-    EMACS_INT i;
-
-    struct
-      {
-       /* Use explicit signed, the signedness of a bit-field of type
-          int is implementation defined.  */
-       signed EMACS_INT val  : VALBITS;
-       ENUM_BF (Lisp_Type) type : GCTYPEBITS;
-      } s;
-    struct
-      {
-       EMACS_UINT val : VALBITS;
-       ENUM_BF (Lisp_Type) type : GCTYPEBITS;
-      } u;
-  }
-Lisp_Object;
-
-#else /* If WORDS_BIGENDIAN */
-
-typedef
-union Lisp_Object
-  {
-    /* Used for comparing two Lisp_Objects;
-       also, positive integers can be accessed fast this way.  */
-    EMACS_INT i;
-
-    struct
-      {
-       ENUM_BF (Lisp_Type) type : GCTYPEBITS;
-       /* Use explicit signed, the signedness of a bit-field of type
-          int is implementation defined.  */
-       signed EMACS_INT val  : VALBITS;
-      } s;
-    struct
-      {
-       ENUM_BF (Lisp_Type) type : GCTYPEBITS;
-       EMACS_UINT val : VALBITS;
-      } u;
-  }
-Lisp_Object;
-
-#endif /* WORDS_BIGENDIAN */
+#define XLI(o) (o).i
+static inline Lisp_Object
+XIL (EMACS_INT i)
+{
+  Lisp_Object o = { i };
+  return o;
+}
 
-#ifdef __GNUC__
 static inline Lisp_Object
 LISP_MAKE_RVALUE (Lisp_Object o)
 {
     return o;
 }
-#else
-/* This is more portable to pre-C99 non-GCC compilers, but for
-   backwards compatibility GCC still accepts an old GNU extension
-   which caused this to only generate a warning.  */
-#define LISP_MAKE_RVALUE(o) (0 ? (o) : (o))
-#endif
 
-#else /* USE_LISP_UNION_TYPE */
+#define LISP_INITIALLY_ZERO {0}
 
-/* If union type is not wanted, define Lisp_Object as just a number.  */
+#else /* CHECK_LISP_OBJECT_TYPE */
+
+/* If a struct type is not wanted, define Lisp_Object as just a number.  */
 
 typedef EMACS_INT Lisp_Object;
+#define XLI(o) (o)
+#define XIL(i) (i)
 #define LISP_MAKE_RVALUE(o) (0+(o))
-#endif /* USE_LISP_UNION_TYPE */
+#define LISP_INITIALLY_ZERO 0
+#endif /* CHECK_LISP_OBJECT_TYPE */
 
-/* In the size word of a vector, this bit means the vector has been marked.
-   (Shift -1 left, not 1, to avoid provoking overflow diagnostics.)  */
+/* In the size word of a vector, this bit means the vector has been marked.  */
 
-#define ARRAY_MARK_FLAG ((EMACS_INT) -1 << (BITS_PER_EMACS_INT - 1))
+#define ARRAY_MARK_FLAG PTRDIFF_MIN
 
 /* In the size word of a struct Lisp_Vector, this bit means it's really
    some other vector-like object.  */
-#define PSEUDOVECTOR_FLAG ((EMACS_INT) 1 << (BITS_PER_EMACS_INT - 2))
+#define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2)
 
 /* In a pseudovector, the size field actually contains a word with one
    PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to
@@ -413,28 +341,26 @@ typedef EMACS_INT Lisp_Object;
    It is not crucial, but there are plenty of bits here, so why not do it?  */
 enum pvec_type
 {
-  PVEC_NORMAL_VECTOR = 0,
-  PVEC_PROCESS = 0x200,
-  PVEC_FRAME = 0x400,
-  PVEC_COMPILED = 0x800,
-  PVEC_WINDOW = 0x1000,
-  PVEC_WINDOW_CONFIGURATION = 0x2000,
-  PVEC_SUBR = 0x4000,
-  PVEC_CHAR_TABLE = 0x8000,
-  PVEC_BOOL_VECTOR = 0x10000,
-  PVEC_BUFFER = 0x20000,
-  PVEC_HASH_TABLE = 0x40000,
-  PVEC_TERMINAL = 0x80000,
-  PVEC_SUB_CHAR_TABLE = 0x100000,
-  PVEC_FONT = 0x200000,
-  PVEC_OTHER = 0x400000,
-  PVEC_TYPE_MASK = 0x7ffe00
-
-#if 0 /* This is used to make the value of PSEUDOVECTOR_FLAG available to
-        GDB.  It doesn't work on OS Alpha.  Moved to a variable in
-        emacs.c.  */
-  PVEC_FLAG = PSEUDOVECTOR_FLAG
-#endif
+  PVEC_NORMAL_VECTOR = 0,      /* Unused!  */
+  PVEC_FREE,
+  PVEC_PROCESS,
+  PVEC_FRAME,
+  PVEC_WINDOW,
+  PVEC_BOOL_VECTOR,
+  PVEC_BUFFER,
+  PVEC_HASH_TABLE,
+  PVEC_TERMINAL,
+  PVEC_WINDOW_CONFIGURATION,
+  PVEC_SUBR,
+  PVEC_OTHER,
+  /* These last 4 are special because we OR them in fns.c:internal_equal,
+     so they have to use a disjoint bit pattern:
+     if (!(size & (PVEC_COMPILED | PVEC_CHAR_TABLE
+                   | PVEC_SUB_CHAR_TABLE | PVEC_FONT))) */
+  PVEC_COMPILED                        = 0x10,
+  PVEC_CHAR_TABLE              = 0x20,
+  PVEC_SUB_CHAR_TABLE          = 0x30,
+  PVEC_FONT                    = 0x40
 };
 
 /* For convenience, we also store the number of elements in these bits.
@@ -442,7 +368,9 @@ enum pvec_type
    only the number of Lisp_Object fields (that need to be traced by the GC).
    The distinction is used e.g. by Lisp_Process which places extra
    non-Lisp_Object fields at the end of the structure.  */
-#define PSEUDOVECTOR_SIZE_MASK 0x1ff
+#define PSEUDOVECTOR_SIZE_BITS 16
+#define PSEUDOVECTOR_SIZE_MASK ((1 << PSEUDOVECTOR_SIZE_BITS) - 1)
+#define PVEC_TYPE_MASK (0x0fff << PSEUDOVECTOR_SIZE_BITS)
 
 /* Number of bits to put in each character in the internal representation
    of bool vectors.  This should not vary across implementations.  */
@@ -452,127 +380,55 @@ enum pvec_type
  For example, if tem is a Lisp_Object whose type is Lisp_Cons,
  XCONS (tem) is the struct Lisp_Cons * pointing to the memory for that cons.  */
 
-#ifndef USE_LISP_UNION_TYPE
-
 /* Return a perfect hash of the Lisp_Object representation.  */
-#define XHASH(a) (a)
+#define XHASH(a) XLI (a)
 
-#ifdef USE_LSB_TAG
+#if USE_LSB_TAG
 
-#define TYPEMASK ((((EMACS_INT) 1) << GCTYPEBITS) - 1)
-#define XTYPE(a) ((enum Lisp_Type) ((a) & TYPEMASK))
-#ifdef USE_2_TAGS_FOR_INTS
-# define XINT(a) (((EMACS_INT) (a)) >> (GCTYPEBITS - 1))
-# define XUINT(a) (((EMACS_UINT) (a)) >> (GCTYPEBITS - 1))
-# define make_number(N) (((EMACS_INT) (N)) << (GCTYPEBITS - 1))
-#else
-# define XINT(a) (((EMACS_INT) (a)) >> GCTYPEBITS)
-# define XUINT(a) (((EMACS_UINT) (a)) >> GCTYPEBITS)
-# define make_number(N) (((EMACS_INT) (N)) << GCTYPEBITS)
-#endif
-#define XSET(var, type, ptr)                                           \
-    (eassert (XTYPE ((intptr_t) (ptr)) == 0), /* Check alignment.  */ \
-     (var) = (type) | (intptr_t) (ptr))
+#define TYPEMASK ((1 << GCTYPEBITS) - 1)
+#define XTYPE(a) ((enum Lisp_Type) (XLI (a) & TYPEMASK))
+#define XINT(a) (XLI (a) >> INTTYPEBITS)
+#define XUINT(a) ((EMACS_UINT) XLI (a) >> INTTYPEBITS)
+#define make_number(N) XIL ((EMACS_INT) (N) << INTTYPEBITS)
+#define XSET(var, type, ptr)                                              \
+  (eassert (XTYPE (XIL ((intptr_t) (ptr))) == 0), /* Check alignment.  */  \
+   (var) = XIL ((type) | (intptr_t) (ptr)))
 
-#define XPNTR(a) ((intptr_t) ((a) & ~TYPEMASK))
+#define XPNTR(a) ((intptr_t) (XLI (a) & ~TYPEMASK))
+#define XUNTAG(a, type) ((intptr_t) (XLI (a) - (type)))
 
 #else  /* not USE_LSB_TAG */
 
-#define VALMASK ((((EMACS_INT) 1) << VALBITS) - 1)
+#define VALMASK VAL_MAX
 
-/* One need to override this if there must be high bits set in data space
-   (doing the result of the below & ((1 << (GCTYPE + 1)) - 1) would work
-    on all machines, but would penalize machines which don't need it)
- */
-#define XTYPE(a) ((enum Lisp_Type) (((EMACS_UINT) (a)) >> VALBITS))
+#define XTYPE(a) ((enum Lisp_Type) ((EMACS_UINT) XLI (a) >> VALBITS))
 
 /* For integers known to be positive, XFASTINT provides fast retrieval
    and XSETFASTINT provides fast storage.  This takes advantage of the
-   fact that Lisp_Int is 0.  */
-#define XFASTINT(a) ((a) + 0)
-#define XSETFASTINT(a, b) ((a) = (b))
+   fact that Lisp integers have zero-bits in their tags.  */
+#define XFASTINT(a) (XLI (a) + 0)
+#define XSETFASTINT(a, b) ((a) = XIL (b))
 
 /* Extract the value of a Lisp_Object as a (un)signed integer.  */
 
-#ifdef USE_2_TAGS_FOR_INTS
-# define XINT(a) ((((EMACS_INT) (a)) << (GCTYPEBITS - 1)) >> (GCTYPEBITS - 1))
-# define XUINT(a) ((EMACS_UINT) ((a) & (1 + (VALMASK << 1))))
-# define make_number(N) ((((EMACS_INT) (N)) & (1 + (VALMASK << 1))))
-#else
-# define XINT(a) ((((EMACS_INT) (a)) << (BITS_PER_EMACS_INT - VALBITS))        \
-                >> (BITS_PER_EMACS_INT - VALBITS))
-# define XUINT(a) ((EMACS_UINT) ((a) & VALMASK))
-# define make_number(N)                \
-  ((((EMACS_INT) (N)) & VALMASK) | ((EMACS_INT) Lisp_Int) << VALBITS)
-#endif
+#define XINT(a) (XLI (a) << INTTYPEBITS >> INTTYPEBITS)
+#define XUINT(a) ((EMACS_UINT) (XLI (a) & INTMASK))
+#define make_number(N) XIL ((EMACS_INT) (N) & INTMASK)
 
-#define XSET(var, type, ptr)                             \
-   ((var) = ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \
-            + ((intptr_t) (ptr) & VALMASK)))
+#define XSET(var, type, ptr)                                 \
+  ((var) = XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS)  \
+               + ((intptr_t) (ptr) & VALMASK)))
 
 #ifdef DATA_SEG_BITS
 /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
    which were stored in a Lisp_Object */
-#define XPNTR(a) ((uintptr_t) (((a) & VALMASK)) | DATA_SEG_BITS))
+#define XPNTR(a) ((uintptr_t) ((XLI (a) & VALMASK)) | DATA_SEG_BITS))
 #else
-#define XPNTR(a) ((uintptr_t) ((a) & VALMASK))
+#define XPNTR(a) ((uintptr_t) (XLI (a) & VALMASK))
 #endif
 
 #endif /* not USE_LSB_TAG */
 
-#else /* USE_LISP_UNION_TYPE */
-
-#ifdef USE_2_TAGS_FOR_INTS
-# error "USE_2_TAGS_FOR_INTS is not supported with USE_LISP_UNION_TYPE"
-#endif
-
-#define XHASH(a) ((a).i)
-#define XTYPE(a) ((enum Lisp_Type) (a).u.type)
-#define XINT(a) ((EMACS_INT) (a).s.val)
-#define XUINT(a) ((EMACS_UINT) (a).u.val)
-
-#ifdef USE_LSB_TAG
-
-# define XSET(var, vartype, ptr) \
-  (eassert ((((uintptr_t) (ptr)) & ((1 << GCTYPEBITS) - 1)) == 0),     \
-   (var).u.val = ((uintptr_t) (ptr)) >> GCTYPEBITS,                    \
-   (var).u.type = ((char) (vartype)))
-
-/* Some versions of gcc seem to consider the bitfield width when issuing
-   the "cast to pointer from integer of different size" warning, so the
-   cast is here to widen the value back to its natural size.  */
-# define XPNTR(v) ((intptr_t) (v).s.val << GCTYPEBITS)
-
-#else  /* !USE_LSB_TAG */
-
-/* For integers known to be positive, XFASTINT provides fast retrieval
-   and XSETFASTINT provides fast storage.  This takes advantage of the
-   fact that Lisp_Int is 0.  */
-# define XFASTINT(a) ((a).i + 0)
-# define XSETFASTINT(a, b) ((a).i = (b))
-
-# define XSET(var, vartype, ptr) \
-   (((var).s.val = ((intptr_t) (ptr))), ((var).s.type = ((char) (vartype))))
-
-#ifdef DATA_SEG_BITS
-/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers
-   which were stored in a Lisp_Object */
-#define XPNTR(a) ((intptr_t) (XUINT (a) | DATA_SEG_BITS))
-#else
-#define XPNTR(a) ((intptr_t) XUINT (a))
-#endif
-
-#endif /* !USE_LSB_TAG */
-
-#if __GNUC__ >= 2 && defined (__OPTIMIZE__)
-#define make_number(N) \
-  (__extension__ ({ Lisp_Object _l; _l.s.val = (N); _l.s.type = Lisp_Int; _l; }))
-#else
-extern Lisp_Object make_number (EMACS_INT);
-#endif
-
-#endif /* USE_LISP_UNION_TYPE */
-
 /* For integers known to be positive, XFASTINT sometimes provides
    faster retrieval and XSETFASTINT provides faster storage.
    If not, fallback on the non-accelerated path.  */
@@ -581,21 +437,18 @@ extern Lisp_Object make_number (EMACS_INT);
 # define XSETFASTINT(a, b) (XSETINT (a, b))
 #endif
 
-#define EQ(x, y) (XHASH (x) == XHASH (y))
-
-/* Number of bits in a fixnum, including the sign bit.  */
-#ifdef USE_2_TAGS_FOR_INTS
-# define FIXNUM_BITS (VALBITS + 1)
-#else
-# define FIXNUM_BITS VALBITS
+/* Extract the pointer value of the Lisp object A, under the
+   assumption that A's type is TYPE.  This is a fallback
+   implementation if nothing faster is available.  */
+#ifndef XUNTAG
+# define XUNTAG(a, type) XPNTR (a)
 #endif
 
-/* Mask indicating the significant bits of a fixnum.  */
-#define INTMASK (((EMACS_INT) 1 << FIXNUM_BITS) - 1)
+#define EQ(x, y) (XHASH (x) == XHASH (y))
 
 /* Largest and smallest representable fixnum values.  These are the C
    values.  */
-#define MOST_POSITIVE_FIXNUM (INTMASK / 2)
+#define MOST_POSITIVE_FIXNUM (EMACS_INT_MAX >> INTTYPEBITS)
 #define MOST_NEGATIVE_FIXNUM (-1 - MOST_POSITIVE_FIXNUM)
 
 /* Value is non-zero if I doesn't fit into a Lisp fixnum.  It is
@@ -605,17 +458,28 @@ extern Lisp_Object make_number (EMACS_INT);
 #define FIXNUM_OVERFLOW_P(i) \
   (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM))
 
+static inline ptrdiff_t
+clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
+{
+  return num < lower ? lower : num <= upper ? num : upper;
+}
+
 /* Extract a value or address from a Lisp_Object.  */
 
-#define XCONS(a) (eassert (CONSP (a)), (struct Lisp_Cons *) XPNTR (a))
-#define XVECTOR(a) (eassert (VECTORLIKEP (a)), (struct Lisp_Vector *) XPNTR (a))
-#define XSTRING(a) (eassert (STRINGP (a)), (struct Lisp_String *) XPNTR (a))
-#define XSYMBOL(a) (eassert (SYMBOLP (a)), (struct Lisp_Symbol *) XPNTR (a))
-#define XFLOAT(a) (eassert (FLOATP (a)), (struct Lisp_Float *) XPNTR (a))
+#define XCONS(a)   (eassert (CONSP (a)), \
+                   (struct Lisp_Cons *) XUNTAG (a, Lisp_Cons))
+#define XVECTOR(a) (eassert (VECTORLIKEP (a)), \
+                   (struct Lisp_Vector *) XUNTAG (a, Lisp_Vectorlike))
+#define XSTRING(a) (eassert (STRINGP (a)), \
+                   (struct Lisp_String *) XUNTAG (a, Lisp_String))
+#define XSYMBOL(a) (eassert (SYMBOLP (a)), \
+                   (struct Lisp_Symbol *) XUNTAG (a, Lisp_Symbol))
+#define XFLOAT(a)  (eassert (FLOATP (a)), \
+                   (struct Lisp_Float *) XUNTAG (a, Lisp_Float))
 
 /* Misc types.  */
 
-#define XMISC(a)   ((union Lisp_Misc *) XPNTR (a))
+#define XMISC(a)       ((union Lisp_Misc *) XUNTAG (a, Lisp_Misc))
 #define XMISCANY(a)    (eassert (MISCP (a)), &(XMISC (a)->u_any))
 #define XMISCTYPE(a)   (XMISCANY (a)->type)
 #define XMARKER(a)     (eassert (MARKERP (a)), &(XMISC (a)->u_marker))
@@ -635,14 +499,24 @@ extern Lisp_Object make_number (EMACS_INT);
 
 /* Pseudovector types.  */
 
-#define XPROCESS(a) (eassert (PROCESSP (a)), (struct Lisp_Process *) XPNTR (a))
-#define XWINDOW(a) (eassert (WINDOWP (a)), (struct window *) XPNTR (a))
-#define XTERMINAL(a) (eassert (TERMINALP (a)), (struct terminal *) XPNTR (a))
-#define XSUBR(a) (eassert (SUBRP (a)), (struct Lisp_Subr *) XPNTR (a))
-#define XBUFFER(a) (eassert (BUFFERP (a)), (struct buffer *) XPNTR (a))
-#define XCHAR_TABLE(a) (eassert (CHAR_TABLE_P (a)), (struct Lisp_Char_Table *) XPNTR (a))
-#define XSUB_CHAR_TABLE(a) (eassert (SUB_CHAR_TABLE_P (a)), (struct Lisp_Sub_Char_Table *) XPNTR (a))
-#define XBOOL_VECTOR(a) (eassert (BOOL_VECTOR_P (a)), (struct Lisp_Bool_Vector *) XPNTR (a))
+#define XPROCESS(a) (eassert (PROCESSP (a)), \
+                    (struct Lisp_Process *) XUNTAG (a, Lisp_Vectorlike))
+#define XWINDOW(a) (eassert (WINDOWP (a)), \
+                   (struct window *) XUNTAG (a, Lisp_Vectorlike))
+#define XTERMINAL(a) (eassert (TERMINALP (a)), \
+                     (struct terminal *) XUNTAG (a, Lisp_Vectorlike))
+#define XSUBR(a) (eassert (SUBRP (a)), \
+                 (struct Lisp_Subr *) XUNTAG (a, Lisp_Vectorlike))
+#define XBUFFER(a) (eassert (BUFFERP (a)), \
+                   (struct buffer *) XUNTAG (a, Lisp_Vectorlike))
+#define XCHAR_TABLE(a) (eassert (CHAR_TABLE_P (a)), \
+                       (struct Lisp_Char_Table *) XUNTAG (a, Lisp_Vectorlike))
+#define XSUB_CHAR_TABLE(a) (eassert (SUB_CHAR_TABLE_P (a)), \
+                           ((struct Lisp_Sub_Char_Table *) \
+                            XUNTAG (a, Lisp_Vectorlike)))
+#define XBOOL_VECTOR(a) (eassert (BOOL_VECTOR_P (a)), \
+                        ((struct Lisp_Bool_Vector *) \
+                         XUNTAG (a, Lisp_Vectorlike)))
 
 /* Construct a Lisp_Object from a value or address.  */
 
@@ -662,19 +536,23 @@ extern Lisp_Object make_number (EMACS_INT);
 
 #define XSETPVECTYPE(v, code) XSETTYPED_PVECTYPE (v, header.size, code)
 #define XSETTYPED_PVECTYPE(v, size_member, code) \
-  ((v)->size_member |= PSEUDOVECTOR_FLAG | (code))
+  ((v)->size_member |= PSEUDOVECTOR_FLAG | ((code) << PSEUDOVECTOR_SIZE_BITS))
 #define XSETPVECTYPESIZE(v, code, sizeval) \
-  ((v)->header.size = PSEUDOVECTOR_FLAG | (code) | (sizeval))
+  ((v)->header.size = (PSEUDOVECTOR_FLAG                       \
+                      | ((code) << PSEUDOVECTOR_SIZE_BITS)     \
+                      | (sizeval)))
 
 /* The cast to struct vectorlike_header * avoids aliasing issues.  */
 #define XSETPSEUDOVECTOR(a, b, code) \
-  XSETTYPED_PSEUDOVECTOR(a, b,       \
-                        ((struct vectorlike_header *) XPNTR (a))->size, \
-                        code)
+  XSETTYPED_PSEUDOVECTOR (a, b,                                        \
+                         (((struct vectorlike_header *)        \
+                           XUNTAG (a, Lisp_Vectorlike))        \
+                          ->size),                             \
+                         code)
 #define XSETTYPED_PSEUDOVECTOR(a, b, size, code)                       \
   (XSETVECTOR (a, b),                                                  \
    eassert ((size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))              \
-           == (PSEUDOVECTOR_FLAG | (code))))
+           == (PSEUDOVECTOR_FLAG | (code << PSEUDOVECTOR_SIZE_BITS))))
 
 #define XSETWINDOW_CONFIGURATION(a, b) \
   (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW_CONFIGURATION))
@@ -811,7 +689,7 @@ struct Lisp_Cons
 #ifdef GC_CHECK_STRING_BYTES
 
 struct Lisp_String;
-extern EMACS_INT string_bytes (struct Lisp_String *);
+extern ptrdiff_t string_bytes (struct Lisp_String *);
 #define STRING_BYTES(S) string_bytes ((S))
 
 #else /* not GC_CHECK_STRING_BYTES */
@@ -854,13 +732,13 @@ extern EMACS_INT string_bytes (struct Lisp_String *);
 /* Set text properties.  */
 #define STRING_SET_INTERVALS(STR, INT) (XSTRING (STR)->intervals = (INT))
 
-/* In a string or vector, the sign bit of the `size' is the gc mark bit */
+/* In a string or vector, the sign bit of the `size' is the gc mark bit */
 
 struct Lisp_String
   {
-    EMACS_INT size;
-    EMACS_INT size_byte;
-    INTERVAL intervals;                /* text properties in this string */
+    ptrdiff_t size;
+    ptrdiff_t size_byte;
+    INTERVAL intervals;                /* Text properties in this string.  */
     unsigned char *data;
   };
 
@@ -873,14 +751,41 @@ struct Lisp_String
    <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8546>.  */
 struct vectorlike_header
   {
-    EMACS_INT size;
-
-    /* Pointer to the next vector-like object.  It is generally a buffer or a
+    /* This field contains various pieces of information:
+       - The MSB (ARRAY_MARK_FLAG) holds the gcmarkbit.
+       - The next bit (PSEUDOVECTOR_FLAG) indicates whether this is a plain
+         vector (0) or a pseudovector (1).
+       - If PSEUDOVECTOR_FLAG is 0, the rest holds the size (number
+         of slots) of the vector.
+       - If PSEUDOVECTOR_FLAG is 1, the rest is subdivided into
+         a "pvec type" tag held in PVEC_TYPE_MASK and a size held in the lowest
+         PSEUDOVECTOR_SIZE_BITS.  That size normally indicates the number of
+         Lisp_Object slots at the beginning of the object that need to be
+         traced by the GC, tho some types use it slightly differently.
+       - E.g. if the pvec type is PVEC_FREE it means this is an unallocated
+         vector on a free-list and PSEUDOVECTOR_SIZE_BITS indicates its size
+         in bytes.  */
+    ptrdiff_t size;
+
+    /* When the vector is allocated from a vector block, NBYTES is used
+       if the vector is not on a free list, and VECTOR is used otherwise.
+       For large vector-like objects, BUFFER or VECTOR is used as a pointer
+       to the next vector-like object.  It is generally a buffer or a
        Lisp_Vector alias, so for convenience it is a union instead of a
        pointer: this way, one can write P->next.vector instead of ((struct
        Lisp_Vector *) P->next).  */
     union {
+      /* This is only needed for small vectors that are not free because the
+        `size' field only gives us the number of Lisp_Object slots, whereas we
+        need to know the total size, including non-Lisp_Object data.
+        FIXME: figure out a way to store this info elsewhere so we can
+        finally get rid of this extra word of overhead.  */
+      ptrdiff_t nbytes;
       struct buffer *buffer;
+      /* FIXME: This can be removed: For large vectors, this field could be
+        placed *before* the vector itself.  And for small vectors on a free
+        list, this field could be stored in the vector's bytes, since the
+        empty vector is handled specially anyway.  */
       struct Lisp_Vector *vector;
     } next;
   };
@@ -895,7 +800,7 @@ struct Lisp_Vector
    of the shortest vector that would hold that struct.  */
 #define VECSIZE(type) ((sizeof (type)                                    \
                        - offsetof (struct Lisp_Vector, contents[0])      \
-                        + sizeof (Lisp_Object) - 1) /* round up */       \
+                        + sizeof (Lisp_Object) - 1) /* Round up.  */     \
                       / sizeof (Lisp_Object))
 
 /* Like VECSIZE, but used when the pseudo-vector has non-Lisp_Object fields
@@ -1068,7 +973,7 @@ struct Lisp_Bool_Vector
 
 struct Lisp_Subr
   {
-    EMACS_INT size;
+    ptrdiff_t size;
     union {
       Lisp_Object (*a0) (void);
       Lisp_Object (*a1) (Lisp_Object);
@@ -1255,7 +1160,7 @@ struct Lisp_Hash_Table
      a special way (e.g. because of weakness).  */
 
   /* Number of key/value entries in the table.  */
-  EMACS_INT count;
+  ptrdiff_t count;
 
   /* Vector of keys and values.  The key of item I is found at index
      2 * I, the value is found at index 2 * I + 1.
@@ -1277,7 +1182,7 @@ struct Lisp_Hash_Table
 
 
 #define XHASH_TABLE(OBJ) \
-     ((struct Lisp_Hash_Table *) XPNTR (OBJ))
+     ((struct Lisp_Hash_Table *) XUNTAG (OBJ, Lisp_Vectorlike))
 
 #define XSET_HASH_TABLE(VAR, PTR) \
      (XSETPSEUDOVECTOR (VAR, PTR, PVEC_HASH_TABLE))
@@ -1335,8 +1240,6 @@ struct Lisp_Misc_Any              /* Supertype of all Misc types.  */
   ENUM_BF (Lisp_Misc_Type) type : 16;          /* = Lisp_Misc_??? */
   unsigned gcmarkbit : 1;
   int spacer : 15;
-  /* Make it as long as "Lisp_Free without padding".  */
-  void *fill;
 };
 
 struct Lisp_Marker
@@ -1372,14 +1275,71 @@ struct Lisp_Marker
      That would also allow to preserve it ordered.  */
   struct Lisp_Marker *next;
   /* This is the char position where the marker points.  */
-  EMACS_INT charpos;
+  ptrdiff_t charpos;
   /* This is the byte position.
      It's mostly used as a charpos<->bytepos cache (i.e. it's not directly
      used to implement the functionality of markers, but rather to (ab)use
      markers as a cache for char<->byte mappings).  */
-  EMACS_INT bytepos;
+  ptrdiff_t bytepos;
 };
 
+/* START and END are markers in the overlay's buffer, and
+   PLIST is the overlay's property list.  */
+struct Lisp_Overlay
+/* An overlay's real data content is:
+   - plist
+   - buffer
+   - insertion type of both ends
+   - start & start_byte
+   - end & end_byte
+   - next (singly linked list of overlays).
+   - start_next and end_next (singly linked list of markers).
+   I.e. 9words plus 2 bits, 3words of which are for external linked lists.
+*/
+  {
+    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Overlay */
+    unsigned gcmarkbit : 1;
+    int spacer : 15;
+    struct Lisp_Overlay *next;
+    Lisp_Object start, end, plist;
+  };
+
+/* Hold a C pointer for later use.
+   This type of object is used in the arg to record_unwind_protect.  */
+struct Lisp_Save_Value
+  {
+    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Save_Value */
+    unsigned gcmarkbit : 1;
+    int spacer : 14;
+    /* If DOGC is set, POINTER is the address of a memory
+       area containing INTEGER potential Lisp_Objects.  */
+    unsigned int dogc : 1;
+    void *pointer;
+    ptrdiff_t integer;
+  };
+
+
+/* A miscellaneous object, when it's on the free list.  */
+struct Lisp_Free
+  {
+    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Free */
+    unsigned gcmarkbit : 1;
+    int spacer : 15;
+    union Lisp_Misc *chain;
+  };
+
+/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
+   It uses one of these struct subtypes to get the type field.  */
+
+union Lisp_Misc
+  {
+    struct Lisp_Misc_Any u_any;           /* Supertype of all Misc types.  */
+    struct Lisp_Free u_free;
+    struct Lisp_Marker u_marker;
+    struct Lisp_Overlay u_overlay;
+    struct Lisp_Save_Value u_save_value;
+  };
+
 /* Forwarding pointer to an int variable.
    This is allowed only in the value cell of a symbol,
    and it means that the symbol's value really lives in the
@@ -1446,13 +1406,13 @@ struct Lisp_Buffer_Objfwd
 struct Lisp_Buffer_Local_Value
   {
     /* 1 means that merely setting the variable creates a local
-       binding for the current buffer */
+       binding for the current buffer */
     unsigned int local_if_set : 1;
     /* 1 means this variable can have frame-local bindings, otherwise, it is
        can have buffer-local bindings.  The two cannot be combined.  */
     unsigned int frame_local : 1;
     /* 1 means that the binding now loaded was found.
-       Presumably equivalent to (defcell!=valcell) */
+       Presumably equivalent to (defcell!=valcell) */
     unsigned int found : 1;
     /* If non-NULL, a forwarding to the C var where it should also be set.  */
     union Lisp_Fwd *fwd;       /* Should never be (Buffer|Kboard)_Objfwd.  */
@@ -1477,27 +1437,6 @@ struct Lisp_Buffer_Local_Value
 #define BLV_VALUE(blv) (XCDR ((blv)->valcell))
 #define SET_BLV_VALUE(blv, v) (XSETCDR ((blv)->valcell, v))
 
-/* START and END are markers in the overlay's buffer, and
-   PLIST is the overlay's property list.  */
-struct Lisp_Overlay
-/* An overlay's real data content is:
-   - plist
-   - buffer
-   - insertion type of both ends
-   - start & start_byte
-   - end & end_byte
-   - next (singly linked list of overlays).
-   - start_next and end_next (singly linked list of markers).
-   I.e. 9words plus 2 bits, 3words of which are for external linked lists.
-*/
-  {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Overlay */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
-    struct Lisp_Overlay *next;
-    Lisp_Object start, end, plist;
-  };
-
 /* Like Lisp_Objfwd except that value lives in a slot in the
    current kboard.  */
 struct Lisp_Kboard_Objfwd
@@ -1506,59 +1445,16 @@ struct Lisp_Kboard_Objfwd
     int offset;
   };
 
-/* Hold a C pointer for later use.
-   This type of object is used in the arg to record_unwind_protect.  */
-struct Lisp_Save_Value
-  {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Save_Value */
-    unsigned gcmarkbit : 1;
-    int spacer : 14;
-    /* If DOGC is set, POINTER is the address of a memory
-       area containing INTEGER potential Lisp_Objects.  */
-    unsigned int dogc : 1;
-    void *pointer;
-    ptrdiff_t integer;
-  };
-
-
-/* A miscellaneous object, when it's on the free list.  */
-struct Lisp_Free
-  {
-    ENUM_BF (Lisp_Misc_Type) type : 16;        /* = Lisp_Misc_Free */
-    unsigned gcmarkbit : 1;
-    int spacer : 15;
-    union Lisp_Misc *chain;
-#ifdef USE_LSB_TAG
-    /* Try to make sure that sizeof(Lisp_Misc) preserves TYPEBITS-alignment.
-       This assumes that Lisp_Marker is the largest of the alternatives and
-       that Lisp_Misc_Any has the same size as "Lisp_Free w/o padding".  */
-    char padding[((((sizeof (struct Lisp_Marker) - 1) >> GCTYPEBITS) + 1)
-                 << GCTYPEBITS) - sizeof (struct Lisp_Misc_Any)];
-#endif
-  };
-
-/* To get the type field of a union Lisp_Misc, use XMISCTYPE.
-   It uses one of these struct subtypes to get the type field.  */
-
-union Lisp_Misc
-  {
-    struct Lisp_Misc_Any u_any;           /* Supertype of all Misc types.  */
-    struct Lisp_Free u_free;      /* Includes padding to force alignment.  */
-    struct Lisp_Marker u_marker;                        /* 5 */
-    struct Lisp_Overlay u_overlay;                      /* 5 */
-    struct Lisp_Save_Value u_save_value;                /* 3 */
-  };
-
 union Lisp_Fwd
   {
-    struct Lisp_Intfwd u_intfwd;                        /* 2 */
-    struct Lisp_Boolfwd u_boolfwd;                      /* 2 */
-    struct Lisp_Objfwd u_objfwd;                        /* 2 */
-    struct Lisp_Buffer_Objfwd u_buffer_objfwd;          /* 2 */
-    struct Lisp_Kboard_Objfwd u_kboard_objfwd;          /* 2 */
+    struct Lisp_Intfwd u_intfwd;
+    struct Lisp_Boolfwd u_boolfwd;
+    struct Lisp_Objfwd u_objfwd;
+    struct Lisp_Buffer_Objfwd u_buffer_objfwd;
+    struct Lisp_Kboard_Objfwd u_kboard_objfwd;
   };
 \f
-/* Lisp floating point type */
+/* Lisp floating point type */
 struct Lisp_Float
   {
     union
@@ -1643,18 +1539,24 @@ typedef struct {
    encodes a char code in the lower CHARACTERBITS bits and a (very small)
    face-id in the upper bits, or it may be a cons (CHAR . FACE-ID).  */
 
-#define GLYPH_CODE_CHAR(gc) \
-  (CONSP (gc) ? XINT (XCAR (gc)) : INTEGERP (gc) ? (XINT (gc) & ((1 << CHARACTERBITS)-1)) : 0)
+#define GLYPH_CODE_P(gc)                                               \
+  (CONSP (gc)                                                          \
+   ? (CHARACTERP (XCAR (gc))                                           \
+      && RANGED_INTEGERP (0, XCDR (gc), MAX_FACE_ID))                  \
+   : (RANGED_INTEGERP                                                  \
+      (0, gc,                                                          \
+       (MAX_FACE_ID < TYPE_MAXIMUM (EMACS_INT) >> CHARACTERBITS                \
+       ? ((EMACS_INT) MAX_FACE_ID << CHARACTERBITS) | MAX_CHAR         \
+       : TYPE_MAXIMUM (EMACS_INT)))))
 
-#define GLYPH_CODE_FACE(gc) \
-  (CONSP (gc) ? XINT (XCDR (gc)) : INTEGERP (gc) ? (XINT (gc) >> CHARACTERBITS) : DEFAULT_FACE_ID)
+/* The following are valid only if GLYPH_CODE_P (gc).  */
 
-/* Return 1 if glyph code from display vector contains valid character code.  */
-#define GLYPH_CODE_CHAR_VALID_P(gc) CHAR_VALID_P (GLYPH_CODE_CHAR (gc))
+#define GLYPH_CODE_CHAR(gc) \
+  (CONSP (gc) ? XINT (XCAR (gc)) : XINT (gc) & ((1 << CHARACTERBITS) - 1))
 
-#define GLYPH_CODE_P(gc) ((CONSP (gc) && INTEGERP (XCAR (gc)) && INTEGERP (XCDR (gc))) || INTEGERP (gc))
+#define GLYPH_CODE_FACE(gc) \
+  (CONSP (gc) ? XINT (XCDR (gc)) : XINT (gc) >> CHARACTERBITS)
 
-/* Only called when GLYPH_CODE_P (gc) is true.  */
 #define SET_GLYPH_FROM_GLYPH_CODE(glyph, gc)                           \
   do                                                                   \
     {                                                                  \
@@ -1714,7 +1616,9 @@ typedef struct {
 #define RANGED_INTEGERP(lo, x, hi) \
   (INTEGERP (x) && (lo) <= XINT (x) && XINT (x) <= (hi))
 #define TYPE_RANGED_INTEGERP(type, x) \
-  RANGED_INTEGERP (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type))
+  (TYPE_SIGNED (type)                                                  \
+   ? RANGED_INTEGERP (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type))     \
+   : RANGED_INTEGERP (0, x, TYPE_MAXIMUM (type)))
 
 #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x))))
 #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol)
@@ -1738,15 +1642,17 @@ typedef struct {
 /* True if object X is a pseudovector whose code is CODE.  The cast to struct
    vectorlike_header * avoids aliasing issues.  */
 #define PSEUDOVECTORP(x, code)                                 \
-  TYPED_PSEUDOVECTORP(x, vectorlike_header, code)
+  TYPED_PSEUDOVECTORP (x, vectorlike_header, code)
+
+#define PSEUDOVECTOR_TYPEP(v, code)                                    \
+  (((v)->size & (PSEUDOVECTOR_FLAG | PVEC_TYPE_MASK))                  \
+   == (PSEUDOVECTOR_FLAG | ((code) << PSEUDOVECTOR_SIZE_BITS)))
 
 /* True if object X, with internal type struct T *, is a pseudovector whose
    code is CODE.  */
 #define TYPED_PSEUDOVECTORP(x, t, code)                                \
   (VECTORLIKEP (x)                                             \
-   && (((((struct t *) XPNTR (x))->size                                \
-        & (PSEUDOVECTOR_FLAG | (code))))                       \
-       == (PSEUDOVECTOR_FLAG | (code))))
+   && PSEUDOVECTOR_TYPEP ((struct t *) XUNTAG (x, Lisp_Vectorlike), code))
 
 /* Test for specific pseudovector types.  */
 #define WINDOW_CONFIGURATIONP(x) PSEUDOVECTORP (x, PVEC_WINDOW_CONFIGURATION)
@@ -1837,6 +1743,25 @@ typedef struct {
 #define CHECK_NATNUM(x) \
   CHECK_TYPE (NATNUMP (x), Qwholenump, x)
 
+#define CHECK_RANGED_INTEGER(x, lo, hi)                                        \
+  do {                                                                 \
+    CHECK_NUMBER (x);                                                  \
+    if (! ((lo) <= XINT (x) && XINT (x) <= (hi)))                      \
+      args_out_of_range_3                                              \
+       (x,                                                             \
+        make_number ((lo) < 0 && (lo) < MOST_NEGATIVE_FIXNUM           \
+                     ? MOST_NEGATIVE_FIXNUM                            \
+                     : (lo)),                                          \
+        make_number (min (hi, MOST_POSITIVE_FIXNUM)));                 \
+  } while (0)
+#define CHECK_TYPE_RANGED_INTEGER(type, x) \
+  do {                                                                 \
+    if (TYPE_SIGNED (type))                                            \
+      CHECK_RANGED_INTEGER (x, TYPE_MINIMUM (type), TYPE_MAXIMUM (type)); \
+    else                                                               \
+      CHECK_RANGED_INTEGER (x, 0, TYPE_MAXIMUM (type));                        \
+  } while (0)
+
 #define CHECK_MARKER(x) \
   CHECK_TYPE (MARKERP (x), Qmarkerp, x)
 
@@ -1920,7 +1845,8 @@ typedef struct {
 #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc)    \
    Lisp_Object fnname DEFUN_ARGS_ ## maxargs ;                         \
    static DECL_ALIGN (struct Lisp_Subr, sname) =                       \
-     { PVEC_SUBR | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),   \
+   { (PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS)                             \
+     | (sizeof (struct Lisp_Subr) / sizeof (EMACS_INT)),               \
       { (Lisp_Object (__cdecl *)(void))fnname },                        \
        minargs, maxargs, lname, intspec, 0};                           \
    Lisp_Object fnname
@@ -1928,7 +1854,7 @@ typedef struct {
 #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc)    \
    Lisp_Object fnname DEFUN_ARGS_ ## maxargs ;                         \
    static DECL_ALIGN (struct Lisp_Subr, sname) =                       \
-     { PVEC_SUBR,                                                      \
+     { PVEC_SUBR << PSEUDOVECTOR_SIZE_BITS,                            \
       { .a ## maxargs = fnname },                                      \
        minargs, maxargs, lname, intspec, 0};                           \
    Lisp_Object fnname
@@ -2055,9 +1981,9 @@ struct specbinding
 
 extern struct specbinding *specpdl;
 extern struct specbinding *specpdl_ptr;
-extern EMACS_INT specpdl_size;
+extern ptrdiff_t specpdl_size;
 
-#define SPECPDL_INDEX()        ((int) (specpdl_ptr - specpdl))
+#define SPECPDL_INDEX()        (specpdl_ptr - specpdl)
 
 /* Everything needed to describe an active condition case.  */
 struct handler
@@ -2110,8 +2036,8 @@ struct catchtag
   jmp_buf jmp;
   struct backtrace *backlist;
   struct handler *handlerlist;
-  int lisp_eval_depth;
-  int pdlcount;
+  EMACS_INT lisp_eval_depth;
+  ptrdiff_t pdlcount;
   int poll_suppress_count;
   int interrupt_input_blocked;
   struct byte_stack *byte_stack;
@@ -2219,7 +2145,7 @@ struct gcpro
 #define GC_USE_GCPROS_CHECK_ZOMBIES    3
 
 #ifndef GC_MARK_STACK
-#define GC_MARK_STACK GC_USE_GCPROS_AS_BEFORE
+#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
 #endif
 
 /* Whether we do the stack marking manually.  */
@@ -2386,7 +2312,7 @@ extern Lisp_Object Qerror, Qquit, Qargs_out_of_range;
 extern Lisp_Object Qvoid_variable, Qvoid_function;
 extern Lisp_Object Qinvalid_read_syntax;
 extern Lisp_Object Qinvalid_function, Qwrong_number_of_arguments, Qno_catch;
-extern Lisp_Object Qend_of_file, Qarith_error, Qmark_inactive;
+extern Lisp_Object Quser_error, Qend_of_file, Qarith_error, Qmark_inactive;
 extern Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
 extern Lisp_Object Qtext_read_only;
 extern Lisp_Object Qinteractive_form;
@@ -2410,56 +2336,14 @@ extern Lisp_Object Qinteger;
 
 extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
 
-EXFUN (Finteractive_form, 1);
-EXFUN (Fbyteorder, 0);
+EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST;
 
 /* Defined in frame.c */
 extern Lisp_Object Qframep;
 
 /* Defined in data.c */
-EXFUN (Fcar, 1);
-EXFUN (Fcar_safe, 1);
-EXFUN (Fcdr, 1);
-EXFUN (Fcdr_safe, 1);
-EXFUN (Fsetcar, 2);
-EXFUN (Fsetcdr, 2);
-EXFUN (Fboundp, 1);
-EXFUN (Ffboundp, 1);
-EXFUN (Fsymbol_function, 1);
-EXFUN (Fsymbol_name, 1);
 extern Lisp_Object indirect_function (Lisp_Object);
-EXFUN (Findirect_function, 2);
-EXFUN (Ffset, 2);
-EXFUN (Fsymbol_value, 1);
 extern Lisp_Object find_symbol_value (Lisp_Object);
-EXFUN (Fset, 2);
-EXFUN (Fdefault_value, 1);
-EXFUN (Fset_default, 2);
-EXFUN (Fdefault_boundp, 1);
-EXFUN (Fmake_local_variable, 1);
-EXFUN (Flocal_variable_p, 2);
-
-EXFUN (Faref, 2);
-EXFUN (Faset, 3);
-
-EXFUN (Fstring_to_number, 2);
-EXFUN (Fnumber_to_string, 1);
-EXFUN (Fgtr, 2);
-EXFUN (Flss, 2);
-EXFUN (Fgeq, 2);
-EXFUN (Fleq, 2);
-EXFUN (Fzerop, 1);
-EXFUN (Fplus, MANY);
-EXFUN (Fminus, MANY);
-EXFUN (Ftimes, MANY);
-EXFUN (Fquo, MANY);
-EXFUN (Frem, 2);
-EXFUN (Fmax, MANY);
-EXFUN (Fmin, MANY);
-
-EXFUN (Fadd1, 1);
-EXFUN (Fsub1, 1);
-EXFUN (Fmake_variable_buffer_local, 1);
 
 /* Convert the integer I to an Emacs representation, either the integer
    itself, or a cons of two or three integers, or if all else fails a float.
@@ -2490,10 +2374,10 @@ extern intmax_t cons_to_signed (Lisp_Object, intmax_t, intmax_t);
 extern uintmax_t cons_to_unsigned (Lisp_Object, uintmax_t);
 
 extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *);
-extern void args_out_of_range (Lisp_Object, Lisp_Object) NO_RETURN;
-extern void args_out_of_range_3 (Lisp_Object, Lisp_Object,
-                                 Lisp_Object) NO_RETURN;
-extern Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object) NO_RETURN;
+extern _Noreturn void args_out_of_range (Lisp_Object, Lisp_Object);
+extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object,
+                                          Lisp_Object);
+extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
 extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
 extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int);
 extern void syms_of_data (void);
@@ -2501,36 +2385,23 @@ extern void init_data (void);
 extern void swap_in_global_binding (struct Lisp_Symbol *);
 
 /* Defined in cmds.c */
-EXFUN (Fend_of_line, 1);
-EXFUN (Fforward_char, 1);
-EXFUN (Fforward_line, 1);
 extern void syms_of_cmds (void);
 extern void keys_of_cmds (void);
 
 /* Defined in coding.c */
 extern Lisp_Object Qcharset;
-EXFUN (Fcoding_system_p, 1);
-EXFUN (Fcoding_system_base, 1);
-EXFUN (Fcoding_system_eol_type, 1);
-EXFUN (Fcheck_coding_system, 1);
-EXFUN (Fread_coding_system, 2);
-EXFUN (Fread_non_nil_coding_system, 1);
-EXFUN (Ffind_operation_coding_system, MANY);
-EXFUN (Fdecode_coding_string, 4);
-extern Lisp_Object detect_coding_system (const unsigned char *, EMACS_INT,
-                                         EMACS_INT, int, int, Lisp_Object);
+extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
+                                         ptrdiff_t, int, int, Lisp_Object);
 extern void init_coding (void);
 extern void init_coding_once (void);
 extern void syms_of_coding (void);
 
 /* Defined in character.c */
-EXFUN (Fchar_width, 1);
-EXFUN (Fstring, MANY);
-extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT);
-extern EMACS_INT multibyte_chars_in_text (const unsigned char *, EMACS_INT);
-extern int multibyte_char_to_unibyte (int);
-extern int multibyte_char_to_unibyte_safe (int);
-extern void init_character_once (void);
+EXFUN (Fmax_char, 0) ATTRIBUTE_CONST;
+extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t);
+extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t);
+extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST;
+extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST;
 extern void syms_of_character (void);
 
 /* Defined in charset.c */
@@ -2544,17 +2415,15 @@ struct charset;
 extern void syms_of_composite (void);
 
 /* Defined in syntax.c */
-EXFUN (Fforward_word, 1);
-EXFUN (Fskip_chars_forward, 2);
-EXFUN (Fskip_chars_backward, 2);
 extern void init_syntax_once (void);
 extern void syms_of_syntax (void);
 
 /* Defined in fns.c */
 extern Lisp_Object QCrehash_size, QCrehash_threshold;
 enum { NEXT_ALMOST_PRIME_LIMIT = 11 };
-extern EMACS_INT next_almost_prime (EMACS_INT);
-extern Lisp_Object larger_vector (Lisp_Object, EMACS_INT, Lisp_Object);
+EXFUN (Fidentity, 1) ATTRIBUTE_CONST;
+extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST;
+extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t);
 extern void sweep_weak_hash_tables (void);
 extern Lisp_Object Qcursor_in_echo_area;
 extern Lisp_Object Qstring_lessp;
@@ -2567,72 +2436,24 @@ Lisp_Object make_hash_table (Lisp_Object, Lisp_Object, Lisp_Object,
 ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *);
 ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
                    EMACS_UINT);
-void init_weak_hash_tables (void);
-extern void init_fns (void);
-EXFUN (Fmake_hash_table, MANY);
-EXFUN (Fgethash, 3);
-EXFUN (Fputhash, 3);
-EXFUN (Fremhash, 2);
-
-EXFUN (Fidentity, 1);
-EXFUN (Flength, 1);
-EXFUN (Fappend, MANY);
-EXFUN (Fconcat, MANY);
-EXFUN (Fvconcat, MANY);
-EXFUN (Fcopy_sequence, 1);
-EXFUN (Fstring_make_multibyte, 1);
-EXFUN (Fstring_make_unibyte, 1);
-EXFUN (Fstring_as_multibyte, 1);
-EXFUN (Fstring_as_unibyte, 1);
-EXFUN (Fstring_to_multibyte, 1);
-EXFUN (Fsubstring, 3);
-extern Lisp_Object substring_both (Lisp_Object, EMACS_INT, EMACS_INT,
-                                  EMACS_INT, EMACS_INT);
-EXFUN (Fnth, 2);
-EXFUN (Fnthcdr, 2);
-EXFUN (Fmemq, 2);
-EXFUN (Fassq, 2);
-EXFUN (Fassoc, 2);
-EXFUN (Felt, 2);
-EXFUN (Fmember, 2);
-EXFUN (Frassq, 2);
-EXFUN (Fdelq, 2);
-EXFUN (Fdelete, 2);
-EXFUN (Fsort, 2);
-EXFUN (Freverse, 1);
-EXFUN (Fnreverse, 1);
-EXFUN (Fget, 2);
-EXFUN (Fput, 3);
-EXFUN (Fequal, 2);
-EXFUN (Fnconc, MANY);
-EXFUN (Fmapcar, 2);
-EXFUN (Fmapconcat, 3);
+
+extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t,
+                                  ptrdiff_t, ptrdiff_t);
 extern Lisp_Object do_yes_or_no_p (Lisp_Object);
-EXFUN (Fprovide, 2);
 extern Lisp_Object concat2 (Lisp_Object, Lisp_Object);
 extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object nconc2 (Lisp_Object, Lisp_Object);
 extern Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object);
 extern Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object);
 extern void clear_string_char_byte_cache (void);
-extern EMACS_INT string_char_to_byte (Lisp_Object, EMACS_INT);
-extern EMACS_INT string_byte_to_char (Lisp_Object, EMACS_INT);
+extern ptrdiff_t string_char_to_byte (Lisp_Object, ptrdiff_t);
+extern ptrdiff_t string_byte_to_char (Lisp_Object, ptrdiff_t);
 extern Lisp_Object string_to_multibyte (Lisp_Object);
 extern Lisp_Object string_make_unibyte (Lisp_Object);
-EXFUN (Fcopy_alist, 1);
-EXFUN (Fplist_get, 2);
-EXFUN (Fplist_put, 3);
-EXFUN (Fplist_member, 2);
-EXFUN (Frassoc, 2);
-EXFUN (Fstring_equal, 2);
-EXFUN (Fcompare_strings, 7);
-EXFUN (Fstring_lessp, 2);
 extern void syms_of_fns (void);
 
 /* Defined in floatfns.c */
 extern double extract_float (Lisp_Object);
-EXFUN (Ffloat, 1);
-EXFUN (Ftruncate, 2);
 extern void init_floatfns (void);
 extern void syms_of_floatfns (void);
 extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y);
@@ -2650,61 +2471,61 @@ extern Lisp_Object QCascent, QCmargin, QCrelief;
 extern Lisp_Object QCconversion;
 extern int x_bitmap_mask (struct frame *, ptrdiff_t);
 extern void syms_of_image (void);
-extern void init_image (void);
 
 /* Defined in insdel.c */
 extern Lisp_Object Qinhibit_modification_hooks;
-extern void move_gap (EMACS_INT);
-extern void move_gap_both (EMACS_INT, EMACS_INT);
-extern void buffer_overflow (void) NO_RETURN;
-extern void make_gap (EMACS_INT);
-extern EMACS_INT copy_text (const unsigned char *, unsigned char *,
-                           EMACS_INT, int, int);
+extern void move_gap (ptrdiff_t);
+extern void move_gap_both (ptrdiff_t, ptrdiff_t);
+extern _Noreturn void buffer_overflow (void);
+extern void make_gap (ptrdiff_t);
+extern ptrdiff_t copy_text (const unsigned char *, unsigned char *,
+                           ptrdiff_t, int, int);
 extern int count_combining_before (const unsigned char *,
-                                  EMACS_INT, EMACS_INT, EMACS_INT);
+                                  ptrdiff_t, ptrdiff_t, ptrdiff_t);
 extern int count_combining_after (const unsigned char *,
-                                 EMACS_INT, EMACS_INT, EMACS_INT);
-extern void insert (const char *, EMACS_INT);
-extern void insert_and_inherit (const char *, EMACS_INT);
-extern void insert_1 (const char *, EMACS_INT, int, int, int);
-extern void insert_1_both (const char *, EMACS_INT, EMACS_INT,
+                                 ptrdiff_t, ptrdiff_t, ptrdiff_t);
+extern void insert (const char *, ptrdiff_t);
+extern void insert_and_inherit (const char *, ptrdiff_t);
+extern void insert_1 (const char *, ptrdiff_t, int, int, int);
+extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t,
                           int, int, int);
-extern void insert_from_gap (EMACS_INT, EMACS_INT);
-extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT,
-                               EMACS_INT, EMACS_INT, int);
-extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int);
+extern void insert_from_gap (ptrdiff_t, ptrdiff_t);
+extern void insert_from_string (Lisp_Object, ptrdiff_t, ptrdiff_t,
+                               ptrdiff_t, ptrdiff_t, int);
+extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, int);
 extern void insert_char (int);
 extern void insert_string (const char *);
-extern void insert_before_markers (const char *, EMACS_INT);
-extern void insert_before_markers_and_inherit (const char *, EMACS_INT);
-extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT,
-                                              EMACS_INT, EMACS_INT,
-                                              EMACS_INT, int);
-extern void del_range (EMACS_INT, EMACS_INT);
-extern Lisp_Object del_range_1 (EMACS_INT, EMACS_INT, int, int);
-extern void del_range_byte (EMACS_INT, EMACS_INT, int);
-extern void del_range_both (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int);
-extern Lisp_Object del_range_2 (EMACS_INT, EMACS_INT,
-                               EMACS_INT, EMACS_INT, int);
-extern void modify_region (struct buffer *, EMACS_INT, EMACS_INT, int);
-extern void prepare_to_modify_buffer (EMACS_INT, EMACS_INT, EMACS_INT *);
-extern void signal_after_change (EMACS_INT, EMACS_INT, EMACS_INT);
-extern void adjust_after_insert (EMACS_INT, EMACS_INT, EMACS_INT,
-                                EMACS_INT, EMACS_INT);
-extern void adjust_markers_for_delete (EMACS_INT, EMACS_INT,
-                                      EMACS_INT, EMACS_INT);
-extern void replace_range (EMACS_INT, EMACS_INT, Lisp_Object, int, int, int);
-extern void replace_range_2 (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
-                            const char *, EMACS_INT, EMACS_INT, int);
+extern void insert_before_markers (const char *, ptrdiff_t);
+extern void insert_before_markers_and_inherit (const char *, ptrdiff_t);
+extern void insert_from_string_before_markers (Lisp_Object, ptrdiff_t,
+                                              ptrdiff_t, ptrdiff_t,
+                                              ptrdiff_t, int);
+extern void del_range (ptrdiff_t, ptrdiff_t);
+extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, int, int);
+extern void del_range_byte (ptrdiff_t, ptrdiff_t, int);
+extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, int);
+extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t,
+                               ptrdiff_t, ptrdiff_t, int);
+extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, int);
+extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *);
+extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t);
+extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t,
+                                ptrdiff_t, ptrdiff_t);
+extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t,
+                                      ptrdiff_t, ptrdiff_t);
+extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, int, int, int);
+extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
+                            const char *, ptrdiff_t, ptrdiff_t, int);
 extern void syms_of_insdel (void);
 
 /* Defined in dispnew.c */
+#if (defined PROFILING \
+     && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__))
+_Noreturn void __executable_start (void);
+#endif
 extern Lisp_Object selected_frame;
 extern Lisp_Object Vwindow_system;
-EXFUN (Fding, 1);
-EXFUN (Fredraw_frame, 1);
-EXFUN (Fsleep_for, 2);
-EXFUN (Fredisplay, 1);
+void duration_to_sec_usec (double, int *, int *);
 extern Lisp_Object sit_for (Lisp_Object, int, int);
 extern void init_display (void);
 extern void syms_of_display (void);
@@ -2724,7 +2545,7 @@ extern Lisp_Object QCdata, QCfile;
 extern Lisp_Object QCmap;
 extern Lisp_Object Qrisky_local_variable;
 extern struct frame *last_glyphless_glyph_frame;
-extern unsigned last_glyphless_glyph_face_id;
+extern int last_glyphless_glyph_face_id;
 extern int last_glyphless_glyph_merged_face_id;
 extern int noninteractive_need_newline;
 extern Lisp_Object echo_area_buffer[2];
@@ -2740,15 +2561,15 @@ extern void clear_message (int, int);
 extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
 extern void message1 (const char *);
 extern void message1_nolog (const char *);
-extern void message2 (const char *, EMACS_INT, int);
-extern void message2_nolog (const char *, EMACS_INT, int);
-extern void message3 (Lisp_Object, EMACS_INT, int);
-extern void message3_nolog (Lisp_Object, EMACS_INT, int);
-extern void message_dolog (const char *, EMACS_INT, int, int);
+extern void message2 (const char *, ptrdiff_t, int);
+extern void message2_nolog (const char *, ptrdiff_t, int);
+extern void message3 (Lisp_Object, ptrdiff_t, int);
+extern void message3_nolog (Lisp_Object, ptrdiff_t, int);
+extern void message_dolog (const char *, ptrdiff_t, int, int);
 extern void message_with_string (const char *, Lisp_Object, int);
 extern void message_log_maybe_newline (void);
 extern void update_echo_area (void);
-extern void truncate_echo_area (EMACS_INT);
+extern void truncate_echo_area (ptrdiff_t);
 extern void redisplay (void);
 extern void redisplay_preserve_echo_area (int);
 extern void prepare_menu_bars (void);
@@ -2757,14 +2578,14 @@ void set_frame_cursor_types (struct frame *, Lisp_Object);
 extern void syms_of_xdisp (void);
 extern void init_xdisp (void);
 extern Lisp_Object safe_eval (Lisp_Object);
-extern int pos_visible_p (struct window *, EMACS_INT, int *,
+extern int pos_visible_p (struct window *, ptrdiff_t, int *,
                           int *, int *, int *, int *, int *);
 
 /* Defined in xsettings.c */
 extern void syms_of_xsettings (void);
 
 /* Defined in vm-limit.c.  */
-extern void memory_warnings (POINTER_TYPE *, void (*warnfun) (const char *));
+extern void memory_warnings (void *, void (*warnfun) (const char *));
 
 /* Defined in alloc.c */
 extern void check_pure_size (void);
@@ -2772,52 +2593,60 @@ extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT);
 extern void reset_malloc_hooks (void);
 extern void uninterrupt_malloc (void);
 extern void malloc_warning (const char *);
-extern void memory_full (size_t) NO_RETURN;
-extern void buffer_memory_full (EMACS_INT) NO_RETURN;
+extern _Noreturn void memory_full (size_t);
+extern _Noreturn void buffer_memory_full (ptrdiff_t);
 extern int survives_gc_p (Lisp_Object);
 extern void mark_object (Lisp_Object);
 #if defined REL_ALLOC && !defined SYSTEM_MALLOC
 extern void refill_memory_reserve (void);
 #endif
 extern const char *pending_malloc_warning;
+extern Lisp_Object zero_vector;
 extern Lisp_Object *stack_base;
-EXFUN (Fcons, 2);
 extern Lisp_Object list1 (Lisp_Object);
 extern Lisp_Object list2 (Lisp_Object, Lisp_Object);
 extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
                          Lisp_Object);
-EXFUN (Flist, MANY);
-EXFUN (Fmake_list, 2);
 extern Lisp_Object allocate_misc (void);
-EXFUN (Fmake_vector, 2);
-EXFUN (Fvector, MANY);
-EXFUN (Fmake_symbol, 1);
-EXFUN (Fmake_marker, 0);
-extern void string_overflow (void) NO_RETURN;
-EXFUN (Fmake_string, 2);
-extern Lisp_Object build_string (const char *);
-extern Lisp_Object make_string (const char *, EMACS_INT);
-extern Lisp_Object make_unibyte_string (const char *, EMACS_INT);
-extern Lisp_Object make_multibyte_string (const char *, EMACS_INT, EMACS_INT);
+extern _Noreturn void string_overflow (void);
+extern Lisp_Object make_string (const char *, ptrdiff_t);
+extern Lisp_Object make_formatted_string (char *, const char *, ...)
+  ATTRIBUTE_FORMAT_PRINTF (2, 3);
+extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t);
+extern Lisp_Object make_multibyte_string (const char *, ptrdiff_t, ptrdiff_t);
 extern Lisp_Object make_event_array (int, Lisp_Object *);
 extern Lisp_Object make_uninit_string (EMACS_INT);
 extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT);
-extern Lisp_Object make_string_from_bytes (const char *, EMACS_INT, EMACS_INT);
+extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t);
 extern Lisp_Object make_specified_string (const char *,
-                                         EMACS_INT, EMACS_INT, int);
-EXFUN (Fpurecopy, 1);
-extern Lisp_Object make_pure_string (const char *, EMACS_INT, EMACS_INT, int);
-extern Lisp_Object make_pure_c_string (const char *data);
+                                         ptrdiff_t, ptrdiff_t, int);
+extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int);
+extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t);
+
+/* Make a string allocated in pure space, use STR as string data.  */
+
+static inline Lisp_Object
+build_pure_c_string (const char *str)
+{
+  return make_pure_c_string (str, strlen (str));
+}
+
+/* Make a string from the data at STR, treating it as multibyte if the
+   data warrants.  */
+
+static inline Lisp_Object
+build_string (const char *str)
+{
+  return make_string (str, strlen (str));
+}
+
 extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
-extern Lisp_Object make_pure_vector (EMACS_INT);
-EXFUN (Fgarbage_collect, 0);
-EXFUN (Fmake_byte_code, MANY);
-EXFUN (Fmake_bool_vector, 2);
+extern void make_byte_code (struct Lisp_Vector *);
 extern Lisp_Object Qchar_table_extra_slots;
 extern struct Lisp_Vector *allocate_vector (EMACS_INT);
-extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag);
+extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, int tag);
 #define ALLOCATE_PSEUDOVECTOR(typ,field,tag)                           \
   ((typ*)                                                              \
    allocate_pseudovector                                               \
@@ -2831,7 +2660,7 @@ extern int gc_in_progress;
 extern int abort_on_gc;
 extern Lisp_Object make_float (double);
 extern void display_malloc_warning (void);
-extern int inhibit_garbage_collection (void);
+extern ptrdiff_t inhibit_garbage_collection (void);
 extern Lisp_Object make_save_value (void *, ptrdiff_t);
 extern void free_marker (Lisp_Object);
 extern void free_cons (struct Lisp_Cons *);
@@ -2841,13 +2670,16 @@ extern void syms_of_alloc (void);
 extern struct buffer * allocate_buffer (void);
 extern int valid_lisp_object_p (Lisp_Object);
 
+#ifdef REL_ALLOC
+/* Defined in ralloc.c */
+extern void *r_alloc (void **, size_t);
+extern void r_alloc_free (void **);
+extern void *r_re_alloc (void **, size_t);
+extern void r_alloc_reset_variable (void **, void **);
+extern void r_alloc_inhibit_buffer_relocation (int);
+#endif
+
 /* Defined in chartab.c */
-EXFUN (Fmake_char_table, 2);
-EXFUN (Fset_char_table_parent, 2);
-EXFUN (Fchar_table_extra_slot, 2);
-EXFUN (Fset_char_table_extra_slot, 3);
-EXFUN (Fset_char_table_range, 3);
-EXFUN (Foptimize_char_table, 2);
 extern Lisp_Object copy_char_table (Lisp_Object);
 extern Lisp_Object char_table_ref (Lisp_Object, int);
 extern Lisp_Object char_table_ref_and_range (Lisp_Object, int,
@@ -2869,11 +2701,6 @@ extern void syms_of_chartab (void);
 /* Defined in print.c */
 extern Lisp_Object Vprin1_to_string_buffer;
 extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE;
-EXFUN (Fprin1, 2);
-EXFUN (Fprin1_to_string, 2);
-EXFUN (Fterpri, 1);
-EXFUN (Fprint, 2);
-EXFUN (Ferror_message_string, 1);
 extern Lisp_Object Qstandard_output;
 extern Lisp_Object Qexternal_debugging_output;
 extern void temp_output_buffer_setup (const char *);
@@ -2885,7 +2712,7 @@ extern void print_error_message (Lisp_Object, Lisp_Object, const char *,
 extern Lisp_Object internal_with_output_to_temp_buffer
         (const char *, Lisp_Object (*) (Lisp_Object), Lisp_Object);
 #define FLOAT_TO_STRING_BUFSIZE 350
-extern void float_to_string (char *, double);
+extern int float_to_string (char *, double);
 extern void syms_of_print (void);
 
 /* Defined in doprnt.c */
@@ -2903,19 +2730,10 @@ extern ptrdiff_t evxprintf (char **, ptrdiff_t *, char const *, ptrdiff_t,
 /* Defined in lread.c.  */
 extern Lisp_Object Qvariable_documentation, Qstandard_input;
 extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
-EXFUN (Fread, 1);
-EXFUN (Fread_from_string, 3);
-EXFUN (Fintern, 2);
-EXFUN (Fintern_soft, 2);
-EXFUN (Funintern, 2);
-EXFUN (Fload, 5);
-EXFUN (Fget_load_suffixes, 0);
-EXFUN (Fread_char, 3);
-EXFUN (Fread_event, 3);
 extern Lisp_Object check_obarray (Lisp_Object);
-extern Lisp_Object intern (const char *);
-extern Lisp_Object intern_c_string (const char *);
-extern Lisp_Object oblookup (Lisp_Object, const char *, EMACS_INT, EMACS_INT);
+extern Lisp_Object intern_1 (const char *, ptrdiff_t);
+extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t);
+extern Lisp_Object oblookup (Lisp_Object, const char *, ptrdiff_t, ptrdiff_t);
 #define LOADHIST_ATTACH(x) \
   do {                                                                 \
     if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \
@@ -2931,8 +2749,20 @@ extern void init_obarray (void);
 extern void init_lread (void);
 extern void syms_of_lread (void);
 
+static inline Lisp_Object
+intern (const char *str)
+{
+  return intern_1 (str, strlen (str));
+}
+
+static inline Lisp_Object
+intern_c_string (const char *str)
+{
+  return intern_c_string_1 (str, strlen (str));
+}
+
 /* Defined in eval.c.  */
-extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qdefun, Qmacro;
+extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qmacro;
 extern Lisp_Object Qinhibit_quit, Qclosure;
 extern Lisp_Object Qand_rest;
 extern Lisp_Object Vautoload_queue;
@@ -2951,29 +2781,18 @@ extern struct handler *handlerlist;
 
    should no longer be used.  */
 extern Lisp_Object Vrun_hooks;
-EXFUN (Frun_hooks, MANY);
-EXFUN (Frun_hook_with_args, MANY);
-EXFUN (Frun_hook_with_args_until_failure, MANY);
 extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args,
                                       Lisp_Object (*funcall)
                                       (ptrdiff_t nargs, Lisp_Object *args));
-EXFUN (Fprogn, UNEVALLED);
-EXFUN (Finteractive_p, 0);
-EXFUN (Fthrow, 2) NO_RETURN;
-EXFUN (Fsignal, 2);
-extern void xsignal (Lisp_Object, Lisp_Object) NO_RETURN;
-extern void xsignal0 (Lisp_Object) NO_RETURN;
-extern void xsignal1 (Lisp_Object, Lisp_Object) NO_RETURN;
-extern void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN;
-extern void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object) NO_RETURN;
-extern void signal_error (const char *, Lisp_Object) NO_RETURN;
-EXFUN (Fcommandp, 2);
-EXFUN (Ffunctionp, 1);
-EXFUN (Feval, 2);
+extern _Noreturn void xsignal (Lisp_Object, Lisp_Object);
+extern _Noreturn void xsignal0 (Lisp_Object);
+extern _Noreturn void xsignal1 (Lisp_Object, Lisp_Object);
+extern _Noreturn void xsignal2 (Lisp_Object, Lisp_Object, Lisp_Object);
+extern _Noreturn void xsignal3 (Lisp_Object, Lisp_Object, Lisp_Object,
+                               Lisp_Object);
+extern _Noreturn void signal_error (const char *, Lisp_Object);
 extern Lisp_Object eval_sub (Lisp_Object form);
-EXFUN (Fapply, MANY);
-EXFUN (Ffuncall, MANY);
 extern Lisp_Object apply1 (Lisp_Object, Lisp_Object);
 extern Lisp_Object call0 (Lisp_Object);
 extern Lisp_Object call1 (Lisp_Object, Lisp_Object);
@@ -2983,7 +2802,6 @@ extern Lisp_Object call4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Li
 extern Lisp_Object call5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object call6 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object call7 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
-EXFUN (Fdo_auto_save, 2);
 extern Lisp_Object internal_catch (Lisp_Object, Lisp_Object (*) (Lisp_Object), Lisp_Object);
 extern Lisp_Object internal_lisp_condition_case (Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object internal_condition_case (Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object));
@@ -2992,10 +2810,10 @@ extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp
 extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (ptrdiff_t, Lisp_Object *), ptrdiff_t, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object));
 extern void specbind (Lisp_Object, Lisp_Object);
 extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
-extern Lisp_Object unbind_to (int, Lisp_Object);
-extern void error (const char *, ...) NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2);
-extern void verror (const char *, va_list)
-  NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0);
+extern Lisp_Object unbind_to (ptrdiff_t, Lisp_Object);
+extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
+extern _Noreturn void verror (const char *, va_list)
+  ATTRIBUTE_FORMAT_PRINTF (1, 0);
 extern void do_autoload (Lisp_Object, Lisp_Object);
 extern Lisp_Object un_autoload (Lisp_Object);
 extern void init_eval_once (void);
@@ -3010,85 +2828,36 @@ extern void syms_of_eval (void);
 
 /* Defined in editfns.c */
 extern Lisp_Object Qfield;
-EXFUN (Fcurrent_message, 0);
-EXFUN (Fgoto_char, 1);
-EXFUN (Fpoint_max_marker, 0);
-EXFUN (Fpoint, 0);
-EXFUN (Fpoint_marker, 0);
-EXFUN (Fline_beginning_position, 1);
-EXFUN (Fline_end_position, 1);
-EXFUN (Ffollowing_char, 0);
-EXFUN (Fprevious_char, 0);
-EXFUN (Fchar_after, 1);
-EXFUN (Finsert, MANY);
-EXFUN (Finsert_char, 3);
 extern void insert1 (Lisp_Object);
-EXFUN (Feolp, 0);
-EXFUN (Feobp, 0);
-EXFUN (Fbolp, 0);
-EXFUN (Fbobp, 0);
-EXFUN (Fformat, MANY);
-EXFUN (Fmessage, MANY);
 extern Lisp_Object format2 (const char *, Lisp_Object, Lisp_Object);
-EXFUN (Fbuffer_substring, 2);
-EXFUN (Fbuffer_string, 0);
 extern Lisp_Object save_excursion_save (void);
 extern Lisp_Object save_restriction_save (void);
 extern Lisp_Object save_excursion_restore (Lisp_Object);
 extern Lisp_Object save_restriction_restore (Lisp_Object);
-EXFUN (Fchar_to_string, 1);
-EXFUN (Fdelete_region, 2);
-EXFUN (Fnarrow_to_region, 2);
-EXFUN (Fwiden, 0);
-EXFUN (Fuser_login_name, 1);
-EXFUN (Fsystem_name, 0);
-EXFUN (Fcurrent_time, 0);
-EXFUN (Fget_internal_run_time, 0);
-extern EMACS_INT clip_to_bounds (EMACS_INT, EMACS_INT, EMACS_INT);
-extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int);
-extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT,
-                                           EMACS_INT, int);
+extern _Noreturn void time_overflow (void);
+extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, int);
+extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t,
+                                           ptrdiff_t, int);
 extern void init_editfns (void);
 const char *get_system_name (void);
 extern void syms_of_editfns (void);
-EXFUN (Fconstrain_to_field, 5);
-EXFUN (Ffield_end, 3);
 extern void set_time_zone_rule (const char *);
 
 /* Defined in buffer.c */
 extern int mouse_face_overlay_overlaps (Lisp_Object);
-extern void nsberror (Lisp_Object) NO_RETURN;
-EXFUN (Fset_buffer_multibyte, 1);
-EXFUN (Foverlay_start, 1);
-EXFUN (Foverlay_end, 1);
-extern void adjust_overlays_for_insert (EMACS_INT, EMACS_INT);
-extern void adjust_overlays_for_delete (EMACS_INT, EMACS_INT);
-extern void fix_start_end_in_overlays (EMACS_INT, EMACS_INT);
+extern _Noreturn void nsberror (Lisp_Object);
+extern void adjust_overlays_for_insert (ptrdiff_t, ptrdiff_t);
+extern void adjust_overlays_for_delete (ptrdiff_t, ptrdiff_t);
+extern void fix_start_end_in_overlays (ptrdiff_t, ptrdiff_t);
 extern void report_overlay_modification (Lisp_Object, Lisp_Object, int,
                                          Lisp_Object, Lisp_Object, Lisp_Object);
-extern int overlay_touches_p (EMACS_INT);
+extern int overlay_touches_p (ptrdiff_t);
 extern Lisp_Object Vbuffer_alist;
-EXFUN (Fget_buffer, 1);
-EXFUN (Fget_buffer_create, 1);
-EXFUN (Fgenerate_new_buffer_name, 2);
-EXFUN (Fset_buffer, 1);
 extern Lisp_Object set_buffer_if_live (Lisp_Object);
-EXFUN (Fbarf_if_buffer_read_only, 0);
-EXFUN (Fcurrent_buffer, 0);
-EXFUN (Fother_buffer, 3);
 extern Lisp_Object other_buffer_safely (Lisp_Object);
-EXFUN (Foverlay_get, 2);
-EXFUN (Fbuffer_modified_p, 1);
-EXFUN (Fset_buffer_modified_p, 1);
-EXFUN (Fkill_buffer, 1);
-EXFUN (Fkill_all_local_variables, 0);
-EXFUN (Fbuffer_enable_undo, 1);
-EXFUN (Ferase_buffer, 0);
 extern Lisp_Object Qpriority, Qwindow, Qbefore_string, Qafter_string;
 extern Lisp_Object get_truename_buffer (Lisp_Object);
 extern struct buffer *all_buffers;
-EXFUN (Fprevious_overlay_change, 1);
-EXFUN (Fbuffer_file_name, 1);
 extern void init_buffer_once (void);
 extern void init_buffer (void);
 extern void syms_of_buffer (void);
@@ -3096,21 +2865,18 @@ extern void keys_of_buffer (void);
 
 /* Defined in marker.c */
 
-EXFUN (Fmarker_position, 1);
-EXFUN (Fmarker_buffer, 1);
-EXFUN (Fcopy_marker, 2);
-EXFUN (Fset_marker, 3);
-extern EMACS_INT marker_position (Lisp_Object);
-extern EMACS_INT marker_byte_position (Lisp_Object);
+extern ptrdiff_t marker_position (Lisp_Object);
+extern ptrdiff_t marker_byte_position (Lisp_Object);
 extern void clear_charpos_cache (struct buffer *);
-extern EMACS_INT charpos_to_bytepos (EMACS_INT);
-extern EMACS_INT buf_charpos_to_bytepos (struct buffer *, EMACS_INT);
-extern EMACS_INT buf_bytepos_to_charpos (struct buffer *, EMACS_INT);
+extern ptrdiff_t charpos_to_bytepos (ptrdiff_t);
+extern ptrdiff_t buf_charpos_to_bytepos (struct buffer *, ptrdiff_t);
+extern ptrdiff_t buf_bytepos_to_charpos (struct buffer *, ptrdiff_t);
 extern void unchain_marker (struct Lisp_Marker *marker);
 extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object);
-extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT);
+extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t);
 extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object,
-                                               EMACS_INT, EMACS_INT);
+                                               ptrdiff_t, ptrdiff_t);
+extern Lisp_Object build_marker (struct buffer *, ptrdiff_t, ptrdiff_t);
 extern void syms_of_marker (void);
 
 /* Defined in fileio.c */
@@ -3120,27 +2886,11 @@ extern Lisp_Object Qfile_exists_p;
 extern Lisp_Object Qfile_directory_p;
 extern Lisp_Object Qinsert_file_contents;
 extern Lisp_Object Qfile_name_history;
-EXFUN (Ffind_file_name_handler, 2);
-EXFUN (Ffile_name_as_directory, 1);
-EXFUN (Fexpand_file_name, 2);
-EXFUN (Ffile_name_nondirectory, 1);
-EXFUN (Fsubstitute_in_file_name, 1);
-EXFUN (Ffile_symlink_p, 1);
-EXFUN (Fverify_visited_file_modtime, 1);
-EXFUN (Ffile_exists_p, 1);
-EXFUN (Ffile_name_absolute_p, 1);
-EXFUN (Fdirectory_file_name, 1);
-EXFUN (Ffile_name_directory, 1);
 extern Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
-EXFUN (Ffile_accessible_directory_p, 1);
-EXFUN (Funhandled_file_name_directory, 1);
-EXFUN (Ffile_directory_p, 1);
-EXFUN (Fwrite_region, 7);
-EXFUN (Ffile_readable_p, 1);
-EXFUN (Fread_file_name, 6);
+EXFUN (Fread_file_name, 6);     /* not a normal DEFUN */
 extern Lisp_Object close_file_unwind (Lisp_Object);
 extern Lisp_Object restore_point_unwind (Lisp_Object);
-extern void report_file_error (const char *, Lisp_Object) NO_RETURN;
+extern _Noreturn void report_file_error (const char *, Lisp_Object);
 extern int internal_delete_file (Lisp_Object);
 extern void syms_of_fileio (void);
 extern Lisp_Object make_temp_name (Lisp_Object, int);
@@ -3148,29 +2898,25 @@ extern Lisp_Object Qdelete_file;
 
 /* Defined in search.c */
 extern void shrink_regexp_cache (void);
-EXFUN (Fstring_match, 3);
 extern void restore_search_regs (void);
-EXFUN (Fmatch_data, 3);
-EXFUN (Fset_match_data, 2);
-EXFUN (Fmatch_beginning, 1);
-EXFUN (Fmatch_end, 1);
 extern void record_unwind_save_match_data (void);
 struct re_registers;
 extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
                                                  struct re_registers *,
                                                  Lisp_Object, int, int);
-extern EMACS_INT fast_string_match (Lisp_Object, Lisp_Object);
-extern EMACS_INT fast_c_string_match_ignore_case (Lisp_Object, const char *);
-extern EMACS_INT fast_string_match_ignore_case (Lisp_Object, Lisp_Object);
-extern EMACS_INT fast_looking_at (Lisp_Object, EMACS_INT, EMACS_INT,
-                                  EMACS_INT, EMACS_INT, Lisp_Object);
-extern EMACS_INT scan_buffer (int, EMACS_INT, EMACS_INT, EMACS_INT,
-                             EMACS_INT *, int);
-extern EMACS_INT scan_newline (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
+extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object);
+extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *,
+                                                 ptrdiff_t);
+extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object);
+extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t,
+                                  ptrdiff_t, ptrdiff_t, Lisp_Object);
+extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t,
+                             ptrdiff_t *, int);
+extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
                               EMACS_INT, int);
-extern EMACS_INT find_next_newline (EMACS_INT, int);
-extern EMACS_INT find_next_newline_no_quit (EMACS_INT, EMACS_INT);
-extern EMACS_INT find_before_next_newline (EMACS_INT, EMACS_INT, EMACS_INT);
+extern ptrdiff_t find_next_newline (ptrdiff_t, int);
+extern ptrdiff_t find_next_newline_no_quit (ptrdiff_t, ptrdiff_t);
+extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t);
 extern void syms_of_search (void);
 extern void clear_regexp_cache (void);
 
@@ -3179,14 +2925,6 @@ extern void clear_regexp_cache (void);
 extern Lisp_Object Qcompletion_ignore_case;
 extern Lisp_Object Vminibuffer_list;
 extern Lisp_Object last_minibuf_string;
-EXFUN (Fcompleting_read, 8);
-EXFUN (Fread_from_minibuffer, 7);
-EXFUN (Fread_variable, 2);
-EXFUN (Fread_buffer, 3);
-EXFUN (Fread_minibuffer, 2);
-EXFUN (Feval_minibuffer, 2);
-EXFUN (Fread_string, 5);
-EXFUN (Fassoc_string, 3);
 extern Lisp_Object get_minibuffer (EMACS_INT);
 extern void init_minibuf_once (void);
 extern void syms_of_minibuf (void);
@@ -3196,24 +2934,16 @@ extern void syms_of_minibuf (void);
 extern Lisp_Object Qminus, Qplus;
 extern Lisp_Object Qwhen;
 extern Lisp_Object Qcall_interactively, Qmouse_leave_buffer_hook;
-EXFUN (Fprefix_numeric_value, 1);
 extern void syms_of_callint (void);
 
 /* Defined in casefiddle.c */
 
 extern Lisp_Object Qidentity;
-EXFUN (Fdowncase, 1);
-EXFUN (Fupcase, 1);
-EXFUN (Fupcase_region, 2);
-EXFUN (Fupcase_initials, 1);
-EXFUN (Fupcase_initials_region, 2);
 extern void syms_of_casefiddle (void);
 extern void keys_of_casefiddle (void);
 
 /* Defined in casetab.c */
 
-EXFUN (Fset_case_table, 1);
-EXFUN (Fset_standard_case_table, 1);
 extern void init_casetab_once (void);
 extern void syms_of_casetab (void);
 
@@ -3226,16 +2956,9 @@ extern Lisp_Object Qdisabled, QCfilter;
 extern Lisp_Object Qup, Qdown, Qbottom;
 extern Lisp_Object Qtop;
 extern int input_pending;
-EXFUN (Fdiscard_input, 0);
-EXFUN (Frecursive_edit, 0);
-EXFUN (Ftop_level, 0) NO_RETURN;
 extern Lisp_Object menu_bar_items (Lisp_Object);
 extern Lisp_Object tool_bar_items (Lisp_Object, int *);
 extern void discard_mouse_events (void);
-EXFUN (Fevent_convert_list, 1);
-EXFUN (Fread_key_sequence, 5);
-EXFUN (Fset_input_interrupt_mode, 1);
-EXFUN (Fset_input_mode, 4);
 extern Lisp_Object pending_funcalls;
 extern int detect_input_pending (void);
 extern int detect_input_pending_ignore_squeezables (void);
@@ -3253,17 +2976,12 @@ extern void syms_of_keyboard (void);
 extern void keys_of_keyboard (void);
 
 /* Defined in indent.c */
-EXFUN (Fvertical_motion, 2);
-EXFUN (Findent_to, 2);
-EXFUN (Fmove_to_column, 2);
-extern EMACS_INT current_column (void);
+extern ptrdiff_t current_column (void);
 extern void invalidate_current_column (void);
-extern int indented_beyond_p (EMACS_INT, EMACS_INT, EMACS_INT);
+extern int indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT);
 extern void syms_of_indent (void);
 
 /* Defined in frame.c */
-#ifdef HAVE_WINDOW_SYSTEM
-#endif /* HAVE_WINDOW_SYSTEM */
 extern Lisp_Object Qonly;
 extern Lisp_Object Qvisible;
 extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
@@ -3273,14 +2991,6 @@ extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
 extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
 #endif
 extern Lisp_Object frame_buffer_predicate (Lisp_Object);
-EXFUN (Fselect_frame, 2);
-EXFUN (Fselected_frame, 0);
-EXFUN (Fmake_frame_visible, 1);
-EXFUN (Ficonify_frame, 1);
-EXFUN (Fframe_parameter, 2);
-EXFUN (Fmodify_frame_parameters, 2);
-EXFUN (Fraise_frame, 1);
-EXFUN (Fredirect_frame_focus, 2);
 extern void frames_discard_buffer (Lisp_Object);
 extern void syms_of_frame (void);
 
@@ -3297,7 +3007,6 @@ extern Lisp_Object Qfile_name_handler_alist;
 extern void fatal_error_signal (int);
 #endif
 extern Lisp_Object Qkill_emacs;
-EXFUN (Fkill_emacs, 1) NO_RETURN;
 #if HAVE_SETLOCALE
 void fixup_locale (void);
 void synchronize_system_messages_locale (void);
@@ -3327,16 +3036,20 @@ extern int running_asynch_code;
 
 /* Defined in process.c.  */
 extern Lisp_Object QCtype, Qlocal;
-EXFUN (Fget_buffer_process, 1);
-EXFUN (Fprocess_status, 1);
-EXFUN (Fkill_process, 2);
-EXFUN (Fwaiting_for_user_input_p, 0);
 extern Lisp_Object Qprocessp;
 extern void kill_buffer_processes (Lisp_Object);
-extern int wait_reading_process_output (int, int, int, int,
+extern int wait_reading_process_output (intmax_t, int, int, int,
                                         Lisp_Object,
                                         struct Lisp_Process *,
                                         int);
+/* Max value for the first argument of wait_reading_process_output.  */
+#if __GNUC__ == 3 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5)
+/* Work around a bug in GCC 3.4.2, known to be fixed in GCC 4.6.3.
+   The bug merely causes a bogus warning, but the warning is annoying.  */
+# define WAIT_READING_MAX min (TYPE_MAXIMUM (time_t), INTMAX_MAX)
+#else
+# define WAIT_READING_MAX INTMAX_MAX
+#endif
 extern void add_keyboard_wait_descriptor (int);
 extern void delete_keyboard_wait_descriptor (int);
 #ifdef HAVE_GPM
@@ -3344,16 +3057,14 @@ extern void add_gpm_wait_descriptor (int);
 extern void delete_gpm_wait_descriptor (int);
 #endif
 extern void close_process_descs (void);
-extern void init_process (void);
+extern void init_process_emacs (void);
 extern void syms_of_process (void);
 extern void setup_process_coding_systems (Lisp_Object);
 
-EXFUN (Fcall_process, MANY);
-extern int child_setup (int, int, int, char **, int, Lisp_Object)
 #ifndef DOS_NT
- NO_RETURN
+ _Noreturn
 #endif
- ;
+extern int child_setup (int, int, int, char **, int, Lisp_Object);
 extern void init_callproc_1 (void);
 extern void init_callproc (void);
 extern void set_initial_environment (void);
@@ -3361,7 +3072,6 @@ extern void syms_of_callproc (void);
 
 /* Defined in doc.c */
 extern Lisp_Object Qfunction_documentation;
-EXFUN (Fsubstitute_command_keys, 1);
 extern Lisp_Object read_doc_string (Lisp_Object);
 extern Lisp_Object get_doc_string (Lisp_Object, int, int);
 extern void syms_of_doc (void);
@@ -3380,22 +3090,19 @@ extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
 
 /* Defined in macros.c */
 extern Lisp_Object Qexecute_kbd_macro;
-EXFUN (Fexecute_kbd_macro, 3);
-EXFUN (Fcancel_kbd_macro_events, 0);
 extern void init_macros (void);
 extern void syms_of_macros (void);
 
 /* Defined in undo.c */
 extern Lisp_Object Qapply;
 extern Lisp_Object Qinhibit_read_only;
-EXFUN (Fundo_boundary, 0);
 extern void truncate_undo_list (struct buffer *);
-extern void record_marker_adjustment (Lisp_Object, EMACS_INT);
-extern void record_insert (EMACS_INT, EMACS_INT);
-extern void record_delete (EMACS_INT, Lisp_Object);
+extern void record_marker_adjustment (Lisp_Object, ptrdiff_t);
+extern void record_insert (ptrdiff_t, ptrdiff_t);
+extern void record_delete (ptrdiff_t, Lisp_Object);
 extern void record_first_change (void);
-extern void record_change (EMACS_INT, EMACS_INT);
-extern void record_property_change (EMACS_INT, EMACS_INT,
+extern void record_change (ptrdiff_t, ptrdiff_t);
+extern void record_property_change (ptrdiff_t, ptrdiff_t,
                                    Lisp_Object, Lisp_Object,
                                     Lisp_Object);
 extern void syms_of_undo (void);
@@ -3405,21 +3112,12 @@ extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks;
 extern Lisp_Object Qfront_sticky, Qrear_nonsticky;
 extern Lisp_Object Qminibuffer_prompt;
 
-EXFUN (Fnext_single_property_change, 4);
-EXFUN (Fnext_single_char_property_change, 4);
-EXFUN (Fprevious_single_property_change, 4);
-EXFUN (Fget_text_property, 3);
-EXFUN (Fput_text_property, 5);
-EXFUN (Fprevious_char_property_change, 2);
-EXFUN (Fnext_char_property_change, 2);
 extern void report_interval_modification (Lisp_Object, Lisp_Object);
 
 /* Defined in menu.c */
 extern void syms_of_menu (void);
 
 /* Defined in xmenu.c */
-EXFUN (Fx_popup_menu, 2);
-EXFUN (Fx_popup_dialog, 3);
 extern void syms_of_xmenu (void);
 
 /* Defined in termchar.h */
@@ -3441,9 +3139,9 @@ extern void init_sys_modes (struct tty_display_info *);
 extern void reset_sys_modes (struct tty_display_info *);
 extern void init_all_sys_modes (void);
 extern void reset_all_sys_modes (void);
-extern void wait_for_termination (int);
-extern void interruptible_wait_for_termination (int);
-extern void flush_pending_output (int);
+extern void wait_for_termination (pid_t);
+extern void interruptible_wait_for_termination (pid_t);
+extern void flush_pending_output (int) ATTRIBUTE_CONST;
 extern void child_setup_tty (int);
 extern void setup_pty (int);
 extern int set_window_size (int, int, int);
@@ -3451,22 +3149,19 @@ extern EMACS_INT get_random (void);
 extern void seed_random (long);
 extern int emacs_open (const char *, int, int);
 extern int emacs_close (int);
-extern EMACS_INT emacs_read (int, char *, EMACS_INT);
-extern EMACS_INT emacs_write (int, const char *, EMACS_INT);
+extern ptrdiff_t emacs_read (int, char *, ptrdiff_t);
+extern ptrdiff_t emacs_write (int, const char *, ptrdiff_t);
 enum { READLINK_BUFSIZE = 1024 };
 extern char *emacs_readlink (const char *, char [READLINK_BUFSIZE]);
 
-EXFUN (Funlock_buffer, 0);
 extern void unlock_all_files (void);
 extern void lock_file (Lisp_Object);
 extern void unlock_file (Lisp_Object);
 extern void unlock_buffer (struct buffer *);
 extern void syms_of_filelock (void);
-extern void init_filelock (void);
 
 /* Defined in sound.c */
 extern void syms_of_sound (void);
-extern void init_sound (void);
 
 /* Defined in category.c */
 extern void init_category_once (void);
@@ -3486,12 +3181,10 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
 extern int *char_ins_del_vector;
 extern void mark_ttys (void);
 extern void syms_of_term (void);
-extern void fatal (const char *msgid, ...)
-  NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2);
+extern _Noreturn void fatal (const char *msgid, ...)
+  ATTRIBUTE_FORMAT_PRINTF (1, 2);
 
 /* Defined in terminal.c */
-EXFUN (Fframe_terminal, 1);
-EXFUN (Fdelete_terminal, 2);
 extern void syms_of_terminal (void);
 
 /* Defined in font.c */
@@ -3504,8 +3197,6 @@ extern void syms_of_fontset (void);
 
 /* Defined in xfns.c, w32fns.c, or macfns.c */
 extern Lisp_Object Qfont_param;
-EXFUN (Fxw_display_color_p, 1);
-EXFUN (Fx_focus_frame, 1);
 #endif
 
 /* Defined in xfaces.c */
@@ -3518,8 +3209,6 @@ extern Lisp_Object QCfamily, QCweight, QCslant;
 extern Lisp_Object QCheight, QCname, QCwidth, QCforeground, QCbackground;
 extern Lisp_Object Vface_alternative_font_family_alist;
 extern Lisp_Object Vface_alternative_font_registry_alist;
-EXFUN (Fclear_face_cache, 1);
-EXFUN (Fx_load_color_file, 1);
 extern void syms_of_xfaces (void);
 
 #ifdef HAVE_X_WINDOWS
@@ -3541,14 +3230,10 @@ extern void syms_of_xterm (void);
 extern char *x_get_keysym_name (int);
 #endif /* HAVE_WINDOW_SYSTEM */
 
-#ifdef MSDOS
-/* Defined in msdos.c */
-EXFUN (Fmsdos_downcase_filename, 1);
-#endif
-
 #ifdef HAVE_LIBXML2
 /* Defined in xml.c */
 extern void syms_of_xml (void);
+extern void xml_cleanup_parser (void);
 #endif
 
 #ifdef HAVE_MENUS
@@ -3565,15 +3250,6 @@ void syms_of_dbusbind (void);
 /* Defined in msdos.c, w32.c */
 extern char *emacs_root_dir (void);
 #endif /* DOS_NT */
-
-#ifdef REL_ALLOC
-/* Defined in ralloc.c */
-extern void r_alloc_reset_variable (POINTER_TYPE **, POINTER_TYPE **);
-extern POINTER_TYPE *r_alloc (POINTER_TYPE **, size_t);
-extern POINTER_TYPE *r_re_alloc (POINTER_TYPE **, size_t);
-extern void r_alloc_free (POINTER_TYPE **ptr);
-extern void r_alloc_inhibit_buffer_relocation (int);
-#endif /* REL_ALLOC */
 \f
 /* Nonzero means Emacs has already been initialized.
    Used during startup to detect startup of dumped Emacs.  */
@@ -3581,9 +3257,10 @@ extern int initialized;
 
 extern int immediate_quit;         /* Nonzero means ^G can quit instantly */
 
-extern POINTER_TYPE *xmalloc (size_t);
-extern POINTER_TYPE *xrealloc (POINTER_TYPE *, size_t);
-extern void xfree (POINTER_TYPE *);
+extern void *xmalloc (size_t);
+extern void *xzalloc (size_t);
+extern void *xrealloc (void *, size_t);
+extern void xfree (void *);
 extern void *xnmalloc (ptrdiff_t, ptrdiff_t);
 extern void *xnrealloc (void *, ptrdiff_t, ptrdiff_t);
 extern void *xpalloc (void *, ptrdiff_t *, ptrdiff_t, ptrdiff_t, ptrdiff_t);
@@ -3687,7 +3364,7 @@ extern void init_system_name (void);
 extern Lisp_Object safe_alloca_unwind (Lisp_Object);
 
 #define USE_SAFE_ALLOCA                        \
-  int sa_count = (int) SPECPDL_INDEX (), sa_must_free = 0
+  ptrdiff_t sa_count = SPECPDL_INDEX (); int sa_must_free = 0
 
 /* SAFE_ALLOCA allocates a simple buffer.  */
 
@@ -3697,7 +3374,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
       buf = (type) alloca (size);                        \
     else                                                 \
       {                                                          \
-       buf = (type) xmalloc (size);                      \
+       buf = xmalloc (size);                             \
        sa_must_free = 1;                                 \
        record_unwind_protect (safe_alloca_unwind,        \
                               make_save_value (buf, 0)); \
@@ -3741,7 +3418,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
     else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object)) \
       {                                                          \
        Lisp_Object arg_;                                 \
-       buf = (Lisp_Object *) xmalloc ((nelt) * sizeof (Lisp_Object));  \
+       buf = xmalloc ((nelt) * sizeof (Lisp_Object));    \
        arg_ = make_save_value (buf, nelt);               \
        XSAVE_VALUE (arg_)->dogc = 1;                     \
        sa_must_free = 1;                                 \
index c082630f717b0ac1f9b0742a21d5be9cc2b71c81..162d88199177b2c1a127314e636794dc7b0b3c7b 100644 (file)
@@ -30,8 +30,9 @@
 ##   sed -e 's/"[ )].*//' -n -e '/(load "/ s/.*load "//p' loadup.el | \
 ##   grep -vE 'site-|ldefs-boot'
 ## minus any duplicates.
-## Note that you cannot just add a ".elc" extension to every file,
-## since some of them are no-byte-compile (eg some language/ ones).
+## Note that you can generally just add a ".elc" extension to every file
+## that does not have an explicit .el extension, but beware of any
+## no-byte-compile ones.
 
 ## Confusingly, term/internal is not in loadup, but is unconditionally
 ## loaded by pc-win, which is.
@@ -53,7 +54,7 @@ lisp = \
        $(lispsource)/emacs-lisp/byte-run.elc \
        $(lispsource)/emacs-lisp/backquote.elc \
        $(lispsource)/subr.elc \
-       $(lispsource)/version.el \
+       $(lispsource)/version.elc \
        $(lispsource)/widget.elc \
        $(lispsource)/custom.elc \
        $(lispsource)/emacs-lisp/map-ynp.elc \
@@ -82,28 +83,28 @@ lisp = \
        $(lispsource)/language/chinese.elc \
        $(lispsource)/language/cyrillic.elc \
        $(lispsource)/language/indian.elc \
-       $(lispsource)/language/sinhala.el \
-       $(lispsource)/language/english.el \
+       $(lispsource)/language/sinhala.elc \
+       $(lispsource)/language/english.elc \
        $(lispsource)/language/ethiopic.elc \
        $(lispsource)/language/european.elc \
-       $(lispsource)/language/czech.el \
-       $(lispsource)/language/slovak.el \
-       $(lispsource)/language/romanian.el \
-       $(lispsource)/language/greek.el \
+       $(lispsource)/language/czech.elc \
+       $(lispsource)/language/slovak.elc \
+       $(lispsource)/language/romanian.elc \
+       $(lispsource)/language/greek.elc \
        $(lispsource)/language/hebrew.elc \
-       $(lispsource)/language/japanese.el \
-       $(lispsource)/language/korean.el \
-       $(lispsource)/language/lao.el \
-       $(lispsource)/language/tai-viet.el \
-       $(lispsource)/language/thai.el \
+       $(lispsource)/language/japanese.elc \
+       $(lispsource)/language/korean.elc \
+       $(lispsource)/language/lao.elc \
+       $(lispsource)/language/tai-viet.elc \
+       $(lispsource)/language/thai.elc \
        $(lispsource)/language/tibetan.elc \
        $(lispsource)/language/vietnamese.elc \
-       $(lispsource)/language/misc-lang.el \
-       $(lispsource)/language/utf-8-lang.el \
-       $(lispsource)/language/georgian.el \
-       $(lispsource)/language/khmer.el \
-       $(lispsource)/language/burmese.el \
-       $(lispsource)/language/cham.el \
+       $(lispsource)/language/misc-lang.elc \
+       $(lispsource)/language/utf-8-lang.elc \
+       $(lispsource)/language/georgian.elc \
+       $(lispsource)/language/khmer.elc \
+       $(lispsource)/language/burmese.elc \
+       $(lispsource)/language/cham.elc \
        $(lispsource)/indent.elc \
        $(lispsource)/window.elc \
        $(lispsource)/frame.elc \
@@ -120,7 +121,6 @@ lisp = \
        $(lispsource)/isearch.elc \
        $(lispsource)/rfn-eshadow.elc \
        $(lispsource)/menu-bar.elc \
-       $(lispsource)/paths.el \
        $(lispsource)/emacs-lisp/lisp.elc \
        $(lispsource)/textmodes/page.elc \
        $(lispsource)/register.elc \
@@ -128,9 +128,12 @@ lisp = \
        $(lispsource)/emacs-lisp/lisp-mode.elc \
        $(lispsource)/textmodes/text-mode.elc \
        $(lispsource)/textmodes/fill.elc \
+       $(lispsource)/newcomment.elc \
        $(lispsource)/replace.elc \
+       $(lispsource)/emacs-lisp/tabulated-list.elc \
        $(lispsource)/buff-menu.elc \
        $(lispsource)/fringe.elc \
+       $(lispsource)/emacs-lisp/regexp-opt.elc \
        $(lispsource)/image.elc \
        $(lispsource)/international/fontset.elc \
        $(lispsource)/dnd.elc \
index b6135429b4848f32b89d2c74e89f288a9eed3588..39378bb11dd40144f821c695b9eb942346740559 100644 (file)
@@ -24,12 +24,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <errno.h>
-#include <limits.h>    /* for CHAR_BIT */
+#include <limits.h>    /* For CHAR_BIT.  */
 #include <setjmp.h>
+#include <stat-time.h>
 #include "lisp.h"
 #include "intervals.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "coding.h"
 #include <epaths.h>
@@ -44,6 +45,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "msdos.h"
 #endif
 
+#ifdef HAVE_NS
+#include "nsterm.h"
+#endif
+
 #include <unistd.h>
 #include <math.h>
 
@@ -61,7 +66,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define file_tell ftell
 #endif
 
-/* hash table read constants */
+/* Hash table read constants.  */
 static Lisp_Object Qhash_table, Qdata;
 static Lisp_Object Qtest, Qsize;
 static Lisp_Object Qweakness;
@@ -105,16 +110,13 @@ static Lisp_Object load_descriptor_list;
 /* File for get_file_char to read from.  Use by load.  */
 static FILE *instream;
 
-/* When nonzero, read conses in pure space */
-static int read_pure;
-
 /* For use within read-from-string (this reader is non-reentrant!!)  */
-static EMACS_INT read_from_string_index;
-static EMACS_INT read_from_string_index_byte;
-static EMACS_INT read_from_string_limit;
+static ptrdiff_t read_from_string_index;
+static ptrdiff_t read_from_string_index_byte;
+static ptrdiff_t read_from_string_limit;
 
 /* Number of characters read in the current call to Fread or
-   Fread_from_string. */
+   Fread_from_string.  */
 static EMACS_INT readchar_count;
 
 /* This contains the last string skipped with #@.  */
@@ -157,10 +159,6 @@ static void readevalloop (Lisp_Object, FILE*, Lisp_Object, int,
                           Lisp_Object, Lisp_Object);
 static Lisp_Object load_unwind (Lisp_Object);
 static Lisp_Object load_descriptor_unwind (Lisp_Object);
-
-static void invalid_syntax (const char *) NO_RETURN;
-static void end_of_file_error (void) NO_RETURN;
-
 \f
 /* Functions that read one byte from the current source READCHARFUN
    or unreads one byte.  If the integer argument C is -1, it returns
@@ -187,7 +185,7 @@ static int readbyte_from_string (int, Lisp_Object);
 /* When READCHARFUN is Qget_file_char, Qget_emacs_mule_file_char,
    Qlambda, or a cons, we use this to keep an unread character because
    a file stream can't handle multibyte-char unreading.  The value -1
-   means that there's no unread character. */
+   means that there's no unread character.  */
 static int unread_char;
 
 static int
@@ -209,7 +207,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
     {
       register struct buffer *inbuffer = XBUFFER (readcharfun);
 
-      EMACS_INT pt_byte = BUF_PT_BYTE (inbuffer);
+      ptrdiff_t pt_byte = BUF_PT_BYTE (inbuffer);
 
       if (pt_byte >= BUF_ZV_BYTE (inbuffer))
        return -1;
@@ -238,7 +236,7 @@ readchar (Lisp_Object readcharfun, int *multibyte)
     {
       register struct buffer *inbuffer = XMARKER (readcharfun)->buffer;
 
-      EMACS_INT bytepos = marker_byte_position (readcharfun);
+      ptrdiff_t bytepos = marker_byte_position (readcharfun);
 
       if (bytepos >= BUF_ZV_BYTE (inbuffer))
        return -1;
@@ -372,8 +370,8 @@ unreadchar (Lisp_Object readcharfun, int c)
   else if (BUFFERP (readcharfun))
     {
       struct buffer *b = XBUFFER (readcharfun);
-      EMACS_INT charpos = BUF_PT (b);
-      EMACS_INT bytepos = BUF_PT_BYTE (b);
+      ptrdiff_t charpos = BUF_PT (b);
+      ptrdiff_t bytepos = BUF_PT_BYTE (b);
 
       if (! NILP (BVAR (b, enable_multibyte_characters)))
        BUF_DEC_POS (b, bytepos);
@@ -385,7 +383,7 @@ unreadchar (Lisp_Object readcharfun, int c)
   else if (MARKERP (readcharfun))
     {
       struct buffer *b = XMARKER (readcharfun)->buffer;
-      EMACS_INT bytepos = XMARKER (readcharfun)->bytepos;
+      ptrdiff_t bytepos = XMARKER (readcharfun)->bytepos;
 
       XMARKER (readcharfun)->charpos--;
       if (! NILP (BVAR (b, enable_multibyte_characters)))
@@ -447,7 +445,7 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
   c = getc (instream);
 
 #ifdef EINTR
-  /* Interrupted reads have been observed while reading over the network */
+  /* Interrupted reads have been observed while reading over the network */
   while (c == EOF && ferror (instream) && errno == EINTR)
     {
       UNBLOCK_INPUT;
@@ -604,15 +602,9 @@ read_filtered_event (int no_switch_frame, int ascii_required,
   /* Compute timeout.  */
   if (NUMBERP (seconds))
     {
-      EMACS_TIME wait_time;
-      int sec, usec;
       double duration = extract_float (seconds);
-
-      sec  = (int) duration;
-      usec = (duration - sec) * 1000000;
-      EMACS_GET_TIME (end_time);
-      EMACS_SET_SECS_USECS (wait_time, sec, usec);
-      EMACS_ADD_TIME (end_time, end_time, wait_time);
+      EMACS_TIME wait_time = EMACS_TIME_FROM_DOUBLE (duration);
+      end_time = add_emacs_time (current_emacs_time (), wait_time);
     }
 
 /* Read until we get an acceptable event.  */
@@ -914,7 +906,7 @@ safe_to_load_p (int fd)
 
       if (i >= nbytes
          || fast_c_string_match_ignore_case (Vbytecomp_version_regexp,
-                                             buf + i) < 0)
+                                             buf + i, nbytes - i) < 0)
        safe_p = 0;
     }
   if (safe_p)
@@ -1022,7 +1014,7 @@ Return t if the file exists and loads successfully.  */)
 {
   register FILE *stream;
   register int fd = -1;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3;
   Lisp_Object found, efound, hist_file_name;
   /* 1 means we printed the ".el is newer" message.  */
@@ -1067,7 +1059,7 @@ Return t if the file exists and loads successfully.  */)
 
 
   /* Avoid weird lossage with null string as arg,
-     since it would try to load a directory as a Lisp file */
+     since it would try to load a directory as a Lisp file */
   if (SBYTES (file) > 0)
     {
       ptrdiff_t size = SBYTES (file);
@@ -1171,7 +1163,7 @@ Return t if the file exists and loads successfully.  */)
      Vload_source_file_function.  */
   specbind (Qlexical_binding, Qnil);
 
-  /* Get the name for load-history. */
+  /* Get the name for load-history.  */
   hist_file_name = (! NILP (Vpurify_flag)
                     ? Fconcat (2, (tmp[0] = Ffile_name_directory (file),
                                    tmp[1] = Ffile_name_nondirectory (found),
@@ -1226,7 +1218,8 @@ Return t if the file exists and loads successfully.  */)
              SSET (efound, SBYTES (efound) - 1, 'c');
            }
 
-         if (result == 0 && s1.st_mtime < s2.st_mtime)
+         if (result == 0
+             && EMACS_TIME_LT (get_stat_mtime (&s1), get_stat_mtime (&s2)))
            {
              /* Make the progress messages mention that source is newer.  */
              newer = 1;
@@ -1324,7 +1317,7 @@ Return t if the file exists and loads successfully.  */)
     }
   unbind_to (count, Qnil);
 
-  /* Run any eval-after-load forms for this file */
+  /* Run any eval-after-load forms for this file */
   if (!NILP (Ffboundp (Qdo_after_load_evaluation)))
     call1 (Qdo_after_load_evaluation, hist_file_name) ;
 
@@ -1356,7 +1349,7 @@ Return t if the file exists and loads successfully.  */)
 }
 
 static Lisp_Object
-load_unwind (Lisp_Object arg)  /* used as unwind-protect function in load */
+load_unwind (Lisp_Object arg)  /* Used as unwind-protect function in load.  */
 {
   FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
   if (stream != NULL)
@@ -1442,16 +1435,16 @@ int
 openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate)
 {
   register int fd;
-  EMACS_INT fn_size = 100;
+  ptrdiff_t fn_size = 100;
   char buf[100];
   register char *fn = buf;
   int absolute = 0;
-  EMACS_INT want_length;
+  ptrdiff_t want_length;
   Lisp_Object filename;
   struct stat st;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   Lisp_Object string, tail, encoded_fn;
-  EMACS_INT max_suffix_len = 0;
+  ptrdiff_t max_suffix_len = 0;
 
   CHECK_STRING (str);
 
@@ -1475,13 +1468,13 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
     {
       filename = Fexpand_file_name (str, XCAR (path));
       if (!complete_filename_p (filename))
-       /* If there are non-absolute elts in PATH (eg ".") */
+       /* If there are non-absolute elts in PATH (eg ".") */
        /* Of course, this could conceivably lose if luser sets
-          default-directory to be something non-absolute... */
+          default-directory to be something non-absolute...  */
        {
          filename = Fexpand_file_name (filename, BVAR (current_buffer, directory));
          if (!complete_filename_p (filename))
-           /* Give up on this path element! */
+           /* Give up on this path element!  */
            continue;
        }
 
@@ -1489,36 +1482,26 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
         this path element/specified file name and any possible suffix.  */
       want_length = max_suffix_len + SBYTES (filename);
       if (fn_size <= want_length)
-       fn = (char *) alloca (fn_size = 100 + want_length);
+       fn = alloca (fn_size = 100 + want_length);
 
       /* Loop over suffixes.  */
       for (tail = NILP (suffixes) ? Fcons (empty_unibyte_string, Qnil) : suffixes;
           CONSP (tail); tail = XCDR (tail))
        {
-         ptrdiff_t lsuffix = SBYTES (XCAR (tail));
+         ptrdiff_t fnlen, lsuffix = SBYTES (XCAR (tail));
          Lisp_Object handler;
          int exists;
 
          /* Concatenate path element/specified name with the suffix.
             If the directory starts with /:, remove that.  */
-         if (SCHARS (filename) > 2
-             && SREF (filename, 0) == '/'
-             && SREF (filename, 1) == ':')
-           {
-             strncpy (fn, SSDATA (filename) + 2,
-                      SBYTES (filename) - 2);
-             fn[SBYTES (filename) - 2] = 0;
-           }
-         else
-           {
-             strncpy (fn, SSDATA (filename),
-                      SBYTES (filename));
-             fn[SBYTES (filename)] = 0;
-           }
-
-         if (lsuffix != 0)  /* Bug happens on CCI if lsuffix is 0.  */
-           strncat (fn, SSDATA (XCAR (tail)), lsuffix);
-
+         int prefixlen = ((SCHARS (filename) > 2
+                           && SREF (filename, 0) == '/'
+                           && SREF (filename, 1) == ':')
+                          ? 2 : 0);
+         fnlen = SBYTES (filename) - prefixlen;
+         memcpy (fn, SDATA (filename) + prefixlen, fnlen);
+         memcpy (fn + fnlen, SDATA (XCAR (tail)), lsuffix + 1);
+         fnlen += lsuffix;
          /* Check that the file exists and is not a directory.  */
          /* We used to only check for handlers on non-absolute file names:
                if (absolute)
@@ -1527,7 +1510,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
                  handler = Ffind_file_name_handler (filename, Qfile_exists_p);
             It's not clear why that was the case and it breaks things like
             (load "/bar.el") where the file is actually "/bar.el.gz".  */
-         string = build_string (fn);
+         string = make_string (fn, fnlen);
          handler = Ffind_file_name_handler (string, Qfile_exists_p);
          if ((!NILP (handler) || !NILP (predicate)) && !NATNUMP (predicate))
             {
@@ -1561,7 +1544,9 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
                {
                  /* Check that we can access or open it.  */
                  if (NATNUMP (predicate))
-                   fd = (access (pfn, XFASTINT (predicate)) == 0) ? 1 : -1;
+                   fd = (((XFASTINT (predicate) & ~INT_MAX) == 0
+                          && access (pfn, XFASTINT (predicate)) == 0)
+                         ? 1 : -1);
                  else
                    fd = emacs_open (pfn, O_RDONLY, 0);
 
@@ -1606,12 +1591,12 @@ build_load_history (Lisp_Object filename, int entire)
     {
       tem = XCAR (tail);
 
-      /* Find the feature's previous assoc list... */
+      /* Find the feature's previous assoc list...  */
       if (!NILP (Fequal (filename, Fcar (tem))))
        {
          foundit = 1;
 
-         /*  If we're loading the entire file, remove old data. */
+         /*  If we're loading the entire file, remove old data.  */
          if (entire)
            {
              if (NILP (prev))
@@ -1652,13 +1637,6 @@ build_load_history (Lisp_Object filename, int entire)
                           Vload_history);
 }
 
-static Lisp_Object
-unreadpure (Lisp_Object junk) /* Used as unwind-protect function in readevalloop */
-{
-  read_pure = 0;
-  return Qnil;
-}
-
 static Lisp_Object
 readevalloop_1 (Lisp_Object old)
 {
@@ -1669,7 +1647,7 @@ readevalloop_1 (Lisp_Object old)
 /* Signal an `end-of-file' error, if possible with file name
    information.  */
 
-static void
+static _Noreturn void
 end_of_file_error (void)
 {
   if (STRINGP (Vload_file_name))
@@ -1695,7 +1673,7 @@ readevalloop (Lisp_Object readcharfun,
 {
   register int c;
   register Lisp_Object val;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   struct buffer *b = 0;
   int continue_reading_p;
@@ -1735,7 +1713,7 @@ readevalloop (Lisp_Object readcharfun,
 
   GCPRO4 (sourcename, readfun, start, end);
 
-  /* Try to ensure sourcename is a truename, except whilst preloading. */
+  /* Try to ensure sourcename is a truename, except whilst preloading.  */
   if (NILP (Vpurify_flag)
       && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))
       && !NILP (Ffboundp (Qfile_truename)))
@@ -1746,7 +1724,7 @@ readevalloop (Lisp_Object readcharfun,
   continue_reading_p = 1;
   while (continue_reading_p)
     {
-      int count1 = SPECPDL_INDEX ();
+      ptrdiff_t count1 = SPECPDL_INDEX ();
 
       if (b != 0 && NILP (BVAR (b, name)))
        error ("Reading from killed buffer");
@@ -1800,8 +1778,7 @@ readevalloop (Lisp_Object readcharfun,
 
       if (!NILP (Vpurify_flag) && c == '(')
        {
-         record_unwind_protect (unreadpure, Qnil);
-         val = read_list (-1, readcharfun);
+         val = read_list (0, readcharfun);
        }
       else
        {
@@ -1872,7 +1849,7 @@ DO-ALLOW-PRINT, if non-nil, specifies that `print' and related
 This function preserves the position of point.  */)
   (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename, Lisp_Object unibyte, Lisp_Object do_allow_print)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object tem, buf;
 
   if (NILP (buffer))
@@ -1917,7 +1894,7 @@ This function does not move point.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object printflag, Lisp_Object read_function)
 {
   /* FIXME: Do the eval-sexp-add-defvars dance!  */
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object tem, cbuf;
 
   cbuf = Fcurrent_buffer ();
@@ -1929,7 +1906,7 @@ This function does not move point.  */)
   specbind (Qstandard_output, tem);
   specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list));
 
-  /* readevalloop calls functions which check the type of start and end.  */
+  /* `readevalloop' calls functions which check the type of start and end.  */
   readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename),
                !NILP (printflag), Qnil, read_function,
                start, end);
@@ -1972,16 +1949,16 @@ START and END optionally delimit a substring of STRING from which to read;
 {
   Lisp_Object ret;
   CHECK_STRING (string);
-  /* read_internal_start sets read_from_string_index. */
+  /* `read_internal_start' sets `read_from_string_index'.  */
   ret = read_internal_start (string, start, end);
   return Fcons (ret, make_number (read_from_string_index));
 }
 
 /* Function to set up the global context we need in toplevel read
-   calls. */
+   calls.  */
 static Lisp_Object
 read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
-/* start, end only used when stream is a string. */
+/* `start', `end' only used when stream is a string.  */
 {
   Lisp_Object retval;
 
@@ -1995,7 +1972,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
   if (STRINGP (stream)
       || ((CONSP (stream) && STRINGP (XCAR (stream)))))
     {
-      EMACS_INT startval, endval;
+      ptrdiff_t startval, endval;
       Lisp_Object string;
 
       if (STRINGP (stream))
@@ -2008,9 +1985,9 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
       else
        {
          CHECK_NUMBER (end);
-         endval = XINT (end);
-         if (endval < 0 || endval > SCHARS (string))
+         if (! (0 <= XINT (end) && XINT (end) <= SCHARS (string)))
            args_out_of_range (string, end);
+         endval = XINT (end);
        }
 
       if (NILP (start))
@@ -2018,9 +1995,9 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
       else
        {
          CHECK_NUMBER (start);
-         startval = XINT (start);
-         if (startval < 0 || startval > endval)
+         if (! (0 <= XINT (start) && XINT (start) <= endval))
            args_out_of_range (string, start);
+         startval = XINT (start);
        }
       read_from_string_index = startval;
       read_from_string_index_byte = string_char_to_byte (string, startval);
@@ -2038,7 +2015,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
 /* Signal Qinvalid_read_syntax error.
    S is error string of length N (if > 0)  */
 
-static void
+static _Noreturn void
 invalid_syntax (const char *s)
 {
   xsignal1 (Qinvalid_read_syntax, build_string (s));
@@ -2046,7 +2023,7 @@ invalid_syntax (const char *s)
 
 
 /* Use this for recursive reads, in contexts where internal tokens
-   are not allowed. */
+   are not allowed.  */
 
 static Lisp_Object
 read0 (Lisp_Object readcharfun)
@@ -2073,7 +2050,7 @@ read_escape (Lisp_Object readcharfun, int stringp)
 {
   register int c = READCHAR;
   /* \u allows up to four hex digits, \U up to eight.  Default to the
-     behavior for \u, and change this value in the case that \U is seen. */
+     behavior for \u, and change this value in the case that \U is seen.  */
   int unicode_hex_count = 4;
 
   switch (c)
@@ -2259,8 +2236,8 @@ read_escape (Lisp_Object readcharfun, int stringp)
        while (++count <= unicode_hex_count)
          {
            c = READCHAR;
-           /* isdigit and isalpha may be locale-specific, which we don't
-              want. */
+           /* `isdigit' and `isalpha' may be locale-specific, which we don't
+              want.  */
            if      (c >= '0' && c <= '9')  i = (i << 4) + (c - '0');
            else if (c >= 'a' && c <= 'f')  i = (i << 4) + (c - 'a') + 10;
             else if (c >= 'A' && c <= 'F')  i = (i << 4) + (c - 'A') + 10;
@@ -2414,13 +2391,13 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
            {
              /* Accept extended format for hashtables (extensible to
                 other types), e.g.
-                #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
+                #s(hash-table size 2 test equal data (k1 v1 k2 v2))  */
              Lisp_Object tmp = read_list (0, readcharfun);
              Lisp_Object head = CAR_SAFE (tmp);
              Lisp_Object data = Qnil;
              Lisp_Object val = Qnil;
              /* The size is 2 * number of allowed keywords to
-                make-hash-table. */
+                make-hash-table.  */
              Lisp_Object params[10];
              Lisp_Object ht;
              Lisp_Object key = Qnil;
@@ -2432,36 +2409,36 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
 
              tmp = CDR_SAFE (tmp);
 
-             /* This is repetitive but fast and simple. */
+             /* This is repetitive but fast and simple.  */
              params[param_count] = QCsize;
-             params[param_count+1] = Fplist_get (tmp, Qsize);
+             params[param_count + 1] = Fplist_get (tmp, Qsize);
              if (!NILP (params[param_count + 1]))
                param_count += 2;
 
              params[param_count] = QCtest;
-             params[param_count+1] = Fplist_get (tmp, Qtest);
+             params[param_count + 1] = Fplist_get (tmp, Qtest);
              if (!NILP (params[param_count + 1]))
                param_count += 2;
 
              params[param_count] = QCweakness;
-             params[param_count+1] = Fplist_get (tmp, Qweakness);
+             params[param_count + 1] = Fplist_get (tmp, Qweakness);
              if (!NILP (params[param_count + 1]))
                param_count += 2;
 
              params[param_count] = QCrehash_size;
-             params[param_count+1] = Fplist_get (tmp, Qrehash_size);
+             params[param_count + 1] = Fplist_get (tmp, Qrehash_size);
              if (!NILP (params[param_count + 1]))
                param_count += 2;
 
              params[param_count] = QCrehash_threshold;
-             params[param_count+1] = Fplist_get (tmp, Qrehash_threshold);
+             params[param_count + 1] = Fplist_get (tmp, Qrehash_threshold);
              if (!NILP (params[param_count + 1]))
                param_count += 2;
 
-             /* This is the hashtable data. */
+             /* This is the hashtable data.  */
              data = Fplist_get (tmp, Qdata);
 
-             /* Now use params to make a new hashtable and fill it. */
+             /* Now use params to make a new hashtable and fill it.  */
              ht = Fmake_hash_table (param_count, params);
 
              while (CONSP (data))
@@ -2498,16 +2475,17 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
              if (c == '[')
                {
                  Lisp_Object tmp;
-                 EMACS_INT depth, size;
+                 int depth;
+                 ptrdiff_t size;
 
                  tmp = read_vector (readcharfun, 0);
-                 if (!INTEGERP (AREF (tmp, 0)))
+                 size = ASIZE (tmp);
+                 if (size == 0)
+                   error ("Invalid size char-table");
+                 if (! RANGED_INTEGERP (1, AREF (tmp, 0), 3))
                    error ("Invalid depth in char-table");
                  depth = XINT (AREF (tmp, 0));
-                 if (depth < 1 || depth > 3)
-                   error ("Invalid depth in char-table");
-                 size = ASIZE (tmp) - 2;
-                 if (chartab_size [depth] != size)
+                 if (chartab_size[depth] != size - 2)
                    error ("Invalid size char-table");
                  XSETPVECTYPE (XVECTOR (tmp), PVEC_SUB_CHAR_TABLE);
                  return tmp;
@@ -2556,8 +2534,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
             build them using function calls.  */
          Lisp_Object tmp;
          tmp = read_vector (readcharfun, 1);
-         return Fmake_byte_code (ASIZE (tmp),
-                                 XVECTOR (tmp)->contents);
+         make_byte_code (XVECTOR (tmp));
+         return tmp;
        }
       if (c == '(')
        {
@@ -2640,13 +2618,12 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
 
              if (saved_doc_string_size == 0)
                {
-                 saved_doc_string = (char *) xmalloc (nskip + extra);
+                 saved_doc_string = xmalloc (nskip + extra);
                  saved_doc_string_size = nskip + extra;
                }
              if (nskip > saved_doc_string_size)
                {
-                 saved_doc_string = (char *) xrealloc (saved_doc_string,
-                                                       nskip + extra);
+                 saved_doc_string = xrealloc (saved_doc_string, nskip + extra);
                  saved_doc_string_size = nskip + extra;
                }
 
@@ -2693,13 +2670,13 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
              /* No symbol character follows, this is the empty
                 symbol.  */
              UNREAD (c);
-             return Fmake_symbol (build_string (""));
+             return Fmake_symbol (empty_unibyte_string);
            }
          goto read_symbol;
        }
       /* ## is the empty symbol.  */
       if (c == '#')
-       return Fintern (build_string (""), Qnil);
+       return Fintern (empty_unibyte_string, Qnil);
       /* Reader forms that can reuse previously read objects.  */
       if (c >= '0' && c <= '9')
        {
@@ -2728,7 +2705,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
                       n for #n#.  */
                  if (c == '=')
                    {
-                     /* Make a placeholder for #n# to use temporarily */
+                     /* Make a placeholder for #n# to use temporarily */
                      Lisp_Object placeholder;
                      Lisp_Object cell;
 
@@ -2736,10 +2713,10 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
                      cell = Fcons (make_number (n), placeholder);
                      read_objects = Fcons (cell, read_objects);
 
-                     /* Read the object itself. */
+                     /* Read the object itself.  */
                      tem = read0 (readcharfun);
 
-                     /* Now put it everywhere the placeholder was... */
+                     /* Now put it everywhere the placeholder was...  */
                      substitute_object_in_subtree (tem, placeholder);
 
                      /* ...and #n# will use the real value from now on.  */
@@ -2909,8 +2886,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
                ptrdiff_t offset = p - read_buffer;
                if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
                  memory_full (SIZE_MAX);
-               read_buffer = (char *) xrealloc (read_buffer,
-                                                read_buffer_size * 2);
+               read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
                read_buffer_size *= 2;
                p = read_buffer + offset;
                end = read_buffer + read_buffer_size;
@@ -2922,7 +2898,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
 
                ch = read_escape (readcharfun, 1);
 
-               /* CH is -1 if \ newline has just been seen */
+               /* CH is -1 if \ newline has just been seen */
                if (ch == -1)
                  {
                    if (p == read_buffer)
@@ -2937,7 +2913,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
                  force_singlebyte = 1;
                else if (! ASCII_CHAR_P (ch))
                  force_multibyte = 1;
-               else            /* i.e. ASCII_CHAR_P (ch) */
+               else            /* I.e. ASCII_CHAR_P (ch).  */
                  {
                    /* Allow `\C- ' and `\C-?'.  */
                    if (modifiers == CHAR_CTL)
@@ -2987,28 +2963,19 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
 
        /* If purifying, and string starts with \ newline,
           return zero instead.  This is for doc strings
-          that we are really going to find in etc/DOC.nn.nn  */
+          that we are really going to find in etc/DOC.nn.nn.  */
        if (!NILP (Vpurify_flag) && NILP (Vdoc_file_name) && cancel)
          return make_number (0);
 
-       if (force_multibyte)
-         /* READ_BUFFER already contains valid multibyte forms.  */
-         ;
-       else if (force_singlebyte)
+       if (! force_multibyte && force_singlebyte)
          {
+           /* READ_BUFFER contains raw 8-bit bytes and no multibyte
+              forms.  Convert it to unibyte.  */
            nchars = str_as_unibyte ((unsigned char *) read_buffer,
                                     p - read_buffer);
            p = read_buffer + nchars;
          }
-       else
-         {
-           /* Otherwise, READ_BUFFER contains only ASCII.  */
-         }
 
-       if (read_pure)
-         return make_pure_string (read_buffer, nchars, p - read_buffer,
-                                  (force_multibyte
-                                   || (p - read_buffer != nchars)));
        return make_specified_string (read_buffer, nchars, p - read_buffer,
                                      (force_multibyte
                                       || (p - read_buffer != nchars)));
@@ -3053,8 +3020,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
                  ptrdiff_t offset = p - read_buffer;
                  if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
                    memory_full (SIZE_MAX);
-                 read_buffer = (char *) xrealloc (read_buffer,
-                                                  read_buffer_size * 2);
+                 read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
                  read_buffer_size *= 2;
                  p = read_buffer + offset;
                  end = read_buffer + read_buffer_size;
@@ -3084,8 +3050,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
              ptrdiff_t offset = p - read_buffer;
              if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < read_buffer_size)
                memory_full (SIZE_MAX);
-             read_buffer = (char *) xrealloc (read_buffer,
-                                              read_buffer_size * 2);
+             read_buffer = xrealloc (read_buffer, read_buffer_size * 2);
              read_buffer_size *= 2;
              p = read_buffer + offset;
              end = read_buffer + read_buffer_size;
@@ -3102,25 +3067,24 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
          }
        {
          Lisp_Object name, result;
-         EMACS_INT nbytes = p - read_buffer;
-         EMACS_INT nchars
+         ptrdiff_t nbytes = p - read_buffer;
+         ptrdiff_t nchars
            = (multibyte
               ? multibyte_chars_in_text ((unsigned char *) read_buffer,
                                          nbytes)
               : nbytes);
 
-         if (uninterned_symbol && ! NILP (Vpurify_flag))
-           name = make_pure_string (read_buffer, nchars, nbytes, multibyte);
-         else
-           name = make_specified_string (read_buffer, nchars, nbytes, multibyte);
+         name = ((uninterned_symbol && ! NILP (Vpurify_flag)
+                  ? make_pure_string : make_specified_string)
+                 (read_buffer, nchars, nbytes, multibyte));
          result = (uninterned_symbol ? Fmake_symbol (name)
                    : Fintern (name, Qnil));
 
          if (EQ (Vread_with_symbol_positions, Qt)
              || EQ (Vread_with_symbol_positions, readcharfun))
-           Vread_symbol_positions_list =
-             Fcons (Fcons (result, make_number (start_position)),
-                    Vread_symbol_positions_list);
+           Vread_symbol_positions_list
+             Fcons (Fcons (result, make_number (start_position)),
+                      Vread_symbol_positions_list);
          return result;
        }
       }
@@ -3128,7 +3092,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
 }
 \f
 
-/* List of nodes we've seen during substitute_object_in_subtree. */
+/* List of nodes we've seen during substitute_object_in_subtree.  */
 static Lisp_Object seen_list;
 
 static void
@@ -3136,23 +3100,23 @@ substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder)
 {
   Lisp_Object check_object;
 
-  /* We haven't seen any objects when we start. */
+  /* We haven't seen any objects when we start.  */
   seen_list = Qnil;
 
-  /* Make all the substitutions. */
+  /* Make all the substitutions.  */
   check_object
     = substitute_object_recurse (object, placeholder, object);
 
-  /* Clear seen_list because we're done with it. */
+  /* Clear seen_list because we're done with it.  */
   seen_list = Qnil;
 
   /* The returned object here is expected to always eq the
-     original. */
+     original.  */
   if (!EQ (check_object, object))
     error ("Unexpected mutation error in reader");
 }
 
-/*  Feval doesn't get called from here, so no gc protection is needed. */
+/*  Feval doesn't get called from here, so no gc protection is needed.  */
 #define SUBSTITUTE(get_val, set_val)                   \
   do {                                                 \
     Lisp_Object old_value = get_val;                   \
@@ -3169,11 +3133,11 @@ substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder)
 static Lisp_Object
 substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Object subtree)
 {
-  /* If we find the placeholder, return the target object. */
+  /* If we find the placeholder, return the target object.  */
   if (EQ (placeholder, subtree))
     return object;
 
-  /* If we've been to this node before, don't explore it again. */
+  /* If we've been to this node before, don't explore it again.  */
   if (!EQ (Qnil, Fmemq (subtree, seen_list)))
     return subtree;
 
@@ -3223,7 +3187,7 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
     case Lisp_String:
       {
        /* Check for text properties in each interval.
-          substitute_in_interval contains part of the logic. */
+          substitute_in_interval contains part of the logic.  */
 
        INTERVAL    root_interval = STRING_INTERVALS (subtree);
        Lisp_Object arg           = Fcons (object, placeholder);
@@ -3234,7 +3198,7 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
        return subtree;
       }
 
-      /* Other types don't recurse any further. */
+      /* Other types don't recurse any further.  */
     default:
       return subtree;
     }
@@ -3421,7 +3385,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
 
   tem = read_list (1, readcharfun);
   len = Flength (tem);
-  vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil));
+  vector = Fmake_vector (len, Qnil);
 
   size = ASIZE (vector);
   ptr = XVECTOR (vector)->contents;
@@ -3468,7 +3432,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
                }
 
              /* Now handle the bytecode slot.  */
-             ptr[COMPILED_BYTECODE] = read_pure ? Fpurecopy (bytestr) : bytestr;
+             ptr[COMPILED_BYTECODE] = bytestr;
            }
          else if (i == COMPILED_DOC_STRING
                   && STRINGP (item)
@@ -3480,7 +3444,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
                item = Fstring_as_multibyte (item);
            }
        }
-      ptr[i] = read_pure ? Fpurecopy (item) : item;
+      ptr[i] = item;
       otem = XCONS (tem);
       tem = Fcdr (tem);
       free_cons (otem);
@@ -3488,17 +3452,11 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
   return vector;
 }
 
-/* FLAG = 1 means check for ] to terminate rather than ) and .
-   FLAG = -1 means check for starting with defun
-    and make structure pure.  */
+/* FLAG = 1 means check for ] to terminate rather than ) and .  */
 
 static Lisp_Object
 read_list (int flag, register Lisp_Object readcharfun)
 {
-  /* -1 means check next element for defun,
-     0 means don't check,
-     1 means already checked and found defun. */
-  int defunflag = flag < 0 ? -1 : 0;
   Lisp_Object val, tail;
   register Lisp_Object elt, tem;
   struct gcpro gcpro1, gcpro2;
@@ -3540,7 +3498,7 @@ read_list (int flag, register Lisp_Object readcharfun)
               We don't use Fexpand_file_name because that would make
               the directory absolute now.  */
            elt = concat2 (build_string ("../lisp/"),
-                          Ffile_name_nondirectory (elt));
+                        Ffile_name_nondirectory (elt));
        }
       else if (EQ (elt, Vload_file_name)
               && ! NILP (elt)
@@ -3660,24 +3618,18 @@ read_list (int flag, register Lisp_Object readcharfun)
            }
          invalid_syntax ("] in a list");
        }
-      tem = (read_pure && flag <= 0
-            ? pure_cons (elt, Qnil)
-            : Fcons (elt, Qnil));
+      tem = Fcons (elt, Qnil);
       if (!NILP (tail))
        XSETCDR (tail, tem);
       else
        val = tem;
       tail = tem;
-      if (defunflag < 0)
-       defunflag = EQ (elt, Qdefun);
-      else if (defunflag > 0)
-       read_pure = 1;
     }
 }
 \f
 static Lisp_Object initial_obarray;
 
-/* oblookup stores the bucket number here, for the sake of Funintern.  */
+/* `oblookup' stores the bucket number here, for the sake of Funintern.  */
 
 static size_t oblookup_last_bucket_number;
 
@@ -3700,32 +3652,20 @@ check_obarray (Lisp_Object obarray)
    interned in the current obarray.  */
 
 Lisp_Object
-intern (const char *str)
+intern_1 (const char *str, ptrdiff_t len)
 {
-  Lisp_Object tem;
-  ptrdiff_t len = strlen (str);
-  Lisp_Object obarray;
+  Lisp_Object obarray = check_obarray (Vobarray);
+  Lisp_Object tem = oblookup (obarray, str, len, len);
 
-  obarray = Vobarray;
-  if (!VECTORP (obarray) || ASIZE (obarray) == 0)
-    obarray = check_obarray (obarray);
-  tem = oblookup (obarray, str, len, len);
-  if (SYMBOLP (tem))
-    return tem;
-  return Fintern (make_string (str, len), obarray);
+  return SYMBOLP (tem) ? tem : Fintern (make_string (str, len), obarray);
 }
 
 Lisp_Object
-intern_c_string (const char *str)
+intern_c_string_1 (const char *str, ptrdiff_t len)
 {
-  Lisp_Object tem;
-  ptrdiff_t len = strlen (str);
-  Lisp_Object obarray;
+  Lisp_Object obarray = check_obarray (Vobarray);
+  Lisp_Object tem = oblookup (obarray, str, len, len);
 
-  obarray = Vobarray;
-  if (!VECTORP (obarray) || ASIZE (obarray) == 0)
-    obarray = check_obarray (obarray);
-  tem = oblookup (obarray, str, len, len);
   if (SYMBOLP (tem))
     return tem;
 
@@ -3735,7 +3675,7 @@ intern_c_string (const char *str)
        with the extra copy.  */
     abort ();
 
-  return Fintern (make_pure_c_string (str), obarray);
+  return Fintern (make_pure_c_string (str, len), obarray);
 }
 \f
 DEFUN ("intern", Fintern, Sintern, 1, 2, 0,
@@ -3775,7 +3715,7 @@ it defaults to the value of `obarray'.  */)
       SET_SYMBOL_VAL (XSYMBOL (sym), sym);
     }
 
-  ptr = &XVECTOR (obarray)->contents[XINT (tem)];
+  ptr = &AREF (obarray, XINT(tem));
   if (SYMBOLP (*ptr))
     XSYMBOL (sym)->next = XSYMBOL (*ptr);
   else
@@ -3854,18 +3794,18 @@ OBARRAY defaults to the value of the variable `obarray'.  */)
 
   hash = oblookup_last_bucket_number;
 
-  if (EQ (XVECTOR (obarray)->contents[hash], tem))
+  if (EQ (AREF (obarray, hash), tem))
     {
       if (XSYMBOL (tem)->next)
-       XSETSYMBOL (XVECTOR (obarray)->contents[hash], XSYMBOL (tem)->next);
+       XSETSYMBOL (AREF (obarray, hash), XSYMBOL (tem)->next);
       else
-       XSETINT (XVECTOR (obarray)->contents[hash], 0);
+       XSETINT (AREF (obarray, hash), 0);
     }
   else
     {
       Lisp_Object tail, following;
 
-      for (tail = XVECTOR (obarray)->contents[hash];
+      for (tail = AREF (obarray, hash);
           XSYMBOL (tail)->next;
           tail = following)
        {
@@ -3888,28 +3828,25 @@ OBARRAY defaults to the value of the variable `obarray'.  */)
    Also store the bucket number in oblookup_last_bucket_number.  */
 
 Lisp_Object
-oblookup (Lisp_Object obarray, register const char *ptr, EMACS_INT size, EMACS_INT size_byte)
+oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff_t size_byte)
 {
   size_t hash;
   size_t obsize;
   register Lisp_Object tail;
   Lisp_Object bucket, tem;
 
-  if (!VECTORP (obarray)
-      || (obsize = ASIZE (obarray)) == 0)
-    {
-      obarray = check_obarray (obarray);
-      obsize = ASIZE (obarray);
-    }
+  obarray = check_obarray (obarray);
+  obsize = ASIZE (obarray);
+
   /* This is sometimes needed in the middle of GC.  */
   obsize &= ~ARRAY_MARK_FLAG;
   hash = hash_string (ptr, size_byte) % obsize;
-  bucket = XVECTOR (obarray)->contents[hash];
+  bucket = AREF (obarray, hash);
   oblookup_last_bucket_number = hash;
   if (EQ (bucket, make_number (0)))
     ;
   else if (!SYMBOLP (bucket))
-    error ("Bad data in guts of obarray"); /* Like CADR error message */
+    error ("Bad data in guts of obarray"); /* Like CADR error message */
   else
     for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next))
       {
@@ -3932,7 +3869,7 @@ map_obarray (Lisp_Object obarray, void (*fn) (Lisp_Object, Lisp_Object), Lisp_Ob
   CHECK_VECTOR (obarray);
   for (i = ASIZE (obarray) - 1; i >= 0; i--)
     {
-      tail = XVECTOR (obarray)->contents[i];
+      tail = AREF (obarray, i);
       if (SYMBOLP (tail))
        while (1)
          {
@@ -3976,7 +3913,7 @@ init_obarray (void)
   initial_obarray = Vobarray;
   staticpro (&initial_obarray);
 
-  Qunbound = Fmake_symbol (make_pure_c_string ("unbound"));
+  Qunbound = Fmake_symbol (build_pure_c_string ("unbound"));
   /* Set temporary dummy values to Qnil and Vpurify_flag to satisfy the
      NILP (Vpurify_flag) check in intern_c_string.  */
   Qnil = make_number (-1); Vpurify_flag = make_number (1);
@@ -3990,10 +3927,12 @@ init_obarray (void)
   /* XSYMBOL (Qnil)->function = Qunbound; */
   SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
   XSYMBOL (Qnil)->constant = 1;
+  XSYMBOL (Qnil)->declared_special = 1;
   XSYMBOL (Qnil)->plist = Qnil;
 
   Qt = intern_c_string ("t");
   SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
+  XSYMBOL (Qnil)->declared_special = 1;
   XSYMBOL (Qt)->constant = 1;
 
   /* Qt is correct even if CANNOT_DUMP.  loadup.el will set to nil at end.  */
@@ -4001,7 +3940,7 @@ init_obarray (void)
 
   DEFSYM (Qvariable_documentation, "variable-documentation");
 
-  read_buffer = (char *) xmalloc (size);
+  read_buffer = xmalloc (size);
   read_buffer_size = size;
 }
 \f
@@ -4014,7 +3953,7 @@ defsubr (struct Lisp_Subr *sname)
   XSETSUBR (XSYMBOL (sym)->function, sname);
 }
 
-#ifdef NOTDEF /* use fset in subr.el now */
+#ifdef NOTDEF /* Use fset in subr.el now!  */
 void
 defalias (struct Lisp_Subr *sname, char *string)
 {
@@ -4098,62 +4037,110 @@ defvar_kboard (struct Lisp_Kboard_Objfwd *ko_fwd,
   SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd);
 }
 \f
+/* Check that the elements of Vload_path exist.  */
+
+static void
+load_path_check (void)
+{
+  Lisp_Object path_tail;
+
+  /* The only elements that might not exist are those from
+     PATH_LOADSEARCH, EMACSLOADPATH.  Anything else is only added if
+     it exists.  */
+  for (path_tail = Vload_path; !NILP (path_tail); path_tail = XCDR (path_tail))
+    {
+      Lisp_Object dirfile;
+      dirfile = Fcar (path_tail);
+      if (STRINGP (dirfile))
+        {
+          dirfile = Fdirectory_file_name (dirfile);
+          if (access (SSDATA (dirfile), 0) < 0)
+            dir_warning ("Warning: Lisp directory `%s' does not exist.\n",
+                         XCAR (path_tail));
+        }
+    }
+}
+
 /* Record the value of load-path used at the start of dumping
    so we can see if the site changed it later during dumping.  */
 static Lisp_Object dump_path;
 
+/* Compute the default Vload_path, with the following logic:
+   If CANNOT_DUMP:
+   use EMACSLOADPATH env-var if set; otherwise use PATH_LOADSEARCH,
+   prepending PATH_SITELOADSEARCH unless --no-site-lisp.
+   The remainder is what happens when dumping works:
+   If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH.
+   Otherwise use EMACSLOADPATH if set, else PATH_LOADSEARCH.
+
+   If !initialized, then just set both Vload_path and dump_path.
+   If initialized, then if Vload_path != dump_path, do nothing.
+   (Presumably the load-path has already been changed by something.
+   This can only be from a site-load file during dumping,
+   or because EMACSLOADPATH is set.)
+   If Vinstallation_directory is not nil (ie, running uninstalled):
+   If installation-dir/lisp exists and not already a member,
+   we must be running uninstalled.  Reset the load-path
+   to just installation-dir/lisp.  (The default PATH_LOADSEARCH
+   refers to the eventual installation directories.  Since we
+   are not yet installed, we should not use them, even if they exist.)
+   If installation-dir/lisp does not exist, just add dump_path at the
+   end instead.
+   Add installation-dir/leim (if exists and not already a member) at the front.
+   Add installation-dir/site-lisp (if !no_site_lisp, and exists
+   and not already a member) at the front.
+   If installation-dir != source-dir (ie running an uninstalled,
+   out-of-tree build) AND install-dir/src/Makefile exists BUT
+   install-dir/src/Makefile.in does NOT exist (this is a sanity
+   check), then repeat the above steps for source-dir/lisp,
+   leim and site-lisp.
+   Finally, add the site-lisp directories at the front (if !no_site_lisp).
+*/
+
 void
 init_lread (void)
 {
   const char *normal;
-  int turn_off_warning = 0;
-
-  /* Compute the default Vload-path, with the following logic:
-     If CANNOT_DUMP just use PATH_LOADSEARCH.
-     Else if purify-flag (ie dumping) start from PATH_DUMPLOADSEARCH;
-     otherwise start from PATH_LOADSEARCH.
-     If !initialized, then just set both Vload_path and dump_path.
-     If initialized, then if Vload_path != dump_path, do nothing.
-     (Presumably the load-path has already been changed by something.)
-     Also do nothing if Vinstallation_directory is nil.
-     Otherwise:
-       Remove site-lisp directories from the front of load-path.
-       Add installation-dir/lisp (if exists and not already a member),
-         at the front, and turn off warnings about missing directories
-         (because we are presumably running uninstalled).
-         If it does not exist, add dump_path at the end instead.
-       Add installation-dir/leim (if exists and not already a member)
-         at the front.
-       Add installation-dir/site-lisp (if !no_site_lisp, and exists
-         and not already a member) at the front.
-       If installation-dir != source-dir (ie running an uninstalled,
-         out-of-tree build) AND install-dir/src/Makefile exists BUT
-         install-dir/src/Makefile.in does NOT exist (this is a sanity
-         check), then repeat the above steps for source-dir/lisp,
-         leim and site-lisp.
-       Finally, add the previously removed site-lisp directories back
-       at the front (if !no_site_lisp).
-
-     We then warn about any of the load-path elements that do not
-     exist.  The only ones that might not exist are those from
-     PATH_LOADSEARCH, and perhaps dump_path.
-
-     Having done all this, we then throw it all away if purify-flag is
-     nil (ie, not dumping) and EMACSLOADPATH is set, and just
-     unconditionally use the latter value instead.
-     So AFAICS the only net results of all the previous steps will be
-     possibly to issue some irrelevant warnings.
-
-     FIXME? There's a case for saying that if we are running
-     uninstalled, the eventual installation directories should not yet
-     be included in load-path.
-  */
+
 #ifdef CANNOT_DUMP
+#ifdef HAVE_NS
+  const char *loadpath = ns_load_path ();
+#endif
+
   normal = PATH_LOADSEARCH;
-  Vload_path = decode_env_path (0, normal);
+#ifdef HAVE_NS
+  Vload_path = decode_env_path ("EMACSLOADPATH", loadpath ? loadpath : normal);
+#else
+  Vload_path = decode_env_path ("EMACSLOADPATH", normal);
+#endif
+
+  load_path_check ();
+
+  /* FIXME CANNOT_DUMP platforms should get source-dir/lisp etc added
+   to their load-path too, AFAICS.  I don't think we can tell the
+   difference between initialized and !initialized in this case,
+   so we'll have to do it unconditionally when Vinstallation_directory
+   is non-nil.  */
+#ifdef HAVE_NS
+  /* loadpath already includes the app-bundle's site-lisp.  */
+  if (!no_site_lisp && !egetenv ("EMACSLOADPATH") && !loadpath)
+#else
+  if (!no_site_lisp && !egetenv ("EMACSLOADPATH"))
+#endif
+    {
+      Lisp_Object sitelisp;
+      sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
+      if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
+    }
 #else
   if (NILP (Vpurify_flag))
-    normal = PATH_LOADSEARCH;
+    {
+      normal = PATH_LOADSEARCH;
+      /* If the EMACSLOADPATH environment variable is set, use its value.
+         This doesn't apply if we're dumping.  */
+      if (egetenv ("EMACSLOADPATH"))
+        Vload_path = decode_env_path ("EMACSLOADPATH", normal);
+    }
   else
     normal = PATH_DUMPLOADSEARCH;
 
@@ -4162,184 +4149,158 @@ init_lread (void)
      the source directory, instead of the path of the installed elisp
      libraries.  However, if it appears that Vload_path has already been
      changed from the default that was saved before dumping, don't
-     change it further.  */
+     change it further.  Changes can only be due to EMACSLOADPATH, or
+     site-lisp files that were processed during dumping.  */
   if (initialized)
     {
-      if (! NILP (Fequal (dump_path, Vload_path)))
+      if (NILP (Fequal (dump_path, Vload_path)))
+        {
+          /* Do not make any changes, just check the elements exist.  */
+          /* Note: --no-site-lisp is ignored.
+             I don't know what to do about this.  */
+          load_path_check ();
+        }
+      else
        {
+#ifdef HAVE_NS
+         const char *loadpath = ns_load_path ();
+         Vload_path = decode_env_path (0, loadpath ? loadpath : normal);
+#else
          Vload_path = decode_env_path (0, normal);
-         if (no_site_lisp || !NILP (Vinstallation_directory))
+#endif
+         if (!NILP (Vinstallation_directory))
            {
-             Lisp_Object tem, tem1, sitelisp;
-
-             /* Remove "site-lisp" dirs from front of path temporarily
-                and store them in sitelisp, then conc them on at the
-                end so they're always first in path.
-                Note that this won't work if you used a
-                --enable-locallisppath element that does not happen
-                to contain "site-lisp" in its name.
-             */
-             sitelisp = Qnil;
-             while (1)
-               {
-                 tem = Fcar (Vload_path);
-                 tem1 = Fstring_match (build_string ("site-lisp"),
-                                       tem, Qnil);
-                 if (!NILP (tem1))
-                   {
-                     Vload_path = Fcdr (Vload_path);
-                     sitelisp = Fcons (tem, sitelisp);
-                   }
-                 else
-                   break;
-               }
-
-             if (!NILP (Vinstallation_directory))
-               {
-                 /* Add to the path the lisp subdir of the
-                    installation dir, if it exists.  */
-                 tem = Fexpand_file_name (build_string ("lisp"),
-                                          Vinstallation_directory);
-                 tem1 = Ffile_exists_p (tem);
-                 if (!NILP (tem1))
-                   {
-                     if (NILP (Fmember (tem, Vload_path)))
-                       {
-                         turn_off_warning = 1;
-                         Vload_path = Fcons (tem, Vload_path);
-                       }
-                   }
-                 else
-                   /* That dir doesn't exist, so add the build-time
-                      Lisp dirs instead.  */
-                   Vload_path = nconc2 (Vload_path, dump_path);
-
-                 /* Add leim under the installation dir, if it exists.  */
-                 tem = Fexpand_file_name (build_string ("leim"),
-                                          Vinstallation_directory);
-                 tem1 = Ffile_exists_p (tem);
-                 if (!NILP (tem1))
-                   {
-                     if (NILP (Fmember (tem, Vload_path)))
-                       Vload_path = Fcons (tem, Vload_path);
-                   }
-
-                 /* Add site-lisp under the installation dir, if it exists.  */
-                 if (!no_site_lisp)
-                   {
-                     tem = Fexpand_file_name (build_string ("site-lisp"),
-                                              Vinstallation_directory);
-                     tem1 = Ffile_exists_p (tem);
-                     if (!NILP (tem1))
-                       {
-                         if (NILP (Fmember (tem, Vload_path)))
-                           Vload_path = Fcons (tem, Vload_path);
-                       }
-                   }
-
-                 /* If Emacs was not built in the source directory,
-                    and it is run from where it was built, add to load-path
-                    the lisp, leim and site-lisp dirs under that directory.  */
-
-                 if (NILP (Fequal (Vinstallation_directory, Vsource_directory)))
-                   {
-                     Lisp_Object tem2;
-
-                     tem = Fexpand_file_name (build_string ("src/Makefile"),
-                                              Vinstallation_directory);
-                     tem1 = Ffile_exists_p (tem);
-
-                     /* Don't be fooled if they moved the entire source tree
-                        AFTER dumping Emacs.  If the build directory is indeed
-                        different from the source dir, src/Makefile.in and
-                        src/Makefile will not be found together.  */
-                     tem = Fexpand_file_name (build_string ("src/Makefile.in"),
-                                              Vinstallation_directory);
-                     tem2 = Ffile_exists_p (tem);
-                     if (!NILP (tem1) && NILP (tem2))
-                       {
-                         tem = Fexpand_file_name (build_string ("lisp"),
-                                                  Vsource_directory);
-
-                         if (NILP (Fmember (tem, Vload_path)))
-                           Vload_path = Fcons (tem, Vload_path);
-
-                         tem = Fexpand_file_name (build_string ("leim"),
-                                                  Vsource_directory);
-
-                         if (NILP (Fmember (tem, Vload_path)))
-                           Vload_path = Fcons (tem, Vload_path);
-
-                         if (!no_site_lisp)
-                           {
-                             tem = Fexpand_file_name (build_string ("site-lisp"),
-                                                      Vsource_directory);
-
-                             if (NILP (Fmember (tem, Vload_path)))
-                               Vload_path = Fcons (tem, Vload_path);
-                           }
-                       }
-                   } /* Vinstallation_directory != Vsource_directory */
-               }     /* if Vinstallation_directory */
-             if (!NILP (sitelisp) && !no_site_lisp)
-               Vload_path = nconc2 (Fnreverse (sitelisp), Vload_path);
-           } /* if Vinstallation_directory || no_site_lisp */
-       }     /* if dump_path == Vload_path */
+             Lisp_Object tem, tem1;
+
+              /* Add to the path the lisp subdir of the installation
+                 dir, if it exists.  Note: in out-of-tree builds,
+                 this directory is empty save for Makefile.  */
+              tem = Fexpand_file_name (build_string ("lisp"),
+                                       Vinstallation_directory);
+              tem1 = Ffile_exists_p (tem);
+              if (!NILP (tem1))
+                {
+                  if (NILP (Fmember (tem, Vload_path)))
+                    {
+                      /* We are running uninstalled.  The default load-path
+                         points to the eventual installed lisp, leim
+                         directories.  We should not use those now, even
+                         if they exist, so start over from a clean slate.  */
+                      Vload_path = Fcons (tem, Qnil);
+                    }
+                }
+              else
+                /* That dir doesn't exist, so add the build-time
+                   Lisp dirs instead.  */
+                Vload_path = nconc2 (Vload_path, dump_path);
+
+              /* Add leim under the installation dir, if it exists. */
+              tem = Fexpand_file_name (build_string ("leim"),
+                                       Vinstallation_directory);
+              tem1 = Ffile_exists_p (tem);
+              if (!NILP (tem1))
+                {
+                  if (NILP (Fmember (tem, Vload_path)))
+                    Vload_path = Fcons (tem, Vload_path);
+                }
+
+              /* Add site-lisp under the installation dir, if it exists.  */
+              if (!no_site_lisp)
+                {
+                  tem = Fexpand_file_name (build_string ("site-lisp"),
+                                           Vinstallation_directory);
+                  tem1 = Ffile_exists_p (tem);
+                  if (!NILP (tem1))
+                    {
+                      if (NILP (Fmember (tem, Vload_path)))
+                        Vload_path = Fcons (tem, Vload_path);
+                    }
+                }
+
+              /* If Emacs was not built in the source directory,
+                 and it is run from where it was built, add to load-path
+                 the lisp, leim and site-lisp dirs under that directory.  */
+
+              if (NILP (Fequal (Vinstallation_directory, Vsource_directory)))
+                {
+                  Lisp_Object tem2;
+
+                  tem = Fexpand_file_name (build_string ("src/Makefile"),
+                                           Vinstallation_directory);
+                  tem1 = Ffile_exists_p (tem);
+
+                  /* Don't be fooled if they moved the entire source tree
+                     AFTER dumping Emacs.  If the build directory is indeed
+                     different from the source dir, src/Makefile.in and
+                     src/Makefile will not be found together.  */
+                  tem = Fexpand_file_name (build_string ("src/Makefile.in"),
+                                           Vinstallation_directory);
+                  tem2 = Ffile_exists_p (tem);
+                  if (!NILP (tem1) && NILP (tem2))
+                    {
+                      tem = Fexpand_file_name (build_string ("lisp"),
+                                               Vsource_directory);
+
+                      if (NILP (Fmember (tem, Vload_path)))
+                        Vload_path = Fcons (tem, Vload_path);
+
+                      tem = Fexpand_file_name (build_string ("leim"),
+                                               Vsource_directory);
+
+                      if (NILP (Fmember (tem, Vload_path)))
+                        Vload_path = Fcons (tem, Vload_path);
+
+                      if (!no_site_lisp)
+                        {
+                          tem = Fexpand_file_name (build_string ("site-lisp"),
+                                                   Vsource_directory);
+
+                          if (NILP (Fmember (tem, Vload_path)))
+                            Vload_path = Fcons (tem, Vload_path);
+                        }
+                    }
+                } /* Vinstallation_directory != Vsource_directory */
+
+           } /* if Vinstallation_directory */
+
+          /* Check before adding the site-lisp directories.
+             The install should have created them, but they are not
+             required, so no need to warn if they are absent.
+             Or we might be running before installation.  */
+          load_path_check ();
+
+          /* Add the site-lisp directories at the front.  */
+#ifdef HAVE_NS
+          /* loadpath already includes the app-bundle's site-lisp.  */
+          if (!no_site_lisp && !loadpath)
+#else
+          if (!no_site_lisp)
+#endif
+            {
+              Lisp_Object sitelisp;
+              sitelisp = decode_env_path (0, PATH_SITELOADSEARCH);
+              if (! NILP (sitelisp)) Vload_path = nconc2 (sitelisp, Vload_path);
+            }
+       } /* if dump_path == Vload_path */
     }
   else                          /* !initialized */
     {
-      /* NORMAL refers to the lisp dir in the source directory.  */
-      /* We used to add ../lisp at the front here, but
-        that caused trouble because it was copied from dump_path
-        into Vload_path, above, when Vinstallation_directory was non-nil.
-        It should be unnecessary.  */
+      /* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the
+         source directory.  We used to add ../lisp (ie the lisp dir in
+         the build directory) at the front here, but that caused trouble
+        because it was copied from dump_path into Vload_path, above,
+        when Vinstallation_directory was non-nil.  It should not be
+         necessary, since in out of tree builds lisp/ is empty, save
+         for Makefile.  */
       Vload_path = decode_env_path (0, normal);
       dump_path = Vload_path;
+      /* No point calling load_path_check; load-path only contains essential
+         elements from the source directory at this point.  They cannot
+         be missing unless something went extremely (and improbably)
+         wrong, in which case the build will fail in obvious ways.  */
     }
 #endif  /* CANNOT_DUMP */
 
-#if (!(defined (WINDOWSNT) || (defined (HAVE_NS))))
-  /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is
-     almost never correct, thereby causing a warning to be printed out that
-     confuses users.  Since PATH_LOADSEARCH is always overridden by the
-     EMACSLOADPATH environment variable below, disable the warning on NT.  */
-
-  /* HAVE_NS also uses EMACSLOADPATH.  */
-
-  /* Warn if dirs in the *standard* path don't exist.  */
-  if (!turn_off_warning)
-    {
-      Lisp_Object path_tail;
-
-      for (path_tail = Vload_path;
-          !NILP (path_tail);
-          path_tail = XCDR (path_tail))
-       {
-         Lisp_Object dirfile;
-         dirfile = Fcar (path_tail);
-         if (STRINGP (dirfile))
-           {
-             dirfile = Fdirectory_file_name (dirfile);
-              /* Do we really need to warn about missing site-lisp dirs?
-                 It's true that the installation should have created
-                 them and added subdirs.el, but it's harmless if they
-                 are not there.  */
-             if (access (SSDATA (dirfile), 0) < 0)
-               dir_warning ("Warning: Lisp directory `%s' does not exist.\n",
-                            XCAR (path_tail));
-           }
-       }
-    }
-#endif /* !(WINDOWSNT || HAVE_NS) */
-
-  /* If the EMACSLOADPATH environment variable is set, use its value.
-     This doesn't apply if we're dumping.  */
-#ifndef CANNOT_DUMP
-  if (NILP (Vpurify_flag)
-      && egetenv ("EMACSLOADPATH"))
-#endif
-    Vload_path = decode_env_path ("EMACSLOADPATH", normal);
-
   Vvalues = Qnil;
 
   load_in_progress = 0;
@@ -4359,7 +4320,7 @@ dir_warning (const char *format, Lisp_Object dirname)
 {
   fprintf (stderr, format, SDATA (dirname));
 
-  /* Don't log the warning before we've initialized!! */
+  /* Don't log the warning before we've initialized!!  */
   if (initialized)
     {
       char *buffer;
@@ -4400,7 +4361,8 @@ to find all the symbols in an obarray, use `mapatoms'.  */);
 
   DEFVAR_LISP ("values", Vvalues,
               doc: /* List of values of all expressions which were read, evaluated and printed.
-Order is reverse chronological.  */);
+                      Order is reverse chronological.  */);
+  XSYMBOL (intern ("values"))->declared_special = 0;
 
   DEFVAR_LISP ("standard-input", Vstandard_input,
               doc: /* Stream for read to get input from.
@@ -4418,7 +4380,7 @@ defined, although they may be in the future.
 
 The positions are relative to the last call to `read' or
 `read-from-string'.  It is probably a bad idea to set this variable at
-the toplevel; bind it instead. */);
+the toplevel; bind it instead.  */);
   Vread_with_symbol_positions = Qnil;
 
   DEFVAR_LISP ("read-symbol-positions-list", Vread_symbol_positions_list,
@@ -4433,7 +4395,7 @@ symbol from the position where `read' or `read-from-string' started.
 
 Note that a symbol will appear multiple times in this list, if it was
 read multiple times.  The list is in the same order as the symbols
-were read in. */);
+were read in.  */);
   Vread_symbol_positions_list = Qnil;
 
   DEFVAR_LISP ("read-circle", Vread_circle,
@@ -4441,7 +4403,7 @@ were read in. */);
   Vread_circle = Qt;
 
   DEFVAR_LISP ("load-path", Vload_path,
-              doc: /* *List of directories to search for files to load.
+              doc: /* List of directories to search for files to load.
 Each element is a string (directory name) or nil (try default directory).
 Initialized based on EMACSLOADPATH environment variable, if any,
 otherwise to default specified by file `epaths.h' when Emacs was built.  */);
@@ -4451,8 +4413,8 @@ otherwise to default specified by file `epaths.h' when Emacs was built.  */);
 This list should not include the empty string.
 `load' and related functions try to append these suffixes, in order,
 to the specified file name if a Lisp suffix is allowed or required.  */);
-  Vload_suffixes = Fcons (make_pure_c_string (".elc"),
-                         Fcons (make_pure_c_string (".el"), Qnil));
+  Vload_suffixes = Fcons (build_pure_c_string (".elc"),
+                         Fcons (build_pure_c_string (".el"), Qnil));
   DEFVAR_LISP ("load-file-rep-suffixes", Vload_file_rep_suffixes,
               doc: /* List of suffixes that indicate representations of \
 the same file.
@@ -4585,7 +4547,7 @@ from the file, and matches them against this regular expression.
 When the regular expression matches, the file is considered to be safe
 to load.  See also `load-dangerous-libraries'.  */);
   Vbytecomp_version_regexp
-    = make_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");
+    = build_pure_c_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)");
 
   Qlexical_binding = intern ("lexical-binding");
   staticpro (&Qlexical_binding);
diff --git a/src/m/README b/src/m/README
deleted file mode 100644 (file)
index ad91167..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-This directory contains C header files containing machine-specific
-definitions.  Each file describes a particular machine.  The emacs
-configuration script edits ../config.h to include the appropriate one of
-these files, and then each emacs source file includes config.h.
-
-template.h is a generic template for machine descriptions; it
-describes the parameters a machine file can specify.
diff --git a/src/m/alpha.h b/src/m/alpha.h
deleted file mode 100644 (file)
index 2a97a3d..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Machine description file for the alpha chip.
-
-Copyright (C) 1994, 1997, 1999, 2001-2012  Free Software Foundation, Inc.
-
-Author: Rainer Schoepf
-(according to authors.el)
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifndef _LP64
-#define _LP64 /* This doesn't appear to be necessary on OSF 4/5  -- fx.  */
-#endif
-
-/* Now define a symbol for the cpu type, if your compiler
-   does not define it automatically.  */
-/* __alpha defined automatically */
-
-
-#ifdef __ELF__
-
-#if !defined (GNU_LINUX) && !defined (__NetBSD__)
-#define DATA_START    0x140000000
-#endif
-
-#else  /* not __ELF__ */
-
-/* Describe layout of the address space in an executing process.  */
-#define DATA_START    0x140000000
-
-#endif /* __ELF__ */
-
-/* On the Alpha it's best to avoid including TERMIO since struct
-   termio and struct termios are mutually incompatible.  */
-#define NO_TERMIO
-
-/* Many Alpha implementations (e.g. gas 2.8) can't handle DBL_MIN:
-   they generate code that uses a signaling NaN instead of DBL_MIN.
-   Define DBL_MIN_REPLACEMENT to be the next value larger than DBL_MIN:
-   this avoids the assembler bug.  */
-#define DBL_MIN_REPLACEMENT 2.2250738585072019e-308
diff --git a/src/m/amdx86-64.h b/src/m/amdx86-64.h
deleted file mode 100644 (file)
index f0482c7..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* machine description file for AMD x86-64.
-
-Copyright (C) 2002-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#define BITS_PER_LONG           64
-#define BITS_PER_EMACS_INT      64
-
-/* Now define a symbol for the cpu type, if your compiler
-   does not define it automatically:
-   Ones defined so far include vax, m68000, ns16000, pyramid,
-   orion, tahoe, APOLLO and many others */
-/* __x86_64 defined automatically.  */
-
-/* Define the type to use.  */
-#define EMACS_INT               long
-#define pI                     "l"
-#define EMACS_UINT              unsigned long
-
-/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
-#undef DATA_SEG_BITS
diff --git a/src/m/ia64.h b/src/m/ia64.h
deleted file mode 100644 (file)
index 2ddc2fd..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/* machine description file for the IA-64 architecture.
-
-Copyright (C) 2000-2012  Free Software Foundation, Inc.
-
-     Contributed by David Mosberger <davidm@hpl.hp.com>
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#define BITS_PER_LONG          64
-#define BITS_PER_EMACS_INT     64
-
-/* Now define a symbol for the cpu type, if your compiler
-   does not define it automatically.  */
-/* __ia64__ defined automatically */
-
-/* Define the type to use.  */
-#define EMACS_INT              long
-#define pI                     "l"
-#define EMACS_UINT             unsigned long
-
-#ifdef REL_ALLOC
-#ifndef _MALLOC_INTERNAL
-/* "char *" because ralloc.c defines it that way.  gmalloc.c thinks it
-   is allowed to prototype these as "void *" so we don't prototype in
-   that case.  You're right: it stinks!  */
-extern char *r_alloc (), *r_re_alloc ();
-extern void r_alloc_free ();
-#endif /* not _MALLOC_INTERNAL */
-#endif /* REL_ALLOC */
diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h
deleted file mode 100644 (file)
index 9798ad2..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/* R2 AIX machine/system dependent defines
-
-Copyright (C) 1988, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-/* The data segment in this machine always starts at address 0x20000000.
-   An address of data cannot be stored correctly in a Lisp object;
-   we always lose the high bits.  We must tell XPNTR to add them back.  */
-#define DATA_START 0x20000000
-#define DATA_SEG_BITS 0x20000000
-
-#ifndef NLIST_STRUCT
-/* AIX supposedly doesn't use this interface, but on the RS/6000
-   it apparently does.  */
-#define NLIST_STRUCT
-#endif
-
-#undef ADDR_CORRECT
-#define ADDR_CORRECT(x) ((int)(x))
-
-/*** BUILD 9008 - FIONREAD problem still exists in X-Windows. ***/
-#define BROKEN_FIONREAD
-/* As we define BROKEN_FIONREAD, SIGIO will be undefined in systty.h.
-   But, on AIX, SIGAIO, SIGPTY, and SIGPOLL are defined as SIGIO,
-   which causes compilation error at init_signals in sysdep.c.  So, we
-   define these macros so that syssignal.h detects them and undefine
-   SIGAIO, SIGPTY and SIGPOLL.  */
-#define BROKEN_SIGAIO
-#define BROKEN_SIGPTY
-#define BROKEN_SIGPOLL
-
diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h
deleted file mode 100644 (file)
index aa652a8..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Machine description file for IBM S390 in 64-bit mode
-
-Copyright (C) 2002-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#define BITS_PER_LONG 64
-#define BITS_PER_EMACS_INT 64
-
-/* Define the type to use.  */
-#define EMACS_INT long
-#define pI "l"
-#define EMACS_UINT unsigned long
-
-/* On the 64 bit architecture, we can use 60 bits for addresses */
-#define VALBITS         60
-
-/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
-#define XPNTR(a) XUINT (a)
diff --git a/src/m/intel386.h b/src/m/intel386.h
deleted file mode 100644 (file)
index 78a43e9..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Machine description file for intel 386.
-
-Copyright (C) 1987, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-#ifdef WINDOWSNT
-#define DATA_START     get_data_start ()
-#endif
-
-#ifdef GNU_LINUX
-/* libc-linux/sysdeps/linux/i386/ulimit.c says that due to shared library, */
-/* we cannot get the maximum address for brk */
-#define ULIMIT_BREAK_VALUE (32*1024*1024)
-#endif
diff --git a/src/m/m68k.h b/src/m/m68k.h
deleted file mode 100644 (file)
index 120a2ba..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Machine description file for generic Motorola 68k.
-
-Copyright (C) 1985, 1995, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Now define a symbol for the cpu type, if your compiler
-   does not define it automatically.  */
-#ifndef m68k
-#define m68k
-#endif
-
-#ifdef GNU_LINUX
-#ifdef __ELF__
-#define DATA_SEG_BITS 0x80000000
-#endif
-
-#endif
-
diff --git a/src/m/macppc.h b/src/m/macppc.h
deleted file mode 100644 (file)
index 0303ead..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/* machine description file For the powerpc Macintosh.
-
-Copyright (C) 1994, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-#ifdef _ARCH_PPC64
-#ifndef _LP64
-#define _LP64
-#endif
-#endif
diff --git a/src/m/sparc.h b/src/m/sparc.h
deleted file mode 100644 (file)
index 27b6070..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* machine description file for Sun 4 SPARC.
-
-Copyright (C) 1987, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* __sparc__ is defined by the compiler by default.  */
-
-#ifdef __arch64__              /* GCC, 64-bit ABI.  */
-
-#define BITS_PER_LONG 64
-
-#ifndef _LP64
-#define _LP64 /* Done on Alpha -- not sure if it should be here.  -- fx */
-#endif
-
-#endif  /* __arch64__ */
diff --git a/src/m/template.h b/src/m/template.h
deleted file mode 100644 (file)
index 5f1a46c..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* machine description file template.
-
-Copyright (C) 1985-1986, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* Now define a symbol for the cpu type, if your compiler
-   does not define it automatically.
-   Ones defined so far include m68k and many others */
-
-/* After adding support for a new machine, modify the large case
-   statement in configure.in to recognize reasonable
-   configuration names, and add a description of the system to
-   `etc/MACHINES'.
-
-   Check for any tests of $machine in configure.in, and add an entry
-   for the new machine if needed.
-
-   If you've just fixed a problem in an existing configuration file,
-   you should also check `etc/MACHINES' to make sure its descriptions
-   of known problems in that configuration should be updated.  */
diff --git a/src/m/vax.h b/src/m/vax.h
deleted file mode 100644 (file)
index e4bed40..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* machine description file for vax.
-
-Copyright (C) 1985-1986, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-/* #define vax    -- appears to be done automatically  */
-
-#define HAVE_FTIME
index d43e37513f50377027622174e1cbdd27061f1c30..0b1eda0b8ab77d2613fe1cab61879c3ad2b9f721 100644 (file)
@@ -23,6 +23,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "macros.h"
 #include "commands.h"
+#include "character.h"
 #include "buffer.h"
 #include "window.h"
 #include "keyboard.h"
@@ -62,8 +63,7 @@ macro before appending to it. */)
 
   if (!current_kboard->kbd_macro_buffer)
     {
-      current_kboard->kbd_macro_buffer
-       = (Lisp_Object *)xmalloc (30 * sizeof (Lisp_Object));
+      current_kboard->kbd_macro_buffer = xmalloc (30 * sizeof (Lisp_Object));
       current_kboard->kbd_macro_bufsize = 30;
     }
   update_mode_lines++;
@@ -95,13 +95,14 @@ macro before appending to it. */)
         has put another macro there.  */
       if (current_kboard->kbd_macro_bufsize < len + 30)
        {
-         if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) - 30
-             < current_kboard->kbd_macro_bufsize)
+         if (PTRDIFF_MAX < MOST_POSITIVE_FIXNUM + 30
+             && PTRDIFF_MAX < len + 30)
            memory_full (SIZE_MAX);
-         current_kboard->kbd_macro_buffer
-           = (Lisp_Object *)xrealloc (current_kboard->kbd_macro_buffer,
-                                      (len + 30) * sizeof (Lisp_Object));
-         current_kboard->kbd_macro_bufsize = len + 30;
+         current_kboard->kbd_macro_buffer =
+           xpalloc (current_kboard->kbd_macro_buffer,
+                    &current_kboard->kbd_macro_bufsize,
+                    len + 30 - current_kboard->kbd_macro_bufsize, -1,
+                    sizeof *current_kboard->kbd_macro_buffer);
        }
 
       /* Must convert meta modifier when copying string to vector.  */
@@ -203,8 +204,7 @@ store_kbd_macro_char (Lisp_Object c)
              < kb->kbd_macro_bufsize)
            memory_full (SIZE_MAX);
          nbytes = kb->kbd_macro_bufsize * (2 * sizeof *kb->kbd_macro_buffer);
-         kb->kbd_macro_buffer
-           = (Lisp_Object *) xrealloc (kb->kbd_macro_buffer, nbytes);
+         kb->kbd_macro_buffer = xrealloc (kb->kbd_macro_buffer, nbytes);
          kb->kbd_macro_bufsize *= 2;
          kb->kbd_macro_ptr = kb->kbd_macro_buffer + ptr_offset;
          kb->kbd_macro_end = kb->kbd_macro_buffer + end_offset;
@@ -258,7 +258,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
      from before this macro started.  */
   Vthis_command = KVAR (current_kboard, Vlast_command);
   /* C-x z after the macro should repeat the macro.  */
-  real_this_command = KVAR (current_kboard, Vlast_kbd_macro);
+  Vreal_this_command = KVAR (current_kboard, Vlast_kbd_macro);
 
   if (! NILP (KVAR (current_kboard, defining_kbd_macro)))
     error ("Can't execute anonymous macro while defining one");
@@ -285,7 +285,7 @@ pop_kbd_macro (Lisp_Object info)
   Vexecuting_kbd_macro = XCAR (info);
   tem = XCDR (info);
   executing_kbd_macro_index = XINT (XCAR (tem));
-  real_this_command = XCDR (tem);
+  Vreal_this_command = XCDR (tem);
   Frun_hooks (1, &Qkbd_macro_termination_hook);
   return Qnil;
 }
@@ -301,7 +301,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
 {
   Lisp_Object final;
   Lisp_Object tem;
-  int pdlcount = SPECPDL_INDEX ();
+  ptrdiff_t pdlcount = SPECPDL_INDEX ();
   EMACS_INT repeat = 1;
   struct gcpro gcpro1, gcpro2;
   EMACS_INT success_count = 0;
@@ -320,7 +320,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
 
   tem = Fcons (Vexecuting_kbd_macro,
               Fcons (make_number (executing_kbd_macro_index),
-                     real_this_command));
+                     Vreal_this_command));
   record_unwind_protect (pop_kbd_macro, tem);
 
   GCPRO2 (final, loopfunc);
@@ -351,7 +351,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC returns nil.  */)
 
   executing_kbd_macro = Qnil;
 
-  real_this_command = Vexecuting_kbd_macro;
+  Vreal_this_command = Vexecuting_kbd_macro;
 
   UNGCPRO;
   return unbind_to (pdlcount, Qnil);
index d7ca325e223c8a800566aac673eeff076530f247..0106616f3c9d8a2b23b04283ab0abd8991033824 100644 (file)
@@ -27,11 +27,7 @@ EMACSLOADPATH=$(CURDIR)/../lisp
 # Size in MBs of the static heap in temacs.exe.
 HEAPSIZE = 27
 
-#
-# HAVE_CONFIG_H is required by some generic gnu sources stuck into
-# the emacs source tree.
-#
-LOCAL_FLAGS     = -Demacs=1 -DHAVE_CONFIG_H -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
+LOCAL_FLAGS     = -Demacs=1 -I../lib -I../nt/inc -DHAVE_NTGUI=1 $(EMACS_EXTRA_C_FLAGS)
 
 SRC             = .
 EMACS           = $(BLD)/emacs.exe
@@ -128,6 +124,7 @@ OBJ2 =  $(BLD)/sysdep.$(O)          \
        $(BLD)/image.$(O)               \
        $(BLD)/terminal.$(O)            \
        $(BLD)/menu.$(O)                \
+       $(BLD)/xml.$(O)                 \
        $(BLD)/w32term.$(O)             \
        $(BLD)/w32xfns.$(O)             \
        $(BLD)/w32fns.$(O)              \
@@ -225,7 +222,7 @@ GLOBAL_SOURCES =   dosfns.c msdos.c \
        process.c callproc.c unexw32.c \
        region-cache.c sound.c atimer.c \
        doprnt.c intervals.c textprop.c composite.c \
-       gnutls.c
+       gnutls.c xml.c
 SOME_MACHINE_OBJECTS = dosfns.o msdos.o \
        xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o dbusbind.o
 obj = $(GLOBAL_SOURCES:.c=.o)
@@ -342,7 +339,7 @@ cleanall:   clean
 ##
 ## This works only with GNU Make.
 
-TAGS: $(OBJ0) $(OBJ1) $(OBJ2) $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
+TAGS: $(OBJ0) $(OBJ1) $(OBJ2) $(CURDIR)/s/ms-w32.h
        $(MAKE) $(MFLAGS) TAGS-$(MAKETYPE)
 
 TAGS-LISP: $(OBJ0) $(OBJ1) $(OBJ2)
@@ -356,7 +353,7 @@ TAGS-gmake:
          $(OBJ1_c)
        ../lib-src/$(BLD)/etags.exe -a --regex=@../nt/emacs-src.tags \
          $(OBJ2_c) \
-         $(CURDIR)/*.h $(CURDIR)/m/intel386.h $(CURDIR)/s/ms-w32.h
+         $(CURDIR)/*.h $(CURDIR)/s/ms-w32.h
 
 TAGS-nmake:
        echo This target is not supported with NMake
@@ -390,11 +387,14 @@ GNU_LIB = $(EMACS_ROOT)/lib
 NT_INC = $(EMACS_ROOT)/nt/inc
 
 SYSTIME_H      = $(SRC)/systime.h \
-                $(NT_INC)/sys/time.h
+                $(NT_INC)/sys/time.h \
+                $(GNU_LIB)/timespec.h
 ATIMER_H       = $(SRC)/atimer.h \
                 $(SYSTIME_H)
 BLOCKINPUT_H   = $(SRC)/blockinput.h \
                 $(ATIMER_H)
+BUFFER_H       = $(SRC)/buffer.h \
+                $(SYSTIME_H)
 CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \
                 $(NT_INC)/unistd.h
 CHARACTER_H    = $(SRC)/character.h \
@@ -406,13 +406,14 @@ CODING_H       = $(SRC)/coding.h \
 MS_W32_H       = $(SRC)/s/ms-w32.h \
                 $(NT_INC)/sys/stat.h
 CONFIG_H       = $(SRC)/config.h \
-                $(SRC)/m/intel386.h \
                 $(MS_W32_H)
 DIR_H          = $(NT_INC)/sys/dir.h \
                 $(SRC)/ndir.h
 W32GUI_H       = $(SRC)/w32gui.h \
                 $(SYSTIME_H)
 DISPEXTERN_H   = $(SRC)/dispextern.h \
+                $(GNU_LIB)/c-strcase.h \
+                $(SYSTIME_H) \
                 $(W32GUI_H)
 FILEMODE_H     = $(GNU_LIB)/filemode.h \
                 $(NT_INC)/sys/stat.h
@@ -455,6 +456,8 @@ SHA512_H       = $(GNU_LIB)/sha512.h \
                 $(U64_H)
 SOCKET_H       = $(NT_INC)/sys/socket.h \
                 $(SRC)/w32.h
+STAT_TIME_H    = $(GNU_LIB)/stat-time.h \
+                $(NT_INC)/sys/stat.h
 SYSTTY_H       = $(SRC)/systty.h \
                 $(NT_INC)/sys/ioctl.h \
                 $(NT_INC)/unistd.h
@@ -467,13 +470,13 @@ WINDOW_H       = $(SRC)/window.h \
 
 $(BLD)/alloc.$(O) : \
        $(SRC)/alloc.c \
-       $(SRC)/buffer.h \
        $(SRC)/puresize.h \
        $(SRC)/syssignal.h \
        $(SRC)/w32.h \
        $(NT_INC)/unistd.h \
        $(GNU_LIB)/verify.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(FRAME_H) \
@@ -487,7 +490,6 @@ $(BLD)/alloc.$(O) : \
 $(BLD)/atimer.$(O) : \
        $(SRC)/atimer.c \
        $(SRC)/syssignal.h \
-       $(NT_INC)/sys/time.h \
        $(NT_INC)/unistd.h \
        $(ATIMER_H) \
        $(BLOCKINPUT_H) \
@@ -497,7 +499,7 @@ $(BLD)/atimer.$(O) : \
 
 $(BLD)/bidi.$(O) : \
        $(SRC)/bidi.c \
-       $(SRC)/buffer.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
@@ -505,7 +507,6 @@ $(BLD)/bidi.$(O) : \
 
 $(BLD)/buffer.$(O) : \
        $(SRC)/buffer.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/indent.h \
        $(SRC)/keymap.h \
@@ -515,6 +516,7 @@ $(BLD)/buffer.$(O) : \
        $(NT_INC)/unistd.h \
        $(GNU_LIB)/verify.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(FRAME_H) \
@@ -525,8 +527,8 @@ $(BLD)/buffer.$(O) : \
 
 $(BLD)/bytecode.$(O) : \
        $(SRC)/bytecode.c \
-       $(SRC)/buffer.h \
        $(SRC)/syntax.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(LISP_H) \
@@ -534,9 +536,9 @@ $(BLD)/bytecode.$(O) : \
 
 $(BLD)/callint.$(O) : \
        $(SRC)/callint.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/keymap.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(KEYBOARD_H) \
@@ -545,7 +547,6 @@ $(BLD)/callint.$(O) : \
 
 $(BLD)/callproc.$(O) : \
        $(SRC)/callproc.c \
-       $(SRC)/buffer.h \
        $(SRC)/ccl.h \
        $(SRC)/commands.h \
        $(SRC)/composite.h \
@@ -555,6 +556,7 @@ $(BLD)/callproc.$(O) : \
        $(NT_INC)/sys/file.h \
        $(NT_INC)/unistd.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -566,27 +568,27 @@ $(BLD)/callproc.$(O) : \
 
 $(BLD)/casefiddle.$(O) : \
        $(SRC)/casefiddle.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/composite.h \
        $(SRC)/keymap.h \
        $(SRC)/syntax.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(LISP_H)
 
 $(BLD)/casetab.$(O) : \
        $(SRC)/casetab.c \
-       $(SRC)/buffer.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(LISP_H)
 
 $(BLD)/category.$(O) : \
        $(SRC)/category.c \
-       $(SRC)/buffer.h \
        $(SRC)/category.h \
        $(SRC)/keymap.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -603,10 +605,10 @@ $(BLD)/ccl.$(O) : \
 
 $(BLD)/character.$(O) : \
        $(SRC)/character.c \
-       $(SRC)/buffer.h \
        $(SRC)/composite.h \
        $(SRC)/disptab.h \
        $(GNU_LIB)/intprops.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -614,9 +616,9 @@ $(BLD)/character.$(O) : \
 
 $(BLD)/charset.$(O) : \
        $(SRC)/charset.c \
-       $(SRC)/buffer.h \
        $(SRC)/disptab.h \
        $(NT_INC)/unistd.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
@@ -633,10 +635,10 @@ $(BLD)/chartab.$(O) : \
 
 $(BLD)/cmds.$(O) : \
        $(SRC)/cmds.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/keymap.h \
        $(SRC)/syntax.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
@@ -647,9 +649,9 @@ $(BLD)/cmds.$(O) : \
 
 $(BLD)/coding.$(O) : \
        $(SRC)/coding.c \
-       $(SRC)/buffer.h \
        $(SRC)/ccl.h \
        $(SRC)/composite.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
@@ -661,7 +663,7 @@ $(BLD)/coding.$(O) : \
 
 $(BLD)/composite.$(O) : \
        $(SRC)/composite.c \
-       $(SRC)/buffer.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -675,10 +677,11 @@ $(BLD)/composite.$(O) : \
 
 $(BLD)/data.$(O) : \
        $(SRC)/data.c \
-       $(SRC)/buffer.h \
+       $(SRC)/keymap.h \
        $(SRC)/puresize.h \
        $(SRC)/syssignal.h \
        $(GNU_LIB)/intprops.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(FONT_H) \
@@ -689,13 +692,13 @@ $(BLD)/data.$(O) : \
 
 $(BLD)/dired.$(O) : \
        $(SRC)/dired.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/regex.h \
        $(NT_INC)/pwd.h \
        $(NT_INC)/sys/stat.h \
        $(NT_INC)/unistd.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
@@ -704,11 +707,11 @@ $(BLD)/dired.$(O) : \
        $(FILEMODE_H) \
        $(GRP_H) \
        $(LISP_H) \
+       $(STAT_TIME_H) \
        $(SYSTIME_H)
 
 $(BLD)/dispnew.$(O) : \
        $(SRC)/dispnew.c \
-       $(SRC)/buffer.h \
        $(SRC)/cm.h \
        $(SRC)/commands.h \
        $(SRC)/disptab.h \
@@ -718,6 +721,7 @@ $(BLD)/dispnew.$(O) : \
        $(SRC)/termopts.h \
        $(NT_INC)/unistd.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
@@ -733,11 +737,11 @@ $(BLD)/dispnew.$(O) : \
 
 $(BLD)/doc.$(O) : \
        $(SRC)/doc.c \
-       $(SRC)/buffer.h \
        $(SRC)/buildobj.h \
        $(SRC)/keymap.h \
        $(NT_INC)/sys/file.h \
        $(NT_INC)/unistd.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(KEYBOARD_H) \
@@ -752,13 +756,13 @@ $(BLD)/doprnt.$(O) : \
 
 $(BLD)/editfns.$(O) : \
        $(SRC)/editfns.c \
-       $(SRC)/buffer.h \
        $(NT_INC)/pwd.h \
        $(NT_INC)/unistd.h \
        $(GNU_LIB)/intprops.h \
        $(GNU_LIB)/strftime.h \
        $(GNU_LIB)/verify.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -770,7 +774,6 @@ $(BLD)/editfns.$(O) : \
 
 $(BLD)/emacs.$(O) : \
        $(SRC)/emacs.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/gnutls.h \
        $(SRC)/keymap.h \
@@ -781,6 +784,8 @@ $(BLD)/emacs.$(O) : \
        $(NT_INC)/sys/file.h \
        $(NT_INC)/unistd.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(FRAME_H) \
        $(INTERVALS_H) \
@@ -803,12 +808,12 @@ $(BLD)/eval.$(O) : \
 
 $(BLD)/fileio.$(O) : \
        $(SRC)/fileio.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(NT_INC)/pwd.h \
        $(NT_INC)/sys/stat.h \
        $(NT_INC)/unistd.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -816,16 +821,17 @@ $(BLD)/fileio.$(O) : \
        $(FRAME_H) \
        $(INTERVALS_H) \
        $(LISP_H) \
+       $(STAT_TIME_H) \
        $(SYSTIME_H) \
        $(WINDOW_H)
 
 $(BLD)/filelock.$(O) : \
        $(SRC)/filelock.c \
-       $(SRC)/buffer.h \
        $(NT_INC)/pwd.h \
        $(NT_INC)/sys/file.h \
        $(NT_INC)/sys/stat.h \
        $(NT_INC)/unistd.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -844,12 +850,12 @@ $(BLD)/floatfns.$(O) : \
 
 $(BLD)/fns.$(O) : \
        $(SRC)/fns.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/keymap.h \
        $(NT_INC)/unistd.h \
        $(GNU_LIB)/intprops.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -866,9 +872,9 @@ $(BLD)/fns.$(O) : \
 
 $(BLD)/font.$(O) : \
        $(SRC)/font.c \
-       $(SRC)/buffer.h \
        $(SRC)/composite.h \
        $(SRC)/fontset.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -881,10 +887,10 @@ $(BLD)/font.$(O) : \
 
 $(BLD)/fontset.$(O) : \
        $(SRC)/fontset.c \
-       $(SRC)/buffer.h \
        $(SRC)/ccl.h \
        $(SRC)/fontset.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -900,11 +906,11 @@ $(BLD)/fontset.$(O) : \
 
 $(BLD)/frame.$(O) : \
        $(SRC)/frame.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/fontset.h \
        $(SRC)/termchar.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
@@ -918,8 +924,9 @@ $(BLD)/frame.$(O) : \
 
 $(BLD)/fringe.$(O) : \
        $(SRC)/fringe.c \
-       $(SRC)/buffer.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
        $(FRAME_H) \
@@ -929,7 +936,7 @@ $(BLD)/fringe.$(O) : \
 
 $(BLD)/gmalloc.$(O) : \
        $(SRC)/gmalloc.c \
-       $(SRC)/getpagesize.h \
+       $(NT_INC)/stdint.h \
        $(NT_INC)/unistd.h \
        $(CONFIG_H)
 
@@ -940,6 +947,14 @@ $(BLD)/gnutls.$(O) : \
        $(LISP_H) \
        $(PROCESS_H)
 
+$(BLD)/xml.$(O) : \
+       $(SRC)/xml.c \
+       $(SRC)/w32.h \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
+       $(CONFIG_H) \
+       $(LISP_H)
+
 $(BLD)/image.$(O) : \
        $(SRC)/image.c \
        $(SRC)/epaths.h \
@@ -960,7 +975,6 @@ $(BLD)/image.$(O) : \
 
 $(BLD)/indent.$(O) : \
        $(SRC)/indent.c \
-       $(SRC)/buffer.h \
        $(SRC)/category.h \
        $(SRC)/composite.h \
        $(SRC)/disptab.h \
@@ -968,6 +982,7 @@ $(BLD)/indent.$(O) : \
        $(SRC)/region-cache.h \
        $(SRC)/termchar.h \
        $(SRC)/termopts.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
@@ -979,10 +994,10 @@ $(BLD)/indent.$(O) : \
 
 $(BLD)/insdel.$(O) : \
        $(SRC)/insdel.c \
-       $(SRC)/buffer.h \
        $(SRC)/region-cache.h \
        $(GNU_LIB)/intprops.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(INTERVALS_H) \
@@ -991,10 +1006,11 @@ $(BLD)/insdel.$(O) : \
 
 $(BLD)/intervals.$(O) : \
        $(SRC)/intervals.c \
-       $(SRC)/buffer.h \
        $(SRC)/keymap.h \
        $(SRC)/puresize.h \
        $(GNU_LIB)/intprops.h \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(INTERVALS_H) \
        $(KEYBOARD_H) \
@@ -1002,7 +1018,6 @@ $(BLD)/intervals.$(O) : \
 
 $(BLD)/keyboard.$(O) : \
        $(SRC)/keyboard.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/disptab.h \
        $(SRC)/keymap.h \
@@ -1016,6 +1031,7 @@ $(BLD)/keyboard.$(O) : \
        $(NT_INC)/unistd.h \
        $(ATIMER_H) \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
@@ -1031,11 +1047,11 @@ $(BLD)/keyboard.$(O) : \
 
 $(BLD)/keymap.$(O) : \
        $(SRC)/keymap.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/keymap.h \
        $(SRC)/puresize.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -1052,13 +1068,13 @@ $(BLD)/lastfile.$(O) : \
 
 $(BLD)/lread.$(O) : \
        $(SRC)/lread.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/epaths.h \
        $(NT_INC)/sys/file.h \
        $(NT_INC)/sys/stat.h \
        $(NT_INC)/unistd.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
@@ -1067,13 +1083,15 @@ $(BLD)/lread.$(O) : \
        $(INTERVALS_H) \
        $(KEYBOARD_H) \
        $(LISP_H) \
+       $(STAT_TIME_H) \
        $(TERMHOOKS_H)
 
 $(BLD)/macros.$(O) : \
        $(SRC)/macros.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/macros.h \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(KEYBOARD_H) \
        $(LISP_H) \
@@ -1081,7 +1099,7 @@ $(BLD)/macros.$(O) : \
 
 $(BLD)/marker.$(O) : \
        $(SRC)/marker.c \
-       $(SRC)/buffer.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(LISP_H)
@@ -1102,10 +1120,11 @@ $(BLD)/menu.$(O) : \
 
 $(BLD)/minibuf.$(O) : \
        $(SRC)/minibuf.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/keymap.h \
        $(SRC)/syntax.h \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
        $(FRAME_H) \
@@ -1142,6 +1161,7 @@ $(BLD)/w32heap.$(O) : \
 
 $(BLD)/w32inevt.$(O) : \
        $(SRC)/w32inevt.c \
+       $(SRC)/termchar.h \
        $(SRC)/w32heap.h \
        $(BLOCKINPUT_H) \
        $(CONFIG_H) \
@@ -1150,7 +1170,8 @@ $(BLD)/w32inevt.$(O) : \
        $(KEYBOARD_H) \
        $(LISP_H) \
        $(TERMHOOKS_H) \
-       $(W32TERM_H)
+       $(W32TERM_H) \
+       $(WINDOW_H)
 
 $(BLD)/w32proc.$(O) : \
        $(SRC)/w32proc.c \
@@ -1180,13 +1201,14 @@ $(BLD)/w32console.$(O) : \
        $(DISPEXTERN_H) \
        $(FRAME_H) \
        $(LISP_H) \
-       $(TERMHOOKS_H)
+       $(TERMHOOKS_H) \
+       $(WINDOW_H)
 
 $(BLD)/print.$(O) : \
        $(SRC)/print.c \
-       $(SRC)/buffer.h \
        $(SRC)/termchar.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -1203,7 +1225,6 @@ $(BLD)/print.$(O) : \
 
 $(BLD)/process.$(O) : \
        $(SRC)/process.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/composite.h \
        $(SRC)/gnutls.h \
@@ -1220,6 +1241,7 @@ $(BLD)/process.$(O) : \
        $(NT_INC)/unistd.h \
        $(ATIMER_H) \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -1244,19 +1266,19 @@ $(BLD)/ralloc.$(O) : \
 
 $(BLD)/regex.$(O) : \
        $(SRC)/regex.c \
-       $(SRC)/buffer.h \
        $(SRC)/category.h \
        $(SRC)/regex.h \
        $(SRC)/syntax.h \
-       $(NT_INC)/unistd.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(LISP_H)
 
 $(BLD)/region-cache.$(O) : \
        $(SRC)/region-cache.c \
-       $(SRC)/buffer.h \
        $(SRC)/region-cache.h \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(LISP_H)
 
@@ -1273,13 +1295,13 @@ $(BLD)/scroll.$(O) : \
 
 $(BLD)/search.$(O) : \
        $(SRC)/search.c \
-       $(SRC)/buffer.h \
        $(SRC)/category.h \
        $(SRC)/commands.h \
        $(SRC)/regex.h \
        $(SRC)/region-cache.h \
        $(SRC)/syntax.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -1297,12 +1319,12 @@ $(BLD)/sound.$(O) : \
 
 $(BLD)/syntax.$(O) : \
        $(SRC)/syntax.c \
-       $(SRC)/buffer.h \
        $(SRC)/category.h \
        $(SRC)/commands.h \
        $(SRC)/keymap.h \
        $(SRC)/regex.h \
        $(SRC)/syntax.h \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CONFIG_H) \
        $(INTERVALS_H) \
@@ -1323,6 +1345,7 @@ $(BLD)/sysdep.$(O) : \
        $(NT_INC)/unistd.h \
        $(GNU_LIB)/allocator.h \
        $(GNU_LIB)/ignore-value.h \
+       $(GNU_LIB)/utimens.h \
        $(BLOCKINPUT_H) \
        $(CAREADLINKAT_H) \
        $(CONFIG_H) \
@@ -1340,7 +1363,6 @@ $(BLD)/sysdep.$(O) : \
 
 $(BLD)/term.$(O) : \
        $(SRC)/term.c \
-       $(SRC)/buffer.h \
        $(SRC)/cm.h \
        $(SRC)/composite.h \
        $(SRC)/disptab.h \
@@ -1350,8 +1372,10 @@ $(BLD)/term.$(O) : \
        $(SRC)/termopts.h \
        $(SRC)/tparam.h \
        $(NT_INC)/sys/file.h \
+       $(NT_INC)/sys/time.h \
        $(NT_INC)/unistd.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
@@ -1378,7 +1402,8 @@ $(BLD)/terminal.$(O) : \
 
 $(BLD)/textprop.$(O) : \
        $(SRC)/textprop.c \
-       $(SRC)/buffer.h \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(INTERVALS_H) \
        $(LISP_H) \
@@ -1392,8 +1417,9 @@ $(BLD)/tparam.$(O) : \
 
 $(BLD)/undo.$(O) : \
        $(SRC)/undo.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(LISP_H) \
        $(WINDOW_H)
@@ -1412,13 +1438,14 @@ $(BLD)/vm-limit.$(O) : \
 
 $(BLD)/window.$(O) : \
        $(SRC)/window.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/disptab.h \
        $(SRC)/indent.h \
        $(SRC)/keymap.h \
        $(SRC)/termchar.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CONFIG_H) \
        $(DISPEXTERN_H) \
        $(FRAME_H) \
@@ -1431,7 +1458,6 @@ $(BLD)/window.$(O) : \
 
 $(BLD)/xdisp.$(O) : \
        $(SRC)/xdisp.c \
-       $(SRC)/buffer.h \
        $(SRC)/commands.h \
        $(SRC)/disptab.h \
        $(SRC)/fontset.h \
@@ -1442,6 +1468,7 @@ $(BLD)/xdisp.$(O) : \
        $(SRC)/termchar.h \
        $(SRC)/termopts.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
@@ -1459,11 +1486,11 @@ $(BLD)/xdisp.$(O) : \
 
 $(BLD)/xfaces.$(O) : \
        $(SRC)/xfaces.c \
-       $(SRC)/buffer.h \
        $(SRC)/fontset.h \
        $(SRC)/termchar.h \
        $(NT_INC)/sys/stat.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CONFIG_H) \
@@ -1479,7 +1506,6 @@ $(BLD)/xfaces.$(O) : \
 
 $(BLD)/w32fns.$(O) : \
        $(SRC)/w32fns.c \
-       $(SRC)/buffer.h \
        $(SRC)/ccl.h \
        $(SRC)/epaths.h \
        $(SRC)/fontset.h \
@@ -1487,6 +1513,7 @@ $(BLD)/w32fns.$(O) : \
        $(SRC)/w32font.h \
        $(SRC)/w32heap.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
@@ -1504,9 +1531,11 @@ $(BLD)/w32fns.$(O) : \
 
 $(BLD)/w32menu.$(O) : \
        $(SRC)/w32menu.c \
-       $(SRC)/buffer.h \
        $(SRC)/keymap.h \
+       $(SRC)/w32heap.h \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
+       $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
        $(CONFIG_H) \
@@ -1521,7 +1550,6 @@ $(BLD)/w32menu.$(O) : \
 
 $(BLD)/w32term.$(O) : \
        $(SRC)/w32term.c \
-       $(SRC)/buffer.h \
        $(SRC)/ccl.h \
        $(SRC)/disptab.h \
        $(SRC)/fontset.h \
@@ -1533,6 +1561,7 @@ $(BLD)/w32term.$(O) : \
        $(NT_INC)/sys/stat.h \
        $(ATIMER_H) \
        $(BLOCKINPUT_H) \
+       $(BUFFER_H) \
        $(CHARACTER_H) \
        $(CHARSET_H) \
        $(CODING_H) \
index 75d4fe954fd4ab264ad68b515934340712db015a..72f48a2d7b9d9932b5de2a72797f099e869b6b46 100644 (file)
@@ -20,19 +20,54 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 
 /* Record one cached position found recently by
    buf_charpos_to_bytepos or buf_bytepos_to_charpos.  */
 
-static EMACS_INT cached_charpos;
-static EMACS_INT cached_bytepos;
+static ptrdiff_t cached_charpos;
+static ptrdiff_t cached_bytepos;
 static struct buffer *cached_buffer;
 static int cached_modiff;
 
-static void byte_char_debug_check (struct buffer *, EMACS_INT, EMACS_INT);
+/* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased
+   bootstrap time when byte_char_debug_check is enabled; so this
+   is never turned on by --enable-checking configure option.  */
+
+#ifdef MARKER_DEBUG
+
+extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE;
+extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE;
+
+static void
+byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos)
+{
+  ptrdiff_t nchars;
+
+  if (NILP (BVAR (b, enable_multibyte_characters)))
+    return;
+
+  if (bytepos > BUF_GPT_BYTE (b))
+    nchars
+      = multibyte_chars_in_text (BUF_BEG_ADDR (b),
+                                BUF_GPT_BYTE (b) - BUF_BEG_BYTE (b))
+      + multibyte_chars_in_text (BUF_GAP_END_ADDR (b),
+                                bytepos - BUF_GPT_BYTE (b));
+  else
+    nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b),
+                                     bytepos - BUF_BEG_BYTE (b));
+
+  if (charpos - 1 != nchars)
+    abort ();
+}
+
+#else /* not MARKER_DEBUG */
+
+#define byte_char_debug_check(b,charpos,bytepos) do { } while (0)
 
+#endif /* MARKER_DEBUG */
 void
 clear_charpos_cache (struct buffer *b)
 {
@@ -55,14 +90,14 @@ clear_charpos_cache (struct buffer *b)
 
 #define CONSIDER(CHARPOS, BYTEPOS)                                     \
 {                                                                      \
-  EMACS_INT this_charpos = (CHARPOS);                                  \
+  ptrdiff_t this_charpos = (CHARPOS);                                  \
   int changed = 0;                                                     \
                                                                        \
   if (this_charpos == charpos)                                         \
     {                                                                  \
-      EMACS_INT value = (BYTEPOS);                                     \
-      if (byte_debug_flag)                                             \
-       byte_char_debug_check (b, charpos, value);                      \
+      ptrdiff_t value = (BYTEPOS);                                     \
+                                                                       \
+      byte_char_debug_check (b, charpos, value);                       \
       return value;                                                    \
     }                                                                  \
   else if (this_charpos > charpos)                                     \
@@ -85,46 +120,26 @@ clear_charpos_cache (struct buffer *b)
     {                                                                  \
       if (best_above - best_below == best_above_byte - best_below_byte)        \
         {                                                              \
-         EMACS_INT value = best_below_byte + (charpos - best_below);   \
-         if (byte_debug_flag)                                          \
-           byte_char_debug_check (b, charpos, value);                  \
+         ptrdiff_t value = best_below_byte + (charpos - best_below);   \
+                                                                       \
+         byte_char_debug_check (b, charpos, value);                    \
          return value;                                                 \
        }                                                               \
     }                                                                  \
 }
 
-static void
-byte_char_debug_check (struct buffer *b, EMACS_INT charpos, EMACS_INT bytepos)
-{
-  EMACS_INT nchars = 0;
-
-  if (bytepos > BUF_GPT_BYTE (b))
-    {
-      nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b),
-                                       BUF_GPT_BYTE (b) - BUF_BEG_BYTE (b));
-      nchars += multibyte_chars_in_text (BUF_GAP_END_ADDR (b),
-                                        bytepos - BUF_GPT_BYTE (b));
-    }
-  else
-    nchars = multibyte_chars_in_text (BUF_BEG_ADDR (b),
-                                     bytepos - BUF_BEG_BYTE (b));
-
-  if (charpos - 1 != nchars)
-    abort ();
-}
-
-EMACS_INT
-charpos_to_bytepos (EMACS_INT charpos)
+ptrdiff_t
+charpos_to_bytepos (ptrdiff_t charpos)
 {
   return buf_charpos_to_bytepos (current_buffer, charpos);
 }
 
-EMACS_INT
-buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos)
+ptrdiff_t
+buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
 {
   struct Lisp_Marker *tail;
-  EMACS_INT best_above, best_above_byte;
-  EMACS_INT best_below, best_below_byte;
+  ptrdiff_t best_above, best_above_byte;
+  ptrdiff_t best_below, best_below_byte;
 
   if (charpos < BUF_BEG (b) || charpos > BUF_Z (b))
     abort ();
@@ -187,15 +202,9 @@ buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos)
         cache the correspondence by creating a marker here.
         It will last until the next GC.  */
       if (record)
-       {
-         Lisp_Object marker, buffer;
-         marker = Fmake_marker ();
-         XSETBUFFER (buffer, b);
-         set_marker_both (marker, buffer, best_below, best_below_byte);
-       }
+       build_marker (b, best_below, best_below_byte);
 
-      if (byte_debug_flag)
-       byte_char_debug_check (b, charpos, best_below_byte);
+      byte_char_debug_check (b, best_below, best_below_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);
@@ -218,15 +227,9 @@ buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos)
         cache the correspondence by creating a marker here.
         It will last until the next GC.  */
       if (record)
-       {
-         Lisp_Object marker, buffer;
-         marker = Fmake_marker ();
-         XSETBUFFER (buffer, b);
-         set_marker_both (marker, buffer, best_above, best_above_byte);
-       }
+       build_marker (b, best_above, best_above_byte);
 
-      if (byte_debug_flag)
-       byte_char_debug_check (b, charpos, best_above_byte);
+      byte_char_debug_check (b, best_above, best_above_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);
@@ -239,25 +242,6 @@ buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos)
 
 #undef CONSIDER
 
-/* Used for debugging: recompute the bytepos corresponding to CHARPOS
-   in the simplest, most reliable way.  */
-
-extern EMACS_INT verify_bytepos (EMACS_INT charpos) EXTERNALLY_VISIBLE;
-EMACS_INT
-verify_bytepos (EMACS_INT charpos)
-{
-  EMACS_INT below = 1;
-  EMACS_INT below_byte = 1;
-
-  while (below != charpos)
-    {
-      below++;
-      BUF_INC_POS (current_buffer, below_byte);
-    }
-
-  return below_byte;
-}
-\f
 /* buf_bytepos_to_charpos returns the char position corresponding to
    BYTEPOS.  */
 
@@ -266,14 +250,14 @@ verify_bytepos (EMACS_INT charpos)
 
 #define CONSIDER(BYTEPOS, CHARPOS)                                     \
 {                                                                      \
-  EMACS_INT this_bytepos = (BYTEPOS);                                  \
+  ptrdiff_t this_bytepos = (BYTEPOS);                                  \
   int changed = 0;                                                     \
                                                                        \
   if (this_bytepos == bytepos)                                         \
     {                                                                  \
-      EMACS_INT value = (CHARPOS);                                     \
-      if (byte_debug_flag)                                             \
-       byte_char_debug_check (b, value, bytepos);                      \
+      ptrdiff_t value = (CHARPOS);                                     \
+                                                                       \
+      byte_char_debug_check (b, value, bytepos);                       \
       return value;                                                    \
     }                                                                  \
   else if (this_bytepos > bytepos)                                     \
@@ -296,20 +280,20 @@ verify_bytepos (EMACS_INT charpos)
     {                                                                  \
       if (best_above - best_below == best_above_byte - best_below_byte)        \
        {                                                               \
-         EMACS_INT value = best_below + (bytepos - best_below_byte);   \
-         if (byte_debug_flag)                                          \
-           byte_char_debug_check (b, value, bytepos);                  \
+         ptrdiff_t value = best_below + (bytepos - best_below_byte);   \
+                                                                       \
+         byte_char_debug_check (b, value, bytepos);                    \
          return value;                                                 \
        }                                                               \
     }                                                                  \
 }
 
-EMACS_INT
-buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos)
+ptrdiff_t
+buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
 {
   struct Lisp_Marker *tail;
-  EMACS_INT best_above, best_above_byte;
-  EMACS_INT best_below, best_below_byte;
+  ptrdiff_t best_above, best_above_byte;
+  ptrdiff_t best_below, best_below_byte;
 
   if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b))
     abort ();
@@ -365,15 +349,9 @@ buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos)
         But don't do it if BUF_MARKERS is nil;
         that is a signal from Fset_buffer_multibyte.  */
       if (record && BUF_MARKERS (b))
-       {
-         Lisp_Object marker, buffer;
-         marker = Fmake_marker ();
-         XSETBUFFER (buffer, b);
-         set_marker_both (marker, buffer, best_below, best_below_byte);
-       }
+       build_marker (b, best_below, best_below_byte);
 
-      if (byte_debug_flag)
-       byte_char_debug_check (b, best_below, bytepos);
+      byte_char_debug_check (b, best_below, best_below_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);
@@ -398,15 +376,9 @@ buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos)
         But don't do it if BUF_MARKERS is nil;
         that is a signal from Fset_buffer_multibyte.  */
       if (record && BUF_MARKERS (b))
-       {
-         Lisp_Object marker, buffer;
-         marker = Fmake_marker ();
-         XSETBUFFER (buffer, b);
-         set_marker_both (marker, buffer, best_above, best_above_byte);
-       }
+       build_marker (b, best_above, best_above_byte);
 
-      if (byte_debug_flag)
-       byte_char_debug_check (b, best_above, bytepos);
+      byte_char_debug_check (b, best_above, best_above_byte);
 
       cached_buffer = b;
       cached_modiff = BUF_MODIFF (b);
@@ -452,7 +424,28 @@ Returns nil if MARKER points nowhere.  */)
 
   return Qnil;
 }
-\f
+
+/* Change M so it points to B at CHARPOS and BYTEPOS.  */
+
+static inline void
+attach_marker (struct Lisp_Marker *m, struct buffer *b,
+              ptrdiff_t charpos, ptrdiff_t bytepos)
+{
+  /* Every character is at least one byte.  */
+  eassert (charpos <= bytepos);
+
+  m->charpos = charpos;
+  m->bytepos = bytepos;
+
+  if (m->buffer != b)
+    {
+      unchain_marker (m);
+      m->buffer = b;
+      m->next = BUF_MARKERS (b);
+      BUF_MARKERS (b) = m;
+    }
+}
+
 DEFUN ("set-marker", Fset_marker, Sset_marker, 2, 3, 0,
        doc: /* Position MARKER before character number POSITION in BUFFER.
 BUFFER defaults to the current buffer.
@@ -461,7 +454,8 @@ Then it no longer slows down editing in any buffer.
 Returns MARKER.  */)
   (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer)
 {
-  register EMACS_INT charno, bytepos;
+  register ptrdiff_t charpos;
+  register ptrdiff_t bytepos;
   register struct buffer *b;
   register struct Lisp_Marker *m;
 
@@ -502,31 +496,10 @@ Returns MARKER.  */)
     }
 
   CHECK_NUMBER_COERCE_MARKER (position);
+  charpos = clip_to_bounds (BUF_BEG (b), XINT (position), BUF_Z (b));
+  bytepos = buf_charpos_to_bytepos (b, charpos);
 
-  charno = XINT (position);
-
-  if (charno < BUF_BEG (b))
-    charno = BUF_BEG (b);
-  if (charno > BUF_Z (b))
-    charno = BUF_Z (b);
-
-  bytepos = buf_charpos_to_bytepos (b, charno);
-
-  /* Every character is at least one byte.  */
-  if (charno > bytepos)
-    abort ();
-
-  m->bytepos = bytepos;
-  m->charpos = charno;
-
-  if (m->buffer != b)
-    {
-      unchain_marker (m);
-      m->buffer = b;
-      m->next = BUF_MARKERS (b);
-      BUF_MARKERS (b) = m;
-    }
-
+  attach_marker (m, b, charpos, bytepos);
   return marker;
 }
 
@@ -536,7 +509,8 @@ Returns MARKER.  */)
 Lisp_Object
 set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
 {
-  register EMACS_INT charno, bytepos;
+  register ptrdiff_t charpos;
+  register ptrdiff_t bytepos;
   register struct buffer *b;
   register struct Lisp_Marker *m;
 
@@ -577,31 +551,10 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
     }
 
   CHECK_NUMBER_COERCE_MARKER (pos);
+  charpos = clip_to_bounds (BUF_BEGV (b), XINT (pos), BUF_ZV (b));
+  bytepos = buf_charpos_to_bytepos (b, charpos);
 
-  charno = XINT (pos);
-
-  if (charno < BUF_BEGV (b))
-    charno = BUF_BEGV (b);
-  if (charno > BUF_ZV (b))
-    charno = BUF_ZV (b);
-
-  bytepos = buf_charpos_to_bytepos (b, charno);
-
-  /* Every character is at least one byte.  */
-  if (charno > bytepos)
-    abort ();
-
-  m->bytepos = bytepos;
-  m->charpos = charno;
-
-  if (m->buffer != b)
-    {
-      unchain_marker (m);
-      m->buffer = b;
-      m->next = BUF_MARKERS (b);
-      BUF_MARKERS (b) = m;
-    }
-
+  attach_marker (m, b, charpos, bytepos);
   return marker;
 }
 \f
@@ -609,7 +562,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer)
    character position and the corresponding byte position.  */
 
 Lisp_Object
-set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMACS_INT bytepos)
+set_marker_both (Lisp_Object marker, Lisp_Object buffer, ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   register struct buffer *b;
   register struct Lisp_Marker *m;
@@ -635,21 +588,8 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMAC
   if (BUF_Z (b) == BUF_Z_BYTE (b)
       && charpos != bytepos)
     abort ();
-  /* Every character is at least one byte.  */
-  if (charpos > bytepos)
-    abort ();
-
-  m->bytepos = bytepos;
-  m->charpos = charpos;
-
-  if (m->buffer != b)
-    {
-      unchain_marker (m);
-      m->buffer = b;
-      m->next = BUF_MARKERS (b);
-      BUF_MARKERS (b) = m;
-    }
 
+  attach_marker (m, b, charpos, bytepos);
   return marker;
 }
 
@@ -657,7 +597,7 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMAC
    be outside the visible part.  */
 
 Lisp_Object
-set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMACS_INT bytepos)
+set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   register struct buffer *b;
   register struct Lisp_Marker *m;
@@ -679,95 +619,64 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT ch
        }
     }
 
-  if (charpos < BUF_BEGV (b))
-    charpos = BUF_BEGV (b);
-  if (charpos > BUF_ZV (b))
-    charpos = BUF_ZV (b);
-  if (bytepos < BUF_BEGV_BYTE (b))
-    bytepos = BUF_BEGV_BYTE (b);
-  if (bytepos > BUF_ZV_BYTE (b))
-    bytepos = BUF_ZV_BYTE (b);
+  charpos = clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b));
+  bytepos = clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b));
 
   /* In a single-byte buffer, the two positions must be equal.  */
   if (BUF_Z (b) == BUF_Z_BYTE (b)
       && charpos != bytepos)
     abort ();
-  /* Every character is at least one byte.  */
-  if (charpos > bytepos)
-    abort ();
-
-  m->bytepos = bytepos;
-  m->charpos = charpos;
-
-  if (m->buffer != b)
-    {
-      unchain_marker (m);
-      m->buffer = b;
-      m->next = BUF_MARKERS (b);
-      BUF_MARKERS (b) = m;
-    }
 
+  attach_marker (m, b, charpos, bytepos);
   return marker;
 }
 \f
-/* Remove MARKER from the chain of whatever buffer it is in.
-   Leave it "in no buffer".
-
-   This is called during garbage collection,
-   so we must be careful to ignore and preserve mark bits,
-   including those in chain fields of markers.  */
+/* Remove MARKER from the chain of whatever buffer it is in,
+   leaving it points to nowhere.  This is called during garbage
+   collection, so we must be careful to ignore and preserve
+   mark bits, including those in chain fields of markers.  */
 
 void
 unchain_marker (register struct Lisp_Marker *marker)
 {
-  register struct Lisp_Marker *tail, *prev, *next;
-  register struct buffer *b;
-
-  b = marker->buffer;
-  if (b == 0)
-    return;
-
-  if (EQ (BVAR (b, name), Qnil))
-    abort ();
-
-  marker->buffer = 0;
+  register struct buffer *b = marker->buffer;
 
-  tail = BUF_MARKERS (b);
-  prev = NULL;
-  while (tail)
+  if (b)
     {
-      next = tail->next;
-
-      if (marker == tail)
-       {
-         if (!prev)
-           {
-             BUF_MARKERS (b) = next;
-             /* Deleting first marker from the buffer's chain.  Crash
-                if new first marker in chain does not say it belongs
-                to the same buffer, or at least that they have the same
-                base buffer.  */
-             if (next && b->text != next->buffer->text)
-               abort ();
-           }
-         else
-           prev->next = next;
-         /* We have removed the marker from the chain;
-            no need to scan the rest of the chain.  */
-         return;
-       }
-      else
-       prev = tail;
-      tail = next;
+      register struct Lisp_Marker *tail, **prev;
+
+      /* No dead buffers here.  */
+      eassert (!NILP (BVAR (b, name)));
+
+      marker->buffer = NULL;
+      prev = &BUF_MARKERS (b);
+
+      for (tail = BUF_MARKERS (b); tail; prev = &tail->next, tail = *prev)
+       if (marker == tail)
+         {
+           if (*prev == BUF_MARKERS (b))
+             {
+               /* Deleting first marker from the buffer's chain.  Crash 
+                  if new first marker in chain does not say it belongs
+                  to the same buffer, or at least that they have the same
+                  base buffer.  */
+               if (tail->next && b->text != tail->next->buffer->text)
+                 abort ();
+             }
+           *prev = tail->next;
+           /* We have removed the marker from the chain;
+              no need to scan the rest of the chain.  */
+           break;
+         }
+
+      /* Error if marker was not in it's chain.  */
+      eassert (tail != NULL);
     }
-
-  /* Marker was not in its chain.  */
-  abort ();
 }
 
 /* Return the char position of marker MARKER, as a C integer.  */
 
-EMACS_INT
+ptrdiff_t
 marker_position (Lisp_Object marker)
 {
   register struct Lisp_Marker *m = XMARKER (marker);
@@ -776,25 +685,25 @@ marker_position (Lisp_Object marker)
   if (!buf)
     error ("Marker does not point anywhere");
 
+  eassert (BUF_BEG (buf) <= m->charpos && m->charpos <= BUF_Z (buf));
+
   return m->charpos;
 }
 
 /* Return the byte position of marker MARKER, as a C integer.  */
 
-EMACS_INT
+ptrdiff_t
 marker_byte_position (Lisp_Object marker)
 {
   register struct Lisp_Marker *m = XMARKER (marker);
   register struct buffer *buf = m->buffer;
-  register EMACS_INT i = m->bytepos;
 
   if (!buf)
     error ("Marker does not point anywhere");
 
-  if (i < BUF_BEG_BYTE (buf) || i > BUF_Z_BYTE (buf))
-    abort ();
+  eassert (BUF_BEG_BYTE (buf) <= m->bytepos && m->bytepos <= BUF_Z_BYTE (buf));
 
-  return i;
+  return m->bytepos;
 }
 \f
 DEFUN ("copy-marker", Fcopy_marker, Scopy_marker, 0, 2, 0,
@@ -847,25 +756,21 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at,
   (Lisp_Object position)
 {
   register struct Lisp_Marker *tail;
-  register EMACS_INT charno;
+  register ptrdiff_t charpos;
 
-  charno = XINT (position);
-
-  if (charno < BEG)
-    charno = BEG;
-  if (charno > Z)
-    charno = Z;
+  charpos = clip_to_bounds (BEG, XINT (position), Z);
 
   for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next)
-    if (tail->charpos == charno)
+    if (tail->charpos == charpos)
       return Qt;
 
   return Qnil;
 }
 
+#ifdef MARKER_DEBUG
+
 /* For debugging -- count the markers in buffer BUF.  */
 
-extern int count_markers (struct buffer *) EXTERNALLY_VISIBLE;
 int
 count_markers (struct buffer *buf)
 {
@@ -877,6 +782,26 @@ count_markers (struct buffer *buf)
 
   return total;
 }
+
+/* For debugging -- recompute the bytepos corresponding
+   to CHARPOS in the simplest, most reliable way.  */
+
+ptrdiff_t
+verify_bytepos (ptrdiff_t charpos)
+{
+  ptrdiff_t below = 1;
+  ptrdiff_t below_byte = 1;
+
+  while (below != charpos)
+    {
+      below++;
+      BUF_INC_POS (current_buffer, below_byte);
+    }
+
+  return below_byte;
+}
+
+#endif /* MARKER_DEBUG */
 \f
 void
 syms_of_marker (void)
@@ -888,8 +813,4 @@ syms_of_marker (void)
   defsubr (&Smarker_insertion_type);
   defsubr (&Sset_marker_insertion_type);
   defsubr (&Sbuffer_has_markers_at);
-
-  DEFVAR_BOOL ("byte-debug-flag", byte_debug_flag,
-              doc: /* Non-nil enables debugging checks in byte/char position conversions.  */);
-  byte_debug_flag = 0;
 }
index 244592a9768ebb129c427af99f1205a4ed817f10..dbe58dc91566f330652e4a81558ce18b252f364c 100644 (file)
@@ -33,8 +33,8 @@ extern int etext;
 # endif
 #endif
 
-extern char *start_of_data (void);
-#if defined USE_LSB_TAG || UINTPTR_MAX >> VALBITS == 0
+extern char *start_of_data (void) ATTRIBUTE_CONST;
+#if USE_LSB_TAG || UINTPTR_MAX <= VAL_MAX
 #define EXCEEDS_LISP_PTR(ptr) 0
 #elif defined DATA_SEG_BITS
 #define EXCEEDS_LISP_PTR(ptr) \
index df86208c7ef726b572a35c2dfd2fb44391ece84a..3b8ebb65d2c7f5fecf9b7bedcf586394db29e486 100644 (file)
@@ -129,7 +129,7 @@ discard_menu_items (void)
       menu_items = Qnil;
       menu_items_allocated = 0;
     }
-  xassert (NILP (menu_items_inuse));
+  eassert (NILP (menu_items_inuse));
 }
 
 #ifdef HAVE_NS
@@ -175,15 +175,17 @@ save_menu_items (void)
 }
 
 \f
-/* Make the menu_items vector twice as large.  */
+/* Ensure that there is room for ITEMS items in the menu_items vector.  */
 
 static void
-grow_menu_items (void)
+ensure_menu_items (int items)
 {
-  if ((INT_MAX - MENU_ITEMS_PANE_LENGTH) / 2 < menu_items_allocated)
-    memory_full (SIZE_MAX);
-  menu_items_allocated *= 2;
-  menu_items = larger_vector (menu_items, menu_items_allocated, Qnil);
+  int incr = items - (menu_items_allocated - menu_items_used);
+  if (0 < incr)
+    {
+      menu_items = larger_vector (menu_items, incr, INT_MAX);
+      menu_items_allocated = ASIZE (menu_items);
+    }
 }
 
 #if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \
@@ -194,10 +196,9 @@ grow_menu_items (void)
 static void
 push_submenu_start (void)
 {
-  if (menu_items_used + 1 > menu_items_allocated)
-    grow_menu_items ();
-
-  XVECTOR (menu_items)->contents[menu_items_used++] = Qnil;
+  ensure_menu_items (1);
+  ASET (menu_items, menu_items_used, Qnil);
+  menu_items_used++;
   menu_items_submenu_depth++;
 }
 
@@ -206,10 +207,9 @@ push_submenu_start (void)
 static void
 push_submenu_end (void)
 {
-  if (menu_items_used + 1 > menu_items_allocated)
-    grow_menu_items ();
-
-  XVECTOR (menu_items)->contents[menu_items_used++] = Qlambda;
+  ensure_menu_items (1);
+  ASET (menu_items, menu_items_used, Qlambda);
+  menu_items_used++;
   menu_items_submenu_depth--;
 }
 
@@ -220,10 +220,9 @@ push_submenu_end (void)
 static void
 push_left_right_boundary (void)
 {
-  if (menu_items_used + 1 > menu_items_allocated)
-    grow_menu_items ();
-
-  XVECTOR (menu_items)->contents[menu_items_used++] = Qquote;
+  ensure_menu_items (1);
+  ASET (menu_items, menu_items_used, Qquote);
+  menu_items_used++;
 }
 
 /* Start a new menu pane in menu_items.
@@ -232,14 +231,15 @@ push_left_right_boundary (void)
 static void
 push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec)
 {
-  if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated)
-    grow_menu_items ();
-
+  ensure_menu_items (MENU_ITEMS_PANE_LENGTH);
   if (menu_items_submenu_depth == 0)
     menu_items_n_panes++;
-  XVECTOR (menu_items)->contents[menu_items_used++] = Qt;
-  XVECTOR (menu_items)->contents[menu_items_used++] = name;
-  XVECTOR (menu_items)->contents[menu_items_used++] = prefix_vec;
+  ASET (menu_items, menu_items_used, Qt);
+  menu_items_used++;
+  ASET (menu_items, menu_items_used, name);
+  menu_items_used++;
+  ASET (menu_items, menu_items_used, prefix_vec);
+  menu_items_used++;
 }
 
 /* Push one menu item into the current pane.  NAME is the string to
@@ -253,8 +253,7 @@ push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec)
 static void
 push_menu_item (Lisp_Object name, Lisp_Object enable, Lisp_Object key, Lisp_Object def, Lisp_Object equiv, Lisp_Object type, Lisp_Object selected, Lisp_Object help)
 {
-  if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated)
-    grow_menu_items ();
+  ensure_menu_items (MENU_ITEMS_ITEM_LENGTH);
 
   ASET (menu_items, menu_items_used + MENU_ITEMS_ITEM_NAME,    name);
   ASET (menu_items, menu_items_used + MENU_ITEMS_ITEM_ENABLE,  enable);
@@ -350,10 +349,10 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
   if (!res)
     return;                    /* Not a menu item.  */
 
-  map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP];
+  map = AREF (item_properties, ITEM_PROPERTY_MAP);
 
-  enabled = XVECTOR (item_properties)->contents[ITEM_PROPERTY_ENABLE];
-  item_string = XVECTOR (item_properties)->contents[ITEM_PROPERTY_NAME];
+  enabled = AREF (item_properties, ITEM_PROPERTY_ENABLE);
+  item_string = AREF (item_properties, ITEM_PROPERTY_NAME);
 
   if (!NILP (map) && SREF (item_string, 0) == '@')
     {
@@ -370,11 +369,11 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
      front of them.  */
   {
     Lisp_Object prefix = Qnil;
-    Lisp_Object type = XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE];
+    Lisp_Object type = AREF (item_properties, ITEM_PROPERTY_TYPE);
     if (!NILP (type))
       {
        Lisp_Object selected
-         = XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED];
+         = AREF (item_properties, ITEM_PROPERTY_SELECTED);
 
        if (skp->notbuttons)
          /* The first button. Line up previous items in this menu.  */
@@ -385,7 +384,7 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
            while (idx < menu_items_used)
              {
                tem
-                 = XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME];
+                 = AREF (menu_items, idx + MENU_ITEMS_ITEM_NAME);
                if (NILP (tem))
                  {
                    idx++;
@@ -404,8 +403,8 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
                  {
                    if (!submenu && SREF (tem, 0) != '\0'
                        && SREF (tem, 0) != '-')
-                     XVECTOR (menu_items)->contents[idx + MENU_ITEMS_ITEM_NAME]
-                       = concat2 (build_string ("    "), tem);
+                     ASET (menu_items, idx + MENU_ITEMS_ITEM_NAME,
+                           concat2 (build_string ("    "), tem));
                    idx += MENU_ITEMS_ITEM_LENGTH;
                  }
              }
@@ -437,11 +436,11 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
 #endif /* HAVE_X_WINDOWS || MSDOS */
 
   push_menu_item (item_string, enabled, key,
-                 XVECTOR (item_properties)->contents[ITEM_PROPERTY_DEF],
-                 XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ],
-                 XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE],
-                 XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED],
-                 XVECTOR (item_properties)->contents[ITEM_PROPERTY_HELP]);
+                 AREF (item_properties, ITEM_PROPERTY_DEF),
+                 AREF (item_properties, ITEM_PROPERTY_KEYEQ),
+                 AREF (item_properties, ITEM_PROPERTY_TYPE),
+                 AREF (item_properties, ITEM_PROPERTY_SELECTED),
+                 AREF (item_properties, ITEM_PROPERTY_HELP));
 
 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || defined (HAVE_NTGUI)
   /* Display a submenu using the toolkit.  */
@@ -458,9 +457,9 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
    and generate menu panes for them in menu_items.  */
 
 static void
-keymap_panes (Lisp_Object *keymaps, int nmaps)
+keymap_panes (Lisp_Object *keymaps, ptrdiff_t nmaps)
 {
-  int mapno;
+  ptrdiff_t mapno;
 
   init_menu_items ();
 
@@ -532,16 +531,17 @@ int
 parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps)
 {
   Lisp_Object length;
-  int len;
+  EMACS_INT len;
   Lisp_Object *mapvec;
-  int i;
+  ptrdiff_t i;
   int top_level_items = 0;
+  USE_SAFE_ALLOCA;
 
   length = Flength (maps);
   len = XINT (length);
 
   /* Convert the list MAPS into a vector MAPVEC.  */
-  mapvec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
+  SAFE_ALLOCA_LISP (mapvec, len);
   for (i = 0; i < len; i++)
     {
       mapvec[i] = Fcar (maps);
@@ -571,6 +571,7 @@ parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object m
        }
     }
 
+  SAFE_FREE ();
   return top_level_items;
 }
 
@@ -631,8 +632,7 @@ digest_single_submenu (int start, int end, int top_level_items)
   widget_value **submenu_stack;
   int panes_seen = 0;
 
-  submenu_stack
-    = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
+  submenu_stack = alloca (menu_items_used * sizeof *submenu_stack);
   wv = xmalloc_widget_value ();
   wv->name = "menu";
   wv->value = 0;
@@ -650,27 +650,27 @@ digest_single_submenu (int start, int end, int top_level_items)
   i = start;
   while (i < end)
     {
-      if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
+      if (EQ (AREF (menu_items, i), Qnil))
        {
          submenu_stack[submenu_depth++] = save_wv;
          save_wv = prev_wv;
          prev_wv = 0;
          i++;
        }
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda))
+      else if (EQ (AREF (menu_items, i), Qlambda))
        {
          prev_wv = save_wv;
          save_wv = submenu_stack[--submenu_depth];
          i++;
        }
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qt)
+      else if (EQ (AREF (menu_items, i), Qt)
               && submenu_depth != 0)
        i += MENU_ITEMS_PANE_LENGTH;
       /* Ignore a nil in the item list.
         It's meaningful only for dialog boxes.  */
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
+      else if (EQ (AREF (menu_items, i), Qquote))
        i += 1;
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
+      else if (EQ (AREF (menu_items, i), Qt))
        {
          /* Create a new pane.  */
          Lisp_Object pane_name;
@@ -678,7 +678,7 @@ digest_single_submenu (int start, int end, int top_level_items)
 
          panes_seen++;
 
-         pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
+         pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
 
 #ifdef HAVE_NTGUI
          if (STRINGP (pane_name))
@@ -892,31 +892,31 @@ find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object
   int i;
 
   entry = Qnil;
-  subprefix_stack = (Lisp_Object *) alloca (menu_bar_items_used * sizeof (Lisp_Object));
+  subprefix_stack = alloca (menu_bar_items_used * sizeof *subprefix_stack);
   prefix = Qnil;
   i = 0;
 
   while (i < menu_bar_items_used)
     {
-      if (EQ (XVECTOR (vector)->contents[i], Qnil))
+      if (EQ (AREF (vector, i), Qnil))
        {
          subprefix_stack[submenu_depth++] = prefix;
          prefix = entry;
          i++;
        }
-      else if (EQ (XVECTOR (vector)->contents[i], Qlambda))
+      else if (EQ (AREF (vector, i), Qlambda))
        {
          prefix = subprefix_stack[--submenu_depth];
          i++;
        }
-      else if (EQ (XVECTOR (vector)->contents[i], Qt))
+      else if (EQ (AREF (vector, i), Qt))
        {
-         prefix = XVECTOR (vector)->contents[i + MENU_ITEMS_PANE_PREFIX];
+         prefix = AREF (vector, i + MENU_ITEMS_PANE_PREFIX);
          i += MENU_ITEMS_PANE_LENGTH;
        }
       else
        {
-         entry = XVECTOR (vector)->contents[i + MENU_ITEMS_ITEM_VALUE];
+         entry = AREF (vector, i + MENU_ITEMS_ITEM_VALUE);
          /* Treat the pointer as an integer.  There's no problem
             as long as pointers have enough bits to hold small integers.  */
          if ((intptr_t) client_data == i)
@@ -981,32 +981,32 @@ find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data)
 
   while (i < menu_items_used)
     {
-      if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
+      if (EQ (AREF (menu_items, i), Qnil))
         {
           subprefix_stack[submenu_depth++] = prefix;
           prefix = entry;
           i++;
         }
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda))
+      else if (EQ (AREF (menu_items, i), Qlambda))
         {
           prefix = subprefix_stack[--submenu_depth];
           i++;
         }
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
+      else if (EQ (AREF (menu_items, i), Qt))
         {
           prefix
-            = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
+            = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
           i += MENU_ITEMS_PANE_LENGTH;
         }
       /* Ignore a nil in the item list.
          It's meaningful only for dialog boxes.  */
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
+      else if (EQ (AREF (menu_items, i), Qquote))
         i += 1;
       else
         {
           entry
-            = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE];
-          if ((EMACS_INT)client_data ==  (EMACS_INT)(&XVECTOR (menu_items)->contents[i]))
+            = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
+          if (&AREF (menu_items, i) == client_data)
             {
               if (keymaps != 0)
                 {
@@ -1082,7 +1082,7 @@ no quit occurs and `x-popup-menu' returns nil.  */)
   Lisp_Object x, y, window;
   int keymaps = 0;
   int for_click = 0;
-  int specpdl_count = SPECPDL_INDEX ();
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
   struct gcpro gcpro1;
 
   if (NILP (position))
@@ -1175,9 +1175,6 @@ no quit occurs and `x-popup-menu' returns nil.  */)
          }
       }
 
-    CHECK_NUMBER (x);
-    CHECK_NUMBER (y);
-
     /* Decode where to put the menu.  */
 
     if (FRAMEP (window))
@@ -1200,6 +1197,16 @@ no quit occurs and `x-popup-menu' returns nil.  */)
         but I don't want to make one now.  */
       CHECK_WINDOW (window);
 
+    CHECK_RANGED_INTEGER (x,
+                         (xpos < INT_MIN - MOST_NEGATIVE_FIXNUM
+                          ? (EMACS_INT) INT_MIN - xpos
+                          : MOST_NEGATIVE_FIXNUM),
+                         INT_MAX - xpos);
+    CHECK_RANGED_INTEGER (y,
+                         (ypos < INT_MIN - MOST_NEGATIVE_FIXNUM
+                          ? (EMACS_INT) INT_MIN - ypos
+                          : MOST_NEGATIVE_FIXNUM),
+                         INT_MAX - ypos);
     xpos += XINT (x);
     ypos += XINT (y);
 
@@ -1248,11 +1255,12 @@ no quit occurs and `x-popup-menu' returns nil.  */)
   else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
     {
       /* We were given a list of keymaps.  */
-      int nmaps = XFASTINT (Flength (menu));
-      Lisp_Object *maps
-       = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object));
-      int i;
+      EMACS_INT nmaps = XFASTINT (Flength (menu));
+      Lisp_Object *maps;
+      ptrdiff_t i;
+      USE_SAFE_ALLOCA;
 
+      SAFE_ALLOCA_LISP (maps, nmaps);
       title = Qnil;
 
       /* The first keymap that has a prompt string
@@ -1276,6 +1284,8 @@ no quit occurs and `x-popup-menu' returns nil.  */)
        ASET (menu_items, MENU_ITEMS_PANE_NAME, title);
 
       keymaps = 1;
+
+      SAFE_FREE ();
     }
   else
     {
index cb22a5255d6d51efe02349983523a2ffbef5900e..3406928a8d5e9cfcafcfed4c336d76334152ea42 100644 (file)
@@ -26,7 +26,7 @@ extern void x_set_menu_bar_lines (struct frame *f,
                                   Lisp_Object oldval);
 
 extern void init_menu_items (void);
-extern void finish_menu_items (void);
+extern void finish_menu_items (void) ATTRIBUTE_CONST;
 extern void discard_menu_items (void);
 extern void save_menu_items (void);
 extern int parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
index a9bdf06b735405676b1a8e5ef23089b0b6575f65..7e47be39bc9e39295ead9afdd9c1aef07c58714c 100644 (file)
@@ -25,6 +25,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "lisp.h"
 #include "commands.h"
+#include "character.h"
 #include "buffer.h"
 #include "dispextern.h"
 #include "keyboard.h"
@@ -72,7 +73,7 @@ Lisp_Object Qcompletion_ignore_case;
 static Lisp_Object Qminibuffer_completion_table;
 static Lisp_Object Qminibuffer_completion_predicate;
 static Lisp_Object Qminibuffer_completion_confirm;
-static Lisp_Object Quser_variable_p;
+static Lisp_Object Qcustom_variable_p;
 
 static Lisp_Object Qminibuffer_default;
 
@@ -89,7 +90,7 @@ static Lisp_Object minibuf_prompt;
 /* Width of current mini-buffer prompt.  Only set after display_line
    of the line that contains the prompt.  */
 
-static EMACS_INT minibuf_prompt_width;
+static ptrdiff_t minibuf_prompt_width;
 
 \f
 /* Put minibuf on currently selected frame's minibuffer.
@@ -172,7 +173,7 @@ without invoking the usual minibuffer commands.  */)
 static Lisp_Object read_minibuf_unwind (Lisp_Object);
 static Lisp_Object run_exit_minibuf_hook (Lisp_Object);
 static Lisp_Object read_minibuf (Lisp_Object, Lisp_Object,
-                                 Lisp_Object, Lisp_Object,
+                                 Lisp_Object,
                                  int, Lisp_Object,
                                  Lisp_Object, Lisp_Object,
                                  int, int);
@@ -192,7 +193,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
 {
   struct gcpro gcpro1, gcpro2;
   Lisp_Object expr_and_pos;
-  EMACS_INT pos;
+  ptrdiff_t pos;
 
   GCPRO2 (val, defalt);
 
@@ -210,7 +211,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
     {
       /* Ignore trailing whitespace; any other trailing junk
         is an error.  */
-      EMACS_INT i;
+      ptrdiff_t i;
       pos = string_char_to_byte (val, pos);
       for (i = pos; i < SBYTES (val); i++)
        {
@@ -247,7 +248,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
   val = Qnil;
   size = 100;
   len = 0;
-  line = (char *) xmalloc (size);
+  line = xmalloc (size);
 
   while ((c = getchar ()) != '\n')
     {
@@ -335,7 +336,7 @@ DEFUN ("minibuffer-contents", Fminibuffer_contents,
 If the current buffer is not a minibuffer, return its entire contents.  */)
   (void)
 {
-  EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ());
+  ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ());
   return make_buffer_string (prompt_end, ZV, 1);
 }
 
@@ -345,7 +346,7 @@ DEFUN ("minibuffer-contents-no-properties", Fminibuffer_contents_no_properties,
 If the current buffer is not a minibuffer, return its entire contents.  */)
   (void)
 {
-  EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ());
+  ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ());
   return make_buffer_string (prompt_end, ZV, 0);
 }
 
@@ -356,7 +357,7 @@ That is what completion commands operate on.
 If the current buffer is not a minibuffer, return its entire contents.  */)
   (void)
 {
-  EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ());
+  ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ());
   if (PT < prompt_end)
     error ("Cannot do completion in the prompt");
   return make_buffer_string (prompt_end, PT, 1);
@@ -388,16 +389,16 @@ If the current buffer is not a minibuffer, return its entire contents.  */)
 
 static Lisp_Object
 read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
-             Lisp_Object backup_n, int expflag,
+             int expflag,
              Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
              int allow_props, int inherit_input_method)
 {
   Lisp_Object val;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object mini_frame, ambient_dir, minibuffer, input_method;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object enable_multibyte;
-  int pos = INTEGERP (backup_n) ? XINT (backup_n) : 0;
+  EMACS_INT pos = 0;
   /* String to add to the history.  */
   Lisp_Object histstring;
 
@@ -423,8 +424,8 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
     {
       if (CONSP (initial))
        {
-         backup_n = Fcdr (initial);
-         initial = Fcar (initial);
+         Lisp_Object backup_n = XCDR (initial);
+         initial = XCAR (initial);
          CHECK_STRING (initial);
          if (!NILP (backup_n))
            {
@@ -621,14 +622,14 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
   /* Display this minibuffer in the proper window.  */
   Fset_window_buffer (minibuf_window, Fcurrent_buffer (), Qnil);
   Fselect_window (minibuf_window, Qnil);
-  XSETFASTINT (XWINDOW (minibuf_window)->hscroll, 0);
+  XWINDOW (minibuf_window)->hscroll = 0;
 
   Fmake_local_variable (Qprint_escape_newlines);
   print_escape_newlines = 1;
 
   /* Erase the buffer.  */
   {
-    int count1 = SPECPDL_INDEX ();
+    ptrdiff_t count1 = SPECPDL_INDEX ();
     specbind (Qinhibit_read_only, Qt);
     specbind (Qinhibit_modification_hooks, Qt);
     Ferase_buffer ();
@@ -791,8 +792,8 @@ get_minibuffer (EMACS_INT depth)
   buf = Fcar (tail);
   if (NILP (buf) || NILP (BVAR (XBUFFER (buf), name)))
     {
-      sprintf (name, " *Minibuf-%"pI"d*", depth);
-      buf = Fget_buffer_create (build_string (name));
+      buf = Fget_buffer_create
+       (make_formatted_string (name, " *Minibuf-%"pI"d*", depth));
 
       /* Although the buffer's name starts with a space, undo should be
         enabled in it.  */
@@ -802,11 +803,10 @@ get_minibuffer (EMACS_INT depth)
     }
   else
     {
-      int count = SPECPDL_INDEX ();
-      /* `reset_buffer' blindly sets the list of overlays to NULL, so we
-        have to empty the list, otherwise we end up with overlays that
-        think they belong to this buffer while the buffer doesn't know about
-        them any more.  */
+      ptrdiff_t count = SPECPDL_INDEX ();
+      /* We have to empty both overlay lists.  Otherwise we end
+        up with overlays that think they belong to this buffer
+        while the buffer doesn't know about them any more.  */
       delete_all_overlays (XBUFFER (buf));
       reset_buffer (XBUFFER (buf));
       record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
@@ -870,7 +870,7 @@ read_minibuf_unwind (Lisp_Object data)
 
   /* Erase the minibuffer we were using at this level.  */
   {
-    int count = SPECPDL_INDEX ();
+    ptrdiff_t count = SPECPDL_INDEX ();
     /* Prevent error in erase-buffer.  */
     specbind (Qinhibit_read_only, Qt);
     specbind (Qinhibit_modification_hooks, Qt);
@@ -887,8 +887,8 @@ read_minibuf_unwind (Lisp_Object data)
 
   /* Make sure minibuffer window is erased, not ignored.  */
   windows_or_buffers_changed++;
-  XSETFASTINT (XWINDOW (window)->last_modified, 0);
-  XSETFASTINT (XWINDOW (window)->last_overlay_modified, 0);
+  XWINDOW (window)->last_modified = 0;
+  XWINDOW (window)->last_overlay_modified = 0;
 
   /* In case the previous minibuffer displayed in this miniwindow is
      dead, we may keep displaying this buffer (tho it's inactive), so reset it,
@@ -978,7 +978,7 @@ and some related functions, which use zero-indexing for POSITION.  */)
 
   GCPRO1 (default_value);
   val = read_minibuf (keymap, initial_contents, prompt,
-                     Qnil, !NILP (read),
+                     !NILP (read),
                      histvar, histpos, default_value,
                      minibuffer_allow_text_properties,
                      !NILP (inherit_input_method));
@@ -996,7 +996,7 @@ Such arguments are used as in `read-from-minibuffer'.)  */)
 {
   CHECK_STRING (prompt);
   return read_minibuf (Vminibuffer_local_map, initial_contents,
-                      prompt, Qnil, 1, Qminibuffer_history,
+                      prompt, 1, Qminibuffer_history,
                       make_number (0), Qnil, 0, 0);
 }
 
@@ -1009,7 +1009,7 @@ Such arguments are used as in `read-from-minibuffer'.)  */)
   (Lisp_Object prompt, Lisp_Object initial_contents)
 {
   return Feval (read_minibuf (Vread_expression_map, initial_contents,
-                             prompt, Qnil, 1, Qread_expression_history,
+                             prompt, 1, Qread_expression_history,
                              make_number (0), Qnil, 0, 0),
                Qnil);
 }
@@ -1034,12 +1034,20 @@ Fifth arg INHERIT-INPUT-METHOD, if non-nil, means the minibuffer inherits
   (Lisp_Object prompt, Lisp_Object initial_input, Lisp_Object history, Lisp_Object default_value, Lisp_Object inherit_input_method)
 {
   Lisp_Object val;
+  ptrdiff_t count = SPECPDL_INDEX ();
+
+  /* Just in case we're in a recursive minibuffer, make it clear that the
+     previous minibuffer's completion table does not apply to the new
+     minibuffer.
+     FIXME: `minibuffer-completion-table' should be buffer-local instead.  */
+  specbind (Qminibuffer_completion_table, Qnil);
+
   val = Fread_from_minibuffer (prompt, initial_input, Qnil,
                               Qnil, history, default_value,
                               inherit_input_method);
   if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (default_value))
     val = CONSP (default_value) ? XCAR (default_value) : default_value;
-  return val;
+  return unbind_to (count, val);
 }
 
 DEFUN ("read-no-blanks-input", Fread_no_blanks_input, Sread_no_blanks_input, 1, 3, 0,
@@ -1055,7 +1063,7 @@ the current input method and the setting of`enable-multibyte-characters'.  */)
   (Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method)
 {
   CHECK_STRING (prompt);
-  return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil,
+  return read_minibuf (Vminibuffer_local_ns_map, initial, prompt,
                       0, Qminibuffer_history, make_number (0), Qnil, 0,
                       !NILP (inherit_input_method));
 }
@@ -1094,10 +1102,11 @@ Prompt with PROMPT.  */)
 #endif /* NOTDEF */
 
 DEFUN ("read-variable", Fread_variable, Sread_variable, 1, 2, 0,
-       doc: /* Read the name of a user variable and return it as a symbol.
+       doc: /* Read the name of a user option and return it as a symbol.
 Prompt with PROMPT.  By default, return DEFAULT-VALUE or its first element
 if it is a list.
-A user variable is one for which `user-variable-p' returns non-nil.  */)
+A user option, or customizable variable, is one for which
+`custom-variable-p' returns non-nil.  */)
   (Lisp_Object prompt, Lisp_Object default_value)
 {
   Lisp_Object name, default_string;
@@ -1110,7 +1119,7 @@ A user variable is one for which `user-variable-p' returns non-nil.  */)
     default_string = default_value;
 
   name = Fcompleting_read (prompt, Vobarray,
-                          Quser_variable_p, Qt,
+                          Qcustom_variable_p, Qt,
                           Qnil, Qnil, default_string, Qnil);
   if (NILP (name))
     return name;
@@ -1135,7 +1144,7 @@ function, instead of the usual behavior.  */)
   Lisp_Object args[4], result;
   char *s;
   ptrdiff_t len;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   if (BUFFERP (def))
     def = BVAR (XBUFFER (def), name);
@@ -1234,9 +1243,9 @@ is used to further constrain the set of candidates.  */)
 {
   Lisp_Object bestmatch, tail, elt, eltstring;
   /* Size in bytes of BESTMATCH.  */
-  int bestmatchsize = 0;
+  ptrdiff_t bestmatchsize = 0;
   /* These are in bytes, too.  */
-  int compare, matchsize;
+  ptrdiff_t compare, matchsize;
   enum { function_table, list_table, obarray_table, hash_table}
     type = (HASH_TABLE_P (collection) ? hash_table
            : VECTORP (collection) ? obarray_table
@@ -1245,9 +1254,9 @@ is used to further constrain the set of candidates.  */)
                    && (!SYMBOLP (XCAR (collection))
                        || NILP (XCAR (collection)))))
               ? list_table : function_table));
-  EMACS_INT idx = 0, obsize = 0;
+  ptrdiff_t idx = 0, obsize = 0;
   int matchcount = 0;
-  int bindcount = -1;
+  ptrdiff_t bindcount = -1;
   Lisp_Object bucket, zero, end, tem;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
@@ -1264,7 +1273,7 @@ is used to further constrain the set of candidates.  */)
     {
       collection = check_obarray (collection);
       obsize = ASIZE (collection);
-      bucket = XVECTOR (collection)->contents[idx];
+      bucket = AREF (collection, idx);
     }
 
   while (1)
@@ -1299,7 +1308,7 @@ is used to further constrain the set of candidates.  */)
            break;
          else
            {
-             bucket = XVECTOR (collection)->contents[idx];
+             bucket = AREF (collection, idx);
              continue;
            }
        }
@@ -1510,8 +1519,8 @@ with a space are ignored unless STRING itself starts with a space.  */)
     : NILP (collection) || (CONSP (collection)
                            && (!SYMBOLP (XCAR (collection))
                                || NILP (XCAR (collection))));
-  EMACS_INT idx = 0, obsize = 0;
-  int bindcount = -1;
+  ptrdiff_t idx = 0, obsize = 0;
+  ptrdiff_t bindcount = -1;
   Lisp_Object bucket, tem, zero;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
@@ -1527,7 +1536,7 @@ with a space are ignored unless STRING itself starts with a space.  */)
     {
       collection = check_obarray (collection);
       obsize = ASIZE (collection);
-      bucket = XVECTOR (collection)->contents[idx];
+      bucket = AREF (collection, idx);
     }
 
   while (1)
@@ -1562,7 +1571,7 @@ with a space are ignored unless STRING itself starts with a space.  */)
            break;
          else
            {
-             bucket = XVECTOR (collection)->contents[idx];
+             bucket = AREF (collection, idx);
              continue;
            }
        }
@@ -1725,8 +1734,6 @@ See also `completing-read-function'.  */)
   return Ffuncall (9, args);
 }
 \f
-Lisp_Object Fassoc_string (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold);
-
 /* Test whether TXT is an exact completion.  */
 DEFUN ("test-completion", Ftest_completion, Stest_completion, 2, 3, 0,
        doc: /* Return non-nil if STRING is a valid completion.
@@ -1772,7 +1779,7 @@ the values STRING, PREDICATE and `lambda'.  */)
        {
          for (i = ASIZE (collection) - 1; i >= 0; i--)
            {
-             tail = XVECTOR (collection)->contents[i];
+             tail = AREF (collection, i);
              if (SYMBOLP (tail))
                while (1)
                  {
@@ -1820,7 +1827,7 @@ the values STRING, PREDICATE and `lambda'.  */)
   /* Reject this element if it fails to match all the regexps.  */
   if (CONSP (Vcompletion_regexp_list))
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil);
       for (regexps = Vcompletion_regexp_list; CONSP (regexps);
           regexps = XCDR (regexps))
@@ -1975,11 +1982,11 @@ syms_of_minibuf (void)
   staticpro (&last_minibuf_string);
   last_minibuf_string = Qnil;
 
-  DEFSYM (Quser_variable_p, "user-variable-p");
   DEFSYM (Qminibuffer_history, "minibuffer-history");
   DEFSYM (Qbuffer_name_history, "buffer-name-history");
   Fset (Qbuffer_name_history, Qnil);
 
+  DEFSYM (Qcustom_variable_p, "custom-variable-p");
   DEFSYM (Qminibuffer_setup_hook, "minibuffer-setup-hook");
   DEFSYM (Qminibuffer_exit_hook, "minibuffer-exit-hook");
   DEFSYM (Qhistory_length, "history-length");
index ede864087cac3bda5c6d54026eefef154d2e7f06..d6a493a71d34da798ed73b8b969191cd77636d9b 100644 (file)
@@ -31,7 +31,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <time.h>
 #include <sys/param.h>
 #include <sys/time.h>
+/* gettime and settime in dos.h clash with their namesakes from
+   gnulib, so we move out of our way the prototypes in dos.h.  */
+#define gettime dos_h_gettime_
+#define settime dos_h_settime_
 #include <dos.h>
+#undef gettime
+#undef settime
 #include <errno.h>
 #include <sys/stat.h>    /* for _fixpath */
 #include <unistd.h>     /* for chdir, dup, dup2, etc. */
@@ -103,18 +109,18 @@ int _crt0_startup_flags = (_CRT0_FLAG_UNIX_SBRK | _CRT0_FLAG_FILL_SBRK_MEMORY);
 
 #endif /* not SYSTEM_MALLOC */
 
+/* Return the current timestamp in milliseconds since midnight.  */
 static unsigned long
 event_timestamp (void)
 {
-  struct time t;
+  struct timespec t;
   unsigned long s;
 
   gettime (&t);
-  s = t.ti_min;
-  s *= 60;
-  s += t.ti_sec;
+  s = t.tv_sec;
+  s %= 86400;
   s *= 1000;
-  s += t.ti_hund * 10;
+  s += t.tv_nsec * 1000000;
 
   return s;
 }
@@ -514,8 +520,10 @@ dos_set_window_size (int *rows, int *cols)
 
   /* If the user specified a special video mode for these dimensions,
      use that mode.  */
-  sprintf (video_name, "screen-dimensions-%dx%d", *rows, *cols);
-  video_mode = Fsymbol_value (Fintern_soft (build_string (video_name), Qnil));
+  video_mode 
+    = Fsymbol_value (Fintern_soft (make_formatted_string 
+                                  (video_name, "screen-dimensions-%dx%d",
+                                   *rows, *cols), Qnil));
 
   if (INTEGERP (video_mode)
       && (video_mode_value = XINT (video_mode)) > 0)
@@ -1610,11 +1618,9 @@ IT_set_frame_parameters (struct frame *f, Lisp_Object alist)
 
   /* Extract parm names and values into those vectors.  */
   i = 0;
-  for (tail = alist; CONSP (tail); tail = Fcdr (tail))
+  for (tail = alist; CONSP (tail); tail = XCDR (tail))
     {
-      Lisp_Object elt;
-
-      elt = Fcar (tail);
+      Lisp_Object elt = XCAR (tail);
       parms[i] = Fcar (elt);
       CHECK_SYMBOL (parms[i]);
       values[i] = Fcdr (elt);
@@ -2466,12 +2472,12 @@ dos_rawgetc (void)
       sc = regs.h.ah;
 
       total_doskeys += 2;
-      XVECTOR (recent_doskeys)->contents[recent_doskeys_index++]
-       = make_number (c);
+      ASET (recent_doskeys, recent_doskeys_index, make_number (c));
+      recent_doskeys_index++;
       if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
        recent_doskeys_index = 0;
-      XVECTOR (recent_doskeys)->contents[recent_doskeys_index++]
-       = make_number (sc);
+      ASET (recent_doskeys, recent_doskeys_index, make_number (sc));
+      recent_doskeys_index++;
       if (recent_doskeys_index == NUM_RECENT_DOSKEYS)
        recent_doskeys_index = 0;
 
@@ -2822,7 +2828,7 @@ IT_menu_create (void)
 {
   XMenu *menu;
 
-  menu = (XMenu *) xmalloc (sizeof (XMenu));
+  menu = xmalloc (sizeof (XMenu));
   menu->allocated = menu->count = menu->panecount = menu->width = 0;
   return menu;
 }
@@ -2836,10 +2842,10 @@ IT_menu_make_room (XMenu *menu)
   if (menu->allocated == 0)
     {
       int count = menu->allocated = 10;
-      menu->text = (char **) xmalloc (count * sizeof (char *));
-      menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *));
-      menu->panenumber = (int *) xmalloc (count * sizeof (int));
-      menu->help_text = (const char **) xmalloc (count * sizeof (char *));
+      menu->text = xmalloc (count * sizeof (char *));
+      menu->submenu = xmalloc (count * sizeof (XMenu *));
+      menu->panenumber = xmalloc (count * sizeof (int));
+      menu->help_text = xmalloc (count * sizeof (char *));
     }
   else if (menu->allocated == menu->count)
     {
@@ -2920,7 +2926,7 @@ IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help)
   width = menu->width;
   /* We multiply width by 2 to account for possible control characters.
      FIXME: cater to non-ASCII characters in menus.  */
-  text = (struct glyph *) xmalloc ((width * 2 + 2) * sizeof (struct glyph));
+  text = xmalloc ((width * 2 + 2) * sizeof (struct glyph));
   ScreenGetCursor (&row, &col);
   mouse_get_xy (&mx, &my);
   IT_update_begin (sf);
@@ -4072,13 +4078,6 @@ sigprocmask (int how, const sigset_t *new_set, sigset_t *old_set)
 #ifndef HAVE_SELECT
 #include "sysselect.h"
 
-#ifndef EMACS_TIME_ZERO_OR_NEG_P
-#define EMACS_TIME_ZERO_OR_NEG_P(time) \
-  ((long)(time).tv_sec < 0             \
-   || ((time).tv_sec == 0              \
-       && (long)(time).tv_usec <= 0))
-#endif
-
 /* This yields the rest of the current time slice to the task manager.
    It should be called by any code which knows that it has nothing
    useful to do except idle.
@@ -4104,10 +4103,10 @@ dos_yield_time_slice (void)
    because wait_reading_process_output takes care of that.  */
 int
 sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
-           EMACS_TIME *timeout)
+           EMACS_TIME *timeout, void *ignored)
 {
   int check_input;
-  struct time t;
+  struct timespec t;
 
   check_input = 0;
   if (rfds)
@@ -4137,22 +4136,17 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
       EMACS_TIME clnow, cllast, cldiff;
 
       gettime (&t);
-      EMACS_SET_SECS_USECS (cllast, t.ti_sec, t.ti_hund * 10000L);
+      cllast = make_emacs_time (t.tv_sec, t.tv_nsec);
 
       while (!check_input || !detect_input_pending ())
        {
          gettime (&t);
-         EMACS_SET_SECS_USECS (clnow, t.ti_sec, t.ti_hund * 10000L);
-         EMACS_SUB_TIME (cldiff, clnow, cllast);
-
-         /* When seconds wrap around, we assume that no more than
-            1 minute passed since last `gettime'.  */
-         if (EMACS_TIME_NEG_P (cldiff))
-           EMACS_SET_SECS (cldiff, EMACS_SECS (cldiff) + 60);
-         EMACS_SUB_TIME (*timeout, *timeout, cldiff);
+         clnow = make_emacs_time (t.tv_sec, t.tv_nsec);
+         cldiff = sub_emacs_time (clnow, cllast);
+         *timeout = sub_emacs_time (*timeout, cldiff);
 
          /* Stop when timeout value crosses zero.  */
-         if (EMACS_TIME_ZERO_OR_NEG_P (*timeout))
+         if (EMACS_TIME_SIGN (*timeout) <= 0)
            return 0;
          cllast = clnow;
          dos_yield_time_slice ();
@@ -4270,7 +4264,7 @@ syms_of_msdos (void)
   DEFSYM (Qreverse, "reverse");
 
   DEFVAR_LISP ("dos-unsupported-char-glyph", Vdos_unsupported_char_glyph,
-              doc: /* *Glyph to display instead of chars not supported by current codepage.
+              doc: /* Glyph to display instead of chars not supported by current codepage.
 This variable is used only by MS-DOS terminals.  */);
   Vdos_unsupported_char_glyph = make_number ('\177');
 
index d3b5afeb99ea72cfb2ded7b7245df0c0b9862ca6..77fbf5845d91e963d226b86efae1192ce62fdb19 100644 (file)
--- a/src/ns.mk
+++ b/src/ns.mk
@@ -1,6 +1,6 @@
 ### autodeps.mk --- src/Makefile fragment for GNU Emacs
 
-## Copyright (C) 2008-2012  Free Software Foundation, Inc.
+## Copyright (C) 2008-2012 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
 
 ${ns_appdir}: ${ns_appsrc}
        rm -fr ${ns_appdir}
-       mkdir -p ${ns_appdir}
+       ${MKDIR_P} ${ns_appdir}
        ( cd ${ns_appsrc} ; tar cfh - . ) | ( cd ${ns_appdir} ; umask 022; tar xf - )
 
-${ns_appbindir}Emacs: emacs${EXEEXT}
-       mkdir -p ${ns_appbindir}
-       cp -f emacs${EXEEXT} ${ns_appbindir}Emacs
+${ns_appbindir}/Emacs: emacs${EXEEXT}
+       ${MKDIR_P} ${ns_appbindir}
+       cp -f emacs${EXEEXT} ${ns_appbindir}/Emacs
 
-ns-app: ${ns_appdir} ${ns_appbindir}Emacs
+ns-app: ${ns_appdir} ${ns_appbindir}/Emacs
 
 ### ns.mk ends here
index 206c4155d0173e6c00aa968e8876c4ba10fad1bc..7c8f673d9ae5d497d7b48766bcd6912c48589a60 100644 (file)
@@ -33,16 +33,17 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 #include <signal.h>
 #include <math.h>
 #include <setjmp.h>
+#include <c-strcase.h>
 
 #include "lisp.h"
 #include "blockinput.h"
 #include "nsterm.h"
 #include "window.h"
+#include "character.h"
 #include "buffer.h"
 #include "keyboard.h"
 #include "termhooks.h"
 #include "fontset.h"
-#include "character.h"
 #include "font.h"
 
 #if 0
@@ -101,7 +102,7 @@ extern BOOL ns_in_resize;
 static Lisp_Object as_script, *as_result;
 static int as_status;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 static ptrdiff_t image_cache_refcount;
 #endif
 
@@ -169,7 +170,7 @@ check_ns_display_info (Lisp_Object frame)
       struct terminal *t = get_terminal (frame, 1);
 
       if (t->type != output_ns)
-        error ("Terminal %ld is not a Nextstep display", (long) XINT (frame));
+        error ("Terminal %"pI"d is not a Nextstep display", XINT (frame));
 
       return t->display_info.ns;
     }
@@ -470,11 +471,11 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
   if ([[view window] miniwindowTitle] &&
       ([[[view window] miniwindowTitle]
              isEqualToString: [NSString stringWithUTF8String:
-                                           SDATA (arg)]]))
+                                           SSDATA (arg)]]))
     return;
 
   [[view window] setMiniwindowTitle:
-        [NSString stringWithUTF8String: SDATA (arg)]];
+        [NSString stringWithUTF8String: SSDATA (arg)]];
 }
 
 static void
@@ -489,7 +490,7 @@ ns_set_name_internal (FRAME_PTR f, Lisp_Object name)
   encoded_name = ENCODE_UTF_8 (name);
   UNGCPRO;
 
-  str = [NSString stringWithUTF8String: SDATA (encoded_name)];
+  str = [NSString stringWithUTF8String: SSDATA (encoded_name)];
 
   /* Don't change the name if it's already NAME.  */
   if (! [[[view window] title] isEqualToString: str])
@@ -500,7 +501,7 @@ ns_set_name_internal (FRAME_PTR f, Lisp_Object name)
   else
     encoded_icon_name = ENCODE_UTF_8 (f->icon_name);
 
-  str = [NSString stringWithUTF8String: SDATA (encoded_icon_name)];
+  str = [NSString stringWithUTF8String: SSDATA (encoded_icon_name)];
 
   if ([[view window] miniwindowTitle] &&
       ! [[[view window] miniwindowTitle] isEqualToString: str])
@@ -511,7 +512,6 @@ ns_set_name_internal (FRAME_PTR f, Lisp_Object name)
 static void
 ns_set_name (struct frame *f, Lisp_Object name, int explicit)
 {
-  NSView *view;
   NSTRACE (ns_set_name);
 
   if (ns_in_resize)
@@ -640,14 +640,14 @@ ns_set_name_as_filename (struct frame *f)
   title = FRAME_ICONIFIED_P (f) ? [[[view window] miniwindowTitle] UTF8String]
                                 : [[[view window] title] UTF8String];
 
-  if (title && (! strcmp (title, SDATA (encoded_name))))
+  if (title && (! strcmp (title, SSDATA (encoded_name))))
     {
       [pool release];
       UNBLOCK_INPUT;
       return;
     }
 
-  str = [NSString stringWithUTF8String: SDATA (encoded_name)];
+  str = [NSString stringWithUTF8String: SSDATA (encoded_name)];
   if (str == nil) str = @"Bad coding";
 
   if (FRAME_ICONIFIED_P (f))
@@ -662,7 +662,7 @@ ns_set_name_as_filename (struct frame *f)
           encoded_filename = ENCODE_UTF_8 (filename);
           UNGCPRO;
 
-          fstr = [NSString stringWithUTF8String: SDATA (encoded_filename)];
+          fstr = [NSString stringWithUTF8String: SSDATA (encoded_filename)];
           if (fstr == nil) fstr = @"";
 #ifdef NS_IMPL_COCOA
           /* work around a bug observed on 10.3 and later where
@@ -705,11 +705,10 @@ void
 x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   int nlines;
-  int olines = FRAME_MENU_BAR_LINES (f);
   if (FRAME_MINIBUF_ONLY_P (f))
     return;
 
-  if (INTEGERP (value))
+  if (TYPE_RANGED_INTEGERP (int, value))
     nlines = XINT (value);
   else
     nlines = 0;
@@ -736,12 +735,11 @@ void
 x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
 {
   int nlines;
-  Lisp_Object root_window;
 
   if (FRAME_MINIBUF_ONLY_P (f))
     return;
 
-  if (INTEGERP (value) && XINT (value) >= 0)
+  if (RANGED_INTEGERP (0, value, INT_MAX))
     nlines = XFASTINT (value);
   else
     nlines = 0;
@@ -779,7 +777,7 @@ ns_implicitly_set_icon_type (struct frame *f)
   BLOCK_INPUT;
   pool = [[NSAutoreleasePool alloc] init];
   if (f->output_data.ns->miniimage
-      && [[NSString stringWithUTF8String: SDATA (f->name)]
+      && [[NSString stringWithUTF8String: SSDATA (f->name)]
                isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]])
     {
       [pool release];
@@ -801,10 +799,10 @@ ns_implicitly_set_icon_type (struct frame *f)
     {
       elt = XCAR (chain);
       /* special case: 't' means go by file type */
-      if (SYMBOLP (elt) && EQ (elt, Qt) && SDATA (f->name)[0] == '/')
+      if (SYMBOLP (elt) && EQ (elt, Qt) && SSDATA (f->name)[0] == '/')
         {
           NSString *str
-            = [NSString stringWithUTF8String: SDATA (f->name)];
+            = [NSString stringWithUTF8String: SSDATA (f->name)];
           if ([[NSFileManager defaultManager] fileExistsAtPath: str])
             image = [[[NSWorkspace sharedWorkspace] iconForFile: str] retain];
         }
@@ -817,7 +815,7 @@ ns_implicitly_set_icon_type (struct frame *f)
           if (image == nil)
             image = [[NSImage imageNamed:
                                [NSString stringWithUTF8String:
-                                           SDATA (XCDR (elt))]] retain];
+                                           SSDATA (XCDR (elt))]] retain];
         }
     }
 
@@ -846,7 +844,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
 
   if (!NILP (arg) && SYMBOLP (arg))
     {
-      arg =build_string (SDATA (SYMBOL_NAME (arg)));
+      arg =build_string (SSDATA (SYMBOL_NAME (arg)));
       store_frame_param (f, Qicon_type, arg);
     }
 
@@ -862,7 +860,7 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
   image = [EmacsImage allocInitFromFile: arg];
   if (image == nil)
     image =[NSImage imageNamed: [NSString stringWithUTF8String:
-                                            SDATA (arg)]];
+                                            SSDATA (arg)]];
 
   if (image == nil)
     {
@@ -891,9 +889,9 @@ ns_lisp_to_cursor_type (Lisp_Object arg)
 {
   char *str;
   if (XTYPE (arg) == Lisp_String)
-    str = SDATA (arg);
+    str = SSDATA (arg);
   else if (XTYPE (arg) == Lisp_Symbol)
-    str = SDATA (SYMBOL_NAME (arg));
+    str = SSDATA (SYMBOL_NAME (arg));
   else return -1;
   if (!strcmp (str, "box"))    return FILLED_BOX_CURSOR;
   if (!strcmp (str, "hollow")) return HOLLOW_BOX_CURSOR;
@@ -1058,16 +1056,16 @@ unwind_create_frame (Lisp_Object frame)
   /* If frame is ``official'', nothing to do.  */
   if (NILP (Fmemq (frame, Vframe_list)))
     {
-#if GLYPH_DEBUG && XASSERTS
+#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
       struct ns_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 #endif
 
       x_free_frame_resources (f);
       free_glyphs (f);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       /* Check that reference counts are indeed correct.  */
-      xassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
+      eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
 #endif
       return Qt;
     }
@@ -1136,7 +1134,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   int minibuffer_only = 0;
   int window_prompting = 0;
   int width, height;
-  int count = specpdl_ptr - specpdl;
+  ptrdiff_t count = specpdl_ptr - specpdl;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object display;
   struct ns_display_info *dpyinfo = NULL;
@@ -1203,8 +1201,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   f->terminal = dpyinfo->terminal;
 
   f->output_method = output_ns;
-  f->output_data.ns = (struct ns_output *)xmalloc (sizeof *(f->output_data.ns));
-  memset (f->output_data.ns, 0, sizeof *(f->output_data.ns));
+  f->output_data.ns = xzalloc (sizeof *f->output_data.ns);
 
   FRAME_FONTSET (f) = -1;
 
@@ -1219,9 +1216,9 @@ This function is an internal primitive--use `make-frame' instead.  */)
   record_unwind_protect (unwind_create_frame, frame);
 
   f->output_data.ns->window_desc = desc_ctr++;
-  if (!NILP (parent))
+  if (TYPE_RANGED_INTEGERP (Window, parent))
     {
-      f->output_data.ns->parent_desc = (Window) XFASTINT (parent);
+      f->output_data.ns->parent_desc = XFASTINT (parent);
       f->output_data.ns->explicit_parent = 1;
     }
   else
@@ -1294,7 +1291,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   x_default_parameter (f, parms, Qright_fringe, Qnil,
                       "rightFringe", "RightFringe", RES_TYPE_NUMBER);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   image_cache_refcount =
     FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
 #endif
@@ -1493,12 +1490,12 @@ Optional arg INIT, if non-nil, provides a default file name to use.  */)
   Lisp_Object fname;
 
   NSString *promptS = NILP (prompt) || !STRINGP (prompt) ? nil :
-    [NSString stringWithUTF8String: SDATA (prompt)];
+    [NSString stringWithUTF8String: SSDATA (prompt)];
   NSString *dirS = NILP (dir) || !STRINGP (dir) ?
-    [NSString stringWithUTF8String: SDATA (BVAR (current_buffer, directory))] :
-    [NSString stringWithUTF8String: SDATA (dir)];
+    [NSString stringWithUTF8String: SSDATA (BVAR (current_buffer, directory))] :
+    [NSString stringWithUTF8String: SSDATA (dir)];
   NSString *initS = NILP (init) || !STRINGP (init) ? nil :
-    [NSString stringWithUTF8String: SDATA (init)];
+    [NSString stringWithUTF8String: SSDATA (init)];
 
   check_ns ();
 
@@ -1568,9 +1565,9 @@ If OWNER is nil, Emacs is assumed.  */)
   if (NILP (owner))
     owner = build_string([ns_app_name UTF8String]);
   CHECK_STRING (name);
-/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SDATA (name)); */
+/*fprintf (stderr, "ns-get-resource checking resource '%s'\n", SSDATA (name)); */
 
-  value = ns_get_defaults_value (SDATA (name));
+  value = ns_get_defaults_value (SSDATA (name));
 
   if (value)
     return build_string (value);
@@ -1591,15 +1588,15 @@ If VALUE is nil, the default is removed.  */)
   if (NILP (value))
     {
       [[NSUserDefaults standardUserDefaults] removeObjectForKey:
-                         [NSString stringWithUTF8String: SDATA (name)]];
+                         [NSString stringWithUTF8String: SSDATA (name)]];
     }
   else
     {
       CHECK_STRING (value);
       [[NSUserDefaults standardUserDefaults] setObject:
-                [NSString stringWithUTF8String: SDATA (value)]
+                [NSString stringWithUTF8String: SSDATA (value)]
                                         forKey: [NSString stringWithUTF8String:
-                                                         SDATA (name)]];
+                                                         SSDATA (name)]];
     }
 
   return Qnil;
@@ -1795,10 +1792,10 @@ terminate Emacs if we can't open the connection.
     {
       if (!NILP (must_succeed))
         fatal ("OpenStep on %s not responding.\n",
-               SDATA (display));
+               SSDATA (display));
       else
         error ("OpenStep on %s not responding.\n",
-               SDATA (display));
+               SSDATA (display));
     }
 
   /* Register our external input/output types, used for determining
@@ -1897,14 +1894,14 @@ font descriptor.  If string contains `fontset' and not
 {
   char *nm;
   CHECK_STRING (name);
-  nm = SDATA (name);
+  nm = SSDATA (name);
 
   if (nm[0] != '-')
     return name;
   if (strstr (nm, "fontset") && !strstr (nm, "fontset-startup"))
     return name;
 
-  return build_string (ns_xlfd_to_fontname (SDATA (name)));
+  return build_string (ns_xlfd_to_fontname (SSDATA (name)));
 }
 
 
@@ -1927,14 +1924,14 @@ The optional argument FRAME is currently ignored.  */)
   BLOCK_INPUT;
 
   colorlists = [[NSColorList availableColorLists] objectEnumerator];
-  while (clist = [colorlists nextObject])
+  while ((clist = [colorlists nextObject]))
     {
       if ([[clist name] length] < 7 ||
           [[clist name] rangeOfString: @"PANTONE"].location == 0)
         {
           NSEnumerator *cnames = [[clist allKeys] reverseObjectEnumerator];
           NSString *cname;
-          while (cname = [cnames nextObject])
+          while ((cname = [cnames nextObject]))
             list = Fcons (build_string ([cname UTF8String]), list);
 /*           for (i = [[clist allKeys] count] - 1; i >= 0; i--)
                list = Fcons (build_string ([[[clist allKeys] objectAtIndex: i]
@@ -2014,12 +2011,11 @@ there was no result.  */)
   id pb;
   NSString *svcName;
   char *utfStr;
-  int len;
 
   CHECK_STRING (service);
   check_ns ();
 
-  utfStr = SDATA (service);
+  utfStr = SSDATA (service);
   svcName = [NSString stringWithUTF8String: utfStr];
 
   pb =[NSPasteboard pasteboardWithUniqueName];
@@ -2044,7 +2040,7 @@ DEFUN ("ns-convert-utf8-nfd-to-nfc", Fns_convert_utf8_nfd_to_nfc,
   NSString *utfStr;
 
   CHECK_STRING (str);
-  utfStr = [NSString stringWithUTF8String: SDATA (str)];
+  utfStr = [NSString stringWithUTF8String: SSDATA (str)];
   if (![utfStr respondsToSelector:
                  @selector (precomposedStringWithCanonicalMapping)])
     {
@@ -2074,7 +2070,7 @@ ns_do_applescript (Lisp_Object script, Lisp_Object *result)
 
   NSAppleScript* scriptObject =
     [[NSAppleScript alloc] initWithSource:
-                            [NSString stringWithUTF8String: SDATA (script)]];
+                            [NSString stringWithUTF8String: SSDATA (script)]];
 
   returnDescriptor = [scriptObject executeAndReturnError: &errorDict];
   [scriptObject release];
@@ -2173,7 +2169,7 @@ In case the execution fails, an error is signaled. */)
   else if (!STRINGP (result))
     error ("AppleScript error %d", status);
   else
-    error ("%s", SDATA (result));
+    error ("%s", SSDATA (result));
 }
 #endif
 
@@ -2227,8 +2223,8 @@ x_get_string_resource (XrmDatabase rdb, char *name, char *class)
 
   res = ns_get_defaults_value (toCheck);
   return !res ? NULL :
-      (!strncasecmp (res, "YES", 3) ? "true" :
-          (!strncasecmp (res, "NO", 2) ? "false" : res));
+      (!c_strncasecmp (res, "YES", 3) ? "true" :
+          (!c_strncasecmp (res, "NO", 2) ? "false" : res));
 }
 
 
@@ -2400,7 +2396,6 @@ frame, a display name (a string), or terminal ID.  If omitted or nil,
 that stands for the selected frame's display. */)
      (Lisp_Object display)
 {
-  int top;
   NSScreen *screen;
   NSRect vScreen;
 
@@ -2548,7 +2543,7 @@ Text larger than the specified size is clipped.  */)
 {
   int root_x, root_y;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct frame *f;
   char *str;
   NSSize size;
@@ -2558,7 +2553,7 @@ Text larger than the specified size is clipped.  */)
   GCPRO4 (string, parms, frame, timeout);
 
   CHECK_STRING (string);
-  str = SDATA (string);
+  str = SSDATA (string);
   f = check_x_frame (frame);
   if (NILP (timeout))
     timeout = make_number (5);
@@ -2692,8 +2687,6 @@ Value is t if tooltip was open, nil otherwise.  */)
 void
 syms_of_nsfns (void)
 {
-  int i;
-
   Qfontsize = intern_c_string ("fontsize");
   staticpro (&Qfontsize);
 
index 9aa7b0865ab44ef26ef70f27b934ef425079239c..6f9294e082ab0a76b7129b015ca18407ea6b4ae7 100644 (file)
@@ -100,7 +100,7 @@ ns_get_family (Lisp_Object font_spec)
       return nil;
   else
     {
-      char *tmp = xstrdup (SDATA (SYMBOL_NAME (tem)));
+      char *tmp = xstrdup (SSDATA (SYMBOL_NAME (tem)));
       NSString *family;
       ns_unescape_name (tmp);
       family = [NSString stringWithUTF8String: tmp];
@@ -152,7 +152,7 @@ ns_spec_to_descriptor (Lisp_Object font_spec)
        [fdAttrs setObject: tdict forKey: NSFontTraitsAttribute];
 
     fdesc = [NSFontDescriptor fontDescriptorWithFontAttributes: fdAttrs];
-    if (family != nil) 
+    if (family != nil)
       {
        fdesc = [fdesc fontDescriptorWithFamily: family];
       }
@@ -271,6 +271,11 @@ ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct)
     const unsigned short *bytes2 = [[set2 bitmapRepresentation] bytes];
     int i, off = 0, tot = 0;
 
+    /* Work around what appears to be a GNUstep bug.
+       See <http://bugs.gnu.org/11853>.  */
+    if (! (bytes1 && bytes2))
+      return NO;
+
     for (i=0; i<4096; i++, bytes1++, bytes2++)
        if (*bytes2)
          {
@@ -288,13 +293,13 @@ ns_charset_covers(NSCharacterSet *set1, NSCharacterSet *set2, float pct)
 static NSString
 *ns_lang_to_script (Lisp_Object lang)
 {
-    if (!strcmp (SDATA (SYMBOL_NAME (lang)), "ja"))
+    if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ja"))
        return @"han";
     /* NOTE: ja given for any hanzi that's also a kanji, but Chinese fonts
              have more characters. */
-    else if (!strcmp (SDATA (SYMBOL_NAME (lang)), "zh"))
+    else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "zh"))
        return @"han";
-    else if (!strcmp (SDATA (SYMBOL_NAME (lang)), "ko"))
+    else if (!strcmp (SSDATA (SYMBOL_NAME (lang)), "ko"))
        return @"hangul";
     else
        return @"";
@@ -308,7 +313,7 @@ static NSString
 {
     Lisp_Object script = assq_no_quit (XCAR (otf), Votf_script_alist);
     return CONSP (script)
-       ? [NSString stringWithUTF8String: SDATA (SYMBOL_NAME (XCDR ((script))))]
+       ? [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (XCDR ((script))))]
        : @"";
 }
 
@@ -321,10 +326,10 @@ static NSString
     while CONSP (rts)
       {
         r = XCAR (XCAR (rts));
-        if (!strncmp(SDATA(r), reg, strlen(SDATA(r))))
+        if (!strncmp(SSDATA(r), reg, strlen(SSDATA(r))))
           {
             script = XCDR (XCAR (rts));
-            return [NSString stringWithUTF8String: SDATA (SYMBOL_NAME (script))];
+            return [NSString stringWithUTF8String: SSDATA (SYMBOL_NAME (script))];
           }
         rts = XCDR (rts);
       }
@@ -350,7 +355,7 @@ static NSString
            Lisp_Object key = XCAR (tmp), val = XCDR (tmp);
            if (EQ (key, QCscript) && SYMBOLP (val))
                return [NSString stringWithUTF8String:
-                           SDATA (SYMBOL_NAME (val))];
+                           SSDATA (SYMBOL_NAME (val))];
            if (EQ (key, QClang) && SYMBOLP (val))
                return ns_lang_to_script (val);
            if (EQ (key, QCotf) && CONSP (val) && SYMBOLP (XCAR (val)))
@@ -368,7 +373,7 @@ static NSString
         if (EQ (reg, Qiso10646_1))
           reg = Qiso8859_1;
 #endif
-        return ns_registry_to_script (SDATA (SYMBOL_NAME (reg)));
+        return ns_registry_to_script (SSDATA (SYMBOL_NAME (reg)));
       }
 
     return @"";
@@ -459,7 +464,7 @@ static NSSet
            while (1)
              {
                NSEnumerator *allFamiliesEnum = [allFamilies objectEnumerator];
-               while (family = [allFamiliesEnum nextObject])
+               while ((family = [allFamiliesEnum nextObject]))
                  {
                    NSCharacterSet *fset = [[fontMgr fontWithFamily: family
                         traits: 0 weight: 5 size: 12.0]        coveredCharacterSet];
@@ -523,7 +528,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
        NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
              [matchingDescs count]);
 
-    for (dEnum = [matchingDescs objectEnumerator]; desc = [dEnum nextObject]; )
+    for (dEnum = [matchingDescs objectEnumerator]; (desc = [dEnum nextObject]);)
       {
        if (![cFamilies containsObject:
                 [desc objectForKey: NSFontFamilyAttribute]])
@@ -557,8 +562,8 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
       return ns_fallback_entity ();
 
     if (NSFONT_TRACE)
-       fprintf (stderr, "    Returning %ld entities.\n",
-                 (long) XINT (Flength (list)));
+       fprintf (stderr, "    Returning %"pI"d entities.\n",
+                 XINT (Flength (list)));
 
     return list;
 }
@@ -659,13 +664,13 @@ nsfont_list_family (Lisp_Object frame)
     [[[NSFontManager sharedFontManager] availableFontFamilies]
       objectEnumerator];
   NSString *family;
-  while (family = [families nextObject])
+  while ((family = [families nextObject]))
       list = Fcons (intern ([family UTF8String]), list);
   /* FIXME: escape the name? */
 
   if (NSFONT_TRACE)
-    fprintf (stderr, "nsfont: list families returning %ld entries\n",
-            (long) XINT (Flength (list)));
+    fprintf (stderr, "nsfont: list families returning %"pI"d entries\n",
+            XINT (Flength (list)));
 
   return list;
 }
@@ -687,7 +692,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
   Lisp_Object tem;
   NSRect brect;
   Lisp_Object font_object;
-  int i;
   int fixLeopardBug;
   static NSMutableDictionary *fontCache = nil;
   NSNumber *cached;
@@ -714,7 +718,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
     }
 
   tem = AREF (font_entity, FONT_ADSTYLE_INDEX);
-  synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)),
+  synthItal = !NILP (tem) && !strncmp ("synthItal", SSDATA (SYMBOL_NAME (tem)),
                                        9);
   family = ns_get_family (font_entity);
   if (family == nil)
@@ -779,14 +783,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
   if (!font)
     return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */
 
-  font_info->glyphs = (unsigned short **)
-    xmalloc (0x100 * sizeof (unsigned short *));
-  font_info->metrics = (struct font_metrics **)
-    xmalloc (0x100 * sizeof (struct font_metrics *));
-  if (!font_info->glyphs || !font_info->metrics)
-    return Qnil;
-  memset (font_info->glyphs, 0, 0x100 * sizeof (unsigned short *));
-  memset (font_info->metrics, 0, 0x100 * sizeof (struct font_metrics *));
+  font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
+  font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
 
   BLOCK_INPUT;
 
@@ -813,7 +811,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
 
   {
     const char *fontName = [[nsfont fontName] UTF8String];
-    int len = strlen (fontName);
 
     /* The values specified by fonts are not always exact. For
      * example, a 6x8 font could specify that the descender is
@@ -831,8 +828,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
     [font_info->nsfont retain];
 
     /* set up ns_font (defined in nsgui.h) */
-    font_info->name = (char *)xmalloc (strlen (fontName)+1);
-    strcpy (font_info->name, fontName);
+    font_info->name = xstrdup (fontName);
     font_info->bold = [fontMgr traitsOfFont: nsfont] & NSBoldFontMask;
     font_info->ital =
       synthItal || ([fontMgr traitsOfFont: nsfont] & NSItalicFontMask);
@@ -1062,7 +1058,6 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
      NS to render the string, it will come out differently from the individual
      character widths added up because of layout processing. */
   {
-    XCharStruct *cs;
     int cwidth, twidth = 0;
     int hi, lo;
     /* FIXME: composition: no vertical displacement is considered. */
@@ -1371,8 +1366,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
  BLOCK_INPUT;
  sfont = [font_info->nsfont screenFont];
 
-  font_info->metrics[block] = xmalloc (0x100 * sizeof (struct font_metrics));
-  memset (font_info->metrics[block], 0, 0x100 * sizeof (struct font_metrics));
+  font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics));
   if (!(font_info->metrics[block]))
     abort ();
 
@@ -1417,7 +1411,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
   maxChar = 0;
   maxGlyph = 0;
   dict = [NSMutableDictionary new];
-  cglyphs = (CGGlyph *)xmalloc (c * sizeof (CGGlyph));
+  cglyphs = xmalloc (c * sizeof (CGGlyph));
   return self;
 }
 
index 0c9a8a01e6965dcb045736f6372bd6b8b8e333b8..60c38b221fb94b381cecc45aa7e4530b4c786e7d 100644 (file)
@@ -27,7 +27,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #warning "Z is defined.  If you get a later parse error in a header, check that buffer.h or other files #define-ing Z are not included."
 #endif  /* Z */
 #define Cursor FooFoo
-#undef init_process
 #endif  /* NS_IMPL_COCOA */
 
 #undef verify
@@ -36,7 +35,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifdef NS_IMPL_COCOA
 #undef Cursor
-#define init_process emacs_init_process
 #endif /* NS_IMPL_COCOA */
 #import <Foundation/NSDistantObject.h>
 
index 82a176975ff3c0fafb226c6305ff57baeae46c3d..1479294948bf707d5a28a29f9f7bbc9787698a2e 100644 (file)
@@ -96,7 +96,7 @@ ns_load_image (struct frame *f, struct image *img,
     {
       NSData *data;
 
-      data = [NSData dataWithBytes: SDATA (spec_data)
+      data = [NSData dataWithBytes: SSDATA (spec_data)
                            length: SBYTES (spec_data)];
       eImg = [[EmacsImage alloc] initWithData: data];
       [eImg setPixmapData];
@@ -171,7 +171,7 @@ static EmacsImage *ImageList = nil;
 
   /* look for an existing image of the same name */
   while (image != nil &&
-         [[image name] compare: [NSString stringWithUTF8String: SDATA (file)]]
+         [[image name] compare: [NSString stringWithUTF8String: SSDATA (file)]]
              != NSOrderedSame)
     image = [image imageListNext];
 
@@ -187,7 +187,7 @@ static EmacsImage *ImageList = nil;
     return nil;
 
   image = [[EmacsImage alloc] initByReferencingFile:
-                     [NSString stringWithUTF8String: SDATA (found)]];
+                     [NSString stringWithUTF8String: SSDATA (found)]];
 
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
   imgRep = [NSBitmapImageRep imageRepWithData:[image TIFFRepresentation]];
@@ -205,7 +205,7 @@ static EmacsImage *ImageList = nil;
   [image setScalesWhenResized: YES];
   [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
 
-  [image setName: [NSString stringWithUTF8String: SDATA (file)]];
+  [image setName: [NSString stringWithUTF8String: SSDATA (file)]];
   [image reference];
   ImageList = [image imageListSetNext: ImageList];
 
@@ -334,7 +334,6 @@ static EmacsImage *ImageList = nil;
 - setXBMColor: (NSColor *)color
 {
   NSSize s = [self size];
-  int len = (int) s.width * s.height;
   unsigned char *planes[5];
   CGFloat r, g, b, a;
   NSColor *rgbColor;
@@ -400,7 +399,7 @@ static EmacsImage *ImageList = nil;
   NSImageRep *rep;
 
   reps = [[self representations] objectEnumerator];
-  while (rep = (NSImageRep *) [reps nextObject])
+  while ((rep = (NSImageRep *) [reps nextObject]))
     {
       if ([rep respondsToSelector: @selector (getBitmapDataPlanes:)])
         {
index 7a6434941d2d1f457436157bdc33f14bd5e70fad..c919f350c6ca99471139faeacacb81b014799db3 100644 (file)
@@ -28,6 +28,7 @@ Carbon version by Yamamoto Mitsuharu. */
 
 #include "lisp.h"
 #include "window.h"
+#include "character.h"
 #include "buffer.h"
 #include "keymap.h"
 #include "coding.h"
@@ -186,11 +187,10 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
       int *submenu_top_level_items, *submenu_n_panes;
       struct buffer *prev = current_buffer;
       Lisp_Object buffer;
-      int specpdl_count = SPECPDL_INDEX ();
+      ptrdiff_t specpdl_count = SPECPDL_INDEX ();
       int previous_menu_items_used = f->menu_bar_items_used;
       Lisp_Object *previous_items
-       = (Lisp_Object *) alloca (previous_menu_items_used
-                                 * sizeof (Lisp_Object));
+       = alloca (previous_menu_items_used * sizeof *previous_items);
 
       /* lisp preliminaries */
       buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer;
@@ -230,11 +230,11 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
 
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
-      submenu_start = (int *) alloca (ASIZE (items) * sizeof (int *));
-      submenu_end = (int *) alloca (ASIZE (items) * sizeof (int *));
-      submenu_n_panes = (int *) alloca (ASIZE (items) * sizeof (int));
-      submenu_top_level_items
-       = (int *) alloca (ASIZE (items) * sizeof (int *));
+      submenu_start = alloca (ASIZE (items) * sizeof *submenu_start);
+      submenu_end = alloca (ASIZE (items) * sizeof *submenu_end);
+      submenu_n_panes = alloca (ASIZE (items) * sizeof *submenu_n_panes);
+      submenu_top_level_items = alloca (ASIZE (items)
+                                       * sizeof *submenu_top_level_items);
       init_menu_items ();
       for (i = 0; i < ASIZE (items); i += 4)
        {
@@ -249,7 +249,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
           /* FIXME: we'd like to only parse the needed submenu, but this
                was causing crashes in the _common parsing code.. need to make
                sure proper initialization done.. */
-/*        if (submenu && strcmp (submenuTitle, SDATA (string)))
+/*        if (submenu && strcmp (submenuTitle, SSDATA (string)))
              continue; */
 
          submenu_start[i] = menu_items_used;
@@ -318,8 +318,8 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
             if (!EQ (previous_items[i], AREF (menu_items, i)))
               if (!(STRINGP (previous_items[i])
                     && STRINGP (AREF (menu_items, i))
-                    && !strcmp (SDATA (previous_items[i]),
-                               SDATA (AREF (menu_items, i)))))
+                    && !strcmp (SSDATA (previous_items[i]),
+                               SSDATA (AREF (menu_items, i)))))
                   break;
           if (i == previous_menu_items_used)
             {
@@ -356,7 +356,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
          string = AREF (items, i + 1);
          if (NILP (string))
            break;
-/*           if (submenu && strcmp (submenuTitle, SDATA (string)))
+/*           if (submenu && strcmp (submenuTitle, SSDATA (string)))
                continue; */
 
          wv->name = SSDATA (string);
@@ -422,11 +422,14 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
               if (EQ (string, make_number (0))) // FIXME: Why???  --Stef
                 continue;
               if (NILP (string))
-                if (previous_strings[i][0])
-                  break;
-              else
-                continue;
-              if (strncmp (previous_strings[i], SDATA (string), 10))
+                {
+                  if (previous_strings[i][0])
+                    break;
+                  else
+                    continue;
+                }
+              else if (memcmp (previous_strings[i], SDATA (string),
+                         min (10, SBYTES (string) + 1)))
                 break;
             }
 
@@ -447,7 +450,8 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
            break;
 
           if (n < 100)
-            strncpy (previous_strings[i/4], SDATA (string), 10);
+           memcpy (previous_strings[i/4], SDATA (string),
+                    min (10, SBYTES (string) + 1));
 
          wv = xmalloc_widget_value ();
          wv->name = SSDATA (string);
@@ -455,7 +459,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu)
          wv->enabled = 1;
          wv->button_type = BUTTON_TYPE_NONE;
          wv->help = Qnil;
-         wv->call_data = (void *) (EMACS_INT) (-1);
+         wv->call_data = (void *) (intptr_t) (-1);
 
 #ifdef NS_IMPL_COCOA
           /* we'll update the real copy under app menu when time comes */
@@ -526,7 +530,7 @@ set_frame_menubar (struct frame *f, int first_time, int deep_p)
 /* override designated initializer */
 - initWithTitle: (NSString *)title
 {
-  if (self = [super initWithTitle: title])
+  if ((self = [super initWithTitle: title]))
     [self setAutoenablesItems: NO];
   return self;
 }
@@ -791,8 +795,8 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
 {
   EmacsMenu *pmenu;
   NSPoint p;
-  Lisp_Object window, tem, keymap;
-  int specpdl_count = SPECPDL_INDEX ();
+  Lisp_Object tem;
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
   widget_value *wv, *first_wv = 0;
 
   p.x = x; p.y = y;
@@ -813,9 +817,9 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
   {
   widget_value *save_wv = 0, *prev_wv = 0;
   widget_value **submenu_stack
-    = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
+    = alloca (menu_items_used * sizeof *submenu_stack);
 /*   Lisp_Object *subprefix_stack
-       = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); */
+       = alloca (menu_items_used * sizeof *subprefix_stack); */
   int submenu_depth = 0;
   int first_pane = 1;
   int i;
@@ -988,7 +992,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
     }
 
   pmenu = [[EmacsMenu alloc] initWithTitle:
-                               [NSString stringWithUTF8String: SDATA (title)]];
+                               [NSString stringWithUTF8String: SSDATA (title)]];
   [pmenu fillWithWidgetValue: first_wv->contents];
   free_menubar_widget_value_tree (first_wv);
   unbind_to (specpdl_count, Qnil);
@@ -1041,7 +1045,6 @@ update_frame_tool_bar (FRAME_PTR f)
                             i * TOOL_BAR_ITEM_NSLOTS + (IDX))
 
       BOOL enabled_p = !NILP (TOOLPROP (TOOL_BAR_ITEM_ENABLED_P));
-      BOOL selected_p = !NILP (TOOLPROP (TOOL_BAR_ITEM_SELECTED_P));
       int idx;
       ptrdiff_t img_id;
       struct image *img;
@@ -1056,7 +1059,7 @@ update_frame_tool_bar (FRAME_PTR f)
        {
           /* NS toolbar auto-computes disabled and selected images */
           idx = TOOL_BAR_IMAGE_ENABLED_SELECTED;
-         xassert (ASIZE (image) >= idx);
+         eassert (ASIZE (image) >= idx);
          image = AREF (image, idx);
        }
       else
@@ -1429,7 +1432,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
   dialog = [[EmacsDialogPanel alloc] initFromContents: contents
                                            isQuestion: isQ];
   {
-    int specpdl_count = SPECPDL_INDEX ();
+    ptrdiff_t specpdl_count = SPECPDL_INDEX ();
     record_unwind_protect (pop_down_menu, make_save_value (dialog, 0));
     popup_activated_flag = 1;
     tem = [dialog runDialogAt: p];
@@ -1471,7 +1474,6 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
 {
   NSSize spacing = {SPACER, SPACER};
   NSRect area;
-  char this_cmd_name[80];
   id cell;
   static NSImageView *imgView;
   static FlippedView *contentView;
@@ -1579,11 +1581,11 @@ void process_dialog (id window, Lisp_Object list)
       item = XCAR (list);
       if (XTYPE (item) == Lisp_String)
         {
-          [window addString: SDATA (item) row: row++];
+          [window addString: SSDATA (item) row: row++];
         }
       else if (XTYPE (item) == Lisp_Cons)
         {
-          [window addButton: SDATA (XCAR (item))
+          [window addButton: SSDATA (XCAR (item))
                       value: XCDR (item) row: row++];
         }
       else if (NILP (item))
@@ -1673,7 +1675,7 @@ void process_dialog (id window, Lisp_Object list)
 
   if (XTYPE (head) == Lisp_String)
       [title setStringValue:
-                 [NSString stringWithUTF8String: SDATA (head)]];
+                 [NSString stringWithUTF8String: SSDATA (head)]];
   else if (isQ == YES)
       [title setStringValue: @"Question"];
   else
index 4d901fac2ec012af6f1724695230127d5c827782..a4d91dae1f2ad25e1da471927351dbcc64371d1d 100644 (file)
@@ -62,7 +62,7 @@ symbol_to_nsstring (Lisp_Object sym)
   if (EQ (sym, QPRIMARY))     return NXPrimaryPboard;
   if (EQ (sym, QSECONDARY))   return NXSecondaryPboard;
   if (EQ (sym, QTEXT))        return NSStringPboardType;
-  return [NSString stringWithUTF8String: SDATA (XSYMBOL (sym)->xname)];
+  return [NSString stringWithUTF8String: SSDATA (XSYMBOL (sym)->xname)];
 }
 
 static NSPasteboard *
@@ -112,8 +112,8 @@ clean_local_selection_data (Lisp_Object obj)
 
   if (VECTORP (obj))
     {
-      int i;
-      int size = ASIZE (obj);
+      ptrdiff_t i;
+      ptrdiff_t size = ASIZE (obj);
       Lisp_Object copy;
 
       if (size == 1)
@@ -157,7 +157,7 @@ ns_string_to_pasteboard_internal (id pb, Lisp_Object str, NSString *gtype)
 
       CHECK_STRING (str);
 
-      utfStr = SDATA (str);
+      utfStr = SSDATA (str);
       nsStr = [[NSString alloc] initWithBytesNoCopy: utfStr
                                              length: SBYTES (str)
                                            encoding: NSUTF8StringEncoding
@@ -184,7 +184,7 @@ ns_get_local_selection (Lisp_Object selection_name,
 {
   Lisp_Object local_value;
   Lisp_Object handler_fn, value, type, check;
-  int count;
+  ptrdiff_t count;
 
   local_value = assq_no_quit (selection_name, Vselection_alist);
 
@@ -297,7 +297,7 @@ ns_string_from_pasteboard (id pb)
       length = [mstr lengthOfBytesUsingEncoding: NSUTF8StringEncoding];
 
 #if ! defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4
-      if (!utfStr) 
+      if (!utfStr)
         {
           utfStr = [mstr cString];
           length = strlen (utfStr);
@@ -388,7 +388,7 @@ On Nextstep, FRAME is unused.  */)
       for (rest = Vns_sent_selection_hooks; CONSP (rest); rest = Fcdr (rest))
         call3 (Fcar (rest), selection, target_symbol, successful_p);
     }
-  
+
   return value;
 }
 
@@ -443,7 +443,7 @@ On Nextstep, TERMINAL is unused.  */)
   if (EQ (selection, Qt)) selection = QSECONDARY;
   pb = ns_symbol_to_pb (selection);
   if (pb == nil) return Qnil;
-  
+
   types = [pb types];
   return ([types count] == 0) ? Qnil : Qt;
 }
@@ -603,4 +603,3 @@ The functions are called with one argument, the selection type\n\
   Qforeign_selection = intern_c_string ("foreign-selection");
   staticpro (&Qforeign_selection);
 }
-
index bc535b47d973a6481fcafe49aed3e700f0aadfd8..b20621a53d79a5419955d813f1e7686bc00e3085 100644 (file)
@@ -89,7 +89,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    }
 
 /* AppKit-side interface */
-- menuDown: sender;
+- menuDown: (id)sender;
 - toolbarClicked: (id)item;
 - toggleToolbar: (id)sender;
 - (void)keyDown: (NSEvent *)theEvent;
@@ -535,7 +535,7 @@ struct ns_display_info
 extern struct ns_display_info *x_display_list;
 
 extern Lisp_Object ns_display_name_list;
-extern struct ns_display_info *ns_display_info_for_name ();
+extern struct ns_display_info *ns_display_info_for_name (Lisp_Object name);
 
 struct ns_display_info *check_x_display_info (Lisp_Object frame);
 FRAME_PTR check_x_frame (Lisp_Object frame);
@@ -697,7 +697,7 @@ struct x_output
   (! (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) ? 0 \
    : FRAME_SCROLL_BAR_COLS (f))
 
-extern struct ns_display_info *ns_term_init ();
+extern struct ns_display_info *ns_term_init (Lisp_Object display_name);
 extern void ns_term_shutdown (int sig);
 
 /* constants for text rendering */
@@ -707,8 +707,6 @@ extern void ns_term_shutdown (int sig);
 #define NS_DUMPGLYPH_MOUSEFACE          3
 
 
-EXFUN (Fx_display_grayscale_p, 1);
-EXFUN (Fx_display_planes, 1);
 
 /* In nsfont, called from fontset.c */
 extern void nsfont_make_fontset_for_font (Lisp_Object name,
@@ -727,13 +725,15 @@ extern void ns_clear_frame (struct frame *f);
 extern const char *ns_xlfd_to_fontname (const char *xlfd);
 
 extern void check_ns (void);
-extern Lisp_Object ns_map_event_to_object ();
-extern Lisp_Object ns_string_from_pasteboard ();
-extern void ns_string_to_pasteboard ();
+extern Lisp_Object ns_map_event_to_object (void);
+#ifdef __OBJC__
+extern Lisp_Object ns_string_from_pasteboard (id pb);
+extern void ns_string_to_pasteboard (id pb, Lisp_Object str);
+#endif
 extern Lisp_Object ns_get_local_selection (Lisp_Object selection_name,
                                            Lisp_Object target_type);
-extern void nxatoms_of_nsselect ();
-extern int ns_lisp_to_cursor_type ();
+extern void nxatoms_of_nsselect (void);
+extern int ns_lisp_to_cursor_type (Lisp_Object arg);
 extern Lisp_Object ns_cursor_type_to_lisp (int arg);
 extern Lisp_Object Qnone;
 extern void ns_set_name_as_filename (struct frame *f);
@@ -758,9 +758,9 @@ extern void ns_free_indexed_color (unsigned long idx, struct frame *f);
 /* C access to ObjC functionality */
 extern void  ns_release_object (void *obj);
 extern void  ns_retain_object (void *obj);
-extern void *ns_alloc_autorelease_pool ();
-extern void ns_release_autorelease_pool ();
-extern const char *ns_get_defaults_value ();
+extern void *ns_alloc_autorelease_pool (void);
+extern void ns_release_autorelease_pool (void *);
+extern const char *ns_get_defaults_value (const char *key);
 
 /* in nsmenu */
 extern void update_frame_tool_bar (FRAME_PTR f);
@@ -796,11 +796,14 @@ extern void x_set_tool_bar_lines (struct frame *f,
 extern void x_activate_menubar (struct frame *);
 extern void free_frame_menubar (struct frame *);
 extern void x_free_frame_resources (struct frame *);
+extern void x_destroy_window (struct frame *);
 
 #define NSAPP_DATA2_RUNASSCRIPT 10
 extern void ns_run_ascript (void);
 
-extern void ns_init_paths (void);
+extern const char *ns_etc_directory (void);
+extern const char *ns_exec_path (void);
+extern const char *ns_load_path (void);
 extern void syms_of_nsterm (void);
 extern void syms_of_nsfns (void);
 extern void syms_of_nsmenu (void);
@@ -824,7 +827,8 @@ extern int x_display_pixel_width (struct ns_display_info *);
 
 /* This in nsterm.m */
 extern int ns_select (int nfds, fd_set *readfds, fd_set *writefds,
-                      fd_set *exceptfds, struct timeval *timeout);
+                      fd_set *exceptfds, EMACS_TIME *timeout,
+                     sigset_t *sigmask);
 extern unsigned long ns_get_rgb_color (struct frame *f,
                                        float r, float g, float b, float a);
 extern NSPoint last_mouse_motion_position;
index aad1f3283d6310a7de2107e9cb61a4bb9a1fee11..c13fb6623f5c775e5592d6e1e76de0a840171c19 100644 (file)
@@ -36,6 +36,8 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
 #include <signal.h>
 #include <unistd.h>
 #include <setjmp.h>
+#include <c-strcase.h>
+#include <ftoastr.h>
 
 #include "lisp.h"
 #include "blockinput.h"
@@ -167,7 +169,9 @@ static EmacsScroller *last_mouse_scroll_bar = nil;
 static struct frame *ns_updating_frame;
 static NSView *focus_view = NULL;
 static int ns_window_num = 0;
+#ifdef NS_IMPL_GNUSTEP
 static NSRect uRect;
+#endif
 static BOOL gsaved = NO;
 BOOL ns_in_resize = NO;
 static BOOL ns_fake_keydown = NO;
@@ -183,7 +187,6 @@ static NSTimer *timed_entry = 0;
 static NSTimer *fd_entry = nil;
 static NSTimer *scroll_repeat_entry = nil;
 static fd_set select_readfds, t_readfds;
-static struct timeval select_timeout;
 static int select_nfds;
 static NSAutoreleasePool *outerpool;
 static struct input_event *emacs_event = NULL;
@@ -286,24 +289,52 @@ append2 (Lisp_Object list, Lisp_Object item)
 }
 
 
-void
-ns_init_paths (void)
-/* --------------------------------------------------------------------------
-   Used to allow emacs to find its resources under Emacs.app
-   Called from emacs.c at startup.
-   -------------------------------------------------------------------------- */
+const char *
+ns_etc_directory (void)
+/* If running as a self-contained app bundle, return as a string the
+   filename of the etc directory, if present; else nil.  */
+{
+  NSBundle *bundle = [NSBundle mainBundle];
+  NSString *resourceDir = [bundle resourcePath];
+  NSString *resourcePath;
+  NSFileManager *fileManager = [NSFileManager defaultManager];
+  BOOL isDir;
+
+  resourcePath = [resourceDir stringByAppendingPathComponent: @"etc"];
+  if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
+    {
+      if (isDir) return [resourcePath UTF8String];
+    }
+  return NULL;
+}
+
+
+const char *
+ns_exec_path (void)
+/* If running as a self-contained app bundle, return as a path string
+   the filenames of the libexec and bin directories, ie libexec:bin.
+   Otherwise, return nil.
+   Normally, Emacs does not add its own bin/ directory to the PATH.
+   However, a self-contained NS build has a different layout, with
+   bin/ and libexec/ subdirectories in the directory that contains
+   Emacs.app itself.
+   We put libexec first, because init_callproc_1 uses the first
+   element to initialize exec-directory.  An alternative would be
+   for init_callproc to check for invocation-directory/libexec.
+*/
 {
   NSBundle *bundle = [NSBundle mainBundle];
-  NSString *binDir = [bundle bundlePath], *resourceDir = [bundle resourcePath];
+  NSString *resourceDir = [bundle resourcePath];
+  NSString *binDir = [bundle bundlePath];
   NSString *resourcePath, *resourcePaths;
   NSRange range;
-  BOOL onWindows = NO; /* how do I determine this? */
+  BOOL onWindows = NO;       /* FIXME determine this somehow  */
   NSString *pathSeparator = onWindows ? @";" : @":";
   NSFileManager *fileManager = [NSFileManager defaultManager];
+  NSArray *paths;
+  NSEnumerator *pathEnum;
   BOOL isDir;
-/*NSLog (@"ns_init_paths: '%@'\n%@\n", [[NSBundle mainBundle] bundlePath], [[NSBundle mainBundle] resourcePath]); */
 
-  /* get bindir from base */
   range = [resourceDir rangeOfString: @"Contents"];
   if (range.location != NSNotFound)
     {
@@ -313,107 +344,66 @@ ns_init_paths (void)
 #endif
     }
 
-  /* the following based on Andrew Choi's init_mac_osx_environment () */
-  if (!getenv ("EMACSLOADPATH"))
-    {
-      NSArray *paths = [resourceDir stringsByAppendingPaths:
-                                  [NSArray arrayWithObjects:
-                                         @"site-lisp", @"lisp", @"leim", nil]];
-      NSEnumerator *pathEnum = [paths objectEnumerator];
-      resourcePaths = @"";
-      while (resourcePath = [pathEnum nextObject])
-        {
-          if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
-            if (isDir)
-              {
-                if ([resourcePaths length] > 0)
-                  resourcePaths
-                   = [resourcePaths stringByAppendingString: pathSeparator];
-                resourcePaths
-                 = [resourcePaths stringByAppendingString: resourcePath];
-              }
-        }
-      if ([resourcePaths length] > 0)
-        setenv ("EMACSLOADPATH", [resourcePaths UTF8String], 1);
-/*NSLog (@"loadPath: '%@'\n", resourcePaths); */
-    }
-
-  if (!getenv ("EMACSPATH"))
-    {
-      NSArray *paths = [binDir stringsByAppendingPaths:
-                                  [NSArray arrayWithObjects: @"bin",
-                                                             @"lib-exec", nil]];
-      NSEnumerator *pathEnum = [paths objectEnumerator];
-      resourcePaths = @"";
-      while (resourcePath = [pathEnum nextObject])
-        {
-          if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
-            if (isDir)
-              {
-                if ([resourcePaths length] > 0)
-                  resourcePaths
-                   = [resourcePaths stringByAppendingString: pathSeparator];
-                resourcePaths
-                 = [resourcePaths stringByAppendingString: resourcePath];
-              }
-        }
-      if ([resourcePaths length] > 0)
-        setenv ("EMACSPATH", [resourcePaths UTF8String], 1);
-    }
-
-  resourcePath = [resourceDir stringByAppendingPathComponent: @"etc"];
-  if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
-    {
-      if (isDir)
-        {
-          if (!getenv ("EMACSDATA"))
-            setenv ("EMACSDATA", [resourcePath UTF8String], 1);
-          if (!getenv ("EMACSDOC"))
-            setenv ("EMACSDOC", [resourcePath UTF8String], 1);
-        }
-    }
+  paths = [binDir stringsByAppendingPaths:
+                [NSArray arrayWithObjects: @"libexec", @"bin", nil]];
+  pathEnum = [paths objectEnumerator];
+  resourcePaths = @"";
 
-  if (!getenv ("INFOPATH"))
+  while ((resourcePath = [pathEnum nextObject]))
     {
-      resourcePath = [resourceDir stringByAppendingPathComponent: @"info"];
       if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
         if (isDir)
-          setenv ("INFOPATH", [[resourcePath stringByAppendingString: @":"]
-                                             UTF8String], 1);
-      /* Note, extra colon needed to cause merge w/later user additions. */
+          {
+            if ([resourcePaths length] > 0)
+              resourcePaths
+                = [resourcePaths stringByAppendingString: pathSeparator];
+            resourcePaths
+              = [resourcePaths stringByAppendingString: resourcePath];
+          }
     }
+  if ([resourcePaths length] > 0) return [resourcePaths UTF8String];
+
+  return NULL;
 }
 
 
-static int
-timeval_subtract (struct timeval *result, struct timeval x, struct timeval y)
-/* --------------------------------------------------------------------------
-   Subtract the `struct timeval' values X and Y, storing the result in RESULT.
-   Return 1 if the difference is negative, otherwise 0.
-   -------------------------------------------------------------------------- */
+const char *
+ns_load_path (void)
+/* If running as a self-contained app bundle, return as a path string
+   the filenames of the site-lisp, lisp and leim directories.
+   Ie, site-lisp:lisp:leim.  Otherwise, return nil.  */
 {
-  /* Perform the carry for the later subtraction by updating y.
-     This is safer because on some systems
-     the tv_sec member is unsigned.  */
-  if (x.tv_usec < y.tv_usec)
-    {
-      int nsec = (y.tv_usec - x.tv_usec) / 1000000 + 1;
-      y.tv_usec -= 1000000 * nsec;
-      y.tv_sec += nsec;
-    }
-  if (x.tv_usec - y.tv_usec > 1000000)
+  NSBundle *bundle = [NSBundle mainBundle];
+  NSString *resourceDir = [bundle resourcePath];
+  NSString *resourcePath, *resourcePaths;
+  BOOL onWindows = NO;          /* FIXME determine this somehow */
+  NSString *pathSeparator = onWindows ? @";" : @":";
+  NSFileManager *fileManager = [NSFileManager defaultManager];
+  BOOL isDir;
+  NSArray *paths = [resourceDir stringsByAppendingPaths:
+                              [NSArray arrayWithObjects:
+                                         @"site-lisp", @"lisp", @"leim", nil]];
+  NSEnumerator *pathEnum = [paths objectEnumerator];
+  resourcePaths = @"";
+
+  /* Hack to skip site-lisp.  */
+  if (no_site_lisp) resourcePath = [pathEnum nextObject];
+
+  while ((resourcePath = [pathEnum nextObject]))
     {
-      int nsec = (y.tv_usec - x.tv_usec) / 1000000;
-      y.tv_usec += 1000000 * nsec;
-      y.tv_sec -= nsec;
+      if ([fileManager fileExistsAtPath: resourcePath isDirectory: &isDir])
+        if (isDir)
+          {
+            if ([resourcePaths length] > 0)
+              resourcePaths
+                = [resourcePaths stringByAppendingString: pathSeparator];
+            resourcePaths
+              = [resourcePaths stringByAppendingString: resourcePath];
+          }
     }
+  if ([resourcePaths length] > 0) return [resourcePaths UTF8String];
 
-  /* Compute the time remaining to wait.  tv_usec is certainly positive.  */
-  result->tv_sec = x.tv_sec - y.tv_sec;
-  result->tv_usec = x.tv_usec - y.tv_usec;
-
-  /* Return indication of whether the result should be considered negative.  */
-  return x.tv_sec < y.tv_sec;
+  return NULL;
 }
 
 static void
@@ -422,29 +412,19 @@ ns_timeout (int usecs)
      Blocking timer utility used by ns_ring_bell
    -------------------------------------------------------------------------- */
 {
-  struct timeval wakeup;
-
-  EMACS_GET_TIME (wakeup);
-
-  /* Compute time to wait until, propagating carry from usecs.  */
-  wakeup.tv_usec += usecs;
-  wakeup.tv_sec += (wakeup.tv_usec / 1000000);
-  wakeup.tv_usec %= 1000000;
+  EMACS_TIME wakeup = add_emacs_time (current_emacs_time (),
+                                     make_emacs_time (0, usecs * 1000));
 
   /* Keep waiting until past the time wakeup.  */
   while (1)
     {
-      struct timeval timeout;
-
-      EMACS_GET_TIME (timeout);
-
-      /* In effect, timeout = wakeup - timeout.
-        Break if result would be negative.  */
-      if (timeval_subtract (&timeout, wakeup, timeout))
+      EMACS_TIME timeout, now = current_emacs_time ();
+      if (EMACS_TIME_LE (wakeup, now))
        break;
+      timeout = sub_emacs_time (wakeup, now);
 
       /* Try to wait that long--but we might wake up sooner.  */
-      select (0, NULL, NULL, NULL, &timeout);
+      pselect (0, NULL, NULL, NULL, &timeout, NULL);
     }
 }
 
@@ -1133,7 +1113,7 @@ x_free_frame_resources (struct frame *f)
   NSView *view = FRAME_NS_VIEW (f);
   struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (f);
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
-  NSTRACE (x_destroy_window);
+  NSTRACE (x_free_frame_resources);
   check_ns ();
 
   [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */
@@ -1240,7 +1220,6 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows)
    -------------------------------------------------------------------------- */
 {
   EmacsView *view = FRAME_NS_VIEW (f);
-  EmacsToolbar *toolbar = [view toolbar];
   NSWindow *window = [view window];
   NSRect wr = [window frame];
   int tb = FRAME_EXTERNAL_TOOL_BAR (f);
@@ -1362,8 +1341,7 @@ ns_index_color (NSColor *color, struct frame *f)
     {
       color_table->size = NS_COLOR_CAPACITY;
       color_table->avail = 1; /* skip idx=0 as marker */
-      color_table->colors
-       = (NSColor **)xmalloc (color_table->size * sizeof (NSColor *));
+      color_table->colors = xmalloc (color_table->size * sizeof (NSColor *));
       color_table->colors[0] = nil;
       color_table->empty_indices = [[NSMutableSet alloc] init];
     }
@@ -1461,21 +1439,16 @@ ns_get_color (const char *name, NSColor **col)
       [scanner scanFloat: &b];
     }
   else if (!strncmp(name, "rgb:", 4))  /* A newer X11 format -- rgb:r/g/b */
-    {
-      strncpy (hex, name + 4, 19);
-      hex[19] = '\0';
-      scaling = (strlen(hex) - 2) / 3;
-    }
+    scaling = (snprintf (hex, sizeof hex, "%s", name + 4) - 2) / 3;
   else if (name[0] == '#')        /* An old X11 format; convert to newer */
     {
       int len = (strlen(name) - 1);
       int start = (len % 3 == 0) ? 1 : len / 4 + 1;
       int i;
       scaling = strlen(name+start) / 3;
-      for (i=0; i<3; i++) {
-        strncpy(hex + i * (scaling + 1), name + start + i * scaling, scaling);
-        hex[(i+1) * (scaling + 1) - 1] = '/';
-      }
+      for (i = 0; i < 3; i++)
+       sprintf (hex + i * (scaling + 1), "%.*s/", scaling,
+                name + start + i * scaling);
       hex[3 * (scaling + 1) - 1] = '\0';
     }
 
@@ -1531,21 +1504,6 @@ ns_get_color (const char *name, NSColor **col)
 }
 
 
-static NSColor *
-ns_get_color_default (const char *name, NSColor *dflt)
-/* --------------------------------------------------------------------------
-     Parse a color or use a default value
-   -------------------------------------------------------------------------- */
-{
-  NSColor * col;
-
-  if (ns_get_color (name, &col))
-    return dflt;
-  else
-    return col;
-}
-
-
 int
 ns_lisp_to_color (Lisp_Object color, NSColor **col)
 /* --------------------------------------------------------------------------
@@ -1554,9 +1512,9 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col)
 {
   NSTRACE (ns_lisp_to_color);
   if (STRINGP (color))
-    return ns_get_color (SDATA (color), col);
+    return ns_get_color (SSDATA (color), col);
   else if (SYMBOLP (color))
-    return ns_get_color (SDATA (SYMBOL_NAME (color)), col);
+    return ns_get_color (SSDATA (SYMBOL_NAME (color)), col);
   return 1;
 }
 
@@ -1801,7 +1759,6 @@ ns_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window,
 {
   id view;
   NSPoint position;
-  int xchar, ychar;
   Lisp_Object frame, tail;
   struct frame *f;
   struct ns_display_info *dpyinfo;
@@ -1895,7 +1852,7 @@ ns_frame_up_to_date (struct frame *f)
 }
 
 
-void
+static void
 ns_define_frame_cursor (struct frame *f, Cursor cursor)
 /* --------------------------------------------------------------------------
     External (RIF): set frame mouse pointer type.
@@ -2020,7 +1977,7 @@ ns_clear_frame (struct frame *f)
 }
 
 
-void
+static void
 ns_clear_frame_area (struct frame *f, int x, int y, int width, int height)
 /* --------------------------------------------------------------------------
     External (RIF):  Clear section of frame
@@ -2149,7 +2106,7 @@ ns_after_update_window_line (struct glyph_row *desired_row)
   NSTRACE (ns_after_update_window_line);
 
   /* begin copy from other terms */
-  xassert (w);
+  eassert (w);
 
   if (!desired_row->mode_line_p && !w->pseudo_window_p)
     desired_row->redraw_fringe_bitmaps_p = 1;
@@ -2223,8 +2180,7 @@ ns_compute_glyph_string_overhangs (struct glyph_string *s)
      External (RIF); compute left/right overhang of whole string and set in s
    -------------------------------------------------------------------------- */
 {
-  struct face *face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
-  struct font *font = s->font; /*face->font; */
+  struct font *font = s->font;
 
   if (s->char2b)
     {
@@ -2284,17 +2240,9 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
   /* grow bimgs if needed */
   if (nBimgs < max_used_fringe_bitmap)
     {
-      EmacsImage **newBimgs
-       = xmalloc (max_used_fringe_bitmap * sizeof (EmacsImage *));
-      memset (newBimgs, 0, max_used_fringe_bitmap * sizeof (EmacsImage *));
-
-      if (nBimgs)
-        {
-          memcpy (newBimgs, bimgs, nBimgs * sizeof (EmacsImage *));
-          xfree (bimgs);
-        }
-
-      bimgs = newBimgs;
+      bimgs = xrealloc (bimgs, max_used_fringe_bitmap * sizeof *bimgs);
+      memset (bimgs + nBimgs, 0,
+             (max_used_fringe_bitmap - nBimgs) * sizeof *bimgs);
       nBimgs = max_used_fringe_bitmap;
     }
 
@@ -2349,7 +2297,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
 }
 
 
-void
+static void
 ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
                        int x, int y, int cursor_type, int cursor_width,
                        int on_p, int active_p)
@@ -2598,6 +2546,60 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr)
   return n;
 }
 
+/* --------------------------------------------------------------------
+   Draw a wavy line under glyph string s. The wave fills wave_height
+   pixels from y.
+
+                    x          wave_length = 3
+                                 --
+                y    *   *   *   *   *
+                     |* * * * * * * * *
+    wave_height = 3  | *   *   *   *
+  --------------------------------------------------------------------- */
+
+static void
+ns_draw_underwave (struct glyph_string *s, CGFloat width, CGFloat x)
+{
+  int wave_height = 3, wave_length = 3;
+  int y, dx, dy, odd, xmax;
+  NSPoint a, b;
+  NSRect waveClip;
+
+  dx = wave_length;
+  dy = wave_height - 1;
+  y =  s->ybase + 1;
+  xmax = x + width;
+
+  /* Find and set clipping rectangle */
+  waveClip = NSMakeRect (x, y, width, wave_height);
+  [[NSGraphicsContext currentContext] saveGraphicsState];
+  NSRectClip (waveClip);
+
+  /* Draw the waves */
+  a.x = x - ((int)(x) % dx);
+  b.x = a.x + dx;
+  odd = (int)(a.x/dx) % 2;
+  a.y = b.y = y;
+
+  if (odd)
+    a.y += dy;
+  else
+    b.y += dy;
+
+  while (a.x <= xmax)
+    {
+      [NSBezierPath strokeLineFromPoint:a toPoint:b];
+      a.x = b.x, a.y = b.y;
+      b.x += dx, b.y = y + odd*dy;
+      odd = !odd;
+    }
+
+  /* Restore previous clipping rectangle(s) */
+  [[NSGraphicsContext currentContext] restoreGraphicsState];
+}
+
+
+
 void
 ns_draw_text_decoration (struct glyph_string *s, struct face *face,
                          NSColor *defaultCol, CGFloat width, CGFloat x)
@@ -2611,63 +2613,75 @@ ns_draw_text_decoration (struct glyph_string *s, struct face *face,
   /* Do underline. */
   if (face->underline_p)
     {
-      NSRect r;
-      unsigned long thickness, position;
-
-      /* If the prev was underlined, match its appearance. */
-      if (s->prev && s->prev->face->underline_p
-          && s->prev->underline_thickness > 0)
+      if (s->face->underline_type == FACE_UNDER_WAVE)
         {
-          thickness = s->prev->underline_thickness;
-          position = s->prev->underline_position;
+          if (face->underline_defaulted_p)
+            [defaultCol set];
+          else
+            [ns_lookup_indexed_color (face->underline_color, s->f) set];
+
+          ns_draw_underwave (s, width, x);
         }
-      else
+      else if (s->face->underline_type == FACE_UNDER_LINE)
         {
-          struct font *font;
-          unsigned long descent;
-
-          font=s->font;
-          descent = s->y + s->height - s->ybase;
-
-          /* Use underline thickness of font, defaulting to 1. */
-          thickness = (font && font->underline_thickness > 0)
-            ? font->underline_thickness : 1;
-
-          /* Determine the offset of underlining from the baseline. */
-          if (x_underline_at_descent_line)
-            position = descent - thickness;
-          else if (x_use_underline_position_properties
-                   && font && font->underline_position >= 0)
-            position = font->underline_position;
-          else if (font)
-            position = lround (font->descent / 2);
-          else
-            position = underline_minimum_offset;
 
-          position = max (position, underline_minimum_offset);
+          NSRect r;
+          unsigned long thickness, position;
 
-          /* Ensure underlining is not cropped. */
-          if (descent <= position)
+          /* If the prev was underlined, match its appearance. */
+          if (s->prev && s->prev->face->underline_p
+              && s->prev->underline_thickness > 0)
             {
-              position = descent - 1;
-              thickness = 1;
+              thickness = s->prev->underline_thickness;
+              position = s->prev->underline_position;
             }
-          else if (descent < position + thickness)
-            thickness = 1;
-        }
+          else
+            {
+              struct font *font;
+              unsigned long descent;
+
+              font=s->font;
+              descent = s->y + s->height - s->ybase;
+
+              /* Use underline thickness of font, defaulting to 1. */
+              thickness = (font && font->underline_thickness > 0)
+                ? font->underline_thickness : 1;
+
+              /* Determine the offset of underlining from the baseline. */
+              if (x_underline_at_descent_line)
+                position = descent - thickness;
+              else if (x_use_underline_position_properties
+                       && font && font->underline_position >= 0)
+                position = font->underline_position;
+              else if (font)
+                position = lround (font->descent / 2);
+              else
+                position = underline_minimum_offset;
 
-      s->underline_thickness = thickness;
-      s->underline_position = position;
+              position = max (position, underline_minimum_offset);
 
-      r = NSMakeRect (x, s->ybase + position, width, thickness);
+              /* Ensure underlining is not cropped. */
+              if (descent <= position)
+                {
+                  position = descent - 1;
+                  thickness = 1;
+                }
+              else if (descent < position + thickness)
+                thickness = 1;
+            }
 
-      if (face->underline_defaulted_p)
-        [defaultCol set];
-      else
-        [ns_lookup_indexed_color (face->underline_color, s->f) set];
-      NSRectFill (r);
-    }
+          s->underline_thickness = thickness;
+          s->underline_position = position;
+
+          r = NSMakeRect (x, s->ybase + position, width, thickness);
 
+          if (face->underline_defaulted_p)
+            [defaultCol set];
+          else
+            [ns_lookup_indexed_color (face->underline_color, s->f) set];
+          NSRectFill (r);
+        }
+    }
   /* Do overline. We follow other terms in using a thickness of 1
      and ignoring overline_margin. */
   if (face->overline_p)
@@ -3474,7 +3488,7 @@ ns_read_socket (struct terminal *terminal, int expected,
 
 int
 ns_select (int nfds, fd_set *readfds, fd_set *writefds,
-           fd_set *exceptfds, struct timeval *timeout)
+           fd_set *exceptfds, EMACS_TIME *timeout, sigset_t *sigmask)
 /* --------------------------------------------------------------------------
      Replacement for select, checking for events
    -------------------------------------------------------------------------- */
@@ -3482,12 +3496,14 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
   int result;
   double time;
   NSEvent *ev;
+  struct timespec select_timeout;
+
 /*  NSTRACE (ns_select); */
 
   if (NSApp == nil || inNsSelect == 1 /* || ([NSApp isActive] == NO &&
                       [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:nil
  inMode:NSDefaultRunLoopMode dequeue:NO] == nil) */)
-    return select (nfds, readfds, writefds, exceptfds, timeout);
+    return pselect (nfds, readfds, writefds, exceptfds, timeout, sigmask);
 
   /* Save file descriptor set, which gets overwritten in calls to select ()
      Note, this is called from process.c, and only readfds is ever set */
@@ -3500,8 +3516,9 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
     select_nfds = 0;
 
     /* Try an initial select for pending data on input files */
-  select_timeout.tv_sec = select_timeout.tv_usec = 0;
-  result = select (nfds, readfds, writefds, exceptfds, &select_timeout);
+  select_timeout.tv_sec = select_timeout.tv_nsec = 0;
+  result = pselect (nfds, readfds, writefds, exceptfds,
+                   &select_timeout, sigmask);
   if (result)
     return result;
 
@@ -3510,7 +3527,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
 
     /* set a timeout and run the main AppKit event loop while continuing
        to monitor the files */
-  time = ((double) timeout->tv_sec) + ((double) timeout->tv_usec)/1000000.0;
+  time = EMACS_TIME_TO_DOUBLE (*timeout);
   timed_entry = [[NSTimer scheduledTimerWithTimeInterval: time
                                            target: NSApp
                                          selector: @selector (timeout_handler:)
@@ -3518,7 +3535,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
                                           repeats: YES] /* for safe removal */
                                                          retain];
 
-  /* set a periodic task to try the select () again */
+  /* set a periodic task to try the pselect () again */
   fd_entry = [[NSTimer scheduledTimerWithTimeInterval: 0.1
                                                target: NSApp
                                              selector: @selector (fd_handler:)
@@ -3560,7 +3577,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds,
         }
       else
         {
-          /* Received back from select () in fd_handler; copy the results */
+          /* Received back from pselect () in fd_handler; copy the results */
           if (readfds)
             memcpy (readfds, &select_readfds, sizeof (fd_set));
           return t;
@@ -3594,7 +3611,6 @@ ns_set_vertical_scroll_bar (struct window *window,
   BOOL barOnVeryLeft, barOnVeryRight;
   int top, left, height, width, sb_width, sb_left;
   EmacsScroller *bar;
-static int count = 0;
 
   /* optimization; display engine sends WAY too many of these.. */
   if (!NILP (window->vertical_scroll_bar))
@@ -3776,43 +3792,23 @@ static Lisp_Object ns_string_to_lispmod (const char *s)
      Convert modifier name to lisp symbol
    -------------------------------------------------------------------------- */
 {
-  if (!strncmp (SDATA (SYMBOL_NAME (Qmeta)), s, 10))
+  if (!strncmp (SSDATA (SYMBOL_NAME (Qmeta)), s, 10))
     return Qmeta;
-  else if (!strncmp (SDATA (SYMBOL_NAME (Qsuper)), s, 10))
+  else if (!strncmp (SSDATA (SYMBOL_NAME (Qsuper)), s, 10))
     return Qsuper;
-  else if (!strncmp (SDATA (SYMBOL_NAME (Qcontrol)), s, 10))
+  else if (!strncmp (SSDATA (SYMBOL_NAME (Qcontrol)), s, 10))
     return Qcontrol;
-  else if (!strncmp (SDATA (SYMBOL_NAME (Qalt)), s, 10))
+  else if (!strncmp (SSDATA (SYMBOL_NAME (Qalt)), s, 10))
     return Qalt;
-  else if (!strncmp (SDATA (SYMBOL_NAME (Qhyper)), s, 10))
+  else if (!strncmp (SSDATA (SYMBOL_NAME (Qhyper)), s, 10))
     return Qhyper;
-  else if (!strncmp (SDATA (SYMBOL_NAME (Qnone)), s, 10))
+  else if (!strncmp (SSDATA (SYMBOL_NAME (Qnone)), s, 10))
     return Qnone;
   else
     return Qnil;
 }
 
 
-static Lisp_Object ns_mod_to_lisp (int m)
-/* --------------------------------------------------------------------------
-     Convert modifier code (see lisp.h) to lisp symbol
-   -------------------------------------------------------------------------- */
-{
-  if (m == CHAR_META)
-    return Qmeta;
-  else if (m == CHAR_SUPER)
-    return Qsuper;
-  else if (m == CHAR_CTL)
-    return Qcontrol;
-  else if (m == CHAR_ALT)
-    return Qalt;
-  else if (m == CHAR_HYPER)
-    return Qhyper;
-  else /* if (m == 0) */
-    return Qnone;
-}
-
-
 static void
 ns_default (const char *parameter, Lisp_Object *result,
            Lisp_Object yesval, Lisp_Object noval,
@@ -3827,9 +3823,9 @@ ns_default (const char *parameter, Lisp_Object *result,
     {
       double f;
       char *pos;
-      if (strcasecmp (value, "YES") == 0)
+      if (c_strcasecmp (value, "YES") == 0)
         *result = yesval;
-      else if (strcasecmp (value, "NO") == 0)
+      else if (c_strcasecmp (value, "NO") == 0)
         *result = noval;
       else if (is_float && (f = strtod (value, &pos), pos != value))
         *result = make_float (f);
@@ -3841,7 +3837,7 @@ ns_default (const char *parameter, Lisp_Object *result,
 }
 
 
-void
+static void
 ns_initialize_display_info (struct ns_display_info *dpyinfo)
 /* --------------------------------------------------------------------------
       Initialize global info and storage for display.
@@ -3859,8 +3855,7 @@ ns_initialize_display_info (struct ns_display_info *dpyinfo)
                                                  NSColorSpaceFromDepth (depth)];
     dpyinfo->n_planes = NSBitsPerPixelFromDepth (depth);
     dpyinfo->image_cache = make_image_cache ();
-    dpyinfo->color_table
-      = (struct ns_color_table *)xmalloc (sizeof (struct ns_color_table));
+    dpyinfo->color_table = xmalloc (sizeof *dpyinfo->color_table);
     dpyinfo->color_table->colors = NULL;
     dpyinfo->root_window = 42; /* a placeholder.. */
 
@@ -3931,7 +3926,6 @@ static void
 ns_delete_terminal (struct terminal *terminal)
 {
   struct ns_display_info *dpyinfo = terminal->display_info.ns;
-  int i;
 
   /* Protect against recursive calls.  delete_frame in
      delete_terminal calls us back when it deletes our last frame.  */
@@ -4041,13 +4035,12 @@ ns_term_init (Lisp_Object display_name)
                                          selector: @selector (logNotification:)
                                              name: nil object: nil]; */
 
-  dpyinfo = (struct ns_display_info *)xmalloc (sizeof (struct ns_display_info));
-  memset (dpyinfo, 0, sizeof (struct ns_display_info));
+  dpyinfo = xzalloc (sizeof *dpyinfo);
 
   ns_initialize_display_info (dpyinfo);
   terminal = ns_create_terminal (dpyinfo);
 
-  terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+  terminal->kboard = xmalloc (sizeof *terminal->kboard);
   init_kboard (terminal->kboard);
   KVAR (terminal->kboard, Vwindow_system) = Qns;
   terminal->kboard->next_kboard = all_kboards;
@@ -4067,10 +4060,7 @@ ns_term_init (Lisp_Object display_name)
                                 ns_display_name_list);
   dpyinfo->name_list_element = XCAR (ns_display_name_list);
 
-  /* Set the name of the terminal. */
-  terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
-  strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
-  terminal->name[SBYTES (display_name)] = 0;
+  terminal->name = xstrdup (SSDATA (display_name));
 
   UNBLOCK_INPUT;
 
@@ -4096,7 +4086,6 @@ ns_term_init (Lisp_Object display_name)
     if ( cl == nil )
       {
         Lisp_Object color_file, color_map, color;
-        int r,g,b;
         unsigned long c;
         char *name;
 
@@ -4113,7 +4102,7 @@ ns_term_init (Lisp_Object display_name)
         for ( ; CONSP (color_map); color_map = XCDR (color_map))
           {
             color = XCAR (color_map);
-            name = SDATA (XCAR (color));
+            name = SSDATA (XCAR (color));
             c = XINT (XCDR (color));
             [cl setColor:
                   [NSColor colorWithCalibratedRed: RED_FROM_ULONG (c) / 255.0
@@ -4127,14 +4116,14 @@ ns_term_init (Lisp_Object display_name)
   }
 
   {
-    char c[128];
 #ifdef NS_IMPL_GNUSTEP
-    strncpy (c, gnustep_base_version, sizeof (c));
+    Vwindow_system_version = build_string (gnustep_base_version);
 #else
     /*PSnextrelease (128, c); */
-    snprintf (c, sizeof (c), "%g", NSAppKitVersionNumber);
+    char c[DBL_BUFSIZE_BOUND];
+    int len = dtoastr (c, sizeof c, 0, 0, NSAppKitVersionNumber);
+    Vwindow_system_version = make_unibyte_string (c, len);
 #endif
-    Vwindow_system_version = build_string (c);
   }
 
   delete_keyboard_wait_descriptor (0);
@@ -4225,7 +4214,7 @@ ns_term_shutdown (int sig)
 
   /* code not reached in emacs.c after this is called by shut_down_emacs: */
   if (STRINGP (Vauto_save_list_file_name))
-    unlink (SDATA (Vauto_save_list_file_name));
+    unlink (SSDATA (Vauto_save_list_file_name));
 
   if (sig == 0 || sig == SIGTERM)
     {
@@ -4540,6 +4529,7 @@ ns_term_shutdown (int sig)
    -------------------------------------------------------------------------- */
 {
   int result;
+  struct timespec select_timeout;
   /* NSTRACE (fd_handler); */
 
   if (select_nfds == 0)
@@ -4547,9 +4537,8 @@ ns_term_shutdown (int sig)
 
   memcpy (&t_readfds, &select_readfds, sizeof (fd_set));
 
-  select_timeout.tv_sec = select_timeout.tv_usec = 0;
-  result = select (select_nfds, &t_readfds, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
-                  &select_timeout);
+  select_timeout.tv_sec = select_timeout.tv_nsec = 0;
+  result = pselect (select_nfds, &t_readfds, NULL, NULL, &select_timeout, NULL);
   if (result)
     {
       memcpy (&select_readfds, &t_readfds, sizeof (fd_set));
@@ -4572,7 +4561,7 @@ ns_term_shutdown (int sig)
 {
   [ns_pending_service_names addObject: userData];
   [ns_pending_service_args addObject: [NSString stringWithUTF8String:
-      SDATA (ns_string_from_pasteboard (pboard))]];
+      SSDATA (ns_string_from_pasteboard (pboard))]];
 }
 
 
@@ -4636,8 +4625,8 @@ ns_term_shutdown (int sig)
   if (!emacs_event)
     return;
 
-  if (newFont = [sender convertFont:
-                           ((struct nsfont_info *)face->font)->nsfont])
+  if ((newFont = [sender convertFont:
+                           ((struct nsfont_info *)face->font)->nsfont]))
     {
       SET_FRAME_GARBAGED (emacsframe); /* now needed as of 2008/10 */
 
@@ -4731,8 +4720,13 @@ ns_term_shutdown (int sig)
 
   if (!processingCompose)
     {
+      /* When using screen sharing, no left or right information is sent,
+         so use Left key in those cases.  */
+      int is_left_key, is_right_key;
+
       code = ([[theEvent charactersIgnoringModifiers] length] == 0) ?
         0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0];
+
       /* (Carbon way: [theEvent keyCode]) */
 
       /* is it a "function key"? */
@@ -4757,13 +4751,17 @@ ns_term_shutdown (int sig)
       if (flags & NSShiftKeyMask)
         emacs_event->modifiers |= shift_modifier;
 
-      if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask)
+      is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask;
+      is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask
+        || (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask);
+      
+      if (is_right_key)
         emacs_event->modifiers |= parse_solitary_modifier
           (EQ (ns_right_command_modifier, Qleft)
            ? ns_command_modifier
            : ns_right_command_modifier);
 
-      if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask)
+      if (is_left_key)
         {
           emacs_event->modifiers |= parse_solitary_modifier
             (ns_command_modifier);
@@ -4800,13 +4798,17 @@ ns_term_shutdown (int sig)
             }
         }
 
-      if ((flags & NSRightControlKeyMask) == NSRightControlKeyMask)
+      is_right_key = (flags & NSRightControlKeyMask) == NSRightControlKeyMask;
+      is_left_key = (flags & NSLeftControlKeyMask) == NSLeftControlKeyMask
+        || (! is_right_key && (flags & NSControlKeyMask) == NSControlKeyMask);
+
+      if (is_right_key)
           emacs_event->modifiers |= parse_solitary_modifier
               (EQ (ns_right_control_modifier, Qleft)
                ? ns_control_modifier
                : ns_right_control_modifier);
 
-      if ((flags & NSLeftControlKeyMask) == NSLeftControlKeyMask)
+      if (is_left_key)
         emacs_event->modifiers |= parse_solitary_modifier
           (ns_control_modifier);
 
@@ -4817,7 +4819,13 @@ ns_term_shutdown (int sig)
       left_is_none = NILP (ns_alternate_modifier)
         || EQ (ns_alternate_modifier, Qnone);
 
-      if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask)
+      is_right_key = (flags & NSRightAlternateKeyMask)
+        == NSRightAlternateKeyMask;
+      is_left_key = (flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask
+        || (! is_right_key
+            && (flags & NSAlternateKeyMask) == NSAlternateKeyMask);
+
+      if (is_right_key)
         {
           if ((NILP (ns_right_alternate_modifier)
                || EQ (ns_right_alternate_modifier, Qnone)
@@ -4837,7 +4845,7 @@ ns_term_shutdown (int sig)
                : ns_right_alternate_modifier);
         }
 
-      if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask) /* default = meta */
+      if (is_left_key) /* default = meta */
         {
           if (left_is_none && !fnKeysym)
             {   /* accept pre-interp alt comb */
@@ -5113,7 +5121,6 @@ ns_term_shutdown (int sig)
 - (void)mouseDown: (NSEvent *)theEvent
 {
   NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
-  Lisp_Object window;
 
   NSTRACE (mouseDown);
 
@@ -5325,8 +5332,7 @@ ns_term_shutdown (int sig)
             char *pos = strstr (t, "  —  ");
             if (pos)
               *pos = '\0';
-            old_title = (char *) xmalloc (strlen (t) + 1);
-            strcpy (old_title, t);
+            old_title = xstrdup (t);
           }
         size_title = xmalloc (strlen (old_title) + 40);
        esprintf (size_title, "%s  —  (%d x %d)", old_title, cols, rows);
@@ -5344,9 +5350,9 @@ ns_term_shutdown (int sig)
 
 - (void)windowDidResize: (NSNotification *)notification
 {
+#ifdef NS_IMPL_GNUSTEP
   NSWindow *theWindow = [notification object];
 
-#ifdef NS_IMPL_GNUSTEP
    /* in GNUstep, at least currently, it's possible to get a didResize
       without getting a willResize.. therefore we need to act as if we got
       the willResize now */
@@ -5466,7 +5472,6 @@ ns_term_shutdown (int sig)
   Lisp_Object tem;
   NSWindow *win;
   NSButton *toggleButton;
-  int vbextra = NS_SCROLL_BAR_WIDTH (f);
   NSSize sz;
   NSColor *col;
   NSString *name;
@@ -5519,7 +5524,7 @@ ns_term_shutdown (int sig)
 
   tem = f->name;
   name = [NSString stringWithUTF8String:
-                   NILP (tem) ? (unsigned char *)"Emacs" : SDATA (tem)];
+                   NILP (tem) ? "Emacs" : SSDATA (tem)];
   [win setTitle: name];
 
   /* toolbar support */
@@ -5538,7 +5543,7 @@ ns_term_shutdown (int sig)
   tem = f->icon_name;
   if (!NILP (tem))
     [win setMiniwindowTitle:
-           [NSString stringWithUTF8String: SDATA (tem)]];
+           [NSString stringWithUTF8String: SSDATA (tem)]];
 
   {
     NSScreen *screen = [win screen];
@@ -5683,18 +5688,13 @@ ns_term_shutdown (int sig)
 
 - (void)mouseEntered: (NSEvent *)theEvent
 {
-  NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
-  struct ns_display_info *dpyinfo = FRAME_NS_DISPLAY_INFO (emacsframe);
   NSTRACE (mouseEntered);
-
   last_mouse_movement_time = EV_TIMESTAMP (theEvent);
 }
 
 
 - (void)mouseExited: (NSEvent *)theEvent
 {
-  NSPoint p = [self convertPoint: [theEvent locationInWindow] fromView: nil];
-  NSRect r;
   Mouse_HLInfo *hlinfo = emacsframe ? MOUSE_HL_INFO (emacsframe) : NULL;
 
   NSTRACE (mouseExited);
@@ -5717,10 +5717,14 @@ ns_term_shutdown (int sig)
   NSTRACE (menuDown);
   if (context_menu_value == -1)
     context_menu_value = [sender tag];
-  else
-    find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used,
-                                  emacsframe->menu_bar_vector,
-                                  (void *)[sender tag]);
+  else 
+    {
+      NSInteger tag = [sender tag];
+      find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used,
+                                    emacsframe->menu_bar_vector,
+                                    (void *)tag);
+    }
+
   ns_send_appdefined (-1);
   return self;
 }
@@ -6046,7 +6050,7 @@ ns_term_shutdown (int sig)
 
   if (nr_screens == 1)
     return [super constrainFrameRect:frameRect toScreen:screen];
-  
+
   if (f->output_data.ns->dont_constrain
       || ns_menu_bar_should_be_hidden ())
     return frameRect;
index 40e0fb6b8558e30ad62ebabd2a73748b8574d151..b650b1265b1d203167ce257e08a6ea802035af88 100644 (file)
@@ -23,8 +23,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <stdio.h>
 #include <setjmp.h>
 #include "lisp.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "keyboard.h"
 #include "frame.h"
@@ -55,10 +55,10 @@ static Lisp_Object Qfloat_output_format;
 #endif
 
 /* Avoid actual stack overflow in print.  */
-static int print_depth;
+static ptrdiff_t print_depth;
 
 /* Level of nesting inside outputting backquote in new style.  */
-static int new_backquote_output;
+static ptrdiff_t new_backquote_output;
 
 /* Detect most circularities to print finite output.  */
 #define PRINT_CIRCLE 200
@@ -69,11 +69,11 @@ static Lisp_Object being_printed[PRINT_CIRCLE];
 static char *print_buffer;
 
 /* Size allocated in print_buffer.  */
-static EMACS_INT print_buffer_size;
+static ptrdiff_t print_buffer_size;
 /* Chars stored in print_buffer.  */
-static EMACS_INT print_buffer_pos;
+static ptrdiff_t print_buffer_pos;
 /* Bytes stored in print_buffer.  */
-static EMACS_INT print_buffer_pos_byte;
+static ptrdiff_t print_buffer_pos_byte;
 
 Lisp_Object Qprint_escape_newlines;
 static Lisp_Object Qprint_escape_multibyte, Qprint_escape_nonascii;
@@ -86,27 +86,27 @@ static Lisp_Object Qprint_escape_multibyte, Qprint_escape_nonascii;
      N    the object has been printed so we can refer to it as #N#.
    print_number_index holds the largest N already used.
    N has to be striclty larger than 0 since we need to distinguish -N.  */
-static int print_number_index;
+static ptrdiff_t print_number_index;
 static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
 
 /* GDB resets this to zero on W32 to disable OutputDebugString calls.  */
 int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
 
 \f
-/* Low level output routines for characters and strings */
+/* Low level output routines for characters and strings */
 
 /* Lisp functions to do output using a stream
    must have the stream in a variable called printcharfun
    and must start with PRINTPREPARE, end with PRINTFINISH,
    and use PRINTDECLARE to declare common variables.
    Use PRINTCHAR to output one character,
-   or call strout to output a block of characters. */
+   or call strout to output a block of characters.  */
 
 #define PRINTDECLARE                                                   \
    struct buffer *old = current_buffer;                                        \
-   EMACS_INT old_point = -1, start_point = -1;                         \
-   EMACS_INT old_point_byte = -1, start_point_byte = -1;               \
-   int specpdl_count = SPECPDL_INDEX ();                               \
+   ptrdiff_t old_point = -1, start_point = -1;                         \
+   ptrdiff_t old_point_byte = -1, start_point_byte = -1;               \
+   ptrdiff_t specpdl_count = SPECPDL_INDEX ();                         \
    int free_print_buffer = 0;                                          \
    int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \
    Lisp_Object original
@@ -122,7 +122,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
      }                                                                 \
    if (MARKERP (printcharfun))                                         \
      {                                                                 \
-       EMACS_INT marker_pos;                                           \
+       ptrdiff_t marker_pos;                                           \
        if (! XMARKER (printcharfun)->buffer)                           \
          error ("Marker does not point anywhere");                     \
        if (XMARKER (printcharfun)->buffer != current_buffer)           \
@@ -156,8 +156,8 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
         }                                                              \
        else                                                            \
         {                                                              \
-          ptrdiff_t new_size = 1000;                                   \
-          print_buffer = (char *) xmalloc (new_size);                  \
+          int new_size = 1000;                                         \
+          print_buffer = xmalloc (new_size);                           \
           print_buffer_size = new_size;                                \
           free_print_buffer = 1;                                       \
         }                                                              \
@@ -173,8 +173,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
        if (print_buffer_pos != print_buffer_pos_byte                   \
           && NILP (BVAR (current_buffer, enable_multibyte_characters)))        \
         {                                                              \
-          unsigned char *temp                                          \
-            = (unsigned char *) alloca (print_buffer_pos + 1);         \
+          unsigned char *temp = alloca (print_buffer_pos + 1);         \
           copy_text ((unsigned char *) print_buffer, temp,             \
                      print_buffer_pos_byte, 1, 0);                     \
           insert_1_both ((char *) temp, print_buffer_pos,              \
@@ -233,15 +232,10 @@ printchar (unsigned int ch, Lisp_Object fun)
 
       if (NILP (fun))
        {
-         if (print_buffer_size - len <= print_buffer_pos_byte)
-           {
-             ptrdiff_t new_size;
-             if (STRING_BYTES_BOUND / 2 < print_buffer_size)
-               string_overflow ();
-             new_size = print_buffer_size * 2;
-             print_buffer = (char *) xrealloc (print_buffer, new_size);
-             print_buffer_size = new_size;
-           }
+         ptrdiff_t incr = len - (print_buffer_size - print_buffer_pos_byte);
+         if (0 < incr)
+           print_buffer =
+             xpalloc (print_buffer, &print_buffer_size, incr, -1, 1);
          memcpy (print_buffer + print_buffer_pos_byte, str, len);
          print_buffer_pos += 1;
          print_buffer_pos_byte += len;
@@ -276,7 +270,7 @@ printchar (unsigned int ch, Lisp_Object fun)
    to data in a Lisp string.  Otherwise that is not safe.  */
 
 static void
-strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
+strout (const char *ptr, ptrdiff_t size, ptrdiff_t size_byte,
        Lisp_Object printcharfun)
 {
   if (size < 0)
@@ -284,15 +278,9 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
 
   if (NILP (printcharfun))
     {
-      if (print_buffer_size - size_byte < print_buffer_pos_byte)
-       {
-         ptrdiff_t new_size;
-         if (STRING_BYTES_BOUND / 2 - size_byte < print_buffer_size)
-           string_overflow ();
-         new_size = print_buffer_size * 2 + size_byte;
-         print_buffer = (char *) xrealloc (print_buffer, new_size);
-         print_buffer_size = new_size;
-       }
+      ptrdiff_t incr = size_byte - (print_buffer_size - print_buffer_pos_byte);
+      if (0 < incr)
+       print_buffer = xpalloc (print_buffer, &print_buffer_size, incr, -1, 1);
       memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte);
       print_buffer_pos += size;
       print_buffer_pos_byte += size_byte;
@@ -333,7 +321,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte,
   else
     {
       /* PRINTCHARFUN is a Lisp function.  */
-      EMACS_INT i = 0;
+      ptrdiff_t i = 0;
 
       if (size == size_byte)
        {
@@ -369,7 +357,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
 {
   if (EQ (printcharfun, Qt) || NILP (printcharfun))
     {
-      EMACS_INT chars;
+      ptrdiff_t chars;
 
       if (print_escape_nonascii)
        string = string_escape_byte8 (string);
@@ -385,7 +373,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
             convert STRING to a multibyte string containing the same
             character codes.  */
          Lisp_Object newstr;
-         EMACS_INT bytes;
+         ptrdiff_t bytes;
 
          chars = SBYTES (string);
          bytes = count_size_as_multibyte (SDATA (string), chars);
@@ -403,7 +391,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
       if (EQ (printcharfun, Qt))
        {
          /* Output to echo area.  */
-         EMACS_INT nbytes = SBYTES (string);
+         ptrdiff_t nbytes = SBYTES (string);
          char *buffer;
 
          /* Copy the string contents so that relocation of STRING by
@@ -425,9 +413,9 @@ print_string (Lisp_Object string, Lisp_Object printcharfun)
     {
       /* Otherwise, string may be relocated by printing one char.
         So re-fetch the string address for each character.  */
-      EMACS_INT i;
-      EMACS_INT size = SCHARS (string);
-      EMACS_INT size_byte = SBYTES (string);
+      ptrdiff_t i;
+      ptrdiff_t size = SCHARS (string);
+      ptrdiff_t size_byte = SBYTES (string);
       struct gcpro gcpro1;
       GCPRO1 (string);
       if (size == size_byte)
@@ -498,7 +486,7 @@ write_string_1 (const char *data, int size, Lisp_Object printcharfun)
 void
 temp_output_buffer_setup (const char *bufname)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   register struct buffer *old = current_buffer;
   register Lisp_Object buf;
 
@@ -602,7 +590,7 @@ A printed representation of an object is text which describes that object.  */)
   Lisp_Object printcharfun;
   /* struct gcpro gcpro1, gcpro2; */
   Lisp_Object save_deactivate_mark;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct buffer *previous;
 
   specbind (Qinhibit_modification_hooks, Qt);
@@ -728,7 +716,7 @@ to make it write to the debugging output.  */)
   (Lisp_Object character)
 {
   CHECK_NUMBER (character);
-  putc ((int) XINT (character), stderr);
+  putc (XINT (character) & 0xFF, stderr);
 
 #ifdef WINDOWSNT
   /* Send the output to a debugger (nothing happens if there isn't one).  */
@@ -865,7 +853,6 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
 {
   Lisp_Object errname, errmsg, file_error, tail;
   struct gcpro gcpro1;
-  int i;
 
   if (context != 0)
     write_string_1 (context, -1, stream);
@@ -875,10 +862,13 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
   if (!NILP (caller) && SYMBOLP (caller))
     {
       Lisp_Object cname = SYMBOL_NAME (caller);
-      char *name = alloca (SBYTES (cname));
+      char *name;
+      USE_SAFE_ALLOCA;
+      SAFE_ALLOCA (name, char *, SBYTES (cname));
       memcpy (name, SDATA (cname), SBYTES (cname));
       message_dolog (name, SBYTES (cname), 0, 0);
       message_dolog (": ", 2, 0, 0);
+      SAFE_FREE ();
     }
 
   errname = Fcar (data);
@@ -893,9 +883,8 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
     }
   else
     {
-      Lisp_Object error_conditions;
+      Lisp_Object error_conditions = Fget (errname, Qerror_conditions);
       errmsg = Fget (errname, Qerror_message);
-      error_conditions = Fget (errname, Qerror_conditions);
       file_error = Fmemq (Qfile_error, error_conditions);
     }
 
@@ -909,22 +898,30 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
   if (!NILP (file_error) && CONSP (tail))
     errmsg = XCAR (tail), tail = XCDR (tail);
 
-  if (STRINGP (errmsg))
-    Fprinc (errmsg, stream);
-  else
-    write_string_1 ("peculiar error", -1, stream);
+  {
+    const char *sep = ": ";
 
-  for (i = 0; CONSP (tail); tail = XCDR (tail), i = 1)
-    {
-      Lisp_Object obj;
+    if (!STRINGP (errmsg))
+      write_string_1 ("peculiar error", -1, stream);
+    else if (SCHARS (errmsg))
+      Fprinc (errmsg, stream);
+    else
+      sep = NULL;
 
-      write_string_1 (i ? ", " : ": ", 2, stream);
-      obj = XCAR (tail);
-      if (!NILP (file_error) || EQ (errname, Qend_of_file))
-       Fprinc (obj, stream);
-      else
-       Fprin1 (obj, stream);
-    }
+    for (; CONSP (tail); tail = XCDR (tail), sep = ", ")
+      {
+       Lisp_Object obj;
+
+       if (sep)
+         write_string_1 (sep, 2, stream);
+       obj = XCAR (tail);
+       if (!NILP (file_error)
+           || EQ (errname, Qend_of_file) || EQ (errname, Quser_error))
+         Fprinc (obj, stream);
+       else
+         Fprin1 (obj, stream);
+      }
+  }
 
   UNGCPRO;
 }
@@ -946,43 +943,49 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context,
  * Given the above, the buffer must be least FLOAT_TO_STRING_BUFSIZE bytes.
  */
 
-void
+int
 float_to_string (char *buf, double data)
 {
   char *cp;
   int width;
+  int len;
 
   /* Check for plus infinity in a way that won't lose
      if there is no plus infinity.  */
   if (data == data / 2 && data > 1.0)
     {
-      strcpy (buf, "1.0e+INF");
-      return;
+      static char const infinity_string[] = "1.0e+INF";
+      strcpy (buf, infinity_string);
+      return sizeof infinity_string - 1;
     }
   /* Likewise for minus infinity.  */
   if (data == data / 2 && data < -1.0)
     {
-      strcpy (buf, "-1.0e+INF");
-      return;
+      static char const minus_infinity_string[] = "-1.0e+INF";
+      strcpy (buf, minus_infinity_string);
+      return sizeof minus_infinity_string - 1;
     }
   /* Check for NaN in a way that won't fail if there are no NaNs.  */
   if (! (data * 0.0 >= 0.0))
     {
       /* Prepend "-" if the NaN's sign bit is negative.
         The sign bit of a double is the bit that is 1 in -0.0.  */
+      static char const NaN_string[] = "0.0e+NaN";
       int i;
       union { double d; char c[sizeof (double)]; } u_data, u_minus_zero;
+      int negative = 0;
       u_data.d = data;
       u_minus_zero.d = - 0.0;
       for (i = 0; i < sizeof (double); i++)
        if (u_data.c[i] & u_minus_zero.c[i])
          {
-           *buf++ = '-';
+           *buf = '-';
+           negative = 1;
            break;
          }
 
-      strcpy (buf, "0.0e+NaN");
-      return;
+      strcpy (buf + negative, NaN_string);
+      return negative + sizeof NaN_string - 1;
     }
 
   if (NILP (Vfloat_output_format)
@@ -991,7 +994,7 @@ float_to_string (char *buf, double data)
     {
       /* Generate the fewest number of digits that represent the
         floating point value without losing information.  */
-      dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data);
+      len = dtoastr (buf, FLOAT_TO_STRING_BUFSIZE - 2, 0, 0, data);
       /* The decimal point must be printed, or the byte compiler can
         get confused (Bug#8033). */
       width = 1;
@@ -1034,7 +1037,7 @@ float_to_string (char *buf, double data)
       if (cp[1] != 0)
        goto lose;
 
-      sprintf (buf, SSDATA (Vfloat_output_format), data);
+      len = sprintf (buf, SSDATA (Vfloat_output_format), data);
     }
 
   /* Make sure there is a decimal point with digit after, or an
@@ -1051,14 +1054,18 @@ float_to_string (char *buf, double data)
        {
          cp[1] = '0';
          cp[2] = 0;
+         len++;
        }
       else if (*cp == 0)
        {
          *cp++ = '.';
          *cp++ = '0';
          *cp++ = 0;
+         len += 2;
        }
     }
+
+  return len;
 }
 
 \f
@@ -1088,11 +1095,9 @@ print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag)
 
       if (HASH_TABLE_P (Vprint_number_table))
        { /* Remove unnecessary objects, which appear only once in OBJ;
-            that is, whose status is Qt.
-            Maybe a better way to do that is to copy elements to
-            a new hash table.  */
+            that is, whose status is Qt.  */
          struct Lisp_Hash_Table *h = XHASH_TABLE (Vprint_number_table);
-         EMACS_INT i;
+         ptrdiff_t i;
 
          for (i = 0; i < HASH_TABLE_SIZE (h); ++i)
            if (!NILP (HASH_HASH (h, i))
@@ -1126,19 +1131,19 @@ static void
 print_preprocess (Lisp_Object obj)
 {
   int i;
-  EMACS_INT size;
+  ptrdiff_t size;
   int loop_count = 0;
   Lisp_Object halftail;
 
-  /* Give up if we go so deep that print_object will get an error.  */
-  /* See similar code in print_object.  */
-  if (print_depth >= PRINT_CIRCLE)
-    error ("Apparently circular structure being printed");
-
   /* Avoid infinite recursion for circular nested structure
      in the case where Vprint_circle is nil.  */
   if (NILP (Vprint_circle))
     {
+      /* Give up if we go so deep that print_object will get an error.  */
+      /* See similar code in print_object.  */
+      if (print_depth >= PRINT_CIRCLE)
+       error ("Apparently circular structure being printed");
+
       for (i = 0; i < print_depth; i++)
        if (EQ (obj, being_printed[i]))
          return;
@@ -1212,7 +1217,7 @@ print_preprocess (Lisp_Object obj)
          if (size & PSEUDOVECTOR_FLAG)
            size &= PSEUDOVECTOR_SIZE_MASK;
          for (i = 0; i < size; i++)
-           print_preprocess (XVECTOR (obj)->contents[i]);
+           print_preprocess (AREF (obj, i));
          if (HASH_TABLE_P (obj))
            { /* For hash tables, the key_and_value slot is past
                 `size' because it needs to be marked specially in case
@@ -1240,7 +1245,7 @@ static void print_check_string_charset_prop (INTERVAL interval, Lisp_Object stri
 #define PRINT_STRING_NON_CHARSET_FOUND 1
 #define PRINT_STRING_UNSAFE_CHARSET_FOUND 2
 
-/* Bitwise or of the above macros. */
+/* Bitwise or of the above macros.  */
 static int print_check_string_result;
 
 static void
@@ -1269,8 +1274,8 @@ print_check_string_charset_prop (INTERVAL interval, Lisp_Object string)
       || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND))
     {
       int i, c;
-      EMACS_INT charpos = interval->position;
-      EMACS_INT bytepos = string_char_to_byte (string, charpos);
+      ptrdiff_t charpos = interval->position;
+      ptrdiff_t bytepos = string_char_to_byte (string, charpos);
       Lisp_Object charset;
 
       charset = XCAR (XCDR (val));
@@ -1323,48 +1328,46 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
 
   QUIT;
 
-  /* See similar code in print_preprocess.  */
-  if (print_depth >= PRINT_CIRCLE)
-    error ("Apparently circular structure being printed");
-
   /* Detect circularities and truncate them.  */
-  if (PRINT_CIRCLE_CANDIDATE_P (obj))
+  if (NILP (Vprint_circle))
     {
-      if (NILP (Vprint_circle) && NILP (Vprint_gensym))
-       {
-         /* Simple but incomplete way.  */
-         int i;
-         for (i = 0; i < print_depth; i++)
-           if (EQ (obj, being_printed[i]))
-             {
-               sprintf (buf, "#%d", i);
-               strout (buf, -1, -1, printcharfun);
-               return;
-             }
-         being_printed[print_depth] = obj;
-       }
-      else
+      /* Simple but incomplete way.  */
+      int i;
+
+      /* See similar code in print_preprocess.  */
+      if (print_depth >= PRINT_CIRCLE)
+       error ("Apparently circular structure being printed");
+
+      for (i = 0; i < print_depth; i++)
+       if (EQ (obj, being_printed[i]))
+         {
+           int len = sprintf (buf, "#%d", i);
+           strout (buf, len, len, printcharfun);
+           return;
+         }
+      being_printed[print_depth] = obj;
+    }
+  else if (PRINT_CIRCLE_CANDIDATE_P (obj))
+    {
+      /* With the print-circle feature.  */
+      Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
+      if (INTEGERP (num))
        {
-         /* With the print-circle feature.  */
-         Lisp_Object num = Fgethash (obj, Vprint_number_table, Qnil);
-         if (INTEGERP (num))
+         EMACS_INT n = XINT (num);
+         if (n < 0)
+           { /* Add a prefix #n= if OBJ has not yet been printed;
+                that is, its status field is nil.  */
+             int len = sprintf (buf, "#%"pI"d=", -n);
+             strout (buf, len, len, printcharfun);
+             /* OBJ is going to be printed.  Remember that fact.  */
+             Fputhash (obj, make_number (- n), Vprint_number_table);
+           }
+         else
            {
-             EMACS_INT n = XINT (num);
-             if (n < 0)
-               { /* Add a prefix #n= if OBJ has not yet been printed;
-                    that is, its status field is nil.  */
-                 sprintf (buf, "#%"pI"d=", -n);
-                 strout (buf, -1, -1, printcharfun);
-                 /* OBJ is going to be printed.  Remember that fact.  */
-                 Fputhash (obj, make_number (- n), Vprint_number_table);
-               }
-             else
-               {
-                 /* Just print #n# if OBJ has already been printed.  */
-                 sprintf (buf, "#%"pI"d#", n);
-                 strout (buf, -1, -1, printcharfun);
-                 return;
-               }
+             /* Just print #n# if OBJ has already been printed.  */
+             int len = sprintf (buf, "#%"pI"d#", n);
+             strout (buf, len, len, printcharfun);
+             return;
            }
        }
     }
@@ -1374,16 +1377,17 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
   switch (XTYPE (obj))
     {
     case_Lisp_Int:
-      sprintf (buf, "%"pI"d", XINT (obj));
-      strout (buf, -1, -1, printcharfun);
+      {
+       int len = sprintf (buf, "%"pI"d", XINT (obj));
+       strout (buf, len, len, printcharfun);
+      }
       break;
 
     case Lisp_Float:
       {
        char pigbuf[FLOAT_TO_STRING_BUFSIZE];
-
-       float_to_string (pigbuf, XFLOAT_DATA (obj));
-       strout (pigbuf, -1, -1, printcharfun);
+       int len = float_to_string (pigbuf, XFLOAT_DATA (obj));
+       strout (pigbuf, len, len, printcharfun);
       }
       break;
 
@@ -1392,10 +1396,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
        print_string (obj, printcharfun);
       else
        {
-         register EMACS_INT i_byte;
+         register ptrdiff_t i_byte;
          struct gcpro gcpro1;
          unsigned char *str;
-         EMACS_INT size_byte;
+         ptrdiff_t size_byte;
          /* 1 means we must ensure that the next character we output
             cannot be taken as part of a hex character escape.  */
          int need_nonhex = 0;
@@ -1453,15 +1457,16 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
                     when found in a multibyte string, always use a hex escape
                     so it reads back as multibyte.  */
                  char outbuf[50];
+                 int len;
 
                  if (CHAR_BYTE8_P (c))
-                   sprintf (outbuf, "\\%03o", CHAR_TO_BYTE8 (c));
+                   len = sprintf (outbuf, "\\%03o", CHAR_TO_BYTE8 (c));
                  else
                    {
-                     sprintf (outbuf, "\\x%04x", c);
+                     len = sprintf (outbuf, "\\x%04x", c);
                      need_nonhex = 1;
                    }
-                 strout (outbuf, -1, -1, printcharfun);
+                 strout (outbuf, len, len, printcharfun);
                }
              else if (! multibyte
                       && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c)
@@ -1472,8 +1477,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
                     print single-byte non-ASCII string chars
                     using octal escapes.  */
                  char outbuf[5];
-                 sprintf (outbuf, "\\%03o", c);
-                 strout (outbuf, -1, -1, printcharfun);
+                 int len = sprintf (outbuf, "\\%03o", c);
+                 strout (outbuf, len, len, printcharfun);
                }
              else
                {
@@ -1513,8 +1518,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
        register unsigned char *p = SDATA (SYMBOL_NAME (obj));
        register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj));
        register int c;
-       int i, i_byte;
-       EMACS_INT size_byte;
+       ptrdiff_t i, i_byte;
+       ptrdiff_t size_byte;
        Lisp_Object name;
 
        name = SYMBOL_NAME (obj);
@@ -1638,8 +1643,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
                    /* Simple but incomplete way.  */
                    if (i != 0 && EQ (obj, halftail))
                      {
-                       sprintf (buf, " . #%"pMd, i / 2);
-                       strout (buf, -1, -1, printcharfun);
+                       int len = sprintf (buf, " . #%"pMd, i / 2);
+                       strout (buf, len, len, printcharfun);
                        goto end_of_list;
                      }
                  }
@@ -1703,9 +1708,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
       else if (BOOL_VECTOR_P (obj))
        {
          ptrdiff_t i;
-         register unsigned char c;
+         int len;
+         unsigned char c;
          struct gcpro gcpro1;
-         EMACS_INT size_in_chars
+         ptrdiff_t size_in_chars
            = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1)
               / BOOL_VECTOR_BITS_PER_CHAR);
 
@@ -1713,8 +1719,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
 
          PRINTCHAR ('#');
          PRINTCHAR ('&');
-         sprintf (buf, "%"pI"d", XBOOL_VECTOR (obj)->size);
-         strout (buf, -1, -1, printcharfun);
+         len = sprintf (buf, "%"pI"d", XBOOL_VECTOR (obj)->size);
+         strout (buf, len, len, printcharfun);
          PRINTCHAR ('\"');
 
          /* Don't print more characters than the specified maximum.
@@ -1765,9 +1771,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
        }
       else if (WINDOWP (obj))
        {
+         int len;
          strout ("#<window ", -1, -1, printcharfun);
-         sprintf (buf, "%"pI"d", XFASTINT (XWINDOW (obj)->sequence_number));
-         strout (buf, -1, -1, printcharfun);
+         len = sprintf (buf, "%d", XWINDOW (obj)->sequence_number);
+         strout (buf, len, len, printcharfun);
          if (!NILP (XWINDOW (obj)->buffer))
            {
              strout (" on ", -1, -1, printcharfun);
@@ -1777,10 +1784,11 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
        }
       else if (TERMINALP (obj))
        {
+         int len;
          struct terminal *t = XTERMINAL (obj);
          strout ("#<terminal ", -1, -1, printcharfun);
-         sprintf (buf, "%d", t->id);
-         strout (buf, -1, -1, printcharfun);
+         len = sprintf (buf, "%d", t->id);
+         strout (buf, len, len, printcharfun);
          if (t->name)
            {
              strout (" on ", -1, -1, printcharfun);
@@ -1791,8 +1799,9 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
       else if (HASH_TABLE_P (obj))
        {
          struct Lisp_Hash_Table *h = XHASH_TABLE (obj);
-         int i;
-         EMACS_INT real_size, size;
+         ptrdiff_t i;
+         ptrdiff_t real_size, size;
+         int len;
 #if 0
          strout ("#<hash-table", -1, -1, printcharfun);
          if (SYMBOLP (h->test))
@@ -1803,18 +1812,18 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
              PRINTCHAR (' ');
              strout (SDATA (SYMBOL_NAME (h->weak)), -1, -1, printcharfun);
              PRINTCHAR (' ');
-             sprintf (buf, "%"pI"d/%"pI"d", h->count, ASIZE (h->next));
-             strout (buf, -1, -1, printcharfun);
+             len = sprintf (buf, "%"pD"d/%"pD"d", h->count, ASIZE (h->next));
+             strout (buf, len, len, printcharfun);
            }
-         sprintf (buf, " %p", h);
-         strout (buf, -1, -1, printcharfun);
+         len = sprintf (buf, " %p", h);
+         strout (buf, len, len, printcharfun);
          PRINTCHAR ('>');
 #endif
          /* Implement a readable output, e.g.:
            #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
          /* Always print the size. */
-         sprintf (buf, "#s(hash-table size %"pI"d", ASIZE (h->next));
-         strout (buf, -1, -1, printcharfun);
+         len = sprintf (buf, "#s(hash-table size %"pD"d", ASIZE (h->next));
+         strout (buf, len, len, printcharfun);
 
          if (!NILP (h->test))
            {
@@ -1887,17 +1896,18 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
        }
       else if (FRAMEP (obj))
        {
+         int len;
          strout ((FRAME_LIVE_P (XFRAME (obj))
                   ? "#<frame " : "#<dead frame "),
                  -1, -1, printcharfun);
          print_string (XFRAME (obj)->name, printcharfun);
-         sprintf (buf, " %p", XFRAME (obj));
-         strout (buf, -1, -1, printcharfun);
+         len = sprintf (buf, " %p", XFRAME (obj));
+         strout (buf, len, len, printcharfun);
          PRINTCHAR ('>');
        }
       else if (FONTP (obj))
        {
-         EMACS_INT i;
+         int i;
 
          if (! FONT_OBJECT_P (obj))
            {
@@ -1925,7 +1935,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
        }
       else
        {
-         EMACS_INT size = ASIZE (obj);
+         ptrdiff_t size = ASIZE (obj);
          if (COMPILEDP (obj))
            {
              PRINTCHAR ('#');
@@ -1956,7 +1966,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
          {
            register int i;
            register Lisp_Object tem;
-           EMACS_INT real_size = size;
+           ptrdiff_t real_size = size;
 
            /* Don't print more elements than the specified maximum.  */
            if (NATNUMP (Vprint_length)
@@ -1966,7 +1976,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
            for (i = 0; i < size; i++)
              {
                if (i) PRINTCHAR (' ');
-               tem = XVECTOR (obj)->contents[i];
+               tem = AREF (obj, i);
                print_object (tem, printcharfun, escapeflag);
              }
            if (size < real_size)
@@ -1988,8 +1998,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
            strout ("in no buffer", -1, -1, printcharfun);
          else
            {
-             sprintf (buf, "at %"pI"d", marker_position (obj));
-             strout (buf, -1, -1, printcharfun);
+             int len = sprintf (buf, "at %"pD"d", marker_position (obj));
+             strout (buf, len, len, printcharfun);
              strout (" in ", -1, -1, printcharfun);
              print_string (BVAR (XMARKER (obj)->buffer, name), printcharfun);
            }
@@ -2002,10 +2012,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
            strout ("in no buffer", -1, -1, printcharfun);
          else
            {
-             sprintf (buf, "from %"pI"d to %"pI"d in ",
-                      marker_position (OVERLAY_START (obj)),
-                      marker_position (OVERLAY_END   (obj)));
-             strout (buf, -1, -1, printcharfun);
+             int len = sprintf (buf, "from %"pD"d to %"pD"d in ",
+                                marker_position (OVERLAY_START (obj)),
+                                marker_position (OVERLAY_END   (obj)));
+             strout (buf, len, len, printcharfun);
              print_string (BVAR (XMARKER (OVERLAY_START (obj))->buffer, name),
                            printcharfun);
            }
@@ -2020,10 +2030,12 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
 
        case Lisp_Misc_Save_Value:
          strout ("#<save_value ", -1, -1, printcharfun);
-         sprintf (buf, "ptr=%p int=%"pD"d",
-                   XSAVE_VALUE (obj)->pointer,
-                   XSAVE_VALUE (obj)->integer);
-         strout (buf, -1, -1, printcharfun);
+         {
+           int len = sprintf (buf, "ptr=%p int=%"pD"d",
+                              XSAVE_VALUE (obj)->pointer,
+                              XSAVE_VALUE (obj)->integer);
+           strout (buf, len, len, printcharfun);
+         }
          PRINTCHAR ('>');
          break;
 
@@ -2035,16 +2047,17 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
     default:
     badtype:
       {
+       int len;
        /* We're in trouble if this happens!
           Probably should just abort () */
        strout ("#<EMACS BUG: INVALID DATATYPE ", -1, -1, printcharfun);
        if (MISCP (obj))
-         sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
+         len = sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
        else if (VECTORLIKEP (obj))
-         sprintf (buf, "(PVEC 0x%08"pI"x)", ASIZE (obj));
+         len = sprintf (buf, "(PVEC 0x%08"pD"x)", ASIZE (obj));
        else
-         sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
-       strout (buf, -1, -1, printcharfun);
+         len = sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
+       strout (buf, len, len, printcharfun);
        strout (" Save your buffers immediately and please report this bug>",
                -1, -1, printcharfun);
       }
@@ -2149,7 +2162,7 @@ shared once again when the text is read back.  */);
   Vprint_gensym = Qnil;
 
   DEFVAR_LISP ("print-circle", Vprint_circle,
-              doc: /* *Non-nil means print recursive structures using #N= and #N# syntax.
+              doc: /* Non-nil means print recursive structures using #N= and #N# syntax.
 If nil, printing proceeds recursively and may lead to
 `max-lisp-eval-depth' being exceeded or an error may occur:
 \"Apparently circular structure being printed.\"  Also see
@@ -2161,7 +2174,7 @@ where N is a positive decimal integer.  */);
   Vprint_circle = Qnil;
 
   DEFVAR_LISP ("print-continuous-numbering", Vprint_continuous_numbering,
-              doc: /* *Non-nil means number continuously across print calls.
+              doc: /* Non-nil means number continuously across print calls.
 This affects the numbers printed for #N= labels and #M# references.
 See also `print-circle', `print-gensym', and `print-number-table'.
 This variable should not be set with `setq'; bind it with a `let' instead.  */);
index f6f1ad0a6fb8a060b2c6481cef7f9fb6c25ee6ce..ceb5c81d32b7410f913e98b9fce374e4d3e6aeed 100644 (file)
@@ -93,8 +93,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "systty.h"
 
 #include "window.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "coding.h"
 #include "process.h"
 #include "frame.h"
@@ -120,6 +120,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "nsterm.h"
 #endif
 
+/* Work around GCC 4.7.0 bug with strict overflow checking; see
+   <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>.
+   These lines can be removed once the GCC bug is fixed.  */
+#if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wstrict-overflow"
+#endif
+
 Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname, Qtpgid;
 Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime, Qcstime;
 Lisp_Object Qcutime, Qpri, Qnice, Qthcount, Qstart, Qvsize, Qrss, Qargs;
@@ -175,9 +182,9 @@ extern int h_errno;
 #endif
 
 /* Number of events of change of status of a process.  */
-static int process_tick;
+static EMACS_INT process_tick;
 /* Number of events for which the user or sentinel has been notified.  */
-static int update_tick;
+static EMACS_INT update_tick;
 
 /* Define NON_BLOCKING_CONNECT if we can support non-blocking connects.  */
 
@@ -221,13 +228,11 @@ static int update_tick;
 #endif
 
 #if !defined (ADAPTIVE_READ_BUFFERING) && !defined (NO_ADAPTIVE_READ_BUFFERING)
-#ifdef EMACS_HAS_USECS
 #define ADAPTIVE_READ_BUFFERING
 #endif
-#endif
 
 #ifdef ADAPTIVE_READ_BUFFERING
-#define READ_OUTPUT_DELAY_INCREMENT 10000
+#define READ_OUTPUT_DELAY_INCREMENT (EMACS_TIME_RESOLUTION / 100)
 #define READ_OUTPUT_DELAY_MAX       (READ_OUTPUT_DELAY_INCREMENT * 5)
 #define READ_OUTPUT_DELAY_MAX_MAX   (READ_OUTPUT_DELAY_INCREMENT * 7)
 
@@ -244,7 +249,6 @@ static int process_output_skip;
 #define process_output_delay_count 0
 #endif
 
-static Lisp_Object Fget_process (Lisp_Object);
 static void create_process (Lisp_Object, char **, Lisp_Object);
 #ifdef SIGIO
 static int keyboard_bit_set (SELECT_TYPE *);
@@ -348,7 +352,7 @@ static struct fd_callback_data
 void
 add_read_fd (int fd, fd_callback func, void *data)
 {
-  xassert (fd < MAXDESC);
+  eassert (fd < MAXDESC);
   add_keyboard_wait_descriptor (fd);
 
   fd_callback_info[fd].func = func;
@@ -361,7 +365,7 @@ add_read_fd (int fd, fd_callback func, void *data)
 void
 delete_read_fd (int fd)
 {
-  xassert (fd < MAXDESC);
+  eassert (fd < MAXDESC);
   delete_keyboard_wait_descriptor (fd);
 
   fd_callback_info[fd].condition &= ~FOR_READ;
@@ -378,7 +382,7 @@ delete_read_fd (int fd)
 void
 add_write_fd (int fd, fd_callback func, void *data)
 {
-  xassert (fd < MAXDESC);
+  eassert (fd < MAXDESC);
   FD_SET (fd, &write_mask);
   if (fd > max_input_desc)
     max_input_desc = fd;
@@ -395,7 +399,7 @@ delete_write_fd (int fd)
 {
   int lim = max_input_desc;
 
-  xassert (fd < MAXDESC);
+  eassert (fd < MAXDESC);
   FD_CLR (fd, &write_mask);
   fd_callback_info[fd].condition &= ~FOR_WRITE;
   if (fd_callback_info[fd].condition == 0)
@@ -620,34 +624,18 @@ make_process (Lisp_Object name)
   printmax_t i;
 
   p = allocate_process ();
-
-  p->infd = -1;
-  p->outfd = -1;
-  p->tick = 0;
-  p->update_tick = 0;
-  p->pid = 0;
-  p->pty_flag = 0;
-  p->raw_status_new = 0;
+  /* Initialize Lisp data.  Note that allocate_process initializes all
+     Lisp data to nil, so do it only for slots which should not be nil.  */
   p->status = Qrun;
   p->mark = Fmake_marker ();
-  p->kill_without_query = 0;
 
-#ifdef ADAPTIVE_READ_BUFFERING
-  p->adaptive_read_buffering = 0;
-  p->read_output_delay = 0;
-  p->read_output_skip = 0;
-#endif
+  /* Initialize non-Lisp data.  Note that allocate_process zeroes out all
+     non-Lisp data, so do it only for slots which should not be zero.  */
+  p->infd = -1;
+  p->outfd = -1;
 
 #ifdef HAVE_GNUTLS
   p->gnutls_initstage = GNUTLS_STAGE_EMPTY;
-  /* Default log level.  */
-  p->gnutls_log_level = 0;
-  /* GnuTLS handshakes attempted for this connection.  */
-  p->gnutls_handshakes_tried = 0;
-  p->gnutls_p = 0;
-  p->gnutls_state = NULL;
-  p->gnutls_x509_cred = NULL;
-  p->gnutls_anon_cred = NULL;
 #endif
 
   /* If name is already in use, modify it until it is unused.  */
@@ -657,8 +645,7 @@ make_process (Lisp_Object name)
     {
       tem = Fget_process (name1);
       if (NILP (tem)) break;
-      sprintf (suffix, "<%"pMd">", i);
-      name1 = concat2 (name, build_string (suffix));
+      name1 = concat2 (name, make_formatted_string (suffix, "<%"pMd">", i));
     }
   name = name1;
   p->name = name;
@@ -767,9 +754,7 @@ nil, indicating the current buffer's process.  */)
     {
 #ifdef SIGCHLD
       Lisp_Object symbol;
-      /* Assignment to EMACS_INT stops GCC whining about limited range
-        of data type.  */
-      EMACS_INT pid = p->pid;
+      pid_t pid = p->pid;
 
       /* No problem storing the pid here, as it is still in Vprocess_alist.  */
       deleted_pid_list = Fcons (make_fixnum_or_float (pid),
@@ -866,9 +851,7 @@ This is the pid of the external process which PROCESS uses or talks to.
 For a network connection, this value is nil.  */)
   (register Lisp_Object process)
 {
-  /* Assignment to EMACS_INT stops GCC whining about limited range of
-     data type.  */
-  EMACS_INT pid;
+  pid_t pid;
 
   CHECK_PROCESS (process);
   pid = XPROCESS (process)->pid;
@@ -1043,8 +1026,8 @@ DEFUN ("set-process-window-size", Fset_process_window_size,
   (register Lisp_Object process, Lisp_Object height, Lisp_Object width)
 {
   CHECK_PROCESS (process);
-  CHECK_NATNUM (height);
-  CHECK_NATNUM (width);
+  CHECK_RANGED_INTEGER (height, 0, INT_MAX);
+  CHECK_RANGED_INTEGER (width, 0, INT_MAX);
 
   if (XPROCESS (process)->infd < 0
       || set_window_size (XPROCESS (process)->infd,
@@ -1104,10 +1087,6 @@ DEFUN ("process-query-on-exit-flag",
   return (XPROCESS (process)->kill_without_query ? Qnil : Qt);
 }
 
-#ifdef DATAGRAM_SOCKETS
-static Lisp_Object Fprocess_datagram_address (Lisp_Object);
-#endif
-
 DEFUN ("process-contact", Fprocess_contact, Sprocess_contact,
        1, 2, 0,
        doc: /* Return the contact info of PROCESS; t for a real child.
@@ -1207,7 +1186,7 @@ Returns nil if format of ADDRESS is invalid.  */)
   if (VECTORP (address))  /* AF_INET or AF_INET6 */
     {
       register struct Lisp_Vector *p = XVECTOR (address);
-      EMACS_INT size = p->header.size;
+      ptrdiff_t size = p->header.size;
       Lisp_Object args[10];
       int nargs, i;
 
@@ -1236,14 +1215,12 @@ Returns nil if format of ADDRESS is invalid.  */)
 
       for (i = 0; i < nargs; i++)
        {
-         EMACS_INT element = XINT (p->contents[i]);
-
-         if (element < 0 || element > 65535)
+         if (! RANGED_INTEGERP (0, p->contents[i], 65535))
            return Qnil;
 
          if (nargs <= 5         /* IPv4 */
              && i < 4           /* host, not port */
-             && element > 255)
+             && XINT (p->contents[i]) > 255)
            return Qnil;
 
          args[i+1] = p->contents[i];
@@ -1298,7 +1275,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
   Lisp_Object buffer, name, program, proc, current_dir, tem;
   register unsigned char **new_argv;
   ptrdiff_t i;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   buffer = args[1];
   if (!NILP (buffer))
@@ -1387,7 +1364,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
     val = Vcoding_system_for_read;
     if (NILP (val))
       {
-       args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
+       args2 = alloca ((nargs + 1) * sizeof *args2);
        args2[0] = Qstart_process;
        for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
        GCPRO2 (proc, current_dir);
@@ -1406,7 +1383,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
       {
        if (EQ (coding_systems, Qt))
          {
-           args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
+           args2 = alloca ((nargs + 1) * sizeof *args2);
            args2[0] = Qstart_process;
            for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
            GCPRO2 (proc, current_dir);
@@ -1500,7 +1477,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS)  */)
 
       /* Now that everything is encoded we can collect the strings into
         NEW_ARGV.  */
-      new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *));
+      new_argv = alloca ((nargs - 1) * sizeof *new_argv);
       new_argv[nargs - 2] = 0;
 
       for (i = nargs - 2; i-- != 0; )
@@ -1874,10 +1851,9 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
         So have an interrupt jar it loose.  */
       {
        struct atimer *timer;
-       EMACS_TIME offset;
+       EMACS_TIME offset = make_emacs_time (1, 0);
 
        stop_polling ();
-       EMACS_SET_SECS_USECS (offset, 1, 0);
        timer = start_atimer (ATIMER_RELATIVE, offset, create_process_1, 0);
 
        if (forkin >= 0)
@@ -2108,7 +2084,8 @@ get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp)
       return sizeof (struct sockaddr_un);
     }
 #endif
-  else if (CONSP (address) && INTEGERP (XCAR (address)) && VECTORP (XCDR (address)))
+  else if (CONSP (address) && TYPE_RANGED_INTEGERP (int, XCAR (address))
+          && VECTORP (XCDR (address)))
     {
       struct sockaddr *sa;
       *familyp = XINT (XCAR (address));
@@ -2131,6 +2108,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
   register struct Lisp_Vector *p;
   register unsigned char *cp = NULL;
   register int i;
+  EMACS_INT hostport;
 
   memset (sa, 0, len);
 
@@ -2141,8 +2119,8 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
        {
          struct sockaddr_in *sin = (struct sockaddr_in *) sa;
          len = sizeof (sin->sin_addr) + 1;
-         i = XINT (p->contents[--len]);
-         sin->sin_port = htons (i);
+         hostport = XINT (p->contents[--len]);
+         sin->sin_port = htons (hostport);
          cp = (unsigned char *)&sin->sin_addr;
          sa->sa_family = family;
        }
@@ -2152,8 +2130,8 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int
          struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
          uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr;
          len = sizeof (sin6->sin6_addr) + 1;
-         i = XINT (p->contents[--len]);
-         sin6->sin6_port = htons (i);
+         hostport = XINT (p->contents[--len]);
+         sin6->sin6_port = htons (hostport);
          for (i = 0; i < len; i++)
            if (INTEGERP (p->contents[i]))
              {
@@ -2308,7 +2286,7 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
     case SOPT_INT:
       {
        int optval;
-       if (INTEGERP (val))
+       if (TYPE_RANGED_INTEGERP (int, val))
          optval = XINT (val);
        else
          error ("Bad option value for %s", name);
@@ -2347,7 +2325,7 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val)
 
        linger.l_onoff = 1;
        linger.l_linger = 0;
-       if (INTEGERP (val))
+       if (TYPE_RANGED_INTEGERP (int, val))
          linger.l_linger = XINT (val);
        else
          linger.l_onoff = NILP (val) ? 0 : 1;
@@ -2586,7 +2564,7 @@ usage:  (make-serial-process &rest ARGS)  */)
   struct gcpro gcpro1;
   Lisp_Object name, buffer;
   Lisp_Object tem, val;
-  int specpdl_count = -1;
+  ptrdiff_t specpdl_count = -1;
 
   if (nargs == 0)
     return Qnil;
@@ -2886,8 +2864,8 @@ usage: (make-network-process &rest ARGS)  */)
   int xerrno = 0;
   int s = -1, outch, inch;
   struct gcpro gcpro1;
-  int count = SPECPDL_INDEX ();
-  int count1;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  ptrdiff_t count1;
   Lisp_Object QCaddress;  /* one of QClocal or QCremote */
   Lisp_Object tem;
   Lisp_Object name, buffer, host, service, address;
@@ -2934,7 +2912,7 @@ usage: (make-network-process &rest ARGS)  */)
       error ("Network servers not supported");
 #else
       is_server = 1;
-      if (INTEGERP (tem))
+      if (TYPE_RANGED_INTEGERP (int, tem))
        backlog = XINT (tem);
 #endif
     }
@@ -3000,7 +2978,7 @@ usage: (make-network-process &rest ARGS)  */)
 #endif
   else if (EQ (tem, Qipv4))
     family = AF_INET;
-  else if (INTEGERP (tem))
+  else if (TYPE_RANGED_INTEGERP (int, tem))
     family = XINT (tem);
   else
     error ("Unknown address family");
@@ -3034,7 +3012,9 @@ usage: (make-network-process &rest ARGS)  */)
       CHECK_STRING (service);
       memset (&address_un, 0, sizeof address_un);
       address_un.sun_family = AF_LOCAL;
-      strncpy (address_un.sun_path, SSDATA (service), sizeof address_un.sun_path);
+      if (sizeof address_un.sun_path <= SBYTES (service))
+       error ("Service name too long");
+      strcpy (address_un.sun_path, SSDATA (service));
       ai.ai_addr = (struct sockaddr *) &address_un;
       ai.ai_addrlen = sizeof address_un;
       goto open_socket;
@@ -3287,7 +3267,7 @@ usage: (make-network-process &rest ARGS)  */)
        {
          /* Unlike most other syscalls connect() cannot be called
             again.  (That would return EALREADY.)  The proper way to
-            wait for completion is select(). */
+            wait for completion is pselect(). */
          int sc;
          socklen_t len;
          SELECT_TYPE fdset;
@@ -3295,8 +3275,7 @@ usage: (make-network-process &rest ARGS)  */)
          FD_ZERO (&fdset);
          FD_SET (s, &fdset);
          QUIT;
-         sc = select (s + 1, (SELECT_TYPE *)0, &fdset, (SELECT_TYPE *)0,
-                      (EMACS_TIME *)0);
+         sc = pselect (s + 1, NULL, &fdset, NULL, NULL, NULL);
          if (sc == -1)
            {
              if (errno == EINTR)
@@ -3337,7 +3316,7 @@ usage: (make-network-process &rest ARGS)  */)
        {
          if (datagram_address[s].sa)
            abort ();
-         datagram_address[s].sa = (struct sockaddr *) xmalloc (lres->ai_addrlen);
+         datagram_address[s].sa = xmalloc (lres->ai_addrlen);
          datagram_address[s].len = lres->ai_addrlen;
          if (is_server)
            {
@@ -3739,8 +3718,9 @@ FLAGS is the current flags of the interface.  */)
 
   CHECK_STRING (ifname);
 
-  memset (rq.ifr_name, 0, sizeof rq.ifr_name);
-  strncpy (rq.ifr_name, SSDATA (ifname), sizeof (rq.ifr_name));
+  if (sizeof rq.ifr_name <= SBYTES (ifname))
+    error ("interface name too long");
+  strcpy (rq.ifr_name, SSDATA (ifname));
 
   s = socket (AF_INET, SOCK_STREAM, 0);
   if (s < 0)
@@ -3957,7 +3937,8 @@ If JUST-THIS-ONE is an integer, don't run any timers either.
 Return non-nil if we received any output before the timeout expired.  */)
   (register Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, Lisp_Object just_this_one)
 {
-  int secs, usecs = 0;
+  intmax_t secs;
+  int nsecs;
 
   if (! NILP (process))
     CHECK_PROCESS (process);
@@ -3976,27 +3957,36 @@ Return non-nil if we received any output before the timeout expired.  */)
        }
     }
 
+  secs = 0;
+  nsecs = -1;
+
   if (!NILP (seconds))
     {
       if (INTEGERP (seconds))
-       secs = XINT (seconds);
+       {
+         if (0 < XINT (seconds))
+           {
+             secs = XINT (seconds);
+             nsecs = 0;
+           }
+       }
       else if (FLOATP (seconds))
        {
-         double timeout = XFLOAT_DATA (seconds);
-         secs = (int) timeout;
-         usecs = (int) ((timeout - (double) secs) * 1000000);
+         if (0 < XFLOAT_DATA (seconds))
+           {
+             EMACS_TIME t = EMACS_TIME_FROM_DOUBLE (XFLOAT_DATA (seconds));
+             secs = min (EMACS_SECS (t), WAIT_READING_MAX);
+             nsecs = EMACS_NSECS (t);
+           }
        }
       else
        wrong_type_argument (Qnumberp, seconds);
-
-      if (secs < 0 || (secs == 0 && usecs == 0))
-       secs = -1, usecs = 0;
     }
-  else
-    secs = NILP (process) ? -1 : 0;
+  else if (! NILP (process))
+    nsecs = 0;
 
   return
-    (wait_reading_process_output (secs, usecs, 0, 0,
+    (wait_reading_process_output (secs, nsecs, 0, 0,
                                  Qnil,
                                  !NILP (process) ? XPROCESS (process) : NULL,
                                  NILP (just_this_one) ? 0 :
@@ -4237,36 +4227,21 @@ wait_reading_process_output_1 (void)
 {
 }
 
-/* Use a wrapper around select to work around a bug in gdb 5.3.
-   Normally, the wrapper is optimized away by inlining.
-
-   If emacs is stopped inside select, the gdb backtrace doesn't
-   show the function which called select, so it is practically
-   impossible to step through wait_reading_process_output.  */
-
-#ifndef select
-static inline int
-select_wrapper (int n, fd_set *rfd, fd_set *wfd, fd_set *xfd, struct timeval *tmo)
-{
-  return select (n, rfd, wfd, xfd, tmo);
-}
-#define select select_wrapper
-#endif
-
 /* Read and dispose of subprocess output while waiting for timeout to
    elapse and/or keyboard input to be available.
 
    TIME_LIMIT is:
-     timeout in seconds, or
-     zero for no limit, or
-     -1 means gobble data immediately available but don't wait for any.
+     timeout in seconds
+     If negative, gobble data immediately available but don't wait for any.
 
-   MICROSECS is:
-     an additional duration to wait, measured in microseconds.
-     If this is nonzero and time_limit is 0, then the timeout
-     consists of MICROSECS only.
+   NSECS is:
+     an additional duration to wait, measured in nanoseconds
+     If TIME_LIMIT is zero, then:
+       If NSECS == 0, there is no limit.
+       If NSECS > 0, the timeout consists of NSECS only.
+       If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative.
 
-   READ_KBD is a lisp value:
+   READ_KBD is:
      0 to ignore keyboard input, or
      1 to return when input is available, or
      -1 meaning caller will actually read the input, so don't throw to
@@ -4291,7 +4266,7 @@ select_wrapper (int n, fd_set *rfd, fd_set *wfd, fd_set *xfd, struct timeval *tm
    Otherwise, return true if we received input from any process.  */
 
 int
-wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
+wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
                             int do_display,
                             Lisp_Object wait_for_cell,
                             struct Lisp_Process *wait_proc, int just_wait_proc)
@@ -4306,12 +4281,12 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
   EMACS_TIME timeout, end_time;
   int wait_channel = -1;
   int got_some_input = 0;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   FD_ZERO (&Available);
   FD_ZERO (&Writeok);
 
-  if (time_limit == 0 && microsecs == 0 && wait_proc && !NILP (Vinhibit_quit)
+  if (time_limit == 0 && nsecs == 0 && wait_proc && !NILP (Vinhibit_quit)
       && !(CONSP (wait_proc->status) && EQ (XCAR (wait_proc->status), Qexit)))
     message ("Blocking call to accept-process-output with quit inhibited!!");
 
@@ -4323,13 +4298,20 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
                         make_number (waiting_for_user_input_p));
   waiting_for_user_input_p = read_kbd;
 
+  if (time_limit < 0)
+    {
+      time_limit = 0;
+      nsecs = -1;
+    }
+  else if (TYPE_MAXIMUM (time_t) < time_limit)
+    time_limit = TYPE_MAXIMUM (time_t);
+
   /* Since we may need to wait several times,
      compute the absolute time to return at.  */
-  if (time_limit || microsecs)
+  if (time_limit || 0 < nsecs)
     {
-      EMACS_GET_TIME (end_time);
-      EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
-      EMACS_ADD_TIME (end_time, end_time, timeout);
+      timeout = make_emacs_time (time_limit, nsecs);
+      end_time = add_emacs_time (current_emacs_time (), timeout);
     }
 
   while (1)
@@ -4352,24 +4334,24 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
 
       /* Compute time from now till when time limit is up */
       /* Exit if already run out */
-      if (time_limit == -1)
+      if (nsecs < 0)
        {
-         /* -1 specified for timeout means
+         /* A negative timeout means
             gobble output available now
             but don't wait at all. */
 
-         EMACS_SET_SECS_USECS (timeout, 0, 0);
+         timeout = make_emacs_time (0, 0);
        }
-      else if (time_limit || microsecs)
+      else if (time_limit || 0 < nsecs)
        {
-         EMACS_GET_TIME (timeout);
-         EMACS_SUB_TIME (timeout, end_time, timeout);
-         if (EMACS_TIME_NEG_P (timeout))
+         EMACS_TIME now = current_emacs_time ();
+         if (EMACS_TIME_LE (end_time, now))
            break;
+         timeout = sub_emacs_time (end_time, now);
        }
       else
        {
-         EMACS_SET_SECS_USECS (timeout, 100000, 0);
+         timeout = make_emacs_time (100000, 0);
        }
 
       /* Normally we run timers here.
@@ -4411,21 +4393,22 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
              && requeued_events_pending_p ())
            break;
 
-         if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1)
+         /* A negative timeout means do not wait at all.  */
+         if (0 <= nsecs)
            {
-             EMACS_TIME difference;
-             EMACS_SUB_TIME (difference, timer_delay, timeout);
-             if (EMACS_TIME_NEG_P (difference))
+             if (EMACS_TIME_VALID_P (timer_delay))
                {
-                 timeout = timer_delay;
-                 timeout_reduced_for_timers = 1;
+                 if (EMACS_TIME_LT (timer_delay, timeout))
+                   {
+                     timeout = timer_delay;
+                     timeout_reduced_for_timers = 1;
+                   }
+               }
+             else
+               {
+                 /* This is so a breakpoint can be put here.  */
+                 wait_reading_process_output_1 ();
                }
-           }
-         /* If time_limit is -1, we are not going to wait at all.  */
-         else if (time_limit != -1)
-           {
-             /* This is so a breakpoint can be put here.  */
-             wait_reading_process_output_1 ();
            }
        }
 
@@ -4453,15 +4436,15 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
             Atemp = input_wait_mask;
          Ctemp = write_mask;
 
-         EMACS_SET_SECS_USECS (timeout, 0, 0);
-         if ((select (max (max_process_desc, max_input_desc) + 1,
-                      &Atemp,
+         timeout = make_emacs_time (0, 0);
+         if ((pselect (max (max_process_desc, max_input_desc) + 1,
+                       &Atemp,
 #ifdef NON_BLOCKING_CONNECT
-                      (num_pending_connects > 0 ? &Ctemp : (SELECT_TYPE *)0),
+                       (num_pending_connects > 0 ? &Ctemp : NULL),
 #else
-                      (SELECT_TYPE *)0,
+                       NULL,
 #endif
-                      (SELECT_TYPE *)0, &timeout)
+                       NULL, &timeout, NULL)
               <= 0))
            {
              /* It's okay for us to do this and then continue with
@@ -4584,9 +4567,9 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
             Vprocess_adaptive_read_buffering is nil.  */
          if (process_output_skip && check_delay > 0)
            {
-             int usecs = EMACS_USECS (timeout);
-             if (EMACS_SECS (timeout) > 0 || usecs > READ_OUTPUT_DELAY_MAX)
-               usecs = READ_OUTPUT_DELAY_MAX;
+             int nsecs = EMACS_NSECS (timeout);
+             if (EMACS_SECS (timeout) > 0 || nsecs > READ_OUTPUT_DELAY_MAX)
+               nsecs = READ_OUTPUT_DELAY_MAX;
              for (channel = 0; check_delay > 0 && channel <= max_process_desc; channel++)
                {
                  proc = chan_process[channel];
@@ -4601,11 +4584,11 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
                        continue;
                      FD_CLR (channel, &Available);
                      XPROCESS (proc)->read_output_skip = 0;
-                     if (XPROCESS (proc)->read_output_delay < usecs)
-                       usecs = XPROCESS (proc)->read_output_delay;
+                     if (XPROCESS (proc)->read_output_delay < nsecs)
+                       nsecs = XPROCESS (proc)->read_output_delay;
                    }
                }
-             EMACS_SET_SECS_USECS (timeout, 0, usecs);
+             timeout = make_emacs_time (0, nsecs);
              process_output_skip = 0;
            }
 #endif
@@ -4614,12 +4597,12 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
 #elif defined (HAVE_NS)
          nfds = ns_select
 #else
-         nfds = select
+         nfds = pselect
 #endif
             (max (max_process_desc, max_input_desc) + 1,
              &Available,
              (check_write ? &Writeok : (SELECT_TYPE *)0),
-             (SELECT_TYPE *)0, &timeout);
+             NULL, &timeout, NULL);
 
 #ifdef HAVE_GNUTLS
           /* GnuTLS buffers data internally.  In lowat mode it leaves
@@ -4677,8 +4660,8 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
       /*  If we woke up due to SIGWINCH, actually change size now.  */
       do_pending_window_change (0);
 
-      if (time_limit && nfds == 0 && ! timeout_reduced_for_timers)
-       /* We wanted the full specified time, so return now.  */
+      if ((time_limit || nsecs) && nfds == 0 && ! timeout_reduced_for_timers)
+       /* We waited the full specified time, so return now.  */
        break;
       if (nfds < 0)
        {
@@ -4829,7 +4812,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
              if (wait_channel == channel)
                {
                  wait_channel = -1;
-                 time_limit = -1;
+                 nsecs = -1;
                  got_some_input = 1;
                }
              proc = chan_process[channel];
@@ -5047,14 +5030,14 @@ read_process_output (Lisp_Object proc, register int channel)
   char *chars;
   register Lisp_Object outstream;
   register struct Lisp_Process *p = XPROCESS (proc);
-  register EMACS_INT opoint;
+  register ptrdiff_t opoint;
   struct coding_system *coding = proc_decode_coding_system[channel];
   int carryover = p->decoding_carryover;
   int readmax = 4096;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object odeactivate;
 
-  chars = (char *) alloca (carryover + readmax);
+  chars = alloca (carryover + readmax);
   if (carryover)
     /* See the comment above.  */
     memcpy (chars, SDATA (p->decoding_buf), carryover);
@@ -5246,10 +5229,10 @@ read_process_output (Lisp_Object proc, register int channel)
   else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name)))
     {
       Lisp_Object old_read_only;
-      EMACS_INT old_begv, old_zv;
-      EMACS_INT old_begv_byte, old_zv_byte;
-      EMACS_INT before, before_byte;
-      EMACS_INT opoint_byte;
+      ptrdiff_t old_begv, old_zv;
+      ptrdiff_t old_begv_byte, old_zv_byte;
+      ptrdiff_t before, before_byte;
+      ptrdiff_t opoint_byte;
       Lisp_Object text;
       struct buffer *b;
 
@@ -5367,7 +5350,7 @@ static jmp_buf send_process_frame;
 static Lisp_Object process_sent_to;
 
 #ifndef FORWARD_SIGNAL_TO_MAIN_THREAD
-static void send_process_trap (int) NO_RETURN;
+static _Noreturn void send_process_trap (int);
 #endif
 
 static void
@@ -5378,6 +5361,78 @@ send_process_trap (int ignore)
   longjmp (send_process_frame, 1);
 }
 
+/* In send_process, when a write fails temporarily,
+   wait_reading_process_output is called.  It may execute user code,
+   e.g. timers, that attempts to write new data to the same process.
+   We must ensure that data is sent in the right order, and not
+   interspersed half-completed with other writes (Bug#10815).  This is
+   handled by the write_queue element of struct process.  It is a list
+   with each entry having the form
+
+   (string . (offset . length))
+
+   where STRING is a lisp string, OFFSET is the offset into the
+   string's byte sequence from which we should begin to send, and
+   LENGTH is the number of bytes left to send.  */
+
+/* Create a new entry in write_queue.
+   INPUT_OBJ should be a buffer, string Qt, or Qnil.
+   BUF is a pointer to the string sequence of the input_obj or a C
+   string in case of Qt or Qnil.  */
+
+static void
+write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
+                  const char *buf, ptrdiff_t len, int front)
+{
+  ptrdiff_t offset;
+  Lisp_Object entry, obj;
+
+  if (STRINGP (input_obj))
+    {
+      offset = buf - SSDATA (input_obj);
+      obj = input_obj;
+    }
+  else
+    {
+      offset = 0;
+      obj = make_unibyte_string (buf, len);
+    }
+
+  entry = Fcons (obj, Fcons (make_number (offset), make_number (len)));
+
+  if (front)
+    p->write_queue = Fcons (entry, p->write_queue);
+  else
+    p->write_queue = nconc2 (p->write_queue, Fcons (entry, Qnil));
+}
+
+/* Remove the first element in the write_queue of process P, put its
+   contents in OBJ, BUF and LEN, and return non-zero.  If the
+   write_queue is empty, return zero.  */
+
+static int
+write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
+                const char **buf, ptrdiff_t *len)
+{
+  Lisp_Object entry, offset_length;
+  ptrdiff_t offset;
+
+  if (NILP (p->write_queue))
+    return 0;
+
+  entry = XCAR (p->write_queue);
+  p->write_queue = XCDR (p->write_queue);
+
+  *obj = XCAR (entry);
+  offset_length = XCDR (entry);
+
+  *len = XINT (XCDR (offset_length));
+  offset = XINT (XCAR (offset_length));
+  *buf = SSDATA (*obj) + offset;
+
+  return 1;
+}
+
 /* Send some data to process PROC.
    BUF is the beginning of the data; LEN is the number of characters.
    OBJECT is the Lisp object that the data comes from.  If OBJECT is
@@ -5390,17 +5445,14 @@ send_process_trap (int ignore)
 
 static void
 send_process (volatile Lisp_Object proc, const char *volatile buf,
-             volatile EMACS_INT len, volatile Lisp_Object object)
+             volatile ptrdiff_t len, volatile Lisp_Object object)
 {
   /* Use volatile to protect variables from being clobbered by longjmp.  */
   struct Lisp_Process *p = XPROCESS (proc);
   ssize_t rv;
   struct coding_system *coding;
-  struct gcpro gcpro1;
   void (*volatile old_sigpipe) (int);
 
-  GCPRO1 (object);
-
   if (p->raw_status_new)
     update_status (p);
   if (! EQ (p->status, Qrun))
@@ -5461,8 +5513,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
       coding->dst_object = Qt;
       if (BUFFERP (object))
        {
-         EMACS_INT from_byte, from, to;
-         EMACS_INT save_pt, save_pt_byte;
+         ptrdiff_t from_byte, from, to;
+         ptrdiff_t save_pt, save_pt_byte;
          struct buffer *cur = current_buffer;
 
          set_buffer_internal (XBUFFER (object));
@@ -5512,22 +5564,37 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
   if (!setjmp (send_process_frame))
     {
       p = XPROCESS (proc);  /* Repair any setjmp clobbering.  */
-
       process_sent_to = proc;
-      while (len > 0)
+
+      /* If there is already data in the write_queue, put the new data
+         in the back of queue.  Otherwise, ignore it.  */
+      if (!NILP (p->write_queue))
+        write_queue_push (p, object, buf, len, 0);
+
+      do   /* while !NILP (p->write_queue) */
        {
-         EMACS_INT this = len;
+         ptrdiff_t cur_len = -1;
+         const char *cur_buf;
+         Lisp_Object cur_object;
 
-         /* Send this batch, using one or more write calls.  */
-         while (this > 0)
+         /* If write_queue is empty, ignore it.  */
+         if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len))
            {
-             EMACS_INT written = 0;
+             cur_len = len;
+             cur_buf = buf;
+             cur_object = object;
+           }
+
+         while (cur_len > 0)
+           {
+             /* Send this batch, using one or more write calls.  */
+             ptrdiff_t written = 0;
              int outfd = p->outfd;
              old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap);
 #ifdef DATAGRAM_SOCKETS
              if (DATAGRAM_CHAN_P (outfd))
                {
-                 rv = sendto (outfd, buf, this,
+                 rv = sendto (outfd, cur_buf, cur_len,
                               0, datagram_address[outfd].sa,
                               datagram_address[outfd].len);
                  if (0 <= rv)
@@ -5544,10 +5611,10 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
                {
 #ifdef HAVE_GNUTLS
                  if (p->gnutls_p)
-                   written = emacs_gnutls_write (p, buf, this);
+                   written = emacs_gnutls_write (p, cur_buf, cur_len);
                  else
 #endif
-                   written = emacs_write (outfd, buf, this);
+                   written = emacs_write (outfd, cur_buf, cur_len);
                  rv = (written ? 0 : -1);
 #ifdef ADAPTIVE_READ_BUFFERING
                  if (p->read_output_delay > 0
@@ -5575,8 +5642,6 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
                       that may allow the program
                       to finish doing output and read more.  */
                    {
-                     EMACS_INT offset = 0;
-
 #ifdef BROKEN_PTY_READ_AFTER_EAGAIN
                      /* A gross hack to work around a bug in FreeBSD.
                         In the following sequence, read(2) returns
@@ -5602,35 +5667,22 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
                        }
 #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */
 
-                     /* Running filters might relocate buffers or strings.
-                        Arrange to relocate BUF.  */
-                     if (BUFFERP (object))
-                       offset = BUF_PTR_BYTE_POS (XBUFFER (object),
-                                                  (unsigned char *) buf);
-                     else if (STRINGP (object))
-                       offset = buf - SSDATA (object);
-
-#ifdef EMACS_HAS_USECS
-                     wait_reading_process_output (0, 20000, 0, 0, Qnil, NULL, 0);
-#else
-                     wait_reading_process_output (1, 0, 0, 0, Qnil, NULL, 0);
-#endif
-
-                     if (BUFFERP (object))
-                       buf = (char *) BUF_BYTE_ADDRESS (XBUFFER (object),
-                                                        offset);
-                     else if (STRINGP (object))
-                       buf = offset + SSDATA (object);
+                     /* Put what we should have written in wait_queue.  */
+                     write_queue_push (p, cur_object, cur_buf, cur_len, 1);
+                     wait_reading_process_output (0, 20 * 1000 * 1000,
+                                                  0, 0, Qnil, NULL, 0);
+                     /* Reread queue, to see what is left.  */
+                     break;
                    }
                  else
                    /* This is a real error.  */
                    report_file_error ("writing to process", Fcons (proc, Qnil));
                }
-             buf += written;
-             len -= written;
-             this -= written;
+             cur_buf += written;
+             cur_len -= written;
            }
        }
+      while (!NILP (p->write_queue));
     }
   else
     {
@@ -5643,8 +5695,6 @@ send_process (volatile Lisp_Object proc, const char *volatile buf,
       deactivate_process (proc);
       error ("SIGPIPE raised on process %s; closed it", SDATA (p->name));
     }
-
-  UNGCPRO;
 }
 
 DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region,
@@ -5659,7 +5709,7 @@ Output from processes can arrive in between bunches.  */)
   (Lisp_Object process, Lisp_Object start, Lisp_Object end)
 {
   Lisp_Object proc;
-  EMACS_INT start1, end1;
+  ptrdiff_t start1, end1;
 
   proc = get_process (process);
   validate_region (&start, &end);
@@ -5695,10 +5745,10 @@ Output from processes can arrive in between bunches.  */)
 \f
 /* Return the foreground process group for the tty/pty that
    the process P uses.  */
-static int
+static pid_t
 emacs_get_tty_pgrp (struct Lisp_Process *p)
 {
-  int gid = -1;
+  pid_t gid = -1;
 
 #ifdef TIOCGPGRP
   if (ioctl (p->infd, TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
@@ -5728,7 +5778,7 @@ return t unconditionally.  */)
 {
   /* Initialize in case ioctl doesn't exist or gives an error,
      in a way that will cause returning t.  */
-  int gid;
+  pid_t gid;
   Lisp_Object proc;
   struct Lisp_Process *p;
 
@@ -5769,7 +5819,7 @@ process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
 {
   Lisp_Object proc;
   register struct Lisp_Process *p;
-  int gid;
+  pid_t gid;
   int no_pgrp = 0;
 
   proc = get_process (process);
@@ -6023,48 +6073,40 @@ SIGCODE may be an integer, or a symbol whose name is a signal name.  */)
 {
   pid_t pid;
 
-  if (INTEGERP (process))
-    {
-      pid = XINT (process);
-      goto got_it;
-    }
-
-  if (FLOATP (process))
-    {
-      pid = (pid_t) XFLOAT_DATA (process);
-      goto got_it;
-    }
-
   if (STRINGP (process))
     {
-      Lisp_Object tem;
-      if (tem = Fget_process (process), NILP (tem))
+      Lisp_Object tem = Fget_process (process);
+      if (NILP (tem))
        {
-         pid = XINT (Fstring_to_number (process, make_number (10)));
-         if (pid > 0)
-           goto got_it;
+         Lisp_Object process_number =
+           string_to_number (SSDATA (process), 10, 1);
+         if (INTEGERP (process_number) || FLOATP (process_number))
+           tem = process_number;
        }
       process = tem;
     }
-  else
+  else if (!NUMBERP (process))
     process = get_process (process);
 
   if (NILP (process))
     return process;
 
-  CHECK_PROCESS (process);
-  pid = XPROCESS (process)->pid;
-  if (pid <= 0)
-    error ("Cannot signal process %s", SDATA (XPROCESS (process)->name));
-
- got_it:
+  if (NUMBERP (process))
+    CONS_TO_INTEGER (process, pid_t, pid);
+  else
+    {
+      CHECK_PROCESS (process);
+      pid = XPROCESS (process)->pid;
+      if (pid <= 0)
+       error ("Cannot signal process %s", SDATA (XPROCESS (process)->name));
+    }
 
 #define parse_signal(NAME, VALUE)              \
   else if (!xstrcasecmp (name, NAME))          \
     XSETINT (sigcode, VALUE)
 
   if (INTEGERP (sigcode))
-    ;
+    CHECK_TYPE_RANGED_INTEGER (int, sigcode);
   else
     {
       char *name;
@@ -6244,7 +6286,7 @@ process has been transmitted to the serial port.  */)
 
       if (!proc_encode_coding_system[new_outfd])
        proc_encode_coding_system[new_outfd]
-         = (struct coding_system *) xmalloc (sizeof (struct coding_system));
+         = xmalloc (sizeof (struct coding_system));
       memcpy (proc_encode_coding_system[new_outfd],
              proc_encode_coding_system[old_outfd],
              sizeof (struct coding_system));
@@ -6327,8 +6369,8 @@ sigchld_handler (int signo)
       for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail))
        {
          Lisp_Object xpid = XCAR (tail);
-         if ((INTEGERP (xpid) && pid == (pid_t) XINT (xpid))
-             || (FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid)))
+         if ((INTEGERP (xpid) && pid == XINT (xpid))
+             || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid)))
            {
              XSETCAR (tail, Qnil);
              goto sigchld_end_of_loop;
@@ -6382,7 +6424,7 @@ sigchld_handler (int signo)
          /* Tell wait_reading_process_output that it needs to wake up and
             look around.  */
          if (input_available_clear_time)
-           EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
+           *input_available_clear_time = make_emacs_time (0, 0);
        }
 
       /* There was no asynchronous process found for that pid: we have
@@ -6400,7 +6442,7 @@ sigchld_handler (int signo)
          /* Tell wait_reading_process_output that it needs to wake up and
             look around.  */
          if (input_available_clear_time)
-           EMACS_SET_SECS_USECS (*input_available_clear_time, 0, 0);
+           *input_available_clear_time = make_emacs_time (0, 0);
        }
 
     sigchld_end_of_loop:
@@ -6444,7 +6486,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
 {
   Lisp_Object sentinel, odeactivate;
   register struct Lisp_Process *p = XPROCESS (proc);
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   int outer_running_asynch_code = running_asynch_code;
   int waiting = waiting_for_user_input_p;
 
@@ -6603,8 +6645,8 @@ status_notify (struct Lisp_Process *deleting_process)
            {
              Lisp_Object tem;
              struct buffer *old = current_buffer;
-             EMACS_INT opoint, opoint_byte;
-             EMACS_INT before, before_byte;
+             ptrdiff_t opoint, opoint_byte;
+             ptrdiff_t before, before_byte;
 
              /* Avoid error if buffer is deleted
                 (probably that's why the process is dead, too) */
@@ -6761,19 +6803,25 @@ keyboard_bit_set (fd_set *mask)
 
 /* Defined on msdos.c.  */
 extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
-                      EMACS_TIME *);
+                      EMACS_TIME *, void *);
 
 /* Implementation of wait_reading_process_output, assuming that there
    are no subprocesses.  Used only by the MS-DOS build.
 
    Wait for timeout to elapse and/or keyboard input to be available.
 
-   time_limit is:
-     timeout in seconds, or
-     zero for no limit, or
-     -1 means gobble data immediately available but don't wait for any.
+   TIME_LIMIT is:
+     timeout in seconds
+     If negative, gobble data immediately available but don't wait for any.
+
+   NSECS is:
+     an additional duration to wait, measured in nanoseconds
+     If TIME_LIMIT is zero, then:
+       If NSECS == 0, there is no limit.
+       If NSECS > 0, the timeout consists of NSECS only.
+       If NSECS < 0, gobble data immediately, as if TIME_LIMIT were negative.
 
-   read_kbd is a Lisp_Object:
+   READ_KBD is:
      0 to ignore keyboard input, or
      1 to return when input is available, or
      -1 means caller will actually read the input, so don't throw to
@@ -6782,28 +6830,33 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
    see full version for other parameters. We know that wait_proc will
      always be NULL, since `subprocesses' isn't defined.
 
-   do_display != 0 means redisplay should be done to show subprocess
+   DO_DISPLAY != 0 means redisplay should be done to show subprocess
    output that arrives.
 
    Return true if we received input from any process.  */
 
 int
-wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
+wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
                             int do_display,
                             Lisp_Object wait_for_cell,
                             struct Lisp_Process *wait_proc, int just_wait_proc)
 {
   register int nfds;
   EMACS_TIME end_time, timeout;
-  SELECT_TYPE waitchannels;
-  int xerrno;
+
+  if (time_limit < 0)
+    {
+      time_limit = 0;
+      nsecs = -1;
+    }
+  else if (TYPE_MAXIMUM (time_t) < time_limit)
+    time_limit = TYPE_MAXIMUM (time_t);
 
   /* What does time_limit really mean?  */
-  if (time_limit || microsecs)
+  if (time_limit || 0 < nsecs)
     {
-      EMACS_GET_TIME (end_time);
-      EMACS_SET_SECS_USECS (timeout, time_limit, microsecs);
-      EMACS_ADD_TIME (end_time, end_time, timeout);
+      timeout = make_emacs_time (time_limit, nsecs);
+      end_time = add_emacs_time (current_emacs_time (), timeout);
     }
 
   /* Turn off periodic alarms (in case they are in use)
@@ -6815,6 +6868,8 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
   while (1)
     {
       int timeout_reduced_for_timers = 0;
+      SELECT_TYPE waitchannels;
+      int xerrno;
 
       /* If calling from keyboard input, do not quit
         since we want to return C-g as an input character.
@@ -6828,24 +6883,24 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
 
       /* Compute time from now till when time limit is up */
       /* Exit if already run out */
-      if (time_limit == -1)
+      if (nsecs < 0)
        {
-         /* -1 specified for timeout means
+         /* A negative timeout means
             gobble output available now
             but don't wait at all. */
 
-         EMACS_SET_SECS_USECS (timeout, 0, 0);
+         timeout = make_emacs_time (0, 0);
        }
-      else if (time_limit || microsecs)
+      else if (time_limit || 0 < nsecs)
        {
-         EMACS_GET_TIME (timeout);
-         EMACS_SUB_TIME (timeout, end_time, timeout);
-         if (EMACS_TIME_NEG_P (timeout))
+         EMACS_TIME now = current_emacs_time ();
+         if (EMACS_TIME_LE (end_time, now))
            break;
+         timeout = sub_emacs_time (end_time, now);
        }
       else
        {
-         EMACS_SET_SECS_USECS (timeout, 100000, 0);
+         timeout = make_emacs_time (100000, 0);
        }
 
       /* If our caller will not immediately handle keyboard events,
@@ -6874,11 +6929,9 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
              && requeued_events_pending_p ())
            break;
 
-         if (! EMACS_TIME_NEG_P (timer_delay) && time_limit != -1)
+         if (EMACS_TIME_VALID_P (timer_delay) && 0 <= nsecs)
            {
-             EMACS_TIME difference;
-             EMACS_SUB_TIME (difference, timer_delay, timeout);
-             if (EMACS_TIME_NEG_P (difference))
+             if (EMACS_TIME_LT (timer_delay, timeout))
                {
                  timeout = timer_delay;
                  timeout_reduced_for_timers = 1;
@@ -6891,13 +6944,6 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
       if (read_kbd < 0)
        set_waiting_for_input (&timeout);
 
-      /* Wait till there is something to do.  */
-
-      if (! read_kbd && NILP (wait_for_cell))
-       FD_ZERO (&waitchannels);
-      else
-       FD_SET (0, &waitchannels);
-
       /* If a frame has been newly mapped and needs updating,
         reprocess its display stuff.  */
       if (frame_garbaged && do_display)
@@ -6908,14 +6954,16 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
            set_waiting_for_input (&timeout);
        }
 
+      /* Wait till there is something to do.  */
+      FD_ZERO (&waitchannels);
       if (read_kbd && detect_input_pending ())
+       nfds = 0;
+      else
        {
-         nfds = 0;
-         FD_ZERO (&waitchannels);
+         if (read_kbd || !NILP (wait_for_cell))
+           FD_SET (0, &waitchannels);
+         nfds = pselect (1, &waitchannels, NULL, NULL, &timeout, NULL);
        }
-      else
-       nfds = select (1, &waitchannels, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
-                      &timeout);
 
       xerrno = errno;
 
@@ -6925,7 +6973,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd,
       /*  If we woke up due to SIGWINCH, actually change size now.  */
       do_pending_window_change (0);
 
-      if (time_limit && nfds == 0 && ! timeout_reduced_for_timers)
+      if ((time_limit || nsecs) && nfds == 0 && ! timeout_reduced_for_timers)
        /* We waited the full specified time, so return now.  */
        break;
 
@@ -7030,8 +7078,7 @@ setup_process_coding_systems (Lisp_Object process)
     return;
 
   if (!proc_decode_coding_system[inch])
-    proc_decode_coding_system[inch]
-      = (struct coding_system *) xmalloc (sizeof (struct coding_system));
+    proc_decode_coding_system[inch] = xmalloc (sizeof (struct coding_system));
   coding_system = p->decode_coding_system;
   if (! NILP (p->filter))
     ;
@@ -7043,8 +7090,7 @@ setup_process_coding_systems (Lisp_Object process)
   setup_coding_system (coding_system, proc_decode_coding_system[inch]);
 
   if (!proc_encode_coding_system[outch])
-    proc_encode_coding_system[outch]
-      = (struct coding_system *) xmalloc (sizeof (struct coding_system));
+    proc_encode_coding_system[outch] = xmalloc (sizeof (struct coding_system));
   setup_coding_system (p->encode_coding_system,
                       proc_encode_coding_system[outch]);
 #endif
@@ -7228,19 +7274,20 @@ integer or floating point values.
  majflt  -- number of major page faults (number)
  cminflt -- cumulative number of minor page faults (number)
  cmajflt -- cumulative number of major page faults (number)
- utime   -- user time used by the process, in the (HIGH LOW USEC) format
- stime   -- system time used by the process, in the (HIGH LOW USEC) format
- time    -- sum of utime and stime, in the (HIGH LOW USEC) format
- cutime  -- user time used by the process and its children, (HIGH LOW USEC)
- cstime  -- system time used by the process and its children, (HIGH LOW USEC)
- ctime   -- sum of cutime and cstime, in the (HIGH LOW USEC) format
+ utime   -- user time used by the process, in (current-time) format,
+              which is a list of integers (HIGH LOW USEC PSEC)
+ stime   -- system time used by the process (current-time)
+ time    -- sum of utime and stime (current-time)
+ cutime  -- user time used by the process and its children (current-time)
+ cstime  -- system time used by the process and its children (current-time)
+ ctime   -- sum of cutime and cstime (current-time)
  pri     -- priority of the process (number)
  nice    -- nice value of the process (number)
  thcount -- process thread count (number)
- start   -- time the process started, in the (HIGH LOW USEC) format
+ start   -- time the process started (current-time)
  vsize   -- virtual memory size of the process in KB's (number)
  rss     -- resident set size of the process in KB's (number)
- etime   -- elapsed time the process is running, in (HIGH LOW USEC) format
+ etime   -- elapsed time the process is running, in (HIGH LOW USEC PSEC) format
  pcpu    -- percents of CPU time used by the process (floating-point number)
  pmem    -- percents of total physical memory used by process's resident set
               (floating-point number)
@@ -7251,8 +7298,10 @@ integer or floating point values.
 }
 
 \f
+/* This is not called "init_process" because that is the name of a
+   Mach system call, so it would cause problems on Darwin systems.  */
 void
-init_process (void)
+init_process_emacs (void)
 {
 #ifdef subprocesses
   register int i;
@@ -7349,8 +7398,7 @@ init_process (void)
     char const *release = (STRINGP (Voperating_system_release)
                           ? SSDATA (Voperating_system_release)
                           : 0);
-    if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
-                                   && release[1] == '.')) {
+    if (!release || !release[0] || (release[0] < '7' && release[1] == '.')) {
       Vprocess_connection_type = Qnil;
     }
   }
@@ -7465,7 +7513,7 @@ syms_of_process (void)
   DEFSYM (Qargs, "args");
 
   DEFVAR_BOOL ("delete-exited-processes", delete_exited_processes,
-              doc: /* *Non-nil means delete processes immediately when they exit.
+              doc: /* Non-nil means delete processes immediately when they exit.
 A value of nil means don't delete them until `list-processes' is run.  */);
 
   delete_exited_processes = 1;
index 3eb94cb196b0f44db9d5d48e4d87204f4d17d6f2..649056a99ff34190bf6783fa08f25df96165bbe5 100644 (file)
@@ -77,6 +77,8 @@ struct Lisp_Process
     Lisp_Object encode_coding_system;
     /* Working buffer for encoding.  */
     Lisp_Object encoding_buf;
+    /* Queue for storing waiting writes */
+    Lisp_Object write_queue;
 
 #ifdef HAVE_GNUTLS
     Lisp_Object gnutls_cred_type;
@@ -95,17 +97,17 @@ struct Lisp_Process
     /* Descriptor by which we write to this process */
     int outfd;
     /* Event-count of last event in which this process changed status.  */
-    int tick;
+    EMACS_INT tick;
     /* Event-count of last such event reported.  */
-    int update_tick;
+    EMACS_INT update_tick;
     /* Size of carryover in decoding.  */
     int decoding_carryover;
     /* Hysteresis to try to read process output in larger blocks.
        On some systems, e.g. GNU/Linux, Emacs is seen as
        an interactive app also when reading process output, meaning
        that process output can be read in as little as 1 byte at a
-       time.  Value is micro-seconds to delay reading output from
-       this process.  Range is 0 .. 50000.  */
+       time.  Value is nanoseconds to delay reading output from
+       this process.  Range is 0 .. 50 * 1000 * 1000.  */
     int read_output_delay;
     /* Should we delay reading output from this process.
        Initialized from `Vprocess_adaptive_read_buffering'.
index e854dc585e8a6305a65dc801d6a2ccb7c4517fa1..2f024345d612a2cb6f2f842f7b5fcebafdd11c30 100644 (file)
@@ -45,8 +45,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Increase BASE_PURESIZE by a ratio depending on the machine's word size.  */
 #ifndef PURESIZE_RATIO
-#if BITS_PER_EMACS_INT > 32
-#define PURESIZE_RATIO 10/6    /* Don't surround with `()'. */
+#if EMACS_INT_MAX >> 31 != 0
+#if PTRDIFF_MAX >> 31 != 0
+#define PURESIZE_RATIO 10 / 6  /* Don't surround with `()'.  */
+#else
+#define PURESIZE_RATIO 8 / 6   /* Don't surround with `()'.  */
+#endif
 #else
 #define PURESIZE_RATIO 1
 #endif
@@ -56,7 +60,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* ENABLE_CHECKING somehow increases the purespace used, probably because
    it tends to cause some macro arguments to be evaluated twice.  This is
    a bug, but it's difficult to track it down.  */
-#define PURESIZE_CHECKING_RATIO 12/10  /* Don't surround with `()'. */
+#define PURESIZE_CHECKING_RATIO 12 / 10        /* Don't surround with `()'.  */
 #else
 #define PURESIZE_CHECKING_RATIO 1
 #endif
@@ -71,7 +75,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
   { if (PURE_P (obj))    \
       pure_write_error (); }
 
-extern void pure_write_error (void) NO_RETURN;
+extern _Noreturn void pure_write_error (void);
 \f
 /* Define PURE_P.  */
 
index b1a5982574f0e008ec09c7d4dbc914df0a334366..c40258693f576f9788e0f3d9288aab329862a185 100644 (file)
@@ -31,9 +31,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <unistd.h>
 
-typedef POINTER_TYPE *POINTER;
-typedef size_t SIZE;
-
 #ifdef DOUG_LEA_MALLOC
 #define M_TOP_PAD           -2
 extern int mallopt (int, int);
@@ -47,9 +44,6 @@ extern size_t __malloc_extra_blocks;
 
 #include <stddef.h>
 
-typedef size_t SIZE;
-typedef void *POINTER;
-
 #include <unistd.h>
 #include <malloc.h>
 
@@ -58,6 +52,8 @@ typedef void *POINTER;
 
 #include "getpagesize.h"
 
+typedef size_t SIZE;
+typedef void *POINTER;
 #define NIL ((POINTER) 0)
 
 /* A flag to indicate whether we have initialized ralloc yet.  For
@@ -95,10 +91,8 @@ static int extra_bytes;
 /* Macros for rounding.  Note that rounding to any value is possible
    by changing the definition of PAGE.  */
 #define PAGE (getpagesize ())
-#define ALIGNED(addr) (((unsigned long int) (addr) & (page_size - 1)) == 0)
 #define ROUNDUP(size) (((unsigned long int) (size) + page_size - 1) \
                       & ~(page_size - 1))
-#define ROUND_TO_PAGE(addr) (addr & (~(page_size - 1)))
 
 #define MEM_ALIGN sizeof (double)
 #define MEM_ROUNDUP(addr) (((unsigned long int)(addr) + MEM_ALIGN - 1) \
@@ -151,7 +145,6 @@ typedef struct heap
 } *heap_ptr;
 
 #define NIL_HEAP ((heap_ptr) 0)
-#define HEAP_PTR_SIZE (sizeof (struct heap))
 
 /* This is the first heap object.
    If we need additional heap objects, each one resides at the beginning of
@@ -366,15 +359,6 @@ relinquish (void)
        }
     }
 }
-
-/* Return the total size in use by relocating allocator,
-   above where malloc gets space.  */
-
-long
-r_alloc_size_in_use (void)
-{
-  return (char *) break_value - (char *) virtual_break_value;
-}
 \f
 /* The meat - allocating, freeing, and relocating blocs.  */
 
@@ -412,7 +396,7 @@ get_bloc (SIZE size)
   register bloc_ptr new_bloc;
   register heap_ptr heap;
 
-  if (! (new_bloc = (bloc_ptr) malloc (BLOC_PTR_SIZE))
+  if (! (new_bloc = malloc (BLOC_PTR_SIZE))
       || ! (new_bloc->data = obtain (break_value, size)))
     {
       free (new_bloc);
@@ -748,7 +732,7 @@ free_bloc (bloc_ptr bloc)
    __morecore hook values - in particular, __default_morecore in the
    GNU malloc package.  */
 
-POINTER
+static POINTER
 r_alloc_sbrk (long int size)
 {
   register bloc_ptr b;
@@ -1014,52 +998,6 @@ r_re_alloc (POINTER *ptr, SIZE size)
   return *ptr;
 }
 
-/* Disable relocations, after making room for at least SIZE bytes
-   of non-relocatable heap if possible.  The relocatable blocs are
-   guaranteed to hold still until thawed, even if this means that
-   malloc must return a null pointer.  */
-
-void
-r_alloc_freeze (long int size)
-{
-  if (! r_alloc_initialized)
-    r_alloc_init ();
-
-  /* If already frozen, we can't make any more room, so don't try.  */
-  if (r_alloc_freeze_level > 0)
-    size = 0;
-  /* If we can't get the amount requested, half is better than nothing.  */
-  while (size > 0 && r_alloc_sbrk (size) == 0)
-    size /= 2;
-  ++r_alloc_freeze_level;
-  if (size > 0)
-    r_alloc_sbrk (-size);
-}
-
-void
-r_alloc_thaw (void)
-{
-
-  if (! r_alloc_initialized)
-    r_alloc_init ();
-
-  if (--r_alloc_freeze_level < 0)
-    abort ();
-
-  /* This frees all unused blocs.  It is not too inefficient, as the resize
-     and memcpy is done only once.  Afterwards, all unreferenced blocs are
-     already shrunk to zero size.  */
-  if (!r_alloc_freeze_level)
-    {
-      bloc_ptr *b = &first_bloc;
-      while (*b)
-       if (!(*b)->variable)
-         free_bloc (*b);
-       else
-         b = &(*b)->next;
-    }
-}
-
 
 #if defined (emacs) && defined (DOUG_LEA_MALLOC)
 
index 0f9150193ec68ce67d0cc3abfa2664790b0f1aab..4bf119402ac3559e85d26cb8561aab66fa047030 100644 (file)
   #pragma alloca
 #endif
 
-#ifdef HAVE_CONFIG_H
-# include <config.h>
+/* Ignore some GCC warnings for now.  This section should go away
+   once the Emacs and Gnulib regex code is merged.  */
+#if (__GNUC__ == 4 && 5 <= __GNUC_MINOR__) || 4 < __GNUC__
+# pragma GCC diagnostic ignored "-Wstrict-overflow"
+# ifndef emacs
+#  pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#  pragma GCC diagnostic ignored "-Wunused-function"
+#  pragma GCC diagnostic ignored "-Wunused-macros"
+#  pragma GCC diagnostic ignored "-Wunused-result"
+#  pragma GCC diagnostic ignored "-Wunused-variable"
+# endif
 #endif
 
+#include <config.h>
+
 #include <stddef.h>
 
 #ifdef emacs
 
 # include <setjmp.h>
 # include "lisp.h"
+# include "character.h"
 # include "buffer.h"
 
 /* Make syntax table lookup grant data in gl_state.  */
 # define SYNTAX_ENTRY_VIA_PROPERTY
 
 # include "syntax.h"
-# include "character.h"
 # include "category.h"
 
 # ifdef malloc
 
 /* When used in Emacs's lib-src, we need xmalloc and xrealloc. */
 
-void *
+static void *
 xmalloc (size_t size)
 {
-  register void *val;
-  val = (void *) malloc (size);
+  void *val = malloc (size);
   if (!val && size)
     {
       write (2, "virtual memory exhausted\n", 25);
@@ -211,16 +221,16 @@ xmalloc (size_t size)
   return val;
 }
 
-void *
+static void *
 xrealloc (void *block, size_t size)
 {
-  register void *val;
+  void *val;
   /* We must call malloc explicitly when BLOCK is 0, since some
      reallocs don't do this.  */
   if (! block)
-    val = (void *) malloc (size);
+    val = malloc (size);
   else
-    val = (void *) realloc (block, size);
+    val = realloc (block, size);
   if (!val && size)
     {
       write (2, "virtual memory exhausted\n", 25);
@@ -421,17 +431,7 @@ init_syntax_once (void)
 
 #endif /* not emacs */
 \f
-/* We remove any previous definition of `SIGN_EXTEND_CHAR',
-   since ours (we hope) works properly with all combinations of
-   machines, compilers, `char' and `unsigned char' argument types.
-   (Per Bothner suggested the basic approach.)  */
-#undef SIGN_EXTEND_CHAR
-#if __STDC__
-# define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-#else  /* not __STDC__ */
-/* As in Harbison and Steele.  */
-# define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128)
-#endif
+#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
 \f
 /* Should we use malloc or alloca?  If REGEX_MALLOC is not defined, we
    use `alloca' instead of `malloc'.  This is because using malloc in
@@ -540,12 +540,12 @@ typedef char boolean;
 #define false 0
 #define true 1
 
-static regoff_t re_match_2_internal _RE_ARGS ((struct re_pattern_buffer *bufp,
-                                              re_char *string1, size_t size1,
-                                              re_char *string2, size_t size2,
-                                              ssize_t pos,
-                                              struct re_registers *regs,
-                                              ssize_t stop));
+static regoff_t re_match_2_internal (struct re_pattern_buffer *bufp,
+                                    re_char *string1, size_t size1,
+                                    re_char *string2, size_t size2,
+                                    ssize_t pos,
+                                    struct re_registers *regs,
+                                    ssize_t stop);
 \f
 /* These are the command codes that appear in compiled regular
    expressions.  Some opcodes are followed by argument bytes.  A
@@ -722,11 +722,8 @@ typedef enum
   } while (0)
 
 #ifdef DEBUG
-static void extract_number _RE_ARGS ((int *dest, re_char *source));
 static void
-extract_number (dest, source)
-    int *dest;
-    re_char *source;
+extract_number (int *dest, re_char *source)
 {
   int temp = SIGN_EXTEND_CHAR (*(source + 1));
   *dest = *source & 0377;
@@ -750,12 +747,8 @@ extract_number (dest, source)
   } while (0)
 
 #ifdef DEBUG
-static void extract_number_and_incr _RE_ARGS ((int *destination,
-                                              re_char **source));
 static void
-extract_number_and_incr (destination, source)
-    int *destination;
-    re_char **source;
+extract_number_and_incr (int *destination, re_char **source)
 {
   extract_number (destination, *source);
   *source += 2;
@@ -1392,7 +1385,7 @@ typedef struct
 #ifdef MATCH_MAY_ALLOCATE
 # define INIT_FAIL_STACK()                                             \
   do {                                                                 \
-    fail_stack.stack = (fail_stack_elt_t *)                            \
+    fail_stack.stack =                                                 \
       REGEX_ALLOCATE_STACK (INIT_FAILURE_ALLOC * TYPICAL_FAILURE_SIZE  \
                            * sizeof (fail_stack_elt_t));               \
                                                                        \
@@ -1435,8 +1428,7 @@ typedef struct
     >= re_max_failures * TYPICAL_FAILURE_SIZE)                         \
    ? 0                                                                 \
    : ((fail_stack).stack                                               \
-      = (fail_stack_elt_t *)                                           \
-       REGEX_REALLOCATE_STACK ((fail_stack).stack,                     \
+      = REGEX_REALLOCATE_STACK ((fail_stack).stack,                    \
          (fail_stack).size * sizeof (fail_stack_elt_t),                \
          MIN (re_max_failures * TYPICAL_FAILURE_SIZE,                  \
               ((fail_stack).size * sizeof (fail_stack_elt_t)           \
@@ -1659,25 +1651,22 @@ do {                                                                    \
 \f
 /* Subroutine declarations and macros for regex_compile.  */
 
-static reg_errcode_t regex_compile _RE_ARGS ((re_char *pattern, size_t size,
-                                             reg_syntax_t syntax,
-                                             struct re_pattern_buffer *bufp));
-static void store_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc, int arg));
-static void store_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc,
-                                int arg1, int arg2));
-static void insert_op1 _RE_ARGS ((re_opcode_t op, unsigned char *loc,
-                                 int arg, unsigned char *end));
-static void insert_op2 _RE_ARGS ((re_opcode_t op, unsigned char *loc,
-                                 int arg1, int arg2, unsigned char *end));
-static boolean at_begline_loc_p _RE_ARGS ((re_char *pattern,
-                                          re_char *p,
-                                          reg_syntax_t syntax));
-static boolean at_endline_loc_p _RE_ARGS ((re_char *p,
-                                          re_char *pend,
-                                          reg_syntax_t syntax));
-static re_char *skip_one_char _RE_ARGS ((re_char *p));
-static int analyse_first _RE_ARGS ((re_char *p, re_char *pend,
-                                   char *fastmap, const int multibyte));
+static reg_errcode_t regex_compile (re_char *pattern, size_t size,
+                                   reg_syntax_t syntax,
+                                   struct re_pattern_buffer *bufp);
+static void store_op1 (re_opcode_t op, unsigned char *loc, int arg);
+static void store_op2 (re_opcode_t op, unsigned char *loc, int arg1, int arg2);
+static void insert_op1 (re_opcode_t op, unsigned char *loc,
+                       int arg, unsigned char *end);
+static void insert_op2 (re_opcode_t op, unsigned char *loc,
+                       int arg1, int arg2, unsigned char *end);
+static boolean at_begline_loc_p (re_char *pattern, re_char *p,
+                                reg_syntax_t syntax);
+static boolean at_endline_loc_p (re_char *p, re_char *pend,
+                                reg_syntax_t syntax);
+static re_char *skip_one_char (re_char *p);
+static int analyse_first (re_char *p, re_char *pend,
+                         char *fastmap, const int multibyte);
 
 /* Fetch the next character in the uncompiled pattern, with no
    translation.  */
@@ -2150,12 +2139,7 @@ static void
 extend_range_table_work_area (struct range_table_work_area *work_area)
 {
   work_area->allocated += 16 * sizeof (int);
-  if (work_area->table)
-    work_area->table
-      = (int *) realloc (work_area->table, work_area->allocated);
-  else
-    work_area->table
-      = (int *) malloc (work_area->allocated);
+  work_area->table = realloc (work_area->table, work_area->allocated);
 }
 
 #if 0
@@ -2429,9 +2413,8 @@ regex_grow_registers (int num_regs)
 
 #endif /* not MATCH_MAY_ALLOCATE */
 \f
-static boolean group_in_compile_stack _RE_ARGS ((compile_stack_type
-                                                compile_stack,
-                                                regnum_t regnum));
+static boolean group_in_compile_stack (compile_stack_type compile_stack,
+                                      regnum_t regnum);
 
 /* `regex_compile' compiles PATTERN (of length SIZE) according to SYNTAX.
    Returns one of error codes defined in `regex.h', or zero for success.
@@ -3751,16 +3734,8 @@ regex_compile (const re_char *pattern, size_t size, reg_syntax_t syntax, struct
     if (fail_stack.size < re_max_failures * TYPICAL_FAILURE_SIZE)
       {
        fail_stack.size = re_max_failures * TYPICAL_FAILURE_SIZE;
-
-       if (! fail_stack.stack)
-         fail_stack.stack
-           = (fail_stack_elt_t *) malloc (fail_stack.size
-                                          * sizeof (fail_stack_elt_t));
-       else
-         fail_stack.stack
-           = (fail_stack_elt_t *) realloc (fail_stack.stack,
-                                           (fail_stack.size
-                                            * sizeof (fail_stack_elt_t)));
+       falk_stack.stack = realloc (fail_stack.stack,
+                                   fail_stack.size * sizeof *falk_stack.stack);
       }
 
     regex_grow_registers (num_regs);
@@ -3832,18 +3807,37 @@ static boolean
 at_begline_loc_p (const re_char *pattern, const re_char *p, reg_syntax_t syntax)
 {
   re_char *prev = p - 2;
-  boolean prev_prev_backslash = prev > pattern && prev[-1] == '\\';
+  boolean odd_backslashes;
 
-  return
-       /* After a subexpression?  */
-       (*prev == '(' && (syntax & RE_NO_BK_PARENS || prev_prev_backslash))
-       /* After an alternative?         */
-    || (*prev == '|' && (syntax & RE_NO_BK_VBAR || prev_prev_backslash))
-       /* After a shy subexpression?  */
-    || ((syntax & RE_SHY_GROUPS) && prev - 2 >= pattern
-       && prev[-1] == '?' && prev[-2] == '('
-       && (syntax & RE_NO_BK_PARENS
-           || (prev - 3 >= pattern && prev[-3] == '\\')));
+  /* After a subexpression?  */
+  if (*prev == '(')
+    odd_backslashes = (syntax & RE_NO_BK_PARENS) == 0;
+
+  /* After an alternative?  */
+  else if (*prev == '|')
+    odd_backslashes = (syntax & RE_NO_BK_VBAR) == 0;
+
+  /* After a shy subexpression?  */
+  else if (*prev == ':' && (syntax & RE_SHY_GROUPS))
+    {
+      /* Skip over optional regnum.  */
+      while (prev - 1 >= pattern && prev[-1] >= '0' && prev[-1] <= '9')
+       --prev;
+
+      if (!(prev - 2 >= pattern
+           && prev[-1] == '?' && prev[-2] == '('))
+       return false;
+      prev -= 2;
+      odd_backslashes = (syntax & RE_NO_BK_PARENS) == 0;
+    }
+  else
+    return false;
+
+  /* Count the number of preceding backslashes.  */
+  p = prev;
+  while (prev - 1 >= pattern && prev[-1] == '\\')
+    --prev;
+  return (p - prev) & odd_backslashes;
 }
 
 
@@ -4541,10 +4535,10 @@ WEAK_ALIAS (__re_search_2, re_search_2)
 \f
 /* Declarations and macros for re_match_2.  */
 
-static int bcmp_translate _RE_ARGS ((re_char *s1, re_char *s2,
-                                     register ssize_t len,
-                                     RE_TRANSLATE_TYPE translate,
-                                     const int multibyte));
+static int bcmp_translate (re_char *s1, re_char *s2,
+                          register ssize_t len,
+                          RE_TRANSLATE_TYPE translate,
+                          const int multibyte);
 
 /* This converts PTR, a pointer into one of the search strings `string1'
    and `string2' into an offset from the beginning of that string.  */
@@ -6399,13 +6393,13 @@ re_comp (const char *s)
 
   if (!re_comp_buf.buffer)
     {
-      re_comp_buf.buffer = (unsigned char *) malloc (200);
+      re_comp_buf.buffer = malloc (200);
       if (re_comp_buf.buffer == NULL)
        /* Yes, we're discarding `const' here if !HAVE_LIBINTL.  */
        return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
       re_comp_buf.allocated = 200;
 
-      re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
+      re_comp_buf.fastmap = malloc (1 << BYTEWIDTH);
       if (re_comp_buf.fastmap == NULL)
        /* Yes, we're discarding `const' here if !HAVE_LIBINTL.  */
        return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
@@ -6489,15 +6483,13 @@ regcomp (regex_t *__restrict preg, const char *__restrict pattern,
   preg->used = 0;
 
   /* Try to allocate space for the fastmap.  */
-  preg->fastmap = (char *) malloc (1 << BYTEWIDTH);
+  preg->fastmap = malloc (1 << BYTEWIDTH);
 
   if (cflags & REG_ICASE)
     {
       unsigned i;
 
-      preg->translate
-       = (RE_TRANSLATE_TYPE) malloc (CHAR_SET_SIZE
-                                     * sizeof (*(RE_TRANSLATE_TYPE)0));
+      preg->translate = malloc (CHAR_SET_SIZE * sizeof *preg->translate);
       if (preg->translate == NULL)
        return (int) REG_ESPACE;
 
@@ -6652,7 +6644,7 @@ regerror (int err_code, const regex_t *preg, char *errbuf, size_t errbuf_size)
     {
       if (msg_size > errbuf_size)
        {
-         strncpy (errbuf, msg, errbuf_size - 1);
+         memcpy (errbuf, msg, errbuf_size - 1);
          errbuf[errbuf_size - 1] = 0;
        }
       else
index 643d0b7b5aba447100ece544e776a9205a3d798c..e0ede012b203448c6b095c0df2335192d5f95bbb 100644 (file)
@@ -451,38 +451,21 @@ typedef struct
 \f
 /* Declarations for routines.  */
 
-/* To avoid duplicating every routine declaration -- once with a
-   prototype (if we are ANSI), and once without (if we aren't) -- we
-   use the following macro to declare argument types.  This
-   unfortunately clutters up the declarations a bit, but I think it's
-   worth it.  */
-
-#if defined __STDC__ || defined PROTOTYPES
-
-# define _RE_ARGS(args) args
-
-#else /* not __STDC__  || PROTOTYPES */
-
-# define _RE_ARGS(args) ()
-
-#endif /* not __STDC__  || PROTOTYPES */
-
 /* Sets the current default syntax to SYNTAX, and return the old syntax.
    You can also simply assign to the `re_syntax_options' variable.  */
-extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));
+extern reg_syntax_t re_set_syntax (reg_syntax_t __syntax);
 
 /* Compile the regular expression PATTERN, with length LENGTH
    and syntax given by the global `re_syntax_options', into the buffer
    BUFFER.  Return NULL if successful, and an error string if not.  */
-extern const char *re_compile_pattern
-  _RE_ARGS ((const char *pattern, size_t length,
-             struct re_pattern_buffer *buffer));
+extern const char *re_compile_pattern (const char *__pattern, size_t __length,
+                                      struct re_pattern_buffer *__buffer);
 
 
 /* Compile a fastmap for the compiled pattern in BUFFER; used to
    accelerate searches.  Return 0 if successful and -2 if was an
    internal error.  */
-extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
+extern int re_compile_fastmap (struct re_pattern_buffer *__buffer);
 
 
 /* Search in the string STRING (with length LENGTH) for the pattern
@@ -490,33 +473,35 @@ extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));
    characters.  Return the starting position of the match, -1 for no
    match, or -2 for an internal error.  Also return register
    information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
-extern regoff_t re_search
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
-            size_t length, ssize_t start, ssize_t range,
-            struct re_registers *regs));
+extern regoff_t re_search (struct re_pattern_buffer *__buffer,
+                          const char *__string, size_t __length,
+                          ssize_t __start, ssize_t __range,
+                          struct re_registers *__regs);
 
 
 /* Like `re_search', but search in the concatenation of STRING1 and
    STRING2.  Also, stop searching at index START + STOP.  */
-extern regoff_t re_search_2
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
-             size_t length1, const char *string2, size_t length2,
-             ssize_t start, ssize_t range, struct re_registers *regs,
-            ssize_t stop));
+extern regoff_t re_search_2 (struct re_pattern_buffer *__buffer,
+                            const char *__string1, size_t __length1,
+                            const char *__string2, size_t __length2,
+                            ssize_t __start, ssize_t __range,
+                            struct re_registers *__regs,
+                            ssize_t __stop);
 
 
 /* Like `re_search', but return how many characters in STRING the regexp
    in BUFFER matched, starting at position START.  */
-extern regoff_t re_match
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,
-             size_t length, ssize_t start, struct re_registers *regs));
+extern regoff_t re_match (struct re_pattern_buffer *__buffer,
+                         const char *__string, size_t __length,
+                         ssize_t __start, struct re_registers *__regs);
 
 
 /* Relates to `re_match' as `re_search_2' relates to `re_search'.  */
-extern regoff_t re_match_2
-  _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,
-             size_t length1, const char *string2, size_t length2,
-             ssize_t start, struct re_registers *regs, ssize_t stop));
+extern regoff_t re_match_2 (struct re_pattern_buffer *__buffer,
+                           const char *__string1, size_t __length1,
+                           const char *__string2, size_t __length2,
+                           ssize_t __start, struct re_registers *__regs,
+                           ssize_t __stop);
 
 
 /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
@@ -531,15 +516,16 @@ extern regoff_t re_match_2
    Unless this function is called, the first search or match using
    PATTERN_BUFFER will allocate its own register data, without
    freeing the old data.  */
-extern void re_set_registers
-  _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,
-             unsigned num_regs, regoff_t *starts, regoff_t *ends));
+extern void re_set_registers (struct re_pattern_buffer *__buffer,
+                             struct re_registers *__regs,
+                             unsigned __num_regs,
+                             regoff_t *__starts, regoff_t *__ends);
 
 #if defined _REGEX_RE_COMP || defined _LIBC
 # ifndef _CRAY
 /* 4.2 bsd compatibility.  */
-extern char *re_comp _RE_ARGS ((const char *));
-extern int re_exec _RE_ARGS ((const char *));
+extern char *re_comp (const char *);
+extern int re_exec (const char *);
 # endif
 #endif
 
@@ -562,20 +548,19 @@ extern int re_exec _RE_ARGS ((const char *));
 #endif
 
 /* POSIX compatibility.  */
-extern reg_errcode_t regcomp _RE_ARGS ((regex_t *__restrict __preg,
-                                       const char *__restrict __pattern,
-                                       int __cflags));
+extern reg_errcode_t regcomp (regex_t *__restrict __preg,
+                             const char *__restrict __pattern,
+                             int __cflags);
 
-extern reg_errcode_t regexec _RE_ARGS ((const regex_t *__restrict __preg,
-                                       const char *__restrict __string,
-                                       size_t __nmatch,
-                                       regmatch_t __pmatch[__restrict_arr],
-                                       int __eflags));
+extern reg_errcode_t regexec (const regex_t *__restrict __preg,
+                             const char *__restrict __string, size_t __nmatch,
+                             regmatch_t __pmatch[__restrict_arr],
+                             int __eflags);
 
-extern size_t regerror _RE_ARGS ((int __errcode, const regex_t *__preg,
-                                 char *__errbuf, size_t __errbuf_size));
+extern size_t regerror (int __errcode, const regex_t * __preg,
+                       char *__errbuf, size_t __errbuf_size);
 
-extern void regfree _RE_ARGS ((regex_t *__preg));
+extern void regfree (regex_t *__preg);
 
 
 #ifdef __cplusplus
index 9f4e5921877a6319da9095d776efb2c7d8e58365..14b6233a5a5c892077ee5a6e44a423f13e3e9a2c 100644 (file)
@@ -24,6 +24,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "region-cache.h"
 
@@ -131,15 +132,13 @@ static void revalidate_region_cache (struct buffer *buf, struct region_cache *c)
 struct region_cache *
 new_region_cache (void)
 {
-  struct region_cache *c
-    = (struct region_cache *) xmalloc (sizeof (struct region_cache));
+  struct region_cache *c = xmalloc (sizeof *c);
 
   c->gap_start = 0;
   c->gap_len = NEW_CACHE_GAP;
   c->cache_len = 0;
-  c->boundaries =
-    (struct boundary *) xmalloc ((c->gap_len + c->cache_len)
-                                 * sizeof (*c->boundaries));
+  c->boundaries = xmalloc ((c->gap_len + c->cache_len)
+                          * sizeof (*c->boundaries));
 
   c->beg_unchanged = 0;
   c->end_unchanged = 0;
index 37b041396f9fd1ab82eb72a3eb8710ea37418441..6c881a7fb8ccef58030b89fd6421066fb1f3b486 100644 (file)
@@ -16,62 +16,6 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Define symbols to identify the version of Unix this is.
-   Define all the symbols that apply correctly.  */
-#define USG                            /* System III, System V, etc */
-#define USG5
-
-/* This symbol should be defined on AIX Version 3  ??????? */
-#ifndef _AIX
-#define _AIX
-#endif
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
- It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "aix"
-
-/* In AIX, you allocate a pty by opening /dev/ptc to get the master side.
-   To get the name of the slave side, you just ttyname() the master side.  */
-#define PTY_ITERATION int c; for (c = 0; !c ; c++)
-#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc");
-#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));
-
-/* Define HAVE_PTYS if the system supports pty devices.  */
-#define HAVE_PTYS
-
-/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
-#define HAVE_SOCKETS
-\f
-/* Special items needed to make Emacs run on this system.  */
-
-/* AIX doesn't define this.  */
-#define unix 1
-
-/* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct.  */
-#define SIGNALS_VIA_CHARACTERS
-#define CLASH_DETECTION
-
 /* Perry Smith <pedz@ddivt1.austin.ibm.com> says these are correct.  */
 #undef sigmask
 
-#ifndef HAVE_LIBXMU
-/* Unfortunately without libXmu we cannot support EditRes.  */
-#define NO_EDITRES
-#endif
-
-/* On AIX Emacs uses the gmalloc.c malloc implementation.  But given
-   the way this system works, libc functions that return malloced
-   memory use the libc malloc implementation. Calling xfree or
-   xrealloc on the results of such functions results in a crash.
-
-   One solution for this could be to define SYSTEM_MALLOC in configure,
-   but that does not currently work on this system.
-
-   It is possible to completely override the malloc implementation on
-   AIX, but that involves putting the malloc functions in a shared
-   library and setting the MALLOCTYPE environment variable to point to
-   that shared library.
-
-   Emacs currently calls xrealloc on the results of get_current_dir name,
-   to avoid a crash just use the Emacs implementation for that function.  */
-#define BROKEN_GET_CURRENT_DIR_NAME 1
diff --git a/src/s/bsd-common.h b/src/s/bsd-common.h
deleted file mode 100644 (file)
index c2dbdb9..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Definitions file for GNU Emacs running on bsd 4.3
-
-Copyright (C) 1985-1986, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-/* Define symbols to identify the version of Unix this is.
-   Define all the symbols that apply correctly.   */
-
-/* We give these symbols the numeric values found in <sys/param.h> to
-   avoid warnings about redefined macros.  */
-#ifndef BSD4_3
-#define BSD4_3 1
-#endif /* BSD4_3 */
-
-#ifndef BSD_SYSTEM
-#define BSD_SYSTEM 43
-#endif /* BSD_SYSTEM */
-
-/* For mem-limits.h.  */
-#define BSD4_2
-
-#define TABDLY OXTABS
-#define TAB3 OXTABS
-
-#define NO_TERMIO
-
-/* If the system's imake configuration file defines `NeedWidePrototypes'
-   as `NO', we must define NARROWPROTO manually.  Such a define is
-   generated in the Makefile generated by `xmkmf'.  If we don't
-   define NARROWPROTO, we will see the wrong function prototypes
-   for X functions taking float or double parameters.  */
-#define NARROWPROTO 1
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
- It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "berkeley-unix"
-
-/* Do not use interrupt_input = 1 by default, because in 4.3
-   we can make noninterrupt input work properly.  */
-#undef INTERRUPT_INPUT
-
-/* First pty name is /dev/ptyp0.  */
-#define FIRST_PTY_LETTER 'p'
-
-/* Define HAVE_PTYS if the system supports pty devices.  */
-#define HAVE_PTYS
-
-/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
-#define HAVE_SOCKETS
-
-/* Define CLASH_DETECTION if you want lock files to be written
-   so that Emacs can tell instantly when you try to modify
-   a file that someone else has modified in his Emacs.  */
-#define CLASH_DETECTION
-
-/* Send signals to subprocesses by "typing" special chars at them.  */
-#define SIGNALS_VIA_CHARACTERS
diff --git a/src/s/cygwin.h b/src/s/cygwin.h
deleted file mode 100644 (file)
index 9a37182..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/* System description header file for Cygwin.
-
-Copyright (C) 1985-1986, 1992, 1999, 2002-2012 Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "cygwin"
-
-/* Emacs can read input using SIGIO and buffering characters itself,
-   or using CBREAK mode and making C-g cause SIGINT.
-   The choice is controlled by the variable interrupt_input.
-
-   Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
-
-   Emacs uses the presence or absence of the SIGIO and BROKEN_SIGIO macros
-   to indicate whether or not signal-driven I/O is possible.  It uses
-   INTERRUPT_INPUT to decide whether to use it by default.
-
-   SIGIO can be used only on systems that implement it (4.2 and 4.3).
-   CBREAK mode has two disadvantages
-     1) At least in 4.2, it is impossible to handle the Meta key properly.
-        I hear that in system V this problem does not exist.
-     2) Control-G causes output to be discarded.
-        I do not know whether this can be fixed in system V.
-
-   Another method of doing input is planned but not implemented.
-   It would have Emacs fork off a separate process
-   to read the input and send it to the true Emacs process
-   through a pipe. */
-#undef INTERRUPT_INPUT
-
-/* Define HAVE_PTYS if the system supports pty devices.  */
-#define HAVE_PTYS
-#define PTY_ITERATION          int i; for (i = 0; i < 1; i++) /* ick */
-#define PTY_NAME_SPRINTF       /* none */
-#define PTY_TTY_NAME_SPRINTF   /* none */
-#define PTY_OPEN                                       \
-  do                                                   \
-    {                                                  \
-      int dummy;                                       \
-      SIGMASKTYPE mask;                                        \
-      mask = sigblock (sigmask (SIGCHLD));             \
-      if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) \
-       fd = -1;                                        \
-      sigsetmask (mask);                               \
-      emacs_close (dummy);                             \
-    }                                                  \
-  while (0)
-
-/* Define CLASH_DETECTION if you want lock files to be written
-   so that Emacs can tell instantly when you try to modify
-   a file that someone else has modified in his Emacs.  */
-#define CLASH_DETECTION
-
-/* If the system's imake configuration file defines `NeedWidePrototypes'
-   as `NO', we must define NARROWPROTO manually.  Such a define is
-   generated in the Makefile generated by `xmkmf'.  If we don't
-   define NARROWPROTO, we will see the wrong function prototypes
-   for X functions taking float or double parameters.  */
-#define NARROWPROTO 1
-
-/* Used in various places to enable cygwin-specific code changes.  */
-#define CYGWIN 1
-
-#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
-
-#define HAVE_SOCKETS
-
-/* vfork() interacts badly with setsid(), causing ptys to fail to
-   change their controlling terminal */
-#define vfork fork
-
-/* This should work (at least when compiling with gcc).  But I have no way
-   or intention to verify or even test it.  If you encounter a problem with
-   it, feel free to change this setting, but please add a comment here about
-   why it needed to be changed.  */
-#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-
-/* Emacs supplies its own malloc, but glib (part of Gtk+) calls
-   memalign and on Cygwin, that becomes the Cygwin-supplied memalign.
-   As malloc is not the Cygwin malloc, the Cygwin memalign always
-   returns ENOSYS.  A workaround is to set G_SLICE=always-malloc. */
-#define G_SLICE_ALWAYS_MALLOC
-
-/* Send signals to subprocesses by "typing" special chars at them.  */
-#define SIGNALS_VIA_CHARACTERS
index 9ac9e91fd9df53ccd1909393e46781394571619c..20d576e49869cba0196a269d455f512b51b830d2 100644 (file)
@@ -17,106 +17,7 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-
-/* Define symbols to identify the version of Unix this is.
-   Define all the symbols that apply correctly.  */
-#define BSD4_2
-/* BSD4_3 and BSD4_4 are already defined in sys/param.h */
-#define BSD_SYSTEM
-
-/* More specific than the above two.  We cannot use __APPLE__ as this
-   may not be defined on non-OSX Darwin, and we cannot define DARWIN
-   here because Panther and lower CoreFoundation.h uses DARWIN to
-   distinguish OS X from pure Darwin.  */
-#define DARWIN_OS
-
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "darwin"
-
-/* Emacs can read input using SIGIO and buffering characters itself,
-   or using CBREAK mode and making C-g cause SIGINT.
-   The choice is controlled by the variable interrupt_input.
-
-   Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
-
-   Emacs uses the presence or absence of the SIGIO and BROKEN_SIGIO macros
-   to indicate whether or not signal-driven I/O is possible.  It uses
-   INTERRUPT_INPUT to decide whether to use it by default.
-
-   SIGIO can be used only on systems that implement it (4.2 and 4.3).
-   CBREAK mode has two disadvantages
-     1) At least in 4.2, it is impossible to handle the Meta key properly.
-        I hear that in system V this problem does not exist.
-     2) Control-G causes output to be discarded.
-        I do not know whether this can be fixed in system V.
-
-   Another method of doing input is planned but not implemented.
-   It would have Emacs fork off a separate process
-   to read the input and send it to the true Emacs process
-   through a pipe. */
-#define INTERRUPT_INPUT
-
-/* Letter to use in finding device name of first pty,
-  if system supports pty's.  'a' means it is /dev/ptya0  */
-#define FIRST_PTY_LETTER 'p'
-
-#define NO_TERMIO
-
-/* Define HAVE_PTYS if the system supports pty devices.
-   Note: PTYs are broken on darwin <6.  Use at your own risk.  */
-#define HAVE_PTYS
-/* Run only once.  We need a `for'-loop because the code uses `continue'.  */
-#define PTY_ITERATION  int i; for (i = 0; i < 1; i++)
-#define PTY_NAME_SPRINTF       /* none */
-#define PTY_TTY_NAME_SPRINTF   /* none */
-/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
-   But we don't have to block SIGCHLD because it is blocked in the
-   implementation of grantpt.  */
-#define PTY_OPEN                                               \
-  do                                                           \
-    {                                                          \
-      int slave;                                               \
-      if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1)   \
-       fd = -1;                                                \
-      else                                                     \
-       emacs_close (slave);                                    \
-    }                                                          \
-  while (0)
-
-/* PTYs only work correctly on Darwin 7 or higher.  So make the default
-   for process-connection-type dependent on the kernel version.  */
-#define MIN_PTY_KERNEL_VERSION '7'
-
-/* Define CLASH_DETECTION if you want lock files to be written
-   so that Emacs can tell instantly when you try to modify
-   a file that someone else has modified in his Emacs.  */
-#define CLASH_DETECTION
-
-/* Avoid the use of the name init_process (process.c) because it is
-   also the name of a Mach system call.  */
-#define init_process emacs_init_process
-
-/* Used in dispnew.c.  Copied from freebsd.h. */
-#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
-
-/* System uses OXTABS instead of the expected TAB3.  (Copied from bsd386.h.)  */
-#define TAB3 OXTABS
-
-/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
-#define HAVE_SOCKETS
-
 /* Definitions for how to compile & link.  */
-#ifdef HAVE_NS
-#define SYSTEM_PURESIZE_EXTRA 200000
-#endif
-
-/* On Darwin, res_init appears not to be useful: see bug#562 and
-   http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html  */
-#undef HAVE_RES_INIT
-#undef HAVE_LIBRESOLV
-
 #ifdef emacs
 #define malloc unexec_malloc
 #define realloc unexec_realloc
@@ -125,26 +26,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef HAVE_POSIX_MEMALIGN
 #endif
 
-/* Define the following so emacs symbols will not conflict with those
-   in the System framework.  Otherwise -prebind will not work.  */
-
-/* Do not define abort in emacs.c.  */
-#define NO_ABORT
-
-/* Do not define matherr in floatfns.c.  */
-#define NO_MATHERR
-
 /* The following solves the problem that Emacs hangs when evaluating
    (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile
    does not exist.  Also, setsid is not allowed in the vfork child's
    context as of Darwin 9/Mac OS X 10.5.  */
 #undef HAVE_WORKING_VFORK
 #define vfork fork
-
-/* Don't close pty in process.c to make it as controlling terminal.
-   It is already a controlling terminal of subprocess, because we did
-   ioctl TIOCSCTTY.  */
-#define DONT_REOPEN_PTY
-
-/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack.  */
-#define GC_MARK_STACK   GC_MAKE_GCPROS_NOOPS
index c74605fe3661329ff6c93063c87bcb12e8801ff1..9177403f426614ca4b4cba1945236d5f1f7a5685 100644 (file)
@@ -20,44 +20,3 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Get most of the stuff from bsd-common */
-#include "bsd-common.h"
-
-#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
-
-/* This silences a few compilation warnings.  */
-#undef BSD_SYSTEM
-#if __FreeBSD__ == 1
-#define BSD_SYSTEM 199103
-#elif __FreeBSD__ == 2
-#define BSD_SYSTEM 199306
-#elif __FreeBSD__ >= 3
-#define BSD_SYSTEM 199506
-#endif
-
-/* Don't close pty in process.c to make it as controlling terminal.
-   It is already a controlling terminal of subprocess, because we did
-   ioctl TIOCSCTTY.  */
-#define DONT_REOPEN_PTY
-
-/* Circumvent a bug in FreeBSD.  In the following sequence of
-   writes/reads on a PTY, read(2) returns bogus data:
-
-   write(2)  1022 bytes
-   write(2)   954 bytes, get EAGAIN
-   read(2)   1024 bytes in process_read_output
-   read(2)     11 bytes in process_read_output
-
-   That is, read(2) returns more bytes than have ever been written
-   successfully.  The 1033 bytes read are the 1022 bytes written
-   successfully after processing (for example with CRs added if the
-   terminal is set up that way which it is here).  The same bytes will
-   be seen again in a later read(2), without the CRs.  */
-#define BROKEN_PTY_READ_AFTER_EAGAIN 1
-
-/* Tell that garbage collector that setjmp is known to save all
-   registers relevant for conservative garbage collection in the jmp_buf.  */
-#define GC_SETJMP_WORKS 1
-
-/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack.  */
-#define GC_MARK_STACK  GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/gnu-kfreebsd.h b/src/s/gnu-kfreebsd.h
deleted file mode 100644 (file)
index a855719..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "gnu-linux.h"
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#undef SYSTEM_TYPE
-#define SYSTEM_TYPE "gnu/kfreebsd" /* All the best software is free */
-
-#define NO_TERMIO               /* use only <termios.h> */
-
index b54bd985e6bc3d9c20713e50b7c52efb0f12250c..2847fd6d19c600ce0f5ac023bbd467b3e5a9ee93 100644 (file)
@@ -20,142 +20,3 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Define symbols to identify the version of Unix this is.
-   Define all the symbols that apply correctly.  */
-#define USG
-#define GNU_LINUX
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "gnu/linux"                /* All the best software is free. */
-
-#ifdef emacs
-#ifdef HAVE_LINUX_VERSION_H
-#include <linux/version.h>
-
-#if LINUX_VERSION_CODE >= 0x20400
-/* 21 Jun 06: Eric Hanchrow <offby1@blarg.net> says this works.  */
-#define SIGNALS_VIA_CHARACTERS
-#endif /* LINUX_VERSION_CODE >= 0x20400 */
-#endif /* HAVE_LINUX_VERSION_H */
-#endif /* emacs */
-
-#if defined HAVE_GRANTPT
-#define UNIX98_PTYS
-
-/* Run only once.  We need a `for'-loop because the code uses `continue'.  */
-#define PTY_ITERATION  int i; for (i = 0; i < 1; i++)
-
-#ifdef HAVE_GETPT
-#define PTY_NAME_SPRINTF
-#define PTY_OPEN fd = getpt ()
-#else /* not HAVE_GETPT */
-#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
-#endif /* not HAVE_GETPT */
-
-/* Note that grantpt and unlockpt may fork.  We must block SIGCHLD to
-   prevent sigchld_handler from intercepting the child's death.  */
-#define PTY_TTY_NAME_SPRINTF                           \
-  {                                                    \
-    char *ptyname;                                     \
-                                                       \
-    sigblock (sigmask (SIGCHLD));                      \
-    if (grantpt (fd) == -1 || unlockpt (fd) == -1      \
-        || !(ptyname = ptsname(fd)))                   \
-      {                                                        \
-       sigunblock (sigmask (SIGCHLD));                 \
-       close (fd);                                     \
-       return -1;                                      \
-      }                                                        \
-    strncpy (pty_name, ptyname, sizeof (pty_name));    \
-    pty_name[sizeof (pty_name) - 1] = 0;               \
-    sigunblock (sigmask (SIGCHLD));                    \
-  }
-
-#else /* not HAVE_GRANTPT */
-
-/* Letter to use in finding device name of first pty,
-   if system supports pty's.  'p' means it is /dev/ptyp0  */
-#define FIRST_PTY_LETTER 'p'
-
-#endif  /* not HAVE_GRANTPT */
-
-/* Define HAVE_PTYS if the system supports pty devices.  */
-#define HAVE_PTYS
-
-#define HAVE_SOCKETS
-
-/* This is used in list_system_processes.  */
-#define HAVE_PROCFS 1
-
-/* Define CLASH_DETECTION if you want lock files to be written
-   so that Emacs can tell instantly when you try to modify
-   a file that someone else has modified in his Emacs.  */
-#define CLASH_DETECTION
-
-/* Here, on a separate page, add any special hacks needed
-   to make Emacs work on this system.  For example,
-   you might define certain system call names that don't
-   exist on your system, or that do different things on
-   your system and must be used only through an encapsulation
-   (Which you should place, by convention, in sysdep.c).  */
-\f
-/* This is needed for dispnew.c:update_frame.  */
-#ifdef emacs
-#include <stdio.h>  /* Get the definition of _IO_STDIO_H.  */
-#if defined (_IO_STDIO_H) || defined (_STDIO_USES_IOSTREAM)
-/* New C libio names.  */
-#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
-  ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
-#elif defined (__UCLIBC__)
-/* Using the uClibc library.  */
-#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
-  ((FILE)->__bufpos - (FILE)->__bufstart)
-#else /* !_IO_STDIO_H && ! __UCLIBC__ */
-/* Old C++ iostream names.  */
-#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
-  ((FILE)->_pptr - (FILE)->_pbase)
-#endif /* !_IO_STDIO_H && ! __UCLIBC__ */
-
-#define INTERRUPT_INPUT
-#endif /* emacs */
-
-#define POSIX                 /* affects getpagesize.h and systty.h */
-
-/* This is to work around mysterious gcc failures in some system versions.
-   It is unlikely that Emacs changes will work around this problem;
-   therefore, this should remain permanently.  */
-#ifndef HAVE_XRMSETDATABASE
-#define HAVE_XRMSETDATABASE
-#endif
-
-#define NARROWPROTO 1
-
-/* Tell that garbage collector that setjmp is known to save all
-   registers relevant for conservative garbage collection in the jmp_buf.  */
-/* Not all the architectures are tested, but there are Debian packages
-   for SCM and/or Guile on them, so the technique must work.  See also
-   comments in alloc.c concerning setjmp and gcc.  Fixme:  it's
-   probably safe to make this conditional just on GCC, except for ia64
-   register window-flushing.  */
-/* Don't use #cpu here since in newest development versions of GCC,
-   we must call cpp with -traditional, and that disables #cpu.  */
-#if defined __i386__ || defined __sparc__ || defined __mc68000__ \
-    || defined __alpha__ || defined __mips__ || defined __s390__ \
-    || defined __arm__ || defined __powerpc__ || defined __amd64__ \
-    || defined __ia64__ || defined __sh__
-#define GC_SETJMP_WORKS 1
-#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-#ifdef __mc68000__
-#define GC_LISP_OBJECT_ALIGNMENT 2
-#endif
-#ifdef __ia64__
-#define GC_MARK_SECONDARY_STACK()                              \
-  do {                                                         \
-    extern void *__libc_ia64_register_backing_store_base;      \
-    __builtin_ia64_flushrs ();                                 \
-    mark_memory (__libc_ia64_register_backing_store_base,      \
-                __builtin_ia64_bsp ());                        \
-  } while (0)
-#endif
-#endif
diff --git a/src/s/gnu.h b/src/s/gnu.h
deleted file mode 100644 (file)
index 37aaa13..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Definitions file for GNU Emacs running on the GNU Hurd.
-
-Copyright (C) 1994-1996, 2001-2012  Free Software Foundation, Inc.
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
-
-
-/* Get most of the stuff from bsd-common */
-#include "bsd-common.h"
-
-#undef SYSTEM_TYPE
-#define SYSTEM_TYPE "gnu"
-
-#undef NLIST_STRUCT
-
-#define SIGNALS_VIA_CHARACTERS
-
-/* libc defines data_start.  */
-#define DATA_START ({ extern int data_start; (char *) &data_start; })
-
-/* Some losing code fails to include this and then assumes
-   that because it is braindead that O_RDONLY==0.  */
-#include <fcntl.h>
-
-#ifdef emacs
-#include <stdio.h>  /* Get the definition of _IO_STDIO_H.  */
-#if defined (_IO_STDIO_H) || defined (_STDIO_USES_IOSTREAM)
-/* new C libio names */
-#define GNU_LIBRARY_PENDING_OUTPUT_COUNT(FILE) \
-  ((FILE)->_IO_write_ptr - (FILE)->_IO_write_base)
-#endif /* !_IO_STDIO_H */
-#endif /* emacs */
-
-#define POSIX_SIGNALS 1
-
-/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method for marking the stack.  */
-#define GC_MARK_STACK  GC_MAKE_GCPROS_NOOPS
index becb5d3464e973434484f52710c7eee4221c410e..94b46a715ead845921a5ec7d906332257965bcc1 100644 (file)
@@ -17,91 +17,11 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-
-#define RUN_TIME_REMAP
-
-/* Define symbols to identify the version of Unix this is.
-   Define all the symbols that apply correctly.  */
-#define USG                            /* System III, System V, etc */
-#define USG5
-#define HPUX
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "hpux"
-
-/* Letter to use in finding device name of first pty,
-   if system supports pty's.  'p' means it is /dev/ptym/ptyp0  */
-#define FIRST_PTY_LETTER 'p'
-
-#define NO_TERMIO
-
-/* Define HAVE_PTYS if the system supports pty devices.  */
-#define HAVE_PTYS
-
-/* Define HAVE_SOCKETS if system supports 4.2-compatible sockets.  */
-#define HAVE_SOCKETS
-
-/* Define CLASH_DETECTION if you want lock files to be written
-   so that Emacs can tell instantly when you try to modify
-   a file that someone else has modified in his Emacs.  */
-#define CLASH_DETECTION
-
-/* Special hacks needed to make Emacs run on this system.  */
-
-/* In hpux, the symbol SIGIO is defined, but the feature
-   doesn't work in the way Emacs needs it to.  */
-#define BROKEN_SIGIO
-
-/* Some additional system facilities exist.  */
-#define HAVE_PERROR  /* Delete this line for version 6.  */
-
-/* This is how to get the device name of the tty end of a pty.  */
-#define PTY_TTY_NAME_SPRINTF \
-            sprintf (pty_name, "/dev/pty/tty%c%x", c, i);
-
-/* This is how to get the device name of the control end of a pty.  */
-#define PTY_NAME_SPRINTF \
-       sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);
-
-/* This triggers a conditional in xfaces.c.  */
-#define XOS_NEEDS_TIME_H
-
-/* Assar Westerlund <assar@sics.se> says this is necessary for
-   HP-UX 10.20, and that it works for HP-UX 0 as well.  */
-#define NO_EDITRES
-
-/* Eric Backus <ericb@lsid.hp.com> says, HP-UX 9.x on HP 700 machines
-   has a broken `rint' in some library versions including math library
-   version number A.09.05.
-
-   You can fix the math library by installing patch number PHSS_4630.
-   But we can fix it more reliably for Emacs like this.  */
-#undef HAVE_RINT
-
 /* We have to go this route, rather than hpux9's approach of renaming the
    functions via macros.  The system's stdlib.h has fully prototyped
    declarations, which yields a conflicting definition of srand48; it
    tries to redeclare what was once srandom to be srand48.  So we go
-   with HAVE_LRAND48 being defined.  */
+   with HAVE_LRAND48 being defined.
+   Note we also undef HAVE_RANDOM via configure.  */
 #undef srandom
 #undef random
-#undef HAVE_RANDOM
-
-
-/* Rainer Malzbender <rainer@displaytech.com> says defining
-   HAVE_XRMSETDATABASE allows Emacs to compile on HP-UX 10.20 using GCC.  */
-#ifndef HAVE_XRMSETDATABASE
-#define HAVE_XRMSETDATABASE
-#endif
-
-/* 2000-11-21: Temporarily disable Unix 98 large file support found by
-   configure.  It fails on HPUX 11, at least, because it enables
-   header sections which lose when `static' is defined away, as it is
-   on HP-UX.  (You get duplicate symbol errors on linking). */
-#undef _FILE_OFFSET_BITS
-\f
-/* The data segment on this machine always starts at address 0x40000000.  */
-#define DATA_SEG_BITS 0x40000000
-
-#define DATA_START    0x40000000
diff --git a/src/s/hpux11.h b/src/s/hpux11.h
deleted file mode 100644 (file)
index 40bcc98..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "hpux10-20.h"
-
-/* SA_RESTART resets the timeout of `select', so don't use it.  */
-#define BROKEN_SA_RESTART
-
-/* It does work on HPUX to open the pty's tty in the parent (Emacs),
-   then close and reopen it in the child.  */
-#define USG_SUBTTY_WORKS
-
index 32374498fe7a48e831e49bc589dd0b591b6a0002..9b21584546129f8ee91c2d4c3dde66a28d13a900 100644 (file)
@@ -17,89 +17,16 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-
-#define IRIX6_5                        /* used in m/iris4d */
 #include "usg5-4-common.h"
 
 #undef _longjmp /* use system versions, not conservative aliases */
 #undef _setjmp
 
-#define SETPGRP_RELEASES_CTTY
-
-#ifdef SYSTEM_TYPE
-#undef SYSTEM_TYPE
-#endif
-#define SYSTEM_TYPE "irix"
-
-#ifdef SETUP_SLAVE_PTY
-#undef SETUP_SLAVE_PTY
-#endif
-
-/* thomas@mathematik.uni-bremen.de says this is needed.  */
-/* Make process_send_signal work by "typing" a signal character on the pty.  */
-#define SIGNALS_VIA_CHARACTERS
-
-/* Letter to use in finding device name of first pty,
-   if system supports pty's.  'a' means it is /dev/ptya0  */
-#undef FIRST_PTY_LETTER
-#define FIRST_PTY_LETTER 'q'
-
-/* No need to use sprintf to get the tty name--we get that from _getpty.  */
-#define PTY_TTY_NAME_SPRINTF
-/* No need to get the pty name at all.  */
-#ifdef PTY_NAME_SPRINTF
-#undef PTY_NAME_SPRINTF
-#endif
-#define PTY_NAME_SPRINTF
 #ifdef emacs
 char *_getpty();
 #endif
-/* We need only try once to open a pty.  */
-#define PTY_ITERATION
-/* Here is how to do it.  */
-#define PTY_OPEN                                           \
-{                                                          \
-  struct sigaction ocstat, cstat;                          \
-  struct stat stb;                                         \
-  char * name;                                             \
-  sigemptyset(&cstat.sa_mask);                             \
-  cstat.sa_handler = SIG_DFL;                              \
-  cstat.sa_flags = 0;                                      \
-  sigaction(SIGCLD, &cstat, &ocstat);                      \
-  name = _getpty (&fd, O_RDWR | O_NDELAY, 0600, 0);        \
-  sigaction(SIGCLD, &ocstat, (struct sigaction *)0);       \
-  if (name == 0)                                           \
-    return -1;                                             \
-  if (fd < 0)                                              \
-    return -1;                                             \
-  if (fstat (fd, &stb) < 0)                                \
-    return -1;                                             \
-  strcpy (pty_name, name);                                 \
-}
-
-/* Ulimit(UL_GMEMLIM) is busted...  */
-#define ULIMIT_BREAK_VALUE 0x14000000
-
-/* Tell process_send_signal to use VSUSP instead of VSWTCH.  */
-#define PREFER_VSUSP
-
-#define NARROWPROTO 1
 
-#if _MIPS_SZLONG == 64         /* -mabi=64 (gcc) or -64 (MIPSpro) */
-#define _LP64                  /* lisp.h takes care of the rest */
-#endif /* _MIPS_SZLONG */
-
-#undef SA_RESTART
+#undef SA_RESTART     /* not the same as defining BROKEN_SA_RESTART */
 
 #undef TIOCSIGSEND             /* defined in usg5-4-common.h */
 
-/* Tested on Irix 6.5.  SCM worked on earlier versions.  */
-#define GC_SETJMP_WORKS 1
-#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
-
-
-/* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which
-   were stored in a Lisp_Object (as Emacs uses fewer than 32 bits for
-   the value field of a LISP_OBJECT).  */
-#define DATA_START 0x10000000
-#define DATA_SEG_BITS  0x10000000
index e89ecb0593189857d367b4659ed6c911026e057a..7128d8a069dc68fb9c882f74c9f2493deccb63f0 100644 (file)
@@ -27,6 +27,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define DOS_NT         /* MSDOS or WINDOWSNT */
 #endif
 
+/* #undef const */
+
 /* If you are compiling with a non-C calling convention but need to
    declare vararg routines differently, put it here.  */
 #define _VARARGS_ __cdecl
@@ -36,23 +38,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    convention must be whatever standard the libraries expect.  */
 #define _CALLBACK_ __cdecl
 
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "windows-nt"
-
-#define NO_MATHERR 1
-
-/* Letter to use in finding device name of first pty,
-   if system supports pty's.  'a' means it is /dev/ptya0  */
-#define FIRST_PTY_LETTER 'a'
-
 /* Define HAVE_TIMEVAL if the system supports the BSD style clock values.
    Look in <sys/time.h> for a timeval structure.  */
 #define HAVE_TIMEVAL 1
 
-/* NT supports Winsock which is close enough (with some hacks).  */
-#define HAVE_SOCKETS 1
-
 /* But our select implementation doesn't allow us to make non-blocking
    connects.  So until that is fixed, this is necessary:  */
 #define BROKEN_NON_BLOCKING_CONNECT 1
@@ -61,14 +50,25 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    for received packets, so datagrams are broken too.  */
 #define BROKEN_DATAGRAM_SOCKETS 1
 
-#define MAIL_USE_POP 1
 #define MAIL_USE_SYSTEM_LOCK 1
 
 /* If the character used to separate elements of the executable path
    is not ':', #define this to be the appropriate character constant.  */
 #define SEPCHAR ';'
 
-#define ORDINARY_LINK 1
+/* Define to 1 if GCC-style __attribute__ ((__aligned__ (expr))) works. */
+#ifdef __GNUC__
+#define HAVE_ATTRIBUTE_ALIGNED 1
+#endif
+
+/* Define to 1 if strtold conforms to C99. */
+#ifdef __GNUC__
+#define HAVE_C99_STRTOLD 1
+#endif
+
+#if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
+#define HAVE___BUILTIN_UNWIND_INIT 1
+#endif
 
 /* ============================================================ */
 
@@ -85,6 +85,46 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
 
+#ifdef __GNUC__
+#ifndef __cplusplus
+#undef inline
+#endif
+#else  /* MSVC */
+#define inline __inline
+#endif
+
+#ifdef __GNUC__
+# define restrict __restrict__
+#else
+# define restrict
+#endif
+
+/* `mode_t' is not defined for MSVC. Define. */
+#ifdef _MSC_VER
+typedef unsigned short mode_t;
+#endif
+
+/* A va_copy replacement for MSVC.  */
+#ifdef _MSC_VER
+# ifdef _WIN64
+#  ifndef va_copy               /* Need to be checked (?) */
+#   define va_copy(d,s) ((d) = (s))
+#  endif
+# else /* not _WIN64 */
+#  define va_copy(d,s) ((d) = (s))
+# endif         /* not _WIN64 */
+#endif  /* _MSC_VER */
+
+#ifndef WINDOWSNT
+/* Some of the files of Emacs which are intended for use with other
+   programs assume that if you have a config.h file, you must declare
+   the type of getenv.  */
+extern char *getenv ();
+#endif
+
+#ifdef HAVE_STRINGS_H
+#include "strings.h"
+#endif
 #include <sys/types.h>
 
 #ifdef _MSC_VER
@@ -108,79 +148,6 @@ struct sigaction {
 #define MAXPATHLEN      _MAX_PATH
 #endif
 
-#define HAVE_SOUND  1
-#define LISP_FLOAT_TYPE 1
-
-#define HAVE_SYS_TIMEB_H 1
-#define HAVE_SYS_TIME_H 1
-#define HAVE_UNISTD_H 1
-#undef  HAVE_UTIME_H
-#undef  HAVE_LINUX_VERSION_H
-#undef  HAVE_SYS_SYSTEMINFO_H
-#define HAVE_PWD_H 1
-#define TIME_WITH_SYS_TIME 1
-
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_GETHOSTNAME 1
-#undef  HAVE_GETDOMAINNAME
-#define HAVE_DUP2 1
-#define HAVE_RENAME 1
-#define HAVE_CLOSEDIR 1
-#define HAVE_FSYNC 1           /* fsync is called _commit in MSVC.  */
-
-#undef  TM_IN_SYS_TIME
-#undef  HAVE_TM_ZONE
-
-#define HAVE_LONG_FILE_NAMES 1
-
-#define HAVE_MKDIR 1
-#define HAVE_RMDIR 1
-#define HAVE_RANDOM 1
-#undef  HAVE_SYSINFO
-#undef  HAVE_LRAND48
-#define HAVE_MEMCMP 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMSET 1
-#define HAVE_LOGB 1
-#define HAVE_FREXP 1
-#define HAVE_FMOD 1
-#undef  HAVE_RINT
-#undef  HAVE_CBRT
-#define HAVE_FTIME 1
-#undef  HAVE_RES_INIT /* For -lresolv on Suns.  */
-#undef  HAVE_SETSID
-#undef  HAVE_FPATHCONF
-#define HAVE_SELECT 1
-#undef  HAVE_EUIDACCESS
-#define HAVE_GETPAGESIZE 1
-#define HAVE_TZSET 1
-#define HAVE_SETLOCALE 1
-#undef  HAVE_UTIMES
-#undef  HAVE_SETRLIMIT
-#undef  HAVE_SETPGID
-/* If you think about defining HAVE_GETCWD, don't: the alternative
-   getwd is redefined on w32.c, and does not really return the current
-   directory, to get the desired results elsewhere in Emacs */
-#undef  HAVE_GETCWD
-#define HAVE_SHUTDOWN 1
-
-#define LOCALTIME_CACHE
-#define HAVE_INET_SOCKETS 1
-
-#undef  HAVE_AIX_SMT_EXP
-#define USE_TOOLKIT_SCROLL_BARS 1
-
-/* Define if you have the ANSI `strerror' function.
-   Otherwise you must have the variable `char *sys_errlist[]'.  */
-#define HAVE_STRERROR 1
-
-/* Define if `struct utimbuf' is declared by <utime.h>.  */
-#undef  HAVE_STRUCT_UTIMBUF
-
-#define HAVE_MOUSE 1
-#define HAVE_H_ERRNO 1
-
 #ifdef HAVE_NTGUI
 #define HAVE_WINDOW_SYSTEM 1
 #define HAVE_MENUS 1
@@ -232,6 +199,7 @@ struct sigaction {
 #define rename  sys_rename
 #define rmdir   sys_rmdir
 #define select  sys_select
+#define pselect sys_select
 #define sleep   sys_sleep
 #define strerror sys_strerror
 #undef unlink
@@ -301,6 +269,15 @@ typedef int pid_t;
 #define utime    _utime
 #endif
 
+/* 'struct timespec' is used by time-related functions in lib/ and
+   elsewhere, but we don't use lib/time.h where the structure is
+   defined.  */
+struct timespec
+{
+  time_t       tv_sec;         /* seconds */
+  long int     tv_nsec;        /* nanoseconds */
+};
+
 /* This is hacky, but is necessary to avoid warnings about macro
    redefinitions using the SDK compilers.  */
 #ifndef __STDC__
@@ -347,6 +324,13 @@ extern char *get_emacs_configuration_options (void);
 #define _WINSOCKAPI_    1
 #define _WINSOCK_H
 
+/* Prevent accidental use of features unavailable in
+   older Windows versions we still support.  */
+#define _WIN32_WINNT 0x0400
+
+/* Make a leaner executable.  */
+#define WIN32_LEAN_AND_MEAN 1
+
 /* Defines size_t and alloca ().  */
 #ifdef emacs
 #define malloc e_malloc
@@ -360,6 +344,16 @@ extern char *get_emacs_configuration_options (void);
 #include <malloc.h>
 #endif
 
+/* stdlib.h must be included after redefining malloc & friends, but
+   before redefining abort.  Isn't library redefinition funny?  */
+#include <stdlib.h>
+
+/* Redefine abort.  */
+#ifdef HAVE_NTGUI
+#define abort  w32_abort
+extern _Noreturn void w32_abort (void);
+#endif
+
 #include <sys/stat.h>
 
 /* Define for those source files that do not include enough NT system files.  */
@@ -372,17 +366,41 @@ extern char *get_emacs_configuration_options (void);
 #endif
 
 /* For proper declaration of environ.  */
-#include <stdlib.h>
 #ifndef sys_nerr
 #define sys_nerr _sys_nerr
 #endif
-#include <string.h>
 
 extern int getloadavg (double *, int);
 
+#if defined (__MINGW32__) || _MSC_VER >= 1400
+
+/* Define to 1 if the system has the type `long long int'. */
+# define HAVE_LONG_LONG_INT 1
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+# define HAVE_UNSIGNED_LONG_LONG_INT 1
+
+#elif _MSC_VER >= 1200
+
+/* Temporarily disable wider-than-pointer integers until they're tested more.
+   Build with CFLAGS='-DWIDE_EMACS_INT' to try them out.  */
+
+# ifdef WIDE_EMACS_INT
+
+/* Use pre-C99-style 64-bit integers.  */
+# define EMACS_INT __int64
+# define EMACS_INT_MAX _I64_MAX
+# define pI "I64"
+
+# endif
+
+#endif
+
 /* We need a little extra space, see ../../lisp/loadup.el.  */
 #define SYSTEM_PURESIZE_EXTRA 50000
 
+#define DATA_START     get_data_start ()
+
 /* For unexec to work on Alpha systems, we need to put Emacs'
    initialized data into a separate section from the CRT initialized
    data (because the Alpha linker freely reorders data variables, even
@@ -415,5 +433,4 @@ extern void _DebPrint (const char *fmt, ...);
 #define DebPrint(stuff)
 #endif
 
-
 /* ============================================================ */
index d2058f2e4256d09d3308712d11ad45d65b85059c..15112dad7a7840680ef61975677d16509150d030 100644 (file)
@@ -31,11 +31,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 #endif
 
 #define DOS_NT /* MSDOS or WINDOWSNT */
-#undef BSD_SYSTEM
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "ms-dos"
 
 /* subprocesses should be defined if you want to have code for
    asynchronous subprocesses (as used in M-x compile and M-x shell).
@@ -48,10 +43,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
    different things on your system and must be used only through an
    encapsulation (which you should place, by convention, in sysdep.c).  */
 \f
-/* Avoid incompatibilities between gmalloc.c and system header files
-   in how to declare valloc.  */
-#define GMALLOC_INHIBIT_VALLOC
-
 /* This overrides the default value on editfns.c, since DJGPP
    does not have pw->pw_gecos.  */
 #define USER_FULL_NAME (getenv ("NAME"))
@@ -61,15 +52,16 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 #define _setjmp setjmp
 #define _longjmp longjmp
 
-#define DATA_START  (&etext + 1)
-
 #define _NAIVE_DOS_REGS
 
-/* command.com does not understand `...` so we define this.  */
+/* Used by emacs.c:decode_env_path.  */
 #define SEPCHAR ';'
 
+/* Used by callproc.c (and process.c, but in the part not compiled on
+   MSDOS).  The default is defined on process.h.  */
 #define NULL_DEVICE "nul"
 
+/* Used by floatfns.c.  */
 #define HAVE_INVERSE_HYPERBOLIC
 #define FLOAT_CHECK_DOMAIN
 
@@ -94,23 +86,14 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
 :se=</SO>:so=<SO>:us=<UL>:ue=</UL>:md=<BD>:mh=<DIM>:mb=<BL>:mr=<RV>:me=<NV>:\
 :AB=<BG %d>:AF=<FG %d>:op=<DefC>:"
 
-/* Define this to be the separator between devices and paths.  */
+/* Define this to be the separator between devices and paths.  Used by
+   lisp.h to define IS_DEVICE_SEP.  */
 #define DEVICE_SEP ':'
 
-/* We'll support either convention on MSDOG.  */
+/* We'll support either convention of slashes on MSDOS.  */
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
 #define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
 
-
-/* Mode line description of a buffer's type.  */
-#define MODE_LINE_BINARY_TEXT(buf) (NILP(B_(buf,buffer_file_type)) ? "T" : "B")
-
-/* We have (the code to control) a mouse.  */
-#define HAVE_MOUSE
-
-/* We can use mouse menus.  */
-#define HAVE_MENUS
-
 /* Define one of these for easier conditionals.  */
 #ifdef HAVE_X_WINDOWS
 /* We need a little extra space, see ../../lisp/loadup.el and the
@@ -129,8 +112,3 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */
    enlarging Emacs footprint by another 100+ KBytes.  */
 #define SYSTEM_PURESIZE_EXTRA (-170000+65000)
 #endif
-
-/* Tell the garbage collector that setjmp is known to save all
-   registers relevant for conservative garbage collection in the jmp_buf.  */
-#define GC_SETJMP_WORKS 1
-#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
index f25023fb615b321cf985ff78e55c7aff393273ac..7a571ee811671264d7a80870a732a4d5796faf41 100644 (file)
@@ -17,27 +17,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-
-/* Get most of the stuff from bsd-common.  */
-#include "bsd-common.h"
-
-#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
-
-#define DEFAULT_SOUND_DEVICE "/dev/audio"
-
 /* Greg A. Woods <woods@weird.com> says we must include signal.h
    before syssignal.h is included, to work around interface conflicts
    that are handled with CPP __RENAME() macro in signal.h.  */
 #include <signal.h>
 
-/* Don't close pty in process.c to make it as controlling terminal.
-   It is already a controlling terminal of subprocess, because we did
-   ioctl TIOCSCTTY.  */
-#define DONT_REOPEN_PTY
-
-/* Tell that garbage collector that setjmp is known to save all
-   registers relevant for conservative garbage collection in the jmp_buf.  */
-#define GC_SETJMP_WORKS 1
-
-/* Use the GC_MAKE_GCPROS_NOOPS (see lisp.h) method.  */
-#define GC_MARK_STACK  GC_MAKE_GCPROS_NOOPS
diff --git a/src/s/openbsd.h b/src/s/openbsd.h
deleted file mode 100644 (file)
index 0a8bab2..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/* System file for openbsd.  */
-
-/* Nearly the same as NetBSD.  Note there are differences in configure.  */
-#include "netbsd.h"
-
-/* The symbol SIGIO is defined, but the feature doesn't work in the
-   way Emacs needs it to.  See
-   <http://article.gmane.org/gmane.os.openbsd.ports/46831>.  */
-#define BROKEN_SIGIO
diff --git a/src/s/sol2-10.h b/src/s/sol2-10.h
deleted file mode 100644 (file)
index b20476e..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Handle Solaris 2.10.  */
-
-#include "sol2-6.h"
-
-/* This is used in list_system_processes.  */
-#define HAVE_PROCFS 1
-
-/* This is needed for the system_process_attributes implementation.  */
-#define _STRUCTURED_PROC 1
-
index a9fefcb199293a11b44ded79ba0cda86cfc69080..3bed55598b7a6573374378e9d7c71516377257ea 100644 (file)
@@ -19,44 +19,3 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "usg5-4-common.h"
 
-#define SOLARIS2
-
-/* This triggers a conditional in xfaces.c.  */
-#define XOS_NEEDS_TIME_H
-
-#define POSIX
-
-/* Prefer kstat over kvm in getloadavg.c, kstat doesn't require root.
-   ghazi@caip.rutgers.edu, 7/21/97.  Don't redefine if already defined
-   (e.g., by config.h). */
-#ifndef HAVE_LIBKSTAT
-#define HAVE_LIBKSTAT
-#endif
-
-/* This is the same definition as in usg5-4-common.h, but with sigblock/sigunblock
-   rather than sighold/sigrelse, which appear to be BSD4.1 specific.
-   It may also be appropriate for SVR4.x
-   (x<2) but I'm not sure.   fnf@cygnus.com */
-/* This sets the name of the slave side of the PTY.  On SysVr4,
-   grantpt(3) forks a subprocess, so keep sigchld_handler() from
-   intercepting that death.  If any child but grantpt's should die
-   within, it should be caught after sigrelse(2). */
-
-#define PTY_TTY_NAME_SPRINTF                   \
-  {                                            \
-    char *ptsname (int), *ptyname;             \
-                                               \
-    sigblock (sigmask (SIGCLD));               \
-    if (grantpt (fd) == -1)                    \
-      { emacs_close (fd); return -1; }         \
-    sigunblock (sigmask (SIGCLD));             \
-    if (unlockpt (fd) == -1)                   \
-      { emacs_close (fd); return -1; }         \
-    if (!(ptyname = ptsname (fd)))             \
-      { emacs_close (fd); return -1; }         \
-    strncpy (pty_name, ptyname, sizeof (pty_name)); \
-    pty_name[sizeof (pty_name) - 1] = 0;       \
-  }
-
-#define GC_SETJMP_WORKS 1
-#define GC_MARK_STACK GC_MAKE_GCPROS_NOOPS
index 527694bd4bb3ba257564a411c31bb88a5482dd7a..e6f43896aacaee876e0a613be50e4a59a0e25ee8 100644 (file)
@@ -19,52 +19,6 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-
-/* Define symbols to identify the version of Unix this is.
-   Define all the symbols that apply correctly.  */
-
-/* #define USG5 */
-/* #define USG */
-/* #define HPUX */
-/* #define BSD4_2 */
-/* #define BSD4_3 */
-/* #define BSD_SYSTEM */
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-
-#define SYSTEM_TYPE "berkeley-unix"
-
-/* Emacs can read input using SIGIO and buffering characters itself,
-   or using CBREAK mode and making C-g cause SIGINT.
-   The choice is controlled by the variable interrupt_input.
-
-   Define INTERRUPT_INPUT to make interrupt_input = 1 the default (use SIGIO)
-
-   Emacs uses the presence or absence of the SIGIO and BROKEN_SIGIO macros
-   to indicate whether or not signal-driven I/O is possible.  It uses
-   INTERRUPT_INPUT to decide whether to use it by default.
-
-   SIGIO can be used only on systems that implement it (4.2 and 4.3).
-   CBREAK mode has two disadvantages
-     1) At least in 4.2, it is impossible to handle the Meta key properly.
-        I hear that in system V this problem does not exist.
-     2) Control-G causes output to be discarded.
-        I do not know whether this can be fixed in system V.
-
-   Another method of doing input is planned but not implemented.
-   It would have Emacs fork off a separate process
-   to read the input and send it to the true Emacs process
-   through a pipe.  */
-#define INTERRUPT_INPUT
-
-/* Letter to use in finding device name of first pty,
-   if system supports pty's.  'a' means it is /dev/ptya0.  */
-#define FIRST_PTY_LETTER 'a'
-
-/* Define HAVE_PTYS if the system supports pty devices.  */
-#define HAVE_PTYS
-
 /* subprocesses should be undefined if you do NOT want to
    have code for asynchronous subprocesses
    (as used in M-x compile and M-x shell).
@@ -72,11 +26,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* #undef subprocesses */
 
-/* Define CLASH_DETECTION if you want lock files to be written
-   so that Emacs can tell instantly when you try to modify
-   a file that someone else has modified in his Emacs.  */
-#define CLASH_DETECTION
-
 /* If the character used to separate elements of the executable path
    is not ':', #define this to be the appropriate character constant.  */
 /* #define SEPCHAR ':' */
@@ -89,25 +38,16 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    your system and must be used only through an encapsulation (which
    you should place, by convention, in sysdep.c).  */
 
-/* If the system's imake configuration file defines `NeedWidePrototypes'
-   as `NO', we must define NARROWPROTO manually.  Such a define is
-   generated in the Makefile generated by `xmkmf'.  If we don't
-   define NARROWPROTO, we will see the wrong function prototypes
-   for X functions taking float or double parameters.  */
-
-/*  #define NARROWPROTO 1 */
-
 /* ============================================================ */
 
 /* After adding support for a new system, modify the large case
-   statement in configure.in to recognize reasonable
+   statement in configure.ac to recognize reasonable
    configuration names, and add a description of the system to
    `etc/MACHINES'.
 
-   Check for any tests of $opsys in configure.in, and add an entry
+   Check for any tests of $opsys in configure.ac, and add an entry
    for the new system if needed.
 
    If you've just fixed a problem in an existing configuration file,
    you should also check `etc/MACHINES' to make sure its descriptions
    of known problems in that configuration should be updated.  */
-
index 22c396a060e9612298dea201fd9d9b3402abed04..59c74a56f4e0ce657ded6f128f887d55e5538b7a 100644 (file)
@@ -17,36 +17,4 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-
 #include "usg5-4-common.h"
-
-/* #define HAVE_GETWD  (appears to be buggy on SVR4.2) */
-#undef HAVE_GETWD
-
-#undef HAVE_SYSV_SIGPAUSE
-
-/* This is the same definition as in usg5-4-common.h, but with sigblock/sigunblock
-   rather than sighold/sigrelse, which appear to be BSD4.1 specific.
-   It may also be appropriate for SVR4.x
-   (x<2) but I'm not sure.   fnf@cygnus.com */
-/* This sets the name of the slave side of the PTY.  On SysVr4,
-   grantpt(3) forks a subprocess, so keep sigchld_handler() from
-   intercepting that death.  If any child but grantpt's should die
-   within, it should be caught after sigrelse(2).  */
-#define PTY_TTY_NAME_SPRINTF                   \
-  {                                            \
-    char *ptsname (int), *ptyname;             \
-                                               \
-    sigblock(sigmask(SIGCLD));                 \
-    if (grantpt(fd) == -1)                     \
-      fatal("could not grant slave pty");      \
-    sigunblock(sigmask(SIGCLD));               \
-    if (unlockpt(fd) == -1)                    \
-      fatal("could not unlock slave pty");     \
-    if (!(ptyname = ptsname(fd)))              \
-      fatal ("could not enable slave pty");    \
-    strncpy(pty_name, ptyname, sizeof(pty_name)); \
-    pty_name[sizeof(pty_name) - 1] = 0;                \
-  }
-
-#define        PENDING_OUTPUT_COUNT(FILE) ((FILE)->__ptr - (FILE)->__base)
index fabdd66f3bb441a874014fdaab27b19578a3a770..6ead01d3712a6d01146eea03cd553e51c481cac4 100644 (file)
@@ -20,27 +20,13 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-/* Use the SysVr3 file for at least base configuration.  */
-#define USG                            /* System III, System V, etc */
-
-#define USG5
-#define USG5_4
-
-/* SYSTEM_TYPE should indicate the kind of system you are using.
-   It sets the Lisp variable system-type.  */
-#define SYSTEM_TYPE "usg-unix-v"
-
 /* setjmp and longjmp can safely replace _setjmp and _longjmp,
    but they will run slower.  */
 #define _setjmp setjmp
 #define _longjmp longjmp
 
-/* The docs for system V/386 suggest v.3 has sigpause, so let's try it.  */
-#define HAVE_SYSV_SIGPAUSE
-
 /* Get FIONREAD from <sys/filio.h>.  Get <sys/ttold.h> to get struct tchars.
-   But get <termio.h> first to make sure ttold.h doesn't interfere.
-   And don't try to use SIGIO yet.  */
+   But get <termio.h> first to make sure ttold.h doesn't interfere.  */
 #include <sys/wait.h>
 
 #ifdef emacs
@@ -51,20 +37,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <sys/stream.h>
 #include <sys/stropts.h>
 #include <sys/termios.h>
-#define BROKEN_SIGIO
 #endif
 
-/* Some SVr4s don't define NSIG in sys/signal.h for ANSI environments;
-   instead, there's a system variable _sys_nsig.  Unfortunately, we need the
-   constant to dimension an array.  So wire in the appropriate value here.  */
-#define NSIG_MINIMUM 32
-
-/* We can support this.  */
-#define CLASH_DETECTION
-
-/* Define HAVE_PTYS if the system supports pty devices.  */
-#define HAVE_PTYS
-
 /* It is possible to receive SIGCHLD when there are no children
    waiting, because a previous waitsys(2) cleaned up the carcass of child
    without clearing the SIGCHLD pending info.  So, use a non-blocking
@@ -78,21 +52,3 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    this is all we need.  */
 #define TIOCSIGSEND TIOCSIGNAL
 
-/* This change means that we don't loop through allocate_pty too many
-   times in the (rare) event of a failure.  */
-#define FIRST_PTY_LETTER 'z'
-
-/* This sets the name of the master side of the PTY.  */
-#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
-
-/* Push various streams modules onto a PTY channel.  */
-#define SETUP_SLAVE_PTY \
-  if (ioctl (xforkin, I_PUSH, "ptem") == -1)   \
-    fatal ("ioctl I_PUSH ptem");               \
-  if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
-    fatal ("ioctl I_PUSH ldterm");     \
-  if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) \
-    fatal ("ioctl I_PUSH ttcompat");
-
-/* This definition was suggested for next release.  So give it a try.  */
-#define HAVE_SOCKETS
index 77ea1007ade9cf38e1eb45d227218bfc94bbeb6a..78ebe65bdcce308efa76842f4d007b4a7664ad5a 100644 (file)
@@ -94,7 +94,7 @@ calculate_scrolling (FRAME_PTR frame,
                     int free_at_end)
 {
   register int i, j;
-  EMACS_INT frame_lines = FRAME_LINES (frame);
+  int frame_lines = FRAME_LINES (frame);
   register struct matrix_elt *p, *p1;
   register int cost, cost1;
 
@@ -253,24 +253,24 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
   /* A queue for line insertions to be done.  */
   struct queue { int count, pos; };
   struct queue *queue_start
-    = (struct queue *) alloca (current_matrix->nrows * sizeof (struct queue));
+    = alloca (current_matrix->nrows * sizeof *queue_start);
   struct queue *queue = queue_start;
 
-  char *retained_p = (char *) alloca (window_size * sizeof (char));
-  int *copy_from = (int *) alloca (window_size * sizeof (int));
+  char *retained_p = alloca (window_size * sizeof *retained_p);
+  int *copy_from = alloca (window_size * sizeof *copy_from);
 
   /* Zero means line is empty.  */
   memset (retained_p, 0, window_size * sizeof (char));
   for (k = 0; k < window_size; ++k)
     copy_from[k] = -1;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 # define CHECK_BOUNDS                                                  \
   do                                                                   \
     {                                                                  \
       int ck;                                                          \
       for (ck = 0; ck < window_size; ++ck)                             \
-       xassert (copy_from[ck] == -1                                    \
+       eassert (copy_from[ck] == -1                                    \
                 || (copy_from[ck] >= 0 && copy_from[ck] < window_size)); \
     }                                                                  \
   while (0);
@@ -317,12 +317,12 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
        {
          /* Best thing done here is no insert or delete, i.e. a write.  */
          --i, --j;
-         xassert (i >= 0 && i < window_size);
-         xassert (j >= 0 && j < window_size);
+         eassert (i >= 0 && i < window_size);
+         eassert (j >= 0 && j < window_size);
          copy_from[i] = j;
          retained_p[j] = 1;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
          CHECK_BOUNDS;
 #endif
        }
@@ -368,13 +368,13 @@ do_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
     }
 
   for (k = 0; k < window_size; ++k)
-    xassert (copy_from[k] >= 0 && copy_from[k] < window_size);
+    eassert (copy_from[k] >= 0 && copy_from[k] < window_size);
 
   /* Perform the row swizzling.  */
   mirrored_line_dance (current_matrix, unchanged_at_top, window_size,
                       copy_from, retained_p);
 
-  /* Some sanity checks if GLYPH_DEBUG != 0.  */
+  /* Some sanity checks if GLYPH_DEBUG is defined.  */
   CHECK_MATRIX (current_matrix);
 
   if (terminal_window_p)
@@ -432,7 +432,7 @@ calculate_direct_scrolling (FRAME_PTR frame,
                            int free_at_end)
 {
   register int i, j;
-  EMACS_INT frame_lines = FRAME_LINES (frame);
+  int frame_lines = FRAME_LINES (frame);
   register struct matrix_elt *p, *p1;
   register int cost, cost1, delta;
 
@@ -671,11 +671,11 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
   int write_follows_p = 1;
 
   /* For each row in the new matrix what row of the old matrix it is.  */
-  int *copy_from = (int *) alloca (window_size * sizeof (int));
+  int *copy_from = alloca (window_size * sizeof *copy_from);
 
   /* Non-zero for each row in the new matrix that is retained from the
      old matrix.  Lines not retained are empty.  */
-  char *retained_p = (char *) alloca (window_size * sizeof (char));
+  char *retained_p = alloca (window_size * sizeof *retained_p);
 
   memset (retained_p, 0, window_size * sizeof (char));
 
@@ -728,7 +728,7 @@ do_direct_scrolling (struct frame *frame, struct glyph_matrix *current_matrix,
             place they belong.  */
          int n_to_write = p->writecount;
          write_follows_p = 1;
-         xassert (n_to_write > 0);
+         eassert (n_to_write > 0);
 
          if (i > j)
            {
@@ -889,8 +889,8 @@ static void
 line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn,
               register int *ov, register int *mf)
 {
-  register EMACS_INT i;
-  register EMACS_INT frame_lines = FRAME_LINES (frame);
+  register int i;
+  register int frame_lines = FRAME_LINES (frame);
   register int insert_overhead = ov1 * 10;
   register int next_insert_cost = ovn * 10;
 
index 26fc7396555ad570d67d020b0799d08be573593b..118cec4af481cdd199a84fef938173f35c8936a6 100644 (file)
@@ -24,8 +24,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "syntax.h"
 #include "category.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "region-cache.h"
 #include "commands.h"
@@ -90,20 +90,19 @@ static Lisp_Object Qinvalid_regexp;
 /* Error condition used for failing searches.  */
 static Lisp_Object Qsearch_failed;
 
-static void set_search_regs (EMACS_INT, EMACS_INT);
+static void set_search_regs (ptrdiff_t, ptrdiff_t);
 static void save_search_regs (void);
-static EMACS_INT simple_search (EMACS_INT, unsigned char *, EMACS_INT,
-                               EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT,
-                                EMACS_INT, EMACS_INT);
-static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT,
-                              Lisp_Object, Lisp_Object, EMACS_INT,
-                              EMACS_INT, int);
-static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT,
-                                EMACS_INT, EMACS_INT, EMACS_INT, int,
+static EMACS_INT simple_search (EMACS_INT, unsigned char *, ptrdiff_t,
+                               ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t,
+                                ptrdiff_t, ptrdiff_t);
+static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, ptrdiff_t,
+                              Lisp_Object, Lisp_Object, ptrdiff_t,
+                              ptrdiff_t, int);
+static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t,
+                                ptrdiff_t, ptrdiff_t, EMACS_INT, int,
                                 Lisp_Object, Lisp_Object, int);
-static void matcher_overflow (void) NO_RETURN;
 
-static void
+static _Noreturn void
 matcher_overflow (void)
 {
   error ("Stack overflow in regexp matcher");
@@ -176,8 +175,7 @@ shrink_regexp_cache (void)
   for (cp = searchbuf_head; cp != 0; cp = cp->next)
     {
       cp->buf.allocated = cp->buf.used;
-      cp->buf.buffer
-       = (unsigned char *) xrealloc (cp->buf.buffer, cp->buf.used);
+      cp->buf.buffer = xrealloc (cp->buf.buffer, cp->buf.used);
     }
 }
 
@@ -272,8 +270,8 @@ looking_at_1 (Lisp_Object string, int posix)
 {
   Lisp_Object val;
   unsigned char *p1, *p2;
-  EMACS_INT s1, s2;
-  register EMACS_INT i;
+  ptrdiff_t s1, s2;
+  register ptrdiff_t i;
   struct re_pattern_buffer *bufp;
 
   if (running_asynch_code)
@@ -368,10 +366,10 @@ data if you want to preserve them.  */)
 static Lisp_Object
 string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix)
 {
-  EMACS_INT val;
+  ptrdiff_t val;
   struct re_pattern_buffer *bufp;
-  EMACS_INT pos, pos_byte;
-  int i;
+  EMACS_INT pos;
+  ptrdiff_t pos_byte, i;
 
   if (running_asynch_code)
     save_search_regs ();
@@ -383,7 +381,7 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int p
     pos = 0, pos_byte = 0;
   else
     {
-      EMACS_INT len = SCHARS (string);
+      ptrdiff_t len = SCHARS (string);
 
       CHECK_NUMBER (start);
       pos = XINT (start);
@@ -468,10 +466,10 @@ matched by parenthesis constructs in the pattern.  */)
    and return the index of the match, or negative on failure.
    This does not clobber the match data.  */
 
-EMACS_INT
+ptrdiff_t
 fast_string_match (Lisp_Object regexp, Lisp_Object string)
 {
-  EMACS_INT val;
+  ptrdiff_t val;
   struct re_pattern_buffer *bufp;
 
   bufp = compile_pattern (regexp, 0, Qnil,
@@ -491,12 +489,12 @@ fast_string_match (Lisp_Object regexp, Lisp_Object string)
    This does not clobber the match data.
    We assume that STRING contains single-byte characters.  */
 
-EMACS_INT
-fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string)
+ptrdiff_t
+fast_c_string_match_ignore_case (Lisp_Object regexp,
+                                const char *string, ptrdiff_t len)
 {
-  EMACS_INT val;
+  ptrdiff_t val;
   struct re_pattern_buffer *bufp;
-  size_t len = strlen (string);
 
   regexp = string_make_unibyte (regexp);
   re_match_object = Qt;
@@ -511,10 +509,10 @@ fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string)
 
 /* Like fast_string_match but ignore case.  */
 
-EMACS_INT
+ptrdiff_t
 fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
 {
-  EMACS_INT val;
+  ptrdiff_t val;
   struct re_pattern_buffer *bufp;
 
   bufp = compile_pattern (regexp, 0, Vascii_canon_table,
@@ -535,14 +533,14 @@ fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string)
    indices into the string.  This function doesn't modify the match
    data.  */
 
-EMACS_INT
-fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT limit, EMACS_INT limit_byte, Lisp_Object string)
+ptrdiff_t
+fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t limit, ptrdiff_t limit_byte, Lisp_Object string)
 {
   int multibyte;
   struct re_pattern_buffer *buf;
   unsigned char *p1, *p2;
-  EMACS_INT s1, s2;
-  EMACS_INT len;
+  ptrdiff_t s1, s2;
+  ptrdiff_t len;
 
   if (STRINGP (string))
     {
@@ -641,9 +639,9 @@ newline_cache_on_off (struct buffer *buf)
    If ALLOW_QUIT is non-zero, set immediate_quit.  That's good to do
    except when inside redisplay.  */
 
-EMACS_INT
-scan_buffer (register int target, EMACS_INT start, EMACS_INT end,
-            EMACS_INT count, EMACS_INT *shortage, int allow_quit)
+ptrdiff_t
+scan_buffer (register int target, ptrdiff_t start, ptrdiff_t end,
+            ptrdiff_t count, ptrdiff_t *shortage, int allow_quit)
 {
   struct region_cache *newline_cache;
   int direction;
@@ -675,9 +673,9 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end,
            the position of the last character before the next such
            obstacle --- the last character the dumb search loop should
            examine.  */
-       EMACS_INT ceiling_byte = CHAR_TO_BYTE (end) - 1;
-       EMACS_INT start_byte = CHAR_TO_BYTE (start);
-       EMACS_INT tem;
+       ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end) - 1;
+       ptrdiff_t start_byte = CHAR_TO_BYTE (start);
+       ptrdiff_t tem;
 
         /* If we're looking for a newline, consult the newline cache
            to see where we can avoid some scanning.  */
@@ -748,9 +746,9 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end,
     while (start > end)
       {
         /* The last character to check before the next obstacle.  */
-       EMACS_INT ceiling_byte = CHAR_TO_BYTE (end);
-       EMACS_INT start_byte = CHAR_TO_BYTE (start);
-       EMACS_INT tem;
+       ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end);
+       ptrdiff_t start_byte = CHAR_TO_BYTE (start);
+       ptrdiff_t tem;
 
         /* Consult the newline cache, if appropriate.  */
         if (target == '\n' && newline_cache)
@@ -835,8 +833,8 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end,
    except in special cases.  */
 
 EMACS_INT
-scan_newline (EMACS_INT start, EMACS_INT start_byte,
-             EMACS_INT limit, EMACS_INT limit_byte,
+scan_newline (ptrdiff_t start, ptrdiff_t start_byte,
+             ptrdiff_t limit, ptrdiff_t limit_byte,
              register EMACS_INT count, int allow_quit)
 {
   int direction = ((count > 0) ? 1 : -1);
@@ -844,7 +842,7 @@ scan_newline (EMACS_INT start, EMACS_INT start_byte,
   register unsigned char *cursor;
   unsigned char *base;
 
-  EMACS_INT ceiling;
+  ptrdiff_t ceiling;
   register unsigned char *ceiling_addr;
 
   int old_immediate_quit = immediate_quit;
@@ -930,21 +928,21 @@ scan_newline (EMACS_INT start, EMACS_INT start_byte,
   return count * direction;
 }
 
-EMACS_INT
-find_next_newline_no_quit (EMACS_INT from, EMACS_INT cnt)
+ptrdiff_t
+find_next_newline_no_quit (ptrdiff_t from, ptrdiff_t cnt)
 {
-  return scan_buffer ('\n', from, 0, cnt, (EMACS_INT *) 0, 0);
+  return scan_buffer ('\n', from, 0, cnt, (ptrdiff_t *) 0, 0);
 }
 
 /* Like find_next_newline, but returns position before the newline,
    not after, and only search up to TO.  This isn't just
    find_next_newline (...)-1, because you might hit TO.  */
 
-EMACS_INT
-find_before_next_newline (EMACS_INT from, EMACS_INT to, EMACS_INT cnt)
+ptrdiff_t
+find_before_next_newline (ptrdiff_t from, ptrdiff_t to, ptrdiff_t cnt)
 {
-  EMACS_INT shortage;
-  EMACS_INT pos = scan_buffer ('\n', from, to, cnt, &shortage, 1);
+  ptrdiff_t shortage;
+  ptrdiff_t pos = scan_buffer ('\n', from, to, cnt, &shortage, 1);
 
   if (shortage == 0)
     pos--;
@@ -959,7 +957,8 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
                Lisp_Object count, int direction, int RE, int posix)
 {
   register EMACS_INT np;
-  EMACS_INT lim, lim_byte;
+  EMACS_INT lim;
+  ptrdiff_t lim_byte;
   EMACS_INT n = direction;
 
   if (!NILP (count))
@@ -1035,7 +1034,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
 static int
 trivial_regexp_p (Lisp_Object regexp)
 {
-  EMACS_INT len = SBYTES (regexp);
+  ptrdiff_t len = SBYTES (regexp);
   unsigned char *s = SDATA (regexp);
   while (--len >= 0)
     {
@@ -1099,13 +1098,13 @@ while (0)
 static struct re_registers search_regs_1;
 
 static EMACS_INT
-search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
-              EMACS_INT lim, EMACS_INT lim_byte, EMACS_INT n,
+search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
+              ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n,
               int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix)
 {
-  EMACS_INT len = SCHARS (string);
-  EMACS_INT len_byte = SBYTES (string);
-  register int i;
+  ptrdiff_t len = SCHARS (string);
+  ptrdiff_t len_byte = SBYTES (string);
+  register ptrdiff_t i;
 
   if (running_asynch_code)
     save_search_regs ();
@@ -1121,7 +1120,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
   if (RE && !(trivial_regexp_p (string) && NILP (Vsearch_spaces_regexp)))
     {
       unsigned char *p1, *p2;
-      EMACS_INT s1, s2;
+      ptrdiff_t s1, s2;
       struct re_pattern_buffer *bufp;
 
       bufp = compile_pattern (string,
@@ -1157,7 +1156,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
 
       while (n < 0)
        {
-         EMACS_INT val;
+         ptrdiff_t val;
 
          val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2,
                             pos_byte - BEGV_BYTE, lim_byte - pos_byte,
@@ -1202,7 +1201,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
        }
       while (n > 0)
        {
-         EMACS_INT val;
+         ptrdiff_t val;
 
          val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2,
                             pos_byte - BEGV_BYTE, lim_byte - pos_byte,
@@ -1248,8 +1247,8 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
   else                         /* non-RE case */
     {
       unsigned char *raw_pattern, *pat;
-      EMACS_INT raw_pattern_size;
-      EMACS_INT raw_pattern_size_byte;
+      ptrdiff_t raw_pattern_size;
+      ptrdiff_t raw_pattern_size_byte;
       unsigned char *patbuf;
       int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
       unsigned char *base_pat;
@@ -1274,7 +1273,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
          raw_pattern_size_byte
            = count_size_as_multibyte (SDATA (string),
                                       raw_pattern_size);
-         raw_pattern = (unsigned char *) alloca (raw_pattern_size_byte + 1);
+         raw_pattern = alloca (raw_pattern_size_byte + 1);
          copy_text (SDATA (string), raw_pattern,
                     SCHARS (string), 0, 1);
        }
@@ -1288,7 +1287,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
             the chosen single-byte character set can possibly match.  */
          raw_pattern_size = SCHARS (string);
          raw_pattern_size_byte = SCHARS (string);
-         raw_pattern = (unsigned char *) alloca (raw_pattern_size + 1);
+         raw_pattern = alloca (raw_pattern_size + 1);
          copy_text (SDATA (string), raw_pattern,
                     SBYTES (string), 1, 0);
        }
@@ -1296,7 +1295,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
       /* Copy and optionally translate the pattern.  */
       len = raw_pattern_size;
       len_byte = raw_pattern_size_byte;
-      patbuf = (unsigned char *) alloca (len * MAX_MULTIBYTE_LENGTH);
+      patbuf = alloca (len * MAX_MULTIBYTE_LENGTH);
       pat = patbuf;
       base_pat = raw_pattern;
       if (multibyte)
@@ -1443,15 +1442,15 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte,
 
 static EMACS_INT
 simple_search (EMACS_INT n, unsigned char *pat,
-              EMACS_INT len, EMACS_INT len_byte, Lisp_Object trt,
-              EMACS_INT pos, EMACS_INT pos_byte,
-              EMACS_INT lim, EMACS_INT lim_byte)
+              ptrdiff_t len, ptrdiff_t len_byte, Lisp_Object trt,
+              ptrdiff_t pos, ptrdiff_t pos_byte,
+              ptrdiff_t lim, ptrdiff_t lim_byte)
 {
   int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
   int forward = n > 0;
   /* Number of buffer bytes matched.  Note that this may be different
      from len_byte in a multibyte buffer.  */
-  EMACS_INT match_byte;
+  ptrdiff_t match_byte = PTRDIFF_MIN;
 
   if (lim > pos && multibyte)
     while (n > 0)
@@ -1459,9 +1458,9 @@ simple_search (EMACS_INT n, unsigned char *pat,
        while (1)
          {
            /* Try matching at position POS.  */
-           EMACS_INT this_pos = pos;
-           EMACS_INT this_pos_byte = pos_byte;
-           EMACS_INT this_len = len;
+           ptrdiff_t this_pos = pos;
+           ptrdiff_t this_pos_byte = pos_byte;
+           ptrdiff_t this_len = len;
            unsigned char *p = pat;
            if (pos + len > lim || pos_byte + len_byte > lim_byte)
              goto stop;
@@ -1505,8 +1504,8 @@ simple_search (EMACS_INT n, unsigned char *pat,
        while (1)
          {
            /* Try matching at position POS.  */
-           EMACS_INT this_pos = pos;
-           EMACS_INT this_len = len;
+           ptrdiff_t this_pos = pos;
+           ptrdiff_t this_len = len;
            unsigned char *p = pat;
 
            if (pos + len > lim)
@@ -1544,9 +1543,9 @@ simple_search (EMACS_INT n, unsigned char *pat,
        while (1)
          {
            /* Try matching at position POS.  */
-           EMACS_INT this_pos = pos;
-           EMACS_INT this_pos_byte = pos_byte;
-           EMACS_INT this_len = len;
+           ptrdiff_t this_pos = pos;
+           ptrdiff_t this_pos_byte = pos_byte;
+           ptrdiff_t this_len = len;
            const unsigned char *p = pat + len_byte;
 
            if (this_pos - len < lim || (pos_byte - len_byte) < lim_byte)
@@ -1587,8 +1586,8 @@ simple_search (EMACS_INT n, unsigned char *pat,
        while (1)
          {
            /* Try matching at position POS.  */
-           EMACS_INT this_pos = pos - len;
-           EMACS_INT this_len = len;
+           ptrdiff_t this_pos = pos - len;
+           ptrdiff_t this_len = len;
            unsigned char *p = pat;
 
            if (this_pos < lim)
@@ -1622,6 +1621,7 @@ simple_search (EMACS_INT n, unsigned char *pat,
  stop:
   if (n == 0)
     {
+      eassert (match_byte != PTRDIFF_MIN);
       if (forward)
        set_search_regs ((multibyte ? pos_byte : pos) - match_byte, match_byte);
       else
@@ -1652,18 +1652,18 @@ simple_search (EMACS_INT n, unsigned char *pat,
 
 static EMACS_INT
 boyer_moore (EMACS_INT n, unsigned char *base_pat,
-            EMACS_INT len_byte,
+            ptrdiff_t len_byte,
             Lisp_Object trt, Lisp_Object inverse_trt,
-            EMACS_INT pos_byte, EMACS_INT lim_byte,
+            ptrdiff_t pos_byte, ptrdiff_t lim_byte,
              int char_base)
 {
   int direction = ((n > 0) ? 1 : -1);
-  register EMACS_INT dirlen;
-  EMACS_INT limit;
+  register ptrdiff_t dirlen;
+  ptrdiff_t limit;
   int stride_for_teases = 0;
   int BM_tab[0400];
   register unsigned char *cursor, *p_limit;
-  register EMACS_INT i;
+  register ptrdiff_t i;
   register int j;
   unsigned char *pat, *pat_end;
   int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
@@ -1815,7 +1815,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
      char if reverse) of pattern would align in a possible match.  */
   while (n != 0)
     {
-      EMACS_INT tail_end;
+      ptrdiff_t tail_end;
       unsigned char *tail_end_ptr;
 
       /* It's been reported that some (broken) compiler thinks that
@@ -1919,7 +1919,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
              cursor += dirlen - i - direction; /* fix cursor */
              if (i + direction == 0)
                {
-                 EMACS_INT position, start, end;
+                 ptrdiff_t position, start, end;
 
                  cursor -= direction;
 
@@ -2011,7 +2011,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
              pos_byte += dirlen - i - direction;
              if (i + direction == 0)
                {
-                 EMACS_INT position, start, end;
+                 ptrdiff_t position, start, end;
                  pos_byte -= direction;
 
                  position = pos_byte + ((direction > 0) ? 1 - len_byte : 0);
@@ -2052,9 +2052,9 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
    Also clear out the match data for registers 1 and up.  */
 
 static void
-set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes)
+set_search_regs (ptrdiff_t beg_byte, ptrdiff_t nbytes)
 {
-  int i;
+  ptrdiff_t i;
 
   if (!NILP (Vinhibit_changing_match_data))
     return;
@@ -2063,8 +2063,8 @@ set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes)
      the match position.  */
   if (search_regs.num_regs == 0)
     {
-      search_regs.start = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
-      search_regs.end = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
+      search_regs.start = xmalloc (2 * sizeof (regoff_t));
+      search_regs.end = xmalloc (2 * sizeof (regoff_t));
       search_regs.num_regs = 2;
     }
 
@@ -2080,102 +2080,6 @@ set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes)
   XSETBUFFER (last_thing_searched, current_buffer);
 }
 \f
-DEFUN ("word-search-regexp", Fword_search_regexp, Sword_search_regexp, 1, 2, 0,
-       doc: /* Return a regexp which matches words, ignoring punctuation.
-Given STRING, a string of words separated by word delimiters,
-compute a regexp that matches those exact words separated by
-arbitrary punctuation.  If LAX is non-nil, the end of the string
-need not match a word boundary unless it ends in whitespace.
-
-Used in `word-search-forward', `word-search-backward',
-`word-search-forward-lax', `word-search-backward-lax'.  */)
-  (Lisp_Object string, Lisp_Object lax)
-{
-  register unsigned char *o;
-  register EMACS_INT i, i_byte, len, punct_count = 0, word_count = 0;
-  Lisp_Object val;
-  int prev_c = 0;
-  EMACS_INT adjust;
-  int whitespace_at_end;
-
-  CHECK_STRING (string);
-  len = SCHARS (string);
-
-  for (i = 0, i_byte = 0; i < len; )
-    {
-      int c;
-
-      FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, i, i_byte);
-
-      if (SYNTAX (c) != Sword)
-       {
-         punct_count++;
-         if (SYNTAX (prev_c) == Sword)
-           word_count++;
-       }
-
-      prev_c = c;
-    }
-
-  if (SYNTAX (prev_c) == Sword)
-    {
-      word_count++;
-      whitespace_at_end = 0;
-    }
-  else
-    {
-      whitespace_at_end = 1;
-      if (!word_count)
-       return empty_unibyte_string;
-    }
-
-  adjust = - punct_count + 5 * (word_count - 1)
-    + ((!NILP (lax) && !whitespace_at_end) ? 2 : 4);
-  if (STRING_MULTIBYTE (string))
-    val = make_uninit_multibyte_string (len + adjust,
-                                       SBYTES (string)
-                                       + adjust);
-  else
-    val = make_uninit_string (len + adjust);
-
-  o = SDATA (val);
-  *o++ = '\\';
-  *o++ = 'b';
-  prev_c = 0;
-
-  for (i = 0, i_byte = 0; i < len; )
-    {
-      int c;
-      EMACS_INT i_byte_orig = i_byte;
-
-      FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, i, i_byte);
-
-      if (SYNTAX (c) == Sword)
-       {
-         memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig);
-         o += i_byte - i_byte_orig;
-       }
-      else if (SYNTAX (prev_c) == Sword && --word_count)
-       {
-         *o++ = '\\';
-         *o++ = 'W';
-         *o++ = '\\';
-         *o++ = 'W';
-         *o++ = '*';
-       }
-
-      prev_c = c;
-    }
-
-  if (NILP (lax) || whitespace_at_end)
-    {
-      *o++ = '\\';
-      *o++ = 'b';
-    }
-
-  return val;
-}
-\f
 DEFUN ("search-backward", Fsearch_backward, Ssearch_backward, 1, 4,
        "MSearch backward: ",
        doc: /* Search backward from point for STRING.
@@ -2218,86 +2122,6 @@ See also the functions `match-beginning', `match-end' and `replace-match'.  */)
   return search_command (string, bound, noerror, count, 1, 0, 0);
 }
 
-DEFUN ("word-search-backward", Fword_search_backward, Sword_search_backward, 1, 4,
-       "sWord search backward: ",
-       doc: /* Search backward from point for STRING, ignoring differences in punctuation.
-Set point to the beginning of the occurrence found, and return point.
-An optional second argument bounds the search; it is a buffer position.
-The match found must not extend before that position.
-Optional third argument, if t, means if fail just return nil (no error).
-  If not nil and not t, move to limit of search and return nil.
-Optional fourth argument is repeat count--search for successive occurrences.
-
-Relies on the function `word-search-regexp' to convert a sequence
-of words in STRING to a regexp used to search words without regard
-to punctuation.  */)
-  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
-{
-  return search_command (Fword_search_regexp (string, Qnil), bound, noerror, count, -1, 1, 0);
-}
-
-DEFUN ("word-search-forward", Fword_search_forward, Sword_search_forward, 1, 4,
-       "sWord search: ",
-       doc: /* Search forward from point for STRING, ignoring differences in punctuation.
-Set point to the end of the occurrence found, and return point.
-An optional second argument bounds the search; it is a buffer position.
-The match found must not extend after that position.
-Optional third argument, if t, means if fail just return nil (no error).
-  If not nil and not t, move to limit of search and return nil.
-Optional fourth argument is repeat count--search for successive occurrences.
-
-Relies on the function `word-search-regexp' to convert a sequence
-of words in STRING to a regexp used to search words without regard
-to punctuation.  */)
-  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
-{
-  return search_command (Fword_search_regexp (string, Qnil), bound, noerror, count, 1, 1, 0);
-}
-
-DEFUN ("word-search-backward-lax", Fword_search_backward_lax, Sword_search_backward_lax, 1, 4,
-       "sWord search backward: ",
-       doc: /* Search backward from point for STRING, ignoring differences in punctuation.
-Set point to the beginning of the occurrence found, and return point.
-
-Unlike `word-search-backward', the end of STRING need not match a word
-boundary, unless STRING ends in whitespace.
-
-An optional second argument bounds the search; it is a buffer position.
-The match found must not extend before that position.
-Optional third argument, if t, means if fail just return nil (no error).
-  If not nil and not t, move to limit of search and return nil.
-Optional fourth argument is repeat count--search for successive occurrences.
-
-Relies on the function `word-search-regexp' to convert a sequence
-of words in STRING to a regexp used to search words without regard
-to punctuation.  */)
-  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
-{
-  return search_command (Fword_search_regexp (string, Qt), bound, noerror, count, -1, 1, 0);
-}
-
-DEFUN ("word-search-forward-lax", Fword_search_forward_lax, Sword_search_forward_lax, 1, 4,
-       "sWord search: ",
-       doc: /* Search forward from point for STRING, ignoring differences in punctuation.
-Set point to the end of the occurrence found, and return point.
-
-Unlike `word-search-forward', the end of STRING need not match a word
-boundary, unless STRING ends in whitespace.
-
-An optional second argument bounds the search; it is a buffer position.
-The match found must not extend after that position.
-Optional third argument, if t, means if fail just return nil (no error).
-  If not nil and not t, move to limit of search and return nil.
-Optional fourth argument is repeat count--search for successive occurrences.
-
-Relies on the function `word-search-regexp' to convert a sequence
-of words in STRING to a regexp used to search words without regard
-to punctuation.  */)
-  (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, Lisp_Object count)
-{
-  return search_command (Fword_search_regexp (string, Qt), bound, noerror, count, 1, 1, 0);
-}
-
 DEFUN ("re-search-backward", Fre_search_backward, Sre_search_backward, 1, 4,
        "sRE search backward: ",
        doc: /* Search backward from point for match for regular expression REGEXP.
@@ -2423,14 +2247,14 @@ since only regular expressions have distinguished subexpressions.  */)
   (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp)
 {
   enum { nochange, all_caps, cap_initial } case_action;
-  register EMACS_INT pos, pos_byte;
+  register ptrdiff_t pos, pos_byte;
   int some_multiletter_word;
   int some_lowercase;
   int some_uppercase;
   int some_nonuppercase_initial;
   register int c, prevc;
   ptrdiff_t sub;
-  EMACS_INT opoint, newpoint;
+  ptrdiff_t opoint, newpoint;
 
   CHECK_STRING (newtext);
 
@@ -2473,7 +2297,7 @@ since only regular expressions have distinguished subexpressions.  */)
   if (NILP (fixedcase))
     {
       /* Decide how to casify by examining the matched text. */
-      EMACS_INT last;
+      ptrdiff_t last;
 
       pos = search_regs.start[sub];
       last = search_regs.end[sub];
@@ -2560,19 +2384,19 @@ since only regular expressions have distinguished subexpressions.  */)
         if desired.  */
       if (NILP (literal))
        {
-         EMACS_INT lastpos = 0;
-         EMACS_INT lastpos_byte = 0;
+         ptrdiff_t lastpos = 0;
+         ptrdiff_t lastpos_byte = 0;
          /* We build up the substituted string in ACCUM.  */
          Lisp_Object accum;
          Lisp_Object middle;
-         EMACS_INT length = SBYTES (newtext);
+         ptrdiff_t length = SBYTES (newtext);
 
          accum = Qnil;
 
          for (pos_byte = 0, pos = 0; pos_byte < length;)
            {
-             EMACS_INT substart = -1;
-             EMACS_INT subend = 0;
+             ptrdiff_t substart = -1;
+             ptrdiff_t subend = 0;
              int delbackslash = 0;
 
              FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte);
@@ -2588,8 +2412,8 @@ since only regular expressions have distinguished subexpressions.  */)
                    }
                  else if (c >= '1' && c <= '9')
                    {
-                     if (search_regs.start[c - '0'] >= 0
-                         && c <= search_regs.num_regs + '0')
+                     if (c - '0' < search_regs.num_regs
+                         && 0 <= search_regs.start[c - '0'])
                        {
                          substart = search_regs.start[c - '0'];
                          subend = search_regs.end[c - '0'];
@@ -2675,7 +2499,7 @@ since only regular expressions have distinguished subexpressions.  */)
       substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length
                            ? STRING_BYTES_BOUND
                            : length * 2 + 100);
-      substed = (unsigned char *) xmalloc (substed_alloc_size);
+      substed = xmalloc (substed_alloc_size);
       substed_len = 0;
 
       /* Go thru NEWTEXT, producing the actual text to insert in
@@ -2727,7 +2551,7 @@ since only regular expressions have distinguished subexpressions.  */)
 
              if (c == '&')
                idx = sub;
-             else if (c >= '1' && c <= '9' && c <= search_regs.num_regs + '0')
+             else if (c >= '1' && c <= '9' && c - '0' < search_regs.num_regs)
                {
                  if (search_regs.start[c - '0'] >= 1)
                    idx = c - '0';
@@ -2779,7 +2603,7 @@ since only regular expressions have distinguished subexpressions.  */)
        {
          if (buf_multibyte)
            {
-             EMACS_INT nchars =
+             ptrdiff_t nchars =
                multibyte_chars_in_text (substed, substed_len);
 
              newtext = make_multibyte_string ((char *) substed, nchars,
@@ -2805,10 +2629,10 @@ since only regular expressions have distinguished subexpressions.  */)
 
   /* Adjust search data for this change.  */
   {
-    EMACS_INT oldend = search_regs.end[sub];
-    EMACS_INT oldstart = search_regs.start[sub];
-    EMACS_INT change = newpoint - search_regs.end[sub];
-    int i;
+    ptrdiff_t oldend = search_regs.end[sub];
+    ptrdiff_t oldstart = search_regs.start[sub];
+    ptrdiff_t change = newpoint - search_regs.end[sub];
+    ptrdiff_t i;
 
     for (i = 0; i < search_regs.num_regs; i++)
       {
@@ -2901,7 +2725,7 @@ Return value is undefined if the last search failed.  */)
 {
   Lisp_Object tail, prev;
   Lisp_Object *data;
-  int i, len;
+  ptrdiff_t i, len;
 
   if (!NILP (reseat))
     for (tail = reuse; CONSP (tail); tail = XCDR (tail))
@@ -2916,13 +2740,12 @@ Return value is undefined if the last search failed.  */)
 
   prev = Qnil;
 
-  data = (Lisp_Object *) alloca ((2 * search_regs.num_regs + 1)
-                                * sizeof (Lisp_Object));
+  data = alloca ((2 * search_regs.num_regs + 1) * sizeof *data);
 
   len = 0;
   for (i = 0; i < search_regs.num_regs; i++)
     {
-      EMACS_INT start = search_regs.start[i];
+      ptrdiff_t start = search_regs.start[i];
       if (start >= 0)
        {
          if (EQ (last_thing_searched, Qt)
@@ -3013,11 +2836,13 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
 
   /* Allocate registers if they don't already exist.  */
   {
-    ptrdiff_t length = XFASTINT (Flength (list)) / 2;
+    EMACS_INT length = XFASTINT (Flength (list)) / 2;
 
     if (length > search_regs.num_regs)
       {
        ptrdiff_t num_regs = search_regs.num_regs;
+       if (PTRDIFF_MAX < length)
+         memory_full (SIZE_MAX);
        search_regs.start =
          xpalloc (search_regs.start, &num_regs, length - num_regs,
                   min (PTRDIFF_MAX, UINT_MAX), sizeof (regoff_t));
@@ -3047,7 +2872,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
          }
        else
          {
-           EMACS_INT from;
+           Lisp_Object from;
            Lisp_Object m;
 
            m = marker;
@@ -3060,7 +2885,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
              }
 
            CHECK_NUMBER_COERCE_MARKER (marker);
-           from = XINT (marker);
+           from = marker;
 
            if (!NILP (reseat) && MARKERP (m))
              {
@@ -3077,8 +2902,20 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere.  */)
              XSETFASTINT (marker, 0);
 
            CHECK_NUMBER_COERCE_MARKER (marker);
-           search_regs.start[i] = from;
-           search_regs.end[i] = XINT (marker);
+           if ((XINT (from) < 0
+                ? TYPE_MINIMUM (regoff_t) <= XINT (from)
+                : XINT (from) <= TYPE_MAXIMUM (regoff_t))
+               && (XINT (marker) < 0
+                   ? TYPE_MINIMUM (regoff_t) <= XINT (marker)
+                   : XINT (marker) <= TYPE_MAXIMUM (regoff_t)))
+             {
+               search_regs.start[i] = XINT (from);
+               search_regs.end[i] = XINT (marker);
+             }
+           else
+             {
+               search_regs.start[i] = -1;
+             }
 
            if (!NILP (reseat) && MARKERP (m))
              {
@@ -3169,7 +3006,7 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
 
   CHECK_STRING (string);
 
-  temp = (char *) alloca (SBYTES (string) * 2);
+  temp = alloca (SBYTES (string) * 2);
 
   /* Now copy the data into the new string, inserting escapes. */
 
@@ -3201,7 +3038,7 @@ syms_of_search (void)
   for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
     {
       searchbufs[i].buf.allocated = 100;
-      searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100);
+      searchbufs[i].buf.buffer = xmalloc (100);
       searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
       searchbufs[i].regexp = Qnil;
       searchbufs[i].whitespace_regexp = Qnil;
@@ -3219,12 +3056,12 @@ syms_of_search (void)
   Fput (Qsearch_failed, Qerror_conditions,
        pure_cons (Qsearch_failed, pure_cons (Qerror, Qnil)));
   Fput (Qsearch_failed, Qerror_message,
-       make_pure_c_string ("Search failed"));
+       build_pure_c_string ("Search failed"));
 
   Fput (Qinvalid_regexp, Qerror_conditions,
        pure_cons (Qinvalid_regexp, pure_cons (Qerror, Qnil)));
   Fput (Qinvalid_regexp, Qerror_message,
-       make_pure_c_string ("Invalid regexp"));
+       build_pure_c_string ("Invalid regexp"));
 
   last_thing_searched = Qnil;
   staticpro (&last_thing_searched);
@@ -3254,11 +3091,6 @@ is to bind it with `let' around a small expression.  */);
   defsubr (&Sposix_string_match);
   defsubr (&Ssearch_forward);
   defsubr (&Ssearch_backward);
-  defsubr (&Sword_search_regexp);
-  defsubr (&Sword_search_forward);
-  defsubr (&Sword_search_backward);
-  defsubr (&Sword_search_forward_lax);
-  defsubr (&Sword_search_backward_lax);
   defsubr (&Sre_search_forward);
   defsubr (&Sre_search_backward);
   defsubr (&Sposix_search_forward);
index 5fd5bd5c0defcba4a240e4ef7c98c1afad684743..151bc1a08c16418ab64e0b5551f092dfaad01c23 100644 (file)
@@ -1,5 +1,6 @@
 /* sound.c -- sound support.
-   Copyright (C) 1998-1999, 2001-2012 Free Software Foundation, Inc.
+
+Copyright (C) 1998-1999, 2001-2012 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -109,26 +110,11 @@ enum sound_attr
   SOUND_ATTR_SENTINEL
 };
 
-#ifdef HAVE_ALSA
-static void alsa_sound_perror (const char *, int) NO_RETURN;
-#endif
-static void sound_perror (const char *) NO_RETURN;
-static void sound_warning (const char *);
-static int parse_sound (Lisp_Object, Lisp_Object *);
-
 /* END: Common Definitions */
 
 /* BEGIN: Non Windows Definitions */
 #ifndef WINDOWSNT
 
-#ifndef DEFAULT_SOUND_DEVICE
-#define DEFAULT_SOUND_DEVICE "/dev/dsp"
-#endif
-#ifndef DEFAULT_ALSA_SOUND_DEVICE
-#define DEFAULT_ALSA_SOUND_DEVICE "default"
-#endif
-
-
 /* Structure forward declarations.  */
 
 struct sound;
@@ -235,11 +221,11 @@ struct sound_device
 
   /* Return a preferred data size in bytes to be sent to write (below)
      each time.  2048 is used if this is NULL.  */
-  EMACS_INT (* period_size) (struct sound_device *sd);
+  ptrdiff_t (* period_size) (struct sound_device *sd);
 
   /* Write NYBTES bytes from BUFFER to device SD.  */
   void (* write) (struct sound_device *sd, const char *buffer,
-                  EMACS_INT nbytes);
+                  ptrdiff_t nbytes);
 
   /* A place for devices to store additional data.  */
   void *data;
@@ -291,7 +277,7 @@ static void vox_configure (struct sound_device *);
 static void vox_close (struct sound_device *sd);
 static void vox_choose_format (struct sound_device *, struct sound *);
 static int vox_init (struct sound_device *);
-static void vox_write (struct sound_device *, const char *, EMACS_INT);
+static void vox_write (struct sound_device *, const char *, ptrdiff_t);
 static void find_sound_type (struct sound *);
 static u_int32_t le2hl (u_int32_t);
 static u_int16_t le2hs (u_int16_t);
@@ -323,7 +309,7 @@ static int do_play_sound (const char *, unsigned long);
 
 /* Like perror, but signals an error.  */
 
-static void
+static _Noreturn void
 sound_perror (const char *msg)
 {
   int saved_errno = errno;
@@ -600,11 +586,11 @@ wav_play (struct sound *s, struct sound_device *sd)
   else
     {
       char *buffer;
-      EMACS_INT nbytes = 0;
-      EMACS_INT blksize = sd->period_size ? sd->period_size (sd) : 2048;
-      EMACS_INT data_left = header->data_length;
+      ptrdiff_t nbytes = 0;
+      ptrdiff_t blksize = sd->period_size ? sd->period_size (sd) : 2048;
+      ptrdiff_t data_left = header->data_length;
 
-      buffer = (char *) alloca (blksize);
+      buffer = alloca (blksize);
       lseek (s->fd, sizeof *header, SEEK_SET);
       while (data_left > 0
              && (nbytes = emacs_read (s->fd, buffer, blksize)) > 0)
@@ -690,15 +676,15 @@ au_play (struct sound *s, struct sound_device *sd)
               SBYTES (s->data) - header->data_offset);
   else
     {
-      EMACS_INT blksize = sd->period_size ? sd->period_size (sd) : 2048;
+      ptrdiff_t blksize = sd->period_size ? sd->period_size (sd) : 2048;
       char *buffer;
-      EMACS_INT nbytes;
+      ptrdiff_t nbytes;
 
       /* Seek */
       lseek (s->fd, header->data_offset, SEEK_SET);
 
       /* Copy sound data to the device.  */
-      buffer = (char *) alloca (blksize);
+      buffer = alloca (blksize);
       while ((nbytes = emacs_read (s->fd, buffer, blksize)) > 0)
        sd->write (sd, buffer, nbytes);
 
@@ -724,7 +710,7 @@ vox_open (struct sound_device *sd)
 {
   const char *file;
 
-  /* Open the sound device.  Default is /dev/dsp.  */
+  /* Open the sound device (eg /dev/dsp).  */
   if (sd->file)
     file = sd->file;
   else
@@ -743,7 +729,7 @@ vox_configure (struct sound_device *sd)
 {
   int val;
 
-  xassert (sd->fd >= 0);
+  eassert (sd->fd >= 0);
 
   /* On GNU/Linux, it seems that the device driver doesn't like to be
      interrupted by a signal.  Block the ones we know to cause
@@ -870,7 +856,7 @@ vox_init (struct sound_device *sd)
   const char *file;
   int fd;
 
-  /* Open the sound device.  Default is /dev/dsp.  */
+  /* Open the sound device (eg /dev/dsp).  */
   if (sd->file)
     file = sd->file;
   else
@@ -895,7 +881,7 @@ vox_init (struct sound_device *sd)
 /* Write NBYTES bytes from BUFFER to device SD.  */
 
 static void
-vox_write (struct sound_device *sd, const char *buffer, EMACS_INT nbytes)
+vox_write (struct sound_device *sd, const char *buffer, ptrdiff_t nbytes)
 {
   if (emacs_write (sd->fd, buffer, nbytes) != nbytes)
     sound_perror ("Error writing to sound device");
@@ -908,7 +894,11 @@ vox_write (struct sound_device *sd, const char *buffer, EMACS_INT nbytes)
 
 /* This driver is available on GNU/Linux. */
 
-static void
+#ifndef DEFAULT_ALSA_SOUND_DEVICE
+#define DEFAULT_ALSA_SOUND_DEVICE "default"
+#endif
+
+static _Noreturn void
 alsa_sound_perror (const char *msg, int err)
 {
   error ("%s: %s", msg, snd_strerror (err));
@@ -938,7 +928,7 @@ alsa_open (struct sound_device *sd)
   else
     file = DEFAULT_ALSA_SOUND_DEVICE;
 
-  p = xmalloc (sizeof (*p));
+  p = xmalloc (sizeof *p);
   p->handle = NULL;
   p->hwparams = NULL;
   p->swparams = NULL;
@@ -952,7 +942,7 @@ alsa_open (struct sound_device *sd)
     alsa_sound_perror (file, err);
 }
 
-static EMACS_INT
+static ptrdiff_t
 alsa_period_size (struct sound_device *sd)
 {
   struct alsa_params *p = (struct alsa_params *) sd->data;
@@ -968,7 +958,7 @@ alsa_configure (struct sound_device *sd)
   struct alsa_params *p = (struct alsa_params *) sd->data;
   snd_pcm_uframes_t buffer_size;
 
-  xassert (p->handle != 0);
+  eassert (p->handle != 0);
 
   err = snd_pcm_hw_params_malloc (&p->hwparams);
   if (err < 0)
@@ -1155,13 +1145,13 @@ alsa_choose_format (struct sound_device *sd, struct sound *s)
 /* Write NBYTES bytes from BUFFER to device SD.  */
 
 static void
-alsa_write (struct sound_device *sd, const char *buffer, EMACS_INT nbytes)
+alsa_write (struct sound_device *sd, const char *buffer, ptrdiff_t nbytes)
 {
   struct alsa_params *p = (struct alsa_params *) sd->data;
 
   /* The the third parameter to snd_pcm_writei is frames, not bytes. */
   int fact = snd_pcm_format_size (sd->format, 1) * sd->channels;
-  EMACS_INT nwritten = 0;
+  ptrdiff_t nwritten = 0;
   int err;
 
   while (nwritten < nbytes)
@@ -1348,7 +1338,7 @@ Internal use only, use `play-sound' instead.  */)
   (Lisp_Object sound)
 {
   Lisp_Object attrs[SOUND_ATTR_SENTINEL];
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
 #ifndef WINDOWSNT
   Lisp_Object file;
@@ -1370,12 +1360,10 @@ Internal use only, use `play-sound' instead.  */)
 #ifndef WINDOWSNT
   file = Qnil;
   GCPRO2 (sound, file);
-  current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device));
-  memset (current_sound_device, 0, sizeof (struct sound_device));
-  current_sound = (struct sound *) xmalloc (sizeof (struct sound));
-  memset (current_sound, 0, sizeof (struct sound));
+  current_sound_device = xzalloc (sizeof *current_sound_device);
+  current_sound = xzalloc (sizeof *current_sound);
   record_unwind_protect (sound_cleanup, Qnil);
-  current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES);
+  current_sound->header = alloca (MAX_SOUND_HEADER_BYTES);
 
   if (STRINGP (attrs[SOUND_FILE]))
     {
@@ -1407,7 +1395,7 @@ Internal use only, use `play-sound' instead.  */)
   if (STRINGP (attrs[SOUND_DEVICE]))
     {
       int len = SCHARS (attrs[SOUND_DEVICE]);
-      current_sound_device->file = (char *) alloca (len + 1);
+      current_sound_device->file = alloca (len + 1);
       strcpy (current_sound_device->file, SSDATA (attrs[SOUND_DEVICE]));
     }
 
@@ -1439,7 +1427,7 @@ Internal use only, use `play-sound' instead.  */)
 
   lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil);
   len = XSTRING (lo_file)->size;
-  psz_file = (char *) alloca (len + 1);
+  psz_file = alloca (len + 1);
   strcpy (psz_file, XSTRING (lo_file)->data);
   if (INTEGERP (attrs[SOUND_VOLUME]))
     {
@@ -1485,10 +1473,4 @@ syms_of_sound (void)
   defsubr (&Splay_sound_internal);
 }
 
-
-void
-init_sound (void)
-{
-}
-
 #endif /* HAVE_SOUND */
index 16012d9f88ebf95261cbb696971d8f29a51ab48b..69c2789ed39bfcf23984b3233cfdc44d2e4efe2b 100644 (file)
@@ -25,8 +25,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 #include "lisp.h"
 #include "commands.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "keymap.h"
 #include "regex.h"
 
@@ -111,18 +111,18 @@ Lisp_Object syntax_temp;
 
 struct lisp_parse_state
   {
-    int depth;    /* Depth at end of parsing.  */
+    EMACS_INT depth;   /* Depth at end of parsing.  */
     int instring;  /* -1 if not within string, else desired terminator.  */
-    int incomment; /* -1 if in unnestable comment else comment nesting */
+    EMACS_INT incomment; /* -1 if in unnestable comment else comment nesting */
     int comstyle;  /* comment style a=0, or b=1, or ST_COMMENT_STYLE.  */
     int quoted;           /* Nonzero if just after an escape char at end of parsing */
-    int mindepth;  /* Minimum depth seen while scanning.  */
+    EMACS_INT mindepth;        /* Minimum depth seen while scanning.  */
     /* Char number of most recent start-of-expression at current level */
-    EMACS_INT thislevelstart;
+    ptrdiff_t thislevelstart;
     /* Char number of start of containing expression */
-    EMACS_INT prevlevelstart;
-    EMACS_INT location;             /* Char number at which parsing stopped.  */
-    EMACS_INT comstr_start;  /* Position of last comment/string starter.  */
+    ptrdiff_t prevlevelstart;
+    ptrdiff_t location;             /* Char number at which parsing stopped.  */
+    ptrdiff_t comstr_start;  /* Position of last comment/string starter.  */
     Lisp_Object levelstarts; /* Char numbers of starts-of-expression
                                of levels (starting from outermost).  */
   };
@@ -135,20 +135,19 @@ struct lisp_parse_state
    find_start_begv is the BEGV value when it was found.
    find_start_modiff is the value of MODIFF when it was found.  */
 
-static EMACS_INT find_start_pos;
-static EMACS_INT find_start_value;
-static EMACS_INT find_start_value_byte;
+static ptrdiff_t find_start_pos;
+static ptrdiff_t find_start_value;
+static ptrdiff_t find_start_value_byte;
 static struct buffer *find_start_buffer;
-static EMACS_INT find_start_begv;
-static int find_start_modiff;
+static ptrdiff_t find_start_begv;
+static EMACS_INT find_start_modiff;
 
 
-static Lisp_Object Fsyntax_table_p (Lisp_Object);
 static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int);
 static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object);
 static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int);
 static void scan_sexps_forward (struct lisp_parse_state *,
-                                EMACS_INT, EMACS_INT, EMACS_INT, int,
+                                ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT,
                                 int, Lisp_Object, int);
 static int in_classes (int, Lisp_Object);
 \f
@@ -177,7 +176,7 @@ struct gl_state_s gl_state;         /* Global state of syntax parser.  */
    start/end of OBJECT.  */
 
 void
-update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
+update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init,
                     Lisp_Object object)
 {
   Lisp_Object tmp_table;
@@ -339,12 +338,12 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init,
    or after.  On return global syntax data is good for lookup at CHARPOS. */
 
 static int
-char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
+char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   register enum syntaxcode code;
-  register EMACS_INT beg = BEGV;
+  register ptrdiff_t beg = BEGV;
   register int quoted = 0;
-  EMACS_INT orig = charpos;
+  ptrdiff_t orig = charpos;
 
   while (charpos > beg)
     {
@@ -367,8 +366,8 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos)
 /* Return the bytepos one character before BYTEPOS.
    We assume that BYTEPOS is not at the start of the buffer.  */
 
-static inline EMACS_INT
-dec_bytepos (EMACS_INT bytepos)
+static inline ptrdiff_t
+dec_bytepos (ptrdiff_t bytepos)
 {
   if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
     return bytepos - 1;
@@ -391,10 +390,10 @@ dec_bytepos (EMACS_INT bytepos)
    valid on return from the subroutine, so the caller should explicitly
    update the global data.  */
 
-static EMACS_INT
-find_defun_start (EMACS_INT pos, EMACS_INT pos_byte)
+static ptrdiff_t
+find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
 {
-  EMACS_INT opoint = PT, opoint_byte = PT_BYTE;
+  ptrdiff_t opoint = PT, opoint_byte = PT_BYTE;
 
   if (!open_paren_in_column_0_is_defun_start)
     {
@@ -461,7 +460,7 @@ find_defun_start (EMACS_INT pos, EMACS_INT pos_byte)
 /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE.  */
 
 static int
-prev_char_comend_first (EMACS_INT pos, EMACS_INT pos_byte)
+prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte)
 {
   int c, val;
 
@@ -503,7 +502,7 @@ prev_char_comend_first (EMACS_INT pos, EMACS_INT pos_byte)
    the returned value (or at FROM, if the search was not successful).  */
 
 static int
-back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested, int comstyle, EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr)
+back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested, int comstyle, ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr)
 {
   /* Look back, counting the parity of string-quotes,
      and recording the comment-starters seen.
@@ -522,14 +521,14 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
      inside another comment).
      Test case:  { a (* b } c (* d *) */
   int comment_lossage = 0;
-  EMACS_INT comment_end = from;
-  EMACS_INT comment_end_byte = from_byte;
-  EMACS_INT comstart_pos = 0;
-  EMACS_INT comstart_byte IF_LINT (= 0);
+  ptrdiff_t comment_end = from;
+  ptrdiff_t comment_end_byte = from_byte;
+  ptrdiff_t comstart_pos = 0;
+  ptrdiff_t comstart_byte IF_LINT (= 0);
   /* Place where the containing defun starts,
      or 0 if we didn't come across it yet.  */
-  EMACS_INT defun_start = 0;
-  EMACS_INT defun_start_byte = 0;
+  ptrdiff_t defun_start = 0;
+  ptrdiff_t defun_start_byte = 0;
   register enum syntaxcode code;
   int nesting = 1;             /* current comment nesting */
   int c;
@@ -543,7 +542,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
      that determines quote parity to the comment-end.  */
   while (from != stop)
     {
-      EMACS_INT temp_byte;
+      ptrdiff_t temp_byte;
       int prev_syntax, com2start, com2end;
       int comstart;
 
@@ -581,7 +580,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
         have %..\n and %{..}%.  */
       if (from > stop && (com2end || comstart))
        {
-         EMACS_INT next = from, next_byte = from_byte;
+         ptrdiff_t next = from, next_byte = from_byte;
          int next_c, next_syntax;
          DEC_BOTH (next, next_byte);
          UPDATE_SYNTAX_TABLE_BACKWARD (next);
@@ -737,7 +736,8 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested
        {
          scan_sexps_forward (&state,
                              defun_start, defun_start_byte,
-                             comment_end, -10000, 0, Qnil, 0);
+                             comment_end, TYPE_MINIMUM (EMACS_INT),
+                             0, Qnil, 0);
          defun_start = comment_end;
          if (state.incomment == (comnested ? 1 : -1)
              && state.comstyle == comstyle)
@@ -987,7 +987,7 @@ text property.  */)
       }
 
   if (val < ASIZE (Vsyntax_code_object) && NILP (match))
-    return XVECTOR (Vsyntax_code_object)->contents[val];
+    return AREF (Vsyntax_code_object, val);
   else
     /* Since we can't use a shared object, let's make a new one.  */
     return Fcons (make_number (val), match);
@@ -1099,13 +1099,13 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
   first = XCAR (value);
   match_lisp = XCDR (value);
 
-  if (!INTEGERP (first) || !(NILP (match_lisp) || INTEGERP (match_lisp)))
+  if (!INTEGERP (first) || !(NILP (match_lisp) || CHARACTERP (match_lisp)))
     {
       insert_string ("invalid");
       return syntax;
     }
 
-  syntax_code = XINT (first);
+  syntax_code = XINT (first) & INT_MAX;
   code = (enum syntaxcode) (syntax_code & 0377);
   start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code);
   start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);;
@@ -1223,12 +1223,12 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value,
    If that many words cannot be found before the end of the buffer, return 0.
    COUNT negative means scan backward and stop at word beginning.  */
 
-EMACS_INT
-scan_words (register EMACS_INT from, register EMACS_INT count)
+ptrdiff_t
+scan_words (register ptrdiff_t from, register EMACS_INT count)
 {
-  register EMACS_INT beg = BEGV;
-  register EMACS_INT end = ZV;
-  register EMACS_INT from_byte = CHAR_TO_BYTE (from);
+  register ptrdiff_t beg = BEGV;
+  register ptrdiff_t end = ZV;
+  register ptrdiff_t from_byte = CHAR_TO_BYTE (from);
   register enum syntaxcode code;
   int ch0, ch1;
   Lisp_Object func, pos;
@@ -1263,7 +1263,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
       if (! NILP (Ffboundp (func)))
        {
          pos = call2 (func, make_number (from - 1), make_number (end));
-         if (INTEGERP (pos) && XINT (pos) > from)
+         if (INTEGERP (pos) && from < XINT (pos) && XINT (pos) <= ZV)
            {
              from = XINT (pos);
              from_byte = CHAR_TO_BYTE (from);
@@ -1313,7 +1313,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count)
       if (! NILP (Ffboundp (func)))
        {
          pos = call2 (func, make_number (from), make_number (beg));
-         if (INTEGERP (pos) && XINT (pos) < from)
+         if (INTEGERP (pos) && BEGV <= XINT (pos) && XINT (pos) < from)
            {
              from = XINT (pos);
              from_byte = CHAR_TO_BYTE (from);
@@ -1357,7 +1357,7 @@ and the function returns nil.  Field boundaries are not noticed if
   (Lisp_Object arg)
 {
   Lisp_Object tmp;
-  int orig_val, val;
+  ptrdiff_t orig_val, val;
 
   if (NILP (arg))
     XSETFASTINT (arg, 1);
@@ -1432,14 +1432,14 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
   int *char_ranges IF_LINT (= NULL);
   int n_char_ranges = 0;
   int negate = 0;
-  register EMACS_INT i, i_byte;
+  register ptrdiff_t i, i_byte;
   /* Set to 1 if the current buffer is multibyte and the region
      contains non-ASCII chars.  */
   int multibyte;
   /* Set to 1 if STRING is multibyte and it contains non-ASCII
      chars.  */
   int string_multibyte;
-  EMACS_INT size_byte;
+  ptrdiff_t size_byte;
   const unsigned char *str;
   int len;
   Lisp_Object iso_classes;
@@ -1581,7 +1581,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
          fastmap[CHAR_LEADING_CODE (c)] = 1;
          range_start_byte = i;
          range_start_char = c;
-         char_ranges = (int *) alloca (sizeof (int) * 128 * 2);
+         char_ranges = alloca (sizeof *char_ranges * 128 * 2);
          for (i = 129; i < 0400; i++)
            {
              c = BYTE8_TO_CHAR (i);
@@ -1602,7 +1602,7 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
     }
   else                         /* STRING is multibyte */
     {
-      char_ranges = (int *) alloca (sizeof (int) * SCHARS (string) * 2);
+      char_ranges = alloca (sizeof *char_ranges * SCHARS (string) * 2);
 
       while (i_byte < size_byte)
        {
@@ -1753,9 +1753,9 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl
     }
 
   {
-    EMACS_INT start_point = PT;
-    EMACS_INT pos = PT;
-    EMACS_INT pos_byte = PT_BYTE;
+    ptrdiff_t start_point = PT;
+    ptrdiff_t pos = PT;
+    ptrdiff_t pos_byte = PT_BYTE;
     unsigned char *p = PT_ADDR, *endp, *stop;
 
     if (forwardp)
@@ -1925,9 +1925,9 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
   register unsigned int c;
   unsigned char fastmap[0400];
   int negate = 0;
-  register EMACS_INT i, i_byte;
+  register ptrdiff_t i, i_byte;
   int multibyte;
-  EMACS_INT size_byte;
+  ptrdiff_t size_byte;
   unsigned char *str;
 
   CHECK_STRING (string);
@@ -1980,9 +1980,9 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim)
       fastmap[i] ^= 1;
 
   {
-    EMACS_INT start_point = PT;
-    EMACS_INT pos = PT;
-    EMACS_INT pos_byte = PT_BYTE;
+    ptrdiff_t start_point = PT;
+    ptrdiff_t pos = PT;
+    ptrdiff_t pos_byte = PT_BYTE;
     unsigned char *p = PT_ADDR, *endp, *stop;
 
     if (forwardp)
@@ -2135,10 +2135,10 @@ in_classes (int c, Lisp_Object iso_classes)
    remains valid for forward search starting at the returned position. */
 
 static int
-forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop,
-             int nesting, int style, int prev_syntax,
-             EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr,
-             int *incomment_ptr)
+forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
+             EMACS_INT nesting, int style, int prev_syntax,
+             ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr,
+             EMACS_INT *incomment_ptr)
 {
   register int c, c1;
   register enum syntaxcode code;
@@ -2240,17 +2240,17 @@ If COUNT comments are found as expected, with nothing except whitespace
 between them, return t; otherwise return nil.  */)
   (Lisp_Object count)
 {
-  register EMACS_INT from;
-  EMACS_INT from_byte;
-  register EMACS_INT stop;
+  register ptrdiff_t from;
+  ptrdiff_t from_byte;
+  register ptrdiff_t stop;
   register int c, c1;
   register enum syntaxcode code;
   int comstyle = 0;        /* style of comment encountered */
   int comnested = 0;       /* whether the comment is nestable or not */
   int found;
   EMACS_INT count1;
-  EMACS_INT out_charpos, out_bytepos;
-  int dummy;
+  ptrdiff_t out_charpos, out_bytepos;
+  EMACS_INT dummy;
 
   CHECK_NUMBER (count);
   count1 = XINT (count);
@@ -2374,7 +2374,7 @@ between them, return t; otherwise return nil.  */)
            {
              /* Skip until first preceding unquoted comment_fence.  */
              int fence_found = 0;
-             EMACS_INT ini = from, ini_byte = from_byte;
+             ptrdiff_t ini = from, ini_byte = from_byte;
 
              while (1)
                {
@@ -2457,21 +2457,22 @@ static Lisp_Object
 scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag)
 {
   Lisp_Object val;
-  register EMACS_INT stop = count > 0 ? ZV : BEGV;
+  register ptrdiff_t stop = count > 0 ? ZV : BEGV;
   register int c, c1;
   int stringterm;
   int quoted;
   int mathexit = 0;
   register enum syntaxcode code, temp_code;
-  int min_depth = depth;    /* Err out if depth gets less than this.  */
+  EMACS_INT min_depth = depth;    /* Err out if depth gets less than this.  */
   int comstyle = 0;        /* style of comment encountered */
   int comnested = 0;       /* whether the comment is nestable or not */
-  EMACS_INT temp_pos;
+  ptrdiff_t temp_pos;
   EMACS_INT last_good = from;
   int found;
-  EMACS_INT from_byte;
-  EMACS_INT out_bytepos, out_charpos;
-  int temp, dummy;
+  ptrdiff_t from_byte;
+  ptrdiff_t out_bytepos, out_charpos;
+  int temp;
+  EMACS_INT dummy;
   int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol;
 
   if (depth > 0) min_depth = 0;
@@ -2895,11 +2896,11 @@ DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars,
 This includes chars with "quote" or "prefix" syntax (' or p).  */)
   (void)
 {
-  EMACS_INT beg = BEGV;
-  EMACS_INT opoint = PT;
-  EMACS_INT opoint_byte = PT_BYTE;
-  EMACS_INT pos = PT;
-  EMACS_INT pos_byte = PT_BYTE;
+  ptrdiff_t beg = BEGV;
+  ptrdiff_t opoint = PT;
+  ptrdiff_t opoint_byte = PT_BYTE;
+  ptrdiff_t pos = PT;
+  ptrdiff_t pos_byte = PT_BYTE;
   int c;
 
   if (pos <= beg)
@@ -2940,8 +2941,8 @@ This includes chars with "quote" or "prefix" syntax (' or p).  */)
 
 static void
 scan_sexps_forward (struct lisp_parse_state *stateptr,
-                   EMACS_INT from, EMACS_INT from_byte, EMACS_INT end,
-                   int targetdepth, int stopbefore,
+                   ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t end,
+                   EMACS_INT targetdepth, int stopbefore,
                    Lisp_Object oldstate, int commentstop)
 {
   struct lisp_parse_state state;
@@ -2949,23 +2950,23 @@ scan_sexps_forward (struct lisp_parse_state *stateptr,
   register enum syntaxcode code;
   int c1;
   int comnested;
-  struct level { int last, prev; };
+  struct level { ptrdiff_t last, prev; };
   struct level levelstart[100];
   register struct level *curlevel = levelstart;
   struct level *endlevel = levelstart + 100;
-  register int depth;  /* Paren depth of current scanning location.
+  register EMACS_INT depth; /* Paren depth of current scanning location.
                           level - levelstart equals this except
                           when the depth becomes negative.  */
-  int mindepth;                /* Lowest DEPTH value seen.  */
+  EMACS_INT mindepth;          /* Lowest DEPTH value seen.  */
   int start_quoted = 0;                /* Nonzero means starting after a char quote */
   Lisp_Object tem;
-  EMACS_INT prev_from;         /* Keep one character before FROM.  */
-  EMACS_INT prev_from_byte;
+  ptrdiff_t prev_from;         /* Keep one character before FROM.  */
+  ptrdiff_t prev_from_byte;
   int prev_from_syntax;
   int boundary_stop = commentstop == -1;
   int nofence;
   int found;
-  EMACS_INT out_bytepos, out_charpos;
+  ptrdiff_t out_bytepos, out_charpos;
   int temp;
 
   prev_from = from;
@@ -3009,7 +3010,7 @@ do { prev_from = from;                            \
       tem = Fcar (oldstate);
       /* Check whether we are inside string_fence-style string: */
       state.instring = (!NILP (tem)
-                       ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE)
+                       ? (CHARACTERP (tem) ? XFASTINT (tem) : ST_STRING_STYLE)
                        : -1);
 
       oldstate = Fcdr (oldstate);
@@ -3029,19 +3030,21 @@ do { prev_from = from;                          \
       tem = Fcar (oldstate);
       state.comstyle = (NILP (tem)
                        ? 0
-                       : (EQ (tem, Qsyntax_table)
-                          ? ST_COMMENT_STYLE
-                          : INTEGERP (tem) ? XINT (tem) : 1));
+                       : (RANGED_INTEGERP (0, tem, ST_COMMENT_STYLE)
+                          ? XINT (tem)
+                          : ST_COMMENT_STYLE));
 
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
-      state.comstr_start = NILP (tem) ? -1 : XINT (tem) ;
+      state.comstr_start =
+       RANGED_INTEGERP (PTRDIFF_MIN, tem, PTRDIFF_MAX) ? XINT (tem) : -1;
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
       while (!NILP (tem))              /* >= second enclosing sexps.  */
        {
-         /* curlevel++->last ran into compiler bug on Apollo */
-         curlevel->last = XINT (Fcar (tem));
+         Lisp_Object temhd = Fcar (tem);
+         if (RANGED_INTEGERP (PTRDIFF_MIN, temhd, PTRDIFF_MAX))
+           curlevel->last = XINT (temhd);
          if (++curlevel == endlevel)
            curlevel--; /* error ("Nesting too deep for parser"); */
          curlevel->prev = -1;
@@ -3314,14 +3317,14 @@ Fourth arg STOPBEFORE non-nil means stop when come to
  any character that starts a sexp.
 Fifth arg OLDSTATE is a list like what this function returns.
  It is used to initialize the state of the parse.  Elements number 1, 2, 6
- and 8 are ignored.
+ are ignored.
 Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
  If it is symbol `syntax-table', stop after the start of a comment or a
  string, or after end of a comment or a string.  */)
   (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop)
 {
   struct lisp_parse_state state;
-  int target;
+  EMACS_INT target;
 
   if (!NILP (targetdepth))
     {
@@ -3329,7 +3332,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment.
       target = XINT (targetdepth);
     }
   else
-    target = -100000;          /* We won't reach this depth */
+    target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth */
 
   validate_region (&from, &to);
   scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)),
@@ -3382,32 +3385,31 @@ init_syntax_once (void)
   /* Create objects which can be shared among syntax tables.  */
   Vsyntax_code_object = Fmake_vector (make_number (Smax), Qnil);
   for (i = 0; i < ASIZE (Vsyntax_code_object); i++)
-    XVECTOR (Vsyntax_code_object)->contents[i]
-      = Fcons (make_number (i), Qnil);
+    ASET (Vsyntax_code_object, i, Fcons (make_number (i), Qnil));
 
   /* Now we are ready to set up this property, so we can
      create syntax tables.  */
   Fput (Qsyntax_table, Qchar_table_extra_slots, make_number (0));
 
-  temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace];
+  temp = AREF (Vsyntax_code_object, (int) Swhitespace);
 
   Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp);
 
   /* Control characters should not be whitespace.  */
-  temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct];
+  temp = AREF (Vsyntax_code_object, (int) Spunct);
   for (i = 0; i <= ' ' - 1; i++)
     SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp);
 
   /* Except that a few really are whitespace.  */
-  temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace];
+  temp = AREF (Vsyntax_code_object, (int) Swhitespace);
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp);
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp);
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp);
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp);
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp);
 
-  temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword];
+  temp = AREF (Vsyntax_code_object, (int) Sword);
   for (i = 'a'; i <= 'z'; i++)
     SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp);
   for (i = 'A'; i <= 'Z'; i++)
@@ -3435,14 +3437,14 @@ init_syntax_once (void)
   SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\\',
                        Fcons (make_number ((int) Sescape), Qnil));
 
-  temp = XVECTOR (Vsyntax_code_object)->contents[(int) Ssymbol];
+  temp = AREF (Vsyntax_code_object, (int) Ssymbol);
   for (i = 0; i < 10; i++)
     {
       c = "_-+*/&|<>="[i];
       SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, c, temp);
     }
 
-  temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct];
+  temp = AREF (Vsyntax_code_object, (int) Spunct);
   for (i = 0; i < 12; i++)
     {
       c = ".,;:?!#@~^'`"[i];
@@ -3450,7 +3452,7 @@ init_syntax_once (void)
     }
 
   /* All multibyte characters have syntax `word' by default.  */
-  temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword];
+  temp = AREF (Vsyntax_code_object, (int) Sword);
   char_table_set_range (Vstandard_syntax_table, 0x80, MAX_CHAR, temp);
 }
 
@@ -3473,7 +3475,7 @@ syms_of_syntax (void)
   Fput (Qscan_error, Qerror_conditions,
        pure_cons (Qscan_error, pure_cons (Qerror, Qnil)));
   Fput (Qscan_error, Qerror_message,
-       make_pure_c_string ("Scan error"));
+       build_pure_c_string ("Scan error"));
 
   DEFVAR_BOOL ("parse-sexp-ignore-comments", parse_sexp_ignore_comments,
               doc: /* Non-nil means `forward-sexp', etc., should treat comments as whitespace.  */);
@@ -3494,7 +3496,7 @@ See the info node `(elisp)Syntax Properties' for a description of the
 
   DEFVAR_BOOL ("open-paren-in-column-0-is-defun-start",
               open_paren_in_column_0_is_defun_start,
-              doc: /* *Non-nil means an open paren in column 0 denotes the start of a defun.  */);
+              doc: /* Non-nil means an open paren in column 0 denotes the start of a defun.  */);
   open_paren_in_column_0_is_defun_start = 1;
 
 
index a5d7ec5acedcdfb374bc7ea83df4d7855176ca22..6edb1585795bb09dab121286cf48d7f2bad7df9a 100644 (file)
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
-extern void update_syntax_table (EMACS_INT, EMACS_INT, int, Lisp_Object);
+extern void update_syntax_table (ptrdiff_t, EMACS_INT, int, Lisp_Object);
 
 /* The standard syntax table is stored where it will automatically
    be used in all new buffers.  */
@@ -258,7 +258,7 @@ do                                                                  \
     else if (EQ (gl_state.object, Qt))                                 \
       {                                                                        \
        gl_state.b_property = 0;                                        \
-       gl_state.e_property = MOST_POSITIVE_FIXNUM;                     \
+       gl_state.e_property = PTRDIFF_MAX;                              \
        gl_state.offset = 0;                                            \
       }                                                                        \
     else                                                               \
@@ -277,15 +277,15 @@ while (0)
 struct gl_state_s
 {
   Lisp_Object object;                  /* The object we are scanning. */
-  EMACS_INT start;                     /* Where to stop. */
-  EMACS_INT stop;                      /* Where to stop. */
+  ptrdiff_t start;                     /* Where to stop. */
+  ptrdiff_t stop;                      /* Where to stop. */
   int use_global;                      /* Whether to use global_code
                                           or c_s_t. */
   Lisp_Object global_code;             /* Syntax code of current char. */
   Lisp_Object current_syntax_table;    /* Syntax table for current pos. */
   Lisp_Object old_prop;                        /* Syntax-table prop at prev pos. */
-  EMACS_INT b_property;                        /* First index where c_s_t is valid. */
-  EMACS_INT e_property;                        /* First index where c_s_t is
+  ptrdiff_t b_property;                        /* First index where c_s_t is valid. */
+  ptrdiff_t e_property;                        /* First index where c_s_t is
                                           not valid. */
   INTERVAL forward_i;                  /* Where to start lookup on forward */
   INTERVAL backward_i;                 /* or backward movement.  The
@@ -295,8 +295,8 @@ struct gl_state_s
                                           intervals too, depending
                                           on: */
   /* Offset for positions specified to UPDATE_SYNTAX_TABLE.  */
-  EMACS_INT offset;
+  ptrdiff_t offset;
 };
 
 extern struct gl_state_s gl_state;
-extern EMACS_INT scan_words (EMACS_INT, EMACS_INT);
+extern ptrdiff_t scan_words (ptrdiff_t, EMACS_INT);
index edaaa4c93d73539eec49e67ca1bdb7d69048e797..7d0855b543c469a49240aa9fe6e50ddf32163d5f 100644 (file)
@@ -32,39 +32,39 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <allocator.h>
 #include <careadlinkat.h>
 #include <ignore-value.h>
+#include <utimens.h>
 
 #include "lisp.h"
 #include "sysselect.h"
 #include "blockinput.h"
 
+#ifdef BSD_SYSTEM
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
+#ifdef __FreeBSD__
+#include <sys/user.h>
+#include <sys/resource.h>
+#include <math.h>
+#endif
+
 #ifdef WINDOWSNT
 #define read sys_read
 #define write sys_write
 #include <windows.h>
-#ifndef NULL
-#define NULL 0
-#endif
 #endif /* not WINDOWSNT */
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <errno.h>
 
-#ifdef HAVE_SETPGID
-#if !defined (USG)
-#undef setpgrp
-#define setpgrp setpgid
-#endif
-#endif
-
 /* Get SI_SRPC_DOMAIN, if it is available.  */
 #ifdef HAVE_SYS_SYSTEMINFO_H
 #include <sys/systeminfo.h>
 #endif
 
 #ifdef MSDOS   /* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
-#include <dos.h>
-#include "dosfns.h"
 #include "msdos.h"
 #include <sys/param.h>
 #endif
@@ -101,25 +101,16 @@ extern char *getwd (char *);
 
 #include "syssignal.h"
 #include "systime.h"
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-
-#ifndef HAVE_UTIMES
-#ifndef HAVE_STRUCT_UTIMBUF
-/* We want to use utime rather than utimes, but we couldn't find the
-   structure declaration.  We'll use the traditional one.  */
-struct utimbuf {
-  long actime;
-  long modtime;
-};
-#endif
-#endif
 
 static int emacs_get_tty (int, struct emacs_tty *);
 static int emacs_set_tty (int, struct emacs_tty *, int);
 #if defined TIOCNOTTY || defined USG5 || defined CYGWIN
-static void croak (char *) NO_RETURN;
+static _Noreturn void croak (char *);
+#endif
+
+/* ULLONG_MAX is missing on Red Hat Linux 7.3; see Bug#11781.  */
+#ifndef ULLONG_MAX
+#define ULLONG_MAX TYPE_MAXIMUM (unsigned long long int)
 #endif
 
 /* Declare here, including term.h is problematic on some systems.  */
@@ -157,7 +148,7 @@ get_current_dir_name (void)
 #endif
       )
     {
-      buf = (char *) malloc (strlen (pwd) + 1);
+      buf = malloc (strlen (pwd) + 1);
       if (!buf)
         return NULL;
       strcpy (buf, pwd);
@@ -166,7 +157,7 @@ get_current_dir_name (void)
   else
     {
       size_t buf_size = 1024;
-      buf = (char *) malloc (buf_size);
+      buf = malloc (buf_size);
       if (!buf)
         return NULL;
       for (;;)
@@ -181,7 +172,7 @@ get_current_dir_name (void)
               return NULL;
             }
           buf_size *= 2;
-          buf = (char *) realloc (buf, buf_size);
+          buf = realloc (buf, buf_size);
           if (!buf)
             return NULL;
         }
@@ -190,7 +181,7 @@ get_current_dir_name (void)
   else
     {
       /* We need MAXPATHLEN here.  */
-      buf = (char *) malloc (MAXPATHLEN + 1);
+      buf = malloc (MAXPATHLEN + 1);
       if (!buf)
         return NULL;
       if (getwd (buf) == NULL)
@@ -296,7 +287,7 @@ int wait_debugging EXTERNALLY_VISIBLE;
 #ifndef MSDOS
 
 static void
-wait_for_termination_1 (int pid, int interruptible)
+wait_for_termination_1 (pid_t pid, int interruptible)
 {
   while (1)
     {
@@ -344,14 +335,14 @@ wait_for_termination_1 (int pid, int interruptible)
    make sure it will get eliminated (not remain forever as a zombie) */
 
 void
-wait_for_termination (int pid)
+wait_for_termination (pid_t pid)
 {
   wait_for_termination_1 (pid, 0);
 }
 
 /* Like the above, but allow keyboard interruption. */
 void
-interruptible_wait_for_termination (int pid)
+interruptible_wait_for_termination (pid_t pid)
 {
   wait_for_termination_1 (pid, 1);
 }
@@ -530,7 +521,7 @@ sys_subshell (void)
     goto xyzzy;
 
   dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
-  str_volatile = str = (unsigned char *) alloca (SCHARS (dir) + 2);
+  str_volatile = str = alloca (SCHARS (dir) + 2);
   len = SCHARS (dir);
   memcpy (str, SDATA (dir), len);
   if (str[len - 1] != '/') str[len++] = '/';
@@ -865,7 +856,7 @@ init_sys_modes (struct tty_display_info *tty_out)
     return;                     /* The tty is suspended. */
 
   if (! tty_out->old_tty)
-    tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
+    tty_out->old_tty = xmalloc (sizeof *tty_out->old_tty);
 
   emacs_get_tty (fileno (tty_out->input), tty_out->old_tty);
 
@@ -1359,7 +1350,7 @@ init_system_name (void)
   Vsystem_name = build_string (uts.nodename);
 #else /* HAVE_GETHOSTNAME */
   unsigned int hostname_size = 256;
-  char *hostname = (char *) alloca (hostname_size);
+  char *hostname = alloca (hostname_size);
 
   /* Try to get the host name; if the buffer is too short, try
      again.  Apparently, the only indication gethostname gives of
@@ -1375,7 +1366,7 @@ init_system_name (void)
        break;
 
       hostname_size <<= 1;
-      hostname = (char *) alloca (hostname_size);
+      hostname = alloca (hostname_size);
     }
 #ifdef HAVE_SOCKETS
   /* Turn the hostname into the official, fully-qualified hostname.
@@ -1493,9 +1484,10 @@ sys_signal (int signal_number, signal_handler_t action)
 #if defined (SA_RESTART)
   /* Emacs mostly works better with restartable system services. If this
      flag exists, we probably want to turn it on here.
-     However, on some systems this resets the timeout of `select'
-     which means that `select' never finishes if it keeps getting signals.
-     BROKEN_SA_RESTART is defined on those systems.  */
+     However, on some systems (only hpux11 at present) this resets the
+     timeout of `select' which means that `select' never finishes if
+     it keeps getting signals.
+     We define BROKEN_SA_RESTART on those systems.  */
   /* It's not clear why the comment above says "mostly works better".  --Stef
      When SYNC_INPUT is set, we don't want SA_RESTART because we need to poll
      for pending input so we need long-running syscalls to be interrupted
@@ -1800,21 +1792,6 @@ get_random (void)
   return val & INTMASK;
 }
 
-#ifndef HAVE_STRERROR
-#ifndef WINDOWSNT
-char *
-strerror (int errnum)
-{
-  extern char *sys_errlist[];
-  extern int sys_nerr;
-
-  if (errnum >= 0 && errnum < sys_nerr)
-    return sys_errlist[errnum];
-  return (char *) "Unknown error";
-}
-#endif /* not WINDOWSNT */
-#endif /* ! HAVE_STRERROR */
-
 #ifndef HAVE_SNPRINTF
 /* Approximate snprintf as best we can on ancient hosts that lack it.  */
 int
@@ -1902,8 +1879,8 @@ emacs_close (int fd)
 /* Read from FILEDESC to a buffer BUF with size NBYTE, retrying if interrupted.
    Return the number of bytes read, which might be less than NBYTE.
    On error, set errno and return -1.  */
-EMACS_INT
-emacs_read (int fildes, char *buf, EMACS_INT nbyte)
+ptrdiff_t
+emacs_read (int fildes, char *buf, ptrdiff_t nbyte)
 {
   register ssize_t rtnval;
 
@@ -1919,11 +1896,11 @@ emacs_read (int fildes, char *buf, EMACS_INT nbyte)
 /* Write to FILEDES from a buffer BUF with size NBYTE, retrying if interrupted
    or if a partial write occurs.  Return the number of bytes written, setting
    errno if this is less than NBYTE.  */
-EMACS_INT
-emacs_write (int fildes, const char *buf, EMACS_INT nbyte)
+ptrdiff_t
+emacs_write (int fildes, const char *buf, ptrdiff_t nbyte)
 {
   ssize_t rtnval;
-  EMACS_INT bytes_written;
+  ptrdiff_t bytes_written;
 
   bytes_written = 0;
 
@@ -2023,65 +2000,6 @@ getwd (char *pathname)
 
 #endif /* HAVE_GETWD */
 
-/*
- *     Emulate rename using unlink/link.  Note that this is
- *     only partially correct.  Also, doesn't enforce restriction
- *     that files be of same type (regular->regular, dir->dir, etc).
- */
-
-#ifndef HAVE_RENAME
-
-int
-rename (const char *from, const char *to)
-{
-  if (access (from, 0) == 0)
-    {
-      unlink (to);
-      if (link (from, to) == 0)
-       if (unlink (from) == 0)
-         return (0);
-    }
-  return (-1);
-}
-
-#endif
-
-
-#if defined (HPUX) && !defined (HAVE_PERROR)
-
-/* HPUX curses library references perror, but as far as we know
-   it won't be called.  Anyway this definition will do for now.  */
-
-void
-perror (void)
-{
-}
-#endif /* HPUX and not HAVE_PERROR */
-
-/*
- *     Gettimeofday.  Simulate as much as possible.  Only accurate
- *     to nearest second.  Emacs doesn't use tzp so ignore it for now.
- *     Only needed when subprocesses are defined.
- */
-
-#ifndef HAVE_GETTIMEOFDAY
-#ifdef HAVE_TIMEVAL
-
-int
-gettimeofday (struct timeval *tp, struct timezone *tzp)
-{
-  extern long time (long);
-
-  tp->tv_sec = time ((long *)0);
-  tp->tv_usec = 0;
-  if (tzp != 0)
-    tzp->tz_minuteswest = -1;
-  return 0;
-}
-
-#endif
-#endif /* !HAVE_GETTIMEOFDAY && HAVE_TIMEVAL */
-
 /*
  *     This function will go away as soon as all the stubs fixed. (fnf)
  */
@@ -2118,146 +2036,44 @@ closedir (DIR *dirp /* stream from opendir */)
 #endif /* HAVE_DIRENT_H */
 
 \f
-int
-set_file_times (const char *filename, EMACS_TIME atime, EMACS_TIME mtime)
-{
-#ifdef HAVE_UTIMES
-  struct timeval tv[2];
-  tv[0] = atime;
-  tv[1] = mtime;
-  return utimes (filename, tv);
-#else /* not HAVE_UTIMES */
-  struct utimbuf utb;
-  utb.actime = EMACS_SECS (atime);
-  utb.modtime = EMACS_SECS (mtime);
-  return utime (filename, &utb);
-#endif /* not HAVE_UTIMES */
-}
-\f
-/* mkdir and rmdir functions, for systems which don't have them.  */
-
-#ifndef HAVE_MKDIR
-/*
- * Written by Robert Rother, Mariah Corporation, August 1985.
- *
- * If you want it, it's yours.  All I ask in return is that if you
- * figure out how to do this in a Bourne Shell script you send me
- * a copy.
- *                                     sdcsvax!rmr or rmr@uscd
- *
- * Severely hacked over by John Gilmore to make a 4.2BSD compatible
- * subroutine.  11Mar86; hoptoad!gnu
- *
- * Modified by rmtodd@uokmax 6-28-87 -- when making an already existing dir,
- * subroutine didn't return EEXIST.  It does now.
- */
-
-/*
- * Make a directory.
- */
-int
-mkdir (char *dpath, int dmode)
+/* Return a struct timeval that is roughly equivalent to T.
+   Use the least timeval not less than T.
+   Return an extremal value if the result would overflow.  */
+struct timeval
+make_timeval (EMACS_TIME t)
 {
-  int cpid, status, fd;
-  struct stat statbuf;
-
-  if (stat (dpath, &statbuf) == 0)
-    {
-      errno = EEXIST;          /* Stat worked, so it already exists */
-      return -1;
-    }
-
-  /* If stat fails for a reason other than non-existence, return error */
-  if (errno != ENOENT)
-    return -1;
-
-  synch_process_alive = 1;
-  switch (cpid = fork ())
-    {
-
-    case -1:                   /* Error in fork */
-      return (-1);             /* Errno is set already */
-
-    case 0:                    /* Child process */
-      /*
-                * Cheap hack to set mode of new directory.  Since this
-                * child process is going away anyway, we zap its umask.
-                * FIXME, this won't suffice to set SUID, SGID, etc. on this
-                * directory.  Does anybody care?
-                */
-      status = umask (0);      /* Get current umask */
-      status = umask (status | (0777 & ~dmode));       /* Set for mkdir */
-      fd = emacs_open ("/dev/null", O_RDWR, 0);
-      if (fd >= 0)
-        {
-         dup2 (fd, 0);
-         dup2 (fd, 1);
-         dup2 (fd, 2);
-        }
-      execl ("/bin/mkdir", "mkdir", dpath, (char *) 0);
-      _exit (-1);              /* Can't exec /bin/mkdir */
-
-    default:                   /* Parent process */
-      wait_for_termination (cpid);
-    }
+  struct timeval tv;
+  tv.tv_sec = t.tv_sec;
+  tv.tv_usec = t.tv_nsec / 1000;
 
-  if (synch_process_death != 0 || synch_process_retcode != 0
-      || synch_process_termsig != 0)
+  if (t.tv_nsec % 1000 != 0)
     {
-      errno = EIO;             /* We don't know why, but */
-      return -1;               /* /bin/mkdir failed */
+      if (tv.tv_usec < 999999)
+       tv.tv_usec++;
+      else if (tv.tv_sec < TYPE_MAXIMUM (time_t))
+       {
+         tv.tv_sec++;
+         tv.tv_usec = 0;
+       }
     }
 
-  return 0;
+  return tv;
 }
-#endif /* not HAVE_MKDIR */
 
-#ifndef HAVE_RMDIR
+/* Set the access and modification time stamps of FD (a.k.a. FILE) to be
+   ATIME and MTIME, respectively.
+   FD must be either negative -- in which case it is ignored --
+   or a file descriptor that is open on FILE.
+   If FD is nonnegative, then FILE can be NULL.  */
 int
-rmdir (char *dpath)
+set_file_times (int fd, const char *filename,
+               EMACS_TIME atime, EMACS_TIME mtime)
 {
-  int cpid, status, fd;
-  struct stat statbuf;
-
-  if (stat (dpath, &statbuf) != 0)
-    {
-      /* Stat just set errno.  We don't have to */
-      return -1;
-    }
-
-  synch_process_alive = 1;
-  switch (cpid = fork ())
-    {
-
-    case -1:                   /* Error in fork */
-      return (-1);             /* Errno is set already */
-
-    case 0:                    /* Child process */
-      fd = emacs_open ("/dev/null", O_RDWR, 0);
-      if (fd >= 0)
-        {
-         dup2 (fd, 0);
-         dup2 (fd, 1);
-         dup2 (fd, 2);
-        }
-      execl ("/bin/rmdir", "rmdir", dpath, (char *) 0);
-      _exit (-1);              /* Can't exec /bin/rmdir */
-
-    default:                   /* Parent process */
-      wait_for_termination (cpid);
-    }
-
-  if (synch_process_death != 0 || synch_process_retcode != 0
-      || synch_process_termsig != 0)
-    {
-      errno = EIO;             /* We don't know why, but */
-      return -1;               /* /bin/rmdir failed */
-    }
-
-  return 0;
+  struct timespec timespec[2];
+  timespec[0] = atime;
+  timespec[1] = mtime;
+  return fdutimens (fd, filename, timespec);
 }
-#endif /* !HAVE_RMDIR */
-
 \f
 #ifndef HAVE_STRSIGNAL
 char *
@@ -2529,6 +2345,52 @@ list_system_processes (void)
   return proclist;
 }
 
+#elif defined BSD_SYSTEM
+
+Lisp_Object
+list_system_processes (void)
+{
+#if defined DARWIN_OS || defined __NetBSD__ || defined __OpenBSD__
+  int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL};
+#else
+  int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PROC};
+#endif
+  size_t len;
+  struct kinfo_proc *procs;
+  size_t i;
+
+  struct gcpro gcpro1;
+  Lisp_Object proclist = Qnil;
+
+  if (sysctl (mib, 3, NULL, &len, NULL, 0) != 0)
+    return proclist;
+
+  procs = xmalloc (len);
+  if (sysctl (mib, 3, procs, &len, NULL, 0) != 0)
+    {
+      xfree (procs);
+      return proclist;
+    }
+
+  GCPRO1 (proclist);
+  len /= sizeof (struct kinfo_proc);
+  for (i = 0; i < len; i++)
+    {
+#if defined DARWIN_OS || defined __NetBSD__
+      proclist = Fcons (make_fixnum_or_float (procs[i].kp_proc.p_pid), proclist);
+#elif defined __OpenBSD__
+      proclist = Fcons (make_fixnum_or_float (procs[i].p_pid), proclist);
+#else
+      proclist = Fcons (make_fixnum_or_float (procs[i].ki_pid), proclist);
+#endif
+    }
+  UNGCPRO;
+
+  xfree (procs);
+
+  return  proclist;
+}
+
 /* The WINDOWSNT implementation is in w32.c.
    The MSDOS implementation is in dosfns.c.  */
 #elif !defined (WINDOWSNT) && !defined (MSDOS)
@@ -2542,60 +2404,78 @@ list_system_processes (void)
 #endif /* !defined (WINDOWSNT) */
 
 #ifdef GNU_LINUX
-static void
-time_from_jiffies (unsigned long long tval, long hz,
-                  time_t *sec, unsigned *usec)
-{
-  unsigned long long ullsec;
-
-  *sec = tval / hz;
-  ullsec = *sec;
-  tval -= ullsec * hz;
-  /* Careful: if HZ > 1 million, then integer division by it yields zero.  */
-  if (hz <= 1000000)
-    *usec = tval * 1000000 / hz;
+static EMACS_TIME
+time_from_jiffies (unsigned long long tval, long hz)
+{
+  unsigned long long s = tval / hz;
+  unsigned long long frac = tval % hz;
+  int ns;
+
+  if (TYPE_MAXIMUM (time_t) < s)
+    time_overflow ();
+  if (LONG_MAX - 1 <= ULLONG_MAX / EMACS_TIME_RESOLUTION
+      || frac <= ULLONG_MAX / EMACS_TIME_RESOLUTION)
+    ns = frac * EMACS_TIME_RESOLUTION / hz;
   else
-    *usec = tval / (hz / 1000000);
+    {
+      /* This is reachable only in the unlikely case that HZ * HZ
+        exceeds ULLONG_MAX.  It calculates an approximation that is
+        guaranteed to be in range.  */
+      long hz_per_ns = (hz / EMACS_TIME_RESOLUTION
+                       + (hz % EMACS_TIME_RESOLUTION != 0));
+      ns = frac / hz_per_ns;
+    }
+
+  return make_emacs_time (s, ns);
 }
 
 static Lisp_Object
 ltime_from_jiffies (unsigned long long tval, long hz)
 {
-  time_t sec;
-  unsigned usec;
-
-  time_from_jiffies (tval, hz, &sec, &usec);
-
-  return list3 (make_number ((sec >> 16) & 0xffff),
-               make_number (sec & 0xffff),
-               make_number (usec));
+  EMACS_TIME t = time_from_jiffies (tval, hz);
+  return make_lisp_time (t);
 }
 
-static void
-get_up_time (time_t *sec, unsigned *usec)
+static EMACS_TIME
+get_up_time (void)
 {
   FILE *fup;
-
-  *sec = *usec = 0;
+  EMACS_TIME up = make_emacs_time (0, 0);
 
   BLOCK_INPUT;
   fup = fopen ("/proc/uptime", "r");
 
   if (fup)
     {
-      double uptime, idletime;
+      unsigned long long upsec, upfrac, idlesec, idlefrac;
+      int upfrac_start, upfrac_end, idlefrac_start, idlefrac_end;
 
-      /* The numbers in /proc/uptime use C-locale decimal point, but
-        we already set ourselves to the C locale (see `fixup_locale'
-        in emacs.c).  */
-      if (2 <= fscanf (fup, "%lf %lf", &uptime, &idletime))
+      if (fscanf (fup, "%llu.%n%llu%n %llu.%n%llu%n",
+                 &upsec, &upfrac_start, &upfrac, &upfrac_end,
+                 &idlesec, &idlefrac_start, &idlefrac, &idlefrac_end)
+         == 4)
        {
-         *sec = uptime;
-         *usec = (uptime - *sec) * 1000000;
+         if (TYPE_MAXIMUM (time_t) < upsec)
+           {
+             upsec = TYPE_MAXIMUM (time_t);
+             upfrac = EMACS_TIME_RESOLUTION - 1;
+           }
+         else
+           {
+             int upfraclen = upfrac_end - upfrac_start;
+             for (; upfraclen < LOG10_EMACS_TIME_RESOLUTION; upfraclen++)
+               upfrac *= 10;
+             for (; LOG10_EMACS_TIME_RESOLUTION < upfraclen; upfraclen--)
+               upfrac /= 10;
+             upfrac = min (upfrac, EMACS_TIME_RESOLUTION - 1);
+           }
+         up = make_emacs_time (upsec, upfrac);
        }
       fclose (fup);
     }
   UNBLOCK_INPUT;
+
+  return up;
 }
 
 #define MAJOR(d) (((unsigned)(d) >> 8) & 0xfff)
@@ -2684,26 +2564,28 @@ system_process_attributes (Lisp_Object pid)
   char procbuf[1025], *p, *q;
   int fd;
   ssize_t nread;
-  const char *cmd = NULL;
+  static char const default_cmd[] = "???";
+  const char *cmd = default_cmd;
+  int cmdsize = sizeof default_cmd - 1;
   char *cmdline = NULL;
-  ptrdiff_t cmdsize = 0, cmdline_size;
+  ptrdiff_t cmdline_size;
   unsigned char c;
-  int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount;
+  printmax_t proc_id;
+  int ppid, pgrp, sess, tty, tpgid, thcount;
+  uid_t uid;
+  gid_t gid;
   unsigned long long u_time, s_time, cutime, cstime, start;
   long priority, niceness, rss;
   unsigned long minflt, majflt, cminflt, cmajflt, vsize;
-  time_t sec;
-  unsigned usec;
-  EMACS_TIME tnow, tstart, tboot, telapsed;
+  EMACS_TIME tnow, tstart, tboot, telapsed, us_time;
   double pcpu, pmem;
   Lisp_Object attrs = Qnil;
   Lisp_Object cmd_str, decoded_cmd, tem;
   struct gcpro gcpro1, gcpro2;
-  EMACS_INT uid_eint, gid_eint;
 
   CHECK_NUMBER_OR_FLOAT (pid);
-  proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
-  sprintf (procfn, "/proc/%u", proc_id);
+  CONS_TO_INTEGER (pid, pid_t, proc_id);
+  sprintf (procfn, "/proc/%"pMd, proc_id);
   if (stat (procfn, &st) < 0)
     return attrs;
 
@@ -2711,9 +2593,7 @@ system_process_attributes (Lisp_Object pid)
 
   /* euid egid */
   uid = st.st_uid;
-  /* Use of EMACS_INT stops GCC whining about limited range of data type.  */
-  uid_eint = uid;
-  attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid_eint)), attrs);
+  attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
   BLOCK_INPUT;
   pw = getpwuid (uid);
   UNBLOCK_INPUT;
@@ -2721,8 +2601,7 @@ system_process_attributes (Lisp_Object pid)
     attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
 
   gid = st.st_gid;
-  gid_eint = gid;
-  attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid_eint)), attrs);
+  attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
   BLOCK_INPUT;
   gr = getgrgid (gid);
   UNBLOCK_INPUT;
@@ -2751,11 +2630,6 @@ system_process_attributes (Lisp_Object pid)
        }
       else
        q = NULL;
-      if (cmd == NULL)
-       {
-         cmd = "???";
-         cmdsize = 3;
-       }
       /* Command name is encoded in locale-coding-system; decode it.  */
       cmd_str = make_unibyte_string (cmd, cmdsize);
       decoded_cmd = code_convert_string_norecord (cmd_str,
@@ -2820,36 +2694,19 @@ system_process_attributes (Lisp_Object pid)
          attrs = Fcons (Fcons (Qpri, make_number (priority)), attrs);
          attrs = Fcons (Fcons (Qnice, make_number (niceness)), attrs);
          attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (thcount_eint)), attrs);
-         EMACS_GET_TIME (tnow);
-         get_up_time (&sec, &usec);
-         EMACS_SET_SECS (telapsed, sec);
-         EMACS_SET_USECS (telapsed, usec);
-         EMACS_SUB_TIME (tboot, tnow, telapsed);
-         time_from_jiffies (start, clocks_per_sec, &sec, &usec);
-         EMACS_SET_SECS (tstart, sec);
-         EMACS_SET_USECS (tstart, usec);
-         EMACS_ADD_TIME (tstart, tboot, tstart);
-         attrs = Fcons (Fcons (Qstart,
-                               list3 (make_number
-                                      ((EMACS_SECS (tstart) >> 16) & 0xffff),
-                                      make_number
-                                      (EMACS_SECS (tstart) & 0xffff),
-                                      make_number
-                                      (EMACS_USECS (tstart)))),
-                        attrs);
+         tnow = current_emacs_time ();
+         telapsed = get_up_time ();
+         tboot = sub_emacs_time (tnow, telapsed);
+         tstart = time_from_jiffies (start, clocks_per_sec);
+         tstart = add_emacs_time (tboot, tstart);
+         attrs = Fcons (Fcons (Qstart, make_lisp_time (tstart)), attrs);
          attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (vsize/1024)), attrs);
          attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (4*rss)), attrs);
-         EMACS_SUB_TIME (telapsed, tnow, tstart);
-         attrs = Fcons (Fcons (Qetime,
-                               list3 (make_number
-                                      ((EMACS_SECS (telapsed) >> 16) & 0xffff),
-                                      make_number
-                                      (EMACS_SECS (telapsed) & 0xffff),
-                                      make_number
-                                      (EMACS_USECS (telapsed)))),
-                        attrs);
-         time_from_jiffies (u_time + s_time, clocks_per_sec, &sec, &usec);
-         pcpu = (sec + usec / 1000000.0) / (EMACS_SECS (telapsed) + EMACS_USECS (telapsed) / 1000000.0);
+         telapsed = sub_emacs_time (tnow, tstart);
+         attrs = Fcons (Fcons (Qetime, make_lisp_time (telapsed)), attrs);
+         us_time = time_from_jiffies (u_time + s_time, clocks_per_sec);
+         pcpu = (EMACS_TIME_TO_DOUBLE (us_time)
+                 / EMACS_TIME_TO_DOUBLE (telapsed));
          if (pcpu > 1.0)
            pcpu = 1.0;
          attrs = Fcons (Fcons (Qpcpu, make_float (100 * pcpu)), attrs);
@@ -2910,14 +2767,9 @@ system_process_attributes (Lisp_Object pid)
        }
       if (!cmdline_size)
        {
-         if (!cmd)
-           cmd = "???";
-         if (!cmdsize)
-           cmdsize = strlen (cmd);
          cmdline_size = cmdsize + 2;
          cmdline = xmalloc (cmdline_size + 1);
-         strcpy (cmdline, "[");
-         strcat (strncat (cmdline, cmd, cmdsize), "]");
+         sprintf (cmdline, "[%.*s]", cmdsize, cmd);
        }
       emacs_close (fd);
       /* Command line is encoded in locale-coding-system; decode it.  */
@@ -2962,15 +2814,16 @@ system_process_attributes (Lisp_Object pid)
   struct psinfo pinfo;
   int fd;
   ssize_t nread;
-  int proc_id, uid, gid;
+  printmax_t proc_id;
+  uid_t uid;
+  gid_t gid;
   Lisp_Object attrs = Qnil;
   Lisp_Object decoded_cmd, tem;
   struct gcpro gcpro1, gcpro2;
-  EMACS_INT uid_eint, gid_eint;
 
   CHECK_NUMBER_OR_FLOAT (pid);
-  proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid);
-  sprintf (procfn, "/proc/%u", proc_id);
+  CONS_TO_INTEGER (pid, pid_t, proc_id);
+  sprintf (procfn, "/proc/%"pMd, proc_id);
   if (stat (procfn, &st) < 0)
     return attrs;
 
@@ -2978,9 +2831,7 @@ system_process_attributes (Lisp_Object pid)
 
   /* euid egid */
   uid = st.st_uid;
-  /* Use of EMACS_INT stops GCC whining about limited range of data type.  */
-  uid_eint = uid;
-  attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid_eint)), attrs);
+  attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs);
   BLOCK_INPUT;
   pw = getpwuid (uid);
   UNBLOCK_INPUT;
@@ -2988,8 +2839,7 @@ system_process_attributes (Lisp_Object pid)
     attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
 
   gid = st.st_gid;
-  gid_eint = gid;
-  attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid_eint)), attrs);
+  attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs);
   BLOCK_INPUT;
   gr = getgrgid (gid);
   UNBLOCK_INPUT;
@@ -3032,33 +2882,20 @@ system_process_attributes (Lisp_Object pid)
                Qcstime
                Are they available? */
 
-         attrs = Fcons (Fcons (Qtime,
-                               list3 (make_number (pinfo.pr_time.tv_sec >> 16),
-                                      make_number (pinfo.pr_time.tv_sec & 0xffff),
-                                      make_number (pinfo.pr_time.tv_nsec))),
-                        attrs);
-
-         attrs = Fcons (Fcons (Qctime,
-                               list3 (make_number (pinfo.pr_ctime.tv_sec >> 16),
-                                      make_number (pinfo.pr_ctime.tv_sec & 0xffff),
-                                      make_number (pinfo.pr_ctime.tv_nsec))),
-                        attrs);
-
+         attrs = Fcons (Fcons (Qtime, make_lisp_time (pinfo.pr_time)), attrs);
+         attrs = Fcons (Fcons (Qctime, make_lisp_time (pinfo.pr_ctime)), attrs);
          attrs = Fcons (Fcons (Qpri, make_number (pinfo.pr_lwp.pr_pri)), attrs);
          attrs = Fcons (Fcons (Qnice, make_number (pinfo.pr_lwp.pr_nice)), attrs);
          attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (pinfo.pr_nlwp)), attrs);
 
-         attrs = Fcons (Fcons (Qstart,
-                               list3 (make_number (pinfo.pr_start.tv_sec >> 16),
-                                      make_number (pinfo.pr_start.tv_sec & 0xffff),
-                                      make_number (pinfo.pr_start.tv_nsec))),
-                        attrs);
+         attrs = Fcons (Fcons (Qstart, make_lisp_time (pinfo.pr_start)), attrs);
          attrs = Fcons (Fcons (Qvsize, make_fixnum_or_float (pinfo.pr_size)), attrs);
          attrs = Fcons (Fcons (Qrss, make_fixnum_or_float (pinfo.pr_rssize)), attrs);
 
-         /* pr_pctcpu and pr_pctmem are encoded as a fixed point 16 bit number in  [0 ... 1].  */
-         attrs = Fcons (Fcons (Qpcpu, (pinfo.pr_pctcpu * 100.0) / (double)0x8000), attrs);
-         attrs = Fcons (Fcons (Qpmem, (pinfo.pr_pctmem * 100.0) / (double)0x8000), attrs);
+         /* pr_pctcpu and pr_pctmem are unsigned integers in the
+            range 0 .. 2**15, representing 0.0 .. 1.0.  */
+         attrs = Fcons (Fcons (Qpcpu, make_float (100.0 / 0x8000 * pinfo.pr_pctcpu)), attrs);
+         attrs = Fcons (Fcons (Qpmem, make_float (100.0 / 0x8000 * pinfo.pr_pctmem)), attrs);
 
          decoded_cmd
            =  code_convert_string_norecord (make_unibyte_string (pinfo.pr_fname,
@@ -3079,6 +2916,192 @@ system_process_attributes (Lisp_Object pid)
   return attrs;
 }
 
+#elif defined __FreeBSD__
+
+static EMACS_TIME
+timeval_to_EMACS_TIME (struct timeval t)
+{
+  return make_emacs_time (t.tv_sec, t.tv_usec * 1000);
+}
+
+static Lisp_Object
+make_lisp_timeval (struct timeval t)
+{
+  return make_lisp_time (timeval_to_EMACS_TIME (t));
+}
+
+Lisp_Object
+system_process_attributes (Lisp_Object pid)
+{
+  int proc_id;
+  int pagesize = getpagesize ();
+  int npages;
+  int fscale;
+  struct passwd *pw;
+  struct group  *gr;
+  char *ttyname;
+  size_t len;
+  char args[MAXPATHLEN];
+  EMACS_TIME t, now;
+
+  int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID};
+  struct kinfo_proc proc;
+  size_t proclen = sizeof proc;
+
+  struct gcpro gcpro1, gcpro2;
+  Lisp_Object attrs = Qnil;
+  Lisp_Object decoded_comm;
+
+  CHECK_NUMBER_OR_FLOAT (pid);
+  CONS_TO_INTEGER (pid, int, proc_id);
+  mib[3] = proc_id;
+
+  if (sysctl (mib, 4, &proc, &proclen, NULL, 0) != 0)
+    return attrs;
+
+  GCPRO2 (attrs, decoded_comm);
+
+  attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs);
+
+  BLOCK_INPUT;
+  pw = getpwuid (proc.ki_uid);
+  UNBLOCK_INPUT;
+  if (pw)
+    attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs);
+
+  attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs);
+
+  BLOCK_INPUT;
+  gr = getgrgid (proc.ki_svgid);
+  UNBLOCK_INPUT;
+  if (gr)
+    attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs);
+
+  decoded_comm = code_convert_string_norecord
+    (make_unibyte_string (proc.ki_comm, strlen (proc.ki_comm)),
+     Vlocale_coding_system, 0);
+
+  attrs = Fcons (Fcons (Qcomm, decoded_comm), attrs);
+  {
+    char state[2] = {'\0', '\0'};
+    switch (proc.ki_stat)
+      {
+      case SRUN:
+       state[0] = 'R';
+       break;
+
+      case SSLEEP:
+       state[0] = 'S';
+       break;
+
+      case SLOCK:
+       state[0] = 'D';
+       break;
+
+      case SZOMB:
+       state[0] = 'Z';
+       break;
+
+      case SSTOP:
+       state[0] = 'T';
+       break;
+      }
+    attrs = Fcons (Fcons (Qstate, build_string (state)), attrs);
+  }
+
+  attrs = Fcons (Fcons (Qppid, make_fixnum_or_float (proc.ki_ppid)), attrs);
+  attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs);
+  attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)),  attrs);
+
+  BLOCK_INPUT;
+  ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR);
+  UNBLOCK_INPUT;
+  if (ttyname)
+    attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs);
+
+  attrs = Fcons (Fcons (Qtpgid,   make_fixnum_or_float (proc.ki_tpgid)), attrs);
+  attrs = Fcons (Fcons (Qminflt,  make_fixnum_or_float (proc.ki_rusage.ru_minflt)), attrs);
+  attrs = Fcons (Fcons (Qmajflt,  make_fixnum_or_float (proc.ki_rusage.ru_majflt)), attrs);
+  attrs = Fcons (Fcons (Qcminflt, make_number (proc.ki_rusage_ch.ru_minflt)), attrs);
+  attrs = Fcons (Fcons (Qcmajflt, make_number (proc.ki_rusage_ch.ru_majflt)), attrs);
+
+  attrs = Fcons (Fcons (Qutime, make_lisp_timeval (proc.ki_rusage.ru_utime)),
+                attrs);
+  attrs = Fcons (Fcons (Qstime, make_lisp_timeval (proc.ki_rusage.ru_stime)),
+                attrs);
+  t = add_emacs_time (timeval_to_EMACS_TIME (proc.ki_rusage.ru_utime),
+                     timeval_to_EMACS_TIME (proc.ki_rusage.ru_stime));
+  attrs = Fcons (Fcons (Qtime, make_lisp_time (t)), attrs);
+
+  attrs = Fcons (Fcons (Qcutime,
+                       make_lisp_timeval (proc.ki_rusage_ch.ru_utime)),
+                attrs);
+  attrs = Fcons (Fcons (Qcstime,
+                       make_lisp_timeval (proc.ki_rusage_ch.ru_utime)),
+                attrs);
+  t = add_emacs_time (timeval_to_EMACS_TIME (proc.ki_rusage_ch.ru_utime),
+                     timeval_to_EMACS_TIME (proc.ki_rusage_ch.ru_stime));
+  attrs = Fcons (Fcons (Qctime, make_lisp_time (t)), attrs);
+
+  attrs = Fcons (Fcons (Qthcount, make_fixnum_or_float (proc.ki_numthreads)),
+                attrs);
+  attrs = Fcons (Fcons (Qpri,   make_number (proc.ki_pri.pri_native)), attrs);
+  attrs = Fcons (Fcons (Qnice,  make_number (proc.ki_nice)), attrs);
+  attrs = Fcons (Fcons (Qstart, make_lisp_timeval (proc.ki_start)), attrs);
+  attrs = Fcons (Fcons (Qvsize, make_number (proc.ki_size >> 10)), attrs);
+  attrs = Fcons (Fcons (Qrss,   make_number (proc.ki_rssize * pagesize >> 10)),
+                attrs);
+
+  now = current_emacs_time ();
+  t = sub_emacs_time (now, timeval_to_EMACS_TIME (proc.ki_start));
+  attrs = Fcons (Fcons (Qetime, make_lisp_time (t)), attrs);
+
+  len = sizeof fscale;
+  if (sysctlbyname ("kern.fscale", &fscale, &len, NULL, 0) == 0)
+    {
+      double pcpu;
+      fixpt_t ccpu;
+      len = sizeof ccpu;
+      if (sysctlbyname ("kern.ccpu", &ccpu, &len, NULL, 0) == 0)
+       {
+         pcpu = (100.0 * proc.ki_pctcpu / fscale
+                 / (1 - exp (proc.ki_swtime * log ((double) ccpu / fscale))));
+         attrs = Fcons (Fcons (Qpcpu, make_fixnum_or_float (pcpu)), attrs);
+       }
+    }
+
+  len = sizeof npages;
+  if (sysctlbyname ("hw.availpages", &npages, &len, NULL, 0) == 0)
+    {
+      double pmem = (proc.ki_flag & P_INMEM
+                    ? 100.0 * proc.ki_rssize / npages
+                    : 0);
+      attrs = Fcons (Fcons (Qpmem, make_fixnum_or_float (pmem)), attrs);
+    }
+
+  mib[2] = KERN_PROC_ARGS;
+  len = MAXPATHLEN;
+  if (sysctl (mib, 4, args, &len, NULL, 0) == 0)
+    {
+      int i;
+      for (i = 0; i < len; i++)
+       {
+         if (! args[i] && i < len - 1)
+           args[i] = ' ';
+       }
+
+      decoded_comm =
+       (code_convert_string_norecord
+        (make_unibyte_string (args, strlen (args)),
+         Vlocale_coding_system, 0));
+
+      attrs = Fcons (Fcons (Qargs, decoded_comm), attrs);
+    }
+
+  UNGCPRO;
+  return attrs;
+}
+
 /* The WINDOWSNT implementation is in w32.c.
    The MSDOS implementation is in dosfns.c.  */
 #elif !defined (WINDOWSNT) && !defined (MSDOS)
index f9b9fc00b35a091280a3385a1789aed5cf7f48c3..24bdf469cedcc5f29fc1d9300dc0c50b076b49f3 100644 (file)
@@ -16,14 +16,8 @@ GNU General Public License for more details.
 You should have received a copy of the GNU General Public License
 along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_SYS_SELECT_H
-#if defined (DARWIN_OS)
-#undef init_process
-#endif
+#ifndef DOS_NT
 #include <sys/select.h>
-#if defined (DARWIN_OS)
-#define init_process emacs_init_process
-#endif
 #endif
 
 /* The w32 build defines select stuff in w32.h, which is included
@@ -53,3 +47,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define select sys_select
 #endif
 
+#ifdef MSDOS
+#define pselect sys_select
+#endif
index 86135d71215ac875c5327c23875b4559b20bcf3f..71151ed4c6ac5cf9ecd7a75c58b69a0298976d22 100644 (file)
@@ -1,5 +1,6 @@
 /* syssignal.h - System-dependent definitions for signals.
-   Copyright (C) 1993, 1999, 2001-2012  Free Software Foundation, Inc.
+
+Copyright (C) 1993, 1999, 2001-2012 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -75,28 +76,20 @@ sigset_t sys_sigblock   (sigset_t new_mask);
 sigset_t sys_sigunblock (sigset_t new_mask);
 sigset_t sys_sigsetmask (sigset_t new_mask);
 #if ! (defined TIOCNOTTY || defined USG5 || defined CYGWIN)
-void croak (char *) NO_RETURN;
+_Noreturn void croak (char *);
 #endif
 
 #define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG)
 
 #define sigfree() sigsetmask (SIGEMPTYMASK)
 
-#if defined (SIGINFO) && defined (BROKEN_SIGINFO)
-#undef SIGINFO
-#endif
 #if defined (SIGIO) && defined (BROKEN_SIGIO)
 # undef SIGIO
 #endif
+/* These are only used by AIX  */
 #if defined (SIGPOLL) && defined (BROKEN_SIGPOLL)
 #undef SIGPOLL
 #endif
-#if defined (SIGTSTP) && defined (BROKEN_SIGTSTP)
-#undef SIGTSTP
-#endif
-#if defined (SIGURG) && defined (BROKEN_SIGURG)
-#undef SIGURG
-#endif
 #if defined (SIGAIO) && defined (BROKEN_SIGAIO)
 #undef SIGAIO
 #endif
@@ -105,6 +98,7 @@ void croak (char *) NO_RETURN;
 #endif
 
 
+/* FIXME?  Emacs only defines NSIG_MINIMUM on some platforms?  */
 #if NSIG < NSIG_MINIMUM
 # ifdef NSIG
 #  undef NSIG
index 9e7a1173a20dd06cf2eb23398171465c80e19a6b..2988624852787e1eb5bdf83a3f09efad975760c2 100644 (file)
@@ -19,16 +19,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef EMACS_SYSTIME_H
 #define EMACS_SYSTIME_H
 
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#else
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#endif
+#include <timespec.h>
 
 #ifdef emacs
 # ifdef HAVE_X_WINDOWS
@@ -47,92 +38,107 @@ typedef unsigned long Time;
 #endif
 #endif
 #endif
-\f
-/* EMACS_TIME is the type to use to represent temporal intervals -
-   struct timeval on some systems, int on others.  It can be passed as
-   the timeout argument to the select  system call.
-
-   EMACS_SECS (TIME) is an rvalue for the seconds component of TIME.
-   EMACS_SET_SECS (TIME, SECONDS) sets that to SECONDS.
-
-   EMACS_HAS_USECS is defined if EMACS_TIME has a usecs component.
-   EMACS_USECS (TIME) is an rvalue for the microseconds component of TIME.
-       This returns zero if EMACS_TIME doesn't have a microseconds component.
-   EMACS_SET_USECS (TIME, MICROSECONDS) sets that to MICROSECONDS.
-       This does nothing if EMACS_TIME doesn't have a microseconds component.
-
-   EMACS_SET_SECS_USECS (TIME, SECS, USECS) sets both components of TIME.
-
-   EMACS_GET_TIME (TIME) stores the current system time in TIME, which
-       should be an lvalue.
-
-   EMACS_ADD_TIME (DEST, SRC1, SRC2) adds SRC1 to SRC2 and stores the
-       result in DEST.  SRC should not be negative.
-
-   EMACS_SUB_TIME (DEST, SRC1, SRC2) subtracts SRC2 from SRC1 and
-       stores the result in DEST.  SRC should not be negative.
-   EMACS_TIME_NEG_P (TIME) is true if TIME is negative.
-
-*/
-
-#ifdef HAVE_TIMEVAL
-
-#define EMACS_HAS_USECS
-
-#define EMACS_TIME struct timeval
-#define EMACS_SECS(time)                   ((time).tv_sec  + 0)
-#define EMACS_USECS(time)                  ((time).tv_usec + 0)
-#define EMACS_SET_SECS(time, seconds)      ((time).tv_sec  = (seconds))
-#define EMACS_SET_USECS(time, microseconds) ((time).tv_usec = (microseconds))
 
-/* On SVR4, the compiler may complain if given this extra BSD arg.  */
-#ifdef GETTIMEOFDAY_ONE_ARGUMENT
-#define EMACS_GET_TIME(time) gettimeofday (&(time))
-#else /* not GETTIMEOFDAY_ONE_ARGUMENT */
-/* Presumably the second arg is ignored.  */
-#define EMACS_GET_TIME(time) gettimeofday (&(time), NULL)
-#endif /* not GETTIMEOFDAY_ONE_ARGUMENT */
-
-#define EMACS_ADD_TIME(dest, src1, src2)               \
-  do {                                                 \
-    (dest).tv_sec  = (src1).tv_sec  + (src2).tv_sec;   \
-    (dest).tv_usec = (src1).tv_usec + (src2).tv_usec;  \
-    if ((dest).tv_usec > 1000000)                      \
-      (dest).tv_usec -= 1000000, (dest).tv_sec++;      \
-  } while (0)
-
-#define EMACS_SUB_TIME(dest, src1, src2)               \
-  do {                                                 \
-    (dest).tv_sec  = (src1).tv_sec  - (src2).tv_sec;   \
-    (dest).tv_usec = (src1).tv_usec - (src2).tv_usec;  \
-    if ((dest).tv_usec < 0)                            \
-      (dest).tv_usec += 1000000, (dest).tv_sec--;      \
-  } while (0)
-
-#define EMACS_TIME_NEG_P(time)                                 \
-  ((long)(time).tv_sec < 0                                     \
-   || ((time).tv_sec == 0                                      \
-       && (long)(time).tv_usec < 0))
-
-#else /* ! defined (HAVE_TIMEVAL) */
-
-#define EMACS_TIME int
-#define EMACS_SECS(time)                   (time)
-#define EMACS_USECS(time)                  0
-#define EMACS_SET_SECS(time, seconds)      ((time) = (seconds))
-#define EMACS_SET_USECS(time, usecs)       0
-
-#define EMACS_GET_TIME(t) ((t) = time ((long *) 0))
-#define EMACS_ADD_TIME(dest, src1, src2) ((dest) = (src1) + (src2))
-#define EMACS_SUB_TIME(dest, src1, src2) ((dest) = (src1) - (src2))
-#define EMACS_TIME_NEG_P(t) ((t) < 0)
-
-#endif /* ! defined (HAVE_TIMEVAL) */
-
-#define EMACS_SET_SECS_USECS(time, secs, usecs)                \
-  (EMACS_SET_SECS (time, secs), EMACS_SET_USECS (time, usecs))
-
-extern int set_file_times (const char *, EMACS_TIME, EMACS_TIME);
+#include <sys/time.h>  /* for 'struct timeval' */
+\f
+/* The type to use to represent non-negative temporal intervals.  Its
+   address can be passed as the timeout argument to the pselect system
+   call.  */
+typedef struct timespec EMACS_TIME;
+
+/* Resolution of EMACS_TIME time stamps (in units per second), and log
+   base 10 of the resolution.  The log must be a positive integer.  */
+enum { EMACS_TIME_RESOLUTION = 1000000000 };
+enum { LOG10_EMACS_TIME_RESOLUTION = 9 };
+
+/* EMACS_SECS (TIME) is the seconds component of TIME.
+   EMACS_NSECS (TIME) is the nanoseconds component of TIME.
+   emacs_secs_addr (PTIME) is the address of *PTIME's seconds component.  */
+static inline time_t EMACS_SECS (EMACS_TIME t) { return t.tv_sec; }
+static inline int EMACS_NSECS (EMACS_TIME t) { return t.tv_nsec; }
+static inline time_t *emacs_secs_addr (EMACS_TIME *t) { return &t->tv_sec; }
+
+/* Return an Emacs time with seconds S and nanoseconds NS.  */
+static inline EMACS_TIME
+make_emacs_time (time_t s, int ns)
+{
+  EMACS_TIME r = { s, ns };
+  return r;
+}
+
+/* Return an invalid Emacs time.  */
+static inline EMACS_TIME
+invalid_emacs_time (void)
+{
+  EMACS_TIME r = { 0, -1 };
+  return r;
+}
+
+/* Return current system time.  */
+static inline EMACS_TIME
+current_emacs_time (void)
+{
+  EMACS_TIME r;
+  gettime (&r);
+  return r;
+}
+
+/* Return the result of adding A to B, or of subtracting B from A.
+   On overflow, store an extremal value: ergo, if time_t is unsigned,
+   return 0 if the true answer would be negative.
+
+   WARNING: These are NOT general-purpose macros for adding or
+   subtracting arbitrary time values!  They are generally intended to
+   be used with their first argument an absolute time since the epoch
+   and the second argument a non-negative offset.  Do NOT use them for
+   anything else.  */
+static inline EMACS_TIME
+add_emacs_time (EMACS_TIME a, EMACS_TIME b)
+{
+  return timespec_add (a, b);
+}
+static inline EMACS_TIME
+sub_emacs_time (EMACS_TIME a, EMACS_TIME b)
+{
+  return timespec_sub (a, b);
+}
+
+/* Return the sign of the valid time stamp TIME, either -1, 0, or 1.
+   Note: this can only return a negative value if time_t is a signed
+   data type.  */
+static inline int
+EMACS_TIME_SIGN (EMACS_TIME t)
+{
+  return timespec_sign (t);
+}
+
+/* Return 1 if TIME is a valid time stamp.  */
+static inline int
+EMACS_TIME_VALID_P (EMACS_TIME t)
+{
+  return 0 <= t.tv_nsec;
+}
+
+/* Convert the double D to the greatest EMACS_TIME not greater than D.
+   On overflow, return an extremal value; in particular, if time_t is
+   an unsigned data type and D is negative, return zero.  Return the
+   minimum EMACS_TIME if D is not a number.  */
+static inline EMACS_TIME
+EMACS_TIME_FROM_DOUBLE (double d)
+{
+  return dtotimespec (d);
+}
+
+/* Convert the Emacs time T to an approximate double value D.  */
+static inline double
+EMACS_TIME_TO_DOUBLE (EMACS_TIME t)
+{
+  return timespectod (t);
+}
+
+/* defined in sysdep.c */
+extern int set_file_times (int, const char *, EMACS_TIME, EMACS_TIME);
+extern struct timeval make_timeval (EMACS_TIME);
 
 /* defined in keyboard.c */
 extern void set_waiting_for_input (EMACS_TIME *);
@@ -141,29 +147,43 @@ extern void set_waiting_for_input (EMACS_TIME *);
    happen when this files is used outside the src directory).
    Use GCPRO1 to determine if lisp.h was included.  */
 #ifdef GCPRO1
-/* defined in editfns.c*/
-extern Lisp_Object make_time (time_t);
-extern int lisp_time_argument (Lisp_Object, time_t *, int *);
+/* defined in editfns.c */
+extern Lisp_Object make_lisp_time (EMACS_TIME);
+extern int decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object,
+                                  Lisp_Object, EMACS_TIME *, double *);
+extern EMACS_TIME lisp_time_argument (Lisp_Object);
 #endif
 
-/* Compare times T1 and T2.  Value is 0 if T1 and T2 are the same.
-   Value is < 0 if T1 is less than T2.  Value is > 0 otherwise.  (Cast
-   to long is for those platforms where time_t is an unsigned
-   type, and where otherwise T1 will always be grater than T2.)  */
-
-#define EMACS_TIME_CMP(T1, T2)                         \
-  ((long)EMACS_SECS (T1) - (long)EMACS_SECS (T2)       \
-   + (EMACS_SECS (T1) == EMACS_SECS (T2)               \
-      ? EMACS_USECS (T1) - EMACS_USECS (T2)            \
-      : 0))
-
 /* Compare times T1 and T2 for equality, inequality etc.  */
-
-#define EMACS_TIME_EQ(T1, T2) (EMACS_TIME_CMP (T1, T2) == 0)
-#define EMACS_TIME_NE(T1, T2) (EMACS_TIME_CMP (T1, T2) != 0)
-#define EMACS_TIME_GT(T1, T2) (EMACS_TIME_CMP (T1, T2) > 0)
-#define EMACS_TIME_GE(T1, T2) (EMACS_TIME_CMP (T1, T2) >= 0)
-#define EMACS_TIME_LT(T1, T2) (EMACS_TIME_CMP (T1, T2) < 0)
-#define EMACS_TIME_LE(T1, T2) (EMACS_TIME_CMP (T1, T2) <= 0)
+static inline int
+EMACS_TIME_EQ (EMACS_TIME t1, EMACS_TIME t2)
+{
+  return timespec_cmp (t1, t2) == 0;
+}
+static inline int
+EMACS_TIME_NE (EMACS_TIME t1, EMACS_TIME t2)
+{
+  return timespec_cmp (t1, t2) != 0;
+}
+static inline int
+EMACS_TIME_GT (EMACS_TIME t1, EMACS_TIME t2)
+{
+  return timespec_cmp (t1, t2) > 0;
+}
+static inline int
+EMACS_TIME_GE (EMACS_TIME t1, EMACS_TIME t2)
+{
+  return timespec_cmp (t1, t2) >= 0;
+}
+static inline int
+EMACS_TIME_LT (EMACS_TIME t1, EMACS_TIME t2)
+{
+  return timespec_cmp (t1, t2) < 0;
+}
+static inline int
+EMACS_TIME_LE (EMACS_TIME t1, EMACS_TIME t2)
+{
+  return timespec_cmp (t1, t2) <= 0;
+}
 
 #endif /* EMACS_SYSTIME_H */
index 53458c559ddeacc7c756d52559a67989542c04f5..4d73f896d212f1a05892122a82468ff4e2a32a25 100644 (file)
@@ -24,6 +24,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <ctype.h>
 #include <errno.h>
 #include <sys/file.h>
+#include <sys/time.h>
 #include <unistd.h>
 #include <signal.h>
 #include <setjmp.h>
@@ -32,8 +33,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "termchar.h"
 #include "termopts.h"
 #include "tparam.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "coding.h"
 #include "composite.h"
@@ -85,11 +86,11 @@ static void clear_tty_hooks (struct terminal *terminal);
 static void set_tty_hooks (struct terminal *terminal);
 static void dissociate_if_controlling_tty (int fd);
 static void delete_tty (struct terminal *);
-static void maybe_fatal (int must_succeed, struct terminal *terminal,
-                        const char *str1, const char *str2, ...)
-  NO_RETURN ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5);
-static void vfatal (const char *str, va_list ap)
-  NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0);
+static _Noreturn void maybe_fatal (int must_succeed, struct terminal *terminal,
+                                  const char *str1, const char *str2, ...)
+  ATTRIBUTE_FORMAT_PRINTF (3, 5) ATTRIBUTE_FORMAT_PRINTF (4, 5);
+static _Noreturn void vfatal (const char *str, va_list ap)
+  ATTRIBUTE_FORMAT_PRINTF (1, 0);
 
 
 #define OUTPUT(tty, a)                                          \
@@ -122,12 +123,11 @@ enum no_color_bit
   NC_STANDOUT   = 1 << 0,
   NC_UNDERLINE  = 1 << 1,
   NC_REVERSE    = 1 << 2,
-  NC_BLINK      = 1 << 3,
+  NC_ITALIC     = 1 << 3,
   NC_DIM        = 1 << 4,
   NC_BOLD       = 1 << 5,
   NC_INVIS      = 1 << 6,
-  NC_PROTECT    = 1 << 7,
-  NC_ALT_CHARSET = 1 << 8
+  NC_PROTECT    = 1 << 7
 };
 
 /* internal state */
@@ -1459,7 +1459,7 @@ append_glyph (struct it *it)
   struct glyph *glyph, *end;
   int i;
 
-  xassert (it->glyph_row);
+  eassert (it->glyph_row);
   glyph = (it->glyph_row->glyphs[it->area]
           + it->glyph_row->used[it->area]);
   end = it->glyph_row->glyphs[1 + it->area];
@@ -1546,7 +1546,7 @@ produce_glyphs (struct it *it)
   /* If a hook is installed, let it do the work.  */
 
   /* Nothing but characters are supported on terminal frames.  */
-  xassert (it->what == IT_CHARACTER
+  eassert (it->what == IT_CHARACTER
           || it->what == IT_COMPOSITION
           || it->what == IT_STRETCH
           || it->what == IT_GLYPHLESS);
@@ -1633,7 +1633,7 @@ produce_glyphs (struct it *it)
        {
          Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
 
-         xassert (it->what == IT_GLYPHLESS);
+         eassert (it->what == IT_GLYPHLESS);
          produce_glyphless_glyph (it, 1, acronym);
        }
     }
@@ -1657,7 +1657,7 @@ append_composite_glyph (struct it *it)
 {
   struct glyph *glyph;
 
-  xassert (it->glyph_row);
+  eassert (it->glyph_row);
   glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
   if (glyph < it->glyph_row->glyphs[1 + it->area])
     {
@@ -1749,7 +1749,7 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str)
   struct glyph *glyph, *end;
   int i;
 
-  xassert (it->glyph_row);
+  eassert (it->glyph_row);
   glyph = it->glyph_row->glyphs[it->area] + it->glyph_row->used[it->area];
   end = it->glyph_row->glyphs[1 + it->area];
 
@@ -1851,8 +1851,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
        len = 1;
       else if (len > 4)
        len = 4;
-      sprintf (buf, "[%.*s]", len, str);
-      len += 2;
+      len = sprintf (buf, "[%.*s]", len, str);
       str = buf;
     }
   else
@@ -1872,7 +1871,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
        }
       else
        {
-         xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
+         eassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
          len = (it->c < 0x10000 ? sprintf (buf, "\\u%04X", it->c)
                 : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "\\U%06X", it->c)
                 : sprintf (buf, "\\x%06X", it->c));
@@ -1886,69 +1885,6 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
     append_glyphless_glyph (it, face_id, str);
 }
 
-
-/* Get information about special display element WHAT in an
-   environment described by IT.  WHAT is one of IT_TRUNCATION or
-   IT_CONTINUATION.  Maybe produce glyphs for WHAT if IT has a
-   non-null glyph_row member.  This function ensures that fields like
-   face_id, c, len of IT are left untouched.  */
-
-void
-produce_special_glyphs (struct it *it, enum display_element_type what)
-{
-  struct it temp_it;
-  Lisp_Object gc;
-  GLYPH glyph;
-
-  temp_it = *it;
-  temp_it.dp = NULL;
-  temp_it.what = IT_CHARACTER;
-  temp_it.len = 1;
-  temp_it.object = make_number (0);
-  memset (&temp_it.current, 0, sizeof temp_it.current);
-
-  if (what == IT_CONTINUATION)
-    {
-      /* Continuation glyph.  For R2L lines, we mirror it by hand.  */
-      if (it->bidi_it.paragraph_dir == R2L)
-       SET_GLYPH_FROM_CHAR (glyph, '/');
-      else
-       SET_GLYPH_FROM_CHAR (glyph, '\\');
-      if (it->dp
-         && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))
-         && GLYPH_CODE_CHAR_VALID_P (gc))
-       {
-         /* FIXME: Should we mirror GC for R2L lines?  */
-         SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
-         spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
-       }
-    }
-  else if (what == IT_TRUNCATION)
-    {
-      /* Truncation glyph.  */
-      SET_GLYPH_FROM_CHAR (glyph, '$');
-      if (it->dp
-         && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))
-         && GLYPH_CODE_CHAR_VALID_P (gc))
-       {
-         /* FIXME: Should we mirror GC for R2L lines?  */
-         SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
-         spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
-       }
-    }
-  else
-    abort ();
-
-  temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph);
-  temp_it.face_id = GLYPH_FACE (glyph);
-  temp_it.len = CHAR_BYTES (temp_it.c);
-
-  produce_glyphs (&temp_it);
-  it->pixel_width = temp_it.pixel_width;
-  it->nglyphs = temp_it.pixel_width;
-}
-
-
 \f
 /***********************************************************************
                                Faces
@@ -2024,17 +1960,16 @@ turn_on_face (struct frame *f, int face_id)
   if (face->tty_bold_p && MAY_USE_WITH_COLORS_P (tty, NC_BOLD))
     OUTPUT1_IF (tty, tty->TS_enter_bold_mode);
 
-  if (face->tty_dim_p && MAY_USE_WITH_COLORS_P (tty, NC_DIM))
-    OUTPUT1_IF (tty, tty->TS_enter_dim_mode);
-
-  /* Alternate charset and blinking not yet used.  */
-  if (face->tty_alt_charset_p
-      && MAY_USE_WITH_COLORS_P (tty, NC_ALT_CHARSET))
-    OUTPUT1_IF (tty, tty->TS_enter_alt_charset_mode);
-
-  if (face->tty_blinking_p
-      && MAY_USE_WITH_COLORS_P (tty, NC_BLINK))
-    OUTPUT1_IF (tty, tty->TS_enter_blink_mode);
+  if (face->tty_italic_p && MAY_USE_WITH_COLORS_P (tty, NC_ITALIC))
+    {
+      if (tty->TS_enter_italic_mode)
+       OUTPUT1 (tty, tty->TS_enter_italic_mode);
+      else
+       /* Italics mode is unavailable on many terminals.  In that
+          case, map slant to dimmed text; we want italic text to
+          appear different and dimming is not otherwise used.  */
+       OUTPUT1 (tty, tty->TS_enter_dim_mode);
+    }
 
   if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
     OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
@@ -2071,7 +2006,7 @@ turn_off_face (struct frame *f, int face_id)
   struct face *face = FACE_FROM_ID (f, face_id);
   struct tty_display_info *tty = FRAME_TTY (f);
 
-  xassert (face != NULL);
+  eassert (face != NULL);
 
   if (tty->TS_exit_attribute_mode)
     {
@@ -2079,27 +2014,19 @@ turn_off_face (struct frame *f, int face_id)
         half-bright, reverse-video, standout, underline.  It may or
         may not turn off alt-char-mode.  */
       if (face->tty_bold_p
-         || face->tty_dim_p
+         || face->tty_italic_p
          || face->tty_reverse_p
-         || face->tty_alt_charset_p
-         || face->tty_blinking_p
          || face->tty_underline_p)
        {
          OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
          if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
            tty->standout_mode = 0;
        }
-
-      if (face->tty_alt_charset_p)
-       OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
     }
   else
     {
       /* If we don't have "me" we can only have those appearances
         that have exit sequences defined.  */
-      if (face->tty_alt_charset_p)
-       OUTPUT_IF (tty, tty->TS_exit_alt_charset_mode);
-
       if (face->tty_underline_p)
        OUTPUT_IF (tty, tty->TS_exit_underline_mode);
     }
@@ -2130,8 +2057,7 @@ tty_capable_p (struct tty_display_info *tty, unsigned int caps,
   TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE,   tty->TS_enter_underline_mode,   NC_UNDERLINE);
   TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD,        tty->TS_enter_bold_mode,        NC_BOLD);
   TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM,                 tty->TS_enter_dim_mode,         NC_DIM);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BLINK,       tty->TS_enter_blink_mode,       NC_BLINK);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ALT_CHARSET,         tty->TS_enter_alt_charset_mode, NC_ALT_CHARSET);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC,      tty->TS_enter_italic_mode,      NC_ITALIC);
 
   /* We can do it!  */
   return 1;
@@ -2145,7 +2071,7 @@ DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
 
 TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  This function always returns nil if
-TERMINAL does not refer to a text-only terminal.  */)
+TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
   struct terminal *t = get_tty_terminal (terminal, 0);
@@ -2162,7 +2088,7 @@ DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
 
 TERMINAL can be a terminal object, a frame, or nil (meaning the
 selected frame's terminal).  This function always returns 0 if
-TERMINAL does not refer to a text-only terminal.  */)
+TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
   struct terminal *t = get_tty_terminal (terminal, 0);
@@ -2279,7 +2205,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f)
   else
     color_mode = Qnil;
 
-  mode = INTEGERP (color_mode) ? XINT (color_mode) : 0;
+  mode = TYPE_RANGED_INTEGERP (int, color_mode) ? XINT (color_mode) : 0;
 
   if (mode != tty->previous_color_mode)
     {
@@ -2384,7 +2310,7 @@ no effect if used on a non-tty terminal.
 
 TERMINAL can be a terminal object, a frame or nil (meaning the
 selected frame's terminal).  This function always returns nil if
-TERMINAL does not refer to a text-only terminal.  */)
+TERMINAL does not refer to a text terminal.  */)
   (Lisp_Object terminal)
 {
   struct terminal *t = get_terminal (terminal, 1);
@@ -2394,6 +2320,21 @@ TERMINAL does not refer to a text-only terminal.  */)
   return Qnil;
 }
 
+DEFUN ("tty-top-frame", Ftty_top_frame, Stty_top_frame, 0, 1, 0,
+       doc: /* Return the topmost terminal frame on TERMINAL.
+TERMINAL can be a terminal object, a frame or nil (meaning the
+selected frame's terminal).  This function returns nil if TERMINAL
+does not refer to a text terminal.  Otherwise, it returns the
+top-most frame on the text terminal.  */)
+  (Lisp_Object terminal)
+{
+  struct terminal *t = get_terminal (terminal, 1);
+
+  if (t->type == output_termcap)
+    return t->display_info.tty->top_frame;
+  return Qnil;
+}
+
 \f
 
 DEFUN ("suspend-tty", Fsuspend_tty, Ssuspend_tty, 0, 1, 0,
@@ -2609,6 +2550,18 @@ term_mouse_movement (FRAME_PTR frame, Gpm_Event *event)
   return 0;
 }
 
+/* Return the Time that corresponds to T.  Wrap around on overflow.  */
+static Time
+timeval_to_Time (struct timeval const *t)
+{
+  Time s_1000, ms;
+
+  s_1000 = t->tv_sec;
+  s_1000 *= 1000;
+  ms = t->tv_usec / 1000;
+  return s_1000 + ms;
+}
+
 /* Return the current position of the mouse.
 
    Set *f to the frame the mouse is in, or zero if the mouse is in no
@@ -2628,7 +2581,6 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
                     Lisp_Object *y, Time *timeptr)
 {
   struct timeval now;
-  Time sec, usec;
 
   *fp = SELECTED_FRAME ();
   (*fp)->mouse_moved = 0;
@@ -2639,9 +2591,7 @@ term_mouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window,
   XSETINT (*x, last_mouse_x);
   XSETINT (*y, last_mouse_y);
   gettimeofday(&now, 0);
-  sec = now.tv_sec;
-  usec = now.tv_usec;
-  *timeptr = (sec * 1000) + (usec / 1000);
+  *timeptr = timeval_to_Time (&now);
 }
 
 /* Prepare a mouse-event in *RESULT for placement in the input queue.
@@ -2665,7 +2615,7 @@ term_mouse_click (struct input_event *result, Gpm_Event *event,
       }
     }
   gettimeofday(&now, 0);
-  result->timestamp = (now.tv_sec * 1000) + (now.tv_usec / 1000);
+  result->timestamp = timeval_to_Time (&now);
 
   if (event->type & GPM_UP)
     result->modifiers = up_modifier;
@@ -2847,14 +2797,11 @@ DEFUN ("gpm-mouse-stop", Fgpm_mouse_stop, Sgpm_mouse_stop,
 void
 create_tty_output (struct frame *f)
 {
-  struct tty_output *t;
+  struct tty_output *t = xzalloc (sizeof *t);
 
   if (! FRAME_TERMCAP_P (f))
     abort ();
 
-  t = xmalloc (sizeof (struct tty_output));
-  memset (t, 0, sizeof (struct tty_output));
-
   t->display_info = FRAME_TERMINAL (f)->display_info.tty;
 
   f->output_data.tty = t;
@@ -3054,9 +3001,8 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
   been_here = 1;
   tty = &the_only_display_info;
 #else
-  tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
+  tty = xzalloc (sizeof *tty);
 #endif
-  memset (tty, 0, sizeof (struct tty_display_info));
   tty->next = tty_list;
   tty_list = tty;
 
@@ -3064,7 +3010,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
   terminal->display_info.tty = tty;
   tty->terminal = terminal;
 
-  tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
+  tty->Wcm = xmalloc (sizeof *tty->Wcm);
   Wcm_clear (tty);
 
   encode_terminal_src_size = 0;
@@ -3125,7 +3071,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
 
   Wcm_clear (tty);
 
-  tty->termcap_term_buffer = (char *) xmalloc (buffer_size);
+  tty->termcap_term_buffer = xmalloc (buffer_size);
 
   /* On some systems, tgetent tries to access the controlling
      terminal. */
@@ -3166,7 +3112,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
     abort ();
   buffer_size = strlen (tty->termcap_term_buffer);
 #endif
-  tty->termcap_strings_buffer = area = (char *) xmalloc (buffer_size);
+  tty->termcap_strings_buffer = area = xmalloc (buffer_size);
   tty->TS_ins_line = tgetstr ("al", address);
   tty->TS_ins_multi_lines = tgetstr ("AL", address);
   tty->TS_bell = tgetstr ("bl", address);
@@ -3224,8 +3170,8 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
   tty->TS_enter_underline_mode = tgetstr ("us", address);
   tty->TS_exit_underline_mode = tgetstr ("ue", address);
   tty->TS_enter_bold_mode = tgetstr ("md", address);
+  tty->TS_enter_italic_mode = tgetstr ("ZH", address);
   tty->TS_enter_dim_mode = tgetstr ("mh", address);
-  tty->TS_enter_blink_mode = tgetstr ("mb", address);
   tty->TS_enter_reverse_mode = tgetstr ("mr", address);
   tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
   tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
@@ -3334,7 +3280,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
   tty->mouse_highlight.mouse_face_window = Qnil;
 #endif
 
-  terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+  terminal->kboard = xmalloc (sizeof *terminal->kboard);
   init_kboard (terminal->kboard);
   KVAR (terminal->kboard, Vwindow_system) = Qnil;
   terminal->kboard->next_kboard = all_kboards;
@@ -3594,14 +3540,13 @@ delete_tty (struct terminal *terminal)
   xfree (tty->termcap_strings_buffer);
   xfree (tty->termcap_term_buffer);
 
-  memset (tty, 0, sizeof (struct tty_display_info));
   xfree (tty);
 }
 
 \f
 
 /* Mark the pointers in the tty_display_info objects.
-   Called by the Fgarbage_collector.  */
+   Called by Fgarbage_collect.  */
 
 void
 mark_ttys (void)
@@ -3651,6 +3596,7 @@ bigger, or it may make it blink, or it may do nothing at all.  */);
   defsubr (&Stty_no_underline);
   defsubr (&Stty_type);
   defsubr (&Scontrolling_tty_p);
+  defsubr (&Stty_top_frame);
   defsubr (&Ssuspend_tty);
   defsubr (&Sresume_tty);
 #ifdef HAVE_GPM
index 10c195eebe27ca6b694d94154e7c0bc3e5358185..d1b05e8df94bb1e5e3fa5393d5f8aceee4b5fa32 100644 (file)
@@ -30,10 +30,6 @@ Boston, MA 02110-1301, USA.  */
 #include "msdos.h"
 #endif
 
-#ifndef NULL
-#define NULL (char *) 0
-#endif
-
 /* BUFSIZE is the initial size allocated for the buffer
    for reading the termcap file.
    It is not a limit.
@@ -157,7 +153,7 @@ tgetst1 (char *ptr, char **area)
       p = ptr;
       while ((c = *p++) && c != ':' && c != '\n')
        ;
-      ret = (char *) xmalloc (p - ptr + 1);
+      ret = xmalloc (p - ptr + 1);
     }
   else
     ret = *area;
@@ -381,7 +377,7 @@ tgetent (char *bp, const char *name)
       if (!bp)
        {
          malloc_size = 1 + strlen (term);
-         bp = (char *) xmalloc (malloc_size);
+         bp = xmalloc (malloc_size);
        }
       strcpy (bp, term);
       goto ret;
@@ -444,13 +440,13 @@ tgetent (char *bp, const char *name)
 
   buf.size = BUFSIZE;
   /* Add 1 to size to ensure room for terminating null.  */
-  buf.beg = (char *) xmalloc (buf.size + 1);
+  buf.beg = xmalloc (buf.size + 1);
   term = indirect ? indirect : (char *)name;
 
   if (!bp)
     {
       malloc_size = indirect ? strlen (tcenv) + 1 : buf.size;
-      bp = (char *) xmalloc (malloc_size);
+      bp = xmalloc (malloc_size);
     }
   tc_search_point = bp1 = bp;
 
@@ -482,7 +478,7 @@ tgetent (char *bp, const char *name)
        {
          ptrdiff_t offset1 = bp1 - bp, offset2 = tc_search_point - bp;
          malloc_size = offset1 + buf.size;
-         bp = termcap_name = (char *) xrealloc (bp, malloc_size);
+         bp = termcap_name = xrealloc (bp, malloc_size);
          bp1 = termcap_name + offset1;
          tc_search_point = termcap_name + offset2;
        }
@@ -508,7 +504,7 @@ tgetent (char *bp, const char *name)
   xfree (buf.beg);
 
   if (malloc_size)
-    bp = (char *) xrealloc (bp, bp1 - bp + 1);
+    bp = xrealloc (bp, bp1 - bp + 1);
 
  ret:
   term_entry = bp;
@@ -661,10 +657,6 @@ gobble_line (int fd, register struct termcap_buffer *bufp, char *append_end)
 \f
 #ifdef TEST
 
-#ifdef NULL
-#undef NULL
-#endif
-
 #include <stdio.h>
 
 static void
index d50ee805e03e544c5daab0fc52d937f77a3c5772..102fe45350e05b8bc3ba84909bd5cf55b44b1692 100644 (file)
@@ -124,8 +124,8 @@ struct tty_display_info
                                    each as vpos and hpos) */
 
   const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode).  */
+  const char *TS_enter_italic_mode; /* "ZH" -- turn on italics mode.  */
   const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode.  */
-  const char *TS_enter_blink_mode; /* "mb" -- enter blinking mode.  */
   const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode.  */
   const char *TS_exit_underline_mode; /* "us" -- start underlining.  */
   const char *TS_enter_underline_mode; /* "ue" -- end underlining.  */
index bc61a986cce52caaaef5ad4cde02062daaedc943..4cad4825cdd9762d10674890d332aab53217bbaa 100644 (file)
@@ -229,7 +229,7 @@ struct input_event
      For a HELP_EVENT, this is the position within the object
       (stored in ARG below) where the help was found.  */
   /* In WindowsNT, for a mouse wheel event, this is the delta.  */
-  EMACS_INT code;
+  ptrdiff_t code;
   enum scroll_bar_part part;
 
   int modifiers;               /* See enum below for interpretation.  */
index 9579d1dbd665e7f3a6da8f659c1b3fcf695a1655..4e03c1622130fc4f1c6584a8a2a9776e8a438ad7 100644 (file)
@@ -225,16 +225,13 @@ create_terminal (void)
   struct terminal *terminal = allocate_terminal ();
   Lisp_Object terminal_coding, keyboard_coding;
 
-  terminal->name = NULL;
   terminal->next_terminal = terminal_list;
   terminal_list = terminal;
 
   terminal->id = next_terminal_id++;
 
-  terminal->keyboard_coding =
-    (struct coding_system *) xmalloc (sizeof (struct coding_system));
-  terminal->terminal_coding =
-    (struct coding_system *) xmalloc (sizeof (struct coding_system));
+  terminal->keyboard_coding = xmalloc (sizeof (struct coding_system));
+  terminal->terminal_coding = xmalloc (sizeof (struct coding_system));
 
   /* If default coding systems for the terminal and the keyboard are
      already defined, use them in preference to the defaults.  This is
@@ -255,9 +252,6 @@ create_terminal (void)
   setup_coding_system (keyboard_coding, terminal->keyboard_coding);
   setup_coding_system (terminal_coding, terminal->terminal_coding);
 
-  terminal->param_alist = Qnil;
-  terminal->charset_list = Qnil;
-  terminal->Vselection_alist = Qnil;
   return terminal;
 }
 
index 688b32eb4ecfc947a8823c0a7d35415a453470f4..8aa52bebe5b18e07679a1205aea24264dbe2122c 100644 (file)
@@ -20,13 +20,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 #include "lisp.h"
 #include "intervals.h"
+#include "character.h"
 #include "buffer.h"
 #include "window.h"
 
-#ifndef NULL
-#define NULL (void *)0
-#endif
-
 /* Test for membership, allowing for t (actually any non-cons) to mean the
    universal set.  */
 
@@ -75,15 +72,11 @@ Lisp_Object Qfront_sticky, Qrear_nonsticky;
 static Lisp_Object interval_insert_behind_hooks;
 static Lisp_Object interval_insert_in_front_hooks;
 
-static void text_read_only (Lisp_Object) NO_RETURN;
-static Lisp_Object Fprevious_property_change (Lisp_Object, Lisp_Object,
-                                             Lisp_Object);
-
 
 /* Signal a `text-read-only' error.  This function makes it easier
    to capture that error in GDB by putting a breakpoint on it.  */
 
-static void
+static _Noreturn void
 text_read_only (Lisp_Object propval)
 {
   if (STRINGP (propval))
@@ -124,7 +117,7 @@ INTERVAL
 validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force)
 {
   register INTERVAL i;
-  EMACS_INT searchpos;
+  ptrdiff_t searchpos;
 
   CHECK_STRING_OR_BUFFER (object);
   CHECK_NUMBER_COERCE_MARKER (*begin);
@@ -160,7 +153,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en
     }
   else
     {
-      EMACS_INT len = SCHARS (object);
+      ptrdiff_t len = SCHARS (object);
 
       if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end)
             && XINT (*end) <= len))
@@ -278,7 +271,7 @@ interval_has_some_properties_list (Lisp_Object list, INTERVAL i)
   /* Go through each element of LIST.  */
   for (tail1 = list; CONSP (tail1); tail1 = XCDR (tail1))
     {
-      sym = Fcar (tail1);
+      sym = XCAR (tail1);
 
       /* Go through i's plist, looking for tail1 */
       for (tail2 = i->plist; CONSP (tail2); tail2 = XCDR (XCDR (tail2)))
@@ -494,30 +487,15 @@ remove_properties (Lisp_Object plist, Lisp_Object list, INTERVAL i, Lisp_Object
     i->plist = current_plist;
   return changed;
 }
-
-#if 0
-/* Remove all properties from interval I.  Return non-zero
-   if this changes the interval.  */
-
-static inline int
-erase_properties (INTERVAL i)
-{
-  if (NILP (i->plist))
-    return 0;
-
-  i->plist = Qnil;
-  return 1;
-}
-#endif
 \f
 /* Returns the interval of POSITION in OBJECT.
    POSITION is BEG-based.  */
 
 INTERVAL
-interval_of (EMACS_INT position, Lisp_Object object)
+interval_of (ptrdiff_t position, Lisp_Object object)
 {
   register INTERVAL i;
-  EMACS_INT beg, end;
+  ptrdiff_t beg, end;
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -775,7 +753,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
   else
     {
       Lisp_Object initial_value, value;
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
 
       if (! NILP (object))
        CHECK_BUFFER (object);
@@ -858,7 +836,7 @@ position LIMIT; return LIMIT if nothing is found before reaching LIMIT.  */)
     }
   else
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
 
       if (! NILP (object))
        CHECK_BUFFER (object);
@@ -1140,7 +1118,7 @@ Return t if any property value actually changed, nil otherwise.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
-  register EMACS_INT s, len;
+  register ptrdiff_t s, len;
   register int modified = 0;
   struct gcpro gcpro1;
 
@@ -1170,7 +1148,7 @@ Return t if any property value actually changed, nil otherwise.  */)
          skip it.  */
       if (interval_has_all_properties (properties, i))
        {
-         EMACS_INT got = (LENGTH (i) - (s - i->position));
+         ptrdiff_t got = (LENGTH (i) - (s - i->position));
          if (got >= len)
            RETURN_UNGCPRO (Qnil);
          len -= got;
@@ -1190,8 +1168,7 @@ Return t if any property value actually changed, nil otherwise.  */)
   /* We are at the beginning of interval I, with LEN chars to scan.  */
   for (;;)
     {
-      if (i == 0)
-       abort ();
+      eassert (i != 0);
 
       if (LENGTH (i) >= len)
        {
@@ -1345,7 +1322,7 @@ void
 set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i)
 {
   register INTERVAL prev_changed = NULL_INTERVAL;
-  register EMACS_INT s, len;
+  register ptrdiff_t s, len;
   INTERVAL unchanged;
 
   if (XINT (start) < XINT (end))
@@ -1390,8 +1367,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie
   /* We are starting at the beginning of an interval I.  LEN is positive.  */
   do
     {
-      if (i == 0)
-       abort ();
+      eassert (i != 0);
 
       if (LENGTH (i) >= len)
        {
@@ -1438,7 +1414,7 @@ Use `set-text-properties' if you want to remove all text properties.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
-  register EMACS_INT s, len;
+  register ptrdiff_t s, len;
   register int modified = 0;
 
   if (NILP (object))
@@ -1457,7 +1433,7 @@ Use `set-text-properties' if you want to remove all text properties.  */)
          it covers the entire region.  */
       if (! interval_has_some_properties (properties, i))
        {
-         EMACS_INT got = (LENGTH (i) - (s - i->position));
+         ptrdiff_t got = (LENGTH (i) - (s - i->position));
          if (got >= len)
            return Qnil;
          len -= got;
@@ -1479,8 +1455,7 @@ Use `set-text-properties' if you want to remove all text properties.  */)
   /* We are at the beginning of an interval, with len to scan */
   for (;;)
     {
-      if (i == 0)
-       abort ();
+      eassert (i != 0);
 
       if (LENGTH (i) >= len)
        {
@@ -1524,7 +1499,7 @@ Return t if any property was actually removed, nil otherwise.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object)
 {
   register INTERVAL i, unchanged;
-  register EMACS_INT s, len;
+  register ptrdiff_t s, len;
   register int modified = 0;
   Lisp_Object properties;
   properties = list_of_properties;
@@ -1545,7 +1520,7 @@ Return t if any property was actually removed, nil otherwise.  */)
          it covers the entire region.  */
       if (! interval_has_some_properties_list (properties, i))
        {
-         EMACS_INT got = (LENGTH (i) - (s - i->position));
+         ptrdiff_t got = (LENGTH (i) - (s - i->position));
          if (got >= len)
            return Qnil;
          len -= got;
@@ -1569,8 +1544,7 @@ Return t if any property was actually removed, nil otherwise.  */)
      and we call signal_after_change before returning if modified != 0. */
   for (;;)
     {
-      if (i == 0)
-       abort ();
+      eassert (i != 0);
 
       if (LENGTH (i) >= len)
        {
@@ -1634,7 +1608,7 @@ markers).  If OBJECT is a string, START and END are 0-based indices into it.  */
   (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
 {
   register INTERVAL i;
-  register EMACS_INT e, pos;
+  register ptrdiff_t e, pos;
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -1670,7 +1644,7 @@ markers).  If OBJECT is a string, START and END are 0-based indices into it.  */
   (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object)
 {
   register INTERVAL i;
-  register EMACS_INT s, e;
+  register ptrdiff_t s, e;
 
   if (NILP (object))
     XSETBUFFER (object, current_buffer);
@@ -1780,7 +1754,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_
   Lisp_Object res;
   Lisp_Object stuff;
   Lisp_Object plist;
-  EMACS_INT s, e, e2, p, len;
+  ptrdiff_t s, e, e2, p, len;
   int modified = 0;
   struct gcpro gcpro1, gcpro2;
 
@@ -1792,8 +1766,11 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_
   {
     Lisp_Object dest_start, dest_end;
 
+    e = XINT (pos) + (XINT (end) - XINT (start));
+    if (MOST_POSITIVE_FIXNUM < e)
+      args_out_of_range (pos, end);
     dest_start = pos;
-    XSETFASTINT (dest_end, XINT (dest_start) + (XINT (end) - XINT (start)));
+    XSETFASTINT (dest_end, e);
     /* Apply this to a copy of pos; it will try to increment its arguments,
        which we don't want.  */
     validate_interval_range (dest, &dest_start, &dest_end, soft);
@@ -1877,12 +1854,12 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp
   i = validate_interval_range (object, &start, &end, soft);
   if (!NULL_INTERVAL_P (i))
     {
-      EMACS_INT s = XINT (start);
-      EMACS_INT e = XINT (end);
+      ptrdiff_t s = XINT (start);
+      ptrdiff_t e = XINT (end);
 
       while (s < e)
        {
-         EMACS_INT interval_end, len;
+         ptrdiff_t interval_end, len;
          Lisp_Object plist;
 
          interval_end = i->position + LENGTH (i);
@@ -1960,7 +1937,7 @@ Lisp_Object
 extend_property_ranges (Lisp_Object list, Lisp_Object new_end)
 {
   Lisp_Object prev = Qnil, head = list;
-  EMACS_INT max = XINT (new_end);
+  ptrdiff_t max = XINT (new_end);
 
   for (; CONSP (list); prev = list, list = XCDR (list))
     {
@@ -2014,7 +1991,7 @@ call_mod_hooks (Lisp_Object list, Lisp_Object start, Lisp_Object end)
 
 void
 verify_interval_modification (struct buffer *buf,
-                             EMACS_INT start, EMACS_INT end)
+                             ptrdiff_t start, ptrdiff_t end)
 {
   register INTERVAL intervals = BUF_INTERVALS (buf);
   register INTERVAL i;
@@ -2035,7 +2012,7 @@ verify_interval_modification (struct buffer *buf,
 
   if (start > end)
     {
-      EMACS_INT temp = start;
+      ptrdiff_t temp = start;
       start = end;
       end = temp;
     }
index ac21667d65bf8e2288736562dd64f41176973fd9..9492d9dee3632ead09e16272c2ba687d4ca77e5c 100644 (file)
@@ -22,10 +22,6 @@ Boston, MA 02110-1301, USA.  */
 #include <setjmp.h>
 #include "lisp.h"              /* for xmalloc */
 #include "tparam.h"
-
-#ifndef NULL
-#define NULL (char *) 0
-#endif
 \f
 /* Assuming STRING is the value of a termcap string entry
    containing `%' constructs to expand parameters,
@@ -102,7 +98,7 @@ tparam1 (const char *string, char *outstring, int len,
          if (outlen == 0)
            {
              outlen = len + 40;
-             new = (char *) xmalloc (outlen);
+             new = xmalloc (outlen);
              memcpy (new, outstring, offset);
            }
          else
index 4041a2adacc3ac0c280fcbd11eb6a862005aed77..c90e7b62405cf9ed145cbf304354598e151c8494 100644 (file)
@@ -20,6 +20,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <config.h>
 #include <setjmp.h>
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "commands.h"
 #include "window.h"
@@ -30,7 +31,7 @@ static struct buffer *last_undo_buffer;
 
 /* Position of point last time we inserted a boundary.  */
 static struct buffer *last_boundary_buffer;
-static EMACS_INT last_boundary_position;
+static ptrdiff_t last_boundary_position;
 
 Lisp_Object Qinhibit_read_only;
 
@@ -51,7 +52,7 @@ static Lisp_Object pending_boundary;
    undo record that will be added just after this command terminates.  */
 
 static void
-record_point (EMACS_INT pt)
+record_point (ptrdiff_t pt)
 {
   int at_boundary;
 
@@ -113,7 +114,7 @@ record_point (EMACS_INT pt)
    because we don't need to record the contents.)  */
 
 void
-record_insert (EMACS_INT beg, EMACS_INT length)
+record_insert (ptrdiff_t beg, ptrdiff_t length)
 {
   Lisp_Object lbeg, lend;
 
@@ -148,7 +149,7 @@ record_insert (EMACS_INT beg, EMACS_INT length)
    of the characters in STRING, at location BEG.  */
 
 void
-record_delete (EMACS_INT beg, Lisp_Object string)
+record_delete (ptrdiff_t beg, Lisp_Object string)
 {
   Lisp_Object sbeg;
 
@@ -176,7 +177,7 @@ record_delete (EMACS_INT beg, Lisp_Object string)
    won't be inverted automatically by undoing the buffer modification.  */
 
 void
-record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
+record_marker_adjustment (Lisp_Object marker, ptrdiff_t adjustment)
 {
   if (EQ (BVAR (current_buffer, undo_list), Qt))
     return;
@@ -199,7 +200,7 @@ record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment)
    The replacement must not change the number of characters.  */
 
 void
-record_change (EMACS_INT beg, EMACS_INT length)
+record_change (ptrdiff_t beg, ptrdiff_t length)
 {
   record_delete (beg, make_buffer_string (beg, beg + length, 1));
   record_insert (beg, length);
@@ -225,7 +226,7 @@ record_first_change (void)
     base_buffer = base_buffer->base_buffer;
 
   BVAR (current_buffer, undo_list) =
-    Fcons (Fcons (Qt, INTEGER_TO_CONS (base_buffer->modtime)),
+    Fcons (Fcons (Qt, make_lisp_time (base_buffer->modtime)),
           BVAR (current_buffer, undo_list));
 }
 
@@ -233,7 +234,7 @@ record_first_change (void)
    for LENGTH characters starting at position BEG in BUFFER.  */
 
 void
-record_property_change (EMACS_INT beg, EMACS_INT length,
+record_property_change (ptrdiff_t beg, ptrdiff_t length,
                        Lisp_Object prop, Lisp_Object value,
                        Lisp_Object buffer)
 {
@@ -308,11 +309,11 @@ truncate_undo_list (struct buffer *b)
 {
   Lisp_Object list;
   Lisp_Object prev, next, last_boundary;
-  int size_so_far = 0;
+  EMACS_INT size_so_far = 0;
 
   /* Make sure that calling undo-outer-limit-function
      won't cause another GC.  */
-  int count = inhibit_garbage_collection ();
+  ptrdiff_t count = inhibit_garbage_collection ();
 
   /* Make the buffer current to get its local values of variables such
      as undo_limit.  Also so that Vundo_outer_limit_function can
@@ -436,6 +437,13 @@ truncate_undo_list (struct buffer *b)
 
   unbind_to (count, Qnil);
 }
+
+static _Noreturn void
+user_error (const char *msg)
+{
+  xsignal1 (Quser_error, build_string (msg));
+}
+
 \f
 DEFUN ("primitive-undo", Fprimitive_undo, Sprimitive_undo, 2, 2, 0,
        doc: /* Undo N records from the front of the list LIST.
@@ -444,8 +452,8 @@ Return what remains of the list.  */)
 {
   struct gcpro gcpro1, gcpro2;
   Lisp_Object next;
-  int count = SPECPDL_INDEX ();
-  register int arg;
+  ptrdiff_t count = SPECPDL_INDEX ();
+  register EMACS_INT arg;
   Lisp_Object oldlist;
   int did_apply = 0;
 
@@ -497,10 +505,23 @@ Return what remains of the list.  */)
              cdr = XCDR (next);
              if (EQ (car, Qt))
                {
-                 /* Element (t high . low) records previous modtime.  */
+                 /* Element (t . TIME) records previous modtime.
+                    Preserve any flag of NONEXISTENT_MODTIME_NSECS or
+                    UNKNOWN_MODTIME_NSECS.  */
                  struct buffer *base_buffer = current_buffer;
-                 time_t mod_time;
-                 CONS_TO_INTEGER (cdr, time_t, mod_time);
+                 EMACS_TIME mod_time;
+
+                 if (CONSP (cdr)
+                     && CONSP (XCDR (cdr))
+                     && CONSP (XCDR (XCDR (cdr)))
+                     && CONSP (XCDR (XCDR (XCDR (cdr))))
+                     && INTEGERP (XCAR (XCDR (XCDR (XCDR (cdr)))))
+                     && XINT (XCAR (XCDR (XCDR (XCDR (cdr))))) < 0)
+                   mod_time =
+                     (make_emacs_time
+                      (0, XINT (XCAR (XCDR (XCDR (XCDR (cdr))))) / 1000));
+                 else
+                   mod_time = lisp_time_argument (cdr);
 
                  if (current_buffer->base_buffer)
                    base_buffer = current_buffer->base_buffer;
@@ -508,7 +529,7 @@ Return what remains of the list.  */)
                  /* If this records an obsolete save
                     (not matching the actual disk file)
                     then don't mark unmodified.  */
-                 if (mod_time != base_buffer->modtime)
+                 if (EMACS_TIME_NE (mod_time, base_buffer->modtime))
                    continue;
 #ifdef CLASH_DETECTION
                  Funlock_buffer ();
@@ -528,7 +549,7 @@ Return what remains of the list.  */)
                  end = Fcdr (cdr);
 
                  if (XINT (beg) < BEGV || XINT (end) > ZV)
-                   error ("Changes to be undone are outside visible portion of buffer");
+                   user_error ("Changes to be undone are outside visible portion of buffer");
                  Fput_text_property (beg, end, prop, val, Qnil);
                }
              else if (INTEGERP (car) && INTEGERP (cdr))
@@ -537,7 +558,7 @@ Return what remains of the list.  */)
 
                  if (XINT (car) < BEGV
                      || XINT (cdr) > ZV)
-                   error ("Changes to be undone are outside visible portion of buffer");
+                   user_error ("Changes to be undone are outside visible portion of buffer");
                  /* Set point first thing, so that undoing this undo
                     does not send point back to where it is now.  */
                  Fgoto_char (car);
@@ -588,14 +609,14 @@ Return what remains of the list.  */)
                  if (pos < 0)
                    {
                      if (-pos < BEGV || -pos > ZV)
-                       error ("Changes to be undone are outside visible portion of buffer");
+                       user_error ("Changes to be undone are outside visible portion of buffer");
                      SET_PT (-pos);
                      Finsert (1, &membuf);
                    }
                  else
                    {
                      if (pos < BEGV || pos > ZV)
-                       error ("Changes to be undone are outside visible portion of buffer");
+                       user_error ("Changes to be undone are outside visible portion of buffer");
                      SET_PT (pos);
 
                      /* Now that we record marker adjustments
index e27fb1d136d93b47ed4a897bb06ef6fa940623e9..29fa0fd6287e3e3b31a777205204009659971a1d 100644 (file)
@@ -78,13 +78,13 @@ static long data_scnptr;
 static long load_scnptr;
 static long orig_load_scnptr;
 static long orig_data_scnptr;
-static int unrelocate_symbols (int, int, char *, char *);
+static int unrelocate_symbols (int, int, const char *, const char *);
 
 #ifndef MAX_SECTIONS
 #define MAX_SECTIONS   10
 #endif
 
-static int adjust_lnnoptrs (int, int, char *);
+static int adjust_lnnoptrs (int, int, const char *);
 
 static int pagemask;
 
@@ -92,7 +92,7 @@ static int pagemask;
 #include "lisp.h"
 
 static void
-report_error (char *file, int fd)
+report_error (const char *file, int fd)
 {
   if (fd)
     close (fd);
@@ -104,16 +104,16 @@ report_error (char *file, int fd)
 #define ERROR2(msg,x,y) report_error_1 (new, msg, x, y); return -1
 
 static void
-report_error_1 (int fd, char *msg, int a1, int a2)
+report_error_1 (int fd, const char *msg, int a1, int a2)
 {
   close (fd);
   error (msg, a1, a2);
 }
 
-static int make_hdr (int, int, char *, char *);
-static void mark_x (char *);
+static int make_hdr (int, int, const char *, const char *);
+static void mark_x (const char *);
 static int copy_text_and_data (int);
-static int copy_sym (int, int, char *, char *);
+static int copy_sym (int, int, const char *, const char *);
 static void write_segment (int, char *, char *);
 \f
 /* ****************************************************************
@@ -159,7 +159,7 @@ unexec (const char *new_name, const char *a_name)
  */
 static int
 make_hdr (int new, int a_out,
-         char *a_name, char *new_name)
+         const char *a_name, const char *new_name)
 {
   int scns;
   unsigned int bss_start;
@@ -429,7 +429,7 @@ write_segment (int new, char *ptr, char *end)
  * Copy the relocation information and symbol table from the a.out to the new
  */
 static int
-copy_sym (int new, int a_out, char *a_name, char *new_name)
+copy_sym (int new, int a_out, const char *a_name, const char *new_name)
 {
   char page[UnexBlockSz];
   int n;
@@ -465,7 +465,7 @@ copy_sym (int new, int a_out, char *a_name, char *new_name)
  * After successfully building the new a.out, mark it executable
  */
 static void
-mark_x (char *name)
+mark_x (const char *name)
 {
   struct stat sbuf;
   int um;
@@ -483,7 +483,7 @@ mark_x (char *name)
 }
 \f
 static int
-adjust_lnnoptrs (int writedesc, int readdesc, char *new_name)
+adjust_lnnoptrs (int writedesc, int readdesc, const char *new_name)
 {
   int nsyms;
   int naux;
@@ -530,7 +530,8 @@ adjust_lnnoptrs (int writedesc, int readdesc, char *new_name)
 }
 
 static int
-unrelocate_symbols (int new, int a_out, char *a_name, char *new_name)
+unrelocate_symbols (int new, int a_out,
+                   const char *a_name, const char *new_name)
 {
   int i;
   LDHDR ldhdr;
index ac9c9e757649eadf3df1b9b69eb7c3e1702b1a70..f35b53aeab3ec48e6cc8373ffa84828b699706be 100644 (file)
@@ -506,11 +506,7 @@ typedef struct {
 #endif
 
 #ifndef ElfW
-# ifdef __STDC__
-#  define ElfBitsW(bits, type) Elf##bits##_##type
-# else
-#  define ElfBitsW(bits, type) Elf/**/bits/**/_/**/type
-# endif
+# define ElfBitsW(bits, type) Elf##bits##_##type
 # ifdef _LP64
 #  define ELFSIZE 64
 # else
index 2e77d3e17bcd214ccbaa4dc4efa7623ca96ec5dd..0f5ad5498b008d1c036be8f0632bfe5f7ff22f79 100644 (file)
@@ -197,8 +197,6 @@ static off_t data_segment_old_fileoff = 0;
 
 static struct segment_command *data_segment_scp;
 
-static void unexec_error (const char *format, ...) NO_RETURN;
-
 /* Read N bytes from infd into memory starting at address DEST.
    Return true if successful, false otherwise.  */
 static int
@@ -275,7 +273,7 @@ unexec_copy (off_t dest, off_t src, ssize_t count)
 
 /* Debugging and informational messages routines.  */
 
-static void
+static _Noreturn void
 unexec_error (const char *format, ...)
 {
   va_list ap;
@@ -396,7 +394,7 @@ build_region_list (void)
        }
       else
        {
-         r = (struct region_t *) malloc (sizeof (struct region_t));
+         r = malloc (sizeof *r);
 
          if (!r)
            unexec_error ("cannot allocate region structure");
@@ -671,7 +669,7 @@ read_load_commands (void)
 #endif
 
   nlc = mh.ncmds;
-  lca = (struct load_command **) malloc (nlc * sizeof (struct load_command *));
+  lca = malloc (nlc * sizeof *lca);
 
   for (i = 0; i < nlc; i++)
     {
@@ -680,7 +678,7 @@ read_load_commands (void)
         size first and then read the rest.  */
       if (!unexec_read (&lc, sizeof (struct load_command)))
         unexec_error ("cannot read load command");
-      lca[i] = (struct load_command *) malloc (lc.cmdsize);
+      lca[i] = malloc (lc.cmdsize);
       memcpy (lca[i], &lc, sizeof (struct load_command));
       if (!unexec_read (lca[i] + 1, lc.cmdsize - sizeof (struct load_command)))
         unexec_error ("cannot read content of load command");
@@ -809,9 +807,9 @@ copy_data_segment (struct load_command *lc)
        {
          sectp->flags = S_REGULAR;
          if (!unexec_write (sectp->offset, (void *) sectp->addr, sectp->size))
-           unexec_error ("cannot write section %s", sectp->sectname);
+           unexec_error ("cannot write section %.16s", sectp->sectname);
          if (!unexec_write (header_offset, sectp, sizeof (struct section)))
-           unexec_error ("cannot write section %s's header", sectp->sectname);
+           unexec_error ("cannot write section %.16s's header", sectp->sectname);
        }
       else if (strncmp (sectp->sectname, SECT_BSS, 16) == 0)
        {
@@ -829,15 +827,15 @@ copy_data_segment (struct load_command *lc)
          my_size = (unsigned long)my_endbss_static - sectp->addr;
          if (!(sectp->addr <= (unsigned long)my_endbss_static
                && my_size <= sectp->size))
-           unexec_error ("my_endbss_static is not in section %s",
+           unexec_error ("my_endbss_static is not in section %.16s",
                          sectp->sectname);
          if (!unexec_write (sectp->offset, (void *) sectp->addr, my_size))
-           unexec_error ("cannot write section %s", sectp->sectname);
+           unexec_error ("cannot write section %.16s", sectp->sectname);
          if (!unexec_write_zero (sectp->offset + my_size,
                                  sectp->size - my_size))
-           unexec_error ("cannot write section %s", sectp->sectname);
+           unexec_error ("cannot write section %.16s", sectp->sectname);
          if (!unexec_write (header_offset, sectp, sizeof (struct section)))
-           unexec_error ("cannot write section %s's header", sectp->sectname);
+           unexec_error ("cannot write section %.16s's header", sectp->sectname);
        }
       else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
               || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
@@ -848,15 +846,18 @@ copy_data_segment (struct load_command *lc)
               || strncmp (sectp->sectname, "__cfstring", 16) == 0
               || strncmp (sectp->sectname, "__gcc_except_tab", 16) == 0
               || strncmp (sectp->sectname, "__program_vars", 16) == 0
+              || strncmp (sectp->sectname, "__mod_init_func", 16) == 0
+              || strncmp (sectp->sectname, "__mod_term_func", 16) == 0
               || strncmp (sectp->sectname, "__objc_", 7) == 0)
        {
          if (!unexec_copy (sectp->offset, old_file_offset, sectp->size))
-           unexec_error ("cannot copy section %s", sectp->sectname);
+           unexec_error ("cannot copy section %.16s", sectp->sectname);
          if (!unexec_write (header_offset, sectp, sizeof (struct section)))
-           unexec_error ("cannot write section %s's header", sectp->sectname);
+           unexec_error ("cannot write section %.16s's header", sectp->sectname);
        }
       else
-       unexec_error ("unrecognized section name in __DATA segment");
+       unexec_error ("unrecognized section %.16s in __DATA segment",
+                     sectp->sectname);
 
       printf ("        section %-16.16s at %#8lx - %#8lx (sz: %#8lx)\n",
              sectp->sectname, (long) (sectp->offset),
@@ -1377,7 +1378,7 @@ unexec_realloc (void *old_ptr, size_t new_size)
          size_t old_size = ((unexec_malloc_header_t *) old_ptr)[-1].u.size;
          size_t size = new_size > old_size ? old_size : new_size;
 
-         p = (size_t *) malloc (new_size);
+         p = malloc (new_size);
          if (size)
            memcpy (p, old_ptr, size);
        }
index ef1e34e6f0f63fc9261bbbe52dba55874f3fc59a..336f3b4faea83e115d140a5acab114bd4676c5d9 100644 (file)
@@ -7,6 +7,7 @@
 #include <setjmp.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "charset.h"
 #include "coding.h"
index 94725044048b0a6a42e93f26e00a896e7bf08aed..c313a900f2c6d87c4f39d417852f89ab331d5f5d 100644 (file)
@@ -31,7 +31,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 enum warnlevel { not_warned, warned_75, warned_85, warned_95 };
 static enum warnlevel warnlevel;
 
-typedef POINTER_TYPE *POINTER;
+typedef void *POINTER;
 
 /* Function to call to issue a warning;
    0 means don't issue them.  */
index 03f63bedf0ddb97d34f4ccba4996f360ae5c269d..2026de7421dcc7ce3b8486f1c4893f084d8441fb 100644 (file)
@@ -36,8 +36,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dispextern.h"        /* frame.h seems to want this */
 #include "frame.h"     /* Need this to get the X window of selected_frame */
 #include "blockinput.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "coding.h"
 #include "composite.h"
 
@@ -493,7 +493,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
 
       setup_coding_system (Fcheck_coding_system (coding_system), &coding);
       coding.dst_bytes = nbytes * 4;
-      coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
+      coding.destination = xmalloc (coding.dst_bytes);
       Vnext_selection_coding_system = Qnil;
       coding.mode |= CODING_MODE_LAST_BLOCK;
       dst = coding.destination;
@@ -572,7 +572,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
     goto unblock;
 
   if ((data_size = get_clipboard_data_size (CF_OEMTEXT)) == 0 ||
-      (htext = (unsigned char *)xmalloc (data_size)) == 0)
+      (htext = xmalloc (data_size)) == 0)
     goto closeclip;
 
   /* need to know final size after '\r' chars are removed because
index 3d3d33453c667af3f2dfc5c74aae9fe70724d307..e8c48a50a974d32bd47c501224784ba93c62ef8d 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -318,8 +318,10 @@ is_windows_9x (void)
   return s_b_ret;
 }
 
+static Lisp_Object ltime (ULONGLONG);
+
 /* Get total user and system times for get-internal-run-time.
-   Returns a list of three integers if the times are provided by the OS
+   Returns a list of integers if the times are provided by the OS
    (NT derivatives), otherwise it returns the result of current-time. */
 Lisp_Object
 w32_get_internal_run_time (void)
@@ -331,27 +333,12 @@ w32_get_internal_run_time (void)
       if ((*get_process_times_fn) (proc, &create, &exit, &kernel, &user))
         {
           LARGE_INTEGER user_int, kernel_int, total;
-          int microseconds;
           user_int.LowPart = user.dwLowDateTime;
           user_int.HighPart = user.dwHighDateTime;
           kernel_int.LowPart = kernel.dwLowDateTime;
           kernel_int.HighPart = kernel.dwHighDateTime;
           total.QuadPart = user_int.QuadPart + kernel_int.QuadPart;
-          /* FILETIME is 100 nanosecond increments, Emacs only wants
-             microsecond resolution.  */
-          total.QuadPart /= 10;
-          microseconds = total.QuadPart % 1000000;
-          total.QuadPart /= 1000000;
-
-          /* Sanity check to make sure we can represent the result.  */
-          if (total.HighPart == 0)
-            {
-              int secs = total.LowPart;
-
-              return list3 (make_number ((secs >> 16) & 0xffff),
-                            make_number (secs & 0xffff),
-                            make_number (microseconds));
-            }
+         return ltime (total.QuadPart);
         }
     }
 
@@ -791,9 +778,8 @@ getwd (char *dir)
     return dir;
   return NULL;
 #else
-  /* Emacs doesn't actually change directory itself, and we want to
-     force our real wd to be where emacs.exe is to avoid unnecessary
-     conflicts when trying to rename or delete directories.  */
+  /* Emacs doesn't actually change directory itself, it stays in the
+     same directory where it was started.  */
   strcpy (dir, startup_dir);
   return dir;
 #endif
@@ -1490,7 +1476,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype)
       lpvalue = NULL;
 
       if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS
-         && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
+         && (lpvalue = xmalloc (cbData)) != NULL
          && RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS)
        {
           RegCloseKey (hrootkey);
@@ -1507,7 +1493,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype)
       lpvalue = NULL;
 
       if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS
-         && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
+         && (lpvalue = xmalloc (cbData)) != NULL
          && RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS)
        {
           RegCloseKey (hrootkey);
@@ -1549,12 +1535,7 @@ init_environment (char ** argv)
         read-only filesystem, like CD-ROM or a write-protected floppy.
         The only way to be really sure is to actually create a file and
         see if it succeeds.  But I think that's too much to ask.  */
-#ifdef _MSC_VER
-      /* MSVC's _access crashes with D_OK.  */
       if (tmp && sys_access (tmp, D_OK) == 0)
-#else
-      if (tmp && _access (tmp, D_OK) == 0)
-#endif
        {
          char * var = alloca (strlen (tmp) + 8);
          sprintf (var, "TMPDIR=%s", tmp);
@@ -1794,27 +1775,15 @@ init_environment (char ** argv)
        memcpy (*envp, "COMSPEC=", 8);
   }
 
-  /* Remember the initial working directory for getwd, then make the
-     real wd be the location of emacs.exe to avoid conflicts when
-     renaming or deleting directories.  (We also don't call chdir when
-     running subprocesses for the same reason.)  */
+  /* Remember the initial working directory for getwd.  */
   if (!GetCurrentDirectory (MAXPATHLEN, startup_dir))
     abort ();
 
   {
-    char *p;
     static char modname[MAX_PATH];
 
     if (!GetModuleFileName (NULL, modname, MAX_PATH))
       abort ();
-    if ((p = strrchr (modname, '\\')) == NULL)
-      abort ();
-    *p = 0;
-
-    SetCurrentDirectory (modname);
-
-    /* Ensure argv[0] has the full path to Emacs.  */
-    *p = '\\';
     argv[0] = modname;
   }
 
@@ -2000,7 +1969,7 @@ gettimeofday (struct timeval *tv, struct timezone *tz)
      changed.  We could fix that by using GetSystemTime and
      GetTimeZoneInformation, but that doesn't seem necessary, since
      Emacs always calls gettimeofday with the 2nd argument NULL (see
-     EMACS_GET_TIME).  */
+     current_emacs_time).  */
   if (tz)
     {
       tz->tz_minuteswest = tb.timezone;        /* minutes west of Greenwich  */
@@ -2008,6 +1977,41 @@ gettimeofday (struct timeval *tv, struct timezone *tz)
     }
 }
 
+/* Emulate fdutimens.  */
+
+/* Set the access and modification time stamps of FD (a.k.a. FILE) to be
+   TIMESPEC[0] and TIMESPEC[1], respectively.
+   FD must be either negative -- in which case it is ignored --
+   or a file descriptor that is open on FILE.
+   If FD is nonnegative, then FILE can be NULL, which means
+   use just futimes instead of utimes.
+   If TIMESPEC is null, FAIL.
+   Return 0 on success, -1 (setting errno) on failure.  */
+
+int
+fdutimens (int fd, char const *file, struct timespec const timespec[2])
+{
+  struct _utimbuf ut;
+
+  if (!timespec)
+    {
+      errno = ENOSYS;
+      return -1;
+    }
+  if (fd < 0 && !file)
+    {
+      errno = EBADF;
+      return -1;
+    }
+  ut.actime = timespec[0].tv_sec;
+  ut.modtime = timespec[1].tv_sec;
+  if (fd >= 0)
+    return _futime (fd, &ut);
+  else
+    return _utime (file, &ut);
+}
+
+
 /* ------------------------------------------------------------------------- */
 /* IO support and wrapper functions for W32 API. */
 /* ------------------------------------------------------------------------- */
@@ -2165,7 +2169,7 @@ GetCachedVolumeInformation (char * root_dir)
         entry if present.  */
       if (info == NULL)
        {
-         info = (volume_info_data *) xmalloc (sizeof (volume_info_data));
+         info = xmalloc (sizeof (volume_info_data));
          add_volume_info (root_dir, info);
        }
       else
@@ -2645,7 +2649,8 @@ sys_access (const char * path, int mode)
 {
   DWORD attributes;
 
-  /* MSVC implementation doesn't recognize D_OK.  */
+  /* MSVCRT implementation of 'access' doesn't recognize D_OK, and its
+     newer versions blow up when passed D_OK.  */
   path = map_w32_filename (path, NULL);
   if (is_unc_volume (path))
     {
@@ -2657,9 +2662,17 @@ sys_access (const char * path, int mode)
     }
   else if ((attributes = GetFileAttributes (path)) == -1)
     {
-      /* Should try mapping GetLastError to errno; for now just indicate
-        that path doesn't exist.  */
-      errno = EACCES;
+      DWORD w32err = GetLastError ();
+
+      switch (w32err)
+       {
+       case ERROR_FILE_NOT_FOUND:
+         errno = ENOENT;
+         break;
+       default:
+         errno = EACCES;
+         break;
+       }
       return -1;
     }
   if ((mode & X_OK) != 0 && !is_exec (path))
@@ -4071,14 +4084,17 @@ restore_privilege (TOKEN_PRIVILEGES *priv)
 }
 
 static Lisp_Object
-ltime (long time_sec, long time_usec)
+ltime (ULONGLONG time_100ns)
 {
-  return list3 (make_number ((time_sec >> 16) & 0xffff),
+  ULONGLONG time_sec = time_100ns / 10000000;
+  int subsec = time_100ns % 10000000;
+  return list4 (make_number (time_sec >> 16),
                make_number (time_sec & 0xffff),
-               make_number (time_usec));
+               make_number (subsec / 10),
+               make_number (subsec % 10 * 100000));
 }
 
-#define U64_TO_LISP_TIME(time) ltime ((time) / 1000000L, (time) % 1000000L)
+#define U64_TO_LISP_TIME(time) ltime (time)
 
 static int
 process_times (HANDLE h_proc, Lisp_Object *ctime, Lisp_Object *etime,
@@ -4097,11 +4113,9 @@ process_times (HANDLE h_proc, Lisp_Object *ctime, Lisp_Object *etime,
   GetSystemTimeAsFileTime (&ft_current);
 
   FILETIME_TO_U64 (tem1, ft_kernel);
-  tem1 /= 10L;
   *stime = U64_TO_LISP_TIME (tem1);
 
   FILETIME_TO_U64 (tem2, ft_user);
-  tem2 /= 10L;
   *utime = U64_TO_LISP_TIME (tem2);
 
   tem3 = tem1 + tem2;
@@ -4110,13 +4124,13 @@ process_times (HANDLE h_proc, Lisp_Object *ctime, Lisp_Object *etime,
   FILETIME_TO_U64 (tem, ft_creation);
   /* Process no 4 (System) returns zero creation time.  */
   if (tem)
-    tem = (tem - utc_base) / 10L;
+    tem -= utc_base;
   *ctime = U64_TO_LISP_TIME (tem);
 
   if (tem)
     {
       FILETIME_TO_U64 (tem3, ft_current);
-      tem = (tem3 - utc_base) / 10L - tem;
+      tem = (tem3 - utc_base) - tem;
     }
   *etime = U64_TO_LISP_TIME (tem);
 
@@ -5816,7 +5830,15 @@ w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id)
             CHECK_STRING_CAR (dlls);
             if ((library_dll = LoadLibrary (SDATA (XCAR (dlls)))))
               {
-                found = XCAR (dlls);
+                char name[MAX_PATH];
+                DWORD len;
+
+                len = GetModuleFileNameA (library_dll, name, sizeof (name));
+                found = Fcons (XCAR (dlls),
+                               (len > 0)
+                               /* Possibly truncated */
+                               ? make_specified_string (name, -1, len, 1)
+                               : Qnil);
                 break;
               }
           }
@@ -6267,7 +6289,7 @@ emacs_gnutls_pull (gnutls_transport_ptr_t p, void* buf, size_t sz)
 {
   int n, sc, err;
   SELECT_TYPE fdset;
-  EMACS_TIME timeout;
+  struct timeval timeout;
   struct Lisp_Process *process = (struct Lisp_Process *)p;
   int fd = process->infd;
 
@@ -6283,13 +6305,14 @@ emacs_gnutls_pull (gnutls_transport_ptr_t p, void* buf, size_t sz)
       if (err == EWOULDBLOCK)
         {
           /* Set a small timeout.  */
-          EMACS_SET_SECS_USECS (timeout, 1, 0);
+         timeout.tv_sec = 1;
+         timeout.tv_usec = 0;
           FD_ZERO (&fdset);
           FD_SET ((int)fd, &fdset);
 
           /* Use select with the timeout to poll the selector.  */
           sc = select (fd + 1, &fdset, (SELECT_TYPE *)0, (SELECT_TYPE *)0,
-                       &timeout);
+                       &timeout, NULL);
 
           if (sc > 0)
             continue;  /* Try again.  */
index e8b0f621b4f8f7447d41f2c825f5239811e59945..42d89cca6d7baf3e52725b917f23a6efbfdfd169 100644 (file)
@@ -33,6 +33,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "disptab.h"
 #include "frame.h"
+#include "window.h"
 #include "termhooks.h"
 #include "termchar.h"
 #include "dispextern.h"
@@ -339,6 +340,84 @@ w32con_write_glyphs (struct frame *f, register struct glyph *string,
     }
 }
 
+/* Used for mouse highlight.  */
+static void
+w32con_write_glyphs_with_face (struct frame *f, register int x, register int y,
+                              register struct glyph *string, register int len,
+                              register int face_id)
+{
+  unsigned char *conversion_buffer;
+  struct coding_system *coding;
+
+  if (len <= 0)
+    return;
+
+  /* If terminal_coding does any conversion, use it, otherwise use
+     safe_terminal_coding.  We can't use CODING_REQUIRE_ENCODING here
+     because it always return 1 if the member src_multibyte is 1.  */
+  coding = (FRAME_TERMINAL_CODING (f)->common_flags & CODING_REQUIRE_ENCODING_MASK
+           ? FRAME_TERMINAL_CODING (f) : &safe_terminal_coding);
+  /* We are going to write the entire block of glyphs in one go, as
+     they all have the same face.  So this _is_ the last block.  */
+  coding->mode |= CODING_MODE_LAST_BLOCK;
+
+  conversion_buffer = encode_terminal_code (string, len, coding);
+  if (coding->produced > 0)
+    {
+      DWORD filled, written;
+      /* Compute the character attributes corresponding to the face.  */
+      DWORD char_attr = w32_face_attributes (f, face_id);
+      COORD start_coords;
+
+      start_coords.X = x;
+      start_coords.Y = y;
+      /* Set the attribute for these characters.  */
+      if (!FillConsoleOutputAttribute (cur_screen, char_attr,
+                                      coding->produced, start_coords,
+                                      &filled))
+       DebPrint (("Failed writing console attributes: %d\n", GetLastError ()));
+      else
+       {
+         /* Write the characters.  */
+         if (!WriteConsoleOutputCharacter (cur_screen, conversion_buffer,
+                                           filled, start_coords, &written))
+           DebPrint (("Failed writing console characters: %d\n",
+                      GetLastError ()));
+       }
+    }
+}
+
+/* Implementation of draw_row_with_mouse_face for W32 console.  */
+void
+tty_draw_row_with_mouse_face (struct window *w, struct glyph_row *row,
+                             int start_hpos, int end_hpos,
+                             enum draw_glyphs_face draw)
+{
+  int nglyphs = end_hpos - start_hpos;
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  struct tty_display_info *tty = FRAME_TTY (f);
+  int face_id = tty->mouse_highlight.mouse_face_face_id;
+  int pos_x, pos_y;
+
+  if (end_hpos >= row->used[TEXT_AREA])
+    nglyphs = row->used[TEXT_AREA] - start_hpos;
+
+  pos_y = row->y + WINDOW_TOP_EDGE_Y (w);
+  pos_x = row->used[LEFT_MARGIN_AREA] + start_hpos + WINDOW_LEFT_EDGE_X (w);
+
+  if (draw == DRAW_MOUSE_FACE)
+    w32con_write_glyphs_with_face (f, pos_x, pos_y,
+                                  row->glyphs[TEXT_AREA] + start_hpos,
+                                  nglyphs, face_id);
+  else if (draw == DRAW_NORMAL_TEXT)
+    {
+      COORD save_coords = cursor_coords;
+
+      w32con_move_cursor (f, pos_y, pos_x);
+      write_glyphs (f, row->glyphs[TEXT_AREA] + start_hpos, nglyphs);
+      w32con_move_cursor (f, save_coords.Y, save_coords.X);
+    }
+}
 
 static void
 w32con_delete_glyphs (struct frame *f, int n)
@@ -537,7 +616,7 @@ w32_face_attributes (struct frame *f, int face_id)
   WORD char_attr;
   struct face *face = FACE_FROM_ID (f, face_id);
 
-  xassert (face != NULL);
+  eassert (face != NULL);
 
   char_attr = char_attr_normal;
 
@@ -570,6 +649,7 @@ void
 initialize_w32_display (struct terminal *term)
 {
   CONSOLE_SCREEN_BUFFER_INFO   info;
+  Mouse_HLInfo *hlinfo;
 
   term->rif = 0; /* No window based redisplay on the console.  */
   term->cursor_to_hook         = w32con_move_cursor;
@@ -600,6 +680,15 @@ initialize_w32_display (struct terminal *term)
   term->judge_scroll_bars_hook = 0;
   term->frame_up_to_date_hook = 0;
 
+  /* Initialize the mouse-highlight data.  */
+  hlinfo = &term->display_info.tty->mouse_highlight;
+  hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+  hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+  hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
+  hlinfo->mouse_face_mouse_frame = NULL;
+  hlinfo->mouse_face_window = Qnil;
+  hlinfo->mouse_face_hidden = 0;
+
   /* Initialize interrupt_handle.  */
   init_crit ();
 
index 510d1e94f166bb83d9e1f6f4dd27966dca23f155..dac83ab6ae1bef15c50c7fd1c181e6cd9514bb41 100644 (file)
@@ -32,13 +32,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "w32term.h"
 #include "frame.h"
 #include "window.h"
+#include "character.h"
 #include "buffer.h"
 #include "intervals.h"
 #include "dispextern.h"
 #include "keyboard.h"
 #include "blockinput.h"
 #include "epaths.h"
-#include "character.h"
 #include "charset.h"
 #include "coding.h"
 #include "ccl.h"
@@ -183,7 +183,7 @@ unsigned int msh_mousewheel = 0;
 #define MENU_FREE_DELAY 1000
 static unsigned menu_free_timer = 0;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 static int image_cache_refcount, dpyinfo_refcount;
 #endif
 
@@ -678,7 +678,7 @@ w32_color_map_lookup (char *colorname)
       elt = XCAR (tail);
       if (!CONSP (elt)) continue;
 
-      tem = Fcar (elt);
+      tem = XCAR (elt);
 
       if (lstrcmpi (SDATA (tem), colorname) == 0)
        {
@@ -1006,8 +1006,7 @@ w32_map_color (FRAME_PTR f, COLORREF color)
     }
 
   /* not already mapped, so add to list and recreate Windows palette */
-  list = (struct w32_palette_entry *)
-    xmalloc (sizeof (struct w32_palette_entry));
+  list = xmalloc (sizeof (struct w32_palette_entry));
   SET_W32_COLOR (list->entry, color);
   list->refcount = 1;
   list->next = FRAME_W32_DISPLAY_INFO (f)->color_list;
@@ -1109,8 +1108,7 @@ w32_defined_color (FRAME_PTR f, char *color, XColor *color_def, int alloc)
          if (entry == NULL && alloc)
            {
              /* not already mapped, so add to list */
-             entry = (struct w32_palette_entry *)
-               xmalloc (sizeof (struct w32_palette_entry));
+             entry = xmalloc (sizeof (struct w32_palette_entry));
              SET_W32_COLOR (entry->entry, XUINT (tem));
              entry->next = NULL;
              *prev = entry;
@@ -2509,19 +2507,19 @@ post_character_message (HWND hwnd, UINT msg,
      woken up if blocked in sys_select, but we do NOT want to post
      the quit_char message itself (because it will usually be as if
      the user had typed quit_char twice).  Instead, we post a dummy
-     message that has no particular effect. */
+     message that has no particular effect.  */
   {
     int c = wParam;
     if (isalpha (c) && wmsg.dwModifiers == ctrl_modifier)
       c = make_ctrl_char (c) & 0377;
     if (c == quit_char
-       || (wmsg.dwModifiers == 0 &&
-           w32_quit_key && wParam == w32_quit_key))
+       || (wmsg.dwModifiers == 0
+           && w32_quit_key && wParam == w32_quit_key))
       {
        Vquit_flag = Qt;
 
        /* The choice of message is somewhat arbitrary, as long as
-          the main thread handler just ignores it. */
+          the main thread handler just ignores it.  */
        msg = WM_NULL;
 
        /* Interrupt any blocking system calls.  */
@@ -3663,6 +3661,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
     case WM_EMACS_SHOWWINDOW:
       return ShowWindow ((HWND) wParam, (WPARAM) lParam);
 
+    case WM_EMACS_BRINGTOTOP:
     case WM_EMACS_SETFOREGROUND:
       {
         HWND foreground_window;
@@ -3680,6 +3679,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
           foreground_thread = 0;
 
         retval = SetForegroundWindow ((HWND) wParam);
+        if (msg == WM_EMACS_BRINGTOTOP)
+          retval = BringWindowToTop ((HWND) wParam);
 
         /* Detach from the previous foreground thread.  */
         if (foreground_thread)
@@ -3878,7 +3879,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
 
   {
     char *str = SSDATA (Vx_resource_name);
-    f->namebuf = (char *) xmalloc (strlen (str) + 1);
+    f->namebuf = xmalloc (strlen (str) + 1);
     strcpy (f->namebuf, str);
   }
 
@@ -3993,17 +3994,17 @@ unwind_create_frame (Lisp_Object frame)
   /* If frame is ``official'', nothing to do.  */
   if (NILP (Fmemq (frame, Vframe_list)))
     {
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
 #endif
 
       x_free_frame_resources (f);
       free_glyphs (f);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       /* Check that reference counts are indeed correct.  */
-      xassert (dpyinfo->reference_count == dpyinfo_refcount);
-      xassert (dpyinfo->image_cache->refcount == image_cache_refcount);
+      eassert (dpyinfo->reference_count == dpyinfo_refcount);
+      eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
 #endif
       return Qt;
     }
@@ -4035,7 +4036,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms)
 
       for (i = 0; names[i]; i++)
         {
-          font = font_open_by_name (f, names[i]);
+          font = font_open_by_name (f, names[i], strlen (names[i]));
           if (! NILP (font))
             break;
         }
@@ -4070,7 +4071,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   int minibuffer_only = 0;
   long window_prompting = 0;
   int width, height;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object display;
   struct w32_display_info *dpyinfo = NULL;
@@ -4142,9 +4143,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   f->terminal = dpyinfo->terminal;
 
   f->output_method = output_w32;
-  f->output_data.w32 =
-    (struct w32_output *) xmalloc (sizeof (struct w32_output));
-  memset (f->output_data.w32, 0, sizeof (struct w32_output));
+  f->output_data.w32 = xzalloc (sizeof (struct w32_output));
   FRAME_FONTSET (f) = -1;
 
   f->icon_name
@@ -4157,7 +4156,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
 
   /* With FRAME_X_DISPLAY_INFO set up, this unwind-protect is safe.  */
   record_unwind_protect (unwind_create_frame, frame);
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   image_cache_refcount =
     FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
   dpyinfo_refcount = dpyinfo->reference_count;
@@ -4898,9 +4897,10 @@ If TYPE is not given or nil, the type is STRING.
 FORMAT gives the size in bits of each element if VALUE is a list.
 It must be one of 8, 16 or 32.
 If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
-If OUTER_P is non-nil, the property is changed for the outer X window of
+If OUTER-P is non-nil, the property is changed for the outer X window of
 FRAME.  Default is to change on the edit X window.  */)
-  (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
+  (Lisp_Object prop, Lisp_Object value, Lisp_Object frame,
+   Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
 {
   struct frame *f = check_x_frame (frame);
   Atom prop_atom;
@@ -4945,23 +4945,24 @@ FRAME nil or omitted means use the selected frame.  Value is PROP.  */)
 
 
 DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
-       1, 2, 0,
+       1, 6, 0,
        doc: /* Value is the value of window property PROP on FRAME.
 If FRAME is nil or omitted, use the selected frame.
 
-On MS Windows, this function only accepts the PROP and FRAME arguments.
-
 On X Windows, the following optional arguments are also accepted:
 If TYPE is nil or omitted, get the property as a string.
 Otherwise TYPE is the name of the atom that denotes the type expected.
 If SOURCE is non-nil, get the property on that window instead of from
 FRAME.  The number 0 denotes the root window.
-If DELETE_P is non-nil, delete the property after retrieving it.
-If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
+If DELETE-P is non-nil, delete the property after retrieving it.
+If VECTOR-RET-P is non-nil, don't return a string but a vector of values.
+
+On MS Windows, this function accepts but ignores those optional arguments.
 
 Value is nil if FRAME hasn't a property with name PROP or if PROP has
 no value of TYPE (always string in the MS Windows case).  */)
-  (Lisp_Object prop, Lisp_Object frame)
+  (Lisp_Object prop, Lisp_Object frame, Lisp_Object type,
+   Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p)
 {
   struct frame *f = check_x_frame (frame);
   Atom prop_atom;
@@ -5016,16 +5017,6 @@ no value of TYPE (always string in the MS Windows case).  */)
    cursor.  Duplicated from xdisp.c, but cannot use the version there
    due to lack of atimers on w32.  */
 #define DEFAULT_HOURGLASS_DELAY 1
-/* Return non-zero if hourglass timer has been started or hourglass is
-   shown.  */
-/* PENDING: if W32 can use atimers (atimer.[hc]) then the common impl in
-           xdisp.c could be used. */
-
-int
-hourglass_started (void)
-{
-  return hourglass_shown_p || hourglass_timer;
-}
 
 /* Cancel a currently active hourglass timer, and start a new one.  */
 
@@ -5183,7 +5174,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
   Lisp_Object name;
   long window_prompting = 0;
   int width, height;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3;
   struct kboard *kb;
   int face_change_count_before = face_change_count;
@@ -5237,16 +5228,14 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
      counts etc.  */
   f->terminal = dpyinfo->terminal;
   f->output_method = output_w32;
-  f->output_data.w32 =
-    (struct w32_output *) xmalloc (sizeof (struct w32_output));
-  memset (f->output_data.w32, 0, sizeof (struct w32_output));
+  f->output_data.w32 = xzalloc (sizeof (struct w32_output));
 
   FRAME_FONTSET (f)  = -1;
   f->icon_name = Qnil;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   image_cache_refcount =
-    FRAME_IMAGE_CACHE ? FRAME_IMAGE_CACHE (f)->refcount : 0;
+    FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
   dpyinfo_refcount = dpyinfo->reference_count;
 #endif /* GLYPH_DEBUG */
   FRAME_KBOARD (f) = kb;
@@ -5532,7 +5521,7 @@ Text larger than the specified size is clipped.  */)
   int i, width, height, seen_reversed_p;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   int old_windows_or_buffers_changed = windows_or_buffers_changed;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   specbind (Qinhibit_redisplay, Qt);
 
@@ -5811,7 +5800,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
 Value is t if tooltip was open, nil otherwise.  */)
   (void)
 {
-  int count;
+  ptrdiff_t count;
   Lisp_Object deleted, frame, timer;
   struct gcpro gcpro1, gcpro2;
 
@@ -5933,7 +5922,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.  */)
 {
   struct frame *f = SELECTED_FRAME ();
   Lisp_Object file = Qnil;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   char filename[MAX_PATH + 1];
   char init_dir[MAX_PATH + 1];
@@ -6333,13 +6322,8 @@ The return value is the hotkey-id if registered, otherwise nil.  */)
 
       /* Notify input thread about new hot-key definition, so that it
         takes effect without needing to switch focus.  */
-#ifdef USE_LISP_UNION_TYPE
       PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
-                        (WPARAM) key.i, 0);
-#else
-      PostThreadMessage (dwWindowsThreadId, WM_EMACS_REGISTER_HOT_KEY,
-                        (WPARAM) key, 0);
-#endif
+                        (WPARAM) XLI (key), 0);
     }
 
   return key;
@@ -6361,13 +6345,8 @@ DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
     {
       /* Notify input thread about hot-key definition being removed, so
         that it takes effect without needing focus switch.  */
-#ifdef USE_LISP_UNION_TYPE
       if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
-                            (WPARAM) XINT (XCAR (item)), (LPARAM) item.i))
-#else
-      if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_UNREGISTER_HOT_KEY,
-                            (WPARAM) XINT (XCAR (item)), (LPARAM) item))
-#endif
+                            (WPARAM) XINT (XCAR (item)), (LPARAM) XLI (item)))
        {
          MSG msg;
          GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -6439,13 +6418,8 @@ is set to off if the low bit of NEW-STATE is zero, otherwise on.  */)
   if (!dwWindowsThreadId)
     return make_number (w32_console_toggle_lock_key (vk_code, new_state));
 
-#ifdef USE_LISP_UNION_TYPE
   if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
-                        (WPARAM) vk_code, (LPARAM) new_state.i))
-#else
-  if (PostThreadMessage (dwWindowsThreadId, WM_EMACS_TOGGLE_LOCK_KEY,
-                        (WPARAM) vk_code, (LPARAM) new_state))
-#endif
+                        (WPARAM) vk_code, (LPARAM) XLI (new_state)))
     {
       MSG msg;
       GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
@@ -6709,7 +6683,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
       return Qnil;
     }
   /* Allocate memory for the PRINTER_INFO_2 struct */
-  ppi2 = (PRINTER_INFO_2 *) xmalloc (dwNeeded);
+  ppi2 = xmalloc (dwNeeded);
   if (!ppi2)
     {
       ClosePrinter (hPrn);
@@ -6824,7 +6798,7 @@ syms_of_w32fns (void)
   Fput (Qundefined_color, Qerror_conditions,
        pure_cons (Qundefined_color, pure_cons (Qerror, Qnil)));
   Fput (Qundefined_color, Qerror_message,
-       make_pure_c_string ("Undefined color"));
+       build_pure_c_string ("Undefined color"));
 
   staticpro (&w32_grabbed_keys);
   w32_grabbed_keys = Qnil;
index 8badace96358f36af0fcbc0eb17485cb85fdafc2..0200d7ce074f583b472f835ff0b20690a1aae736 100644 (file)
@@ -289,20 +289,12 @@ memq_no_quit (Lisp_Object elt, Lisp_Object list)
 Lisp_Object
 intern_font_name (char * string)
 {
-  Lisp_Object obarray, tem, str;
-  int len;
-
-  str = DECODE_SYSTEM (build_string (string));
-  len = SCHARS (str);
-
-  /* The following code is copied from the function intern (in lread.c).  */
-  obarray = Vobarray;
-  if (!VECTORP (obarray) || ASIZE (obarray) == 0)
-    obarray = check_obarray (obarray);
-  tem = oblookup (obarray, SDATA (str), len, len);
-  if (SYMBOLP (tem))
-    return tem;
-  return Fintern (str, obarray);
+  Lisp_Object str = DECODE_SYSTEM (build_string (string));
+  int len = SCHARS (str);
+  Lisp_Object obarray = check_obarray (Vobarray);
+  Lisp_Object tem = oblookup (obarray, SDATA (str), len, len);  
+  /* This code is similar to intern function from lread.c.  */
+  return SYMBOLP (tem) ? tem : Fintern (str, obarray);
 }
 
 /* w32 implementation of get_cache for font backend.
@@ -529,9 +521,7 @@ w32font_text_extents (struct font *font, unsigned *code,
          if (!w32_font->cached_metrics[block])
            {
              w32_font->cached_metrics[block]
-               = xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
-             memset (w32_font->cached_metrics[block], 0,
-                     CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
+               = xzalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
            }
 
          char_metric = w32_font->cached_metrics[block] + pos_in_block;
index da8579896f22c030d35446e0373d9e22552ac472..cc5e5cd2bf50c8a5ea3cec63bbc1b05813c3c6df 100644 (file)
@@ -114,7 +114,7 @@ get_data_end (void)
   return data_region_end;
 }
 
-#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG)
+#if !USE_LSB_TAG
 static char *
 allocate_heap (void)
 {
@@ -141,7 +141,7 @@ allocate_heap (void)
 
   return ptr;
 }
-#else  /* USE_LISP_UNION_TYPE || USE_LSB_TAG */
+#else  /* USE_LSB_TAG */
 static char *
 allocate_heap (void)
 {
@@ -160,7 +160,7 @@ allocate_heap (void)
 
   return ptr;
 }
-#endif /* USE_LISP_UNION_TYPE || USE_LSB_TAG */
+#endif /* USE_LSB_TAG */
 
 
 /* Emulate Unix sbrk.  Note that ralloc.c expects the return value to
@@ -259,7 +259,7 @@ init_heap (void)
          exit (1);
        }
 
-#if !defined (USE_LISP_UNION_TYPE) && !defined (USE_LSB_TAG)
+#if !USE_LSB_TAG
       /* Ensure that the addresses don't use the upper tag bits since
         the Lisp type goes there.  */
       if (((unsigned long) data_region_base & ~VALMASK) != 0)
index e7a8bf629d63184c408d40b8531bb519c7b7fd57..a85fdbbe43570e7e5821b6051f752fd9f23f266c 100644 (file)
@@ -35,8 +35,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "frame.h"
 #include "dispextern.h"
+#include "window.h"
 #include "blockinput.h"
 #include "termhooks.h"
+#include "termchar.h"
 #include "w32heap.h"
 #include "w32term.h"
 
@@ -566,7 +568,7 @@ w32_console_mouse_position (FRAME_PTR *f,
 static void
 mouse_moved_to (int x, int y)
 {
-  /* If we're in the same place, ignore it */
+  /* If we're in the same place, ignore it */
   if (x != movement_pos.X || y != movement_pos.Y)
     {
       SELECTED_FRAME ()->mouse_moved = 1;
@@ -599,14 +601,63 @@ do_mouse_event (MOUSE_EVENT_RECORD *event,
                struct input_event *emacs_ev)
 {
   static DWORD button_state = 0;
+  static Lisp_Object last_mouse_window;
   DWORD but_change, mask;
   int i;
 
   if (event->dwEventFlags == MOUSE_MOVED)
     {
-      /* For movement events we just note that the mouse has moved
-        so that emacs will generate drag events.  */
-      mouse_moved_to (event->dwMousePosition.X, event->dwMousePosition.Y);
+      FRAME_PTR f = SELECTED_FRAME ();
+      Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+      int mx = event->dwMousePosition.X, my = event->dwMousePosition.Y;
+
+      mouse_moved_to (mx, my);
+
+      if (f->mouse_moved)
+       {
+         if (hlinfo->mouse_face_hidden)
+           {
+             hlinfo->mouse_face_hidden = 0;
+             clear_mouse_face (hlinfo);
+           }
+
+         /* Generate SELECT_WINDOW_EVENTs when needed.  */
+         if (!NILP (Vmouse_autoselect_window))
+           {
+             Lisp_Object mouse_window = window_from_coordinates (f, mx, my,
+                                                                 0, 0);
+             /* A window will be selected only when it is not
+                selected now, and the last mouse movement event was
+                not in it.  A minibuffer window will be selected iff
+                it is active.  */
+             if (WINDOWP (mouse_window)
+                 && !EQ (mouse_window, last_mouse_window)
+                 && !EQ (mouse_window, selected_window))
+               {
+                 struct input_event event;
+
+                 EVENT_INIT (event);
+                 event.kind = SELECT_WINDOW_EVENT;
+                 event.frame_or_window = mouse_window;
+                 event.arg = Qnil;
+                 event.timestamp = movement_time;
+                 kbd_buffer_store_event (&event);
+               }
+             last_mouse_window = mouse_window;
+           }
+         else
+           last_mouse_window = Qnil;
+
+         previous_help_echo_string = help_echo_string;
+         help_echo_string = help_echo_object = help_echo_window = Qnil;
+         help_echo_pos = -1;
+         note_mouse_highlight (f, mx, my);
+         /* If the contents of the global variable help_echo has
+            changed (inside note_mouse_highlight), generate a HELP_EVENT.  */
+         if (!NILP (help_echo_string) || !NILP (previous_help_echo_string))
+           gen_help_event (help_echo_string, selected_frame, help_echo_window,
+                           help_echo_object, help_echo_pos);
+       }
       return 0;
     }
 
index 9091cb816276ad7c498b9b3663c676e60b1316b7..24dc9d79192bf683df231c3c1ec247097f6e9d82 100644 (file)
@@ -31,6 +31,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "termhooks.h"
 #include "window.h"
 #include "blockinput.h"
+#include "character.h"
 #include "buffer.h"
 #include "charset.h"
 #include "coding.h"
@@ -48,6 +49,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "dispextern.h"
 
+#include "w32heap.h"   /* for osinfo_cache */
+
 #undef HAVE_DIALOGS /* TODO: Implement native dialogs.  */
 
 #ifndef TRUE
@@ -159,13 +162,12 @@ otherwise it is "Question". */)
     }
   else if (CONSP (position))
     {
-      Lisp_Object tem;
-      tem = Fcar (position);
+      Lisp_Object tem = XCAR (position);
       if (CONSP (tem))
-       window = Fcar (Fcdr (position));
+       window = Fcar (XCDR (position));
       else
        {
-         tem = Fcar (Fcdr (position));  /* EVENT_START (position) */
+         tem = Fcar (XCDR (position));  /* EVENT_START (position) */
          window = Fcar (tem);       /* POSN_WINDOW (tem) */
        }
     }
@@ -381,7 +383,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
 
       struct buffer *prev = current_buffer;
       Lisp_Object buffer;
-      int specpdl_count = SPECPDL_INDEX ();
+      ptrdiff_t specpdl_count = SPECPDL_INDEX ();
       int previous_menu_items_used = f->menu_bar_items_used;
       Lisp_Object *previous_items
        = (Lisp_Object *) alloca (previous_menu_items_used
@@ -1498,8 +1500,11 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
            AppendMenu (menu, fuFlags,
                        item != NULL ? (UINT) item: (UINT) wv->call_data,
                        out_string);
-         /* Don't use Unicode menus in future.  */
-         unicode_append_menu = NULL;
+         /* Don't use Unicode menus in future, unless this is Windows
+            NT or later, where a failure of AppendMenuW does NOT mean
+            Unicode menus are unsupported.  */
+         if (osinfo_cache.dwPlatformId != VER_PLATFORM_WIN32_NT)
+           unicode_append_menu = NULL;
        }
 
       if (unicode_append_menu && (fuFlags & MF_OWNERDRAW))
@@ -1528,11 +1533,7 @@ add_menu_item (HMENU menu, widget_value *wv, HMENU item)
             until it is ready to be displayed, since GC can happen while
             menus are active.  */
          if (!NILP (wv->help))
-#ifdef USE_LISP_UNION_TYPE
-           info.dwItemData = (DWORD) (wv->help).i;
-#else
-           info.dwItemData = (DWORD) (wv->help);
-#endif
+           info.dwItemData = (DWORD) XLI (wv->help);
          if (wv->button_type == BUTTON_TYPE_RADIO)
            {
              /* CheckMenuRadioItem allows us to differentiate TOGGLE and
@@ -1607,12 +1608,7 @@ w32_menu_display_help (HWND owner, HMENU menu, UINT item, UINT flags)
          info.fMask = MIIM_DATA;
          get_menu_item_info (menu, item, FALSE, &info);
 
-#ifdef USE_LISP_UNION_TYPE
-         help = info.dwItemData ? (Lisp_Object) ((EMACS_INT) info.dwItemData)
-                                : Qnil;
-#else
-         help = info.dwItemData ? (Lisp_Object) info.dwItemData : Qnil;
-#endif
+         help = info.dwItemData ? XIL (info.dwItemData) : Qnil;
        }
 
       /* Store the help echo in the keyboard buffer as the X toolkit
index 5bdeba259587ff35847a7a84dd62394a25fbc5c5..afc1b21fdde3cf09b5ef0bac76079801fc312743 100644 (file)
@@ -777,7 +777,7 @@ sys_spawnve (int mode, char *cmdname, char **argv, char **envp)
     }
 
   /* Handle executable names without an executable suffix.  */
-  program = make_string (cmdname, strlen (cmdname));
+  program = build_string (cmdname);
   if (NILP (Ffile_executable_p (program)))
     {
       struct gcpro gcpro1;
@@ -1080,7 +1080,7 @@ extern int proc_buffered_char[];
 
 int
 sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
-           EMACS_TIME *timeout)
+           EMACS_TIME *timeout, void *ignored)
 {
   SELECT_TYPE orfds;
   DWORD timeout_ms, start_time;
@@ -1090,7 +1090,8 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
   HANDLE wait_hnd[MAXDESC + MAX_CHILDREN];
   int fdindex[MAXDESC];   /* mapping from wait handles back to descriptors */
 
-  timeout_ms = timeout ? (timeout->tv_sec * 1000 + timeout->tv_usec / 1000) : INFINITE;
+  timeout_ms =
+    timeout ? (timeout->tv_sec * 1000 + timeout->tv_nsec / 1000000) : INFINITE;
 
   /* If the descriptor sets are NULL but timeout isn't, then just Sleep.  */
   if (rfds == NULL && wfds == NULL && efds == NULL && timeout != NULL)
@@ -1948,8 +1949,12 @@ If LCID (a 16-bit number) is not a valid locale, the result is nil.  */)
       got_full = GetLocaleInfo (XINT (lcid),
                                XINT (longform),
                                full_name, sizeof (full_name));
+      /* GetLocaleInfo's return value includes the terminating null
+        character, when the returned information is a string, whereas
+        make_unibyte_string needs the string length without the
+        terminating null.  */
       if (got_full)
-       return make_unibyte_string (full_name, got_full);
+       return make_unibyte_string (full_name, got_full - 1);
     }
 
   return Qnil;
index ec251cfd8379389458338a32883ad7cda67e1e2a..9c727ae5ab75e386bda1d2d561b740cbdd26edcd 100644 (file)
@@ -110,7 +110,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype)
        }
 
       ok = (keyname
-           && (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
+           && (lpvalue = xmalloc (cbData)) != NULL
            && RegQueryValueEx (hrootkey, keyname, NULL, NULL, lpvalue, &cbData) == ERROR_SUCCESS);
 
       RegCloseKey (hrootkey);
index 699c72b71a85761829a7632c6f99dae0389c051f..1d4a6f41bdd273752a2d21c4f265ffc4a00b97d2 100644 (file)
@@ -216,7 +216,7 @@ convert_to_handle_as_coded (Lisp_Object coding_system)
 
   setup_windows_coding_system (coding_system, &coding);
   coding.dst_bytes = SBYTES (current_text) * 2;
-  coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
+  coding.destination = xmalloc (coding.dst_bytes);
   encode_coding_object (&coding, current_text, 0, 0,
                        SCHARS (current_text), SBYTES (current_text), Qnil);
 
index 8a0e9efc943600651294dd26470f22ca072b6ed0..6f0065de9ebc8ca4e2019c4c9d460cfd807c091b 100644 (file)
@@ -231,6 +231,10 @@ static void my_set_focus (struct frame *, HWND);
 static void my_set_foreground_window (HWND);
 static void my_destroy_window (struct frame *, HWND);
 
+#ifdef GLYPH_DEBUG
+static void x_check_font (struct frame *, struct font *);
+#endif
+
 static Lisp_Object Qvendor_specific_keysyms;
 
 \f
@@ -281,8 +285,7 @@ XChangeGC (void *ignore, XGCValues *gc, unsigned long mask,
 XGCValues *
 XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
 {
-  XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
-  memset (gc, 0, sizeof (XGCValues));
+  XGCValues *gc = xzalloc (sizeof (XGCValues));
 
   XChangeGC (ignore, gc, mask, xgcv);
 
@@ -309,6 +312,94 @@ w32_set_clip_rectangle (HDC hdc, RECT *rect)
     SelectClipRgn (hdc, NULL);
 }
 
+/* Restore clipping rectangle in S */
+static void
+w32_restore_glyph_string_clip (struct glyph_string *s)
+{
+  RECT *r = s->clip;
+  int n = s->num_clips;
+
+  if (n == 1)
+    w32_set_clip_rectangle (s->hdc, r);
+  else if (n > 1)
+    {
+      HRGN clip1 = CreateRectRgnIndirect (r);
+      HRGN clip2 = CreateRectRgnIndirect (r + 1);
+      if (CombineRgn (clip1, clip1, clip2, RGN_OR) != ERROR)
+        SelectClipRgn (s->hdc, clip1);
+      DeleteObject (clip1);
+      DeleteObject (clip2);
+    }
+}
+
+/*
+   Draw a wavy line under S. The wave fills wave_height pixels from y0.
+
+                    x0         wave_length = 2
+                                 --
+                y0   *   *   *   *   *
+                     |* * * * * * * * *
+    wave_height = 3  | *   *   *   *
+
+*/
+
+void
+w32_draw_underwave (struct glyph_string *s, COLORREF color)
+{
+  int wave_height = 2, wave_length = 3;
+  int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax;
+  XRectangle wave_clip, string_clip, final_clip;
+  RECT w32_final_clip, w32_string_clip;
+  HPEN hp, oldhp;
+
+  dx = wave_length;
+  dy = wave_height - 1;
+  x0 = s->x;
+  y0 = s->ybase + 1;
+  width = s->width;
+  xmax = x0 + width;
+
+  /* Find and set clipping rectangle */
+
+  wave_clip = (XRectangle){ x0, y0, width, wave_height };
+  get_glyph_string_clip_rect (s, &w32_string_clip);
+  CONVERT_TO_XRECT (string_clip, w32_string_clip);
+
+  if (!x_intersect_rectangles (&wave_clip, &string_clip, &final_clip))
+    return;
+
+  hp = CreatePen (PS_SOLID, 0, color);
+  oldhp = SelectObject (s->hdc, hp);
+  CONVERT_FROM_XRECT (final_clip, w32_final_clip);
+  w32_set_clip_rectangle (s->hdc, &w32_final_clip);
+
+  /* Draw the waves */
+
+  x1 = x0 - (x0 % dx);
+  x2 = x1 + dx;
+  odd = (x1/dx) % 2;
+  y1 = y2 = y0;
+
+  if (odd)
+    y1 += dy;
+  else
+    y2 += dy;
+
+  MoveToEx (s->hdc, x1, y1, NULL);
+
+  while (x1 <= xmax)
+    {
+      LineTo (s->hdc, x2, y2);
+      x1  = x2, y1 = y2;
+      x2 += dx, y2 = y0 + odd*dy;
+      odd = !odd;
+    }
+
+  /* Restore previous pen and clipping rectangle(s) */
+  w32_restore_glyph_string_clip (s);
+  SelectObject (s->hdc, oldhp);
+  DeleteObject (hp);
+}
 
 /* Draw a hollow rectangle at the specified position.  */
 void
@@ -650,7 +741,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
   struct frame *f;
   int width, height;
 
-  xassert (w);
+  eassert (w);
 
   if (!desired_row->mode_line_p && !w->pseudo_window_p)
     desired_row->redraw_fringe_bitmaps_p = 1;
@@ -994,7 +1085,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
       s->gc = FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc;
     }
 
-  xassert (s->gc != 0);
+  eassert (s->gc != 0);
 }
 
 
@@ -1051,7 +1142,7 @@ x_set_glyph_string_gc (struct glyph_string *s)
     }
 
   /* GC must have been set.  */
-  xassert (s->gc != 0);
+  eassert (s->gc != 0);
 }
 
 
@@ -1468,7 +1559,7 @@ w32_alloc_lighter_color (struct frame *f, COLORREF *color,
   delta /= 256;
 
   /* Change RGB values by specified FACTOR.  Avoid overflow!  */
-  xassert (factor >= 0);
+  eassert (factor >= 0);
   new = PALETTERGB (min (0xff, factor * GetRValue (*color)),
                     min (0xff, factor * GetGValue (*color)),
                     min (0xff, factor * GetBValue (*color)));
@@ -2145,7 +2236,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
 static void
 x_draw_stretch_glyph_string (struct glyph_string *s)
 {
-  xassert (s->first_glyph->type == STRETCH_GLYPH);
+  eassert (s->first_glyph->type == STRETCH_GLYPH);
 
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
@@ -2343,60 +2434,74 @@ x_draw_glyph_string (struct glyph_string *s)
       /* Draw underline.  */
       if (s->face->underline_p)
         {
-          unsigned long thickness, position;
-          int y;
-
-          if (s->prev && s->prev->face->underline_p)
+          if (s->face->underline_type == FACE_UNDER_WAVE)
             {
-              /* We use the same underline style as the previous one.  */
-              thickness = s->prev->underline_thickness;
-              position = s->prev->underline_position;
+              COLORREF color;
+
+              if (s->face->underline_defaulted_p)
+                color = s->gc->foreground;
+              else
+                color = s->face->underline_color;
+
+              w32_draw_underwave (s, color);
             }
-          else
+          else if (s->face->underline_type == FACE_UNDER_LINE)
             {
-              /* Get the underline thickness.  Default is 1 pixel.  */
-              if (s->font && s->font->underline_thickness > 0)
-                thickness = s->font->underline_thickness;
+              unsigned long thickness, position;
+              int y;
+
+              if (s->prev && s->prev->face->underline_p)
+                {
+                  /* We use the same underline style as the previous one.  */
+                  thickness = s->prev->underline_thickness;
+                  position = s->prev->underline_position;
+                }
               else
-                thickness = 1;
-              if (x_underline_at_descent_line)
-                position = (s->height - thickness) - (s->ybase - s->y);
+                {
+                  /* Get the underline thickness.  Default is 1 pixel.  */
+                  if (s->font && s->font->underline_thickness > 0)
+                    thickness = s->font->underline_thickness;
+                  else
+                    thickness = 1;
+                  if (x_underline_at_descent_line)
+                    position = (s->height - thickness) - (s->ybase - s->y);
+                  else
+                    {
+                      /* Get the underline position.  This is the recommended
+                         vertical offset in pixels from the baseline to the top of
+                         the underline.  This is a signed value according to the
+                         specs, and its default is
+
+                         ROUND ((maximum_descent) / 2), with
+                         ROUND (x) = floor (x + 0.5)  */
+
+                      if (x_use_underline_position_properties
+                          && s->font && s->font->underline_position >= 0)
+                        position = s->font->underline_position;
+                      else if (s->font)
+                        position = (s->font->descent + 1) / 2;
+                    }
+                  position = max (position, underline_minimum_offset);
+                }
+              /* Check the sanity of thickness and position.  We should
+                 avoid drawing underline out of the current line area.  */
+              if (s->y + s->height <= s->ybase + position)
+                position = (s->height - 1) - (s->ybase - s->y);
+              if (s->y + s->height < s->ybase + position + thickness)
+                thickness = (s->y + s->height) - (s->ybase + position);
+              s->underline_thickness = thickness;
+              s->underline_position =position;
+              y = s->ybase + position;
+              if (s->face->underline_defaulted_p)
+                {
+                  w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
+                                 y, s->width, 1);
+                }
               else
                 {
-                /* Get the underline position.  This is the recommended
-                   vertical offset in pixels from the baseline to the top of
-                   the underline.  This is a signed value according to the
-                   specs, and its default is
-
-                   ROUND ((maximum_descent) / 2), with
-                   ROUND (x) = floor (x + 0.5)  */
-
-                if (x_use_underline_position_properties
-                    && s->font && s->font->underline_position >= 0)
-                  position = s->font->underline_position;
-                else if (s->font)
-                  position = (s->font->descent + 1) / 2;
+                  w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x,
+                                 y, s->width, 1);
                 }
-             position = max (position, underline_minimum_offset);
-            }
-         /* Check the sanity of thickness and position.  We should
-            avoid drawing underline out of the current line area.  */
-         if (s->y + s->height <= s->ybase + position)
-           position = (s->height - 1) - (s->ybase - s->y);
-         if (s->y + s->height < s->ybase + position + thickness)
-           thickness = (s->y + s->height) - (s->ybase + position);
-         s->underline_thickness = thickness;
-         s->underline_position =position;
-          y = s->ybase + position;
-          if (s->face->underline_defaulted_p)
-            {
-              w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
-                             y, s->width, 1);
-            }
-          else
-            {
-              w32_fill_area (s->f, s->hdc, s->face->underline_color, s->x,
-                             y, s->width, 1);
             }
         }
       /* Draw overline.  */
@@ -3488,6 +3593,12 @@ my_destroy_window (struct frame * f, HWND hwnd)
               (WPARAM) hwnd, 0);
 }
 
+static void
+my_bring_window_to_top (HWND hwnd)
+{
+  SendMessage (hwnd, WM_EMACS_BRINGTOTOP, (WPARAM) hwnd, 0);
+}
+
 /* Create a scroll bar and return the scroll bar vector for it.  W is
    the Emacs window on which to create the scroll bar. TOP, LEFT,
    WIDTH and HEIGHT are the pixel coordinates and dimensions of the
@@ -4122,8 +4233,8 @@ w32_read_socket (struct terminal *terminal, int expected,
          /* Generate a language change event.  */
          f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
 
-         /* lParam contains the input lang ID.  Use it to update our
-            record of the keyboard codepage.  */
+         /* lParam contains the input language ID in its low 16 bits.
+            Use it to update our record of the keyboard codepage.  */
          keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam
                                                          & 0xffff));
 
@@ -4131,7 +4242,7 @@ w32_read_socket (struct terminal *terminal, int expected,
            {
              inev.kind = LANGUAGE_CHANGE_EVENT;
              XSETFRAME (inev.frame_or_window, f);
-             inev.code = msg.msg.wParam;
+             inev.code = keyboard_codepage;
              inev.modifiers = msg.msg.lParam & 0xffff;
            }
          break;
@@ -4332,7 +4443,7 @@ w32_read_socket (struct terminal *terminal, int expected,
 
           /* If the contents of the global variable help_echo_string
              has changed, generate a HELP_EVENT.  */
-#if 0 /* The below is an invalid comparison when USE_LISP_UNION_TYPE.
+#if 0 /* The below is an invalid comparison when CHECK_LISP_OBJECT_TYPE.
         But it was originally changed to this to fix a bug, so I have
         not removed it completely in case the bug is still there.  */
           if (help_echo_string != previous_help_echo_string ||
@@ -5596,24 +5707,27 @@ x_raise_frame (struct frame *f)
       HDWP handle = BeginDeferWindowPos (2);
       if (handle)
        {
-         DeferWindowPos (handle,
-                         FRAME_W32_WINDOW (f),
-                         HWND_TOP,
-                         0, 0, 0, 0,
-                         SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
-
-         DeferWindowPos (handle,
-                         GetForegroundWindow (),
-                         FRAME_W32_WINDOW (f),
-                         0, 0, 0, 0,
-                         SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
-
-         EndDeferWindowPos (handle);
+         handle = DeferWindowPos (handle,
+                                  FRAME_W32_WINDOW (f),
+                                  HWND_TOP,
+                                  0, 0, 0, 0,
+                                  SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
+         if (handle)
+           {
+             handle = DeferWindowPos (handle,
+                                      GetForegroundWindow (),
+                                      FRAME_W32_WINDOW (f),
+                                      0, 0, 0, 0,
+                                      SWP_NOSIZE | SWP_NOMOVE |
+                                      SWP_NOACTIVATE);
+             if (handle)
+               EndDeferWindowPos (handle);
+           }
        }
     }
   else
     {
-      my_set_foreground_window (FRAME_W32_WINDOW (f));
+      my_bring_window_to_top (FRAME_W32_WINDOW (f));
     }
 
   UNBLOCK_INPUT;
@@ -5904,6 +6018,27 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
 #endif
 }
 
+\f
+/***********************************************************************
+                               Fonts
+ ***********************************************************************/
+
+#ifdef GLYPH_DEBUG
+
+/* Check that FONT is valid on frame F.  It is if it can be found in F's
+   font table.  */
+
+static void
+x_check_font (struct frame *f, struct font *font)
+{
+  eassert (font != NULL && ! NILP (font->props[FONT_TYPE_INDEX]));
+  if (font->driver->check)
+    eassert (font->driver->check (f, font) == 0);
+}
+
+#endif /* GLYPH_DEBUG */
+
+
 \f
 /***********************************************************************
                            Initialization
@@ -5924,10 +6059,8 @@ w32_initialize_display_info (Lisp_Object display_name)
                                  w32_display_name_list);
   dpyinfo->name_list_element = XCAR (w32_display_name_list);
 
-  dpyinfo->w32_id_name
-    = (char *) xmalloc (SCHARS (Vinvocation_name)
-                       + SCHARS (Vsystem_name)
-                       + 2);
+  dpyinfo->w32_id_name = xmalloc (SCHARS (Vinvocation_name)
+                                 + SCHARS (Vsystem_name) + 2);
   sprintf (dpyinfo->w32_id_name, "%s@%s",
           SDATA (Vinvocation_name), SDATA (Vsystem_name));
 
@@ -6092,7 +6225,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
   /* We don't yet support separate terminals on W32, so don't try to share
      keyboards between virtual terminals that are on the same physical
      terminal like X does.  */
-  terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+  terminal->kboard = xmalloc (sizeof (KBOARD));
   init_kboard (terminal->kboard);
   KVAR (terminal->kboard, Vwindow_system) = intern ("w32");
   terminal->kboard->next_kboard = all_kboards;
@@ -6144,7 +6277,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
   terminal = w32_create_terminal (dpyinfo);
 
   /* Set the name of the terminal. */
-  terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
+  terminal->name = xmalloc (SBYTES (display_name) + 1);
   strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
   terminal->name[SBYTES (display_name)] = 0;
 
@@ -6411,7 +6544,7 @@ the cursor have no effect.  */);
      from cus-start.el and other places, like "M-x set-variable".  */
   DEFVAR_BOOL ("x-use-underline-position-properties",
               x_use_underline_position_properties,
-     doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
+     doc: /* Non-nil means make use of UNDERLINE_POSITION font properties.
 A value of nil means ignore them.  If you encounter fonts with bogus
 UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
 to 4.1, set this to nil.  You can also use `underline-minimum-offset'
@@ -6421,7 +6554,7 @@ sizes.  */);
 
   DEFVAR_BOOL ("x-underline-at-descent-line",
               x_underline_at_descent_line,
-     doc: /* *Non-nil means to draw the underline at the same place as the descent line.
+     doc: /* Non-nil means to draw the underline at the same place as the descent line.
 A value of nil means to draw the underline according to the value of the
 variable `x-use-underline-position-properties', which is usually at the
 baseline level.  The default value is nil.  */);
index 4528bbd5c0a4448bfee13e9a6abad8d9c22a9b6d..4fdf560dabc134ff280fddaaba1fd1ae8ebd7589 100644 (file)
@@ -576,7 +576,8 @@ do { \
 #define WM_EMACS_HIDE_CARET            (WM_EMACS_START + 18)
 #define WM_EMACS_SETCURSOR             (WM_EMACS_START + 19)
 #define WM_EMACS_PAINT                 (WM_EMACS_START + 20)
-#define WM_EMACS_END                   (WM_EMACS_START + 21)
+#define WM_EMACS_BRINGTOTOP            (WM_EMACS_START + 21)
+#define WM_EMACS_END                   (WM_EMACS_START + 22)
 
 #define WND_FONTWIDTH_INDEX    (0)
 #define WND_LINEHEIGHT_INDEX   (4)
@@ -687,9 +688,6 @@ struct face;
 XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *);
 struct frame * check_x_frame (Lisp_Object);
 
-EXFUN (Fx_display_color_p, 1);
-EXFUN (Fx_display_grayscale_p, 1);
-
 typedef DWORD (WINAPI * ClipboardSequence_Proc) (void);
 typedef BOOL (WINAPI * AppendMenuW_Proc) (
     IN HMENU,
index 5e5c8e88b2beadcda24c1c8f367a1789193954a4..06f7b1bd192f26d8bf4467f147cd351ce392579a 100644 (file)
@@ -231,7 +231,7 @@ uniscribe_shape (Lisp_Object lgstring)
   /* First we need to break up the glyph string into runs of glyphs that
      can be treated together.  First try a single run.  */
   max_items = 2;
-  items = (SCRIPT_ITEM *) xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1);
+  items = xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1);
 
   while ((result = ScriptItemize (chars, nchars, max_items, NULL, NULL,
                                  items, &nitems)) == E_OUTOFMEMORY)
index 0cb1013b9718cd79e74e427e3042935f46bc7b1a..b94c30f4e9c2746ba59535d9644d07f62c5143cf 100644 (file)
@@ -429,25 +429,15 @@ set_frame_size (EmacsFrame ew)
       {
        /* the tricky things with the sign is to make sure that
           -0 is printed -0. */
-       int len;
-       char *tem;
        sprintf (shell_position, "=%c%d%c%d",
                 flags & XNegative ? '-' : '+', x < 0 ? -x : x,
                 flags & YNegative ? '-' : '+', y < 0 ? -y : y);
-       len = strlen (shell_position) + 1;
-       tem = (char *) xmalloc (len);
-       strncpy (tem, shell_position, len);
-       XtVaSetValues (wmshell, XtNgeometry, tem, NULL);
+       XtVaSetValues (wmshell, XtNgeometry, xstrdup (shell_position), NULL);
       }
     else if (flags & (WidthValue | HeightValue))
       {
-       int len;
-       char *tem;
        sprintf (shell_position, "=%dx%d", pixel_width, pixel_height);
-       len = strlen (shell_position) + 1;
-       tem = (char *) xmalloc (len);
-       strncpy (tem, shell_position, len);
-       XtVaSetValues (wmshell, XtNgeometry, tem, NULL);
+       XtVaSetValues (wmshell, XtNgeometry, xstrdup (shell_position), NULL);
       }
 
     /* If the geometry spec we're using has W/H components, mark the size
index f93f58f9b72dd99fe6415ed667a217a491de0c41..7fd66057ad27c0755ed7edbc29e58c80d4d14659 100644 (file)
@@ -23,6 +23,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 #include "keyboard.h"
 #include "keymap.h"
@@ -63,7 +64,7 @@ static int displayed_window_lines (struct window *);
 static struct window *decode_window (Lisp_Object);
 static int count_windows (struct window *);
 static int get_leaf_windows (struct window *, struct window **, int);
-static void window_scroll (Lisp_Object, int, int, int);
+static void window_scroll (Lisp_Object, EMACS_INT, int, int);
 static void window_scroll_pixel_based (Lisp_Object, int, int, int);
 static void window_scroll_line_based (Lisp_Object, int, int, int);
 static int freeze_window_start (struct window *, void *);
@@ -127,8 +128,8 @@ static int window_scroll_pixel_based_preserve_x;
 static int window_scroll_pixel_based_preserve_y;
 
 /* Same for window_scroll_line_based.  */
-static int window_scroll_preserve_hpos;
-static int window_scroll_preserve_vpos;
+static EMACS_INT window_scroll_preserve_hpos;
+static EMACS_INT window_scroll_preserve_vpos;
 \f
 static struct window *
 decode_window (register Lisp_Object window)
@@ -330,8 +331,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
 
   if (NILP (norecord))
     {
-      ++window_select_count;
-      XSETFASTINT (w->use_time, window_select_count);
+      w->use_time = ++window_select_count;
       record_buffer (w->buffer);
     }
 
@@ -378,7 +378,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
      redisplay_window has altered point after scrolling,
      because it makes the change only in the window.  */
   {
-    register EMACS_INT new_point = marker_position (w->pointm);
+    register ptrdiff_t new_point = marker_position (w->pointm);
     if (new_point < BEGV)
       SET_PT (BEGV);
     else if (new_point > ZV)
@@ -498,7 +498,7 @@ one.  The window with the lowest use time is the least recently
 selected one.  */)
   (Lisp_Object window)
 {
-  return decode_window (window)->use_time;
+  return make_number (decode_window (window)->use_time);
 }
 \f
 DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0,
@@ -667,30 +667,45 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
 WINDOW must be a live window and defaults to the selected one.  */)
   (Lisp_Object window)
 {
-  return decode_window (window)->hscroll;
+  return make_number (decode_window (window)->hscroll);
+}
+
+/* Set W's horizontal scroll amount to HSCROLL clipped to a reasonable
+   range, returning the new amount as a fixnum.  */
+static Lisp_Object
+set_window_hscroll (struct window *w, EMACS_INT hscroll)
+{
+  /* Horizontal scrolling has problems with large scroll amounts.
+     It's too slow with long lines, and even with small lines the
+     display can be messed up.  For now, though, impose only the limits
+     required by the internal representation: horizontal scrolling must
+     fit in fixnum (since it's visible to Elisp) and into ptrdiff_t
+     (since it's stored in a ptrdiff_t).  */
+  ptrdiff_t hscroll_max = min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX);
+  ptrdiff_t new_hscroll = clip_to_bounds (0, hscroll, hscroll_max);
+
+  /* Prevent redisplay shortcuts when changing the hscroll.  */
+  if (w->hscroll != new_hscroll)
+    XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
+
+  w->hscroll = new_hscroll;
+  return make_number (new_hscroll);
 }
 
 DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
        doc: /* Set number of columns WINDOW is scrolled from left margin to NCOL.
 If WINDOW is nil, the selected window is used.
-Return NCOL.  NCOL should be zero or positive.
+Clip the number to a reasonable value if out of range.
+Return the new number.  NCOL should be zero or positive.
 
 Note that if `automatic-hscrolling' is non-nil, you cannot scroll the
 window so that the location of point moves off-window.  */)
   (Lisp_Object window, Lisp_Object ncol)
 {
   struct window *w = decode_window (window);
-  int hscroll;
 
   CHECK_NUMBER (ncol);
-  hscroll = max (0, XINT (ncol));
-
-  /* Prevent redisplay shortcuts when changing the hscroll.  */
-  if (XINT (w->hscroll) != hscroll)
-    XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
-
-  w->hscroll = make_number (hscroll);
-  return ncol;
+  return set_window_hscroll (w, XINT (ncol));
 }
 
 DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
@@ -1313,8 +1328,8 @@ if it isn't already recorded.  */)
 
   if (! NILP (update)
       && ! (! NILP (w->window_end_valid)
-           && XFASTINT (w->last_modified) >= BUF_MODIFF (b)
-           && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b))
+           && w->last_modified >= BUF_MODIFF (b)
+           && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b))
       && !noninteractive)
     {
       struct text_pos startp;
@@ -1393,12 +1408,12 @@ overriding motion of point in order to display at this exact start.  */)
   CHECK_NUMBER_COERCE_MARKER (pos);
   set_marker_restricted (w->start, pos, w->buffer);
   /* this is not right, but much easier than doing what is right. */
-  w->start_at_line_beg = Qnil;
+  w->start_at_line_beg = 0;
   if (NILP (noforce))
-    w->force_start = Qt;
-  w->update_mode_line = Qt;
-  XSETFASTINT (w->last_modified, 0);
-  XSETFASTINT (w->last_overlay_modified, 0);
+    w->force_start = 1;
+  w->update_mode_line = 1;
+  w->last_modified = 0;
+  w->last_overlay_modified = 0;
   if (!EQ (window, selected_window))
     windows_or_buffers_changed++;
 
@@ -1495,7 +1510,8 @@ Return nil if window display is not up-to-date.  In that case, use
   register struct window *w;
   register struct buffer *b;
   struct glyph_row *row, *end_row;
-  int max_y, crop, i, n;
+  int max_y, crop, i;
+  EMACS_INT n;
 
   w = decode_window (window);
 
@@ -1509,8 +1525,8 @@ Return nil if window display is not up-to-date.  In that case, use
   if (NILP (w->window_end_valid)
       || current_buffer->clip_changed
       || current_buffer->prevent_redisplay_optimizations_p
-      || XFASTINT (w->last_modified) < BUF_MODIFF (b)
-      || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b))
+      || w->last_modified < BUF_MODIFF (b)
+      || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b))
     return Qnil;
 
   if (NILP (line))
@@ -2033,7 +2049,7 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
     candidate_p = 1;
   else if (NILP (all_frames))
     {
-      xassert (WINDOWP (owindow));
+      eassert (WINDOWP (owindow));
       candidate_p = EQ (w->frame, XWINDOW (owindow)->frame);
     }
   else if (EQ (all_frames, Qvisible))
@@ -2471,7 +2487,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
            if (EQ (w->buffer, obj))
              {
                mark_window_display_accurate (window, 0);
-               w->update_mode_line = Qt;
+               w->update_mode_line = 1;
                XBUFFER (obj)->prevent_redisplay_optimizations_p = 1;
                ++update_mode_lines;
                best_window = window;
@@ -2563,9 +2579,8 @@ window-start value is reasonable when this function is called.  */)
   struct window *w, *r, *s;
   struct frame *f;
   Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta;
-  EMACS_INT startpos IF_LINT (= 0);
+  ptrdiff_t startpos IF_LINT (= 0);
   int top IF_LINT (= 0), new_top, resize_failed;
-  Mouse_HLInfo *hlinfo;
 
   w = decode_any_window (window);
   XSETWINDOW (window, w);
@@ -2646,19 +2661,23 @@ window-start value is reasonable when this function is called.  */)
     }
 
   BLOCK_INPUT;
-  hlinfo = MOUSE_HL_INFO (f);
-  /* We are going to free the glyph matrices of WINDOW, and with that
-     we might lose any information about glyph rows that have some of
-     their glyphs highlighted in mouse face.  (These rows are marked
-     with a non-zero mouse_face_p flag.)  If WINDOW indeed has some
-     glyphs highlighted in mouse face, signal to frame's up-to-date
-     hook that mouse highlight was overwritten, so that it will
-     arrange for redisplaying the highlight.  */
-  if (EQ (hlinfo->mouse_face_window, window))
+  if (!FRAME_INITIAL_P (f))
     {
-      hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
-      hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
-      hlinfo->mouse_face_window = Qnil;
+        Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
+      /* We are going to free the glyph matrices of WINDOW, and with
+        that we might lose any information about glyph rows that have
+        some of their glyphs highlighted in mouse face.  (These rows
+        are marked with a non-zero mouse_face_p flag.)  If WINDOW
+        indeed has some glyphs highlighted in mouse face, signal to
+        frame's up-to-date hook that mouse highlight was overwritten,
+        so that it will arrange for redisplaying the highlight.  */
+      if (EQ (hlinfo->mouse_face_window, window))
+       {
+         hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+         hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+         hlinfo->mouse_face_window = Qnil;
+       }
     }
   free_window_matrices (r);
 
@@ -2770,12 +2789,11 @@ window-start value is reasonable when this function is called.  */)
 
          set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos);
          w->window_end_valid = Qnil;
-         w->start_at_line_beg = ((pos.bytepos == BEGV_BYTE
-                                  || FETCH_BYTE (pos.bytepos - 1) == '\n') ? Qt
-                                 : Qnil);
+         w->start_at_line_beg = (pos.bytepos == BEGV_BYTE
+                                   || FETCH_BYTE (pos.bytepos - 1) == '\n');
          /* We need to do this, so that the window-scroll-functions
             get called.  */
-         w->optional_new_start = Qt;
+         w->optional_new_start = 1;
 
          set_buffer_internal (obuf);
        }
@@ -2870,13 +2888,6 @@ adjust_window_margins (struct window *w)
   return 1;
 }
 \f
-static Lisp_Object Fset_window_margins (Lisp_Object, Lisp_Object, Lisp_Object);
-static Lisp_Object Fset_window_fringes (Lisp_Object, Lisp_Object, Lisp_Object,
-                                       Lisp_Object);
-static Lisp_Object Fset_window_scroll_bars (Lisp_Object, Lisp_Object,
-                                           Lisp_Object, Lisp_Object);
-static Lisp_Object Fset_window_vscroll (Lisp_Object, Lisp_Object, Lisp_Object);
-
 /* The following three routines are needed for running a window's
    configuration change hook.  */
 static void
@@ -2904,7 +2915,7 @@ select_frame_norecord (Lisp_Object frame)
 void
 run_window_configuration_change_hook (struct frame *f)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object frame, global_wcch
     = Fdefault_value (Qwindow_configuration_change_hook);
   XSETFRAME (frame, f);
@@ -2935,7 +2946,7 @@ run_window_configuration_change_hook (struct frame *f)
        if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook,
                                      buffer)))
          {
-           int inner_count = SPECPDL_INDEX ();
+           ptrdiff_t inner_count = SPECPDL_INDEX ();
            record_unwind_protect (select_window_norecord, Fselected_window ());
            select_window_norecord (window);
            run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook,
@@ -2970,7 +2981,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
 {
   struct window *w = XWINDOW (window);
   struct buffer *b = XBUFFER (buffer);
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   int samebuf = EQ (buffer, w->buffer);
 
   w->buffer = buffer;
@@ -2999,16 +3010,16 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
         Resetting hscroll and vscroll here is problematic for things like
         image-mode and doc-view-mode since it resets the image's position
         whenever we resize the frame.  */
-      w->hscroll = w->min_hscroll = make_number (0);
+      w->hscroll = w->min_hscroll = 0;
       w->vscroll = 0;
       set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b));
       set_marker_restricted (w->start,
                             make_number (b->last_window_start),
                             buffer);
-      w->start_at_line_beg = Qnil;
-      w->force_start = Qnil;
-      XSETFASTINT (w->last_modified, 0);
-      XSETFASTINT (w->last_overlay_modified, 0);
+      w->start_at_line_beg = 0;
+      w->force_start = 0;
+      w->last_modified = 0;
+      w->last_overlay_modified = 0;
     }
   /* Maybe we could move this into the `if' but it's not obviously safe and
      I doubt it's worth the trouble.  */
@@ -3142,7 +3153,7 @@ displaying that buffer.  */)
     {
       struct window *w = XWINDOW (object);
       mark_window_display_accurate (object, 0);
-      w->update_mode_line = Qt;
+      w->update_mode_line = 1;
       if (BUFFERP (w->buffer))
        XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
       ++update_mode_lines;
@@ -3193,15 +3204,15 @@ temp_output_buffer_show (register Lisp_Object buf)
        Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
       Vminibuf_scroll_window = window;
       w = XWINDOW (window);
-      XSETFASTINT (w->hscroll, 0);
-      XSETFASTINT (w->min_hscroll, 0);
+      w->hscroll = 0;
+      w->min_hscroll = 0;
       set_marker_restricted_both (w->start, buf, BEG, BEG);
       set_marker_restricted_both (w->pointm, buf, BEG, BEG);
 
       /* Run temp-buffer-show-hook, with the chosen window selected
         and its buffer current.  */
       {
-        int count = SPECPDL_INDEX ();
+        ptrdiff_t count = SPECPDL_INDEX ();
         Lisp_Object prev_window, prev_buffer;
         prev_window = selected_window;
         XSETBUFFER (prev_buffer, old);
@@ -3238,17 +3249,15 @@ make_parent_window (Lisp_Object window, int horflag)
 {
   Lisp_Object parent;
   register struct window *o, *p;
-  int i;
 
   o = XWINDOW (window);
   p = allocate_window ();
-  for (i = 0; i < VECSIZE (struct window); ++i)
-    ((struct Lisp_Vector *) p)->contents[i]
-      = ((struct Lisp_Vector *) o)->contents[i];
+  memcpy ((char *) p + sizeof (struct vectorlike_header),
+         (char *) o + sizeof (struct vectorlike_header),
+         sizeof (Lisp_Object) * VECSIZE (struct window));
   XSETWINDOW (parent, p);
 
-  ++sequence_number;
-  XSETFASTINT (p->sequence_number, sequence_number);
+  p->sequence_number = ++sequence_number;
 
   replace_window (window, parent, 1);
 
@@ -3273,9 +3282,8 @@ make_window (void)
   register struct window *w;
 
   w = allocate_window ();
-  /* Initialize all Lisp data.  */
-  w->frame = w->mini_p = Qnil;
-  w->next = w->prev = w->hchild = w->vchild = w->parent = Qnil;
+  /* Initialize Lisp data.  Note that allocate_window initializes all
+     Lisp data to nil, so do it only for slots which should not be nil.  */
   XSETFASTINT (w->left_col, 0);
   XSETFASTINT (w->top_line, 0);
   XSETFASTINT (w->total_lines, 0);
@@ -3284,46 +3292,19 @@ make_window (void)
   w->normal_cols = make_float (1.0);
   XSETFASTINT (w->new_total, 0);
   XSETFASTINT (w->new_normal, 0);
-  w->buffer = Qnil;
   w->start = Fmake_marker ();
   w->pointm = Fmake_marker ();
-  w->force_start = w->optional_new_start = Qnil;
-  XSETFASTINT (w->hscroll, 0);
-  XSETFASTINT (w->min_hscroll, 0);
-  XSETFASTINT (w->use_time, 0);
-  ++sequence_number;
-  XSETFASTINT (w->sequence_number, sequence_number);
-  w->temslot = w->last_modified = w->last_overlay_modified = Qnil;
-  XSETFASTINT (w->last_point, 0);
-  w->last_had_star = w->vertical_scroll_bar = Qnil;
-  w->left_margin_cols = w->right_margin_cols = Qnil;
-  w->left_fringe_width = w->right_fringe_width = Qnil;
-  w->fringes_outside_margins = Qnil;
-  w->scroll_bar_width = Qnil;
   w->vertical_scroll_bar_type = Qt;
-  w->last_mark_x = w->last_mark_y = Qnil;
   XSETFASTINT (w->window_end_pos, 0);
   XSETFASTINT (w->window_end_vpos, 0);
-  w->window_end_valid = w->update_mode_line = Qnil;
-  w->start_at_line_beg = w->display_table = w->dedicated = Qnil;
-  w->base_line_number = w->base_line_pos = w->region_showing = Qnil;
-  w->column_number_displayed = w->redisplay_end_trigger = Qnil;
-  w->combination_limit = w->window_parameters = Qnil;
-  w->prev_buffers = w->next_buffers = Qnil;
-  /* Initialize non-Lisp data.  */
-  w->desired_matrix = w->current_matrix = 0;
+
+  /* Initialize non-Lisp data.  Note that allocate_window zeroes out all
+     non-Lisp data, so do it only for slots which should not be zero.  */
   w->nrows_scale_factor = w->ncols_scale_factor = 1;
-  memset (&w->cursor, 0, sizeof (w->cursor));
-  memset (&w->last_cursor, 0, sizeof (w->last_cursor));
-  memset (&w->phys_cursor, 0, sizeof (w->phys_cursor));
   w->phys_cursor_type = -1;
   w->phys_cursor_width = -1;
-  w->phys_cursor_on_p = 0;
-  w->last_cursor_off_p = w->cursor_off_p = 0;
-  w->must_be_updated_p = 0;
-  w->pseudo_window_p = 0;
-  w->frozen_window_start_p = 0;
-  w->vscroll = 0;
+  w->sequence_number = ++sequence_number;
+
   /* Reset window_list.  */
   Vwindow_list = Qnil;
   /* Return window.  */
@@ -3512,8 +3493,8 @@ window_resize_apply (struct window *w, int horflag)
     }
 
   /* Clear out some redisplay caches.  */
-  XSETFASTINT (w->last_modified, 0);
-  XSETFASTINT (w->last_overlay_modified, 0);
+  w->last_modified = 0;
+  w->last_overlay_modified = 0;
 }
 
 
@@ -3901,7 +3882,6 @@ Signal an error when WINDOW is the only window on its frame.  */)
       && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines)))
     /* We can delete WINDOW now.  */
     {
-      Mouse_HLInfo *hlinfo;
 
       /* Block input.  */
       BLOCK_INPUT;
@@ -3909,9 +3889,13 @@ Signal an error when WINDOW is the only window on its frame.  */)
 
       /* If this window is referred to by the dpyinfo's mouse
         highlight, invalidate that slot to be safe (Bug#9904).  */
-      hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
-      if (EQ (hlinfo->mouse_face_window, window))
-       hlinfo->mouse_face_window = Qnil;
+      if (!FRAME_INITIAL_P (f))
+       {
+         Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
+
+         if (EQ (hlinfo->mouse_face_window, window))
+           hlinfo->mouse_face_window = Qnil;
+       }
 
       windows_or_buffers_changed++;
       Vwindow_list = Qnil;
@@ -4027,8 +4011,8 @@ grow_mini_window (struct window *w, int delta)
   struct window *r;
   Lisp_Object root, value;
 
-  xassert (MINI_WINDOW_P (w));
-  xassert (delta >= 0);
+  eassert (MINI_WINDOW_P (w));
+  eassert (delta >= 0);
 
   root = FRAME_ROOT_WINDOW (f);
   r = XWINDOW (root);
@@ -4042,8 +4026,8 @@ grow_mini_window (struct window *w, int delta)
       /* Grow the mini-window.  */
       XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
       XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value));
-      XSETFASTINT (w->last_modified, 0);
-      XSETFASTINT (w->last_overlay_modified, 0);
+      w->last_modified = 0;
+      w->last_overlay_modified = 0;
 
       adjust_glyphs (f);
       UNBLOCK_INPUT;
@@ -4060,7 +4044,7 @@ shrink_mini_window (struct window *w)
   Lisp_Object root, value;
   EMACS_INT size;
 
-  xassert (MINI_WINDOW_P (w));
+  eassert (MINI_WINDOW_P (w));
 
   size = XINT (w->total_lines);
   if (size > 1)
@@ -4078,8 +4062,8 @@ shrink_mini_window (struct window *w)
          XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
          XSETFASTINT (w->total_lines, 1);
 
-         XSETFASTINT (w->last_modified, 0);
-         XSETFASTINT (w->last_overlay_modified, 0);
+         w->last_modified = 0;
+         w->last_overlay_modified = 0;
 
          adjust_glyphs (f);
          UNBLOCK_INPUT;
@@ -4189,9 +4173,10 @@ window_internal_height (struct window *w)
    respectively.  */
 
 static void
-window_scroll (Lisp_Object window, int n, int whole, int noerror)
+window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror)
 {
   immediate_quit = 1;
+  n = clip_to_bounds (INT_MIN, n, INT_MAX);
 
   /* If we must, use the pixel-based version which is much slower than
      the line-based one but can handle varying line heights.  */
@@ -4292,7 +4277,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
              /* Maybe modify window start instead of scrolling.  */
              if (rbot > 0 || w->vscroll < 0)
                {
-                 EMACS_INT spos;
+                 ptrdiff_t spos;
 
                  Fset_window_vscroll (window, make_number (0), Qt);
                  /* If there are other text lines above the current row,
@@ -4303,13 +4288,13 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
                    spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV);
                  set_marker_restricted (w->start, make_number (spos),
                                         w->buffer);
-                 w->start_at_line_beg = Qt;
-                 w->update_mode_line = Qt;
-                 XSETFASTINT (w->last_modified, 0);
-                 XSETFASTINT (w->last_overlay_modified, 0);
+                 w->start_at_line_beg = 1;
+                 w->update_mode_line = 1;
+                 w->last_modified = 0;
+                 w->last_overlay_modified = 0;
                  /* Set force_start so that redisplay_window will run the
                     window-scroll-functions.  */
-                 w->force_start = Qt;
+                 w->force_start = 1;
                  return;
                }
            }
@@ -4347,7 +4332,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
   start_display (&it, w, start);
   if (whole)
     {
-      EMACS_INT start_pos = IT_CHARPOS (it);
+      ptrdiff_t start_pos = IT_CHARPOS (it);
       int dy = WINDOW_FRAME_LINE_HEIGHT (w);
       dy = max ((window_box_height (w)
                 - next_screen_context_lines * dy),
@@ -4434,8 +4419,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
 
   if (! vscrolled)
     {
-      EMACS_INT pos = IT_CHARPOS (it);
-      EMACS_INT bytepos;
+      ptrdiff_t pos = IT_CHARPOS (it);
+      ptrdiff_t bytepos;
 
       /* If in the middle of a multi-glyph character move forward to
         the next character.  */
@@ -4449,14 +4434,13 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
       set_marker_restricted (w->start, make_number (pos),
                             w->buffer);
       bytepos = XMARKER (w->start)->bytepos;
-      w->start_at_line_beg = ((pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n')
-                             ? Qt : Qnil);
-      w->update_mode_line = Qt;
-      XSETFASTINT (w->last_modified, 0);
-      XSETFASTINT (w->last_overlay_modified, 0);
+      w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
+      w->update_mode_line = 1;
+      w->last_modified = 0;
+      w->last_overlay_modified = 0;
       /* Set force_start so that redisplay_window will run the
         window-scroll-functions.  */
-      w->force_start = Qt;
+      w->force_start = 1;
     }
 
   /* The rest of this function uses current_y in a nonstandard way,
@@ -4505,7 +4489,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
     }
   else if (n < 0)
     {
-      EMACS_INT charpos, bytepos;
+      ptrdiff_t charpos, bytepos;
       int partial_p;
 
       /* Save our position, for the
@@ -4582,12 +4566,12 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
      in `grep-mode-font-lock-keywords').  So we use a marker to record
      the old point position, to prevent crashes in SET_PT_BOTH.  */
   Lisp_Object opoint_marker = Fpoint_marker ();
-  register EMACS_INT pos, pos_byte;
+  register ptrdiff_t pos, pos_byte;
   register int ht = window_internal_height (w);
   register Lisp_Object tem;
   int lose;
   Lisp_Object bolp;
-  EMACS_INT startpos;
+  ptrdiff_t startpos;
   Lisp_Object original_pos = Qnil;
 
   /* If scrolling screen-fulls, compute the number of lines to
@@ -4606,10 +4590,10 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
          struct position posit
            = *compute_motion (startpos, 0, 0, 0,
                               PT, ht, 0,
-                              -1, XINT (w->hscroll),
+                              -1, w->hscroll,
                               0, w);
          window_scroll_preserve_vpos = posit.vpos;
-         window_scroll_preserve_hpos = posit.hpos + XINT (w->hscroll);
+         window_scroll_preserve_hpos = posit.hpos + w->hscroll;
        }
 
       original_pos = Fcons (make_number (window_scroll_preserve_hpos),
@@ -4649,13 +4633,13 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
        max (0, min (scroll_margin, XINT (w->total_lines) / 4));
 
       set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
-      w->start_at_line_beg = bolp;
-      w->update_mode_line = Qt;
-      XSETFASTINT (w->last_modified, 0);
-      XSETFASTINT (w->last_overlay_modified, 0);
+      w->start_at_line_beg = !NILP (bolp);
+      w->update_mode_line = 1;
+      w->last_modified = 0;
+      w->last_overlay_modified = 0;
       /* Set force_start so that redisplay_window will run
         the window-scroll-functions.  */
-      w->force_start = Qt;
+      w->force_start = 1;
 
       if (!NILP (Vscroll_preserve_screen_position)
          && (whole || !EQ (Vscroll_preserve_screen_position, Qt)))
@@ -4736,9 +4720,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
 static void
 scroll_command (Lisp_Object n, int direction)
 {
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
-  xassert (eabs (direction) == 1);
+  eassert (eabs (direction) == 1);
 
   /* If selected window's buffer isn't current, make it current for
      the moment.  But don't screw up if window_scroll gets an error.  */
@@ -4851,7 +4835,7 @@ specifies the window to scroll.  This takes precedence over
 {
   Lisp_Object window;
   struct window *w;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   window = Fother_window_for_scrolling ();
   w = XWINDOW (window);
@@ -4870,7 +4854,7 @@ specifies the window to scroll.  This takes precedence over
   else
     {
       if (CONSP (arg))
-       arg = Fcar (arg);
+       arg = XCAR (arg);
       CHECK_NUMBER (arg);
       window_scroll (window, XINT (arg), 0, 1);
     }
@@ -4892,17 +4876,11 @@ will not scroll a window to a column less than the value returned
 by this function.  This happens in an interactive call.  */)
   (register Lisp_Object arg, Lisp_Object set_minimum)
 {
-  Lisp_Object result;
-  int hscroll;
   struct window *w = XWINDOW (selected_window);
-
-  if (NILP (arg))
-    XSETFASTINT (arg, window_body_cols (w) - 2);
-  else
-    arg = Fprefix_numeric_value (arg);
-
-  hscroll = XINT (w->hscroll) + XINT (arg);
-  result = Fset_window_hscroll (selected_window, make_number (hscroll));
+  EMACS_INT requested_arg = (NILP (arg)
+                            ? window_body_cols (w) - 2
+                            : XINT (Fprefix_numeric_value (arg)));
+  Lisp_Object result = set_window_hscroll (w, w->hscroll + requested_arg);
 
   if (!NILP (set_minimum))
     w->min_hscroll = w->hscroll;
@@ -4921,17 +4899,11 @@ will not scroll a window to a column less than the value returned
 by this function.  This happens in an interactive call.  */)
   (register Lisp_Object arg, Lisp_Object set_minimum)
 {
-  Lisp_Object result;
-  int hscroll;
   struct window *w = XWINDOW (selected_window);
-
-  if (NILP (arg))
-    XSETFASTINT (arg, window_body_cols (w) - 2);
-  else
-    arg = Fprefix_numeric_value (arg);
-
-  hscroll = XINT (w->hscroll) - XINT (arg);
-  result = Fset_window_hscroll (selected_window, make_number (hscroll));
+  EMACS_INT requested_arg = (NILP (arg)
+                            ? window_body_cols (w) - 2
+                            : XINT (Fprefix_numeric_value (arg)));
+  Lisp_Object result = set_window_hscroll (w, w->hscroll - requested_arg);
 
   if (!NILP (set_minimum))
     w->min_hscroll = w->hscroll;
@@ -5033,7 +5005,7 @@ and redisplay normally--don't erase and redraw the frame.  */)
   struct buffer *buf = XBUFFER (w->buffer);
   struct buffer *obuf = current_buffer;
   int center_p = 0;
-  EMACS_INT charpos, bytepos;
+  ptrdiff_t charpos, bytepos;
   EMACS_INT iarg IF_LINT (= 0);
   int this_scroll_margin;
 
@@ -5098,7 +5070,7 @@ and redisplay normally--don't erase and redraw the frame.  */)
        {
          struct it it;
          struct text_pos pt;
-         int nlines = min (INT_MAX, -iarg);
+         ptrdiff_t nlines = min (PTRDIFF_MAX, -iarg);
          int extra_line_spacing;
          int h = window_box_height (w);
          void *itdata = bidi_shelve_cache ();
@@ -5199,12 +5171,10 @@ and redisplay normally--don't erase and redraw the frame.  */)
   set_marker_both (w->start, w->buffer, charpos, bytepos);
   w->window_end_valid = Qnil;
 
-  w->optional_new_start = Qt;
+  w->optional_new_start = 1;
 
-  if (bytepos == BEGV_BYTE || FETCH_BYTE (bytepos - 1) == '\n')
-    w->start_at_line_beg = Qt;
-  else
-    w->start_at_line_beg = Qnil;
+  w->start_at_line_beg = (bytepos == BEGV_BYTE ||
+                         FETCH_BYTE (bytepos - 1) == '\n');
 
   set_buffer_internal (obuf);
   return Qnil;
@@ -5255,8 +5225,8 @@ zero means top of window, negative means relative to bottom of window.  */)
       int height = window_internal_height (w);
       Fvertical_motion (make_number (- (height / 2)), window);
       set_marker_both (w->start, w->buffer, PT, PT_BYTE);
-      w->start_at_line_beg = Fbolp ();
-      w->force_start = Qt;
+      w->start_at_line_beg = !NILP (Fbolp ());
+      w->force_start = 1;
     }
   else
     Fgoto_char (w->start);
@@ -5382,7 +5352,7 @@ the return value is nil.  Otherwise the value is t.  */)
   Lisp_Object frame;
   Lisp_Object auto_buffer_name;
   FRAME_PTR f;
-  EMACS_INT old_point = -1;
+  ptrdiff_t old_point = -1;
 
   CHECK_WINDOW_CONFIGURATION (configuration);
 
@@ -5499,9 +5469,8 @@ the return value is nil.  Otherwise the value is t.  */)
         really like to do is to free only those matrices not reused
         below.  */
       root_window = XWINDOW (FRAME_ROOT_WINDOW (f));
-      leaf_windows
-       = (struct window **) alloca (count_windows (root_window)
-                                    * sizeof (struct window *));
+      leaf_windows = alloca (count_windows (root_window)
+                            * sizeof *leaf_windows);
       n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0);
 
       /* Kludge Alert!
@@ -5560,14 +5529,14 @@ the return value is nil.  Otherwise the value is t.  */)
          w->total_lines = p->total_lines;
          w->normal_cols = p->normal_cols;
          w->normal_lines = p->normal_lines;
-         w->hscroll = p->hscroll;
-         w->min_hscroll = p->min_hscroll;
+         w->hscroll = XFASTINT (p->hscroll);
+         w->min_hscroll = XFASTINT (p->min_hscroll);
          w->display_table = p->display_table;
          w->left_margin_cols = p->left_margin_cols;
          w->right_margin_cols = p->right_margin_cols;
          w->left_fringe_width = p->left_fringe_width;
          w->right_fringe_width = p->right_fringe_width;
-         w->fringes_outside_margins = p->fringes_outside_margins;
+         w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
          w->scroll_bar_width = p->scroll_bar_width;
          w->vertical_scroll_bar_type = p->vertical_scroll_bar_type;
          w->dedicated = p->dedicated;
@@ -5594,8 +5563,8 @@ the return value is nil.  Otherwise the value is t.  */)
                }
            }
 
-         XSETFASTINT (w->last_modified, 0);
-         XSETFASTINT (w->last_overlay_modified, 0);
+         w->last_modified = 0;
+         w->last_overlay_modified = 0;
 
          /* Reinstall the saved buffer and pointers into it.  */
          if (NILP (p->buffer))
@@ -5605,7 +5574,7 @@ the return value is nil.  Otherwise the value is t.  */)
            /* If saved buffer is alive, install it.  */
            {
              w->buffer = p->buffer;
-             w->start_at_line_beg = p->start_at_line_beg;
+             w->start_at_line_beg = !NILP (p->start_at_line_beg);
              set_marker_restricted (w->start, p->start, w->buffer);
              set_marker_restricted (w->pointm, p->pointm, w->buffer);
              Fset_marker (BVAR (XBUFFER (w->buffer), mark),
@@ -5630,7 +5599,7 @@ the return value is nil.  Otherwise the value is t.  */)
                set_marker_restricted_both (w->pointm, w->buffer,
                                            BUF_PT (XBUFFER (w->buffer)),
                                            BUF_PT_BYTE (XBUFFER (w->buffer)));
-             w->start_at_line_beg = Qt;
+             w->start_at_line_beg = 1;
            }
          else if (STRINGP (auto_buffer_name =
                            Fwindow_parameter (window, Qauto_buffer_name))
@@ -5639,7 +5608,7 @@ the return value is nil.  Otherwise the value is t.  */)
            {
              set_marker_restricted (w->start, make_number (0), w->buffer);
              set_marker_restricted (w->pointm, make_number (0), w->buffer);
-             w->start_at_line_beg = Qt;
+             w->start_at_line_beg = 1;
            }
          else
            /* Window has no live buffer, get one.  */
@@ -5653,7 +5622,7 @@ the return value is nil.  Otherwise the value is t.  */)
                 range.  */
              set_marker_restricted (w->start, make_number (0), w->buffer);
              set_marker_restricted (w->pointm, make_number (0), w->buffer);
-             w->start_at_line_beg = Qt;
+             w->start_at_line_beg = 1;
              if (!NILP (w->dedicated))
                /* Record this window as dead.  */
                dead_windows = Fcons (window, dead_windows);
@@ -5705,7 +5674,7 @@ the return value is nil.  Otherwise the value is t.  */)
          if (NILP (leaf_windows[i]->buffer))
            {
              /* Assert it's not reused as a combination.  */
-             xassert (NILP (leaf_windows[i]->hchild)
+             eassert (NILP (leaf_windows[i]->hchild)
                       && NILP (leaf_windows[i]->vchild));
              free_window_matrices (leaf_windows[i]);
            }
@@ -5834,7 +5803,7 @@ get_phys_cursor_glyph (struct window *w)
   if (!row->enabled_p)
     return NULL;
 
-  if (XINT (w->hscroll))
+  if (w->hscroll)
     {
       /* When the window is hscrolled, cursor hpos can legitimately be
         out of bounds, but we draw the cursor at the corresponding
@@ -5876,14 +5845,14 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
       p->total_lines = w->total_lines;
       p->normal_cols = w->normal_cols;
       p->normal_lines = w->normal_lines;
-      p->hscroll = w->hscroll;
-      p->min_hscroll = w->min_hscroll;
+      XSETFASTINT (p->hscroll, w->hscroll);
+      XSETFASTINT (p->min_hscroll, w->min_hscroll);
       p->display_table = w->display_table;
       p->left_margin_cols = w->left_margin_cols;
       p->right_margin_cols = w->right_margin_cols;
       p->left_fringe_width = w->left_fringe_width;
       p->right_fringe_width = w->right_fringe_width;
-      p->fringes_outside_margins = w->fringes_outside_margins;
+      p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
       p->scroll_bar_width = w->scroll_bar_width;
       p->vertical_scroll_bar_type = w->vertical_scroll_bar_type;
       p->dedicated = w->dedicated;
@@ -5942,17 +5911,16 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
             is the selected window, then get the value of point from
             the buffer; pointm is garbage in the selected window.  */
          if (EQ (window, selected_window))
-           {
-             p->pointm = Fmake_marker ();
-             set_marker_both (p->pointm, w->buffer,
-                              BUF_PT (XBUFFER (w->buffer)),
-                              BUF_PT_BYTE (XBUFFER (w->buffer)));
-           }
+           p->pointm = build_marker (XBUFFER (w->buffer),
+                                     BUF_PT (XBUFFER (w->buffer)),
+                                     BUF_PT_BYTE (XBUFFER (w->buffer)));
          else
            p->pointm = Fcopy_marker (w->pointm, Qnil);
+         XMARKER (p->pointm)->insertion_type
+           = !NILP (Vwindow_point_insertion_type);
 
          p->start = Fcopy_marker (w->start, Qnil);
-         p->start_at_line_beg = w->start_at_line_beg;
+         p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
 
          tem = BVAR (XBUFFER (w->buffer), mark);
          p->mark = Fcopy_marker (tem, Qnil);
@@ -6027,8 +5995,8 @@ saved by this function.  */)
   tem = Fmake_vector (make_number (n_windows), Qnil);
   data->saved_windows = tem;
   for (i = 0; i < n_windows; i++)
-    XVECTOR (tem)->contents[i]
-      = Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil);
+    ASET (tem, i,
+         Fmake_vector (make_number (VECSIZE (struct saved_window)), Qnil));
   save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
   XSETWINDOW_CONFIGURATION (tem, data);
   return (tem);
@@ -6118,6 +6086,7 @@ display marginal areas and the text area.  */)
   (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins)
 {
   struct window *w = decode_window (window);
+  int outside = !NILP (outside_margins);
 
   if (!NILP (left_width))
     CHECK_NATNUM (left_width);
@@ -6128,11 +6097,11 @@ display marginal areas and the text area.  */)
   if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
       && (!EQ (w->left_fringe_width, left_width)
          || !EQ (w->right_fringe_width, right_width)
-         || !EQ (w->fringes_outside_margins, outside_margins)))
+         || w->fringes_outside_margins != outside))
     {
       w->left_fringe_width = left_width;
       w->right_fringe_width = right_width;
-      w->fringes_outside_margins = outside_margins;
+      w->fringes_outside_margins = outside;
 
       adjust_window_margins (w);
 
@@ -6185,7 +6154,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused.  */)
 
   if (!NILP (width))
     {
-      CHECK_NATNUM (width);
+      CHECK_RANGED_INTEGER (width, 0, INT_MAX);
 
       if (XINT (width) == 0)
        vertical_type = Qnil;
index ea127ca95a80ed51f2713cdde1129f5037b4b731..10cabed979bbf0dc756bc544b41766d4fc2965cd 100644 (file)
@@ -94,9 +94,6 @@ struct window
     /* The frame this window is on.  */
     Lisp_Object frame;
 
-    /* t if this window is a minibuffer window.  */
-    Lisp_Object mini_p;
-
     /* Following (to right or down) and preceding (to left or up) child
        at same level of tree.  */
     Lisp_Object next, prev;
@@ -144,42 +141,10 @@ struct window
        each one can have its own value of point.  */
     Lisp_Object pointm;
 
-    /* Non-nil means next redisplay must use the value of start
-       set up for it in advance.  Set by scrolling commands.  */
-    Lisp_Object force_start;
-    /* Non-nil means we have explicitly changed the value of start,
-       but that the next redisplay is not obliged to use the new value.
-       This is used in Fdelete_other_windows to force a call to
-       Vwindow_scroll_functions; also by Frecenter with argument.  */
-    Lisp_Object optional_new_start;
-
-    /* Number of columns display within the window is scrolled to the left.  */
-    Lisp_Object hscroll;
-    /* Minimum hscroll for automatic hscrolling.  This is the value
-       the user has set, by set-window-hscroll for example.  */
-    Lisp_Object min_hscroll;
-
-    /* Number saying how recently window was selected.  */
-    Lisp_Object use_time;
-
-    /* Unique number of window assigned when it was created.  */
-    Lisp_Object sequence_number;
-
     /* No permanent meaning; used by save-window-excursion's
        bookkeeping.  */
     Lisp_Object temslot;
 
-    /* text.modified of displayed buffer as of last time display
-       completed.  */
-    Lisp_Object last_modified;
-    /* BUF_OVERLAY_MODIFIED of displayed buffer as of last complete update.  */
-    Lisp_Object last_overlay_modified;
-    /* Value of point at that time.  */
-    Lisp_Object last_point;
-    /* Non-nil if the buffer was "modified" when the window
-       was last updated.  */
-    Lisp_Object last_had_star;
-
     /* This window's vertical scroll bar.  This field is only for use
        by the window-system-dependent code which implements the
        scroll bars; it can store anything it likes here.  If this
@@ -194,9 +159,6 @@ struct window
     /* Width of left and right fringes.
        A value of nil or t means use frame values.  */
     Lisp_Object left_fringe_width, right_fringe_width;
-    /* Non-nil means fringes are drawn outside display margins;
-       othersize draw them between margin areas and text.  */
-    Lisp_Object fringes_outside_margins;
 
     /* Pixel width of scroll bars.
        A value of nil or t means use frame values.  */
@@ -206,11 +168,6 @@ struct window
        no scroll bar.  A value of t means use frame value.  */
     Lisp_Object vertical_scroll_bar_type;
 
-    /* Frame coords of mark as of last time display completed */
-    /* May be nil if mark does not exist or was not on frame */
-    Lisp_Object last_mark_x;
-    Lisp_Object last_mark_y;
-
     /* Z - the buffer position of the last glyph in the current matrix
        of W.  Only valid if WINDOW_END_VALID is not nil.  */
     Lisp_Object window_end_pos;
@@ -223,18 +180,13 @@ struct window
        did not get onto the frame.  */
     Lisp_Object window_end_valid;
 
-    /* Non-nil means must regenerate mode line of this window */
-    Lisp_Object update_mode_line;
-
-    /* Non-nil means current value of `start'
-       was the beginning of a line when it was chosen.  */
-    Lisp_Object start_at_line_beg;
-
     /* Display-table to use for displaying chars in this window.
        Nil means use the buffer's own display-table.  */
     Lisp_Object display_table;
 
-    /* Non-nil means window is marked as dedicated.  */
+    /* Non-nil usually means window is marked as dedicated.
+       Note Lisp code may set this to something beyond Qnil
+       and Qt, so bitfield can't be used here.  */
     Lisp_Object dedicated;
 
     /* Line number and position of a line somewhere above the top of the
@@ -279,6 +231,31 @@ struct window
     struct glyph_matrix *current_matrix;
     struct glyph_matrix *desired_matrix;
 
+    /* Number saying how recently window was selected.  */
+    int use_time;
+
+    /* Unique number of window assigned when it was created.  */
+    int sequence_number;
+
+    /* Number of columns display within the window is scrolled to the left.  */
+    ptrdiff_t hscroll;
+
+    /* Minimum hscroll for automatic hscrolling.  This is the value
+       the user has set, by set-window-hscroll for example.  */
+    ptrdiff_t min_hscroll;
+
+    /* Displayed buffer's text modification events counter as of last time
+       display completed.  */
+    EMACS_INT last_modified;
+
+    /* Displayed buffer's overlays modification events counter as of last
+       complete update.  */
+    EMACS_INT last_overlay_modified;
+
+    /* Value of point at that time.  Since this is a position in a buffer,
+       it should be positive. */
+    ptrdiff_t last_point;
+
     /* Scaling factor for the glyph_matrix size calculation in this window.
        Used if window contains many small images or uses proportional fonts,
        as the normal  may yield a matrix which is too small.  */
@@ -302,6 +279,30 @@ struct window
     /* This is handy for undrawing the cursor.  */
     int phys_cursor_ascent, phys_cursor_height;
 
+    /* Non-zero if this window is a minibuffer window.  */
+    unsigned mini : 1;
+
+    /* Non-zero means must regenerate mode line of this window */
+    unsigned update_mode_line : 1;
+
+    /* Non-nil if the buffer was "modified" when the window
+       was last updated.  */
+    unsigned last_had_star : 1;
+
+    /* Non-zero means current value of `start'
+       was the beginning of a line when it was chosen.  */
+    unsigned start_at_line_beg : 1;
+
+    /* Non-zero means next redisplay must use the value of start
+       set up for it in advance.  Set by scrolling commands.  */
+    unsigned force_start : 1;
+
+    /* Non-zero means we have explicitly changed the value of start,
+       but that the next redisplay is not obliged to use the new value.
+       This is used in Fdelete_other_windows to force a call to
+       Vwindow_scroll_functions; also by Frecenter with argument.  */
+    unsigned optional_new_start : 1;
+
     /* Non-zero means the cursor is currently displayed.  This can be
        set to zero by functions overpainting the cursor image.  */
     unsigned phys_cursor_on_p : 1;
@@ -326,18 +327,22 @@ struct window
        accept that.  */
     unsigned frozen_window_start_p : 1;
 
+    /* Non-zero means fringes are drawn outside display margins.
+       Otherwise draw them between margin areas and text.  */
+    unsigned fringes_outside_margins : 1;
+
     /* Amount by which lines of this window are scrolled in
        y-direction (smooth scrolling).  */
     int vscroll;
 
-    /* Z_BYTE - the buffer position of the last glyph in the current matrix
-       of W.  Only valid if WINDOW_END_VALID is not nil.  */
-    int window_end_bytepos;
+    /* Z_BYTE - the buffer position of the last glyph in the current matrix of W.
+       Should be nonnegative, and only valid if window_end_valid is not nil.  */
+    ptrdiff_t window_end_bytepos;
 };
 
 /* 1 if W is a minibuffer window.  */
 
-#define MINI_WINDOW_P(W)       (!NILP ((W)->mini_p))
+#define MINI_WINDOW_P(W)       ((W)->mini)
 
 /* General window layout:
 
@@ -608,7 +613,7 @@ struct window
 /* Are fringes outside display margins in window W.  */
 
 #define WINDOW_HAS_FRINGES_OUTSIDE_MARGINS(W)  \
-  (!NILP ((W)->fringes_outside_margins))
+  ((W)->fringes_outside_margins)
 
 /* Say whether scroll bars are currently enabled for window W,
    and which side they are on.  */
@@ -810,14 +815,9 @@ extern Lisp_Object Vmouse_window;
 
 extern Lisp_Object Vmouse_event;
 
-EXFUN (Fnext_window, 3);
-EXFUN (Fselect_window, 2);
-EXFUN (Fset_window_buffer, 3);
-EXFUN (Fset_window_point, 2);
 extern Lisp_Object make_window (void);
 extern Lisp_Object window_from_coordinates (struct frame *, int, int,
                                             enum window_part *, int);
-EXFUN (Fwindow_dedicated_p, 1);
 extern void resize_frame_windows (struct frame *, int, int);
 extern void delete_all_child_windows (Lisp_Object);
 extern void freeze_window_starts (struct frame *, int);
@@ -852,11 +852,6 @@ extern EMACS_INT minibuf_level;
 
 extern int update_mode_lines;
 
-/* Nonzero if BEGV - BEG or Z - ZV of current buffer has changed since
-   last redisplay that finished.  */
-
-extern int clip_changed;
-
 /* Nonzero if window sizes or contents have changed since last
    redisplay that finished */
 
@@ -893,21 +888,10 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
 extern Lisp_Object Qwindowp, Qwindow_live_p;
 extern Lisp_Object Vwindow_list;
 
-EXFUN (Fwindow_buffer, 1);
-EXFUN (Fget_buffer_window, 2);
-EXFUN (Fwindow_minibuffer_p, 1);
-EXFUN (Fselected_window, 0);
-EXFUN (Fframe_root_window, 1);
-EXFUN (Fframe_first_window, 1);
-EXFUN (Fset_frame_selected_window, 3);
-EXFUN (Fset_window_configuration, 1);
-EXFUN (Fcurrent_window_configuration, 1);
 extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
-EXFUN (Fpos_visible_in_window_p, 3);
 extern void mark_window_cursors_off (struct window *);
 extern int window_internal_height (struct window *);
 extern int window_body_cols (struct window *w);
-EXFUN (Frecenter, 1);
 extern void temp_output_buffer_show (Lisp_Object);
 extern void replace_buffer_in_windows (Lisp_Object);
 extern void replace_buffer_in_windows_safely (Lisp_Object);
index 6762bf85eb459f47c1856c89df82f8858e2897ef..4d77b56ad551b3d73c9f6189557a67562e80f749 100644 (file)
@@ -1,6 +1,6 @@
 /* Display generation from window structure and buffer text.
 
-Copyright (C) 1985-1988, 1993-1995, 1997-2012  Free Software Foundation, Inc.
+Copyright (C) 1985-1988, 1993-1995, 1997-2012 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -281,8 +281,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "window.h"
 #include "termchar.h"
 #include "dispextern.h"
-#include "buffer.h"
 #include "character.h"
+#include "buffer.h"
 #include "charset.h"
 #include "indent.h"
 #include "commands.h"
@@ -383,11 +383,21 @@ static Lisp_Object Qline_height;
 #define IT_OVERFLOW_NEWLINE_INTO_FRINGE(it) 0
 #endif /* HAVE_WINDOW_SYSTEM */
 
-/* Test if the display element loaded in IT is a space or tab
-   character.  This is used to determine word wrapping.  */
-
-#define IT_DISPLAYING_WHITESPACE(it)                           \
-  (it->what == IT_CHARACTER && (it->c == ' ' || it->c == '\t'))
+/* Test if the display element loaded in IT, or the underlying buffer
+   or string character, is a space or a TAB character.  This is used
+   to determine where word wrapping can occur.  */
+
+#define IT_DISPLAYING_WHITESPACE(it)                                   \
+  ((it->what == IT_CHARACTER && (it->c == ' ' || it->c == '\t'))       \
+   || ((STRINGP (it->string)                                           \
+       && (SREF (it->string, IT_STRING_BYTEPOS (*it)) == ' '           \
+           || SREF (it->string, IT_STRING_BYTEPOS (*it)) == '\t'))     \
+       || (it->s                                                       \
+          && (it->s[IT_BYTEPOS (*it)] == ' '                           \
+              || it->s[IT_BYTEPOS (*it)] == '\t'))                     \
+       || (IT_BYTEPOS (*it) < ZV_BYTE                                  \
+          && (*BYTE_POS_ADDR (IT_BYTEPOS (*it)) == ' '                 \
+              || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t'))))         \
 
 /* Name of the face used to highlight trailing whitespace.  */
 
@@ -617,10 +627,10 @@ int current_mode_line_height, current_header_line_height;
     CACHE = NULL;                              \
   } while (0)
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 /* Non-zero means print traces of redisplay if compiled with
-   GLYPH_DEBUG != 0.  */
+   GLYPH_DEBUG defined.  */
 
 int trace_redisplay_p;
 
@@ -741,6 +751,7 @@ static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 };
 int redisplaying_p;
 
 static Lisp_Object Qinhibit_free_realized_faces;
+static Lisp_Object Qmode_line_default_help_echo;
 
 /* If a string, XTread_socket generates an event to display that string.
    (The display is done in read_char.)  */
@@ -748,7 +759,7 @@ static Lisp_Object Qinhibit_free_realized_faces;
 Lisp_Object help_echo_string;
 Lisp_Object help_echo_window;
 Lisp_Object help_echo_object;
-EMACS_INT help_echo_pos;
+ptrdiff_t help_echo_pos;
 
 /* Temporary variable for XTread_socket.  */
 
@@ -795,33 +806,33 @@ static Lisp_Object get_it_property (struct it *it, Lisp_Object prop);
 
 static void handle_line_prefix (struct it *);
 
-static void pint2str (char *, int, EMACS_INT);
-static void pint2hrstr (char *, int, EMACS_INT);
+static void pint2str (char *, int, ptrdiff_t);
+static void pint2hrstr (char *, int, ptrdiff_t);
 static struct text_pos run_window_scroll_functions (Lisp_Object,
                                                     struct text_pos);
 static void reconsider_clip_changes (struct window *, struct buffer *);
 static int text_outside_line_unchanged_p (struct window *,
-                                         EMACS_INT, EMACS_INT);
+                                         ptrdiff_t, ptrdiff_t);
 static void store_mode_line_noprop_char (char);
 static int store_mode_line_noprop (const char *, int, int);
 static void handle_stop (struct it *);
-static void handle_stop_backwards (struct it *, EMACS_INT);
+static void handle_stop_backwards (struct it *, ptrdiff_t);
 static void vmessage (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0);
 static void ensure_echo_area_buffers (void);
 static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object);
 static Lisp_Object with_echo_area_buffer_unwind_data (struct window *);
 static int with_echo_area_buffer (struct window *, int,
-                                  int (*) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT),
-                                  EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
+                                  int (*) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t),
+                                  ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t);
 static void clear_garbaged_frames (void);
-static int current_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
+static int current_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t);
 static void pop_message (void);
-static int truncate_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
-static void set_message (const char *, Lisp_Object, EMACS_INT, int);
-static int set_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
+static int truncate_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t);
+static void set_message (const char *, Lisp_Object, ptrdiff_t, int);
+static int set_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t);
 static int display_echo_area (struct window *);
-static int display_echo_area_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
-static int resize_mini_window_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT);
+static int display_echo_area_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t);
+static int resize_mini_window_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t);
 static Lisp_Object unwind_redisplay (Lisp_Object);
 static int string_char_and_length (const unsigned char *, int *);
 static struct text_pos display_prop_end (struct it *, Lisp_Object,
@@ -834,10 +845,10 @@ static struct glyph_row *get_overlay_arrow_glyph_row (struct window *,
 static void extend_face_to_end_of_line (struct it *);
 static int append_space_for_newline (struct it *, int);
 static int cursor_row_fully_visible_p (struct window *, int, int);
-static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int);
+static int try_scrolling (Lisp_Object, int, ptrdiff_t, ptrdiff_t, int, int);
 static int try_cursor_movement (Lisp_Object, struct text_pos, int *);
-static int trailing_whitespace_p (EMACS_INT);
-static intmax_t message_log_check_duplicate (EMACS_INT, EMACS_INT);
+static int trailing_whitespace_p (ptrdiff_t);
+static intmax_t message_log_check_duplicate (ptrdiff_t, ptrdiff_t);
 static void push_it (struct it *, struct text_pos *);
 static void iterate_out_of_display_property (struct it *);
 static void pop_it (struct it *);
@@ -851,7 +862,7 @@ static Lisp_Object redisplay_window_error (Lisp_Object);
 static Lisp_Object redisplay_window_0 (Lisp_Object);
 static Lisp_Object redisplay_window_1 (Lisp_Object);
 static int set_cursor_from_row (struct window *, struct glyph_row *,
-                               struct glyph_matrix *, EMACS_INT, EMACS_INT,
+                               struct glyph_matrix *, ptrdiff_t, ptrdiff_t,
                                int, int);
 static int update_menu_bar (struct frame *, int, int);
 static int try_window_reusing_current_matrix (struct window *);
@@ -863,14 +874,14 @@ static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_O
 static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object);
 static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *);
 static void display_menu_bar (struct window *);
-static EMACS_INT display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT,
-                                     EMACS_INT *);
+static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t,
+                                     ptrdiff_t *);
 static int display_string (const char *, Lisp_Object, Lisp_Object,
-                           EMACS_INT, EMACS_INT, struct it *, int, int, int, int);
+                           ptrdiff_t, ptrdiff_t, struct it *, int, int, int, int);
 static void compute_line_metrics (struct it *);
 static void run_redisplay_end_trigger_hook (struct it *);
-static int get_overlay_strings (struct it *, EMACS_INT);
-static int get_overlay_strings_1 (struct it *, EMACS_INT, int);
+static int get_overlay_strings (struct it *, ptrdiff_t);
+static int get_overlay_strings_1 (struct it *, ptrdiff_t, int);
 static void next_overlay_string (struct it *);
 static void reseat (struct it *, struct text_pos, int);
 static void reseat_1 (struct it *, struct text_pos, int);
@@ -885,14 +896,14 @@ static int next_element_from_buffer (struct it *);
 static int next_element_from_composition (struct it *);
 static int next_element_from_image (struct it *);
 static int next_element_from_stretch (struct it *);
-static void load_overlay_strings (struct it *, EMACS_INT);
+static void load_overlay_strings (struct it *, ptrdiff_t);
 static int init_from_display_pos (struct it *, struct window *,
                                   struct display_pos *);
 static void reseat_to_string (struct it *, const char *,
-                              Lisp_Object, EMACS_INT, EMACS_INT, int, int);
+                              Lisp_Object, ptrdiff_t, ptrdiff_t, int, int);
 static int get_next_display_element (struct it *);
 static enum move_it_result
-       move_it_in_display_line_to (struct it *, EMACS_INT, int,
+       move_it_in_display_line_to (struct it *, ptrdiff_t, int,
                                   enum move_operation_enum);
 void move_it_vertically_backward (struct it *, int);
 static void init_to_row_start (struct it *, struct window *,
@@ -902,20 +913,20 @@ static int init_to_row_end (struct it *, struct window *,
 static void back_to_previous_line_start (struct it *);
 static int forward_to_next_line_start (struct it *, int *, struct bidi_it *);
 static struct text_pos string_pos_nchars_ahead (struct text_pos,
-                                                Lisp_Object, EMACS_INT);
-static struct text_pos string_pos (EMACS_INT, Lisp_Object);
-static struct text_pos c_string_pos (EMACS_INT, const char *, int);
-static EMACS_INT number_of_chars (const char *, int);
+                                                Lisp_Object, ptrdiff_t);
+static struct text_pos string_pos (ptrdiff_t, Lisp_Object);
+static struct text_pos c_string_pos (ptrdiff_t, const char *, int);
+static ptrdiff_t number_of_chars (const char *, int);
 static void compute_stop_pos (struct it *);
 static void compute_string_pos (struct text_pos *, struct text_pos,
                                 Lisp_Object);
 static int face_before_or_after_it_pos (struct it *, int);
-static EMACS_INT next_overlay_change (EMACS_INT);
+static ptrdiff_t next_overlay_change (ptrdiff_t);
 static int handle_display_spec (struct it *, Lisp_Object, Lisp_Object,
-                               Lisp_Object, struct text_pos *, EMACS_INT, int);
+                               Lisp_Object, struct text_pos *, ptrdiff_t, int);
 static int handle_single_display_spec (struct it *, Lisp_Object,
                                        Lisp_Object, Lisp_Object,
-                                       struct text_pos *, EMACS_INT, int, int);
+                                       struct text_pos *, ptrdiff_t, int, int);
 static int underlying_face_id (struct it *);
 static int in_ellipses_for_invisible_text_p (struct display_pos *,
                                              struct window *);
@@ -940,6 +951,7 @@ static void append_stretch_glyph (struct it *, Lisp_Object,
 
 #endif /* HAVE_WINDOW_SYSTEM */
 
+static void produce_special_glyphs (struct it *, enum display_element_type);
 static void show_mouse_face (Mouse_HLInfo *, enum draw_glyphs_face);
 static int coords_in_mouse_face_p (struct window *, int, int);
 
@@ -1014,7 +1026,7 @@ window_box_height (struct window *w)
   struct frame *f = XFRAME (w->frame);
   int height = WINDOW_TOTAL_HEIGHT (w);
 
-  xassert (height >= 0);
+  eassert (height >= 0);
 
   /* Note: the code below that determines the mode-line/header-line
      height is essentially the same as that contained in the macro
@@ -1240,6 +1252,23 @@ string_from_display_spec (Lisp_Object spec)
   return spec;
 }
 
+
+/* Limit insanely large values of W->hscroll on frame F to the largest
+   value that will still prevent first_visible_x and last_visible_x of
+   'struct it' from overflowing an int.  */
+static inline int
+window_hscroll_limited (struct window *w, struct frame *f)
+{
+  ptrdiff_t window_hscroll = w->hscroll;
+  int window_text_width = window_box_width (w, TEXT_AREA);
+  int colwidth = FRAME_COLUMN_WIDTH (f);
+
+  if (window_hscroll > (INT_MAX - window_text_width) / colwidth - 1)
+    window_hscroll = (INT_MAX - window_text_width) / colwidth - 1;
+
+  return window_hscroll;
+}
+
 /* Return 1 if position CHARPOS is visible in window W.
    CHARPOS < 0 means return info about WINDOW_END position.
    If visible, set *X and *Y to pixel coordinates of top left corner.
@@ -1247,7 +1276,7 @@ string_from_display_spec (Lisp_Object spec)
    Set *ROWH and *VPOS to row's visible height and VPOS (row number).  */
 
 int
-pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
+pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y,
               int *rtop, int *rbot, int *rowh, int *vpos)
 {
   struct it it;
@@ -1500,7 +1529,7 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
                          --g;
                          top_x -= g->pixel_width;
                        }
-                     xassert (g < it3.glyph_row->glyphs[TEXT_AREA]
+                     eassert (g < it3.glyph_row->glyphs[TEXT_AREA]
                                    + it3.glyph_row->used[TEXT_AREA]);
                    }
                }
@@ -1551,8 +1580,10 @@ pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y,
 
   current_header_line_height = current_mode_line_height = -1;
 
-  if (visible_p && XFASTINT (w->hscroll) > 0)
-    *x -= XFASTINT (w->hscroll) * WINDOW_FRAME_COLUMN_WIDTH (w);
+  if (visible_p && w->hscroll > 0)
+    *x -=
+      window_hscroll_limited (w, WINDOW_XFRAME (w))
+      * WINDOW_FRAME_COLUMN_WIDTH (w);
 
 #if 0
   /* Debugging code.  */
@@ -1593,9 +1624,9 @@ string_char_and_length (const unsigned char *str, int *len)
    in STRING, return the position NCHARS ahead (NCHARS >= 0).  */
 
 static struct text_pos
-string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, EMACS_INT nchars)
+string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, ptrdiff_t nchars)
 {
-  xassert (STRINGP (string) && nchars >= 0);
+  eassert (STRINGP (string) && nchars >= 0);
 
   if (STRING_MULTIBYTE (string))
     {
@@ -1621,11 +1652,11 @@ string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, EMACS_INT ncha
    for character position CHARPOS in STRING.  */
 
 static inline struct text_pos
-string_pos (EMACS_INT charpos, Lisp_Object string)
+string_pos (ptrdiff_t charpos, Lisp_Object string)
 {
   struct text_pos pos;
-  xassert (STRINGP (string));
-  xassert (charpos >= 0);
+  eassert (STRINGP (string));
+  eassert (charpos >= 0);
   SET_TEXT_POS (pos, charpos, string_char_to_byte (string, charpos));
   return pos;
 }
@@ -1636,12 +1667,12 @@ string_pos (EMACS_INT charpos, Lisp_Object string)
    means recognize multibyte characters.  */
 
 static struct text_pos
-c_string_pos (EMACS_INT charpos, const char *s, int multibyte_p)
+c_string_pos (ptrdiff_t charpos, const char *s, int multibyte_p)
 {
   struct text_pos pos;
 
-  xassert (s != NULL);
-  xassert (charpos >= 0);
+  eassert (s != NULL);
+  eassert (charpos >= 0);
 
   if (multibyte_p)
     {
@@ -1666,14 +1697,14 @@ c_string_pos (EMACS_INT charpos, const char *s, int multibyte_p)
 /* Value is the number of characters in C string S.  MULTIBYTE_P
    non-zero means recognize multibyte characters.  */
 
-static EMACS_INT
+static ptrdiff_t
 number_of_chars (const char *s, int multibyte_p)
 {
-  EMACS_INT nchars;
+  ptrdiff_t nchars;
 
   if (multibyte_p)
     {
-      EMACS_INT rest = strlen (s);
+      ptrdiff_t rest = strlen (s);
       int len;
       const unsigned char *p = (const unsigned char *) s;
 
@@ -1697,8 +1728,8 @@ number_of_chars (const char *s, int multibyte_p)
 static void
 compute_string_pos (struct text_pos *newpos, struct text_pos pos, Lisp_Object string)
 {
-  xassert (STRINGP (string));
-  xassert (CHARPOS (*newpos) >= CHARPOS (pos));
+  eassert (STRINGP (string));
+  eassert (CHARPOS (*newpos) >= CHARPOS (pos));
 
   if (STRING_MULTIBYTE (string))
     *newpos = string_pos_nchars_ahead (pos, string,
@@ -2389,7 +2420,7 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args)
     val = Qnil;
   else
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       struct gcpro gcpro1;
 
       GCPRO1 (args[0]);
@@ -2456,23 +2487,23 @@ check_it (struct it *it)
 {
   if (it->method == GET_FROM_STRING)
     {
-      xassert (STRINGP (it->string));
-      xassert (IT_STRING_CHARPOS (*it) >= 0);
+      eassert (STRINGP (it->string));
+      eassert (IT_STRING_CHARPOS (*it) >= 0);
     }
   else
     {
-      xassert (IT_STRING_CHARPOS (*it) < 0);
+      eassert (IT_STRING_CHARPOS (*it) < 0);
       if (it->method == GET_FROM_BUFFER)
        {
          /* Check that character and byte positions agree.  */
-         xassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it)));
+         eassert (IT_CHARPOS (*it) == BYTE_TO_CHAR (IT_BYTEPOS (*it)));
        }
     }
 
   if (it->dpvec)
-    xassert (it->current.dpvec_index >= 0);
+    eassert (it->current.dpvec_index >= 0);
   else
-    xassert (it->current.dpvec_index < 0);
+    eassert (it->current.dpvec_index < 0);
 }
 
 #define CHECK_IT(IT)   check_it ((IT))
@@ -2484,7 +2515,7 @@ check_it (struct it *it)
 #endif /* not 0 */
 
 
-#if GLYPH_DEBUG && XASSERTS
+#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
 
 /* Check that the window end of window W is what we expect it
    to be---the last row in the current matrix displaying text.  */
@@ -2496,7 +2527,7 @@ check_window_end (struct window *w)
       && !NILP (w->window_end_valid))
     {
       struct glyph_row *row;
-      xassert ((row = MATRIX_ROW (w->current_matrix,
+      eassert ((row = MATRIX_ROW (w->current_matrix,
                                  XFASTINT (w->window_end_vpos)),
                !row->enabled_p
                || MATRIX_ROW_DISPLAYS_TEXT_P (row)
@@ -2510,7 +2541,7 @@ check_window_end (struct window *w)
 
 #define CHECK_WINDOW_END(W)    (void) 0
 
-#endif
+#endif /* GLYPH_DEBUG and ENABLE_CHECKING */
 
 
 \f
@@ -2539,15 +2570,15 @@ check_window_end (struct window *w)
 
 void
 init_iterator (struct it *it, struct window *w,
-              EMACS_INT charpos, EMACS_INT bytepos,
+              ptrdiff_t charpos, ptrdiff_t bytepos,
               struct glyph_row *row, enum face_id base_face_id)
 {
   int highlight_region_p;
   enum face_id remapped_base_face_id = base_face_id;
 
   /* Some precondition checks.  */
-  xassert (w != NULL && it != NULL);
-  xassert (charpos < 0 || (charpos >= BUF_BEG (current_buffer)
+  eassert (w != NULL && it != NULL);
+  eassert (charpos < 0 || (charpos >= BUF_BEG (current_buffer)
                           && charpos <= ZV));
 
   /* If face attributes have been changed since the last redisplay,
@@ -2630,7 +2661,9 @@ init_iterator (struct it *it, struct window *w,
      is invisible.  >0 means lines indented more than this value are
      invisible.  */
   it->selective = (INTEGERP (BVAR (current_buffer, selective_display))
-                  ? XINT (BVAR (current_buffer, selective_display))
+                  ? clip_to_bounds (-1, XINT (BVAR (current_buffer,
+                                                    selective_display)),
+                                    PTRDIFF_MAX)
                   : (!NILP (BVAR (current_buffer, selective_display))
                      ? -1 : 0));
   it->selective_display_ellipsis_p
@@ -2663,7 +2696,7 @@ init_iterator (struct it *it, struct window *w,
              && WINDOWP (minibuf_selected_window)
              && w == XWINDOW (minibuf_selected_window))))
     {
-      EMACS_INT markpos = marker_position (BVAR (current_buffer, mark));
+      ptrdiff_t markpos = marker_position (BVAR (current_buffer, mark));
       it->region_beg_charpos = min (PT, markpos);
       it->region_end_charpos = max (PT, markpos);
     }
@@ -2677,13 +2710,14 @@ init_iterator (struct it *it, struct window *w,
     it->redisplay_end_trigger_charpos
       = marker_position (w->redisplay_end_trigger);
   else if (INTEGERP (w->redisplay_end_trigger))
-    it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger);
+    it->redisplay_end_trigger_charpos =
+      clip_to_bounds (PTRDIFF_MIN, XINT (w->redisplay_end_trigger), PTRDIFF_MAX);
 
   it->tab_width = SANE_TAB_WIDTH (current_buffer);
 
   /* Are lines in the display truncated?  */
   if (base_face_id != DEFAULT_FACE_ID
-      || XINT (it->w->hscroll)
+      || it->w->hscroll
       || (! WINDOW_FULL_WIDTH_P (it->w)
          && ((!NILP (Vtruncate_partial_width_windows)
               && !INTEGERP (Vtruncate_partial_width_windows))
@@ -2698,31 +2732,28 @@ init_iterator (struct it *it, struct window *w,
     it->line_wrap = TRUNCATE;
 
   /* Get dimensions of truncation and continuation glyphs.  These are
-     displayed as fringe bitmaps under X, so we don't need them for such
-     frames.  */
-  if (!FRAME_WINDOW_P (it->f))
+     displayed as fringe bitmaps under X, but we need them for such
+     frames when the fringes are turned off.  */
+  if (it->line_wrap == TRUNCATE)
     {
-      if (it->line_wrap == TRUNCATE)
-       {
-         /* We will need the truncation glyph.  */
-         xassert (it->glyph_row == NULL);
-         produce_special_glyphs (it, IT_TRUNCATION);
-         it->truncation_pixel_width = it->pixel_width;
-       }
-      else
-       {
-         /* We will need the continuation glyph.  */
-         xassert (it->glyph_row == NULL);
-         produce_special_glyphs (it, IT_CONTINUATION);
-         it->continuation_pixel_width = it->pixel_width;
-       }
-
-      /* Reset these values to zero because the produce_special_glyphs
-        above has changed them.  */
-      it->pixel_width = it->ascent = it->descent = 0;
-      it->phys_ascent = it->phys_descent = 0;
+      /* We will need the truncation glyph.  */
+      eassert (it->glyph_row == NULL);
+      produce_special_glyphs (it, IT_TRUNCATION);
+      it->truncation_pixel_width = it->pixel_width;
+    }
+  else
+    {
+      /* We will need the continuation glyph.  */
+      eassert (it->glyph_row == NULL);
+      produce_special_glyphs (it, IT_CONTINUATION);
+      it->continuation_pixel_width = it->pixel_width;
     }
 
+  /* Reset these values to zero because the produce_special_glyphs
+     above has changed them.  */
+  it->pixel_width = it->ascent = it->descent = 0;
+  it->phys_ascent = it->phys_descent = 0;
+
   /* Set this after getting the dimensions of truncation and
      continuation glyphs, so that we don't produce glyphs when calling
      produce_special_glyphs, above.  */
@@ -2745,16 +2776,19 @@ init_iterator (struct it *it, struct window *w,
     }
   else
     {
-      it->first_visible_x
-       = XFASTINT (it->w->hscroll) * FRAME_COLUMN_WIDTH (it->f);
+      it->first_visible_x =
+       window_hscroll_limited (it->w, it->f) * FRAME_COLUMN_WIDTH (it->f);
       it->last_visible_x = (it->first_visible_x
                            + window_box_width (w, TEXT_AREA));
 
-      /* If we truncate lines, leave room for the truncator glyph(s) at
+      /* If we truncate lines, leave room for the truncation glyph(s) at
         the right margin.  Otherwise, leave room for the continuation
-        glyph(s).  Truncation and continuation glyphs are not inserted
-        for window-based redisplay.  */
-      if (!FRAME_WINDOW_P (it->f))
+        glyph(s).  Done only if the window has no fringes.  Since we
+        don't know at this point whether there will be any R2L lines in
+        the window, we reserve space for truncation/continuation glyphs
+        even if only one of the fringes is absent.  */
+      if (WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0
+         || (it->bidi_p && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0))
        {
          if (it->line_wrap == TRUNCATE)
            it->last_visible_x -= it->truncation_pixel_width;
@@ -2890,7 +2924,10 @@ start_display (struct it *it, struct window *w, struct text_pos pos)
                  /* Or it fits exactly and we're on a window
                     system frame.  */
                  || (new_x == it->last_visible_x
-                     && FRAME_WINDOW_P (it->f))))
+                     && FRAME_WINDOW_P (it->f)
+                     && ((it->bidi_p && it->bidi_it.paragraph_dir == R2L)
+                         ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                         : WINDOW_RIGHT_FRINGE_WIDTH (it->w)))))
            {
              if ((it->current.dpvec_index >= 0
                   || it->current.overlay_string_index >= 0)
@@ -2937,7 +2974,7 @@ in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w)
 {
   Lisp_Object prop, window;
   int ellipses_p = 0;
-  EMACS_INT charpos = CHARPOS (pos->pos);
+  ptrdiff_t charpos = CHARPOS (pos->pos);
 
   /* If POS specifies a position in a display vector, this might
      be for an ellipsis displayed for invisible text.  We won't
@@ -2969,7 +3006,7 @@ in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w)
 static int
 init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
 {
-  EMACS_INT charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos);
+  ptrdiff_t charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos);
   int i, overlay_strings_with_newlines = 0;
 
   /* If POS specifies a position in a display vector, this might
@@ -3029,7 +3066,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
         pos->overlay_string_index is in IT->overlay_strings.  */
       if (pos->overlay_string_index >= OVERLAY_STRING_CHUNK_SIZE)
        {
-         int n = pos->overlay_string_index / OVERLAY_STRING_CHUNK_SIZE;
+         ptrdiff_t n = pos->overlay_string_index / OVERLAY_STRING_CHUNK_SIZE;
          it->current.overlay_string_index = 0;
          while (n--)
            {
@@ -3042,7 +3079,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
       relative_index = (it->current.overlay_string_index
                        % OVERLAY_STRING_CHUNK_SIZE);
       it->string = it->overlay_strings[relative_index];
-      xassert (STRINGP (it->string));
+      eassert (STRINGP (it->string));
       it->current.string_pos = pos->string_pos;
       it->method = GET_FROM_STRING;
     }
@@ -3053,7 +3090,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
         string.  This can only be a string from a `display' property.
         IT should already be filled with that string.  */
       it->current.string_pos = pos->string_pos;
-      xassert (STRINGP (it->string));
+      eassert (STRINGP (it->string));
     }
 
   /* Restore position in display vector translations, control
@@ -3062,7 +3099,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos)
     {
       if (it->dpvec == NULL)
        get_next_display_element (it);
-      xassert (it->dpvec && it->current.dpvec_index == 0);
+      eassert (it->dpvec && it->current.dpvec_index == 0);
       it->current.dpvec_index = pos->dpvec_index;
     }
 
@@ -3224,7 +3261,7 @@ compute_stop_pos (struct it *it)
 {
   register INTERVAL iv, next_iv;
   Lisp_Object object, limit, position;
-  EMACS_INT charpos, bytepos;
+  ptrdiff_t charpos, bytepos;
 
   if (STRINGP (it->string))
     {
@@ -3238,7 +3275,7 @@ compute_stop_pos (struct it *it)
     }
   else
     {
-      EMACS_INT pos;
+      ptrdiff_t pos;
 
       /* If end_charpos is out of range for some reason, such as a
         misbehaving display function, rationalize it (Bug#5984).  */
@@ -3320,7 +3357,7 @@ compute_stop_pos (struct it *it)
 
   if (it->cmp_it.id < 0)
     {
-      EMACS_INT stoppos = it->end_charpos;
+      ptrdiff_t stoppos = it->end_charpos;
 
       if (it->bidi_p && it->bidi_it.scan_dir < 0)
        stoppos = -1;
@@ -3328,7 +3365,7 @@ compute_stop_pos (struct it *it)
                                    stoppos, it->string);
     }
 
-  xassert (STRINGP (it->string)
+  eassert (STRINGP (it->string)
           || (it->stop_charpos >= BEGV
               && it->stop_charpos >= IT_CHARPOS (*it)));
 }
@@ -3339,11 +3376,11 @@ compute_stop_pos (struct it *it)
    follows.  This is like `next-overlay-change' but doesn't use
    xmalloc.  */
 
-static EMACS_INT
-next_overlay_change (EMACS_INT pos)
+static ptrdiff_t
+next_overlay_change (ptrdiff_t pos)
 {
   ptrdiff_t i, noverlays;
-  EMACS_INT endpos;
+  ptrdiff_t endpos;
   Lisp_Object *overlays;
 
   /* Get all overlays at the given position.  */
@@ -3354,7 +3391,7 @@ next_overlay_change (EMACS_INT pos)
   for (i = 0; i < noverlays; ++i)
     {
       Lisp_Object oend;
-      EMACS_INT oendpos;
+      ptrdiff_t oendpos;
 
       oend = OVERLAY_END (overlays[i]);
       oendpos = OVERLAY_POSITION (oend);
@@ -3381,7 +3418,7 @@ next_overlay_change (EMACS_INT pos)
    strings, non-zero otherwise.  It is set to 2 if the display string
    uses any kind of `(space ...)' spec that will produce a stretch of
    white space in the text area.  */
-EMACS_INT
+ptrdiff_t
 compute_display_string_pos (struct text_pos *position,
                            struct bidi_string_data *string,
                            int frame_window_p, int *disp_prop)
@@ -3391,10 +3428,10 @@ compute_display_string_pos (struct text_pos *position,
     (string && STRINGP (string->lstring)) ? string->lstring : Qnil;
   Lisp_Object pos, spec, limpos;
   int string_p = (string && (STRINGP (string->lstring) || string->s));
-  EMACS_INT eob = string_p ? string->schars : ZV;
-  EMACS_INT begb = string_p ? 0 : BEGV;
-  EMACS_INT bufpos, charpos = CHARPOS (*position);
-  EMACS_INT lim =
+  ptrdiff_t eob = string_p ? string->schars : ZV;
+  ptrdiff_t begb = string_p ? 0 : BEGV;
+  ptrdiff_t bufpos, charpos = CHARPOS (*position);
+  ptrdiff_t lim =
     (charpos < eob - MAX_DISP_SCAN) ? charpos + MAX_DISP_SCAN : eob;
   struct text_pos tpos;
   int rv = 0;
@@ -3465,14 +3502,14 @@ compute_display_string_pos (struct text_pos *position,
    return -1.  A display string is either an overlay with `display'
    property whose value is a string or a `display' text property whose
    value is a string.  */
-EMACS_INT
-compute_display_string_end (EMACS_INT charpos, struct bidi_string_data *string)
+ptrdiff_t
+compute_display_string_end (ptrdiff_t charpos, struct bidi_string_data *string)
 {
   /* OBJECT = nil means current buffer.  */
   Lisp_Object object =
     (string && STRINGP (string->lstring)) ? string->lstring : Qnil;
   Lisp_Object pos = make_number (charpos);
-  EMACS_INT eob =
+  ptrdiff_t eob =
     (STRINGP (object) || (string && string->s)) ? string->schars : ZV;
 
   if (charpos >= eob || (string->s && !STRINGP (object)))
@@ -3535,7 +3572,7 @@ handle_fontified_prop (struct it *it)
             no amount of fontifying will be able to change it.  */
          NILP (prop) && IT_CHARPOS (*it) < Z))
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       Lisp_Object val;
       struct buffer *obuf = current_buffer;
       int begv = BEGV, zv = ZV;
@@ -3544,7 +3581,7 @@ handle_fontified_prop (struct it *it)
       val = Vfontification_functions;
       specbind (Qfontification_functions, Qnil);
 
-      xassert (it->end_charpos == ZV);
+      eassert (it->end_charpos == ZV);
 
       if (!CONSP (val) || EQ (XCAR (val), Qlambda))
        safe_call1 (val, pos);
@@ -3632,7 +3669,7 @@ static enum prop_handled
 handle_face_prop (struct it *it)
 {
   int new_face_id;
-  EMACS_INT next_stop;
+  ptrdiff_t next_stop;
 
   if (!STRINGP (it->string))
     {
@@ -3673,11 +3710,12 @@ handle_face_prop (struct it *it)
   else
     {
       int base_face_id;
-      EMACS_INT bufpos;
+      ptrdiff_t bufpos;
       int i;
       Lisp_Object from_overlay
        = (it->current.overlay_string_index >= 0
-          ? it->string_overlays[it->current.overlay_string_index]
+          ? it->string_overlays[it->current.overlay_string_index
+                                % OVERLAY_STRING_CHUNK_SIZE]
           : Qnil);
 
       /* See if we got to this string directly or indirectly from
@@ -3691,7 +3729,8 @@ handle_face_prop (struct it *it)
          {
            if (it->stack[i].current.overlay_string_index >= 0)
              from_overlay
-               = it->string_overlays[it->stack[i].current.overlay_string_index];
+               = it->string_overlays[it->stack[i].current.overlay_string_index
+                                     % OVERLAY_STRING_CHUNK_SIZE];
            else if (! NILP (it->stack[i].from_overlay))
              from_overlay = it->stack[i].from_overlay;
 
@@ -3774,7 +3813,7 @@ underlying_face_id (struct it *it)
 {
   int face_id = it->base_face_id, i;
 
-  xassert (STRINGP (it->string));
+  eassert (STRINGP (it->string));
 
   for (i = it->sp - 1; i >= 0; --i)
     if (NILP (it->stack[i].string))
@@ -3793,15 +3832,15 @@ static int
 face_before_or_after_it_pos (struct it *it, int before_p)
 {
   int face_id, limit;
-  EMACS_INT next_check_charpos;
+  ptrdiff_t next_check_charpos;
   struct it it_copy;
   void *it_copy_data = NULL;
 
-  xassert (it->s == NULL);
+  eassert (it->s == NULL);
 
   if (STRINGP (it->string))
     {
-      EMACS_INT bufpos, charpos;
+      ptrdiff_t bufpos, charpos;
       int base_face_id;
 
       /* No face change past the end of the string (for the case
@@ -3863,7 +3902,7 @@ face_before_or_after_it_pos (struct it *it, int before_p)
              charpos = it_copy.bidi_it.charpos;
            }
        }
-      xassert (0 <= charpos && charpos <= SCHARS (it->string));
+      eassert (0 <= charpos && charpos <= SCHARS (it->string));
 
       if (it->current.overlay_string_index >= 0)
        bufpos = IT_CHARPOS (*it);
@@ -3963,7 +4002,7 @@ face_before_or_after_it_pos (struct it *it, int before_p)
                            it_copy.bidi_it.charpos, it_copy.bidi_it.bytepos);
            }
        }
-      xassert (BEGV <= CHARPOS (pos) && CHARPOS (pos) <= ZV);
+      eassert (BEGV <= CHARPOS (pos) && CHARPOS (pos) <= ZV);
 
       /* Determine face for CHARSET_ASCII, or unibyte.  */
       face_id = face_at_buffer_position (it->w,
@@ -4014,7 +4053,7 @@ handle_invisible_prop (struct it *it)
       if (!NILP (prop)
          && IT_STRING_CHARPOS (*it) < it->end_charpos)
        {
-         EMACS_INT endpos;
+         ptrdiff_t endpos;
 
          handled = HANDLED_RECOMPUTE_PROPS;
 
@@ -4033,7 +4072,7 @@ handle_invisible_prop (struct it *it)
              && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit))
            {
              struct text_pos old;
-             EMACS_INT oldpos;
+             ptrdiff_t oldpos;
 
              old = it->current.string_pos;
              oldpos = CHARPOS (old);
@@ -4085,7 +4124,7 @@ handle_invisible_prop (struct it *it)
   else
     {
       int invis_p;
-      EMACS_INT newpos, next_stop, start_charpos, tem;
+      ptrdiff_t newpos, next_stop, start_charpos, tem;
       Lisp_Object pos, prop, overlay;
 
       /* First of all, is there invisible text at this position?  */
@@ -4148,7 +4187,7 @@ handle_invisible_prop (struct it *it)
          /* The position newpos is now either ZV or on visible text.  */
          if (it->bidi_p)
            {
-             EMACS_INT bpos = CHAR_TO_BYTE (newpos);
+             ptrdiff_t bpos = CHAR_TO_BYTE (newpos);
              int on_newline =
                bpos == ZV_BYTE || FETCH_BYTE (bpos) == '\n';
              int after_newline =
@@ -4324,7 +4363,7 @@ handle_display_prop (struct it *it)
 {
   Lisp_Object propval, object, overlay;
   struct text_pos *position;
-  EMACS_INT bufpos;
+  ptrdiff_t bufpos;
   /* Nonzero if some property replaces the display of the text itself.  */
   int display_replaced_p = 0;
 
@@ -4389,7 +4428,7 @@ handle_display_prop (struct it *it)
 static int
 handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
                     Lisp_Object overlay, struct text_pos *position,
-                    EMACS_INT bufpos, int frame_window_p)
+                    ptrdiff_t bufpos, int frame_window_p)
 {
   int replacing_p = 0;
   int rv;
@@ -4425,7 +4464,7 @@ handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
     }
   else if (VECTORP (spec))
     {
-      int i;
+      ptrdiff_t i;
       for (i = 0; i < ASIZE (spec); ++i)
        if ((rv = handle_single_display_spec (it, AREF (spec, i), object,
                                              overlay, position, bufpos,
@@ -4496,7 +4535,7 @@ display_prop_end (struct it *it, Lisp_Object object, struct text_pos start_pos)
 static int
 handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
                            Lisp_Object overlay, struct text_pos *position,
-                           EMACS_INT bufpos, int display_replaced_p,
+                           ptrdiff_t bufpos, int display_replaced_p,
                            int frame_window_p)
 {
   Lisp_Object form;
@@ -4518,7 +4557,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
 
   if (!NILP (form) && !EQ (form, Qt))
     {
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       struct gcpro gcpro1;
 
       /* Bind `object' to the object having the `display' property, a
@@ -4560,7 +4599,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
                  && (EQ (XCAR (it->font_height), Qplus)
                      || EQ (XCAR (it->font_height), Qminus))
                  && CONSP (XCDR (it->font_height))
-                 && INTEGERP (XCAR (XCDR (it->font_height))))
+                 && RANGED_INTEGERP (0, XCAR (XCDR (it->font_height)), INT_MAX))
                {
                  /* `(+ N)' or `(- N)' where N is an integer.  */
                  int steps = XINT (XCAR (XCDR (it->font_height)));
@@ -4592,7 +4631,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
                {
                  /* Evaluate IT->font_height with `height' bound to the
                     current specified height to get the new height.  */
-                 int count = SPECPDL_INDEX ();
+                 ptrdiff_t count = SPECPDL_INDEX ();
 
                  specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]);
                  value = safe_eval (it->font_height);
@@ -4941,7 +4980,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object,
 
 int
 display_prop_intangible_p (Lisp_Object prop, Lisp_Object overlay,
-                          EMACS_INT charpos, EMACS_INT bytepos)
+                          ptrdiff_t charpos, ptrdiff_t bytepos)
 {
   int frame_window_p = FRAME_WINDOW_P (XFRAME (selected_frame));
   struct text_pos position;
@@ -5022,7 +5061,7 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string)
   else if (VECTORP (prop))
     {
       /* A vector of sub-properties.  */
-      int i;
+      ptrdiff_t i;
       for (i = 0; i < ASIZE (prop); ++i)
        if (single_display_spec_string_p (AREF (prop, i), string))
          return 1;
@@ -5043,9 +5082,9 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string)
    This function may only use code that doesn't eval because it is
    called asynchronously from note_mouse_highlight.  */
 
-static EMACS_INT
+static ptrdiff_t
 string_buffer_position_lim (Lisp_Object string,
-                           EMACS_INT from, EMACS_INT to, int back_p)
+                           ptrdiff_t from, ptrdiff_t to, int back_p)
 {
   Lisp_Object limit, prop, pos;
   int found = 0;
@@ -5091,11 +5130,11 @@ string_buffer_position_lim (Lisp_Object string,
    This function may only use code that doesn't eval because it is
    called asynchronously from note_mouse_highlight.  */
 
-static EMACS_INT
-string_buffer_position (Lisp_Object string, EMACS_INT around_charpos)
+static ptrdiff_t
+string_buffer_position (Lisp_Object string, ptrdiff_t around_charpos)
 {
   const int MAX_DISTANCE = 1000;
-  EMACS_INT found = string_buffer_position_lim (string, around_charpos,
+  ptrdiff_t found = string_buffer_position_lim (string, around_charpos,
                                                around_charpos + MAX_DISTANCE,
                                                0);
 
@@ -5118,7 +5157,7 @@ static enum prop_handled
 handle_composition_prop (struct it *it)
 {
   Lisp_Object prop, string;
-  EMACS_INT pos, pos_byte, start, end;
+  ptrdiff_t pos, pos_byte, start, end;
 
   if (STRINGP (it->string))
     {
@@ -5184,7 +5223,7 @@ struct overlay_entry
 {
   Lisp_Object overlay;
   Lisp_Object string;
-  int priority;
+  EMACS_INT priority;
   int after_string_p;
 };
 
@@ -5221,7 +5260,7 @@ next_overlay_string (struct it *it)
 
       it->ellipsis_p = (it->stack[it->sp - 1].display_ellipsis_p != 0);
       pop_it (it);
-      xassert (it->sp > 0
+      eassert (it->sp > 0
               || (NILP (it->string)
                   && it->method == GET_FROM_BUFFER
                   && it->stop_charpos >= BEGV
@@ -5316,12 +5355,17 @@ compare_overlay_entries (const void *e1, const void *e2)
       else
        result = entry1->after_string_p ? -1 : 1;
     }
-  else if (entry1->after_string_p)
-    /* After-strings sorted in order of decreasing priority.  */
-    result = entry2->priority - entry1->priority;
+  else if (entry1->priority != entry2->priority)
+    {
+      if (entry1->after_string_p)
+       /* After-strings sorted in order of decreasing priority.  */
+       result = entry2->priority < entry1->priority ? -1 : 1;
+      else
+       /* Before-strings sorted in order of increasing priority.  */
+       result = entry1->priority < entry2->priority ? -1 : 1;
+    }
   else
-    /* Before-strings sorted in order of increasing priority.  */
-    result = entry1->priority - entry2->priority;
+    result = 0;
 
   return result;
 }
@@ -5352,15 +5396,16 @@ compare_overlay_entries (const void *e1, const void *e2)
    compare_overlay_entries.  */
 
 static void
-load_overlay_strings (struct it *it, EMACS_INT charpos)
+load_overlay_strings (struct it *it, ptrdiff_t charpos)
 {
   Lisp_Object overlay, window, str, invisible;
   struct Lisp_Overlay *ov;
-  EMACS_INT start, end;
-  int size = 20;
-  int n = 0, i, j, invis_p;
-  struct overlay_entry *entries
-    = (struct overlay_entry *) alloca (size * sizeof *entries);
+  ptrdiff_t start, end;
+  ptrdiff_t size = 20;
+  ptrdiff_t n = 0, i, j;
+  int invis_p;
+  struct overlay_entry *entries = alloca (size * sizeof *entries);
+  USE_SAFE_ALLOCA;
 
   if (charpos <= 0)
     charpos = IT_CHARPOS (*it);
@@ -5376,13 +5421,10 @@ load_overlay_strings (struct it *it, EMACS_INT charpos)
                                                                        \
       if (n == size)                                                   \
        {                                                               \
-         int new_size = 2 * size;                                      \
          struct overlay_entry *old = entries;                          \
-         entries =                                                     \
-            (struct overlay_entry *) alloca (new_size                  \
-                                            * sizeof *entries);        \
+         SAFE_NALLOCA (entries, 2, size);                              \
          memcpy (entries, old, size * sizeof *entries);                \
-         size = new_size;                                              \
+         size *= 2;                                                    \
        }                                                               \
                                                                        \
       entries[n].string = (STRING);                                    \
@@ -5398,7 +5440,7 @@ load_overlay_strings (struct it *it, EMACS_INT charpos)
   for (ov = current_buffer->overlays_before; ov; ov = ov->next)
     {
       XSETMISC (overlay, ov);
-      xassert (OVERLAYP (overlay));
+      eassert (OVERLAYP (overlay));
       start = OVERLAY_POSITION (OVERLAY_START (overlay));
       end = OVERLAY_POSITION (OVERLAY_END (overlay));
 
@@ -5438,7 +5480,7 @@ load_overlay_strings (struct it *it, EMACS_INT charpos)
   for (ov = current_buffer->overlays_after; ov; ov = ov->next)
     {
       XSETMISC (overlay, ov);
-      xassert (OVERLAYP (overlay));
+      eassert (OVERLAYP (overlay));
       start = OVERLAY_POSITION (OVERLAY_START (overlay));
       end = OVERLAY_POSITION (OVERLAY_END (overlay));
 
@@ -5495,6 +5537,7 @@ load_overlay_strings (struct it *it, EMACS_INT charpos)
     }
 
   CHECK_IT (it);
+  SAFE_FREE ();
 }
 
 
@@ -5503,7 +5546,7 @@ load_overlay_strings (struct it *it, EMACS_INT charpos)
    least one overlay string was found.  */
 
 static int
-get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
+get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p)
 {
   /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to
      process.  This fills IT->overlay_strings with strings, and sets
@@ -5525,11 +5568,11 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
         strings.  */
       if (compute_stop_p)
        compute_stop_pos (it);
-      xassert (it->face_id >= 0);
+      eassert (it->face_id >= 0);
 
       /* Save IT's settings.  They are restored after all overlay
         strings have been processed.  */
-      xassert (!compute_stop_p || it->sp == 0);
+      eassert (!compute_stop_p || it->sp == 0);
 
       /* When called from handle_stop, there might be an empty display
          string loaded.  In that case, don't bother saving it.  But
@@ -5549,7 +5592,7 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
       it->string = it->overlay_strings[0];
       it->from_overlay = Qnil;
       it->stop_charpos = 0;
-      xassert (STRINGP (it->string));
+      eassert (STRINGP (it->string));
       it->end_charpos = SCHARS (it->string);
       it->prev_stop = 0;
       it->base_level_stop = 0;
@@ -5567,7 +5610,7 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
       /* Set up the bidi iterator for this overlay string.  */
       if (it->bidi_p)
        {
-         EMACS_INT pos = (charpos > 0 ? charpos : IT_CHARPOS (*it));
+         ptrdiff_t pos = (charpos > 0 ? charpos : IT_CHARPOS (*it));
 
          it->bidi_it.string.lstring = it->string;
          it->bidi_it.string.s = NULL;
@@ -5585,7 +5628,7 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p)
 }
 
 static int
-get_overlay_strings (struct it *it, EMACS_INT charpos)
+get_overlay_strings (struct it *it, ptrdiff_t charpos)
 {
   it->string = Qnil;
   it->method = GET_FROM_BUFFER;
@@ -5615,14 +5658,14 @@ push_it (struct it *it, struct text_pos *position)
 {
   struct iterator_stack_entry *p;
 
-  xassert (it->sp < IT_STACK_SIZE);
+  eassert (it->sp < IT_STACK_SIZE);
   p = it->stack + it->sp;
 
   p->stop_charpos = it->stop_charpos;
   p->prev_stop = it->prev_stop;
   p->base_level_stop = it->base_level_stop;
   p->cmp_it = it->cmp_it;
-  xassert (it->face_id >= 0);
+  eassert (it->face_id >= 0);
   p->face_id = it->face_id;
   p->string = it->string;
   p->method = it->method;
@@ -5666,10 +5709,10 @@ static void
 iterate_out_of_display_property (struct it *it)
 {
   int buffer_p = !STRINGP (it->string);
-  EMACS_INT eob = (buffer_p ? ZV : it->end_charpos);
-  EMACS_INT bob = (buffer_p ? BEGV : 0);
+  ptrdiff_t eob = (buffer_p ? ZV : it->end_charpos);
+  ptrdiff_t bob = (buffer_p ? BEGV : 0);
 
-  xassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob);
+  eassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob);
 
   /* Maybe initialize paragraph direction.  If we are at the beginning
      of a new paragraph, next_element_from_buffer may not have a
@@ -5708,7 +5751,7 @@ pop_it (struct it *it)
   struct iterator_stack_entry *p;
   int from_display_prop = it->from_disp_prop_p;
 
-  xassert (it->sp > 0);
+  eassert (it->sp > 0);
   --it->sp;
   p = it->stack + it->sp;
   it->stop_charpos = p->stop_charpos;
@@ -5778,7 +5821,7 @@ pop_it (struct it *it)
          && (it->method == GET_FROM_BUFFER || it->method == GET_FROM_STRING))
        iterate_out_of_display_property (it);
 
-      xassert ((BUFFERP (it->object)
+      eassert ((BUFFERP (it->object)
                && IT_CHARPOS (*it) == it->bidi_it.charpos
                && IT_BYTEPOS (*it) == it->bidi_it.bytepos)
               || (STRINGP (it->object)
@@ -5829,7 +5872,7 @@ static int
 forward_to_next_line_start (struct it *it, int *skipped_p,
                            struct bidi_it *bidi_it_prev)
 {
-  EMACS_INT old_selective;
+  ptrdiff_t old_selective;
   int newline_found_p, n;
   const int MAX_NEWLINE_DISTANCE = 500;
 
@@ -5871,11 +5914,11 @@ forward_to_next_line_start (struct it *it, int *skipped_p,
      short-cut.  */
   if (!newline_found_p)
     {
-      EMACS_INT start = IT_CHARPOS (*it);
-      EMACS_INT limit = find_next_newline_no_quit (start, 1);
+      ptrdiff_t start = IT_CHARPOS (*it);
+      ptrdiff_t limit = find_next_newline_no_quit (start, 1);
       Lisp_Object pos;
 
-      xassert (!STRINGP (it->string));
+      eassert (!STRINGP (it->string));
 
       /* If there isn't any `display' property in sight, and no
         overlays, we can just use the position of the newline in
@@ -5970,8 +6013,8 @@ back_to_previous_visible_line_start (struct it *it)
       {
        struct it it2;
        void *it2data = NULL;
-       EMACS_INT pos;
-       EMACS_INT beg, end;
+       ptrdiff_t pos;
+       ptrdiff_t beg, end;
        Lisp_Object val, overlay;
 
        SAVE_IT (it2, *it, it2data);
@@ -6014,8 +6057,8 @@ back_to_previous_visible_line_start (struct it *it)
 
   it->continuation_lines_width = 0;
 
-  xassert (IT_CHARPOS (*it) >= BEGV);
-  xassert (IT_CHARPOS (*it) == BEGV
+  eassert (IT_CHARPOS (*it) >= BEGV);
+  eassert (IT_CHARPOS (*it) == BEGV
           || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
   CHECK_IT (it);
 }
@@ -6057,7 +6100,7 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
           && indented_beyond_p (IT_CHARPOS (*it), IT_BYTEPOS (*it),
                                 it->selective))
       {
-       xassert (IT_BYTEPOS (*it) == BEGV
+       eassert (IT_BYTEPOS (*it) == BEGV
                 || FETCH_BYTE (IT_BYTEPOS (*it) - 1) == '\n');
        newline_found_p =
          forward_to_next_line_start (it, &skipped_p, &bidi_it_prev);
@@ -6124,7 +6167,7 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p)
 static void
 reseat (struct it *it, struct text_pos pos, int force_p)
 {
-  EMACS_INT original_pos = IT_CHARPOS (*it);
+  ptrdiff_t original_pos = IT_CHARPOS (*it);
 
   reseat_1 (it, pos, 0);
 
@@ -6171,10 +6214,10 @@ static void
 reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
 {
   /* Don't call this function when scanning a C string.  */
-  xassert (it->s == NULL);
+  eassert (it->s == NULL);
 
   /* POS must be a reasonable value.  */
-  xassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV);
+  eassert (CHARPOS (pos) >= BEGV && CHARPOS (pos) <= ZV);
 
   it->current.pos = it->position = pos;
   it->end_charpos = ZV;
@@ -6234,7 +6277,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p)
 
 static void
 reseat_to_string (struct it *it, const char *s, Lisp_Object string,
-                 EMACS_INT charpos, EMACS_INT precision, int field_width,
+                 ptrdiff_t charpos, ptrdiff_t precision, int field_width,
                  int multibyte)
 {
   /* No region in strings.  */
@@ -6247,7 +6290,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
   memset (&it->current, 0, sizeof it->current);
   it->current.overlay_string_index = -1;
   it->current.dpvec_index = -1;
-  xassert (charpos >= 0);
+  eassert (charpos >= 0);
 
   /* If STRING is specified, use its multibyteness, otherwise use the
      setting of MULTIBYTE, if specified.  */
@@ -6264,7 +6307,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
 
   if (s == NULL)
     {
-      xassert (STRINGP (string));
+      eassert (STRINGP (string));
       it->string = string;
       it->s = NULL;
       it->end_charpos = it->string_nchars = SCHARS (string);
@@ -6352,7 +6395,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string,
     }
   if (s == NULL && it->multibyte_p)
     {
-      EMACS_INT endpos = SCHARS (it->string);
+      ptrdiff_t endpos = SCHARS (it->string);
       if (endpos > it->end_charpos)
        endpos = it->end_charpos;
       composition_compute_stop_pos (&it->cmp_it, charpos, -1, endpos,
@@ -6460,11 +6503,11 @@ lookup_glyphless_char_display (int c, struct it *it)
    end of buffer (or C string) is reached.  */
 
 static struct frame *last_escape_glyph_frame = NULL;
-static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS);
+static int last_escape_glyph_face_id = (1 << FACE_ID_BITS);
 static int last_escape_glyph_merged_face_id = 0;
 
 struct frame *last_glyphless_glyph_frame = NULL;
-unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
+int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS);
 int last_glyphless_glyph_merged_face_id = 0;
 
 static int
@@ -6507,7 +6550,7 @@ get_next_display_element (struct it *it)
 
          if (! it->multibyte_p && ! ASCII_CHAR_P (c))
            {
-             xassert (SINGLE_BYTE_CHAR_P (c));
+             eassert (SINGLE_BYTE_CHAR_P (c));
              if (unibyte_display_via_language_environment)
                {
                  c = DECODE_CHAR (unibyte, c);
@@ -6596,7 +6639,7 @@ get_next_display_element (struct it *it)
              Lisp_Object gc;
              int ctl_len;
              int face_id;
-             EMACS_INT lface_id = 0;
+             int lface_id = 0;
              int escape_glyph;
 
              /* Handle control characters with ^.  */
@@ -6608,8 +6651,7 @@ get_next_display_element (struct it *it)
                  g = '^';           /* default glyph for Control */
                  /* Set IT->ctl_chars[0] to the glyph for `^'.  */
                  if (it->dp
-                     && (gc = DISP_CTRL_GLYPH (it->dp), GLYPH_CODE_P (gc))
-                     && GLYPH_CODE_CHAR_VALID_P (gc))
+                     && (gc = DISP_CTRL_GLYPH (it->dp), GLYPH_CODE_P (gc)))
                    {
                      g = GLYPH_CODE_CHAR (gc);
                      lface_id = GLYPH_CODE_FACE (gc);
@@ -6658,8 +6700,7 @@ get_next_display_element (struct it *it)
              escape_glyph = '\\';
 
              if (it->dp
-                 && (gc = DISP_ESCAPE_GLYPH (it->dp), GLYPH_CODE_P (gc))
-                 && GLYPH_CODE_CHAR_VALID_P (gc))
+                 && (gc = DISP_ESCAPE_GLYPH (it->dp), GLYPH_CODE_P (gc)))
                {
                  escape_glyph = GLYPH_CODE_CHAR (gc);
                  lface_id = GLYPH_CODE_FACE (gc);
@@ -6758,7 +6799,7 @@ get_next_display_element (struct it *it)
        }
       else
        {
-         EMACS_INT pos = (it->s ? -1
+         ptrdiff_t pos = (it->s ? -1
                     : STRINGP (it->string) ? IT_STRING_CHARPOS (*it)
                     : IT_CHARPOS (*it));
          int c;
@@ -6810,7 +6851,7 @@ get_next_display_element (struct it *it)
                       && (it->current.overlay_string_index
                           == it->n_overlay_strings - 1))
                {
-                 EMACS_INT ignore;
+                 ptrdiff_t ignore;
                  int next_face_id;
                  struct text_pos pos = it->current.pos;
                  INC_TEXT_POS (pos, it->multibyte_p);
@@ -6922,7 +6963,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
                {
                  /* No more grapheme clusters in this composition.
                     Find the next stop position.  */
-                 EMACS_INT stop = it->end_charpos;
+                 ptrdiff_t stop = it->end_charpos;
                  if (it->bidi_it.scan_dir < 0)
                    /* Now we are scanning backward and don't know
                       where to stop.  */
@@ -6950,7 +6991,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
                {
                  /* No more grapheme clusters in this composition.
                     Find the next stop position.  */
-                 EMACS_INT stop = it->end_charpos;
+                 ptrdiff_t stop = it->end_charpos;
                  if (it->bidi_it.scan_dir < 0)
                    /* Now we are scanning backward and don't know
                       where to stop.  */
@@ -6962,7 +7003,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
        }
       else
        {
-         xassert (it->len != 0);
+         eassert (it->len != 0);
 
          if (!it->bidi_p)
            {
@@ -6983,14 +7024,14 @@ set_iterator_to_next (struct it *it, int reseat_p)
                {
                  /* As the scan direction was changed, we must
                     re-compute the stop position for composition.  */
-                 EMACS_INT stop = it->end_charpos;
+                 ptrdiff_t stop = it->end_charpos;
                  if (it->bidi_it.scan_dir < 0)
                    stop = -1;
                  composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it),
                                                IT_BYTEPOS (*it), stop, Qnil);
                }
            }
-         xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it)));
+         eassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it)));
        }
       break;
 
@@ -7062,7 +7103,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
 
     case GET_FROM_STRING:
       /* Current display element is a character from a Lisp string.  */
-      xassert (it->s == NULL && STRINGP (it->string));
+      eassert (it->s == NULL && STRINGP (it->string));
       /* Don't advance past string end.  These conditions are true
         when set_iterator_to_next is called at the end of
         get_next_display_element, in which case the Lisp string is
@@ -7113,7 +7154,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
                it->cmp_it.from = it->cmp_it.to;
              else
                {
-                 EMACS_INT stop = it->end_charpos;
+                 ptrdiff_t stop = it->end_charpos;
                  if (it->bidi_it.scan_dir < 0)
                    stop = -1;
                  composition_compute_stop_pos (&it->cmp_it,
@@ -7132,7 +7173,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
                it->cmp_it.to = it->cmp_it.from;
              else
                {
-                 EMACS_INT stop = it->end_charpos;
+                 ptrdiff_t stop = it->end_charpos;
                  if (it->bidi_it.scan_dir < 0)
                    stop = -1;
                  composition_compute_stop_pos (&it->cmp_it,
@@ -7164,7 +7205,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
              IT_STRING_CHARPOS (*it) = it->bidi_it.charpos;
              if (prev_scan_dir != it->bidi_it.scan_dir)
                {
-                 EMACS_INT stop = it->end_charpos;
+                 ptrdiff_t stop = it->end_charpos;
 
                  if (it->bidi_it.scan_dir < 0)
                    stop = -1;
@@ -7211,7 +7252,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
       /* The position etc with which we have to proceed are on
         the stack.  The position may be at the end of a string,
          if the `display' property takes up the whole string.  */
-      xassert (it->sp > 0);
+      eassert (it->sp > 0);
       pop_it (it);
       if (it->method == GET_FROM_STRING)
        goto consider_string_end;
@@ -7222,7 +7263,7 @@ set_iterator_to_next (struct it *it, int reseat_p)
       abort ();
     }
 
-  xassert (it->method != GET_FROM_STRING
+  eassert (it->method != GET_FROM_STRING
           || (STRINGP (it->string)
               && IT_STRING_CHARPOS (*it) >= 0));
 }
@@ -7242,7 +7283,7 @@ next_element_from_display_vector (struct it *it)
   Lisp_Object gc;
 
   /* Precondition.  */
-  xassert (it->dpvec && it->current.dpvec_index >= 0);
+  eassert (it->dpvec && it->current.dpvec_index >= 0);
 
   it->face_id = it->saved_face_id;
 
@@ -7250,7 +7291,7 @@ next_element_from_display_vector (struct it *it)
      That seemed totally bogus - so I changed it...  */
   gc = it->dpvec[it->current.dpvec_index];
 
-  if (GLYPH_CODE_P (gc) && GLYPH_CODE_CHAR_VALID_P (gc))
+  if (GLYPH_CODE_P (gc))
     {
       it->c = GLYPH_CODE_CHAR (gc);
       it->len = CHAR_BYTES (it->c);
@@ -7262,7 +7303,7 @@ next_element_from_display_vector (struct it *it)
        it->face_id = it->dpvec_face_id;
       else
        {
-         EMACS_INT lface_id = GLYPH_CODE_FACE (gc);
+         int lface_id = GLYPH_CODE_FACE (gc);
          if (lface_id > 0)
            it->face_id = merge_faces (it->f, Qt, lface_id,
                                       it->saved_face_id);
@@ -7285,8 +7326,8 @@ static void
 get_visually_first_element (struct it *it)
 {
   int string_p = STRINGP (it->string) || it->s;
-  EMACS_INT eob = (string_p ? it->bidi_it.string.schars : ZV);
-  EMACS_INT bob = (string_p ? 0 : BEGV);
+  ptrdiff_t eob = (string_p ? it->bidi_it.string.schars : ZV);
+  ptrdiff_t bob = (string_p ? 0 : BEGV);
 
   if (STRINGP (it->string))
     {
@@ -7318,7 +7359,7 @@ get_visually_first_element (struct it *it)
     }
   else
     {
-      EMACS_INT orig_bytepos = it->bidi_it.bytepos;
+      ptrdiff_t orig_bytepos = it->bidi_it.bytepos;
 
       /* We need to prime the bidi iterator starting at the line's or
         string's beginning, before we will be able to produce the
@@ -7356,11 +7397,11 @@ get_visually_first_element (struct it *it)
 
   if (STRINGP (it->string) || !it->s)
     {
-      EMACS_INT stop, charpos, bytepos;
+      ptrdiff_t stop, charpos, bytepos;
 
       if (STRINGP (it->string))
        {
-         xassert (!it->s);
+         eassert (!it->s);
          stop = SCHARS (it->string);
          if (stop > it->end_charpos)
            stop = it->end_charpos;
@@ -7390,9 +7431,9 @@ next_element_from_string (struct it *it)
 {
   struct text_pos position;
 
-  xassert (STRINGP (it->string));
-  xassert (!it->bidi_p || EQ (it->string, it->bidi_it.string.lstring));
-  xassert (IT_STRING_CHARPOS (*it) >= 0);
+  eassert (STRINGP (it->string));
+  eassert (!it->bidi_p || EQ (it->string, it->bidi_it.string.lstring));
+  eassert (IT_STRING_CHARPOS (*it) >= 0);
   position = it->current.string_pos;
 
   /* With bidi reordering, the character to display might not be the
@@ -7556,8 +7597,8 @@ next_element_from_c_string (struct it *it)
 {
   int success_p = 1;
 
-  xassert (it->s);
-  xassert (!it->bidi_p || it->s == it->bidi_it.string.s);
+  eassert (it->s);
+  eassert (!it->bidi_p || it->s == it->bidi_it.string.s);
   it->what = IT_CHARACTER;
   BYTEPOS (it->position) = CHARPOS (it->position) = 0;
   it->object = Qnil;
@@ -7657,13 +7698,13 @@ compute_stop_pos_backwards (struct it *it)
   struct text_pos pos;
   struct display_pos save_current = it->current;
   struct text_pos save_position = it->position;
-  EMACS_INT charpos = IT_CHARPOS (*it);
-  EMACS_INT where_we_are = charpos;
-  EMACS_INT save_stop_pos = it->stop_charpos;
-  EMACS_INT save_end_pos = it->end_charpos;
+  ptrdiff_t charpos = IT_CHARPOS (*it);
+  ptrdiff_t where_we_are = charpos;
+  ptrdiff_t save_stop_pos = it->stop_charpos;
+  ptrdiff_t save_end_pos = it->end_charpos;
 
-  xassert (NILP (it->string) && !it->s);
-  xassert (it->bidi_p);
+  eassert (NILP (it->string) && !it->s);
+  eassert (it->bidi_p);
   it->bidi_p = 0;
   do
     {
@@ -7698,17 +7739,17 @@ compute_stop_pos_backwards (struct it *it)
    position.  */
 
 static void
-handle_stop_backwards (struct it *it, EMACS_INT charpos)
+handle_stop_backwards (struct it *it, ptrdiff_t charpos)
 {
   int bufp = !STRINGP (it->string);
-  EMACS_INT where_we_are = (bufp ? IT_CHARPOS (*it) : IT_STRING_CHARPOS (*it));
+  ptrdiff_t where_we_are = (bufp ? IT_CHARPOS (*it) : IT_STRING_CHARPOS (*it));
   struct display_pos save_current = it->current;
   struct text_pos save_position = it->position;
   struct text_pos pos1;
-  EMACS_INT next_stop;
+  ptrdiff_t next_stop;
 
   /* Scan in strict logical order.  */
-  xassert (it->bidi_p);
+  eassert (it->bidi_p);
   it->bidi_p = 0;
   do
     {
@@ -7747,9 +7788,9 @@ next_element_from_buffer (struct it *it)
 {
   int success_p = 1;
 
-  xassert (IT_CHARPOS (*it) >= BEGV);
-  xassert (NILP (it->string) && !it->s);
-  xassert (!it->bidi_p
+  eassert (IT_CHARPOS (*it) >= BEGV);
+  eassert (NILP (it->string) && !it->s);
+  eassert (!it->bidi_p
           || (EQ (it->bidi_it.string.lstring, Qnil)
               && it->bidi_it.string.s == NULL));
 
@@ -7849,7 +7890,7 @@ next_element_from_buffer (struct it *it)
       /* No face changes, overlays etc. in sight, so just return a
         character from current_buffer.  */
       unsigned char *p;
-      EMACS_INT stop;
+      ptrdiff_t stop;
 
       /* Maybe run the redisplay end trigger hook.  Performance note:
         This doesn't seem to cost measurable time.  */
@@ -7908,7 +7949,7 @@ next_element_from_buffer (struct it *it)
     }
 
   /* Value is zero if end of buffer reached.  */
-  xassert (!success_p || it->what != IT_CHARACTER || it->len > 0);
+  eassert (!success_p || it->what != IT_CHARACTER || it->len > 0);
   return success_p;
 }
 
@@ -7922,7 +7963,7 @@ run_redisplay_end_trigger_hook (struct it *it)
 
   /* IT->glyph_row should be non-null, i.e. we should be actually
      displaying something, or otherwise we should not run the hook.  */
-  xassert (it->glyph_row);
+  eassert (it->glyph_row);
 
   /* Set up hook arguments.  */
   args[0] = Qredisplay_end_trigger_functions;
@@ -8038,7 +8079,7 @@ next_element_from_composition (struct it *it)
 
 static enum move_it_result
 move_it_in_display_line_to (struct it *it,
-                           EMACS_INT to_charpos, int to_x,
+                           ptrdiff_t to_charpos, int to_x,
                            enum move_operation_enum op)
 {
   enum move_it_result result = MOVE_UNDEFINED;
@@ -8048,7 +8089,7 @@ move_it_in_display_line_to (struct it *it,
   void *ppos_data = NULL;
   int may_wrap = 0;
   enum it_method prev_method = it->method;
-  EMACS_INT prev_pos = IT_CHARPOS (*it);
+  ptrdiff_t prev_pos = IT_CHARPOS (*it);
   int saw_smaller_pos = prev_pos < to_charpos;
 
   /* Don't produce glyphs in produce_glyphs.  */
@@ -8290,7 +8331,10 @@ move_it_in_display_line_to (struct it *it,
                      /* Or it fits exactly and we're on a window
                         system frame.  */
                      || (new_x == it->last_visible_x
-                         && FRAME_WINDOW_P (it->f))))
+                         && FRAME_WINDOW_P (it->f)
+                         && ((it->bidi_p && it->bidi_it.paragraph_dir == R2L)
+                             ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                             : WINDOW_RIGHT_FRINGE_WIDTH (it->w)))))
                {
                  if (/* IT->hpos == 0 means the very first glyph
                         doesn't fit on the line, e.g. a wide image.  */
@@ -8337,10 +8381,15 @@ move_it_in_display_line_to (struct it *it,
                          /* On graphical terminals, newlines may
                             "overflow" into the fringe if
                             overflow-newline-into-fringe is non-nil.
-                            On text-only terminals, newlines may
-                            overflow into the last glyph on the
+                            On text terminals, and on graphical
+                            terminals with no right margin, newlines
+                            may overflow into the last glyph on the
                             display line.*/
                          if (!FRAME_WINDOW_P (it->f)
+                             || ((it->bidi_p
+                                  && it->bidi_it.paragraph_dir == R2L)
+                                 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                                 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0
                              || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
                            {
                              if (!get_next_display_element (it))
@@ -8415,7 +8464,7 @@ move_it_in_display_line_to (struct it *it,
             necessary here because of lines consisting of a line end,
             only.  The line end will not produce any glyphs and we
             would never get MOVE_X_REACHED.  */
-         xassert (it->nglyphs == 0);
+         eassert (it->nglyphs == 0);
          result = MOVE_X_REACHED;
          break;
        }
@@ -8472,6 +8521,9 @@ move_it_in_display_line_to (struct it *it,
          && it->current_x >= it->last_visible_x)
        {
          if (!FRAME_WINDOW_P (it->f)
+             || ((it->bidi_p && it->bidi_it.paragraph_dir == R2L)
+                 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0
              || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it))
            {
              int at_eob_p = 0;
@@ -8542,7 +8594,7 @@ move_it_in_display_line_to (struct it *it,
 /* For external use.  */
 void
 move_it_in_display_line (struct it *it,
-                        EMACS_INT to_charpos, int to_x,
+                        ptrdiff_t to_charpos, int to_x,
                         enum move_operation_enum op)
 {
   if (it->line_wrap == WORD_WRAP
@@ -8585,7 +8637,7 @@ move_it_in_display_line (struct it *it,
    displayed to the right of TO_CHARPOS on the screen.  */
 
 void
-move_it_to (struct it *it, EMACS_INT to_charpos, int to_x, int to_y, int to_vpos, int op)
+move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos, int op)
 {
   enum move_it_result skip, skip2 = MOVE_X_REACHED;
   int line_height, line_start_x = 0, reached = 0;
@@ -8862,10 +8914,10 @@ move_it_vertically_backward (struct it *it, int dy)
   int nlines, h;
   struct it it2, it3;
   void *it2data = NULL, *it3data = NULL;
-  EMACS_INT start_pos;
+  ptrdiff_t start_pos;
 
  move_further_back:
-  xassert (dy >= 0);
+  eassert (dy >= 0);
 
   start_pos = IT_CHARPOS (*it);
 
@@ -8908,11 +8960,11 @@ move_it_vertically_backward (struct it *it, int dy)
           || (it2.method == GET_FROM_STRING
               && IT_CHARPOS (it2) == start_pos
               && SREF (it2.string, IT_STRING_BYTEPOS (it2) - 1) == '\n')));
-  xassert (IT_CHARPOS (*it) >= BEGV);
+  eassert (IT_CHARPOS (*it) >= BEGV);
   SAVE_IT (it3, it2, it3data);
 
   move_it_to (&it2, start_pos, -1, -1, -1, MOVE_TO_POS);
-  xassert (IT_CHARPOS (*it) >= BEGV);
+  eassert (IT_CHARPOS (*it) >= BEGV);
   /* H is the actual vertical distance from the position in *IT
      and the starting position.  */
   h = it2.current_y - it->current_y;
@@ -8944,7 +8996,7 @@ move_it_vertically_backward (struct it *it, int dy)
          && IT_CHARPOS (*it) > BEGV
          && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n')
        {
-         EMACS_INT nl_pos =
+         ptrdiff_t nl_pos =
            find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1);
 
          move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS);
@@ -9054,7 +9106,7 @@ move_it_past_eol (struct it *it)
    truncate-lines nil.  */
 
 void
-move_it_by_lines (struct it *it, int dvpos)
+move_it_by_lines (struct it *it, ptrdiff_t dvpos)
 {
 
   /* The commented-out optimization uses vmotion on terminals.  This
@@ -9103,7 +9155,7 @@ move_it_by_lines (struct it *it, int dvpos)
     {
       struct it it2;
       void *it2data = NULL;
-      EMACS_INT start_charpos, i;
+      ptrdiff_t start_charpos, i;
 
       /* Start at the beginning of the screen line containing IT's
         position.  This may actually move vertically backwards,
@@ -9189,7 +9241,7 @@ add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2)
   Lisp_Object args[3];
   Lisp_Object msg, fmt;
   char *buffer;
-  EMACS_INT len;
+  ptrdiff_t len;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   USE_SAFE_ALLOCA;
 
@@ -9238,7 +9290,7 @@ message_log_maybe_newline (void)
    so the buffer M must NOT point to a Lisp string.  */
 
 void
-message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
+message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
 {
   const unsigned char *msg = (const unsigned char *) m;
 
@@ -9250,8 +9302,8 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
       struct buffer *oldbuf;
       Lisp_Object oldpoint, oldbegv, oldzv;
       int old_windows_or_buffers_changed = windows_or_buffers_changed;
-      EMACS_INT point_at_end = 0;
-      EMACS_INT zv_at_end = 0;
+      ptrdiff_t point_at_end = 0;
+      ptrdiff_t zv_at_end = 0;
       Lisp_Object old_deactivate_mark, tem;
       struct gcpro gcpro1;
 
@@ -9284,7 +9336,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
       if (multibyte
          && NILP (BVAR (current_buffer, enable_multibyte_characters)))
        {
-         EMACS_INT i;
+         ptrdiff_t i;
          int c, char_bytes;
          char work[1];
 
@@ -9302,7 +9354,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
       else if (! multibyte
               && ! NILP (BVAR (current_buffer, enable_multibyte_characters)))
        {
-         EMACS_INT i;
+         ptrdiff_t i;
          int c, char_bytes;
          unsigned char str[MAX_MULTIBYTE_LENGTH];
          /* Convert a single-byte string to multibyte
@@ -9320,7 +9372,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
 
       if (nlflag)
        {
-         EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte;
+         ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte;
          printmax_t dups;
          insert_1 ("\n", 1, 1, 0, 0);
 
@@ -9346,12 +9398,10 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
                    {
                      char dupstr[sizeof " [ times]"
                                  + INT_STRLEN_BOUND (printmax_t)];
-                     int duplen;
 
                      /* If you change this format, don't forget to also
                         change message_log_check_duplicate.  */
-                     sprintf (dupstr, " [%"pMd" times]", dups);
-                     duplen = strlen (dupstr);
+                     int duplen = sprintf (dupstr, " [%"pMd" times]", dups);
                      TEMP_SET_PT_BOTH (Z - 1, Z_BYTE - 1);
                      insert_1 (dupstr, duplen, 1, 0, 1);
                    }
@@ -9413,10 +9463,10 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte)
    value N > 1 if we should also append " [N times]".  */
 
 static intmax_t
-message_log_check_duplicate (EMACS_INT prev_bol_byte, EMACS_INT this_bol_byte)
+message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte)
 {
-  EMACS_INT i;
-  EMACS_INT len = Z_BYTE - 1 - this_bol_byte;
+  ptrdiff_t i;
+  ptrdiff_t len = Z_BYTE - 1 - this_bol_byte;
   int seen_dots = 0;
   unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte);
   unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte);
@@ -9450,7 +9500,7 @@ message_log_check_duplicate (EMACS_INT prev_bol_byte, EMACS_INT this_bol_byte)
    This may GC, so the buffer M must NOT point to a Lisp string.  */
 
 void
-message2 (const char *m, EMACS_INT nbytes, int multibyte)
+message2 (const char *m, ptrdiff_t nbytes, int multibyte)
 {
   /* First flush out any partial line written with print.  */
   message_log_maybe_newline ();
@@ -9463,7 +9513,7 @@ message2 (const char *m, EMACS_INT nbytes, int multibyte)
 /* The non-logging counterpart of message2.  */
 
 void
-message2_nolog (const char *m, EMACS_INT nbytes, int multibyte)
+message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte)
 {
   struct frame *sf = SELECTED_FRAME ();
   message_enable_multibyte = multibyte;
@@ -9525,7 +9575,7 @@ message2_nolog (const char *m, EMACS_INT nbytes, int multibyte)
    This function cancels echoing.  */
 
 void
-message3 (Lisp_Object m, EMACS_INT nbytes, int multibyte)
+message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
 {
   struct gcpro gcpro1;
 
@@ -9557,7 +9607,7 @@ message3 (Lisp_Object m, EMACS_INT nbytes, int multibyte)
    and make this cancel echoing.  */
 
 void
-message3_nolog (Lisp_Object m, EMACS_INT nbytes, int multibyte)
+message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte)
 {
   struct frame *sf = SELECTED_FRAME ();
   message_enable_multibyte = multibyte;
@@ -9748,7 +9798,7 @@ vmessage (const char *m, va_list ap)
              len = doprnt (FRAME_MESSAGE_BUF (f),
                            FRAME_MESSAGE_BUF_SIZE (f), m, (char *)0, ap);
 
-             message2 (FRAME_MESSAGE_BUF (f), len, 0);
+             message2 (FRAME_MESSAGE_BUF (f), len, 1);
            }
          else
            message1 (0);
@@ -9822,8 +9872,8 @@ ensure_echo_area_buffers (void)
        int j;
 
        old_buffer = echo_buffer[i];
-       sprintf (name, " *Echo Area %d*", i);
-       echo_buffer[i] = Fget_buffer_create (build_string (name));
+       echo_buffer[i] = Fget_buffer_create
+         (make_formatted_string (name, " *Echo Area %d*", i));
        BVAR (XBUFFER (echo_buffer[i]), truncate_lines) = Qnil;
        /* to force word wrap in echo area -
           it was decided to postpone this*/
@@ -9854,12 +9904,12 @@ ensure_echo_area_buffers (void)
 
 static int
 with_echo_area_buffer (struct window *w, int which,
-                      int (*fn) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT),
-                      EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
+                      int (*fn) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t),
+                      ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
 {
   Lisp_Object buffer;
   int this_one, the_other, clear_buffer_p, rc;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   /* If buffers aren't live, make new ones.  */
   ensure_echo_area_buffers ();
@@ -9925,13 +9975,13 @@ with_echo_area_buffer (struct window *w, int which,
   if (clear_buffer_p && Z > BEG)
     del_range (BEG, Z);
 
-  xassert (BEGV >= BEG);
-  xassert (ZV <= Z && ZV >= BEGV);
+  eassert (BEGV >= BEG);
+  eassert (ZV <= Z && ZV >= BEGV);
 
   rc = fn (a1, a2, a3, a4);
 
-  xassert (BEGV >= BEG);
-  xassert (ZV <= Z && ZV >= BEGV);
+  eassert (BEGV >= BEG);
+  eassert (ZV <= Z && ZV >= BEGV);
 
   unbind_to (count, Qnil);
   return rc;
@@ -9973,7 +10023,7 @@ with_echo_area_buffer_unwind_data (struct window *w)
        ASET (vector, i, Qnil);
     }
 
-  xassert (i == ASIZE (vector));
+  eassert (i == ASIZE (vector));
   return vector;
 }
 
@@ -10035,7 +10085,7 @@ setup_echo_area_for_printing (int multibyte_p)
 
       if (Z > BEG)
        {
-         int count = SPECPDL_INDEX ();
+         ptrdiff_t count = SPECPDL_INDEX ();
          specbind (Qinhibit_read_only, Qt);
          /* Note that undo recording is always disabled.  */
          del_range (BEG, Z);
@@ -10088,14 +10138,14 @@ setup_echo_area_for_printing (int multibyte_p)
 static int
 display_echo_area (struct window *w)
 {
-  int i, no_message_p, window_height_changed_p, count;
+  int i, no_message_p, window_height_changed_p;
 
   /* Temporarily disable garbage collections while displaying the echo
      area.  This is done because a GC can print a message itself.
      That message would modify the echo area buffer's contents while a
      redisplay of the buffer is going on, and seriously confuse
      redisplay.  */
-  count = inhibit_garbage_collection ();
+  ptrdiff_t count = inhibit_garbage_collection ();
 
   /* If there is no message, we must call display_echo_area_1
      nevertheless because it resizes the window.  But we will have to
@@ -10124,7 +10174,7 @@ display_echo_area (struct window *w)
    Value is non-zero if height of W was changed.  */
 
 static int
-display_echo_area_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
+display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
 {
   intptr_t i1 = a1;
   struct window *w = (struct window *) i1;
@@ -10188,7 +10238,7 @@ resize_echo_area_exactly (void)
    resize_mini_window returns.  */
 
 static int
-resize_mini_window_1 (EMACS_INT a1, Lisp_Object exactly, EMACS_INT a3, EMACS_INT a4)
+resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly, ptrdiff_t a3, ptrdiff_t a4)
 {
   intptr_t i1 = a1;
   return resize_mini_window ((struct window *) i1, !NILP (exactly));
@@ -10212,7 +10262,7 @@ resize_mini_window (struct window *w, int exact_p)
   struct frame *f = XFRAME (w->frame);
   int window_height_changed_p = 0;
 
-  xassert (MINI_WINDOW_P (w));
+  eassert (MINI_WINDOW_P (w));
 
   /* By default, start display at the beginning.  */
   set_marker_both (w->start, w->buffer,
@@ -10238,7 +10288,8 @@ resize_mini_window (struct window *w, int exact_p)
       struct it it;
       struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
       int total_height = WINDOW_TOTAL_LINES (root) + WINDOW_TOTAL_LINES (w);
-      int height, max_height;
+      int height;
+      EMACS_INT max_height;
       int unit = FRAME_LINE_HEIGHT (f);
       struct text_pos start;
       struct buffer *old_current_buffer = NULL;
@@ -10367,7 +10418,7 @@ current_message (void)
 
 
 static int
-current_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
+current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
 {
   intptr_t i1 = a1;
   Lisp_Object *msg = (Lisp_Object *) i1;
@@ -10402,7 +10453,7 @@ restore_message (void)
 {
   Lisp_Object msg;
 
-  xassert (CONSP (Vmessage_stack));
+  eassert (CONSP (Vmessage_stack));
   msg = XCAR (Vmessage_stack);
   if (STRINGP (msg))
     message3_nolog (msg, SBYTES (msg), STRING_MULTIBYTE (msg));
@@ -10425,7 +10476,7 @@ pop_message_unwind (Lisp_Object dummy)
 static void
 pop_message (void)
 {
-  xassert (CONSP (Vmessage_stack));
+  eassert (CONSP (Vmessage_stack));
   Vmessage_stack = XCDR (Vmessage_stack);
 }
 
@@ -10446,7 +10497,7 @@ check_message_stack (void)
    time we display it---but don't redisplay it now.  */
 
 void
-truncate_echo_area (EMACS_INT nchars)
+truncate_echo_area (ptrdiff_t nchars)
 {
   if (nchars == 0)
     echo_area_buffer[0] = Qnil;
@@ -10468,7 +10519,7 @@ truncate_echo_area (EMACS_INT nchars)
    message to at most NCHARS characters.  */
 
 static int
-truncate_message_1 (EMACS_INT nchars, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4)
+truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4)
 {
   if (BEG + nchars < Z)
     del_range (BEG + nchars, Z);
@@ -10494,7 +10545,7 @@ truncate_message_1 (EMACS_INT nchars, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4
 
 static void
 set_message (const char *s, Lisp_Object string,
-            EMACS_INT nbytes, int multibyte_p)
+            ptrdiff_t nbytes, int multibyte_p)
 {
   message_enable_multibyte
     = ((s && multibyte_p)
@@ -10513,7 +10564,7 @@ set_message (const char *s, Lisp_Object string,
    current.  */
 
 static int
-set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multibyte_p)
+set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multibyte_p)
 {
   intptr_t i1 = a1;
   const char *s = (const char *) i1;
@@ -10534,7 +10585,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
 
   if (STRINGP (string))
     {
-      EMACS_INT nchars;
+      ptrdiff_t nchars;
 
       if (nbytes == 0)
        nbytes = SBYTES (string);
@@ -10553,7 +10604,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
       if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters)))
        {
          /* Convert from multi-byte to single-byte.  */
-         EMACS_INT i;
+         ptrdiff_t i;
          int c, n;
          char work[1];
 
@@ -10571,7 +10622,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby
               && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
        {
          /* Convert from single-byte to multi-byte.  */
-         EMACS_INT i;
+         ptrdiff_t i;
          int c, n;
          unsigned char str[MAX_MULTIBYTE_LENGTH];
 
@@ -10716,7 +10767,7 @@ echo_area_display (int update_frame_p)
              /* Must update other windows.  Likewise as in other
                 cases, don't let this update be interrupted by
                 pending input.  */
-             int count = SPECPDL_INDEX ();
+             ptrdiff_t count = SPECPDL_INDEX ();
              specbind (Qredisplay_dont_pause, Qt);
              windows_or_buffers_changed = 1;
              redisplay_internal ();
@@ -10801,7 +10852,8 @@ static Lisp_Object mode_line_string_face_prop;
 static Lisp_Object Vmode_line_unwind_vector;
 
 static Lisp_Object
-format_mode_line_unwind_data (struct buffer *obuf,
+format_mode_line_unwind_data (struct frame *target_frame,
+                             struct buffer *obuf,
                              Lisp_Object owin,
                              int save_proptrans)
 {
@@ -10813,7 +10865,7 @@ format_mode_line_unwind_data (struct buffer *obuf,
   Vmode_line_unwind_vector = Qnil;
 
   if (NILP (vector))
-    vector = Fmake_vector (make_number (8), Qnil);
+    vector = Fmake_vector (make_number (10), Qnil);
 
   ASET (vector, 0, make_number (mode_line_target));
   ASET (vector, 1, make_number (MODE_LINE_NOPROP_LEN (0)));
@@ -10828,6 +10880,15 @@ format_mode_line_unwind_data (struct buffer *obuf,
     tmp = Qnil;
   ASET (vector, 6, tmp);
   ASET (vector, 7, owin);
+  if (target_frame)
+    {
+      /* Similarly to `with-selected-window', if the operation selects
+        a window on another frame, we must restore that frame's
+        selected window, and (for a tty) the top-frame.  */
+      ASET (vector, 8, target_frame->selected_window);
+      if (FRAME_TERMCAP_P (target_frame))
+       ASET (vector, 9, FRAME_TTY (target_frame)->top_frame);
+    }
 
   return vector;
 }
@@ -10835,6 +10896,10 @@ format_mode_line_unwind_data (struct buffer *obuf,
 static Lisp_Object
 unwind_format_mode_line (Lisp_Object vector)
 {
+  Lisp_Object old_window = AREF (vector, 7);
+  Lisp_Object target_frame_window = AREF (vector, 8);
+  Lisp_Object old_top_frame = AREF (vector, 9);
+
   mode_line_target = XINT (AREF (vector, 0));
   mode_line_noprop_ptr = mode_line_noprop_buf + XINT (AREF (vector, 1));
   mode_line_string_list = AREF (vector, 2);
@@ -10843,9 +10908,26 @@ unwind_format_mode_line (Lisp_Object vector)
   mode_line_string_face = AREF (vector, 4);
   mode_line_string_face_prop = AREF (vector, 5);
 
-  if (!NILP (AREF (vector, 7)))
-    /* Select window before buffer, since it may change the buffer.  */
-    Fselect_window (AREF (vector, 7), Qt);
+  /* Select window before buffer, since it may change the buffer.  */
+  if (!NILP (old_window))
+    {
+      /* If the operation that we are unwinding had selected a window
+        on a different frame, reset its frame-selected-window.  For a
+        text terminal, reset its top-frame if necessary.  */
+      if (!NILP (target_frame_window))
+       {
+         Lisp_Object frame
+           = WINDOW_FRAME (XWINDOW (target_frame_window));
+
+         if (!EQ (frame, WINDOW_FRAME (XWINDOW (old_window))))
+           Fselect_window (target_frame_window, Qt);
+
+         if (!NILP (old_top_frame) && !EQ (old_top_frame, frame))
+           Fselect_frame (old_top_frame, Qt);
+       }
+
+      Fselect_window (old_window, Qt);
+    }
 
   if (!NILP (AREF (vector, 6)))
     {
@@ -10893,7 +10975,7 @@ store_mode_line_noprop (const char *string, int field_width, int precision)
 {
   const unsigned char *str = (const unsigned char *) string;
   int n = 0;
-  EMACS_INT dummy, nbytes;
+  ptrdiff_t dummy, nbytes;
 
   /* Copy at most PRECISION chars from STR.  */
   nbytes = strlen (string);
@@ -10938,7 +11020,7 @@ x_consider_frame_title (Lisp_Object frame)
       char *title;
       ptrdiff_t len;
       struct it it;
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
 
       for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
        {
@@ -10961,7 +11043,7 @@ x_consider_frame_title (Lisp_Object frame)
         mode_line_noprop_buf; then display the title.  */
       record_unwind_protect (unwind_format_mode_line,
                             format_mode_line_unwind_data
-                               (current_buffer, selected_window, 0));
+                              (f, current_buffer, selected_window, 0));
 
       Fselect_window (f->selected_window, Qt);
       set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer));
@@ -10990,8 +11072,6 @@ x_consider_frame_title (Lisp_Object frame)
 
 #endif /* not HAVE_WINDOW_SYSTEM */
 
-
-
 \f
 /***********************************************************************
                              Menu Bars
@@ -11041,7 +11121,7 @@ prepare_menu_bars (void)
   if (all_windows)
     {
       Lisp_Object tail, frame;
-      int count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       /* 1 means that update_menu_bar has run its hooks
         so any further calls to update_menu_bar shouldn't do so again.  */
       int menu_bar_hooks_run = 0;
@@ -11152,13 +11232,13 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
          || update_mode_lines
          || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer))
               < BUF_MODIFF (XBUFFER (w->buffer)))
-             != !NILP (w->last_had_star))
+             != w->last_had_star)
          || ((!NILP (Vtransient_mark_mode)
               && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
              != !NILP (w->region_showing)))
        {
          struct buffer *prev = current_buffer;
-         int count = SPECPDL_INDEX ();
+         ptrdiff_t count = SPECPDL_INDEX ();
 
          specbind (Qinhibit_menubar_update, Qt);
 
@@ -11204,11 +11284,11 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run)
          else
            /* On a terminal screen, the menu bar is an ordinary screen
               line, and this makes it get updated.  */
-           w->update_mode_line = Qt;
+           w->update_mode_line = 1;
 #else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
          /* In the non-toolkit version, the menu bar is an ordinary screen
             line, and this makes it get updated.  */
-         w->update_mode_line = Qt;
+         w->update_mode_line = 1;
 #endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
 
          unbind_to (count, Qnil);
@@ -11346,17 +11426,17 @@ update_tool_bar (struct frame *f, int save_match_data)
         the rest of the redisplay algorithm is about the same as
         windows_or_buffers_changed anyway.  */
       if (windows_or_buffers_changed
-         || !NILP (w->update_mode_line)
+         || w->update_mode_line
          || update_mode_lines
          || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer))
               < BUF_MODIFF (XBUFFER (w->buffer)))
-             != !NILP (w->last_had_star))
+             != w->last_had_star)
          || ((!NILP (Vtransient_mark_mode)
               && !NILP (BVAR (XBUFFER (w->buffer), mark_active)))
              != !NILP (w->region_showing)))
        {
          struct buffer *prev = current_buffer;
-         int count = SPECPDL_INDEX ();
+         ptrdiff_t count = SPECPDL_INDEX ();
          Lisp_Object frame, new_tool_bar;
           int new_n_tool_bar;
          struct gcpro gcpro1;
@@ -11401,7 +11481,7 @@ update_tool_bar (struct frame *f, int save_match_data)
               BLOCK_INPUT;
               f->tool_bar_items = new_tool_bar;
               f->n_tool_bar_items = new_n_tool_bar;
-              w->update_mode_line = Qt;
+              w->update_mode_line = 1;
               UNBLOCK_INPUT;
             }
 
@@ -11475,7 +11555,7 @@ build_desired_tool_bar_string (struct frame *f)
                   ? TOOL_BAR_IMAGE_DISABLED_SELECTED
                   : TOOL_BAR_IMAGE_DISABLED_DESELECTED);
 
-         xassert (ASIZE (image) >= idx);
+         eassert (ASIZE (image) >= idx);
          image = AREF (image, idx);
        }
       else
@@ -11494,20 +11574,20 @@ build_desired_tool_bar_string (struct frame *f)
                : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
       hmargin = vmargin = relief;
 
-      if (INTEGERP (Vtool_bar_button_margin)
-         && XINT (Vtool_bar_button_margin) > 0)
+      if (RANGED_INTEGERP (1, Vtool_bar_button_margin,
+                          INT_MAX - max (hmargin, vmargin)))
        {
          hmargin += XFASTINT (Vtool_bar_button_margin);
          vmargin += XFASTINT (Vtool_bar_button_margin);
        }
       else if (CONSP (Vtool_bar_button_margin))
        {
-         if (INTEGERP (XCAR (Vtool_bar_button_margin))
-             && XINT (XCAR (Vtool_bar_button_margin)) > 0)
+         if (RANGED_INTEGERP (1, XCAR (Vtool_bar_button_margin),
+                              INT_MAX - hmargin))
            hmargin += XFASTINT (XCAR (Vtool_bar_button_margin));
 
-         if (INTEGERP (XCDR (Vtool_bar_button_margin))
-             && XINT (XCDR (Vtool_bar_button_margin)) > 0)
+         if (RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin),
+                              INT_MAX - vmargin))
            vmargin += XFASTINT (XCDR (Vtool_bar_button_margin));
        }
 
@@ -11853,7 +11933,7 @@ redisplay_tool_bar (struct frame *f)
     {
       int border, rows, height, extra;
 
-      if (INTEGERP (Vtool_bar_border))
+      if (TYPE_RANGED_INTEGERP (int, Vtool_bar_border))
        border = XINT (Vtool_bar_border);
       else if (EQ (Vtool_bar_border, Qinternal_border_width))
        border = FRAME_INTERNAL_BORDER_WIDTH (f);
@@ -12041,7 +12121,7 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
 
 void
 handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
-                      unsigned int modifiers)
+                      int modifiers)
 {
   Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
   struct window *w = XWINDOW (f->tool_bar_window);
@@ -12220,7 +12300,7 @@ hscroll_window_tree (Lisp_Object window)
          hscroll_step_abs = 0;
        }
     }
-  else if (INTEGERP (Vhscroll_step))
+  else if (TYPE_RANGED_INTEGERP (int, Vhscroll_step))
     {
       hscroll_step_abs = XINT (Vhscroll_step);
       if (hscroll_step_abs < 0)
@@ -12262,7 +12342,7 @@ hscroll_window_tree (Lisp_Object window)
                 inside the left margin and the window is already
                 hscrolled. */
              && ((!row_r2l_p
-                  && ((XFASTINT (w->hscroll)
+                  && ((w->hscroll
                        && w->cursor.x <= h_margin)
                       || (cursor_row->enabled_p
                           && cursor_row->truncated_on_right_p
@@ -12280,13 +12360,13 @@ hscroll_window_tree (Lisp_Object window)
                              are actually truncated on the left. */
                           && cursor_row->truncated_on_right_p
                           && w->cursor.x <= h_margin)
-                         || (XFASTINT (w->hscroll)
+                         || (w->hscroll
                              && (w->cursor.x >= text_area_width - h_margin))))))
            {
              struct it it;
-             int hscroll;
+             ptrdiff_t hscroll;
              struct buffer *saved_current_buffer;
-             EMACS_INT pt;
+             ptrdiff_t pt;
              int wanted_x;
 
              /* Find point in a display of infinite width.  */
@@ -12341,15 +12421,15 @@ hscroll_window_tree (Lisp_Object window)
                  hscroll
                    = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
                }
-             hscroll = max (hscroll, XFASTINT (w->min_hscroll));
+             hscroll = max (hscroll, w->min_hscroll);
 
              /* Don't prevent redisplay optimizations if hscroll
                 hasn't changed, as it will unnecessarily slow down
                 redisplay.  */
-             if (XFASTINT (w->hscroll) != hscroll)
+             if (w->hscroll != hscroll)
                {
                  XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
-                 w->hscroll = make_number (hscroll);
+                 w->hscroll = hscroll;
                  hscrolled_p = 1;
                }
            }
@@ -12388,7 +12468,7 @@ hscroll_windows (Lisp_Object window)
    to a non-zero value.  This is sometimes handy to have in a debugger
    session.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 /* First and last unchanged row for try_window_id.  */
 
@@ -12401,12 +12481,12 @@ static int debug_dvpos, debug_dy;
 
 /* Delta in characters and bytes for try_window_id.  */
 
-static EMACS_INT debug_delta, debug_delta_bytes;
+static ptrdiff_t debug_delta, debug_delta_bytes;
 
 /* Values of window_end_pos and window_end_vpos at the end of
    try_window_id.  */
 
-static EMACS_INT debug_end_vpos;
+static ptrdiff_t debug_end_vpos;
 
 /* Append a string to W->desired_matrix->method.  FMT is a printf
    format string.  If trace_redisplay_p is non-zero also printf the
@@ -12418,23 +12498,21 @@ static void debug_method_add (struct window *, char const *, ...)
 static void
 debug_method_add (struct window *w, char const *fmt, ...)
 {
-  char buffer[512];
   char *method = w->desired_matrix->method;
   int len = strlen (method);
   int size = sizeof w->desired_matrix->method;
   int remaining = size - len - 1;
   va_list ap;
 
-  va_start (ap, fmt);
-  vsprintf (buffer, fmt, ap);
-  va_end (ap);
   if (len && remaining)
     {
       method[len] = '|';
       --remaining, ++len;
     }
 
-  strncpy (method + len, buffer, remaining);
+  va_start (ap, fmt);
+  vsnprintf (method + len, remaining + 1, fmt, ap);
+  va_end (ap);
 
   if (trace_redisplay_p)
     fprintf (stderr, "%p (%s): %s\n",
@@ -12443,7 +12521,7 @@ debug_method_add (struct window *w, char const *fmt, ...)
               && STRINGP (BVAR (XBUFFER (w->buffer), name)))
              ? SSDATA (BVAR (XBUFFER (w->buffer), name))
              : "no buffer"),
-            buffer);
+            method + len);
 }
 
 #endif /* GLYPH_DEBUG */
@@ -12456,13 +12534,13 @@ debug_method_add (struct window *w, char const *fmt, ...)
 
 static inline int
 text_outside_line_unchanged_p (struct window *w,
-                              EMACS_INT start, EMACS_INT end)
+                              ptrdiff_t start, ptrdiff_t end)
 {
   int unchanged_p = 1;
 
   /* If text or overlays have changed, see where.  */
-  if (XFASTINT (w->last_modified) < MODIFF
-      || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF)
+  if (w->last_modified < MODIFF
+      || w->last_overlay_modified < OVERLAY_MODIFF)
     {
       /* Gap in the line?  */
       if (GPT < start || Z - GPT < end)
@@ -12679,10 +12757,10 @@ overlay_arrow_at_row (struct it *it, struct glyph_row *row)
    position.  BUF and PT are the current point buffer and position.  */
 
 static int
-check_point_in_composition (struct buffer *prev_buf, EMACS_INT prev_pt,
-                           struct buffer *buf, EMACS_INT pt)
+check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt,
+                           struct buffer *buf, ptrdiff_t pt)
 {
-  EMACS_INT start, end;
+  ptrdiff_t start, end;
   Lisp_Object prop;
   Lisp_Object buffer;
 
@@ -12733,7 +12811,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
   if (!b->clip_changed
       && BUFFERP (w->buffer) && !NILP (w->window_end_valid))
     {
-      EMACS_INT pt;
+      ptrdiff_t pt;
 
       if (w == XWINDOW (selected_window))
        pt = PT;
@@ -12741,9 +12819,9 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
        pt = marker_position (w->pointm);
 
       if ((w->current_matrix->buffer != XBUFFER (w->buffer)
-          || pt != XINT (w->last_point))
+          || pt != w->last_point)
          && check_point_in_composition (w->current_matrix->buffer,
-                                        XINT (w->last_point),
+                                        w->last_point,
                                         XBUFFER (w->buffer), pt))
        b->clip_changed = 1;
     }
@@ -12761,7 +12839,7 @@ select_frame_for_redisplay (Lisp_Object frame)
   Lisp_Object old = selected_frame;
   struct Lisp_Symbol *sym;
 
-  xassert (FRAMEP (frame) && FRAME_LIVE_P (XFRAME (frame)));
+  eassert (FRAMEP (frame) && FRAME_LIVE_P (XFRAME (frame)));
 
   selected_frame = frame;
 
@@ -12802,7 +12880,7 @@ redisplay_internal (void)
   int must_finish = 0;
   struct text_pos tlbufpos, tlendpos;
   int number_of_visible_frames;
-  int count, count1;
+  ptrdiff_t count, count1;
   struct frame *sf;
   int polling_stopped_here = 0;
   Lisp_Object old_frame = selected_frame;
@@ -12811,6 +12889,9 @@ redisplay_internal (void)
      frames.  Zero means, only selected_window is considered.  */
   int consider_all_windows_p;
 
+  /* Non-zero means redisplay has to redisplay the miniwindow */
+  int update_miniwindow_p = 0;
+
   TRACE ((stderr, "redisplay_internal %d\n", redisplaying_p));
 
   /* No redisplay if running in batch mode or frame is not yet fully
@@ -12947,9 +13028,9 @@ redisplay_internal (void)
     update_mode_lines++;
 
   /* Detect case that we need to write or remove a star in the mode line.  */
-  if ((SAVE_MODIFF < MODIFF) != !NILP (w->last_had_star))
+  if ((SAVE_MODIFF < MODIFF) != w->last_had_star)
     {
-      w->update_mode_line = Qt;
+      w->update_mode_line = 1;
       if (buffer_shared > 1)
        update_mode_lines++;
     }
@@ -12962,11 +13043,11 @@ redisplay_internal (void)
   if (!NILP (w->column_number_displayed)
       /* This alternative quickly identifies a common case
         where no change is needed.  */
-      && !(PT == XFASTINT (w->last_point)
-          && XFASTINT (w->last_modified) >= MODIFF
-          && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
+      && !(PT == w->last_point
+          && w->last_modified >= MODIFF
+          && w->last_overlay_modified >= OVERLAY_MODIFF)
       && (XFASTINT (w->column_number_displayed) != current_column ()))
-    w->update_mode_line = Qt;
+    w->update_mode_line = 1;
 
   unbind_to (count1, Qnil);
 
@@ -12997,6 +13078,10 @@ redisplay_internal (void)
          && !MINI_WINDOW_P (XWINDOW (selected_window))))
     {
       int window_height_changed_p = echo_area_display (0);
+
+      if (message_cleared_p)
+       update_miniwindow_p = 1;
+
       must_finish = 1;
 
       /* If we don't display the current message, don't clear the
@@ -13023,8 +13108,8 @@ redisplay_internal (void)
     }
   else if (EQ (selected_window, minibuf_window)
           && (current_buffer->clip_changed
-              || XFASTINT (w->last_modified) < MODIFF
-              || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF)
+              || w->last_modified < MODIFF
+              || w->last_overlay_modified < OVERLAY_MODIFF)
           && resize_mini_window (w, 0))
     {
       /* Resized active mini-window to fit the size of what it is
@@ -13033,7 +13118,7 @@ redisplay_internal (void)
 /* FIXME: this causes all frames to be updated, which seems unnecessary
    since only the current frame needs to be considered.  This function needs
    to be rewritten with two variables, consider_all_windows and
-   consider_all_frames. */
+   consider_all_frames.  */
       consider_all_windows_p = 1;
       ++windows_or_buffers_changed;
       ++update_mode_lines;
@@ -13065,7 +13150,7 @@ redisplay_internal (void)
   tlendpos = this_line_end_pos;
   if (!consider_all_windows_p
       && CHARPOS (tlbufpos) > 0
-      && NILP (w->update_mode_line)
+      && !w->update_mode_line
       && !current_buffer->clip_changed
       && !current_buffer->prevent_redisplay_optimizations_p
       && FRAME_VISIBLE_P (XFRAME (w->frame))
@@ -13073,8 +13158,8 @@ redisplay_internal (void)
       /* Make sure recorded data applies to current buffer, etc.  */
       && this_line_buffer == current_buffer
       && current_buffer == XBUFFER (w->buffer)
-      && NILP (w->force_start)
-      && NILP (w->optional_new_start)
+      && !w->force_start
+      && !w->optional_new_start
       /* Point must be on the line that we have info recorded about.  */
       && PT >= CHARPOS (tlbufpos)
       && PT <= Z - CHARPOS (tlendpos)
@@ -13089,8 +13174,8 @@ redisplay_internal (void)
              || FETCH_BYTE (BYTEPOS (tlbufpos)) == '\n'))
        /* Former continuation line has disappeared by becoming empty.  */
        goto cancel;
-      else if (XFASTINT (w->last_modified) < MODIFF
-              || XFASTINT (w->last_overlay_modified) < OVERLAY_MODIFF
+      else if (w->last_modified < MODIFF
+              || w->last_overlay_modified < OVERLAY_MODIFF
               || MINI_WINDOW_P (w))
        {
          /* We have to handle the case of continuation around a
@@ -13145,7 +13230,7 @@ redisplay_internal (void)
                {
                  struct glyph_row *row
                    = MATRIX_ROW (w->current_matrix, this_line_vpos + 1);
-                 EMACS_INT delta, delta_bytes;
+                 ptrdiff_t delta, delta_bytes;
 
                  /* We used to distinguish between two cases here,
                     conditioned by Z - CHARPOS (tlendpos) == ZV, for
@@ -13181,7 +13266,7 @@ redisplay_internal (void)
              /* Update hint: No need to try to scroll in update_window.  */
              w->desired_matrix->no_scrolling_p = 1;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
              *w->desired_matrix->method = 0;
              debug_method_add (w, "optimization 1");
 #endif
@@ -13194,7 +13279,7 @@ redisplay_internal (void)
            goto cancel;
        }
       else if (/* Cursor position hasn't changed.  */
-              PT == XFASTINT (w->last_point)
+              PT == w->last_point
               /* Make sure the cursor was last displayed
                  in this window.  Otherwise we have to reposition it.  */
               && 0 <= w->cursor.vpos
@@ -13219,7 +13304,8 @@ redisplay_internal (void)
         then we can't just move the cursor.  */
       else if (! (!NILP (Vtransient_mark_mode)
                  && !NILP (BVAR (current_buffer, mark_active)))
-              && (EQ (selected_window, BVAR (current_buffer, last_selected_window))
+              && (EQ (selected_window,
+                      BVAR (current_buffer, last_selected_window))
                   || highlight_nonselected_windows)
               && NILP (w->region_showing)
               && NILP (Vshow_trailing_whitespace)
@@ -13245,10 +13331,10 @@ redisplay_internal (void)
              && (row = MATRIX_ROW (w->current_matrix, this_line_vpos),
                  row->enabled_p))
            {
-             xassert (this_line_vpos == it.vpos);
-             xassert (this_line_y == it.current_y);
+             eassert (this_line_vpos == it.vpos);
+             eassert (this_line_y == it.current_y);
              set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
              *w->desired_matrix->method = 0;
              debug_method_add (w, "optimization 3");
 #endif
@@ -13289,6 +13375,12 @@ redisplay_internal (void)
        {
          struct frame *f = XFRAME (frame);
 
+         /* We don't have to do anything for unselected terminal
+            frames.  */
+         if ((FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
+             && !EQ (FRAME_TTY (f)->top_frame, frame))
+           continue;
+
          if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
            {
              if (! EQ (frame, selected_frame))
@@ -13372,7 +13464,7 @@ redisplay_internal (void)
     }
   else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf))
     {
-      Lisp_Object mini_window;
+      Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf);
       struct frame *mini_frame;
 
       displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer);
@@ -13381,6 +13473,10 @@ redisplay_internal (void)
       internal_condition_case_1 (redisplay_window_1, selected_window,
                                 list_of_error,
                                 redisplay_window_error);
+      if (update_miniwindow_p)
+       internal_condition_case_1 (redisplay_window_1, mini_window,
+                                  list_of_error,
+                                  redisplay_window_error);
 
       /* Compare desired and current matrices, perform output.  */
 
@@ -13599,12 +13695,10 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
     {
       struct buffer *b = XBUFFER (w->buffer);
 
-      w->last_modified
-       = make_number (accurate_p ? BUF_MODIFF (b) : 0);
-      w->last_overlay_modified
-       = make_number (accurate_p ? BUF_OVERLAY_MODIFF (b) : 0);
+      w->last_modified = accurate_p ? BUF_MODIFF(b) : 0;
+      w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF(b) : 0;
       w->last_had_star
-       = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b) ? Qt : Qnil;
+       = BUF_MODIFF (b) > BUF_SAVE_MODIFF (b);
 
       if (accurate_p)
        {
@@ -13624,16 +13718,16 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p)
          w->last_cursor_off_p = w->cursor_off_p;
 
          if (w == XWINDOW (selected_window))
-           w->last_point = make_number (BUF_PT (b));
+           w->last_point = BUF_PT (b);
          else
-           w->last_point = make_number (XMARKER (w->pointm)->charpos);
+           w->last_point = XMARKER (w->pointm)->charpos;
        }
     }
 
   if (accurate_p)
     {
       w->window_end_valid = w->buffer;
-      w->update_mode_line = Qnil;
+      w->update_mode_line = 0;
     }
 }
 
@@ -13768,18 +13862,18 @@ redisplay_window_1 (Lisp_Object window)
 static int
 set_cursor_from_row (struct window *w, struct glyph_row *row,
                     struct glyph_matrix *matrix,
-                    EMACS_INT delta, EMACS_INT delta_bytes,
+                    ptrdiff_t delta, ptrdiff_t delta_bytes,
                     int dy, int dvpos)
 {
   struct glyph *glyph = row->glyphs[TEXT_AREA];
   struct glyph *end = glyph + row->used[TEXT_AREA];
   struct glyph *cursor = NULL;
   /* The last known character position in row.  */
-  EMACS_INT last_pos = MATRIX_ROW_START_CHARPOS (row) + delta;
+  ptrdiff_t last_pos = MATRIX_ROW_START_CHARPOS (row) + delta;
   int x = row->x;
-  EMACS_INT pt_old = PT - delta;
-  EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta;
-  EMACS_INT pos_after = MATRIX_ROW_END_CHARPOS (row) + delta;
+  ptrdiff_t pt_old = PT - delta;
+  ptrdiff_t pos_before = MATRIX_ROW_START_CHARPOS (row) + delta;
+  ptrdiff_t pos_after = MATRIX_ROW_END_CHARPOS (row) + delta;
   struct glyph *glyph_before = glyph - 1, *glyph_after = end;
   /* A glyph beyond the edge of TEXT_AREA which we should never
      touch.  */
@@ -13792,11 +13886,11 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
   int string_seen = 0;
   /* Largest and smallest buffer positions seen so far during scan of
      glyph row.  */
-  EMACS_INT bpos_max = pos_before;
-  EMACS_INT bpos_min = pos_after;
+  ptrdiff_t bpos_max = pos_before;
+  ptrdiff_t bpos_min = pos_after;
   /* Last buffer position covered by an overlay string with an integer
      `cursor' property.  */
-  EMACS_INT bpos_covered = 0;
+  ptrdiff_t bpos_covered = 0;
   /* Non-zero means the display string on which to display the cursor
      comes from a text property, not from an overlay.  */
   int string_from_text_prop = 0;
@@ -13804,7 +13898,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
   /* Don't even try doing anything if called for a mode-line or
      header-line row, since the rest of the code isn't prepared to
      deal with such calamities.  */
-  xassert (!row->mode_line_p);
+  eassert (!row->mode_line_p);
   if (row->mode_line_p)
     return 0;
 
@@ -13889,7 +13983,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
       {
        if (BUFFERP (glyph->object))
          {
-           EMACS_INT dpos = glyph->charpos - pt_old;
+           ptrdiff_t dpos = glyph->charpos - pt_old;
 
            if (glyph->charpos > bpos_max)
              bpos_max = glyph->charpos;
@@ -13905,16 +13999,13 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
                    break;
                  }
                /* See if we've found a better approximation to
-                  POS_BEFORE or to POS_AFTER.  Note that we want the
-                  first (leftmost) glyph of all those that are the
-                  closest from below, and the last (rightmost) of all
-                  those from above.  */
+                  POS_BEFORE or to POS_AFTER.  */
                if (0 > dpos && dpos > pos_before - pt_old)
                  {
                    pos_before = glyph->charpos;
                    glyph_before = glyph;
                  }
-               else if (0 < dpos && dpos <= pos_after - pt_old)
+               else if (0 < dpos && dpos < pos_after - pt_old)
                  {
                    pos_after = glyph->charpos;
                    glyph_after = glyph;
@@ -13926,7 +14017,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
        else if (STRINGP (glyph->object))
          {
            Lisp_Object chprop;
-           EMACS_INT glyph_pos = glyph->charpos;
+           ptrdiff_t glyph_pos = glyph->charpos;
 
            chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
                                         glyph->object);
@@ -13942,7 +14033,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
                   text is completely covered by display properties,
                   so that no glyph with valid buffer positions is
                   ever seen in the row.  */
-               EMACS_INT prop_pos =
+               ptrdiff_t prop_pos =
                  string_buffer_position_lim (glyph->object, pos_before,
                                              pos_after, 0);
 
@@ -13980,7 +14071,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
       {
        if (BUFFERP (glyph->object))
          {
-           EMACS_INT dpos = glyph->charpos - pt_old;
+           ptrdiff_t dpos = glyph->charpos - pt_old;
 
            if (glyph->charpos > bpos_max)
              bpos_max = glyph->charpos;
@@ -13998,7 +14089,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
                    pos_before = glyph->charpos;
                    glyph_before = glyph;
                  }
-               else if (0 < dpos && dpos <= pos_after - pt_old)
+               else if (0 < dpos && dpos < pos_after - pt_old)
                  {
                    pos_after = glyph->charpos;
                    glyph_after = glyph;
@@ -14010,13 +14101,13 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
        else if (STRINGP (glyph->object))
          {
            Lisp_Object chprop;
-           EMACS_INT glyph_pos = glyph->charpos;
+           ptrdiff_t glyph_pos = glyph->charpos;
 
            chprop = Fget_char_property (make_number (glyph_pos), Qcursor,
                                         glyph->object);
            if (!NILP (chprop))
              {
-               EMACS_INT prop_pos =
+               ptrdiff_t prop_pos =
                  string_buffer_position_lim (glyph->object, pos_before,
                                              pos_after, 0);
 
@@ -14064,7 +14155,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
 
       if (row->ends_in_ellipsis_p && pos_after == last_pos)
        {
-         EMACS_INT ellipsis_pos;
+         ptrdiff_t ellipsis_pos;
 
          /* Scan back over the ellipsis glyphs.  */
          if (!row->reversed_p)
@@ -14104,7 +14195,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
             positioned between POS_BEFORE and POS_AFTER in the
             buffer.  */
          struct glyph *start, *stop;
-         EMACS_INT pos = pos_before;
+         ptrdiff_t pos = pos_before;
 
          x = -1;
 
@@ -14147,10 +14238,10 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
              if (STRINGP (glyph->object))
                {
                  Lisp_Object str;
-                 EMACS_INT tem;
+                 ptrdiff_t tem;
                  /* If the display property covers the newline, we
                     need to search for it one position farther.  */
-                 EMACS_INT lim = pos_after
+                 ptrdiff_t lim = pos_after
                    + (pos_after == MATRIX_ROW_END_CHARPOS (row) + delta);
 
                  string_from_text_prop = 0;
@@ -14160,15 +14251,18 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
                      || pos <= tem)
                    {
                      /* If the string from which this glyph came is
-                        found in the buffer at point, then we've
-                        found the glyph we've been looking for.  If
-                        it comes from an overlay (tem == 0), and it
-                        has the `cursor' property on one of its
+                        found in the buffer at point, or at position
+                        that is closer to point than pos_after, then
+                        we've found the glyph we've been looking for.
+                        If it comes from an overlay (tem == 0), and
+                        it has the `cursor' property on one of its
                         glyphs, record that glyph as a candidate for
                         displaying the cursor.  (As in the
                         unidirectional version, we will display the
                         cursor on the last candidate we find.)  */
-                     if (tem == 0 || tem == pt_old)
+                     if (tem == 0
+                         || tem == pt_old
+                         || (tem - pt_old > 0 && tem < pos_after))
                        {
                          /* The glyphs from this string could have
                             been reordered.  Find the one with the
@@ -14176,7 +14270,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
                             be a character in the string with the
                             `cursor' property, which means display
                             cursor on that character's glyph.  */
-                         EMACS_INT strpos = glyph->charpos;
+                         ptrdiff_t strpos = glyph->charpos;
 
                          if (tem)
                            {
@@ -14189,7 +14283,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
                               glyph += incr)
                            {
                              Lisp_Object cprop;
-                             EMACS_INT gpos = glyph->charpos;
+                             ptrdiff_t gpos = glyph->charpos;
 
                              cprop = Fget_char_property (make_number (gpos),
                                                          Qcursor,
@@ -14206,7 +14300,8 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
                                }
                            }
 
-                         if (tem == pt_old)
+                         if (tem == pt_old
+                             || (tem - pt_old > 0 && tem < pos_after))
                            goto compute_x;
                        }
                      if (tem)
@@ -14226,6 +14321,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
             the cursor is not on this line.  */
          if (cursor == NULL
              && (row->reversed_p ? glyph <= end : glyph >= end)
+             && (row->reversed_p ? end > glyphs_end : end < glyphs_end)
              && STRINGP (end->object)
              && row->continued_p)
            return 0;
@@ -14255,6 +14351,21 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
  compute_x:
   if (cursor != NULL)
     glyph = cursor;
+  else if (glyph == glyphs_end
+          && pos_before == pos_after
+          && STRINGP ((row->reversed_p
+                       ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1
+                       : row->glyphs[TEXT_AREA])->object))
+    {
+      /* If all the glyphs of this row came from strings, put the
+        cursor on the first glyph of the row.  This avoids having the
+        cursor outside of the text area in this very rare and hard
+        use case.  */
+      glyph =
+       row->reversed_p
+       ? row->glyphs[TEXT_AREA] + row->used[TEXT_AREA] - 1
+       : row->glyphs[TEXT_AREA];
+    }
   if (x < 0)
     {
       struct glyph *g;
@@ -14479,7 +14590,7 @@ enum
 
 static int
 try_scrolling (Lisp_Object window, int just_this_one_p,
-              EMACS_INT arg_scroll_conservatively, EMACS_INT scroll_step,
+              ptrdiff_t arg_scroll_conservatively, ptrdiff_t scroll_step,
               int temp_scroll_step, int last_line_misfit)
 {
   struct window *w = XWINDOW (window);
@@ -14493,7 +14604,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p,
   /* We will never try scrolling more than this number of lines.  */
   int scroll_limit = SCROLL_LIMIT;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   debug_method_add (w, "try_scrolling");
 #endif
 
@@ -14845,11 +14956,16 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
   struct frame *f = XFRAME (w->frame);
   int rc = CURSOR_MOVEMENT_CANNOT_BE_USED;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   if (inhibit_try_cursor_movement)
     return rc;
 #endif
 
+  /* Previously, there was a check for Lisp integer in the
+     if-statement below. Now, this field is converted to
+     ptrdiff_t, thus zero means invalid position in a buffer.  */
+  eassert (w->last_point > 0);
+
   /* Handle case where text has not changed, only point, and it has
      not moved off the frame.  */
   if (/* Point may be in this window.  */
@@ -14870,8 +14986,6 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
           && !NILP (BVAR (current_buffer, mark_active)))
       && NILP (w->region_showing)
       && NILP (Vshow_trailing_whitespace)
-      /* Right after splitting windows, last_point may be nil.  */
-      && INTEGERP (w->last_point)
       /* This code is not used for mini-buffer for the sake of the case
         of redisplaying to replace an echo area message; since in
         that case the mini-buffer contents per se are usually
@@ -14892,7 +15006,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
       int this_scroll_margin, top_scroll_margin;
       struct glyph_row *row = NULL;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       debug_method_add (w, "cursor movement");
 #endif
 
@@ -14929,13 +15043,13 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
          int scroll_p = 0, must_scroll = 0;
          int last_y = window_text_bottom_y (w) - this_scroll_margin;
 
-         if (PT > XFASTINT (w->last_point))
+         if (PT > w->last_point)
            {
              /* Point has moved forward.  */
              while (MATRIX_ROW_END_CHARPOS (row) < PT
                     && MATRIX_ROW_BOTTOM_Y (row) < last_y)
                {
-                 xassert (row->enabled_p);
+                 eassert (row->enabled_p);
                  ++row;
                }
 
@@ -14964,7 +15078,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
                      && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)))
                scroll_p = 1;
            }
-         else if (PT < XFASTINT (w->last_point))
+         else if (PT < w->last_point)
            {
              /* Cursor has to be moved backward.  Note that PT >=
                 CHARPOS (startp) because of the outer if-statement.  */
@@ -14978,7 +15092,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
                     && (row->y > top_scroll_margin
                         || CHARPOS (startp) == BEGV))
                {
-                 xassert (row->enabled_p);
+                 eassert (row->enabled_p);
                  --row;
                }
 
@@ -15048,7 +15162,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
                      rc = CURSOR_MOVEMENT_MUST_SCROLL;
                      break;
                    }
-                 xassert (row->enabled_p);
+                 eassert (row->enabled_p);
                }
            }
          if (must_scroll)
@@ -15119,7 +15233,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste
                        MATRIX_ROW (w->current_matrix, w->cursor.vpos);
                      struct glyph *g =
                        candidate->glyphs[TEXT_AREA] + w->cursor.hpos;
-                     EMACS_INT endpos = MATRIX_ROW_END_CHARPOS (candidate);
+                     ptrdiff_t endpos = MATRIX_ROW_END_CHARPOS (candidate);
 
                      exact_match_p =
                        (BUFFERP (g->object) && g->charpos == PT)
@@ -15179,7 +15293,7 @@ static
 void
 set_vertical_scroll_bar (struct window *w)
 {
-  EMACS_INT start, end, whole;
+  ptrdiff_t start, end, whole;
 
   /* Calculate the start and end positions for the current window.
      At some point, it would be nice to choose between scrollbars
@@ -15239,18 +15353,18 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
      It indicates that the buffer contents and narrowing are unchanged.  */
   int buffer_unchanged_p = 0;
   int temp_scroll_step = 0;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   int rc;
   int centering_position = -1;
   int last_line_misfit = 0;
-  EMACS_INT beg_unchanged, end_unchanged;
+  ptrdiff_t beg_unchanged, end_unchanged;
 
   SET_TEXT_POS (lpoint, PT, PT_BYTE);
   opoint = lpoint;
 
   /* W must be a leaf window here.  */
-  xassert (!NILP (w->buffer));
-#if GLYPH_DEBUG
+  eassert (!NILP (w->buffer));
+#ifdef GLYPH_DEBUG
   *w->desired_matrix->method = 0;
 #endif
 
@@ -15258,7 +15372,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
   reconsider_clip_changes (w, buffer);
 
   /* Has the mode line to be updated?  */
-  update_mode_line = (!NILP (w->update_mode_line)
+  update_mode_line = (w->update_mode_line
                      || update_mode_lines
                      || buffer->clip_changed
                      || buffer->prevent_redisplay_optimizations_p);
@@ -15310,8 +15424,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     = (!NILP (w->window_end_valid)
        && !current_buffer->clip_changed
        && !current_buffer->prevent_redisplay_optimizations_p
-       && XFASTINT (w->last_modified) >= MODIFF
-       && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF);
+       && w->last_modified >= MODIFF
+       && w->last_overlay_modified >= OVERLAY_MODIFF);
 
   /* Run the window-bottom-change-functions
      if it is possible that the text on the screen has changed
@@ -15333,8 +15447,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
   buffer_unchanged_p
     = (!NILP (w->window_end_valid)
        && !current_buffer->clip_changed
-       && XFASTINT (w->last_modified) >= MODIFF
-       && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF);
+       && w->last_modified >= MODIFF
+       && w->last_overlay_modified >= OVERLAY_MODIFF);
 
   /* When windows_or_buffers_changed is non-zero, we can't rely on
      the window end being valid, so set it to nil there.  */
@@ -15359,9 +15473,9 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
   if (!NILP (w->column_number_displayed)
       /* This alternative quickly identifies a common case
         where no change is needed.  */
-      && !(PT == XFASTINT (w->last_point)
-          && XFASTINT (w->last_modified) >= MODIFF
-          && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)
+      && !(PT == w->last_point
+          && w->last_modified >= MODIFF
+          && w->last_overlay_modified >= OVERLAY_MODIFF)
       && (XFASTINT (w->column_number_displayed) != current_column ()))
     update_mode_line = 1;
 
@@ -15384,8 +15498,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
      window, set up appropriate value.  */
   if (!EQ (window, selected_window))
     {
-      EMACS_INT new_pt = XMARKER (w->pointm)->charpos;
-      EMACS_INT new_pt_byte = marker_byte_position (w->pointm);
+      ptrdiff_t new_pt = XMARKER (w->pointm)->charpos;
+      ptrdiff_t new_pt_byte = marker_byte_position (w->pointm);
       if (new_pt < BEGV)
        {
          new_pt = BEGV;
@@ -15430,32 +15544,31 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
 
   /* If someone specified a new starting point but did not insist,
      check whether it can be used.  */
-  if (!NILP (w->optional_new_start)
+  if (w->optional_new_start
       && CHARPOS (startp) >= BEGV
       && CHARPOS (startp) <= ZV)
     {
-      w->optional_new_start = Qnil;
+      w->optional_new_start = 0;
       start_display (&it, w, startp);
       move_it_to (&it, PT, 0, it.last_visible_y, -1,
                  MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
       if (IT_CHARPOS (it) == PT)
-       w->force_start = Qt;
+       w->force_start = 1;
       /* IT may overshoot PT if text at PT is invisible.  */
       else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT)
-       w->force_start = Qt;
+       w->force_start = 1;
     }
 
  force_start:
 
   /* Handle case where place to start displaying has been specified,
      unless the specified location is outside the accessible range.  */
-  if (!NILP (w->force_start)
-      || w->frozen_window_start_p)
+  if (w->force_start || w->frozen_window_start_p)
     {
       /* We set this later on if we have to adjust point.  */
       int new_vpos = -1;
 
-      w->force_start = Qnil;
+      w->force_start = 0;
       w->vscroll = 0;
       w->window_end_valid = Qnil;
 
@@ -15474,12 +15587,12 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
          || ! NILP (Vwindow_scroll_functions))
        {
          update_mode_line = 1;
-         w->update_mode_line = Qt;
+         w->update_mode_line = 1;
          startp = run_window_scroll_functions (window, startp);
        }
 
-      w->last_modified = make_number (0);
-      w->last_overlay_modified = make_number (0);
+      w->last_modified = 0;
+      w->last_overlay_modified = 0;
       if (CHARPOS (startp) < BEGV)
        SET_TEXT_POS (startp, BEGV, BEGV_BYTE);
       else if (CHARPOS (startp) > ZV)
@@ -15492,7 +15605,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
         the scroll margin (bug#148) -- cyd  */
       if (!try_window (window, startp, 0))
        {
-         w->force_start = Qt;
+         w->force_start = 1;
          clear_glyph_matrix (w->desired_matrix);
          goto need_larger_matrices;
        }
@@ -15543,7 +15656,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
            }
        }
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       debug_method_add (w, "forced window start");
 #endif
       goto done;
@@ -15571,11 +15684,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     }
   /* If current starting point was originally the beginning of a line
      but no longer is, find a new starting point.  */
-  else if (!NILP (w->start_at_line_beg)
+  else if (w->start_at_line_beg
           && !(CHARPOS (startp) <= BEGV
                || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n'))
     {
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       debug_method_add (w, "recenter 1");
 #endif
       goto recenter;
@@ -15586,7 +15699,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
      not work.  It is 0 if unsuccessful for some other reason.  */
   else if ((tem = try_window_id (w)) != 0)
     {
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       debug_method_add (w, "try_window_id %d", tem);
 #endif
 
@@ -15604,8 +15717,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
           && (CHARPOS (startp) < ZV
               /* Avoid starting at end of buffer.  */
               || CHARPOS (startp) == BEGV
-              || (XFASTINT (w->last_modified) >= MODIFF
-                  && XFASTINT (w->last_overlay_modified) >= OVERLAY_MODIFF)))
+              || (w->last_modified >= MODIFF
+                  && w->last_overlay_modified >= OVERLAY_MODIFF)))
     {
       int d1, d2, d3, d4, d5, d6;
 
@@ -15618,7 +15731,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
         new window start, since that would change the position under
         the mouse, resulting in an unwanted mouse-movement rather
         than a simple mouse-click.  */
-      if (NILP (w->start_at_line_beg)
+      if (!w->start_at_line_beg
          && NILP (do_mouse_tracking)
          && CHARPOS (startp) > BEGV
          && CHARPOS (startp) > BEG + beg_unchanged
@@ -15638,12 +15751,12 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
             See bug#9324.  */
          && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6))
        {
-         w->force_start = Qt;
+         w->force_start = 1;
          SET_TEXT_POS_FROM_MARKER (startp, w->start);
          goto force_start;
        }
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       debug_method_add (w, "same window start");
 #endif
 
@@ -15692,14 +15805,14 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
 
  try_to_scroll:
 
-  w->last_modified = make_number (0);
-  w->last_overlay_modified = make_number (0);
+  w->last_modified = 0;
+  w->last_overlay_modified = 0;
 
   /* Redisplay the mode line.  Select the buffer properly for that.  */
   if (!update_mode_line)
     {
       update_mode_line = 1;
-      w->update_mode_line = Qt;
+      w->update_mode_line = 1;
     }
 
   /* Try to scroll by specified few lines.  */
@@ -15738,7 +15851,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
 
  recenter:
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   debug_method_add (w, "recenter");
 #endif
 
@@ -15757,7 +15870,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
        scroll_margin > 0
        ? min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4)
        : 0;
-      EMACS_INT margin_pos = CHARPOS (startp);
+      ptrdiff_t margin_pos = CHARPOS (startp);
       Lisp_Object aggressive;
       int scrolling_up;
 
@@ -15830,7 +15943,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     }
   move_it_vertically_backward (&it, centering_position);
 
-  xassert (IT_CHARPOS (it) >= BEGV);
+  eassert (IT_CHARPOS (it) >= BEGV);
 
   /* The function move_it_vertically_backward may move over more
      than the specified y-distance.  If it->w is small, e.g. a
@@ -15954,9 +16067,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
  done:
 
   SET_TEXT_POS_FROM_MARKER (startp, w->start);
-  w->start_at_line_beg = ((CHARPOS (startp) == BEGV
-                          || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n')
-                         ? Qt : Qnil);
+  w->start_at_line_beg = (CHARPOS (startp) == BEGV
+                           || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n');
 
   /* Display the mode line, if we must.  */
   if ((update_mode_line
@@ -16173,21 +16285,21 @@ try_window (Lisp_Object window, struct text_pos pos, int flags)
   /* If bottom moved off end of frame, change mode line percentage.  */
   if (XFASTINT (w->window_end_pos) <= 0
       && Z != IT_CHARPOS (it))
-    w->update_mode_line = Qt;
+    w->update_mode_line = 1;
 
   /* Set window_end_pos to the offset of the last character displayed
      on the window from the end of current_buffer.  Set
      window_end_vpos to its row number.  */
   if (last_text_row)
     {
-      xassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row));
+      eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row));
       w->window_end_bytepos
        = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
       w->window_end_pos
        = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row));
       w->window_end_vpos
        = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix));
-      xassert (MATRIX_ROW (w->desired_matrix, XFASTINT (w->window_end_vpos))
+      eassert (MATRIX_ROW (w->desired_matrix, XFASTINT (w->window_end_vpos))
               ->displays_text_p);
     }
   else
@@ -16227,7 +16339,7 @@ try_window_reusing_current_matrix (struct window *w)
   struct glyph_row *start_row;
   int start_vpos, min_y, max_y;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   if (inhibit_try_window_reusing)
     return 0;
 #endif
@@ -16449,7 +16561,7 @@ try_window_reusing_current_matrix (struct window *w)
       /* Update hint: don't try scrolling again in update_window.  */
       w->desired_matrix->no_scrolling_p = 1;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       debug_method_add (w, "try_window_reusing_current_matrix 1");
 #endif
       return 1;
@@ -16496,7 +16608,7 @@ try_window_reusing_current_matrix (struct window *w)
        }
 
       /* Start displaying at the start of first_row_to_display.  */
-      xassert (first_row_to_display->y < yb);
+      eassert (first_row_to_display->y < yb);
       init_to_row_start (&it, w, first_row_to_display);
 
       nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix)
@@ -16568,7 +16680,7 @@ try_window_reusing_current_matrix (struct window *w)
        }
 
       /* Scroll the current matrix.  */
-      xassert (nrows_scrolled > 0);
+      eassert (nrows_scrolled > 0);
       rotate_matrix (w->current_matrix,
                     start_vpos,
                     MATRIX_ROW_VPOS (bottom_row, w->current_matrix),
@@ -16639,7 +16751,7 @@ try_window_reusing_current_matrix (struct window *w)
       w->window_end_valid = Qnil;
       w->desired_matrix->no_scrolling_p = 1;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       debug_method_add (w, "try_window_reusing_current_matrix 2");
 #endif
       return 1;
@@ -16656,7 +16768,7 @@ try_window_reusing_current_matrix (struct window *w)
 
 static struct glyph_row *find_last_unchanged_at_beg_row (struct window *);
 static struct glyph_row *find_first_unchanged_at_end_row (struct window *,
-                                                          EMACS_INT *, EMACS_INT *);
+                                                          ptrdiff_t *, ptrdiff_t *);
 static struct glyph_row *
 find_last_row_displaying_text (struct glyph_matrix *, struct it *,
                                struct glyph_row *);
@@ -16680,7 +16792,7 @@ find_last_row_displaying_text (struct glyph_matrix *matrix, struct it *it,
   row = start ? start : MATRIX_FIRST_TEXT_ROW (matrix);
   while (MATRIX_ROW_DISPLAYS_TEXT_P (row))
     {
-      xassert (row->enabled_p);
+      eassert (row->enabled_p);
       row_found = row;
       if (MATRIX_ROW_BOTTOM_Y (row) >= it->last_visible_y)
        break;
@@ -16704,7 +16816,7 @@ find_last_row_displaying_text (struct glyph_matrix *matrix, struct it *it,
 static struct glyph_row *
 find_last_unchanged_at_beg_row (struct window *w)
 {
-  EMACS_INT first_changed_pos = BEG + BEG_UNCHANGED;
+  ptrdiff_t first_changed_pos = BEG + BEG_UNCHANGED;
   struct glyph_row *row;
   struct glyph_row *row_found = NULL;
   int yb = window_text_bottom_y (w);
@@ -16760,7 +16872,7 @@ find_last_unchanged_at_beg_row (struct window *w)
 
 static struct glyph_row *
 find_first_unchanged_at_end_row (struct window *w,
-                                EMACS_INT *delta, EMACS_INT *delta_bytes)
+                                ptrdiff_t *delta, ptrdiff_t *delta_bytes)
 {
   struct glyph_row *row;
   struct glyph_row *row_found = NULL;
@@ -16788,11 +16900,11 @@ find_first_unchanged_at_end_row (struct window *w,
         corresponds to window_end_pos.  This allows us to translate
         buffer positions in the current matrix to current buffer
         positions for characters not in changed text.  */
-      EMACS_INT Z_old =
+      ptrdiff_t Z_old =
        MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos);
-      EMACS_INT Z_BYTE_old =
+      ptrdiff_t Z_BYTE_old =
        MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos;
-      EMACS_INT last_unchanged_pos, last_unchanged_pos_old;
+      ptrdiff_t last_unchanged_pos, last_unchanged_pos_old;
       struct glyph_row *first_text_row
        = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
 
@@ -16842,9 +16954,9 @@ sync_frame_with_window_matrix_rows (struct window *w)
 
   /* Preconditions: W must be a leaf window and full-width.  Its frame
      must have a frame matrix.  */
-  xassert (NILP (w->hchild) && NILP (w->vchild));
-  xassert (WINDOW_FULL_WIDTH_P (w));
-  xassert (!FRAME_WINDOW_P (f));
+  eassert (NILP (w->hchild) && NILP (w->vchild));
+  eassert (WINDOW_FULL_WIDTH_P (w));
+  eassert (!FRAME_WINDOW_P (f));
 
   /* If W is a full-width window, glyph pointers in W's current matrix
      have, by definition, to be the same as glyph pointers in the
@@ -16879,12 +16991,12 @@ sync_frame_with_window_matrix_rows (struct window *w)
    containing CHARPOS or null.  */
 
 struct glyph_row *
-row_containing_pos (struct window *w, EMACS_INT charpos,
+row_containing_pos (struct window *w, ptrdiff_t charpos,
                    struct glyph_row *start, struct glyph_row *end, int dy)
 {
   struct glyph_row *row = start;
   struct glyph_row *best_row = NULL;
-  EMACS_INT mindif = BUF_ZV (XBUFFER (w->buffer)) + 1;
+  ptrdiff_t mindif = BUF_ZV (XBUFFER (w->buffer)) + 1;
   int last_y;
 
   /* If we happen to start on a header-line, skip that.  */
@@ -16998,16 +17110,16 @@ try_window_id (struct window *w)
   struct glyph_row *bottom_row;
   int bottom_vpos;
   struct it it;
-  EMACS_INT delta = 0, delta_bytes = 0, stop_pos;
+  ptrdiff_t delta = 0, delta_bytes = 0, stop_pos;
   int dvpos, dy;
   struct text_pos start_pos;
   struct run run;
   int first_unchanged_at_end_vpos = 0;
   struct glyph_row *last_text_row, *last_text_row_at_end;
   struct text_pos start;
-  EMACS_INT first_changed_charpos, last_changed_charpos;
+  ptrdiff_t first_changed_charpos, last_changed_charpos;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   if (inhibit_try_window_id)
     return 0;
 #endif
@@ -17053,11 +17165,11 @@ try_window_id (struct window *w)
     GIVE_UP (5);
 
   /* Another way to prevent redisplay optimizations.  */
-  if (XFASTINT (w->last_modified) == 0)
+  if (w->last_modified == 0)
     GIVE_UP (6);
 
   /* Verify that window is not hscrolled.  */
-  if (XFASTINT (w->hscroll) != 0)
+  if (w->hscroll != 0)
     GIVE_UP (7);
 
   /* Verify that display wasn't paused.  */
@@ -17132,7 +17244,7 @@ try_window_id (struct window *w)
          || (last_changed_charpos < CHARPOS (start) - 1
              && FETCH_BYTE (BYTEPOS (start) - 1) == '\n')))
     {
-      EMACS_INT Z_old, Z_delta, Z_BYTE_old, Z_delta_bytes;
+      ptrdiff_t Z_old, Z_delta, Z_BYTE_old, Z_delta_bytes;
       struct glyph_row *r0;
 
       /* Compute how many chars/bytes have been added to or removed
@@ -17281,7 +17393,7 @@ try_window_id (struct window *w)
       it.glyph_row = MATRIX_ROW (desired_matrix, it.vpos);
       it.current_y = MATRIX_ROW_BOTTOM_Y (last_unchanged_at_beg_row);
 
-      xassert (it.hpos == 0 && it.current_x == 0);
+      eassert (it.hpos == 0 && it.current_x == 0);
     }
   else
     {
@@ -17311,7 +17423,7 @@ try_window_id (struct window *w)
   stop_pos = 0;
   if (first_unchanged_at_end_row)
     {
-      xassert (last_unchanged_at_beg_row == NULL
+      eassert (last_unchanged_at_beg_row == NULL
               || first_unchanged_at_end_row >= last_unchanged_at_beg_row);
 
       /* If this is a continuation line, move forward to the next one
@@ -17334,19 +17446,19 @@ try_window_id (struct window *w)
                      + delta);
          first_unchanged_at_end_vpos
            = MATRIX_ROW_VPOS (first_unchanged_at_end_row, current_matrix);
-         xassert (stop_pos >= Z - END_UNCHANGED);
+         eassert (stop_pos >= Z - END_UNCHANGED);
        }
     }
   else if (last_unchanged_at_beg_row == NULL)
     GIVE_UP (19);
 
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
   /* Either there is no unchanged row at the end, or the one we have
      now displays text.  This is a necessary condition for the window
      end pos calculation at the end of this function.  */
-  xassert (first_unchanged_at_end_row == NULL
+  eassert (first_unchanged_at_end_row == NULL
           || MATRIX_ROW_DISPLAYS_TEXT_P (first_unchanged_at_end_row));
 
   debug_last_unchanged_at_beg_vpos
@@ -17355,7 +17467,7 @@ try_window_id (struct window *w)
        : -1);
   debug_first_unchanged_at_end_vpos = first_unchanged_at_end_vpos;
 
-#endif /* GLYPH_DEBUG != 0 */
+#endif /* GLYPH_DEBUG */
 
 
   /* Display new lines.  Set last_text_row to the last new line
@@ -17591,7 +17703,7 @@ try_window_id (struct window *w)
       struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos);
 
       /* If last_row is the window end line, it should display text.  */
-      xassert (last_row->displays_text_p);
+      eassert (last_row->displays_text_p);
 
       /* If window end line was partially visible before, begin
         displaying at that line.  Otherwise begin displaying with the
@@ -17638,16 +17750,16 @@ try_window_id (struct window *w)
         matrix.  Set row to the last row displaying text in current
         matrix starting at first_unchanged_at_end_row, after
         scrolling.  */
-      xassert (first_unchanged_at_end_row->displays_text_p);
+      eassert (first_unchanged_at_end_row->displays_text_p);
       row = find_last_row_displaying_text (w->current_matrix, &it,
                                           first_unchanged_at_end_row);
-      xassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
+      eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row));
 
       w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
       w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
       w->window_end_vpos
        = make_number (MATRIX_ROW_VPOS (row, w->current_matrix));
-      xassert (w->window_end_bytepos >= 0);
+      eassert (w->window_end_bytepos >= 0);
       IF_DEBUG (debug_method_add (w, "A"));
     }
   else if (last_text_row_at_end)
@@ -17658,7 +17770,7 @@ try_window_id (struct window *w)
        = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end);
       w->window_end_vpos
        = make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix));
-      xassert (w->window_end_bytepos >= 0);
+      eassert (w->window_end_bytepos >= 0);
       IF_DEBUG (debug_method_add (w, "B"));
     }
   else if (last_text_row)
@@ -17672,7 +17784,7 @@ try_window_id (struct window *w)
        = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row);
       w->window_end_vpos
        = make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix));
-      xassert (w->window_end_bytepos >= 0);
+      eassert (w->window_end_bytepos >= 0);
     }
   else if (first_unchanged_at_end_row == NULL
           && last_text_row == NULL
@@ -17698,11 +17810,11 @@ try_window_id (struct window *w)
            row  = current_row;
        }
 
-      xassert (row != NULL);
+      eassert (row != NULL);
       w->window_end_vpos = make_number (vpos + 1);
       w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row));
       w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
-      xassert (w->window_end_bytepos >= 0);
+      eassert (w->window_end_bytepos >= 0);
       IF_DEBUG (debug_method_add (w, "C"));
     }
   else
@@ -17725,7 +17837,7 @@ try_window_id (struct window *w)
                        More debugging support
  ***********************************************************************/
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 void dump_glyph_row (struct glyph_row *, int, int) EXTERNALLY_VISIBLE;
 void dump_glyph_matrix (struct glyph_matrix *, int) EXTERNALLY_VISIBLE;
@@ -17876,7 +17988,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
               row->visible_height,
               row->ascent,
               row->phys_ascent);
-      fprintf (stderr, "%9d %5d\t%5d\n", row->start.overlay_string_index,
+      fprintf (stderr, "%9"pD"d %5"pD"d\t%5d\n", row->start.overlay_string_index,
               row->end.overlay_string_index,
               row->continuation_lines_width);
       fprintf (stderr, "%9"pI"d %5"pI"d\n",
@@ -17912,7 +18024,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
 
       for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
        {
-         char *s = (char *) alloca (row->used[area] + 1);
+         char *s = alloca (row->used[area] + 1);
          int i;
 
          for (i = 0; i < row->used[area]; ++i)
@@ -17950,7 +18062,7 @@ glyphs in short form, otherwise show glyphs in long form.  */)
           w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos);
   fprintf (stderr, "=============================================\n");
   dump_glyph_matrix (w->current_matrix,
-                    NILP (glyphs) ? 0 : XINT (glyphs));
+                    TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 0);
   return Qnil;
 }
 
@@ -17973,7 +18085,7 @@ GLYPH > 1 or omitted means dump glyphs in long form.  */)
   (Lisp_Object row, Lisp_Object glyphs)
 {
   struct glyph_matrix *matrix;
-  int vpos;
+  EMACS_INT vpos;
 
   CHECK_NUMBER (row);
   matrix = XWINDOW (selected_window)->current_matrix;
@@ -17981,7 +18093,7 @@ GLYPH > 1 or omitted means dump glyphs in long form.  */)
   if (vpos >= 0 && vpos < matrix->nrows)
     dump_glyph_row (MATRIX_ROW (matrix, vpos),
                    vpos,
-                   INTEGERP (glyphs) ? XINT (glyphs) : 2);
+                   TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 2);
   return Qnil;
 }
 
@@ -17995,13 +18107,13 @@ GLYPH > 1 or omitted means dump glyphs in long form.  */)
 {
   struct frame *sf = SELECTED_FRAME ();
   struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix;
-  int vpos;
+  EMACS_INT vpos;
 
   CHECK_NUMBER (row);
   vpos = XINT (row);
   if (vpos >= 0 && vpos < m->nrows)
     dump_glyph_row (MATRIX_ROW (m, vpos), vpos,
-                   INTEGERP (glyphs) ? XINT (glyphs) : 2);
+                   TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 2);
   return Qnil;
 }
 
@@ -18104,11 +18216,8 @@ get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string)
 }
 
 
-/* Insert truncation glyphs at the start of IT->glyph_row.  Truncation
-   glyphs are only inserted for terminal frames since we can't really
-   win with truncation glyphs when partially visible glyphs are
-   involved.  Which glyphs to insert is determined by
-   produce_special_glyphs.  */
+/* Insert truncation glyphs at the start of IT->glyph_row.  Which
+   glyphs to insert is determined by produce_special_glyphs.  */
 
 static void
 insert_left_trunc_glyphs (struct it *it)
@@ -18116,7 +18225,11 @@ insert_left_trunc_glyphs (struct it *it)
   struct it truncate_it;
   struct glyph *from, *end, *to, *toend;
 
-  xassert (!FRAME_WINDOW_P (it->f));
+  eassert (!FRAME_WINDOW_P (it->f)
+          || (!it->glyph_row->reversed_p
+              && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0)
+          || (it->glyph_row->reversed_p
+              && WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0));
 
   /* Get the truncation glyphs.  */
   truncate_it = *it;
@@ -18131,20 +18244,65 @@ insert_left_trunc_glyphs (struct it *it)
   /* Overwrite glyphs from IT with truncation glyphs.  */
   if (!it->glyph_row->reversed_p)
     {
+      short tused = truncate_it.glyph_row->used[TEXT_AREA];
+
       from = truncate_it.glyph_row->glyphs[TEXT_AREA];
-      end = from + truncate_it.glyph_row->used[TEXT_AREA];
+      end = from + tused;
       to = it->glyph_row->glyphs[TEXT_AREA];
       toend = to + it->glyph_row->used[TEXT_AREA];
+      if (FRAME_WINDOW_P (it->f))
+       {
+         /* On GUI frames, when variable-size fonts are displayed,
+            the truncation glyphs may need more pixels than the row's
+            glyphs they overwrite.  We overwrite more glyphs to free
+            enough screen real estate, and enlarge the stretch glyph
+            on the right (see display_line), if there is one, to
+            preserve the screen position of the truncation glyphs on
+            the right.  */
+         int w = 0;
+         struct glyph *g = to;
+         short used;
+
+         /* The first glyph could be partially visible, in which case
+            it->glyph_row->x will be negative.  But we want the left
+            truncation glyphs to be aligned at the left margin of the
+            window, so we override the x coordinate at which the row
+            will begin.  */
+         it->glyph_row->x = 0;
+         while (g < toend && w < it->truncation_pixel_width)
+           {
+             w += g->pixel_width;
+             ++g;
+           }
+         if (g - to - tused > 0)
+           {
+             memmove (to + tused, g, (toend - g) * sizeof(*g));
+             it->glyph_row->used[TEXT_AREA] -= g - to - tused;
+           }
+         used = it->glyph_row->used[TEXT_AREA];
+         if (it->glyph_row->truncated_on_right_p
+             && WINDOW_RIGHT_FRINGE_WIDTH (it->w) == 0
+             && it->glyph_row->glyphs[TEXT_AREA][used - 2].type
+             == STRETCH_GLYPH)
+           {
+             int extra = w - it->truncation_pixel_width;
+
+             it->glyph_row->glyphs[TEXT_AREA][used - 2].pixel_width += extra;
+           }
+       }
 
       while (from < end)
        *to++ = *from++;
 
       /* There may be padding glyphs left over.  Overwrite them too.  */
-      while (to < toend && CHAR_GLYPH_PADDING_P (*to))
+      if (!FRAME_WINDOW_P (it->f))
        {
-         from = truncate_it.glyph_row->glyphs[TEXT_AREA];
-         while (from < end)
-           *to++ = *from++;
+         while (to < toend && CHAR_GLYPH_PADDING_P (*to))
+           {
+             from = truncate_it.glyph_row->glyphs[TEXT_AREA];
+             while (from < end)
+               *to++ = *from++;
+           }
        }
 
       if (to > toend)
@@ -18152,22 +18310,48 @@ insert_left_trunc_glyphs (struct it *it)
     }
   else
     {
+      short tused = truncate_it.glyph_row->used[TEXT_AREA];
+
       /* In R2L rows, overwrite the last (rightmost) glyphs, and do
         that back to front.  */
       end = truncate_it.glyph_row->glyphs[TEXT_AREA];
       from = end + truncate_it.glyph_row->used[TEXT_AREA] - 1;
       toend = it->glyph_row->glyphs[TEXT_AREA];
       to = toend + it->glyph_row->used[TEXT_AREA] - 1;
+      if (FRAME_WINDOW_P (it->f))
+       {
+         int w = 0;
+         struct glyph *g = to;
+
+         while (g >= toend && w < it->truncation_pixel_width)
+           {
+             w += g->pixel_width;
+             --g;
+           }
+         if (to - g - tused > 0)
+           to = g + tused;
+         if (it->glyph_row->truncated_on_right_p
+             && WINDOW_LEFT_FRINGE_WIDTH (it->w) == 0
+             && it->glyph_row->glyphs[TEXT_AREA][1].type == STRETCH_GLYPH)
+           {
+             int extra = w - it->truncation_pixel_width;
+
+             it->glyph_row->glyphs[TEXT_AREA][1].pixel_width += extra;
+           }
+       }
 
       while (from >= end && to >= toend)
        *to-- = *from--;
-      while (to >= toend && CHAR_GLYPH_PADDING_P (*to))
+      if (!FRAME_WINDOW_P (it->f))
        {
-         from =
-           truncate_it.glyph_row->glyphs[TEXT_AREA]
-           + truncate_it.glyph_row->used[TEXT_AREA] - 1;
-         while (from >= end && to >= toend)
-           *to-- = *from--;
+         while (to >= toend && CHAR_GLYPH_PADDING_P (*to))
+           {
+             from =
+               truncate_it.glyph_row->glyphs[TEXT_AREA]
+               + truncate_it.glyph_row->used[TEXT_AREA] - 1;
+             while (from >= end && to >= toend)
+               *to-- = *from--;
+           }
        }
       if (from >= end)
        {
@@ -18249,8 +18433,8 @@ compute_line_metrics (struct it *it)
       for (i = 0; i < row->used[TEXT_AREA]; ++i)
        row->pixel_width += row->glyphs[TEXT_AREA][i].pixel_width;
 
-      xassert (row->pixel_width >= 0);
-      xassert (row->ascent >= 0 && row->height > 0);
+      eassert (row->pixel_width >= 0);
+      eassert (row->ascent >= 0 && row->height > 0);
 
       row->overlapping_p = (MATRIX_ROW_OVERLAPS_SUCC_P (row)
                            || MATRIX_ROW_OVERLAPS_PRED_P (row));
@@ -18526,9 +18710,9 @@ extend_face_to_end_of_line (struct it *it)
    trailing whitespace.  */
 
 static int
-trailing_whitespace_p (EMACS_INT charpos)
+trailing_whitespace_p (ptrdiff_t charpos)
 {
-  EMACS_INT bytepos = CHAR_TO_BYTE (charpos);
+  ptrdiff_t bytepos = CHAR_TO_BYTE (charpos);
   int c = 0;
 
   while (bytepos < ZV_BYTE
@@ -18670,7 +18854,7 @@ cursor_row_p (struct glyph_row *row)
 
                        for ( ; glyph >= beg && EQ (glyph->object, s); --glyph)
                          {
-                           EMACS_INT gpos = glyph->charpos;
+                           ptrdiff_t gpos = glyph->charpos;
 
                            if (!NILP (Fget_char_property (make_number (gpos),
                                                           Qcursor, s)))
@@ -18723,7 +18907,7 @@ push_prefix_prop (struct it *it, Lisp_Object prop)
   struct text_pos pos =
     STRINGP (it->string) ? it->current.string_pos : it->current.pos;
 
-  xassert (it->method == GET_FROM_BUFFER
+  eassert (it->method == GET_FROM_BUFFER
           || it->method == GET_FROM_DISPLAY_VECTOR
           || it->method == GET_FROM_STRING);
 
@@ -18850,10 +19034,10 @@ unproduce_glyphs (struct it *it, int n)
 {
   struct glyph *glyph, *end;
 
-  xassert (it->glyph_row);
-  xassert (it->glyph_row->reversed_p);
-  xassert (it->area == TEXT_AREA);
-  xassert (n <= it->glyph_row->used[TEXT_AREA]);
+  eassert (it->glyph_row);
+  eassert (it->glyph_row->reversed_p);
+  eassert (it->area == TEXT_AREA);
+  eassert (n <= it->glyph_row->used[TEXT_AREA]);
 
   if (n > it->glyph_row->used[TEXT_AREA])
     n = it->glyph_row->used[TEXT_AREA];
@@ -18867,8 +19051,8 @@ unproduce_glyphs (struct it *it, int n)
    and ROW->maxpos.  */
 static void
 find_row_edges (struct it *it, struct glyph_row *row,
-               EMACS_INT min_pos, EMACS_INT min_bpos,
-               EMACS_INT max_pos, EMACS_INT max_bpos)
+               ptrdiff_t min_pos, ptrdiff_t min_bpos,
+               ptrdiff_t max_pos, ptrdiff_t max_bpos)
 {
   /* FIXME: Revisit this when glyph ``spilling'' in continuation
      lines' rows is implemented for bidi-reordered rows.  */
@@ -19035,14 +19219,14 @@ display_line (struct it *it)
   int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0);
   int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0);
   int wrap_row_extra_line_spacing IF_LINT (= 0);
-  EMACS_INT wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0);
-  EMACS_INT wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0);
+  ptrdiff_t wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0);
+  ptrdiff_t wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0);
   int cvpos;
-  EMACS_INT min_pos = ZV + 1, max_pos = 0;
-  EMACS_INT min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0);
+  ptrdiff_t min_pos = ZV + 1, max_pos = 0;
+  ptrdiff_t min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0);
 
   /* We always start displaying at hpos zero even if hscrolled.  */
-  xassert (it->hpos == 0 && it->current_x == 0);
+  eassert (it->hpos == 0 && it->current_x == 0);
 
   if (MATRIX_ROW_VPOS (row, it->w->desired_matrix)
       >= it->w->desired_matrix->nrows)
@@ -19077,9 +19261,22 @@ display_line (struct it *it)
      if the first glyph is partially visible or if we hit a line end.  */
   if (it->current_x < it->first_visible_x)
     {
+      enum move_it_result move_result;
+
       this_line_min_pos = row->start.pos;
-      move_it_in_display_line_to (it, ZV, it->first_visible_x,
-                                 MOVE_TO_POS | MOVE_TO_X);
+      move_result = move_it_in_display_line_to (it, ZV, it->first_visible_x,
+                                               MOVE_TO_POS | MOVE_TO_X);
+      /* If we are under a large hscroll, move_it_in_display_line_to
+        could hit the end of the line without reaching
+        it->first_visible_x.  Pretend that we did reach it.  This is
+        especially important on a TTY, where we will call
+        extend_face_to_end_of_line, which needs to know how many
+        blank glyphs to produce.  */
+      if (it->current_x < it->first_visible_x
+         && (move_result == MOVE_NEWLINE_OR_CR
+             || move_result == MOVE_POS_MATCH_OR_ZV))
+       it->current_x = it->first_visible_x;
+
       /* Record the smallest positions seen while we moved over
         display elements that are not visible.  This is needed by
         redisplay_internal for optimizing the case where the cursor
@@ -19112,10 +19309,10 @@ display_line (struct it *it)
     {                                                          \
       int composition_p = !STRINGP ((IT)->string)              \
        && ((IT)->what == IT_COMPOSITION);                      \
-      EMACS_INT current_pos =                                  \
+      ptrdiff_t current_pos =                                  \
        composition_p ? (IT)->cmp_it.charpos                    \
                      : IT_CHARPOS (*(IT));                     \
-      EMACS_INT current_bpos =                                 \
+      ptrdiff_t current_bpos =                                 \
        composition_p ? CHAR_TO_BYTE (current_pos)              \
                      : IT_BYTEPOS (*(IT));                     \
       if (current_pos < min_pos)                               \
@@ -19280,13 +19477,19 @@ display_line (struct it *it)
                      new_x > it->last_visible_x
                      /* Or it fits exactly on a window system frame.  */
                      || (new_x == it->last_visible_x
-                         && FRAME_WINDOW_P (it->f))))
+                         && FRAME_WINDOW_P (it->f)
+                         && (row->reversed_p
+                             ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                             : WINDOW_RIGHT_FRINGE_WIDTH (it->w)))))
                {
                  /* End of a continued line.  */
 
                  if (it->hpos == 0
                      || (new_x == it->last_visible_x
-                         && FRAME_WINDOW_P (it->f)))
+                         && FRAME_WINDOW_P (it->f)
+                         && (row->reversed_p
+                             ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                             : WINDOW_RIGHT_FRINGE_WIDTH (it->w))))
                    {
                      /* Current glyph is the only one on the line or
                         fits exactly on the line.  We must continue
@@ -19397,6 +19600,10 @@ display_line (struct it *it)
                         window system frames.  We leave the glyph in
                         this row and let it fill the row, but don't
                         consume the TAB.  */
+                     if ((row->reversed_p
+                          ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                          : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0)
+                       produce_special_glyphs (it, IT_CONTINUATION);
                      it->continuation_lines_width += it->last_visible_x;
                      row->ends_in_middle_of_char_p = 1;
                      row->continued_p = 1;
@@ -19414,12 +19621,15 @@ display_line (struct it *it)
                      row->used[TEXT_AREA] = n_glyphs_before + i;
 
                      /* Display continuation glyphs.  */
-                     if (!FRAME_WINDOW_P (it->f))
+                     it->current_x = x_before;
+                     it->continuation_lines_width += x;
+                     if (!FRAME_WINDOW_P (it->f)
+                         || (row->reversed_p
+                             ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                             : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0)
                        produce_special_glyphs (it, IT_CONTINUATION);
                      row->continued_p = 1;
 
-                     it->current_x = x_before;
-                     it->continuation_lines_width += x;
                      extend_face_to_end_of_line (it);
 
                      if (nglyphs > 1 && i > 0)
@@ -19461,7 +19671,7 @@ display_line (struct it *it)
                     move_it_in_display_line at the start of this
                     function, unless the text display area of the
                     window is empty.  */
-                 xassert (it->first_visible_x <= it->last_visible_x);
+                 eassert (it->first_visible_x <= it->last_visible_x);
                }
            }
          /* Even if this display element produced no glyphs at all,
@@ -19521,12 +19731,15 @@ display_line (struct it *it)
       /* If we truncate lines, we are done when the last displayed
         glyphs reach past the right margin of the window.  */
       if (it->line_wrap == TRUNCATE
-         && (FRAME_WINDOW_P (it->f)
+         && (FRAME_WINDOW_P (it->f) && WINDOW_RIGHT_FRINGE_WIDTH (it->w)
              ? (it->current_x >= it->last_visible_x)
              : (it->current_x > it->last_visible_x)))
        {
          /* Maybe add truncation glyphs.  */
-         if (!FRAME_WINDOW_P (it->f))
+         if (!FRAME_WINDOW_P (it->f)
+             || (row->reversed_p
+                 ? WINDOW_LEFT_FRINGE_WIDTH (it->w)
+                 : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0)
            {
              int i, n;
 
@@ -19551,7 +19764,16 @@ display_line (struct it *it)
                  i = row->used[TEXT_AREA] - (i + 1);
                }
 
-             for (n = row->used[TEXT_AREA]; i < n; ++i)
+             it->current_x = x_before;
+             if (!FRAME_WINDOW_P (it->f))
+               {
+                 for (n = row->used[TEXT_AREA]; i < n; ++i)
+                   {
+                     row->used[TEXT_AREA] = i;
+                     produce_special_glyphs (it, IT_TRUNCATION);
+                   }
+               }
+             else
                {
                  row->used[TEXT_AREA] = i;
                  produce_special_glyphs (it, IT_TRUNCATION);
@@ -19572,6 +19794,7 @@ display_line (struct it *it)
                  row->exact_window_width_line_p = 1;
                  goto at_end_of_line;
                }
+             it->current_x = x_before;
            }
 
          row->truncated_on_right_p = 1;
@@ -19579,7 +19802,6 @@ display_line (struct it *it)
          reseat_at_next_visible_line_start (it, 0);
          row->ends_at_zv_p = FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n';
          it->hpos = hpos_before;
-         it->current_x = x_before;
          break;
        }
     }
@@ -19592,7 +19814,10 @@ display_line (struct it *it)
   if (it->first_visible_x
       && IT_CHARPOS (*it) != CHARPOS (row->start.pos))
     {
-      if (!FRAME_WINDOW_P (it->f))
+      if (!FRAME_WINDOW_P (it->f)
+         || (row->reversed_p
+             ? WINDOW_RIGHT_FRINGE_WIDTH (it->w)
+             : WINDOW_LEFT_FRINGE_WIDTH (it->w)) == 0)
        insert_left_trunc_glyphs (it);
       row->truncated_on_left_p = 1;
     }
@@ -19653,7 +19878,7 @@ display_line (struct it *it)
        }
       else
        {
-         xassert (INTEGERP (overlay_arrow_string));
+         eassert (INTEGERP (overlay_arrow_string));
          row->overlay_arrow_bitmap = XINT (overlay_arrow_string);
        }
       overlay_arrow_seen = 1;
@@ -19763,8 +19988,8 @@ See also `bidi-paragraph-direction'.  */)
         use current_matrix if it is up to date, but this seems fast
         enough as it is.  */
       struct bidi_it itb;
-      EMACS_INT pos = BUF_PT (buf);
-      EMACS_INT bytepos = BUF_PT_BYTE (buf);
+      ptrdiff_t pos = BUF_PT (buf);
+      ptrdiff_t bytepos = BUF_PT_BYTE (buf);
       int c;
       void *itb_data = bidi_shelve_cache ();
 
@@ -19856,7 +20081,7 @@ display_menu_bar (struct window *w)
 #endif /* HAVE_NS */
 
 #ifdef USE_X_TOOLKIT
-  xassert (!FRAME_WINDOW_P (f));
+  eassert (!FRAME_WINDOW_P (f));
   init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID);
   it.first_visible_x = 0;
   it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
@@ -19866,7 +20091,7 @@ display_menu_bar (struct window *w)
       /* Menu bar lines are displayed in the desired matrix of the
         dummy window menu_bar_window.  */
       struct window *menu_w;
-      xassert (WINDOWP (f->menu_bar_window));
+      eassert (WINDOWP (f->menu_bar_window));
       menu_w = XWINDOW (f->menu_bar_window);
       init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
                     MENU_FACE_ID);
@@ -20052,7 +20277,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
 {
   struct it it;
   struct face *face;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   init_iterator (&it, w, -1, -1, NULL, face_id);
   /* Don't extend on a previously drawn mode-line.
@@ -20072,7 +20297,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format)
   it.paragraph_embedding = L2R;
 
   record_unwind_protect (unwind_format_mode_line,
-                        format_mode_line_unwind_data (NULL, Qnil, 0));
+                        format_mode_line_unwind_data (NULL, NULL, Qnil, 0));
 
   mode_line_target = MODE_LINE_DISPLAY;
 
@@ -20188,7 +20413,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
       {
        /* A string: output it and check for %-constructs within it.  */
        unsigned char c;
-       EMACS_INT offset = 0;
+       ptrdiff_t offset = 0;
 
        if (SCHARS (elt) > 0
            && (!NILP (props) || risky))
@@ -20285,7 +20510,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
               && (mode_line_target != MODE_LINE_DISPLAY
                   || it->current_x < it->last_visible_x))
          {
-           EMACS_INT last_offset = offset;
+           ptrdiff_t last_offset = offset;
 
            /* Advance to end of string or next format specifier.  */
            while ((c = SREF (elt, offset++)) != '\0' && c != '%')
@@ -20293,7 +20518,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
 
            if (offset - 1 != last_offset)
              {
-               EMACS_INT nchars, nbytes;
+               ptrdiff_t nchars, nbytes;
 
                /* Output to end of string or up to '%'.  Field width
                   is length of string.  Don't output more than
@@ -20312,9 +20537,9 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
                    break;
                  case MODE_LINE_STRING:
                    {
-                     EMACS_INT bytepos = last_offset;
-                     EMACS_INT charpos = string_byte_to_char (elt, bytepos);
-                     EMACS_INT endpos = (precision <= 0
+                     ptrdiff_t bytepos = last_offset;
+                     ptrdiff_t charpos = string_byte_to_char (elt, bytepos);
+                     ptrdiff_t endpos = (precision <= 0
                                          ? string_byte_to_char (elt, offset)
                                          : charpos + nchars);
 
@@ -20326,8 +20551,8 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
                    break;
                  case MODE_LINE_DISPLAY:
                    {
-                     EMACS_INT bytepos = last_offset;
-                     EMACS_INT charpos = string_byte_to_char (elt, bytepos);
+                     ptrdiff_t bytepos = last_offset;
+                     ptrdiff_t charpos = string_byte_to_char (elt, bytepos);
 
                      if (precision <= 0)
                        nchars = string_byte_to_char (elt, offset) - charpos;
@@ -20340,7 +20565,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
              }
            else /* c == '%' */
              {
-               EMACS_INT percent_position = offset;
+               ptrdiff_t percent_position = offset;
 
                /* Get the specified minimum width.  Zero means
                   don't pad.  */
@@ -20362,7 +20587,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision,
                else if (c != 0)
                  {
                    int multibyte;
-                   EMACS_INT bytepos, charpos;
+                   ptrdiff_t bytepos, charpos;
                    const char *spec;
                    Lisp_Object string;
 
@@ -20635,7 +20860,7 @@ static int
 store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string,
                        int field_width, int precision, Lisp_Object props)
 {
-  EMACS_INT len;
+  ptrdiff_t len;
   int n = 0;
 
   if (string != NULL)
@@ -20736,7 +20961,7 @@ are the selected window and the WINDOW's buffer).  */)
   struct buffer *old_buffer = NULL;
   int face_id;
   int no_props = INTEGERP (face);
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object str;
   int string_start = 0;
 
@@ -20773,7 +20998,8 @@ are the selected window and the WINDOW's buffer).  */)
      and set that to nil so that we don't alter the outer value.  */
   record_unwind_protect (unwind_format_mode_line,
                         format_mode_line_unwind_data
-                            (old_buffer, selected_window, 1));
+                          (XFRAME (WINDOW_FRAME (XWINDOW (window))),
+                           old_buffer, selected_window, 1));
   mode_line_proptrans_alist = Qnil;
 
   Fselect_window (window, Qt);
@@ -20822,7 +21048,7 @@ are the selected window and the WINDOW's buffer).  */)
    the positive integer D to BUF using a minimal field width WIDTH.  */
 
 static void
-pint2str (register char *buf, register int width, register EMACS_INT d)
+pint2str (register char *buf, register int width, register ptrdiff_t d)
 {
   register char *p = buf;
 
@@ -20866,11 +21092,11 @@ static const char power_letter[] =
   };
 
 static void
-pint2hrstr (char *buf, int width, EMACS_INT d)
+pint2hrstr (char *buf, int width, ptrdiff_t d)
 {
   /* We aim to represent the nonnegative integer D as
      QUOTIENT.TENTHS * 10 ^ (3 * EXPONENT). */
-  EMACS_INT quotient = d;
+  ptrdiff_t quotient = d;
   int remainder = 0;
   /* -1 means: do not use TENTHS. */
   int tenths = -1;
@@ -20980,8 +21206,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
 
   if (!VECTORP (val))          /* Not yet decided.  */
     {
-      if (multibyte)
-       *buf++ = '-';
+      *buf++ = multibyte ? '-' : ' ';
       if (eol_flag)
        eoltype = eol_mnemonic_undecided;
       /* Don't mention EOL conversion if it isn't decided.  */
@@ -20994,8 +21219,9 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
       attrs = AREF (val, 0);
       eolvalue = AREF (val, 2);
 
-      if (multibyte)
-       *buf++ = XFASTINT (CODING_ATTR_MNEMONIC (attrs));
+      *buf++ = multibyte
+       ? XFASTINT (CODING_ATTR_MNEMONIC (attrs))
+       : ' ';
 
       if (eol_flag)
        {
@@ -21023,7 +21249,7 @@ decode_mode_spec_coding (Lisp_Object coding_system, register char *buf, int eol_
        }
       else if (CHARACTERP (eoltype))
        {
-         unsigned char *tmp = (unsigned char *) alloca (MAX_MULTIBYTE_LENGTH);
+         unsigned char *tmp = alloca (MAX_MULTIBYTE_LENGTH);
          int c = XFASTINT (eoltype);
          eol_str_len = CHAR_STRING (c, tmp);
          eol_str = tmp;
@@ -21150,7 +21376,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
        return "";
       else
        {
-         EMACS_INT col = current_column ();
+         ptrdiff_t col = current_column ();
          w->column_number_displayed = make_number (col);
          pint2str (decode_mode_spec_buf, field_width, col);
          return decode_mode_spec_buf;
@@ -21182,23 +21408,23 @@ decode_mode_spec (struct window *w, register int c, int field_width,
 
     case 'i':
       {
-       EMACS_INT size = ZV - BEGV;
+       ptrdiff_t size = ZV - BEGV;
        pint2str (decode_mode_spec_buf, field_width, size);
        return decode_mode_spec_buf;
       }
 
     case 'I':
       {
-       EMACS_INT size = ZV - BEGV;
+       ptrdiff_t size = ZV - BEGV;
        pint2hrstr (decode_mode_spec_buf, field_width, size);
        return decode_mode_spec_buf;
       }
 
     case 'l':
       {
-       EMACS_INT startpos, startpos_byte, line, linepos, linepos_byte;
-       EMACS_INT topline, nlines, height;
-       EMACS_INT junk;
+       ptrdiff_t startpos, startpos_byte, line, linepos, linepos_byte;
+       ptrdiff_t topline, nlines, height;
+       ptrdiff_t junk;
 
        /* %c and %l are ignored in `frame-title-format'.  */
        if (mode_line_target == MODE_LINE_TITLE)
@@ -21259,10 +21485,10 @@ decode_mode_spec (struct window *w, register int c, int field_width,
        else if (nlines < height + 25 || nlines > height * 3 + 50
                 || linepos == BUF_BEGV (b))
          {
-           EMACS_INT limit = BUF_BEGV (b);
-           EMACS_INT limit_byte = BUF_BEGV_BYTE (b);
-           EMACS_INT position;
-           EMACS_INT distance =
+           ptrdiff_t limit = BUF_BEGV (b);
+           ptrdiff_t limit_byte = BUF_BEGV_BYTE (b);
+           ptrdiff_t position;
+           ptrdiff_t distance =
              (height * 2 + 30) * line_number_display_limit_width;
 
            if (startpos - distance > limit)
@@ -21324,8 +21550,8 @@ decode_mode_spec (struct window *w, register int c, int field_width,
 
     case 'p':
       {
-       EMACS_INT pos = marker_position (w->start);
-       EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b);
+       ptrdiff_t pos = marker_position (w->start);
+       ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b);
 
        if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b))
          {
@@ -21347,7 +21573,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
               so get us a 2-digit number that is close.  */
            if (total == 100)
              total = 99;
-           sprintf (decode_mode_spec_buf, "%2"pI"d%%", total);
+           sprintf (decode_mode_spec_buf, "%2"pD"d%%", total);
            return decode_mode_spec_buf;
          }
       }
@@ -21355,9 +21581,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
       /* Display percentage of size above the bottom of the screen.  */
     case 'P':
       {
-       EMACS_INT toppos = marker_position (w->start);
-       EMACS_INT botpos = BUF_Z (b) - XFASTINT (w->window_end_pos);
-       EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b);
+       ptrdiff_t toppos = marker_position (w->start);
+       ptrdiff_t botpos = BUF_Z (b) - XFASTINT (w->window_end_pos);
+       ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b);
 
        if (botpos >= BUF_ZV (b))
          {
@@ -21378,9 +21604,9 @@ decode_mode_spec (struct window *w, register int c, int field_width,
            if (total == 100)
              total = 99;
            if (toppos <= BUF_BEGV (b))
-             sprintf (decode_mode_spec_buf, "Top%2"pI"d%%", total);
+             sprintf (decode_mode_spec_buf, "Top%2"pD"d%%", total);
            else
-             sprintf (decode_mode_spec_buf, "%2"pI"d%%", total);
+             sprintf (decode_mode_spec_buf, "%2"pD"d%%", total);
            return decode_mode_spec_buf;
          }
       }
@@ -21397,7 +21623,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
 
     case '@':
       {
-       int count = inhibit_garbage_collection ();
+       ptrdiff_t count = inhibit_garbage_collection ();
        Lisp_Object val = call1 (intern ("file-remote-p"),
                                 BVAR (current_buffer, directory));
        unbind_to (count, Qnil);
@@ -21466,17 +21692,17 @@ decode_mode_spec (struct window *w, register int c, int field_width,
 
    Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT.  */
 
-static EMACS_INT
-display_count_lines (EMACS_INT start_byte,
-                    EMACS_INT limit_byte, EMACS_INT count,
-                    EMACS_INT *byte_pos_ptr)
+static ptrdiff_t
+display_count_lines (ptrdiff_t start_byte,
+                    ptrdiff_t limit_byte, ptrdiff_t count,
+                    ptrdiff_t *byte_pos_ptr)
 {
   register unsigned char *cursor;
   unsigned char *base;
 
-  register EMACS_INT ceiling;
+  register ptrdiff_t ceiling;
   register unsigned char *ceiling_addr;
-  EMACS_INT orig_count = count;
+  ptrdiff_t orig_count = count;
 
   /* If we are not in selective display mode,
      check only for newlines.  */
@@ -21610,13 +21836,13 @@ display_count_lines (EMACS_INT start_byte,
 
 static int
 display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_string,
-               EMACS_INT face_string_pos, EMACS_INT start, struct it *it,
+               ptrdiff_t face_string_pos, ptrdiff_t start, struct it *it,
                int field_width, int precision, int max_x, int multibyte)
 {
   int hpos_at_start = it->hpos;
   int saved_face_id = it->face_id;
   struct glyph_row *row = it->glyph_row;
-  EMACS_INT it_charpos;
+  ptrdiff_t it_charpos;
 
   /* Initialize the iterator IT for iteration over STRING beginning
      with index START.  */
@@ -21631,7 +21857,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
      FACE_STRING, if that's given.  */
   if (STRINGP (face_string))
     {
-      EMACS_INT endptr;
+      ptrdiff_t endptr;
       struct face *face;
 
       it->face_id
@@ -21800,7 +22026,10 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
   if (it->first_visible_x
       && it_charpos > 0)
     {
-      if (!FRAME_WINDOW_P (it->f))
+      if (!FRAME_WINDOW_P (it->f)
+         || (row->reversed_p
+             ? WINDOW_RIGHT_FRINGE_WIDTH (it->w)
+             : WINDOW_LEFT_FRINGE_WIDTH (it->w)) == 0)
        insert_left_trunc_glyphs (it);
       row->truncated_on_left_p = 1;
     }
@@ -21961,7 +22190,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
   if (NILP (prop))
     return OK_PIXELS (0);
 
-  xassert (FRAME_LIVE_P (it->f));
+  eassert (FRAME_LIVE_P (it->f));
 
   if (SYMBOLP (prop))
     {
@@ -22060,7 +22289,9 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
            return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w));
        }
 
-      prop = Fbuffer_local_value (prop, it->w->buffer);
+      prop = buffer_local_value_1 (prop, it->w->buffer);
+      if (EQ (prop, Qunbound))
+       prop = Qnil;
     }
 
   if (INTEGERP (prop) || FLOATP (prop))
@@ -22110,7 +22341,9 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
              return OK_PIXELS (pixels);
            }
 
-         car = Fbuffer_local_value (car, it->w->buffer);
+         car = buffer_local_value_1 (car, it->w->buffer);
+         if (EQ (car, Qunbound))
+           car = Qnil;
        }
 
       if (INTEGERP (car) || FLOATP (car))
@@ -22138,7 +22371,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop,
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 void
 dump_glyph_string (struct glyph_string *s)
@@ -22284,7 +22517,7 @@ get_char_face_and_encoding (struct frame *f, int c, int face_id,
   if (display_p)
 #endif
     {
-      xassert (face != NULL);
+      eassert (face != NULL);
       PREPARE_FACE_FOR_DISPLAY (f, face);
     }
 
@@ -22302,7 +22535,7 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
 {
   struct face *face;
 
-  xassert (glyph->type == CHAR_GLYPH);
+  eassert (glyph->type == CHAR_GLYPH);
   face = FACE_FROM_ID (f, glyph->face_id);
 
   if (two_byte_p)
@@ -22324,7 +22557,7 @@ get_glyph_face_and_encoding (struct frame *f, struct glyph *glyph,
     }
 
   /* Make sure X resources of the face are allocated.  */
-  xassert (face != NULL);
+  eassert (face != NULL);
   PREPARE_FACE_FOR_DISPLAY (f, face);
   return face;
 }
@@ -22370,7 +22603,7 @@ fill_composite_glyph_string (struct glyph_string *s, struct face *base_face,
      glyph that requires the different face, add it to S.  */
   struct face *face;
 
-  xassert (s);
+  eassert (s);
 
   s->for_overlaps = overlaps;
   s->face = NULL;
@@ -22480,13 +22713,13 @@ fill_glyphless_glyph_string (struct glyph_string *s, int face_id,
   struct glyph *glyph, *last;
   int voffset;
 
-  xassert (s->first_glyph->type == GLYPHLESS_GLYPH);
+  eassert (s->first_glyph->type == GLYPHLESS_GLYPH);
   s->for_overlaps = overlaps;
   glyph = s->row->glyphs[s->area] + start;
   last = s->row->glyphs[s->area] + end;
   voffset = glyph->voffset;
   s->face = FACE_FROM_ID (s->f, face_id);
-  s->font = s->face->font;
+  s->font = s->face->font ? s->face->font : FRAME_FONT (s->f);
   s->nchars = 1;
   s->width = glyph->pixel_width;
   glyph++;
@@ -22521,9 +22754,9 @@ fill_glyph_string (struct glyph_string *s, int face_id,
   int voffset;
   int glyph_not_available_p;
 
-  xassert (s->f == XFRAME (s->w->frame));
-  xassert (s->nchars == 0);
-  xassert (start >= 0 && end > start);
+  eassert (s->f == XFRAME (s->w->frame));
+  eassert (s->nchars == 0);
+  eassert (start >= 0 && end > start);
 
   s->for_overlaps = overlaps;
   glyph = s->row->glyphs[s->area] + start;
@@ -22546,7 +22779,7 @@ fill_glyph_string (struct glyph_string *s, int face_id,
                                               &two_byte_p);
       s->two_byte_p = two_byte_p;
       ++s->nchars;
-      xassert (s->nchars <= end - start);
+      eassert (s->nchars <= end - start);
       s->width += glyph->pixel_width;
       if (glyph++->padding_p != s->padding_p)
        break;
@@ -22567,7 +22800,7 @@ fill_glyph_string (struct glyph_string *s, int face_id,
   /* Adjust base line for subscript/superscript text.  */
   s->ybase += voffset;
 
-  xassert (s->face && s->face->gc);
+  eassert (s->face && s->face->gc);
   return glyph - s->row->glyphs[s->area];
 }
 
@@ -22577,9 +22810,9 @@ fill_glyph_string (struct glyph_string *s, int face_id,
 static void
 fill_image_glyph_string (struct glyph_string *s)
 {
-  xassert (s->first_glyph->type == IMAGE_GLYPH);
+  eassert (s->first_glyph->type == IMAGE_GLYPH);
   s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id);
-  xassert (s->img);
+  eassert (s->img);
   s->slice = s->first_glyph->slice.img;
   s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
   s->font = s->face->font;
@@ -22603,7 +22836,7 @@ fill_stretch_glyph_string (struct glyph_string *s, int start, int end)
   struct glyph *glyph, *last;
   int voffset, face_id;
 
-  xassert (s->first_glyph->type == STRETCH_GLYPH);
+  eassert (s->first_glyph->type == STRETCH_GLYPH);
 
   glyph = s->row->glyphs[s->area] + start;
   last = s->row->glyphs[s->area] + end;
@@ -22627,7 +22860,7 @@ fill_stretch_glyph_string (struct glyph_string *s, int start, int end)
 
   /* The case that face->gc == 0 is handled when drawing the glyph
      string by calling PREPARE_FACE_FOR_DISPLAY.  */
-  xassert (s->face);
+  eassert (s->face);
   return glyph - s->row->glyphs[s->area];
 }
 
@@ -22892,7 +23125,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
 #define BUILD_STRETCH_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X)   \
      do                                                                            \
        {                                                                   \
-        s = (struct glyph_string *) alloca (sizeof *s);                    \
+        s = alloca (sizeof *s);                                            \
         INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL);              \
         START = fill_stretch_glyph_string (s, START, END);                 \
         append_glyph_string (&HEAD, &TAIL, s);                             \
@@ -22912,7 +23145,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
 #define BUILD_IMAGE_GLYPH_STRING(START, END, HEAD, TAIL, HL, X, LAST_X) \
      do                                                                        \
        {                                                               \
-        s = (struct glyph_string *) alloca (sizeof *s);                \
+        s = alloca (sizeof *s);                                        \
         INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL);          \
         fill_image_glyph_string (s);                                   \
         append_glyph_string (&HEAD, &TAIL, s);                         \
@@ -22939,8 +23172,8 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
                                                                           \
         face_id = (row)->glyphs[area][START].face_id;                     \
                                                                           \
-        s = (struct glyph_string *) alloca (sizeof *s);                   \
-        char2b = (XChar2b *) alloca ((END - START) * sizeof *char2b);     \
+        s = alloca (sizeof *s);                                           \
+        char2b = alloca ((END - START) * sizeof *char2b);                 \
         INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL);           \
         append_glyph_string (&HEAD, &TAIL, s);                            \
         s->x = (X);                                                       \
@@ -22968,13 +23201,13 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
     struct glyph_string *first_s = NULL;                                   \
     int n;                                                                 \
                                                                            \
-    char2b = (XChar2b *) alloca ((sizeof *char2b) * cmp->glyph_len);       \
+    char2b = alloca (cmp->glyph_len * sizeof *char2b);                     \
                                                                            \
     /* Make glyph_strings for each glyph sequence that is drawable by      \
        the same face, and append them to HEAD/TAIL.  */                            \
     for (n = 0; n < cmp->glyph_len;)                                       \
       {                                                                            \
-       s = (struct glyph_string *) alloca (sizeof *s);                     \
+       s = alloca (sizeof *s);                                             \
        INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL);             \
        append_glyph_string (&(HEAD), &(TAIL), s);                          \
        s->cmp = cmp;                                                       \
@@ -23002,9 +23235,8 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
     face_id = (row)->glyphs[area][START].face_id;                        \
     gstring = (composition_gstring_from_id                               \
               ((row)->glyphs[area][START].u.cmp.id));                    \
-    s = (struct glyph_string *) alloca (sizeof *s);                      \
-    char2b = (XChar2b *) alloca ((sizeof *char2b)                        \
-                                * LGSTRING_GLYPH_LEN (gstring));         \
+    s = alloca (sizeof *s);                                              \
+    char2b = alloca (LGSTRING_GLYPH_LEN (gstring) * sizeof *char2b);     \
     INIT_GLYPH_STRING (s, char2b, w, row, area, START, HL);              \
     append_glyph_string (&(HEAD), &(TAIL), s);                           \
     s->x = (X);                                                                  \
@@ -23023,7 +23255,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
                                                                            \
       face_id = (row)->glyphs[area][START].face_id;                        \
                                                                            \
-      s = (struct glyph_string *) alloca (sizeof *s);                      \
+      s = alloca (sizeof *s);                                              \
       INIT_GLYPH_STRING (s, NULL, w, row, area, START, HL);                \
       append_glyph_string (&HEAD, &TAIL, s);                               \
       s->x = (X);                                                          \
@@ -23118,7 +23350,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p)
 
 static int
 draw_glyphs (struct window *w, int x, struct glyph_row *row,
-            enum glyph_row_area area, EMACS_INT start, EMACS_INT end,
+            enum glyph_row_area area, ptrdiff_t start, ptrdiff_t end,
             enum draw_glyphs_face hl, int overlaps)
 {
   struct glyph_string *head, *tail;
@@ -23373,8 +23605,8 @@ append_glyph (struct it *it)
   struct glyph *glyph;
   enum glyph_row_area area = it->area;
 
-  xassert (it->glyph_row);
-  xassert (it->char_to_display != '\n' && it->char_to_display != '\t');
+  eassert (it->glyph_row);
+  eassert (it->char_to_display != '\n' && it->char_to_display != '\t');
 
   glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
   if (glyph < it->glyph_row->glyphs[area + 1])
@@ -23447,7 +23679,7 @@ append_composite_glyph (struct it *it)
   struct glyph *glyph;
   enum glyph_row_area area = it->area;
 
-  xassert (it->glyph_row);
+  eassert (it->glyph_row);
 
   glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
   if (glyph < it->glyph_row->glyphs[area + 1])
@@ -23539,10 +23771,10 @@ produce_image_glyph (struct it *it)
   int glyph_ascent, crop;
   struct glyph_slice slice;
 
-  xassert (it->what == IT_IMAGE);
+  eassert (it->what == IT_IMAGE);
 
   face = FACE_FROM_ID (it->f, it->face_id);
-  xassert (face);
+  eassert (face);
   /* Make sure X resources of the face is loaded.  */
   PREPARE_FACE_FOR_DISPLAY (it->f, face);
 
@@ -23557,7 +23789,7 @@ produce_image_glyph (struct it *it)
     }
 
   img = IMAGE_FROM_ID (it->f, it->image_id);
-  xassert (img);
+  eassert (img);
   /* Make sure X resources of the image is loaded.  */
   prepare_image_for_display (it->f, img);
 
@@ -23698,7 +23930,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
   struct glyph *glyph;
   enum glyph_row_area area = it->area;
 
-  xassert (ascent >= 0 && ascent <= height);
+  eassert (ascent >= 0 && ascent <= height);
 
   glyph = it->glyph_row->glyphs[area] + it->glyph_row->used[area];
   if (glyph < it->glyph_row->glyphs[area + 1])
@@ -23808,7 +24040,7 @@ produce_stretch_glyph (struct it *it)
 #endif
 
   /* List should start with `space'.  */
-  xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
+  eassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
   plist = XCDR (it->object);
 
   /* Compute the width of the stretch.  */
@@ -23947,6 +24179,102 @@ produce_stretch_glyph (struct it *it)
     it->nglyphs = width;
 }
 
+/* Get information about special display element WHAT in an
+   environment described by IT.  WHAT is one of IT_TRUNCATION or
+   IT_CONTINUATION.  Maybe produce glyphs for WHAT if IT has a
+   non-null glyph_row member.  This function ensures that fields like
+   face_id, c, len of IT are left untouched.  */
+
+static void
+produce_special_glyphs (struct it *it, enum display_element_type what)
+{
+  struct it temp_it;
+  Lisp_Object gc;
+  GLYPH glyph;
+
+  temp_it = *it;
+  temp_it.object = make_number (0);
+  memset (&temp_it.current, 0, sizeof temp_it.current);
+
+  if (what == IT_CONTINUATION)
+    {
+      /* Continuation glyph.  For R2L lines, we mirror it by hand.  */
+      if (it->bidi_it.paragraph_dir == R2L)
+       SET_GLYPH_FROM_CHAR (glyph, '/');
+      else
+       SET_GLYPH_FROM_CHAR (glyph, '\\');
+      if (it->dp
+         && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)))
+       {
+         /* FIXME: Should we mirror GC for R2L lines?  */
+         SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
+         spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
+       }
+    }
+  else if (what == IT_TRUNCATION)
+    {
+      /* Truncation glyph.  */
+      SET_GLYPH_FROM_CHAR (glyph, '$');
+      if (it->dp
+         && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)))
+       {
+         /* FIXME: Should we mirror GC for R2L lines?  */
+         SET_GLYPH_FROM_GLYPH_CODE (glyph, gc);
+         spec_glyph_lookup_face (XWINDOW (it->window), &glyph);
+       }
+    }
+  else
+    abort ();
+
+#ifdef HAVE_WINDOW_SYSTEM
+  /* On a GUI frame, when the right fringe (left fringe for R2L rows)
+     is turned off, we precede the truncation/continuation glyphs by a
+     stretch glyph whose width is computed such that these special
+     glyphs are aligned at the window margin, even when very different
+     fonts are used in different glyph rows.  */
+  if (FRAME_WINDOW_P (temp_it.f)
+      /* init_iterator calls this with it->glyph_row == NULL, and it
+        wants only the pixel width of the truncation/continuation
+        glyphs.  */
+      && temp_it.glyph_row
+      /* insert_left_trunc_glyphs calls us at the beginning of the
+        row, and it has its own calculation of the stretch glyph
+        width.  */
+      && temp_it.glyph_row->used[TEXT_AREA] > 0
+      && (temp_it.glyph_row->reversed_p
+         ? WINDOW_LEFT_FRINGE_WIDTH (temp_it.w)
+         : WINDOW_RIGHT_FRINGE_WIDTH (temp_it.w)) == 0)
+    {
+      int stretch_width = temp_it.last_visible_x - temp_it.current_x;
+
+      if (stretch_width > 0)
+       {
+         struct face *face = FACE_FROM_ID (temp_it.f, temp_it.face_id);
+         struct font *font =
+           face->font ? face->font : FRAME_FONT (temp_it.f);
+         int stretch_ascent =
+           (((temp_it.ascent + temp_it.descent)
+             * FONT_BASE (font)) / FONT_HEIGHT (font));
+
+         append_stretch_glyph (&temp_it, make_number (0), stretch_width,
+                               temp_it.ascent + temp_it.descent,
+                               stretch_ascent);
+       }
+    }
+#endif
+
+  temp_it.dp = NULL;
+  temp_it.what = IT_CHARACTER;
+  temp_it.len = 1;
+  temp_it.c = temp_it.char_to_display = GLYPH_CHAR (glyph);
+  temp_it.face_id = GLYPH_FACE (glyph);
+  temp_it.len = CHAR_BYTES (temp_it.c);
+
+  PRODUCE_GLYPHS (&temp_it);
+  it->pixel_width = temp_it.pixel_width;
+  it->nglyphs = temp_it.pixel_width;
+}
+
 #ifdef HAVE_WINDOW_SYSTEM
 
 /* Calculate line-height and line-spacing properties.
@@ -24187,7 +24515,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
        }
       else
        {
-         xassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
+         eassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE);
          sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c);
          str = buf;
        }
@@ -24289,7 +24617,7 @@ x_produce_glyphs (struct it *it)
             Vglyphless_char_display.  */
          Lisp_Object acronym = lookup_glyphless_char_display (-1, it);
 
-         xassert (it->what == IT_GLYPHLESS);
+         eassert (it->what == IT_GLYPHLESS);
          produce_glyphless_glyph (it, 1, STRINGP (acronym) ? acronym : Qnil);
          goto done;
        }
@@ -24582,7 +24910,7 @@ x_produce_glyphs (struct it *it)
          XChar2b char2b;
          struct font_metrics *pcm;
          int font_not_found_p;
-         EMACS_INT pos;
+         ptrdiff_t pos;
 
          for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--)
            if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t')
@@ -24914,7 +25242,7 @@ x_produce_glyphs (struct it *it)
  done:
   /* Accumulate dimensions.  Note: can't assume that it->descent > 0
      because this isn't true for images with `:ascent 100'.  */
-  xassert (it->ascent >= 0 && it->descent >= 0);
+  eassert (it->ascent >= 0 && it->descent >= 0);
   if (it->area == TEXT_AREA)
     it->current_x += it->pixel_width;
 
@@ -24943,7 +25271,7 @@ x_write_glyphs (struct glyph *start, int len)
 {
   int x, hpos, chpos = updated_window->phys_cursor.hpos;
 
-  xassert (updated_window && updated_row);
+  eassert (updated_window && updated_row);
   /* When the window is hscrolled, cursor hpos can legitimately be out
      of bounds, but we draw the cursor at the corresponding window
      margin in that case.  */
@@ -24990,9 +25318,9 @@ x_insert_glyphs (struct glyph *start, int len)
   struct glyph_row *row;
   struct glyph *glyph;
   int frame_x, frame_y;
-  EMACS_INT hpos;
+  ptrdiff_t hpos;
 
-  xassert (updated_window && updated_row);
+  eassert (updated_window && updated_row);
   BLOCK_INPUT;
   w = updated_window;
   f = XFRAME (WINDOW_FRAME (w));
@@ -25047,7 +25375,7 @@ x_clear_end_of_line (int to_x)
   int max_x, min_y, max_y;
   int from_x, from_y, to_y;
 
-  xassert (updated_window && updated_row);
+  eassert (updated_window && updated_row);
   f = XFRAME (w->frame);
 
   if (updated_row->full_width_p)
@@ -25137,8 +25465,7 @@ get_specified_cursor_type (Lisp_Object arg, int *width)
 
   if (CONSP (arg)
       && EQ (XCAR (arg), Qbar)
-      && INTEGERP (XCDR (arg))
-      && XINT (XCDR (arg)) >= 0)
+      && RANGED_INTEGERP (0, XCDR (arg), INT_MAX))
     {
       *width = XINT (XCDR (arg));
       return BAR_CURSOR;
@@ -25152,8 +25479,7 @@ get_specified_cursor_type (Lisp_Object arg, int *width)
 
   if (CONSP (arg)
       && EQ (XCAR (arg), Qhbar)
-      && INTEGERP (XCDR (arg))
-      && XINT (XCDR (arg)) >= 0)
+      && RANGED_INTEGERP (0, XCDR (arg), INT_MAX))
     {
       *width = XINT (XCDR (arg));
       return HBAR_CURSOR;
@@ -25674,7 +26000,7 @@ display_and_set_cursor (struct window *w, int on,
       || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA]))
     glyph = glyph_row->glyphs[TEXT_AREA] + hpos;
 
-  xassert (interrupt_input_blocked);
+  eassert (interrupt_input_blocked);
 
   /* Set new_cursor_type to the cursor we want to be displayed.  */
   new_cursor_type = get_window_cursor_type (w, glyph,
@@ -25811,7 +26137,7 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row,
       return;
     }
 #endif
-#if defined (HAVE_GPM) || defined (MSDOS)
+#if defined (HAVE_GPM) || defined (MSDOS) || defined (WINDOWSNT)
   tty_draw_row_with_mouse_face (w, row, start_hpos, end_hpos, draw);
 #endif
 }
@@ -26050,7 +26376,7 @@ cursor_in_mouse_face_p (struct window *w)
    buffer positions change non-linearly with glyph rows.  */
 static void
 rows_from_pos_range (struct window *w,
-                    EMACS_INT start_charpos, EMACS_INT end_charpos,
+                    ptrdiff_t start_charpos, ptrdiff_t end_charpos,
                     Lisp_Object disp_string,
                     struct glyph_row **start, struct glyph_row **end)
 {
@@ -26126,7 +26452,7 @@ rows_from_pos_range (struct window *w,
   for ( ; row->enabled_p && MATRIX_ROW_BOTTOM_Y (row) <= last_y; row++)
     {
       struct glyph_row *next = row + 1;
-      EMACS_INT next_start = MATRIX_ROW_START_CHARPOS (next);
+      ptrdiff_t next_start = MATRIX_ROW_START_CHARPOS (next);
 
       if (!next->enabled_p
          || next >= MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w)
@@ -26207,9 +26533,9 @@ rows_from_pos_range (struct window *w,
 static void
 mouse_face_from_buffer_pos (Lisp_Object window,
                            Mouse_HLInfo *hlinfo,
-                           EMACS_INT mouse_charpos,
-                           EMACS_INT start_charpos,
-                           EMACS_INT end_charpos,
+                           ptrdiff_t mouse_charpos,
+                           ptrdiff_t start_charpos,
+                           ptrdiff_t end_charpos,
                            Lisp_Object before_string,
                            Lisp_Object after_string,
                            Lisp_Object disp_string)
@@ -26218,12 +26544,12 @@ mouse_face_from_buffer_pos (Lisp_Object window,
   struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
   struct glyph_row *r1, *r2;
   struct glyph *glyph, *end;
-  EMACS_INT ignore, pos;
+  ptrdiff_t ignore, pos;
   int x;
 
-  xassert (NILP (disp_string) || STRINGP (disp_string));
-  xassert (NILP (before_string) || STRINGP (before_string));
-  xassert (NILP (after_string) || STRINGP (after_string));
+  eassert (NILP (disp_string) || STRINGP (disp_string));
+  eassert (NILP (before_string) || STRINGP (before_string));
+  eassert (NILP (after_string) || STRINGP (after_string));
 
   /* Find the rows corresponding to START_CHARPOS and END_CHARPOS.  */
   rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2);
@@ -26551,7 +26877,7 @@ mouse_face_from_buffer_pos (Lisp_Object window,
    Value is non-zero if a glyph was found.  */
 
 static int
-fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object,
+fast_find_string_pos (struct window *w, ptrdiff_t pos, Lisp_Object object,
                      int *hpos, int *vpos, int *x, int *y, int right_p)
 {
   int yb = window_text_bottom_y (w);
@@ -26621,7 +26947,7 @@ fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object,
 static void
 mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo,
                            Lisp_Object object,
-                           EMACS_INT startpos, EMACS_INT endpos)
+                           ptrdiff_t startpos, ptrdiff_t endpos)
 {
   int yb = window_text_bottom_y (w);
   struct glyph_row *r;
@@ -26791,8 +27117,8 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y)
        {
          struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot));
          Lisp_Object *poly = v->contents;
-         int n = v->header.size;
-         int i;
+         ptrdiff_t n = v->header.size;
+         ptrdiff_t i;
          int inside = 0;
          Lisp_Object lx, ly;
          int x0, y0;
@@ -26870,7 +27196,9 @@ Returns the alist element for the first matching AREA in MAP.  */)
   CHECK_NUMBER (x);
   CHECK_NUMBER (y);
 
-  return find_hot_spot (map, XINT (x), XINT (y));
+  return find_hot_spot (map,
+                       clip_to_bounds (INT_MIN, XINT (x), INT_MAX),
+                       clip_to_bounds (INT_MIN, XINT (y), INT_MAX));
 }
 
 
@@ -26929,14 +27257,14 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
   Cursor cursor = No_Cursor;
   Lisp_Object pointer = Qnil;
   int dx, dy, width, height;
-  EMACS_INT charpos;
+  ptrdiff_t charpos;
   Lisp_Object string, object = Qnil;
-  Lisp_Object pos, help;
+  Lisp_Object pos IF_LINT (= Qnil), help;
 
   Lisp_Object mouse_face;
   int original_x_pixel = x;
   struct glyph * glyph = NULL, * row_start_glyph = NULL;
-  struct glyph_row *row;
+  struct glyph_row *row IF_LINT (= 0);
 
   if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
     {
@@ -27004,7 +27332,6 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
              if (!NILP (help))
                {
                  help_echo_string = help;
-                 /* Is this correct?  ++kfs */
                  XSETWINDOW (help_echo_window, w);
                  help_echo_object = w->buffer;
                  help_echo_pos = charpos;
@@ -27017,14 +27344,20 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
 #endif /* HAVE_WINDOW_SYSTEM */
 
   if (STRINGP (string))
+    pos = make_number (charpos);
+
+  /* Set the help text and mouse pointer.  If the mouse is on a part
+     of the mode line without any text (e.g. past the right edge of
+     the mode line text), use the default help text and pointer.  */
+  if (STRINGP (string) || area == ON_MODE_LINE)
     {
-      pos = make_number (charpos);
-      /* If we're on a string with `help-echo' text property, arrange
-        for the help to be displayed.  This is done by setting the
-        global variable help_echo_string to the help string.  */
+      /* Arrange to display the help by setting the global variables
+        help_echo_string, help_echo_object, and help_echo_pos.  */
       if (NILP (help))
        {
-         help = Fget_text_property (pos, Qhelp_echo, string);
+         if (STRINGP (string))
+           help = Fget_text_property (pos, Qhelp_echo, string);
+
          if (!NILP (help))
            {
              help_echo_string = help;
@@ -27032,31 +27365,56 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
              help_echo_object = string;
              help_echo_pos = charpos;
            }
+         else if (area == ON_MODE_LINE)
+           {
+             Lisp_Object default_help
+               = buffer_local_value_1 (Qmode_line_default_help_echo,
+                                       w->buffer);
+
+             if (STRINGP (default_help))
+               {
+                 help_echo_string = default_help;
+                 XSETWINDOW (help_echo_window, w);
+                 help_echo_object = Qnil;
+                 help_echo_pos = -1;
+               }
+           }
        }
 
 #ifdef HAVE_WINDOW_SYSTEM
+      /* Change the mouse pointer according to what is under it.  */
       if (FRAME_WINDOW_P (f))
        {
          dpyinfo = FRAME_X_DISPLAY_INFO (f);
-         cursor  = FRAME_X_OUTPUT (f)->nontext_cursor;
-         if (NILP (pointer))
-           pointer = Fget_text_property (pos, Qpointer, string);
-
-         /* Change the mouse pointer according to what is under X/Y.  */
-         if (NILP (pointer)
-             && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
+         if (STRINGP (string))
            {
-             Lisp_Object map;
-             map = Fget_text_property (pos, Qlocal_map, string);
-             if (!KEYMAPP (map))
-               map = Fget_text_property (pos, Qkeymap, string);
-             if (!KEYMAPP (map))
-               cursor = dpyinfo->vertical_scroll_bar_cursor;
+             cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
+
+             if (NILP (pointer))
+               pointer = Fget_text_property (pos, Qpointer, string);
+
+             /* Change the mouse pointer according to what is under X/Y.  */
+             if (NILP (pointer)
+                 && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE)))
+               {
+                 Lisp_Object map;
+                 map = Fget_text_property (pos, Qlocal_map, string);
+                 if (!KEYMAPP (map))
+                   map = Fget_text_property (pos, Qkeymap, string);
+                 if (!KEYMAPP (map))
+                   cursor = dpyinfo->vertical_scroll_bar_cursor;
+               }
            }
+         else
+           /* Default mode-line pointer.  */
+           cursor = FRAME_X_DISPLAY_INFO (f)->vertical_scroll_bar_cursor;
        }
 #endif
+    }
 
-     /* Change the mouse face according to what is under X/Y.  */
+  /* Change the mouse face according to what is under X/Y.  */
+  if (STRINGP (string))
+    {
       mouse_face = Fget_text_property (pos, Qmouse_face, string);
       if (!NILP (mouse_face)
          && ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
@@ -27069,7 +27427,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y,
          int gpos;
          int gseq_length;
          int total_pixel_width;
-         EMACS_INT begpos, endpos, ignore;
+         ptrdiff_t begpos, endpos, ignore;
 
          int vpos, hpos;
 
@@ -27295,18 +27653,18 @@ note_mouse_highlight (struct frame *f, int x, int y)
   b = XBUFFER (w->buffer);
   if (part == ON_TEXT
       && EQ (w->window_end_valid, w->buffer)
-      && XFASTINT (w->last_modified) == BUF_MODIFF (b)
-      && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b))
+      && w->last_modified == BUF_MODIFF (b)
+      && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b))
     {
       int hpos, vpos, dx, dy, area = LAST_AREA;
-      EMACS_INT pos;
+      ptrdiff_t pos;
       struct glyph *glyph;
       Lisp_Object object;
       Lisp_Object mouse_face = Qnil, position;
       Lisp_Object *overlay_vec = NULL;
       ptrdiff_t i, noverlays;
       struct buffer *obuf;
-      EMACS_INT obegv, ozv;
+      ptrdiff_t obegv, ozv;
       int same_region;
 
       /* Find the glyph under X/Y.  */
@@ -27464,7 +27822,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
              /* The mouse-highlighting comes from a display string
                 with a mouse-face.  */
              Lisp_Object s, e;
-             EMACS_INT ignore;
+             ptrdiff_t ignore;
 
              s = Fprevious_single_property_change
                (make_number (pos + 1), Qmouse_face, object, Qnil);
@@ -27496,7 +27854,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
                  /* If we are on a display string with no mouse-face,
                     check if the text under it has one.  */
                  struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos);
-                 EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
+                 ptrdiff_t start = MATRIX_ROW_START_CHARPOS (r);
                  pos = string_buffer_position (object, start);
                  if (pos > 0)
                    {
@@ -27595,7 +27953,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
        else
          {
            Lisp_Object obj = glyph->object;
-           EMACS_INT charpos = glyph->charpos;
+           ptrdiff_t charpos = glyph->charpos;
 
            /* Try text properties.  */
            if (STRINGP (obj)
@@ -27610,8 +27968,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
                       see if the buffer text ``under'' it does.  */
                    struct glyph_row *r
                      = MATRIX_ROW (w->current_matrix, vpos);
-                   EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
-                   EMACS_INT p = string_buffer_position (obj, start);
+                   ptrdiff_t start = MATRIX_ROW_START_CHARPOS (r);
+                   ptrdiff_t p = string_buffer_position (obj, start);
                    if (p > 0)
                      {
                        help = Fget_char_property (make_number (p),
@@ -27651,7 +28009,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
          if (NILP (pointer))
            {
              Lisp_Object obj = glyph->object;
-             EMACS_INT charpos = glyph->charpos;
+             ptrdiff_t charpos = glyph->charpos;
 
              /* Try text properties.  */
              if (STRINGP (obj)
@@ -27666,8 +28024,8 @@ note_mouse_highlight (struct frame *f, int x, int y)
                         see if the buffer text ``under'' it does.  */
                      struct glyph_row *r
                        = MATRIX_ROW (w->current_matrix, vpos);
-                     EMACS_INT start = MATRIX_ROW_START_CHARPOS (r);
-                     EMACS_INT p = string_buffer_position (obj, start);
+                     ptrdiff_t start = MATRIX_ROW_START_CHARPOS (r);
+                     ptrdiff_t p = string_buffer_position (obj, start);
                      if (p > 0)
                        pointer = Fget_char_property (make_number (p),
                                                      Qpointer, w->buffer);
@@ -27807,7 +28165,7 @@ expose_area (struct window *w, struct glyph_row *row, XRectangle *r,
 static int
 expose_line (struct window *w, struct glyph_row *row, XRectangle *r)
 {
-  xassert (row->enabled_p);
+  eassert (row->enabled_p);
 
   if (row->mode_line_p || w->pseudo_window_p)
     draw_glyphs (w, 0, row, TEXT_AREA,
@@ -27847,7 +28205,7 @@ expose_overlaps (struct window *w,
   for (row = first_overlapping_row; row <= last_overlapping_row; ++row)
     if (row->overlapping_p)
       {
-       xassert (row->enabled_p && !row->mode_line_p);
+       eassert (row->enabled_p && !row->mode_line_p);
 
        row->clip = r;
        if (row->used[LEFT_MARGIN_AREA])
@@ -28293,7 +28651,7 @@ syms_of_xdisp (void)
   message_dolog_marker3 = Fmake_marker ();
   staticpro (&message_dolog_marker3);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   defsubr (&Sdump_frame_glyph_matrix);
   defsubr (&Sdump_glyph_matrix);
   defsubr (&Sdump_glyph_row);
@@ -28383,7 +28741,7 @@ syms_of_xdisp (void)
   staticpro (&echo_area_buffer[0]);
   staticpro (&echo_area_buffer[1]);
 
-  Vmessages_buffer_name = make_pure_c_string ("*Messages*");
+  Vmessages_buffer_name = build_pure_c_string ("*Messages*");
   staticpro (&Vmessages_buffer_name);
 
   mode_line_proptrans_alist = Qnil;
@@ -28397,6 +28755,8 @@ syms_of_xdisp (void)
   Vmode_line_unwind_vector = Qnil;
   staticpro (&Vmode_line_unwind_vector);
 
+  DEFSYM (Qmode_line_default_help_echo, "mode-line-default-help-echo");
+
   help_echo_string = Qnil;
   staticpro (&help_echo_string);
   help_echo_object = Qnil;
@@ -28412,14 +28772,14 @@ syms_of_xdisp (void)
 
 #ifdef HAVE_WINDOW_SYSTEM
   DEFVAR_BOOL ("x-stretch-cursor", x_stretch_cursor_p,
-    doc: /* *Non-nil means draw block cursor as wide as the glyph under it.
+    doc: /* Non-nil means draw block cursor as wide as the glyph under it.
 For example, if a block cursor is over a tab, it will be drawn as
 wide as that tab on the display.  */);
   x_stretch_cursor_p = 0;
 #endif
 
   DEFVAR_LISP ("show-trailing-whitespace", Vshow_trailing_whitespace,
-    doc: /* *Non-nil means highlight trailing whitespace.
+    doc: /* Non-nil means highlight trailing whitespace.
 The face used for trailing whitespace is `trailing-whitespace'.  */);
   Vshow_trailing_whitespace = Qnil;
 
@@ -28439,7 +28799,7 @@ A value of nil means no special handling of these characters.  */);
   Vnobreak_char_display = Qt;
 
   DEFVAR_LISP ("void-text-area-pointer", Vvoid_text_area_pointer,
-    doc: /* *The pointer shape to show in void text areas.
+    doc: /* The pointer shape to show in void text areas.
 A value of nil means to show the text pointer.  Other options are `arrow',
 `text', `hand', `vdrag', `hdrag', `modeline', and `hourglass'.  */);
   Vvoid_text_area_pointer = Qarrow;
@@ -28462,7 +28822,7 @@ See also `overlay-arrow-string'.  */);
   DEFVAR_LISP ("overlay-arrow-string", Voverlay_arrow_string,
     doc: /* String to display as an arrow in non-window frames.
 See also `overlay-arrow-position'.  */);
-  Voverlay_arrow_string = make_pure_c_string ("=>");
+  Voverlay_arrow_string = build_pure_c_string ("=>");
 
   DEFVAR_LISP ("overlay-arrow-variable-list", Voverlay_arrow_variable_list,
     doc: /* List of variables (symbols) which hold markers for overlay arrows.
@@ -28472,14 +28832,14 @@ where to display overlay arrows.  */);
     = Fcons (intern_c_string ("overlay-arrow-position"), Qnil);
 
   DEFVAR_INT ("scroll-step", emacs_scroll_step,
-    doc: /* *The number of lines to try scrolling a window by when point moves out.
+    doc: /* The number of lines to try scrolling a window by when point moves out.
 If that fails to bring point back on frame, point is centered instead.
 If this is zero, point is always centered after it moves off frame.
 If you want scrolling to always be a line at a time, you should set
 `scroll-conservatively' to a large value rather than set this to 1.  */);
 
   DEFVAR_INT ("scroll-conservatively", scroll_conservatively,
-    doc: /* *Scroll up to this many lines, to bring point back on screen.
+    doc: /* Scroll up to this many lines, to bring point back on screen.
 If point moves off-screen, redisplay will scroll by up to
 `scroll-conservatively' lines in order to bring point just barely
 onto the screen again.  If that cannot be done, then redisplay
@@ -28493,7 +28853,7 @@ A value of zero means always recenter point if it moves off screen.  */);
   scroll_conservatively = 0;
 
   DEFVAR_INT ("scroll-margin", scroll_margin,
-    doc: /* *Number of lines of margin at the top and bottom of a window.
+    doc: /* Number of lines of margin at the top and bottom of a window.
 Recenter the window whenever point gets within this many lines
 of the top or bottom of the window.  */);
   scroll_margin = 0;
@@ -28503,7 +28863,7 @@ of the top or bottom of the window.  */);
 Value is a number or a cons (WIDTH-DPI . HEIGHT-DPI).  */);
   Vdisplay_pixels_per_inch = make_float (72.0);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   DEFVAR_INT ("debug-end-pos", debug_end_pos, doc: /* Don't ask.  */);
 #endif
 
@@ -28529,20 +28889,20 @@ Any other value means to use the appropriate face, `mode-line',
   mode_line_inverse_video = 1;
 
   DEFVAR_LISP ("line-number-display-limit", Vline_number_display_limit,
-    doc: /* *Maximum buffer size for which line number should be displayed.
+    doc: /* Maximum buffer size for which line number should be displayed.
 If the buffer is bigger than this, the line number does not appear
 in the mode line.  A value of nil means no limit.  */);
   Vline_number_display_limit = Qnil;
 
   DEFVAR_INT ("line-number-display-limit-width",
              line_number_display_limit_width,
-    doc: /* *Maximum line width (in characters) for line number display.
+    doc: /* Maximum line width (in characters) for line number display.
 If the average length of the lines near point is bigger than this, then the
 line number may be omitted from the mode line.  */);
   line_number_display_limit_width = 200;
 
   DEFVAR_BOOL ("highlight-nonselected-windows", highlight_nonselected_windows,
-    doc: /* *Non-nil means highlight region even in nonselected windows.  */);
+    doc: /* Non-nil means highlight region even in nonselected windows.  */);
   highlight_nonselected_windows = 0;
 
   DEFVAR_BOOL ("multiple-frames", multiple_frames,
@@ -28568,10 +28928,10 @@ and is used only on frames for which no explicit name has been set
   Vicon_title_format
     = Vframe_title_format
     = pure_cons (intern_c_string ("multiple-frames"),
-                pure_cons (make_pure_c_string ("%b"),
+                pure_cons (build_pure_c_string ("%b"),
                            pure_cons (pure_cons (empty_unibyte_string,
                                                  pure_cons (intern_c_string ("invocation-name"),
-                                                            pure_cons (make_pure_c_string ("@"),
+                                                            pure_cons (build_pure_c_string ("@"),
                                                                        pure_cons (intern_c_string ("system-name"),
                                                                                   Qnil)))),
                                       Qnil)));
@@ -28614,7 +28974,7 @@ See `set-window-redisplay-end-trigger'.  */);
   Vredisplay_end_trigger_functions = Qnil;
 
   DEFVAR_LISP ("mouse-autoselect-window", Vmouse_autoselect_window,
-     doc: /* *Non-nil means autoselect window with mouse pointer.
+     doc: /* Non-nil means autoselect window with mouse pointer.
 If nil, do not autoselect windows.
 A positive number means delay autoselection by that many seconds: a
 window is autoselected only after the mouse has remained in that
@@ -28634,7 +28994,7 @@ When customizing this variable make sure that the actual value of
   Vmouse_autoselect_window = Qnil;
 
   DEFVAR_LISP ("auto-resize-tool-bars", Vauto_resize_tool_bars,
-    doc: /* *Non-nil means automatically resize tool-bars.
+    doc: /* Non-nil means automatically resize tool-bars.
 This dynamically changes the tool-bar's height to the minimum height
 that is needed to make all tool-bar items visible.
 If value is `grow-only', the tool-bar's height is only increased
@@ -28642,15 +29002,15 @@ automatically; to decrease the tool-bar height, use \\[recenter].  */);
   Vauto_resize_tool_bars = Qt;
 
   DEFVAR_BOOL ("auto-raise-tool-bar-buttons", auto_raise_tool_bar_buttons_p,
-    doc: /* *Non-nil means raise tool-bar buttons when the mouse moves over them.  */);
+    doc: /* Non-nil means raise tool-bar buttons when the mouse moves over them.  */);
   auto_raise_tool_bar_buttons_p = 1;
 
   DEFVAR_BOOL ("make-cursor-line-fully-visible", make_cursor_line_fully_visible_p,
-    doc: /* *Non-nil means to scroll (recenter) cursor line if it is not fully visible.  */);
+    doc: /* Non-nil means to scroll (recenter) cursor line if it is not fully visible.  */);
   make_cursor_line_fully_visible_p = 1;
 
   DEFVAR_LISP ("tool-bar-border", Vtool_bar_border,
-    doc: /* *Border below tool-bar in pixels.
+    doc: /* Border below tool-bar in pixels.
 If an integer, use it as the height of the border.
 If it is one of `internal-border-width' or `border-width', use the
 value of the corresponding frame parameter.
@@ -28658,7 +29018,7 @@ Otherwise, no border is added below the tool-bar.  */);
   Vtool_bar_border = Qinternal_border_width;
 
   DEFVAR_LISP ("tool-bar-button-margin", Vtool_bar_button_margin,
-    doc: /* *Margin around tool-bar buttons in pixels.
+    doc: /* Margin around tool-bar buttons in pixels.
 If an integer, use that for both horizontal and vertical margins.
 Otherwise, value should be a pair of integers `(HORZ . VERT)' with
 HORZ specifying the horizontal margin, and VERT specifying the
@@ -28666,7 +29026,7 @@ vertical margin.  */);
   Vtool_bar_button_margin = make_number (DEFAULT_TOOL_BAR_BUTTON_MARGIN);
 
   DEFVAR_INT ("tool-bar-button-relief", tool_bar_button_relief,
-    doc: /* *Relief thickness of tool-bar buttons.  */);
+    doc: /* Relief thickness of tool-bar buttons.  */);
   tool_bar_button_relief = DEFAULT_TOOL_BAR_BUTTON_RELIEF;
 
   DEFVAR_LISP ("tool-bar-style", Vtool_bar_style,
@@ -28677,11 +29037,13 @@ It can be one of
  both             - show both, text below image
  both-horiz       - show text to the right of the image
  text-image-horiz - show text to the left of the image
- any other        - use system default or image if no system default.  */);
+ any other        - use system default or image if no system default.
+
+This variable only affects the GTK+ toolkit version of Emacs.  */);
   Vtool_bar_style = Qnil;
 
   DEFVAR_INT ("tool-bar-max-label-size", tool_bar_max_label_size,
-    doc: /* *Maximum number of characters a label can have to be shown.
+    doc: /* Maximum number of characters a label can have to be shown.
 The tool bar style must also show labels for this to have any effect, see
 `tool-bar-style'.  */);
   tool_bar_max_label_size = DEFAULT_TOOL_BAR_LABEL_SIZE;
@@ -28696,7 +29058,7 @@ fontified regions the property `fontified'.  */);
 
   DEFVAR_BOOL ("unibyte-display-via-language-environment",
                unibyte_display_via_language_environment,
-    doc: /* *Non-nil means display unibyte text according to language environment.
+    doc: /* Non-nil means display unibyte text according to language environment.
 Specifically, this means that raw bytes in the range 160-255 decimal
 are displayed by converting them to the equivalent multibyte characters
 according to the current language environment.  As a result, they are
@@ -28707,7 +29069,7 @@ but does not change the fact they are interpreted as raw bytes.  */);
   unibyte_display_via_language_environment = 0;
 
   DEFVAR_LISP ("max-mini-window-height", Vmax_mini_window_height,
-    doc: /* *Maximum height for resizing mini-windows (the minibuffer and the echo area).
+    doc: /* Maximum height for resizing mini-windows (the minibuffer and the echo area).
 If a float, it specifies a fraction of the mini-window frame's height.
 If an integer, it specifies a number of lines.  */);
   Vmax_mini_window_height = make_float (0.25);
@@ -28741,12 +29103,12 @@ point visible.  */);
   DEFSYM (Qauto_hscroll_mode, "auto-hscroll-mode");
 
   DEFVAR_INT ("hscroll-margin", hscroll_margin,
-    doc: /* *How many columns away from the window edge point is allowed to get
+    doc: /* How many columns away from the window edge point is allowed to get
 before automatic hscrolling will horizontally scroll the window.  */);
   hscroll_margin = 5;
 
   DEFVAR_LISP ("hscroll-step", Vhscroll_step,
-    doc: /* *How many columns to scroll the window when point gets too close to the edge.
+    doc: /* How many columns to scroll the window when point gets too close to the edge.
 When point is less than `hscroll-margin' columns from the window
 edge, automatic hscrolling will scroll the window by the amount of columns
 determined by this variable.  If its value is a positive integer, scroll that
@@ -28818,7 +29180,7 @@ To add a prefix to continuation lines, use `wrap-prefix'.  */);
     doc: /* Non-nil means don't free realized faces.  Internal use only.  */);
   inhibit_free_realized_faces = 0;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   DEFVAR_BOOL ("inhibit-try-window-id", inhibit_try_window_id,
               doc: /* Inhibit try_window_id display optimization.  */);
   inhibit_try_window_id = 0;
@@ -28833,7 +29195,7 @@ To add a prefix to continuation lines, use `wrap-prefix'.  */);
 #endif /* GLYPH_DEBUG */
 
   DEFVAR_INT ("overline-margin", overline_margin,
-              doc: /* *Space between overline and text, in pixels.
+              doc: /* Space between overline and text, in pixels.
 The default value is 2: the height of the overline (1 pixel) plus 1 pixel
 margin to the character height.  */);
   overline_margin = 2;
@@ -28854,7 +29216,7 @@ cursor shapes.  */);
   display_hourglass_p = 1;
 
   DEFVAR_LISP ("hourglass-delay", Vhourglass_delay,
-              doc: /* *Seconds to wait before displaying an hourglass pointer when Emacs is busy.  */);
+              doc: /* Seconds to wait before displaying an hourglass pointer when Emacs is busy.  */);
   Vhourglass_delay = make_number (DEFAULT_HOURGLASS_DELAY);
 
   hourglass_atimer = NULL;
@@ -28935,7 +29297,7 @@ init_xdisp (void)
     /* Allocate the buffer for frame titles.
        Also used for `format-mode-line'.  */
     int size = 100;
-    mode_line_noprop_buf = (char *) xmalloc (size);
+    mode_line_noprop_buf = xmalloc (size);
     mode_line_noprop_buf_end = mode_line_noprop_buf + size;
     mode_line_noprop_ptr = mode_line_noprop_buf;
     mode_line_target = MODE_LINE_DISPLAY;
@@ -28950,39 +29312,26 @@ init_xdisp (void)
 
 /* Platform-independent portion of hourglass implementation. */
 
-/* Return non-zero if hourglass timer has been started or hourglass is
-   shown.  */
-int
-hourglass_started (void)
-{
-  return hourglass_shown_p || hourglass_atimer != NULL;
-}
-
 /* Cancel a currently active hourglass timer, and start a new one.  */
 void
 start_hourglass (void)
 {
 #if defined (HAVE_WINDOW_SYSTEM)
   EMACS_TIME delay;
-  int secs, usecs = 0;
 
   cancel_hourglass ();
 
   if (INTEGERP (Vhourglass_delay)
       && XINT (Vhourglass_delay) > 0)
-    secs = XFASTINT (Vhourglass_delay);
+    delay = make_emacs_time (min (XINT (Vhourglass_delay),
+                                 TYPE_MAXIMUM (time_t)),
+                            0);
   else if (FLOATP (Vhourglass_delay)
           && XFLOAT_DATA (Vhourglass_delay) > 0)
-    {
-      Lisp_Object tem;
-      tem = Ftruncate (Vhourglass_delay, Qnil);
-      secs = XFASTINT (tem);
-      usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000;
-    }
+    delay = EMACS_TIME_FROM_DOUBLE (XFLOAT_DATA (Vhourglass_delay));
   else
-    secs = DEFAULT_HOURGLASS_DELAY;
+    delay = make_emacs_time (DEFAULT_HOURGLASS_DELAY, 0);
 
-  EMACS_SET_SECS_USECS (delay, secs, usecs);
   hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay,
                                   show_hourglass, NULL);
 #endif
index 476fb1e03667dbd9ffb99ce363f0710e64c9d960..e9089017c4e328b8d916b38e443a291e1d5c4e8d 100644 (file)
@@ -233,7 +233,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef FRAME_X_DISPLAY_INFO
 #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO
 #define x_display_info w32_display_info
-#define FRAME_X_FONT_TABLE FRAME_W32_FONT_TABLE
 #define check_x check_w32
 #define GCGraphicsExposures 0
 #endif /* WINDOWSNT */
@@ -243,7 +242,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #undef FRAME_X_DISPLAY_INFO
 #define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO
 #define x_display_info ns_display_info
-#define FRAME_X_FONT_TABLE FRAME_NS_FONT_TABLE
 #define check_x check_ns
 #define GCGraphicsExposures 0
 #endif /* HAVE_NS */
@@ -320,6 +318,7 @@ static Lisp_Object QCfontset;
 
 Lisp_Object Qnormal;
 Lisp_Object Qbold;
+static Lisp_Object Qline, Qwave;
 static Lisp_Object Qultra_light, Qextra_light, Qlight;
 static Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold;
 static Lisp_Object Qoblique, Qreverse_oblique, Qreverse_italic;
@@ -440,7 +439,7 @@ static Lisp_Object Vparam_value_alist;
 
 /* The total number of colors currently allocated.  */
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 static int ncolors_allocated;
 static int npixmaps_allocated;
 static int ngcs;
@@ -538,7 +537,7 @@ int color_count[256];
 void
 register_color (unsigned long pixel)
 {
-  xassert (pixel < 256);
+  eassert (pixel < 256);
   ++color_count[pixel];
 }
 
@@ -548,7 +547,7 @@ register_color (unsigned long pixel)
 void
 unregister_color (unsigned long pixel)
 {
-  xassert (pixel < 256);
+  eassert (pixel < 256);
   if (color_count[pixel] > 0)
     --color_count[pixel];
   else
@@ -662,7 +661,7 @@ static inline void
 x_free_gc (struct frame *f, GC gc)
 {
   eassert (interrupt_input_blocked);
-  IF_DEBUG (xassert (--ngcs >= 0));
+  IF_DEBUG (eassert (--ngcs >= 0));
   XFreeGC (FRAME_X_DISPLAY (f), gc);
 }
 
@@ -688,7 +687,7 @@ x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv)
 static inline void
 x_free_gc (struct frame *f, GC gc)
 {
-  IF_DEBUG (xassert (--ngcs >= 0));
+  IF_DEBUG (eassert (--ngcs >= 0));
   xfree (gc);
 }
 
@@ -702,9 +701,8 @@ x_create_gc (struct frame *f,
             unsigned long mask,
             XGCValues *xgcv)
 {
-  GC gc = xmalloc (sizeof (*gc));
-  if (gc)
-    memcpy (gc, xgcv, sizeof (XGCValues));
+  GC gc = xmalloc (sizeof *gc);
+  memcpy (gc, xgcv, sizeof (XGCValues));
   return gc;
 }
 
@@ -715,29 +713,6 @@ x_free_gc (struct frame *f, GC gc)
 }
 #endif  /* HAVE_NS */
 
-/* Like strcasecmp/stricmp.  Used to compare parts of font names which
-   are in ISO8859-1.  */
-
-int
-xstrcasecmp (const char *s1, const char *s2)
-{
-  while (*s1 && *s2)
-    {
-      unsigned char b1 = *s1;
-      unsigned char b2 = *s2;
-      unsigned char c1 = tolower (b1);
-      unsigned char c2 = tolower (b2);
-      if (c1 != c2)
-       return c1 < c2 ? -1 : 1;
-      ++s1, ++s2;
-    }
-
-  if (*s1 == 0)
-    return *s2 == 0 ? 0 : -1;
-  return 1;
-}
-
-
 /* If FRAME is nil, return a pointer to the selected frame.
    Otherwise, check that FRAME is a live frame, and return a pointer
    to it.  NPARAM is the parameter number of FRAME, for
@@ -922,7 +897,7 @@ the pixmap.  Bits are stored row by row, each row occupies
   else if (CONSP (object))
     {
       /* Otherwise OBJECT must be (WIDTH HEIGHT DATA), WIDTH and
-        HEIGHT must be integers > 0, and DATA must be string large
+        HEIGHT must be ints > 0, and DATA must be string large
         enough to hold a bitmap of the specified size.  */
       Lisp_Object width, height, data;
 
@@ -942,11 +917,11 @@ the pixmap.  Bits are stored row by row, each row occupies
        }
 
       if (STRINGP (data)
-         && INTEGERP (width) && 0 < XINT (width)
-         && INTEGERP (height) && 0 < XINT (height))
+         && RANGED_INTEGERP (1, width, INT_MAX)
+         && RANGED_INTEGERP (1, height, INT_MAX))
        {
-         EMACS_INT bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1)
-                                    / BITS_PER_CHAR);
+         int bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1)
+                              / BITS_PER_CHAR);
          if (XINT (height) <= SBYTES (data) / bytes_per_row)
            pixmap_p = 1;
        }
@@ -1008,7 +983,7 @@ load_pixmap (FRAME_PTR f, Lisp_Object name, unsigned int *w_ptr,
     }
   else
     {
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
       ++npixmaps_allocated;
 #endif
       if (w_ptr)
@@ -1323,8 +1298,8 @@ load_color (struct frame *f, struct face *face, Lisp_Object name,
 {
   XColor color;
 
-  xassert (STRINGP (name));
-  xassert (target_index == LFACE_FOREGROUND_INDEX
+  eassert (STRINGP (name));
+  eassert (target_index == LFACE_FOREGROUND_INDEX
           || target_index == LFACE_BACKGROUND_INDEX
           || target_index == LFACE_UNDERLINE_INDEX
           || target_index == LFACE_OVERLINE_INDEX
@@ -1373,7 +1348,7 @@ load_color (struct frame *f, struct face *face, Lisp_Object name,
          abort ();
        }
     }
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   else
     ++ncolors_allocated;
 #endif
@@ -1604,7 +1579,9 @@ compare_fonts_by_sort_order (const void *v1, const void *v2)
       else
        {
          if (INTEGERP (val1))
-           result = INTEGERP (val2) ? XINT (val1) - XINT (val2) : -1;
+           result = (INTEGERP (val2) && XINT (val1) >= XINT (val2)
+                     ? XINT (val1) > XINT (val2)
+                     : -1);
          else
            result = INTEGERP (val2) ? 1 : 0;
        }
@@ -1633,8 +1610,10 @@ the face font sort order.  */)
   (Lisp_Object family, Lisp_Object frame)
 {
   Lisp_Object font_spec, list, *drivers, vec;
-  int i, nfonts, ndrivers;
+  ptrdiff_t i, nfonts;
+  EMACS_INT ndrivers;
   Lisp_Object result;
+  USE_SAFE_ALLOCA;
 
   if (NILP (frame))
     frame = selected_frame;
@@ -1670,7 +1649,7 @@ the face font sort order.  */)
   font_props_for_sorting[i++] = FONT_REGISTRY_INDEX;
 
   ndrivers = XINT (Flength (list));
-  drivers  = alloca (sizeof (Lisp_Object) * ndrivers);
+  SAFE_ALLOCA_LISP (drivers, ndrivers);
   for (i = 0; i < ndrivers; i++, list = XCDR (list))
     drivers[i] = XCAR (list);
   vec = Fvconcat (ndrivers, drivers);
@@ -1702,6 +1681,7 @@ the face font sort order.  */)
       result = Fcons (v, result);
     }
 
+  SAFE_FREE ();
   return result;
 }
 
@@ -1848,7 +1828,6 @@ the WIDTH times as wide as FACE on FRAME.  */)
 #define LFACE_INHERIT(LFACE)       AREF ((LFACE), LFACE_INHERIT_INDEX)
 #define LFACE_FONTSET(LFACE)       AREF ((LFACE), LFACE_FONTSET_INDEX)
 
-#if XASSERTS
 /* Non-zero if LFACE is a Lisp face.  A Lisp face is a vector of size
    LFACE_VECTOR_SIZE which has the symbol `face' in slot 0.  */
 
@@ -1856,77 +1835,77 @@ the WIDTH times as wide as FACE on FRAME.  */)
      (VECTORP (LFACE)                                  \
       && ASIZE (LFACE) == LFACE_VECTOR_SIZE            \
       && EQ (AREF (LFACE, 0), Qface))
-#endif
 
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 /* Check consistency of Lisp face attribute vector ATTRS.  */
 
 static void
 check_lface_attrs (Lisp_Object *attrs)
 {
-  xassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_FAMILY_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_FAMILY_INDEX])
           || STRINGP (attrs[LFACE_FAMILY_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_FOUNDRY_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_FOUNDRY_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_FOUNDRY_INDEX])
           || STRINGP (attrs[LFACE_FOUNDRY_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_SWIDTH_INDEX])
           || SYMBOLP (attrs[LFACE_SWIDTH_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_HEIGHT_INDEX])
           || INTEGERP (attrs[LFACE_HEIGHT_INDEX])
           || FLOATP (attrs[LFACE_HEIGHT_INDEX])
           || FUNCTIONP (attrs[LFACE_HEIGHT_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_WEIGHT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_WEIGHT_INDEX])
           || SYMBOLP (attrs[LFACE_WEIGHT_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_SLANT_INDEX])
           || SYMBOLP (attrs[LFACE_SLANT_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_UNDERLINE_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_UNDERLINE_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_UNDERLINE_INDEX])
           || SYMBOLP (attrs[LFACE_UNDERLINE_INDEX])
-          || STRINGP (attrs[LFACE_UNDERLINE_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
+          || STRINGP (attrs[LFACE_UNDERLINE_INDEX])
+          || CONSP (attrs[LFACE_UNDERLINE_INDEX]));
+  eassert (UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_OVERLINE_INDEX])
           || SYMBOLP (attrs[LFACE_OVERLINE_INDEX])
           || STRINGP (attrs[LFACE_OVERLINE_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_STRIKE_THROUGH_INDEX])
           || SYMBOLP (attrs[LFACE_STRIKE_THROUGH_INDEX])
           || STRINGP (attrs[LFACE_STRIKE_THROUGH_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_BOX_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_BOX_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_BOX_INDEX])
           || SYMBOLP (attrs[LFACE_BOX_INDEX])
           || STRINGP (attrs[LFACE_BOX_INDEX])
           || INTEGERP (attrs[LFACE_BOX_INDEX])
           || CONSP (attrs[LFACE_BOX_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_INVERSE_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_INVERSE_INDEX])
           || SYMBOLP (attrs[LFACE_INVERSE_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_FOREGROUND_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_FOREGROUND_INDEX])
           || STRINGP (attrs[LFACE_FOREGROUND_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_BACKGROUND_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_BACKGROUND_INDEX])
           || STRINGP (attrs[LFACE_BACKGROUND_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_INHERIT_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_INHERIT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_INHERIT_INDEX])
           || NILP (attrs[LFACE_INHERIT_INDEX])
           || SYMBOLP (attrs[LFACE_INHERIT_INDEX])
           || CONSP (attrs[LFACE_INHERIT_INDEX]));
 #ifdef HAVE_WINDOW_SYSTEM
-  xassert (UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_STIPPLE_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_STIPPLE_INDEX])
           || SYMBOLP (attrs[LFACE_STIPPLE_INDEX])
           || !NILP (Fbitmap_spec_p (attrs[LFACE_STIPPLE_INDEX])));
-  xassert (UNSPECIFIEDP (attrs[LFACE_FONT_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_FONT_INDEX])
           || IGNORE_DEFFACE_P (attrs[LFACE_FONT_INDEX])
           || FONTP (attrs[LFACE_FONT_INDEX]));
-  xassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX])
+  eassert (UNSPECIFIEDP (attrs[LFACE_FONTSET_INDEX])
           || STRINGP (attrs[LFACE_FONTSET_INDEX])
           || NILP (attrs[LFACE_FONTSET_INDEX]));
 #endif
@@ -1940,17 +1919,17 @@ check_lface (Lisp_Object lface)
 {
   if (!NILP (lface))
     {
-      xassert (LFACEP (lface));
+      eassert (LFACEP (lface));
       check_lface_attrs (XVECTOR (lface)->contents);
     }
 }
 
-#else /* GLYPH_DEBUG == 0 */
+#else /* not GLYPH_DEBUG */
 
 #define check_lface_attrs(attrs)       (void) 0
 #define check_lface(lface)             (void) 0
 
-#endif /* GLYPH_DEBUG == 0 */
+#endif /* GLYPH_DEBUG */
 
 
 \f
@@ -2217,7 +2196,7 @@ set_lface_from_font (struct frame *f, Lisp_Object lface,
     {
       int pt = PIXEL_TO_POINT (font->pixel_size * 10, f->resy);
 
-      xassert (pt > 0);
+      eassert (pt > 0);
       LFACE_HEIGHT (lface) = make_number (pt);
     }
 
@@ -2263,7 +2242,7 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid)
     {
       if (INTEGERP (to))
        /* relative X absolute => absolute */
-       result = make_number ((EMACS_INT)(XFLOAT_DATA (from) * XINT (to)));
+       result = make_number (XFLOAT_DATA (from) * XINT (to));
       else if (FLOATP (to))
        /* relative X relative => relative */
        result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to));
@@ -2520,7 +2499,8 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to,
                {
                  if (EQ (value, Qt)
                      || NILP (value)
-                     || STRINGP (value))
+                     || STRINGP (value)
+                     || CONSP (value))
                    to[LFACE_UNDERLINE_INDEX] = value;
                  else
                    err = 1;
@@ -2683,8 +2663,7 @@ Value is a vector of face attributes.  */)
         property `face' of the Lisp face name.  */
       if (next_lface_id == lface_id_to_name_size)
        lface_id_to_name =
-         xpalloc (lface_id_to_name, &lface_id_to_name_size, 1,
-                  min (INT_MAX, MOST_POSITIVE_FIXNUM),
+         xpalloc (lface_id_to_name, &lface_id_to_name_size, 1, MAX_FACE_ID,
                   sizeof *lface_id_to_name);
 
       lface_id_to_name[next_lface_id] = face;
@@ -2723,7 +2702,7 @@ Value is a vector of face attributes.  */)
       ++windows_or_buffers_changed;
     }
 
-  xassert (LFACEP (lface));
+  eassert (LFACEP (lface));
   check_lface (lface);
   return lface;
 }
@@ -2944,14 +2923,53 @@ FRAME 0 means change the face on all frames, and change the default
     }
   else if (EQ (attr, QCunderline))
     {
-      if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value))
-       if ((SYMBOLP (value)
-            && !EQ (value, Qt)
-            && !EQ (value, Qnil))
-           /* Underline color.  */
-           || (STRINGP (value)
-               && SCHARS (value) == 0))
-         signal_error ("Invalid face underline", value);
+      int valid_p = 0;
+
+      if (UNSPECIFIEDP (value) || IGNORE_DEFFACE_P (value))
+       valid_p = 1;
+      else if (NILP (value) || EQ (value, Qt))
+        valid_p = 1;
+      else if (STRINGP (value) && SCHARS (value) > 0)
+        valid_p = 1;
+      else if (CONSP (value))
+        {
+          Lisp_Object key, val, list;
+
+          list = value;
+          valid_p = 1;
+
+          while (!NILP (CAR_SAFE(list)))
+            {
+              key = CAR_SAFE (list);
+              list = CDR_SAFE (list);
+              val = CAR_SAFE (list);
+              list = CDR_SAFE (list);
+
+              if (NILP (key) || NILP (val))
+                {
+                  valid_p = 0;
+                  break;
+                }
+
+              else if (EQ (key, QCcolor)
+                       && !(EQ (val, Qforeground_color)
+                            || (STRINGP (val) && SCHARS (val) > 0)))
+                {
+                  valid_p = 0;
+                  break;
+                }
+
+              else if (EQ (key, QCstyle)
+                       && !(EQ (val, Qline) || EQ (val, Qwave)))
+                {
+                  valid_p = 0;
+                  break;
+                }
+            }
+        }
+
+      if (!valid_p)
+        signal_error ("Invalid face underline", value);
 
       old_value = LFACE_UNDERLINE (lface);
       LFACE_UNDERLINE (lface) = value;
@@ -3468,7 +3486,7 @@ face_boolean_x_resource_value (Lisp_Object value, int signal_p)
 {
   Lisp_Object result = make_number (0);
 
-  xassert (STRINGP (value));
+  eassert (STRINGP (value));
 
   if (xstrcasecmp (SSDATA (value), "on") == 0
       || xstrcasecmp (SSDATA (value), "true") == 0)
@@ -4041,7 +4059,7 @@ hash_string_case_insensitive (Lisp_Object string)
 {
   const unsigned char *s;
   unsigned hash = 0;
-  xassert (STRINGP (string));
+  eassert (STRINGP (string));
   for (s = SDATA (string); *s; ++s)
     hash = (hash << 1) ^ tolower (*s);
   return hash;
@@ -4072,7 +4090,7 @@ lface_hash (Lisp_Object *v)
 static inline int
 lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
 {
-  xassert (lface_fully_specified_p (lface1)
+  eassert (lface_fully_specified_p (lface1)
           && lface_fully_specified_p (lface2));
   return (xstrcasecmp (SSDATA (lface1[LFACE_FAMILY_INDEX]),
                       SSDATA (lface2[LFACE_FAMILY_INDEX])) == 0
@@ -4103,8 +4121,7 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
 static struct face *
 make_realized_face (Lisp_Object *attr)
 {
-  struct face *face = (struct face *) xmalloc (sizeof *face);
-  memset (face, 0, sizeof *face);
+  struct face *face = xzalloc (sizeof *face);
   face->ascii_face = face;
   memcpy (face->lface, attr, sizeof face->lface);
   return face;
@@ -4153,7 +4170,7 @@ void
 prepare_face_for_display (struct frame *f, struct face *face)
 {
 #ifdef HAVE_WINDOW_SYSTEM
-  xassert (FRAME_WINDOW_P (f));
+  eassert (FRAME_WINDOW_P (f));
 
   if (face->gc == 0)
     {
@@ -4249,13 +4266,11 @@ make_face_cache (struct frame *f)
   struct face_cache *c;
   int size;
 
-  c = (struct face_cache *) xmalloc (sizeof *c);
-  memset (c, 0, sizeof *c);
+  c = xzalloc (sizeof *c);
   size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
-  c->buckets = (struct face **) xmalloc (size);
-  memset (c->buckets, 0, size);
+  c->buckets = xzalloc (size);
   c->size = 50;
-  c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
+  c->faces_by_id = xmalloc (c->size * sizeof *c->faces_by_id);
   c->f = f;
   c->menu_face_changed_p = menu_face_changed_default;
   return c;
@@ -4414,7 +4429,7 @@ cache_face (struct face_cache *c, struct face *face, unsigned int hash)
       break;
   face->id = i;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   /* Check that FACE got a unique id.  */
   {
     int j, n;
@@ -4425,7 +4440,7 @@ cache_face (struct face_cache *c, struct face *face, unsigned int hash)
        if (face1->id == i)
          ++n;
 
-    xassert (n == 1);
+    eassert (n == 1);
   }
 #endif /* GLYPH_DEBUG */
 
@@ -4476,7 +4491,7 @@ lookup_face (struct frame *f, Lisp_Object *attr)
   int i;
   struct face *face;
 
-  xassert (cache != NULL);
+  eassert (cache != NULL);
   check_lface_attrs (attr);
 
   /* Look up ATTR in the face cache.  */
@@ -4500,8 +4515,8 @@ lookup_face (struct frame *f, Lisp_Object *attr)
   if (face == NULL)
     face = realize_face (cache, attr, -1);
 
-#if GLYPH_DEBUG
-  xassert (face == FACE_FROM_ID (f, face->id));
+#ifdef GLYPH_DEBUG
+  eassert (face == FACE_FROM_ID (f, face->id));
 #endif /* GLYPH_DEBUG */
 
   return face->id;
@@ -4522,7 +4537,7 @@ face_for_font (struct frame *f, Lisp_Object font_object, struct face *base_face)
   int i;
   struct face *face;
 
-  xassert (cache != NULL);
+  eassert (cache != NULL);
   base_face = base_face->ascii_face;
   hash = lface_hash (base_face->lface);
   i = hash % FACE_CACHE_BUCKETS_SIZE;
@@ -4575,7 +4590,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p)
 }
 
 
-/* Return the display face-id of the basic face who's canonical face-id
+/* Return the display face-id of the basic face whose canonical face-id
    is FACE_ID.  The return value will usually simply be FACE_ID, unless that
    basic face has bee remapped via Vface_remapping_alist.  This function is
    conservative: if something goes wrong, it will simply return FACE_ID
@@ -4880,14 +4895,13 @@ static int
 tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
                                struct face *def_face)
 {
-  int weight;
+  int weight, slant;
   Lisp_Object val, fg, bg;
   XColor fg_tty_color, fg_std_color;
   XColor bg_tty_color, bg_std_color;
   unsigned test_caps = 0;
   Lisp_Object *def_attrs = def_face->lface;
 
-
   /* First check some easy-to-check stuff; ttys support none of the
      following attributes, so we can just return false if any are requested
      (even if `nominal' values are specified, we should still return false,
@@ -4903,11 +4917,9 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
       || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
-      || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX])
-      || !UNSPECIFIEDP (attrs[LFACE_SLANT_INDEX]))
+      || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]))
     return 0;
 
-
   /* Test for terminal `capabilities' (non-color character attributes).  */
 
   /* font weight (bold/dim) */
@@ -4933,6 +4945,18 @@ tty_supports_face_attributes_p (struct frame *f, Lisp_Object *attrs,
        return 0;               /* same as default */
     }
 
+  /* font slant */
+  val = attrs[LFACE_SLANT_INDEX];
+  if (!UNSPECIFIEDP (val)
+      && (slant = FONT_SLANT_NAME_NUMERIC (val), slant >= 0))
+    {
+      int def_slant = FONT_SLANT_NAME_NUMERIC (def_attrs[LFACE_SLANT_INDEX]);
+      if (slant == 100 || slant == def_slant)
+       return 0; /* same as default */
+      else
+       test_caps |= TTY_CAP_ITALIC;
+    }
+
   /* underlining */
   val = attrs[LFACE_UNDERLINE_INDEX];
   if (!UNSPECIFIEDP (val))
@@ -5277,7 +5301,7 @@ static int
 realize_basic_faces (struct frame *f)
 {
   int success_p = 0;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   /* Block input here so that we won't be surprised by an X expose
      event, for instance, without having the faces set up.  */
@@ -5332,11 +5356,11 @@ realize_default_face (struct frame *f)
   /* If the `default' face is not yet known, create it.  */
   lface = lface_from_face_name (f, Qdefault, 0);
   if (NILP (lface))
-  {
+    {
        Lisp_Object frame;
        XSETFRAME (frame, f);
        lface = Finternal_make_lisp_face (Qdefault, frame);
-  }
+    }
 
 #ifdef HAVE_WINDOW_SYSTEM
   if (FRAME_WINDOW_P (f))
@@ -5414,7 +5438,7 @@ realize_default_face (struct frame *f)
     LFACE_STIPPLE (lface) = Qnil;
 
   /* Realize the face; it must be fully-specified now.  */
-  xassert (lface_fully_specified_p (XVECTOR (lface)->contents));
+  eassert (lface_fully_specified_p (XVECTOR (lface)->contents));
   check_lface (lface);
   memcpy (attrs, XVECTOR (lface)->contents, sizeof attrs);
   face = realize_face (c, attrs, DEFAULT_FACE_ID);
@@ -5455,7 +5479,7 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id)
   /* The default face must exist and be fully specified.  */
   get_lface_attributes_no_remap (f, Qdefault, attrs, 1);
   check_lface_attrs (attrs);
-  xassert (lface_fully_specified_p (attrs));
+  eassert (lface_fully_specified_p (attrs));
 
   /* If SYMBOL isn't know as a face, create it.  */
   if (NILP (lface))
@@ -5485,7 +5509,7 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id)
   struct face *face;
 
   /* LFACE must be fully specified.  */
-  xassert (cache != NULL);
+  eassert (cache != NULL);
   check_lface_attrs (attrs);
 
   if (former_face_id >= 0 && cache->used > former_face_id)
@@ -5528,7 +5552,7 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
   struct face_cache *cache = FRAME_FACE_CACHE (f);
   struct face *face;
 
-  face = (struct face *) xmalloc (sizeof *face);
+  face = xmalloc (sizeof *face);
   *face = *base_face;
   face->gc = 0;
   face->extra = NULL;
@@ -5563,9 +5587,9 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
 #ifdef HAVE_WINDOW_SYSTEM
   struct face *default_face;
   struct frame *f;
-  Lisp_Object stipple, overline, strike_through, box;
+  Lisp_Object stipple, underline, overline, strike_through, box;
 
-  xassert (FRAME_WINDOW_P (cache->f));
+  eassert (FRAME_WINDOW_P (cache->f));
 
   /* Allocate a new realized face.  */
   face = make_realized_face (attrs);
@@ -5643,7 +5667,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
     {
       /* Simple box of specified line width in foreground color of the
         face.  */
-      xassert (XINT (box) != 0);
+      eassert (XINT (box) != 0);
       face->box = FACE_SIMPLE_BOX;
       face->box_line_width = XINT (box);
       face->box_color = face->foreground;
@@ -5696,28 +5720,75 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs)
 
   /* Text underline, overline, strike-through.  */
 
-  if (EQ (attrs[LFACE_UNDERLINE_INDEX], Qt))
+  underline = attrs[LFACE_UNDERLINE_INDEX];
+  if (EQ (underline, Qt))
     {
       /* Use default color (same as foreground color).  */
       face->underline_p = 1;
+      face->underline_type = FACE_UNDER_LINE;
       face->underline_defaulted_p = 1;
       face->underline_color = 0;
     }
-  else if (STRINGP (attrs[LFACE_UNDERLINE_INDEX]))
+  else if (STRINGP (underline))
     {
       /* Use specified color.  */
       face->underline_p = 1;
+      face->underline_type = FACE_UNDER_LINE;
       face->underline_defaulted_p = 0;
       face->underline_color
-       = load_color (f, face, attrs[LFACE_UNDERLINE_INDEX],
+       = load_color (f, face, underline,
                      LFACE_UNDERLINE_INDEX);
     }
-  else if (NILP (attrs[LFACE_UNDERLINE_INDEX]))
+  else if (NILP (underline))
     {
       face->underline_p = 0;
       face->underline_defaulted_p = 0;
       face->underline_color = 0;
     }
+  else if (CONSP (underline))
+    {
+      /* `(:color COLOR :style STYLE)'.
+         STYLE being one of `line' or `wave'. */
+      face->underline_p = 1;
+      face->underline_color = 0;
+      face->underline_defaulted_p = 1;
+      face->underline_type = FACE_UNDER_LINE;
+
+      while (CONSP (underline))
+        {
+          Lisp_Object keyword, value;
+
+          keyword = XCAR (underline);
+          underline = XCDR (underline);
+
+          if (!CONSP (underline))
+            break;
+          value = XCAR (underline);
+          underline = XCDR (underline);
+
+          if (EQ (keyword, QCcolor))
+            {
+              if (EQ (value, Qforeground_color))
+                {
+                  face->underline_defaulted_p = 1;
+                  face->underline_color = 0;
+                }
+              else if (STRINGP (value))
+                {
+                  face->underline_defaulted_p = 0;
+                  face->underline_color = load_color (f, face, value,
+                                                      LFACE_UNDERLINE_INDEX);
+                }
+            }
+          else if (EQ (keyword, QCstyle))
+            {
+              if (EQ (value, Qline))
+                face->underline_type = FACE_UNDER_LINE;
+              else if (EQ (value, Qwave))
+                face->underline_type = FACE_UNDER_WAVE;
+            }
+        }
+    }
 
   overline = attrs[LFACE_OVERLINE_INDEX];
   if (STRINGP (overline))
@@ -5777,7 +5848,7 @@ map_tty_color (struct frame *f, struct face *face,
     foreground_p ? FACE_TTY_DEFAULT_BG_COLOR : FACE_TTY_DEFAULT_FG_COLOR;
 #endif
 
-  xassert (idx == LFACE_FOREGROUND_INDEX || idx == LFACE_BACKGROUND_INDEX);
+  eassert (idx == LFACE_FOREGROUND_INDEX || idx == LFACE_BACKGROUND_INDEX);
 
   XSETFRAME (frame, f);
   color = face->lface[idx];
@@ -5845,7 +5916,7 @@ realize_tty_face (struct face_cache *cache, Lisp_Object *attrs)
   struct frame *f = cache->f;
 
   /* Frame must be a termcap frame.  */
-  xassert (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f));
+  eassert (FRAME_TERMCAP_P (cache->f) || FRAME_MSDOS_P (cache->f));
 
   /* Allocate a new realized face.  */
   face = make_realized_face (attrs);
@@ -5853,15 +5924,13 @@ realize_tty_face (struct face_cache *cache, Lisp_Object *attrs)
   face->font_name = FRAME_MSDOS_P (cache->f) ? "ms-dos" : "tty";
 #endif
 
-  /* Map face attributes to TTY appearances.  We map slant to
-     dimmed text because we want italic text to appear differently
-     and because dimmed text is probably used infrequently.  */
+  /* Map face attributes to TTY appearances.  */
   weight = FONT_WEIGHT_NAME_NUMERIC (attrs[LFACE_WEIGHT_INDEX]);
   slant = FONT_SLANT_NAME_NUMERIC (attrs[LFACE_SLANT_INDEX]);
   if (weight > 100)
     face->tty_bold_p = 1;
-  if (weight < 100 || slant != 100)
-    face->tty_dim_p = 1;
+  if (slant != 100)
+    face->tty_italic_p = 1;
   if (!NILP (attrs[LFACE_UNDERLINE_INDEX]))
     face->tty_underline_p = 1;
   if (!NILP (attrs[LFACE_INVERSE_INDEX]))
@@ -5960,9 +6029,9 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop)
    The face returned is suitable for displaying ASCII characters.  */
 
 int
-face_at_buffer_position (struct window *w, EMACS_INT pos,
-                        EMACS_INT region_beg, EMACS_INT region_end,
-                        EMACS_INT *endptr, EMACS_INT limit,
+face_at_buffer_position (struct window *w, ptrdiff_t pos,
+                        ptrdiff_t region_beg, ptrdiff_t region_end,
+                        ptrdiff_t *endptr, ptrdiff_t limit,
                         int mouse, int base_face_id)
 {
   struct frame *f = XFRAME (w->frame);
@@ -5971,14 +6040,14 @@ face_at_buffer_position (struct window *w, EMACS_INT pos,
   ptrdiff_t i, noverlays;
   Lisp_Object *overlay_vec;
   Lisp_Object frame;
-  EMACS_INT endpos;
+  ptrdiff_t endpos;
   Lisp_Object propname = mouse ? Qmouse_face : Qface;
   Lisp_Object limit1, end;
   struct face *default_face;
 
   /* W must display the current buffer.  We could write this function
      to use the frame and buffer of W, but right now it doesn't.  */
-  /* xassert (XBUFFER (w->buffer) == current_buffer); */
+  /* eassert (XBUFFER (w->buffer) == current_buffer); */
 
   XSETFRAME (frame, f);
   XSETFASTINT (position, pos);
@@ -5997,7 +6066,7 @@ face_at_buffer_position (struct window *w, EMACS_INT pos,
 
   /* Look at properties from overlays.  */
   {
-    EMACS_INT next_overlay;
+    ptrdiff_t next_overlay;
 
     GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0);
     if (next_overlay < endpos)
@@ -6072,9 +6141,9 @@ face_at_buffer_position (struct window *w, EMACS_INT pos,
    simply disregards the `face' properties of all overlays.  */
 
 int
-face_for_overlay_string (struct window *w, EMACS_INT pos,
-                        EMACS_INT region_beg, EMACS_INT region_end,
-                        EMACS_INT *endptr, EMACS_INT limit,
+face_for_overlay_string (struct window *w, ptrdiff_t pos,
+                        ptrdiff_t region_beg, ptrdiff_t region_end,
+                        ptrdiff_t *endptr, ptrdiff_t limit,
                         int mouse, Lisp_Object overlay)
 {
   struct frame *f = XFRAME (w->frame);
@@ -6088,7 +6157,7 @@ face_for_overlay_string (struct window *w, EMACS_INT pos,
 
   /* W must display the current buffer.  We could write this function
      to use the frame and buffer of W, but right now it doesn't.  */
-  /* xassert (XBUFFER (w->buffer) == current_buffer); */
+  /* eassert (XBUFFER (w->buffer) == current_buffer); */
 
   XSETFRAME (frame, f);
   XSETFASTINT (position, pos);
@@ -6107,14 +6176,14 @@ face_for_overlay_string (struct window *w, EMACS_INT pos,
 
   *endptr = endpos;
 
-  default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID);
-
-  /* Optimize common cases where we can use the default face.  */
+  /* Optimize common case where we can use the default face.  */
   if (NILP (prop)
-      && !(pos >= region_beg && pos < region_end))
+      && !(pos >= region_beg && pos < region_end)
+      && NILP (Vface_remapping_alist))
     return DEFAULT_FACE_ID;
 
   /* Begin with attributes from the default face.  */
+  default_face = FACE_FROM_ID (f, lookup_basic_face (f, DEFAULT_FACE_ID));
   memcpy (attrs, default_face->lface, sizeof attrs);
 
   /* Merge in attributes specified via text properties.  */
@@ -6161,9 +6230,9 @@ face_for_overlay_string (struct window *w, EMACS_INT pos,
 
 int
 face_at_string_position (struct window *w, Lisp_Object string,
-                        EMACS_INT pos, EMACS_INT bufpos,
-                        EMACS_INT region_beg, EMACS_INT region_end,
-                        EMACS_INT *endptr, enum face_id base_face_id,
+                        ptrdiff_t pos, ptrdiff_t bufpos,
+                        ptrdiff_t region_beg, ptrdiff_t region_end,
+                        ptrdiff_t *endptr, enum face_id base_face_id,
                         int mouse_p)
 {
   Lisp_Object prop, position, end, limit;
@@ -6192,7 +6261,7 @@ face_at_string_position (struct window *w, Lisp_Object string,
     *endptr = -1;
 
   base_face = FACE_FROM_ID (f, base_face_id);
-  xassert (base_face);
+  eassert (base_face);
 
   /* Optimize the default case that there is no face property and we
      are not in the region.  */
@@ -6246,7 +6315,7 @@ face_at_string_position (struct window *w, Lisp_Object string,
 */
 
 int
-merge_faces (struct frame *f, Lisp_Object face_name, EMACS_INT face_id,
+merge_faces (struct frame *f, Lisp_Object face_name, int face_id,
             int base_face_id)
 {
   Lisp_Object attrs[LFACE_VECTOR_SIZE];
@@ -6310,7 +6379,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string.  */)
   CHECK_STRING (filename);
   abspath = Fexpand_file_name (filename, Qnil);
 
-  fp = fopen (SDATA (abspath), "rt");
+  fp = fopen (SSDATA (abspath), "rt");
   if (fp)
     {
       char buf[512];
@@ -6349,7 +6418,7 @@ where R,G,B are numbers between 0 and 255 and name is an arbitrary string.  */)
                                Tests
  ***********************************************************************/
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 /* Print the contents of the realized face FACE to stderr.  */
 
@@ -6424,7 +6493,7 @@ DEFUN ("show-face-resources", Fshow_face_resources, Sshow_face_resources,
   return Qnil;
 }
 
-#endif /* GLYPH_DEBUG != 0 */
+#endif /* GLYPH_DEBUG */
 
 
 \f
@@ -6465,6 +6534,8 @@ syms_of_xfaces (void)
   DEFSYM (QCcolor, ":color");
   DEFSYM (QCline_width, ":line-width");
   DEFSYM (QCstyle, ":style");
+  DEFSYM (Qline, "line");
+  DEFSYM (Qwave, "wave");
   DEFSYM (Qreleased_button, "released-button");
   DEFSYM (Qpressed_button, "pressed-button");
   DEFSYM (Qnormal, "normal");
@@ -6546,7 +6617,7 @@ syms_of_xfaces (void)
   defsubr (&Sinternal_set_alternative_font_family_alist);
   defsubr (&Sinternal_set_alternative_font_registry_alist);
   defsubr (&Sface_attributes_as_vector);
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   defsubr (&Sdump_face);
   defsubr (&Sshow_face_resources);
 #endif /* GLYPH_DEBUG */
@@ -6558,7 +6629,7 @@ syms_of_xfaces (void)
 #endif
 
   DEFVAR_LISP ("font-list-limit", Vfont_list_limit,
-              doc: /* *Limit for font matching.
+              doc: /* Limit for font matching.
 If an integer > 0, font matching functions won't load more than
 that number of fonts when searching for a matching font.  */);
   Vfont_list_limit = make_number (DEFAULT_FONT_LIST_LIMIT);
@@ -6568,11 +6639,11 @@ that number of fonts when searching for a matching font.  */);
   Vface_new_frame_defaults = Qnil;
 
   DEFVAR_LISP ("face-default-stipple", Vface_default_stipple,
-    doc: /* *Default stipple pattern used on monochrome displays.
+    doc: /* Default stipple pattern used on monochrome displays.
 This stipple pattern is used on monochrome displays
 instead of shades of gray for a face background color.
 See `set-face-stipple' for possible values for this variable.  */);
-  Vface_default_stipple = make_pure_c_string ("gray3");
+  Vface_default_stipple = build_pure_c_string ("gray3");
 
   DEFVAR_LISP ("tty-defined-color-alist", Vtty_defined_color_alist,
    doc: /* An alist of defined terminal colors and their RGB values.
index 6f08ada1bb92a163b5bab992f1e149c5322cbaec..a0229919aa0628914d3005dbc644d56d1ac6ee3c 100644 (file)
@@ -32,13 +32,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "xterm.h"
 #include "frame.h"
 #include "window.h"
+#include "character.h"
 #include "buffer.h"
 #include "intervals.h"
 #include "dispextern.h"
 #include "keyboard.h"
 #include "blockinput.h"
 #include <epaths.h>
-#include "character.h"
 #include "charset.h"
 #include "coding.h"
 #include "fontset.h"
@@ -126,17 +126,9 @@ extern LWLIB_ID widget_id_tick;
 
 #define MAXREQUEST(dpy) (XMaxRequestSize (dpy))
 
-/* The gray bitmap `bitmaps/gray'.  This is done because xterm.c uses
-   it, and including `bitmaps/gray' more than once is a problem when
-   config.h defines `static' as an empty replacement string.  */
-
-int gray_bitmap_width = gray_width;
-int gray_bitmap_height = gray_height;
-char *gray_bitmap_bits = gray_bits;
-
 /* Nonzero if using X.  */
 
-static int x_in_use;
+int x_in_use;
 
 static Lisp_Object Qnone;
 static Lisp_Object Qsuppress_icon;
@@ -144,7 +136,7 @@ static Lisp_Object Qundefined_color;
 static Lisp_Object Qcompound_text, Qcancel_timer;
 Lisp_Object Qfont_param;
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 static ptrdiff_t image_cache_refcount;
 static int dpyinfo_refcount;
 #endif
@@ -1200,7 +1192,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
   if (FRAME_MINIBUF_ONLY_P (f))
     return;
 
-  if (INTEGERP (value))
+  if (TYPE_RANGED_INTEGERP (int, value))
     nlines = XINT (value);
   else
     nlines = 0;
@@ -1215,7 +1207,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
       FRAME_EXTERNAL_MENU_BAR (f) = 1;
       if (FRAME_X_P (f) && f->output_data.x->menubar_widget == 0)
        /* Make sure next redisplay shows the menu bar.  */
-       XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt;
+       XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = 1;
     }
   else
     {
@@ -1286,8 +1278,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
   if (FRAME_MINIBUF_ONLY_P (f))
     return;
 
-  /* Use VALUE only if an integer >= 0.  */
-  if (INTEGERP (value) && XINT (value) >= 0)
+  /* Use VALUE only if an int >= 0.  */
+  if (RANGED_INTEGERP (0, value, INT_MAX))
     nlines = XFASTINT (value);
   else
     nlines = 0;
@@ -1299,7 +1291,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
       FRAME_EXTERNAL_TOOL_BAR (f) = 1;
       if (FRAME_X_P (f) && f->output_data.x->toolbar_widget == 0)
        /* Make sure next redisplay shows the tool bar.  */
-       XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt;
+       XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = 1;
       update_frame_tool_bar (f);
     }
   else
@@ -1889,10 +1881,9 @@ xic_create_fontsetname (const char *base_fontname, int motif)
 
   /* Make a fontset name from the base font name.  */
   if (xic_default_fontset == base_fontname)
-    { /* There is no base font name, use the default.  */
-      ptrdiff_t len = strlen (base_fontname) + 2;
-      fontsetname = xmalloc (len);
-      memset (fontsetname, 0, len);
+    {
+      /* There is no base font name, use the default.  */
+      fontsetname = xmalloc (strlen (base_fontname) + 2);
       strcpy (fontsetname, base_fontname);
     }
   else
@@ -1908,13 +1899,12 @@ xic_create_fontsetname (const char *base_fontname, int motif)
       for (i = 0; *p; p++)
        if (*p == '-') i++;
       if (i != 14)
-       { /* As the font name doesn't conform to XLFD, we can't
+       {
+         /* As the font name doesn't conform to XLFD, we can't
             modify it to generalize it to allcs and allfamilies.
             Use the specified font plus the default.  */
-         ptrdiff_t len =
-           strlen (base_fontname) + strlen (xic_default_fontset) + 3;
-         fontsetname = xmalloc (len);
-         memset (fontsetname, 0, len);
+         fontsetname = xmalloc (strlen (base_fontname)
+                                + strlen (xic_default_fontset) + 3);
          strcpy (fontsetname, base_fontname);
          strcat (fontsetname, sep);
          strcat (fontsetname, xic_default_fontset);
@@ -1963,24 +1953,21 @@ xic_create_fontsetname (const char *base_fontname, int motif)
 
          /* Build the font spec that matches all charsets.  */
          len = p - base_fontname + strlen (allcs) + 1;
-         font_allcs = (char *) alloca (len);
-         memset (font_allcs, 0, len);
+         font_allcs = alloca (len);
          memcpy (font_allcs, base_fontname, p - base_fontname);
          strcat (font_allcs, allcs);
 
          /* Build the font spec that matches all families and
             add-styles.  */
          len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1;
-         font_allfamilies = (char *) alloca (len);
-         memset (font_allfamilies, 0, len);
+         font_allfamilies = alloca (len);
          strcpy (font_allfamilies, allfamilies);
          memcpy (font_allfamilies + strlen (allfamilies), p1, p - p1);
          strcat (font_allfamilies, allcs);
 
          /* Build the font spec that matches all.  */
          len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1;
-         font_all = (char *) alloca (len);
-         memset (font_all, 0, len);
+         font_all = alloca (len);
          strcpy (font_all, allfamilies);
          strcat (font_all, all);
          memcpy (font_all + strlen (all) + strlen (allfamilies), p2, p - p2);
@@ -1990,7 +1977,6 @@ xic_create_fontsetname (const char *base_fontname, int motif)
          len = strlen (base_fontname) + strlen (font_allcs)
            + strlen (font_allfamilies) + strlen (font_all) + 5;
          fontsetname = xmalloc (len);
-         memset (fontsetname, 0, len);
          strcpy (fontsetname, base_fontname);
          strcat (fontsetname, sep);
          strcat (fontsetname, font_allcs);
@@ -2382,7 +2368,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
 
   {
     char *str = SSDATA (Vx_resource_name);
-    f->namebuf = (char *) xmalloc (strlen (str) + 1);
+    f->namebuf = xmalloc (strlen (str) + 1);
     strcpy (f->namebuf, str);
   }
 
@@ -2439,7 +2425,6 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
 
   /* Do some needed geometry management.  */
   {
-    ptrdiff_t len;
     char *tem, shell_position[sizeof "=x++" + 4 * INT_STRLEN_BOUND (int)];
     Arg gal[10];
     int gac = 0;
@@ -2508,13 +2493,11 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
         }
     }
 
-    len = strlen (shell_position) + 1;
     /* We don't free this because we don't know whether
        it is safe to free it while the frame exists.
        It isn't worth the trouble of arranging to free it
        when the frame is deleted.  */
-    tem = (char *) xmalloc (len);
-    strncpy (tem, shell_position, len);
+    tem = xstrdup (shell_position);
     XtSetArg (gal[gac], XtNgeometry, tem); gac++;
     XtSetValues (shell_widget, gal, gac);
   }
@@ -2787,8 +2770,8 @@ x_icon (struct frame *f, Lisp_Object parms)
   icon_y = x_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER);
   if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound))
     {
-      CHECK_NUMBER (icon_x);
-      CHECK_NUMBER (icon_y);
+      CHECK_TYPE_RANGED_INTEGER (int, icon_x);
+      CHECK_TYPE_RANGED_INTEGER (int, icon_y);
     }
   else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound))
     error ("Both left and top icon corners of icon must be specified");
@@ -2931,17 +2914,17 @@ unwind_create_frame (Lisp_Object frame)
   /* If frame is ``official'', nothing to do.  */
   if (NILP (Fmemq (frame, Vframe_list)))
     {
-#if GLYPH_DEBUG && XASSERTS
+#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
       struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
 #endif
 
       x_free_frame_resources (f);
       free_glyphs (f);
 
-#if GLYPH_DEBUG
+#if defined GLYPH_DEBUG && defined ENABLE_CHECKING
       /* Check that reference counts are indeed correct.  */
-      xassert (dpyinfo->reference_count == dpyinfo_refcount);
-      xassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
+      eassert (dpyinfo->reference_count == dpyinfo_refcount);
+      eassert (dpyinfo->terminal->image_cache->refcount == image_cache_refcount);
 #endif
       return Qt;
     }
@@ -2973,11 +2956,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms)
          read yet.  */
       const char *system_font = xsettings_get_system_font ();
       if (system_font)
-        {
-          char *name = xstrdup (system_font);
-          font = font_open_by_name (f, name);
-          xfree (name);
-        }
+       font = font_open_by_name (f, system_font, strlen (system_font));
     }
 
   if (NILP (font))
@@ -3007,7 +2986,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object parms)
 
       for (i = 0; names[i]; i++)
        {
-         font = font_open_by_name (f, names[i]);
+         font = font_open_by_name (f, names[i], strlen (names[i]));
          if (! NILP (font))
            break;
        }
@@ -3079,7 +3058,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   int minibuffer_only = 0;
   long window_prompting = 0;
   int width, height;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object display;
   struct x_display_info *dpyinfo = NULL;
@@ -3146,8 +3125,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
   f->terminal = dpyinfo->terminal;
 
   f->output_method = output_x_window;
-  f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
-  memset (f->output_data.x, 0, sizeof (struct x_output));
+  f->output_data.x = xzalloc (sizeof *f->output_data.x);
   f->output_data.x->icon_bitmap = -1;
   FRAME_FONTSET (f) = -1;
   f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -3313,7 +3291,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
                                        "scrollBarBackground",
                                        "ScrollBarBackground", 0);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   image_cache_refcount =
     FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
   dpyinfo_refcount = dpyinfo->reference_count;
@@ -3336,7 +3314,7 @@ This function is an internal primitive--use `make-frame' instead.  */)
      could get an infloop in next_frame since the frame is not yet in
      Vframe_list.  */
   {
-    int count2 = SPECPDL_INDEX ();
+    ptrdiff_t count2 = SPECPDL_INDEX ();
     record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code);
     inhibit_lisp_code = Qt;
 
@@ -3975,7 +3953,7 @@ select_visual (struct x_display_info *dpyinfo)
       /* VALUE should be of the form CLASS-DEPTH, where CLASS is one
         of `PseudoColor', `TrueColor' etc. and DEPTH is the color
         depth, a decimal number.  NAME is compared with case ignored.  */
-      char *s = (char *) alloca (SBYTES (value) + 1);
+      char *s = alloca (SBYTES (value) + 1);
       char *dash;
       int i, class = -1;
       XVisualInfo vinfo;
@@ -4207,9 +4185,10 @@ If TYPE is not given or nil, the type is STRING.
 FORMAT gives the size in bits of each element if VALUE is a list.
 It must be one of 8, 16 or 32.
 If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
-If OUTER_P is non-nil, the property is changed for the outer X window of
+If OUTER-P is non-nil, the property is changed for the outer X window of
 FRAME.  Default is to change on the edit X window.  */)
-  (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
+  (Lisp_Object prop, Lisp_Object value, Lisp_Object frame,
+   Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
 {
   struct frame *f = check_x_frame (frame);
   Atom prop_atom;
@@ -4224,11 +4203,11 @@ FRAME.  Default is to change on the edit X window.  */)
   if (! NILP (format))
     {
       CHECK_NUMBER (format);
-      element_format = XFASTINT (format);
 
-      if (element_format != 8 && element_format != 16
-          && element_format != 32)
+      if (XINT (format) != 8 && XINT (format) != 16
+          && XINT (format) != 32)
         error ("FORMAT must be one of 8, 16 or 32");
+      element_format = XINT (format);
     }
 
   if (CONSP (value))
@@ -4310,19 +4289,20 @@ DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
        doc: /* Value is the value of window property PROP on FRAME.
 If FRAME is nil or omitted, use the selected frame.
 
-On MS Windows, this function only accepts the PROP and FRAME arguments.
-
 On X Windows, the following optional arguments are also accepted:
 If TYPE is nil or omitted, get the property as a string.
 Otherwise TYPE is the name of the atom that denotes the type expected.
 If SOURCE is non-nil, get the property on that window instead of from
 FRAME.  The number 0 denotes the root window.
-If DELETE_P is non-nil, delete the property after retrieving it.
-If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
+If DELETE-P is non-nil, delete the property after retrieving it.
+If VECTOR-RET-P is non-nil, don't return a string but a vector of values.
+
+On MS Windows, this function accepts but ignores those optional arguments.
 
 Value is nil if FRAME hasn't a property with name PROP or if PROP has
 no value of TYPE (always string in the MS Windows case).  */)
-  (Lisp_Object prop, Lisp_Object frame, Lisp_Object type, Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p)
+  (Lisp_Object prop, Lisp_Object frame, Lisp_Object type,
+   Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p)
 {
   struct frame *f = check_x_frame (frame);
   Atom prop_atom;
@@ -4586,7 +4566,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
   Lisp_Object frame;
   Lisp_Object name;
   int width, height;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3;
   int face_change_count_before = face_change_count;
   Lisp_Object buffer;
@@ -4632,8 +4612,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
      from this point on, x_destroy_window might screw up reference
      counts etc.  */
   f->output_method = output_x_window;
-  f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
-  memset (f->output_data.x, 0, sizeof (struct x_output));
+  f->output_data.x = xzalloc (sizeof *f->output_data.x);
   f->output_data.x->icon_bitmap = -1;
   FRAME_FONTSET (f) = -1;
   f->output_data.x->scroll_bar_foreground_pixel = -1;
@@ -4747,7 +4726,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
   x_default_parameter (f, parms, Qborder_color, build_string ("black"),
                       "borderColor", "BorderColor", RES_TYPE_STRING);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
   image_cache_refcount =
     FRAME_IMAGE_CACHE (f) ? FRAME_IMAGE_CACHE (f)->refcount : 0;
   dpyinfo_refcount = dpyinfo->reference_count;
@@ -4983,7 +4962,7 @@ Text larger than the specified size is clipped.  */)
   int i, width, height, seen_reversed_p;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   int old_windows_or_buffers_changed = windows_or_buffers_changed;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   specbind (Qinhibit_redisplay, Qt);
 
@@ -5093,10 +5072,8 @@ Text larger than the specified size is clipped.  */)
   w->left_col = w->top_line = make_number (0);
 
   if (CONSP (Vx_max_tooltip_size)
-      && INTEGERP (XCAR (Vx_max_tooltip_size))
-      && XINT (XCAR (Vx_max_tooltip_size)) > 0
-      && INTEGERP (XCDR (Vx_max_tooltip_size))
-      && XINT (XCDR (Vx_max_tooltip_size)) > 0)
+      && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
+      && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX))
     {
       w->total_cols = XCAR (Vx_max_tooltip_size);
       w->total_lines = XCDR (Vx_max_tooltip_size);
@@ -5242,7 +5219,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
 Value is t if tooltip was open, nil otherwise.  */)
   (void)
 {
-  int count;
+  ptrdiff_t count;
   Lisp_Object deleted, frame, timer;
   struct gcpro gcpro1, gcpro2;
 
@@ -5384,7 +5361,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.  */)
   Arg al[10];
   int ac = 0;
   XmString dir_xmstring, pattern_xmstring;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
 
   check_x ();
@@ -5553,7 +5530,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.  */)
   char *fn;
   Lisp_Object file = Qnil;
   Lisp_Object decoded_file;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
   char *cdef_file;
 
@@ -5616,7 +5593,7 @@ If FRAME is omitted or nil, it defaults to the selected frame. */)
   Lisp_Object font_param;
   char *default_name = NULL;
   struct gcpro gcpro1, gcpro2;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   check_x ();
 
@@ -5847,7 +5824,7 @@ syms_of_xfns (void)
   Fput (Qundefined_color, Qerror_conditions,
        pure_cons (Qundefined_color, pure_cons (Qerror, Qnil)));
   Fput (Qundefined_color, Qerror_message,
-       make_pure_c_string ("Undefined color"));
+       build_pure_c_string ("Undefined color"));
 
   DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape,
     doc: /* The shape of the pointer when over text.
@@ -5920,32 +5897,32 @@ Chinese, Japanese, and Korean.  */);
 
 /* This is not ifdef:ed, so other builds than GTK can customize it.  */
   DEFVAR_BOOL ("x-gtk-use-old-file-dialog", x_gtk_use_old_file_dialog,
-    doc: /* *Non-nil means prompt with the old GTK file selection dialog.
+    doc: /* Non-nil means prompt with the old GTK file selection dialog.
 If nil or if the file selection dialog is not available, the new GTK file
 chooser is used instead.  To turn off all file dialogs set the
 variable `use-file-dialog'.  */);
   x_gtk_use_old_file_dialog = 0;
 
   DEFVAR_BOOL ("x-gtk-show-hidden-files", x_gtk_show_hidden_files,
-    doc: /* *If non-nil, the GTK file chooser will by default show hidden files.
+    doc: /* If non-nil, the GTK file chooser will by default show hidden files.
 Note that this is just the default, there is a toggle button on the file
 chooser to show or not show hidden files on a case by case basis.  */);
   x_gtk_show_hidden_files = 0;
 
   DEFVAR_BOOL ("x-gtk-file-dialog-help-text", x_gtk_file_dialog_help_text,
-    doc: /* *If non-nil, the GTK file chooser will show additional help text.
+    doc: /* If non-nil, the GTK file chooser will show additional help text.
 If more space for files in the file chooser dialog is wanted, set this to nil
 to turn the additional text off.  */);
   x_gtk_file_dialog_help_text = 1;
 
   DEFVAR_BOOL ("x-gtk-whole-detached-tool-bar", x_gtk_whole_detached_tool_bar,
-    doc: /* *If non-nil, a detached tool bar is shown in full.
+    doc: /* If non-nil, a detached tool bar is shown in full.
 The default is to just show an arrow and pressing on that arrow shows
 the tool bar buttons.  */);
   x_gtk_whole_detached_tool_bar = 0;
 
   DEFVAR_BOOL ("x-gtk-use-system-tooltips", x_gtk_use_system_tooltips,
-    doc: /* *If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used.
+    doc: /* If non-nil with a Gtk+ built Emacs, the Gtk+ tooltip is used.
 Otherwise use Emacs own tooltip implementation.
 When using Gtk+ tooltips, the tooltip face is not used.  */);
   x_gtk_use_system_tooltips = 1;
@@ -5975,10 +5952,10 @@ When using Gtk+ tooltips, the tooltip face is not used.  */);
   DEFVAR_LISP ("gtk-version-string", Vgtk_version_string,
                doc: /* Version info for GTK+.  */);
   {
-    char gtk_version[40];
-    g_snprintf (gtk_version, sizeof (gtk_version), "%u.%u.%u",
-                GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
-    Vgtk_version_string = make_pure_string (gtk_version, strlen (gtk_version), strlen (gtk_version), 0);
+    char gtk_version[sizeof ".." + 3 * INT_STRLEN_BOUND (int)];
+    int len = sprintf (gtk_version, "%d.%d.%d",
+                      GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+    Vgtk_version_string = make_pure_string (gtk_version, len, len, 0);
   }
 #endif /* USE_GTK */
 
index 25bb8a94fd9585f4973310bd938daaf75cfc41cc..0443b49de8f6c72514817f8c107fd99ce66b14d6 100644 (file)
@@ -132,7 +132,7 @@ static int xfont_check (FRAME_PTR, struct font *);
 
 struct font_driver xfont_driver =
   {
-    0,                         /* Qx */
+    LISP_INITIALLY_ZERO,       /* Qx */
     0,                         /* case insensitive */
     xfont_get_cache,
     xfont_list,
@@ -164,8 +164,9 @@ xfont_get_cache (FRAME_PTR f)
 static int
 compare_font_names (const void *name1, const void *name2)
 {
-  return xstrcasecmp (*(const char **) name1,
-                     *(const char **) name2);
+  char *const *n1 = name1;
+  char *const *n2 = name2;
+  return xstrcasecmp (*n1, *n2);
 }
 
 /* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length
@@ -173,7 +174,7 @@ compare_font_names (const void *name1, const void *name2)
    XLFD is NULL terminated.  The caller must assure that OUTPUT is at
    least twice (plus 1) as large as XLFD.  */
 
-static int
+static ptrdiff_t
 xfont_decode_coding_xlfd (char *xlfd, int len, char *output)
 {
   char *p0 = xlfd, *p1 = output;
@@ -248,7 +249,7 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont,
     }
   else if (VECTORP (chars))
     {
-      int i;
+      ptrdiff_t i;
 
       for (i = ASIZE (chars) - 1; i >= 0; i--)
        {
@@ -396,13 +397,14 @@ xfont_list_pattern (Display *display, const char *pattern,
 
       for (i = 0; i < num_fonts; i++)
        {
+         ptrdiff_t len;
          Lisp_Object entity;
 
          if (i > 0 && xstrcasecmp (indices[i - 1], indices[i]) == 0)
            continue;
          entity = font_make_entity ();
-         xfont_decode_coding_xlfd (indices[i], -1, buf);
-         if (font_parse_xlfd (buf, entity) < 0)
+         len = xfont_decode_coding_xlfd (indices[i], -1, buf);
+         if (font_parse_xlfd (buf, len, entity) < 0)
            continue;
          ASET (entity, FONT_TYPE_INDEX, Qx);
          /* Avoid auto-scaled fonts.  */
@@ -432,7 +434,8 @@ xfont_list_pattern (Display *display, const char *pattern,
                {
                  elt = XCAR (tail);
                  if (STRINGP (elt)
-                     && fast_c_string_match_ignore_case (elt, indices[i]) >= 0)
+                     && fast_c_string_match_ignore_case (elt, indices[i],
+                                                         len) >= 0)
                    break;
                }
              if (! CONSP (tail))
@@ -603,10 +606,11 @@ xfont_match (Lisp_Object frame, Lisp_Object spec)
             string.  We must avoid such a name.  */
          if (*s)
            {
+             ptrdiff_t len;
              entity = font_make_entity ();
              ASET (entity, FONT_TYPE_INDEX, Qx);
-             xfont_decode_coding_xlfd (s, -1, name);
-             if (font_parse_xlfd (name, entity) < 0)
+             len = xfont_decode_coding_xlfd (s, -1, name);
+             if (font_parse_xlfd (name, len, entity) < 0)
                entity = Qnil;
            }
          XFree (s);
@@ -795,7 +799,7 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
   ASET (font_object, FONT_TYPE_INDEX, Qx);
   if (STRINGP (fullname))
     {
-      font_parse_xlfd (SSDATA (fullname), font_object);
+      font_parse_xlfd (SSDATA (fullname), SBYTES (fullname), font_object);
       ASET (font_object, FONT_NAME_INDEX, fullname);
     }
   else
index bc0c56a0fe04cbc345c513f616f621533beba945..f999ac662ce054924660d1e0989ecffac0fb3991 100644 (file)
@@ -527,7 +527,7 @@ xftfont_prepare_face (FRAME_PTR f, struct face *face)
     }
 #endif
 
-  xftface_info = malloc (sizeof (struct xftface_info));
+  xftface_info = malloc (sizeof *xftface_info);
   if (! xftface_info)
     return -1;
   xftfont_get_colors (f, face, face->gc, NULL,
index 80dbfc32aee86726337115c686e4dcb1664bf1bd..04ca00274e8ac821512636d016bcbdb215d7764c 100644 (file)
@@ -27,28 +27,33 @@ along with GNU Emacs.  If not, see <http§://www.gnu.org/licenses/>.  */
 #include <glib.h>
 #include <errno.h>
 #include <setjmp.h>
+#include "xterm.h"
 
 static GPollFD *gfds;
 static ptrdiff_t gfds_size;
 
 int
-xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
-          EMACS_TIME *timeout)
+xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
+          EMACS_TIME *timeout, sigset_t *sigmask)
 {
   SELECT_TYPE all_rfds, all_wfds;
   EMACS_TIME tmo, *tmop = timeout;
 
-  GMainContext *context = g_main_context_default ();
+  GMainContext *context;
   int have_wfds = wfds != NULL;
-  int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0;
+  int n_gfds = 0, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
   int i, nfds, tmo_in_millisec;
 
+  if (!x_in_use)
+    return pselect (fds_lim, rfds, wfds, efds, tmop, sigmask);
+
   if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));
   else FD_ZERO (&all_rfds);
   if (wfds) memcpy (&all_wfds, wfds, sizeof (all_rfds));
   else FD_ZERO (&all_wfds);
 
   /* Update event sources in GLib. */
+  context = g_main_context_default ();
   g_main_context_pending (context);
 
   do {
@@ -83,28 +88,21 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
 
   if (tmo_in_millisec >= 0)
     {
-      EMACS_SET_SECS_USECS (tmo, tmo_in_millisec/1000,
-                            1000 * (tmo_in_millisec % 1000));
-      if (!timeout) our_tmo = 1;
-      else
-        {
-          EMACS_TIME difference;
-
-          EMACS_SUB_TIME (difference, tmo, *timeout);
-          if (EMACS_TIME_NEG_P (difference)) our_tmo = 1;
-        }
-
-      if (our_tmo) tmop = &tmo;
+      tmo = make_emacs_time (tmo_in_millisec / 1000,
+                            1000 * 1000 * (tmo_in_millisec % 1000));
+      if (!timeout || EMACS_TIME_LT (tmo, *timeout))
+       tmop = &tmo;
     }
 
-  nfds = select (max_fds+1, &all_rfds, have_wfds ? &all_wfds : NULL,
-                 efds, tmop);
+  fds_lim = max_fds + 1;
+  nfds = pselect (fds_lim, &all_rfds, have_wfds ? &all_wfds : NULL,
+                 efds, tmop, sigmask);
 
   if (nfds < 0)
     retval = nfds;
   else if (nfds > 0)
     {
-      for (i = 0; i < max_fds+1; ++i)
+      for (i = 0; i < fds_lim; ++i)
         {
           if (FD_ISSET (i, &all_rfds))
             {
@@ -127,7 +125,7 @@ xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
         }
     }
 
-  if (our_fds > 0 || (nfds == 0 && our_tmo))
+  if (our_fds > 0 || (nfds == 0 && tmop == &tmo))
     {
 
       /* If Gtk+ is in use eventually gtk_main_iteration will be called,
@@ -155,6 +153,6 @@ xgselect_initialize (void)
 {
 #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
   gfds_size = 128;
-  gfds = xmalloc (sizeof (*gfds)*gfds_size);
+  gfds = xmalloc (gfds_size * sizeof *gfds);
 #endif
 }
index 15d7cd5fdd3d06948dc880cafcc164a98382196b..8e5614ea972854aed0c4dc5d4dd7f2985629df06 100644 (file)
@@ -28,9 +28,9 @@ extern int xg_select (int max_fds,
                       SELECT_TYPE *rfds,
                       SELECT_TYPE *wfds,
                       SELECT_TYPE *efds,
-                      EMACS_TIME *timeout);
+                      EMACS_TIME *timeout,
+                     sigset_t *sigmask);
 
 extern void xgselect_initialize (void);
 
 #endif /* XGSELECT_H */
-
index 5f0a273948a1d3c4b636ba2cc6bff5959e790d6f..61e3e3632b0ae9b8ceac56323dc8d47c489aa265 100644 (file)
@@ -47,6 +47,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "termhooks.h"
 #include "window.h"
 #include "blockinput.h"
+#include "character.h"
 #include "buffer.h"
 #include "charset.h"
 #include "coding.h"
@@ -257,13 +258,12 @@ for instance using the window manager, then this produces a quit and
     }
   else if (CONSP (position))
     {
-      Lisp_Object tem;
-      tem = Fcar (position);
+      Lisp_Object tem = XCAR (position);
       if (CONSP (tem))
-       window = Fcar (Fcdr (position));
+       window = Fcar (XCDR (position));
       else
        {
-         tem = Fcar (Fcdr (position));  /* EVENT_START (position) */
+         tem = Fcar (XCDR (position));  /* EVENT_START (position) */
          window = Fcar (tem);       /* POSN_WINDOW (tem) */
        }
     }
@@ -318,7 +318,7 @@ for instance using the window manager, then this produces a quit and
     Lisp_Object title;
     const char *error_name;
     Lisp_Object selection;
-    int specpdl_count = SPECPDL_INDEX ();
+    ptrdiff_t specpdl_count = SPECPDL_INDEX ();
 
     /* Decode the dialog items from what was specified.  */
     title = Fcar (contents);
@@ -391,8 +391,6 @@ x_menu_wait_for_event (void *data)
          )
     {
       EMACS_TIME next_time = timer_check (), *ntp;
-      long secs = EMACS_SECS (next_time);
-      long usecs = EMACS_USECS (next_time);
       SELECT_TYPE read_fds;
       struct x_display_info *dpyinfo;
       int n = 0;
@@ -406,19 +404,18 @@ x_menu_wait_for_event (void *data)
           XFlush (dpyinfo->display);
         }
 
-      if (secs < 0 && usecs < 0)
+      if (! EMACS_TIME_VALID_P (next_time))
         ntp = 0;
       else
         ntp = &next_time;
 
 #ifdef HAVE_GTK3
-      /* Gtk3 have arrows on menus when they don't fit.  When the pointer is
-         over an arrow, a timeout scrolls it a bit.  Use xg_select so that
-         timeout gets triggered.  */
-
-      xg_select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, ntp);
+      /* Gtk3 have arrows on menus when they don't fit.  When the
+        pointer is over an arrow, a timeout scrolls it a bit.  Use
+        xg_select so that timeout gets triggered.  */
+      xg_select (n + 1, &read_fds, NULL, NULL, ntp, NULL);
 #else
-      select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, ntp);
+      pselect (n + 1, &read_fds, NULL, NULL, ntp, NULL);
 #endif
     }
 }
@@ -963,7 +960,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
   else if (!f->output_data.x->saved_menu_event && !deep_p)
     {
       deep_p = 1;
-      f->output_data.x->saved_menu_event = (XEvent*)xmalloc (sizeof (XEvent));
+      f->output_data.x->saved_menu_event = xmalloc (sizeof (XEvent));
       f->output_data.x->saved_menu_event->type = 0;
     }
 
@@ -979,11 +976,10 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
 
       struct buffer *prev = current_buffer;
       Lisp_Object buffer;
-      int specpdl_count = SPECPDL_INDEX ();
+      ptrdiff_t specpdl_count = SPECPDL_INDEX ();
       int previous_menu_items_used = f->menu_bar_items_used;
       Lisp_Object *previous_items
-       = (Lisp_Object *) alloca (previous_menu_items_used
-                                 * sizeof (Lisp_Object));
+       = alloca (previous_menu_items_used * sizeof *previous_items);
       int subitems;
 
       /* If we are making a new widget, its contents are empty,
@@ -1030,18 +1026,19 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
       menu_items = f->menu_bar_vector;
       menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
       subitems = ASIZE (items) / 4;
-      submenu_start = (int *) alloca ((subitems + 1) * sizeof (int));
-      submenu_end = (int *) alloca (subitems * sizeof (int));
-      submenu_n_panes = (int *) alloca (subitems * sizeof (int));
-      submenu_top_level_items = (int *) alloca (subitems * sizeof (int));
+      submenu_start = alloca ((subitems + 1) * sizeof *submenu_start);
+      submenu_end = alloca (subitems * sizeof *submenu_end);
+      submenu_n_panes = alloca (subitems * sizeof *submenu_n_panes);
+      submenu_top_level_items = alloca (subitems
+                                       * sizeof *submenu_top_level_items);
       init_menu_items ();
       for (i = 0; i < subitems; i++)
        {
          Lisp_Object key, string, maps;
 
-         key = XVECTOR (items)->contents[4 * i];
-         string = XVECTOR (items)->contents[4 * i + 1];
-         maps = XVECTOR (items)->contents[4 * i + 2];
+         key = AREF (items, 4 * i);
+         string = AREF (items, 4 * i + 1);
+         maps = AREF (items, 4 * i + 2);
          if (NILP (string))
            break;
 
@@ -1092,7 +1089,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
       /* Compare the new menu items with the ones computed last time.  */
       for (i = 0; i < previous_menu_items_used; i++)
        if (menu_items_used == i
-           || (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i])))
+           || (!EQ (previous_items[i], AREF (menu_items, i))))
          break;
       if (i == menu_items_used && i == previous_menu_items_used && i != 0)
        {
@@ -1117,7 +1114,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
       for (i = 0; i < ASIZE (items); i += 4)
        {
          Lisp_Object string;
-         string = XVECTOR (items)->contents[i + 1];
+         string = AREF (items, i + 1);
          if (NILP (string))
             break;
           wv->name = SSDATA (string);
@@ -1144,7 +1141,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
        {
          Lisp_Object string;
 
-         string = XVECTOR (items)->contents[i + 1];
+         string = AREF (items, i + 1);
          if (NILP (string))
            break;
 
@@ -1445,7 +1442,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
   GtkWidget *menu;
   GtkMenuPositionFunc pos_func = 0;  /* Pop up at pointer.  */
   struct next_popup_x_y popup_x_y;
-  int specpdl_count = SPECPDL_INDEX ();
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
   int use_pos_func = ! for_click;
 
 #ifdef HAVE_GTK3
@@ -1609,7 +1606,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
 
   {
     int fact = 4 * sizeof (LWLIB_ID);
-    int specpdl_count = SPECPDL_INDEX ();
+    ptrdiff_t specpdl_count = SPECPDL_INDEX ();
     record_unwind_protect (pop_down_menu,
                            Fcons (make_number (menu_id >> (fact)),
                                   make_number (menu_id & ~(-1 << (fact)))));
@@ -1641,14 +1638,14 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
   int i;
   widget_value *wv, *save_wv = 0, *first_wv = 0, *prev_wv = 0;
   widget_value **submenu_stack
-    = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
+    = alloca (menu_items_used * sizeof *submenu_stack);
   Lisp_Object *subprefix_stack
-    = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
+    = alloca (menu_items_used * sizeof *subprefix_stack);
   int submenu_depth = 0;
 
   int first_pane;
 
-  int specpdl_count = SPECPDL_INDEX ();
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
 
   if (! FRAME_X_P (f))
     abort ();
@@ -1676,7 +1673,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
   i = 0;
   while (i < menu_items_used)
     {
-      if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
+      if (EQ (AREF (menu_items, i), Qnil))
        {
          submenu_stack[submenu_depth++] = save_wv;
          save_wv = prev_wv;
@@ -1684,21 +1681,21 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
          first_pane = 1;
          i++;
        }
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda))
+      else if (EQ (AREF (menu_items, i), Qlambda))
        {
          prev_wv = save_wv;
          save_wv = submenu_stack[--submenu_depth];
          first_pane = 0;
          i++;
        }
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qt)
+      else if (EQ (AREF (menu_items, i), Qt)
               && submenu_depth != 0)
        i += MENU_ITEMS_PANE_LENGTH;
       /* Ignore a nil in the item list.
         It's meaningful only for dialog boxes.  */
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
+      else if (EQ (AREF (menu_items, i), Qquote))
        i += 1;
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
+      else if (EQ (AREF (menu_items, i), Qt))
        {
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
@@ -1731,7 +1728,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
                save_wv->next = wv;
              else
                first_wv->contents = wv;
-             wv->name = pane_string;
+             wv->name = (char *) pane_string;
              if (keymaps && !NILP (prefix))
                wv->name++;
              wv->value = 0;
@@ -1788,7 +1785,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
             make the call_data null so that it won't display a box
             when the mouse is on it.  */
          wv->call_data
-           = (!NILP (def) ? (void *) &XVECTOR (menu_items)->contents[i] : 0);
+           = (!NILP (def) ? (void *) &AREF (menu_items, i) : 0);
          wv->enabled = !NILP (enable);
 
          if (NILP (type))
@@ -1864,32 +1861,32 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
       i = 0;
       while (i < menu_items_used)
        {
-         if (EQ (XVECTOR (menu_items)->contents[i], Qnil))
+         if (EQ (AREF (menu_items, i), Qnil))
            {
              subprefix_stack[submenu_depth++] = prefix;
              prefix = entry;
              i++;
            }
-         else if (EQ (XVECTOR (menu_items)->contents[i], Qlambda))
+         else if (EQ (AREF (menu_items, i), Qlambda))
            {
              prefix = subprefix_stack[--submenu_depth];
              i++;
            }
-         else if (EQ (XVECTOR (menu_items)->contents[i], Qt))
+         else if (EQ (AREF (menu_items, i), Qt))
            {
              prefix
-               = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
+               = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
              i += MENU_ITEMS_PANE_LENGTH;
            }
          /* Ignore a nil in the item list.
             It's meaningful only for dialog boxes.  */
-         else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
+         else if (EQ (AREF (menu_items, i), Qquote))
            i += 1;
          else
            {
              entry
-               = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE];
-             if (menu_item_selection == &XVECTOR (menu_items)->contents[i])
+               = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
+             if (menu_item_selection == &AREF (menu_items, i))
                {
                  if (keymaps != 0)
                    {
@@ -1945,7 +1942,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
 
   if (menu)
     {
-      int specpdl_count = SPECPDL_INDEX ();
+      ptrdiff_t specpdl_count = SPECPDL_INDEX ();
       record_unwind_protect (pop_down_menu, make_save_value (menu, 0));
 
       /* Display the menu.  */
@@ -2001,7 +1998,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv)
   /* Process events that apply to the dialog box.
      Also handle timers.  */
   {
-    int count = SPECPDL_INDEX ();
+    ptrdiff_t count = SPECPDL_INDEX ();
     int fact = 4 * sizeof (LWLIB_ID);
 
     /* xdialog_show_unwind is responsible for popping the dialog box down.  */
@@ -2039,7 +2036,7 @@ xdialog_show (FRAME_PTR f,
   /* 1 means we've seen the boundary between left-hand elts and right-hand.  */
   int boundary_seen = 0;
 
-  int specpdl_count = SPECPDL_INDEX ();
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
 
   if (! FRAME_X_P (f))
     abort ();
@@ -2057,12 +2054,12 @@ xdialog_show (FRAME_PTR f,
   {
     Lisp_Object pane_name, prefix;
     const char *pane_string;
-    pane_name = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_NAME];
-    prefix = XVECTOR (menu_items)->contents[MENU_ITEMS_PANE_PREFIX];
+    pane_name = AREF (menu_items, MENU_ITEMS_PANE_NAME);
+    prefix = AREF (menu_items, MENU_ITEMS_PANE_PREFIX);
     pane_string = (NILP (pane_name)
                   ? "" : SSDATA (pane_name));
     prev_wv = xmalloc_widget_value ();
-    prev_wv->value = pane_string;
+    prev_wv->value = (char *) pane_string;
     if (keymaps && !NILP (prefix))
       prev_wv->name++;
     prev_wv->enabled = 1;
@@ -2077,10 +2074,10 @@ xdialog_show (FRAME_PTR f,
 
        /* Create a new item within current pane.  */
        Lisp_Object item_name, enable, descrip;
-       item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
-       enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
+       item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
+       enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
        descrip
-         = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
+         = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
 
        if (NILP (item_name))
          {
@@ -2109,7 +2106,7 @@ xdialog_show (FRAME_PTR f,
        if (!NILP (descrip))
          wv->key = SSDATA (descrip);
        wv->value = SSDATA (item_name);
-       wv->call_data = (void *) &XVECTOR (menu_items)->contents[i];
+       wv->call_data = (void *) &AREF (menu_items, i);
        wv->enabled = !NILP (enable);
        wv->help = Qnil;
        prev_wv = wv;
@@ -2176,13 +2173,13 @@ xdialog_show (FRAME_PTR f,
        {
          Lisp_Object entry;
 
-         if (EQ (XVECTOR (menu_items)->contents[i], Qt))
+         if (EQ (AREF (menu_items, i), Qt))
            {
              prefix
-               = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
+               = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
              i += MENU_ITEMS_PANE_LENGTH;
            }
-         else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
+         else if (EQ (AREF (menu_items, i), Qquote))
            {
              /* This is the boundary between left-side elts and
                 right-side elts.  */
@@ -2191,8 +2188,8 @@ xdialog_show (FRAME_PTR f,
          else
            {
              entry
-               = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE];
-             if (menu_item_selection == &XVECTOR (menu_items)->contents[i])
+               = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
+             if (menu_item_selection == &AREF (menu_items, i))
                {
                  if (keymaps != 0)
                    {
@@ -2304,7 +2301,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
   int maxwidth;
   int dummy_int;
   unsigned int dummy_uint;
-  int specpdl_count = SPECPDL_INDEX ();
+  ptrdiff_t specpdl_count = SPECPDL_INDEX ();
 
   if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
     abort ();
@@ -2352,7 +2349,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
   lpane = XM_FAILURE;
   while (i < menu_items_used)
     {
-      if (EQ (XVECTOR (menu_items)->contents[i], Qt))
+      if (EQ (AREF (menu_items, i), Qt))
        {
          /* Create a new pane.  */
          Lisp_Object pane_name, prefix;
@@ -2360,8 +2357,8 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
 
           maxlines = max (maxlines, lines);
           lines = 0;
-         pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
-         prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
+         pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
+         prefix = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
          pane_string = (NILP (pane_name)
                         ? "" : SSDATA (pane_name));
          if (keymaps && !NILP (prefix))
@@ -2381,7 +2378,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
          while (j < menu_items_used)
            {
              Lisp_Object item;
-             item = XVECTOR (menu_items)->contents[j];
+             item = AREF (menu_items, j);
              if (EQ (item, Qt))
                break;
              if (NILP (item))
@@ -2398,7 +2395,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
        }
       /* Ignore a nil in the item list.
         It's meaningful only for dialog boxes.  */
-      else if (EQ (XVECTOR (menu_items)->contents[i], Qquote))
+      else if (EQ (AREF (menu_items, i), Qquote))
        i += 1;
       else
        {
@@ -2407,18 +2404,18 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
          char *item_data;
          char const *help_string;
 
-         item_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_NAME];
-         enable = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_ENABLE];
+         item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
+         enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
          descrip
-           = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
-         help = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_HELP];
+           = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
+         help = AREF (menu_items, i + MENU_ITEMS_ITEM_HELP);
          help_string = STRINGP (help) ? SSDATA (help) : NULL;
 
          if (!NILP (descrip))
            {
              /* if alloca is fast, use that to make the space,
                 to reduce gc needs.  */
-             item_data = (char *) alloca (maxwidth + SBYTES (descrip) + 1);
+             item_data = alloca (maxwidth + SBYTES (descrip) + 1);
              memcpy (item_data, SSDATA (item_name), SBYTES (item_name));
              for (j = SCHARS (item_name); j < maxwidth; j++)
                item_data[j] = ' ';
@@ -2525,11 +2522,11 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
       i = 0;
       while (i < menu_items_used)
        {
-         if (EQ (XVECTOR (menu_items)->contents[i], Qt))
+         if (EQ (AREF (menu_items, i), Qt))
            {
              if (pane == 0)
                pane_prefix
-                 = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
+                 = AREF (menu_items, i + MENU_ITEMS_PANE_PREFIX);
              pane--;
              i += MENU_ITEMS_PANE_LENGTH;
            }
@@ -2540,7 +2537,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
                  if (selidx == 0)
                    {
                      entry
-                       = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE];
+                       = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
                      if (keymaps != 0)
                        {
                          entry = Fcons (entry, Qnil);
index 5c4b6ee35f00890043b7dd408b8918b56820ab93..7bc6130b8b1d1487af2b33e1bb2caa65c8c61b21 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -26,8 +26,100 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <libxml/HTMLparser.h>
 
 #include "lisp.h"
+#include "character.h"
 #include "buffer.h"
 
+\f
+static Lisp_Object Qlibxml2_dll;
+
+#ifdef WINDOWSNT
+
+#include <windows.h>
+#include "w32.h"
+
+/* Macro for defining functions that will be loaded from the libxml2 DLL.  */
+#define DEF_XML2_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args
+
+/* Macro for loading libxml2 functions from the library.  */
+#define LOAD_XML2_FN(lib,func) {                                       \
+    fn_##func = (void *) GetProcAddress (lib, #func);                  \
+    if (!fn_##func) goto bad_library;                                  \
+  }
+
+DEF_XML2_FN (htmlDocPtr, htmlReadMemory,
+            (const char *, int, const char *, const char *, int));
+DEF_XML2_FN (xmlDocPtr, xmlReadMemory,
+            (const char *, int, const char *, const char *, int));
+DEF_XML2_FN (xmlNodePtr, xmlDocGetRootElement, (xmlDocPtr));
+DEF_XML2_FN (void, xmlFreeDoc, (xmlDocPtr));
+DEF_XML2_FN (void, xmlCleanupParser, (void));
+DEF_XML2_FN (void, xmlCheckVersion, (int));
+
+static int
+libxml2_loaded_p (void)
+{
+  Lisp_Object found = Fassq (Qlibxml2_dll, Vlibrary_cache);
+
+  if (CONSP (found))
+    return EQ (XCDR (found), Qt) ? 1 : 0;
+  return 0;
+}
+
+#else  /* !WINDOWSNT */
+
+#define fn_htmlReadMemory       htmlReadMemory
+#define fn_xmlReadMemory        xmlReadMemory
+#define fn_xmlDocGetRootElement xmlDocGetRootElement
+#define fn_xmlFreeDoc           xmlFreeDoc
+#define fn_xmlCleanupParser     xmlCleanupParser
+#define fn_xmlCheckVersion      xmlCheckVersion
+
+static inline int
+libxml2_loaded_p (void)
+{
+  return 1;
+}
+
+#endif /* !WINDOWSNT */
+
+static int
+init_libxml2_functions (Lisp_Object libraries)
+{
+#ifdef WINDOWSNT
+  if (libxml2_loaded_p ())
+    return 1;
+  else
+    {
+      HMODULE library;
+
+      if (!(library = w32_delayed_load (libraries, Qlibxml2_dll)))
+       {
+         message ("%s", "libxml2 library not found");
+         return 0;
+       }
+
+      /* LOAD_XML2_FN jumps to bad_library if it fails to find the
+        named function.  */
+      LOAD_XML2_FN (library, htmlReadMemory);
+      LOAD_XML2_FN (library, xmlReadMemory);
+      LOAD_XML2_FN (library, xmlDocGetRootElement);
+      LOAD_XML2_FN (library, xmlFreeDoc);
+      LOAD_XML2_FN (library, xmlCleanupParser);
+      LOAD_XML2_FN (library, xmlCheckVersion);
+
+      Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qt), Vlibrary_cache);
+      return 1;
+    }
+
+ bad_library:
+  Vlibrary_cache = Fcons (Fcons (Qlibxml2_dll, Qnil), Vlibrary_cache);
+
+  return 0;
+#else  /* !WINDOWSNT */
+  return 1;
+#endif /* !WINDOWSNT */
+}
+
 static Lisp_Object
 make_dom (xmlNode *node)
 {
@@ -89,10 +181,10 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
   xmlDoc *doc;
   Lisp_Object result = Qnil;
   const char *burl = "";
-  EMACS_INT bytes;
-  EMACS_INT istart, iend;
+  ptrdiff_t bytes;
+  ptrdiff_t istart, iend;
 
-  LIBXML_TEST_VERSION;
+  fn_xmlCheckVersion (LIBXML_VERSION);
 
   validate_region (&start, &end);
 
@@ -111,16 +203,16 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
   bytes = CHAR_TO_BYTE (iend) - CHAR_TO_BYTE (istart);
 
   if (htmlp)
-    doc = htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
-                         bytes, burl, "utf-8",
-                         HTML_PARSE_RECOVER|HTML_PARSE_NONET|
-                         HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
-                         HTML_PARSE_NOBLANKS);
+    doc = fn_htmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
+                            bytes, burl, "utf-8",
+                            HTML_PARSE_RECOVER|HTML_PARSE_NONET|
+                            HTML_PARSE_NOWARNING|HTML_PARSE_NOERROR|
+                            HTML_PARSE_NOBLANKS);
   else
-    doc = xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
-                        bytes, burl, "utf-8",
-                        XML_PARSE_NONET|XML_PARSE_NOWARNING|
-                        XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
+    doc = fn_xmlReadMemory ((char *) BYTE_POS_ADDR (CHAR_TO_BYTE (istart)),
+                           bytes, burl, "utf-8",
+                           XML_PARSE_NONET|XML_PARSE_NOWARNING|
+                           XML_PARSE_NOBLANKS |XML_PARSE_NOERROR);
 
   if (doc != NULL)
     {
@@ -139,19 +231,26 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html
       if (NILP (result)) {
        /* The document isn't just comments, so get the tree the
           proper way. */
-       xmlNode *node = xmlDocGetRootElement (doc);
+       xmlNode *node = fn_xmlDocGetRootElement (doc);
        if (node != NULL)
          result = make_dom (node);
       } else
        result = Fcons (intern ("top"),
                        Fcons (Qnil, Fnreverse (Fcons (r, result))));
 
-      xmlFreeDoc (doc);
+      fn_xmlFreeDoc (doc);
     }
 
   return result;
 }
 
+void
+xml_cleanup_parser (void)
+{
+  if (libxml2_loaded_p ())
+    fn_xmlCleanupParser ();
+}
+
 DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
        Slibxml_parse_html_region,
        2, 3, 0,
@@ -159,7 +258,9 @@ DEFUN ("libxml-parse-html-region", Flibxml_parse_html_region,
 If BASE-URL is non-nil, it is used to expand relative URLs.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
 {
-  return parse_region (start, end, base_url, 1);
+  if (init_libxml2_functions (Vdynamic_library_alist))
+    return parse_region (start, end, base_url, 1);
+  return Qnil;
 }
 
 DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
@@ -169,7 +270,9 @@ DEFUN ("libxml-parse-xml-region", Flibxml_parse_xml_region,
 If BASE-URL is non-nil, it is used to expand relative URLs.  */)
   (Lisp_Object start, Lisp_Object end, Lisp_Object base_url)
 {
-  return parse_region (start, end, base_url, 0);
+  if (init_libxml2_functions (Vdynamic_library_alist))
+    return parse_region (start, end, base_url, 0);
+  return Qnil;
 }
 
 \f
@@ -181,6 +284,8 @@ syms_of_xml (void)
 {
   defsubr (&Slibxml_parse_html_region);
   defsubr (&Slibxml_parse_xml_region);
+
+  DEFSYM (Qlibxml2_dll, "libxml2");
 }
 
 #endif /* HAVE_LIBXML2 */
index 5998e49b07e3697b83cb53f37cec351c1daa4412..624bafa5e928b4a73872b53cfedc0a37ef85ea1d 100644 (file)
@@ -74,10 +74,8 @@ static char *
 x_get_customization_string (XrmDatabase db, const char *name,
                            const char *class)
 {
-  char *full_name
-    = (char *) alloca (strlen (name) + sizeof ("customization") + 3);
-  char *full_class
-    = (char *) alloca (strlen (class) + sizeof ("Customization") + 3);
+  char *full_name = alloca (strlen (name) + sizeof "customization" + 3);
+  char *full_class = alloca (strlen (class) + sizeof "Customization" + 3);
   char *result;
 
   sprintf (full_name,  "%s.%s", name,  "customization");
@@ -87,7 +85,7 @@ x_get_customization_string (XrmDatabase db, const char *name,
 
   if (result)
     {
-      char *copy = (char *) xmalloc (strlen (result) + 1);
+      char *copy = xmalloc (strlen (result) + 1);
       strcpy (copy, result);
       return copy;
     }
@@ -126,13 +124,13 @@ x_get_customization_string (XrmDatabase db, const char *name,
    Return NULL otherwise.  */
 
 static char *
-magic_file_p (const char *string, EMACS_INT string_len, const char *class,
+magic_file_p (const char *string, ptrdiff_t string_len, const char *class,
              const char *escaped_suffix)
 {
   char *lang = getenv ("LANG");
 
   ptrdiff_t path_size = 100;
-  char *path = (char *) xmalloc (path_size);
+  char *path = xmalloc (path_size);
   ptrdiff_t path_len = 0;
 
   const char *p = string;
@@ -206,7 +204,7 @@ magic_file_p (const char *string, EMACS_INT string_len, const char *class,
          if (min (PTRDIFF_MAX, SIZE_MAX) / 2 - 1 - path_len < next_len)
            memory_full (SIZE_MAX);
          path_size = (path_len + next_len + 1) * 2;
-         path = (char *) xrealloc (path, path_size);
+         path = xrealloc (path, path_size);
        }
 
       memcpy (path + path_len, next, next_len);
@@ -258,7 +256,7 @@ gethomedir (void)
   if (ptr == NULL)
     return xstrdup ("/");
 
-  copy = (char *) xmalloc (strlen (ptr) + 2);
+  copy = xmalloc (strlen (ptr) + 2);
   strcpy (copy, ptr);
   strcat (copy, "/");
 
@@ -400,7 +398,7 @@ get_user_db (Display *display)
       char *xdefault;
 
       home = gethomedir ();
-      xdefault = (char *) xmalloc (strlen (home) + sizeof (".Xdefaults"));
+      xdefault = xmalloc (strlen (home) + sizeof ".Xdefaults");
       strcpy (xdefault, home);
       strcat (xdefault, ".Xdefaults");
       db = XrmGetFileDatabase (xdefault);
@@ -434,7 +432,7 @@ get_environ_db (void)
       char *home = gethomedir ();
       char const *host = get_system_name ();
       ptrdiff_t pathsize = strlen (home) + sizeof xdefaults + strlen (host);
-      path = (char *) xrealloc (home, pathsize);
+      path = xrealloc (home, pathsize);
       strcat (strcat (path, xdefaults), host);
       p = path;
     }
index 15ce8d487fa04c798f2af9c5e64de10d9c93d4d5..e2da561e953ef2312dd5b296b5b833f0d683590b 100644 (file)
@@ -35,11 +35,11 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "dispextern.h"        /* frame.h seems to want this */
 #include "frame.h"     /* Need this to get the X window of selected_frame */
 #include "blockinput.h"
+#include "character.h"
 #include "buffer.h"
 #include "process.h"
 #include "termhooks.h"
 #include "keyboard.h"
-#include "character.h"
 
 #include <X11/Xproto.h>
 
@@ -81,13 +81,13 @@ static Lisp_Object clean_local_selection_data (Lisp_Object);
 
 #ifdef TRACE_SELECTION
 #define TRACE0(fmt) \
-  fprintf (stderr, "%d: " fmt "\n", getpid ())
+  fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid ())
 #define TRACE1(fmt, a0) \
-  fprintf (stderr, "%d: " fmt "\n", getpid (), a0)
+  fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0)
 #define TRACE2(fmt, a0, a1) \
-  fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1)
+  fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0, a1)
 #define TRACE3(fmt, a0, a1, a2) \
-  fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1, a2)
+  fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0, a1, a2)
 #else
 #define TRACE0(fmt)            (void) 0
 #define TRACE1(fmt, a0)                (void) 0
@@ -180,16 +180,11 @@ x_queue_event (struct input_event *event)
        }
     }
 
-  queue_tmp
-    = (struct selection_event_queue *) xmalloc (sizeof (struct selection_event_queue));
-
-  if (queue_tmp != NULL)
-    {
-      TRACE1 ("QUEUE SELECTION EVENT %p", queue_tmp);
-      queue_tmp->event = *event;
-      queue_tmp->next = selection_queue;
-      selection_queue = queue_tmp;
-    }
+  queue_tmp = xmalloc (sizeof *queue_tmp);
+  TRACE1 ("QUEUE SELECTION EVENT %p", queue_tmp);
+  queue_tmp->event = *event;
+  queue_tmp->next = selection_queue;
+  selection_queue = queue_tmp;
 }
 
 /* Start queuing SELECTION_REQUEST_EVENT events.  */
@@ -392,7 +387,6 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
 {
   Lisp_Object local_value;
   Lisp_Object handler_fn, value, check;
-  int count;
 
   local_value = LOCAL_SELECTION (selection_symbol, dpyinfo);
 
@@ -409,7 +403,7 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
       /* Don't allow a quit within the converter.
         When the user types C-g, he would be surprised
         if by luck it came during a converter.  */
-      count = SPECPDL_INDEX ();
+      ptrdiff_t count = SPECPDL_INDEX ();
       specbind (Qinhibit_quit, Qt);
 
       CHECK_SYMBOL (target_type);
@@ -603,7 +597,7 @@ x_reply_selection_request (struct input_event *event,
   Window window = SELECTION_EVENT_REQUESTOR (event);
   ptrdiff_t bytes_remaining;
   int max_bytes = selection_quantum (display);
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   struct selection_data *cs;
 
   reply->type = SelectionNotify;
@@ -792,7 +786,7 @@ x_handle_selection_request (struct input_event *event)
   Atom property = SELECTION_EVENT_PROPERTY (event);
   Lisp_Object local_selection_data;
   int success = 0;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
   GCPRO2 (local_selection_data, target_symbol);
 
   if (!dpyinfo) goto DONE;
@@ -913,7 +907,7 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol,
     {
       if (for_multiple)
        {
-         cs = xmalloc (sizeof (struct selection_data));
+         cs = xmalloc (sizeof *cs);
          cs->data = (unsigned char *) &conversion_fail_tag;
          cs->size = 1;
          cs->format = 32;
@@ -930,7 +924,7 @@ x_convert_selection (struct input_event *event, Lisp_Object selection_symbol,
     }
 
   /* Otherwise, record the converted selection to binary.  */
-  cs = xmalloc (sizeof (struct selection_data));
+  cs = xmalloc (sizeof *cs);
   cs->data = NULL;
   cs->nofree = 1;
   cs->property = property;
@@ -1086,7 +1080,7 @@ static struct prop_location *
 expect_property_change (Display *display, Window window,
                         Atom property, int state)
 {
-  struct prop_location *pl = (struct prop_location *) xmalloc (sizeof *pl);
+  struct prop_location *pl = xmalloc (sizeof *pl);
   pl->identifier = ++prop_location_identifier;
   pl->display = display;
   pl->window = window;
@@ -1140,8 +1134,7 @@ wait_for_property_change_unwind (Lisp_Object loc)
 static void
 wait_for_property_change (struct prop_location *location)
 {
-  int secs, usecs;
-  int count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX ();
 
   if (property_change_reply_object)
     abort ();
@@ -1157,10 +1150,11 @@ wait_for_property_change (struct prop_location *location)
      property_change_reply, because property_change_reply_object says so.  */
   if (! location->arrived)
     {
-      secs = x_selection_timeout / 1000;
-      usecs = (x_selection_timeout % 1000) * 1000;
-      TRACE2 ("  Waiting %d secs, %d usecs", secs, usecs);
-      wait_reading_process_output (secs, usecs, 0, 0,
+      EMACS_INT timeout = max (0, x_selection_timeout);
+      EMACS_INT secs = timeout / 1000;
+      int nsecs = (timeout % 1000) * 1000000;
+      TRACE2 ("  Waiting %"pI"d secs, %d nsecs", secs, nsecs);
+      wait_reading_process_output (secs, nsecs, 0, 0,
                                   property_change_reply, NULL, 0);
 
       if (NILP (XCAR (property_change_reply)))
@@ -1229,7 +1223,8 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
   Atom type_atom = (CONSP (target_type)
                    ? symbol_to_x_atom (dpyinfo, XCAR (target_type))
                    : symbol_to_x_atom (dpyinfo, target_type));
-  int secs, usecs;
+  EMACS_INT timeout, secs;
+  int nsecs;
 
   if (!FRAME_LIVE_P (f))
     return Qnil;
@@ -1265,10 +1260,11 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
   UNBLOCK_INPUT;
 
   /* This allows quits.  Also, don't wait forever.  */
-  secs = x_selection_timeout / 1000;
-  usecs = (x_selection_timeout % 1000) * 1000;
-  TRACE1 ("  Start waiting %d secs for SelectionNotify", secs);
-  wait_reading_process_output (secs, usecs, 0, 0,
+  timeout = max (0, x_selection_timeout);
+  secs = timeout / 1000;
+  nsecs = (timeout % 1000) * 1000000;
+  TRACE1 ("  Start waiting %"pI"d secs for SelectionNotify", secs);
+  wait_reading_process_output (secs, nsecs, 0, 0,
                               reading_selection_reply, NULL, 0);
   TRACE1 ("  Got event = %d", !NILP (XCAR (reading_selection_reply)));
 
@@ -1358,7 +1354,7 @@ x_get_window_property (Display *display, Window window, Atom property,
        break;
 
       bytes_per_item = *actual_format_ret >> 3;
-      xassert (*actual_size_ret <= buffer_size / bytes_per_item);
+      eassert (*actual_size_ret <= buffer_size / bytes_per_item);
 
       /* The man page for XGetWindowProperty says:
          "If the returned format is 32, the returned data is represented
@@ -1445,7 +1441,7 @@ receive_incremental_selection (Display *display, Window window, Atom property,
   struct prop_location *wait_object;
   if (min (PTRDIFF_MAX, SIZE_MAX) < min_size_bytes)
     memory_full (SIZE_MAX);
-  *data_ret = (unsigned char *) xmalloc (min_size_bytes);
+  *data_ret = xmalloc (min_size_bytes);
   *size_bytes_ret = min_size_bytes;
 
   TRACE1 ("Read %u bytes incrementally", min_size_bytes);
@@ -1702,7 +1698,7 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data,
       v = Fmake_vector (make_number (size / 2), make_number (0));
       for (i = 0; i < size / 2; i++)
        {
-         EMACS_INT j = ((short *) data) [i];
+         short j = ((short *) data) [i];
          Faset (v, make_number (i), make_number (j));
        }
       return v;
@@ -1779,20 +1775,24 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
     }
   else if (SYMBOLP (obj))
     {
-      *data_ret = (unsigned char *) xmalloc (sizeof (Atom) + 1);
+      void *data = xmalloc (sizeof (Atom) + 1);
+      Atom *x_atom_ptr = data;
+      *data_ret = data;
       *format_ret = 32;
       *size_ret = 1;
       (*data_ret) [sizeof (Atom)] = 0;
-      (*(Atom **) data_ret) [0] = symbol_to_x_atom (dpyinfo, obj);
+      *x_atom_ptr = symbol_to_x_atom (dpyinfo, obj);
       if (NILP (type)) type = QATOM;
     }
   else if (RANGED_INTEGERP (X_SHRT_MIN, obj, X_SHRT_MAX))
     {
-      *data_ret = (unsigned char *) xmalloc (sizeof (short) + 1);
+      void *data = xmalloc (sizeof (short) + 1);
+      short *short_ptr = data;
+      *data_ret = data;
       *format_ret = 16;
       *size_ret = 1;
       (*data_ret) [sizeof (short)] = 0;
-      (*(short **) data_ret) [0] = XINT (obj);
+      *short_ptr = XINT (obj);
       if (NILP (type)) type = QINTEGER;
     }
   else if (INTEGERP (obj)
@@ -1801,11 +1801,13 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
                   || (CONSP (XCDR (obj))
                       && INTEGERP (XCAR (XCDR (obj)))))))
     {
-      *data_ret = (unsigned char *) xmalloc (sizeof (unsigned long) + 1);
+      void *data = xmalloc (sizeof (unsigned long) + 1);
+      unsigned long *x_long_ptr = data;
+      *data_ret = data;
       *format_ret = 32;
       *size_ret = 1;
       (*data_ret) [sizeof (unsigned long)] = 0;
-      (*(unsigned long **) data_ret) [0] = cons_to_x_long (obj);
+      *x_long_ptr = cons_to_x_long (obj);
       if (NILP (type)) type = QINTEGER;
     }
   else if (VECTORP (obj))
@@ -1817,30 +1819,35 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
       ptrdiff_t i;
       ptrdiff_t size = ASIZE (obj);
 
-      if (SYMBOLP (XVECTOR (obj)->contents [0]))
+      if (SYMBOLP (AREF (obj, 0)))
        /* This vector is an ATOM set */
        {
+         void *data;
+         Atom *x_atoms;
          if (NILP (type)) type = QATOM;
          for (i = 0; i < size; i++)
-           if (!SYMBOLP (XVECTOR (obj)->contents [i]))
+           if (!SYMBOLP (AREF (obj, i)))
              signal_error ("All elements of selection vector must have same type", obj);
 
-         *data_ret = xnmalloc (size, sizeof (Atom));
+         *data_ret = data = xnmalloc (size, sizeof *x_atoms);
+         x_atoms = data;
          *format_ret = 32;
          *size_ret = size;
          for (i = 0; i < size; i++)
-           (*(Atom **) data_ret) [i]
-             = symbol_to_x_atom (dpyinfo, XVECTOR (obj)->contents [i]);
+           x_atoms[i] = symbol_to_x_atom (dpyinfo, AREF (obj, i));
        }
       else
        /* This vector is an INTEGER set, or something like it */
        {
          int format = 16;
          int data_size = sizeof (short);
+         void *data;
+         unsigned long *x_atoms;
+         short *shorts;
          if (NILP (type)) type = QINTEGER;
          for (i = 0; i < size; i++)
            {
-             if (! RANGED_INTEGERP (X_SHRT_MIN, XVECTOR (obj)->contents[i],
+             if (! RANGED_INTEGERP (X_SHRT_MIN, AREF (obj, i),
                                     X_SHRT_MAX))
                {
                  /* Use sizeof (long) even if it is more than 32 bits.
@@ -1851,17 +1858,17 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
                  break;
                }
            }
-         *data_ret = xnmalloc (size, data_size);
+         *data_ret = data = xnmalloc (size, data_size);
+         x_atoms = data;
+         shorts = data;
          *format_ret = format;
          *size_ret = size;
          for (i = 0; i < size; i++)
            {
              if (format == 32)
-               (*((unsigned long **) data_ret)) [i] =
-                 cons_to_x_long (XVECTOR (obj)->contents[i]);
+               x_atoms[i] = cons_to_x_long (AREF (obj, i));
              else
-               (*((short **) data_ret)) [i] =
-                 XINT (XVECTOR (obj)->contents[i]);
+               shorts[i] = XINT (AREF (obj, i));
            }
        }
     }
@@ -1896,11 +1903,10 @@ clean_local_selection_data (Lisp_Object obj)
       ptrdiff_t size = ASIZE (obj);
       Lisp_Object copy;
       if (size == 1)
-       return clean_local_selection_data (XVECTOR (obj)->contents [0]);
+       return clean_local_selection_data (AREF (obj, 0));
       copy = Fmake_vector (make_number (size), Qnil);
       for (i = 0; i < size; i++)
-       XVECTOR (copy)->contents [i]
-         = clean_local_selection_data (XVECTOR (obj)->contents [i]);
+       ASET (copy, i, clean_local_selection_data (AREF (obj, i)));
       return copy;
     }
   return obj;
@@ -2623,13 +2629,12 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
   if (x_check_property_data (values) == -1)
     error ("Bad data in VALUES, must be number, cons or string");
 
-  event.xclient.type = ClientMessage;
-  event.xclient.format = XFASTINT (format);
-
-  if (event.xclient.format != 8 && event.xclient.format != 16
-      && event.xclient.format != 32)
+  if (XINT (format) != 8 && XINT (format) != 16 && XINT (format) != 32)
     error ("FORMAT must be one of 8, 16 or 32");
 
+  event.xclient.type = ClientMessage;
+  event.xclient.format = XINT (format);
+
   if (FRAMEP (dest) || NILP (dest))
     {
       struct frame *fdest = check_x_frame (dest);
index 066c6e795e91396a86acb7446a0da30097f11282..a28d75d9422b8759442fee46f08ff0ae3cf158b5 100644 (file)
@@ -159,8 +159,9 @@ store_tool_bar_style_changed (const char *newstyle,
                                 XCAR (dpyinfo->name_list_element));
 }
 
-
+#ifdef HAVE_XFT
 #define XSETTINGS_FONT_NAME       "Gtk/FontName"
+#endif
 #define XSETTINGS_TOOL_BAR_STYLE  "Gtk/ToolbarStyle"
 
 enum {
@@ -710,10 +711,12 @@ apply_xft_settings (struct x_display_info *dpyinfo,
       if (send_event_p)
         store_config_changed_event (Qfont_render,
                                     XCAR (dpyinfo->name_list_element));
-      sprintf (buf, format, oldsettings.aa, oldsettings.hinting,
-              oldsettings.rgba, oldsettings.lcdfilter,
-              oldsettings.hintstyle, oldsettings.dpi);
-      Vxft_settings = build_string (buf);
+      Vxft_settings 
+       = make_formatted_string (buf, format,
+                                oldsettings.aa, oldsettings.hinting,
+                                oldsettings.rgba, oldsettings.lcdfilter,
+                                oldsettings.hintstyle, oldsettings.dpi);
+      
     }
   else
     FcPatternDestroy (pat);
@@ -1024,7 +1027,7 @@ syms_of_xsettings (void)
   defsubr (&Sfont_get_system_normal_font);
 
   DEFVAR_BOOL ("font-use-system-font", use_system_font,
-    doc: /* *Non-nil means to apply the system defined font dynamically.
+    doc: /* Non-nil means to apply the system defined font dynamically.
 When this is non-nil and the system defined fixed width font changes, we
 update frames dynamically.
 If this variable is nil, Emacs ignores system font changes.  */);
@@ -1032,7 +1035,7 @@ If this variable is nil, Emacs ignores system font changes.  */);
 
   DEFVAR_LISP ("xft-settings", Vxft_settings,
                doc: /* Font settings applied to Xft.  */);
-  Vxft_settings = make_string ("", 0);
+  Vxft_settings = empty_unibyte_string;
 
 #ifdef HAVE_XFT
   Fprovide (intern_c_string ("font-render-setting"), Qnil);
index d6b0c0945df8c02127d799181b1752de94b65968..10dc7ef926a13ff5fe364918f09699e494532de9 100644 (file)
@@ -20,8 +20,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #ifndef XSETTINGS_H
 #define XSETTINGS_H
 
-EXFUN (Ftool_bar_get_system_style, 0);
-
 extern void xsettings_initialize (struct x_display_info *dpyinfo);
 extern void xft_settings_event (struct x_display_info *dpyinfo,
                                 XEvent *);
index 9ce166883c30eecae249a840793b5cc43f9ddaec..b5c5ce33d6c211fe01f72ccc01b85706ea09d987 100644 (file)
@@ -85,10 +85,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <X11/Shell.h>
 #endif
 
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
-
 #include <unistd.h>
 
 #ifdef USE_GTK
@@ -139,6 +135,8 @@ extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
 #endif
 #endif
 
+#include "bitmaps/gray.xbm"
+
 /* Default to using XIM if available.  */
 #ifdef USE_XIM
 int use_xim = 1;
@@ -256,11 +254,7 @@ static Time last_user_time;
 /* Incremented by XTread_socket whenever it really tries to read
    events.  */
 
-#ifdef __STDC__
 static int volatile input_signal_count;
-#else
-static int input_signal_count;
-#endif
 
 /* Used locally within XTread_socket.  */
 
@@ -322,7 +316,7 @@ static void XTframe_up_to_date (struct frame *);
 static void XTset_terminal_modes (struct terminal *);
 static void XTreset_terminal_modes (struct terminal *);
 static void x_clear_frame (struct frame *);
-static void x_ins_del_lines (struct frame *, int, int) NO_RETURN;
+static _Noreturn void x_ins_del_lines (struct frame *, int, int);
 static void frame_highlight (struct frame *);
 static void frame_unhighlight (struct frame *);
 static void x_new_focus_frame (struct x_display_info *, struct frame *);
@@ -355,7 +349,7 @@ static int handle_one_xevent (struct x_display_info *, XEvent *,
 #ifdef USE_GTK
 static int x_dispatch_event (XEvent *, Display *);
 #endif
-/* Don't declare this NO_RETURN because we want no
+/* Don't declare this _Noreturn because we want no
    interference with debugging failing X calls.  */
 static void x_connection_closed (Display *, const char *);
 static void x_wm_set_window_state (struct frame *, int);
@@ -721,7 +715,7 @@ x_after_update_window_line (struct glyph_row *desired_row)
   struct frame *f;
   int width, height;
 
-  xassert (w);
+  eassert (w);
 
   if (!desired_row->mode_line_p && !w->pseudo_window_p)
     desired_row->redraw_fringe_bitmaps_p = 1;
@@ -914,7 +908,7 @@ static void x_draw_glyph_string_foreground (struct glyph_string *);
 static void x_draw_composite_glyph_string_foreground (struct glyph_string *);
 static void x_draw_glyph_string_box (struct glyph_string *);
 static void x_draw_glyph_string  (struct glyph_string *);
-static void x_delete_glyphs (struct frame *, int) NO_RETURN;
+static _Noreturn void x_delete_glyphs (struct frame *, int);
 static void x_compute_glyph_string_overhangs (struct glyph_string *);
 static void x_set_cursor_gc (struct glyph_string *);
 static void x_set_mode_line_face_gc (struct glyph_string *);
@@ -937,7 +931,7 @@ static void x_draw_box_rect (struct glyph_string *, int, int, int, int,
                              int, int, int, XRectangle *);
 static void x_scroll_bar_clear (struct frame *);
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 static void x_check_font (struct frame *, struct font *);
 #endif
 
@@ -1039,7 +1033,7 @@ x_set_mouse_face_gc (struct glyph_string *s)
       s->gc = FRAME_X_DISPLAY_INFO (s->f)->scratch_cursor_gc;
 
     }
-  xassert (s->gc != 0);
+  eassert (s->gc != 0);
 }
 
 
@@ -1096,7 +1090,7 @@ x_set_glyph_string_gc (struct glyph_string *s)
     }
 
   /* GC must have been set.  */
-  xassert (s->gc != 0);
+  eassert (s->gc != 0);
 }
 
 
@@ -1697,8 +1691,8 @@ x_query_colors (struct frame *f, XColor *colors, int ncolors)
       for (i = 0; i < ncolors; ++i)
        {
          unsigned long pixel = colors[i].pixel;
-         xassert (pixel < dpyinfo->ncolor_cells);
-         xassert (dpyinfo->color_cells[pixel].pixel == pixel);
+         eassert (pixel < dpyinfo->ncolor_cells);
+         eassert (dpyinfo->color_cells[pixel].pixel == pixel);
          colors[i] = dpyinfo->color_cells[pixel];
        }
     }
@@ -1856,7 +1850,7 @@ x_alloc_lighter_color (struct frame *f, Display *display, Colormap cmap, long un
   x_query_color (f, &color);
 
   /* Change RGB values by specified FACTOR.  Avoid overflow!  */
-  xassert (factor >= 0);
+  eassert (factor >= 0);
   new.red = min (0xffff, factor * color.red);
   new.green = min (0xffff, factor * color.green);
   new.blue = min (0xffff, factor * color.blue);
@@ -2568,7 +2562,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
 static void
 x_draw_stretch_glyph_string (struct glyph_string *s)
 {
-  xassert (s->first_glyph->type == STRETCH_GLYPH);
+  eassert (s->first_glyph->type == STRETCH_GLYPH);
 
   if (s->hl == DRAW_CURSOR
       && !x_stretch_cursor_p)
@@ -2665,6 +2659,68 @@ x_draw_stretch_glyph_string (struct glyph_string *s)
   s->background_filled_p = 1;
 }
 
+/*
+   Draw a wavy line under S. The wave fills wave_height pixels from y0.
+
+                    x0         wave_length = 2
+                                 --
+                y0   *   *   *   *   *
+                     |* * * * * * * * *
+    wave_height = 3  | *   *   *   *
+
+*/
+
+static void
+x_draw_underwave (struct glyph_string *s)
+{
+  int wave_height = 2, wave_length = 3;
+  int dx, dy, x0, y0, width, x1, y1, x2, y2, odd, xmax;
+  XRectangle wave_clip, string_clip, final_clip;
+
+  dx = wave_length;
+  dy = wave_height - 1;
+  x0 = s->x;
+  y0 = s->ybase + 1;
+  width = s->width;
+  xmax = x0 + width;
+
+  /* Find and set clipping rectangle */
+
+  wave_clip = (XRectangle){ x0, y0, width, wave_height };
+  get_glyph_string_clip_rect (s, &string_clip);
+
+  if (!x_intersect_rectangles (&wave_clip, &string_clip, &final_clip))
+    return;
+
+  XSetClipRectangles (s->display, s->gc, 0, 0, &final_clip, 1, Unsorted);
+
+  /* Draw the waves */
+
+  x1 = x0 - (x0 % dx);
+  x2 = x1 + dx;
+  odd = (x1/dx) % 2;
+  y1 = y2 = y0;
+
+  if (odd)
+    y1 += dy;
+  else
+    y2 += dy;
+
+  if (INT_MAX - dx < xmax)
+    abort ();
+
+  while (x1 <= xmax)
+    {
+      XDrawLine (s->display, s->window, s->gc, x1, y1, x2, y2);
+      x1  = x2, y1 = y2;
+      x2 += dx, y2 = y0 + odd*dy;
+      odd = !odd;
+    }
+
+  /* Restore previous clipping rectangle(s) */
+  XSetClipRectangles (s->display, s->gc, 0, 0, s->clip, s->num_clips, Unsorted);
+}
+
 
 /* Draw glyph string S.  */
 
@@ -2767,68 +2823,83 @@ x_draw_glyph_string (struct glyph_string *s)
     {
       /* Draw underline.  */
       if (s->face->underline_p)
-       {
-         unsigned long thickness, position;
-         int y;
-
-         if (s->prev && s->prev->face->underline_p)
-           {
-             /* We use the same underline style as the previous one.  */
-             thickness = s->prev->underline_thickness;
-             position = s->prev->underline_position;
-           }
-         else
-           {
-             /* Get the underline thickness.  Default is 1 pixel.  */
-             if (s->font && s->font->underline_thickness > 0)
-               thickness = s->font->underline_thickness;
-             else
-               thickness = 1;
-             if (x_underline_at_descent_line)
-               position = (s->height - thickness) - (s->ybase - s->y);
-             else
-               {
-                 /* Get the underline position.  This is the recommended
-                    vertical offset in pixels from the baseline to the top of
-                    the underline.  This is a signed value according to the
-                    specs, and its default is
-
-                    ROUND ((maximum descent) / 2), with
-                    ROUND(x) = floor (x + 0.5)  */
-
-                 if (x_use_underline_position_properties
-                     && s->font && s->font->underline_position >= 0)
-                   position = s->font->underline_position;
-                 else if (s->font)
-                   position = (s->font->descent + 1) / 2;
-                 else
-                   position = underline_minimum_offset;
-               }
-             position = max (position, underline_minimum_offset);
-           }
-         /* Check the sanity of thickness and position.  We should
-            avoid drawing underline out of the current line area.  */
-         if (s->y + s->height <= s->ybase + position)
-           position = (s->height - 1) - (s->ybase - s->y);
-         if (s->y + s->height < s->ybase + position + thickness)
-           thickness = (s->y + s->height) - (s->ybase + position);
-         s->underline_thickness = thickness;
-         s->underline_position = position;
-         y = s->ybase + position;
-         if (s->face->underline_defaulted_p)
-           XFillRectangle (s->display, s->window, s->gc,
-                           s->x, y, s->width, thickness);
-         else
-           {
-             XGCValues xgcv;
-             XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
-             XSetForeground (s->display, s->gc, s->face->underline_color);
-             XFillRectangle (s->display, s->window, s->gc,
-                             s->x, y, s->width, thickness);
-             XSetForeground (s->display, s->gc, xgcv.foreground);
-           }
-       }
+        {
+          if (s->face->underline_type == FACE_UNDER_WAVE)
+            {
+              if (s->face->underline_defaulted_p)
+                x_draw_underwave (s);
+              else
+                {
+                  XGCValues xgcv;
+                  XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
+                  XSetForeground (s->display, s->gc, s->face->underline_color);
+                  x_draw_underwave (s);
+                  XSetForeground (s->display, s->gc, xgcv.foreground);
+                }
+            }
+          else if (s->face->underline_type == FACE_UNDER_LINE)
+            {
+              unsigned long thickness, position;
+              int y;
 
+              if (s->prev && s->prev->face->underline_p)
+                {
+                  /* We use the same underline style as the previous one.  */
+                  thickness = s->prev->underline_thickness;
+                  position = s->prev->underline_position;
+                }
+              else
+                {
+                  /* Get the underline thickness.  Default is 1 pixel.  */
+                  if (s->font && s->font->underline_thickness > 0)
+                    thickness = s->font->underline_thickness;
+                  else
+                    thickness = 1;
+                  if (x_underline_at_descent_line)
+                    position = (s->height - thickness) - (s->ybase - s->y);
+                  else
+                    {
+                      /* Get the underline position.  This is the recommended
+                         vertical offset in pixels from the baseline to the top of
+                         the underline.  This is a signed value according to the
+                         specs, and its default is
+
+                         ROUND ((maximum descent) / 2), with
+                         ROUND(x) = floor (x + 0.5)  */
+
+                      if (x_use_underline_position_properties
+                          && s->font && s->font->underline_position >= 0)
+                        position = s->font->underline_position;
+                      else if (s->font)
+                        position = (s->font->descent + 1) / 2;
+                      else
+                        position = underline_minimum_offset;
+                    }
+                  position = max (position, underline_minimum_offset);
+                }
+              /* Check the sanity of thickness and position.  We should
+                 avoid drawing underline out of the current line area.  */
+              if (s->y + s->height <= s->ybase + position)
+                position = (s->height - 1) - (s->ybase - s->y);
+              if (s->y + s->height < s->ybase + position + thickness)
+                thickness = (s->y + s->height) - (s->ybase + position);
+              s->underline_thickness = thickness;
+              s->underline_position = position;
+              y = s->ybase + position;
+              if (s->face->underline_defaulted_p)
+                XFillRectangle (s->display, s->window, s->gc,
+                                s->x, y, s->width, thickness);
+              else
+                {
+                  XGCValues xgcv;
+                  XGetGCValues (s->display, s->gc, GCForeground, &xgcv);
+                  XSetForeground (s->display, s->gc, s->face->underline_color);
+                  XFillRectangle (s->display, s->window, s->gc,
+                                  s->x, y, s->width, thickness);
+                  XSetForeground (s->display, s->gc, xgcv.foreground);
+                }
+            }
+        }
       /* Draw overline.  */
       if (s->face->overline_p)
        {
@@ -2955,7 +3026,7 @@ x_delete_glyphs (struct frame *f, register int n)
 void
 x_clear_area (Display *dpy, Window window, int x, int y, int width, int height, int exposures)
 {
-  xassert (width > 0 && height > 0);
+  eassert (width > 0 && height > 0);
   XClearArea (dpy, window, x, y, width, height, exposures);
 }
 
@@ -2997,44 +3068,6 @@ x_clear_frame (struct frame *f)
 \f
 /* Invert the middle quarter of the frame for .15 sec.  */
 
-/* We use the select system call to do the waiting, so we have to make
-   sure it's available.  If it isn't, we just won't do visual bells.  */
-
-#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
-
-
-/* Subtract the `struct timeval' values X and Y, storing the result in
-   *RESULT.  Return 1 if the difference is negative, otherwise 0.  */
-
-static int
-timeval_subtract (struct timeval *result, struct timeval x, struct timeval y)
-{
-  /* Perform the carry for the later subtraction by updating y.  This
-     is safer because on some systems the tv_sec member is unsigned.  */
-  if (x.tv_usec < y.tv_usec)
-    {
-      int nsec = (y.tv_usec - x.tv_usec) / 1000000 + 1;
-      y.tv_usec -= 1000000 * nsec;
-      y.tv_sec += nsec;
-    }
-
-  if (x.tv_usec - y.tv_usec > 1000000)
-    {
-      int nsec = (y.tv_usec - x.tv_usec) / 1000000;
-      y.tv_usec += 1000000 * nsec;
-      y.tv_sec -= nsec;
-    }
-
-  /* Compute the time remaining to wait.  tv_usec is certainly
-     positive.  */
-  result->tv_sec = x.tv_sec - y.tv_sec;
-  result->tv_usec = x.tv_usec - y.tv_usec;
-
-  /* Return indication of whether the result should be considered
-     negative.  */
-  return x.tv_sec < y.tv_sec;
-}
-
 static void
 XTflash (struct frame *f)
 {
@@ -3135,34 +3168,25 @@ XTflash (struct frame *f)
       x_flush (f);
 
       {
-       struct timeval wakeup;
-
-       EMACS_GET_TIME (wakeup);
-
-       /* Compute time to wait until, propagating carry from usecs.  */
-       wakeup.tv_usec += 150000;
-       wakeup.tv_sec += (wakeup.tv_usec / 1000000);
-       wakeup.tv_usec %= 1000000;
+       EMACS_TIME delay = make_emacs_time (0, 150 * 1000 * 1000);
+       EMACS_TIME wakeup = add_emacs_time (current_emacs_time (), delay);
 
        /* Keep waiting until past the time wakeup or any input gets
           available.  */
        while (! detect_input_pending ())
          {
-           struct timeval current;
-           struct timeval timeout;
+           EMACS_TIME current = current_emacs_time ();
+           EMACS_TIME timeout;
 
-           EMACS_GET_TIME (current);
-
-           /* Break if result would be negative.  */
-           if (timeval_subtract (&current, wakeup, current))
+           /* Break if result would not be positive.  */
+           if (EMACS_TIME_LE (wakeup, current))
              break;
 
            /* How long `select' should wait.  */
-           timeout.tv_sec = 0;
-           timeout.tv_usec = 10000;
+           timeout = make_emacs_time (0, 10 * 1000 * 1000);
 
            /* Try to wait that long--but we might wake up sooner.  */
-           select (0, NULL, NULL, NULL, &timeout);
+           pselect (0, NULL, NULL, NULL, &timeout, NULL);
          }
       }
 
@@ -3203,8 +3227,6 @@ XTflash (struct frame *f)
   UNBLOCK_INPUT;
 }
 
-#endif /* defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) */
-
 
 static void
 XTtoggle_invisible_pointer (FRAME_PTR f, int invisible)
@@ -3231,11 +3253,9 @@ XTring_bell (struct frame *f)
 {
   if (FRAME_X_DISPLAY (f))
     {
-#if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT)
       if (visible_bell)
        XTflash (f);
       else
-#endif
        {
          BLOCK_INPUT;
          XBell (FRAME_X_DISPLAY (f), 0);
@@ -3700,24 +3720,23 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
 /* Convert between the modifier bits X uses and the modifier bits
    Emacs uses.  */
 
-EMACS_INT
+int
 x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state)
 {
-  EMACS_INT mod_meta = meta_modifier;
-  EMACS_INT mod_alt  = alt_modifier;
-  EMACS_INT mod_hyper = hyper_modifier;
-  EMACS_INT mod_super = super_modifier;
+  int mod_meta = meta_modifier;
+  int mod_alt  = alt_modifier;
+  int mod_hyper = hyper_modifier;
+  int mod_super = super_modifier;
   Lisp_Object tem;
 
   tem = Fget (Vx_alt_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_alt = XINT (tem);
+  if (INTEGERP (tem)) mod_alt = XINT (tem) & INT_MAX;
   tem = Fget (Vx_meta_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_meta = XINT (tem);
+  if (INTEGERP (tem)) mod_meta = XINT (tem) & INT_MAX;
   tem = Fget (Vx_hyper_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_hyper = XINT (tem);
+  if (INTEGERP (tem)) mod_hyper = XINT (tem) & INT_MAX;
   tem = Fget (Vx_super_keysym, Qmodifier_value);
-  if (INTEGERP (tem)) mod_super = XINT (tem);
-
+  if (INTEGERP (tem)) mod_super = XINT (tem) & INT_MAX;
 
   return (  ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0)
             | ((state & ControlMask)                   ? ctrl_modifier : 0)
@@ -3730,10 +3749,10 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state)
 static int
 x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state)
 {
-  int mod_meta = meta_modifier;
-  int mod_alt  = alt_modifier;
-  int mod_hyper = hyper_modifier;
-  int mod_super = super_modifier;
+  EMACS_INT mod_meta = meta_modifier;
+  EMACS_INT mod_alt  = alt_modifier;
+  EMACS_INT mod_hyper = hyper_modifier;
+  EMACS_INT mod_super = super_modifier;
 
   Lisp_Object tem;
 
@@ -4532,7 +4551,7 @@ xaw_jump_callback (Widget widget, XtPointer client_data, XtPointer call_data)
   whole = 10000000;
   portion = shown < 1 ? top * whole : 0;
 
-  if (shown < 1 && (eabs (top + shown - 1) < 1.0/height))
+  if (shown < 1 && (eabs (top + shown - 1) < 1.0f / height))
     /* Some derivatives of Xaw refuse to shrink the thumb when you reach
        the bottom, so we force the scrolling whenever we see that we're
        too close to the bottom (in x_set_toolkit_scroll_bar_thumb
@@ -4897,7 +4916,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
     else
       top = old_top;
     /* Keep two pixels available for moving the thumb down.  */
-    shown = max (0, min (1 - top - (2.0 / height), shown));
+    shown = max (0, min (1 - top - (2.0f / height), shown));
 
     /* If the call to XawScrollbarSetThumb below doesn't seem to work,
        check that your system's configuration file contains a define
@@ -5754,9 +5773,9 @@ static struct x_display_info *next_noop_dpyinfo;
      do                                                                        \
        {                                                               \
         if (f->output_data.x->saved_menu_event == 0)                   \
-           f->output_data.x->saved_menu_event                          \
-            = (XEvent *) xmalloc (sizeof (XEvent));                    \
-         *f->output_data.x->saved_menu_event = event;                   \
+           f->output_data.x->saved_menu_event =                                \
+            xmalloc (sizeof (XEvent));                                 \
+         *f->output_data.x->saved_menu_event = event;                  \
         inev.ie.kind = MENU_BAR_ACTIVATE_EVENT;                        \
         XSETFRAME (inev.ie.frame_or_window, f);                        \
        }                                                               \
@@ -6427,7 +6446,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
               if (status_return == XBufferOverflow)
                 {
                   copy_bufsiz = nbytes + 1;
-                  copy_bufptr = (unsigned char *) alloca (copy_bufsiz);
+                  copy_bufptr = alloca (copy_bufsiz);
                   nbytes = XmbLookupString (FRAME_XIC (f),
                                             &event.xkey, (char *) copy_bufptr,
                                             copy_bufsiz, &keysym,
@@ -6492,9 +6511,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
 
          /* Now non-ASCII.  */
          if (HASH_TABLE_P (Vx_keysym_table)
-             && (NATNUMP (c = Fgethash (make_number (keysym),
-                                        Vx_keysym_table,
-                                        Qnil))))
+             && (c = Fgethash (make_number (keysym),
+                               Vx_keysym_table,
+                               Qnil),
+                 NATNUMP (c)))
            {
              inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c))
                               ? ASCII_KEYSTROKE_EVENT
@@ -7646,7 +7666,7 @@ x_error_catcher (Display *display, XErrorEvent *event)
 void
 x_catch_errors (Display *dpy)
 {
-  struct x_error_message_stack *data = xmalloc (sizeof (*data));
+  struct x_error_message_stack *data = xmalloc (sizeof *data);
 
   /* Make sure any errors from previous requests have been dealt with.  */
   XSync (dpy, False);
@@ -7772,9 +7792,9 @@ x_connection_closed (Display *dpy, const char *error_message)
 {
   struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
   Lisp_Object frame, tail;
-  int idx = SPECPDL_INDEX ();
+  ptrdiff_t idx = SPECPDL_INDEX ();
 
-  error_msg = (char *) alloca (strlen (error_message) + 1);
+  error_msg = alloca (strlen (error_message) + 1);
   strcpy (error_msg, error_message);
   handling_signal = 0;
 
@@ -8163,14 +8183,13 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
   if (use_xim)
     {
 #ifdef HAVE_X11R6_XIM
-      struct xim_inst_t *xim_inst;
+      struct xim_inst_t *xim_inst = xmalloc (sizeof *xim_inst);
       ptrdiff_t len;
 
-      xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t));
       dpyinfo->xim_callback_data = xim_inst;
       xim_inst->dpyinfo = dpyinfo;
       len = strlen (resource_name);
-      xim_inst->resource_name = (char *) xmalloc (len + 1);
+      xim_inst->resource_name = xmalloc (len + 1);
       memcpy (xim_inst->resource_name, resource_name, len + 1);
       XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
                                      resource_name, emacs_class,
@@ -8787,9 +8806,8 @@ x_wait_for_event (struct frame *f, int eventtype)
 
   /* Set timeout to 0.1 second.  Hopefully not noticeable.
      Maybe it should be configurable.  */
-  EMACS_SET_SECS_USECS (tmo, 0, 100000);
-  EMACS_GET_TIME (tmo_at);
-  EMACS_ADD_TIME (tmo_at, tmo_at, tmo);
+  tmo = make_emacs_time (0, 100 * 1000 * 1000);
+  tmo_at = add_emacs_time (current_emacs_time (), tmo);
 
   while (pending_event_wait.eventtype)
     {
@@ -8802,10 +8820,12 @@ x_wait_for_event (struct frame *f, int eventtype)
       FD_ZERO (&fds);
       FD_SET (fd, &fds);
 
-      EMACS_GET_TIME (time_now);
-      EMACS_SUB_TIME (tmo, tmo_at, time_now);
+      time_now = current_emacs_time ();
+      if (EMACS_TIME_LT (tmo_at, time_now))
+       break;
 
-      if (EMACS_TIME_NEG_P (tmo) || select (fd+1, &fds, NULL, NULL, &tmo) == 0)
+      tmo = sub_emacs_time (tmo_at, time_now);
+      if (pselect (fd + 1, &fds, NULL, NULL, &tmo, NULL) == 0)
         break; /* Timeout */
     }
   pending_event_wait.f = 0;
@@ -9775,7 +9795,7 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
                                Fonts
  ***********************************************************************/
 
-#if GLYPH_DEBUG
+#ifdef GLYPH_DEBUG
 
 /* Check that FONT is valid on frame F.  It is if it can be found in F's
    font table.  */
@@ -9783,12 +9803,12 @@ x_wm_set_icon_position (struct frame *f, int icon_x, int icon_y)
 static void
 x_check_font (struct frame *f, struct font *font)
 {
-  xassert (font != NULL && ! NILP (font->props[FONT_TYPE_INDEX]));
+  eassert (font != NULL && ! NILP (font->props[FONT_TYPE_INDEX]));
   if (font->driver->check)
-    xassert (font->driver->check (f, font) == 0);
+    eassert (font->driver->check (f, font) == 0);
 }
 
-#endif /* GLYPH_DEBUG != 0 */
+#endif /* GLYPH_DEBUG */
 
 \f
 /***********************************************************************
@@ -10010,7 +10030,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
           const char *file = "~/.emacs.d/gtkrc";
           Lisp_Object s, abs_file;
 
-          s = make_string (file, strlen (file));
+          s = build_string (file);
           abs_file = Fexpand_file_name (s, Qnil);
 
           if (! NILP (abs_file) && !NILP (Ffile_readable_p (abs_file)))
@@ -10072,8 +10092,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 
   /* We have definitely succeeded.  Record the new connection.  */
 
-  dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
-  memset (dpyinfo, 0, sizeof *dpyinfo);
+  dpyinfo = xzalloc (sizeof *dpyinfo);
   hlinfo = &dpyinfo->mouse_highlight;
 
   terminal = x_create_terminal (dpyinfo);
@@ -10091,7 +10110,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
       terminal->kboard = share->terminal->kboard;
     else
       {
-       terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
+       terminal->kboard = xmalloc (sizeof *terminal->kboard);
        init_kboard (terminal->kboard);
        KVAR (terminal->kboard, Vwindow_system) = Qx;
 
@@ -10145,8 +10164,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
   dpyinfo->display = dpy;
 
   /* Set the name of the terminal. */
-  terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
-  strncpy (terminal->name, SSDATA (display_name), SBYTES (display_name));
+  terminal->name = xmalloc (SBYTES (display_name) + 1);
+  memcpy (terminal->name, SSDATA (display_name), SBYTES (display_name));
   terminal->name[SBYTES (display_name)] = 0;
 
 #if 0
@@ -10156,10 +10175,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
   lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@";
   if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name))
     memory_full (SIZE_MAX);
-  dpyinfo->x_id_name
-    = (char *) xmalloc (SBYTES (Vinvocation_name)
-                       + SBYTES (Vsystem_name)
-                       + 2);
+  dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name)
+                               + SBYTES (Vsystem_name) + 2);
   strcat (strcat (strcpy (dpyinfo->x_id_name, SSDATA (Vinvocation_name)), "@"),
          SSDATA (Vsystem_name));
 
@@ -10347,16 +10364,18 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
     const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]);
     /* 1 for _XSETTINGS_SN  */
     const int total_atom_count = 1 + atom_count;
-    Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count);
-    char **atom_names = xmalloc (sizeof (char *) * total_atom_count);
-    char xsettings_atom_name[64];
+    Atom *atoms_return = xmalloc (total_atom_count * sizeof *atoms_return);
+    char **atom_names = xmalloc (total_atom_count * sizeof *atom_names);
+    static char const xsettings_fmt[] = "_XSETTINGS_S%d";
+    char xsettings_atom_name[sizeof xsettings_fmt - 2
+                            + INT_STRLEN_BOUND (int)];
 
     for (i = 0; i < atom_count; i++)
       atom_names[i] = (char *) atom_refs[i].name;
 
     /* Build _XSETTINGS_SN atom name */
-    snprintf (xsettings_atom_name, sizeof (xsettings_atom_name),
-              "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
+    sprintf (xsettings_atom_name, xsettings_fmt,
+            XScreenNumberOfScreen (dpyinfo->screen));
     atom_names[i] = xsettings_atom_name;
 
     XInternAtoms (dpyinfo->display, atom_names, total_atom_count,
@@ -10374,7 +10393,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
 
   dpyinfo->x_dnd_atoms_size = 8;
   dpyinfo->x_dnd_atoms_length = 0;
-  dpyinfo->x_dnd_atoms = xmalloc (sizeof (*dpyinfo->x_dnd_atoms)
+  dpyinfo->x_dnd_atoms = xmalloc (sizeof *dpyinfo->x_dnd_atoms
                                   * dpyinfo->x_dnd_atoms_size);
 
   dpyinfo->net_supported_atoms = NULL;
@@ -10387,8 +10406,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
   {
     dpyinfo->gray
       = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
-                                    gray_bitmap_bits,
-                                    gray_bitmap_width, gray_bitmap_height,
+                                    gray_bits, gray_width, gray_height,
                                     1, 0, 1);
   }
 
@@ -10579,9 +10597,7 @@ x_activate_timeout_atimer (void)
   BLOCK_INPUT;
   if (!x_timeout_atimer_activated_flag)
     {
-      EMACS_TIME interval;
-
-      EMACS_SET_SECS_USECS (interval, 0, 100000);
+      EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000);
       start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0);
       x_timeout_atimer_activated_flag = 1;
     }
@@ -10822,7 +10838,7 @@ syms_of_xterm (void)
   last_mouse_press_frame = Qnil;
 
 #ifdef USE_GTK
-  xg_default_icon_file = make_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
+  xg_default_icon_file = build_pure_c_string ("icons/hicolor/scalable/apps/emacs.svg");
   staticpro (&xg_default_icon_file);
 
   DEFSYM (Qx_gtk_map_stock, "x-gtk-map-stock");
@@ -10830,7 +10846,7 @@ syms_of_xterm (void)
 
   DEFVAR_BOOL ("x-use-underline-position-properties",
               x_use_underline_position_properties,
-     doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
+     doc: /* Non-nil means make use of UNDERLINE_POSITION font properties.
 A value of nil means ignore them.  If you encounter fonts with bogus
 UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
 to 4.1, set this to nil.  You can also use `underline-minimum-offset'
@@ -10840,7 +10856,7 @@ sizes.  */);
 
   DEFVAR_BOOL ("x-underline-at-descent-line",
               x_underline_at_descent_line,
-     doc: /* *Non-nil means to draw the underline at the same place as the descent line.
+     doc: /* Non-nil means to draw the underline at the same place as the descent line.
 A value of nil means to draw the underline according to the value of the
 variable `x-use-underline-position-properties', which is usually at the
 baseline level.  The default value is nil.  */);
index 86daa7bd27e61a7864614e5c6e0117f85cb4bb3a..86a76fd81a91a6c2b009efb312de34a4a9814251 100644 (file)
@@ -736,9 +736,6 @@ enum
 /* This is the Colormap which frame F uses.  */
 #define FRAME_X_COLORMAP(f) FRAME_X_DISPLAY_INFO (f)->cmap
 
-/* This is the 'font_info *' which frame F has.  */
-#define FRAME_X_FONT_TABLE(f) (FRAME_X_DISPLAY_INFO (f)->font_table)
-
 /* The difference in pixels between the top left corner of the
    Emacs window (including possible window manager decorations)
    and FRAME_X_WINDOW (f).  */
@@ -779,8 +776,7 @@ enum
 struct scroll_bar
 {
   /* These fields are shared by all vectors.  */
-  EMACS_INT size_from_Lisp_Vector_struct;
-  struct Lisp_Vector *next_from_Lisp_Vector_struct;
+  struct vectorlike_header header;
 
   /* The window we're a scroll bar for.  */
   Lisp_Object window;
@@ -821,12 +817,6 @@ struct scroll_bar
   unsigned int fringe_extended_p : 1;
 };
 
-/* The number of elements a vector holding a struct scroll_bar needs.  */
-#define SCROLL_BAR_VEC_SIZE                                    \
-  ((sizeof (struct scroll_bar)                                 \
-    - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *))      \
-   / sizeof (Lisp_Object))
-
 /* Turning a lisp vector value into a pointer to a struct scroll_bar.  */
 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
 
@@ -944,10 +934,7 @@ void x_handle_property_notify (XPropertyEvent *);
 /* From xfns.c.  */
 
 struct frame *check_x_frame (Lisp_Object);
-EXFUN (Fx_display_grayscale_p, 1);
 extern void x_free_gcs (struct frame *);
-extern int gray_bitmap_width, gray_bitmap_height;
-extern char *gray_bitmap_bits;
 
 /* From xrdb.c.  */
 
@@ -996,7 +983,7 @@ extern void x_mouse_leave (struct x_display_info *);
 #ifdef USE_X_TOOLKIT
 extern int x_dispatch_event (XEvent *, Display *);
 #endif
-extern EMACS_INT x_x_to_emacs_modifiers (struct x_display_info *, int);
+extern int x_x_to_emacs_modifiers (struct x_display_info *, int);
 extern int x_display_pixel_height (struct x_display_info *);
 extern int x_display_pixel_width (struct x_display_info *);
 
@@ -1038,6 +1025,7 @@ extern void x_clipboard_manager_save_all (void);
 
 extern struct x_display_info * check_x_display_info (Lisp_Object);
 extern Lisp_Object x_get_focus_frame (struct frame *);
+extern int x_in_use;
 
 #ifdef USE_GTK
 extern int xg_set_icon (struct frame *, Lisp_Object);
index b90c26af98a157b2a93ab7b25309cd8c42053658..f82a395e548a3f9b66e1efbf7b08e562f30cefb4 100644 (file)
@@ -1,6 +1,73 @@
-2012-06-01  Chong Yidong  <cyd@gnu.org>
+2012-07-17  Stefan Monnier  <monnier@iro.umontreal.ca>
 
-       * Version 24.1 released.
+       * indent/shell.sh: Add test case for ${#VAR}.
+
+       * indent/latex-mode.tex: New file.
+
+2012-07-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * eshell.el: Use cl-lib.
+
+2012-07-03  Chong Yidong  <cyd@gnu.org>
+
+       * automated/xml-parse-tests.el (xml-parse-tests--bad-data): New.
+
+2012-07-02  Chong Yidong  <cyd@gnu.org>
+
+       * automated/xml-parse-tests.el (xml-parse-tests--data):
+       More testcases.
+
+2012-07-01  Chong Yidong  <cyd@gnu.org>
+
+       * automated/xml-parse-tests.el: New file.
+
+2012-06-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * automated/ert-x-tests.el (ert-test-run-tests-interactively-2):
+       Use cl-flet.
+
+2012-06-08  Ulf Jasper  <ulf.jasper@web.de>
+
+       * automated/icalendar-tests.el (icalendar--parse-vtimezone):
+       Test escaped commas in TZID (Bug#11473).
+       (icalendar-import-with-timezone): New.
+       (icalendar-real-world): Add new testcase as given in the bugreport
+       of Bug#11473.
+
+2012-05-29  Ulf Jasper  <ulf.jasper@web.de>
+
+       * automated/icalendar-tests.el (icalendar-tests--test-import):
+       Include UID in import tests (Bug#11525).
+       (icalendar-import-non-recurring, icalendar-import-rrule)
+       (icalendar-import-duration, icalendar-import-bug-6766): Adjust to
+       UID-import change.
+       (icalendar-import-with-uid): New.
+       (icalendar-tests--test-cycle, icalendar-tests--do-test-cycle):
+       Include UID in cycle tests.
+       (icalendar-cycle, icalendar-real-world): UID-import change.
+
+2012-05-21  Glenn Morris  <rgm@gnu.org>
+
+       * automated/Makefile.in (setwins): Scrap superfluous subshell.
+
+2012-05-15  Teodor Zlatanov  <tzz@lifelogs.com>
+
+       * automated/url-util-tests.el: New file to test
+       lisp/url/url-util.el.  Only `url-build-query-string' and
+       `url-parse-query-string' are tested right now (Bug#8706).
+
+2012-04-28  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * indent/shell.sh:
+       * indent/shell.rc: Ad some test cases.
+
+2012-04-24  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * indent/ruby.rb: New file, to test new syntax-propertize code.
+
+2012-04-11  Glenn Morris  <rgm@gnu.org>
+
+       * automated/vc-bzr.el (vc-bzr-test-faulty-bzr-autoloads): New test.
 
 2012-02-13  Teodor Zlatanov  <tzz@lifelogs.com>
 
 2009-12-18  Ulf Jasper  <ulf.jasper@web.de>
 
        * icalendar-testsuite.el
-       (icalendar-testsuite--run-function-tests): Add
-       icalendar-testsuite--test-parse-vtimezone.
+       (icalendar-testsuite--run-function-tests):
+       Add icalendar-testsuite--test-parse-vtimezone.
        (icalendar-testsuite--test-parse-vtimezone): New.
        (icalendar-testsuite--do-test-cycle): Doc changes.
        (icalendar-testsuite--run-real-world-tests): Remove trailing
 2008-10-31  Ulf Jasper  <ulf.jasper@web.de>
 
        * icalendar-testsuite.el (icalendar-testsuite--run-function-tests):
-       Added `icalendar-testsuite--test-create-uid'.
+       Add `icalendar-testsuite--test-create-uid'.
        (icalendar-testsuite--test-create-uid): New.
 
 2008-06-14  Ulf Jasper  <ulf.jasper@web.de>
index c07d5a1897d51d1f98d361dbc8330982f78b189f..4f2e8a59e49a00e0e5a3ca4b9c991cbc815b97d8 100644 (file)
@@ -48,7 +48,7 @@ BYTE_COMPILE_EXTRA_FLAGS =
 emacs = EMACSLOADPATH=$(lispsrc):$(test) LC_ALL=C $(EMACS) $(EMACSOPT)
 
 # Common command to find subdirectories
-setwins=subdirs=`(find . -type d -print)`; \
+setwins=subdirs=`find . -type d -print`; \
        for file in $$subdirs; do \
           case $$file in */.* | */.*/* | */=* ) ;; \
                *) wins="$$wins $$file" ;; \
index ad36c4296b462df860efba023fc88759dfef3b76..ecd0e8856f7be0ed5511f5a45ddf409481b6bdb7 100644 (file)
     ;; maven
     ("FooBar.java:[111,53] no interface expected here"
      1 53 111 "FooBar.java")
+    ("  [ERROR] /Users/cinsk/hello.java:[651,96] ';' expected"
+     15 96 651 "/Users/cinsk/hello.java") ;Bug#11517.
     ;; mips-1 mips-2
     ("TrimMask (255) in solomon.c may be indistinguishable from TrimMasks (93) in solomo.c due to truncation"
      11 nil 255 "solomon.c")
index bb05608e41899bcafd7b7cbcc037f7456bdb6beb..520502bb307240358d270e6a5a1896d3952959fc 100644 (file)
 
 (ert-deftest ert-test-run-tests-interactively-2 ()
   :tags '(:causes-redisplay)
-  (let ((passing-test (make-ert-test :name 'passing-test
-                                     :body (lambda () (ert-pass))))
-        (failing-test (make-ert-test :name 'failing-test
-                                     :body (lambda ()
-                                             (ert-info ((propertize "foo\nbar"
-                                                                    'a 'b))
-                                             (ert-fail
-                                              "failure message"))))))
-    (let ((ert-debug-on-error nil))
-      (let* ((buffer-name (generate-new-buffer-name "*ert-test-run-tests*"))
-             (messages nil)
-             (mock-message-fn
-              (lambda (format-string &rest args)
-                (push (apply #'format format-string args) messages))))
-        (flet ((expected-string (with-font-lock-p)
-                 (ert-propertized-string
-                  "Selector: (member <passing-test> <failing-test>)\n"
-                  "Passed: 1\n"
-                  "Failed: 1 (1 unexpected)\n"
-                  "Total:  2/2\n\n"
-                  "Started at:\n"
-                  "Finished.\n"
-                  "Finished at:\n\n"
-                  `(category ,(button-category-symbol
-                               'ert--results-progress-bar-button)
-                             button (t)
-                             face ,(if with-font-lock-p
-                                       'ert-test-result-unexpected
-                                     'button))
-                  ".F" nil "\n\n"
-                  `(category ,(button-category-symbol
-                               'ert--results-expand-collapse-button)
-                             button (t)
-                             face ,(if with-font-lock-p
-                                       'ert-test-result-unexpected
-                                     'button))
-                  "F" nil " "
-                  `(category ,(button-category-symbol
-                               'ert--test-name-button)
-                             button (t)
-                             ert-test-name failing-test)
-                  "failing-test"
-                  nil "\n    Info: " '(a b) "foo\n"
-                  nil "          " '(a b) "bar"
-                  nil "\n    (ert-test-failed \"failure message\")\n\n\n"
-                  )))
-        (save-window-excursion
-          (unwind-protect
-              (let ((case-fold-search nil))
-                (ert-run-tests-interactively
-                 `(member ,passing-test ,failing-test) buffer-name
-                 mock-message-fn)
-                (should (equal messages `(,(concat
-                                            "Ran 2 tests, 1 results were "
-                                            "as expected, 1 unexpected"))))
-                (with-current-buffer buffer-name
-                  (font-lock-mode 0)
-                  (should (ert-equal-including-properties
-                           (ert-filter-string (buffer-string)
-                                              '("Started at:\\(.*\\)$" 1)
-                                              '("Finished at:\\(.*\\)$" 1))
-                           (expected-string nil)))
-                  ;; `font-lock-mode' only works if interactive, so
-                  ;; pretend we are.
-                  (let ((noninteractive nil))
-                    (font-lock-mode 1))
-                  (should (ert-equal-including-properties
-                           (ert-filter-string (buffer-string)
-                                              '("Started at:\\(.*\\)$" 1)
-                                              '("Finished at:\\(.*\\)$" 1))
-                           (expected-string t)))))
-            (when (get-buffer buffer-name)
-              (kill-buffer buffer-name)))))))))
+  (let* ((passing-test (make-ert-test :name 'passing-test
+                                      :body (lambda () (ert-pass))))
+         (failing-test (make-ert-test :name 'failing-test
+                                      :body (lambda ()
+                                              (ert-info ((propertize "foo\nbar"
+                                                                     'a 'b))
+                                                (ert-fail
+                                                 "failure message")))))
+         (ert-debug-on-error nil)
+         (buffer-name (generate-new-buffer-name "*ert-test-run-tests*"))
+         (messages nil)
+         (mock-message-fn
+          (lambda (format-string &rest args)
+            (push (apply #'format format-string args) messages))))
+    (cl-flet ((expected-string (with-font-lock-p)
+                (ert-propertized-string
+                 "Selector: (member <passing-test> <failing-test>)\n"
+                 "Passed: 1\n"
+                 "Failed: 1 (1 unexpected)\n"
+                 "Total:  2/2\n\n"
+                 "Started at:\n"
+                 "Finished.\n"
+                 "Finished at:\n\n"
+                 `(category ,(button-category-symbol
+                              'ert--results-progress-bar-button)
+                            button (t)
+                            face ,(if with-font-lock-p
+                                      'ert-test-result-unexpected
+                                    'button))
+                 ".F" nil "\n\n"
+                 `(category ,(button-category-symbol
+                              'ert--results-expand-collapse-button)
+                            button (t)
+                            face ,(if with-font-lock-p
+                                      'ert-test-result-unexpected
+                                    'button))
+                 "F" nil " "
+                 `(category ,(button-category-symbol
+                              'ert--test-name-button)
+                            button (t)
+                            ert-test-name failing-test)
+                 "failing-test"
+                 nil "\n    Info: " '(a b) "foo\n"
+                 nil "          " '(a b) "bar"
+                 nil "\n    (ert-test-failed \"failure message\")\n\n\n"
+                 )))
+      (save-window-excursion
+        (unwind-protect
+            (let ((case-fold-search nil))
+              (ert-run-tests-interactively
+               `(member ,passing-test ,failing-test) buffer-name
+               mock-message-fn)
+              (should (equal messages `(,(concat
+                                          "Ran 2 tests, 1 results were "
+                                          "as expected, 1 unexpected"))))
+              (with-current-buffer buffer-name
+                (font-lock-mode 0)
+                (should (ert-equal-including-properties
+                         (ert-filter-string (buffer-string)
+                                            '("Started at:\\(.*\\)$" 1)
+                                            '("Finished at:\\(.*\\)$" 1))
+                         (expected-string nil)))
+                ;; `font-lock-mode' only works if interactive, so
+                ;; pretend we are.
+                (let ((noninteractive nil))
+                  (font-lock-mode 1))
+                (should (ert-equal-including-properties
+                         (ert-filter-string (buffer-string)
+                                            '("Started at:\\(.*\\)$" 1)
+                                            '("Finished at:\\(.*\\)$" 1))
+                         (expected-string t)))))
+          (when (get-buffer buffer-name)
+            (kill-buffer buffer-name)))))))
 
 (ert-deftest ert-test-describe-test ()
   "Tests `ert-describe-test'."
index 503ea22d2b82bccf2c7c2daf323ceae7a9b623c0..58b8379bb11073518fc1b545615d8f81341dba7e 100644 (file)
@@ -188,7 +188,7 @@ END:VTIMEZONE
     (should (string= "STD-02:00DST-03:00,M3.5.0/03:00:00,M10.5.0/04:00:00"
                      (cdr result)))
     (setq vtimezone (icalendar-tests--get-ical-event "BEGIN:VTIMEZONE
-TZID:anothername
+TZID:anothername\, with a comma
 BEGIN:STANDARD
 DTSTART:16010101T040000
 TZOFFSETFROM:+0300
@@ -204,7 +204,7 @@ END:DAYLIGHT
 END:VTIMEZONE
 "))
     (setq result (icalendar--parse-vtimezone vtimezone))
-    (should (string= "anothername" (car result)))
+    (should (string= "anothername, with a comma" (car result)))
     (message (cdr result))
     (should (string= "STD-02:00DST-03:00,M3.2.1/03:00:00,M10.2.1/04:00:00"
                      (cdr result)))))
@@ -682,7 +682,7 @@ Argument EXPECTED-AMERICAN expected american style diary string."
         (unless (eq (char-before) ?\n)
           (insert "\n"))
         (insert "END:VEVENT\nEND:VCALENDAR\n"))
-      (let ((icalendar-import-format "%s%d%l%o%t%u%c")
+      (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
             (icalendar-import-format-summary "%s")
             (icalendar-import-format-location "\n Location: %s")
             (icalendar-import-format-description "\n Desc: %s")
@@ -690,6 +690,7 @@ Argument EXPECTED-AMERICAN expected american style diary string."
             (icalendar-import-format-status "\n Status: %s")
             (icalendar-import-format-url "\n URL: %s")
             (icalendar-import-format-class "\n Class: %s")
+            (icalendar-import-format-uid "\n UID: %s")
             calendar-date-style)
         (when expected-iso
           (setq calendar-date-style 'iso)
@@ -751,14 +752,17 @@ DTSTAMP:20031103T011641Z
    "&%%(and (diary-block 2004 7 19 2004 8 27)) Sommerferien
  Status: TENTATIVE
  Class: PRIVATE
+ UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
 "
    "&%%(and (diary-block 19 7 2004 27 8 2004)) Sommerferien
  Status: TENTATIVE
  Class: PRIVATE
+ UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
 "
    "&%%(and (diary-block 7 19 2004 8 27 2004)) Sommerferien
  Status: TENTATIVE
  Class: PRIVATE
+ UID: 748f2da0-0d9b-11d8-97af-b4ec8686ea61
 ")
   (icalendar-tests--test-import
    "UID
@@ -782,13 +786,16 @@ LAST-MODIFIED
 "
    "&2004/11/23 14:00-14:30 folded summary
  Status: TENTATIVE
- Class: PRIVATE\n"
+ Class: PRIVATE
+ UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
    "&23/11/2004 14:00-14:30 folded summary
  Status: TENTATIVE
- Class: PRIVATE\n"
+ Class: PRIVATE
+ UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n"
    "&11/23/2004 14:00-14:30 folded summary
  Status: TENTATIVE
- Class: PRIVATE\n")
+ Class: PRIVATE
+ UID: 04979712-3902-11d9-93dd-8f9f4afe08da\n")
 
   (icalendar-tests--test-import
    "UID
@@ -810,13 +817,16 @@ DTSTAMP
 "
    "&2004/11/23 14:45-15:45 another example
  Status: TENTATIVE
- Class: PRIVATE\n"
+ Class: PRIVATE
+ UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
    "&23/11/2004 14:45-15:45 another example
  Status: TENTATIVE
- Class: PRIVATE\n"
+ Class: PRIVATE
+ UID: 6161a312-3902-11d9-b512-f764153bb28b\n"
    "&11/23/2004 14:45-15:45 another example
  Status: TENTATIVE
- Class: PRIVATE\n"))
+ Class: PRIVATE
+ UID: 6161a312-3902-11d9-b512-f764153bb28b\n"))
 
 (ert-deftest icalendar-import-rrule ()
   (icalendar-tests--test-import
@@ -879,7 +889,6 @@ RRULE:FREQ=MONTHLY;UNTIL=20050819;
    "DTSTART;VALUE=DATE:20040815
 DTEND;VALUE=DATE:20040816
 SUMMARY:Maria Himmelfahrt
-UID:CC56BEA6-49D2-11D8-8833-00039386D1C2-RID
 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=8
 "
    "&%%(and (diary-anniversary 2004 8 15))  Maria Himmelfahrt\n"
@@ -982,11 +991,14 @@ SEQUENCE:1
 CREATED:20041127T183329
 "
    "&%%(and (diary-cyclic 1 2001 12 21) (diary-block 2001 12 21 2001 12 29))  Urlaub
- Class: PUBLIC\n"
+ Class: PUBLIC
+ UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
    "&%%(and (diary-cyclic 1 21 12 2001) (diary-block 21 12 2001 29 12 2001))  Urlaub
- Class: PUBLIC\n"
+ Class: PUBLIC
+ UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"
    "&%%(and (diary-cyclic 1 12 21 2001) (diary-block 12 21 2001 12 29 2001))  Urlaub
- Class: PUBLIC\n"))
+ Class: PUBLIC
+ UID: 20041127T183329Z-18215-1001-4536-49109@andromeda\n"))
 
 (ert-deftest icalendar-import-bug-6766 ()
   ;;bug#6766 -- multiple byday values in a weekly rrule
@@ -1016,20 +1028,26 @@ UID:8814e3f9-7482-408f-996c-3bfe486a1263
 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 2010 4 21)) 11:30-12:00 Scrum
  Status: CONFIRMED
  Class: PUBLIC
+ UID: 8814e3f9-7482-408f-996c-3bfe486a1262
 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 2010 4 22)) Tues + Thurs thinking
  Class: PUBLIC
+ UID: 8814e3f9-7482-408f-996c-3bfe486a1263
 "
 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 21 4 2010)) 11:30-12:00 Scrum
  Status: CONFIRMED
  Class: PUBLIC
+ UID: 8814e3f9-7482-408f-996c-3bfe486a1262
 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 22 4 2010)) Tues + Thurs thinking
  Class: PUBLIC
+ UID: 8814e3f9-7482-408f-996c-3bfe486a1263
 "
 "&%%(and (memq (calendar-day-of-week date) '(1 3 4 5)) (diary-cyclic 1 4 21 2010)) 11:30-12:00 Scrum
  Status: CONFIRMED
  Class: PUBLIC
+ UID: 8814e3f9-7482-408f-996c-3bfe486a1262
 &%%(and (memq (calendar-day-of-week date) '(2 4)) (diary-cyclic 1 4 22 2010)) Tues + Thurs thinking
  Class: PUBLIC
+ UID: 8814e3f9-7482-408f-996c-3bfe486a1263
 "))
 
 (ert-deftest icalendar-import-multiple-vcalendars ()
@@ -1074,6 +1092,55 @@ END:VCALENDAR
    "&23/7/2011 event-1\n&24/7/2011 event-2\n&25/7/2011 event-3a\n&25/7/2011 event-3b\n"
    "&7/23/2011 event-1\n&7/24/2011 event-2\n&7/25/2011 event-3a\n&7/25/2011 event-3b\n"))
 
+(ert-deftest icalendar-import-with-uid ()
+  "Perform import test with uid."
+  (icalendar-tests--test-import
+   "UID:1234567890uid
+SUMMARY:non-recurring
+DTSTART;VALUE=DATE-TIME:20030919T090000
+DTEND;VALUE=DATE-TIME:20030919T113000"
+   "&2003/9/19 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
+   "&19/9/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"
+   "&9/19/2003 09:00-11:30 non-recurring\n UID: 1234567890uid\n"))
+
+(ert-deftest icalendar-import-with-timezone ()
+  ;; bug#11473
+  (icalendar-tests--test-import
+   "BEGIN:VCALENDAR
+BEGIN:VTIMEZONE
+TZID:fictional\, nonexistent\, arbitrary
+BEGIN:STANDARD
+DTSTART:20100101T000000
+TZOFFSETFROM:+0200
+TZOFFSETTO:-0200
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=01
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:20101201T000000
+TZOFFSETFROM:-0200
+TZOFFSETTO:+0200
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+SUMMARY:standardtime
+DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20120115T120000
+DTEND;TZID=\"fictional, nonexistent, arbitrary\":20120115T123000
+END:VEVENT
+BEGIN:VEVENT
+SUMMARY:daylightsavingtime
+DTSTART;TZID=\"fictional, nonexistent, arbitrary\":20121215T120000
+DTEND;TZID=\"fictional, nonexistent, arbitrary\":20121215T123000
+END:VEVENT
+END:VCALENDAR"
+   ;; "standardtime" begins first sunday in january and is 4 hours behind CET
+   ;; "daylightsavingtime" begins first sunday in november and is 1 hour before CET
+   "&2012/1/15 15:00-15:30 standardtime
+&2012/12/15 11:00-11:30 daylightsavingtime
+"
+   nil
+   nil)
+  )
 ;; ======================================================================
 ;; Cycle
 ;; ======================================================================
@@ -1089,14 +1156,15 @@ Argument INPUT icalendar event string."
       (unless (eq (char-before) ?\n)
         (insert "\n"))
       (insert "END:VEVENT\nEND:VCALENDAR\n"))
-    (let ((icalendar-import-format "%s%d%l%o%t%u%c")
+    (let ((icalendar-import-format "%s%d%l%o%t%u%c%U")
           (icalendar-import-format-summary "%s")
           (icalendar-import-format-location "\n Location: %s")
           (icalendar-import-format-description "\n Desc: %s")
           (icalendar-import-format-organizer "\n Organizer: %s")
           (icalendar-import-format-status "\n Status: %s")
           (icalendar-import-format-url "\n URL: %s")
-          (icalendar-import-format-class "\n Class: %s"))
+          (icalendar-import-format-class "\n Class: %s")
+          (icalendar-import-format-class "\n UID: %s"))
       (dolist (calendar-date-style '(iso european american))
         (icalendar-tests--do-test-cycle)))))
 
@@ -1120,8 +1188,8 @@ Argument INPUT icalendar event string."
          (save-excursion
            (find-file temp-ics)
            (goto-char (point-min))
-           (when (re-search-forward "\nUID:.*\n" nil t)
-             (replace-match "\n"))
+           ;;(when (re-search-forward "\nUID:.*\n" nil t)
+             ;;(replace-match "\n"))
            (let ((cycled (buffer-substring-no-properties (point-min) (point-max))))
              (should (string= org-input cycled)))))
       ;; clean up
@@ -1134,14 +1202,17 @@ Argument INPUT icalendar event string."
       (delete-file temp-ics))))
 
 (ert-deftest icalendar-cycle ()
-  "Perform cycling tests."
+  "Perform cycling tests.
+Take care to avoid auto-generated UIDs here."
   (icalendar-tests--test-cycle
-   "DTSTART;VALUE=DATE-TIME:20030919T090000
+   "UID:dummyuid
+DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 SUMMARY:Cycletest
 ")
   (icalendar-tests--test-cycle
-   "DTSTART;VALUE=DATE-TIME:20030919T090000
+   "UID:blah
+DTSTART;VALUE=DATE-TIME:20030919T090000
 DTEND;VALUE=DATE-TIME:20030919T113000
 SUMMARY:Cycletest
 DESCRIPTION:beschreibung!
@@ -1149,7 +1220,8 @@ LOCATION:nowhere
 ORGANIZER:ulf
 ")
     (icalendar-tests--test-cycle
-     "DTSTART;VALUE=DATE:19190909
+     "UID:4711
+DTSTART;VALUE=DATE:19190909
 DTEND;VALUE=DATE:19190910
 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=09;BYMONTHDAY=09
 SUMMARY:and diary-anniversary
@@ -1222,12 +1294,14 @@ END:VCALENDAR"
  Location: Cccc
  Organizer: MAILTO:aaaaaaa@aaaaaaa.com
  Status: CONFIRMED
+ UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
 "
    "&5/9/2003 10:30-15:30 On-Site Interview
  Desc: 10:30am - Blah
  Location: Cccc
  Organizer: MAILTO:aaaaaaa@aaaaaaa.com
  Status: CONFIRMED
+ UID: 040000008200E00074C5B7101A82E0080000000080B6DE661216C301000000000000000010000000DB823520692542408ED02D7023F9DFF9
 ")
 
   ;; 2003-06-18 a
@@ -1268,12 +1342,14 @@ END:VALARM"
  Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
  Organizer: MAILTO:xxx@xxxxx.com
  Status: CONFIRMED
+ UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
 "
    "&6/23/2003 11:00-12:00 Dress Rehearsal for XXXX-XXXX
  Desc: 753 Zeichen hier radiert
  Location: 555 or TN 555-5555 ID 5555 & NochWas (see below)
  Organizer: MAILTO:xxx@xxxxx.com
  Status: CONFIRMED
+ UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
 ")
   ;; 2003-06-18 b -- uses timezone
   (icalendar-tests--test-import
@@ -1338,12 +1414,14 @@ END:VCALENDAR"
  Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
  Organizer: MAILTO:bbb@bbbbb.com
  Status: CONFIRMED
+ UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
 "
    "&6/23/2003 17:00-18:00 Updated: Dress Rehearsal for ABC01-15
  Desc: Viele Zeichen standen hier früher
  Location: 123 or TN 123-1234 ID abcd & SonstWo (see below)
  Organizer: MAILTO:bbb@bbbbb.com
  Status: CONFIRMED
+ UID: 040000008200E00074C5B7101A82E00800000000608AA7DA9835C3010000000000000000100000007C3A6D65EE726E40B7F3D69A23BD567E
 ")
   ;; export 2004-10-28 block entries
   (icalendar-tests--test-export
@@ -1567,8 +1645,6 @@ VERSION
 PRODID
  :-//Mozilla.org/NONSGML Mozilla Calendar V1.0//EN
 BEGIN:VEVENT
-UID
- :04979712-3902-11d9-93dd-8f9f4afe08da
 SUMMARY
  :Jjjjj & Wwwww
 STATUS
@@ -1587,8 +1663,6 @@ LAST-MODIFIED
  :20041118T013640Z
 END:VEVENT
 BEGIN:VEVENT
-UID
- :6161a312-3902-11d9-b512-f764153bb28b
 SUMMARY
  :BB Aaaaaaaa Bbbbb
 STATUS
@@ -1605,8 +1679,6 @@ DTSTAMP
  :20041118T013641Z
 END:VEVENT
 BEGIN:VEVENT
-UID
- :943a4d7e-3902-11d9-9ce7-c9addeadf928
 SUMMARY
  :Hhhhhhhh
 STATUS
@@ -1623,8 +1695,6 @@ DTSTAMP
  :20041118T013831Z
 END:VEVENT
 BEGIN:VEVENT
-UID
- :fe53615e-3902-11d9-9dd8-9d38a155bf41
 SUMMARY
  :MMM Aaaaaaaaa
 STATUS
@@ -1645,8 +1715,6 @@ DTSTAMP
  :20041118T014117Z
 END:VEVENT
 BEGIN:VEVENT
-UID
- :87c928ee-3901-11d9-b21f-b45042155024
 SUMMARY
  :Rrrr/Cccccc ii Aaaaaaaa
 DESCRIPTION
@@ -1669,8 +1737,6 @@ LAST-MODIFIED
  :20041118T014203Z
 END:VEVENT
 BEGIN:VEVENT
-UID
- :e8f331ae-3902-11d9-9948-dfdcb66a2872
 SUMMARY
  :Wwww aa hhhh
 STATUS
@@ -1790,11 +1856,13 @@ DTSTAMP
  Desc: abcdef
  Status: CONFIRMED
  Class: PRIVATE
+ UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
 "
    "&%%(and (diary-block 2 6 2005 2 6 2005)) Waitangi Day
  Desc: abcdef
  Status: CONFIRMED
  Class: PRIVATE
+ UID: b60d398e-1dd1-11b2-a159-cf8cb05139f4
 ")
 
   ;; 2005-03-01 lt
@@ -1805,8 +1873,10 @@ UID:6AFA7558-6994-11D9-8A3A-000A95A0E830-RID
 DTSTAMP:20050118T210335Z
 DURATION:P7D"
    nil
-   "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n"
-   "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa\n")
+   "&%%(and (diary-block 17 2 2005 23 2 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
+ UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n"
+   "&%%(and (diary-block 2 17 2005 2 23 2005)) Hhhhhh Aaaaa ii Aaaaaaaa
+ UID: 6AFA7558-6994-11D9-8A3A-000A95A0E830-RID\n")
 
   ;; 2005-03-23 lt
   (icalendar-tests--test-export
@@ -1831,7 +1901,72 @@ DTEND;VALUE=DATE:19001102
 RRULE:FREQ=YEARLY;INTERVAL=1;BYMONTH=11;BYMONTHDAY=1
 SUMMARY:NNN Wwwwwwww Wwwww - Aaaaaa Pppppppp rrrrrr ddd oo Nnnnnnnn 30
 ")
-  )
+
+  ;; bug#11473
+  (icalendar-tests--test-import
+   "BEGIN:VCALENDAR
+METHOD:REQUEST
+PRODID:Microsoft Exchange Server 2007
+VERSION:2.0
+BEGIN:VTIMEZONE
+TZID:(UTC+01:00) Amsterdam\, Berlin\, Bern\, Rome\, Stockholm\, Vienna
+BEGIN:STANDARD
+DTSTART:16010101T030000
+TZOFFSETFROM:+0200
+TZOFFSETTO:+0100
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=10
+END:STANDARD
+BEGIN:DAYLIGHT
+DTSTART:16010101T020000
+TZOFFSETFROM:+0100
+TZOFFSETTO:+0200
+RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=-1SU;BYMONTH=3
+END:DAYLIGHT
+END:VTIMEZONE
+BEGIN:VEVENT
+ORGANIZER;CN=\"A. Luser\":MAILTO:a.luser@foo.com
+ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;RSVP=TRUE;CN=\"Luser, Oth
+ er\":MAILTO:other.luser@foo.com
+DESCRIPTION;LANGUAGE=en-US:\nWhassup?\n\n
+SUMMARY;LANGUAGE=en-US:Query
+DTSTART;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\"
+ :20120515T150000
+DTEND;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna\":2
+ 0120515T153000
+UID:040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000
+ 010000000575268034ECDB649A15349B1BF240F15
+RECURRENCE-ID;TZID=\"(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, V
+ ienna\":20120515T170000
+CLASS:PUBLIC
+PRIORITY:5
+DTSTAMP:20120514T153645Z
+TRANSP:OPAQUE
+STATUS:CONFIRMED
+SEQUENCE:15
+LOCATION;LANGUAGE=en-US:phone
+X-MICROSOFT-CDO-APPT-SEQUENCE:15
+X-MICROSOFT-CDO-OWNERAPPTID:1907632092
+X-MICROSOFT-CDO-BUSYSTATUS:TENTATIVE
+X-MICROSOFT-CDO-INTENDEDSTATUS:BUSY
+X-MICROSOFT-CDO-ALLDAYEVENT:FALSE
+X-MICROSOFT-CDO-IMPORTANCE:1
+X-MICROSOFT-CDO-INSTTYPE:3
+BEGIN:VALARM
+ACTION:DISPLAY
+DESCRIPTION:REMINDER
+TRIGGER;RELATED=START:-PT15M
+END:VALARM
+END:VEVENT
+END:VCALENDAR"
+   nil
+   "&15/5/2012 15:00-15:30 Query
+ Location: phone
+ Organizer: MAILTO:a.luser@foo.com
+ Status: CONFIRMED
+ Class: PUBLIC
+ UID: 040000008200E00074C5B7101A82E0080000000020FFAED0CFEFCC01000000000000000010000000575268034ECDB649A15349B1BF240F15
+"     nil)
+)
 
 (provide 'icalendar-tests)
 ;;; icalendar-tests.el ends here
diff --git a/test/automated/url-util-tests.el b/test/automated/url-util-tests.el
new file mode 100644 (file)
index 0000000..65eb37c
--- /dev/null
@@ -0,0 +1,51 @@
+;;; url-util-tests.el --- Test suite for url-util.
+
+;; Copyright (C) 2012  Free Software Foundation, Inc.
+
+;; Author: Teodor Zlatanov <tzz@lifelogs.com>
+;; Keywords: data
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Code:
+
+(require 'ert)
+(require 'url-util)
+
+(ert-deftest url-util-tests ()
+  (let ((tests
+         '(("key1=val1&key2=val2&key3=val1&key3=val2&key4&key5"
+            ((key1 val1) (key2 "val2") (key3 val1 val2) (key4) (key5 "")))
+           ("key1=val1;key2=val2;key3=val1;key3=val2;key4;key5"
+            ((key1 "val1") (key2 val2) (key3 val1 val2) ("key4") (key5 "")) t)
+           ("key1=val1;key2=val2;key3=val1;key3=val2;key4=;key5="
+            ((key1 val1) (key2 val2) ("key3" val1 val2) (key4) (key5 "")) t t)))
+        test)
+    (while tests
+      (setq test (car tests)
+            tests (cdr tests))
+      (should (equal (apply 'url-build-query-string (cdr test)) (car test)))))
+  (should (equal (url-parse-query-string
+                  "key1=val1&key2=val2&key3=val1&key3=val2&key4=&key5")
+                 '(("key5" "")
+                   ("key4" "")
+                   ("key3" "val2" "val1")
+                   ("key2" "val2")
+                   ("key1" "val1")))))
+
+(provide 'url-util-tests)
+
+;;; url-util-tests.el ends here
index 904ab4d13047d42e293dfc1e25255fdff949ac68..94f8502b88298a52cee0bc05eb73cc9a836c9437 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-bzr.el --- tests for vc/vc-bzr.el
 
-;; Copyright (C) 2011-2012  Free Software Foundation, Inc.
+;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <rgm@gnu.org>
 
           (should (get-buffer "*vc-log*")))
       (delete-directory tempdir t))))
 
+;; http://lists.gnu.org/archive/html/help-gnu-emacs/2012-04/msg00145.html
+(ert-deftest vc-bzr-test-faulty-bzr-autoloads ()
+  "Test we can generate autoloads in a bzr directory when bzr is faulty."
+  :expected-result (if (executable-find vc-bzr-program) :passed :failed)
+  (should (executable-find vc-bzr-program))
+  (let* ((tempdir (make-temp-file "vc-bzr-test" t))
+         (file (expand-file-name "foo.el" tempdir))
+         (default-directory (file-name-as-directory tempdir))
+         (generated-autoload-file (expand-file-name "loaddefs.el" tempdir)))
+    (unwind-protect
+        (progn
+          (call-process vc-bzr-program nil nil nil "init")
+          (with-temp-buffer
+            (insert ";;;###autoload
+\(defun foo () \"foo\" (interactive) (message \"foo!\"))")
+            (write-region nil nil file nil 'silent))
+          (call-process vc-bzr-program nil nil nil "add")
+          (call-process vc-bzr-program nil nil nil "commit" "-m" "Commit 1")
+          ;; Deleting dirstate ensures both that vc-bzr's status heuristic
+          ;; fails, so it has to call the external bzr status, and
+          ;; causes bzr status to fail.  This simulates a broken bzr
+          ;; installation.
+          (delete-file ".bzr/checkout/dirstate")
+          (should (progn (update-directory-autoloads default-directory)
+                         t)))
+      (delete-directory tempdir t))))
+
 ;;; vc-bzr.el ends here
diff --git a/test/automated/xml-parse-tests.el b/test/automated/xml-parse-tests.el
new file mode 100644 (file)
index 0000000..e655306
--- /dev/null
@@ -0,0 +1,94 @@
+;;; xml-parse-tests.el --- Test suite for XML parsing.
+
+;; Copyright (C) 2012 Free Software Foundation, Inc.
+
+;; Author: Chong Yidong <cyd@stupidchicken.com>
+;; Keywords:       internal
+;; Human-Keywords: internal
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Type M-x test-xml-parse RET to generate the test buffer.
+
+;;; Code:
+
+(require 'xml)
+
+(defvar xml-parse-tests--data
+  `(;; General entity substitution
+    ("<?xml version=\"1.0\"?><!DOCTYPE foo SYSTEM \"bar.dtd\" [<!ENTITY ent \"AbC\">]><foo a=\"b\"><bar>&ent;;</bar></foo>" .
+     ((foo ((a . "b")) (bar nil "AbC;"))))
+    ("<?xml version=\"1.0\"?><foo>&amp;amp;&#x26;apos;&apos;&lt;&gt;&quot;</foo>" .
+     ((foo () "&amp;&apos;'<>\"")))
+    ;; Parameter entity substitution
+    ("<?xml version=\"1.0\"?><!DOCTYPE foo SYSTEM \"bar.dtd\" [<!ENTITY % pent \"AbC\"><!ENTITY ent \"%pent;\">]><foo a=\"b\"><bar>&ent;;</bar></foo>" .
+     ((foo ((a . "b")) (bar nil "AbC;"))))
+    ;; Tricky parameter entity substitution (like XML spec Appendix D)
+    ("<?xml version='1.0'?><!DOCTYPE foo [ <!ENTITY % xx '&#37;zz;'><!ENTITY % zz '&#60;!ENTITY ent \"b\" >' > %xx; ]><foo>A&ent;C</foo>" .
+     ((foo () "AbC")))
+    ;; Bug#7172
+    ("<?xml version=\"1.0\"?><!DOCTYPE foo [ <!ELEMENT EXAM_PLE EMPTY> ]><foo></foo>" .
+     ((foo ())))
+    ;; Entities referencing entities, in character data
+    ("<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">]><foo>&abc;</foo>" .
+     ((foo () "aBc")))
+    ;; Entities referencing entities, in attribute values
+    ("<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">]><foo a=\"-&abc;-\">1</foo>" .
+     ((foo ((a . "-aBc-")) "1")))
+    ;; Character references must be treated as character data
+    ("<foo>AT&amp;T;</foo>" . ((foo () "AT&T;")))
+    ("<foo>&#38;amp;</foo>" . ((foo () "&amp;")))
+    ("<foo>&#x26;amp;</foo>" . ((foo () "&amp;")))
+    ;; Unusual but valid XML names [5]
+    ("<ÀÖØö.3·-‿⁀󯿿>abc</ÀÖØö.3·-‿⁀󯿿>" . ((,(intern "ÀÖØö.3·-‿⁀󯿿") () "abc")))
+    ("<:>abc</:>" . ((,(intern ":") () "abc"))))
+  "Alist of XML strings and their expected parse trees.")
+
+(defvar xml-parse-tests--bad-data
+  '(;; XML bomb in content
+    "<!DOCTYPE foo [<!ENTITY lol \"lol\"><!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\"><!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">]><foo>&lol2;</foo>"
+    ;; XML bomb in attribute value
+    "<!DOCTYPE foo [<!ENTITY lol \"lol\"><!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\"><!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">]><foo a=\"&lol2;\">!</foo>"
+    ;; Non-terminating DTD
+    "<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">"
+    "<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">asdf"
+    "<!DOCTYPE foo [ <!ENTITY b \"B\"><!ENTITY abc \"a&b;c\">asdf&abc;"
+    ;; Invalid XML names
+    "<0foo>abc</0foo>"
+    "<‿foo>abc</‿foo>"
+    "<f¿>abc</f¿>")
+  "List of XML strings that should signal an error in the parser")
+
+(ert-deftest xml-parse-tests ()
+  "Test XML parsing."
+  (with-temp-buffer
+    (dolist (test xml-parse-tests--data)
+      (erase-buffer)
+      (insert (car test))
+      (should (equal (cdr test) (xml-parse-region))))
+    (let ((xml-entity-expansion-limit 50))
+      (dolist (test xml-parse-tests--bad-data)
+       (erase-buffer)
+       (insert test)
+       (should-error (xml-parse-region))))))
+
+;; Local Variables:
+;; no-byte-compile: t
+;; End:
+
+;;; xml-parse-tests.el ends here.
index 7acb34b6029f0d7884bf8fa714deff7233912ead..4d6480c81bb0265924ceca6076052645ddbdcfc2 100644 (file)
@@ -28,7 +28,7 @@
 ;;; Code:
 
 (eval-when-compile
-  (require 'cl)                                ; assert
+  (require 'cl-lib)
   (require 'eshell)
   (require 'esh-util))
 (require 'esh-mode)
 
 (eshell-deftest banner banner-displayed
   "Startup banner is displayed at point-min"
-  (assert eshell-banner-message)
+  (cl-assert eshell-banner-message)
   (let ((msg (eval eshell-banner-message)))
-    (assert msg)
+    (cl-assert msg)
     (goto-char (point-min))
     (looking-at msg)))
 
diff --git a/test/indent/latex-mode.tex b/test/indent/latex-mode.tex
new file mode 100644 (file)
index 0000000..55c8e70
--- /dev/null
@@ -0,0 +1,11 @@
+\documentclass{article}         % -*- eval: (bug-reference-mode 1) -*-
+
+\usepackage[utf8]{inputenc}
+
+\begin{document}
+
+To fix this, remove the \url{sn9c102.ko} from where it appears in
+\url{/lib/modules/$(uname -r)},  %bug#11953.
+and install the appropriate \url{gspca-modules} package.
+
+\end{document}
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
new file mode 100644 (file)
index 0000000..c4a747a
--- /dev/null
@@ -0,0 +1,19 @@
+# Don't mis-match "sub" at the end of words.
+a = asub / aslb + bsub / bslb;
+
+b = %Q{This is a "string"}
+c = %w(foo
+ bar
+ baz)
+d = %!hello!
+
+# A "do" after a slash means that slash is not a division, but it doesn't imply
+# it's a regexp-ender, since it can be a regexp-starter instead!
+x = toto / foo; if /do bar/ then
+                  toto = 1
+                end
+
+# Some Cucumber code:
+Given /toto/ do
+  print "hello"
+end
index 841223555b94fdcab528ffddf49dd5f99b261a12..e5c63e335b9c3f22913d718fdd44e40cd28d31fc 100755 (executable)
@@ -1,7 +1,10 @@
 #!/bin/rc
 
 if (foo) {
-    echo 1
+    echo 1 \
+         toto \
+         tutu
+    titi
 }
 if not {
     echo 2
@@ -23,6 +26,10 @@ switch ($a) {
         for (i in a b c)
             echo "$i"           # KNOWN INDENT BUG
         echo titi
+        if (foo)
+            echo 3             # KNOWN INDENT BUG
+        if not
+            echo 4             # KNOWN INDENT BUG
 
     case *
        echo other
index 89f47d0bfe35971d9d449de9156a7b58811e30d2..957fe74fdeed82f890c7de6da669857636e47d86 100755 (executable)
@@ -1,9 +1,17 @@
 #!/bin/sh
+# -*- eval: (bug-reference-mode 1) -*-
 
 setlock -n /tmp/getmail.lock && echo getmail isn\'t running
 
 # adsgsdg
 
+declare -a VERSION
+for i in $(ls "$PREFIX/sbin") ; do
+    echo -e $N')' $i
+    VERSION[${#VERSION[*]}]=$i         #bug#11946.
+    N=$(($N + 1))
+done
+
 foo () {
 
     bar () {
@@ -13,6 +21,7 @@ foo () {
     case toto
     in a) hello                 # KNOWN INDENT BUG
     ;; b) hi                    # KNOWN INDENT BUG
+    ;; c) hi                    # KNOWN INDENT BUG
     esac
 
     case $toto in
@@ -34,7 +43,8 @@ foo () {
             sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
             ;;
     esac |
-        cat                     # KNOWN INDENT BUG
+        grep '.' |              # KNOWN INDENT BUG
+        sed 1d
     
     case toto in
         -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
diff --git a/vpath.sed b/vpath.sed
deleted file mode 100644 (file)
index a792eb0..0000000
--- a/vpath.sed
+++ /dev/null
@@ -1,8 +0,0 @@
-/^VPATH *=/c\
-# This works only in GNU make.  Using the patterns avoids\
-# object files being found by VPATH, and thus permits building\
-# when $srcdir is configured itself.\
-vpath %.c $(srcdir)\
-vpath %.h $(srcdir)\
-\
-